Skip to contentSkip to conversation

ACPI: make _OSI strings static

PATCH In review Bjorn Helgaas 1 participant 1 message Apr 18, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ACPI: make _OSI strings static

Move acpi_gbl_valid_osi_strings[] from utglobal.c to uteval.c and make it static. Then we can remove ACPI_NUM_OSI_STRINGS, which is a maintenance problem for OSPMs that want to change the features reported by _OSI.

This patch is against the Linux-ized ACPI CA, since I don't have a good way to modify or test the original Intel version. I hope it's small enough that you can easily make the corresponding change to the Intel version.

This modification may be used under either the GPL or the BSD-style license used for the Intel ACPI CA.

drivers/acpi/utilities/uteval.c +25 -3
Index: work-mm5/drivers/acpi/utilities/uteval.c
===================================================================
@@ -48,6 +48,29 @@
 #define _COMPONENT          ACPI_UTILITIES
 ACPI_MODULE_NAME("uteval")
 
+#define ACPI_ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+
+/*
+ * Strings supported by the _OSI predefined (internal) method.
+ */
+static const char *acpi_valid_osi_strings[] = {
+	/* Operating System Vendor Strings */
+
+	"Linux",
+	"Windows 2000",
+	"Windows 2001",
+	"Windows 2001.1",
+	"Windows 2001 SP0",
+	"Windows 2001 SP1",
+	"Windows 2001 SP2",
+	"Windows 2001 SP3",
+	"Windows 2001 SP4",
+
+	/* Feature Group Strings */
+
+	"Extended Address Space Descriptor",
+};
+
 /* Local prototypes */
 static void
 acpi_ut_copy_id_string(char *destination, char *source, acpi_size max_length);
@@ -93,10 +116,9 @@
 
 	/* Compare input string to table of supported strings */
 
-	for (i = 0; i < ACPI_NUM_OSI_STRINGS; i++) {
+	for (i = 0; i < ACPI_ARRAY_SIZE(acpi_valid_osi_strings); i++) {
 		if (!ACPI_STRCMP(string_desc->string.pointer,
-				 ACPI_CAST_PTR(char,
-					       acpi_gbl_valid_osi_strings[i])))
+					       acpi_valid_osi_strings[i]))
 		{
 
 			/* This string is supported */
drivers/acpi/utilities/utglobal.c +0 -22
Index: work-mm5/drivers/acpi/utilities/utglobal.c
===================================================================
@@ -184,28 +184,6 @@
 	"_S4D"
 };
 
-/*
- * Strings supported by the _OSI predefined (internal) method.
- * When adding strings, be sure to update ACPI_NUM_OSI_STRINGS.
- */
-const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS] = {
-	/* Operating System Vendor Strings */
-
-	"Linux",
-	"Windows 2000",
-	"Windows 2001",
-	"Windows 2001.1",
-	"Windows 2001 SP0",
-	"Windows 2001 SP1",
-	"Windows 2001 SP2",
-	"Windows 2001 SP3",
-	"Windows 2001 SP4",
-
-	/* Feature Group Strings */
-
-	"Extended Address Space Descriptor"
-};
-
 /*******************************************************************************
  *
  * Namespace globals
include/acpi/acconfig.h +0 -4
Index: work-mm5/include/acpi/acconfig.h
===================================================================
@@ -187,10 +187,6 @@
 
 #define ACPI_SMBUS_BUFFER_SIZE          34
 
-/* Number of strings associated with the _OSI reserved method */
-
-#define ACPI_NUM_OSI_STRINGS            10
-
 /******************************************************************************
  *
  * ACPI AML Debugger
include/acpi/acglobal.h +0 -1
Index: work-mm5/include/acpi/acglobal.h
===================================================================
@@ -244,7 +244,6 @@
 extern const char *acpi_gbl_highest_dstate_names[4];
 extern const struct acpi_opcode_info acpi_gbl_aml_op_info[AML_NUM_OPCODES];
 extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];
-extern const char *acpi_gbl_valid_osi_strings[ACPI_NUM_OSI_STRINGS];
 
 /*****************************************************************************
  *