2 * Functions for registration of I/O interruption subclasses on s390.
4 * Copyright IBM Corp. 2008
5 * Authors: Sebastian Ott <sebott@linux.vnet.ibm.com>
8 #include <linux/spinlock.h>
9 #include <linux/module.h>
12 static unsigned int isc_refs[MAX_ISC + 1];
13 static DEFINE_SPINLOCK(isc_ref_lock);
17 * isc_register - register an I/O interruption subclass.
18 * @isc: I/O interruption subclass to register
20 * The number of users for @isc is increased. If this is the first user to
21 * register @isc, the corresponding I/O interruption subclass mask is enabled.
24 * This function must not be called in interrupt context.
26 void isc_register(unsigned int isc)
33 spin_lock(&isc_ref_lock);
34 if (isc_refs[isc] == 0)
35 ctl_set_bit(6, 31 - isc);
37 spin_unlock(&isc_ref_lock);
39 EXPORT_SYMBOL_GPL(isc_register);
42 * isc_unregister - unregister an I/O interruption subclass.
43 * @isc: I/O interruption subclass to unregister
45 * The number of users for @isc is decreased. If this is the last user to
46 * unregister @isc, the corresponding I/O interruption subclass mask is
48 * Note: This function must not be called if isc_register() hasn't been called
49 * before by the driver for @isc.
52 * This function must not be called in interrupt context.
54 void isc_unregister(unsigned int isc)
56 spin_lock(&isc_ref_lock);
57 /* check for misuse */
58 if (isc > MAX_ISC || isc_refs[isc] == 0) {
62 if (isc_refs[isc] == 1)
63 ctl_clear_bit(6, 31 - isc);
66 spin_unlock(&isc_ref_lock);
68 EXPORT_SYMBOL_GPL(isc_unregister);