Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp1018332rwo; Sat, 22 Jul 2023 05:11:04 -0700 (PDT) X-Google-Smtp-Source: APBJJlG5mvN/B1DrgKHUA4z0c5/K27U50sJIx29oQCMviN4nZupuSRgCxVoepgiPLe7I1nuolvyu X-Received: by 2002:a17:90a:8a89:b0:268:420:61c3 with SMTP id x9-20020a17090a8a8900b00268042061c3mr27496pjn.43.1690027864609; Sat, 22 Jul 2023 05:11:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690027864; cv=none; d=google.com; s=arc-20160816; b=ciaIudaf8PP7yYOptzg8HsBqB37LDSAZT/PvIj6iJ9JzbqCDh2WR20ft6s5c5KgogW H8NI9d8ebU9oF8DYTO7qUm9P8po/JKIdFDfhz3vVHX4fp8aSw3v/uepilqQhuHtObv7O BGq6MbgatIoSP9rqYlRm3lX/esZOg+RJ+pZQKKYiqSOtDstnlAUgsr+sYsUNbYtgCcOe MCSRWlfDNda6E0QiDah33RPryYxI5b1PQrn7O/GYO4ZdtEhb7aklrzVuJC0naHV6AgHA Nm3r1iTBYmya8IGmHKqqc1tKDKJHzumgoxDrGhPA3EztfP2sX65wUprNj4ym8LNDepIw WnLw== 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=TfQRq1hemavY+YX0FEbEmN3TekAHVwUrnPJMhDDzA/k=; fh=WaQYlaN5vX3IDavTkTtoFN25f59w3IMq7xcfsVS1pY0=; b=YDWpqZNbS0+MZp/j5mLkIx1135ovFNpR0xa01jn/P3CUH5vIRTHnkpKudVGMmDoMFD Gn+AxC0I/1iCflCzm4ehb82NIjcAKioJ29O4nlbF5AZPMAlXwOIbSNpZk0wPx/GHICiR GF62xmO9MasGoJY5WOfblk7zwPQIqgQo8HLypOQUF4utz9K3YTsV4Vwhg29Iav7gqT+6 475IKp2t/P8USSLpCKYQ08/WhGC9NSaCMiJRonrGQqOlIMQMZ9zH8U8zyJetIwyOEUhS QXqTVWQuRNQYS8ujQWuvPm9OH4fU//lFkPthhjOR6c0xks2NtZhgH+u3mrdRdlK9QUbf Fk3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b="WY/igbIy"; 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 nl10-20020a17090b384a00b0025bcbba10c6si5688235pjb.85.2023.07.22.05.10.51; Sat, 22 Jul 2023 05:11:04 -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="WY/igbIy"; 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 S230237AbjGVL5O (ORCPT + 99 others); Sat, 22 Jul 2023 07:57:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230137AbjGVL5L (ORCPT ); Sat, 22 Jul 2023 07:57:11 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EF282D6D; Sat, 22 Jul 2023 04:56:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1690026686; 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=TfQRq1hemavY+YX0FEbEmN3TekAHVwUrnPJMhDDzA/k=; b=WY/igbIyaZc/ejPjOv7Z2UDJVmXXfMMdntziAbpepvVzLhCyA1uOf1Xz3c1PEQSvtuG7XR /mQHzOpitHgLX7Qo8yr9AOw4puVOnbuJuevFe+d7UnaefTyZzrexLgbDPgiuUVcA4Lue7t mZ5kokvPPVt6YTVQsJkYZU0b0izmIzs= 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 15/22] i2c: pnx: Remove #ifdef guards for PM related functions Date: Sat, 22 Jul 2023 13:50:39 +0200 Message-Id: <20230722115046.27323-16-paul@crapouillou.net> In-Reply-To: <20230722115046.27323-1-paul@crapouillou.net> References: <20230722115046.27323-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. Signed-off-by: Paul Cercueil Reviewed-by: Jonathan Cameron --- Cc: Vladimir Zapolskiy Cc: linux-arm-kernel@lists.infradead.org --- drivers/i2c/busses/i2c-pnx.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c index 82400057f810..4ee7db512333 100644 --- a/drivers/i2c/busses/i2c-pnx.c +++ b/drivers/i2c/busses/i2c-pnx.c @@ -613,7 +613,6 @@ static const struct i2c_algorithm pnx_algorithm = { .functionality = i2c_pnx_func, }; -#ifdef CONFIG_PM_SLEEP static int i2c_pnx_controller_suspend(struct device *dev) { struct i2c_pnx_algo_data *alg_data = dev_get_drvdata(dev); @@ -630,12 +629,9 @@ static int i2c_pnx_controller_resume(struct device *dev) return clk_prepare_enable(alg_data->clk); } -static SIMPLE_DEV_PM_OPS(i2c_pnx_pm, - i2c_pnx_controller_suspend, i2c_pnx_controller_resume); -#define PNX_I2C_PM (&i2c_pnx_pm) -#else -#define PNX_I2C_PM NULL -#endif +static DEFINE_SIMPLE_DEV_PM_OPS(i2c_pnx_pm, + i2c_pnx_controller_suspend, + i2c_pnx_controller_resume); static int i2c_pnx_probe(struct platform_device *pdev) { @@ -763,7 +759,7 @@ static struct platform_driver i2c_pnx_driver = { .driver = { .name = "pnx-i2c", .of_match_table = of_match_ptr(i2c_pnx_of_match), - .pm = PNX_I2C_PM, + .pm = pm_sleep_ptr(&i2c_pnx_pm), }, .probe = i2c_pnx_probe, .remove_new = i2c_pnx_remove, -- 2.40.1