--- linux/arch/ia64/kernel/efivars.c.orig	Mon Feb 11 22:40:55 2002
+++ linux/arch/ia64/kernel/efivars.c	Mon Feb 11 22:49:09 2002
@@ -1,7 +1,7 @@
 /*
  * EFI Variables - efivars.c
  *
- * Copyright (C) 2001 Dell Computer Corporation <Matt_Domsch@dell.com>
+ * Copyright (C) 2001,2002 Dell Computer Corporation <Matt_Domsch@dell.com>
  *
  * This code takes all variables accessible from EFI runtime and
  *  exports them via /proc
@@ -29,6 +29,11 @@
  *
  * Changelog:
  *
+ *  11 Feb 2002 - Matt Domsch <Matt_Domsch@dell.com>
+ *   use list_for_each_safe when deleting vars.  Use list_t.
+ *   remove ifdef CONFIG_SMP around include <linux/smp.h>
+ *   v0.04 release to linux-ia64@linuxia64.org
+ *
  *  20 April 2001 - Matt Domsch <Matt_Domsch@dell.com>
  *   Moved vars from /proc/efi to /proc/efi/vars, and made
  *   efi.c own the /proc/efi directory.
@@ -56,18 +61,16 @@
 #include <linux/sched.h>		/* for capable() */
 #include <linux/mm.h>
 #include <linux/module.h>
+#include <linux/smp.h>
 
 #include <asm/efi.h>
 #include <asm/uaccess.h>
-#ifdef CONFIG_SMP
-#include <linux/smp.h>
-#endif
 
 MODULE_AUTHOR("Matt Domsch <Matt_Domsch@Dell.com>");
 MODULE_DESCRIPTION("/proc interface to EFI Variables");
 MODULE_LICENSE("GPL");
 
-#define EFIVARS_VERSION "0.03 2001-Apr-20"
+#define EFIVARS_VERSION "0.04 2002-Feb-11"
 
 static int
 efivar_read(char *page, char **start, off_t off,
@@ -97,7 +100,7 @@ typedef struct _efi_variable_t {
 typedef struct _efivar_entry_t {
 	efi_variable_t          var;
 	struct proc_dir_entry   *entry;
-	struct list_head        list;
+	list_t                  list;
 } efivar_entry_t;
 
 static spinlock_t efivars_lock = SPIN_LOCK_UNLOCKED;
@@ -265,7 +268,7 @@ efivar_write(struct file *file, const ch
 {
 	unsigned long strsize1, strsize2;
 	int found=0;
-	struct list_head *pos;
+	list_t *pos, *n;
 	unsigned long size = sizeof(efi_variable_t);
 	efi_status_t status;
 	efivar_entry_t *efivar = data, *search_efivar = NULL;
@@ -297,7 +300,7 @@ efivar_write(struct file *file, const ch
 	   This allows any properly formatted data structure to
 	   be written to any of the files in /proc/efi/vars and it will work.
 	*/
-	list_for_each(pos, &efivar_list) {
+	list_for_each_safe(pos, n, &efivar_list) {
 		search_efivar = efivar_entry(pos);
 		strsize1 = utf8_strsize(search_efivar->var.VariableName, 1024);
 		strsize2 = utf8_strsize(var_data->VariableName, 1024);
@@ -413,12 +416,12 @@ efivars_init(void)
 static void __exit
 efivars_exit(void)
 {
-	struct list_head *pos;
+	list_t *pos, *n;
 	efivar_entry_t *efivar;
 
 	spin_lock(&efivars_lock);
 
-	list_for_each(pos, &efivar_list) {
+	list_for_each_safe(pos, n, &efivar_list) {
 		efivar = efivar_entry(pos);
 		remove_proc_entry(efivar->entry->name, efi_vars_dir);
 		list_del(&efivar->list);
