Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/pci: clarify interrupt vector usage

Rename and clarify the usage of the interrupt bit vectors. Also change
the array of the per-function bit vectors to be dynamically allocated.

Signed-off-by: Sebastian Ott <sebott@linux.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>

authored by

Sebastian Ott and committed by
Martin Schwidefsky
b1f54864 30e63ef2

+26 -12
+26 -12
arch/s390/pci/pci_irq.c
··· 14 14 #define SIC_IRQ_MODE_ALL 0 15 15 #define SIC_IRQ_MODE_SINGLE 1 16 16 17 - static struct airq_iv *zpci_aisb_iv; 18 - static struct airq_iv *zpci_aibv[ZPCI_NR_DEVICES]; 17 + /* 18 + * summary bit vector - one summary bit per function 19 + */ 20 + static struct airq_iv *zpci_sbv; 21 + 22 + /* 23 + * interrupt bit vectors - one vector per function 24 + */ 25 + static struct airq_iv **zpci_ibv; 19 26 20 27 /* Modify PCI: Register adapter interruptions */ 21 28 static int zpci_set_airq(struct zpci_dev *zdev) ··· 36 29 fib.noi = airq_iv_end(zdev->aibv); 37 30 fib.aibv = (unsigned long) zdev->aibv->vector; 38 31 fib.aibvo = 0; /* each zdev has its own interrupt vector */ 39 - fib.aisb = (unsigned long) zpci_aisb_iv->vector + (zdev->aisb/64)*8; 32 + fib.aisb = (unsigned long) zpci_sbv->vector + (zdev->aisb/64)*8; 40 33 fib.aisbo = zdev->aisb & 63; 41 34 42 35 return zpci_mod_fc(req, &fib, &status) ? -EIO : 0; ··· 72 65 inc_irq_stat(IRQIO_PCI); 73 66 for (si = 0;;) { 74 67 /* Scan adapter summary indicator bit vector */ 75 - si = airq_iv_scan(zpci_aisb_iv, si, airq_iv_end(zpci_aisb_iv)); 68 + si = airq_iv_scan(zpci_sbv, si, airq_iv_end(zpci_sbv)); 76 69 if (si == -1UL) { 77 70 if (irqs_on++) 78 71 /* End of second scan with interrupts on. */ ··· 85 78 } 86 79 87 80 /* Scan the adapter interrupt vector for this device. */ 88 - aibv = zpci_aibv[si]; 81 + aibv = zpci_ibv[si]; 89 82 for (ai = 0;;) { 90 83 ai = airq_iv_scan(aibv, ai, airq_iv_end(aibv)); 91 84 if (ai == -1UL) ··· 113 106 msi_vecs = min_t(unsigned int, nvec, zdev->max_msi); 114 107 115 108 /* Allocate adapter summary indicator bit */ 116 - aisb = airq_iv_alloc_bit(zpci_aisb_iv); 109 + aisb = airq_iv_alloc_bit(zpci_sbv); 117 110 if (aisb == -1UL) 118 111 return -EIO; 119 112 zdev->aisb = aisb; ··· 124 117 return -ENOMEM; 125 118 126 119 /* Wire up shortcut pointer */ 127 - zpci_aibv[aisb] = zdev->aibv; 120 + zpci_ibv[aisb] = zdev->aibv; 128 121 129 122 /* Request MSI interrupts */ 130 123 hwirq = 0; ··· 183 176 } 184 177 185 178 if (zdev->aisb != -1UL) { 186 - zpci_aibv[zdev->aisb] = NULL; 187 - airq_iv_free_bit(zpci_aisb_iv, zdev->aisb); 179 + zpci_ibv[zdev->aisb] = NULL; 180 + airq_iv_free_bit(zpci_sbv, zdev->aisb); 188 181 zdev->aisb = -1UL; 189 182 } 190 183 if (zdev->aibv) { ··· 209 202 *zpci_airq.lsi_ptr = 1; 210 203 211 204 rc = -ENOMEM; 212 - zpci_aisb_iv = airq_iv_create(ZPCI_NR_DEVICES, AIRQ_IV_ALLOC); 213 - if (!zpci_aisb_iv) 205 + zpci_ibv = kcalloc(ZPCI_NR_DEVICES, sizeof(*zpci_ibv), GFP_KERNEL); 206 + if (!zpci_ibv) 214 207 goto out_airq; 208 + 209 + zpci_sbv = airq_iv_create(ZPCI_NR_DEVICES, AIRQ_IV_ALLOC); 210 + if (!zpci_sbv) 211 + goto out_free; 215 212 216 213 zpci_set_irq_ctrl(SIC_IRQ_MODE_SINGLE, NULL, PCI_ISC); 217 214 return 0; 218 215 216 + out_free: 217 + kfree(zpci_ibv); 219 218 out_airq: 220 219 unregister_adapter_interrupt(&zpci_airq); 221 220 out: ··· 230 217 231 218 void __init zpci_irq_exit(void) 232 219 { 233 - airq_iv_release(zpci_aisb_iv); 220 + airq_iv_release(zpci_sbv); 221 + kfree(zpci_ibv); 234 222 unregister_adapter_interrupt(&zpci_airq); 235 223 }