summaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2024-07-20 01:51:39 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2024-07-20 01:51:39 +0200
commit8e5c0abfa02d85b9cd2419567ad2d73ed8fe4b74 (patch)
treec1a9b40f2785fabe80283ac6454343a8c129a362 /drivers/input/mouse
parentMerge tag 'i2c-for-6.11-rc1-try2' of git://git.kernel.org/pub/scm/linux/kerne... (diff)
parentMerge branch 'next' into for-linus (diff)
downloadlinux-8e5c0abfa02d85b9cd2419567ad2d73ed8fe4b74.tar.xz
linux-8e5c0abfa02d85b9cd2419567ad2d73ed8fe4b74.zip
Merge tag 'input-for-v6.11-rc0' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input updates from Dmitry Torokhov: - streamlined logic in input core for handling normal input handlers vs input filters - updates to input drivers to allocate memory with sizeof(*pointer) instead of sizeof(type) - change to ads7846 touchscreen driver to use hsync GPIO instead of requiring platform data with special method (which is not compatible with boards using device tree) - update to adc-joystick driver to handle inverted axes - cleanups in various drivers switching them to use the new "guard" and "__free()" facilities - changes to several drivers (adxl34x, atmel_mxt_ts, ati-remote2, omap-keypad, yealink) to stop creating driver-specific device attributes manually and use driver core facilities for this - update to Cypress PS/2 protocol driver to properly handle errors from the PS/2 transport as well as other cleanups - update to edt-ft5x06 driver to support ft5426 variant - update to ektf2127 driver to support ektf2232 variant - update to exc3000 driver to support EXC81W32 variant - update to imagis driver to support IST3038 variant - other assorted driver cleanups. * tag 'input-for-v6.11-rc0' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (71 commits) Input: yealink - simplify locking in sysfs attribute handling Input: yealink - use driver core to instantiate device attributes Input: ati-remote2 - use driver core to instantiate device attributes Input: omap-keypad - use driver core to instantiate device attributes Input: atmel_mxt_ts - use driver core to instantiate device attributes Input: exc3000 - add EXC81W32 support dt-bindings: input: touchscreen: exc3000: add EXC81W32 Input: twl4030-pwrbutton - fix kernel-doc warning Input: himax_hx83112b - add support for HX83100A Input: himax_hx83112b - add himax_chip struct for multi-chip support Input: himax_hx83112b - implement MCU register reading Input: himax_hx83112b - use more descriptive register defines dt-bindings: input: touchscreen: himax,hx83112b: add HX83100A Input: do not check number of events in input_pass_values() Input: preallocate memory to hold event values Input: rearrange input_alloc_device() to prepare for preallocating of vals Input: simplify event handling logic Input: make events() method return number of events processed Input: make sure input handlers define only one processing method Input: evdev - remove ->event() method ...
Diffstat (limited to 'drivers/input/mouse')
-rw-r--r--drivers/input/mouse/alps.c2
-rw-r--r--drivers/input/mouse/appletouch.c2
-rw-r--r--drivers/input/mouse/bcm5974.c2
-rw-r--r--drivers/input/mouse/cypress_ps2.c184
-rw-r--r--drivers/input/mouse/cypress_ps2.h6
-rw-r--r--drivers/input/mouse/elan_i2c_core.c2
-rw-r--r--drivers/input/mouse/focaltech.c3
-rw-r--r--drivers/input/mouse/hgpk.c2
-rw-r--r--drivers/input/mouse/lifebook.c2
-rw-r--r--drivers/input/mouse/maplemouse.c2
-rw-r--r--drivers/input/mouse/psmouse-base.c2
-rw-r--r--drivers/input/mouse/sentelic.c2
-rw-r--r--drivers/input/mouse/sermouse.c2
-rw-r--r--drivers/input/mouse/synaptics.c4
-rw-r--r--drivers/input/mouse/synaptics_i2c.c2
-rw-r--r--drivers/input/mouse/vsxxxaa.c2
16 files changed, 108 insertions, 113 deletions
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
index e2c11d9f3868..d5ef5a112d6f 100644
--- a/drivers/input/mouse/alps.c
+++ b/drivers/input/mouse/alps.c
@@ -3201,7 +3201,7 @@ int alps_detect(struct psmouse *psmouse, bool set_properties)
*/
psmouse_reset(psmouse);
- priv = kzalloc(sizeof(struct alps_data), GFP_KERNEL);
+ priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
index 627048bc6a12..e669f86f1882 100644
--- a/drivers/input/mouse/appletouch.c
+++ b/drivers/input/mouse/appletouch.c
@@ -855,7 +855,7 @@ static int atp_probe(struct usb_interface *iface,
}
/* allocate memory for our device state and initialize it */
- dev = kzalloc(sizeof(struct atp), GFP_KERNEL);
+ dev = kzalloc(sizeof(*dev), GFP_KERNEL);
input_dev = input_allocate_device();
if (!dev || !input_dev) {
dev_err(&iface->dev, "Out of memory\n");
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c
index ca150618d32f..10a03a566905 100644
--- a/drivers/input/mouse/bcm5974.c
+++ b/drivers/input/mouse/bcm5974.c
@@ -904,7 +904,7 @@ static int bcm5974_probe(struct usb_interface *iface,
cfg = bcm5974_get_config(udev);
/* allocate memory for our device state and initialize it */
- dev = kzalloc(sizeof(struct bcm5974), GFP_KERNEL);
+ dev = kzalloc(sizeof(*dev), GFP_KERNEL);
input_dev = input_allocate_device();
if (!dev || !input_dev) {
dev_err(&iface->dev, "out of memory\n");
diff --git a/drivers/input/mouse/cypress_ps2.c b/drivers/input/mouse/cypress_ps2.c
index d272f1ec27ba..b3c34ebcc4ef 100644
--- a/drivers/input/mouse/cypress_ps2.c
+++ b/drivers/input/mouse/cypress_ps2.c
@@ -32,33 +32,30 @@ static void cypress_set_packet_size(struct psmouse *psmouse, unsigned int n)
cytp->pkt_size = n;
}
-static const unsigned char cytp_rate[] = {10, 20, 40, 60, 100, 200};
-static const unsigned char cytp_resolution[] = {0x00, 0x01, 0x02, 0x03};
+static const u8 cytp_rate[] = {10, 20, 40, 60, 100, 200};
+static const u8 cytp_resolution[] = {0x00, 0x01, 0x02, 0x03};
-static int cypress_ps2_sendbyte(struct psmouse *psmouse, int value)
+static int cypress_ps2_sendbyte(struct psmouse *psmouse, u8 cmd)
{
struct ps2dev *ps2dev = &psmouse->ps2dev;
+ int error;
- if (ps2_sendbyte(ps2dev, value & 0xff, CYTP_CMD_TIMEOUT) < 0) {
+ error = ps2_sendbyte(ps2dev, cmd, CYTP_CMD_TIMEOUT);
+ if (error) {
psmouse_dbg(psmouse,
- "sending command 0x%02x failed, resp 0x%02x\n",
- value & 0xff, ps2dev->nak);
- if (ps2dev->nak == CYTP_PS2_RETRY)
- return CYTP_PS2_RETRY;
- else
- return CYTP_PS2_ERROR;
+ "sending command 0x%02x failed, resp 0x%02x, error %d\n",
+ cmd, ps2dev->nak, error);
+ return error;
}
#ifdef CYTP_DEBUG_VERBOSE
- psmouse_dbg(psmouse, "sending command 0x%02x succeeded, resp 0xfa\n",
- value & 0xff);
+ psmouse_dbg(psmouse, "sending command 0x%02x succeeded\n", cmd);
#endif
return 0;
}
-static int cypress_ps2_ext_cmd(struct psmouse *psmouse, unsigned short cmd,
- unsigned char data)
+static int cypress_ps2_ext_cmd(struct psmouse *psmouse, u8 prefix, u8 nibble)
{
struct ps2dev *ps2dev = &psmouse->ps2dev;
int tries = CYTP_PS2_CMD_TRIES;
@@ -72,22 +69,21 @@ static int cypress_ps2_ext_cmd(struct psmouse *psmouse, unsigned short cmd,
* If sending the command fails, send recovery command
* to make the device return to the ready state.
*/
- rc = cypress_ps2_sendbyte(psmouse, cmd & 0xff);
- if (rc == CYTP_PS2_RETRY) {
+ rc = cypress_ps2_sendbyte(psmouse, prefix);
+ if (rc == -EAGAIN) {
rc = cypress_ps2_sendbyte(psmouse, 0x00);
- if (rc == CYTP_PS2_RETRY)
+ if (rc == -EAGAIN)
rc = cypress_ps2_sendbyte(psmouse, 0x0a);
}
- if (rc == CYTP_PS2_ERROR)
- continue;
-
- rc = cypress_ps2_sendbyte(psmouse, data);
- if (rc == CYTP_PS2_RETRY)
- rc = cypress_ps2_sendbyte(psmouse, data);
- if (rc == CYTP_PS2_ERROR)
- continue;
- else
- break;
+
+ if (!rc) {
+ rc = cypress_ps2_sendbyte(psmouse, nibble);
+ if (rc == -EAGAIN)
+ rc = cypress_ps2_sendbyte(psmouse, nibble);
+
+ if (!rc)
+ break;
+ }
} while (--tries > 0);
ps2_end_command(ps2dev);
@@ -96,13 +92,12 @@ static int cypress_ps2_ext_cmd(struct psmouse *psmouse, unsigned short cmd,
}
static int cypress_ps2_read_cmd_status(struct psmouse *psmouse,
- unsigned char cmd,
- unsigned char *param)
+ u8 cmd, u8 *param)
{
- int rc;
struct ps2dev *ps2dev = &psmouse->ps2dev;
enum psmouse_state old_state;
int pktsize;
+ int rc;
ps2_begin_command(ps2dev);
@@ -113,13 +108,16 @@ static int cypress_ps2_read_cmd_status(struct psmouse *psmouse,
pktsize = (cmd == CYTP_CMD_READ_TP_METRICS) ? 8 : 3;
memset(param, 0, pktsize);
- rc = cypress_ps2_sendbyte(psmouse, 0xe9);
- if (rc < 0)
+ rc = cypress_ps2_sendbyte(psmouse, PSMOUSE_CMD_GETINFO & 0xff);
+ if (rc)
goto out;
- wait_event_timeout(ps2dev->wait,
- (psmouse->pktcnt >= pktsize),
- msecs_to_jiffies(CYTP_CMD_TIMEOUT));
+ if (!wait_event_timeout(ps2dev->wait,
+ psmouse->pktcnt >= pktsize,
+ msecs_to_jiffies(CYTP_CMD_TIMEOUT))) {
+ rc = -ETIMEDOUT;
+ goto out;
+ }
memcpy(param, psmouse->packet, pktsize);
@@ -135,8 +133,7 @@ out:
return rc;
}
-static bool cypress_verify_cmd_state(struct psmouse *psmouse,
- unsigned char cmd, unsigned char *param)
+static bool cypress_verify_cmd_state(struct psmouse *psmouse, u8 cmd, u8* param)
{
bool rate_match = false;
bool resolution_match = false;
@@ -166,31 +163,24 @@ static bool cypress_verify_cmd_state(struct psmouse *psmouse,
return false;
}
-static int cypress_send_ext_cmd(struct psmouse *psmouse, unsigned char cmd,
- unsigned char *param)
+static int cypress_send_ext_cmd(struct psmouse *psmouse, u8 cmd, u8 *param)
{
+ u8 cmd_prefix = PSMOUSE_CMD_SETRES & 0xff;
int tries = CYTP_PS2_CMD_TRIES;
- int rc;
+ int error;
psmouse_dbg(psmouse, "send extension cmd 0x%02x, [%d %d %d %d]\n",
cmd, DECODE_CMD_AA(cmd), DECODE_CMD_BB(cmd),
DECODE_CMD_CC(cmd), DECODE_CMD_DD(cmd));
do {
- cypress_ps2_ext_cmd(psmouse,
- PSMOUSE_CMD_SETRES, DECODE_CMD_DD(cmd));
- cypress_ps2_ext_cmd(psmouse,
- PSMOUSE_CMD_SETRES, DECODE_CMD_CC(cmd));
- cypress_ps2_ext_cmd(psmouse,
- PSMOUSE_CMD_SETRES, DECODE_CMD_BB(cmd));
- cypress_ps2_ext_cmd(psmouse,
- PSMOUSE_CMD_SETRES, DECODE_CMD_AA(cmd));
-
- rc = cypress_ps2_read_cmd_status(psmouse, cmd, param);
- if (rc)
- continue;
-
- if (cypress_verify_cmd_state(psmouse, cmd, param))
+ cypress_ps2_ext_cmd(psmouse, cmd_prefix, DECODE_CMD_DD(cmd));
+ cypress_ps2_ext_cmd(psmouse, cmd_prefix, DECODE_CMD_CC(cmd));
+ cypress_ps2_ext_cmd(psmouse, cmd_prefix, DECODE_CMD_BB(cmd));
+ cypress_ps2_ext_cmd(psmouse, cmd_prefix, DECODE_CMD_AA(cmd));
+
+ error = cypress_ps2_read_cmd_status(psmouse, cmd, param);
+ if (!error && cypress_verify_cmd_state(psmouse, cmd, param))
return 0;
} while (--tries > 0);
@@ -200,7 +190,7 @@ static int cypress_send_ext_cmd(struct psmouse *psmouse, unsigned char cmd,
int cypress_detect(struct psmouse *psmouse, bool set_properties)
{
- unsigned char param[3];
+ u8 param[3];
if (cypress_send_ext_cmd(psmouse, CYTP_CMD_READ_CYPRESS_ID, param))
return -ENODEV;
@@ -220,7 +210,7 @@ int cypress_detect(struct psmouse *psmouse, bool set_properties)
static int cypress_read_fw_version(struct psmouse *psmouse)
{
struct cytp_data *cytp = psmouse->private;
- unsigned char param[3];
+ u8 param[3];
if (cypress_send_ext_cmd(psmouse, CYTP_CMD_READ_CYPRESS_ID, param))
return -ENODEV;
@@ -249,7 +239,7 @@ static int cypress_read_fw_version(struct psmouse *psmouse)
static int cypress_read_tp_metrics(struct psmouse *psmouse)
{
struct cytp_data *cytp = psmouse->private;
- unsigned char param[8];
+ u8 param[8];
/* set default values for tp metrics. */
cytp->tp_width = CYTP_DEFAULT_WIDTH;
@@ -321,15 +311,15 @@ static int cypress_read_tp_metrics(struct psmouse *psmouse)
static int cypress_query_hardware(struct psmouse *psmouse)
{
- int ret;
+ int error;
- ret = cypress_read_fw_version(psmouse);
- if (ret)
- return ret;
+ error = cypress_read_fw_version(psmouse);
+ if (error)
+ return error;
- ret = cypress_read_tp_metrics(psmouse);
- if (ret)
- return ret;
+ error = cypress_read_tp_metrics(psmouse);
+ if (error)
+ return error;
return 0;
}
@@ -337,10 +327,13 @@ static int cypress_query_hardware(struct psmouse *psmouse)
static int cypress_set_absolute_mode(struct psmouse *psmouse)
{
struct cytp_data *cytp = psmouse->private;
- unsigned char param[3];
+ u8 param[3];
+ int error;
- if (cypress_send_ext_cmd(psmouse, CYTP_CMD_ABS_WITH_PRESSURE_MODE, param) < 0)
- return -1;
+ error = cypress_send_ext_cmd(psmouse, CYTP_CMD_ABS_WITH_PRESSURE_MODE,
+ param);
+ if (error)
+ return error;
cytp->mode = (cytp->mode & ~CYTP_BIT_ABS_REL_MASK)
| CYTP_BIT_ABS_PRESSURE;
@@ -365,7 +358,7 @@ static void cypress_reset(struct psmouse *psmouse)
static int cypress_set_input_params(struct input_dev *input,
struct cytp_data *cytp)
{
- int ret;
+ int error;
if (!cytp->tp_res_x || !cytp->tp_res_y)
return -EINVAL;
@@ -382,10 +375,10 @@ static int cypress_set_input_params(struct input_dev *input,
input_set_abs_params(input, ABS_MT_POSITION_Y, 0, cytp->tp_max_abs_y, 0, 0);
input_set_abs_params(input, ABS_MT_PRESSURE, 0, 255, 0, 0);
- ret = input_mt_init_slots(input, CYTP_MAX_MT_SLOTS,
- INPUT_MT_DROP_UNUSED|INPUT_MT_TRACK);
- if (ret < 0)
- return ret;
+ error = input_mt_init_slots(input, CYTP_MAX_MT_SLOTS,
+ INPUT_MT_DROP_UNUSED | INPUT_MT_TRACK);
+ if (error)
+ return error;
__set_bit(INPUT_PROP_SEMI_MT, input->propbit);
@@ -414,9 +407,9 @@ static int cypress_set_input_params(struct input_dev *input,
return 0;
}
-static int cypress_get_finger_count(unsigned char header_byte)
+static int cypress_get_finger_count(u8 header_byte)
{
- unsigned char bits6_7;
+ u8 bits6_7;
int finger_count;
bits6_7 = header_byte >> 6;
@@ -441,10 +434,11 @@ static int cypress_get_finger_count(unsigned char header_byte)
static int cypress_parse_packet(struct psmouse *psmouse,
- struct cytp_data *cytp, struct cytp_report_data *report_data)
+ struct cytp_data *cytp,
+ struct cytp_report_data *report_data)
{
- unsigned char *packet = psmouse->packet;
- unsigned char header_byte = packet[0];
+ u8 *packet = psmouse->packet;
+ u8 header_byte = packet[0];
memset(report_data, 0, sizeof(struct cytp_report_data));
@@ -559,7 +553,7 @@ static psmouse_ret_t cypress_validate_byte(struct psmouse *psmouse)
{
int contact_cnt;
int index = psmouse->pktcnt - 1;
- unsigned char *packet = psmouse->packet;
+ u8 *packet = psmouse->packet;
struct cytp_data *cytp = psmouse->private;
if (index < 0 || index > cytp->pkt_size)
@@ -612,6 +606,7 @@ static psmouse_ret_t cypress_protocol_handler(struct psmouse *psmouse)
static void cypress_set_rate(struct psmouse *psmouse, unsigned int rate)
{
struct cytp_data *cytp = psmouse->private;
+ u8 rate_param;
if (rate >= 80) {
psmouse->rate = 80;
@@ -621,8 +616,8 @@ static void cypress_set_rate(struct psmouse *psmouse, unsigned int rate)
cytp->mode &= ~CYTP_BIT_HIGH_RATE;
}
- ps2_command(&psmouse->ps2dev, (unsigned char *)&psmouse->rate,
- PSMOUSE_CMD_SETRATE);
+ rate_param = (u8)rate;
+ ps2_command(&psmouse->ps2dev, &rate_param, PSMOUSE_CMD_SETRATE);
}
static void cypress_disconnect(struct psmouse *psmouse)
@@ -635,21 +630,22 @@ static void cypress_disconnect(struct psmouse *psmouse)
static int cypress_reconnect(struct psmouse *psmouse)
{
int tries = CYTP_PS2_CMD_TRIES;
- int rc;
+ int error;
do {
cypress_reset(psmouse);
- rc = cypress_detect(psmouse, false);
- } while (rc && (--tries > 0));
+ error = cypress_detect(psmouse, false);
+ } while (error && (--tries > 0));
- if (rc) {
+ if (error) {
psmouse_err(psmouse, "Reconnect: unable to detect trackpad.\n");
- return -1;
+ return error;
}
- if (cypress_set_absolute_mode(psmouse)) {
+ error = cypress_set_absolute_mode(psmouse);
+ if (error) {
psmouse_err(psmouse, "Reconnect: Unable to initialize Cypress absolute mode.\n");
- return -1;
+ return error;
}
return 0;
@@ -658,8 +654,9 @@ static int cypress_reconnect(struct psmouse *psmouse)
int cypress_init(struct psmouse *psmouse)
{
struct cytp_data *cytp;
+ int error;
- cytp = kzalloc(sizeof(struct cytp_data), GFP_KERNEL);
+ cytp = kzalloc(sizeof(*cytp), GFP_KERNEL);
if (!cytp)
return -ENOMEM;
@@ -668,17 +665,20 @@ int cypress_init(struct psmouse *psmouse)
cypress_reset(psmouse);
- if (cypress_query_hardware(psmouse)) {
+ error = cypress_query_hardware(psmouse);
+ if (error) {
psmouse_err(psmouse, "Unable to query Trackpad hardware.\n");
goto err_exit;
}
- if (cypress_set_absolute_mode(psmouse)) {
+ error = cypress_set_absolute_mode(psmouse);
+ if (error) {
psmouse_err(psmouse, "init: Unable to initialize Cypress absolute mode.\n");
goto err_exit;
}
- if (cypress_set_input_params(psmouse->dev, cytp) < 0) {
+ error = cypress_set_input_params(psmouse->dev, cytp);
+ if (error) {
psmouse_err(psmouse, "init: Unable to set input params.\n");
goto err_exit;
}
@@ -703,5 +703,5 @@ err_exit:
psmouse->private = NULL;
kfree(cytp);
- return -1;
+ return error;
}
diff --git a/drivers/input/mouse/cypress_ps2.h b/drivers/input/mouse/cypress_ps2.h
index bb4979d06bf9..47d538a49089 100644
--- a/drivers/input/mouse/cypress_ps2.h
+++ b/drivers/input/mouse/cypress_ps2.h
@@ -72,12 +72,6 @@
#define CYTP_DATA_TIMEOUT 30
#define CYTP_EXT_CMD 0xe8
-#define CYTP_PS2_RETRY 0xfe
-#define CYTP_PS2_ERROR 0xfc
-
-#define CYTP_RESP_RETRY 0x01
-#define CYTP_RESP_ERROR 0xfe
-
#define CYTP_105001_WIDTH 97 /* Dell XPS 13 */
#define CYTP_105001_HIGH 59
diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
index c2aec5c360b3..ce96513b34f6 100644
--- a/drivers/input/mouse/elan_i2c_core.c
+++ b/drivers/input/mouse/elan_i2c_core.c
@@ -1356,6 +1356,8 @@ static int elan_suspend(struct device *dev)
}
err:
+ if (ret)
+ enable_irq(client->irq);
mutex_unlock(&data->sysfs_mutex);
return ret;
}
diff --git a/drivers/input/mouse/focaltech.c b/drivers/input/mouse/focaltech.c
index c74b99077d16..356b99d48544 100644
--- a/drivers/input/mouse/focaltech.c
+++ b/drivers/input/mouse/focaltech.c
@@ -408,8 +408,7 @@ int focaltech_init(struct psmouse *psmouse)
struct focaltech_data *priv;
int error;
- psmouse->private = priv = kzalloc(sizeof(struct focaltech_data),
- GFP_KERNEL);
+ psmouse->private = priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
diff --git a/drivers/input/mouse/hgpk.c b/drivers/input/mouse/hgpk.c
index 3c8310da0b05..6125652e5ad8 100644
--- a/drivers/input/mouse/hgpk.c
+++ b/drivers/input/mouse/hgpk.c
@@ -981,7 +981,7 @@ int hgpk_init(struct psmouse *psmouse)
struct hgpk_data *priv;
int err;
- priv = kzalloc(sizeof(struct hgpk_data), GFP_KERNEL);
+ priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (!priv) {
err = -ENOMEM;
goto alloc_fail;
diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c
index bd9955730176..7147dacc404f 100644
--- a/drivers/input/mouse/lifebook.c
+++ b/drivers/input/mouse/lifebook.c
@@ -273,7 +273,7 @@ static int lifebook_create_relative_device(struct psmouse *psmouse)
struct lifebook_data *priv;
int error = -ENOMEM;
- priv = kzalloc(sizeof(struct lifebook_data), GFP_KERNEL);
+ priv = kzalloc(sizeof(*priv), GFP_KERNEL);
dev2 = input_allocate_device();
if (!priv || !dev2)
goto err_out;
diff --git a/drivers/input/mouse/maplemouse.c b/drivers/input/mouse/maplemouse.c
index 2de64d6a04d1..baef4be14b54 100644
--- a/drivers/input/mouse/maplemouse.c
+++ b/drivers/input/mouse/maplemouse.c
@@ -73,7 +73,7 @@ static int probe_maple_mouse(struct device *dev)
struct input_dev *input_dev;
struct dc_mouse *mse;
- mse = kzalloc(sizeof(struct dc_mouse), GFP_KERNEL);
+ mse = kzalloc(sizeof(*mse), GFP_KERNEL);
if (!mse) {
error = -ENOMEM;
goto fail;
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index a0aac76b1e41..a2c9f7144864 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -1591,7 +1591,7 @@ static int psmouse_connect(struct serio *serio, struct serio_driver *drv)
psmouse_deactivate(parent);
}
- psmouse = kzalloc(sizeof(struct psmouse), GFP_KERNEL);
+ psmouse = kzalloc(sizeof(*psmouse), GFP_KERNEL);
input_dev = input_allocate_device();
if (!psmouse || !input_dev)
goto err_free;
diff --git a/drivers/input/mouse/sentelic.c b/drivers/input/mouse/sentelic.c
index 2716d2ba386a..44b136fc29aa 100644
--- a/drivers/input/mouse/sentelic.c
+++ b/drivers/input/mouse/sentelic.c
@@ -1028,7 +1028,7 @@ int fsp_init(struct psmouse *psmouse)
"Finger Sensing Pad, hw: %d.%d.%d, sn: %x, sw: %s\n",
ver >> 4, ver & 0x0F, rev, sn, fsp_drv_ver);
- psmouse->private = priv = kzalloc(sizeof(struct fsp_data), GFP_KERNEL);
+ psmouse->private = priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
diff --git a/drivers/input/mouse/sermouse.c b/drivers/input/mouse/sermouse.c
index 993f90333380..218c8432a13b 100644
--- a/drivers/input/mouse/sermouse.c
+++ b/drivers/input/mouse/sermouse.c
@@ -231,7 +231,7 @@ static int sermouse_connect(struct serio *serio, struct serio_driver *drv)
unsigned char c = serio->id.extra;
int err = -ENOMEM;
- sermouse = kzalloc(sizeof(struct sermouse), GFP_KERNEL);
+ sermouse = kzalloc(sizeof(*sermouse), GFP_KERNEL);
input_dev = input_allocate_device();
if (!sermouse || !input_dev)
goto fail1;
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 7a303a9d6bf7..38191c3b31bf 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -708,7 +708,7 @@ static void synaptics_pt_create(struct psmouse *psmouse)
{
struct serio *serio;
- serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
+ serio = kzalloc(sizeof(*serio), GFP_KERNEL);
if (!serio) {
psmouse_err(psmouse,
"not enough memory for pass-through port\n");
@@ -1563,7 +1563,7 @@ static int synaptics_init_ps2(struct psmouse *psmouse,
synaptics_apply_quirks(psmouse, info);
- psmouse->private = priv = kzalloc(sizeof(struct synaptics_data), GFP_KERNEL);
+ psmouse->private = priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
diff --git a/drivers/input/mouse/synaptics_i2c.c b/drivers/input/mouse/synaptics_i2c.c
index 56e9ba396858..a0d707e47d93 100644
--- a/drivers/input/mouse/synaptics_i2c.c
+++ b/drivers/input/mouse/synaptics_i2c.c
@@ -508,7 +508,7 @@ static struct synaptics_i2c *synaptics_i2c_touch_create(struct i2c_client *clien
{
struct synaptics_i2c *touch;
- touch = kzalloc(sizeof(struct synaptics_i2c), GFP_KERNEL);
+ touch = kzalloc(sizeof(*touch), GFP_KERNEL);
if (!touch)
return NULL;
diff --git a/drivers/input/mouse/vsxxxaa.c b/drivers/input/mouse/vsxxxaa.c
index 8af8e4a15f95..707cd28f4ba6 100644
--- a/drivers/input/mouse/vsxxxaa.c
+++ b/drivers/input/mouse/vsxxxaa.c
@@ -456,7 +456,7 @@ static int vsxxxaa_connect(struct serio *serio, struct serio_driver *drv)
struct input_dev *input_dev;
int err = -ENOMEM;
- mouse = kzalloc(sizeof(struct vsxxxaa), GFP_KERNEL);
+ mouse = kzalloc(sizeof(*mouse), GFP_KERNEL);
input_dev = input_allocate_device();
if (!mouse || !input_dev)
goto fail1;