All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Lynch <ntl@pobox.com>
To: John Rose <johnrose@austin.ibm.com>
Cc: Paul Mackerras <paulus@samba.org>, linuxppc-dev@ozlabs.org
Subject: Re: [PATCH] reorg RTAS delay code
Date: Fri, 2 Jun 2006 16:33:08 -0500	[thread overview]
Message-ID: <20060602213308.GP8934@localdomain> (raw)
In-Reply-To: <1149280229.18052.3.camel@sinatra.austin.ibm.com>

> +/* For an RTAS busy status code, perform the hinted delay. */
> +unsigned int rtas_busy_delay(int status)
> +{
> +	unsigned int ms;
>  
> -	return ms; 
> +	ms = rtas_busy_delay_time(status);
> +	if (ms)
> +		msleep(ms);
> +
> +	return ms;
>  }

Can you put a might_sleep() at the beginning of this function so that
we can reliably catch unsafe uses of it?  Otherwise we'll get warnings
only when a delay is actually executed.


> @@ -438,22 +449,14 @@ int rtas_get_power_level(int powerdomain
>  int rtas_set_power_level(int powerdomain, int level, int *setlevel)
>  {
>  	int token = rtas_token("set-power-level");
> -	unsigned int wait_time;
>  	int rc;
>  
>  	if (token == RTAS_UNKNOWN_SERVICE)
>  		return -ENOENT;
>  
> -	while (1) {
> +	do
>  		rc = rtas_call(token, 2, 2, setlevel, powerdomain, level);
> -		if (rc == RTAS_BUSY)
> -			udelay(1);
> -		else if (rtas_is_extended_busy(rc)) {
> -			wait_time = rtas_extended_busy_delay_time(rc);
> -			udelay(wait_time * 1000);
> -		} else
> -			break;
> -	}
> +	while (rtas_busy_delay(rc));

Coding style nit -- am I alone in thinking that do/while without the
brackets looks weird?  Given the single-statement body of the loop, I
guess the brackets aren't necessary, but omitting the brackets doesn't
save lines in this case.

  reply	other threads:[~2006-06-02 21:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-31 19:32 [PATCH] use msleep() for RTAS delays John Rose
2006-06-01  5:31 ` Benjamin Herrenschmidt
2006-06-01  5:39   ` Paul Mackerras
2006-06-01 18:09     ` Arnd Bergmann
2006-06-01 15:55   ` John Rose
2006-06-01 22:25     ` John Rose
2006-06-02 20:30       ` [PATCH] reorg RTAS delay code John Rose
2006-06-02 21:33         ` Nathan Lynch [this message]
2006-06-05 21:31           ` John Rose
2006-06-05 21:54             ` Nathan Lynch
2006-06-10  2:04             ` Anton Blanchard
2006-06-10  2:08               ` Anton Blanchard
2006-06-12 16:18                 ` John Rose
     [not found]                   ` <17553.4390.79327.634945@cargo.ozlabs.ibm.com>
2006-06-15 22:32                     ` [PATCH] powerpc: RTAS delay, fix module build breaks John Rose
2006-07-13 18:20             ` [PATCH] reorg RTAS delay code Nathan Lynch
2006-07-25  4:39               ` Haren Myneni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060602213308.GP8934@localdomain \
    --to=ntl@pobox.com \
    --cc=johnrose@austin.ibm.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.