Skip to content

Commit 6ea6865

Browse files
committed
drivers: ethernet: phy: vsc8541: fixed build warnings
Fixed some build warnings in the driver from previous changes by removing an unused variable and hooking up the cfg_link function. Also removes some implicit boolean conversions. Signed-off-by: Robert Hancock <robert.hancock@calian.com>
1 parent c5fe7be commit 6ea6865

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/ethernet/phy/phy_microchip_vsc8541.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,14 @@ static int phy_mc_vsc8541_get_speed(const struct device *dev, struct phy_link_st
230230
return ret;
231231
}
232232

233-
is_duplex = (aux_status & PHY_REG_PAGE0_EXT_DEV_AUX_DUPLEX) != 0;
233+
is_duplex = (aux_status & PHY_REG_PAGE0_EXT_DEV_AUX_DUPLEX) != 0U;
234234

235235
ret = phy_mc_vsc8541_read(dev, PHY_REG_PAGE0_STAT1000_EXT2, &link1000_status);
236236
if (ret < 0) {
237237
return ret;
238238
}
239239

240-
if ((link1000_status & BIT(12))) {
240+
if ((link1000_status & BIT(12)) != 0U) {
241241
state->speed = is_duplex ? LINK_FULL_1000BASE : LINK_HALF_1000BASE;
242242
return 0; /* no need to check lower speeds */
243243
}
@@ -247,7 +247,7 @@ static int phy_mc_vsc8541_get_speed(const struct device *dev, struct phy_link_st
247247
return ret;
248248
}
249249

250-
if (link100_status & BIT(12)) {
250+
if ((link100_status & BIT(12)) != 0U) {
251251
state->speed = is_duplex ? LINK_FULL_100BASE : LINK_HALF_100BASE;
252252
return 0; /* no need to check lower speeds */
253253
}
@@ -257,7 +257,7 @@ static int phy_mc_vsc8541_get_speed(const struct device *dev, struct phy_link_st
257257
return ret;
258258
}
259259

260-
if (link10_status & BIT(6)) {
260+
if ((link10_status & BIT(6)) != 0U) {
261261
state->speed = is_duplex ? LINK_FULL_10BASE : LINK_HALF_10BASE;
262262
} else {
263263
state->speed = 0; /* no link */
@@ -269,7 +269,7 @@ static int phy_mc_vsc8541_get_speed(const struct device *dev, struct phy_link_st
269269
static int phy_mc_vsc8541_cfg_link(const struct device *dev, enum phy_link_speed adv_speeds,
270270
enum phy_cfg_link_flag flags)
271271
{
272-
if (flags & PHY_FLAG_AUTO_NEGOTIATION_DISABLED) {
272+
if ((flags & PHY_FLAG_AUTO_NEGOTIATION_DISABLED) != 0U) {
273273
LOG_ERR("Disabling auto-negotiation is not supported by this driver");
274274
return -ENOTSUP;
275275
}
@@ -284,7 +284,6 @@ static int phy_mc_vsc8541_cfg_link(const struct device *dev, enum phy_link_speed
284284
static int phy_mc_vsc8541_init(const struct device *dev)
285285
{
286286
struct mc_vsc8541_data *data = dev->data;
287-
struct mc_vsc8541_config *cfg = dev->config;
288287
int ret;
289288

290289
data->active_page = -1;
@@ -335,7 +334,7 @@ static int phy_mc_vsc8541_get_link(const struct device *dev, struct phy_link_sta
335334

336335
hasLink = (reg_sr & MII_BMSR_LINK_STATUS) != 0;
337336

338-
if (reg_cr & MII_BMCR_AUTONEG_ENABLE) {
337+
if ((reg_cr & MII_BMCR_AUTONEG_ENABLE) != 0U) {
339338
/* auto negotiation active; update status */
340339
auto_negotiation_finished = (reg_sr & MII_BMSR_AUTONEG_COMPLETE) != 0;
341340
}
@@ -489,6 +488,7 @@ static int phy_mc_vsc8541_write(const struct device *dev, uint16_t reg_addr, uin
489488

490489
static DEVICE_API(ethphy, mc_vsc8541_phy_api) = {
491490
.get_link = phy_mc_vsc8541_get_link,
491+
.cfg_link = phy_mc_vsc8541_cfg_link,
492492
.link_cb_set = phy_mc_vsc8541_link_cb_set,
493493
.read = phy_mc_vsc8541_read,
494494
.write = phy_mc_vsc8541_write,

0 commit comments

Comments
 (0)