From patchwork Mon Jan 1 18:54:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 10139203 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 500BB60596 for ; Mon, 1 Jan 2018 18:55:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43EE42654B for ; Mon, 1 Jan 2018 18:55:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 38EC1285D5; Mon, 1 Jan 2018 18:55:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03CE628468 for ; Mon, 1 Jan 2018 18:55:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751728AbeAASzD (ORCPT ); Mon, 1 Jan 2018 13:55:03 -0500 Received: from mail-wr0-f196.google.com ([209.85.128.196]:37656 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751667AbeAASzD (ORCPT ); Mon, 1 Jan 2018 13:55:03 -0500 Received: by mail-wr0-f196.google.com with SMTP id f8so36103323wre.4 for ; Mon, 01 Jan 2018 10:55:02 -0800 (PST) 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; bh=1abuDfq40aJUKAT5Iyhdp9hxz0OcYtKQfagwguBkoJQ=; b=j4Ziz6uh6S50enmXf6FrMHVosBmXI/hCy7sUHcWYtw+H1lAmzMbPnWdjsz69zCD6fQ 0Y4q2hjeVTYabp5hsk691QN/sbD8hnQipjx/AxBq5ohbq51psKCCIpvH8NQeujAtf8Jl 6R1hd77RuQQ3FhB798T6fi4pst21oJ2DrDz2v3tnz4ZgLW4AhzhtCYt6Wge45aoD2szd tsxqlxmtVXUbBKFQKkD0e2eD13X274M/L3xv2wUUZzT16GzJna4nAd18OwXDOXtKkBy9 6AopZLfXkWuSZCLmMXkrDSM+fs3VfIWihVrWF3Cku3BvWickTC5IyWgXKdZX4ZJ9yq/j QC8Q== X-Gm-Message-State: AKGB3mKMpkFFBnmNHIjEdos7+7SZWalFiIcXYGh2p8kOJct4ExDqQXYJ yYDLdaLlYLdqSxk4Q38JkvENKtmFDBM= X-Google-Smtp-Source: ACJfBov+YcuqjrbB7dC0RZZcXo8OhPHcXto8H17hGO3Fl3IJvCn7NGYQBQrTtJ0wb0WHH34e9yWqiA== X-Received: by 10.223.132.35 with SMTP id 32mr45319086wrf.248.1514832902112; Mon, 01 Jan 2018 10:55:02 -0800 (PST) Received: from localhost.localdomain ([151.66.78.0]) by smtp.gmail.com with ESMTPSA id f4sm57959688wra.75.2018.01.01.10.55.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Jan 2018 10:55:01 -0800 (PST) From: Lorenzo Bianconi To: jic23@kernel.org Cc: linux-iio@vger.kernel.org Subject: [PATCH 1/3] iio: imu: st_lsm6dsx: fix endianness in st_lsm6dsx_read_oneshot() Date: Mon, 1 Jan 2018 19:54:42 +0100 Message-Id: <20180101185444.22045-2-lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.15.1 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Apply le16_to_cpu() to data read from the sensor in order to take into account architecture endianness Fixes: 290a6ce11d93 (iio: imu: add support to lsm6dsx driver) Signed-off-by: Lorenzo Bianconi --- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c index 239c735242be..812cd25f284e 100644 --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c @@ -448,7 +448,7 @@ static int st_lsm6dsx_read_oneshot(struct st_lsm6dsx_sensor *sensor, st_lsm6dsx_sensor_disable(sensor); - *val = (s16)data; + *val = (s16)le16_to_cpu(data); return IIO_VAL_INT; }