From patchwork Sat Mar 25 06:00:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 9644417 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 7014F60327 for ; Sat, 25 Mar 2017 06:01:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5FE5F26E48 for ; Sat, 25 Mar 2017 06:01:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5464626E4E; Sat, 25 Mar 2017 06:01:21 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 E6A83269A3 for ; Sat, 25 Mar 2017 06:01:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967547AbdCYGBI (ORCPT ); Sat, 25 Mar 2017 02:01:08 -0400 Received: from mail-pg0-f65.google.com ([74.125.83.65]:35645 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967314AbdCYGAy (ORCPT ); Sat, 25 Mar 2017 02:00:54 -0400 Received: by mail-pg0-f65.google.com with SMTP id g2so1704691pge.2; Fri, 24 Mar 2017 23:00:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qJfpaq+SMV8zgj/izmkB/Ps2xEtKkmYW4ROjFKgdJuk=; b=i5TmA4GDEomP8nBliDk6KHNM3eNVQIPJ840tjfW66Lmb/tbp4citSS3jl/ACixFBLA 3ASmN3evc0iLY6wyKK/i5BhqM7iRDHaY+4reW9TpGK0xAGDWw9Y/1cB/Wpn0z1fj1Byc YYexnXwOOyqiJEqfIoiPqvDpXP4L+nWpfZSJJM3j5wK+0j8mA5wYaphp4I09BOv5ul4Y Shgm8y0YBb5oN0bfnAYnIg6wrtw2fEqpMCI3uz7n/8mBuae4XfC+0jqZTrmIPqFL4Tkz 2PIwfJ/CIAu1skc1/soVvQ6D6lZk/HJLUTyQqQGQFWOEUV24djfcFmZdCdndJ/TDmFzf P2Cg== 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; bh=qJfpaq+SMV8zgj/izmkB/Ps2xEtKkmYW4ROjFKgdJuk=; b=QUZdrXIqIaG3sY7ej08SwxJ8EhcS2OfVy5br/PtH6WRw109tECq0ngSmK4gBTlN04w rypDdPhw/SZbbv0sVhdF3CntLoZtQtWia9ITTFSe6/ATWdX0av8OL3C2sSzZNK40LObW W4N5rfVEu6ZrlP1MAF6WQbD0NW/KZFM0OrI6pM8khCEkvyfqkLQu6WFAPUNT81eL2g2X 0KIPJ5oK8V5vclzqcdwXGivi2QvtfIOpxPBEA+LHjkUna8iMxWK+K3umTaJI/qAFtXbp vHbScyqLFd0qgBkTiyr6SEuLeRIVSvPLEDkpwVO/J5R+fqIoEa/I0bWUeMT9KIH6T7Wq 4hxg== X-Gm-Message-State: AFeK/H0dAVwnR8YN6iT/NoGs1Y/PB3TnkNVcD2EPu/wqXsNf/Nn5j7xVCXG8ofpZdwewEw== X-Received: by 10.98.33.68 with SMTP id h65mr13730579pfh.214.1490421653235; Fri, 24 Mar 2017 23:00:53 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([172.22.152.34]) by smtp.gmail.com with ESMTPSA id b128sm7916225pfg.54.2017.03.24.23.00.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Mar 2017 23:00:52 -0700 (PDT) From: Dmitry Torokhov To: Benjamin Tissoires , Andrew Duggan Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Nick Dyer Subject: [PATCH 2/4] Input: synaptics-rmi4 - fix endianness issue in SMBus transport Date: Fri, 24 Mar 2017 23:00:48 -0700 Message-Id: <20170325060050.39867-2-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.12.1.578.ge9c3154ca4-goog In-Reply-To: <20170325060050.39867-1-dmitry.torokhov@gmail.com> References: <20170325060050.39867-1-dmitry.torokhov@gmail.com> Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The mapping table holds address in LE form, so we should convert it to CPU when comparing it. Signed-off-by: Dmitry Torokhov --- drivers/input/rmi4/rmi_smbus.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/input/rmi4/rmi_smbus.c b/drivers/input/rmi4/rmi_smbus.c index 76752555d809..c8bf49686460 100644 --- a/drivers/input/rmi4/rmi_smbus.c +++ b/drivers/input/rmi4/rmi_smbus.c @@ -89,17 +89,16 @@ static int rmi_smb_get_command_code(struct rmi_transport_dev *xport, mutex_lock(&rmi_smb->mappingtable_mutex); for (i = 0; i < RMI_SMB2_MAP_SIZE; i++) { - if (rmi_smb->mapping_table[i].rmiaddr == rmiaddr) { + struct mapping_table_entry *entry = &rmi_smb->mapping_table[i]; + if (le16_to_cpu(entry->rmiaddr) == rmiaddr) { if (isread) { - if (rmi_smb->mapping_table[i].readcount - == bytecount) { + if (entry->readcount == bytecount) { *commandcode = i; retval = 0; goto exit; } } else { - if (rmi_smb->mapping_table[i].flags & - RMI_SMB2_MAP_FLAGS_WE) { + if (entry->flags & RMI_SMB2_MAP_FLAGS_WE) { *commandcode = i; retval = 0; goto exit;