Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp29589140rwd; Wed, 5 Jul 2023 14:20:41 -0700 (PDT) X-Google-Smtp-Source: APBJJlFRt5xZwPqK5lwN2XI2P072BqMef2jng4eukBnEdiKobAun9+735QGF5gk/IsQtJHVbJ2UJ X-Received: by 2002:a17:90b:f85:b0:262:ffd2:ced with SMTP id ft5-20020a17090b0f8500b00262ffd20cedmr27606pjb.0.1688592041570; Wed, 05 Jul 2023 14:20:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688592041; cv=none; d=google.com; s=arc-20160816; b=0IHo5BiR/qOeeDzZfuSW8mrJxm2v0HxI930ZT4n/MPqTwZe0xa22HBuYmGlIEewDEn vzIMFNiWyZ767DgtEFIaGFR0L/K9xPC7A3yzbtoDvSU8ka+I+wiOeEiBCPF9H2DpNEQS 5mk5GAPya0FVTsK84cITzjXIIYiH7GmS0GkNWsmBAFXOhmWgFY1j6vPaBN4Nofp1J3/r 4gho7E2E2ExS/VI7x8Yb/+MAeCVztRFqHl5vFPVfZ6l7HbeI3ehie9uxSWWGmw2K2uON AfYJS8csnW4D524PrHiizCEJE8yzjRHP3G+ulXSiIUV7tcdW1Yync6c/egf5YwOg0Fm7 AKuw== 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=d3aQXAnkhZ7Mg6y01d2N6oWlFlsuT62QoVsGZrNeIxk=; fh=v+C2F6RTDIzrS9Ux8Pl2bn5O909fj/y+5SCz+NEBsC8=; b=Oi6uo7ovyx572AubQwpk7k6joTUrsCvuzPI0wZW/WXYnflxTf778Xo/ZMn/cy0Bk5q Xm43Dms/0aXZ6vMAFEymrrutnfzJHiNbRBk2u4AbcJY2FQyXaVKGhsfRtqmYjzAvdC5x 9LMkjOUuptQ1P3Z3yoCj+Xpr6jv/IJtwUcsRzS7fLIjBxl15x6flPdntp0nu+oQvEmuZ qH1UJ0bYOb/kny8e5zk4gWVH+yND9QZ0Awxa88inKuEJxD97XBD0Ry04gpEZvTtCrb5X A9US7RhesqbA3PQ2Bpy2IlEnrFrTv3rtMbagrLNk6xDs5XCo8+59aJU2sxb3dhiQFKII 1N6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=MgTj5abI; 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 u1-20020a17090ae00100b002611518b4aesi106932pjy.101.2023.07.05.14.20.27; Wed, 05 Jul 2023 14:20:41 -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=MgTj5abI; 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 S233818AbjGEUnz (ORCPT + 99 others); Wed, 5 Jul 2023 16:43:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233849AbjGEUnx (ORCPT ); Wed, 5 Jul 2023 16:43:53 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BBBCB19B9; Wed, 5 Jul 2023 13:43:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1688589813; 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=d3aQXAnkhZ7Mg6y01d2N6oWlFlsuT62QoVsGZrNeIxk=; b=MgTj5abITfTAufGMnC+BqQbsKTxpvUHjaXv6rUIZniEvz368kOpI424x+JDFERQSnp8Gly m7lJ2gXzEJBBtwfQKqKgbyMUKoc94zUV77reozfs/9B2uvY+5eWfMdCTkj2xrR9Kc7DU1F 6IMaPF3jEoSo6kfWKhmJ3ojevciAfdw= From: Paul Cercueil To: Wolfram Sang Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH 02/23] i2c: au1550: Remove #ifdef guards for PM related functions Date: Wed, 5 Jul 2023 22:42:53 +0200 Message-Id: <20230705204314.89800-3-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 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 --- drivers/i2c/busses/i2c-au1550.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/drivers/i2c/busses/i2c-au1550.c b/drivers/i2c/busses/i2c-au1550.c index e66c12ecf270..8e43f25c117e 100644 --- a/drivers/i2c/busses/i2c-au1550.c +++ b/drivers/i2c/busses/i2c-au1550.c @@ -342,7 +342,6 @@ static void i2c_au1550_remove(struct platform_device *pdev) i2c_au1550_disable(priv); } -#ifdef CONFIG_PM static int i2c_au1550_suspend(struct device *dev) { struct i2c_au1550_data *priv = dev_get_drvdata(dev); @@ -361,21 +360,13 @@ static int i2c_au1550_resume(struct device *dev) return 0; } -static const struct dev_pm_ops i2c_au1550_pmops = { - .suspend = i2c_au1550_suspend, - .resume = i2c_au1550_resume, -}; - -#define AU1XPSC_SMBUS_PMOPS (&i2c_au1550_pmops) - -#else -#define AU1XPSC_SMBUS_PMOPS NULL -#endif +static DEFINE_SIMPLE_DEV_PM_OPS(i2c_au1550_pmops, + i2c_au1550_suspend, i2c_au1550_resume); static struct platform_driver au1xpsc_smbus_driver = { .driver = { .name = "au1xpsc_smbus", - .pm = AU1XPSC_SMBUS_PMOPS, + .pm = pm_sleep_ptr(&i2c_au1550_pmops), }, .probe = i2c_au1550_probe, .remove_new = i2c_au1550_remove, -- 2.40.1