From: Yang Yingliang <yangyingliang@huawei.com>
To: <linux-tegra@vger.kernel.org>
Cc: <thierry.reding@gmail.com>, <jonathanh@nvidia.com>,
<yangyingliang@huawei.com>
Subject: [PATCH -next] soc/tegra: cbb: tegra194: use of_address_count() helper
Date: Thu, 27 Oct 2022 14:56:25 +0800 [thread overview]
Message-ID: <20221027065625.1443750-1-yangyingliang@huawei.com> (raw)
After commit 16988c742968 ("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>
---
drivers/soc/tegra/cbb/tegra194-cbb.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/soc/tegra/cbb/tegra194-cbb.c b/drivers/soc/tegra/cbb/tegra194-cbb.c
index 1ae0bd9a1ac1..b5676dd49e88 100644
--- a/drivers/soc/tegra/cbb/tegra194-cbb.c
+++ b/drivers/soc/tegra/cbb/tegra194-cbb.c
@@ -2191,7 +2191,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;
@@ -2211,8 +2210,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);
--
2.25.1
next reply other threads:[~2022-10-27 6:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-27 6:56 Yang Yingliang [this message]
2022-10-28 11:24 ` [PATCH -next] soc/tegra: cbb: tegra194: use of_address_count() helper Thierry Reding
2023-04-05 13:19 ` Thierry Reding
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221027065625.1443750-1-yangyingliang@huawei.com \
--to=yangyingliang@huawei.com \
--cc=jonathanh@nvidia.com \
--cc=linux-tegra@vger.kernel.org \
--cc=thierry.reding@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox