linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Gavin Shan <gwshan@linux.vnet.ibm.com>
To: Russell Currey <ruscur@russell.cc>
Cc: Gavin Shan <gwshan@linux.vnet.ibm.com>, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH V2 2/2] pseries/eeh: Handle RTAS delay requests in configure_bridge
Date: Wed, 30 Mar 2016 10:07:01 +1100	[thread overview]
Message-ID: <20160329230701.GA5670@gwshan> (raw)
In-Reply-To: <1459288877.4182.4.camel@russell.cc>

On Wed, Mar 30, 2016 at 08:01:17AM +1000, Russell Currey wrote:
>On Tue, 2016-03-29 at 20:49 +1100, Gavin Shan wrote:
>> On Tue, Mar 29, 2016 at 12:51:51PM +1000, Russell Currey wrote:
.../...

>> > 
>> > +		switch (ret) {
>> > +		case 0:
>> > +			return ret;
>> > +		case RTAS_EXTENDED_DELAY_MIN:
>> > +		case RTAS_EXTENDED_DELAY_MIN+1:
>> > +		case RTAS_EXTENDED_DELAY_MIN+2:
>> > +			mwait = rtas_busy_delay(ret);
>> > +			break;
>> > +		default:
>> > +			goto err;
>> > +		}
>> > +
>> > +		max_wait -= mwait;
>> If you like, the block can be simplified to as below. In that case,
>> tag #err isn't needed.
>> 
>>                 if (!ret)
>>                         return ret;
>> 
>>                 max_wait -= rtas_busy_delay(ret);
>> 
>That doesn't catch the case where the return value is greater than
>RTAS_EXTENDED_DELAY_MIN+2, in which case we would be sleeping for at least
>1 second.  However, I am going to change it so that any delay above 100ms
>is just treated as if it was 100ms, so I can simplify the code there and
>probably remove the switch and goto.
>

Yeah, we need update @max_wait and check it in advance. The point
is to remove the tag and simplify the switch block if you want, but
it's not a big deal:

		max_wait -= rtas_busy_delay_time(ret)
		if (ret <= 0 || max_wait < 0)
			return ret;

		rtas_busy_delay(ret);

Thanks,
Gavin

  reply	other threads:[~2016-03-29 23:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-29  2:51 [PATCH V2 1/2] pseries/eeh: Refactor the configure bridge RTAS tokens Russell Currey
2016-03-29  2:51 ` [PATCH V2 2/2] pseries/eeh: Handle RTAS delay requests in configure_bridge Russell Currey
2016-03-29  9:49   ` Gavin Shan
2016-03-29 22:01     ` Russell Currey
2016-03-29 23:07       ` Gavin Shan [this message]
2016-03-29 15:51   ` Tyrel Datwyler
2016-03-29 21:58     ` Russell Currey
2016-03-29  5:26 ` [PATCH V2 1/2] pseries/eeh: Refactor the configure bridge RTAS tokens Gavin Shan
2016-03-29  5:53   ` Russell Currey
2016-03-29  9:26     ` Gavin Shan

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=20160329230701.GA5670@gwshan \
    --to=gwshan@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=ruscur@russell.cc \
    /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 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).