ldpaa_eth.c: Fix warning when PHYLIB is not enabled
PATCH 1/1 ldpaa_eth.c: Fix warning when PHYLIB is not enabled
We need to #ifdef some variables to avoid warning about them being unused.
--- drivers/net/ldpaa_eth/ldpaa_eth.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/ldpaa_eth/ldpaa_eth.c +7 -3
@@ -402,10 +402,12 @@ error:static int ldpaa_get_dpmac_state (struct ldpaa_eth_priv *priv,struct dpmac_link_state *state) { -struct phy_device *phydev =NULL ;phy_interface_t enet_if; -int phy_num, phys_detected; -int err; +int phys_detected; +#ifdef CONFIG_PHYLIB +struct phy_device *phydev =NULL ; +int err, phy_num; +#endif /* let's start off with maximum capabilities */ enet_if =wriop_get_enet_if (priv->dpmac_id);
@@ -590,8 +592,10 @@ static void ldpaa_eth_stop(struct eth_device *net_dev) {struct ldpaa_eth_priv *priv = (struct ldpaa_eth_priv *)net_dev->priv;int err =0 ; +#ifdef CONFIG_PHYLIB struct phy_device *phydev =NULL ;int phy_num; +#endif if ((net_dev->state ==ETH_STATE_PASSIVE ) || (net_dev->state ==ETH_STATE_INIT ))
Signature · 1 line
2.7.4
PATCH 1/1 ldpaa_eth.c: Fix warning when PHYLIB is not enabled
Quoted 20 lines · Tom Rini
We need to #ifdef some variables to avoid warning about them being unused.
Fixes 1a048cd65645 ("driver: net: fsl-mc: Add support of multiple phys for dpmac")Signed-off-by Tom Rini <[email protected]>---
drivers/net/ldpaa_eth/ldpaa_eth.c| 10 +++++++---1 file changed, 7 insertions(+), 3 deletions(-)drivers/net/ldpaa_eth/ldpaa_eth.c +0
-0@@ -402,10 +402,12 @@ error:static int ldpaa_get_dpmac_state (struct ldpaa_eth_priv *priv,struct dpmac_link_state *state)
drivers/net/ldpaa_eth/ldpaa_eth.c error: · line 410
Quoted 10 lines
drivers/net/ldpaa_eth/ldpaa_eth.c +5
-3{ -struct phy_device *phydev =NULL ;phy_interface_t enet_if; -int phy_num, phys_detected; -int err; +int phys_detected; +#ifdef CONFIG_PHYLIB +struct phy_device *phydev =NULL ; +int err, phy_num; +#endif
Reading this, I started to wonder whether we want to use __maybe_unused to suppress these warnings w/o having to add these #if defined(…) blocks?
The drawback is that GCC won’t warn about lingering unused variables is a ‘maybe’ unused becomes a permanently unused variable...
Quoted 21 lines
drivers/net/ldpaa_eth/ldpaa_eth.c +2
-0/* let's start off with maximum capabilities */ enet_if =wriop_get_enet_if (priv->dpmac_id);@@ -590,8 +592,10 @@ static void ldpaa_eth_stop(struct eth_device *net_dev) {struct ldpaa_eth_priv *priv = (struct ldpaa_eth_priv *)net_dev->priv;int err =0 ; +#ifdef CONFIG_PHYLIB struct phy_device *phydev =NULL ;int phy_num; +#endif if ((net_dev->state ==ETH_STATE_PASSIVE ) || (net_dev->state ==ETH_STATE_INIT ))Signature · 6 lines
2.7.4 _______________________________________________ U-Boot mailing list U-Boot at lists.denx.de https://lists.denx.de/listinfo/u-boot
PATCH 1/1 ldpaa_eth.c: Fix warning when PHYLIB is not enabled
Quoted 32 lines · Philipp Tomsich
Quoted 18 lines · Tom Rini
We need to #ifdef some variables to avoid warning about them being unused.
Fixes 1a048cd65645 ("driver: net: fsl-mc: Add support of multiple phys for dpmac")Signed-off-by Tom Rini <[email protected]>---
drivers/net/ldpaa_eth/ldpaa_eth.c| 10 +++++++---1 file changed, 7 insertions(+), 3 deletions(-)drivers/net/ldpaa_eth/ldpaa_eth.c +0
-0@@ -402,10 +402,12 @@ error:static int ldpaa_get_dpmac_state (struct ldpaa_eth_priv *priv,struct dpmac_link_state *state)drivers/net/ldpaa_eth/ldpaa_eth.c error: · line 410
Quoted 10 lines
drivers/net/ldpaa_eth/ldpaa_eth.c +5
-3{ -struct phy_device *phydev =NULL ;phy_interface_t enet_if; -int phy_num, phys_detected; -int err; +int phys_detected; +#ifdef CONFIG_PHYLIB +struct phy_device *phydev =NULL ; +int err, phy_num; +#endif Reading this, I started to wonder whether we want to use
__maybe_unusedto suppress these warnings w/o having to add these #if defined(…) blocks?
Quoted 2 lines
The drawback is that GCC won’t warn about lingering unused variables is a ‘maybe’ unused becomes a permanently unused variable...
Yeah, I'm not sure sometimes if __maybe_unused is cleaner looking or not. I think it depends on the number of things that are or aren't needing to get blocked off.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181012/1de1187b/attachment.sig>
PATCH 1/1 ldpaa_eth.c: Fix warning when PHYLIB is not enabled
In reply to Tom RiniQuoted 5 lines · Tom Rini
We need to #ifdef some variables to avoid warning about them being unused.
Fixes 1a048cd65645 ("driver: net: fsl-mc: Add support of multiple phys for dpmac")Signed-off-by Tom Rini <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20181012/5e1c49ef/attachment.sig>