gpio: Get rid of duplicate of_node assignment in the drivers
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 17 Dec 2021 16:39:35 +0000 (17:39 +0100)
committerBartosz Golaszewski <brgl@bgdev.pl>
Fri, 17 Dec 2021 16:39:35 +0000 (17:39 +0100)
GPIO library does copy the of_node from the parent device of
the GPIO chip, there is no need to repeat this in the individual
drivers. Remove these assignment all at once.

For the details one may look into the of_gpio_dev_init() implementation.

While at it, remove duplicate parent device assignment where it is the case.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-By: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
25 files changed:
drivers/gpio/gpio-adnp.c
drivers/gpio/gpio-amdpt.c
drivers/gpio/gpio-bd71828.c
drivers/gpio/gpio-brcmstb.c
drivers/gpio/gpio-davinci.c
drivers/gpio/gpio-eic-sprd.c
drivers/gpio/gpio-em.c
drivers/gpio/gpio-ge.c
drivers/gpio/gpio-grgpio.c
drivers/gpio/gpio-gw-pld.c
drivers/gpio/gpio-mt7621.c
drivers/gpio/gpio-mvebu.c
drivers/gpio/gpio-omap.c
drivers/gpio/gpio-palmas.c
drivers/gpio/gpio-pmic-eic-sprd.c
drivers/gpio/gpio-raspberrypi-exp.c
drivers/gpio/gpio-rda.c
drivers/gpio/gpio-rockchip.c
drivers/gpio/gpio-sama5d2-piobu.c
drivers/gpio/gpio-sprd.c
drivers/gpio/gpio-stmpe.c
drivers/gpio/gpio-tc3589x.c
drivers/gpio/gpio-tegra186.c
drivers/gpio/gpio-tps65218.c
drivers/gpio/gpio-vf610.c

