All of lore.kernel.org
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: "Hadar Gat" <hadar.gat@arm.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Shawn Guo" <shawnguo@kernel.org>,
	"Sascha Hauer" <s.hauer@pengutronix.de>,
	"Liviu Dudau" <liviu.dudau@arm.com>,
	"Sudeep Holla" <sudeep.holla@arm.com>,
	"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
	"Michael Turquette" <mturquette@baylibre.com>,
	"Stephen Boyd" <sboyd@kernel.org>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"Ludovic Desroches" <ludovic.desroches@microchip.com>,
	"Vinod Koul" <vkoul@kernel.org>,
	"Maxime Coquelin" <mcoquelin.stm32@gmail.com>,
	"Alexandre Torgue" <alexandre.torgue@st.com>,
	"Rob Clark" <robdclark@gmail.com>, "Sean Paul" <sean@poorly.run>,
	"David Airlie" <airlied@linux.ie>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Sandy Huang" <hjc@rock-chips.com>,
	"Heiko Stübner" <heiko@sntech.de>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Chen-Yu Tsai" <wens@csie.org>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Joerg Roedel" <joro@8bytes.org>,
	"Jonathan Hunter" <jonathanh@nvidia.com>,
	"Philipp Zabel" <p.zabel@pengutronix.de>,
	"Mauro Carvalho Chehab" <mchehab@kernel.org>,
	"Nicolas Ferre" <nicolas.ferre@microchip.com>,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	"Tony Lindgren" <tony@atomide.com>,
	"Lee Jones" <lee.jones@linaro.org>,
	"Andy Gross" <agross@kernel.org>,
	"Bjorn Andersson" <bjorn.andersson@linaro.org>,
	"Miquel Raynal" <miquel.raynal@bootlin.com>,
	"Richard Weinberger" <richard@nod.at>,
	"Vignesh Raghavendra" <vigneshr@ti.com>,
	"Giuseppe Cavallaro" <peppe.cavallaro@st.com>,
	"Jose Abreu" <joabreu@synopsys.com>, "JC Kuo" <jckuo@nvidia.com>,
	"Kishon Vijay Abraham I" <kishon@ti.com>,
	"Dong Aisheng" <aisheng.dong@nxp.com>,
	"Fabio Estevam" <festevam@gmail.com>,
	"Stefan Agner" <stefan@agner.ch>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Kukjin Kim" <kgene@kernel.org>,
	"Krzysztof Kozlowski" <krzk@kernel.org>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Frank Rowand" <frowand.list@gmail.com>,
	linux-iio@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-mtd@lists.infradead.org, sparclinux@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org,
	linux-rockchip@lists.infradead.org, linux-media@vger.kernel.org,
	devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-gpio@vger.kernel.org, linux-mediatek@lists.infradead.org,
	linux-tegra@vger.kernel.org, linux-omap@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	"Ofir Drang" <ofir.drang@arm.com>,
	"Gilad Ben-Yossef" <gilad@benyossef.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	iommu@lists.linux-foundation.org, dmaengine@vger.kernel.org,
	freedreno@lists.freedesktop.org
Cc: linux-samsung-soc@vger.kernel.org, kbuild-all@lists.01.org,
	linux-iio@vger.kernel.org, netdev@vger.kernel.org,
	dri-devel@lists.freedesktop.org, linux-clk@vger.kernel.org,
	linux-rockchip@lists.infradead.org,
	linux-mtd@lists.infradead.org, Hadar Gat <hadar.gat@arm.com>,
	sparclinux@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-media@vger.kernel.org
Subject: Re: [PATCH v3] of_device: removed #include that caused a recursion in included headers
Date: Thu, 23 Apr 2020 13:27:31 +0800	[thread overview]
Message-ID: <202004231303.gnRgjLGr%lkp@intel.com> (raw)
In-Reply-To: <1587395080-15722-1-git-send-email-hadar.gat@arm.com>

[-- Attachment #1: Type: text/plain, Size: 16750 bytes --]

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@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@ti.com>
:::::: CC: Tero Kristo <t-kristo@ti.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 48658 bytes --]

