linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hwmon: (tmp513) use simple i2c probe
@ 2020-08-21 16:02 Stephen Kitt
  2020-08-21 18:30 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Kitt @ 2020-08-21 16:02 UTC (permalink / raw)
  To: Eric Tremblay, 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/tmp513.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/hwmon/tmp513.c b/drivers/hwmon/tmp513.c
index df66e0bc1253..9f5885b0eb74 100644
--- a/drivers/hwmon/tmp513.c
+++ b/drivers/hwmon/tmp513.c
@@ -709,8 +709,7 @@ static int tmp51x_configure(struct device *dev, struct tmp51x_data *data)
 	return 0;
 }
 
-static int tmp51x_probe(struct i2c_client *client,
-			const struct i2c_device_id *id)
+static int tmp51x_probe(struct i2c_client *client)
 {
 	struct device *dev = &client->dev;
 	struct tmp51x_data *data;
@@ -724,7 +723,7 @@ static int tmp51x_probe(struct i2c_client *client,
 	if (client->dev.of_node)
 		data->id = (enum tmp51x_ids)device_get_match_data(&client->dev);
 	else
-		data->id = id->driver_data;
+		data->id = i2c_match_id(tmp51x_id, client)->driver_data;
 
 	ret = tmp51x_configure(dev, data);
 	if (ret < 0) {
@@ -751,7 +750,7 @@ static int tmp51x_probe(struct i2c_client *client,
 	if (IS_ERR(hwmon_dev))
 		return PTR_ERR(hwmon_dev);
 
-	dev_dbg(dev, "power monitor %s\n", id->name);
+	dev_dbg(dev, "power monitor %s\n", client->name);
 
 	return 0;
 }
@@ -761,7 +760,7 @@ static struct i2c_driver tmp51x_driver = {
 		.name	= "tmp51x",
 		.of_match_table = of_match_ptr(tmp51x_of_match),
 	},
-	.probe		= tmp51x_probe,
+	.probe_new	= tmp51x_probe,
 	.id_table	= tmp51x_id,
 };
 
-- 
2.25.4


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

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

On Fri, Aug 21, 2020 at 06:02:31PM +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/tmp513.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/hwmon/tmp513.c b/drivers/hwmon/tmp513.c
> index df66e0bc1253..9f5885b0eb74 100644
> --- a/drivers/hwmon/tmp513.c
> +++ b/drivers/hwmon/tmp513.c
> @@ -709,8 +709,7 @@ static int tmp51x_configure(struct device *dev, struct tmp51x_data *data)
>  	return 0;
>  }
>  
> -static int tmp51x_probe(struct i2c_client *client,
> -			const struct i2c_device_id *id)
> +static int tmp51x_probe(struct i2c_client *client)
>  {
>  	struct device *dev = &client->dev;
>  	struct tmp51x_data *data;
> @@ -724,7 +723,7 @@ static int tmp51x_probe(struct i2c_client *client,
>  	if (client->dev.of_node)
>  		data->id = (enum tmp51x_ids)device_get_match_data(&client->dev);
>  	else
> -		data->id = id->driver_data;
> +		data->id = i2c_match_id(tmp51x_id, client)->driver_data;
>  
>  	ret = tmp51x_configure(dev, data);
>  	if (ret < 0) {
> @@ -751,7 +750,7 @@ static int tmp51x_probe(struct i2c_client *client,
>  	if (IS_ERR(hwmon_dev))
>  		return PTR_ERR(hwmon_dev);
>  
> -	dev_dbg(dev, "power monitor %s\n", id->name);
> +	dev_dbg(dev, "power monitor %s\n", client->name);
>  
>  	return 0;
>  }
> @@ -761,7 +760,7 @@ static struct i2c_driver tmp51x_driver = {
>  		.name	= "tmp51x",
>  		.of_match_table = of_match_ptr(tmp51x_of_match),
>  	},
> -	.probe		= tmp51x_probe,
> +	.probe_new	= tmp51x_probe,
>  	.id_table	= tmp51x_id,
>  };
>  

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

end of thread, other threads:[~2020-08-21 18:30 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:02 [PATCH] hwmon: (tmp513) use simple i2c probe Stephen Kitt
2020-08-21 18:30 ` 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).