diff mbox series

acpi/devices: refactor devices' HIDs and names

Message ID 20200603191907.223748-1-alex.hung@canonical.com
State Accepted
Headers show
Series acpi/devices: refactor devices' HIDs and names | expand

Commit Message

Alex Hung June 3, 2020, 7:19 p.m. UTC
There are no functional changes.

Signed-off-by: Alex Hung <alex.hung@canonical.com>
---
 src/acpi/devices/ac_adapter/ac.c         | 9 +++++----
 src/acpi/devices/battery/battery.c       | 9 +++++----
 src/acpi/devices/battery/smart_battery.c | 9 +++++----
 src/acpi/devices/buttons/power_button.c  | 9 +++++----
 src/acpi/devices/buttons/sleep_button.c  | 9 +++++----
 src/acpi/devices/ec/ec.c                 | 9 +++++----
 src/acpi/devices/lid/lid.c               | 9 +++++----
 src/acpi/devices/nvdimm/nvdimm.c         | 9 +++++----
 src/acpi/devices/sensor/als.c            | 9 +++++----
 src/acpi/devices/time/time.c             | 9 +++++----
 src/acpi/devices/wpc/wpc.c               | 9 +++++----
 11 files changed, 55 insertions(+), 44 deletions(-)

Comments

Colin Ian King June 3, 2020, 7:26 p.m. UTC | #1
On 03/06/2020 20:19, Alex Hung wrote:
> There are no functional changes.
> 
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>  src/acpi/devices/ac_adapter/ac.c         | 9 +++++----
>  src/acpi/devices/battery/battery.c       | 9 +++++----
>  src/acpi/devices/battery/smart_battery.c | 9 +++++----
>  src/acpi/devices/buttons/power_button.c  | 9 +++++----
>  src/acpi/devices/buttons/sleep_button.c  | 9 +++++----
>  src/acpi/devices/ec/ec.c                 | 9 +++++----
>  src/acpi/devices/lid/lid.c               | 9 +++++----
>  src/acpi/devices/nvdimm/nvdimm.c         | 9 +++++----
>  src/acpi/devices/sensor/als.c            | 9 +++++----
>  src/acpi/devices/time/time.c             | 9 +++++----
>  src/acpi/devices/wpc/wpc.c               | 9 +++++----
>  11 files changed, 55 insertions(+), 44 deletions(-)
> 
> diff --git a/src/acpi/devices/ac_adapter/ac.c b/src/acpi/devices/ac_adapter/ac.c
> index 2a07c313..c924143d 100644
> --- a/src/acpi/devices/ac_adapter/ac.c
> +++ b/src/acpi/devices/ac_adapter/ac.c
> @@ -27,7 +27,8 @@
>  #include <inttypes.h>
>  #include <string.h>
>  
> -#define FWTS_ACPI_AC_HID "ACPI0003"
> +#define FWTS_ACPI_DEVICE_HID "ACPI0003"
> +#define FWTS_ACPI_DEVICE "AC adapter"
>  
>  static ACPI_HANDLE device;
>  
> @@ -49,14 +50,14 @@ static int acpi_ac_init(fwts_framework *fw)
>  	if (fwts_acpica_init(fw) != FWTS_OK)
>  		return FWTS_ERROR;
>  
> -	status = AcpiGetDevices(FWTS_ACPI_AC_HID, get_device_handle, NULL, NULL);
> +	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
>  	if (ACPI_FAILURE(status)) {
>  		fwts_log_error(fw, "Cannot find the ACPI device");
>  		return FWTS_ERROR;
>  	}
>  
>  	if (!device) {
> -		fwts_log_error(fw, "ACPI AC device does not exist, skipping test");
> +		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
>  		fwts_acpica_deinit();
>  		return FWTS_SKIP;
>  	} else {
> @@ -68,7 +69,7 @@ static int acpi_ac_init(fwts_framework *fw)
>  
>  		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
>  		if (ACPI_SUCCESS(status)) {
> -			fwts_log_info_verbatim(fw, "ACPI AC Adapter Device: %s", full_name);
> +			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
>  			fwts_log_nl(fw);
>  		}
>  	}
> diff --git a/src/acpi/devices/battery/battery.c b/src/acpi/devices/battery/battery.c
> index 400f485b..00c375c7 100644
> --- a/src/acpi/devices/battery/battery.c
> +++ b/src/acpi/devices/battery/battery.c
> @@ -27,7 +27,8 @@
>  #include <inttypes.h>
>  #include <string.h>
>  
> -#define FWTS_ACPI_BATTERY_HID "PNP0C0A"
> +#define FWTS_ACPI_DEVICE_HID "PNP0C0A"
> +#define FWTS_ACPI_DEVICE "battery"
>  
>  static ACPI_HANDLE device;
>  
> @@ -49,14 +50,14 @@ static int acpi_battery_init(fwts_framework *fw)
>  	if (fwts_acpica_init(fw) != FWTS_OK)
>  		return FWTS_ERROR;
>  
> -	status = AcpiGetDevices(FWTS_ACPI_BATTERY_HID, get_device_handle, NULL, NULL);
> +	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
>  	if (ACPI_FAILURE(status)) {
>  		fwts_log_error(fw, "Cannot find the ACPI device");
>  		return FWTS_ERROR;
>  	}
>  
>  	if (!device) {
> -		fwts_log_error(fw, "ACPI Battery device does not exist, skipping test");
> +		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
>  		fwts_acpica_deinit();
>  		return FWTS_SKIP;
>  	} else {
> @@ -68,7 +69,7 @@ static int acpi_battery_init(fwts_framework *fw)
>  
>  		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
>  		if (ACPI_SUCCESS(status)) {
> -			fwts_log_info_verbatim(fw, "ACPI Battery Device: %s", full_name);
> +			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
>  			fwts_log_nl(fw);
>  		}
>  	}
> diff --git a/src/acpi/devices/battery/smart_battery.c b/src/acpi/devices/battery/smart_battery.c
> index bf3f4043..83dd8b3b 100644
> --- a/src/acpi/devices/battery/smart_battery.c
> +++ b/src/acpi/devices/battery/smart_battery.c
> @@ -27,7 +27,8 @@
>  #include <inttypes.h>
>  #include <string.h>
>  
> -#define FWTS_SMART_BATTERY_HID "ACPI0002"
> +#define FWTS_ACPI_DEVICE_HID "ACPI0002"
> +#define FWTS_ACPI_DEVICE "smart battery"
>  
>  static ACPI_HANDLE device;
>  
> @@ -49,14 +50,14 @@ static int smart_battery_init(fwts_framework *fw)
>  	if (fwts_acpica_init(fw) != FWTS_OK)
>  		return FWTS_ERROR;
>  
> -	status = AcpiGetDevices(FWTS_SMART_BATTERY_HID, get_device_handle, NULL, NULL);
> +	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
>  	if (ACPI_FAILURE(status)) {
>  		fwts_log_error(fw, "Cannot find the ACPI device");
>  		return FWTS_ERROR;
>  	}
>  
>  	if (!device) {
> -		fwts_log_error(fw, "Smart Battery device does not exist, skipping test");
> +		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
>  		fwts_acpica_deinit();
>  		return FWTS_SKIP;
>  	} else {
> @@ -68,7 +69,7 @@ static int smart_battery_init(fwts_framework *fw)
>  
>  		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
>  		if (ACPI_SUCCESS(status)) {
> -			fwts_log_info_verbatim(fw, "Smart Battery Device: %s", full_name);
> +			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
>  			fwts_log_nl(fw);
>  		}
>  	}
> diff --git a/src/acpi/devices/buttons/power_button.c b/src/acpi/devices/buttons/power_button.c
> index d69a1a12..84c2d2dc 100644
> --- a/src/acpi/devices/buttons/power_button.c
> +++ b/src/acpi/devices/buttons/power_button.c
> @@ -27,7 +27,8 @@
>  #include <inttypes.h>
>  #include <string.h>
>  
> -#define FWTS_POWER_BUTTON_HID "PNP0C0C"
> +#define FWTS_ACPI_DEVICE_HID "PNP0C0C"
> +#define FWTS_ACPI_DEVICE "power button"
>  
>  static ACPI_HANDLE device;
>  
> @@ -49,14 +50,14 @@ static int power_button_init(fwts_framework *fw)
>  	if (fwts_acpica_init(fw) != FWTS_OK)
>  		return FWTS_ERROR;
>  
> -	status = AcpiGetDevices(FWTS_POWER_BUTTON_HID, get_device_handle, NULL, NULL);
> +	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
>  	if (ACPI_FAILURE(status)) {
>  		fwts_log_error(fw, "Cannot find the ACPI device");
>  		return FWTS_ERROR;
>  	}
>  
>  	if (!device) {
> -		fwts_log_error(fw, "ACPI power button device does not exist, skipping test");
> +		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
>  		fwts_acpica_deinit();
>  		return FWTS_SKIP;
>  	} else {
> @@ -68,7 +69,7 @@ static int power_button_init(fwts_framework *fw)
>  
>  		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
>  		if (ACPI_SUCCESS(status)) {
> -			fwts_log_info_verbatim(fw, "ACPI Power Button Device: %s", full_name);
> +			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
>  			fwts_log_nl(fw);
>  		}
>  	}
> diff --git a/src/acpi/devices/buttons/sleep_button.c b/src/acpi/devices/buttons/sleep_button.c
> index 39a7d558..d32ca3c9 100644
> --- a/src/acpi/devices/buttons/sleep_button.c
> +++ b/src/acpi/devices/buttons/sleep_button.c
> @@ -27,7 +27,8 @@
>  #include <inttypes.h>
>  #include <string.h>
>  
> -#define FWTS_SLEEP_BUTTON_HID "PNP0C0E"
> +#define FWTS_ACPI_DEVICE_HID "PNP0C0E"
> +#define FWTS_ACPI_DEVICE "sleep button"
>  
>  static ACPI_HANDLE device;
>  
> @@ -49,14 +50,14 @@ static int sleep_button_init(fwts_framework *fw)
>  	if (fwts_acpica_init(fw) != FWTS_OK)
>  		return FWTS_ERROR;
>  
> -	status = AcpiGetDevices(FWTS_SLEEP_BUTTON_HID, get_device_handle, NULL, NULL);
> +	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
>  	if (ACPI_FAILURE(status)) {
>  		fwts_log_error(fw, "Cannot find the ACPI device");
>  		return FWTS_ERROR;
>  	}
>  
>  	if (!device) {
> -		fwts_log_error(fw, "ACPI sleep button device does not exist, skipping test");
> +		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
>  		fwts_acpica_deinit();
>  		return FWTS_SKIP;
>  	} else {
> @@ -68,7 +69,7 @@ static int sleep_button_init(fwts_framework *fw)
>  
>  		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
>  		if (ACPI_SUCCESS(status)) {
> -			fwts_log_info_verbatim(fw, "ACPI Sleep Button Device: %s", full_name);
> +			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
>  			fwts_log_nl(fw);
>  		}
>  	}
> diff --git a/src/acpi/devices/ec/ec.c b/src/acpi/devices/ec/ec.c
> index 1db1d8a5..63430586 100644
> --- a/src/acpi/devices/ec/ec.c
> +++ b/src/acpi/devices/ec/ec.c
> @@ -27,7 +27,8 @@
>  #include <inttypes.h>
>  #include <string.h>
>  
> -#define FWTS_ACPI_EC_HID "PNP0C09"
> +#define FWTS_ACPI_DEVICE_HID "PNP0C09"
> +#define FWTS_ACPI_DEVICE "EC"
>  
>  static ACPI_HANDLE device;
>  
> @@ -49,14 +50,14 @@ static int acpi_ec_init(fwts_framework *fw)
>  	if (fwts_acpica_init(fw) != FWTS_OK)
>  		return FWTS_ERROR;
>  
> -	status = AcpiGetDevices(FWTS_ACPI_EC_HID, get_device_handle, NULL, NULL);
> +	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
>  	if (ACPI_FAILURE(status)) {
>  		fwts_log_error(fw, "Cannot find the ACPI device");
>  		return FWTS_ERROR;
>  	}
>  
>  	if (!device) {
> -		fwts_log_error(fw, "ACPI EC device does not exist, skipping test");
> +		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
>  		fwts_acpica_deinit();
>  		return FWTS_SKIP;
>  	} else {
> @@ -68,7 +69,7 @@ static int acpi_ec_init(fwts_framework *fw)
>  
>  		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
>  		if (ACPI_SUCCESS(status)) {
> -			fwts_log_info_verbatim(fw, "ACPI EC Device: %s", full_name);
> +			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
>  			fwts_log_nl(fw);
>  		}
>  	}
> diff --git a/src/acpi/devices/lid/lid.c b/src/acpi/devices/lid/lid.c
> index e76914cc..f1036ac7 100644
> --- a/src/acpi/devices/lid/lid.c
> +++ b/src/acpi/devices/lid/lid.c
> @@ -27,7 +27,8 @@
>  #include <inttypes.h>
>  #include <string.h>
>  
> -#define FWTS_ACPI_LID_HID "PNP0C0D"
> +#define FWTS_ACPI_DEVICE_HID "PNP0C0D"
> +#define FWTS_ACPI_DEVICE "lid"
>  
>  static ACPI_HANDLE device;
>  
> @@ -49,14 +50,14 @@ static int acpi_lid_init(fwts_framework *fw)
>  	if (fwts_acpica_init(fw) != FWTS_OK)
>  		return FWTS_ERROR;
>  
> -	status = AcpiGetDevices(FWTS_ACPI_LID_HID, get_device_handle, NULL, NULL);
> +	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
>  	if (ACPI_FAILURE(status)) {
>  		fwts_log_error(fw, "Cannot find the ACPI device");
>  		return FWTS_ERROR;
>  	}
>  
>  	if (!device) {
> -		fwts_log_error(fw, "ACPI lid device does not exist, skipping test");
> +		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
>  		fwts_acpica_deinit();
>  		return FWTS_SKIP;
>  	} else {
> @@ -68,7 +69,7 @@ static int acpi_lid_init(fwts_framework *fw)
>  
>  		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
>  		if (ACPI_SUCCESS(status)) {
> -			fwts_log_info_verbatim(fw, "ACPI Lid Device: %s", full_name);
> +			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
>  			fwts_log_nl(fw);
>  		}
>  	}
> diff --git a/src/acpi/devices/nvdimm/nvdimm.c b/src/acpi/devices/nvdimm/nvdimm.c
> index 507fa082..3f93f815 100644
> --- a/src/acpi/devices/nvdimm/nvdimm.c
> +++ b/src/acpi/devices/nvdimm/nvdimm.c
> @@ -27,7 +27,8 @@
>  #include <inttypes.h>
>  #include <string.h>
>  
> -#define FWTS_ACPI_NVDIMM_HID "ACPI0012"
> +#define FWTS_ACPI_DEVICE_HID "ACPI0012"
> +#define FWTS_ACPI_DEVICE "NVDIMM"
>  
>  static ACPI_HANDLE device;
>  
> @@ -49,14 +50,14 @@ static int acpi_nvdimm_init(fwts_framework *fw)
>  	if (fwts_acpica_init(fw) != FWTS_OK)
>  		return FWTS_ERROR;
>  
> -	status = AcpiGetDevices(FWTS_ACPI_NVDIMM_HID, get_device_handle, NULL, NULL);
> +	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
>  	if (ACPI_FAILURE(status)) {
>  		fwts_log_error(fw, "Cannot find the ACPI device");
>  		return FWTS_ERROR;
>  	}
>  
>  	if (!device) {
> -		fwts_log_error(fw, "ACPI NVDIMM device does not exist, skipping test");
> +		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
>  		fwts_acpica_deinit();
>  		return FWTS_SKIP;
>  	} else {
> @@ -68,7 +69,7 @@ static int acpi_nvdimm_init(fwts_framework *fw)
>  
>  		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
>  		if (ACPI_SUCCESS(status)) {
> -			fwts_log_info_verbatim(fw, "ACPI NVDIMM Device: %s", full_name);
> +			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
>  			fwts_log_nl(fw);
>  		}
>  	}
> diff --git a/src/acpi/devices/sensor/als.c b/src/acpi/devices/sensor/als.c
> index 5cb712bf..5c781511 100644
> --- a/src/acpi/devices/sensor/als.c
> +++ b/src/acpi/devices/sensor/als.c
> @@ -27,7 +27,8 @@
>  #include <inttypes.h>
>  #include <string.h>
>  
> -#define FWTS_ACPI_AMBIENT_LIGHT_HID "ACPI0008"
> +#define FWTS_ACPI_DEVICE_HID "ACPI0008"
> +#define FWTS_ACPI_DEVICE "ambient light sensor"
>  
>  static ACPI_HANDLE device;
>  
> @@ -49,14 +50,14 @@ static int ambient_light_init(fwts_framework *fw)
>  	if (fwts_acpica_init(fw) != FWTS_OK)
>  		return FWTS_ERROR;
>  
> -	status = AcpiGetDevices(FWTS_ACPI_AMBIENT_LIGHT_HID, get_device_handle, NULL, NULL);
> +	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
>  	if (ACPI_FAILURE(status)) {
>  		fwts_log_error(fw, "Cannot find the ACPI device");
>  		return FWTS_ERROR;
>  	}
>  
>  	if (!device) {
> -		fwts_log_error(fw, "ACPI ambient light sensor device does not exist, skipping test");
> +		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
>  		fwts_acpica_deinit();
>  		return FWTS_SKIP;
>  	} else {
> @@ -68,7 +69,7 @@ static int ambient_light_init(fwts_framework *fw)
>  
>  		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
>  		if (ACPI_SUCCESS(status)) {
> -			fwts_log_info_verbatim(fw, "ACPI Ambient Light Sensor Device: %s", full_name);
> +			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
>  			fwts_log_nl(fw);
>  		}
>  	}
> diff --git a/src/acpi/devices/time/time.c b/src/acpi/devices/time/time.c
> index 4f776cf6..7caa2728 100644
> --- a/src/acpi/devices/time/time.c
> +++ b/src/acpi/devices/time/time.c
> @@ -27,7 +27,8 @@
>  #include <inttypes.h>
>  #include <string.h>
>  
> -#define FWTS_ACPI_TIME_ALARM_HID "ACPI000E"
> +#define FWTS_ACPI_DEVICE_HID "ACPI000E"
> +#define FWTS_ACPI_DEVICE "time and alarm"
>  
>  static ACPI_HANDLE device;
>  
> @@ -51,14 +52,14 @@ static int acpi_time_alarm_init(fwts_framework *fw)
>  	if (fwts_acpica_init(fw) != FWTS_OK)
>  		return FWTS_ERROR;
>  
> -	status = AcpiGetDevices(FWTS_ACPI_TIME_ALARM_HID, get_device_handle, NULL, NULL);
> +	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
>  	if (ACPI_FAILURE(status)) {
>  		fwts_log_error(fw, "Cannot find the ACPI device");
>  		return FWTS_ERROR;
>  	}
>  
>  	if (!device) {
> -		fwts_log_error(fw, "ACPI time and alarm device does not exist, skipping test");
> +		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
>  		fwts_acpica_deinit();
>  		return FWTS_SKIP;
>  	} else {
> @@ -70,7 +71,7 @@ static int acpi_time_alarm_init(fwts_framework *fw)
>  
>  		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
>  		if (ACPI_SUCCESS(status)) {
> -			fwts_log_info_verbatim(fw, "ACPI Time and Alarm Device: %s", full_name);
> +			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
>  			fwts_log_nl(fw);
>  		}
>  	}
> diff --git a/src/acpi/devices/wpc/wpc.c b/src/acpi/devices/wpc/wpc.c
> index 516ce970..019a40f2 100644
> --- a/src/acpi/devices/wpc/wpc.c
> +++ b/src/acpi/devices/wpc/wpc.c
> @@ -27,7 +27,8 @@
>  #include <inttypes.h>
>  #include <string.h>
>  
> -#define FWTS_ACPI_WPC_HID "ACPI0014"
> +#define FWTS_ACPI_DEVICE_HID "ACPI0014"
> +#define FWTS_ACPI_DEVICE "wireless power calibration"
>  
>  static ACPI_HANDLE device;
>  
> @@ -49,14 +50,14 @@ static int acpi_wpc_init(fwts_framework *fw)
>  	if (fwts_acpica_init(fw) != FWTS_OK)
>  		return FWTS_ERROR;
>  
> -	status = AcpiGetDevices(FWTS_ACPI_WPC_HID, get_device_handle, NULL, NULL);
> +	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
>  	if (ACPI_FAILURE(status)) {
>  		fwts_log_error(fw, "Cannot find the ACPI device");
>  		return FWTS_ERROR;
>  	}
>  
>  	if (!device) {
> -		fwts_log_error(fw, "ACPI wireless power calibration device does not exist, skipping test");
> +		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
>  		fwts_acpica_deinit();
>  		return FWTS_SKIP;
>  	} else {
> @@ -68,7 +69,7 @@ static int acpi_wpc_init(fwts_framework *fw)
>  
>  		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
>  		if (ACPI_SUCCESS(status)) {
> -			fwts_log_info_verbatim(fw, "ACPI Wireless Power Calibration Device: %s", full_name);
> +			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
>  			fwts_log_nl(fw);
>  		}
>  	}
> 

