Commit 1eb9157a authored by Miquel Raynal's avatar Miquel Raynal Committed by Kishon Vijay Abraham I

phy: mvebu-cp110-comphy: Cosmetic change in a helper

Before adding more logic, simplify a bit the writing of the
mvebu_comphy_get_mode() helper by using a pointer instead of
referencing a configuration with the entire table name.
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
parent ef0ac9f2
...@@ -265,16 +265,18 @@ static int mvebu_comphy_get_mode(bool fw_mode, int lane, int port, ...@@ -265,16 +265,18 @@ static int mvebu_comphy_get_mode(bool fw_mode, int lane, int port,
enum phy_mode mode, int submode) enum phy_mode mode, int submode)
{ {
int i, n = ARRAY_SIZE(mvebu_comphy_cp110_modes); int i, n = ARRAY_SIZE(mvebu_comphy_cp110_modes);
const struct mvebu_comphy_conf *conf;
/* Unused PHY mux value is 0x0 */ /* Unused PHY mux value is 0x0 */
if (mode == PHY_MODE_INVALID) if (mode == PHY_MODE_INVALID)
return 0; return 0;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
if (mvebu_comphy_cp110_modes[i].lane == lane && conf = &mvebu_comphy_cp110_modes[i];
mvebu_comphy_cp110_modes[i].port == port && if (conf->lane == lane &&
mvebu_comphy_cp110_modes[i].mode == mode && conf->port == port &&
mvebu_comphy_cp110_modes[i].submode == submode) conf->mode == mode &&
conf->submode == submode)
break; break;
} }
...@@ -282,9 +284,9 @@ static int mvebu_comphy_get_mode(bool fw_mode, int lane, int port, ...@@ -282,9 +284,9 @@ static int mvebu_comphy_get_mode(bool fw_mode, int lane, int port,
return -EINVAL; return -EINVAL;
if (fw_mode) if (fw_mode)
return mvebu_comphy_cp110_modes[i].fw_mode; return conf->fw_mode;
else else
return mvebu_comphy_cp110_modes[i].mux; return conf->mux;
} }
static inline int mvebu_comphy_get_mux(int lane, int port, static inline int mvebu_comphy_get_mux(int lane, int port,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment