Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: Get rid of duplicate of_node assignment in the drivers

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>

authored by

Andy Shevchenko and committed by
Bartosz Golaszewski
448cf905 ca7e7822

+2 -36
-1
drivers/gpio/gpio-adnp.c
··· 458 458 chip->ngpio = num_gpios; 459 459 chip->label = adnp->client->name; 460 460 chip->parent = &adnp->client->dev; 461 - chip->of_node = chip->parent->of_node; 462 461 chip->owner = THIS_MODULE; 463 462 464 463 if (is_irq_controller) {
+1 -3
drivers/gpio/gpio-amdpt.c
··· 105 105 pt_gpio->gc.request = pt_gpio_request; 106 106 pt_gpio->gc.free = pt_gpio_free; 107 107 pt_gpio->gc.ngpio = (uintptr_t)device_get_match_data(dev); 108 - #if defined(CONFIG_OF_GPIO) 109 - pt_gpio->gc.of_node = dev->of_node; 110 - #endif 108 + 111 109 ret = gpiochip_add_data(&pt_gpio->gc, pt_gpio); 112 110 if (ret) { 113 111 dev_err(dev, "Failed to register GPIO lib\n");
-1
drivers/gpio/gpio-bd71828.c
··· 121 121 * "gpio-reserved-ranges" and exclude them from control 122 122 */ 123 123 bdgpio->gpio.ngpio = 4; 124 - bdgpio->gpio.of_node = dev->parent->of_node; 125 124 bdgpio->regmap = dev_get_regmap(dev->parent, NULL); 126 125 if (!bdgpio->regmap) 127 126 return -ENODEV;
-1
drivers/gpio/gpio-brcmstb.c
··· 703 703 goto fail; 704 704 } 705 705 706 - gc->of_node = np; 707 706 gc->owner = THIS_MODULE; 708 707 gc->label = devm_kasprintf(dev, GFP_KERNEL, "%pOF", dev->of_node); 709 708 if (!gc->label) {
-1
drivers/gpio/gpio-davinci.c
··· 254 254 #ifdef CONFIG_OF_GPIO 255 255 chips->chip.of_gpio_n_cells = 2; 256 256 chips->chip.parent = dev; 257 - chips->chip.of_node = dev->of_node; 258 257 chips->chip.request = gpiochip_generic_request; 259 258 chips->chip.free = gpiochip_generic_free; 260 259 #endif
-1
drivers/gpio/gpio-eic-sprd.c
··· 609 609 sprd_eic->chip.ngpio = pdata->num_eics; 610 610 sprd_eic->chip.base = -1; 611 611 sprd_eic->chip.parent = &pdev->dev; 612 - sprd_eic->chip.of_node = pdev->dev.of_node; 613 612 sprd_eic->chip.direction_input = sprd_eic_direction_input; 614 613 switch (sprd_eic->type) { 615 614 case SPRD_EIC_DEBOUNCE:
-1
drivers/gpio/gpio-em.c
··· 306 306 } 307 307 308 308 gpio_chip = &p->gpio_chip; 309 - gpio_chip->of_node = dev->of_node; 310 309 gpio_chip->direction_input = em_gio_direction_input; 311 310 gpio_chip->get = em_gio_get; 312 311 gpio_chip->direction_output = em_gio_direction_output;
-1
drivers/gpio/gpio-ge.c
··· 82 82 gc->base = -1; 83 83 gc->ngpio = (u16)(uintptr_t)of_device_get_match_data(&pdev->dev); 84 84 gc->of_gpio_n_cells = 2; 85 - gc->of_node = pdev->dev.of_node; 86 85 87 86 /* This function adds a memory mapped GPIO chip */ 88 87 ret = devm_gpiochip_add_data(&pdev->dev, gc, NULL);
-1
drivers/gpio/gpio-grgpio.c
··· 358 358 priv->imask = gc->read_reg(regs + GRGPIO_IMASK); 359 359 priv->dev = &ofdev->dev; 360 360 361 - gc->of_node = np; 362 361 gc->owner = THIS_MODULE; 363 362 gc->to_irq = grgpio_to_irq; 364 363 gc->label = devm_kasprintf(&ofdev->dev, GFP_KERNEL, "%pOF", np);
-1
drivers/gpio/gpio-gw-pld.c
··· 82 82 gw->chip.base = -1; 83 83 gw->chip.can_sleep = true; 84 84 gw->chip.parent = dev; 85 - gw->chip.of_node = np; 86 85 gw->chip.owner = THIS_MODULE; 87 86 gw->chip.label = dev_name(dev); 88 87 gw->chip.ngpio = 8;
-1
drivers/gpio/gpio-mt7621.c
··· 217 217 memset(rg, 0, sizeof(*rg)); 218 218 219 219 spin_lock_init(&rg->lock); 220 - rg->chip.of_node = node; 221 220 rg->bank = bank; 222 221 223 222 dat = mtk->base + GPIO_REG_DATA + (rg->bank * GPIO_BANK_STRIDE);
-1
drivers/gpio/gpio-mvebu.c
··· 1183 1183 mvchip->chip.base = id * MVEBU_MAX_GPIO_PER_BANK; 1184 1184 mvchip->chip.ngpio = ngpios; 1185 1185 mvchip->chip.can_sleep = false; 1186 - mvchip->chip.of_node = np; 1187 1186 mvchip->chip.dbg_show = mvebu_gpio_dbg_show; 1188 1187 1189 1188 if (soc_variant == MVEBU_GPIO_SOC_VARIANT_A8K)
-3
drivers/gpio/gpio-omap.c
··· 1419 1419 bank->is_mpuio = pdata->is_mpuio; 1420 1420 bank->non_wakeup_gpios = pdata->non_wakeup_gpios; 1421 1421 bank->regs = pdata->regs; 1422 - #ifdef CONFIG_OF_GPIO 1423 - bank->chip.of_node = of_node_get(node); 1424 - #endif 1425 1422 1426 1423 if (node) { 1427 1424 if (!of_property_read_bool(node, "ti,gpio-always-on"))
+1 -3
drivers/gpio/gpio-palmas.c
··· 170 170 palmas_gpio->gpio_chip.set = palmas_gpio_set; 171 171 palmas_gpio->gpio_chip.get = palmas_gpio_get; 172 172 palmas_gpio->gpio_chip.parent = &pdev->dev; 173 - #ifdef CONFIG_OF_GPIO 174 - palmas_gpio->gpio_chip.of_node = pdev->dev.of_node; 175 - #endif 173 + 176 174 palmas_pdata = dev_get_platdata(palmas->dev); 177 175 if (palmas_pdata && palmas_pdata->gpio_base) 178 176 palmas_gpio->gpio_chip.base = palmas_pdata->gpio_base;
-1
drivers/gpio/gpio-pmic-eic-sprd.c
··· 331 331 pmic_eic->chip.ngpio = SPRD_PMIC_EIC_NR; 332 332 pmic_eic->chip.base = -1; 333 333 pmic_eic->chip.parent = &pdev->dev; 334 - pmic_eic->chip.of_node = pdev->dev.of_node; 335 334 pmic_eic->chip.direction_input = sprd_pmic_eic_direction_input; 336 335 pmic_eic->chip.request = sprd_pmic_eic_request; 337 336 pmic_eic->chip.free = sprd_pmic_eic_free;
-1
drivers/gpio/gpio-raspberrypi-exp.c
··· 221 221 rpi_gpio->gc.parent = dev; 222 222 rpi_gpio->gc.label = MODULE_NAME; 223 223 rpi_gpio->gc.owner = THIS_MODULE; 224 - rpi_gpio->gc.of_node = np; 225 224 rpi_gpio->gc.base = -1; 226 225 rpi_gpio->gc.ngpio = NUM_GPIO; 227 226
-2
drivers/gpio/gpio-rda.c
··· 240 240 rda_gpio->chip.label = dev_name(dev); 241 241 rda_gpio->chip.ngpio = ngpios; 242 242 rda_gpio->chip.base = -1; 243 - rda_gpio->chip.parent = dev; 244 - rda_gpio->chip.of_node = np; 245 243 246 244 if (rda_gpio->irq >= 0) { 247 245 rda_gpio->irq_chip.name = "rda-gpio",
-3
drivers/gpio/gpio-rockchip.c
··· 584 584 gc->ngpio = bank->nr_pins; 585 585 gc->label = bank->name; 586 586 gc->parent = bank->dev; 587 - #ifdef CONFIG_OF_GPIO 588 - gc->of_node = of_node_get(bank->of_node); 589 - #endif 590 587 591 588 ret = gpiochip_add_data(gc, bank); 592 589 if (ret) {
-1
drivers/gpio/gpio-sama5d2-piobu.c
··· 192 192 platform_set_drvdata(pdev, piobu); 193 193 piobu->chip.label = pdev->name; 194 194 piobu->chip.parent = &pdev->dev; 195 - piobu->chip.of_node = pdev->dev.of_node; 196 195 piobu->chip.owner = THIS_MODULE, 197 196 piobu->chip.get_direction = sama5d2_piobu_get_direction, 198 197 piobu->chip.direction_input = sama5d2_piobu_direction_input,
-1
drivers/gpio/gpio-sprd.c
··· 237 237 sprd_gpio->chip.ngpio = SPRD_GPIO_NR; 238 238 sprd_gpio->chip.base = -1; 239 239 sprd_gpio->chip.parent = &pdev->dev; 240 - sprd_gpio->chip.of_node = pdev->dev.of_node; 241 240 sprd_gpio->chip.request = sprd_gpio_request; 242 241 sprd_gpio->chip.free = sprd_gpio_free; 243 242 sprd_gpio->chip.get = sprd_gpio_get;
-1
drivers/gpio/gpio-stmpe.c
··· 477 477 stmpe_gpio->chip = template_chip; 478 478 stmpe_gpio->chip.ngpio = stmpe->num_gpios; 479 479 stmpe_gpio->chip.parent = &pdev->dev; 480 - stmpe_gpio->chip.of_node = np; 481 480 stmpe_gpio->chip.base = -1; 482 481 483 482 if (IS_ENABLED(CONFIG_DEBUG_FS))
-1
drivers/gpio/gpio-tc3589x.c
··· 319 319 tc3589x_gpio->chip.ngpio = tc3589x->num_gpio; 320 320 tc3589x_gpio->chip.parent = &pdev->dev; 321 321 tc3589x_gpio->chip.base = -1; 322 - tc3589x_gpio->chip.of_node = np; 323 322 324 323 girq = &tc3589x_gpio->chip.irq; 325 324 girq->chip = &tc3589x_gpio_irq_chip;
-1
drivers/gpio/gpio-tegra186.c
··· 749 749 gpio->gpio.names = (const char * const *)names; 750 750 751 751 #if defined(CONFIG_OF_GPIO) 752 - gpio->gpio.of_node = pdev->dev.of_node; 753 752 gpio->gpio.of_gpio_n_cells = 2; 754 753 gpio->gpio.of_xlate = tegra186_gpio_of_xlate; 755 754 #endif /* CONFIG_OF_GPIO */
-3
drivers/gpio/gpio-tps65218.c
··· 196 196 tps65218_gpio->tps65218 = tps65218; 197 197 tps65218_gpio->gpio_chip = template_chip; 198 198 tps65218_gpio->gpio_chip.parent = &pdev->dev; 199 - #ifdef CONFIG_OF_GPIO 200 - tps65218_gpio->gpio_chip.of_node = pdev->dev.of_node; 201 - #endif 202 199 203 200 return devm_gpiochip_add_data(&pdev->dev, &tps65218_gpio->gpio_chip, 204 201 tps65218_gpio);
-1
drivers/gpio/gpio-vf610.c
··· 298 298 } 299 299 300 300 gc = &port->gc; 301 - gc->of_node = np; 302 301 gc->parent = dev; 303 302 gc->label = "vf610-gpio"; 304 303 gc->ngpio = VF610_GPIO_PER_PORT;