From patchwork Tue Apr 1 00:08:33 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jingoo Han X-Patchwork-Id: 3918201 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DBB4C9F357 for ; Tue, 1 Apr 2014 00:08:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9B6B3203AF for ; Tue, 1 Apr 2014 00:08:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4F15B20204 for ; Tue, 1 Apr 2014 00:08:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751153AbaDAAIg (ORCPT ); Mon, 31 Mar 2014 20:08:36 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:65471 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750857AbaDAAIf convert rfc822-to-8bit (ORCPT ); Mon, 31 Mar 2014 20:08:35 -0400 Received: from epcpsbgr1.samsung.com (u141.gpu120.samsung.co.kr [203.254.230.141]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N3B006Z0SEA0U00@mailout3.samsung.com> for linux-fbdev@vger.kernel.org; Tue, 01 Apr 2014 09:08:34 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [203.254.230.51]) by epcpsbgr1.samsung.com (EPCPMTA) with SMTP id F6.4C.12635.2830A335; Tue, 01 Apr 2014 09:08:34 +0900 (KST) X-AuditID: cbfee68d-b7fcd6d00000315b-83-533a0382e48e Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 13.90.28157.2830A335; Tue, 01 Apr 2014 09:08:34 +0900 (KST) Received: from DOJG1HAN03 ([12.36.166.146]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N3B002BDSE9C070@mmp2.samsung.com>; Tue, 01 Apr 2014 09:08:33 +0900 (KST) From: Jingoo Han To: 'Alexander Shiyan' , 'Lee Jones' Cc: linux-fbdev@vger.kernel.org, 'Bryan Wu' , 'Jean-Christophe Plagniol-Villard' , 'Tomi Valkeinen' , 'Jingoo Han' , 'Joe Perches' , 'Dan Carpenter' References: <1396087871-9091-1-git-send-email-shc_work@mail.ru> <1396253926.772940992@f347.i.mail.ru> <20140331085047.GA20397@lee--X1> <1396262212.223310081@f381.i.mail.ru> In-reply-to: <1396262212.223310081@f381.i.mail.ru> Subject: Re: [PATCH] backlight: pwm_bl: Use SIMPLE_DEV_PM_OPS() Date: Tue, 01 Apr 2014 09:08:33 +0900 Message-id: <000701cf4d3e$856f2ac0$904d8040$%han@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-transfer-encoding: 8BIT X-Mailer: Microsoft Office Outlook 12.0 Thread-index: Ac9MzSPRZeornPSKQieIhvWtbX/UfAAb4cpA Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrHIsWRmVeSWpSXmKPExsVy+t8zY90mZqtgg6U3eS2O7pzIZPH633QW i8sLL7FazL7/mMXi/tejjBYn+j6wWqx7+ILJYtIOKYv182+xOXB67Jx1l93j1YU7LB53ru1h 85gy9wirx8ent1g8vqy6xuzRt2UVo8fxG9uZPD5vkgvgjOKySUnNySxLLdK3S+DKaHt0laVg oVTFok2rGBsYd4l0MXJySAiYSGx994UFwhaTuHBvPVsXIxeHkMAyRondu7tYYYralv5igkhM Z5RYtfQ8K4Tzm1GicfJ6JpAqNgE1iS9fDrOD2CICvhJPD04C62AWmMsk0bFnFgtExwZGiY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Di x+R7LCBhZgF1iSlTckHCzALaEk/eXWAFCUsAhR/91YU4wUji9dI5zBAlIhL7XrxjnMAoNAvJ oFkIg2YhGTQLSccCRpZVjKKpBckFxUnpuUZ6xYm5xaV56XrJ+bmbGMFJ5Zn0DsZVDRaHGAU4 GJV4eC3KLYOFWBPLiitzDzFKcDArifAeeQ8U4k1JrKxKLcqPLyrNSS0+xJgM9OVEZinR5Hxg wssriTc0NjEzsjQyszAyMTcnTVhJnPdgq3WgkEB6YklqdmpqQWoRzBYmDk6pBkY5DbGJd7X3 nHooUtJ6+Gdax6bV05f+zLHl5GRMV161fNmFmIzysyXzN9Y23ntX+E/EhKnM+abDkZa7BakX 1LKa7y+bt6Xh4IPJImmbFea0u/OJPj/qHcj+s2SPd8TZhdvLV/h4/vVctT2mP+PjrCsPtfkc Li98Flk7effKh8UBV9j6JMsXBzsrsRRnJBpqMRcVJwIAu2iF2G4DAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Monday, March 31, 2014 7:37 PM, Lee Jones wrote: > Mon, 31 Mar 2014 09:50:47 +0100 ?? Lee Jones : > > > > > > > Use the SIMPLE_DEV_PM_OPS() macro to declare the driver's pm_ops. > > > > > > > > > > > > > > Signed-off-by: Alexander Shiyan > > > > > > > --- > > > > > > > drivers/video/backlight/pwm_bl.c | 17 ++++------------- > > > > > > > 1 file changed, 4 insertions(+), 13 deletions(-) > > > > > > > > > > > > > > diff --git a/drivers/video/backlight/pwm_bl.c b/drivers/video/backlight/pwm_bl.c > > > > > > > index b75201f..d5e1f5b 100644 > > > > > > > --- a/drivers/video/backlight/pwm_bl.c > > > > > > > +++ b/drivers/video/backlight/pwm_bl.c > > > > > > > > > > > > [...] > > > > > > > > > > > > > -static int pwm_backlight_resume(struct device *dev) > > > > > > > +static int __maybe_unused pwm_bl_resume(struct device *dev) > > > > > > > > > > > > What's the __maybe_unused attribute for? > > > > > > > > > > > > In include/linux/compiler-gcc.h it redefines the attribute as 'unused': > > > > > > > > > > > > #define __maybe_unused __attribute__((unused)) > > > > > > > > > > > > ... are you sure this is what you want? > > > > > > > > > > Yes. This avoids compiler warnings if CONFIG_PM is unset. > > > > > > > > What are the advantages of this over the config option? Besides 2 > > > > lines of code? > > > > > > Just an increase compile coverage. > > > > What does this mean? I replied to another one of your patches with the > > same question. > > Code parts for suspend() and resume() will be compiled regardless of > CONFIG_PM option and will be discarded by linker if CONFIG_PM is not set. (+cc Joe Perches, Dan Carpenter) Original patch is http://www.spinics.net/lists/linux-fbdev/msg14177.html I don't think that __maybe_unused is good. Currently, SIMPLE_DEV_PM_OPS is using "#ifdef CONFIG_PM_SLEEP" as below. So, suspend_fn, resume_fn should be protected by "#ifdef CONFIG_PM_SLEEP". Maybe, it is necessary to fix SET_SYSTEM_SLEEP_PM_OPS define, in order to increase compile coverage. ./include/linux/pm.h #define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ const struct dev_pm_ops name = { \ SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \ } #ifdef CONFIG_PM_SLEEP #define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \ .suspend = suspend_fn, \ .resume = resume_fn, \ .freeze = suspend_fn, \ .thaw = resume_fn, \ .poweroff = suspend_fn, \ .restore = resume_fn, #else #define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) #endif Please, don’t remove "#ifdef CONFIG_PM_SLEEP". Your patch can be modified as below: --- To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/drivers/video/backlight/pwm_bl.c +++ b/drivers/video/backlight/pwm_bl.c @@ -386,14 +386,7 @@ static int pwm_backlight_resume(struct device *dev) } #endif -static const struct dev_pm_ops pwm_backlight_pm_ops = { -#ifdef CONFIG_PM_SLEEP - .suspend = pwm_backlight_suspend, - .resume = pwm_backlight_resume, - .poweroff = pwm_backlight_suspend, - .restore = pwm_backlight_resume, -#endif -}; +static SIMPLE_DEV_PM_OPS(pwm_bl_pm_ops, pwm_bl_suspend, pwm_bl_resume); Best regards, Jingoo Han