Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1421241

Re: [PATCH 01/48] clk: at91: replace usleep() by udelay() calls

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject Re: [PATCH 01/48] clk: at91: replace usleep() by udelay() calls
Date 2016-06-13 21:30 +0200
Message-ID <rJFIB-2aM-5@gated-at.bofh.it> (permalink)
References <rICMO-2IE-7@gated-at.bofh.it> <rIDfQ-2Za-3@gated-at.bofh.it> <rJBYn-86X-35@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Monday, June 13, 2016 5:24:09 PM CEST Alexandre Belloni wrote:
> On 11/06/2016 at 00:30:36 +0200, Arnd Bergmann wrote :
> > On Saturday, June 11, 2016 12:03:04 AM CEST Alexandre Belloni wrote:
> > > From: Cyrille Pitchen <cyrille.pitchen@atmel.com>
> > > 
> > > Fix the main and slow clock .prepare() implementations which used to call
> > > usleep() when the scheduler wasn't ready yet.
> > > 
> > 
> > Does this have to be called that early? It seems wasteful to always
> > call udelay() here, when these are functions that are normally
> > allowed to sleep.
> > 
> 
> So I've tested it and something like that would work:
> 
>         if (system_state < SYSTEM_RUNNING)
>                 udelay(osc->startup_usec);
>         else
>                 usleep_range(osc->startup_usec, osc->startup_usec + 1);

I think that's reasonable in this case.

> But I'm afraid it would be the first driver to actually do something
> like that (however, it is already the only driver trying to sleep). 

We have a lot of drivers that call potentially sleeping function from
the .prepare callback, e.g. when they go to an i2c controller.

	Arnd

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH 01/48] clk: at91: replace usleep() by udelay() calls Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2016-06-13 17:30 +0200
  Re: [PATCH 01/48] clk: at91: replace usleep() by udelay() calls Arnd Bergmann <arnd@arndb.de> - 2016-06-13 21:30 +0200
  Re: [PATCH 01/48] clk: at91: replace usleep() by udelay() calls Afzal Mohammed <afzal.mohd.ma@gmail.com> - 2016-06-14 18:10 +0200
    Re: [PATCH 01/48] clk: at91: replace usleep() by udelay() calls Boris Brezillon <boris.brezillon@free-electrons.com> - 2016-06-14 18:20 +0200

csiph-web