From: Alex Chiang <achiang@hp.com>
To: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: jbarnes@virtuousgeek.org, kristen.c.accardi@intel.com,
jpk@sgi.com, Alex Chiang <achiang@hp.com>
Subject: [PATCH v5 13/16] PCI: SGI Hotplug: stop managing bss_hotplug_slot->name
Date: Wed, 08 Oct 2008 22:47:35 -0600 [thread overview]
Message-ID: <20081009044735.8678.45392.stgit@bob.kio> (raw)
In-Reply-To: <20081009043140.8678.44164.stgit@bob.kio>
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: jbarnes@virtuousgeek.org
Cc: kristen.c.accardi@intel.com
Cc: jpk@sgi.com
Signed-off-by: Alex Chiang <achiang@hp.com>
---
drivers/pci/hotplug/sgi_hotplug.c | 19 ++++++-------------
1 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/drivers/pci/hotplug/sgi_hotplug.c b/drivers/pci/hotplug/sgi_hotplug.c
index 6d20bbd..d748698 100644
--- a/drivers/pci/hotplug/sgi_hotplug.c
+++ b/drivers/pci/hotplug/sgi_hotplug.c
@@ -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,
- struct pci_bus *pci_bus, int device)
+ struct pci_bus *pci_bus, int device,
+ char *name)
{
struct pcibus_info *pcibus_info;
struct slot *slot;
@@ -173,15 +174,9 @@ static int sn_hp_slot_private_alloc(struct hotplug_slot *bss_hotplug_slot,
return -ENOMEM;
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->pci_bus = pci_bus;
- sprintf(bss_hotplug_slot->name, "%04x:%02x:%02x",
+ sprintf(name, "%04x:%02x:%02x",
pci_domain_nr(pci_bus),
((u16)pcibus_info->pbi_buscommon.bs_persist_busnum),
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)
{
kfree(bss_hotplug_slot->info);
- kfree(bss_hotplug_slot->name);
kfree(bss_hotplug_slot->private);
kfree(bss_hotplug_slot);
}
@@ -618,6 +612,7 @@ static int sn_hotplug_slot_register(struct pci_bus *pci_bus)
int device;
struct pci_slot *pci_slot;
struct hotplug_slot *bss_hotplug_slot;
+ char name[SN_SLOT_NAME_SIZE];
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,
- pci_bus, device)) {
+ pci_bus, device, name)) {
rc = -ENOMEM;
goto alloc_err;
}
-
bss_hotplug_slot->ops = &sn_hotplug_slot_ops;
bss_hotplug_slot->release = &sn_release_slot;
- rc = pci_hp_register(bss_hotplug_slot, pci_bus, device,
- bss_hotplug_slot->name);
+ rc = pci_hp_register(bss_hotplug_slot, pci_bus, device, name);
if (rc)
goto register_err;
next prev parent reply other threads:[~2008-10-09 4:51 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-09 4:46 [PATCH v5 00/16] PCI: let the core manage slot names Alex Chiang
2008-10-09 4:46 ` [PATCH v5 01/16] PCI Hotplug core: add 'name' param pci_hp_register interface Alex Chiang
2008-10-09 4:46 ` [PATCH v5 02/16] PCI: rename pci_update_slot_number to pci_renumber_slot Alex Chiang
2008-10-09 4:46 ` [PATCH v5 03/16] PCI: update pci_create_slot() to take a 'rename' param Alex Chiang
2008-10-09 4:46 ` [PATCH v5 04/16] PCI: prevent duplicate slot names Alex Chiang
2008-10-09 5:31 ` Kenji Kaneshige
2008-10-09 5:56 ` Alex Chiang
2008-10-09 12:32 ` Kenji Kaneshige
2008-10-10 2:10 ` Alex Chiang
2008-10-10 2:11 ` Alex Chiang
2008-10-10 2:12 ` Alex Chiang
2008-10-10 4:43 ` Kenji Kaneshige
2008-10-10 5:27 ` Alex Chiang
2008-10-10 8:11 ` Kenji Kaneshige
2008-10-10 21:29 ` Alex Chiang
2008-10-09 4:46 ` [PATCH v5 05/16] PCI, PCI Hotplug: introduce slot_name helpers Alex Chiang
2008-10-09 4:47 ` [PATCH v5 06/16] PCI: acpiphp: remove 'name' parameter Alex Chiang
2008-10-09 4:47 ` [PATCH v5 07/16] PCI: cpci_hotplug: stop managing hotplug_slot->name Alex Chiang
2008-10-09 4:47 ` [PATCH v5 08/16] PCI: cpqphp: " Alex Chiang
2008-10-09 4:47 ` [PATCH v5 09/16] PCI: fakephp: remove 'name' parameter Alex Chiang
2008-10-09 4:47 ` [PATCH v5 10/16] PCI: ibmphp: stop managing hotplug_slot->name Alex Chiang
2008-10-09 4:47 ` [PATCH v5 11/16] PCI: pciehp: remove 'name' parameter Alex Chiang
2008-10-09 4:47 ` [PATCH v5 12/16] PCI: rpaphp: kmalloc/kfree slot->name directly Alex Chiang
2008-10-09 4:47 ` Alex Chiang [this message]
2008-10-09 4:47 ` [PATCH v5 14/16] PCI: shcphp: remove 'name' parameter Alex Chiang
2008-10-09 4:47 ` [PATCH v5 15/16] PCI: Hotplug core: remove 'name' Alex Chiang
2008-10-09 4:47 ` [PATCH v5 16/16] PCI Hotplug: fakephp: add duplicate slot name debugging Alex Chiang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081009044735.8678.45392.stgit@bob.kio \
--to=achiang@hp.com \
--cc=jbarnes@virtuousgeek.org \
--cc=jpk@sgi.com \
--cc=kristen.c.accardi@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox