PCI: SGI Hotplug: stop managing bss_hotplug_slot->name

We no longer need to manage our version of hotplug_slot->name
since the PCI and hotplug core manage it on our behalf.

Update the sn_hp_slot_private_alloc() interface to fill in
the correct name for us, as that function already has all
the parameters needed to determine the name.

Cc: kristen.c.accardi@intel.com
Cc: jpk@sgi.com
Acked-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Alex Chiang <achiang@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
This commit is contained in:
Alex Chiang 2008-10-20 17:41:48 -06:00 committed by Jesse Barnes
parent b2132fecca
commit 85234ce86d
1 changed files with 6 additions and 13 deletions

View File

@ -161,7 +161,8 @@ static int sn_pci_bus_valid(struct pci_bus *pci_bus)
} }
static int sn_hp_slot_private_alloc(struct hotplug_slot *bss_hotplug_slot, static int sn_hp_slot_private_alloc(struct hotplug_slot *bss_hotplug_slot,
struct pci_bus *pci_bus, int device) struct pci_bus *pci_bus, int device,
char *name)
{ {
struct pcibus_info *pcibus_info; struct pcibus_info *pcibus_info;
struct slot *slot; struct slot *slot;
@ -173,15 +174,9 @@ static int sn_hp_slot_private_alloc(struct hotplug_slot *bss_hotplug_slot,
return -ENOMEM; return -ENOMEM;
bss_hotplug_slot->private = slot; bss_hotplug_slot->private = slot;
bss_hotplug_slot->name = kmalloc(SN_SLOT_NAME_SIZE, GFP_KERNEL);
if (!bss_hotplug_slot->name) {
kfree(bss_hotplug_slot->private);
return -ENOMEM;
}
slot->device_num = device; slot->device_num = device;
slot->pci_bus = pci_bus; slot->pci_bus = pci_bus;
sprintf(bss_hotplug_slot->name, "%04x:%02x:%02x", sprintf(name, "%04x:%02x:%02x",
pci_domain_nr(pci_bus), pci_domain_nr(pci_bus),
((u16)pcibus_info->pbi_buscommon.bs_persist_busnum), ((u16)pcibus_info->pbi_buscommon.bs_persist_busnum),
device + 1); device + 1);
@ -608,7 +603,6 @@ static inline int get_power_status(struct hotplug_slot *bss_hotplug_slot,
static void sn_release_slot(struct hotplug_slot *bss_hotplug_slot) static void sn_release_slot(struct hotplug_slot *bss_hotplug_slot)
{ {
kfree(bss_hotplug_slot->info); kfree(bss_hotplug_slot->info);
kfree(bss_hotplug_slot->name);
kfree(bss_hotplug_slot->private); kfree(bss_hotplug_slot->private);
kfree(bss_hotplug_slot); kfree(bss_hotplug_slot);
} }
@ -618,6 +612,7 @@ static int sn_hotplug_slot_register(struct pci_bus *pci_bus)
int device; int device;
struct pci_slot *pci_slot; struct pci_slot *pci_slot;
struct hotplug_slot *bss_hotplug_slot; struct hotplug_slot *bss_hotplug_slot;
char name[SN_SLOT_NAME_SIZE];
int rc = 0; int rc = 0;
/* /*
@ -645,16 +640,14 @@ static int sn_hotplug_slot_register(struct pci_bus *pci_bus)
} }
if (sn_hp_slot_private_alloc(bss_hotplug_slot, if (sn_hp_slot_private_alloc(bss_hotplug_slot,
pci_bus, device)) { pci_bus, device, name)) {
rc = -ENOMEM; rc = -ENOMEM;
goto alloc_err; goto alloc_err;
} }
bss_hotplug_slot->ops = &sn_hotplug_slot_ops; bss_hotplug_slot->ops = &sn_hotplug_slot_ops;
bss_hotplug_slot->release = &sn_release_slot; bss_hotplug_slot->release = &sn_release_slot;
rc = pci_hp_register(bss_hotplug_slot, pci_bus, device, rc = pci_hp_register(bss_hotplug_slot, pci_bus, device, name);
bss_hotplug_slot->name);
if (rc) if (rc)
goto register_err; goto register_err;