[arm-platforms:irq/domain_cleanup 5/25] drivers/staging/octeon-usb/octeon-hcd.c:3548:26: error: dereferencing pointer to incomplete type 'struct device_node'

kernel test robot lkp at intel.com
Sat May 15 11:27:08 PDT 2021


tree:   https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git irq/domain_cleanup
head:   dee94333f76d0bd7b6c8302e377654b6e103b71b
commit: 59463db82808e6588f589b75f7fef5f0c0c2012d [5/25] MIPS: Do not include linux/irqdomain.h from asm/irq.h
config: mips-cavium_octeon_defconfig (attached as .config)
compiler: mips64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git/commit/?id=59463db82808e6588f589b75f7fef5f0c0c2012d
        git remote add arm-platforms https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms.git
        git fetch --no-tags arm-platforms irq/domain_cleanup
        git checkout 59463db82808e6588f589b75f7fef5f0c0c2012d
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross W=1 ARCH=mips 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

All errors (new ones prefixed by >>):

   drivers/staging/octeon-usb/octeon-hcd.c: In function 'octeon_usb_probe':
>> drivers/staging/octeon-usb/octeon-hcd.c:3548:26: error: dereferencing pointer to incomplete type 'struct device_node'
    3548 |  usbn_node = dev->of_node->parent;
         |                          ^~
