![]() |
|
|||
0001 // SPDX-License-Identifier: GPL-2.0 0002 /* 0003 * Functions for registration of I/O interruption subclasses on s390. 0004 * 0005 * Copyright IBM Corp. 2008 0006 * Authors: Sebastian Ott <sebott@linux.vnet.ibm.com> 0007 */ 0008 0009 #include <linux/spinlock.h> 0010 #include <linux/module.h> 0011 #include <asm/isc.h> 0012 0013 static unsigned int isc_refs[MAX_ISC + 1]; 0014 static DEFINE_SPINLOCK(isc_ref_lock); 0015 0016 0017 /** 0018 * isc_register - register an I/O interruption subclass. 0019 * @isc: I/O interruption subclass to register 0020 * 0021 * The number of users for @isc is increased. If this is the first user to 0022 * register @isc, the corresponding I/O interruption subclass mask is enabled. 0023 * 0024 * Context: 0025 * This function must not be called in interrupt context. 0026 */ 0027 void isc_register(unsigned int isc) 0028 { 0029 if (isc > MAX_ISC) { 0030 WARN_ON(1); 0031 return; 0032 } 0033 0034 spin_lock(&isc_ref_lock); 0035 if (isc_refs[isc] == 0) 0036 ctl_set_bit(6, 31 - isc); 0037 isc_refs[isc]++; 0038 spin_unlock(&isc_ref_lock); 0039 } 0040 EXPORT_SYMBOL_GPL(isc_register); 0041 0042 /** 0043 * isc_unregister - unregister an I/O interruption subclass. 0044 * @isc: I/O interruption subclass to unregister 0045 * 0046 * The number of users for @isc is decreased. If this is the last user to 0047 * unregister @isc, the corresponding I/O interruption subclass mask is 0048 * disabled. 0049 * Note: This function must not be called if isc_register() hasn't been called 0050 * before by the driver for @isc. 0051 * 0052 * Context: 0053 * This function must not be called in interrupt context. 0054 */ 0055 void isc_unregister(unsigned int isc) 0056 { 0057 spin_lock(&isc_ref_lock); 0058 /* check for misuse */ 0059 if (isc > MAX_ISC || isc_refs[isc] == 0) { 0060 WARN_ON(1); 0061 goto out_unlock; 0062 } 0063 if (isc_refs[isc] == 1) 0064 ctl_clear_bit(6, 31 - isc); 0065 isc_refs[isc]--; 0066 out_unlock: 0067 spin_unlock(&isc_ref_lock); 0068 } 0069 EXPORT_SYMBOL_GPL(isc_unregister);
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |