Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Pablo Mazzini" <pmazzini@gmail.com>
Cc: linux-hwmon@vger.kernel.org, mfd@lists.linux.dev, lee@kernel.org
Subject: Re: [PATCH 5/7] regulator: sy7636a: report the temperature
Date: Mon, 26 Oct 2026 01:35:40 +0000	[thread overview]
Message-ID: <sashiko-outbox-184583@kernel.org> (raw)
In-Reply-To: <20261026003918.155321-6-pmazzini@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] regulator: sy7636a: registering hwmon device outside drivers/hwmon/
--

commit 3011502577fb90233215473b5182522faa4b0058
Author: Pablo Mazzini <pmazzini@gmail.com>

regulator: sy7636a: report the temperature

This commit removes the dedicated sy7636a hardware monitoring driver and
moves temperature reporting into the sy7636a regulator driver, reading the
thermistor register only when the rails are enabled.

> diff --git a/drivers/regulator/sy7636a-regulator.c b/drivers/regulator/sy7636a-regulator.c
> index 5705599d1b55e..816df7716c0e0 100644
> --- a/drivers/regulator/sy7636a-regulator.c
> +++ b/drivers/regulator/sy7636a-regulator.c

[ ... ]

> @@ -147,6 +148,52 @@ static const struct regulator_desc desc = {
>  	.of_match = of_match_ptr("vcom"),
>  };
>  
> +static int sy7636a_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
> +			      u32 attr, int channel, long *temp)
> +{
> +	struct sy7636a_data *data = dev_get_drvdata(dev);
> +	unsigned int mode, val;
> +	int ret;
> +
> +	ret = regmap_read(data->regmap, SY7636A_REG_OPERATION_MODE_CRL, &mode);
> +	if (ret)
> +		return ret;
> +
> +	/* the thermistor is only sampled while the rails are on */
> +	if (!(mode & SY7636A_OPERATION_MODE_CRL_ONOFF))
> +		return -ENODATA;
> +
> +	ret = regmap_read(data->regmap, SY7636A_REG_TERMISTOR_READOUT, &val);
> +	if (ret)
> +		return ret;
> +
> +	*temp = (s8)val * 1000;
> +
> +	return 0;
> +}

[ ... ]

> @@ -235,6 +282,15 @@ static int sy7636a_regulator_probe(struct platform_device *pdev)
>  		return PTR_ERR(rdev);
>  	}
>  
> +	if (IS_REACHABLE(CONFIG_HWMON)) {
> +		struct device *hwmon_dev;
> +
> +		hwmon_dev = devm_hwmon_device_register_with_info(&pdev->dev, "sy7636a", data,
> +								 &sy7636a_hwmon_chip_info, NULL);
> +		if (IS_ERR(hwmon_dev))
> +			dev_notice(&pdev->dev, "failed to register hwmon\n");
> +	}

[Severity: Medium]
Should the hardware monitoring driver remain in drivers/hwmon/ rather than
calling devm_hwmon_device_register_with_info() directly from
sy7636a_regulator_probe() in drivers/regulator/sy7636a-regulator.c?

Hardware monitoring drivers are expected to reside in drivers/hwmon/, and
when a chip's primary functionality is in another subsystem, its hardware
monitoring support should be implemented as an auxiliary or subdevice driver
in drivers/hwmon/ rather than registering a hwmon device directly from
outside drivers/hwmon/.

While the follow-up commit ("regulator: sy7636a: bind to the i2c device
directly") removes the mfd cell table in drivers/mfd/simple-mfd-i2c.c,
sy7636a_hwmon_read() only accesses the shared regmap via regmap_read() and
does not depend on internal regulator driver state. Could the temperature
reading check be kept in drivers/hwmon/sy7636a-hwmon.c (for instance via an
auxiliary device registered by the regulator driver)?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261026003918.155321-1-pmazzini@gmail.com?part=5

  reply	other threads:[~2026-10-26  1:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-26  0:39 [PATCH 0/7] sy7636a: power the panel only during updates Pablo Mazzini
2026-10-26  0:39 ` [PATCH 5/7] regulator: sy7636a: report the temperature Pablo Mazzini
2026-10-26  1:35   ` sashiko-bot [this message]
2026-10-26  2:10     ` Pablo Mazzini
2026-10-26  8:42   ` Andreas Kemnade
2026-10-26 14:35   ` Guenter Roeck
2026-10-26 23:26     ` Andreas Kemnade
2026-10-27  7:32       ` Pablo Mazzini
2026-10-27  9:18         ` Andreas Kemnade
2026-10-27 21:32           ` Andreas Kemnade
2026-10-26  0:39 ` [PATCH 6/7] regulator: sy7636a: bind to the I2C device directly Pablo Mazzini
2026-10-26  1:26   ` sashiko-bot
2026-10-26  9:37 ` [PATCH 0/7] sy7636a: power the panel only during updates Andreas Kemnade
2026-10-26 11:28   ` Pablo Mazzini

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=sashiko-outbox-184583@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=mfd@lists.linux.dev \
    --cc=pmazzini@gmail.com \
    --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