[<prev] [next>] [day] [month] [year] [list]
Date: Wed, 4 Apr 2007 07:39:17 -0400 (EDT)
From: "John Anthony Kazos Jr." <jakj@...-k-j.com>
To: gregkh@...e.de
cc: linux-kernel@...r.kernel.org
Subject: [PATCH] lib/kobject_uevent.c: Collapse unnecessary loop nesting
(top_kobj)
From: John Anthony Kazos Jr. <jakj@...-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@...-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");
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists