ACPICA: Cleanup source to reduce differences between Linux and ACPICA.
authorLv Zheng <lv.zheng@intel.com>
Thu, 20 Dec 2012 01:07:26 +0000 (01:07 +0000)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 10 Jan 2013 11:36:17 +0000 (12:36 +0100)
This is a cosmetic patch only. Comparison of the resulting binary showed
only line number differences.

This patch does not affect the generation of the Linux binary.
This patch decreases 389 lines of 20121018 divergence.diff.

This patch reduces source code diff caused by the simple code maintenance
work:
1. Deletion of the unused include files.
2. Deletion of the deprecated codes blocks.
3. Repositioning of the code blocks.
4. Replacing the values with the well defined macros.
5. Replacing the types with the equivalent types.

Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
21 files changed:
drivers/acpi/acpica/accommon.h
drivers/acpi/acpica/acglobal.h
drivers/acpi/acpica/aclocal.h
drivers/acpi/acpica/amlresrc.h
drivers/acpi/acpica/dsobject.c
drivers/acpi/acpica/exregion.c
drivers/acpi/acpica/hwregs.c
drivers/acpi/acpica/hwsleep.c
drivers/acpi/acpica/hwxfsleep.c
drivers/acpi/acpica/nsdumpdv.c
drivers/acpi/acpica/nsinit.c
drivers/acpi/acpica/nsutils.c
drivers/acpi/acpica/nsxfeval.c
drivers/acpi/acpica/tbxface.c
drivers/acpi/acpica/utxface.c
include/acpi/acconfig.h
include/acpi/acpiosxf.h
include/acpi/acpixf.h
include/acpi/actbl.h
include/acpi/actypes.h
include/acpi/platform/acenv.h

index 8a7d51bfb3b39632f6f5a46f5b0bb469dfab7b86..8632d7136730eed3d85054a1d3c30cac4a4ca505 100644 (file)
@@ -51,6 +51,7 @@
  *
  * Note: The order of these include files is important.
  */
+#include <acpi/acconfig.h>     /* Global configuration constants */
 #include "acmacros.h"          /* C macros */
 #include "aclocal.h"           /* Internal data types */
 #include "acobject.h"          /* ACPI internal object */
index 1ef7ca486a28da7d5ad4edb9ab37406cd01192fc..864806e1ac54e9cff30c97f6abda59b62a42bfc5 100644 (file)
@@ -192,14 +192,6 @@ ACPI_EXTERN u8 acpi_gbl_integer_bit_width;
 ACPI_EXTERN u8 acpi_gbl_integer_byte_width;
 ACPI_EXTERN u8 acpi_gbl_integer_nybble_width;
 
-/* Mutex for _OSI support */
-
-ACPI_EXTERN acpi_mutex acpi_gbl_osi_mutex;
-
-/* Reader/Writer lock is used for namespace walk and dynamic table unload */
-
-ACPI_EXTERN struct acpi_rw_lock acpi_gbl_namespace_rw_lock;
-
 /*****************************************************************************
  *
  * Mutual exclusion within ACPICA subsystem
@@ -233,6 +225,14 @@ ACPI_EXTERN u8 acpi_gbl_global_lock_pending;
 ACPI_EXTERN acpi_spinlock acpi_gbl_gpe_lock;   /* For GPE data structs and registers */
 ACPI_EXTERN acpi_spinlock acpi_gbl_hardware_lock;      /* For ACPI H/W except GPE registers */
 
+/* Mutex for _OSI support */
+
+ACPI_EXTERN acpi_mutex acpi_gbl_osi_mutex;
+
+/* Reader/Writer lock is used for namespace walk and dynamic table unload */
+
+ACPI_EXTERN struct acpi_rw_lock acpi_gbl_namespace_rw_lock;
+
 /*****************************************************************************
  *
  * Miscellaneous globals
@@ -304,6 +304,7 @@ extern const char *acpi_gbl_region_types[ACPI_NUM_PREDEFINED_REGIONS];
 ACPI_EXTERN struct acpi_memory_list *acpi_gbl_global_list;
 ACPI_EXTERN struct acpi_memory_list *acpi_gbl_ns_node_list;
 ACPI_EXTERN u8 acpi_gbl_display_final_mem_stats;
+ACPI_EXTERN u8 acpi_gbl_disable_mem_tracking;
 #endif
 
 /*****************************************************************************
@@ -365,19 +366,18 @@ ACPI_EXTERN u8 acpi_gbl_sleep_type_b;
  *
  ****************************************************************************/
 
