public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org
Cc: linas@austin.ibm.com
Subject: [PATCH] powerpc/PCI hotplug: shuffle error checking to better location.
Date: Fri, 20 Jan 2006 11:04:40 -0800	[thread overview]
Message-ID: <11377838802978@kroah.com> (raw)
In-Reply-To: <11377838804050@kroah.com>

[PATCH] powerpc/PCI hotplug: shuffle error checking to better location.

Error checking is scattered through various layers of the dlpar code,
leading to a somewhat opaque code structure. This patch consolidates
error checking in one routine, simplifying the code a tad. There's
also some whitespace cleanup here too.

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
Acked-by: John Rose <johnrose@austin.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
commit 2f8d04252f3ae653d142229c2f28ff88afb46ed8
tree da6abf3cc396887e3ccd3f13d2c938388ff66e52
parent 3138b8204e439aaa9ee4a6693ed1305ac36e356e
author linas@austin.ibm.com <linas@austin.ibm.com> Thu, 12 Jan 2006 18:35:23 -0600
committer Greg Kroah-Hartman <gregkh@suse.de> Fri, 20 Jan 2006 10:29:36 -0800

 drivers/pci/hotplug/rpadlpar_core.c |   44 ++++++++++++++++++-----------------
 1 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c
index d3aa9df..3eefe2c 100644
--- a/drivers/pci/hotplug/rpadlpar_core.c
+++ b/drivers/pci/hotplug/rpadlpar_core.c
@@ -103,13 +103,13 @@ static struct slot *find_slot(struct dev
 	struct list_head *tmp, *n;
 	struct slot *slot;
 
-        list_for_each_safe(tmp, n, &rpaphp_slot_head) {
-                slot = list_entry(tmp, struct slot, rpaphp_slot_list);
-                if (slot->dn == dn)
-                        return slot;
-        }
+	list_for_each_safe(tmp, n, &rpaphp_slot_head) {
+		slot = list_entry(tmp, struct slot, rpaphp_slot_list);
+		if (slot->dn == dn)
+			return slot;
+	}
 
-        return NULL;
+	return NULL;
 }
 
 static struct pci_dev *dlpar_find_new_dev(struct pci_bus *parent,
@@ -126,9 +126,9 @@ static struct pci_dev *dlpar_find_new_de
 	return NULL;
 }
 
