diff options
author | Linas Vepstas <linas@austin.ibm.com> | 2007-04-13 18:34:07 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-05-02 22:02:38 -0400 |
commit | bf8cbae47559170d2f2947dd547492714f195dd3 (patch) | |
tree | 07ac3329fb0d2a46031e49d361b9050433865331 /drivers/pci | |
parent | f14e3136509e3825a83f6689cb709f41dfacea47 (diff) |
PCI: rpaphp: Cleanup flow of control for rpaphp_add_slot
Cleanup the flow of control for rpaphp_add_slot(), so as to
make it easier to read. The ext patch will fix a bug in this
same code.
Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
Cc: John Rose <johnrose@austin.ibm.com>
Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/hotplug/rpaphp_core.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c index 71a2cb8baa4a..f6c05f3621ca 100644 --- a/drivers/pci/hotplug/rpaphp_core.c +++ b/drivers/pci/hotplug/rpaphp_core.c | |||
@@ -299,32 +299,32 @@ int rpaphp_add_slot(struct device_node *dn) | |||
299 | const int *indexes, *names, *types, *power_domains; | 299 | const int *indexes, *names, *types, *power_domains; |
300 | char *name, *type; | 300 | char *name, *type; |
301 | 301 | ||
302 | if (!dn->name || strcmp(dn->name, "pci")) | ||
303 | return 0; | ||
304 | |||
305 | if (!is_php_dn(dn, &indexes, &names, &types, &power_domains)) | ||
306 | return 0; | ||
307 | |||
302 | dbg("Entry %s: dn->full_name=%s\n", __FUNCTION__, dn->full_name); | 308 | dbg("Entry %s: dn->full_name=%s\n", __FUNCTION__, dn->full_name); |
303 | 309 | ||
304 | /* register PCI devices */ | 310 | /* register PCI devices */ |
305 | if (dn->name != 0 && strcmp(dn->name, "pci") == 0) { | 311 | name = (char *) &names[1]; |
306 | if (!is_php_dn(dn, &indexes, &names, &types, &power_domains)) | 312 | type = (char *) &types[1]; |
307 | goto exit; | 313 | for (i = 0; i < indexes[0]; i++) { |
308 | 314 | ||
309 | name = (char *) &names[1]; | 315 | slot = alloc_slot_struct(dn, indexes[i + 1], name, power_domains[i + 1]); |
310 | type = (char *) &types[1]; | 316 | if (!slot) |
311 | for (i = 0; i < indexes[0]; i++, | 317 | return -ENOMEM; |
312 | name += (strlen(name) + 1), type += (strlen(type) + 1)) { | 318 | |
313 | 319 | slot->type = simple_strtoul(type, NULL, 10); | |
314 | if (!(slot = alloc_slot_struct(dn, indexes[i + 1], name, | ||
315 | power_domains[i + 1]))) { | ||
316 | retval = -ENOMEM; | ||
317 | goto exit; | ||
318 | } | ||
319 | slot->type = simple_strtoul(type, NULL, 10); | ||
320 | 320 | ||
321 | dbg("Found drc-index:0x%x drc-name:%s drc-type:%s\n", | 321 | dbg("Found drc-index:0x%x drc-name:%s drc-type:%s\n", |
322 | indexes[i + 1], name, type); | 322 | indexes[i + 1], name, type); |
323 | 323 | ||
324 | retval = rpaphp_register_pci_slot(slot); | 324 | retval = rpaphp_register_pci_slot(slot); |
325 | } | 325 | name += strlen(name) + 1; |
326 | type += strlen(type) + 1; | ||
326 | } | 327 | } |
327 | exit: | ||
328 | dbg("%s - Exit: num_slots=%d rc[%d]\n", | 328 | dbg("%s - Exit: num_slots=%d rc[%d]\n", |
329 | __FUNCTION__, num_slots, retval); | 329 | __FUNCTION__, num_slots, retval); |
330 | return retval; | 330 | return retval; |