Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1219544
| From | Peng Fan <van.freenix@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] gpio: gpiolib: use devm_* API to simplify driver code |
| Date | 2015-09-05 15:40 +0200 |
| Message-ID | <q5lRi-1T7-31@gated-at.bofh.it> (permalink) |
| References | <q0YJA-7eS-15@gated-at.bofh.it> <q1hVV-1br-11@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH] gpio: gpiolib: use devm_* API to simplify driver code Peng Fan <van.freenix@gmail.com> - 2015-08-24 14:10 +0200
Re: [PATCH] gpio: gpiolib: use devm_* API to simplify driver code Grygorii Strashko <grygorii.strashko@ti.com> - 2015-08-25 10:40 +0200
Re: [PATCH] gpio: gpiolib: use devm_* API to simplify driver code Alexandre Courbot <gnurou@gmail.com> - 2015-08-31 07:20 +0200
Re: [PATCH] gpio: gpiolib: use devm_* API to simplify driver code Peng Fan <van.freenix@gmail.com> - 2015-09-05 15:40 +0200
csiph-web