summaryrefslogtreecommitdiff
path: root/drivers/input/rmi4/rmi_smbus.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2017-03-24 12:34:20 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2017-04-03 16:23:59 -0700
commit2593cd1189a2a38a17c97abcd847f28f8a4617be (patch)
tree802ebc6253e5b7e74395bce775fee0b4d2c0060b /drivers/input/rmi4/rmi_smbus.c
parent8cf0adf2f8c3f9f30ba4f1b79e051993aea158d7 (diff)
Input: synaptics-rmi4 - fix endianness issue in SMBus transport
The mapping table holds address in LE form, so we should convert it to CPU when comparing it. Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/rmi4/rmi_smbus.c')
-rw-r--r--drivers/input/rmi4/rmi_smbus.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/input/rmi4/rmi_smbus.c b/drivers/input/rmi4/rmi_smbus.c
index 76752555d809..6bb67baa1b77 100644
--- a/drivers/input/rmi4/rmi_smbus.c
+++ b/drivers/input/rmi4/rmi_smbus.c
@@ -89,17 +89,17 @@ 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;