1 // SPDX-License-Identifier: GPL-2.0
3 * Functions for registration of I/O interruption subclasses on s390.
5 * Copyright IBM Corp. 2008
6 * Authors: Sebastian Ott <sebott@linux.vnet.ibm.com>
9 #include <linux/spinlock.h>
10 #include <linux/module.h>
13 static unsigned int isc_refs
[MAX_ISC
+ 1];
14 static DEFINE_SPINLOCK(isc_ref_lock
);
18 * isc_register - register an I/O interruption subclass.
19 * @isc: I/O interruption subclass to register
21 * The number of users for @isc is increased. If this is the first user to
22 * register @isc, the corresponding I/O interruption subclass mask is enabled.
25 * This function must not be called in interrupt context.
27 void isc_register(unsigned int isc
)
34 spin_lock(&isc_ref_lock
);
35 if (isc_refs
[isc
] == 0)
36 ctl_set_bit(6, 31 - isc
);
38 spin_unlock(&isc_ref_lock
);
40 EXPORT_SYMBOL_GPL(isc_register
);
43 * isc_unregister - unregister an I/O interruption subclass.
44 * @isc: I/O interruption subclass to unregister
46 * The number of users for @isc is decreased. If this is the last user to
47 * unregister @isc, the corresponding I/O interruption subclass mask is
49 * Note: This function must not be called if isc_register() hasn't been called
50 * before by the driver for @isc.
53 * This function must not be called in interrupt context.
55 void isc_unregister(unsigned int isc
)
57 spin_lock(&isc_ref_lock
);
58 /* check for misuse */
59 if (isc
> MAX_ISC
|| isc_refs
[isc
] == 0) {
63 if (isc_refs
[isc
] == 1)
64 ctl_clear_bit(6, 31 - isc
);
67 spin_unlock(&isc_ref_lock
);
69 EXPORT_SYMBOL_GPL(isc_unregister
);