tg3: Add the ability to conditionally build w/ HWMON

Introduce a Kconfig option: CONFIG_TIGON3_HWMON which allows to build
in/out support for thermal sensors reported by Tigon3 NICs.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Florian Fainelli 2017-03-06 12:56:02 -08:00 committed by David S. Miller
parent 9c13e8d0c2
commit 038e893d78
2 changed files with 14 additions and 1 deletions

View File

@ -109,7 +109,6 @@ config TIGON3
tristate "Broadcom Tigon3 support" tristate "Broadcom Tigon3 support"
depends on PCI depends on PCI
select PHYLIB select PHYLIB
select HWMON
imply PTP_1588_CLOCK imply PTP_1588_CLOCK
---help--- ---help---
This driver supports Broadcom Tigon3 based gigabit Ethernet cards. This driver supports Broadcom Tigon3 based gigabit Ethernet cards.
@ -117,6 +116,13 @@ config TIGON3
To compile this driver as a module, choose M here: the module To compile this driver as a module, choose M here: the module
will be called tg3. This is recommended. will be called tg3. This is recommended.
config TIGON3_HWMON
bool "Broadcom Tigon3 HWMON support"
default y
depends on TIGON3 && HWMON && !(TIGON3=y && HWMON=m)
---help---
Say Y if you want to expose the thermal sensor on Tigon3 devices.
config BNX2X config BNX2X
tristate "Broadcom NetXtremeII 10Gb support" tristate "Broadcom NetXtremeII 10Gb support"
depends on PCI depends on PCI

View File

@ -825,6 +825,7 @@ static int tg3_ape_event_lock(struct tg3 *tp, u32 timeout_us)
return timeout_us ? 0 : -EBUSY; return timeout_us ? 0 : -EBUSY;
} }
#ifdef CONFIG_TIGON3_HWMON
static int tg3_ape_wait_for_event(struct tg3 *tp, u32 timeout_us) static int tg3_ape_wait_for_event(struct tg3 *tp, u32 timeout_us)
{ {
u32 i, apedata; u32 i, apedata;
@ -904,6 +905,7 @@ static int tg3_ape_scratchpad_read(struct tg3 *tp, u32 *data, u32 base_off,
return 0; return 0;
} }
#endif
static int tg3_ape_send_event(struct tg3 *tp, u32 event) static int tg3_ape_send_event(struct tg3 *tp, u32 event)
{ {
@ -10744,6 +10746,7 @@ static int tg3_init_hw(struct tg3 *tp, bool reset_phy)
return tg3_reset_hw(tp, reset_phy); return tg3_reset_hw(tp, reset_phy);
} }
#ifdef CONFIG_TIGON3_HWMON
static void tg3_sd_scan_scratchpad(struct tg3 *tp, struct tg3_ocir *ocir) static void tg3_sd_scan_scratchpad(struct tg3 *tp, struct tg3_ocir *ocir)
{ {
int i; int i;
@ -10826,6 +10829,10 @@ static void tg3_hwmon_open(struct tg3 *tp)
dev_err(&pdev->dev, "Cannot register hwmon device, aborting\n"); dev_err(&pdev->dev, "Cannot register hwmon device, aborting\n");
} }
} }
#else
static inline void tg3_hwmon_close(struct tg3 *tp) { }
static inline void tg3_hwmon_open(struct tg3 *tp) { }
#endif /* CONFIG_TIGON3_HWMON */
#define TG3_STAT_ADD32(PSTAT, REG) \ #define TG3_STAT_ADD32(PSTAT, REG) \