public inbox for linux-leds@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Cc: Pavel Machek <pavel@ucw.cz>, Dan Murphy <dmurphy@ti.com>,
	linux-leds@vger.kernel.org
Subject: Re: [PATCH v1 1/2] leds: trigger: gpio: GPIO 0 is valid
Date: Fri, 30 Aug 2019 18:01:54 +0300	[thread overview]
Message-ID: <20190830150154.GN2680@smile.fi.intel.com> (raw)
In-Reply-To: <4abc4284-023d-2596-1554-42c0657cf1e8@gmail.com>

On Mon, Aug 26, 2019 at 08:36:04PM +0200, Jacek Anaszewski wrote:
> On 8/26/19 11:57 AM, Andy Shevchenko wrote:
> > On Sat, Aug 24, 2019 at 06:47:54PM +0200, Jacek Anaszewski wrote:
> >> On 8/21/19 7:17 PM, Andy Shevchenko wrote:
> >>> Allow all valid GPIOs to be used in the driver.
> >>>
> >>> Fixes: 17354bfe8527 ("leds: Add gpio-led trigger")
> >>> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > 
> >>> -	if (!gpio) {
> >>> -		if (gpio_data->gpio != 0)
> >>> +	if (!gpio_is_valid(gpio)) {
> >>> +		if (gpio_is_valid(gpio_data->gpio))
> >>>  			free_irq(gpio_to_irq(gpio_data->gpio), led);
> >>> -		gpio_data->gpio = 0;
> >>> +		gpio_data->gpio = gpio;
> >>
> >> It looks odd to me. I'd just assign invalid constant gpio number
> >> e.g. -1.
> > 
> > Current ABI (unsigned) doesn't allow us to do this. Internally we can redefine
> 
> Ah, right, missed that.
> 
> > invalid GPIO line number to -1 or so, but does it worth it?  And actually I
> > would prefer -EINVAL or -ENOENT in such cases.
> 
> OK, we can keep your "= gpio" assignment in view of the above, but need
> to return error instead of "n".

Then we will break an ABI, where user expects no error it suddenly will be one.

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2019-08-30 15:01 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-21 17:17 [PATCH v1 1/2] leds: trigger: gpio: GPIO 0 is valid Andy Shevchenko
2019-08-21 17:17 ` [PATCH v1 2/2] leds: trigger: gpio: Convert to use kstrtox() Andy Shevchenko
2019-08-24 16:51   ` Jacek Anaszewski
2019-08-24 16:47 ` [PATCH v1 1/2] leds: trigger: gpio: GPIO 0 is valid Jacek Anaszewski
2019-08-26  9:57   ` Andy Shevchenko
2019-08-26 18:36     ` Jacek Anaszewski
2019-08-30 15:01       ` Andy Shevchenko [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=20190830150154.GN2680@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=dmurphy@ti.com \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /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