mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Michał Kopeć" <michal.kopec@3mdeb.com>
To: "Filip Gołaś" <filip.golas@3mdeb.com>
Cc: "Hans de Goede" <hansg@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Guenter Roeck" <linux@roeck-us.net>,
	platform-driver-x86@vger.kernel.org, linux-hwmon@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/3] platform/x86: dasharo-acpi: Add EC fan curve support
Date: Thu, 26 Nov 2026 17:55:05 +0100	[thread overview]
Message-ID: <20261126165506.2793034-1-michal.kopec@3mdeb.com> (raw)
In-Reply-To: <20261123105821.305527-4-filip.golas@3mdeb.com>

On Mon, Nov 23, 2026 at 11:58:21AM +0100, Filip Gołaś wrote:

Hi Filip,

Thanks for the V2, a few comments below:

> @@ -78,6 +81,7 @@ struct dasharo_capability {
>
>  struct dasharo_data {
>       struct platform_device *pdev;
> +     struct mutex curve_lock;

The hwmon core already serializes the ->read()/->write() callbacks on
its own lock, and exports hwmon_lock()/hwmon_unlock() (plus a
guard(hwmon_lock)) for attributes in extra groups. Could we use that
instead of a private mutex? It would drop devm_mutex_init(), and it
would also serialize the curve attributes against pwmN_enable/pwmN,
which go through the core. The show callbacks currently take no lock
at all.

> +     val /= MILLIDEGREE_PER_DEGREE;

Nit: DIV_ROUND_CLOSEST() would be more usual for hwmon. Negative
values are already rejected above, so it's safe here.

> +#define DASHARO_POINT_ATTRS(ch, pt) \
> +     static SENSOR_DEVICE_ATTR_2_RW(pwm##ch##_auto_point##pt##_temp, curve_point_temp, \
> +                                    (ch) - 1, (pt) - 1); \
> +     static SENSOR_DEVICE_ATTR_2_RW(pwm##ch##_auto_point##pt##_pwm, curve_point_pwm, \
> +                                    ch - 1, pt - 1)

The parentheses are inconsistent between the two lines; please use
(ch) - 1, (pt) - 1 in both.

> +DASHARO_POINT_ATTRS(1, 1);
> +DASHARO_POINT_ATTRS(1, 2);
> +DASHARO_POINT_ATTRS(1, 3);
> +DASHARO_POINT_ATTRS(1, 4);
> +DASHARO_POINT_ATTRS(2, 1);
> +DASHARO_POINT_ATTRS(2, 2);
> +DASHARO_POINT_ATTRS(2, 3);
> +DASHARO_POINT_ATTRS(2, 4);

The attributes only exist for pwm1 and pwm2, but the driver supports
up to 24 PWM channels. If firmware reports FAN_POINTS for a fan on
pwm3 or above, it silently gets no curve attributes. Please mention
this limit in the commit message, or generate the attributes for all
channels if that's not too much trouble.

Thanks,
Michał

  reply	other threads:[~2026-11-26 16:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 10:58 [PATCH v2 0/3] platform/x86: dasharo-acpi: Add fan control Filip Gołaś
2026-11-23 10:58 ` [PATCH v2 1/3] platform/x86: dasharo-acpi: Extract dasharo_call() from dasharo_read_channel() Filip Gołaś
2026-11-23 10:58 ` [PATCH v2 2/3] platform/x86: dasharo-acpi: Add fan mode and PWM write support Filip Gołaś
2026-11-23 10:58 ` [PATCH v2 3/3] platform/x86: dasharo-acpi: Add EC fan curve support Filip Gołaś
2026-11-26 16:55   ` Michał Kopeć [this message]
2026-11-27  9:02     ` Filip Gołaś

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=20261126165506.2793034-1-michal.kopec@3mdeb.com \
    --to=michal.kopec@3mdeb.com \
    --cc=filip.golas@3mdeb.com \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=platform-driver-x86@vger.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®