[RFC,49/57] drivers: mfd: altera: Use driver_find_device_by_of_node() helper
diff mbox series

Message ID 1559577023-558-50-git-send-email-suzuki.poulose@arm.com
State New
Headers show
Series
  • [RFC,01/57] drivers: s390/cio: Use driver_for_each_device
Related show

Commit Message

Suzuki K Poulose June 3, 2019, 3:50 p.m. UTC
Use the new helper to find device by of_node.

Cc: Thor Thayer <thor.thayer@linux.intel.com>
Cc: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 drivers/mfd/altera-sysmgr.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

Comments

Thor Thayer June 4, 2019, 4:13 p.m. UTC | #1
On 6/3/19 10:50 AM, Suzuki K Poulose wrote:
> Use the new helper to find device by of_node.
> 
> Cc: Thor Thayer <thor.thayer@linux.intel.com>
> Cc: Lee Jones <lee.jones@linaro.org>
> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>

Acked-by: Thor Thayer <thor.thayer@linux.intel.com>

Patch
diff mbox series

diff --git a/drivers/mfd/altera-sysmgr.c b/drivers/mfd/altera-sysmgr.c
index 2ee14d8..1fbe06c 100644
--- a/drivers/mfd/altera-sysmgr.c
+++ b/drivers/mfd/altera-sysmgr.c
@@ -88,16 +88,6 @@  static struct regmap_config altr_sysmgr_regmap_cfg = {
 };
 
 /**
- * sysmgr_match_phandle
- * Matching function used by driver_find_device().
- * Return: True if match is found, otherwise false.
- */
-static int sysmgr_match_phandle(struct device *dev, const void *data)
-{
-	return dev->of_node == (const struct device_node *)data;
-}
-
-/**
  * altr_sysmgr_regmap_lookup_by_phandle
  * Find the sysmgr previous configured in probe() and return regmap property.
  * Return: regmap if found or error if not found.
@@ -117,8 +107,8 @@  struct regmap *altr_sysmgr_regmap_lookup_by_phandle(struct device_node *np,
 	if (!sysmgr_np)
 		return ERR_PTR(-ENODEV);
 
-	dev = driver_find_device(&altr_sysmgr_driver.driver, NULL,
-				 (void *)sysmgr_np, sysmgr_match_phandle);
+	dev = driver_find_device_by_of_node(&altr_sysmgr_driver.driver, NULL,
+					    (void *)sysmgr_np);
 	of_node_put(sysmgr_np);
 	if (!dev)
 		return ERR_PTR(-EPROBE_DEFER);