linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] rtc: convert two drivers to devm_i2c_new_dummy_device()
@ 2019-08-20 15:42 Wolfram Sang
  2019-08-20 15:42 ` [PATCH 1/2] rtc: max77686: convert " Wolfram Sang
  2019-08-20 15:42 ` [PATCH 2/2] rtc: s35390a: " Wolfram Sang
  0 siblings, 2 replies; 10+ messages in thread
From: Wolfram Sang @ 2019-08-20 15:42 UTC (permalink / raw)
  To: linux-i2c; +Cc: Wolfram Sang, linux-kernel, linux-rtc

I was about to simplify the call to i2c_unregister_device() when I
realized that converting to devm_i2c_new_dummy_device() will simplify
the drivers a lot. So I took this approach.

Only build tested, but visually reviewed multiple times.

Wolfram Sang (2):
  rtc: max77686: convert to devm_i2c_new_dummy_device()
  rtc: s35390a: convert to devm_i2c_new_dummy_device()

 drivers/rtc/rtc-max77686.c | 17 +++---------
 drivers/rtc/rtc-s35390a.c  | 54 +++++++++-----------------------------
 2 files changed, 17 insertions(+), 54 deletions(-)

-- 
2.20.1


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

* [PATCH 1/2] rtc: max77686: convert to devm_i2c_new_dummy_device()
  2019-08-20 15:42 [PATCH 0/2] rtc: convert two drivers to devm_i2c_new_dummy_device() Wolfram Sang
@ 2019-08-20 15:42 ` Wolfram Sang
  2019-08-29 20:57   ` Alexandre Belloni
  2019-08-20 15:42 ` [PATCH 2/2] rtc: s35390a: " Wolfram Sang
  1 sibling, 1 reply; 10+ messages in thread
From: Wolfram Sang @ 2019-08-20 15:42 UTC (permalink / raw)
  To: linux-i2c
  Cc: Wolfram Sang, Chanwoo Choi, Krzysztof Kozlowski,
	Bartlomiej Zolnierkiewicz, Alessandro Zummo, Alexandre Belloni,
	linux-kernel, linux-rtc

I was about to simplify the call to i2c_unregister_device() when I
realized that converting to devm_i2c_new_dummy_device() will simplify
the driver a lot. So I took this approach.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
Build tested only, buildbot is happy, too.

Please apply to your tree.

 drivers/rtc/rtc-max77686.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c
index d04fd1024697..4027b33034dc 100644
--- a/drivers/rtc/rtc-max77686.c
+++ b/drivers/rtc/rtc-max77686.c
@@ -693,8 +693,8 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info)
 		goto add_rtc_irq;
 	}
 
-	info->rtc = i2c_new_dummy_device(parent_i2c->adapter,
-				  info->drv_data->rtc_i2c_addr);
+	info->rtc = devm_i2c_new_dummy_device(info->dev, parent_i2c->adapter,
+					      info->drv_data->rtc_i2c_addr);
 	if (IS_ERR(info->rtc)) {
 		dev_err(info->dev, "Failed to allocate I2C device for RTC\n");
 		return PTR_ERR(info->rtc);
@@ -705,7 +705,7 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info)
 	if (IS_ERR(info->rtc_regmap)) {
 		ret = PTR_ERR(info->rtc_regmap);
 		dev_err(info->dev, "Failed to allocate RTC regmap: %d\n", ret);
-		goto err_unregister_i2c;
+		return ret;
 	}
 
 add_rtc_irq:
@@ -715,15 +715,10 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info)
 				  &info->rtc_irq_data);
 	if (ret < 0) {
 		dev_err(info->dev, "Failed to add RTC irq chip: %d\n", ret);
-		goto err_unregister_i2c;
+		return ret;
 	}
 
 	return 0;
-
-err_unregister_i2c:
-	if (info->rtc)
-		i2c_unregister_device(info->rtc);
-	return ret;
 }
 
 static int max77686_rtc_probe(struct platform_device *pdev)
@@ -786,8 +781,6 @@ static int max77686_rtc_probe(struct platform_device *pdev)
 
 err_rtc:
 	regmap_del_irq_chip(info->rtc_irq, info->rtc_irq_data);
-	if (info->rtc)
-		i2c_unregister_device(info->rtc);
 
 	return ret;
 }
@@ -798,8 +791,6 @@ static int max77686_rtc_remove(struct platform_device *pdev)
 
 	free_irq(info->virq, info);
 	regmap_del_irq_chip(info->rtc_irq, info->rtc_irq_data);
-	if (info->rtc)
-		i2c_unregister_device(info->rtc);
 
 	return 0;
 }
-- 
2.20.1


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

* [PATCH 2/2] rtc: s35390a: convert to devm_i2c_new_dummy_device()
  2019-08-20 15:42 [PATCH 0/2] rtc: convert two drivers to devm_i2c_new_dummy_device() Wolfram Sang
  2019-08-20 15:42 ` [PATCH 1/2] rtc: max77686: convert " Wolfram Sang
