| .. | .. |
|---|
| 49 | 49 | #define GET_STATUS(name, type) \ |
|---|
| 50 | 50 | static int get_##name(struct hotplug_slot *slot, type *value) \ |
|---|
| 51 | 51 | { \ |
|---|
| 52 | | - struct hotplug_slot_ops *ops = slot->ops; \ |
|---|
| 52 | + const struct hotplug_slot_ops *ops = slot->ops; \ |
|---|
| 53 | 53 | int retval = 0; \ |
|---|
| 54 | | - if (!try_module_get(ops->owner)) \ |
|---|
| 54 | + if (!try_module_get(slot->owner)) \ |
|---|
| 55 | 55 | return -ENODEV; \ |
|---|
| 56 | 56 | if (ops->get_##name) \ |
|---|
| 57 | 57 | retval = ops->get_##name(slot, value); \ |
|---|
| 58 | | - else \ |
|---|
| 59 | | - *value = slot->info->name; \ |
|---|
| 60 | | - module_put(ops->owner); \ |
|---|
| 58 | + module_put(slot->owner); \ |
|---|
| 61 | 59 | return retval; \ |
|---|
| 62 | 60 | } |
|---|
| 63 | 61 | |
|---|
| .. | .. |
|---|
| 90 | 88 | power = (u8)(lpower & 0xff); |
|---|
| 91 | 89 | dbg("power = %d\n", power); |
|---|
| 92 | 90 | |
|---|
| 93 | | - if (!try_module_get(slot->ops->owner)) { |
|---|
| 91 | + if (!try_module_get(slot->owner)) { |
|---|
| 94 | 92 | retval = -ENODEV; |
|---|
| 95 | 93 | goto exit; |
|---|
| 96 | 94 | } |
|---|
| .. | .. |
|---|
| 109 | 107 | err("Illegal value specified for power\n"); |
|---|
| 110 | 108 | retval = -EINVAL; |
|---|
| 111 | 109 | } |
|---|
| 112 | | - module_put(slot->ops->owner); |
|---|
| 110 | + module_put(slot->owner); |
|---|
| 113 | 111 | |
|---|
| 114 | 112 | exit: |
|---|
| 115 | 113 | if (retval) |
|---|
| .. | .. |
|---|
| 138 | 136 | static ssize_t attention_write_file(struct pci_slot *pci_slot, const char *buf, |
|---|
| 139 | 137 | size_t count) |
|---|
| 140 | 138 | { |
|---|
| 141 | | - struct hotplug_slot_ops *ops = pci_slot->hotplug->ops; |
|---|
| 139 | + struct hotplug_slot *slot = pci_slot->hotplug; |
|---|
| 140 | + const struct hotplug_slot_ops *ops = slot->ops; |
|---|
| 142 | 141 | unsigned long lattention; |
|---|
| 143 | 142 | u8 attention; |
|---|
| 144 | 143 | int retval = 0; |
|---|
| .. | .. |
|---|
| 147 | 146 | attention = (u8)(lattention & 0xff); |
|---|
| 148 | 147 | dbg(" - attention = %d\n", attention); |
|---|
| 149 | 148 | |
|---|
| 150 | | - if (!try_module_get(ops->owner)) { |
|---|
| 149 | + if (!try_module_get(slot->owner)) { |
|---|
| 151 | 150 | retval = -ENODEV; |
|---|
| 152 | 151 | goto exit; |
|---|
| 153 | 152 | } |
|---|
| 154 | 153 | if (ops->set_attention_status) |
|---|
| 155 | | - retval = ops->set_attention_status(pci_slot->hotplug, attention); |
|---|
| 156 | | - module_put(ops->owner); |
|---|
| 154 | + retval = ops->set_attention_status(slot, attention); |
|---|
| 155 | + module_put(slot->owner); |
|---|
| 157 | 156 | |
|---|
| 158 | 157 | exit: |
|---|
| 159 | 158 | if (retval) |
|---|
| .. | .. |
|---|
| 213 | 212 | test = (u32)(ltest & 0xffffffff); |
|---|
| 214 | 213 | dbg("test = %d\n", test); |
|---|
| 215 | 214 | |
|---|
| 216 | | - if (!try_module_get(slot->ops->owner)) { |
|---|
| 215 | + if (!try_module_get(slot->owner)) { |
|---|
| 217 | 216 | retval = -ENODEV; |
|---|
| 218 | 217 | goto exit; |
|---|
| 219 | 218 | } |
|---|
| 220 | 219 | if (slot->ops->hardware_test) |
|---|
| 221 | 220 | retval = slot->ops->hardware_test(slot, test); |
|---|
| 222 | | - module_put(slot->ops->owner); |
|---|
| 221 | + module_put(slot->owner); |
|---|
| 223 | 222 | |
|---|
| 224 | 223 | exit: |
|---|
| 225 | 224 | if (retval) |
|---|
| .. | .. |
|---|
| 444 | 443 | |
|---|
| 445 | 444 | if (slot == NULL) |
|---|
| 446 | 445 | return -ENODEV; |
|---|
| 447 | | - if ((slot->info == NULL) || (slot->ops == NULL)) |
|---|
| 446 | + if (slot->ops == NULL) |
|---|
| 448 | 447 | return -EINVAL; |
|---|
| 449 | 448 | |
|---|
| 450 | | - slot->ops->owner = owner; |
|---|
| 451 | | - slot->ops->mod_name = mod_name; |
|---|
| 449 | + slot->owner = owner; |
|---|
| 450 | + slot->mod_name = mod_name; |
|---|
| 452 | 451 | |
|---|
| 453 | 452 | /* |
|---|
| 454 | 453 | * No problems if we call this interface from both ACPI_PCI_SLOT |
|---|
| .. | .. |
|---|
| 558 | 557 | pci_destroy_slot(pci_slot); |
|---|
| 559 | 558 | } |
|---|
| 560 | 559 | EXPORT_SYMBOL_GPL(pci_hp_destroy); |
|---|
| 561 | | - |
|---|
| 562 | | -/** |
|---|
| 563 | | - * pci_hp_change_slot_info - changes the slot's information structure in the core |
|---|
| 564 | | - * @slot: pointer to the slot whose info has changed |
|---|
| 565 | | - * @info: pointer to the info copy into the slot's info structure |
|---|
| 566 | | - * |
|---|
| 567 | | - * @slot must have been registered with the pci |
|---|
| 568 | | - * hotplug subsystem previously with a call to pci_hp_register(). |
|---|
| 569 | | - * |
|---|
| 570 | | - * Returns 0 if successful, anything else for an error. |
|---|
| 571 | | - */ |
|---|
| 572 | | -int pci_hp_change_slot_info(struct hotplug_slot *slot, |
|---|
| 573 | | - struct hotplug_slot_info *info) |
|---|
| 574 | | -{ |
|---|
| 575 | | - if (!slot || !info) |
|---|
| 576 | | - return -ENODEV; |
|---|
| 577 | | - |
|---|
| 578 | | - memcpy(slot->info, info, sizeof(struct hotplug_slot_info)); |
|---|
| 579 | | - |
|---|
| 580 | | - return 0; |
|---|
| 581 | | -} |
|---|
| 582 | | -EXPORT_SYMBOL_GPL(pci_hp_change_slot_info); |
|---|
| 583 | 560 | |
|---|
| 584 | 561 | static int __init pci_hotplug_init(void) |
|---|
| 585 | 562 | { |
|---|