linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Titinger <mtitinger@baylibre.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: jdelvare@suse.com, lm-sensors@lm-sensors.org,
	linux-kernel@vger.kernel.org, mturquette@baylibre.com,
	bcousson@baylibre.com, ptitiano@baylibre.com
Subject: Re: [PATCH v2 1/2] hwmon: ina2xx: convert driver to using regmap
Date: Wed, 28 Oct 2015 10:23:59 +0100	[thread overview]
Message-ID: <5630942F.1020705@baylibre.com> (raw)
In-Reply-To: <20151028024711.GA30927@roeck-us.net>

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
>


  reply	other threads:[~2015-10-28  9:24 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-19 16:21 [RFC] hwmon: ina2xx: allow for actual measurement bandwidth above 160 Hz Marc Titinger
2015-10-20  1:32 ` Guenter Roeck
2015-10-20  7:58   ` Marc Titinger
2015-10-20  8:20   ` [PATCH v2] " Marc Titinger
2015-10-20 12:54     ` Guenter Roeck
2015-10-20 13:17       ` Marc Titinger
2015-10-20 13:30         ` Guenter Roeck
2015-10-20 13:46           ` Marc Titinger
2015-10-20 17:00             ` Guenter Roeck
2015-10-21  7:46               ` Marc Titinger
2015-10-20 13:52           ` Michael Turquette
2015-10-23 16:13       ` [RFC] hwmon: ina2xx: port to using remap, improve bandwidth Marc Titinger
2015-10-23 16:49         ` kbuild test robot
2015-10-23 16:52         ` Guenter Roeck
2015-10-23 20:35           ` Marc Titinger
2015-10-24  2:21             ` Guenter Roeck
2015-10-24 12:45             ` Guenter Roeck
2015-10-26 16:24               ` [PATCH 0/2] hwmon: ina2xx: convert driver to using regmap Marc Titinger
2015-10-26 16:24               ` [PATCH 1/2] " Marc Titinger
2015-10-27  1:02                 ` Guenter Roeck
2015-10-27  1:12                 ` Guenter Roeck
2015-10-27  9:51                   ` [PATCH v2 " Marc Titinger
2015-10-28  2:47                     ` Guenter Roeck
2015-10-28  9:23                       ` Marc Titinger [this message]
2015-10-26 16:24               ` [PATCH 2/2] hwmon: ina2xx: give precedence to DT over checking for platform data Marc Titinger
2015-10-27  1:10                 ` Guenter Roeck
2015-10-27  9:51                   ` [PATCH v2 " Marc Titinger
2015-10-23 16:55         ` [RFC] hwmon: ina2xx: port to using remap, improve bandwidth kbuild test robot
2015-10-23 20:10         ` kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5630942F.1020705@baylibre.com \
    --to=mtitinger@baylibre.com \
    --cc=bcousson@baylibre.com \
    --cc=jdelvare@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lm-sensors@lm-sensors.org \
    --cc=mturquette@baylibre.com \
    --cc=ptitiano@baylibre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).