From patchwork Wed Jul 5 20:42:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 13302924 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B15F4EB64DD for ; Wed, 5 Jul 2023 20:44:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uegg2TRhpsnwioExU3n3fwJVFHUc6mZQtzksqHth9xY=; b=1DqVS4jhqWyZKp YJRccodIZnO+FfsxOXJNBKiGg8I1fqBc3iLsH/4s6hAQd4FLmewAulH0vD7KrwE2pJzMBkUPXWa4j aQ5YheMIey4rTfUHC2gXQDYTbCvmOIkT8bnCP34q2O+pcF1YTVOA+9/JClJxYawZksCT3bCmiJGyI +4+oL/SlUDbJVz3OSAWDaFD6gM2E+SmG6WdzrRd6LXbSAkMXmlJsksA1SCL9gMJloTWfbA+VR6Dt7 1mYi3/DMgBFs3uBXZ+WDv5bzXs9dn3UvqG7JXtYQKS5x7324qgn3xraymiShAwEyWHyMKaBcFFhOS Nby39cF51VscH12ZRNRg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qH9Lz-00H31r-0W; Wed, 05 Jul 2023 20:43:59 +0000 Received: from aposti.net ([89.234.176.197]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qH9Lw-00H309-0M for linux-arm-kernel@lists.infradead.org; Wed, 05 Jul 2023 20:43:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1688589817; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8Cruf7Vmb7XSlnXrVuQFYOamoAziq4HcztCnizK0FoQ=; b=XM/d9wXlRlr4OUyJhItpMMIKkBgDyd81rFGnWpcQIRIkJuNZg9U+g8H5M+YQyHsWVdK/UK iHBGMsvWguN/7JSchVExtCMcwnB95aByf6jXOvy/dsbo/RZ8I/ZOt5aVDXCY1leYH3wG8g dHiNaRFXXrpDmOzZ7X0h3exNU7Ygqng= From: Paul Cercueil To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil , Bartosz Golaszewski , linux-arm-kernel@lists.infradead.org Subject: [PATCH 05/23] i2c: davinci: Remove #ifdef guards for PM related functions Date: Wed, 5 Jul 2023 22:42:56 +0200 Message-Id: <20230705204314.89800-6-paul@crapouillou.net> In-Reply-To: <20230705204314.89800-1-paul@crapouillou.net> References: <20230705204314.89800-1-paul@crapouillou.net> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230705_134356_306095_EA1C22CA X-CRM114-Status: GOOD ( 15.08 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use the new PM macros for the suspend and resume functions to be automatically dropped by the compiler when CONFIG_PM or CONFIG_PM_SLEEP are 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. Note that the behaviour is slightly different than before; the original code wrapped the suspend/resume with #ifdef CONFIG_PM guards, which resulted in these functions being compiled in but never used when CONFIG_PM_SLEEP was disabled. Now, those functions are only compiled in when CONFIG_PM_SLEEP is enabled. Signed-off-by: Paul Cercueil Reviewed-by: Jonathan Cameron --- Cc: Bartosz Golaszewski Cc: linux-arm-kernel@lists.infradead.org --- drivers/i2c/busses/i2c-davinci.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/i2c/busses/i2c-davinci.c b/drivers/i2c/busses/i2c-davinci.c index 71b60778c643..52527189a7bf 100644 --- a/drivers/i2c/busses/i2c-davinci.c +++ b/drivers/i2c/busses/i2c-davinci.c @@ -902,7 +902,6 @@ static void davinci_i2c_remove(struct platform_device *pdev) pm_runtime_disable(dev->dev); } -#ifdef CONFIG_PM static int davinci_i2c_suspend(struct device *dev) { struct davinci_i2c_dev *i2c_dev = dev_get_drvdata(dev); @@ -926,15 +925,10 @@ static int davinci_i2c_resume(struct device *dev) static const struct dev_pm_ops davinci_i2c_pm = { .suspend = davinci_i2c_suspend, .resume = davinci_i2c_resume, - SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) + NOIRQ_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) }; -#define davinci_i2c_pm_ops (&davinci_i2c_pm) -#else -#define davinci_i2c_pm_ops NULL -#endif - static const struct platform_device_id davinci_i2c_driver_ids[] = { { .name = "i2c_davinci", }, { /* sentinel */ } @@ -947,7 +941,7 @@ static struct platform_driver davinci_i2c_driver = { .id_table = davinci_i2c_driver_ids, .driver = { .name = "i2c_davinci", - .pm = davinci_i2c_pm_ops, + .pm = pm_sleep_ptr(&davinci_i2c_pm), .of_match_table = davinci_i2c_of_match, }, };