diff options
author | Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com> | 2009-06-15 22:01:25 -0400 |
---|---|---|
committer | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-06-16 17:30:11 -0400 |
commit | c825bc94c8c1908750ab20413eb639c6be029e2d (patch) | |
tree | 6e5800fe52e0f94f42fdcd4c327b8cfaf803978a /drivers/pci/slot.c | |
parent | 498a8faf2c7eb974f70b7c5a60a31f0d48c35d44 (diff) |
PCI hotplug: create symlink to hotplug driver module
Create symbolic link to hotplug driver module in the PCI slot
directory (/sys/bus/pci/slots/<SLOT#>). In the past, we need to load
hotplug drivers one by one to identify the hotplug driver that handles
the slot, and it was very inconvenient especially for trouble shooting.
With this change, we can easily identify the hotplug driver.
Signed-off-by: Taku Izumi <izumi.taku@jp.fujitsu.com>
Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Reviewed-by: Alex Chiang <achiang@hp.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers/pci/slot.c')
-rw-r--r-- | drivers/pci/slot.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c index fe95ce20bcbd..eddb0748b0ea 100644 --- a/drivers/pci/slot.c +++ b/drivers/pci/slot.c | |||
@@ -307,6 +307,45 @@ void pci_destroy_slot(struct pci_slot *slot) | |||
307 | } | 307 | } |
308 | EXPORT_SYMBOL_GPL(pci_destroy_slot); | 308 | EXPORT_SYMBOL_GPL(pci_destroy_slot); |
309 | 309 | ||
310 | #if defined(CONFIG_HOTPLUG_PCI) || defined(CONFIG_HOTPLUG_PCI_MODULE) | ||
311 | #include <linux/pci_hotplug.h> | ||
312 | /** | ||
313 | * pci_hp_create_link - create symbolic link to the hotplug driver module. | ||
314 | * @slot: struct pci_slot | ||
315 | * | ||
316 | * Helper function for pci_hotplug_core.c to create symbolic link to | ||
317 | * the hotplug driver module. | ||
318 | */ | ||
319 | void pci_hp_create_module_link(struct pci_slot *pci_slot) | ||
320 | { | ||
321 | struct hotplug_slot *slot = pci_slot->hotplug; | ||
322 | struct kobject *kobj = NULL; | ||
323 | int no_warn; | ||
324 | |||
325 | if (!slot || !slot->ops) | ||
326 | return; | ||
327 | kobj = kset_find_obj(module_kset, slot->ops->mod_name); | ||
328 | if (!kobj) | ||
329 | return; | ||
330 | no_warn = sysfs_create_link(&pci_slot->kobj, kobj, "module"); | ||
331 | kobject_put(kobj); | ||
332 | } | ||
333 | EXPORT_SYMBOL_GPL(pci_hp_create_module_link); | ||
334 | |||
335 | /** | ||
336 | * pci_hp_remove_link - remove symbolic link to the hotplug driver module. | ||
337 | * @slot: struct pci_slot | ||
338 | * | ||
339 | * Helper function for pci_hotplug_core.c to remove symbolic link to | ||
340 | * the hotplug driver module. | ||
341 | */ | ||
342 | void pci_hp_remove_module_link(struct pci_slot *pci_slot) | ||
343 | { | ||
344 | sysfs_remove_link(&pci_slot->kobj, "module"); | ||
345 | } | ||
346 | EXPORT_SYMBOL_GPL(pci_hp_remove_module_link); | ||
347 | #endif | ||
348 | |||
310 | static int pci_slot_init(void) | 349 | static int pci_slot_init(void) |
311 | { | 350 | { |
312 | struct kset *pci_bus_kset; | 351 | struct kset *pci_bus_kset; |