linux-i2c.vger.kernel.org archive mirror
 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>,
	Linus Walleij <linus.walleij@stericsson.com>,
	linux-i2c@vger.kernel.org, Sonic Zhang <sonic.zhang@analog.com>,
	Jean Delvare <khali@linux-fr.org>,
	Ben Dooks <ben-linux@fluff.org>,
	Wolfram Sang <w.sang@pengutronix.de>,
	Peter Korsgaard <jacmet@sunsite.dk>,
	Guan Xuetao <gxt@mprc.pku.edu.cn>,
	Vitaly Wool <vitalywool@gmail.com>,
	Colin Cross <ccross@android.com>,
	Stephen Warren <swarren@wwwdotorg.org>
Subject: [PATCH 2/7] i2c-bfin-twi: Use struct dev_pm_ops for power management
Date: Wed, 11 Jul 2012 21:23:31 +0200	[thread overview]
Message-ID: <201207112123.31502.rjw@sisk.pl> (raw)
In-Reply-To: <201207112121.11046.rjw@sisk.pl>

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

Make the Blackfin On-Chip Two Wire Interface 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>
---
 drivers/i2c/busses/i2c-bfin-twi.c |   18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

Index: linux/drivers/i2c/busses/i2c-bfin-twi.c
===================================================================
--- linux.orig/drivers/i2c/busses/i2c-bfin-twi.c
+++ linux/drivers/i2c/busses/i2c-bfin-twi.c
@@ -611,9 +611,9 @@ static struct i2c_algorithm bfin_twi_alg
 	.functionality = bfin_twi_functionality,
 };
 
-static int i2c_bfin_twi_suspend(struct platform_device *pdev, pm_message_t state)
+static int i2c_bfin_twi_suspend(struct device *dev)
 {
-	struct bfin_twi_iface *iface = platform_get_drvdata(pdev);
+	struct bfin_twi_iface *iface = dev_get_drvdata(dev);
 
 	iface->saved_clkdiv = read_CLKDIV(iface);
 	iface->saved_control = read_CONTROL(iface);
@@ -626,14 +626,14 @@ static int i2c_bfin_twi_suspend(struct p
 	return 0;
 }
 
-static int i2c_bfin_twi_resume(struct platform_device *pdev)
+static int i2c_bfin_twi_resume(struct device *dev)
 {
-	struct bfin_twi_iface *iface = platform_get_drvdata(pdev);
+	struct bfin_twi_iface *iface = dev_get_drvdata(dev);
 
 	int rc = request_irq(iface->irq, bfin_twi_interrupt_entry,
-		0, pdev->name, iface);
+		0, to_platform_device(dev)->name, iface);
 	if (rc) {
-		dev_err(&pdev->dev, "Can't get IRQ %d !\n", iface->irq);
+		dev_err(dev, "Can't get IRQ %d !\n", iface->irq);
 		return -ENODEV;
 	}
 
@@ -646,6 +646,9 @@ static int i2c_bfin_twi_resume(struct pl
 	return 0;
 }
 
+static SIMPLE_DEV_PM_OPS(i2c_bfin_twi_pm,
+			 i2c_bfin_twi_suspend, i2c_bfin_twi_resume);
+
 static int i2c_bfin_twi_probe(struct platform_device *pdev)
 {
 	struct bfin_twi_iface *iface;
@@ -770,11 +773,10 @@ static int i2c_bfin_twi_remove(struct pl
 static struct platform_driver i2c_bfin_twi_driver = {
 	.probe		= i2c_bfin_twi_probe,
 	.remove		= i2c_bfin_twi_remove,
-	.suspend	= i2c_bfin_twi_suspend,
-	.resume		= i2c_bfin_twi_resume,
 	.driver		= {
 		.name	= "i2c-bfin-twi",
 		.owner	= THIS_MODULE,
+		.pm	= &i2c_bfin_twi_pm,
 	},
 };
 

  parent reply	other threads:[~2012-07-11 19:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-11 19:21 [PATCH 0/7] PM / I2C: Convert platform I2C drivers to PM handling based on struct dev_pm_ops Rafael J. Wysocki
2012-07-11 19:22 ` [PATCH 1/7] i2c-at91: Use struct dev_pm_ops for power management Rafael J. Wysocki
2012-07-11 19:23 ` Rafael J. Wysocki [this message]
2012-07-12  2:51   ` [PATCH 2/7] i2c-bfin-twi: " Zhang, Sonic
2012-07-11 19:24 ` [PATCH 3/7] i2c-ocores: " Rafael J. Wysocki
2012-07-11 19:25 ` [PATCH 5/7] i2c-puv3: " Rafael J. Wysocki
2012-07-12  3:24   ` guanxuetao
2012-07-11 19:26 ` [PATCH 6/7] i2c-stu300: " Rafael J. Wysocki
     [not found]   ` <201207112126.36412.rjw-KKrjLPT3xs0@public.gmane.org>
2012-07-11 21:56     ` Linus Walleij
2012-07-11 19:27 ` [PATCH 7/7] i2c-tegra: " Rafael J. Wysocki
     [not found] ` <201207112121.11046.rjw-KKrjLPT3xs0@public.gmane.org>
2012-07-11 19:25   ` [PATCH 4/7] i2c-pnx: " Rafael J. Wysocki
2012-07-12  6:00   ` [PATCH 0/7] PM / I2C: Convert platform I2C drivers to PM handling based on struct dev_pm_ops Laxman Dewangan
2012-07-12 10:09 ` Wolfram Sang
2012-07-12 10:17   ` Rafael J. Wysocki

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=201207112123.31502.rjw@sisk.pl \
    --to=rjw@sisk.pl \
    --cc=ben-linux@fluff.org \
    --cc=ccross@android.com \
    --cc=gxt@mprc.pku.edu.cn \
    --cc=jacmet@sunsite.dk \
    --cc=khali@linux-fr.org \
    --cc=linus.walleij@stericsson.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=sonic.zhang@analog.com \
    --cc=swarren@wwwdotorg.org \
    --cc=vitalywool@gmail.com \
    --cc=w.sang@pengutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).