nfsd: move most of nfsfh.h to fs/nfsd
[safe/jmp/linux-2.6] / drivers / pci / hotplug / ibmphp_hpc.c
index 6894b54..83f337c 100644 (file)
 #include <linux/delay.h>
 #include <linux/module.h>
 #include <linux/pci.h>
-#include <linux/smp_lock.h>
 #include <linux/init.h>
+#include <linux/mutex.h>
+#include <linux/sched.h>
+#include <linux/kthread.h>
 #include "ibmphp.h"
 
-static int to_debug = FALSE;
+static int to_debug = 0;
 #define debug_polling(fmt, arg...)     do { if (to_debug) debug (fmt, arg); } while (0)
 
 //----------------------------------------------------------------------------
@@ -64,7 +66,7 @@ static int to_debug = FALSE;
 #define WPG_I2C_OR             0x2000  // I2C OR operation
 
 //----------------------------------------------------------------------------
-// Command set for I2C Master Operation Setup Regisetr
+// Command set for I2C Master Operation Setup Register
 //----------------------------------------------------------------------------
 #define WPG_READATADDR_MASK    0x00010000      // read,bytes,I2C shifted,index
 #define WPG_WRITEATADDR_MASK   0x40010000      // write,bytes,I2C shifted,index
@@ -93,18 +95,17 @@ static int to_debug = FALSE;
 //----------------------------------------------------------------------------
 // macro utilities
 //----------------------------------------------------------------------------
-// if bits 20,22,25,26,27,29,30 are OFF return TRUE
-#define HPC_I2CSTATUS_CHECK(s) ((u8)((s & 0x00000A76) ? FALSE : TRUE))
+// if bits 20,22,25,26,27,29,30 are OFF return 1
+#define HPC_I2CSTATUS_CHECK(s) ((u8)((s & 0x00000A76) ? 0 : 1))
 
 //----------------------------------------------------------------------------
 // global variables
 //----------------------------------------------------------------------------
-static int ibmphp_shutdown;
-static int tid_poll;
-static struct semaphore sem_hpcaccess; // lock access to HPC
+static struct mutex sem_hpcaccess;     // lock access to HPC
 static struct semaphore semOperations; // lock all operations and
                                        // access to data structures
 static struct semaphore sem_exit;      // make sure polling thread goes away
+static struct task_struct *ibmphp_poll_thread;
 //----------------------------------------------------------------------------
 // local function prototypes
 //----------------------------------------------------------------------------
@@ -114,10 +115,9 @@ static u8 hpc_writecmdtoindex (u8, u8);
 static u8 hpc_readcmdtoindex (u8, u8);
 static void get_hpc_access (void);
 static void free_hpc_access (void);
-static void poll_hpc (void);
+static int poll_hpc(void *data);
 static int process_changeinstatus (struct slot *, struct slot *);
 static int process_changeinlatch (u8, u8, struct controller *);
-static int hpc_poll_thread (void *);
 static int hpc_wait_ctlr_notworking (int, struct controller *, void __iomem *, u8 *);
 //----------------------------------------------------------------------------
 
