Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: phylink: ensure consistent phy interface mode

Ensure that we supply the same phy interface mode to mac_link_down() as
we did for the corresponding mac_link_up() call. This ensures that MAC
drivers that use the phy interface mode in these methods can depend on
mac_link_down() always corresponding to a mac_link_up() call for the
same interface mode.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Russell King and committed by
David S. Miller
c6787263 315ca92d

+7 -3
+7 -3
drivers/net/phy/phylink.c
··· 51 51 52 52 /* The link configuration settings */ 53 53 struct phylink_link_state link_config; 54 + 55 + /* The current settings */ 56 + phy_interface_t cur_interface; 57 + 54 58 struct gpio_desc *link_gpio; 55 59 struct timer_list link_poll; 56 60 void (*get_fixed_state)(struct net_device *dev, ··· 450 446 if (!link_state.link) { 451 447 netif_carrier_off(ndev); 452 448 pl->ops->mac_link_down(ndev, pl->link_an_mode, 453 - pl->phy_state.interface); 449 + pl->cur_interface); 454 450 netdev_info(ndev, "Link is Down\n"); 455 451 } else { 452 + pl->cur_interface = link_state.interface; 456 453 pl->ops->mac_link_up(ndev, pl->link_an_mode, 457 - pl->phy_state.interface, 458 - pl->phydev); 454 + pl->cur_interface, pl->phydev); 459 455 460 456 netif_carrier_on(ndev); 461 457