示例#1
0
static void acpi_thermal_unregister_thermal_zone(struct acpi_thermal *tz)
{
	sysfs_remove_link(&tz->device->dev.kobj, "thermal_zone");
	sysfs_remove_link(&tz->thermal_zone->device.kobj, "device");
	thermal_zone_device_unregister(tz->thermal_zone);
	tz->thermal_zone = NULL;
	acpi_detach_data(tz->device->handle, acpi_bus_private_data_handler);
}
示例#2
0
int acpi_pci_unbind(
    struct acpi_device      *device)
{
    int                     result = 0;
    acpi_status             status = AE_OK;
    struct acpi_pci_data    *data = NULL;
    char                    *pathname = NULL;
    struct acpi_buffer      buffer = {0, NULL};

    ACPI_FUNCTION_TRACE("acpi_pci_unbind");

    if (!device || !device->parent)
        return_VALUE(-EINVAL);

    pathname = (char *) kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
    if(!pathname)
        return_VALUE(-ENOMEM);
    memset(pathname, 0, ACPI_PATHNAME_MAX);

    buffer.length = ACPI_PATHNAME_MAX;
    buffer.pointer = pathname;
    acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer);
    ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Unbinding PCI device [%s]...\n",
                      pathname));
    kfree(pathname);

    status = acpi_get_data(device->handle, acpi_pci_data_handler, (void**)&data);
    if (ACPI_FAILURE(status)) {
        ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
                          "Unable to get data from device %s\n",
                          acpi_device_bid(device)));
        result = -ENODEV;
        goto end;
    }

    status = acpi_detach_data(device->handle, acpi_pci_data_handler);
    if (ACPI_FAILURE(status)) {
        ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
                          "Unable to detach data from device %s\n",
                          acpi_device_bid(device)));
        result = -ENODEV;
        goto end;
    }
    if (data->dev->subordinate) {
        acpi_pci_irq_del_prt(data->id.segment, data->bus->number);
    }
    kfree(data);

end:
    return_VALUE(result);
}
static int acpi_pci_unbind(struct acpi_device *device)
{
	int result = 0;
	acpi_status status;
	struct acpi_pci_data *data;
	struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };


	if (!device || !device->parent)
		return -EINVAL;

	status = acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer);
	if (ACPI_FAILURE(status))
		return -ENODEV;

	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Unbinding PCI device [%s]...\n",
			  (char *) buffer.pointer));
	kfree(buffer.pointer);

	status =
	    acpi_get_data(device->handle, acpi_pci_data_handler,
			  (void **)&data);
	if (ACPI_FAILURE(status)) {
		result = -ENODEV;
		goto end;
	}

	status = acpi_detach_data(device->handle, acpi_pci_data_handler);
	if (ACPI_FAILURE(status)) {
		ACPI_EXCEPTION((AE_INFO, status,
				"Unable to detach data from device %s",
				acpi_device_bid(device)));
		result = -ENODEV;
		goto end;
	}
	if (data->dev->subordinate) {
		acpi_pci_irq_del_prt(data->id.segment, data->bus->number);
	}
	pci_dev_put(data->dev);
	kfree(data);

      end:
	return result;
}
示例#4
0
void acpi_bus_detach_private_data(acpi_handle handle)
{
	acpi_detach_data(handle, acpi_bus_private_data_handler);
}