Skip to content

Commit 3ba9fdf

Browse files
robherringUlf Hansson
authored andcommitted
pmdomain: 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> Link: https://lore.kernel.org/r/20231006224614.444488-1-robh@kernel.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent e8fa18d commit 3ba9fdf

3 files changed

Lines changed: 12 additions & 24 deletions

File tree

drivers/pmdomain/actions/owl-sps.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
* Copyright (c) 2017 Andreas Färber
99
*/
1010

11+
#include <linux/mod_devicetable.h>
1112
#include <linux/of_address.h>
12-
#include <linux/of_platform.h>
13+
#include <linux/platform_device.h>
14+
#include <linux/property.h>
1315
#include <linux/pm_domain.h>
1416
#include <linux/soc/actions/owl-sps.h>
1517
#include <dt-bindings/power/owl-s500-powergate.h>
@@ -96,24 +98,16 @@ static int owl_sps_init_domain(struct owl_sps *sps, int index)
9698

9799
static int owl_sps_probe(struct platform_device *pdev)
98100
{
99-
const struct of_device_id *match;
100101
const struct owl_sps_info *sps_info;
101102
struct owl_sps *sps;
102103
int i, ret;
103104

104-
if (!pdev->dev.of_node) {
105-
dev_err(&pdev->dev, "no device node\n");
106-
return -ENODEV;
107-
}
108-
109-
match = of_match_device(pdev->dev.driver->of_match_table, &pdev->dev);
110-
if (!match || !match->data) {
105+
sps_info = device_get_match_data(&pdev->dev);
106+
if (!sps_info) {
111107
dev_err(&pdev->dev, "unknown compatible or missing data\n");
112108
return -EINVAL;
113109
}
114110

115-
sps_info = match->data;
116-
117111
sps = devm_kzalloc(&pdev->dev,
118112
struct_size(sps, domains, sps_info->num_domains),
119113
GFP_KERNEL);

drivers/pmdomain/imx/gpc.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@
77
#include <linux/clk.h>
88
#include <linux/delay.h>
99
#include <linux/io.h>
10-
#include <linux/of_device.h>
10+
#include <linux/of.h>
1111
#include <linux/platform_device.h>
1212
#include <linux/pm_domain.h>
13+
#include <linux/property.h>
1314
#include <linux/regmap.h>
1415
#include <linux/regulator/consumer.h>
1516

@@ -403,9 +404,7 @@ static int imx_gpc_old_dt_init(struct device *dev, struct regmap *regmap,
403404

404405
static int imx_gpc_probe(struct platform_device *pdev)
405406
{
406-
const struct of_device_id *of_id =
407-
of_match_device(imx_gpc_dt_ids, &pdev->dev);
408-
const struct imx_gpc_dt_data *of_id_data = of_id->data;
407+
const struct imx_gpc_dt_data *of_id_data = device_get_match_data(&pdev->dev);
409408
struct device_node *pgc_node;
410409
struct regmap *regmap;
411410
void __iomem *base;

drivers/pmdomain/rockchip/pm-domains.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@
99
#include <linux/iopoll.h>
1010
#include <linux/err.h>
1111
#include <linux/mutex.h>
12+
#include <linux/platform_device.h>
1213
#include <linux/pm_clock.h>
1314
#include <linux/pm_domain.h>
15+
#include <linux/property.h>
16+
#include <linux/of.h>
1417
#include <linux/of_address.h>
1518
#include <linux/of_clk.h>
16-
#include <linux/of_platform.h>
1719
#include <linux/clk.h>
1820
#include <linux/regmap.h>
1921
#include <linux/mfd/syscon.h>
@@ -857,7 +859,6 @@ static int rockchip_pm_domain_probe(struct platform_device *pdev)
857859
struct device_node *node;
858860
struct device *parent;
859861
struct rockchip_pmu *pmu;
860-
const struct of_device_id *match;
861862
const struct rockchip_pmu_info *pmu_info;
862863
int error;
863864

@@ -866,13 +867,7 @@ static int rockchip_pm_domain_probe(struct platform_device *pdev)
866867
return -ENODEV;
867868
}
868869

869-
match = of_match_device(dev->driver->of_match_table, dev);
870-
if (!match || !match->data) {
871-
dev_err(dev, "missing pmu data\n");
872-
return -EINVAL;
873-
}
874-
875-
pmu_info = match->data;
870+
pmu_info = device_get_match_data(dev);
876871

877872
pmu = devm_kzalloc(dev,
878873
struct_size(pmu, domains, pmu_info->num_domains),

0 commit comments

Comments
 (0)