From: Linus Torvalds <torvalds@linux-foundation.org>
To: hpa@zytor.com, mingo@redhat.com, tglx@linutronix.de,
mingo@elte.hu, linux-kernel@vger.kernel.org
Cc: linux-tip-commits@vger.kernel.org
Subject: Re: [tip:irq/genirq] irq: refactor and clean up the free_irq() code flow
Date: Tue, 17 Feb 2009 11:04:29 -0800 (PST) [thread overview]
Message-ID: <alpine.LFD.2.00.0902171101080.21686@localhost.localdomain> (raw)
In-Reply-To: <tip-ae88a23b32fa7e0dc9fa7ce735966e68eb41b0bc@kernel.org>
On Sun, 15 Feb 2009, Ingo Molnar wrote:
> struct irq_desc *desc = irq_to_desc(irq);
> - struct irqaction **p;
> + struct irqaction *action, **p, **pp;
The whole reason for 'pp' seems to be the confusing loop:
> for (;;) {
> + action = *p;
> + pp = p;
> +
> + if (!action) {
> + WARN(1, "Trying to free already-free IRQ %d\n", irq);
> + spin_unlock_irqrestore(&desc->lock, flags);
> +
> + return;
> + }
>
> + p = &action->next;
> + if (action->dev_id != dev_id)
> + continue;
>
> + break;
> + }
> + /* Found it - now remove it from the list of entries: */
> + *pp = action->next;
Where the need for 'pp' would go away if you'd just write it as
if (action->dev_id == dev_id)
break;
p = &action->next;
}
*p = action->next;
instead. Which also makes it both shorter and more readable.
Linus
next parent reply other threads:[~2009-02-17 19:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <tip-ae88a23b32fa7e0dc9fa7ce735966e68eb41b0bc@kernel.org>
2009-02-17 19:04 ` Linus Torvalds [this message]
2009-02-17 19:45 ` Ingo Molnar
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=alpine.LFD.2.00.0902171101080.21686@localhost.localdomain \
--to=torvalds@linux-foundation.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®