-extern struct acpi_fixed_event_info
-    acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS];
-ACPI_EXTERN struct acpi_fixed_event_handler
-    acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS];
-ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head;
-ACPI_EXTERN struct acpi_gpe_block_info
-*acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS];
-
 #if (!ACPI_REDUCED_HARDWARE)
 
 ACPI_EXTERN u8 acpi_gbl_all_gpes_initialized;
+ACPI_EXTERN struct acpi_gpe_xrupt_info *acpi_gbl_gpe_xrupt_list_head;
+ACPI_EXTERN struct acpi_gpe_block_info
+    *acpi_gbl_gpe_fadt_blocks[ACPI_MAX_GPE_BLOCKS];
 ACPI_EXTERN acpi_gbl_event_handler acpi_gbl_global_event_handler;
 ACPI_EXTERN void *acpi_gbl_global_event_handler_context;
+ACPI_EXTERN struct acpi_fixed_event_handler
+    acpi_gbl_fixed_event_handlers[ACPI_NUM_FIXED_EVENTS];
+extern struct acpi_fixed_event_info
+    acpi_gbl_fixed_event_info[ACPI_NUM_FIXED_EVENTS];
 
 #endif                         /* !ACPI_REDUCED_HARDWARE */
 
@@ -428,6 +428,7 @@ extern u8 acpi_gbl_db_terminate_threads;
 ACPI_EXTERN u8 acpi_gbl_db_opt_tables;
 ACPI_EXTERN u8 acpi_gbl_db_opt_stats;
 ACPI_EXTERN u8 acpi_gbl_db_opt_ini_methods;
+ACPI_EXTERN u8 acpi_gbl_db_opt_no_region_support;
 
 ACPI_EXTERN char *acpi_gbl_db_args[ACPI_DEBUGGER_MAX_ARGS];
 ACPI_EXTERN acpi_object_type acpi_gbl_db_arg_types[ACPI_DEBUGGER_MAX_ARGS];
index 50f8b97e799bc4a6d8d5f84eed1bfa930a5144e8..421b048f6640998a1d91dc984d6f99e84ddc7de4 100644 (file)
@@ -410,11 +410,6 @@ struct acpi_gpe_notify_info {
        struct acpi_gpe_notify_info *next;
 };
 
