[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Xen-devel] [PATCH v8 5/9] PCI: Add pci_iomap_wc() variants
- To: Borislav Petkov <bp@xxxxxxx>
- From: "Luis R. Rodriguez" <mcgrof@xxxxxxxxxxxxxxxx>
- Date: Thu, 25 Jun 2015 08:53:35 -0700
- Cc: linux-fbdev <linux-fbdev@xxxxxxxxxxxxxxx>, Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>, "Michael S. Tsirkin" <mst@xxxxxxxxxx>, "linux-pci@xxxxxxxxxxxxxxx" <linux-pci@xxxxxxxxxxxxxxx>, Ville SyrjÃlà <syrjala@xxxxxx>, Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, Ville SyrjÃlà <ville.syrjala@xxxxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Arnd Bergmann <arnd@xxxxxxxx>, Davidlohr Bueso <dbueso@xxxxxxx>, Tomi Valkeinen <tomi.valkeinen@xxxxxx>, Mel Gorman <mgorman@xxxxxxx>, Suresh Siddha <sbsiddha@xxxxxxxxx>, Dave Airlie <airlied@xxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxx>, Jean-Christophe Plagniol-Villard <plagnioj@xxxxxxxxxxxx>, Antonino Daplas <adaplas@xxxxxxxxx>, Stefan Bader <stefan.bader@xxxxxxxxxxxxx>, Daniel Vetter <daniel.vetter@xxxxxxxx>, Bjorn Helgaas <bhelgaas@xxxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, Vlastimil Babka <vbabka@xxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Toshi Kani <toshi.kani@xxxxxx>, "linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>, Andy Lutomirski <luto@xxxxxxxxxxxxxx>, David Vrabel <david.vrabel@xxxxxxxxxx>, venkatesh.pallipadi@xxxxxxxxx, Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, Roger Pau Monnà <roger.pau@xxxxxxxxxx>
- Delivery-date: Thu, 25 Jun 2015 15:54:02 +0000
- List-id: Xen developer discussion <xen-devel.lists.xen.org>
On Thu, Jun 25, 2015 at 8:09 AM, Borislav Petkov <bp@xxxxxxx> wrote:
>> +void __iomem *pci_iomap_wc_range(struct pci_dev *dev,
>> + int bar,
>> + unsigned long offset,
>> + unsigned long maxlen)
>> +{
>> + resource_size_t start = pci_resource_start(dev, bar);
>> + resource_size_t len = pci_resource_len(dev, bar);
>> + unsigned long flags = pci_resource_flags(dev, bar);
>> +
>> + if (len <= offset || !start)
>> + return NULL;
>> + len -= offset;
>> + start += offset;
>> + if (maxlen && len > maxlen)
>> + len = maxlen;
>> + if (flags & IORESOURCE_IO)
>> + return NULL;
>
> I've moved this check at the beginning of the function so that we bail
> out before doing the computations above it.
That indeed looks like a good optimization.
Luis
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|