From: Peng Fan <van.freenix@gmail.com>
To: Grygorii Strashko <grygorii.strashko@ti.com>
Cc: linus.walleij@linaro.org, gnurou@gmail.com,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] gpio: gpiolib: use devm_* API to simplify driver code
Date: Sat, 5 Sep 2015 21:32:52 +0800 [thread overview]
Message-ID: <20150905133251.GA17774@linux-4gyl.site> (raw)
In-Reply-To: <55DC2997.9030705@ti.com>
On Tue, Aug 25, 2015 at 11:38:47AM +0300, Grygorii Strashko wrote:
> On 08/24/2015 03:05 PM, Peng Fan wrote:
> >Use devm_* API to simplify driver code.
> >
> >Signed-off-by: Peng Fan <van.freenix@gmail.com>
> >Cc: Linus Walleij <linus.walleij@linaro.org>
> >Cc: Alexandre Courbot <gnurou@gmail.com>
> ---
> > drivers/gpio/gpiolib.c | 11 +++++------
> > 1 file changed, 5 insertions(+), 6 deletions(-)
> >
> >diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> >index 6bc612b..f9470b0 100644
> >--- a/drivers/gpio/gpiolib.c
> >+++ b/drivers/gpio/gpiolib.c
> >@@ -243,7 +243,8 @@ int gpiochip_add(struct gpio_chip *chip)
> > int base = chip->base;
> > struct gpio_desc *descs;
> >
> >- descs = kcalloc(chip->ngpio, sizeof(descs[0]), GFP_KERNEL);
> >+ descs = devm_kcalloc(chip->dev, chip->ngpio, sizeof(descs[0]),
> >+ GFP_KERNEL);
>
> ^ above will not work for every one as NOT all GPIO drivers
> implemented using dev/drv model, so chip->dev could be not set
> (at least it was true when I've checked it last time).
>
Thanks for correcting me!
Regards,
Peng.
>
>
>
> --
> regards,
> -grygorii
prev parent reply other threads:[~2015-09-05 13:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-24 12:05 [PATCH] gpio: gpiolib: use devm_* API to simplify driver code Peng Fan
2015-08-25 8:38 ` Grygorii Strashko
2015-08-31 5:16 ` Alexandre Courbot
2015-09-05 13:32 ` Peng Fan [this message]
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=20150905133251.GA17774@linux-4gyl.site \
--to=van.freenix@gmail.com \
--cc=gnurou@gmail.com \
--cc=grygorii.strashko@ti.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.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