mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH V2 4/4] i8042: support async suspend and shutdown
@ 2009-07-24  3:02 Zhang Rui
  2009-07-24  7:14 ` Pavel Machek
  0 siblings, 1 reply; 4+ messages in thread
From: Zhang Rui @ 2009-07-24  3:02 UTC (permalink / raw)
  To: Linux Kernel Mailing List, linux-pm, linux-acpi
  Cc: Rafael J. Wysocki, Pavel Machek, Len Brown, Alan Stern,
	Arjan van de Ven, dtor, Zhang, Rui


i8042 controller support device async actions.

If boot option "dev_async_action" is added,
i8042 controller and its child devices can be
suspended/shutdown asynchronously.

Signed-off-by: Zhang Rui <rui.zhang@intel.com>
---
 drivers/input/serio/i8042.c |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Index: linux-2.6/drivers/input/serio/i8042.c
===================================================================
--- linux-2.6.orig/drivers/input/serio/i8042.c
+++ linux-2.6/drivers/input/serio/i8042.c
@@ -1285,14 +1285,21 @@ static int __init i8042_init(void)
 		goto err_unregister_driver;
 	}
 
-	err = platform_device_add(i8042_platform_device);
+	err = dev_async_register(&i8042_platform_device->dev,
+			DEV_ASYNC_SUSPEND | DEV_ASYNC_SHUTDOWN);
 	if (err)
 		goto err_free_device;
 
+	err = platform_device_add(i8042_platform_device);
+	if (err)
+		goto err_dev_async_unregister;
+
 	panic_blink = i8042_panic_blink;
 
 	return 0;
 
+ err_dev_async_unregister:
+	dev_async_unregister(&i8042_platform_device->dev);
  err_free_device:
 	platform_device_put(i8042_platform_device);
  err_unregister_driver:
@@ -1305,6 +1312,7 @@ static int __init i8042_init(void)
 
 static void __exit i8042_exit(void)
 {
+	dev_async_unregister(&i8042_platform_device->dev);
 	platform_device_unregister(i8042_platform_device);
 	platform_driver_unregister(&i8042_driver);
 	i8042_platform_exit();



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

* Re: [PATCH V2 4/4] i8042: support async suspend and shutdown
  2009-07-24  3:02 [PATCH V2 4/4] i8042: support async suspend and shutdown Zhang Rui
@ 2009-07-24  7:14 ` Pavel Machek
  2009-08-03  9:26   ` Zhang Rui
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Machek @ 2009-07-24  7:14 UTC (permalink / raw)
  To: Zhang Rui
  Cc: Linux Kernel Mailing List, linux-pm, linux-acpi,
	Rafael J. Wysocki, Len Brown, Alan Stern, Arjan van de Ven, dtor

On Fri 2009-07-24 11:02:12, Zhang Rui wrote:
> 
> i8042 controller support device async actions.
> 
> If boot option "dev_async_action" is added,
> i8042 controller and its child devices can be
> suspended/shutdown asynchronously.
> 
> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
> ---
>  drivers/input/serio/i8042.c |   10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> Index: linux-2.6/drivers/input/serio/i8042.c
> ===================================================================
> --- linux-2.6.orig/drivers/input/serio/i8042.c
> +++ linux-2.6/drivers/input/serio/i8042.c
> @@ -1285,14 +1285,21 @@ static int __init i8042_init(void)
>  		goto err_unregister_driver;
>  	}
>  
> -	err = platform_device_add(i8042_platform_device);
> +	err = dev_async_register(&i8042_platform_device->dev,
> +			DEV_ASYNC_SUSPEND | DEV_ASYNC_SHUTDOWN);
>  	if (err)
>  		goto err_free_device;
>  
> +	err = platform_device_add(i8042_platform_device);
> +	if (err)
> +		goto err_dev_async_unregister;
> +
>  	panic_blink = i8042_panic_blink;
>  
>  	return 0;
>  
> + err_dev_async_unregister:
> +	dev_async_unregister(&i8042_platform_device->dev);
>   err_free_device:
>  	platform_device_put(i8042_platform_device);
>   err_unregister_driver:

I still do not like the interface: manually unregistering seems to be
ugly & error prone.

> @@ -1305,6 +1312,7 @@ static int __init i8042_init(void)
>  
>  static void __exit i8042_exit(void)
>  {
> +	dev_async_unregister(&i8042_platform_device->dev);
>  	platform_device_unregister(i8042_platform_device);
>  	platform_driver_unregister(&i8042_driver);
>  	i8042_platform_exit();
> 

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

* Re: [PATCH V2 4/4] i8042: support async suspend and shutdown
  2009-07-24  7:14 ` Pavel Machek
