diff mbox series

[2/9] rtc: ds1307: Convert to .probe_new()

Message ID 20221021130706.178687-3-u.kleine-koenig@pengutronix.de
State Changes Requested
Headers show
Series rtc: Convert i2c drivers to .probe_new() | expand

Commit Message

Uwe Kleine-König Oct. 21, 2022, 1:06 p.m. UTC
.probe_new() doesn't get the i2c_device_id * parameter, so determine
that explicitly in .probe().

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/rtc/rtc-ds1307.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Alexandre Belloni Nov. 2, 2022, 4:24 p.m. UTC | #1
On 21/10/2022 15:06:59+0200, Uwe Kleine-König wrote:
> .probe_new() doesn't get the i2c_device_id * parameter, so determine
> that explicitly in .probe().
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/rtc/rtc-ds1307.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
> index d51565bcc189..70a6755a7d69 100644
> --- a/drivers/rtc/rtc-ds1307.c
> +++ b/drivers/rtc/rtc-ds1307.c
> @@ -1712,9 +1712,9 @@ static const struct regmap_config regmap_config = {
>  	.val_bits = 8,
>  };
>  
> -static int ds1307_probe(struct i2c_client *client,
> -			const struct i2c_device_id *id)
> +static int ds1307_probe(struct i2c_client *client)
>  {
> +	const struct i2c_device_id *id;
>  	struct ds1307		*ds1307;
>  	const void		*match;
>  	int			err = -ENODEV;
> @@ -1746,7 +1746,7 @@ static int ds1307_probe(struct i2c_client *client,
>  	if (match) {
>  		ds1307->type = (enum ds_type)match;
>  		chip = &chips[ds1307->type];
> -	} else if (id) {
> +	} else if ((id = i2c_match_id(ds1307_id, client))) {

This is not proper style for the kernel and it introduces a checkpatch
error.

>  		chip = &chips[id->driver_data];
>  		ds1307->type = id->driver_data;
>  	} else {
> @@ -2011,7 +2011,7 @@ static struct i2c_driver ds1307_driver = {
>  		.name	= "rtc-ds1307",
>  		.of_match_table = ds1307_of_match,
>  	},
> -	.probe		= ds1307_probe,
> +	.probe_new	= ds1307_probe,
>  	.id_table	= ds1307_id,
>  };
>  
> -- 
> 2.37.2
>
diff mbox series

Patch

diff --git a/drivers/rtc/rtc-ds1307.c b/drivers/rtc/rtc-ds1307.c
index d51565bcc189..70a6755a7d69 100644
--- a/drivers/rtc/rtc-ds1307.c
+++ b/drivers/rtc/rtc-ds1307.c
@@ -1712,9 +1712,9 @@  static const struct regmap_config regmap_config = {
 	.val_bits = 8,
 };
 
-static int ds1307_probe(struct i2c_client *client,
-			const struct i2c_device_id *id)
+static int ds1307_probe(struct i2c_client *client)
 {
+	const struct i2c_device_id *id;
 	struct ds1307		*ds1307;
 	const void		*match;
 	int			err = -ENODEV;
@@ -1746,7 +1746,7 @@  static int ds1307_probe(struct i2c_client *client,
 	if (match) {
 		ds1307->type = (enum ds_type)match;
 		chip = &chips[ds1307->type];
-	} else if (id) {
+	} else if ((id = i2c_match_id(ds1307_id, client))) {
 		chip = &chips[id->driver_data];
 		ds1307->type = id->driver_data;
 	} else {
@@ -2011,7 +2011,7 @@  static struct i2c_driver ds1307_driver = {
 		.name	= "rtc-ds1307",
 		.of_match_table = ds1307_of_match,
 	},
-	.probe		= ds1307_probe,
+	.probe_new	= ds1307_probe,
 	.id_table	= ds1307_id,
 };