[PATCH] generic_nvram: use inode lock not lock_kernel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The locking is only done for lseek so this isn't a big change. All the
other operations are thrown at the arch specific lower layers for locking
handling without the file pointer being directly exposed.

Signed-off-by: Alan Cox <[email protected]>

diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.22-rc6-mm1/drivers/char/generic_nvram.c linux-2.6.22-rc6-mm1/drivers/char/generic_nvram.c
--- linux.vanilla-2.6.22-rc6-mm1/drivers/char/generic_nvram.c	2007-07-02 20:47:23.000000000 +0100
+++ linux-2.6.22-rc6-mm1/drivers/char/generic_nvram.c	2007-07-09 12:05:06.786669552 +0100
@@ -30,7 +30,7 @@
 
 static loff_t nvram_llseek(struct file *file, loff_t offset, int origin)
 {
-	lock_kernel();
+	mutex_lock(&file->f_path.dentry->d_inode->i_mutex);
 	switch (origin) {
 	case 1:
 		offset += file->f_pos;
@@ -44,7 +44,7 @@
 		return -EINVAL;
 	}
 	file->f_pos = offset;
-	unlock_kernel();
+	mutex_unlock(&file->f_path.dentry->d_inode->i_mutex);
 	return file->f_pos;
 }
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux