Skip to content

Commit 3e8b4d6

Browse files
Ansueldavem330
authored andcommitted
net: dsa: qca8k: move qca8k_port_to_phy() to header
Move qca8k_port_to_phy() to qca8k header as it's useful for future reference in Switch LEDs module since the same logic is applied to get the right index of the switch port. Make it inline as it's simple function that just decrease the port. Signed-off-by: Christian Marangi <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Reviewed-by: Michal Kubiak <[email protected]> Reviewed-by: Florian Fainelli <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1584418 commit 3e8b4d6

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

drivers/net/dsa/qca/qca8k-8xxx.c

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -772,21 +772,6 @@ qca8k_phy_eth_command(struct qca8k_priv *priv, bool read, int phy,
772772
return ret;
773773
}
774774

775-
static u32
776-
qca8k_port_to_phy(int port)
777-
{
778-
/* From Andrew Lunn:
779-
* Port 0 has no internal phy.
780-
* Port 1 has an internal PHY at MDIO address 0.
781-
* Port 2 has an internal PHY at MDIO address 1.
782-
* ...
783-
* Port 5 has an internal PHY at MDIO address 4.
784-
* Port 6 has no internal PHY.
785-
*/
786-
787-
return port - 1;
788-
}
789-
790775
static int
791776
qca8k_mdio_busy_wait(struct mii_bus *bus, u32 reg, u32 mask)
792777
{

drivers/net/dsa/qca/qca8k.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,20 @@ struct qca8k_fdb {
421421
u8 mac[6];
422422
};
423423

424+
static inline u32 qca8k_port_to_phy(int port)
425+
{
426+
/* From Andrew Lunn:
427+
* Port 0 has no internal phy.
428+
* Port 1 has an internal PHY at MDIO address 0.
429+
* Port 2 has an internal PHY at MDIO address 1.
430+
* ...
431+
* Port 5 has an internal PHY at MDIO address 4.
432+
* Port 6 has no internal PHY.
433+
*/
434+
435+
return port - 1;
436+
}
437+
424438
/* Common setup function */
425439
extern const struct qca8k_mib_desc ar8327_mib[];
426440
extern const struct regmap_access_table qca8k_readable_table;

0 commit comments

Comments
 (0)