macintosh/via-macii: Access autopoll_devs when inside lock
authorFinn Thain <fthain@telegraphics.com.au>
Sun, 28 Jun 2020 04:23:12 +0000 (14:23 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Sun, 26 Jul 2020 13:34:24 +0000 (23:34 +1000)
The interrupt handler should be excluded when accessing the autopoll_devs
variable.

Fixes: d95fd5fce88f0 ("m68k: Mac II ADB fixes") # v5.0+
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Tested-by: Stan Johnson <userm57@yahoo.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/5952dd8a9bc9de90f1acc4790c51dd42b4c98065.1593318192.git.fthain@telegraphics.com.au
drivers/macintosh/via-macii.c

index ac824d7..6aa9035 100644 (file)
@@ -270,15 +270,12 @@ static int macii_autopoll(int devs)
        unsigned long flags;
        int err = 0;
 
+       local_irq_save(flags);
+
        /* bit 1 == device 1, and so on. */
        autopoll_devs = devs & 0xFFFE;
 
-       if (!autopoll_devs)
-               return 0;
-
-       local_irq_save(flags);
-
-       if (current_req == NULL) {
+       if (autopoll_devs && !current_req) {
                /* Send a Talk Reg 0. The controller will repeatedly transmit
                 * this as long as it is idle.
                 */