diff options
author | Miquel Raynal <miquel.raynal@bootlin.com> | 2019-07-31 08:21:17 -0400 |
---|---|---|
committer | Kishon Vijay Abraham I <kishon@ti.com> | 2019-08-27 02:07:09 -0400 |
commit | 1eb9157ab3ef64e845e10fe40d49638fb408119e (patch) | |
tree | 838a3d4682a3470db7cb69e54827956a63af6f78 | |
parent | ef0ac9f24b65bac389a21b2d37ab90200f285062 (diff) |
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: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
-rw-r--r-- | drivers/phy/marvell/phy-mvebu-cp110-comphy.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/phy/marvell/phy-mvebu-cp110-comphy.c b/drivers/phy/marvell/phy-mvebu-cp110-comphy.c index e4c0ec61dd04..98cb7298a9fe 100644 --- a/drivers/phy/marvell/phy-mvebu-cp110-comphy.c +++ b/drivers/phy/marvell/phy-mvebu-cp110-comphy.c | |||
@@ -265,16 +265,18 @@ static int mvebu_comphy_get_mode(bool fw_mode, int lane, int port, | |||
265 | enum phy_mode mode, int submode) | 265 | enum phy_mode mode, int submode) |
266 | { | 266 | { |
267 | int i, n = ARRAY_SIZE(mvebu_comphy_cp110_modes); | 267 | int i, n = ARRAY_SIZE(mvebu_comphy_cp110_modes); |
268 | const struct mvebu_comphy_conf *conf; | ||
268 | 269 | ||
269 | /* Unused PHY mux value is 0x0 */ | 270 | /* Unused PHY mux value is 0x0 */ |
270 | if (mode == PHY_MODE_INVALID) | 271 | if (mode == PHY_MODE_INVALID) |
271 | return 0; | 272 | return 0; |
272 | 273 | ||
273 | for (i = 0; i < n; i++) { | 274 | for (i = 0; i < n; i++) { |
274 | if (mvebu_comphy_cp110_modes[i].lane == lane && | 275 | conf = &mvebu_comphy_cp110_modes[i]; |
275 | mvebu_comphy_cp110_modes[i].port == port && | 276 | if (conf->lane == lane && |
276 | mvebu_comphy_cp110_modes[i].mode == mode && | 277 | conf->port == port && |
277 | mvebu_comphy_cp110_modes[i].submode == submode) | 278 | conf->mode == mode && |
279 | conf->submode == submode) | ||
278 | break; | 280 | break; |
279 | } | 281 | } |
280 | 282 | ||
@@ -282,9 +284,9 @@ static int mvebu_comphy_get_mode(bool fw_mode, int lane, int port, | |||
282 | return -EINVAL; | 284 | return -EINVAL; |
283 | 285 | ||
284 | if (fw_mode) | 286 | if (fw_mode) |
285 | return mvebu_comphy_cp110_modes[i].fw_mode; | 287 | return conf->fw_mode; |
286 | else | 288 | else |
287 | return mvebu_comphy_cp110_modes[i].mux; | 289 | return conf->mux; |
288 | } | 290 | } |
289 | 291 | ||
290 | static inline int mvebu_comphy_get_mux(int lane, int port, | 292 | static inline int mvebu_comphy_get_mux(int lane, int port, |