aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Lynch <ntl@pobox.com>2008-03-13 15:52:10 -0400
committerPaul Mackerras <paulus@samba.org>2008-04-06 23:49:25 -0400
commitc6d4d5a8a83e4a564bcf233fdd565183c33df5d1 (patch)
tree801bfb328121f02df9e78380eb25f325ea2a41cb
parent834d97d452208279edf11c57eca150360d2dd1d6 (diff)
[POWERPC] Convert pci and eeh code to of_device_is_available
A couple of places are duplicating the function of of_device_is_available; convert them to use it. Signed-off-by: Nathan Lynch <ntl@pobox.com> Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r--arch/powerpc/kernel/rtas_pci.c19
-rw-r--r--arch/powerpc/platforms/pseries/eeh.c5
2 files changed, 4 insertions, 20 deletions
diff --git a/arch/powerpc/kernel/rtas_pci.c b/arch/powerpc/kernel/rtas_pci.c
index 945e8f4db873..3ab88a9dc70d 100644
--- a/arch/powerpc/kernel/rtas_pci.c
+++ b/arch/powerpc/kernel/rtas_pci.c
@@ -56,21 +56,6 @@ static inline int config_access_valid(struct pci_dn *dn, int where)
56 return 0; 56 return 0;
57} 57}
58 58
59static int of_device_available(struct device_node * dn)
60{
61 const char *status;
62
63 status = of_get_property(dn, "status", NULL);
64
65 if (!status)
66 return 1;
67
68 if (!strcmp(status, "okay"))
69 return 1;
70
71 return 0;
72}
73
74int rtas_read_config(struct pci_dn *pdn, int where, int size, u32 *val) 59int rtas_read_config(struct pci_dn *pdn, int where, int size, u32 *val)
75{ 60{
76 int returnval = -1; 61 int returnval = -1;
@@ -117,7 +102,7 @@ static int rtas_pci_read_config(struct pci_bus *bus,
117 for (dn = busdn->child; dn; dn = dn->sibling) { 102 for (dn = busdn->child; dn; dn = dn->sibling) {
118 struct pci_dn *pdn = PCI_DN(dn); 103 struct pci_dn *pdn = PCI_DN(dn);
119 if (pdn && pdn->devfn == devfn 104 if (pdn && pdn->devfn == devfn
120 && of_device_available(dn)) 105 && of_device_is_available(dn))
121 return rtas_read_config(pdn, where, size, val); 106 return rtas_read_config(pdn, where, size, val);
122 } 107 }
123 108
@@ -164,7 +149,7 @@ static int rtas_pci_write_config(struct pci_bus *bus,
164 for (dn = busdn->child; dn; dn = dn->sibling) { 149 for (dn = busdn->child; dn; dn = dn->sibling) {
165 struct pci_dn *pdn = PCI_DN(dn); 150 struct pci_dn *pdn = PCI_DN(dn);
166 if (pdn && pdn->devfn == devfn 151 if (pdn && pdn->devfn == devfn
167 && of_device_available(dn)) 152 && of_device_is_available(dn))
168 return rtas_write_config(pdn, where, size, val); 153 return rtas_write_config(pdn, where, size, val);
169 } 154 }
170 return PCIBIOS_DEVICE_NOT_FOUND; 155 return PCIBIOS_DEVICE_NOT_FOUND;
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c
index 9eb539ee5f9a..550b2f7d2cc1 100644
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -945,7 +945,6 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
945 unsigned int rets[3]; 945 unsigned int rets[3];
946 struct eeh_early_enable_info *info = data; 946 struct eeh_early_enable_info *info = data;
947 int ret; 947 int ret;
948 const char *status = of_get_property(dn, "status", NULL);
949 const u32 *class_code = of_get_property(dn, "class-code", NULL); 948 const u32 *class_code = of_get_property(dn, "class-code", NULL);
950 const u32 *vendor_id = of_get_property(dn, "vendor-id", NULL); 949 const u32 *vendor_id = of_get_property(dn, "vendor-id", NULL);
951 const u32 *device_id = of_get_property(dn, "device-id", NULL); 950 const u32 *device_id = of_get_property(dn, "device-id", NULL);
@@ -959,8 +958,8 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
959 pdn->eeh_freeze_count = 0; 958 pdn->eeh_freeze_count = 0;
960 pdn->eeh_false_positives = 0; 959 pdn->eeh_false_positives = 0;
961 960
962 if (status && strncmp(status, "ok", 2) != 0) 961 if (!of_device_is_available(dn))
963 return NULL; /* ignore devices with bad status */ 962 return NULL;
964 963
965 /* Ignore bad nodes. */ 964 /* Ignore bad nodes. */
966 if (!class_code || !vendor_id || !device_id) 965 if (!class_code || !vendor_id || !device_id)