From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0B19D314A80 for ; Wed, 28 Jan 2026 16:32:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769617944; cv=none; b=Gw9H92xweBzpUwrjFJ1eiq0AAVKcuzS5qqdkyG4F+D0G+8B9tTp7zr7dP4Q/1PlfUbbg6seokPS2Buc3jg4rHsdh883So2Ii7ECOihRKlkG2iiqPHsG/TAWA7Ab3j+P2uDJ6v2RGx4QamE2tyUj59U+k36R7vQRGnf4243ONfn0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769617944; c=relaxed/simple; bh=2KVyNWIkQkrJdqOphMJW7+jbP6BykNPtdq1SsqqypFk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=GdUDIN4g/BJyFguOthrhTVHzFVd2ZKvp2NZlZgqJN2dVJcSEjPBRSdSrme6YLjxn7adsmveVeE1u0c+Eu2Bwzp+nEgGEhU1TUkBYCcJykrd1EXyvSJufbP/+gOjMCU7dopR0KQ1xoiGvJc4oZXXP0jduTyUmN11qdN0PNKB54XE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=KE04ZKZD; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=QQXk30A1; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="KE04ZKZD"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="QQXk30A1" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60SFWhDo3442499 for ; Wed, 28 Jan 2026 16:32:22 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= gTot7wm8bc+eEGywtGKUdiOEeratq7Vt53Auj5Idu/M=; b=KE04ZKZD87/3s+sp CFJGOZmev+/yZjW+OoM66B8XoltEuIn0k9XJU57RQlo9XqW9dazjEZLxncMlHNSn oXOa1wm7nuULjY8aTLuPJ4J2OEPsCSYvCMc6JfL0/BxXo0TdM1A2+bypuk0zVnvK ttzl++jLL2jF8sAXM5Zt4HOKNtEPtWu1mfcEVOiVRc4KlGK0BLAvJZwjHA1ggU5G xX1nQnvBlAWsOb1OZ7lov7z5NPqOeMpaPagagh5wFbBmBuAaupWXah1/W7VpJo0/ 7YjtS8daarDQrnWGZl/pIG2X7pCbs01FtS5SeLfxLyvRho0T1Sndk6rEJ33zaH9P CpJ8Tg== Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4byanajhy2-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Wed, 28 Jan 2026 16:32:22 +0000 (GMT) Received: by mail-pg1-f199.google.com with SMTP id 41be03b00d2f7-c52d37d346dso3793023a12.3 for ; Wed, 28 Jan 2026 08:32:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1769617941; x=1770222741; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=gTot7wm8bc+eEGywtGKUdiOEeratq7Vt53Auj5Idu/M=; b=QQXk30A1HlS2XcqSV4S/EDELIaVepkJC15Ghhd1LQ6r/UZvOX5xiiW03foJOkwqP9B zBzFdvXwG6QEd3JWhyvYT42V8ddKed/3gvPe2gQ/A4/JspVQXKswk97hZzjgWG8tlwdj 4Y2I+qEnV1V/Vs15SXyKOQyvqRUOIKPnQ/dPv+HoDlHs18dcoGCg8//xAHy4w397jnkh hdS54BD/TA4THGCT36DpthtjaPJqM9NjH323F0Nu5zqAOJdijcyfJC6pPbwXHvGQz2H5 ZejYeyXnoaaiKVZnEdopCj8mBaKvl8j+zPt+wsfxay67gOFNGcQCssI2aRo/ojvpC9VM AqBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769617941; x=1770222741; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=gTot7wm8bc+eEGywtGKUdiOEeratq7Vt53Auj5Idu/M=; b=O8gzwl+bIdqQBqyh1/DbEpBiVwqYpZZQqPdf/fkpTu6CZU61yLHPCJUGq7pirWVcR4 TzI7GKAILI6GIJS5mD4AZaxdHKeNLZnQFD81lnIs6cHn8uC6aZWOBDPqKZXMId0BplY6 DPCZPm5O6hJjX+lPAQ4TN13ni+X0owMSVFzwlG15QXnkQ/5SmBJfGp/7H3UOiHpkFFNG f/HfaqmNGjW2C+TLJLdcWXTpYl+4syqRgERl+HObrBaAmPw3ikq4gV8pxR0Fl9GhFYby eI+rI1+dfreBvTL8cV/5muLAuroEohnBQf1/1d+wtitmCzXj5fkLFYOb6KNZM2lzgzOR 3O6g== X-Forwarded-Encrypted: i=1; AJvYcCXQtA/64kjMUKEkqG0RnwyPeJdfesbUa+L1bLLUUCP985VJH9MC7+7sAVUHdKxbsQlP7qfBJi4TPJiWooDh@vger.kernel.org X-Gm-Message-State: AOJu0YwEjDwvKUmubGGq1/6HgJtUOak7A8ky9MNzB5t2p6iptmguKDgg s18xmEH0ZMHXnR0f4rCw4ItNpCBY6RTu/r6Mpghl9DALESvGf/g4eVX27igZ7N/jGP0XGLqTM8p przDnYUJ9GkbjOMzVRGcgjXe6LvzLQ42wDvuH6qU7fG6Ulo/owXu/W/ZsvRe6ERfboajG X-Gm-Gg: AZuq6aJcpkkOeDLKLF/faHu1//R1iuwU0OOJyBQzd3YvJuxqHJdxFegBro0jxE1U7mp PohLFuL5DILhfFCvmBQlOpOWqDXcZdm6I/QXp0gBtB/GEfqAirsdmpIIPQV0JnXIiPKRC4TyWV2 oQK/cgdsgNXScSMEdsuij7R6MQzVppvTOiJE+/XdMhwKBQcr3eyt3//DJGW4aoxx0bPavuhjbNz TytUI8NVS9r8Y1t6snMO+UfngtruyJnni0eyfCPqt0Ngcqs0pcaCPjGXOn7om9y5hVg6XMoqj6n ufgf6mAQfENx49zJubiv9Gcie1UDbcL3+Hug+sTMOWPvjttYQswS7/ERV2Nf0z+Hlo/nSfozNHB khRgg04nfNxckKLtikV/iNURImWp7O5a9uyMyINtb0A== X-Received: by 2002:a05:6a21:2e02:b0:38e:9e4c:ed5c with SMTP id adf61e73a8af0-38ec64052c4mr5152074637.52.1769617941492; Wed, 28 Jan 2026 08:32:21 -0800 (PST) X-Received: by 2002:a05:6a21:2e02:b0:38e:9e4c:ed5c with SMTP id adf61e73a8af0-38ec64052c4mr5152041637.52.1769617940901; Wed, 28 Jan 2026 08:32:20 -0800 (PST) Received: from [192.168.1.2] ([49.204.110.251]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-c642a33607esm2647671a12.23.2026.01.28.08.32.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 28 Jan 2026 08:32:20 -0800 (PST) Message-ID: Date: Wed, 28 Jan 2026 22:02:14 +0530 Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 1/3] spi: geni-qcom: Improve target mode allocation by using proper allocation functions To: Konrad Dybcio , Mark Brown , linux-arm-msm@vger.kernel.org, linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, bjorn.andersson@oss.qualcomm.com, dmitry.baryshkov@oss.qualcomm.com Cc: prasad.sodagudi@oss.qualcomm.com, mukesh.savaliya@oss.qualcomm.com, quic_vtanuku@quicinc.com, aniket.randive@oss.qualcomm.com, chandana.chiluveru@oss.qualcomm.com, jyothi.seerapu@oss.qualcomm.com References: <20260122151008.2149252-1-praveen.talari@oss.qualcomm.com> <20260122151008.2149252-2-praveen.talari@oss.qualcomm.com> <847290c3-d5aa-45cf-a75b-ff119b608433@oss.qualcomm.com> Content-Language: en-US From: Praveen Talari In-Reply-To: <847290c3-d5aa-45cf-a75b-ff119b608433@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Proofpoint-GUID: gDtM9NGb3097boCtUIH3xKeCX2uKKEli X-Proofpoint-ORIG-GUID: gDtM9NGb3097boCtUIH3xKeCX2uKKEli X-Authority-Analysis: v=2.4 cv=N58k1m9B c=1 sm=1 tr=0 ts=697a3a16 cx=c_pps a=Oh5Dbbf/trHjhBongsHeRQ==:117 a=hmzEZbfuJy6/QR5cQt8XuQ==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=dd4507Samm2KvyETbE8A:9 a=QEXdDO2ut3YA:10 a=_Vgx9l1VpLgwpw_dHYaR:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTI4MDEzNiBTYWx0ZWRfX13Jo1efZuPew MYOYXDd3DbCZuUz+t7HgFkIoz492FezGASrbG5qaNN6WJKRk1n2LfyiTR81+vt0u1SID3mLYNFx toRxA4SO3v/8tEzB0GU/3Ac7CtZo6nJSWx38PQ2CwjyixvoHFw/H2q7yfK9k09Dzta4dtAzzIrE 9UtZxub7h4BckaWzNKpZJ+CKrbm5WrJv5lX1uX4zzubfKV2p8Z7Xj3tsXVPsR0CCYBEm1M8p5JU /swp36zdekDjoJ8k+KjrxFu8NKuxXYuNWGDGoocrzB6srCT14cvlw8c1+fjLyBAX+QVmktCaPTI EgVxk/DfaEDuwDdU7mtgJcueChu3LwJDudeCCXc+e/ZiLxDTtPC39SrNGjunFluZMRECeyuwC28 D9XB/i4Nvb/nfjm0P6YgmgPOK/AVY1M06ozWr5MzL9eTYt5FWfWl+Rr0RzclqKFnHV1WAxen4f2 XoOJGFss28HWG1WGSUQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-01-28_03,2026-01-28_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 lowpriorityscore=0 priorityscore=1501 malwarescore=0 bulkscore=0 adultscore=0 clxscore=1015 impostorscore=0 phishscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2601280136 Hi Konrad On 1/27/2026 6:45 PM, Konrad Dybcio wrote: > On 1/22/26 4:10 PM, Praveen Talari wrote: >> 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 >> --- >> drivers/spi/spi-geni-qcom.c | 15 ++++++++------- >> 1 file changed, 8 insertions(+), 7 deletions(-) >> >> diff --git a/drivers/spi/spi-geni-qcom.c b/drivers/spi/spi-geni-qcom.c >> index 0e5fd9df1a8f..f5d05025b196 100644 >> --- a/drivers/spi/spi-geni-qcom.c >> +++ b/drivers/spi/spi-geni-qcom.c >> @@ -1017,6 +1017,14 @@ static int spi_geni_probe(struct platform_device *pdev) >> struct clk *clk; >> struct device *dev = &pdev->dev; >> >> + if (device_property_read_bool(dev, "spi-slave")) >> + spi = devm_spi_alloc_target(dev, sizeof(*mas)); >> + else >> + spi = devm_spi_alloc_host(dev, sizeof(*mas)); >> + >> + if (!spi) >> + return -ENOMEM; >> + >> irq = platform_get_irq(pdev, 0); >> if (irq < 0) >> return irq; >> @@ -1033,10 +1041,6 @@ static int spi_geni_probe(struct platform_device *pdev) >> if (IS_ERR(clk)) >> return PTR_ERR(clk); >> >> - spi = devm_spi_alloc_host(dev, sizeof(*mas)); >> - if (!spi) >> - return -ENOMEM; > > Is there a reason you're moving this code to the top of the function? When CONFIG_SPI_SLAVE is disabled, the call returns NULL; therefore, I placed this check at the start of the probe() function. ref: static inline struct spi_controller *devm_spi_alloc_target(struct device *dev, unsigned int size) { if (!IS_ENABLED(CONFIG_SPI_SLAVE)) return NULL; return __devm_spi_alloc_controller(dev, size, true); } Thanks, Praveen > > the "main" change looks ok > > Konrad