Commit de0a4148 authored by Paul Gortmaker's avatar Paul Gortmaker Committed by David S. Miller
Browse files

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.


Cc: Michael Chan <>
Reported-by: default avatarBenjamin Herrenschmidt <>
Reported-by: default avatarAnisse Astier <>
Suggested-by: default avatarDavid S. Miller <>
Signed-off-by: default avatarPaul Gortmaker <>
Signed-off-by: default avatarDavid S. Miller <>
parent d4e62648
......@@ -101,6 +101,7 @@ config TIGON3
tristate "Broadcom Tigon3 support"
depends on PCI
select PHYLIB
select HWMON
This driver supports Broadcom Tigon3 based gigabit Ethernet cards.
......@@ -44,10 +44,8 @@
#include <linux/prefetch.h>
#include <linux/dma-mapping.h>
#include <linux/firmware.h>
#include <linux/hwmon.h>
#include <linux/hwmon-sysfs.h>
#include <net/checksum.h>
#include <net/ip.h>
......@@ -9594,7 +9592,6 @@ static int tg3_init_hw(struct tg3 *tp, int reset_phy)
return tg3_reset_hw(tp, reset_phy);
static void tg3_sd_scan_scratchpad(struct tg3 *tp, struct tg3_ocir *ocir)
int i;
......@@ -9647,22 +9644,17 @@ static const struct attribute_group tg3_group = {
.attrs = tg3_attributes,
static void tg3_hwmon_close(struct tg3 *tp)
if (tp->hwmon_dev) {
tp->hwmon_dev = NULL;
sysfs_remove_group(&tp->pdev->dev.kobj, &tg3_group);
static void tg3_hwmon_open(struct tg3 *tp)
int i, err;
u32 size = 0;
struct pci_dev *pdev = tp->pdev;
......@@ -9694,7 +9686,6 @@ static void tg3_hwmon_open(struct tg3 *tp)
dev_err(&pdev->dev, "Cannot register hwmon device, aborting\n");
sysfs_remove_group(&pdev->dev.kobj, &tg3_group);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment