aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of
diff options
context:
space:
mode:
authorYang Yingliang <yangyingliang@huawei.com>2022-10-08 19:56:17 +0800
committerRob Herring <robh@kernel.org>2022-10-16 17:58:54 -0500
commit32e8f9b3144496c76ad659c255246ecee7b47669 (patch)
tree9e55801b096b6305ed8633f7d0a58f78c60bae39 /drivers/of
parent16988c742968d5ceb2e832a57bd277f51f0a59d7 (diff)
downloadlinux-32e8f9b3144496c76ad659c255246ecee7b47669.tar.gz
of/platform: use of_address_count() helper
Use of_address_count() to instead of open-coding it. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Link: https://lore.kernel.org/r/20221008115617.3583890-3-yangyingliang@huawei.com Signed-off-by: Rob Herring <robh@kernel.org>
Diffstat (limited to 'drivers/of')
-rw-r--r--drivers/of/platform.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 3507095a69f69..81c8c227ab6bf 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -115,15 +115,14 @@ struct platform_device *of_device_alloc(struct device_node *np,
{
struct platform_device *dev;
int rc, i, num_reg = 0;
- struct resource *res, temp_res;
+ struct resource *res;
dev = platform_device_alloc("", PLATFORM_DEVID_NONE);
if (!dev)
return NULL;
/* count the io resources */
- while (of_address_to_resource(np, num_reg, &temp_res) == 0)
- num_reg++;
+ num_reg = of_address_count(np);
/* Populate the resource table */
if (num_reg) {