Message ID | 2aa5200a-ee42-e064-16a1-672bed5708c6@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 4f198e720eab187577aabef319bc75d666b441c3 |
Delegated to: | Kalle Valo |
Headers | show |
Series | [v3,1/5] wifi: rtl8xxxu: Deduplicate the efuse dumping code | expand |
> -----Original Message----- > From: Bitterblue Smith <rtl8821cerfe2@gmail.com> > Sent: Saturday, December 17, 2022 10:12 PM > To: linux-wireless@vger.kernel.org > Cc: Jes Sorensen <Jes.Sorensen@gmail.com>; Ping-Ke Shih <pkshih@realtek.com>; Andrea Merello > <andrea.merello@gmail.com>; Taehee Yoo <ap420073@gmail.com> > Subject: [PATCH v3 1/5] wifi: rtl8xxxu: Deduplicate the efuse dumping code > > Every chip family except RTL8723AU has a copy of the efuse dumping > code. Remove this and dump the efuse from a single place using a new > function rtl8xxxu_dump_efuse(). > > Also, use print_hex_dump() to print the efuse instead of a loop and > dev_info(). It shows the ASCII interpretation of the bytes, which is > nice. > > Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com> Reviewed-by: Ping-Ke Shih <pkshih@realtek.com> > --- > v3: > - Implement suggestion from Ping-Ke Shih: > - Use EFUSE_MAP_LEN instead of EFUSE_REAL_CONTENT_LEN_8723A. > They have the same value. > > v2: > - Patch is new in v2. > --- > .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c | 11 ----------- > .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c | 10 ---------- > .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c | 9 --------- > .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c | 11 ----------- > .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 13 +++++++++++++ > 5 files changed, 13 insertions(+), 41 deletions(-) > [...]
Bitterblue Smith <rtl8821cerfe2@gmail.com> wrote: > Every chip family except RTL8723AU has a copy of the efuse dumping > code. Remove this and dump the efuse from a single place using a new > function rtl8xxxu_dump_efuse(). > > Also, use print_hex_dump() to print the efuse instead of a loop and > dev_info(). It shows the ASCII interpretation of the bytes, which is > nice. > > Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com> > Reviewed-by: Ping-Ke Shih <pkshih@realtek.com> 5 patches applied to wireless-next.git, thanks. 4f198e720eab wifi: rtl8xxxu: Deduplicate the efuse dumping code d7a3705c9634 wifi: rtl8xxxu: Make rtl8xxxu_load_firmware take const char* b75289e89459 wifi: rtl8xxxu: Define masks for cck_agc_rpt bits 3dfb8e844fa3 wifi: rtl8xxxu: Support new chip RTL8188EU 8b9754b28f0f wifi: rtl8xxxu: Add rate control code for RTL8188EU
diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c index 2c4f403ba68f..ba28a4c00d3b 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c @@ -716,7 +716,6 @@ static void rtl8188fu_init_statistics(struct rtl8xxxu_priv *priv) static int rtl8188fu_parse_efuse(struct rtl8xxxu_priv *priv) { struct rtl8188fu_efuse *efuse = &priv->efuse_wifi.efuse8188fu; - int i; if (efuse->rtl_id != cpu_to_le16(0x8129)) return -EINVAL; @@ -738,16 +737,6 @@ static int rtl8188fu_parse_efuse(struct rtl8xxxu_priv *priv) dev_info(&priv->udev->dev, "Vendor: %.7s\n", efuse->vendor_name); dev_info(&priv->udev->dev, "Product: %.7s\n", efuse->device_name); - if (rtl8xxxu_debug & RTL8XXXU_DEBUG_EFUSE) { - unsigned char *raw = priv->efuse_wifi.raw; - - dev_info(&priv->udev->dev, - "%s: dumping efuse (0x%02zx bytes):\n", - __func__, sizeof(struct rtl8188fu_efuse)); - for (i = 0; i < sizeof(struct rtl8188fu_efuse); i += 8) - dev_info(&priv->udev->dev, "%02x: %8ph\n", i, &raw[i]); - } - return 0; } diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c index 3bef9ffc8b02..d43f8afeb876 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c @@ -404,7 +404,6 @@ static int rtl8192cu_load_firmware(struct rtl8xxxu_priv *priv) static int rtl8192cu_parse_efuse(struct rtl8xxxu_priv *priv) { struct rtl8192cu_efuse *efuse = &priv->efuse_wifi.efuse8192; - int i; if (efuse->rtl_id != cpu_to_le16(0x8129)) return -EINVAL; @@ -457,15 +456,6 @@ static int rtl8192cu_parse_efuse(struct rtl8xxxu_priv *priv) priv->power_base = &rtl8188r_power_base; } - if (rtl8xxxu_debug & RTL8XXXU_DEBUG_EFUSE) { - unsigned char *raw = priv->efuse_wifi.raw; - - dev_info(&priv->udev->dev, - "%s: dumping efuse (0x%02zx bytes):\n", - __func__, sizeof(struct rtl8192cu_efuse)); - for (i = 0; i < sizeof(struct rtl8192cu_efuse); i += 8) - dev_info(&priv->udev->dev, "%02x: %8ph\n", i, &raw[i]); - } return 0; } diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c index 6dc1e5858e77..91f018f6fca0 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c @@ -704,15 +704,6 @@ static int rtl8192eu_parse_efuse(struct rtl8xxxu_priv *priv) rtl8192eu_log_next_device_info(priv, "Product", efuse->device_info, &record_offset); rtl8192eu_log_next_device_info(priv, "Serial", efuse->device_info, &record_offset); - if (rtl8xxxu_debug & RTL8XXXU_DEBUG_EFUSE) { - unsigned char *raw = priv->efuse_wifi.raw; - - dev_info(&priv->udev->dev, - "%s: dumping efuse (0x%02zx bytes):\n", - __func__, sizeof(struct rtl8192eu_efuse)); - for (i = 0; i < sizeof(struct rtl8192eu_efuse); i += 8) - dev_info(&priv->udev->dev, "%02x: %8ph\n", i, &raw[i]); - } return 0; } diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c index a0ec895b61a4..b26737447035 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c @@ -497,17 +497,6 @@ static int rtl8723bu_parse_efuse(struct rtl8xxxu_priv *priv) dev_info(&priv->udev->dev, "Vendor: %.7s\n", efuse->vendor_name); dev_info(&priv->udev->dev, "Product: %.41s\n", efuse->device_name); - if (rtl8xxxu_debug & RTL8XXXU_DEBUG_EFUSE) { - int i; - unsigned char *raw = priv->efuse_wifi.raw; - - dev_info(&priv->udev->dev, - "%s: dumping efuse (0x%02zx bytes):\n", - __func__, sizeof(struct rtl8723bu_efuse)); - for (i = 0; i < sizeof(struct rtl8723bu_efuse); i += 8) - dev_info(&priv->udev->dev, "%02x: %8ph\n", i, &raw[i]); - } - return 0; } diff --git a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c index 3ed435401e57..7f2adb1a9c70 100644 --- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c +++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c @@ -1813,6 +1813,16 @@ static int rtl8xxxu_read_efuse(struct rtl8xxxu_priv *priv) return ret; } +static void rtl8xxxu_dump_efuse(struct rtl8xxxu_priv *priv) +{ + dev_info(&priv->udev->dev, + "Dumping efuse for RTL%s (0x%02x bytes):\n", + priv->chip_name, EFUSE_MAP_LEN); + + print_hex_dump(KERN_INFO, "", DUMP_PREFIX_OFFSET, 16, 1, + priv->efuse_wifi.raw, EFUSE_MAP_LEN, true); +} + void rtl8xxxu_reset_8051(struct rtl8xxxu_priv *priv) { u8 val8; @@ -6839,6 +6849,9 @@ static int rtl8xxxu_probe(struct usb_interface *interface, goto err_set_intfdata; } + if (rtl8xxxu_debug & RTL8XXXU_DEBUG_EFUSE) + rtl8xxxu_dump_efuse(priv); + rtl8xxxu_print_chipinfo(priv); ret = priv->fops->load_firmware(priv);
Every chip family except RTL8723AU has a copy of the efuse dumping code. Remove this and dump the efuse from a single place using a new function rtl8xxxu_dump_efuse(). Also, use print_hex_dump() to print the efuse instead of a loop and dev_info(). It shows the ASCII interpretation of the bytes, which is nice. Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com> --- v3: - Implement suggestion from Ping-Ke Shih: - Use EFUSE_MAP_LEN instead of EFUSE_REAL_CONTENT_LEN_8723A. They have the same value. v2: - Patch is new in v2. --- .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8188f.c | 11 ----------- .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192c.c | 10 ---------- .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8192e.c | 9 --------- .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_8723b.c | 11 ----------- .../net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c | 13 +++++++++++++ 5 files changed, 13 insertions(+), 41 deletions(-)