|
@@ -49,15 +49,15 @@ static DEFINE_MUTEX(pci_hp_mutex);
|
|
#define GET_STATUS(name, type) \
|
|
#define GET_STATUS(name, type) \
|
|
static int get_##name(struct hotplug_slot *slot, type *value) \
|
|
static int get_##name(struct hotplug_slot *slot, type *value) \
|
|
{ \
|
|
{ \
|
|
- struct hotplug_slot_ops *ops = slot->ops; \
|
|
|
|
|
|
+ const struct hotplug_slot_ops *ops = slot->ops; \
|
|
int retval = 0; \
|
|
int retval = 0; \
|
|
- if (!try_module_get(ops->owner)) \
|
|
|
|
|
|
+ if (!try_module_get(slot->owner)) \
|
|
return -ENODEV; \
|
|
return -ENODEV; \
|
|
if (ops->get_##name) \
|
|
if (ops->get_##name) \
|
|
retval = ops->get_##name(slot, value); \
|
|
retval = ops->get_##name(slot, value); \
|
|
else \
|
|
else \
|
|
*value = slot->info->name; \
|
|
*value = slot->info->name; \
|
|
- module_put(ops->owner); \
|
|
|
|
|
|
+ module_put(slot->owner); \
|
|
return retval; \
|
|
return retval; \
|
|
}
|
|
}
|
|
|
|
|
|
@@ -90,7 +90,7 @@ static ssize_t power_write_file(struct pci_slot *pci_slot, const char *buf,
|
|
power = (u8)(lpower & 0xff);
|
|
power = (u8)(lpower & 0xff);
|
|
dbg("power = %d\n", power);
|
|
dbg("power = %d\n", power);
|
|
|
|
|
|
- if (!try_module_get(slot->ops->owner)) {
|
|
|
|
|
|
+ if (!try_module_get(slot->owner)) {
|
|
retval = -ENODEV;
|
|
retval = -ENODEV;
|
|
goto exit;
|
|
goto exit;
|
|
}
|
|
}
|
|
@@ -109,7 +109,7 @@ static ssize_t power_write_file(struct pci_slot *pci_slot, const char *buf,
|
|
err("Illegal value specified for power\n");
|
|
err("Illegal value specified for power\n");
|
|
retval = -EINVAL;
|
|
retval = -EINVAL;
|
|
}
|
|
}
|
|
- module_put(slot->ops->owner);
|
|
|
|
|
|
+ module_put(slot->owner);
|
|
|
|
|
|
exit:
|
|
exit:
|
|
if (retval)
|
|
if (retval)
|
|
@@ -138,7 +138,8 @@ static ssize_t attention_read_file(struct pci_slot *pci_slot, char *buf)
|
|
static ssize_t attention_write_file(struct pci_slot *pci_slot, const char *buf,
|
|
static ssize_t attention_write_file(struct pci_slot *pci_slot, const char *buf,
|
|
size_t count)
|
|
size_t count)
|
|
{
|
|
{
|
|
- struct hotplug_slot_ops *ops = pci_slot->hotplug->ops;
|
|
|
|
|
|
+ struct hotplug_slot *slot = pci_slot->hotplug;
|
|
|
|
+ const struct hotplug_slot_ops *ops = slot->ops;
|
|
unsigned long lattention;
|
|
unsigned long lattention;
|
|
u8 attention;
|
|
u8 attention;
|
|
int retval = 0;
|
|
int retval = 0;
|
|
@@ -147,13 +148,13 @@ static ssize_t attention_write_file(struct pci_slot *pci_slot, const char *buf,
|
|
attention = (u8)(lattention & 0xff);
|
|
attention = (u8)(lattention & 0xff);
|
|
dbg(" - attention = %d\n", attention);
|
|
dbg(" - attention = %d\n", attention);
|
|
|
|
|
|
- if (!try_module_get(ops->owner)) {
|
|
|
|
|
|
+ if (!try_module_get(slot->owner)) {
|
|
retval = -ENODEV;
|
|
retval = -ENODEV;
|
|
goto exit;
|
|
goto exit;
|
|
}
|
|
}
|
|
if (ops->set_attention_status)
|
|
if (ops->set_attention_status)
|
|
- retval = ops->set_attention_status(pci_slot->hotplug, attention);
|
|
|
|
- module_put(ops->owner);
|
|
|
|
|
|
+ retval = ops->set_attention_status(slot, attention);
|
|
|
|
+ module_put(slot->owner);
|
|
|
|
|
|
exit:
|
|
exit:
|
|
if (retval)
|
|
if (retval)
|
|
@@ -213,13 +214,13 @@ static ssize_t test_write_file(struct pci_slot *pci_slot, const char *buf,
|
|
test = (u32)(ltest & 0xffffffff);
|
|
test = (u32)(ltest & 0xffffffff);
|
|
dbg("test = %d\n", test);
|
|
dbg("test = %d\n", test);
|
|
|
|
|
|
- if (!try_module_get(slot->ops->owner)) {
|
|
|
|
|
|
+ if (!try_module_get(slot->owner)) {
|
|
retval = -ENODEV;
|
|
retval = -ENODEV;
|
|
goto exit;
|
|
goto exit;
|
|
}
|
|
}
|
|
if (slot->ops->hardware_test)
|
|
if (slot->ops->hardware_test)
|
|
retval = slot->ops->hardware_test(slot, test);
|
|
retval = slot->ops->hardware_test(slot, test);
|
|
- module_put(slot->ops->owner);
|
|
|
|
|
|
+ module_put(slot->owner);
|
|
|
|
|
|
exit:
|
|
exit:
|
|
if (retval)
|
|
if (retval)
|
|
@@ -447,8 +448,8 @@ int __pci_hp_initialize(struct hotplug_slot *slot, struct pci_bus *bus,
|
|
if ((slot->info == NULL) || (slot->ops == NULL))
|
|
if ((slot->info == NULL) || (slot->ops == NULL))
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
|
|
|
|
- slot->ops->owner = owner;
|
|
|
|
- slot->ops->mod_name = mod_name;
|
|
|
|
|
|
+ slot->owner = owner;
|
|
|
|
+ slot->mod_name = mod_name;
|
|
|
|
|
|
/*
|
|
/*
|
|
* No problems if we call this interface from both ACPI_PCI_SLOT
|
|
* No problems if we call this interface from both ACPI_PCI_SLOT
|