linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers/mfd: remove unneeded and dangerous clearing of clientdata
@ 2010-05-17 12:10 Wolfram Sang
       [not found] ` <1274098229-13858-1-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Wolfram Sang @ 2010-05-17 12:10 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, Wolfram Sang, Jean Delvare,
	Samuel Ortiz, stable-DgEjT+Ai2ygdnm+yROfE0A

Unlike real i2c-devices which get detached from the driver, dummy-devices get
truly unregistered. So, there has never been a need to clear the clientdata
because the device will go away anyhow. For the occasions fixed here, clearing
clientdata was even dangerous as the structure was freed already.

Signed-off-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
Cc: Samuel Ortiz <sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
Cc: stable-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
---

Note: While most of the other calls clearing clientdata became superfluous
meanwhile and will be fixed later to remove redundancy, this is a seperate
issue. It was wrong from the beginning and needs to be fixed as it can cause
crashes. Hopefully, during this release-cycle, all other clearings of
clientdata will be removed and we will never see the related confusion again.

 drivers/mfd/88pm860x-i2c.c |    1 -
 drivers/mfd/max8925-i2c.c  |    2 --
 2 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/drivers/mfd/88pm860x-i2c.c b/drivers/mfd/88pm860x-i2c.c
index 4a6e718..e55f3d2 100644
--- a/drivers/mfd/88pm860x-i2c.c
+++ b/drivers/mfd/88pm860x-i2c.c
@@ -200,7 +200,6 @@ static int __devexit pm860x_remove(struct i2c_client *client)
 
 	pm860x_device_exit(chip);
 	i2c_unregister_device(chip->companion);
-	i2c_set_clientdata(chip->companion, NULL);
 	i2c_set_clientdata(chip->client, NULL);
 	kfree(chip);
 	return 0;
diff --git a/drivers/mfd/max8925-i2c.c b/drivers/mfd/max8925-i2c.c
index d9fd878..e73f3f5 100644
--- a/drivers/mfd/max8925-i2c.c
+++ b/drivers/mfd/max8925-i2c.c
@@ -173,8 +173,6 @@ static int __devexit max8925_remove(struct i2c_client *client)
 	max8925_device_exit(chip);
 	i2c_unregister_device(chip->adc);
 	i2c_unregister_device(chip->rtc);
-	i2c_set_clientdata(chip->adc, NULL);
-	i2c_set_clientdata(chip->rtc, NULL);
 	i2c_set_clientdata(chip->i2c, NULL);
 	kfree(chip);
 	return 0;
-- 
1.7.0

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

* Re: [PATCH] drivers/mfd: remove unneeded and dangerous clearing of clientdata
       [not found] ` <1274098229-13858-1-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2010-05-18 17:31   ` Jean Delvare
  2010-05-20 22:52   ` Samuel Ortiz
  1 sibling, 0 replies; 3+ messages in thread
From: Jean Delvare @ 2010-05-18 17:31 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA, Samuel Ortiz,
	stable-DgEjT+Ai2ygdnm+yROfE0A

On Mon, 17 May 2010 14:10:29 +0200, Wolfram Sang wrote:
> Unlike real i2c-devices which get detached from the driver, dummy-devices get
> truly unregistered. So, there has never been a need to clear the clientdata
> because the device will go away anyhow. For the occasions fixed here, clearing
> clientdata was even dangerous as the structure was freed already.
> 
> Signed-off-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Cc: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
> Cc: Samuel Ortiz <sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> Cc: stable-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

Acked-by: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>

