From de7ef8bcdfbdc861a136a06ee21efb220025581f Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Mon, 10 Nov 2008 18:22:04 +0100 Subject: [PATCH] Coding style cleanup: `for(...)' wants a space. --- example.c | 2 +- lib/generic.c | 6 +++--- lib/i386-ports.c | 2 +- lib/init.c | 6 +++--- lspci.c | 50 ++++++++++++++++++++++++------------------------ setpci.c | 14 +++++++------- 6 files changed, 40 insertions(+), 40 deletions(-) diff --git a/example.c b/example.c index 9b24951..7780e55 100644 --- a/example.c +++ b/example.c @@ -20,7 +20,7 @@ int main(void) /* Set all options you want -- here we stick with the defaults */ pci_init(pacc); /* Initialize the PCI library */ pci_scan_bus(pacc); /* We want to get the list of devices */ - for(dev=pacc->devices; dev; dev=dev->next) /* Iterate over all devices */ + for (dev=pacc->devices; dev; dev=dev->next) /* Iterate over all devices */ { pci_fill_info(dev, PCI_FILL_IDENT | PCI_FILL_BASES | PCI_FILL_CLASS); /* Fill in header info we need */ c = pci_read_byte(dev, PCI_INTERRUPT_PIN); /* Read config register directly */ diff --git a/lib/generic.c b/lib/generic.c index 617c5fe..cc902dc 100644 --- a/lib/generic.c +++ b/lib/generic.c @@ -25,11 +25,11 @@ pci_generic_scan_bus(struct pci_access *a, byte *busmap, int bus) busmap[bus] = 1; t = pci_alloc_dev(a); t->bus = bus; - for(dev=0; dev<32; dev++) + for (dev=0; dev<32; dev++) { t->dev = dev; multi = 0; - for(t->func=0; !t->func || multi && t->func<8; t->func++) + for (t->func=0; !t->func || multi && t->func<8; t->func++) { u32 vd = pci_read_long(t, PCI_VENDOR_ID); struct pci_dev *d; @@ -108,7 +108,7 @@ pci_generic_fill_info(struct pci_dev *d, int flags) } if (cnt) { - for(i=0; idebug("...sanity check"); d.bus = 0; d.func = 0; - for(d.dev = 0; d.dev < 32; d.dev++) + for (d.dev = 0; d.dev < 32; d.dev++) { u16 class, vendor; if (m->read(&d, PCI_CLASS_DEVICE, (byte *) &class, sizeof(class)) && diff --git a/lib/init.c b/lib/init.c index be45f81..103dc3a 100644 --- a/lib/init.c +++ b/lib/init.c @@ -158,7 +158,7 @@ pci_alloc(void) pci_define_param(a, "net.cache_name", "~/.pciids-cache", "Name of the ID cache file"); a->id_lookup_mode = PCI_LOOKUP_CACHE; #endif - for(i=0; iconfig) pci_methods[i]->config(a); return a; @@ -185,7 +185,7 @@ pci_init(struct pci_access *a) else { unsigned int i; - for(i=0; idebug("Trying method %d...", i); @@ -210,7 +210,7 @@ pci_cleanup(struct pci_access *a) { struct pci_dev *d, *e; - for(d=a->devices; d; d=e) + for (d=a->devices; d; d=e) { e = d->next; pci_free_dev(d); diff --git a/lspci.c b/lspci.c index 6413451..e86fe77 100644 --- a/lspci.c +++ b/lspci.c @@ -177,7 +177,7 @@ scan_devices(void) struct pci_dev *p; pci_scan_bus(pacc); - for(p=pacc->devices; p; p=p->next) + for (p=pacc->devices; p; p=p->next) if (d = scan_device(p)) { d->next = first_dev; @@ -256,10 +256,10 @@ sort_them(void) struct device *d; cnt = 0; - for(d=first_dev; d; d=d->next) + for (d=first_dev; d; d=d->next) cnt++; h = index = alloca(sizeof(struct device *) * cnt); - for(d=first_dev; d; d=d->next) + for (d=first_dev; d; d=d->next) *h++ = d; qsort(index, cnt, sizeof(struct device *), compare_them); last_dev = &first_dev; @@ -398,7 +398,7 @@ format_agp_rate(int rate, char *buf, int agp3) char *c = buf; int i; - for(i=0; i<=2; i++) + for (i=0; i<=2; i++) if (rate & (1 << i)) { if (c != buf) @@ -2036,7 +2036,7 @@ show_bases(struct device *d, int cnt) word cmd = get_conf_word(d, PCI_COMMAND); int i; - for(i=0; ibase_addr[i]; pciaddr_t len = (p->known_fields & PCI_FILL_SIZES) ? p->size[i] : 0; @@ -2278,7 +2278,7 @@ show_htype2(struct device *d) get_conf_byte(d, PCI_CB_CARD_BUS), get_conf_byte(d, PCI_CB_SUBORDINATE_BUS), get_conf_byte(d, PCI_CB_LATENCY_TIMER)); - for(i=0; i<2; i++) + for (i=0; i<2; i++) { int p = 8*i; u32 base = get_conf_long(d, PCI_CB_MEMORY_BASE_0 + p); @@ -2288,7 +2288,7 @@ show_htype2(struct device *d) (cmd & PCI_COMMAND_MEMORY) ? "" : " [disabled]", (brc & (PCI_CB_BRIDGE_CTL_PREFETCH_MEM0 << i)) ? " (prefetchable)" : ""); } - for(i=0; i<2; i++) + for (i=0; i<2; i++) { int p = 8*i; u32 base = get_conf_long(d, PCI_CB_IO_BASE_0 + p); @@ -2483,7 +2483,7 @@ show_hex_dump(struct device *d) cnt = 4096; } - for(i=0; inext) + for (d=first_dev; d; d=d->next) show_device(d); } @@ -2618,7 +2618,7 @@ find_bus(struct bridge *b, unsigned int domain, unsigned int n) { struct bus *bus; - for(bus=b->first_bus; bus; bus=bus->sibling) + for (bus=b->first_bus; bus; bus=bus->sibling) if (bus->domain == domain && bus->number == n) break; return bus; @@ -2646,7 +2646,7 @@ insert_dev(struct device *d, struct bridge *b) if (! (bus = find_bus(b, p->domain, p->bus))) { struct bridge *c; - for(c=b->child; c; c=c->next) + for (c=b->child; c; c=c->next) if (c->domain == p->domain && c->secondary <= p->bus && p->bus <= c->subordinate) { insert_dev(d, c); @@ -2672,7 +2672,7 @@ grow_tree(void) /* Build list of bridges */ last_br = &host_bridge.chain; - for(d=first_dev; d; d=d->next) + for (d=first_dev; d; d=d->next) { word class = d->dev->device_class; byte ht = get_conf_byte(d, PCI_HEADER_TYPE) & 0x7f; @@ -2704,11 +2704,11 @@ grow_tree(void) /* Create a bridge tree */ - for(b=&host_bridge; b; b=b->chain) + for (b=&host_bridge; b; b=b->chain) { struct bridge *c, *best; best = NULL; - for(c=&host_bridge; c; c=c->chain) + for (c=&host_bridge; c; c=c->chain) if (c != b && (c == &host_bridge || b->domain == c->domain) && b->primary >= c->secondary && b->primary <= c->subordinate && (!best || best->subordinate - best->primary > c->subordinate - c->primary)) @@ -2722,13 +2722,13 @@ grow_tree(void) /* Insert secondary bus for each bridge */ - for(b=&host_bridge; b; b=b->chain) + for (b=&host_bridge; b; b=b->chain) if (!find_bus(b, b->domain, b->secondary)) new_bus(b, b->domain, b->secondary); /* Create bus structs and link devices */ - for(d=first_dev; d;) + for (d=first_dev; d;) { d2 = d->next; insert_dev(d, &host_bridge); @@ -2742,7 +2742,7 @@ print_it(char *line, char *p) *p++ = '\n'; *p = 0; fputs(line, stdout); - for(p=line; *p; p++) + for (p=line; *p; p++) if (*p == '+' || *p == '|') *p = '|'; else @@ -2759,7 +2759,7 @@ show_tree_dev(struct device *d, char *line, char *p) char namebuf[256]; p += sprintf(p, "%02x.%x", q->dev, q->func); - for(b=&host_bridge; b; b=b->chain) + for (b=&host_bridge; b; b=b->chain) if (b->br_dev == d) { if (b->secondary == b->subordinate) @@ -2888,11 +2888,11 @@ do_map_bus(int bus) if (verbose) printf("Mapping bus %02x\n", bus); - for(dev = 0; dev < 32; dev++) + for (dev = 0; dev < 32; dev++) if (filter.slot < 0 || filter.slot == dev) { int func_limit = 1; - for(func = 0; func < func_limit; func++) + for (func = 0; func < func_limit; func++) if (filter.func < 0 || filter.func == func) { /* XXX: Bus mapping supports only domain 0 */ @@ -2934,7 +2934,7 @@ do_map_bridges(int bus, int min, int max) struct bus_bridge *b; bi->guestbook = 1; - for(b=bi->bridges; b; b=b->next) + for (b=bi->bridges; b; b=b->next) { if (bus_info[b->first].guestbook) b->bug = 1; @@ -2954,10 +2954,10 @@ map_bridges(void) int i; printf("\nSummary of buses:\n\n"); - for(i=0; i<256; i++) + for (i=0; i<256; i++) if (bus_info[i].exists && !bus_info[i].guestbook) do_map_bridges(i, 0, 255); - for(i=0; i<256; i++) + for (i=0; i<256; i++) { struct bus_info *bi = bus_info + i; struct bus_bridge *b = bi->via; @@ -2972,7 +2972,7 @@ map_bridges(void) else printf("Secondary host bus (?)\n"); } - for(b=bi->bridges; b; b=b->next) + for (b=bi->bridges; b; b=b->next) { printf("\t%02x.%d Bridge to %02x-%02x", b->dev, b->func, b->first, b->last); switch (b->bug) @@ -3002,7 +3002,7 @@ map_the_bus(void) else { int bus; - for(bus=0; bus<256; bus++) + for (bus=0; bus<256; bus++) do_map_bus(bus); } map_bridges(); diff --git a/setpci.c b/setpci.c index 108264f..cd1f7fc 100644 --- a/setpci.c +++ b/setpci.c @@ -46,11 +46,11 @@ select_devices(struct pci_filter *filt) struct pci_dev *z, **a, **b; int cnt = 1; - for(z=pacc->devices; z; z=z->next) + for (z=pacc->devices; z; z=z->next) if (pci_filter_match(filt, z)) cnt++; a = b = xmalloc(sizeof(struct device *) * cnt); - for(z=pacc->devices; z; z=z->next) + for (z=pacc->devices; z; z=z->next) if (pci_filter_match(filt, z)) *a++ = z; *a = NULL; @@ -71,7 +71,7 @@ exec_op(struct op *op, struct pci_dev *dev) addr = op->addr; if (op->num_values >= 0) { - for(i=0; inum_values; i++) + for (i=0; inum_values; i++) { if ((op->values[i].mask & max_values[width]) == max_values[width]) { @@ -155,7 +155,7 @@ execute(struct op *op) { pdev = vec = op->dev_vector; while (dev = *pdev++) - for(oops=op; oops && oops->dev_vector == vec; oops=oops->next) + for (oops=op; oops && oops->dev_vector == vec; oops=oops->next) exec_op(oops, dev); while (op && op->dev_vector == vec) op = op->next; @@ -414,7 +414,7 @@ static void parse_ops(int argc, char **argv, int i) *d++ = 0; if (!*d) usage("Missing value"); - for(e=d, n=1; *e; e++) + for (e=d, n=1; *e; e++) if (*e == ',') n++; op = xmalloc(sizeof(struct op) + n*sizeof(struct value)); @@ -450,7 +450,7 @@ static void parse_ops(int argc, char **argv, int i) if (f && *f) { const struct reg_name *r; - for(r = pci_reg_names; r->name; r++) + for (r = pci_reg_names; r->name; r++) if (!strcasecmp(r->name, c)) break; if (!r->name) @@ -466,7 +466,7 @@ static void parse_ops(int argc, char **argv, int i) die("Unaligned register address!"); op->addr = ll; /* read in all the values to be set */ - for(j=0; j