[PATCH net-next] net: airoha: simplify WAN device check in airoha_dev_init()
Lorenzo Bianconi
lorenzo at kernel.org
Mon Jun 8 01:29:28 PDT 2026
> airoha_register_gdm_devices() iterates eth->ports[] in order, so GDM2's
> netdev is always registered before GDM3/GDM4. This means the explicit
> check for eth->ports[1] && eth->ports[1]->devs[0] is a redundant
> special-case of what airoha_get_wan_gdm_dev() already covers, since
> GDM2 is always marked as WAN during its own ndo_init.
> Remove the redundant check and rely solely on airoha_get_wan_gdm_dev()
> which handles both the GDM2-present and GDM2-absent cases.
>
> Signed-off-by: Lorenzo Bianconi <lorenzo at kernel.org>
Please drop this patch since I need to modify it to address Andrew's request
about LAN/WAN configuration.
Regards,
Lorenzo
> ---
> drivers/net/ethernet/airoha/airoha_eth.c | 12 ++----------
> 1 file changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c
> index 5a8e84fa9918..b333a7b309c2 100644
> --- a/drivers/net/ethernet/airoha/airoha_eth.c
> +++ b/drivers/net/ethernet/airoha/airoha_eth.c
> @@ -2004,18 +2004,10 @@ static int airoha_dev_init(struct net_device *netdev)
>
> switch (port->id) {
> case AIROHA_GDM3_IDX:
> - case AIROHA_GDM4_IDX: {
> - struct airoha_eth *eth = dev->eth;
> -
> - /* GDM2 supports a single net_device */
> - if (eth->ports[1] && eth->ports[1]->devs[0])
> - break;
> -
> - if (airoha_get_wan_gdm_dev(eth))
> + case AIROHA_GDM4_IDX:
> + if (airoha_get_wan_gdm_dev(dev->eth))
> break;
> -
> fallthrough;
> - }
> case AIROHA_GDM2_IDX:
> /* GDM2 is always used as wan */
> dev->flags |= AIROHA_PRIV_F_WAN;
>
> ---
> base-commit: 903db046d5579bef0ea699eae4b279dd6455fc9f
> change-id: 20260606-airoha-eth-simplify-dev-init-5d53c7cc004e
>
> Best regards,
> --
> Lorenzo Bianconi <lorenzo at kernel.org>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20260608/d2f5f893/attachment-0001.sig>
More information about the linux-arm-kernel
mailing list