--- /dev/null
+From 208fbec5bec1de4fce48aab41efde11ba25ab04c Mon Sep 17 00:00:00 2001
+From: Cord Walter <cord.walter@gmx.de>
+Date: Thu, 20 Nov 2008 13:46:57 +0000
+Subject: axnet_cs / pcnet_cs: moving PCMCIA_DEVICE_PROD_ID for Netgear FA411
+
+From: Cord Walter <cord.walter@gmx.de>
+
+commit 208fbec5bec1de4fce48aab41efde11ba25ab04c upstream.
+
+Hi,
+
+after noticing that my Netgear FA411 (PCMCIA-NIC) [1] stopped working with
+the release of the 2.6.25 kernel (sidux-version), I checked the
+respective driver sources and noticed that the pcnet_cs driver bailed
+out with "use axnet_cs instead" for the Netgear FA411, but axnet_cs
+doesn't claim this ID.
+
+I compiled a kernel with the PCMCIA-ID for the netgear card moved to
+axnet_cs from pcnet_cs which worked. I then contacted sidux-kernel
+maintainer Stefan Lippers-Hollmann who turned the info into this patch
+and integrated it into the kernel:
+
+<http://svn.berlios.de/svnroot/repos/fullstory/linux-sidux-2.6/trunk/debian/patches/features/2.6.27.4_PCMCIA_move-PCMCIA-ID-for-Netgear-FA411-from-pcnet_cs-to-axnet_cs.patch>
+
+This works for me and AFAIK there were no reports of any breakage for
+other devices on sidux-support.
+
+This looks like a trivial patch, but since I have very limited
+experience with kernel modifications I might be woefully wrong there.
+But if there are no side effects of this patch, is it possible to get it
+into the official kernel?
+
+I can provide more detailed information on the affected hardware if
+necessary.
+
+-cord
+
+[1]
+Socket 1 Device 0: [axnet_cs] (bus ID: 1.0)
+ Configuration: state: on
+ Product Name: NETGEAR FA411 Fast Ethernet
+ Identification: manf_id: 0x0149 card_id: 0x0411
+ function: 6 (network)
+ prod_id(1): "NETGEAR" (0x9aa79dc3)
+ prod_id(2): "FA411" (0x40fad875)
+ prod_id(3): "Fast Ethernet" (0xb4be14e3)
+ prod_id(4): --- (---)
+
+From: Stefan Lippers-Hollmann <s.l-h@gmx.de>
+Date: Sat, 1 Nov 2008 23:53:04 +0000
+Subject: PCMCIA: move PCMCIA ID for Netgear FA411 from pcnet_cs to axnet_cs:
+
+Since kernel 2.6.25, commit 61da96be07ec860e260ca4af0199b9d48d000b80
+(pcnet_cs: if AX88190-based card, printk "use axnet_cs instead" message.),
+pcnet_cs bails out with "use axnet_cs instead" for the Netgear FA411, but
+axnet_cs doesn't claim this ID.
+
+Socket 1 Device 0: [axnet_cs] (bus ID: 1.0)
+ Configuration: state: on
+ Product Name: NETGEAR FA411 Fast Ethernet
+ Identification: manf_id: 0x0149 card_id: 0x0411
+ function: 6 (network)
+ prod_id(1): "NETGEAR" (0x9aa79dc3)
+ prod_id(2): "FA411" (0x40fad875)
+ prod_id(3): "Fast Ethernet" (0xb4be14e3)
+ prod_id(4): --- (---)
+
+Signed-off-by: Stefan Lippers-Hollmann <s.l-h@gmx.de>
+Signed-off-by: Cord Walter <qord@cwalter.net>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/net/pcmcia/axnet_cs.c | 1 +
+ drivers/net/pcmcia/pcnet_cs.c | 1 -
+ 2 files changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/net/pcmcia/axnet_cs.c
++++ b/drivers/net/pcmcia/axnet_cs.c
+@@ -787,6 +787,7 @@ static struct pcmcia_device_id axnet_ids
+ PCMCIA_DEVICE_PROD_ID12("IO DATA", "ETXPCM", 0x547e66dc, 0x233adac2),
+ PCMCIA_DEVICE_PROD_ID12("Linksys", "EtherFast 10/100 PC Card (PCMPC100 V3)", 0x0733cc81, 0x232019a8),
+ PCMCIA_DEVICE_PROD_ID12("MELCO", "LPC3-TX", 0x481e0094, 0xf91af609),
++ PCMCIA_DEVICE_PROD_ID12("NETGEAR", "FA411", 0x9aa79dc3, 0x40fad875),
+ PCMCIA_DEVICE_PROD_ID12("PCMCIA", "100BASE", 0x281f1c5d, 0x7c2add04),
+ PCMCIA_DEVICE_PROD_ID12("PCMCIA", "FastEtherCard", 0x281f1c5d, 0x7ef26116),
+ PCMCIA_DEVICE_PROD_ID12("PCMCIA", "FEP501", 0x281f1c5d, 0x2e272058),
+--- a/drivers/net/pcmcia/pcnet_cs.c
++++ b/drivers/net/pcmcia/pcnet_cs.c
+@@ -1697,7 +1697,6 @@ static struct pcmcia_device_id pcnet_ids
+ PCMCIA_DEVICE_PROD_ID12("National Semiconductor", "InfoMover NE4100", 0x36e1191f, 0xa6617ec8),
+ PCMCIA_DEVICE_PROD_ID12("NEC", "PC-9801N-J12", 0x18df0ba0, 0xbc912d76),
+ PCMCIA_DEVICE_PROD_ID12("NETGEAR", "FA410TX", 0x9aa79dc3, 0x60e5bc0e),
+- PCMCIA_DEVICE_PROD_ID12("NETGEAR", "FA411", 0x9aa79dc3, 0x40fad875),
+ PCMCIA_DEVICE_PROD_ID12("Network Everywhere", "Fast Ethernet 10/100 PC Card", 0x820a67b6, 0x31ed1a5f),
+ PCMCIA_DEVICE_PROD_ID12("NextCom K.K.", "Next Hawk", 0xaedaec74, 0xad050ef1),
+ PCMCIA_DEVICE_PROD_ID12("PCMCIA", "10/100Mbps Ethernet Card", 0x281f1c5d, 0x6e41773b),
--- /dev/null
+From a266d9f1253a38ec2d5655ebcd6846298b0554f4 Mon Sep 17 00:00:00 2001
+From: Andreas Herrmann <andreas.herrmann3@amd.com>
+Date: Fri, 21 Nov 2008 14:49:25 +0100
+Subject: CPUFREQ: powernow-k8: ignore out-of-range PstateStatus value
+
+From: Andreas Herrmann <andreas.herrmann3@amd.com>
+
+commit a266d9f1253a38ec2d5655ebcd6846298b0554f4 upstream.
+
+A workaround for AMD CPU family 11h erratum 311 might cause that the
+P-state Status Register shows a "current P-state" which is larger than
+the "current P-state limit" in P-state Current Limit Register. For the
+wrong P-state value there is no ACPI _PSS object defined and
+powernow-k8/cpufreq can't determine the proper CPU frequency for that
+state.
+
+As a consequence this can cause a panic during boot (potentially with
+all recent kernel versions -- at least I have reproduced it with
+various 2.6.27 kernels and with the current .28 series), as an
+example:
+
+powernow-k8: Found 1 AMD Turion(tm)X2 Ultra DualCore Mobile ZM-82 processors (2 \
+)
+powernow-k8: 0 : pstate 0 (2200 MHz)
+powernow-k8: 1 : pstate 1 (1100 MHz)
+powernow-k8: 2 : pstate 2 (600 MHz)
+BUG: unable to handle kernel paging request at ffff88086e7528b8
+IP: [<ffffffff80486361>] cpufreq_stats_update+0x4a/0x5f
+PGD 202063 PUD 0
+Oops: 0002 [#1] SMP
+last sysfs file:
+CPU 1
+Modules linked in:
+Pid: 1, comm: swapper Not tainted 2.6.28-rc3-dirty #16
+RIP: 0010:[<ffffffff80486361>] [<ffffffff80486361>] cpufreq_stats_update+0x4a/0\
+f
+Synaptics claims to have extended capabilities, but I'm not able to read them.<6\
+6
+RAX: 0000000000000000 RBX: 0000000000000001 RCX: ffff88006e7528c0
+RDX: 00000000ffffffff RSI: ffff88006e54af00 RDI: ffffffff808f056c
+RBP: 00000000fffee697 R08: 0000000000000003 R09: ffff88006e73f080
+R10: 0000000000000001 R11: 00000000002191c0 R12: ffff88006fb83c10
+R13: 00000000ffffffff R14: 0000000000000001 R15: 0000000000000000
+FS: 0000000000000000(0000) GS:ffff88006fb50740(0000) knlGS:0000000000000000
+Unable to initialize Synaptics hardware.
+CS: 0010 DS: 0018 ES: 0018 CR0: 000000008005003b
+CR2: ffff88086e7528b8 CR3: 0000000000201000 CR4: 00000000000006e0
+DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
+DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
+Process swapper (pid: 1, threadinfo ffff88006fb82000, task ffff88006fb816d0)
+Stack:
+ ffff88006e74da50 0000000000000000 ffff88006e54af00 ffffffff804863c7
+ ffff88006e74da50 0000000000000000 00000000ffffffff 0000000000000000
+ ffff88006fb83c10 ffffffff8024b46c ffffffff808f0560 ffff88006fb83c10
+Call Trace:
+ [<ffffffff804863c7>] ? cpufreq_stat_notifier_trans+0x51/0x83
+ [<ffffffff8024b46c>] ? notifier_call_chain+0x29/0x4c
+ [<ffffffff8024b561>] ? __srcu_notifier_call_chain+0x46/0x61
+ [<ffffffff8048496d>] ? cpufreq_notify_transition+0x93/0xa9
+ [<ffffffff8021ab8d>] ? powernowk8_target+0x1e8/0x5f3
+ [<ffffffff80486687>] ? cpufreq_governor_performance+0x1b/0x20
+ [<ffffffff80484886>] ? __cpufreq_governor+0x71/0xa8
+ [<ffffffff80484b21>] ? __cpufreq_set_policy+0x101/0x13e
+ [<ffffffff80485bcd>] ? cpufreq_add_dev+0x3f0/0x4cd
+ [<ffffffff8048577a>] ? handle_update+0x0/0x8
+ [<ffffffff803c2062>] ? sysdev_driver_register+0xb6/0x10d
+ [<ffffffff8056592c>] ? powernowk8_init+0x0/0x7e
+ [<ffffffff8048604c>] ? cpufreq_register_driver+0x8f/0x140
+ [<ffffffff80209056>] ? _stext+0x56/0x14f
+ [<ffffffff802c2234>] ? proc_register+0x122/0x17d
+ [<ffffffff802c23a0>] ? create_proc_entry+0x73/0x8a
+ [<ffffffff8025c259>] ? register_irq_proc+0x92/0xaa
+ [<ffffffff8025c2c8>] ? init_irq_proc+0x57/0x69
+ [<ffffffff807fc85f>] ? kernel_init+0x116/0x169
+ [<ffffffff8020cc79>] ? child_rip+0xa/0x11
+ [<ffffffff807fc749>] ? kernel_init+0x0/0x169
+ [<ffffffff8020cc6f>] ? child_rip+0x0/0x11
+Code: 05 c5 83 36 00 48 c7 c2 48 5d 86 80 48 8b 04 d8 48 8b 40 08 48 8b 34 02 48\
+
+RIP [<ffffffff80486361>] cpufreq_stats_update+0x4a/0x5f
+ RSP <ffff88006fb83b20>
+CR2: ffff88086e7528b8
+---[ end trace 0678bac75e67a2f7 ]---
+Kernel panic - not syncing: Attempted to kill init!
+
+In short, aftereffect of the wrong P-state is that
+cpufreq_stats_update() uses "-1" as index for some array in
+
+cpufreq_stats_update (unsigned int cpu)
+{
+...
+ if (stat->time_in_state)
+ stat->time_in_state[stat->last_index] =
+ cputime64_add(stat->time_in_state[stat->last_index],
+ cputime_sub(cur_time, stat->last_time));
+...
+}
+
+Fortunately, the wrong P-state value is returned only if the core is
+in P-state 0. This fix solves the problem by detecting the
+out-of-range P-state, ignoring it, and using "0" instead.
+
+Cc: Mark Langsdorf <mark.langsdorf@amd.com>
+Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
+Signed-off-by: Dave Jones <davej@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ arch/x86/kernel/cpu/cpufreq/powernow-k8.c | 18 +++++++++++++++---
+ arch/x86/kernel/cpu/cpufreq/powernow-k8.h | 17 ++++++++++++++++-
+ 2 files changed, 31 insertions(+), 4 deletions(-)
+
+--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
++++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
+@@ -116,9 +116,20 @@ static int query_current_values_with_pen
+ u32 i = 0;
+
+ if (cpu_family == CPU_HW_PSTATE) {
+- rdmsr(MSR_PSTATE_STATUS, lo, hi);
+- i = lo & HW_PSTATE_MASK;
+- data->currpstate = i;
++ if (data->currpstate == HW_PSTATE_INVALID) {
++ /* read (initial) hw pstate if not yet set */
++ rdmsr(MSR_PSTATE_STATUS, lo, hi);
++ i = lo & HW_PSTATE_MASK;
++
++ /*
++ * a workaround for family 11h erratum 311 might cause
++ * an "out-of-range Pstate if the core is in Pstate-0
++ */
++ if (i >= data->numps)
++ data->currpstate = HW_PSTATE_0;
++ else
++ data->currpstate = i;
++ }
+ return 0;
+ }
+ do {
+@@ -1117,6 +1128,7 @@ static int __cpuinit powernowk8_cpu_init
+ }
+
+ data->cpu = pol->cpu;
++ data->currpstate = HW_PSTATE_INVALID;
+
+ if (powernow_k8_cpu_init_acpi(data)) {
+ /*
+--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.h
++++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.h
+@@ -5,6 +5,19 @@
+ * http://www.gnu.org/licenses/gpl.html
+ */
+
++
++enum pstate {
++ HW_PSTATE_INVALID = 0xff,
++ HW_PSTATE_0 = 0,
++ HW_PSTATE_1 = 1,
++ HW_PSTATE_2 = 2,
++ HW_PSTATE_3 = 3,
++ HW_PSTATE_4 = 4,
++ HW_PSTATE_5 = 5,
++ HW_PSTATE_6 = 6,
++ HW_PSTATE_7 = 7,
++};
++
+ struct powernow_k8_data {
+ unsigned int cpu;
+
+@@ -23,7 +36,9 @@ struct powernow_k8_data {
+ u32 exttype; /* extended interface = 1 */
+
+ /* keep track of the current fid / vid or pstate */
+- u32 currvid, currfid, currpstate;
++ u32 currvid;
++ u32 currfid;
++ enum pstate currpstate;
+
+ /* the powernow_table includes all frequency and vid/fid pairings:
+ * fid are the lower 8 bits of the index, vid are the upper 8 bits.
--- /dev/null
+From achiang@hp.com Tue Dec 2 16:22:39 2008
+From: Alex Chiang <achiang@hp.com>
+Date: Mon, 01 Dec 2008 13:09:39 -0700
+Subject: PCI: acpiphp: remove 'name' parameter
+To: stable@kernel.org
+Message-ID: <20081201200939.30671.76121.stgit@bob.kio>
+
+From: Alex Chiang <achiang@hp.com>
+
+commit df77cd10078e36e1b89964e5e8c206add399a98d upstream.
+
+We do not need to manage our own name parameter, especially since
+the PCI core can change it on our behalf, in the case of duplicate
+slot names.
+
+Remove 'name' from acpiphp's version of struct slot.
+
+Cc: kristen.c.accardi@intel.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>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/pci/hotplug/acpiphp.h | 9 +++++----
+ drivers/pci/hotplug/acpiphp_core.c | 31 ++++++++++++++++---------------
+ 2 files changed, 21 insertions(+), 19 deletions(-)
+
+--- a/drivers/pci/hotplug/acpiphp_core.c
++++ b/drivers/pci/hotplug/acpiphp_core.c
+@@ -44,6 +44,9 @@
+
+ #define MY_NAME "acpiphp"
+
++/* name size which is used for entries in pcihpfs */
++#define SLOT_NAME_SIZE 21 /* {_SUN} */
++
+ static int debug;
+ int acpiphp_debug;
+
+@@ -84,7 +87,6 @@ static struct hotplug_slot_ops acpi_hotp
+ .get_adapter_status = get_adapter_status,
+ };
+
+-
+ /**
+ * acpiphp_register_attention - set attention LED callback
+ * @info: must be completely filled with LED callbacks
+@@ -136,7 +138,7 @@ static int enable_slot(struct hotplug_sl
+ {
+ struct slot *slot = hotplug_slot->private;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ /* enable the specified slot */
+ return acpiphp_enable_slot(slot->acpi_slot);
+@@ -154,7 +156,7 @@ static int disable_slot(struct hotplug_s
+ struct slot *slot = hotplug_slot->private;
+ int retval;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ /* disable the specified slot */
+ retval = acpiphp_disable_slot(slot->acpi_slot);
+@@ -177,7 +179,7 @@ static int disable_slot(struct hotplug_s
+ {
+ int retval = -ENODEV;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, hotplug_slot_name(hotplug_slot));
+
+ if (attention_info && try_module_get(attention_info->owner)) {
+ retval = attention_info->set_attn(hotplug_slot, status);
+@@ -200,7 +202,7 @@ static int get_power_status(struct hotpl
+ {
+ struct slot *slot = hotplug_slot->private;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ *value = acpiphp_get_power_status(slot->acpi_slot);
+
+@@ -222,7 +224,7 @@ static int get_attention_status(struct h
+ {
+ int retval = -EINVAL;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, hotplug_slot_name(hotplug_slot));
+
+ if (attention_info && try_module_get(attention_info->owner)) {
+ retval = attention_info->get_attn(hotplug_slot, value);
+@@ -245,7 +247,7 @@ static int get_latch_status(struct hotpl
+ {
+ struct slot *slot = hotplug_slot->private;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ *value = acpiphp_get_latch_status(slot->acpi_slot);
+
+@@ -265,7 +267,7 @@ static int get_adapter_status(struct hot
+ {
+ struct slot *slot = hotplug_slot->private;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ *value = acpiphp_get_adapter_status(slot->acpi_slot);
+
+@@ -299,7 +301,7 @@ static void release_slot(struct hotplug_
+ {
+ struct slot *slot = hotplug_slot->private;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ kfree(slot->hotplug_slot);
+ kfree(slot);
+@@ -310,6 +312,7 @@ int acpiphp_register_hotplug_slot(struct
+ {
+ struct slot *slot;
+ int retval = -ENOMEM;
++ char name[SLOT_NAME_SIZE];
+
+ slot = kzalloc(sizeof(*slot), GFP_KERNEL);
+ if (!slot)
+@@ -321,8 +324,6 @@ int acpiphp_register_hotplug_slot(struct
+
+ slot->hotplug_slot->info = &slot->info;
+
+- slot->hotplug_slot->name = slot->name;
+-
+ slot->hotplug_slot->private = slot;
+ slot->hotplug_slot->release = &release_slot;
+ slot->hotplug_slot->ops = &acpi_hotplug_slot_ops;
+@@ -336,12 +337,12 @@ int acpiphp_register_hotplug_slot(struct
+ slot->hotplug_slot->info->cur_bus_speed = PCI_SPEED_UNKNOWN;
+
+ acpiphp_slot->slot = slot;
+- snprintf(slot->name, sizeof(slot->name), "%u", slot->acpi_slot->sun);
++ snprintf(name, SLOT_NAME_SIZE, "%u", slot->acpi_slot->sun);
+
+ retval = pci_hp_register(slot->hotplug_slot,
+ acpiphp_slot->bridge->pci_bus,
+ acpiphp_slot->device,
+- slot->name);
++ name);
+ if (retval == -EBUSY)
+ goto error_hpslot;
+ if (retval) {
+@@ -349,7 +350,7 @@ int acpiphp_register_hotplug_slot(struct
+ goto error_hpslot;
+ }
+
+- info("Slot [%s] registered\n", slot->hotplug_slot->name);
++ info("Slot [%s] registered\n", slot_name(slot));
+
+ return 0;
+ error_hpslot:
+@@ -366,7 +367,7 @@ void acpiphp_unregister_hotplug_slot(str
+ struct slot *slot = acpiphp_slot->slot;
+ int retval = 0;
+
+- info ("Slot [%s] unregistered\n", slot->hotplug_slot->name);
++ info("Slot [%s] unregistered\n", slot_name(slot));
+
+ retval = pci_hp_deregister(slot->hotplug_slot);
+ if (retval)
+--- a/drivers/pci/hotplug/acpiphp.h
++++ b/drivers/pci/hotplug/acpiphp.h
+@@ -50,9 +50,6 @@
+ #define info(format, arg...) printk(KERN_INFO "%s: " format, MY_NAME , ## arg)
+ #define warn(format, arg...) printk(KERN_WARNING "%s: " format, MY_NAME , ## arg)
+
+-/* name size which is used for entries in pcihpfs */
+-#define SLOT_NAME_SIZE 20 /* {_SUN} */
+-
+ struct acpiphp_bridge;
+ struct acpiphp_slot;
+
+@@ -63,9 +60,13 @@ struct slot {
+ struct hotplug_slot *hotplug_slot;
+ struct acpiphp_slot *acpi_slot;
+ struct hotplug_slot_info info;
+- char name[SLOT_NAME_SIZE];
+ };
+
++static inline const char *slot_name(struct slot *slot)
++{
++ return hotplug_slot_name(slot->hotplug_slot);
++}
++
+ /*
+ * struct acpiphp_bridge - PCI bridge information
+ *
--- /dev/null
+From achiang@hp.com Tue Dec 2 16:23:26 2008
+From: Alex Chiang <achiang@hp.com>
+Date: Mon, 01 Dec 2008 13:09:44 -0700
+Subject: PCI: cpci_hotplug: stop managing hotplug_slot->name
+To: stable@kernel.org
+Message-ID: <20081201200944.30671.50942.stgit@bob.kio>
+
+From: Alex Chiang <achiang@hp.com>
+
+commit d6c479e0b777afcd7a26ca62e122e3f878ccc830 upstream.
+
+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.
+
+Cc: kristen.c.accardi@intel.com
+Cc: scottm@somanetworks.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>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/pci/hotplug/cpci_hotplug.h | 6 ++
+ drivers/pci/hotplug/cpci_hotplug_core.c | 76 ++++++++++++--------------------
+ drivers/pci/hotplug/cpci_hotplug_pci.c | 4 -
+ 3 files changed, 37 insertions(+), 49 deletions(-)
+
+--- a/drivers/pci/hotplug/cpci_hotplug_core.c
++++ b/drivers/pci/hotplug/cpci_hotplug_core.c
+@@ -108,7 +108,7 @@ enable_slot(struct hotplug_slot *hotplug
+ struct slot *slot = hotplug_slot->private;
+ int retval = 0;
+
+- dbg("%s - physical_slot = %s", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s", __func__, slot_name(slot));
+
+ if (controller->ops->set_power)
+ retval = controller->ops->set_power(slot, 1);
+@@ -121,25 +121,23 @@ disable_slot(struct hotplug_slot *hotplu
+ struct slot *slot = hotplug_slot->private;
+ int retval = 0;
+
+- dbg("%s - physical_slot = %s", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s", __func__, slot_name(slot));
+
+ down_write(&list_rwsem);
+
+ /* Unconfigure device */
+- dbg("%s - unconfiguring slot %s",
+- __func__, slot->hotplug_slot->name);
++ dbg("%s - unconfiguring slot %s", __func__, slot_name(slot));
+ if ((retval = cpci_unconfigure_slot(slot))) {
+ err("%s - could not unconfigure slot %s",
+- __func__, slot->hotplug_slot->name);
++ __func__, slot_name(slot));
+ goto disable_error;
+ }
+- dbg("%s - finished unconfiguring slot %s",
+- __func__, slot->hotplug_slot->name);
++ dbg("%s - finished unconfiguring slot %s", __func__, slot_name(slot));
+
+ /* Clear EXT (by setting it) */
+ if (cpci_clear_ext(slot)) {
+ err("%s - could not clear EXT for slot %s",
+- __func__, slot->hotplug_slot->name);
++ __func__, slot_name(slot));
+ retval = -ENODEV;
+ goto disable_error;
+ }
+@@ -214,7 +212,6 @@ static void release_slot(struct hotplug_
+ struct slot *slot = hotplug_slot->private;
+
+ kfree(slot->hotplug_slot->info);
+- kfree(slot->hotplug_slot->name);
+ kfree(slot->hotplug_slot);
+ if (slot->dev)
+ pci_dev_put(slot->dev);
+@@ -222,12 +219,6 @@ static void release_slot(struct hotplug_
+ }
+
+ #define SLOT_NAME_SIZE 6
+-static void
+-make_slot_name(struct slot *slot)
+-{
+- snprintf(slot->hotplug_slot->name,
+- SLOT_NAME_SIZE, "%02x:%02x", slot->bus->number, slot->number);
+-}
+
+ int
+ cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last)
+@@ -235,7 +226,7 @@ cpci_hp_register_bus(struct pci_bus *bus
+ struct slot *slot;
+ struct hotplug_slot *hotplug_slot;
+ struct hotplug_slot_info *info;
+- char *name;
++ char name[SLOT_NAME_SIZE];
+ int status = -ENOMEM;
+ int i;
+
+@@ -262,35 +253,31 @@ cpci_hp_register_bus(struct pci_bus *bus
+ goto error_hpslot;
+ hotplug_slot->info = info;
+
+- name = kmalloc(SLOT_NAME_SIZE, GFP_KERNEL);
+- if (!name)
+- goto error_info;
+- hotplug_slot->name = name;
+-
+ slot->bus = bus;
+ slot->number = i;
+ slot->devfn = PCI_DEVFN(i, 0);
+
++ snprintf(name, SLOT_NAME_SIZE, "%02x:%02x", bus->number, i);
++
+ hotplug_slot->private = slot;
+ hotplug_slot->release = &release_slot;
+- make_slot_name(slot);
+ hotplug_slot->ops = &cpci_hotplug_slot_ops;
+
+ /*
+ * Initialize the slot info structure with some known
+ * good values.
+ */
+- dbg("initializing slot %s", slot->hotplug_slot->name);
++ dbg("initializing slot %s", name);
+ info->power_status = cpci_get_power_status(slot);
+ info->attention_status = cpci_get_attention_status(slot);
+
+- dbg("registering slot %s", slot->hotplug_slot->name);
+- status = pci_hp_register(slot->hotplug_slot, bus, i,
+- slot->hotplug_slot->name);
++ dbg("registering slot %s", name);
++ status = pci_hp_register(slot->hotplug_slot, bus, i, name);
+ if (status) {
+ err("pci_hp_register failed with error %d", status);
+- goto error_name;
++ goto error_info;
+ }
++ dbg("slot registered with name: %s", slot_name(slot));
+
+ /* Add slot to our internal list */
+ down_write(&list_rwsem);
+@@ -299,8 +286,6 @@ cpci_hp_register_bus(struct pci_bus *bus
+ up_write(&list_rwsem);
+ }
+ return 0;
+-error_name:
+- kfree(name);
+ error_info:
+ kfree(info);
+ error_hpslot:
+@@ -328,7 +313,7 @@ cpci_hp_unregister_bus(struct pci_bus *b
+ list_del(&slot->slot_list);
+ slots--;
+
+- dbg("deregistering slot %s", slot->hotplug_slot->name);
++ dbg("deregistering slot %s", slot_name(slot));
+ status = pci_hp_deregister(slot->hotplug_slot);
+ if (status) {
+ err("pci_hp_deregister failed with error %d",
+@@ -380,11 +365,10 @@ init_slots(int clear_ins)
+ return -1;
+ }
+ list_for_each_entry(slot, &slot_list, slot_list) {
+- dbg("%s - looking at slot %s",
+- __func__, slot->hotplug_slot->name);
++ dbg("%s - looking at slot %s", __func__, slot_name(slot));
+ if (clear_ins && cpci_check_and_clear_ins(slot))
+ dbg("%s - cleared INS for slot %s",
+- __func__, slot->hotplug_slot->name);
++ __func__, slot_name(slot));
+ dev = pci_get_slot(slot->bus, PCI_DEVFN(slot->number, 0));
+ if (dev) {
+ if (update_adapter_status(slot->hotplug_slot, 1))
+@@ -415,8 +399,7 @@ check_slots(void)
+ }
+ extracted = inserted = 0;
+ list_for_each_entry(slot, &slot_list, slot_list) {
+- dbg("%s - looking at slot %s",
+- __func__, slot->hotplug_slot->name);
++ dbg("%s - looking at slot %s", __func__, slot_name(slot));
+ if (cpci_check_and_clear_ins(slot)) {
+ /*
+ * Some broken hardware (e.g. PLX 9054AB) asserts
+@@ -424,35 +407,34 @@ check_slots(void)
+ */
+ if (slot->dev) {
+ warn("slot %s already inserted",
+- slot->hotplug_slot->name);
++ slot_name(slot));
+ inserted++;
+ continue;
+ }
+
+ /* Process insertion */
+- dbg("%s - slot %s inserted",
+- __func__, slot->hotplug_slot->name);
++ dbg("%s - slot %s inserted", __func__, slot_name(slot));
+
+ /* GSM, debug */
+ hs_csr = cpci_get_hs_csr(slot);
+ dbg("%s - slot %s HS_CSR (1) = %04x",
+- __func__, slot->hotplug_slot->name, hs_csr);
++ __func__, slot_name(slot), hs_csr);
+
+ /* Configure device */
+ dbg("%s - configuring slot %s",
+- __func__, slot->hotplug_slot->name);
++ __func__, slot_name(slot));
+ if (cpci_configure_slot(slot)) {
+ err("%s - could not configure slot %s",
+- __func__, slot->hotplug_slot->name);
++ __func__, slot_name(slot));
+ continue;
+ }
+ dbg("%s - finished configuring slot %s",
+- __func__, slot->hotplug_slot->name);
++ __func__, slot_name(slot));
+
+ /* GSM, debug */
+ hs_csr = cpci_get_hs_csr(slot);
+ dbg("%s - slot %s HS_CSR (2) = %04x",
+- __func__, slot->hotplug_slot->name, hs_csr);
++ __func__, slot_name(slot), hs_csr);
+
+ if (update_latch_status(slot->hotplug_slot, 1))
+ warn("failure to update latch file");
+@@ -465,18 +447,18 @@ check_slots(void)
+ /* GSM, debug */
+ hs_csr = cpci_get_hs_csr(slot);
+ dbg("%s - slot %s HS_CSR (3) = %04x",
+- __func__, slot->hotplug_slot->name, hs_csr);
++ __func__, slot_name(slot), hs_csr);
+
+ inserted++;
+ } else if (cpci_check_ext(slot)) {
+ /* Process extraction request */
+ dbg("%s - slot %s extracted",
+- __func__, slot->hotplug_slot->name);
++ __func__, slot_name(slot));
+
+ /* GSM, debug */
+ hs_csr = cpci_get_hs_csr(slot);
+ dbg("%s - slot %s HS_CSR = %04x",
+- __func__, slot->hotplug_slot->name, hs_csr);
++ __func__, slot_name(slot), hs_csr);
+
+ if (!slot->extracting) {
+ if (update_latch_status(slot->hotplug_slot, 0)) {
+@@ -494,7 +476,7 @@ check_slots(void)
+ * bother trying to tell the driver or not?
+ */
+ err("card in slot %s was improperly removed",
+- slot->hotplug_slot->name);
++ slot_name(slot));
+ if (update_adapter_status(slot->hotplug_slot, 0))
+ warn("failure to update adapter file");
+ slot->extracting = 0;
+--- a/drivers/pci/hotplug/cpci_hotplug.h
++++ b/drivers/pci/hotplug/cpci_hotplug.h
+@@ -30,6 +30,7 @@
+
+ #include <linux/types.h>
+ #include <linux/pci.h>
++#include <linux/pci_hotplug.h>
+
+ /* PICMG 2.1 R2.0 HS CSR bits: */
+ #define HS_CSR_INS 0x0080
+@@ -69,6 +70,11 @@ struct cpci_hp_controller {
+ struct cpci_hp_controller_ops *ops;
+ };
+
++static inline const char *slot_name(struct slot *slot)
++{
++ return hotplug_slot_name(slot->hotplug_slot);
++}
++
+ extern int cpci_hp_register_controller(struct cpci_hp_controller *controller);
+ extern int cpci_hp_unregister_controller(struct cpci_hp_controller *controller);
+ extern int cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last);
+--- a/drivers/pci/hotplug/cpci_hotplug_pci.c
++++ b/drivers/pci/hotplug/cpci_hotplug_pci.c
+@@ -209,7 +209,7 @@ int cpci_led_on(struct slot* slot)
+ hs_cap + 2,
+ hs_csr)) {
+ err("Could not set LOO for slot %s",
+- slot->hotplug_slot->name);
++ hotplug_slot_name(slot->hotplug_slot));
+ return -ENODEV;
+ }
+ }
+@@ -238,7 +238,7 @@ int cpci_led_off(struct slot* slot)
+ hs_cap + 2,
+ hs_csr)) {
+ err("Could not clear LOO for slot %s",
+- slot->hotplug_slot->name);
++ hotplug_slot_name(slot->hotplug_slot));
+ return -ENODEV;
+ }
+ }
--- /dev/null
+From achiang@hp.com Tue Dec 2 16:23:50 2008
+From: Alex Chiang <achiang@hp.com>
+Date: Mon, 01 Dec 2008 13:09:49 -0700
+Subject: PCI: cpqphp: stop managing hotplug_slot->name
+To: stable@kernel.org
+Message-ID: <20081201200949.30671.81449.stgit@bob.kio>
+
+From: Alex Chiang <achiang@hp.com>
+
+commit 30ac7acd05d1449ac784de144c4b5237be25b0b4 upstream.
+
+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.
+
+Cc: jbarnes@virtuousgeek.org
+Cc: kristen.c.accardi@intel.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>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/pci/hotplug/cpqphp.h | 13 ++++-------
+ drivers/pci/hotplug/cpqphp_core.c | 42 +++++++++++++++++---------------------
+ 2 files changed, 24 insertions(+), 31 deletions(-)
+
+--- a/drivers/pci/hotplug/cpqphp_core.c
++++ b/drivers/pci/hotplug/cpqphp_core.c
+@@ -315,14 +315,15 @@ static void release_slot(struct hotplug_
+ {
+ struct slot *slot = hotplug_slot->private;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ kfree(slot->hotplug_slot->info);
+- kfree(slot->hotplug_slot->name);
+ kfree(slot->hotplug_slot);
+ kfree(slot);
+ }
+
++#define SLOT_NAME_SIZE 10
++
+ static int ctrl_slot_setup(struct controller *ctrl,
+ void __iomem *smbios_start,
+ void __iomem *smbios_table)
+@@ -335,6 +336,7 @@ static int ctrl_slot_setup(struct contro
+ u8 slot_number;
+ u8 ctrl_slot;
+ u32 tempdword;
++ char name[SLOT_NAME_SIZE];
+ void __iomem *slot_entry= NULL;
+ int result = -ENOMEM;
+
+@@ -363,16 +365,12 @@ static int ctrl_slot_setup(struct contro
+ if (!hotplug_slot->info)
+ goto error_hpslot;
+ hotplug_slot_info = hotplug_slot->info;
+- hotplug_slot->name = kmalloc(SLOT_NAME_SIZE, GFP_KERNEL);
+-
+- if (!hotplug_slot->name)
+- goto error_info;
+
+ slot->ctrl = ctrl;
+ slot->bus = ctrl->bus;
+ slot->device = slot_device;
+ slot->number = slot_number;
+- dbg("slot->number = %d\n", slot->number);
++ dbg("slot->number = %u\n", slot->number);
+
+ slot_entry = get_SMBIOS_entry(smbios_start, smbios_table, 9,
+ slot_entry);
+@@ -418,9 +416,9 @@ static int ctrl_slot_setup(struct contro
+ /* register this slot with the hotplug pci core */
+ hotplug_slot->release = &release_slot;
+ hotplug_slot->private = slot;
+- make_slot_name(hotplug_slot->name, SLOT_NAME_SIZE, slot);
++ snprintf(name, SLOT_NAME_SIZE, "%u", slot->number);
+ hotplug_slot->ops = &cpqphp_hotplug_slot_ops;
+-
++
+ hotplug_slot_info->power_status = get_slot_enabled(ctrl, slot);
+ hotplug_slot_info->attention_status =
+ cpq_get_attention_status(ctrl, slot);
+@@ -437,10 +435,10 @@ static int ctrl_slot_setup(struct contro
+ result = pci_hp_register(hotplug_slot,
+ ctrl->pci_dev->bus,
+ slot->device,
+- hotplug_slot->name);
++ name);
+ if (result) {
+ err("pci_hp_register failed with error %d\n", result);
+- goto error_name;
++ goto error_info;
+ }
+
+ slot->next = ctrl->slot;
+@@ -452,8 +450,6 @@ static int ctrl_slot_setup(struct contro
+ }
+
+ return 0;
+-error_name:
+- kfree(hotplug_slot->name);
+ error_info:
+ kfree(hotplug_slot_info);
+ error_hpslot:
+@@ -639,7 +635,7 @@ static int set_attention_status (struct
+ u8 device;
+ u8 function;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ if (cpqhp_get_bus_dev(ctrl, &bus, &devfn, slot->number) == -1)
+ return -ENODEV;
+@@ -666,7 +662,7 @@ static int process_SI(struct hotplug_slo
+ u8 device;
+ u8 function;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ if (cpqhp_get_bus_dev(ctrl, &bus, &devfn, slot->number) == -1)
+ return -ENODEV;
+@@ -698,7 +694,7 @@ static int process_SS(struct hotplug_slo
+ u8 device;
+ u8 function;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ if (cpqhp_get_bus_dev(ctrl, &bus, &devfn, slot->number) == -1)
+ return -ENODEV;
+@@ -721,7 +717,7 @@ static int hardware_test(struct hotplug_
+ struct slot *slot = hotplug_slot->private;
+ struct controller *ctrl = slot->ctrl;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ return cpqhp_hardware_test(ctrl, value);
+ }
+@@ -732,7 +728,7 @@ static int get_power_status(struct hotpl
+ struct slot *slot = hotplug_slot->private;
+ struct controller *ctrl = slot->ctrl;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ *value = get_slot_enabled(ctrl, slot);
+ return 0;
+@@ -743,7 +739,7 @@ static int get_attention_status(struct h
+ struct slot *slot = hotplug_slot->private;
+ struct controller *ctrl = slot->ctrl;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ *value = cpq_get_attention_status(ctrl, slot);
+ return 0;
+@@ -754,7 +750,7 @@ static int get_latch_status(struct hotpl
+ struct slot *slot = hotplug_slot->private;
+ struct controller *ctrl = slot->ctrl;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ *value = cpq_get_latch_status(ctrl, slot);
+
+@@ -766,7 +762,7 @@ static int get_adapter_status(struct hot
+ struct slot *slot = hotplug_slot->private;
+ struct controller *ctrl = slot->ctrl;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ *value = get_presence_status(ctrl, slot);
+
+@@ -778,7 +774,7 @@ static int get_max_bus_speed (struct hot
+ struct slot *slot = hotplug_slot->private;
+ struct controller *ctrl = slot->ctrl;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ *value = ctrl->speed_capability;
+
+@@ -790,7 +786,7 @@ static int get_cur_bus_speed (struct hot
+ struct slot *slot = hotplug_slot->private;
+ struct controller *ctrl = slot->ctrl;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ *value = ctrl->speed;
+
+--- a/drivers/pci/hotplug/cpqphp.h
++++ b/drivers/pci/hotplug/cpqphp.h
+@@ -449,6 +449,11 @@ extern u8 cpqhp_disk_irq;
+
+ /* inline functions */
+
++static inline char *slot_name(struct slot *slot)
++{
++ return hotplug_slot_name(slot->hotplug_slot);
++}
++
+ /*
+ * return_resource
+ *
+@@ -696,14 +701,6 @@ static inline int get_presence_status(st
+ return presence_save;
+ }
+
+-#define SLOT_NAME_SIZE 10
+-
+-static inline void make_slot_name(char *buffer, int buffer_size, struct slot *slot)
+-{
+- snprintf(buffer, buffer_size, "%d", slot->number);
+-}
+-
+-
+ static inline int wait_for_ctrl_irq(struct controller *ctrl)
+ {
+ DECLARE_WAITQUEUE(wait, current);
--- /dev/null
+From achiang@hp.com Tue Dec 2 16:24:15 2008
+From: Alex Chiang <achiang@hp.com>
+Date: Mon, 01 Dec 2008 13:09:54 -0700
+Subject: PCI: fakephp: remove 'name' parameter
+To: stable@kernel.org
+Message-ID: <20081201200954.30671.41467.stgit@bob.kio>
+
+From: Alex Chiang <achiang@hp.com>
+
+commit 43caae884b5a5e2eacb4879225341cb49700e129 upstream.
+
+Remove 'name' from fakephp's struct dummy_slot, as the PCI core
+will now manage our slot name for us.
+
+Cc: kristen.c.accardi@intel.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>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/pci/hotplug/fakephp.c | 19 ++++++++++---------
+ 1 file changed, 10 insertions(+), 9 deletions(-)
+
+--- a/drivers/pci/hotplug/fakephp.c
++++ b/drivers/pci/hotplug/fakephp.c
+@@ -66,7 +66,6 @@ struct dummy_slot {
+ struct pci_dev *dev;
+ struct work_struct remove_work;
+ unsigned long removed;
+- char name[8];
+ };
+
+ static int debug;
+@@ -96,10 +95,13 @@ static void dummy_release(struct hotplug
+ kfree(dslot);
+ }
+
++#define SLOT_NAME_SIZE 8
++
+ static int add_slot(struct pci_dev *dev)
+ {
+ struct dummy_slot *dslot;
+ struct hotplug_slot *slot;
++ char name[SLOT_NAME_SIZE];
+ int retval = -ENOMEM;
+ static int count = 1;
+
+@@ -119,20 +121,18 @@ static int add_slot(struct pci_dev *dev)
+ if (!dslot)
+ goto error_info;
+
+- slot->name = dslot->name;
+- snprintf(slot->name, sizeof(dslot->name), "fake%d", count++);
+- dbg("slot->name = %s\n", slot->name);
++ snprintf(name, SLOT_NAME_SIZE, "fake%d", count++);
+ slot->ops = &dummy_hotplug_slot_ops;
+ slot->release = &dummy_release;
+ slot->private = dslot;
+
+- retval = pci_hp_register(slot, dev->bus, PCI_SLOT(dev->devfn),
+- slot->name);
++ retval = pci_hp_register(slot, dev->bus, PCI_SLOT(dev->devfn), name);
+ if (retval) {
+ err("pci_hp_register failed with error %d\n", retval);
+ goto error_dslot;
+ }
+
++ dbg("slot->name = %s\n", hotplug_slot_name(slot));
+ dslot->slot = slot;
+ dslot->dev = pci_dev_get(dev);
+ list_add (&dslot->node, &slot_list);
+@@ -168,10 +168,11 @@ static void remove_slot(struct dummy_slo
+ {
+ int retval;
+
+- dbg("removing slot %s\n", dslot->slot->name);
++ dbg("removing slot %s\n", hotplug_slot_name(dslot->slot));
+ retval = pci_hp_deregister(dslot->slot);
+ if (retval)
+- err("Problem unregistering a slot %s\n", dslot->slot->name);
++ err("Problem unregistering a slot %s\n",
++ hotplug_slot_name(dslot->slot));
+ }
+
+ /* called from the single-threaded workqueue handler to remove a slot */
+@@ -309,7 +310,7 @@ static int disable_slot(struct hotplug_s
+ return -ENODEV;
+ dslot = slot->private;
+
+- dbg("%s - physical_slot = %s\n", __func__, slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, hotplug_slot_name(slot));
+
+ for (func = 7; func >= 0; func--) {
+ dev = pci_get_slot(dslot->dev->bus, dslot->dev->devfn + func);
--- /dev/null
+From achiang@hp.com Tue Dec 2 16:19:49 2008
+From: Alex Chiang <achiang@hp.com>
+Date: Mon, 01 Dec 2008 13:09:14 -0700
+Subject: PCI Hotplug core: add 'name' param pci_hp_register interface
+To: stable@kernel.org
+Message-ID: <20081201200914.30671.31648.stgit@bob.kio>
+
+From: Alex Chiang <achiang@hp.com>
+
+commit 1359f2701b96abd9bb69c1273fb995a093b6409a upstream.
+
+Update pci_hp_register() to take a const char *name parameter.
+
+The motivation for this is to clean up the individual hotplug
+drivers so that each one does not have to manage its own name.
+The PCI core should be the place where we manage the name.
+
+We update the interface and all callsites first, in a
+"no functional change" manner, and clean up the drivers later.
+
+Cc: kristen.c.accardi@intel.com
+Acked-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
+Reviewed-by: Matthew Wilcox <willy@linux.intel.com>
+Signed-off-by: Alex Chiang <achiang@hp.com>
+Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/pci/hotplug/acpiphp_core.c | 3 ++-
+ drivers/pci/hotplug/cpci_hotplug_core.c | 3 ++-
+ drivers/pci/hotplug/cpqphp_core.c | 3 ++-
+ drivers/pci/hotplug/fakephp.c | 3 ++-
+ drivers/pci/hotplug/ibmphp_ebda.c | 3 ++-
+ drivers/pci/hotplug/pci_hotplug_core.c | 15 ++++++++-------
+ drivers/pci/hotplug/pciehp_core.c | 3 ++-
+ drivers/pci/hotplug/rpaphp_slot.c | 2 +-
+ drivers/pci/hotplug/sgi_hotplug.c | 3 ++-
+ drivers/pci/hotplug/shpchp_core.c | 3 ++-
+ include/linux/pci_hotplug.h | 3 ++-
+ 11 files changed, 27 insertions(+), 17 deletions(-)
+
+--- a/drivers/pci/hotplug/acpiphp_core.c
++++ b/drivers/pci/hotplug/acpiphp_core.c
+@@ -340,7 +340,8 @@ int acpiphp_register_hotplug_slot(struct
+
+ retval = pci_hp_register(slot->hotplug_slot,
+ acpiphp_slot->bridge->pci_bus,
+- acpiphp_slot->device);
++ acpiphp_slot->device,
++ slot->name);
+ if (retval == -EBUSY)
+ goto error_hpslot;
+ if (retval) {
+--- a/drivers/pci/hotplug/cpci_hotplug_core.c
++++ b/drivers/pci/hotplug/cpci_hotplug_core.c
+@@ -285,7 +285,8 @@ cpci_hp_register_bus(struct pci_bus *bus
+ info->attention_status = cpci_get_attention_status(slot);
+
+ dbg("registering slot %s", slot->hotplug_slot->name);
+- status = pci_hp_register(slot->hotplug_slot, bus, i);
++ status = pci_hp_register(slot->hotplug_slot, bus, i,
++ slot->hotplug_slot->name);
+ if (status) {
+ err("pci_hp_register failed with error %d", status);
+ goto error_name;
+--- a/drivers/pci/hotplug/cpqphp_core.c
++++ b/drivers/pci/hotplug/cpqphp_core.c
+@@ -436,7 +436,8 @@ static int ctrl_slot_setup(struct contro
+ slot_number);
+ result = pci_hp_register(hotplug_slot,
+ ctrl->pci_dev->bus,
+- slot->device);
++ slot->device,
++ hotplug_slot->name);
+ if (result) {
+ err("pci_hp_register failed with error %d\n", result);
+ goto error_name;
+--- a/drivers/pci/hotplug/fakephp.c
++++ b/drivers/pci/hotplug/fakephp.c
+@@ -126,7 +126,8 @@ static int add_slot(struct pci_dev *dev)
+ slot->release = &dummy_release;
+ slot->private = dslot;
+
+- retval = pci_hp_register(slot, dev->bus, PCI_SLOT(dev->devfn));
++ retval = pci_hp_register(slot, dev->bus, PCI_SLOT(dev->devfn),
++ slot->name);
+ if (retval) {
+ err("pci_hp_register failed with error %d\n", retval);
+ goto error_dslot;
+--- a/drivers/pci/hotplug/ibmphp_ebda.c
++++ b/drivers/pci/hotplug/ibmphp_ebda.c
+@@ -1002,7 +1002,8 @@ static int __init ebda_rsrc_controller (
+
+ snprintf (tmp_slot->hotplug_slot->name, 30, "%s", create_file_name (tmp_slot));
+ pci_hp_register(tmp_slot->hotplug_slot,
+- pci_find_bus(0, tmp_slot->bus), tmp_slot->device);
++ pci_find_bus(0, tmp_slot->bus), tmp_slot->device,
++ tmp_slot->hotplug_slot->name);
+ }
+
+ print_ebda_hpc ();
+--- a/drivers/pci/hotplug/pciehp_core.c
++++ b/drivers/pci/hotplug/pciehp_core.c
+@@ -221,7 +221,8 @@ static int init_slots(struct controller
+ duplicate_name:
+ retval = pci_hp_register(hotplug_slot,
+ ctrl->pci_dev->subordinate,
+- slot->device);
++ slot->device,
++ slot->name);
+ if (retval) {
+ /*
+ * If slot N already exists, we'll try to create
+--- a/drivers/pci/hotplug/pci_hotplug_core.c
++++ b/drivers/pci/hotplug/pci_hotplug_core.c
+@@ -547,13 +547,15 @@ out:
+ * @bus: bus this slot is on
+ * @slot: pointer to the &struct hotplug_slot to register
+ * @slot_nr: slot number
++ * @name: name registered with kobject core
+ *
+ * Registers a hotplug slot with the pci hotplug subsystem, which will allow
+ * userspace interaction to the slot.
+ *
+ * Returns 0 if successful, anything else for an error.
+ */
+-int pci_hp_register(struct hotplug_slot *slot, struct pci_bus *bus, int slot_nr)
++int pci_hp_register(struct hotplug_slot *slot, struct pci_bus *bus, int slot_nr,
++ const char *name)
+ {
+ int result;
+ struct pci_slot *pci_slot;
+@@ -569,7 +571,7 @@ int pci_hp_register(struct hotplug_slot
+ }
+
+ /* Check if we have already registered a slot with the same name. */
+- if (get_slot_from_name(slot->name))
++ if (get_slot_from_name(name))
+ return -EEXIST;
+
+ /*
+@@ -577,7 +579,7 @@ int pci_hp_register(struct hotplug_slot
+ * driver and call it here again. If we've already created the
+ * pci_slot, the interface will simply bump the refcount.
+ */
+- pci_slot = pci_create_slot(bus, slot_nr, slot->name);
++ pci_slot = pci_create_slot(bus, slot_nr, name);
+ if (IS_ERR(pci_slot))
+ return PTR_ERR(pci_slot);
+
+@@ -593,8 +595,8 @@ int pci_hp_register(struct hotplug_slot
+ /*
+ * Allow pcihp drivers to override the ACPI_PCI_SLOT name.
+ */
+- if (strcmp(kobject_name(&pci_slot->kobj), slot->name)) {
+- result = kobject_rename(&pci_slot->kobj, slot->name);
++ if (strcmp(kobject_name(&pci_slot->kobj), name)) {
++ result = kobject_rename(&pci_slot->kobj, name);
+ if (result) {
+ pci_destroy_slot(pci_slot);
+ return result;
+@@ -607,8 +609,7 @@ int pci_hp_register(struct hotplug_slot
+
+ result = fs_add_slot(pci_slot);
+ kobject_uevent(&pci_slot->kobj, KOBJ_ADD);
+- dbg("Added slot %s to the list\n", slot->name);
+-
++ dbg("Added slot %s to the list\n", name);
+
+ return result;
+ }
+--- a/drivers/pci/hotplug/rpaphp_slot.c
++++ b/drivers/pci/hotplug/rpaphp_slot.c
+@@ -137,7 +137,7 @@ int rpaphp_register_slot(struct slot *sl
+ slotno = PCI_SLOT(PCI_DN(slot->dn->child)->devfn);
+ else
+ slotno = -1;
+- retval = pci_hp_register(php_slot, slot->bus, slotno);
++ retval = pci_hp_register(php_slot, slot->bus, slotno, slot->name);
+ if (retval) {
+ err("pci_hp_register failed with error %d\n", retval);
+ return retval;
+--- a/drivers/pci/hotplug/sgi_hotplug.c
++++ b/drivers/pci/hotplug/sgi_hotplug.c
+@@ -653,7 +653,8 @@ static int sn_hotplug_slot_register(stru
+ 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);
++ rc = pci_hp_register(bss_hotplug_slot, pci_bus, device,
++ bss_hotplug_slot->name);
+ if (rc)
+ goto register_err;
+
+--- a/drivers/pci/hotplug/shpchp_core.c
++++ b/drivers/pci/hotplug/shpchp_core.c
+@@ -146,7 +146,8 @@ static int init_slots(struct controller
+ slot->hp_slot, slot->number, ctrl->slot_device_offset);
+ duplicate_name:
+ retval = pci_hp_register(slot->hotplug_slot,
+- ctrl->pci_dev->subordinate, slot->device);
++ ctrl->pci_dev->subordinate, slot->device,
++ hotplug_slot->name);
+ if (retval) {
+ /*
+ * If slot N already exists, we'll try to create
+--- a/include/linux/pci_hotplug.h
++++ b/include/linux/pci_hotplug.h
+@@ -165,7 +165,8 @@ struct hotplug_slot {
+ };
+ #define to_hotplug_slot(n) container_of(n, struct hotplug_slot, kobj)
+
+-extern int pci_hp_register(struct hotplug_slot *, struct pci_bus *, int nr);
++extern int pci_hp_register(struct hotplug_slot *, struct pci_bus *, int nr,
++ const char *name);
+ extern int pci_hp_deregister(struct hotplug_slot *slot);
+ extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot,
+ struct hotplug_slot_info *info);
--- /dev/null
+From achiang@hp.com Tue Dec 2 16:26:35 2008
+From: Alex Chiang <achiang@hp.com>
+Date: Mon, 01 Dec 2008 13:10:25 -0700
+Subject: PCI: Hotplug core: remove 'name'
+To: stable@kernel.org
+Message-ID: <20081201201025.30671.51735.stgit@bob.kio>
+
+From: Alex Chiang <achiang@hp.com>
+
+commit 58319b802a614f10f1b5238fbde7a4b2e9a60069 upstream.
+
+Now that the PCI core manages the 'name' for each individual
+hotplug driver, and all drivers (except rpaphp) have been converted
+to use hotplug_slot_name(), there is no need for the PCI hotplug
+core to drag around its own copy of name either.
+
+Cc: kristen.c.accardi@intel.com
+Cc: matthew@wil.cx
+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>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/pci/hotplug/pci_hotplug_core.c | 6 +++---
+ include/linux/pci_hotplug.h | 3 ---
+ 2 files changed, 3 insertions(+), 6 deletions(-)
+
+--- a/drivers/pci/hotplug/pci_hotplug_core.c
++++ b/drivers/pci/hotplug/pci_hotplug_core.c
+@@ -533,7 +533,7 @@ static struct hotplug_slot *get_slot_fro
+
+ list_for_each (tmp, &pci_hotplug_slot_list) {
+ slot = list_entry (tmp, struct hotplug_slot, slot_list);
+- if (strcmp(slot->name, name) == 0)
++ if (strcmp(hotplug_slot_name(slot), name) == 0)
+ return slot;
+ }
+ return NULL;
+@@ -611,7 +611,7 @@ int pci_hp_deregister(struct hotplug_slo
+ return -ENODEV;
+
+ mutex_lock(&pci_hp_mutex);
+- temp = get_slot_from_name(hotplug->name);
++ temp = get_slot_from_name(hotplug_slot_name(hotplug));
+ if (temp != hotplug) {
+ mutex_unlock(&pci_hp_mutex);
+ return -ENODEV;
+@@ -621,7 +621,7 @@ int pci_hp_deregister(struct hotplug_slo
+
+ slot = hotplug->pci_slot;
+ fs_remove_slot(slot);
+- dbg("Removed slot %s from the list\n", hotplug->name);
++ dbg("Removed slot %s from the list\n", hotplug_slot_name(hotplug));
+
+ hotplug->release(hotplug);
+ slot->hotplug = NULL;
+--- a/include/linux/pci_hotplug.h
++++ b/include/linux/pci_hotplug.h
+@@ -142,8 +142,6 @@ struct hotplug_slot_info {
+
+ /**
+ * struct hotplug_slot - used to register a physical slot with the hotplug pci core
+- * @name: the name of the slot being registered. This string must
+- * be unique amoung slots registered on this system.
+ * @ops: pointer to the &struct hotplug_slot_ops to be used for this slot
+ * @info: pointer to the &struct hotplug_slot_info for the initial values for
+ * this slot.
+@@ -153,7 +151,6 @@ struct hotplug_slot_info {
+ * needs.
+ */
+ struct hotplug_slot {
+- char *name;
+ struct hotplug_slot_ops *ops;
+ struct hotplug_slot_info *info;
+ void (*release) (struct hotplug_slot *slot);
--- /dev/null
+From achiang@hp.com Tue Dec 2 16:21:01 2008
+From: Alex Chiang <achiang@hp.com>
+Date: Mon, 01 Dec 2008 13:09:24 -0700
+Subject: PCI Hotplug: serialize pci_hp_register and pci_hp_deregister
+To: stable@kernel.org
+Message-ID: <20081201200924.30671.63454.stgit@bob.kio>
+
+
+From: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
+
+commit 95cb9093960b6249fdbe7417bf513a1358aaa51a upstream.
+
+Convert the pci_hotplug_slot_list_lock, which only protected the
+list of hotplug slots, to a pci_hp_mutex which now protects both
+interfaces.
+
+Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
+Signed-off-by: Alex Chiang <achiang@hp.com>
+Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/pci/hotplug/pci_hotplug_core.c | 51 ++++++++++++++++++---------------
+ 1 file changed, 28 insertions(+), 23 deletions(-)
+
+--- a/drivers/pci/hotplug/pci_hotplug_core.c
++++ b/drivers/pci/hotplug/pci_hotplug_core.c
+@@ -37,6 +37,7 @@
+ #include <linux/init.h>
+ #include <linux/mount.h>
+ #include <linux/namei.h>
++#include <linux/mutex.h>
+ #include <linux/pci.h>
+ #include <linux/pci_hotplug.h>
+ #include <asm/uaccess.h>
+@@ -61,7 +62,7 @@ static int debug;
+ //////////////////////////////////////////////////////////////////
+
+ static LIST_HEAD(pci_hotplug_slot_list);
+-static DEFINE_SPINLOCK(pci_hotplug_slot_list_lock);
++static DEFINE_MUTEX(pci_hp_mutex);
+
+ /* these strings match up with the values in pci_bus_speed */
+ static char *pci_bus_speed_strings[] = {
+@@ -530,16 +531,12 @@ static struct hotplug_slot *get_slot_fro
+ struct hotplug_slot *slot;
+ struct list_head *tmp;
+
+- spin_lock(&pci_hotplug_slot_list_lock);
+ list_for_each (tmp, &pci_hotplug_slot_list) {
+ slot = list_entry (tmp, struct hotplug_slot, slot_list);
+ if (strcmp(slot->name, name) == 0)
+- goto out;
++ return slot;
+ }
+- slot = NULL;
+-out:
+- spin_unlock(&pci_hotplug_slot_list_lock);
+- return slot;
++ return NULL;
+ }
+
+ /**
+@@ -570,9 +567,13 @@ int pci_hp_register(struct hotplug_slot
+ return -EINVAL;
+ }
+
++ mutex_lock(&pci_hp_mutex);
++
+ /* Check if we have already registered a slot with the same name. */
+- if (get_slot_from_name(name))
+- return -EEXIST;
++ if (get_slot_from_name(name)) {
++ result = -EEXIST;
++ goto out;
++ }
+
+ /*
+ * No problems if we call this interface from both ACPI_PCI_SLOT
+@@ -580,13 +581,15 @@ int pci_hp_register(struct hotplug_slot
+ * pci_slot, the interface will simply bump the refcount.
+ */
+ pci_slot = pci_create_slot(bus, slot_nr, name, slot);
+- if (IS_ERR(pci_slot))
+- return PTR_ERR(pci_slot);
++ if (IS_ERR(pci_slot)) {
++ result = PTR_ERR(pci_slot);
++ goto cleanup;
++ }
+
+ if (pci_slot->hotplug) {
+ dbg("%s: already claimed\n", __func__);
+- pci_destroy_slot(pci_slot);
+- return -EBUSY;
++ result = -EBUSY;
++ goto cleanup;
+ }
+
+ slot->pci_slot = pci_slot;
+@@ -597,21 +600,21 @@ int pci_hp_register(struct hotplug_slot
+ */
+ if (strcmp(kobject_name(&pci_slot->kobj), name)) {
+ result = kobject_rename(&pci_slot->kobj, name);
+- if (result) {
+- pci_destroy_slot(pci_slot);
+- return result;
+- }
++ if (result)
++ goto cleanup;
+ }
+
+- spin_lock(&pci_hotplug_slot_list_lock);
+ list_add(&slot->slot_list, &pci_hotplug_slot_list);
+- spin_unlock(&pci_hotplug_slot_list_lock);
+
+ result = fs_add_slot(pci_slot);
+ kobject_uevent(&pci_slot->kobj, KOBJ_ADD);
+ dbg("Added slot %s to the list\n", name);
+-
++out:
++ mutex_unlock(&pci_hp_mutex);
+ return result;
++cleanup:
++ pci_destroy_slot(pci_slot);
++ goto out;
+ }
+
+ /**
+@@ -631,13 +634,14 @@ int pci_hp_deregister(struct hotplug_slo
+ if (!hotplug)
+ return -ENODEV;
+
++ mutex_lock(&pci_hp_mutex);
+ temp = get_slot_from_name(hotplug->name);
+- if (temp != hotplug)
++ if (temp != hotplug) {
++ mutex_unlock(&pci_hp_mutex);
+ return -ENODEV;
++ }
+
+- spin_lock(&pci_hotplug_slot_list_lock);
+ list_del(&hotplug->slot_list);
+- spin_unlock(&pci_hotplug_slot_list_lock);
+
+ slot = hotplug->pci_slot;
+ fs_remove_slot(slot);
+@@ -646,6 +650,7 @@ int pci_hp_deregister(struct hotplug_slo
+ hotplug->release(hotplug);
+ slot->hotplug = NULL;
+ pci_destroy_slot(slot);
++ mutex_unlock(&pci_hp_mutex);
+
+ return 0;
+ }
--- /dev/null
+From achiang@hp.com Tue Dec 2 16:24:45 2008
+From: Alex Chiang <achiang@hp.com>
+Date: Mon, 01 Dec 2008 13:09:59 -0700
+Subject: PCI: ibmphp: stop managing hotplug_slot->name
+To: stable@kernel.org
+Message-ID: <20081201200959.30671.14971.stgit@bob.kio>
+
+From: Alex Chiang <achiang@hp.com>
+
+commit a32615a1a661f83661e8a26c3bc7763f716da8f3 upstream.
+
+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: kristen.c.accardi@intel.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>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/pci/hotplug/ibmphp.h | 5 ++---
+ drivers/pci/hotplug/ibmphp_ebda.c | 20 +++++++-------------
+ 2 files changed, 9 insertions(+), 16 deletions(-)
+
+--- a/drivers/pci/hotplug/ibmphp_ebda.c
++++ b/drivers/pci/hotplug/ibmphp_ebda.c
+@@ -620,11 +620,14 @@ static u8 calculate_first_slot (u8 slot_
+ 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;
+@@ -736,7 +739,6 @@ static void release_slot(struct hotplug_
+
+ 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;
+@@ -768,6 +770,7 @@ static int __init ebda_rsrc_controller (
+ int rc;
+ struct slot *tmp_slot;
+ struct list_head *list;
++ char name[SLOT_NAME_SIZE];
+
+ addr = hpc_list_ptr->phys_addr;
+ for (ctlr = 0; ctlr < hpc_list_ptr->num_ctlrs; ctlr++) {
+@@ -931,12 +934,6 @@ static int __init ebda_rsrc_controller (
+ 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;
+@@ -1000,10 +997,9 @@ static int __init ebda_rsrc_controller (
+ list_for_each (list, &ibmphp_slot_head) {
+ tmp_slot = list_entry (list, struct slot, 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 ();
+@@ -1013,8 +1009,6 @@ static int __init ebda_rsrc_controller (
+ 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);
+--- 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;
--- /dev/null
+From achiang@hp.com Tue Dec 2 16:22:14 2008
+From: Alex Chiang <achiang@hp.com>
+Date: Mon, 01 Dec 2008 13:09:34 -0700
+Subject: PCI, PCI Hotplug: introduce slot_name helpers
+To: stable@kernel.org
+Message-ID: <20081201200934.30671.94659.stgit@bob.kio>
+
+From: Alex Chiang <achiang@hp.com>
+
+commit 0ad772ec464d3fcf9d210836b97e654f393606c4 upstream
+
+In preparation for cleaning up the various hotplug drivers
+such that they don't have to manage their own 'name' parameters
+anymore, we provide the following convenience functions:
+
+ pci_slot_name()
+ hotplug_slot_name()
+
+These helpers will be used by individual hotplug drivers.
+
+Cc: kristen.c.accardi@intel.com
+Cc: matthew@wil.cx
+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>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/pci/slot.c | 2 +-
+ include/linux/pci.h | 5 +++++
+ include/linux/pci_hotplug.h | 5 +++++
+ 3 files changed, 11 insertions(+), 1 deletion(-)
+
+--- a/drivers/pci/slot.c
++++ b/drivers/pci/slot.c
+@@ -116,7 +116,7 @@ static int rename_slot(struct pci_slot *
+ int result = 0;
+ char *slot_name;
+
+- if (strcmp(kobject_name(&slot->kobj), name) == 0)
++ if (strcmp(pci_slot_name(slot), name) == 0)
+ return result;
+
+ slot_name = make_slot_name(name);
+--- a/include/linux/pci.h
++++ b/include/linux/pci.h
+@@ -64,6 +64,11 @@ struct pci_slot {
+ struct kobject kobj;
+ };
+
++static inline const char *pci_slot_name(const struct pci_slot *slot)
++{
++ return kobject_name(&slot->kobj);
++}
++
+ /* File state for mmap()s on /proc/bus/pci/X/Y */
+ enum pci_mmap_state {
+ pci_mmap_io,
+--- a/include/linux/pci_hotplug.h
++++ b/include/linux/pci_hotplug.h
+@@ -165,6 +165,11 @@ struct hotplug_slot {
+ };
+ #define to_hotplug_slot(n) container_of(n, struct hotplug_slot, kobj)
+
++static inline const char *hotplug_slot_name(const struct hotplug_slot *slot)
++{
++ return pci_slot_name(slot->pci_slot);
++}
++
+ extern int pci_hp_register(struct hotplug_slot *, struct pci_bus *, int nr,
+ const char *name);
+ extern int pci_hp_deregister(struct hotplug_slot *slot);
--- /dev/null
+From achiang@hp.com Tue Dec 2 16:25:08 2008
+From: Alex Chiang <achiang@hp.com>
+Date: Mon, 01 Dec 2008 13:10:05 -0700
+Subject: PCI: pciehp: remove 'name' parameter
+To: stable@kernel.org
+Message-ID: <20081201201004.30671.96432.stgit@bob.kio>
+
+From: Alex Chiang <achiang@hp.com>
+
+commit e1acb24f059defdaa0264e925f19cc21b0a3e592 upstream.
+
+We do not need to manage our own name parameter, especially since
+the PCI core can change it on our behalf, in the case of duplicate
+slot names.
+
+Remove 'name' from pciehp's version of struct slot, and remove
+unused 'task_list' as well.
+
+Cc: kristen.c.accardi@intel.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>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/pci/hotplug/pciehp.h | 9 ++++---
+ drivers/pci/hotplug/pciehp_core.c | 34 ++++++++++++++------------
+ drivers/pci/hotplug/pciehp_ctrl.c | 48 +++++++++++++++++++-------------------
+ drivers/pci/hotplug/pciehp_hpc.c | 1
+ 4 files changed, 48 insertions(+), 44 deletions(-)
+
+--- a/drivers/pci/hotplug/pciehp_core.c
++++ b/drivers/pci/hotplug/pciehp_core.c
+@@ -180,7 +180,8 @@ static struct hotplug_slot_attribute hot
+ */
+ static void release_slot(struct hotplug_slot *hotplug_slot)
+ {
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__,
++ hotplug_slot_name(hotplug_slot));
+
+ kfree(hotplug_slot->info);
+ kfree(hotplug_slot);
+@@ -191,6 +192,7 @@ static int init_slots(struct controller
+ struct slot *slot;
+ struct hotplug_slot *hotplug_slot;
+ struct hotplug_slot_info *info;
++ char name[SLOT_NAME_SIZE];
+ int retval = -ENOMEM;
+
+ list_for_each_entry(slot, &ctrl->slot_list, slot_list) {
+@@ -204,15 +206,11 @@ static int init_slots(struct controller
+
+ /* register this slot with the hotplug pci core */
+ hotplug_slot->info = info;
+- hotplug_slot->name = slot->name;
+ hotplug_slot->private = slot;
+ hotplug_slot->release = &release_slot;
+ hotplug_slot->ops = &pciehp_hotplug_slot_ops;
+- get_power_status(hotplug_slot, &info->power_status);
+- get_attention_status(hotplug_slot, &info->attention_status);
+- get_latch_status(hotplug_slot, &info->latch_status);
+- get_adapter_status(hotplug_slot, &info->adapter_status);
+ slot->hotplug_slot = hotplug_slot;
++ snprintf(name, SLOT_NAME_SIZE, "%u", slot->number);
+
+ dbg("Registering bus=%x dev=%x hp_slot=%x sun=%x "
+ "slot_device_offset=%x\n", slot->bus, slot->device,
+@@ -220,11 +218,15 @@ static int init_slots(struct controller
+ retval = pci_hp_register(hotplug_slot,
+ ctrl->pci_dev->subordinate,
+ slot->device,
+- slot->name);
++ name);
+ if (retval) {
+ err("pci_hp_register failed with error %d\n", retval);
+ goto error_info;
+ }
++ get_power_status(hotplug_slot, &info->power_status);
++ get_attention_status(hotplug_slot, &info->attention_status);
++ get_latch_status(hotplug_slot, &info->latch_status);
++ get_adapter_status(hotplug_slot, &info->adapter_status);
+ /* create additional sysfs entries */
+ if (EMI(ctrl)) {
+ retval = sysfs_create_file(&hotplug_slot->pci_slot->kobj,
+@@ -265,7 +267,7 @@ static int set_attention_status(struct h
+ {
+ struct slot *slot = hotplug_slot->private;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ hotplug_slot->info->attention_status = status;
+
+@@ -280,7 +282,7 @@ static int enable_slot(struct hotplug_sl
+ {
+ struct slot *slot = hotplug_slot->private;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ return pciehp_sysfs_enable_slot(slot);
+ }
+@@ -290,7 +292,7 @@ static int disable_slot(struct hotplug_s
+ {
+ struct slot *slot = hotplug_slot->private;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ return pciehp_sysfs_disable_slot(slot);
+ }
+@@ -300,7 +302,7 @@ static int get_power_status(struct hotpl
+ struct slot *slot = hotplug_slot->private;
+ int retval;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ retval = slot->hpc_ops->get_power_status(slot, value);
+ if (retval < 0)
+@@ -314,7 +316,7 @@ static int get_attention_status(struct h
+ struct slot *slot = hotplug_slot->private;
+ int retval;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ retval = slot->hpc_ops->get_attention_status(slot, value);
+ if (retval < 0)
+@@ -328,7 +330,7 @@ static int get_latch_status(struct hotpl
+ struct slot *slot = hotplug_slot->private;
+ int retval;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ retval = slot->hpc_ops->get_latch_status(slot, value);
+ if (retval < 0)
+@@ -342,7 +344,7 @@ static int get_adapter_status(struct hot
+ struct slot *slot = hotplug_slot->private;
+ int retval;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ retval = slot->hpc_ops->get_adapter_status(slot, value);
+ if (retval < 0)
+@@ -357,7 +359,7 @@ static int get_max_bus_speed(struct hotp
+ struct slot *slot = hotplug_slot->private;
+ int retval;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ retval = slot->hpc_ops->get_max_bus_speed(slot, value);
+ if (retval < 0)
+@@ -371,7 +373,7 @@ static int get_cur_bus_speed(struct hotp
+ struct slot *slot = hotplug_slot->private;
+ int retval;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ retval = slot->hpc_ops->get_cur_bus_speed(slot, value);
+ if (retval < 0)
+--- a/drivers/pci/hotplug/pciehp_ctrl.c
++++ b/drivers/pci/hotplug/pciehp_ctrl.c
+@@ -65,7 +65,7 @@ u8 pciehp_handle_attention_button(struct
+ /*
+ * Button pressed - See if need to TAKE ACTION!!!
+ */
+- info("Button pressed on Slot(%s)\n", p_slot->name);
++ info("Button pressed on Slot(%s)\n", slot_name(p_slot));
+ event_type = INT_BUTTON_PRESS;
+
+ queue_interrupt_event(p_slot, event_type);
+@@ -86,13 +86,13 @@ u8 pciehp_handle_switch_change(struct sl
+ /*
+ * Switch opened
+ */
+- info("Latch open on Slot(%s)\n", p_slot->name);
++ info("Latch open on Slot(%s)\n", slot_name(p_slot));
+ event_type = INT_SWITCH_OPEN;
+ } else {
+ /*
+ * Switch closed
+ */
+- info("Latch close on Slot(%s)\n", p_slot->name);
++ info("Latch close on Slot(%s)\n", slot_name(p_slot));
+ event_type = INT_SWITCH_CLOSE;
+ }
+
+@@ -117,13 +117,13 @@ u8 pciehp_handle_presence_change(struct
+ /*
+ * Card Present
+ */
+- info("Card present on Slot(%s)\n", p_slot->name);
++ info("Card present on Slot(%s)\n", slot_name(p_slot));
+ event_type = INT_PRESENCE_ON;
+ } else {
+ /*
+ * Not Present
+ */
+- info("Card not present on Slot(%s)\n", p_slot->name);
++ info("Card not present on Slot(%s)\n", slot_name(p_slot));
+ event_type = INT_PRESENCE_OFF;
+ }
+
+@@ -143,13 +143,13 @@ u8 pciehp_handle_power_fault(struct slot
+ /*
+ * power fault Cleared
+ */
+- info("Power fault cleared on Slot(%s)\n", p_slot->name);
++ info("Power fault cleared on Slot(%s)\n", slot_name(p_slot));
+ event_type = INT_POWER_FAULT_CLEAR;
+ } else {
+ /*
+ * power fault
+ */
+- info("Power fault on Slot(%s)\n", p_slot->name);
++ info("Power fault on Slot(%s)\n", slot_name(p_slot));
+ event_type = INT_POWER_FAULT;
+ info("power fault bit %x set\n", 0);
+ }
+@@ -404,11 +404,11 @@ static void handle_button_press_event(st
+ if (getstatus) {
+ p_slot->state = BLINKINGOFF_STATE;
+ info("PCI slot #%s - powering off due to button "
+- "press.\n", p_slot->name);
++ "press.\n", slot_name(p_slot));
+ } else {
+ p_slot->state = BLINKINGON_STATE;
+ info("PCI slot #%s - powering on due to button "
+- "press.\n", p_slot->name);
++ "press.\n", slot_name(p_slot));
+ }
+ /* blink green LED and turn off amber */
+ if (PWR_LED(ctrl))
+@@ -425,7 +425,7 @@ static void handle_button_press_event(st
+ * press the attention again before the 5 sec. limit
+ * expires to cancel hot-add or hot-remove
+ */
+- info("Button cancel on Slot(%s)\n", p_slot->name);
++ info("Button cancel on Slot(%s)\n", slot_name(p_slot));
+ dbg("%s: button cancel\n", __func__);
+ cancel_delayed_work(&p_slot->work);
+ if (p_slot->state == BLINKINGOFF_STATE) {
+@@ -438,7 +438,7 @@ static void handle_button_press_event(st
+ if (ATTN_LED(ctrl))
+ p_slot->hpc_ops->set_attention_status(p_slot, 0);
+ info("PCI slot #%s - action canceled due to button press\n",
+- p_slot->name);
++ slot_name(p_slot));
+ p_slot->state = STATIC_STATE;
+ break;
+ case POWEROFF_STATE:
+@@ -448,7 +448,7 @@ static void handle_button_press_event(st
+ * this means that the previous attention button action
+ * to hot-add or hot-remove is undergoing
+ */
+- info("Button ignore on Slot(%s)\n", p_slot->name);
++ info("Button ignore on Slot(%s)\n", slot_name(p_slot));
+ update_slot_info(p_slot);
+ break;
+ default:
+@@ -529,7 +529,7 @@ int pciehp_enable_slot(struct slot *p_sl
+ rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus);
+ if (rc || !getstatus) {
+ info("%s: no adapter on slot(%s)\n", __func__,
+- p_slot->name);
++ slot_name(p_slot));
+ mutex_unlock(&p_slot->ctrl->crit_sect);
+ return -ENODEV;
+ }
+@@ -537,7 +537,7 @@ int pciehp_enable_slot(struct slot *p_sl
+ rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
+ if (rc || getstatus) {
+ info("%s: latch open on slot(%s)\n", __func__,
+- p_slot->name);
++ slot_name(p_slot));
+ mutex_unlock(&p_slot->ctrl->crit_sect);
+ return -ENODEV;
+ }
+@@ -547,7 +547,7 @@ int pciehp_enable_slot(struct slot *p_sl
+ rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
+ if (rc || getstatus) {
+ info("%s: already enabled on slot(%s)\n", __func__,
+- p_slot->name);
++ slot_name(p_slot));
+ mutex_unlock(&p_slot->ctrl->crit_sect);
+ return -EINVAL;
+ }
+@@ -582,7 +582,7 @@ int pciehp_disable_slot(struct slot *p_s
+ ret = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus);
+ if (ret || !getstatus) {
+ info("%s: no adapter on slot(%s)\n", __func__,
+- p_slot->name);
++ slot_name(p_slot));
+ mutex_unlock(&p_slot->ctrl->crit_sect);
+ return -ENODEV;
+ }
+@@ -592,7 +592,7 @@ int pciehp_disable_slot(struct slot *p_s
+ ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
+ if (ret || getstatus) {
+ info("%s: latch open on slot(%s)\n", __func__,
+- p_slot->name);
++ slot_name(p_slot));
+ mutex_unlock(&p_slot->ctrl->crit_sect);
+ return -ENODEV;
+ }
+@@ -602,7 +602,7 @@ int pciehp_disable_slot(struct slot *p_s
+ ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
+ if (ret || !getstatus) {
+ info("%s: already disabled slot(%s)\n", __func__,
+- p_slot->name);
++ slot_name(p_slot));
+ mutex_unlock(&p_slot->ctrl->crit_sect);
+ return -EINVAL;
+ }
+@@ -632,14 +632,14 @@ int pciehp_sysfs_enable_slot(struct slot
+ break;
+ case POWERON_STATE:
+ info("Slot %s is already in powering on state\n",
+- p_slot->name);
++ slot_name(p_slot));
+ break;
+ case BLINKINGOFF_STATE:
+ case POWEROFF_STATE:
+- info("Already enabled on slot %s\n", p_slot->name);
++ info("Already enabled on slot %s\n", slot_name(p_slot));
+ break;
+ default:
+- err("Not a valid state on slot %s\n", p_slot->name);
++ err("Not a valid state on slot %s\n", slot_name(p_slot));
+ break;
+ }
+ mutex_unlock(&p_slot->lock);
+@@ -664,14 +664,14 @@ int pciehp_sysfs_disable_slot(struct slo
+ break;
+ case POWEROFF_STATE:
+ info("Slot %s is already in powering off state\n",
+- p_slot->name);
++ slot_name(p_slot));
+ break;
+ case BLINKINGON_STATE:
+ case POWERON_STATE:
+- info("Already disabled on slot %s\n", p_slot->name);
++ info("Already disabled on slot %s\n", slot_name(p_slot));
+ break;
+ default:
+- err("Not a valid state on slot %s\n", p_slot->name);
++ err("Not a valid state on slot %s\n", slot_name(p_slot));
+ break;
+ }
+ mutex_unlock(&p_slot->lock);
+--- a/drivers/pci/hotplug/pciehp.h
++++ b/drivers/pci/hotplug/pciehp.h
+@@ -61,15 +61,13 @@ extern struct workqueue_struct *pciehp_w
+ struct slot {
+ u8 bus;
+ u8 device;
+- u32 number;
+ u8 state;
+- struct timer_list task_event;
+ u8 hp_slot;
++ u32 number;
+ struct controller *ctrl;
+ struct hpc_ops *hpc_ops;
+ struct hotplug_slot *hotplug_slot;
+ struct list_head slot_list;
+- char name[SLOT_NAME_SIZE];
+ unsigned long last_emi_toggle;
+ struct delayed_work work; /* work for button event */
+ struct mutex lock;
+@@ -161,6 +159,11 @@ int pciehp_enable_slot(struct slot *p_sl
+ int pciehp_disable_slot(struct slot *p_slot);
+ int pcie_enable_notification(struct controller *ctrl);
+
++static inline const char *slot_name(struct slot *slot)
++{
++ return hotplug_slot_name(slot->hotplug_slot);
++}
++
+ static inline struct slot *pciehp_find_slot(struct controller *ctrl, u8 device)
+ {
+ struct slot *slot;
+--- a/drivers/pci/hotplug/pciehp_hpc.c
++++ b/drivers/pci/hotplug/pciehp_hpc.c
+@@ -1044,7 +1044,6 @@ static int pcie_init_slot(struct control
+ slot->device = ctrl->slot_device_offset + slot->hp_slot;
+ slot->hpc_ops = ctrl->hpc_ops;
+ slot->number = ctrl->first_slot;
+- snprintf(slot->name, SLOT_NAME_SIZE, "%d", slot->number);
+ mutex_init(&slot->lock);
+ INIT_DELAYED_WORK(&slot->work, pciehp_queue_pushbutton_work);
+ list_add(&slot->slot_list, &ctrl->slot_list);
--- /dev/null
+From achiang@hp.com Tue Dec 2 16:21:37 2008
+From: Alex Chiang <achiang@hp.com>
+Date: Mon, 01 Dec 2008 13:09:29 -0700
+Subject: PCI: prevent duplicate slot names
+To: stable@kernel.org
+Message-ID: <20081201200929.30671.86433.stgit@bob.kio>
+
+From: Alex Chiang <achiang@hp.com>
+
+commit 5fe6cc60680d29740b85278e17a002fa27b7e642 upstream.
+
+Prevent callers of pci_create_slot() from registering slots with
+duplicate names. This condition occurs most often when PCI hotplug
+drivers are loaded on platforms with broken firmware that assigns
+identical names to multiple slots.
+
+We now rename these duplicate slots on behalf of the user.
+
+If firmware assigns the name N to multiple slots, then:
+
+The first registered slot is assigned N
+The second registered slot is assigned N-1
+The third registered slot is assigned N-2
+etc.
+
+This is the permanent fix mentioned in earlier commits d6a9e9b4 and
+167e782e (shpchp/pciehp: Rename duplicate slot name...).
+
+We take advantage of the new 'hotplug' parameter in pci_create_slot()
+to prevent a slot create/rename race between hotplug drivers and
+detection drivers.
+
+ Scenario A:
+ hotplug driver detection driver
+ -------------- ----------------
+ pci_create_slot(hotplug=set)
+ pci_create_slot(hotplug=NULL)
+
+The hotplug driver creates the slot with its desired name, and then
+releases the semaphore. Now, the detection driver tries to create
+the same slot, but it already exists. We don't care about renaming,
+so return the existing slot.
+
+ Scenario B:
+ hotplug driver detection driver
+ -------------- ----------------
+ pci_create_slot(hotplug=NULL)
+ pci_create_slot(hotplug=set)
+
+The detection driver creates the slot with name "X". Then the hotplug
+driver tries to create the same slot, but wants the name "Y" instead.
+We detect that we're trying to create the same slot and that we also
+want a rename, so rename the slot to "Y" and return.
+
+ Scenario C:
+ hotplug driver hotplug driver
+ -------------- ----------------
+ pci_create_slot(hotplug=set)
+ pci_create_slot(hotplug=set)
+
+Two separate hotplug drivers are attempting to claim the slot and
+are passing valid hotplug_slot args to pci_create_slot(). We detect
+that the slot already has a ->hotplug callback, prevent a rename,
+and return -EBUSY.
+
+Cc: jbarnes@virtuousgeek.org
+Cc: kristen.c.accardi@intel.com
+Cc: matthew@wil.cx
+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>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/pci/hotplug/pci_hotplug_core.c | 26 ------
+ drivers/pci/hotplug/pciehp_core.c | 14 ---
+ drivers/pci/hotplug/shpchp_core.c | 15 ---
+ drivers/pci/slot.c | 139 ++++++++++++++++++++++++++-------
+ 4 files changed, 114 insertions(+), 80 deletions(-)
+
+--- a/drivers/pci/hotplug/pciehp_core.c
++++ b/drivers/pci/hotplug/pciehp_core.c
+@@ -191,7 +191,6 @@ static int init_slots(struct controller
+ struct slot *slot;
+ struct hotplug_slot *hotplug_slot;
+ struct hotplug_slot_info *info;
+- int len, dup = 1;
+ int retval = -ENOMEM;
+
+ list_for_each_entry(slot, &ctrl->slot_list, slot_list) {
+@@ -218,24 +217,11 @@ static int init_slots(struct controller
+ dbg("Registering bus=%x dev=%x hp_slot=%x sun=%x "
+ "slot_device_offset=%x\n", slot->bus, slot->device,
+ slot->hp_slot, slot->number, ctrl->slot_device_offset);
+-duplicate_name:
+ retval = pci_hp_register(hotplug_slot,
+ ctrl->pci_dev->subordinate,
+ slot->device,
+ slot->name);
+ if (retval) {
+- /*
+- * If slot N already exists, we'll try to create
+- * slot N-1, N-2 ... N-M, until we overflow.
+- */
+- if (retval == -EEXIST) {
+- len = snprintf(slot->name, SLOT_NAME_SIZE,
+- "%d-%d", slot->number, dup++);
+- if (len < SLOT_NAME_SIZE)
+- goto duplicate_name;
+- else
+- err("duplicate slot name overflow\n");
+- }
+ err("pci_hp_register failed with error %d\n", retval);
+ goto error_info;
+ }
+--- a/drivers/pci/hotplug/pci_hotplug_core.c
++++ b/drivers/pci/hotplug/pci_hotplug_core.c
+@@ -569,12 +569,6 @@ int pci_hp_register(struct hotplug_slot
+
+ mutex_lock(&pci_hp_mutex);
+
+- /* Check if we have already registered a slot with the same name. */
+- if (get_slot_from_name(name)) {
+- result = -EEXIST;
+- goto out;
+- }
+-
+ /*
+ * No problems if we call this interface from both ACPI_PCI_SLOT
+ * driver and call it here again. If we've already created the
+@@ -583,27 +577,12 @@ int pci_hp_register(struct hotplug_slot
+ pci_slot = pci_create_slot(bus, slot_nr, name, slot);
+ if (IS_ERR(pci_slot)) {
+ result = PTR_ERR(pci_slot);
+- goto cleanup;
+- }
+-
+- if (pci_slot->hotplug) {
+- dbg("%s: already claimed\n", __func__);
+- result = -EBUSY;
+- goto cleanup;
++ goto out;
+ }
+
+ slot->pci_slot = pci_slot;
+ pci_slot->hotplug = slot;
+
+- /*
+- * Allow pcihp drivers to override the ACPI_PCI_SLOT name.
+- */
+- if (strcmp(kobject_name(&pci_slot->kobj), name)) {
+- result = kobject_rename(&pci_slot->kobj, name);
+- if (result)
+- goto cleanup;
+- }
+-
+ list_add(&slot->slot_list, &pci_hotplug_slot_list);
+
+ result = fs_add_slot(pci_slot);
+@@ -612,9 +591,6 @@ int pci_hp_register(struct hotplug_slot
+ out:
+ mutex_unlock(&pci_hp_mutex);
+ return result;
+-cleanup:
+- pci_destroy_slot(pci_slot);
+- goto out;
+ }
+
+ /**
+--- a/drivers/pci/hotplug/shpchp_core.c
++++ b/drivers/pci/hotplug/shpchp_core.c
+@@ -102,7 +102,7 @@ static int init_slots(struct controller
+ struct hotplug_slot *hotplug_slot;
+ struct hotplug_slot_info *info;
+ int retval = -ENOMEM;
+- int i, len, dup = 1;
++ int i;
+
+ for (i = 0; i < ctrl->num_slots; i++) {
+ slot = kzalloc(sizeof(*slot), GFP_KERNEL);
+@@ -144,23 +144,10 @@ static int init_slots(struct controller
+ dbg("Registering bus=%x dev=%x hp_slot=%x sun=%x "
+ "slot_device_offset=%x\n", slot->bus, slot->device,
+ slot->hp_slot, slot->number, ctrl->slot_device_offset);
+-duplicate_name:
+ retval = pci_hp_register(slot->hotplug_slot,
+ ctrl->pci_dev->subordinate, slot->device,
+ hotplug_slot->name);
+ if (retval) {
+- /*
+- * If slot N already exists, we'll try to create
+- * slot N-1, N-2 ... N-M, until we overflow.
+- */
+- if (retval == -EEXIST) {
+- len = snprintf(slot->name, SLOT_NAME_SIZE,
+- "%d-%d", slot->number, dup++);
+- if (len < SLOT_NAME_SIZE)
+- goto duplicate_name;
+- else
+- err("duplicate slot name overflow\n");
+- }
+ err("pci_hp_register failed with error %d\n", retval);
+ goto error_info;
+ }
+--- a/drivers/pci/slot.c
++++ b/drivers/pci/slot.c
+@@ -73,6 +73,77 @@ static struct kobj_type pci_slot_ktype =
+ .default_attrs = pci_slot_default_attrs,
+ };
+
++static char *make_slot_name(const char *name)
++{
++ char *new_name;
++ int len, max, dup;
++
++ new_name = kstrdup(name, GFP_KERNEL);
++ if (!new_name)
++ return NULL;
++
++ /*
++ * Make sure we hit the realloc case the first time through the
++ * loop. 'len' will be strlen(name) + 3 at that point which is
++ * enough space for "name-X" and the trailing NUL.
++ */
++ len = strlen(name) + 2;
++ max = 1;
++ dup = 1;
++
++ for (;;) {
++ struct kobject *dup_slot;
++ dup_slot = kset_find_obj(pci_slots_kset, new_name);
++ if (!dup_slot)
++ break;
++ kobject_put(dup_slot);
++ if (dup == max) {
++ len++;
++ max *= 10;
++ kfree(new_name);
++ new_name = kmalloc(len, GFP_KERNEL);
++ if (!new_name)
++ break;
++ }
++ sprintf(new_name, "%s-%d", name, dup++);
++ }
++
++ return new_name;
++}
++
++static int rename_slot(struct pci_slot *slot, const char *name)
++{
++ int result = 0;
++ char *slot_name;
++
++ if (strcmp(kobject_name(&slot->kobj), name) == 0)
++ return result;
++
++ slot_name = make_slot_name(name);
++ if (!slot_name)
++ return -ENOMEM;
++
++ result = kobject_rename(&slot->kobj, slot_name);
++ kfree(slot_name);
++
++ return result;
++}
++
++static struct pci_slot *get_slot(struct pci_bus *parent, int slot_nr)
++{
++ struct pci_slot *slot;
++ /*
++ * We already hold pci_bus_sem so don't worry
++ */
++ list_for_each_entry(slot, &parent->slots, list)
++ if (slot->number == slot_nr) {
++ kobject_get(&slot->kobj);
++ return slot;
++ }
++
++ return NULL;
++}
++
+ /**
+ * pci_create_slot - create or increment refcount for physical PCI slot
+ * @parent: struct pci_bus of parent bridge
+@@ -85,7 +156,17 @@ static struct kobj_type pci_slot_ktype =
+ * either return a new &struct pci_slot to the caller, or if the pci_slot
+ * already exists, its refcount will be incremented.
+ *
+- * Slots are uniquely identified by a @pci_bus, @slot_nr, @name tuple.
++ * Slots are uniquely identified by a @pci_bus, @slot_nr tuple.
++ *
++ * There are known platforms with broken firmware that assign the same
++ * name to multiple slots. Workaround these broken platforms by renaming
++ * the slots on behalf of the caller. If firmware assigns name N to
++ * multiple slots:
++ *
++ * The first slot is assigned N
++ * The second slot is assigned N-1
++ * The third slot is assigned N-2
++ * etc.
+ *
+ * Placeholder slots:
+ * In most cases, @pci_bus, @slot_nr will be sufficient to uniquely identify
+@@ -94,12 +175,8 @@ static struct kobj_type pci_slot_ktype =
+ * the slot. In this scenario, the caller may pass -1 for @slot_nr.
+ *
+ * The following semantics are imposed when the caller passes @slot_nr ==
+- * -1. First, the check for existing %struct pci_slot is skipped, as the
+- * caller may know about several unpopulated slots on a given %struct
+- * pci_bus, and each slot would have a @slot_nr of -1. Uniqueness for
+- * these slots is then determined by the @name parameter. We expect
+- * kobject_init_and_add() to warn us if the caller attempts to create
+- * multiple slots with the same name. The other change in semantics is
++ * -1. First, we no longer check for an existing %struct pci_slot, as there
++ * may be many slots with @slot_nr of -1. The other change in semantics is
+ * user-visible, which is the 'address' parameter presented in sysfs will
+ * consist solely of a dddd:bb tuple, where dddd is the PCI domain of the
+ * %struct pci_bus and bb is the bus number. In other words, the devfn of
+@@ -111,44 +188,53 @@ struct pci_slot *pci_create_slot(struct
+ struct hotplug_slot *hotplug)
+ {
+ struct pci_slot *slot;
+- int err;
++ int err = 0;
++ char *slot_name = NULL;
+
+ down_write(&pci_bus_sem);
+
+ if (slot_nr == -1)
+ goto placeholder;
+
+- /* If we've already created this slot, bump refcount and return. */
+- list_for_each_entry(slot, &parent->slots, list) {
+- if (slot->number == slot_nr) {
+- kobject_get(&slot->kobj);
+- pr_debug("%s: inc refcount to %d on %04x:%02x:%02x\n",
+- __func__,
+- atomic_read(&slot->kobj.kref.refcount),
+- pci_domain_nr(parent), parent->number,
+- slot_nr);
+- goto out;
++ /*
++ * Hotplug drivers are allowed to rename an existing slot,
++ * but only if not already claimed.
++ */
++ slot = get_slot(parent, slot_nr);
++ if (slot) {
++ if (hotplug) {
++ if ((err = slot->hotplug ? -EBUSY : 0)
++ || (err = rename_slot(slot, name))) {
++ kobject_put(&slot->kobj);
++ slot = NULL;
++ goto err;
++ }
+ }
++ goto out;
+ }
+
+ placeholder:
+ slot = kzalloc(sizeof(*slot), GFP_KERNEL);
+ if (!slot) {
+- slot = ERR_PTR(-ENOMEM);
+- goto out;
++ err = -ENOMEM;
++ goto err;
+ }
+
+ slot->bus = parent;
+ slot->number = slot_nr;
+
+ slot->kobj.kset = pci_slots_kset;
+- err = kobject_init_and_add(&slot->kobj, &pci_slot_ktype, NULL,
+- "%s", name);
+- if (err) {
+- printk(KERN_ERR "Unable to register kobject %s\n", name);
++ slot_name = make_slot_name(name);
++ if (!slot_name) {
++ err = -ENOMEM;
+ goto err;
+ }
+
++ err = kobject_init_and_add(&slot->kobj, &pci_slot_ktype, NULL,
++ "%s", slot_name);
++ if (err)
++ goto err;
++
+ INIT_LIST_HEAD(&slot->list);
+ list_add(&slot->list, &parent->slots);
+
+@@ -156,10 +242,10 @@ placeholder:
+ pr_debug("%s: created pci_slot on %04x:%02x:%02x\n",
+ __func__, pci_domain_nr(parent), parent->number, slot_nr);
+
+- out:
++out:
+ up_write(&pci_bus_sem);
+ return slot;
+- err:
++err:
+ kfree(slot);
+ slot = ERR_PTR(err);
+ goto out;
+@@ -205,7 +291,6 @@ EXPORT_SYMBOL_GPL(pci_update_slot_number
+ * just call kobject_put on its kobj and let our release methods do the
+ * rest.
+ */
+-
+ void pci_destroy_slot(struct pci_slot *slot)
+ {
+ pr_debug("%s: dec refcount to %d on %04x:%02x:%02x\n", __func__,
--- /dev/null
+From achiang@hp.com Tue Dec 2 16:25:28 2008
+From: Alex Chiang <achiang@hp.com>
+Date: Mon, 01 Dec 2008 13:10:10 -0700
+Subject: PCI: rpaphp: kmalloc/kfree slot->name directly
+To: stable@kernel.org
+Message-ID: <20081201201010.30671.25715.stgit@bob.kio>
+
+From: Alex Chiang <achiang@hp.com>
+
+commit b2132fecca02fa05d509ba4c8c1e51dee6ccd003 upstream.
+
+rpaphp tends to use slot->name directly everywhere, and doesn't
+ever need slot->hotplug_slot->name.
+
+struct hotplug_slot->name is going away, so convert rpaphp directly
+manipulate its own slot->name everywhere, and don't bother touching
+slot->hotplug_slot->name.
+
+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>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/pci/hotplug/rpaphp_slot.c | 8 +++-----
+ 1 file changed, 3 insertions(+), 5 deletions(-)
+
+--- a/drivers/pci/hotplug/rpaphp_slot.c
++++ b/drivers/pci/hotplug/rpaphp_slot.c
+@@ -43,7 +43,7 @@ static void rpaphp_release_slot(struct h
+ void dealloc_slot_struct(struct slot *slot)
+ {
+ kfree(slot->hotplug_slot->info);
+- kfree(slot->hotplug_slot->name);
++ kfree(slot->name);
+ kfree(slot->hotplug_slot);
+ kfree(slot);
+ }
+@@ -63,11 +63,9 @@ struct slot *alloc_slot_struct(struct de
+ GFP_KERNEL);
+ if (!slot->hotplug_slot->info)
+ goto error_hpslot;
+- slot->hotplug_slot->name = kmalloc(strlen(drc_name) + 1, GFP_KERNEL);
+- if (!slot->hotplug_slot->name)
++ slot->name = kstrdup(drc_name, GFP_KERNEL);
++ if (!slot->name)
+ goto error_info;
+- slot->name = slot->hotplug_slot->name;
+- strcpy(slot->name, drc_name);
+ slot->dn = dn;
+ slot->index = drc_index;
+ slot->power_domain = power_domain;
--- /dev/null
+From achiang@hp.com Tue Dec 2 16:25:47 2008
+From: Alex Chiang <achiang@hp.com>
+Date: Mon, 01 Dec 2008 13:10:15 -0700
+Subject: PCI: SGI Hotplug: stop managing bss_hotplug_slot->name
+To: stable@kernel.org
+Message-ID: <20081201201015.30671.29301.stgit@bob.kio>
+
+From: Alex Chiang <achiang@hp.com>
+
+commit 85234ce86dfa62b779faa19a70364a06e3f7fc32 upstream.
+
+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>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/pci/hotplug/sgi_hotplug.c | 19 ++++++-------------
+ 1 file changed, 6 insertions(+), 13 deletions(-)
+
+--- 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_b
+ }
+
+ 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(stru
+ 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(struc
+ 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(stru
+ 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(stru
+ }
+
+ 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;
+
--- /dev/null
+From achiang@hp.com Tue Dec 2 16:26:03 2008
+From: Alex Chiang <achiang@hp.com>
+Date: Mon, 01 Dec 2008 13:10:20 -0700
+Subject: PCI: shcphp: remove 'name' parameter
+To: stable@kernel.org
+Message-ID: <20081201201020.30671.40096.stgit@bob.kio>
+
+From: Alex Chiang <achiang@hp.com>
+
+commit 66f1705580f796a3f52c092e9dc92cbe5df41dd6 upstream.
+
+We do not need to manage our own name parameter, especially since
+the PCI core can change it on our behalf, in the case of duplicate
+slot names.
+
+Remove 'name' from shpchp's version of struct slot.
+
+This change also removes the unused struct task_event from the
+slot structure.
+
+Cc: kristen.c.accardi@intel.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>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/pci/hotplug/shpchp.h | 9 ++++---
+ drivers/pci/hotplug/shpchp_core.c | 38 ++++++++++++++----------------
+ drivers/pci/hotplug/shpchp_ctrl.c | 48 +++++++++++++++++++-------------------
+ 3 files changed, 48 insertions(+), 47 deletions(-)
+
+--- a/drivers/pci/hotplug/shpchp_core.c
++++ b/drivers/pci/hotplug/shpchp_core.c
+@@ -89,7 +89,7 @@ static void release_slot(struct hotplug_
+ {
+ struct slot *slot = hotplug_slot->private;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ kfree(slot->hotplug_slot->info);
+ kfree(slot->hotplug_slot);
+@@ -101,6 +101,7 @@ static int init_slots(struct controller
+ struct slot *slot;
+ struct hotplug_slot *hotplug_slot;
+ struct hotplug_slot_info *info;
++ char name[SLOT_NAME_SIZE];
+ int retval = -ENOMEM;
+ int i;
+
+@@ -119,8 +120,6 @@ static int init_slots(struct controller
+ goto error_hpslot;
+ hotplug_slot->info = info;
+
+- hotplug_slot->name = slot->name;
+-
+ slot->hp_slot = i;
+ slot->ctrl = ctrl;
+ slot->bus = ctrl->pci_dev->subordinate->number;
+@@ -133,25 +132,24 @@ static int init_slots(struct controller
+ /* register this slot with the hotplug pci core */
+ hotplug_slot->private = slot;
+ hotplug_slot->release = &release_slot;
+- snprintf(slot->name, SLOT_NAME_SIZE, "%d", slot->number);
++ snprintf(name, SLOT_NAME_SIZE, "%d", slot->number);
+ hotplug_slot->ops = &shpchp_hotplug_slot_ops;
+
+- get_power_status(hotplug_slot, &info->power_status);
+- get_attention_status(hotplug_slot, &info->attention_status);
+- get_latch_status(hotplug_slot, &info->latch_status);
+- get_adapter_status(hotplug_slot, &info->adapter_status);
+-
+ dbg("Registering bus=%x dev=%x hp_slot=%x sun=%x "
+ "slot_device_offset=%x\n", slot->bus, slot->device,
+ slot->hp_slot, slot->number, ctrl->slot_device_offset);
+ retval = pci_hp_register(slot->hotplug_slot,
+- ctrl->pci_dev->subordinate, slot->device,
+- hotplug_slot->name);
++ ctrl->pci_dev->subordinate, slot->device, name);
+ if (retval) {
+ err("pci_hp_register failed with error %d\n", retval);
+ goto error_info;
+ }
+
++ get_power_status(hotplug_slot, &info->power_status);
++ get_attention_status(hotplug_slot, &info->attention_status);
++ get_latch_status(hotplug_slot, &info->latch_status);
++ get_adapter_status(hotplug_slot, &info->adapter_status);
++
+ list_add(&slot->slot_list, &ctrl->slot_list);
+ }
+
+@@ -189,7 +187,7 @@ static int set_attention_status (struct
+ {
+ struct slot *slot = get_slot(hotplug_slot);
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ hotplug_slot->info->attention_status = status;
+ slot->hpc_ops->set_attention_status(slot, status);
+@@ -201,7 +199,7 @@ static int enable_slot (struct hotplug_s
+ {
+ struct slot *slot = get_slot(hotplug_slot);
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ return shpchp_sysfs_enable_slot(slot);
+ }
+@@ -210,7 +208,7 @@ static int disable_slot (struct hotplug_
+ {
+ struct slot *slot = get_slot(hotplug_slot);
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ return shpchp_sysfs_disable_slot(slot);
+ }
+@@ -220,7 +218,7 @@ static int get_power_status (struct hotp
+ struct slot *slot = get_slot(hotplug_slot);
+ int retval;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ retval = slot->hpc_ops->get_power_status(slot, value);
+ if (retval < 0)
+@@ -234,7 +232,7 @@ static int get_attention_status (struct
+ struct slot *slot = get_slot(hotplug_slot);
+ int retval;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ retval = slot->hpc_ops->get_attention_status(slot, value);
+ if (retval < 0)
+@@ -248,7 +246,7 @@ static int get_latch_status (struct hotp
+ struct slot *slot = get_slot(hotplug_slot);
+ int retval;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ retval = slot->hpc_ops->get_latch_status(slot, value);
+ if (retval < 0)
+@@ -262,7 +260,7 @@ static int get_adapter_status (struct ho
+ struct slot *slot = get_slot(hotplug_slot);
+ int retval;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ retval = slot->hpc_ops->get_adapter_status(slot, value);
+ if (retval < 0)
+@@ -277,7 +275,7 @@ static int get_max_bus_speed(struct hotp
+ struct slot *slot = get_slot(hotplug_slot);
+ int retval;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ retval = slot->hpc_ops->get_max_bus_speed(slot, value);
+ if (retval < 0)
+@@ -291,7 +289,7 @@ static int get_cur_bus_speed (struct hot
+ struct slot *slot = get_slot(hotplug_slot);
+ int retval;
+
+- dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name);
++ dbg("%s - physical_slot = %s\n", __func__, slot_name(slot));
+
+ retval = slot->hpc_ops->get_cur_bus_speed(slot, value);
+ if (retval < 0)
+--- a/drivers/pci/hotplug/shpchp_ctrl.c
++++ b/drivers/pci/hotplug/shpchp_ctrl.c
+@@ -70,7 +70,7 @@ u8 shpchp_handle_attention_button(u8 hp_
+ /*
+ * Button pressed - See if need to TAKE ACTION!!!
+ */
+- info("Button pressed on Slot(%s)\n", p_slot->name);
++ info("Button pressed on Slot(%s)\n", slot_name(p_slot));
+ event_type = INT_BUTTON_PRESS;
+
+ queue_interrupt_event(p_slot, event_type);
+@@ -98,7 +98,7 @@ u8 shpchp_handle_switch_change(u8 hp_slo
+ /*
+ * Switch opened
+ */
+- info("Latch open on Slot(%s)\n", p_slot->name);
++ info("Latch open on Slot(%s)\n", slot_name(p_slot));
+ event_type = INT_SWITCH_OPEN;
+ if (p_slot->pwr_save && p_slot->presence_save) {
+ event_type = INT_POWER_FAULT;
+@@ -108,7 +108,7 @@ u8 shpchp_handle_switch_change(u8 hp_slo
+ /*
+ * Switch closed
+ */
+- info("Latch close on Slot(%s)\n", p_slot->name);
++ info("Latch close on Slot(%s)\n", slot_name(p_slot));
+ event_type = INT_SWITCH_CLOSE;
+ }
+
+@@ -135,13 +135,13 @@ u8 shpchp_handle_presence_change(u8 hp_s
+ /*
+ * Card Present
+ */
+- info("Card present on Slot(%s)\n", p_slot->name);
++ info("Card present on Slot(%s)\n", slot_name(p_slot));
+ event_type = INT_PRESENCE_ON;
+ } else {
+ /*
+ * Not Present
+ */
+- info("Card not present on Slot(%s)\n", p_slot->name);
++ info("Card not present on Slot(%s)\n", slot_name(p_slot));
+ event_type = INT_PRESENCE_OFF;
+ }
+
+@@ -164,14 +164,14 @@ u8 shpchp_handle_power_fault(u8 hp_slot,
+ /*
+ * Power fault Cleared
+ */
+- info("Power fault cleared on Slot(%s)\n", p_slot->name);
++ info("Power fault cleared on Slot(%s)\n", slot_name(p_slot));
+ p_slot->status = 0x00;
+ event_type = INT_POWER_FAULT_CLEAR;
+ } else {
+ /*
+ * Power fault
+ */
+- info("Power fault on Slot(%s)\n", p_slot->name);
++ info("Power fault on Slot(%s)\n", slot_name(p_slot));
+ event_type = INT_POWER_FAULT;
+ /* set power fault status for this board */
+ p_slot->status = 0xFF;
+@@ -493,11 +493,11 @@ static void handle_button_press_event(st
+ if (getstatus) {
+ p_slot->state = BLINKINGOFF_STATE;
+ info("PCI slot #%s - powering off due to button "
+- "press.\n", p_slot->name);
++ "press.\n", slot_name(p_slot));
+ } else {
+ p_slot->state = BLINKINGON_STATE;
+ info("PCI slot #%s - powering on due to button "
+- "press.\n", p_slot->name);
++ "press.\n", slot_name(p_slot));
+ }
+ /* blink green LED and turn off amber */
+ p_slot->hpc_ops->green_led_blink(p_slot);
+@@ -512,7 +512,7 @@ static void handle_button_press_event(st
+ * press the attention again before the 5 sec. limit
+ * expires to cancel hot-add or hot-remove
+ */
+- info("Button cancel on Slot(%s)\n", p_slot->name);
++ info("Button cancel on Slot(%s)\n", slot_name(p_slot));
+ dbg("%s: button cancel\n", __func__);
+ cancel_delayed_work(&p_slot->work);
+ if (p_slot->state == BLINKINGOFF_STATE)
+@@ -521,7 +521,7 @@ static void handle_button_press_event(st
+ p_slot->hpc_ops->green_led_off(p_slot);
+ p_slot->hpc_ops->set_attention_status(p_slot, 0);
+ info("PCI slot #%s - action canceled due to button press\n",
+- p_slot->name);
++ slot_name(p_slot));
+ p_slot->state = STATIC_STATE;
+ break;
+ case POWEROFF_STATE:
+@@ -531,7 +531,7 @@ static void handle_button_press_event(st
+ * this means that the previous attention button action
+ * to hot-add or hot-remove is undergoing
+ */
+- info("Button ignore on Slot(%s)\n", p_slot->name);
++ info("Button ignore on Slot(%s)\n", slot_name(p_slot));
+ update_slot_info(p_slot);
+ break;
+ default:
+@@ -574,17 +574,17 @@ static int shpchp_enable_slot (struct sl
+ mutex_lock(&p_slot->ctrl->crit_sect);
+ rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus);
+ if (rc || !getstatus) {
+- info("No adapter on slot(%s)\n", p_slot->name);
++ info("No adapter on slot(%s)\n", slot_name(p_slot));
+ goto out;
+ }
+ rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
+ if (rc || getstatus) {
+- info("Latch open on slot(%s)\n", p_slot->name);
++ info("Latch open on slot(%s)\n", slot_name(p_slot));
+ goto out;
+ }
+ rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
+ if (rc || getstatus) {
+- info("Already enabled on slot(%s)\n", p_slot->name);
++ info("Already enabled on slot(%s)\n", slot_name(p_slot));
+ goto out;
+ }
+
+@@ -633,17 +633,17 @@ static int shpchp_disable_slot (struct s
+
+ rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus);
+ if (rc || !getstatus) {
+- info("No adapter on slot(%s)\n", p_slot->name);
++ info("No adapter on slot(%s)\n", slot_name(p_slot));
+ goto out;
+ }
+ rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus);
+ if (rc || getstatus) {
+- info("Latch open on slot(%s)\n", p_slot->name);
++ info("Latch open on slot(%s)\n", slot_name(p_slot));
+ goto out;
+ }
+ rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus);
+ if (rc || !getstatus) {
+- info("Already disabled slot(%s)\n", p_slot->name);
++ info("Already disabled slot(%s)\n", slot_name(p_slot));
+ goto out;
+ }
+
+@@ -671,14 +671,14 @@ int shpchp_sysfs_enable_slot(struct slot
+ break;
+ case POWERON_STATE:
+ info("Slot %s is already in powering on state\n",
+- p_slot->name);
++ slot_name(p_slot));
+ break;
+ case BLINKINGOFF_STATE:
+ case POWEROFF_STATE:
+- info("Already enabled on slot %s\n", p_slot->name);
++ info("Already enabled on slot %s\n", slot_name(p_slot));
+ break;
+ default:
+- err("Not a valid state on slot %s\n", p_slot->name);
++ err("Not a valid state on slot %s\n", slot_name(p_slot));
+ break;
+ }
+ mutex_unlock(&p_slot->lock);
+@@ -703,14 +703,14 @@ int shpchp_sysfs_disable_slot(struct slo
+ break;
+ case POWEROFF_STATE:
+ info("Slot %s is already in powering off state\n",
+- p_slot->name);
++ slot_name(p_slot));
+ break;
+ case BLINKINGON_STATE:
+ case POWERON_STATE:
+- info("Already disabled on slot %s\n", p_slot->name);
++ info("Already disabled on slot %s\n", slot_name(p_slot));
+ break;
+ default:
+- err("Not a valid state on slot %s\n", p_slot->name);
++ err("Not a valid state on slot %s\n", slot_name(p_slot));
+ break;
+ }
+ mutex_unlock(&p_slot->lock);
+--- a/drivers/pci/hotplug/shpchp.h
++++ b/drivers/pci/hotplug/shpchp.h
+@@ -69,15 +69,13 @@ struct slot {
+ u8 state;
+ u8 presence_save;
+ u8 pwr_save;
+- struct timer_list task_event;
+- u8 hp_slot;
+ struct controller *ctrl;
+ struct hpc_ops *hpc_ops;
+ struct hotplug_slot *hotplug_slot;
+ struct list_head slot_list;
+- char name[SLOT_NAME_SIZE];
+ struct delayed_work work; /* work for button event */
+ struct mutex lock;
++ u8 hp_slot;
+ };
+
+ struct event_info {
+@@ -169,6 +167,11 @@ extern void cleanup_slots(struct control
+ extern void shpchp_queue_pushbutton_work(struct work_struct *work);
+ extern int shpc_init( struct controller *ctrl, struct pci_dev *pdev);
+
++static inline const char *slot_name(struct slot *slot)
++{
++ return hotplug_slot_name(slot->hotplug_slot);
++}
++
+ #ifdef CONFIG_ACPI
+ #include <linux/pci-acpi.h>
+ static inline int get_hp_params_from_firmware(struct pci_dev *dev,
--- /dev/null
+From achiang@hp.com Tue Dec 2 16:20:12 2008
+From: Alex Chiang <achiang@hp.com>
+Date: Mon, 01 Dec 2008 13:09:19 -0700
+Subject: PCI: update pci_create_slot() to take a 'hotplug' param
+To: stable@kernel.org
+Message-ID: <20081201200919.30671.41149.stgit@bob.kio>
+
+From: Alex Chiang <achiang@hp.com>
+
+commit 828f37683e6d3ab5912989df0d04201db7ad798e upstream.
+
+Slot detection drivers can co-exist with hotplug drivers. The names
+of the detected/claimed slots may be different depending on module
+load order.
+
+For legacy reasons, we need to allow hotplug drivers to override
+the slot name if a detection driver is loaded first (and they find
+the same slots).
+
+Creating and overriding slot names should be an atomic operation,
+otherwise you get a locking nightmare as various drivers race to
+call pci_create_slot().
+
+pci_create_slot() is already serialized by grabbing the pci_bus_sem.
+
+We update the API and add a 'hotplug' param, which is:
+
+ set if the caller is a hotplug driver
+ NULL if the caller is a detection driver
+
+pci_create_slot() does not actually use the 'hotplug' parameter in this
+patch. A later patch will add the logic that uses it.
+
+Cc: kristen.c.accardi@intel.com
+Cc: matthew@wil.cx
+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>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/acpi/pci_slot.c | 2 +-
+ drivers/pci/hotplug/pci_hotplug_core.c | 2 +-
+ drivers/pci/slot.c | 4 +++-
+ include/linux/pci.h | 3 ++-
+ 4 files changed, 7 insertions(+), 4 deletions(-)
+
+--- a/drivers/acpi/pci_slot.c
++++ b/drivers/acpi/pci_slot.c
+@@ -150,7 +150,7 @@ register_slot(acpi_handle handle, u32 lv
+ }
+
+ snprintf(name, sizeof(name), "%u", (u32)sun);
+- pci_slot = pci_create_slot(pci_bus, device, name);
++ pci_slot = pci_create_slot(pci_bus, device, name, NULL);
+ if (IS_ERR(pci_slot)) {
+ err("pci_create_slot returned %ld\n", PTR_ERR(pci_slot));
+ kfree(slot);
+--- a/drivers/pci/hotplug/pci_hotplug_core.c
++++ b/drivers/pci/hotplug/pci_hotplug_core.c
+@@ -579,7 +579,7 @@ int pci_hp_register(struct hotplug_slot
+ * driver and call it here again. If we've already created the
+ * pci_slot, the interface will simply bump the refcount.
+ */
+- pci_slot = pci_create_slot(bus, slot_nr, name);
++ pci_slot = pci_create_slot(bus, slot_nr, name, slot);
+ if (IS_ERR(pci_slot))
+ return PTR_ERR(pci_slot);
+
+--- a/drivers/pci/slot.c
++++ b/drivers/pci/slot.c
+@@ -78,6 +78,7 @@ static struct kobj_type pci_slot_ktype =
+ * @parent: struct pci_bus of parent bridge
+ * @slot_nr: PCI_SLOT(pci_dev->devfn) or -1 for placeholder
+ * @name: user visible string presented in /sys/bus/pci/slots/<name>
++ * @hotplug: set if caller is hotplug driver, NULL otherwise
+ *
+ * PCI slots have first class attributes such as address, speed, width,
+ * and a &struct pci_slot is used to manage them. This interface will
+@@ -106,7 +107,8 @@ static struct kobj_type pci_slot_ktype =
+ */
+
+ struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,
+- const char *name)
++ const char *name,
++ struct hotplug_slot *hotplug)
+ {
+ struct pci_slot *slot;
+ int err;
+--- a/include/linux/pci.h
++++ b/include/linux/pci.h
+@@ -509,7 +509,8 @@ struct pci_bus *pci_create_bus(struct de
+ struct pci_bus *pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev,
+ int busnr);
+ struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,
+- const char *name);
++ const char *name,
++ struct hotplug_slot *hotplug);
+ void pci_destroy_slot(struct pci_slot *slot);
+ void pci_update_slot_number(struct pci_slot *slot, int slot_nr);
+ int pci_scan_slot(struct pci_bus *bus, int devfn);
x86-always-define-declare_pci_unmap-macros.patch
ath9k-fix-sw-iommu-bounce-buffer-starvation.patch
ath9k-correct-expected-max-rx-buffer-size.patch
+axnet_cs-pcnet_cs-moving-pcmcia_device_prod_id-for-netgear-fa411.patch
+pci-hotplug-core-add-name-param-pci_hp_register-interface.patch
+pci-update-pci_create_slot-to-take-a-hotplug-param.patch
+pci-hotplug-serialize-pci_hp_register-and-pci_hp_deregister.patch
+pci-prevent-duplicate-slot-names.patch
+pci-pci-hotplug-introduce-slot_name-helpers.patch
+pci-acpiphp-remove-name-parameter.patch
+pci-cpci_hotplug-stop-managing-hotplug_slot-name.patch
+pci-cpqphp-stop-managing-hotplug_slot-name.patch
+pci-fakephp-remove-name-parameter.patch
+pci-ibmphp-stop-managing-hotplug_slot-name.patch
+pci-pciehp-remove-name-parameter.patch
+pci-rpaphp-kmalloc-kfree-slot-name-directly.patch
+pci-sgi-hotplug-stop-managing-bss_hotplug_slot-name.patch
+pci-shcphp-remove-name-parameter.patch
+pci-hotplug-core-remove-name.patch
+cpufreq-powernow-k8-ignore-out-of-range-pstatestatus-value.patch
+xen-do-not-reserve-2-pages-of-padding-between-hypervisor-and-fixmap.patch
--- /dev/null
+From 5dc64a3442b98eaa0e3730c35fcf00cf962a93e7 Mon Sep 17 00:00:00 2001
+From: Ian Campbell <Ian.Campbell@citrix.com>
+Date: Fri, 10 Oct 2008 11:27:38 +0100
+Subject: xen: do not reserve 2 pages of padding between hypervisor and fixmap.
+
+From: Ian Campbell <Ian.Campbell@citrix.com>
+
+commit 5dc64a3442b98eaa0e3730c35fcf00cf962a93e7 upstream.
+
+When reserving space for the hypervisor the Xen paravirt backend adds
+an extra two pages (this was carried forward from the 2.6.18-xen tree
+which had them "for safety"). Depending on various CONFIG options this
+can cause the boot time fixmaps to span multiple PMDs which is not
+supported and triggers a WARN in early_ioremap_init().
+
+This was exposed by 2216d199b1430d1c0affb1498a9ebdbd9c0de439 which
+moved the dmi table parsing earlier.
+ x86: fix CONFIG_X86_RESERVE_LOW_64K=y
+
+ The bad_bios_dmi_table() quirk never triggered because we do DMI setup
+ too late. Move it a bit earlier.
+
+There is no real reason to reserve these two extra pages and the
+fixmap already incorporates FIX_HOLE which serves the same
+purpose. None of the other callers of reserve_top_address do this.
+
+Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
+Signed-off-by: Ingo Molnar <mingo@elte.hu>
+Cc: Jeremy Fitzhardinge <jeremy@goop.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ arch/x86/xen/enlighten.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/x86/xen/enlighten.c
++++ b/arch/x86/xen/enlighten.c
+@@ -1413,7 +1413,7 @@ static void __init xen_reserve_top(void)
+ if (HYPERVISOR_xen_version(XENVER_platform_parameters, &pp) == 0)
+ top = pp.virt_start;
+
+- reserve_top_address(-top + 2 * PAGE_SIZE);
++ reserve_top_address(-top);
+ #endif /* CONFIG_X86_32 */
+ }
+