Re: [PATCH 1/6] wifi: ath9k: Obtain system GPIOS from descriptors

From: Andy Shevchenko
Date: Thu Feb 01 2024 - 08:18:11 EST


On Thu, Feb 01, 2024 at 01:20:16PM +0100, Arnd Bergmann wrote:
> On Wed, Jan 31, 2024, at 23:37, Linus Walleij wrote:


FWIW, some nit-picks below.

..

> - if (ah->led_pin < 0) {
> + if (AR_SREV_SOC(ah)) {
> + ah->led_gpio = gpiod_get(ah->dev, "led", 0);
> + if (IS_ERR(ah->led_gpio))
> + ah->led_gpio = NULL;

Slightly better to have something like

desc = gpiod_get_optional();
if (!IS_ERR(desc))
led_gpio = desc;


> + } else if (ah->led_pin < 0) {

..

> + if (sc->sc_ah->led_gpio)

Dup check

> + gpiod_put(sc->sc_ah->led_gpio);

..

> #include "htc.h"
> +#include <linux/gpio/consumer.h>

First to include linux/* ones?

..

> + ath9k_hw_set_gpio(priv->ah, priv->ah->led_pin,
> + (priv->brightness == LED_OFF));

Unnecessary parentheses.

> }

..

> + if (AR_SREV_SOC(priv->ah)) {
> + priv->ah->led_gpio = gpiod_get(priv->ah->dev, "led", 0);
> + if (IS_ERR(priv->ah->led_gpio))
> + priv->ah->led_gpio = NULL;

_optional() ?


> + } else if (AR_SREV_9287(priv->ah))

..

> + if (ah->led_gpio)

Dup check.

> + gpiod_set_value(ah->led_gpio, 1);
>

..

> + if (ah->led_gpio)

Ditto.

> + gpiod_set_value(ah->led_gpio, 0);

--
With Best Regards,
Andy Shevchenko