-struct acpi_gpe_notify_object {
-       struct acpi_namespace_node *node;
-       struct acpi_gpe_notify_object *next;
-};
-
 /*
  * GPE dispatch info. At any time, the GPE can have at most one type
  * of dispatch - Method, Handler, or Implicit Notify.
index 968449685e06c28b8cb5a22687eb90d1e2c0fc0f..bdbb7d057085d7344509cee1d8a31061ea4f2044 100644 (file)
@@ -199,6 +199,12 @@ struct aml_resource_fixed_dma {
 struct aml_resource_large_header {
 AML_RESOURCE_LARGE_HEADER_COMMON};
 
+/* General Flags for address space resource descriptors */
+
+#define ACPI_RESOURCE_FLAG_DEC      2
+#define ACPI_RESOURCE_FLAG_MIF      4
+#define ACPI_RESOURCE_FLAG_MAF      8
+
 struct aml_resource_memory24 {
        AML_RESOURCE_LARGE_HEADER_COMMON u8 flags;
        u16 minimum;
index c9f15d3a368614dcf0fa338212f8c068725bb387..13844a115d97977c5d92c54e3969773a2f8d4be2 100644 (file)
@@ -388,7 +388,7 @@ acpi_ds_build_internal_package_obj(struct acpi_walk_state *walk_state,
        union acpi_parse_object *parent;
        union acpi_operand_object *obj_desc = NULL;
        acpi_status status = AE_OK;
-       unsigned i;
+       u32 i;
        u16 index;
        u16 reference_count;
 
index 0a01e19c319046779c02d4d5ebbc87a1c9863966..044d44141be6e918a2b26a6f1067fa2ab9779c03 100644 (file)
@@ -163,7 +163,7 @@ acpi_ex_system_memory_space_handler(u32 function,
                page_boundary_map_length =
                    ACPI_ROUND_UP(address, ACPI_DEFAULT_PAGE_SIZE) - address;
 
-               if (!page_boundary_map_length) {
+               if (page_boundary_map_length == 0) {
                        page_boundary_map_length = ACPI_DEFAULT_PAGE_SIZE;
                }
 
index 165395f1f7159b7fee8cb42d8e7b30cf1367f79f..e782b5a22fe524a36fe1287526f063674fb6eebc 100644 (file)
@@ -44,7 +44,6 @@
 
 #include <acpi/acpi.h>
 #include "accommon.h"
-#include "acnamesp.h"
 #include "acevents.h"
 
 #define _COMPONENT          ACPI_HARDWARE
index 3fddde056a5e1774e2e208f2478ce07d53fa5bf5..691a5fb10d4d302f434882ba8cea08c29249c2f8 100644 (file)
@@ -45,7 +45,6 @@
 #include <acpi/acpi.h>
 #include <linux/acpi.h>
 #include "accommon.h"
-#include <linux/module.h>
 
 #define _COMPONENT          ACPI_HARDWARE
 ACPI_MODULE_NAME("hwsleep")
@@ -323,7 +322,8 @@ acpi_status acpi_hw_legacy_wake(u8 sleep_state)
         * and use it to determine whether the system is rebooting or
         * resuming. Clear WAK_STS for compatibility.
         */
-       acpi_write_bit_register(ACPI_BITREG_WAKE_STATUS, 1);
+       (void)acpi_write_bit_register(ACPI_BITREG_WAKE_STATUS,
+                                     ACPI_CLEAR_STATUS);
        acpi_gbl_system_awake_and_running = TRUE;
 
        /* Enable power button */
index 2898011ef12b43796553f8c65f02b9c1892d5742..6fcee00cb34b5ac9d36d170483e932e726c7ab6d 100644 (file)
@@ -41,9 +41,9 @@
  * POSSIBILITY OF SUCH DAMAGES.
  */
 
+#include <linux/export.h>
 #include <acpi/acpi.h>
 #include "accommon.h"
-#include <linux/module.h>
 
 #define _COMPONENT          ACPI_HARDWARE
 ACPI_MODULE_NAME("hwxfsleep")
index 944d4c8d94386747337588938821035dfca79909..4ae93602b0ffa3fdd8d27df565d5977ea8508055 100644 (file)
@@ -42,7 +42,6 @@
  */
 
 #include <acpi/acpi.h>
-#include "accommon.h"
 
 /* TBD: This entire module is apparently obsolete and should be removed */
 
index bb6888f5c262963c5a7f9b7f832ba4a8bae7813c..94c1500074c4079e18d8d55c099423f3a417ac4a 100644 (file)
@@ -46,7 +46,6 @@
 #include "acnamesp.h"
 #include "acdispat.h"
 #include "acinterp.h"
-#include <linux/nmi.h>
 
 #define _COMPONENT          ACPI_NAMESPACE
 ACPI_MODULE_NAME("nsinit")
index b5b4cb72a8a89bb9bbfca7981d103b178d5f7fcd..479aad0dbf417f273a707b222fee33c3b1afd547 100644 (file)
@@ -46,7 +46,6 @@
 #include "accommon.h"
 #include "acnamesp.h"
 #include "amlcode.h"
-#include "actables.h"
 
 #define _COMPONENT          ACPI_NAMESPACE
 ACPI_MODULE_NAME("nsutils")
index 70bbc1f9de0d536a90844b59036f41ece50f91e2..5c05ba3bc0d5657596a79a7ece250bc2b54d35f7 100644 (file)
@@ -602,18 +602,20 @@ acpi_ns_get_device_callback(acpi_handle obj_handle,
 
                        /* Walk the CID list */
 
-                       found = 0;
+                       found = FALSE;
                        for (i = 0; i < cid->count; i++) {
                                if (ACPI_STRCMP(cid->ids[i].string, info->hid)
                                    == 0) {
                                        /* Found a matching CID */
-                                       found = 1;
+                                       found = TRUE;
                                        break;
                                }
                        }
+
                        ACPI_FREE(cid);
-                       if (!found)
+                       if (!found) {
                                return (AE_OK);
+                       }
                }
        }
 
index f5632780421d2ab7bd30c14c6948e8d9b893d303..d102fe7f709be11b8521f79daa2bbd36775256c3 100644 (file)
@@ -44,7 +44,6 @@
 #include <linux/export.h>
 #include <acpi/acpi.h>
 #include "accommon.h"
-#include "acnamesp.h"
 #include "actables.h"
 
 #define _COMPONENT          ACPI_TABLES
index 390db0ca5e2e2a223d7afeb83e37581e439837e7..cb85a7b313da361cd1abf779e2ce00832e5abaeb 100644 (file)
 #include <linux/export.h>
 #include <acpi/acpi.h>
 #include "accommon.h"
-#include "acevents.h"
-#include "acnamesp.h"
 #include "acdebug.h"
-#include "actables.h"
-#include "acinterp.h"
 
 #define _COMPONENT          ACPI_UTILITIES
 ACPI_MODULE_NAME("utxface")
index 358258ad09f845830fae4c3fce69cfec164039d7..12a5996da67c95a6daa128ce656d5d9ba2a25dbb 100644 (file)
  *
  *****************************************************************************/
 
-/* Number of distinct GPE register blocks and register width */
-
-#define ACPI_MAX_GPE_BLOCKS             2
-#define ACPI_GPE_REGISTER_WIDTH         8
-
 /* Method info (in WALK_STATE), containing local variables and argumetns */
 
 #define ACPI_METHOD_NUM_LOCALS          8
 #define ACPI_METHOD_NUM_ARGS            7
 #define ACPI_METHOD_MAX_ARG             6
 
-/* Length of _HID, _UID, _CID, and UUID values */
-
-#define ACPI_DEVICE_ID_LENGTH           0x09
-#define ACPI_MAX_CID_LENGTH             48
-#define ACPI_UUID_LENGTH                16
-
 /*
  * Operand Stack (in WALK_STATE), Must be large enough to contain METHOD_MAX_ARG
  */
  */
 #define ACPI_RESULTS_OBJ_NUM_MAX        255
 
-/* Names within the namespace are 4 bytes long */
-
-#define ACPI_NAME_SIZE                  4
-#define ACPI_PATH_SEGMENT_LENGTH        5      /* 4 chars for name + 1 char for separator */
-#define ACPI_PATH_SEPARATOR             '.'
-
-/* Sizes for ACPI table headers */
-
-#define ACPI_OEM_ID_SIZE                6
-#define ACPI_OEM_TABLE_ID_SIZE          8
-
 /* Constants used in searching for the RSDP in low memory */
 
 #define ACPI_EBDA_PTR_LOCATION          0x0000040E     /* Physical Address */
index 43152742b46fe8e56a8731dbcdb79a9c8e6ab79b..33a3e17da362a077b4e46812f3f8037852543555 100644 (file)
@@ -148,6 +148,8 @@ void acpi_os_release_mutex(acpi_mutex handle);
  */
 void *acpi_os_allocate(acpi_size size);
 
+void acpi_os_free(void *memory);
+
 void __iomem *acpi_os_map_memory(acpi_physical_address where,
                                acpi_size length);
 
@@ -180,12 +182,13 @@ acpi_status acpi_os_release_object(acpi_cache_t * cache, void *object);
  * Interrupt handlers
  */
 acpi_status
-acpi_os_install_interrupt_handler(u32 gsi,
+acpi_os_install_interrupt_handler(u32 interrupt_number,
                                  acpi_osd_handler service_routine,
                                  void *context);
 
 acpi_status
-acpi_os_remove_interrupt_handler(u32 gsi, acpi_osd_handler service_routine);
+acpi_os_remove_interrupt_handler(u32 interrupt_number,
+                                acpi_osd_handler service_routine);
 
 void acpi_os_gpe_count(u32 gpe_number);
 void acpi_os_fixed_event_count(u32 fixed_event_number);
index defbcaa90f4032088ef7449085ad0cc74d96e2b7..b409406d3ccf94ab604bfe844b4b223a95dc1e4b 100644 (file)
@@ -58,6 +58,10 @@ extern u8 acpi_gbl_permanent_mmap;
 /*
  * Globals that are publically available
  */
+extern u32 acpi_current_gpe_count;
+extern struct acpi_table_fadt acpi_gbl_FADT;
+extern u8 acpi_gbl_system_awake_and_running;
+extern u8 acpi_gbl_reduced_hardware;   /* ACPI 5.0 */
 /* Runtime configuration of debug print levels */
 extern u32 acpi_dbg_level;
 extern u32 acpi_dbg_layer;
@@ -100,11 +104,6 @@ extern u8 acpi_gbl_disable_auto_repair;
 
 #endif                         /* !ACPI_REDUCED_HARDWARE */
 
-extern u32 acpi_current_gpe_count;
-extern struct acpi_table_fadt acpi_gbl_FADT;
-extern u8 acpi_gbl_system_awake_and_running;
-extern u8 acpi_gbl_reduced_hardware;   /* ACPI 5.0 */
-
 extern u32 acpi_rsdt_forced;
 /*
  * Initialization
@@ -121,15 +120,14 @@ acpi_status acpi_initialize_objects(u32 flags);
 
 acpi_status acpi_terminate(void);
 
-#ifdef ACPI_FUTURE_USAGE
-acpi_status acpi_subsystem_status(void);
-#endif
-
 /*
  * Miscellaneous global interfaces
  */
 ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_enable(void))
 ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status acpi_disable(void))
+#ifdef ACPI_FUTURE_USAGE
+acpi_status acpi_subsystem_status(void);
+#endif
 
 #ifdef ACPI_FUTURE_USAGE
 acpi_status acpi_get_system_info(struct acpi_buffer *ret_buffer);
@@ -466,6 +464,10 @@ acpi_buffer_to_resource(u8 *aml_buffer,
  */
 acpi_status acpi_reset(void);
 
+acpi_status acpi_read(u64 *value, struct acpi_generic_address *reg);
+
+acpi_status acpi_write(u64 value, struct acpi_generic_address *reg);
+
 ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
                                acpi_read_bit_register(u32 register_id,
                                                       u32 *return_value))
@@ -474,20 +476,6 @@ ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
                                acpi_write_bit_register(u32 register_id,
                                                        u32 value))
 
-ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
-                               acpi_set_firmware_waking_vector(u32
-                                                               physical_address))
-
-#if ACPI_MACHINE_WIDTH == 64
-ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
-                               acpi_set_firmware_waking_vector64(u64
-                                                                 physical_address))
-#endif
-
-acpi_status acpi_read(u64 *value, struct acpi_generic_address *reg);
-
-acpi_status acpi_write(u64 value, struct acpi_generic_address *reg);
-
 /*
  * Sleep/Wake interfaces
  */
