diff mbox

[1/2] cpuidle: fix cpu idle driver as a module can not remove

Message ID 1374571681-31911-1-git-send-email-dongsheng.wang@freescale.com (mailing list archive)
State Superseded
Headers show

Commit Message

Dongsheng Wang July 23, 2013, 9:28 a.m. UTC
From: Wang Dongsheng <dongsheng.wang@freescale.com>

The module can not be removed when execute "rmmod". rmmod not use
"--force".

Log:
root:~# rmmod cpuidle-e500
incs[9], decs[1]
rmmod: can't unload 'cpuidle_e500': Resource temporarily unavailable

Signed-off-by: Wang Dongsheng <dongsheng.wang@freescale.com>
---
Branch: pm-cpuidle

 drivers/cpuidle/cpuidle.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

Comments

Rafael J. Wysocki July 23, 2013, 9:32 p.m. UTC | #1
On Tuesday, July 23, 2013 05:28:00 PM Dongsheng Wang wrote:
> From: Wang Dongsheng <dongsheng.wang@freescale.com>
> 
> The module can not be removed when execute "rmmod". rmmod not use
> "--force".
> 
> Log:
> root:~# rmmod cpuidle-e500
> incs[9], decs[1]
> rmmod: can't unload 'cpuidle_e500': Resource temporarily unavailable
> 
> Signed-off-by: Wang Dongsheng <dongsheng.wang@freescale.com>

Can you please check the current linux-next branch of the linux-pm.git tree
and see if that doesn't conflict with the material in there?

Also please explain in the changelog how your changes help to fix the problem.

Thanks,
Rafael


> ---
> Branch: pm-cpuidle
> 
>  drivers/cpuidle/cpuidle.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
> index fdc432f..534320a 100644
> --- a/drivers/cpuidle/cpuidle.c
> +++ b/drivers/cpuidle/cpuidle.c
> @@ -386,6 +386,9 @@ static int __cpuidle_register_device(struct cpuidle_device *dev)
>  		goto err_coupled;
>  
>  	dev->registered = 1;
> +
> +	module_put(drv->owner);
> +
>  	return 0;
>  
>  err_coupled:
> @@ -432,8 +435,6 @@ EXPORT_SYMBOL_GPL(cpuidle_register_device);
>   */
>  void cpuidle_unregister_device(struct cpuidle_device *dev)
>  {
> -	struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);
> -
>  	if (dev->registered == 0)
>  		return;
>  
> @@ -448,8 +449,6 @@ void cpuidle_unregister_device(struct cpuidle_device *dev)
>  	cpuidle_coupled_unregister_device(dev);
>  
>  	cpuidle_resume_and_unlock();
> -
> -	module_put(drv->owner);
>  }
>  
>  EXPORT_SYMBOL_GPL(cpuidle_unregister_device);
>
Wang Dongsheng-B40534 July 24, 2013, 2:26 a.m. UTC | #2
> -----Original Message-----
> From: Rafael J. Wysocki [mailto:rjw@sisk.pl]
> Sent: Wednesday, July 24, 2013 5:33 AM
> To: Wang Dongsheng-B40534
> Cc: daniel.lezcano@linaro.org; linux-pm@vger.kernel.org; linuxppc-
> dev@lists.ozlabs.org
> Subject: Re: [PATCH 1/2] cpuidle: fix cpu idle driver as a module can not
> remove
> 
> On Tuesday, July 23, 2013 05:28:00 PM Dongsheng Wang wrote:
> > From: Wang Dongsheng <dongsheng.wang@freescale.com>
> >
> > The module can not be removed when execute "rmmod". rmmod not use
> > "--force".
> >
> > Log:
> > root:~# rmmod cpuidle-e500
> > incs[9], decs[1]
> > rmmod: can't unload 'cpuidle_e500': Resource temporarily unavailable
> >
> > Signed-off-by: Wang Dongsheng <dongsheng.wang@freescale.com>
> 
> Can you please check the current linux-next branch of the linux-pm.git
> tree
> and see if that doesn't conflict with the material in there?
> 
> Also please explain in the changelog how your changes help to fix the
> problem.
> 
Yes, Linux-next branch also have this problem.

Should I base on Linux-next to fix this problem?

Thanks.
- dongsheng
Li Yang-R58472 July 24, 2013, 10:33 a.m. UTC | #3
> -----Original Message-----
> From: linux-pm-owner@vger.kernel.org [mailto:linux-pm-
> owner@vger.kernel.org] On Behalf Of Wang Dongsheng-B40534
> Sent: Wednesday, July 24, 2013 10:26 AM
> To: Rafael J. Wysocki
> Cc: daniel.lezcano@linaro.org; linux-pm@vger.kernel.org; linuxppc-
> dev@lists.ozlabs.org
> Subject: RE: [PATCH 1/2] cpuidle: fix cpu idle driver as a module can not
> remove
> 
> 
> 
> > -----Original Message-----
> > From: Rafael J. Wysocki [mailto:rjw@sisk.pl]
> > Sent: Wednesday, July 24, 2013 5:33 AM
> > To: Wang Dongsheng-B40534
> > Cc: daniel.lezcano@linaro.org; linux-pm@vger.kernel.org; linuxppc-
> > dev@lists.ozlabs.org
> > Subject: Re: [PATCH 1/2] cpuidle: fix cpu idle driver as a module can
> > not remove
> >
> > On Tuesday, July 23, 2013 05:28:00 PM Dongsheng Wang wrote:
> > > From: Wang Dongsheng <dongsheng.wang@freescale.com>
> > >
> > > The module can not be removed when execute "rmmod". rmmod not use
> > > "--force".
> > >
> > > Log:
> > > root:~# rmmod cpuidle-e500
> > > incs[9], decs[1]
> > > rmmod: can't unload 'cpuidle_e500': Resource temporarily unavailable
> > >
> > > Signed-off-by: Wang Dongsheng <dongsheng.wang@freescale.com>
> >
> > Can you please check the current linux-next branch of the linux-pm.git
> > tree and see if that doesn't conflict with the material in there?
> >
> > Also please explain in the changelog how your changes help to fix the
> > problem.
> >
> Yes, Linux-next branch also have this problem.
> 
> Should I base on Linux-next to fix this problem?

I think Dongsheng is trying to make the platform cpuidle driver as a kernel module.

My questions are:
Is the cpuidle driver supposed to work as a module?
Or it can only be built-in like many current drivers do?

Regards,
Leo
diff mbox

Patch

diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
index fdc432f..534320a 100644
--- a/drivers/cpuidle/cpuidle.c
+++ b/drivers/cpuidle/cpuidle.c
@@ -386,6 +386,9 @@  static int __cpuidle_register_device(struct cpuidle_device *dev)
 		goto err_coupled;
 
 	dev->registered = 1;
+
+	module_put(drv->owner);
+
 	return 0;
 
 err_coupled:
@@ -432,8 +435,6 @@  EXPORT_SYMBOL_GPL(cpuidle_register_device);
  */
 void cpuidle_unregister_device(struct cpuidle_device *dev)
 {
-	struct cpuidle_driver *drv = cpuidle_get_cpu_driver(dev);
-
 	if (dev->registered == 0)
 		return;
 
@@ -448,8 +449,6 @@  void cpuidle_unregister_device(struct cpuidle_device *dev)
 	cpuidle_coupled_unregister_device(dev);
 
 	cpuidle_resume_and_unlock();
-
-	module_put(drv->owner);
 }
 
 EXPORT_SYMBOL_GPL(cpuidle_unregister_device);