From: "Donald D. Dugger" <donald.d.dugger@intel.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: eddie.dong@intel.com, will.auld@intel.com, allen.m.kay@intel.com,
xen-devel@lists.xen.org
Subject: Re: [PATCH V3] Decouple SnadyBridge quirk form VTd timeout
Date: Thu, 20 Nov 2014 22:03:42 -0700 [thread overview]
Message-ID: <20141121050342.GA22258@n0ano.com> (raw)
In-Reply-To: <546DDF34020000780004950D@smtp.nue.novell.com>
On Thu, Nov 20, 2014 at 12:31:48PM +0100, Jan Beulich wrote:
> >>> On 19.11.14 at 20:46, <donald.d.dugger@intel.com> wrote:
> > @@ -237,6 +248,42 @@
> > }
> > }
> >
> > +static void __init parse_snb_timeout(const char *s)
> > +{
> > + int not;
> > +
> > + switch (*s) {
> > +
> > + case '\0':
> > + snb_igd_timeout = SNB_IGD_TIMEOUT_LEGACY;
> > + break;
> > +
> > + case '0': case '1': case '2':
> > + case '3': case '4': case '5':
> > + case '6': case '7': case '8':
> > + case '9':
> > + snb_igd_timeout = MILLISECS(simple_strtoul(s, &s, 0));
> > + if ( snb_igd_timeout == MILLISECS(1) )
> > + snb_igd_timeout = SNB_IGD_TIMEOUT_LEGACY;
> > + break;
>
> Overly complicated. Just parse_bool() first, if that returns negative
> check for "default" or "", and (if not matched) invoke strtoul(). No
> need for this switch statement.
Personally, I prefer switch statements whenever possible, they're linear
(if statements are evil) and the compiler optimizes them well. Anyway,
NP, I'll follow your suggestion.
>
> > +
> > + default:
> > + if ( strncmp("default", s, 7) == 0 ) {
> > + snb_igd_timeout = SNB_IGD_TIMEOUT;
> > + break;
> > + }
> > + not = !strncmp("no-", s, 3);
>
> This makes no sense - you're looking for e.g. "snb_igd_quirk=no-no"
> here. If the use specified "no-snb_igd_quirk", you'll end up seeing
> "=no" when this function gets entered.
I was confused about the `no-' prefix, I thought it applied to the
value when it is really applied to the key (which makes a lot more
sense). Fixed in next version.
>
> Also the whole function is white space damaged (using hard tabs)
> and has misplaced opening braces.
Forgot Xen doesn't like tabs, my bad.
>
> Jan
>
>
And, as Ian pointed out, dyslexia in the subject line, also fixed in the
next version.
--
Don Dugger
"Censeo Toto nos in Kansa esse decisse." - D. Gale
n0ano@n0ano.com
Ph: 303/443-3786
prev parent reply other threads:[~2014-11-21 5:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-19 19:46 [PATCH V3] Decouple SnadyBridge quirk form VTd timeout Donald D. Dugger
2014-11-20 9:00 ` Ian Campbell
2014-11-20 11:31 ` Jan Beulich
2014-11-21 5:03 ` Donald D. Dugger [this message]
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=20141121050342.GA22258@n0ano.com \
--to=donald.d.dugger@intel.com \
--cc=JBeulich@suse.com \
--cc=allen.m.kay@intel.com \
--cc=eddie.dong@intel.com \
--cc=will.auld@intel.com \
--cc=xen-devel@lists.xen.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.