[S390] Move private simple udelay function to arch/s390/lib/delay.c.
authorHeiko Carstens <heiko.carstens@de.ibm.com>
Fri, 10 Oct 2008 19:33:22 +0000 (21:33 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Fri, 10 Oct 2008 19:33:58 +0000 (21:33 +0200)
Move cio's private simple udelay function to lib/delay.c and turn it
into something much more readable. So we have all implementations
at one place.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
arch/s390/include/asm/delay.h
arch/s390/lib/delay.c
drivers/s390/cio/cio.c

index 78357314c4503f939b0946510aaafd16da32a467..a356c958e2609d4d91ebf5b42bca2c79307bfaba 100644 (file)
@@ -15,6 +15,7 @@
 #define _S390_DELAY_H
 
 extern void __udelay(unsigned long usecs);
+extern void udelay_simple(unsigned long usecs);
 extern void __delay(unsigned long loops);
 
 #define udelay(n) __udelay(n)
index 0953cee05efc2d40cefcf8819c650de563462f6b..6ccb9fab055a5b08abb129bbd8752d11f1a0dd8c 100644 (file)
@@ -92,3 +92,16 @@ out:
        local_irq_restore(flags);
        preempt_enable();
 }
+
+/*
+ * Simple udelay variant. To be used on startup and reboot
+ * when the interrupt handler isn't working.
+ */
+void udelay_simple(unsigned long usecs)
+{
+       u64 end;
+
+       end = get_clock() + ((u64) usecs << 12);
+       while (get_clock() < end)
+               cpu_relax();
+}
index c0cb7254725611571662bf203de21ca3dc8c6591..3db2c386546f13733f122b6e0d6ef7410416548c 100644 (file)
@@ -859,19 +859,6 @@ __disable_subchannel_easy(struct subchannel_id schid, struct schib *schib)
        return -EBUSY; /* uhm... */
 }
 
-/* we can't use the normal udelay here, since it enables external interrupts */
-
-static void udelay_reset(unsigned long usecs)
-{
-       uint64_t start_cc, end_cc;
-
-       asm volatile ("STCK %0" : "=m" (start_cc));
-       do {
-               cpu_relax();
-               asm volatile ("STCK %0" : "=m" (end_cc));
-       } while (((end_cc - start_cc)/4096) < usecs);
-}
-
 static int
 __clear_io_subchannel_easy(struct subchannel_id schid)
 {
@@ -887,7 +874,7 @@ __clear_io_subchannel_easy(struct subchannel_id schid)
                        if (schid_equal(&ti.schid, &schid))
                                return 0;
                }
-               udelay_reset(100);
+               udelay_simple(100);
        }
        return -EBUSY;
 }
@@ -895,7 +882,7 @@ __clear_io_subchannel_easy(struct subchannel_id schid)
 static void __clear_chsc_subchannel_easy(void)
 {
        /* It seems we can only wait for a bit here :/ */
-       udelay_reset(100);
+       udelay_simple(100);
 }
 
 static int pgm_check_occured;