All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aayush Kumar <code@aayushk.dev>
To: broonie@kernel.org
Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Aayush Kumar <code@aayushk.dev>
Subject: [PATCH 1/2] spi: sh-hspi: Use devm_platform_ioremap_resource()
Date: Fri,  9 Oct 2026 18:54:20 +0530	[thread overview]
Message-ID: <20261009132421.557758-2-code@aayushk.dev> (raw)
In-Reply-To: <20261009132421.557758-1-code@aayushk.dev>

Use the devm_platform_ioremap_resource() helper instead of calling
platform_get_resource() and devm_ioremap() separately.

Signed-off-by: Aayush Kumar <code@aayushk.dev>
---
 drivers/spi/spi-sh-hspi.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/spi/spi-sh-hspi.c b/drivers/spi/spi-sh-hspi.c
index f840467cf..56df076b6 100644
--- a/drivers/spi/spi-sh-hspi.c
+++ b/drivers/spi/spi-sh-hspi.c
@@ -211,19 +211,11 @@ static int hspi_transfer_one_message(struct spi_controller *ctlr,
 
 static int hspi_probe(struct platform_device *pdev)
 {
-	struct resource *res;
 	struct spi_controller *ctlr;
 	struct hspi_priv *hspi;
 	struct clk *clk;
 	int ret;
 
-	/* get base addr */
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (!res) {
-		dev_err(&pdev->dev, "invalid resource\n");
-		return -EINVAL;
-	}
-
 	ctlr = devm_spi_alloc_host(&pdev->dev, sizeof(*hspi));
 	if (!ctlr)
 		return -ENOMEM;
@@ -241,10 +233,9 @@ static int hspi_probe(struct platform_device *pdev)
 	hspi->ctlr	= ctlr;
 	hspi->dev	= &pdev->dev;
 	hspi->clk	= clk;
-	hspi->addr	= devm_ioremap(hspi->dev,
-				       res->start, resource_size(res));
-	if (!hspi->addr) {
-		ret = -ENOMEM;
+	hspi->addr = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(hspi->addr)) {
+		ret = PTR_ERR(hspi->addr);
 		goto error1;
 	}
 
-- 
2.56.0


  reply	other threads:[~2026-10-09 13:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-09 13:24 [PATCH 0/2] spi: use devm_platform_ioremap_resource() in sh-hspi and jcore Aayush Kumar
2026-10-09 13:24 ` Aayush Kumar [this message]
2026-10-09 13:24 ` [PATCH 2/2] spi: jcore: Use devm_platform_ioremap_resource() Aayush Kumar

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=20261009132421.557758-2-code@aayushk.dev \
    --to=code@aayushk.dev \
    --cc=broonie@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.