2015-01-06 19:18 GMT+01:00 Guenter Roeck <linux@xxxxxxxxxxxx>: > 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. A simple > avg = ina226_avg_tab[INA226_READ_AVG(data->regs[INA2XX_CONFIG])]; > return snprintf(buf, PAGE_SIZE, "%d\n", avg); > or even > return snprintf(buf, PAGE_SIZE, "%d\n", > ina226_avg_tab[INA226_READ_AVG(data->regs[INA2XX_CONFIG])]); > > would accomplish exactly the same. This was stupid, I admit. Fixed in the new version. Hope it's ok now. > I kind of dislike that attribute name. I don't have a better idea though, so > I'll let it pass unless you have a better idea. I don't really. What's wrong with this one? Bart _______________________________________________ lm-sensors mailing list lm-sensors@xxxxxxxxxxxxxx http://lists.lm-sensors.org/mailman/listinfo/lm-sensors