lkml.org 
[lkml]   [2018]   [Nov]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] hwmon (ina3221) Add mutex lock to shunt nodes
On Mon, Nov 12, 2018 at 08:31:22PM -0800, Guenter Roeck wrote:
> On Mon, Nov 12, 2018 at 08:23:24PM -0800, Nicolin Chen wrote:
> > The shunt resistor values are used to calculate shunt voltages
> > and currents. As a part of sysfs nodes, it would be better to
> > get protected with the same mutex too as other sysfs ABI nodes,
> > although this is not very critical because the mutex was added
> > to mainly protect register access.
> >
> > So this patch adds the mutex lock to protect the shunt node.
> >
>
> I am missing something here. I don't see the point of this mutex.
> It just reads a variable and reports the result. When setting,
> it just writes a value. Protecting the conversion of the passed
> value with a mutex is pointless. Protecting writing the value
> against reading it is just as pointless.

The penalty here is that the resistor value would be mismatched
between here and the ongoing calculation when a race happens to
the sysfs accesses. But I feel it might not be really that hurt
to allow it happen.

Let's just drop it then: the mutex was used to protect register
read/writes any way.

Thanks
Nicolin

\
 
 \ /
  Last update: 2018-11-13 05:43    [W:0.037 / U:0.316 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site