Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp3845419rwb; Sun, 7 Aug 2022 08:33:39 -0700 (PDT) X-Google-Smtp-Source: AA6agR5BJBnLeo2Bso5dZ49l+Z92TMD0aZr0EZ/wC8FVVIGWXIIv/TtkLzjh3XLg2CmcvB8Ud+jJ X-Received: by 2002:a17:907:d15:b0:731:179f:9245 with SMTP id gn21-20020a1709070d1500b00731179f9245mr5651744ejc.626.1659886419561; Sun, 07 Aug 2022 08:33:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659886419; cv=none; d=google.com; s=arc-20160816; b=vmEoc/INmID3Vvn21q+DDHjfDTdCeQbkuG8UP9XYyixC0huf8hqeFvQKpghNT7EEkG YQY2Roa5TOKw3tgejgCX7dRcloaaKBAl6ftV6P8Uv4VgU2MLbW6bX78NWtXYr3r9FmhS F7QReLJudvmagTD2NhzZxCXaYnUQfHzPxeDNuCsoRcTWyF4D/tT1Ax6EHtFwP4cCMA3f cNfrt4pT9QPoazeACM6tIO84O8JdGskRmmKV84yXoqea0iQzJDQxxS8RhBc6uFlVaiCG WL3JMFbGx+w3gUxA9vHf3U2ACGvz+6/t+/OfosmCRSP3h6c7O4N2IoEQpEqlomAWq+sQ wlTQ== 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=Di4PoDiPjRu7ZS4lHptDC2et/AkSYRZJ8WxHWXVd9fk=; b=UcvOrkPt+rB/u579QcRxzyT17u8KFGFTqPqxhUkJPXuA2aOo2cXLS8NCl0Rms8gfCi Yzm6zy/gcDSOPkYgz4EvBhpHpEw2YjZn9PRbysiE9x+tXptBp6YZw4KGiAW3XsYRkhM1 Tb31G3adRA7V+VW6bfufvXxsbZHYUGALZCC1Bb7cY0abmVm5pvG8/tr7Sgw7yiQjGZ25 h37dSngfSilCeTJaYREtIdOfFDakwxJUYkNXUg3OlEbB7jJrmuYXzuzvw7ujVG55uUtG 9c5Xbhmq0+2lqWU2HEjhvuODBwOJeVX2f4x8SBPfzITQ4iwpZD4TPoHplsio/D6Uherv N96Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=M8PDLV+k; 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 i3-20020a1709064fc300b00730951e6030si9137348ejw.188.2022.08.07.08.33.14; Sun, 07 Aug 2022 08:33:39 -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=M8PDLV+k; 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 S234943AbiHGO5Q (ORCPT + 99 others); Sun, 7 Aug 2022 10:57:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234752AbiHGO4n (ORCPT ); Sun, 7 Aug 2022 10:56:43 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29ABC269 for ; Sun, 7 Aug 2022 07:56:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883988; 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=Di4PoDiPjRu7ZS4lHptDC2et/AkSYRZJ8WxHWXVd9fk=; b=M8PDLV+k4PAPs6D79cw8p2rh6Vx4VD2ELyDUhaqSKSWca15BHcIDzzjQ1MaYgg+XEYXWrV iWiVNeRH5E/4zQpjYAJHry4nbXXrkSxuxSKyTLBuDFe6gfzNRjhYRFAgHcIsgOevtlvSX2 hVwdvb9hWNozN9FFcBs+xLCexp2B12g= 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 25/28] mfd: stmfx: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:44 +0200 Message-Id: <20220807145247.46107-26-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 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. 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. Signed-off-by: Paul Cercueil 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 ++---- 1 file changed, 2 insertions(+), 4 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, -- 2.35.1