From: "Jan Beulich" Subject: Re: linux c/s 860 Date: Thu, 16 Apr 2009 07:38:16 +0100 Message-ID: <49E6EE78.76EA.0078.0@novell.com> References: <49E6128C.76EA.0078.0@novell.com> <20090416021306.GE2692%yamahata@valinux.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <20090416021306.GE2692%yamahata@valinux.co.jp> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Isaku Yamahata Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Yes, thanks, this way it at least makes sense. You know whether it does what it's supposed to do. Jan >>> Isaku Yamahata 16.04.09 04:13 >>> On Wed, Apr 15, 2009 at 03:59:56PM +0100, Jan Beulich wrote: > Other than its comment says, this c/s doesn't only subtract 1 from = r_align, but > also extends the surrounding condition to include !r_align. If r_align = is zero, > ALIGN(r_align, PAGE_SIZE) will be zero too, and hence in the end r_align > will become ~0. What's the purpose of all that? Or am I missing = something > here? Or is the added condition perhaps just inverted? Thank you for pointing out. The alignment logic should be same as in th following list loop. How about this patch? linux: clean up of linux c/s 860 The fixing logic was somewhat confused and doesn't produce right result. This patch cleans it up. Signed-off-by: Isaku Yamahata diff --git a/drivers/pci/setup-res.c b/drivers/pci/setup-res.c --- a/drivers/pci/setup-res.c +++ b/drivers/pci/setup-res.c @@ -245,11 +245,6 @@ pdev_sort_resources(struct pci_dev *dev, if (!(r->flags) || r->parent) continue; =09 - if (i < PCI_BRIDGE_RESOURCES && (r->flags & IORESOURCE_MEM)= && - !r_align && reassigndev) - /* -1 is compensation for +1 in the following = calc. */ - r_align =3D ALIGN(r_align, PAGE_SIZE) - 1; - if (!r_align) { printk(KERN_WARNING "PCI: Ignore bogus resource %d = " "[%llx:%llx] of %s\n", @@ -258,6 +253,11 @@ pdev_sort_resources(struct pci_dev *dev, continue; } r_align =3D (i < PCI_BRIDGE_RESOURCES) ? r_align + 1 : = r->start; + + if (i < PCI_BRIDGE_RESOURCES && (r->flags & IORESOURCE_MEM)= && + reassigndev) + r_align =3D ALIGN(r_align, PAGE_SIZE); + for (list =3D head; ; list =3D list->next) { resource_size_t align =3D 0; struct resource_list *ln =3D list->next; --=20 yamahata