linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
To: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>, linux-next@vger.kernel.org
Subject: [PATCH 2/4] Updated version of 4c8cc2d54b1d35cf24ede6057e05f103cfa28852
Date: Wed, 28 May 2008 14:57:30 +0900	[thread overview]
Message-ID: <483CF44A.1060103@jp.fujitsu.com> (raw)
In-Reply-To: <483CF356.1010807@jp.fujitsu.com>

Current pciehp evaluates _OSC/OSHP method after some controller
initialization is done. So if evaluating _OSC/OSHP is failed, we need
to cleanup already initialized data structures or hardware. This
clearly is not robust way. With this patch, _OSC/OSHP evaluation is
done first.

Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>

---
 drivers/pci/hotplug/pciehp.h      |    1 +
 drivers/pci/hotplug/pciehp_core.c |   10 +++++++---
 drivers/pci/hotplug/pciehp_hpc.c  |   17 ++---------------
 3 files changed, 10 insertions(+), 18 deletions(-)

Index: linux-2.6.26-rc4/drivers/pci/hotplug/pciehp_core.c
===================================================================
--- linux-2.6.26-rc4.orig/drivers/pci/hotplug/pciehp_core.c
+++ linux-2.6.26-rc4/drivers/pci/hotplug/pciehp_core.c
@@ -444,7 +444,13 @@ static int pciehp_probe(struct pcie_devi
 	struct controller *ctrl;
 	struct slot *t_slot;
 	u8 value;
-	struct pci_dev *pdev;
+	struct pci_dev *pdev = dev->port;
+
+	if (pciehp_force)
+		dbg("Bypassing BIOS check for pciehp use on %s\n",
+		    pci_name(pdev));
+	else if (pciehp_get_hp_hw_control_from_firmware(pdev))
+		goto err_out_none;
 
 	ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL);
 	if (!ctrl) {
@@ -453,8 +459,6 @@ static int pciehp_probe(struct pcie_devi
 	}
 	INIT_LIST_HEAD(&ctrl->slot_list);
 
-	pdev = dev->port;
-
 	rc = pcie_init(ctrl, dev);
 	if (rc) {
 		dbg("%s: controller initialization failed\n", PCIE_MODULE_NAME);
Index: linux-2.6.26-rc4/drivers/pci/hotplug/pciehp_hpc.c
===================================================================
--- linux-2.6.26-rc4.orig/drivers/pci/hotplug/pciehp_hpc.c
+++ linux-2.6.26-rc4/drivers/pci/hotplug/pciehp_hpc.c
@@ -1018,7 +1018,7 @@ static struct hpc_ops pciehp_hpc_ops = {
 };
 
 #ifdef CONFIG_ACPI
-static int pciehp_acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev)
+int pciehp_acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev)
 {
 	acpi_status status;
 	acpi_handle chandle, handle = DEVICE_ACPI_HANDLE(&(dev->dev));
@@ -1122,23 +1122,10 @@ int pcie_init_hardware_part2(struct cont
 
 	if (pcie_write_cmd(ctrl, cmd, mask)) {
 		err("%s: Cannot enable software notification\n", __func__);
-		goto abort;
+		return -1;
 	}
 
-	if (pciehp_force)
-		dbg("Bypassing BIOS check for pciehp use on %s\n",
-				pci_name(ctrl->pci_dev));
-	else if (pciehp_get_hp_hw_control_from_firmware(ctrl->pci_dev))
-		goto abort_disable_intr;
-
 	return 0;
-
-	/* We end up here for the many possible ways to fail this API. */
-abort_disable_intr:
-	if (pcie_write_cmd(ctrl, 0, HP_INTR_ENABLE))
-		err("%s : disabling interrupts failed\n", __func__);
-abort:
-	return -1;
 }
 
 static inline void dbg_ctrl(struct controller *ctrl)
Index: linux-2.6.26-rc4/drivers/pci/hotplug/pciehp.h
===================================================================
--- linux-2.6.26-rc4.orig/drivers/pci/hotplug/pciehp.h
+++ linux-2.6.26-rc4/drivers/pci/hotplug/pciehp.h
@@ -202,6 +202,7 @@ struct hpc_ops {
 #include <acpi/actypes.h>
 #include <linux/pci-acpi.h>
 
+extern int pciehp_acpi_get_hp_hw_control_from_firmware(struct pci_dev *dev);
 #define pciehp_get_hp_hw_control_from_firmware(dev)			\
 	pciehp_acpi_get_hp_hw_control_from_firmware(dev)
 static inline int pciehp_get_hp_params_from_firmware(struct pci_dev *dev,



  parent reply	other threads:[~2008-05-28  5:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-28  2:27 linux-next: pci merge conflict Stephen Rothwell
2008-05-28  2:50 ` Kenji Kaneshige
2008-05-28  3:19   ` Stephen Rothwell
2008-05-28  4:04   ` Jesse Barnes
2008-05-28  4:08   ` Jesse Barnes
2008-05-28  5:53     ` Kenji Kaneshige
2008-05-28  5:56       ` [PATCH 1/4] Updated version of 72c4928058175e889b2f83d1a62ac6f2eb0498a0 Kenji Kaneshige
2008-05-28  5:57       ` Kenji Kaneshige [this message]
2008-05-28  5:59       ` [PATCH 3/4] Updated version of 2b26196717939221ccc06073780b73d0f4ee3203 Kenji Kaneshige
2008-05-28  6:01       ` [PATCH 4/4] Updated version of 9d06d9963852e7818157994c645c640239cb5137 Kenji Kaneshige
2008-05-28 17:57       ` linux-next: pci merge conflict Jesse Barnes

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=483CF44A.1060103@jp.fujitsu.com \
    --to=kaneshige.kenji@jp.fujitsu.com \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-next@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    /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).