Patchwork Make last_dev match comments

login
register
about
Submitter Myles Watson
Date 2010-08-31 20:50:50
Message ID <AANLkTi=w0yGz2bmDWhSwrF9PKg5k96=HOmjgGa4NtAVC@mail.gmail.com>
Download mbox | patch
Permalink /patch/1834/
State Accepted
Commit r5763
Headers show

Comments

Myles Watson - 2010-08-31 20:50:50
This patch simplifies last_dev.

Signed-off-by: Myles Watson <mylesgw@gmail.com>

Thanks,
Myles

Patch

Index: svn/src/devices/device.c
===================================================================
--- svn.orig/src/devices/device.c
+++ svn/src/devices/device.c
@@ -42,7 +42,7 @@ 
 /** Linked list of ALL devices */
 struct device *all_devices = &dev_root;
 /** Pointer to the last device */
-extern struct device **last_dev_p;
+extern struct device *last_dev;
 /** Linked list of free resources */
 struct resource *free_resources = NULL;
 
@@ -95,8 +95,8 @@  device_t alloc_dev(struct bus *parent, s
 	/* Append a new device to the global device list.
 	 * The list is used to find devices once everything is set up.
 	 */
-	*last_dev_p = dev;
-	last_dev_p = &dev->next;
+	last_dev->next = dev;
+	last_dev = dev;
 
 	spin_unlock(&dev_lock);
 	return dev;
Index: svn/util/sconfig/main.c
===================================================================
--- svn.orig/util/sconfig/main.c
+++ svn/util/sconfig/main.c
@@ -446,7 +446,7 @@  int main(int argc, char** argv) {
 	}
 	fprintf(staticc, "\n/* pass 0 */\n");
 	walk_device_tree(staticc, &root, pass0, NULL);
-	fprintf(staticc, "\n/* pass 1 */\nstruct mainboard_config mainboard_info_0;\nstruct device **last_dev_p = &%s.next;\n", lastdev->name);
+	fprintf(staticc, "\n/* pass 1 */\nstruct mainboard_config mainboard_info_0;\nstruct device *last_dev = &%s;\n", lastdev->name);
 	walk_device_tree(staticc, &root, pass1, NULL);
 
 	fclose(staticc);