Skip to contentSkip to conversation

wifi: rtl8xxxu: Use local 'dev' variable for dev_warn()

PATCH In review rafad900 1 participant 2 messages Aug 18 RTL8XXXU wireless driver (rtl8xxxu)

lore
Share & tools
lore

rafad900

author
#0 lore raw

PATCH 1/1 wifi: rtl8xxxu: Use local 'dev' variable for dev_warn()

From: Rafael Alejandro Diaz Cruz <[email protected]>

To ensure consistent patterns, the device struct was defined and used when dev_warn() is called. This follows the logging pattern used in most of rtl8xxxu files.

---
 drivers/net/wireless/realtek/rtl8xxxu/8188e.c |  4 +--
 drivers/net/wireless/realtek/rtl8xxxu/8188f.c |  3 +-
 drivers/net/wireless/realtek/rtl8xxxu/8192e.c | 16 +++++-----
 drivers/net/wireless/realtek/rtl8xxxu/8192f.c | 11 ++++---
 drivers/net/wireless/realtek/rtl8xxxu/8723a.c |  4 +--
 drivers/net/wireless/realtek/rtl8xxxu/8723b.c |  4 +--
 drivers/net/wireless/realtek/rtl8xxxu/core.c  | 31 ++++++++++---------
 7 files changed, 39 insertions(+), 34 deletions(-)
drivers/net/wireless/realtek/rtl8xxxu/8188e.c +2 -2
index fea5aec9ced9..040f4bbbeae4 100644
@@ -643,6 +643,7 @@ static int rtl8188eu_iqk_path_a(struct rtl8xxxu_priv *priv)
 
 static int rtl8188eu_rx_iqk_path_a(struct rtl8xxxu_priv *priv)
 {
+	struct device *dev = &priv->udev->dev;
 	u32 reg_ea4, reg_eac, reg_e94, reg_e9c, val32;
 	int result = 0;
 
@@ -740,8 +741,7 @@ static int rtl8188eu_rx_iqk_path_a(struct rtl8xxxu_priv *priv)
 	    ((reg_eac & 0x03ff0000) != 0x00360000))
 		result |= 0x02;
 	else
-		dev_warn(&priv->udev->dev, "%s: Path A RX IQK failed!\n",
-			 __func__);
+		dev_warn(dev, "%s: Path A RX IQK failed!\n", __func__);
 
 out:
 	return result;
drivers/net/wireless/realtek/rtl8xxxu/8188f.c +2 -1
index 5556aad1a7ad..68609ce37ab0 100644
@@ -789,6 +789,7 @@ static int rtl8188fu_init_phy_rf(struct rtl8xxxu_priv *priv)
 
 void rtl8188f_phy_lc_calibrate(struct rtl8xxxu_priv *priv)
 {
+	struct device *dev = &priv->udev->dev;
 	u32 val32;
 	u32 rf_amode, lstf;
 	int i;
@@ -819,7 +820,7 @@ void rtl8188f_phy_lc_calibrate(struct rtl8xxxu_priv *priv)
 	}
 
 	if (i == 100)
-		dev_warn(&priv->udev->dev, "LC calibration timed out.\n");
+		dev_warn(dev, "LC calibration timed out.\n");
 
 	rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_MODE_AG, rf_amode);
 
drivers/net/wireless/realtek/rtl8xxxu/8192e.c +8 -8
index 690ace303150..131da162d9fb 100644
@@ -742,6 +742,7 @@ static int rtl8192eu_iqk_path_a(struct rtl8xxxu_priv *priv)
 
 static int rtl8192eu_rx_iqk_path_a(struct rtl8xxxu_priv *priv)
 {
+	struct device *dev = &priv->udev->dev;
 	u32 reg_ea4, reg_eac, reg_e94, reg_e9c, val32;
 	int result = 0;
 
@@ -860,8 +861,7 @@ static int rtl8192eu_rx_iqk_path_a(struct rtl8xxxu_priv *priv)
 	    ((reg_eac & 0x03ff0000) != 0x00360000))
 		result |= 0x02;
 	else
-		dev_warn(&priv->udev->dev, "%s: Path A RX IQK failed!\n",
-			 __func__);
+		dev_warn(dev, "%s: Path A RX IQK failed!\n", __func__);
 
 out:
 	return result;
@@ -869,6 +869,7 @@ static int rtl8192eu_rx_iqk_path_a(struct rtl8xxxu_priv *priv)
 
 static int rtl8192eu_iqk_path_b(struct rtl8xxxu_priv *priv)
 {
+	struct device *dev = &priv->udev->dev;
 	u32 reg_eac, reg_eb4, reg_ebc;
 	int result = 0;
 
@@ -910,14 +911,14 @@ static int rtl8192eu_iqk_path_b(struct rtl8xxxu_priv *priv)
 	    ((reg_ebc & 0x03ff0000) != 0x00420000))
 		result |= 0x01;
 	else
