All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-wpan@vger.kernel.org,  netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,  linux-gpio@vger.kernel.org,
	 Alexander Aring <alex.aring@gmail.com>,
	 Stefan Schmidt <stefan@datenfreihafen.org>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	 "David S. Miller" <davem@davemloft.net>,
	 Eric Dumazet <edumazet@google.com>,
	 Jakub Kicinski <kuba@kernel.org>,
	 Paolo Abeni <pabeni@redhat.com>,
	 Linus Walleij <linus.walleij@linaro.org>,
	 Bartosz Golaszewski <brgl@bgdev.pl>
Subject: Re: [PATCH net-next v1 2/2] ieee802154: ca8210: Switch to using gpiod API
Date: Mon, 03 Mar 2025 17:20:59 +0100	[thread overview]
Message-ID: <8734fu84r8.fsf@bootlin.com> (raw)
In-Reply-To: <20250303150855.1294188-3-andriy.shevchenko@linux.intel.com> (Andy Shevchenko's message of "Mon, 3 Mar 2025 17:07:40 +0200")

Hi Andy,

> @@ -350,8 +348,8 @@ struct work_priv_container {
>   * @extclockenable: true if the external clock is to be enabled
>   * @extclockfreq:   frequency of the external clock
>   * @extclockgpio:   ca8210 output gpio of the external clock
> - * @gpio_reset:     gpio number of ca8210 reset line
> - * @gpio_irq:       gpio number of ca8210 interrupt line
> + * @reset_gpio:     GPIO of ca8210 reset line

What about "CA8210 Reset GPIO line"? Or Just "Reset GPIO line"? Or even
"Reset GPIO descriptor" (whatever).

> + * @irq_gpio:       GPIO of ca8210 interrupt line

Same

>   * @irq_id:         identifier for the ca8210 irq
>   *
>   */
> @@ -359,8 +357,8 @@ struct ca8210_platform_data {
>  	bool extclockenable;
>  	unsigned int extclockfreq;
>  	unsigned int extclockgpio;
> -	int gpio_reset;
> -	int gpio_irq;
> +	struct gpio_desc *reset_gpio;
> +	struct gpio_desc *irq_gpio;
>  	int irq_id;
>  };

[...]

>  	/* Wait until wakeup indication seen */
> @@ -2784,25 +2782,14 @@ static void ca8210_unregister_ext_clock(struct spi_device *spi)
>   */
>  static int ca8210_reset_init(struct spi_device *spi)
>  {
> -	int ret;
> -	struct ca8210_platform_data *pdata = spi->dev.platform_data;
> +	struct device *dev = &spi->dev;
> +	struct ca8210_platform_data *pdata = dev_get_platdata(dev);
>

Can you either mention the additional cleanup that you do in the commit
log or split it in a separate commit? (splitting is probably not
necessary here given that most of the cleanup anyway is related to the
actual changes.

> -	pdata->gpio_reset = of_get_named_gpio(
> -		spi->dev.of_node,
> -		"reset-gpio",
> -		0
> -	);
> +	pdata->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
> +	if (IS_ERR(pdata->reset_gpio))
> +		dev_crit(dev, "Reset GPIO did not set to output mode\n");
>  
> -	ret = gpio_direction_output(pdata->gpio_reset, 1);
> -	if (ret < 0) {
> -		dev_crit(
> -			&spi->dev,
> -			"Reset GPIO %d did not set to output mode\n",
> -			pdata->gpio_reset
> -		);
> -	}
> -
> -	return ret;
> +	return PTR_ERR_OR_ZERO(pdata->reset_gpio);

This is not a strong request, but in general I think it is preferred to return
immediately, so this looks easier to understand:

+	pdata->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
+	if (IS_ERR(pdata->reset_gpio)) {
+		dev_crit(dev, "Reset GPIO did not set to output mode\n");
+                return PTR_ERR(pdata->reset_pgio);
+       }
+
+       return 0;

Otherwise the rest lgtm.

Thanks,
Miquèl

  reply	other threads:[~2025-03-03 16:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-03 15:07 [PATCH net-next v1 0/2] ieee802154: ca8210: Sparse fix and GPIOd conversion Andy Shevchenko
2025-03-03 15:07 ` [PATCH net-next v1 1/2] ieee802154: ca8210: Use proper setter and getters for bitwise types Andy Shevchenko
2025-03-03 16:06   ` Miquel Raynal
2025-03-03 16:12     ` Andy Shevchenko
2025-03-03 15:07 ` [PATCH net-next v1 2/2] ieee802154: ca8210: Switch to using gpiod API Andy Shevchenko
2025-03-03 16:20   ` Miquel Raynal [this message]
2025-03-03 16:28     ` Andy Shevchenko
2025-03-03 16:36       ` Miquel Raynal

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=8734fu84r8.fsf@bootlin.com \
    --to=miquel.raynal@bootlin.com \
    --cc=alex.aring@gmail.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=brgl@bgdev.pl \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wpan@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stefan@datenfreihafen.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.