Received: by 2002:ab2:2994:0:b0:1ef:ca3e:3cd5 with SMTP id n20csp881561lqb; Fri, 15 Mar 2024 08:54:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXSr25YVatNsZEDhkAgVFW+xJK3OKjlMDAjaF77BR8wM6AH8PmysiRqXm2a88YRQtBgN9NIEiqOowauLlU1BsHsACCg6uUG7jZeN1KGyg== X-Google-Smtp-Source: AGHT+IGM7YVSr9giKIlwmWBCh9V7U9WKIrhl8zejTmdTZCkL+qUxq8qB7GtEAHFfH1FhFnzVYEf8 X-Received: by 2002:a05:6a20:8e1a:b0:1a3:51b4:f70a with SMTP id y26-20020a056a208e1a00b001a351b4f70amr1522215pzj.5.1710518043796; Fri, 15 Mar 2024 08:54:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710518043; cv=pass; d=google.com; s=arc-20160816; b=wVtIcJHoWVda9kpOGVjmALO2JdQaNNX/fIwuhw1NIwdTbtXYRBmkEzIJ/SiNLEH3G0 fbE60RQ9x/RBTmS6R3MHyvZyypRU6dVbYx6UbQWQYkfcFF0sT2yu0w/pIHtYFHZWerO+ /bK1gs0juGjidZIPhRwAtuETb3HQ6DZ/LJUXk9mfOktWGHPLxnuNS27D3DPkhf3nq160 um7nkA0W0I4yvAQUPMYf2D17dcO9HdCOkM8PX1DqN3M9iVOXEEXFaP3bhVc7R6sobm36 lEsqfBBmrd0bKOCtO6sSpTwsfjvM5g26S3qBKmMG71QyM+7/9YDV1PFQVO7VQ4D02O/b lKyQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=JVdJX1dxAeJ0yuMsoq5fwlcT3DxyqadWTW2RZ/hgZE4=; fh=bsOWEDHjXSz2UgB+cTHjOyvMkitECVKjudN1D1wAMZY=; b=I/ZTASSisT0smgEkNGm0vVsvXu8TW6c12Uk8F5hrVXEBW+/KcGbgly8X0kqOFa4+p5 a6j+8npHhvlUE+PTJ5gjLpj7XF5nBmQ0iiNjDsUQ4nFQNhC3v1ahmnzm/FZPOytkcgk1 HVmUrMgf7Ao8BYJi2NhpVvZbxsDINTpaOohMeRXMKK+0RTLPVPlZ5PNutMhRZ7Yt4wyZ r+ahgtKXWs9c/R0KWKNHAXmdiiI+pyT3NLC6CGJ+I2XesqPPrvPfZTa3sLxsMTPddyO6 Nqo3OYUBTe6NV1nJ9vRzi45JcoyIBb18g04vuN2WMX3m9GP+fJQXG44B52IZT7RkXAUA XiQA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=hc7aOesX; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-104600-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-104600-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id a12-20020a63e40c000000b005b95ee3edc6si2927834pgi.628.2024.03.15.08.54.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 08:54:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-104600-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b=hc7aOesX; arc=pass (i=1 spf=pass spfdomain=baylibre.com dkim=pass dkdomain=baylibre-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-104600-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-104600-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 298D42822E6 for ; Fri, 15 Mar 2024 15:54:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 97DD2210E8; Fri, 15 Mar 2024 15:53:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b="hc7aOesX" Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 70E9E3F9FB for ; Fri, 15 Mar 2024 15:53:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710518032; cv=none; b=N80c4aSGxM4Tms6Z9xqQWL1y7x08Zufe2JSO4CPL2F2NQTx7i9Z1G7LlfhwBAislPT2WNWenxjneQTLVFH5GhfbqgxoIRGlvPrFEYwy74CDvx3LKpYTNJZiLPTtdmDt/w5ZJnmu+2zgJZkwLHdC4C1ZnbV+lFItMUPZv9XZoDJU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710518032; c=relaxed/simple; bh=mO879abPOFEEh+GbocuwQJS8eHGb7R0UFTlONy3AG7s=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=rkkX+TvXPBcG7kupUQ45erH/u8ixqqo/GkUHx6lrv+OOqsfUgMIE1G72HUSUDYWKKgMH+QhtAnX06+KZXsjJ2Nu7h096Ax+rq3nrlLvHSn62a5Oyqbgv1tK/MJyNGj9QuoArwurLWqEaDZG+4mS3kDoqgpwJmbzXJi2Fh+UeqGY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com; spf=pass smtp.mailfrom=baylibre.com; dkim=pass (2048-bit key) header.d=baylibre-com.20230601.gappssmtp.com header.i=@baylibre-com.20230601.gappssmtp.com header.b=hc7aOesX; arc=none smtp.client-ip=209.85.208.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=baylibre.com Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2d29aad15a5so27407151fa.3 for ; Fri, 15 Mar 2024 08:53:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1710518028; x=1711122828; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=JVdJX1dxAeJ0yuMsoq5fwlcT3DxyqadWTW2RZ/hgZE4=; b=hc7aOesXV5OTqtCHZni522wyr8wpcT8aRYOMgvVGSiki/pAh6jCf5v+EzX+pfRrJsG cGSGwstIIschUS+LiTEJ49nsb3gZCyJuFNVSLlfjySnfSrRFyLyEkBORbOtzmXovjfdF baF1OM8gndEaPfgZucYJXL3NGLwAz8oQyjke+GVufzL6Oy5XK06WrJs+NBagLPmoSxpy 3HA82X/DUHk49lF4jbGUSOCX0YrKLHJtrFuwfKYv+R8tBjivZ+PVFlH9MSOkJR+0rOdw sBSM8bbPbMaAOnkGraVq9pjIfWKKqEOK9ry7em1wRoGjW87j7x6RFxXn3LfGbDBUdZFs x3xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710518028; x=1711122828; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JVdJX1dxAeJ0yuMsoq5fwlcT3DxyqadWTW2RZ/hgZE4=; b=BaHuMC7owasm24QbRJmUErwZT5XaDJsoEqXQjB9Nq5KZX7SAWBDn6R7rd/qkWaqnbs 2QQEPGDzNL2YizgR/Xe4pjs74prSVtUMC2Kc/sRYXYaGDqIlCrSd5b6ifXl/qnIeo0FX 5ANm1/oD99Gucc5YpzaNI+O02jxWf1bz5x8KrAytbWTONeBHALylo27/ZmaBVXZ8El+A cqMov+Al2r8lF+BcCa04p7ENjpLooTZ8jzATqVYW/dbd/iEoHEKrdrcMJd+U6vgc1fqm HK7h70L54V9VMCKZ4vwpAI4swNZbN7pe5py7BcC1b1KE92D0smzeL+B+vU5eJuxjZl5P /9sg== X-Forwarded-Encrypted: i=1; AJvYcCW6jgr+k/c5IDeyEAsXDCWSd86Uh8PKeH0QkWQfcOZOYJMOYLpFsUj3PMH5tnrc3zzHC3tPPY638Oz5rSbzyDaO1NOzJpNNFHXR/YT3 X-Gm-Message-State: AOJu0YwQ4wC9wQ5UKAedN9aakl0q/c6ViHZ4r4oK1xiB0+S8pO89pUW5 0C0lShZM+bS/O6fvoJolf9HnIyhveorRRy7mGBz2xUIK3ULsz7euYVVxhGgkiSqWYLxaULVJ7rB IZmo6Wpzg1iQxJGGtDUEUt20wsjoClr+4Uoow3g== X-Received: by 2002:a05:651c:543:b0:2d2:478a:83e with SMTP id q3-20020a05651c054300b002d2478a083emr2706172ljp.24.1710518027519; Fri, 15 Mar 2024 08:53:47 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240228051254.3988329-1-dominique.martinet@atmark-techno.com> <7f03bb12-0976-4cb7-9ca9-4e4e28170bdd@linaro.org> <20240228142441.00002a79@Huawei.com> In-Reply-To: From: David Lechner Date: Fri, 15 Mar 2024 10:53:36 -0500 Message-ID: Subject: Re: [PATCH] iio: industrialio-core: look for aliases to request device index To: Dominique Martinet Cc: Jonathan Cameron , Krzysztof Kozlowski , Jonathan Cameron , Syunya Ohshio , =?UTF-8?Q?Guido_G=C3=BCnther?= , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Mar 15, 2024 at 12:58=E2=80=AFAM Dominique Martinet wrote: > > Hi Jonathan, > > Dominique Martinet wrote on Thu, Feb 29, 2024 at 11:59:19AM +0900: > > Jonathan Cameron wrote on Wed, Feb 28, 2024 at 02:24:41PM +0000: > > > A given IIO device driver may create multiple sysfs directories (regi= sters > > > device + one or more triggers), so I'm not sure how this would work. > > > > Thanks for pointing this out, the driver I'm using doesn't seem to > > create extra triggers (iio_trigger_alloc doesn't seem to be called), bu= t > > the current patch would only affect iio_device_register, so presumably > > would have no impact for these extra directories. > > So my device doesn't have any "built-in" trigger if that's a thing (let > alone multiple), but I've played with iio-trig-sysfs and also had a look > at what's in the tree's dts, and as far as I can see the 'name' > (/sys/bus/iio/devices/trigger*/name, also used when registering a > trigger for a device) seems to be fixed by the driver with parameters of > the dts (e.g. 'reg'), so if there are multiple triggers and one wants > something in the triggerX directory they're supposed to check all the > names? > > > So as far as I can see, I keep thinking it's orthogonal: > - devices get a link as /sys/bus/iio/devices/iio:deviceX ; which contains= : > * 'name', set by driver (some have an index but many are constant), and > does not have to be unique, > * 'label' contains whatever was set as label if set > * 'of_node', a symlink to the device tree node which is what we > currently use to differentiate devices in our code > - triggers get /sys/bus/iio/devices/triggerX, which has a 'name' file > that probably must be unique (as it's can be written in device's > trigger/current_trigger to select it) > > > I'm sure we can make something work out while preserving compatibility, > > the patch I sent might not be great but it wouldn't bother anyone not > > using said aliases. > > > > aliases are apparently not appropriate for this (still not sure why?), > > but if for example labels are better we could keep the current > > iio:deviceX path (/sys/bus/iio/devices/iio:device0) with a label file i= n > > it as current software expect, but add a brand new directory with a lin= k > > named as per the label itself (for example /sys/class/iio/