X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fpci%2Fhotplug%2Facpiphp_glue.c;h=d41795bb6d87643c96ed285f945f94ca13d72e64;hb=9bf4aaab3e101692164d49b7ca357651eb691cb6;hp=4f3594293e8fb19daea5e70b63234145eab3b909;hpb=5273a3df6485dc2ad6aa7ddd441b9a21970f003b;p=linux-2.6.git diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 4f3594293..d41795bb6 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c @@ -66,7 +66,7 @@ static void handle_hotplug_event_func (acpi_handle, u32, void *); * 4. .. * */ -static int is_ejectable (acpi_handle handle) +static int is_ejectable(acpi_handle handle) { acpi_status status; acpi_handle tmp; @@ -326,10 +326,10 @@ static void decode_hpp(struct acpiphp_bridge *bridge) bridge->hpp.enable_PERR = package->package.elements[3].integer.value; dbg("_HPP parameter = (%02x, %02x, %02x, %02x)\n", - bridge->hpp.cache_line_size, - bridge->hpp.latency_timer, - bridge->hpp.enable_SERR, - bridge->hpp.enable_PERR); + bridge->hpp.cache_line_size, + bridge->hpp.latency_timer, + bridge->hpp.enable_SERR, + bridge->hpp.enable_PERR); bridge->flags |= BRIDGE_HAS_HPP; @@ -919,6 +919,48 @@ static unsigned int get_slot_status(struct acpiphp_slot *slot) return (unsigned int)sta; } +/** + * acpiphp_check_bridge - re-enumerate devices + * + * Iterate over all slots under this bridge and make sure that if a + * card is present they are enabled, and if not they are disabled. + */ +static int acpiphp_check_bridge(struct acpiphp_bridge *bridge) +{ + struct acpiphp_slot *slot; + int retval = 0; + int enabled, disabled; + + enabled = disabled = 0; + + for (slot = bridge->slots; slot; slot = slot->next) { + unsigned int status = get_slot_status(slot); + if (slot->flags & SLOT_ENABLED) { + if (status == ACPI_STA_ALL) + continue; + retval = acpiphp_disable_slot(slot); + if (retval) { + err("Error occurred in disabling\n"); + goto err_exit; + } + disabled++; + } else { + if (status != ACPI_STA_ALL) + continue; + retval = acpiphp_enable_slot(slot); + if (retval) { + err("Error occurred in enabling\n"); + goto err_exit; + } + enabled++; + } + } + + dbg("%s: %d enabled, %d disabled\n", __FUNCTION__, enabled, disabled); + + err_exit: + return retval; +} /* * ACPI event handlers @@ -1113,6 +1155,8 @@ void __exit acpiphp_glue_exit(void) kfree(bridge); } + + acpi_pci_unregister_driver(&acpi_pci_hp_driver); } @@ -1138,13 +1182,14 @@ int __init acpiphp_get_num_slots(void) } +#if 0 /** * acpiphp_for_each_slot - call function for each slot * @fn: callback function * @data: context to be passed to callback function * */ -int acpiphp_for_each_slot(acpiphp_callback fn, void *data) +static int acpiphp_for_each_slot(acpiphp_callback fn, void *data) { struct list_head *node; struct acpiphp_bridge *bridge; @@ -1163,7 +1208,7 @@ int acpiphp_for_each_slot(acpiphp_callback fn, void *data) err_exit: return retval; } - +#endif /* search matching slot from id */ struct acpiphp_slot *get_slot_from_id(int id) @@ -1180,8 +1225,9 @@ struct acpiphp_slot *get_slot_from_id(int id) } /* should never happen! */ - err("%s: no object for id %d\n",__FUNCTION__, id); - return 0; + err("%s: no object for id %d\n", __FUNCTION__, id); + WARN_ON(1); + return NULL; } @@ -1241,50 +1287,6 @@ int acpiphp_disable_slot(struct acpiphp_slot *slot) } -/** - * acpiphp_check_bridge - re-enumerate devices - * - * Iterate over all slots under this bridge and make sure that if a - * card is present they are enabled, and if not they are disabled. - */ -int acpiphp_check_bridge(struct acpiphp_bridge *bridge) -{ - struct acpiphp_slot *slot; - int retval = 0; - int enabled, disabled; - - enabled = disabled = 0; - - for (slot = bridge->slots; slot; slot = slot->next) { - unsigned int status = get_slot_status(slot); - if (slot->flags & SLOT_ENABLED) { - if (status == ACPI_STA_ALL) - continue; - retval = acpiphp_disable_slot(slot); - if (retval) { - err("Error occurred in disabling\n"); - goto err_exit; - } - disabled++; - } else { - if (status != ACPI_STA_ALL) - continue; - retval = acpiphp_enable_slot(slot); - if (retval) { - err("Error occurred in enabling\n"); - goto err_exit; - } - enabled++; - } - } - - dbg("%s: %d enabled, %d disabled\n", __FUNCTION__, enabled, disabled); - - err_exit: - return retval; -} - - /* * slot enabled: 1 * slot disabled: 0