All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] thermal: qoriq: Remove unnecessary platform_set_drvdata()
@ 2016-08-23 15:01 Wei Yongjun
  2016-08-24  6:41 ` Zhang Rui
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Yongjun @ 2016-08-23 15:01 UTC (permalink / raw)
  To: Zhang Rui, Eduardo Valentin; +Cc: Wei Yongjun, linux-pm

From: Wei Yongjun <weiyongjun1@huawei.com>

The driver core clears the driver data to NULL after device_release
or on probe failure. Thus, it is not needed to manually clear the
device driver data to NULL.

Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/thermal/qoriq_thermal.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c
index 644ba52..d01eca0 100644
--- a/drivers/thermal/qoriq_thermal.c
+++ b/drivers/thermal/qoriq_thermal.c
@@ -217,15 +217,13 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
 	data->sensor_id = qoriq_tmu_get_sensor_id();
 	if (data->sensor_id < 0) {
 		dev_err(&pdev->dev, "Failed to get sensor id\n");
-		ret = -ENODEV;
-		goto err_iomap;
+		return -ENODEV;
 	}
 
 	data->regs = of_iomap(np, 0);
 	if (!data->regs) {
 		dev_err(&pdev->dev, "Failed to get memory region\n");
-		ret = -ENODEV;
-		goto err_iomap;
+		return -ENODEV;
 	}
 
 	qoriq_tmu_init_device(data);	/* TMU initialization */
@@ -254,9 +252,6 @@ static int qoriq_tmu_probe(struct platform_device *pdev)
 err_tmu:
 	iounmap(data->regs);
 
-err_iomap:
-	platform_set_drvdata(pdev, NULL);
-
 	return ret;
 }
 
@@ -270,7 +265,6 @@ static int qoriq_tmu_remove(struct platform_device *pdev)
 	tmu_write(data, TMR_DISABLE, &data->regs->tmr);
 
 	iounmap(data->regs);
-	platform_set_drvdata(pdev, NULL);
 
 	return 0;
 }




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

* Re: [PATCH -next] thermal: qoriq: Remove unnecessary platform_set_drvdata()
  2016-08-23 15:01 [PATCH -next] thermal: qoriq: Remove unnecessary platform_set_drvdata() Wei Yongjun
@ 2016-08-24  6:41 ` Zhang Rui
  2016-09-08  7:17   ` Troy Jia
  0 siblings, 1 reply; 3+ messages in thread
From: Zhang Rui @ 2016-08-24  6:41 UTC (permalink / raw)
  To: Wei Yongjun, Eduardo Valentin; +Cc: Wei Yongjun, linux-pm, hongtao.jia

On 二, 2016-08-23 at 15:01 +0000, Wei Yongjun wrote:
> From: Wei Yongjun <weiyongjun1@huawei.com>
> 
> The driver core clears the driver data to NULL after device_release
> or on probe failure. Thus, it is not needed to manually clear the
> device driver data to NULL.
> 
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Patch applied.

thanks,
rui
> ---
>  drivers/thermal/qoriq_thermal.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/thermal/qoriq_thermal.c
> b/drivers/thermal/qoriq_thermal.c
> index 644ba52..d01eca0 100644
> --- a/drivers/thermal/qoriq_thermal.c
> +++ b/drivers/thermal/qoriq_thermal.c
> @@ -217,15 +217,13 @@ static int qoriq_tmu_probe(struct
> platform_device *pdev)
>  	data->sensor_id = qoriq_tmu_get_sensor_id();
>  	if (data->sensor_id < 0) {
>  		dev_err(&pdev->dev, "Failed to get sensor id\n");
> -		ret = -ENODEV;
> -		goto err_iomap;
> +		return -ENODEV;
>  	}
>  
>  	data->regs = of_iomap(np, 0);
>  	if (!data->regs) {
>  		dev_err(&pdev->dev, "Failed to get memory
> region\n");
> -		ret = -ENODEV;
> -		goto err_iomap;
> +		return -ENODEV;
>  	}
>  
>  	qoriq_tmu_init_device(data);	/* TMU initialization */
> @@ -254,9 +252,6 @@ static int qoriq_tmu_probe(struct platform_device
> *pdev)
>  err_tmu:
>  	iounmap(data->regs);
>  
> -err_iomap:
> -	platform_set_drvdata(pdev, NULL);
> -
>  	return ret;
>  }
>  
> @@ -270,7 +265,6 @@ static int qoriq_tmu_remove(struct
> platform_device *pdev)
>  	tmu_write(data, TMR_DISABLE, &data->regs->tmr);
>  
>  	iounmap(data->regs);
> -	platform_set_drvdata(pdev, NULL);
>  
>  	return 0;
>  }
> 
> 
> 

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

* RE: [PATCH -next] thermal: qoriq: Remove unnecessary platform_set_drvdata()
  2016-08-24  6:41 ` Zhang Rui
