summaryrefslogtreecommitdiff
path: root/drivers/base/pinctrl.c
diff options
context:
space:
mode:
authorJohan Hovold <johan@kernel.org>2017-06-06 17:59:00 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-06-13 11:07:32 +0200
commit4e75e1d7dac9d7c95c57eceb451d01f2afcc8626 (patch)
treec7828d2df441bb5dfa75f143184399e25cfcc3c2 /drivers/base/pinctrl.c
parent60a93cffcffdc86222c184aafc622b53b8460427 (diff)
driver core: add helper to reuse a device-tree node
Add a helper function to be used when reusing the device-tree node of another device. It is fairly common for drivers to reuse the device-tree node of a parent (or other ancestor) device when creating class or bus devices (e.g. gpio chips, i2c adapters, iio chips, spi masters, serdev, phys, usb root hubs). But reusing a device-tree node may cause problems if the new device is later probed as for example driver core would currently attempt to reinitialise an already active associated pinmux configuration. Other potential issues include the platform-bus code unconditionally dropping the device-tree node reference in its device destructor, reinitialisation of other bus-managed resources such as clocks, and the recently added DMA-setup in driver core. Note that for most examples above this is currently not an issue as the devices are never probed, but this is a problem for the USB bus which has recently gained device-tree support. This was discovered and worked-around in a rather ad-hoc fashion by commit dc5878abf49c ("usb: core: move root hub's device node assignment after it is added to bus") by not setting the of_node pointer until after the root-hub device has been registered. Instead we can allow devices to reuse a device-tree node by setting a flag in their struct device that can be used by core, bus and driver code to avoid resources from being over-allocated. Note that the helper also grabs an extra reference to the device node, which specifically balances the unconditional put in the platform-device destructor. Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/pinctrl.c')
0 files changed, 0 insertions, 0 deletions