All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Birk Skyum" <birk.skyum@pm.me>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [RFC PATCH 2/2] platform: arm64: qcom-hamoa-ec: test sensor and variant handling
Date: Tue, 08 Sep 2026 02:07:11 +0000	[thread overview]
Message-ID: <20260908020711.ED17B1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260908015650.84401-3-birk.skyum@pm.me>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Unresolvable devres reference loop causes a permanent hang during KUnit test cleanup.
- [Medium] Hardware monitoring device registered from a platform driver outside of drivers/hwmon/.
--

commit 10084c21cb97238d4ea1fb5148e02186d2b75bb5
Author: Birk Skyum <birk.skyum@pm.me>

platform: arm64: qcom-hamoa-ec: test sensor and variant handling

This commit introduces KUnit tests for the Qualcomm EC driver's sensor
transactions and read-only callbacks. The tests simulate an I2C adapter to
verify RPM decoding, short transfers, and error propagation without
accessing a physical EC.

> diff --git a/drivers/platform/arm64/qcom-hamoa-ec-test.c b/drivers/platform/arm64/qcom-hamoa-ec-test.c
> new file mode 100644
> index 0000000000000..68868ef7625ae
> --- /dev/null
> +++ b/drivers/platform/arm64/qcom-hamoa-ec-test.c
[ ... ]
> @@ -0,0 +1,294 @@
[ ... ]
> +static void qcom_ec_probe_sensor_test(struct kunit *test)
> +{
> +	struct qcom_ec_test_context *ctx = test->priv;
> +
> +	KUNIT_EXPECT_EQ(test, qcom_ec_hwmon_probe(&ctx->ec), 0);

[Severity: High]
Does manually invoking qcom_ec_hwmon_probe() on a dummy I2C client cause a
permanent kernel hang during test cleanup?

The KUnit test creates a dummy I2C client using i2c_new_dummy_device(),
which lacks a bound driver. When qcom_ec_hwmon_probe() is manually invoked,
it allocates a child hwmon device via devm_hwmon_device_register_with_info():

drivers/platform/arm64/qcom-hamoa-ec.c:qcom_ec_hwmon_probe() {
    ...
    hwmon = devm_hwmon_device_register_with_info(dev, "qcom_ec", ec,
                                                 &qcom_ec_hwmon_chip_info,
                                                 NULL);
    ...
}

Because the dummy client has no bound driver, devres cleanup is deferred
until its kobject refcount reaches zero. However, the registered child hwmon
device takes a kobject reference on the dummy client. This creates an
unresolvable cycle where the parent refcount cannot reach zero until the
child hwmon device is unregistered, which is supposed to happen in the
devres cleanup.

This prevents the dummy client from being freed, causing the subsequent
i2c_del_adapter() in test cleanup to block forever in
wait_for_completion(&adap->dev_released).

[Severity: Medium]
Does this code register a hardware monitoring device from a driver located
outside of the drivers/hwmon/ directory?

The hwmon subsystem architecture requires that hardware monitoring devices
be registered from drivers residing in drivers/hwmon/. If the main
functionality of the chip is not hardware monitoring, the hardware
monitoring functionality should be implemented as an auxiliary device driver
residing in drivers/hwmon/.

Here, devm_hwmon_device_register_with_info() is called directly by a
platform driver located in drivers/platform/arm64/:

drivers/platform/arm64/qcom-hamoa-ec.c:qcom_ec_hwmon_probe() {
    ...
    hwmon = devm_hwmon_device_register_with_info(dev, "qcom_ec", ec,
                                                 &qcom_ec_hwmon_chip_info,
                                                 NULL);
    ...
}

> +	KUNIT_EXPECT_EQ(test, ctx->transactions, 1);
> +	KUNIT_EXPECT_EQ(test, ctx->writes, 0);
> +	ctx->reply[0] = 0;
> +	KUNIT_EXPECT_EQ(test, qcom_ec_hwmon_probe(&ctx->ec), -EPROTO);
> +	KUNIT_EXPECT_EQ(test, ctx->writes, 0);
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260908015650.84401-1-birk.skyum@pm.me?part=2

  reply	other threads:[~2026-09-08  2:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-08  1:57 [RFC PATCH 0/2] Monitor Yoga Slim 7x EC sensors without taking over cooling Birk Skyum
2026-09-08  1:57 ` [RFC PATCH 1/2] platform: arm64: qcom-hamoa-ec: monitor Slim 7x legacy sensors Birk Skyum
2026-09-08  2:03   ` sashiko-bot
2026-09-08  5:25   ` Guenter Roeck
2026-09-08  1:57 ` [RFC PATCH 2/2] platform: arm64: qcom-hamoa-ec: test sensor and variant handling Birk Skyum
2026-09-08  2:07   ` sashiko-bot [this message]
2026-09-08  2:18     ` Birk Skyum
2026-09-08  5:26       ` 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=20260908020711.ED17B1F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=birk.skyum@pm.me \
    --cc=linux-hwmon@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.