Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1418096rdh; Mon, 25 Sep 2023 12:08:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEHAWapbeI0u8I9it025pzq3N3j4nsQ2HL3QgTpx0kbLDMkzZD2BeKM/1ylN8rgJalQQJZ6 X-Received: by 2002:a05:6870:32d3:b0:1db:f7f8:ab56 with SMTP id r19-20020a05687032d300b001dbf7f8ab56mr8668921oac.53.1695668881116; Mon, 25 Sep 2023 12:08:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695668881; cv=none; d=google.com; s=arc-20160816; b=HHjIoK44MXvbhMEWyqKcMYRW/BNYcl00aQKwkKzjeyNavDsa0hF59LRNOe3lTfJ2zW pyQ7CtP9VwbMkbP3J/5YLBLLw0AZbcceS08eTsfYLx0b3AukfWUcDbT0tOtjYbf37yh9 xN0Q4j8aih/ghmH5f73n8np8e9m7Xzm7pomZz0PgGm/R0L2t5sajBAFATKF34AGzM3AF t/2/HaV/6HX6BQDQ40h2nuzPd2RC7MS+InCGpVvjw0+caHJV1FcPeITHuDmUwKwqegQv 99PLNF8w/4amkWSv1ZU92lXPN+UMYqOXIBw3WGIKYU8KcpZMoA1DfIl9YYjxU4IEjhx2 CINw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:dkim-signature; bh=2Z5EPQJfduzTV0uZ8cbVkAvVHIT8W8XjB1RDxXsG0uQ=; fh=j0wrmEkjssv5QUNvO+cLemXLSwg+oetkatevpLlhb/4=; b=0ru2vZe3KHdm2xWlQ7uEwel3meOnZK/4rKcqf43tW2IN9k1gpb8B0fAHVIKgSoKkRO CV/MqSYV0n4pQsbDK0AYPgRBO/9HWBDIx/9z2hYSVnFJae4XWUN5DeBUU2FC+fCgk737 HYcouYoKrgI9G0rlsY1wGYmvdtjVOfptXeA/KtEYclXLpNfIP58YFSZfVqFAMENPdULs Z2/h1nBVoj+3yTIhS+pEjJ0SfAW6sxIc2K5MLkildcjtj+F5eJoAs7lRHsRTa3tH85M2 evFi9CW/XOlRZnz37en53GPzKuf27sBRFGmcBmHa8QvaCPU7SIA7IjjsvmVjzYsazcc4 v3yA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=UOydjEQ3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id 132-20020a63018a000000b0055fce913d52si10223717pgb.761.2023.09.25.12.08.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Sep 2023 12:08:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=UOydjEQ3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 16EE7811EDA2; Mon, 25 Sep 2023 03:07:12 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229805AbjIYKHJ (ORCPT + 99 others); Mon, 25 Sep 2023 06:07:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229473AbjIYKHI (ORCPT ); Mon, 25 Sep 2023 06:07:08 -0400 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 136A5A3; Mon, 25 Sep 2023 03:07:02 -0700 (PDT) Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2c131ddfc95so88768671fa.0; Mon, 25 Sep 2023 03:07:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695636420; x=1696241220; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=2Z5EPQJfduzTV0uZ8cbVkAvVHIT8W8XjB1RDxXsG0uQ=; b=UOydjEQ3xZwMoQdJM/ASIbWX/7F6JNAunu11acMj00hcPGpLGISbEJN6HRicrC1PTw Em8X9set5u5tRc0dHsXSDMMa48B0g56Jg8iQG1nH1oqC6CtzSKHcnIPtNst8zSjehnph c+wNDL1PHC41fqrFIsjWCbyJxR+jsfOaOtpViaBDlDV4KhNVVTyWCA4tw8Sic0Nw67pB 6zfo9U1mm/M93tyq1p4FF3zao42TWb6vaZyffm4r/IK/OogjItXaMUbQNhG9T9L3PD+b DWsw2ONjsVJpAkbg7AQNtcotUVZ7lIq1msVm1S6IPedpAEazcK4SIwgcYssPFh2vT+y+ DmUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695636420; x=1696241220; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2Z5EPQJfduzTV0uZ8cbVkAvVHIT8W8XjB1RDxXsG0uQ=; b=PhnpkDcgAA3NzEwFsD/r55e4Bo66Ue6WPsE2z8+T5j+q/vOT6MPPOamn1UwgcdugNC 16ZO+LMioHvX7E1+8sj6zfuNjcRY7MsMF0IbjNesc4XHzssq3JVLtc/9Xvo8zY1ENW/H 9FsB2gQW/gvQbE0VYwk5GTTgRoOh0ToSRsG7iESCtX0guxb9clISP4bpZ7EvdsFIAK1U w7thJJJs6FAW0bummcn709NQGR8V19/5hs+xJR83MAq6n533AupWkT0CoKt0WTrFy+Vy ZW7hTCQ8eyIXymAj6yb3J8EMBVcjSWjnX3kjFuFBth+yzKAjif9+jQusBCQlEyFlECcR OLHw== X-Gm-Message-State: AOJu0YzBqEBm03Sa5Ap35OfOmk84xRU083VD6sIDi7Pymm2fMvngc7cW /RyMgJLZH4Wrw+JPWlvXRzzYD6vLz0A= X-Received: by 2002:a05:6512:488e:b0:502:ffff:feff with SMTP id eq14-20020a056512488e00b00502fffffeffmr4502918lfb.58.1695636419977; Mon, 25 Sep 2023 03:06:59 -0700 (PDT) Received: from ?IPV6:2001:14ba:16f8:1500::1? (dc78bmyyyyyyyyyyyyyyt-3.rev.dnainternet.fi. [2001:14ba:16f8:1500::1]) by smtp.gmail.com with ESMTPSA id ep30-20020a056512485e00b00500cede2786sm1767687lfb.65.2023.09.25.03.06.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 Sep 2023 03:06:59 -0700 (PDT) Message-ID: Date: Mon, 25 Sep 2023 13:06:58 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Content-Language: en-US, en-GB To: Jonathan Cameron , Lars-Peter Clausen Cc: Matti Vaittinen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Andy Shevchenko , Angel Iglesias , Andreas Klinger , Christophe JAILLET , Benjamin Bara , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <24a577e6e157e1199817ab36631cec51675ef3ca.1695380366.git.mazziesaccount@gmail.com> <20230924170726.41443502@jic23-huawei> <20230924171007.2012a879@jic23-huawei> From: Matti Vaittinen Subject: Re: [PATCH v3 3/6] iio: try searching for exact scan_mask In-Reply-To: <20230924171007.2012a879@jic23-huawei> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 25 Sep 2023 03:07:12 -0700 (PDT) On 9/24/23 19:10, Jonathan Cameron wrote: > On Sun, 24 Sep 2023 17:07:26 +0100 > Jonathan Cameron wrote: > >> On Fri, 22 Sep 2023 14:17:49 +0300 >> Matti Vaittinen wrote: >> >>> When IIO goes through the available scan masks in order to select the >>> best suiting one, it will just accept the first listed subset of channels >>> which meets the user's requirements. This works great for most of the >>> drivers as they can sort the list of channels in the order where >>> the 'least costy' channel selections come first. >>> >>> It may be that in some cases the ordering of the list of available scan >>> masks is not thoroughly considered. We can't really try outsmarting the >>> drivers by selecting the smallest supported subset - as this might not >>> be the 'least costy one' - but we can at least try searching through the >>> list to see if we have an exactly matching mask. It should be sane >>> assumption that if the device can support reading only the exact >>> channels user is interested in, then this should be also the least costy >>> selection - and if it is not and optimization is important, then the >>> driver could consider omitting setting the 'available_scan_mask' and >>> doing demuxing - or just omitting the 'costy exact match' and providing >>> only the more efficient broader selection of channels. >>> >>> Signed-off-by: Matti Vaittinen >> >> Whilst I fully agree with the reasoning behind this, I'd rather we >> did an audit of drivers to find any that have a non logical order >> (one came up today in review) and fix them up. >> >> A quick and dirty grep didn't find it to be a common problem, at least >> partly as most users of this feature only provide one valid mask. >> The few complex corners I found appear to be fine with the expected >> shortest sequences first. >> >> Defending against driver bugs is losing game if it makes the core >> code more complex to follow by changing stuff in non debug paths. >> One option might be to add a trivial check at iio_device_register() >> that we don't have scan modes that are subsets of modes earlier in the list. >> These lists are fairly short so should be cheap to run. >> >> That would incorporate ensuring exact matches come earlier by default. > > BTW I'd have sent these as a separate series as there is potential that > this will distract from or slow down the driver + not all the CC list > will care about this core cleanup. I was not so worried about the driver being postponed. I was prepared to suggest to merging a subset of the patches if need be - while I can continue work with the rest of the series ;) What comes to people being interested in the core-changes Vs. people being interested in the driver changes - I'd expect the core changes to concern much wider audience than the driver changes. But yes, knowing the amount of mails people go through, limiting the recipient to most relevant ones never hurts. Besides, I think there is no conflicts/dependencies as driver changes don't change core/tools, and core/tool changes don't touch the driver so splitting this to two series should be trivial. Will do that for next version. Yours, -- Matti -- Matti Vaittinen Linux kernel developer at ROHM Semiconductors Oulu Finland ~~ When things go utterly wrong vim users can always type :help! ~~