Re: [PATCH net-next v3 1/7] net: usb: lan78xx: Convert to PHYlink for improved PHY and MAC management

kernel test robot
2025-03-15T03:49:05Z

Hi Oleksij,

kernel test robot noticed the following build errors:

[auto build test ERROR on net-next/main]

url: https://github.com/intel-lab-lkp/linux/commits/Oleksij-Rempel/net-usb-lan78xx-Convert-to-PHYlink-for-improved-PHY-and-MAC-management/20250310-200116
base: net-next/main
patch link: https://lore.kernel.org/r/20250310115737.784047-2-o.rempel%40pengutronix.de
patch subject: [PATCH net-next v3 1/7] net: usb: lan78xx: Convert to PHYlink for improved PHY and MAC management
config: i386-randconfig-006-20250315 (https://download.01.org/0day-ci/archive/20250315/202503151113.AFty2HdH-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250315/202503151113.AFty2HdH-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202503151113.AFty2HdH-lkp@intel.com/

All errors (new ones prefixed by >>):

ld: drivers/net/usb/lan78xx.o: in function `lan78xx_phy_init':
>> drivers/net/usb/lan78xx.c:2683: undefined reference to `phylink_connect_phy'
>> ld: drivers/net/usb/lan78xx.c:2651: undefined reference to `phylink_set_fixed_link'
ld: drivers/net/usb/lan78xx.o: in function `lan78xx_open':
>> drivers/net/usb/lan78xx.c:3280: undefined reference to `phylink_start'
ld: drivers/net/usb/lan78xx.o: in function `lan78xx_stop':
>> drivers/net/usb/lan78xx.c:3350: undefined reference to `phylink_stop'
ld: drivers/net/usb/lan78xx.o: in function `lan78xx_disconnect':
drivers/net/usb/lan78xx.c:4375: undefined reference to `phylink_stop'
>> ld: drivers/net/usb/lan78xx.c:4376: undefined reference to `phylink_disconnect_phy'
>> ld: drivers/net/usb/lan78xx.c:4387: undefined reference to `phylink_destroy'
ld: drivers/net/usb/lan78xx.o: in function `lan78xx_phylink_setup':
>> drivers/net/usb/lan78xx.c:2621: undefined reference to `phylink_create'
ld: drivers/net/usb/lan78xx.o: in function `lan78xx_probe':
>> drivers/net/usb/lan78xx.c:4609: undefined reference to `phylink_disconnect_phy'
ld: drivers/net/usb/lan78xx.c:4611: undefined reference to `phylink_destroy'
ld: drivers/net/usb/lan78xx.o: in function `lan78xx_reset_resume':
drivers/net/usb/lan78xx.c:5173: undefined reference to `phylink_start'

vim +2683 drivers/net/usb/lan78xx.c

2599
2600 static int lan78xx_phylink_setup(struct lan78xx_net *dev)
2601 {
2602 struct phylink_config *pc = &dev->phylink_config;
2603 phy_interface_t link_interface;
2604 struct phylink *phylink;
2605
2606 pc->dev = &dev->net->dev;
2607 pc->type = PHYLINK_NETDEV;
2608 pc->mac_capabilities = MAC_SYM_PAUSE | MAC_ASYM_PAUSE | MAC_10 |
2609 MAC_100 | MAC_1000FD;
2610 pc->mac_managed_pm = true;
2611
2612 if (dev->chipid == ID_REV_CHIP_ID_7801_) {
2613 phy_interface_set_rgmii(pc->supported_interfaces);
2614 link_interface = PHY_INTERFACE_MODE_RGMII_ID;
2615 } else {
2616 __set_bit(PHY_INTERFACE_MODE_INTERNAL,
2617 pc->supported_interfaces);
2618 link_interface = PHY_INTERFACE_MODE_INTERNAL;
2619 }
2620
> 2621 phylink = phylink_create(pc, dev->net->dev.fwnode,
2622 link_interface, &lan78xx_phylink_mac_ops);
2623 if (IS_ERR(phylink))
2624 return PTR_ERR(phylink);
2625
2626 dev->phylink = phylink;
2627
2628 return 0;
2629 }
2630
2631 static int lan78xx_phy_init(struct lan78xx_net *dev)
2632 {
2633 struct phy_device *phydev;
2634 int ret;
2635
2636 switch (dev->chipid) {
2637 case ID_REV_CHIP_ID_7801_:
2638 phydev = lan7801_phy_init(dev);
2639 /* If no PHY found, set fixed link, probably there is no
2640 * device or some kind of different device like switch.
2641 * For example: EVB-KSZ9897-1 (KSZ9897 switch evaluation board
2642 * with LAN7801 & KSZ9031)
2643 */
2644 if (!phydev) {
2645 struct phylink_link_state state = {
2646 .speed = SPEED_1000,
2647 .duplex = DUPLEX_FULL,
2648 .interface = PHY_INTERFACE_MODE_RGMII,
2649 };
2650
> 2651 ret = phylink_set_fixed_link(dev->phylink, &state);
2652 if (ret)
2653 netdev_err(dev->net, "Could not set fixed link\n");
2654
2655 return ret;
2656 }
2657
2658 break;
2659
2660 case ID_REV_CHIP_ID_7800_:
2661 case ID_REV_CHIP_ID_7850_:
2662 phydev = phy_find_first(dev->mdiobus);
2663 if (!phydev) {
2664 netdev_err(dev->net, "no PHY found\n");
2665 return -EIO;
2666 }
2667 phydev->is_internal = true;
2668 phydev->interface = PHY_INTERFACE_MODE_GMII;
2669 break;
2670
2671 default:
2672 netdev_err(dev->net, "Unknown CHIP ID found\n");
2673 return -EIO;
2674 }
2675
2676 /* if phyirq is not set, use polling mode in phylib */
2677 if (dev->domain_data.phyirq > 0)
2678 phydev->irq = dev->domain_data.phyirq;
2679 else
2680 phydev->irq = PHY_POLL;
2681 netdev_dbg(dev->net, "phydev->irq = %d\n", phydev->irq);
2682
> 2683 ret = phylink_connect_phy(dev->phylink, phydev);
2684 if (ret) {
2685 netdev_err(dev->net, "can't attach PHY to %s\n",
2686 dev->mdiobus->id);
2687 return -EIO;
2688 }
2689
2690 phy_support_eee(phydev);
2691
2692 if (phydev->mdio.dev.of_node) {
2693 u32 reg;
2694 int len;
2695
2696 len = of_property_count_elems_of_size(phydev->mdio.dev.of_node,
2697 "microchip,led-modes",
2698 sizeof(u32));
2699 if (len >= 0) {
2700 /* Ensure the appropriate LEDs are enabled */
2701 lan78xx_read_reg(dev, HW_CFG, &reg);
2702 reg &= ~(HW_CFG_LED0_EN_ |
2703 HW_CFG_LED1_EN_ |
2704 HW_CFG_LED2_EN_ |
2705 HW_CFG_LED3_EN_);
2706 reg |= (len > 0) * HW_CFG_LED0_EN_ |
2707 (len > 1) * HW_CFG_LED1_EN_ |
2708 (len > 2) * HW_CFG_LED2_EN_ |
2709 (len > 3) * HW_CFG_LED3_EN_;
2710 lan78xx_write_reg(dev, HW_CFG, reg);
2711 }
2712 }
2713
2714 return 0;
2715 }
2716

--
0-DAY CI Kernel Test Service