Received: by 10.192.165.156 with SMTP id m28csp897319imm; Fri, 13 Apr 2018 09:39:54 -0700 (PDT) X-Google-Smtp-Source: AIpwx48gRaHe0AMbxON9wlD1msZ7MfKtxMfL62UKvaWGOgS0KDKRDVWCV9en7i5XwYBKI4RoVWcT X-Received: by 10.98.204.214 with SMTP id j83mr12273054pfk.182.1523637594170; Fri, 13 Apr 2018 09:39:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523637594; cv=none; d=google.com; s=arc-20160816; b=tRYzWKRrvQtOx9Gv6zuH4/EPaBLpBlNHXBc2pkh/obSU4xvYK/BrQtQGQ+mZbwJqBo wFHWeqeSAttZ76RLuf18fSRGN2OWE/uUJgABZG6vLSvk7mDXZWJt91vO4bqBSvG2dfUY 0LwT6tS7Zga35Lb5igNiQZiP/T+04aqkDcRuHb2+aYEl0G0eKj6gOMEqonoi1PAJZa6b XNtA1Sidlw8jh0Lq9kWlqB5JZTUuJpf61ZQ0ZOOLp/0Je9DRVotAlwvhi37cDIDyD83W jxKh5PmY06Bl/sgv48CKxqsGVTDwT7+I3QYaOaMxmStU7Ih40ZSN06Fp7fqlzEUC6EMf OIag== 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:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=AQ+TIPQWmENrQncV6f3ZGjV/67cQJ+PcqdWnTWyhAFM=; b=V8UUBxo42e6lpu7h9E8tdDiSaXftsDIQOubOijbtmEK+6f4UYz/ga/S8t1fPrLA5sg UFp/Cdrj8QyDVe8CvlLrVcVhC8Jp59h/l7hglZ1tPdTZapllWlOMKIS15CMW5BWpIEYd XvESgcQsgY8EX2IhBLbe2mp51c6y8NFH4faTQNvJhGI9DVe2Q3kTq8Xea38s5jTJgdyq D2UYgMrLbQ/kqGyzYATZPhzYSzTdMtSpPPeIzLKqjOeUdn90/kxMG5mBOmQoEpZwAV/H nN727Z8+MkOD2RxVBZ4CSX9p67G1UhjYfwYG68DynNP654SnialkXZdom97n1F73wiIA lY5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@vanguardiasur-com-ar.20150623.gappssmtp.com header.s=20150623 header.b=Xbgltohd; 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 f8si4264091pgo.689.2018.04.13.09.39.40; Fri, 13 Apr 2018 09:39:54 -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; dkim=pass header.i=@vanguardiasur-com-ar.20150623.gappssmtp.com header.s=20150623 header.b=Xbgltohd; 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 S1753040AbeDMQhs (ORCPT + 99 others); Fri, 13 Apr 2018 12:37:48 -0400 Received: from mail-qt0-f194.google.com ([209.85.216.194]:34114 "EHLO mail-qt0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752999AbeDMQhp (ORCPT ); Fri, 13 Apr 2018 12:37:45 -0400 Received: by mail-qt0-f194.google.com with SMTP id a25so2358301qtm.1 for ; Fri, 13 Apr 2018 09:37:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vanguardiasur-com-ar.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AQ+TIPQWmENrQncV6f3ZGjV/67cQJ+PcqdWnTWyhAFM=; b=XbgltohdxD0CaR+AtF/a2xKAloRrt1CEjnZHdF6M3RH/m+2+8AQuFiBmpq1MsH96Q/ BO9eZq4tZ0ZDn4MTjZ0CHYWBW2eq5YhtFqkhlBKC7pslpvEQ9/uHJjbagRO7wk8wwiWM J6is/Le6c7filuOovKs8kZjLUQF11D7edxA+oyBzG9PowcmVjq3kGPGZwgqzYufydhMf aR5y5oUSCSpsJHAmKW2gpoN7bFw6lYe2DdPWp767El8yuMlYWNF5l+kNEvWvtC5SQB8v 8ikBwkkVGRnTve1NDA93VnWFlfRDl4+0UmjFwWZ6WfedS6L9FmZnYN7CLIrZZlgsPETX GrCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AQ+TIPQWmENrQncV6f3ZGjV/67cQJ+PcqdWnTWyhAFM=; b=e6/SeFNt2VgvFWtlfxxUs4vwe41Q2VgI+tehUPxtGr3dNxcau3HVl+iTc+TjTNGAjl l8dGB9EmKi9YQ0LSeCyJa0JHJgTkYXRKK+yDB8w0ENn8T1nvLos1h6FVPnmreNu8MA3B SDmFhVhnDGINbWP1XMQW/OEMXCSdhj1T4bgCJFV9UQ6iWaGQKcdYBdCmTvKUIpf5xrLC IlsdxQeBHXC8BP1EiydQirCf13M1SMevGOuHTo8UvYvb9btXcwDw9Q3BiXKjdyPH/xEm OBvANHRsnTGQ2i3ftmpIzxmHa8dgGNbc2dvS+BDiLoI9P4LgUeYXp3uO/pMwqQS6xSHW IOqQ== X-Gm-Message-State: ALQs6tBNoJHwqcv0UD9+W08EiD9zBkRKqDMLhJVCzM02phKsKNpYkpP8 O8HWgO+JCiszcjQ9o+ZDou4T1A== X-Received: by 10.200.37.85 with SMTP id 21mr3926344qtn.270.1523637465233; Fri, 13 Apr 2018 09:37:45 -0700 (PDT) Received: from localhost.localdomain ([190.210.56.45]) by smtp.gmail.com with ESMTPSA id t82sm5024687qke.52.2018.04.13.09.37.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 13 Apr 2018 09:37:44 -0700 (PDT) From: =?UTF-8?q?Hern=C3=A1n=20Gonzalez?= To: jic23@kernel.org, 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 Cc: =?UTF-8?q?Hern=C3=A1n=20Gonzalez?= Subject: [PATCH v2 01/14] staging: iio: ad7746: Automatically swap values in readings/writings Date: Fri, 13 Apr 2018 13:36:38 -0300 Message-Id: <1523637411-8531-2-git-send-email-hernan@vanguardiasur.com.ar> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1523637411-8531-1-git-send-email-hernan@vanguardiasur.com.ar> References: <1523637411-8531-1-git-send-email-hernan@vanguardiasur.com.ar> 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 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 --- 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; -- 2.7.4