Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp714790img; Thu, 21 Mar 2019 07:29:31 -0700 (PDT) X-Google-Smtp-Source: APXvYqxehwPIFGx1QFwkwqOrotpsi68n1JyTB+pGJOKbDqbz7eiO62/jcz251icvnRJ0gv5AsMhw X-Received: by 2002:a62:449b:: with SMTP id m27mr3642669pfi.79.1553178571075; Thu, 21 Mar 2019 07:29:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553178571; cv=none; d=google.com; s=arc-20160816; b=JtWUK4dn4ipl1zRjmdobv94106WJE+YKKNzXZsNbLyrPJfNLxTqZvHVq4i+OP53WIP ywyBxCKFnpGexnVrcQYnPO/Qz1/uZHP7GuI7Sl/1V4Dz0KJJ4RR/D8Y8jIa0JzQILt2K Y7K3GJbIsyHpZL13+cgX+PI8n8QVFitO7GavCTbx1Dl5x2fozDOhs44Vsl27hgJ1Kr/x MY2XAAAIS84+Utzt6agf3GyohFfgPSWFws3VehXfjIX69jW44wcObfTHOWr421KiJbgd iQXrQ518KB4okvwgc1JKDsrJLB+z6ZGu+rWWJdvbvXj0rXGjw7NPPLqS33zwDr2LzXi6 n5AQ== 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=7nC7WxeW1LsbGxsAGsSZMGhaLM46Wjc5KsGeexje8ho=; b=KuUTzqbGwQ2ubEkOPglqp+JL+lBie3PxhGvmtRHbnHpCBNVi4AH+ohUUoJDx7y9V10 +9pL12xN8MslQczktfo7IrReCUccatR+AY6Cgt59+Ua0zV2njlDKJFJiYGlyJg7MqiRD cKZNskF8PEh+wNuCYg6RvJcEaJpJu7UPqp+tIWu5A9KHM1MKJ48W0+ShSTIknii70bMV 01gs+YdzJ/3jed2SFX1v3s45WfSYY8YoxdKDLgioOFtSLso7yyg9ooyASYGY0sumW58p 7Mfb/WLeFI/W0bs7u8rjIIbWXknxm4S7Kn6HZJ4+0S/qmZO9V78mKam+CbxGwQkvmGAs sjFg== 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 n8si4537316plk.316.2019.03.21.07.29.12; Thu, 21 Mar 2019 07:29:31 -0700 (PDT) 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 S1728091AbfCUO22 (ORCPT + 99 others); Thu, 21 Mar 2019 10:28:28 -0400 Received: from hosting.pavoucek.net ([46.28.107.168]:42648 "EHLO hosting.pavoucek.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727809AbfCUO22 (ORCPT ); Thu, 21 Mar 2019 10:28:28 -0400 Received: from tomas-nb (nat8.vcit.vutbr.net [185.62.108.74]) (Authenticated sender: tomas@novotny.cz) by hosting.pavoucek.net (Postfix) with ESMTPSA id AADA2102F5F; Thu, 21 Mar 2019 15:28:23 +0100 (CET) Date: Thu, 21 Mar 2019 15:28:23 +0100 From: Tomas Novotny To: Angus Ainslie Cc: Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler , Rob Herring , Mark Rutland , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/5] iio: light: vcnl4000 use word writes instead of byte writes Message-ID: <20190321152823.41991dae@tomas-nb> In-Reply-To: <16a2d3e86f296fac2f56fb47e1f1afac@www.akkea.ca> References: <20190317154802.15174-1-angus@akkea.ca> <20190317154802.15174-2-angus@akkea.ca> <20190320155322.3fd9f080@tomas.local.tbs-biometrics.cz> <16a2d3e86f296fac2f56fb47e1f1afac@www.akkea.ca> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-suse-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 Hi Angus, On Wed, 20 Mar 2019 13:21:58 -0700 Angus Ainslie wrote: > Hi Tomas, > > On 2019-03-20 07:53, Tomas Novotny wrote: > > Hi Angus, > > > > On Sun, 17 Mar 2019 08:47:58 -0700 > > "Angus Ainslie (Purism)" wrote: > > > >> The VCNL4200 datasheet says that word read and writes should be used > >> to access the registers. > >> > >> Signed-off-by: Angus Ainslie (Purism) > >> --- > >> drivers/iio/light/vcnl4000.c | 4 ++-- > >> 1 file changed, 2 insertions(+), 2 deletions(-) > >> > >> diff --git a/drivers/iio/light/vcnl4000.c > >> b/drivers/iio/light/vcnl4000.c > >> index 04fd0d4b6f19..5295330b65e2 100644 > >> --- a/drivers/iio/light/vcnl4000.c > >> +++ b/drivers/iio/light/vcnl4000.c > >> @@ -140,10 +140,10 @@ static int vcnl4200_init(struct vcnl4000_data > >> *data) > >> data->rev = (ret >> 8) & 0xf; > >> > >> /* Set defaults and enable both channels */ > >> - ret = i2c_smbus_write_byte_data(data->client, VCNL4200_AL_CONF, > >> 0x00); > >> + ret = i2c_smbus_write_word_data(data->client, VCNL4200_AL_CONF, > >> 0x00); > > > > minor note: the 0x00 looks like a byte. 0 or 0x0000 would be slightly > > better? > > The same below. > > > >> if (ret < 0) > >> return ret; > >> - ret = i2c_smbus_write_byte_data(data->client, VCNL4200_PS_CONF1, > >> 0x00); > >> + ret = i2c_smbus_write_word_data(data->client, VCNL4200_PS_CONF1, > >> 0x00); > > > > The VCNL4200_PS_CONF1 definition is a bit misleading with word write. > > Because > > PS_CONF1 is only a low byte of command code 0x03. The high byte of 0x03 > > is > > PS_CONF2. I would rename it. > > > > As far as a base address for the register that is correct based on the > names in the datasheet. I suppose I could add something like: > > #define VCNL4200_PS_CONF VCNL4200_PS_CONF1 > > and change the reference here if you think that would be more clear. to be honest, I don't know the best practice. As there is also PS_CONF3, I was thinking about PS_CONF1_2, but thinking again, your current name is good enough maybe. Tomas > >> if (ret < 0) > >> return ret; > > > > Anyway, the main point is that I've tested this patch on VCNL4200 and > > it > > works, so: > > Tested-by: Tomas Novotny > > > > T. > > Thanks for testing it > Angus >