summaryrefslogtreecommitdiff
path: root/drivers/media/video/cx88/cx88-blackbird.c
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2011-05-01 06:31:04 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-05-20 09:29:42 -0300
commitf4bd4be8d113534a28e0c9a86cddbabd47b06159 (patch)
tree2c059112f19c98071dd25039a88ddffd1ca53d39 /drivers/media/video/cx88/cx88-blackbird.c
parent579b2b45120fa33f750cd65150d6d8995938750b (diff)
[media] cx88: don't use atomic_t for core->mpeg_users
mpeg_users is always read or written with core->lock held except in mpeg_release (where it looks like a bug). A plain int is simpler and faster. Tested-by: Andi Huber <hobrom@gmx.at> Tested-by: Marlon de Boer <marlon@hyves.nl> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx88/cx88-blackbird.c')
-rw-r--r--drivers/media/video/cx88/cx88-blackbird.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index fa8e347c448c..11e49bbc4a66 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -1073,7 +1073,7 @@ static int mpeg_open(struct file *file)
return err;
}
- if (!atomic_read(&dev->core->mpeg_users) && blackbird_initialize_codec(dev) < 0) {
+ if (!dev->core->mpeg_users && blackbird_initialize_codec(dev) < 0) {
drv->request_release(drv);
mutex_unlock(&dev->core->lock);
return -EINVAL;
@@ -1101,7 +1101,7 @@ static int mpeg_open(struct file *file)
cx88_set_scale(dev->core, dev->width, dev->height,
fh->mpegq.field);
- atomic_inc(&dev->core->mpeg_users);
+ dev->core->mpeg_users++;
mutex_unlock(&dev->core->lock);
return 0;
}
@@ -1112,7 +1112,9 @@ static int mpeg_release(struct file *file)
struct cx8802_dev *dev = fh->dev;
struct cx8802_driver *drv = NULL;
- if (dev->mpeg_active && atomic_read(&dev->core->mpeg_users) == 1)
+ mutex_lock(&dev->core->lock);
+
+ if (dev->mpeg_active && dev->core->mpeg_users == 1)
blackbird_stop_codec(dev);
cx8802_cancel_buffers(fh->dev);
@@ -1121,7 +1123,6 @@ static int mpeg_release(struct file *file)
videobuf_mmap_free(&fh->mpegq);
- mutex_lock(&dev->core->lock);
file->private_data = NULL;
kfree(fh);
@@ -1131,7 +1132,7 @@ static int mpeg_release(struct file *file)
if (drv)
drv->request_release(drv);
- atomic_dec(&dev->core->mpeg_users);
+ dev->core->mpeg_users--;
mutex_unlock(&dev->core->lock);