-		dev_warn(&priv->udev->dev, "%s: Path B IQK failed!\n",
-			 __func__);
+		dev_warn(dev, "%s: Path B IQK failed!\n", __func__);
 
 	return result;
 }
 
 static int rtl8192eu_rx_iqk_path_b(struct rtl8xxxu_priv *priv)
 {
+	struct device *dev = &priv->udev->dev;
 	u32 reg_eac, reg_eb4, reg_ebc, reg_ec4, reg_ecc, val32;
 	int result = 0;
 
@@ -1040,8 +1041,7 @@ static int rtl8192eu_rx_iqk_path_b(struct rtl8xxxu_priv *priv)
 	    ((reg_ecc & 0x03ff0000) != 0x00360000))
 		result |= 0x02;
 	else
-		dev_warn(&priv->udev->dev, "%s: Path B RX IQK failed!\n",
-			 __func__);
+		dev_warn(dev, "%s: Path B RX IQK failed!\n", __func__);
 
 out:
 	return result;
@@ -1495,6 +1495,7 @@ static int rtl8192eu_active_to_lps(struct rtl8xxxu_priv *priv)
 
 static int rtl8192eu_active_to_emu(struct rtl8xxxu_priv *priv)
 {
+	struct device *dev = &priv->udev->dev;
 	u8 val8;
 	int count, ret = 0;
 
@@ -1521,8 +1522,7 @@ static int rtl8192eu_active_to_emu(struct rtl8xxxu_priv *priv)
 	}
 
 	if (!count) {
-		dev_warn(&priv->udev->dev, "%s: Disabling MAC timed out\n",
-			 __func__);
+		dev_warn(dev, "%s: Disabling MAC timed out\n", __func__);
 		ret = -EBUSY;
 		goto exit;
 	}
drivers/net/wireless/realtek/rtl8xxxu/8192f.c +6 -5
index 5f076da4b550..e1a10fe38b9a 100644
@@ -681,6 +681,7 @@ static void rtl8192fu_init_aggregation(struct rtl8xxxu_priv *priv)
 
 static int rtl8192fu_parse_efuse(struct rtl8xxxu_priv *priv)
 {
+	struct device *dev = &priv->udev->dev;
 	struct rtl8192fu_efuse *efuse = &priv->efuse_wifi.efuse8192fu;
 	int i;
 
@@ -731,7 +732,7 @@ static int rtl8192fu_parse_efuse(struct rtl8xxxu_priv *priv)
 	priv->rfe_type = efuse->rfe_option & 0x1f;
 
 	if (priv->rfe_type != 5 && priv->rfe_type != 1)
-		dev_warn(&priv->udev->dev,
+		dev_warn(dev,
 			 "%s: RFE type %d was not tested. Please send an email to [email protected] about this.\n",
 			 __func__, priv->rfe_type);
 
@@ -1022,6 +1023,7 @@ static int rtl8192fu_rx_iqk_path_a(struct rtl8xxxu_priv *priv)
 
 static int rtl8192fu_iqk_path_b(struct rtl8xxxu_priv *priv)
 {
+	struct device *dev = &priv->udev->dev;
 	u32 reg_eac, reg_eb4, reg_ebc, val32;
 	u32 rf_0x58_i, rf_0x58_q;
 	u8 rfe = priv->rfe_type;
@@ -1109,14 +1111,14 @@ static int rtl8192fu_iqk_path_b(struct rtl8xxxu_priv *priv)
 	    ((reg_ebc & 0x03ff0000) != 0x00420000))
 		result |= 0x01;
 	else
-		dev_warn(&priv->udev->dev, "%s: Path B IQK failed!\n",
-			 __func__);
+		dev_warn(dev, "%s: Path B IQK failed!\n", __func__);
 
 	return result;
 }
 
 static int rtl8192fu_rx_iqk_path_b(struct rtl8xxxu_priv *priv)
 {
+	struct device *dev = &priv->udev->dev;
 	u32 reg_eac, reg_eb4, reg_ebc, reg_ec4, reg_ecc, val32;
 	int result = 0;
 	int ktime;
@@ -1246,8 +1248,7 @@ static int rtl8192fu_rx_iqk_path_b(struct rtl8xxxu_priv *priv)
 	    ((reg_ecc & 0x03ff0000) != 0x00360000))
 		result |= 0x02;
 	else
-		dev_warn(&priv->udev->dev, "%s: Path B RX IQK failed!\n",
-			 __func__);
+		dev_warn(dev, "%s: Path B RX IQK failed!\n", __func__);
 
 	return result;
 }
