Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp29567354rwd; Wed, 5 Jul 2023 14:00:37 -0700 (PDT) X-Google-Smtp-Source: APBJJlHzeJ0xSC6OGdzNYRMqOa3SP2ThfcGD9aa+LPyxxEnhFoXPDiN/2HsHsNp2PlNdnkKICIsQ X-Received: by 2002:a17:902:d345:b0:1b0:3ab6:5140 with SMTP id l5-20020a170902d34500b001b03ab65140mr327183plk.4.1688590836909; Wed, 05 Jul 2023 14:00:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688590836; cv=none; d=google.com; s=arc-20160816; b=WD6nkKjqA6aeUN+5mCm3tSzMQqTaVRURUFayjszoNlYtQE5ceedwX58HnStAYaeKb8 7nP+l/YTmlOo258unTptVfsC7WbOaWHz9+TgMU+w/6LJiEBoifWifA6Xfr9Y8stcpvtf wWzbTyi0Q8XME5D2Ab/oH5Le5pI0eG46VZpdQhHxmYTEX22GN8HQs2SN6FcSL0kfTAnW XKgPOmQqAA/aYVN54su1Wdfy29TqONM4sNgCmA3b+qVJdn8XGzf4MF1xX0G0g6ljdSsi MPrTRCbfQYU3z71hz9e87Ge2hnXybO3y78lvBObGPhaenLIPIR8s2AzbPzNJv+yl8NJi hZxg== 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=4ZMhJHfwRq/YsfRfB6Rq8DTpviAwP7iZQD4xDuA/JAE=; fh=LlNi7Jv2UWyoLOhpweVQVkH0zdcVAqZieCKaai2vQO4=; b=M0l4GBPqPwkV7iMG2J56wHq0lo84iQUe6GMJVJvEWHY/+Bj6PnU7cpVD/V5JHOJ2Bb O1FA3dTZjF5ArodYZydg134lxMHq6WucMk7i8AYW/f6H9jfV1sQzUmR/db5NBANLeqKs mTOEoTvo6X849iqCfTnQigAndGMGxQ5XOIv8DeG1Z0HmWELEGTFaKL31+rECOE9cpZRn 0sSDl56nzuI7V7arxV0oOhJ1eGy4eOOh756Fc/SePdHjviYFikUCn3MYraEHDdkcem6R 7MF5PrBxk2Qjt4VVRCgHN8XU6e5j6UiHSSRde+oZ70VDbq4JtO5IVvKsu0fkMeRxzF/5 ReXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b="vGyP40/N"; 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 s2-20020a170902ea0200b001b89cda5e12si7411076plg.546.2023.07.05.14.00.24; Wed, 05 Jul 2023 14:00:36 -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="vGyP40/N"; 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 S233959AbjGEUsW (ORCPT + 99 others); Wed, 5 Jul 2023 16:48:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234054AbjGEUsV (ORCPT ); Wed, 5 Jul 2023 16:48:21 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48C351FD5; Wed, 5 Jul 2023 13:48:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1688589832; 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=4ZMhJHfwRq/YsfRfB6Rq8DTpviAwP7iZQD4xDuA/JAE=; b=vGyP40/Nz2qbJ0Kr5CPbwqy32ezKbHLB4Ij3p169EhLODT4/2cd76R2sAVp3yXy0Jojkpy QbDgMCQ3DD1tqRcd5UMZqzT7Jy2/uwcgY2BETH4sOw4lEv4R1GBS9q5KYo6rCGB2L48bcM dZxpNw2BMrfPP2dKkSSWiMQOx/4cLfw= From: Paul Cercueil To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil , Andy Gross , Bjorn Andersson , Konrad Dybcio , linux-arm-msm@vger.kernel.org Subject: [PATCH 18/23] i2c: qup: Remove #ifdef guards for PM related functions Date: Wed, 5 Jul 2023 22:43:09 +0200 Message-Id: <20230705204314.89800-19-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 driver should probably use the DEFINE_RUNTIME_DEV_PM_OPS() macro, as the system suspend/resume callbacks seem to not do anything more than triggering the runtime-PM states. Signed-off-by: Paul Cercueil --- Cc: Andy Gross Cc: Bjorn Andersson Cc: Konrad Dybcio Cc: linux-arm-msm@vger.kernel.org --- drivers/i2c/busses/i2c-qup.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c index 6eef1dbd00de..658d1c1c2ec8 100644 --- a/drivers/i2c/busses/i2c-qup.c +++ b/drivers/i2c/busses/i2c-qup.c @@ -1920,7 +1920,6 @@ static void qup_i2c_remove(struct platform_device *pdev) pm_runtime_set_suspended(qup->dev); } -#ifdef CONFIG_PM static int qup_i2c_pm_suspend_runtime(struct device *device) { struct qup_i2c_dev *qup = dev_get_drvdata(device); @@ -1938,9 +1937,7 @@ static int qup_i2c_pm_resume_runtime(struct device *device) qup_i2c_enable_clocks(qup); return 0; } -#endif -#ifdef CONFIG_PM_SLEEP static int qup_i2c_suspend(struct device *device) { if (!pm_runtime_suspended(device)) @@ -1955,16 +1952,11 @@ static int qup_i2c_resume(struct device *device) pm_request_autosuspend(device); return 0; } -#endif static const struct dev_pm_ops qup_i2c_qup_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS( - qup_i2c_suspend, - qup_i2c_resume) - SET_RUNTIME_PM_OPS( - qup_i2c_pm_suspend_runtime, - qup_i2c_pm_resume_runtime, - NULL) + SYSTEM_SLEEP_PM_OPS(qup_i2c_suspend, qup_i2c_resume) + RUNTIME_PM_OPS(qup_i2c_pm_suspend_runtime, + qup_i2c_pm_resume_runtime, NULL) }; static const struct of_device_id qup_i2c_dt_match[] = { @@ -1980,7 +1972,7 @@ static struct platform_driver qup_i2c_driver = { .remove_new = qup_i2c_remove, .driver = { .name = "i2c_qup", - .pm = &qup_i2c_qup_pm_ops, + .pm = pm_ptr(&qup_i2c_qup_pm_ops), .of_match_table = qup_i2c_dt_match, .acpi_match_table = ACPI_PTR(qup_i2c_acpi_match), }, -- 2.40.1