Received: by 10.192.165.156 with SMTP id m28csp2742089imm; Sun, 15 Apr 2018 08:03:56 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/5KV8AopUJkgYNke5x0nqWb1wvnMoNAZYpWNT+sm67bGM7IGfLecUnMqU9qO3hyMHEO8Y4 X-Received: by 2002:a17:902:5681:: with SMTP id j1-v6mr11918461pli.383.1523804636504; Sun, 15 Apr 2018 08:03:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523804636; cv=none; d=google.com; s=arc-20160816; b=U9hkGQ0WgrGRTy0YxkDaA0ZRDJhVfsN45lAMYIP7y4Yqmo5H07hL47dEGI2bFHb/Z+ qZtBmqZDoTMa9RzJ3VUt2I0ftf0v/XzLXbrisEs3PpEhjQ68DHDdjlWWN8wkF9fUdXfz b4hKTcPlho9u1RiihtH4uqf56+MK5qXaj4Umi/A8ukjhIxl8SAvKpvoT65o+LNxYle0N oG0+eC1dZwjSRsc0+DFm7hjNkmd6VabRTMYfQn8dfsBYDvY7l5A8+C8+zClNZtgxmcG2 nvMGKv3pmiBz/iVyavX9hhQ9wVwvV+lATlaz+xpsmWD3dCkDOfHTO2LMDvT7GD868acV rgDw== 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 :dmarc-filter:arc-authentication-results; bh=iqk7/vKIHOu8T4tShuy64MPxX7GZTz+claXuIl4oubQ=; b=U+VKYdmTX2A9VzeM9VLiuZxKuHZKS1oQekizDRAfxB+WXEO56l25Da4LXXVJEgDs4I P8PCUX6u1QhS0LATVcEDX8xVZU7YwNtUVZ3ubUb6bcJhL93ApV4Sdn0M4723fLSkXuJX x8Nhq9uurNvUZVCwt+NsoOb8XiUonrTpedJoF9p9CBomY8HOilYiE8gR4eWn5mMB9nW+ w4fjPCgPLvXcjARGMCMOz3HtFA+S7UDczNgIWahZQb+ve/UIbjpsmJe5AqFmn/nBBoXQ wjMm9LUchyILeV0wGIvcR+U0Ok2MYBtZWIwJRevv5RCERQlUMJ5OolEK6Dlb1+mvCqTv dYzQ== 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 p8-v6si10153889plo.295.2018.04.15.08.03.43; Sun, 15 Apr 2018 08:03:56 -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 S1753201AbeDOPCR convert rfc822-to-8bit (ORCPT + 99 others); Sun, 15 Apr 2018 11:02:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:38018 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753145AbeDOPCM (ORCPT ); Sun, 15 Apr 2018 11:02:12 -0400 Received: from archlinux (cpc91196-cmbg18-2-0-cust659.5-4.cable.virginm.net [81.96.234.148]) (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 30A3D20779; Sun, 15 Apr 2018 15:02:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 30A3D20779 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=jic23@kernel.org Date: Sun, 15 Apr 2018 16:02:07 +0100 From: Jonathan Cameron To: =?UTF-8?B?SGVybsOhbg==?= Gonzalez Cc: knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net, gregkh@linuxfoundation.org, Michael.Hennerich@analog.com, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 01/14] staging: iio: ad7746: Automatically swap values in readings/writings Message-ID: <20180415160207.59f6b698@archlinux> In-Reply-To: <1523637411-8531-2-git-send-email-hernan@vanguardiasur.com.ar> References: <1523637411-8531-1-git-send-email-hernan@vanguardiasur.com.ar> <1523637411-8531-2-git-send-email-hernan@vanguardiasur.com.ar> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 13 Apr 2018 13:36:38 -0300 Hernán Gonzalez wrote: > Data to read or write was being handled with the swab16() macro instead > of using i2c_smbus_{read,write}_swapped. > > Signed-off-by: Hernán Gonzalez Applied to the togreg branch of iio.git and pushed out as testing for the autobuilders to play with it. Thanks, Jonathan > --- > drivers/staging/iio/cdc/ad7746.c | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/drivers/staging/iio/cdc/ad7746.c b/drivers/staging/iio/cdc/ad7746.c > index 4882dbc..53e28ae 100644 > --- a/drivers/staging/iio/cdc/ad7746.c > +++ b/drivers/staging/iio/cdc/ad7746.c > @@ -451,7 +451,7 @@ static int ad7746_write_raw(struct iio_dev *indio_dev, > goto out; > } > > - ret = i2c_smbus_write_word_data(chip->client, reg, swab16(val)); > + ret = i2c_smbus_write_word_swapped(chip->client, reg, val); > if (ret < 0) > goto out; > > @@ -462,8 +462,8 @@ static int ad7746_write_raw(struct iio_dev *indio_dev, > ret = -EINVAL; > goto out; > } > - ret = i2c_smbus_write_word_data(chip->client, > - AD7746_REG_CAP_OFFH, swab16(val)); > + ret = i2c_smbus_write_word_swapped(chip->client, > + AD7746_REG_CAP_OFFH, val); > if (ret < 0) > goto out; > > @@ -594,21 +594,21 @@ static int ad7746_read_raw(struct iio_dev *indio_dev, > goto out; > } > > - ret = i2c_smbus_read_word_data(chip->client, reg); > + ret = i2c_smbus_read_word_swapped(chip->client, reg); > if (ret < 0) > goto out; > /* 1 + gain_val / 2^16 */ > *val = 1; > - *val2 = (15625 * swab16(ret)) / 1024; > + *val2 = (15625 * ret) / 1024; > > ret = IIO_VAL_INT_PLUS_MICRO; > break; > case IIO_CHAN_INFO_CALIBBIAS: > - ret = i2c_smbus_read_word_data(chip->client, > - AD7746_REG_CAP_OFFH); > + ret = i2c_smbus_read_word_swapped(chip->client, > + AD7746_REG_CAP_OFFH); > if (ret < 0) > goto out; > - *val = swab16(ret); > + *val = ret; > > ret = IIO_VAL_INT; > break;