Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Yang Yingliang and committed by
Rob Herring
32e8f9b3 16988c74

+2 -3
+2 -3
drivers/of/platform.c
··· 115 115 { 116 116 struct platform_device *dev; 117 117 int rc, i, num_reg = 0; 118 - struct resource *res, temp_res; 118 + struct resource *res; 119 119 120 120 dev = platform_device_alloc("", PLATFORM_DEVID_NONE); 121 121 if (!dev) 122 122 return NULL; 123 123 124 124 /* count the io resources */ 125 - while (of_address_to_resource(np, num_reg, &temp_res) == 0) 126 - num_reg++; 125 + num_reg = of_address_count(np); 127 126 128 127 /* Populate the resource table */ 129 128 if (num_reg) {