From: "Jan Beulich" <JBeulich@suse.com>
To: David Vrabel <david.vrabel@citrix.com>,
Boris Ostrovsky <boris.ostrovsky@oracle.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
Jan Beulich <JBeulich@suse.com>, Juergen Gross <JGross@suse.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] xen-pciback: clean up read_dev_bar()
Date: Mon, 06 Jun 2016 02:12:05 -0600 [thread overview]
Message-ID: <57554C7502000078000F1DF5__44752.4213268936$1465200858$gmane$org@prv-mh.provo.novell.com> (raw)
In-Reply-To: <57554B8D02000078000F1DE4@prv-mh.provo.novell.com>
- drop unused function parameter
- simplify determination of 64-bit memory resource
- use const and unsigned
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
drivers/xen/xen-pciback/conf_space_header.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
--- 4.7-rc2-xen-pciback-BAR.orig/drivers/xen/xen-pciback/conf_space_header.c
+++ 4.7-rc2-xen-pciback-BAR/drivers/xen/xen-pciback/conf_space_header.c
@@ -209,21 +209,18 @@ static int bar_read(struct pci_dev *dev,
return 0;
}
-static inline void read_dev_bar(struct pci_dev *dev,
- struct pci_bar_info *bar_info, int offset,
- u32 len_mask)
+static inline void read_dev_bar(const struct pci_dev *dev,
+ struct pci_bar_info *bar_info,
+ unsigned int offset)
{
- int pos;
- struct resource *res = dev->resource;
+ unsigned int pos;
+ const struct resource *res = dev->resource;
if (offset == PCI_ROM_ADDRESS || offset == PCI_ROM_ADDRESS1)
pos = PCI_ROM_RESOURCE;
else {
pos = (offset - PCI_BASE_ADDRESS_0) / 4;
- if (pos && ((res[pos - 1].flags & (PCI_BASE_ADDRESS_SPACE |
- PCI_BASE_ADDRESS_MEM_TYPE_MASK)) ==
- (PCI_BASE_ADDRESS_SPACE_MEMORY |
- PCI_BASE_ADDRESS_MEM_TYPE_64))) {
+ if (pos && (res[pos - 1].flags & IORESOURCE_MEM_64)) {
bar_info->val = res[pos - 1].start >> 32;
bar_info->len_val = -resource_size(&res[pos - 1]) >> 32;
return;
@@ -248,7 +245,7 @@ static void *bar_init(struct pci_dev *de
if (!bar)
return ERR_PTR(-ENOMEM);
- read_dev_bar(dev, bar, offset, ~0);
+ read_dev_bar(dev, bar, offset);
return bar;
}
@@ -260,7 +257,7 @@ static void *rom_init(struct pci_dev *de
if (!bar)
return ERR_PTR(-ENOMEM);
- read_dev_bar(dev, bar, offset, ~PCI_ROM_ADDRESS_ENABLE);
+ read_dev_bar(dev, bar, offset);
return bar;
}
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-06-06 8:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <57554B8D02000078000F1DE4@prv-mh.provo.novell.com>
2016-06-06 8:11 ` [PATCH 1/2] xen-pciback: return proper values during BAR sizing Jan Beulich
2016-06-06 8:12 ` Jan Beulich [this message]
2016-06-06 8:47 ` [PATCH 3/2] xen-pciback: drop rom_init() Jan Beulich
[not found] ` <57554C5D02000078000F1DF1@prv-mh.provo.novell.com>
2016-06-06 13:03 ` [PATCH 1/2] xen-pciback: return proper values during BAR sizing Boris Ostrovsky
2016-06-06 13:51 ` Jan Beulich
[not found] ` <57559C1D02000078000F20DF@prv-mh.provo.novell.com>
2016-06-06 14:28 ` Boris Ostrovsky
[not found] ` <57554C7502000078000F1DF5@prv-mh.provo.novell.com>
2016-06-06 13:04 ` [PATCH 2/2] xen-pciback: clean up read_dev_bar() Boris Ostrovsky
[not found] ` <575554CC02000078000F1E3F@prv-mh.provo.novell.com>
2016-06-06 13:09 ` [PATCH 3/2] xen-pciback: drop rom_init() Boris Ostrovsky
2016-06-06 13:54 ` Jan Beulich
[not found] ` <57559CBD02000078000F20EC@prv-mh.provo.novell.com>
2016-06-06 14:35 ` Boris Ostrovsky
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='57554C7502000078000F1DF5__44752.4213268936$1465200858$gmane$org@prv-mh.provo.novell.com' \
--to=jbeulich@suse.com \
--cc=JGross@suse.com \
--cc=boris.ostrovsky@oracle.com \
--cc=david.vrabel@citrix.com \
--cc=konrad.wilk@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=xen-devel@lists.xenproject.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 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).