Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d8b55cd9 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "input: touchscreen: hxchipset: fix bug in i2c_write function"

parents de5677c7 93ab7223
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2240,7 +2240,7 @@ void himax_chip_common_deinit(void)
	kfree(hx_touch_data);
	kfree(ic_data);
	kfree(ts->pdata);
	kfree(ts->report_i2c_data);
	kfree(ts->i2c_data);
	kfree(ts);
	probe_fail_flag = 0;
}
+1 −1
Original line number Diff line number Diff line
@@ -365,7 +365,7 @@ struct himax_ts_data {
	struct work_struct ito_test_work;
#endif

	uint8_t *report_i2c_data;
	uint8_t *i2c_data; /* for I2C DMA transfer */
};

struct himax_debug {
+15 −12
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

#include "himax_platform.h"
#include "himax_common.h"
#include "himax_ic_core.h"

int i2c_error_count;
int irq_enable_count;
@@ -172,7 +173,7 @@ int himax_bus_read(uint8_t command, uint8_t *data, uint32_t length, uint8_t toRe
	int retry;
	bool reallocate = false;
	struct himax_ts_data *ts = private_ts;
	uint8_t *buf = ts->report_i2c_data;
	uint8_t *buf = ts->i2c_data;
	struct i2c_client *client = ts->client;
	struct i2c_msg msg[] = {
		{
@@ -189,7 +190,7 @@ int himax_bus_read(uint8_t command, uint8_t *data, uint32_t length, uint8_t toRe
		}
	};

	if (length > HX_REPORT_SZ) {
	if (length > FLASH_RW_MAX_LEN) {
		W("%s: data length too large %d!\n", __func__, length);
		buf = kmalloc(length + HX_CMD_BYTE, GFP_KERNEL);
		if (!buf) {
@@ -233,7 +234,7 @@ int himax_bus_write(uint8_t command, uint8_t *data, uint32_t length, uint8_t toR
	int retry;
	bool reallocate = false;
	struct himax_ts_data *ts = private_ts;
	uint8_t *buf = ts->report_i2c_data;
	uint8_t *buf = ts->i2c_data;
	struct i2c_client *client = ts->client;
	struct i2c_msg msg[] = {
		{
@@ -244,7 +245,7 @@ int himax_bus_write(uint8_t command, uint8_t *data, uint32_t length, uint8_t toR
		}
	};

	if (length > HX_REPORT_SZ) {
	if (length > FLASH_RW_MAX_LEN) {
		W("%s: data length too large %d!\n", __func__, length);
		buf = kmalloc(length + HX_CMD_BYTE, GFP_KERNEL);
		if (!buf) {
@@ -253,6 +254,7 @@ int himax_bus_write(uint8_t command, uint8_t *data, uint32_t length, uint8_t toR
			return -EIO;
		}
		reallocate = true;
		msg[0].buf = buf;
	}

	mutex_lock(&ts->rw_lock);
@@ -291,7 +293,7 @@ int himax_bus_master_write(uint8_t *data, uint32_t length, uint8_t toRetry)
	int retry;
	bool reallocate = false;
	struct himax_ts_data *ts = private_ts;
	uint8_t *buf = ts->report_i2c_data;
	uint8_t *buf = ts->i2c_data;
	struct i2c_client *client = private_ts->client;
	struct i2c_msg msg[] = {
		{
@@ -302,7 +304,7 @@ int himax_bus_master_write(uint8_t *data, uint32_t length, uint8_t toRetry)
		}
	};

	if (length > HX_REPORT_SZ) {
	if (length > FLASH_RW_MAX_LEN) {
		W("%s: data length too large %d!\n", __func__, length);
		buf = kmalloc(length, GFP_KERNEL);
		if (!buf) {
@@ -310,6 +312,7 @@ int himax_bus_master_write(uint8_t *data, uint32_t length, uint8_t toRetry)
			return -EIO;
		}
		reallocate = true;
		msg[0].buf = buf;
	}

	mutex_lock(&ts->rw_lock);
@@ -801,11 +804,11 @@ 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 + HX_CMD_BYTE, GFP_KERNEL);
	if (ts->report_i2c_data == NULL) {
		E("%s: allocate report_i2c_data failed\n", __func__);
	ts->i2c_data = kmalloc(FLASH_RW_MAX_LEN + HX_CMD_BYTE, GFP_KERNEL);
	if (ts->i2c_data == NULL) {
		E("%s: allocate i2c_data failed\n", __func__);
		ret = -ENOMEM;
		goto err_report_i2c_data;
		goto err_alloc_i2c_data;
	}

	/*
@@ -822,8 +825,8 @@ int himax_chip_common_probe(struct i2c_client *client, const struct i2c_device_i
	return ret;

err_fb_notify_reg_failed:
	kfree(ts->report_i2c_data);
err_report_i2c_data:
	kfree(ts->i2c_data);
err_alloc_i2c_data:
	kfree(ts);
err_alloc_data_failed:
err_check_functionality_failed: