All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Arnd Bergmann <arnd@kernel.org>, Pavel Machek <pavel@kernel.org>,
	Arnd Bergmann <arnd@arndb.de>, Linus Walleij <linusw@kernel.org>,
	Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>,
	Bartosz Golaszewski <brgl@kernel.org>,
	linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-gpio@vger.kernel.org
Subject: Re: [PATCH] [v3] leds: gpio: make legacy gpiolib interface optional
Date: Thu, 14 May 2026 15:48:22 +0100	[thread overview]
Message-ID: <20260514144822.GM305027@google.com> (raw)
In-Reply-To: <afrjkMqRUosKtkY8@ashevche-desk.local>

On Wed, 06 May 2026, Andy Shevchenko wrote:

> On Tue, May 05, 2026 at 05:58:48PM +0200, Arnd Bergmann wrote:
> 
> > There are still a handful of ancient mips/armv5/sh boards that use the
> > gpio_led:gpio member to pass an old-style gpio number, but all modern
> > users have been converted to gpio descriptors.
> > 
> > While the CONFIG_GPIOLIB_LEGACY option that guards devm_gpio_request_one()
> > and related helpers is currently turned on in all kernel builds,
> > the plan is to only enable it on the few platforms that actually
> > pass gpio numbers in any platform_data.
> > 
> > Split out the legacy portion of the platform_data handling into a custom
> > helper function that is guarded with in #ifdef block, to allow the
> > the leds-gpio driver to compile cleanly when CONFIG_GPIOLIB_LEGACY
> > gets turned off. Once the last user is converted, this function can
> > be removed.
> 
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> There is a couple of nit-picks, but I'm not objecting if they are not
> going to be addressed.
> 
> ...
> 
> >  	gpiod = devm_gpiod_get_index_optional(dev, NULL, idx, GPIOD_OUT_LOW);
> > -	if (IS_ERR(gpiod))
> > -		return gpiod;
> > -	if (gpiod) {
> > +	if (!IS_ERR(gpiod))
> >  		gpiod_set_consumer_name(gpiod, template->name);
> > -		return gpiod;
> > -	}
> >  
> > -	/*
> > -	 * This is the legacy code path for platform code that
> > -	 * still uses GPIO numbers. Ultimately we would like to get
> > -	 * rid of this block completely.
> > -	 */
> > +	return gpiod;
> 
> Okay, let's stick with this form.
> 
> ...
> 
> > -			if (template->gpiod)
> > -				led_dat->gpiod = template->gpiod;
> > -			else
> > -				led_dat->gpiod =
> > -					gpio_led_get_gpiod(dev, i, template);
> > +			led_dat->gpiod = gpio_led_get_gpiod(dev, i, template);
> > +			if (!led_dat->gpiod)
> > +				led_dat->gpiod = gpio_led_get_legacy_gpiod(dev,
> > +								  i, template);
> 
> Why not keep the style as before:
> 
> 				led_dat->gpiod =
> 					gpio_led_get_legacy_gpiod(dev, i, template);
> 
> ? (Yes, it's a bit longer than 80, but I think in this case it's justified for
> readability).
> 
> > +
> 
> This blank like is not needed.

May as well fix them before I do a full review.

-- 
Lee Jones

      reply	other threads:[~2026-05-14 14:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-05 15:58 [PATCH] [v3] leds: gpio: make legacy gpiolib interface optional Arnd Bergmann
2026-05-06  6:45 ` Andy Shevchenko
2026-05-14 14:48   ` Lee Jones [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=20260514144822.GM305027@google.com \
    --to=lee@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=bartosz.golaszewski@oss.qualcomm.com \
    --cc=brgl@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@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 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.