Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b2f71bad authored by Len Brown's avatar Len Brown
Browse files

Pull acpi_device_handle_cleanup into release branch

parents ba290ab7 d07a8577
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ static struct acpi_driver acpi_ac_driver = {
};

struct acpi_ac {
	acpi_handle handle;
	struct acpi_device * device;
	unsigned long state;
};

@@ -88,7 +88,7 @@ static int acpi_ac_get_state(struct acpi_ac *ac)
	if (!ac)
		return -EINVAL;

	status = acpi_evaluate_integer(ac->handle, "_PSR", NULL, &ac->state);
	status = acpi_evaluate_integer(ac->device->handle, "_PSR", NULL, &ac->state);
	if (ACPI_FAILURE(status)) {
		ACPI_EXCEPTION((AE_INFO, status, "Error reading AC Adapter state"));
		ac->state = ACPI_AC_STATUS_UNKNOWN;
@@ -191,9 +191,7 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
	if (!ac)
		return;

	if (acpi_bus_get_device(ac->handle, &device))
		return;

	device = ac->device;
	switch (event) {
	case ACPI_AC_NOTIFY_STATUS:
		acpi_ac_get_state(ac);
@@ -223,7 +221,7 @@ static int acpi_ac_add(struct acpi_device *device)
		return -ENOMEM;
	memset(ac, 0, sizeof(struct acpi_ac));

	ac->handle = device->handle;
	ac->device = device;
	strcpy(acpi_device_name(device), ACPI_AC_DEVICE_NAME);
	strcpy(acpi_device_class(device), ACPI_AC_CLASS);
	acpi_driver_data(device) = ac;
@@ -236,7 +234,7 @@ static int acpi_ac_add(struct acpi_device *device)
	if (result)
		goto end;

	status = acpi_install_notify_handler(ac->handle,
	status = acpi_install_notify_handler(device->handle,
					     ACPI_DEVICE_NOTIFY, acpi_ac_notify,
					     ac);
	if (ACPI_FAILURE(status)) {
@@ -268,7 +266,7 @@ static int acpi_ac_remove(struct acpi_device *device, int type)

	ac = (struct acpi_ac *)acpi_driver_data(device);

	status = acpi_remove_notify_handler(ac->handle,
	status = acpi_remove_notify_handler(device->handle,
					    ACPI_DEVICE_NOTIFY, acpi_ac_notify);

	acpi_ac_remove_fs(device);
+7 −7
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ struct acpi_memory_info {
};

struct acpi_memory_device {
	acpi_handle handle;
	struct acpi_device * device;
	unsigned int state;	/* State of the memory device */
	struct list_head res_list;
};
@@ -129,7 +129,7 @@ acpi_memory_get_device_resources(struct acpi_memory_device *mem_device)
	struct acpi_memory_info *info, *n;


	status = acpi_walk_resources(mem_device->handle, METHOD_NAME__CRS,
	status = acpi_walk_resources(mem_device->device->handle, METHOD_NAME__CRS,
				     acpi_memory_get_resource, mem_device);
	if (ACPI_FAILURE(status)) {
		list_for_each_entry_safe(info, n, &mem_device->res_list, list)
@@ -192,7 +192,7 @@ static int acpi_memory_check_device(struct acpi_memory_device *mem_device)


	/* Get device present/absent information from the _STA */
	if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->handle, "_STA",
	if (ACPI_FAILURE(acpi_evaluate_integer(mem_device->device->handle, "_STA",
					       NULL, &current_status)))
		return -ENODEV;
	/*
@@ -222,7 +222,7 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
		return result;
	}

	node = acpi_get_node(mem_device->handle);
	node = acpi_get_node(mem_device->device->handle);
	/*
	 * Tell the VM there is more memory here...
	 * Note: Assume that this function returns zero on success
@@ -269,7 +269,7 @@ static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
	arg_list.pointer = &arg;
	arg.type = ACPI_TYPE_INTEGER;
	arg.integer.value = 1;
	status = acpi_evaluate_object(mem_device->handle,
	status = acpi_evaluate_object(mem_device->device->handle,
				      "_EJ0", &arg_list, NULL);
	/* Return on _EJ0 failure */
	if (ACPI_FAILURE(status)) {
@@ -278,7 +278,7 @@ static int acpi_memory_powerdown_device(struct acpi_memory_device *mem_device)
	}

	/* Evalute _STA to check if the device is disabled */
	status = acpi_evaluate_integer(mem_device->handle, "_STA",
	status = acpi_evaluate_integer(mem_device->device->handle, "_STA",
				       NULL, &current_status);
	if (ACPI_FAILURE(status))
		return -ENODEV;
@@ -398,7 +398,7 @@ static int acpi_memory_device_add(struct acpi_device *device)
	memset(mem_device, 0, sizeof(struct acpi_memory_device));

	INIT_LIST_HEAD(&mem_device->res_list);
	mem_device->handle = device->handle;
	mem_device->device = device;
	sprintf(acpi_device_name(device), "%s", ACPI_MEMORY_DEVICE_NAME);
	sprintf(acpi_device_class(device), "%s", ACPI_MEMORY_DEVICE_CLASS);
	acpi_driver_data(device) = mem_device;
+10 −13
Original line number Diff line number Diff line
@@ -108,7 +108,7 @@ struct acpi_battery_trips {
};

struct acpi_battery {
	acpi_handle handle;
	struct acpi_device * device;
	struct acpi_battery_flags flags;
	struct acpi_battery_trips trips;
	unsigned long alarm;
@@ -138,7 +138,7 @@ acpi_battery_get_info(struct acpi_battery *battery,

	/* Evalute _BIF */

	status = acpi_evaluate_object(battery->handle, "_BIF", NULL, &buffer);
	status = acpi_evaluate_object(battery->device->handle, "_BIF", NULL, &buffer);
	if (ACPI_FAILURE(status)) {
		ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF"));
		return -ENODEV;
@@ -198,7 +198,7 @@ acpi_battery_get_status(struct acpi_battery *battery,

	/* Evalute _BST */

	status = acpi_evaluate_object(battery->handle, "_BST", NULL, &buffer);
	status = acpi_evaluate_object(battery->device->handle, "_BST", NULL, &buffer);
	if (ACPI_FAILURE(status)) {
		ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST"));
		return -ENODEV;
@@ -255,7 +255,7 @@ acpi_battery_set_alarm(struct acpi_battery *battery, unsigned long alarm)

	arg0.integer.value = alarm;

	status = acpi_evaluate_object(battery->handle, "_BTP", &arg_list, NULL);
	status = acpi_evaluate_object(battery->device->handle, "_BTP", &arg_list, NULL);
	if (ACPI_FAILURE(status))
		return -ENODEV;

@@ -278,9 +278,7 @@ static int acpi_battery_check(struct acpi_battery *battery)
	if (!battery)
		return -EINVAL;

	result = acpi_bus_get_device(battery->handle, &device);
	if (result)
		return result;
	device = battery->device;

	result = acpi_bus_get_status(device);
	if (result)
@@ -305,7 +303,7 @@ static int acpi_battery_check(struct acpi_battery *battery)

		/* See if alarms are supported, and if so, set default */

		status = acpi_get_handle(battery->handle, "_BTP", &handle);
		status = acpi_get_handle(battery->device->handle, "_BTP", &handle);
		if (ACPI_SUCCESS(status)) {
			battery->flags.alarm = 1;
			acpi_battery_set_alarm(battery, battery->trips.warning);
@@ -662,8 +660,7 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
	if (!battery)
		return;

	if (acpi_bus_get_device(handle, &device))
		return;
	device = battery->device;

	switch (event) {
	case ACPI_BATTERY_NOTIFY_STATUS:
@@ -695,7 +692,7 @@ static int acpi_battery_add(struct acpi_device *device)
		return -ENOMEM;
	memset(battery, 0, sizeof(struct acpi_battery));

	battery->handle = device->handle;
	battery->device = device;
	strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME);
	strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS);
	acpi_driver_data(device) = battery;
@@ -708,7 +705,7 @@ static int acpi_battery_add(struct acpi_device *device)
	if (result)
		goto end;

	status = acpi_install_notify_handler(battery->handle,
	status = acpi_install_notify_handler(device->handle,
					     ACPI_DEVICE_NOTIFY,
					     acpi_battery_notify, battery);
	if (ACPI_FAILURE(status)) {
@@ -740,7 +737,7 @@ static int acpi_battery_remove(struct acpi_device *device, int type)

	battery = (struct acpi_battery *)acpi_driver_data(device);

	status = acpi_remove_notify_handler(battery->handle,
	status = acpi_remove_notify_handler(device->handle,
					    ACPI_DEVICE_NOTIFY,
					    acpi_battery_notify);

+4 −6
Original line number Diff line number Diff line
@@ -82,7 +82,6 @@ static struct acpi_driver acpi_button_driver = {
};

struct acpi_button {
	acpi_handle handle;
	struct acpi_device *device;	/* Fixed button kludge */
	u8 type;
	unsigned long pushed;
@@ -137,7 +136,7 @@ static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
	if (!button || !button->device)
		return 0;

	status = acpi_evaluate_integer(button->handle, "_LID", NULL, &state);
	status = acpi_evaluate_integer(button->device->handle, "_LID", NULL, &state);
	if (ACPI_FAILURE(status)) {
		seq_printf(seq, "state:      unsupported\n");
	} else {
@@ -282,7 +281,7 @@ static acpi_status acpi_button_notify_fixed(void *data)
	if (!button)
		return AE_BAD_PARAMETER;

	acpi_button_notify(button->handle, ACPI_BUTTON_NOTIFY_STATUS, button);
	acpi_button_notify(button->device->handle, ACPI_BUTTON_NOTIFY_STATUS, button);

	return AE_OK;
}
@@ -303,7 +302,6 @@ static int acpi_button_add(struct acpi_device *device)
	memset(button, 0, sizeof(struct acpi_button));

	button->device = device;
	button->handle = device->handle;
	acpi_driver_data(device) = button;

	/*
@@ -362,7 +360,7 @@ static int acpi_button_add(struct acpi_device *device)
						     button);
		break;
	default:
		status = acpi_install_notify_handler(button->handle,
		status = acpi_install_notify_handler(device->handle,
						     ACPI_DEVICE_NOTIFY,
						     acpi_button_notify,
						     button);
@@ -420,7 +418,7 @@ static int acpi_button_remove(struct acpi_device *device, int type)
						    acpi_button_notify_fixed);
		break;
	default:
		status = acpi_remove_notify_handler(button->handle,
		status = acpi_remove_notify_handler(device->handle,
						    ACPI_DEVICE_NOTIFY,
						    acpi_button_notify);
		break;
+5 −5
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ static struct acpi_driver acpi_fan_driver = {
};

struct acpi_fan {
	acpi_handle handle;
	struct acpi_device * device;
};

/* --------------------------------------------------------------------------
@@ -80,7 +80,7 @@ static int acpi_fan_read_state(struct seq_file *seq, void *offset)


	if (fan) {
		if (acpi_bus_get_power(fan->handle, &state))
		if (acpi_bus_get_power(fan->device->handle, &state))
			seq_printf(seq, "status:                  ERROR\n");
		else
			seq_printf(seq, "status:                  %s\n",
@@ -112,7 +112,7 @@ acpi_fan_write_state(struct file *file, const char __user * buffer,

	state_string[count] = '\0';

	result = acpi_bus_set_power(fan->handle,
	result = acpi_bus_set_power(fan->device->handle,
				    simple_strtoul(state_string, NULL, 0));
	if (result)
		return result;
@@ -191,12 +191,12 @@ static int acpi_fan_add(struct acpi_device *device)
		return -ENOMEM;
	memset(fan, 0, sizeof(struct acpi_fan));

	fan->handle = device->handle;
	fan->device = device;
	strcpy(acpi_device_name(device), "Fan");
	strcpy(acpi_device_class(device), ACPI_FAN_CLASS);
	acpi_driver_data(device) = fan;

	result = acpi_bus_get_power(fan->handle, &state);
	result = acpi_bus_get_power(device->handle, &state);
	if (result) {
		printk(KERN_ERR PREFIX "Reading power state\n");
		goto end;
Loading