Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 204928
b: refs/heads/master
c: eca3930
h: refs/heads/master
v: v3
  • Loading branch information
Grant Likely committed Jul 24, 2010
1 parent c0379c0 commit 1387780
Show file tree
Hide file tree
Showing 17 changed files with 103 additions and 104 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 05212157e94ccf4cf458413bbba509cfa95ff92b
refs/heads/master: eca3930163ba8884060ce9d9ff5ef0d9b7c7b00f
11 changes: 0 additions & 11 deletions trunk/arch/microblaze/kernel/of_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,6 @@
#include <linux/topology.h>
#include <asm/atomic.h>

struct bus_type of_platform_bus_type = {
.uevent = of_device_uevent,
};
EXPORT_SYMBOL(of_platform_bus_type);

static int __init of_bus_driver_init(void)
{
return of_bus_type_init(&of_platform_bus_type, "of_platform");
}
postcore_initcall(of_bus_driver_init);

/*
* The list of OF IDs below is used for matching bus types in the
* system whose devices are to be exposed as of_platform_devices.
Expand Down
6 changes: 0 additions & 6 deletions trunk/arch/microblaze/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,9 @@ static struct notifier_block dflt_plat_bus_notifier = {
.priority = INT_MAX,
};

static struct notifier_block dflt_of_bus_notifier = {
.notifier_call = dflt_bus_notify,
.priority = INT_MAX,
};

static int __init setup_bus_notifier(void)
{
bus_register_notifier(&platform_bus_type, &dflt_plat_bus_notifier);
bus_register_notifier(&of_platform_bus_type, &dflt_of_bus_notifier);

return 0;
}
Expand Down
8 changes: 0 additions & 8 deletions trunk/arch/powerpc/kernel/dma-swiotlb.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,9 @@ static struct notifier_block ppc_swiotlb_plat_bus_notifier = {
.priority = 0,
};

static struct notifier_block ppc_swiotlb_of_bus_notifier = {
.notifier_call = ppc_swiotlb_bus_notify,
.priority = 0,
};

int __init swiotlb_setup_bus_notifier(void)
{
bus_register_notifier(&platform_bus_type,
&ppc_swiotlb_plat_bus_notifier);
bus_register_notifier(&of_platform_bus_type,
&ppc_swiotlb_of_bus_notifier);

return 0;
}
12 changes: 0 additions & 12 deletions trunk/arch/powerpc/kernel/of_platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,6 @@ const struct of_device_id of_default_bus_ids[] = {
{},
};

struct bus_type of_platform_bus_type = {
.uevent = of_device_uevent,
};
EXPORT_SYMBOL(of_platform_bus_type);

static int __init of_bus_driver_init(void)
{
return of_bus_type_init(&of_platform_bus_type, "of_platform");
}

postcore_initcall(of_bus_driver_init);

static int of_dev_node_match(struct device *dev, void *data)
{
return to_of_device(dev)->dev.of_node == data;
Expand Down
7 changes: 0 additions & 7 deletions trunk/arch/powerpc/kernel/setup-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -701,16 +701,9 @@ static struct notifier_block ppc_dflt_plat_bus_notifier = {
.priority = INT_MAX,
};

static struct notifier_block ppc_dflt_of_bus_notifier = {
.notifier_call = ppc_dflt_bus_notify,
.priority = INT_MAX,
};

static int __init setup_bus_notifier(void)
{
bus_register_notifier(&platform_bus_type, &ppc_dflt_plat_bus_notifier);
bus_register_notifier(&of_platform_bus_type, &ppc_dflt_of_bus_notifier);

return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/powerpc/platforms/cell/beat_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ static int __init celleb_init_iommu(void)
celleb_init_direct_mapping();
set_pci_dma_ops(&dma_direct_ops);
ppc_md.pci_dma_dev_setup = celleb_pci_dma_dev_setup;
bus_register_notifier(&of_platform_bus_type, &celleb_of_bus_notifier);
bus_register_notifier(&platform_bus_type, &celleb_of_bus_notifier);

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/powerpc/platforms/cell/iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,7 @@ static int __init cell_iommu_init(void)
/* Register callbacks on OF platform device addition/removal
* to handle linking them to the right DMA operations
*/
bus_register_notifier(&of_platform_bus_type, &cell_of_bus_notifier);
bus_register_notifier(&platform_bus_type, &cell_of_bus_notifier);

return 0;
}
Expand Down
7 changes: 1 addition & 6 deletions trunk/arch/powerpc/sysdev/mv64x60_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@

#include <asm/prom.h>

/*
* These functions provide the necessary setup for the mv64x60 drivers.
* These drivers are unusual in that they work on both the MIPS and PowerPC
* architectures. Because of that, the drivers do not support the normal
* PowerPC of_platform_bus_type. They support platform_bus_type instead.
*/
/* These functions provide the necessary setup for the mv64x60 drivers. */

static struct of_device_id __initdata of_mv64x60_devices[] = {
{ .compatible = "marvell,mv64306-devctrl", },
Expand Down
21 changes: 5 additions & 16 deletions trunk/arch/sparc/kernel/of_device_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
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
Expand Down Expand Up @@ -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)
{
Expand Down
21 changes: 5 additions & 16 deletions trunk/arch/sparc/kernel/of_device_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
op->archdata.irqs[i] = build_one_device_irq(op, parent, op->archdata.irqs[i]);

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
Expand Down Expand Up @@ -695,30 +695,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)
{
Expand Down
3 changes: 0 additions & 3 deletions trunk/arch/sparc/kernel/of_device_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ void of_propagate_archdata(struct of_device *bus)
}
}

struct bus_type of_platform_bus_type;
EXPORT_SYMBOL(of_platform_bus_type);

static void get_cells(struct device_node *dp, int *addrc, int *sizec)
{
if (addrc)
Expand Down
6 changes: 6 additions & 0 deletions trunk/drivers/base/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,12 @@ static struct device_attribute platform_dev_attrs[] = {
static int platform_uevent(struct device *dev, struct kobj_uevent_env *env)
{
struct platform_device *pdev = to_platform_device(dev);
int rc;

/* Some devices have extra OF data and an OF-style MODALIAS */
rc = of_device_uevent(dev,env);
if (rc != -ENODEV)
return rc;

add_uevent_var(env, "MODALIAS=%s%s", PLATFORM_MODULE_PREFIX,
(pdev->id_entry) ? pdev->id_entry->name : pdev->name);
Expand Down
5 changes: 5 additions & 0 deletions trunk/drivers/of/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ int of_device_register(struct of_device *ofdev)

device_initialize(&ofdev->dev);

/* name and id have to be set so that the platform bus doesn't get
* confused on matching */
ofdev->name = dev_name(&ofdev->dev);
ofdev->id = -1;

/* device_add will assume that this device is on the same node as
* the parent. If there is no parent defined, set the node
* explicitly */
Expand Down
67 changes: 64 additions & 3 deletions trunk/drivers/of/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,54 @@
#include <linux/of_device.h>
#include <linux/of_irq.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>

static int platform_driver_probe_shim(struct platform_device *pdev)
{
struct platform_driver *pdrv;
struct of_platform_driver *ofpdrv;
const struct of_device_id *match;

pdrv = container_of(pdev->dev.driver, struct platform_driver, driver);
ofpdrv = container_of(pdrv, struct of_platform_driver, platform_driver);
match = of_match_device(pdev->dev.driver->of_match_table, &pdev->dev);
return ofpdrv->probe(pdev, match);
}

static void platform_driver_shutdown_shim(struct platform_device *pdev)
{
struct platform_driver *pdrv;
struct of_platform_driver *ofpdrv;

pdrv = container_of(pdev->dev.driver, struct platform_driver, driver);
ofpdrv = container_of(pdrv, struct of_platform_driver, platform_driver);
ofpdrv->shutdown(pdev);
}

/**
* of_register_platform_driver
*/
int of_register_platform_driver(struct of_platform_driver *drv)
{
/* setup of_platform_driver to platform_driver adaptors */
drv->platform_driver.driver = drv->driver;
if (drv->probe)
drv->platform_driver.probe = platform_driver_probe_shim;
drv->platform_driver.remove = drv->remove;
if (drv->shutdown)
drv->platform_driver.shutdown = platform_driver_shutdown_shim;
drv->platform_driver.suspend = drv->suspend;
drv->platform_driver.resume = drv->resume;

return platform_driver_register(&drv->platform_driver);
}
EXPORT_SYMBOL(of_register_platform_driver);

void of_unregister_platform_driver(struct of_platform_driver *drv)
{
platform_driver_unregister(&drv->platform_driver);
}
EXPORT_SYMBOL(of_unregister_platform_driver);

#if defined(CONFIG_PPC_DCR)
#include <asm/dcr.h>
Expand Down Expand Up @@ -392,16 +440,29 @@ int of_bus_type_init(struct bus_type *bus, const char *name)

int of_register_driver(struct of_platform_driver *drv, struct bus_type *bus)
{
drv->driver.bus = bus;
/*
* Temporary: of_platform_bus used to be distinct from the platform
* bus. It isn't anymore, and so drivers on the platform bus need
* to be registered in a special way.
*
* After all of_platform_bus_type drivers are converted to
* platform_drivers, this exception can be removed.
*/
if (bus == &platform_bus_type)
return of_register_platform_driver(drv);

/* register with core */
drv->driver.bus = bus;
return driver_register(&drv->driver);
}
EXPORT_SYMBOL(of_register_driver);

void of_unregister_driver(struct of_platform_driver *drv)
{
driver_unregister(&drv->driver);
if (drv->driver.bus == &platform_bus_type)
of_unregister_platform_driver(drv);
else
driver_unregister(&drv->driver);
}
EXPORT_SYMBOL(of_unregister_driver);

Expand Down Expand Up @@ -548,7 +609,7 @@ struct of_device *of_platform_device_create(struct device_node *np,
dev->archdata.dma_mask = 0xffffffffUL;
#endif
dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
dev->dev.bus = &of_platform_bus_type;
dev->dev.bus = &platform_bus_type;

/* We do not fill the DMA ops for platform devices by default.
* This is currently the responsibility of the platform code
Expand Down
6 changes: 6 additions & 0 deletions trunk/include/linux/of_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ static inline int of_driver_match_device(struct device *dev,
return 0;
}

static inline int of_device_uevent(struct device *dev,
struct kobj_uevent_env *env)
{
return -ENODEV;
}

#endif /* CONFIG_OF_DEVICE */

#endif /* _LINUX_OF_DEVICE_H */
Loading

0 comments on commit 1387780

Please sign in to comment.