1 From de0a41484c47d783dd4d442914815076aa2caac2 Mon Sep 17 00:00:00 2001
2 From: Paul Gortmaker <paul.gortmaker@windriver.com>
3 Date: Mon, 1 Oct 2012 11:43:49 -0400
4 Subject: tg3: unconditionally select HWMON support when tg3 is enabled.
6 From: Paul Gortmaker <paul.gortmaker@windriver.com>
8 commit de0a41484c47d783dd4d442914815076aa2caac2 upstream.
10 There is the seldom used corner case where HWMON=m at the same
11 time as TIGON3=y (typically randconfigs) which will cause a link
14 drivers/built-in.o: In function `tg3_close':
15 tg3.c:(.text+0x16bd86): undefined reference to `hwmon_device_unregister'
16 drivers/built-in.o: In function `tg3_hwmon_open':
17 tg3.c:(.text+0x16fc4b): undefined reference to `hwmon_device_register'
18 make[1]: *** [vmlinux] Error 1
20 Fix it as suggested by DaveM[1] by having the Kconfig logic simply
21 select HWMON when TIGON3 is selected. This gets rid of all the
22 extra IS_ENABLED ifdeffery in tg3.c as a side benefit.
24 [1] http://marc.info/?l=linux-netdev&m=134250573718151&w=2
26 Reported-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
27 Cc: Michael Chan <mchan@broadcom.com>
28 Reported-by: Anisse Astier <anisse@astier.eu>
29 Suggested-by: David S. Miller <davem@davemloft.net>
30 Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
31 Signed-off-by: David S. Miller <davem@davemloft.net>
32 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
35 drivers/net/ethernet/broadcom/Kconfig | 1 +
36 drivers/net/ethernet/broadcom/tg3.c | 9 ---------
37 2 files changed, 1 insertion(+), 9 deletions(-)
39 --- a/drivers/net/ethernet/broadcom/Kconfig
40 +++ b/drivers/net/ethernet/broadcom/Kconfig
41 @@ -101,6 +101,7 @@ config TIGON3
42 tristate "Broadcom Tigon3 support"
47 This driver supports Broadcom Tigon3 based gigabit Ethernet cards.
49 --- a/drivers/net/ethernet/broadcom/tg3.c
50 +++ b/drivers/net/ethernet/broadcom/tg3.c
52 #include <linux/prefetch.h>
53 #include <linux/dma-mapping.h>
54 #include <linux/firmware.h>
55 -#if IS_ENABLED(CONFIG_HWMON)
56 #include <linux/hwmon.h>
57 #include <linux/hwmon-sysfs.h>
60 #include <net/checksum.h>
62 @@ -9517,7 +9515,6 @@ static int tg3_init_hw(struct tg3 *tp, i
63 return tg3_reset_hw(tp, reset_phy);
66 -#if IS_ENABLED(CONFIG_HWMON)
67 static void tg3_sd_scan_scratchpad(struct tg3 *tp, struct tg3_ocir *ocir)
70 @@ -9570,22 +9567,17 @@ static const struct attribute_group tg3_
71 .attrs = tg3_attributes,
76 static void tg3_hwmon_close(struct tg3 *tp)
78 -#if IS_ENABLED(CONFIG_HWMON)
80 hwmon_device_unregister(tp->hwmon_dev);
82 sysfs_remove_group(&tp->pdev->dev.kobj, &tg3_group);
87 static void tg3_hwmon_open(struct tg3 *tp)
89 -#if IS_ENABLED(CONFIG_HWMON)
92 struct pci_dev *pdev = tp->pdev;
93 @@ -9617,7 +9609,6 @@ static void tg3_hwmon_open(struct tg3 *t
94 dev_err(&pdev->dev, "Cannot register hwmon device, aborting\n");
95 sysfs_remove_group(&pdev->dev.kobj, &tg3_group);