public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thierry Reding <thierry.reding@gmail.com>
To: Alexandre Courbot <acourbot@nvidia.com>
Cc: Jingoo Han <jg1.han@samsung.com>, Bryan Wu <cooloney@gmail.com>,
	Ben Dooks <ben-linux@fluff.org>,
	Kukjin Kim <kgene.kim@samsung.com>,
	linux-pwm@vger.kernel.org, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] pwm-backlight: switch to gpiod interface
Date: Wed, 7 May 2014 10:18:51 +0200	[thread overview]
Message-ID: <20140507081850.GB6362@ulmo> (raw)
In-Reply-To: <1393480414-19473-3-git-send-email-acourbot@nvidia.com>

[-- Attachment #1: Type: text/plain, Size: 1824 bytes --]

On Thu, Feb 27, 2014 at 02:53:34PM +0900, Alexandre Courbot wrote:
> Switch to the new gpiod interface, which allows to handle GPIO
> properties such as active low transparently and removes a whole bunch of
> code.
> 
> There are still a couple of users of this driver that rely on passing
> the enable GPIO number through platform data, so a fallback mechanism
> using a GPIO number is still available to avoid breaking them. It will
> be removed once current users have switched to the GPIO lookup tables
> provided by the gpiod interface.
> 
> Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
> ---
>  drivers/video/backlight/pwm_bl.c | 72 +++++++++++++++++-----------------------
>  include/linux/pwm_backlight.h    |  5 +--
>  2 files changed, 32 insertions(+), 45 deletions(-)

I've applied this with two tiny changes, see below. Please shout if you
think that's a bad idea.

> diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c
[...]
> @@ -256,8 +238,6 @@ static int pwm_backlight_probe(struct platform_device *pdev)
[...]
> +	pb->enable_gpio = devm_gpiod_get(&pdev->dev, "enable");
> +	if (IS_ERR(pb->enable_gpio)) {
> +		ret = PTR_ERR(pb->enable_gpio);
> +		if (ret == -ENOENT) {
> +			pb->enable_gpio = NULL;
> +			ret = 0;
> +		} else {
> +			goto err_alloc;
> +		}

I dropped the ret = 0 here because all error paths set it explicitly and
the non-error path never uses it. Now all branches have a single
statement and therefore the braces can be dropped.

> +	/*
> +	 * Compatibility fallback for drivers still using the integer GPIO
> +	 * platform data. Must go away soon.
> +	 */
> +	if (pb->enable_gpio == NULL && gpio_is_valid(data->enable_gpio)) {

Changed the first condition to !pb->enable_gpio for consistency.

Thierry

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2014-05-07  8:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-27  5:53 [PATCH 0/2] pwm-backlight: switch to gpiod interface (part 1) Alexandre Courbot
2014-02-27  5:53 ` [PATCH 1/2] ARM: SAMSUNG: remove gpio flags in dev-backlight Alexandre Courbot
2014-04-10  4:17   ` Alexandre Courbot
2014-04-10  9:51     ` Jingoo Han
2014-04-10 14:14       ` Alexandre Courbot
2014-04-21  6:07         ` Alexandre Courbot
2014-05-06  4:59           ` Kukjin Kim
2014-05-06 14:33             ` Alexandre Courbot
2014-05-06 15:17               ` Thierry Reding
2014-05-07  8:14   ` Thierry Reding
2014-02-27  5:53 ` [PATCH 2/2] pwm-backlight: switch to gpiod interface Alexandre Courbot
2014-05-07  8:18   ` Thierry Reding [this message]
2014-05-07  8:39     ` Alexandre Courbot
2014-03-26  5:01 ` [PATCH 0/2] pwm-backlight: switch to gpiod interface (part 1) Alexandre Courbot
2014-03-27  0:08   ` Bryan Wu
2014-03-27  1:04     ` Jingoo Han

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=20140507081850.GB6362@ulmo \
    --to=thierry.reding@gmail.com \
    --cc=acourbot@nvidia.com \
    --cc=ben-linux@fluff.org \
    --cc=cooloney@gmail.com \
    --cc=jg1.han@samsung.com \
    --cc=kgene.kim@samsung.com \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@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