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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKR-sGcLkihNKAQpPR6y3u2aCA6xmTd0mp2Ko15e3QZWrc4Dgg@mail.gmail.com>
Date: Fri, 4 Jul 2025 09:26:16 +0200
From: Álvaro Fernández Rojas <noltari@...il.com>
To: Guenter Roeck <linux@...ck-us.net>
Cc: Krzysztof Kozlowski <krzk@...nel.org>, jdelvare@...e.com, robh@...nel.org, krzk+dt@...nel.org, 
	conor+dt@...nel.org, corbet@....net, linux-hwmon@...r.kernel.org, 
	devicetree@...r.kernel.org, linux-kernel@...r.kernel.org, 
	linux-doc@...r.kernel.org
Subject: Re: [PATCH] drivers: hwmon: add EMC2101 driver

Hi Guenter,

El vie, 4 jul 2025 a las 2:25, Guenter Roeck (<linux@...ck-us.net>) escribió:
>
> On Thu, Jul 03, 2025 at 09:23:41AM +0200, Álvaro Fernández Rojas wrote:
> > >
> > > Add a comment describing what you are protecting here. It looks so far
> > > like you could just use regmap and drop the mutex, but I didn't check
> > > thoroughly.
> >
> > The EMC2101 datasheet is explicit about the Look Up Table registers
> > (REG_FAN_LUT_TEMP and REG_FAN_LUT_SPEED) being RO if FAN_LUT_DISABLE
> > isn't set, so I believe that we need the mutex even if we switch to
> > regmap.
> > I will add an explanation with that in the next version.
> > Should I still switch the implementation to regmap considering that we
> > need a mutex?
> >
> What does r/w vs. r/o register access have to do with locking ?

FAN_LUT_DISABLE bit can be set or cleared when pwm_enable is modified,
but we need it to be set in order to be able to modify
REG_FAN_LUT_TEMP and REG_FAN_LUT_SPEED registers.
If FAN_LUT_DISABLE bit isn't set, any attempt to modify
REG_FAN_LUT_TEMP and REG_FAN_LUT_SPEED registers won't work because
they would be RO.
Therefore, we need a lock to ensure that FAN_LUT_DISABLE is kept while
modifying those registers.
Please, take a look at emc2101_pwm_enable_write() and
__pwm_auto_point_temp_store().

>
> Guenter

Best regards,
Álvaro.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