aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2011-05-01 05:31:40 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-05-20 08:29:43 -0400
commit8d115931622eb19a15f2633cb35dd2c4a66db255 (patch)
tree23216f6e5fc4f71449369ad500824832d97ea8b9
parentf4bd4be8d113534a28e0c9a86cddbabd47b06159 (diff)
[media] cx88: don't use atomic_t for core->users
users is always read or written with core->lock held. 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>
-rw-r--r--drivers/media/video/cx88/cx88-video.c5
-rw-r--r--drivers/media/video/cx88/cx88.h2
2 files changed, 4 insertions, 3 deletions
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index b1f734dccea..cef4f282e5a 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -824,7 +824,7 @@ static int video_open(struct file *file)
824 call_all(core, tuner, s_radio); 824 call_all(core, tuner, s_radio);
825 } 825 }
826 826
827 atomic_inc(&core->users); 827 core->users++;
828 mutex_unlock(&core->lock); 828 mutex_unlock(&core->lock);
829 829
830 return 0; 830 return 0;
@@ -922,7 +922,8 @@ static int video_release(struct file *file)
922 file->private_data = NULL; 922 file->private_data = NULL;
923 kfree(fh); 923 kfree(fh);
924 924
925 if(atomic_dec_and_test(&dev->core->users)) 925 dev->core->users--;
926 if (!dev->core->users)
926 call_all(dev->core, core, s_power, 0); 927 call_all(dev->core, core, s_power, 0);
927 mutex_unlock(&dev->core->lock); 928 mutex_unlock(&dev->core->lock);
928 929
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index 9e8176ecf64..a399a8b086b 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -389,7 +389,7 @@ struct cx88_core {
389 struct mutex lock; 389 struct mutex lock;
390 /* various v4l controls */ 390 /* various v4l controls */
391 u32 freq; 391 u32 freq;
392 atomic_t users; 392 int users;
393 int mpeg_users; 393 int mpeg_users;
394 394
395 /* cx88-video needs to access cx8802 for hybrid tuner pll access. */ 395 /* cx88-video needs to access cx8802 for hybrid tuner pll access. */