All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4] hwmon: (tmp401) Add OF device ID table
@ 2022-05-03 11:43 Camel Guo
  2022-05-03 13:44 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Camel Guo @ 2022-05-03 11:43 UTC (permalink / raw)
  To: Guenter Roeck, Jean Delvare
  Cc: Camel Guo, Wolfram Sang, Javier Martinez Canillas, linux-hwmon,
	linux-kernel, kernel

This driver doesn't have of_match_table. This makes the kernel module
tmp401.ko lack alias patterns (e.g: of:N*T*Cti,tmp411) to match DT node
of the supported devices hence this kernel module will not be
automatically loaded.

After adding of_match_table to this driver, the folllowing alias will be
added into tmp401.ko.
$ modinfo drivers/hwmon/tmp401.ko
filename: drivers/hwmon/tmp401.ko
......
author:         Hans de Goede <hdegoede@redhat.com>
alias:          of:N*T*Cti,tmp435C*
alias:          of:N*T*Cti,tmp435
alias:          of:N*T*Cti,tmp432C*
alias:          of:N*T*Cti,tmp432
alias:          of:N*T*Cti,tmp431C*
alias:          of:N*T*Cti,tmp431
alias:          of:N*T*Cti,tmp411C*
alias:          of:N*T*Cti,tmp411
alias:          of:N*T*Cti,tmp401C*
alias:          of:N*T*Cti,tmp401
......

Fixes: af503716ac14 ("i2c: core: report OF style module alias for devices registered via OF")
Signed-off-by: Camel Guo <camel.guo@axis.com>
---

Notes:
    v4:
     - Rewrite commit message due to improper description in old one
    v3:
     - Copy commit message from commit 72fc64c68decf119466 ("hwmon: (tmp103)
       Add OF device ID table")
     - Add Fixes tag
    v2:
     - Put evidence and circumstances in commit message

 drivers/hwmon/tmp401.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/hwmon/tmp401.c b/drivers/hwmon/tmp401.c
index b86d9df7105d..52c9e7d3f2ae 100644
--- a/drivers/hwmon/tmp401.c
+++ b/drivers/hwmon/tmp401.c
@@ -708,10 +708,21 @@ static int tmp401_probe(struct i2c_client *client)
 	return 0;
 }
 
+static const struct of_device_id __maybe_unused tmp4xx_of_match[] = {
+	{ .compatible = "ti,tmp401", },
+	{ .compatible = "ti,tmp411", },
+	{ .compatible = "ti,tmp431", },
+	{ .compatible = "ti,tmp432", },
+	{ .compatible = "ti,tmp435", },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, tmp4xx_of_match);
+
 static struct i2c_driver tmp401_driver = {
 	.class		= I2C_CLASS_HWMON,
 	.driver = {
 		.name	= "tmp401",
+		.of_match_table = of_match_ptr(tmp4xx_of_match),
 	},
 	.probe_new	= tmp401_probe,
 	.id_table	= tmp401_id,

base-commit: 38d741cb70b30741c0e802cbed7bd9cf4fd15fa4
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v4] hwmon: (tmp401) Add OF device ID table
  2022-05-03 11:43 [PATCH v4] hwmon: (tmp401) Add OF device ID table Camel Guo
@ 2022-05-03 13:44 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2022-05-03 13:44 UTC (permalink / raw)
  To: Camel Guo
  Cc: Jean Delvare, Wolfram Sang, Javier Martinez Canillas,
	linux-hwmon, linux-kernel, kernel

On Tue, May 03, 2022 at 01:43:33PM +0200, Camel Guo wrote:
> This driver doesn't have of_match_table. This makes the kernel module
> tmp401.ko lack alias patterns (e.g: of:N*T*Cti,tmp411) to match DT node
> of the supported devices hence this kernel module will not be
> automatically loaded.
> 
> After adding of_match_table to this driver, the folllowing alias will be
> added into tmp401.ko.
> $ modinfo drivers/hwmon/tmp401.ko
> filename: drivers/hwmon/tmp401.ko
> ......
> author:         Hans de Goede <hdegoede@redhat.com>
> alias:          of:N*T*Cti,tmp435C*
> alias:          of:N*T*Cti,tmp435
> alias:          of:N*T*Cti,tmp432C*
> alias:          of:N*T*Cti,tmp432
> alias:          of:N*T*Cti,tmp431C*
> alias:          of:N*T*Cti,tmp431
> alias:          of:N*T*Cti,tmp411C*
> alias:          of:N*T*Cti,tmp411
> alias:          of:N*T*Cti,tmp401C*
> alias:          of:N*T*Cti,tmp401
> ......
> 
> Fixes: af503716ac14 ("i2c: core: report OF style module alias for devices registered via OF")
> Signed-off-by: Camel Guo <camel.guo@axis.com>

Applied.

Thanks,
Guenter

> ---
> 
> Notes:
>     v4:
>      - Rewrite commit message due to improper description in old one
>     v3:
>      - Copy commit message from commit 72fc64c68decf119466 ("hwmon: (tmp103)
>        Add OF device ID table")
>      - Add Fixes tag
>     v2:
>      - Put evidence and circumstances in commit message
> 
>  drivers/hwmon/tmp401.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> 
> base-commit: 38d741cb70b30741c0e802cbed7bd9cf4fd15fa4
> 
> diff --git a/drivers/hwmon/tmp401.c b/drivers/hwmon/tmp401.c
> index b86d9df7105d..52c9e7d3f2ae 100644
> --- a/drivers/hwmon/tmp401.c
> +++ b/drivers/hwmon/tmp401.c
> @@ -708,10 +708,21 @@ static int tmp401_probe(struct i2c_client *client)
>  	return 0;
>  }
>  
> +static const struct of_device_id __maybe_unused tmp4xx_of_match[] = {
> +	{ .compatible = "ti,tmp401", },
> +	{ .compatible = "ti,tmp411", },
> +	{ .compatible = "ti,tmp431", },
> +	{ .compatible = "ti,tmp432", },
> +	{ .compatible = "ti,tmp435", },
> +	{ },
> +};
> +MODULE_DEVICE_TABLE(of, tmp4xx_of_match);
> +
>  static struct i2c_driver tmp401_driver = {
>  	.class		= I2C_CLASS_HWMON,
>  	.driver = {
>  		.name	= "tmp401",
> +		.of_match_table = of_match_ptr(tmp4xx_of_match),
>  	},
>  	.probe_new	= tmp401_probe,
>  	.id_table	= tmp401_id,

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-03 13:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-03 11:43 [PATCH v4] hwmon: (tmp401) Add OF device ID table Camel Guo
2022-05-03 13:44 ` Guenter Roeck

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.