| .. | .. |
|---|
| 21 | 21 | /* free up the memory used by a slot */ |
|---|
| 22 | 22 | void dealloc_slot_struct(struct slot *slot) |
|---|
| 23 | 23 | { |
|---|
| 24 | | - kfree(slot->hotplug_slot->info); |
|---|
| 24 | + of_node_put(slot->dn); |
|---|
| 25 | 25 | kfree(slot->name); |
|---|
| 26 | | - kfree(slot->hotplug_slot); |
|---|
| 27 | 26 | kfree(slot); |
|---|
| 28 | 27 | } |
|---|
| 29 | 28 | |
|---|
| .. | .. |
|---|
| 35 | 34 | slot = kzalloc(sizeof(struct slot), GFP_KERNEL); |
|---|
| 36 | 35 | if (!slot) |
|---|
| 37 | 36 | goto error_nomem; |
|---|
| 38 | | - slot->hotplug_slot = kzalloc(sizeof(struct hotplug_slot), GFP_KERNEL); |
|---|
| 39 | | - if (!slot->hotplug_slot) |
|---|
| 40 | | - goto error_slot; |
|---|
| 41 | | - slot->hotplug_slot->info = kzalloc(sizeof(struct hotplug_slot_info), |
|---|
| 42 | | - GFP_KERNEL); |
|---|
| 43 | | - if (!slot->hotplug_slot->info) |
|---|
| 44 | | - goto error_hpslot; |
|---|
| 45 | 37 | slot->name = kstrdup(drc_name, GFP_KERNEL); |
|---|
| 46 | 38 | if (!slot->name) |
|---|
| 47 | | - goto error_info; |
|---|
| 48 | | - slot->dn = dn; |
|---|
| 39 | + goto error_slot; |
|---|
| 40 | + slot->dn = of_node_get(dn); |
|---|
| 49 | 41 | slot->index = drc_index; |
|---|
| 50 | 42 | slot->power_domain = power_domain; |
|---|
| 51 | | - slot->hotplug_slot->private = slot; |
|---|
| 52 | | - slot->hotplug_slot->ops = &rpaphp_hotplug_slot_ops; |
|---|
| 43 | + slot->hotplug_slot.ops = &rpaphp_hotplug_slot_ops; |
|---|
| 53 | 44 | |
|---|
| 54 | 45 | return (slot); |
|---|
| 55 | 46 | |
|---|
| 56 | | -error_info: |
|---|
| 57 | | - kfree(slot->hotplug_slot->info); |
|---|
| 58 | | -error_hpslot: |
|---|
| 59 | | - kfree(slot->hotplug_slot); |
|---|
| 60 | 47 | error_slot: |
|---|
| 61 | 48 | kfree(slot); |
|---|
| 62 | 49 | error_nomem: |
|---|
| .. | .. |
|---|
| 77 | 64 | int rpaphp_deregister_slot(struct slot *slot) |
|---|
| 78 | 65 | { |
|---|
| 79 | 66 | int retval = 0; |
|---|
| 80 | | - struct hotplug_slot *php_slot = slot->hotplug_slot; |
|---|
| 67 | + struct hotplug_slot *php_slot = &slot->hotplug_slot; |
|---|
| 81 | 68 | |
|---|
| 82 | 69 | dbg("%s - Entry: deregistering slot=%s\n", |
|---|
| 83 | 70 | __func__, slot->name); |
|---|
| .. | .. |
|---|
| 93 | 80 | |
|---|
| 94 | 81 | int rpaphp_register_slot(struct slot *slot) |
|---|
| 95 | 82 | { |
|---|
| 96 | | - struct hotplug_slot *php_slot = slot->hotplug_slot; |
|---|
| 83 | + struct hotplug_slot *php_slot = &slot->hotplug_slot; |
|---|
| 97 | 84 | struct device_node *child; |
|---|
| 98 | 85 | u32 my_index; |
|---|
| 99 | 86 | int retval; |
|---|