* [PATCH] spi: stm32-ospi: Use of_reserved_mem_region_to_resource() for "memory-region"
@ 2025-07-03 18:35 Rob Herring (Arm)
2025-07-04 13:50 ` Mark Brown
2025-07-14 10:33 ` Mark Brown
0 siblings, 2 replies; 4+ messages in thread
From: Rob Herring (Arm) @ 2025-07-03 18:35 UTC (permalink / raw)
To: Mark Brown, Maxime Coquelin, Alexandre Torgue
Cc: linux-spi, linux-stm32, linux-arm-kernel, linux-kernel
Use the newly added of_reserved_mem_region_to_resource() function to
handle "memory-region" properties.
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
---
drivers/spi/spi-stm32-ospi.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/drivers/spi/spi-stm32-ospi.c b/drivers/spi/spi-stm32-ospi.c
index 7c1fa55fbc47..fbf00909b6c5 100644
--- a/drivers/spi/spi-stm32-ospi.c
+++ b/drivers/spi/spi-stm32-ospi.c
@@ -771,7 +771,7 @@ static int stm32_ospi_get_resources(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct stm32_ospi *ospi = platform_get_drvdata(pdev);
- struct resource *res;
+ struct resource *res, _res;
struct reserved_mem *rmem = NULL;
struct device_node *node;
int ret;
@@ -825,17 +825,13 @@ static int stm32_ospi_get_resources(struct platform_device *pdev)
goto err_dma;
}
- node = of_parse_phandle(dev->of_node, "memory-region", 0);
- if (node)
- rmem = of_reserved_mem_lookup(node);
- of_node_put(node);
-
- if (rmem) {
- ospi->mm_size = rmem->size;
- ospi->mm_base = devm_ioremap(dev, rmem->base, rmem->size);
+ res = &_res;
+ ret = of_reserved_mem_region_to_resource(dev->of_node, 0, res);
+ if (!ret) {
+ ospi->mm_size = resource_size(res);
+ ospi->mm_base = devm_ioremap_resource(dev, res);
if (!ospi->mm_base) {
- dev_err(dev, "unable to map memory region: %pa+%pa\n",
- &rmem->base, &rmem->size);
+ dev_err(dev, "unable to map memory region: %pR\n", res);
ret = -ENOMEM;
goto err_dma;
}
--
2.47.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] spi: stm32-ospi: Use of_reserved_mem_region_to_resource() for "memory-region"
2025-07-03 18:35 [PATCH] spi: stm32-ospi: Use of_reserved_mem_region_to_resource() for "memory-region" Rob Herring (Arm)
@ 2025-07-04 13:50 ` Mark Brown
2025-07-07 14:43 ` Rob Herring
2025-07-14 10:33 ` Mark Brown
1 sibling, 1 reply; 4+ messages in thread
From: Mark Brown @ 2025-07-04 13:50 UTC (permalink / raw)
To: Rob Herring (Arm)
Cc: Maxime Coquelin, Alexandre Torgue, linux-spi, linux-stm32,
linux-arm-kernel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 615 bytes --]
On Thu, Jul 03, 2025 at 01:35:37PM -0500, Rob Herring (Arm) wrote:
> Use the newly added of_reserved_mem_region_to_resource() function to
> handle "memory-region" properties.
This breaks an allmodconfig build:
/build/stage/linux/drivers/spi/spi-stm32-ospi.c:775:23: error: unused variable 'rmem' [-Werror,-Wunused-variable]
775 | struct reserved_mem *rmem = NULL;
| ^~~~
/build/stage/linux/drivers/spi/spi-stm32-ospi.c:776:22: error: unused variable 'node' [-Werror,-Wunused-variable]
776 | struct device_node *node;
| ^~~~
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] spi: stm32-ospi: Use of_reserved_mem_region_to_resource() for "memory-region"
2025-07-04 13:50 ` Mark Brown
@ 2025-07-07 14:43 ` Rob Herring
0 siblings, 0 replies; 4+ messages in thread
From: Rob Herring @ 2025-07-07 14:43 UTC (permalink / raw)
To: Mark Brown
Cc: Maxime Coquelin, Alexandre Torgue, linux-spi, linux-stm32,
linux-arm-kernel, linux-kernel
On Fri, Jul 4, 2025 at 8:50 AM Mark Brown <broonie@kernel.org> wrote:
>
> On Thu, Jul 03, 2025 at 01:35:37PM -0500, Rob Herring (Arm) wrote:
> > Use the newly added of_reserved_mem_region_to_resource() function to
> > handle "memory-region" properties.
>
> This breaks an allmodconfig build:
>
> /build/stage/linux/drivers/spi/spi-stm32-ospi.c:775:23: error: unused variable 'rmem' [-Werror,-Wunused-variable]
> 775 | struct reserved_mem *rmem = NULL;
> | ^~~~
> /build/stage/linux/drivers/spi/spi-stm32-ospi.c:776:22: error: unused variable 'node' [-Werror,-Wunused-variable]
> 776 | struct device_node *node;
> | ^~~~
Sigh. I swear I had fixed that...
Rob
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] spi: stm32-ospi: Use of_reserved_mem_region_to_resource() for "memory-region"
2025-07-03 18:35 [PATCH] spi: stm32-ospi: Use of_reserved_mem_region_to_resource() for "memory-region" Rob Herring (Arm)
2025-07-04 13:50 ` Mark Brown
@ 2025-07-14 10:33 ` Mark Brown
1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2025-07-14 10:33 UTC (permalink / raw)
To: Maxime Coquelin, Alexandre Torgue, Rob Herring (Arm)
Cc: linux-spi, linux-stm32, linux-arm-kernel, linux-kernel
On Thu, 03 Jul 2025 13:35:37 -0500, Rob Herring (Arm) wrote:
> Use the newly added of_reserved_mem_region_to_resource() function to
> handle "memory-region" properties.
>
>
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next
Thanks!
[1/1] spi: stm32-ospi: Use of_reserved_mem_region_to_resource() for "memory-region"
commit: defe01abfb7f5c5bd53c723b8577d4fcd64faa5a
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-07-14 10:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-03 18:35 [PATCH] spi: stm32-ospi: Use of_reserved_mem_region_to_resource() for "memory-region" Rob Herring (Arm)
2025-07-04 13:50 ` Mark Brown
2025-07-07 14:43 ` Rob Herring
2025-07-14 10:33 ` Mark Brown
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).