linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / char / hvcs.c
index 4589ff3..831eb4e 100644 (file)
  * the hvcs_final_close() function in order to get it out of the spinlock.
  * Rearranged hvcs_close().  Cleaned up some printks and did some housekeeping
  * on the changelog.  Removed local CLC_LENGTH and used HVCS_CLC_LENGTH from
- * include/asm-powerpc/hvcserver.h 
+ * arch/ppc64/hvcserver.h.
  *
  * 1.3.2 -> 1.3.3 Replaced yield() in hvcs_close() with tty_wait_until_sent() to
  * prevent possible lockup with realtime scheduling as similarily pointed out by
@@ -168,10 +168,9 @@ MODULE_VERSION(HVCS_DRIVER_VERSION);
 
 /*
  * The hcall interface involves putting 8 chars into each of two registers.
- * We load up those 2 registers (in arch/powerpc/platforms/pseries/hvconsole.c)
- * by casting char[16] to long[2].  It would work without __ALIGNED__, but a 
- * little (tiny) bit slower because an unaligned load is slower than aligned 
- * load.
+ * We load up those 2 registers (in arch/ppc64/hvconsole.c) by casting char[16]
+ * to long[2].  It would work without __ALIGNED__, but a little (tiny) bit
+ * slower because an unaligned load is slower than aligned load.
  */
 #define __ALIGNED__    __attribute__((__aligned__(8)))
 
@@ -439,6 +438,7 @@ static int hvcs_io(struct hvcs_struct *hvcsd)
        char buf[HVCS_BUFF_LEN] __ALIGNED__;
        unsigned long flags;
        int got = 0;
+       int i;
 
        spin_lock_irqsave(&hvcsd->lock, flags);
 
@@ -899,12 +899,12 @@ static int hvcs_enable_device(struct hvcs_struct *hvcsd, uint32_t unit_address,
         * the conn was registered and now.
         */
        if (!(rc = request_irq(irq, &hvcs_handle_interrupt,
-                               IRQF_DISABLED, "ibmhvcs", hvcsd))) {
+                               SA_INTERRUPT, "ibmhvcs", hvcsd))) {
                /*
                 * It is possible the vty-server was removed after the irq was
                 * requested but before we have time to enable interrupts.
                 */
-               if (vio_enable_interrupts(vdev) == H_SUCCESS)
+               if (vio_enable_interrupts(vdev) == H_Success)
                        return 0;
                else {
                        printk(KERN_ERR "HVCS: int enable failed for"
@@ -1320,12 +1320,11 @@ static struct tty_operations hvcs_ops = {
 static int hvcs_alloc_index_list(int n)
 {
        int i;
-
        hvcs_index_list = kmalloc(n * sizeof(hvcs_index_count),GFP_KERNEL);
        if (!hvcs_index_list)
                return -ENOMEM;
        hvcs_index_count = n;
-       for (i = 0; i < hvcs_index_count; i++)
+       for(i = 0; i < hvcs_index_count; i++)
                hvcs_index_list[i] = -1;
        return 0;
 }
@@ -1333,9 +1332,11 @@ static int hvcs_alloc_index_list(int n)
 static void hvcs_free_index_list(void)
 {
        /* Paranoia check to be thorough. */
-       kfree(hvcs_index_list);
-       hvcs_index_list = NULL;
-       hvcs_index_count = 0;
+       if (hvcs_index_list) {
+               kfree(hvcs_index_list);
+               hvcs_index_list = NULL;
+               hvcs_index_count = 0;
+       }
 }
 
 static int __init hvcs_module_init(void)
@@ -1363,6 +1364,7 @@ static int __init hvcs_module_init(void)
 
        hvcs_tty_driver->driver_name = hvcs_driver_name;
        hvcs_tty_driver->name = hvcs_device_node;
+       hvcs_tty_driver->devfs_name = hvcs_device_node;
 
        /*
         * We'll let the system assign us a major number, indicated by leaving