Skip to contentSkip to conversation

V4L: Event: debugging fixes

PATCH In review Sakari Ailus 2 participants 3 messages May 3, 2010 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

cover V4L: Event: debugging fixes

Hi,

Laurent Pinchart found that on uni-processor kernels without spinlock debugging spin_is_locked() is always zero, which causes a bad WARN_ON() message to be shown. The following patch removes the WARN_ON() and replaces it with assert_spin_locked() which works correctly.

Regards,

Signature · 2 lines
Sakari Ailus
[email protected]
#1 lore raw

PATCH 1/1 V4L: Events: Replace bad WARN_ON() with assert_spin_locked()

spin_is_locked() always returns zero when spinlock debugging is disabled on a single CPU machine. Replace WARN_ON() with assert_spin_locked().

Thanks to Laurent Pinchart for spotting this!

---
 drivers/media/video/v4l2-event.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/media/video/v4l2-event.c +1 -1
index 170e40f..91bb1c8 100644
@@ -152,7 +152,7 @@ static struct v4l2_subscribed_event *v4l2_event_subscribed(
 	struct v4l2_events *events = fh->events;
 	struct v4l2_subscribed_event *sev;
 
-	WARN_ON(!spin_is_locked(&fh->vdev->fh_lock));
+	assert_spin_locked(&fh->vdev->fh_lock);
 
 	list_for_each_entry(sev, &events->subscribed, list) {
 		if (sev->type == type)
Signature · 1 line
1.5.6.5
Acked-by on v1 1/1
#2 lore raw

Re: [PATCH 1/1] V4L: Events: Replace bad WARN_ON() with assert_spin_locked()

Quoted 7 lines · On Monday 03 May 2010 17:42:46 Sakari Ailus wrote:

spin_is_locked() always returns zero when spinlock debugging is disabled on a single CPU machine. Replace WARN_ON() with assert_spin_locked().

Thanks to Laurent Pinchart for spotting this!

Quoted 17 lines
---
 drivers/media/video/v4l2-event.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
(quoted diff) +0 -0

b/drivers/media/video/v4l2-event.c index 170e40f..91bb1c8 100644

drivers/media/video/v4l2-event.c +1 -1
@@ -152,7 +152,7 @@ static struct v4l2_subscribed_event
 *v4l2_event_subscribed( struct v4l2_events *events = fh->events;
 	struct v4l2_subscribed_event *sev;
 
-	WARN_ON(!spin_is_locked(&fh->vdev->fh_lock));
+	assert_spin_locked(&fh->vdev->fh_lock);
 
 	list_for_each_entry(sev, &events->subscribed, list) {
 		if (sev->type == type)
Signature · 3 lines
Regards,

Laurent Pinchart