lkml.org 
[lkml]   [2009]   [Jul]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] mg_disk: remove prohibited sleep operation
On Thu, 23 Jul 2009 13:57:45 +0900
unsik Kim <donari75@gmail.com> wrote:

> mflash's polling driver operate in standard request_fn_proc's context,
> sleep in this isn't permitted.
> Signed-off-by: unsik Kim <donari75@gmail.com>
> ---
> drivers/block/mg_disk.c | 2 --
> 1 files changed, 0 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c
> index 64f90f5..26371d5 100644
> --- a/drivers/block/mg_disk.c
> +++ b/drivers/block/mg_disk.c
> @@ -244,8 +244,6 @@ static unsigned int mg_wait(struct mg_host *host, u32 expect, u32 msec)
> mg_dump_status("not ready", status, host);
> return MG_ERR_INV_STAT;
> }
> - if (prv_data->use_polling)
> - msleep(1);
>
> status = inb((unsigned long)host->dev_base + MG_REG_STATUS);
> } while (time_before(cur_jiffies, expire));

This change has the potential to cause the driver to use much much more
CPU time and power. Are you really sure that the driver is optimal in
this area?

On possibility is to pass a flag into mg_wait() telling it whether it
is permitted to sleep:

if (may_sleep && prv_data->use_polling)
msleep(1);
else
mdelay(1);

or

if (may_sleep && prv_data->use_polling)
msleep(1);
else
/* nothing */;


so that then we only consume extra power if the caller is the
request_fn handler.



\
 
 \ /
  Last update: 2009-07-27 23:37    [W:0.033 / U:1.488 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site