On 1/31/23 21:48, Mehdi Djait wrote:
Hi Matti,
On Mon, Jan 30, 2023 at 10:15:51AM +0200, Matti Vaittinen wrote:
On 1/29/23 15:37, Mehdi Djait wrote:
/*
* The only difference would be to store the g_range value in the
* driver private struct when the user changes it from sysfs
* (in this case I defined an array called kx022a_g_range_table)
*/
data->g_range = kx022a_g_range_table[n];
Ok. Thanks for the clarification. In that case, as I mentioned below:
>> Do you mean caching the g_range instead of retrieving it from the
hardware?
>> I don't know an use-case where reading the range would be
time-critical -
>> and even if it was, the regmap should cache the value anyways. (unless
>> KX022A_REG_CNTL is in volatile range). So no, I don't think caching the
>> g_range is worth it.
I don't think it makes much difference. The regmap should cache the
value anyways. So, to be honest, I don't think it's worth the space and
code - unless the GSEL reg was in volatile range for some reason - and
even in that case the benefit might not be so big because AFAIR, the
g-range is not read for every sample.
Yours,
-- Matti
--
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland
~~ When things go utterly wrong vim users can always type :help! ~~