]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
ps3fb: atomic fixes
authorGeert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Wed, 2 May 2007 12:48:32 +0000 (14:48 +0200)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Sat, 5 May 2007 00:59:08 +0000 (17:59 -0700)
ps3fb: Use atomic_dec_if_positive() instead of bogus atomic_read()/atomic_dec()
combinations

Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/video/ps3fb.c

index 815b3cc78fd3ea417da384ebaa2f53d83f1cb4e7..dd6dd6e222d7e7735671ae84d82ab05a071bb980 100644 (file)
@@ -680,13 +680,10 @@ EXPORT_SYMBOL_GPL(ps3fb_wait_for_vsync);
 
 void ps3fb_flip_ctl(int on)
 {
-       if (on) {
-               if (atomic_read(&ps3fb.ext_flip) > 0) {
-                       atomic_dec(&ps3fb.ext_flip);
-               }
-       } else {
+       if (on)
+               atomic_dec_if_positive(&ps3fb.ext_flip);
+       else
                atomic_inc(&ps3fb.ext_flip);
-       }
 }
 
 EXPORT_SYMBOL_GPL(ps3fb_flip_ctl);
@@ -786,8 +783,7 @@ static int ps3fb_ioctl(struct fb_info *info, unsigned int cmd,
 
        case PS3FB_IOCTL_OFF:
                DPRINTK("PS3FB_IOCTL_OFF:\n");
-               if (atomic_read(&ps3fb.ext_flip) > 0)
-                       atomic_dec(&ps3fb.ext_flip);
+               atomic_dec_if_positive(&ps3fb.ext_flip);
                retval = 0;
                break;