From patchwork Tue Apr 30 01:09:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jingoo Han X-Patchwork-Id: 2502971 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 947083FD1A for ; Tue, 30 Apr 2013 01:09:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759536Ab3D3BJb (ORCPT ); Mon, 29 Apr 2013 21:09:31 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:26055 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758753Ab3D3BJa (ORCPT ); Mon, 29 Apr 2013 21:09:30 -0400 Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MM100CVNN7SJLI0@mailout3.samsung.com>; Tue, 30 Apr 2013 10:09:28 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [203.254.230.51]) by epcpsbgr4.samsung.com (EPCPMTA) with SMTP id 99.6A.04074.8C91F715; Tue, 30 Apr 2013 10:09:28 +0900 (KST) X-AuditID: cbfee690-b7f136d000000fea-8b-517f19c8c95f Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 27.A2.01422.8C91F715; Tue, 30 Apr 2013 10:09:28 +0900 (KST) Received: from DOJG1HAN03 ([12.23.120.99]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MM100EORN7MSMA0@mmp1.samsung.com>; Tue, 30 Apr 2013 10:09:28 +0900 (KST) From: Jingoo Han To: "'Rafael J. Wysocki'" Cc: linux-pm@vger.kernel.org, 'Len Brown' , 'Pavel Machek' , 'Andrew Morton' , linux-kernel@vger.kernel.org, Wolfram Sang , linux-i2c@vger.kernel.org, Jingoo Han Subject: [PATCH] PM: Add pm_ops_ptr() macro Date: Tue, 30 Apr 2013 10:09:22 +0900 Message-id: <000201ce453f$5ce4fc90$16aef5b0$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: Ac5FP1F9kiI9kOQDTOmqJModGhzCsA== Content-language: ko X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrHIsWRmVeSWpSXmKPExsVy+t8zY90TkvWBBhPXaFvMWb+GzeLywkus FrOm7GWy6Pj7hdHi8q45bBafe48wWtw9dZTNon9hL5PFyhOzmB04PRbvecnkcWLGbxaPvi2r GD0eLW5h9Dh56gmLx4rV39k9Pm+SC2CP4rJJSc3JLEst0rdL4MrYuncKW8FUvoory5rZGxhP cXcxcnJICJhILOjaxwRhi0lcuLeerYuRi0NIYBmjxLIHnWwwRTunXGOESCxilLh6aCcrhPOL UeJt3w9mkCo2ATWJL18Os3cxcnCICKhLHDspAlLDLNDHJHHg9k02kLiwgLbEuo9RIOUsAqoS m44vZQSxeQUsJdaf3scGYQtK/Jh8jwXEZhbQkli/8zgThC0vsXnNW2aIgxQkdpx9DdYrIqAn MWdqByNEjYjEvhfvwA6VEPjJLrHsYSsbxDIBiW+TD7GA3CAhICux6QDUHEmJgytusExgFJuF ZPUsJKtnIVk9C8mKBYwsqxhFUwuSC4qT0otM9IoTc4tL89L1kvNzNzFC4nbCDsZ7B6wPMSYD rZ/ILCWanA+M+7ySeENjMyMLUxNTYyNzSzPShJXEedVbrAOFBNITS1KzU1MLUovii0pzUosP MTJxcEo1MBZcfGrH8POJ59WzZ6esOTTVJS4/6PTluqTAb1KtB+Y+PTzxKbu36Q5Lu61iFw2n 3637ve6Q7kPjD1u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4EQDPxNylTgMAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Add pm_ops_ptr() macro that allows the .pm entry in the driver structures to be assigned without having an #define xxx NULL for the case that PM is not enabled. Signed-off-by: Jingoo Han --- drivers/i2c/busses/i2c-s3c2410.c | 8 +------- include/linux/pm.h | 2 ++ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index 6e8ee92..e7b6639 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c @@ -1218,7 +1218,6 @@ static int s3c24xx_i2c_resume(struct device *dev) } #endif -#ifdef CONFIG_PM static const struct dev_pm_ops s3c24xx_i2c_dev_pm_ops = { #ifdef CONFIG_PM_SLEEP .suspend_noirq = s3c24xx_i2c_suspend_noirq, @@ -1226,11 +1225,6 @@ static const struct dev_pm_ops s3c24xx_i2c_dev_pm_ops = { #endif }; -#define S3C24XX_DEV_PM_OPS (&s3c24xx_i2c_dev_pm_ops) -#else -#define S3C24XX_DEV_PM_OPS NULL -#endif - /* device driver for platform bus bits */ static struct platform_driver s3c24xx_i2c_driver = { @@ -1240,7 +1234,7 @@ static struct platform_driver s3c24xx_i2c_driver = { .driver = { .owner = THIS_MODULE, .name = "s3c-i2c", - .pm = S3C24XX_DEV_PM_OPS, + .pm = pm_ops_ptr(&s3c24xx_i2c_dev_pm_ops), .of_match_table = of_match_ptr(s3c24xx_i2c_match), }, }; diff --git a/include/linux/pm.h b/include/linux/pm.h index a224c7f..bd50d15 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h @@ -55,8 +55,10 @@ struct device; #ifdef CONFIG_PM extern const char power_group_name[]; /* = "power" */ +#define pm_ops_ptr(_ptr) (_ptr) #else #define power_group_name NULL +#define pm_ops_ptr(_ptr) NULL #endif typedef struct pm_message {