[-- Attachment #3: Type: text/plain, Size: 156 bytes --]

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

WARNING: multiple messages have this Message-ID (diff)
From: kbuild test robot <lkp@intel.com>
To: "Hadar Gat" <hadar.gat@arm.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Shawn Guo" <shawnguo@kernel.org>,
	"Sascha Hauer" <s.hauer@pengutronix.de>,
	"Liviu Dudau" <liviu.dudau@arm.com>,
	"Sudeep Holla" <sudeep.holla@arm.com>,
	"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
	"Michael Turquette" <mturquette@baylibre.com>,
	"Stephen Boyd" <sboyd@kernel.org>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"Ludovic Desroches" <ludovic.desroches@microchip.com>,
	"Vinod Koul" <vkoul@kernel.org>,
	"Maxime Coquelin" <mcoquelin.stm32@gmail.com>,
	"Alexandre Torgue" <alexandre.torgue@st.com>,
	"Rob Clark" <robdclark@gmail.com>, "Sean Paul" <sean@poorly.run>,
	"David Airlie" <airlied@linux.ie>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Sandy Huang" <hjc@rock-chips.com>,
	"Heiko Stübner" <heiko@sntech.de>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Chen-Yu Tsai" <wens@csie.org>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Joerg Roedel" <joro@8bytes.org>,
	"Jonathan Hunter" <jonathanh@nvidia.com>,
	"Philipp Zabel" <p.zabel@pengutronix.de>,
	"Mauro Carvalho Chehab" <mchehab@kernel.org>,
	"Nicolas Ferre" <nicolas.ferre@microchip.com>,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	"Tony Lindgren" <tony@atomide.com>,
	"Lee Jones" <lee.jones@linaro.org>,
	"Andy Gross" <agross@kernel.org>,
	"Bjorn Andersson" <bjorn.andersson@linaro.org>,
	"Miquel Raynal" <miquel.raynal@bootlin.com>,
	"Richard Weinberger" <richard@nod.at>,
	"Vignesh Raghavendra" <vigneshr@ti.com>,
	"Giuseppe Cavallaro" <peppe.cavallaro@st.com>,
	"Jose Abreu" <joabreu@synopsys.com>, "JC Kuo" <jckuo@nvidia.com>,
	"Kishon Vijay Abraham I" <kishon@ti.com>,
	"Dong Aisheng" <aisheng.dong@nxp.com>,
	"Fabio Estevam" <festevam@gmail.com>,
	"Stefan Agner" <stefan@agner.ch>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Kukjin Kim" <kgene@kernel.org>,
	"Krzysztof Kozlowski" <krzk@kernel.org>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Frank Rowand" <frowand.list@gmail.com>,
	linux-iio@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-mtd@lists.infradead.org, sparclinux@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org,
	linux-rockchip@lists.infradead.org, linux-media@vger.kernel.org,
	devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-gpio@vger.kernel.org, linux-mediatek@lists.infradead.org,
	linux-tegra@vger.kernel.org, linux-omap@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	"Ofir Drang" <ofir.drang@arm.com>,
	"Gilad Ben-Yossef" <gilad@benyossef.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	iommu@lists.linux-foundation.org, dmaengine@vger.kernel.org,
	freedreno@lists.freedesktop.org
Cc: linux-samsung-soc@vger.kernel.org, kbuild-all@lists.01.org,
	linux-iio@vger.kernel.org, netdev@vger.kernel.org,
	dri-devel@lists.freedesktop.org, linux-clk@vger.kernel.org,
	linux-rockchip@lists.infradead.org,
	linux-mtd@lists.infradead.org, Hadar Gat <hadar.gat@arm.com>,
	sparclinux@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-media@vger.kernel.org
Subject: Re: [PATCH v3] of_device: removed #include that caused a recursion in included headers
Date: Thu, 23 Apr 2020 13:27:31 +0800	[thread overview]
Message-ID: <202004231303.gnRgjLGr%lkp@intel.com> (raw)
In-Reply-To: <1587395080-15722-1-git-send-email-hadar.gat@arm.com>

[-- Attachment #1: Type: text/plain, Size: 16750 bytes --]

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@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@ti.com>
:::::: CC: Tero Kristo <t-kristo@ti.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 48658 bytes --]

[-- Attachment #3: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: kbuild test robot <lkp@intel.com>
To: "Hadar Gat" <hadar.gat@arm.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Shawn Guo" <shawnguo@kernel.org>,
	"Sascha Hauer" <s.hauer@pengutronix.de>,
	"Liviu Dudau" <liviu.dudau@arm.com>,
	"Sudeep Holla" <sudeep.holla@arm.com>,
	"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
	"Michael Turquette" <mturquette@baylibre.com>,
	"Stephen Boyd" <sboyd@kernel.org>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"Ludovic Desroches" <ludovic.desroches@microchip.com>,
	"Vinod Koul" <vkoul@kernel.org>,
	"Maxime Coquelin" <mcoquelin.stm32@gmail.com>,
	"Alexandre Torgue" <alexandre.torgue@st.com>,
	"Rob Clark" <robdclark@gmail.com>, "Sean Paul" <sean@poorly.run>,
	"David Airlie" <airlied@linux.ie>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Sandy Huang" <hjc@rock-chips.com>,
	"Heiko Stübner" <heiko@sntech.de>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Chen-Yu Tsai" <wens@csie.org>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Joerg Roedel" <joro@8bytes.org>,
	"Jonathan Hunter" <jonathanh@nvidia.com>,
	"Philipp Zabel" <p.zabel@pengutronix.de>,
	"Mauro Carvalho Chehab" <mchehab@kernel.org>,
	"Nicolas Ferre" <nicolas.ferre@microchip.com>,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	"Tony Lindgren" <tony@atomide.com>,
	"Lee Jones" <lee.jones@linaro.org>,
	"Andy Gross" <agross@kernel.org>,
	"Bjorn Andersson" <bjorn.andersson@linaro.org>,
	"Miquel Raynal" <miquel.raynal@bootlin.com>,
	"Richard Weinberger" <richard@nod.at>,
	"Vignesh Raghavendra" <vigneshr@ti.com>,
	"Giuseppe Cavallaro" <peppe.cavallaro@st.com>,
	"Jose Abreu" <joabreu@synopsys.com>, "JC Kuo" <jckuo@nvidia.com>,
	"Kishon Vijay Abraham I" <kishon@ti.com>,
	"Dong Aisheng" <aisheng.dong@nxp.com>,
	"Fabio Estevam" <festevam@gmail.com>,
	"Stefan Agner" <stefan@agner.ch>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Kukjin Kim" <kgene@kernel.org>,
	"Krzysztof Kozlowski" <krzk@kernel.org>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Frank Rowand" <frowand.list@gmail.com>,
	linux-iio@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-mtd@lists.infradead.org, sparclinux@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org,
	linux-rockchip@lists.infradead.org, linux-media@vger.kernel.org,
	devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-gpio@vger.kernel.org, linux-mediatek@lists.infradead.org,
	linux-tegra@vger.kernel.org, linux-omap@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	"Ofir Drang" <ofir.drang@arm.com>,
	"Gilad Ben-Yossef" <gilad@benyossef.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	iommu@lists.linux-foundation.org, dmaengine@vger.kernel.org,
	freedreno@lists.freedesktop.org
Cc: linux-samsung-soc@vger.kernel.org, kbuild-all@lists.01.org,
	linux-iio@vger.kernel.org, netdev@vger.kernel.org,
	dri-devel@lists.freedesktop.org, linux-clk@vger.kernel.org,
	linux-rockchip@lists.infradead.org,
	linux-mtd@lists.infradead.org, Hadar Gat <hadar.gat@arm.com>,
	sparclinux@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-media@vger.kernel.org
Subject: Re: [PATCH v3] of_device: removed #include that caused a recursion in included headers
Date: Thu, 23 Apr 2020 13:27:31 +0800	[thread overview]
Message-ID: <202004231303.gnRgjLGr%lkp@intel.com> (raw)
In-Reply-To: <1587395080-15722-1-git-send-email-hadar.gat@arm.com>

[-- Attachment #1: Type: text/plain, Size: 16750 bytes --]

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@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@ti.com>
:::::: CC: Tero Kristo <t-kristo@ti.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 48658 bytes --]

[-- Attachment #3: Type: text/plain, Size: 144 bytes --]

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

WARNING: multiple messages have this Message-ID (diff)
From: kbuild test robot <lkp-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: "David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>,
	"Greg Kroah-Hartman"
	<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
	"Shawn Guo" <shawnguo-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	"Sascha Hauer" <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>,
	"Liviu Dudau" <liviu.dudau-5wv7dgnIgG8@public.gmane.org>,
	"Sudeep Holla" <sudeep.holla-5wv7dgnIgG8@public.gmane.org>,
	"Lorenzo Pieralisi"
	<lorenzo.pieralisi-5wv7dgnIgG8@public.gmane.org>,
	"Michael Turquette"
	<mturquette-rdvid1DuHRBWk0Htik3J/w@public.gmane.org>,
	"Stephen Boyd" <sboyd-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	"Matthias Brugger"
	<matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"Ludovic Desroches"
	<ludovic.desroches-UWL1GkI3JZL3oGB3hsPCZA@public.gmane.org>,
	"Vinod Koul" <vkoul-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	"Maxime Coquelin"
	<mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"Alexandre Torgue"
	<alexandre.torgue-qxv4g6HH51o@public.gmane.org>,
	"Rob Clark" <robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"Sean Paul" <sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>,
	"David Airlie" <airlied-cv59FeDIM0c@public.gmane.org>,
	"Daniel Vetter" <daniel-/w4YWyX8dFk@public.gmane.org>,
	"Sandy Huang" <hjc-TNX95d0MmH7DzftRWevZcw@public.gmane.org>,
	"Heiko Stübner" <heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org>,
	"Maxime Ripard" <mripard-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	"Chen-Yu Tsai" <wens-/F2/8XmEos0@public.gmane.org>
Cc: linux-samsung-soc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	kbuild-all-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org,
	linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	linux-clk-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Hadar Gat <hadar.gat-5wv7dgnIgG8@public.gmane.org>,
	sparclinux-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-stm32-XDFAJ8BFU24N7RejjzZ/Li2xQDfSxrLKVpNB7YpNyf8@public.gmane.org,
	linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v3] of_device: removed #include that caused a recursion in included headers
Date: Thu, 23 Apr 2020 13:27:31 +0800	[thread overview]
Message-ID: <202004231303.gnRgjLGr%lkp@intel.com> (raw)
In-Reply-To: <1587395080-15722-1-git-send-email-hadar.gat-5wv7dgnIgG8@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 16851 bytes --]

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-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

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-l0cyMroinI0@public.gmane.org>
:::::: CC: Tero Kristo <t-kristo-l0cyMroinI0@public.gmane.org>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 48658 bytes --]

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



