All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Hao, Xudong" <xudong.hao@intel.com>
To: Matthew Wilcox <matthew@wil.cx>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	Don Dutile <ddutile@redhat.com>
Subject: RE: [PATCH v5] Quirk for IVB graphics FLR errata
Date: Mon, 16 Apr 2012 00:53:41 +0000	[thread overview]
Message-ID: <403610A45A2B5242BD291EDAE8B37D300FD117D2@SHSMSX102.ccr.corp.intel.com> (raw)
In-Reply-To: <20120414204052.GB28678@parisc-linux.org>

> -----Original Message-----
> From: Matthew Wilcox [mailto:matthew@wil.cx]
> Sent: Sunday, April 15, 2012 4:41 AM
> To: Hao, Xudong
> Cc: Bjorn Helgaas; linux-pci@vger.kernel.org; Don Dutile
> Subject: Re: [PATCH v5] Quirk for IVB graphics FLR errata
> 
> On Fri, Apr 13, 2012 at 08:22:18AM +0000, Hao, Xudong wrote:
> > Changes from v4: (based on Matthew and Don's comments)
> > - using jiffies to set timeout instead of tsc.
> > - correct type mmio_base variable
> > - using readl() and writel() to access io.
> > - correct code style, use spaces around the multiply operator.
> 
> Much better!  Just a couple of minor nits ...
> 
> > +	val = readl(mmio_base + PCH_PP_CONTROL) & 0xfffffffe;
> > +	writel(val, mmio_base + PCH_PP_CONTROL);
> > +	do {
> > +		timeout = jiffies + msecs_to_jiffies(IGD_OPERATION_TIMEOUT);
> > +		while (1) {
> 
> Personally, I'd write this as:
> 
> 	while (time_before(jiffies, timeout)) {
> 		...
> 	}
> 
> > +			val = readl(mmio_base + PCH_PP_STATUS);
> > +			if (((val & 0x80000000) == 0)
> > +				&& ((val & 0x30000000) == 0))
> 
> Is there a reason why this shouldn't be:
> 
> 		if ((val & 0xB0000000) == 0)
> 
> > +				break;
> > +			if (time_after(jiffies, timeout))
> > +				break;
> > +			cpu_relax();
> > +		}
> > +	} while (0);
> 
> Why do we need this to be in a do { } while (0) loop?
> 
> Putting those three suggestions together, I think it should look like this:
> 
> 	writel(val, mmio_base + PCH_PP_CONTROL);
> 	timeout = jiffies + msecs_to_jiffies(IGD_OPERATION_TIMEOUT);
> 	while (time_before(jiffies, timeout)) {
> 		val = readl(mmio_base + PCH_PP_STATUS);
> 		if ((val & 0xB0000000) == 0)
> 			break;
> 		cpu_relax();
> 	}
> 	writel(0x00000002, mmio_base + 0xd0100);
> 

The code looks simple and reasonable, I'll modify with changes and add your name in Signed-off-by.

> With that change, please add:
> 
> Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
> 
> --
> Matthew Wilcox				Intel Open Source Technology Centre
> "Bill, look, we understand that you're interested in selling us this operating
> system, but compare it to ours.  We can't possibly take such a retrograde
> step."

      reply	other threads:[~2012-04-16  0:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-13  8:22 [PATCH v5] Quirk for IVB graphics FLR errata Hao, Xudong
2012-04-14 20:40 ` Matthew Wilcox
2012-04-16  0:53   ` Hao, Xudong [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=403610A45A2B5242BD291EDAE8B37D300FD117D2@SHSMSX102.ccr.corp.intel.com \
    --to=xudong.hao@intel.com \
    --cc=bhelgaas@google.com \
    --cc=ddutile@redhat.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=matthew@wil.cx \
    /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.