Acked-by: Colin Ian King <colin.king@canonical.com>
Ivan Hu June 12, 2020, 9:37 a.m. UTC | #2
On 6/4/20 3:19 AM, Alex Hung wrote:
> There are no functional changes.
> 
> Signed-off-by: Alex Hung <alex.hung@canonical.com>
> ---
>  src/acpi/devices/ac_adapter/ac.c         | 9 +++++----
>  src/acpi/devices/battery/battery.c       | 9 +++++----
>  src/acpi/devices/battery/smart_battery.c | 9 +++++----
>  src/acpi/devices/buttons/power_button.c  | 9 +++++----
>  src/acpi/devices/buttons/sleep_button.c  | 9 +++++----
>  src/acpi/devices/ec/ec.c                 | 9 +++++----
>  src/acpi/devices/lid/lid.c               | 9 +++++----
>  src/acpi/devices/nvdimm/nvdimm.c         | 9 +++++----
>  src/acpi/devices/sensor/als.c            | 9 +++++----
>  src/acpi/devices/time/time.c             | 9 +++++----
>  src/acpi/devices/wpc/wpc.c               | 9 +++++----
>  11 files changed, 55 insertions(+), 44 deletions(-)
> 
> diff --git a/src/acpi/devices/ac_adapter/ac.c b/src/acpi/devices/ac_adapter/ac.c
> index 2a07c313..c924143d 100644
> --- a/src/acpi/devices/ac_adapter/ac.c
> +++ b/src/acpi/devices/ac_adapter/ac.c
> @@ -27,7 +27,8 @@
>  #include <inttypes.h>
>  #include <string.h>
>  
> -#define FWTS_ACPI_AC_HID "ACPI0003"
> +#define FWTS_ACPI_DEVICE_HID "ACPI0003"
> +#define FWTS_ACPI_DEVICE "AC adapter"
>  
>  static ACPI_HANDLE device;
>  
> @@ -49,14 +50,14 @@ static int acpi_ac_init(fwts_framework *fw)
>  	if (fwts_acpica_init(fw) != FWTS_OK)
>  		return FWTS_ERROR;
>  
> -	status = AcpiGetDevices(FWTS_ACPI_AC_HID, get_device_handle, NULL, NULL);
> +	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
>  	if (ACPI_FAILURE(status)) {
>  		fwts_log_error(fw, "Cannot find the ACPI device");
>  		return FWTS_ERROR;
>  	}
>  
>  	if (!device) {
> -		fwts_log_error(fw, "ACPI AC device does not exist, skipping test");
> +		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
>  		fwts_acpica_deinit();
>  		return FWTS_SKIP;
>  	} else {
> @@ -68,7 +69,7 @@ static int acpi_ac_init(fwts_framework *fw)
>  
>  		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
>  		if (ACPI_SUCCESS(status)) {
> -			fwts_log_info_verbatim(fw, "ACPI AC Adapter Device: %s", full_name);
> +			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
>  			fwts_log_nl(fw);
>  		}
>  	}
> diff --git a/src/acpi/devices/battery/battery.c b/src/acpi/devices/battery/battery.c
> index 400f485b..00c375c7 100644
> --- a/src/acpi/devices/battery/battery.c
> +++ b/src/acpi/devices/battery/battery.c
> @@ -27,7 +27,8 @@
>  #include <inttypes.h>
>  #include <string.h>
>  
> -#define FWTS_ACPI_BATTERY_HID "PNP0C0A"
> +#define FWTS_ACPI_DEVICE_HID "PNP0C0A"
> +#define FWTS_ACPI_DEVICE "battery"
>  
>  static ACPI_HANDLE device;
>  
> @@ -49,14 +50,14 @@ static int acpi_battery_init(fwts_framework *fw)
>  	if (fwts_acpica_init(fw) != FWTS_OK)
>  		return FWTS_ERROR;
>  
> -	status = AcpiGetDevices(FWTS_ACPI_BATTERY_HID, get_device_handle, NULL, NULL);
> +	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
>  	if (ACPI_FAILURE(status)) {
>  		fwts_log_error(fw, "Cannot find the ACPI device");
>  		return FWTS_ERROR;
>  	}
>  
>  	if (!device) {
> -		fwts_log_error(fw, "ACPI Battery device does not exist, skipping test");
> +		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
>  		fwts_acpica_deinit();
>  		return FWTS_SKIP;
>  	} else {
> @@ -68,7 +69,7 @@ static int acpi_battery_init(fwts_framework *fw)
>  
>  		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
>  		if (ACPI_SUCCESS(status)) {
> -			fwts_log_info_verbatim(fw, "ACPI Battery Device: %s", full_name);
> +			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
>  			fwts_log_nl(fw);
>  		}
>  	}
> diff --git a/src/acpi/devices/battery/smart_battery.c b/src/acpi/devices/battery/smart_battery.c
> index bf3f4043..83dd8b3b 100644
> --- a/src/acpi/devices/battery/smart_battery.c
> +++ b/src/acpi/devices/battery/smart_battery.c
> @@ -27,7 +27,8 @@
>  #include <inttypes.h>
>  #include <string.h>
>  
> -#define FWTS_SMART_BATTERY_HID "ACPI0002"
> +#define FWTS_ACPI_DEVICE_HID "ACPI0002"
> +#define FWTS_ACPI_DEVICE "smart battery"
>  
>  static ACPI_HANDLE device;
>  
> @@ -49,14 +50,14 @@ static int smart_battery_init(fwts_framework *fw)
>  	if (fwts_acpica_init(fw) != FWTS_OK)
>  		return FWTS_ERROR;
>  
> -	status = AcpiGetDevices(FWTS_SMART_BATTERY_HID, get_device_handle, NULL, NULL);
> +	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
>  	if (ACPI_FAILURE(status)) {
>  		fwts_log_error(fw, "Cannot find the ACPI device");
>  		return FWTS_ERROR;
>  	}
>  
>  	if (!device) {
> -		fwts_log_error(fw, "Smart Battery device does not exist, skipping test");
> +		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
>  		fwts_acpica_deinit();
>  		return FWTS_SKIP;
>  	} else {
> @@ -68,7 +69,7 @@ static int smart_battery_init(fwts_framework *fw)
>  
>  		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
>  		if (ACPI_SUCCESS(status)) {
> -			fwts_log_info_verbatim(fw, "Smart Battery Device: %s", full_name);
> +			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
>  			fwts_log_nl(fw);
>  		}
>  	}
> diff --git a/src/acpi/devices/buttons/power_button.c b/src/acpi/devices/buttons/power_button.c
> index d69a1a12..84c2d2dc 100644
> --- a/src/acpi/devices/buttons/power_button.c
> +++ b/src/acpi/devices/buttons/power_button.c
> @@ -27,7 +27,8 @@
>  #include <inttypes.h>
>  #include <string.h>
>  
> -#define FWTS_POWER_BUTTON_HID "PNP0C0C"
> +#define FWTS_ACPI_DEVICE_HID "PNP0C0C"
> +#define FWTS_ACPI_DEVICE "power button"
>  
>  static ACPI_HANDLE device;
>  
> @@ -49,14 +50,14 @@ static int power_button_init(fwts_framework *fw)
>  	if (fwts_acpica_init(fw) != FWTS_OK)
>  		return FWTS_ERROR;
>  
> -	status = AcpiGetDevices(FWTS_POWER_BUTTON_HID, get_device_handle, NULL, NULL);
> +	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
>  	if (ACPI_FAILURE(status)) {
>  		fwts_log_error(fw, "Cannot find the ACPI device");
>  		return FWTS_ERROR;
>  	}
>  
>  	if (!device) {
> -		fwts_log_error(fw, "ACPI power button device does not exist, skipping test");
> +		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
>  		fwts_acpica_deinit();
>  		return FWTS_SKIP;
>  	} else {
> @@ -68,7 +69,7 @@ static int power_button_init(fwts_framework *fw)
>  
>  		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
>  		if (ACPI_SUCCESS(status)) {
> -			fwts_log_info_verbatim(fw, "ACPI Power Button Device: %s", full_name);
> +			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
>  			fwts_log_nl(fw);
>  		}
>  	}
> diff --git a/src/acpi/devices/buttons/sleep_button.c b/src/acpi/devices/buttons/sleep_button.c
> index 39a7d558..d32ca3c9 100644
> --- a/src/acpi/devices/buttons/sleep_button.c
> +++ b/src/acpi/devices/buttons/sleep_button.c
> @@ -27,7 +27,8 @@
>  #include <inttypes.h>
>  #include <string.h>
>  
> -#define FWTS_SLEEP_BUTTON_HID "PNP0C0E"
> +#define FWTS_ACPI_DEVICE_HID "PNP0C0E"
> +#define FWTS_ACPI_DEVICE "sleep button"
>  
>  static ACPI_HANDLE device;
>  
> @@ -49,14 +50,14 @@ static int sleep_button_init(fwts_framework *fw)
>  	if (fwts_acpica_init(fw) != FWTS_OK)
>  		return FWTS_ERROR;
>  
> -	status = AcpiGetDevices(FWTS_SLEEP_BUTTON_HID, get_device_handle, NULL, NULL);
> +	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
>  	if (ACPI_FAILURE(status)) {
>  		fwts_log_error(fw, "Cannot find the ACPI device");
>  		return FWTS_ERROR;
>  	}
>  
>  	if (!device) {
> -		fwts_log_error(fw, "ACPI sleep button device does not exist, skipping test");
> +		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
>  		fwts_acpica_deinit();
>  		return FWTS_SKIP;
>  	} else {
> @@ -68,7 +69,7 @@ static int sleep_button_init(fwts_framework *fw)
>  
>  		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
>  		if (ACPI_SUCCESS(status)) {
> -			fwts_log_info_verbatim(fw, "ACPI Sleep Button Device: %s", full_name);
> +			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
>  			fwts_log_nl(fw);
>  		}
>  	}
> diff --git a/src/acpi/devices/ec/ec.c b/src/acpi/devices/ec/ec.c
> index 1db1d8a5..63430586 100644
> --- a/src/acpi/devices/ec/ec.c
> +++ b/src/acpi/devices/ec/ec.c
> @@ -27,7 +27,8 @@
>  #include <inttypes.h>
>  #include <string.h>
>  
> -#define FWTS_ACPI_EC_HID "PNP0C09"
> +#define FWTS_ACPI_DEVICE_HID "PNP0C09"
> +#define FWTS_ACPI_DEVICE "EC"
>  
>  static ACPI_HANDLE device;
>  
> @@ -49,14 +50,14 @@ static int acpi_ec_init(fwts_framework *fw)
>  	if (fwts_acpica_init(fw) != FWTS_OK)
>  		return FWTS_ERROR;
>  
> -	status = AcpiGetDevices(FWTS_ACPI_EC_HID, get_device_handle, NULL, NULL);
> +	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
>  	if (ACPI_FAILURE(status)) {
>  		fwts_log_error(fw, "Cannot find the ACPI device");
>  		return FWTS_ERROR;
>  	}
>  
>  	if (!device) {
> -		fwts_log_error(fw, "ACPI EC device does not exist, skipping test");
> +		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
>  		fwts_acpica_deinit();
>  		return FWTS_SKIP;
>  	} else {
> @@ -68,7 +69,7 @@ static int acpi_ec_init(fwts_framework *fw)
>  
>  		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
>  		if (ACPI_SUCCESS(status)) {
> -			fwts_log_info_verbatim(fw, "ACPI EC Device: %s", full_name);
> +			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
>  			fwts_log_nl(fw);
>  		}
>  	}
> diff --git a/src/acpi/devices/lid/lid.c b/src/acpi/devices/lid/lid.c
> index e76914cc..f1036ac7 100644
> --- a/src/acpi/devices/lid/lid.c
> +++ b/src/acpi/devices/lid/lid.c
> @@ -27,7 +27,8 @@
>  #include <inttypes.h>
>  #include <string.h>
>  
> -#define FWTS_ACPI_LID_HID "PNP0C0D"
> +#define FWTS_ACPI_DEVICE_HID "PNP0C0D"
> +#define FWTS_ACPI_DEVICE "lid"
>  
>  static ACPI_HANDLE device;
>  
> @@ -49,14 +50,14 @@ static int acpi_lid_init(fwts_framework *fw)
>  	if (fwts_acpica_init(fw) != FWTS_OK)
>  		return FWTS_ERROR;
>  
> -	status = AcpiGetDevices(FWTS_ACPI_LID_HID, get_device_handle, NULL, NULL);
> +	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
>  	if (ACPI_FAILURE(status)) {
>  		fwts_log_error(fw, "Cannot find the ACPI device");
>  		return FWTS_ERROR;
>  	}
>  
>  	if (!device) {
> -		fwts_log_error(fw, "ACPI lid device does not exist, skipping test");
> +		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
>  		fwts_acpica_deinit();
>  		return FWTS_SKIP;
>  	} else {
> @@ -68,7 +69,7 @@ static int acpi_lid_init(fwts_framework *fw)
>  
>  		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
>  		if (ACPI_SUCCESS(status)) {
> -			fwts_log_info_verbatim(fw, "ACPI Lid Device: %s", full_name);
> +			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
>  			fwts_log_nl(fw);
>  		}
>  	}
> diff --git a/src/acpi/devices/nvdimm/nvdimm.c b/src/acpi/devices/nvdimm/nvdimm.c
> index 507fa082..3f93f815 100644
> --- a/src/acpi/devices/nvdimm/nvdimm.c
> +++ b/src/acpi/devices/nvdimm/nvdimm.c
> @@ -27,7 +27,8 @@
>  #include <inttypes.h>
>  #include <string.h>
>  
> -#define FWTS_ACPI_NVDIMM_HID "ACPI0012"
> +#define FWTS_ACPI_DEVICE_HID "ACPI0012"
> +#define FWTS_ACPI_DEVICE "NVDIMM"
>  
>  static ACPI_HANDLE device;
>  
> @@ -49,14 +50,14 @@ static int acpi_nvdimm_init(fwts_framework *fw)
>  	if (fwts_acpica_init(fw) != FWTS_OK)
>  		return FWTS_ERROR;
>  
> -	status = AcpiGetDevices(FWTS_ACPI_NVDIMM_HID, get_device_handle, NULL, NULL);
> +	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
>  	if (ACPI_FAILURE(status)) {
>  		fwts_log_error(fw, "Cannot find the ACPI device");
>  		return FWTS_ERROR;
>  	}
>  
>  	if (!device) {
> -		fwts_log_error(fw, "ACPI NVDIMM device does not exist, skipping test");
> +		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
>  		fwts_acpica_deinit();
>  		return FWTS_SKIP;
>  	} else {
> @@ -68,7 +69,7 @@ static int acpi_nvdimm_init(fwts_framework *fw)
>  
>  		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
>  		if (ACPI_SUCCESS(status)) {
> -			fwts_log_info_verbatim(fw, "ACPI NVDIMM Device: %s", full_name);
> +			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
>  			fwts_log_nl(fw);
>  		}
>  	}
> diff --git a/src/acpi/devices/sensor/als.c b/src/acpi/devices/sensor/als.c
> index 5cb712bf..5c781511 100644
> --- a/src/acpi/devices/sensor/als.c
> +++ b/src/acpi/devices/sensor/als.c
> @@ -27,7 +27,8 @@
>  #include <inttypes.h>
>  #include <string.h>
>  
> -#define FWTS_ACPI_AMBIENT_LIGHT_HID "ACPI0008"
> +#define FWTS_ACPI_DEVICE_HID "ACPI0008"
> +#define FWTS_ACPI_DEVICE "ambient light sensor"
>  
>  static ACPI_HANDLE device;
>  
> @@ -49,14 +50,14 @@ static int ambient_light_init(fwts_framework *fw)
>  	if (fwts_acpica_init(fw) != FWTS_OK)
>  		return FWTS_ERROR;
>  
> -	status = AcpiGetDevices(FWTS_ACPI_AMBIENT_LIGHT_HID, get_device_handle, NULL, NULL);
> +	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
>  	if (ACPI_FAILURE(status)) {
>  		fwts_log_error(fw, "Cannot find the ACPI device");
>  		return FWTS_ERROR;
>  	}
>  
>  	if (!device) {
> -		fwts_log_error(fw, "ACPI ambient light sensor device does not exist, skipping test");
> +		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
>  		fwts_acpica_deinit();
>  		return FWTS_SKIP;
>  	} else {
> @@ -68,7 +69,7 @@ static int ambient_light_init(fwts_framework *fw)
>  
>  		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
>  		if (ACPI_SUCCESS(status)) {
> -			fwts_log_info_verbatim(fw, "ACPI Ambient Light Sensor Device: %s", full_name);
> +			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
>  			fwts_log_nl(fw);
>  		}
>  	}
> diff --git a/src/acpi/devices/time/time.c b/src/acpi/devices/time/time.c
> index 4f776cf6..7caa2728 100644
> --- a/src/acpi/devices/time/time.c
> +++ b/src/acpi/devices/time/time.c
> @@ -27,7 +27,8 @@
>  #include <inttypes.h>
>  #include <string.h>
>  
> -#define FWTS_ACPI_TIME_ALARM_HID "ACPI000E"
> +#define FWTS_ACPI_DEVICE_HID "ACPI000E"
> +#define FWTS_ACPI_DEVICE "time and alarm"
>  
>  static ACPI_HANDLE device;
>  
> @@ -51,14 +52,14 @@ static int acpi_time_alarm_init(fwts_framework *fw)
>  	if (fwts_acpica_init(fw) != FWTS_OK)
>  		return FWTS_ERROR;
>  
> -	status = AcpiGetDevices(FWTS_ACPI_TIME_ALARM_HID, get_device_handle, NULL, NULL);
> +	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
>  	if (ACPI_FAILURE(status)) {
>  		fwts_log_error(fw, "Cannot find the ACPI device");
>  		return FWTS_ERROR;
>  	}
>  
>  	if (!device) {
> -		fwts_log_error(fw, "ACPI time and alarm device does not exist, skipping test");
> +		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
>  		fwts_acpica_deinit();
>  		return FWTS_SKIP;
>  	} else {
> @@ -70,7 +71,7 @@ static int acpi_time_alarm_init(fwts_framework *fw)
>  
>  		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
>  		if (ACPI_SUCCESS(status)) {
> -			fwts_log_info_verbatim(fw, "ACPI Time and Alarm Device: %s", full_name);
> +			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
>  			fwts_log_nl(fw);
>  		}
>  	}
> diff --git a/src/acpi/devices/wpc/wpc.c b/src/acpi/devices/wpc/wpc.c
> index 516ce970..019a40f2 100644
> --- a/src/acpi/devices/wpc/wpc.c
> +++ b/src/acpi/devices/wpc/wpc.c
> @@ -27,7 +27,8 @@
>  #include <inttypes.h>
>  #include <string.h>
>  
> -#define FWTS_ACPI_WPC_HID "ACPI0014"
> +#define FWTS_ACPI_DEVICE_HID "ACPI0014"
> +#define FWTS_ACPI_DEVICE "wireless power calibration"
>  
>  static ACPI_HANDLE device;
>  
> @@ -49,14 +50,14 @@ static int acpi_wpc_init(fwts_framework *fw)
>  	if (fwts_acpica_init(fw) != FWTS_OK)
>  		return FWTS_ERROR;
>  
> -	status = AcpiGetDevices(FWTS_ACPI_WPC_HID, get_device_handle, NULL, NULL);
> +	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
>  	if (ACPI_FAILURE(status)) {
>  		fwts_log_error(fw, "Cannot find the ACPI device");
>  		return FWTS_ERROR;
>  	}
>  
>  	if (!device) {
> -		fwts_log_error(fw, "ACPI wireless power calibration device does not exist, skipping test");
> +		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
>  		fwts_acpica_deinit();
>  		return FWTS_SKIP;
>  	} else {
> @@ -68,7 +69,7 @@ static int acpi_wpc_init(fwts_framework *fw)
>  
>  		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
>  		if (ACPI_SUCCESS(status)) {
> -			fwts_log_info_verbatim(fw, "ACPI Wireless Power Calibration Device: %s", full_name);
> +			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
>  			fwts_log_nl(fw);
>  		}
>  	}
> 

Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff mbox series

