From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2AE84C4332F for ; Tue, 18 Oct 2022 09:16:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Subject:CC:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=n4v+LTrHeJvKZElftC1FeDanjwn1qixr40LhhK7b0P4=; b=ymi6+sUGHfSLgQ GdGU+J3AgmbwVOAldqu/sjDw2Dq4Yq97vJg724Ch0VVqrVH1WSG60gXJwzHfMSOI1bvTw+4mmAVrZ StaSNBbawEt0/ZPp3aSZOh+PKBRTFd0OCJD4UFyITlTP2z20Ipm3wmSR5PS7Nsmi/jfWlEhMVhe+a v0UZVbGTrfkwoh+d7OwCcHekVHsxt/F9qGbUdrIxRB5ZZ12dx7VNWi8LPR+qISNXt4NR4vKUm+hg6 5DUKz7FDV5r3VwQEhbdY9XwDbLSgn1Kqc2F1Mg9Y7pTb1SvrtTzW1+Nsmu1/+FRc8Gowzx5Jm074J qksGGP6a6bM8zETyfR1A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1okign-004nxo-Q4; Tue, 18 Oct 2022 09:15:09 +0000 Received: from frasgout.his.huawei.com ([185.176.79.56]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1okigk-004nu4-0j for linux-arm-kernel@lists.infradead.org; Tue, 18 Oct 2022 09:15:08 +0000 Received: from fraeml712-chm.china.huawei.com (unknown [172.18.147.206]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Ms7Qn1lQ3z67NLc; Tue, 18 Oct 2022 17:11:45 +0800 (CST) Received: from lhrpeml500005.china.huawei.com (7.191.163.240) by fraeml712-chm.china.huawei.com (10.206.15.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 18 Oct 2022 11:14:53 +0200 Received: from localhost (10.202.226.42) 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.2375.31; Tue, 18 Oct 2022 10:14:53 +0100 Date: Tue, 18 Oct 2022 10:14:52 +0100 From: Jonathan Cameron To: Andy Shevchenko CC: , , , Daniel Mack , "Haojian Zhuang" , Robert Jarzmik , Mark Brown Subject: Re: [PATCH v1 6/6] spi: pxa2xx: Switch from PM ifdeffery to pm_ptr() Message-ID: <20221018101452.0000001c@huawei.com> In-Reply-To: <20221017171243.57078-6-andriy.shevchenko@linux.intel.com> References: <20221017171243.57078-1-andriy.shevchenko@linux.intel.com> <20221017171243.57078-6-andriy.shevchenko@linux.intel.com> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.29; i686-w64-mingw32) MIME-Version: 1.0 X-Originating-IP: [10.202.226.42] X-ClientProxiedBy: lhrpeml100004.china.huawei.com (7.191.162.219) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221018_021506_375488_35ABC8A3 X-CRM114-Status: GOOD ( 21.83 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 17 Oct 2022 20:12:43 +0300 Andy Shevchenko wrote: > Cleaning up the driver to use pm_ptr() macro instead of ifdeffery > that makes it simpler and allows the compiler to remove those functions > if built without CONFIG_PM and CONFIG_PM_SLEEP support. > > Signed-off-by: Andy Shevchenko FWIW I like these - so drive by review. Reviewed-by: Jonathan Cameron I think you could change the handling of !pm_runtime_suspended() to use pm_runtime_force_suspend() and equivalent for resume path. I haven't checked that closely though - just looks like a typical usecase for those functions that are hardened against some of the corner cases that can occur in interactions between different forms of pm. > --- > drivers/spi/spi-pxa2xx.c | 11 +++-------- > 1 file changed, 3 insertions(+), 8 deletions(-) > > diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c > index 76046612466d..60cab241200b 100644 > --- a/drivers/spi/spi-pxa2xx.c > +++ b/drivers/spi/spi-pxa2xx.c > @@ -1680,7 +1680,6 @@ static int pxa2xx_spi_remove(struct platform_device *pdev) > return 0; > } > > -#ifdef CONFIG_PM_SLEEP > static int pxa2xx_spi_suspend(struct device *dev) > { > struct driver_data *drv_data = dev_get_drvdata(dev); > @@ -1715,9 +1714,7 @@ static int pxa2xx_spi_resume(struct device *dev) > /* Start the queue running */ > return spi_controller_resume(drv_data->controller); > } > -#endif > > -#ifdef CONFIG_PM > static int pxa2xx_spi_runtime_suspend(struct device *dev) > { > struct driver_data *drv_data = dev_get_drvdata(dev); > @@ -1732,12 +1729,10 @@ static int pxa2xx_spi_runtime_resume(struct device *dev) > > return clk_prepare_enable(drv_data->ssp->clk); > } > -#endif > > static const struct dev_pm_ops pxa2xx_spi_pm_ops = { > - SET_SYSTEM_SLEEP_PM_OPS(pxa2xx_spi_suspend, pxa2xx_spi_resume) > - SET_RUNTIME_PM_OPS(pxa2xx_spi_runtime_suspend, > - pxa2xx_spi_runtime_resume, NULL) > + SYSTEM_SLEEP_PM_OPS(pxa2xx_spi_suspend, pxa2xx_spi_resume) > + RUNTIME_PM_OPS(pxa2xx_spi_runtime_suspend, pxa2xx_spi_runtime_resume, NULL) > }; > > #ifdef CONFIG_ACPI > @@ -1762,7 +1757,7 @@ MODULE_DEVICE_TABLE(of, pxa2xx_spi_of_match); > static struct platform_driver driver = { > .driver = { > .name = "pxa2xx-spi", > - .pm = &pxa2xx_spi_pm_ops, > + .pm = pm_ptr(&pxa2xx_spi_pm_ops), > .acpi_match_table = ACPI_PTR(pxa2xx_spi_acpi_match), > .of_match_table = of_match_ptr(pxa2xx_spi_of_match), > }, _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel