crypto: hisilicon/sec: use devm_platform_ioremap_resource in sec_map_io
PATCH 1/1 crypto: hisilicon/sec: use devm_platform_ioremap_resource in sec_map_io
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.
--- drivers/crypto/hisilicon/sec/sec_drv.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-)
drivers/crypto/hisilicon/sec/sec_drv.c +3 -16
@@ -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 ;
Signature · 1 line
2.55.0
Herbert Xu
maintainerQuoted 11 lines · Rosen Penev
Replace the open-coded
platform_get_resource()plusdevm_ioremap()sequence in theSEC_NUM_ADDR_REGIONSloop withdevm_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) are0x10000each and disjoint, so the region reservation added bydevm_ioremap_resource()is exclusive and does not introduce overlap failures.
Quoted 7 lines
Built for arm64 (
drivers/crypto/hisilicon/sec/sec_drv.o) with LLVM=1.Assisted-by opencode:hy3-freeSigned-off-by Rosen Penev <[email protected]>--- drivers/crypto/hisilicon/sec/sec_drv.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-)
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt