]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
[PATCH] powerpc: iseries: mf related cleanups
authorMichael Ellerman <michael@ellerman.id.au>
Tue, 21 Mar 2006 09:46:02 +0000 (20:46 +1100)
committerPaul Mackerras <paulus@samba.org>
Wed, 22 Mar 2006 04:04:20 +0000 (15:04 +1100)
Some cleanups in the iSeries code.
 - Make mf_display_progress() check mf_initialized rather than the caller.
 - Set mf_initialized in mf_init() rather than in setup.c
 - Then move mf_initialized into mf.c, the only place it's used.
 - Move the mf related logic from iSeries_progress() to mf_display_progress()
 - Use a #define to size the pending_event_prealloc array
 - Use that define in the initialsation loop rather than sizeof jiggery pokery
 - Remove stupid comment(s)
 - Mark stuff static and/or __init

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/platforms/iseries/mf.c
arch/powerpc/platforms/iseries/setup.c
include/asm-powerpc/iseries/mf.h

index a41d8b78c0cd6e15b8e83c57321eff84fb26dbe9..97a26137cf40ee03ea082f7a039a5c2ac4c9b211 100644 (file)
@@ -46,6 +46,7 @@
 #include "setup.h"
 
 extern int piranha_simulator;
+static int mf_initialized;
 
 /*
  * This is the structure layout for the Machine Facilites LPAR event
@@ -143,7 +144,8 @@ static spinlock_t pending_event_spinlock;
 static struct pending_event *pending_event_head;
 static struct pending_event *pending_event_tail;
 static struct pending_event *pending_event_avail;
-static struct pending_event pending_event_prealloc[16];
+#define PENDING_EVENT_PREALLOC_LEN 16
+static struct pending_event pending_event_prealloc[PENDING_EVENT_PREALLOC_LEN];
 
 /*
  * Put a pending event onto the available queue, so it can get reused.
@@ -625,7 +627,7 @@ void mf_display_src(u32 word)
 /*
  * Display a single word SRC of the form "PROGXXXX" on the VSP control panel.
  */
-void mf_display_progress(u16 value)
+static __init void mf_display_progress_src(u16 value)
 {
        u8 ce[12];
        u8 src[72];
@@ -649,30 +651,42 @@ void mf_display_progress(u16 value)
  * Clear the VSP control panel.  Used to "erase" an SRC that was
  * previously displayed.
  */
-void mf_clear_src(void)
+static void mf_clear_src(void)
 {
        signal_ce_msg_simple(0x4b, NULL);
 }
 
+void __init mf_display_progress(u16 value)
+{
+       if (piranha_simulator || !mf_initialized)
+               return;
+
+       if (0xFFFF == value)
+               mf_clear_src();
+       else
+               mf_display_progress_src(value);
+}
+
 /*
  * Initialization code here.
  */
-void mf_init(void)
+void __init mf_init(void)
 {
        int i;
 
-       /* initialize */
        spin_lock_init(&pending_event_spinlock);
-       for (i = 0;
-            i < sizeof(pending_event_prealloc) / sizeof(*pending_event_prealloc);
-            ++i)
+
+       for (i = 0; i < PENDING_EVENT_PREALLOC_LEN; i++)
                free_pending_event(&pending_event_prealloc[i]);
+
        HvLpEvent_registerHandler(HvLpEvent_Type_MachineFac, &hv_handler);
 
        /* virtual continue ack */
        signal_ce_msg_simple(0x57, NULL);
 
-       /* initialization complete */
+       mf_initialized = 1;
+       mb();
+
        printk(KERN_NOTICE "mf.c: iSeries Linux LPAR Machine Facilities "
                        "initialized\n");
 }
index b08c3686f9035a155759e81654508648c9dedd0c..190891ce9cb46a4b7fc5454367fc730921c6bf5f 100644 (file)
@@ -89,8 +89,6 @@ extern unsigned long embedded_sysmap_end;
 extern unsigned long iSeries_recal_tb;
 extern unsigned long iSeries_recal_titan;
 
-static int mf_initialized;
-
 static unsigned long cmd_mem_limit;
 
 struct MemoryBlock {
@@ -347,8 +345,6 @@ static void __init iSeries_init_early(void)
        HvCallEvent_setLpEventQueueInterruptProc(0, 0);
 
        mf_init();
-       mf_initialized = 1;
-       mb();
 
        /* If we were passed an initrd, set the ROOT_DEV properly if the values
         * look sensible. If not, clear initrd reference.
@@ -585,12 +581,7 @@ static void iSeries_halt(void)
 static void __init iSeries_progress(char * st, unsigned short code)
 {
        printk("Progress: [%04x] - %s\n", (unsigned)code, st);
-       if (!piranha_simulator && mf_initialized) {
-               if (code != 0xffff)
-                       mf_display_progress(code);
-               else
-                       mf_clear_src();
-       }
+       mf_display_progress(code);
 }
 
 static void __init iSeries_fixup_klimit(void)
index 857e5202fc7847262ffa22c3f397181b68a20bc6..335e163daaf37637ea23916a678933b2c5683200 100644 (file)
@@ -45,7 +45,6 @@ extern void mf_reboot(void);
 
 extern void mf_display_src(u32 word);
 extern void mf_display_progress(u16 value);
-extern void mf_clear_src(void);
 
 extern void mf_init(void);