@@ -129,16 +129,14 @@ static int hpc_wait_ctlr_notworking (int, struct controller *, void __iomem *, u
 *---------------------------------------------------------------------*/
 void __init ibmphp_hpc_initvars (void)
 {
-       debug ("%s - Entry\n", __FUNCTION__);
+       debug ("%s - Entry\n", __func__);
 
-       init_MUTEX (&sem_hpcaccess);
+       mutex_init(&sem_hpcaccess);
        init_MUTEX (&semOperations);
        init_MUTEX_LOCKED (&sem_exit);
-       to_debug = FALSE;
-       ibmphp_shutdown = FALSE;
-       tid_poll = 0;
+       to_debug = 0;
 
-       debug ("%s - Exit\n", __FUNCTION__);
+       debug ("%s - Exit\n", __func__);
 }
 
 /*----------------------------------------------------------------------
@@ -156,7 +154,7 @@ static u8 i2c_ctrl_read (struct controller *ctlr_ptr, void __iomem *WPGBbar, u8
        unsigned long ultemp;
        unsigned long data;     // actual data HILO format
 
-       debug_polling ("%s - Entry WPGBbar[%p] index[%x] \n", __FUNCTION__, WPGBbar, index);
+       debug_polling ("%s - Entry WPGBbar[%p] index[%x] \n", __func__, WPGBbar, index);
 
        //--------------------------------------------------------------------
        // READ - step 1
@@ -215,7 +213,7 @@ static u8 i2c_ctrl_read (struct controller *ctlr_ptr, void __iomem *WPGBbar, u8
                i--;
        }
        if (i == 0) {
-               debug ("%s - Error : WPG timeout\n", __FUNCTION__);
+               debug ("%s - Error : WPG timeout\n", __func__);
                return HPC_ERROR;
        }
        //--------------------------------------------------------------------
@@ -243,7 +241,7 @@ static u8 i2c_ctrl_read (struct controller *ctlr_ptr, void __iomem *WPGBbar, u8
 
        status = (u8) data;
 
-       debug_polling ("%s - Exit index[%x] status[%x]\n", __FUNCTION__, index, status);
+       debug_polling ("%s - Exit index[%x] status[%x]\n", __func__, index, status);
 
        return (status);
 }
@@ -264,7 +262,7 @@ static u8 i2c_ctrl_write (struct controller *ctlr_ptr, void __iomem *WPGBbar, u8
        unsigned long data;     // actual data HILO format
        int i;
 
-       debug_polling ("%s - Entry WPGBbar[%p] index[%x] cmd[%x]\n", __FUNCTION__, WPGBbar, index, cmd);
+       debug_polling ("%s - Entry WPGBbar[%p] index[%x] cmd[%x]\n", __func__, WPGBbar, index, cmd);
 
        rc = 0;
        //--------------------------------------------------------------------
@@ -326,7 +324,7 @@ static u8 i2c_ctrl_write (struct controller *ctlr_ptr, void __iomem *WPGBbar, u8
                i--;
        }
        if (i == 0) {
-               debug ("%s - Exit Error:WPG timeout\n", __FUNCTION__);
+               debug ("%s - Exit Error:WPG timeout\n", __func__);
                rc = HPC_ERROR;
        }
 
@@ -347,7 +345,7 @@ static u8 i2c_ctrl_write (struct controller *ctlr_ptr, void __iomem *WPGBbar, u8
                rc = HPC_ERROR;
        }
 
-       debug_polling ("%s Exit rc[%x]\n", __FUNCTION__, rc);
+       debug_polling ("%s Exit rc[%x]\n", __func__, rc);
        return (rc);
 }
 
@@ -529,7 +527,7 @@ static u8 hpc_readcmdtoindex (u8 cmd, u8 index)
 *
 * Action:  issue a READ command to HPC
 *
-* Input:   pslot   - can not be NULL for READ_ALLSTAT
+* Input:   pslot   - cannot be NULL for READ_ALLSTAT
 *          pstatus - can be NULL for READ_ALLSTAT
 *
 * Return   0 or error codes
@@ -543,12 +541,12 @@ int ibmphp_hpc_readslot (struct slot * pslot, u8 cmd, u8 * pstatus)
        int rc = 0;
        int busindex;
 
-       debug_polling ("%s - Entry pslot[%p] cmd[%x] pstatus[%p]\n", __FUNCTION__, pslot, cmd, pstatus);
+       debug_polling ("%s - Entry pslot[%p] cmd[%x] pstatus[%p]\n", __func__, pslot, cmd, pstatus);
 
        if ((pslot == NULL)
            || ((pstatus == NULL) && (cmd != READ_ALLSTAT) && (cmd != READ_BUSSTATUS))) {
                rc = -EINVAL;
-               err ("%s - Error invalid pointer, rc[%d]\n", __FUNCTION__, rc);
+               err ("%s - Error invalid pointer, rc[%d]\n", __func__, rc);
                return rc;
        }
 
@@ -556,7 +554,7 @@ int ibmphp_hpc_readslot (struct slot * pslot, u8 cmd, u8 * pstatus)
                busindex = ibmphp_get_bus_index (pslot->bus);
                if (busindex < 0) {
                        rc = -EINVAL;
-                       err ("%s - Exit Error:invalid bus, rc[%d]\n", __FUNCTION__, rc);
+                       err ("%s - Exit Error:invalid bus, rc[%d]\n", __func__, rc);
                        return rc;
                } else
                        index = (u8) busindex;
@@ -567,7 +565,7 @@ int ibmphp_hpc_readslot (struct slot * pslot, u8 cmd, u8 * pstatus)
 
        if (index == HPC_ERROR) {
                rc = -EINVAL;
-               err ("%s - Exit Error:invalid index, rc[%d]\n", __FUNCTION__, rc);
+               err ("%s - Exit Error:invalid index, rc[%d]\n", __func__, rc);
                return rc;
        }
 
@@ -643,7 +641,7 @@ int ibmphp_hpc_readslot (struct slot * pslot, u8 cmd, u8 * pstatus)
                                                    ctrl_read (ctlr_ptr, wpg_bbar,
                                                                index + WPG_1ST_EXTSLOT_INDEX);
                                } else {
-                                       err ("%s - Error ctrl_read failed\n", __FUNCTION__);
+                                       err ("%s - Error ctrl_read failed\n", __func__);
                                        rc = -EINVAL;
                                        break;
                                }
@@ -664,7 +662,7 @@ int ibmphp_hpc_readslot (struct slot * pslot, u8 cmd, u8 * pstatus)
        
        free_hpc_access ();
 
-       debug_polling ("%s - Exit rc[%d]\n", __FUNCTION__, rc);
+       debug_polling ("%s - Exit rc[%d]\n", __func__, rc);
        return rc;
 }
 
@@ -683,10 +681,10 @@ int ibmphp_hpc_writeslot (struct slot * pslot, u8 cmd)
        int rc = 0;
        int timeout;
 
-       debug_polling ("%s - Entry pslot[%p] cmd[%x]\n", __FUNCTION__, pslot, cmd);
+       debug_polling ("%s - Entry pslot[%p] cmd[%x]\n", __func__, pslot, cmd);
        if (pslot == NULL) {
                rc = -EINVAL;
-               err ("%s - Error Exit rc[%d]\n", __FUNCTION__, rc);
+               err ("%s - Error Exit rc[%d]\n", __func__, rc);
                return rc;
        }
 
@@ -696,7 +694,7 @@ int ibmphp_hpc_writeslot (struct slot * pslot, u8 cmd)
                busindex = ibmphp_get_bus_index (pslot->bus);
                if (busindex < 0) {
                        rc = -EINVAL;
-                       err ("%s - Exit Error:invalid bus, rc[%d]\n", __FUNCTION__, rc);
+                       err ("%s - Exit Error:invalid bus, rc[%d]\n", __func__, rc);
                        return rc;
                } else
                        index = (u8) busindex;
@@ -707,7 +705,7 @@ int ibmphp_hpc_writeslot (struct slot * pslot, u8 cmd)
 
        if (index == HPC_ERROR) {
                rc = -EINVAL;
-               err ("%s - Error Exit rc[%d]\n", __FUNCTION__, rc);
+               err ("%s - Error Exit rc[%d]\n", __func__, rc);
                return rc;
        }
 
@@ -721,7 +719,7 @@ int ibmphp_hpc_writeslot (struct slot * pslot, u8 cmd)
        if ((ctlr_ptr->ctlr_type == 2) || (ctlr_ptr->ctlr_type == 4)) {
                wpg_bbar = ioremap (ctlr_ptr->u.wpeg_ctlr.wpegbbar, WPG_I2C_IOREMAP_SIZE);
 
-               debug ("%s - ctlr id[%x] physical[%lx] logical[%lx] i2c[%x]\n", __FUNCTION__,
+               debug ("%s - ctlr id[%x] physical[%lx] logical[%lx] i2c[%x]\n", __func__,
                ctlr_ptr->ctlr_id, (ulong) (ctlr_ptr->u.wpeg_ctlr.wpegbbar), (ulong) wpg_bbar,
                ctlr_ptr->u.wpeg_ctlr.i2c_addr);
        }
@@ -737,22 +735,22 @@ int ibmphp_hpc_writeslot (struct slot * pslot, u8 cmd)
                // check controller is still not working on the command
                //--------------------------------------------------------------------
                timeout = CMD_COMPLETE_TOUT_SEC;
-               done = FALSE;
+               done = 0;
                while (!done) {
                        rc = hpc_wait_ctlr_notworking (HPC_CTLR_WORKING_TOUT, ctlr_ptr, wpg_bbar,
                                                        &status);
                        if (!rc) {
                                if (NEEDTOCHECK_CMDSTATUS (cmd)) {
                                        if (CTLR_FINISHED (status) == HPC_CTLR_FINISHED_YES)
-                                               done = TRUE;
+                                               done = 1;
                                } else
-                                       done = TRUE;
+                                       done = 1;
                        }
                        if (!done) {
                                msleep(1000);
                                if (timeout < 1) {
-                                       done = TRUE;
-                                       err ("%s - Error command complete timeout\n", __FUNCTION__);
+                                       done = 1;
+                                       err ("%s - Error command complete timeout\n", __func__);
                                        rc = -EFAULT;
                                } else
                                        timeout--;
@@ -767,7 +765,7 @@ int ibmphp_hpc_writeslot (struct slot * pslot, u8 cmd)
                iounmap (wpg_bbar);
        free_hpc_access ();
 
-       debug_polling ("%s - Exit rc[%d]\n", __FUNCTION__, rc);
+       debug_polling ("%s - Exit rc[%d]\n", __func__, rc);
        return rc;
 }
 
@@ -778,7 +776,7 @@ int ibmphp_hpc_writeslot (struct slot * pslot, u8 cmd)
 *---------------------------------------------------------------------*/
 static void get_hpc_access (void)
 {
-       down (&sem_hpcaccess);
+       mutex_lock(&sem_hpcaccess);
 }
 
 /*----------------------------------------------------------------------
@@ -786,7 +784,7 @@ static void get_hpc_access (void)
 *---------------------------------------------------------------------*/
 void free_hpc_access (void)
 {
-       up (&sem_hpcaccess);
+       mutex_unlock(&sem_hpcaccess);
 }
 
 /*----------------------------------------------------------------------
@@ -797,7 +795,7 @@ void free_hpc_access (void)
 void ibmphp_lock_operations (void)
 {
        down (&semOperations);
-       to_debug = TRUE;
+       to_debug = 1;
 }
 
 /*----------------------------------------------------------------------
@@ -805,10 +803,10 @@ void ibmphp_lock_operations (void)
 *---------------------------------------------------------------------*/
 void ibmphp_unlock_operations (void)
 {
-       debug ("%s - Entry\n", __FUNCTION__);
+       debug ("%s - Entry\n", __func__);
        up (&semOperations);
-       to_debug = FALSE;
-       debug ("%s - Exit\n", __FUNCTION__);
+       to_debug = 0;
+       debug ("%s - Exit\n", __func__);
 }
 
 /*----------------------------------------------------------------------
@@ -817,7 +815,7 @@ void ibmphp_unlock_operations (void)
 #define POLL_LATCH_REGISTER    0
 #define POLL_SLOTS             1
 #define POLL_SLEEP             2
-static void poll_hpc (void)
+static int poll_hpc(void *data)
 {
        struct slot myslot;
        struct slot *pslot = NULL;
@@ -829,13 +827,10 @@ static void poll_hpc (void)
        int poll_count = 0;
        u8 ctrl_count = 0x00;
 
-       debug ("%s - Entry\n", __FUNCTION__);
+       debug ("%s - Entry\n", __func__);
 
-       while (!ibmphp_shutdown) {
-               if (ibmphp_shutdown) 
-                       break;
-               
-               /* try to get the lock to do some kind of harware access */
+       while (!kthread_should_stop()) {
+               /* try to get the lock to do some kind of hardware access */
                down (&semOperations);
 
                switch (poll_state) {
@@ -894,7 +889,7 @@ static void poll_hpc (void)
                        up (&semOperations);
                        msleep(POLL_INTERVAL_SEC * 1000);
 
-                       if (ibmphp_shutdown) 
+                       if (kthread_should_stop())
                                break;
                        
                        down (&semOperations);
@@ -906,13 +901,14 @@ static void poll_hpc (void)
                                poll_state = POLL_LATCH_REGISTER;
                        break;
                }       
-               /* give up the harware semaphore */
+               /* give up the hardware semaphore */
                up (&semOperations);
                /* sleep for a short time just for good measure */
                msleep(100);
        }
        up (&sem_exit);
-       debug ("%s - Exit\n", __FUNCTION__);
+       debug ("%s - Exit\n", __func__);
+       return 0;
 }
 
 
