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

Commit 63a1a765 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

ACPI / PM: Fix error messages in drivers/acpi/bus.c



After recent changes of the ACPI device low-power states definitions
kernel messages in drivers/acpi/bus.c need to be updated so that they
include the correct names of the states in question (currently is
"D3" for D3hot and "D4" for D3cold, which is incorrect).

Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
parent b2201e54
Loading
Loading
Loading
Loading
+28 −9
Original line number Original line Diff line number Diff line
@@ -182,6 +182,24 @@ EXPORT_SYMBOL(acpi_bus_get_private_data);
                                 Power Management
                                 Power Management
   -------------------------------------------------------------------------- */
   -------------------------------------------------------------------------- */


static const char *state_string(int state)
{
	switch (state) {
	case ACPI_STATE_D0:
		return "D0";
	case ACPI_STATE_D1:
		return "D1";
	case ACPI_STATE_D2:
		return "D2";
	case ACPI_STATE_D3_HOT:
		return "D3hot";
	case ACPI_STATE_D3_COLD:
		return "D3";
	default:
		return "(unknown)";
	}
}

static int __acpi_bus_get_power(struct acpi_device *device, int *state)
static int __acpi_bus_get_power(struct acpi_device *device, int *state)
{
{
	int result = 0;
	int result = 0;
@@ -215,8 +233,8 @@ static int __acpi_bus_get_power(struct acpi_device *device, int *state)
			device->parent->power.state : ACPI_STATE_D0;
			device->parent->power.state : ACPI_STATE_D0;
	}
	}


	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] power state is D%d\n",
	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] power state is %s\n",
			  device->pnp.bus_id, *state));
			  device->pnp.bus_id, state_string(*state)));


	return 0;
	return 0;
}
}
@@ -234,13 +252,14 @@ static int __acpi_bus_set_power(struct acpi_device *device, int state)
	/* Make sure this is a valid target state */
	/* Make sure this is a valid target state */


	if (state == device->power.state) {
	if (state == device->power.state) {
		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at D%d\n",
		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device is already at %s\n",
				  state));
				  state_string(state)));
		return 0;
		return 0;
	}
	}


	if (!device->power.states[state].flags.valid) {
	if (!device->power.states[state].flags.valid) {
		printk(KERN_WARNING PREFIX "Device does not support D%d\n", state);
		printk(KERN_WARNING PREFIX "Device does not support %s\n",
		       state_string(state));
		return -ENODEV;
		return -ENODEV;
	}
	}
	if (device->parent && (state < device->parent->power.state)) {
	if (device->parent && (state < device->parent->power.state)) {
@@ -294,13 +313,13 @@ static int __acpi_bus_set_power(struct acpi_device *device, int state)
      end:
      end:
	if (result)
	if (result)
		printk(KERN_WARNING PREFIX
		printk(KERN_WARNING PREFIX
			      "Device [%s] failed to transition to D%d\n",
			      "Device [%s] failed to transition to %s\n",
			      device->pnp.bus_id, state);
			      device->pnp.bus_id, state_string(state));
	else {
	else {
		device->power.state = state;
		device->power.state = state;
		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
		ACPI_DEBUG_PRINT((ACPI_DB_INFO,
				  "Device [%s] transitioned to D%d\n",
				  "Device [%s] transitioned to %s\n",
				  device->pnp.bus_id, state));
				  device->pnp.bus_id, state_string(state)));
	}
	}


	return result;
	return result;