[PATCH 2.6.21-rc1] ibmebus: make root device not of_device-based

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The fake root device doesn't have an associated device tree node,
so it should not be an of_device. This patch makes it a normal,
bus-less device and thus saves a lot of checks later on.


Signed-off-by: Joachim Fenkes <[email protected]>
---


 ibmebus.c |   33 ++++++++++++++-------------------
 1 files changed, 14 insertions(+), 19 deletions(-)


diff -urp a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
--- a/arch/powerpc/kernel/ibmebus.c	2007-02-20 01:35:54.000000000 +0100
+++ b/arch/powerpc/kernel/ibmebus.c	2007-02-20 01:39:24.000000000 +0100
@@ -44,9 +44,8 @@
 #include <asm/ibmebus.h>
 #include <asm/abs_addr.h>
 
-static struct ibmebus_dev ibmebus_bus_device = { /* fake "parent" device */
-	.ofdev.dev.bus_id = "ibmebus",
-	.ofdev.dev.bus    = &ibmebus_bus_type,
+static struct device ibmebus_bus_device = { /* fake "parent" device */
+	.bus_id = "ibmebus",
 };
 
 static void *ibmebus_alloc_coherent(struct device *dev,
@@ -173,7 +172,7 @@ static struct ibmebus_dev* __devinit ibm
 {
 	int err = 0;
 
-	dev->ofdev.dev.parent  = &ibmebus_bus_device.ofdev.dev;
+	dev->ofdev.dev.parent  = &ibmebus_bus_device;
 	dev->ofdev.dev.bus     = &ibmebus_bus_type;
 	dev->ofdev.dev.release = ibmebus_dev_release;
 
@@ -268,14 +267,12 @@ static int ibmebus_match_helper_name(str
 	const struct ibmebus_dev *ebus_dev = to_ibmebus_dev(dev);
 	char *name;
 
-	/* parent device has no of_device node, so skip it */
-	if (ebus_dev != &ibmebus_bus_device) {
-		name = (char*)get_property(
-			ebus_dev->ofdev.node, "name", NULL);
+	name = (char*)get_property(
+		ebus_dev->ofdev.node, "name", NULL);
+
+	if (name && (strcmp((char*)data, name) == 0))
+		return 1;
 
-		if (name && (strcmp((char*)data, name) == 0))
-			return 1;
-	}
 	return 0;
 }
 
@@ -384,14 +381,12 @@ static int ibmebus_match_helper_loc_code
 	const struct ibmebus_dev *ebus_dev = to_ibmebus_dev(dev);
 	char *loc_code;
 
-	/* parent device has no of_device node, so skip it */
-	if (ebus_dev != &ibmebus_bus_device) {
-		loc_code = (char*)get_property(
-			ebus_dev->ofdev.node, "ibm,loc-code", NULL);
+	loc_code = (char*)get_property(
+		ebus_dev->ofdev.node, "ibm,loc-code", NULL);
+
+	if (loc_code && (strcmp((char*)data, loc_code) == 0))
+		return 1;
 
-		if (loc_code && (strcmp((char*)data, loc_code) == 0))
-			return 1;
-	}
 	return 0;
 }
 
@@ -449,7 +444,7 @@ static int __init ibmebus_bus_init(void)
 		return err;
 	}
 
-	err = device_register(&ibmebus_bus_device.ofdev.dev);
+	err = device_register(&ibmebus_bus_device);
 	if (err) {
 		printk(KERN_WARNING "%s: device_register returned %i\n",
 		       __FUNCTION__, err);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux