Commit 32e8f9b3 authored by Yang Yingliang's avatar Yang Yingliang Committed by Rob Herring

of/platform: use of_address_count() helper

Use of_address_count() to instead of open-coding it.
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20221008115617.3583890-3-yangyingliang@huawei.comSigned-off-by: default avatarRob Herring <robh@kernel.org>
parent 16988c74
...@@ -115,15 +115,14 @@ struct platform_device *of_device_alloc(struct device_node *np, ...@@ -115,15 +115,14 @@ struct platform_device *of_device_alloc(struct device_node *np,
{ {
struct platform_device *dev; struct platform_device *dev;
int rc, i, num_reg = 0; int rc, i, num_reg = 0;
struct resource *res, temp_res; struct resource *res;
dev = platform_device_alloc("", PLATFORM_DEVID_NONE); dev = platform_device_alloc("", PLATFORM_DEVID_NONE);
if (!dev) if (!dev)
return NULL; return NULL;
/* count the io resources */ /* count the io resources */
while (of_address_to_resource(np, num_reg, &temp_res) == 0) num_reg = of_address_count(np);
num_reg++;
/* Populate the resource table */ /* Populate the resource table */
if (num_reg) { if (num_reg) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment