patch-2.4.21 linux-2.4.21/drivers/hotplug/acpiphp_glue.c
Next file: linux-2.4.21/drivers/hotplug/acpiphp_pci.c
Previous file: linux-2.4.21/drivers/hotplug/acpiphp_core.c
Back to the patch index
Back to the overall index
- Lines: 879
- Date:
2003-06-13 07:51:33.000000000 -0700
- Orig file:
linux-2.4.20/drivers/hotplug/acpiphp_glue.c
- Orig date:
2002-11-28 15:53:12.000000000 -0800
diff -urN linux-2.4.20/drivers/hotplug/acpiphp_glue.c linux-2.4.21/drivers/hotplug/acpiphp_glue.c
@@ -39,12 +39,10 @@
static LIST_HEAD(bridge_list);
-static int debug = 1; /* XXX set 0 after debug */
#define MY_NAME "acpiphp_glue"
static void handle_hotplug_event_bridge (acpi_handle, u32, void *);
static void handle_hotplug_event_func (acpi_handle, u32, void *);
-static struct pci_ops *default_ops;
/*
* initialization & terminatation routines
@@ -90,8 +88,6 @@
static acpi_status
is_ejectable_slot (acpi_handle handle, u32 lvl, void *context, void **rv)
{
- acpi_status status;
- acpi_handle tmp;
int *count = (int *)context;
if (is_ejectable(handle)) {
@@ -157,7 +153,7 @@
for (slot = bridge->slots; slot; slot = slot->next)
if (slot->device == device) {
if (slot->sun != sun)
- warn("sibling found, but _SUN doesn't match!");
+ warn("sibling found, but _SUN doesn't match!\n");
break;
}
@@ -181,7 +177,7 @@
bridge->nr_slots++;
- dbg("found ACPI PCI Hotplug slot at PCI %02x:%02x Slot:%d",
+ dbg("found ACPI PCI Hotplug slot at PCI %02x:%02x Slot:%d\n",
slot->bridge->bus, slot->device, slot->sun);
}
@@ -206,7 +202,7 @@
newfunc);
if (ACPI_FAILURE(status)) {
- err("failed to register interrupt notify handler");
+ err("failed to register interrupt notify handler\n");
return status;
}
@@ -306,21 +302,21 @@
switch (resource_type) {
case ACPI_MEMORY_RANGE:
if (cache_attribute == ACPI_PREFETCHABLE_MEMORY) {
- dbg("resource type: prefetchable memory 0x%x - 0x%x", (u32)min_address_range, (u32)max_address_range);
+ dbg("resource type: prefetchable memory 0x%x - 0x%x\n", (u32)min_address_range, (u32)max_address_range);
res = acpiphp_make_resource(min_address_range,
address_length);
if (!res) {
- err("out of memory");
+ err("out of memory\n");
return;
}
res->next = bridge->p_mem_head;
bridge->p_mem_head = res;
} else {
- dbg("resource type: memory 0x%x - 0x%x", (u32)min_address_range, (u32)max_address_range);
+ dbg("resource type: memory 0x%x - 0x%x\n", (u32)min_address_range, (u32)max_address_range);
res = acpiphp_make_resource(min_address_range,
address_length);
if (!res) {
- err("out of memory");
+ err("out of memory\n");
return;
}
res->next = bridge->mem_head;
@@ -328,22 +324,22 @@
}
break;
case ACPI_IO_RANGE:
- dbg("resource type: io 0x%x - 0x%x", (u32)min_address_range, (u32)max_address_range);
+ dbg("resource type: io 0x%x - 0x%x\n", (u32)min_address_range, (u32)max_address_range);
res = acpiphp_make_resource(min_address_range,
address_length);
if (!res) {
- err("out of memory");
+ err("out of memory\n");
return;
}
res->next = bridge->io_head;
bridge->io_head = res;
break;
case ACPI_BUS_NUMBER_RANGE:
- dbg("resource type: bus number %d - %d", (u32)min_address_range, (u32)max_address_range);
+ dbg("resource type: bus number %d - %d\n", (u32)min_address_range, (u32)max_address_range);
res = acpiphp_make_resource(min_address_range,
address_length);
if (!res) {
- err("out of memory");
+ err("out of memory\n");
return;
}
res->next = bridge->bus_head;
@@ -360,10 +356,9 @@
acpiphp_resource_sort_and_combine(&bridge->mem_head);
acpiphp_resource_sort_and_combine(&bridge->p_mem_head);
acpiphp_resource_sort_and_combine(&bridge->bus_head);
-#if 1
- info("ACPI _CRS resource:");
+
+ dbg("ACPI _CRS resource:\n");
acpiphp_dump_resource(bridge);
-#endif
}
@@ -372,7 +367,7 @@
{
const struct list_head *l;
- list_for_each(l, list) {
+ list_for_each (l, list) {
struct pci_bus *b = pci_bus_b(l);
if (b->number == bus)
return b;
@@ -386,7 +381,7 @@
}
}
- return 0;
+ return NULL;
}
@@ -397,7 +392,8 @@
#if ACPI_CA_VERSION < 0x20020201
acpi_buffer buffer;
#else
- acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
+ acpi_buffer buffer = { .length = ACPI_ALLOCATE_BUFFER,
+ .pointer = NULL};
#endif
acpi_object *package;
int i;
@@ -425,7 +421,7 @@
#endif
if (ACPI_FAILURE(status)) {
- dbg("_HPP evaluation failed");
+ dbg("_HPP evaluation failed\n");
return;
}
@@ -433,13 +429,13 @@
if (!package || package->type != ACPI_TYPE_PACKAGE ||
package->package.count != 4 || !package->package.elements) {
- err("invalid _HPP object; ignoring");
+ err("invalid _HPP object; ignoring\n");
goto err_exit;
}
for (i = 0; i < 4; i++) {
if (package->package.elements[i].type != ACPI_TYPE_INTEGER) {
- err("invalid _HPP parameter type; ignoring");
+ err("invalid _HPP parameter type; ignoring\n");
goto err_exit;
}
}
@@ -449,7 +445,7 @@
bridge->hpp.enable_SERR = package->package.elements[2].integer.value;
bridge->hpp.enable_PERR = package->package.elements[3].integer.value;
- dbg("_HPP parameter = (%02x, %02x, %02x, %02x)",
+ dbg("_HPP parameter = (%02x, %02x, %02x, %02x)\n",
bridge->hpp.cache_line_size,
bridge->hpp.latency_timer,
bridge->hpp.enable_SERR,
@@ -484,15 +480,13 @@
bridge);
if (ACPI_FAILURE(status)) {
- err("failed to register interrupt notify handler");
+ err("failed to register interrupt notify handler\n");
}
list_add(&bridge->list, &bridge_list);
-#if 1
- dbg("Bridge resource:");
+ dbg("Bridge resource:\n");
acpiphp_dump_resource(bridge);
-#endif
}
@@ -503,7 +497,8 @@
#if ACPI_CA_VERSION < 0x20020201
acpi_buffer buffer;
#else
- acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
+ acpi_buffer buffer = { .length = ACPI_ALLOCATE_BUFFER,
+ .pointer = NULL};
#endif
struct acpiphp_bridge *bridge;
@@ -519,7 +514,6 @@
bridge->bus = bus;
bridge->pci_bus = find_pci_bus(&pci_root_buses, bus);
- bridge->pci_ops = bridge->pci_bus->ops;
bridge->res_lock = SPIN_LOCK_UNLOCKED;
@@ -545,7 +539,7 @@
#endif
if (ACPI_FAILURE(status)) {
- err("failed to decode bridge resources");
+ err("failed to decode bridge resources\n");
kfree(bridge);
return;
}
@@ -565,17 +559,15 @@
/* allocate and initialize PCI-to-PCI bridge data structure */
static void add_p2p_bridge (acpi_handle *handle, int seg, int bus, int dev, int fn)
{
- acpi_status status;
struct acpiphp_bridge *bridge;
u8 tmp8;
u16 tmp16;
- u32 tmp;
u64 base64, limit64;
u32 base, limit, base32u, limit32u;
bridge = kmalloc(sizeof(struct acpiphp_bridge), GFP_KERNEL);
if (bridge == NULL) {
- err("out of memory");
+ err("out of memory\n");
return;
}
@@ -587,18 +579,17 @@
bridge->pci_dev = pci_find_slot(bus, PCI_DEVFN(dev, fn));
if (!bridge->pci_dev) {
- err("Can't get pci_dev");
+ err("Can't get pci_dev\n");
kfree(bridge);
return;
}
bridge->pci_bus = bridge->pci_dev->subordinate;
if (!bridge->pci_bus) {
- err("This is not a PCI-to-PCI bridge!");
+ err("This is not a PCI-to-PCI bridge!\n");
kfree(bridge);
return;
}
- bridge->pci_ops = bridge->pci_bus->ops;
bridge->res_lock = SPIN_LOCK_UNLOCKED;
@@ -621,10 +612,10 @@
limit = ((limit << 8) & 0xf000) + 0xfff;
bridge->io_head = acpiphp_make_resource((u64)base, limit - base + 1);
if (!bridge->io_head) {
- err("out of memory");
+ err("out of memory\n");
return;
}
- dbg("16bit I/O range: %04x-%04x",
+ dbg("16bit I/O range: %04x-%04x\n",
(u32)bridge->io_head->base,
(u32)(bridge->io_head->base + bridge->io_head->length - 1));
break;
@@ -635,18 +626,18 @@
limit = (((u32)tmp16 << 16) | ((limit << 8) & 0xf000)) + 0xfff;
bridge->io_head = acpiphp_make_resource((u64)base, limit - base + 1);
if (!bridge->io_head) {
- err("out of memory");
+ err("out of memory\n");
return;
}
- dbg("32bit I/O range: %08x-%08x",
+ dbg("32bit I/O range: %08x-%08x\n",
(u32)bridge->io_head->base,
(u32)(bridge->io_head->base + bridge->io_head->length - 1));
break;
case 0x0f:
- dbg("I/O space unsupported");
+ dbg("I/O space unsupported\n");
break;
default:
- warn("Unknown I/O range type");
+ warn("Unknown I/O range type\n");
}
/* Memory resources (mandatory for P2P bridge) */
@@ -656,10 +647,10 @@
limit = ((tmp16 & 0xfff0) << 16) | 0xfffff;
bridge->mem_head = acpiphp_make_resource((u64)base, limit - base + 1);
if (!bridge->mem_head) {
- err("out of memory");
+ err("out of memory\n");
return;
}
- dbg("32bit Memory range: %08x-%08x",
+ dbg("32bit Memory range: %08x-%08x\n",
(u32)bridge->mem_head->base,
(u32)(bridge->mem_head->base + bridge->mem_head->length-1));
@@ -675,10 +666,10 @@
limit = ((limit & 0xfff0) << 16) | 0xfffff;
bridge->p_mem_head = acpiphp_make_resource((u64)base, limit - base + 1);
if (!bridge->p_mem_head) {
- err("out of memory");
+ err("out of memory\n");
return;
}
- dbg("32bit Prefetchable memory range: %08x-%08x",
+ dbg("32bit Prefetchable memory range: %08x-%08x\n",
(u32)bridge->p_mem_head->base,
(u32)(bridge->p_mem_head->base + bridge->p_mem_head->length - 1));
break;
@@ -690,10 +681,10 @@
bridge->p_mem_head = acpiphp_make_resource(base64, limit64 - base64 + 1);
if (!bridge->p_mem_head) {
- err("out of memory");
+ err("out of memory\n");
return;
}
- dbg("64bit Prefetchable memory range: %08x%08x-%08x%08x",
+ dbg("64bit Prefetchable memory range: %08x%08x-%08x%08x\n",
(u32)(bridge->p_mem_head->base >> 32),
(u32)(bridge->p_mem_head->base & 0xffffffff),
(u32)((bridge->p_mem_head->base + bridge->p_mem_head->length - 1) >> 32),
@@ -702,7 +693,7 @@
case 0x0f:
break;
default:
- warn("Unknown prefetchale memory type");
+ warn("Unknown prefetchale memory type\n");
}
init_bridge_misc(bridge);
@@ -719,7 +710,6 @@
unsigned long tmp;
int seg, bus, device, function;
struct pci_dev *dev;
- u32 val;
/* get PCI address */
seg = (*segbus >> 8) & 0xff;
@@ -731,7 +721,7 @@
status = acpi_evaluate_integer(handle, "_ADR", NULL, &tmp);
if (ACPI_FAILURE(status)) {
- dbg("%s: _ADR evaluation failure", __FUNCTION__);
+ dbg("%s: _ADR evaluation failure\n", __FUNCTION__);
return AE_OK;
}
@@ -748,7 +738,7 @@
/* check if this bridge has ejectable slots */
if (detect_ejectable_slots(handle) > 0) {
- dbg("found PCI-to-PCI bridge at PCI %02x:%02x.%d", bus, device, function);
+ dbg("found PCI-to-PCI bridge at PCI %s\n", dev->slot_name);
add_p2p_bridge(handle, seg, bus, device, function);
}
@@ -763,14 +753,13 @@
unsigned long tmp;
int seg, bus;
acpi_handle dummy_handle;
- int sta = -1;
/* if the bridge doesn't have _STA, we assume it is always there */
status = acpi_get_handle(handle, "_STA", &dummy_handle);
if (ACPI_SUCCESS(status)) {
status = acpi_evaluate_integer(handle, "_STA", NULL, &tmp);
if (ACPI_FAILURE(status)) {
- dbg("%s: _STA evaluation failure", __FUNCTION__);
+ dbg("%s: _STA evaluation failure\n", __FUNCTION__);
return 0;
}
if ((tmp & ACPI_STA_FUNCTIONING) == 0)
@@ -789,13 +778,13 @@
if (ACPI_SUCCESS(status)) {
bus = tmp;
} else {
- warn("can't get bus number, assuming 0");
+ warn("can't get bus number, assuming 0\n");
bus = 0;
}
/* check if this bridge has ejectable slots */
if (detect_ejectable_slots(handle) > 0) {
- dbg("found PCI host-bus bridge with hot-pluggable slots");
+ dbg("found PCI host-bus bridge with hot-pluggable slots\n");
add_host_bridge(handle, seg, bus);
return 0;
}
@@ -807,7 +796,7 @@
find_p2p_bridge, &tmp, NULL);
if (ACPI_FAILURE(status))
- warn("find_p2p_bridge faied (error code = 0x%x)",status);
+ warn("find_p2p_bridge faied (error code = 0x%x)\n",status);
return 0;
}
@@ -820,21 +809,23 @@
acpi_status status;
acpi_device_info info;
char objname[5];
- acpi_buffer buffer = { sizeof(objname), objname };
+ acpi_buffer buffer = { .length = sizeof(objname),
+ .pointer = objname };
status = acpi_get_object_info(handle, &info);
if (ACPI_FAILURE(status)) {
- dbg("%s: failed to get bridge information", __FUNCTION__);
+ dbg("%s: failed to get bridge information\n", __FUNCTION__);
return AE_OK; /* continue */
}
info.hardware_id[sizeof(info.hardware_id)-1] = '\0';
- /* TBD check _CID also */
- if (strcmp(info.hardware_id, ACPI_PCI_HOST_HID) == 0) {
-
+ /* TBD use acpi_get_devices() API */
+ if (info.current_status &&
+ (info.valid & ACPI_VALID_HID) &&
+ strcmp(info.hardware_id, ACPI_PCI_HOST_HID) == 0) {
acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer);
- dbg("checking PCI-hotplug capable bridges under [%s]", objname);
+ dbg("checking PCI-hotplug capable bridges under [%s]\n", objname);
add_bridges(handle);
}
return AE_OK;
@@ -852,15 +843,15 @@
if (slot->flags & SLOT_POWEREDON)
goto err_exit;
- list_for_each(l, &slot->funcs) {
+ list_for_each (l, &slot->funcs) {
func = list_entry(l, struct acpiphp_func, sibling);
if (func->flags & FUNC_HAS_PS0) {
- dbg("%s: executing _PS0 on %02x:%02x.%d", __FUNCTION__,
- slot->bridge->bus, slot->device, func->function);
+ dbg("%s: executing _PS0 on %s\n", __FUNCTION__,
+ func->pci_dev->slot_name);
status = acpi_evaluate_object(func->handle, "_PS0", NULL, NULL);
if (ACPI_FAILURE(status)) {
- warn("%s: _PS0 failed", __FUNCTION__);
+ warn("%s: _PS0 failed\n", __FUNCTION__);
retval = -1;
goto err_exit;
}
@@ -890,27 +881,27 @@
if ((slot->flags & SLOT_POWEREDON) == 0)
goto err_exit;
- list_for_each(l, &slot->funcs) {
+ list_for_each (l, &slot->funcs) {
func = list_entry(l, struct acpiphp_func, sibling);
if (func->flags & FUNC_HAS_PS3) {
- dbg("%s: executing _PS3 on %02x:%02x.%d", __FUNCTION__,
- slot->bridge->bus, slot->device, func->function);
+ dbg("%s: executing _PS3 on %s\n", __FUNCTION__,
+ func->pci_dev->slot_name);
status = acpi_evaluate_object(func->handle, "_PS3", NULL, NULL);
if (ACPI_FAILURE(status)) {
- warn("%s: _PS3 failed", __FUNCTION__);
+ warn("%s: _PS3 failed\n", __FUNCTION__);
retval = -1;
goto err_exit;
}
}
}
- list_for_each(l, &slot->funcs) {
+ list_for_each (l, &slot->funcs) {
func = list_entry(l, struct acpiphp_func, sibling);
if (func->flags & FUNC_HAS_EJ0) {
- dbg("%s: executing _EJ0 on %02x:%02x.%d", __FUNCTION__,
- slot->bridge->bus, slot->device, func->function);
+ dbg("%s: executing _EJ0 on %s\n", __FUNCTION__,
+ func->pci_dev->slot_name);
/* _EJ0 method take one argument */
arg_list.count = 1;
@@ -920,7 +911,7 @@
status = acpi_evaluate_object(func->handle, "_EJ0", &arg_list, NULL);
if (ACPI_FAILURE(status)) {
- warn("%s: _EJ0 failed", __FUNCTION__);
+ warn("%s: _EJ0 failed\n", __FUNCTION__);
retval = -1;
goto err_exit;
}
@@ -946,7 +937,6 @@
*/
static int enable_device (struct acpiphp_slot *slot)
{
- acpi_status status;
u8 bus;
struct pci_dev dev0, *dev;
struct pci_bus *child;
@@ -961,7 +951,7 @@
dev = pci_find_slot(slot->bridge->bus, PCI_DEVFN(slot->device, 0));
if (dev) {
/* This case shouldn't happen */
- err("pci_dev structure already exists.");
+ err("pci_dev structure already exists.\n");
retval = -1;
goto err_exit;
}
@@ -981,7 +971,7 @@
dev = pci_scan_slot (&dev0);
if (!dev) {
- err("No new device found");
+ err("No new device found\n");
retval = -1;
goto err_exit;
}
@@ -993,7 +983,7 @@
}
/* associate pci_dev to our representation */
- list_for_each(l, &slot->funcs) {
+ list_for_each (l, &slot->funcs) {
func = list_entry(l, struct acpiphp_func, sibling);
func->pci_dev = pci_find_slot(slot->bridge->bus,
@@ -1010,10 +1000,8 @@
slot->flags |= SLOT_ENABLED;
-#if 1
- dbg("Available resources:");
+ dbg("Available resources:\n");
acpiphp_dump_resource(slot->bridge);
-#endif
err_exit:
return retval;
@@ -1028,20 +1016,19 @@
int retval = 0;
struct acpiphp_func *func;
struct list_head *l;
- acpi_status status;
/* is this slot already disabled? */
if (!(slot->flags & SLOT_ENABLED))
goto err_exit;
- list_for_each(l, &slot->funcs) {
+ list_for_each (l, &slot->funcs) {
func = list_entry(l, struct acpiphp_func, sibling);
if (func->pci_dev) {
if (acpiphp_unconfigure_function(func) == 0) {
func->pci_dev = NULL;
} else {
- err("failed to unconfigure device");
+ err("failed to unconfigure device\n");
retval = -1;
goto err_exit;
}
@@ -1070,12 +1057,11 @@
{
acpi_status status;
unsigned long sta = 0;
- int fn;
u32 dvid;
struct list_head *l;
struct acpiphp_func *func;
- list_for_each(l, &slot->funcs) {
+ list_for_each (l, &slot->funcs) {
func = list_entry(l, struct acpiphp_func, sibling);
if (func->flags & FUNC_HAS_STA) {
@@ -1083,11 +1069,9 @@
if (ACPI_SUCCESS(status) && sta)
break;
} else {
- pci_read_config_dword_nodev(default_ops,
- slot->bridge->bus,
- slot->device,
- func->function,
- PCI_VENDOR_ID, &dvid);
+ pci_bus_read_config_dword(slot->bridge->pci_bus,
+ PCI_DEVFN(slot->device, func->function),
+ PCI_VENDOR_ID, &dvid);
if (dvid != 0xffffffff) {
sta = ACPI_STA_ALL;
break;
@@ -1106,7 +1090,7 @@
/**
* handle_hotplug_event_bridge - handle ACPI event on bridges
*
- * @handle: Notify()'ed acpi_handle
+ * @handle: Notify()'ed acpi_handle
* @type: Notify code
* @context: pointer to acpiphp_bridge structure
*
@@ -1117,7 +1101,8 @@
{
struct acpiphp_bridge *bridge;
char objname[64];
- acpi_buffer buffer = { sizeof(objname), objname };
+ acpi_buffer buffer = { .length = sizeof(objname),
+ .pointer = objname };
bridge = (struct acpiphp_bridge *)context;
@@ -1126,28 +1111,28 @@
switch (type) {
case ACPI_NOTIFY_BUS_CHECK:
/* bus re-enumerate */
- dbg("%s: Bus check notify on %s", __FUNCTION__, objname);
+ dbg("%s: Bus check notify on %s\n", __FUNCTION__, objname);
acpiphp_check_bridge(bridge);
break;
case ACPI_NOTIFY_DEVICE_CHECK:
/* device check */
- dbg("%s: Device check notify on %s", __FUNCTION__, objname);
+ dbg("%s: Device check notify on %s\n", __FUNCTION__, objname);
acpiphp_check_bridge(bridge);
break;
case ACPI_NOTIFY_DEVICE_WAKE:
/* wake event */
- dbg("%s: Device wake notify on %s", __FUNCTION__, objname);
+ dbg("%s: Device wake notify on %s\n", __FUNCTION__, objname);
break;
case ACPI_NOTIFY_EJECT_REQUEST:
/* request device eject */
- dbg("%s: Device eject notify on %s", __FUNCTION__, objname);
+ dbg("%s: Device eject notify on %s\n", __FUNCTION__, objname);
break;
default:
- warn("notify_handler: unknown event type 0x%x for %s", type, objname);
+ warn("notify_handler: unknown event type 0x%x for %s\n", type, objname);
break;
}
}
@@ -1156,7 +1141,7 @@
/**
* handle_hotplug_event_func - handle ACPI event on functions (i.e. slots)
*
- * @handle: Notify()'ed acpi_handle
+ * @handle: Notify()'ed acpi_handle
* @type: Notify code
* @context: pointer to acpiphp_func structure
*
@@ -1167,7 +1152,8 @@
{
struct acpiphp_func *func;
char objname[64];
- acpi_buffer buffer = { sizeof(objname), objname };
+ acpi_buffer buffer = { .length = sizeof(objname),
+ .pointer = objname };
acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer);
@@ -1176,29 +1162,29 @@
switch (type) {
case ACPI_NOTIFY_BUS_CHECK:
/* bus re-enumerate */
- dbg("%s: Bus check notify on %s", __FUNCTION__, objname);
+ dbg("%s: Bus check notify on %s\n", __FUNCTION__, objname);
acpiphp_enable_slot(func->slot);
break;
case ACPI_NOTIFY_DEVICE_CHECK:
/* device check : re-enumerate from parent bus */
- dbg("%s: Device check notify on %s", __FUNCTION__, objname);
+ dbg("%s: Device check notify on %s\n", __FUNCTION__, objname);
acpiphp_check_bridge(func->slot->bridge);
break;
case ACPI_NOTIFY_DEVICE_WAKE:
/* wake event */
- dbg("%s: Device wake notify on %s", __FUNCTION__, objname);
+ dbg("%s: Device wake notify on %s\n", __FUNCTION__, objname);
break;
case ACPI_NOTIFY_EJECT_REQUEST:
/* request device eject */
- dbg("%s: Device eject notify on %s", __FUNCTION__, objname);
+ dbg("%s: Device eject notify on %s\n", __FUNCTION__, objname);
acpiphp_disable_slot(func->slot);
break;
default:
- warn("notify_handler: unknown event type 0x%x for %s", type, objname);
+ warn("notify_handler: unknown event type 0x%x for %s\n", type, objname);
break;
}
}
@@ -1215,17 +1201,12 @@
if (list_empty(&pci_root_buses))
return -1;
- /* set default pci_ops for configuration space operation */
- default_ops = pci_bus_b(pci_root_buses.next)->ops;
- if (!default_ops)
- return -1;
-
status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX, find_host_bridge,
NULL, NULL);
if (ACPI_FAILURE(status)) {
- err("%s: acpi_walk_namespace() failed", __FUNCTION__);
+ err("%s: acpi_walk_namespace() failed\n", __FUNCTION__);
return -1;
}
@@ -1240,19 +1221,19 @@
*/
void acpiphp_glue_exit (void)
{
- struct list_head *node, *shead, *l, *n;
+ struct list_head *l1, *l2, *n1, *n2;
struct acpiphp_bridge *bridge;
struct acpiphp_slot *slot, *next;
struct acpiphp_func *func;
acpi_status status;
- list_for_each(node, &bridge_list) {
- bridge = (struct acpiphp_bridge *)node;
+ list_for_each_safe (l1, n1, &bridge_list) {
+ bridge = (struct acpiphp_bridge *)l1;
slot = bridge->slots;
while (slot) {
next = slot->next;
- list_for_each_safe(l, n, &slot->funcs) {
- func = list_entry(l, struct acpiphp_func, sibling);
+ list_for_each_safe (l2, n2, &slot->funcs) {
+ func = list_entry(l2, struct acpiphp_func, sibling);
acpiphp_free_resource(&func->io_head);
acpiphp_free_resource(&func->mem_head);
acpiphp_free_resource(&func->p_mem_head);
@@ -1261,7 +1242,7 @@
ACPI_SYSTEM_NOTIFY,
handle_hotplug_event_func);
if (ACPI_FAILURE(status))
- err("failed to remove notify handler");
+ err("failed to remove notify handler\n");
kfree(func);
}
kfree(slot);
@@ -1270,7 +1251,7 @@
status = acpi_remove_notify_handler(bridge->handle, ACPI_SYSTEM_NOTIFY,
handle_hotplug_event_bridge);
if (ACPI_FAILURE(status))
- err("failed to remove notify handler");
+ err("failed to remove notify handler\n");
acpiphp_free_resource(&bridge->io_head);
acpiphp_free_resource(&bridge->mem_head);
@@ -1293,13 +1274,13 @@
num_slots = 0;
- list_for_each(node, &bridge_list) {
+ list_for_each (node, &bridge_list) {
bridge = (struct acpiphp_bridge *)node;
- dbg("Bus%d %dslot(s)", bridge->bus, bridge->nr_slots);
+ dbg("Bus%d %dslot(s)\n", bridge->bus, bridge->nr_slots);
num_slots += bridge->nr_slots;
}
- dbg("Total %dslots", num_slots);
+ dbg("Total %dslots\n", num_slots);
return num_slots;
}
@@ -1317,7 +1298,7 @@
struct acpiphp_slot *slot;
int retval = 0;
- list_for_each(node, &bridge_list) {
+ list_for_each (node, &bridge_list) {
bridge = (struct acpiphp_bridge *)node;
for (slot = bridge->slots; slot; slot = slot->next) {
retval = fn(slot, data);
@@ -1338,7 +1319,7 @@
struct acpiphp_bridge *bridge;
struct acpiphp_slot *slot;
- list_for_each(node, &bridge_list) {
+ list_for_each (node, &bridge_list) {
bridge = (struct acpiphp_bridge *)node;
for (slot = bridge->slots; slot; slot = slot->next)
if (slot->id == id)
@@ -1346,7 +1327,7 @@
}
/* should never happen! */
- err("%s: no object for id %d",__FUNCTION__, id);
+ err("%s: no object for id %d\n",__FUNCTION__, id);
return 0;
}
@@ -1357,7 +1338,6 @@
int acpiphp_enable_slot (struct acpiphp_slot *slot)
{
int retval;
- int online = 0;
down(&slot->crit_sect);
@@ -1381,8 +1361,6 @@
*/
int acpiphp_disable_slot (struct acpiphp_slot *slot)
{
- struct list_head *l;
- struct acpiphp_func *func;
int retval = 0;
down(&slot->crit_sect);
@@ -1397,14 +1375,12 @@
if (retval)
goto err_exit;
-#if 1
acpiphp_resource_sort_and_combine(&slot->bridge->io_head);
acpiphp_resource_sort_and_combine(&slot->bridge->mem_head);
acpiphp_resource_sort_and_combine(&slot->bridge->p_mem_head);
acpiphp_resource_sort_and_combine(&slot->bridge->bus_head);
- dbg("Available resources:");
+ dbg("Available resources:\n");
acpiphp_dump_resource(slot->bridge);
-#endif
err_exit:
up(&slot->crit_sect);
@@ -1431,7 +1407,7 @@
if (sta != ACPI_STA_ALL) {
retval = acpiphp_disable_slot(slot);
if (retval) {
- err("Error occured in enabling");
+ err("Error occured in enabling\n");
up(&slot->crit_sect);
goto err_exit;
}
@@ -1442,7 +1418,7 @@
if (sta == ACPI_STA_ALL) {
retval = acpiphp_enable_slot(slot);
if (retval) {
- err("Error occured in enabling");
+ err("Error occured in enabling\n");
up(&slot->crit_sect);
goto err_exit;
}
@@ -1451,7 +1427,7 @@
}
}
- dbg("%s: %d enabled, %d disabled", __FUNCTION__, enabled, disabled);
+ dbg("%s: %d enabled, %d disabled\n", __FUNCTION__, enabled, disabled);
err_exit:
return retval;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)