static int fs_add_slot(struct pci_slot *pci_slot)
{
int retval = 0;
/* Create symbolic link to the hotplug driver module */
pci_hp_create_module_link(pci_slot);
if (has_power_file(pci_slot)) {
retval = sysfs_create_file(&pci_slot->kobj,
&hotplug_slot_attr_power.attr);
if (retval)
goto exit_power;
}
在检查pci代码的这一部分时,我们可以看到
has_power_file(pci_slot)
将被执行。但是,在
has_power_file():
static bool has_power_file(struct pci_slot *pci_slot)
{
struct hotplug_slot *slot = pci_slot->hotplug;
if ((!slot) || (!slot->ops))
return false;
if ((slot->ops->enable_slot) || /////////// why force enable here ?
(slot->ops->disable_slot) || ////////// why force disalbe here ?
(slot->ops->get_power_status))
return true;
return false;
}
我们可以看到插槽将被启用和禁用,我认为它改变了原来的插槽状态,不是吗?