-static struct pci_dev *dlpar_pci_add_bus(struct device_node *dn)
+static void dlpar_pci_add_bus(struct device_node *dn)
 {
-	struct pci_dn *pdn = dn->data;
+	struct pci_dn *pdn = PCI_DN(dn);
 	struct pci_controller *phb = pdn->phb;
 	struct pci_dev *dev = NULL;
 
@@ -139,7 +139,7 @@ static struct pci_dev *dlpar_pci_add_bus
 	if (!dev) {
 		printk(KERN_ERR "%s: failed to create pci dev for %s\n",
 				__FUNCTION__, dn->full_name);
-		return NULL;
+		return;
 	}
 
 	if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
@@ -156,35 +156,35 @@ static struct pci_dev *dlpar_pci_add_bus
 
 	/* Add new devices to global lists.  Register in proc, sysfs. */
 	pci_bus_add_devices(phb->bus);
-
-	/* Confirm new bridge dev was created */
-	dev = dlpar_find_new_dev(phb->bus, dn);
-	if (dev) {
-		if (dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) {
-			printk(KERN_ERR "%s: unexpected header type %d\n",
-				__FUNCTION__, dev->hdr_type);
-			return NULL;
-		}
-	}
-
-	return dev;
 }
 
 static int dlpar_add_pci_slot(char *drc_name, struct device_node *dn)
 {
 	struct pci_dev *dev;
+	struct pci_controller *phb;
 
 	if (pcibios_find_pci_bus(dn))
 		return -EINVAL;
 
 	/* Add pci bus */
-	dev = dlpar_pci_add_bus(dn);
+	dlpar_pci_add_bus(dn);
+
+	/* Confirm new bridge dev was created */
+	phb = PCI_DN(dn)->phb;
+	dev = dlpar_find_new_dev(phb->bus, dn);
+
 	if (!dev) {
 		printk(KERN_ERR "%s: unable to add bus %s\n", __FUNCTION__,
 			drc_name);
 		return -EIO;
 	}
 
+	if (dev->hdr_type != PCI_HEADER_TYPE_BRIDGE) {
+		printk(KERN_ERR "%s: unexpected header type %d, unable to add bus %s\n",
+			__FUNCTION__, dev->hdr_type, drc_name);
+		return -EIO;
+	}
+
 	/* Add hotplug slot */
 	if (rpaphp_add_slot(dn)) {
 		printk(KERN_ERR "%s: unable to add hotplug slot %s\n",


  reply	other threads:[~2006-01-20 19:05 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-20 19:04 [GIT PATCH] PCI patches for 2.6.16-rc1 Greg KH
2006-01-20 19:04 ` [PATCH] PCI: irq and pci_ids: patch for Intel ICH8 Greg KH
2006-01-20 19:04   ` [PATCH] PCI: schedule PCI_LEGACY_PROC for removal Greg KH
2006-01-20 19:04     ` [PATCH] pci: Schedule removal of pci_module_init Greg KH
2006-01-20 19:04       ` [PATCH] PCI: drivers/pci/pci.c: #if 0 pci_find_ext_capability() Greg KH
2006-01-20 19:04         ` [PATCH] PCI Hotplug: PCI panic on dlpar add (add pci slot to running partition) Greg KH
2006-01-20 19:04           ` [PATCH] PCI Hotplug: fix up coding style issues Greg KH
2006-01-20 19:04             ` [PATCH] PCI: pci_ids: remove duplicates gathered during merge period Greg KH
2006-01-20 19:04               ` [PATCH] PCI: make it easier to see that set_msi_affinity() is used Greg KH
2006-01-20 19:04                 ` [PATCH] PCI Hotplug: shpchp: AMD POGO errata fix Greg KH
2006-01-20 19:04                   ` [PATCH] PCI: restore 2 missing pci ids Greg KH
2006-01-20 19:04                     ` [PATCH] PCI Hotplug/powerpc: module build break Greg KH
2006-01-20 19:04                       ` [PATCH] PCI Hotplug: fix up Kconfig help text Greg KH
2006-01-20 19:04                         ` [PATCH] powerpc/PCI hotplug: cleanup: add prefix Greg KH
2006-01-20 19:04                           ` [PATCH] powerpc/PCI hotplug: remove rpaphp_fixup_new_pci_devices() Greg KH
2006-01-20 19:04                             ` [PATCH] powerpc/PCI hotplug: merge rpaphp_enable_pci_slot() Greg KH
2006-01-20 19:04                               ` [PATCH] powerpc/PCI hotplug: merge config_pci_adapter Greg KH
2006-01-20 19:04                                 ` [PATCH] powerpc/PCI hotplug: minor cleanup forward decls Greg KH
2006-01-20 19:04                                   ` [PATCH] powerpc/PCI hotplug: remove rpaphp_find_bus() Greg KH
2006-01-20 19:04                                     ` [PATCH] powerpc/PCI hotplug: remove remove_bus_device() Greg KH
2006-01-20 19:04                                       ` [PATCH] powerpc/PCI hotplug: de-convolute rpaphp_unconfig_pci_adap Greg KH
2006-01-20 19:04                                         ` Greg KH [this message]
2006-01-20 19:04                                           ` [PATCH] PCI: cyblafb: remove pci_module_init() return, really Greg KH
2006-01-20 19:23 ` [GIT PATCH] PCI patches for 2.6.16-rc1 Greg KH

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=11377838802978@kroah.com \
    --to=gregkh@suse.de \
    --cc=greg@kroah.com \
    --cc=linas@austin.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    /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