> ---
> 
> Note: While most of the other calls clearing clientdata became superfluous
> meanwhile and will be fixed later to remove redundancy, this is a seperate
> issue. It was wrong from the beginning and needs to be fixed as it can cause
> crashes. Hopefully, during this release-cycle, all other clearings of
> clientdata will be removed and we will never see the related confusion again.
> 
>  drivers/mfd/88pm860x-i2c.c |    1 -
>  drivers/mfd/max8925-i2c.c  |    2 --
>  2 files changed, 0 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mfd/88pm860x-i2c.c b/drivers/mfd/88pm860x-i2c.c
> index 4a6e718..e55f3d2 100644
> --- a/drivers/mfd/88pm860x-i2c.c
> +++ b/drivers/mfd/88pm860x-i2c.c
> @@ -200,7 +200,6 @@ static int __devexit pm860x_remove(struct i2c_client *client)
>  
>  	pm860x_device_exit(chip);
>  	i2c_unregister_device(chip->companion);
> -	i2c_set_clientdata(chip->companion, NULL);
>  	i2c_set_clientdata(chip->client, NULL);
>  	kfree(chip);
>  	return 0;
> diff --git a/drivers/mfd/max8925-i2c.c b/drivers/mfd/max8925-i2c.c
> index d9fd878..e73f3f5 100644
> --- a/drivers/mfd/max8925-i2c.c
> +++ b/drivers/mfd/max8925-i2c.c
> @@ -173,8 +173,6 @@ static int __devexit max8925_remove(struct i2c_client *client)
>  	max8925_device_exit(chip);
>  	i2c_unregister_device(chip->adc);
>  	i2c_unregister_device(chip->rtc);
> -	i2c_set_clientdata(chip->adc, NULL);
> -	i2c_set_clientdata(chip->rtc, NULL);
>  	i2c_set_clientdata(chip->i2c, NULL);
>  	kfree(chip);
>  	return 0;


-- 
Jean Delvare

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

* Re: [PATCH] drivers/mfd: remove unneeded and dangerous clearing of clientdata
       [not found] ` <1274098229-13858-1-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
  2010-05-18 17:31   ` Jean Delvare
@ 2010-05-20 22:52   ` Samuel Ortiz
  1 sibling, 0 replies; 3+ messages in thread
From: Samuel Ortiz @ 2010-05-20 22:52 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA, Jean Delvare,
	stable-DgEjT+Ai2ygdnm+yROfE0A

Hi Wolfgang,

On Mon, May 17, 2010 at 02:10:29PM +0200, Wolfram Sang wrote:
> Unlike real i2c-devices which get detached from the driver, dummy-devices get
> truly unregistered. So, there has never been a need to clear the clientdata
> because the device will go away anyhow. For the occasions fixed here, clearing
> clientdata was even dangerous as the structure was freed already.
Patch applied, many thanks.

Cheers,
Samuel.

> Signed-off-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> Cc: Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org>
> Cc: Samuel Ortiz <sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
> Cc: stable-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
> ---
> 
> Note: While most of the other calls clearing clientdata became superfluous
> meanwhile and will be fixed later to remove redundancy, this is a seperate
> issue. It was wrong from the beginning and needs to be fixed as it can cause
> crashes. Hopefully, during this release-cycle, all other clearings of
> clientdata will be removed and we will never see the related confusion again.
> 
>  drivers/mfd/88pm860x-i2c.c |    1 -
>  drivers/mfd/max8925-i2c.c  |    2 --
>  2 files changed, 0 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/mfd/88pm860x-i2c.c b/drivers/mfd/88pm860x-i2c.c
> index 4a6e718..e55f3d2 100644
> --- a/drivers/mfd/88pm860x-i2c.c
> +++ b/drivers/mfd/88pm860x-i2c.c
> @@ -200,7 +200,6 @@ static int __devexit pm860x_remove(struct i2c_client *client)
>  
>  	pm860x_device_exit(chip);
>  	i2c_unregister_device(chip->companion);
> -	i2c_set_clientdata(chip->companion, NULL);
>  	i2c_set_clientdata(chip->client, NULL);
>  	kfree(chip);
>  	return 0;
> diff --git a/drivers/mfd/max8925-i2c.c b/drivers/mfd/max8925-i2c.c
> index d9fd878..e73f3f5 100644
> --- a/drivers/mfd/max8925-i2c.c
> +++ b/drivers/mfd/max8925-i2c.c
> @@ -173,8 +173,6 @@ static int __devexit max8925_remove(struct i2c_client *client)
>  	max8925_device_exit(chip);
>  	i2c_unregister_device(chip->adc);
>  	i2c_unregister_device(chip->rtc);
> -	i2c_set_clientdata(chip->adc, NULL);
> -	i2c_set_clientdata(chip->rtc, NULL);
>  	i2c_set_clientdata(chip->i2c, NULL);
>  	kfree(chip);
>  	return 0;
> -- 
> 1.7.0
> 

-- 
Intel Open Source Technology Centre
http://oss.intel.com/

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

end of thread, other threads:[~2010-05-20 22:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-17 12:10 [PATCH] drivers/mfd: remove unneeded and dangerous clearing of clientdata Wolfram Sang
     [not found] ` <1274098229-13858-1-git-send-email-w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2010-05-18 17:31   ` Jean Delvare
2010-05-20 22:52   ` Samuel Ortiz

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