From b493e10d75b3f60df4a6a166e5093cb24e97ea02 Mon Sep 17 00:00:00 2001 From: Linas Vepstas Date: Fri, 13 Apr 2007 15:34:22 -0700 Subject: [PATCH] --- yaml --- r: 53375 b: refs/heads/master c: da65944be2441191539f50ce71cd1f8030699be1 h: refs/heads/master i: 53373: beb64ea752b26f07e3332203ba30109f1eb10353 53371: 00e3549caef6bd6db852903c287471a139629af4 53367: bfc0e42cb8590fb2291497183dc5c83b11972e3e 53359: 2c5034b6dd2907c207e5f711aa3ad120c6c2093b 53343: c004f0b6a06feab3abac516f70b06483db52509d 53311: 3422eb0399c8f019b898f1d0948a1164cbeafb1f 53247: 2f024ad2cf79ba66292b55b78f462e1a38f0045d v: v3 --- [refs] | 2 +- trunk/drivers/pci/hotplug/rpaphp_core.c | 42 +++++++++++++++++-------- 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/[refs] b/[refs] index 8ba54cba8151..a1548bdaf5a7 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 8485d1a123e0d367bbcbfec36acf134e6895f39a +refs/heads/master: da65944be2441191539f50ce71cd1f8030699be1 diff --git a/trunk/drivers/pci/hotplug/rpaphp_core.c b/trunk/drivers/pci/hotplug/rpaphp_core.c index 75113d9e84ee..aa8d9a60d0a6 100644 --- a/trunk/drivers/pci/hotplug/rpaphp_core.c +++ b/trunk/drivers/pci/hotplug/rpaphp_core.c @@ -262,6 +262,14 @@ static int is_php_type(char *drc_type) return 1; } +/** + * is_php_dn() - return 1 if this is a hotpluggable pci slot, else 0 + * + * This routine will return true only if the device node is + * a hotpluggable slot. This routine will return false + * for built-in pci slots (even when the built-in slots are + * dlparable.) + */ static int is_php_dn(struct device_node *dn, const int **indexes, const int **names, const int **types, const int **power_domains) { @@ -269,24 +277,31 @@ static int is_php_dn(struct device_node *dn, const int **indexes, int rc; rc = get_children_props(dn, indexes, names, &drc_types, power_domains); - if (rc >= 0) { - if (is_php_type((char *) &drc_types[1])) { - *types = drc_types; - return 1; - } - } + if (rc < 0) + return 0; - return 0; + if (!is_php_type((char *) &drc_types[1])) + return 0; + + *types = drc_types; + return 1; } /** - * rpaphp_add_slot -- add hotplug or dlpar slot + * rpaphp_add_slot -- declare a hotplug slot to the hotplug subsystem. + * @dn device node of slot + * + * This subroutine will register a hotplugable slot with the + * PCI hotplug infrastructure. This routine is typicaly called + * during boot time, if the hotplug slots are present at boot time, + * or is called later, by the dlpar add code, if the slot is + * being dynamically added during runtime. + * + * If the device node points at an embedded (built-in) slot, this + * routine will just return without doing anything, since embedded + * slots cannot be hotplugged. * - * rpaphp not only registers PCI hotplug slots(HOTPLUG), - * but also logical DR slots(EMBEDDED). - * HOTPLUG slot: An adapter can be physically added/removed. - * EMBEDDED slot: An adapter can be logically removed/added - * from/to a partition with the slot. + * To remove a slot, it suffices to call rpaphp_deregister_slot() */ int rpaphp_add_slot(struct device_node *dn) { @@ -299,6 +314,7 @@ int rpaphp_add_slot(struct device_node *dn) if (!dn->name || strcmp(dn->name, "pci")) return 0; + /* If this is not a hotplug slot, return without doing anything. */ if (!is_php_dn(dn, &indexes, &names, &types, &power_domains)) return 0;