Patch

diff --git a/src/acpi/devices/ac_adapter/ac.c b/src/acpi/devices/ac_adapter/ac.c
index 2a07c313..c924143d 100644
--- a/src/acpi/devices/ac_adapter/ac.c
+++ b/src/acpi/devices/ac_adapter/ac.c
@@ -27,7 +27,8 @@ 
 #include <inttypes.h>
 #include <string.h>
 
-#define FWTS_ACPI_AC_HID "ACPI0003"
+#define FWTS_ACPI_DEVICE_HID "ACPI0003"
+#define FWTS_ACPI_DEVICE "AC adapter"
 
 static ACPI_HANDLE device;
 
@@ -49,14 +50,14 @@  static int acpi_ac_init(fwts_framework *fw)
 	if (fwts_acpica_init(fw) != FWTS_OK)
 		return FWTS_ERROR;
 
-	status = AcpiGetDevices(FWTS_ACPI_AC_HID, get_device_handle, NULL, NULL);
+	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
 	if (ACPI_FAILURE(status)) {
 		fwts_log_error(fw, "Cannot find the ACPI device");
 		return FWTS_ERROR;
 	}
 
 	if (!device) {
-		fwts_log_error(fw, "ACPI AC device does not exist, skipping test");
+		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
 		fwts_acpica_deinit();
 		return FWTS_SKIP;
 	} else {
@@ -68,7 +69,7 @@  static int acpi_ac_init(fwts_framework *fw)
 
 		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
 		if (ACPI_SUCCESS(status)) {
-			fwts_log_info_verbatim(fw, "ACPI AC Adapter Device: %s", full_name);
+			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
 			fwts_log_nl(fw);
 		}
 	}
