From patchwork Wed Jul 5 20:43:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 13302927 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 117A2C0015E for ; Wed, 5 Jul 2023 20:44:56 +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=XGDwEU2xxDa5IxZRl7kwRryuqp9rDsc+Bm/r01M7uaE=; b=B475Dzlw9y7DYi f4ElWNxU9xNKwibXnuICZGpkx1paUuqVoqmoNhSQdqgeIr1aHa+nFs+qKKmcz5TCNdO9mOUTfbM+2 ntJclVTYkpKONvu0/FvPHD2XKmy/rfKx6Zem/YlbOYF527MhVzm85tF3k5ASPOLPrmO+FNjWtR0Ud 97W0FjYEZnZVNmu5NXZ3hOqhoLRYjKJodKcLsB8FfvfiRGKJwTYOQGLgqteH3Fo1VRIM7ntdvzlBk 0FGkv3KyOzCcrcdISCgfpIFnVdx18iCUA79Fw6OyFVJdaV1agI2r1vGKIJtKmdcsV2aPtjetQ3edt 6+NfgzmdGtIV6JeVYD4Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qH9MV-00H3H7-2j; Wed, 05 Jul 2023 20:44:31 +0000 Received: from aposti.net ([89.234.176.197]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qH9MS-00H3F6-19 for linux-arm-kernel@lists.infradead.org; Wed, 05 Jul 2023 20:44:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1688589828; 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=5gHVcE8RU/hUBu2MLnfanVDpCvnfJ0V9sUihSxAlIOs=; b=L+NwoIkFTMfyOW2TfY7ACZms1Fp/R3Uh0DIk/4xqinDN1NxW2ymRxFezXOvfsTwskqfhkW DIdftWwQA65WCbkk9lfMY4SDeIKOkaTgsvIcGPoC/FD0UDAUtyHf4ubB+dMQnttG8AR7uf 4jZyJ0vmec78v1r6MYD2kRFvwfMmE4g= From: Paul Cercueil To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil , Linus Walleij , linux-arm-kernel@lists.infradead.org Subject: [PATCH 14/23] i2c: nomadik: Remove #ifdef guards for PM related functions Date: Wed, 5 Jul 2023 22:43:05 +0200 Message-Id: <20230705204314.89800-15-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_134428_545871_698DAD39 X-CRM114-Status: GOOD ( 13.01 ) 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. Signed-off-by: Paul Cercueil Reviewed-by: Jonathan Cameron Reviewed-by: Linus Walleij --- Cc: Linus Walleij Cc: linux-arm-kernel@lists.infradead.org --- drivers/i2c/busses/i2c-nomadik.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c index 1e5fd23ef45c..4a4b5bc257ae 100644 --- a/drivers/i2c/busses/i2c-nomadik.c +++ b/drivers/i2c/busses/i2c-nomadik.c @@ -873,7 +873,6 @@ static irqreturn_t i2c_irq_handler(int irq, void *arg) return IRQ_HANDLED; } -#ifdef CONFIG_PM_SLEEP static int nmk_i2c_suspend_late(struct device *dev) { int ret; @@ -890,9 +889,7 @@ static int nmk_i2c_resume_early(struct device *dev) { return pm_runtime_force_resume(dev); } -#endif -#ifdef CONFIG_PM static int nmk_i2c_runtime_suspend(struct device *dev) { struct amba_device *adev = to_amba_device(dev); @@ -925,13 +922,12 @@ static int nmk_i2c_runtime_resume(struct device *dev) return ret; } -#endif static const struct dev_pm_ops nmk_i2c_pm = { - SET_LATE_SYSTEM_SLEEP_PM_OPS(nmk_i2c_suspend_late, nmk_i2c_resume_early) - SET_RUNTIME_PM_OPS(nmk_i2c_runtime_suspend, - nmk_i2c_runtime_resume, - NULL) + LATE_SYSTEM_SLEEP_PM_OPS(nmk_i2c_suspend_late, nmk_i2c_resume_early) + RUNTIME_PM_OPS(nmk_i2c_runtime_suspend, + nmk_i2c_runtime_resume, + NULL) }; static unsigned int nmk_i2c_functionality(struct i2c_adapter *adap) @@ -1080,7 +1076,7 @@ static struct amba_driver nmk_i2c_driver = { .drv = { .owner = THIS_MODULE, .name = DRIVER_NAME, - .pm = &nmk_i2c_pm, + .pm = pm_ptr(&nmk_i2c_pm), }, .id_table = nmk_i2c_ids, .probe = nmk_i2c_probe,