public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Linux PM list <linux-pm@vger.kernel.org>,
	Hans de Goede <hdegoede@redhat.com>,
	Alistair John Strachan <alistair@devzero.co.uk>,
	lm-sensors@lm-sensors.org, Jean Delvare <khali@linux-fr.org>,
	Guenter Roeck <linux@roeck-us.net>,
	Kukjin Kim <kgene.kim@samsung.com>
Subject: [PATCH 2/4][update] hwmon / abituguru3: Use struct dev_pm_ops for power management
Date: Sun, 8 Jul 2012 00:00:01 +0200	[thread overview]
Message-ID: <201207080000.02081.rjw@sisk.pl> (raw)
In-Reply-To: <201207072304.42750.rjw@sisk.pl>

From: Rafael J. Wysocki <rjw@sisk.pl>

Make the Abit uGuru rev. 3 driver define its PM callbacks through
a struct dev_pm_ops object rather than by using legacy PM hooks
in struct platform_driver.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---

dev_get_drvdata() may be used directly instead of being wrapped in
platform_get_drvdata(to_platform_device()).

---
 drivers/hwmon/abituguru3.c |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

Index: linux/drivers/hwmon/abituguru3.c
===================================================================
--- linux.orig/drivers/hwmon/abituguru3.c
+++ linux/drivers/hwmon/abituguru3.c
@@ -1142,9 +1142,9 @@ LEAVE_UPDATE:
 }
 
 #ifdef CONFIG_PM
-static int abituguru3_suspend(struct platform_device *pdev, pm_message_t state)
+static int abituguru3_suspend(struct device *dev)
 {
-	struct abituguru3_data *data = platform_get_drvdata(pdev);
+	struct abituguru3_data *data = dev_get_drvdata(dev);
 	/*
 	 * make sure all communications with the uguru3 are done and no new
 	 * ones are started
@@ -1153,26 +1153,27 @@ static int abituguru3_suspend(struct pla
 	return 0;
 }
 
-static int abituguru3_resume(struct platform_device *pdev)
+static int abituguru3_resume(struct device *dev)
 {
-	struct abituguru3_data *data = platform_get_drvdata(pdev);
+	struct abituguru3_data *data = dev_get_drvdata(dev);
 	mutex_unlock(&data->update_lock);
 	return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(abituguru3_pm, abituguru3_suspend, abituguru3_resume);
+#define ABIT_UGURU3_PM	(&abituguru3_pm)
 #else
-#define abituguru3_suspend	NULL
-#define abituguru3_resume	NULL
+#define ABIT_UGURU3_PM	NULL
 #endif /* CONFIG_PM */
 
 static struct platform_driver abituguru3_driver = {
 	.driver = {
 		.owner	= THIS_MODULE,
 		.name	= ABIT_UGURU3_NAME,
+		.pm	= ABIT_UGURU3_PM
 	},
 	.probe	= abituguru3_probe,
 	.remove	= __devexit_p(abituguru3_remove),
-	.suspend = abituguru3_suspend,
-	.resume = abituguru3_resume
 };
 
 static int __init abituguru3_dmi_detect(void)


  reply	other threads:[~2012-07-07 21:54 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-07 21:02 [PATCH 0/4] PM / hwmon: Convert platform hwmon drivers to PM handling based on struct dev_pm_ops Rafael J. Wysocki
2012-07-07 21:04 ` [PATCH 1/4] hwmon / abituguru: Use struct dev_pm_ops for power management Rafael J. Wysocki
2012-07-07 21:59   ` [PATCH 1/4][update] " Rafael J. Wysocki
2012-07-08 17:06     ` Guenter Roeck
2012-07-07 21:04 ` [PATCH 2/4] hwmon / abituguru3: " Rafael J. Wysocki
2012-07-07 22:00   ` Rafael J. Wysocki [this message]
2012-07-08 17:06     ` [PATCH 2/4][update] " Guenter Roeck
2012-07-07 21:05 ` [PATCH 3/4] hwmon / gpio-fan: " Rafael J. Wysocki
2012-07-07 22:01   ` [PATCH 3/4][update] " Rafael J. Wysocki
2012-07-08 17:07     ` Guenter Roeck
2012-07-07 21:06 ` [PATCH 4/4] hwmon / exynos4_tmu: " Rafael J. Wysocki
2012-07-08 17:02   ` Guenter Roeck
2012-07-08 19:48     ` [PATCH 4/4][update] " Rafael J. Wysocki
2012-07-08 20:30       ` Guenter Roeck
2012-07-08 20:46         ` Rafael J. Wysocki
2012-07-09  4:42           ` Guenter Roeck

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=201207080000.02081.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=alistair@devzero.co.uk \
    --cc=hdegoede@redhat.com \
    --cc=kgene.kim@samsung.com \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lm-sensors@lm-sensors.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