All of lore.kernel.org
 help / color / mirror / Atom feed
From: shubhrajyoti@ti.com
To: linux-iio@vger.kernel.org
Cc: Shubhrajyoti Datta <shubhrajyoti@ti.com>
Subject: [PATCH ]hmc5843: Convert to dev pm ops
Date: Tue, 18 Jan 2011 12:29:10 +0530	[thread overview]
Message-ID: <1295333951-3793-1-git-send-email-shubhrajyoti@ti.com> (raw)

From: Shubhrajyoti Datta <shubhrajyoti@ti.com>


Signed-off-by: Shubhrajyoti Datta <shubhrajyoti@ti.com>
---
 drivers/staging/iio/magnetometer/hmc5843.c |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/iio/magnetometer/hmc5843.c b/drivers/staging/iio/magnetometer/hmc5843.c
index 5168917..b1c26d8 100644
--- a/drivers/staging/iio/magnetometer/hmc5843.c
+++ b/drivers/staging/iio/magnetometer/hmc5843.c
@@ -583,20 +583,25 @@ static int hmc5843_remove(struct i2c_client *client)
 	kfree(i2c_get_clientdata(client));
 	return 0;
 }
-
-static int hmc5843_suspend(struct i2c_client *client, pm_message_t mesg)
+#ifdef CONFIG_PM
+static int hmc5843_suspend(struct device *dev)
 {
+	struct i2c_client *client = to_i2c_client(dev);
 	hmc5843_configure(client, MODE_SLEEP);
 	return 0;
 }
 
-static int hmc5843_resume(struct i2c_client *client)
+static int hmc5843_resume(struct device *dev)
 {
+	struct i2c_client *client = to_i2c_client(dev);
 	struct hmc5843_data *data = i2c_get_clientdata(client);
 	hmc5843_configure(client, data->operating_mode);
 	return 0;
 }
-
+static SIMPLE_DEV_PM_OPS(hmc5843_pm, hmc5843_suspend, hmc5843_resume);
+#else
+#define hmc5843_pm NULL
+#endif
 static const struct i2c_device_id hmc5843_id[] = {
 	{ "hmc5843", 0 },
 	{ }
@@ -605,14 +610,15 @@ static const struct i2c_device_id hmc5843_id[] = {
 static struct i2c_driver hmc5843_driver = {
 	.driver = {
 		.name	= "hmc5843",
+#ifdef CONFIG_PM
+		.pm	= &hmc5843_pm,
+#endif
 	},
 	.id_table	= hmc5843_id,
 	.probe		= hmc5843_probe,
 	.remove		= hmc5843_remove,
 	.detect		= hmc5843_detect,
 	.address_list	= normal_i2c,
-	.suspend	= hmc5843_suspend,
-	.resume		= hmc5843_resume,
 };
 
 static int __init hmc5843_init(void)
-- 
1.7.1


             reply	other threads:[~2011-01-18  6:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-18  6:59 shubhrajyoti [this message]
2011-01-18  6:59 ` [PATCH ] hmc5843: Trivial optimisation shubhrajyoti
2011-01-18 11:14   ` Jonathan Cameron
2011-01-18 11:09 ` [PATCH ]hmc5843: Convert to dev pm ops Jonathan Cameron
2011-01-18 11:42 [PATCH] hmc5843: " shubhrajyoti
2011-01-18 11:48 ` Jonathan Cameron

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=1295333951-3793-1-git-send-email-shubhrajyoti@ti.com \
    --to=shubhrajyoti@ti.com \
    --cc=linux-iio@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 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.