From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADF4BC433FE for ; Sun, 23 Oct 2022 09:54:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230280AbiJWJyX (ORCPT ); Sun, 23 Oct 2022 05:54:23 -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 ); 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 ; 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 To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil , Orson Zhai , Baolin Wang , Chunyan Zhang 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 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. 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 --- Cc: Orson Zhai Cc: Baolin Wang Cc: Chunyan Zhang 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, -- 2.35.1