Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1609106
| From | Dmitry Torokhov <dmitry.torokhov@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 2/4] Input: synaptics-rmi4 - fix endianness issue in SMBus transport |
| Date | 2017-03-25 07:10 +0100 |
| Message-ID | <toN3H-59k-15@gated-at.bofh.it> (permalink) |
| References | <toN3H-59k-1@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
The mapping table holds address in LE form, so we should convert it
to CPU when comparing it.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
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;
--
2.12.1.578.ge9c3154ca4-goog
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 1/4] Input: synaptics-rmi4 - fix handling failures from rmi_enable_sensor Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-03-25 07:10 +0100 [PATCH 4/4] Input: synaptics-rmi4 - when registering sensors do not call them "drivers" Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-03-25 07:10 +0100 [PATCH 3/4] Input: synaptics-rmi4 - cleanup SMbus mapping handling Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-03-25 07:10 +0100 [PATCH 2/4] Input: synaptics-rmi4 - fix endianness issue in SMBus transport Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2017-03-25 07:10 +0100
csiph-web