From patchwork Sat Jul 22 11:50:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 124297 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9010:0:b0:3e4:2afc:c1 with SMTP id l16csp775556vqg; Sat, 22 Jul 2023 05:27:46 -0700 (PDT) X-Google-Smtp-Source: APBJJlFbz/PtcdeGxh+VWGk3mtzzXSyzoBg2ucZIt59FEtw+E9VzMbUg42+u8n7XD3P7jaGSX3c5 X-Received: by 2002:a17:902:e88d:b0:1b1:7362:9a18 with SMTP id w13-20020a170902e88d00b001b173629a18mr3832668plg.27.1690028866199; Sat, 22 Jul 2023 05:27:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690028866; cv=none; d=google.com; s=arc-20160816; b=acbKMjE/URg0oSOfQ5UtqOZ4ub3xp1VFbN5cmKZNTIkxF52n2I42/Swun/hfpxAPMe rj0FPXMl9rmfW8GtQdvBwCU15rX5zj5vP4F96Q9VZFTbbfBTnN0V8cBooQGIkRS3yR3L exKu4p2ptuzbzY71rbA6ODcLy4rsdQZhsWHuM1qX63CCbGItzsGvJzEe4n5WXC941dkS 8S1SSyq+x+sgjba7cO7ZxFk9+oD7Wh+4Q7vLMoqsUpseptDm1RxlfBgoaq1L+4ejL0XR X8vtFvmaTOUal1NIj6gN4dAxH2hNsDowbSOVKJgcSm5Xf58/0gkhJZHKlmAYchdxaLem Qq2w== 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=WJouQK7xzpSaHcHMSHJNeS3qIccDqtjb0YIyUjhatbU=; fh=WaQYlaN5vX3IDavTkTtoFN25f59w3IMq7xcfsVS1pY0=; b=G5JxnB2Q2LnXIUjV+/RQKLIV9IvkPPOezfp/HMy1cjwL/FiyFFyZPXsW9YbMBop1Xk dowqdYRSBKAy9hBcQZnpxEd9d6fjnl9qo8dkvRbgnz7MaetRu3FvANi6KrqhQzajzvOe vsVNHWfHK4GoNy04iufztrzR9gaDdVG3rvna7GuVt1lUtwyti25QaCke4nWy2E0kjHGG jSVQfQCYC8Dwhs3apTxo3ScKjGyDe2U5M38rpMke+79K1u/ToaTrHS0WEH2brwp66DZU FgsOf3THvfEejB7C+eM9G2F/vlljplZMATGnHaBYR+CpxvrspmMnXG+8szqpP7bvEj4e SUuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=zHqKuO9I; 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 kc15-20020a17090333cf00b001b000b3f132si4781068plb.298.2023.07.22.05.27.33; Sat, 22 Jul 2023 05:27:46 -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=zHqKuO9I; 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 S230097AbjGVLyu (ORCPT + 99 others); Sat, 22 Jul 2023 07:54:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229681AbjGVLyt (ORCPT ); Sat, 22 Jul 2023 07:54:49 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDAAB359F; Sat, 22 Jul 2023 04:54:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1690026681; 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=WJouQK7xzpSaHcHMSHJNeS3qIccDqtjb0YIyUjhatbU=; b=zHqKuO9Iw5ItBjFqufsptizJwcHvFt68dDG1LxDWEAq4EP88uGMxSbWAcphUKHSUHA1D1Q OcGkJGBnElcsAtAzuHfO/h098idSam1l6Vjm7MeDrVnDwHZ7hLOb9TyQolB5wFOl4vlPvU jRSDD9lmJpLZ3J4QlsuHLSupWPJ6uHk= From: Paul Cercueil To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil , Jonathan Cameron , Vladimir Zapolskiy , linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 11/22] i2c: lpc2k: Remove #ifdef guards for PM related functions Date: Sat, 22 Jul 2023 13:50:35 +0200 Message-Id: <20230722115046.27323-12-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: 1772123708728687517 X-GMAIL-MSGID: 1772123708728687517 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 Reviewed-by: Jonathan Cameron --- Cc: Vladimir Zapolskiy Cc: linux-arm-kernel@lists.infradead.org --- drivers/i2c/busses/i2c-lpc2k.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/i2c/busses/i2c-lpc2k.c b/drivers/i2c/busses/i2c-lpc2k.c index 5c6d96554753..c61157f1409b 100644 --- a/drivers/i2c/busses/i2c-lpc2k.c +++ b/drivers/i2c/busses/i2c-lpc2k.c @@ -431,7 +431,6 @@ static void i2c_lpc2k_remove(struct platform_device *dev) i2c_del_adapter(&i2c->adap); } -#ifdef CONFIG_PM static int i2c_lpc2k_suspend(struct device *dev) { struct lpc2k_i2c *i2c = dev_get_drvdata(dev); @@ -456,11 +455,6 @@ static const struct dev_pm_ops i2c_lpc2k_dev_pm_ops = { .resume_noirq = i2c_lpc2k_resume, }; -#define I2C_LPC2K_DEV_PM_OPS (&i2c_lpc2k_dev_pm_ops) -#else -#define I2C_LPC2K_DEV_PM_OPS NULL -#endif - static const struct of_device_id lpc2k_i2c_match[] = { { .compatible = "nxp,lpc1788-i2c" }, {}, @@ -472,7 +466,7 @@ static struct platform_driver i2c_lpc2k_driver = { .remove_new = i2c_lpc2k_remove, .driver = { .name = "lpc2k-i2c", - .pm = I2C_LPC2K_DEV_PM_OPS, + .pm = pm_sleep_ptr(&i2c_lpc2k_dev_pm_ops), .of_match_table = lpc2k_i2c_match, }, };