Re: [PATCH v2 5/6] gpio: pca953x: Make platform teardown callback return void

Andy Shevchenko
2022-08-16T10:26:11Z

On Tue, Aug 16, 2022 at 11:16 AM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Mon, Aug 15, 2022 at 11:02 AM Uwe Kleine-König
> <u.kleine-koenig@pengutronix.de> wrote:
> >
> > All platforms that provide a teardown callback return 0. New users are
> > supposed to not make use of platform support, so there is no
> > functionality lost.
> >
> > This patch is a preparation for making i2c remove callbacks return void.
>
> In case you need to send another version, consider below...

(forgot to add) otherwise it can be a follow up.

> > if (pdata && pdata->teardown) {
> > - ret = pdata->teardown(client, chip->gpio_chip.base,
> > - chip->gpio_chip.ngpio, pdata->context);
> > - if (ret < 0)
> > - dev_err(&client->dev, "teardown failed, %d\n", ret);
> > - } else {
> > - ret = 0;
> > + pdata->teardown(client, chip->gpio_chip.base,
> > + chip->gpio_chip.ngpio, pdata->context);
> > }
>
> First of all, after this change the {} should not be needed.
> Second, with a temporary variable
>
> struct gpio_chip *gc = &chip->gpio_chip;
>
> this becomes a one liner like
>
> pdata->teardown(client, gc->base, gc->ngpio, pdata->context);

--
With Best Regards,
Andy Shevchenko