From patchwork Wed Jul 5 20:42:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 116439 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp2143669vqx; Wed, 5 Jul 2023 14:21:03 -0700 (PDT) X-Google-Smtp-Source: APBJJlHOsKZTievjkht2++BlYOPPG6KiBW4X+cZtc37L/ZKOtan6vQp7s4qtB9FBGVGZdbyfUQEI X-Received: by 2002:a17:90b:607:b0:262:fa59:2908 with SMTP id gb7-20020a17090b060700b00262fa592908mr4963894pjb.1.1688592063551; Wed, 05 Jul 2023 14:21:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688592063; cv=none; d=google.com; s=arc-20160816; b=wivUvh1PTQMEagor6MTEDBEqUcy1cxUriUojfwUqP5qsg/jWDXgCddU628Z76aRFz+ cFMfAIvUYMLJNsjGcCmooiZvALg2SY9KXFsJ4QioOvl1LOtt6zoCi1w+AEkUUwcqdSMI dRvGBIO5Ai/jsKhmLekKTsa7C/Nw+7PLwbm6OChJV3bXXSh0a4j7rFqh3moDsV8jCA7K eHTfHqv4GsTn0GHshscQq2Lvs3NwMZmbyUD5mms979i6+LVcHjiIpTFYPQxKG2SwxXzW 1KpKQ9pxjLTYWdlQhRQN0wv3zHv95bwLdRY15M8TJukrDj+PYNpf9DV0pMGRA+pc4TPf C9ow== 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=8c7jTkEU88lEi6fv0iM1MMw6JdY9CeSY5L29Egt6b1A=; fh=fR5/VcV2ao3Owhxob1GcTDl3VhD8MzLmMkWwK6kQjyw=; b=QoyEyyCU8HvMnMofKOHyG/lWN+VasJpuven4wO1DhqM+ujIw290/dQLD8okyW9fiq7 zveYrSnJ3cn5Bsz3wO2i0vyjAOUmn8bEdG8/o2j8spTQtqDc3fQm2EEaQqbxH/1KfSN4 O75YB7N1m47w7BtDb0RLWgB1ffI85JSyXPAQ+Gt5FsdYIKszk2y2cHI09t+bbfH+1neO enWAI21xgOq0DsLoiuBSTk3ZkiuCx10ynpwm+EVpjg04zSh4JjSqiVIzWkDDntyPQRBC DHlQwhiEMae7NJx6BYh2CizjXpXOtuiocBh4n09aIc4XFPOs5D3HNCvZhkAZGJsK3BdT 2TMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=L+0FajBG; 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 h8-20020a170902f54800b001b7f4696a2csi998171plf.347.2023.07.05.14.20.48; Wed, 05 Jul 2023 14:21:03 -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=L+0FajBG; 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 S233962AbjGEUpz (ORCPT + 99 others); Wed, 5 Jul 2023 16:45:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233961AbjGEUpr (ORCPT ); Wed, 5 Jul 2023 16:45:47 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2665119AA; Wed, 5 Jul 2023 13:45:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1688589821; 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=8c7jTkEU88lEi6fv0iM1MMw6JdY9CeSY5L29Egt6b1A=; b=L+0FajBG1zP9IyIZnPhZNyeEF2VvieClOQI9AVyx04NPX+M3U2R22bkmPJ8/1R20jIZwVa KRImFiJGY5YN+q/XDOpuP0ij+CgVqvJvc8NhtdvDGm4Mkafni7TGAUNjuvZFRxGz3fEkGp Dfr44XfIsUuoVJO1/dQ0XKLv/N8icFs= From: Paul Cercueil To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH 08/23] i2c: hix5hd2: Remove #ifdef guards for PM related functions Date: Wed, 5 Jul 2023 22:42:59 +0200 Message-Id: <20230705204314.89800-9-paul@crapouillou.net> In-Reply-To: <20230705204314.89800-1-paul@crapouillou.net> References: <20230705204314.89800-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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770617112076081942?= X-GMAIL-MSGID: =?utf-8?q?1770617112076081942?= 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 this driver should probably use the DEFINE_RUNTIME_DEV_PM_OPS() macro, which would allow the devices to be runtime-suspended on system suspend. Signed-off-by: Paul Cercueil Reviewed-by: Jonathan Cameron --- drivers/i2c/busses/i2c-hix5hd2.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/i2c/busses/i2c-hix5hd2.c b/drivers/i2c/busses/i2c-hix5hd2.c index 784a5f56eb76..8e75515c3ca4 100644 --- a/drivers/i2c/busses/i2c-hix5hd2.c +++ b/drivers/i2c/busses/i2c-hix5hd2.c @@ -475,7 +475,6 @@ static void hix5hd2_i2c_remove(struct platform_device *pdev) pm_runtime_set_suspended(priv->dev); } -#ifdef CONFIG_PM static int hix5hd2_i2c_runtime_suspend(struct device *dev) { struct hix5hd2_i2c_priv *priv = dev_get_drvdata(dev); @@ -494,12 +493,11 @@ static int hix5hd2_i2c_runtime_resume(struct device *dev) return 0; } -#endif static const struct dev_pm_ops hix5hd2_i2c_pm_ops = { - SET_RUNTIME_PM_OPS(hix5hd2_i2c_runtime_suspend, - hix5hd2_i2c_runtime_resume, - NULL) + RUNTIME_PM_OPS(hix5hd2_i2c_runtime_suspend, + hix5hd2_i2c_runtime_resume, + NULL) }; static const struct of_device_id hix5hd2_i2c_match[] = { @@ -513,7 +511,7 @@ static struct platform_driver hix5hd2_i2c_driver = { .remove_new = hix5hd2_i2c_remove, .driver = { .name = "hix5hd2-i2c", - .pm = &hix5hd2_i2c_pm_ops, + .pm = pm_ptr(&hix5hd2_i2c_pm_ops), .of_match_table = hix5hd2_i2c_match, }, };