|
@@ -67,26 +67,6 @@ static const struct hotplug_slot_ops cpci_hotplug_slot_ops = {
|
|
.get_latch_status = get_latch_status,
|
|
.get_latch_status = get_latch_status,
|
|
};
|
|
};
|
|
|
|
|
|
-static int
|
|
|
|
-update_latch_status(struct hotplug_slot *hotplug_slot, u8 value)
|
|
|
|
-{
|
|
|
|
- struct hotplug_slot_info info;
|
|
|
|
-
|
|
|
|
- memcpy(&info, hotplug_slot->info, sizeof(struct hotplug_slot_info));
|
|
|
|
- info.latch_status = value;
|
|
|
|
- return pci_hp_change_slot_info(hotplug_slot, &info);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-static int
|
|
|
|
-update_adapter_status(struct hotplug_slot *hotplug_slot, u8 value)
|
|
|
|
-{
|
|
|
|
- struct hotplug_slot_info info;
|
|
|
|
-
|
|
|
|
- memcpy(&info, hotplug_slot->info, sizeof(struct hotplug_slot_info));
|
|
|
|
- info.adapter_status = value;
|
|
|
|
- return pci_hp_change_slot_info(hotplug_slot, &info);
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
static int
|
|
static int
|
|
enable_slot(struct hotplug_slot *hotplug_slot)
|
|
enable_slot(struct hotplug_slot *hotplug_slot)
|
|
{
|
|
{
|
|
@@ -135,8 +115,7 @@ disable_slot(struct hotplug_slot *hotplug_slot)
|
|
goto disable_error;
|
|
goto disable_error;
|
|
}
|
|
}
|
|
|
|
|
|
- if (update_adapter_status(slot->hotplug_slot, 0))
|
|
|
|
- warn("failure to update adapter file");
|
|
|
|
|
|
+ slot->adapter_status = 0;
|
|
|
|
|
|
if (slot->extracting) {
|
|
if (slot->extracting) {
|
|
slot->extracting = 0;
|
|
slot->extracting = 0;
|
|
@@ -184,20 +163,23 @@ set_attention_status(struct hotplug_slot *hotplug_slot, u8 status)
|
|
static int
|
|
static int
|
|
get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
|
|
get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
|
|
{
|
|
{
|
|
- *value = hotplug_slot->info->adapter_status;
|
|
|
|
|
|
+ struct slot *slot = hotplug_slot->private;
|
|
|
|
+
|
|
|
|
+ *value = slot->adapter_status;
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
static int
|
|
static int
|
|
get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value)
|
|
get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value)
|
|
{
|
|
{
|
|
- *value = hotplug_slot->info->latch_status;
|
|
|
|
|
|
+ struct slot *slot = hotplug_slot->private;
|
|
|
|
+
|
|
|
|
+ *value = slot->latch_status;
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
static void release_slot(struct slot *slot)
|
|
static void release_slot(struct slot *slot)
|
|
{
|
|
{
|
|
- kfree(slot->hotplug_slot->info);
|
|
|
|
kfree(slot->hotplug_slot);
|
|
kfree(slot->hotplug_slot);
|
|
pci_dev_put(slot->dev);
|
|
pci_dev_put(slot->dev);
|
|
kfree(slot);
|
|
kfree(slot);
|
|
@@ -210,7 +192,6 @@ cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last)
|
|
{
|
|
{
|
|
struct slot *slot;
|
|
struct slot *slot;
|
|
struct hotplug_slot *hotplug_slot;
|
|
struct hotplug_slot *hotplug_slot;
|
|
- struct hotplug_slot_info *info;
|
|
|
|
char name[SLOT_NAME_SIZE];
|
|
char name[SLOT_NAME_SIZE];
|
|
int status;
|
|
int status;
|
|
int i;
|
|
int i;
|
|
@@ -237,13 +218,6 @@ cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last)
|
|
}
|
|
}
|
|
slot->hotplug_slot = hotplug_slot;
|
|
slot->hotplug_slot = hotplug_slot;
|
|
|
|
|
|
- info = kzalloc(sizeof(struct hotplug_slot_info), GFP_KERNEL);
|
|
|
|
- if (!info) {
|
|
|
|
- status = -ENOMEM;
|
|
|
|
- goto error_hpslot;
|
|
|
|
- }
|
|
|
|
- hotplug_slot->info = info;
|
|
|
|
-
|
|
|
|
slot->bus = bus;
|
|
slot->bus = bus;
|
|
slot->number = i;
|
|
slot->number = i;
|
|
slot->devfn = PCI_DEVFN(i, 0);
|
|
slot->devfn = PCI_DEVFN(i, 0);
|
|
@@ -253,19 +227,11 @@ cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last)
|
|
hotplug_slot->private = slot;
|
|
hotplug_slot->private = slot;
|
|
hotplug_slot->ops = &cpci_hotplug_slot_ops;
|
|
hotplug_slot->ops = &cpci_hotplug_slot_ops;
|
|
|
|
|
|
- /*
|
|
|
|
- * Initialize the slot info structure with some known
|
|
|
|
- * good values.
|
|
|
|
- */
|
|
|
|
- dbg("initializing slot %s", name);
|
|
|
|
- info->power_status = cpci_get_power_status(slot);
|
|
|
|
- info->attention_status = cpci_get_attention_status(slot);
|
|
|
|
-
|
|
|
|
dbg("registering slot %s", name);
|
|
dbg("registering slot %s", name);
|
|
status = pci_hp_register(slot->hotplug_slot, bus, i, name);
|
|
status = pci_hp_register(slot->hotplug_slot, bus, i, name);
|
|
if (status) {
|
|
if (status) {
|
|
err("pci_hp_register failed with error %d", status);
|
|
err("pci_hp_register failed with error %d", status);
|
|
- goto error_info;
|
|
|
|
|
|
+ goto error_hpslot;
|
|
}
|
|
}
|
|
dbg("slot registered with name: %s", slot_name(slot));
|
|
dbg("slot registered with name: %s", slot_name(slot));
|
|
|
|
|
|
@@ -276,8 +242,6 @@ cpci_hp_register_bus(struct pci_bus *bus, u8 first, u8 last)
|
|
up_write(&list_rwsem);
|
|
up_write(&list_rwsem);
|
|
}
|
|
}
|
|
return 0;
|
|
return 0;
|
|
-error_info:
|
|
|
|
- kfree(info);
|
|
|
|
error_hpslot:
|
|
error_hpslot:
|
|
kfree(hotplug_slot);
|
|
kfree(hotplug_slot);
|
|
error_slot:
|
|
error_slot:
|
|
@@ -359,10 +323,8 @@ init_slots(int clear_ins)
|
|
__func__, slot_name(slot));
|
|
__func__, slot_name(slot));
|
|
dev = pci_get_slot(slot->bus, PCI_DEVFN(slot->number, 0));
|
|
dev = pci_get_slot(slot->bus, PCI_DEVFN(slot->number, 0));
|
|
if (dev) {
|
|
if (dev) {
|
|
- if (update_adapter_status(slot->hotplug_slot, 1))
|
|
|
|
- warn("failure to update adapter file");
|
|
|
|
- if (update_latch_status(slot->hotplug_slot, 1))
|
|
|
|
- warn("failure to update latch file");
|
|
|
|
|
|
+ slot->adapter_status = 1;
|
|
|
|
+ slot->latch_status = 1;
|
|
slot->dev = dev;
|
|
slot->dev = dev;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -424,11 +386,8 @@ check_slots(void)
|
|
dbg("%s - slot %s HS_CSR (2) = %04x",
|
|
dbg("%s - slot %s HS_CSR (2) = %04x",
|
|
__func__, slot_name(slot), hs_csr);
|
|
__func__, slot_name(slot), hs_csr);
|
|
|
|
|
|
- if (update_latch_status(slot->hotplug_slot, 1))
|
|
|
|
- warn("failure to update latch file");
|
|
|
|
-
|
|
|
|
- if (update_adapter_status(slot->hotplug_slot, 1))
|
|
|
|
- warn("failure to update adapter file");
|
|
|
|
|
|
+ slot->latch_status = 1;
|
|
|
|
+ slot->adapter_status = 1;
|
|
|
|
|
|
cpci_led_off(slot);
|
|
cpci_led_off(slot);
|
|
|
|
|
|
@@ -449,9 +408,7 @@ check_slots(void)
|
|
__func__, slot_name(slot), hs_csr);
|
|
__func__, slot_name(slot), hs_csr);
|
|
|
|
|
|
if (!slot->extracting) {
|
|
if (!slot->extracting) {
|
|
- if (update_latch_status(slot->hotplug_slot, 0))
|
|
|
|
- warn("failure to update latch file");
|
|
|
|
-
|
|
|
|
|
|
+ slot->latch_status = 0;
|
|
slot->extracting = 1;
|
|
slot->extracting = 1;
|
|
atomic_inc(&extracting);
|
|
atomic_inc(&extracting);
|
|
}
|
|
}
|
|
@@ -465,8 +422,7 @@ check_slots(void)
|
|
*/
|
|
*/
|
|
err("card in slot %s was improperly removed",
|
|
err("card in slot %s was improperly removed",
|
|
slot_name(slot));
|
|
slot_name(slot));
|
|
- if (update_adapter_status(slot->hotplug_slot, 0))
|
|
|
|
- warn("failure to update adapter file");
|
|
|
|
|
|
+ slot->adapter_status = 0;
|
|
slot->extracting = 0;
|
|
slot->extracting = 0;
|
|
atomic_dec(&extracting);
|
|
atomic_dec(&extracting);
|
|
}
|
|
}
|