Message ID | 20221023094852.8035-24-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 s2csp1561497wrr; Sun, 23 Oct 2022 03:41:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6sVTRB6PNTe/mGnFYpb5oEjv1HvPDjJNt0+lv3/WCvf0btuhpS8Ib7KXZKj4tOxCSm4NWN X-Received: by 2002:a65:5a0b:0:b0:46b:158e:ad7c with SMTP id y11-20020a655a0b000000b0046b158ead7cmr24193145pgs.272.1666521713824; Sun, 23 Oct 2022 03:41:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666521713; cv=none; d=google.com; s=arc-20160816; b=fk8BGapdHdACaKTqoqKQUunKm/VfKmwX+WQ8pBYBXDGdDHxL/KUzPwk+llt/n6tTIg IhHXLPRbbLKleaPeohAvn8LuNzaAFsPRgSjg2HjFQwGoahlQMAA+APSpH9t4w8TvheZF 19QIddhMH/p7zXv1o36YGRhL7S5Z3HOE0qoH2NizJmdzQMdxaRXd2MbiGZ+WbVwy+Z/E lP4BH7G56Wuks1lYJegi6zYV5/UouK0niiEgc+9CsACTMxnHFKROqFPuM+sCitFndX0n +4p8t7veuN+7acG+2q7mdglbqINFuiXBjmqm3iQbNS/JbnVisrsooWAXngNxEx/y3GrZ 3oDw== 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=HDKUPQO6lE4XXrIyfPTsCACfjenryJXx0aNwhM3B1z8=; b=GMu+eziBNJ8TnXvCHjtovR/VCmcWnRxH3KgXOlWZdoHSTd3r/b4eFjf7XrVRe6o8tP +EL8GuyI3ObAP7v/MgWXf0eynZiC5yYVXKjCM4UT4gqR+yBlLfG04O4aI7vQkorSMh5N tSTzCChLm2VA/R0dGhdARkKL0/oet+zoScymlnt2LzXft/FbF3AObXsRYIii2COpvMzY T+f46fn7flbLHPNmZgPvXTE3+TiIKqTFFLmb/zj2iGmoszbvuZ+8uMPB0HY1xFG7VH0H iP626WYih4VGcrawdpc8j7OIrJuL5Vdg6gbRpbnPsk9zh5s/P+WWeiLvlXrXjphHXthQ AbvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=emy0dHpK; 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 q19-20020a170902bd9300b0018694bb16cbsi2991257pls.569.2022.10.23.03.41.38; Sun, 23 Oct 2022 03:41:53 -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=emy0dHpK; 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 S230271AbiJWJyV (ORCPT <rfc822;pwkd43@gmail.com> + 99 others); Sun, 23 Oct 2022 05:54:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230239AbiJWJyT (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 23 Oct 2022 05:54:19 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B35D076476 for <linux-kernel@vger.kernel.org>; Sun, 23 Oct 2022 02:54:10 -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=HDKUPQO6lE4XXrIyfPTsCACfjenryJXx0aNwhM3B1z8=; b=emy0dHpKCzzzV2d6eN5XL6pMwMOKRnbcF8B3DF48yPGB6RCBT0lAakFC2M8DNlRdHfd3z4 oZ+NsY6Jpo7DKT3HBJ7u6gLpoN0pYpTTyQfCi/5UyMnrTXjRS5skq4mfk1FONrpU/s5jE1 eU0DSuAO0RkZCs7DzJ2ohbT04udgHbc= From: Paul Cercueil <paul@crapouillou.net> To: Lee Jones <lee@kernel.org> Cc: linux-kernel@vger.kernel.org, Paul Cercueil <paul@crapouillou.net>, Orson Zhai <orsonzhai@gmail.com>, Baolin Wang <baolin.wang@linux.alibaba.com>, Chunyan Zhang <zhang.lyra@gmail.com> Subject: [PATCH v3 23/28] mfd: sprd-sc27xx: Remove #ifdef guards for PM related functions Date: Sun, 23 Oct 2022 10:48:47 +0100 Message-Id: <20221023094852.8035-24-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?1747474672740221297?= X-GMAIL-MSGID: =?utf-8?q?1747474672740221297?= |
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>
---
Cc: Orson Zhai <orsonzhai@gmail.com>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Chunyan Zhang <zhang.lyra@gmail.com>
drivers/mfd/sprd-sc27xx-spi.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/mfd/sprd-sc27xx-spi.c b/drivers/mfd/sprd-sc27xx-spi.c index d05a47c5187f..ea68d73e5d1c 100644 --- a/drivers/mfd/sprd-sc27xx-spi.c +++ b/drivers/mfd/sprd-sc27xx-spi.c @@ -215,7 +215,6 @@ static int sprd_pmic_probe(struct spi_device *spi) return 0; } -#ifdef CONFIG_PM_SLEEP static int sprd_pmic_suspend(struct device *dev) { struct sprd_pmic *ddata = dev_get_drvdata(dev); @@ -235,9 +234,9 @@ static int sprd_pmic_resume(struct device *dev) return 0; } -#endif -static SIMPLE_DEV_PM_OPS(sprd_pmic_pm_ops, sprd_pmic_suspend, sprd_pmic_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(sprd_pmic_pm_ops, + sprd_pmic_suspend, sprd_pmic_resume); static const struct of_device_id sprd_pmic_match[] = { { .compatible = "sprd,sc2730", .data = &sc2730_data }, @@ -257,7 +256,7 @@ static struct spi_driver sprd_pmic_driver = { .driver = { .name = "sc27xx-pmic", .of_match_table = sprd_pmic_match, - .pm = &sprd_pmic_pm_ops, + .pm = pm_sleep_ptr(&sprd_pmic_pm_ops), }, .probe = sprd_pmic_probe, .id_table = sprd_pmic_spi_ids,