netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] bgmac: Fix build error seen if BCM47XX is not configured
@ 2015-04-15 20:05 Guenter Roeck
  2015-04-15 20:21 ` Rafał Miłecki
  0 siblings, 1 reply; 4+ messages in thread
From: Guenter Roeck @ 2015-04-15 20:05 UTC (permalink / raw)
  To: David S. Miller
  Cc: netdev, linux-kernel, Guenter Roeck, Rafał Miłecki

arm:allmodconfig fails to build as follows since ARCH_BCM_5301X
is configured but not BCM47XX.

drivers/net/ethernet/broadcom/bgmac.c: In function 'bgmac_probe':
drivers/net/ethernet/broadcom/bgmac.c:1643:2: error:
		implicit declaration of function 'bcm47xx_nvram_getenv'

Fixes: fc300dc3733f ("bgmac: allow enabling on ARCH_BCM_5301X")
Cc: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
Seen in today's upstream kernel.

I don't like this fix too much (I think it is quite kludgy),
so I marked it RFC (and please don't beat the messenger ;-).

 drivers/net/ethernet/broadcom/bgmac.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bgmac.c b/drivers/net/ethernet/broadcom/bgmac.c
index 5cb93d1f50a4..dcf27a7c1836 100644
--- a/drivers/net/ethernet/broadcom/bgmac.c
+++ b/drivers/net/ethernet/broadcom/bgmac.c
@@ -17,8 +17,21 @@
 #include <linux/phy_fixed.h>
 #include <linux/interrupt.h>
 #include <linux/dma-mapping.h>
+
+#ifdef CONFIG_BCM47XX
 #include <bcm47xx_nvram.h>
 
+static int __bcm47xx_nvram_getenv(const char *name, char *val, size_t len)
+{
+	return bcm47xx_nvram_getenv(name, val, len);
+}
+#else
+static int __bcm47xx_nvram_getenv(const char *name, char *val, size_t len)
+{
+	return -ENOENT;
+}
+#endif
+
 static const struct bcma_device_id bgmac_bcma_tbl[] = {
 	BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_4706_MAC_GBIT, BCMA_ANY_REV, BCMA_ANY_CLASS),
 	BCMA_CORE(BCMA_MANUF_BCM, BCMA_CORE_MAC_GBIT, BCMA_ANY_REV, BCMA_ANY_CLASS),
@@ -1070,7 +1083,7 @@ static void bgmac_chip_reset(struct bgmac *bgmac)
 			     BGMAC_CHIPCTL_1_IF_TYPE_MII;
 		char buf[4];
 
-		if (bcm47xx_nvram_getenv("et_swtype", buf, sizeof(buf)) > 0) {
+		if (__bcm47xx_nvram_getenv("et_swtype", buf, sizeof(buf)) > 0) {
 			if (kstrtou8(buf, 0, &et_swtype))
 				bgmac_err(bgmac, "Failed to parse et_swtype (%s)\n",
 					  buf);
@@ -1635,7 +1648,7 @@ static int bgmac_probe(struct bcma_device *core)
 	}
 
 	bgmac->int_mask = BGMAC_IS_ERRMASK | BGMAC_IS_RX | BGMAC_IS_TX_MASK;
-	if (bcm47xx_nvram_getenv("et0_no_txint", NULL, 0) == 0)
+	if (__bcm47xx_nvram_getenv("et0_no_txint", NULL, 0) == 0)
 		bgmac->int_mask &= ~BGMAC_IS_TX_MASK;
 
 	/* TODO: reset the external phy. Specs are needed */
-- 
2.1.0

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

* Re: [RFC PATCH] bgmac: Fix build error seen if BCM47XX is not configured
  2015-04-15 20:05 [RFC PATCH] bgmac: Fix build error seen if BCM47XX is not configured Guenter Roeck
@ 2015-04-15 20:21 ` Rafał Miłecki
  2015-04-15 20:46   ` Guenter Roeck
  2015-04-15 21:18   ` David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: Rafał Miłecki @ 2015-04-15 20:21 UTC (permalink / raw)
  To: Guenter Roeck, Ralf Baechle
  Cc: David S. Miller, Network Development, Linux Kernel Mailing List,
	linux-mips@linux-mips.org

