From: "Davíð Steinn Geirsson" <david@dsg.is>
To: Guenter Roeck <linux@roeck-us.net>
Cc: "Jean Delvare" <jdelvare@suse.com>,
linux-hwmon@vger.kernel.org, "Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
devicetree@vger.kernel.org,
"Uwe Kleine-König" <ukleinek@kernel.org>,
linux-pwm@vger.kernel.org, "Jonathan Corbet" <corbet@lwn.net>,
"Shuah Khan" <skhan@linuxfoundation.org>,
"Randy Dunlap" <rdunlap@infradead.org>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/4] hwmon: (adt7475) Convert to hwmon_device_register_with_info()
Date: Sun, 15 Nov 2026 14:16:30 +0000 [thread overview]
Message-ID: <avm-tbgWgTJNFTBj@dsg.is> (raw)
In-Reply-To: <d28f392e-82ea-44d6-83e5-9593b341a722@roeck-us.net>
On Fri, Nov 13, 2026 at 10:07:53PM -0800, Guenter Roeck wrote:
> On 11/13/26 16:41, Davíð Steinn Geirsson wrote:
> > Convert the driver from hwmon_device_register_with_groups() to
> > hwmon_device_register_with_info(). The standard voltage, temperature,
> > fan and PWM attributes move to hwmon_ops. The chip-specific attributes
> > stay driver-defined and are passed as extra groups: the automatic fan
> > control points, temperature smoothing, PWM stall disable,
> > pwm_use_point2_pwm_at_crit and the VID attributes.
> >
> > The driver keeps data->lock, although the hwmon core serialises the
> > hwmon_ops callbacks. The attributes in the extra groups run outside that
> > serialisation, and they share the register cache and its periodic update
> > with the hwmon_ops callbacks. They do not take hwmon_lock() instead, to
> > keep this conversion free of locking changes.
> >
>
> I disagree here. If you don't want to change the locks to use the hwmon
> subsystem lock in this patch, add another patch to change the code to
> use it. The subsystem lock was not introduced to be ignored.
Understood. I did notice one issue while planning that change. Patch 4
makes the chip a PWM provider, so its callbacks will also need the
lock. If the consumer is pwm-fan, then when userspace writes pwm-fan's
pwm attribute, the hwmon core holds pwm-fan's lock. pwm-fan then calls
into the PWM core, which calls into adt7475, which then needs to take
its own hwmon lock:
hwmon_attr_store() takes pwm-fan's hwmon lock
pwm_fan_write()
pwm_apply_might_sleep()
adt7475_pwm_write_waveform()
hwmon_lock() takes adt7475's hwmon lock
As far as I can tell no driver does this today. adt7470 and
aspeed-g6-pwm-tach are the other PWM providers I found in drivers/hwmon,
and neither takes the subsystem lock in its PWM callbacks.
I haven't written any code for this yet, so this is based on my read
of the current code only. If correct, I think this would need a hwmon
core change to give each hwmon device its own lockdep class.
I'm not quite confident enough in my understanding of the core to
commit to implementing such a change. But I'd appreciate your thoughts
on this.
>
> Thanks,
> Guenter
>
Thanks again,
Davíð
next prev parent reply other threads:[~2026-11-15 14:16 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-14 0:41 [PATCH 0/4] hwmon: (adt7475) Add thermal sensor and PWM provider support Davíð Steinn Geirsson
2026-11-14 0:41 ` [PATCH 1/4] dt-bindings: hwmon: adt7475: Add #thermal-sensor-cells Davíð Steinn Geirsson
2026-11-14 0:41 ` [PATCH 2/4] hwmon: (adt7475) Convert to hwmon_device_register_with_info() Davíð Steinn Geirsson
2026-11-14 6:07 ` Guenter Roeck
2026-11-15 14:16 ` Davíð Steinn Geirsson [this message]
2026-11-14 0:41 ` [PATCH 3/4] hwmon: (adt7475) Add thermal zone sensor support Davíð Steinn Geirsson
2026-11-14 0:41 ` [PATCH 4/4] hwmon: (adt7475) Expose fan control via PWM framework Davíð Steinn Geirsson
2026-11-14 6:10 ` Guenter Roeck
2026-11-14 1:03 ` [PATCH 0/4] hwmon: (adt7475) Add thermal sensor and PWM provider support Guenter Roeck
2026-11-14 10:23 ` Davíð Steinn Geirsson
2026-11-14 15:57 ` Guenter Roeck
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=avm-tbgWgTJNFTBj@dsg.is \
--to=david@dsg.is \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=jdelvare@suse.com \
--cc=krzk+dt@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=rdunlap@infradead.org \
--cc=robh@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=ukleinek@kernel.org \
/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
all inboxes | Powered by JetHome®