From 2d3f3a16134f67f5fba29a981fc30972517764cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Poussineau?= Date: Wed, 20 Nov 2024 19:08:02 +0100 Subject: [PATCH] [COMPBATT] Use BATTERY_TAG_INVALID instead 0 when applicable --- drivers/bus/acpi/compbatt/compbatt.c | 10 +++++----- drivers/bus/acpi/compbatt/comppnp.c | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/bus/acpi/compbatt/compbatt.c b/drivers/bus/acpi/compbatt/compbatt.c index e6ef0d738d9..2c947910c29 100644 --- a/drivers/bus/acpi/compbatt/compbatt.c +++ b/drivers/bus/acpi/compbatt/compbatt.c @@ -111,7 +111,7 @@ CompBattRecalculateTag(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension) } /* No tag for this device extension, clear it */ - DeviceExtension->Tag = 0; + DeviceExtension->Tag = BATTERY_TAG_INVALID; NextEntry = NextEntry->Flink; } @@ -161,7 +161,7 @@ CompBattQueryTag(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension, } /* Do we have a tag now? */ - if ((DeviceExtension->Flags & COMPBATT_TAG_ASSIGNED) && (DeviceExtension->Tag)) + if ((DeviceExtension->Flags & COMPBATT_TAG_ASSIGNED) && DeviceExtension->Tag != BATTERY_TAG_INVALID) { /* Return the tag */ *Tag = DeviceExtension->Tag; @@ -170,7 +170,7 @@ CompBattQueryTag(IN PCOMPBATT_DEVICE_EXTENSION DeviceExtension, else { /* No tag */ - *Tag = 0; + *Tag = BATTERY_TAG_INVALID; Status = STATUS_NO_SUCH_DEVICE; } @@ -261,7 +261,7 @@ CompBattGetBatteryInformation(OUT PBATTERY_INFORMATION BatteryInfo, InputBuffer.AtRate = 0; /* Make sure the battery has a tag */ - if (BatteryData->Tag) + if (BatteryData->Tag != BATTERY_TAG_INVALID) { /* Do we already have the data? */ if (!(BatteryData->Flags & COMPBATT_BATTERY_INFORMATION_PRESENT)) @@ -419,7 +419,7 @@ CompBattGetBatteryGranularity(OUT PBATTERY_REPORTING_SCALE ReportingScale, InputBuffer.InformationLevel = BatteryGranularityInformation; /* Make sure the battery has a tag */ - if (BatteryData->Tag) + if (BatteryData->Tag != BATTERY_TAG_INVALID) { /* Send the IOCTL to query the information */ RtlZeroMemory(&BatteryData->BatteryInformation, diff --git a/drivers/bus/acpi/compbatt/comppnp.c b/drivers/bus/acpi/compbatt/comppnp.c index 61b87736758..141ec2ebbe4 100644 --- a/drivers/bus/acpi/compbatt/comppnp.c +++ b/drivers/bus/acpi/compbatt/comppnp.c @@ -134,7 +134,7 @@ CompBattAddNewBattery(IN PUNICODE_STRING BatteryName, { /* Initialize the data and write the battery name */ RtlZeroMemory(BatteryData, sizeof(COMPBATT_BATTERY_DATA)); - BatteryData->Tag = 0; + BatteryData->Tag = BATTERY_TAG_INVALID; BatteryData->BatteryName.MaximumLength = BatteryName->Length; BatteryData->BatteryName.Buffer = (PWCHAR)(BatteryData + 1); RtlCopyUnicodeString(&BatteryData->BatteryName, BatteryName);