From: "John Anthony Kazos Jr." <jakj@j-a-k-j.com>
To: gregkh@suse.de
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] lib/kobject_uevent.c: Collapse unnecessary loop nesting (top_kobj)
Date: Wed, 4 Apr 2007 07:39:17 -0400 (EDT) [thread overview]
Message-ID: <alpine.DEB.0.83.0704040730530.25382@sigma.j-a-k-j.com> (raw)
From: John Anthony Kazos Jr. <jakj@j-a-k-j.com>
Collapses a do..while() loop within an if() to a simple while() loop for
simplicity and readability.
Signed-off-by: John Anthony Kazos Jr. <jakj@j-a-k-j.com>
---
I'm sure GCC is able to handle this optimization decently, but there's no
reason at all for the additional nesting level for the loop.
--- linux-2.6.20.4/lib/kobject_uevent.c.orig 2007-04-04 07:25:08.000000000 -0400
+++ linux-2.6.20.4/lib/kobject_uevent.c 2007-04-04 07:27:28.000000000 -0400
@@ -95,10 +95,8 @@ int kobject_uevent_env(struct kobject *k
/* search the kset we belong to */
top_kobj = kobj;
- if (!top_kobj->kset && top_kobj->parent) {
- do {
- top_kobj = top_kobj->parent;
- } while (!top_kobj->kset && top_kobj->parent);
+ while (!top_kobj->kset && top_kobj->parent) {
+ top_kobj = top_kobj->parent;
}
if (!top_kobj->kset) {
pr_debug("kobject attempted to send uevent without kset!\n");
reply other threads:[~2007-04-04 11:39 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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.DEB.0.83.0704040730530.25382@sigma.j-a-k-j.com \
--to=jakj@j-a-k-j.com \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®