[media] cx88: don't use atomic_t for core->users
authorJonathan Nieder <jrnieder@gmail.com>
Sun, 1 May 2011 09:31:40 +0000 (06:31 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 20 May 2011 12:29:43 +0000 (09:29 -0300)
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>
drivers/media/video/cx88/cx88-video.c
drivers/media/video/cx88/cx88.h

index b1f734dccea0edb2291f2e6303756461fd654906..cef4f282e5aae97c28eaa5515ad03db206cb8664 100644 (file)
@@ -824,7 +824,7 @@ static int video_open(struct file *file)
                call_all(core, tuner, s_radio);
        }
 
-       atomic_inc(&core->users);
+       core->users++;
        mutex_unlock(&core->lock);
 
        return 0;
@@ -922,7 +922,8 @@ static int video_release(struct file *file)
        file->private_data = NULL;
        kfree(fh);
 
-       if(atomic_dec_and_test(&dev->core->users))
+       dev->core->users--;
+       if (!dev->core->users)
                call_all(dev->core, core, s_power, 0);
        mutex_unlock(&dev->core->lock);
 
index 9e8176ecf64867e46fe92d5aed56ee3859ef2dd3..a399a8b086babf4e9facf27a690cdb577a5b6427 100644 (file)
@@ -389,7 +389,7 @@ struct cx88_core {
        struct mutex               lock;
        /* various v4l controls */
        u32                        freq;
-       atomic_t                   users;
+       int                        users;
        int                        mpeg_users;
 
        /* cx88-video needs to access cx8802 for hybrid tuner pll access. */