gpio fixes for v6.5-rc3

- fix initial value handling for output-only pins in gpio-tps68470
 - fix two resource leaks in gpio-mvebu
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAmS6xSUACgkQEacuoBRx
 13J8hhAApOQxsIgJ7BiE/S6i07XYvmxjDJYTMIzIdoIFmUAAz2F9Km8lRHZraEcX
 ReAmIDGgDr0QP9AXY8gj+IfZ1DeEu01KUsJ7brA0MUEtlMTl0YWByVhcQqU8kVdL
 xc557t4JX9PZGkJTu69X0W7ouspwOgTqhzQ9fgZsRb3hVpC79wl5Rn6aMGKcvHl2
 77MhDeXZkJM2mWMHALcLf+xEAHZIySt5MTdemS2HXs939BTki1/+nbNY51Q6iRD/
 zd57fny9I1c4P4+FVDVsieDt1vaE3/r7CCCO5APlspm7+VlHZESgIq+XfuvVrOBQ
 cVTcCBo60Na20y+PskWG6Epbva/NLJ6C1ahFN39tCAUoIj6BreWUD0ztPQqutFMf
 6Cecr4cuZ+8kUvNkc8V2QuYj5YTxdXrUWeLIbNTBvEZ44NCRUXRmAYadCSziGyCM
 3rEOTi9dg8q3wVB/aeRc5Q4DkHKbsJU1c2XKvZeMYNyaDur/PeynPJwifBC73Bpk
 pYTaoUu2C6jr9vc6VsL1IPb27/tNT19IWjktr24RUQDQC2Z5hxPeVA07EW3pKRwQ
 iGRfFoUN/8HTO7kQq77bFMxBwmtT9h+QQPGvFSw5y8cwqBY76cry3mxoVfwmzUpm
 ysWsJvRyKBBvjA7/eZmhwUfBfghvgqN7jSc+Yf+dXxXM93YQHNo=
 =a9OZ
 -----END PGP SIGNATURE-----

Merge tag 'gpio-fixes-for-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux

Pull gpio fixes from Bartosz Golaszewski:

 - fix initial value handling for output-only pins in gpio-tps68470

 - fix two resource leaks in gpio-mvebu

* tag 'gpio-fixes-for-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
  gpio: mvebu: fix irq domain leak
  gpio: mvebu: Make use of devm_pwmchip_add
  gpio: tps68470: Make tps68470_gpio_output() always set the initial value
This commit is contained in:
Linus Torvalds 2023-07-22 10:14:04 -07:00
commit c0842db5e5
2 changed files with 18 additions and 14 deletions

View file

@ -874,7 +874,7 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
spin_lock_init(&mvpwm->lock);
return pwmchip_add(&mvpwm->chip);
return devm_pwmchip_add(dev, &mvpwm->chip);
}
#ifdef CONFIG_DEBUG_FS
@ -1112,6 +1112,13 @@ static int mvebu_gpio_probe_syscon(struct platform_device *pdev,
return 0;
}
static void mvebu_gpio_remove_irq_domain(void *data)
{
struct irq_domain *domain = data;
irq_domain_remove(domain);
}
static int mvebu_gpio_probe(struct platform_device *pdev)
{
struct mvebu_gpio_chip *mvchip;
@ -1243,17 +1250,21 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
if (!mvchip->domain) {
dev_err(&pdev->dev, "couldn't allocate irq domain %s (DT).\n",
mvchip->chip.label);
err = -ENODEV;
goto err_pwm;
return -ENODEV;
}
err = devm_add_action_or_reset(&pdev->dev, mvebu_gpio_remove_irq_domain,
mvchip->domain);
if (err)
return err;
err = irq_alloc_domain_generic_chips(
mvchip->domain, ngpios, 2, np->name, handle_level_irq,
IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_LEVEL, 0, 0);
if (err) {
dev_err(&pdev->dev, "couldn't allocate irq chips %s (DT).\n",
mvchip->chip.label);
goto err_domain;
return err;
}
/*
@ -1293,13 +1304,6 @@ static int mvebu_gpio_probe(struct platform_device *pdev)
}
return 0;
err_domain:
irq_domain_remove(mvchip->domain);
err_pwm:
pwmchip_remove(&mvchip->mvpwm->chip);
return err;
}
static struct platform_driver mvebu_gpio_driver = {

View file

@ -91,13 +91,13 @@ static int tps68470_gpio_output(struct gpio_chip *gc, unsigned int offset,
struct tps68470_gpio_data *tps68470_gpio = gpiochip_get_data(gc);
struct regmap *regmap = tps68470_gpio->tps68470_regmap;
/* Set the initial value */
tps68470_gpio_set(gc, offset, value);
/* rest are always outputs */
if (offset >= TPS68470_N_REGULAR_GPIO)
return 0;
/* Set the initial value */
tps68470_gpio_set(gc, offset, value);
return regmap_update_bits(regmap, TPS68470_GPIO_CTL_REG_A(offset),
TPS68470_GPIO_MODE_MASK,
TPS68470_GPIO_MODE_OUT_CMOS);