reset: Use device_get_match_data()
authorRob Herring <robh@kernel.org>
Wed, 15 Nov 2023 20:58:48 +0000 (14:58 -0600)
committerPhilipp Zabel <p.zabel@pengutronix.de>
Tue, 28 Nov 2023 16:23:01 +0000 (17:23 +0100)
Use preferred device_get_match_data() instead of of_match_device() to
get the driver match data. With this, adjust the includes to explicitly
include the correct headers.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Link: https://lore.kernel.org/r/20231115205848.3732609-1-robh@kernel.org
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
drivers/reset/reset-npcm.c
drivers/reset/sti/reset-syscfg.c

index f6c4f854f2be073321048538935b3ac16bef8c6e..8935ef95a2d1fc6ff517ae276577903ae53d36d1 100644 (file)
@@ -6,8 +6,8 @@
 #include <linux/io.h>
 #include <linux/init.h>
 #include <linux/of.h>
-#include <linux/of_device.h>
 #include <linux/platform_device.h>
+#include <linux/property.h>
 #include <linux/reboot.h>
 #include <linux/reset-controller.h>
 #include <linux/spinlock.h>
@@ -351,8 +351,7 @@ static int npcm_usb_reset(struct platform_device *pdev, struct npcm_rc_data *rc)
                }
        }
 
-       rc->info = (const struct npcm_reset_info *)
-                       of_match_device(dev->driver->of_match_table, dev)->data;
+       rc->info = device_get_match_data(dev);
        switch (rc->info->bmc_id) {
        case BMC_NPCM7XX:
                npcm_usb_reset_npcm7xx(rc);
index c1ba04f6f1554b879d11d47829ebb44651ed706b..2324060b747c863cb896f467a19c54b721ebf7d2 100644 (file)
@@ -7,10 +7,11 @@
  */
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
+#include <linux/property.h>
 #include <linux/module.h>
 #include <linux/err.h>
 #include <linux/types.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
 #include <linux/regmap.h>
 #include <linux/mfd/syscon.h>
 
@@ -183,14 +184,14 @@ static int syscfg_reset_controller_register(struct device *dev,
 int syscfg_reset_probe(struct platform_device *pdev)
 {
        struct device *dev = pdev ? &pdev->dev : NULL;
-       const struct of_device_id *match;
+       const void *data;
 
        if (!dev || !dev->driver)
                return -ENODEV;
 
-       match = of_match_device(dev->driver->of_match_table, dev);
-       if (!match || !match->data)
+       data = device_get_match_data(&pdev->dev);
+       if (!data)
                return -EINVAL;
 
-       return syscfg_reset_controller_register(dev, match->data);
+       return syscfg_reset_controller_register(dev, data);
 }