Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1811003ybg; Thu, 30 Jul 2020 03:20:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTNAyFjxBAMs+K9Qt6bNg6V8XX3cJRUTnb6tgr924L7VJYkF+F5hXUSyqtILS2nBeOF8EL X-Received: by 2002:a05:6402:148a:: with SMTP id e10mr1887171edv.25.1596104413742; Thu, 30 Jul 2020 03:20:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596104413; cv=none; d=google.com; s=arc-20160816; b=H6IrL7RNngnz4l1zSWixK7Jr5JQDjTv/wv99/8FPozlRslLqvWYvczZE1ee7h6aCtr NsY4EUFuz2mh6A/80ozDS5+B9sy4bcSrwf0h6AnofRreFuli0liyNJs/rp+5NzogiBWV okxUMErvX1hhRjJaHdXjYWR2nwrNZ5JVuFsyPY0FzN/6pkJXoBhSssbv5d6XYeAruols hBYgeILLrOhxCOgrlkQShDKKO4bhPNWABUwuBhxuO12nMMD6yRq30zEkK/yRXG6RLtpS ylTEwFFJnY18ORN8WDo0sd0CUnGEXCdYB9kNfihqix3cRKdql1bwRJokcZuZgKVRHpTg YAIw== 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:organization:message-id:date:subject:cc:to :from; bh=XkFkjQzLSpGHLF67RP+gLr1cwJ47MBipxFPl7duL/nw=; b=LktmER6aov8mRjL9+iGXJtQ+0ut734CAFiSRi7iTg44FoQtb5uBIwVsswvL3oSVT0d FFRQUn/wje5uZLbcfW9zLS9ENwMywULcw2RQjMp99d2h8bm7awILNsH7h5aJ3yrBWN7W kb9yk1j5hmGox9qrBNUZEtvc4biq9oXtpfQ54RGqIex0rFv/Dzy4Ipzlz2NDMSZM/Yq4 i7n/cnIATADcqeyfDUKLQJtw6M1lfHL9JFIWoH58USmF7pAYDHoaIOMvQveAVKUOtQ8x R/tu8W/Crc9AKbb7pKzhA0QqI0O5YraEKkUuR/oD3RuqBZZt0Ylh2U63FZ+jsprfWMyR /qVg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n21si2182517eje.11.2020.07.30.03.19.51; Thu, 30 Jul 2020 03:20:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728946AbgG3KSy (ORCPT + 99 others); Thu, 30 Jul 2020 06:18:54 -0400 Received: from mailout08.rmx.de ([94.199.90.85]:44500 "EHLO mailout08.rmx.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726287AbgG3KSx (ORCPT ); Thu, 30 Jul 2020 06:18:53 -0400 Received: from kdin01.retarus.com (kdin01.dmz1.retloc [172.19.17.48]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mailout08.rmx.de (Postfix) with ESMTPS id 4BHRG12gMjzMsSF; Thu, 30 Jul 2020 12:18:49 +0200 (CEST) Received: from mta.arri.de (unknown [217.111.95.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by kdin01.retarus.com (Postfix) with ESMTPS id 4BHRFm4zvGz2xFY; Thu, 30 Jul 2020 12:18:36 +0200 (CEST) Received: from n95hx1g2.localnet (192.168.54.117) by mta.arri.de (192.168.100.104) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 30 Jul 2020 12:18:15 +0200 From: Christian Eggers To: Andy Shevchenko CC: Rob Herring , Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , "Peter Meerwald-Stadler" , linux-iio , devicetree , Linux Kernel Mailing List Subject: Re: [PATCH v2 2/2] iio: light: as73211: New driver Date: Thu, 30 Jul 2020 12:18:14 +0200 Message-ID: <2956063.qbQfZA7an0@n95hx1g2> Organization: Arnold & Richter Cine Technik GmbH & Co. Betriebs KG In-Reply-To: References: <20200728062831.1143-1-ceggers@arri.de> <20200728062831.1143-3-ceggers@arri.de> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Originating-IP: [192.168.54.117] X-RMX-ID: 20200730-121836-4BHRFm4zvGz2xFY-0@kdin01 X-RMX-SOURCE: 217.111.95.66 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andy, thanks for the extensive review. Almost all of you comments will be integrated into v3. On Tuesday, 28 July 2020, 20:00:31 CEST, Andy Shevchenko wrote: > On Tue, Jul 28, 2020 at 9:32 AM Christian Eggers wrote: > > + if (data->client->irq) > > + init_completion(&data->completion); > I believe it should be reinit_completion(). added missing init_completion() in probe(). > > + /* During measurement, there should be no traffic on the i2c bus */ > > + i2c_lock_bus(data->client->adapter, I2C_LOCK_SEGMENT); > Hmm.. Really? yes. According to the datasheet, the device is very sensitive to external noise during measurement. > > + *val = (1 << (data->creg3 & 0b11)) * 1024 * 1000; > > BIT()? GENMASK() ? 1000 I believe defined already. Please recheck in v3. What shall I use instead of "1000"? > > + /* saturate all channels (useful for overflows) */ > > + iio_buffer[1] = 0xffff; > > + iio_buffer[2] = 0xffff; > > + iio_buffer[3] = 0xffff; > > Magic! Replaced by U16_MAX. Do you want to see something else here? It is required to communicate measurement errors to user space as the application will have to adjust integration time and gain. > > +static ssize_t as73211_show_samp_freq_available( > > + struct device *dev __always_unused, > > + struct device_attribute *attr __always_unused, > > + char *buf) > > +{ > > + size_t len = 0; > > + int i; > > + > > + for (i = 0; i < 4; i++) { > > + len += scnprintf(buf + len, PAGE_SIZE - len, "%d ", > > + (1 << (i + 10)) * 1000); > > + } > > + > > + /* replace trailing space by newline */ > > + buf[len - 1] = '\n'; > > + > > + return len; > > +} > > Repetition of IIO core functionality? > > Ditto question for the other similar functions. Can you please give me a pointer to an example? The list of available values of some attributes depend on the current value of other attributes. regards Christian