media: gpio-ir-tx: simplify wait logic
authorSean Young <sean@mess.org>
Thu, 7 Apr 2022 08:43:38 +0000 (10:43 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Sun, 8 May 2022 05:07:16 +0000 (07:07 +0200)
Do not handroll mdelay().

Suggested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/rc/gpio-ir-tx.c

index a50701c..d3063dd 100644 (file)
@@ -62,8 +62,13 @@ static void delay_until(ktime_t until)
                        return;
 
                /* udelay more than 1ms may not work */
-               delta = min(delta, 1000);
+               if (delta >= 1000) {
+                       mdelay(delta / 1000);
+                       continue;
+               }
+
                udelay(delta);
+               break;
        }
 }