aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2010-02-17 09:35:19 -0500
committerJesse Barnes <jbarnes@virtuousgeek.org>2010-05-11 15:01:09 -0400
commit511dd98ce8cf6dc4f8f2cb32a8af31ce9f4ba4a1 (patch)
tree2f95b0d3b64084bf66d605bd2aeecaa69f975122 /drivers
parent52b265a12768b9a72679bec825eb82c784116464 (diff)
PCI: Convert pci_lock to raw_spinlock
pci_lock must be a real spinlock in preempt-rt. Convert it to raw_spinlock. No change for !RT kernels. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/access.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/drivers/pci/access.c b/drivers/pci/access.c
index 2f646fe1260f..affb83b42ebb 100644
--- a/drivers/pci/access.c
+++ b/drivers/pci/access.c
@@ -13,7 +13,7 @@
13 * configuration space. 13 * configuration space.
14 */ 14 */
15 15
16static DEFINE_SPINLOCK(pci_lock); 16static DEFINE_RAW_SPINLOCK(pci_lock);
17 17
18/* 18/*
19 * Wrappers for all PCI configuration access functions. They just check 19 * Wrappers for all PCI configuration access functions. They just check
@@ -33,10 +33,10 @@ int pci_bus_read_config_##size \
33 unsigned long flags; \ 33 unsigned long flags; \
34 u32 data = 0; \ 34 u32 data = 0; \
35 if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; \ 35 if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; \
36 spin_lock_irqsave(&pci_lock, flags); \ 36 raw_spin_lock_irqsave(&pci_lock, flags); \
37 res = bus->ops->read(bus, devfn, pos, len, &data); \ 37 res = bus->ops->read(bus, devfn, pos, len, &data); \
38 *value = (type)data; \ 38 *value = (type)data; \
39 spin_unlock_irqrestore(&pci_lock, flags); \ 39 raw_spin_unlock_irqrestore(&pci_lock, flags); \
40 return res; \ 40 return res; \
41} 41}
42 42
@@ -47,9 +47,9 @@ int pci_bus_write_config_##size \
47 int res; \ 47 int res; \
48 unsigned long flags; \ 48 unsigned long flags; \
49 if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; \ 49 if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; \
50 spin_lock_irqsave(&pci_lock, flags); \ 50 raw_spin_lock_irqsave(&pci_lock, flags); \
51 res = bus->ops->write(bus, devfn, pos, len, value); \ 51 res = bus->ops->write(bus, devfn, pos, len, value); \
52 spin_unlock_irqrestore(&pci_lock, flags); \ 52 raw_spin_unlock_irqrestore(&pci_lock, flags); \
53 return res; \ 53 return res; \
54} 54}
55 55
@@ -79,10 +79,10 @@ struct pci_ops *pci_bus_set_ops(struct pci_bus *bus, struct pci_ops *ops)
79 struct pci_ops *old_ops; 79 struct pci_ops *old_ops;
80 unsigned long flags; 80 unsigned long flags;
81 81
82 spin_lock_irqsave(&pci_lock, flags); 82 raw_spin_lock_irqsave(&pci_lock, flags);
83 old_ops = bus->ops; 83 old_ops = bus->ops;
84 bus->ops = ops; 84 bus->ops = ops;
85 spin_unlock_irqrestore(&pci_lock, flags); 85 raw_spin_unlock_irqrestore(&pci_lock, flags);
86 return old_ops; 86 return old_ops;
87} 87}
88EXPORT_SYMBOL(pci_bus_set_ops); 88EXPORT_SYMBOL(pci_bus_set_ops);
@@ -136,9 +136,9 @@ static noinline void pci_wait_ucfg(struct pci_dev *dev)
136 __add_wait_queue(&pci_ucfg_wait, &wait); 136 __add_wait_queue(&pci_ucfg_wait, &wait);
137 do { 137 do {
138 set_current_state(TASK_UNINTERRUPTIBLE); 138 set_current_state(TASK_UNINTERRUPTIBLE);
139 spin_unlock_irq(&pci_lock); 139 raw_spin_unlock_irq(&pci_lock);
140 schedule(); 140 schedule();
141 spin_lock_irq(&pci_lock); 141 raw_spin_lock_irq(&pci_lock);
142 } while (dev->block_ucfg_access); 142 } while (dev->block_ucfg_access);
143 __remove_wait_queue(&pci_ucfg_wait, &wait); 143 __remove_wait_queue(&pci_ucfg_wait, &wait);
144} 144}
@@ -150,11 +150,11 @@ int pci_user_read_config_##size \
150 int ret = 0; \ 150 int ret = 0; \
151 u32 data = -1; \ 151 u32 data = -1; \
152 if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; \ 152 if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; \
153 spin_lock_irq(&pci_lock); \ 153 raw_spin_lock_irq(&pci_lock); \
154 if (unlikely(dev->block_ucfg_access)) pci_wait_ucfg(dev); \ 154 if (unlikely(dev->block_ucfg_access)) pci_wait_ucfg(dev); \
155 ret = dev->bus->ops->read(dev->bus, dev->devfn, \ 155 ret = dev->bus->ops->read(dev->bus, dev->devfn, \
156 pos, sizeof(type), &data); \ 156 pos, sizeof(type), &data); \
157 spin_unlock_irq(&pci_lock); \ 157 raw_spin_unlock_irq(&pci_lock); \
158 *val = (type)data; \ 158 *val = (type)data; \
159 return ret; \ 159 return ret; \
160} 160}
@@ -165,11 +165,11 @@ int pci_user_write_config_##size \
165{ \ 165{ \
166 int ret = -EIO; \ 166 int ret = -EIO; \
167 if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; \ 167 if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; \
168 spin_lock_irq(&pci_lock); \ 168 raw_spin_lock_irq(&pci_lock); \
169 if (unlikely(dev->block_ucfg_access)) pci_wait_ucfg(dev); \ 169 if (unlikely(dev->block_ucfg_access)) pci_wait_ucfg(dev); \
170 ret = dev->bus->ops->write(dev->bus, dev->devfn, \ 170 ret = dev->bus->ops->write(dev->bus, dev->devfn, \
171 pos, sizeof(type), val); \ 171 pos, sizeof(type), val); \
172 spin_unlock_irq(&pci_lock); \ 172 raw_spin_unlock_irq(&pci_lock); \
173 return ret; \ 173 return ret; \
174} 174}
175 175
@@ -396,10 +396,10 @@ void pci_block_user_cfg_access(struct pci_dev *dev)
396 unsigned long flags; 396 unsigned long flags;
397 int was_blocked; 397 int was_blocked;
398 398
399 spin_lock_irqsave(&pci_lock, flags); 399 raw_spin_lock_irqsave(&pci_lock, flags);
400 was_blocked = dev->block_ucfg_access; 400 was_blocked = dev->block_ucfg_access;
401 dev->block_ucfg_access = 1; 401 dev->block_ucfg_access = 1;
402 spin_unlock_irqrestore(&pci_lock, flags); 402 raw_spin_unlock_irqrestore(&pci_lock, flags);
403 403
404 /* If we BUG() inside the pci_lock, we're guaranteed to hose 404 /* If we BUG() inside the pci_lock, we're guaranteed to hose
405 * the machine */ 405 * the machine */
@@ -417,7 +417,7 @@ void pci_unblock_user_cfg_access(struct pci_dev *dev)
417{ 417{
418 unsigned long flags; 418 unsigned long flags;
419 419
420 spin_lock_irqsave(&pci_lock, flags); 420 raw_spin_lock_irqsave(&pci_lock, flags);
421 421
422 /* This indicates a problem in the caller, but we don't need 422 /* This indicates a problem in the caller, but we don't need
423 * to kill them, unlike a double-block above. */ 423 * to kill them, unlike a double-block above. */
@@ -425,6 +425,6 @@ void pci_unblock_user_cfg_access(struct pci_dev *dev)
425 425
426 dev->block_ucfg_access = 0; 426 dev->block_ucfg_access = 0;
427 wake_up_all(&pci_ucfg_wait); 427 wake_up_all(&pci_ucfg_wait);
428 spin_unlock_irqrestore(&pci_lock, flags); 428 raw_spin_unlock_irqrestore(&pci_lock, flags);
429} 429}
430EXPORT_SYMBOL_GPL(pci_unblock_user_cfg_access); 430EXPORT_SYMBOL_GPL(pci_unblock_user_cfg_access);