Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
b68d8890
Commit
b68d8890
authored
Jul 25, 2009
by
Thomas Gleixner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pci: Convert pci_lock to atomic_spinlock
Signed-off-by:
Thomas Gleixner
<
tglx@linutronix.de
>
parent
dc23e836
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
17 deletions
+17
-17
drivers/pci/access.c
drivers/pci/access.c
+17
-17
No files found.
drivers/pci/access.c
View file @
b68d8890
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
* configuration space.
* configuration space.
*/
*/
static
DEFINE_SPINLOCK
(
pci_lock
);
static
DEFINE_
ATOMIC_
SPINLOCK
(
pci_lock
);
/*
/*
* Wrappers for all PCI configuration access functions. They just check
* Wrappers for all PCI configuration access functions. They just check
...
@@ -32,10 +32,10 @@ int pci_bus_read_config_##size \
...
@@ -32,10 +32,10 @@ int pci_bus_read_config_##size \
unsigned long flags; \
unsigned long flags; \
u32 data = 0; \
u32 data = 0; \
if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; \
if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; \
spin_lock_irqsave(&pci_lock, flags);
\
atomic_spin_lock_irqsave(&pci_lock, flags);
\
res = bus->ops->read(bus, devfn, pos, len, &data); \
res = bus->ops->read(bus, devfn, pos, len, &data); \
*value = (type)data; \
*value = (type)data; \
spin_unlock_irqrestore(&pci_lock, flags);
\
atomic_spin_unlock_irqrestore(&pci_lock, flags);
\
return res; \
return res; \
}
}
...
@@ -46,9 +46,9 @@ int pci_bus_write_config_##size \
...
@@ -46,9 +46,9 @@ int pci_bus_write_config_##size \
int res; \
int res; \
unsigned long flags; \
unsigned long flags; \
if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; \
if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; \
spin_lock_irqsave(&pci_lock, flags);
\
atomic_spin_lock_irqsave(&pci_lock, flags);
\
res = bus->ops->write(bus, devfn, pos, len, value); \
res = bus->ops->write(bus, devfn, pos, len, value); \
spin_unlock_irqrestore(&pci_lock, flags);
\
atomic_spin_unlock_irqrestore(&pci_lock, flags);
\
return res; \
return res; \
}
}
...
@@ -78,10 +78,10 @@ struct pci_ops *pci_bus_set_ops(struct pci_bus *bus, struct pci_ops *ops)
...
@@ -78,10 +78,10 @@ struct pci_ops *pci_bus_set_ops(struct pci_bus *bus, struct pci_ops *ops)
struct
pci_ops
*
old_ops
;
struct
pci_ops
*
old_ops
;
unsigned
long
flags
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
pci_lock
,
flags
);
atomic_
spin_lock_irqsave
(
&
pci_lock
,
flags
);
old_ops
=
bus
->
ops
;
old_ops
=
bus
->
ops
;
bus
->
ops
=
ops
;
bus
->
ops
=
ops
;
spin_unlock_irqrestore
(
&
pci_lock
,
flags
);
atomic_
spin_unlock_irqrestore
(
&
pci_lock
,
flags
);
return
old_ops
;
return
old_ops
;
}
}
EXPORT_SYMBOL
(
pci_bus_set_ops
);
EXPORT_SYMBOL
(
pci_bus_set_ops
);
...
@@ -135,9 +135,9 @@ static noinline void pci_wait_ucfg(struct pci_dev *dev)
...
@@ -135,9 +135,9 @@ static noinline void pci_wait_ucfg(struct pci_dev *dev)
__add_wait_queue
(
&
pci_ucfg_wait
,
&
wait
);
__add_wait_queue
(
&
pci_ucfg_wait
,
&
wait
);
do
{
do
{
set_current_state
(
TASK_UNINTERRUPTIBLE
);
set_current_state
(
TASK_UNINTERRUPTIBLE
);
spin_unlock_irq
(
&
pci_lock
);
atomic_
spin_unlock_irq
(
&
pci_lock
);
schedule
();
schedule
();
spin_lock_irq
(
&
pci_lock
);
atomic_
spin_lock_irq
(
&
pci_lock
);
}
while
(
dev
->
block_ucfg_access
);
}
while
(
dev
->
block_ucfg_access
);
__remove_wait_queue
(
&
pci_ucfg_wait
,
&
wait
);
__remove_wait_queue
(
&
pci_ucfg_wait
,
&
wait
);
}
}
...
@@ -149,11 +149,11 @@ int pci_user_read_config_##size \
...
@@ -149,11 +149,11 @@ int pci_user_read_config_##size \
int ret = 0; \
int ret = 0; \
u32 data = -1; \
u32 data = -1; \
if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; \
if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; \
spin_lock_irq(&pci_lock);
\
atomic_spin_lock_irq(&pci_lock);
\
if (unlikely(dev->block_ucfg_access)) pci_wait_ucfg(dev); \
if (unlikely(dev->block_ucfg_access)) pci_wait_ucfg(dev); \
ret = dev->bus->ops->read(dev->bus, dev->devfn, \
ret = dev->bus->ops->read(dev->bus, dev->devfn, \
pos, sizeof(type), &data); \
pos, sizeof(type), &data); \
spin_unlock_irq(&pci_lock);
\
atomic_spin_unlock_irq(&pci_lock);
\
*val = (type)data; \
*val = (type)data; \
return ret; \
return ret; \
}
}
...
@@ -164,11 +164,11 @@ int pci_user_write_config_##size \
...
@@ -164,11 +164,11 @@ int pci_user_write_config_##size \
{ \
{ \
int ret = -EIO; \
int ret = -EIO; \
if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; \
if (PCI_##size##_BAD) return PCIBIOS_BAD_REGISTER_NUMBER; \
spin_lock_irq(&pci_lock);
\
atomic_spin_lock_irq(&pci_lock);
\
if (unlikely(dev->block_ucfg_access)) pci_wait_ucfg(dev); \
if (unlikely(dev->block_ucfg_access)) pci_wait_ucfg(dev); \
ret = dev->bus->ops->write(dev->bus, dev->devfn, \
ret = dev->bus->ops->write(dev->bus, dev->devfn, \
pos, sizeof(type), val); \
pos, sizeof(type), val); \
spin_unlock_irq(&pci_lock);
\
atomic_spin_unlock_irq(&pci_lock);
\
return ret; \
return ret; \
}
}
...
@@ -395,10 +395,10 @@ void pci_block_user_cfg_access(struct pci_dev *dev)
...
@@ -395,10 +395,10 @@ void pci_block_user_cfg_access(struct pci_dev *dev)
unsigned
long
flags
;
unsigned
long
flags
;
int
was_blocked
;
int
was_blocked
;
spin_lock_irqsave
(
&
pci_lock
,
flags
);
atomic_
spin_lock_irqsave
(
&
pci_lock
,
flags
);
was_blocked
=
dev
->
block_ucfg_access
;
was_blocked
=
dev
->
block_ucfg_access
;
dev
->
block_ucfg_access
=
1
;
dev
->
block_ucfg_access
=
1
;
spin_unlock_irqrestore
(
&
pci_lock
,
flags
);
atomic_
spin_unlock_irqrestore
(
&
pci_lock
,
flags
);
/* If we BUG() inside the pci_lock, we're guaranteed to hose
/* If we BUG() inside the pci_lock, we're guaranteed to hose
* the machine */
* the machine */
...
@@ -416,7 +416,7 @@ void pci_unblock_user_cfg_access(struct pci_dev *dev)
...
@@ -416,7 +416,7 @@ void pci_unblock_user_cfg_access(struct pci_dev *dev)
{
{
unsigned
long
flags
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
pci_lock
,
flags
);
atomic_
spin_lock_irqsave
(
&
pci_lock
,
flags
);
/* This indicates a problem in the caller, but we don't need
/* This indicates a problem in the caller, but we don't need
* to kill them, unlike a double-block above. */
* to kill them, unlike a double-block above. */
...
@@ -424,6 +424,6 @@ void pci_unblock_user_cfg_access(struct pci_dev *dev)
...
@@ -424,6 +424,6 @@ void pci_unblock_user_cfg_access(struct pci_dev *dev)
dev
->
block_ucfg_access
=
0
;
dev
->
block_ucfg_access
=
0
;
wake_up_all
(
&
pci_ucfg_wait
);
wake_up_all
(
&
pci_ucfg_wait
);
spin_unlock_irqrestore
(
&
pci_lock
,
flags
);
atomic_
spin_unlock_irqrestore
(
&
pci_lock
,
flags
);
}
}
EXPORT_SYMBOL_GPL
(
pci_unblock_user_cfg_access
);
EXPORT_SYMBOL_GPL
(
pci_unblock_user_cfg_access
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment