* [PATCH] crypto: hisilicon/sec: use devm_platform_ioremap_resource in sec_map_io
@ 2026-07-15 1:15 Rosen Penev
2026-07-27 0:33 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Rosen Penev @ 2026-07-15 1:15 UTC (permalink / raw)
To: linux-crypto
Cc: Herbert Xu, David S. Miller, Nathan Chancellor, Nick Desaulniers,
Bill Wendling, Justin Stitt, open list,
open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b
Replace the open-coded platform_get_resource() plus devm_ioremap()
sequence in the SEC_NUM_ADDR_REGIONS loop with
devm_platform_ioremap_resource(), which fetches the resource, requests
the region and maps it in one call. Switch the error check to
IS_ERR()/PTR_ERR() and drop the now-unused struct resource pointer.
The driver only maps indices 0 and 1 (SEC_COMMON, SEC_SAA). On hip07 the
corresponding reg regions (0xd0000000, 0xd2000000) are 0x10000 each and
disjoint, so the region reservation added by devm_ioremap_resource() is
exclusive and does not introduce overlap failures.
Built for arm64 (drivers/crypto/hisilicon/sec/sec_drv.o) with LLVM=1.
Assisted-by: opencode:hy3-free
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
drivers/crypto/hisilicon/sec/sec_drv.c | 19 +++----------------
1 file changed, 3 insertions(+), 16 deletions(-)
diff --git a/drivers/crypto/hisilicon/sec/sec_drv.c b/drivers/crypto/hisilicon/sec/sec_drv.c
index 129cb6faa0b7..2514a5e1f9b4 100644
--- a/drivers/crypto/hisilicon/sec/sec_drv.c
+++ b/drivers/crypto/hisilicon/sec/sec_drv.c
@@ -1010,25 +1010,12 @@ static void sec_queue_base_init(struct sec_dev_info *info,
static int sec_map_io(struct sec_dev_info *info, struct platform_device *pdev)
{
- struct resource *res;
int i;
for (i = 0; i < SEC_NUM_ADDR_REGIONS; i++) {
- res = platform_get_resource(pdev, IORESOURCE_MEM, i);
-
- if (!res) {
- dev_err(info->dev, "Memory resource %d not found\n", i);
- return -EINVAL;
- }
-
- info->regs[i] = devm_ioremap(info->dev, res->start,
- resource_size(res));
- if (!info->regs[i]) {
- dev_err(info->dev,
- "Memory resource %d could not be remapped\n",
- i);
- return -EINVAL;
- }
+ info->regs[i] = devm_platform_ioremap_resource(pdev, i);
+ if (IS_ERR(info->regs[i]))
+ return PTR_ERR(info->regs[i]);
}
return 0;
--
2.55.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] crypto: hisilicon/sec: use devm_platform_ioremap_resource in sec_map_io
2026-07-15 1:15 [PATCH] crypto: hisilicon/sec: use devm_platform_ioremap_resource in sec_map_io Rosen Penev
@ 2026-07-27 0:33 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2026-07-27 0:33 UTC (permalink / raw)
To: Rosen Penev
Cc: linux-crypto, David S. Miller, Nathan Chancellor,
Nick Desaulniers, Bill Wendling, Justin Stitt, open list,
open list:CLANG/LLVM BUILD SUPPORT:Keyword:b(?i:clang|llvm)b
On Tue, Jul 14, 2026 at 06:15:33PM -0700, Rosen Penev wrote:
> Replace the open-coded platform_get_resource() plus devm_ioremap()
> sequence in the SEC_NUM_ADDR_REGIONS loop with
> devm_platform_ioremap_resource(), which fetches the resource, requests
> the region and maps it in one call. Switch the error check to
> IS_ERR()/PTR_ERR() and drop the now-unused struct resource pointer.
>
> The driver only maps indices 0 and 1 (SEC_COMMON, SEC_SAA). On hip07 the
> corresponding reg regions (0xd0000000, 0xd2000000) are 0x10000 each and
> disjoint, so the region reservation added by devm_ioremap_resource() is
> exclusive and does not introduce overlap failures.
>
> Built for arm64 (drivers/crypto/hisilicon/sec/sec_drv.o) with LLVM=1.
>
> Assisted-by: opencode:hy3-free
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
> drivers/crypto/hisilicon/sec/sec_drv.c | 19 +++----------------
> 1 file changed, 3 insertions(+), 16 deletions(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-27 0:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-15 1:15 [PATCH] crypto: hisilicon/sec: use devm_platform_ioremap_resource in sec_map_io Rosen Penev
2026-07-27 0:33 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox