]> xenbits.xensource.com Git - xen.git/commitdiff
xen/ACPI: Remove the acpi_string type
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 14 Jul 2023 12:28:24 +0000 (13:28 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 17 Jul 2023 10:35:41 +0000 (11:35 +0100)
Typedef-ing a naked pointer like this is an anti-pattern which is best
avoided.  Furthermore, it's problematic to pass a string literal in a mutable
type.  Delete the type entirely, and replace it with a plain 'const char *'.

This highlights two further bugs.  acpi_get_table() already had a mismatch in
types between it's declaration and definition, and we have declarations for
acpi_get_handle() and acpi_get_table_header() but no definition at all, nor
any callers.

This fixes violations of MISRA Rule 7.4:

  A string literal shall not be assigned to an object unless the object's type
  is "pointer to const-qualified char".

and of Rule 8.3:

  All declarations of an object or function shall use the same names and type
  qualifiers.

and of Rule 8.6:

  An identifier with external linkage shall have exactly one external
  definition.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/drivers/acpi/tables/tbxface.c
xen/include/acpi/acpixf.h
xen/include/acpi/actypes.h

index 21b2e5eae1c7a5d80497b45a51ad33ee520c97bd..204d66caea481ddbd8556b65701136c669c30119 100644 (file)
@@ -164,7 +164,7 @@ acpi_initialize_tables(struct acpi_table_desc * initial_table_array,
  *
  *****************************************************************************/
 acpi_status __init
-acpi_get_table(char *signature,
+acpi_get_table(const char *signature,
               acpi_native_uint instance, struct acpi_table_header **out_table)
 {
        acpi_native_uint i;
@@ -220,7 +220,7 @@ acpi_get_table(char *signature,
  *
  *****************************************************************************/
 acpi_status __init
-acpi_get_table_phys(acpi_string signature, acpi_native_uint instance,
+acpi_get_table_phys(const char *signature, acpi_native_uint instance,
                     acpi_physical_address *addr, acpi_native_uint *len)
 {
        acpi_native_uint i, j;
index ba74908f0478fb856828d2f2e89b6647c300294a..8b70154b8f96f70c61726cac3aafd6bc1371eeba 100644 (file)
@@ -69,25 +69,16 @@ acpi_status acpi_load_tables(void);
 acpi_status acpi_load_table(struct acpi_table_header *table_ptr);
 
 acpi_status
-acpi_get_table_header(acpi_string signature,
-                     acpi_native_uint instance,
-                     struct acpi_table_header *out_table_header);
-
-acpi_status
-acpi_get_table(acpi_string signature,
+acpi_get_table(const char *signature,
               acpi_native_uint instance, struct acpi_table_header **out_table);
 
 acpi_status
-acpi_get_table_phys(acpi_string signature, acpi_native_uint instance,
+acpi_get_table_phys(const char *signature, acpi_native_uint instance,
                     acpi_physical_address *addr, acpi_native_uint *len);
 /*
  * Namespace and name interfaces
  */
 acpi_status
-acpi_get_handle(acpi_handle parent,
-               acpi_string pathname, acpi_handle * ret_handle);
-
-acpi_status
 acpi_debug_trace(char *name, u32 debug_level, u32 debug_layer, u32 flags);
 
 acpi_status
index f3e95abc3ab3ad2e700bc0b7103f704b6af1e4d3..7023863d0349206e445932f4564b6f77dde1c1ce 100644 (file)
@@ -281,7 +281,6 @@ typedef acpi_native_uint acpi_size;
  */
 typedef u32 acpi_status;       /* All ACPI Exceptions */
 typedef u32 acpi_name;         /* 4-byte ACPI name */
-typedef char *acpi_string;     /* Null terminated ASCII string */
 typedef void *acpi_handle;     /* Actually a ptr to a NS Node */
 
 struct uint64_struct {