From: Andrew Lunn <andrew@lunn.ch>
To: Holger Brunck <holger.brunck@hitachienergy.com>
Cc: netdev@vger.kernel.org, "Jakub Kicinski" <kuba@kernel.org>,
"Marek Behún" <kabel@kernel.org>
Subject: Re: [v4] dsa: mv88e6xxx: make serdes SGMII/Fiber tx amplitude configurable
Date: Tue, 8 Feb 2022 14:48:01 +0100 [thread overview]
Message-ID: <YgJ0kexWU4FROzNJ@lunn.ch> (raw)
In-Reply-To: <20220208094455.28870-1-holger.brunck@hitachienergy.com>
> +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
next prev parent reply other threads:[~2022-02-08 13:48 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-08 9:44 [v4] dsa: mv88e6xxx: make serdes SGMII/Fiber tx amplitude configurable Holger Brunck
2022-02-08 13:48 ` Andrew Lunn [this message]
2022-02-08 18:51 ` Holger Brunck
2022-02-08 16:04 ` Marek Behún
2022-02-08 18:49 ` Holger Brunck
2022-02-08 16:12 ` Marek Behún
2022-02-08 18:44 ` Holger Brunck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YgJ0kexWU4FROzNJ@lunn.ch \
--to=andrew@lunn.ch \
--cc=holger.brunck@hitachienergy.com \
--cc=kabel@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).