[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZW3SkKp9KrXvaa2o@smile.fi.intel.com>
Date: Mon, 4 Dec 2023 15:22:24 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Bartosz Golaszewski <brgl@...ev.pl>
Cc: Linus Walleij <linus.walleij@...aro.org>,
linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: Re: [PATCH v3 10/10] gpiolib: remove gpiochip_is_requested()
On Mon, Dec 04, 2023 at 10:35:09AM +0100, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
>
> We have no external users of gpiochip_is_requested(). Let's remove it
> and replace its internal calls with direct testing of the REQUESTED flag.
...
> char *gpiochip_dup_line_label(struct gpio_chip *gc, unsigned int offset)
> {
> - const char *label;
> - char *copy;
> + struct gpio_desc *desc;
> + char *label;
>
> - label = gpiochip_is_requested(gc, offset);
> - if (!label)
> + desc = gpiochip_get_desc(gc, offset);
> + if (IS_ERR(desc))
> return NULL;
>
> - copy = kstrdup(label, GFP_KERNEL);
> - if (!copy)
> + guard(spinlock_irqsave)(&gpio_lock);
> +
> + if (!test_bit(FLAG_REQUESTED, &desc->flags))
> + return NULL;
> +
> + label = kstrdup(desc->label, GFP_KERNEL);
> + if (!label)
> return ERR_PTR(-ENOMEM);
>
> - return copy;
> + return label;
> }
My gosh, maybe we take better naming to reduce churn here?
Whatever, let's stop bikeshedding :-)
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists