Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp3846224rwb; Sun, 7 Aug 2022 08:34:40 -0700 (PDT) X-Google-Smtp-Source: AA6agR75snpggTmc50abI1ttJl7GNvmozy0z5Umj89uhWSXVA0nBjRMcSV6QbNfirpiOVt4aBKaQ X-Received: by 2002:a17:906:d54b:b0:72e:ece1:2956 with SMTP id cr11-20020a170906d54b00b0072eece12956mr11283089ejc.156.1659886480343; Sun, 07 Aug 2022 08:34:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659886480; cv=none; d=google.com; s=arc-20160816; b=IupiRFkpvIQVStPtOoZwgCmr3hYN9XkBGcPTy/nU6DVGQlCQRbG4zMZmFiQ4In0T5P xARsHTScDCQnAtISQXkGyveVesbDKvYlxpmGYQ+DQv3Gg2qdOOzpd1cI0bGY0TKCHqLe 0rn7LXPpAnITJN8ix1/VHCBG+iNy1GPX9LxjiCgkNVDSke6H8GuyqF9T13btDRVNqZmu LBXy78sVoL21hqLeZQ7hsYygkCBpxl6J+RD5ut6FWnEs8mkTixbPBl83mfo6Cy29cAch B7eXSGRpHKcDSs+ZIWWYvoyG+9zC0AyNg8SQnKz2Rj189KmGJo6oo2dcH7s7ZY7DZFLG qNvA== 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=ILGkOjBbxQ6/oFH45I21cYP8YppPBAHJarOOSD0Anzg=; b=sGmI921eNfcxs1doDjmCtL4LoOkpKhpReCyFoEo21BonfZaMxRbH63RNdju2PmbTmE QqW9Ieme5GZutc1cECja1psPN0M9QQ7u0IYex7dduj34azK2hFIvKYBMtPi4cPsZZH5c 2Z0Y4QkWJVjd3iZPjxOBDXLNA2e+jM7lbvZldr6z1ebuDfdbfGEabLdSgWYyitrjjh+g FWmhFY1p8CP3GfJ8uwQzcIoZVr1d96jLZ8dKYU+f3cU+aGRjOOzvJg1zga66t7z74lW3 IzRxyVB2iA/TosWtaf6Nou1hLXSpcLjUUn5AtJKCrzEnKpWACbH7IU4KQl3PxTr/HnAl +80A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=Ji1TNYdO; 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 f20-20020a056402355400b0043c2e89d0acsi5202821edd.3.2022.08.07.08.34.15; Sun, 07 Aug 2022 08:34: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=Ji1TNYdO; 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 S234967AbiHGOzu (ORCPT + 99 others); Sun, 7 Aug 2022 10:55:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235011AbiHGOzX (ORCPT ); Sun, 7 Aug 2022 10:55:23 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D1246175 for ; Sun, 7 Aug 2022 07:55:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883986; 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=ILGkOjBbxQ6/oFH45I21cYP8YppPBAHJarOOSD0Anzg=; b=Ji1TNYdO9uNnL434iMBgQ4dfjBePw83p7ofilPXqQDHIk2QLiuxO7nc4TE6PwAXFV2Byv9 XghPAVeetYDznix7FhwviD9hrKvbSIFo7mAgqISjj+xl6YGzsVf/H8VF33MYRo9dlC0CWr asywwHCFzR8/Bq9QtsuuqmP9e2It1fc= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , patches@opensource.cirrus.com Subject: [PATCH 17/28] mfd: wm8994: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:36 +0200 Message-Id: <20220807145247.46107-18-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-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. The advantage is then that these functions are now always compiled independently of any Kconfig option, and thanks to that bugs and regressions are 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