kernel: backport phylink changes from mainline Linux
[openwrt/staging/jow.git] / target / linux / generic / backport-6.1 / 715-13-v6.5-net-phylink-constify-fwnode-arguments.patch
1 From a3555d1f5c208f0a63eafee77381f68d304a0512 Mon Sep 17 00:00:00 2001
2 From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
3 Date: Fri, 12 May 2023 17:58:37 +0100
4 Subject: [PATCH 12/21] net: phylink: constify fwnode arguments
5
6 Both phylink_create() and phylink_fwnode_phy_connect() do not modify
7 the fwnode argument that they are passed, so lets constify these.
8
9 Reviewed-by: Simon Horman <simon.horman@corigine.com>
10 Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
11 Signed-off-by: David S. Miller <davem@davemloft.net>
12 ---
13 drivers/net/phy/phylink.c | 11 ++++++-----
14 include/linux/phylink.h | 9 +++++----
15 2 files changed, 11 insertions(+), 9 deletions(-)
16
17 --- a/drivers/net/phy/phylink.c
18 +++ b/drivers/net/phy/phylink.c
19 @@ -706,7 +706,7 @@ static int phylink_validate(struct phyli
20 }
21
22 static int phylink_parse_fixedlink(struct phylink *pl,
23 - struct fwnode_handle *fwnode)
24 + const struct fwnode_handle *fwnode)
25 {
26 struct fwnode_handle *fixed_node;
27 bool pause, asym_pause, autoneg;
28 @@ -817,7 +817,8 @@ static int phylink_parse_fixedlink(struc
29 return 0;
30 }
31
32 -static int phylink_parse_mode(struct phylink *pl, struct fwnode_handle *fwnode)
33 +static int phylink_parse_mode(struct phylink *pl,
34 + const struct fwnode_handle *fwnode)
35 {
36 struct fwnode_handle *dn;
37 const char *managed;
38 @@ -1440,7 +1441,7 @@ static void phylink_fixed_poll(struct ti
39 static const struct sfp_upstream_ops sfp_phylink_ops;
40
41 static int phylink_register_sfp(struct phylink *pl,
42 - struct fwnode_handle *fwnode)
43 + const struct fwnode_handle *fwnode)
44 {
45 struct sfp_bus *bus;
46 int ret;
47 @@ -1479,7 +1480,7 @@ static int phylink_register_sfp(struct p
48 * must use IS_ERR() to check for errors from this function.
49 */
50 struct phylink *phylink_create(struct phylink_config *config,
51 - struct fwnode_handle *fwnode,
52 + const struct fwnode_handle *fwnode,
53 phy_interface_t iface,
54 const struct phylink_mac_ops *mac_ops)
55 {
56 @@ -1809,7 +1810,7 @@ EXPORT_SYMBOL_GPL(phylink_of_phy_connect
57 * Returns 0 on success or a negative errno.
58 */
59 int phylink_fwnode_phy_connect(struct phylink *pl,
60 - struct fwnode_handle *fwnode,
61 + const struct fwnode_handle *fwnode,
62 u32 flags)
63 {
64 struct fwnode_handle *phy_fwnode;
65 --- a/include/linux/phylink.h
66 +++ b/include/linux/phylink.h
67 @@ -568,16 +568,17 @@ void phylink_generic_validate(struct phy
68 unsigned long *supported,
69 struct phylink_link_state *state);
70
71 -struct phylink *phylink_create(struct phylink_config *, struct fwnode_handle *,
72 - phy_interface_t iface,
73 - const struct phylink_mac_ops *mac_ops);
74 +struct phylink *phylink_create(struct phylink_config *,
75 + const struct fwnode_handle *,
76 + phy_interface_t,
77 + const struct phylink_mac_ops *);
78 void phylink_destroy(struct phylink *);
79 bool phylink_expects_phy(struct phylink *pl);
80
81 int phylink_connect_phy(struct phylink *, struct phy_device *);
82 int phylink_of_phy_connect(struct phylink *, struct device_node *, u32 flags);
83 int phylink_fwnode_phy_connect(struct phylink *pl,
84 - struct fwnode_handle *fwnode,
85 + const struct fwnode_handle *fwnode,
86 u32 flags);
87 void phylink_disconnect_phy(struct phylink *);
88