diff mbox series

[v2,2/3] hwmon: tmp513: Simplify probe()

Message ID 20230824204456.401580-3-biju.das.jz@bp.renesas.com (mailing list archive)
State Accepted
Headers show
Series Enhancements for tmp51x driver | expand

Commit Message

Biju Das Aug. 24, 2023, 8:44 p.m. UTC
Simpilfy probe() by replacing device_get_match_data() and id lookup for
retrieving match data by i2c_get_match_data().

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v1->v2:
 * Split from v1.
---
 drivers/hwmon/tmp513.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Guenter Roeck Aug. 25, 2023, 1:26 p.m. UTC | #1
On Thu, Aug 24, 2023 at 09:44:55PM +0100, Biju Das wrote:
> Simpilfy probe() by replacing device_get_match_data() and id lookup for
> retrieving match data by i2c_get_match_data().
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>

Applied.

Thanks,
Guenter

> ---
> v1->v2:
>  * Split from v1.
> ---
>  drivers/hwmon/tmp513.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/hwmon/tmp513.c b/drivers/hwmon/tmp513.c
> index 8ee6e02b02e3..9a180b1030c9 100644
> --- a/drivers/hwmon/tmp513.c
> +++ b/drivers/hwmon/tmp513.c
> @@ -720,10 +720,7 @@ static int tmp51x_probe(struct i2c_client *client)
>  	if (!data)
>  		return -ENOMEM;
>  
> -	if (client->dev.of_node)
> -		data->id = (uintptr_t)device_get_match_data(&client->dev);
> -	else
> -		data->id = i2c_match_id(tmp51x_id, client)->driver_data;
> +	data->id = (uintptr_t)i2c_get_match_data(client);
>  
>  	ret = tmp51x_configure(dev, data);
>  	if (ret < 0) {
diff mbox series

Patch

diff --git a/drivers/hwmon/tmp513.c b/drivers/hwmon/tmp513.c
index 8ee6e02b02e3..9a180b1030c9 100644
--- a/drivers/hwmon/tmp513.c
+++ b/drivers/hwmon/tmp513.c
@@ -720,10 +720,7 @@  static int tmp51x_probe(struct i2c_client *client)
 	if (!data)
 		return -ENOMEM;
 
-	if (client->dev.of_node)
-		data->id = (uintptr_t)device_get_match_data(&client->dev);
-	else
-		data->id = i2c_match_id(tmp51x_id, client)->driver_data;
+	data->id = (uintptr_t)i2c_get_match_data(client);
 
 	ret = tmp51x_configure(dev, data);
 	if (ret < 0) {