Skip to content

Commit ab2a605

Browse files
lunndavem330
authored andcommitted
net: phy: Add phydev_warn()
Not all new style LINK_MODE bits can be converted into old style SUPPORTED bits. We need to warn when such a conversion is attempted. Add a helper for this. Convert all pr_warn() calls to phydev_warn() where possible. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent b31cdff commit ab2a605

File tree

6 files changed

+29
-24
lines changed

6 files changed

+29
-24
lines changed

drivers/net/phy/at803x.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ static int at803x_aneg_done(struct phy_device *phydev)
357357

358358
/* check if the SGMII link is OK. */
359359
if (!(phy_read(phydev, AT803X_PSSR) & AT803X_PSSR_MR_AN_COMPLETE)) {
360-
pr_warn("803x_aneg_done: SGMII link is not ok\n");
360+
phydev_warn(phydev, "803x_aneg_done: SGMII link is not ok\n");
361361
aneg_done = 0;
362362
}
363363
/* switch back to copper page */

drivers/net/phy/dp83640.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -553,16 +553,17 @@ static void enable_status_frames(struct phy_device *phydev, bool on)
553553
mutex_unlock(&clock->extreg_lock);
554554

555555
if (!phydev->attached_dev) {
556-
pr_warn("expected to find an attached netdevice\n");
556+
phydev_warn(phydev,
557+
"expected to find an attached netdevice\n");
557558
return;
558559
}
559560

560561
if (on) {
561562
if (dev_mc_add(phydev->attached_dev, status_frame_dst))
562-
pr_warn("failed to add mc address\n");
563+
phydev_warn(phydev, "failed to add mc address\n");
563564
} else {
564565
if (dev_mc_del(phydev->attached_dev, status_frame_dst))
565-
pr_warn("failed to delete mc address\n");
566+
phydev_warn(phydev, "failed to delete mc address\n");
566567
}
567568
}
568569

drivers/net/phy/marvell.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ static void marvell_config_led(struct phy_device *phydev)
638638
err = phy_write_paged(phydev, MII_MARVELL_LED_PAGE, MII_PHY_LED_CTRL,
639639
def_config);
640640
if (err < 0)
641-
pr_warn("Fail to config marvell phy LED.\n");
641+
phydev_warn(phydev, "Fail to config marvell phy LED.\n");
642642
}
643643

644644
static int marvell_config_init(struct phy_device *phydev)

drivers/net/phy/marvell10g.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,9 @@ static int mv3310_config_init(struct phy_device *phydev)
337337
}
338338

339339
if (!ethtool_convert_link_mode_to_legacy_u32(&mask, supported))
340-
dev_warn(&phydev->mdio.dev,
341-
"PHY supports (%*pb) more modes than phylib supports, some modes not supported.\n",
342-
__ETHTOOL_LINK_MODE_MASK_NBITS, supported);
340+
phydev_warn(phydev,
341+
"PHY supports (%*pb) more modes than phylib supports, some modes not supported.\n",
342+
__ETHTOOL_LINK_MODE_MASK_NBITS, supported);
343343

344344
phydev->supported &= mask;
345345
phydev->advertising &= phydev->supported;

