All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Zhang Rui <rui.zhang@intel.com>
Cc: Pavel Machek <pavel@ucw.cz>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-pm <linux-pm@lists.linux-foundation.org>,
	linux-acpi <linux-acpi@vger.kernel.org>,
	Len Brown <lenb@kernel.org>,
	Arjan van de Ven <arjan@linux.intel.com>
Subject: Re: [PATCH 8/8] i8042: support device async suspend & shutdown
Date: Fri, 17 Jul 2009 04:40:15 +0200	[thread overview]
Message-ID: <200907170440.16678.rjw@sisk.pl> (raw)
In-Reply-To: <1247795488.26272.227.camel@rzhang-dt>

On Friday 17 July 2009, Zhang Rui wrote:
> On Wed, 2009-07-15 at 08:37 +0800, Pavel Machek wrote:
> > On Wed 2009-07-15 15:38:42, 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/resumed/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
> > > @@ -1284,14 +1284,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:
> > > @@ -1304,6 +1311,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();
> > 
> > Could we get the core to do async_unregister during device_unregister?
> > 
> yes, we can.
> I think it's a little strange that drivers need to invoke
> dev_async_register to register an async device group, but don't need to
> call dev_async_unregister to unregister it.
> 
> > Or maybe better, just add flags during device_add?
> > 
> Many devices don't know if they support async actions or not during
> device initialization time, like PCI and ACPI devices.
> If we want to create an async group for a PCI device, we have to call
> dev_async_register in the specified PCI device driver, rather than in
> the PCI bus scan stage.

That is quite a big design issue, IMO.

Did you consider any other approach to this?

Best,
Rafael

  reply	other threads:[~2009-07-17  2:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-15  7:38 [PATCH 8/8] i8042: support device async suspend & shutdown Zhang Rui
2009-07-15  0:37 ` Pavel Machek
2009-07-15  0:37 ` Pavel Machek
2009-07-17  1:51   ` Zhang Rui
2009-07-17  1:51     ` Zhang Rui
2009-07-17  2:40     ` Rafael J. Wysocki [this message]
2009-07-17  3:08       ` Zhang Rui
2009-07-17  3:08       ` Zhang Rui
2009-07-17  2:40     ` Rafael J. Wysocki
2009-07-15 10:46 ` Andi Kleen
2009-07-16  1:45   ` Zhang Rui
2009-07-16  1:45   ` Zhang Rui
2009-07-15 10:46 ` Andi Kleen
  -- strict thread matches above, loose matches on Subject: below --
2009-07-15  7:38 Zhang Rui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200907170440.16678.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=arjan@linux.intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=pavel@ucw.cz \
    --cc=rui.zhang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.