aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>2006-01-25 20:04:56 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-03-23 17:35:12 -0500
commitbbe779db9f97e1c99b3c7ce1ebb26bbaecbdb2a9 (patch)
treec24d816da4873b62a4a0f29f6c39e213e5890841 /drivers
parent8abebe13f9df5b93be521eeefbf349236ddcd4eb (diff)
[PATCH] shpchp - move slot name into struct slot
This patch moves slot name area into struct slot. Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/pci/hotplug/shpchp.h2
-rw-r--r--drivers/pci/hotplug/shpchp_core.c14
2 files changed, 5 insertions, 11 deletions
diff --git a/drivers/pci/hotplug/shpchp.h b/drivers/pci/hotplug/shpchp.h
index 1e6d354fff38..dc12b0dbb9b2 100644
--- a/drivers/pci/hotplug/shpchp.h
+++ b/drivers/pci/hotplug/shpchp.h
@@ -53,6 +53,7 @@ extern int shpchp_debug;
53#define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME , ## arg) 53#define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME , ## arg)
54#define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME , ## arg) 54#define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME , ## arg)
55 55
56#define SLOT_NAME_SIZE 10
56struct slot { 57struct slot {
57 u8 bus; 58 u8 bus;
58 u8 device; 59 u8 device;
@@ -68,6 +69,7 @@ struct slot {
68 struct hpc_ops *hpc_ops; 69 struct hpc_ops *hpc_ops;
69 struct hotplug_slot *hotplug_slot; 70 struct hotplug_slot *hotplug_slot;
70 struct list_head slot_list; 71 struct list_head slot_list;
72 char name[SLOT_NAME_SIZE];
71}; 73};
72 74
73struct event_info { 75struct event_info {
diff --git a/drivers/pci/hotplug/shpchp_core.c b/drivers/pci/hotplug/shpchp_core.c
index 4161da4bf4ba..cb4ac43ea95c 100644
--- a/drivers/pci/hotplug/shpchp_core.c
+++ b/drivers/pci/hotplug/shpchp_core.c
@@ -94,12 +94,10 @@ static void release_slot(struct hotplug_slot *hotplug_slot)
94 dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); 94 dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
95 95
96 kfree(slot->hotplug_slot->info); 96 kfree(slot->hotplug_slot->info);
97 kfree(slot->hotplug_slot->name);
98 kfree(slot->hotplug_slot); 97 kfree(slot->hotplug_slot);
99 kfree(slot); 98 kfree(slot);
100} 99}
101 100
102#define SLOT_NAME_SIZE 10
103static void make_slot_name(struct slot *slot) 101static void make_slot_name(struct slot *slot)
104{ 102{
105 snprintf(slot->hotplug_slot->name, SLOT_NAME_SIZE, "%04d_%04d", 103 snprintf(slot->hotplug_slot->name, SLOT_NAME_SIZE, "%04d_%04d",
@@ -111,7 +109,6 @@ static int init_slots(struct controller *ctrl)
111 struct slot *slot; 109 struct slot *slot;
112 struct hotplug_slot *hotplug_slot; 110 struct hotplug_slot *hotplug_slot;
113 struct hotplug_slot_info *info; 111 struct hotplug_slot_info *info;
114 char *name;
115 int retval = -ENOMEM; 112 int retval = -ENOMEM;
116 int i; 113 int i;
117 u32 sun; 114 u32 sun;
@@ -131,10 +128,7 @@ static int init_slots(struct controller *ctrl)
131 goto error_hpslot; 128 goto error_hpslot;
132 hotplug_slot->info = info; 129 hotplug_slot->info = info;
133 130
134 name = kmalloc(SLOT_NAME_SIZE, GFP_KERNEL); 131 hotplug_slot->name = slot->name;
135 if (!name)
136 goto error_info;
137 hotplug_slot->name = name;
138 132
139 slot->hp_slot = i; 133 slot->hp_slot = i;
140 slot->ctrl = ctrl; 134 slot->ctrl = ctrl;
@@ -144,7 +138,7 @@ static int init_slots(struct controller *ctrl)
144 138
145 if (shpchprm_get_physical_slot_number(ctrl, &sun, 139 if (shpchprm_get_physical_slot_number(ctrl, &sun,
146 slot->bus, slot->device)) 140 slot->bus, slot->device))
147 goto error_name; 141 goto error_info;
148 142
149 slot->number = sun; 143 slot->number = sun;
150 144
@@ -165,15 +159,13 @@ static int init_slots(struct controller *ctrl)
165 retval = pci_hp_register(slot->hotplug_slot); 159 retval = pci_hp_register(slot->hotplug_slot);
166 if (retval) { 160 if (retval) {
167 err("pci_hp_register failed with error %d\n", retval); 161 err("pci_hp_register failed with error %d\n", retval);
168 goto error_name; 162 goto error_info;
169 } 163 }
170 164
171 list_add(&slot->slot_list, &ctrl->slot_list); 165 list_add(&slot->slot_list, &ctrl->slot_list);
172 } 166 }
173 167
174 return 0; 168 return 0;
175error_name:
176 kfree(name);
177error_info: 169error_info:
178 kfree(info); 170 kfree(info);
179error_hpslot: 171error_hpslot: