diff options
author | Don Skidmore <donald.c.skidmore@intel.com> | 2012-05-04 02:07:08 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2012-05-10 02:14:43 -0400 |
commit | 1210982bb6ccc39f4252100b00073b7ee3f2e5ce (patch) | |
tree | 907c5dcc10e3cf6d2fe3fdc48bb99dfbd986656e | |
parent | aa7bd467e3db3ddac503d0126a0c021871ca7d88 (diff) |
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: Don Skidmore <donald.c.skidmore@intel.com>
Tested-by: Stephen Ko <stephen.s.ko@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe.h | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/intel/ixgbe/ixgbe_sysfs.c | 36 |
3 files changed, 10 insertions, 32 deletions
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h index cba6ff43cdd1..3ef3c5284e52 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h | |||
@@ -677,8 +677,10 @@ extern int ixgbe_setup_tc(struct net_device *dev, u8 tc); | |||
677 | #endif | 677 | #endif |
678 | extern void ixgbe_tx_ctxtdesc(struct ixgbe_ring *, u32, u32, u32, u32); | 678 | extern void ixgbe_tx_ctxtdesc(struct ixgbe_ring *, u32, u32, u32, u32); |
679 | extern void ixgbe_do_reset(struct net_device *netdev); | 679 | extern void ixgbe_do_reset(struct net_device *netdev); |
680 | #ifdef CONFIG_IXGBE_HWMON | ||
680 | extern void ixgbe_sysfs_exit(struct ixgbe_adapter *adapter); | 681 | extern void ixgbe_sysfs_exit(struct ixgbe_adapter *adapter); |
681 | extern int ixgbe_sysfs_init(struct ixgbe_adapter *adapter); | 682 | extern int ixgbe_sysfs_init(struct ixgbe_adapter *adapter); |
683 | #endif /* CONFIG_IXGBE_HWMON */ | ||
682 | #ifdef IXGBE_FCOE | 684 | #ifdef IXGBE_FCOE |
683 | extern void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter); | 685 | extern void ixgbe_configure_fcoe(struct ixgbe_adapter *adapter); |
684 | extern int ixgbe_fso(struct ixgbe_ring *tx_ring, | 686 | extern int ixgbe_fso(struct ixgbe_ring *tx_ring, |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c index 05f66a24da2a..863c9b759b4c 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | |||
@@ -7344,8 +7344,10 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, | |||
7344 | e_dev_info("%s\n", ixgbe_default_device_descr); | 7344 | e_dev_info("%s\n", ixgbe_default_device_descr); |
7345 | cards_found++; | 7345 | cards_found++; |
7346 | 7346 | ||
7347 | #ifdef CONFIG_IXGBE_HWMON | ||
7347 | if (ixgbe_sysfs_init(adapter)) | 7348 | if (ixgbe_sysfs_init(adapter)) |
7348 | e_err(probe, "failed to allocate sysfs resources\n"); | 7349 | e_err(probe, "failed to allocate sysfs resources\n"); |
7350 | #endif /* CONFIG_IXGBE_HWMON */ | ||
7349 | 7351 | ||
7350 | return 0; | 7352 | return 0; |
7351 | 7353 | ||
@@ -7397,7 +7399,9 @@ static void __devexit ixgbe_remove(struct pci_dev *pdev) | |||
7397 | } | 7399 | } |
7398 | 7400 | ||
7399 | #endif | 7401 | #endif |
7402 | #ifdef CONFIG_IXGBE_HWMON | ||
7400 | ixgbe_sysfs_exit(adapter); | 7403 | ixgbe_sysfs_exit(adapter); |
7404 | #endif /* CONFIG_IXGBE_HWMON */ | ||
7401 | 7405 | ||
7402 | #ifdef IXGBE_FCOE | 7406 | #ifdef IXGBE_FCOE |
7403 | if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) | 7407 | if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) |
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sysfs.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sysfs.c index f81c166dc5a8..1d80b1cefa6a 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sysfs.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sysfs.c | |||
@@ -37,12 +37,7 @@ | |||
37 | #include <linux/netdevice.h> | 37 | #include <linux/netdevice.h> |
38 | #include <linux/hwmon.h> | 38 | #include <linux/hwmon.h> |
39 | 39 | ||
40 | /* | ||
41 | * This file provides a sysfs interface to export information from the | ||
42 | * driver. The information presented is READ-ONLY. | ||
43 | */ | ||
44 | #ifdef CONFIG_IXGBE_HWMON | 40 | #ifdef CONFIG_IXGBE_HWMON |
45 | |||
46 | /* hwmon callback functions */ | 41 | /* hwmon callback functions */ |
47 | static ssize_t ixgbe_hwmon_show_location(struct device *dev, | 42 | static ssize_t ixgbe_hwmon_show_location(struct device *dev, |
48 | struct device_attribute *attr, | 43 | struct device_attribute *attr, |
@@ -162,17 +157,13 @@ static int ixgbe_add_hwmon_attr(struct ixgbe_adapter *adapter, | |||
162 | 157 | ||
163 | return rc; | 158 | return rc; |
164 | } | 159 | } |
165 | #endif /* CONFIG_IXGBE_HWMON */ | ||
166 | 160 | ||
167 | static void ixgbe_sysfs_del_adapter(struct ixgbe_adapter *adapter) | 161 | static void ixgbe_sysfs_del_adapter(struct ixgbe_adapter *adapter) |
168 | { | 162 | { |
169 | #ifdef CONFIG_IXGBE_HWMON | ||
170 | int i; | 163 | int i; |
171 | #endif /* CONFIG_IXGBE_HWMON */ | ||
172 | 164 | ||
173 | if (adapter == NULL) | 165 | if (adapter == NULL) |
174 | return; | 166 | return; |
175 | #ifdef CONFIG_IXGBE_HWMON | ||
176 | 167 | ||
177 | for (i = 0; i < adapter->ixgbe_hwmon_buff.n_hwmon; i++) { | 168 | for (i = 0; i < adapter->ixgbe_hwmon_buff.n_hwmon; i++) { |
178 | device_remove_file(&adapter->pdev->dev, | 169 | device_remove_file(&adapter->pdev->dev, |
@@ -183,12 +174,6 @@ static void ixgbe_sysfs_del_adapter(struct ixgbe_adapter *adapter) | |||
183 | 174 | ||
184 | if (adapter->ixgbe_hwmon_buff.device) | 175 | if (adapter->ixgbe_hwmon_buff.device) |
185 | hwmon_device_unregister(adapter->ixgbe_hwmon_buff.device); | 176 | hwmon_device_unregister(adapter->ixgbe_hwmon_buff.device); |
186 | #endif /* CONFIG_IXGBE_HWMON */ | ||
187 | |||
188 | if (adapter->info_kobj != NULL) { | ||
189 | kobject_put(adapter->info_kobj); | ||
190 | adapter->info_kobj = NULL; | ||
191 | } | ||
192 | } | 177 | } |
193 | 178 | ||
194 | /* called from ixgbe_main.c */ | 179 | /* called from ixgbe_main.c */ |
@@ -200,32 +185,19 @@ void ixgbe_sysfs_exit(struct ixgbe_adapter *adapter) | |||
200 | /* called from ixgbe_main.c */ | 185 | /* called from ixgbe_main.c */ |
201 | int ixgbe_sysfs_init(struct ixgbe_adapter *adapter) | 186 | int ixgbe_sysfs_init(struct ixgbe_adapter *adapter) |
202 | { | 187 | { |
203 | #ifdef CONFIG_IXGBE_HWMON | ||
204 | struct hwmon_buff *ixgbe_hwmon = &adapter->ixgbe_hwmon_buff; | 188 | struct hwmon_buff *ixgbe_hwmon = &adapter->ixgbe_hwmon_buff; |
205 | unsigned int i; | 189 | unsigned int i; |
206 | int n_attrs; | 190 | int n_attrs; |
207 | #endif /* CONFIG_IXGBE_HWMON */ | ||
208 | struct net_device *netdev = adapter->netdev; | ||
209 | int rc = 0; | 191 | int rc = 0; |
210 | 192 | ||
211 | /* create info kobj and attribute listings in kobj */ | ||
212 | adapter->info_kobj = kobject_create_and_add("info", &netdev->dev.kobj); | ||
213 | if (adapter->info_kobj == NULL) { | ||
214 | rc = -ENOMEM; | ||
215 | goto err; | ||
216 | } | ||
217 | |||
218 | #ifdef CONFIG_IXGBE_HWMON | ||
219 | /* If this method isn't defined we don't support thermals */ | 193 | /* If this method isn't defined we don't support thermals */ |
220 | if (adapter->hw.mac.ops.init_thermal_sensor_thresh == NULL) { | 194 | if (adapter->hw.mac.ops.init_thermal_sensor_thresh == NULL) { |
221 | rc = -EPERM; | 195 | goto exit; |
222 | goto err; | ||
223 | } | 196 | } |
224 | 197 | ||
225 | /* Don't create thermal hwmon interface if no sensors present */ | 198 | /* Don't create thermal hwmon interface if no sensors present */ |
226 | rc = adapter->hw.mac.ops.init_thermal_sensor_thresh(&adapter->hw); | 199 | if (adapter->hw.mac.ops.init_thermal_sensor_thresh(&adapter->hw)) |
227 | if (rc) | 200 | goto exit; |
228 | goto err; | ||
229 | 201 | ||
230 | /* | 202 | /* |
231 | * Allocation space for max attributs | 203 | * Allocation space for max attributs |
@@ -261,7 +233,6 @@ int ixgbe_sysfs_init(struct ixgbe_adapter *adapter) | |||
261 | if (rc) | 233 | if (rc) |
262 | goto err; | 234 | goto err; |
263 | } | 235 | } |
264 | #endif /* CONFIG_IXGBE_HWMON */ | ||
265 | 236 | ||
266 | goto exit; | 237 | goto exit; |
267 | 238 | ||
@@ -270,4 +241,5 @@ err: | |||
270 | exit: | 241 | exit: |
271 | return rc; | 242 | return rc; |
272 | } | 243 | } |
244 | #endif /* CONFIG_IXGBE_HWMON */ | ||
273 | 245 | ||