forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/drivers/pci/hotplug/rpaphp_slot.c
....@@ -21,9 +21,8 @@
2121 /* free up the memory used by a slot */
2222 void dealloc_slot_struct(struct slot *slot)
2323 {
24
- kfree(slot->hotplug_slot->info);
24
+ of_node_put(slot->dn);
2525 kfree(slot->name);
26
- kfree(slot->hotplug_slot);
2726 kfree(slot);
2827 }
2928
....@@ -35,28 +34,16 @@
3534 slot = kzalloc(sizeof(struct slot), GFP_KERNEL);
3635 if (!slot)
3736 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;
4537 slot->name = kstrdup(drc_name, GFP_KERNEL);
4638 if (!slot->name)
47
- goto error_info;
48
- slot->dn = dn;
39
+ goto error_slot;
40
+ slot->dn = of_node_get(dn);
4941 slot->index = drc_index;
5042 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;
5344
5445 return (slot);
5546
56
-error_info:
57
- kfree(slot->hotplug_slot->info);
58
-error_hpslot:
59
- kfree(slot->hotplug_slot);
6047 error_slot:
6148 kfree(slot);
6249 error_nomem:
....@@ -77,7 +64,7 @@
7764 int rpaphp_deregister_slot(struct slot *slot)
7865 {
7966 int retval = 0;
80
- struct hotplug_slot *php_slot = slot->hotplug_slot;
67
+ struct hotplug_slot *php_slot = &slot->hotplug_slot;
8168
8269 dbg("%s - Entry: deregistering slot=%s\n",
8370 __func__, slot->name);
....@@ -93,7 +80,7 @@
9380
9481 int rpaphp_register_slot(struct slot *slot)
9582 {
96
- struct hotplug_slot *php_slot = slot->hotplug_slot;
83
+ struct hotplug_slot *php_slot = &slot->hotplug_slot;
9784 struct device_node *child;
9885 u32 my_index;
9986 int retval;