| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * ALPS touchpad PS/2 mouse driver |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 9 | 10 | * |
|---|
| 10 | 11 | * ALPS detection, tap switching and status querying info is taken from |
|---|
| 11 | 12 | * tpconfig utility (by C. Scott Ananian and Bruce Kall). |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 14 | | - * under the terms of the GNU General Public License version 2 as published by |
|---|
| 15 | | - * the Free Software Foundation. |
|---|
| 16 | 13 | */ |
|---|
| 17 | 14 | |
|---|
| 18 | 15 | #include <linux/slab.h> |
|---|
| .. | .. |
|---|
| 855 | 852 | x = y = z = 0; |
|---|
| 856 | 853 | |
|---|
| 857 | 854 | /* Divide 4 since trackpoint's speed is too fast */ |
|---|
| 858 | | - input_report_rel(dev2, REL_X, (char)x / 4); |
|---|
| 859 | | - input_report_rel(dev2, REL_Y, -((char)y / 4)); |
|---|
| 855 | + input_report_rel(dev2, REL_X, (s8)x / 4); |
|---|
| 856 | + input_report_rel(dev2, REL_Y, -((s8)y / 4)); |
|---|
| 860 | 857 | |
|---|
| 861 | 858 | psmouse_report_standard_buttons(dev2, packet[3]); |
|---|
| 862 | 859 | |
|---|
| .. | .. |
|---|
| 1107 | 1104 | ((packet[3] & 0x20) << 1); |
|---|
| 1108 | 1105 | z = (packet[5] & 0x3f) | ((packet[3] & 0x80) >> 1); |
|---|
| 1109 | 1106 | |
|---|
| 1110 | | - input_report_rel(dev2, REL_X, (char)x); |
|---|
| 1111 | | - input_report_rel(dev2, REL_Y, -((char)y)); |
|---|
| 1107 | + input_report_rel(dev2, REL_X, (s8)x); |
|---|
| 1108 | + input_report_rel(dev2, REL_Y, -((s8)y)); |
|---|
| 1112 | 1109 | input_report_abs(dev2, ABS_PRESSURE, z); |
|---|
| 1113 | 1110 | |
|---|
| 1114 | 1111 | psmouse_report_standard_buttons(dev2, packet[1]); |
|---|
| .. | .. |
|---|
| 1932 | 1929 | static int alps_absolute_mode_v6(struct psmouse *psmouse) |
|---|
| 1933 | 1930 | { |
|---|
| 1934 | 1931 | u16 reg_val = 0x181; |
|---|
| 1935 | | - int ret = -1; |
|---|
| 1932 | + int ret; |
|---|
| 1936 | 1933 | |
|---|
| 1937 | 1934 | /* enter monitor mode, to write the register */ |
|---|
| 1938 | 1935 | if (alps_monitor_mode(psmouse, true)) |
|---|
| .. | .. |
|---|
| 2297 | 2294 | if (reg < 0) |
|---|
| 2298 | 2295 | return reg; |
|---|
| 2299 | 2296 | |
|---|
| 2300 | | - x_pitch = (char)(reg << 4) >> 4; /* sign extend lower 4 bits */ |
|---|
| 2297 | + x_pitch = (s8)(reg << 4) >> 4; /* sign extend lower 4 bits */ |
|---|
| 2301 | 2298 | x_pitch = 50 + 2 * x_pitch; /* In 0.1 mm units */ |
|---|
| 2302 | 2299 | |
|---|
| 2303 | | - y_pitch = (char)reg >> 4; /* sign extend upper 4 bits */ |
|---|
| 2300 | + y_pitch = (s8)reg >> 4; /* sign extend upper 4 bits */ |
|---|
| 2304 | 2301 | y_pitch = 36 + 2 * y_pitch; /* In 0.1 mm units */ |
|---|
| 2305 | 2302 | |
|---|
| 2306 | 2303 | reg = alps_command_mode_read_reg(psmouse, reg_pitch + 1); |
|---|
| 2307 | 2304 | if (reg < 0) |
|---|
| 2308 | 2305 | return reg; |
|---|
| 2309 | 2306 | |
|---|
| 2310 | | - x_electrode = (char)(reg << 4) >> 4; /* sign extend lower 4 bits */ |
|---|
| 2307 | + x_electrode = (s8)(reg << 4) >> 4; /* sign extend lower 4 bits */ |
|---|
| 2311 | 2308 | x_electrode = 17 + x_electrode; |
|---|
| 2312 | 2309 | |
|---|
| 2313 | | - y_electrode = (char)reg >> 4; /* sign extend upper 4 bits */ |
|---|
| 2310 | + y_electrode = (s8)reg >> 4; /* sign extend upper 4 bits */ |
|---|
| 2314 | 2311 | y_electrode = 13 + y_electrode; |
|---|
| 2315 | 2312 | |
|---|
| 2316 | 2313 | x_phys = x_pitch * (x_electrode - 1); /* In 0.1 mm units */ |
|---|