drivers: Introduce device lookup variants by of_node

Introduce wrappers for {bus/driver/class}_find_device() to
locate devices by its of_node.

Cc: Maarten Lankhorst <[email protected]>
Cc: Maxime Ripard <[email protected]>
Cc: [email protected]
Cc: David Airlie <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: [email protected]
Cc: Florian Fainelli <[email protected]>
Cc: Frank Rowand <[email protected]>
Cc: Heiko Stuebner <[email protected]>
Cc: Liam Girdwood <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: Mathieu Poirier <[email protected]>
Cc: Rob Herring <[email protected]>
Cc: Srinivas Kandagatla <[email protected]>
Cc: Takashi Iwai <[email protected]>
Cc: Alan Tull <[email protected]>
Cc: [email protected]
Cc: Peter Rosin <[email protected]>
Cc: Florian Fainelli <[email protected]>
Cc: Heiner Kallweit <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Andrew Lunn <[email protected]>
Cc: Liam Girdwood <[email protected]>
Cc: "Rafael J. Wysocki" <[email protected]>
Cc: Thor Thayer <[email protected]>
Cc: Jiri Slaby <[email protected]>
Cc: Andrew Lunn <[email protected]>
Cc: Peter Rosin <[email protected]>
Signed-off-by: Suzuki K Poulose <[email protected]>
Acked-by: Lee Jones <[email protected]>
Acked-by: Wolfram Sang <[email protected]> # I2C part
Acked-by: Moritz Fischer <[email protected]> # For FPGA part
Acked-by: Mark Brown <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
Suzuki K Poulose 2019-07-23 23:18:33 +01:00 • committed by Greg Kroah-Hartman
commit cfba5de9b9
15 changed files with 56 additions and 110 deletions

View file

@ -19,11 +19,6 @@ static struct class *fpga_bridge_class;
/* Lock for adding/removing bridges to linked lists*/
static spinlock_t bridge_list_lock;
static int fpga_bridge_of_node_match(struct device *dev, const void *data)
{
return dev->of_node == data;
}
/**
* fpga_bridge_enable - Enable transactions on the bridge
*
@ -104,8 +99,7 @@ struct fpga_bridge *of_fpga_bridge_get(struct device_node *np,
{
struct device *dev;
dev = class_find_device(fpga_bridge_class, NULL, np,
fpga_bridge_of_node_match);
dev = class_find_device_by_of_node(fpga_bridge_class, np);
if (!dev)
return ERR_PTR(-ENODEV);

View file

@ -482,11 +482,6 @@ struct fpga_manager *fpga_mgr_get(struct device *dev)
}
EXPORT_SYMBOL_GPL(fpga_mgr_get);
static int fpga_mgr_of_node_match(struct device *dev, const void *data)
{
return dev->of_node == data;
}
/**
* of_fpga_mgr_get - Given a device node, get a reference to a fpga mgr.
*
@ -498,8 +493,7 @@ struct fpga_manager *of_fpga_mgr_get(struct device_node *node)
{
struct device *dev;
dev = class_find_device(fpga_mgr_class, NULL, node,
fpga_mgr_of_node_match);
dev = class_find_device_by_of_node(fpga_mgr_class, node);
if (!dev)
return ERR_PTR(-ENODEV);