Re: [PATCH v2 4/4] net: dsa: hsr: Provide generic HSR ksz_hsr_{join|leave} functions

From: Andrew Lunn
Date: Sun Sep 03 2023 - 13:22:30 EST


> +static int ksz_hsr_join(struct dsa_switch *ds, int port, struct net_device *hsr)
> +{
> + struct dsa_port *partner = NULL, *dp;
> + struct ksz_device *dev = ds->priv;
> + enum hsr_version ver;
> + int ret;
> +
> + ret = hsr_get_version(hsr, &ver);
> + if (ret)
> + return ret;
> +
> + switch (dev->chip_id) {
> + case KSZ9477_CHIP_ID:
> + if (ver == PRP_V1)
> + return -EOPNOTSUPP;

This should probably check for versions which are support, and not
assume PRP_V42 is not added some time in the future, which would be
accepted here.

Andrew