[PATCH] qcom: ice: Remove ice probe

Seshu Madhavi Puppala posted 1 patch 2 months ago
drivers/soc/qcom/ice.c | 44 +++++++-----------------------------------
1 file changed, 7 insertions(+), 37 deletions(-)
[PATCH] qcom: ice: Remove ice probe
Posted by Seshu Madhavi Puppala 2 months ago
Under JEDEC specification ICE IP is tightly
coupled with Storage. Qualcomm vendor HW
implementation also ties the clock and power
supply for ICE to corresponding storage clock and
supplies. For a SoC supporting multiple storage
types like UFS and eMMC the ICE physical address
space is not shared and is always part of
corresponding storage physical address space
hence there is no need to independently probe ICE.

Cleanup commit 2afbf43a4aec ("soc: qcom: Make
the Qualcomm UFS/SDCC ICE a dedicated driver")
to remove dedicated ICE probe since there is no
dedicated ICE IP block shared between UFS and
SDCC as mentioned in 2afbf43a4aec.

Storage probe will check for the corresponding
ICE node by using of_qcom_ice_get to get ICE
instance. Additional support added to
of_qcom_ice_get to support ICE instance creation
with new approach. Backward compatibility with
old style device tree approach is untouched.

Signed-off-by: Seshu Madhavi Puppala <quic_spuppala@quicinc.com>
---
 drivers/soc/qcom/ice.c | 44 +++++++-----------------------------------
 1 file changed, 7 insertions(+), 37 deletions(-)

diff --git a/drivers/soc/qcom/ice.c b/drivers/soc/qcom/ice.c
index fbab7fe5c652..47f1b668dc86 100644
--- a/drivers/soc/qcom/ice.c
+++ b/drivers/soc/qcom/ice.c
@@ -303,7 +303,13 @@ struct qcom_ice *of_qcom_ice_get(struct device *dev)
 		goto out;
 	}
 
-	ice = platform_get_drvdata(pdev);
+	base = devm_platform_ioremap_resource(pdev, 0);
+	if (IS_ERR(base)) {
+		dev_warn(&pdev->dev, "ICE registers not found\n");
+		return PTR_ERR(base);
+	}
+
+	ice = qcom_ice_create(&pdev->dev, base);
 	if (!ice) {
 		dev_err(dev, "Cannot get ice instance from %s\n",
 			dev_name(&pdev->dev));
@@ -328,41 +334,5 @@ struct qcom_ice *of_qcom_ice_get(struct device *dev)
 }
 EXPORT_SYMBOL_GPL(of_qcom_ice_get);
 
-static int qcom_ice_probe(struct platform_device *pdev)
-{
-	struct qcom_ice *engine;
-	void __iomem *base;
-
-	base = devm_platform_ioremap_resource(pdev, 0);
-	if (IS_ERR(base)) {
-		dev_warn(&pdev->dev, "ICE registers not found\n");
-		return PTR_ERR(base);
-	}
-
-	engine = qcom_ice_create(&pdev->dev, base);
-	if (IS_ERR(engine))
-		return PTR_ERR(engine);
-
-	platform_set_drvdata(pdev, engine);
-
-	return 0;
-}
-
-static const struct of_device_id qcom_ice_of_match_table[] = {
-	{ .compatible = "qcom,inline-crypto-engine" },
-	{ },
-};
-MODULE_DEVICE_TABLE(of, qcom_ice_of_match_table);
-
-static struct platform_driver qcom_ice_driver = {
-	.probe	= qcom_ice_probe,
-	.driver = {
-		.name = "qcom-ice",
-		.of_match_table = qcom_ice_of_match_table,
-	},
-};
-
-module_platform_driver(qcom_ice_driver);
-
 MODULE_DESCRIPTION("Qualcomm Inline Crypto Engine driver");
 MODULE_LICENSE("GPL");
