linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: <linux-arm-kernel@lists.infradead.org>,
	<linux-spi@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Daniel Mack <daniel@zonque.org>,
	"Haojian Zhuang" <haojian.zhuang@gmail.com>,
	Robert Jarzmik <robert.jarzmik@free.fr>,
	Mark Brown <broonie@kernel.org>
Subject: Re: [PATCH v1 6/6] spi: pxa2xx: Switch from PM ifdeffery to pm_ptr()
Date: Tue, 18 Oct 2022 10:14:52 +0100	[thread overview]
Message-ID: <20221018101452.0000001c@huawei.com> (raw)
In-Reply-To: <20221017171243.57078-6-andriy.shevchenko@linux.intel.com>

On Mon, 17 Oct 2022 20:12:43 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> 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 <andriy.shevchenko@linux.intel.com>
FWIW I like these - so drive by review.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

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),
>  	},


  parent reply	other threads:[~2022-10-18  9:15 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-17 17:12 [PATCH v1 1/6] spi: pxa2xx: Simplify with devm_platform_get_and_ioremap_resource() Andy Shevchenko
2022-10-17 17:12 ` [PATCH v1 2/6] spi: pxa2xx: Respect Intel SSP type given by a property Andy Shevchenko
2022-10-17 17:17   ` Mark Brown
2022-10-17 17:34     ` Andy Shevchenko
2022-10-17 17:12 ` [PATCH v1 3/6] spi: pxa2xx: Remove no more needed PCI ID table Andy Shevchenko
2022-10-17 17:18   ` Mark Brown
2022-10-17 17:35     ` Andy Shevchenko
2022-10-17 17:39       ` Mark Brown
2022-10-17 17:41         ` Andy Shevchenko
2022-10-18 11:42           ` Mark Brown
2022-10-19 15:06             ` Andy Shevchenko
2022-10-19 15:50               ` Mark Brown
2022-10-20 16:18                 ` Andy Shevchenko
2022-10-20 16:25                   ` Mark Brown
2022-10-20 16:42                     ` Andy Shevchenko
2022-10-20 16:58                       ` Mark Brown
2022-10-20 17:03                         ` Andy Shevchenko
2022-10-20 17:26                           ` Mark Brown
2022-10-20 17:41                             ` Andy Shevchenko
2022-10-20 17:45                               ` Mark Brown
2022-10-20 17:55                                 ` Andy Shevchenko
2022-10-20 18:07                                   ` Mark Brown
2022-10-20 18:19                                     ` Andy Shevchenko
2022-10-21 10:42                                       ` Mark Brown
2022-10-21 10:51                                         ` Andy Shevchenko
2022-10-21 10:59                                           ` Mark Brown
2022-10-21 11:15                                             ` Andy Shevchenko
2022-10-21 12:28                                               ` Mark Brown
2022-10-21 12:46                                                 ` Andy Shevchenko
2022-10-17 17:42         ` Mark Brown
2022-10-17 17:12 ` [PATCH v1 4/6] spi: pxa2xx: Remove no more needed driver data Andy Shevchenko
2022-10-17 17:12 ` [PATCH v1 5/6] spi: pxa2xx: Move OF and ACPI ID tables closer to their user Andy Shevchenko
2022-10-18  9:16   ` Jonathan Cameron
2022-10-17 17:12 ` [PATCH v1 6/6] spi: pxa2xx: Switch from PM ifdeffery to pm_ptr() Andy Shevchenko
2022-10-17 17:19   ` Mark Brown
2022-10-17 17:35     ` Andy Shevchenko
2022-10-18  9:14   ` Jonathan Cameron [this message]
2022-10-18 12:23     ` Andy Shevchenko
2022-10-19 12:05 ` (subset) [PATCH v1 1/6] spi: pxa2xx: Simplify with devm_platform_get_and_ioremap_resource() Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221018101452.0000001c@huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=daniel@zonque.org \
    --cc=haojian.zhuang@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=robert.jarzmik@free.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).