Message ID | 20221023094852.8035-5-paul@crapouillou.net |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp1547618wrr; Sun, 23 Oct 2022 02:55:35 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5VBCltQE8VjHrFFJbTlx5j1xD1BxFkSdbXo+O9p7MR10Wb3J7Th8OvUezSyyFmI69XQdUy X-Received: by 2002:a17:907:782:b0:740:7120:c6e7 with SMTP id xd2-20020a170907078200b007407120c6e7mr22815296ejb.313.1666518935342; Sun, 23 Oct 2022 02:55:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666518935; cv=none; d=google.com; s=arc-20160816; b=KMhvf8r1uLzvli0XhPLM4MC+QNZo0TxPDW6VY7+WhU8HsNfnIuFthT4A3WEVCuDpXF LswN/qeNXdGIB8iOQLm12zXSoGkmzrrbwC+9OEMrdvWuV2bz1YrjgXjRXfPD0xZ9H7ni ph/XzGOaN5+VizHVu8rwg2j5gghg6Xm1efhFx3m8y0IYzOlQOWmSthfHUJMzU3OiYZWm k63LfH6hSfsjHFoi/9X1cd8lI5KmnVvFpQxNerc0vZD4SU2YNSrb50CWQBAzPC+pc/c2 248CRotXI5TjK80twK9MCP1I3R74+yvbbSy5AuQ6pKHcbewWCJRASEz26nE4xi4ghrgC oxsA== 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=a32yNu2Eeu11C00fM1RqTufFXXGAOLPmqPKGVg+1zOs=; b=TcQkzFsKqjjj5Hp/M/vSaaCE1Sa9PpU0icgM1ePk2UFy+7NZgZItXot5LpN8Gtu/1f pY80vPEw69NIOtiwW+bJ5OEauSHXyOsMMkqJklLD9ISKR0gCK0vXEAsK0OigzO3xO7Vt 4yKNEKatp3zJnTp51ettLIpfiKF3uOfxMKtpb/1pI74FP+l7+06VRv2EXdZwonBnAxo8 Bpop/1rxrqMHmfRV+J+JSEAzluKlpXk2zyLP/d+EI+KXi3i3LbbPnk+bHV1fhgr5bfQ2 c9SsU2hRpEOkXIb/dPZP+H5D+jCbjCy0nUFhzsXPyhB3PZbU2xupJJfBJAbjy+H/eAn6 HgMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=bKNpXcm3; 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 dm21-20020a170907949500b00787803711f9si26226065ejc.353.2022.10.23.02.55.11; Sun, 23 Oct 2022 02:55:35 -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=bKNpXcm3; 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 S230031AbiJWJtz (ORCPT <rfc822;pwkd43@gmail.com> + 99 others); Sun, 23 Oct 2022 05:49:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230172AbiJWJtr (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 23 Oct 2022 05:49:47 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5998C13EA1 for <linux-kernel@vger.kernel.org>; Sun, 23 Oct 2022 02:49:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1666518545; 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=a32yNu2Eeu11C00fM1RqTufFXXGAOLPmqPKGVg+1zOs=; b=bKNpXcm3d8NoHpBQnqNFOd2mxosxO1mrPVpwMyVyFQcp64FcVA8OGgP8CO6WLmgDOY3zK1 9HQlbDNabm/CwuAFXZMIdh8SfubKwCXqYgmTazHEjZPAcTzXLy9TR9aBrby9NFRkCLi5sb gi0RBTgMtcudSIDQnU2euBh7mTAfvGw= From: Paul Cercueil <paul@crapouillou.net> To: Lee Jones <lee@kernel.org> Cc: linux-kernel@vger.kernel.org, Paul Cercueil <paul@crapouillou.net> Subject: [PATCH v3 04/28] mfd: max8925-i2c: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:28 +0100 Message-Id: <20221023094852.8035-5-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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747471759340195214?= X-GMAIL-MSGID: =?utf-8?q?1747471759340195214?= |
Series |
mfd: Remove #ifdef guards for PM functions
|
|
Commit Message
Paul Cercueil
Oct. 23, 2022, 9:48 a.m. UTC
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 <paul@crapouillou.net>
---
drivers/mfd/max8925-i2c.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/mfd/max8925-i2c.c b/drivers/mfd/max8925-i2c.c index 114e905bef25..649310b5bb3e 100644 --- a/drivers/mfd/max8925-i2c.c +++ b/drivers/mfd/max8925-i2c.c @@ -208,7 +208,6 @@ static int max8925_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM_SLEEP static int max8925_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -228,9 +227,9 @@ static int max8925_resume(struct device *dev) disable_irq_wake(chip->core_irq); return 0; } -#endif -static SIMPLE_DEV_PM_OPS(max8925_pm_ops, max8925_suspend, max8925_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(max8925_pm_ops, + max8925_suspend, max8925_resume); static const struct of_device_id max8925_dt_ids[] = { { .compatible = "maxim,max8925", }, @@ -240,7 +239,7 @@ static const struct of_device_id max8925_dt_ids[] = { static struct i2c_driver max8925_driver = { .driver = { .name = "max8925", - .pm = &max8925_pm_ops, + .pm = pm_sleep_ptr(&max8925_pm_ops), .of_match_table = max8925_dt_ids, }, .probe = max8925_probe,