From 13ce0978e497c15c11b14f65583543c481f24aea Mon Sep 17 00:00:00 2001 From: Alex Chiang Date: Mon, 1 Dec 2008 13:09:34 -0700 Subject: [PATCH] PCI, PCI Hotplug: introduce slot_name helpers 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 Signed-off-by: Alex Chiang Signed-off-by: Jesse Barnes Signed-off-by: Greg Kroah-Hartman --- drivers/pci/slot.c | 2 +- include/linux/pci.h | 5 +++++ include/linux/pci_hotplug.h | 5 +++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c index de7994a8b32a..b703b097ce10 100644 --- a/drivers/pci/slot.c +++ b/drivers/pci/slot.c @@ -116,7 +116,7 @@ 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) + if (strcmp(pci_slot_name(slot), name) == 0) return result; slot_name = make_slot_name(name); diff --git a/include/linux/pci.h b/include/linux/pci.h index 86ed5f960093..426e029dbe72 100644 --- 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, diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h index 5efba6671865..a3a3245943b1 100644 --- 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); -- 2.39.2