Re: [v8, 5/5] hwmon: ina2xx: allow to change the averaging rate at run-time

2015-01-07 Thread Bartosz Golaszewski
2015-01-06 19:18 GMT+01:00 Guenter Roeck : > ina226_avg_val() calculates the average value from ina226_avg_tab > and then you loop through ina226_avg_tab to find the index into ina226_avg_tab > again, only to use the thus calculated index for accessing ina226_avg_tab[] > once more. Think about it.

Re: [v8, 5/5] hwmon: ina2xx: allow to change the averaging rate at run-time

2015-01-07 Thread Bartosz Golaszewski
2015-01-06 19:18 GMT+01:00 Guenter Roeck li...@roeck-us.net: ina226_avg_val() calculates the average value from ina226_avg_tab and then you loop through ina226_avg_tab to find the index into ina226_avg_tab again, only to use the thus calculated index for accessing ina226_avg_tab[] once more.

Re: [v8, 5/5] hwmon: ina2xx: allow to change the averaging rate at run-time

2015-01-06 Thread Guenter Roeck
On Mon, Jan 05, 2015 at 03:20:56PM +0100, Bartosz Golaszewski wrote: > The averaging rate of ina226 is hardcoded to 16 in the driver. Make it > modifiable at run-time via a new sysfs attribute. > > While we're at it - add an additional variable to ina2xx_data, which holds > the current

Re: [v8, 5/5] hwmon: ina2xx: allow to change the averaging rate at run-time

2015-01-06 Thread Guenter Roeck
On Mon, Jan 05, 2015 at 03:20:56PM +0100, Bartosz Golaszewski wrote: The averaging rate of ina226 is hardcoded to 16 in the driver. Make it modifiable at run-time via a new sysfs attribute. While we're at it - add an additional variable to ina2xx_data, which holds the current configuration

[PATCH v8 5/5] hwmon: ina2xx: allow to change the averaging rate at run-time

2015-01-05 Thread Bartosz Golaszewski
The averaging rate of ina226 is hardcoded to 16 in the driver. Make it modifiable at run-time via a new sysfs attribute. While we're at it - add an additional variable to ina2xx_data, which holds the current configuration settings - this way we'll be able to restore the configuration in case of

[PATCH v8 5/5] hwmon: ina2xx: allow to change the averaging rate at run-time

2015-01-05 Thread Bartosz Golaszewski
The averaging rate of ina226 is hardcoded to 16 in the driver. Make it modifiable at run-time via a new sysfs attribute. While we're at it - add an additional variable to ina2xx_data, which holds the current configuration settings - this way we'll be able to restore the configuration in case of