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. @@ -1323,7 +1323,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_carrier_on(net_dev);
  23. return 0;
  24. @@ -1335,7 +1335,7 @@ static int bgmac_stop(struct net_device
  25. netif_carrier_off(net_dev);
  26. - phy_stop(bgmac->phy_dev);
  27. + phy_stop(net_dev->phydev);
  28. napi_disable(&bgmac->napi);
  29. bgmac_chip_intrs_off(bgmac);
  30. @@ -1373,12 +1373,10 @@ static int bgmac_set_mac_address(struct
  31. static int bgmac_ioctl(struct net_device *net_dev, struct ifreq *ifr, int cmd)
  32. {
  33. - struct bgmac *bgmac = netdev_priv(net_dev);
  34. -
  35. if (!netif_running(net_dev))
  36. return -EINVAL;
  37. - return phy_mii_ioctl(bgmac->phy_dev, ifr, cmd);
  38. + return phy_mii_ioctl(net_dev->phydev, ifr, cmd);
  39. }
  40. static const struct net_device_ops bgmac_netdev_ops = {
  41. @@ -1521,7 +1519,7 @@ static int bgmac_get_settings(struct net
  42. {
  43. struct bgmac *bgmac = netdev_priv(net_dev);
  44. - return phy_ethtool_gset(bgmac->phy_dev, cmd);
  45. + return phy_ethtool_gset(net_dev->phydev, cmd);
  46. }
  47. static int bgmac_set_settings(struct net_device *net_dev,
  48. @@ -1529,7 +1527,7 @@ static int bgmac_set_settings(struct net
  49. {
  50. struct bgmac *bgmac = netdev_priv(net_dev);
  51. - return phy_ethtool_sset(bgmac->phy_dev, cmd);
  52. + return phy_ethtool_sset(net_dev->phydev, cmd);
  53. }
  54. static void bgmac_get_drvinfo(struct net_device *net_dev,
  55. @@ -1566,7 +1564,7 @@ static int bgmac_mii_write(struct mii_bu
  56. static void bgmac_adjust_link(struct net_device *net_dev)
  57. {
  58. struct bgmac *bgmac = netdev_priv(net_dev);
  59. - struct phy_device *phy_dev = bgmac->phy_dev;
  60. + struct phy_device *phy_dev = net_dev->phydev;
  61. bool update = false;
  62. if (phy_dev->link) {
  63. @@ -1610,8 +1608,6 @@ static int bgmac_fixed_phy_register(stru
  64. return err;
  65. }
  66. - bgmac->phy_dev = phy_dev;
  67. -
  68. return err;
  69. }
  70. @@ -1664,7 +1660,6 @@ static int bgmac_mii_register(struct bgm
  71. err = PTR_ERR(phy_dev);
  72. goto err_unregister_bus;
  73. }
  74. - bgmac->phy_dev = phy_dev;
  75. return err;
  76. --- a/drivers/net/ethernet/broadcom/bgmac.h
  77. +++ b/drivers/net/ethernet/broadcom/bgmac.h
  78. @@ -441,7 +441,6 @@ struct bgmac {
  79. struct net_device *net_dev;
  80. struct napi_struct napi;
  81. struct mii_bus *mii_bus;
  82. - struct phy_device *phy_dev;
  83. /* DMA */
  84. struct bgmac_dma_ring tx_ring[BGMAC_MAX_TX_RINGS];