-- 
2.17.1
Re: [PATCH] qcom: ice: Remove ice probe
Posted by Bjorn Andersson 1 month, 4 weeks ago
On Sat, Sep 28, 2024 at 10:34:56AM GMT, Seshu Madhavi Puppala wrote:
> Under JEDEC specification ICE IP is tightly
> coupled with Storage. Qualcomm vendor HW
> implementation also ties the clock and power
> supply for ICE to corresponding storage clock and
> supplies. For a SoC supporting multiple storage
> types like UFS and eMMC the ICE physical address
> space is not shared and is always part of
> corresponding storage physical address space
> hence there is no need to independently probe ICE.
> 

So, you're effectively saying that commit 2afbf43a4aec got system design
wrong, and it should never have been a dedicated device?

I presume this would be easy to spot, as there would be platforms with
multiple ICE device nodes...


If so, write that clearly and make sure you make sure that the author of
that change is among the addressed people in your patch.

> Cleanup commit 2afbf43a4aec ("soc: qcom: Make
> the Qualcomm UFS/SDCC ICE a dedicated driver")
> to remove dedicated ICE probe since there is no
> dedicated ICE IP block shared between UFS and
> SDCC as mentioned in 2afbf43a4aec.
> 
> Storage probe will check for the corresponding
> ICE node by using of_qcom_ice_get to get ICE
> instance. Additional support added to
> of_qcom_ice_get to support ICE instance creation
> with new approach. Backward compatibility with
> old style device tree approach is untouched.
> 

Add () suffix to function names, to make it clear that they are
functions.


Also, please read and follow:
https://docs.kernel.org/process/submitting-patches.html#the-canonical-patch-format

> Signed-off-by: Seshu Madhavi Puppala <quic_spuppala@quicinc.com>
> ---
>  drivers/soc/qcom/ice.c | 44 +++++++-----------------------------------
>  1 file changed, 7 insertions(+), 37 deletions(-)
> 
> diff --git a/drivers/soc/qcom/ice.c b/drivers/soc/qcom/ice.c
> index fbab7fe5c652..47f1b668dc86 100644
> --- a/drivers/soc/qcom/ice.c
> +++ b/drivers/soc/qcom/ice.c
> @@ -303,7 +303,13 @@ struct qcom_ice *of_qcom_ice_get(struct device *dev)
>  		goto out;
>  	}
>  
> -	ice = platform_get_drvdata(pdev);
> +	base = devm_platform_ioremap_resource(pdev, 0);

So pdev here is the returned value of of_find_device_by_node() which
refers to a platform_device which now will never find a matching driver.
So no one will ever free this...

> +	if (IS_ERR(base)) {
> +		dev_warn(&pdev->dev, "ICE registers not found\n");

That's just one of the possible error cases. And iirc
devm_platform_ioremap_resource() already did print. Please double check
and update this accordingly.

> +		return PTR_ERR(base);
> +	}
> +
> +	ice = qcom_ice_create(&pdev->dev, base);

This too will now allocate resources on a struct device that doesn't
have a driver and hence will never materialize - or clean up the devres
resources.

Regards,
Bjorn

>  	if (!ice) {
>  		dev_err(dev, "Cannot get ice instance from %s\n",
>  			dev_name(&pdev->dev));
> @@ -328,41 +334,5 @@ struct qcom_ice *of_qcom_ice_get(struct device *dev)
>  }
>  EXPORT_SYMBOL_GPL(of_qcom_ice_get);
>  
> -static int qcom_ice_probe(struct platform_device *pdev)
> -{
> -	struct qcom_ice *engine;
> -	void __iomem *base;
> -
> -	base = devm_platform_ioremap_resource(pdev, 0);
> -	if (IS_ERR(base)) {
> -		dev_warn(&pdev->dev, "ICE registers not found\n");
> -		return PTR_ERR(base);
> -	}
> -
> -	engine = qcom_ice_create(&pdev->dev, base);
> -	if (IS_ERR(engine))
> -		return PTR_ERR(engine);
> -
> -	platform_set_drvdata(pdev, engine);
> -
> -	return 0;
> -}
> -
> -static const struct of_device_id qcom_ice_of_match_table[] = {
> -	{ .compatible = "qcom,inline-crypto-engine" },
> -	{ },
> -};
> -MODULE_DEVICE_TABLE(of, qcom_ice_of_match_table);
> -
> -static struct platform_driver qcom_ice_driver = {
> -	.probe	= qcom_ice_probe,
> -	.driver = {
> -		.name = "qcom-ice",
> -		.of_match_table = qcom_ice_of_match_table,
> -	},
> -};
> -
> -module_platform_driver(qcom_ice_driver);
> -
>  MODULE_DESCRIPTION("Qualcomm Inline Crypto Engine driver");
>  MODULE_LICENSE("GPL");
> -- 
> 2.17.1
>
Re: [PATCH] qcom: ice: Remove ice probe
Posted by kernel test robot 1 month, 4 weeks ago
Hi Seshu,

