]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
soc: qcom: geni-se: Refactor geni_icc_get() and make qup-memory ICC path optional
authorPraveen Talari <praveen.talari@oss.qualcomm.com>
Fri, 27 Feb 2026 06:15:32 +0000 (11:45 +0530)
committerBjorn Andersson <andersson@kernel.org>
Fri, 22 May 2026 02:56:37 +0000 (21:56 -0500)
The "qup-memory" interconnect path is optional and may not be defined
in all device trees. Unroll the loop-based ICC path initialization to
allow specific error handling for each path type.

The "qup-core" and "qup-config" paths remain mandatory and will fail
probe if missing, while "qup-memory" is now handled as optional and
skipped when not present in the device tree.

Co-developed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Praveen Talari <praveen.talari@oss.qualcomm.com>
Reviewed-by: Mukesh Kumar Savaliya <mukesh.savaliya@oss.qualcomm.com>
[...]
Tested-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
Link: https://lore.kernel.org/r/20260227061544.1785978-2-praveen.talari@oss.qualcomm.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
drivers/soc/qcom/qcom-geni-se.c

index cd1779b6a91a747016a7684d28a9c6a8767eaaf2..b6167b968ef60a16be074b386e0dfdeeba5dc321 100644 (file)
@@ -899,30 +899,32 @@ EXPORT_SYMBOL_GPL(geni_se_rx_dma_unprep);
 
 int geni_icc_get(struct geni_se *se, const char *icc_ddr)
 {
-       int i, err;
-       const char *icc_names[] = {"qup-core", "qup-config", icc_ddr};
+       struct geni_icc_path *icc_paths = se->icc_paths;
 
        if (has_acpi_companion(se->dev))
                return 0;
 
-       for (i = 0; i < ARRAY_SIZE(se->icc_paths); i++) {
-               if (!icc_names[i])
-                       continue;
-
-               se->icc_paths[i].path = devm_of_icc_get(se->dev, icc_names[i]);
-               if (IS_ERR(se->icc_paths[i].path))
-                       goto err;
+       icc_paths[GENI_TO_CORE].path = devm_of_icc_get(se->dev, "qup-core");
+       if (IS_ERR(icc_paths[GENI_TO_CORE].path))
+               return dev_err_probe(se->dev, PTR_ERR(icc_paths[GENI_TO_CORE].path),
+                                    "Failed to get 'qup-core' ICC path\n");
+
+       icc_paths[CPU_TO_GENI].path = devm_of_icc_get(se->dev, "qup-config");
+       if (IS_ERR(icc_paths[CPU_TO_GENI].path))
+               return dev_err_probe(se->dev, PTR_ERR(icc_paths[CPU_TO_GENI].path),
+                                    "Failed to get 'qup-config' ICC path\n");
+
+       /* The DDR path is optional, depending on protocol and hw capabilities */
+       icc_paths[GENI_TO_DDR].path = devm_of_icc_get(se->dev, "qup-memory");
+       if (IS_ERR(icc_paths[GENI_TO_DDR].path)) {
+               if (PTR_ERR(icc_paths[GENI_TO_DDR].path) == -ENODATA)
+                       icc_paths[GENI_TO_DDR].path = NULL;
+               else
+                       return dev_err_probe(se->dev, PTR_ERR(icc_paths[GENI_TO_DDR].path),
+                                            "Failed to get 'qup-memory' ICC path\n");
        }
 
        return 0;
-
-err:
-       err = PTR_ERR(se->icc_paths[i].path);
-       if (err != -EPROBE_DEFER)
-               dev_err_ratelimited(se->dev, "Failed to get ICC path '%s': %d\n",
-                                       icc_names[i], err);
-       return err;
-
 }
 EXPORT_SYMBOL_GPL(geni_icc_get);