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,