Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp5272658rwi; Sun, 23 Oct 2022 03:14:21 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4iEXwY/f4vyizabIs/5aN3aYQsASO/ad2H2Fm58cq+EFshPF1lUn+yMI0cAGI0SNaO7jdD X-Received: by 2002:a17:907:2bcf:b0:79d:e8e6:d579 with SMTP id gv15-20020a1709072bcf00b0079de8e6d579mr8127585ejc.563.1666520061670; Sun, 23 Oct 2022 03:14:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666520061; cv=none; d=google.com; s=arc-20160816; b=G72x0piaiFwnuDw2p72QaBqJUm0z2tYrLex3rPJW9hWPMLC+Hu2lohGXOFfye9rXSG WQ7bDtSULob0W1TRuf7wkRlmpdtRrfnZSAoLNyf1RLmTTCG3eQmp9bcuiaFWFWOmfane klzw6kCAKGNP/1dfszdlgSMzJGE35Nh3yx3pAt5NEzj7ybLG8wnoonIecDuWjns2azCS N8TqzXmrBddxaE01qZ5+lwIsZfs0MJiLLxOdkRq2c59lZMJPRNQf2X3ik68cWfVuI8+n F3ftRcDuNY1EG1maxnwHHbvTWwWWrbSCl0jVPZiWVsuS67oVg51LguGyuQuxsHKWkyQ3 lg+A== 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 Return-Path: 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.13.39; Sun, 23 Oct 2022 03:14:21 -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 Content-Transfer-Encoding: 8bit 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 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, -- 2.35.1