@@ -504,6 +492,15 @@ acpi_status acpi_leave_sleep_state_prep(u8 sleep_state);
 
 acpi_status acpi_leave_sleep_state(u8 sleep_state);
 
+ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
+                               acpi_set_firmware_waking_vector(u32
+                                                               physical_address))
+
+#if ACPI_MACHINE_WIDTH == 64
+ACPI_HW_DEPENDENT_RETURN_STATUS(acpi_status
+                               acpi_set_firmware_waking_vector64(u64
+                                                                 physical_address))
+#endif
 /*
  * ACPI Timer interfaces
  */
index 4f94b1d812d5a7af89abbcda02ae4adf9924e42f..c0e6c32353edf9f7b89c956222b37091d6992ee3 100644 (file)
@@ -326,8 +326,6 @@ enum acpi_preferred_pm_profiles {
 
 #pragma pack()
 
-#define ACPI_FADT_OFFSET(f)             (u16) ACPI_OFFSET (struct acpi_table_fadt, f)
-
 /*
  * Internal table-related structures
  */
@@ -364,6 +362,10 @@ struct acpi_table_desc {
 #include <acpi/actbl2.h>
 #include <acpi/actbl3.h>
 
+/* Macros used to generate offsets to specific table fields */
+
+#define ACPI_FADT_OFFSET(f)             (u16) ACPI_OFFSET (struct acpi_table_fadt, f)
+
 /*
  * Sizes of the various flavors of FADT. We need to look closely
  * at the FADT length because the version number essentially tells
index 35d4dea0bd37b438badeecb8d2332c7d87df7daa..6882227d170657956699b1624a424685439e7ed0 100644 (file)
@@ -474,6 +474,7 @@ typedef u64 acpi_integer;
  */
 #define ACPI_FULL_INITIALIZATION        0x00
 #define ACPI_NO_ADDRESS_SPACE_INIT      0x01
+#define ACPI_NO_HARDWARE_INIT           0x02
 #define ACPI_NO_EVENT_INIT              0x04
 #define ACPI_NO_HANDLER_INIT            0x08
 #define ACPI_NO_ACPI_ENABLE             0x10
@@ -970,6 +971,10 @@ acpi_status(*acpi_exception_handler) (acpi_status aml_status,
 typedef
 acpi_status(*acpi_tbl_handler) (u32 event, void *table, void *context);
 
+#define ACPI_TABLE_LOAD             0x0
+#define ACPI_TABLE_UNLOAD           0x1
+#define ACPI_NUM_TABLE_EVENTS       2
+
 /* Address Spaces (For Operation Regions) */
 
 typedef
index 13ac538f789291b0dac3a1b6147776b286367e2d..cec6cd3e850db5517b8b8c2ad5eeee7d66759678 100644 (file)
  *
  *****************************************************************************/
 
-#define ACPI_IS_ASCII(c)  ((c) < 0x80)
-
 /*
  * ACPI_USE_SYSTEM_CLIBRARY - Define this if linking to an actual C library.
  *      Otherwise, local versions of string/memory functions will be used.