drivers/net/phy/microchip.c

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ static int lan88xx_TR_reg_set(struct phy_device *phydev, u16 regaddr,
8888
/* Save current page */
8989
save_page = phy_save_page(phydev);
9090
if (save_page < 0) {
91-
pr_warn("Failed to get current page\n");
91+
phydev_warn(phydev, "Failed to get current page\n");
9292
goto err;
9393
}
9494

@@ -98,14 +98,14 @@ static int lan88xx_TR_reg_set(struct phy_device *phydev, u16 regaddr,
9898
ret = __phy_write(phydev, LAN88XX_EXT_PAGE_TR_LOW_DATA,
9999
(data & 0xFFFF));
100100
if (ret < 0) {
101-
pr_warn("Failed to write TR low data\n");
101+
phydev_warn(phydev, "Failed to write TR low data\n");
102102
goto err;
103103
}
104104

105105
ret = __phy_write(phydev, LAN88XX_EXT_PAGE_TR_HIGH_DATA,
106106
(data & 0x00FF0000) >> 16);
107107
if (ret < 0) {
108-
pr_warn("Failed to write TR high data\n");
108+
phydev_warn(phydev, "Failed to write TR high data\n");
109109
goto err;
110110
}
111111

@@ -115,14 +115,15 @@ static int lan88xx_TR_reg_set(struct phy_device *phydev, u16 regaddr,
115115

116116
ret = __phy_write(phydev, LAN88XX_EXT_PAGE_TR_CR, buf);
117117
if (ret < 0) {
118-
pr_warn("Failed to write data in reg\n");
118+
phydev_warn(phydev, "Failed to write data in reg\n");
119119
goto err;
120120
}
121121

122122
usleep_range(1000, 2000);/* Wait for Data to be written */
123123
val = __phy_read(phydev, LAN88XX_EXT_PAGE_TR_CR);
124124
if (!(val & 0x8000))
125-
pr_warn("TR Register[0x%X] configuration failed\n", regaddr);
125+
phydev_warn(phydev, "TR Register[0x%X] configuration failed\n",
126+
regaddr);
126127
err:
127128
return phy_restore_page(phydev, save_page, ret);
128129
}
@@ -137,23 +138,23 @@ static void lan88xx_config_TR_regs(struct phy_device *phydev)
137138
*/
138139
err = lan88xx_TR_reg_set(phydev, 0x0F82, 0x12B00A);
139140
if (err < 0)
140-
pr_warn("Failed to Set Register[0x0F82]\n");
141+
phydev_warn(phydev, "Failed to Set Register[0x0F82]\n");
141142

142143
/* Get access to Channel b'10, Node b'1101, Register 0x06.
143144
* Write 24-bit value 0xD2C46F to register. Setting SSTrKf1000Slv,
144145
* SSTrKp1000Mas bits.
145146
*/
146147
err = lan88xx_TR_reg_set(phydev, 0x168C, 0xD2C46F);
147148
if (err < 0)
148-
pr_warn("Failed to Set Register[0x168C]\n");
149+
phydev_warn(phydev, "Failed to Set Register[0x168C]\n");
149150

150151
/* Get access to Channel b'10, Node b'1111, Register 0x11.
151152
* Write 24-bit value 0x620 to register. Setting rem_upd_done_thresh
152153
* bits
153154
*/
154155
err = lan88xx_TR_reg_set(phydev, 0x17A2, 0x620);
155156
if (err < 0)
156-
pr_warn("Failed to Set Register[0x17A2]\n");
157+
phydev_warn(phydev, "Failed to Set Register[0x17A2]\n");
157158

158159
/* Get access to Channel b'10, Node b'1101, Register 0x10.
159160
* Write 24-bit value 0xEEFFDD to register. Setting
@@ -162,31 +163,31 @@ static void lan88xx_config_TR_regs(struct phy_device *phydev)
162163
*/
163164
err = lan88xx_TR_reg_set(phydev, 0x16A0, 0xEEFFDD);
164165
if (err < 0)
165-
pr_warn("Failed to Set Register[0x16A0]\n");
166+
phydev_warn(phydev, "Failed to Set Register[0x16A0]\n");
166167

167168
/* Get access to Channel b'10, Node b'1101, Register 0x13.
168169
* Write 24-bit value 0x071448 to register. Setting
169170
* slv_lpi_tr_tmr_val1, slv_lpi_tr_tmr_val2 bits.
170171
*/
171172
err = lan88xx_TR_reg_set(phydev, 0x16A6, 0x071448);
172173
if (err < 0)
173-
pr_warn("Failed to Set Register[0x16A6]\n");
174+
phydev_warn(phydev, "Failed to Set Register[0x16A6]\n");
174175

175176
/* Get access to Channel b'10, Node b'1101, Register 0x12.
176177
* Write 24-bit value 0x13132F to register. Setting
177178
* slv_sigdet_timer_val1, slv_sigdet_timer_val2 bits.
178179
*/
179180
err = lan88xx_TR_reg_set(phydev, 0x16A4, 0x13132F);
180181
if (err < 0)
181-
pr_warn("Failed to Set Register[0x16A4]\n");
182+
phydev_warn(phydev, "Failed to Set Register[0x16A4]\n");
182183

183184
/* Get access to Channel b'10, Node b'1101, Register 0x14.
184185
* Write 24-bit value 0x0 to register. Setting eee_3level_delay,
185186
* eee_TrKf_freeze_delay bits.
186187
*/
187188
err = lan88xx_TR_reg_set(phydev, 0x16A8, 0x0);
188189
if (err < 0)
189-
pr_warn("Failed to Set Register[0x16A8]\n");
190+
phydev_warn(phydev, "Failed to Set Register[0x16A8]\n");
190191

191192
/* Get access to Channel b'01, Node b'1111, Register 0x34.
192193
* Write 24-bit value 0x91B06C to register. Setting
@@ -195,7 +196,7 @@ static void lan88xx_config_TR_regs(struct phy_device *phydev)
195196
*/
196197
err = lan88xx_TR_reg_set(phydev, 0x0FE8, 0x91B06C);
197198
if (err < 0)
198-
pr_warn("Failed to Set Register[0x0FE8]\n");
199+
phydev_warn(phydev, "Failed to Set Register[0x0FE8]\n");
199200

200201
/* Get access to Channel b'01, Node b'1111, Register 0x3E.
201202
* Write 24-bit value 0xC0A028 to register. Setting
@@ -204,7 +205,7 @@ static void lan88xx_config_TR_regs(struct phy_device *phydev)
204205
*/
205206
err = lan88xx_TR_reg_set(phydev, 0x0FFC, 0xC0A028);
206207
if (err < 0)
207-
pr_warn("Failed to Set Register[0x0FFC]\n");
208+
phydev_warn(phydev, "Failed to Set Register[0x0FFC]\n");
208209

209210
/* Get access to Channel b'01, Node b'1111, Register 0x35.
210211
* Write 24-bit value 0x041600 to register. Setting
@@ -213,14 +214,14 @@ static void lan88xx_config_TR_regs(struct phy_device *phydev)
213214
*/
214215
err = lan88xx_TR_reg_set(phydev, 0x0FEA, 0x041600);
215216
if (err < 0)
216-
pr_warn("Failed to Set Register[0x0FEA]\n");
217+
phydev_warn(phydev, "Failed to Set Register[0x0FEA]\n");
217218

218219
/* Get access to Channel b'10, Node b'1101, Register 0x03.
219220
* Write 24-bit value 0x000004 to register. Setting TrFreeze bits.
220221
*/
221222
err = lan88xx_TR_reg_set(phydev, 0x1686, 0x000004);
222223
if (err < 0)
223-
pr_warn("Failed to Set Register[0x1686]\n");
224+
phydev_warn(phydev, "Failed to Set Register[0x1686]\n");
224225
}
225226

226227
static int lan88xx_probe(struct phy_device *phydev)

include/linux/phy.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -968,6 +968,9 @@ static inline void phy_device_reset(struct phy_device *phydev, int value)
968968
#define phydev_err(_phydev, format, args...) \
969969
dev_err(&_phydev->mdio.dev, format, ##args)
970970

971+
#define phydev_warn(_phydev, format, args...) \
972+
dev_warn(&_phydev->mdio.dev, format, ##args)
973+
971974
#define phydev_dbg(_phydev, format, args...) \
972975
dev_dbg(&_phydev->mdio.dev, format, ##args)
973976

0 commit comments

Comments
 (0)