hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/drivers/net/ethernet/freescale/fec_mpc52xx.c
....@@ -74,7 +74,7 @@
7474 static irqreturn_t mpc52xx_fec_interrupt(int, void *);
7575 static irqreturn_t mpc52xx_fec_rx_interrupt(int, void *);
7676 static irqreturn_t mpc52xx_fec_tx_interrupt(int, void *);
77
-static void mpc52xx_fec_stop(struct net_device *dev);
77
+static void mpc52xx_fec_stop(struct net_device *dev, bool may_sleep);
7878 static void mpc52xx_fec_start(struct net_device *dev);
7979 static void mpc52xx_fec_reset(struct net_device *dev);
8080
....@@ -84,7 +84,7 @@
8484 module_param(debug, int, 0);
8585 MODULE_PARM_DESC(debug, "debugging messages level");
8686
87
-static void mpc52xx_fec_tx_timeout(struct net_device *dev)
87
+static void mpc52xx_fec_tx_timeout(struct net_device *dev, unsigned int txqueue)
8888 {
8989 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
9090 unsigned long flags;
....@@ -283,7 +283,7 @@
283283
284284 netif_stop_queue(dev);
285285
286
- mpc52xx_fec_stop(dev);
286
+ mpc52xx_fec_stop(dev, true);
287287
288288 mpc52xx_fec_free_rx_buffers(dev, priv->rx_dmatsk);
289289
....@@ -369,7 +369,7 @@
369369 dma_unmap_single(dev->dev.parent, bd->skb_pa, skb->len,
370370 DMA_TO_DEVICE);
371371
372
- dev_kfree_skb_irq(skb);
372
+ dev_consume_skb_irq(skb);
373373 }
374374 spin_unlock(&priv->lock);
375375
....@@ -693,7 +693,7 @@
693693 *
694694 * stop all activity on fec and empty dma buffers
695695 */
696
-static void mpc52xx_fec_stop(struct net_device *dev)
696
+static void mpc52xx_fec_stop(struct net_device *dev, bool may_sleep)
697697 {
698698 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
699699 struct mpc52xx_fec __iomem *fec = priv->fec;
....@@ -706,7 +706,7 @@
706706 bcom_disable(priv->rx_dmatsk);
707707
708708 /* Wait for tx queue to drain, but only if we're in process context */
709
- if (!in_interrupt()) {
709
+ if (may_sleep) {
710710 timeout = jiffies + msecs_to_jiffies(2000);
711711 while (time_before(jiffies, timeout) &&
712712 !bcom_queue_empty(priv->tx_dmatsk))
....@@ -738,7 +738,7 @@
738738 struct mpc52xx_fec_priv *priv = netdev_priv(dev);
739739 struct mpc52xx_fec __iomem *fec = priv->fec;
740740
741
- mpc52xx_fec_stop(dev);
741
+ mpc52xx_fec_stop(dev, false);
742742
743743 out_be32(&fec->rfifo_status, in_be32(&fec->rfifo_status));
744744 out_be32(&fec->reset_cntrl, FEC_RESET_CNTRL_RESET_FIFO);
....@@ -785,16 +785,6 @@
785785 };
786786
787787
788
-static int mpc52xx_fec_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
789
-{
790
- struct phy_device *phydev = dev->phydev;
791
-
792
- if (!phydev)
793
- return -ENOTSUPP;
794
-
795
- return phy_mii_ioctl(phydev, rq, cmd);
796
-}
797
-
798788 static const struct net_device_ops mpc52xx_fec_netdev_ops = {
799789 .ndo_open = mpc52xx_fec_open,
800790 .ndo_stop = mpc52xx_fec_close,
....@@ -802,7 +792,7 @@
802792 .ndo_set_rx_mode = mpc52xx_fec_set_multicast_list,
803793 .ndo_set_mac_address = mpc52xx_fec_set_mac_address,
804794 .ndo_validate_addr = eth_validate_addr,
805
- .ndo_do_ioctl = mpc52xx_fec_ioctl,
795
+ .ndo_do_ioctl = phy_do_ioctl,
806796 .ndo_tx_timeout = mpc52xx_fec_tx_timeout,
807797 .ndo_get_stats = mpc52xx_fec_get_stats,
808798 #ifdef CONFIG_NET_POLL_CONTROLLER
....@@ -902,8 +892,8 @@
902892 * First try to read MAC address from DT
903893 */
904894 mac_addr = of_get_mac_address(np);
905
- if (mac_addr) {
906
- memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
895
+ if (!IS_ERR(mac_addr)) {
896
+ ether_addr_copy(ndev->dev_addr, mac_addr);
907897 } else {
908898 struct mpc52xx_fec __iomem *fec = priv->fec;
909899