hw/arm/aspeed: Remove AspeedSoCClass dependency from aspeed_uart_last() API

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>
This commit is contained in:
Jamin Lin
2025-10-13 14:37:55 +02:00
committed by Cédric Le Goater
parent 03c9c22f90
commit 37d2e4b533
2 changed files with 3 additions and 3 deletions
+1 -1
View 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");
+2 -2
View 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 */