Skip to content

Commit

Permalink
of/platform: Move platform devices under /sys/devices/platform
Browse files Browse the repository at this point in the history
Currently the devices created by drivers/of/platform.c get created at
the root of /sys/devices. This goes against the typical pattern for
sysfs where the top level /sys/devices structure contains categories of
devices, and the structure of devices is placed below that. To fix this,
make the code in drivers/of/platform.c follow the drivers/base/platform.c
behaviour, and use &platform_bus as the default parent for all new
platform_devices and amba_devices.

This change has been discussed for a long time, but nobody has actually
acted on it. Userspace code that expects to find devices under a fixed
/sys/devices/... path will be affected. It isn't /supposed/ to do that,
but if anyone complains then I'll add a default-off workaround option to
put them back into the root.

Signed-off-by: Grant Likely <[email protected]>
Acked-by: Benjamin Herrenschmidt <[email protected]>
Acked-by: Greg Kroah-Hartman <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Arnd Bergmann <[email protected]>
  • Loading branch information
glikely committed Nov 4, 2014
1 parent 5f56358 commit 43c0767
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/of/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ struct platform_device *of_device_alloc(struct device_node *np,
}

dev->dev.of_node = of_node_get(np);
dev->dev.parent = parent;
dev->dev.parent = parent ? : &platform_bus;

if (bus_id)
dev_set_name(&dev->dev, "%s", bus_id);
Expand Down Expand Up @@ -291,7 +291,7 @@ static struct amba_device *of_amba_device_create(struct device_node *node,

/* setup generic device info */
dev->dev.of_node = of_node_get(node);
dev->dev.parent = parent;
dev->dev.parent = parent ? : &platform_bus;
dev->dev.platform_data = platform_data;
if (bus_id)
dev_set_name(&dev->dev, "%s", bus_id);
Expand Down

0 comments on commit 43c0767

Please sign in to comment.