fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / arch / s390 / hypfs / hypfs_diag.c
index 1785bce..2782cf9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  fs/hypfs/hypfs_diag.c
+ *  arch/s390/hypfs/hypfs_diag.c
  *    Hypervisor filesystem for Linux on s390. Diag 204 and 224
  *    implementation.
  *
@@ -333,22 +333,14 @@ static int diag204(unsigned long subcode, unsigned long size, void *addr)
        register unsigned long _subcode asm("0") = subcode;
        register unsigned long _size asm("1") = size;
 
-       asm volatile ("   diag    %2,%0,0x204\n"
-                     "0: \n" ".section __ex_table,\"a\"\n"
-#ifndef __s390x__
-                     "    .align 4\n"
-                     "    .long  0b,0b\n"
-#else
-                     "    .align 8\n"
-                     "    .quad  0b,0b\n"
-#endif
-                     ".previous":"+d" (_subcode), "+d"(_size)
-                     :"d"(addr)
-                     :"memory");
+       asm volatile(
+               "       diag    %2,%0,0x204\n"
+               "0:\n"
+               EX_TABLE(0b,0b)
+               : "+d" (_subcode), "+d" (_size) : "d" (addr) : "memory");
        if (_subcode)
                return -1;
-       else
-               return _size;
+       return _size;
 }
 
 /*
@@ -387,7 +379,7 @@ static void *diag204_alloc_vbuf(int pages)
 static void *diag204_alloc_rbuf(void)
 {
        diag204_buf = (void*)__get_free_pages(GFP_KERNEL,0);
-       if (diag204_buf)
+       if (!diag204_buf)
                return ERR_PTR(-ENOMEM);
        diag204_buf_pages = 1;
        return diag204_buf;
@@ -403,7 +395,8 @@ static void *diag204_get_buffer(enum diag204_format fmt, int *pages)
                *pages = 1;
                return diag204_alloc_rbuf();
        } else {/* INFO_EXT */
-               *pages = diag204(SUBC_RSI | INFO_EXT, 0, NULL);
+               *pages = diag204((unsigned long)SUBC_RSI |
+                                (unsigned long)INFO_EXT, 0, NULL);
                if (*pages <= 0)
                        return ERR_PTR(-ENOSYS);
                else
@@ -432,12 +425,14 @@ static int diag204_probe(void)
 
        buf = diag204_get_buffer(INFO_EXT, &pages);
        if (!IS_ERR(buf)) {
-               if (diag204(SUBC_STIB7 | INFO_EXT, pages, buf) >= 0) {
+               if (diag204((unsigned long)SUBC_STIB7 |
+                           (unsigned long)INFO_EXT, pages, buf) >= 0) {
                        diag204_store_sc = SUBC_STIB7;
                        diag204_info_type = INFO_EXT;
                        goto out;
                }
-               if (diag204(SUBC_STIB6 | INFO_EXT, pages, buf) >= 0) {
+               if (diag204((unsigned long)SUBC_STIB6 |
+                           (unsigned long)INFO_EXT, pages, buf) >= 0) {
                        diag204_store_sc = SUBC_STIB7;
                        diag204_info_type = INFO_EXT;
                        goto out;
@@ -452,7 +447,8 @@ static int diag204_probe(void)
                rc = PTR_ERR(buf);
                goto fail_alloc;
        }
-       if (diag204(SUBC_STIB4 | INFO_SIMPLE, pages, buf) >= 0) {
+       if (diag204((unsigned long)SUBC_STIB4 |
+                   (unsigned long)INFO_SIMPLE, pages, buf) >= 0) {
                diag204_store_sc = SUBC_STIB4;
                diag204_info_type = INFO_SIMPLE;
                goto out;
@@ -476,7 +472,8 @@ static void *diag204_store(void)
        buf = diag204_get_buffer(diag204_info_type, &pages);
        if (IS_ERR(buf))
                goto out;
-       if (diag204(diag204_store_sc | diag204_info_type, pages, buf) < 0)
+       if (diag204((unsigned long)diag204_store_sc |
+                   (unsigned long)diag204_info_type, pages, buf) < 0)
                return ERR_PTR(-ENOSYS);
 out:
        return buf;
@@ -486,8 +483,7 @@ out:
 
 static void diag224(void *ptr)
 {
-       asm volatile("   diag    %0,%1,0x224\n"
-                    : :"d" (0), "d"(ptr) : "memory");
+       asm volatile("diag %0,%1,0x224" : :"d" (0), "d"(ptr) : "memory");
 }
 
 static int diag224_get_name_table(void)
@@ -525,13 +521,13 @@ __init int hypfs_diag_init(void)
        }
        rc = diag224_get_name_table();
        if (rc) {
-               diag224_delete_name_table();
+               diag204_free_buffer();
                printk(KERN_ERR "hypfs: could not get name table.\n");
        }
        return rc;
 }
 
-__exit void hypfs_diag_exit(void)
+void hypfs_diag_exit(void)
 {
        diag224_delete_name_table();
        diag204_free_buffer();