diff mbox series

[-next,v2,2/2] of/platform: use of_address_count() helper

Message ID 20221008115617.3583890-3-yangyingliang@huawei.com
State Accepted
Commit 32e8f9b3144496c76ad659c255246ecee7b47669
Headers show
Series of: introduce of_address_count() helper | expand

Commit Message

Yang Yingliang Oct. 8, 2022, 11:56 a.m. UTC
Use of_address_count() to instead of open-coding it.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/of/platform.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Rob Herring (Arm) Oct. 14, 2022, 9:10 p.m. UTC | #1
On Sat, 08 Oct 2022 19:56:17 +0800, Yang Yingliang wrote:
> Use of_address_count() to instead of open-coding it.
> 
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
>  drivers/of/platform.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 

Applied, thanks!
diff mbox series

Patch

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 3507095a69f6..81c8c227ab6b 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) {