@ 2009-08-03  9:26   ` Zhang Rui
  2009-08-04 13:46     ` Pavel Machek
  0 siblings, 1 reply; 4+ messages in thread
From: Zhang Rui @ 2009-08-03  9:26 UTC (permalink / raw)
  To: Pavel Machek
  Cc: Linux Kernel Mailing List, linux-pm, linux-acpi,
	Rafael J. Wysocki, Len Brown, Alan Stern, Arjan van de Ven, dtor

On Fri, 2009-07-24 at 15:14 +0800, Pavel Machek wrote:
> On Fri 2009-07-24 11:02:12, Zhang Rui wrote:
> > 
> > i8042 controller support device async actions.
> > 
> > If boot option "dev_async_action" is added,
> > i8042 controller and its child devices can be
> > suspended/shutdown asynchronously.
> > 
> > Signed-off-by: Zhang Rui <rui.zhang@intel.com>
> > ---
> >  drivers/input/serio/i8042.c |   10 +++++++++-
> >  1 file changed, 9 insertions(+), 1 deletion(-)
> > 
> > Index: linux-2.6/drivers/input/serio/i8042.c
> > ===================================================================
> > --- linux-2.6.orig/drivers/input/serio/i8042.c
> > +++ linux-2.6/drivers/input/serio/i8042.c
> > @@ -1285,14 +1285,21 @@ static int __init i8042_init(void)
> >  		goto err_unregister_driver;
> >  	}
> >  
> > -	err = platform_device_add(i8042_platform_device);
> > +	err = dev_async_register(&i8042_platform_device->dev,
> > +			DEV_ASYNC_SUSPEND | DEV_ASYNC_SHUTDOWN);
> >  	if (err)
> >  		goto err_free_device;
> >  
> > +	err = platform_device_add(i8042_platform_device);
> > +	if (err)
> > +		goto err_dev_async_unregister;
> > +
> >  	panic_blink = i8042_panic_blink;
> >  
> >  	return 0;
> >  
> > + err_dev_async_unregister:
> > +	dev_async_unregister(&i8042_platform_device->dev);
> >   err_free_device:
> >  	platform_device_put(i8042_platform_device);
> >   err_unregister_driver:
> 
> I still do not like the interface: manually unregistering seems to be
> ugly & error prone.
> 
hmm, yes, we can check device->dev_async and unregister it in driver
core, at device_unregister time.

then I think we should rename the interfaces to:
device_enable_async_action(dev, type),
and device_disable_async_action(dev)
so that they are more like driver core helper functions.
what do you think?

thanks,
rui
> > @@ -1305,6 +1312,7 @@ static int __init i8042_init(void)
> >  
> >  static void __exit i8042_exit(void)
> >  {
> > +	dev_async_unregister(&i8042_platform_device->dev);
> >  	platform_device_unregister(i8042_platform_device);
> >  	platform_driver_unregister(&i8042_driver);
> >  	i8042_platform_exit();
> > 
> 


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

* Re: [PATCH V2 4/4] i8042: support async suspend and shutdown
  2009-08-03  9:26   ` Zhang Rui
@ 2009-08-04 13:46     ` Pavel Machek
  0 siblings, 0 replies; 4+ messages in thread
From: Pavel Machek @ 2009-08-04 13:46 UTC (permalink / raw)
  To: Zhang Rui
  Cc: Linux Kernel Mailing List, linux-pm, linux-acpi,
	Rafael J. Wysocki, Len Brown, Alan Stern, Arjan van de Ven, dtor


> > >  	panic_blink = i8042_panic_blink;
> > >  
> > >  	return 0;
> > >  
> > > + err_dev_async_unregister:
> > > +	dev_async_unregister(&i8042_platform_device->dev);
> > >   err_free_device:
> > >  	platform_device_put(i8042_platform_device);
> > >   err_unregister_driver:
> > 
> > I still do not like the interface: manually unregistering seems to be
> > ugly & error prone.
> > 
> hmm, yes, we can check device->dev_async and unregister it in driver
> core, at device_unregister time.
> 
> then I think we should rename the interfaces to:
> device_enable_async_action(dev, type),
> and device_disable_async_action(dev)
> so that they are more like driver core helper functions.
> what do you think?

Yes, that would be nicer.
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

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

end of thread, other threads:[~2009-08-04 13:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-24  3:02 [PATCH V2 4/4] i8042: support async suspend and shutdown Zhang Rui
2009-07-24  7:14 ` Pavel Machek
2009-08-03  9:26   ` Zhang Rui
2009-08-04 13:46     ` Pavel Machek

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

all inboxes | Powered by JetHome®