index 8eedfc6451df9778ef5c6c0c40b99dc08913afa2..cc349d4e497376d4dea237e330f7e47cb543edf7 100644 (file)
@@ -458,7 +458,6 @@ static int adnp_gpio_setup(struct adnp *adnp, unsigned int num_gpios,
        chip->ngpio = num_gpios;
        chip->label = adnp->client->name;
        chip->parent = &adnp->client->dev;
-       chip->of_node = chip->parent->of_node;
        chip->owner = THIS_MODULE;
 
        if (is_irq_controller) {
index 13f4e2af3800749c07be1d5a125c88472935ad30..8cfb353c3abb74627806f494d5ed32e14a8222bd 100644 (file)
@@ -105,9 +105,7 @@ static int pt_gpio_probe(struct platform_device *pdev)
        pt_gpio->gc.request          = pt_gpio_request;
        pt_gpio->gc.free             = pt_gpio_free;
        pt_gpio->gc.ngpio            = (uintptr_t)device_get_match_data(dev);
-#if defined(CONFIG_OF_GPIO)
-       pt_gpio->gc.of_node          = dev->of_node;
-#endif
+
        ret = gpiochip_add_data(&pt_gpio->gc, pt_gpio);
        if (ret) {
                dev_err(dev, "Failed to register GPIO lib\n");
index c8e382b53f2f67333002a5a33fed109e9840dea7..b2ccc320c7b53e77f4f3c06bfab37e881d8262b9 100644 (file)
@@ -121,7 +121,6 @@ static int bd71828_probe(struct platform_device *pdev)
         * "gpio-reserved-ranges" and exclude them from control
         */
        bdgpio->gpio.ngpio = 4;
-       bdgpio->gpio.of_node = dev->parent->of_node;
        bdgpio->regmap = dev_get_regmap(dev->parent, NULL);
        if (!bdgpio->regmap)
                return -ENODEV;
index 895a79936248d67dda7f95fc715440936773d3ee..176c264bb959e51e240f367d09702e8938d925a7 100644 (file)
@@ -703,7 +703,6 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
                        goto fail;
                }
 
-               gc->of_node = np;
                gc->owner = THIS_MODULE;
                gc->label = devm_kasprintf(dev, GFP_KERNEL, "%pOF", dev->of_node);
                if (!gc->label) {
index cb5afaa7ed482b5bacade41fb583b7b5606a9d41..f960587f86a388d78ee42b6b823fadaa2128779f 100644 (file)
@@ -254,7 +254,6 @@ static int davinci_gpio_probe(struct platform_device *pdev)
 #ifdef CONFIG_OF_GPIO
        chips->chip.of_gpio_n_cells = 2;
        chips->chip.parent = dev;
-       chips->chip.of_node = dev->of_node;
        chips->chip.request = gpiochip_generic_request;
        chips->chip.free = gpiochip_generic_free;
 #endif
index 865ab2b34fdda6ba4d443498e2bd3bfdfd5ad1f5..8d722e026e9c98b2ef935c4f8eff3296cce769ee 100644 (file)
@@ -609,7 +609,6 @@ static int sprd_eic_probe(struct platform_device *pdev)
        sprd_eic->chip.ngpio = pdata->num_eics;
        sprd_eic->chip.base = -1;
        sprd_eic->chip.parent = &pdev->dev;
-       sprd_eic->chip.of_node = pdev->dev.of_node;
        sprd_eic->chip.direction_input = sprd_eic_direction_input;
        switch (sprd_eic->type) {
        case SPRD_EIC_DEBOUNCE:
index 90b336e6ee275e84863e3b879c7fe22a9faac811..858e6ebbb584c27505a54842391898e53b467e8b 100644 (file)
@@ -306,7 +306,6 @@ static int em_gio_probe(struct platform_device *pdev)
        }
 
        gpio_chip = &p->gpio_chip;
-       gpio_chip->of_node = dev->of_node;
        gpio_chip->direction_input = em_gio_direction_input;
        gpio_chip->get = em_gio_get;
        gpio_chip->direction_output = em_gio_direction_output;
index 636952769bc82bd251c31d51ea38821deed49b7a..f6a3de99f7dbaf8302d19c448290bfedc429a396 100644 (file)
@@ -82,7 +82,6 @@ static int __init gef_gpio_probe(struct platform_device *pdev)
        gc->base = -1;
        gc->ngpio = (u16)(uintptr_t)of_device_get_match_data(&pdev->dev);
        gc->of_gpio_n_cells = 2;
-       gc->of_node = pdev->dev.of_node;
 
        /* This function adds a memory mapped GPIO chip */
        ret = devm_gpiochip_add_data(&pdev->dev, gc, NULL);
index f954359c9544ec3b31ad603306df9e7623ff2562..23d447e17a67594f35b3be8fb640cc9c33a765bd 100644 (file)
@@ -358,7 +358,6 @@ static int grgpio_probe(struct platform_device *ofdev)
        priv->imask = gc->read_reg(regs + GRGPIO_IMASK);
        priv->dev = &ofdev->dev;
 
-       gc->of_node = np;
        gc->owner = THIS_MODULE;
        gc->to_irq = grgpio_to_irq;
        gc->label = devm_kasprintf(&ofdev->dev, GFP_KERNEL, "%pOF", np);
index 242112ff60ee0bf7cda306c9caf7e56a034101fd..77a3fbd46111dd100c6c2ba027c637975b5354fd 100644 (file)
@@ -82,7 +82,6 @@ static int gw_pld_probe(struct i2c_client *client,
        gw->chip.base = -1;
        gw->chip.can_sleep = true;
        gw->chip.parent = dev;
-       gw->chip.of_node = np;
        gw->chip.owner = THIS_MODULE;
        gw->chip.label = dev_name(dev);
        gw->chip.ngpio = 8;
index c3658a597a80a0abb37726bd21d7fed91d14fe67..52b49e7a0a80f912247fccb39d6a1bd8c52c9e62 100644 (file)
@@ -217,7 +217,6 @@ mediatek_gpio_bank_probe(struct device *dev,
        memset(rg, 0, sizeof(*rg));
 
        spin_lock_init(&rg->lock);
-       rg->chip.of_node = node;
        rg->bank = bank;
 
        dat = mtk->base + GPIO_REG_DATA + (rg->bank * GPIO_BANK_STRIDE);
index 8f429d9f36616f9aa89519bcedec8da531022ff9..4c1f9e1091b7f05d45c431406af083a7b3d1564e 100644 (file)
@@ -1183,7 +1183,6 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
        mvchip->chip.base = id * MVEBU_MAX_GPIO_PER_BANK;
        mvchip->chip.ngpio = ngpios;
        mvchip->chip.can_sleep = false;
-       mvchip->chip.of_node = np;
        mvchip->chip.dbg_show = mvebu_gpio_dbg_show;
 
        if (soc_variant == MVEBU_GPIO_SOC_VARIANT_A8K)
index 415e8df89d6fe019fc57be09a235be44398693a4..e099c39e0355d14976eecf0fccfd88be6646564f 100644 (file)
@@ -1419,9 +1419,6 @@ static int omap_gpio_probe(struct platform_device *pdev)
        bank->is_mpuio = pdata->is_mpuio;
        bank->non_wakeup_gpios = pdata->non_wakeup_gpios;
        bank->regs = pdata->regs;
-#ifdef CONFIG_OF_GPIO
-       bank->chip.of_node = of_node_get(node);
-#endif
 
        if (node) {
                if (!of_property_read_bool(node, "ti,gpio-always-on"))
index e8e9029ba5bd80a88809e9e8f509461d2da0339b..bac10c2faf56c400975a779beb5bf44f97ced1ef 100644 (file)
@@ -170,9 +170,7 @@ static int palmas_gpio_probe(struct platform_device *pdev)
        palmas_gpio->gpio_chip.set      = palmas_gpio_set;
        palmas_gpio->gpio_chip.get      = palmas_gpio_get;
        palmas_gpio->gpio_chip.parent = &pdev->dev;
-#ifdef CONFIG_OF_GPIO
-       palmas_gpio->gpio_chip.of_node = pdev->dev.of_node;
-#endif
+
        palmas_pdata = dev_get_platdata(palmas->dev);
        if (palmas_pdata && palmas_pdata->gpio_base)
                palmas_gpio->gpio_chip.base = palmas_pdata->gpio_base;
index 9382851905662d56b84385c894d4fee12e058dd6..e518490c4b681afa6f979f9e8a5ce5a964aa71e1 100644 (file)
@@ -331,7 +331,6 @@ static int sprd_pmic_eic_probe(struct platform_device *pdev)
        pmic_eic->chip.ngpio = SPRD_PMIC_EIC_NR;
        pmic_eic->chip.base = -1;
        pmic_eic->chip.parent = &pdev->dev;
-       pmic_eic->chip.of_node = pdev->dev.of_node;
        pmic_eic->chip.direction_input = sprd_pmic_eic_direction_input;
        pmic_eic->chip.request = sprd_pmic_eic_request;
        pmic_eic->chip.free = sprd_pmic_eic_free;
index 64a552ecc2addde9f9df9c9e1e23295d2d105f80..3c414e0005fcce56e70faa6a3e0801e33a700804 100644 (file)
@@ -221,7 +221,6 @@ static int rpi_exp_gpio_probe(struct platform_device *pdev)
        rpi_gpio->gc.parent = dev;
        rpi_gpio->gc.label = MODULE_NAME;
        rpi_gpio->gc.owner = THIS_MODULE;
-       rpi_gpio->gc.of_node = np;
        rpi_gpio->gc.base = -1;
        rpi_gpio->gc.ngpio = NUM_GPIO;
 
index 463846431183caf89622c4d70774e435ce540564..0d03f525dcd315b09b4ef7f42de4e2bea0113d70 100644 (file)
@@ -240,8 +240,6 @@ static int rda_gpio_probe(struct platform_device *pdev)
        rda_gpio->chip.label = dev_name(dev);
        rda_gpio->chip.ngpio = ngpios;
        rda_gpio->chip.base = -1;
-       rda_gpio->chip.parent = dev;
-       rda_gpio->chip.of_node = np;
 
        if (rda_gpio->irq >= 0) {
                rda_gpio->irq_chip.name = "rda-gpio",
index c1b8e5dbbcc47d3e8c9999de7c2bbcb2fe586592..a4c4e4584f5b8c4c4b5ff520435c983b3790bf1f 100644 (file)
@@ -584,9 +584,6 @@ static int rockchip_gpiolib_register(struct rockchip_pin_bank *bank)
        gc->ngpio = bank->nr_pins;
        gc->label = bank->name;
        gc->parent = bank->dev;
-#ifdef CONFIG_OF_GPIO
-       gc->of_node = of_node_get(bank->of_node);
-#endif
 
        ret = gpiochip_add_data(gc, bank);
        if (ret) {
index b7c950658170147d19d312870653c875898a662a..3e95da717fc9a73ff32e39bae4bd269b14debb72 100644 (file)
@@ -192,7 +192,6 @@ static int sama5d2_piobu_probe(struct platform_device *pdev)
        platform_set_drvdata(pdev, piobu);
        piobu->chip.label = pdev->name;
        piobu->chip.parent = &pdev->dev;
-       piobu->chip.of_node = pdev->dev.of_node;
        piobu->chip.owner = THIS_MODULE,
        piobu->chip.get_direction = sama5d2_piobu_get_direction,
        piobu->chip.direction_input = sama5d2_piobu_direction_input,
index 9dd9dabb579e2dca36e1a307c9a308856895a360..9bff63990eee43c0d9f5cc52a50164564cca1f9c 100644 (file)
@@ -237,7 +237,6 @@ static int sprd_gpio_probe(struct platform_device *pdev)
        sprd_gpio->chip.ngpio = SPRD_GPIO_NR;
        sprd_gpio->chip.base = -1;
        sprd_gpio->chip.parent = &pdev->dev;
-       sprd_gpio->chip.of_node = pdev->dev.of_node;
        sprd_gpio->chip.request = sprd_gpio_request;
        sprd_gpio->chip.free = sprd_gpio_free;
        sprd_gpio->chip.get = sprd_gpio_get;
index dd4d58b4ae498351f1ed68a140ea8364e1ca9602..0fa4f0a93378bb6164b61f317786e8e708dfb927 100644 (file)
@@ -477,7 +477,6 @@ static int stmpe_gpio_probe(struct platform_device *pdev)
        stmpe_gpio->chip = template_chip;
        stmpe_gpio->chip.ngpio = stmpe->num_gpios;
        stmpe_gpio->chip.parent = &pdev->dev;
-       stmpe_gpio->chip.of_node = np;
        stmpe_gpio->chip.base = -1;
 
        if (IS_ENABLED(CONFIG_DEBUG_FS))
index 8d158492488fccc4a794d4f18792bd230c0f6e2f..443fe975bf1392e8bb2c8de2c340a463ec73333d 100644 (file)
@@ -319,7 +319,6 @@ static int tc3589x_gpio_probe(struct platform_device *pdev)
        tc3589x_gpio->chip.ngpio = tc3589x->num_gpio;
        tc3589x_gpio->chip.parent = &pdev->dev;
        tc3589x_gpio->chip.base = -1;
-       tc3589x_gpio->chip.of_node = np;
 
        girq = &tc3589x_gpio->chip.irq;
        girq->chip = &tc3589x_gpio_irq_chip;
index 91c77fccc1e69454707a846f6ab41d827dd4fd85..ce892c84ad27df40a8f2bfa89c3722b786314eb2 100644 (file)
@@ -749,7 +749,6 @@ static int tegra186_gpio_probe(struct platform_device *pdev)
        gpio->gpio.names = (const char * const *)names;
 
 #if defined(CONFIG_OF_GPIO)
-       gpio->gpio.of_node = pdev->dev.of_node;
        gpio->gpio.of_gpio_n_cells = 2;
        gpio->gpio.of_xlate = tegra186_gpio_of_xlate;
 #endif /* CONFIG_OF_GPIO */
index 912382be48e10590a7d8c5332753483ef3092f0c..e1d425a18854e9cf794fd3ad68442e1ad192ec4b 100644 (file)
@@ -196,9 +196,6 @@ static int tps65218_gpio_probe(struct platform_device *pdev)
        tps65218_gpio->tps65218 = tps65218;
        tps65218_gpio->gpio_chip = template_chip;
        tps65218_gpio->gpio_chip.parent = &pdev->dev;
-#ifdef CONFIG_OF_GPIO
-       tps65218_gpio->gpio_chip.of_node = pdev->dev.of_node;
-#endif
 
        return devm_gpiochip_add_data(&pdev->dev, &tps65218_gpio->gpio_chip,
                                      tps65218_gpio);
index e0f2b67558e741eb5836a9e33bc7d63305a1fb56..20780c35da1b4150fe0c94ad3901fcf1f8b0a8d7 100644 (file)
@@ -298,7 +298,6 @@ static int vf610_gpio_probe(struct platform_device *pdev)
        }
 
        gc = &port->gc;
-       gc->of_node = np;
        gc->parent = dev;
        gc->label = "vf610-gpio";
        gc->ngpio = VF610_GPIO_PER_PORT;