Skip to contentSkip to conversation

gpio: removes all usage of gpiochip_remove retval

PATCH In review abdoulaye berthe 19 participants 46 messages May 29, 2014 – Jul 29, 2014 Page 2 of 2

Subsystems (40)
lore
Share & tools
lore
#29 lore raw

PATCH 2/2 pinctrl: remove all usage of gpio_remove ret val in driver/pinctl

In reply to abdoulaye berthe
---
 drivers/pinctrl/pinctrl-adi2.c         |  9 ++++-----
 drivers/pinctrl/pinctrl-as3722.c       | 11 ++---------
 drivers/pinctrl/pinctrl-baytrail.c     |  5 +----
 drivers/pinctrl/pinctrl-coh901.c       | 10 ++--------
 drivers/pinctrl/pinctrl-rockchip.c     | 16 ++++------------
 drivers/pinctrl/sh-pfc/gpio.c          |  9 +++------
 drivers/pinctrl/spear/pinctrl-plgpio.c |  3 +--
 drivers/pinctrl/sunxi/pinctrl-sunxi.c  |  3 +--
 drivers/pinctrl/vt8500/pinctrl-wmt.c   |  9 ++-------
 9 files changed, 20 insertions(+), 55 deletions(-)
drivers/pinctrl/pinctrl-adi2.c +4 -5
index 46413e9..b092b93 100644
@@ -949,7 +949,7 @@ static int adi_gpio_probe(struct platform_device *pdev)
 	struct gpio_port *port;
 	char pinctrl_devname[DEVNAME_SIZE];
 	static int gpio;
-	int ret = 0, ret1;
+	int ret = 0;
 
 	pdata = dev->platform_data;
 	if (!pdata)
@@ -1027,7 +1027,7 @@ static int adi_gpio_probe(struct platform_device *pdev)
 	return 0;
 
 out_remove_gpiochip:
-	ret1 = gpiochip_remove(&port->chip);
+	gpiochip_remove(&port->chip);
 out_remove_domain:
 	if (port->pint)
 		irq_domain_remove(port->domain);
