From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gw2.atmark-techno.com (gw2.atmark-techno.com [35.74.137.57]) (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 56BBAFC01 for ; Fri, 15 Mar 2024 05:57:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=35.74.137.57 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710482274; cv=none; b=W0BAOHLF3xnGMTrUbOMfCcnkg4AKj3L8a7qi2/Q6GlIVPg7AulnVBozc1KDet0bbrOqd070rFfVLz/7YdDBpbeKRlB0KxMakVgkeQNXYRtUhlUd4k5jo9e/PCWI5xc4ihktu+aD6fmIM60pLBG/6sNWvsJphzVToLRysSo7hTzA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710482274; c=relaxed/simple; bh=689CVoU4hSkkdi+xckfkMtotCp/WIXunG9G7U95p51Y=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Jp1QfPvZYvuZLWle6eKVc8w1ZPCXA4ZFXR0W5FswYlDaBhabV1xODhh9yHvsMt3I2dofMNt3QbhUK9QfZM0XrqWsdCOuwIpxp9yl90EmFUn8hDaIo/jf5onnSxxVFmdwFjukQyrNZy6ToaKo4+GOzNUEyNFitGHlUGnVTURMbRg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=atmark-techno.com; spf=pass smtp.mailfrom=atmark-techno.com; dkim=pass (2048-bit key) header.d=atmark-techno.com header.i=@atmark-techno.com header.b=lIve2nhL; dkim=pass (2048-bit key) header.d=atmark-techno.com header.i=@atmark-techno.com header.b=LUqGr1Wz; arc=none smtp.client-ip=35.74.137.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=atmark-techno.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=atmark-techno.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=atmark-techno.com header.i=@atmark-techno.com header.b="lIve2nhL"; dkim=pass (2048-bit key) header.d=atmark-techno.com header.i=@atmark-techno.com header.b="LUqGr1Wz" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=atmark-techno.com; s=gw2_bookworm; t=1710481674; bh=689CVoU4hSkkdi+xckfkMtotCp/WIXunG9G7U95p51Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lIve2nhLDo+gKlMaymzkcDIyEOJzA1e8tYaoEURrKqtP6EPN2H3x+K01Ira27ymQX YDAUy0Q0UjhD1zWyP5tWgfwjMynKAT8fIIe1j2KUenWie5RR4uaFbTbLWQejri0VvL IBY0OJFrSrEGdGiV5pFGBcSVIQmO/iGqIcma7WzbLn2UHagL63swgnn9U05sfA2oc3 +VYgxTdUMUFHJJUq9wDTU+eOPK6mTSifck1N58tC2tYuD5weQnXVzTFPEmjMJ3sZ2U z8vPNy7ri0KwCZvaODSwqZLavFBzB7moVuMVUSBN3fQOxE78lEewDovc8WLgPK7aY9 z3YfSDWTJmFXg== Received: from gw2.atmark-techno.com (localhost [127.0.0.1]) by gw2.atmark-techno.com (Postfix) with ESMTP id 1863CBB9 for ; Fri, 15 Mar 2024 14:47:54 +0900 (JST) Authentication-Results: gw2.atmark-techno.com; dkim=pass (2048-bit key; unprotected) header.d=atmark-techno.com header.i=@atmark-techno.com header.a=rsa-sha256 header.s=google header.b=LUqGr1Wz; dkim-atps=neutral Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by gw2.atmark-techno.com (Postfix) with ESMTPS id 8D18DBB7 for ; Fri, 15 Mar 2024 14:47:52 +0900 (JST) Received: by mail-pf1-f197.google.com with SMTP id d2e1a72fcca58-6e6bf91a8dfso1873242b3a.1 for ; Thu, 14 Mar 2024 22:47:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=atmark-techno.com; s=google; t=1710481671; x=1711086471; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=bYMS5/DXfaIpI+pTTahoABUn10+eXSS/XEewvoMgNdw=; b=LUqGr1WzOm+02rv+c8Ap/x7k2syQ0pqh/poh5vY1pWyas4RZflTBomX4kIx9N2rWBX wL4PajSDOLWQKlLMQkJ/G4rsnagF1fOejFuL+dpnsMDKr4tjWD6/0+uZl8ftUtcyZWB/ hyIeF2HwkBv6NeuRWZFCM7vJAxgYbdaEsUO65YzHPXtw1l4SvCTnswlCS6KUZaS/Aw1D YMi1vWIHzlujqA4U4MaTg2novA/ZNcNUVC8TpyhAPCB0PFaWUJrgSFknrRJFI/n0bNwp bt3QwOIX/W4M+rBCP0hu/wi+MdSzVFoEtMVVLzoZcmqxXUGPmwb+ZDeuvH9HAkqoRxDj XxFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710481671; x=1711086471; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=bYMS5/DXfaIpI+pTTahoABUn10+eXSS/XEewvoMgNdw=; b=PeckNrulSr3RYt43P9KU6xljeKG6V1TphgKynyejuDvPZH1MrTq78NI84GqTNlRH8f +O1qHCqdjKViHS77o8y58agMF6KfOflgVL37pd76KTDbVr9jO2xCvOBTymaDAzito7kH WAJdi17ipCGi/Z0L+sU82NTe6wf+6ll/GZxGjth3Cj0P6e3dVOVNpQYOsYxcw4IOfhW3 0dXU9svzg7ziPcbArUY/Ke3weDr+FniHHtWsrRcd3otR+o3L2diwoYt8yfL6jMsRP7c9 +Nm0ySH8joJvqebm1TdbxBIBfPmZjPMdYrbJhD7pLtmJ9cXMjaE3nd3g2yBbzrGH4ZFC Lxxw== X-Forwarded-Encrypted: i=1; AJvYcCUv6OgoKIgC6bDnGn0D/sAsFIDOiRnVPCbXVe8lGxQk98oeux2Rgngpzydu5I4HfJas+JEIpCS+3Z5oRKdRh8iYY/cbTRFZjeM71+8Y X-Gm-Message-State: AOJu0YxJcmvGx0FUm/DcExg3b9YohIZDRK0gYg6NiT+dBhDfR90q0NWG ElbCvZM28zCrjUlSuBFapEK6RJQzljHP8J/1nC0ZJQTjaVXgNinVsFu+Hf6WAyuXQGZL/PiPuLh SFmMbB4nbTPP33PTQ2sCsHE1ToBT/xFJxFnI3XHjkAESabZ9NZPnuUI3N/AMEOhU= X-Received: by 2002:a05:6a20:6f03:b0:1a3:4438:be20 with SMTP id gt3-20020a056a206f0300b001a34438be20mr4088604pzb.48.1710481671412; Thu, 14 Mar 2024 22:47:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGCUH0IHN6AHGei3jkhHFFHGzGL76YbEw4+7QRI/GsRpKTjLzKIfiwMSllJzEGapNdawt2QAw== X-Received: by 2002:a05:6a20:6f03:b0:1a3:4438:be20 with SMTP id gt3-20020a056a206f0300b001a34438be20mr4088593pzb.48.1710481670857; Thu, 14 Mar 2024 22:47:50 -0700 (PDT) Received: from pc-0182.atmarktech (117.209.187.35.bc.googleusercontent.com. [35.187.209.117]) by smtp.gmail.com with ESMTPSA id o197-20020a62cdce000000b006e68b422850sm2635895pfg.81.2024.03.14.22.47.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Mar 2024 22:47:49 -0700 (PDT) Received: from martinet by pc-0182.atmarktech with local (Exim 4.96) (envelope-from ) id 1rl0Q0-002zK0-2A; Fri, 15 Mar 2024 14:47:48 +0900 Date: Fri, 15 Mar 2024 14:47:38 +0900 From: Dominique Martinet To: Jonathan Cameron Cc: Krzysztof Kozlowski , Jonathan Cameron , Syunya Ohshio , Guido =?utf-8?Q?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 Subject: Re: [PATCH] iio: industrialio-core: look for aliases to request device index Message-ID: References: <20240228051254.3988329-1-dominique.martinet@atmark-techno.com> <7f03bb12-0976-4cb7-9ca9-4e4e28170bdd@linaro.org> <20240228142441.00002a79@Huawei.com> 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=utf-8 Content-Disposition: inline In-Reply-To: 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 (registers > > 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), but > 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 in > it as current software expect, but add a brand new directory with a link > named as per the label itself (for example /sys/class/iio/