@@ -935,40 +931,40 @@ static int process_changeinstatus (struct slot *pslot, struct slot *poldslot)
 {
        u8 status;
        int rc = 0;
-       u8 disable = FALSE;
-       u8 update = FALSE;
+       u8 disable = 0;
+       u8 update = 0;
 
        debug ("process_changeinstatus - Entry pslot[%p], poldslot[%p]\n", pslot, poldslot);
 
        // bit 0 - HPC_SLOT_POWER
        if ((pslot->status & 0x01) != (poldslot->status & 0x01))
-               update = TRUE;
+               update = 1;
 
        // bit 1 - HPC_SLOT_CONNECT
        // ignore
 
        // bit 2 - HPC_SLOT_ATTN
        if ((pslot->status & 0x04) != (poldslot->status & 0x04))
-               update = TRUE;
+               update = 1;
 
        // bit 3 - HPC_SLOT_PRSNT2
        // bit 4 - HPC_SLOT_PRSNT1
        if (((pslot->status & 0x08) != (poldslot->status & 0x08))
                || ((pslot->status & 0x10) != (poldslot->status & 0x10)))
-               update = TRUE;
+               update = 1;
 
        // bit 5 - HPC_SLOT_PWRGD
        if ((pslot->status & 0x20) != (poldslot->status & 0x20))
                // OFF -> ON: ignore, ON -> OFF: disable slot
                if ((poldslot->status & 0x20) && (SLOT_CONNECT (poldslot->status) == HPC_SLOT_CONNECTED) && (SLOT_PRESENT (poldslot->status))) 
-                       disable = TRUE;
+                       disable = 1;
 
        // bit 6 - HPC_SLOT_BUS_SPEED
        // ignore
 
        // bit 7 - HPC_SLOT_LATCH
        if ((pslot->status & 0x80) != (poldslot->status & 0x80)) {
-               update = TRUE;
+               update = 1;
                // OPEN -> CLOSE
                if (pslot->status & 0x80) {
                        if (SLOT_PWRGD (pslot->status)) {
@@ -977,7 +973,7 @@ static int process_changeinstatus (struct slot *pslot, struct slot *poldslot)
                                msleep(1000);
                                rc = ibmphp_hpc_readslot (pslot, READ_SLOTSTATUS, &status);
                                if (SLOT_PWRGD (status))
-                                       update = TRUE;
+                                       update = 1;
                                else    // overwrite power in pslot to OFF
                                        pslot->status &= ~HPC_SLOT_POWER;
                        }
@@ -985,17 +981,17 @@ static int process_changeinstatus (struct slot *pslot, struct slot *poldslot)
                // CLOSE -> OPEN 
                else if ((SLOT_PWRGD (poldslot->status) == HPC_SLOT_PWRGD_GOOD)
                        && (SLOT_CONNECT (poldslot->status) == HPC_SLOT_CONNECTED) && (SLOT_PRESENT (poldslot->status))) {
-                       disable = TRUE;
+                       disable = 1;
                }
                // else - ignore
        }
        // bit 4 - HPC_SLOT_BLINK_ATTN
        if ((pslot->ext_status & 0x08) != (poldslot->ext_status & 0x08))
-               update = TRUE;
+               update = 1;
 
        if (disable) {
                debug ("process_changeinstatus - disable slot\n");
-               pslot->flag = FALSE;
+               pslot->flag = 0;
                rc = ibmphp_do_disable_slot (pslot);
        }
 
@@ -1003,7 +999,7 @@ static int process_changeinstatus (struct slot *pslot, struct slot *poldslot)
                ibmphp_update_slot_info (pslot);
        }
 
-       debug ("%s - Exit rc[%d] disable[%x] update[%x]\n", __FUNCTION__, rc, disable, update);
+       debug ("%s - Exit rc[%d] disable[%x] update[%x]\n", __func__, rc, disable, update);
 
        return rc;
 }