@ 2016-09-08  7:17   ` Troy Jia
  0 siblings, 0 replies; 3+ messages in thread
From: Troy Jia @ 2016-09-08  7:17 UTC (permalink / raw)
  To: Zhang Rui, Wei Yongjun, Eduardo Valentin; +Cc: Wei Yongjun, linux-pm



> -----Original Message-----
> From: Zhang Rui [mailto:rui.zhang@intel.com]
> Sent: Wednesday, August 24, 2016 2:41 PM
> To: Wei Yongjun <weiyj.lk@gmail.com>; Eduardo Valentin
> <edubezval@gmail.com>
> Cc: Wei Yongjun <weiyongjun1@huawei.com>; linux-pm@vger.kernel.org;
> Hongtao Jia <hongtao.jia@nxp.com>
> Subject: Re: [PATCH -next] thermal: qoriq: Remove unnecessary
> platform_set_drvdata()
> 
> On 二, 2016-08-23 at 15:01 +0000, Wei Yongjun wrote:
> > From: Wei Yongjun <weiyongjun1@huawei.com>
> >
> > The driver core clears the driver data to NULL after device_release
> > or on probe failure. Thus, it is not needed to manually clear the
> > device driver data to NULL.
> >
> > Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> 
> Patch applied.
> 
> thanks,
> rui

Thanks Yongjun for the fix.


> > ---
> >  drivers/thermal/qoriq_thermal.c | 10 ++--------
> >  1 file changed, 2 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/thermal/qoriq_thermal.c
> > b/drivers/thermal/qoriq_thermal.c
> > index 644ba52..d01eca0 100644
> > --- a/drivers/thermal/qoriq_thermal.c
> > +++ b/drivers/thermal/qoriq_thermal.c
> > @@ -217,15 +217,13 @@ static int qoriq_tmu_probe(struct
> > platform_device *pdev)
> >  	data->sensor_id = qoriq_tmu_get_sensor_id();
> >  	if (data->sensor_id < 0) {
> >  		dev_err(&pdev->dev, "Failed to get sensor id\n");
> > -		ret = -ENODEV;
> > -		goto err_iomap;
> > +		return -ENODEV;
> >  	}
> >
> >  	data->regs = of_iomap(np, 0);
> >  	if (!data->regs) {
> >  		dev_err(&pdev->dev, "Failed to get memory
> > region\n");
> > -		ret = -ENODEV;
> > -		goto err_iomap;
> > +		return -ENODEV;
> >  	}
> >
> >  	qoriq_tmu_init_device(data);	/* TMU initialization */
> > @@ -254,9 +252,6 @@ static int qoriq_tmu_probe(struct platform_device
> > *pdev)
> >  err_tmu:
> >  	iounmap(data->regs);
> >
> > -err_iomap:
> > -	platform_set_drvdata(pdev, NULL);
> > -
> >  	return ret;
> >  }
> >
> > @@ -270,7 +265,6 @@ static int qoriq_tmu_remove(struct
> > platform_device *pdev)
> >  	tmu_write(data, TMR_DISABLE, &data->regs->tmr);
> >
> >  	iounmap(data->regs);
> > -	platform_set_drvdata(pdev, NULL);
> >
> >  	return 0;
> >  }
> >
> >
> >

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

end of thread, other threads:[~2016-09-08  7:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-23 15:01 [PATCH -next] thermal: qoriq: Remove unnecessary platform_set_drvdata() Wei Yongjun
2016-08-24  6:41 ` Zhang Rui
2016-09-08  7:17   ` Troy Jia

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.