]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
hw/arm/aspeed: Remove AspeedSoCClass dependency from aspeed_uart_last() API
authorJamin Lin <jamin_lin@aspeedtech.com>
Mon, 13 Oct 2025 05:43:14 +0000 (13:43 +0800)
committerCédric Le Goater <clg@redhat.com>
Mon, 13 Oct 2025 12:37:55 +0000 (14:37 +0200)
Refactor the aspeed_uart_last() helper to remove its dependency on
AspeedSoCClass and make the UART helper APIs more generic.

The function now takes uarts_base and uarts_num as integer
parameters instead of requiring a full SoC class instance.
All related call sites in aspeed.c are updated accordingly.

No functional change.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Link: https://lore.kernel.org/qemu-devel/20251013054334.955331-3-jamin_lin@aspeedtech.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
hw/arm/aspeed.c
include/hw/arm/aspeed_soc.h

index 49d8debf9988c9d49bdfa7a3c4ccf07b469d4cb3..ad17471c8d6137915ce5cad3d4faf72ceb15e8d7 100644 (file)
@@ -1311,7 +1311,7 @@ static void aspeed_set_bmc_console(Object *obj, const char *value, Error **errp)
     AspeedSoCClass *sc = ASPEED_SOC_CLASS(object_class_by_name(amc->soc_name));
     int val;
     int uart_first = aspeed_uart_first(sc->uarts_base);
-    int uart_last = aspeed_uart_last(sc);
+    int uart_last = aspeed_uart_last(sc->uarts_base, sc->uarts_num);
 
     if (sscanf(value, "uart%u", &val) != 1) {
         error_setg(errp, "Bad value for \"uart\" property");
index 5786fbbcbbe71ed06aaf3f08b98a7cbb403f2bf1..0162738f884e61ae66720ccc429f8e6d9f248077 100644 (file)
@@ -331,9 +331,9 @@ static inline int aspeed_uart_first(int uarts_base)
     return aspeed_uart_index(uarts_base);
 }
 
-static inline int aspeed_uart_last(AspeedSoCClass *sc)
+static inline int aspeed_uart_last(int uarts_base, int uarts_num)
 {
-    return aspeed_uart_first(sc->uarts_base) + sc->uarts_num - 1;
+    return aspeed_uart_first(uarts_base) + uarts_num - 1;
 }
 
 #endif /* ASPEED_SOC_H */