summaryrefslogtreecommitdiff
path: root/radeonreg.c
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2012-02-24 21:47:13 -0600
committerDave Airlie <airlied@redhat.com>2012-03-09 09:35:47 +0000
commit47e021d5ba4731a92b0eca9bce30427418d81a0a (patch)
treeba86943c788290e999e098ead259118787f24e0b /radeonreg.c
parent20840fc94fe709c047093c82eb78c4258d5fdcd1 (diff)
use continue statement to simplify "for each PCI device" loop
In the construct for each PCI device: if PCI ID is interesting: long block of code to handle the detected device the "if" with long body leaves the reader in suspense about what will happen when the PCI ID is not interesting. Rewriting as for each PCI device: if PCI ID is uninteresting: continue handle the detected device deals with the easy case right away and decreases nesting for the bulk of the "while" loop body as a nice side effect. No change in functionality intended. Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'radeonreg.c')
-rw-r--r--radeonreg.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/radeonreg.c b/radeonreg.c
index 4d016fd..d5b4aa2 100644
--- a/radeonreg.c
+++ b/radeonreg.c
@@ -391,20 +391,22 @@ static int map_radeon_mem(void)
while ((device = pci_device_next(iter))) {
pci_device_probe(device);
- if (device->vendor_id == 0x1002 &&
- (((device->device_class & 0x00ffff00) == 0x00030000) ||
- ((device->device_class & 0x00ffff00) == 0x00038000))) {
- for (i = 0; i < sizeof(RADEONCards) / sizeof(RADEONCardInfo); i++) {
- if (RADEONCards[i].pci_device_id == device->device_id)
- card_info = &RADEONCards[i];
- }
+ if (device->vendor_id != 0x1002)
+ continue;
+ if ((device->device_class & 0x00ffff00) != 0x00030000 &&
+ (device->device_class & 0x00ffff00) != 0x00038000)
+ continue;
+
+ for (i = 0; i < sizeof(RADEONCards) / sizeof(RADEONCardInfo); i++) {
+ if (RADEONCards[i].pci_device_id == device->device_id)
+ card_info = &RADEONCards[i];
+ }
- fb_region = 0;
- ctrl_region = 2;
- avivo_device = device;
- if(skip-- == 0) {
- break;
- }
+ fb_region = 0;
+ ctrl_region = 2;
+ avivo_device = device;
+ if(skip-- == 0) {
+ break;
}
}