GPIO fixes for the v5.7 series:
- Fix proving of mvebu chips without PWM - Fix errorpath on ida_get_simple() on the exar driver - Notify userspace properly about line status changes when flags are changed on lines. - Fix a sleeping while holding spinlock in the mellanox driver. - Fix return value of the PXA and Kona probe calls. - Fix IRQ locking of open drain lines, it is fine to have IRQs on open drain lines flagged for output. -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEElDRnuGcz/wPCXQWMQRCzN7AZXXMFAl7SPXIACgkQQRCzN7AZ XXNnZA//SEFQgIuzRXOVImqgPEa9Rb3v592UtHTWeDXkdm3pUbmW3FEDmL8f5oaB naBCoCpcUSq8TTi3Ja60jeHt6clbBHUGYc//CgQWDaf5AjShUWLdcUOi6N3rmcZv 5h7csbHvuVBWVgPWhop6yOmhfYoTMbOnyOWGJDHn8f1oOmZnlfGJsCansHraZWBZ ExQtmTiHlz89r8HIMvnRU1TloqTENqOca123WvBvJ1rdPaN7yKQkQaHl0p/hQWZb sm3KgTI3PjBU8Ys5nitAUG0Dn85TPzHTnnOURmWRL4yQAg2pCwLUcDvMKeGHlUz8 ygLes55qdOKyiR1wsb2OlbL+LrDOOuU2v13Q6j7aNszDWYq3mxRDRaMqPIfSRFG9 JeYMqVdvkpk6cZsOQtvltjZlO8kD66OfffHrZfR1Amt7qqna+MoB09IXZ50X15d5 Cg6Ek8A/WKMPYILVgWzgkmm0o+lbtNpmB0TIEEFLwMwatllQNN2wW6/4OzT1wFau kWY/TdlM29dgH/+Iqv6m1tJj8ONsMyTiY4Iogi6Irm8L8IVcYFaSAPVNJRZZOhso wt2Lvh3MYEtzWPQdSTA7HuFmYohaCR6DbDjAodhLbnZdhrOeiJPljTvx1FnkiU46 G+bXSmzxkhzFgZnsRydnnutjugdlVYoU3ar/Sdh0WqyiAjc5D1g= =NXVY -----END PGP SIGNATURE----- Merge tag 'gpio-v5.7-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio Pull GPIO fixes from Linus Walleij: "Here are some (very) late fixes for GPIO, none of them very serious except the one tagged for stable for enabling IRQ on open drain lines: - Fix probing of mvebu chips without PWM - Fix error path on ida_get_simple() on the exar driver - Notify userspace properly about line status changes when flags are changed on lines. - Fix a sleeping while holding spinlock in the mellanox driver. - Fix return value of the PXA and Kona probe calls. - Fix IRQ locking of open drain lines, it is fine to have IRQs on open drain lines flagged for output" * tag 'gpio-v5.7-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: gpio: fix locking open drain IRQ lines gpio: bcm-kona: Fix return value of bcm_kona_gpio_probe() gpio: pxa: Fix return value of pxa_gpio_probe() gpio: mlxbf2: Fix sleeping while holding spinlock gpiolib: notify user-space about line status changes after flags are set gpio: exar: Fix bad handling for ida_simple_get error path gpio: mvebu: Fix probing for chips without PWM
This commit is contained in:
commit
900db15047
@ -625,7 +625,7 @@ static int bcm_kona_gpio_probe(struct platform_device *pdev)
|
||||
|
||||
kona_gpio->reg_base = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(kona_gpio->reg_base)) {
|
||||
ret = -ENXIO;
|
||||
ret = PTR_ERR(kona_gpio->reg_base);
|
||||
goto err_irq_domain;
|
||||
}
|
||||
|
||||
|
@ -148,8 +148,10 @@ static int gpio_exar_probe(struct platform_device *pdev)
|
||||
mutex_init(&exar_gpio->lock);
|
||||
|
||||
index = ida_simple_get(&ida_index, 0, 0, GFP_KERNEL);
|
||||
if (index < 0)
|
||||
goto err_destroy;
|
||||
if (index < 0) {
|
||||
ret = index;
|
||||
goto err_mutex_destroy;
|
||||
}
|
||||
|
||||
sprintf(exar_gpio->name, "exar_gpio%d", index);
|
||||
exar_gpio->gpio_chip.label = exar_gpio->name;
|
||||
@ -176,6 +178,7 @@ static int gpio_exar_probe(struct platform_device *pdev)
|
||||
|
||||
err_destroy:
|
||||
ida_simple_remove(&ida_index, index);
|
||||
err_mutex_destroy:
|
||||
mutex_destroy(&exar_gpio->lock);
|
||||
return ret;
|
||||
}
|
||||
|
@ -127,8 +127,8 @@ static int mlxbf2_gpio_lock_acquire(struct mlxbf2_gpio_context *gs)
|
||||
{
|
||||
u32 arm_gpio_lock_val;
|
||||
|
||||
spin_lock(&gs->gc.bgpio_lock);
|
||||
mutex_lock(yu_arm_gpio_lock_param.lock);
|
||||
spin_lock(&gs->gc.bgpio_lock);
|
||||
|
||||
arm_gpio_lock_val = readl(yu_arm_gpio_lock_param.io);
|
||||
|
||||
@ -136,8 +136,8 @@ static int mlxbf2_gpio_lock_acquire(struct mlxbf2_gpio_context *gs)
|
||||
* When lock active bit[31] is set, ModeX is write enabled
|
||||
*/
|
||||
if (YU_LOCK_ACTIVE_BIT(arm_gpio_lock_val)) {
|
||||
mutex_unlock(yu_arm_gpio_lock_param.lock);
|
||||
spin_unlock(&gs->gc.bgpio_lock);
|
||||
mutex_unlock(yu_arm_gpio_lock_param.lock);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@ -152,8 +152,8 @@ static int mlxbf2_gpio_lock_acquire(struct mlxbf2_gpio_context *gs)
|
||||
static void mlxbf2_gpio_lock_release(struct mlxbf2_gpio_context *gs)
|
||||
{
|
||||
writel(YU_ARM_GPIO_LOCK_RELEASE, yu_arm_gpio_lock_param.io);
|
||||
mutex_unlock(yu_arm_gpio_lock_param.lock);
|
||||
spin_unlock(&gs->gc.bgpio_lock);
|
||||
mutex_unlock(yu_arm_gpio_lock_param.lock);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -782,6 +782,15 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
|
||||
"marvell,armada-370-gpio"))
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* There are only two sets of PWM configuration registers for
|
||||
* all the GPIO lines on those SoCs which this driver reserves
|
||||
* for the first two GPIO chips. So if the resource is missing
|
||||
* we can't treat it as an error.
|
||||
*/
|
||||
if (!platform_get_resource_byname(pdev, IORESOURCE_MEM, "pwm"))
|
||||
return 0;
|
||||
|
||||
if (IS_ERR(mvchip->clk))
|
||||
return PTR_ERR(mvchip->clk);
|
||||
|
||||
@ -804,12 +813,6 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
|
||||
mvchip->mvpwm = mvpwm;
|
||||
mvpwm->mvchip = mvchip;
|
||||
|
||||
/*
|
||||
* There are only two sets of PWM configuration registers for
|
||||
* all the GPIO lines on those SoCs which this driver reserves
|
||||
* for the first two GPIO chips. So if the resource is missing
|
||||
* we can't treat it as an error.
|
||||
*/
|
||||
mvpwm->membase = devm_platform_ioremap_resource_byname(pdev, "pwm");
|
||||
if (IS_ERR(mvpwm->membase))
|
||||
return PTR_ERR(mvpwm->membase);
|
||||
|
@ -660,8 +660,8 @@ static int pxa_gpio_probe(struct platform_device *pdev)
|
||||
pchip->irq1 = irq1;
|
||||
|
||||
gpio_reg_base = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (!gpio_reg_base)
|
||||
return -EINVAL;
|
||||
if (IS_ERR(gpio_reg_base))
|
||||
return PTR_ERR(gpio_reg_base);
|
||||
|
||||
clk = clk_get(&pdev->dev, NULL);
|
||||
if (IS_ERR(clk)) {
|
||||
|
@ -729,6 +729,10 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip)
|
||||
if (ret)
|
||||
goto out_free_descs;
|
||||
}
|
||||
|
||||
atomic_notifier_call_chain(&desc->gdev->notifier,
|
||||
GPIOLINE_CHANGED_REQUESTED, desc);
|
||||
|
||||
dev_dbg(&gdev->dev, "registered chardev handle for line %d\n",
|
||||
offset);
|
||||
}
|
||||
@ -1083,6 +1087,9 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip)
|
||||
if (ret)
|
||||
goto out_free_desc;
|
||||
|
||||
atomic_notifier_call_chain(&desc->gdev->notifier,
|
||||
GPIOLINE_CHANGED_REQUESTED, desc);
|
||||
|
||||
le->irq = gpiod_to_irq(desc);
|
||||
if (le->irq <= 0) {
|
||||
ret = -ENODEV;
|
||||
@ -2998,8 +3005,6 @@ static int gpiod_request_commit(struct gpio_desc *desc, const char *label)
|
||||
}
|
||||
done:
|
||||
spin_unlock_irqrestore(&gpio_lock, flags);
|
||||
atomic_notifier_call_chain(&desc->gdev->notifier,
|
||||
GPIOLINE_CHANGED_REQUESTED, desc);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -4215,7 +4220,9 @@ int gpiochip_lock_as_irq(struct gpio_chip *gc, unsigned int offset)
|
||||
}
|
||||
}
|
||||
|
||||
if (test_bit(FLAG_IS_OUT, &desc->flags)) {
|
||||
/* To be valid for IRQ the line needs to be input or open drain */
|
||||
if (test_bit(FLAG_IS_OUT, &desc->flags) &&
|
||||
!test_bit(FLAG_OPEN_DRAIN, &desc->flags)) {
|
||||
chip_err(gc,
|
||||
"%s: tried to flag a GPIO set as output for IRQ\n",
|
||||
__func__);
|
||||
@ -4278,7 +4285,12 @@ void gpiochip_enable_irq(struct gpio_chip *gc, unsigned int offset)
|
||||
|
||||
if (!IS_ERR(desc) &&
|
||||
!WARN_ON(!test_bit(FLAG_USED_AS_IRQ, &desc->flags))) {
|
||||
WARN_ON(test_bit(FLAG_IS_OUT, &desc->flags));
|
||||
/*
|
||||
* We must not be output when using IRQ UNLESS we are
|
||||
* open drain.
|
||||
*/
|
||||
WARN_ON(test_bit(FLAG_IS_OUT, &desc->flags) &&
|
||||
!test_bit(FLAG_OPEN_DRAIN, &desc->flags));
|
||||
set_bit(FLAG_IRQ_IS_ENABLED, &desc->flags);
|
||||
}
|
||||
}
|
||||
@ -4961,6 +4973,9 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
|
||||
atomic_notifier_call_chain(&desc->gdev->notifier,
|
||||
GPIOLINE_CHANGED_REQUESTED, desc);
|
||||
|
||||
return desc;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(gpiod_get_index);
|
||||
@ -5026,6 +5041,9 @@ struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode,
|
||||
return ERR_PTR(ret);
|
||||
}
|
||||
|
||||
atomic_notifier_call_chain(&desc->gdev->notifier,
|
||||
GPIOLINE_CHANGED_REQUESTED, desc);
|
||||
|
||||
return desc;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(fwnode_get_named_gpiod);
|
||||
|
Loading…
Reference in New Issue
Block a user