mbox series

[v2,0/3] ieee802154: ca8210: Sparse fix and GPIOd conversion

Message ID 20250303164928.1466246-1-andriy.shevchenko@linux.intel.com
Headers show
Series ieee802154: ca8210: Sparse fix and GPIOd conversion | expand

Message

Andy Shevchenko March 3, 2025, 4:49 p.m. UTC
The main part is the patch 3 that converts the driver to GPIO descriptor APIs,
the first one is just an ad-hoc fix WRT sparse complains on the bitwise
types misuse. The second one is a small cleanup that helps patch 3 to be nicer.

In v2:
- split and extended cleanup pieces into patch 2 (Miquel)
- updated kernel doc for changed members (Miquel)
- unfolded PTR_ERR_OR_ZERO() to the preferred pattern (Miquel)
- collected tags (Miquel)

Andy Shevchenko (3):
  ieee802154: ca8210: Use proper setter and getters for bitwise types
  ieee802154: ca8210: Get platform data via dev_get_platdata()
  ieee802154: ca8210: Switch to using gpiod API

 drivers/net/ieee802154/ca8210.c | 78 +++++++++++++--------------------
 1 file changed, 31 insertions(+), 47 deletions(-)

Comments

Linus Walleij March 3, 2025, 7:53 p.m. UTC | #1
On Mon, Mar 3, 2025 at 5:49 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> Access to platform data via dev_get_platdata() getter to make code cleaner.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
Andy Shevchenko March 3, 2025, 8:39 p.m. UTC | #2
Mon, Mar 03, 2025 at 09:00:39PM +0100, Linus Walleij kirjoitti:
> On Mon, Mar 3, 2025 at 5:49 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:

...

> >         reinit_completion(&priv->ca8210_is_awake);
> >         msleep(ms);
> > -       gpio_set_value(pdata->gpio_reset, 1);
> > +       gpiod_set_value(pdata->reset_gpio, 1);
> 
> This drives the GPIO low to assert reset, meaning it is something
> that should have GPIO_ACTIVE_LOW set in the device tree,

Yeah, the pin 27 is marked as NRESET and description is pointing out to it as
active low.

> and it might even have, so let's check what we can check:
> 
> git grep cascoda,ca8210
> Documentation/devicetree/bindings/net/ieee802154/ca8210.txt:    -
> compatible:           Should be "cascoda,ca8210"
> Documentation/devicetree/bindings/net/ieee802154/ca8210.txt:
>  compatible = "cascoda,ca8210";
> drivers/net/ieee802154/ca8210.c:        {.compatible = "cascoda,ca8210", },
> 
> well ain't that typical, all users are out of tree. The example
> in the bindings file is wrong, setting ACTIVE_HIGH. Sigh, let's
> assume all those DTS files somewhere are wrong and they
> didn't set GPIO_ACTIVE_LOW in them...

> Maybe add a comment in the code that this is wrong and the
> driver and DTS files should be fixed.

Or maybe fix in the driver and schema and add a quirk to gpiolib-of.c?

> Alternatively patch Documentation/devicetree/bindings/net/ieee802154/ca8210.txt
> to set GPIO_ACTIVE_LOW and fix the code to invert it both
> here and when getting the GPIO, but it could cause problems
> for outoftree users.

Would it? We have such quirks to fix a polarity for other drivers/devices.

> Either way, this is good progress:
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Thank you!
Linus Walleij March 4, 2025, 12:03 a.m. UTC | #3
On Mon, Mar 3, 2025 at 9:39 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:

> > Maybe add a comment in the code that this is wrong and the
> > driver and DTS files should be fixed.
>
> Or maybe fix in the driver and schema and add a quirk to gpiolib-of.c?

Even better!

Yours,
Linus Walleij
Andy Shevchenko March 4, 2025, 11:13 a.m. UTC | #4
On Tue, Mar 04, 2025 at 01:03:41AM +0100, Linus Walleij wrote:
> On Mon, Mar 3, 2025 at 9:39 PM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> 
> > > Maybe add a comment in the code that this is wrong and the
> > > driver and DTS files should be fixed.
> >
> > Or maybe fix in the driver and schema and add a quirk to gpiolib-of.c?
> 
> Even better!

I am about to send a v3, I'm going to leave your tag despite a few changes as
discussed. I hope this is okay with you.
Linus Walleij March 5, 2025, 7:40 a.m. UTC | #5
On Tue, Mar 4, 2025 at 12:13 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Tue, Mar 04, 2025 at 01:03:41AM +0100, Linus Walleij wrote:
> > On Mon, Mar 3, 2025 at 9:39 PM Andy Shevchenko
> > <andy.shevchenko@gmail.com> wrote:
> >
> > > > Maybe add a comment in the code that this is wrong and the
> > > > driver and DTS files should be fixed.
> > >
> > > Or maybe fix in the driver and schema and add a quirk to gpiolib-of.c?
> >
> > Even better!
>
> I am about to send a v3, I'm going to leave your tag despite a few changes as
> discussed. I hope this is okay with you.

Of course!

Linus Walleij