linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [patch 0/3] powerpc: Fixes for nvram_64
@ 2009-10-15  8:54 Thomas Gleixner
  2009-10-15  8:54 ` [patch 1/3] powerpc: Remove unused code Thomas Gleixner
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Thomas Gleixner @ 2009-10-15  8:54 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev

Ben,

while looking at the ioctl in nvram_64.c I noticed a couple of issues
which are addressed by the folling patch series.

Thanks,

	tglx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [patch 1/3] powerpc: Remove unused code
  2009-10-15  8:54 [patch 0/3] powerpc: Fixes for nvram_64 Thomas Gleixner
@ 2009-10-15  8:54 ` Thomas Gleixner
  2009-10-15  8:54 ` [patch 2/3] powerpc: Check nvram_error_log_index in nvram_clear_error_log() Thomas Gleixner
  2009-10-15  8:54 ` [patch 3/3] powerpc: Mark init code __init in nvram_64 Thomas Gleixner
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Gleixner @ 2009-10-15  8:54 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev

nvram_find_partition() has no user. The call site was removed in the
arch/powerpc move, but the function stayed. Remove it.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linuxppc-dev@ozlabs.org
---
 arch/powerpc/include/asm/nvram.h |    1 -
 arch/powerpc/kernel/nvram_64.c   |   25 -------------------------
 2 files changed, 26 deletions(-)

