extern int buses_init(void);
extern int classes_init(void);
extern int firmware_init(void);
+extern int platform_bus_init(void);
extern int sys_bus_init(void);
extern int cpu_dev_init(void);
/* These are also core pieces, but must come after the
* core core pieces.
*/
+ platform_bus_init();
sys_bus_init();
cpu_dev_init();
}
if (pdev)
device_unregister(&pdev->dev);
}
-
+
+
+/**
+ * platform_match - bind platform device to platform driver.
+ * @dev: device.
+ * @drv: driver.
+ *
+ * Platform device IDs are assumed to be encoded like this:
+ * "<name><instance>", where <name> is a short description of the
+ * type of device, like "pci" or "floppy", and <instance> is the
+ * enumerated instance of the device, like '0' or '42'.
+ * Driver IDs are simply "<name>".
+ * So, extract the <name> from the device, and compare it against
+ * the name of the driver. Return whether they match or not.
+ */
+
static int platform_match(struct device * dev, struct device_driver * drv)
{
+ char name[BUS_ID_SIZE];
+
+ if (sscanf(dev->bus_id,"%s",name))
+ return (strcmp(name,drv->name) == 0);
+
return 0;
}
.match = platform_match,
};
-static int __init platform_bus_init(void)
+int __init platform_bus_init(void)
{
device_register(&legacy_bus);
return bus_register(&platform_bus_type);
}
-postcore_initcall(platform_bus_init);
-
EXPORT_SYMBOL(platform_device_register);
EXPORT_SYMBOL(platform_device_unregister);