From: linas@austin.ibm.com (Linas Vepstas)
To: Kristen@austin.ibm.com, Carlson@austin.ibm.com,
"Accardi <kristen.c.accardi"@intel.com
Cc: Andrew Morton <akpm@osdl.org>,
linuxppc-dev@ozlabs.org, pcihpd-discuss@lists.sourceforge.net
Subject: [PATCH 1/19] PCI: rpaphp: Cleanup flow of control for rpaphp_add_slot
Date: Tue, 3 Apr 2007 12:05:51 -0500 (CDT) [thread overview]
Message-ID: <20070403170552.02BA43A65C@topology.austin.ibm.com> (raw)
In-Reply-To: 20070403164850.GP4922@austin.ibm.com>
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>
----
drivers/pci/hotplug/rpaphp_core.c | 40 +++++++++++++++++++-------------------
1 file changed, 20 insertions(+), 20 deletions(-)
Index: linux-2.6.21-rc4-git4/drivers/pci/hotplug/rpaphp_core.c
===================================================================
--- linux-2.6.21-rc4-git4.orig/drivers/pci/hotplug/rpaphp_core.c 2007-03-28 11:10:08.000000000 -0500
+++ linux-2.6.21-rc4-git4/drivers/pci/hotplug/rpaphp_core.c 2007-04-03 11:03:01.000000000 -0500
@@ -299,32 +299,32 @@ int rpaphp_add_slot(struct device_node *
const int *indexes, *names, *types, *power_domains;
char *name, *type;
+ if (!dn->name || strcmp(dn->name, "pci"))
+ return 0;
+
+ if (!is_php_dn(dn, &indexes, &names, &types, &power_domains))
+ return 0;
+
dbg("Entry %s: dn->full_name=%s\n", __FUNCTION__, dn->full_name);
/* register PCI devices */
- if (dn->name != 0 && strcmp(dn->name, "pci") == 0) {
- if (!is_php_dn(dn, &indexes, &names, &types, &power_domains))
- goto exit;
-
- name = (char *) &names[1];
- type = (char *) &types[1];
- for (i = 0; i < indexes[0]; i++,
- name += (strlen(name) + 1), type += (strlen(type) + 1)) {
-
- if (!(slot = alloc_slot_struct(dn, indexes[i + 1], name,
- power_domains[i + 1]))) {
- retval = -ENOMEM;
- goto exit;
- }
- slot->type = simple_strtoul(type, NULL, 10);
+ name = (char *) &names[1];
+ type = (char *) &types[1];
+ for (i = 0; i < indexes[0]; i++) {
+
+ slot = alloc_slot_struct(dn, indexes[i + 1], name, power_domains[i + 1]);
+ if (!slot)
+ return -ENOMEM;
+
+ slot->type = simple_strtoul(type, NULL, 10);
- dbg("Found drc-index:0x%x drc-name:%s drc-type:%s\n",
- indexes[i + 1], name, type);
+ dbg("Found drc-index:0x%x drc-name:%s drc-type:%s\n",
+ indexes[i + 1], name, type);
- retval = rpaphp_register_pci_slot(slot);
- }
+ retval = rpaphp_register_pci_slot(slot);
+ name += strlen(name) + 1;
+ type += strlen(type) + 1;
}
-exit:
dbg("%s - Exit: num_slots=%d rc[%d]\n",
__FUNCTION__, num_slots, retval);
return retval;
next reply other threads:[~2007-04-03 17:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-03 17:05 Linas Vepstas [this message]
-- strict thread matches above, loose matches on Subject: below --
2007-04-03 17:15 [PATCH 1/19] PCI: rpaphp: Cleanup flow of control for rpaphp_add_slot Linas Vepstas
2007-04-03 0:26 [PATCH 0/19]: RPAPHP pci hotplug cleanup patchbomb Linas Vepstas
2007-04-03 0:33 ` [PATCH 1/19] PCI: rpaphp: Cleanup flow of control for rpaphp_add_slot Linas Vepstas
2007-04-03 14:28 ` Nathan Lynch
2007-04-03 16:00 ` Linas Vepstas
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=20070403170552.02BA43A65C@topology.austin.ibm.com \
--to=linas@austin.ibm.com \
--cc="Accardi <kristen.c.accardi"@intel.com \
--cc=Carlson@austin.ibm.com \
--cc=Kristen@austin.ibm.com \
--cc=akpm@osdl.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=pcihpd-discuss@lists.sourceforge.net \
/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).