Commit e75dfba3 authored by Linus Walleij's avatar Linus Walleij

Merge tag 'gpio-fixes-for-v5.7-rc6' of...

Merge tag 'gpio-fixes-for-v5.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux into fixes

gpio fixes for v5.7-rc6

- fix probing for chips without PWM in gpio-mvebu
- fix ida_simple_get() error path in gpio-exar
- fix user-space notifications for line state changes
parents b9bbe6ed 9fefca77
...@@ -148,8 +148,10 @@ static int gpio_exar_probe(struct platform_device *pdev) ...@@ -148,8 +148,10 @@ static int gpio_exar_probe(struct platform_device *pdev)
mutex_init(&exar_gpio->lock); mutex_init(&exar_gpio->lock);
index = ida_simple_get(&ida_index, 0, 0, GFP_KERNEL); index = ida_simple_get(&ida_index, 0, 0, GFP_KERNEL);
if (index < 0) if (index < 0) {
goto err_destroy; ret = index;
goto err_mutex_destroy;
}
sprintf(exar_gpio->name, "exar_gpio%d", index); sprintf(exar_gpio->name, "exar_gpio%d", index);
exar_gpio->gpio_chip.label = exar_gpio->name; exar_gpio->gpio_chip.label = exar_gpio->name;
...@@ -176,6 +178,7 @@ static int gpio_exar_probe(struct platform_device *pdev) ...@@ -176,6 +178,7 @@ static int gpio_exar_probe(struct platform_device *pdev)
err_destroy: err_destroy:
ida_simple_remove(&ida_index, index); ida_simple_remove(&ida_index, index);
err_mutex_destroy:
mutex_destroy(&exar_gpio->lock); mutex_destroy(&exar_gpio->lock);
return ret; return ret;
} }
......
...@@ -782,6 +782,15 @@ static int mvebu_pwm_probe(struct platform_device *pdev, ...@@ -782,6 +782,15 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
"marvell,armada-370-gpio")) "marvell,armada-370-gpio"))
return 0; 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)) if (IS_ERR(mvchip->clk))
return PTR_ERR(mvchip->clk); return PTR_ERR(mvchip->clk);
...@@ -804,12 +813,6 @@ static int mvebu_pwm_probe(struct platform_device *pdev, ...@@ -804,12 +813,6 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
mvchip->mvpwm = mvpwm; mvchip->mvpwm = mvpwm;
mvpwm->mvchip = mvchip; 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"); mvpwm->membase = devm_platform_ioremap_resource_byname(pdev, "pwm");
if (IS_ERR(mvpwm->membase)) if (IS_ERR(mvpwm->membase))
return PTR_ERR(mvpwm->membase); return PTR_ERR(mvpwm->membase);
......
...@@ -729,6 +729,10 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip) ...@@ -729,6 +729,10 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip)
if (ret) if (ret)
goto out_free_descs; 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", dev_dbg(&gdev->dev, "registered chardev handle for line %d\n",
offset); offset);
} }
...@@ -1083,6 +1087,9 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip) ...@@ -1083,6 +1087,9 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip)
if (ret) if (ret)
goto out_free_desc; goto out_free_desc;
atomic_notifier_call_chain(&desc->gdev->notifier,
GPIOLINE_CHANGED_REQUESTED, desc);
le->irq = gpiod_to_irq(desc); le->irq = gpiod_to_irq(desc);
if (le->irq <= 0) { if (le->irq <= 0) {
ret = -ENODEV; ret = -ENODEV;
...@@ -2998,8 +3005,6 @@ static int gpiod_request_commit(struct gpio_desc *desc, const char *label) ...@@ -2998,8 +3005,6 @@ static int gpiod_request_commit(struct gpio_desc *desc, const char *label)
} }
done: done:
spin_unlock_irqrestore(&gpio_lock, flags); spin_unlock_irqrestore(&gpio_lock, flags);
atomic_notifier_call_chain(&desc->gdev->notifier,
GPIOLINE_CHANGED_REQUESTED, desc);
return ret; return ret;
} }
...@@ -4961,6 +4966,9 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev, ...@@ -4961,6 +4966,9 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
return ERR_PTR(ret); return ERR_PTR(ret);
} }
atomic_notifier_call_chain(&desc->gdev->notifier,
GPIOLINE_CHANGED_REQUESTED, desc);
return desc; return desc;
} }
EXPORT_SYMBOL_GPL(gpiod_get_index); EXPORT_SYMBOL_GPL(gpiod_get_index);
...@@ -5026,6 +5034,9 @@ struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode, ...@@ -5026,6 +5034,9 @@ struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode,
return ERR_PTR(ret); return ERR_PTR(ret);
} }
atomic_notifier_call_chain(&desc->gdev->notifier,
GPIOLINE_CHANGED_REQUESTED, desc);
return desc; return desc;
} }
EXPORT_SYMBOL_GPL(fwnode_get_named_gpiod); EXPORT_SYMBOL_GPL(fwnode_get_named_gpiod);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment