nvmem: sunplus-ocotp: Use devm_platform_ioremap_resource_byname() helper function
platform_get_resource_byname() and devm_ioremap_resource() can be replaced by devm_platform_ioremap_resource_byname(), which can simplify the code logic a bit, No functional change here. Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20240902142952.71639-8-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
cdb63c73fa
commit
98ee46391b
@ -159,7 +159,6 @@ static int sp_ocotp_probe(struct platform_device *pdev)
|
|||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
struct nvmem_device *nvmem;
|
struct nvmem_device *nvmem;
|
||||||
struct sp_ocotp_priv *otp;
|
struct sp_ocotp_priv *otp;
|
||||||
struct resource *res;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
otp = devm_kzalloc(dev, sizeof(*otp), GFP_KERNEL);
|
otp = devm_kzalloc(dev, sizeof(*otp), GFP_KERNEL);
|
||||||
@ -168,13 +167,11 @@ static int sp_ocotp_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
otp->dev = dev;
|
otp->dev = dev;
|
||||||
|
|
||||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "hb_gpio");
|
otp->base[HB_GPIO] = devm_platform_ioremap_resource_byname(pdev, "hb_gpio");
|
||||||
otp->base[HB_GPIO] = devm_ioremap_resource(dev, res);
|
|
||||||
if (IS_ERR(otp->base[HB_GPIO]))
|
if (IS_ERR(otp->base[HB_GPIO]))
|
||||||
return PTR_ERR(otp->base[HB_GPIO]);
|
return PTR_ERR(otp->base[HB_GPIO]);
|
||||||
|
|
||||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "otprx");
|
otp->base[OTPRX] = devm_platform_ioremap_resource_byname(pdev, "otprx");
|
||||||
otp->base[OTPRX] = devm_ioremap_resource(dev, res);
|
|
||||||
if (IS_ERR(otp->base[OTPRX]))
|
if (IS_ERR(otp->base[OTPRX]))
|
||||||
return PTR_ERR(otp->base[OTPRX]);
|
return PTR_ERR(otp->base[OTPRX]);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user