WARNING: multiple messages have this Message-ID (diff)
From: kbuild test robot <lkp@intel.com>
To: "Hadar Gat" <hadar.gat@arm.com>,
	"David S. Miller" <davem@davemloft.net>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Shawn Guo" <shawnguo@kernel.org>,
	"Sascha Hauer" <s.hauer@pengutronix.de>,
	"Liviu Dudau" <liviu.dudau@arm.com>,
	"Sudeep Holla" <sudeep.holla@arm.com>,
	"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
	"Michael Turquette" <mturquette@baylibre.com>,
	"Stephen Boyd" <sboyd@kernel.org>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"Ludovic Desroches" <ludovic.desroches@microchip.com>,
	"Vinod Koul" <vkoul@kernel.org>,
	"Maxime Coquelin" <mcoquelin.stm32@gmail.com>,
	"Alexandre Torgue" <alexandre.torgue@st.com>,
	"Rob Clark" <robdclark@gmail.com>, "Sean Paul" <sean@poorly.run>,
	"David Airlie" <airlied@linux.ie>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Sandy Huang" <hjc@rock-chips.com>,
	"Heiko Stübner" <heiko@sntech.de>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Chen-Yu Tsai" <wens@csie.org>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Joerg Roedel" <joro@8bytes.org>,
	"Jonathan Hunter" <jonathanh@nvidia.com>,
	"Philipp Zabel" <p.zabel@pengutronix.de>,
	"Mauro Carvalho Chehab" <mchehab@kernel.org>,
	"Nicolas Ferre" <nicolas.ferre@microchip.com>,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	"Tony Lindgren" <tony@atomide.com>,
	"Lee Jones" <lee.jones@linaro.org>,
	"Andy Gross" <agross@kernel.org>,
	"Bjorn Andersson" <bjorn.andersson@linaro.org>,
	"Miquel Raynal" <miquel.raynal@bootlin.com>,
	"Richard Weinberger" <richard@nod.at>,
	"Vignesh Raghavendra" <vigneshr@ti.com>,
	"Giuseppe Cavallaro" <peppe.cavallaro@st.com>,
	"Jose Abreu" <joabreu@synopsys.com>, "JC Kuo" <jckuo@nvidia.com>,
	"Kishon Vijay Abraham I" <kishon@ti.com>,
	"Dong Aisheng" <aisheng.dong@nxp.com>,
	"Fabio Estevam" <festevam@gmail.com>,
	"Stefan Agner" <stefan@agner.ch>,
	"Linus Walleij" <linus.walleij@linaro.org>,
	"Kukjin Kim" <kgene@kernel.org>,
	"Krzysztof Kozlowski" <krzk@kernel.org>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Frank Rowand" <frowand.list@gmail.com>,
	linux-iio@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-mtd@lists.infradead.org, sparclinux@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-samsung-soc@vger.kernel.org, linux-clk@vger.kernel.org,
	linux-rockchip@lists.infradead.org, linux-media@vger.kernel.org,
	devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-gpio@vger.kernel.org, linux-mediatek@lists.infradead.org,
	linux-tegra@vger.kernel.org, linux-omap@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	"Ofir Drang" <ofir.drang@arm.com>,
	"Gilad Ben-Yossef" <gilad@benyossef.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	iommu@lists.linux-foundation.org, dmaengine@vger.kernel.org,
	freedreno@lists.freedesktop.org
