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 56B8A846B 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=tS8IykJLalT7vOQmiU4OdYSjPRWoY8AHxoXCrBK1u2CF/Goh7mXDOiHy2GnBF6E4YWmL19bZUROqoDxHzMFTQN7/XpofRzAFyiKRXKdIEGQjg7IzyaGcAmwlVXLzn2ogF5QQ0q5c3yana2/Ylp/+u1d3q1msSzoMS0V3cwjK5v0= 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=ZJcHtxeH; 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="ZJcHtxeH"; 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=1710481673; bh=689CVoU4hSkkdi+xckfkMtotCp/WIXunG9G7U95p51Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZJcHtxeHYquE6WIV8k927gOu21f2DOZPiugLeOnWdLAiwGTCI58XS1EUBhYk8sDJY i8WahKViHF2cxu7MjATZAFrErpGxtV7LF0gVM39W0KfZrG9sU6yXgcwtLtVOIa/I7N BPf3DxnAbQW4Cnuuxq3Vbx8TytBJ+g/POi9Upij36oVKtw9GFFPzK/L2gFnQwVVM46 r5xRMRIs00wdoua/eN+Ncyqs5lHPJZgQ+j+T3yC9vI+VrE3+LeNhErEtWXIAKHFeWb ScgryDSEzKDyQpt0aNOtJCvrFFUrPo7t4i5aPB8MN/G9ifuZlD9KACdZ/LjTNWkzT1 jdxYI7Af8ycWQ== Received: from gw2.atmark-techno.com (localhost [127.0.0.1]) by gw2.atmark-techno.com (Postfix) with ESMTP id E86F7B9B for ; Fri, 15 Mar 2024 14:47:53 +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-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by gw2.atmark-techno.com (Postfix) with ESMTPS id 78D17B95 for ; Fri, 15 Mar 2024 14:47:52 +0900 (JST) Received: by mail-pf1-f199.google.com with SMTP id d2e1a72fcca58-6e04e1ac036so1703360b3a.3 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=h+dINIR6V3k6eYAGVpQ4ab19R4QIRtSNdwkyxeEE0Q178k3c3VbN6CfdHvwH6HnQJP DO3RDx+JGbNjX70KL3LR/9AnYhDi9aiWCo4sZCHA1ehknH+ll4NkYJi2M50jgvlWGfHW 94AK7WqH5n4NqpGRATNz/lK0kpGvRPjKytwfiSFAKmNyjqMJ72gct3UpvGjUE6qXiX7R Q1aBQ68fDLakS8JGyRcDNhnfD9U1e6WDARDHu0SxgXQUoECULMc3u3A+oz0tOQ/AzyO0 Yr/xws4pz9Sifd0uU6uuQoD0cc9bc8/vuZ57NPJVRaCUjVxXcSPG0Ag2mCCEh+fD/LDy nXTQ== X-Forwarded-Encrypted: i=1; AJvYcCVnrJo2WmG7TP3zNSKPGjoADYe+46/f/r5/422Me3kVzmusrv1/9fJSC0oNCChvNvVPi5TrsbHioPOrdVXgHGuxrva1WcPrKpsXoA== X-Gm-Message-State: AOJu0YwR6/PbpNtMadBC2xWk/Xbi2JxXsue9yg97uHLeqnl1x0b5MFVt EtWrDX5wwI1EUE04R475uiLw/ffTyfgfT1KysQoswmjJrWb58xBb/ywVwuFAfYuPhuEPd4zZJDI srE6zUQt4qOJ1HjvOdTVcPFHmq/w/c6TuLUTow0mu8tplp0oMlDzoIvmzqUt5 X-Received: by 2002:a05:6a20:6f03:b0:1a3:4438:be20 with SMTP id gt3-20020a056a206f0300b001a34438be20mr4088605pzb.48.1710481671414; 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: devicetree@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/