Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp5040324rwb; Mon, 8 Aug 2022 11:03:29 -0700 (PDT) X-Google-Smtp-Source: AA6agR5qUtB/hlW04eHp+YnrKcVVn6DeiVJc7X9XIUL8adq3fz7ZPafBcwoCx1OrT88x3K5tWDpz X-Received: by 2002:a05:6a00:cc7:b0:52f:2ada:11c5 with SMTP id b7-20020a056a000cc700b0052f2ada11c5mr7460820pfv.19.1659981809660; Mon, 08 Aug 2022 11:03:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659981809; cv=none; d=google.com; s=arc-20160816; b=XKlUwLcmAhS9NyKsWcRWiJc27xGIybUoR/FfUVrBOh8dYSMH63ZH1WYTDHnmlhX8dh v4xMzKgIE1bkj/TENlRADZiKPVVRFAJolL7g50jao5BwNypxwq4MV4n375axHA0xS5UQ MMd0WagjyS7xH//avThZZZLwc8TutdZZMfcZQAtMDFflfS9wYQD8dPHV076sY5nklr0z JWVGC/X2IfZ75N05mhdnsT5nTyxMCsP5hyp52uzHEN7bOuCaQ4O/1ToxuPLixjU8BrOF Owwft9sj4miZ6bOLoHYMCjTmHUn2dMx9yP/GO3ejW1jwNzgID97oiQJu2HSrrOvuHkqR 619g== 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=0I+mSneVr477xNU9unTc0UxMGLtgIxgnptmVK+wu/7U=; b=LQbPRbrmNitzUL9EmbROJ9rOJJPqKlb9MBM1Bn5MsddBlzvyOvDYWYMDKBMU/Gndi9 C1skqbDD7fcbR9411zrwtX31lQeOL8WCKXpOBTRsV3soVWEEtWvxjRpnrZABq1vY3jiu k5aGo183NvUh6IKNt6dgEBYASA/5ndKWriosnpV9IUEc+LLkNec6W2SB8/S132I3Vo1A PFndrj43CzppVmYRp34qmutMs+ZbzTcR41trPIKZg5vOuuadlyxBg4/6m9NU+6KKv48J GoN2DX8Ax6aqb2lDbx2LH6CHeKZL/40pIs64+SEKZdfJXcsEQy/Bv4fU6qql93O9TdHv OZwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=NdfhkT4z; 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 q15-20020a170902eb8f00b0016ef1d4c4fbsi11071304plg.320.2022.08.08.11.03.15; Mon, 08 Aug 2022 11:03: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=NdfhkT4z; 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 S244308AbiHHRp0 (ORCPT + 99 others); Mon, 8 Aug 2022 13:45:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243791AbiHHRox (ORCPT ); Mon, 8 Aug 2022 13:44:53 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C86818B0D for ; Mon, 8 Aug 2022 10:44:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659980505; 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=0I+mSneVr477xNU9unTc0UxMGLtgIxgnptmVK+wu/7U=; b=NdfhkT4zPkFoFXPQfeTmdmzC8xHSFC57HtuRxWElV7h2veZRvFgK8Ae3w5xNLlNyDxK1WG aRjoikqMLXSxFWz9PAD/XxzuUx/d7oqKzcaoxDcL33EkSte/p9ICfCEqjQaqm4EdQrniTP rHgUJ9aKHN2ltEpNOI3F+RDCqzNPx0s= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , patches@opensource.cirrus.com Subject: [PATCH v2 18/30] mfd: wm8994: Remove #ifdef guards for PM related functions Date: Mon, 8 Aug 2022 19:40:55 +0200 Message-Id: <20220808174107.38676-19-paul@crapouillou.net> In-Reply-To: <20220808174107.38676-1-paul@crapouillou.net> References: <20220808174107.38676-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, T_SCC_BODY_TEXT_LINE 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 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 --- Cc: patches@opensource.cirrus.com 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, -- 2.35.1