diff options
author | Alex Chiang <achiang@hp.com> | 2008-08-21 17:13:29 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2008-08-21 18:15:10 -0400 |
commit | 167e782e301188c7c7e31e486bbeea5f918324c1 (patch) | |
tree | c226d2a2de10ff6d437505ac05ea55ae897a83cc /drivers/pci/hotplug/pciehp_hpc.c | |
parent | 6a55617ed5d1aa62b850de2cf66f5ede2eef4825 (diff) |
PCI: pciehp: Rename duplicate slot name N as N-1, N-2, N-M...
Commit 3800345f723fd130d50434d4717b99d4a9f383c8 (pciehp: fix slot name)
introduces the pciehp_slot_with_bus module parameter, which was intended
to help work around broken firmware that assigns the same name to multiple
slots.
Commit 9e4f2e8d4ddb04ad16a3828cd9a369a5a5287009 (pciehp: add message about
pciehp_slot_with_bus option) tells the user to use the above parameter
in the event of a name collision.
This approach is sub-optimal because it requires too much work from
the user.
Instead, let's rename the slot 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
The Mth registered slot becomes N-M
In the event we overflow the slot->name parameter, we report an
error to the user.
This is a temporary fix until the entire PCI core can be reworked
such that individual drivers no longer have to manage their own
slot names.
Tested-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.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>
Diffstat (limited to 'drivers/pci/hotplug/pciehp_hpc.c')
-rw-r--r-- | drivers/pci/hotplug/pciehp_hpc.c | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index ad27e9e225a6..ab31f5ba665d 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c | |||
@@ -1030,15 +1030,6 @@ static void pcie_shutdown_notification(struct controller *ctrl) | |||
1030 | pciehp_free_irq(ctrl); | 1030 | pciehp_free_irq(ctrl); |
1031 | } | 1031 | } |
1032 | 1032 | ||
1033 | static void make_slot_name(struct slot *slot) | ||
1034 | { | ||
1035 | if (pciehp_slot_with_bus) | ||
1036 | snprintf(slot->name, SLOT_NAME_SIZE, "%04d_%04d", | ||
1037 | slot->bus, slot->number); | ||
1038 | else | ||
1039 | snprintf(slot->name, SLOT_NAME_SIZE, "%d", slot->number); | ||
1040 | } | ||
1041 | |||
1042 | static int pcie_init_slot(struct controller *ctrl) | 1033 | static int pcie_init_slot(struct controller *ctrl) |
1043 | { | 1034 | { |
1044 | struct slot *slot; | 1035 | struct slot *slot; |
@@ -1053,7 +1044,7 @@ static int pcie_init_slot(struct controller *ctrl) | |||
1053 | slot->device = ctrl->slot_device_offset + slot->hp_slot; | 1044 | slot->device = ctrl->slot_device_offset + slot->hp_slot; |
1054 | slot->hpc_ops = ctrl->hpc_ops; | 1045 | slot->hpc_ops = ctrl->hpc_ops; |
1055 | slot->number = ctrl->first_slot; | 1046 | slot->number = ctrl->first_slot; |
1056 | make_slot_name(slot); | 1047 | snprintf(slot->name, SLOT_NAME_SIZE, "%d", slot->number); |
1057 | mutex_init(&slot->lock); | 1048 | mutex_init(&slot->lock); |
1058 | INIT_DELAYED_WORK(&slot->work, pciehp_queue_pushbutton_work); | 1049 | INIT_DELAYED_WORK(&slot->work, pciehp_queue_pushbutton_work); |
1059 | list_add(&slot->slot_list, &ctrl->slot_list); | 1050 | list_add(&slot->slot_list, &ctrl->slot_list); |