pinctrl: Use device_get_match_data()
Subsystems (7)
PATCH 1/1 pinctrl: 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/pinctrl/bcm/pinctrl-ns.c | 8 ++------ drivers/pinctrl/berlin/berlin-bg2.c | 8 +++----- drivers/pinctrl/berlin/berlin-bg2cd.c | 8 +++----- drivers/pinctrl/berlin/berlin-bg2q.c | 8 +++----- drivers/pinctrl/berlin/berlin-bg4ct.c | 9 +++++---- drivers/pinctrl/berlin/pinctrl-as370.c | 9 +++++---- drivers/pinctrl/mvebu/pinctrl-armada-38x.c | 9 ++------- drivers/pinctrl/mvebu/pinctrl-armada-39x.c | 9 ++------- drivers/pinctrl/mvebu/pinctrl-armada-ap806.c | 5 +---- drivers/pinctrl/mvebu/pinctrl-armada-cp110.c | 6 ++---- drivers/pinctrl/mvebu/pinctrl-armada-xp.c | 9 ++------- drivers/pinctrl/mvebu/pinctrl-dove.c | 6 ++---- drivers/pinctrl/mvebu/pinctrl-kirkwood.c | 7 ++----- drivers/pinctrl/mvebu/pinctrl-orion.c | 7 ++----- drivers/pinctrl/nomadik/pinctrl-abx500.c | 9 ++------- drivers/pinctrl/nomadik/pinctrl-nomadik.c | 10 ++++------ drivers/pinctrl/pinctrl-at91.c | 11 +++++------ drivers/pinctrl/pinctrl-xway.c | 11 ++++------- drivers/pinctrl/ti/pinctrl-ti-iodelay.c | 18 ++++++++---------- 19 files changed, 59 insertions(+), 108 deletions(-)
drivers/pinctrl/bcm/pinctrl-ns.c +2 -6
@@ -7,11 +7,11 @@#include <linux/io.h> #include <linux/module.h> #include <linux/of.h> -#include <linux/of_device.h> #include <linux/pinctrl/pinconf-generic.h> #include <linux/pinctrl/pinctrl.h> #include <linux/pinctrl/pinmux.h> #include <linux/platform_device.h> +#include <linux/property.h> #include <linux/slab.h> #include "../core.h"
@@ -208,7 +208,6 @@ static const struct of_device_id ns_pinctrl_of_match_table[] = {static int ns_pinctrl_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; -const struct of_device_id *of_id;struct ns_pinctrl *ns_pinctrl;struct pinctrl_desc *pctldesc;struct pinctrl_pin_desc *pin;
@@ -225,10 +224,7 @@ static int ns_pinctrl_probe(struct platform_device *pdev) ns_pinctrl->dev = dev; - of_id =of_match_device (ns_pinctrl_of_match_table, dev); -if (!of_id) -return -EINVAL ; - ns_pinctrl->chipset_flag = (uintptr_t )of_id->data; + ns_pinctrl->chipset_flag = (uintptr_t )device_get_match_data (dev); res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"cru_gpio_control" );
drivers/pinctrl/berlin/berlin-bg2.c +3 -5
@@ -8,8 +8,9 @@*/ #include <linux/init.h> -#include <linux/of_device.h> +#include <linux/of.h> #include <linux/platform_device.h> +#include <linux/property.h> #include <linux/regmap.h> #include "berlin.h"
@@ -227,10 +228,7 @@ static const struct of_device_id berlin2_pinctrl_match[] = {static int berlin2_pinctrl_probe (struct platform_device *pdev) { -const struct of_device_id *match = -of_match_device (berlin2_pinctrl_match, &pdev->dev); - -return berlin_pinctrl_probe (pdev, match->data); +return berlin_pinctrl_probe (pdev,device_get_match_data (&pdev->dev)); }static struct platform_driver berlin2_pinctrl_driver = {
drivers/pinctrl/berlin/berlin-bg2cd.c +3 -5
@@ -8,8 +8,9 @@*/ #include <linux/init.h> -#include <linux/of_device.h> +#include <linux/of.h> #include <linux/platform_device.h> +#include <linux/property.h> #include <linux/regmap.h> #include "berlin.h"
@@ -172,10 +173,7 @@ static const struct of_device_id berlin2cd_pinctrl_match[] = {static int berlin2cd_pinctrl_probe (struct platform_device *pdev) { -const struct of_device_id *match = -of_match_device (berlin2cd_pinctrl_match, &pdev->dev); - -return berlin_pinctrl_probe (pdev, match->data); +return berlin_pinctrl_probe (pdev,device_get_match_data (&pdev->dev)); }static struct platform_driver berlin2cd_pinctrl_driver = {
drivers/pinctrl/berlin/berlin-bg2q.c +3 -5
@@ -8,8 +8,9 @@*/ #include <linux/init.h> -#include <linux/of_device.h> +#include <linux/of.h> #include <linux/platform_device.h> +#include <linux/property.h> #include <linux/regmap.h> #include "berlin.h"
@@ -389,10 +390,7 @@ static const struct of_device_id berlin2q_pinctrl_match[] = {static int berlin2q_pinctrl_probe (struct platform_device *pdev) { -const struct of_device_id *match = -of_match_device (berlin2q_pinctrl_match, &pdev->dev); - -return berlin_pinctrl_probe (pdev, match->data); +return berlin_pinctrl_probe (pdev,device_get_match_data (&pdev->dev)); }static struct platform_driver berlin2q_pinctrl_driver = {
drivers/pinctrl/berlin/berlin-bg4ct.c +5 -4
@@ -8,8 +8,9 @@*/ #include <linux/init.h> -#include <linux/of_device.h> +#include <linux/of.h> #include <linux/platform_device.h> +#include <linux/property.h> #include <linux/regmap.h> #include "berlin.h"
@@ -449,8 +450,8 @@ static const struct of_device_id berlin4ct_pinctrl_match[] = {static int berlin4ct_pinctrl_probe (struct platform_device *pdev) { -const struct of_device_id *match = -of_match_device (berlin4ct_pinctrl_match, &pdev->dev); +const struct berlin_pinctrl_desc *desc = +device_get_match_data (&pdev->dev);struct regmap_config *rmconfig;struct regmap *regmap;struct resource *res;
@@ -473,7 +474,7 @@ static int berlin4ct_pinctrl_probe(struct platform_device *pdev)if (IS_ERR (regmap))return PTR_ERR (regmap); -return berlin_pinctrl_probe_regmap (pdev, match->data, regmap); +return berlin_pinctrl_probe_regmap (pdev, desc, regmap); }static struct platform_driver berlin4ct_pinctrl_driver = {
drivers/pinctrl/berlin/pinctrl-as370.c +5 -4
@@ -8,8 +8,9 @@*/ #include <linux/init.h> -#include <linux/of_device.h> +#include <linux/of.h> #include <linux/platform_device.h> +#include <linux/property.h> #include <linux/regmap.h> #include "berlin.h"
@@ -330,8 +331,8 @@ static const struct of_device_id as370_pinctrl_match[] = {static int as370_pinctrl_probe (struct platform_device *pdev) { -const struct of_device_id *match = -of_match_device (as370_pinctrl_match, &pdev->dev); +const struct berlin_pinctrl_desc *desc = +device_get_match_data (&pdev->dev);struct regmap_config *rmconfig;struct regmap *regmap;struct resource *res;
@@ -354,7 +355,7 @@ static int as370_pinctrl_probe(struct platform_device *pdev)if (IS_ERR (regmap))return PTR_ERR (regmap); -return berlin_pinctrl_probe_regmap (pdev, match->data, regmap); +return berlin_pinctrl_probe_regmap (pdev, desc, regmap); }static struct platform_driver as370_pinctrl_driver = {
drivers/pinctrl/mvebu/pinctrl-armada-38x.c +2 -7
@@ -12,8 +12,8 @@#include <linux/io.h> #include <linux/platform_device.h> #include <linux/of.h> -#include <linux/of_device.h> #include <linux/pinctrl/pinctrl.h> +#include <linux/property.h> #include "pinctrl-mvebu.h"
@@ -404,13 +404,8 @@ static struct pinctrl_gpio_range armada_38x_mpp_gpio_ranges[] = {static int armada_38x_pinctrl_probe (struct platform_device *pdev) {struct mvebu_pinctrl_soc_info *soc = &armada_38x_pinctrl_info; -const struct of_device_id *match = -of_match_device (armada_38x_pinctrl_of_match, &pdev->dev); -if (!match) -return -ENODEV ; - - soc->variant = (unsigned ) match->data &0xff ; + soc->variant = (unsigned )device_get_match_data (&pdev->dev) &0xff ; soc->controls = armada_38x_mpp_controls; soc->ncontrols =ARRAY_SIZE (armada_38x_mpp_controls); soc->gpioranges = armada_38x_mpp_gpio_ranges;
drivers/pinctrl/mvebu/pinctrl-armada-39x.c +2 -7
@@ -12,8 +12,8 @@#include <linux/io.h> #include <linux/platform_device.h> #include <linux/of.h> -#include <linux/of_device.h> #include <linux/pinctrl/pinctrl.h> +#include <linux/property.h> #include "pinctrl-mvebu.h"
@@ -386,13 +386,8 @@ static struct pinctrl_gpio_range armada_39x_mpp_gpio_ranges[] = {static int armada_39x_pinctrl_probe (struct platform_device *pdev) {struct mvebu_pinctrl_soc_info *soc = &armada_39x_pinctrl_info; -const struct of_device_id *match = -of_match_device (armada_39x_pinctrl_of_match, &pdev->dev); -if (!match) -return -ENODEV ; - - soc->variant = (unsigned ) match->data &0xff ; + soc->variant = (unsigned )device_get_match_data (&pdev->dev) &0xff ; soc->controls = armada_39x_mpp_controls; soc->ncontrols =ARRAY_SIZE (armada_39x_mpp_controls); soc->gpioranges = armada_39x_mpp_gpio_ranges;
drivers/pinctrl/mvebu/pinctrl-armada-ap806.c +1 -4
@@ -13,7 +13,6 @@#include <linux/io.h> #include <linux/platform_device.h> #include <linux/of.h> -#include <linux/of_device.h> #include <linux/pinctrl/pinctrl.h> #include "pinctrl-mvebu.h"
@@ -106,10 +105,8 @@ static struct pinctrl_gpio_range armada_ap806_mpp_gpio_ranges[] = {static int armada_ap806_pinctrl_probe (struct platform_device *pdev) {struct mvebu_pinctrl_soc_info *soc = &armada_ap806_pinctrl_info; -const struct of_device_id *match = -of_match_device (armada_ap806_pinctrl_of_match, &pdev->dev); -if (!match || !pdev->dev.parent) +if (!pdev->dev.parent)return -ENODEV ; soc->variant =0 ;/* no variants for Armada AP806 */
drivers/pinctrl/mvebu/pinctrl-armada-cp110.c +2 -4
@@ -12,9 +12,9 @@#include <linux/io.h> #include <linux/mfd/syscon.h> #include <linux/of.h> -#include <linux/of_device.h> #include <linux/pinctrl/pinctrl.h> #include <linux/platform_device.h> +#include <linux/property.h> #include "pinctrl-mvebu.h"
@@ -638,8 +638,6 @@ static void mvebu_pinctrl_assign_variant(struct mvebu_mpp_mode *m,static int armada_cp110_pinctrl_probe (struct platform_device *pdev) {struct mvebu_pinctrl_soc_info *soc; -const struct of_device_id *match = -of_match_device (armada_cp110_pinctrl_of_match, &pdev->dev);int i;if (!pdev->dev.parent)
@@ -650,7 +648,7 @@ static int armada_cp110_pinctrl_probe(struct platform_device *pdev)if (!soc)return -ENOMEM ; - soc->variant = (unsigned long ) match->data &0xff ; + soc->variant = (unsigned long )device_get_match_data (&pdev->dev) &0xff ; soc->controls = armada_cp110_mpp_controls; soc->ncontrols =ARRAY_SIZE (armada_cp110_mpp_controls); soc->modes = armada_cp110_mpp_modes;
drivers/pinctrl/mvebu/pinctrl-armada-xp.c +2 -7
@@ -19,8 +19,8 @@#include <linux/platform_device.h> #include <linux/clk.h> #include <linux/of.h> -#include <linux/of_device.h> #include <linux/pinctrl/pinctrl.h> +#include <linux/property.h> #include <linux/bitops.h> #include "pinctrl-mvebu.h"
@@ -568,14 +568,9 @@ static int armada_xp_pinctrl_resume(struct platform_device *pdev)static int armada_xp_pinctrl_probe (struct platform_device *pdev) {struct mvebu_pinctrl_soc_info *soc = &armada_xp_pinctrl_info; -const struct of_device_id *match = -of_match_device (armada_xp_pinctrl_of_match, &pdev->dev);int nregs; -if (!match) -return -ENODEV ; - - soc->variant = (unsigned ) match->data &0xff ; + soc->variant = (unsigned )device_get_match_data (&pdev->dev) &0xff ;switch (soc->variant) {case V_MV78230 :
drivers/pinctrl/mvebu/pinctrl-dove.c +2 -4
@@ -12,9 +12,9 @@#include <linux/platform_device.h> #include <linux/clk.h> #include <linux/of.h> -#include <linux/of_device.h> #include <linux/mfd/syscon.h> #include <linux/pinctrl/pinctrl.h> +#include <linux/property.h> #include <linux/regmap.h> #include "pinctrl-mvebu.h"
@@ -765,13 +765,11 @@ static int dove_pinctrl_probe(struct platform_device *pdev) {struct resource *res, *mpp_res;struct resource fb_res; -const struct of_device_id *match = -of_match_device (dove_pinctrl_of_match, &pdev->dev);struct mvebu_mpp_ctrl_data *mpp_data;void __iomem *base;int i; - pdev->dev.platform_data = (void *)match->data; + pdev->dev.platform_data = (void *)device_get_match_data (&pdev->dev);/* * General MPP Configuration Register is part of pdma registers.
drivers/pinctrl/mvebu/pinctrl-kirkwood.c +2 -5
@@ -11,8 +11,8 @@#include <linux/platform_device.h> #include <linux/clk.h> #include <linux/of.h> -#include <linux/of_device.h> #include <linux/pinctrl/pinctrl.h> +#include <linux/property.h> #include "pinctrl-mvebu.h"
@@ -470,10 +470,7 @@ static const struct of_device_id kirkwood_pinctrl_of_match[] = {static int kirkwood_pinctrl_probe (struct platform_device *pdev) { -const struct of_device_id *match = -of_match_device (kirkwood_pinctrl_of_match, &pdev->dev); - - pdev->dev.platform_data = (void *)match->data; + pdev->dev.platform_data = (void *)device_get_match_data (&pdev->dev);return mvebu_pinctrl_simple_mmio_probe (pdev); }
drivers/pinctrl/mvebu/pinctrl-orion.c +2 -5
@@ -19,8 +19,8 @@#include <linux/platform_device.h> #include <linux/clk.h> #include <linux/of.h> -#include <linux/of_device.h> #include <linux/pinctrl/pinctrl.h> +#include <linux/property.h> #include "pinctrl-mvebu.h"
@@ -218,10 +218,7 @@ static const struct of_device_id orion_pinctrl_of_match[] = {static int orion_pinctrl_probe (struct platform_device *pdev) { -const struct of_device_id *match = -of_match_device (orion_pinctrl_of_match, &pdev->dev); - - pdev->dev.platform_data = (void *)match->data; + pdev->dev.platform_data = (void *)device_get_match_data (&pdev->dev); mpp_base =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (mpp_base))
drivers/pinctrl/nomadik/pinctrl-abx500.c +2 -7
@@ -17,6 +17,7 @@#include <linux/of.h> #include <linux/of_device.h> #include <linux/platform_device.h> +#include <linux/property.h> #include <linux/seq_file.h> #include <linux/slab.h> #include <linux/types.h>
@@ -985,7 +986,6 @@ static const struct of_device_id abx500_gpio_match[] = {static int abx500_gpio_probe (struct platform_device *pdev) {struct device_node *np = pdev->dev.of_node; -const struct of_device_id *match;struct abx500_pinctrl *pct;unsigned int id =-1 ;int ret;
@@ -1006,12 +1006,7 @@ static int abx500_gpio_probe(struct platform_device *pdev) pct->chip.parent = &pdev->dev; pct->chip.base =-1 ;/* Dynamic allocation */ - match =of_match_device (abx500_gpio_match, &pdev->dev); -if (!match) { -dev_err (&pdev->dev,"gpio dt not matching\n" ); -return -ENODEV ; - } - id = (unsigned long )match->data; + id = (unsigned long )device_get_match_data (&pdev->dev);/* Poke in other ASIC variants here */ switch (id) {
drivers/pinctrl/nomadik/pinctrl-nomadik.c +4 -6
@@ -16,9 +16,11 @@#include <linux/interrupt.h> #include <linux/io.h> #include <linux/kernel.h> +#include <linux/of.h> #include <linux/of_address.h> -#include <linux/of_device.h> +#include <linux/of_platform.h> #include <linux/platform_device.h> +#include <linux/property.h> #include <linux/seq_file.h> #include <linux/slab.h> #include <linux/spinlock.h>
@@ -1838,7 +1840,6 @@ static int nmk_pinctrl_resume(struct device *dev)static int nmk_pinctrl_probe (struct platform_device *pdev) { -const struct of_device_id *match;struct device_node *np = pdev->dev.of_node;struct device_node *prcm_np;struct nmk_pinctrl *npct;
@@ -1849,10 +1850,7 @@ static int nmk_pinctrl_probe(struct platform_device *pdev)if (!npct)return -ENOMEM ; - match =of_match_device (nmk_pinctrl_match, &pdev->dev); -if (!match) -return -ENODEV ; - version = (unsigned int ) match->data; + version = (unsigned int )device_get_match_data (&pdev->dev);/* Poke in other ASIC variants here */ if (version ==PINCTRL_NMK_STN8815 )
drivers/pinctrl/pinctrl-at91.c +5 -6
@@ -12,10 +12,9 @@#include <linux/interrupt.h> #include <linux/io.h> #include <linux/of.h> -#include <linux/of_address.h> -#include <linux/of_device.h> -#include <linux/of_irq.h> +#include <linux/platform_device.h> #include <linux/pm.h> +#include <linux/property.h> #include <linux/seq_file.h> #include <linux/slab.h> #include <linux/string_helpers.h>
@@ -1302,8 +1301,8 @@ static int at91_pinctrl_probe_dt(struct platform_device *pdev,if (!np)return -ENODEV ; - info->dev = dev; - info->ops =of_device_get_match_data (dev); + info->dev = &pdev->dev; + info->ops =device_get_match_data (&pdev->dev);at91_pinctrl_child_count (info, np);/*
@@ -1845,7 +1844,7 @@ static int at91_gpio_probe(struct platform_device *pdev)if (IS_ERR (at91_chip->regbase))return PTR_ERR (at91_chip->regbase); - at91_chip->ops =of_device_get_match_data (dev); + at91_chip->ops =device_get_match_data (dev); at91_chip->pioc_virq = irq; at91_chip->clock =devm_clk_get_enabled (dev,NULL );
drivers/pinctrl/pinctrl-xway.c +4 -7
@@ -11,12 +11,12 @@#include <linux/gpio/driver.h> #include <linux/slab.h> #include <linux/module.h> -#include <linux/of_platform.h> -#include <linux/of_address.h> +#include <linux/of.h> #include <linux/ioport.h> #include <linux/io.h> #include <linux/device.h> #include <linux/platform_device.h> +#include <linux/property.h> #include "pinctrl-lantiq.h"
@@ -1451,7 +1451,6 @@ MODULE_DEVICE_TABLE(of, xway_match);static int pinmux_xway_probe (struct platform_device *pdev) { -const struct of_device_id *match;const struct pinctrl_xway_soc *xway_soc;int ret, i;
@@ -1460,10 +1459,8 @@ static int pinmux_xway_probe(struct platform_device *pdev)if (IS_ERR (xway_info.membase[0 ]))return PTR_ERR (xway_info.membase[0 ]); - match =of_match_device (xway_match, &pdev->dev); -if (match) - xway_soc = (const struct pinctrl_xway_soc *) match->data; -else + xway_soc =device_get_match_data (&pdev->dev); +if (!xway_soc) xway_soc = &danube_pinctrl;/* find out how many pads we have */
drivers/pinctrl/ti/pinctrl-ti-iodelay.c +8 -10
@@ -14,7 +14,8 @@#include <linux/io.h> #include <linux/module.h> #include <linux/of.h> -#include <linux/of_device.h> +#include <linux/platform_device.h> +#include <linux/property.h> #include <linux/regmap.h> #include <linux/seq_file.h> #include <linux/slab.h>
@@ -822,7 +823,6 @@ static int ti_iodelay_probe(struct platform_device *pdev) {struct device *dev = &pdev->dev;struct device_node *np =of_node_get (dev->of_node); -const struct of_device_id *match;struct resource *res;struct ti_iodelay_device *iod;int ret =0 ;
@@ -833,20 +833,18 @@ static int ti_iodelay_probe(struct platform_device *pdev) goto exit_out; } - match =of_match_device (ti_iodelay_of_match, dev); -if (!match) { - ret = -EINVAL ; -dev_err (dev,"No DATA match\n" ); - goto exit_out; - } - iod =devm_kzalloc (dev,sizeof (*iod),GFP_KERNEL );if (!iod) { ret = -ENOMEM ; goto exit_out; } iod->dev = dev; - iod->reg_data = match->data; + iod->reg_data =device_get_match_data (dev); +if (!iod->reg_data) { + ret = -EINVAL ; +dev_err (dev,"No DATA match\n" ); + goto exit_out; + }/* So far We can assume there is only 1 bank of registers */ iod->reg_base =devm_platform_get_and_ioremap_resource (pdev,0 , &res);
Signature · 1 line
2.42.0
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]>---
Reviewed-by Florian Fainelli <[email protected]>
Signature · 1 line
Florian