[PATCH 18/21] Replace pci_dn with eeh_dev for EEH aux components

2012-02-27 Thread Gavin Shan
The original EEH implementation is heavily depending on struct pci_dn.
We have to put EEH related information to pci_dn. Actually, we could
split struct pci_dn so that the EEH sensitive information to form an
individual struct, then EEH looks more independent.

The patch replaces pci_dn with eeh_dev for EEH aux components like
event and driver. Also, the eeh_event struct has been adjusted for
a little bit since eeh_dev has linked the associated FDT (Flat Device
Tree) node and PCI device. It's not necessary for eeh_event struct to
trace FDT node and PCI device. We can just simply to trace eeh_dev in
eeh_event.

The patch also renames function pcid_name() to eeh_pcid_name(), which
should be missed in the previous patch where the EEH aux components
have been cleaned up.

Signed-off-by: Gavin Shan sha...@linux.vnet.ibm.com
---
 arch/powerpc/include/asm/eeh_event.h|7 +-
 arch/powerpc/platforms/pseries/eeh.c|2 +-
 arch/powerpc/platforms/pseries/eeh_driver.c |   81 +--
 arch/powerpc/platforms/pseries/eeh_event.c  |   36 ++--
 4 files changed, 63 insertions(+), 63 deletions(-)

diff --git a/arch/powerpc/include/asm/eeh_event.h 
b/arch/powerpc/include/asm/eeh_event.h
index 25ebf6a..c68b012 100644
--- a/arch/powerpc/include/asm/eeh_event.h
+++ b/arch/powerpc/include/asm/eeh_event.h
@@ -28,12 +28,11 @@
  */
 struct eeh_event {
struct list_headlist;   /* to form event queue  */
-   struct device_node  *dn;/* struct device node   */
-   struct pci_dev  *dev;   /* affected device  */
+   struct eeh_dev  *edev;  /* EEH device   */
 };
 
-int eeh_send_failure_event(struct device_node *dn, struct pci_dev *dev);
-struct pci_dn *handle_eeh_events(struct eeh_event *);
+int eeh_send_failure_event(struct eeh_dev *edev);
+struct eeh_dev *handle_eeh_events(struct eeh_event *);
 
 #endif /* __KERNEL__ */
 #endif /* ASM_POWERPC_EEH_EVENT_H */
diff --git a/arch/powerpc/platforms/pseries/eeh.c 
b/arch/powerpc/platforms/pseries/eeh.c
index aec10f6..9b1fd0c 100644
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -475,7 +475,7 @@ int eeh_dn_check_failure(struct device_node *dn, struct 
pci_dev *dev)
eeh_mark_slot(dn, EEH_MODE_ISOLATED);
raw_spin_unlock_irqrestore(confirm_error_lock, flags);
 
-   eeh_send_failure_event(edev-dn, edev-pdev);
+   eeh_send_failure_event(edev);
 
/* Most EEH events are due to device driver bugs.  Having
 * a stack trace will help the device-driver authors figure
diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c 
b/arch/powerpc/platforms/pseries/eeh_driver.c
index 3f25fab..baf92cd 100644
--- a/arch/powerpc/platforms/pseries/eeh_driver.c
+++ b/arch/powerpc/platforms/pseries/eeh_driver.c
@@ -40,7 +40,7 @@
  * This routine is used to retrieve the name of PCI device driver
  * if that's valid.
  */
