diff mbox series

[v3,3/5] wifi: rtl8xxxu: Recognise all possible chip cuts

Message ID bded398b-322d-0e70-c058-62b1a6115bed@gmail.com
State Superseded
Headers show
Series [v3,1/5] wifi: rtl8xxxu: Add central frequency offset tracking | expand

Commit Message

Bitterblue Smith Oct. 28, 2022, 4:37 p.m. UTC
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 <rtl8821cerfe2@gmail.com>
---
v3:
 - No change.
 
v2:
 - Suggestion from Ping-Ke Shih:
   - Don't use array of letters.
---
 .../wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 26 ++++---------------
 1 file changed, 5 insertions(+), 21 deletions(-)

Comments

Ping-Ke Shih Oct. 31, 2022, 1:08 a.m. UTC | #1
> -----Original Message-----
> From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
> Sent: Saturday, October 29, 2022 12:37 AM
> To: linux-wireless@vger.kernel.org
> Cc: Jes Sorensen <Jes.Sorensen@gmail.com>
> Subject: [PATCH v3 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 <rtl8821cerfe2@gmail.com>

Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>

> ---
> v3:
>  - No change.
> 
> v2:
>  - Suggestion from Ping-Ke Shih:
>    - Don't use array of letters.
> ---

[...]
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
index 861c33a6d7f9..64062f18a5a0 100644
--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
@@ -1574,30 +1574,14 @@  rtl8xxxu_set_spec_sifs(struct rtl8xxxu_priv *priv, u16 cck, u16 ofdm)
 static void rtl8xxxu_print_chipinfo(struct rtl8xxxu_priv *priv)
 {
 	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 = '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);