diff --git a/src/acpi/devices/battery/battery.c b/src/acpi/devices/battery/battery.c
index 400f485b..00c375c7 100644
--- a/src/acpi/devices/battery/battery.c
+++ b/src/acpi/devices/battery/battery.c
@@ -27,7 +27,8 @@ 
 #include <inttypes.h>
 #include <string.h>
 
-#define FWTS_ACPI_BATTERY_HID "PNP0C0A"
+#define FWTS_ACPI_DEVICE_HID "PNP0C0A"
+#define FWTS_ACPI_DEVICE "battery"
 
 static ACPI_HANDLE device;
 
@@ -49,14 +50,14 @@  static int acpi_battery_init(fwts_framework *fw)
 	if (fwts_acpica_init(fw) != FWTS_OK)
 		return FWTS_ERROR;
 
-	status = AcpiGetDevices(FWTS_ACPI_BATTERY_HID, get_device_handle, NULL, NULL);
+	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
 	if (ACPI_FAILURE(status)) {
 		fwts_log_error(fw, "Cannot find the ACPI device");
 		return FWTS_ERROR;
 	}
 
 	if (!device) {
-		fwts_log_error(fw, "ACPI Battery device does not exist, skipping test");
+		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
 		fwts_acpica_deinit();
 		return FWTS_SKIP;
 	} else {
@@ -68,7 +69,7 @@  static int acpi_battery_init(fwts_framework *fw)
 
 		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
 		if (ACPI_SUCCESS(status)) {
-			fwts_log_info_verbatim(fw, "ACPI Battery Device: %s", full_name);
+			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
 			fwts_log_nl(fw);
 		}
 	}
