13ef50b15796003c8f913025614710230d4fca84
[openwrt/staging/xback.git] /
1 From 98ee46391baf35987227236d0c3bb30ab6e758c8 Mon Sep 17 00:00:00 2001
2 From: Zhang Zekun <zhangzekun11@huawei.com>
3 Date: Mon, 2 Sep 2024 15:29:50 +0100
4 Subject: [PATCH] nvmem: sunplus-ocotp: Use
5 devm_platform_ioremap_resource_byname() helper function
6
7 platform_get_resource_byname() and devm_ioremap_resource() can be
8 replaced by devm_platform_ioremap_resource_byname(), which can
9 simplify the code logic a bit, No functional change here.
10
11 Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>
12 Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
13 Link: https://lore.kernel.org/r/20240902142952.71639-8-srinivas.kandagatla@linaro.org
14 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
15 ---
16 drivers/nvmem/sunplus-ocotp.c | 7 ++-----
17 1 file changed, 2 insertions(+), 5 deletions(-)
18
19 --- a/drivers/nvmem/sunplus-ocotp.c
20 +++ b/drivers/nvmem/sunplus-ocotp.c
21 @@ -159,7 +159,6 @@ static int sp_ocotp_probe(struct platfor
22 struct device *dev = &pdev->dev;
23 struct nvmem_device *nvmem;
24 struct sp_ocotp_priv *otp;
25 - struct resource *res;
26 int ret;
27
28 otp = devm_kzalloc(dev, sizeof(*otp), GFP_KERNEL);
29 @@ -168,13 +167,11 @@ static int sp_ocotp_probe(struct platfor
30
31 otp->dev = dev;
32
33 - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hb_gpio");
34 - otp->base[HB_GPIO] = devm_ioremap_resource(dev, res);
35 + otp->base[HB_GPIO] = devm_platform_ioremap_resource_byname(pdev, "hb_gpio");
36 if (IS_ERR(otp->base[HB_GPIO]))
37 return PTR_ERR(otp->base[HB_GPIO]);
38
39 - res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "otprx");
40 - otp->base[OTPRX] = devm_ioremap_resource(dev, res);
41 + otp->base[OTPRX] = devm_platform_ioremap_resource_byname(pdev, "otprx");
42 if (IS_ERR(otp->base[OTPRX]))
43 return PTR_ERR(otp->base[OTPRX]);
44