linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pcmcia: pcmcia_resource: Replace mdelay() with msleep()
@ 2018-07-30 13:42 Jia-Ju Bai
  2018-10-01  9:38 ` Dominik Brodowski
  0 siblings, 1 reply; 2+ messages in thread
From: Jia-Ju Bai @ 2018-07-30 13:42 UTC (permalink / raw)
  To: linux; +Cc: linux-kernel, Jia-Ju Bai

pcmcia_fixup_iowidth() and pcmcia_enable_device() are 
never called in atomic context.
They call mdelay() to busily wait, which is not necessary.
mdelay() can be replaced with msleep().

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
---
 drivers/pcmcia/pcmcia_resource.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c
index 34aad895a239..8129dd8094cd 100644
--- a/drivers/pcmcia/pcmcia_resource.c
+++ b/drivers/pcmcia/pcmcia_resource.c
@@ -284,7 +284,7 @@ int pcmcia_fixup_iowidth(struct pcmcia_device *p_dev)
 		io_on.stop = s->io[i].res->end;
 
 		s->ops->set_io_map(s, &io_off);
-		mdelay(40);
+		msleep(40);
 		s->ops->set_io_map(s, &io_on);
 	}
 unlock:
@@ -567,7 +567,7 @@ int pcmcia_enable_device(struct pcmcia_device *p_dev)
 			!(flags & CONF_ENABLE_PULSE_IRQ))
 			option |= COR_LEVEL_REQ;
 		pcmcia_write_cis_mem(s, 1, (base + CISREG_COR)>>1, 1, &option);
-		mdelay(40);
+		msleep(40);
 	}
 	if (p_dev->config_regs & PRESENT_STATUS)
 		pcmcia_write_cis_mem(s, 1, (base + CISREG_CCSR)>>1, 1, &status);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] pcmcia: pcmcia_resource: Replace mdelay() with msleep()
  2018-07-30 13:42 [PATCH] pcmcia: pcmcia_resource: Replace mdelay() with msleep() Jia-Ju Bai
@ 2018-10-01  9:38 ` Dominik Brodowski
  0 siblings, 0 replies; 2+ messages in thread
From: Dominik Brodowski @ 2018-10-01  9:38 UTC (permalink / raw)
  To: Jia-Ju Bai; +Cc: linux-kernel

On Mon, Jul 30, 2018 at 09:42:56PM +0800, Jia-Ju Bai wrote:
> pcmcia_fixup_iowidth() and pcmcia_enable_device() are 
> never called in atomic context.
> They call mdelay() to busily wait, which is not necessary.
> mdelay() can be replaced with msleep().
> 
> This is found by a static analysis tool named DCNS written by myself.
> 
> Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>

Applied to pcmcia-next, thanks.

	Dominik

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-01 11:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-30 13:42 [PATCH] pcmcia: pcmcia_resource: Replace mdelay() with msleep() Jia-Ju Bai
2018-10-01  9:38 ` Dominik Brodowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).