Commit 1210982b authored by Don Skidmore's avatar Don Skidmore Committed by Jeff Kirsher

ixgbe: cleanup the hwmon function calls

When the hwmon code was initially added it was with the assumption that a
sysfs patch would be also coming soon.  Since that isn't the case some
clean up needs to be done.  This patch does that.
Signed-off-by: default avatarDon Skidmore <donald.c.skidmore@intel.com>
Tested-by: default avatarStephen Ko <stephen.s.ko@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent aa7bd467
...@@ -677,8 +677,10 @@ extern int ixgbe_setup_tc(struct net_device *dev, u8 tc); ...@@ -677,8 +677,10 @@ extern int ixgbe_setup_tc(struct net_device *dev, u8 tc);
#endif #endif
extern void ixgbe_tx_ctxtdesc(struct ixgbe_ring *, u32, u32, u32, u32); extern void ixgbe_tx_ctxtdesc(struct ixgbe_ring *, u32, u32, u32, u32);
extern void ixgbe_do_reset(struct net_device *netdev); extern void ixgbe_do_reset(struct net_device *netdev);
#ifdef CONFIG_IXGBE_HWMON
extern void ixgbe_sysfs_exit(struct ixgbe_adapter *adapter); extern void ixgbe_sysfs_exit(struct ixgbe_adapter *adapter);
extern int ixgbe_sysfs_init(struct ixgbe_adapter *adapter); extern int ixgbe_sysfs_init(struct ixgbe_adapter *adapter);
#endif /* CONFIG_IXGBE_HWMON */
#ifdef IXGBE_FCOE #ifdef IXGBE_FCOE
extern void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter); extern void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter);
extern int ixgbe_fso(struct ixgbe_ring *tx_ring, extern int ixgbe_fso(struct ixgbe_ring *tx_ring,
......
...@@ -7344,8 +7344,10 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, ...@@ -7344,8 +7344,10 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
e_dev_info("%s\n", ixgbe_default_device_descr); e_dev_info("%s\n", ixgbe_default_device_descr);
cards_found++; cards_found++;
#ifdef CONFIG_IXGBE_HWMON
if (ixgbe_sysfs_init(adapter)) if (ixgbe_sysfs_init(adapter))
e_err(probe, "failed to allocate sysfs resources\n"); e_err(probe, "failed to allocate sysfs resources\n");
#endif /* CONFIG_IXGBE_HWMON */
return 0; return 0;
...@@ -7397,7 +7399,9 @@ static void __devexit ixgbe_remove(struct pci_dev *pdev) ...@@ -7397,7 +7399,9 @@ static void __devexit ixgbe_remove(struct pci_dev *pdev)
} }
#endif #endif
#ifdef CONFIG_IXGBE_HWMON
ixgbe_sysfs_exit(adapter); ixgbe_sysfs_exit(adapter);
#endif /* CONFIG_IXGBE_HWMON */
#ifdef IXGBE_FCOE #ifdef IXGBE_FCOE
if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED)
......
...@@ -37,12 +37,7 @@ ...@@ -37,12 +37,7 @@
#include <linux/netdevice.h> #include <linux/netdevice.h>
#include <linux/hwmon.h> #include <linux/hwmon.h>
/*
* This file provides a sysfs interface to export information from the
* driver. The information presented is READ-ONLY.
*/
#ifdef CONFIG_IXGBE_HWMON #ifdef CONFIG_IXGBE_HWMON
/* hwmon callback functions */ /* hwmon callback functions */
static ssize_t ixgbe_hwmon_show_location(struct device *dev, static ssize_t ixgbe_hwmon_show_location(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
...@@ -162,17 +157,13 @@ static int ixgbe_add_hwmon_attr(struct ixgbe_adapter *adapter, ...@@ -162,17 +157,13 @@ static int ixgbe_add_hwmon_attr(struct ixgbe_adapter *adapter,
return rc; return rc;
} }
#endif /* CONFIG_IXGBE_HWMON */
static void ixgbe_sysfs_del_adapter(struct ixgbe_adapter *adapter) static void ixgbe_sysfs_del_adapter(struct ixgbe_adapter *adapter)
{ {
#ifdef CONFIG_IXGBE_HWMON
int i; int i;
#endif /* CONFIG_IXGBE_HWMON */
if (adapter == NULL) if (adapter == NULL)
return; return;
#ifdef CONFIG_IXGBE_HWMON
for (i = 0; i < adapter->ixgbe_hwmon_buff.n_hwmon; i++) { for (i = 0; i < adapter->ixgbe_hwmon_buff.n_hwmon; i++) {
device_remove_file(&adapter->pdev->dev, device_remove_file(&adapter->pdev->dev,
...@@ -183,12 +174,6 @@ static void ixgbe_sysfs_del_adapter(struct ixgbe_adapter *adapter) ...@@ -183,12 +174,6 @@ static void ixgbe_sysfs_del_adapter(struct ixgbe_adapter *adapter)
if (adapter->ixgbe_hwmon_buff.device) if (adapter->ixgbe_hwmon_buff.device)
hwmon_device_unregister(adapter->ixgbe_hwmon_buff.device); hwmon_device_unregister(adapter->ixgbe_hwmon_buff.device);
#endif /* CONFIG_IXGBE_HWMON */
if (adapter->info_kobj != NULL) {
kobject_put(adapter->info_kobj);
adapter->info_kobj = NULL;
}
} }
/* called from ixgbe_main.c */ /* called from ixgbe_main.c */
...@@ -200,32 +185,19 @@ void ixgbe_sysfs_exit(struct ixgbe_adapter *adapter) ...@@ -200,32 +185,19 @@ void ixgbe_sysfs_exit(struct ixgbe_adapter *adapter)
/* called from ixgbe_main.c */ /* called from ixgbe_main.c */
int ixgbe_sysfs_init(struct ixgbe_adapter *adapter) int ixgbe_sysfs_init(struct ixgbe_adapter *adapter)
{ {
#ifdef CONFIG_IXGBE_HWMON
struct hwmon_buff *ixgbe_hwmon = &adapter->ixgbe_hwmon_buff; struct hwmon_buff *ixgbe_hwmon = &adapter->ixgbe_hwmon_buff;
unsigned int i; unsigned int i;
int n_attrs; int n_attrs;
#endif /* CONFIG_IXGBE_HWMON */
struct net_device *netdev = adapter->netdev;
int rc = 0; int rc = 0;
/* create info kobj and attribute listings in kobj */
adapter->info_kobj = kobject_create_and_add("info", &netdev->dev.kobj);
if (adapter->info_kobj == NULL) {
rc = -ENOMEM;
goto err;
}
#ifdef CONFIG_IXGBE_HWMON
/* If this method isn't defined we don't support thermals */ /* If this method isn't defined we don't support thermals */
if (adapter->hw.mac.ops.init_thermal_sensor_thresh == NULL) { if (adapter->hw.mac.ops.init_thermal_sensor_thresh == NULL) {
rc = -EPERM; goto exit;
goto err;
} }
/* Don't create thermal hwmon interface if no sensors present */ /* Don't create thermal hwmon interface if no sensors present */
rc = adapter->hw.mac.ops.init_thermal_sensor_thresh(&adapter->hw); if (adapter->hw.mac.ops.init_thermal_sensor_thresh(&adapter->hw))
if (rc) goto exit;
goto err;
/* /*
* Allocation space for max attributs * Allocation space for max attributs
...@@ -261,7 +233,6 @@ int ixgbe_sysfs_init(struct ixgbe_adapter *adapter) ...@@ -261,7 +233,6 @@ int ixgbe_sysfs_init(struct ixgbe_adapter *adapter)
if (rc) if (rc)
goto err; goto err;
} }
#endif /* CONFIG_IXGBE_HWMON */
goto exit; goto exit;
...@@ -270,4 +241,5 @@ int ixgbe_sysfs_init(struct ixgbe_adapter *adapter) ...@@ -270,4 +241,5 @@ int ixgbe_sysfs_init(struct ixgbe_adapter *adapter)
exit: exit:
return rc; return rc;
} }
#endif /* CONFIG_IXGBE_HWMON */
Markdown is supported
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