@ 2019-08-20 15:42 ` Wolfram Sang
  2019-08-29 20:58   ` Alexandre Belloni
  1 sibling, 1 reply; 10+ messages in thread
From: Wolfram Sang @ 2019-08-20 15:42 UTC (permalink / raw)
  To: linux-i2c
  Cc: Wolfram Sang, Alessandro Zummo, Alexandre Belloni, linux-rtc,
	linux-kernel

I was about to simplify the call to i2c_unregister_device() when I
realized that converting to devm_i2c_new_dummy_device() will simplify
the driver a lot. So I took this approach.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
Build tested only, buildbot is happy, too.

Please apply to your tree.

 drivers/rtc/rtc-s35390a.c | 54 ++++++++++-----------------------------
 1 file changed, 13 insertions(+), 41 deletions(-)

diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
index 5826209a3f30..da34cfd70f95 100644
--- a/drivers/rtc/rtc-s35390a.c
+++ b/drivers/rtc/rtc-s35390a.c
@@ -434,37 +434,32 @@ static int s35390a_probe(struct i2c_client *client,
 	char buf, status1;
 	struct device *dev = &client->dev;
 
-	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
-		err = -ENODEV;
-		goto exit;
-	}
+	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
+		return -ENODEV;
 
 	s35390a = devm_kzalloc(dev, sizeof(struct s35390a), GFP_KERNEL);
-	if (!s35390a) {
-		err = -ENOMEM;
-		goto exit;
-	}
+	if (!s35390a)
+		return -ENOMEM;
 
 	s35390a->client[0] = client;
 	i2c_set_clientdata(client, s35390a);
 
 	/* This chip uses multiple addresses, use dummy devices for them */
 	for (i = 1; i < 8; ++i) {
-		s35390a->client[i] = i2c_new_dummy_device(client->adapter,
-					client->addr + i);
+		s35390a->client[i] = devm_i2c_new_dummy_device(dev,
+							       client->adapter,
+							       client->addr + i);
 		if (IS_ERR(s35390a->client[i])) {
 			dev_err(dev, "Address %02x unavailable\n",
 				client->addr + i);
-			err = PTR_ERR(s35390a->client[i]);
-			goto exit_dummy;
+			return PTR_ERR(s35390a->client[i]);
 		}
 	}
 
 	err_read = s35390a_read_status(s35390a, &status1);
 	if (err_read < 0) {
-		err = err_read;
 		dev_err(dev, "error resetting chip\n");
-		goto exit_dummy;
+		return err_read;
 	}
 
 	if (status1 & S35390A_FLAG_24H)
@@ -478,13 +473,13 @@ static int s35390a_probe(struct i2c_client *client,
 		err = s35390a_set_reg(s35390a, S35390A_CMD_STATUS2, &buf, 1);
 		if (err < 0) {
 			dev_err(dev, "error disabling alarm");
-			goto exit_dummy;
+			return err;
 		}
 	} else {
 		err = s35390a_disable_test_mode(s35390a);
 		if (err < 0) {
 			dev_err(dev, "error disabling test mode\n");
-			goto exit_dummy;
+			return err;
 		}
 	}
 
