Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp2481956ybz; Sun, 3 May 2020 02:03:20 -0700 (PDT) X-Google-Smtp-Source: APiQypIUjjJi90Pj6nCuIboqZeUh5TFdS1TwI+fV2Znpr6frnITSTh2tLKYzeGU8rGrU3j/LKOYl X-Received: by 2002:a17:906:31d7:: with SMTP id f23mr10139335ejf.118.1588496600819; Sun, 03 May 2020 02:03:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588496600; cv=none; d=google.com; s=arc-20160816; b=mNj1xjRmdx+0jzgLJ63SVNdESYQv0p9RbPQgo1zbKo7l8f6RsT5MhablhM/wNl+3KL 8ZPhCVac9tPDYXAelbFWHqiGV9cmJqft1OxXVtrUDqXt4Pl3wNuCCB5eTcAZIkNC6efp gc/As/ql/U7lXp349p/hdP6IYZN0X1owLuCivgxV6eCNUQjwvjcuP1bbZRHt7nm14LuO qUn8PDGedmibiYShK/si7jGcUNg0aCjj18eCstpYfyiSLUelz1UISdLtTbl63zLL2Z2i CGTa9LUPrHdJ65pyuoFV12jlfH8T45oEGsOOrIps/5Uq6Mia7vHT7PHiHKAeLsi/AKcb DejQ== 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 :dkim-signature; bh=eLjp71zB4Hjr4ESzAR0ZZEMH3x+4qnaOxn5yKS2zfCA=; b=iPPisKJbb8jMOWPkd7c14tVwU0nXsT9JEK4oC1o14XQ3f0yWwaxmn/Ux0ydkr3u3Ex pdwZP65kEp67pSKyRXPd3mWScmsKMjX0Ix09dTTbu7b2iK7sIsdwnXjFmiDKYoG/+YVv ON1Ybojsn2Akc8T+7tPXCvoo7lEbC+E1QtVOunAKyQk6jTA26f89waEQyJK+4TwrvEy0 RzFkZi/yOp6oTarbufmKbmbptY9axrd0DO7XfAB7uXl8UVDxRcOV5YuE3I+NW34rzSJu l4BcO6vBLk5H5rV35AkNKNhS+r3Cy52EWnc6oGfW3ysBc0oiU/1c9cDSqmjluu/psH6W I5xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bssdfKQm; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l27si5008079edj.537.2020.05.03.02.02.57; Sun, 03 May 2020 02:03:20 -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; dkim=pass header.i=@kernel.org header.s=default header.b=bssdfKQm; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727891AbgECI6k (ORCPT + 99 others); Sun, 3 May 2020 04:58:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:40392 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726445AbgECI6j (ORCPT ); Sun, 3 May 2020 04:58:39 -0400 Received: from archlinux (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F225620757; Sun, 3 May 2020 08:58:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1588496319; bh=PzPJwhdog6n665ICQFUm4hWA02sPJblPykFkeetcIk4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=bssdfKQmpxdwtkl3EoF629epL3V7tK/iUBx8FX4iENSz5kLmrX5UEWbs9UcI/yCFx X5SWJFoyymHdn3uIPtYQcnTKz6IJdRZHa6Ium2icqI1eiige7zUG4wVNnDi/8np1pb 99ZaqRDsSdQIYCYnzNFxPp6g7BGU9Q4abHIFelSg= Date: Sun, 3 May 2020 09:58:35 +0100 From: Jonathan Cameron To: Mathieu Othacehe Cc: knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v6 1/5] iio: vcnl4000: Fix i2c swapped word reading. Message-ID: <20200503095835.37a9bcf2@archlinux> In-Reply-To: <20200427095559.16131-2-m.othacehe@gmail.com> References: <20200427095559.16131-1-m.othacehe@gmail.com> <20200427095559.16131-2-m.othacehe@gmail.com> X-Mailer: Claws Mail 3.17.5 (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 Mon, 27 Apr 2020 11:55:55 +0200 Mathieu Othacehe wrote: > The bytes returned by the i2c reading need to be swapped > unconditionally. Otherwise, on be16 platforms, an incorrect value will be > returned. Missing sign off so I can't apply. Also, please add an appropriate fixes tag. Once that's fixed I'll probably be a bit naughty with this one and mark it for stable, but take it for the next merge window. Bug has been there a while without anyone noticing so I don't mind delaying fixing it a little longer to make it easier to merge the rest of the series. Thanks, Jonathan > --- > drivers/iio/light/vcnl4000.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c > index 58e97462e803..e5f86bd00fb0 100644 > --- a/drivers/iio/light/vcnl4000.c > +++ b/drivers/iio/light/vcnl4000.c > @@ -219,7 +219,6 @@ static int vcnl4000_measure(struct vcnl4000_data *data, u8 req_mask, > u8 rdy_mask, u8 data_reg, int *val) > { > int tries = 20; > - __be16 buf; > int ret; > > mutex_lock(&data->vcnl4000_lock); > @@ -246,13 +245,12 @@ static int vcnl4000_measure(struct vcnl4000_data *data, u8 req_mask, > goto fail; > } > > - ret = i2c_smbus_read_i2c_block_data(data->client, > - data_reg, sizeof(buf), (u8 *) &buf); > + ret = i2c_smbus_read_word_swapped(data->client, data_reg); > if (ret < 0) > goto fail; > > mutex_unlock(&data->vcnl4000_lock); > - *val = be16_to_cpu(buf); > + *val = ret; > > return 0; >