aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/igb/igb.h
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2013-11-26 02:15:23 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2013-12-10 04:27:35 -0500
commite3670b81954ab1247341a08514aa4df09f0b495e (patch)
tree1173cb2ec884b3d23acb50003a6affe9769669ca /drivers/net/ethernet/intel/igb/igb.h
parent56cec249167b44ee2ba7a3cbf4431bee937e08e3 (diff)
igb: Convert to use devm_hwmon_device_register_with_groups
Simplify the code. Attach hwmon sysfs attributes to hwmon device instead of pci device. Avoid race conditions caused by attributes being created after registration and provide mandatory 'name' attribute by using new hwmon API. Other cleanup: Instead of allocating memory for hwmon attributes, move attributes and all other hwmon related data into struct hwmon_buff and allocate the entire structure using devm_kzalloc. Check return value from calls to igb_add_hwmon_attr() one by one instead of logically combining them all together. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/igb/igb.h')
-rw-r--r--drivers/net/ethernet/intel/igb/igb.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/net/ethernet/intel/igb/igb.h b/drivers/net/ethernet/intel/igb/igb.h
index 11173f46f436..8aaca0a1dca0 100644
--- a/drivers/net/ethernet/intel/igb/igb.h
+++ b/drivers/net/ethernet/intel/igb/igb.h
@@ -337,8 +337,10 @@ struct hwmon_attr {
337 }; 337 };
338 338
339struct hwmon_buff { 339struct hwmon_buff {
340 struct device *device; 340 struct attribute_group group;
341 struct hwmon_attr *hwmon_list; 341 const struct attribute_group *groups[2];
342 struct attribute *attrs[E1000_MAX_SENSORS * 4 + 1];
343 struct hwmon_attr hwmon_list[E1000_MAX_SENSORS * 4];
342 unsigned int n_hwmon; 344 unsigned int n_hwmon;
343 }; 345 };
344#endif 346#endif
@@ -440,7 +442,7 @@ struct igb_adapter {
440 442
441 char fw_version[32]; 443 char fw_version[32];
442#ifdef CONFIG_IGB_HWMON 444#ifdef CONFIG_IGB_HWMON
443 struct hwmon_buff igb_hwmon_buff; 445 struct hwmon_buff *igb_hwmon_buff;
444 bool ets; 446 bool ets;
445#endif 447#endif
446 struct i2c_algo_bit_data i2c_algo; 448 struct i2c_algo_bit_data i2c_algo;