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 3/4][update] hwmon / gpio-fan: Use struct dev_pm_ops for power management
Date: Sun, 8 Jul 2012 00:01:03 +0200	[thread overview]
Message-ID: <201207080001.03666.rjw@sisk.pl> (raw)
In-Reply-To: <201207072305.28595.rjw@sisk.pl>

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

Make the gpio-fan 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/gpio-fan.c |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

Index: linux/drivers/hwmon/gpio-fan.c
===================================================================
--- linux.orig/drivers/hwmon/gpio-fan.c
+++ linux/drivers/hwmon/gpio-fan.c
@@ -503,9 +503,9 @@ static int __devexit gpio_fan_remove(str
 }
 
 #ifdef CONFIG_PM
-static int gpio_fan_suspend(struct platform_device *pdev, pm_message_t state)
+static int gpio_fan_suspend(struct device *dev)
 {
-	struct gpio_fan_data *fan_data = platform_get_drvdata(pdev);
+	struct gpio_fan_data *fan_data = dev_get_drvdata(dev);
 
 	if (fan_data->ctrl) {
 		fan_data->resume_speed = fan_data->speed_index;
@@ -515,27 +515,28 @@ static int gpio_fan_suspend(struct platf
 	return 0;
 }
 
-static int gpio_fan_resume(struct platform_device *pdev)
+static int gpio_fan_resume(struct device *dev)
 {
-	struct gpio_fan_data *fan_data = platform_get_drvdata(pdev);
+	struct gpio_fan_data *fan_data = dev_get_drvdata(dev);
 
 	if (fan_data->ctrl)
 		set_fan_speed(fan_data, fan_data->resume_speed);
 
 	return 0;
 }
+
+static SIMPLE_DEV_PM_OPS(gpio_fan_pm, gpio_fan_suspend, gpio_fan_resume);
+#define GPIO_FAN_PM	(&gpio_fan_pm)
 #else
-#define gpio_fan_suspend NULL
-#define gpio_fan_resume NULL
+#define GPIO_FAN_PM	NULL
 #endif
 
 static struct platform_driver gpio_fan_driver = {
 	.probe		= gpio_fan_probe,
 	.remove		= __devexit_p(gpio_fan_remove),
-	.suspend	= gpio_fan_suspend,
-	.resume		= gpio_fan_resume,
 	.driver	= {
 		.name	= "gpio-fan",
+		.pm	= GPIO_FAN_PM,
 	},
 };
 


  reply	other threads:[~2012-07-07 21:55 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   ` [PATCH 2/4][update] " Rafael J. Wysocki
2012-07-08 17:06     ` Guenter Roeck
2012-07-07 21:05 ` [PATCH 3/4] hwmon / gpio-fan: " Rafael J. Wysocki
2012-07-07 22:01   ` Rafael J. Wysocki [this message]
2012-07-08 17:07     ` [PATCH 3/4][update] " 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=201207080001.03666.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