From patchwork Sun Oct 23 09:48:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 7989 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1560662wrr; Sun, 23 Oct 2022 03:38:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6q/zu26XEom6KnFOb+6k0EvOeO3NiNXJHUZmlfIUfM93n62Eu+Ov/k6bFyKPF6Y9qDzkiv X-Received: by 2002:a17:907:97c7:b0:7a5:ad82:f31c with SMTP id js7-20020a17090797c700b007a5ad82f31cmr1815581ejc.497.1666521504155; Sun, 23 Oct 2022 03:38:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666521504; cv=none; d=google.com; s=arc-20160816; b=l1/5Juo81Nd7r2SxwLuPPLdMP9sJCysj8k+h3XZPj+sSCAFk7liOUyh2hFFbLJ6NAo SiOtAPzUyXT0GZGZiGvPPggCUEPEUBU2JtkQ/fHgLor3GAdgUs3frL6iP44lN9eVuI2c 7PUPFS1Kx/wEgJ7I4JNENPiLREoM2aJ34O9jy8aNvjGYNOy1g5dEzTt8M0CXVZ4qY7iw TDxO5NnV2ho5sOo9d16fAR+qkup5IUo7+rtkx0F5Lb9IC63753fKOdAw1p3FE6mCw+RZ Vu0A57ADMxn0fQZ8ltVnYXt/QyteZLyTmHQDd7tJhRx3RL56vKCB6ESFwR7Bmlxkng7P LJdg== 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=rf+V8WTFZDSAN+5ckAKYlLWjlRnrCdeSS0nl0u+Vh8Q=; b=SP3BTkMwxuUbVT0lU9vV+STMFt5/joEvnOoMyURINNC4s1oA1u29vokPPlx81yplFv atNaRbZQuAXy1rnJhhX6HragUf0395pzZM50s4noGY94+YDnPpHauT+0UpdHHrgG64AY j1RQSdleRtodqvnbog5rTXm3H8Iae0NZIMPlHIdBNoAtgUjFNRLrqQn1+T3B5i8jhT6o rrJRIOJc1dsUdHwMU6QLkGXT5xZpaigdbAapehYJ/b7hdtT6wWk/oVCKh/CG8ZxE59Ag 1oQsxUvCAhA1ZbswAfZPY+L1XU/RRUq2pdXSbpo/Lugminxg9SEJlU/tD0Eeck0bGaF2 4iXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=dBj76baE; 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 m14-20020a056402510e00b0045dc25bb7easi18566909edd.555.2022.10.23.03.38.01; Sun, 23 Oct 2022 03:38:24 -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=dBj76baE; 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 S230218AbiJWJyp (ORCPT + 99 others); Sun, 23 Oct 2022 05:54:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54250 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230287AbiJWJyl (ORCPT ); Sun, 23 Oct 2022 05:54:41 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22409318 for ; Sun, 23 Oct 2022 02:54:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518557; 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=rf+V8WTFZDSAN+5ckAKYlLWjlRnrCdeSS0nl0u+Vh8Q=; b=dBj76baEE4f6P4L0pHYValJKIB5hlDqZDhP/pphi/81ZB1nbB3FxGzocUaMiHRga9OzRWG fhfVfhE+EQV/2WZMJ956KovllsLWcMhx3eSOLeZ5QU4+d3bJw2N+7WjRnI5S1rv+JsZYLV 4URyf6DLKZYGgMCKP4e29Kj0BdGI0zs= 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 v3 24/28] mfd: stmfx: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:48 +0100 Message-Id: <20221023094852.8035-25-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?1747474452693259293?= X-GMAIL-MSGID: =?utf-8?q?1747474452693259293?= 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 --- V2: remove CONFIG_PM wrapper around fields in private struct V3: No change 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 ++---- include/linux/mfd/stmfx.h | 2 -- 2 files changed, 2 insertions(+), 6 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, diff --git a/include/linux/mfd/stmfx.h b/include/linux/mfd/stmfx.h index 744dce63946e..967a2e486800 100644 --- a/include/linux/mfd/stmfx.h +++ b/include/linux/mfd/stmfx.h @@ -113,10 +113,8 @@ struct stmfx { struct irq_domain *irq_domain; struct mutex lock; /* IRQ bus lock */ u8 irq_src; -#ifdef CONFIG_PM u8 bkp_sysctrl; u8 bkp_irqoutpin; -#endif }; int stmfx_function_enable(struct stmfx *stmfx, u32 func);