mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jingoo Han <jg1.han@samsung.com>
To: "'Andrew Morton'" <akpm@linux-foundation.org>
Cc: "'LKML'" <linux-kernel@vger.kernel.org>,
	"'Richard Purdie'" <rpurdie@rpsys.net>,
	"'Jingoo Han'" <jg1.han@samsung.com>
Subject: [PATCH 07/14] backlight: corgi_lcd: convert corgi_lcd to dev_pm_ops
Date: Tue, 12 Mar 2013 14:51:18 +0900	[thread overview]
Message-ID: <004401ce1ee5$9da8ea00$d8fabe00$%han@samsung.com> (raw)
In-Reply-To: <003e01ce1ee5$4897e020$d9c7a060$%han@samsung.com>

Instead of using legacy suspend/resume methods, using newer dev_pm_ops
structure allows better control over power management.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
 drivers/video/backlight/corgi_lcd.c |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/video/backlight/corgi_lcd.c b/drivers/video/backlight/corgi_lcd.c
index aa782f3..c97867a 100644
--- a/drivers/video/backlight/corgi_lcd.c
+++ b/drivers/video/backlight/corgi_lcd.c
@@ -457,10 +457,10 @@ static const struct backlight_ops corgi_bl_ops = {
 	.update_status  = corgi_bl_update_status,
 };
 
-#ifdef CONFIG_PM
-static int corgi_lcd_suspend(struct spi_device *spi, pm_message_t state)
+#ifdef CONFIG_PM_SLEEP
+static int corgi_lcd_suspend(struct device *dev)
 {
-	struct corgi_lcd *lcd = spi_get_drvdata(spi);
+	struct corgi_lcd *lcd = dev_get_drvdata(dev);
 
 	corgibl_flags |= CORGIBL_SUSPENDED;
 	corgi_bl_set_intensity(lcd, 0);
@@ -468,20 +468,19 @@ static int corgi_lcd_suspend(struct spi_device *spi, pm_message_t state)
 	return 0;
 }
 
-static int corgi_lcd_resume(struct spi_device *spi)
+static int corgi_lcd_resume(struct device *dev)
 {
-	struct corgi_lcd *lcd = spi_get_drvdata(spi);
+	struct corgi_lcd *lcd = dev_get_drvdata(dev);
 
 	corgibl_flags &= ~CORGIBL_SUSPENDED;
 	corgi_lcd_set_power(lcd->lcd_dev, FB_BLANK_UNBLANK);
 	backlight_update_status(lcd->bl_dev);
 	return 0;
 }
-#else
-#define corgi_lcd_suspend	NULL
-#define corgi_lcd_resume	NULL
 #endif
 
+static SIMPLE_DEV_PM_OPS(corgi_lcd_pm_ops, corgi_lcd_suspend, corgi_lcd_resume);
+
 static int setup_gpio_backlight(struct corgi_lcd *lcd,
 				struct corgi_lcd_platform_data *pdata)
 {
@@ -611,11 +610,10 @@ static struct spi_driver corgi_lcd_driver = {
 	.driver		= {
 		.name	= "corgi-lcd",
 		.owner	= THIS_MODULE,
+		.pm	= &corgi_lcd_pm_ops,
 	},
 	.probe		= corgi_lcd_probe,
 	.remove		= corgi_lcd_remove,
-	.suspend	= corgi_lcd_suspend,
-	.resume		= corgi_lcd_resume,
 };
 
 module_spi_driver(corgi_lcd_driver);
-- 
1.7.2.5



  parent reply	other threads:[~2013-03-12  5:51 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-12  5:48 [PATCH 01/14] backlight: ld9040: convert ld9040 " Jingoo Han
2013-03-12  5:49 ` [PATCH 02/14] backlight: lms501kf03: convert lms501kf03 " Jingoo Han
2013-03-12  5:49 ` [PATCH 03/14] backlight: s6e63m0: convert s6e63m0 " Jingoo Han
2013-03-12  5:50 ` [PATCH 04/14] backlight: adp5520: convert adp5520_bl " Jingoo Han
2013-03-12  5:50 ` [PATCH 05/14] backlight: adp8860: convert adp8860 " Jingoo Han
2013-03-12  5:50 ` [PATCH 06/14] backlight: adp8870: convert adp8870 " Jingoo Han
2013-03-12  5:51 ` Jingoo Han [this message]
2013-03-12  5:51 ` [PATCH 08/14] backlight: ep93xx: convert ep93xx " Jingoo Han
2013-03-12  5:52 ` [PATCH 09/14] backlight: hp680_bl: convert hp680bl " Jingoo Han
2013-03-12  5:52 ` [PATCH 10/14] backlight: kb3886_bl: convert kb3886bl " Jingoo Han
2013-03-12  5:52 ` [PATCH 11/14] backlight: lm3533_bl: convert lm3533_bl " Jingoo Han
2013-03-12  5:53 ` [PATCH 12/14] backlight: locomolcd: convert locomolcd " Jingoo Han
2013-03-12  5:53 ` [PATCH 13/14] backlight: ltv350qv: convert ltv350qv " Jingoo Han
2013-03-12  5:53 ` [PATCH 14/14] backlight: tdo24m: convert tdo24m " Jingoo Han

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='004401ce1ee5$9da8ea00$d8fabe00$%han@samsung.com' \
    --to=jg1.han@samsung.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rpurdie@rpsys.net \
    /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

all inboxes | Powered by JetHome®