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,
Alex Chiang <achiang@hp.com>
Subject: [PATCH v6-resend 11/17] PCI: ibmphp: stop managing hotplug_slot->name
Date: Tue, 14 Oct 2008 01:25:58 -0600 [thread overview]
Message-ID: <20081014072558.24319.6110.stgit@bob.kio> (raw)
In-Reply-To: <20081014072311.24319.27334.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.
Now, we simply advise the PCI core of the name that we would
like, and let the core take care of the rest.
Additionally, slightly rearrange the members of struct slot
so they are naturally aligned to eliminate holes.
Cc: jbarnes@virtuousgeek.org
Cc: kristen.c.accardi@intel.com
Signed-off-by: Alex Chiang <achiang@hp.com>
---
drivers/pci/hotplug/ibmphp.h | 5 ++---
drivers/pci/hotplug/ibmphp_ebda.c | 20 +++++++-------------
2 files changed, 9 insertions(+), 16 deletions(-)
diff --git a/drivers/pci/hotplug/ibmphp.h b/drivers/pci/hotplug/ibmphp.h
index 612d963..a8d391a 100644
--- a/drivers/pci/hotplug/ibmphp.h
+++ b/drivers/pci/hotplug/ibmphp.h
@@ -707,17 +707,16 @@ struct slot {
u8 device;
u8 number;
u8 real_physical_slot_num;
- char name[100];
u32 capabilities;
u8 supported_speed;
u8 supported_bus_mode;
+ u8 flag; /* this is for disable slot and polling */
+ u8 ctlr_index;
struct hotplug_slot *hotplug_slot;
struct controller *ctrl;
struct pci_func *func;
u8 irq[4];
- u8 flag; /* this is for disable slot and polling */
int bit_mode; /* 0 = 32, 1 = 64 */
- u8 ctlr_index;
struct bus_info *bus_on;
struct list_head ibm_slot_list;
u8 status;
diff --git a/drivers/pci/hotplug/ibmphp_ebda.c b/drivers/pci/hotplug/ibmphp_ebda.c
index 85528d6..402dc10 100644
--- a/drivers/pci/hotplug/ibmphp_ebda.c
+++ b/drivers/pci/hotplug/ibmphp_ebda.c
@@ -587,11 +587,14 @@ static u8 calculate_first_slot (u8 slot_num)
return first_slot + 1;
}
+
+#define SLOT_NAME_SIZE 30
+
static char *create_file_name (struct slot * slot_cur)
{
struct opt_rio *opt_vg_ptr = NULL;
struct opt_rio_lo *opt_lo_ptr = NULL;
- static char str[30];
+ static char str[SLOT_NAME_SIZE];
int which = 0; /* rxe = 1, chassis = 0 */
u8 number = 1; /* either chassis or rxe # */
u8 first_slot = 1;
@@ -703,7 +706,6 @@ static void release_slot(struct hotplug_slot *hotplug_slot)
slot = hotplug_slot->private;
kfree(slot->hotplug_slot->info);
- kfree(slot->hotplug_slot->name);
kfree(slot->hotplug_slot);
slot->ctrl = NULL;
slot->bus_on = NULL;
@@ -734,6 +736,7 @@ static int __init ebda_rsrc_controller (void)
struct bus_info *bus_info_ptr1, *bus_info_ptr2;
int rc;
struct slot *tmp_slot;
+ char name[SLOT_NAME_SIZE];
addr = hpc_list_ptr->phys_addr;
for (ctlr = 0; ctlr < hpc_list_ptr->num_ctlrs; ctlr++) {
@@ -897,12 +900,6 @@ static int __init ebda_rsrc_controller (void)
goto error_no_hp_info;
}
- hp_slot_ptr->name = kmalloc(30, GFP_KERNEL);
- if (!hp_slot_ptr->name) {
- rc = -ENOMEM;
- goto error_no_hp_name;
- }
-
tmp_slot = kzalloc(sizeof(*tmp_slot), GFP_KERNEL);
if (!tmp_slot) {
rc = -ENOMEM;
@@ -964,10 +961,9 @@ static int __init ebda_rsrc_controller (void)
} /* each hpc */
list_for_each_entry(tmp_slot, &ibmphp_slot_head, ibm_slot_list) {
- snprintf (tmp_slot->hotplug_slot->name, 30, "%s", create_file_name (tmp_slot));
+ snprintf(name, SLOT_NAME_SIZE, "%s", create_file_name(tmp_slot));
pci_hp_register(tmp_slot->hotplug_slot,
- pci_find_bus(0, tmp_slot->bus), tmp_slot->device,
- tmp_slot->hotplug_slot->name);
+ pci_find_bus(0, tmp_slot->bus), tmp_slot->device, name);
}
print_ebda_hpc ();
@@ -977,8 +973,6 @@ static int __init ebda_rsrc_controller (void)
error:
kfree (hp_slot_ptr->private);
error_no_slot:
- kfree (hp_slot_ptr->name);
-error_no_hp_name:
kfree (hp_slot_ptr->info);
error_no_hp_info:
kfree (hp_slot_ptr);
next prev parent reply other threads:[~2008-10-14 7:29 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-14 7:25 [PATCH v6-resend 00/17] PCI: let the core manage slot names Alex Chiang
2008-10-14 7:25 ` [PATCH v6-resend 01/17] PCI Hotplug core: add 'name' param pci_hp_register interface Alex Chiang
2008-10-14 7:25 ` [PATCH v6-resend 02/17] PCI: rename pci_update_slot_number to pci_renumber_slot Alex Chiang
2008-10-14 7:25 ` [PATCH v6-resend 03/17] PCI: update pci_create_slot() to take a 'hotplug' param Alex Chiang
2008-10-14 7:25 ` [PATCH v6-resend 04/17] PCI Hotplug: serialize pci_hp_register and pci_hp_deregister Alex Chiang
2008-10-14 7:25 ` [PATCH v6-resend 05/17] PCI: prevent duplicate slot names Alex Chiang
2008-10-14 7:25 ` [PATCH v6-resend 06/17] PCI, PCI Hotplug: introduce slot_name helpers Alex Chiang
2008-10-14 7:25 ` [PATCH v6-resend 07/17] PCI: acpiphp: remove 'name' parameter Alex Chiang
2008-10-14 7:25 ` [PATCH v6-resend 08/17] PCI: cpci_hotplug: stop managing hotplug_slot->name Alex Chiang
2008-10-14 7:25 ` [PATCH v6-resend 09/17] PCI: cpqphp: " Alex Chiang
2008-10-14 7:25 ` [PATCH v6-resend 10/17] PCI: fakephp: remove 'name' parameter Alex Chiang
2008-10-14 7:25 ` Alex Chiang [this message]
2008-10-14 7:26 ` [PATCH v6-resend 12/17] PCI: pciehp: " Alex Chiang
2008-10-14 7:26 ` [PATCH v6-resend 13/17] PCI: rpaphp: kmalloc/kfree slot->name directly Alex Chiang
2008-10-14 7:26 ` [PATCH v6-resend 14/17] PCI: SGI Hotplug: stop managing bss_hotplug_slot->name Alex Chiang
2008-10-14 7:26 ` [PATCH v6-resend 15/17] PCI: shcphp: remove 'name' parameter Alex Chiang
2008-10-14 7:26 ` [PATCH v6-resend 16/17] PCI: Hotplug core: remove 'name' Alex Chiang
2008-10-14 7:26 ` [PATCH v6-resend 17/17] PCI Hotplug: fakephp: add duplicate slot name debugging Alex Chiang
2008-10-15 16:50 ` [PATCH v6-resend 00/17] PCI: let the core manage slot names Kenji Kaneshige
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=20081014072558.24319.6110.stgit@bob.kio \
--to=achiang@hp.com \
--cc=jbarnes@virtuousgeek.org \
--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