[PATCH v2 16/17] hw/arm/aspeed: Promote connect_serial_hds_to_uarts() to public machine API

Jamin Lin via posted 17 patches 6 days, 20 hours ago
[PATCH v2 16/17] hw/arm/aspeed: Promote connect_serial_hds_to_uarts() to public machine API
Posted by Jamin Lin via 6 days, 20 hours ago
This commit promotes connect_serial_hds_to_uarts() to a public Aspeed
machine API, allowing board-specific implementations to use it for
connecting serial host devices to the SoC UARTs.

Previously, this function was declared static within aspeed.c and used
only internally. Making this function a public API standardizes that
process and avoids code duplication.

No functional changes.

Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
---
 include/hw/arm/aspeed.h | 1 +
 hw/arm/aspeed.c         | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h
index 02f0ea5522..1546d2952f 100644
--- a/include/hw/arm/aspeed.h
+++ b/include/hw/arm/aspeed.h
@@ -70,5 +70,6 @@ void aspeed_machine_class_init_cpus_defaults(MachineClass *mc);
 void create_pca9552(AspeedSoCState *soc, int bus_id, int addr);
 I2CSlave *create_pca9554(AspeedSoCState *soc, int bus_id, int addr);
 void aspeed_machine_ast2600_class_emmc_init(ObjectClass *oc);
+void connect_serial_hds_to_uarts(AspeedMachineState *bmc);
 
 #endif
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index fc37f48802..c5e8a0608d 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -117,7 +117,7 @@ static void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo, bool emmc,
                                &error_fatal);
 }
 
-static void connect_serial_hds_to_uarts(AspeedMachineState *bmc)
+void connect_serial_hds_to_uarts(AspeedMachineState *bmc)
 {
     AspeedMachineClass *amc = ASPEED_MACHINE_GET_CLASS(bmc);
     AspeedSoCState *s = bmc->soc;
-- 
2.43.0
Re: [SPAM] [PATCH v2 16/17] hw/arm/aspeed: Promote connect_serial_hds_to_uarts() to public machine API
Posted by Cédric Le Goater 6 days, 7 hours ago
On 10/29/25 05:37, Jamin Lin wrote:
> This commit promotes connect_serial_hds_to_uarts() to a public Aspeed
> machine API, allowing board-specific implementations to use it for
> connecting serial host devices to the SoC UARTs.
> 
> Previously, this function was declared static within aspeed.c and used
> only internally. Making this function a public API standardizes that
> process and avoids code duplication.
> 
> No functional changes.
> 
> Signed-off-by: Jamin Lin <jamin_lin@aspeedtech.com>
> ---
>   include/hw/arm/aspeed.h | 1 +
>   hw/arm/aspeed.c         | 2 +-
>   2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/include/hw/arm/aspeed.h b/include/hw/arm/aspeed.h
> index 02f0ea5522..1546d2952f 100644
> --- a/include/hw/arm/aspeed.h
> +++ b/include/hw/arm/aspeed.h
> @@ -70,5 +70,6 @@ void aspeed_machine_class_init_cpus_defaults(MachineClass *mc);
>   void create_pca9552(AspeedSoCState *soc, int bus_id, int addr);
>   I2CSlave *create_pca9554(AspeedSoCState *soc, int bus_id, int addr);
>   void aspeed_machine_ast2600_class_emmc_init(ObjectClass *oc);
> +void connect_serial_hds_to_uarts(AspeedMachineState *bmc);
>   
>   #endif
> diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
> index fc37f48802..c5e8a0608d 100644
> --- a/hw/arm/aspeed.c
> +++ b/hw/arm/aspeed.c
> @@ -117,7 +117,7 @@ static void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo, bool emmc,
>                                  &error_fatal);
>   }
>   
> -static void connect_serial_hds_to_uarts(AspeedMachineState *bmc)
> +void connect_serial_hds_to_uarts(AspeedMachineState *bmc)
>   {
>       AspeedMachineClass *amc = ASPEED_MACHINE_GET_CLASS(bmc);
>       AspeedSoCState *s = bmc->soc;


Please add an 'aspeed_' prefix and consider documentation.


Thanks,

C.