public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: linux-kernel@vger.kernel.org, Hong Liu <hong.liu@intel.com>
Subject: Re: [PATCH] apds9802als: add runtime PM support
Date: Fri, 22 Oct 2010 13:03:24 -0700	[thread overview]
Message-ID: <20101022130324.ce4ec019.akpm@linux-foundation.org> (raw)
In-Reply-To: <20101015134713.25557.44608.stgit@localhost.localdomain>

On Fri, 15 Oct 2010 14:47:25 +0100
Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:

>     Update the driver for the needed runtime power features. Remove the old
>     user controlled power functions.

How's this look?



put PM code under CONFIG_PM

Cc: Alan Cox <alan@linux.intel.com>
Cc: Hong Liu <hong.liu@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 drivers/misc/apds9802als.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff -puN drivers/misc/apds9802als.c~drivers-misc-apds9802alsc-add-runtime-pm-support-fix drivers/misc/apds9802als.c
--- a/drivers/misc/apds9802als.c~drivers-misc-apds9802alsc-add-runtime-pm-support-fix
+++ a/drivers/misc/apds9802als.c
@@ -266,6 +266,7 @@ static int apds9802als_remove(struct i2c
 	return 0;
 }
 
+#ifdef CONFIG_PM
 static int apds9802als_suspend(struct i2c_client *client, pm_message_t mesg)
 {
 	als_set_power_state(client, false);
@@ -302,6 +303,14 @@ static const struct dev_pm_ops apds9802a
 	.runtime_resume = apds9802als_runtime_resume,
 };
 
+#define APDS9802ALS_PM_OPS (&apds9802als_pm_ops)
+
+#else	/* CONFIG_PM */
+#define apds9802als_suspend NULL
+#define apds9802als_resume NULL
+#define APDS9802ALS_PM_OPS NULL
+#endif	/* CONFIG_PM */
+
 static struct i2c_device_id apds9802als_id[] = {
 	{ DRIVER_NAME, 0 },
 	{ }
@@ -312,7 +321,7 @@ MODULE_DEVICE_TABLE(i2c, apds9802als_id)
 static struct i2c_driver apds9802als_driver = {
 	.driver = {
 		.name = DRIVER_NAME,
-		.pm = &apds9802als_pm_ops,
+		.pm = APDS9802ALS_PM_OPS,
 	},
 	.probe = apds9802als_probe,
 	.remove = apds9802als_remove,
_


And a question.  This driver puts the .suspend and .resume pointers
into the `struct i2c_driver'.  However drivers/misc/isl29020.c does not
do that.  What's up with that?

  reply	other threads:[~2010-10-22 20:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-15 13:47 [PATCH] apds9802als: add runtime PM support Alan Cox
2010-10-22 20:03 ` Andrew Morton [this message]
  -- strict thread matches above, loose matches on Subject: below --
2010-10-21 18:34 Alan Stern
2010-10-26  6:05 ` Hong Liu
2010-10-26 13:51   ` Alan Stern
2010-10-27  0:39     ` Hong Liu
2010-10-27 14:13       ` Alan Stern

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=20101022130324.ce4ec019.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=hong.liu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox