From: Marek Vasut <marek.vasut@gmail.com>
To: Jingoo Han <jg1.han@samsung.com>
Cc: "'Andrew Morton'" <akpm@linux-foundation.org>,
"'LKML'" <linux-kernel@vger.kernel.org>,
"'Richard Purdie'" <rpurdie@rpsys.net>,
"'Axel Lin'" <axel.lin@gmail.com>
Subject: Re: [PATCH 5/7] backlight: lms283gf05: use devm_gpio_request()
Date: Wed, 13 Jun 2012 13:26:33 +0200 [thread overview]
Message-ID: <201206131326.33716.marek.vasut@gmail.com> (raw)
In-Reply-To: <000601cd4957$1d7b88b0$58729a10$%han@samsung.com>
Dear Jingoo Han,
> The devm_ functions allocate memory that is released when a driver
> detaches. This patch uses devm_gpio_request of these functions.
>
> Cc: Marek Vasut <marek.vasut@gmail.com>
Acked-by: Marek Vasut <marek.vasut@gmail.com>
> Cc: Richard Purdie <rpurdie@rpsys.net>
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>
> ---
> drivers/video/backlight/lms283gf05.c | 24 ++++++------------------
> 1 files changed, 6 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/video/backlight/lms283gf05.c
> b/drivers/video/backlight/lms283gf05.c index a9f2c36..ea43f22 100644
> --- a/drivers/video/backlight/lms283gf05.c
> +++ b/drivers/video/backlight/lms283gf05.c
> @@ -158,29 +158,27 @@ static int __devinit lms283gf05_probe(struct
> spi_device *spi) int ret = 0;
>
> if (pdata != NULL) {
> - ret = gpio_request(pdata->reset_gpio, "LMS285GF05 RESET");
> + ret = devm_gpio_request(&spi->dev, pdata->reset_gpio,
> + "LMS285GF05 RESET");
> if (ret)
> return ret;
>
> ret = gpio_direction_output(pdata->reset_gpio,
> !pdata->reset_inverted);
> if (ret)
> - goto err;
> + return ret;
> }
>
> st = devm_kzalloc(&spi->dev, sizeof(struct lms283gf05_state),
> GFP_KERNEL);
> if (st == NULL) {
> dev_err(&spi->dev, "No memory for device state\n");
> - ret = -ENOMEM;
> - goto err;
> + return -ENOMEM;
> }
>
> ld = lcd_device_register("lms283gf05", &spi->dev, st, &lms_ops);
> - if (IS_ERR(ld)) {
> - ret = PTR_ERR(ld);
> - goto err;
> - }
> + if (IS_ERR(ld))
> + return PTR_ERR(ld);
>
> st->spi = spi;
> st->ld = ld;
> @@ -193,24 +191,14 @@ static int __devinit lms283gf05_probe(struct
> spi_device *spi) lms283gf05_toggle(spi, disp_initseq,
> ARRAY_SIZE(disp_initseq));
>
> return 0;
> -
> -err:
> - if (pdata != NULL)
> - gpio_free(pdata->reset_gpio);
> -
> - return ret;
> }
>
> static int __devexit lms283gf05_remove(struct spi_device *spi)
> {
> struct lms283gf05_state *st = dev_get_drvdata(&spi->dev);
> - struct lms283gf05_pdata *pdata = st->spi->dev.platform_data;
>
> lcd_device_unregister(st->ld);
>
> - if (pdata != NULL)
> - gpio_free(pdata->reset_gpio);
> -
> return 0;
> }
Best regards,
Marek Vasut
prev parent reply other threads:[~2012-06-13 11:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-13 11:24 [PATCH 5/7] backlight: lms283gf05: use devm_gpio_request() Jingoo Han
2012-06-13 11:26 ` Marek Vasut [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=201206131326.33716.marek.vasut@gmail.com \
--to=marek.vasut@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=axel.lin@gmail.com \
--cc=jg1.han@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rpurdie@rpsys.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.