* [PATCH v2 0/8] gpio: use devres for irq generic chip
@ 2017-08-09 12:24 Bartosz Golaszewski
2017-08-09 12:25 ` [PATCH v2 1/8] gpio: mxc: disallow unbinding the driver Bartosz Golaszewski
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: Bartosz Golaszewski @ 2017-08-09 12:24 UTC (permalink / raw)
To: Linus Walleij; +Cc: linux-gpio, linux-kernel, Bartosz Golaszewski
We now provide resource managed versions of irq_alloc_generic_chip()
and irq_setup_generic_chip(). Use them in all relevant gpio drivers.
v1 -> v2:
- added three patches which explicitly disable driver unbinding for
non-modular drivers, only updated those built-in modules which already
use devres in their probe() functions
- left out the sodaville patch since it explictly says it doesn't free
any resources
Bartosz Golaszewski (8):
gpio: mxc: disallow unbinding the driver
gpio: mxs: disallow unbinding the driver
gpio: sta2x11: disallow unbinding the driver
gpio: sta2x11: use devres for irq generic chip
gpio: ml-ioh: use devres for irq generic chip
gpio: pch: use devres for irq generic chip
gpio: mxc: use devres for irq generic chip
gpio: mxs: use devres for irq generic chip
drivers/gpio/gpio-ml-ioh.c | 12 +++++++-----
drivers/gpio/gpio-mxc.c | 16 +++++++++++-----
drivers/gpio/gpio-mxs.c | 15 ++++++++++-----
drivers/gpio/gpio-pch.c | 12 +++++++-----
drivers/gpio/gpio-sta2x11.c | 14 ++++++++++----
5 files changed, 45 insertions(+), 24 deletions(-)
--
2.13.2
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 1/8] gpio: mxc: disallow unbinding the driver
2017-08-09 12:24 [PATCH v2 0/8] gpio: use devres for irq generic chip Bartosz Golaszewski
@ 2017-08-09 12:25 ` Bartosz Golaszewski
2017-08-09 12:25 ` [PATCH v2 2/8] gpio: mxs: " Bartosz Golaszewski
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Bartosz Golaszewski @ 2017-08-09 12:25 UTC (permalink / raw)
To: Linus Walleij; +Cc: linux-gpio, linux-kernel, Bartosz Golaszewski
This driver is non-modular so explicitly disallow a driver unbind.
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
---
drivers/gpio/gpio-mxc.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index 92692251ade1..a4d4a3527a24 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -507,6 +507,7 @@ static struct platform_driver mxc_gpio_driver = {
.driver = {
.name = "gpio-mxc",
.of_match_table = mxc_gpio_dt_ids,
+ .suppress_bind_attrs = true,
},
.probe = mxc_gpio_probe,
.id_table = mxc_gpio_devtype,
--
2.13.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 2/8] gpio: mxs: disallow unbinding the driver
2017-08-09 12:24 [PATCH v2 0/8] gpio: use devres for irq generic chip Bartosz Golaszewski
2017-08-09 12:25 ` [PATCH v2 1/8] gpio: mxc: disallow unbinding the driver Bartosz Golaszewski
@ 2017-08-09 12:25 ` Bartosz Golaszewski
2017-08-09 12:25 ` [PATCH v2 3/8] gpio: sta2x11: " Bartosz Golaszewski
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Bartosz Golaszewski @ 2017-08-09 12:25 UTC (permalink / raw)
To: Linus Walleij; +Cc: linux-gpio, linux-kernel, Bartosz Golaszewski
This driver is non-modular so explicitly disallow a driver unbind.
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
---
drivers/gpio/gpio-mxs.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpio/gpio-mxs.c b/drivers/gpio/gpio-mxs.c
index 6ae583f36733..159927876577 100644
--- a/drivers/gpio/gpio-mxs.c
+++ b/drivers/gpio/gpio-mxs.c
@@ -379,6 +379,7 @@ static struct platform_driver mxs_gpio_driver = {
.driver = {
.name = "gpio-mxs",
.of_match_table = mxs_gpio_dt_ids,
+ .suppress_bind_attrs = true,
},
.probe = mxs_gpio_probe,
.id_table = mxs_gpio_ids,
--
2.13.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 3/8] gpio: sta2x11: disallow unbinding the driver
2017-08-09 12:24 [PATCH v2 0/8] gpio: use devres for irq generic chip Bartosz Golaszewski
2017-08-09 12:25 ` [PATCH v2 1/8] gpio: mxc: disallow unbinding the driver Bartosz Golaszewski
2017-08-09 12:25 ` [PATCH v2 2/8] gpio: mxs: " Bartosz Golaszewski
@ 2017-08-09 12:25 ` Bartosz Golaszewski
2017-08-09 12:25 ` [PATCH v2 4/8] gpio: sta2x11: use devres for irq generic chip Bartosz Golaszewski
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Bartosz Golaszewski @ 2017-08-09 12:25 UTC (permalink / raw)
To: Linus Walleij; +Cc: linux-gpio, linux-kernel, Bartosz Golaszewski
This driver is non-modular so explicitly disallow a driver unbind.
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
---
drivers/gpio/gpio-sta2x11.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpio/gpio-sta2x11.c b/drivers/gpio/gpio-sta2x11.c
index 9e705162da8d..56beb31c03db 100644
--- a/drivers/gpio/gpio-sta2x11.c
+++ b/drivers/gpio/gpio-sta2x11.c
@@ -432,6 +432,7 @@ static int gsta_probe(struct platform_device *dev)
static struct platform_driver sta2x11_gpio_platform_driver = {
.driver = {
.name = "sta2x11-gpio",
+ .suppress_bind_attrs = true,
},
.probe = gsta_probe,
};
--
2.13.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 4/8] gpio: sta2x11: use devres for irq generic chip
2017-08-09 12:24 [PATCH v2 0/8] gpio: use devres for irq generic chip Bartosz Golaszewski
` (2 preceding siblings ...)
2017-08-09 12:25 ` [PATCH v2 3/8] gpio: sta2x11: " Bartosz Golaszewski
@ 2017-08-09 12:25 ` Bartosz Golaszewski
2017-08-09 12:25 ` [PATCH v2 5/8] gpio: ml-ioh: " Bartosz Golaszewski
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Bartosz Golaszewski @ 2017-08-09 12:25 UTC (permalink / raw)
To: Linus Walleij; +Cc: linux-gpio, linux-kernel, Bartosz Golaszewski
Use resource managed variants of irq_alloc_generic_chip() and
irq_setup_generic_chip().
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
---
drivers/gpio/gpio-sta2x11.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/gpio/gpio-sta2x11.c b/drivers/gpio/gpio-sta2x11.c
index 56beb31c03db..407359da08f9 100644
--- a/drivers/gpio/gpio-sta2x11.c
+++ b/drivers/gpio/gpio-sta2x11.c
@@ -324,9 +324,11 @@ static int gsta_alloc_irq_chip(struct gsta_gpio *chip)
{
struct irq_chip_generic *gc;
struct irq_chip_type *ct;
+ int rv;
- gc = irq_alloc_generic_chip(KBUILD_MODNAME, 1, chip->irq_base,
- chip->reg_base, handle_simple_irq);
+ gc = devm_irq_alloc_generic_chip(chip->dev, KBUILD_MODNAME, 1,
+ chip->irq_base,
+ chip->reg_base, handle_simple_irq);
if (!gc)
return -ENOMEM;
@@ -338,8 +340,11 @@ static int gsta_alloc_irq_chip(struct gsta_gpio *chip)
ct->chip.irq_enable = gsta_irq_enable;
/* FIXME: this makes at most 32 interrupts. Request 0 by now */
- irq_setup_generic_chip(gc, 0 /* IRQ_MSK(GSTA_GPIO_PER_BLOCK) */, 0,
- IRQ_NOREQUEST | IRQ_NOPROBE, 0);
+ rv = devm_irq_setup_generic_chip(chip->dev, gc,
+ 0 /* IRQ_MSK(GSTA_GPIO_PER_BLOCK) */,
+ 0, IRQ_NOREQUEST | IRQ_NOPROBE, 0);
+ if (rv)
+ return rv;
/* Set up all all 128 interrupts: code from setup_generic_chip */
{
--
2.13.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 5/8] gpio: ml-ioh: use devres for irq generic chip
2017-08-09 12:24 [PATCH v2 0/8] gpio: use devres for irq generic chip Bartosz Golaszewski
` (3 preceding siblings ...)
2017-08-09 12:25 ` [PATCH v2 4/8] gpio: sta2x11: use devres for irq generic chip Bartosz Golaszewski
@ 2017-08-09 12:25 ` Bartosz Golaszewski
2017-08-09 12:25 ` [PATCH v2 6/8] gpio: pch: " Bartosz Golaszewski
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Bartosz Golaszewski @ 2017-08-09 12:25 UTC (permalink / raw)
To: Linus Walleij; +Cc: linux-gpio, linux-kernel, Bartosz Golaszewski
Use resource managed variants of irq_alloc_generic_chip() and
irq_setup_generic_chip().
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
---
drivers/gpio/gpio-ml-ioh.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/gpio/gpio-ml-ioh.c b/drivers/gpio/gpio-ml-ioh.c
index 74fdce096c26..4b80e996d976 100644
--- a/drivers/gpio/gpio-ml-ioh.c
+++ b/drivers/gpio/gpio-ml-ioh.c
@@ -391,9 +391,10 @@ static int ioh_gpio_alloc_generic_chip(struct ioh_gpio *chip,
{
struct irq_chip_generic *gc;
struct irq_chip_type *ct;
+ int rv;
- gc = irq_alloc_generic_chip("ioh_gpio", 1, irq_start, chip->base,
- handle_simple_irq);
+ gc = devm_irq_alloc_generic_chip(chip->dev, "ioh_gpio", 1, irq_start,
+ chip->base, handle_simple_irq);
if (!gc)
return -ENOMEM;
@@ -406,10 +407,11 @@ static int ioh_gpio_alloc_generic_chip(struct ioh_gpio *chip,
ct->chip.irq_disable = ioh_irq_disable;
ct->chip.irq_enable = ioh_irq_enable;
- irq_setup_generic_chip(gc, IRQ_MSK(num), IRQ_GC_INIT_MASK_CACHE,
- IRQ_NOREQUEST | IRQ_NOPROBE, 0);
+ rv = devm_irq_setup_generic_chip(chip->dev, gc, IRQ_MSK(num),
+ IRQ_GC_INIT_MASK_CACHE,
+ IRQ_NOREQUEST | IRQ_NOPROBE, 0);
- return 0;
+ return rv;
}
static int ioh_gpio_probe(struct pci_dev *pdev,
--
2.13.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 6/8] gpio: pch: use devres for irq generic chip
2017-08-09 12:24 [PATCH v2 0/8] gpio: use devres for irq generic chip Bartosz Golaszewski
` (4 preceding siblings ...)
2017-08-09 12:25 ` [PATCH v2 5/8] gpio: ml-ioh: " Bartosz Golaszewski
@ 2017-08-09 12:25 ` Bartosz Golaszewski
2017-08-09 12:25 ` [PATCH v2 7/8] gpio: mxc: " Bartosz Golaszewski
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Bartosz Golaszewski @ 2017-08-09 12:25 UTC (permalink / raw)
To: Linus Walleij; +Cc: linux-gpio, linux-kernel, Bartosz Golaszewski
Use resource managed variants of irq_alloc_generic_chip() and
irq_setup_generic_chip().
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
---
drivers/gpio/gpio-pch.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/gpio/gpio-pch.c b/drivers/gpio/gpio-pch.c
index f6600f8ada52..68c6d0c5a6d1 100644
--- a/drivers/gpio/gpio-pch.c
+++ b/drivers/gpio/gpio-pch.c
@@ -337,9 +337,10 @@ static int pch_gpio_alloc_generic_chip(struct pch_gpio *chip,
{
struct irq_chip_generic *gc;
struct irq_chip_type *ct;
+ int rv;
- gc = irq_alloc_generic_chip("pch_gpio", 1, irq_start, chip->base,
- handle_simple_irq);
+ gc = devm_irq_alloc_generic_chip(chip->dev, "pch_gpio", 1, irq_start,
+ chip->base, handle_simple_irq);
if (!gc)
return -ENOMEM;
@@ -351,10 +352,11 @@ static int pch_gpio_alloc_generic_chip(struct pch_gpio *chip,
ct->chip.irq_unmask = pch_irq_unmask;
ct->chip.irq_set_type = pch_irq_type;
- irq_setup_generic_chip(gc, IRQ_MSK(num), IRQ_GC_INIT_MASK_CACHE,
- IRQ_NOREQUEST | IRQ_NOPROBE, 0);
+ rv = devm_irq_setup_generic_chip(chip->dev, gc, IRQ_MSK(num),
+ IRQ_GC_INIT_MASK_CACHE,
+ IRQ_NOREQUEST | IRQ_NOPROBE, 0);
- return 0;
+ return rv;
}
static int pch_gpio_probe(struct pci_dev *pdev,
--
2.13.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 7/8] gpio: mxc: use devres for irq generic chip
2017-08-09 12:24 [PATCH v2 0/8] gpio: use devres for irq generic chip Bartosz Golaszewski
` (5 preceding siblings ...)
2017-08-09 12:25 ` [PATCH v2 6/8] gpio: pch: " Bartosz Golaszewski
@ 2017-08-09 12:25 ` Bartosz Golaszewski
2017-08-09 12:25 ` [PATCH v2 8/8] gpio: mxs: " Bartosz Golaszewski
2017-08-20 22:03 ` [PATCH v2 0/8] gpio: " Linus Walleij
8 siblings, 0 replies; 10+ messages in thread
From: Bartosz Golaszewski @ 2017-08-09 12:25 UTC (permalink / raw)
To: Linus Walleij; +Cc: linux-gpio, linux-kernel, Bartosz Golaszewski
Use resource managed variants of irq_alloc_generic_chip() and
irq_setup_generic_chip().
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
---
drivers/gpio/gpio-mxc.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c
index a4d4a3527a24..78da5cbce056 100644
--- a/drivers/gpio/gpio-mxc.c
+++ b/drivers/gpio/gpio-mxc.c
@@ -66,6 +66,7 @@ struct mxc_gpio_port {
int irq_high;
struct irq_domain *domain;
struct gpio_chip gc;
+ struct device *dev;
u32 both_edges;
};
@@ -344,9 +345,10 @@ static int mxc_gpio_init_gc(struct mxc_gpio_port *port, int irq_base)
{
struct irq_chip_generic *gc;
struct irq_chip_type *ct;
+ int rv;
- gc = irq_alloc_generic_chip("gpio-mxc", 1, irq_base,
- port->base, handle_level_irq);
+ gc = devm_irq_alloc_generic_chip(port->dev, "gpio-mxc", 1, irq_base,
+ port->base, handle_level_irq);
if (!gc)
return -ENOMEM;
gc->private = port;
@@ -361,10 +363,11 @@ static int mxc_gpio_init_gc(struct mxc_gpio_port *port, int irq_base)
ct->regs.ack = GPIO_ISR;
ct->regs.mask = GPIO_IMR;
- irq_setup_generic_chip(gc, IRQ_MSK(32), IRQ_GC_INIT_NESTED_LOCK,
- IRQ_NOREQUEST, 0);
+ rv = devm_irq_setup_generic_chip(port->dev, gc, IRQ_MSK(32),
+ IRQ_GC_INIT_NESTED_LOCK,
+ IRQ_NOREQUEST, 0);
- return 0;
+ return rv;
}
static void mxc_gpio_get_hw(struct platform_device *pdev)
@@ -418,6 +421,8 @@ static int mxc_gpio_probe(struct platform_device *pdev)
if (!port)
return -ENOMEM;
+ port->dev = &pdev->dev;
+
iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
port->base = devm_ioremap_resource(&pdev->dev, iores);
if (IS_ERR(port->base))
--
2.13.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 8/8] gpio: mxs: use devres for irq generic chip
2017-08-09 12:24 [PATCH v2 0/8] gpio: use devres for irq generic chip Bartosz Golaszewski
` (6 preceding siblings ...)
2017-08-09 12:25 ` [PATCH v2 7/8] gpio: mxc: " Bartosz Golaszewski
@ 2017-08-09 12:25 ` Bartosz Golaszewski
2017-08-20 22:03 ` [PATCH v2 0/8] gpio: " Linus Walleij
8 siblings, 0 replies; 10+ messages in thread
From: Bartosz Golaszewski @ 2017-08-09 12:25 UTC (permalink / raw)
To: Linus Walleij; +Cc: linux-gpio, linux-kernel, Bartosz Golaszewski
Use resource managed variants of irq_alloc_generic_chip() and
irq_setup_generic_chip().
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
---
drivers/gpio/gpio-mxs.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/drivers/gpio/gpio-mxs.c b/drivers/gpio/gpio-mxs.c
index 159927876577..435def22445d 100644
--- a/drivers/gpio/gpio-mxs.c
+++ b/drivers/gpio/gpio-mxs.c
@@ -66,6 +66,7 @@ struct mxs_gpio_port {
int irq;
struct irq_domain *domain;
struct gpio_chip gc;
+ struct device *dev;
enum mxs_gpio_id devid;
u32 both_edges;
};
@@ -209,9 +210,10 @@ static int mxs_gpio_init_gc(struct mxs_gpio_port *port, int irq_base)
{
struct irq_chip_generic *gc;
struct irq_chip_type *ct;
+ int rv;
- gc = irq_alloc_generic_chip("gpio-mxs", 2, irq_base,
- port->base, handle_level_irq);
+ gc = devm_irq_alloc_generic_chip(port->dev, "gpio-mxs", 2, irq_base,
+ port->base, handle_level_irq);
if (!gc)
return -ENOMEM;
@@ -242,10 +244,11 @@ static int mxs_gpio_init_gc(struct mxs_gpio_port *port, int irq_base)
ct->regs.disable = PINCTRL_IRQEN(port) + MXS_CLR;
ct->handler = handle_level_irq;
- irq_setup_generic_chip(gc, IRQ_MSK(32), IRQ_GC_INIT_NESTED_LOCK,
- IRQ_NOREQUEST, 0);
+ rv = devm_irq_setup_generic_chip(port->dev, gc, IRQ_MSK(32),
+ IRQ_GC_INIT_NESTED_LOCK,
+ IRQ_NOREQUEST, 0);
- return 0;
+ return rv;
}
static int mxs_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
@@ -304,6 +307,7 @@ static int mxs_gpio_probe(struct platform_device *pdev)
if (port->id < 0)
return port->id;
port->devid = (enum mxs_gpio_id) of_id->data;
+ port->dev = &pdev->dev;
port->irq = platform_get_irq(pdev, 0);
if (port->irq < 0)
return port->irq;
--
2.13.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v2 0/8] gpio: use devres for irq generic chip
2017-08-09 12:24 [PATCH v2 0/8] gpio: use devres for irq generic chip Bartosz Golaszewski
` (7 preceding siblings ...)
2017-08-09 12:25 ` [PATCH v2 8/8] gpio: mxs: " Bartosz Golaszewski
@ 2017-08-20 22:03 ` Linus Walleij
8 siblings, 0 replies; 10+ messages in thread
From: Linus Walleij @ 2017-08-20 22:03 UTC (permalink / raw)
To: Bartosz Golaszewski; +Cc: linux-gpio, linux-kernel
On Wed, Aug 9, 2017 at 2:24 PM, Bartosz Golaszewski <brgl@bgdev.pl> wrote:
> We now provide resource managed versions of irq_alloc_generic_chip()
> and irq_setup_generic_chip(). Use them in all relevant gpio drivers.
>
> v1 -> v2:
> - added three patches which explicitly disable driver unbinding for
> non-modular drivers, only updated those built-in modules which already
> use devres in their probe() functions
> - left out the sodaville patch since it explictly says it doesn't free
> any resources
Argh missed the v2. I am indeed overloaded.
Applying this v2 series instead.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2017-08-20 22:03 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-09 12:24 [PATCH v2 0/8] gpio: use devres for irq generic chip Bartosz Golaszewski
2017-08-09 12:25 ` [PATCH v2 1/8] gpio: mxc: disallow unbinding the driver Bartosz Golaszewski
2017-08-09 12:25 ` [PATCH v2 2/8] gpio: mxs: " Bartosz Golaszewski
2017-08-09 12:25 ` [PATCH v2 3/8] gpio: sta2x11: " Bartosz Golaszewski
2017-08-09 12:25 ` [PATCH v2 4/8] gpio: sta2x11: use devres for irq generic chip Bartosz Golaszewski
2017-08-09 12:25 ` [PATCH v2 5/8] gpio: ml-ioh: " Bartosz Golaszewski
2017-08-09 12:25 ` [PATCH v2 6/8] gpio: pch: " Bartosz Golaszewski
2017-08-09 12:25 ` [PATCH v2 7/8] gpio: mxc: " Bartosz Golaszewski
2017-08-09 12:25 ` [PATCH v2 8/8] gpio: mxs: " Bartosz Golaszewski
2017-08-20 22:03 ` [PATCH v2 0/8] gpio: " Linus Walleij
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.