Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp29584229rwd; Wed, 5 Jul 2023 14:15:22 -0700 (PDT) X-Google-Smtp-Source: APBJJlGp9Z7PhhaiT3dH/Pz0nv4Cc+BwhHVUrXqgnbkxTsUHnfhH8EDsF3FBndXY4wkFQ4SDuwxa X-Received: by 2002:a9d:6210:0:b0:6b8:8174:80e4 with SMTP id g16-20020a9d6210000000b006b8817480e4mr141760otj.21.1688591722236; Wed, 05 Jul 2023 14:15:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688591722; cv=none; d=google.com; s=arc-20160816; b=unU4psoj9GsXEVABOZ8kM+lEtVg3/uEtflgIoz4g4RZj8djMp8GzwkB9rgPtnXAmMp 2B1Cj2ojU/jntcRBNWihNjO9DoD+sRbKhtYhNU058+2dmBntkwobYK9jMem5L4nc2Jhq vs4SiPmZioQagiGtO8JiAa6xu21/8WJngf79hgt3JFmHqRWh8z3FNLypSUnUwFDh9Ft2 npYib20MYHRnrPbnvZAN4fJuBt+1o8bZw4VyuDdGPyQQP8xAQ9+jeJM35YgHgZI6wVeh KlMA2FIAt8VMLHeYW7J5YzPziFQ4e9c71kleS39TkkDMaWnamvtR1hveOQOAzT3p55hM +d2g== 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=8Cruf7Vmb7XSlnXrVuQFYOamoAziq4HcztCnizK0FoQ=; fh=hnEjkU0tU5h7ruKZyTQ1mm6nXTcsOZE8yOEaGSyOfSI=; b=PwB2TxiCyCQ5ggi2y+Pk4TkDT2zbTZ3a4VusRZprGc2k20H34U1Iy/JJXJZrLNJ5PP yUMfQujOEtk7CndArmOo0VQKO0tmxy+IHeUvC8sRpyOwlwCUMNA/+1D63cfeesLbdpoM K57yPsJoGt3gd8LsPZqaRSxWHeYQDADlqCnXmrfN5qTFVhDyxY7zboQG4ekJqlh/df3m tvZd6FhkiemLpaojo3Ytnp5CMyZRJvJrLxTb05e/SoCmctmAZo+vEgJ6/2f3US0t30HI ZV9DJDeH16HFoX9OwuHHr9nB0HBQOCOqf0TxgZqgljsoURQWOzs/glGt5bTiInHSGj58 B2RA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b="XM/d9wXl"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s1-20020a63d041000000b0054ff40bf1ccsi23964586pgi.702.2023.07.05.14.15.08; Wed, 05 Jul 2023 14:15:22 -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="XM/d9wXl"; 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 S233921AbjGEUpS (ORCPT + 99 others); Wed, 5 Jul 2023 16:45:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233870AbjGEUpN (ORCPT ); Wed, 5 Jul 2023 16:45:13 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4ECF1BC0; Wed, 5 Jul 2023 13:44:59 -0700 (PDT) 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 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, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 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 --- 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, }, }; -- 2.40.1