Skip to content

Commit c1d8841

Browse files
robherringpH5
authored andcommitted
reset: Use device_get_match_data()
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>
1 parent 41df5d7 commit c1d8841

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

drivers/reset/reset-npcm.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
#include <linux/io.h>
77
#include <linux/init.h>
88
#include <linux/of.h>
9-
#include <linux/of_device.h>
109
#include <linux/platform_device.h>
10+
#include <linux/property.h>
1111
#include <linux/reboot.h>
1212
#include <linux/reset-controller.h>
1313
#include <linux/spinlock.h>
@@ -351,8 +351,7 @@ static int npcm_usb_reset(struct platform_device *pdev, struct npcm_rc_data *rc)
351351
}
352352
}
353353

354-
rc->info = (const struct npcm_reset_info *)
355-
of_match_device(dev->driver->of_match_table, dev)->data;
354+
rc->info = device_get_match_data(dev);
356355
switch (rc->info->bmc_id) {
357356
case BMC_NPCM7XX:
358357
npcm_usb_reset_npcm7xx(rc);

drivers/reset/sti/reset-syscfg.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@
77
*/
88
#include <linux/kernel.h>
99
#include <linux/platform_device.h>
10+
#include <linux/property.h>
1011
#include <linux/module.h>
1112
#include <linux/err.h>
1213
#include <linux/types.h>
13-
#include <linux/of_device.h>
14+
#include <linux/of.h>
1415
#include <linux/regmap.h>
1516
#include <linux/mfd/syscon.h>
1617

@@ -183,14 +184,14 @@ static int syscfg_reset_controller_register(struct device *dev,
183184
int syscfg_reset_probe(struct platform_device *pdev)
184185
{
185186
struct device *dev = pdev ? &pdev->dev : NULL;
186-
const struct of_device_id *match;
187+
const void *data;
187188

188189
if (!dev || !dev->driver)
189190
return -ENODEV;
190191

191-
match = of_match_device(dev->driver->of_match_table, dev);
192-
if (!match || !match->data)
192+
data = device_get_match_data(&pdev->dev);
193+
if (!data)
193194
return -EINVAL;
194195

195-
return syscfg_reset_controller_register(dev, match->data);
196+
return syscfg_reset_controller_register(dev, data);
196197
}

0 commit comments

Comments
 (0)