[PATCH net-next] net: use pdev instead of OF funcs
kernel test robot
lkp at intel.com
Sun Nov 10 21:53:27 AEDT 2024
Hi Rosen,
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/Rosen-Penev/net-use-pdev-instead-of-OF-funcs/20241110-073939
base: net-next/main
patch link: https://lore.kernel.org/r/20241109233821.8619-1-rosenp%40gmail.com
patch subject: [PATCH net-next] net: use pdev instead of OF funcs
config: powerpc-ge_imp3a_defconfig (https://download.01.org/0day-ci/archive/20241110/202411101834.A8QNRx3c-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 13.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241110/202411101834.A8QNRx3c-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 at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411101834.A8QNRx3c-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/net/ethernet/freescale/ucc_geth.c: In function 'ucc_geth_free_rx':
drivers/net/ethernet/freescale/ucc_geth.c:1810:31: warning: variable 'uf_info' set but not used [-Wunused-but-set-variable]
1810 | struct ucc_fast_info *uf_info;
| ^~~~~~~
drivers/net/ethernet/freescale/ucc_geth.c: In function 'ucc_geth_free_tx':
drivers/net/ethernet/freescale/ucc_geth.c:1849:31: warning: variable 'uf_info' set but not used [-Wunused-but-set-variable]
1849 | struct ucc_fast_info *uf_info;
| ^~~~~~~
drivers/net/ethernet/freescale/ucc_geth.c: In function 'ucc_geth_alloc_tx':
drivers/net/ethernet/freescale/ucc_geth.c:2142:31: warning: variable 'uf_info' set but not used [-Wunused-but-set-variable]
2142 | struct ucc_fast_info *uf_info;
| ^~~~~~~
drivers/net/ethernet/freescale/ucc_geth.c: In function 'ucc_geth_alloc_rx':
drivers/net/ethernet/freescale/ucc_geth.c:2204:31: warning: variable 'uf_info' set but not used [-Wunused-but-set-variable]
2204 | struct ucc_fast_info *uf_info;
| ^~~~~~~
drivers/net/ethernet/freescale/ucc_geth.c: In function 'ucc_geth_startup':
drivers/net/ethernet/freescale/ucc_geth.c:2271:13: warning: variable 'ifstat' set but not used [-Wunused-but-set-variable]
2271 | u32 ifstat, i, j, size, l2qt, l3qt;
| ^~~~~~
drivers/net/ethernet/freescale/ucc_geth.c:2261:62: warning: variable 'p_82xx_addr_filt' set but not used [-Wunused-but-set-variable]
2261 | struct ucc_geth_82xx_address_filtering_pram __iomem *p_82xx_addr_filt;
| ^~~~~~~~~~~~~~~~
drivers/net/ethernet/freescale/ucc_geth.c: In function 'ucc_geth_rx':
drivers/net/ethernet/freescale/ucc_geth.c:2996:13: warning: variable 'bdBuffer' set but not used [-Wunused-but-set-variable]
2996 | u8 *bdBuffer;
| ^~~~~~~~
drivers/net/ethernet/freescale/ucc_geth.c: In function 'ucc_geth_irq_handler':
drivers/net/ethernet/freescale/ucc_geth.c:3149:31: warning: variable 'ug_info' set but not used [-Wunused-but-set-variable]
3149 | struct ucc_geth_info *ug_info;
| ^~~~~~~
drivers/net/ethernet/freescale/ucc_geth.c: In function 'ucc_geth_probe':
>> drivers/net/ethernet/freescale/ucc_geth.c:3608:42: error: expected ')' before numeric constant
3608 | res = platform_get_resource(ofdev 0, IORESOURCE_MEM);
| ~ ^~
| )
>> drivers/net/ethernet/freescale/ucc_geth.c:3608:15: error: too few arguments to function 'platform_get_resource'
3608 | res = platform_get_resource(ofdev 0, IORESOURCE_MEM);
| ^~~~~~~~~~~~~~~~~~~~~
In file included from drivers/net/ethernet/freescale/ucc_geth.c:36:
include/linux/platform_device.h:58:25: note: declared here
58 | extern struct resource *platform_get_resource(struct platform_device *,
| ^~~~~~~~~~~~~~~~~~~~~
vim +3608 drivers/net/ethernet/freescale/ucc_geth.c
3555
3556 static int ucc_geth_probe(struct platform_device* ofdev)
3557 {
3558 struct device *device = &ofdev->dev;
3559 struct device_node *np = ofdev->dev.of_node;
3560 struct net_device *dev = NULL;
3561 struct ucc_geth_private *ugeth = NULL;
3562 struct ucc_geth_info *ug_info;
3563 struct resource *res;
3564 int err, ucc_num, max_speed = 0;
3565 const unsigned int *prop;
3566 phy_interface_t phy_interface;
3567 static const int enet_to_speed[] = {
3568 SPEED_10, SPEED_10, SPEED_10,
3569 SPEED_100, SPEED_100, SPEED_100,
3570 SPEED_1000, SPEED_1000, SPEED_1000, SPEED_1000,
3571 };
3572 static const phy_interface_t enet_to_phy_interface[] = {
3573 PHY_INTERFACE_MODE_MII, PHY_INTERFACE_MODE_RMII,
3574 PHY_INTERFACE_MODE_RGMII, PHY_INTERFACE_MODE_MII,
3575 PHY_INTERFACE_MODE_RMII, PHY_INTERFACE_MODE_RGMII,
3576 PHY_INTERFACE_MODE_GMII, PHY_INTERFACE_MODE_RGMII,
3577 PHY_INTERFACE_MODE_TBI, PHY_INTERFACE_MODE_RTBI,
3578 PHY_INTERFACE_MODE_SGMII,
3579 };
3580
3581 ugeth_vdbg("%s: IN", __func__);
3582
3583 prop = of_get_property(np, "cell-index", NULL);
3584 if (!prop) {
3585 prop = of_get_property(np, "device-id", NULL);
3586 if (!prop)
3587 return -ENODEV;
3588 }
3589
3590 ucc_num = *prop - 1;
3591 if ((ucc_num < 0) || (ucc_num > 7))
3592 return -ENODEV;
3593
3594 ug_info = devm_kmemdup(&ofdev->dev, &ugeth_primary_info,
3595 sizeof(*ug_info), GFP_KERNEL);
3596 if (!ug_info)
3597 return -ENOMEM;
3598
3599 ug_info->uf_info.ucc_num = ucc_num;
3600
3601 err = ucc_geth_parse_clock(np, "rx", &ug_info->uf_info.rx_clock);
3602 if (err)
3603 return err;
3604 err = ucc_geth_parse_clock(np, "tx", &ug_info->uf_info.tx_clock);
3605 if (err)
3606 return err;
3607
> 3608 res = platform_get_resource(ofdev 0, IORESOURCE_MEM);
3609 if (!res)
3610 return -ENODEV;
3611
3612 ug_info->uf_info.regs = res->start;
3613 ug_info->uf_info.irq = platform_get_irq(ofdev, 0);
3614
3615 ug_info->phy_node = of_parse_phandle(np, "phy-handle", 0);
3616 if (!ug_info->phy_node && of_phy_is_fixed_link(np)) {
3617 /*
3618 * In the case of a fixed PHY, the DT node associated
3619 * to the PHY is the Ethernet MAC DT node.
3620 */
3621 err = of_phy_register_fixed_link(np);
3622 if (err)
3623 return err;
3624 ug_info->phy_node = of_node_get(np);
3625 }
3626
3627 /* Find the TBI PHY node. If it's not there, we don't support SGMII */
3628 ug_info->tbi_node = of_parse_phandle(np, "tbi-handle", 0);
3629
3630 /* get the phy interface type, or default to MII */
3631 prop = of_get_property(np, "phy-connection-type", NULL);
3632 if (!prop) {
3633 /* handle interface property present in old trees */
3634 prop = of_get_property(ug_info->phy_node, "interface", NULL);
3635 if (prop != NULL) {
3636 phy_interface = enet_to_phy_interface[*prop];
3637 max_speed = enet_to_speed[*prop];
3638 } else
3639 phy_interface = PHY_INTERFACE_MODE_MII;
3640 } else {
3641 phy_interface = to_phy_interface((const char *)prop);
3642 }
3643
3644 /* get speed, or derive from PHY interface */
3645 if (max_speed == 0)
3646 switch (phy_interface) {
3647 case PHY_INTERFACE_MODE_GMII:
3648 case PHY_INTERFACE_MODE_RGMII:
3649 case PHY_INTERFACE_MODE_RGMII_ID:
3650 case PHY_INTERFACE_MODE_RGMII_RXID:
3651 case PHY_INTERFACE_MODE_RGMII_TXID:
3652 case PHY_INTERFACE_MODE_TBI:
3653 case PHY_INTERFACE_MODE_RTBI:
3654 case PHY_INTERFACE_MODE_SGMII:
3655 max_speed = SPEED_1000;
3656 break;
3657 default:
3658 max_speed = SPEED_100;
3659 break;
3660 }
3661
3662 if (max_speed == SPEED_1000) {
3663 unsigned int snums = qe_get_num_of_snums();
3664
3665 /* configure muram FIFOs for gigabit operation */
3666 ug_info->uf_info.urfs = UCC_GETH_URFS_GIGA_INIT;
3667 ug_info->uf_info.urfet = UCC_GETH_URFET_GIGA_INIT;
3668 ug_info->uf_info.urfset = UCC_GETH_URFSET_GIGA_INIT;
3669 ug_info->uf_info.utfs = UCC_GETH_UTFS_GIGA_INIT;
3670 ug_info->uf_info.utfet = UCC_GETH_UTFET_GIGA_INIT;
3671 ug_info->uf_info.utftt = UCC_GETH_UTFTT_GIGA_INIT;
3672 ug_info->numThreadsTx = UCC_GETH_NUM_OF_THREADS_4;
3673
3674 /* If QE's snum number is 46/76 which means we need to support
3675 * 4 UECs at 1000Base-T simultaneously, we need to allocate
3676 * more Threads to Rx.
3677 */
3678 if ((snums == 76) || (snums == 46))
3679 ug_info->numThreadsRx = UCC_GETH_NUM_OF_THREADS_6;
3680 else
3681 ug_info->numThreadsRx = UCC_GETH_NUM_OF_THREADS_4;
3682 }
3683
3684 if (netif_msg_probe(&debug))
3685 pr_info("UCC%1d at 0x%8llx (irq = %d)\n",
3686 ug_info->uf_info.ucc_num + 1,
3687 (u64)ug_info->uf_info.regs,
3688 ug_info->uf_info.irq);
3689
3690 /* Create an ethernet device instance */
3691 dev = devm_alloc_etherdev(&ofdev->dev, sizeof(*ugeth));
3692 if (!dev) {
3693 err = -ENOMEM;
3694 goto err_deregister_fixed_link;
3695 }
3696
3697 ugeth = netdev_priv(dev);
3698 spin_lock_init(&ugeth->lock);
3699
3700 /* Create CQs for hash tables */
3701 INIT_LIST_HEAD(&ugeth->group_hash_q);
3702 INIT_LIST_HEAD(&ugeth->ind_hash_q);
3703
3704 dev_set_drvdata(device, dev);
3705
3706 /* Set the dev->base_addr to the gfar reg region */
3707 dev->base_addr = (unsigned long)(ug_info->uf_info.regs);
3708
3709 SET_NETDEV_DEV(dev, device);
3710
3711 /* Fill in the dev structure */
3712 uec_set_ethtool_ops(dev);
3713 dev->netdev_ops = &ucc_geth_netdev_ops;
3714 dev->watchdog_timeo = TX_TIMEOUT;
3715 INIT_WORK(&ugeth->timeout_work, ucc_geth_timeout_work);
3716 netif_napi_add(dev, &ugeth->napi, ucc_geth_poll);
3717 dev->mtu = 1500;
3718 dev->max_mtu = 1518;
3719
3720 ugeth->msg_enable = netif_msg_init(debug.msg_enable, UGETH_MSG_DEFAULT);
3721 ugeth->phy_interface = phy_interface;
3722 ugeth->max_speed = max_speed;
3723
3724 /* Carrier starts down, phylib will bring it up */
3725 netif_carrier_off(dev);
3726
3727 err = devm_register_netdev(&ofdev->dev, dev);
3728 if (err) {
3729 if (netif_msg_probe(ugeth))
3730 pr_err("%s: Cannot register net device, aborting\n",
3731 dev->name);
3732 goto err_deregister_fixed_link;
3733 }
3734
3735 err = of_get_ethdev_address(np, dev);
3736 if (err == -EPROBE_DEFER)
3737 goto err_deregister_fixed_link;
3738
3739 ugeth->ug_info = ug_info;
3740 ugeth->dev = device;
3741 ugeth->ndev = dev;
3742 ugeth->node = np;
3743
3744 return 0;
3745
3746 err_deregister_fixed_link:
3747 if (of_phy_is_fixed_link(np))
3748 of_phy_deregister_fixed_link(np);
3749 of_node_put(ug_info->tbi_node);
3750 of_node_put(ug_info->phy_node);
3751 return err;
3752 }
3753
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
More information about the Linuxppc-dev
mailing list