Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1887491imu; Sat, 12 Jan 2019 09:52:35 -0800 (PST) X-Google-Smtp-Source: ALg8bN4I+WP2z+3gnqRjo55JeSjMNtx+FyUsQO1ydcLfBBaL6Pgu4z1QUeSG2CpUM9ZEp77Ojtp6 X-Received: by 2002:a63:a401:: with SMTP id c1mr7475064pgf.403.1547315555602; Sat, 12 Jan 2019 09:52:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547315555; cv=none; d=google.com; s=arc-20160816; b=NUYIUBBccak2DyEbGl4HZ/GBA70RsvfzXApVubKD2uMyQquIvJSc6b2k6bhu6dO5ck 2hum5VOVsz2PaXSeic2+XamfVeIu8nw/hz7/6VqxP9UiLwiXICHPgxBRFDGoKvzst+wL 451nagugJmoGlxwjbxyyliLperkbbh+7xwhW+onP2LpznFjTTi0U9W4xV4icU17V+I6m KzN2XpIPiWG+GYxnzFfyvM0+Bn5maAhn5OZHfyyK/GP3t86uS3CdwWkjSWgg/ziasSDC 2abnGU2zEJhokR/cZFi9UXg154i/Mv0iXlN9Z8ugnD2GGV6759SAa6EDwsWyHIjQL8cu sSVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=wi1rnrJ/9OnGbdnhjKogft49FUe/UKabf8lNhOBuh3Q=; b=ubbfQdnZ0t77kLVe8ITE2jogczHR495pGKbdo8/2oEpccruKVjYO6BE4WoZug15Sux fhUD0pXQIgBfZOBYy8Fc2AEB9JJUvJ/8sxaPMJ+Bl6eeVBQpMbs99ADhZsbGD4OAcPt7 IsTcf9z5pzaiEThDSOuy0xpp3qvxwyUcZWaYtLqmIpcKONGIiqDJaDkTw/7F97o/rdYM ZjO/PYITIlQWSY91f1vLmpN/xnMljmRLTGGK7li1ApSBJQistrzrJbtHldaKxgxECURY PT55lCQ+jmZQe8Ug8xdElLb1ETetZBzYf8Lq7fi3sCNYuQILrP6Y6zqSMTrBxDGHafTV s9+A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g26si11440851pfe.127.2019.01.12.09.52.10; Sat, 12 Jan 2019 09:52:35 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726467AbfALREy (ORCPT + 99 others); Sat, 12 Jan 2019 12:04:54 -0500 Received: from saturn.retrosnub.co.uk ([46.235.226.198]:33754 "EHLO saturn.retrosnub.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725843AbfALREy (ORCPT ); Sat, 12 Jan 2019 12:04:54 -0500 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) by saturn.retrosnub.co.uk (Postfix; Retrosnub mail submission) with ESMTPSA id 36E789E789B; Sat, 12 Jan 2019 17:04:51 +0000 (GMT) Date: Sat, 12 Jan 2019 17:04:49 +0000 From: Jonathan Cameron To: Tomasz Duszynski Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] iio: chemical: sps30: allow changing self cleaning period Message-ID: <20190112170449.5418c9bf@archlinux> In-Reply-To: <20190106105730.GA6449@arch> References: <20181226193035.3144-1-tduszyns@gmail.com> <20190105165447.0056fb2e@archlinux> <20190106105730.GA6449@arch> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 6 Jan 2019 11:57:31 +0100 Tomasz Duszynski wrote: > On Sat, Jan 05, 2019 at 04:54:47PM +0000, Jonathan Cameron wrote: > > On Wed, 26 Dec 2018 20:30:35 +0100 > > Tomasz Duszynski wrote: > > > > > Sensor can periodically trigger self cleaning. Period can be changed by > > > writing a new value to a dedicated attribute. Upon attribute read > > > triplet representing respectively current, minimum and maximum period is > > > returned. > > > > > > Signed-off-by: Tomasz Duszynski > > > > Code is fine, but to end up with predictable generic interface > > that fits with the rest of IIO we need a different userspace interface I think... > > > > See below. > > > > Jonathan > > > --- > > > Documentation/ABI/testing/sysfs-bus-iio-sps30 | 11 ++ > > > drivers/iio/chemical/sps30.c | 134 +++++++++++++++--- > > > 2 files changed, 127 insertions(+), 18 deletions(-) > > > > > > diff --git a/Documentation/ABI/testing/sysfs-bus-iio-sps30 b/Documentation/ABI/testing/sysfs-bus-iio-sps30 > > > index e7ce2c57635e..d83d9192a3e0 100644 > > > --- a/Documentation/ABI/testing/sysfs-bus-iio-sps30 > > > +++ b/Documentation/ABI/testing/sysfs-bus-iio-sps30 > > > @@ -6,3 +6,14 @@ Description: > > > Writing 1 starts sensor self cleaning. Internal fan accelerates > > > to its maximum speed and keeps spinning for about 10 seconds in > > > order to blow out accumulated dust. > > > + > > > +What: /sys/bus/iio/devices/iio:deviceX/cleaning_interval > > > +Date: December 2018 > > > +KernelVersion: 4.22 > > > +Contact: linux-iio@vger.kernel.org > > > +Description: > > > + Sensor is capable of triggering self cleaning periodically. > > > + Period can be changed by writing a new value here. Upon reading > > > + three values are returned representing respectively current, > > > + minimum and maximum period. All values are in seconds. > > > + Writing 0 here disables periodical self cleaning entirely. > > Hmm. The issue here is that the value isn't: > > 1. Intuitive > > 2. A single value (requirement for sysfs interfaces - we stretch the meaning > > a bit where there the values really don't have any meaning on their own but > > that isn't true here). > > > > This is not uncommon in sysfs for attributes to list both available > range and current value. Hence I though I could try to sneak that here. > > Turned out that without luck ;). Indeed, in general some drivers an subsystems do that. We decided not to a long time ago. Mainly because we already had an interface for the value itself without the extras and so couldn't change it without breaking the userspace ABI. Even though we are looking at new interfaces, we need to be consistent! > > > We have a syntax in IIO use when we want to specify a range of acceptable > > values. It's done for 'core' attributes using the available callback > > (I need to write some proper docs for it though...) > > > > cleaning_period - the actual value. > > cleaning_period_available > > The range version (rather than list of values) is formatted > > by iio_format_avail_range which generates [min step max] > > > > Please do something along those lines for this control as well. > > > > Agree. > Thanks, Jonathan