gpio: use resource management for irq descriptors
Subsystems (7)
cover gpio: use resource management for irq descriptors
The following series uses the recently introduced set of devm_irq_alloc_desc*() helpers in the GPIO drivers.
While we're at it: if the modified drivers called request_irq(), it was changed to devm_request_irq() too.
Some drivers correctly clean up resources (e.g. gpio-mockup, gpio-pch) - for them this change leads to an actual code shrink.
Other drivers are meant to be built-in and the devices they control are never removed (e.g. gpio-pxa, gpio-davinci), so they deliberately omit the cleanup. Still: in case something changes it's better to free the resources - especially since these drivers already use other devm_* routines like devm_kzalloc() etc.
The last group of drivers are the ones which can be compiled as modules, but leak resources unintentionally (e.g. gpio-twl4030, gpio-omap). This change fixes the interrupt descriptor leaks, but some drivers will require additional work since they still don't release other resources.
The following drivers were tested: gpio-mockup, gpio-omap and gpio-davinci. The rest was compile-tested only.
Bartosz Golaszewski (12):
gpio: mockup: use devm_irq_alloc_descs()
gpio: twl4030: use devm_irq_alloc_descs()
gpio: omap: use devm_irq_alloc_descs()
gpio: pch: use resource management for irqs
gpio: ml-ioh: use resource management for irqs
gpio: xlp: use resource management for irqs
gpio: pxa: use devm_irq_alloc_descs()
gpio: davinci: use devm_irq_alloc_descs()
gpio: sodaville: use resource management for irqs
gpio: mxc: use devm_irq_alloc_descs()
gpio: mxs: use devm_irq_alloc_descs()
gpio: sta2x11: use resource management for irqs
drivers/gpio/gpio-davinci.c | 2 +- drivers/gpio/gpio-ml-ioh.c | 28 +++++++--------------------- drivers/gpio/gpio-mockup.c | 16 +--------------- drivers/gpio/gpio-mxc.c | 6 ++---- drivers/gpio/gpio-mxs.c | 6 ++---- drivers/gpio/gpio-omap.c | 3 ++- drivers/gpio/gpio-pch.c | 14 ++++---------- drivers/gpio/gpio-pxa.c | 2 +- drivers/gpio/gpio-sodaville.c | 28 +++++++++++----------------- drivers/gpio/gpio-sta2x11.c | 17 ++++++----------- drivers/gpio/gpio-twl4030.c | 3 ++- drivers/gpio/gpio-xlp.c | 8 ++++---- 12 files changed, 43 insertions(+), 90 deletions(-)
Signature · 1 line
2.9.3
PATCH 1/12 gpio: mockup: use devm_irq_alloc_descs()
Use the resource managed variant of irq_alloc_descs(). This allows us to remove gpio_mockup_remove().
--- drivers/gpio/gpio-mockup.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-)
drivers/gpio/gpio-mockup.c +1 -15
@@ -169,7 +169,7 @@ static int gpio_mockup_irqchip_setup(struct device *dev,struct gpio_chip *gc = &chip->gc;int irq_base, i; - irq_base =irq_alloc_descs (-1 ,0 , gc->ngpio,0 ); + irq_base =devm_irq_alloc_descs (dev,-1 ,0 , gc->ngpio,0 );if (irq_base <0 )return irq_base;
@@ -373,25 +373,11 @@ static int gpio_mockup_probe(struct platform_device *pdev)return 0 ; } -static int gpio_mockup_remove (struct platform_device *pdev) -{ -struct gpio_mockup_chip *chips; -int i; - - chips =platform_get_drvdata (pdev); - -for (i =0 ; i < gpio_mockup_params_nr >>1 ; i++) -irq_free_descs (chips[i].gc.irq_base, chips[i].gc.ngpio); - -return 0 ; -} -static struct platform_driver gpio_mockup_driver = { .driver = { .name =GPIO_MOCKUP_NAME , }, .probe = gpio_mockup_probe, - .remove = gpio_mockup_remove, };static struct platform_device *pdev;
Signature · 1 line
2.9.3
PATCH 2/12 gpio: twl4030: use devm_irq_alloc_descs()
In reply to Bartosz GolaszewskiThis driver never frees the irq descriptors it allocates. Fix it by using a resource managed variant of irq_alloc_descs().
--- drivers/gpio/gpio-twl4030.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpio/gpio-twl4030.c +2 -1
@@ -485,7 +485,8 @@ static int gpio_twl4030_probe(struct platform_device *pdev) goto no_irqs; } - irq_base =irq_alloc_descs (-1 ,0 ,TWL4030_GPIO_MAX ,0 ); + irq_base =devm_irq_alloc_descs (&pdev->dev,-1 , +0 ,TWL4030_GPIO_MAX ,0 );if (irq_base <0 ) {dev_err (&pdev->dev,"Failed to alloc irq_descs\n" );return irq_base;
Signature · 1 line
2.9.3
PATCH 3/12 gpio: omap: use devm_irq_alloc_descs()
In reply to Bartosz GolaszewskiThis driver never frees the allocated interrupt descriptors. Fix it by using a resource managed variant of irq_alloc_descs().
--- drivers/gpio/gpio-omap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpio/gpio-omap.c +2 -1
@@ -1085,7 +1085,8 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc)* REVISIT: Once we have OMAP1 supporting SPARSE_IRQ, we can drop * irq_alloc_descs() since a base IRQ offset will no longer be needed. */ - irq_base =irq_alloc_descs (-1 ,0 , bank->width,0 ); + irq_base =devm_irq_alloc_descs (bank->chip.parent, +-1 ,0 , bank->width,0 );if (irq_base <0 ) {dev_err (bank->chip.parent,"Couldn't allocate IRQ numbers\n" );return -ENODEV ;
Signature · 1 line
2.9.3
PATCH 4/12 gpio: pch: use resource management for irqs
In reply to Bartosz GolaszewskiUse device resource managed variants of irq_alloc_descs() and request_irq() and remove the code manually freeing irq resources.
--- drivers/gpio/gpio-pch.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/gpio/gpio-pch.c +4 -10
@@ -403,7 +403,8 @@ static int pch_gpio_probe(struct pci_dev *pdev, goto err_gpiochip_add; } - irq_base =irq_alloc_descs (-1 ,0 , gpio_pins[chip->ioh],NUMA_NO_NODE ); + irq_base =devm_irq_alloc_descs (&pdev->dev,-1 ,0 , + gpio_pins[chip->ioh],NUMA_NO_NODE );if (irq_base <0 ) {dev_warn (&pdev->dev,"PCH gpio: Failed to get IRQ base num\n" ); chip->irq_base =-1 ;
@@ -416,8 +417,8 @@ static int pch_gpio_probe(struct pci_dev *pdev,iowrite32 (msk, &chip->reg->imask);iowrite32 (msk, &chip->reg->ien); - ret =request_irq (pdev->irq, pch_gpio_handler, -IRQF_SHARED ,KBUILD_MODNAME , chip); + ret =devm_request_irq (&pdev->dev, pdev->irq, pch_gpio_handler, +IRQF_SHARED ,KBUILD_MODNAME , chip);if (ret !=0 ) {dev_err (&pdev->dev,"%s request_irq failed\n" , __func__);
@@ -430,7 +431,6 @@ static int pch_gpio_probe(struct pci_dev *pdev,return 0 ; err_request_irq: -irq_free_descs (irq_base, gpio_pins[chip->ioh]);gpiochip_remove (&chip->gpio); err_gpiochip_add:
@@ -452,12 +452,6 @@ static void pch_gpio_remove(struct pci_dev *pdev) {struct pch_gpio *chip =pci_get_drvdata (pdev); -if (chip->irq_base !=-1 ) { -free_irq (pdev->irq, chip); - -irq_free_descs (chip->irq_base, gpio_pins[chip->ioh]); - } -gpiochip_remove (&chip->gpio);pci_iounmap (pdev, chip->base);pci_release_regions (pdev);
Signature · 1 line
2.9.3
PATCH 5/12 gpio: ml-ioh: use resource management for irqs
In reply to Bartosz GolaszewskiUse device resource managed variants of irq_alloc_descs() and request_irq() and remove the code manually freeing irq resources.
--- drivers/gpio/gpio-ml-ioh.c | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-)
drivers/gpio/gpio-ml-ioh.c +7 -21
@@ -459,41 +459,31 @@ static int ioh_gpio_probe(struct pci_dev *pdev, chip = chip_save;for (j =0 ; j <8 ; j++, chip++) { - irq_base =irq_alloc_descs (-1 ,IOH_IRQ_BASE , num_ports[j], -NUMA_NO_NODE ); + irq_base =devm_irq_alloc_descs (&pdev->dev,-1 ,IOH_IRQ_BASE , + num_ports[j],NUMA_NO_NODE );if (irq_base <0 ) {dev_warn (&pdev->dev,"ml_ioh_gpio: Failed to get IRQ base num\n" ); - chip->irq_base =-1 ; ret = irq_base; - goto err_irq_alloc_descs; + goto err_gpiochip_add; } chip->irq_base = irq_base;ioh_gpio_alloc_generic_chip (chip, irq_base, num_ports[j]); } chip = chip_save; - ret =request_irq (pdev->irq, ioh_gpio_handler, -IRQF_SHARED ,KBUILD_MODNAME , chip); + ret =devm_request_irq (&pdev->dev, pdev->irq, ioh_gpio_handler, +IRQF_SHARED ,KBUILD_MODNAME , chip);if (ret !=0 ) {dev_err (&pdev->dev,"%s request_irq failed\n" , __func__); - goto err_request_irq; + goto err_gpiochip_add; }pci_set_drvdata (pdev, chip);return 0 ; -err_request_irq: - chip = chip_save; -err_irq_alloc_descs: -while (--j >=0 ) { - chip--; -irq_free_descs (chip->irq_base, num_ports[j]); - } - - chip = chip_save; err_gpiochip_add:while (--i >=0 ) { chip--;
@@ -524,12 +514,8 @@ static void ioh_gpio_remove(struct pci_dev *pdev) chip_save = chip; -free_irq (pdev->irq, chip); - -for (i =0 ; i <8 ; i++, chip++) { -irq_free_descs (chip->irq_base, num_ports[i]); +for (i =0 ; i <8 ; i++, chip++)gpiochip_remove (&chip->gpio); - } chip = chip_save;pci_iounmap (pdev, chip->base);
Signature · 1 line
2.9.3
PATCH 6/12 gpio: xlp: use resource management for irqs
In reply to Bartosz GolaszewskiUse the resource managed variant of irq_alloc_descs() and remove the code manually freeing allocated interrupt descriptors.
--- drivers/gpio/gpio-xlp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpio/gpio-xlp.c +4 -4
@@ -404,7 +404,9 @@ static int xlp_gpio_probe(struct platform_device *pdev)/* XLP(MIPS) has fixed range for GPIO IRQs, Vulcan(ARM64) does not */ if (soc_type !=GPIO_VARIANT_VULCAN ) { - irq_base =irq_alloc_descs (-1 ,XLP_GPIO_IRQ_BASE , gc->ngpio,0 ); + irq_base =devm_irq_alloc_descs (&pdev->dev,-1 , +XLP_GPIO_IRQ_BASE , + gc->ngpio,0 );if (irq_base <0 ) {dev_err (&pdev->dev,"Failed to allocate IRQ numbers\n" );return irq_base;
@@ -415,7 +417,7 @@ static int xlp_gpio_probe(struct platform_device *pdev) err =gpiochip_add_data (gc, priv);if (err <0 ) - goto out_free_desc; +return err; err =gpiochip_irqchip_add (gc, &xlp_gpio_irq_chip, irq_base, handle_level_irq,IRQ_TYPE_NONE );
@@ -433,8 +435,6 @@ static int xlp_gpio_probe(struct platform_device *pdev) out_gpio_remove:gpiochip_remove (gc); -out_free_desc: -irq_free_descs (irq_base, gc->ngpio);return err; }
Signature · 1 line
2.9.3
PATCH 7/12 gpio: pxa: use devm_irq_alloc_descs()
In reply to Bartosz GolaszewskiThis driver never frees the interrupt descriptors it allocates. Fix it by using the resource managed version of irq_alloc_descs().
--- drivers/gpio/gpio-pxa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-pxa.c +1 -1
@@ -601,7 +601,7 @@ static int pxa_gpio_probe_dt(struct platform_device *pdev, nr_gpios = gpio_id->gpio_nums; pxa_last_gpio = nr_gpios -1 ; - irq_base =irq_alloc_descs (-1 ,0 , nr_gpios,0 ); + irq_base =devm_irq_alloc_descs (&pdev->dev,-1 ,0 , nr_gpios,0 );if (irq_base <0 ) {dev_err (&pdev->dev,"Failed to allocate IRQ numbers\n" );return irq_base;
Signature · 1 line
2.9.3
PATCH 8/12 gpio: davinci: use devm_irq_alloc_descs()
In reply to Bartosz GolaszewskiThis driver never frees the interrupt descriptors it allocates. Fix it by using the resource managed version of irq_alloc_descs().
--- drivers/gpio/gpio-davinci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-davinci.c +1 -1
@@ -483,7 +483,7 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)clk_prepare_enable (clk);if (!pdata->gpio_unbanked) { - irq =irq_alloc_descs (-1 ,0 , ngpio,0 ); + irq =devm_irq_alloc_descs (dev,-1 ,0 , ngpio,0 );if (irq <0 ) {dev_err (dev,"Couldn't allocate IRQ numbers\n" );return irq;
Signature · 1 line
2.9.3
PATCH 9/12 gpio: sodaville: use resource management for irqs
In reply to Bartosz GolaszewskiUse device resource managed variants of irq_alloc_descs() and request_irq() and remove the code manually freeing irq resources.
--- drivers/gpio/gpio-sodaville.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-)
drivers/gpio/gpio-sodaville.c +11 -17
@@ -135,7 +135,8 @@ static int sdv_register_irqsupport(struct sdv_gpio_chip_data *sd,struct irq_chip_type *ct;int ret; - sd->irq_base =irq_alloc_descs (-1 ,0 ,SDV_NUM_PUB_GPIOS ,-1 ); + sd->irq_base =devm_irq_alloc_descs (&pdev->dev,-1 ,0 , +SDV_NUM_PUB_GPIOS ,-1 );if (sd->irq_base <0 )return sd->irq_base;
@@ -143,10 +144,11 @@ static int sdv_register_irqsupport(struct sdv_gpio_chip_data *sd,writel (0 , sd->gpio_pub_base +GPIO_INT );writel ((1 <<11 ) -1 , sd->gpio_pub_base +GPSTR ); - ret =request_irq (pdev->irq, sdv_gpio_pub_irq_handler,IRQF_SHARED , -"sdv_gpio" , sd); + ret =devm_request_irq (&pdev->dev, pdev->irq, + sdv_gpio_pub_irq_handler,IRQF_SHARED , +"sdv_gpio" , sd);if (ret) - goto out_free_desc; +return ret;/* * This gpio irq controller latches level irqs. Testing shows that if
@@ -155,10 +157,8 @@ static int sdv_register_irqsupport(struct sdv_gpio_chip_data *sd,*/ sd->gc =irq_alloc_generic_chip ("sdv-gpio" ,1 , sd->irq_base, sd->gpio_pub_base, handle_fasteoi_irq); -if (!sd->gc) { - ret = -ENOMEM ; - goto out_free_irq; - } +if (!sd->gc) +return -ENOMEM ; sd->gc->private = sd; ct = sd->gc->chip_types;
@@ -176,16 +176,10 @@ static int sdv_register_irqsupport(struct sdv_gpio_chip_data *sd, sd->id =irq_domain_add_legacy (pdev->dev.of_node,SDV_NUM_PUB_GPIOS , sd->irq_base,0 , &irq_domain_sdv_ops, sd); -if (!sd->id) { - ret = -ENODEV ; - goto out_free_irq; - } +if (!sd->id) +return -ENODEV ; +return 0 ; -out_free_irq: -free_irq (pdev->irq, sd); -out_free_desc: -irq_free_descs (sd->irq_base,SDV_NUM_PUB_GPIOS ); -return ret; } static int sdv_gpio_probe(struct pci_dev *pdev,
Signature · 1 line
2.9.3
PATCH 10/12 gpio: mxc: use devm_irq_alloc_descs()
In reply to Bartosz GolaszewskiThis driver never frees the interrupt descriptors it allocates. Fix it by using the resource managed version of irq_alloc_descs().
--- drivers/gpio/gpio-mxc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpio/gpio-mxc.c +2 -4
@@ -471,7 +471,7 @@ static int mxc_gpio_probe(struct platform_device *pdev)if (err) goto out_bgio; - irq_base =irq_alloc_descs (-1 ,0 ,32 ,numa_node_id ()); + irq_base =devm_irq_alloc_descs (&pdev->dev,-1 ,0 ,32 ,numa_node_id ());if (irq_base <0 ) { err = irq_base; goto out_bgio;
@@ -481,7 +481,7 @@ static int mxc_gpio_probe(struct platform_device *pdev) &irq_domain_simple_ops, NULL);if (!port->domain) { err = -ENODEV ; - goto out_irqdesc_free; + goto out_bgio; }/* gpio-mxc can be a generic irq chip */
@@ -495,8 +495,6 @@ static int mxc_gpio_probe(struct platform_device *pdev) out_irqdomain_remove:irq_domain_remove (port->domain); -out_irqdesc_free: -irq_free_descs (irq_base,32 ); out_bgio:dev_info (&pdev->dev,"%s failed with errno %d\n" , __func__, err);return err;
Signature · 1 line
2.9.3
PATCH 11/12 gpio: mxs: use devm_irq_alloc_descs()
In reply to Bartosz GolaszewskiThis driver never frees the interrupt descriptors it allocates. Fix it by using the resource managed version of irq_alloc_descs().
--- drivers/gpio/gpio-mxs.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpio/gpio-mxs.c +2 -4
@@ -328,7 +328,7 @@ static int mxs_gpio_probe(struct platform_device *pdev)/* clear address has to be used to clear IRQSTAT bits */ writel (~0U , port->base +PINCTRL_IRQSTAT (port) +MXS_CLR ); - irq_base =irq_alloc_descs (-1 ,0 ,32 ,numa_node_id ()); + irq_base =devm_irq_alloc_descs (&pdev->dev,-1 ,0 ,32 ,numa_node_id ());if (irq_base <0 ) { err = irq_base; goto out_iounmap;
@@ -338,7 +338,7 @@ static int mxs_gpio_probe(struct platform_device *pdev) &irq_domain_simple_ops, NULL);if (!port->domain) { err = -ENODEV ; - goto out_irqdesc_free; + goto out_iounmap; }/* gpio-mxs can be a generic irq chip */
@@ -370,8 +370,6 @@ static int mxs_gpio_probe(struct platform_device *pdev) out_irqdomain_remove:irq_domain_remove (port->domain); -out_irqdesc_free: -irq_free_descs (irq_base,32 ); out_iounmap:iounmap (port->base);return err;
Signature · 1 line
2.9.3
PATCH 12/12 gpio: sta2x11: use resource management for irqs
In reply to Bartosz GolaszewskiUse device resource managed variants of irq_alloc_descs() and request_irq() and remove the code manually freeing irq resources.
--- drivers/gpio/gpio-sta2x11.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
drivers/gpio/gpio-sta2x11.c +6 -11
@@ -392,7 +392,8 @@ static int gsta_probe(struct platform_device *dev)gsta_set_config (chip, i, gpio_pdata->pinconfig[i]);/* 384 was used in previous code: be compatible for other drivers */ - err =irq_alloc_descs (-1 ,384 ,GSTA_NR_GPIO ,NUMA_NO_NODE ); + err =devm_irq_alloc_descs (&dev->dev,-1 ,384 , +GSTA_NR_GPIO ,NUMA_NO_NODE );if (err <0 ) {dev_warn (&dev->dev,"sta2x11 gpio: Can't get irq base (%i)\n" , -err);
@@ -401,29 +402,23 @@ static int gsta_probe(struct platform_device *dev) chip->irq_base = err;gsta_alloc_irq_chip (chip); - err =request_irq (pdev->irq, gsta_gpio_handler, -IRQF_SHARED ,KBUILD_MODNAME , chip); + err =devm_request_irq (&dev->dev, pdev->irq, gsta_gpio_handler, +IRQF_SHARED ,KBUILD_MODNAME , chip);if (err <0 ) {dev_err (&dev->dev,"sta2x11 gpio: Can't request irq (%i)\n" , -err); - goto err_free_descs; +return err; } err =devm_gpiochip_add_data (&dev->dev, &chip->gpio, chip);if (err <0 ) {dev_err (&dev->dev,"sta2x11 gpio: Can't register (%i)\n" , -err); - goto err_free_irq; +return err; }platform_set_drvdata (dev, chip);return 0 ; - -err_free_irq: -free_irq (pdev->irq, chip); -err_free_descs: -irq_free_descs (chip->irq_base,GSTA_NR_GPIO ); -return err; }static struct platform_driver sta2x11_gpio_platform_driver = {
Signature · 1 line
2.9.3
Re: [PATCH 07/12] gpio: pxa: use devm_irq_alloc_descs()
In reply to Bartosz GolaszewskiQuoted 4 lines · Bartosz Golaszewski
This driver never frees the interrupt descriptors it allocates. Fix it by using the resource managed version of
irq_alloc_descs().Signed-off-by Bartosz Golaszewski <[email protected]>
Signature · 1 line
Robert
Re: [PATCH 08/12] gpio: davinci: use devm_irq_alloc_descs()
In reply to Bartosz GolaszewskiQuoted 3 lines · Bartosz Golaszewski
This driver never frees the interrupt descriptors it allocates. Fix it by using the resource managed version of
irq_alloc_descs().
Quoted 19 lines
Signed-off-by Bartosz Golaszewski <[email protected]>--- drivers/gpio/gpio-davinci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpio/gpio-davinci.c +1
-1@@ -483,7 +483,7 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)clk_prepare_enable (clk);if (!pdata->gpio_unbanked) { - irq =irq_alloc_descs (-1 ,0 , ngpio,0 ); + irq =devm_irq_alloc_descs (dev,-1 ,0 , ngpio,0 );if (irq <0 ) {dev_err (dev,"Couldn't allocate IRQ numbers\n" );return irq;
Re: [PATCH 03/12] gpio: omap: use devm_irq_alloc_descs()
In reply to Bartosz GolaszewskiQuoted 4 lines · Bartosz Golaszewski
This driver never frees the allocated interrupt descriptors. Fix it by using a resource managed variant of
irq_alloc_descs().Signed-off-by Bartosz Golaszewski <[email protected]>
Would be good to get Aaro's ack on this one.
Regards,
Tony
Quoted 25 lines
--- drivers/gpio/gpio-omap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpio/gpio-omap.c +2
-1@@ -1085,7 +1085,8 @@ static int omap_gpio_chip_init(struct gpio_bank *bank, struct irq_chip *irqc)* REVISIT: Once we have OMAP1 supporting SPARSE_IRQ, we can drop * irq_alloc_descs() since a base IRQ offset will no longer be needed. */ - irq_base =irq_alloc_descs (-1 ,0 , bank->width,0 ); + irq_base =devm_irq_alloc_descs (bank->chip.parent, +-1 ,0 , bank->width,0 );if (irq_base <0 ) {dev_err (bank->chip.parent,"Couldn't allocate IRQ numbers\n" );return -ENODEV ;Signature · 6 lines
2.9.3 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 01/12] gpio: mockup: use devm_irq_alloc_descs()
In reply to Bartosz GolaszewskiQuoted 4 lines · Bartosz Golaszewski
Use the resource managed variant of
irq_alloc_descs(). This allows us to removegpio_mockup_remove().Signed-off-by Bartosz Golaszewski <[email protected]>
Quoted 46 lines
--- drivers/gpio/gpio-mockup.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-)drivers/gpio/gpio-mockup.c +1
-16@@ -169,7 +169,7 @@ static int gpio_mockup_irqchip_setup(struct device *dev,struct gpio_chip *gc = &chip->gc;int irq_base, i; - irq_base =irq_alloc_descs (-1 ,0 , gc->ngpio,0 ); + irq_base =devm_irq_alloc_descs (dev,-1 ,0 , gc->ngpio,0 );if (irq_base <0 )return irq_base;@@ -373,25 +373,11 @@ static int gpio_mockup_probe(struct platform_device *pdev)return 0 ; } -static int gpio_mockup_remove (struct platform_device *pdev) -{ -struct gpio_mockup_chip *chips; -int i; - - chips =platform_get_drvdata (pdev); - -for (i =0 ; i < gpio_mockup_params_nr >>1 ; i++) -irq_free_descs (chips[i].gc.irq_base, chips[i].gc.ngpio); - -return 0 ; -} -static struct platform_driver gpio_mockup_driver = { .driver = { .name =GPIO_MOCKUP_NAME , }, .probe = gpio_mockup_probe, - .remove = gpio_mockup_remove, };static struct platform_device *pdev; --2.9.3
Re: [PATCH 01/12] gpio: mockup: use devm_irq_alloc_descs()
In reply to Bartosz GolaszewskiQuoted 4 lines · Bartosz Golaszewski
Use the resource managed variant of
irq_alloc_descs(). This allows us to removegpio_mockup_remove().Signed-off-by Bartosz Golaszewski <[email protected]>
Patch applied with Bamvor's review tag.
Yours,
Linus Walleij
Re: [PATCH 02/12] gpio: twl4030: use devm_irq_alloc_descs()
In reply to Bartosz GolaszewskiQuoted 4 lines · Bartosz Golaszewski
This driver never frees the irq descriptors it allocates. Fix it by using a resource managed variant of
irq_alloc_descs().Signed-off-by Bartosz Golaszewski <[email protected]>
Patch applied.
Yours,
Linus Walleij
Re: [PATCH 03/12] gpio: omap: use devm_irq_alloc_descs()
In reply to Bartosz GolaszewskiQuoted 4 lines · Bartosz Golaszewski
This driver never frees the allocated interrupt descriptors. Fix it by using a resource managed variant of
irq_alloc_descs().Signed-off-by Bartosz Golaszewski <[email protected]>
Patch applied.
Yours,
Linus Walleij
Re: [PATCH 04/12] gpio: pch: use resource management for irqs
In reply to Bartosz GolaszewskiQuoted 4 lines · Bartosz Golaszewski
Use device resource managed variants of
irq_alloc_descs()andrequest_irq()and remove the code manually freeing irq resources.Signed-off-by Bartosz Golaszewski <[email protected]>
Patch applied.
Yours,
Linus Walleij
Re: [PATCH 05/12] gpio: ml-ioh: use resource management for irqs
In reply to Bartosz GolaszewskiQuoted 4 lines · Bartosz Golaszewski
Use device resource managed variants of
irq_alloc_descs()andrequest_irq()and remove the code manually freeing irq resources.Signed-off-by Bartosz Golaszewski <[email protected]>
Patch applied.
Yours,
Linus Walleij
Re: [PATCH 06/12] gpio: xlp: use resource management for irqs
In reply to Bartosz GolaszewskiQuoted 4 lines · Bartosz Golaszewski
Use the resource managed variant of
irq_alloc_descs()and remove the code manually freeing allocated interrupt descriptors.Signed-off-by Bartosz Golaszewski <[email protected]>
Patch applied.
Yours,
Linus Walleij
Re: [PATCH 07/12] gpio: pxa: use devm_irq_alloc_descs()
In reply to Bartosz GolaszewskiQuoted 4 lines · Bartosz Golaszewski
This driver never frees the interrupt descriptors it allocates. Fix it by using the resource managed version of
irq_alloc_descs().Signed-off-by Bartosz Golaszewski <[email protected]>
Patch applied with Robert's ACK.
Yours,
Linus Walleij
Re: [PATCH 08/12] gpio: davinci: use devm_irq_alloc_descs()
In reply to Bartosz GolaszewskiQuoted 4 lines · Bartosz Golaszewski
This driver never frees the interrupt descriptors it allocates. Fix it by using the resource managed version of
irq_alloc_descs().Signed-off-by Bartosz Golaszewski <[email protected]>
Patch applied with Keerty's ACK.
Yours,
Linus Walleij
Re: [PATCH 09/12] gpio: sodaville: use resource management for irqs
In reply to Bartosz GolaszewskiQuoted 4 lines · Bartosz Golaszewski
Use device resource managed variants of
irq_alloc_descs()andrequest_irq()and remove the code manually freeing irq resources.Signed-off-by Bartosz Golaszewski <[email protected]>
Patch applied.
Yours,
Linus Walleij
Re: [PATCH 10/12] gpio: mxc: use devm_irq_alloc_descs()
In reply to Bartosz GolaszewskiQuoted 4 lines · Bartosz Golaszewski
This driver never frees the interrupt descriptors it allocates. Fix it by using the resource managed version of
irq_alloc_descs().Signed-off-by Bartosz Golaszewski <[email protected]>
Patch applied.
Yours,
Linus Walleij
Re: [PATCH 11/12] gpio: mxs: use devm_irq_alloc_descs()
In reply to Bartosz GolaszewskiQuoted 4 lines · Bartosz Golaszewski
This driver never frees the interrupt descriptors it allocates. Fix it by using the resource managed version of
irq_alloc_descs().Signed-off-by Bartosz Golaszewski <[email protected]>
Patch applied.
Yours,
Linus Walleij
Re: [PATCH 12/12] gpio: sta2x11: use resource management for irqs
In reply to Bartosz GolaszewskiQuoted 4 lines · Bartosz Golaszewski
Use device resource managed variants of
irq_alloc_descs()andrequest_irq()and remove the code manually freeing irq resources.Signed-off-by Bartosz Golaszewski <[email protected]>
Patch applied.
Yours,
Linus Walleij
Quoted 24 lines · Bartosz Golaszewski
The following series uses the recently introduced set of devm_irq_alloc_desc*() helpers in the GPIO drivers.
While we're at it: if the modified drivers called
request_irq(), it was changed todevm_request_irq()too.Some drivers correctly clean up resources (e.g. gpio-mockup, gpio-pch) - for them this change leads to an actual code shrink.
Other drivers are meant to be built-in and the devices they control are never removed (e.g. gpio-pxa, gpio-davinci), so they deliberately omit the cleanup. Still: in case something changes it's better to free the resources - especially since these drivers already use other devm_* routines like
devm_kzalloc()etc.The last group of drivers are the ones which can be compiled as modules, but leak resources unintentionally (e.g. gpio-twl4030, gpio-omap). This change fixes the interrupt descriptor leaks, but some drivers will require additional work since they still don't release other resources.
The following drivers were tested: gpio-mockup, gpio-omap and gpio-davinci. The rest was compile-tested only.
Quoted 13 lines
Bartosz Golaszewski (12):
gpio: mockup: usedevm_irq_alloc_descs()
gpio: twl4030: usedevm_irq_alloc_descs()
gpio: omap: usedevm_irq_alloc_descs()
gpio: pch: use resource management for irqs
gpio: ml-ioh: use resource management for irqs
gpio: xlp: use resource management for irqs
gpio: pxa: usedevm_irq_alloc_descs()
gpio: davinci: usedevm_irq_alloc_descs()
gpio: sodaville: use resource management for irqs
gpio: mxc: usedevm_irq_alloc_descs()
gpio: mxs: usedevm_irq_alloc_descs()
gpio: sta2x11: use resource management for irqs
Excellent series, applied all and pushing to the build servers for testing.
Interested in the job to go over to drivers/pinctrl and check if we have some dangling descs there if this works out?
Yours,
Linus Walleij
2017-03-14 16:18 GMT+01:00 Linus Walleij <[email protected]>:
Quoted 4 lines
Excellent series, applied all and pushing to the build servers for testing.
Thanks!
Quoted 3 lines
Interested in the job to go over to
drivers/pinctrland check if we have some dangling descs there if this works out?
If time permits, I will be improving the resource management for interrupts (generic-chip, domains etc.), so I may end up in pinctrl at some point.
Best regards,
Bartosz Golaszewski