of: Merge of_platform_bus_type with platform_bus_type

of_platform_bus was being used in the same manner as the platform_bus.
The only difference being that of_platform_bus devices are generated
from data in the device tree, and platform_bus devices are usually
statically allocated in platform code.  Having them separate causes
the problem of device drivers having to be registered twice if it
was possible for the same device to appear on either bus.

This patch removes of_platform_bus_type and registers all of_platform
bus devices and drivers on the platform bus instead.  A previous patch
made the of_device structure an alias for the platform_device structure,
and a shim is used to adapt of_platform_drivers to the platform bus.

After all of of_platform_bus drivers are converted to be normal platform
drivers, the shim code can be removed.

Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Grant Likely
2010-06-08 07:48:21 -06:00
parent 05212157e9
commit eca3930163
16 changed files with 102 additions and 103 deletions

View File

@@ -424,7 +424,7 @@ build_resources:
build_device_resources(op, parent);
op->dev.parent = parent;
op->dev.bus = &of_platform_bus_type;
op->dev.bus = &platform_bus_type;
if (!parent)
dev_set_name(&op->dev, "root");
else
@@ -452,30 +452,19 @@ static void __init scan_tree(struct device_node *dp, struct device *parent)
}
}
static void __init scan_of_devices(void)
static int __init scan_of_devices(void)
{
struct device_node *root = of_find_node_by_path("/");
struct of_device *parent;
parent = scan_one_device(root, NULL);
if (!parent)
return;
return 0;
scan_tree(root->child, &parent->dev);
return 0;
}
static int __init of_bus_driver_init(void)
{
int err;
err = of_bus_type_init(&of_platform_bus_type, "of");
if (!err)
scan_of_devices();
return err;
}
postcore_initcall(of_bus_driver_init);
postcore_initcall(scan_of_devices);
static int __init of_debug(char *str)
{