diff mbox

[01/12] gpio: mockup: use devm_irq_alloc_descs()

Message ID 1488644620-11488-2-git-send-email-bgolaszewski@baylibre.com (mailing list archive)
State New, archived
Headers show

Commit Message

Bartosz Golaszewski March 4, 2017, 4:23 p.m. UTC
Use the resource managed variant of irq_alloc_descs(). This allows us
to remove gpio_mockup_remove().

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 drivers/gpio/gpio-mockup.c | 16 +---------------
 1 file changed, 1 insertion(+), 15 deletions(-)

Comments

Bamvor Zhang Jian March 8, 2017, 8:21 a.m. UTC | #1
On 4 March 2017 at 17:23, Bartosz Golaszewski <bgolaszewski@baylibre.com> wrote:
> Use the resource managed variant of irq_alloc_descs(). This allows us
> to remove gpio_mockup_remove().
>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>

> ---
>  drivers/gpio/gpio-mockup.c | 16 +---------------
>  1 file changed, 1 insertion(+), 15 deletions(-)
>
> diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c
> index 06dac72..37c2d69 100644
> --- a/drivers/gpio/gpio-mockup.c
> +++ b/drivers/gpio/gpio-mockup.c
> @@ -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
>
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Linus Walleij March 14, 2017, 3:08 p.m. UTC | #2
On Sat, Mar 4, 2017 at 5:23 PM, Bartosz Golaszewski
<bgolaszewski@baylibre.com> wrote:

> Use the resource managed variant of irq_alloc_descs(). This allows us
> to remove gpio_mockup_remove().
>
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>

Patch applied with Bamvor's review tag.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c
index 06dac72..37c2d69 100644
--- a/drivers/gpio/gpio-mockup.c
+++ b/drivers/gpio/gpio-mockup.c
@@ -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;