2022-10-16 17:30:35

by Bitterblue Smith

[permalink] [raw]
Subject: [PATCH 3/5] wifi: rtl8xxxu: Recognise all possible chip cuts

The chip cut, also known as the chip version, is a letter from A (0)
to P (15). Recognise them all instead of printing "unknown" when it's
greater than E.

Signed-off-by: Bitterblue Smith <[email protected]>
---
.../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 27 +++++--------------
1 file changed, 6 insertions(+), 21 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
index 2efc99896b96..a8914650815e 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -1573,31 +1573,16 @@ rtl8xxxu_set_spec_sifs(struct rtl8xxxu_priv *priv, u16 cck, u16 ofdm)

static void rtl8xxxu_print_chipinfo(struct rtl8xxxu_priv *priv)
{
+ static const char cuts[16] = "ABCDEFGHIJKLMNOP";
struct device *dev = &priv->udev->dev;
- char *cut;
+ char cut = '?';

- switch (priv->chip_cut) {
- case 0:
- cut = "A";
- break;
- case 1:
- cut = "B";
- break;
- case 2:
- cut = "C";
- break;
- case 3:
- cut = "D";
- break;
- case 4:
- cut = "E";
- break;
- default:
- cut = "unknown";
- }
+ /* Currently always true: chip_cut is 4 bits. */
+ if (priv->chip_cut <= 15)
+ cut = cuts[priv->chip_cut];

dev_info(dev,
- "RTL%s rev %s (%s) %iT%iR, TX queues %i, WiFi=%i, BT=%i, GPS=%i, HI PA=%i\n",
+ "RTL%s rev %c (%s) %iT%iR, TX queues %i, WiFi=%i, BT=%i, GPS=%i, HI PA=%i\n",
priv->chip_name, cut, priv->chip_vendor, priv->tx_paths,
priv->rx_paths, priv->ep_tx_count, priv->has_wifi,
priv->has_bluetooth, priv->has_gps, priv->hi_pa);
--
2.38.0


2022-10-21 05:47:48

by Ping-Ke Shih

[permalink] [raw]
Subject: RE: [PATCH 3/5] wifi: rtl8xxxu: Recognise all possible chip cuts



> -----Original Message-----
> From: Bitterblue Smith <[email protected]>
> Sent: Monday, October 17, 2022 1:30 AM
> To: [email protected]
> Cc: Jes Sorensen <[email protected]>
> Subject: [PATCH 3/5] wifi: rtl8xxxu: Recognise all possible chip cuts
>
> The chip cut, also known as the chip version, is a letter from A (0)
> to P (15). Recognise them all instead of printing "unknown" when it's
> greater than E.
>
> Signed-off-by: Bitterblue Smith <[email protected]>
> ---
> .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 27 +++++--------------
> 1 file changed, 6 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> index 2efc99896b96..a8914650815e 100644
> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
> @@ -1573,31 +1573,16 @@ rtl8xxxu_set_spec_sifs(struct rtl8xxxu_priv *priv, u16 cck, u16 ofdm)
>
> static void rtl8xxxu_print_chipinfo(struct rtl8xxxu_priv *priv)
> {
> + static const char cuts[16] = "ABCDEFGHIJKLMNOP";
> struct device *dev = &priv->udev->dev;
> - char *cut;
> + char cut = '?';
>
> - switch (priv->chip_cut) {
> - case 0:
> - cut = "A";
> - break;
> - case 1:
> - cut = "B";
> - break;
> - case 2:
> - cut = "C";
> - break;
> - case 3:
> - cut = "D";
> - break;
> - case 4:
> - cut = "E";
> - break;
> - default:
> - cut = "unknown";
> - }
> + /* Currently always true: chip_cut is 4 bits. */
> + if (priv->chip_cut <= 15)
> + cut = cuts[priv->chip_cut];

How about?

cut = 'A' + priv->chip_cut;


>
> dev_info(dev,
> - "RTL%s rev %s (%s) %iT%iR, TX queues %i, WiFi=%i, BT=%i, GPS=%i, HI PA=%i\n",
> + "RTL%s rev %c (%s) %iT%iR, TX queues %i, WiFi=%i, BT=%i, GPS=%i, HI PA=%i\n",
> priv->chip_name, cut, priv->chip_vendor, priv->tx_paths,
> priv->rx_paths, priv->ep_tx_count, priv->has_wifi,
> priv->has_bluetooth, priv->has_gps, priv->hi_pa);
> --
> 2.38.0
>
> ------Please consider the environment before printing this e-mail.

2022-10-21 17:42:30

by Bitterblue Smith

[permalink] [raw]
Subject: Re: [PATCH 3/5] wifi: rtl8xxxu: Recognise all possible chip cuts

On 21/10/2022 08:31, Ping-Ke Shih wrote:
>
>
>> -----Original Message-----
>> From: Bitterblue Smith <[email protected]>
>> Sent: Monday, October 17, 2022 1:30 AM
>> To: [email protected]
>> Cc: Jes Sorensen <[email protected]>
>> Subject: [PATCH 3/5] wifi: rtl8xxxu: Recognise all possible chip cuts
>>
>> The chip cut, also known as the chip version, is a letter from A (0)
>> to P (15). Recognise them all instead of printing "unknown" when it's
>> greater than E.
>>
>> Signed-off-by: Bitterblue Smith <[email protected]>
>> ---
>> .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 27 +++++--------------
>> 1 file changed, 6 insertions(+), 21 deletions(-)
>>
>> diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
>> b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
>> index 2efc99896b96..a8914650815e 100644
>> --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
>> +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
>> @@ -1573,31 +1573,16 @@ rtl8xxxu_set_spec_sifs(struct rtl8xxxu_priv *priv, u16 cck, u16 ofdm)
>>
>> static void rtl8xxxu_print_chipinfo(struct rtl8xxxu_priv *priv)
>> {
>> + static const char cuts[16] = "ABCDEFGHIJKLMNOP";
>> struct device *dev = &priv->udev->dev;
>> - char *cut;
>> + char cut = '?';
>>
>> - switch (priv->chip_cut) {
>> - case 0:
>> - cut = "A";
>> - break;
>> - case 1:
>> - cut = "B";
>> - break;
>> - case 2:
>> - cut = "C";
>> - break;
>> - case 3:
>> - cut = "D";
>> - break;
>> - case 4:
>> - cut = "E";
>> - break;
>> - default:
>> - cut = "unknown";
>> - }
>> + /* Currently always true: chip_cut is 4 bits. */
>> + if (priv->chip_cut <= 15)
>> + cut = cuts[priv->chip_cut];
>
> How about?
>
> cut = 'A' + priv->chip_cut;
>
That works too.