Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp29874359rwd; Wed, 5 Jul 2023 19:51:13 -0700 (PDT) X-Google-Smtp-Source: APBJJlEpZwSX1Q58vXDQIg1a54uAaQqryvUqkYPiuJPp9B2KzZlrpBhADBq97TcAG2uOP+VUHW6w X-Received: by 2002:a05:620a:4048:b0:767:81e5:566 with SMTP id i8-20020a05620a404800b0076781e50566mr546846qko.58.1688611873552; Wed, 05 Jul 2023 19:51:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688611873; cv=none; d=google.com; s=arc-20160816; b=eCul5uyNTbmINTRS9pO8XpTCd+VaPDuWR+UmN++7CWdlVA004sTXVW+NugM+LsqQPZ kdeRyMYiKsOHkHRVt/YEEugYzuCeyj8xnhtpFGHi7gp71fQRsv57Msip5jw+PhZGd/4c NMsbsoxEYzgse3X2I4BMp6SDKwEmsVHdc+nigFHXLXjDKruueYLmrBDYlkCSYfZ6BwtJ JYmNjVy/1hOW70L3jrD4Fz+nkgKdo4moKfiR0GcyLiki4UKrivLA19aoHcIM1rLRepw+ gG+KclsE1jTSoOPrqevEgCDIb4sC1F7dINfsBcbLkJ7mG1i5GTR4cWuTfrWlXddJi4iR NtXg== 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 :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=pdrjRBL+BR0PXqh3YRXnJGQDgZyLFSgJaOilZj35wFY=; fh=AoBKDoIYWkthvv09cUrKZT1LFNrp4ZHx0OnI/Rn+iiA=; b=bntBUWbA808e/guuy1nv74ctQFwbn58akltRkHgVjcUtJUuVI0Dv8bveaErvPAgAdr pRqhYnLcFY66WENYOjetPiCmjvMpxls5Rbk1mJ+qi/lurcTYi08h6hinxlfylm9JSqOe P8AB2JxEFG2MvNoX9ALJQNPv3uIDK0tryf+O6kzNLoWhhuVV9HVchehAI5syJLl7AG0R tgGBNxrCULXhGcegv+Ih2ZCre+ivVMyRqKg0wbcAxcPvlt7DBkflOrTYEloVDfiPF5oL RpEVEejtzW32LGFG7InwyP2Wd6UWglBok1m4bKVtHlr7io/ZChSQYxQF+yRHC8+r+KBW QaSw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j13-20020a62b60d000000b0068104e45e1csi442286pff.236.2023.07.05.19.50.59; Wed, 05 Jul 2023 19:51:13 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232166AbjGFCbn (ORCPT + 99 others); Wed, 5 Jul 2023 22:31:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229661AbjGFCbm (ORCPT ); Wed, 5 Jul 2023 22:31:42 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15DF2DA; Wed, 5 Jul 2023 19:31:41 -0700 (PDT) Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4QxL6l41pwz67KNf; Thu, 6 Jul 2023 10:28:15 +0800 (CST) Received: from localhost (10.34.206.101) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Thu, 6 Jul 2023 03:31:37 +0100 Date: Thu, 6 Jul 2023 10:31:33 +0800 From: Jonathan Cameron To: Paul Cercueil CC: Wolfram Sang , , Subject: Re: [PATCH 10/23] i2c: img-scb: Remove #ifdef guards for PM related functions Message-ID: <20230706103133.00006b5f@Huawei.com> In-Reply-To: <20230705204314.89800-11-paul@crapouillou.net> References: <20230705204314.89800-1-paul@crapouillou.net> <20230705204314.89800-11-paul@crapouillou.net> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.34.206.101] X-ClientProxiedBy: lhrpeml500001.china.huawei.com (7.191.163.213) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Wed, 5 Jul 2023 22:43:01 +0200 Paul Cercueil wrote: > 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 I thought the _DEFINE macros weren't really intended for driver usage and it's good to keep the ability to change those details without updating lots of drivers. Perhaps just express it long hand here? Jonathan > --- > drivers/i2c/busses/i2c-img-scb.c | 13 ++++--------- > 1 file changed, 4 insertions(+), 9 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-img-scb.c b/drivers/i2c/busses/i2c-img-scb.c > index 4b674cfbc6fb..a92e3082542e 100644 > --- a/drivers/i2c/busses/i2c-img-scb.c > +++ b/drivers/i2c/busses/i2c-img-scb.c > @@ -1454,7 +1454,6 @@ static int img_i2c_runtime_resume(struct device *dev) > return 0; > } > > -#ifdef CONFIG_PM_SLEEP > static int img_i2c_suspend(struct device *dev) > { > struct img_i2c *i2c = dev_get_drvdata(dev); > @@ -1482,14 +1481,10 @@ static int img_i2c_resume(struct device *dev) > > return 0; > } > -#endif /* CONFIG_PM_SLEEP */ > > -static const struct dev_pm_ops img_i2c_pm = { > - SET_RUNTIME_PM_OPS(img_i2c_runtime_suspend, > - img_i2c_runtime_resume, > - NULL) > - SET_SYSTEM_SLEEP_PM_OPS(img_i2c_suspend, img_i2c_resume) > -}; > +static _DEFINE_DEV_PM_OPS(img_i2c_pm, img_i2c_suspend, img_i2c_resume, > + img_i2c_runtime_suspend, img_i2c_runtime_resume, > + NULL); > > static const struct of_device_id img_scb_i2c_match[] = { > { .compatible = "img,scb-i2c" }, > @@ -1501,7 +1496,7 @@ static struct platform_driver img_scb_i2c_driver = { > .driver = { > .name = "img-i2c-scb", > .of_match_table = img_scb_i2c_match, > - .pm = &img_i2c_pm, > + .pm = pm_ptr(&img_i2c_pm), > }, > .probe = img_i2c_probe, > .remove_new = img_i2c_remove,