[Freedreno] [PATCH v3] of_device: removed #include that caused a recursion in included headers

kbuild test robot lkp at intel.com
Thu Apr 23 05:27:31 UTC 2020


Hi Hadar,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on sparc/master]
[also build test ERROR on stm32/stm32-next linus/master v5.7-rc2 next-20200422]
[cannot apply to sparc-next/master]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Hadar-Gat/of_device-removed-include-that-caused-a-recursion-in-included-headers/20200423-040844
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc.git master
config: arm64-defconfig (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=arm64 

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

All errors (new ones prefixed by >>):

   drivers/firmware/ti_sci.c: In function 'ti_sci_probe':
>> drivers/firmware/ti_sci.c:3520:9: error: implicit declaration of function 'of_platform_populate' [-Werror=implicit-function-declaration]
    3520 |  return of_platform_populate(dev->of_node, NULL, NULL, dev);
         |         ^~~~~~~~~~~~~~~~~~~~
   drivers/firmware/ti_sci.c: In function 'ti_sci_remove':
>> drivers/firmware/ti_sci.c:3536:2: error: implicit declaration of function 'of_platform_depopulate' [-Werror=implicit-function-declaration]
    3536 |  of_platform_depopulate(dev);
         |  ^~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors
--
   drivers/firmware/tegra/bpmp.c: In function 'tegra_bpmp_get':
>> drivers/firmware/tegra/bpmp.c:51:9: error: implicit declaration of function 'of_find_device_by_node'; did you mean 'bus_find_device_by_fwnode'? [-Werror=implicit-function-declaration]
      51 |  pdev = of_find_device_by_node(np);
         |         ^~~~~~~~~~~~~~~~~~~~~~
         |         bus_find_device_by_fwnode
   drivers/firmware/tegra/bpmp.c:51:7: warning: assignment to 'struct platform_device *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
      51 |  pdev = of_find_device_by_node(np);
         |       ^
   drivers/firmware/tegra/bpmp.c: In function 'tegra_bpmp_probe':
>> drivers/firmware/tegra/bpmp.c:759:8: error: implicit declaration of function 'of_platform_default_populate' [-Werror=implicit-function-declaration]
     759 |  err = of_platform_default_populate(pdev->dev.of_node, NULL, &pdev->dev);
         |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors
--
   drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c: In function 'sun8i_dw_hdmi_find_connector_pdev':
>> drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c:115:9: error: implicit declaration of function 'of_find_device_by_node'; did you mean 'of_find_i2c_device_by_node'? [-Werror=implicit-function-declaration]
     115 |  pdev = of_find_device_by_node(remote);
         |         ^~~~~~~~~~~~~~~~~~~~~~
         |         of_find_i2c_device_by_node
   drivers/gpu/drm/sun4i/sun8i_dw_hdmi.c:115:7: warning: assignment to 'struct platform_device *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     115 |  pdev = of_find_device_by_node(remote);
         |       ^
   cc1: some warnings being treated as errors

vim +/of_platform_populate +3520 drivers/firmware/ti_sci.c

aa276781a64a5f Nishanth Menon 2016-10-18  3385  
aa276781a64a5f Nishanth Menon 2016-10-18  3386  static int ti_sci_probe(struct platform_device *pdev)
aa276781a64a5f Nishanth Menon 2016-10-18  3387  {
aa276781a64a5f Nishanth Menon 2016-10-18  3388  	struct device *dev = &pdev->dev;
aa276781a64a5f Nishanth Menon 2016-10-18  3389  	const struct of_device_id *of_id;
aa276781a64a5f Nishanth Menon 2016-10-18  3390  	const struct ti_sci_desc *desc;
aa276781a64a5f Nishanth Menon 2016-10-18  3391  	struct ti_sci_xfer *xfer;
aa276781a64a5f Nishanth Menon 2016-10-18  3392  	struct ti_sci_info *info = NULL;
aa276781a64a5f Nishanth Menon 2016-10-18  3393  	struct ti_sci_xfers_info *minfo;
aa276781a64a5f Nishanth Menon 2016-10-18  3394  	struct mbox_client *cl;
aa276781a64a5f Nishanth Menon 2016-10-18  3395  	int ret = -EINVAL;
aa276781a64a5f Nishanth Menon 2016-10-18  3396  	int i;
912cffb4ed8612 Nishanth Menon 2016-10-18  3397  	int reboot = 0;
e69a35531589a2 Nishanth Menon 2018-08-28  3398  	u32 h_id;
aa276781a64a5f Nishanth Menon 2016-10-18  3399  
aa276781a64a5f Nishanth Menon 2016-10-18  3400  	of_id = of_match_device(ti_sci_of_match, dev);
aa276781a64a5f Nishanth Menon 2016-10-18  3401  	if (!of_id) {
aa276781a64a5f Nishanth Menon 2016-10-18  3402  		dev_err(dev, "OF data missing\n");
aa276781a64a5f Nishanth Menon 2016-10-18  3403  		return -EINVAL;
aa276781a64a5f Nishanth Menon 2016-10-18  3404  	}
aa276781a64a5f Nishanth Menon 2016-10-18  3405  	desc = of_id->data;
aa276781a64a5f Nishanth Menon 2016-10-18  3406  
aa276781a64a5f Nishanth Menon 2016-10-18  3407  	info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);
aa276781a64a5f Nishanth Menon 2016-10-18  3408  	if (!info)
aa276781a64a5f Nishanth Menon 2016-10-18  3409  		return -ENOMEM;
aa276781a64a5f Nishanth Menon 2016-10-18  3410  
aa276781a64a5f Nishanth Menon 2016-10-18  3411  	info->dev = dev;
aa276781a64a5f Nishanth Menon 2016-10-18  3412  	info->desc = desc;
e69a35531589a2 Nishanth Menon 2018-08-28  3413  	ret = of_property_read_u32(dev->of_node, "ti,host-id", &h_id);
e69a35531589a2 Nishanth Menon 2018-08-28  3414  	/* if the property is not present in DT, use a default from desc */
e69a35531589a2 Nishanth Menon 2018-08-28  3415  	if (ret < 0) {
e69a35531589a2 Nishanth Menon 2018-08-28  3416  		info->host_id = info->desc->default_host_id;
e69a35531589a2 Nishanth Menon 2018-08-28  3417  	} else {
e69a35531589a2 Nishanth Menon 2018-08-28  3418  		if (!h_id) {
e69a35531589a2 Nishanth Menon 2018-08-28  3419  			dev_warn(dev, "Host ID 0 is reserved for firmware\n");
e69a35531589a2 Nishanth Menon 2018-08-28  3420  			info->host_id = info->desc->default_host_id;
e69a35531589a2 Nishanth Menon 2018-08-28  3421  		} else {
e69a35531589a2 Nishanth Menon 2018-08-28  3422  			info->host_id = h_id;
e69a35531589a2 Nishanth Menon 2018-08-28  3423  		}
e69a35531589a2 Nishanth Menon 2018-08-28  3424  	}
e69a35531589a2 Nishanth Menon 2018-08-28  3425  
912cffb4ed8612 Nishanth Menon 2016-10-18  3426  	reboot = of_property_read_bool(dev->of_node,
912cffb4ed8612 Nishanth Menon 2016-10-18  3427  				       "ti,system-reboot-controller");
aa276781a64a5f Nishanth Menon 2016-10-18  3428  	INIT_LIST_HEAD(&info->node);
aa276781a64a5f Nishanth Menon 2016-10-18  3429  	minfo = &info->minfo;
aa276781a64a5f Nishanth Menon 2016-10-18  3430  
aa276781a64a5f Nishanth Menon 2016-10-18  3431  	/*
aa276781a64a5f Nishanth Menon 2016-10-18  3432  	 * Pre-allocate messages
aa276781a64a5f Nishanth Menon 2016-10-18  3433  	 * NEVER allocate more than what we can indicate in hdr.seq
aa276781a64a5f Nishanth Menon 2016-10-18  3434  	 * if we have data description bug, force a fix..
aa276781a64a5f Nishanth Menon 2016-10-18  3435  	 */
aa276781a64a5f Nishanth Menon 2016-10-18  3436  	if (WARN_ON(desc->max_msgs >=
aa276781a64a5f Nishanth Menon 2016-10-18  3437  		    1 << 8 * sizeof(((struct ti_sci_msg_hdr *)0)->seq)))
aa276781a64a5f Nishanth Menon 2016-10-18  3438  		return -EINVAL;
aa276781a64a5f Nishanth Menon 2016-10-18  3439  
aa276781a64a5f Nishanth Menon 2016-10-18  3440  	minfo->xfer_block = devm_kcalloc(dev,
aa276781a64a5f Nishanth Menon 2016-10-18  3441  					 desc->max_msgs,
aa276781a64a5f Nishanth Menon 2016-10-18  3442  					 sizeof(*minfo->xfer_block),
aa276781a64a5f Nishanth Menon 2016-10-18  3443  					 GFP_KERNEL);
aa276781a64a5f Nishanth Menon 2016-10-18  3444  	if (!minfo->xfer_block)
aa276781a64a5f Nishanth Menon 2016-10-18  3445  		return -ENOMEM;
aa276781a64a5f Nishanth Menon 2016-10-18  3446  
a86854d0c599b3 Kees Cook      2018-06-12  3447  	minfo->xfer_alloc_table = devm_kcalloc(dev,
a86854d0c599b3 Kees Cook      2018-06-12  3448  					       BITS_TO_LONGS(desc->max_msgs),
a86854d0c599b3 Kees Cook      2018-06-12  3449  					       sizeof(unsigned long),
aa276781a64a5f Nishanth Menon 2016-10-18  3450  					       GFP_KERNEL);
aa276781a64a5f Nishanth Menon 2016-10-18  3451  	if (!minfo->xfer_alloc_table)
aa276781a64a5f Nishanth Menon 2016-10-18  3452  		return -ENOMEM;
aa276781a64a5f Nishanth Menon 2016-10-18  3453  	bitmap_zero(minfo->xfer_alloc_table, desc->max_msgs);
aa276781a64a5f Nishanth Menon 2016-10-18  3454  
aa276781a64a5f Nishanth Menon 2016-10-18  3455  	/* Pre-initialize the buffer pointer to pre-allocated buffers */
aa276781a64a5f Nishanth Menon 2016-10-18  3456  	for (i = 0, xfer = minfo->xfer_block; i < desc->max_msgs; i++, xfer++) {
aa276781a64a5f Nishanth Menon 2016-10-18  3457  		xfer->xfer_buf = devm_kcalloc(dev, 1, desc->max_msg_size,
aa276781a64a5f Nishanth Menon 2016-10-18  3458  					      GFP_KERNEL);
aa276781a64a5f Nishanth Menon 2016-10-18  3459  		if (!xfer->xfer_buf)
aa276781a64a5f Nishanth Menon 2016-10-18  3460  			return -ENOMEM;
aa276781a64a5f Nishanth Menon 2016-10-18  3461  
aa276781a64a5f Nishanth Menon 2016-10-18  3462  		xfer->tx_message.buf = xfer->xfer_buf;
aa276781a64a5f Nishanth Menon 2016-10-18  3463  		init_completion(&xfer->done);
aa276781a64a5f Nishanth Menon 2016-10-18  3464  	}
aa276781a64a5f Nishanth Menon 2016-10-18  3465  
aa276781a64a5f Nishanth Menon 2016-10-18  3466  	ret = ti_sci_debugfs_create(pdev, info);
aa276781a64a5f Nishanth Menon 2016-10-18  3467  	if (ret)
aa276781a64a5f Nishanth Menon 2016-10-18  3468  		dev_warn(dev, "Failed to create debug file\n");
aa276781a64a5f Nishanth Menon 2016-10-18  3469  
aa276781a64a5f Nishanth Menon 2016-10-18  3470  	platform_set_drvdata(pdev, info);
aa276781a64a5f Nishanth Menon 2016-10-18  3471  
aa276781a64a5f Nishanth Menon 2016-10-18  3472  	cl = &info->cl;
aa276781a64a5f Nishanth Menon 2016-10-18  3473  	cl->dev = dev;
aa276781a64a5f Nishanth Menon 2016-10-18  3474  	cl->tx_block = false;
aa276781a64a5f Nishanth Menon 2016-10-18  3475  	cl->rx_callback = ti_sci_rx_callback;
aa276781a64a5f Nishanth Menon 2016-10-18  3476  	cl->knows_txdone = true;
aa276781a64a5f Nishanth Menon 2016-10-18  3477  
aa276781a64a5f Nishanth Menon 2016-10-18  3478  	spin_lock_init(&minfo->xfer_lock);
aa276781a64a5f Nishanth Menon 2016-10-18  3479  	sema_init(&minfo->sem_xfer_count, desc->max_msgs);
aa276781a64a5f Nishanth Menon 2016-10-18  3480  
aa276781a64a5f Nishanth Menon 2016-10-18  3481  	info->chan_rx = mbox_request_channel_byname(cl, "rx");
aa276781a64a5f Nishanth Menon 2016-10-18  3482  	if (IS_ERR(info->chan_rx)) {
aa276781a64a5f Nishanth Menon 2016-10-18  3483  		ret = PTR_ERR(info->chan_rx);
aa276781a64a5f Nishanth Menon 2016-10-18  3484  		goto out;
aa276781a64a5f Nishanth Menon 2016-10-18  3485  	}
aa276781a64a5f Nishanth Menon 2016-10-18  3486  
aa276781a64a5f Nishanth Menon 2016-10-18  3487  	info->chan_tx = mbox_request_channel_byname(cl, "tx");
aa276781a64a5f Nishanth Menon 2016-10-18  3488  	if (IS_ERR(info->chan_tx)) {
aa276781a64a5f Nishanth Menon 2016-10-18  3489  		ret = PTR_ERR(info->chan_tx);
aa276781a64a5f Nishanth Menon 2016-10-18  3490  		goto out;
aa276781a64a5f Nishanth Menon 2016-10-18  3491  	}
aa276781a64a5f Nishanth Menon 2016-10-18  3492  	ret = ti_sci_cmd_get_revision(info);
aa276781a64a5f Nishanth Menon 2016-10-18  3493  	if (ret) {
aa276781a64a5f Nishanth Menon 2016-10-18  3494  		dev_err(dev, "Unable to communicate with TISCI(%d)\n", ret);
aa276781a64a5f Nishanth Menon 2016-10-18  3495  		goto out;
aa276781a64a5f Nishanth Menon 2016-10-18  3496  	}
aa276781a64a5f Nishanth Menon 2016-10-18  3497  
9e7d756da7a5b0 Nishanth Menon 2016-10-18  3498  	ti_sci_setup_ops(info);
9e7d756da7a5b0 Nishanth Menon 2016-10-18  3499  
912cffb4ed8612 Nishanth Menon 2016-10-18  3500  	if (reboot) {
912cffb4ed8612 Nishanth Menon 2016-10-18  3501  		info->nb.notifier_call = tisci_reboot_handler;
912cffb4ed8612 Nishanth Menon 2016-10-18  3502  		info->nb.priority = 128;
912cffb4ed8612 Nishanth Menon 2016-10-18  3503  
912cffb4ed8612 Nishanth Menon 2016-10-18  3504  		ret = register_restart_handler(&info->nb);
912cffb4ed8612 Nishanth Menon 2016-10-18  3505  		if (ret) {
912cffb4ed8612 Nishanth Menon 2016-10-18  3506  			dev_err(dev, "reboot registration fail(%d)\n", ret);
912cffb4ed8612 Nishanth Menon 2016-10-18  3507  			return ret;
912cffb4ed8612 Nishanth Menon 2016-10-18  3508  		}
912cffb4ed8612 Nishanth Menon 2016-10-18  3509  	}
912cffb4ed8612 Nishanth Menon 2016-10-18  3510  
aa276781a64a5f Nishanth Menon 2016-10-18  3511  	dev_info(dev, "ABI: %d.%d (firmware rev 0x%04x '%s')\n",
aa276781a64a5f Nishanth Menon 2016-10-18  3512  		 info->handle.version.abi_major, info->handle.version.abi_minor,
aa276781a64a5f Nishanth Menon 2016-10-18  3513  		 info->handle.version.firmware_revision,
aa276781a64a5f Nishanth Menon 2016-10-18  3514  		 info->handle.version.firmware_description);
aa276781a64a5f Nishanth Menon 2016-10-18  3515  
aa276781a64a5f Nishanth Menon 2016-10-18  3516  	mutex_lock(&ti_sci_list_mutex);
aa276781a64a5f Nishanth Menon 2016-10-18  3517  	list_add_tail(&info->node, &ti_sci_list);
aa276781a64a5f Nishanth Menon 2016-10-18  3518  	mutex_unlock(&ti_sci_list_mutex);
aa276781a64a5f Nishanth Menon 2016-10-18  3519  
aa276781a64a5f Nishanth Menon 2016-10-18 @3520  	return of_platform_populate(dev->of_node, NULL, NULL, dev);
aa276781a64a5f Nishanth Menon 2016-10-18  3521  out:
aa276781a64a5f Nishanth Menon 2016-10-18  3522  	if (!IS_ERR(info->chan_tx))
aa276781a64a5f Nishanth Menon 2016-10-18  3523  		mbox_free_channel(info->chan_tx);
aa276781a64a5f Nishanth Menon 2016-10-18  3524  	if (!IS_ERR(info->chan_rx))
aa276781a64a5f Nishanth Menon 2016-10-18  3525  		mbox_free_channel(info->chan_rx);
aa276781a64a5f Nishanth Menon 2016-10-18  3526  	debugfs_remove(info->d);
aa276781a64a5f Nishanth Menon 2016-10-18  3527  	return ret;
aa276781a64a5f Nishanth Menon 2016-10-18  3528  }
aa276781a64a5f Nishanth Menon 2016-10-18  3529  
aa276781a64a5f Nishanth Menon 2016-10-18  3530  static int ti_sci_remove(struct platform_device *pdev)
aa276781a64a5f Nishanth Menon 2016-10-18  3531  {
aa276781a64a5f Nishanth Menon 2016-10-18  3532  	struct ti_sci_info *info;
aa276781a64a5f Nishanth Menon 2016-10-18  3533  	struct device *dev = &pdev->dev;
aa276781a64a5f Nishanth Menon 2016-10-18  3534  	int ret = 0;
aa276781a64a5f Nishanth Menon 2016-10-18  3535  
aa276781a64a5f Nishanth Menon 2016-10-18 @3536  	of_platform_depopulate(dev);
aa276781a64a5f Nishanth Menon 2016-10-18  3537  
aa276781a64a5f Nishanth Menon 2016-10-18  3538  	info = platform_get_drvdata(pdev);
aa276781a64a5f Nishanth Menon 2016-10-18  3539  
912cffb4ed8612 Nishanth Menon 2016-10-18  3540  	if (info->nb.notifier_call)
912cffb4ed8612 Nishanth Menon 2016-10-18  3541  		unregister_restart_handler(&info->nb);
912cffb4ed8612 Nishanth Menon 2016-10-18  3542  
aa276781a64a5f Nishanth Menon 2016-10-18  3543  	mutex_lock(&ti_sci_list_mutex);
aa276781a64a5f Nishanth Menon 2016-10-18  3544  	if (info->users)
aa276781a64a5f Nishanth Menon 2016-10-18  3545  		ret = -EBUSY;
aa276781a64a5f Nishanth Menon 2016-10-18  3546  	else
aa276781a64a5f Nishanth Menon 2016-10-18  3547  		list_del(&info->node);
aa276781a64a5f Nishanth Menon 2016-10-18  3548  	mutex_unlock(&ti_sci_list_mutex);
aa276781a64a5f Nishanth Menon 2016-10-18  3549  
aa276781a64a5f Nishanth Menon 2016-10-18  3550  	if (!ret) {
aa276781a64a5f Nishanth Menon 2016-10-18  3551  		ti_sci_debugfs_destroy(pdev, info);
aa276781a64a5f Nishanth Menon 2016-10-18  3552  
aa276781a64a5f Nishanth Menon 2016-10-18  3553  		/* Safe to free channels since no more users */
aa276781a64a5f Nishanth Menon 2016-10-18  3554  		mbox_free_channel(info->chan_tx);
aa276781a64a5f Nishanth Menon 2016-10-18  3555  		mbox_free_channel(info->chan_rx);
aa276781a64a5f Nishanth Menon 2016-10-18  3556  	}
aa276781a64a5f Nishanth Menon 2016-10-18  3557  
aa276781a64a5f Nishanth Menon 2016-10-18  3558  	return ret;
aa276781a64a5f Nishanth Menon 2016-10-18  3559  }
aa276781a64a5f Nishanth Menon 2016-10-18  3560  

:::::: The code at line 3520 was first introduced by commit
:::::: aa276781a64a5f15ecc21e920960c5b1f84e5fee firmware: Add basic support for TI System Control Interface (TI-SCI) protocol

:::::: TO: Nishanth Menon <nm at ti.com>
:::::: CC: Tero Kristo <t-kristo at ti.com>

---
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: 48658 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/freedreno/attachments/20200423/1ef658f8/attachment-0001.gz>


More information about the Freedreno mailing list