pmdomain: Use device_get_match_data()
PATCH 1/1 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 <[email protected]>
--- drivers/pmdomain/actions/owl-sps.c | 16 +++++----------- drivers/pmdomain/imx/gpc.c | 7 +++---- drivers/pmdomain/rockchip/pm-domains.c | 13 ++++--------- 3 files changed, 12 insertions(+), 24 deletions(-)
drivers/pmdomain/actions/owl-sps.c +5 -11
@@ -8,8 +8,10 @@* Copyright (c) 2017 Andreas Färber */ +#include <linux/mod_devicetable.h> #include <linux/of_address.h> -#include <linux/of_platform.h> +#include <linux/platform_device.h> +#include <linux/property.h> #include <linux/pm_domain.h> #include <linux/soc/actions/owl-sps.h> #include <dt-bindings/power/owl-s500-powergate.h>
@@ -96,24 +98,16 @@ static int owl_sps_init_domain(struct owl_sps *sps, int index)static int owl_sps_probe (struct platform_device *pdev) { -const struct of_device_id *match;const struct owl_sps_info *sps_info;struct owl_sps *sps;int i, ret; -if (!pdev->dev.of_node) { -dev_err (&pdev->dev,"no device node\n" ); -return -ENODEV ; - } - - match =of_match_device (pdev->dev.driver->of_match_table, &pdev->dev); -if (!match || !match->data) { + sps_info =device_get_match_data (&pdev->dev); +if (!sps_info) {dev_err (&pdev->dev,"unknown compatible or missing data\n" );return -EINVAL ; } - sps_info = match->data; - sps =devm_kzalloc (&pdev->dev,struct_size (sps, domains, sps_info->num_domains),GFP_KERNEL );
drivers/pmdomain/imx/gpc.c +3 -4
@@ -7,9 +7,10 @@#include <linux/clk.h> #include <linux/delay.h> #include <linux/io.h> -#include <linux/of_device.h> +#include <linux/of.h> #include <linux/platform_device.h> #include <linux/pm_domain.h> +#include <linux/property.h> #include <linux/regmap.h> #include <linux/regulator/consumer.h>
@@ -403,9 +404,7 @@ static int imx_gpc_old_dt_init(struct device *dev, struct regmap *regmap,static int imx_gpc_probe (struct platform_device *pdev) { -const struct of_device_id *of_id = -of_match_device (imx_gpc_dt_ids, &pdev->dev); -const struct imx_gpc_dt_data *of_id_data = of_id->data; +const struct imx_gpc_dt_data *of_id_data =device_get_match_data (&pdev->dev);struct device_node *pgc_node;struct regmap *regmap;void __iomem *base;
drivers/pmdomain/rockchip/pm-domains.c +4 -9
@@ -9,11 +9,13 @@#include <linux/iopoll.h> #include <linux/err.h> #include <linux/mutex.h> +#include <linux/platform_device.h> #include <linux/pm_clock.h> #include <linux/pm_domain.h> +#include <linux/property.h> +#include <linux/of.h> #include <linux/of_address.h> #include <linux/of_clk.h> -#include <linux/of_platform.h> #include <linux/clk.h> #include <linux/regmap.h> #include <linux/mfd/syscon.h>
@@ -857,7 +859,6 @@ static int rockchip_pm_domain_probe(struct platform_device *pdev)struct device_node *node;struct device *parent;struct rockchip_pmu *pmu; -const struct of_device_id *match;const struct rockchip_pmu_info *pmu_info;int error;
@@ -866,13 +867,7 @@ static int rockchip_pm_domain_probe(struct platform_device *pdev)return -ENODEV ; } - match =of_match_device (dev->driver->of_match_table, dev); -if (!match || !match->data) { -dev_err (dev,"missing pmu data\n" ); -return -EINVAL ; - } - - pmu_info = match->data; + pmu_info =device_get_match_data (dev); pmu = devm_kzalloc(dev, struct_size(pmu, domains, pmu_info->num_domains),
Signature · 1 line
2.40.1
Quoted 6 lines · Rob Herring
Use preferred
device_get_match_data()instead ofof_match_device()to get the driver match data. With this, adjust the includes to explicitly include the correct headers.Signed-off-by Rob Herring <[email protected]>
Applied for next, thanks!
Kind regards
Uffe
Quoted 121 lines
--- drivers/pmdomain/actions/owl-sps.c | 16 +++++----------- drivers/pmdomain/imx/gpc.c | 7 +++---- drivers/pmdomain/rockchip/pm-domains.c | 13 ++++--------- 3 files changed, 12 insertions(+), 24 deletions(-)drivers/pmdomain/actions/owl-sps.c +5
-11@@ -8,8 +8,10 @@* Copyright (c) 2017 Andreas Färber */ +#include <linux/mod_devicetable.h> #include <linux/of_address.h> -#include <linux/of_platform.h> +#include <linux/platform_device.h> +#include <linux/property.h> #include <linux/pm_domain.h> #include <linux/soc/actions/owl-sps.h> #include <dt-bindings/power/owl-s500-powergate.h> @@ -96,24 +98,16 @@ static int owl_sps_init_domain(struct owl_sps *sps, int index)static int owl_sps_probe (struct platform_device *pdev) { -const struct of_device_id *match;const struct owl_sps_info *sps_info;struct owl_sps *sps;int i, ret; -if (!pdev->dev.of_node) { -dev_err (&pdev->dev,"no device node\n" ); -return -ENODEV ; - } - - match =of_match_device (pdev->dev.driver->of_match_table, &pdev->dev); -if (!match || !match->data) { + sps_info =device_get_match_data (&pdev->dev); +if (!sps_info) {dev_err (&pdev->dev,"unknown compatible or missing data\n" );return -EINVAL ; } - sps_info = match->data; - sps =devm_kzalloc (&pdev->dev,struct_size (sps, domains, sps_info->num_domains),GFP_KERNEL );drivers/pmdomain/imx/gpc.c +3
-4@@ -7,9 +7,10 @@#include <linux/clk.h> #include <linux/delay.h> #include <linux/io.h> -#include <linux/of_device.h> +#include <linux/of.h> #include <linux/platform_device.h> #include <linux/pm_domain.h> +#include <linux/property.h> #include <linux/regmap.h> #include <linux/regulator/consumer.h> @@ -403,9 +404,7 @@ static int imx_gpc_old_dt_init(struct device *dev, struct regmap *regmap,static int imx_gpc_probe (struct platform_device *pdev) { -const struct of_device_id *of_id = -of_match_device (imx_gpc_dt_ids, &pdev->dev); -const struct imx_gpc_dt_data *of_id_data = of_id->data; +const struct imx_gpc_dt_data *of_id_data =device_get_match_data (&pdev->dev);struct device_node *pgc_node;struct regmap *regmap;void __iomem *base;drivers/pmdomain/rockchip/pm-domains.c +4
-10@@ -9,11 +9,13 @@#include <linux/iopoll.h> #include <linux/err.h> #include <linux/mutex.h> +#include <linux/platform_device.h> #include <linux/pm_clock.h> #include <linux/pm_domain.h> +#include <linux/property.h> +#include <linux/of.h> #include <linux/of_address.h> #include <linux/of_clk.h> -#include <linux/of_platform.h> #include <linux/clk.h> #include <linux/regmap.h> #include <linux/mfd/syscon.h> @@ -857,7 +859,6 @@ static int rockchip_pm_domain_probe(struct platform_device *pdev)struct device_node *node;struct device *parent;struct rockchip_pmu *pmu; -const struct of_device_id *match;const struct rockchip_pmu_info *pmu_info;int error;@@ -866,13 +867,7 @@ static int rockchip_pm_domain_probe(struct platform_device *pdev)return -ENODEV ; } - match =of_match_device (dev->driver->of_match_table, dev); -if (!match || !match->data) { -dev_err (dev,"missing pmu data\n" ); -return -EINVAL ; - } - - pmu_info = match->data; + pmu_info =device_get_match_data (dev); pmu = devm_kzalloc(dev, struct_size(pmu, domains, pmu_info->num_domains), --2.40.1