arm: simplify updating ACPI table header checksum
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Fri, 21 Mar 2025 23:21:20 +0000 (00:21 +0100)
committerTom Rini <trini@konsulko.com>
Tue, 8 Apr 2025 21:22:56 +0000 (15:22 -0600)
Use acpi_update_checksum() to update table header.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Matthias Brugger <mbrugger@suse.com>
arch/arm/mach-bcm283x/bcm2711_acpi.c
board/raspberrypi/rpi/rpi.c

index 79b2833..58f8ee2 100644 (file)
@@ -81,7 +81,7 @@ static int acpi_write_pptt(struct acpi_ctx *ctx, const struct acpi_writer *entry
        }
 
        header->length = ctx->current - ctx->tab_start;
-       header->checksum = table_compute_checksum(header, header->length);
+       acpi_update_checksum(header);
 
        acpi_inc(ctx, header->length);
        acpi_add_table(ctx, header);
@@ -116,7 +116,7 @@ static int rpi_write_gtdt(struct acpi_ctx *ctx, const struct acpi_writer *entry)
        gtdt->el2_flags = GTDT_FLAG_INT_ACTIVE_LOW;
        gtdt->cnt_read_base = 0xffffffffffffffff;
 
-       header->checksum = table_compute_checksum(header, header->length);
+       acpi_update_checksum(header);
 
        acpi_add_table(ctx, gtdt);
 
index 70d3c35..6ecd3eb 100644 (file)
@@ -791,7 +791,7 @@ static int rpi_acpi_write_ssdt(struct acpi_ctx *ctx, const struct acpi_writer *e
 
        /* (Re)calculate length and checksum */
        ssdt->length = ctx->current - (void *)ssdt;
-       ssdt->checksum = table_compute_checksum((void *)ssdt, ssdt->length);
+       acpi_update_checksum(ssdt);
        log_debug("SSDT at %p, length %x\n", ssdt, ssdt->length);
 
        /* Drop the table if it is empty */