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>
This commit is contained in:

committed by
Jeff Kirsher

parent
56cec24916
commit
e3670b8195
@@ -337,8 +337,10 @@ struct hwmon_attr {
|
||||
};
|
||||
|
||||
struct hwmon_buff {
|
||||
struct device *device;
|
||||
struct hwmon_attr *hwmon_list;
|
||||
struct attribute_group group;
|
||||
const struct attribute_group *groups[2];
|
||||
struct attribute *attrs[E1000_MAX_SENSORS * 4 + 1];
|
||||
struct hwmon_attr hwmon_list[E1000_MAX_SENSORS * 4];
|
||||
unsigned int n_hwmon;
|
||||
};
|
||||
#endif
|
||||
@@ -440,7 +442,7 @@ struct igb_adapter {
|
||||
|
||||
char fw_version[32];
|
||||
#ifdef CONFIG_IGB_HWMON
|
||||
struct hwmon_buff igb_hwmon_buff;
|
||||
struct hwmon_buff *igb_hwmon_buff;
|
||||
bool ets;
|
||||
#endif
|
||||
struct i2c_algo_bit_data i2c_algo;
|
||||
|
Reference in New Issue
Block a user