* [PATCH 0/2] spi: use devm_platform_ioremap_resource() in sh-hspi and jcore
@ 2026-10-09 13:24 Aayush Kumar
2026-10-09 13:24 ` [PATCH 1/2] spi: sh-hspi: Use devm_platform_ioremap_resource() Aayush Kumar
2026-10-09 13:24 ` [PATCH 2/2] spi: jcore: " Aayush Kumar
0 siblings, 2 replies; 3+ messages in thread
From: Aayush Kumar @ 2026-10-09 13:24 UTC (permalink / raw)
To: broonie; +Cc: linux-spi, linux-kernel, Aayush Kumar
Convert these two SPI drivers to the devm_platform_ioremap_resource()
helper to simplify the probe paths.
Aayush Kumar (2):
spi: sh-hspi: Use devm_platform_ioremap_resource()
spi: jcore: Use devm_platform_ioremap_resource()
drivers/spi/spi-jcore.c | 14 +++-----------
drivers/spi/spi-sh-hspi.c | 15 +++------------
2 files changed, 6 insertions(+), 23 deletions(-)
--
2.56.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] spi: sh-hspi: Use devm_platform_ioremap_resource()
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
2026-10-09 13:24 ` [PATCH 2/2] spi: jcore: " Aayush Kumar
1 sibling, 0 replies; 3+ messages in thread
From: Aayush Kumar @ 2026-10-09 13:24 UTC (permalink / raw)
To: broonie; +Cc: linux-spi, linux-kernel, Aayush Kumar
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
^ permalink raw reply [flat|nested] 3+ messages in thread* [PATCH 2/2] spi: jcore: Use devm_platform_ioremap_resource()
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 ` [PATCH 1/2] spi: sh-hspi: Use devm_platform_ioremap_resource() Aayush Kumar
@ 2026-10-09 13:24 ` Aayush Kumar
1 sibling, 0 replies; 3+ messages in thread
From: Aayush Kumar @ 2026-10-09 13:24 UTC (permalink / raw)
To: broonie; +Cc: linux-spi, linux-kernel, Aayush Kumar
Use the devm_platform_ioremap_resource() helper instead of calling
platform_get_resource(), devm_request_mem_region() and devm_ioremap()
separately.
Signed-off-by: Aayush Kumar <code@aayushk.dev>
---
drivers/spi/spi-jcore.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/drivers/spi/spi-jcore.c b/drivers/spi/spi-jcore.c
index a75cd61ec..df82e8adb 100644
--- a/drivers/spi/spi-jcore.c
+++ b/drivers/spi/spi-jcore.c
@@ -143,7 +143,6 @@ static int jcore_spi_probe(struct platform_device *pdev)
struct device_node *node = pdev->dev.of_node;
struct jcore_spi *hw;
struct spi_controller *host;
- struct resource *res;
u32 clock_freq;
struct clk *clk;
@@ -164,16 +163,9 @@ static int jcore_spi_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, hw);
/* Find and map our resources */
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res)
- return -EBUSY;
- if (!devm_request_mem_region(&pdev->dev, res->start,
- resource_size(res), pdev->name))
- return -EBUSY;
- hw->base = devm_ioremap(&pdev->dev, res->start,
- resource_size(res));
- if (!hw->base)
- return -EBUSY;
+ hw->base = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(hw->base))
+ return PTR_ERR(hw->base);
/*
* The SPI clock rate controlled via a configurable clock divider
--
2.56.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-09 13:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH 1/2] spi: sh-hspi: Use devm_platform_ioremap_resource() Aayush Kumar
2026-10-09 13:24 ` [PATCH 2/2] spi: jcore: " Aayush Kumar
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®