mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Jingoo Han <jg1.han@samsung.com>
Cc: "'Andrew Morton'" <akpm@linux-foundation.org>,
	"'LKML'" <linux-kernel@vger.kernel.org>,
	"'Richard Purdie'" <rpurdie@rpsys.net>
Subject: Re: [PATCH] backlight: da903x_bl: switch to using SIMPLE_DEV_PM_OPS
Date: Tue, 12 Mar 2013 20:02:42 +0100	[thread overview]
Message-ID: <513F7BD2.5040800@metafoo.de> (raw)
In-Reply-To: <003d01ce1ee5$316a57c0$943f0740$%han@samsung.com>

On 03/12/2013 06:48 AM, Jingoo Han wrote:
> This reduces #ifdefs in the code. Also, CONFIG_PM_SLEEP is used
> to avoid warnings of unused functions if CONFIG_PM_SLEEP is not
> defined.
> 
> Signed-off-by: Jingoo Han <jg1.han@samsung.com>

I think you can eliminate the suspend/resume functions all together by using
the blacklight subsystems CORE_SUSPENDRESUME feature.

E.g.

diff --git a/drivers/video/backlight/da903x_bl.c
b/drivers/video/backlight/da903x_bl.c
index 8179cef..80ba6b3 100644
--- a/drivers/video/backlight/da903x_bl.c
+++ b/drivers/video/backlight/da903x_bl.c
@@ -88,6 +88,9 @@ static int da903x_backlight_update_status(struct
 	if (bl->props.fb_blank != FB_BLANK_UNBLANK)
 		brightness = 0;

+	if (bl->props.state & BL_CORE_SUSPENDED)
+		brightness = 0;
+
 	return da903x_backlight_set(bl, brightness);
 }

@@ -100,6 +103,7 @@ static int da903x_backlight_get_brightness(struct
 static const struct backlight_ops da903x_backlight_ops = {
 	.update_status	= da903x_backlight_update_status,
 	.get_brightness	= da903x_backlight_get_brightness,
+	.options	= BL_CORE_SUSPENDRESUME,
 };

 static int da903x_backlight_probe(struct platform_device *pdev)
@@ -161,35 +165,10 @@ static int da903x_backlight_remove(struct
 	return 0;
 }

-#ifdef CONFIG_PM
-static int da903x_backlight_suspend(struct device *dev)
-{
-	struct backlight_device *bl = dev_get_drvdata(dev);
-
-	return da903x_backlight_set(bl, 0);
-}
-
-static int da903x_backlight_resume(struct device *dev)
-{
-	struct backlight_device *bl = dev_get_drvdata(dev);
-
-	backlight_update_status(bl);
-	return 0;
-}
-
-static const struct dev_pm_ops da903x_backlight_pm_ops = {
-	.suspend	= da903x_backlight_suspend,
-	.resume		= da903x_backlight_resume,
-};
-#endif
-
 static struct platform_driver da903x_backlight_driver = {
 	.driver		= {
 		.name	= "da903x-backlight",
 		.owner	= THIS_MODULE,
-#ifdef CONFIG_PM
-		.pm	= &da903x_backlight_pm_ops,
-#endif
 	},
 	.probe		= da903x_backlight_probe,
 	.remove		= da903x_backlight_remove,

  reply	other threads:[~2013-03-12 19:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-12  5:48 Jingoo Han
2013-03-12 19:02 ` Lars-Peter Clausen [this message]
2013-03-13  0:33   ` Jingoo Han
2013-03-13  0:51 ` [PATCH] backlight: da903x_bl: use BL_CORE_SUSPENDRESUME option 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=513F7BD2.5040800@metafoo.de \
    --to=lars@metafoo.de \
    --cc=akpm@linux-foundation.org \
    --cc=jg1.han@samsung.com \
    --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

Powered by JetHome