[PATCH 1/2] spi: sh-hspi: Use devm_platform_ioremap_resource()
From: Aayush Kumar
Date: Fri Oct 09 2026 - 09:25:46 EST
Use the devm_platform_ioremap_resource() helper instead of calling
platform_get_resource() and devm_ioremap() separately.
Signed-off-by: Aayush Kumar <code@xxxxxxxxxxx>
---
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