@@ -1038,12 +1038,11 @@ out_remove_domain:
 static int adi_gpio_remove(struct platform_device *pdev)
 {
 	struct gpio_port *port = platform_get_drvdata(pdev);
-	int ret;
 	u8 offset;
 
 	list_del(&port->node);
 	gpiochip_remove_pin_ranges(&port->chip);
-	ret = gpiochip_remove(&port->chip);
+	gpiochip_remove(&port->chip);
 	if (port->pint) {
 		for (offset = 0; offset < port->width; offset++)
 			irq_dispose_mapping(irq_find_mapping(port->domain,
@@ -1051,7 +1050,7 @@ static int adi_gpio_remove(struct platform_device *pdev)
 		irq_domain_remove(port->domain);
 	}
 
-	return ret;
+	return 0;
 }
 
 static int adi_pinctrl_probe(struct platform_device *pdev)
drivers/pinctrl/pinctrl-as3722.c +2 -9
index c862f9c0..0e4ec91 100644
@@ -565,7 +565,6 @@ static int as3722_pinctrl_probe(struct platform_device *pdev)
 {
 	struct as3722_pctrl_info *as_pci;
 	int ret;
-	int tret;
 
 	as_pci = devm_kzalloc(&pdev->dev, sizeof(*as_pci), GFP_KERNEL);
 	if (!as_pci)
@@ -611,10 +610,7 @@ static int as3722_pinctrl_probe(struct platform_device *pdev)
 	return 0;
 
 fail_range_add:
-	tret = gpiochip_remove(&as_pci->gpio_chip);
-	if (tret < 0)
-		dev_warn(&pdev->dev, "Couldn't remove gpio chip, %d\n", tret);
-
+	gpiochip_remove(&as_pci->gpio_chip);
 fail_chip_add:
 	pinctrl_unregister(as_pci->pctl);
 	return ret;
@@ -623,11 +619,8 @@ fail_chip_add:
 static int as3722_pinctrl_remove(struct platform_device *pdev)
 {
 	struct as3722_pctrl_info *as_pci = platform_get_drvdata(pdev);
-	int ret;
 
-	ret = gpiochip_remove(&as_pci->gpio_chip);
-	if (ret < 0)
-		return ret;
+	gpiochip_remove(&as_pci->gpio_chip);
 	pinctrl_unregister(as_pci->pctl);
 	return 0;
 }
drivers/pinctrl/pinctrl-baytrail.c +1 -4
index 701a646..d8e9469 100644
@@ -638,12 +638,9 @@ MODULE_DEVICE_TABLE(acpi, byt_gpio_acpi_match);
 static int byt_gpio_remove(struct platform_device *pdev)
 {
 	struct byt_gpio *vg = platform_get_drvdata(pdev);
-	int err;
 
 	pm_runtime_disable(&pdev->dev);
-	err = gpiochip_remove(&vg->chip);
-	if (err)
-		dev_warn(&pdev->dev, "failed to remove gpio_chip.\n");
+	gpiochip_remove(&vg->chip);
 
 	return 0;
 }
drivers/pinctrl/pinctrl-coh901.c +2 -8
index d182fdd..29cbbab 100644
@@ -756,8 +756,7 @@ static int __init u300_gpio_probe(struct platform_device *pdev)
 
 err_no_range:
 err_no_irqchip:
-	if (gpiochip_remove(&gpio->chip))
-		dev_err(&pdev->dev, "failed to remove gpio chip\n");
+	gpiochip_remove(&gpio->chip);
 err_no_chip:
 	clk_disable_unprepare(gpio->clk);
 	dev_err(&pdev->dev, "module ERROR:%d\n", err);
@@ -767,16 +766,11 @@ err_no_chip:
 static int __exit u300_gpio_remove(struct platform_device *pdev)
 {
 	struct u300_gpio *gpio = platform_get_drvdata(pdev);
-	int err;
 
 	/* Turn off the GPIO block */
 	writel(0x00000000U, gpio->base + U300_GPIO_CR);
 
-	err = gpiochip_remove(&gpio->chip);
-	if (err < 0) {
-		dev_err(gpio->dev, "unable to remove gpiochip: %d\n", err);
-		return err;
-	}
+	gpiochip_remove(&gpio->chip);
 	clk_disable_unprepare(gpio->clk);
 	return 0;
 }
drivers/pinctrl/pinctrl-rockchip.c +4 -12
index 192aaee..e2e66c8 100644
@@ -1492,10 +1492,7 @@ fail:
 	for (--i, --bank; i >= 0; --i, --bank) {
 		if (!bank->valid)
 			continue;
-
-		if (gpiochip_remove(&bank->gpio_chip))
-			dev_err(&pdev->dev, "gpio chip %s remove failed\n",
-							bank->gpio_chip.label);
+		gpiochip_remove(&bank->gpio_chip);
 	}
 	return ret;
 }
@@ -1505,20 +1502,15 @@ static int rockchip_gpiolib_unregister(struct platform_device *pdev,
 {
 	struct rockchip_pin_ctrl *ctrl = info->ctrl;
 	struct rockchip_pin_bank *bank = ctrl->pin_banks;
-	int ret = 0;
 	int i;
 
-	for (i = 0; !ret && i < ctrl->nr_banks; ++i, ++bank) {
+	for (i = 0; i < ctrl->nr_banks; ++i, ++bank) {
 		if (!bank->valid)
 			continue;
-
-		ret = gpiochip_remove(&bank->gpio_chip);
+		gpiochip_remove(&bank->gpio_chip);
 	}
 
-	if (ret)
-		dev_err(&pdev->dev, "gpio chip remove failed\n");
-
-	return ret;
+	return 0;
 }
 
 static int rockchip_get_bank_data(struct rockchip_pin_bank *bank,
drivers/pinctrl/sh-pfc/gpio.c +3 -6
index a9288ab..80f641e 100644
@@ -409,11 +409,8 @@ int sh_pfc_register_gpiochip(struct sh_pfc *pfc)
 
 int sh_pfc_unregister_gpiochip(struct sh_pfc *pfc)
 {
-	int err;
-	int ret;
-
-	ret = gpiochip_remove(&pfc->gpio->gpio_chip);
-	err = gpiochip_remove(&pfc->func->gpio_chip);
+	gpiochip_remove(&pfc->gpio->gpio_chip);
+	gpiochip_remove(&pfc->func->gpio_chip);
 
-	return ret < 0 ? ret : err;
+	return 0;
 }
drivers/pinctrl/spear/pinctrl-plgpio.c +1 -2
index 3a20cdc..bddb791 100644
@@ -606,8 +606,7 @@ static int plgpio_probe(struct platform_device *pdev)
 
 remove_gpiochip:
 	dev_info(&pdev->dev, "Remove gpiochip\n");
-	if (gpiochip_remove(&plgpio->chip))
-		dev_err(&pdev->dev, "unable to remove gpiochip\n");
+	gpiochip_remove(&plgpio->chip);
 unprepare_clk:
 	if (!IS_ERR(plgpio->clk))
 		clk_unprepare(plgpio->clk);
drivers/pinctrl/sunxi/pinctrl-sunxi.c +1 -2
index 47f5e1b..96ee6bb 100644
@@ -983,8 +983,7 @@ int sunxi_pinctrl_init(struct platform_device *pdev,
 clk_error:
 	clk_disable_unprepare(clk);
 gpiochip_error:
-	if (gpiochip_remove(pctl->chip))
-		dev_err(&pdev->dev, "failed to remove gpio chip\n");
+	gpiochip_remove(pctl->chip);
 pinctrl_error:
 	pinctrl_unregister(pctl->pctl_dev);
 	return ret;
drivers/pinctrl/vt8500/pinctrl-wmt.c +2 -7
index 8c976c2..8cea355 100644
@@ -615,8 +615,7 @@ int wmt_pinctrl_probe(struct platform_device *pdev,
 	return 0;
 
 fail_range:
-	if (gpiochip_remove(&data->gpio_chip))
-		dev_err(&pdev->dev, "failed to remove gpio chip\n");
+	gpiochip_remove(&data->gpio_chip);
 fail_gpio:
 	pinctrl_unregister(data->pctl_dev);
 	return err;
@@ -625,12 +624,8 @@ fail_gpio:
 int wmt_pinctrl_remove(struct platform_device *pdev)
 {
 	struct wmt_pinctrl_data *data = platform_get_drvdata(pdev);
-	int err;
-
-	err = gpiochip_remove(&data->gpio_chip);
-	if (err)
-		dev_err(&pdev->dev, "failed to remove gpio chip\n");
 
+	gpiochip_remove(&data->gpio_chip);
 	pinctrl_unregister(data->pctl_dev);
 
 	return 0;
Signature · 1 line
1.9.1
#31 lore raw

PATCH 3/3 driver:gpio remove all usage of gpio_remove retval in driver

In reply to abdoulaye berthe

this remove all reference to gpio_remove retval in all driver except pinctrl and gpio. the same thing is done for gpio and pinctrl in two different patches.

---
 arch/arm/common/scoop.c                        | 10 ++--------
 arch/mips/txx9/generic/setup.c                 |  4 ++--
 arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c |  3 ++-
 arch/sh/boards/mach-x3proto/gpio.c             |  6 ++----
 drivers/bcma/driver_gpio.c                     |  3 ++-
 drivers/hid/hid-cp2112.c                       |  6 ++----
 drivers/input/keyboard/adp5588-keys.c          |  4 +---
 drivers/input/keyboard/adp5589-keys.c          |  4 +---
 drivers/input/touchscreen/ad7879.c             | 10 +++-------
 drivers/leds/leds-pca9532.c                    | 10 ++--------
 drivers/leds/leds-tca6507.c                    |  7 ++-----
 drivers/media/dvb-frontends/cxd2820r_core.c    | 10 +++-------
 drivers/mfd/asic3.c                            |  3 ++-
 drivers/mfd/htc-i2cpld.c                       |  8 +-------
 drivers/mfd/sm501.c                            | 17 +++--------------
 drivers/mfd/tc6393xb.c                         | 13 ++++---------
 drivers/mfd/ucb1x00-core.c                     |  8 ++------
 drivers/pinctrl/pinctrl-abx500.c               | 15 +++------------
 drivers/pinctrl/pinctrl-exynos5440.c           |  6 +-----
 drivers/pinctrl/pinctrl-msm.c                  | 10 +++-------
 drivers/pinctrl/pinctrl-nomadik.c              |  2 +-
 drivers/pinctrl/pinctrl-samsung.c              | 14 ++++----------
 drivers/platform/x86/intel_pmic_gpio.c         |  3 +--
 drivers/ssb/driver_gpio.c                      |  3 ++-
 drivers/staging/vme/devices/vme_pio2_gpio.c    |  4 +---
 drivers/tty/serial/max310x.c                   | 10 ++++------
 drivers/video/fbdev/via/via-gpio.c             | 10 +++-------
 sound/soc/codecs/wm5100.c                      |  5 +----
 sound/soc/codecs/wm8903.c                      |  6 +-----
 sound/soc/codecs/wm8962.c                      |  5 +----
 sound/soc/codecs/wm8996.c                      |  6 +-----
 31 files changed, 63 insertions(+), 162 deletions(-)
arch/arm/common/scoop.c +2 -8
index 6ef146e..5881c9c 100644
@@ -244,18 +244,12 @@ err_ioremap:
 static int scoop_remove(struct platform_device *pdev)
 {
 	struct scoop_dev *sdev = platform_get_drvdata(pdev);
-	int ret;
 
 	if (!sdev)
 		return -EINVAL;
 
-	if (sdev->gpio.base != -1) {
-		ret = gpiochip_remove(&sdev->gpio);
-		if (ret) {
-			dev_err(&pdev->dev, "Can't remove gpio chip: %d\n", ret);
-			return ret;
-		}
-	}
+	if (sdev->gpio.base != -1)
+		gpiochip_remove(&sdev->gpio);
 
 	platform_set_drvdata(pdev, NULL);
 	iounmap(sdev->base);
arch/mips/txx9/generic/setup.c +2 -2
index dd2cf25..49be896 100644
@@ -789,11 +789,11 @@ void __init txx9_iocled_init(unsigned long baseaddr,
 	if (platform_device_add(pdev))
 		goto out_pdev;
 	return;
+
 out_pdev:
 	platform_device_put(pdev);
 out_gpio:
-	if (gpiochip_remove(&iocled->chip))
-		return;
+	gpiochip_remove(&iocled->chip);
 out_unmap:
 	iounmap(iocled->mmioaddr);
 out_free:
arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c +2 -1
index e238b6a..7399702 100644
@@ -141,7 +141,8 @@ static int mcu_gpiochip_add(struct mcu *mcu)
 
 static int mcu_gpiochip_remove(struct mcu *mcu)
 {
-	return gpiochip_remove(&mcu->gc);
+	gpiochip_remove(&mcu->gc);
+	return 0;
 }
 
 static int mcu_probe(struct i2c_client *client, const struct i2c_device_id *id)
arch/sh/boards/mach-x3proto/gpio.c +2 -4
index 3ea65e9..f035a7a 100644
@@ -128,10 +128,8 @@ int __init x3proto_gpio_setup(void)
 	return 0;
 
 err_irq:
-	ret = gpiochip_remove(&x3proto_gpio_chip);
-	if (unlikely(ret))
-		pr_err("Failed deregistering GPIO\n");
-
+	gpiochip_remove(&x3proto_gpio_chip);
+	ret = 0;
 err_gpio:
 	synchronize_irq(ilsel);
 
drivers/bcma/driver_gpio.c +2 -1
index d7f81ad..7dd70a7 100644
@@ -250,5 +250,6 @@ int bcma_gpio_init(struct bcma_drv_cc *cc)
 int bcma_gpio_unregister(struct bcma_drv_cc *cc)
 {
 	bcma_gpio_irq_domain_exit(cc);
-	return gpiochip_remove(&cc->gpio);
+	gpiochip_remove(&cc->gpio);
+	return 0;
 }
drivers/hid/hid-cp2112.c +2 -4
index 56be85a..a7f1b4b 100644
@@ -964,8 +964,7 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id)
 	return ret;
 
 err_gpiochip_remove:
-	if (gpiochip_remove(&dev->gc) < 0)
-		hid_err(hdev, "error removing gpio chip\n");
+	gpiochip_remove(&dev->gc);
 err_free_i2c:
 	i2c_del_adapter(&dev->adap);
 err_free_dev:
@@ -984,8 +983,7 @@ static void cp2112_remove(struct hid_device *hdev)
 	struct cp2112_device *dev = hid_get_drvdata(hdev);
 
 	sysfs_remove_group(&hdev->dev.kobj, &cp2112_attr_group);
-	if (gpiochip_remove(&dev->gc))
-		hid_err(hdev, "unable to remove gpio chip\n");
+	gpiochip_remove(&dev->gc);
 	i2c_del_adapter(&dev->adap);
 	/* i2c_del_adapter has finished removing all i2c devices from our
 	 * adapter. Well behaved devices should no longer call our cp2112_xfer
drivers/input/keyboard/adp5588-keys.c +1 -3
index 5ef7fcf..b97ed44 100644
@@ -251,9 +251,7 @@ static void adp5588_gpio_remove(struct adp5588_kpad *kpad)
 			dev_warn(dev, "teardown failed %d\n", error);
 	}
 
-	error = gpiochip_remove(&kpad->gc);
-	if (error)
-		dev_warn(dev, "gpiochip_remove failed %d\n", error);
+	gpiochip_remove(&kpad->gc);
 }
 #else
 static inline int adp5588_gpio_add(struct adp5588_kpad *kpad)
drivers/input/keyboard/adp5589-keys.c +1 -3
index 6329549..a452677 100644
@@ -567,9 +567,7 @@ static void adp5589_gpio_remove(struct adp5589_kpad *kpad)
 			dev_warn(dev, "teardown failed %d\n", error);
 	}
 
-	error = gpiochip_remove(&kpad->gc);
-	if (error)
-		dev_warn(dev, "gpiochip_remove failed %d\n", error);
+	gpiochip_remove(&kpad->gc);
 }
 #else
 static inline int adp5589_gpio_add(struct adp5589_kpad *kpad)
drivers/input/touchscreen/ad7879.c +3 -7
index fce5906..1eb9d3c 100644
@@ -470,14 +470,10 @@ static int ad7879_gpio_add(struct ad7879 *ts,
 static void ad7879_gpio_remove(struct ad7879 *ts)
 {
 	const struct ad7879_platform_data *pdata = dev_get_platdata(ts->dev);
-	int ret;
 
-	if (pdata->gpio_export) {
-		ret = gpiochip_remove(&ts->gc);
-		if (ret)
-			dev_err(ts->dev, "failed to remove gpio %d\n",
-				ts->gc.base);
-	}
+	if (pdata->gpio_export)
+		gpiochip_remove(&ts->gc);
+
 }
 #else
 static inline int ad7879_gpio_add(struct ad7879 *ts,
drivers/leds/leds-pca9532.c +2 -8
index 4a0e786..5a6363d 100644
@@ -319,14 +319,8 @@ static int pca9532_destroy_devices(struct pca9532_data *data, int n_devs)
 	}
 
 #ifdef CONFIG_LEDS_PCA9532_GPIO
-	if (data->gpio.dev) {
-		int err = gpiochip_remove(&data->gpio);
-		if (err) {
-			dev_err(&data->client->dev, "%s failed, %d\n",
-						"gpiochip_remove()", err);
-			return err;
-		}
-	}
+	if (data->gpio.dev)
+		gpiochip_remove(&data->gpio);
 #endif
 
 	return 0;
drivers/leds/leds-tca6507.c +2 -5
index 3d9e267..20fa8e7 100644
@@ -667,11 +667,8 @@ static int tca6507_probe_gpios(struct i2c_client *client,
 
 static void tca6507_remove_gpio(struct tca6507_chip *tca)
 {
-	if (tca->gpio.ngpio) {
-		int err = gpiochip_remove(&tca->gpio);
-		dev_err(&tca->client->dev, "%s failed, %d\n",
-			"gpiochip_remove()", err);
-	}
+	if (tca->gpio.ngpio)
+		gpiochip_remove(&tca->gpio);
 }
 #else /* CONFIG_GPIOLIB */
 static int tca6507_probe_gpios(struct i2c_client *client,
drivers/media/dvb-frontends/cxd2820r_core.c +3 -7
index 03930d5..51ef8931 100644
@@ -584,18 +584,14 @@ static int cxd2820r_get_frontend_algo(struct dvb_frontend *fe)
 static void cxd2820r_release(struct dvb_frontend *fe)
 {
 	struct cxd2820r_priv *priv = fe->demodulator_priv;
-	int uninitialized_var(ret); /* silence compiler warning */
 
 	dev_dbg(&priv->i2c->dev, "%s\n", __func__);
 
 #ifdef CONFIG_GPIOLIB
 	/* remove GPIOs */
-	if (priv->gpio_chip.label) {
-		ret = gpiochip_remove(&priv->gpio_chip);
-		if (ret)
-			dev_err(&priv->i2c->dev, "%s: gpiochip_remove() " \
-					"failed=%d\n", KBUILD_MODNAME, ret);
-	}
+	if (priv->gpio_chip.label)
+		gpiochip_remove(&priv->gpio_chip);
+
 #endif
 	kfree(priv);
 	return;
drivers/mfd/asic3.c +2 -1
index 9f6294f..8a968f9 100644
@@ -605,7 +605,8 @@ static int asic3_gpio_remove(struct platform_device *pdev)
 {
 	struct asic3 *asic = platform_get_drvdata(pdev);
 
-	return gpiochip_remove(&asic->gpio);
+	gpiochip_remove(&asic->gpio);
+	return 0;
 }
 
 static void asic3_clk_enable(struct asic3 *asic, struct asic3_clk *clk)
drivers/mfd/htc-i2cpld.c +1 -7
index d7b2a75..4306329 100644
@@ -486,15 +486,9 @@ static int htcpld_register_chip_gpio(
 
 	ret = gpiochip_add(&(chip->chip_in));
 	if (ret) {
-		int error;
-
 		dev_warn(dev, "Unable to register input GPIOs for 0x%x: %d\n",
 			 plat_chip_data->addr, ret);
-
-		error = gpiochip_remove(&(chip->chip_out));
-		if (error)
-			dev_warn(dev, "Error while trying to unregister gpio chip: %d\n", error);
-
+		gpiochip_remove(&(chip->chip_out));
 		return ret;
 	}
 
drivers/mfd/sm501.c +3 -14
index 81e6d09..02027b7 100644
@@ -1047,7 +1047,6 @@ static int sm501_register_gpio(struct sm501_devdata *sm)
 	struct sm501_gpio *gpio = &sm->gpio;
 	resource_size_t iobase = sm->io_res->start + SM501_GPIO;
 	int ret;
-	int tmp;
 
 	dev_dbg(sm->dev, "registering gpio block %08llx\n",
 		(unsigned long long)iobase);
@@ -1086,11 +1085,7 @@ static int sm501_register_gpio(struct sm501_devdata *sm)
 	return 0;
 
  err_low_chip:
-	tmp = gpiochip_remove(&gpio->low.gpio);
-	if (tmp) {
-		dev_err(sm->dev, "cannot remove low chip, cannot tidy up\n");
-		return ret;
-	}
+	gpiochip_remove(&gpio->low.gpio);
 
  err_mapped:
 	iounmap(gpio->regs);
@@ -1105,18 +1100,12 @@ static int sm501_register_gpio(struct sm501_devdata *sm)
 static void sm501_gpio_remove(struct sm501_devdata *sm)
 {
 	struct sm501_gpio *gpio = &sm->gpio;
-	int ret;
 
 	if (!sm->gpio.registered)
 		return;
 
-	ret = gpiochip_remove(&gpio->low.gpio);
-	if (ret)
-		dev_err(sm->dev, "cannot remove low chip, cannot tidy up\n");
-
-	ret = gpiochip_remove(&gpio->high.gpio);
-	if (ret)
-		dev_err(sm->dev, "cannot remove high chip, cannot tidy up\n");
+	gpiochip_remove(&gpio->low.gpio);
+	gpiochip_remove(&gpio->high.gpio);
 
 	iounmap(gpio->regs);
 	release_resource(gpio->regs_res);
drivers/mfd/tc6393xb.c +4 -9
index 11c19e5..4fac16b 100644
@@ -607,7 +607,7 @@ static int tc6393xb_probe(struct platform_device *dev)
 	struct tc6393xb_platform_data *tcpd = dev_get_platdata(&dev->dev);
 	struct tc6393xb *tc6393xb;
 	struct resource *iomem, *rscr;
-	int ret, temp;
+	int ret;
 
 	iomem = platform_get_resource(dev, IORESOURCE_MEM, 0);
 	if (!iomem)
@@ -714,7 +714,7 @@ err_setup:
 
 err_gpio_add:
 	if (tc6393xb->gpio.base != -1)
-		temp = gpiochip_remove(&tc6393xb->gpio);
+		gpiochip_remove(&tc6393xb->gpio);
 	tcpd->disable(dev);
 err_enable:
 	clk_disable(tc6393xb->clk);
@@ -744,13 +744,8 @@ static int tc6393xb_remove(struct platform_device *dev)
 
 	tc6393xb_detach_irq(dev);
 
-	if (tc6393xb->gpio.base != -1) {
-		ret = gpiochip_remove(&tc6393xb->gpio);
-		if (ret) {
-			dev_err(&dev->dev, "Can't remove gpio chip: %d\n", ret);
-			return ret;
-		}
-	}
+	if (tc6393xb->gpio.base != -1)
+		gpiochip_remove(&tc6393xb->gpio);
 
 	ret = tcpd->disable(dev);
 	clk_disable(tc6393xb->clk);
drivers/mfd/ucb1x00-core.c +2 -6
index 153d595..58ea9fd 100644
@@ -621,7 +621,6 @@ static void ucb1x00_remove(struct mcp *mcp)
 	struct ucb1x00_plat_data *pdata = mcp->attached_device.platform_data;
 	struct ucb1x00 *ucb = mcp_get_drvdata(mcp);
 	struct list_head *l, *n;
-	int ret;
 
 	mutex_lock(&ucb1x00_mutex);
 	list_del(&ucb->node);
@@ -631,11 +630,8 @@ static void ucb1x00_remove(struct mcp *mcp)
 	}
 	mutex_unlock(&ucb1x00_mutex);
 
-	if (ucb->gpio.base != -1) {
-		ret = gpiochip_remove(&ucb->gpio);
-		if (ret)
-			dev_err(&ucb->dev, "Can't remove gpio chip: %d\n", ret);
-	}
+	if (ucb->gpio.base != -1)
+		gpiochip_remove(&ucb->gpio);
 
 	irq_set_chained_handler(ucb->irq, NULL);
 	irq_free_descs(ucb->irq_base, 16);
drivers/pinctrl/pinctrl-abx500.c +3 -12
index 163da9c..7dc9804 100644
@@ -1221,7 +1221,7 @@ static int abx500_gpio_probe(struct platform_device *pdev)
 	const struct of_device_id *match;
 	struct abx500_pinctrl *pct;
 	unsigned int id = -1;
-	int ret, err;
+	int ret;
 	int i;
 
 	if (!np) {
@@ -1313,10 +1313,7 @@ static int abx500_gpio_probe(struct platform_device *pdev)
 	return 0;
 
 out_rem_chip:
-	err = gpiochip_remove(&pct->chip);
-	if (err)
-		dev_info(&pdev->dev, "failed to remove gpiochip\n");
-
+	gpiochip_remove(&pct->chip);
 	return ret;
 }
 
@@ -1327,14 +1324,8 @@ out_rem_chip:
 static int abx500_gpio_remove(struct platform_device *pdev)
 {
 	struct abx500_pinctrl *pct = platform_get_drvdata(pdev);
-	int ret;
 
-	ret = gpiochip_remove(&pct->chip);
-	if (ret < 0) {
-		dev_err(pct->dev, "unable to remove gpiochip: %d\n",
-			ret);
-		return ret;
-	}
+	gpiochip_remove(&pct->chip);
 
 	return 0;
 }
drivers/pinctrl/pinctrl-exynos5440.c +1 -5
index 8fe2ab0..648c600 100644
@@ -881,11 +881,7 @@ static int exynos5440_gpiolib_register(struct platform_device *pdev,
 static int exynos5440_gpiolib_unregister(struct platform_device *pdev,
 				struct exynos5440_pinctrl_priv_data *priv)
 {
-	int ret = gpiochip_remove(priv->gc);
-	if (ret) {
-		dev_err(&pdev->dev, "gpio chip remove failed\n");
-		return ret;
-	}
+	gpiochip_remove(priv->gc);
 	return 0;
 }
 
drivers/pinctrl/pinctrl-msm.c +3 -7
index df6dda4c..b4b941f 100644
@@ -923,14 +923,10 @@ EXPORT_SYMBOL(msm_pinctrl_probe);
 int msm_pinctrl_remove(struct platform_device *pdev)
 {
 	struct msm_pinctrl *pctrl = platform_get_drvdata(pdev);
-	int ret;
-
-	ret = gpiochip_remove(&pctrl->chip);
-	if (ret) {
-		dev_err(&pdev->dev, "Failed to remove gpiochip\n");
-		return ret;
-	}
 
+	gpiochip_remove(&pctrl->chip);
+	irq_set_chained_handler(pctrl->irq, NULL);
+	irq_domain_remove(pctrl->domain);
 	pinctrl_unregister(pctrl->pctrl);
 
 	return 0;
drivers/pinctrl/pinctrl-nomadik.c +1 -1
index 8f6f16e..98c5ce2 100644
@@ -1261,7 +1261,7 @@ static int nmk_gpio_probe(struct platform_device *dev)
 				   IRQ_TYPE_EDGE_FALLING);
 	if (ret) {
 		dev_err(&dev->dev, "could not add irqchip\n");
-		ret = gpiochip_remove(&nmk_chip->chip);
+		gpiochip_remove(&nmk_chip->chip);
 		return -ENODEV;
 	}
 	/* Then register the chain on the parent IRQ */
drivers/pinctrl/pinctrl-samsung.c +4 -10
index 3e61d0f..99ec2fe 100644
@@ -841,9 +841,7 @@ static int samsung_gpiolib_register(struct platform_device *pdev,
 
 fail:
 	for (--i, --bank; i >= 0; --i, --bank)
-		if (gpiochip_remove(&bank->gpio_chip))
-			dev_err(&pdev->dev, "gpio chip %s remove failed\n",
-							bank->gpio_chip.label);
+		gpiochip_remove(&bank->gpio_chip);
 	return ret;
 }
 
@@ -853,16 +851,12 @@ static int samsung_gpiolib_unregister(struct platform_device *pdev,
 {
 	struct samsung_pin_ctrl *ctrl = drvdata->ctrl;
 	struct samsung_pin_bank *bank = ctrl->pin_banks;
-	int ret = 0;
 	int i;
 
-	for (i = 0; !ret && i < ctrl->nr_banks; ++i, ++bank)
-		ret = gpiochip_remove(&bank->gpio_chip);
+	for (i = 0; i < ctrl->nr_banks; ++i, ++bank)
+		gpiochip_remove(&bank->gpio_chip);
 
-	if (ret)
-		dev_err(&pdev->dev, "gpio chip remove failed\n");
-
-	return ret;
+	return 0;
 }
 
 static const struct of_device_id samsung_pinctrl_dt_match[];
drivers/platform/x86/intel_pmic_gpio.c +1 -2
index 40929e4..04fed00 100644
@@ -301,8 +301,7 @@ static int platform_pmic_gpio_probe(struct platform_device *pdev)
 	return 0;
 
 fail_request_irq:
-	if (gpiochip_remove(&pg->chip))
-		pr_err("gpiochip_remove failed\n");
+	gpiochip_remove(&pg->chip);
 err:
 	iounmap(pg->gpiointr);
 err2:
drivers/ssb/driver_gpio.c +2 -1
index ba350d2..f92e266 100644
@@ -475,7 +475,8 @@ int ssb_gpio_unregister(struct ssb_bus *bus)
 {
 	if (ssb_chipco_available(&bus->chipco) ||
 	    ssb_extif_available(&bus->extif)) {
-		return gpiochip_remove(&bus->gpio);
+		gpiochip_remove(&bus->gpio);
+		return 0;
 	} else {
 		SSB_WARN_ON(1);
 	}
drivers/staging/vme/devices/vme_pio2_gpio.c +1 -3
index 2a2d920..3068288 100644
@@ -221,9 +221,7 @@ void pio2_gpio_exit(struct pio2_card *card)
 {
 	const char *label = card->gc.label;
 
-	if (gpiochip_remove(&(card->gc)))
-		dev_err(&card->vdev->dev, "Failed to remove GPIO");
-
+	gpiochip_remove(&(card->gc));
 	kfree(label);
 }
 
drivers/tty/serial/max310x.c +4 -6
index 2a99d0c..740171b 100644
@@ -1249,7 +1249,7 @@ static int max310x_probe(struct device *dev, struct max310x_devtype *devtype,
 	mutex_destroy(&s->mutex);
 
 #ifdef CONFIG_GPIOLIB
-	WARN_ON(gpiochip_remove(&s->gpio));
+	gpiochip_remove(&s->gpio);
 
 out_uart:
 #endif
@@ -1264,12 +1264,10 @@ out_clk:
 static int max310x_remove(struct device *dev)
 {
 	struct max310x_port *s = dev_get_drvdata(dev);
-	int i, ret = 0;
+	int i;
 
 #ifdef CONFIG_GPIOLIB
-	ret = gpiochip_remove(&s->gpio);
-	if (ret)
-		return ret;
+	gpiochip_remove(&s->gpio);
 #endif
 
 	for (i = 0; i < s->uart.nr; i++) {
@@ -1283,7 +1281,7 @@ static int max310x_remove(struct device *dev)
 	uart_unregister_driver(&s->uart);
 	clk_disable_unprepare(s->clk);
 
-	return ret;
+	return 0;
 }
 
 static const struct of_device_id __maybe_unused max310x_dt_ids[] = {
drivers/video/fbdev/via/via-gpio.c +3 -7
index e408679..6f433b8 100644
@@ -270,7 +270,7 @@ static int viafb_gpio_probe(struct platform_device *platdev)
 static int viafb_gpio_remove(struct platform_device *platdev)
 {
 	unsigned long flags;
-	int ret = 0, i;
+	int i;
 
 #ifdef CONFIG_PM
 	viafb_pm_unregister(&viafb_gpio_pm_hooks);
@@ -280,11 +280,7 @@ static int viafb_gpio_remove(struct platform_device *platdev)
 	 * Get unregistered.
 	 */
 	if (viafb_gpio_config.gpio_chip.ngpio > 0) {
-		ret = gpiochip_remove(&viafb_gpio_config.gpio_chip);
-		if (ret) { /* Somebody still using it? */
-			printk(KERN_ERR "Viafb: GPIO remove failed\n");
-			return ret;
-		}
+		gpiochip_remove(&viafb_gpio_config.gpio_chip);
 	}
 	/*
 	 * Disable the ports.
@@ -294,7 +290,7 @@ static int viafb_gpio_remove(struct platform_device *platdev)
 		viafb_gpio_disable(viafb_gpio_config.active_gpios[i]);
 	viafb_gpio_config.gpio_chip.ngpio = 0;
 	spin_unlock_irqrestore(&viafb_gpio_config.vdev->reg_lock, flags);
-	return ret;
+	return 0;
 }
 
 static struct platform_driver via_gpio_driver = {
sound/soc/codecs/wm5100.c +1 -4
index 91a9ea2..a75b7c1 100644
@@ -2320,11 +2320,8 @@ static void wm5100_init_gpio(struct i2c_client *i2c)
 static void wm5100_free_gpio(struct i2c_client *i2c)
 {
 	struct wm5100_priv *wm5100 = i2c_get_clientdata(i2c);
-	int ret;
 
-	ret = gpiochip_remove(&wm5100->gpio_chip);
-	if (ret != 0)
-		dev_err(&i2c->dev, "Failed to remove GPIOs: %d\n", ret);
+	gpiochip_remove(&wm5100->gpio_chip);
 }
 #else
 static void wm5100_init_gpio(struct i2c_client *i2c)
sound/soc/codecs/wm8903.c +1 -5
index b84940c..c87bc04 100644
@@ -1878,11 +1878,7 @@ static void wm8903_init_gpio(struct wm8903_priv *wm8903)
 
 static void wm8903_free_gpio(struct wm8903_priv *wm8903)
 {
-	int ret;
-
-	ret = gpiochip_remove(&wm8903->gpio_chip);
-	if (ret != 0)
-		dev_err(wm8903->dev, "Failed to remove GPIOs: %d\n", ret);
+	gpiochip_remove(&wm8903->gpio_chip);
 }
 #else
 static void wm8903_init_gpio(struct wm8903_priv *wm8903)
sound/soc/codecs/wm8962.c +1 -4
index ca2fda9..896650f 100644
@@ -3397,11 +3397,8 @@ static void wm8962_init_gpio(struct snd_soc_codec *codec)
 static void wm8962_free_gpio(struct snd_soc_codec *codec)
 {
 	struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec);
-	int ret;
 
-	ret = gpiochip_remove(&wm8962->gpio_chip);
-	if (ret != 0)
-		dev_err(codec->dev, "Failed to remove GPIOs: %d\n", ret);
+	gpiochip_remove(&wm8962->gpio_chip);
 }
 #else
 static void wm8962_init_gpio(struct snd_soc_codec *codec)
sound/soc/codecs/wm8996.c +1 -5
index 6926633..35a2bb8 100644
@@ -2220,11 +2220,7 @@ static void wm8996_init_gpio(struct wm8996_priv *wm8996)
 
 static void wm8996_free_gpio(struct wm8996_priv *wm8996)
 {
-	int ret;
-
-	ret = gpiochip_remove(&wm8996->gpio_chip);
-	if (ret != 0)
-		dev_err(wm8996->dev, "Failed to remove GPIOs: %d\n", ret);
+	gpiochip_remove(&wm8996->gpio_chip);
 }
 #else
 static void wm8996_init_gpio(struct wm8996_priv *wm8996)
Signature · 1 line
1.9.1
#32 lore raw

Re: [PATCH 3/3] driver:gpio remove all usage of gpio_remove retval in driver

On Sat, Jul 12, 2014 at 10:30 PM, abdoulaye berthe <[email protected]> wrote:

Heads up. Requesting ACKs for this patch or I'm atleast warning that it will be applied. We're getting rid of the return value from gpiochip_remove().

Quoted 5 lines

this remove all reference to gpio_remove retval in all driver except pinctrl and gpio. the same thing is done for gpio and pinctrl in two different patches.

(...)

I think this patch probably needs to be broken down per-subsystem as it hits all over the map. But let's start requesting ACKs for the individual pieces.
Actually I think it will be OK to merge because there is likely not much churn around these code sites.

I'm a bit torn between just wanting a big patch for this hitting drivers/gpio and smaller patches hitting one subsystem at a time. We should be able to hammer this in one switch strike.

Quoted 1 line
 arch/arm/common/scoop.c                        | 10 ++--------

ARM SoC folks, can you ACK this?

Quoted 1 line
 arch/mips/txx9/generic/setup.c                 |  4 ++--

Ralf can you ACK this?

Quoted 1 line
 arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c |  3 ++-

Benji, can you ACK this?

Quoted 1 line
 arch/sh/boards/mach-x3proto/gpio.c             |  6 ++----

Aha noone can ACK this, whatever...

Quoted 1 line
 drivers/bcma/driver_gpio.c                     |  3 ++-

Rafał can you ACK this?

Quoted 1 line
 drivers/hid/hid-cp2112.c                       |  6 ++----

Jiri can you ACK this?

Quoted 3 lines
 drivers/input/keyboard/adp5588-keys.c          |  4 +---
 drivers/input/keyboard/adp5589-keys.c          |  4 +---
 drivers/input/touchscreen/ad7879.c             | 10 +++-------

Dmitry can you ACK this?

Quoted 2 lines
 drivers/leds/leds-pca9532.c                    | 10 ++--------
 drivers/leds/leds-tca6507.c                    |  7 ++-----

Bryan can you ACK this?

Quoted 1 line
 drivers/media/dvb-frontends/cxd2820r_core.c    | 10 +++-------

Mauro can you ACK this?

(Hm that looks weird. Mental note to look closer at this.)

Quoted 5 lines
 drivers/mfd/asic3.c                            |  3 ++-
 drivers/mfd/htc-i2cpld.c                       |  8 +-------
 drivers/mfd/sm501.c                            | 17 +++--------------
 drivers/mfd/tc6393xb.c                         | 13 ++++---------
 drivers/mfd/ucb1x00-core.c                     |  8 ++------

Lee/Sam can either of you ACK this?

Quoted 5 lines
 drivers/pinctrl/pinctrl-abx500.c               | 15 +++------------
 drivers/pinctrl/pinctrl-exynos5440.c           |  6 +-----
 drivers/pinctrl/pinctrl-msm.c                  | 10 +++-------
 drivers/pinctrl/pinctrl-nomadik.c              |  2 +-
 drivers/pinctrl/pinctrl-samsung.c              | 14 ++++----------

Abdoulaye: these should be in the other patch for pinctrl.

Quoted 1 line
 drivers/platform/x86/intel_pmic_gpio.c         |  3 +--

Matthew can you ACK this?

Quoted 1 line
 drivers/ssb/driver_gpio.c                      |  3 ++-

Michael can you (A) ACK this and
(B) think of moving this driver to drivers/gpio... Patches welcome.

Quoted 2 lines
 drivers/staging/vme/devices/vme_pio2_gpio.c    |  4 +---
 drivers/tty/serial/max310x.c                   | 10 ++++------

Greg can you ACK this?

Quoted 1 line
 drivers/video/fbdev/via/via-gpio.c             | 10 +++-------

Tomi can you ACK this?

Quoted 4 lines
 sound/soc/codecs/wm5100.c                      |  5 +----
 sound/soc/codecs/wm8903.c                      |  6 +-----
 sound/soc/codecs/wm8962.c                      |  5 +----
 sound/soc/codecs/wm8996.c                      |  6 +-----

Liam || Mark can you ACK this?

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#33 lore raw

Re: [PATCH 3/3] driver:gpio remove all usage of gpio_remove retval in driver

Quoted 2 lines · Linus Walleij

Heads up. Requesting ACKs for this patch or I'm atleast warning that it will be applied. We're getting rid of the return value from gpiochip_remove().

Can someone send the patch please? Splitting it up per-subsystem would probably be easier...

#34 lore raw

Re: [PATCH 3/3] driver:gpio remove all usage of gpio_remove retval in driver

Quoted 7 lines · Mark Brown
Quoted 2 lines · Linus Walleij

Heads up. Requesting ACKs for this patch or I'm atleast warning that it will be applied. We're getting rid of the return value from gpiochip_remove().

Can someone send the patch please? Splitting it up per-subsystem would probably be easier...

OK Abdoulaye maybe we can do it a piece at a time?

I have removed the __must_check attribute from gpiochip_remove() in the gpiolib, so the compiler won't complain about this being missing anymore as of kernel v3.17. I also dropped the check in the GPIO and pin control subsystem, and other subsystems can start dropping the checks too if they are OK with the build warnings from the kautobuild until the __must_check removal has propagated upstream.

Yours,
Linus Walleij

maintainer Acked-by
#35 lore raw

Re: [PATCH 3/3] driver:gpio remove all usage of gpio_remove retval in driver

In reply to Linus Walleij
Quoted 3 lines · On Tue, 22 Jul 2014 17:08:13 +0200 Linus Walleij <[email protected]>…
Quoted 1 line
 drivers/ssb/driver_gpio.c                      |  3 ++-

Michael can you (A) ACK this and

Quoted 1 line

(B) think of moving this driver to drivers/gpio... Patches welcome.

This is not that easy, as it is not a driver on its own, but integral part of ssb. I don't think it's a good idea to move it out.

I'll accept well tested patches, though.

Signature · 1 line
Michael
#36 lore raw

Re: [PATCH 3/3] driver:gpio remove all usage of gpio_remove retval in driver

In reply to Linus Walleij
Quoted 18 lines · Linus Walleij

On Sat, Jul 12, 2014 at 10:30 PM, abdoulaye berthe <[email protected]> wrote:

Heads up. Requesting ACKs for this patch or I'm atleast warning that it will be applied. We're getting rid of the return value from gpiochip_remove().

Quoted 5 lines

this remove all reference to gpio_remove retval in all driver except pinctrl and gpio. the same thing is done for gpio and pinctrl in two different patches.

(...)

I think this patch probably needs to be broken down per-subsystem as it hits all over the map. But let's start requesting ACKs for the individual pieces.
Actually I think it will be OK to merge because there is likely not much churn around these code sites.

Quoted 3 lines

I'm a bit torn between just wanting a big patch for this hitting drivers/gpio and smaller patches hitting one subsystem at a time. We should be able to hammer this in one switch strike.

It would be better if you could devise a plan to make the switch a subsystem at a time.

[...]

Quoted 7 lines
Quoted 5 lines
 drivers/mfd/asic3.c                            |  3 ++-
 drivers/mfd/htc-i2cpld.c                       |  8 +-------
 drivers/mfd/sm501.c                            | 17 +++--------------
 drivers/mfd/tc6393xb.c                         | 13 ++++---------
 drivers/mfd/ucb1x00-core.c                     |  8 ++------

Lee/Sam can either of you ACK this?

I don't see any code?

Signature · 8 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
maintainer Acked-by
#37 lore raw

Re: [PATCH 3/3] driver:gpio remove all usage of gpio_remove retval in driver

In reply to Linus Walleij
Quoted 21 lines · Linus Walleij

On Sat, Jul 12, 2014 at 10:30 PM, abdoulaye berthe <[email protected]> wrote:

Heads up. Requesting ACKs for this patch or I'm atleast warning that it will be applied. We're getting rid of the return value from gpiochip_remove().

Quoted 5 lines

this remove all reference to gpio_remove retval in all driver except pinctrl and gpio. the same thing is done for gpio and pinctrl in two different patches.

(...)

I think this patch probably needs to be broken down per-subsystem as it hits all over the map. But let's start requesting ACKs for the individual pieces.
Actually I think it will be OK to merge because there is likely not much churn around these code sites.

I'm a bit torn between just wanting a big patch for this hitting drivers/gpio and smaller patches hitting one subsystem at a time. We should be able to hammer this in one switch strike.

...

Quoted 6 lines
Quoted 4 lines
 drivers/input/keyboard/adp5588-keys.c          |  4 +---
 drivers/input/keyboard/adp5589-keys.c          |  4 +---
 drivers/input/touchscreen/ad7879.c             | 10 +++-------

Dmitry can you ACK this?

Signature · 1 line
Dmitry
#38 lore raw

Re: [PATCH 3/3] driver:gpio remove all usage of gpio_remove retval in driver

In reply to Linus Walleij

Em Tue, 22 Jul 2014 17:08:13 +0200
Linus Walleij <[email protected]> escreveu:

Quoted 22 lines · abdoulaye berthe

Heads up. Requesting ACKs for this patch or I'm atleast warning that it will be applied. We're getting rid of the return value from gpiochip_remove().

Quoted 5 lines

this remove all reference to gpio_remove retval in all driver except pinctrl and gpio. the same thing is done for gpio and pinctrl in two different patches.

(...)

I think this patch probably needs to be broken down per-subsystem as it hits all over the map. But let's start requesting ACKs for the individual pieces.
Actually I think it will be OK to merge because there is likely not much churn around these code sites.

I'm a bit torn between just wanting a big patch for this hitting drivers/gpio and smaller patches hitting one subsystem at a time. We should be able to hammer this in one switch strike.

...

Quoted 3 lines
Quoted 1 line
 drivers/media/dvb-frontends/cxd2820r_core.c    | 10 +++-------

Mauro can you ACK this?

Quoted 2 lines

(Hm that looks weird. Mental note to look closer at this.)

What's weird there?

Regards,
Mauro

#39 lore raw

Re: [PATCH 3/3] driver:gpio remove all usage of gpio_remove retval in driver

In reply to Linus Walleij
Quoted 8 lines · Linus Walleij

On Sat, Jul 12, 2014 at 10:30 PM, abdoulaye berthe <[email protected]> wrote:

Heads up. Requesting ACKs for this patch or I'm atleast warning that it will be applied. We're getting rid of the return value from gpiochip_remove().

Quoted 1 line
 drivers/video/fbdev/via/via-gpio.c             | 10 +++-------

Tomi can you ACK this?

Tomi

#40 lore raw

PATCH 2/2 gpio: gpiolib: set gpiochip_remove retval to void

In reply to abdoulaye berthe

This avoids handling gpiochip remove error in device remove handler.

---
 drivers/gpio/gpiolib.c      | 24 +++++++-----------------
 include/linux/gpio/driver.h |  2 +-
 2 files changed, 8 insertions(+), 18 deletions(-)
drivers/gpio/gpiolib.c +7 -17
index f48817d..022543f 100644
@@ -1263,10 +1263,9 @@ static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip);
  *
  * A gpio_chip with any GPIOs still requested may not be removed.
  */
-int gpiochip_remove(struct gpio_chip *chip)
+void gpiochip_remove(struct gpio_chip *chip)
 {
 	unsigned long	flags;
-	int		status = 0;
 	unsigned	id;
 
 	acpi_gpiochip_remove(chip);
@@ -1278,24 +1277,15 @@ int gpiochip_remove(struct gpio_chip *chip)
 	of_gpiochip_remove(chip);
 
 	for (id = 0; id < chip->ngpio; id++) {
-		if (test_bit(FLAG_REQUESTED, &chip->desc[id].flags)) {
-			status = -EBUSY;
-			break;
-		}
-	}
-	if (status == 0) {
-		for (id = 0; id < chip->ngpio; id++)
-			chip->desc[id].chip = NULL;
-
-		list_del(&chip->list);
+		if (test_bit(FLAG_REQUESTED, &chip->desc[id].flags))
+			panic("gpio: removing gpiochip with gpios still requested\n");
 	}
+	for (id = 0; id < chip->ngpio; id++)
+		chip->desc[id].chip = NULL;
 
+	list_del(&chip->list);
 	spin_unlock_irqrestore(&gpio_lock, flags);
-
-	if (status == 0)
-		gpiochip_unexport(chip);
-
-	return status;
+	gpiochip_unexport(chip);
 }
 EXPORT_SYMBOL_GPL(gpiochip_remove);
 
include/linux/gpio/driver.h +1 -1
index 1827b43..ad5c4ef 100644
@@ -138,7 +138,7 @@ extern const char *gpiochip_is_requested(struct gpio_chip *chip,
 
 /* add/remove chips */
 extern int gpiochip_add(struct gpio_chip *chip);
-extern int __must_check gpiochip_remove(struct gpio_chip *chip);
+extern void gpiochip_remove(struct gpio_chip *chip);
 extern struct gpio_chip *gpiochip_find(void *data,
 			      int (*match)(struct gpio_chip *chip, void *data));
 
Signature · 1 line
1.9.1
#41 lore raw

Re: [PATCH 2/2] gpio: gpiolib: set gpiochip_remove retval to void

Quoted 31 lines · abdoulaye berthe

This avoids handling gpiochip remove error in device remove handler.

---
 drivers/gpio/gpiolib.c      | 24 +++++++-----------------
 include/linux/gpio/driver.h |  2 +-
 2 files changed, 8 insertions(+), 18 deletions(-)
drivers/gpio/gpiolib.c +1 -4
index f48817d..022543f 100644
@@ -1263,10 +1263,9 @@ static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip);
  *
  * A gpio_chip with any GPIOs still requested may not be removed.
  */
-int gpiochip_remove(struct gpio_chip *chip)
+void gpiochip_remove(struct gpio_chip *chip)
 {
        unsigned long   flags;
-       int             status = 0;
        unsigned        id;
 
        acpi_gpiochip_remove(chip);
@@ -1278,24 +1277,15 @@ int gpiochip_remove(struct gpio_chip *chip)
        of_gpiochip_remove(chip);
 
        for (id = 0; id < chip->ngpio; id++) {
-               if (test_bit(FLAG_REQUESTED, &chip->desc[id].flags)) {
-                       status = -EBUSY;

drivers/gpio/gpiolib.c int gpiochip_remove(struct gpio_chip *chip) · line 1281

Quoted 10 lines
drivers/gpio/gpiolib.c +2 -8
-                       break;
-               }
-       }
-       if (status == 0) {
-               for (id = 0; id < chip->ngpio; id++)
-                       chip->desc[id].chip = NULL;
-
-               list_del(&chip->list);
+               if (test_bit(FLAG_REQUESTED, &chip->desc[id].flags))
+                       panic("gpio: removing gpiochip with gpios still requested\n");

Really, really I don't think we should panic here. Apparently if you don't do this things are going to crash later on some platforms. Could you detail what the problem is exactly so we can try and come with a solution?

Event if we crash later with a more obscure reason, using pr_err() here to provide some information should be helpful enough.

Alex.

#42 lore raw

Re: [PATCH 2/2] gpio: gpiolib: set gpiochip_remove retval to void

How about using the interface tracker described in the link bellow ?
https://lkml.org/lkml/2014/5/5/55
Abdoulaye.

Quoted 52 lines · Alexandre Courbot
Quoted 31 lines · abdoulaye berthe

This avoids handling gpiochip remove error in device remove handler.

---
 drivers/gpio/gpiolib.c      | 24 +++++++-----------------
 include/linux/gpio/driver.h |  2 +-
 2 files changed, 8 insertions(+), 18 deletions(-)
drivers/gpio/gpiolib.c +1 -4
index f48817d..022543f 100644
@@ -1263,10 +1263,9 @@ static void gpiochip_irqchip_remove(struct gpio_chip *gpiochip);
  *
  * A gpio_chip with any GPIOs still requested may not be removed.
  */
-int gpiochip_remove(struct gpio_chip *chip)
+void gpiochip_remove(struct gpio_chip *chip)
 {
        unsigned long   flags;
-       int             status = 0;
        unsigned        id;
 
        acpi_gpiochip_remove(chip);
@@ -1278,24 +1277,15 @@ int gpiochip_remove(struct gpio_chip *chip)
        of_gpiochip_remove(chip);
 
        for (id = 0; id < chip->ngpio; id++) {
-               if (test_bit(FLAG_REQUESTED, &chip->desc[id].flags)) {
-                       status = -EBUSY;

drivers/gpio/gpiolib.c int gpiochip_remove(struct gpio_chip *chip) · line 1281

Quoted 10 lines
drivers/gpio/gpiolib.c +2 -8
-                       break;
-               }
-       }
-       if (status == 0) {
-               for (id = 0; id < chip->ngpio; id++)
-                       chip->desc[id].chip = NULL;
-
-               list_del(&chip->list);
+               if (test_bit(FLAG_REQUESTED, &chip->desc[id].flags))
+                       panic("gpio: removing gpiochip with gpios still requested\n");

Really, really I don't think we should panic here. Apparently if you don't do this things are going to crash later on some platforms. Could you detail what the problem is exactly so we can try and come with a solution?

Event if we crash later with a more obscure reason, using pr_err() here to provide some information should be helpful enough.

Alex.

#43 lore raw

Re: [PATCH 2/2] gpio: gpiolib: set gpiochip_remove retval to void

In reply to Alexandre Courbot
Quoted 5 lines · Alexandre Courbot
Quoted 3 lines · abdoulaye berthe

This avoids handling gpiochip remove error in device remove handler.

(...)

Quoted 6 lines

drivers/gpio/gpiolib.c int gpiochip_remove(struct gpio_chip *chip) · line 1281

Quoted 4 lines
drivers/gpio/gpiolib.c +2 -1
-               list_del(&chip->list);
+               if (test_bit(FLAG_REQUESTED, &chip->desc[id].flags))
+                       panic("gpio: removing gpiochip with gpios still requested\n");

Really, really I don't think we should panic here.

Nope dev_crit() is the right thing, with a big fat warning message.

Yours,
Linus Walleij

#44 lore raw

Re: [PATCH 0/2] gpiochip remove

In reply to abdoulaye berthe

I didn't modify the panic in the second patch as the initial goal of the patch was to avoid logging a message and continue as nothing happens however that happens to be a bad idea compared to a new proposal, I am ready to change it.

Quoted 114 lines · abdoulaye berthe

The aim of this patch is to make gpiochip_remove() behavior consistent, especially when issuing a remove request while the chipio chip is still requested. It is the 1st patch in a serie af 2 patches The 1st patch updates users of the return value while the 2nd patch changes the return value of gpiochip_remove from int to void.

abdoulaye berthe (2):
gpio: removes all usage of gpiochip_remove retval
gpio: gpiolib: set gpiochip_remove retval to void

 arch/arm/common/scoop.c                        | 10 ++--------
 arch/mips/txx9/generic/setup.c                 |  4 ++--
 arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c |  3 ++-
 arch/sh/boards/mach-x3proto/gpio.c             |  6 ++----
 drivers/bcma/driver_gpio.c                     |  3 ++-
 drivers/gpio/gpio-74x164.c                     |  8 +++-----
 drivers/gpio/gpio-adnp.c                       |  9 +--------
 drivers/gpio/gpio-adp5520.c                    |  8 +-------
 drivers/gpio/gpio-adp5588.c                    |  6 +-----
 drivers/gpio/gpio-amd8111.c                    |  3 +--
 drivers/gpio/gpio-arizona.c                    |  3 ++-
 drivers/gpio/gpio-cs5535.c                     |  8 +-------
 drivers/gpio/gpio-da9052.c                     |  3 ++-
 drivers/gpio/gpio-da9055.c                     |  3 ++-
 drivers/gpio/gpio-dwapb.c                      |  2 +-
 drivers/gpio/gpio-em.c                         |  5 +----
 drivers/gpio/gpio-f7188x.c                     | 18 ++----------------
 drivers/gpio/gpio-generic.c                    |  3 ++-
 drivers/gpio/gpio-grgpio.c                     |  4 +---
 drivers/gpio/gpio-ich.c                        |  9 +--------
 drivers/gpio/gpio-it8761e.c                    |  6 +-----
 drivers/gpio/gpio-janz-ttl.c                   |  8 +-------
 drivers/gpio/gpio-kempld.c                     |  3 ++-
 drivers/gpio/gpio-lp3943.c                     |  3 ++-
 drivers/gpio/gpio-lynxpoint.c                  |  5 +----
 drivers/gpio/gpio-max730x.c                    | 12 ++++--------
 drivers/gpio/gpio-max732x.c                    |  7 +------
 drivers/gpio/gpio-mc33880.c                    | 11 +++--------
 drivers/gpio/gpio-mc9s08dz60.c                 |  3 ++-
 drivers/gpio/gpio-mcp23s08.c                   | 26 +++++++-------------------
 drivers/gpio/gpio-ml-ioh.c                     |  8 ++------
 drivers/gpio/gpio-msm-v2.c                     |  5 +----
 drivers/gpio/gpio-mxc.c                        |  2 +-
 drivers/gpio/gpio-octeon.c                     |  3 ++-
 drivers/gpio/gpio-palmas.c                     |  3 ++-
 drivers/gpio/gpio-pca953x.c                    |  7 +------
 drivers/gpio/gpio-pcf857x.c                    |  4 +---
 drivers/gpio/gpio-pch.c                        | 10 ++--------
 drivers/gpio/gpio-rc5t583.c                    |  3 ++-
 drivers/gpio/gpio-rcar.c                       |  5 +----
 drivers/gpio/gpio-rdc321x.c                    |  7 ++-----
 drivers/gpio/gpio-sch.c                        | 16 +++-------------
 drivers/gpio/gpio-sch311x.c                    |  6 ++----
 drivers/gpio/gpio-sodaville.c                  |  4 +---
 drivers/gpio/gpio-stmpe.c                      |  8 +-------
 drivers/gpio/gpio-sx150x.c                     |  7 ++-----
 drivers/gpio/gpio-syscon.c                     |  3 ++-
 drivers/gpio/gpio-tb10x.c                      |  5 +----
 drivers/gpio/gpio-tc3589x.c                    |  8 +-------
 drivers/gpio/gpio-timberdale.c                 |  5 +----
 drivers/gpio/gpio-tps6586x.c                   |  3 ++-
 drivers/gpio/gpio-tps65910.c                   |  3 ++-
 drivers/gpio/gpio-tps65912.c                   |  3 ++-
 drivers/gpio/gpio-ts5500.c                     |  6 +++---
 drivers/gpio/gpio-twl4030.c                    |  4 +---
 drivers/gpio/gpio-twl6040.c                    |  3 ++-
 drivers/gpio/gpio-ucb1400.c                    |  2 +-
 drivers/gpio/gpio-viperboard.c                 | 10 +++-------
 drivers/gpio/gpio-vx855.c                      |  3 +--
 drivers/gpio/gpio-wm831x.c                     |  3 ++-
 drivers/gpio/gpio-wm8350.c                     |  3 ++-
 drivers/gpio/gpio-wm8994.c                     |  3 ++-
 drivers/gpio/gpiolib.c                         | 24 +++++++-----------------
 drivers/hid/hid-cp2112.c                       |  6 ++----
 drivers/input/keyboard/adp5588-keys.c          |  4 +---
 drivers/input/keyboard/adp5589-keys.c          |  4 +---
 drivers/input/touchscreen/ad7879.c             | 10 +++-------
 drivers/leds/leds-pca9532.c                    | 10 ++--------
 drivers/leds/leds-tca6507.c                    |  7 ++-----
 drivers/media/dvb-frontends/cxd2820r_core.c    | 10 +++-------
 drivers/mfd/asic3.c                            |  3 ++-
 drivers/mfd/htc-i2cpld.c                       |  8 +-------
 drivers/mfd/sm501.c                            | 17 +++--------------
 drivers/mfd/tc6393xb.c                         | 13 ++++---------
 drivers/mfd/ucb1x00-core.c                     |  8 ++------
 drivers/pinctrl/pinctrl-abx500.c               | 15 +++------------
 drivers/pinctrl/pinctrl-adi2.c                 |  9 ++++-----
 drivers/pinctrl/pinctrl-as3722.c               | 11 ++---------
 drivers/pinctrl/pinctrl-baytrail.c             |  5 +----
 drivers/pinctrl/pinctrl-coh901.c               | 10 ++--------
 drivers/pinctrl/pinctrl-exynos5440.c           |  6 +-----
 drivers/pinctrl/pinctrl-msm.c                  | 11 ++---------
 drivers/pinctrl/pinctrl-nomadik.c              |  2 +-
 drivers/pinctrl/pinctrl-rockchip.c             | 16 ++++------------
 drivers/pinctrl/pinctrl-samsung.c              | 14 ++++----------
 drivers/pinctrl/pinctrl-sunxi.c                |  3 +--
 drivers/pinctrl/sh-pfc/gpio.c                  |  9 +++------
 drivers/pinctrl/spear/pinctrl-plgpio.c         |  3 +--
 drivers/pinctrl/vt8500/pinctrl-wmt.c           |  9 ++-------
 drivers/platform/x86/intel_pmic_gpio.c         |  3 +--
 drivers/ssb/driver_gpio.c                      |  3 ++-
 drivers/staging/vme/devices/vme_pio2_gpio.c    |  4 +---
 drivers/tty/serial/max310x.c                   | 10 ++++------
 drivers/video/fbdev/via/via-gpio.c             | 10 +++-------
 include/linux/gpio/driver.h                    |  2 +-
 sound/soc/codecs/wm5100.c                      |  5 +----
 sound/soc/codecs/wm8903.c                      |  6 +-----
 sound/soc/codecs/wm8962.c                      |  5 +----
 sound/soc/codecs/wm8996.c                      |  6 +-----
 99 files changed, 190 insertions(+), 478 deletions(-)

--
1.9.1