Cc: linux-samsung-soc@vger.kernel.org, kbuild-all@lists.01.org,
	linux-iio@vger.kernel.org, netdev@vger.kernel.org,
	dri-devel@lists.freedesktop.org, linux-clk@vger.kernel.org,
	linux-rockchip@lists.infradead.org,
	linux-mtd@lists.infradead.org, Hadar Gat <hadar.gat@arm.com>,
	sparclinux@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-media@vger.kernel.org
Subject: Re: [PATCH v3] of_device: removed #include that caused a recursion in included headers
Date: Thu, 23 Apr 2020 13:27:31 +0800	[thread overview]
Message-ID: <202004231303.gnRgjLGr%lkp@intel.com> (raw)
In-Reply-To: <1587395080-15722-1-git-send-email-hadar.gat@arm.com>

[-- Attachment #1: Type: text/plain, Size: 16750 bytes --]

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@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@ti.com>
:::::: CC: Tero Kristo <t-kristo@ti.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 48658 bytes --]

[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

WARNING: multiple messages have this Message-ID (diff)
From: kbuild test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH v3] of_device: removed #include that caused a recursion in included headers
Date: Thu, 23 Apr 2020 13:27:31 +0800	[thread overview]
Message-ID: <202004231303.gnRgjLGr%lkp@intel.com> (raw)
In-Reply-To: <1587395080-15722-1-git-send-email-hadar.gat@arm.com>

