aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/rpaphp_slot.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/hotplug/rpaphp_slot.c')
-rw-r--r--drivers/pci/hotplug/rpaphp_slot.c57
1 files changed, 9 insertions, 48 deletions
diff --git a/drivers/pci/hotplug/rpaphp_slot.c b/drivers/pci/hotplug/rpaphp_slot.c
index 80402027c015..0e8815495083 100644
--- a/drivers/pci/hotplug/rpaphp_slot.c
+++ b/drivers/pci/hotplug/rpaphp_slot.c
@@ -30,35 +30,6 @@
30#include <asm/rtas.h> 30#include <asm/rtas.h>
31#include "rpaphp.h" 31#include "rpaphp.h"
32 32
33static ssize_t removable_read_file (struct hotplug_slot *php_slot, char *buf)
34{
35 u8 value;
36 int retval = -ENOENT;
37 struct slot *slot = (struct slot *)php_slot->private;
38
39 if (!slot)
40 return retval;
41
42 value = slot->removable;
43 retval = sprintf (buf, "%d\n", value);
44 return retval;
45}
46
47static struct hotplug_slot_attribute hotplug_slot_attr_removable = {
48 .attr = {.name = "phy_removable", .mode = S_IFREG | S_IRUGO},
49 .show = removable_read_file,
50};
51
52static void rpaphp_sysfs_add_attr_removable (struct hotplug_slot *slot)
53{
54 sysfs_create_file(&slot->kobj, &hotplug_slot_attr_removable.attr);
55}
56
57static void rpaphp_sysfs_remove_attr_removable (struct hotplug_slot *slot)
58{
59 sysfs_remove_file(&slot->kobj, &hotplug_slot_attr_removable.attr);
60}
61
62static ssize_t location_read_file (struct hotplug_slot *php_slot, char *buf) 33static ssize_t location_read_file (struct hotplug_slot *php_slot, char *buf)
63{ 34{
64 char *value; 35 char *value;
@@ -176,9 +147,6 @@ int deregister_slot(struct slot *slot)
176 /* remove "phy_location" file */ 147 /* remove "phy_location" file */
177 rpaphp_sysfs_remove_attr_location(php_slot); 148 rpaphp_sysfs_remove_attr_location(php_slot);
178 149
179 /* remove "phy_removable" file */
180 rpaphp_sysfs_remove_attr_removable(php_slot);
181
182 retval = pci_hp_deregister(php_slot); 150 retval = pci_hp_deregister(php_slot);
183 if (retval) 151 if (retval)
184 err("Problem unregistering a slot %s\n", slot->name); 152 err("Problem unregistering a slot %s\n", slot->name);
@@ -212,9 +180,6 @@ int register_slot(struct slot *slot)
212 /* create "phy_locatoin" file */ 180 /* create "phy_locatoin" file */
213 rpaphp_sysfs_add_attr_location(slot->hotplug_slot); 181 rpaphp_sysfs_add_attr_location(slot->hotplug_slot);
214 182
215 /* create "phy_removable" file */
216 rpaphp_sysfs_add_attr_removable(slot->hotplug_slot);
217
218 /* add slot to our internal list */ 183 /* add slot to our internal list */
219 dbg("%s adding slot[%s] to rpaphp_slot_list\n", 184 dbg("%s adding slot[%s] to rpaphp_slot_list\n",
220 __FUNCTION__, slot->name); 185 __FUNCTION__, slot->name);
@@ -230,21 +195,17 @@ int rpaphp_get_power_status(struct slot *slot, u8 * value)
230{ 195{
231 int rc = 0, level; 196 int rc = 0, level;
232 197
233 if (slot->type == HOTPLUG) { 198 rc = rtas_get_power_level(slot->power_domain, &level);
234 rc = rtas_get_power_level(slot->power_domain, &level); 199 if (rc < 0) {
235 if (!rc) { 200 err("failed to get power-level for slot(%s), rc=0x%x\n",
236 dbg("%s the power level of slot %s(pwd-domain:0x%x) is %d\n", 201 slot->location, rc);
237 __FUNCTION__, slot->name, slot->power_domain, level); 202 return rc;
238 *value = level;
239 } else
240 err("failed to get power-level for slot(%s), rc=0x%x\n",
241 slot->location, rc);
242 } else {
243 dbg("%s report POWER_ON for EMBEDDED or PHB slot %s\n",
244 __FUNCTION__, slot->location);
245 *value = (u8) POWER_ON;
246 } 203 }
247 204
205 dbg("%s the power level of slot %s(pwd-domain:0x%x) is %d\n",
206 __FUNCTION__, slot->name, slot->power_domain, level);
207 *value = level;
208
248 return rc; 209 return rc;
249} 210}
250 211