]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/3.6.8/tg3-unconditionally-select-hwmon-support-when-tg3-is-enabled.patch
Fixes for 4.19
[thirdparty/kernel/stable-queue.git] / releases / 3.6.8 / tg3-unconditionally-select-hwmon-support-when-tg3-is-enabled.patch
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.
5
6 From: Paul Gortmaker <paul.gortmaker@windriver.com>
7
8 commit de0a41484c47d783dd4d442914815076aa2caac2 upstream.
9
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
12 fail like:
13
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
19
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.
23
24 [1] http://marc.info/?l=linux-netdev&m=134250573718151&w=2
25
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>
33
34 ---
35 drivers/net/ethernet/broadcom/Kconfig | 1 +
36 drivers/net/ethernet/broadcom/tg3.c | 9 ---------
37 2 files changed, 1 insertion(+), 9 deletions(-)
38
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"
43 depends on PCI
44 select PHYLIB
45 + select HWMON
46 ---help---
47 This driver supports Broadcom Tigon3 based gigabit Ethernet cards.
48
49 --- a/drivers/net/ethernet/broadcom/tg3.c
50 +++ b/drivers/net/ethernet/broadcom/tg3.c
51 @@ -44,10 +44,8 @@
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>
58 -#endif
59
60 #include <net/checksum.h>
61 #include <net/ip.h>
62 @@ -9517,7 +9515,6 @@ static int tg3_init_hw(struct tg3 *tp, i
63 return tg3_reset_hw(tp, reset_phy);
64 }
65
66 -#if IS_ENABLED(CONFIG_HWMON)
67 static void tg3_sd_scan_scratchpad(struct tg3 *tp, struct tg3_ocir *ocir)
68 {
69 int i;
70 @@ -9570,22 +9567,17 @@ static const struct attribute_group tg3_
71 .attrs = tg3_attributes,
72 };
73
74 -#endif
75 -
76 static void tg3_hwmon_close(struct tg3 *tp)
77 {
78 -#if IS_ENABLED(CONFIG_HWMON)
79 if (tp->hwmon_dev) {
80 hwmon_device_unregister(tp->hwmon_dev);
81 tp->hwmon_dev = NULL;
82 sysfs_remove_group(&tp->pdev->dev.kobj, &tg3_group);
83 }
84 -#endif
85 }
86
87 static void tg3_hwmon_open(struct tg3 *tp)
88 {
89 -#if IS_ENABLED(CONFIG_HWMON)
90 int i, err;
91 u32 size = 0;
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);
96 }
97 -#endif
98 }
99
100