Index: linux-2.6-tip/arch/powerpc/include/asm/nvram.h
===================================================================
--- linux-2.6-tip.orig/arch/powerpc/include/asm/nvram.h
+++ linux-2.6-tip/arch/powerpc/include/asm/nvram.h
@@ -73,7 +73,6 @@ extern int nvram_write_error_log(char * 
 extern int nvram_read_error_log(char * buff, int length,
 					 unsigned int * err_type, unsigned int *err_seq);
 extern int nvram_clear_error_log(void);
-extern struct nvram_partition *nvram_find_partition(int sig, const char *name);
 
 extern int pSeries_nvram_init(void);
 
Index: linux-2.6-tip/arch/powerpc/kernel/nvram_64.c
===================================================================
--- linux-2.6-tip.orig/arch/powerpc/kernel/nvram_64.c
+++ linux-2.6-tip/arch/powerpc/kernel/nvram_64.c
@@ -228,31 +228,6 @@ static unsigned char nvram_checksum(stru
 	return c_sum;
 }
 
-
-/*
- * Find an nvram partition, sig can be 0 for any
- * partition or name can be NULL for any name, else
- * tries to match both
- */
-struct nvram_partition *nvram_find_partition(int sig, const char *name)
-{
-	struct nvram_partition * part;
-	struct list_head * p;
-
-	list_for_each(p, &nvram_part->partition) {
-		part = list_entry(p, struct nvram_partition, partition);
-
-		if (sig && part->header.signature != sig)
-			continue;
-		if (name && 0 != strncmp(name, part->header.name, 12))
-			continue;
-		return part; 
-	}
-	return NULL;
-}
-EXPORT_SYMBOL(nvram_find_partition);
-
-
 static int nvram_remove_os_partition(void)
 {
 	struct list_head *i;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [patch 2/3] powerpc: Check nvram_error_log_index in nvram_clear_error_log()
  2009-10-15  8:54 [patch 0/3] powerpc: Fixes for nvram_64 Thomas Gleixner
  2009-10-15  8:54 ` [patch 1/3] powerpc: Remove unused code Thomas Gleixner
@ 2009-10-15  8:54 ` Thomas Gleixner
  2009-10-15  8:54 ` [patch 3/3] powerpc: Mark init code __init in nvram_64 Thomas Gleixner
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Gleixner @ 2009-10-15  8:54 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev

nvram_clear_error_log() calls ppc_md.nvram_write() even when
nvram_error_log_index is -1 (invalid). The nvram_write() function does
not check for a negative offset. 

Check nvram_error_log_index as the other nvram log functions do.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linuxppc-dev@ozlabs.org

---
 arch/powerpc/kernel/nvram_64.c |    3 +++
 1 file changed, 3 insertions(+)

Index: linux-2.6-tip/arch/powerpc/kernel/nvram_64.c
===================================================================
--- linux-2.6-tip.orig/arch/powerpc/kernel/nvram_64.c
+++ linux-2.6-tip/arch/powerpc/kernel/nvram_64.c
@@ -681,6 +681,9 @@ int nvram_clear_error_log(void)
 	int clear_word = ERR_FLAG_ALREADY_LOGGED;
 	int rc;
 
+	if (nvram_error_log_index == -1)
+		return -1;
+
 	tmp_index = nvram_error_log_index;
 	
 	rc = ppc_md.nvram_write((char *)&clear_word, sizeof(int), &tmp_index);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [patch 3/3] powerpc: Mark init code __init in nvram_64
  2009-10-15  8:54 [patch 0/3] powerpc: Fixes for nvram_64 Thomas Gleixner
  2009-10-15  8:54 ` [patch 1/3] powerpc: Remove unused code Thomas Gleixner
  2009-10-15  8:54 ` [patch 2/3] powerpc: Check nvram_error_log_index in nvram_clear_error_log() Thomas Gleixner
@ 2009-10-15  8:54 ` Thomas Gleixner
  2 siblings, 0 replies; 4+ messages in thread
From: Thomas Gleixner @ 2009-10-15  8:54 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev

Mark all functions which are only called from nvram_init() __init.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linuxppc-dev@ozlabs.org
---
 arch/powerpc/kernel/nvram_64.c |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

Index: linux-2.6-tip/arch/powerpc/kernel/nvram_64.c
===================================================================
--- linux-2.6-tip.orig/arch/powerpc/kernel/nvram_64.c
+++ linux-2.6-tip/arch/powerpc/kernel/nvram_64.c
@@ -184,7 +184,7 @@ static struct miscdevice nvram_dev = {
 
 
 #ifdef DEBUG_NVRAM
-static void nvram_print_partitions(char * label)
+static void __init nvram_print_partitions(char * label)
 {
 	struct list_head * p;
 	struct nvram_partition * tmp_part;
@@ -202,7 +202,7 @@ static void nvram_print_partitions(char 
 #endif
 
 
-static int nvram_write_header(struct nvram_partition * part)
+static int __init nvram_write_header(struct nvram_partition * part)
 {
 	loff_t tmp_index;
 	int rc;
@@ -214,7 +214,7 @@ static int nvram_write_header(struct nvr
 }
 
 
-static unsigned char nvram_checksum(struct nvram_header *p)
+static unsigned char __init nvram_checksum(struct nvram_header *p)
 {
 	unsigned int c_sum, c_sum2;
 	unsigned short *sp = (unsigned short *)p->name; /* assume 6 shorts */
@@ -228,7 +228,7 @@ static unsigned char nvram_checksum(stru
 	return c_sum;
 }
 
-static int nvram_remove_os_partition(void)
+static int __init nvram_remove_os_partition(void)
 {
 	struct list_head *i;
 	struct list_head *j;
@@ -294,7 +294,7 @@ static int nvram_remove_os_partition(voi
  * Will create a partition starting at the first free
  * space found if space has enough room.
  */
-static int nvram_create_os_partition(void)
+static int __init nvram_create_os_partition(void)
 {
 	struct nvram_partition *part;
 	struct nvram_partition *new_part;
@@ -397,7 +397,7 @@ static int nvram_create_os_partition(voi
  * 5.) If the max chunk cannot be allocated then try finding a chunk
  * that will satisfy the minum needed (NVRAM_MIN_REQ).
  */
-static int nvram_setup_partition(void)
+static int __init nvram_setup_partition(void)
 {
 	struct list_head * p;
 	struct nvram_partition * part;
@@ -455,7 +455,7 @@ static int nvram_setup_partition(void)
 }
 
 
-static int nvram_scan_partitions(void)
+static int __init nvram_scan_partitions(void)
 {
 	loff_t cur_index = 0;
 	struct nvram_header phead;

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-10-15  8:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-15  8:54 [patch 0/3] powerpc: Fixes for nvram_64 Thomas Gleixner
2009-10-15  8:54 ` [patch 1/3] powerpc: Remove unused code Thomas Gleixner
2009-10-15  8:54 ` [patch 2/3] powerpc: Check nvram_error_log_index in nvram_clear_error_log() Thomas Gleixner
2009-10-15  8:54 ` [patch 3/3] powerpc: Mark init code __init in nvram_64 Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).