070-v4.8-0004-net-ethernet-bgmac-use-phydev-from-struct-net_device.patch 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. From b21fcb259313bcf7d4f73ecd5e44948995c8957c Mon Sep 17 00:00:00 2001
  2. From: Philippe Reynes <tremyfr@gmail.com>
  3. Date: Sun, 19 Jun 2016 22:37:05 +0200
  4. Subject: [PATCH 1/2] net: ethernet: bgmac: use phydev from struct net_device
  5. The private structure contain a pointer to phydev, but the structure
  6. net_device already contain such pointer. So we can remove the pointer
  7. phydev in the private structure, and update the driver to use the
  8. one contained in struct net_device.
  9. Signed-off-by: Philippe Reynes <tremyfr@gmail.com>
  10. Signed-off-by: David S. Miller <davem@davemloft.net>
  11. ---
  12. drivers/net/ethernet/broadcom/bgmac.c | 17 ++++++-----------
  13. drivers/net/ethernet/broadcom/bgmac.h | 1 -
  14. 2 files changed, 6 insertions(+), 12 deletions(-)
  15. --- a/drivers/net/ethernet/broadcom/bgmac.c
  16. +++ b/drivers/net/ethernet/broadcom/bgmac.c
  17. @@ -1324,7 +1324,7 @@ static int bgmac_open(struct net_device
  18. }
  19. napi_enable(&bgmac->napi);
  20. - phy_start(bgmac->phy_dev);
  21. + phy_start(net_dev->phydev);
  22. netif_start_queue(net_dev);
  23. @@ -1337,7 +1337,7 @@ static int bgmac_stop(struct net_device
  24. netif_carrier_off(net_dev);
  25. - phy_stop(bgmac->phy_dev);
  26. + phy_stop(net_dev->phydev);
  27. napi_disable(&bgmac->napi);
  28. bgmac_chip_intrs_off(bgmac);
  29. @@ -1375,12 +1375,10 @@ static int bgmac_set_mac_address(struct
  30. static int bgmac_ioctl(struct net_device *net_dev, struct ifreq *ifr, int cmd)
  31. {
  32. - struct bgmac *bgmac = netdev_priv(net_dev);
  33. -
  34. if (!netif_running(net_dev))
  35. return -EINVAL;
  36. - return phy_mii_ioctl(bgmac->phy_dev, ifr, cmd);
  37. + return phy_mii_ioctl(net_dev->phydev, ifr, cmd);
  38. }
  39. static const struct net_device_ops bgmac_netdev_ops = {
  40. @@ -1523,7 +1521,7 @@ static int bgmac_get_settings(struct net
  41. {
  42. struct bgmac *bgmac = netdev_priv(net_dev);
  43. - return phy_ethtool_gset(bgmac->phy_dev, cmd);
  44. + return phy_ethtool_gset(net_dev->phydev, cmd);
  45. }
  46. static int bgmac_set_settings(struct net_device *net_dev,
  47. @@ -1531,7 +1529,7 @@ static int bgmac_set_settings(struct net
  48. {
  49. struct bgmac *bgmac = netdev_priv(net_dev);
  50. - return phy_ethtool_sset(bgmac->phy_dev, cmd);
  51. + return phy_ethtool_sset(net_dev->phydev, cmd);
  52. }
  53. static void bgmac_get_drvinfo(struct net_device *net_dev,
  54. @@ -1568,7 +1566,7 @@ static int bgmac_mii_write(struct mii_bu
  55. static void bgmac_adjust_link(struct net_device *net_dev)
  56. {
  57. struct bgmac *bgmac = netdev_priv(net_dev);
  58. - struct phy_device *phy_dev = bgmac->phy_dev;
  59. + struct phy_device *phy_dev = net_dev->phydev;
  60. bool update = false;
  61. if (phy_dev->link) {
  62. @@ -1612,8 +1610,6 @@ static int bgmac_fixed_phy_register(stru
  63. return err;
  64. }
  65. - bgmac->phy_dev = phy_dev;
  66. -
  67. return err;
  68. }
  69. @@ -1666,7 +1662,6 @@ static int bgmac_mii_register(struct bgm
  70. err = PTR_ERR(phy_dev);
  71. goto err_unregister_bus;
  72. }
  73. - bgmac->phy_dev = phy_dev;
  74. return err;
  75. --- a/drivers/net/ethernet/broadcom/bgmac.h
  76. +++ b/drivers/net/ethernet/broadcom/bgmac.h
  77. @@ -441,7 +441,6 @@ struct bgmac {
  78. struct net_device *net_dev;
  79. struct napi_struct napi;
  80. struct mii_bus *mii_bus;
  81. - struct phy_device *phy_dev;
  82. /* DMA */
  83. struct bgmac_dma_ring tx_ring[BGMAC_MAX_TX_RINGS];