Commit 9bde7fb8 authored by Hector Martin's avatar Hector Martin Committed by Rafael J. Wysocki
Browse files

ACPI: property: Support strings in Apple _DSM props



The Wi-Fi module in x86 Apple machines has a "module-instance" device
property that specifies the platform type and is used for firmware
selection. Its value is a string, so add support for string values in
acpi_extract_apple_properties().

Reviewed-by: default avatarLukas Wunner <lukas@wunner.de>
Acked-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Signed-off-by: default avatarHector Martin <marcan@marcan.st>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 793582ff
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -71,13 +71,16 @@ void acpi_extract_apple_properties(struct acpi_device *adev)

		if ( key->type != ACPI_TYPE_STRING ||
		    (val->type != ACPI_TYPE_INTEGER &&
		     val->type != ACPI_TYPE_BUFFER))
		     val->type != ACPI_TYPE_BUFFER &&
		     val->type != ACPI_TYPE_STRING))
			continue; /* skip invalid properties */

		__set_bit(i, valid);
		newsize += key->string.length + 1;
		if ( val->type == ACPI_TYPE_BUFFER)
			newsize += val->buffer.length;
		else if (val->type == ACPI_TYPE_STRING)
			newsize += val->string.length + 1;
	}

	numvalid = bitmap_weight(valid, numprops);
@@ -119,6 +122,12 @@ void acpi_extract_apple_properties(struct acpi_device *adev)
		newprops[v].type = val->type;
		if (val->type == ACPI_TYPE_INTEGER) {
			newprops[v].integer.value = val->integer.value;
		} else if (val->type == ACPI_TYPE_STRING) {
			newprops[v].string.length = val->string.length;
			newprops[v].string.pointer = free_space;
			memcpy(free_space, val->string.pointer,
			       val->string.length);
			free_space += val->string.length + 1;
		} else {
			newprops[v].buffer.length = val->buffer.length;
			newprops[v].buffer.pointer = free_space;