@@ -1025,7 +1021,7 @@ static int process_changeinlatch (u8 old, u8 new, struct controller *ctrl)
        u8 mask;
        int rc = 0;
 
-       debug ("%s - Entry old[%x], new[%x]\n", __FUNCTION__, old, new);
+       debug ("%s - Entry old[%x], new[%x]\n", __func__, old, new);
        // bit 0 reserved, 0 is LSB, check bit 1-6 for 6 slots
 
        for (i = ctrl->starting_slot_num; i <= ctrl->ending_slot_num; i++) {
@@ -1035,60 +1031,33 @@ static int process_changeinlatch (u8 old, u8 new, struct controller *ctrl)
                        if (pslot) {
                                memcpy ((void *) &myslot, (void *) pslot, sizeof (struct slot));
                                rc = ibmphp_hpc_readslot (pslot, READ_ALLSTAT, NULL);
-                               debug ("%s - call process_changeinstatus for slot[%d]\n", __FUNCTION__, i);
+                               debug ("%s - call process_changeinstatus for slot[%d]\n", __func__, i);
                                process_changeinstatus (pslot, &myslot);
                        } else {
                                rc = -EINVAL;
-                               err ("%s - Error bad pointer for slot[%d]\n", __FUNCTION__, i);
+                               err ("%s - Error bad pointer for slot[%d]\n", __func__, i);
                        }
                }
        }
