Skip to content

Commit de0a414

Browse files
Paul Gortmakerdavem330
authored andcommitted
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 <[email protected]> Reported-by: Benjamin Herrenschmidt <[email protected]> Reported-by: Anisse Astier <[email protected]> Suggested-by: David S. Miller <[email protected]> Signed-off-by: Paul Gortmaker <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent d4e6264 commit de0a414

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

drivers/net/ethernet/broadcom/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ config TIGON3
101101
tristate "Broadcom Tigon3 support"
102102
depends on PCI
103103
select PHYLIB
104+
select HWMON
104105
---help---
105106
This driver supports Broadcom Tigon3 based gigabit Ethernet cards.
106107

drivers/net/ethernet/broadcom/tg3.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,8 @@
4444
#include <linux/prefetch.h>
4545
#include <linux/dma-mapping.h>
4646
#include <linux/firmware.h>
47-
#if IS_ENABLED(CONFIG_HWMON)
4847
#include <linux/hwmon.h>
4948
#include <linux/hwmon-sysfs.h>
50-
#endif
5149

5250
#include <net/checksum.h>
5351
#include <net/ip.h>
@@ -9594,7 +9592,6 @@ static int tg3_init_hw(struct tg3 *tp, int reset_phy)
95949592
return tg3_reset_hw(tp, reset_phy);
95959593
}
95969594

9597-
#if IS_ENABLED(CONFIG_HWMON)
95989595
static void tg3_sd_scan_scratchpad(struct tg3 *tp, struct tg3_ocir *ocir)
95999596
{
96009597
int i;
@@ -9647,22 +9644,17 @@ static const struct attribute_group tg3_group = {
96479644
.attrs = tg3_attributes,
96489645
};
96499646

9650-
#endif
9651-
96529647
static void tg3_hwmon_close(struct tg3 *tp)
96539648
{
9654-
#if IS_ENABLED(CONFIG_HWMON)
96559649
if (tp->hwmon_dev) {
96569650
hwmon_device_unregister(tp->hwmon_dev);
96579651
tp->hwmon_dev = NULL;
96589652
sysfs_remove_group(&tp->pdev->dev.kobj, &tg3_group);
96599653
}
9660-
#endif
96619654
}
96629655

96639656
static void tg3_hwmon_open(struct tg3 *tp)
96649657
{
9665-
#if IS_ENABLED(CONFIG_HWMON)
96669658
int i, err;
96679659
u32 size = 0;
96689660
struct pci_dev *pdev = tp->pdev;
@@ -9694,7 +9686,6 @@ static void tg3_hwmon_open(struct tg3 *tp)
96949686
dev_err(&pdev->dev, "Cannot register hwmon device, aborting\n");
96959687
sysfs_remove_group(&pdev->dev.kobj, &tg3_group);
96969688
}
9697-
#endif
96989689
}
96999690

97009691

0 commit comments

Comments
 (0)