diff options
Diffstat (limited to 'drivers/spmi/spmi.c')
-rw-r--r-- | drivers/spmi/spmi.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/spmi/spmi.c b/drivers/spmi/spmi.c index b37ead9e2fad..a456ce5141e1 100644 --- a/drivers/spmi/spmi.c +++ b/drivers/spmi/spmi.c @@ -387,6 +387,23 @@ static struct bus_type spmi_bus_type = { }; /** + * spmi_device_from_of() - get the associated SPMI device from a device node + * + * @np: device node + * + * Returns the struct spmi_device associated with a device node or NULL. + */ +struct spmi_device *spmi_device_from_of(struct device_node *np) +{ + struct device *dev = bus_find_device_by_of_node(&spmi_bus_type, np); + + if (dev) + return to_spmi_device(dev); + return NULL; +} +EXPORT_SYMBOL_GPL(spmi_device_from_of); + +/** * spmi_controller_alloc() - Allocate a new SPMI device * @ctrl: associated controller * |