-       debug ("%s - Exit rc[%d]\n", __FUNCTION__, rc);
+       debug ("%s - Exit rc[%d]\n", __func__, rc);
        return rc;
 }
 
 /*----------------------------------------------------------------------
-* Name:    hpc_poll_thread
-*
-* Action:  polling
-*
-* Return   0
-* Value:
-*---------------------------------------------------------------------*/
-static int hpc_poll_thread (void *data)
-{
-       debug ("%s - Entry\n", __FUNCTION__);
-
-       daemonize("hpc_poll");
-       allow_signal(SIGKILL);
-
-       poll_hpc ();
-
-       tid_poll = 0;
-       debug ("%s - Exit\n", __FUNCTION__);
-       return 0;
-}
-
-
-/*----------------------------------------------------------------------
 * Name:    ibmphp_hpc_start_poll_thread
 *
 * Action:  start polling thread
 *---------------------------------------------------------------------*/
 int __init ibmphp_hpc_start_poll_thread (void)
 {
-       int rc = 0;
-
-       debug ("%s - Entry\n", __FUNCTION__);
+       debug ("%s - Entry\n", __func__);
 
-       tid_poll = kernel_thread (hpc_poll_thread, NULL, 0);
-       if (tid_poll < 0) {
-               err ("%s - Error, thread not started\n", __FUNCTION__);
-               rc = -1;
+       ibmphp_poll_thread = kthread_run(poll_hpc, NULL, "hpc_poll");
+       if (IS_ERR(ibmphp_poll_thread)) {
+               err ("%s - Error, thread not started\n", __func__);
+               return PTR_ERR(ibmphp_poll_thread);
        }
-
-       debug ("%s - Exit tid_poll[%d] rc[%d]\n", __FUNCTION__, tid_poll, rc);
-       return rc;
+       return 0;
 }
 
 /*----------------------------------------------------------------------
@@ -1098,9 +1067,9 @@ int __init ibmphp_hpc_start_poll_thread (void)
 *---------------------------------------------------------------------*/
 void __exit ibmphp_hpc_stop_poll_thread (void)
 {
-       debug ("%s - Entry\n", __FUNCTION__);
+       debug ("%s - Entry\n", __func__);
 
-       ibmphp_shutdown = TRUE;
+       kthread_stop(ibmphp_poll_thread);
        debug ("before locking operations \n");
        ibmphp_lock_operations ();
        debug ("after locking operations \n");
@@ -1119,7 +1088,7 @@ void __exit ibmphp_hpc_stop_poll_thread (void)
        up (&sem_exit);
        debug ("after sem exit up\n");
 
-       debug ("%s - Exit\n", __FUNCTION__);
+       debug ("%s - Exit\n", __func__);
 }
 
 /*----------------------------------------------------------------------
@@ -1134,7 +1103,7 @@ static int hpc_wait_ctlr_notworking (int timeout, struct controller *ctlr_ptr, v
                                    u8 * pstatus)
 {
        int rc = 0;
-       u8 done = FALSE;
+       u8 done = 0;
 
        debug_polling ("hpc_wait_ctlr_notworking - Entry timeout[%d]\n", timeout);
 
@@ -1142,14 +1111,14 @@ static int hpc_wait_ctlr_notworking (int timeout, struct controller *ctlr_ptr, v
                *pstatus = ctrl_read (ctlr_ptr, wpg_bbar, WPG_CTLR_INDEX);
                if (*pstatus == HPC_ERROR) {
                        rc = HPC_ERROR;
-                       done = TRUE;
+                       done = 1;
                }
                if (CTLR_WORKING (*pstatus) == HPC_CTLR_WORKING_NO)
-                       done = TRUE;
+                       done = 1;
                if (!done) {
                        msleep(1000);
                        if (timeout < 1) {
-                               done = TRUE;
+                               done = 1;
                                err ("HPCreadslot - Error ctlr timeout\n");
                                rc = HPC_ERROR;
                        } else