gpio: 74xx-mmio: Use of_device_get_match_data()
PATCH 1/12 gpio: 74xx-mmio: Use of_device_get_match_data()
From: Thierry Reding <[email protected]>
Use of_device_get_match_data() instead of open-coding it.
--- drivers/gpio/gpio-74xx-mmio.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/gpio/gpio-74xx-mmio.c +2 -7
@@ -105,27 +105,22 @@ static int mmio_74xx_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)static int mmio_74xx_gpio_probe (struct platform_device *pdev) { -const struct of_device_id *of_id;struct mmio_74xx_gpio_priv *priv;struct resource *res;void __iomem *dat;int err; - of_id =of_match_device (mmio_74xx_gpio_ids, &pdev->dev); -if (!of_id) -return -ENODEV ; - priv =devm_kzalloc (&pdev->dev,sizeof (*priv),GFP_KERNEL );if (!priv)return -ENOMEM ; + priv->flags = (uintptr_t )of_device_get_match_data (&pdev->dev); + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); dat =devm_ioremap_resource (&pdev->dev, res);if (IS_ERR (dat))return PTR_ERR (dat); - priv->flags = (uintptr_t ) of_id->data; - err =bgpio_init (&priv->gc, &pdev->dev,DIV_ROUND_UP (MMIO_74XX_BIT_CNT (priv->flags),8 ), dat,NULL ,NULL ,NULL ,NULL ,0 );
Signature · 1 line
2.17.0
PATCH 2/12 gpio: dwapb: Use of_device_get_match_data()
From: Thierry Reding <[email protected]>
Use of_device_get_match_data() instead of open-coding it.
--- drivers/gpio/gpio-dwapb.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/gpio/gpio-dwapb.c +1 -7
@@ -684,13 +684,7 @@ static int dwapb_gpio_probe(struct platform_device *pdev) gpio->flags =0 ;if (dev->of_node) { -const struct of_device_id *of_devid; - - of_devid =of_match_device (dwapb_of_match, dev); -if (of_devid) { -if (of_devid->data) - gpio->flags = (uintptr_t )of_devid->data; - } + gpio->flags = (uintptr_t )of_device_get_match_data (dev); }else if (has_acpi_companion (dev)) {const struct acpi_device_id *acpi_id;
Signature · 1 line
2.17.0
PATCH 3/12 gpio: ge: Use of_device_get_match_data()
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Use of_device_get_match_data() instead of open-coding it.
--- drivers/gpio/gpio-ge.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-ge.c +1 -3
@@ -52,8 +52,6 @@ MODULE_DEVICE_TABLE(of, gef_gpio_ids);static int __init gef_gpio_probe (struct platform_device *pdev) { -const struct of_device_id *of_id = -of_match_device (gef_gpio_ids, &pdev->dev);struct gpio_chip *gc;void __iomem *regs;int ret;
@@ -82,7 +80,7 @@ static int __init gef_gpio_probe(struct platform_device *pdev) } gc->base =-1 ; - gc->ngpio = (u16 )(uintptr_t )of_id->data; + gc->ngpio = (u16 )of_device_get_match_data (&pdev->dev); gc->of_gpio_n_cells =2 ; gc->of_node = pdev->dev.of_node;
Signature · 1 line
2.17.0
PATCH 4/12 gpio: ingenic: Use of_device_get_match_data()
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Use of_device_get_match_data() instead of open-coding it.
--- drivers/gpio/gpio-ingenic.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-ingenic.c +1 -3
@@ -285,8 +285,6 @@ MODULE_DEVICE_TABLE(of, ingenic_gpio_of_match);static int ingenic_gpio_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; -const struct of_device_id *of_id =of_match_device ( - ingenic_gpio_of_match, dev);struct ingenic_gpio_chip *jzgc;u32 bank;int err;
@@ -323,7 +321,7 @@ static int ingenic_gpio_probe(struct platform_device *pdev) jzgc->gc.parent = dev; jzgc->gc.of_node = dev->of_node; jzgc->gc.owner =THIS_MODULE ; - jzgc->version = (enum jz_version )of_id->data; + jzgc->version = (enum jz_version )of_device_get_match_data (dev); jzgc->gc.set = ingenic_gpio_set; jzgc->gc.get = ingenic_gpio_get;
Signature · 1 line
2.17.0
PATCH 5/12 gpio: mxs: Use of_device_get_match_data()
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Use of_device_get_match_data() instead of open-coding it.
--- drivers/gpio/gpio-mxs.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-mxs.c +1 -3
@@ -290,8 +290,6 @@ MODULE_DEVICE_TABLE(of, mxs_gpio_dt_ids);static int mxs_gpio_probe (struct platform_device *pdev) { -const struct of_device_id *of_id = -of_match_device (mxs_gpio_dt_ids, &pdev->dev);struct device_node *np = pdev->dev.of_node;struct device_node *parent;static void __iomem *base;
@@ -306,7 +304,7 @@ static int mxs_gpio_probe(struct platform_device *pdev) port->id =of_alias_get_id (np,"gpio" );if (port->id <0 )return port->id; - port->devid = (enum mxs_gpio_id ) of_id->data; + port->devid = (enum mxs_gpio_id )of_device_get_match_data (&pdev->dev); port->dev = &pdev->dev; port->irq =platform_get_irq (pdev,0 );if (port->irq <0 )
Signature · 1 line
2.17.0
PATCH 6/12 gpio: palmas: Use of_device_get_match_data()
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Use of_device_get_match_data() instead of open-coding it.
--- drivers/gpio/gpio-palmas.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/gpio/gpio-palmas.c +1 -5
@@ -159,13 +159,9 @@ static int palmas_gpio_probe(struct platform_device *pdev)struct palmas_platform_data *palmas_pdata;struct palmas_gpio *palmas_gpio;int ret; -const struct of_device_id *match;const struct palmas_device_data *dev_data; - match =of_match_device (of_palmas_gpio_match, &pdev->dev); -if (!match) -return -ENODEV ; - dev_data = match->data; + dev_data =of_device_get_match_data (&pdev->dev);if (!dev_data) dev_data = &palmas_dev_data;
Signature · 1 line
2.17.0
PATCH 7/12 gpio: pca953x: Use of_device_get_match_data()
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Use of_device_get_match_data() instead of open-coding it.
--- drivers/gpio/gpio-pca953x.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/gpio/gpio-pca953x.c +4 -6
@@ -810,13 +810,11 @@ static int pca953x_probe(struct i2c_client *client, chip->driver_data = i2c_id->driver_data; }else {const struct acpi_device_id *acpi_id; -const struct of_device_id *match; +struct device *dev = &client->dev; - match =of_match_device (pca953x_dt_ids, &client->dev); -if (match) { - chip->driver_data = (int )(uintptr_t )match->data; - }else { - acpi_id =acpi_match_device (pca953x_acpi_ids, &client->dev); + chip->driver_data = (uintptr_t )of_device_get_match_data (dev); +if (!chip->driver_data) { + acpi_id =acpi_match_device (pca953x_acpi_ids, dev);if (!acpi_id) { ret = -ENODEV ; goto err_exit;
Signature · 1 line
2.17.0
PATCH 8/12 gpio: pxa: Use of_device_get_match_data()
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Use of_device_get_match_data() instead of open-coding it.
--- drivers/gpio/gpio-pxa.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/gpio/gpio-pxa.c +1 -7
@@ -579,15 +579,9 @@ static int pxa_gpio_probe_dt(struct platform_device *pdev, struct pxa_gpio_chip *pchip) {int nr_gpios; -const struct of_device_id *of_id = -of_match_device (pxa_gpio_dt_ids, &pdev->dev);const struct pxa_gpio_id *gpio_id; -if (!of_id || !of_id->data) { -dev_err (&pdev->dev,"Failed to find gpio controller\n" ); -return -EFAULT ; - } - gpio_id = of_id->data; + gpio_id =of_device_get_match_data (&pdev->dev); gpio_type = gpio_id->type; nr_gpios = gpio_id->gpio_nums;
Signature · 1 line
2.17.0
PATCH 9/12 gpio: syscon: Use of_device_get_match_data()
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Use of_device_get_match_data() instead of open-coding it.
--- drivers/gpio/gpio-syscon.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/gpio/gpio-syscon.c +1 -6
@@ -182,20 +182,15 @@ MODULE_DEVICE_TABLE(of, syscon_gpio_ids);static int syscon_gpio_probe (struct platform_device *pdev) {struct device *dev = &pdev->dev; -const struct of_device_id *of_id;struct syscon_gpio_priv *priv;struct device_node *np = dev->of_node;int ret; - of_id =of_match_device (syscon_gpio_ids, dev); -if (!of_id) -return -ENODEV ; - priv =devm_kzalloc (dev,sizeof (*priv),GFP_KERNEL );if (!priv)return -ENOMEM ; - priv->data = of_id->data; + priv->data =of_device_get_match_data (dev);if (priv->data->compatible) { priv->syscon = syscon_regmap_lookup_by_compatible(
Signature · 1 line
2.17.0
PATCH 10/12 gpio: ts4900: Use of_device_get_match_data()
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Use of_device_get_match_data() instead of open-coding it.
--- drivers/gpio/gpio-ts4900.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
drivers/gpio/gpio-ts4900.c +1 -6
@@ -128,15 +128,10 @@ MODULE_DEVICE_TABLE(of, ts4900_gpio_of_match_table);static int ts4900_gpio_probe (struct i2c_client *client,const struct i2c_device_id *id) { -const struct of_device_id *match;struct ts4900_gpio_priv *priv;u32 ngpio;int ret; - match =of_match_device (ts4900_gpio_of_match_table, &client->dev); -if (!match) -return -EINVAL ; -if (of_property_read_u32 (client->dev.of_node,"ngpios" , &ngpio)) ngpio =DEFAULT_PIN_NUMBER ;
@@ -148,7 +143,7 @@ static int ts4900_gpio_probe(struct i2c_client *client, priv->gpio_chip.label ="ts4900-gpio" ; priv->gpio_chip.ngpio = ngpio; priv->gpio_chip.parent = &client->dev; - priv->input_bit = (uintptr_t )match->data; + priv->input_bit = (uintptr_t )of_device_get_match_data (&client->dev); priv->regmap =devm_regmap_init_i2c (client, &ts4900_regmap_config);if (IS_ERR (priv->regmap)) {
Signature · 1 line
2.17.0
PATCH 11/12 gpio: vf610: Use of_device_get_match_data()
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Use of_device_get_match_data() instead of open-coding it.
--- drivers/gpio/gpio-vf610.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpio/gpio-vf610.c +1 -3
@@ -254,8 +254,6 @@ static struct irq_chip vf610_gpio_irq_chip = {static int vf610_gpio_probe (struct platform_device *pdev) { -const struct of_device_id *of_id =of_match_device (vf610_gpio_dt_ids, - &pdev->dev);struct device *dev = &pdev->dev;struct device_node *np = dev->of_node;struct vf610_gpio_port *port;
@@ -267,7 +265,7 @@ static int vf610_gpio_probe(struct platform_device *pdev)if (!port)return -ENOMEM ; - port->sdata = of_id->data; + port->sdata =of_device_get_match_data (dev); iores =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); port->base =devm_ioremap_resource (dev, iores);if (IS_ERR (port->base))
Signature · 1 line
2.17.0
PATCH 12/12 gpio: xlp: Use of_device_get_match_data()
In reply to Thierry RedingFrom: Thierry Reding <[email protected]>
Use of_device_get_match_data() instead of open-coding it.
--- drivers/gpio/gpio-xlp.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/gpio/gpio-xlp.c +1 -8
@@ -322,14 +322,7 @@ static int xlp_gpio_probe(struct platform_device *pdev)return irq;if (pdev->dev.of_node) { -const struct of_device_id *of_id; - - of_id =of_match_device (xlp_gpio_of_ids, &pdev->dev); -if (!of_id) { -dev_err (&pdev->dev,"Unable to match OF ID\n" ); -return -ENODEV ; - } - soc_type = (uintptr_t ) of_id->data; + soc_type = (uintptr_t )of_device_get_match_data (&pdev->dev); }else {const struct acpi_device_id *acpi_id;
Signature · 1 line
2.17.0
Quoted 5 lines · Thierry Reding
From: Thierry Reding <[email protected]>
Use
of_device_get_match_data()instead of open-coding it.Signed-off-by Thierry Reding <[email protected]>
All 12 patches applied!
Thanks for your cleanup efforts, much much appreciated!
Yours,
Linus Walleij