Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp29883763rwd; Wed, 5 Jul 2023 20:03:02 -0700 (PDT) X-Google-Smtp-Source: APBJJlGnZfRmi03gvBRfaMimjADz4v57jYxnODyhpTqLK0kOf9kiBNBL2BCoWYyKCTqk5Y3GrBSp X-Received: by 2002:a05:6808:6cd:b0:3a3:5f8c:ac0d with SMTP id m13-20020a05680806cd00b003a35f8cac0dmr364168oih.22.1688612582228; Wed, 05 Jul 2023 20:03:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688612582; cv=none; d=google.com; s=arc-20160816; b=R2BrN7CQX2KBMY0xwleHLqM+n2g0E+uOeVJ1GKKSilW6I8PGgmLvUa6DIhRZUM6Ub1 Z9hZZ9PKd1DfM+PXvbVY+JC23dN+Pr93n8K6mCraFtTeYgz3ZSXpfHr2RhBGLfcFnWKd UjCBR0mqPMIkX6/rO67JBVfXgLHd6URHROD6zdunJNvXHIU7Uk15ajpo2+pQD5/wurDN hQSGn4GDLBKa0kGGhOaAukph5xkZtVFYU9yJQ1G5ruKz/JvqS+VckIVbqKHWkwFQDXcw /EOBcrBJ39C2nN3RWSfdFzFtf94iEDAXgFdkoNIvorhosR5BTOyZNF0JAiZuNAR6ORKc t+Tw== 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=Eo4C1il/JoFtX0zrDSG8UvzvlF6Ewg5rPCSRnZBs6F0=; fh=AoBKDoIYWkthvv09cUrKZT1LFNrp4ZHx0OnI/Rn+iiA=; b=FCFwTZxzEJizYWj4UPWecsGCsG28Dme+8SmVmEVXLtGhlgSOso32br5bvaDezqwHpR vBOnNbZ2x9q2Rfj1gZZ3YakUvITLTnIghMMzcpRL8JRSN0HsbqRUa7xOub9Hqef5DOTn 9GtOFCp2kQ1YJlmB6UoPY8cAwLa+fHFj6qaUzfwOUggNrfT1TNje4/06UDLmS3UaD8bV VIcPWz1gIwuEZge/l9pAQJRtHAYHVfXYWx7gVtIzvrv4bYq/faWqsnQd9DPK/AIJGKtV wiHfXR4vckg726Zj/GkmcKv5mDMniQDiyeBPuu4Lgmh7AGRlz3by6bn9NIygQK+jPOxb FXrA== 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 f3-20020a631f03000000b0051394ccd19csi572885pgf.55.2023.07.05.20.02.46; Wed, 05 Jul 2023 20:03:02 -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 S233016AbjGFChr (ORCPT + 99 others); Wed, 5 Jul 2023 22:37:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229632AbjGFChq (ORCPT ); Wed, 5 Jul 2023 22:37:46 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E003199E; Wed, 5 Jul 2023 19:37:45 -0700 (PDT) Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4QxLFl5mgpz67HqD; Thu, 6 Jul 2023 10:34:19 +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:37:41 +0100 Date: Thu, 6 Jul 2023 10:37:37 +0800 From: Jonathan Cameron To: Paul Cercueil CC: Wolfram Sang , , Subject: Re: [PATCH 11/23] i2c: kempld: Remove #ifdef guards for PM related functions Message-ID: <20230706103737.00007497@Huawei.com> In-Reply-To: <20230705204314.89800-12-paul@crapouillou.net> References: <20230705204314.89800-1-paul@crapouillou.net> <20230705204314.89800-12-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: lhrpeml100001.china.huawei.com (7.191.160.183) 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:02 +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. > > Note that the driver should most likely be updated to use the > platform_driver.driver.pm.{suspend,resume} callbacks. Agreed. In this particular case I'd be tempted to do that first so that we don't introduce pm_ptr() usage for these hooks. Look at the platform device core, I suspect they should be pm_sleep_ptr() but not 100% sure. Jonathan > > Signed-off-by: Paul Cercueil > --- > drivers/i2c/busses/i2c-kempld.c | 9 ++------- > 1 file changed, 2 insertions(+), 7 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-kempld.c b/drivers/i2c/busses/i2c-kempld.c > index 281058e3ea46..cb61e7b9202c 100644 > --- a/drivers/i2c/busses/i2c-kempld.c > +++ b/drivers/i2c/busses/i2c-kempld.c > @@ -350,7 +350,6 @@ static void kempld_i2c_remove(struct platform_device *pdev) > i2c_del_adapter(&i2c->adap); > } > > -#ifdef CONFIG_PM > static int kempld_i2c_suspend(struct platform_device *pdev, pm_message_t state) > { > struct kempld_i2c_data *i2c = platform_get_drvdata(pdev); > @@ -377,10 +376,6 @@ static int kempld_i2c_resume(struct platform_device *pdev) > > return 0; > } > -#else > -#define kempld_i2c_suspend NULL > -#define kempld_i2c_resume NULL > -#endif > > static struct platform_driver kempld_i2c_driver = { > .driver = { > @@ -388,8 +383,8 @@ static struct platform_driver kempld_i2c_driver = { > }, > .probe = kempld_i2c_probe, > .remove_new = kempld_i2c_remove, > - .suspend = kempld_i2c_suspend, > - .resume = kempld_i2c_resume, > + .suspend = pm_ptr(kempld_i2c_suspend), > + .resume = pm_ptr(kempld_i2c_resume), > }; > > module_platform_driver(kempld_i2c_driver);