soc/tegra: cbb: tegra194: Use of_address_count() helper

After commit 16988c7429 ("of/address: introduce of_address_count() helper"),
We can use of_address_count() to instead of open-coding it.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
This commit is contained in:
Yang Yingliang 2022-10-27 14:56:25 +08:00 committed by Thierry Reding
parent 6854f27598
commit 056a6e1db2

View File

@ -2190,7 +2190,6 @@ MODULE_DEVICE_TABLE(of, tegra194_cbb_match);
static int tegra194_cbb_get_bridges(struct tegra194_cbb *cbb, struct device_node *np)
{
struct tegra_cbb *entry;
struct resource res;
unsigned long flags;
unsigned int i;
int err;
@ -2210,8 +2209,7 @@ static int tegra194_cbb_get_bridges(struct tegra194_cbb *cbb, struct device_node
spin_unlock_irqrestore(&cbb_lock, flags);
if (!cbb->bridges) {
while (of_address_to_resource(np, cbb->num_bridges, &res) == 0)
cbb->num_bridges++;
cbb->num_bridges = of_address_count(np);
cbb->bridges = devm_kcalloc(cbb->base.dev, cbb->num_bridges,
sizeof(*cbb->bridges), GFP_KERNEL);