Loading drivers/input/touchscreen/hxchipset/himax_common.h +1 −0 Original line number Diff line number Diff line Loading @@ -143,6 +143,7 @@ #define HX_FINGER_LEAVE 2 #define HX_REPORT_SZ 128 #define HX_CMD_BYTE 1 enum HX_TS_PATH { HX_REPORT_COORD = 1, Loading drivers/input/touchscreen/hxchipset/himax_platform.c +22 −18 Original line number Diff line number Diff line Loading @@ -178,29 +178,32 @@ int himax_bus_read(uint8_t command, uint8_t *data, uint32_t length, uint8_t toRe { .addr = client->addr, .flags = 0, .len = 1, .buf = &command, .len = HX_CMD_BYTE, .buf = buf, }, { .addr = client->addr, .flags = I2C_M_RD, .len = length, .buf = buf, .buf = buf + HX_CMD_BYTE, } }; if (length > HX_REPORT_SZ * 2) { I("%s: data length too large %d\n", __func__, length); buf = kmalloc(length, GFP_KERNEL); if (length > HX_REPORT_SZ) { W("%s: data length too large %d!\n", __func__, length); buf = kmalloc(length + HX_CMD_BYTE, GFP_KERNEL); if (!buf) { E("%s: failed realloc buf %d\n", __func__, length); E("%s: failed realloc buf %d\n", __func__, length + HX_CMD_BYTE); return -EIO; } reallocate = true; msg[1].buf = buf; msg[0].buf = buf; msg[1].buf = buf + HX_CMD_BYTE; } mutex_lock(&ts->rw_lock); buf[0] = command; for (retry = 0; retry < toRetry; retry++) { if (i2c_transfer(client->adapter, msg, 2) == 2) Loading @@ -216,7 +219,7 @@ int himax_bus_read(uint8_t command, uint8_t *data, uint32_t length, uint8_t toRe return -EIO; } memcpy(data, buf, length); memcpy(data, buf + HX_CMD_BYTE, length); mutex_unlock(&ts->rw_lock); if (reallocate) Loading @@ -236,16 +239,17 @@ int himax_bus_write(uint8_t command, uint8_t *data, uint32_t length, uint8_t toR { .addr = client->addr, .flags = 0, .len = length + 1, .len = length + HX_CMD_BYTE, .buf = buf, } }; if (length + 1 > HX_REPORT_SZ * 2) { I("%s: data length too large %d\n", __func__, length + 1); buf = kmalloc(length + 1, GFP_KERNEL); if (length > HX_REPORT_SZ) { W("%s: data length too large %d!\n", __func__, length); buf = kmalloc(length + HX_CMD_BYTE, GFP_KERNEL); if (!buf) { E("%s: failed realloc buf %d\n", __func__, length + 1); E("%s: failed realloc buf %d\n", __func__, length + HX_CMD_BYTE); return -EIO; } reallocate = true; Loading @@ -253,7 +257,7 @@ int himax_bus_write(uint8_t command, uint8_t *data, uint32_t length, uint8_t toR mutex_lock(&ts->rw_lock); buf[0] = command; memcpy(buf + 1, data, length); memcpy(buf + HX_CMD_BYTE, data, length); for (retry = 0; retry < toRetry; retry++) { if (i2c_transfer(client->adapter, msg, 1) == 1) Loading Loading @@ -298,8 +302,8 @@ int himax_bus_master_write(uint8_t *data, uint32_t length, uint8_t toRetry) } }; if (length > HX_REPORT_SZ * 2) { I("%s: data length too large %d\n", __func__, length); if (length > HX_REPORT_SZ) { W("%s: data length too large %d!\n", __func__, length); buf = kmalloc(length, GFP_KERNEL); if (!buf) { E("%s: failed realloc buf %d\n", __func__, length); Loading Loading @@ -797,7 +801,7 @@ int himax_chip_common_probe(struct i2c_client *client, const struct i2c_device_i mutex_init(&ts->rw_lock); private_ts = ts; ts->report_i2c_data = kmalloc(HX_REPORT_SZ * 2, GFP_KERNEL); ts->report_i2c_data = kmalloc(HX_REPORT_SZ + HX_CMD_BYTE, GFP_KERNEL); if (ts->report_i2c_data == NULL) { E("%s: allocate report_i2c_data failed\n", __func__); ret = -ENOMEM; Loading Loading
drivers/input/touchscreen/hxchipset/himax_common.h +1 −0 Original line number Diff line number Diff line Loading @@ -143,6 +143,7 @@ #define HX_FINGER_LEAVE 2 #define HX_REPORT_SZ 128 #define HX_CMD_BYTE 1 enum HX_TS_PATH { HX_REPORT_COORD = 1, Loading
drivers/input/touchscreen/hxchipset/himax_platform.c +22 −18 Original line number Diff line number Diff line Loading @@ -178,29 +178,32 @@ int himax_bus_read(uint8_t command, uint8_t *data, uint32_t length, uint8_t toRe { .addr = client->addr, .flags = 0, .len = 1, .buf = &command, .len = HX_CMD_BYTE, .buf = buf, }, { .addr = client->addr, .flags = I2C_M_RD, .len = length, .buf = buf, .buf = buf + HX_CMD_BYTE, } }; if (length > HX_REPORT_SZ * 2) { I("%s: data length too large %d\n", __func__, length); buf = kmalloc(length, GFP_KERNEL); if (length > HX_REPORT_SZ) { W("%s: data length too large %d!\n", __func__, length); buf = kmalloc(length + HX_CMD_BYTE, GFP_KERNEL); if (!buf) { E("%s: failed realloc buf %d\n", __func__, length); E("%s: failed realloc buf %d\n", __func__, length + HX_CMD_BYTE); return -EIO; } reallocate = true; msg[1].buf = buf; msg[0].buf = buf; msg[1].buf = buf + HX_CMD_BYTE; } mutex_lock(&ts->rw_lock); buf[0] = command; for (retry = 0; retry < toRetry; retry++) { if (i2c_transfer(client->adapter, msg, 2) == 2) Loading @@ -216,7 +219,7 @@ int himax_bus_read(uint8_t command, uint8_t *data, uint32_t length, uint8_t toRe return -EIO; } memcpy(data, buf, length); memcpy(data, buf + HX_CMD_BYTE, length); mutex_unlock(&ts->rw_lock); if (reallocate) Loading @@ -236,16 +239,17 @@ int himax_bus_write(uint8_t command, uint8_t *data, uint32_t length, uint8_t toR { .addr = client->addr, .flags = 0, .len = length + 1, .len = length + HX_CMD_BYTE, .buf = buf, } }; if (length + 1 > HX_REPORT_SZ * 2) { I("%s: data length too large %d\n", __func__, length + 1); buf = kmalloc(length + 1, GFP_KERNEL); if (length > HX_REPORT_SZ) { W("%s: data length too large %d!\n", __func__, length); buf = kmalloc(length + HX_CMD_BYTE, GFP_KERNEL); if (!buf) { E("%s: failed realloc buf %d\n", __func__, length + 1); E("%s: failed realloc buf %d\n", __func__, length + HX_CMD_BYTE); return -EIO; } reallocate = true; Loading @@ -253,7 +257,7 @@ int himax_bus_write(uint8_t command, uint8_t *data, uint32_t length, uint8_t toR mutex_lock(&ts->rw_lock); buf[0] = command; memcpy(buf + 1, data, length); memcpy(buf + HX_CMD_BYTE, data, length); for (retry = 0; retry < toRetry; retry++) { if (i2c_transfer(client->adapter, msg, 1) == 1) Loading Loading @@ -298,8 +302,8 @@ int himax_bus_master_write(uint8_t *data, uint32_t length, uint8_t toRetry) } }; if (length > HX_REPORT_SZ * 2) { I("%s: data length too large %d\n", __func__, length); if (length > HX_REPORT_SZ) { W("%s: data length too large %d!\n", __func__, length); buf = kmalloc(length, GFP_KERNEL); if (!buf) { E("%s: failed realloc buf %d\n", __func__, length); Loading Loading @@ -797,7 +801,7 @@ int himax_chip_common_probe(struct i2c_client *client, const struct i2c_device_i mutex_init(&ts->rw_lock); private_ts = ts; ts->report_i2c_data = kmalloc(HX_REPORT_SZ * 2, GFP_KERNEL); ts->report_i2c_data = kmalloc(HX_REPORT_SZ + HX_CMD_BYTE, GFP_KERNEL); if (ts->report_i2c_data == NULL) { E("%s: allocate report_i2c_data failed\n", __func__); ret = -ENOMEM; Loading