[PATCH 1/4] pci: rename variable mask -> barval
Uwe Kleine-König
u.kleine-koenig at pengutronix.de
Fri Apr 13 16:30:50 PDT 2018
The variable isn't really a mask. And it is irritating that this "mask"
value is passed as parameter "maxbase" to the function pci_size() which
also has a parameter "mask". So rename it to a more generic term.
The main reason for this patch is that the next patch introduces another
variable with name "mask" and so this original is in the way.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
---
drivers/pci/pci.c | 29 +++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index b2570eb15181..538903ee6607 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -170,25 +170,26 @@ static void setup_device(struct pci_dev *dev, int max_bar)
for (bar = 0; bar < max_bar; bar++) {
resource_size_t last_addr;
- u32 orig, mask, size;
+ u32 orig, barval, size;
pci_read_config_dword(dev, PCI_BASE_ADDRESS_0 + bar * 4, &orig);
pci_write_config_dword(dev, PCI_BASE_ADDRESS_0 + bar * 4, 0xfffffffe);
- pci_read_config_dword(dev, PCI_BASE_ADDRESS_0 + bar * 4, &mask);
+ pci_read_config_dword(dev, PCI_BASE_ADDRESS_0 + bar * 4, &barval);
pci_write_config_dword(dev, PCI_BASE_ADDRESS_0 + bar * 4, orig);
- if (mask == 0 || mask == 0xffffffff) {
+ if (barval == 0 || barval == 0xffffffff) {
pr_debug("pbar%d set bad mask\n", bar);
continue;
}
- if (mask & 0x01) { /* IO */
- size = pci_size(orig, mask, 0xfffffffe);
+ if (barval & 0x01) { /* IO */
+ size = pci_size(orig, barval, 0xfffffffe);
if (!size) {
pr_debug("pbar%d bad IO mask\n", bar);
continue;
}
- pr_debug("pbar%d: mask=%08x io %d bytes\n", bar, mask, size);
+ pr_debug("pbar%d: barval=%08x io %d bytes\n",
+ bar, barval, size);
if (ALIGN(last_io, size) + size >
dev->bus->resource[PCI_BUS_RESOURCE_IO]->end) {
pr_debug("BAR does not fit within bus IO res\n");
@@ -200,15 +201,15 @@ static void setup_device(struct pci_dev *dev, int max_bar)
dev->resource[bar].flags = IORESOURCE_IO;
last_addr = last_io;
last_io += size;
- } else if ((mask & PCI_BASE_ADDRESS_MEM_PREFETCH) &&
+ } else if ((barval & PCI_BASE_ADDRESS_MEM_PREFETCH) &&
last_mem_pref) /* prefetchable MEM */ {
- size = pci_size(orig, mask, 0xfffffff0);
+ size = pci_size(orig, barval, 0xfffffff0);
if (!size) {
pr_debug("pbar%d bad P-MEM mask\n", bar);
continue;
}
- pr_debug("pbar%d: mask=%08x P memory %d bytes\n",
- bar, mask, size);
+ pr_debug("pbar%d: barval=%08x P memory %d bytes\n",
+ bar, barval, size);
if (ALIGN(last_mem_pref, size) + size >
dev->bus->resource[PCI_BUS_RESOURCE_MEM_PREF]->end) {
pr_debug("BAR does not fit within bus p-mem res\n");
@@ -222,13 +223,13 @@ static void setup_device(struct pci_dev *dev, int max_bar)
last_addr = last_mem_pref;
last_mem_pref += size;
} else { /* non-prefetch MEM */
- size = pci_size(orig, mask, 0xfffffff0);
+ size = pci_size(orig, barval, 0xfffffff0);
if (!size) {
pr_debug("pbar%d bad NP-MEM mask\n", bar);
continue;
}
- pr_debug("pbar%d: mask=%08x NP memory %d bytes\n",
- bar, mask, size);
+ pr_debug("pbar%d: barval=%08x NP memory %d bytes\n",
+ bar, barval, size);
if (ALIGN(last_mem, size) + size >
dev->bus->resource[PCI_BUS_RESOURCE_MEM]->end) {
pr_debug("BAR does not fit within bus np-mem res\n");
@@ -245,7 +246,7 @@ static void setup_device(struct pci_dev *dev, int max_bar)
dev->resource[bar].start = last_addr;
dev->resource[bar].end = last_addr + size - 1;
- if ((mask & PCI_BASE_ADDRESS_MEM_TYPE_64)) {
+ if ((barval & PCI_BASE_ADDRESS_MEM_TYPE_64)) {
dev->resource[bar].flags |= IORESOURCE_MEM_64;
pci_write_config_dword(dev,
PCI_BASE_ADDRESS_1 + bar * 4, 0);
--
2.16.3
More information about the barebox
mailing list