drivers/net/wireless/realtek/rtl8xxxu/8723a.c +2 -2
index 18e038b82f49..a68e89c06cf1 100644
@@ -413,6 +413,7 @@ static int rtl8723au_power_on(struct rtl8xxxu_priv *priv)
 
 static int rtl8723au_active_to_emu(struct rtl8xxxu_priv *priv)
 {
+	struct device *dev = &priv->udev->dev;
 	u8 val8;
 	int count, ret = 0;
 
@@ -439,8 +440,7 @@ static int rtl8723au_active_to_emu(struct rtl8xxxu_priv *priv)
 	}
 
 	if (!count) {
-		dev_warn(&priv->udev->dev, "%s: Disabling MAC timed out\n",
-			 __func__);
+		dev_warn(dev, "%s: Disabling MAC timed out\n", __func__);
 		ret = -EBUSY;
 		goto exit;
 	}
drivers/net/wireless/realtek/rtl8xxxu/8723b.c +2 -2
index 24c6d8ae76ec..2edcb6f34867 100644
@@ -1216,6 +1216,7 @@ static void rtl8723bu_phy_iq_calibrate(struct rtl8xxxu_priv *priv)
 
 static int rtl8723bu_active_to_emu(struct rtl8xxxu_priv *priv)
 {
+	struct device *dev = &priv->udev->dev;
 	u8 val8;
 	u16 val16;
 	u32 val32;
@@ -1247,8 +1248,7 @@ static int rtl8723bu_active_to_emu(struct rtl8xxxu_priv *priv)
 	}
 
 	if (!count) {
-		dev_warn(&priv->udev->dev, "%s: Disabling MAC timed out\n",
-			 __func__);
+		dev_warn(dev, "%s: Disabling MAC timed out\n", __func__);
 		ret = -EBUSY;
 		goto exit;
 	}
