[PATCH 18/46] Kobject: kobject_uevent.c: Collapse unnecessary loop nesting (top_kobj)

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <linux-kernel@...>
Cc: John Anthony Kazos Jr <jakj@...>, Greg Kroah-Hartman <gregkh@...>
Date: Friday, April 27, 2007 - 2:53 pm

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 lib/kobject_uevent.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c
index 4122f38..d9a3510 100644
--- a/lib/kobject_uevent.c
+++ b/lib/kobject_uevent.c
@@ -95,10 +95,8 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
 
 	/* 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");
-- 
1.5.1.2

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 13/46] Driver core: notify userspace of network devic..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 14/46] Driver core: suppress uevents via filter, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 15/46] Driver core: switch firmware_class to uevent_s..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 16/46] uevent: use add_uevent_var() instead of open c..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 17/46] Driver core: add suspend() and resume() to str..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 18/46] Kobject: kobject_uevent.c: Collapse unnecessar..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 19/46] kobject: kobject_add() reference leak, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 20/46] Driver core: remove use of rwsem, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 21/46] SCSI: use the proper semaphore to protect the ..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 22/46] USB: remove use of the bus rwsem, as it doesn'..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 23/46] PNP: stop using the subsystem rwsem, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 24/46] Input: serio - do not touch bus's rwsem, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 25/46] Input: gameport - do not touch bus's rwsem, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 26/46] IDE: remove rwsem use from ide-proc core, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 27/46] IEEE1394: remove rwsem use from ieee1394 core, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 28/46] PHY: remove rwsem use from phy core, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
Re: [PATCH 28/46] PHY: remove rwsem use from phy core, Andy Fleming, (Fri Apr 27, 5:11 pm)
[PATCH 29/46] qeth: Remove usage of subsys.rwsem, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 30/46] kobject core: remove rwsem from struct subsystem, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 31/46] Driver core: make uevent-environment available..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 32/46] Driver core: warn when userspace writes to the..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 33/46] kobject: Comment and warning fixes to kobject.c, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 34/46] the overdue removal of the mount/umount uevents, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 35/46] debugfs: Add debugfs_create_u64(), Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 36/46] driver core: bus_add_driver should return an e..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 37/46] Driver core: use mutex instead of semaphore in..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 38/46] sysfs: bin.c printk fix, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 39/46] s390: cio: Delay uevents for subchannels, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 40/46] device_schedule_callback() needs a module refe..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 41/46] security: prevent permission checking of file ..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 42/46] define platform wakeup hook, use in pci_enable..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 43/46] s2ram: add arch irq disable/enable hooks, Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 44/46] mod_sysfs_setup() doesn't return errno when ko..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 45/46] drivers/base/attribute_container.c: use mutex ..., Greg Kroah-Hartman, (Fri Apr 27, 2:53 pm)
[PATCH 46/46] dev_dbg: check dev_dbg() arguments, Greg Kroah-Hartman, (Fri Apr 27, 2:54 pm)