-static inline const char *pcid_name(struct pci_dev *pdev)
+static inline const char *eeh_pcid_name(struct pci_dev *pdev)
 {
if (pdev  pdev-dev.driver)
return pdev-dev.driver-name;
@@ -81,7 +81,7 @@ static void print_device_node_tree(struct pci_dn *pdn, int 
dent)
  */
 static void eeh_disable_irq(struct pci_dev *dev)
 {
-   struct device_node *dn = pci_device_to_OF_node(dev);
+   struct eeh_dev *edev = pci_dev_to_eeh_dev(dev);
 
/* Don't disable MSI and MSI-X interrupts. They are
 * effectively disabled by the DMA Stopped state
@@ -93,7 +93,7 @@ static void eeh_disable_irq(struct pci_dev *dev)
if (!irq_has_action(dev-irq))
return;
 
-   PCI_DN(dn)-eeh_mode |= EEH_MODE_IRQ_DISABLED;
+   edev-mode |= EEH_MODE_IRQ_DISABLED;
disable_irq_nosync(dev-irq);
 }
 
@@ -106,10 +106,10 @@ static void eeh_disable_irq(struct pci_dev *dev)
  */
 static void eeh_enable_irq(struct pci_dev *dev)
 {
-   struct device_node *dn = pci_device_to_OF_node(dev);
+   struct eeh_dev *edev = pci_dev_to_eeh_dev(dev);
 
-   if ((PCI_DN(dn)-eeh_mode)  EEH_MODE_IRQ_DISABLED) {
-   PCI_DN(dn)-eeh_mode = ~EEH_MODE_IRQ_DISABLED;
+   if ((edev-mode)  EEH_MODE_IRQ_DISABLED) {
+   edev-mode = ~EEH_MODE_IRQ_DISABLED;
enable_irq(dev-irq);
}
 }
@@ -270,20 +270,20 @@ static int eeh_report_failure(struct pci_dev *dev, void 
*userdata)
 
 /**
  * eeh_reset_device - Perform actual reset of a pci slot
- * @pe_dn: PE associated device node
+ * @edev: PE associated EEH device
  * @bus: PCI bus corresponding to the isolcated slot
  *
  * This routine must be called to do reset on the indicated PE.
  * During the reset, udev might be invoked because those affected
  * PCI devices will be removed and then added.
  */
-static int eeh_reset_device(struct pci_dn *pe_dn, struct pci_bus *bus)
+static int eeh_reset_device(struct eeh_dev *edev, struct pci_bus *bus)
 {
struct device_node *dn;
int cnt, rc;
 
  

[PATCH 18/21] Replace pci_dn with eeh_dev for EEH aux components

2012-02-24 Thread Gavin Shan
The original EEH implementation is heavily depending on struct pci_dn.
We have to put EEH related information to pci_dn. Actually, we could
split struct pci_dn so that the EEH sensitive information to form an
individual struct, then EEH looks more independent.

The patch replaces pci_dn with eeh_dev for EEH aux components like
event and driver. Also, the eeh_event struct has been adjusted for
a little bit since eeh_dev has linked the associated FDT (Flat Device
Tree) node and PCI device. It's not necessary for eeh_event struct to
trace FDT node and PCI device. We can just simply to trace eeh_dev in
eeh_event.

The patch also renames function pcid_name() to eeh_pcid_name(), which
should be missed in the previous patch where the EEH aux components
have been cleaned up.

Signed-off-by: Gavin Shan sha...@linux.vnet.ibm.com
---
 arch/powerpc/include/asm/eeh_event.h|7 +-
 arch/powerpc/platforms/pseries/eeh.c|2 +-
 arch/powerpc/platforms/pseries/eeh_driver.c |   81 +--
 arch/powerpc/platforms/pseries/eeh_event.c  |   36 ++--
 4 files changed, 63 insertions(+), 63 deletions(-)

diff --git a/arch/powerpc/include/asm/eeh_event.h 
b/arch/powerpc/include/asm/eeh_event.h
index 25ebf6a..c68b012 100644
--- a/arch/powerpc/include/asm/eeh_event.h
+++ b/arch/powerpc/include/asm/eeh_event.h
@@ -28,12 +28,11 @@
  */
 struct eeh_event {
struct list_headlist;   /* to form event queue  */
-   struct device_node  *dn;/* struct device node   */
-   struct pci_dev  *dev;   /* affected device  */
+   struct eeh_dev  *edev;  /* EEH device   */
 };
 
-int eeh_send_failure_event(struct device_node *dn, struct pci_dev *dev);
-struct pci_dn *handle_eeh_events(struct eeh_event *);
+int eeh_send_failure_event(struct eeh_dev *edev);
+struct eeh_dev *handle_eeh_events(struct eeh_event *);
 
 #endif /* __KERNEL__ */
 #endif /* ASM_POWERPC_EEH_EVENT_H */
diff --git a/arch/powerpc/platforms/pseries/eeh.c 
b/arch/powerpc/platforms/pseries/eeh.c
index 84a8a0c..759d5af 100644
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -475,7 +475,7 @@ int eeh_dn_check_failure(struct device_node *dn, struct 
pci_dev *dev)
eeh_mark_slot(dn, EEH_MODE_ISOLATED);
raw_spin_unlock_irqrestore(confirm_error_lock, flags);
 
-   eeh_send_failure_event(edev-dn, edev-pdev);
+   eeh_send_failure_event(edev);
 
/* Most EEH events are due to device driver bugs.  Having
 * a stack trace will help the device-driver authors figure
diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c 
b/arch/powerpc/platforms/pseries/eeh_driver.c
index 3f25fab..3bf1d10 100644
--- a/arch/powerpc/platforms/pseries/eeh_driver.c
+++ b/arch/powerpc/platforms/pseries/eeh_driver.c
@@ -40,7 +40,7 @@
  * This routine is used to retrieve the name of PCI device driver
  * if that's valid.
  */
-static inline const char *pcid_name(struct pci_dev *pdev)
+static inline const char *eeh_pcid_name(struct pci_dev *pdev)
 {
if (pdev  pdev-dev.driver)
return pdev-dev.driver-name;
@@ -81,7 +81,7 @@ static void print_device_node_tree(struct pci_dn *pdn, int 
dent)
  */
 static void eeh_disable_irq(struct pci_dev *dev)
 {
-   struct device_node *dn = pci_device_to_OF_node(dev);
+   struct eeh_dev *edev = PCI_DEV_TO_EEH_DEV(dev);
 
/* Don't disable MSI and MSI-X interrupts. They are
 * effectively disabled by the DMA Stopped state
@@ -93,7 +93,7 @@ static void eeh_disable_irq(struct pci_dev *dev)
if (!irq_has_action(dev-irq))
return;
 
-   PCI_DN(dn)-eeh_mode |= EEH_MODE_IRQ_DISABLED;
+   edev-mode |= EEH_MODE_IRQ_DISABLED;
disable_irq_nosync(dev-irq);
 }
 
@@ -106,10 +106,10 @@ static void eeh_disable_irq(struct pci_dev *dev)
  */
 static void eeh_enable_irq(struct pci_dev *dev)
 {
-   struct device_node *dn = pci_device_to_OF_node(dev);
+   struct eeh_dev *edev = PCI_DEV_TO_EEH_DEV(dev);
 
-   if ((PCI_DN(dn)-eeh_mode)  EEH_MODE_IRQ_DISABLED) {
-   PCI_DN(dn)-eeh_mode = ~EEH_MODE_IRQ_DISABLED;
+   if ((edev-mode)  EEH_MODE_IRQ_DISABLED) {
+   edev-mode = ~EEH_MODE_IRQ_DISABLED;
enable_irq(dev-irq);
}
 }
@@ -270,20 +270,20 @@ static int eeh_report_failure(struct pci_dev *dev, void 
*userdata)
 
 /**
  * eeh_reset_device - Perform actual reset of a pci slot
- * @pe_dn: PE associated device node
+ * @edev: PE associated EEH device
  * @bus: PCI bus corresponding to the isolcated slot
  *
  * This routine must be called to do reset on the indicated PE.
  * During the reset, udev might be invoked because those affected
  * PCI devices will be removed and then added.
  */
-static int eeh_reset_device(struct pci_dn *pe_dn, struct pci_bus *bus)
+static int eeh_reset_device(struct eeh_dev *edev, struct pci_bus *bus)
 {
struct device_node *dn;
int cnt, rc;