lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAMpxmJUeX1J+wHW_c0NLeOgPcUyv82s9fH+xo8aisdwBYH2hUg@mail.gmail.com>
Date:	Wed, 7 Jan 2015 13:48:40 +0100
From:	Bartosz Golaszewski <bgolaszewski@...libre.com>
To:	Guenter Roeck <linux@...ck-us.net>
Cc:	Patrick Titiano <ptitiano@...libre.com>,
	LKML <linux-kernel@...r.kernel.org>,
	Benoit Cousson <bcousson@...libre.com>,
	LM Sensors <lm-sensors@...sensors.org>
Subject: Re: [v8, 5/5] hwmon: ina2xx: allow to change the averaging rate at run-time

2015-01-06 19:18 GMT+01:00 Guenter Roeck <linux@...ck-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. 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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