diff --git a/src/acpi/devices/battery/smart_battery.c b/src/acpi/devices/battery/smart_battery.c
index bf3f4043..83dd8b3b 100644
--- a/src/acpi/devices/battery/smart_battery.c
+++ b/src/acpi/devices/battery/smart_battery.c
@@ -27,7 +27,8 @@ 
 #include <inttypes.h>
 #include <string.h>
 
-#define FWTS_SMART_BATTERY_HID "ACPI0002"
+#define FWTS_ACPI_DEVICE_HID "ACPI0002"
+#define FWTS_ACPI_DEVICE "smart battery"
 
 static ACPI_HANDLE device;
 
@@ -49,14 +50,14 @@  static int smart_battery_init(fwts_framework *fw)
 	if (fwts_acpica_init(fw) != FWTS_OK)
 		return FWTS_ERROR;
 
-	status = AcpiGetDevices(FWTS_SMART_BATTERY_HID, get_device_handle, NULL, NULL);
+	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
 	if (ACPI_FAILURE(status)) {
 		fwts_log_error(fw, "Cannot find the ACPI device");
 		return FWTS_ERROR;
 	}
 
 	if (!device) {
-		fwts_log_error(fw, "Smart Battery device does not exist, skipping test");
+		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
 		fwts_acpica_deinit();
 		return FWTS_SKIP;
 	} else {
@@ -68,7 +69,7 @@  static int smart_battery_init(fwts_framework *fw)
 
 		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
 		if (ACPI_SUCCESS(status)) {
-			fwts_log_info_verbatim(fw, "Smart Battery Device: %s", full_name);
+			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
 			fwts_log_nl(fw);
 		}
 	}
diff --git a/src/acpi/devices/buttons/power_button.c b/src/acpi/devices/buttons/power_button.c
index d69a1a12..84c2d2dc 100644
--- a/src/acpi/devices/buttons/power_button.c
+++ b/src/acpi/devices/buttons/power_button.c
@@ -27,7 +27,8 @@ 
 #include <inttypes.h>
 #include <string.h>
 
-#define FWTS_POWER_BUTTON_HID "PNP0C0C"
+#define FWTS_ACPI_DEVICE_HID "PNP0C0C"
+#define FWTS_ACPI_DEVICE "power button"
 
 static ACPI_HANDLE device;
 
@@ -49,14 +50,14 @@  static int power_button_init(fwts_framework *fw)
 	if (fwts_acpica_init(fw) != FWTS_OK)
 		return FWTS_ERROR;
 
-	status = AcpiGetDevices(FWTS_POWER_BUTTON_HID, get_device_handle, NULL, NULL);
+	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
 	if (ACPI_FAILURE(status)) {
 		fwts_log_error(fw, "Cannot find the ACPI device");
 		return FWTS_ERROR;
 	}
 
 	if (!device) {
-		fwts_log_error(fw, "ACPI power button device does not exist, skipping test");
+		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
 		fwts_acpica_deinit();
 		return FWTS_SKIP;
 	} else {
@@ -68,7 +69,7 @@  static int power_button_init(fwts_framework *fw)
 
 		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
 		if (ACPI_SUCCESS(status)) {
-			fwts_log_info_verbatim(fw, "ACPI Power Button Device: %s", full_name);
+			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
 			fwts_log_nl(fw);
 		}
 	}
