linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hwmon: (dme1737) use simple i2c probe
@ 2020-08-21 16:00 Stephen Kitt
  2020-08-21 18:31 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Kitt @ 2020-08-21 16:00 UTC (permalink / raw)
  To: Juerg Haefliger, Jean Delvare, Guenter Roeck, linux-hwmon
  Cc: linux-kernel, Stephen Kitt

As part of the ongoing i2c transition to the simple probe
("probe_new"), this patch uses i2c_match_id to retrieve the
driver_data for the probed device. The id parameter is thus no longer
necessary and the simple probe can be used instead.

Signed-off-by: Stephen Kitt <steve@sk2.org>
---
 drivers/hwmon/dme1737.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/hwmon/dme1737.c b/drivers/hwmon/dme1737.c
index c3472b73fa79..c1e4cfb40c3d 100644
--- a/drivers/hwmon/dme1737.c
+++ b/drivers/hwmon/dme1737.c
@@ -2461,8 +2461,9 @@ static int dme1737_i2c_detect(struct i2c_client *client,
 	return 0;
 }
 
-static int dme1737_i2c_probe(struct i2c_client *client,
-			     const struct i2c_device_id *id)
+static const struct i2c_device_id dme1737_id[];
+
+static int dme1737_i2c_probe(struct i2c_client *client)
 {
 	struct dme1737_data *data;
 	struct device *dev = &client->dev;
@@ -2473,7 +2474,7 @@ static int dme1737_i2c_probe(struct i2c_client *client,
 		return -ENOMEM;
 
 	i2c_set_clientdata(client, data);
-	data->type = id->driver_data;
+	data->type = i2c_match_id(dme1737_id, client)->driver_data;
 	data->client = client;
 	data->name = client->name;
 	mutex_init(&data->update_lock);
@@ -2529,7 +2530,7 @@ static struct i2c_driver dme1737_i2c_driver = {
 	.driver = {
 		.name = "dme1737",
 	},
-	.probe = dme1737_i2c_probe,
+	.probe_new = dme1737_i2c_probe,
 	.remove = dme1737_i2c_remove,
 	.id_table = dme1737_id,
 	.detect = dme1737_i2c_detect,
-- 
2.25.4


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

* Re: [PATCH] hwmon: (dme1737) use simple i2c probe
  2020-08-21 16:00 [PATCH] hwmon: (dme1737) use simple i2c probe Stephen Kitt
@ 2020-08-21 18:31 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2020-08-21 18:31 UTC (permalink / raw)
  To: Stephen Kitt; +Cc: Juerg Haefliger, Jean Delvare, linux-hwmon, linux-kernel

On Fri, Aug 21, 2020 at 06:00:35PM +0200, Stephen Kitt wrote:
> As part of the ongoing i2c transition to the simple probe
> ("probe_new"), this patch uses i2c_match_id to retrieve the
> driver_data for the probed device. The id parameter is thus no longer
> necessary and the simple probe can be used instead.
> 
> Signed-off-by: Stephen Kitt <steve@sk2.org>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/dme1737.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/hwmon/dme1737.c b/drivers/hwmon/dme1737.c
> index c3472b73fa79..c1e4cfb40c3d 100644
> --- a/drivers/hwmon/dme1737.c
> +++ b/drivers/hwmon/dme1737.c
> @@ -2461,8 +2461,9 @@ static int dme1737_i2c_detect(struct i2c_client *client,
>  	return 0;
>  }
>  
> -static int dme1737_i2c_probe(struct i2c_client *client,
> -			     const struct i2c_device_id *id)
> +static const struct i2c_device_id dme1737_id[];
> +
> +static int dme1737_i2c_probe(struct i2c_client *client)
>  {
>  	struct dme1737_data *data;
>  	struct device *dev = &client->dev;
> @@ -2473,7 +2474,7 @@ static int dme1737_i2c_probe(struct i2c_client *client,
>  		return -ENOMEM;
>  
>  	i2c_set_clientdata(client, data);
> -	data->type = id->driver_data;
> +	data->type = i2c_match_id(dme1737_id, client)->driver_data;
>  	data->client = client;
>  	data->name = client->name;
>  	mutex_init(&data->update_lock);
> @@ -2529,7 +2530,7 @@ static struct i2c_driver dme1737_i2c_driver = {
>  	.driver = {
>  		.name = "dme1737",
>  	},
> -	.probe = dme1737_i2c_probe,
> +	.probe_new = dme1737_i2c_probe,
>  	.remove = dme1737_i2c_remove,
>  	.id_table = dme1737_id,
>  	.detect = dme1737_i2c_detect,

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

end of thread, other threads:[~2020-08-21 18:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-21 16:00 [PATCH] hwmon: (dme1737) use simple i2c probe Stephen Kitt
2020-08-21 18:31 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).