]> err.no Git - linux-2.6/blobdiff - arch/powerpc/kernel/of_device.c
[PATCH] Add comments to the PDA structure to annotate offsets
[linux-2.6] / arch / powerpc / kernel / of_device.c
index 7065e40e2f42ac8661fb372c371911aa17c76a23..397c83eda20ee3ac907c929e526bf59510b7b5f1 100644 (file)
@@ -1,4 +1,3 @@
-#include <linux/config.h>
 #include <linux/string.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -132,6 +131,8 @@ static int of_device_resume(struct device * dev)
 struct bus_type of_platform_bus_type = {
        .name   = "of_platform",
        .match  = of_platform_bus_match,
+       .probe  = of_device_probe,
+       .remove = of_device_remove,
        .suspend        = of_device_suspend,
        .resume = of_device_resume,
 };
@@ -145,17 +146,12 @@ postcore_initcall(of_bus_driver_init);
 
 int of_register_driver(struct of_platform_driver *drv)
 {
-       int count = 0;
-
        /* initialize common driver fields */
        drv->driver.name = drv->name;
        drv->driver.bus = &of_platform_bus_type;
-       drv->driver.probe = of_device_probe;
-       drv->driver.remove = of_device_remove;
 
        /* register with core */
-       count = driver_register(&drv->driver);
-       return count ? count : 1;
+       return driver_register(&drv->driver);
 }
 
 void of_unregister_driver(struct of_platform_driver *drv)
@@ -193,27 +189,9 @@ void of_release_dev(struct device *dev)
 int of_device_register(struct of_device *ofdev)
 {
        int rc;
-       struct of_device **odprop;
 
        BUG_ON(ofdev->node == NULL);
 
-       odprop = (struct of_device **)get_property(ofdev->node, "linux,device", NULL);
-       if (!odprop) {
-               struct property *new_prop;
-       
-               new_prop = kmalloc(sizeof(struct property) + sizeof(struct of_device *),
-                       GFP_KERNEL);
-               if (new_prop == NULL)
-                       return -ENOMEM;
-               new_prop->name = "linux,device";
-               new_prop->length = sizeof(sizeof(struct of_device *));
-               new_prop->value = (unsigned char *)&new_prop[1];
-               odprop = (struct of_device **)new_prop->value;
-               *odprop = NULL;
-               prom_add_property(ofdev->node, new_prop);
-       }
-       *odprop = ofdev;
-
        rc = device_register(&ofdev->dev);
        if (rc)
                return rc;
@@ -225,14 +203,8 @@ int of_device_register(struct of_device *ofdev)
 
 void of_device_unregister(struct of_device *ofdev)
 {
-       struct of_device **odprop;
-
        device_remove_file(&ofdev->dev, &dev_attr_devspec);
 
-       odprop = (struct of_device **)get_property(ofdev->node, "linux,device", NULL);
-       if (odprop)
-               *odprop = NULL;
-
        device_unregister(&ofdev->dev);
 }