>> drivers/staging/octeon-usb/octeon-hcd.c:3550:6: error: implicit declaration of function 'of_property_read_u32' [-Werror=implicit-function-declaration]
    3550 |  i = of_property_read_u32(usbn_node,
         |      ^~~~~~~~~~~~~~~~~~~~
>> drivers/staging/octeon-usb/octeon-hcd.c:3575:6: error: implicit declaration of function 'of_property_read_string' [-Werror=implicit-function-declaration]
    3575 |  i = of_property_read_string(usbn_node,
         |      ^~~~~~~~~~~~~~~~~~~~~~~
>> drivers/staging/octeon-usb/octeon-hcd.c:3600:9: error: implicit declaration of function 'irq_create_mapping' [-Werror=implicit-function-declaration]
    3600 |   irq = irq_create_mapping(NULL, hwirq);
         |         ^~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +3548 drivers/staging/octeon-usb/octeon-hcd.c

96b06c0a16f737 Chris Packham 2020-02-05  3527  
96b06c0a16f737 Chris Packham 2020-02-05  3528  static int octeon_usb_probe(struct platform_device *pdev)
96b06c0a16f737 Chris Packham 2020-02-05  3529  {
96b06c0a16f737 Chris Packham 2020-02-05  3530  	int status;
96b06c0a16f737 Chris Packham 2020-02-05  3531  	int initialize_flags;
96b06c0a16f737 Chris Packham 2020-02-05  3532  	int usb_num;
96b06c0a16f737 Chris Packham 2020-02-05  3533  	struct resource *res_mem;
96b06c0a16f737 Chris Packham 2020-02-05  3534  	struct device_node *usbn_node;
96b06c0a16f737 Chris Packham 2020-02-05  3535  	int irq = platform_get_irq(pdev, 0);
96b06c0a16f737 Chris Packham 2020-02-05  3536  	struct device *dev = &pdev->dev;
96b06c0a16f737 Chris Packham 2020-02-05  3537  	struct octeon_hcd *usb;
96b06c0a16f737 Chris Packham 2020-02-05  3538  	struct usb_hcd *hcd;
96b06c0a16f737 Chris Packham 2020-02-05  3539  	u32 clock_rate = 48000000;
96b06c0a16f737 Chris Packham 2020-02-05  3540  	bool is_crystal_clock = false;
96b06c0a16f737 Chris Packham 2020-02-05  3541  	const char *clock_type;
96b06c0a16f737 Chris Packham 2020-02-05  3542  	int i;
96b06c0a16f737 Chris Packham 2020-02-05  3543  
96b06c0a16f737 Chris Packham 2020-02-05  3544  	if (!dev->of_node) {
96b06c0a16f737 Chris Packham 2020-02-05  3545  		dev_err(dev, "Error: empty of_node\n");
96b06c0a16f737 Chris Packham 2020-02-05  3546  		return -ENXIO;
96b06c0a16f737 Chris Packham 2020-02-05  3547  	}
96b06c0a16f737 Chris Packham 2020-02-05 @3548  	usbn_node = dev->of_node->parent;
96b06c0a16f737 Chris Packham 2020-02-05  3549  
96b06c0a16f737 Chris Packham 2020-02-05 @3550  	i = of_property_read_u32(usbn_node,
96b06c0a16f737 Chris Packham 2020-02-05  3551  				 "clock-frequency", &clock_rate);
96b06c0a16f737 Chris Packham 2020-02-05  3552  	if (i)
96b06c0a16f737 Chris Packham 2020-02-05  3553  		i = of_property_read_u32(usbn_node,
96b06c0a16f737 Chris Packham 2020-02-05  3554  					 "refclk-frequency", &clock_rate);
96b06c0a16f737 Chris Packham 2020-02-05  3555  	if (i) {
96b06c0a16f737 Chris Packham 2020-02-05  3556  		dev_err(dev, "No USBN \"clock-frequency\"\n");
96b06c0a16f737 Chris Packham 2020-02-05  3557  		return -ENXIO;
96b06c0a16f737 Chris Packham 2020-02-05  3558  	}
96b06c0a16f737 Chris Packham 2020-02-05  3559  	switch (clock_rate) {
96b06c0a16f737 Chris Packham 2020-02-05  3560  	case 12000000:
96b06c0a16f737 Chris Packham 2020-02-05  3561  		initialize_flags = CVMX_USB_INITIALIZE_FLAGS_CLOCK_12MHZ;
96b06c0a16f737 Chris Packham 2020-02-05  3562  		break;
96b06c0a16f737 Chris Packham 2020-02-05  3563  	case 24000000:
96b06c0a16f737 Chris Packham 2020-02-05  3564  		initialize_flags = CVMX_USB_INITIALIZE_FLAGS_CLOCK_24MHZ;
96b06c0a16f737 Chris Packham 2020-02-05  3565  		break;
96b06c0a16f737 Chris Packham 2020-02-05  3566  	case 48000000:
96b06c0a16f737 Chris Packham 2020-02-05  3567  		initialize_flags = CVMX_USB_INITIALIZE_FLAGS_CLOCK_48MHZ;
96b06c0a16f737 Chris Packham 2020-02-05  3568  		break;
96b06c0a16f737 Chris Packham 2020-02-05  3569  	default:
96b06c0a16f737 Chris Packham 2020-02-05  3570  		dev_err(dev, "Illegal USBN \"clock-frequency\" %u\n",
96b06c0a16f737 Chris Packham 2020-02-05  3571  			clock_rate);
96b06c0a16f737 Chris Packham 2020-02-05  3572  		return -ENXIO;
96b06c0a16f737 Chris Packham 2020-02-05  3573  	}
96b06c0a16f737 Chris Packham 2020-02-05  3574  
96b06c0a16f737 Chris Packham 2020-02-05 @3575  	i = of_property_read_string(usbn_node,
96b06c0a16f737 Chris Packham 2020-02-05  3576  				    "cavium,refclk-type", &clock_type);
96b06c0a16f737 Chris Packham 2020-02-05  3577  	if (i)
96b06c0a16f737 Chris Packham 2020-02-05  3578  		i = of_property_read_string(usbn_node,
96b06c0a16f737 Chris Packham 2020-02-05  3579  					    "refclk-type", &clock_type);
96b06c0a16f737 Chris Packham 2020-02-05  3580  
96b06c0a16f737 Chris Packham 2020-02-05  3581  	if (!i && strcmp("crystal", clock_type) == 0)
96b06c0a16f737 Chris Packham 2020-02-05  3582  		is_crystal_clock = true;
96b06c0a16f737 Chris Packham 2020-02-05  3583  
96b06c0a16f737 Chris Packham 2020-02-05  3584  	if (is_crystal_clock)
96b06c0a16f737 Chris Packham 2020-02-05  3585  		initialize_flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_XI;
96b06c0a16f737 Chris Packham 2020-02-05  3586  	else
96b06c0a16f737 Chris Packham 2020-02-05  3587  		initialize_flags |= CVMX_USB_INITIALIZE_FLAGS_CLOCK_XO_GND;
96b06c0a16f737 Chris Packham 2020-02-05  3588  
96b06c0a16f737 Chris Packham 2020-02-05  3589  	res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
96b06c0a16f737 Chris Packham 2020-02-05  3590  	if (!res_mem) {
96b06c0a16f737 Chris Packham 2020-02-05  3591  		dev_err(dev, "found no memory resource\n");
96b06c0a16f737 Chris Packham 2020-02-05  3592  		return -ENXIO;
96b06c0a16f737 Chris Packham 2020-02-05  3593  	}
96b06c0a16f737 Chris Packham 2020-02-05  3594  	usb_num = (res_mem->start >> 44) & 1;
96b06c0a16f737 Chris Packham 2020-02-05  3595  
96b06c0a16f737 Chris Packham 2020-02-05  3596  	if (irq < 0) {
96b06c0a16f737 Chris Packham 2020-02-05  3597  		/* Defective device tree, but we know how to fix it. */
96b06c0a16f737 Chris Packham 2020-02-05  3598  		irq_hw_number_t hwirq = usb_num ? (1 << 6) + 17 : 56;
96b06c0a16f737 Chris Packham 2020-02-05  3599  
96b06c0a16f737 Chris Packham 2020-02-05 @3600  		irq = irq_create_mapping(NULL, hwirq);
96b06c0a16f737 Chris Packham 2020-02-05  3601  	}
96b06c0a16f737 Chris Packham 2020-02-05  3602  
96b06c0a16f737 Chris Packham 2020-02-05  3603  	/*
96b06c0a16f737 Chris Packham 2020-02-05  3604  	 * Set the DMA mask to 64bits so we get buffers already translated for
96b06c0a16f737 Chris Packham 2020-02-05  3605  	 * DMA.
96b06c0a16f737 Chris Packham 2020-02-05  3606  	 */
96b06c0a16f737 Chris Packham 2020-02-05  3607  	i = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(64));
96b06c0a16f737 Chris Packham 2020-02-05  3608  	if (i)
96b06c0a16f737 Chris Packham 2020-02-05  3609  		return i;
96b06c0a16f737 Chris Packham 2020-02-05  3610  
96b06c0a16f737 Chris Packham 2020-02-05  3611  	/*
96b06c0a16f737 Chris Packham 2020-02-05  3612  	 * Only cn52XX and cn56XX have DWC_OTG USB hardware and the
96b06c0a16f737 Chris Packham 2020-02-05  3613  	 * IOB priority registers.  Under heavy network load USB
96b06c0a16f737 Chris Packham 2020-02-05  3614  	 * hardware can be starved by the IOB causing a crash.  Give
96b06c0a16f737 Chris Packham 2020-02-05  3615  	 * it a priority boost if it has been waiting more than 400
96b06c0a16f737 Chris Packham 2020-02-05  3616  	 * cycles to avoid this situation.
96b06c0a16f737 Chris Packham 2020-02-05  3617  	 *
96b06c0a16f737 Chris Packham 2020-02-05  3618  	 * Testing indicates that a cnt_val of 8192 is not sufficient,
96b06c0a16f737 Chris Packham 2020-02-05  3619  	 * but no failures are seen with 4096.  We choose a value of
96b06c0a16f737 Chris Packham 2020-02-05  3620  	 * 400 to give a safety factor of 10.
96b06c0a16f737 Chris Packham 2020-02-05  3621  	 */
96b06c0a16f737 Chris Packham 2020-02-05  3622  	if (OCTEON_IS_MODEL(OCTEON_CN52XX) || OCTEON_IS_MODEL(OCTEON_CN56XX)) {
96b06c0a16f737 Chris Packham 2020-02-05  3623  		union cvmx_iob_n2c_l2c_pri_cnt pri_cnt;
96b06c0a16f737 Chris Packham 2020-02-05  3624  
96b06c0a16f737 Chris Packham 2020-02-05  3625  		pri_cnt.u64 = 0;
96b06c0a16f737 Chris Packham 2020-02-05  3626  		pri_cnt.s.cnt_enb = 1;
96b06c0a16f737 Chris Packham 2020-02-05  3627  		pri_cnt.s.cnt_val = 400;
96b06c0a16f737 Chris Packham 2020-02-05  3628  		cvmx_write_csr(CVMX_IOB_N2C_L2C_PRI_CNT, pri_cnt.u64);
96b06c0a16f737 Chris Packham 2020-02-05  3629  	}
96b06c0a16f737 Chris Packham 2020-02-05  3630  
96b06c0a16f737 Chris Packham 2020-02-05  3631  	hcd = usb_create_hcd(&octeon_hc_driver, dev, dev_name(dev));
96b06c0a16f737 Chris Packham 2020-02-05  3632  	if (!hcd) {
96b06c0a16f737 Chris Packham 2020-02-05  3633  		dev_dbg(dev, "Failed to allocate memory for HCD\n");
96b06c0a16f737 Chris Packham 2020-02-05  3634  		return -1;
96b06c0a16f737 Chris Packham 2020-02-05  3635  	}
96b06c0a16f737 Chris Packham 2020-02-05  3636  	hcd->uses_new_polling = 1;
96b06c0a16f737 Chris Packham 2020-02-05  3637  	usb = (struct octeon_hcd *)hcd->hcd_priv;
96b06c0a16f737 Chris Packham 2020-02-05  3638  
96b06c0a16f737 Chris Packham 2020-02-05  3639  	spin_lock_init(&usb->lock);
96b06c0a16f737 Chris Packham 2020-02-05  3640  
96b06c0a16f737 Chris Packham 2020-02-05  3641  	usb->init_flags = initialize_flags;
96b06c0a16f737 Chris Packham 2020-02-05  3642  
96b06c0a16f737 Chris Packham 2020-02-05  3643  	/* Initialize the USB state structure */
96b06c0a16f737 Chris Packham 2020-02-05  3644  	usb->index = usb_num;
96b06c0a16f737 Chris Packham 2020-02-05  3645  	INIT_LIST_HEAD(&usb->idle_pipes);
96b06c0a16f737 Chris Packham 2020-02-05  3646  	for (i = 0; i < ARRAY_SIZE(usb->active_pipes); i++)
96b06c0a16f737 Chris Packham 2020-02-05  3647  		INIT_LIST_HEAD(&usb->active_pipes[i]);
96b06c0a16f737 Chris Packham 2020-02-05  3648  
96b06c0a16f737 Chris Packham 2020-02-05  3649  	/* Due to an errata, CN31XX doesn't support DMA */
96b06c0a16f737 Chris Packham 2020-02-05  3650  	if (OCTEON_IS_MODEL(OCTEON_CN31XX)) {
96b06c0a16f737 Chris Packham 2020-02-05  3651  		usb->init_flags |= CVMX_USB_INITIALIZE_FLAGS_NO_DMA;
96b06c0a16f737 Chris Packham 2020-02-05  3652  		/* Only use one channel with non DMA */
96b06c0a16f737 Chris Packham 2020-02-05  3653  		usb->idle_hardware_channels = 0x1;
96b06c0a16f737 Chris Packham 2020-02-05  3654  	} else if (OCTEON_IS_MODEL(OCTEON_CN5XXX)) {
96b06c0a16f737 Chris Packham 2020-02-05  3655  		/* CN5XXX have an errata with channel 3 */
96b06c0a16f737 Chris Packham 2020-02-05  3656  		usb->idle_hardware_channels = 0xf7;
96b06c0a16f737 Chris Packham 2020-02-05  3657  	} else {
96b06c0a16f737 Chris Packham 2020-02-05  3658  		usb->idle_hardware_channels = 0xff;
96b06c0a16f737 Chris Packham 2020-02-05  3659  	}
96b06c0a16f737 Chris Packham 2020-02-05  3660  
96b06c0a16f737 Chris Packham 2020-02-05  3661  	status = cvmx_usb_initialize(dev, usb);
96b06c0a16f737 Chris Packham 2020-02-05  3662  	if (status) {
96b06c0a16f737 Chris Packham 2020-02-05  3663  		dev_dbg(dev, "USB initialization failed with %d\n", status);
96b06c0a16f737 Chris Packham 2020-02-05  3664  		usb_put_hcd(hcd);
96b06c0a16f737 Chris Packham 2020-02-05  3665  		return -1;
96b06c0a16f737 Chris Packham 2020-02-05  3666  	}
96b06c0a16f737 Chris Packham 2020-02-05  3667  
96b06c0a16f737 Chris Packham 2020-02-05  3668  	status = usb_add_hcd(hcd, irq, 0);
96b06c0a16f737 Chris Packham 2020-02-05  3669  	if (status) {
96b06c0a16f737 Chris Packham 2020-02-05  3670  		dev_dbg(dev, "USB add HCD failed with %d\n", status);
96b06c0a16f737 Chris Packham 2020-02-05  3671  		usb_put_hcd(hcd);
96b06c0a16f737 Chris Packham 2020-02-05  3672  		return -1;
96b06c0a16f737 Chris Packham 2020-02-05  3673  	}
96b06c0a16f737 Chris Packham 2020-02-05  3674  	device_wakeup_enable(hcd->self.controller);
96b06c0a16f737 Chris Packham 2020-02-05  3675  
96b06c0a16f737 Chris Packham 2020-02-05  3676  	dev_info(dev, "Registered HCD for port %d on irq %d\n", usb_num, irq);
96b06c0a16f737 Chris Packham 2020-02-05  3677  
96b06c0a16f737 Chris Packham 2020-02-05  3678  	return 0;
96b06c0a16f737 Chris Packham 2020-02-05  3679  }
96b06c0a16f737 Chris Packham 2020-02-05  3680  

:::::: The code at line 3548 was first introduced by commit
:::::: 96b06c0a16f737e9ea7dff1e23dd5f6d847e6731 Revert "staging: octeon-usb: delete the octeon usb host controller driver"

:::::: TO: Chris Packham <chris.packham at alliedtelesis.co.nz>
:::::: CC: Greg Kroah-Hartman <gregkh at linuxfoundation.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 18966 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20210516/f0224d87/attachment-0001.gz>


More information about the linux-arm-kernel mailing list