aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/broadcom
diff options
context:
space:
mode:
authorPaul Gortmaker <paul.gortmaker@windriver.com>2012-10-01 11:43:49 -0400
committerDavid S. Miller <davem@davemloft.net>2012-10-01 18:07:39 -0400
commitde0a41484c47d783dd4d442914815076aa2caac2 (patch)
treeb789a2930a3d4e3c1cfc555ec082d812453feea5 /drivers/net/ethernet/broadcom
parentd4e62648274857a2b3a5bc62f910c062e71b2d9b (diff)
tg3: unconditionally select HWMON support when tg3 is enabled.
There is the seldom used corner case where HWMON=m at the same time as TIGON3=y (typically randconfigs) which will cause a link fail like: drivers/built-in.o: In function `tg3_close': tg3.c:(.text+0x16bd86): undefined reference to `hwmon_device_unregister' drivers/built-in.o: In function `tg3_hwmon_open': tg3.c:(.text+0x16fc4b): undefined reference to `hwmon_device_register' make[1]: *** [vmlinux] Error 1 Fix it as suggested by DaveM[1] by having the Kconfig logic simply select HWMON when TIGON3 is selected. This gets rid of all the extra IS_ENABLED ifdeffery in tg3.c as a side benefit. [1] http://marc.info/?l=linux-netdev&m=134250573718151&w=2 Cc: Michael Chan <mchan@broadcom.com> Reported-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Reported-by: Anisse Astier <anisse@astier.eu> Suggested-by: David S. Miller <davem@davemloft.net> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom')
-rw-r--r--drivers/net/ethernet/broadcom/Kconfig1
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c9
2 files changed, 1 insertions, 9 deletions
diff --git a/drivers/net/ethernet/broadcom/Kconfig b/drivers/net/ethernet/broadcom/Kconfig
index f15e72e81ac4..4bd416b72e65 100644
--- a/drivers/net/ethernet/broadcom/Kconfig
+++ b/drivers/net/ethernet/broadcom/Kconfig
@@ -101,6 +101,7 @@ config TIGON3
101 tristate "Broadcom Tigon3 support" 101 tristate "Broadcom Tigon3 support"
102 depends on PCI 102 depends on PCI
103 select PHYLIB 103 select PHYLIB
104 select HWMON
104 ---help--- 105 ---help---
105 This driver supports Broadcom Tigon3 based gigabit Ethernet cards. 106 This driver supports Broadcom Tigon3 based gigabit Ethernet cards.
106 107
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 24f6623c82ab..008ea14b638e 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -44,10 +44,8 @@
44#include <linux/prefetch.h> 44#include <linux/prefetch.h>
45#include <linux/dma-mapping.h> 45#include <linux/dma-mapping.h>
46#include <linux/firmware.h> 46#include <linux/firmware.h>
47#if IS_ENABLED(CONFIG_HWMON)
48#include <linux/hwmon.h> 47#include <linux/hwmon.h>
49#include <linux/hwmon-sysfs.h> 48#include <linux/hwmon-sysfs.h>
50#endif
51 49
52#include <net/checksum.h> 50#include <net/checksum.h>
53#include <net/ip.h> 51#include <net/ip.h>
@@ -9594,7 +9592,6 @@ static int tg3_init_hw(struct tg3 *tp, int reset_phy)
9594 return tg3_reset_hw(tp, reset_phy); 9592 return tg3_reset_hw(tp, reset_phy);
9595} 9593}
9596 9594
9597#if IS_ENABLED(CONFIG_HWMON)
9598static void tg3_sd_scan_scratchpad(struct tg3 *tp, struct tg3_ocir *ocir) 9595static void tg3_sd_scan_scratchpad(struct tg3 *tp, struct tg3_ocir *ocir)
9599{ 9596{
9600 int i; 9597 int i;
@@ -9647,22 +9644,17 @@ static const struct attribute_group tg3_group = {
9647 .attrs = tg3_attributes, 9644 .attrs = tg3_attributes,
9648}; 9645};
9649 9646
9650#endif
9651
9652static void tg3_hwmon_close(struct tg3 *tp) 9647static void tg3_hwmon_close(struct tg3 *tp)
9653{ 9648{
9654#if IS_ENABLED(CONFIG_HWMON)
9655 if (tp->hwmon_dev) { 9649 if (tp->hwmon_dev) {
9656 hwmon_device_unregister(tp->hwmon_dev); 9650 hwmon_device_unregister(tp->hwmon_dev);
9657 tp->hwmon_dev = NULL; 9651 tp->hwmon_dev = NULL;
9658 sysfs_remove_group(&tp->pdev->dev.kobj, &tg3_group); 9652 sysfs_remove_group(&tp->pdev->dev.kobj, &tg3_group);
9659 } 9653 }
9660#endif
9661} 9654}
9662 9655
9663static void tg3_hwmon_open(struct tg3 *tp) 9656static void tg3_hwmon_open(struct tg3 *tp)
9664{ 9657{
9665#if IS_ENABLED(CONFIG_HWMON)
9666 int i, err; 9658 int i, err;
9667 u32 size = 0; 9659 u32 size = 0;
9668 struct pci_dev *pdev = tp->pdev; 9660 struct pci_dev *pdev = tp->pdev;
@@ -9694,7 +9686,6 @@ static void tg3_hwmon_open(struct tg3 *tp)
9694 dev_err(&pdev->dev, "Cannot register hwmon device, aborting\n"); 9686 dev_err(&pdev->dev, "Cannot register hwmon device, aborting\n");
9695 sysfs_remove_group(&pdev->dev.kobj, &tg3_group); 9687 sysfs_remove_group(&pdev->dev.kobj, &tg3_group);
9696 } 9688 }
9697#endif
9698} 9689}
9699 9690
9700 9691