Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Romain Gantois" <romain.gantois@bootlin.com>
Cc: robh@kernel.org, conor+dt@kernel.org,
	linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 2/2] hwmon: (adt7462) Add of_match_table to support devicetree
Date: Wed, 03 Jun 2026 11:40:26 +0000	[thread overview]
Message-ID: <20260603114026.709611F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260603-adt7462-bindings-v1-2-301304bcf774@bootlin.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Using `of_match_ptr()` prevents the driver from being matched via ACPI PRP0001 when `CONFIG_OF` is disabled.
--

commit c2691e00dcd763957c6a2291880ea9079be2bbda
Author: Kory Maincent <kory.maincent@bootlin.com>

hwmon: (adt7462) Add of_match_table to support devicetree

This commit adds an of_match_table to the adt7462 driver to enable
devicetree probing.

> diff --git a/drivers/hwmon/adt7462.c b/drivers/hwmon/adt7462.c
> index 174dfee47f7a7..ef6e5252dc0a4 100644
> --- a/drivers/hwmon/adt7462.c
> +++ b/drivers/hwmon/adt7462.c
[ ... ]
> @@ -1814,10 +1814,17 @@ static const struct i2c_device_id adt7462_id[] = {
>  };
>  MODULE_DEVICE_TABLE(i2c, adt7462_id);
>  
> +static const struct of_device_id __maybe_unused adt7462_of_match[] = {
> +	{ .compatible = "adi,adt7462" },
> +	{ },
> +};
> +MODULE_DEVICE_TABLE(of, adt7462_of_match);
> +
>  static struct i2c_driver adt7462_driver = {
>  	.class		= I2C_CLASS_HWMON,
>  	.driver = {
>  		.name	= "adt7462",
> +		.of_match_table = of_match_ptr(adt7462_of_match),

[Severity: Low]
Does using of_match_ptr() here prevent the driver from being matched via
ACPI PRP0001 when CONFIG_OF is disabled?

When CONFIG_OF is disabled, of_match_ptr() evaluates to NULL, hiding the
of_match_table from the driver core. This prevents the driver from being
matched using ACPI PRP0001, which relies on OF compatible strings even on
systems without Device Tree.

Would it be better to drop of_match_ptr() and assign the table directly,
along with removing the __maybe_unused attribute from adt7462_of_match?

>  	},
>  	.probe		= adt7462_probe,
>  	.id_table	= adt7462_id,

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260603-adt7462-bindings-v1-0-301304bcf774@bootlin.com?part=2

      reply	other threads:[~2026-06-03 11:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-03 11:10 [PATCH 0/2] hwmon: (adt7462) Support probing via device tree Romain Gantois
2026-06-03 11:10 ` [PATCH 1/2] dt-binding: hwmon: Add binding for ADT7462 Romain Gantois
2026-06-03 11:35   ` sashiko-bot
2026-06-03 12:02     ` Romain Gantois
2026-06-03 11:10 ` [PATCH 2/2] hwmon: (adt7462) Add of_match_table to support devicetree Romain Gantois
2026-06-03 11:40   ` sashiko-bot [this message]

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=20260603114026.709611F00893@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=robh@kernel.org \
    --cc=romain.gantois@bootlin.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