From: Oleg Nesterov <oleg@redhat.com>
To: Chris Li <sparse@chrisli.org>, Luc Van Oostenryck <lucvoo@kernel.org>
Cc: Alexey Gladkov <legion@kernel.org>, linux-sparse@vger.kernel.org
Subject: [PATCH 3/4] sparse/dissect: introduce struct lookup_args for lookup_member()
Date: Fri, 5 Jun 2026 16:56:50 +0200 [thread overview]
Message-ID: <aiLjsol2gybBNBwc@redhat.com> (raw)
In-Reply-To: <aiLjjDwKRB1UjNcs@redhat.com>
No functional changes, preparation for the next patch.
The new "struct lookup_args" bundles the current name/p_addr arguments
of lookup_member().
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
dissect.c | 26 +++++++++++++++++---------
1 file changed, 17 insertions(+), 9 deletions(-)
diff --git a/dissect.c b/dissect.c
index c790807e..3da9e3a2 100644
--- a/dissect.c
+++ b/dissect.c
@@ -283,25 +283,29 @@ static struct symbol *base_type(struct symbol *sym)
?: &bad_ctype;
}
-static struct symbol *lookup_member(struct symbol *type, struct ident *name, int *p_addr)
+struct lookup_args {
+ struct ident *name;
+ int *p_addr;
+};
+
+static struct symbol *lookup_member(struct symbol *type, struct lookup_args *la)
{
struct symbol *node;
int addr = 0;
FOR_EACH_PTR(type->symbol_list, node)
- if (!name) {
- if (addr == *p_addr)
+ if (!la->name) {
+ if (*la->p_addr == addr)
return node;
}
else if (node->ident == NULL) {
- node = lookup_member(node->ctype.base_type, name, NULL);
+ node = lookup_member(node->ctype.base_type, la);
if (node)
goto found;
}
- else if (node->ident == name) {
-found:
- if (p_addr)
- *p_addr = addr;
+ else if (node->ident == la->name) {
+found: if (la->p_addr)
+ *la->p_addr = addr;
return node;
}
addr++;
@@ -314,7 +318,11 @@ static struct symbol *find_report_member(usage_t mode, struct position *pos,
struct symbol *type, struct ident *name,
int *p_addr)
{
- struct symbol *mem = lookup_member(type, name, p_addr);
+ struct lookup_args la = {
+ .name = name,
+ .p_addr = p_addr,
+ };
+ struct symbol *mem = lookup_member(type, &la);
if (!mem) {
static struct symbol bad_member = {
--
2.52.0
next prev parent reply other threads:[~2026-06-05 14:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-05 14:56 [PATCH 0/4] sparse/dissect: fix missing usage reports for unnamed members of named types Oleg Nesterov
2026-06-05 14:56 ` [PATCH 1/4] sparse/dissect: introduce find_report_member() Oleg Nesterov
2026-06-05 14:56 ` [PATCH 2/4] sparse/dissect: fold lookup_member() into find_report_member() Oleg Nesterov
2026-06-05 14:56 ` Oleg Nesterov [this message]
2026-06-05 14:56 ` [PATCH 4/4] sparse/dissect: fix missing usage reports for unnamed members of named types Oleg Nesterov
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=aiLjsol2gybBNBwc@redhat.com \
--to=oleg@redhat.com \
--cc=legion@kernel.org \
--cc=linux-sparse@vger.kernel.org \
--cc=lucvoo@kernel.org \
--cc=sparse@chrisli.org \
/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