diff --git a/src/acpi/devices/buttons/sleep_button.c b/src/acpi/devices/buttons/sleep_button.c
index 39a7d558..d32ca3c9 100644
--- a/src/acpi/devices/buttons/sleep_button.c
+++ b/src/acpi/devices/buttons/sleep_button.c
@@ -27,7 +27,8 @@ 
 #include <inttypes.h>
 #include <string.h>
 
-#define FWTS_SLEEP_BUTTON_HID "PNP0C0E"
+#define FWTS_ACPI_DEVICE_HID "PNP0C0E"
+#define FWTS_ACPI_DEVICE "sleep button"
 
 static ACPI_HANDLE device;
 
@@ -49,14 +50,14 @@  static int sleep_button_init(fwts_framework *fw)
 	if (fwts_acpica_init(fw) != FWTS_OK)
 		return FWTS_ERROR;
 
-	status = AcpiGetDevices(FWTS_SLEEP_BUTTON_HID, get_device_handle, NULL, NULL);
+	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
 	if (ACPI_FAILURE(status)) {
 		fwts_log_error(fw, "Cannot find the ACPI device");
 		return FWTS_ERROR;
 	}
 
 	if (!device) {
-		fwts_log_error(fw, "ACPI sleep button device does not exist, skipping test");
+		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
 		fwts_acpica_deinit();
 		return FWTS_SKIP;
 	} else {
@@ -68,7 +69,7 @@  static int sleep_button_init(fwts_framework *fw)
 
 		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
 		if (ACPI_SUCCESS(status)) {
-			fwts_log_info_verbatim(fw, "ACPI Sleep Button Device: %s", full_name);
+			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
 			fwts_log_nl(fw);
 		}
 	}
diff --git a/src/acpi/devices/ec/ec.c b/src/acpi/devices/ec/ec.c
index 1db1d8a5..63430586 100644
--- a/src/acpi/devices/ec/ec.c
+++ b/src/acpi/devices/ec/ec.c
@@ -27,7 +27,8 @@ 
 #include <inttypes.h>
 #include <string.h>
 
-#define FWTS_ACPI_EC_HID "PNP0C09"
+#define FWTS_ACPI_DEVICE_HID "PNP0C09"
+#define FWTS_ACPI_DEVICE "EC"
 
 static ACPI_HANDLE device;
 
@@ -49,14 +50,14 @@  static int acpi_ec_init(fwts_framework *fw)
 	if (fwts_acpica_init(fw) != FWTS_OK)
 		return FWTS_ERROR;
 
-	status = AcpiGetDevices(FWTS_ACPI_EC_HID, get_device_handle, NULL, NULL);
+	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
 	if (ACPI_FAILURE(status)) {
 		fwts_log_error(fw, "Cannot find the ACPI device");
 		return FWTS_ERROR;
 	}
 
 	if (!device) {
-		fwts_log_error(fw, "ACPI EC device does not exist, skipping test");
+		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
 		fwts_acpica_deinit();
 		return FWTS_SKIP;
 	} else {
@@ -68,7 +69,7 @@  static int acpi_ec_init(fwts_framework *fw)
 
 		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
 		if (ACPI_SUCCESS(status)) {
-			fwts_log_info_verbatim(fw, "ACPI EC Device: %s", full_name);
+			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
 			fwts_log_nl(fw);
 		}
 	}
diff --git a/src/acpi/devices/lid/lid.c b/src/acpi/devices/lid/lid.c
index e76914cc..f1036ac7 100644
--- a/src/acpi/devices/lid/lid.c
+++ b/src/acpi/devices/lid/lid.c
@@ -27,7 +27,8 @@ 
 #include <inttypes.h>
 #include <string.h>
 
-#define FWTS_ACPI_LID_HID "PNP0C0D"
+#define FWTS_ACPI_DEVICE_HID "PNP0C0D"
+#define FWTS_ACPI_DEVICE "lid"
 
 static ACPI_HANDLE device;
 
@@ -49,14 +50,14 @@  static int acpi_lid_init(fwts_framework *fw)
 	if (fwts_acpica_init(fw) != FWTS_OK)
 		return FWTS_ERROR;
 
