Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1257850

Re: [PATCH v2 1/2] hwmon: ina2xx: convert driver to using regmap

From Marc Titinger <mtitinger@baylibre.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 1/2] hwmon: ina2xx: convert driver to using regmap
Date 2015-10-28 10:30 +0100
Message-ID <qovdo-Lu-19@gated-at.bofh.it> (permalink)
References <qo15D-78q-7@gated-at.bofh.it> <qo9cT-3CL-15@gated-at.bofh.it> <qooYi-54u-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 28/10/2015 03:47, Guenter Roeck wrote:
> On Tue, Oct 27, 2015 at 10:51:07AM +0100, Marc Titinger wrote:
>> Any sysfs "show" read access from the client app will result in reading
>> all registers (8 with ina226). Depending on the host this can limit the
>> best achievable read rate.
>>
>> This changeset allows for individual register accesses through regmap.
>>
>> Tested with BeagleBone Black (Baylibre-ACME) and ina226.
>>
>> Signed-off-by: Marc Titinger <mtitinger@baylibre.com>
>> ---
>>
>>    v2:
>> 	- rename 'rv' to 'regval' for clarity
>> 	- fix missed smbus_xxx api change to regmap
>> 	- rename ina2xx_do_update to ina2xx_read_reg
>> 	- fix indentation
>>
>>   drivers/hwmon/ina2xx.c | 211 +++++++++++++++++++------------------------------
>>   1 file changed, 82 insertions(+), 129 deletions(-)
>>
>> diff --git a/drivers/hwmon/ina2xx.c b/drivers/hwmon/ina2xx.c
>> index 4d28150..5e7ada8 100644
>> --- a/drivers/hwmon/ina2xx.c
>> +++ b/drivers/hwmon/ina2xx.c
>
> [ ... ]
>>
>> -	mutex_lock(&data->update_lock);
>>   	data->rshunt = val;
>>   	status = ina2xx_calibrate(data);
>> -	mutex_unlock(&data->update_lock);
>
> I think this can result in a race conditon if multiple processes
> try to update the shunt resistor value at the same time in a
> multi-core system. There is no guarantee that the value programmed
> into the chip matches the value that is written into 'rshunt'.
> So I think we still need the mutex, unless you have a better
> idea how to avoid the race.
>
Right, I had that same afterthought when removing the mutex at that 
position. Fix incoming!

M.


> Thanks,
> Guenter
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC] hwmon: ina2xx: allow for actual measurement bandwidth above 160 Hz Marc Titinger <mtitinger@baylibre.com> - 2015-10-19 18:30 +0200
  Re: [RFC] hwmon: ina2xx: allow for actual measurement bandwidth above  160 Hz Guenter Roeck <linux@roeck-us.net> - 2015-10-20 03:40 +0200
    Re: [RFC] hwmon: ina2xx: allow for actual measurement bandwidth above  160 Hz Marc Titinger <mtitinger@baylibre.com> - 2015-10-20 10:00 +0200
    [PATCH v2] hwmon: ina2xx: allow for actual measurement bandwidth above 160 Hz Marc Titinger <mtitinger@baylibre.com> - 2015-10-20 10:30 +0200
      Re: [PATCH v2] hwmon: ina2xx: allow for actual measurement bandwidth  above 160 Hz Guenter Roeck <linux@roeck-us.net> - 2015-10-20 15:00 +0200
        Re: [PATCH v2] hwmon: ina2xx: allow for actual measurement bandwidth  above 160 Hz Marc Titinger <mtitinger@baylibre.com> - 2015-10-20 15:20 +0200
          Re: [PATCH v2] hwmon: ina2xx: allow for actual measurement bandwidth  above 160 Hz Guenter Roeck <linux@roeck-us.net> - 2015-10-20 15:40 +0200
            Re: [PATCH v2] hwmon: ina2xx: allow for actual measurement bandwidth  above 160 Hz Marc Titinger <mtitinger@baylibre.com> - 2015-10-20 15:50 +0200
              Re: [PATCH v2] hwmon: ina2xx: allow for actual measurement bandwidth  above 160 Hz Guenter Roeck <linux@roeck-us.net> - 2015-10-20 19:10 +0200
                Re: [PATCH v2] hwmon: ina2xx: allow for actual measurement bandwidth  above 160 Hz Marc Titinger <mtitinger@baylibre.com> - 2015-10-21 09:50 +0200
            Re: [PATCH v2] hwmon: ina2xx: allow for actual measurement bandwidth above  160 Hz Michael Turquette <mturquette@baylibre.com> - 2015-10-20 16:00 +0200
        [RFC] hwmon: ina2xx: port to using remap, improve bandwidth. Marc Titinger <mtitinger@baylibre.com> - 2015-10-23 18:20 +0200
          Re: [RFC] hwmon: ina2xx: port to using remap, improve bandwidth. Guenter Roeck <linux@roeck-us.net> - 2015-10-23 19:00 +0200
            Re: [RFC] hwmon: ina2xx: port to using remap, improve bandwidth. Marc Titinger <mtitinger@baylibre.com> - 2015-10-23 22:40 +0200
              Re: [RFC] hwmon: ina2xx: port to using remap, improve bandwidth. Guenter Roeck <linux@roeck-us.net> - 2015-10-24 04:30 +0200
              Re: [RFC] hwmon: ina2xx: port to using remap, improve bandwidth. Guenter Roeck <linux@roeck-us.net> - 2015-10-24 14:50 +0200
                [PATCH 0/2] hwmon: ina2xx: convert driver to using regmap Marc Titinger <mtitinger@baylibre.com> - 2015-10-26 17:30 +0100
                [PATCH 2/2] hwmon: ina2xx: give precedence to DT over checking for platform data. Marc Titinger <mtitinger@baylibre.com> - 2015-10-26 17:30 +0100
                Re: [PATCH 2/2] hwmon: ina2xx: give precedence to DT over checking  for platform data. Guenter Roeck <linux@roeck-us.net> - 2015-10-27 02:20 +0100
                [PATCH 1/2] hwmon: ina2xx: convert driver to using regmap Marc Titinger <mtitinger@baylibre.com> - 2015-10-26 17:30 +0100
                Re: [PATCH 1/2] hwmon: ina2xx: convert driver to using regmap Guenter Roeck <linux@roeck-us.net> - 2015-10-27 02:10 +0100
                Re: [PATCH 1/2] hwmon: ina2xx: convert driver to using regmap Guenter Roeck <linux@roeck-us.net> - 2015-10-27 02:20 +0100
                [PATCH v2 1/2] hwmon: ina2xx: convert driver to using regmap Marc Titinger <mtitinger@baylibre.com> - 2015-10-27 11:00 +0100
                [PATCH v2 2/2] hwmon: ina2xx: give precedence to DT over checking for platform data. Marc Titinger <mtitinger@baylibre.com> - 2015-10-27 11:00 +0100
                Re: [PATCH v2 1/2] hwmon: ina2xx: convert driver to using regmap Guenter Roeck <linux@roeck-us.net> - 2015-10-28 03:50 +0100
                Re: [PATCH v2 1/2] hwmon: ina2xx: convert driver to using regmap Marc Titinger <mtitinger@baylibre.com> - 2015-10-28 10:30 +0100
          Re: [RFC] hwmon: ina2xx: port to using remap, improve bandwidth. kbuild test robot <lkp@intel.com> - 2015-10-23 19:00 +0200

csiph-web