From patchwork Sat Jul 22 11:53: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: 124294 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp775353vqg; Sat, 22 Jul 2023 05:27:20 -0700 (PDT) X-Google-Smtp-Source: APBJJlHTYwBlA/p+wOva4SkJjD91BYsX5g/WymaSN0lt2teIRu0S2xzqMCb8UKlFuQqclLfo51JZ X-Received: by 2002:a05:6a20:3ca7:b0:137:e595:8312 with SMTP id b39-20020a056a203ca700b00137e5958312mr3516088pzj.14.1690028840351; Sat, 22 Jul 2023 05:27:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690028840; cv=none; d=google.com; s=arc-20160816; b=X4DaonApB5uD8WdVu1Phkg6UNYqkvduUhekgGjAFJyoNpFdmk0SkcFCPJIBBDhBkaD BhxX2NzhaVtpKuP55iri092fHUfNfdF7T7LSaxpNEBkEeL8ZrFGNvdO3Lx6FCKFaH7ZJ pYUgYP6GfCtSKJFdvp0Bhdvgw0SogElE/muntL+7+GYOURz5jC2ZxeBT8BfO/MIk9rit hzntHYtlKie7A9z2D5Lm3bkEFf8wc7Qav1iwShbmunw5/bM/zCaz/+frHEA3h4+bgDXH r55KQbrm7Oil9Gx5EyKpfJZW6zXqkhWirP0aoUF7FyT6oAhJI97KtIvimauqSoeoSP6m FCKw== 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=Gr5fISthM3hjviIV2m+GHu1GOqDLLniBOMs8Cbn21rA=; fh=rq0eQUMyxSUeB9niiXdyznwA33SE9gYcI9XTv0GJfWE=; b=XGp0iQvpN3xKibCyCZFlHYajwvCMEIkum+C5mzNwPStrJynK4s/SgxMIC5rDHewwZo XX2qaADnRBKpISXkBnlxfYkQKQlDyZ5yhtrvIfT/X0/tykk8zu4t+F0ZrS49XEt58Kv+ Y0BayvgZy1cHXu/qvUM5E8FzXXe8zOKflrlfnF+wiE2gUqgBEPuqkgZ1JCwHzkgN0iUk IomwFhavOCihjl3T2VXB2hKxL7sZbnvMai2rJutTCpiIuJIWjVN8iqNqrPW6s4SPAnwD qxmhdPAK2nCT0VHXzqOX1VGnU+lZ22IDe2n4zesg4GWq8tAo4BGhZPLMqvfDwtteuIiK Ra3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=TsdRxWo4; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s28-20020a63525c000000b0055c8d14df3asi4935648pgl.799.2023.07.22.05.27.07; Sat, 22 Jul 2023 05:27:20 -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=TsdRxWo4; 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 S230321AbjGVL6h (ORCPT + 99 others); Sat, 22 Jul 2023 07:58:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230153AbjGVL6b (ORCPT ); Sat, 22 Jul 2023 07:58:31 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2FF710C1; Sat, 22 Jul 2023 04:58:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1690026799; 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=Gr5fISthM3hjviIV2m+GHu1GOqDLLniBOMs8Cbn21rA=; b=TsdRxWo4yJIATAp3W8dDyU7tgsfQmpxGpFFRw+3KM40FlLmb/rd/NYamRtL3nkjbzVOV1E EdGE1xEoAEAC+4v03oTCSxxntuVILqG2FM1l3wi6r1U+B9qqL6cZbfHndA1qE5YyRRmYqC hpr8GhfxWYmRwV8T7NwI0Us6DWZJsBw= From: Paul Cercueil To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil , Jonathan Cameron , Andy Gross , Bjorn Andersson , Konrad Dybcio , linux-arm-msm@vger.kernel.org Subject: [PATCH v2 17/22] i2c: qup: Remove #ifdef guards for PM related functions Date: Sat, 22 Jul 2023 13:53:05 +0200 Message-Id: <20230722115310.27681-1-paul@crapouillou.net> In-Reply-To: <20230722115046.27323-1-paul@crapouillou.net> References: <20230722115046.27323-1-paul@crapouillou.net> MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772123681000792087 X-GMAIL-MSGID: 1772123681000792087 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 Reviewed-by: Jonathan Cameron --- 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 ae90170023b0..598102d16677 100644 --- a/drivers/i2c/busses/i2c-qup.c +++ b/drivers/i2c/busses/i2c-qup.c @@ -1927,7 +1927,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); @@ -1945,9 +1944,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)) @@ -1962,16 +1959,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[] = { @@ -1987,7 +1979,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), },