generic: 6.1: backport qca808x LED support patch
[openwrt/openwrt.git] / target / linux / generic / backport-6.1 / 707-v6.8-03-net-phy-at803x-raname-hw_stats-functions-to-qca83xx-.patch
1 From 07b1ad83b9ed6db1735ba10baf67b7a565ac0cef Mon Sep 17 00:00:00 2001
2 From: Christian Marangi <ansuelsmth@gmail.com>
3 Date: Fri, 8 Dec 2023 15:51:50 +0100
4 Subject: [PATCH 03/13] net: phy: at803x: raname hw_stats functions to qca83xx
5 specific name
6
7 The function and the struct related to hw_stats were specific to qca83xx
8 PHY but were called following the convention in the driver of calling
9 everything with at803x prefix.
10
11 To better organize the code, rename these function a more specific name
12 to better describe that they are specific to 83xx PHY family.
13
14 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
15 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
16 Signed-off-by: David S. Miller <davem@davemloft.net>
17 ---
18 drivers/net/phy/at803x.c | 44 ++++++++++++++++++++--------------------
19 1 file changed, 22 insertions(+), 22 deletions(-)
20
21 --- a/drivers/net/phy/at803x.c
22 +++ b/drivers/net/phy/at803x.c
23 @@ -295,7 +295,7 @@ struct at803x_hw_stat {
24 enum stat_access_type access_type;
25 };
26
27 -static struct at803x_hw_stat at803x_hw_stats[] = {
28 +static struct at803x_hw_stat qca83xx_hw_stats[] = {
29 { "phy_idle_errors", 0xa, GENMASK(7, 0), PHY},
30 { "phy_receive_errors", 0x15, GENMASK(15, 0), PHY},
31 { "eee_wake_errors", 0x16, GENMASK(15, 0), MMD},
32 @@ -311,7 +311,7 @@ struct at803x_priv {
33 bool is_1000basex;
34 struct regulator_dev *vddio_rdev;
35 struct regulator_dev *vddh_rdev;
36 - u64 stats[ARRAY_SIZE(at803x_hw_stats)];
37 + u64 stats[ARRAY_SIZE(qca83xx_hw_stats)];
38 };
39
40 struct at803x_context {
41 @@ -529,24 +529,24 @@ static void at803x_get_wol(struct phy_de
42 wol->wolopts |= WAKE_MAGIC;
43 }
44
45 -static int at803x_get_sset_count(struct phy_device *phydev)
46 +static int qca83xx_get_sset_count(struct phy_device *phydev)
47 {
48 - return ARRAY_SIZE(at803x_hw_stats);
49 + return ARRAY_SIZE(qca83xx_hw_stats);
50 }
51
52 -static void at803x_get_strings(struct phy_device *phydev, u8 *data)
53 +static void qca83xx_get_strings(struct phy_device *phydev, u8 *data)
54 {
55 int i;
56
57 - for (i = 0; i < ARRAY_SIZE(at803x_hw_stats); i++) {
58 + for (i = 0; i < ARRAY_SIZE(qca83xx_hw_stats); i++) {
59 strscpy(data + i * ETH_GSTRING_LEN,
60 - at803x_hw_stats[i].string, ETH_GSTRING_LEN);
61 + qca83xx_hw_stats[i].string, ETH_GSTRING_LEN);
62 }
63 }
64
65 -static u64 at803x_get_stat(struct phy_device *phydev, int i)
66 +static u64 qca83xx_get_stat(struct phy_device *phydev, int i)
67 {
68 - struct at803x_hw_stat stat = at803x_hw_stats[i];
69 + struct at803x_hw_stat stat = qca83xx_hw_stats[i];
70 struct at803x_priv *priv = phydev->priv;
71 int val;
72 u64 ret;
73 @@ -567,13 +567,13 @@ static u64 at803x_get_stat(struct phy_de
74 return ret;
75 }
76
77 -static void at803x_get_stats(struct phy_device *phydev,
78 - struct ethtool_stats *stats, u64 *data)
79 +static void qca83xx_get_stats(struct phy_device *phydev,
80 + struct ethtool_stats *stats, u64 *data)
81 {
82 int i;
83
84 - for (i = 0; i < ARRAY_SIZE(at803x_hw_stats); i++)
85 - data[i] = at803x_get_stat(phydev, i);
86 + for (i = 0; i < ARRAY_SIZE(qca83xx_hw_stats); i++)
87 + data[i] = qca83xx_get_stat(phydev, i);
88 }
89
90 static int at803x_suspend(struct phy_device *phydev)
91 @@ -2175,9 +2175,9 @@ static struct phy_driver at803x_driver[]
92 .flags = PHY_IS_INTERNAL,
93 .config_init = qca83xx_config_init,
94 .soft_reset = genphy_soft_reset,
95 - .get_sset_count = at803x_get_sset_count,
96 - .get_strings = at803x_get_strings,
97 - .get_stats = at803x_get_stats,
98 + .get_sset_count = qca83xx_get_sset_count,
99 + .get_strings = qca83xx_get_strings,
100 + .get_stats = qca83xx_get_stats,
101 .suspend = qca83xx_suspend,
102 .resume = qca83xx_resume,
103 }, {
104 @@ -2191,9 +2191,9 @@ static struct phy_driver at803x_driver[]
105 .flags = PHY_IS_INTERNAL,
106 .config_init = qca83xx_config_init,
107 .soft_reset = genphy_soft_reset,
108 - .get_sset_count = at803x_get_sset_count,
109 - .get_strings = at803x_get_strings,
110 - .get_stats = at803x_get_stats,
111 + .get_sset_count = qca83xx_get_sset_count,
112 + .get_strings = qca83xx_get_strings,
113 + .get_stats = qca83xx_get_stats,
114 .suspend = qca83xx_suspend,
115 .resume = qca83xx_resume,
116 }, {
117 @@ -2207,9 +2207,9 @@ static struct phy_driver at803x_driver[]
118 .flags = PHY_IS_INTERNAL,
119 .config_init = qca83xx_config_init,
120 .soft_reset = genphy_soft_reset,
121 - .get_sset_count = at803x_get_sset_count,
122 - .get_strings = at803x_get_strings,
123 - .get_stats = at803x_get_stats,
124 + .get_sset_count = qca83xx_get_sset_count,
125 + .get_strings = qca83xx_get_strings,
126 + .get_stats = qca83xx_get_stats,
127 .suspend = qca83xx_suspend,
128 .resume = qca83xx_resume,
129 }, {