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.c66
1 files changed, 11 insertions, 55 deletions
diff --git a/drivers/pci/hotplug/rpaphp_slot.c b/drivers/pci/hotplug/rpaphp_slot.c
index ff2cbf0652d8..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,21 +180,13 @@ 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);
221 186
222 list_add(&slot->rpaphp_slot_list, &rpaphp_slot_head); 187 list_add(&slot->rpaphp_slot_list, &rpaphp_slot_head);
223 188 info("Slot [%s](PCI location=%s) registered\n", slot->name,
224 if (slot->dev_type == VIO_DEV) 189 slot->location);
225 info("Slot [%s](VIO location=%s) registered\n",
226 slot->name, slot->location);
227 else
228 info("Slot [%s](PCI location=%s) registered\n",
229 slot->name, slot->location);
230 num_slots++; 190 num_slots++;
231 return 0; 191 return 0;
232} 192}
@@ -235,21 +195,17 @@ int rpaphp_get_power_status(struct slot *slot, u8 * value)
235{ 195{
236 int rc = 0, level; 196 int rc = 0, level;
237 197
238 if (slot->type == HOTPLUG) { 198 rc = rtas_get_power_level(slot->power_domain, &level);
239 rc = rtas_get_power_level(slot->power_domain, &level); 199 if (rc < 0) {
240 if (!rc) { 200 err("failed to get power-level for slot(%s), rc=0x%x\n",
241 dbg("%s the power level of slot %s(pwd-domain:0x%x) is %d\n", 201 slot->location, rc);
242 __FUNCTION__, slot->name, slot->power_domain, level); 202 return rc;
243 *value = level;
244 } else
245 err("failed to get power-level for slot(%s), rc=0x%x\n",
246 slot->location, rc);
247 } else {
248 dbg("%s report POWER_ON for EMBEDDED or PHB slot %s\n",
249 __FUNCTION__, slot->location);
250 *value = (u8) POWER_ON;
251 } 203 }
252 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
253 return rc; 209 return rc;
254} 210}
255 211