diff options
Diffstat (limited to 'drivers/pci/hotplug/pnv_php.c')
-rw-r--r-- | drivers/pci/hotplug/pnv_php.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/drivers/pci/hotplug/pnv_php.c b/drivers/pci/hotplug/pnv_php.c index 12b92a0ff688..5bb63430262e 100644 --- a/drivers/pci/hotplug/pnv_php.c +++ b/drivers/pci/hotplug/pnv_php.c | |||
@@ -328,6 +328,11 @@ out: | |||
328 | return ret; | 328 | return ret; |
329 | } | 329 | } |
330 | 330 | ||
331 | static inline struct pnv_php_slot *to_pnv_php_slot(struct hotplug_slot *slot) | ||
332 | { | ||
333 | return container_of(slot, struct pnv_php_slot, slot); | ||
334 | } | ||
335 | |||
331 | int pnv_php_set_slot_power_state(struct hotplug_slot *slot, | 336 | int pnv_php_set_slot_power_state(struct hotplug_slot *slot, |
332 | uint8_t state) | 337 | uint8_t state) |
333 | { | 338 | { |
@@ -378,7 +383,6 @@ static int pnv_php_get_power_state(struct hotplug_slot *slot, u8 *state) | |||
378 | ret); | 383 | ret); |
379 | } else { | 384 | } else { |
380 | *state = power_state; | 385 | *state = power_state; |
381 | slot->info->power_status = power_state; | ||
382 | } | 386 | } |
383 | 387 | ||
384 | return 0; | 388 | return 0; |
@@ -397,7 +401,6 @@ static int pnv_php_get_adapter_state(struct hotplug_slot *slot, u8 *state) | |||
397 | ret = pnv_pci_get_presence_state(php_slot->id, &presence); | 401 | ret = pnv_pci_get_presence_state(php_slot->id, &presence); |
398 | if (ret >= 0) { | 402 | if (ret >= 0) { |
399 | *state = presence; | 403 | *state = presence; |
400 | slot->info->adapter_status = presence; | ||
401 | ret = 0; | 404 | ret = 0; |
402 | } else { | 405 | } else { |
403 | pci_warn(php_slot->pdev, "Error %d getting presence\n", ret); | 406 | pci_warn(php_slot->pdev, "Error %d getting presence\n", ret); |
@@ -406,10 +409,20 @@ static int pnv_php_get_adapter_state(struct hotplug_slot *slot, u8 *state) | |||
406 | return ret; | 409 | return ret; |
407 | } | 410 | } |
408 | 411 | ||
412 | static int pnv_php_get_attention_state(struct hotplug_slot *slot, u8 *state) | ||
413 | { | ||
414 | struct pnv_php_slot *php_slot = to_pnv_php_slot(slot); | ||
415 | |||
416 | *state = php_slot->attention_state; | ||
417 | return 0; | ||
418 | } | ||
419 | |||
409 | static int pnv_php_set_attention_state(struct hotplug_slot *slot, u8 state) | 420 | static int pnv_php_set_attention_state(struct hotplug_slot *slot, u8 state) |
410 | { | 421 | { |
422 | struct pnv_php_slot *php_slot = to_pnv_php_slot(slot); | ||
423 | |||
411 | /* FIXME: Make it real once firmware supports it */ | 424 | /* FIXME: Make it real once firmware supports it */ |
412 | slot->info->attention_status = state; | 425 | php_slot->attention_state = state; |
413 | 426 | ||
414 | return 0; | 427 | return 0; |
415 | } | 428 | } |
@@ -501,8 +514,7 @@ scan: | |||
501 | 514 | ||
502 | static int pnv_php_enable_slot(struct hotplug_slot *slot) | 515 | static int pnv_php_enable_slot(struct hotplug_slot *slot) |
503 | { | 516 | { |
504 | struct pnv_php_slot *php_slot = container_of(slot, | 517 | struct pnv_php_slot *php_slot = to_pnv_php_slot(slot); |
505 | struct pnv_php_slot, slot); | ||
506 | 518 | ||
507 | return pnv_php_enable(php_slot, true); | 519 | return pnv_php_enable(php_slot, true); |
508 | } | 520 | } |
@@ -533,6 +545,7 @@ static int pnv_php_disable_slot(struct hotplug_slot *slot) | |||
533 | static const struct hotplug_slot_ops php_slot_ops = { | 545 | static const struct hotplug_slot_ops php_slot_ops = { |
534 | .get_power_status = pnv_php_get_power_state, | 546 | .get_power_status = pnv_php_get_power_state, |
535 | .get_adapter_status = pnv_php_get_adapter_state, | 547 | .get_adapter_status = pnv_php_get_adapter_state, |
548 | .get_attention_status = pnv_php_get_attention_state, | ||
536 | .set_attention_status = pnv_php_set_attention_state, | 549 | .set_attention_status = pnv_php_set_attention_state, |
537 | .enable_slot = pnv_php_enable_slot, | 550 | .enable_slot = pnv_php_enable_slot, |
538 | .disable_slot = pnv_php_disable_slot, | 551 | .disable_slot = pnv_php_disable_slot, |
@@ -594,7 +607,6 @@ static struct pnv_php_slot *pnv_php_alloc_slot(struct device_node *dn) | |||
594 | php_slot->id = id; | 607 | php_slot->id = id; |
595 | php_slot->power_state_check = false; | 608 | php_slot->power_state_check = false; |
596 | php_slot->slot.ops = &php_slot_ops; | 609 | php_slot->slot.ops = &php_slot_ops; |
597 | php_slot->slot.info = &php_slot->slot_info; | ||
598 | php_slot->slot.private = php_slot; | 610 | php_slot->slot.private = php_slot; |
599 | 611 | ||
600 | INIT_LIST_HEAD(&php_slot->children); | 612 | INIT_LIST_HEAD(&php_slot->children); |