From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 850873382F4 for ; Fri, 30 Jan 2026 11:22:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769772170; cv=none; b=ilrVavBtMbqfdkfy4ZLMf7qsIHOnYpytP853PZT6iiBahpWaYjsy8aDcv2jV5TJay6fXRSySBQxTVbmatsors/9N+Oq/j4eDwELu1QTnknlplWPiv6vntgRZfSpQURyrtwQHaJJA8UiGWzsja86O+mWYiDK4XT2M4UvsU1ZSJhE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769772170; c=relaxed/simple; bh=dVjadyquaKeik+5XqUpXlDz1A5y0JMoA9NMOSF7QWGs=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=oDnclE2I62ccYfuyJ3fWqxD+MH3lbEt2VmUQ2NIbgT+heRMSOBcMOzvoDtnP580A2l/ciSTi2Q68hcDg//BRELVEovA3H/Mtyg1HpsW03mHnXWFGmJmcmfJOIard8/GobwLQePiUjcTRY+r8E7F/vVAli+w6BucyZYar3D3s6Pg= 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=aG74lj8t; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=idWDXjZv; arc=none smtp.client-ip=205.220.180.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="aG74lj8t"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="idWDXjZv" Received: from pps.filterd (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 60UAfiSj995918 for ; Fri, 30 Jan 2026 11:22:48 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= q2Pmi2PxduAkYx18ZQxB/YX4MWuCY7zbCFQhTQcTLeI=; b=aG74lj8tZWyRJQ6r NXobRax75yiwrtGA64xgv01k7CoP9CKBIG7x1wOWGC+Mea73DMGqDE7c/HgrX7A3 fjsrAW0SenF/F/DbXVvls5xZMvg3DR3wQ/xRwC4+Cs4qwo6UvolYw1Oiu6Ze3F6z XFbK60uSskLJNq1q3qHBBna7A7Dao+y/dQiEuRzi/nQo37lEfSRq5F5QerFechqy Kaa3w8UvBMNCnbKGu0QURP7SJUC+bUgDFouPfzyt5mrobmTGEEGECyJKqy7LvcqC tiM9CJYobk2Ryni80qIJcyFtx1Bhxh8JQXxi35AF82d9r3HFg8UsC7JzrTsiK5vN OUKEgg== Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4c0bvvjw1h-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 30 Jan 2026 11:22:48 +0000 (GMT) Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-8888ae5976aso2141746d6.2 for ; Fri, 30 Jan 2026 03:22:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1769772168; x=1770376968; 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=q2Pmi2PxduAkYx18ZQxB/YX4MWuCY7zbCFQhTQcTLeI=; b=idWDXjZvE6KkJtYNytgCWEgVkDquZV9BwksT/muPjijcDtM1eAArh7UGNl8gtQHeuU mEAa1r/LvrYeLVOIE49FsBhMIXiaIUrtkpJglsribsZ+sPs5R900yBHq+sh9jOF344EN X6q+WJwAAr05t2dnHYm6PZOHzRpcXiEL3PZWkyKedoNec7QjRkNGxbpAnzfAoEIQQGkO sVtRVk08QWiA5SVMpyZgi1kHBX+6sqOfwl6ZNtt7MtjYcwbpIRYyqrUaWBnZEyPXwPiD eMQOkTfOSeQhC+i0TuLkbaqOcYZB3s2XggPuAUrvbFobL0OoZIS1I5dEVPF1wDDUOVLI FuLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769772168; x=1770376968; 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=q2Pmi2PxduAkYx18ZQxB/YX4MWuCY7zbCFQhTQcTLeI=; b=Y3HtTc4T7zN9gq244dlD6b+zEHPQ6CCiWI/CwIlVnq/m0otGyJ05ixZLaMZyKk1/Az tY10xHlBA9DX28LziFeFF2vs9MHdIsUrzZoejq96PVWdrJERHub6ZsnpPoi88SR1AbvG D2xm6TRVpl3ysDgyoIPEh+ULZ9VG2HcMdBWHZVFjzS8hnCybBc3FXUwAhuBfbNitk5x3 Uo85CXEgPHi1jBfEIyQ8JTcqOP7R+vyz6xAwK3yBkz7igu8dC3WiFAHOaDT+kGycaZtw IHFH49ZhcKtHgCRAKyblR0yB4LAIMwUrTdk8gYN7ddYr+5FUoHuSx5MTx+5F4raf+ab6 rhrg== X-Forwarded-Encrypted: i=1; AJvYcCU7CFWMIEwV5jPax6F/0k8wWAibXUgi4YZ2WX5ynm0o/EOlPCs5VaLwXi0Vhqc/ODFpiD7Azmvb40V3aAI=@vger.kernel.org X-Gm-Message-State: AOJu0YwnYdFmnSJKs1YTGWcn2vd7JCCwFcRvouQWree8VI+zhmWW9cH4 e6MhNQzpmBgX5FOlzRqdXhljrtf17oUi2A54TK8f8n5i1Uj1XxgdayEOuKbZ4bNk0/+OTVHDfyU OCzOaHNPZfI2zIyU+bjuZzwRWuuvOOsnEDMBI5MwOc7qeOXQ/joqFIBnLGBTOTRKR68reIb89ev 0= X-Gm-Gg: AZuq6aIb7bUHhIyCLb2Qo72z2F3GyWa3M2cPQiyWs5Arcb23GlrlRlbY22Larnvz6Wu rEoWB8HQb5EJP1u7l8HURgh+XFqjnbjA0eqd33PmvLQwz5QrZikqxqTFmWh7NoPw+XKwBclXBWf 95vbpS5pLvNLbAMHRh8hmPKsMlnm9HP893ufhThjYRkqmsAp65b1EGSUkzk534CPAkTNP+8q9J+ iGXHSugpTYTvcC61nxVmi5cuQ1cOiKcjTZFiVplKjpIB9SlUdtC8uIQofsxy8dxcwqoazI9zmZ/ +soDjoE20WMBB4ANRzTGN1VVrWdONBGCIri1J9Fur2h3wUMhu4OUVV+8+GzA5UejrA6i/FjhNoG uRViuyUIea91g8oo+dgQiGsHX1cHdQOw5NdwXtKYiyy9AKf2cmI07KiQ8i9dChfBBoOs= X-Received: by 2002:ae9:e710:0:b0:8c9:eb7f:b6d with SMTP id af79cd13be357-8c9eb7f16d1mr199456785a.4.1769772167775; Fri, 30 Jan 2026 03:22:47 -0800 (PST) X-Received: by 2002:ae9:e710:0:b0:8c9:eb7f:b6d with SMTP id af79cd13be357-8c9eb7f16d1mr199454985a.4.1769772167343; Fri, 30 Jan 2026 03:22:47 -0800 (PST) Received: from [192.168.119.254] (078088045245.garwolin.vectranet.pl. [78.88.45.245]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b8de46abf6fsm226693366b.52.2026.01.30.03.22.44 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 30 Jan 2026 03:22:46 -0800 (PST) Message-ID: <32eb6d3c-835f-44cd-9852-96ddc8661113@oss.qualcomm.com> Date: Fri, 30 Jan 2026 12:22:43 +0100 Precedence: bulk X-Mailing-List: linux-kernel@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: Praveen Talari , 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> <57cb30cf-2da6-4df9-954d-953955969b02@oss.qualcomm.com> Content-Language: en-US From: Konrad Dybcio In-Reply-To: <57cb30cf-2da6-4df9-954d-953955969b02@oss.qualcomm.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Authority-Analysis: v=2.4 cv=ZdEQ98VA c=1 sm=1 tr=0 ts=697c9488 cx=c_pps a=7E5Bxpl4vBhpaufnMqZlrw==:117 a=FpWmc02/iXfjRdCD7H54yg==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=DI4xcUXyGD7WBy4uMMEA:9 a=3ZKOabzyN94A:10 a=QEXdDO2ut3YA:10 a=pJ04lnu7RYOZP9TFuWaZ:22 X-Proofpoint-GUID: I9oKqh6DjcjSowcgkzehEfwyFIH6Ktxw X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMTMwMDA5MiBTYWx0ZWRfX9fw35566bILv B0CewAtKJEsYiLjd0DcHgBz+3Imw7wmu2VWOAPfJDrACCQI3wQDjAr967dhm45G0boQU61NvtIn tfpgzdJDxzMlE5CvWvapJP7XNKa4idMi2b1aLB097MSvxUuOoaFnRzbA/BABusoYsNBQFZAEJSX RiWBskVm69Puvn58l2TdoBiMEOXsZDaYD+NwUEVNO4d3/8O2xjniKisKMaGcgRzS53NCklFhZdk HkSmCUJkKJ7BTUccdIYZMwIDsWx2nfQ1HCGe2KhTt696aUDCXKPIFwJ1mMLzYvL/AfqK4EWS+R1 DL/N7aWt7L4snNnNiPyLEOnACe4hp39JO2l9orTctGmSiRjIAFekT2BysJOFQmnk0EalhYFQZ1J jBmTsHC2prhL8z0MmjQL12sTXAk8ALkzIA8Tm2CzdKiDayJB2yzuRdkThnOpvpsCni6PJlHbWw6 wC5tDdFIT9Amzs2Ec5A== X-Proofpoint-ORIG-GUID: I9oKqh6DjcjSowcgkzehEfwyFIH6Ktxw 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-30_01,2026-01-29_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 clxscore=1015 phishscore=0 spamscore=0 suspectscore=0 malwarescore=0 bulkscore=0 lowpriorityscore=0 priorityscore=1501 impostorscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2601150000 definitions=main-2601300092 On 1/29/26 4:45 PM, Praveen Talari wrote: > Hi Konrad, > > On 1/29/2026 5:12 PM, Konrad Dybcio wrote: >> On 1/28/26 5:32 PM, Praveen Talari wrote: >>> 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); >>> } >> >> That doesn't really matter since spi is not accessed beforehand >> and it'd return a NULL if it failed to allocate either way > I agree. I had also reviewed other SPI drivers as a reference for this implementation. > > Do you want me to keep the change where earlier the host allocation was present, or is the current modification acceptable? Please move it back Konrad