On 15 April 2015 at 22:05, Guenter Roeck <linux@roeck-us.net> wrote:
> arm:allmodconfig fails to build as follows since ARCH_BCM_5301X
> is configured but not BCM47XX.
>
> drivers/net/ethernet/broadcom/bgmac.c: In function 'bgmac_probe':
> drivers/net/ethernet/broadcom/bgmac.c:1643:2: error:
>                 implicit declaration of function 'bcm47xx_nvram_getenv'
>
> Fixes: fc300dc3733f ("bgmac: allow enabling on ARCH_BCM_5301X")
> Cc: Rafał Miłecki <zajec5@gmail.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> Seen in today's upstream kernel.
>
> I don't like this fix too much (I think it is quite kludgy),
> so I marked it RFC (and please don't beat the messenger ;-).

Ooh great, I totally forgot about this :|

The problem is that fc300dc (bgmac: allow enabling on ARCH_BCM_5301X)
[0] shouldn't really be sent (by me) in the first place. This is
because it depends on 138173d (MIPS: BCM47xx: Move NVRAM header to the
include/linux/.) [1] which isn't in Linus's tree yet.

So there are two solutions:
1) Revert fc300dc, wait for 138173d and re-apply fc300dc
2) Wait for 138173d with this build breakage

I guess the decisions depends on
a) time needed for David to revert fc300dc & send pull request
vs.
b) time needed for Ralf to send pull request

David, Ralf, what do you think about this?

Sorry for causing this problem :|

[0] http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=fc300dc3733fdc328e6e10c7b8379b60c26cd648
[1] http://git.linux-mips.org/cgit/ralf/upstream-sfr.git/commit/?id=138173d4e826587da66c7d321da1a91283222536

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

* Re: [RFC PATCH] bgmac: Fix build error seen if BCM47XX is not configured
  2015-04-15 20:21 ` Rafał Miłecki
@ 2015-04-15 20:46   ` Guenter Roeck
  2015-04-15 21:18   ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2015-04-15 20:46 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: Ralf Baechle, David S. Miller, Network Development,
	Linux Kernel Mailing List, linux-mips@linux-mips.org

On Wed, Apr 15, 2015 at 10:21:49PM +0200, Rafał Miłecki wrote:
> On 15 April 2015 at 22:05, Guenter Roeck <linux@roeck-us.net> wrote:
> > arm:allmodconfig fails to build as follows since ARCH_BCM_5301X
> > is configured but not BCM47XX.
> >
> > drivers/net/ethernet/broadcom/bgmac.c: In function 'bgmac_probe':
> > drivers/net/ethernet/broadcom/bgmac.c:1643:2: error:
> >                 implicit declaration of function 'bcm47xx_nvram_getenv'
> >
> > Fixes: fc300dc3733f ("bgmac: allow enabling on ARCH_BCM_5301X")
> > Cc: Rafał Miłecki <zajec5@gmail.com>
> > Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> > ---
> > Seen in today's upstream kernel.
> >
> > I don't like this fix too much (I think it is quite kludgy),
> > so I marked it RFC (and please don't beat the messenger ;-).
> 
> Ooh great, I totally forgot about this :|
> 
> The problem is that fc300dc (bgmac: allow enabling on ARCH_BCM_5301X)
> [0] shouldn't really be sent (by me) in the first place. This is
> because it depends on 138173d (MIPS: BCM47xx: Move NVRAM header to the
> include/linux/.) [1] which isn't in Linus's tree yet.
> 
> So there are two solutions:
> 1) Revert fc300dc, wait for 138173d and re-apply fc300dc
> 2) Wait for 138173d with this build breakage
> 
> I guess the decisions depends on
> a) time needed for David to revert fc300dc & send pull request
> vs.
> b) time needed for Ralf to send pull request
> 
> David, Ralf, what do you think about this?
> 

Since the fix is in the queue, maybe we can live with the breakage
for a few days ? Your solution is definitely _much_ better than my hack.

Guenter

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

* Re: [RFC PATCH] bgmac: Fix build error seen if BCM47XX is not configured
  2015-04-15 20:21 ` Rafał Miłecki
  2015-04-15 20:46   ` Guenter Roeck
@ 2015-04-15 21:18   ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2015-04-15 21:18 UTC (permalink / raw)
  To: zajec5; +Cc: linux, ralf, netdev, linux-kernel, linux-mips

From: Rafał Miłecki <zajec5@gmail.com>
Date: Wed, 15 Apr 2015 22:21:49 +0200

> I guess the decisions depends on
> a) time needed for David to revert fc300dc & send pull request
> vs.
> b) time needed for Ralf to send pull request

Let's just wait for Ralf's stuff to hit Linus's tree.

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

end of thread, other threads:[~2015-04-15 21:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-15 20:05 [RFC PATCH] bgmac: Fix build error seen if BCM47XX is not configured Guenter Roeck
2015-04-15 20:21 ` Rafał Miłecki
2015-04-15 20:46   ` Guenter Roeck
2015-04-15 21:18   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).