lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211008135226.GA1366565@roeck-us.net>
Date:   Fri, 8 Oct 2021 06:52:26 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Zev Weiss <zev@...ilderbeest.net>
Cc:     Jean Delvare <jdelvare@...e.com>, linux-hwmon@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 6/8] hwmon: (pmbus/lm25066) Add OF device ID table

On Tue, Sep 28, 2021 at 02:22:40AM -0700, Zev Weiss wrote:
> See commit 8881a19187e4 ("hwmon: (ucd9000) Add OF device ID table")
> for reasoning.
> 
The actual reasoning should be provided here, not a reference to another
commit. Never mind, I did that.

> Signed-off-by: Zev Weiss <zev@...ilderbeest.net>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/pmbus/lm25066.c | 26 ++++++++++++++++++++++++--
>  1 file changed, 24 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hwmon/pmbus/lm25066.c b/drivers/hwmon/pmbus/lm25066.c
> index dbbf8571c437..18d5a76f346d 100644
> --- a/drivers/hwmon/pmbus/lm25066.c
> +++ b/drivers/hwmon/pmbus/lm25066.c
> @@ -14,6 +14,7 @@
>  #include <linux/slab.h>
>  #include <linux/i2c.h>
>  #include <linux/log2.h>
> +#include <linux/of_device.h>
>  #include "pmbus.h"
>  
>  enum chips { lm25056, lm25066, lm5064, lm5066, lm5066i };
> @@ -444,12 +445,24 @@ static const struct i2c_device_id lm25066_id[] = {
>  };
>  MODULE_DEVICE_TABLE(i2c, lm25066_id);
>  
> +static const struct of_device_id __maybe_unused lm25066_of_match[] = {
> +	{ .compatible = "ti,lm25056", .data = (void*)lm25056, },
> +	{ .compatible = "ti,lm25066", .data = (void*)lm25066, },
> +	{ .compatible = "ti,lm5064",  .data = (void*)lm5064,  },
> +	{ .compatible = "ti,lm5066",  .data = (void*)lm5066,  },
> +	{ .compatible = "ti,lm5066i", .data = (void*)lm5066i, },
> +	{ },
> +};
> +MODULE_DEVICE_TABLE(of, lm25066_of_match);
> +
>  static int lm25066_probe(struct i2c_client *client)
>  {
>  	int config;
>  	struct lm25066_data *data;
>  	struct pmbus_driver_info *info;
>  	const struct __coeff *coeff;
> +	const struct of_device_id *of_id;
> +	const struct i2c_device_id *i2c_id;
>  
>  	if (!i2c_check_functionality(client->adapter,
>  				     I2C_FUNC_SMBUS_READ_BYTE_DATA))
> @@ -464,7 +477,15 @@ static int lm25066_probe(struct i2c_client *client)
>  	if (config < 0)
>  		return config;
>  
> -	data->id = i2c_match_id(lm25066_id, client)->driver_data;
> +	i2c_id = i2c_match_id(lm25066_id, client);
> +
> +	of_id = of_match_device(lm25066_of_match, &client->dev);
> +	if (of_id && (enum chips)of_id->data != i2c_id->driver_data)
> +		dev_notice(&client->dev,
> +		           "Device mismatch: %s in device tree, %s detected\n",
> +		           of_id->name, i2c_id->name);
> +
> +	data->id = i2c_id->driver_data;
>  	info = &data->info;
>  
>  	info->pages = 1;
> @@ -521,7 +542,8 @@ static int lm25066_probe(struct i2c_client *client)
>  static struct i2c_driver lm25066_driver = {
>  	.driver = {
>  		   .name = "lm25066",
> -		   },
> +		   .of_match_table = of_match_ptr(lm25066_of_match),
> +	},
>  	.probe_new = lm25066_probe,
>  	.id_table = lm25066_id,
>  };

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