[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YgJ0kexWU4FROzNJ@lunn.ch>
Date: Tue, 8 Feb 2022 14:48:01 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Holger Brunck <holger.brunck@...achienergy.com>
Cc: netdev@...r.kernel.org, Jakub Kicinski <kuba@...nel.org>,
Marek BehĂșn <kabel@...nel.org>
Subject: Re: [v4] dsa: mv88e6xxx: make serdes SGMII/Fiber tx amplitude
configurable
> +static struct mv88e6352_serdes_p2p_to_val mv88e6352_serdes_p2p_to_val[] = {
Please add a const to this. It will make the memory usage a little
smaller and help protect from overwrite.
> + /* Mapping of configurable mikrovolt values to the register value */
> + { 14000, 0},
> + { 112000, 1},
> + { 210000, 2},
> + { 308000, 3},
> + { 406000, 4},
> + { 504000, 5},
> + { 602000, 6},
> + { 700000, 7},
> +};
> +
> +int mv88e6352_serdes_set_tx_p2p_amplitude(struct mv88e6xxx_chip *chip, int port,
> + int val)
> +{
> + bool found = false;
> + u16 reg;
> + int err;
> + int i;
> +
> + if (!mv88e6352_port_has_serdes(chip, port))
> + return -EOPNOTSUPP;
Russell just reworked this call. Did you take that into account?
> +
> + for (i = 0; i < ARRAY_SIZE(mv88e6352_serdes_p2p_to_val); ++i) {
> + if (mv88e6352_serdes_p2p_to_val[i].mv == val) {
> + reg = mv88e6352_serdes_p2p_to_val[i].regval;
i has the same value as mv88e6352_serdes_p2p_to_val[i].regval, so you
can drop it and just use i.
Andrew
Powered by blists - more mailing lists