Skip to contentSkip to conversation

Staging: speakup: speakup_keypc.c: usleep_range is preferred over udelay

PATCH Superseded Jaya Durga 3 participants 3 messages Jul 12, 2017 Staging

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Jaya Durga

author
#0 lore raw

PATCH 1/1 Staging: speakup: speakup_keypc.c: usleep_range is preferred over udelay

Fix checkpatch issue: CHECK: usleep_range is preferred over udelay;

---
 drivers/staging/speakup/speakup_keypc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/speakup/speakup_keypc.c +2 -2
index d3203f8..1ba4cfc 100644
@@ -28,7 +28,7 @@
 
 #define DRV_VERSION "2.10"
 #define SYNTH_IO_EXTENT	0x04
-#define SWAIT udelay(70)
+#define SWAIT usleep_range(70, 150)
 #define PROCSPEECH 0x1f
 #define SYNTH_CLEAR 0x03
 
@@ -164,7 +164,7 @@ static const char *synth_immediate(struct spk_synth *synth, const char *buf)
 			if (--timeout <= 0)
 				return oops();
 		outb_p(ch, synth_port);
-		udelay(70);
+		usleep_range(70, 150);
 		buf++;
 	}
 	return NULL;
Signature · 1 line
1.9.1
maintainer
#1 lore raw
Quoted 12 lines · Jaya Durga

Fix checkpatch issue: CHECK: usleep_range is preferred over udelay;

---
 drivers/staging/speakup/speakup_keypc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/speakup/speakup_keypc.c +0 -0
index d3203f8..1ba4cfc 100644

drivers/staging/speakup/speakup_keypc.c line 31

Quoted 5 lines
drivers/staging/speakup/speakup_keypc.c +1 -1
@@ -28,7 +28,7 @@
 
 #define DRV_VERSION "2.10"
 #define SYNTH_IO_EXTENT	0x04
-#define SWAIT udelay(70)
+#define SWAIT usleep_range(70, 150)

Ick, why not just get rid of SWAIT entirely please?

drivers/staging/speakup/speakup_keypc.c static const char *synth_immediate(struct spk_synth *synth, const char *buf) · line 167

Quoted 9 lines
drivers/staging/speakup/speakup_keypc.c +1 -1
 #define PROCSPEECH 0x1f
 #define SYNTH_CLEAR 0x03
 
@@ -164,7 +164,7 @@ static const char *synth_immediate(struct spk_synth *synth, const char *buf)
 			if (--timeout <= 0)
 				return oops();
 		outb_p(ch, synth_port);
-		udelay(70);
+		usleep_range(70, 150);

And you are sure it is ok to wait up to 150 long here?

thanks,

greg k-h

#2 lore raw
In reply to Jaya Durga
Quoted 1 line · Jaya Durga, on mer. 12 juil. 2017 16:53:53 +0530, wrote:

Fix checkpatch issue: CHECK: usleep_range is preferred over udelay;

IIRC synth_immediate is meant to be usable in atomic contexts too, so usleep can't be used.

Samuel