mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-07 20:00:13 +00:00
HV: io: spell out explicit narrowing of integers
The MMIO/PIO write APIs in io.h always take a uint32_t value but may uses it as 8, 16 or 32-bit integers. This patch converts the prototypes to align with their functionality. The pointer conversion and assignment are splitted to separate statements to prevent static checkers from being confused about the underlying types. v1 -> v2: * Change the prototype of mmio-related functions, instead of keeping the explicit conversions internal. The addresses are kept void* since in most cases hva (in void*) is passed. Signed-off-by: Junjie Mao <junjie.mao@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -20,10 +20,12 @@ void restore_msrs(void)
|
||||
|
||||
static void acpi_gas_write(struct acpi_generic_address *gas, uint32_t val)
|
||||
{
|
||||
uint16_t val16 = (uint16_t)val;
|
||||
|
||||
if (gas->space_id == SPACE_SYSTEM_MEMORY)
|
||||
mmio_write_word(val, (void *)HPA2HVA(gas->address));
|
||||
mmio_write_word(val16, HPA2HVA(gas->address));
|
||||
else
|
||||
io_write_word(val, gas->address);
|
||||
io_write_word(val16, gas->address);
|
||||
}
|
||||
|
||||
static uint32_t acpi_gas_read(struct acpi_generic_address *gas)
|
||||
@@ -31,7 +33,7 @@ static uint32_t acpi_gas_read(struct acpi_generic_address *gas)
|
||||
uint32_t ret = 0;
|
||||
|
||||
if (gas->space_id == SPACE_SYSTEM_MEMORY)
|
||||
ret = mmio_read_word((void *)HPA2HVA(gas->address));
|
||||
ret = mmio_read_word(HPA2HVA(gas->address));
|
||||
else
|
||||
ret = io_read_word(gas->address);
|
||||
|
||||
|
Reference in New Issue
Block a user