Skip to content

Commit ad56814

Browse files
groeckdtor
authored andcommitted
Input: mouse - use local variables consistently
If a function declares a variable to access a structure element, use it consistently. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent a0d86ec commit ad56814

9 files changed

Lines changed: 31 additions & 42 deletions

File tree

‎drivers/input/mouse/alps.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1855,7 +1855,7 @@ static int alps_absolute_mode_v1_v2(struct psmouse *psmouse)
18551855
* Switch mouse to poll (remote) mode so motion data will not
18561856
* get in our way
18571857
*/
1858-
return ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_SETPOLL);
1858+
return ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETPOLL);
18591859
}
18601860

18611861
static int alps_monitor_mode_send_word(struct psmouse *psmouse, u16 word)

‎drivers/input/mouse/bcm5974.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on)
665665
char *data;
666666

667667
/* Type 3 does not require a mode switch */
668-
if (dev->cfg.tp_type == TYPE3)
668+
if (c->tp_type == TYPE3)
669669
return 0;
670670

671671
data = kmalloc(c->um_size, GFP_KERNEL);

‎drivers/input/mouse/cyapa.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -832,8 +832,8 @@ static int cyapa_prepare_wakeup_controls(struct cyapa *cyapa)
832832
int error;
833833

834834
if (device_can_wakeup(dev)) {
835-
error = sysfs_merge_group(&client->dev.kobj,
836-
&cyapa_power_wakeup_group);
835+
error = sysfs_merge_group(&dev->kobj,
836+
&cyapa_power_wakeup_group);
837837
if (error) {
838838
dev_err(dev, "failed to add power wakeup group: %d\n",
839839
error);
@@ -1312,7 +1312,7 @@ static int cyapa_probe(struct i2c_client *client,
13121312
return error;
13131313
}
13141314

1315-
error = sysfs_create_group(&client->dev.kobj, &cyapa_sysfs_group);
1315+
error = sysfs_create_group(&dev->kobj, &cyapa_sysfs_group);
13161316
if (error) {
13171317
dev_err(dev, "failed to create sysfs entries: %d\n", error);
13181318
return error;

‎drivers/input/mouse/cypress_ps2.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static int cypress_ps2_read_cmd_status(struct psmouse *psmouse,
107107
enum psmouse_state old_state;
108108
int pktsize;
109109

110-
ps2_begin_command(&psmouse->ps2dev);
110+
ps2_begin_command(ps2dev);
111111

112112
old_state = psmouse->state;
113113
psmouse->state = PSMOUSE_CMD_MODE;
@@ -133,7 +133,7 @@ static int cypress_ps2_read_cmd_status(struct psmouse *psmouse,
133133
psmouse->state = old_state;
134134
psmouse->pktcnt = 0;
135135

136-
ps2_end_command(&psmouse->ps2dev);
136+
ps2_end_command(ps2dev);
137137

138138
return rc;
139139
}

‎drivers/input/mouse/elan_i2c_core.c‎

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,8 +1041,7 @@ static int elan_probe(struct i2c_client *client,
10411041
return -EIO;
10421042
}
10431043

1044-
data = devm_kzalloc(&client->dev, sizeof(struct elan_tp_data),
1045-
GFP_KERNEL);
1044+
data = devm_kzalloc(dev, sizeof(struct elan_tp_data), GFP_KERNEL);
10461045
if (!data)
10471046
return -ENOMEM;
10481047

@@ -1053,29 +1052,25 @@ static int elan_probe(struct i2c_client *client,
10531052
init_completion(&data->fw_completion);
10541053
mutex_init(&data->sysfs_mutex);
10551054

1056-
data->vcc = devm_regulator_get(&client->dev, "vcc");
1055+
data->vcc = devm_regulator_get(dev, "vcc");
10571056
if (IS_ERR(data->vcc)) {
10581057
error = PTR_ERR(data->vcc);
10591058
if (error != -EPROBE_DEFER)
1060-
dev_err(&client->dev,
1061-
"Failed to get 'vcc' regulator: %d\n",
1059+
dev_err(dev, "Failed to get 'vcc' regulator: %d\n",
10621060
error);
10631061
return error;
10641062
}
10651063

10661064
error = regulator_enable(data->vcc);
10671065
if (error) {
1068-
dev_err(&client->dev,
1069-
"Failed to enable regulator: %d\n", error);
1066+
dev_err(dev, "Failed to enable regulator: %d\n", error);
10701067
return error;
10711068
}
10721069

1073-
error = devm_add_action(&client->dev,
1074-
elan_disable_regulator, data);
1070+
error = devm_add_action(dev, elan_disable_regulator, data);
10751071
if (error) {
10761072
regulator_disable(data->vcc);
1077-
dev_err(&client->dev,
1078-
"Failed to add disable regulator action: %d\n",
1073+
dev_err(dev, "Failed to add disable regulator action: %d\n",
10791074
error);
10801075
return error;
10811076
}
@@ -1093,14 +1088,14 @@ static int elan_probe(struct i2c_client *client,
10931088
if (error)
10941089
return error;
10951090

1096-
dev_info(&client->dev,
1091+
dev_info(dev,
10971092
"Elan Touchpad: Module ID: 0x%04x, Firmware: 0x%04x, Sample: 0x%04x, IAP: 0x%04x\n",
10981093
data->product_id,
10991094
data->fw_version,
11001095
data->sm_version,
11011096
data->iap_version);
11021097

1103-
dev_dbg(&client->dev,
1098+
dev_dbg(dev,
11041099
"Elan Touchpad Extra Information:\n"
11051100
" Max ABS X,Y: %d,%d\n"
11061101
" Width X,Y: %d,%d\n"
@@ -1118,47 +1113,42 @@ static int elan_probe(struct i2c_client *client,
11181113
* Systems using device tree should set up interrupt via DTS,
11191114
* the rest will use the default falling edge interrupts.
11201115
*/
1121-
irqflags = client->dev.of_node ? 0 : IRQF_TRIGGER_FALLING;
1116+
irqflags = dev->of_node ? 0 : IRQF_TRIGGER_FALLING;
11221117

1123-
error = devm_request_threaded_irq(&client->dev, client->irq,
1124-
NULL, elan_isr,
1118+
error = devm_request_threaded_irq(dev, client->irq, NULL, elan_isr,
11251119
irqflags | IRQF_ONESHOT,
11261120
client->name, data);
11271121
if (error) {
1128-
dev_err(&client->dev, "cannot register irq=%d\n", client->irq);
1122+
dev_err(dev, "cannot register irq=%d\n", client->irq);
11291123
return error;
11301124
}
11311125

1132-
error = sysfs_create_groups(&client->dev.kobj, elan_sysfs_groups);
1126+
error = sysfs_create_groups(&dev->kobj, elan_sysfs_groups);
11331127
if (error) {
1134-
dev_err(&client->dev, "failed to create sysfs attributes: %d\n",
1135-
error);
1128+
dev_err(dev, "failed to create sysfs attributes: %d\n", error);
11361129
return error;
11371130
}
11381131

1139-
error = devm_add_action(&client->dev,
1140-
elan_remove_sysfs_groups, data);
1132+
error = devm_add_action(dev, elan_remove_sysfs_groups, data);
11411133
if (error) {
11421134
elan_remove_sysfs_groups(data);
1143-
dev_err(&client->dev,
1144-
"Failed to add sysfs cleanup action: %d\n",
1135+
dev_err(dev, "Failed to add sysfs cleanup action: %d\n",
11451136
error);
11461137
return error;
11471138
}
11481139

11491140
error = input_register_device(data->input);
11501141
if (error) {
1151-
dev_err(&client->dev, "failed to register input device: %d\n",
1152-
error);
1142+
dev_err(dev, "failed to register input device: %d\n", error);
11531143
return error;
11541144
}
11551145

11561146
/*
11571147
* Systems using device tree should set up wakeup via DTS,
11581148
* the rest will configure device as wakeup source by default.
11591149
*/
1160-
if (!client->dev.of_node)
1161-
device_init_wakeup(&client->dev, true);
1150+
if (!dev->of_node)
1151+
device_init_wakeup(dev, true);
11621152

11631153
return 0;
11641154
}

‎drivers/input/mouse/elantech.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1412,7 +1412,7 @@ int elantech_detect(struct psmouse *psmouse, bool set_properties)
14121412
struct ps2dev *ps2dev = &psmouse->ps2dev;
14131413
unsigned char param[3];
14141414

1415-
ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_RESET_DIS);
1415+
ps2_command(ps2dev, NULL, PSMOUSE_CMD_RESET_DIS);
14161416

14171417
if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_DISABLE) ||
14181418
ps2_command(ps2dev, NULL, PSMOUSE_CMD_SETSCALE11) ||

‎drivers/input/mouse/hgpk.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -713,8 +713,7 @@ static int hgpk_toggle_powersave(struct psmouse *psmouse, int enable)
713713
* the upper bound. (in practice, it takes about 3 loops.)
714714
*/
715715
for (timeo = 20; timeo > 0; timeo--) {
716-
if (!ps2_sendbyte(&psmouse->ps2dev,
717-
PSMOUSE_CMD_DISABLE, 20))
716+
if (!ps2_sendbyte(ps2dev, PSMOUSE_CMD_DISABLE, 20))
718717
break;
719718
msleep(25);
720719
}
@@ -740,7 +739,7 @@ static int hgpk_toggle_powersave(struct psmouse *psmouse, int enable)
740739
psmouse_set_state(psmouse, PSMOUSE_IGNORE);
741740

742741
/* probably won't see an ACK, the touchpad will be off */
743-
ps2_sendbyte(&psmouse->ps2dev, 0xec, 20);
742+
ps2_sendbyte(ps2dev, 0xec, 20);
744743
}
745744

746745
return 0;

‎drivers/input/mouse/logips2pp.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ int ps2pp_detect(struct psmouse *psmouse, bool set_properties)
402402
psmouse->set_resolution = ps2pp_set_resolution;
403403
psmouse->disconnect = ps2pp_disconnect;
404404

405-
error = device_create_file(&psmouse->ps2dev.serio->dev,
405+
error = device_create_file(&ps2dev->serio->dev,
406406
&psmouse_attr_smartscroll.dattr);
407407
if (error) {
408408
psmouse_err(psmouse,

‎drivers/input/mouse/trackpoint.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties)
379379
if (!set_properties)
380380
return 0;
381381

382-
if (trackpoint_read(&psmouse->ps2dev, TP_EXT_BTN, &button_info)) {
382+
if (trackpoint_read(ps2dev, TP_EXT_BTN, &button_info)) {
383383
psmouse_warn(psmouse, "failed to get extended button data\n");
384384
button_info = 0;
385385
}
@@ -402,7 +402,7 @@ int trackpoint_detect(struct psmouse *psmouse, bool set_properties)
402402

403403
trackpoint_defaults(psmouse->private);
404404

405-
error = trackpoint_power_on_reset(&psmouse->ps2dev);
405+
error = trackpoint_power_on_reset(ps2dev);
406406

407407
/* Write defaults to TP only if reset fails. */
408408
if (error)

0 commit comments

Comments
 (0)