public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] CHROMIUM: devfreq: rk3399: Clear edev->dev drvdata before enabling dfi
@ 2017-09-01 23:52 Jeffy Chen
  2017-09-02  0:47 ` Brian Norris
  0 siblings, 1 reply; 3+ messages in thread
From: Jeffy Chen @ 2017-09-01 23:52 UTC (permalink / raw)
  To: linux-kernel, dbasehore
  Cc: briannorris, dianders, Jeffy Chen, Chanwoo Choi, Kyungmin Park,
	MyungJoo Ham, linux-pm

Currently we are using edev->dev drvdata to get rk3399-dmc data, but
it would be inited to edev in devfreq_event_add_edev.

So we need to clear the edev->dev drvdata before enabling dfi, to
prevent dfi from getting the wrong rk3399-dmc data when the irq
triggered too early.

Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---

 drivers/devfreq/rk3399_dmc.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/devfreq/rk3399_dmc.c b/drivers/devfreq/rk3399_dmc.c
index 1b89ebbad02c..12f9f03f349f 100644
--- a/drivers/devfreq/rk3399_dmc.c
+++ b/drivers/devfreq/rk3399_dmc.c
@@ -429,6 +429,7 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev)
 
 	rk3399_devfreq_dmc_profile.initial_freq = data->rate;
 
+	platform_set_drvdata(pdev, NULL);
 	data->devfreq = devm_devfreq_add_device(dev,
 					   &rk3399_devfreq_dmc_profile,
 					   "simple_ondemand",
-- 
2.11.0

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

* Re: [PATCH] CHROMIUM: devfreq: rk3399: Clear edev->dev drvdata before enabling dfi
  2017-09-01 23:52 [PATCH] CHROMIUM: devfreq: rk3399: Clear edev->dev drvdata before enabling dfi Jeffy Chen
@ 2017-09-02  0:47 ` Brian Norris
  2017-09-02  1:51   ` jeffy
  0 siblings, 1 reply; 3+ messages in thread
From: Brian Norris @ 2017-09-02  0:47 UTC (permalink / raw)
  To: Jeffy Chen
  Cc: linux-kernel, dbasehore, dianders, Chanwoo Choi, Kyungmin Park,
	MyungJoo Ham, linux-pm

On Sat, Sep 02, 2017 at 07:52:37AM +0800, Jeffy Chen wrote:
> Currently we are using edev->dev drvdata to get rk3399-dmc data, but
> it would be inited to edev in devfreq_event_add_edev.
> 
> So we need to clear the edev->dev drvdata before enabling dfi, to
> prevent dfi from getting the wrong rk3399-dmc data when the irq
> triggered too early.

Your description doesn't match your code. You say you're clearing
evdev->dev driver data but...

> Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
> ---
> 
>  drivers/devfreq/rk3399_dmc.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/devfreq/rk3399_dmc.c b/drivers/devfreq/rk3399_dmc.c
> index 1b89ebbad02c..12f9f03f349f 100644
> --- a/drivers/devfreq/rk3399_dmc.c
> +++ b/drivers/devfreq/rk3399_dmc.c
> @@ -429,6 +429,7 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev)
>  
>  	rk3399_devfreq_dmc_profile.initial_freq = data->rate;
>  
> +	platform_set_drvdata(pdev, NULL);

...here you're only clearing the drvdata for the platform device. Is
that a mistake? (Hint: that's not what you uploaded on the Chromium OS
instance, where you presumably tested this.)

And if you're really trying to do what your commit message says:

We're having two different files fight over who owns the edev drvdata?
That seems like a big no-no.

We should work out who's the real owner of 'drvdata', and find some
other solution for the others.

Brian

>  	data->devfreq = devm_devfreq_add_device(dev,
>  					   &rk3399_devfreq_dmc_profile,
>  					   "simple_ondemand",
> -- 
> 2.11.0
> 
> 

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

* Re: [PATCH] CHROMIUM: devfreq: rk3399: Clear edev->dev drvdata before enabling dfi
  2017-09-02  0:47 ` Brian Norris
@ 2017-09-02  1:51   ` jeffy
  0 siblings, 0 replies; 3+ messages in thread
From: jeffy @ 2017-09-02  1:51 UTC (permalink / raw)
  To: Brian Norris
  Cc: linux-kernel, dbasehore, dianders, Chanwoo Choi, Kyungmin Park,
	MyungJoo Ham, linux-pm

hi brian,
On 09/02/2017 08:47 AM, Brian Norris wrote:
> On Sat, Sep 02, 2017 at 07:52:37AM +0800, Jeffy Chen wrote:
>> Currently we are using edev->dev drvdata to get rk3399-dmc data, but
>> it would be inited to edev in devfreq_event_add_edev.
>>
>> So we need to clear the edev->dev drvdata before enabling dfi, to
>> prevent dfi from getting the wrong rk3399-dmc data when the irq
>> triggered too early.
>
> Your description doesn't match your code. You say you're clearing
> evdev->dev driver data but...
>
>> Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
>> ---
>>
>>   drivers/devfreq/rk3399_dmc.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/devfreq/rk3399_dmc.c b/drivers/devfreq/rk3399_dmc.c
>> index 1b89ebbad02c..12f9f03f349f 100644
>> --- a/drivers/devfreq/rk3399_dmc.c
>> +++ b/drivers/devfreq/rk3399_dmc.c
>> @@ -429,6 +429,7 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev)
>>
>>   	rk3399_devfreq_dmc_profile.initial_freq = data->rate;
>>
>> +	platform_set_drvdata(pdev, NULL);
>
> ...here you're only clearing the drvdata for the platform device. Is
> that a mistake? (Hint: that's not what you uploaded on the Chromium OS
> instance, where you presumably tested this.)
>
> And if you're really trying to do what your commit message says:
>
> We're having two different files fight over who owns the edev drvdata?
> That seems like a big no-no.
>
> We should work out who's the real owner of 'drvdata', and find some
> other solution for the others.

sorry, indeed...it turns out the upstream dmc driver is not using 
dfi(it's simple_onfemand below ;)...

so we don't need thus patch for upstream kernel...or maybe we should 
submit other cros patches(contains the one causes this issue, and this 
patch)
>
> Brian
>
>>   	data->devfreq = devm_devfreq_add_device(dev,
>>   					   &rk3399_devfreq_dmc_profile,
>>   					   "simple_ondemand",
>> --
>> 2.11.0
>>
>>
>
>
>

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

end of thread, other threads:[~2017-09-02  1:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-01 23:52 [PATCH] CHROMIUM: devfreq: rk3399: Clear edev->dev drvdata before enabling dfi Jeffy Chen
2017-09-02  0:47 ` Brian Norris
2017-09-02  1:51   ` jeffy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox