diff mbox series

[v1,1/3] gpiolib: Follow usual pattern for gpiod_remove_lookup_table() call

Message ID 20201228200618.58716-1-andriy.shevchenko@linux.intel.com
State New
Headers show
Series [v1,1/3] gpiolib: Follow usual pattern for gpiod_remove_lookup_table() call | expand

Commit Message

Andy Shevchenko Dec. 28, 2020, 8:06 p.m. UTC
The usual pattern for the remove calls, like gpiod_remove_lookup_table(),
is to be NULL-aware, i.o.w. become a no-op whenever parameter is NULL.
Update gpiod_remove_lookup_table() call to follow this pattern.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpiolib.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Bartosz Golaszewski Jan. 4, 2021, 2:24 p.m. UTC | #1
On Mon, Dec 28, 2020 at 9:06 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> The usual pattern for the remove calls, like gpiod_remove_lookup_table(),
> is to be NULL-aware, i.o.w. become a no-op whenever parameter is NULL.
> Update gpiod_remove_lookup_table() call to follow this pattern.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/gpio/gpiolib.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index b02cc2abd3b6..611d6ea82d75 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -3460,6 +3460,10 @@ EXPORT_SYMBOL_GPL(gpiod_add_lookup_table);
>   */
>  void gpiod_remove_lookup_table(struct gpiod_lookup_table *table)
>  {
> +       /* Nothing to remove */
> +       if (!table)
> +               return;
> +
>         mutex_lock(&gpio_lookup_lock);
>
>         list_del(&table->list);
> --
> 2.29.2
>

Applied, thanks!

Bart
Andy Shevchenko Jan. 4, 2021, 2:33 p.m. UTC | #2
On Mon, Jan 04, 2021 at 03:24:47PM +0100, Bartosz Golaszewski wrote:
> On Mon, Dec 28, 2020 at 9:06 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> >
> > The usual pattern for the remove calls, like gpiod_remove_lookup_table(),
> > is to be NULL-aware, i.o.w. become a no-op whenever parameter is NULL.
> > Update gpiod_remove_lookup_table() call to follow this pattern.
> >
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> >  drivers/gpio/gpiolib.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> > index b02cc2abd3b6..611d6ea82d75 100644
> > --- a/drivers/gpio/gpiolib.c
> > +++ b/drivers/gpio/gpiolib.c
> > @@ -3460,6 +3460,10 @@ EXPORT_SYMBOL_GPL(gpiod_add_lookup_table);
> >   */
> >  void gpiod_remove_lookup_table(struct gpiod_lookup_table *table)
> >  {
> > +       /* Nothing to remove */
> > +       if (!table)
> > +               return;
> > +
> >         mutex_lock(&gpio_lookup_lock);
> >
> >         list_del(&table->list);
> > --
> > 2.29.2
> >
> 
> Applied, thanks!

Thanks. Though I think it can be also applied to I²C tree since dependency?
Any tags / immutable branch for Wolfram?
Bartosz Golaszewski Jan. 4, 2021, 2:59 p.m. UTC | #3
On Mon, Jan 4, 2021 at 3:32 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Mon, Jan 04, 2021 at 03:24:47PM +0100, Bartosz Golaszewski wrote:
> > On Mon, Dec 28, 2020 at 9:06 PM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
> > >
> > > The usual pattern for the remove calls, like gpiod_remove_lookup_table(),
> > > is to be NULL-aware, i.o.w. become a no-op whenever parameter is NULL.
> > > Update gpiod_remove_lookup_table() call to follow this pattern.
> > >
> > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > ---
> > >  drivers/gpio/gpiolib.c | 4 ++++
> > >  1 file changed, 4 insertions(+)
> > >
> > > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> > > index b02cc2abd3b6..611d6ea82d75 100644
> > > --- a/drivers/gpio/gpiolib.c
> > > +++ b/drivers/gpio/gpiolib.c
> > > @@ -3460,6 +3460,10 @@ EXPORT_SYMBOL_GPL(gpiod_add_lookup_table);
> > >   */
> > >  void gpiod_remove_lookup_table(struct gpiod_lookup_table *table)
> > >  {
> > > +       /* Nothing to remove */
> > > +       if (!table)
> > > +               return;
> > > +
> > >         mutex_lock(&gpio_lookup_lock);
> > >
> > >         list_del(&table->list);
> > > --
> > > 2.29.2
> > >
> >
> > Applied, thanks!
>
> Thanks. Though I think it can be also applied to I涎 tree since dependency?
> Any tags / immutable branch for Wolfram?
>
> --
> With Best Regards,
> Andy Shevchenko
>
>

Oops I assumed this is independent. In that case:

Acked-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>

Wolfram, please take it through the i2c tree.

Bartosz
Jean Delvare Jan. 6, 2021, 4:03 p.m. UTC | #4
On Mon, 28 Dec 2020 22:06:16 +0200, Andy Shevchenko wrote:
> The usual pattern for the remove calls, like gpiod_remove_lookup_table(),
> is to be NULL-aware, i.o.w. become a no-op whenever parameter is NULL.
> Update gpiod_remove_lookup_table() call to follow this pattern.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/gpio/gpiolib.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index b02cc2abd3b6..611d6ea82d75 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -3460,6 +3460,10 @@ EXPORT_SYMBOL_GPL(gpiod_add_lookup_table);
>   */
>  void gpiod_remove_lookup_table(struct gpiod_lookup_table *table)
>  {
> +	/* Nothing to remove */
> +	if (!table)
> +		return;
> +
>  	mutex_lock(&gpio_lookup_lock);
>  
>  	list_del(&table->list);

Reviewed-by: Jean Delvare <jdelvare@suse.de>
diff mbox series

Patch

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index b02cc2abd3b6..611d6ea82d75 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -3460,6 +3460,10 @@  EXPORT_SYMBOL_GPL(gpiod_add_lookup_table);
  */
 void gpiod_remove_lookup_table(struct gpiod_lookup_table *table)
 {
+	/* Nothing to remove */
+	if (!table)
+		return;
+
 	mutex_lock(&gpio_lookup_lock);
 
 	list_del(&table->list);