diff mbox series

[3/5] wifi: ath9k: add extra options to of_init

Message ID 20240905180928.382090-4-rosenp@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Toke Høiland-Jørgensen
Headers show
Series wifi: ath9k: remove platform_data support | expand

Commit Message

Rosen Penev Sept. 5, 2024, 6:09 p.m. UTC
This is in preparation for removing platform_data support from ath9k.
Except for led-active-high, these are already present downstream in
OpenWrt and never upstreamed.

For tx_gain_buffalo, just set it based on the device. The flag was made
for a single device. Instead of adding an extra option, just look for
the compatible string.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/net/wireless/ath/ath9k/init.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Krzysztof Kozlowski Sept. 5, 2024, 9:30 p.m. UTC | #1
On 05/09/2024 20:09, Rosen Penev wrote:
> This is in preparation for removing platform_data support from ath9k.
> Except for led-active-high, these are already present downstream in
> OpenWrt and never upstreamed.
> 
> For tx_gain_buffalo, just set it based on the device. The flag was made
> for a single device. Instead of adding an extra option, just look for
> the compatible string.
> 

Bindings are before users.

> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
>  drivers/net/wireless/ath/ath9k/init.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
> index 7fad7e75af6a..88db51ec7e55 100644
> --- a/drivers/net/wireless/ath/ath9k/init.c
> +++ b/drivers/net/wireless/ath/ath9k/init.c
> @@ -670,6 +670,7 @@ static int ath9k_of_init(struct ath_softc *sc)
>  	struct ath_common *common = ath9k_hw_common(ah);
>  	enum ath_bus_type bus_type = common->bus_ops->ath_bus_type;
>  	char eeprom_name[100];
> +	u8 led_pin;
>  	int ret;
>  
>  	if (!of_device_is_available(np))
> @@ -691,6 +692,12 @@ static int ath9k_of_init(struct ath_softc *sc)
>  		ah->ah_flags |= AH_NO_EEP_SWAP;
>  	}
>  
> +	if (!of_property_read_u8(np, "qca,led-pin", &led_pin))
> +		ah->led_pin = led_pin;
> +
> +	ah->config.led_active_high = of_property_read_bool(np, "qca,led-active-high");
> +	ah->config.tx_gain_buffalo = of_device_is_compatible(np, "buffalo,wzr-hp-g450h");

There is no such compatible.

Please run scripts/checkpatch.pl and fix reported warnings. Then please
run `scripts/checkpatch.pl --strict` and (probably) fix more warnings.
Some warnings can be ignored, especially from --strict run, but the code
here looks like it needs a fix. Feel free to get in touch if the warning
is not clear.

Best regards,
Krzysztof
Rosen Penev Sept. 5, 2024, 10:46 p.m. UTC | #2
On Thu, Sep 5, 2024 at 2:30 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> On 05/09/2024 20:09, Rosen Penev wrote:
> > This is in preparation for removing platform_data support from ath9k.
> > Except for led-active-high, these are already present downstream in
> > OpenWrt and never upstreamed.
> >
> > For tx_gain_buffalo, just set it based on the device. The flag was made
> > for a single device. Instead of adding an extra option, just look for
> > the compatible string.
> >
>
> Bindings are before users.
>
> > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > ---
> >  drivers/net/wireless/ath/ath9k/init.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
> > index 7fad7e75af6a..88db51ec7e55 100644
> > --- a/drivers/net/wireless/ath/ath9k/init.c
> > +++ b/drivers/net/wireless/ath/ath9k/init.c
> > @@ -670,6 +670,7 @@ static int ath9k_of_init(struct ath_softc *sc)
> >       struct ath_common *common = ath9k_hw_common(ah);
> >       enum ath_bus_type bus_type = common->bus_ops->ath_bus_type;
> >       char eeprom_name[100];
> > +     u8 led_pin;
> >       int ret;
> >
> >       if (!of_device_is_available(np))
> > @@ -691,6 +692,12 @@ static int ath9k_of_init(struct ath_softc *sc)
> >               ah->ah_flags |= AH_NO_EEP_SWAP;
> >       }
> >
> > +     if (!of_property_read_u8(np, "qca,led-pin", &led_pin))
> > +             ah->led_pin = led_pin;
> > +
> > +     ah->config.led_active_high = of_property_read_bool(np, "qca,led-active-high");
> > +     ah->config.tx_gain_buffalo = of_device_is_compatible(np, "buffalo,wzr-hp-g450h");
>
> There is no such compatible.
Correct. There is none at this time. As the commit message states,
tx_gain_buffalo was introduced for this device and this device only.
If it is to be upstreamed, this would be the name for it. OTOH, the
device is old and probably can't run modern kernels comfortably. It
might make sense to eventually remove this completely.

My goal with this commit is to match ath9k_platform_device capability
to OF before removing it.
>
> Please run scripts/checkpatch.pl and fix reported warnings. Then please
> run `scripts/checkpatch.pl --strict` and (probably) fix more warnings.
> Some warnings can be ignored, especially from --strict run, but the code
> here looks like it needs a fix. Feel free to get in touch if the warning
> is not clear.
>
> Best regards,
> Krzysztof
>
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath9k/init.c b/drivers/net/wireless/ath/ath9k/init.c
index 7fad7e75af6a..88db51ec7e55 100644
--- a/drivers/net/wireless/ath/ath9k/init.c
+++ b/drivers/net/wireless/ath/ath9k/init.c
@@ -670,6 +670,7 @@  static int ath9k_of_init(struct ath_softc *sc)
 	struct ath_common *common = ath9k_hw_common(ah);
 	enum ath_bus_type bus_type = common->bus_ops->ath_bus_type;
 	char eeprom_name[100];
+	u8 led_pin;
 	int ret;
 
 	if (!of_device_is_available(np))
@@ -691,6 +692,12 @@  static int ath9k_of_init(struct ath_softc *sc)
 		ah->ah_flags |= AH_NO_EEP_SWAP;
 	}
 
+	if (!of_property_read_u8(np, "qca,led-pin", &led_pin))
+		ah->led_pin = led_pin;
+
+	ah->config.led_active_high = of_property_read_bool(np, "qca,led-active-high");
+	ah->config.tx_gain_buffalo = of_device_is_compatible(np, "buffalo,wzr-hp-g450h");
+
 	of_get_mac_address(np, common->macaddr);
 
 	return 0;