Update cm3602, crucial, and synaptics touchscreen to glacier
/drivers/input/opticaljoystick/curcial.c
blob:7af405060204148b0a360c72b5a6ad7683afe1cd -> blob:86499916be022be18c816cfe262df850db731e17
--- drivers/input/opticaljoystick/curcial.c
+++ drivers/input/opticaljoystick/curcial.c
@@ -238,8 +238,8 @@ static void curcial_oj_work_func(struct
bool out = false;
uint8_t pxsum;
uint16_t sht;
- int16_t x_sum;
- int16_t y_sum;
+ int16_t x_sum, x_idx;
+ int16_t y_sum, y_idx;
curcial_oj_polling_mode(OJ_POLLING_DISABLE);
@@ -317,8 +317,15 @@ static void curcial_oj_work_func(struct
}
}
- x_count = oj->Xsteps[abs(x_sum) / normal_th];
- y_count = oj->Ysteps[abs(y_sum) / normal_th];
+ x_idx = abs(x_sum) / normal_th;
+ y_idx = abs(y_sum) / normal_th;
+ if (x_idx >= ARRAY_SIZE(oj->Xsteps))
+ x_idx = ARRAY_SIZE(oj->Xsteps) - 1;
+ if (y_idx >= ARRAY_SIZE(oj->Ysteps))
+ y_idx = ARRAY_SIZE(oj->Ysteps) - 1;
+
+ x_count = oj->Xsteps[x_idx];
+ y_count = oj->Ysteps[y_idx];
if (evtKey == OJ_KEY_LEFT) {
for (j = 0; j < x_count; j++) {
input_report_rel(oj->input_dev, REL_X, -1);
@@ -362,7 +369,7 @@ static void curcial_oj_work_func(struct
mDeltaX = 0;
mDeltaY = 0;
if (polling_delay)
- msleep(polling_delay);/*hr_msleep(polling_delay);*/
+ hr_msleep(polling_delay);
} while ((data[0] & 0x80) && (!atomic_read(&suspend_flag)));