[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>
This commit is contained in:
Kenji Kaneshige 2006-01-26 10:04:56 +09:00 committed by Greg Kroah-Hartman
parent 8abebe13f9
commit bbe779db9f
2 changed files with 5 additions and 11 deletions

View File

@ -53,6 +53,7 @@ extern int shpchp_debug;
#define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME , ## arg) #define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME , ## arg)
#define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME , ## arg) #define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME , ## arg)
#define SLOT_NAME_SIZE 10
struct slot { struct slot {
u8 bus; u8 bus;
u8 device; u8 device;
@ -68,6 +69,7 @@ struct slot {
struct hpc_ops *hpc_ops; struct hpc_ops *hpc_ops;
struct hotplug_slot *hotplug_slot; struct hotplug_slot *hotplug_slot;
struct list_head slot_list; struct list_head slot_list;
char name[SLOT_NAME_SIZE];
}; };
struct event_info { struct event_info {

View File

@ -94,12 +94,10 @@ static void release_slot(struct hotplug_slot *hotplug_slot)
dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
kfree(slot->hotplug_slot->info); kfree(slot->hotplug_slot->info);
kfree(slot->hotplug_slot->name);
kfree(slot->hotplug_slot); kfree(slot->hotplug_slot);
kfree(slot); kfree(slot);
} }
#define SLOT_NAME_SIZE 10
static void make_slot_name(struct slot *slot) static void make_slot_name(struct slot *slot)
{ {
snprintf(slot->hotplug_slot->name, SLOT_NAME_SIZE, "%04d_%04d", snprintf(slot->hotplug_slot->name, SLOT_NAME_SIZE, "%04d_%04d",
@ -111,7 +109,6 @@ static int init_slots(struct controller *ctrl)
struct slot *slot; struct slot *slot;
struct hotplug_slot *hotplug_slot; struct hotplug_slot *hotplug_slot;
struct hotplug_slot_info *info; struct hotplug_slot_info *info;
char *name;
int retval = -ENOMEM; int retval = -ENOMEM;
int i; int i;
u32 sun; u32 sun;
@ -131,10 +128,7 @@ static int init_slots(struct controller *ctrl)
goto error_hpslot; goto error_hpslot;
hotplug_slot->info = info; hotplug_slot->info = info;
name = kmalloc(SLOT_NAME_SIZE, GFP_KERNEL); hotplug_slot->name = slot->name;
if (!name)
goto error_info;
hotplug_slot->name = name;
slot->hp_slot = i; slot->hp_slot = i;
slot->ctrl = ctrl; slot->ctrl = ctrl;
@ -144,7 +138,7 @@ static int init_slots(struct controller *ctrl)
if (shpchprm_get_physical_slot_number(ctrl, &sun, if (shpchprm_get_physical_slot_number(ctrl, &sun,
slot->bus, slot->device)) slot->bus, slot->device))
goto error_name; goto error_info;
slot->number = sun; slot->number = sun;
@ -165,15 +159,13 @@ static int init_slots(struct controller *ctrl)
retval = pci_hp_register(slot->hotplug_slot); retval = pci_hp_register(slot->hotplug_slot);
if (retval) { if (retval) {
err("pci_hp_register failed with error %d\n", retval); err("pci_hp_register failed with error %d\n", retval);
goto error_name; goto error_info;
} }
list_add(&slot->slot_list, &ctrl->slot_list); list_add(&slot->slot_list, &ctrl->slot_list);
} }
return 0; return 0;
error_name:
kfree(name);
error_info: error_info:
kfree(info); kfree(info);
error_hpslot: error_hpslot: