From: Peter Korsgaard <peter@korsgaard.com>
To: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
Linus Walleij <linus.walleij@linaro.org>,
Alexandre Courbot <gnurou@gmail.com>,
Grant Likely <grant.likely@linaro.org>,
Rob Herring <robh+dt@kernel.org>,
Peter Korsgaard <jacmet@sunsite.dk>,
devicetree@vger.kernel.org
Subject: Re: [PATCH 7/8] gpio/mpc8xxx: Convert to platform device interface.
Date: Mon, 19 Jan 2015 23:48:16 +0100 [thread overview]
Message-ID: <87k30i9ykv.fsf@dell.be.48ers.dk> (raw)
In-Reply-To: <1421581173-28416-8-git-send-email-ricardo.ribalda@gmail.com> (Ricardo Ribalda Delgado's message of "Sun, 18 Jan 2015 12:39:32 +0100")
>>>>> "Ricardo" == Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> writes:
> This way we do not need to transverse the device tree manually.
> Cc: Linus Walleij <linus.walleij@linaro.org>
> Cc: Alexandre Courbot <gnurou@gmail.com>
> Cc: Grant Likely <grant.likely@linaro.org>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Peter Korsgaard <jacmet@sunsite.dk>
> Cc: devicetree@vger.kernel.org
> Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
> ---
> drivers/gpio/gpio-mpc8xxx.c | 48 +++++++++++++++++++++------------------------
> 1 file changed, 22 insertions(+), 26 deletions(-)
> diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c
> index d1ff879..57eb794 100644
> --- a/drivers/gpio/gpio-mpc8xxx.c
> +++ b/drivers/gpio/gpio-mpc8xxx.c
> @@ -15,6 +15,7 @@
> #include <linux/of.h>
> #include <linux/of_gpio.h>
> #include <linux/of_irq.h>
> +#include <linux/of_platform.h>
> #include <linux/gpio.h>
> #include <linux/slab.h>
> #include <linux/irq.h>
> @@ -342,8 +343,9 @@ static struct of_device_id mpc8xxx_gpio_ids[] __initdata = {
> {}
> };
> -static void __init mpc8xxx_add_controller(struct device_node *np)
> +static int mpc8xxx_probe(struct platform_device *pdev)
> {
> + struct device_node *np = pdev->dev.of_node;
> struct mpc8xxx_gpio_chip *mpc8xxx_gc;
> struct of_mm_gpio_chip *mm_gc;
> struct gpio_chip *gc;
> @@ -351,11 +353,9 @@ static void __init mpc8xxx_add_controller(struct device_node *np)
> unsigned hwirq;
> int ret;
> - mpc8xxx_gc = kzalloc(sizeof(*mpc8xxx_gc), GFP_KERNEL);
> - if (!mpc8xxx_gc) {
> - ret = -ENOMEM;
> - goto err;
> - }
> + mpc8xxx_gc = devm_kzalloc(&pdev->dev, sizeof(*mpc8xxx_gc), GFP_KERNEL);
> + if (!mpc8xxx_gc)
> + return -ENOMEM;
> spin_lock_init(&mpc8xxx_gc->lock);
> @@ -375,16 +375,16 @@ static void __init mpc8xxx_add_controller(struct device_node *np)
> ret = of_mm_gpiochip_add(np, mm_gc);
> if (ret)
> - goto err;
> + return ret;
> hwirq = irq_of_parse_and_map(np, 0);
> if (hwirq == NO_IRQ)
> - goto skip_irq;
> + return 0;
Actually, looking closer - Isn't this leaking mm_gc? It was as well
before, but it would be good to get it fixed.
> mpc8xxx_gc-> irq = irq_domain_add_linear(np, MPC8XXX_GPIO_PINS,
> &mpc8xxx_gpio_irq_ops, mpc8xxx_gc);
> if (!mpc8xxx_gc->irq)
> - goto skip_irq;
> + return 0;
And here as well?
--
Bye, Peter Korsgaard
next prev parent reply other threads:[~2015-01-19 22:48 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-18 11:39 [PATCH 0/8] Use of_mm_gpiochip_remove Ricardo Ribalda Delgado
2015-01-18 11:39 ` [PATCH 1/8] gpio/mpc5200: " Ricardo Ribalda Delgado
2015-01-20 10:06 ` Linus Walleij
2015-01-18 11:39 ` [PATCH 2/8] gpio/-mm-lantiq: Use devm_kzalloc Ricardo Ribalda Delgado
2015-01-20 10:07 ` Linus Walleij
2015-01-18 11:39 ` [PATCH 3/8] gpio/mm-lantiq: Do not replicate code Ricardo Ribalda Delgado
2015-01-20 10:09 ` Linus Walleij
2015-01-18 11:39 ` [PATCH 4/8] gpio-mm-lantiq: Use of_propery_read_u16 Ricardo Ribalda Delgado
2015-01-19 10:57 ` Mark Rutland
2015-01-19 11:27 ` [PATCH v2 4/8] gpio-mm-lantiq: Use of_property_read_u32 Ricardo Ribalda Delgado
2015-01-20 10:10 ` Linus Walleij
2015-01-19 11:28 ` [PATCH 4/8] gpio-mm-lantiq: Use of_propery_read_u16 Ricardo Ribalda Delgado
2015-01-18 11:39 ` [PATCH 5/8] gpio/gpio-mm-lantiq: Use of_mm_gpiochip_remove Ricardo Ribalda Delgado
2015-01-18 11:39 ` [PATCH 6/8] gpio/zevio: " Ricardo Ribalda Delgado
2015-01-18 11:39 ` [PATCH 7/8] gpio/mpc8xxx: Convert to platform device interface Ricardo Ribalda Delgado
2015-01-19 22:36 ` Peter Korsgaard
2015-01-19 22:48 ` Peter Korsgaard [this message]
2015-01-19 23:37 ` Ricardo Ribalda Delgado
2015-01-20 10:41 ` Peter Korsgaard
2015-01-20 10:54 ` Ricardo Ribalda Delgado
2015-01-20 2:03 ` Alexandre Courbot
2015-01-20 10:15 ` Linus Walleij
2015-01-18 11:39 ` [PATCH 8/8] gpio/mpc8xxx: Use of_mm_gpiochip_remove Ricardo Ribalda Delgado
2015-01-19 22:52 ` Peter Korsgaard
2015-01-19 23:10 ` Ricardo Ribalda Delgado
2015-01-20 10:40 ` Peter Korsgaard
2015-01-20 10:17 ` Linus Walleij
2015-01-20 10:31 ` Ricardo Ribalda Delgado
2015-01-21 16:45 ` Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k30i9ykv.fsf@dell.be.48ers.dk \
--to=peter@korsgaard.com \
--cc=devicetree@vger.kernel.org \
--cc=gnurou@gmail.com \
--cc=grant.likely@linaro.org \
--cc=jacmet@sunsite.dk \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ricardo.ribalda@gmail.com \
--cc=robh+dt@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®