@@ -493,10 +488,8 @@ static int s35390a_probe(struct i2c_client *client,
 	s35390a->rtc = devm_rtc_device_register(dev, s35390a_driver.driver.name,
 						&s35390a_rtc_ops, THIS_MODULE);
 
-	if (IS_ERR(s35390a->rtc)) {
-		err = PTR_ERR(s35390a->rtc);
-		goto exit_dummy;
-	}
+	if (IS_ERR(s35390a->rtc))
+		return PTR_ERR(s35390a->rtc);
 
 	/* supports per-minute alarms only, therefore set uie_unsupported */
 	s35390a->rtc->uie_unsupported = 1;
@@ -505,26 +498,6 @@ static int s35390a_probe(struct i2c_client *client,
 		rtc_update_irq(s35390a->rtc, 1, RTC_AF);
 
 	return 0;
-
-exit_dummy:
-	for (i = 1; i < 8; ++i)
-		if (s35390a->client[i])
-			i2c_unregister_device(s35390a->client[i]);
-
-exit:
-	return err;
-}
-
-static int s35390a_remove(struct i2c_client *client)
-{
-	unsigned int i;
-	struct s35390a *s35390a = i2c_get_clientdata(client);
-
-	for (i = 1; i < 8; ++i)
-		if (s35390a->client[i])
-			i2c_unregister_device(s35390a->client[i]);
-
-	return 0;
 }
 
 static struct i2c_driver s35390a_driver = {
@@ -533,7 +506,6 @@ static struct i2c_driver s35390a_driver = {
 		.of_match_table = of_match_ptr(s35390a_of_match),
 	},
 	.probe		= s35390a_probe,
-	.remove		= s35390a_remove,
 	.id_table	= s35390a_id,
 };
 
-- 
2.20.1


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

* Re: [PATCH 1/2] rtc: max77686: convert to devm_i2c_new_dummy_device()
  2019-08-20 15:42 ` [PATCH 1/2] rtc: max77686: convert " Wolfram Sang
@ 2019-08-29 20:57   ` Alexandre Belloni
  2019-08-30 12:45     ` Wolfram Sang
  0 siblings, 1 reply; 10+ messages in thread
From: Alexandre Belloni @ 2019-08-29 20:57 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, Chanwoo Choi, Krzysztof Kozlowski,
	Bartlomiej Zolnierkiewicz, Alessandro Zummo, linux-kernel,
	linux-rtc

On 20/08/2019 17:42:37+0200, Wolfram Sang wrote:
> I was about to simplify the call to i2c_unregister_device() when I
> realized that converting to devm_i2c_new_dummy_device() will simplify
> the driver a lot. So I took this approach.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> Build tested only, buildbot is happy, too.
> 
> Please apply to your tree.
> 

I'm confused because I already applied:
https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git/commit/?h=rtc-next&id=7150710f3084de8d35ce3221eeae2caee8813f92

>  drivers/rtc/rtc-max77686.c | 17 ++++-------------
>  1 file changed, 4 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-max77686.c b/drivers/rtc/rtc-max77686.c
> index d04fd1024697..4027b33034dc 100644
> --- a/drivers/rtc/rtc-max77686.c
> +++ b/drivers/rtc/rtc-max77686.c
> @@ -693,8 +693,8 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info)
>  		goto add_rtc_irq;
>  	}
>  
> -	info->rtc = i2c_new_dummy_device(parent_i2c->adapter,
> -				  info->drv_data->rtc_i2c_addr);
> +	info->rtc = devm_i2c_new_dummy_device(info->dev, parent_i2c->adapter,
> +					      info->drv_data->rtc_i2c_addr);
>  	if (IS_ERR(info->rtc)) {
>  		dev_err(info->dev, "Failed to allocate I2C device for RTC\n");
>  		return PTR_ERR(info->rtc);
> @@ -705,7 +705,7 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info)
>  	if (IS_ERR(info->rtc_regmap)) {
>  		ret = PTR_ERR(info->rtc_regmap);
>  		dev_err(info->dev, "Failed to allocate RTC regmap: %d\n", ret);
> -		goto err_unregister_i2c;
> +		return ret;
>  	}
>  
>  add_rtc_irq:
> @@ -715,15 +715,10 @@ static int max77686_init_rtc_regmap(struct max77686_rtc_info *info)
>  				  &info->rtc_irq_data);
>  	if (ret < 0) {
>  		dev_err(info->dev, "Failed to add RTC irq chip: %d\n", ret);
> -		goto err_unregister_i2c;
> +		return ret;
>  	}
>  
>  	return 0;
> -
> -err_unregister_i2c:
> -	if (info->rtc)
> -		i2c_unregister_device(info->rtc);
> -	return ret;
>  }
>  
>  static int max77686_rtc_probe(struct platform_device *pdev)
> @@ -786,8 +781,6 @@ static int max77686_rtc_probe(struct platform_device *pdev)
>  
>  err_rtc:
>  	regmap_del_irq_chip(info->rtc_irq, info->rtc_irq_data);
> -	if (info->rtc)
> -		i2c_unregister_device(info->rtc);
>  
>  	return ret;
>  }
> @@ -798,8 +791,6 @@ static int max77686_rtc_remove(struct platform_device *pdev)
>  
>  	free_irq(info->virq, info);
>  	regmap_del_irq_chip(info->rtc_irq, info->rtc_irq_data);
> -	if (info->rtc)
> -		i2c_unregister_device(info->rtc);
>  
>  	return 0;
>  }
> -- 
> 2.20.1
> 

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* Re: [PATCH 2/2] rtc: s35390a: convert to devm_i2c_new_dummy_device()
  2019-08-20 15:42 ` [PATCH 2/2] rtc: s35390a: " Wolfram Sang
@ 2019-08-29 20:58   ` Alexandre Belloni
  0 siblings, 0 replies; 10+ messages in thread
From: Alexandre Belloni @ 2019-08-29 20:58 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c, Alessandro Zummo, linux-rtc, linux-kernel

On 20/08/2019 17:42:38+0200, Wolfram Sang wrote:
> I was about to simplify the call to i2c_unregister_device() when I
> realized that converting to devm_i2c_new_dummy_device() will simplify
> the driver a lot. So I took this approach.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> Build tested only, buildbot is happy, too.
> 
> Please apply to your tree.
> 

Isn't that https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git/commit/?h=rtc-next&id=ca83542cdb5c14dd369de2539bdca2670d89feea

>  drivers/rtc/rtc-s35390a.c | 54 ++++++++++-----------------------------
>  1 file changed, 13 insertions(+), 41 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-s35390a.c b/drivers/rtc/rtc-s35390a.c
> index 5826209a3f30..da34cfd70f95 100644
> --- a/drivers/rtc/rtc-s35390a.c
> +++ b/drivers/rtc/rtc-s35390a.c
> @@ -434,37 +434,32 @@ static int s35390a_probe(struct i2c_client *client,
>  	char buf, status1;
>  	struct device *dev = &client->dev;
>  
> -	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C)) {
> -		err = -ENODEV;
> -		goto exit;
> -	}
> +	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
> +		return -ENODEV;
>  
>  	s35390a = devm_kzalloc(dev, sizeof(struct s35390a), GFP_KERNEL);
> -	if (!s35390a) {
> -		err = -ENOMEM;
> -		goto exit;
> -	}
> +	if (!s35390a)
> +		return -ENOMEM;
>  
>  	s35390a->client[0] = client;
>  	i2c_set_clientdata(client, s35390a);
>  
>  	/* This chip uses multiple addresses, use dummy devices for them */
>  	for (i = 1; i < 8; ++i) {
> -		s35390a->client[i] = i2c_new_dummy_device(client->adapter,
> -					client->addr + i);
> +		s35390a->client[i] = devm_i2c_new_dummy_device(dev,
> +							       client->adapter,
> +							       client->addr + i);
>  		if (IS_ERR(s35390a->client[i])) {
>  			dev_err(dev, "Address %02x unavailable\n",
>  				client->addr + i);
> -			err = PTR_ERR(s35390a->client[i]);
> -			goto exit_dummy;
> +			return PTR_ERR(s35390a->client[i]);
>  		}
>  	}
>  
>  	err_read = s35390a_read_status(s35390a, &status1);
>  	if (err_read < 0) {
> -		err = err_read;
>  		dev_err(dev, "error resetting chip\n");
> -		goto exit_dummy;
> +		return err_read;
>  	}
>  
>  	if (status1 & S35390A_FLAG_24H)
> @@ -478,13 +473,13 @@ static int s35390a_probe(struct i2c_client *client,
>  		err = s35390a_set_reg(s35390a, S35390A_CMD_STATUS2, &buf, 1);
>  		if (err < 0) {
>  			dev_err(dev, "error disabling alarm");
> -			goto exit_dummy;
> +			return err;
>  		}
>  	} else {
>  		err = s35390a_disable_test_mode(s35390a);
>  		if (err < 0) {
>  			dev_err(dev, "error disabling test mode\n");
> -			goto exit_dummy;
> +			return err;
>  		}
>  	}
>  
> @@ -493,10 +488,8 @@ static int s35390a_probe(struct i2c_client *client,
>  	s35390a->rtc = devm_rtc_device_register(dev, s35390a_driver.driver.name,
>  						&s35390a_rtc_ops, THIS_MODULE);
>  
> -	if (IS_ERR(s35390a->rtc)) {
> -		err = PTR_ERR(s35390a->rtc);
> -		goto exit_dummy;
> -	}
> +	if (IS_ERR(s35390a->rtc))
> +		return PTR_ERR(s35390a->rtc);
>  
>  	/* supports per-minute alarms only, therefore set uie_unsupported */
>  	s35390a->rtc->uie_unsupported = 1;
> @@ -505,26 +498,6 @@ static int s35390a_probe(struct i2c_client *client,
>  		rtc_update_irq(s35390a->rtc, 1, RTC_AF);
>  
>  	return 0;
> -
> -exit_dummy:
> -	for (i = 1; i < 8; ++i)
> -		if (s35390a->client[i])
> -			i2c_unregister_device(s35390a->client[i]);
> -
> -exit:
> -	return err;
> -}
> -
> -static int s35390a_remove(struct i2c_client *client)
> -{
> -	unsigned int i;
> -	struct s35390a *s35390a = i2c_get_clientdata(client);
> -
> -	for (i = 1; i < 8; ++i)
> -		if (s35390a->client[i])
> -			i2c_unregister_device(s35390a->client[i]);
> -
> -	return 0;
>  }
>  
>  static struct i2c_driver s35390a_driver = {
> @@ -533,7 +506,6 @@ static struct i2c_driver s35390a_driver = {
>  		.of_match_table = of_match_ptr(s35390a_of_match),
>  	},
>  	.probe		= s35390a_probe,
> -	.remove		= s35390a_remove,
>  	.id_table	= s35390a_id,
>  };
>  
> -- 
> 2.20.1
> 

-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* Re: [PATCH 1/2] rtc: max77686: convert to devm_i2c_new_dummy_device()
  2019-08-29 20:57   ` Alexandre Belloni
@ 2019-08-30 12:45     ` Wolfram Sang
  2019-08-30 12:53       ` Alexandre Belloni
  0 siblings, 1 reply; 10+ messages in thread
From: Wolfram Sang @ 2019-08-30 12:45 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Wolfram Sang, linux-i2c, Chanwoo Choi, Krzysztof Kozlowski,
	Bartlomiej Zolnierkiewicz, Alessandro Zummo, linux-kernel,
	linux-rtc

[-- Attachment #1: Type: text/plain, Size: 1219 bytes --]

On Thu, Aug 29, 2019 at 10:57:52PM +0200, Alexandre Belloni wrote:
> On 20/08/2019 17:42:37+0200, Wolfram Sang wrote:
> > I was about to simplify the call to i2c_unregister_device() when I
> > realized that converting to devm_i2c_new_dummy_device() will simplify
> > the driver a lot. So I took this approach.
> > 
> > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> > ---
> > Build tested only, buildbot is happy, too.
> > 
> > Please apply to your tree.
> > 
> 
> I'm confused because I already applied:
> https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git/commit/?h=rtc-next&id=7150710f3084de8d35ce3221eeae2caee8813f92

The above was a mass conversion to i2c_new_dummy_device() to make sure
all in-kernel users use the API returning an ERRPTR. Mass conversion to
the devm_ variant of the same function was too troublesome.

With another series, I wanted to remove superfluous error checking of
i2c_unregister_device() because it is NULL-ptr safe, like here:

> > -	if (info->rtc)
> > -		i2c_unregister_device(info->rtc);

But for these two RTC drivers, I figured moving to devm_* is way easier
than fixing up the mass conversion result from coccinelle.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 1/2] rtc: max77686: convert to devm_i2c_new_dummy_device()
  2019-08-30 12:45     ` Wolfram Sang
@ 2019-08-30 12:53       ` Alexandre Belloni
  2019-08-30 13:00         ` Wolfram Sang
  0 siblings, 1 reply; 10+ messages in thread
From: Alexandre Belloni @ 2019-08-30 12:53 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Wolfram Sang, linux-i2c, Chanwoo Choi, Krzysztof Kozlowski,
	Bartlomiej Zolnierkiewicz, Alessandro Zummo, linux-kernel,
	linux-rtc

On 30/08/2019 14:45:54+0200, Wolfram Sang wrote:
> On Thu, Aug 29, 2019 at 10:57:52PM +0200, Alexandre Belloni wrote:
> > On 20/08/2019 17:42:37+0200, Wolfram Sang wrote:
> > > I was about to simplify the call to i2c_unregister_device() when I
> > > realized that converting to devm_i2c_new_dummy_device() will simplify
> > > the driver a lot. So I took this approach.
> > > 
> > > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> > > ---
> > > Build tested only, buildbot is happy, too.
> > > 
> > > Please apply to your tree.
> > > 
> > 
> > I'm confused because I already applied:
> > https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git/commit/?h=rtc-next&id=7150710f3084de8d35ce3221eeae2caee8813f92
> 
> The above was a mass conversion to i2c_new_dummy_device() to make sure
> all in-kernel users use the API returning an ERRPTR. Mass conversion to
> the devm_ variant of the same function was too troublesome.
> 
> With another series, I wanted to remove superfluous error checking of
> i2c_unregister_device() because it is NULL-ptr safe, like here:
> 
> > > -	if (info->rtc)
> > > -		i2c_unregister_device(info->rtc);
> 
> But for these two RTC drivers, I figured moving to devm_* is way easier
> than fixing up the mass conversion result from coccinelle.
> 

Ok so should I drop the previous patches and apply those instead?


-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* Re: [PATCH 1/2] rtc: max77686: convert to devm_i2c_new_dummy_device()
  2019-08-30 12:53       ` Alexandre Belloni
@ 2019-08-30 13:00         ` Wolfram Sang
  2019-08-30 13:06           ` Alexandre Belloni
  0 siblings, 1 reply; 10+ messages in thread
From: Wolfram Sang @ 2019-08-30 13:00 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Wolfram Sang, linux-i2c, Chanwoo Choi, Krzysztof Kozlowski,
	Bartlomiej Zolnierkiewicz, Alessandro Zummo, linux-kernel,
	linux-rtc

[-- Attachment #1: Type: text/plain, Size: 916 bytes --]


> > > I'm confused because I already applied:
> > > https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git/commit/?h=rtc-next&id=7150710f3084de8d35ce3221eeae2caee8813f92
> > 
> > The above was a mass conversion to i2c_new_dummy_device() to make sure
> > all in-kernel users use the API returning an ERRPTR. Mass conversion to
> > the devm_ variant of the same function was too troublesome.
> > 
> > With another series, I wanted to remove superfluous error checking of
> > i2c_unregister_device() because it is NULL-ptr safe, like here:
> > 
> > > > -	if (info->rtc)
> > > > -		i2c_unregister_device(info->rtc);
> > 
> > But for these two RTC drivers, I figured moving to devm_* is way easier
> > than fixing up the mass conversion result from coccinelle.
> > 
> 
> Ok so should I drop the previous patches and apply those instead?

Nope, they should be incremental, aren't they?


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 1/2] rtc: max77686: convert to devm_i2c_new_dummy_device()
  2019-08-30 13:00         ` Wolfram Sang
@ 2019-08-30 13:06           ` Alexandre Belloni
  2019-08-30 13:18             ` Wolfram Sang
  0 siblings, 1 reply; 10+ messages in thread
From: Alexandre Belloni @ 2019-08-30 13:06 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Wolfram Sang, linux-i2c, Chanwoo Choi, Krzysztof Kozlowski,
	Bartlomiej Zolnierkiewicz, Alessandro Zummo, linux-kernel,
	linux-rtc

On 30/08/2019 15:00:35+0200, Wolfram Sang wrote:
> 
> > > > I'm confused because I already applied:
> > > > https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git/commit/?h=rtc-next&id=7150710f3084de8d35ce3221eeae2caee8813f92
> > > 
> > > The above was a mass conversion to i2c_new_dummy_device() to make sure
> > > all in-kernel users use the API returning an ERRPTR. Mass conversion to
> > > the devm_ variant of the same function was too troublesome.
> > > 
> > > With another series, I wanted to remove superfluous error checking of
> > > i2c_unregister_device() because it is NULL-ptr safe, like here:
> > > 
> > > > > -	if (info->rtc)
> > > > > -		i2c_unregister_device(info->rtc);
> > > 
> > > But for these two RTC drivers, I figured moving to devm_* is way easier
> > > than fixing up the mass conversion result from coccinelle.
> > > 
> > 
> > Ok so should I drop the previous patches and apply those instead?
> 
> Nope, they should be incremental, aren't they?
> 
No, your patches don't apply on top of rtc-next


-- 
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

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

* Re: [PATCH 1/2] rtc: max77686: convert to devm_i2c_new_dummy_device()
  2019-08-30 13:06           ` Alexandre Belloni
@ 2019-08-30 13:18             ` Wolfram Sang
  0 siblings, 0 replies; 10+ messages in thread
From: Wolfram Sang @ 2019-08-30 13:18 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Wolfram Sang, linux-i2c, Chanwoo Choi, Krzysztof Kozlowski,
	Bartlomiej Zolnierkiewicz, Alessandro Zummo, linux-kernel,
	linux-rtc

[-- Attachment #1: Type: text/plain, Size: 225 bytes --]


> > Nope, they should be incremental, aren't they?
> > 
> No, your patches don't apply on top of rtc-next

Looks like you edited some whitespaces to match opening parens before
applying? I'll resend to match these.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2019-08-30 13:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-20 15:42 [PATCH 0/2] rtc: convert two drivers to devm_i2c_new_dummy_device() Wolfram Sang
2019-08-20 15:42 ` [PATCH 1/2] rtc: max77686: convert " Wolfram Sang
2019-08-29 20:57   ` Alexandre Belloni
2019-08-30 12:45     ` Wolfram Sang
2019-08-30 12:53       ` Alexandre Belloni
2019-08-30 13:00         ` Wolfram Sang
2019-08-30 13:06           ` Alexandre Belloni
2019-08-30 13:18             ` Wolfram Sang
2019-08-20 15:42 ` [PATCH 2/2] rtc: s35390a: " Wolfram Sang
2019-08-29 20:58   ` Alexandre Belloni

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).