lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <00b201ce1f82$60a775c0$21f66140$%han@samsung.com>
Date:	Wed, 13 Mar 2013 09:33:26 +0900
From:	Jingoo Han <jg1.han@...sung.com>
To:	'Lars-Peter Clausen' <lars@...afoo.de>
Cc:	'Andrew Morton' <akpm@...ux-foundation.org>,
	'LKML' <linux-kernel@...r.kernel.org>,
	'Richard Purdie' <rpurdie@...ys.net>,
	'Jingoo Han' <jg1.han@...sung.com>
Subject: Re: [PATCH] backlight: da903x_bl: switch to using SIMPLE_DEV_PM_OPS

On Wednesday, March 13, 2013 4:03 AM, Lars-Peter Clausen wrote:
> 
> 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@...sung.com>
> 
> I think you can eliminate the suspend/resume functions all together by using
> the blacklight subsystems CORE_SUSPENDRESUME feature.

Hi Lars-Peter Clausen,

Yes, you're right.
I will use CORE_SUSPENDRESUME feature.
Thank you for your comment :)

Best regards,
Jingoo Han

> 
> 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,

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