Subject: [PATCH] RTAS - adapt procfs interface

From: Jens Osterkamp <[email-masked]>
Date: Tue, 1 Apr 2008 15:12:20 +0200

Hi,

rtas_flash was broken since 2.6.24-rc5. This patch fixes it.
I think this is a good bugfix candidate for 2.6.25.

Jens

---

From: Maxim Shchetynin <[email-masked]>

Handling of the proc_dir_entry->count has being changed in 2.6.24-rc5.
After this change the default value for pde->count is 1 and not 0 as it
was in earlier kernels. Therefore, if we want to check wether our procfs
file is already opened (already in use), we have to check if pde->count
is not greater than 2 but not 1.

Signed-off-by: Maxim Shchetynin <[email-masked]>
Signed-off-by: Jens Osterkamp <[email-masked]>

Index: linux-2.6/arch/powerpc/kernel/rtas_flash.c
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/rtas_flash.c
+++ linux-2.6/arch/powerpc/kernel/rtas_flash.c
@@ -356,7 +356,7 @@ static int rtas_excl_open(struct inode *
 
 	/* Enforce exclusive open with use count of PDE */
 	spin_lock(&flash_file_open_lock);
-	if (atomic_read(&dp->count) > 1) {
+	if (atomic_read(&dp->count) > 2) {
 		spin_unlock(&flash_file_open_lock);
 		return -EBUSY;
 	}