From patchwork Sun Oct 23 09:48:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 7972 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1546838wrr; Sun, 23 Oct 2022 02:52:07 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4qVdEwEA4JPcEDnt1vhs1UqfiMiS/YEFfXQ//+aCmeQeenMrCUIT//lqKF5YjUkk98E0LR X-Received: by 2002:a05:6a00:330a:b0:563:176d:af81 with SMTP id cq10-20020a056a00330a00b00563176daf81mr28374665pfb.13.1666518727491; Sun, 23 Oct 2022 02:52:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666518727; cv=none; d=google.com; s=arc-20160816; b=IoDJcfpwz+iTEWoTRNRZ2ghCv4KgI3PGLrkH9y+t6H/eFJd1r/Cgax27sxFG4YafJ0 dlhemb7mTD6k9F3Q1nvrXv/2QXayWdaalPYCIWecXdkeSBN+NHNwdLpMM556sR9EnBV1 8H2vvIsNys8+iI1q4qf63MPY6zmKf0OLKcUhdSgFk5v0DoqxIte0PpiX61DPU2PoClA4 I/kz6WsILnYljrhNqGQDWSCoTAh06P6uypV8qrQC0cBpw+lKuP99ZuL1SgQKBhE7CpNv blr5v+m2BQyNGWquxWP9Oxp21T6NQjnVOIuJi04fQ9v3xgM9HSf1aM8FcUtlcFos5FFG I/zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DrQfVq26IcEBKrFEtoBOOzSjXtsyVbn1/l3uB8Ev+4g=; b=v8IV+8Xkyw58Wml+zulBQw3nIvbOlVwRIenxkrXJDvpjE5wTJ17iK5FYh9qwB049aZ B2THDIACN7ffGPoI1ewEJUz2TV8Gn2s6Hm9qn9j8Rnptct12B+a/Q9Y2Dn0BsoBp4f4g J+krBp5CbTbcnIGqx6Akcl0bledFGyJvm0MRtqzA0PGYpiJwUaggOQZtB4R6g7kyoJbu AN9gOTed2pbbACMHSSNoZd5jdA+/SN7Eg5g8+f/K4eXjimt4Eacw/5bjcI6p3SUgNlSp qL0E8Eu+lXHy9T57oThlaWZ3/tETkX6zQ/Hx9CbmYkKpTAOFKigTNKkfXQ/yC/gyhNrF NLAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=kgb2K0N3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l190-20020a6391c7000000b0046b127a88d5si29727753pge.552.2022.10.23.02.51.54; Sun, 23 Oct 2022 02:52:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=kgb2K0N3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230146AbiJWJtO (ORCPT + 99 others); Sun, 23 Oct 2022 05:49:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230141AbiJWJtM (ORCPT ); Sun, 23 Oct 2022 05:49:12 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91A686BCEE for ; Sun, 23 Oct 2022 02:49:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518543; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=DrQfVq26IcEBKrFEtoBOOzSjXtsyVbn1/l3uB8Ev+4g=; b=kgb2K0N3EQq0luk0lhhXzMYrHyme9zzOFDWu8wKPFBkuqSry3SqyL4AWNrB6xM4PJipOup W7VMdgy9C95YrZ3A2iF07l0yi13+V8bPgVW4uhAIZCCt0ulYqqiZeiHEnRvS3mKmGSfVeX R2XF3LuDwrlh8XMbKOjQluhhNRCDo5w= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 01/28] mfd: 88pm80x: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:25 +0100 Message-Id: <20221023094852.8035-2-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747471540896584467?= X-GMAIL-MSGID: =?utf-8?q?1747471540896584467?= Use the new EXPORT_GPL_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- drivers/mfd/88pm800.c | 2 +- drivers/mfd/88pm805.c | 2 +- drivers/mfd/88pm80x.c | 5 +---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index eaf9845633b4..409f0996ae1d 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -599,7 +599,7 @@ static int pm800_remove(struct i2c_client *client) static struct i2c_driver pm800_driver = { .driver = { .name = "88PM800", - .pm = &pm80x_pm_ops, + .pm = pm_sleep_ptr(&pm80x_pm_ops), }, .probe = pm800_probe, .remove = pm800_remove, diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index ada6c513302b..724ac4947e6f 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c @@ -254,7 +254,7 @@ static int pm805_remove(struct i2c_client *client) static struct i2c_driver pm805_driver = { .driver = { .name = "88PM805", - .pm = &pm80x_pm_ops, + .pm = pm_sleep_ptr(&pm80x_pm_ops), }, .probe = pm805_probe, .remove = pm805_remove, diff --git a/drivers/mfd/88pm80x.c b/drivers/mfd/88pm80x.c index be036e7e787b..ac4f08565f29 100644 --- a/drivers/mfd/88pm80x.c +++ b/drivers/mfd/88pm80x.c @@ -129,7 +129,6 @@ int pm80x_deinit(void) } EXPORT_SYMBOL_GPL(pm80x_deinit); -#ifdef CONFIG_PM_SLEEP static int pm80x_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -153,10 +152,8 @@ static int pm80x_resume(struct device *dev) return 0; } -#endif -SIMPLE_DEV_PM_OPS(pm80x_pm_ops, pm80x_suspend, pm80x_resume); -EXPORT_SYMBOL_GPL(pm80x_pm_ops); +EXPORT_GPL_SIMPLE_DEV_PM_OPS(pm80x_pm_ops, pm80x_suspend, pm80x_resume); MODULE_DESCRIPTION("I2C Driver for Marvell 88PM80x"); MODULE_AUTHOR("Qiao Zhou "); From patchwork Sun Oct 23 09:48:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 7978 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1547885wrr; Sun, 23 Oct 2022 02:56:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM66Sz/KGov9QpekxX8D9Pdph1l8KAKOGSeZNJjVcciURaLJyUU0m0/SyR66UsvH4D9kR8Ap X-Received: by 2002:a17:907:1c17:b0:78d:df89:26c6 with SMTP id nc23-20020a1709071c1700b0078ddf8926c6mr24310449ejc.20.1666518989201; Sun, 23 Oct 2022 02:56:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666518989; cv=none; d=google.com; s=arc-20160816; b=AfQDM9I1cUqUQXj4OhyhyqUnwGN3hZ9brjPm9TQ2B1vTd3WSLKAKbeOpZ63C2oS3VT 8MSi43XyILPMYW9rWDDY+qN5O2cj/pPjqgVkTzRW5CQTwUt8jIfXyTBIGkRcsPJAteG4 RKrVXwoMr1nYKHzbzGnzDQR0yZc7a2MHUllK4dxJQTeAMXWQz27xDy6+sy3uljGFLjJ6 FHl+zCFCHIWCOxnv4rl3q116HS1S8rsUHFLm2eLx+GnM7c8eCMp4kTJeUrLUS58oT3rk f5VaQb0mkldIsd+5H8viDUV2nyKkWvoICzzzFo3A6fdV2gUCi7tzUL7H5j4la/PlU8mY SrQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=v1iDgRdVM2mercE3ut+EO5L+yG7WE7yznsiwCD0Lt98=; b=pzv9X2QlhFXvyLPsfvvJZr3vL7Ba16XrJ1blYQE0v19VggU+E6gQ409+QpZydmYysQ /yVI0v9cFZCVvI0AgQMU05rFpw3mGY4VQWukwdP3HOYpksZxiPrxh/f4wFZejFQdwxJE CdTGnGra5/5alwTl3brS84MrAperD8fsalf90/V4SLRr+/Mpl8o8lf0iwMp3EMSeEdCw 2CTgDznHLw9F7lJCU+XiL/97WT0dxswCEkFu3BJ1mc6k7xA5agoFz81fvdyZJLcAOeSI a9L+/pABwBTXnu21LAo9SuZMJ5DgRCi267YEkMwi2tKw/y5AUU0pkbnqUsIrpJvEKDf0 0y+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=TV0MZndo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p26-20020a170906a01a00b0078db89b2566si22536427ejy.699.2022.10.23.02.56.05; Sun, 23 Oct 2022 02:56:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=TV0MZndo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229867AbiJWJtX (ORCPT + 99 others); Sun, 23 Oct 2022 05:49:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230149AbiJWJtU (ORCPT ); Sun, 23 Oct 2022 05:49:20 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C22F96BCEE for ; Sun, 23 Oct 2022 02:49:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518544; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=v1iDgRdVM2mercE3ut+EO5L+yG7WE7yznsiwCD0Lt98=; b=TV0MZndoXOwRdei9zSfLhWa8OCd/Mx1VRctmJ+aRpmw2y0BpV5PBMUbL1ZHx4TdadNlq6O Q6s9CxhKrGZwCUCdcK249ntpNbNZLu5jar3PpZGFzs3TAaCJvVXZEv/9Ie8uN9526IFWF0 x9hrx+LyPF/zcEb/yFrt+gvQZfwOXfo= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 02/28] mfd: aat2870: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:26 +0100 Message-Id: <20221023094852.8035-3-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747471815482535993?= X-GMAIL-MSGID: =?utf-8?q?1747471815482535993?= Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- drivers/mfd/aat2870-core.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/mfd/aat2870-core.c b/drivers/mfd/aat2870-core.c index a17cf759739d..8a3967c3f026 100644 --- a/drivers/mfd/aat2870-core.c +++ b/drivers/mfd/aat2870-core.c @@ -409,7 +409,6 @@ static int aat2870_i2c_probe(struct i2c_client *client, return ret; } -#ifdef CONFIG_PM_SLEEP static int aat2870_i2c_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -438,10 +437,9 @@ static int aat2870_i2c_resume(struct device *dev) return 0; } -#endif /* CONFIG_PM_SLEEP */ -static SIMPLE_DEV_PM_OPS(aat2870_pm_ops, aat2870_i2c_suspend, - aat2870_i2c_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(aat2870_pm_ops, aat2870_i2c_suspend, + aat2870_i2c_resume); static const struct i2c_device_id aat2870_i2c_id_table[] = { { "aat2870", 0 }, @@ -451,7 +449,7 @@ static const struct i2c_device_id aat2870_i2c_id_table[] = { static struct i2c_driver aat2870_i2c_driver = { .driver = { .name = "aat2870", - .pm = &aat2870_pm_ops, + .pm = pm_sleep_ptr(&aat2870_pm_ops), .suppress_bind_attrs = true, }, .probe = aat2870_i2c_probe, From patchwork Sun Oct 23 09:48:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 7980 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1553104wrr; Sun, 23 Oct 2022 03:13:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5aSAQCBr+DnRg4sskt2Bg4ZcCAYJX3VHsOjuMZa7xrXTOes1LRr3Pe+K0bhKd7ZSdRdvVk X-Received: by 2002:a17:906:4fc3:b0:72e:eab4:d9d7 with SMTP id i3-20020a1709064fc300b0072eeab4d9d7mr22895572ejw.599.1666519988367; Sun, 23 Oct 2022 03:13:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666519988; cv=none; d=google.com; s=arc-20160816; b=W1Ef95GbjtVFjBeDq6rLw+XIaBytUDiXbMlapoQ4D+i/gfVqNOjQKzeOeqnxN5N6TY cySf+wMBRw5GheHlgMDR2BuXZc0tsunB7iQ07DMsNvSt1hD0AgNkKuShJwKuZ+vXMyzE yClHhghYKwhtnary27egFmKbs3uJkuM4R4hDAHPf0iXHV2kh74vFPEGaq/D/iF2HszHm 4sJqBY25xmLs8cmOeuAPQn/LsU9bgdiuKmhSzuv4nQ8OqJQQVggXgEQXSg8wuq+Ms0hL WetvObPHOMcXTjhbRqd5yTtA+QwQ+MGTK2yskxrOfTNnhIMFP2YZPhJWNq55MOz2e9Ye qr7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=RmH+YiYpUPBPp3yS1R7ESWCNgocdrFNtdRwVFv9A680=; b=PrQip3WulrQbrbQ0DVvFQ1RyPDOCea70WZGHXyd8PEpA95ghk41+cq6GRC5/NWO4MV z5h/KXIw6eduyuezWSPt0NuIdspcJ4IYG+1gApU6tztFXjCQxdERkv6/EaTmhYfJvIo9 qzlEq68j1shh9CSrAsfbPkDyxs3A5o3naZv3b7xPOZDxT82MV7EtH9yb5T/XZ72X9w29 OWmD8MFnTPgZ2UvHftJarWq6Nd3rof3OsgzIpwTLf5zQJUUKSxOzay02U7fT1Iv8Wt/f Q2KRsEXzMwf4NKl+HhASfhzBSg6JT7I0Mb9oT9Likvp4BJ9EJ0QniPykYZWswh8ZPEEx yLrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=fCp4riuw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p3-20020a17090635c300b0078d4b2754b5si21807565ejb.332.2022.10.23.03.12.39; Sun, 23 Oct 2022 03:13:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=fCp4riuw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230171AbiJWJtl (ORCPT + 99 others); Sun, 23 Oct 2022 05:49:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230155AbiJWJti (ORCPT ); Sun, 23 Oct 2022 05:49:38 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1BA37DED9 for ; Sun, 23 Oct 2022 02:49:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518544; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RmH+YiYpUPBPp3yS1R7ESWCNgocdrFNtdRwVFv9A680=; b=fCp4riuws/yV0z90McsIaD8AOSmeDlATXdIEtcZlsGuNd7LS8J/sE8HogShUDfwX+GxsYD YvVLzqNw9q9+ARe/rGF/Q9nmjK1LEOGYjI4I7gVIY+M945OucjK+6snNsVkJC2t2JDUeeo UXZjVazw7lJmUMe5PWM8eZlo5msa0I4= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Michael Hennerich Subject: [PATCH v3 03/28] mfd: adp5520: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:27 +0100 Message-Id: <20221023094852.8035-4-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747472863680031691?= X-GMAIL-MSGID: =?utf-8?q?1747472863680031691?= Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil Acked-by: Michael Hennerich --- drivers/mfd/adp5520.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/adp5520.c b/drivers/mfd/adp5520.c index 8db15f5a7179..882eddc32f8e 100644 --- a/drivers/mfd/adp5520.c +++ b/drivers/mfd/adp5520.c @@ -305,7 +305,6 @@ static int adp5520_probe(struct i2c_client *client, return ret; } -#ifdef CONFIG_PM_SLEEP static int adp5520_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -326,9 +325,8 @@ static int adp5520_resume(struct device *dev) adp5520_write(chip->dev, ADP5520_MODE_STATUS, chip->mode); return 0; } -#endif -static SIMPLE_DEV_PM_OPS(adp5520_pm, adp5520_suspend, adp5520_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(adp5520_pm, adp5520_suspend, adp5520_resume); static const struct i2c_device_id adp5520_id[] = { { "pmic-adp5520", ID_ADP5520 }, @@ -339,7 +337,7 @@ static const struct i2c_device_id adp5520_id[] = { static struct i2c_driver adp5520_driver = { .driver = { .name = "adp5520", - .pm = &adp5520_pm, + .pm = pm_sleep_ptr(&adp5520_pm), .suppress_bind_attrs = true, }, .probe = adp5520_probe, From patchwork Sun Oct 23 09:48:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 7977 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1547618wrr; Sun, 23 Oct 2022 02:55:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5VBCltQE8VjHrFFJbTlx5j1xD1BxFkSdbXo+O9p7MR10Wb3J7Th8OvUezSyyFmI69XQdUy X-Received: by 2002:a17:907:782:b0:740:7120:c6e7 with SMTP id xd2-20020a170907078200b007407120c6e7mr22815296ejb.313.1666518935342; Sun, 23 Oct 2022 02:55:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666518935; cv=none; d=google.com; s=arc-20160816; b=KMhvf8r1uLzvli0XhPLM4MC+QNZo0TxPDW6VY7+WhU8HsNfnIuFthT4A3WEVCuDpXF LswN/qeNXdGIB8iOQLm12zXSoGkmzrrbwC+9OEMrdvWuV2bz1YrjgXjRXfPD0xZ9H7ni ph/XzGOaN5+VizHVu8rwg2j5gghg6Xm1efhFx3m8y0IYzOlQOWmSthfHUJMzU3OiYZWm k63LfH6hSfsjHFoi/9X1cd8lI5KmnVvFpQxNerc0vZD4SU2YNSrb50CWQBAzPC+pc/c2 248CRotXI5TjK80twK9MCP1I3R74+yvbbSy5AuQ6pKHcbewWCJRASEz26nE4xi4ghrgC oxsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=a32yNu2Eeu11C00fM1RqTufFXXGAOLPmqPKGVg+1zOs=; b=TcQkzFsKqjjj5Hp/M/vSaaCE1Sa9PpU0icgM1ePk2UFy+7NZgZItXot5LpN8Gtu/1f pY80vPEw69NIOtiwW+bJ5OEauSHXyOsMMkqJklLD9ISKR0gCK0vXEAsK0OigzO3xO7Vt 4yKNEKatp3zJnTp51ettLIpfiKF3uOfxMKtpb/1pI74FP+l7+06VRv2EXdZwonBnAxo8 Bpop/1rxrqMHmfRV+J+JSEAzluKlpXk2zyLP/d+EI+KXi3i3LbbPnk+bHV1fhgr5bfQ2 c9SsU2hRpEOkXIb/dPZP+H5D+jCbjCy0nUFhzsXPyhB3PZbU2xupJJfBJAbjy+H/eAn6 HgMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=bKNpXcm3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm21-20020a170907949500b00787803711f9si26226065ejc.353.2022.10.23.02.55.11; Sun, 23 Oct 2022 02:55:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=bKNpXcm3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230031AbiJWJtz (ORCPT + 99 others); Sun, 23 Oct 2022 05:49:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230172AbiJWJtr (ORCPT ); Sun, 23 Oct 2022 05:49:47 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5998C13EA1 for ; Sun, 23 Oct 2022 02:49:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518545; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=a32yNu2Eeu11C00fM1RqTufFXXGAOLPmqPKGVg+1zOs=; b=bKNpXcm3d8NoHpBQnqNFOd2mxosxO1mrPVpwMyVyFQcp64FcVA8OGgP8CO6WLmgDOY3zK1 9HQlbDNabm/CwuAFXZMIdh8SfubKwCXqYgmTazHEjZPAcTzXLy9TR9aBrby9NFRkCLi5sb gi0RBTgMtcudSIDQnU2euBh7mTAfvGw= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 04/28] mfd: max8925-i2c: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:28 +0100 Message-Id: <20221023094852.8035-5-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747471759340195214?= X-GMAIL-MSGID: =?utf-8?q?1747471759340195214?= Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- drivers/mfd/max8925-i2c.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/max8925-i2c.c b/drivers/mfd/max8925-i2c.c index 114e905bef25..649310b5bb3e 100644 --- a/drivers/mfd/max8925-i2c.c +++ b/drivers/mfd/max8925-i2c.c @@ -208,7 +208,6 @@ static int max8925_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM_SLEEP static int max8925_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -228,9 +227,9 @@ static int max8925_resume(struct device *dev) disable_irq_wake(chip->core_irq); return 0; } -#endif -static SIMPLE_DEV_PM_OPS(max8925_pm_ops, max8925_suspend, max8925_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(max8925_pm_ops, + max8925_suspend, max8925_resume); static const struct of_device_id max8925_dt_ids[] = { { .compatible = "maxim,max8925", }, @@ -240,7 +239,7 @@ static const struct of_device_id max8925_dt_ids[] = { static struct i2c_driver max8925_driver = { .driver = { .name = "max8925", - .pm = &max8925_pm_ops, + .pm = pm_sleep_ptr(&max8925_pm_ops), .of_match_table = max8925_dt_ids, }, .probe = max8925_probe, From patchwork Sun Oct 23 09:48:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 7998 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1565317wrr; Sun, 23 Oct 2022 03:58:08 -0700 (PDT) X-Google-Smtp-Source: AMsMyM68f6SlP1ypyGMBXYSd+sVhdsRVzTVPXQRVkYLEwTGJ5jI+xrjZFwyyf1sXQXscjHn8a8Fz X-Received: by 2002:a05:6402:42c6:b0:45c:fc58:bd0f with SMTP id i6-20020a05640242c600b0045cfc58bd0fmr26263801edc.19.1666522688498; Sun, 23 Oct 2022 03:58:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666522688; cv=none; d=google.com; s=arc-20160816; b=o3EiiIkQH+mtqnroLIHruevU+BV0LM9flEwzbXO4iHnyFlE6OlSAfju1LOjSC/ZAuI VHYuPMiGP38byYS6Bcgq3E9TRY3KqRLK2pidAajpe0+pQ/Fat7rKnpoApegfU4+CY3Fz wsLR64Pg4BlCIjXG9Lc4ojzhXaKmGzqDuFZYfKdWPS8vr6+XslhKULX6ue2FE7ghXDXo uZC7HCIuHAbRC1EjFWixSX3XVk99C2wSjcZNoLefynesC1pKZXF2K/Wbbje2hgS6kiUV H15HbkDHeFbwMzlQuFn7XJsi/LMPBp2HLPG6+zaCbkiUjhoywwPHWh+LoDXzgT8NMxZs ljPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+FBECTcdeQLfSp5bHcYAa/1zAvqLKLLp0tQ+VpGze+A=; b=fahExk5nwp/5Dl0OGYyTr/CP/9+hwxZFlkFcfF622iELMDo4foY90zkWAMSqFDzjBh tGwUfJPQe12+HCnq/ifClHuSAQqVbvPp9FCPWpTOKLs8xZjkS2BTrjhuqJIm00mwlroO KXztPAnS1t5+CZVd2i5oMPB1F9NhO0WJhOwA0yFZkgp7UbrWVejYme4envGd17oPsOV5 yTvxZKnzud2w8IVnIk+r0udnjaWL6F5yCNsnZaGp4JOrcQ8kwdk4azMATX/VOmBIyWxB s6m15HEglpE8AJzzirCXVsAv09dKalGqah5JoMRMHSo62HLPFtdXhv4CrV5rcMdsD5Po pMnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=WMXviK4z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s16-20020a056402015000b0044f2fb68fe6si21523825edu.495.2022.10.23.03.57.44; Sun, 23 Oct 2022 03:58:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=WMXviK4z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230163AbiJWJuF (ORCPT + 99 others); Sun, 23 Oct 2022 05:50:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230157AbiJWJuB (ORCPT ); Sun, 23 Oct 2022 05:50:01 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AB6F2E6BC for ; Sun, 23 Oct 2022 02:49:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518546; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+FBECTcdeQLfSp5bHcYAa/1zAvqLKLLp0tQ+VpGze+A=; b=WMXviK4znNH+cxAIFAOQi3B1ykMnVrOcVU4hf2Rqqlk058V80E+qnyk8E0LlkDXjEPWIXm 5qVkv3kePJ7wNXzCipfnq9MYT16MVBahctpgvp0h4oxMOe2Waq01lOVUy6yVlaUaKThAzq zocXklgI+/PciXSlgUahWpIe9bqshyo= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Matthias Brugger , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH v3 05/28] mfd: mt6397-irq: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:29 +0100 Message-Id: <20221023094852.8035-6-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747475694305094120?= X-GMAIL-MSGID: =?utf-8?q?1747475694305094120?= Use the new pm_sleep_ptr() macro to handle the .irq_set_wake() callback. This macro allows the mt6397_irq_set_wake() function to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- Cc: Matthias Brugger Cc: linux-arm-kernel@lists.infradead.org Cc: linux-mediatek@lists.infradead.org drivers/mfd/mt6397-irq.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/mfd/mt6397-irq.c b/drivers/mfd/mt6397-irq.c index eff53fed8fe7..72f923e47752 100644 --- a/drivers/mfd/mt6397-irq.c +++ b/drivers/mfd/mt6397-irq.c @@ -54,7 +54,6 @@ static void mt6397_irq_enable(struct irq_data *data) mt6397->irq_masks_cur[reg] |= BIT(shift); } -#ifdef CONFIG_PM_SLEEP static int mt6397_irq_set_wake(struct irq_data *irq_data, unsigned int on) { struct mt6397_chip *mt6397 = irq_data_get_irq_chip_data(irq_data); @@ -68,9 +67,6 @@ static int mt6397_irq_set_wake(struct irq_data *irq_data, unsigned int on) return 0; } -#else -#define mt6397_irq_set_wake NULL -#endif static struct irq_chip mt6397_irq_chip = { .name = "mt6397-irq", @@ -78,7 +74,7 @@ static struct irq_chip mt6397_irq_chip = { .irq_bus_sync_unlock = mt6397_irq_sync_unlock, .irq_enable = mt6397_irq_enable, .irq_disable = mt6397_irq_disable, - .irq_set_wake = mt6397_irq_set_wake, + .irq_set_wake = pm_sleep_ptr(mt6397_irq_set_wake), }; static void mt6397_irq_handle_reg(struct mt6397_chip *mt6397, int reg, From patchwork Sun Oct 23 09:48:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 7976 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1547314wrr; Sun, 23 Oct 2022 02:54:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5gwjFsPg1VfqqT0YLwPJmSJFKpyPB2piA5KVdaHTOFpWOHivITqArMknhB3eCC7nDciU9y X-Received: by 2002:aa7:c744:0:b0:461:a144:e94d with SMTP id c4-20020aa7c744000000b00461a144e94dmr2713410eds.236.1666518878697; Sun, 23 Oct 2022 02:54:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666518878; cv=none; d=google.com; s=arc-20160816; b=ZZ3BwoJ8QTeIsxHryEhBY5sRJ+P27T7DrZ9Fv6zBXTrxS1OMadLY2TYfIZ3411iuGH CshKK2C1nmYTxirFWuS2+meOD6dHJWh8F5z0bPwuR28ntPlSttbLLD8+jAEHqA9sBXAC V1lAoez6IQcomEPUP/cEtQu6S6Xn/gtthm97rx9JzWjjZYASMBDmVzvbQnwjo+dYqG+f KsGNtNDVx6rOsfUlpFgG3mRdaPWJB2TUNUIQOhVcnhhDtiBHREXtQm7/WTyja0AqwHNy 837QgQKw2fNiw7gJV/SPsyVYoRntD5PeSaQHpx4CKLc9L6CeIDx05A10QwYFfA5ByEmm U/2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0q1o3KBhQ5MOOQZOY2QmugcO19dZJBIvTlnLlJG5KlM=; b=HEIKB1qoHLoDIHd9mrglvkKLOVQuevUFuLBU5kHEFjDcRde/9bq97Kvx4IaU1vmb0x n3Udes/GM0jWcGdvrUEVOoTFdWtxTakcvfZzHE4eHr1enN6oKlkceAiw2bLByqzgP2YK jcDK1N7LY9bwB6kPL7yVIYz7nzrgjmIWeJpQC7dX0XFDbdY57YK3yBl1TL4pEqFHcRBj MJenXOe40wVElOhwBW5aJyg4DAK/4+w2qFf33KcVMqq1LIrIMPtOg7iE2kVw7IftH1eA 4bNY76rwXMDogQhs9uFfWm9igSC+UaBitPrNiVdPfPTpgBOdXYraTkaFTPzR7+Pl3+vr mRAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b="iRNen0c/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gb6-20020a170907960600b0078b96722000si28723359ejc.608.2022.10.23.02.54.14; Sun, 23 Oct 2022 02:54:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b="iRNen0c/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230170AbiJWJuX (ORCPT + 99 others); Sun, 23 Oct 2022 05:50:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230190AbiJWJuR (ORCPT ); Sun, 23 Oct 2022 05:50:17 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92AB73AB03 for ; Sun, 23 Oct 2022 02:50:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518546; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0q1o3KBhQ5MOOQZOY2QmugcO19dZJBIvTlnLlJG5KlM=; b=iRNen0c/8Ot1Qe7QRuJCfD2BCxA+y4O7MkfUepGe23zXEeRHs/SygVUWMexDvzbBKoVg3D MdJvDrnKkYq4b3hHVEJEBmg39aq9rcXl3WrlMqinr97rB8BojBS91myMwK/uf30DCQYP7T /4gF8D5RveRS4dPpWSUVXshyilpGr8A= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 06/28] mfd: pcf50633: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:30 +0100 Message-Id: <20221023094852.8035-7-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747471699370467809?= X-GMAIL-MSGID: =?utf-8?q?1747471699370467809?= Use the new EXPORT_GPL_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- drivers/mfd/pcf50633-core.c | 22 +--------------------- drivers/mfd/pcf50633-irq.c | 13 ++++++++----- include/linux/mfd/pcf50633/core.h | 6 ++---- 3 files changed, 11 insertions(+), 30 deletions(-) diff --git a/drivers/mfd/pcf50633-core.c b/drivers/mfd/pcf50633-core.c index e9c565cf0f54..06d750d9a476 100644 --- a/drivers/mfd/pcf50633-core.c +++ b/drivers/mfd/pcf50633-core.c @@ -158,26 +158,6 @@ pcf50633_client_dev_register(struct pcf50633 *pcf, const char *name, } } -#ifdef CONFIG_PM_SLEEP -static int pcf50633_suspend(struct device *dev) -{ - struct i2c_client *client = to_i2c_client(dev); - struct pcf50633 *pcf = i2c_get_clientdata(client); - - return pcf50633_irq_suspend(pcf); -} - -static int pcf50633_resume(struct device *dev) -{ - struct i2c_client *client = to_i2c_client(dev); - struct pcf50633 *pcf = i2c_get_clientdata(client); - - return pcf50633_irq_resume(pcf); -} -#endif - -static SIMPLE_DEV_PM_OPS(pcf50633_pm, pcf50633_suspend, pcf50633_resume); - static const struct regmap_config pcf50633_regmap_config = { .reg_bits = 8, .val_bits = 8, @@ -302,7 +282,7 @@ MODULE_DEVICE_TABLE(i2c, pcf50633_id_table); static struct i2c_driver pcf50633_driver = { .driver = { .name = "pcf50633", - .pm = &pcf50633_pm, + .pm = pm_sleep_ptr(&pcf50633_pm), }, .id_table = pcf50633_id_table, .probe = pcf50633_probe, diff --git a/drivers/mfd/pcf50633-irq.c b/drivers/mfd/pcf50633-irq.c index 2096afb0ce9b..e85af7f1cb0b 100644 --- a/drivers/mfd/pcf50633-irq.c +++ b/drivers/mfd/pcf50633-irq.c @@ -7,6 +7,7 @@ * All rights reserved. */ +#include #include #include #include @@ -218,10 +219,10 @@ static irqreturn_t pcf50633_irq(int irq, void *data) return IRQ_HANDLED; } -#ifdef CONFIG_PM - -int pcf50633_irq_suspend(struct pcf50633 *pcf) +static int pcf50633_suspend(struct device *dev) { + struct i2c_client *client = to_i2c_client(dev); + struct pcf50633 *pcf = i2c_get_clientdata(client); int ret; int i; u8 res[5]; @@ -257,8 +258,10 @@ int pcf50633_irq_suspend(struct pcf50633 *pcf) return ret; } -int pcf50633_irq_resume(struct pcf50633 *pcf) +static int pcf50633_resume(struct device *dev) { + struct i2c_client *client = to_i2c_client(dev); + struct pcf50633 *pcf = i2c_get_clientdata(client); int ret; /* Write the saved mask registers */ @@ -273,7 +276,7 @@ int pcf50633_irq_resume(struct pcf50633 *pcf) return ret; } -#endif +EXPORT_GPL_SIMPLE_DEV_PM_OPS(pcf50633_pm, pcf50633_suspend, pcf50633_resume); int pcf50633_irq_init(struct pcf50633 *pcf, int irq) { diff --git a/include/linux/mfd/pcf50633/core.h b/include/linux/mfd/pcf50633/core.h index 3f752dc62a6c..539f27f8bd89 100644 --- a/include/linux/mfd/pcf50633/core.h +++ b/include/linux/mfd/pcf50633/core.h @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -226,9 +227,6 @@ static inline struct pcf50633 *dev_to_pcf50633(struct device *dev) int pcf50633_irq_init(struct pcf50633 *pcf, int irq); void pcf50633_irq_free(struct pcf50633 *pcf); -#ifdef CONFIG_PM -int pcf50633_irq_suspend(struct pcf50633 *pcf); -int pcf50633_irq_resume(struct pcf50633 *pcf); -#endif +extern const struct dev_pm_ops pcf50633_pm; #endif From patchwork Sun Oct 23 09:48:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 7996 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1564539wrr; Sun, 23 Oct 2022 03:54:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5bCzR8VGh44noUDAyaLh86M6kyGV/iYD60ZZe3bP9yPRwSG7bwcI0MhplMzofxYi85xTdS X-Received: by 2002:a17:906:3287:b0:78d:8877:d50f with SMTP id 7-20020a170906328700b0078d8877d50fmr22981775ejw.486.1666522488873; Sun, 23 Oct 2022 03:54:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666522488; cv=none; d=google.com; s=arc-20160816; b=Sz3rzTr5bUWOowvuJB3tgBVzGZ5yVvXuuJ56Wk9K+eZtJ6jGAc2IHMa6AC+WOIAcc+ XTW7wUxIoAJW7PhZTlSdiipzR7yNGUIm8dhzC6RJcmz9aXYR9nw4t+nZPbHa6Rt1ZWJ7 ffswWInvdoPFY4RsYmvgwnGgzxNOINmoH2kBVc/7cGJjMV3Dnr53enWbBfUxCCG5Olai UffHaz+R9hYCTnhqkFBDiLeH2vd6HAoJ56aTTZXFfkeNYfv22Hdkra41tVLyPv51JUCF YQsMedjYXnqg87hAxrfQuoa6Pezzw8fZhrag5xPwWvSHX7vl34ih0Kws7UA+qcSObI7V u15A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=41LrJxU80KiCvA5q7AmgY7aUdotJZRC7pzTXsCNxuuM=; b=qJxU9ZcPHU1dyhF7mnobLCG1jkRMFgY/+TesFfjPMpvqEE88I9i1QwYXnZ4UFrGi1t d2Cjmj3fXar9cF3nHpAHyIFPmsWwaAz1s2x6lmERxn9XMg5TAvcoAoyYcBYCfwCkAM8E NSWfKg1G3LT/x6kpYiTgi84PVsJfiJVobcMEQug1uXGAeItMT5oX/kwfrR5+aUQFq21r oQ+QLLkIJHfAdl0uMJ1zfypkRSO0tOQGLo8Q4adOYYDKt8zuCFWNQiGow5EKPY3mUR/P qBwj+ADqOrExHvtqcmWzwSjMkg0+3kQKzl76zJpI1UwcB8mFZh4OZz1bWJ4mjHpNrI71 8edg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b="V8D/Jee3"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m22-20020aa7c2d6000000b0044e9fd71b82si21357440edp.280.2022.10.23.03.54.24; Sun, 23 Oct 2022 03:54:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b="V8D/Jee3"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230203AbiJWJuk (ORCPT + 99 others); Sun, 23 Oct 2022 05:50:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230206AbiJWJub (ORCPT ); Sun, 23 Oct 2022 05:50:31 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14FEF51A1A for ; Sun, 23 Oct 2022 02:50:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518547; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=41LrJxU80KiCvA5q7AmgY7aUdotJZRC7pzTXsCNxuuM=; b=V8D/Jee3FZyV0+Iwh4Ob6cs7rOCY+4P4GLLr+8DhMPwWVSigTbLXmPbwDMQu7QSCkQjJv6 Nd+rOqbOch6fezbHmrdsIIv5h2lsw19Gs/s4wK+FnEbbwH5BRDcMopJ6ZmOpxcRhnAp0aF KGIsP+1CIqWJPN5Z5G2rr76IwjEDIiE= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 07/28] mfd: rc5t583-irq: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:31 +0100 Message-Id: <20221023094852.8035-8-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747475485535560819?= X-GMAIL-MSGID: =?utf-8?q?1747475485535560819?= Use the new pm_sleep_ptr() macro to handle the .irq_set_wake() callback. This macro allows the mt6397_irq_set_wake() function to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- drivers/mfd/rc5t583-irq.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/mfd/rc5t583-irq.c b/drivers/mfd/rc5t583-irq.c index b374a3d34688..621ea61fa7c6 100644 --- a/drivers/mfd/rc5t583-irq.c +++ b/drivers/mfd/rc5t583-irq.c @@ -228,15 +228,12 @@ static void rc5t583_irq_sync_unlock(struct irq_data *irq_data) mutex_unlock(&rc5t583->irq_lock); } -#ifdef CONFIG_PM_SLEEP + static int rc5t583_irq_set_wake(struct irq_data *irq_data, unsigned int on) { struct rc5t583 *rc5t583 = irq_data_get_irq_chip_data(irq_data); return irq_set_irq_wake(rc5t583->chip_irq, on); } -#else -#define rc5t583_irq_set_wake NULL -#endif static irqreturn_t rc5t583_irq(int irq, void *data) { @@ -317,7 +314,7 @@ static struct irq_chip rc5t583_irq_chip = { .irq_bus_lock = rc5t583_irq_lock, .irq_bus_sync_unlock = rc5t583_irq_sync_unlock, .irq_set_type = rc5t583_irq_set_type, - .irq_set_wake = rc5t583_irq_set_wake, + .irq_set_wake = pm_sleep_ptr(rc5t583_irq_set_wake), }; int rc5t583_irq_init(struct rc5t583 *rc5t583, int irq, int irq_base) From patchwork Sun Oct 23 09:48:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 7973 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1546978wrr; Sun, 23 Oct 2022 02:52:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Fy2Ev+AD0Vtjvn+nHwmZxAlfevaHmFhL+rgxkOF84f3mC3Y6jsrxxsEpMGKTU94uzW9CD X-Received: by 2002:a63:69c6:0:b0:46e:af43:1588 with SMTP id e189-20020a6369c6000000b0046eaf431588mr12069085pgc.520.1666518775466; Sun, 23 Oct 2022 02:52:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666518775; cv=none; d=google.com; s=arc-20160816; b=PCLEIKjwV2PBkFDGH+l1j+wOu6mrxtEOPKHsZdgQm41wVdbeDnKTsUiFcM2c/zvizo 77TPwk00iA87qMMluiLXEyQOPlfrJm9MT/gR8FHDHrGvSrr0nO/WpD/b0XbDpa/BAde8 l1ZHaucZuV2IjJmEmX48dc0M4rIuC8MVED0wUjJnmwETEnK0kbGXJvKcj+DvJ8Ge5n3M AO9c0NlLIWi06FP2yHdyd8k79VBgQSccxhwAgZVrF9CyONKazSs4npnrN27abvCtJ6sO 8380Rse9Fh9svbnWPgsH/rKketwqxFKkkmYd0ay1pr7VjhS5Yp99mJxbz5s/hVhGOdut Zd0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3M9dCoUiG7SdzuIW6iaf9KAa+/qkvhEMPsTc9+Iggvw=; b=yqnB5TxK83nnlb5bJByKfVOHloDDM0MROLh17M0upnGJk1YNZTyZ5tpbkskeKj9kI/ 7l4l/0b+QxJdfR0blHrVj2Tv8Rc63Qju6c4+Cfr2V2P1TYGmXhTqbCeRDaqVTnSdIigR lW2iHaFUnW1DszgOMYTI7SviqFqe50jav/qI+rpMgnbXUPV9qmiby/3uN4glmz9GSaIo +wmuwxaWHbETJos0WN8uHYACdI3kMN8dy3wo6NnowDgkJ0tAhhKgf6l0TsAclbtnbpDz ve2BXT/N/TcBT40m9lHZ/PIdZOpDpUpsRzO64nsPsXfU2jsyraMRKOUyZSNEDRa3EBwn ZjYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=Hu+oDwDk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n18-20020a170902e55200b0016d9c8479b5si35123361plf.344.2022.10.23.02.52.42; Sun, 23 Oct 2022 02:52:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=Hu+oDwDk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230267AbiJWJvB (ORCPT + 99 others); Sun, 23 Oct 2022 05:51:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230219AbiJWJum (ORCPT ); Sun, 23 Oct 2022 05:50:42 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0AD03ECD0 for ; Sun, 23 Oct 2022 02:50:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518547; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3M9dCoUiG7SdzuIW6iaf9KAa+/qkvhEMPsTc9+Iggvw=; b=Hu+oDwDkdnYZX6c5HGfyuyRIFGXcLqOLji3RgwBRZ+GeLGd5dcKaBrd9841snyAius7VDJ QzIVd3YQBUbp29WD/XwyqhT/wfhuWldPSFkkqGJ4dvjgMdOD21GNC7l6SooEacairfkNxu 7+pX0qcDiCtlUui5J/nBk3vSaICD9Fk= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 08/28] mfd: stpmic1: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:32 +0100 Message-Id: <20221023094852.8035-9-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747471591520044752?= X-GMAIL-MSGID: =?utf-8?q?1747471591520044752?= Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- drivers/mfd/stpmic1.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/stpmic1.c b/drivers/mfd/stpmic1.c index eb3da558c3fb..7d8b0c0548fe 100644 --- a/drivers/mfd/stpmic1.c +++ b/drivers/mfd/stpmic1.c @@ -162,7 +162,6 @@ static int stpmic1_probe(struct i2c_client *i2c, return devm_of_platform_populate(dev); } -#ifdef CONFIG_PM_SLEEP static int stpmic1_suspend(struct device *dev) { struct i2c_client *i2c = to_i2c_client(dev); @@ -187,9 +186,8 @@ static int stpmic1_resume(struct device *dev) return 0; } -#endif -static SIMPLE_DEV_PM_OPS(stpmic1_pm, stpmic1_suspend, stpmic1_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(stpmic1_pm, stpmic1_suspend, stpmic1_resume); static const struct of_device_id stpmic1_of_match[] = { { .compatible = "st,stpmic1", }, @@ -201,7 +199,7 @@ static struct i2c_driver stpmic1_driver = { .driver = { .name = "stpmic1", .of_match_table = of_match_ptr(stpmic1_of_match), - .pm = &stpmic1_pm, + .pm = pm_sleep_ptr(&stpmic1_pm), }, .probe = stpmic1_probe, }; From patchwork Sun Oct 23 09:48:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 8002 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1567197wrr; Sun, 23 Oct 2022 04:03:49 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5oQ6H2wukF4/WKcoYHPKMbZu5kqtpJDn9UDTbuojxFq6LuGewXw/zdOaMzSrF+8fmzDUV6 X-Received: by 2002:a17:907:162a:b0:78e:2859:76be with SMTP id hb42-20020a170907162a00b0078e285976bemr22744860ejc.768.1666523029242; Sun, 23 Oct 2022 04:03:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666523029; cv=none; d=google.com; s=arc-20160816; b=KSLU6RGCDKE7UYmHUhwvlsW11bdBfs0XLCR75dqOA/Se0fzBqub6YsYjNwDR4DQhgf +aLO5v0voJn1x0Yhv+jQBbzz4Kqw53WoLGGmycRS/imjhMfsojD+k/FCBL6h9Upy393R 1piNyIZtaWZWO6eGHFXQmPZmthX6UxWq1lvB/1OyJoPO3RiDy0JZGG3kfPqqg3U6o7bm BOzr4fmJzybi/hx/QJmorn8nsvm2sGRJacL0TQzZRrXlQjRoyEyaNODTLmA+xSmtrEys cDgE3A2DlBV66QsqXdfaPRF5uPo2rwniCKqow2Xf55vi/4lavRFk7Z7O70YDNZ8M+e93 Y8Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=o88MccR3qEu1Ka3g1RWgK0rEm5DdYE6bq3HPlQGFNi4=; b=q+MtjNmyQaNT8zYFWRydwj6+Bc2tGAJ/g4F2Z4uFuTH//dWnfuUWOYcV5Zuc2/OzZP GYcysIwyQX5q/zXsUv1i94dyZOrBy+pQDsjSbJXAMZtq2JQHj6zdJ9x8ZqX3qAaLXnyO GbOOK2aZ1I8gD44+KRrTdaacgcwE+Pquiktj5epkJxtoI5KfVGoxkkB9rNpZ9wNSoK/x t/Czo6Y2OqLrpjQ5WKb5qXxZ1k4prB75UbefV1CHJoDlIIbZ6SaNNHE3aCxeZlflavpu kMU1G0gYoo/fveIvAlYShQd7WvXmDiBOCWeRHwUa0IFWQgNn18Uwd4kro5eMIOCrYlvq j9XA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=pcuJSH76; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sc11-20020a1709078a0b00b0078c9dd279b6si23547387ejc.345.2022.10.23.04.03.24; Sun, 23 Oct 2022 04:03:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=pcuJSH76; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230188AbiJWJvL (ORCPT + 99 others); Sun, 23 Oct 2022 05:51:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230178AbiJWJu4 (ORCPT ); Sun, 23 Oct 2022 05:50:56 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6838F5B7AD for ; Sun, 23 Oct 2022 02:50:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518548; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=o88MccR3qEu1Ka3g1RWgK0rEm5DdYE6bq3HPlQGFNi4=; b=pcuJSH76iZA0NzImnhzEJW9EKq7oVQaT+snLzlGBC0H2whCUg2u8YgmO21xYq33N8W+IMH CddyIvSF3nqZAmX/czfADjkUGj59SSs6bgr9yHl4BqX+B/VEEiF4Ro35jkeR6Yh6vSWmKd /i15obtEisSF1mLVDw/ZgPzDH9fmgU0= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 09/28] mfd: ucb1x00: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:33 +0100 Message-Id: <20221023094852.8035-10-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747476051891879863?= X-GMAIL-MSGID: =?utf-8?q?1747476051891879863?= Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- drivers/mfd/ucb1x00-core.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/ucb1x00-core.c b/drivers/mfd/ucb1x00-core.c index b690796d24d4..fc4d4c844a81 100644 --- a/drivers/mfd/ucb1x00-core.c +++ b/drivers/mfd/ucb1x00-core.c @@ -660,7 +660,6 @@ void ucb1x00_unregister_driver(struct ucb1x00_driver *drv) mutex_unlock(&ucb1x00_mutex); } -#ifdef CONFIG_PM_SLEEP static int ucb1x00_suspend(struct device *dev) { struct ucb1x00_plat_data *pdata = dev_get_platdata(dev); @@ -728,15 +727,15 @@ static int ucb1x00_resume(struct device *dev) mutex_unlock(&ucb1x00_mutex); return 0; } -#endif -static SIMPLE_DEV_PM_OPS(ucb1x00_pm_ops, ucb1x00_suspend, ucb1x00_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(ucb1x00_pm_ops, + ucb1x00_suspend, ucb1x00_resume); static struct mcp_driver ucb1x00_driver = { .drv = { .name = "ucb1x00", .owner = THIS_MODULE, - .pm = &ucb1x00_pm_ops, + .pm = pm_sleep_ptr(&ucb1x00_pm_ops), }, .probe = ucb1x00_probe, .remove = ucb1x00_remove, From patchwork Sun Oct 23 09:48:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 7974 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1547173wrr; Sun, 23 Oct 2022 02:53:58 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4iea4hDnfNxpnvsIpZcPZhr/kv7T++tM03maPhVv4QXkWoE8ApF+6MgPKU7QrrJ++WEHCS X-Received: by 2002:a17:906:dac3:b0:780:a242:2f14 with SMTP id xi3-20020a170906dac300b00780a2422f14mr22055865ejb.668.1666518838033; Sun, 23 Oct 2022 02:53:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666518838; cv=none; d=google.com; s=arc-20160816; b=qYK8Vz6+f7fantvNQLaM1TesemFjAJm+wT20wlCIjFd0O4ALEauf9AU0XHSdrhOHN/ NKigUEvztQSVkLqfHFC/TGExWwmmTk4yPMJsfxMDKKFIvVn0WPl7F+3Sef5PkZzm89wn b7B7rosz0AZ5Xx988ujy/MMQcVHMXpPQpY1ucJKB/dGIiX3y19R4240v9xQyRi9UHhyk /V2nG/Y+8dEszyCcfCMRa4F+tkXpFb7c8+Eo8YuWVGTEv9QYPBYfxhef4O/J3H2OHFpy ijbPak/LjExkNpWdQvfwWHbVRsket9S1T3Q6ODZsc15GRM6y5G17Gebh9A3oGsWl4kk2 aF2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jNM14hgERipulNrTxZJyirqtg7ieEuWp63IzBQfH5BM=; b=ex+gpe9kndeepzQW4ZEkgoJKOdGMaiHCR1TTleMjaW4kjBx0UL1XNW1hR7EBzCU1um fFdai/tVFAllX/5rydWEHlliWrIdrvvktB3+j/9723IHIB2GGliCN1wmXlZimJUw9MO4 KhKKSt5PZN8eAuUbix/wTY/ZZIfsejjYYt31JhMHW2ZIh5xr70jiyxWYmEyIHn6b13hR p3nVVvVCyclXdHW3fa9IkdQUjaizfN1bmELAafWlwbSyIxPbbuVeAtyEL4sENaesce1b p5q0+C9TmCfngy7RuuPCgS7NEj+ws25ARHsJcpdtjqAvzi8N9+TCfNJ4aqwyX+62D5EF /DuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=Bn7vamxg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wv1-20020a170907080100b00791a4f70674si12221483ejb.24.2022.10.23.02.53.33; Sun, 23 Oct 2022 02:53:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=Bn7vamxg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230257AbiJWJvS (ORCPT + 99 others); Sun, 23 Oct 2022 05:51:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39712 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230218AbiJWJu7 (ORCPT ); Sun, 23 Oct 2022 05:50:59 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DF7C41D31 for ; Sun, 23 Oct 2022 02:50:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518549; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jNM14hgERipulNrTxZJyirqtg7ieEuWp63IzBQfH5BM=; b=Bn7vamxgb0atnUmSwqU3A1rZKH3zLQJnIZe6UpCL/VQVUzf6emW2Bx+7bgSMNy9Hbci/NI iRKBJ2GzrcHP6k6fElnZm7lp5y2abSPgzckITMQ+k5qUXlBZVzcu/83uN7bs2uzTr58OB+ CngucT5u9FgtvfOBHQOx3gNyAukapE4= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 10/28] mfd: 88pm860x: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:34 +0100 Message-Id: <20221023094852.8035-11-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747471657134245625?= X-GMAIL-MSGID: =?utf-8?q?1747471657134245625?= Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- drivers/mfd/88pm860x-core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/88pm860x-core.c b/drivers/mfd/88pm860x-core.c index b1e829ea909b..b698eb59041e 100644 --- a/drivers/mfd/88pm860x-core.c +++ b/drivers/mfd/88pm860x-core.c @@ -1213,7 +1213,6 @@ static int pm860x_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM_SLEEP static int pm860x_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -1233,9 +1232,8 @@ static int pm860x_resume(struct device *dev) disable_irq_wake(chip->core_irq); return 0; } -#endif -static SIMPLE_DEV_PM_OPS(pm860x_pm_ops, pm860x_suspend, pm860x_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(pm860x_pm_ops, pm860x_suspend, pm860x_resume); static const struct i2c_device_id pm860x_id_table[] = { { "88PM860x", 0 }, @@ -1252,7 +1250,7 @@ MODULE_DEVICE_TABLE(of, pm860x_dt_ids); static struct i2c_driver pm860x_driver = { .driver = { .name = "88PM860x", - .pm = &pm860x_pm_ops, + .pm = pm_sleep_ptr(&pm860x_pm_ops), .of_match_table = pm860x_dt_ids, }, .probe_new = pm860x_probe, From patchwork Sun Oct 23 09:48:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 8001 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1565783wrr; Sun, 23 Oct 2022 04:00:06 -0700 (PDT) X-Google-Smtp-Source: AMsMyM44BDVgC59AtnGZi5ZflAZdzMSHriHR9Nf27u2Ly9KXWp6ZMOySinkstUNzU/sMOwOax79p X-Received: by 2002:a17:906:ee8e:b0:730:4a24:f311 with SMTP id wt14-20020a170906ee8e00b007304a24f311mr23700687ejb.420.1666522796539; Sun, 23 Oct 2022 03:59:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666522796; cv=none; d=google.com; s=arc-20160816; b=kqTslTEPCJbsEjPEzHELdZc5AjHT+ZfCl02q2eqGRS+unty+BE2MDPU7m+oA9mffXW /Mxb6gxAKf6vRV6Cf2qKb9ZsEAkIJ/OgKld+0XpvMZVI2VbmkbABfpPt1s0AATtMuga1 qdpFobq9viMKIVkM7qzEc6JwjbF6ZpUUBgG94C9sY6CyQaNb2lFzGiqO3FDyY3YkjIkG BinfTLIdt9KMw6mnvRZW5nY1/9e4UciKldd5uHqYB1gfeCxFYHOAgbZF0LyMMwKQliuW xgG8znTvKj3BZ5uozasAczLxORfZxEn5AUI1ePndgcUkwhn1AmJJE1XN5Rmtq/I9JTkR qAtQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=4kZIVuuKKO+sS/oNnpnJC3ag5t6waBzISKhOioOsnm4=; b=hKYV1xb+o6ByVGOi60hvrE627vai5aes+e/tQyUtLVziaIniF9bHOyNRmhu+6uhXTd 6Zl5RiiM55uyGT4jnKU2/QczlbZm8H0iHarES2gfxeB/HxNXIIR4zjWN/M5zDVuYzEtB iM2juKwxzWXKR4ic1gvv3AheHRqmwyoPQSuI7OStexOxBsl2LCk7p+4OUJmFTi59mnUT DtfwKkZ9WzM4vUw7pCDA4WpOlQd59sx+hRAXKfeYdI9VX2bqCYbwDRZbVKhiDjB/A/tD Pb+SbRe7VrZdRVBClxC5DoIJfPmjtefvgW2CKzTiSRx8qmLzXZAaBro3yzkNyF3laej7 2E7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b="F7ZT/58j"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sc11-20020a1709078a0b00b0078c9dd279b6si23547387ejc.345.2022.10.23.03.59.32; Sun, 23 Oct 2022 03:59:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b="F7ZT/58j"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230187AbiJWJvb (ORCPT + 99 others); Sun, 23 Oct 2022 05:51:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230231AbiJWJvH (ORCPT ); Sun, 23 Oct 2022 05:51:07 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 165E0564F9 for ; Sun, 23 Oct 2022 02:51:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518549; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=4kZIVuuKKO+sS/oNnpnJC3ag5t6waBzISKhOioOsnm4=; b=F7ZT/58jdkSWGmpsKrL/S1pQ/KE/OC+iTOv51KZIWLYATApCXwIuUB+deozMGhSSoahyip BS7uSBZffafdO6/98lczYrr542NPNbegeyQO2xXtC7tcjds7i6G9qMZYtW4Dl2Is3KfRsT sN9VWAtRaEqEfE4xC1yX6xsRceeUJlE= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 11/28] mfd: mcp-sa11x0: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:35 +0100 Message-Id: <20221023094852.8035-12-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747475807661760274?= X-GMAIL-MSGID: =?utf-8?q?1747475807661760274?= Use the new pm_sleep_ptr() macro to handle the .suspend/.resume callbacks. This macro allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- drivers/mfd/mcp-sa11x0.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/mfd/mcp-sa11x0.c b/drivers/mfd/mcp-sa11x0.c index 4629dff187cd..1c9831b78cf9 100644 --- a/drivers/mfd/mcp-sa11x0.c +++ b/drivers/mfd/mcp-sa11x0.c @@ -255,7 +255,6 @@ static int mcp_sa11x0_remove(struct platform_device *dev) return 0; } -#ifdef CONFIG_PM_SLEEP static int mcp_sa11x0_suspend(struct device *dev) { struct mcp_sa11x0 *m = priv(dev_get_drvdata(dev)); @@ -277,17 +276,14 @@ static int mcp_sa11x0_resume(struct device *dev) return 0; } -#endif static const struct dev_pm_ops mcp_sa11x0_pm_ops = { -#ifdef CONFIG_PM_SLEEP .suspend = mcp_sa11x0_suspend, .freeze = mcp_sa11x0_suspend, .poweroff = mcp_sa11x0_suspend, .resume_noirq = mcp_sa11x0_resume, .thaw_noirq = mcp_sa11x0_resume, .restore_noirq = mcp_sa11x0_resume, -#endif }; static struct platform_driver mcp_sa11x0_driver = { @@ -295,7 +291,7 @@ static struct platform_driver mcp_sa11x0_driver = { .remove = mcp_sa11x0_remove, .driver = { .name = DRIVER_NAME, - .pm = &mcp_sa11x0_pm_ops, + .pm = pm_sleep_ptr(&mcp_sa11x0_pm_ops), }, }; From patchwork Sun Oct 23 09:48:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 7975 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1547213wrr; Sun, 23 Oct 2022 02:54:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7FpVAyPuaY32u3GG0ozHh7V5ZAT6KuIqlz30hLHI3pdEqyzOqBXbLnDPos59OpKSD2/klW X-Received: by 2002:a05:6402:34cd:b0:45d:a345:764 with SMTP id w13-20020a05640234cd00b0045da3450764mr25818705edc.415.1666518853609; Sun, 23 Oct 2022 02:54:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666518853; cv=none; d=google.com; s=arc-20160816; b=ab6ICDwY+0HNRkHcGRCPZsdD6eGKaCQAJam9iAt6EDjKK7QAjVK0Oq0MY4V6A7j731 IoaI8OhfVGQux9j3uZJNFY2sHYAjsgeRAOWemdWN3YdhoovFtRvE3G9LqN78uoKr/EGP d9KalCfz7SJk9eq3yDx4+bU2NE17MZUrVU1cc0F3itplI88P3A/6Fw5t/gxI3oy2+rmL JquNahFgpX9rwVB9Z3bFMeTLpKv4/0hbh/DKzOty+kk6k43Ef0iOhLJZAYbBSWBpteKt zBdRmGvxKfDfAxKUBKthn7Xyxk0fYKQwTR3dQfgF2VJjvnSzYCqXzVmKynPTllgm56vf 9+5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=PcfiZpIziLwA4ODr10aXNC1rF+NYGqY0uv8N27EWE4c=; b=QwOCa8BdJ9ebTShPEKG2sozPvWb9r55zXhqlO/wGCm8Y9mRIDy4DStIFDIx9CRdYF5 pace+LqpUZOe4E3alN8Azhzg8BTk8h68VYeGKY5GWcIqr0nUNKjvfQzVmFTPuV3URoQW EUl9KQkYPeShkKhkoFVT0SN9c05fVRyUPgQ6pXlZ97KOr7ynwz5cmhCVOQpDLMi0soCP /82OIt5UYI58Tlyugiq3KvnSo9ZfH0yz4jNEnGkHMTG9mX/SQf82vIcwdzCI5AYysHaS UxxEolt1c8u/+NX3NYF7mRaFoczozVadKAtXXRRha9QWNVteZOixjC0TTb8DEl9NsZm3 nwZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=YhTvZVmH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cs12-20020a0564020c4c00b004618343b140si3439303edb.199.2022.10.23.02.53.49; Sun, 23 Oct 2022 02:54:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=YhTvZVmH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230241AbiJWJvh (ORCPT + 99 others); Sun, 23 Oct 2022 05:51:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230211AbiJWJvQ (ORCPT ); Sun, 23 Oct 2022 05:51:16 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47F3B61D78 for ; Sun, 23 Oct 2022 02:51:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518550; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PcfiZpIziLwA4ODr10aXNC1rF+NYGqY0uv8N27EWE4c=; b=YhTvZVmHDDsGDnwPpkTYrQVyMJ85ouFIUx8bvNDhK1W0Z3J6cXqelICtDze3JJLHIwhCus 5LBsz9nWnLdoLPzBuXsakv6NaqyS2hbN6aQp6HayJws1Y5OL9i63m9UWqGAQ9n/2f16+PW 4HHMWZyjiV860Ke+MlvR/rTrMBW3J9k= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Krzysztof Kozlowski Subject: [PATCH v3 12/28] mfd: sec: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:36 +0100 Message-Id: <20221023094852.8035-13-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747471673243219466?= X-GMAIL-MSGID: =?utf-8?q?1747471673243219466?= Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil Reviewed-by: Krzysztof Kozlowski --- drivers/mfd/sec-core.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/sec-core.c b/drivers/mfd/sec-core.c index 1fb29c45f5cf..a467de2b2fea 100644 --- a/drivers/mfd/sec-core.c +++ b/drivers/mfd/sec-core.c @@ -455,7 +455,6 @@ static void sec_pmic_shutdown(struct i2c_client *i2c) regmap_update_bits(sec_pmic->regmap_pmic, reg, mask, 0); } -#ifdef CONFIG_PM_SLEEP static int sec_pmic_suspend(struct device *dev) { struct i2c_client *i2c = to_i2c_client(dev); @@ -488,14 +487,14 @@ static int sec_pmic_resume(struct device *dev) return 0; } -#endif /* CONFIG_PM_SLEEP */ -static SIMPLE_DEV_PM_OPS(sec_pmic_pm_ops, sec_pmic_suspend, sec_pmic_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(sec_pmic_pm_ops, + sec_pmic_suspend, sec_pmic_resume); static struct i2c_driver sec_pmic_driver = { .driver = { .name = "sec_pmic", - .pm = &sec_pmic_pm_ops, + .pm = pm_sleep_ptr(&sec_pmic_pm_ops), .of_match_table = sec_dt_match, }, .probe = sec_pmic_probe, From patchwork Sun Oct 23 09:48:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 7981 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1554832wrr; Sun, 23 Oct 2022 03:17:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5rGY70Gk8tqbzROs96/6HKMIWfO5zAakVzLyB/nIz2mmyvFUUQjg4aoOHgtzXrK2EtBdbC X-Received: by 2002:a05:6402:51a:b0:461:970e:2adc with SMTP id m26-20020a056402051a00b00461970e2adcmr3748359edv.44.1666520276413; Sun, 23 Oct 2022 03:17:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666520276; cv=none; d=google.com; s=arc-20160816; b=LZ8ogvu8u9IvKnHHDStdqLHv6YTbaha94Zw4fv74EG+U8MFSNNm/PSrPPGS/qsF98U 20/RcQHmOylio0xywPyphRItr+o6CATAmsNHPz4K9HO8PNmtLdjaQX88XGw3ChwcvJgv xAVoOj+C1De7sLQei++r8RQGOmPUQQiy73tqVpIOn157nOR3FwmGV/peDGG2vXazg88b PMsQc66oGy8VDP/bG3rpsXmqf71iBlTKk1RzZcj29gXi7Gq0v4zLUQ5OUxob2k8riGQu lWXrHn4CtA15PytuIqGFLJeodO6rQv7Kc8b19MoxE/IWWVa2t4bCx8iIq8frByi7qiKm cA5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=6nRVOy34FSWnz35RTkSCNiLoYnujLTUllYE1MRb8dnM=; b=QWQm3+YxhUPP1aAl6ZmW2ZUJ2gCylzyQKU2IWp18lpN8VYKKiREoaAH9d6QrdtaLkx k7Y2xmW/7CBeuHLgia6C75yAq0+ASXpES4wtjKJGeE7Tc83LS7jb5xaItJN3sHc5axuR La+sgFmAO1+kpb5nh5tqNjuAgOzsOFaIZ1v+g/7srNeIBfH0l6wjxUoO/IkuisdWsgRK PPdfVE4IjzCVpQKV02nwK2sI8+1eLFoUPiWm3cFdo5WLvSfAb3XtwGWIpTgnXL+g4Uic ZJoKD81DCs1iiwlAJ0UIqQs1VXhA4Kn1vLHURSekTURMdLdYF3ae7FbexmlvNh7If1fq Z5qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=SmcZDH4K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p3-20020a17090635c300b0078d4b2754b5si21807565ejb.332.2022.10.23.03.17.30; Sun, 23 Oct 2022 03:17:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=SmcZDH4K; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230230AbiJWJvr (ORCPT + 99 others); Sun, 23 Oct 2022 05:51:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230272AbiJWJva (ORCPT ); Sun, 23 Oct 2022 05:51:30 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8626753A8 for ; Sun, 23 Oct 2022 02:51:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518550; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6nRVOy34FSWnz35RTkSCNiLoYnujLTUllYE1MRb8dnM=; b=SmcZDH4KIEEkbU/WdZKwwliQkfoxLuLba9mgknhsRQuEXpgJuvPLWt5anmkAZLG/s6HigV XvzOSTPJJTDjMOeSzW5FKq4Fl9Kd+14MFKQqiDHDClnJUSfh1plgXtw2y3p/RIWrveNnwx fwAXvG6XWJ9FvOIhaf4n407CblusWCU= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 13/28] mfd: sm501: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:37 +0100 Message-Id: <20221023094852.8035-14-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747473164942675914?= X-GMAIL-MSGID: =?utf-8?q?1747473164942675914?= Use the new pm_sleep_ptr() macro to handle the .suspend/.resume callbacks. This macro allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- drivers/mfd/sm501.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c index 3ac4508a6742..28027982cf69 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c @@ -1432,8 +1432,6 @@ static int sm501_plat_probe(struct platform_device *dev) } -#ifdef CONFIG_PM - /* power management support */ static void sm501_set_power(struct sm501_devdata *sm, int on) @@ -1509,10 +1507,6 @@ static int sm501_plat_resume(struct platform_device *pdev) return 0; } -#else -#define sm501_plat_suspend NULL -#define sm501_plat_resume NULL -#endif /* Initialisation data for PCI devices */ @@ -1714,8 +1708,8 @@ static struct platform_driver sm501_plat_driver = { }, .probe = sm501_plat_probe, .remove = sm501_plat_remove, - .suspend = sm501_plat_suspend, - .resume = sm501_plat_resume, + .suspend = pm_sleep_ptr(sm501_plat_suspend), + .resume = pm_sleep_ptr(sm501_plat_resume), }; static int __init sm501_base_init(void) From patchwork Sun Oct 23 09:48:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 7993 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1563784wrr; Sun, 23 Oct 2022 03:51:40 -0700 (PDT) X-Google-Smtp-Source: AMsMyM46NCGA2pVrNrmi6l8TS/wa9PLQfb4uv5Cmmu+vhoZRsojWLBZjwXg077kHchYUWmHwZw4e X-Received: by 2002:a17:902:d510:b0:185:475a:4057 with SMTP id b16-20020a170902d51000b00185475a4057mr28695547plg.54.1666522300422; Sun, 23 Oct 2022 03:51:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666522300; cv=none; d=google.com; s=arc-20160816; b=W/ln8htJ94grjqVXPRpzZdKGBuWnazcKX/haeqOHuY7t0o+66EukM+N8tv4zp26DVE gSxOdT3WUeprCxPh7nz8GIRtJWjBcrreVk72aSu2f1ntqwsrdW6eXSOwSmezMJtwwg0f JttTi2Gntiic0PXSFECpj7tknYfCHtcL8GLd3P1/JCinZWa/ogebu6JXhIFZta2izdEd 5mZJ6PaieTMgCGz7QhQxHS5xDtzXRC1v2BXzFZ7wnLd+BhLbxpj036PIX2DKKburOhpI 2v5curUtealxa+WxkqCaDTA8D7e/93wfiL/RnX/S8uWt1iwyLPUdjxLIE3/lvIV7xrJt Jm3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VklgnW+uBOCoO+RRy4aqJ12OaIfCdghjrJSE0/tnQoc=; b=sNB4+1sRGAz4aV8uIpM6EBX0IzYb1oA/s+bqb8+FesVcHneWk0NrZ7WVWfePnC4y9F M18do0gld5jqQoZ7Zvu9+2VZdD5n54ZPM1uH1+zeaoaeMO9JZCh7F03g9ZcOWdvJq5wA ehZias38gcLODziEgCTmGwCgiwTIiXsJuoC3s+BGbMFU5Dc+/fynMNgmuUu9jX/gvjWg Huu2Er1PmOQjH8vHhiHq6mHUOXKIyCMBNFezl0sf2vNMRP9fKfgNhMsAs4rrV7kg29U8 EnwJA7cPUg4CulicAI1zsHr3ThJlvS92D53PTUOV898CSSui2Zw6Sru1eGomKwgFJWJ6 OiTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b="VAwl/6kf"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 13-20020a63134d000000b0045cfaf0bad5si8092746pgt.476.2022.10.23.03.51.27; Sun, 23 Oct 2022 03:51:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b="VAwl/6kf"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230092AbiJWJvy (ORCPT + 99 others); Sun, 23 Oct 2022 05:51:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230227AbiJWJvq (ORCPT ); Sun, 23 Oct 2022 05:51:46 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DACE75FDA for ; Sun, 23 Oct 2022 02:51:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518551; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VklgnW+uBOCoO+RRy4aqJ12OaIfCdghjrJSE0/tnQoc=; b=VAwl/6kfncV2uyXCN6oQ65qasZTcAlL1v5LXBI4n++1IXjBf9NTOsXuBouV+GbrXVdyn9s E1WmT5sZQUZd5c/BOXywoizANoLKuVfi1JnkBs+lKC2k+k4/uk077o/27ZZFJE59XiUL5X JmAGepzU2NX8mRZYrKfquHoDD8Ky3eM= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 14/28] mfd: tc6387xb: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:38 +0100 Message-Id: <20221023094852.8035-15-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747475287148501156?= X-GMAIL-MSGID: =?utf-8?q?1747475287148501156?= Use the new pm_sleep_ptr() macro to handle the .suspend/.resume callbacks. This macro allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- drivers/mfd/tc6387xb.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/mfd/tc6387xb.c b/drivers/mfd/tc6387xb.c index e846e4d26b6e..5392da6ba7b0 100644 --- a/drivers/mfd/tc6387xb.c +++ b/drivers/mfd/tc6387xb.c @@ -40,7 +40,6 @@ static const struct resource tc6387xb_mmc_resources[] = { /*--------------------------------------------------------------------------*/ -#ifdef CONFIG_PM static int tc6387xb_suspend(struct platform_device *dev, pm_message_t state) { struct tc6387xb *tc6387xb = platform_get_drvdata(dev); @@ -67,10 +66,6 @@ static int tc6387xb_resume(struct platform_device *dev) return 0; } -#else -#define tc6387xb_suspend NULL -#define tc6387xb_resume NULL -#endif /*--------------------------------------------------------------------------*/ @@ -220,8 +215,8 @@ static struct platform_driver tc6387xb_platform_driver = { }, .probe = tc6387xb_probe, .remove = tc6387xb_remove, - .suspend = tc6387xb_suspend, - .resume = tc6387xb_resume, + .suspend = pm_sleep_ptr(tc6387xb_suspend), + .resume = pm_sleep_ptr(tc6387xb_resume), }; module_platform_driver(tc6387xb_platform_driver); From patchwork Sun Oct 23 09:48:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 7988 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1560569wrr; Sun, 23 Oct 2022 03:38:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4d93fGOa09SSUW8UqxFcv49sSxWzqGJef//unN00zvf97yL/5o6LNtnhHVdIYtZ5kmseUe X-Received: by 2002:a17:907:16aa:b0:6fe:91d5:18d2 with SMTP id hc42-20020a17090716aa00b006fe91d518d2mr23593290ejc.190.1666521481669; Sun, 23 Oct 2022 03:38:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666521481; cv=none; d=google.com; s=arc-20160816; b=dJZ5ep6a0+9LkbHzWw/GSEixGbX6tYdUOsDhozn2yurKjwobeZXnO1f2xbE6bcaDEf QsorAL0JvOFBhYwCROVHMDkrBBnb4JXDCKH3pcr5ptonpkPevk3jEB/+YTWvNhhZ0VMw m7kmIz+rGC+ibO66AUERk4qz+wtm0EgSU+H5B1gJExBnUdP0jXoER7QVv5lej/RauOAC FfekpVehYLmeBlJJDzJjjNs3oYlgFHa+sYGAKlWMHccK2nG6XHSfGu3fCEfTJIuzTx3q HKanhbeuVCZBYPs1D8+7Qk68FWuW+GZ2751BDLXJTpvXIDdsGIN4mpwZgk/M0cQaIDGM HcmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=C/CZfgeHadcU1fuJomu2DjVRR0sBKfhmzKi2+xTgRd8=; b=GU/aBcD+yiTn2Q9xkZAeQotkifdc+EpJuqxJ0yHcjVwGKQudqGMws1HnqlQ8/cSpIN xLC+P+StFP1uPXQpKVhLQCFgyOwfZls3S787MImxctxi5l48j/WYtvK5owyjEPLIVVqk rEFU5x415dRRUm2TtOut5CLXnrWPeAxhWy+PuMMVtm8T+nFTvrDZEReHwXpy5pVBSEHu cCMtl2TlicFGTR6BuylIfa2RL0E4D70Ir/SSPzM79kDxXeLM+Fk7GKl3G9TRzcs6YRjo A6nxan7tgWSkN4Sis910f7j4izMv58Xq6UzMs8auevHUnfhxn4kcg6PxH6+dk9nf+rPh 5aVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=KWW5ShZK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hz6-20020a1709072ce600b00791a5f0b140si13213449ejc.993.2022.10.23.03.37.37; Sun, 23 Oct 2022 03:38:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=KWW5ShZK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230036AbiJWJwM (ORCPT + 99 others); Sun, 23 Oct 2022 05:52:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230162AbiJWJwJ (ORCPT ); Sun, 23 Oct 2022 05:52:09 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FEAD754B3 for ; Sun, 23 Oct 2022 02:51:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518552; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=C/CZfgeHadcU1fuJomu2DjVRR0sBKfhmzKi2+xTgRd8=; b=KWW5ShZKnp6gjISj0AbHVV6/r/XBPH28JqPe5zr7JiKugFf1U58ilHjvnuLXwg7EzcKOwh Xc66i1gAXijbV0itAU+9WPr3o85M6Gfn9P84Z0p5wgjBGIVMGeDQuFFHL3+z59pcEpyPZ+ F/UweYh07QCMZmKn6adiaKMpvGuCpkA= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 15/28] mfd: tps6586x: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:39 +0100 Message-Id: <20221023094852.8035-16-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747474428931894206?= X-GMAIL-MSGID: =?utf-8?q?1747474428931894206?= Use the new pm_sleep_ptr() macro to handle the .irq_set_wake() callback. This macro allows the mt6397_irq_set_wake() function to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- drivers/mfd/tps6586x.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c index c9303d3d6602..fd57c3974615 100644 --- a/drivers/mfd/tps6586x.c +++ b/drivers/mfd/tps6586x.c @@ -269,15 +269,11 @@ static void tps6586x_irq_sync_unlock(struct irq_data *data) mutex_unlock(&tps6586x->irq_lock); } -#ifdef CONFIG_PM_SLEEP static int tps6586x_irq_set_wake(struct irq_data *irq_data, unsigned int on) { struct tps6586x *tps6586x = irq_data_get_irq_chip_data(irq_data); return irq_set_irq_wake(tps6586x->irq, on); } -#else -#define tps6586x_irq_set_wake NULL -#endif static struct irq_chip tps6586x_irq_chip = { .name = "tps6586x", @@ -285,7 +281,7 @@ static struct irq_chip tps6586x_irq_chip = { .irq_bus_sync_unlock = tps6586x_irq_sync_unlock, .irq_disable = tps6586x_irq_disable, .irq_enable = tps6586x_irq_enable, - .irq_set_wake = tps6586x_irq_set_wake, + .irq_set_wake = pm_sleep_ptr(tps6586x_irq_set_wake), }; static int tps6586x_irq_map(struct irq_domain *h, unsigned int virq, From patchwork Sun Oct 23 09:48:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 7979 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1548375wrr; Sun, 23 Oct 2022 02:58:53 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4y9NODU9LjJkTRLTJBInV+SvJwolWm6pz+yLKEsrvK1kU0GxoIpOrvUsv8R2aZ8wsDqiCd X-Received: by 2002:a17:907:8688:b0:791:91a0:fdb3 with SMTP id qa8-20020a170907868800b0079191a0fdb3mr21708278ejc.499.1666519122392; Sun, 23 Oct 2022 02:58:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666519122; cv=none; d=google.com; s=arc-20160816; b=GOozVNU59Noo4VnbWlSCEvId3YSvVzQrl4t9D+SLidzbSziu1MKLZKGnK/YrUaxKSb 0VTFS2OmEzYun+5Ih4vmQZiu+HbV4F3VGngChQYGaF0kqCHFVou0wIXIq1ZwpPDAq8Mk jVzT5mtFtcYxHD4Wz2RVa6XAKRl0onJEzomxD/8ZjL28igQtBgZrBBGtygGiueLRgsX7 mH5f845NDpExQRGpHOLVh3hV9JIMMjK3Ytzfx5Y9qp7X4QJCb2eQpsfdMHbBmlqyR4SL tp7JK3/eRqDM+kN68t+BONmDsnT9Tm3JM327rCYHKnuhtj2siK2RKyveHNl4ZtdNl+iy uR2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lyyljsq433FjzziKmqqvZZTp5vtZQm0VWBzs9lEg4/Q=; b=QsSPVq74BbZS1suQsUOYYwWFUa1GvGFIcZryGVLZhFplyGLESh41OU3zTZUCZAOo2O uRnwruNAh6Hj7YeG0PAm+cxmklUAUuntzVfYiOKXuywpRJt/5a37Z2+5dnx1/ZgUzW6q Na1aOVZyTQqJhanC4kS5U2cbG1hJpHTdd8pVdXmXhw13h53Dnt3/ztNouFeHvyd+Hpdm 4yBGPwgA2BGYLLpaq0p6dnILxu9ZEQHjvmo9T+Uuz5B9YaPBC2na2uYeQWAJ7s3FTKM4 +HP4nlqebPx3Kd9cO+GSAxeepi7/1qEINjt4mMuNLiYrerrF69RZMBRX52TrynmNtenp PniA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=Bl3qJQwn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oz15-20020a1709077d8f00b0078dcc87b1c4si13370170ejc.923.2022.10.23.02.58.16; Sun, 23 Oct 2022 02:58:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=Bl3qJQwn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229928AbiJWJwk (ORCPT + 99 others); Sun, 23 Oct 2022 05:52:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230173AbiJWJwj (ORCPT ); Sun, 23 Oct 2022 05:52:39 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3A0F74DC2 for ; Sun, 23 Oct 2022 02:52:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518552; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lyyljsq433FjzziKmqqvZZTp5vtZQm0VWBzs9lEg4/Q=; b=Bl3qJQwnF/mgh0ZIe2ANQ9s2QygwMAyVqFAKAH0Qht5gnhf9aTanNjSzHHMn0rTOqhV4RQ iMUF7iMh7BYx9Xvd3IDhGphIsclQNcgAIRf3PUoufiwJo9pv7MB2dwJhb8f+IoJ2Pgo0ki 1ofViD+ouPLOUHCv3x7cD6ehVvbTJrU= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Charles Keepax Subject: [PATCH v3 16/28] mfd: wm8994: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:40 +0100 Message-Id: <20221023094852.8035-17-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747471955276463267?= X-GMAIL-MSGID: =?utf-8?q?1747471955276463267?= Use the new RUNTIME_PM_OPS() and pm_ptr() macros to handle the .runtime_suspend/.runtime_resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_PM is disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Note that this driver should probably use the new DEFINE_RUNTIME_DEV_PM_OPS() macro instead, which will provide .suspend/.resume callbacks, pointing to pm_runtime_force_suspend() and pm_runtime_force_resume() respectively; unless those callbacks really aren't needed. Signed-off-by: Paul Cercueil Acked-by: Charles Keepax --- drivers/mfd/wm8994-core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/wm8994-core.c b/drivers/mfd/wm8994-core.c index 7b1d270722ba..a27a13b5ae1e 100644 --- a/drivers/mfd/wm8994-core.c +++ b/drivers/mfd/wm8994-core.c @@ -110,7 +110,6 @@ static const char *wm8958_main_supplies[] = { "SPKVDD2", }; -#ifdef CONFIG_PM static int wm8994_suspend(struct device *dev) { struct wm8994 *wm8994 = dev_get_drvdata(dev); @@ -213,7 +212,6 @@ static int wm8994_resume(struct device *dev) return ret; } -#endif #ifdef CONFIG_REGULATOR static int wm8994_ldo_in_use(struct wm8994_pdata *pdata, int ldo) @@ -676,13 +674,13 @@ static const struct i2c_device_id wm8994_i2c_id[] = { MODULE_DEVICE_TABLE(i2c, wm8994_i2c_id); static const struct dev_pm_ops wm8994_pm_ops = { - SET_RUNTIME_PM_OPS(wm8994_suspend, wm8994_resume, NULL) + RUNTIME_PM_OPS(wm8994_suspend, wm8994_resume, NULL) }; static struct i2c_driver wm8994_i2c_driver = { .driver = { .name = "wm8994", - .pm = &wm8994_pm_ops, + .pm = pm_ptr(&wm8994_pm_ops), .of_match_table = wm8994_of_match, }, .probe = wm8994_i2c_probe, From patchwork Sun Oct 23 09:48:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 7995 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1564458wrr; Sun, 23 Oct 2022 03:54:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4whrGpKqKvUHIdkilg8olzheCjk1XgYi3hx2HnABG+riOfeL/TmKniKLQd8oWBhbj4msrb X-Received: by 2002:a63:d0:0:b0:45b:b321:46d2 with SMTP id 199-20020a6300d0000000b0045bb32146d2mr24130539pga.250.1666522463652; Sun, 23 Oct 2022 03:54:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666522463; cv=none; d=google.com; s=arc-20160816; b=oX/Qvmz26+J5yrnm+vuxMTjp6LbT47MK0Hqlvw/33iAXRD5Dh/3w3llRDS/QGmMO6i 2/Vrjg9zxFKBaGiCWegjNPRY+U81KR3atKuZimWGUT5ehZlNXy5p7uLztIA0fAYVUQBO eXT3Pf5HRXnDU/BkwM87iys2z8pifBS/7YEVRhnBCDZYCr/f3PHXIGPsQN9Cn5DexPqA n201O79bnmEjbp6jGuNFEEFQ75HyxjpZDqn51VReOQ6Kinv+6wl+LOlXVQZyCh+w/cO9 QLuZGJA6aIpykGjg+pUr6W5mwJdBPklHd7NCw5tJA4l98mqehv3BJiFYiil2ZOBqIx8o rVew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=p6dlhZlwLIf/lPMpMtYZKWAT+azhK3anbKwIEZa9zE8=; b=e+1xdyK4VPDD7sasKGXTlrjIWJttilD0HheIYTP1j3ug8WO/ePEWzEYtRjYHid6Bje RfJonE4qUaJdcoZw7uFkxn1XAOHOMTLGffoJp8wEVWQ4GCR8awabiL8idd5mnBeA5BF5 Eb8ZZlgmCLHxO9qu26FjHFqu8kjIFDXhMNTqkhTSq5KFo28lv3uwuYLply8UieKFa7Xw /80DeeflaagjMtoXtAFD5y+zh0IzNdNCEw13awqmlix42YZJVYlyPznL3KDuHjC4/QKQ volxpqNikHtX1QiSM5hNcFF0Kk1a1rPmoSEjt+BMvYo0h1+BZIURxPHasngeXa+j3Nuk BtJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=X3Izna6i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u8-20020a654c08000000b0043c64130f17si31717494pgq.107.2022.10.23.03.54.10; Sun, 23 Oct 2022 03:54:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=X3Izna6i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230181AbiJWJw7 (ORCPT + 99 others); Sun, 23 Oct 2022 05:52:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230219AbiJWJw5 (ORCPT ); Sun, 23 Oct 2022 05:52:57 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B1175A835 for ; Sun, 23 Oct 2022 02:52:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518553; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=p6dlhZlwLIf/lPMpMtYZKWAT+azhK3anbKwIEZa9zE8=; b=X3Izna6i+PuzhYrjVCdVd4B0BGYCC43zVSGK6WANLlnoavKLLK9b3BvNJVJAr3vHfzYuwt ow2x6ZKsfMqVZrApb7L/6HgRdsraAoKc2vKRQmXCUUXEb7Vmoj1ZwiH7/ZKPsqEucaKn9l OfAvR3dnb3ksURXBgeP+aWhaRJ9c1O4= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 17/28] mfd: max77620: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:41 +0100 Message-Id: <20221023094852.8035-18-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747475458823232317?= X-GMAIL-MSGID: =?utf-8?q?1747475458823232317?= Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- drivers/mfd/max77620.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/mfd/max77620.c b/drivers/mfd/max77620.c index a6661e07035b..42fa9c4b97aa 100644 --- a/drivers/mfd/max77620.c +++ b/drivers/mfd/max77620.c @@ -576,7 +576,6 @@ static int max77620_probe(struct i2c_client *client, return 0; } -#ifdef CONFIG_PM_SLEEP static int max77620_set_fps_period(struct max77620_chip *chip, int fps_id, int time_period) { @@ -683,7 +682,6 @@ static int max77620_i2c_resume(struct device *dev) return 0; } -#endif static const struct i2c_device_id max77620_id[] = { {"max77620", MAX77620}, @@ -692,14 +690,13 @@ static const struct i2c_device_id max77620_id[] = { {}, }; -static const struct dev_pm_ops max77620_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(max77620_i2c_suspend, max77620_i2c_resume) -}; +static DEFINE_SIMPLE_DEV_PM_OPS(max77620_pm_ops, + max77620_i2c_suspend, max77620_i2c_resume); static struct i2c_driver max77620_driver = { .driver = { .name = "max77620", - .pm = &max77620_pm_ops, + .pm = pm_sleep_ptr(&max77620_pm_ops), }, .probe = max77620_probe, .id_table = max77620_id, From patchwork Sun Oct 23 09:48:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 7999 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1565475wrr; Sun, 23 Oct 2022 03:58:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6ssiVMHYiseu7K0C9j/ZFoJKhp/uB0Kmgy3e9NNE4qfSQ95jM9AzGme6x3PWSTrlPNoYNx X-Received: by 2002:a63:480e:0:b0:46e:b96c:4f89 with SMTP id v14-20020a63480e000000b0046eb96c4f89mr10193668pga.201.1666522723940; Sun, 23 Oct 2022 03:58:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666522723; cv=none; d=google.com; s=arc-20160816; b=B5GHqNgbRJoXfxGbU/s5ATZNrpkpCaypuC2lutUxpdXoU3wznVaDViUMIlY1n3XuLI 3q1QxR/z+sAXUWiUC3J6V6g82QD1NESR3rplTL0nPf3KQgudHV21GpNTQWpjRAtrgj6r K9/OUA3xUKuPzRFhuH05kvEfvOTDe736Hbk58PEp3NbN1ldutjTevRhi+sHZaf1uodFB 4q47hyqH7NDl+YDGXbILlV/wt6p8F8CNitXYrrLLoVKHiMh/8jKlg+ehh5HkuGuZJZnt 4f0SYtDEnkHlVOU49PU4vETusLPviZo36466Fuot/ahmgufW5mCplzSlVNtSPM0Ukldk kzlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=br301fRK+XR8bCfkYexTo4vtYjSJhFPTzOjfRomSgPs=; b=t/yOhMg0O1jFqa317gOYT5YtVmut3v+CMRi4rxVAoGKXncqVQsX2bksl/76pfpvBz1 amwyKCzKYwJ9eNpBez2AgBCYA6sqtJgkr5RH9O/MWg+52JHsAhbLsVZatrBm40SWOfHf gzm0ftZ7fzhfmBxocONEUGrHGN6hYa08mOGUwLosJG8mJh4g9NC51E5T2pK4UyLzU0TG q/gbFOREzl4whehYOR5Cz+H3n7Swz8zISha2m+aQnMVgfTrN5jEByQcO3LpIw/sCpG51 t/+zm5xMpETv4eyrEjCJVKaK1DS0gmWOnFDTOWf/PQWA5fu6k8lwM8/hV8foH18okIDx e+FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=FN+w4sbg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 13-20020a63134d000000b0045cfaf0bad5si8092746pgt.476.2022.10.23.03.58.30; Sun, 23 Oct 2022 03:58:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=FN+w4sbg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230227AbiJWJxM (ORCPT + 99 others); Sun, 23 Oct 2022 05:53:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230231AbiJWJxL (ORCPT ); Sun, 23 Oct 2022 05:53:11 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F314760CD for ; Sun, 23 Oct 2022 02:53:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518553; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=br301fRK+XR8bCfkYexTo4vtYjSJhFPTzOjfRomSgPs=; b=FN+w4sbgOYuu4k6UDjmFbxK1q5s3lW9Se3QRdNx20NVbKRBt74smUJFlL4th3zWy1wCQq7 Y0Oiy/9KJpd/1iYuKvKt0f0fXgToVBOLBKF7ZIxLfqzGxaGZFWwxhdRuOvoEwMXK0jW/2C E98fsVmN1iGY64TkrbEMKYvKqJwvqSk= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 18/28] mfd: t7l66xb: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:42 +0100 Message-Id: <20221023094852.8035-19-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747475731742990896?= X-GMAIL-MSGID: =?utf-8?q?1747475731742990896?= Use the new pm_sleep_ptr() macro to handle the .suspend/.resume callbacks. This macro allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- drivers/mfd/t7l66xb.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/mfd/t7l66xb.c b/drivers/mfd/t7l66xb.c index 663ffd4b8570..1d9d1d38d068 100644 --- a/drivers/mfd/t7l66xb.c +++ b/drivers/mfd/t7l66xb.c @@ -257,7 +257,6 @@ static void t7l66xb_detach_irq(struct platform_device *dev) /*--------------------------------------------------------------------------*/ -#ifdef CONFIG_PM static int t7l66xb_suspend(struct platform_device *dev, pm_message_t state) { struct t7l66xb *t7l66xb = platform_get_drvdata(dev); @@ -288,10 +287,6 @@ static int t7l66xb_resume(struct platform_device *dev) return 0; } -#else -#define t7l66xb_suspend NULL -#define t7l66xb_resume NULL -#endif /*--------------------------------------------------------------------------*/ @@ -416,8 +411,8 @@ static struct platform_driver t7l66xb_platform_driver = { .driver = { .name = "t7l66xb", }, - .suspend = t7l66xb_suspend, - .resume = t7l66xb_resume, + .suspend = pm_sleep_ptr(t7l66xb_suspend), + .resume = pm_sleep_ptr(t7l66xb_resume), .probe = t7l66xb_probe, .remove = t7l66xb_remove, }; From patchwork Sun Oct 23 09:48:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 7982 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1554978wrr; Sun, 23 Oct 2022 03:18:20 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5Ctq2Nd7ssNGWorw3FkbI6WESzMphMpBjWmr9Jqq5yfCqWrF9FUWZjnSXOyiw+AJh9uhOg X-Received: by 2002:a05:6402:5107:b0:45d:409:1337 with SMTP id m7-20020a056402510700b0045d04091337mr26466834edd.185.1666520300631; Sun, 23 Oct 2022 03:18:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666520300; cv=none; d=google.com; s=arc-20160816; b=fODDLzql8jC/JqRKtpehCDMmXHAalPvT+FqL/6+XKWyjowAr8q7Fj+/hXd7ZACe3En 55zgyKiP3UZJnvJ6sD5T0iyRqoEXJ+QRBh3/NPsMd+xKwBEK++iZRLMPHp/rEJRds24u uviuFzVFaV39+LyYm8t2CwwfPF3rqzGJ3CnK4Sem5igPp7TEru/buJoWhMVB2beNMEFE g/hRz65pYh7iGouElCGbM/sE6PIsMskyU+5+lxky3gwxj+i1TBwyH9yK+o00A5lp5WuS B/M04aoWKikcpR+inQfu2uD+C1g6f/P0C2k/kiFdhm1ZBxiOFRgyVlmjLHSEggPpaflK hjaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hjKKqw3Bk3xbTfdsBUYQKJyI4PHiU8JemC2E70n/LOg=; b=UKdyPAlhIbjOFFoRixq8IVr5tJxJjJO3GGCJtl67a7q/wykoQStu8t1aAio1ACnKiA uovCOOXDn7kXCYxV2wEbQnYMukeZT5TWeB6mP61rQvYpmndNsnCugAhOQrZoHDbvTTCr /VsfTQok5sNaOgl1RdSjlqMRLCOABTQUzmrqJhvGWjxqNyvZrPyWMsLy7E5kDUKSP2Dv AmvzbbzOPwu6wmr1FFA6hxCYRcguIz9C4/2QNYvV2s6+H443Ma74lnTbWKMUdeDqpVoe 0PYLsuxDse6MuZQmB+FeCm7V1QyAdo4zXyt0n2NJ8LOH4LoEh2OQrRb2a7cer49vyG5W FjEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=0usJwLGZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ga13-20020a1709070c0d00b0078d2197d670si24080742ejc.661.2022.10.23.03.17.56; Sun, 23 Oct 2022 03:18:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=0usJwLGZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230204AbiJWJxc (ORCPT + 99 others); Sun, 23 Oct 2022 05:53:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230210AbiJWJx3 (ORCPT ); Sun, 23 Oct 2022 05:53:29 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E29CD75CC2 for ; Sun, 23 Oct 2022 02:53:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518554; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hjKKqw3Bk3xbTfdsBUYQKJyI4PHiU8JemC2E70n/LOg=; b=0usJwLGZjJ+e/1Vb9BwWtfQuGR6MEwx+OK98wvscHh0B4ccXJYqJZ/svmM2+nwVOsZcK14 3HElOeLjAwv76sNkobr6+Pv2HjvnkDnOFBfra0DiDMsuGDuAnOe7cS8VwXXWGbJ77spbUR vJ6LBe/UdZBd6ijdOt0LvoNw+pmSzoo= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Charles Keepax Subject: [PATCH v3 19/28] mfd: arizona: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:43 +0100 Message-Id: <20221023094852.8035-20-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747473190872983864?= X-GMAIL-MSGID: =?utf-8?q?1747473190872983864?= Only export the arizona_pm_ops if CONFIG_PM is set, but leave the suspend/resume functions (and related code) outside #ifdef guards. If CONFIG_PM is not set, the arizona_pm_ops will be defined as "static __maybe_unused", and the structure plus all the callbacks will be automatically dropped by the compiler. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil Acked-by: Charles Keepax --- V2: Use new EXPORT_GPL_DEV_PM_OPS() macro V3: No change drivers/mfd/arizona-core.c | 19 +++++++------------ drivers/mfd/arizona-i2c.c | 2 +- drivers/mfd/arizona-spi.c | 2 +- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/drivers/mfd/arizona-core.c b/drivers/mfd/arizona-core.c index cbf1dd90b70d..bd7ee3260d53 100644 --- a/drivers/mfd/arizona-core.c +++ b/drivers/mfd/arizona-core.c @@ -480,7 +480,6 @@ static int wm5102_clear_write_sequencer(struct arizona *arizona) return 0; } -#ifdef CONFIG_PM static int arizona_isolate_dcvdd(struct arizona *arizona) { int ret; @@ -742,9 +741,7 @@ static int arizona_runtime_suspend(struct device *dev) return 0; } -#endif -#ifdef CONFIG_PM_SLEEP static int arizona_suspend(struct device *dev) { struct arizona *arizona = dev_get_drvdata(dev); @@ -784,17 +781,15 @@ static int arizona_resume(struct device *dev) return 0; } -#endif -const struct dev_pm_ops arizona_pm_ops = { - SET_RUNTIME_PM_OPS(arizona_runtime_suspend, - arizona_runtime_resume, - NULL) - SET_SYSTEM_SLEEP_PM_OPS(arizona_suspend, arizona_resume) - SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(arizona_suspend_noirq, - arizona_resume_noirq) +EXPORT_GPL_DEV_PM_OPS(arizona_pm_ops) = { + RUNTIME_PM_OPS(arizona_runtime_suspend, + arizona_runtime_resume, + NULL) + SYSTEM_SLEEP_PM_OPS(arizona_suspend, arizona_resume) + NOIRQ_SYSTEM_SLEEP_PM_OPS(arizona_suspend_noirq, + arizona_resume_noirq) }; -EXPORT_SYMBOL_GPL(arizona_pm_ops); #ifdef CONFIG_OF static int arizona_of_get_core_pdata(struct arizona *arizona) diff --git a/drivers/mfd/arizona-i2c.c b/drivers/mfd/arizona-i2c.c index 6d83e6b9a692..8799d9183bee 100644 --- a/drivers/mfd/arizona-i2c.c +++ b/drivers/mfd/arizona-i2c.c @@ -119,7 +119,7 @@ static const struct of_device_id arizona_i2c_of_match[] = { static struct i2c_driver arizona_i2c_driver = { .driver = { .name = "arizona", - .pm = &arizona_pm_ops, + .pm = pm_ptr(&arizona_pm_ops), .of_match_table = of_match_ptr(arizona_i2c_of_match), }, .probe = arizona_i2c_probe, diff --git a/drivers/mfd/arizona-spi.c b/drivers/mfd/arizona-spi.c index 941b0267d09d..da05b966d48c 100644 --- a/drivers/mfd/arizona-spi.c +++ b/drivers/mfd/arizona-spi.c @@ -282,7 +282,7 @@ static const struct of_device_id arizona_spi_of_match[] = { static struct spi_driver arizona_spi_driver = { .driver = { .name = "arizona", - .pm = &arizona_pm_ops, + .pm = pm_ptr(&arizona_pm_ops), .of_match_table = of_match_ptr(arizona_spi_of_match), .acpi_match_table = ACPI_PTR(arizona_acpi_match), }, From patchwork Sun Oct 23 09:48:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 7983 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1555506wrr; Sun, 23 Oct 2022 03:20:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5v/7qIDJZSfekYdH1CcKak/9I6eLG4KT9k7L8Zyk4Ww6uliXPbcMNXy6N3yaAehaqrtWcd X-Received: by 2002:a17:907:75c1:b0:79b:f804:c081 with SMTP id jl1-20020a17090775c100b0079bf804c081mr9604271ejc.381.1666520424509; Sun, 23 Oct 2022 03:20:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666520424; cv=none; d=google.com; s=arc-20160816; b=0e92kan+N2P5GooEjn5xVIo6YIyVCbGtYKXHCI9GtXnY1SzfzUVS/H3tIxv0+snqMP AqEuZBqCi2U7fCmts6EPBGLLQxXRS3fyVGBTamHYmj43M8MfYMuu07Dj/jWz/GdMIx36 Eh7ilTHb97OC90uql0V+xRDtE3UQSo7qbXHICXlpmQx7VHm5Unlt1T7ikRfOvFSWS03g SqvmdFpCJlefg9T99iH2vXxoBKsSVZMQgbFfXNCt06UBCEUW4P24+MM2wGVt6W2nfpJC de7v7yv0GSg66ReX1PGF1CM1B6yZlwOZI+rqicMA9zxKLHW78XhsnOb/iQ7FyUMEGIoi 3OJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jS4RbK1fBZHnJZWsSL9bNObOtXdqrDwmB2EJvhOE5WE=; b=0/G1juR/Y7LymKVclLvAZ1tDrKs8Mv/FaroGUoH3JfyBn6CK+RzCS7bZN7DIK9Tt3b m6XO3vcMm5GyzyjflodeSHQHbBXgRlDTMqy0F6EH4sbR+bgKFBbYmrc0wqJlSVCy+nev kTfAu2rwmsL//md7NKCiojiruJeo1Q26M1cGz68CMlLp+F6O+hnZ4UKSlHOeaSmsEx0N 3/HgvKMlm32rUXTxRomXw5FySXIG2l6DyvNaKT3Uv9NjRpYiTwRmg8z/4+HBkcvVM45A bpaFi1LIR99946NLYtTFjZZemKt60twZQbQea3hi6wewZYRRGc1lpbWox2RWZNLEQ/SR T5Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=rtXmaloH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q5-20020a1709064c8500b0078200f886bbsi24729503eju.361.2022.10.23.03.19.59; Sun, 23 Oct 2022 03:20:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=rtXmaloH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230242AbiJWJxr (ORCPT + 99 others); Sun, 23 Oct 2022 05:53:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230253AbiJWJxm (ORCPT ); Sun, 23 Oct 2022 05:53:42 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1D4A2760E9 for ; Sun, 23 Oct 2022 02:53:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518555; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jS4RbK1fBZHnJZWsSL9bNObOtXdqrDwmB2EJvhOE5WE=; b=rtXmaloHsvGNzT2AB4fOw0XJ32A/93glRX494xsmj5xI3pald7gB9yu0TSeTydLWcu0Fgq 3L2+usa7H/VMv8RTwemGLTPJuYmdRPtiY67VWAndb6WY26Upa8rcVpp5sBtv0IBHMt9mkx Acd0H9jxZPGpkS8moPeJq3/bwvwBUG8= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Krzysztof Kozlowski Subject: [PATCH v3 20/28] mfd: max14577: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:44 +0100 Message-Id: <20221023094852.8035-21-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747473320928477132?= X-GMAIL-MSGID: =?utf-8?q?1747473320928477132?= Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil Reviewed-by: Krzysztof Kozlowski --- drivers/mfd/max14577.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/max14577.c b/drivers/mfd/max14577.c index 6c487fa14e9c..9de29a8070c7 100644 --- a/drivers/mfd/max14577.c +++ b/drivers/mfd/max14577.c @@ -482,7 +482,6 @@ static const struct i2c_device_id max14577_i2c_id[] = { }; MODULE_DEVICE_TABLE(i2c, max14577_i2c_id); -#ifdef CONFIG_PM_SLEEP static int max14577_suspend(struct device *dev) { struct i2c_client *i2c = to_i2c_client(dev); @@ -515,14 +514,13 @@ static int max14577_resume(struct device *dev) return 0; } -#endif /* CONFIG_PM_SLEEP */ -static SIMPLE_DEV_PM_OPS(max14577_pm, max14577_suspend, max14577_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(max14577_pm, max14577_suspend, max14577_resume); static struct i2c_driver max14577_i2c_driver = { .driver = { .name = "max14577", - .pm = &max14577_pm, + .pm = pm_sleep_ptr(&max14577_pm), .of_match_table = max14577_dt_match, }, .probe = max14577_i2c_probe, From patchwork Sun Oct 23 09:48:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 7991 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1563419wrr; Sun, 23 Oct 2022 03:49:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7VVGY3pGqij8Hvy1nEwuhPepu6ltcgNgSkfGK4xyFRPz/F2vE5VN2vU+U1SNvr6QNcHr0j X-Received: by 2002:a17:907:270d:b0:7a5:f25d:9efe with SMTP id w13-20020a170907270d00b007a5f25d9efemr1687368ejk.640.1666522187621; Sun, 23 Oct 2022 03:49:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666522187; cv=none; d=google.com; s=arc-20160816; b=OZopI+Bh77eDeFps4r+KWwjnVE7O6SDjKktCNkB1OVIxlQbnM1m7cd0INU3b4pAIDj WL13VXhyzDGk8KmHopz0q/eN7Zh+EG0X2xV6VrkV7+4Ru3pytwA6+XE53Zc3mNhaizXx ZOWT1KiLGW1U+LPUN1J+9MUt6CbCAzbbVE2wMMZ9K+w+REqW15FyMjHTxPBURVcfTjIu Vw/Mp7TxIP+paB05PGSQRFMM0Jd8QDORPcJIXZ1+PMTH0X252n+H0hhYfQNoe8Wv2qlW resWTUTSP1ZoxMl/y+vcSnOuVALU87hBTQM9guwbY3e6g3oZCx0Ea/au0Yn4jwIK3YcW LvXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=aDdXMBaOyK7oXLIUXU8KO8h1827AMeVClKPmuTxxjYw=; b=VCmZ2IabuujA1/rtBgakmpJKzHQLrwBoAOprhwqyQrrfk1zVLL52lp74LfCYOlNz2S 00YblMpIsa1rfYMt8yJDY6pRcukyyaKOIWW9TgM5k6A0SfkleyOC31uyaebRqlhEEVjD npFwUIzbKYUfdGo9D9Bn37mQ8A5hRLsliLjww2/CB1vVDEppS5pr5kyq9hn1KHW1fhua KmjA0ebkbymW71ZZtbVgSxQEyAS0SZuMeRvrYjNkmZW5HLN1/SWsT3vg3k4b6Wpss4cc CI594r7ei1rNjzpgK7rw8uYnzPC2tKQXY1OIJ28zBQsZrRYXzKTHbOZzEnuNOqf0+L6H bAqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=UVcgkd2h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m22-20020aa7c2d6000000b0044e9fd71b82si21357440edp.280.2022.10.23.03.49.23; Sun, 23 Oct 2022 03:49:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=UVcgkd2h; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230251AbiJWJyA (ORCPT + 99 others); Sun, 23 Oct 2022 05:54:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230210AbiJWJxw (ORCPT ); Sun, 23 Oct 2022 05:53:52 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE32857227 for ; Sun, 23 Oct 2022 02:53:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518555; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aDdXMBaOyK7oXLIUXU8KO8h1827AMeVClKPmuTxxjYw=; b=UVcgkd2hqBcVTDUblKW3Y+9nk5/fMeVVyGZYIWvhDzaCIWOkUxmwBQdyN3JQupoMFszBVp yI+asK4EPSJltpmZ7zS7Caj/JDgmv3A6Eva7yNng/Ed+fBnDg482KqaaeuLKQ0ThFT1T3h b6DQA5qDSaJPv3K1ERHiG5kKTzsyI1g= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Krzysztof Kozlowski Subject: [PATCH v3 21/28] mfd: max77686: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:45 +0100 Message-Id: <20221023094852.8035-22-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747475169362908671?= X-GMAIL-MSGID: =?utf-8?q?1747475169362908671?= Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil Reviewed-by: Krzysztof Kozlowski --- drivers/mfd/max77686.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/max77686.c b/drivers/mfd/max77686.c index 2ac64277fb84..f8e863f3fc95 100644 --- a/drivers/mfd/max77686.c +++ b/drivers/mfd/max77686.c @@ -226,7 +226,6 @@ static int max77686_i2c_probe(struct i2c_client *i2c) return 0; } -#ifdef CONFIG_PM_SLEEP static int max77686_suspend(struct device *dev) { struct i2c_client *i2c = to_i2c_client(dev); @@ -261,14 +260,13 @@ static int max77686_resume(struct device *dev) return 0; } -#endif /* CONFIG_PM_SLEEP */ -static SIMPLE_DEV_PM_OPS(max77686_pm, max77686_suspend, max77686_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(max77686_pm, max77686_suspend, max77686_resume); static struct i2c_driver max77686_i2c_driver = { .driver = { .name = "max77686", - .pm = &max77686_pm, + .pm = pm_sleep_ptr(&max77686_pm), .of_match_table = max77686_pmic_dt_match, }, .probe_new = max77686_i2c_probe, From patchwork Sun Oct 23 09:48:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 7984 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1557919wrr; Sun, 23 Oct 2022 03:28:16 -0700 (PDT) X-Google-Smtp-Source: AMsMyM54G2kAlu1RSp15z91TGq/BWM+Ih5NhEKsxFqSOTzCagDrVR9ocC94gWO5UtYvgpVKd3vI/ X-Received: by 2002:a17:907:62a1:b0:781:b320:90c0 with SMTP id nd33-20020a17090762a100b00781b32090c0mr21672106ejc.255.1666520895895; Sun, 23 Oct 2022 03:28:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666520895; cv=none; d=google.com; s=arc-20160816; b=xrlI8qLIL4kK23YOeCkc23LoHeF8tu3PyqwdXfQ/RxmgsU0NukEbVaMg1WtgdXFVvX bcz0ZgVbMEtQ7MFMQ+3l3mv2c7d/WEhwaLtxHQoahUvoBB6mKtmR0JDGa4mmAaZ1RlLD iEkTQ4ttYCU/J3TqtCuEQxMX8xlaFIU1glsQvtYTCUg538mTwNG6p3ekrsd60WA2BgsA EoIy0o6/sWjHpILiNtrcxg3jpPpbh9i7n/gRRVRTAGH4d//swzWcdvOz1P5Cqzi8OPTW xiosAzhEhOnrZFEmRQ3Nf8u3sq+ZClht1jXUWsr/JlPsNJuoPb8SmPe30dIT/u8+fdnX Z1jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fH7g4YysWMLgOSNDG15jV52CUiW7mUEZ75bQsRILO7Y=; b=ejSqoRq3EQtZPZyMpNIbt2L3dqp00H40HUxytp/NxZtu76k/R+AbI0E0yaeD4vHmxT BKy7aNo45MqmHGhoesmqBDOoIFwLFZ0QdvZAFcIu0UInldx8Il/FvxoVUqJ26tCyTAzW /4zITFpsC2z0lsEL+S4366M44q4Zjjce1w0LwYvjTp5JTz0XVodv7FMBfvuF/x0wssoI x79BZnq8NUevRCa7JslqR4u0Tacceu27Z1nSxLgvmSeByvxAmEXEqGpbMU2kIVvWH5W+ W2xdd8pAp99dm2YlLSz8KRGot+UHqo0SuYHAb1EMT1nAzrbjt1z7hHSmRz7tXhn3CDzP A45Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=Eo1izMgZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m14-20020a056402510e00b0045dc25bb7easi18566909edd.555.2022.10.23.03.27.52; Sun, 23 Oct 2022 03:28:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=Eo1izMgZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230252AbiJWJyI (ORCPT + 99 others); Sun, 23 Oct 2022 05:54:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52018 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230210AbiJWJyD (ORCPT ); Sun, 23 Oct 2022 05:54:03 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90BA7760D4 for ; Sun, 23 Oct 2022 02:53:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518556; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fH7g4YysWMLgOSNDG15jV52CUiW7mUEZ75bQsRILO7Y=; b=Eo1izMgZo0Frd07iuiRf9vf0fPXjQWEKqIe+2Bb8/l1BPw7uYGD6XuUOmArqH5H2tabJWa uw/WwGE6sqa2b04ScoqkO0g6adnTgivFJn62wERiV03dp5Q6uXsq4yEprv0pRue1F6jXZX HKP/0H4faJWhV237ysdVPljtKQ0IC54= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 22/28] mfd: motorola-cpcap: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:46 +0100 Message-Id: <20221023094852.8035-23-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747473814563166397?= X-GMAIL-MSGID: =?utf-8?q?1747473814563166397?= Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- drivers/mfd/motorola-cpcap.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/motorola-cpcap.c b/drivers/mfd/motorola-cpcap.c index 265464b5d7cc..ae8930eff72d 100644 --- a/drivers/mfd/motorola-cpcap.c +++ b/drivers/mfd/motorola-cpcap.c @@ -221,7 +221,6 @@ static const struct regmap_config cpcap_regmap_config = { .val_format_endian = REGMAP_ENDIAN_LITTLE, }; -#ifdef CONFIG_PM_SLEEP static int cpcap_suspend(struct device *dev) { struct spi_device *spi = to_spi_device(dev); @@ -239,9 +238,8 @@ static int cpcap_resume(struct device *dev) return 0; } -#endif -static SIMPLE_DEV_PM_OPS(cpcap_pm, cpcap_suspend, cpcap_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(cpcap_pm, cpcap_suspend, cpcap_resume); static const struct mfd_cell cpcap_mfd_devices[] = { { @@ -346,7 +344,7 @@ static struct spi_driver cpcap_driver = { .driver = { .name = "cpcap-core", .of_match_table = cpcap_of_match, - .pm = &cpcap_pm, + .pm = pm_sleep_ptr(&cpcap_pm), }, .probe = cpcap_probe, .id_table = cpcap_spi_ids, From patchwork Sun Oct 23 09:48:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 7990 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1561497wrr; Sun, 23 Oct 2022 03:41:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6sVTRB6PNTe/mGnFYpb5oEjv1HvPDjJNt0+lv3/WCvf0btuhpS8Ib7KXZKj4tOxCSm4NWN X-Received: by 2002:a65:5a0b:0:b0:46b:158e:ad7c with SMTP id y11-20020a655a0b000000b0046b158ead7cmr24193145pgs.272.1666521713824; Sun, 23 Oct 2022 03:41:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666521713; cv=none; d=google.com; s=arc-20160816; b=fk8BGapdHdACaKTqoqKQUunKm/VfKmwX+WQ8pBYBXDGdDHxL/KUzPwk+llt/n6tTIg IhHXLPRbbLKleaPeohAvn8LuNzaAFsPRgSjg2HjFQwGoahlQMAA+APSpH9t4w8TvheZF 19QIddhMH/p7zXv1o36YGRhL7S5Z3HOE0qoH2NizJmdzQMdxaRXd2MbiGZ+WbVwy+Z/E lP4BH7G56Wuks1lYJegi6zYV5/UouK0niiEgc+9CsACTMxnHFKROqFPuM+sCitFndX0n +4p8t7veuN+7acG+2q7mdglbqINFuiXBjmqm3iQbNS/JbnVisrsooWAXngNxEx/y3GrZ 3oDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HDKUPQO6lE4XXrIyfPTsCACfjenryJXx0aNwhM3B1z8=; b=GMu+eziBNJ8TnXvCHjtovR/VCmcWnRxH3KgXOlWZdoHSTd3r/b4eFjf7XrVRe6o8tP +EL8GuyI3ObAP7v/MgWXf0eynZiC5yYVXKjCM4UT4gqR+yBlLfG04O4aI7vQkorSMh5N tSTzCChLm2VA/R0dGhdARkKL0/oet+zoScymlnt2LzXft/FbF3AObXsRYIii2COpvMzY T+f46fn7flbLHPNmZgPvXTE3+TiIKqTFFLmb/zj2iGmoszbvuZ+8uMPB0HY1xFG7VH0H iP626WYih4VGcrawdpc8j7OIrJuL5Vdg6gbRpbnPsk9zh5s/P+WWeiLvlXrXjphHXthQ AbvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=emy0dHpK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q19-20020a170902bd9300b0018694bb16cbsi2991257pls.569.2022.10.23.03.41.38; Sun, 23 Oct 2022 03:41:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=emy0dHpK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230271AbiJWJyV (ORCPT + 99 others); Sun, 23 Oct 2022 05:54:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230239AbiJWJyT (ORCPT ); Sun, 23 Oct 2022 05:54:19 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B35D076476 for ; Sun, 23 Oct 2022 02:54:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518557; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HDKUPQO6lE4XXrIyfPTsCACfjenryJXx0aNwhM3B1z8=; b=emy0dHpKCzzzV2d6eN5XL6pMwMOKRnbcF8B3DF48yPGB6RCBT0lAakFC2M8DNlRdHfd3z4 oZ+NsY6Jpo7DKT3HBJ7u6gLpoN0pYpTTyQfCi/5UyMnrTXjRS5skq4mfk1FONrpU/s5jE1 eU0DSuAO0RkZCs7DzJ2ohbT04udgHbc= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Orson Zhai , Baolin Wang , Chunyan Zhang Subject: [PATCH v3 23/28] mfd: sprd-sc27xx: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:47 +0100 Message-Id: <20221023094852.8035-24-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747474672740221297?= X-GMAIL-MSGID: =?utf-8?q?1747474672740221297?= Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- Cc: Orson Zhai Cc: Baolin Wang Cc: Chunyan Zhang drivers/mfd/sprd-sc27xx-spi.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/sprd-sc27xx-spi.c b/drivers/mfd/sprd-sc27xx-spi.c index d05a47c5187f..ea68d73e5d1c 100644 --- a/drivers/mfd/sprd-sc27xx-spi.c +++ b/drivers/mfd/sprd-sc27xx-spi.c @@ -215,7 +215,6 @@ static int sprd_pmic_probe(struct spi_device *spi) return 0; } -#ifdef CONFIG_PM_SLEEP static int sprd_pmic_suspend(struct device *dev) { struct sprd_pmic *ddata = dev_get_drvdata(dev); @@ -235,9 +234,9 @@ static int sprd_pmic_resume(struct device *dev) return 0; } -#endif -static SIMPLE_DEV_PM_OPS(sprd_pmic_pm_ops, sprd_pmic_suspend, sprd_pmic_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(sprd_pmic_pm_ops, + sprd_pmic_suspend, sprd_pmic_resume); static const struct of_device_id sprd_pmic_match[] = { { .compatible = "sprd,sc2730", .data = &sc2730_data }, @@ -257,7 +256,7 @@ static struct spi_driver sprd_pmic_driver = { .driver = { .name = "sc27xx-pmic", .of_match_table = sprd_pmic_match, - .pm = &sprd_pmic_pm_ops, + .pm = pm_sleep_ptr(&sprd_pmic_pm_ops), }, .probe = sprd_pmic_probe, .id_table = sprd_pmic_spi_ids, From patchwork Sun Oct 23 09:48:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 7989 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1560662wrr; Sun, 23 Oct 2022 03:38:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6q/zu26XEom6KnFOb+6k0EvOeO3NiNXJHUZmlfIUfM93n62Eu+Ov/k6bFyKPF6Y9qDzkiv X-Received: by 2002:a17:907:97c7:b0:7a5:ad82:f31c with SMTP id js7-20020a17090797c700b007a5ad82f31cmr1815581ejc.497.1666521504155; Sun, 23 Oct 2022 03:38:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666521504; cv=none; d=google.com; s=arc-20160816; b=l1/5Juo81Nd7r2SxwLuPPLdMP9sJCysj8k+h3XZPj+sSCAFk7liOUyh2hFFbLJ6NAo SiOtAPzUyXT0GZGZiGvPPggCUEPEUBU2JtkQ/fHgLor3GAdgUs3frL6iP44lN9eVuI2c 7PUPFS1Kx/wEgJ7I4JNENPiLREoM2aJ34O9jy8aNvjGYNOy1g5dEzTt8M0CXVZ4qY7iw TDxO5NnV2ho5sOo9d16fAR+qkup5IUo7+rtkx0F5Lb9IC63753fKOdAw1p3FE6mCw+RZ Vu0A57ADMxn0fQZ8ltVnYXt/QyteZLyTmHQDd7tJhRx3RL56vKCB6ESFwR7Bmlxkng7P LJdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rf+V8WTFZDSAN+5ckAKYlLWjlRnrCdeSS0nl0u+Vh8Q=; b=SP3BTkMwxuUbVT0lU9vV+STMFt5/joEvnOoMyURINNC4s1oA1u29vokPPlx81yplFv atNaRbZQuAXy1rnJhhX6HragUf0395pzZM50s4noGY94+YDnPpHauT+0UpdHHrgG64AY j1RQSdleRtodqvnbog5rTXm3H8Iae0NZIMPlHIdBNoAtgUjFNRLrqQn1+T3B5i8jhT6o rrJRIOJc1dsUdHwMU6QLkGXT5xZpaigdbAapehYJ/b7hdtT6wWk/oVCKh/CG8ZxE59Ag 1oQsxUvCAhA1ZbswAfZPY+L1XU/RRUq2pdXSbpo/Lugminxg9SEJlU/tD0Eeck0bGaF2 4iXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=dBj76baE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m14-20020a056402510e00b0045dc25bb7easi18566909edd.555.2022.10.23.03.38.01; Sun, 23 Oct 2022 03:38:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=dBj76baE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230218AbiJWJyp (ORCPT + 99 others); Sun, 23 Oct 2022 05:54:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230287AbiJWJyl (ORCPT ); Sun, 23 Oct 2022 05:54:41 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22409318 for ; Sun, 23 Oct 2022 02:54:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518557; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rf+V8WTFZDSAN+5ckAKYlLWjlRnrCdeSS0nl0u+Vh8Q=; b=dBj76baEE4f6P4L0pHYValJKIB5hlDqZDhP/pphi/81ZB1nbB3FxGzocUaMiHRga9OzRWG fhfVfhE+EQV/2WZMJ956KovllsLWcMhx3eSOLeZ5QU4+d3bJw2N+7WjRnI5S1rv+JsZYLV 4URyf6DLKZYGgMCKP4e29Kj0BdGI0zs= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Maxime Coquelin , Alexandre Torgue , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 24/28] mfd: stmfx: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:48 +0100 Message-Id: <20221023094852.8035-25-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747474452693259293?= X-GMAIL-MSGID: =?utf-8?q?1747474452693259293?= Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- V2: remove CONFIG_PM wrapper around fields in private struct V3: No change Cc: Maxime Coquelin Cc: Alexandre Torgue Cc: linux-stm32@st-md-mailman.stormreply.com Cc: linux-arm-kernel@lists.infradead.org drivers/mfd/stmfx.c | 6 ++---- include/linux/mfd/stmfx.h | 2 -- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/mfd/stmfx.c b/drivers/mfd/stmfx.c index 122f96094410..94af27346669 100644 --- a/drivers/mfd/stmfx.c +++ b/drivers/mfd/stmfx.c @@ -476,7 +476,6 @@ static int stmfx_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM_SLEEP static int stmfx_suspend(struct device *dev) { struct stmfx *stmfx = dev_get_drvdata(dev); @@ -542,9 +541,8 @@ static int stmfx_resume(struct device *dev) return 0; } -#endif -static SIMPLE_DEV_PM_OPS(stmfx_dev_pm_ops, stmfx_suspend, stmfx_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(stmfx_dev_pm_ops, stmfx_suspend, stmfx_resume); static const struct of_device_id stmfx_of_match[] = { { .compatible = "st,stmfx-0300", }, @@ -556,7 +554,7 @@ static struct i2c_driver stmfx_driver = { .driver = { .name = "stmfx-core", .of_match_table = stmfx_of_match, - .pm = &stmfx_dev_pm_ops, + .pm = pm_sleep_ptr(&stmfx_dev_pm_ops), }, .probe = stmfx_probe, .remove = stmfx_remove, diff --git a/include/linux/mfd/stmfx.h b/include/linux/mfd/stmfx.h index 744dce63946e..967a2e486800 100644 --- a/include/linux/mfd/stmfx.h +++ b/include/linux/mfd/stmfx.h @@ -113,10 +113,8 @@ struct stmfx { struct irq_domain *irq_domain; struct mutex lock; /* IRQ bus lock */ u8 irq_src; -#ifdef CONFIG_PM u8 bkp_sysctrl; u8 bkp_irqoutpin; -#endif }; int stmfx_function_enable(struct stmfx *stmfx, u32 func); From patchwork Sun Oct 23 09:48:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 7986 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1558409wrr; Sun, 23 Oct 2022 03:30:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM74POre+Oqlf/cEWeGz0jUvz8sGzZIsNDe/li4TuX3guAWU2r70E976RPKMo2NVnkL2UKaW X-Received: by 2002:a17:907:3f8f:b0:78d:f741:7f5a with SMTP id hr15-20020a1709073f8f00b0078df7417f5amr23040852ejc.71.1666521003668; Sun, 23 Oct 2022 03:30:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666521003; cv=none; d=google.com; s=arc-20160816; b=HPyN/XxqrDdSpLALVs5E7op/ivj1I/4yhIaioL7L1dbDagavnrb0/1GsFTnwQDQPaX C/RB+To4JKHfeR1A8W5IzOqDdmLOC9IA91S3sr1wxuy+thWv/GDhYY/R6EKSq+RV0wff jw/AJB8wPj9VmGEe77Ml+Hs7pzjXChlErG1eBFKnfdni186QPKxBvfOnd+oxZ87syuJl ksxS4QA0FLLoYY9hF3wByoNo05wfjHtvcBOSJLk0EnD5/3upRXUoblnsHPLW6KTk+dzO eV62Atmtg8xjrUP3+g9jV5aFVd0UwZOJAAq4VLg/5UVoZeQen3g8LuRe4EwYns1kqS8r vuEQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=YSXFtUMP2239U1R0Zna0E84HFug4CfOI1c/yuHZa1WY=; b=jDHtVsK7BrN5gjx+V5nWDN6YNKwd82QK7YMC6jprLqrJmCU9xe7FJhLxoJjFji3xjT mg4bX5PgSTIrsR587bgSbJADXq0nkQeY60rgUhU1vBfZK7cJFG6oUqxeo+YX46gac3NF 83GwvCrE/9lnkjsGeVZ4cf7okp2j1/Te0rd6+7FebHhmGellsaZb+iYfag0ju8QxpHsN dVqt7PPnJ+EmXbMNrHzHAYV3KMTOYejxFLcgg8242yb0e7kAdhuSfCYMC3KxH4U5/G7K wAUpLrh5fcC8OmxOf3UgCJgApAQ7zU+Ne9jCcK6kMM70NIrzarUrTToChtrGIl8Ox6JA szQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=QOwuLGTh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m22-20020aa7c2d6000000b0044e9fd71b82si21357440edp.280.2022.10.23.03.29.39; Sun, 23 Oct 2022 03:30:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=QOwuLGTh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230312AbiJWJzK (ORCPT + 99 others); Sun, 23 Oct 2022 05:55:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230316AbiJWJy6 (ORCPT ); Sun, 23 Oct 2022 05:54:58 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B3D022516 for ; Sun, 23 Oct 2022 02:54:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518558; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YSXFtUMP2239U1R0Zna0E84HFug4CfOI1c/yuHZa1WY=; b=QOwuLGThnniJS2rm7pVt7LxJYscZhBKEE7Tv34kOWnFNg4Qiz4BxDRIvnRFQJWm4Vjeave jRY7bIDtV1wqowQozXM0Zt9yfBDxihcCiPy9yhGzUSrj76q0r6YVLc1XMtj/Hs3oaYI4+C Oqz7GOeo7RU3/xKrtYb7ogh96xfqmGA= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Maxime Coquelin , Alexandre Torgue , linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 25/28] mfd: stmpe: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:49 +0100 Message-Id: <20221023094852.8035-26-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747473928289798533?= X-GMAIL-MSGID: =?utf-8?q?1747473928289798533?= Use the new EXPORT_GPL_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- V2: remove duplicated "const". Cc: Maxime Coquelin Cc: Alexandre Torgue Cc: linux-stm32@st-md-mailman.stormreply.com Cc: linux-arm-kernel@lists.infradead.org drivers/mfd/stmpe-i2c.c | 4 +--- drivers/mfd/stmpe-spi.c | 4 +--- drivers/mfd/stmpe.c | 8 ++------ 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/mfd/stmpe-i2c.c b/drivers/mfd/stmpe-i2c.c index d3eedf3d607e..bf094cc9f9de 100644 --- a/drivers/mfd/stmpe-i2c.c +++ b/drivers/mfd/stmpe-i2c.c @@ -116,9 +116,7 @@ MODULE_DEVICE_TABLE(i2c, stmpe_i2c_id); static struct i2c_driver stmpe_i2c_driver = { .driver = { .name = "stmpe-i2c", -#ifdef CONFIG_PM - .pm = &stmpe_dev_pm_ops, -#endif + .pm = pm_sleep_ptr(&stmpe_dev_pm_ops), .of_match_table = stmpe_of_match, }, .probe = stmpe_i2c_probe, diff --git a/drivers/mfd/stmpe-spi.c b/drivers/mfd/stmpe-spi.c index ad8055a0e286..e9cbf33502b3 100644 --- a/drivers/mfd/stmpe-spi.c +++ b/drivers/mfd/stmpe-spi.c @@ -135,9 +135,7 @@ static struct spi_driver stmpe_spi_driver = { .driver = { .name = "stmpe-spi", .of_match_table = of_match_ptr(stmpe_spi_of_match), -#ifdef CONFIG_PM - .pm = &stmpe_dev_pm_ops, -#endif + .pm = pm_sleep_ptr(&stmpe_dev_pm_ops), }, .probe = stmpe_spi_probe, .remove = stmpe_spi_remove, diff --git a/drivers/mfd/stmpe.c b/drivers/mfd/stmpe.c index 0c4f74197d3e..c304d20bb988 100644 --- a/drivers/mfd/stmpe.c +++ b/drivers/mfd/stmpe.c @@ -1495,7 +1495,6 @@ void stmpe_remove(struct stmpe *stmpe) mfd_remove_devices(stmpe->dev); } -#ifdef CONFIG_PM static int stmpe_suspend(struct device *dev) { struct stmpe *stmpe = dev_get_drvdata(dev); @@ -1516,8 +1515,5 @@ static int stmpe_resume(struct device *dev) return 0; } -const struct dev_pm_ops stmpe_dev_pm_ops = { - .suspend = stmpe_suspend, - .resume = stmpe_resume, -}; -#endif +EXPORT_GPL_SIMPLE_DEV_PM_OPS(stmpe_dev_pm_ops, + stmpe_suspend, stmpe_resume); From patchwork Sun Oct 23 09:48:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 7994 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1564142wrr; Sun, 23 Oct 2022 03:53:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5mcib7PeIpmKqVlG8XKjgRwI/1q7gY0tK4tFGPng6CaAkSNTnlhLJiZ/5SCuxpX5v+GeEg X-Received: by 2002:a63:e544:0:b0:462:2c80:f521 with SMTP id z4-20020a63e544000000b004622c80f521mr22612183pgj.549.1666522385203; Sun, 23 Oct 2022 03:53:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666522385; cv=none; d=google.com; s=arc-20160816; b=B23YiQ0/IPdrmEDK+nieObho5ZfblBYhNkPhHjZqBI6vIF2qEvq/qzf9pRRteArwVC imfo1iZ7S3JBOv4GGdnNPMptd0VBCj6ooOEfr1kb3bcyQ+UEBFeguBD4E+XNb56sZNhx 7CNUtkozYHFCzLdwi0DYHfkpntNBP3aMGxSO9MkRobGOlMF/giUSf82f2OoNdZvwHnwD 2TM1iod/eqFVOAItkiJ2PULstIYt0AUIsSKEWlsJ4myocM0kv+XNoP5DyTnjGqkYj30v e7TUcIEojGLDMXa4X1sOEkIIu0FKrK6Usk8ZOZ8btuv3rCvUJbNFR8THIXKNvyXDcqr0 DiQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/fNX/ttuDiI3uxQdqB3fB+Ou1WPOijArfObsH7/WKDQ=; b=H7ZPCDpLlcqIwpKihEDc4SUlTJup2B+rKS9HTJVA13NG3ItbYGtCl4q8LCjHkECeyj /ZKJv+TyFWX6TZ/bAHgqCYP2gOTU+1Mv4d7391o8HT4oDGk3Idf6H8H/wXAg8vYZrzQj KwPc8aA1zeOXAC8zy/tEYh65mkBiDkPRxHT4C4/lGoHlMATmMuRNA/52pwGE8o6/ixJn 29F4BBnPeNhR5Wu5col8uB48EZudyDt/IQS6/MiKN3jCmKMdbxSq4hl0GjxucOKWbZJS e+DGuU/TwAOWGoLFK8IAZv3Mgio2Rk/3xK5FsIAYXKQU/rEbAJm1Uh6UM/JnEGLOhi8s yVmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=wCCE0tHv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u8-20020a654c08000000b0043c64130f17si31717494pgq.107.2022.10.23.03.52.51; Sun, 23 Oct 2022 03:53:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=wCCE0tHv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230327AbiJWJzS (ORCPT + 99 others); Sun, 23 Oct 2022 05:55:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230287AbiJWJzC (ORCPT ); Sun, 23 Oct 2022 05:55:02 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1491A64C7 for ; Sun, 23 Oct 2022 02:54:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518559; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/fNX/ttuDiI3uxQdqB3fB+Ou1WPOijArfObsH7/WKDQ=; b=wCCE0tHv8/OT2rcRBgCsOIsb3437XkIhFuiBPr9YpJrNSDMXXA6oO9VyoWbMBqyvqJWa+e hnE2TDg7GEmZw8xjJ4JmnZt19h7hj/VfXzqA4PIXll3DGb92Z3rdV+HNVACGJEQ6Vx3r5+ exZQ3XfFRab1Lt3oJtvaZMq8QTICq68= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 26/28] mfd: tc3589x: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:50 +0100 Message-Id: <20221023094852.8035-27-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747475376610955281?= X-GMAIL-MSGID: =?utf-8?q?1747475376610955281?= Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- drivers/mfd/tc3589x.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/mfd/tc3589x.c b/drivers/mfd/tc3589x.c index 13583cdb93b6..ab7e0f6f5489 100644 --- a/drivers/mfd/tc3589x.c +++ b/drivers/mfd/tc3589x.c @@ -438,7 +438,6 @@ static int tc3589x_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM_SLEEP static int tc3589x_suspend(struct device *dev) { struct tc3589x *tc3589x = dev_get_drvdata(dev); @@ -466,9 +465,9 @@ static int tc3589x_resume(struct device *dev) return ret; } -#endif -static SIMPLE_DEV_PM_OPS(tc3589x_dev_pm_ops, tc3589x_suspend, tc3589x_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(tc3589x_dev_pm_ops, + tc3589x_suspend, tc3589x_resume); static const struct i2c_device_id tc3589x_id[] = { { "tc35890", TC3589X_TC35890 }, @@ -485,7 +484,7 @@ MODULE_DEVICE_TABLE(i2c, tc3589x_id); static struct i2c_driver tc3589x_driver = { .driver = { .name = "tc3589x", - .pm = &tc3589x_dev_pm_ops, + .pm = pm_sleep_ptr(&tc3589x_dev_pm_ops), .of_match_table = of_match_ptr(tc3589x_match), }, .probe = tc3589x_probe, From patchwork Sun Oct 23 09:48:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 7985 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1558239wrr; Sun, 23 Oct 2022 03:29:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4V+mbLtlnR1hwK3iTqkj/l9gkjyUa4JzeODDxBogxOSXP6siKFoGYYOQn5ld1WNk+9Hk9L X-Received: by 2002:a17:906:eec7:b0:733:189f:b07a with SMTP id wu7-20020a170906eec700b00733189fb07amr23396327ejb.230.1666520971176; Sun, 23 Oct 2022 03:29:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666520971; cv=none; d=google.com; s=arc-20160816; b=mzWuDXZNdLfJQwz0osAfl2OD1wvTeMxMARbpd6qnY0eOJnMWT+ZoHaovoFsWI7ipdv 4G65dF68AGwrjAPzKTJlA1FDlGMibex/bhTTnEuprXHAncBEgRNnsnN9lADQehTIK2B1 Iqmql5amNVnsDfEP0TB2S1UqKbYdvf/8M3+f+qOqZNB2keRmtwPie7IrX5F6Y5/Ms4Pg XRt6lGD/YHn8SWoVGGJH3Re/fLpGFAATyB1IyfoxlRyLUYzQasTfcj91vvG9Ax7q7r5q mAtuyeW5E9OAOvy1TxeTPY3ipOVBpkX5Ga0780AxXDoapJKqSPuNC0kGHGFYkBhNhw/u Ku4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FKwp4R0sM21Ivi8navoOTJy75R51wyGPAcCybh3hh04=; b=CwX+fgzGiFAP7kmWEx3+wijRWByuPlG/nI4WrsHjMEHWJk1gWBfEwcJTTfTX7yGW7I 3WMWspEJrfVs5htrolsf0ex2ITu5/hFn743DkWMhyot3+t1bUo37D7h3oSwTHTkvyD/b H3MxYW94rQie26GvRAXA3F2ONnIvqGhqFEoFZC2eKE6+Jca24l0LErx6Ecohs0lfwQBq Gxz6qVYfhf/U88mfIQeZqWL5XtA7IGHqXPiFFX3hnh9qYsjkePFLZvfwjUp8O4c27/BJ mycxNz6e4h+5qfaufc2KdFX937SfK+lxG56hBLMvpDUqZ71GWFdg2mFfH8AhJnWWxZrh 9aEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=lqSw4wxf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n8-20020a05640205c800b004585e0f44fesi29149184edx.60.2022.10.23.03.29.06; Sun, 23 Oct 2022 03:29:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=lqSw4wxf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230317AbiJWJzm (ORCPT + 99 others); Sun, 23 Oct 2022 05:55:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230308AbiJWJzI (ORCPT ); Sun, 23 Oct 2022 05:55:08 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7863931EFF for ; Sun, 23 Oct 2022 02:55:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518559; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FKwp4R0sM21Ivi8navoOTJy75R51wyGPAcCybh3hh04=; b=lqSw4wxfbDVH/WSNC7MHZ2lbxkvreN4X8JVR+2SW39jHRtx3syR+/ZfcjjgpzZViqWyNrV LYVRYIqXS3oRKf7OdAxD8dI3q7L1kXI1SDAtFzQB/y/Q5PdQ1mnMa1BSFfMwRo1QHPd8z7 Et6ahhV6CTUWuhmbDXKLANHKt6DlQ/s= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 27/28] mfd: tc6393xb: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:51 +0100 Message-Id: <20221023094852.8035-28-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747473893928713200?= X-GMAIL-MSGID: =?utf-8?q?1747473893928713200?= Use the new pm_sleep_ptr() macro to handle the .suspend/.resume callbacks. This macro allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil --- drivers/mfd/tc6393xb.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c index aa903a31dd43..997bb8b5881d 100644 --- a/drivers/mfd/tc6393xb.c +++ b/drivers/mfd/tc6393xb.c @@ -813,7 +813,6 @@ static int tc6393xb_remove(struct platform_device *dev) return 0; } -#ifdef CONFIG_PM static int tc6393xb_suspend(struct platform_device *dev, pm_message_t state) { struct tc6393xb_platform_data *tcpd = dev_get_platdata(&dev->dev); @@ -876,16 +875,12 @@ static int tc6393xb_resume(struct platform_device *dev) return 0; } -#else -#define tc6393xb_suspend NULL -#define tc6393xb_resume NULL -#endif static struct platform_driver tc6393xb_driver = { .probe = tc6393xb_probe, .remove = tc6393xb_remove, - .suspend = tc6393xb_suspend, - .resume = tc6393xb_resume, + .suspend = pm_sleep_ptr(tc6393xb_suspend), + .resume = pm_sleep_ptr(tc6393xb_resume), .driver = { .name = "tc6393xb", From patchwork Sun Oct 23 09:48:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 7987 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1559914wrr; Sun, 23 Oct 2022 03:35:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4XSvmViZipUA/509OWDO4C+fVi6LWfjxl8QUqM09viNlTHRL95luDbt0o+SO0moQilU9N5 X-Received: by 2002:a05:6402:448b:b0:43b:5ec6:8863 with SMTP id er11-20020a056402448b00b0043b5ec68863mr25471882edb.377.1666521333298; Sun, 23 Oct 2022 03:35:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666521333; cv=none; d=google.com; s=arc-20160816; b=ZPsZgykDjIF6hxHItWgIqz5kiQCmpDfENazqCWmuldU6cYvmt9iGPo5O1yEdi3Yzvz HSzKfsGgvFHkHocclNG48uarL3Sk3Ubrqt4YgMy3X6j4mBNqjJYwRnUgqwli6lyYzofk 67h4+Nz/nDqQKt4zIEgRZkQ9Sh2H7dEeZ+iljNrg9bF2Tb5kbeP/LkUGGwHc3kSGRR7S tmPdEsMTzdhgHg5duKWXQbDlLESMMQD3goxX9w0RUm7K9LWftjqfU3jNtl/18/zBEWFq j1+UKpEn4qYUiQsVDTbp1TdBKNtv6y5T+EfbkbG9NbU2okToVYJv0TSEv+HDvzr98k6E k9fA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TEQXKhpmuv4knhdIiLWQdn8XmCoEHRrn4b2xDe3I7q8=; b=PI40RPW9HZ4RlMmeoTVbTcB5XgpOz5OBEFGH36y1DH+5tF8cq0rZtjcvMHbPu+hkcN XoPnAINC4lPcgI5+yeX/g3oXuTPnaVmQ2p2XRzCExZey6TKlw+84BWqPLDUYm1NrBy70 fAG2aKHGAWlB9s1tLZKwFxSNLRk1xthCsFYGaisCv5ne5uJ/Og4zwntLPK0ptyY83tZ1 nq4oKBcFbQzgG5cuEG9/ac+IBFqwvlJmDERxlrfEqSJ7NGEqlPVMc+xNRsFKM8I9Hq+6 wOYSaUSDx0jXobZ/qAtS5ZSUc7EIwU8efU3pRxXSix6iNTgyYdvBQ2h4oAqNRBFzXzF4 i85A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=vHksYpqY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m14-20020a056402510e00b0045dc25bb7easi18566909edd.555.2022.10.23.03.35.08; Sun, 23 Oct 2022 03:35:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=vHksYpqY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230358AbiJWJzz (ORCPT + 99 others); Sun, 23 Oct 2022 05:55:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230337AbiJWJzX (ORCPT ); Sun, 23 Oct 2022 05:55:23 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 944813EA77 for ; Sun, 23 Oct 2022 02:55:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518560; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TEQXKhpmuv4knhdIiLWQdn8XmCoEHRrn4b2xDe3I7q8=; b=vHksYpqY8Bg/aEpy6dWj761UxdGO2zSMJvI6genf6oow2CSnAucZx1N2i4ozanyrmB1f9j l3LDPVkiV9CvPlw+E/Sk0BUPEC0jT1tB9qFj3k2U4MgmxXCn2/Aa4U63pNrsimr1PGQuOX WMYU9iS/OH2TjkJSmkVvJRts/n+r1Co= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v3 28/28] mfd: intel-lpss: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:52 +0100 Message-Id: <20221023094852.8035-29-paul@crapouillou.net> In-Reply-To: <20221023094852.8035-1-paul@crapouillou.net> References: <20221023094852.8035-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747474273988220985?= X-GMAIL-MSGID: =?utf-8?q?1747474273988220985?= Use the new EXPORT_GPL_DEV_PM_OPS() and pm_sleep_ptr() / pm_ptr() macros to handle the PM callbacks. These macros allow the PM functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Note that instead of exporting two dev_pm_ops structures containing the exact same data, one in intel-lpss-acpi.c and one in intel-lpss-pci.c, we export one single dev_pm_ops structure from intel-lpss.c using the EXPORT_GP_DEV_PM_OPS() macro, which is then referenced from the -acpi.c and -pci.c files. Signed-off-by: Paul Cercueil --- drivers/mfd/intel-lpss-acpi.c | 4 +--- drivers/mfd/intel-lpss-pci.c | 2 +- drivers/mfd/intel-lpss.c | 15 +++++++++------ drivers/mfd/intel-lpss.h | 28 +--------------------------- 4 files changed, 12 insertions(+), 37 deletions(-) diff --git a/drivers/mfd/intel-lpss-acpi.c b/drivers/mfd/intel-lpss-acpi.c index a143c8dca2d9..1d46a7aa1c61 100644 --- a/drivers/mfd/intel-lpss-acpi.c +++ b/drivers/mfd/intel-lpss-acpi.c @@ -203,15 +203,13 @@ static int intel_lpss_acpi_remove(struct platform_device *pdev) return 0; } -static INTEL_LPSS_PM_OPS(intel_lpss_acpi_pm_ops); - static struct platform_driver intel_lpss_acpi_driver = { .probe = intel_lpss_acpi_probe, .remove = intel_lpss_acpi_remove, .driver = { .name = "intel-lpss", .acpi_match_table = intel_lpss_acpi_ids, - .pm = &intel_lpss_acpi_pm_ops, + .pm = pm_ptr(&intel_lpss_pm_ops), }, }; diff --git a/drivers/mfd/intel-lpss-pci.c b/drivers/mfd/intel-lpss-pci.c index dde31c50a632..28f4d3a5aae3 100644 --- a/drivers/mfd/intel-lpss-pci.c +++ b/drivers/mfd/intel-lpss-pci.c @@ -556,7 +556,7 @@ static struct pci_driver intel_lpss_pci_driver = { .probe = intel_lpss_pci_probe, .remove = intel_lpss_pci_remove, .driver = { - .pm = &intel_lpss_pci_pm_ops, + .pm = pm_ptr(&intel_lpss_pm_ops), }, }; diff --git a/drivers/mfd/intel-lpss.c b/drivers/mfd/intel-lpss.c index cfbee2cfba6b..9cdd0b52f8d8 100644 --- a/drivers/mfd/intel-lpss.c +++ b/drivers/mfd/intel-lpss.c @@ -468,7 +468,7 @@ static int resume_lpss_device(struct device *dev, void *data) return 0; } -int intel_lpss_prepare(struct device *dev) +static int intel_lpss_prepare(struct device *dev) { /* * Resume both child devices before entering system sleep. This @@ -477,9 +477,8 @@ int intel_lpss_prepare(struct device *dev) device_for_each_child_reverse(dev, NULL, resume_lpss_device); return 0; } -EXPORT_SYMBOL_GPL(intel_lpss_prepare); -int intel_lpss_suspend(struct device *dev) +static int intel_lpss_suspend(struct device *dev) { struct intel_lpss *lpss = dev_get_drvdata(dev); unsigned int i; @@ -498,9 +497,8 @@ int intel_lpss_suspend(struct device *dev) return 0; } -EXPORT_SYMBOL_GPL(intel_lpss_suspend); -int intel_lpss_resume(struct device *dev) +static int intel_lpss_resume(struct device *dev) { struct intel_lpss *lpss = dev_get_drvdata(dev); unsigned int i; @@ -513,7 +511,12 @@ int intel_lpss_resume(struct device *dev) return 0; } -EXPORT_SYMBOL_GPL(intel_lpss_resume); + +EXPORT_GPL_DEV_PM_OPS(intel_lpss_pm_ops) = { + .prepare = pm_sleep_ptr(intel_lpss_prepare), + LATE_SYSTEM_SLEEP_PM_OPS(intel_lpss_suspend, intel_lpss_resume) + RUNTIME_PM_OPS(intel_lpss_suspend, intel_lpss_resume, NULL) +}; static int __init intel_lpss_init(void) { diff --git a/drivers/mfd/intel-lpss.h b/drivers/mfd/intel-lpss.h index 062ce95b68b9..c1d72b117ed5 100644 --- a/drivers/mfd/intel-lpss.h +++ b/drivers/mfd/intel-lpss.h @@ -30,32 +30,6 @@ int intel_lpss_probe(struct device *dev, const struct intel_lpss_platform_info *info); void intel_lpss_remove(struct device *dev); -#ifdef CONFIG_PM -int intel_lpss_prepare(struct device *dev); -int intel_lpss_suspend(struct device *dev); -int intel_lpss_resume(struct device *dev); - -#ifdef CONFIG_PM_SLEEP -#define INTEL_LPSS_SLEEP_PM_OPS \ - .prepare = intel_lpss_prepare, \ - SET_LATE_SYSTEM_SLEEP_PM_OPS(intel_lpss_suspend, intel_lpss_resume) -#else -#define INTEL_LPSS_SLEEP_PM_OPS -#endif - -#define INTEL_LPSS_RUNTIME_PM_OPS \ - .runtime_suspend = intel_lpss_suspend, \ - .runtime_resume = intel_lpss_resume, - -#else /* !CONFIG_PM */ -#define INTEL_LPSS_SLEEP_PM_OPS -#define INTEL_LPSS_RUNTIME_PM_OPS -#endif /* CONFIG_PM */ - -#define INTEL_LPSS_PM_OPS(name) \ -const struct dev_pm_ops name = { \ - INTEL_LPSS_SLEEP_PM_OPS \ - INTEL_LPSS_RUNTIME_PM_OPS \ -} +extern const struct dev_pm_ops intel_lpss_pm_ops; #endif /* __MFD_INTEL_LPSS_H */