drivers/net/wireless/realtek/rtl8xxxu/core.c +17 -14
index bddbd0990de7..f36cfaa2442f 100644
@@ -2186,6 +2186,7 @@ void rtl8xxxu_firmware_self_reset(struct rtl8xxxu_priv *priv)
 static int
 rtl8xxxu_init_mac(struct rtl8xxxu_priv *priv)
 {
+	struct device *dev = &priv->udev->dev;
 	const struct rtl8xxxu_reg8val *array = priv->fops->mactable;
 	int i, ret;
 	u16 reg;
@@ -2200,8 +2201,7 @@ rtl8xxxu_init_mac(struct rtl8xxxu_priv *priv)
 
 		ret = rtl8xxxu_write8(priv, reg, val);
 		if (ret != 1) {
-			dev_warn(&priv->udev->dev,
-				 "Failed to initialize MAC "
+			dev_warn(dev, "Failed to initialize MAC "
 				 "(reg: %04x, val %02x)\n", reg, val);
 			return -EAGAIN;
 		}
@@ -2228,6 +2228,7 @@ rtl8xxxu_init_mac(struct rtl8xxxu_priv *priv)
 int rtl8xxxu_init_phy_regs(struct rtl8xxxu_priv *priv,
 			   const struct rtl8xxxu_reg32val *array)
 {
+	struct device *dev = &priv->udev->dev;
 	int i, ret;
 	u16 reg;
 	u32 val;
@@ -2241,8 +2242,7 @@ int rtl8xxxu_init_phy_regs(struct rtl8xxxu_priv *priv,
 
 		ret = rtl8xxxu_write32(priv, reg, val);
 		if (ret != sizeof(val)) {
-			dev_warn(&priv->udev->dev,
-				 "Failed to initialize PHY\n");
+			dev_warn(dev, "Failed to initialize PHY\n");
 			return -EAGAIN;
 		}
 		udelay(1);
@@ -2386,6 +2386,7 @@ static int rtl8xxxu_init_rf_regs(struct rtl8xxxu_priv *priv,
 				 const struct rtl8xxxu_rfregval *array,
 				 enum rtl8xxxu_rfpath path)
 {
+	struct device *dev = &priv->udev->dev;
 	int i, ret;
 	u8 reg;
 	u32 val;
@@ -2420,8 +2421,7 @@ static int rtl8xxxu_init_rf_regs(struct rtl8xxxu_priv *priv,
 
 		ret = rtl8xxxu_write_rfreg(priv, path, reg, val);
 		if (ret) {
-			dev_warn(&priv->udev->dev,
-				 "Failed to initialize RF\n");
+			dev_warn(dev, "Failed to initialize RF\n");
 			return -EAGAIN;
 		}
 		udelay(1);
@@ -2557,6 +2557,7 @@ int rtl8xxxu_init_llt_table(struct rtl8xxxu_priv *priv)
 
 int rtl8xxxu_auto_llt_table(struct rtl8xxxu_priv *priv)
 {
+	struct device *dev = &priv->udev->dev;
 	u32 val32;
 	int ret = 0;
 	int i;
@@ -2574,7 +2575,7 @@ int rtl8xxxu_auto_llt_table(struct rtl8xxxu_priv *priv)
 
 	if (!i) {
 		ret = -EBUSY;
-		dev_warn(&priv->udev->dev, "LLT table init failed\n");
+		dev_warn(dev, "LLT table init failed\n");
 	}
 
 	return ret;
@@ -3088,6 +3089,7 @@ void rtl8xxxu_mac_calibration(struct rtl8xxxu_priv *priv,
 
 static int rtl8xxxu_iqk_path_a(struct rtl8xxxu_priv *priv)
 {
+	struct device *dev = &priv->udev->dev;
 	u32 reg_eac, reg_e94, reg_e9c, reg_ea4, val32;
 	int result = 0;
 
@@ -3137,14 +3139,14 @@ static int rtl8xxxu_iqk_path_a(struct rtl8xxxu_priv *priv)
 	    ((reg_eac & 0x03ff0000) != 0x00360000))
 		result |= 0x02;
 	else
-		dev_warn(&priv->udev->dev, "%s: Path A RX IQK failed!\n",
-			 __func__);
+		dev_warn(dev, "%s: Path A RX IQK failed!\n", __func__);
 out:
 	return result;
 }
 
 static int rtl8xxxu_iqk_path_b(struct rtl8xxxu_priv *priv)
 {
+	struct device *dev = &priv->udev->dev;
 	u32 reg_eac, reg_eb4, reg_ebc, reg_ec4, reg_ecc;
 	int result = 0;
 
@@ -3173,7 +3175,7 @@ static int rtl8xxxu_iqk_path_b(struct rtl8xxxu_priv *priv)
 	    (((reg_ecc & 0x03ff0000) >> 16) != 0x36))
 		result |= 0x02;
 	else
-		dev_warn(&priv->udev->dev, "%s: Path B RX IQK failed!\n",
+		dev_warn(dev, "%s: Path B RX IQK failed!\n",
 			 __func__);
 out:
 	return result;
@@ -3637,6 +3639,7 @@ static void rtl8xxxu_set_ampdu_min_space(struct rtl8xxxu_priv *priv, u8 density)
 
 int rtl8xxxu_active_to_lps(struct rtl8xxxu_priv *priv)
 {
+	struct device *dev = &priv->udev->dev;
 	u8 val8;
 	u8 val32;
 	int count, ret = 0;
@@ -3654,8 +3657,7 @@ int rtl8xxxu_active_to_lps(struct rtl8xxxu_priv *priv)
 	}
 
 	if (!count) {
-		dev_warn(&priv->udev->dev,
-			 "%s: RX poll timed out (0x05f8)\n", __func__);
+		dev_warn(dev, "%s: RX poll timed out (0x05f8)\n", __func__);
 		ret = -EBUSY;
 		goto exit;
 	}
@@ -5862,6 +5864,7 @@ static void rtl8xxxu_queue_rx_urb(struct rtl8xxxu_priv *priv,
 static void rtl8xxxu_rx_urb_work(struct work_struct *work)
 {
 	struct rtl8xxxu_priv *priv;
+	struct device *dev;
 	struct rtl8xxxu_rx_urb *rx_urb, *tmp;
 	struct list_head local;
 	struct sk_buff *skb;
@@ -5869,6 +5872,7 @@ static void rtl8xxxu_rx_urb_work(struct work_struct *work)
 	int ret;
 
 	priv = container_of(work, struct rtl8xxxu_priv, rx_urb_wq);
+	dev = &priv->udev->dev;
 	INIT_LIST_HEAD(&local);
 
 	spin_lock_irqsave(&priv->rx_urb_lock, flags);
@@ -5894,8 +5898,7 @@ static void rtl8xxxu_rx_urb_work(struct work_struct *work)
 			rtl8xxxu_queue_rx_urb(priv, rx_urb);
 			break;
 		default:
-			dev_warn(&priv->udev->dev,
-				 "failed to requeue urb with error %i\n", ret);
+			dev_warn(dev, "failed to requeue urb with error %i\n", ret);
 			skb = (struct sk_buff *)rx_urb->urb.context;
 			dev_kfree_skb(skb);
 			usb_free_urb(&rx_urb->urb);
Signature · 1 line
2.43.0
#1 lore raw

sorry, please ignore this patch. It was a test email that I messed up.

Quoted 393 lines · On Tue, Aug 18, 2026 at 12:09 PM rafad900 <[email protected]> wrote:

From: Rafael Alejandro Diaz Cruz <[email protected]>

To ensure consistent patterns, the device struct was defined and used when dev_warn() is called. This follows the logging pattern used in most of rtl8xxxu files.

---
 drivers/net/wireless/realtek/rtl8xxxu/8188e.c |  4 +--
 drivers/net/wireless/realtek/rtl8xxxu/8188f.c |  3 +-
 drivers/net/wireless/realtek/rtl8xxxu/8192e.c | 16 +++++-----
 drivers/net/wireless/realtek/rtl8xxxu/8192f.c | 11 ++++---
 drivers/net/wireless/realtek/rtl8xxxu/8723a.c |  4 +--
 drivers/net/wireless/realtek/rtl8xxxu/8723b.c |  4 +--
 drivers/net/wireless/realtek/rtl8xxxu/core.c  | 31 ++++++++++---------
 7 files changed, 39 insertions(+), 34 deletions(-)
drivers/net/wireless/realtek/rtl8xxxu/8188e.c +2 -2
index fea5aec9ced9..040f4bbbeae4 100644
@@ -643,6 +643,7 @@ static int rtl8188eu_iqk_path_a(struct rtl8xxxu_priv *priv)
 
 static int rtl8188eu_rx_iqk_path_a(struct rtl8xxxu_priv *priv)
 {
+       struct device *dev = &priv->udev->dev;
        u32 reg_ea4, reg_eac, reg_e94, reg_e9c, val32;
        int result = 0;
 
@@ -740,8 +741,7 @@ static int rtl8188eu_rx_iqk_path_a(struct rtl8xxxu_priv *priv)
            ((reg_eac & 0x03ff0000) != 0x00360000))
                result |= 0x02;
        else
-               dev_warn(&priv->udev->dev, "%s: Path A RX IQK failed!\n",
-                        __func__);
+               dev_warn(dev, "%s: Path A RX IQK failed!\n", __func__);
 
 out:
        return result;
drivers/net/wireless/realtek/rtl8xxxu/8188f.c +2 -1
index 5556aad1a7ad..68609ce37ab0 100644
@@ -789,6 +789,7 @@ static int rtl8188fu_init_phy_rf(struct rtl8xxxu_priv *priv)
 
 void rtl8188f_phy_lc_calibrate(struct rtl8xxxu_priv *priv)
 {
+       struct device *dev = &priv->udev->dev;
        u32 val32;
        u32 rf_amode, lstf;
        int i;
@@ -819,7 +820,7 @@ void rtl8188f_phy_lc_calibrate(struct rtl8xxxu_priv *priv)
        }
 
        if (i == 100)
-               dev_warn(&priv->udev->dev, "LC calibration timed out.\n");
+               dev_warn(dev, "LC calibration timed out.\n");
 
        rtl8xxxu_write_rfreg(priv, RF_A, RF6052_REG_MODE_AG, rf_amode);
 
drivers/net/wireless/realtek/rtl8xxxu/8192e.c +8 -8
index 690ace303150..131da162d9fb 100644
@@ -742,6 +742,7 @@ static int rtl8192eu_iqk_path_a(struct rtl8xxxu_priv *priv)
 
 static int rtl8192eu_rx_iqk_path_a(struct rtl8xxxu_priv *priv)
 {
+       struct device *dev = &priv->udev->dev;
        u32 reg_ea4, reg_eac, reg_e94, reg_e9c, val32;
        int result = 0;
 
@@ -860,8 +861,7 @@ static int rtl8192eu_rx_iqk_path_a(struct rtl8xxxu_priv *priv)
            ((reg_eac & 0x03ff0000) != 0x00360000))
                result |= 0x02;
        else
-               dev_warn(&priv->udev->dev, "%s: Path A RX IQK failed!\n",
-                        __func__);
+               dev_warn(dev, "%s: Path A RX IQK failed!\n", __func__);
 
 out:
        return result;
@@ -869,6 +869,7 @@ static int rtl8192eu_rx_iqk_path_a(struct rtl8xxxu_priv *priv)
 
 static int rtl8192eu_iqk_path_b(struct rtl8xxxu_priv *priv)
 {
+       struct device *dev = &priv->udev->dev;
        u32 reg_eac, reg_eb4, reg_ebc;
        int result = 0;
 
@@ -910,14 +911,14 @@ static int rtl8192eu_iqk_path_b(struct rtl8xxxu_priv *priv)
            ((reg_ebc & 0x03ff0000) != 0x00420000))
                result |= 0x01;
        else
-               dev_warn(&priv->udev->dev, "%s: Path B IQK failed!\n",
-                        __func__);
+               dev_warn(dev, "%s: Path B IQK failed!\n", __func__);
 
        return result;
 }
 
 static int rtl8192eu_rx_iqk_path_b(struct rtl8xxxu_priv *priv)
 {
+       struct device *dev = &priv->udev->dev;
        u32 reg_eac, reg_eb4, reg_ebc, reg_ec4, reg_ecc, val32;
        int result = 0;
 
@@ -1040,8 +1041,7 @@ static int rtl8192eu_rx_iqk_path_b(struct rtl8xxxu_priv *priv)
            ((reg_ecc & 0x03ff0000) != 0x00360000))
                result |= 0x02;
        else
-               dev_warn(&priv->udev->dev, "%s: Path B RX IQK failed!\n",
-                        __func__);
+               dev_warn(dev, "%s: Path B RX IQK failed!\n", __func__);
 
 out:
        return result;
@@ -1495,6 +1495,7 @@ static int rtl8192eu_active_to_lps(struct rtl8xxxu_priv *priv)
 
 static int rtl8192eu_active_to_emu(struct rtl8xxxu_priv *priv)
 {
+       struct device *dev = &priv->udev->dev;
        u8 val8;
        int count, ret = 0;
 
@@ -1521,8 +1522,7 @@ static int rtl8192eu_active_to_emu(struct rtl8xxxu_priv *priv)
        }
 
        if (!count) {
-               dev_warn(&priv->udev->dev, "%s: Disabling MAC timed out\n",
-                        __func__);
+               dev_warn(dev, "%s: Disabling MAC timed out\n", __func__);
                ret = -EBUSY;
                goto exit;
        }
drivers/net/wireless/realtek/rtl8xxxu/8192f.c +6 -5
index 5f076da4b550..e1a10fe38b9a 100644
@@ -681,6 +681,7 @@ static void rtl8192fu_init_aggregation(struct rtl8xxxu_priv *priv)
 
 static int rtl8192fu_parse_efuse(struct rtl8xxxu_priv *priv)
 {
+       struct device *dev = &priv->udev->dev;
        struct rtl8192fu_efuse *efuse = &priv->efuse_wifi.efuse8192fu;
        int i;
 
@@ -731,7 +732,7 @@ static int rtl8192fu_parse_efuse(struct rtl8xxxu_priv *priv)
        priv->rfe_type = efuse->rfe_option & 0x1f;
 
        if (priv->rfe_type != 5 && priv->rfe_type != 1)
-               dev_warn(&priv->udev->dev,
+               dev_warn(dev,
                         "%s: RFE type %d was not tested. Please send an email to [email protected] about this.\n",
                         __func__, priv->rfe_type);
 
@@ -1022,6 +1023,7 @@ static int rtl8192fu_rx_iqk_path_a(struct rtl8xxxu_priv *priv)
 
 static int rtl8192fu_iqk_path_b(struct rtl8xxxu_priv *priv)
 {
+       struct device *dev = &priv->udev->dev;
        u32 reg_eac, reg_eb4, reg_ebc, val32;
        u32 rf_0x58_i, rf_0x58_q;
        u8 rfe = priv->rfe_type;
@@ -1109,14 +1111,14 @@ static int rtl8192fu_iqk_path_b(struct rtl8xxxu_priv *priv)
            ((reg_ebc & 0x03ff0000) != 0x00420000))
                result |= 0x01;
        else
-               dev_warn(&priv->udev->dev, "%s: Path B IQK failed!\n",
-                        __func__);
+               dev_warn(dev, "%s: Path B IQK failed!\n", __func__);
 
        return result;
 }
 
 static int rtl8192fu_rx_iqk_path_b(struct rtl8xxxu_priv *priv)
 {
+       struct device *dev = &priv->udev->dev;
        u32 reg_eac, reg_eb4, reg_ebc, reg_ec4, reg_ecc, val32;
        int result = 0;
        int ktime;
@@ -1246,8 +1248,7 @@ static int rtl8192fu_rx_iqk_path_b(struct rtl8xxxu_priv *priv)
            ((reg_ecc & 0x03ff0000) != 0x00360000))
                result |= 0x02;
        else
-               dev_warn(&priv->udev->dev, "%s: Path B RX IQK failed!\n",
-                        __func__);
+               dev_warn(dev, "%s: Path B RX IQK failed!\n", __func__);
 
        return result;
 }
drivers/net/wireless/realtek/rtl8xxxu/8723a.c +2 -2
index 18e038b82f49..a68e89c06cf1 100644
@@ -413,6 +413,7 @@ static int rtl8723au_power_on(struct rtl8xxxu_priv *priv)
 
 static int rtl8723au_active_to_emu(struct rtl8xxxu_priv *priv)
 {
+       struct device *dev = &priv->udev->dev;
        u8 val8;
        int count, ret = 0;
 
@@ -439,8 +440,7 @@ static int rtl8723au_active_to_emu(struct rtl8xxxu_priv *priv)
        }
 
        if (!count) {
-               dev_warn(&priv->udev->dev, "%s: Disabling MAC timed out\n",
-                        __func__);
+               dev_warn(dev, "%s: Disabling MAC timed out\n", __func__);
                ret = -EBUSY;
                goto exit;
        }
drivers/net/wireless/realtek/rtl8xxxu/8723b.c +2 -2
index 24c6d8ae76ec..2edcb6f34867 100644
@@ -1216,6 +1216,7 @@ static void rtl8723bu_phy_iq_calibrate(struct rtl8xxxu_priv *priv)
 
 static int rtl8723bu_active_to_emu(struct rtl8xxxu_priv *priv)
 {
+       struct device *dev = &priv->udev->dev;
        u8 val8;
        u16 val16;
        u32 val32;
@@ -1247,8 +1248,7 @@ static int rtl8723bu_active_to_emu(struct rtl8xxxu_priv *priv)
        }
 
        if (!count) {
-               dev_warn(&priv->udev->dev, "%s: Disabling MAC timed out\n",
-                        __func__);
+               dev_warn(dev, "%s: Disabling MAC timed out\n", __func__);
                ret = -EBUSY;
                goto exit;
        }
drivers/net/wireless/realtek/rtl8xxxu/core.c +17 -15
index bddbd0990de7..f36cfaa2442f 100644
@@ -2186,6 +2186,7 @@ void rtl8xxxu_firmware_self_reset(struct rtl8xxxu_priv *priv)
 static int
 rtl8xxxu_init_mac(struct rtl8xxxu_priv *priv)
 {
+       struct device *dev = &priv->udev->dev;
        const struct rtl8xxxu_reg8val *array = priv->fops->mactable;
        int i, ret;
        u16 reg;
@@ -2200,8 +2201,7 @@ rtl8xxxu_init_mac(struct rtl8xxxu_priv *priv)
 
                ret = rtl8xxxu_write8(priv, reg, val);
                if (ret != 1) {
-                       dev_warn(&priv->udev->dev,
-                                "Failed to initialize MAC "
+                       dev_warn(dev, "Failed to initialize MAC "
                                 "(reg: %04x, val %02x)\n", reg, val);
                        return -EAGAIN;
                }
@@ -2228,6 +2228,7 @@ rtl8xxxu_init_mac(struct rtl8xxxu_priv *priv)
 int rtl8xxxu_init_phy_regs(struct rtl8xxxu_priv *priv,
                           const struct rtl8xxxu_reg32val *array)
 {
+       struct device *dev = &priv->udev->dev;
        int i, ret;
        u16 reg;
        u32 val;
@@ -2241,8 +2242,7 @@ int rtl8xxxu_init_phy_regs(struct rtl8xxxu_priv *priv,
 
                ret = rtl8xxxu_write32(priv, reg, val);
                if (ret != sizeof(val)) {
-                       dev_warn(&priv->udev->dev,
-                                "Failed to initialize PHY\n");
+                       dev_warn(dev, "Failed to initialize PHY\n");
                        return -EAGAIN;
                }
                udelay(1);
@@ -2386,6 +2386,7 @@ static int rtl8xxxu_init_rf_regs(struct rtl8xxxu_priv *priv,
                                 const struct rtl8xxxu_rfregval *array,
                                 enum rtl8xxxu_rfpath path)
 {
+       struct device *dev = &priv->udev->dev;
        int i, ret;
        u8 reg;
        u32 val;
@@ -2420,8 +2421,7 @@ static int rtl8xxxu_init_rf_regs(struct rtl8xxxu_priv *priv,
 
                ret = rtl8xxxu_write_rfreg(priv, path, reg, val);
                if (ret) {
-                       dev_warn(&priv->udev->dev,
-                                "Failed to initialize RF\n");
+                       dev_warn(dev, "Failed to initialize RF\n");
                        return -EAGAIN;
                }
                udelay(1);
@@ -2557,6 +2557,7 @@ int rtl8xxxu_init_llt_table(struct rtl8xxxu_priv *priv)
 
 int rtl8xxxu_auto_llt_table(struct rtl8xxxu_priv *priv)
 {
+       struct device *dev = &priv->udev->dev;
        u32 val32;
        int ret = 0;
        int i;
@@ -2574,7 +2575,7 @@ int rtl8xxxu_auto_llt_table(struct rtl8xxxu_priv *priv)
 
        if (!i) {
                ret = -EBUSY;
-               dev_warn(&priv->udev->dev, "LLT table init failed\n");
+               dev_warn(dev, "LLT table init failed\n");
        }
 
        return ret;
@@ -3088,6 +3089,7 @@ void rtl8xxxu_mac_calibration(struct rtl8xxxu_priv *priv,
 
 static int rtl8xxxu_iqk_path_a(struct rtl8xxxu_priv *priv)
 {
+       struct device *dev = &priv->udev->dev;
        u32 reg_eac, reg_e94, reg_e9c, reg_ea4, val32;
        int result = 0;
 
@@ -3137,14 +3139,14 @@ static int rtl8xxxu_iqk_path_a(struct rtl8xxxu_priv *priv)
            ((reg_eac & 0x03ff0000) != 0x00360000))
                result |= 0x02;
        else
-               dev_warn(&priv->udev->dev, "%s: Path A RX IQK failed!\n",
-                        __func__);
+               dev_warn(dev, "%s: Path A RX IQK failed!\n", __func__);
 out:
        return result;
 }
 
 static int rtl8xxxu_iqk_path_b(struct rtl8xxxu_priv *priv)
 {
+       struct device *dev = &priv->udev->dev;
        u32 reg_eac, reg_eb4, reg_ebc, reg_ec4, reg_ecc;
        int result = 0;
 
@@ -3173,7 +3175,7 @@ static int rtl8xxxu_iqk_path_b(struct rtl8xxxu_priv *priv)
            (((reg_ecc & 0x03ff0000) >> 16) != 0x36))
                result |= 0x02;
        else
-               dev_warn(&priv->udev->dev, "%s: Path B RX IQK failed!\n",
+               dev_warn(dev, "%s: Path B RX IQK failed!\n",
                         __func__);
 out:
        return result;
@@ -3637,6 +3639,7 @@ static void rtl8xxxu_set_ampdu_min_space(struct rtl8xxxu_priv *priv, u8 density)
 
 int rtl8xxxu_active_to_lps(struct rtl8xxxu_priv *priv)
 {
+       struct device *dev = &priv->udev->dev;
        u8 val8;
        u8 val32;
        int count, ret = 0;
@@ -3654,8 +3657,7 @@ int rtl8xxxu_active_to_lps(struct rtl8xxxu_priv *priv)
        }
 
        if (!count) {
-               dev_warn(&priv->udev->dev,
-                        "%s: RX poll timed out (0x05f8)\n", __func__);
+               dev_warn(dev, "%s: RX poll timed out (0x05f8)\n", __func__);
                ret = -EBUSY;
                goto exit;
        }
@@ -5862,6 +5864,7 @@ static void rtl8xxxu_queue_rx_urb(struct rtl8xxxu_priv *priv,
 static void rtl8xxxu_rx_urb_work(struct work_struct *work)
 {
        struct rtl8xxxu_priv *priv;
+       struct device *dev;
        struct rtl8xxxu_rx_urb *rx_urb, *tmp;
        struct list_head local;
        struct sk_buff *skb;
@@ -5869,6 +5872,7 @@ static void rtl8xxxu_rx_urb_work(struct work_struct *work)
        int ret;
 
        priv = container_of(work, struct rtl8xxxu_priv, rx_urb_wq);
+       dev = &priv->udev->dev;
        INIT_LIST_HEAD(&local);
 
        spin_lock_irqsave(&priv->rx_urb_lock, flags);
@@ -5894,8 +5898,7 @@ static void rtl8xxxu_rx_urb_work(struct work_struct *work)
                        rtl8xxxu_queue_rx_urb(priv, rx_urb);
                        break;
                default:
-                       dev_warn(&priv->udev->dev,
-                                "failed to requeue urb with error %i\n", ret);
+                       dev_warn(dev, "failed to requeue urb with error %i\n", ret);
                        skb = (struct sk_buff *)rx_urb->urb.context;
                        dev_kfree_skb(skb);
                        usb_free_urb(&rx_urb->urb);
--

2.43.0