igb: Convert to use devm_hwmon_device_register_with_groups
authorGuenter Roeck <linux@roeck-us.net>
Tue, 26 Nov 2013 07:15:23 +0000 (07:15 +0000)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Tue, 10 Dec 2013 09:27:35 +0000 (01:27 -0800)
commite3670b81954ab1247341a08514aa4df09f0b495e
tree1173cb2ec884b3d23acb50003a6affe9769669ca
parent56cec249167b44ee2ba7a3cbf4431bee937e08e3
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>
drivers/net/ethernet/intel/igb/igb.h
drivers/net/ethernet/intel/igb/igb_hwmon.c