kernel test robot noticed the following build warnings:

[auto build test WARNING on v6.11]
[also build test WARNING on next-20240930]
[cannot apply to linus/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Seshu-Madhavi-Puppala/qcom-ice-Remove-ice-probe/20240928-130818
base:   v6.11
patch link:    https://lore.kernel.org/r/20240928050456.27577-1-quic_spuppala%40quicinc.com
patch subject: [PATCH] qcom: ice: Remove ice probe
config: arc-randconfig-r122-20241001 (https://download.01.org/0day-ci/archive/20241001/202410011021.Lr5B1w7F-lkp@intel.com/config)
compiler: arc-elf-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20241001/202410011021.Lr5B1w7F-lkp@intel.com/reproduce)

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

sparse warnings: (new ones prefixed by >>)
>> drivers/soc/qcom/ice.c:309:31: sparse: sparse: incorrect type in return expression (different base types) @@     expected struct qcom_ice * @@     got long @@
   drivers/soc/qcom/ice.c:309:31: sparse:     expected struct qcom_ice *
   drivers/soc/qcom/ice.c:309:31: sparse:     got long
   drivers/soc/qcom/ice.c: note: in included file (through include/linux/mmzone.h, include/linux/gfp.h, include/linux/xarray.h, ...):
   include/linux/page-flags.h:235:46: sparse: sparse: self-comparison always evaluates to false
   include/linux/page-flags.h:235:46: sparse: sparse: self-comparison always evaluates to false

vim +309 drivers/soc/qcom/ice.c

   250	
   251	/**
   252	 * of_qcom_ice_get() - get an ICE instance from a DT node
   253	 * @dev: device pointer for the consumer device
   254	 *
   255	 * This function will provide an ICE instance either by creating one for the
   256	 * consumer device if its DT node provides the 'ice' reg range and the 'ice'
   257	 * clock (for legacy DT style). On the other hand, if consumer provides a
   258	 * phandle via 'qcom,ice' property to an ICE DT, the ICE instance will already
   259	 * be created and so this function will return that instead.
   260	 *
   261	 * Return: ICE pointer on success, NULL if there is no ICE data provided by the
   262	 * consumer or ERR_PTR() on error.
   263	 */
   264	struct qcom_ice *of_qcom_ice_get(struct device *dev)
   265	{
   266		struct platform_device *pdev = to_platform_device(dev);
   267		struct qcom_ice *ice;
   268		struct device_node *node;
   269		struct resource *res;
   270		void __iomem *base;
   271	
   272		if (!dev || !dev->of_node)
   273			return ERR_PTR(-ENODEV);
   274	
   275		/*
   276		 * In order to support legacy style devicetree bindings, we need
   277		 * to create the ICE instance using the consumer device and the reg
   278		 * range called 'ice' it provides.
   279		 */
   280		res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ice");
   281		if (res) {
   282			base = devm_ioremap_resource(&pdev->dev, res);
   283			if (IS_ERR(base))
   284				return ERR_CAST(base);
   285	
   286			/* create ICE instance using consumer dev */
   287			return qcom_ice_create(&pdev->dev, base);
   288		}
   289	
   290		/*
   291		 * If the consumer node does not provider an 'ice' reg range
   292		 * (legacy DT binding), then it must at least provide a phandle
   293		 * to the ICE devicetree node, otherwise ICE is not supported.
   294		 */
   295		node = of_parse_phandle(dev->of_node, "qcom,ice", 0);
   296		if (!node)
   297			return NULL;
   298	
   299		pdev = of_find_device_by_node(node);
   300		if (!pdev) {
   301			dev_err(dev, "Cannot find device node %s\n", node->name);
   302			ice = ERR_PTR(-EPROBE_DEFER);
   303			goto out;
   304		}
   305	
   306		base = devm_platform_ioremap_resource(pdev, 0);
   307		if (IS_ERR(base)) {
   308			dev_warn(&pdev->dev, "ICE registers not found\n");
 > 309			return PTR_ERR(base);
   310		}
   311	
   312		ice = qcom_ice_create(&pdev->dev, base);
   313		if (!ice) {
   314			dev_err(dev, "Cannot get ice instance from %s\n",
   315				dev_name(&pdev->dev));
   316			platform_device_put(pdev);
   317			ice = ERR_PTR(-EPROBE_DEFER);
   318			goto out;
   319		}
   320	
   321		ice->link = device_link_add(dev, &pdev->dev, DL_FLAG_AUTOREMOVE_SUPPLIER);
   322		if (!ice->link) {
   323			dev_err(&pdev->dev,
   324				"Failed to create device link to consumer %s\n",
   325				dev_name(dev));
   326			platform_device_put(pdev);
   327			ice = ERR_PTR(-EINVAL);
   328		}
   329	
   330	out:
   331		of_node_put(node);
   332	
   333		return ice;
   334	}
   335	EXPORT_SYMBOL_GPL(of_qcom_ice_get);
   336	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Re: [PATCH] qcom: ice: Remove ice probe
Posted by kernel test robot 2 months ago
Hi Seshu,

kernel test robot noticed the following build warnings:

[auto build test WARNING on v6.11]
[also build test WARNING on next-20240927]
[cannot apply to linus/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Seshu-Madhavi-Puppala/qcom-ice-Remove-ice-probe/20240928-130818
base:   v6.11
patch link:    https://lore.kernel.org/r/20240928050456.27577-1-quic_spuppala%40quicinc.com
patch subject: [PATCH] qcom: ice: Remove ice probe
config: arc-allyesconfig (https://download.01.org/0day-ci/archive/20240929/202409290409.BkBQ6BVX-lkp@intel.com/config)
compiler: arceb-elf-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240929/202409290409.BkBQ6BVX-lkp@intel.com/reproduce)

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

All warnings (new ones prefixed by >>):

   drivers/soc/qcom/ice.c: In function 'of_qcom_ice_get':
>> drivers/soc/qcom/ice.c:309:24: warning: returning 'long int' from a function with return type 'struct qcom_ice *' makes pointer from integer without a cast [-Wint-conversion]
     309 |                 return PTR_ERR(base);
         |                        ^~~~~~~~~~~~~


vim +309 drivers/soc/qcom/ice.c

   250	
   251	/**
   252	 * of_qcom_ice_get() - get an ICE instance from a DT node
   253	 * @dev: device pointer for the consumer device
   254	 *
   255	 * This function will provide an ICE instance either by creating one for the
   256	 * consumer device if its DT node provides the 'ice' reg range and the 'ice'
   257	 * clock (for legacy DT style). On the other hand, if consumer provides a
   258	 * phandle via 'qcom,ice' property to an ICE DT, the ICE instance will already
   259	 * be created and so this function will return that instead.
   260	 *
   261	 * Return: ICE pointer on success, NULL if there is no ICE data provided by the
   262	 * consumer or ERR_PTR() on error.
   263	 */
   264	struct qcom_ice *of_qcom_ice_get(struct device *dev)
   265	{
   266		struct platform_device *pdev = to_platform_device(dev);
   267		struct qcom_ice *ice;
   268		struct device_node *node;
   269		struct resource *res;
   270		void __iomem *base;
   271	
   272		if (!dev || !dev->of_node)
   273			return ERR_PTR(-ENODEV);
   274	
   275		/*
   276		 * In order to support legacy style devicetree bindings, we need
   277		 * to create the ICE instance using the consumer device and the reg
   278		 * range called 'ice' it provides.
   279		 */
   280		res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ice");
   281		if (res) {
   282			base = devm_ioremap_resource(&pdev->dev, res);
   283			if (IS_ERR(base))
   284				return ERR_CAST(base);
   285	
   286			/* create ICE instance using consumer dev */
   287			return qcom_ice_create(&pdev->dev, base);
   288		}
   289	
   290		/*
   291		 * If the consumer node does not provider an 'ice' reg range
   292		 * (legacy DT binding), then it must at least provide a phandle
   293		 * to the ICE devicetree node, otherwise ICE is not supported.
   294		 */
   295		node = of_parse_phandle(dev->of_node, "qcom,ice", 0);
   296		if (!node)
   297			return NULL;
   298	
   299		pdev = of_find_device_by_node(node);
   300		if (!pdev) {
   301			dev_err(dev, "Cannot find device node %s\n", node->name);
   302			ice = ERR_PTR(-EPROBE_DEFER);
   303			goto out;
   304		}
   305	
   306		base = devm_platform_ioremap_resource(pdev, 0);
   307		if (IS_ERR(base)) {
   308			dev_warn(&pdev->dev, "ICE registers not found\n");
 > 309			return PTR_ERR(base);
   310		}
   311	
   312		ice = qcom_ice_create(&pdev->dev, base);
   313		if (!ice) {
   314			dev_err(dev, "Cannot get ice instance from %s\n",
   315				dev_name(&pdev->dev));
   316			platform_device_put(pdev);
   317			ice = ERR_PTR(-EPROBE_DEFER);
   318			goto out;
   319		}
   320	
   321		ice->link = device_link_add(dev, &pdev->dev, DL_FLAG_AUTOREMOVE_SUPPLIER);
   322		if (!ice->link) {
   323			dev_err(&pdev->dev,
   324				"Failed to create device link to consumer %s\n",
   325				dev_name(dev));
   326			platform_device_put(pdev);
   327			ice = ERR_PTR(-EINVAL);
   328		}
   329	
   330	out:
   331		of_node_put(node);
   332	
   333		return ice;
   334	}
   335	EXPORT_SYMBOL_GPL(of_qcom_ice_get);
   336	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Re: [PATCH] qcom: ice: Remove ice probe
Posted by kernel test robot 2 months ago
Hi Seshu,

kernel test robot noticed the following build errors:

[auto build test ERROR on v6.11]
[also build test ERROR on next-20240927]
[cannot apply to linus/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Seshu-Madhavi-Puppala/qcom-ice-Remove-ice-probe/20240928-130818
base:   v6.11
patch link:    https://lore.kernel.org/r/20240928050456.27577-1-quic_spuppala%40quicinc.com
patch subject: [PATCH] qcom: ice: Remove ice probe
config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20240929/202409290335.0ctcBH8j-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240929/202409290335.0ctcBH8j-lkp@intel.com/reproduce)

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

All errors (new ones prefixed by >>):

   drivers/soc/qcom/ice.c: In function 'of_qcom_ice_get':
>> drivers/soc/qcom/ice.c:309:24: error: returning 'long int' from a function with return type 'struct qcom_ice *' makes pointer from integer without a cast [-Wint-conversion]
     309 |                 return PTR_ERR(base);
         |                        ^~~~~~~~~~~~~


vim +309 drivers/soc/qcom/ice.c

   250	
   251	/**
   252	 * of_qcom_ice_get() - get an ICE instance from a DT node
   253	 * @dev: device pointer for the consumer device
   254	 *
   255	 * This function will provide an ICE instance either by creating one for the
   256	 * consumer device if its DT node provides the 'ice' reg range and the 'ice'
   257	 * clock (for legacy DT style). On the other hand, if consumer provides a
   258	 * phandle via 'qcom,ice' property to an ICE DT, the ICE instance will already
   259	 * be created and so this function will return that instead.
   260	 *
   261	 * Return: ICE pointer on success, NULL if there is no ICE data provided by the
   262	 * consumer or ERR_PTR() on error.
   263	 */
   264	struct qcom_ice *of_qcom_ice_get(struct device *dev)
   265	{
   266		struct platform_device *pdev = to_platform_device(dev);
   267		struct qcom_ice *ice;
   268		struct device_node *node;
   269		struct resource *res;
   270		void __iomem *base;
   271	
   272		if (!dev || !dev->of_node)
   273			return ERR_PTR(-ENODEV);
   274	
   275		/*
   276		 * In order to support legacy style devicetree bindings, we need
   277		 * to create the ICE instance using the consumer device and the reg
   278		 * range called 'ice' it provides.
   279		 */
   280		res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ice");
   281		if (res) {
   282			base = devm_ioremap_resource(&pdev->dev, res);
   283			if (IS_ERR(base))
   284				return ERR_CAST(base);
   285	
   286			/* create ICE instance using consumer dev */
   287			return qcom_ice_create(&pdev->dev, base);
   288		}
   289	
   290		/*
   291		 * If the consumer node does not provider an 'ice' reg range
   292		 * (legacy DT binding), then it must at least provide a phandle
   293		 * to the ICE devicetree node, otherwise ICE is not supported.
   294		 */
   295		node = of_parse_phandle(dev->of_node, "qcom,ice", 0);
   296		if (!node)
   297			return NULL;
   298	
   299		pdev = of_find_device_by_node(node);
   300		if (!pdev) {
   301			dev_err(dev, "Cannot find device node %s\n", node->name);
   302			ice = ERR_PTR(-EPROBE_DEFER);
   303			goto out;
   304		}
   305	
   306		base = devm_platform_ioremap_resource(pdev, 0);
   307		if (IS_ERR(base)) {
   308			dev_warn(&pdev->dev, "ICE registers not found\n");
 > 309			return PTR_ERR(base);
   310		}
   311	
   312		ice = qcom_ice_create(&pdev->dev, base);
   313		if (!ice) {
   314			dev_err(dev, "Cannot get ice instance from %s\n",
   315				dev_name(&pdev->dev));
   316			platform_device_put(pdev);
   317			ice = ERR_PTR(-EPROBE_DEFER);
   318			goto out;
   319		}
   320	
   321		ice->link = device_link_add(dev, &pdev->dev, DL_FLAG_AUTOREMOVE_SUPPLIER);
   322		if (!ice->link) {
   323			dev_err(&pdev->dev,
   324				"Failed to create device link to consumer %s\n",
   325				dev_name(dev));
   326			platform_device_put(pdev);
   327			ice = ERR_PTR(-EINVAL);
   328		}
   329	
   330	out:
   331		of_node_put(node);
   332	
   333		return ice;
   334	}
   335	EXPORT_SYMBOL_GPL(of_qcom_ice_get);
   336	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Re: [PATCH] qcom: ice: Remove ice probe
Posted by kernel test robot 2 months ago
Hi Seshu,

kernel test robot noticed the following build errors:

[auto build test ERROR on v6.11]
[also build test ERROR on next-20240927]
[cannot apply to linus/master]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Seshu-Madhavi-Puppala/qcom-ice-Remove-ice-probe/20240928-130818
base:   v6.11
patch link:    https://lore.kernel.org/r/20240928050456.27577-1-quic_spuppala%40quicinc.com
patch subject: [PATCH] qcom: ice: Remove ice probe
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20240929/202409290321.quE8sBb5-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240929/202409290321.quE8sBb5-lkp@intel.com/reproduce)

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

All errors (new ones prefixed by >>):

>> drivers/soc/qcom/ice.c:309:10: error: incompatible integer to pointer conversion returning 'long' from a function with result type 'struct qcom_ice *' [-Wint-conversion]
     309 |                 return PTR_ERR(base);
         |                        ^~~~~~~~~~~~~
   1 error generated.


vim +309 drivers/soc/qcom/ice.c

   250	
   251	/**
   252	 * of_qcom_ice_get() - get an ICE instance from a DT node
   253	 * @dev: device pointer for the consumer device
   254	 *
   255	 * This function will provide an ICE instance either by creating one for the
   256	 * consumer device if its DT node provides the 'ice' reg range and the 'ice'
   257	 * clock (for legacy DT style). On the other hand, if consumer provides a
   258	 * phandle via 'qcom,ice' property to an ICE DT, the ICE instance will already
   259	 * be created and so this function will return that instead.
   260	 *
   261	 * Return: ICE pointer on success, NULL if there is no ICE data provided by the
   262	 * consumer or ERR_PTR() on error.
   263	 */
   264	struct qcom_ice *of_qcom_ice_get(struct device *dev)
   265	{
   266		struct platform_device *pdev = to_platform_device(dev);
   267		struct qcom_ice *ice;
   268		struct device_node *node;
   269		struct resource *res;
   270		void __iomem *base;
   271	
   272		if (!dev || !dev->of_node)
   273			return ERR_PTR(-ENODEV);
   274	
   275		/*
   276		 * In order to support legacy style devicetree bindings, we need
   277		 * to create the ICE instance using the consumer device and the reg
   278		 * range called 'ice' it provides.
   279		 */
   280		res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ice");
   281		if (res) {
   282			base = devm_ioremap_resource(&pdev->dev, res);
   283			if (IS_ERR(base))
   284				return ERR_CAST(base);
   285	
   286			/* create ICE instance using consumer dev */
   287			return qcom_ice_create(&pdev->dev, base);
   288		}
   289	
   290		/*
   291		 * If the consumer node does not provider an 'ice' reg range
   292		 * (legacy DT binding), then it must at least provide a phandle
   293		 * to the ICE devicetree node, otherwise ICE is not supported.
   294		 */
   295		node = of_parse_phandle(dev->of_node, "qcom,ice", 0);
   296		if (!node)
   297			return NULL;
   298	
   299		pdev = of_find_device_by_node(node);
   300		if (!pdev) {
   301			dev_err(dev, "Cannot find device node %s\n", node->name);
   302			ice = ERR_PTR(-EPROBE_DEFER);
   303			goto out;
   304		}
   305	
   306		base = devm_platform_ioremap_resource(pdev, 0);
   307		if (IS_ERR(base)) {
   308			dev_warn(&pdev->dev, "ICE registers not found\n");
 > 309			return PTR_ERR(base);
   310		}
   311	
   312		ice = qcom_ice_create(&pdev->dev, base);
   313		if (!ice) {
   314			dev_err(dev, "Cannot get ice instance from %s\n",
   315				dev_name(&pdev->dev));
   316			platform_device_put(pdev);
   317			ice = ERR_PTR(-EPROBE_DEFER);
   318			goto out;
   319		}
   320	
   321		ice->link = device_link_add(dev, &pdev->dev, DL_FLAG_AUTOREMOVE_SUPPLIER);
   322		if (!ice->link) {
   323			dev_err(&pdev->dev,
   324				"Failed to create device link to consumer %s\n",
   325				dev_name(dev));
   326			platform_device_put(pdev);
   327			ice = ERR_PTR(-EINVAL);
   328		}
   329	
   330	out:
   331		of_node_put(node);
   332	
   333		return ice;
   334	}
   335	EXPORT_SYMBOL_GPL(of_qcom_ice_get);
   336	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki