From ddc9a1d90abedad10d3d1f1bd14b2a6d70f1c9e6 Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Fri, 17 Jul 2015 11:02:34 +0100 Subject: pcmcia: remove KERN_INFO level from debug message The KERN_INFO level is being appended to the "%s:" string in the DEBUGP macro, so it isn't actually doing what was originally intended and instead inserts it in the wrong place. Remove it so it is at least we're using the DEBUGP macro consistently throughout the driver and we're not going to lose any functionality in message level with change anyhow. Caught by smatch static analysis: drivers/char/pcmcia/cm4040_cs.c:509 cm4040_reader_release() warn: KERN_* level not at start of string Signed-off-by: Colin Ian King Cc: Harald Welte Cc: Arnd Bergmann Signed-off-by: Dominik Brodowski --- drivers/char/pcmcia/cm4040_cs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/char') diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index f80965407d3c..d5e43606339c 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c @@ -505,7 +505,7 @@ static void cm4040_reader_release(struct pcmcia_device *link) DEBUGP(3, dev, "-> cm4040_reader_release\n"); while (link->open) { - DEBUGP(3, dev, KERN_INFO MODULE_NAME ": delaying release " + DEBUGP(3, dev, MODULE_NAME ": delaying release " "until process has terminated\n"); wait_event(dev->devq, (link->open == 0)); } -- cgit v1.2.3-59-g8ed1b From be826ada52f1fcabed5b5217c94609ebf5967211 Mon Sep 17 00:00:00 2001 From: Jia-Ju Bai Date: Sun, 18 Mar 2018 22:49:57 +0800 Subject: char: pcmcia: cm4000_cs: Replace mdelay with usleep_range in set_protocol set_protocol() is never called in atomic context. The call chains ending up at set_protocol() are: [1] set_protocol() <- monitor_card() [2] set_protocol() <- cmm_ioctl() monitor_card() is only set in setup_timer(), and cmm_ioctl() is only set as ".unlocked_ioctl" in file_operations structure "cm4000_fops". Despite never getting called from atomic context, set_protocol() calls mdelay(10), i.e. busy wait for 10ms. That is not necessary and can be replaced with usleep_range to avoid busy waiting. This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai Acked-by: Harald Welte Signed-off-by: Dominik Brodowski --- drivers/char/pcmcia/cm4000_cs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/char') diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index a219964cb770..809507bf8f1c 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c @@ -530,7 +530,7 @@ static int set_protocol(struct cm4000_dev *dev, struct ptsreq *ptsreq) DEBUGP(5, dev, "NumRecBytes is valid\n"); break; } - mdelay(10); + usleep_range(10000, 11000); } if (i == 100) { DEBUGP(5, dev, "Timeout waiting for NumRecBytes getting " @@ -546,7 +546,7 @@ static int set_protocol(struct cm4000_dev *dev, struct ptsreq *ptsreq) DEBUGP(2, dev, "NumRecBytes = %i\n", num_bytes_read); break; } - mdelay(10); + usleep_range(10000, 11000); } /* check whether it is a short PTS reply? */ -- cgit v1.2.3-59-g8ed1b