[-- Attachment #1: Type: text/plain, Size: 17000 bytes --]

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@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@ti.com>
:::::: CC: Tero Kristo <t-kristo@ti.com>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 48658 bytes --]

  parent reply	other threads:[~2020-04-23  5:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-20 15:04 [PATCH v3] of_device: removed #include that caused a recursion in included headers Hadar Gat
2020-04-20 15:04 ` Hadar Gat
2020-04-20 15:04 ` Hadar Gat
2020-04-20 15:04 ` Hadar Gat
2020-04-20 15:04 ` Hadar Gat
2020-04-22 12:09 ` Liviu Dudau
2020-04-22 12:09   ` Liviu Dudau
2020-04-22 12:09   ` Liviu Dudau
2020-04-22 12:09   ` Liviu Dudau
2020-04-22 12:09   ` Liviu Dudau
2020-04-23  5:27 ` kbuild test robot [this message]
2020-04-23  5:27   ` kbuild test robot
2020-04-23  5:27   ` kbuild test robot
2020-04-23  5:27   ` kbuild test robot
2020-04-23  5:27   ` kbuild test robot
2020-04-23  5:27   ` kbuild test robot
2020-04-24 10:05 ` Lee Jones
2020-04-24 10:05   ` Lee Jones
2020-04-24 10:05   ` Lee Jones
2020-04-24 10:05   ` Lee Jones
2020-04-24 10:05   ` Lee Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202004231303.gnRgjLGr%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=agross@kernel.org \
    --cc=airlied@linux.ie \
    --cc=aisheng.dong@nxp.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=alexandre.torgue@st.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=daniel@ffwll.ch \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=festevam@gmail.com \
    --cc=freedreno@lists.freedesktop.org \
    --cc=frowand.list@gmail.com \
    --cc=gilad@benyossef.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hadar.gat@arm.com \
    --cc=heiko@sntech.de \
    --cc=hjc@rock-chips.com \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jckuo@nvidia.com \
    --cc=jic23@kernel.org \
    --cc=joabreu@synopsys.com \
    --cc=jonathanh@nvidia.com \
    --cc=joro@8bytes.org \
    --cc=kbuild-all@lists.01.org \
    --cc=kgene@kernel.org \
    --cc=kishon@ti.com \
    --cc=krzk@kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=linux-tegra@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=ludovic.desroches@microchip.com \
    --cc=matthias.bgg@gmail.com \
    --cc=mchehab@kernel.org \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=mripard@kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=ofir.drang@arm.com \
    --cc=p.zabel@pengutronix.de \
    --cc=peppe.cavallaro@st.com \
    --cc=richard@nod.at \
    --cc=robdclark@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=sboyd@kernel.org \
    --cc=sean@poorly.run \
    --cc=shawnguo@kernel.org \
    --cc=sparclinux@vger.kernel.org \
    --cc=stefan@agner.ch \
    --cc=sudeep.holla@arm.com \
    --cc=thierry.reding@gmail.com \
    --cc=tony@atomide.com \
    --cc=vigneshr@ti.com \
    --cc=vkoul@kernel.org \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.