X-Git-Url: http://git.onelab.eu/?p=linux-2.6.git;a=blobdiff_plain;f=drivers%2Fs390%2Fcio%2Fairq.c;h=3720e77b465fcf463e1ed5f178226cf29457e118;hp=71c03c87e5e295b0fe1bd0852dee2e68eab7b954;hb=9213980e6a70d8473e0ffd4b39ab5b6caaba9ff5;hpb=c449269f45c2cdf53af08c8d0af37472f66539d9 diff --git a/drivers/s390/cio/airq.c b/drivers/s390/cio/airq.c index 71c03c87e..3720e77b4 100644 --- a/drivers/s390/cio/airq.c +++ b/drivers/s390/cio/airq.c @@ -2,7 +2,7 @@ * drivers/s390/cio/airq.c * S/390 common I/O routines -- support for adapter interruptions * - * $Revision: 1.11 $ + * $Revision: 1.12 $ * * Copyright (C) 1999-2002 IBM Deutschland Entwicklung GmbH, * IBM Corporation @@ -14,11 +14,11 @@ #include #include #include +#include #include "cio_debug.h" #include "airq.h" -static spinlock_t adapter_lock = SPIN_LOCK_UNLOCKED; static adapter_int_handler_t adapter_handler; /* @@ -40,23 +40,17 @@ s390_register_adapter_interrupt (adapter_int_handler_t handler) CIO_TRACE_EVENT (4, "rgaint"); - spin_lock (&adapter_lock); - if (handler == NULL) ret = -EINVAL; - else if (adapter_handler) - ret = -EBUSY; - else { - adapter_handler = handler; - ret = 0; - } - - spin_unlock (&adapter_lock); + else + ret = (cmpxchg(&adapter_handler, NULL, handler) ? -EBUSY : 0); + if (!ret) + synchronize_kernel(); sprintf (dbf_txt, "ret:%d", ret); CIO_TRACE_EVENT (4, dbf_txt); - return (ret); + return ret; } int @@ -67,38 +61,26 @@ s390_unregister_adapter_interrupt (adapter_int_handler_t handler) CIO_TRACE_EVENT (4, "urgaint"); - spin_lock (&adapter_lock); - if (handler == NULL) ret = -EINVAL; - else if (handler != adapter_handler) - ret = -EINVAL; else { adapter_handler = NULL; + synchronize_kernel(); ret = 0; } - - spin_unlock (&adapter_lock); - sprintf (dbf_txt, "ret:%d", ret); CIO_TRACE_EVENT (4, dbf_txt); - return (ret); + return ret; } void do_adapter_IO (void) { - CIO_TRACE_EVENT (4, "doaio"); - - spin_lock (&adapter_lock); + CIO_TRACE_EVENT (6, "doaio"); if (adapter_handler) (*adapter_handler) (); - - spin_unlock (&adapter_lock); - - return; } EXPORT_SYMBOL (s390_register_adapter_interrupt);