FB: sa1100: make GPIO configuration setting safe
authorRussell King <rmk+kernel@arm.linux.org.uk>
Wed, 18 Jan 2012 12:52:59 +0000 (12:52 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 21 Feb 2012 11:56:21 +0000 (11:56 +0000)
The sa1100fb driver needs to set the GPIO direction and alternate
function register according to the panel that we're driving.  We've
done this in the driver by read-modify-writing the register, which
may cause problems with races.  Fix this with a minimal change.

Acked-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
drivers/video/sa1100fb.c

index d1d97cab24c8cea4add9cff8850816e447c1f2ef..b644f0f1268cea33ce95518491178c938b2493f3 100644 (file)
@@ -761,8 +761,19 @@ static void sa1100fb_setup_gpio(struct sa1100fb_info *fbi)
        }
 
        if (mask) {
+               unsigned long flags;
+
+               /*
+                * SA-1100 requires the GPIO direction register set
+                * appropriately for the alternate function.  Hence
+                * we set it here via bitmask rather than excessive
+                * fiddling via the GPIO subsystem - and even then
+                * we'll still have to deal with GAFR.
+                */
+               local_irq_save(flags);
                GPDR |= mask;
                GAFR |= mask;
+               local_irq_restore(flags);
        }
 }