diff options
| -rw-r--r-- | drivers/pci/hotplug/rpaphp_core.c | 42 |
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 | */ | ||
| 265 | static int is_php_dn(struct device_node *dn, const int **indexes, | 273 | static 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 | */ |
| 291 | int rpaphp_add_slot(struct device_node *dn) | 306 | int 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 | ||