-	status = AcpiGetDevices(FWTS_ACPI_LID_HID, get_device_handle, NULL, NULL);
+	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
 	if (ACPI_FAILURE(status)) {
 		fwts_log_error(fw, "Cannot find the ACPI device");
 		return FWTS_ERROR;
 	}
 
 	if (!device) {
-		fwts_log_error(fw, "ACPI lid device does not exist, skipping test");
+		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
 		fwts_acpica_deinit();
 		return FWTS_SKIP;
 	} else {
@@ -68,7 +69,7 @@  static int acpi_lid_init(fwts_framework *fw)
 
 		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
 		if (ACPI_SUCCESS(status)) {
-			fwts_log_info_verbatim(fw, "ACPI Lid Device: %s", full_name);
+			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
 			fwts_log_nl(fw);
 		}
 	}
diff --git a/src/acpi/devices/nvdimm/nvdimm.c b/src/acpi/devices/nvdimm/nvdimm.c
index 507fa082..3f93f815 100644
--- a/src/acpi/devices/nvdimm/nvdimm.c
+++ b/src/acpi/devices/nvdimm/nvdimm.c
@@ -27,7 +27,8 @@ 
 #include <inttypes.h>
 #include <string.h>
 
-#define FWTS_ACPI_NVDIMM_HID "ACPI0012"
+#define FWTS_ACPI_DEVICE_HID "ACPI0012"
+#define FWTS_ACPI_DEVICE "NVDIMM"
 
 static ACPI_HANDLE device;
 
@@ -49,14 +50,14 @@  static int acpi_nvdimm_init(fwts_framework *fw)
 	if (fwts_acpica_init(fw) != FWTS_OK)
 		return FWTS_ERROR;
 
-	status = AcpiGetDevices(FWTS_ACPI_NVDIMM_HID, get_device_handle, NULL, NULL);
+	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
 	if (ACPI_FAILURE(status)) {
 		fwts_log_error(fw, "Cannot find the ACPI device");
 		return FWTS_ERROR;
 	}
 
 	if (!device) {
-		fwts_log_error(fw, "ACPI NVDIMM device does not exist, skipping test");
+		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
 		fwts_acpica_deinit();
 		return FWTS_SKIP;
 	} else {
@@ -68,7 +69,7 @@  static int acpi_nvdimm_init(fwts_framework *fw)
 
 		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
 		if (ACPI_SUCCESS(status)) {
-			fwts_log_info_verbatim(fw, "ACPI NVDIMM Device: %s", full_name);
+			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
 			fwts_log_nl(fw);
 		}
 	}
diff --git a/src/acpi/devices/sensor/als.c b/src/acpi/devices/sensor/als.c
index 5cb712bf..5c781511 100644
--- a/src/acpi/devices/sensor/als.c
+++ b/src/acpi/devices/sensor/als.c
@@ -27,7 +27,8 @@ 
 #include <inttypes.h>
 #include <string.h>
 
-#define FWTS_ACPI_AMBIENT_LIGHT_HID "ACPI0008"
+#define FWTS_ACPI_DEVICE_HID "ACPI0008"
+#define FWTS_ACPI_DEVICE "ambient light sensor"
 
 static ACPI_HANDLE device;
 
@@ -49,14 +50,14 @@  static int ambient_light_init(fwts_framework *fw)
 	if (fwts_acpica_init(fw) != FWTS_OK)
 		return FWTS_ERROR;
 
-	status = AcpiGetDevices(FWTS_ACPI_AMBIENT_LIGHT_HID, get_device_handle, NULL, NULL);
+	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
 	if (ACPI_FAILURE(status)) {
 		fwts_log_error(fw, "Cannot find the ACPI device");
 		return FWTS_ERROR;
 	}
 
 	if (!device) {
-		fwts_log_error(fw, "ACPI ambient light sensor device does not exist, skipping test");
+		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
 		fwts_acpica_deinit();
 		return FWTS_SKIP;
 	} else {
@@ -68,7 +69,7 @@  static int ambient_light_init(fwts_framework *fw)
 
 		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
 		if (ACPI_SUCCESS(status)) {
-			fwts_log_info_verbatim(fw, "ACPI Ambient Light Sensor Device: %s", full_name);
+			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
 			fwts_log_nl(fw);
 		}
 	}
diff --git a/src/acpi/devices/time/time.c b/src/acpi/devices/time/time.c
index 4f776cf6..7caa2728 100644
--- a/src/acpi/devices/time/time.c
+++ b/src/acpi/devices/time/time.c
@@ -27,7 +27,8 @@ 
 #include <inttypes.h>
 #include <string.h>
 
-#define FWTS_ACPI_TIME_ALARM_HID "ACPI000E"
+#define FWTS_ACPI_DEVICE_HID "ACPI000E"
+#define FWTS_ACPI_DEVICE "time and alarm"
 
 static ACPI_HANDLE device;
 
@@ -51,14 +52,14 @@  static int acpi_time_alarm_init(fwts_framework *fw)
 	if (fwts_acpica_init(fw) != FWTS_OK)
 		return FWTS_ERROR;
 
-	status = AcpiGetDevices(FWTS_ACPI_TIME_ALARM_HID, get_device_handle, NULL, NULL);
+	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
 	if (ACPI_FAILURE(status)) {
 		fwts_log_error(fw, "Cannot find the ACPI device");
 		return FWTS_ERROR;
 	}
 
 	if (!device) {
-		fwts_log_error(fw, "ACPI time and alarm device does not exist, skipping test");
+		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
 		fwts_acpica_deinit();
 		return FWTS_SKIP;
 	} else {
@@ -70,7 +71,7 @@  static int acpi_time_alarm_init(fwts_framework *fw)
 
 		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
 		if (ACPI_SUCCESS(status)) {
-			fwts_log_info_verbatim(fw, "ACPI Time and Alarm Device: %s", full_name);
+			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
 			fwts_log_nl(fw);
 		}
 	}
diff --git a/src/acpi/devices/wpc/wpc.c b/src/acpi/devices/wpc/wpc.c
index 516ce970..019a40f2 100644
--- a/src/acpi/devices/wpc/wpc.c
+++ b/src/acpi/devices/wpc/wpc.c
@@ -27,7 +27,8 @@ 
 #include <inttypes.h>
 #include <string.h>
 
-#define FWTS_ACPI_WPC_HID "ACPI0014"
+#define FWTS_ACPI_DEVICE_HID "ACPI0014"
+#define FWTS_ACPI_DEVICE "wireless power calibration"
 
 static ACPI_HANDLE device;
 
@@ -49,14 +50,14 @@  static int acpi_wpc_init(fwts_framework *fw)
 	if (fwts_acpica_init(fw) != FWTS_OK)
 		return FWTS_ERROR;
 
-	status = AcpiGetDevices(FWTS_ACPI_WPC_HID, get_device_handle, NULL, NULL);
+	status = AcpiGetDevices(FWTS_ACPI_DEVICE_HID, get_device_handle, NULL, NULL);
 	if (ACPI_FAILURE(status)) {
 		fwts_log_error(fw, "Cannot find the ACPI device");
 		return FWTS_ERROR;
 	}
 
 	if (!device) {
-		fwts_log_error(fw, "ACPI wireless power calibration device does not exist, skipping test");
+		fwts_log_error(fw, "ACPI %s device does not exist, skipping test", FWTS_ACPI_DEVICE);
 		fwts_acpica_deinit();
 		return FWTS_SKIP;
 	} else {
@@ -68,7 +69,7 @@  static int acpi_wpc_init(fwts_framework *fw)
 
 		status = AcpiGetName(device, ACPI_FULL_PATHNAME, &buffer);
 		if (ACPI_SUCCESS(status)) {
-			fwts_log_info_verbatim(fw, "ACPI Wireless Power Calibration Device: %s", full_name);
+			fwts_log_info_verbatim(fw, "ACPI %s device: %s", FWTS_ACPI_DEVICE, full_name);
 			fwts_log_nl(fw);
 		}
 	}