mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexander Dahl <ada@thorsis.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Cc: Mark Brown <broonie@kernel.org>,
	Nicolas Ferre <nicolas.ferre@microchip.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Claudiu Beznea <claudiu.beznea@tuxon.dev>,
	linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] spi: atmel-quadspi: Simplify probe() with local 'dev' variable
Date: Mon, 6 Jul 2026 12:58:31 +0200	[thread overview]
Message-ID: <20260706-plunder-fencing-b9ca15ef05ae@thorsis.com> (raw)
In-Reply-To: <20260705172737.120095-4-krzysztof.kozlowski@oss.qualcomm.com>

Hello Krzysztof,

I think you missed some.  At least the two outlined below, but maybe
more which are not part of the lines covered by the patch?

Am Sun, Jul 05, 2026 at 07:27:38PM +0200 schrieb Krzysztof Kozlowski:
> Instead of multiple '&pdev->dev' dereferences, just use a local 'dev'
> variable which makes multiple function calls shorter thus easier to
> follow.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
> ---
>  drivers/spi/atmel-quadspi.c | 37 +++++++++++++++++++------------------
>  1 file changed, 19 insertions(+), 18 deletions(-)
> 
> diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c
> index aaf7f4c46b22..8d9c77f5de43 100644
> --- a/drivers/spi/atmel-quadspi.c
> +++ b/drivers/spi/atmel-quadspi.c
> @@ -1347,20 +1347,21 @@ static const struct atmel_qspi_ops atmel_qspi_sama7g5_ops = {
>  
>  static int atmel_qspi_probe(struct platform_device *pdev)
>  {
> +	struct device *dev = &pdev->dev;
>  	struct spi_controller *ctrl;
>  	struct atmel_qspi *aq;
>  	struct resource *res;
>  	int irq, err = 0;
>  
> -	ctrl = devm_spi_alloc_host(&pdev->dev, sizeof(*aq));
> +	ctrl = devm_spi_alloc_host(dev, sizeof(*aq));
>  	if (!ctrl)
>  		return -ENOMEM;
>  
>  	aq = spi_controller_get_devdata(ctrl);
>  
> -	aq->caps = of_device_get_match_data(&pdev->dev);
> +	aq->caps = of_device_get_match_data(dev);
>  	if (!aq->caps) {
> -		dev_err(&pdev->dev, "Could not retrieve QSPI caps\n");
> +		dev_err(dev, "Could not retrieve QSPI caps\n");
>  		return -EINVAL;
>  	}
>  
> @@ -1387,31 +1388,31 @@ static int atmel_qspi_probe(struct platform_device *pdev)
>  	/* Map the registers */
>  	aq->regs = devm_platform_ioremap_resource_byname(pdev, "qspi_base");
>  	if (IS_ERR(aq->regs))
> -		return dev_err_probe(&pdev->dev, PTR_ERR(aq->regs),
> +		return dev_err_probe(dev, PTR_ERR(aq->regs),
>  				     "missing registers\n");
>  
>  	/* Map the AHB memory */
>  	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "qspi_mmap");
> -	aq->mem = devm_ioremap_resource(&pdev->dev, res);
> +	aq->mem = devm_ioremap_resource(dev, res);
>  	if (IS_ERR(aq->mem))
> -		return dev_err_probe(&pdev->dev, PTR_ERR(aq->mem),
> +		return dev_err_probe(dev, PTR_ERR(aq->mem),
>  				     "missing AHB memory\n");
>  
>  	aq->mmap_size = resource_size(res);
>  	aq->mmap_phys_base = (dma_addr_t)res->start;
>  
>  	/* Get the peripheral clock */
> -	aq->pclk = devm_clk_get_enabled(&pdev->dev, "pclk");
> +	aq->pclk = devm_clk_get_enabled(dev, "pclk");
>  	if (IS_ERR(aq->pclk))
> -		aq->pclk = devm_clk_get_enabled(&pdev->dev, NULL);
> +		aq->pclk = devm_clk_get_enabled(dev, NULL);
>  
>  	if (IS_ERR(aq->pclk))
> -		return dev_err_probe(&pdev->dev, PTR_ERR(aq->pclk),
> +		return dev_err_probe(dev, PTR_ERR(aq->pclk),
>  				     "missing peripheral clock\n");
>  
>  	if (aq->caps->has_qspick) {
>  		/* Get the QSPI system clock */
> -		aq->qspick = devm_clk_get_enabled(&pdev->dev, "qspick");
> +		aq->qspick = devm_clk_get_enabled(dev, "qspick");
>  		if (IS_ERR(aq->qspick)) {
>  			dev_err(&pdev->dev, "missing system clock\n");

Here.

>  			err = PTR_ERR(aq->qspick);
> @@ -1420,7 +1421,7 @@ static int atmel_qspi_probe(struct platform_device *pdev)
>  
>  	} else if (aq->caps->has_gclk) {
>  		/* Get the QSPI generic clock */
> -		aq->gclk = devm_clk_get(&pdev->dev, "gclk");
> +		aq->gclk = devm_clk_get(dev, "gclk");
>  		if (IS_ERR(aq->gclk)) {
>  			dev_err(&pdev->dev, "missing Generic clock\n");

Here.

>  			err = PTR_ERR(aq->gclk);
> @@ -1439,15 +1440,15 @@ static int atmel_qspi_probe(struct platform_device *pdev)
>  	if (irq < 0)
>  		return irq;
>  
> -	err = devm_request_irq(&pdev->dev, irq, atmel_qspi_interrupt,
> -			       0, dev_name(&pdev->dev), aq);
> +	err = devm_request_irq(dev, irq, atmel_qspi_interrupt,
> +			       0, dev_name(dev), aq);
>  	if (err)
>  		return err;
>  
> -	pm_runtime_set_autosuspend_delay(&pdev->dev, 500);
> -	pm_runtime_use_autosuspend(&pdev->dev);
> -	devm_pm_runtime_set_active_enabled(&pdev->dev);
> -	devm_pm_runtime_get_noresume(&pdev->dev);
> +	pm_runtime_set_autosuspend_delay(dev, 500);
> +	pm_runtime_use_autosuspend(dev);
> +	devm_pm_runtime_set_active_enabled(dev);
> +	devm_pm_runtime_get_noresume(dev);
>  
>  	err = atmel_qspi_init(aq);
>  	if (err)
> @@ -1457,7 +1458,7 @@ static int atmel_qspi_probe(struct platform_device *pdev)
>  	if (err)
>  		return err;
>  
> -	pm_runtime_put_autosuspend(&pdev->dev);
> +	pm_runtime_put_autosuspend(dev);
>  
>  	return 0;
>  }

Greets
Alex


  parent reply	other threads:[~2026-07-06 11:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-05 17:27 Krzysztof Kozlowski
2026-07-05 17:27 ` [PATCH 2/3] spi: atmel-quadspi: Simplify with dev_err_probe() Krzysztof Kozlowski
2026-07-05 17:27 ` [PATCH 3/3] spi: altera: " Krzysztof Kozlowski
2026-07-06 10:58 ` Alexander Dahl [this message]
2026-07-06 11:14   ` [PATCH 1/3] spi: atmel-quadspi: Simplify probe() with local 'dev' variable Krzysztof Kozlowski
2026-07-14 11:51 ` 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=20260706-plunder-fencing-b9ca15ef05ae@thorsis.com \
    --to=ada@thorsis.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=broonie@kernel.org \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=krzysztof.kozlowski@oss.qualcomm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    /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

all inboxes | Powered by JetHome®