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

Commit 34cf66e7 authored by Bob Moore's avatar Bob Moore Committed by Len Brown
Browse files

ACPICA: Eliminate duplicate code in acpi_ut_execute_* functions

Now that the nsrepair code automatically repairs _HID-related
strings, this type of code is no longer needed in acpi_ut_execute_HID,
acpi_ut_execute_CID, and acpi_ut_execute_UID. ACPICA BZ 878.

http://www.acpica.org/bugzilla/show_bug.cgi?id=878



Signed-off-by: default avatarBob Moore <robert.moore@intel.com>
Signed-off-by: default avatarLin Ming <ming.m.lin@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 81256669
Loading
Loading
Loading
Loading
+4 −41
Original line number Diff line number Diff line
@@ -48,42 +48,6 @@
#define _COMPONENT          ACPI_UTILITIES
ACPI_MODULE_NAME("utids")

/* Local prototypes */
static void acpi_ut_copy_id_string(char *destination, char *source);

/*******************************************************************************
 *
 * FUNCTION:    acpi_ut_copy_id_string
 *
 * PARAMETERS:  Destination         - Where to copy the string
 *              Source              - Source string
 *
 * RETURN:      None
 *
 * DESCRIPTION: Copies an ID string for the _HID, _CID, and _UID methods.
 *              Performs removal of a leading asterisk if present -- workaround
 *              for a known issue on a bunch of machines.
 *
 ******************************************************************************/

static void acpi_ut_copy_id_string(char *destination, char *source)
{

	/*
	 * Workaround for ID strings that have a leading asterisk. This construct
	 * is not allowed by the ACPI specification  (ID strings must be
	 * alphanumeric), but enough existing machines have this embedded in their
	 * ID strings that the following code is useful.
	 */
	if (*source == '*') {
		source++;
	}

	/* Do the actual copy */

	ACPI_STRCPY(destination, source);
}

/*******************************************************************************
 *
 * FUNCTION:    acpi_ut_execute_HID
@@ -101,7 +65,6 @@ static void acpi_ut_copy_id_string(char *destination, char *source)
 *              NOTE: Internal function, no parameter validation
 *
 ******************************************************************************/

acpi_status
acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
		    struct acpica_device_id **return_id)
@@ -147,7 +110,7 @@ acpi_ut_execute_HID(struct acpi_namespace_node *device_node,
	if (obj_desc->common.type == ACPI_TYPE_INTEGER) {
		acpi_ex_eisa_id_to_string(hid->string, obj_desc->integer.value);
	} else {
		acpi_ut_copy_id_string(hid->string, obj_desc->string.pointer);
		ACPI_STRCPY(hid->string, obj_desc->string.pointer);
	}

	hid->length = length;
@@ -224,7 +187,7 @@ acpi_ut_execute_UID(struct acpi_namespace_node *device_node,
	if (obj_desc->common.type == ACPI_TYPE_INTEGER) {
		acpi_ex_integer_to_string(uid->string, obj_desc->integer.value);
	} else {
		acpi_ut_copy_id_string(uid->string, obj_desc->string.pointer);
		ACPI_STRCPY(uid->string, obj_desc->string.pointer);
	}

	uid->length = length;
@@ -357,7 +320,7 @@ acpi_ut_execute_CID(struct acpi_namespace_node *device_node,

			/* Copy the String CID from the returned object */

			acpi_ut_copy_id_string(next_id_string,
			ACPI_STRCPY(next_id_string,
				    cid_objects[i]->string.pointer);
			length = cid_objects[i]->string.length + 1;
		}