Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

spi: geni-qcom: Improve target mode allocation by using proper allocation functions

The current implementation always allocates a host controller and sets the
target flag later when the "spi-slave" device tree property is present.
This approach is suboptimal as it doesn't utilize the dedicated allocation
functions designed for target mode.

Use devm_spi_alloc_target() when "spi-slave" device tree property is
present, otherwise use devm_spi_alloc_host(). This replaces the previous
approach of always allocating a host controller and setting target flag
later.

Signed-off-by: Praveen Talari <praveen.talari@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Link: https://patch.msgid.link/20260204162854.1206323-2-praveen.talari@oss.qualcomm.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Praveen Talari and committed by
Mark Brown
50464497 4cc4ace7

+5 -4
+5 -4
drivers/spi/spi-geni-qcom.c
··· 1033 1033 if (IS_ERR(clk)) 1034 1034 return PTR_ERR(clk); 1035 1035 1036 - spi = devm_spi_alloc_host(dev, sizeof(*mas)); 1036 + if (device_property_read_bool(dev, "spi-slave")) 1037 + spi = devm_spi_alloc_target(dev, sizeof(*mas)); 1038 + else 1039 + spi = devm_spi_alloc_host(dev, sizeof(*mas)); 1040 + 1037 1041 if (!spi) 1038 1042 return -ENOMEM; 1039 1043 ··· 1090 1086 ret = devm_pm_runtime_enable(dev); 1091 1087 if (ret) 1092 1088 return ret; 1093 - 1094 - if (device_property_read_bool(&pdev->dev, "spi-slave")) 1095 - spi->target = true; 1096 1089 1097 1090 /* Set the bus quota to a reasonable value for register access */ 1098 1091 mas->se.icc_paths[GENI_TO_CORE].avg_bw = Bps_to_icc(CORE_2X_50_MHZ);