linux-next: manual merge of the gpio-brgl tree with the arm-soc tree

From: Stephen Rothwell
Date: Tue May 30 2023 - 00:19:32 EST


Hi all,

Today's linux-next merge of the gpio-brgl tree got a conflict in:

drivers/gpio/gpio-twl4030.c

between commit:

d5f4fa60d63a ("ARM/gpio: Push OMAP2 quirk down into TWL4030 driver")

from the arm-soc tree and commit:

fbc8ab2ccd85 ("gpio: twl4030: Use devm_gpiochip_add_data() to simplify remove path")

from the gpio-brgl tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging. You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

--
Cheers,
Stephen Rothwell

diff --cc drivers/gpio/gpio-twl4030.c
index 446599ac234a,3708ed2314e8..000000000000
--- a/drivers/gpio/gpio-twl4030.c
+++ b/drivers/gpio/gpio-twl4030.c
@@@ -490,30 -492,9 +490,18 @@@ static struct twl4030_gpio_platform_dat
return omap_twl_info;
}

- /* Cannot use as gpio_twl4030_probe() calls us */
- static int gpio_twl4030_remove(struct platform_device *pdev)
- {
- struct gpio_twl4030_priv *priv = platform_get_drvdata(pdev);
-
- gpiochip_remove(&priv->gpio_chip);
-
- /* REVISIT no support yet for deregistering all the IRQs */
- WARN_ON(!is_module());
- return 0;
- }
-
+/* Called from the registered devm action */
+static void gpio_twl4030_power_off_action(void *data)
+{
+ struct gpio_desc *d = data;
+
+ gpiod_unexport(d);
+ gpiochip_free_own_desc(d);
+}
+
static int gpio_twl4030_probe(struct platform_device *pdev)
{
- struct twl4030_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev);
+ struct twl4030_gpio_platform_data *pdata;
struct device_node *node = pdev->dev.of_node;
struct gpio_twl4030_priv *priv;
int ret, irq_base;
@@@ -586,38 -569,19 +574,35 @@@ no_irqs
if (ret < 0) {
dev_err(&pdev->dev, "could not register gpiochip, %d\n", ret);
priv->gpio_chip.ngpio = 0;
- gpio_twl4030_remove(pdev);
- goto out;
+ return ret;
}

- if (pdata->setup) {
- int status;
+ /*
+ * Special quirk for the OMAP3 to hog and export a WLAN power
+ * GPIO.
+ */
+ if (IS_ENABLED(CONFIG_ARCH_OMAP3) &&
+ of_machine_is_compatible("compulab,omap3-sbc-t3730")) {
+ struct gpio_desc *d;
+
+ d = gpiochip_request_own_desc(&priv->gpio_chip,
+ 2, "wlan pwr",
+ GPIO_ACTIVE_HIGH,
+ GPIOD_OUT_HIGH);
+ if (IS_ERR(d))
+ return dev_err_probe(&pdev->dev, PTR_ERR(d),
+ "unable to hog wlan pwr GPIO\n");
+
+ gpiod_export(d, 0);
+
+ ret = devm_add_action_or_reset(&pdev->dev, gpio_twl4030_power_off_action, d);
+ if (ret)
+ return dev_err_probe(&pdev->dev, ret,
+ "failed to install power off handler\n");

- status = pdata->setup(&pdev->dev, priv->gpio_chip.base,
- TWL4030_GPIO_MAX);
- if (status)
- dev_dbg(&pdev->dev, "setup --> %d\n", status);
}

- platform_set_drvdata(pdev, priv);
- out:
- return ret;
+ return 0;
}

static const struct of_device_id twl_gpio_match[] = {

Attachment: pgpJtFKswrMph.pgp
Description: OpenPGP digital signature