aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug
diff options
context:
space:
mode:
authorLinas Vepstas <linas@austin.ibm.com>2007-04-13 18:34:22 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-05-02 22:02:40 -0400
commitda65944be2441191539f50ce71cd1f8030699be1 (patch)
tree009e2ef836472f1f184f84dcb1b8cc29a783173a /drivers/pci/hotplug
parent8485d1a123e0d367bbcbfec36acf134e6895f39a (diff)
PCI: rpaphp: Document is_php_dn()
Fix up the documentation: the rpaphp_add_slot() does not actually handle embedded slots: in fact, it ignores them. Fix the flow of control in the routine that checks for embedded slots. 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')
-rw-r--r--drivers/pci/hotplug/rpaphp_core.c42
1 files changed, 29 insertions, 13 deletions
diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
index 75113d9e84ee..aa8d9a60d0a6 100644
--- a/drivers/pci/hotplug/rpaphp_core.c
+++ b/drivers/pci/hotplug/rpaphp_core.c
@@ -262,6 +262,14 @@ static int is_php_type(char *drc_type)
262 return 1; 262 return 1;
263} 263}
264 264
265/**
266 * is_php_dn() - return 1 if this is a hotpluggable pci slot, else 0
267 *
268 * This routine will return true only if the device node is
269 * a hotpluggable slot. This routine will return false
270 * for built-in pci slots (even when the built-in slots are
271 * dlparable.)
272 */
265static int is_php_dn(struct device_node *dn, const int **indexes, 273static int is_php_dn(struct device_node *dn, const int **indexes,
266 const int **names, const int **types, const int **power_domains) 274 const int **names, const int **types, const int **power_domains)
267{ 275{
@@ -269,24 +277,31 @@ static int is_php_dn(struct device_node *dn, const int **indexes,
269 int rc; 277 int rc;
270 278
271 rc = get_children_props(dn, indexes, names, &drc_types, power_domains); 279 rc = get_children_props(dn, indexes, names, &drc_types, power_domains);
272 if (rc >= 0) { 280 if (rc < 0)
273 if (is_php_type((char *) &drc_types[1])) { 281 return 0;
274 *types = drc_types;
275 return 1;
276 }
277 }
278 282
279 return 0; 283 if (!is_php_type((char *) &drc_types[1]))
284 return 0;
285
286 *types = drc_types;
287 return 1;
280} 288}
281 289
282/** 290/**
283 * rpaphp_add_slot -- add hotplug or dlpar slot 291 * rpaphp_add_slot -- declare a hotplug slot to the hotplug subsystem.
292 * @dn device node of slot
293 *
294 * This subroutine will register a hotplugable slot with the
295 * PCI hotplug infrastructure. This routine is typicaly called
296 * during boot time, if the hotplug slots are present at boot time,
297 * or is called later, by the dlpar add code, if the slot is
298 * being dynamically added during runtime.
299 *
300 * If the device node points at an embedded (built-in) slot, this
301 * routine will just return without doing anything, since embedded
302 * slots cannot be hotplugged.
284 * 303 *
285 * rpaphp not only registers PCI hotplug slots(HOTPLUG), 304 * To remove a slot, it suffices to call rpaphp_deregister_slot()
286 * but also logical DR slots(EMBEDDED).
287 * HOTPLUG slot: An adapter can be physically added/removed.
288 * EMBEDDED slot: An adapter can be logically removed/added
289 * from/to a partition with the slot.
290 */ 305 */
291int rpaphp_add_slot(struct device_node *dn) 306int rpaphp_add_slot(struct device_node *dn)
292{ 307{
@@ -299,6 +314,7 @@ int rpaphp_add_slot(struct device_node *dn)
299 if (!dn->name || strcmp(dn->name, "pci")) 314 if (!dn->name || strcmp(dn->name, "pci"))
300 return 0; 315 return 0;
301 316
317 /* If this is not a hotplug slot, return without doing anything. */
302 if (!is_php_dn(dn, &indexes, &names, &types, &power_domains)) 318 if (!is_php_dn(dn, &indexes, &names, &types, &power_domains))
303 return 0; 319 return 0;
304 320