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