All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: stmmac: Fix stmmac_mdio_reset() when building stmmac as modules
@ 2018-10-31 15:08 ` Niklas Cassel
  0 siblings, 0 replies; 4+ messages in thread
From: Niklas Cassel @ 2018-10-31 15:08 UTC (permalink / raw)
  To: Giuseppe Cavallaro, Alexandre Torgue, Jose Abreu,
	David S. Miller, Maxime Coquelin
  Cc: vkoul, Niklas Cassel, netdev, linux-stm32, linux-arm-kernel,
	linux-kernel

When building stmmac, it is only possible to select CONFIG_DWMAC_GENERIC,
or any of the glue drivers, when CONFIG_STMMAC_PLATFORM is set.
The only exception is CONFIG_STMMAC_PCI.

When calling of_mdiobus_register(), it will call our ->reset()
callback, which is set to stmmac_mdio_reset().

Most of the code in stmmac_mdio_reset() is protected by a
"#if defined(CONFIG_STMMAC_PLATFORM)", which will evaluate
to false when CONFIG_STMMAC_PLATFORM=m.

Because of this, the phy reset gpio will only be pulled when
stmmac is built as built-in, but not when built as modules.

Fix this by using "#if IS_ENABLED()" instead of "#if defined()".

Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index b72ef171477e..bdd351597b55 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -243,7 +243,7 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
  */
 int stmmac_mdio_reset(struct mii_bus *bus)
 {
-#if defined(CONFIG_STMMAC_PLATFORM)
+#if IS_ENABLED(CONFIG_STMMAC_PLATFORM)
 	struct net_device *ndev = bus->priv;
 	struct stmmac_priv *priv = netdev_priv(ndev);
 	unsigned int mii_address = priv->hw->mii.addr;
-- 
2.17.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] net: stmmac: Fix stmmac_mdio_reset() when building stmmac as modules
@ 2018-10-31 15:08 ` Niklas Cassel
  0 siblings, 0 replies; 4+ messages in thread
From: Niklas Cassel @ 2018-10-31 15:08 UTC (permalink / raw)
  To: linux-arm-kernel

When building stmmac, it is only possible to select CONFIG_DWMAC_GENERIC,
or any of the glue drivers, when CONFIG_STMMAC_PLATFORM is set.
The only exception is CONFIG_STMMAC_PCI.

When calling of_mdiobus_register(), it will call our ->reset()
callback, which is set to stmmac_mdio_reset().

Most of the code in stmmac_mdio_reset() is protected by a
"#if defined(CONFIG_STMMAC_PLATFORM)", which will evaluate
to false when CONFIG_STMMAC_PLATFORM=m.

Because of this, the phy reset gpio will only be pulled when
stmmac is built as built-in, but not when built as modules.

Fix this by using "#if IS_ENABLED()" instead of "#if defined()".

Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
---
 drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index b72ef171477e..bdd351597b55 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -243,7 +243,7 @@ static int stmmac_mdio_write(struct mii_bus *bus, int phyaddr, int phyreg,
  */
 int stmmac_mdio_reset(struct mii_bus *bus)
 {
-#if defined(CONFIG_STMMAC_PLATFORM)
+#if IS_ENABLED(CONFIG_STMMAC_PLATFORM)
 	struct net_device *ndev = bus->priv;
 	struct stmmac_priv *priv = netdev_priv(ndev);
 	unsigned int mii_address = priv->hw->mii.addr;
-- 
2.17.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] net: stmmac: Fix stmmac_mdio_reset() when building stmmac as modules
  2018-10-31 15:08 ` Niklas Cassel
@ 2018-11-01  1:36   ` David Miller
  -1 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2018-11-01  1:36 UTC (permalink / raw)
  To: niklas.cassel
  Cc: peppe.cavallaro, alexandre.torgue, joabreu, mcoquelin.stm32,
	vkoul, netdev, linux-stm32, linux-arm-kernel, linux-kernel

From: Niklas Cassel <niklas.cassel@linaro.org>
Date: Wed, 31 Oct 2018 16:08:10 +0100

> When building stmmac, it is only possible to select CONFIG_DWMAC_GENERIC,
> or any of the glue drivers, when CONFIG_STMMAC_PLATFORM is set.
> The only exception is CONFIG_STMMAC_PCI.
> 
> When calling of_mdiobus_register(), it will call our ->reset()
> callback, which is set to stmmac_mdio_reset().
> 
> Most of the code in stmmac_mdio_reset() is protected by a
> "#if defined(CONFIG_STMMAC_PLATFORM)", which will evaluate
> to false when CONFIG_STMMAC_PLATFORM=m.
> 
> Because of this, the phy reset gpio will only be pulled when
> stmmac is built as built-in, but not when built as modules.
> 
> Fix this by using "#if IS_ENABLED()" instead of "#if defined()".
> 
> Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>

Applied and queued up for -stable, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] net: stmmac: Fix stmmac_mdio_reset() when building stmmac as modules
@ 2018-11-01  1:36   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2018-11-01  1:36 UTC (permalink / raw)
  To: linux-arm-kernel

From: Niklas Cassel <niklas.cassel@linaro.org>
Date: Wed, 31 Oct 2018 16:08:10 +0100

> When building stmmac, it is only possible to select CONFIG_DWMAC_GENERIC,
> or any of the glue drivers, when CONFIG_STMMAC_PLATFORM is set.
> The only exception is CONFIG_STMMAC_PCI.
> 
> When calling of_mdiobus_register(), it will call our ->reset()
> callback, which is set to stmmac_mdio_reset().
> 
> Most of the code in stmmac_mdio_reset() is protected by a
> "#if defined(CONFIG_STMMAC_PLATFORM)", which will evaluate
> to false when CONFIG_STMMAC_PLATFORM=m.
> 
> Because of this, the phy reset gpio will only be pulled when
> stmmac is built as built-in, but not when built as modules.
> 
> Fix this by using "#if IS_ENABLED()" instead of "#if defined()".
> 
> Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>

Applied and queued up for -stable, thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-11-01  1:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-31 15:08 [PATCH] net: stmmac: Fix stmmac_mdio_reset() when building stmmac as modules Niklas Cassel
2018-10-31 15:08 ` Niklas Cassel
2018-11-01  1:36 ` David Miller
2018-11-01  1:36   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.