From: sashiko-bot@kernel.org
To: "Luiz Angelo Daros de Luca" <luizluca@gmail.com>
Cc: linux-hwmon@vger.kernel.org, robh@kernel.org,
conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [hwmon-next PATCH v5 3/4] hwmon: (adt7470) Expose fan control via PWM framework
Date: Thu, 30 Jul 2026 21:39:29 +0000 [thread overview]
Message-ID: <20260730213930.66FBA1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260730-adt7470_thermalzone-v5-3-42995a6bb8c5@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The ADT7470 driver implements and registers secondary functionality (PWM) directly in the hwmon driver, violating subsystem layering guidelines.
--
--- Patch [3]: [hwmon-next PATCH v5 3/4] hwmon: (adt7470) Expose fan control via PWM framework ---
commit 8476b17bbf277543f8b1034721091c420371204b
Author: Luiz Angelo Daros de Luca <luizluca@gmail.com>
hwmon: (adt7470) Expose fan control via PWM framework
The ADT7470 features four PWM outputs designed to control fans. This commit
exposes the ADT7470 fan control lines through the generic PWM framework,
allowing generic PWM consumers described in Device Tree to manage the fans.
> diff --git a/drivers/hwmon/adt7470.c b/drivers/hwmon/adt7470.c
> index 87ddd7b8ddaea..eeec3db0da88d 100644
> --- a/drivers/hwmon/adt7470.c
> +++ b/drivers/hwmon/adt7470.c
[ ... ]
> @@ -1328,6 +1497,29 @@ static int adt7470_probe(struct i2c_client *client)
>
> data->pwm_freq = (u32)freq_val;
>
> + data->use_pwm_framework = false;
> +
> + if (device_property_present(dev, "#pwm-cells")) {
> + if (IS_REACHABLE(CONFIG_PWM)) {
> + struct pwm_chip *chip;
> +
> + chip = devm_pwmchip_alloc(dev, ADT7470_PWM_COUNT, 0);
> + if (IS_ERR(chip))
> + return PTR_ERR(chip);
> +
> + chip->ops = &adt7470_pwm_ops;
> + pwmchip_set_drvdata(chip, data);
> +
> + err = devm_pwmchip_add(dev, chip);
[Severity: Medium]
Does this violate the hardware monitoring subsystem guidelines?
The guidelines state that if a hardware monitoring device supports secondary
functionality (such as PWM in this case), the secondary functionality should
be implemented as an auxiliary device, with the driver residing in the
appropriate subsystem directory.
Could this PWM functionality be split out into a separate driver under
drivers/pwm/ using the auxiliary bus, rather than implementing the PWM
operations and registration directly in the hwmon driver?
> + if (err)
> + return dev_err_probe(dev, err, "failed to register PWM chip\n");
> +
> + data->use_pwm_framework = true;
> + } else {
> + dev_warn(dev, "#pwm-cells present but CONFIG_PWM disabled. HWMON PWM attributes not hidden.\n");
> + }
> + }
> +
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260730-adt7470_thermalzone-v5-0-42995a6bb8c5@gmail.com?part=3
next prev parent reply other threads:[~2026-07-30 21:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 21:29 [hwmon-next PATCH v5 0/4] hwmon: (adt7470) Add PWM provider and thermal sensor support Luiz Angelo Daros de Luca
2026-07-30 21:29 ` [hwmon-next PATCH v5 1/4] dt-bindings: hwmon: add adi,adt7470 Luiz Angelo Daros de Luca
2026-07-30 21:34 ` sashiko-bot
2026-07-30 21:29 ` [hwmon-next PATCH v5 2/4] hwmon: (adt7470) Add ADT7470_PWM_MAX macro Luiz Angelo Daros de Luca
2026-07-30 21:35 ` sashiko-bot
2026-07-30 21:29 ` [hwmon-next PATCH v5 3/4] hwmon: (adt7470) Expose fan control via PWM framework Luiz Angelo Daros de Luca
2026-07-30 21:39 ` sashiko-bot [this message]
2026-07-30 21:29 ` [hwmon-next PATCH v5 4/4] hwmon: (adt7470) Add thermal zone sensor support Luiz Angelo Daros de Luca
2026-07-30 21:43 ` sashiko-bot
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=20260730213930.66FBA1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=luizluca@gmail.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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).