Subject: [patch 1/1] sn: fixes due to driver core changes

From: [email-masked]
Date: Thu, 28 Apr 2005 17:11:52 -0700

From: Patrick Mochel <[email-masked]>

Signed-off-by: Andrew Morton <[email-masked]>
Signed-off-by: Greg Kroah-Hartman <[email-masked]>

---
 arch/ia64/sn/kernel/tiocx.c |   21 +++++++++------------
 1 files changed, 9 insertions(+), 12 deletions(-)

--- gregkh-2.6.orig/arch/ia64/sn/kernel/tiocx.c	2005-05-05 10:53:40.000000000 -0700
+++ gregkh-2.6/arch/ia64/sn/kernel/tiocx.c	2005-05-05 11:09:32.000000000 -0700
@@ -518,25 +518,22 @@
 	return 0;
 }
 
-static void __exit tiocx_exit(void)
+static int cx_remove_device(struct device * dev, void * data)
 {
-	struct device *dev;
-	struct device *tdev;
+	struct cx_dev *cx_dev = to_cx_dev(dev);
+	device_remove_file(dev, &dev_attr_cxdev_control);
+	cx_device_unregister(cx_dev);
+	return 0;
+}
 
+static void __exit tiocx_exit(void)
+{
 	DBG("tiocx_exit\n");
 
 	/*
 	 * Unregister devices.
 	 */
-	list_for_each_entry_safe(dev, tdev, &tiocx_bus_type.devices.list,
-				 bus_list) {
-		if (dev) {
-			struct cx_dev *cx_dev = to_cx_dev(dev);
-			device_remove_file(dev, &dev_attr_cxdev_control);
-			cx_device_unregister(cx_dev);
-		}
-	}
-
+	bus_for_each_dev(&tiocx_bus_type, NULL, NULL, cx_remove_device);
 	bus_unregister(&tiocx_bus_type);
 }