[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230327180157.GC1882@sol.localdomain>
Date: Mon, 27 Mar 2023 11:01:57 -0700
From: Eric Biggers <ebiggers@...nel.org>
To: Abel Vesa <abel.vesa@...aro.org>
Cc: Ulf Hansson <ulf.hansson@...aro.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Andy Gross <agross@...nel.org>,
Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konrad.dybcio@...aro.org>,
Manivannan Sadhasivam <mani@...nel.org>,
Alim Akhtar <alim.akhtar@...sung.com>,
Avri Altman <avri.altman@....com>,
Bart Van Assche <bvanassche@....org>,
Adrian Hunter <adrian.hunter@...el.com>,
"James E . J . Bottomley" <jejb@...ux.ibm.com>,
"Martin K . Petersen" <martin.petersen@...cle.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
"David S . Miller" <davem@...emloft.net>,
linux-mmc@...r.kernel.org, devicetree@...r.kernel.org,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-arm-msm@...r.kernel.org, linux-crypto@...r.kernel.org,
linux-scsi@...r.kernel.org
Subject: Re: [PATCH v4 4/7] soc: qcom: Make the Qualcomm UFS/SDCC ICE a
dedicated driver
On Mon, Mar 27, 2023 at 04:47:31PM +0300, Abel Vesa wrote:
> + /* For now this driver only supports ICE version 3 and 4. */
> + if (major != 3 && major != 4) {
> + dev_warn(dev, "Unsupported ICE version: v%d.%d.%d\n",
> + major, minor, step);
> + return false;
> + }
Version 4 support was not in the original. This ought to be mentioned in the
commit message.
> +struct qcom_ice *of_qcom_ice_get(struct device *dev)
> +{
> + struct platform_device *pdev = to_platform_device(dev);
> + struct qcom_ice *ice = ERR_PTR(-EPROBE_DEFER);
> + struct device_node *node;
> + struct resource *res;
> + void __iomem *base;
> +
> + if (!dev || !dev->of_node)
> + return ERR_PTR(-ENODEV);
> +
> + /* legacy has ice reg range in the consumer DT node */
> + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ice");
> + if (res) {
> + base = devm_ioremap_resource(&pdev->dev, res);
> + if (IS_ERR(base))
> + return base;
> +
> + /* create ICE instance using consumer dev */
> + return qcom_ice_create(pdev, base);
> + }
> +
> + node = of_parse_phandle(dev->of_node, "qcom,ice", 0);
> + if (!node) {
> + ice = NULL;
> + goto out;
> + }
I think a longer comment in this code explaining the legacy implementation vs.
the new implementation would be helpful.
> + pdev = of_find_device_by_node(node);
> + if (!pdev) {
> + dev_err(dev, "Cannot find device node %s\n", node->name);
> + goto out;
> + }
It is hard to understand the return value in this case, since
'ice = ERR_PTR(-EPROBE_DEFER)' happens way above. Maybe do:
if (!pdev) {
dev_err(dev, "Cannot find device node %s\n", node->name);
ice = ERR_PTR(-EPROBE_DEFER);
goto out;
}
> +
> + ice = platform_get_drvdata(pdev);
> + if (!ice) {
> + dev_err(dev, "Cannot get ice\n");
> + put_device(&pdev->dev);
> + return ERR_PTR(-ENODEV);
> + }
Can this error message be more descriptive?
Otherwise this patch is looking good, thanks!
- Eric
Powered by blists - more mailing lists