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 961C4272E53 for ; Mon, 20 Jul 2026 01:44:52 +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=1784511894; cv=none; b=tjALbtnqQ9pSueEHAQPRYp993Orfvx/sLH4kFix7vf7J23DsC8MkAkMili5GFPapGkW8/fFTZm7eUxPJszes8OGoeCxx588XJ/LbcsIr0EyRr640/o2/584vqbvbhemB8Aq0Xryk2amQ6JxedOYu6ixXhlQhdpxpJRqeoU5XVNE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784511894; c=relaxed/simple; bh=iStVGvWn8peZsqiqAMgO1DeCCaqU6NDwZ+ll0MQqFSA=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Mq8a8SRt0VZUyQetenrvmM5yI0qc+Yhso8nVhvVUGLzWlBqMLWLiqgcSU+YskT2/pDc6AXKL/4IthES3f0EbK1QKLjjHv3e+jDZgD31hcJXK18i4/abuVODArNj5bH1XBrQYCg1X3phH7Y8IJIxktflarauwx2JXxOXthNrKuTo= 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=mnCPvrmA; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=CH+xnHMl; 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="mnCPvrmA"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="CH+xnHMl" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66JNt1Fa940160 for ; Mon, 20 Jul 2026 01:44:51 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= A80KOCLG2b6sD2R8+bULxsxxaaO8AzJe9I4MDEg+WNs=; b=mnCPvrmAqXBfWRrp wZxN5vjL4ldL9SNJk5wkxlmEyduN7s3uSfSytSGOwNO9soC6Lt8puw9fx69VhIL1 2oxRnt7V3Kd1U3tTKB+wjXGtR1vOMgKyY+AXg0V4S8+6lT9LXCTUw/QDLp8wup+G gMwMKdvQXVkrBUkU/Yg28plTkoG1aHNWdMXapuyT0pA22hydksATTsvNBWnGyzVQ w+C1Ns5fyswf7yeKM4Q/TdT8k+GI2YBOjzIKES0aDFjrFhzHdF9FP4phYuRWoriT ZE1dRrPp6jJzriQh3lL6x3GtJ68fnFf+AZsGPH3aMotejfEf+MnqqqUmwLhFagbH k6GOLA== 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 4fg2c6bwqy-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 20 Jul 2026 01:44:51 +0000 (GMT) Received: by mail-pg1-f199.google.com with SMTP id 41be03b00d2f7-ca7c1e22995so14559884a12.3 for ; Sun, 19 Jul 2026 18:44:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784511890; x=1785116690; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=A80KOCLG2b6sD2R8+bULxsxxaaO8AzJe9I4MDEg+WNs=; b=CH+xnHMlh+/NlFN/HoA082K5nRMbfXhs1l5Yk60SqC3CjgfQjJwjlGdjYscymXZ7uZ AGMITNASCfRnTI/gNL3WZPZofUIAsKlDBLeb81boZ1pXSXdC+Uez64FJ5DEd9dehm7Zq cWuDj2nVT6rbD3cutA5zckvm5s5vU9sceHiYn0emTZv4AHiiWncx+rOcdtQCz3Ui8rtO ljspCx0Sb2ah4/ZWNEezxwc9nzchO9LMztzieibZzY1oJTkx+/ZKbNmFiEh0xfJctWVX MV01d2fP7KnDbV7bFcHVmDMnot32LyVi8mRrqC11Fcs49NQBq1mFLU44jikDJ1sx2fVg 6I8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784511890; x=1785116690; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=A80KOCLG2b6sD2R8+bULxsxxaaO8AzJe9I4MDEg+WNs=; b=lL0BUJrWFpq6OoLx2n+OlVz9WK+pbZYqxJWu1cHf8QhE5lTAtaejSwzmCpBSvvfhdd WV4tXwB2kQTVtd9yTZ6WzRpPypBiPHbsYRhjPSICbgooMP2T4EpDIT8RI/mC/j33+M71 +Be0rkrnjWyrtp3tEUQXHRian0y4Umz8L0kN6tAOjhRWd/OV1bAFr15FcN7sWN7j/a6c Ne1iI4h+3K44s4c+DbR3Z36m95RtGm9TCa3ddkRfUL2PPipcBpqouFoG4KtExEzaMQYM i4ZAdieBRQ25trDRV/RONgioM6lrjfft/ftK6taw7btt+8UODzKzbYGOsv0CaXBnwKQs mf1w== X-Forwarded-Encrypted: i=1; AHgh+Rrw9MtPaapGkVwBf3hz5YkEdn951A6BKp+eTGwDrw9qJYd4V2a7D2+LZRz8B3PigRsoJpOydYpM0tVhnqc=@vger.kernel.org X-Gm-Message-State: AOJu0YxVlAC5al7yMk7jBzML82kgVz1S287x2DoqFXB6agwRnBtOjGuv YYwXA5HJGcr5xijh+Cw5k22lEGS/aPYlBlJSXVC9rcL2+CqfOXhuo9G0C+P+SMIYkCaZ9/DQGsS j8D1nNvMpdkNmmr66QJbtslWGHJksEMgyV9jOJSLa3kiZ8wICxbV9Kwu4w2p5dX65OW8= X-Gm-Gg: AfdE7cnmpCcbJPS5GM9tIOt6WBj7S4u1bEfh/Kcm3QttacJbf6sux8N397oAyVo4msE M3jZ9hhs0dC0LufVSrfLtO0SgtIJFppb7nZxww/eG+9lKAKjG2F8pOh/s72bp/6Qokf8hPA6ESL /lOIUih3eT3uf6KPDK5FYCPoKYxEkPW7v7L47JvjEpleMZ2kCJSvVHx2vTOrODxhDAbmFCuDoY+ pBef8uGM1iNf/M8q0dgTO2qzySWyUedFNr8te3cEnBFAjRn/BXqeUsUVhgRZD25hQacOWzXfnF/ 58RucaIZW7f5njh01ADJg4kDYJdVkEy9J/c6iX+eBTzz9OcKqh3Rg5HGJxmbUv9y8ks8838glZo tty9WD/k4FecP3Jw/ X-Received: by 2002:a05:6a00:1945:b0:845:e8b9:347 with SMTP id d2e1a72fcca58-84c2926be85mr12085648b3a.13.1784511890214; Sun, 19 Jul 2026 18:44:50 -0700 (PDT) X-Received: by 2002:a05:6a00:1945:b0:845:e8b9:347 with SMTP id d2e1a72fcca58-84c2926be85mr12085632b3a.13.1784511889749; Sun, 19 Jul 2026 18:44:49 -0700 (PDT) Received: from jic23-huawei ([50.35.46.84]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-84c4b640050sm1946332b3a.45.2026.07.19.18.44.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jul 2026 18:44:49 -0700 (PDT) Date: Mon, 20 Jul 2026 02:44:43 +0100 From: Jonathan Cameron To: Andy Shevchenko Cc: "Colin King (gmail)" , Dan Carpenter , Duje =?UTF-8?B?TWloYW5vdmnEhw==?= , David Lechner , Nuno =?UTF-8?B?U8Oh?= , Andy Shevchenko , linux-iio@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH][next] iio: adc: make read-only const array config static Message-ID: <20260720024430.2d1359a4@jic23-huawei> In-Reply-To: References: <20260714165012.184651-1-colin.i.king@gmail.com> <58361942-9082-4778-a3a6-cd0bc4034644@gmail.com> X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Proofpoint-GUID: iitPm0638rxX39x4S2oz71PhOqcWGWwI X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzIwMDAxNCBTYWx0ZWRfXxOq/muDmYS0T ZW5ggncAVGtzXDqHKgs4pFHOyvpV0faeudxifwgzQNJlTq9P14sW9gOJij3y/Ubtk+qDaSaMshy b7I8XolfeCZy+TxyN4lhVdP0yhGdESlgmw3oX9EpiykWEGhzLcaEGpxXdw+ye05iC7UMJk0xlic RIgzs+s+n39rNWgGsbpla3qUWV1sSKY8D5xdwaHQas49z/8sKZqOkl2VdsFygq1pwPgdF/vkB3g oWO3ynGilBmLqrPVH1qb6yAEpl3f+U0rWac1cv043MtlWnWDuowIXKCBixkIizroHJHz8VVTUrS GGmVKKVR6rbkxQyuRMa8kiXqHb/pxHtSWKczGUEktP/AF+8HF8PowVFKJN41qhtg5Bm72gWe5I0 PXY9VswVDnAAADNTkxWey1OpChVWPPsJgsr1NZ5Jd8ufuHyodxuIn1mKcJWySmSnvQcPrU9VFff frb+QhhHFtZqP1xn3iA== X-Proofpoint-ORIG-GUID: iitPm0638rxX39x4S2oz71PhOqcWGWwI X-Proofpoint-Spam-Info: AW1haW4tMjYwNzIwMDAxNCBTYWx0ZWRfX683hwSmKXTNN HX089u4RVKazSQNnm0jPJf7MHIPVtXuQWZnBlpmdXU8dLyX3eUWDtXyFdUQwEWF3TdDV/iLfOMP TtMW99X2qfYjjCQzOZvtEwtzvWbkUJQ= X-Authority-Analysis: v=2.4 cv=CJQamxrD c=1 sm=1 tr=0 ts=6a5d7d93 cx=c_pps a=Oh5Dbbf/trHjhBongsHeRQ==:117 a=qC1CW/w66vtJz1P9yTJxNA==:17 a=kj9zAlcOel0A:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_glEPmIy2e8OvE2BGh3C:22 a=QyXUC8HyAAAA:8 a=Y5yDRIdPUsbKug6gOGoA:9 a=CjuIK1q_8ugA:10 a=_Vgx9l1VpLgwpw_dHYaR:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-19_08,2026-07-17_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 impostorscore=0 lowpriorityscore=0 malwarescore=0 suspectscore=0 phishscore=0 priorityscore=1501 spamscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607200014 On Wed, 15 Jul 2026 16:54:13 +0300 Andy Shevchenko wrote: > On Wed, Jul 15, 2026 at 02:34:50PM +0100, Colin King (gmail) wrote: > > On 15/07/2026 14:32, Andy Shevchenko wrote: > > > On Wed, Jul 15, 2026 at 01:22:32PM +0300, Dan Carpenter wrote: > > > > On Tue, Jul 14, 2026 at 08:08:10PM +0300, Andy Shevchenko wrote: > > > > > On Tue, Jul 14, 2026 at 05:50:12PM +0100, Colin Ian King wrote: > > ... > > > > > > In all patches like this it's always a bikeshedding possible of moving static > > > > > data outside of a function. I have no strong opinion in these cases (when the > > > > > data solely used by a single function), but in general it might give different > > > > > readability experience (it's harder to notice static data in the local function > > > > > definition block). So I leave this exercise to the maintainers of the respective > > > > > pieces of the code. > > > > > > > > It's an interesting point... > > > > > > > > At one point Smatch didn't track static variables and it used to > > > > generate occasional false positives. And it's like you say, those > > > > little "static" qualifiers are hard to spot in a wall of declaration > > > > text. I've never considered moving the declarations out of the > > > > function scope but it might be a good idea? > > > > > > Maybe, as I said, I have no strong opinion here. I am all ears to hear > > > what others think. > > > > For small arrays it's a moot point if this type of change is useful, so > > Yep, it actually becomes a trade-off between generated code and existing data. > With a small difference that static const may be located in ROM (important for > the embedded devices with minimum available memory). > > > I'm OK if it's not accepted. I appreciate the feedback. > > Me too. I prefer not to think too much about the trade offs and just assume it is 'mostly' worth doing so add static everywhere like this unless it's a hot path. Anyhow, I've picked this one up. Jonathan > > > > > But in this case since this data is const, the static vs not-static > > > > doesn't affect flow analysis or readability. > > > > > > It doesn't affect flow analysis, but we also have David's point about > > > amount of data to be static may affect the code generation. > > ... > > > > The main point I have is that stumbling over the 'static' in the definition > > > block might rise some additional questions and slow down the understanding of > > > the code (by reading). > >