imx6: fix USB for 4.9 kernel
[oweals/openwrt.git] / target / linux / mvebu / patches-4.4 / 146-sfp-phylink-hook-up-eeprom-functions.patch
1 From a7091ef24223ed39b39c6b73b77c55c8a607f34a Mon Sep 17 00:00:00 2001
2 From: Russell King <rmk+kernel@arm.linux.org.uk>
3 Date: Thu, 8 Oct 2015 23:49:47 +0100
4 Subject: [PATCH 734/744] sfp/phylink: hook up eeprom functions
5
6 Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
7 ---
8  drivers/net/phy/sfp.c | 19 +++++++++++--------
9  1 file changed, 11 insertions(+), 8 deletions(-)
10
11 --- a/drivers/net/phy/sfp.c
12 +++ b/drivers/net/phy/sfp.c
13 @@ -901,11 +901,9 @@ static void sfp_sm_event(struct sfp *sfp
14         mutex_unlock(&sfp->sm_mutex);
15  }
16  
17 -#if 0
18 -static int sfp_phy_module_info(struct phy_device *phy,
19 -                              struct ethtool_modinfo *modinfo)
20 +static int sfp_module_info(void *priv, struct ethtool_modinfo *modinfo)
21  {
22 -       struct sfp *sfp = phy->priv;
23 +       struct sfp *sfp = priv;
24  
25         /* locking... and check module is present */
26  
27 @@ -919,10 +917,9 @@ static int sfp_phy_module_info(struct ph
28         return 0;
29  }
30  
31 -static int sfp_phy_module_eeprom(struct phy_device *phy,
32 -       struct ethtool_eeprom *ee, u8 *data)
33 +static int sfp_module_eeprom(void *priv, struct ethtool_eeprom *ee, u8 *data)
34  {
35 -       struct sfp *sfp = phy->priv;
36 +       struct sfp *sfp = priv;
37         unsigned int first, last, len;
38         int ret;
39  
40 @@ -953,7 +950,11 @@ static int sfp_phy_module_eeprom(struct
41         }
42         return 0;
43  }
44 -#endif
45 +
46 +static const struct phylink_module_ops sfp_module_ops = {
47 +       .get_module_info = sfp_module_info,
48 +       .get_module_eeprom = sfp_module_eeprom,
49 +};
50  
51  static void sfp_timeout(struct work_struct *work)
52  {
53 @@ -1029,6 +1030,7 @@ static int sfp_netdev_notify(struct noti
54         case NETDEV_UNREGISTER:
55                 if (sfp->mod_phy && sfp->phylink)
56                         phylink_disconnect_phy(sfp->phylink);
57 +               phylink_unregister_module(sfp->phylink, sfp);
58                 sfp->phylink = NULL;
59                 dev_put(sfp->ndev);
60                 sfp->ndev = NULL;
61 @@ -1145,6 +1147,7 @@ static int sfp_probe(struct platform_dev
62                 }
63  
64                 phylink_disable(sfp->phylink);
65 +               phylink_register_module(sfp->phylink, sfp, &sfp_module_ops);
66         }
67  
68         sfp->state = sfp_get_state(sfp);