diff options
author | Linas Vepstas <linas@austin.ibm.com> | 2007-04-13 18:34:14 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-05-02 22:02:39 -0400 |
commit | bf0af511fcc856649a2a39c627828695b580d124 (patch) | |
tree | f921e091364da84b19741e9054600695491a9707 /drivers/pci/hotplug/rpaphp_pci.c | |
parent | 427310ff02e80cc80826407c0121cec3694c9e7d (diff) |
PCI: rpaphp: Remove another wrappered function
Remove another stove-pipe; this funcion was called from
two different places, with a compile-time const that is
then run-time checked to perform two different things.
Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
Cc: John Rose <johnrose@austin.ibm.com>
Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci/hotplug/rpaphp_pci.c')
-rw-r--r-- | drivers/pci/hotplug/rpaphp_pci.c | 59 |
1 files changed, 16 insertions, 43 deletions
diff --git a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c index ba8c83770abe..b6a991ab9b7e 100644 --- a/drivers/pci/hotplug/rpaphp_pci.c +++ b/drivers/pci/hotplug/rpaphp_pci.c | |||
@@ -64,43 +64,6 @@ int rpaphp_get_sensor_state(struct slot *slot, int *state) | |||
64 | return rc; | 64 | return rc; |
65 | } | 65 | } |
66 | 66 | ||
67 | /** | ||
68 | * get_pci_adapter_status - get the status of a slot | ||
69 | * | ||
70 | * 0-- slot is empty | ||
71 | * 1-- adapter is configured | ||
72 | * 2-- adapter is not configured | ||
73 | * 3-- not valid | ||
74 | */ | ||
75 | int rpaphp_get_pci_adapter_status(struct slot *slot, int is_init, u8 * value) | ||
76 | { | ||
77 | struct pci_bus *bus; | ||
78 | int state, rc; | ||
79 | |||
80 | *value = NOT_VALID; | ||
81 | rc = rpaphp_get_sensor_state(slot, &state); | ||
82 | if (rc) | ||
83 | goto exit; | ||
84 | |||
85 | if (state == EMPTY) | ||
86 | *value = EMPTY; | ||
87 | else if (state == PRESENT) { | ||
88 | if (!is_init) { | ||
89 | /* at run-time slot->state can be changed by */ | ||
90 | /* config/unconfig adapter */ | ||
91 | *value = slot->state; | ||
92 | } else { | ||
93 | bus = pcibios_find_pci_bus(slot->dn); | ||
94 | if (bus && !list_empty(&bus->devices)) | ||
95 | *value = CONFIGURED; | ||
96 | else | ||
97 | *value = NOT_CONFIGURED; | ||
98 | } | ||
99 | } | ||
100 | exit: | ||
101 | return rc; | ||
102 | } | ||
103 | |||
104 | static void print_slot_pci_funcs(struct pci_bus *bus) | 67 | static void print_slot_pci_funcs(struct pci_bus *bus) |
105 | { | 68 | { |
106 | struct device_node *dn; | 69 | struct device_node *dn; |
@@ -183,20 +146,30 @@ exit_rc: | |||
183 | 146 | ||
184 | int rpaphp_register_pci_slot(struct slot *slot) | 147 | int rpaphp_register_pci_slot(struct slot *slot) |
185 | { | 148 | { |
186 | int rc, level; | 149 | int rc, level, state; |
150 | struct pci_bus *bus; | ||
187 | struct hotplug_slot_info *info = slot->hotplug_slot->info; | 151 | struct hotplug_slot_info *info = slot->hotplug_slot->info; |
188 | 152 | ||
153 | /* Find out if the power is turned on for the slot */ | ||
189 | rc = rtas_get_power_level(slot->power_domain, &level); | 154 | rc = rtas_get_power_level(slot->power_domain, &level); |
190 | if (rc) | 155 | if (rc) |
191 | return rc; | 156 | return rc; |
192 | info->power_status = level; | 157 | info->power_status = level; |
193 | 158 | ||
194 | rpaphp_get_pci_adapter_status(slot, 1, &info->adapter_status); | 159 | /* Figure out if there is an adapter in the slot */ |
160 | info->adapter_status = NOT_VALID; | ||
161 | rc = rpaphp_get_sensor_state(slot, &state); | ||
162 | if (rc) | ||
163 | return rc; | ||
195 | 164 | ||
196 | if (info->adapter_status == NOT_VALID) { | 165 | if (state == EMPTY) |
197 | err("%s: NOT_VALID: skip dn->full_name=%s\n", | 166 | info->adapter_status = EMPTY; |
198 | __FUNCTION__, slot->dn->full_name); | 167 | else if (state == PRESENT) { |
199 | return -EINVAL; | 168 | bus = pcibios_find_pci_bus(slot->dn); |
169 | if (bus && !list_empty(&bus->devices)) | ||
170 | info->adapter_status = CONFIGURED; | ||
171 | else | ||
172 | info->adapter_status = NOT_CONFIGURED; | ||
200 | } | 173 | } |
201 | 174 | ||
202 | if (setup_pci_slot(slot)) | 175 | if (setup_pci_slot(slot)) |