Skip to content

Commit

Permalink
drm/nouveau/nouveau: Do not BUG_ON(!spin_is_locked()) on UP
Browse files Browse the repository at this point in the history
commit ff4c0d5 upstream.

On !SMP systems spinlocks do not exist. Thus checking of they
are active will always fail.

Use
  assert_spin_locked(lock);
instead of
  BUG_ON(!spin_is_locked(lock));
to not BUG() on all UP systems.

Signed-off-by: Bruno Prémont <bonbons@linux-vserver.org>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Bruno Prémont authored and Greg Kroah-Hartman committed Jan 16, 2015
1 parent f34d67f commit f4589f7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions drivers/gpu/drm/nouveau/core/core/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
void
nvkm_event_put(struct nvkm_event *event, u32 types, int index)
{
BUG_ON(!spin_is_locked(&event->refs_lock));
assert_spin_locked(&event->refs_lock);
while (types) {
int type = __ffs(types); types &= ~(1 << type);
if (--event->refs[index * event->types_nr + type] == 0) {
Expand All @@ -39,7 +39,7 @@ nvkm_event_put(struct nvkm_event *event, u32 types, int index)
void
nvkm_event_get(struct nvkm_event *event, u32 types, int index)
{
BUG_ON(!spin_is_locked(&event->refs_lock));
assert_spin_locked(&event->refs_lock);
while (types) {
int type = __ffs(types); types &= ~(1 << type);
if (++event->refs[index * event->types_nr + type] == 1) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/nouveau/core/core/notify.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ nvkm_notify_send(struct nvkm_notify *notify, void *data, u32 size)
struct nvkm_event *event = notify->event;
unsigned long flags;

BUG_ON(!spin_is_locked(&event->list_lock));
assert_spin_locked(&event->list_lock);
BUG_ON(size != notify->size);

spin_lock_irqsave(&event->refs_lock, flags);
Expand Down

0 comments on commit f4589f7

Please sign in to comment.