Skip to contentSkip to conversation

Input: Drop unnecessary calls to input_set_drvdata

PATCH In review Guenter Roeck 2 participants 7 messages Jan 23, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Input: Drop unnecessary calls to input_set_drvdata

If there is not call to dev_get_drvdata() or input_get_drvdata(), the call to input_set_drvdata() is unnecessary and can be dropped.

The series was build tested on kerneltests.org and by the 0day build system.

The patch series is based on v4.10-rc4, with input/next (sha 2de8b4110c82) merged on top. For convenience, the series is available at:
git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git input-base

----------------------------------------------------------------
Guenter Roeck (5):
Input: keyboard - drop unnecessary calls to input_set_drvdata
Input: joystick/maplecontrol - drop unnecessary call to input_set_drvdata
Input: mouse - drop unnecessary calls to input_set_drvdata
Input: misc/dm355evm_keys - drop unnecessary call to input_set_drvdata
Input: touchscreen - drop unnecessary calls to input_set_drvdata

 drivers/input/joystick/maplecontrol.c      | 1 -
 drivers/input/keyboard/adp5520-keys.c      | 2 --
 drivers/input/keyboard/bf54x-keys.c        | 2 --
 drivers/input/keyboard/maple_keyb.c        | 1 -
 drivers/input/keyboard/opencores-kbd.c     | 2 --
 drivers/input/keyboard/tca8418_keypad.c    | 2 --
 drivers/input/keyboard/tm2-touchkey.c      | 2 --
 drivers/input/misc/dm355evm_keys.c         | 2 --
 drivers/input/mouse/cypress_ps2.c          | 2 --
 drivers/input/mouse/maplemouse.c           | 1 -
 drivers/input/touchscreen/edt-ft5x06.c     | 1 -
 drivers/input/touchscreen/egalax_ts.c      | 2 --
 drivers/input/touchscreen/elants_i2c.c     | 2 --
 drivers/input/touchscreen/ili210x.c        | 1 -
 drivers/input/touchscreen/mcs5000_ts.c     | 1 -
 drivers/input/touchscreen/raydium_i2c_ts.c | 2 --
 16 files changed, 26 deletions(-)
#1 lore raw

PATCH 1/5 Input: keyboard - drop unnecessary calls to input_set_drvdata

If there is no call to dev_get_drvdata() or input_get_drvdata(), the call to input_set_drvdata() is unnecessary and can be dropped.

The conversion was done automatically using the following coccinelle script.

@used@
@@

(
input_get_drvdata(...)
|
dev_get_drvdata(...)
)

@depends on !used@
@@

- input_set_drvdata(...);

---
 drivers/input/keyboard/adp5520-keys.c   | 2 --
 drivers/input/keyboard/bf54x-keys.c     | 2 --
 drivers/input/keyboard/maple_keyb.c     | 1 -
 drivers/input/keyboard/opencores-kbd.c  | 2 --
 drivers/input/keyboard/tca8418_keypad.c | 2 --
 drivers/input/keyboard/tm2-touchkey.c   | 2 --
 6 files changed, 11 deletions(-)
drivers/input/keyboard/adp5520-keys.c +0 -2
index db1004dad108..f0b9b37bde58 100644
@@ -107,8 +107,6 @@ static int adp5520_keys_probe(struct platform_device *pdev)
 	input->phys = "adp5520-keys/input0";
 	input->dev.parent = &pdev->dev;
 
-	input_set_drvdata(input, dev);
-
 	input->id.bustype = BUS_I2C;
 	input->id.vendor = 0x0001;
 	input->id.product = 0x5520;
drivers/input/keyboard/bf54x-keys.c +0 -2
index 81b07dddae86..39bcbc38997f 100644
@@ -268,8 +268,6 @@ static int bfin_kpad_probe(struct platform_device *pdev)
 	input->phys = "bf54x-keys/input0";
 	input->dev.parent = &pdev->dev;
 
-	input_set_drvdata(input, bf54x_kpad);
-
 	input->id.bustype = BUS_HOST;
 	input->id.vendor = 0x0001;
 	input->id.product = 0x0001;
drivers/input/keyboard/maple_keyb.c +0 -1
index 5aa2361aef95..78e3567ec18c 100644
@@ -196,7 +196,6 @@ static int probe_maple_kbd(struct device *dev)
 	__clear_bit(KEY_RESERVED, idev->keybit);
 
 	input_set_capability(idev, EV_MSC, MSC_SCAN);
-	input_set_drvdata(idev, kbd);
 
 	error = input_register_device(idev);
 	if (error)
drivers/input/keyboard/opencores-kbd.c +0 -2
index 98ea6190f5f5..d62b4068c077 100644
@@ -75,8 +75,6 @@ static int opencores_kbd_probe(struct platform_device *pdev)
 	input->name = pdev->name;
 	input->phys = "opencores-kbd/input0";
 
-	input_set_drvdata(input, opencores_kbd);
-
 	input->id.bustype = BUS_HOST;
 	input->id.vendor = 0x0001;
 	input->id.product = 0x0001;
drivers/input/keyboard/tca8418_keypad.c +0 -2
index 11d5c76d9fb4..9f6308fac0b4 100644
@@ -358,8 +358,6 @@ static int tca8418_keypad_probe(struct i2c_client *client,
 		__set_bit(EV_REP, input->evbit);
 	input_set_capability(input, EV_MSC, MSC_SCAN);
 
-	input_set_drvdata(input, keypad_data);
-
 	irq = client->irq;
 	if (irq_is_gpio)
 		irq = gpio_to_irq(irq);
drivers/input/keyboard/tm2-touchkey.c +0 -2
index 916e2f3a9bbb..485900f953e0 100644
@@ -193,8 +193,6 @@ static int tm2_touchkey_probe(struct i2c_client *client,
 	input_set_capability(touchkey->input_dev, EV_KEY, KEY_PHONE);
 	input_set_capability(touchkey->input_dev, EV_KEY, KEY_BACK);
 
-	input_set_drvdata(touchkey->input_dev, touchkey);
-
 	error = input_register_device(touchkey->input_dev);
 	if (error) {
 		dev_err(&client->dev,
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/5 Input: joystick/maplecontrol - drop unnecessary call to input_set_drvdata

In reply to Guenter Roeck

Since there is no call to dev_get_drvdata() or input_get_drvdata(), the call to input_set_drvdata() is unnecessary and can be dropped.

The conversion was done automatically using the following coccinelle script.

@used@
@@

(
input_get_drvdata(...)
|
dev_get_drvdata(...)
)

@depends on !used@
@@

- input_set_drvdata(...);

---
 drivers/input/joystick/maplecontrol.c | 1 -
 1 file changed, 1 deletion(-)
drivers/input/joystick/maplecontrol.c +0 -1
index 8aa6e4c497da..ff54e195d42c 100644
@@ -139,7 +139,6 @@ static int probe_maple_controller(struct device *dev)
 	idev->dev.parent = &mdev->dev;
 	idev->name = mdev->product_name;
 	idev->id.bustype = BUS_HOST;
-	input_set_drvdata(idev, pad);
 
 	error = input_register_device(idev);
 	if (error)
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/5 Input: mouse - drop unnecessary calls to input_set_drvdata

In reply to Guenter Roeck

Since there is no call to dev_get_drvdata() or input_get_drvdata(), the call to input_set_drvdata() is unnecessary and can be dropped.

The conversion was done automatically using the following coccinelle script.

@used@
@@

(
input_get_drvdata(...)
|
dev_get_drvdata(...)
)

@depends on !used@
@@

- input_set_drvdata(...);

---
 drivers/input/mouse/cypress_ps2.c | 2 --
 drivers/input/mouse/maplemouse.c  | 1 -
 2 files changed, 3 deletions(-)
drivers/input/mouse/cypress_ps2.c +0 -2
index faa3a980d4f5..21bad3e75fee 100644
@@ -414,8 +414,6 @@ static int cypress_set_input_params(struct input_dev *input,
 	__set_bit(BTN_RIGHT, input->keybit);
 	__set_bit(BTN_MIDDLE, input->keybit);
 
-	input_set_drvdata(input, cytp);
-
 	return 0;
 }
 
drivers/input/mouse/maplemouse.c +0 -1
index 0a60717b91c6..25f0ecb90126 100644
@@ -87,7 +87,6 @@ static int probe_maple_mouse(struct device *dev)
 	mse->dev = input_dev;
 	mse->mdev = mdev;
 
-	input_set_drvdata(input_dev, mse);
 	input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL);
 	input_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_LEFT) |
 		BIT_MASK(BTN_RIGHT) | BIT_MASK(BTN_MIDDLE);
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/5 Input: misc/dm355evm_keys - drop unnecessary call to input_set_drvdata

In reply to Guenter Roeck

Since there is no call to dev_get_drvdata() or input_get_drvdata(), the call to input_set_drvdata() is unnecessary and can be dropped.

The conversion was done automatically using the following coccinelle script.

@used@
@@

(
input_get_drvdata(...)
|
dev_get_drvdata(...)
)

@depends on !used@
@@

- input_set_drvdata(...);

---
 drivers/input/misc/dm355evm_keys.c | 2 --
 1 file changed, 2 deletions(-)
drivers/input/misc/dm355evm_keys.c +0 -2
index b6b7bd4e5462..82e272ebc0ed 100644
@@ -195,8 +195,6 @@ static int dm355evm_keys_probe(struct platform_device *pdev)
 		goto fail1;
 	keys->irq = status;
 
-	input_set_drvdata(input, keys);
-
 	input->name = "DM355 EVM Controls";
 	input->phys = "dm355evm/input0";
 	input->dev.parent = &pdev->dev;
Signature · 1 line
2.7.4
#5 lore raw

PATCH 5/5 Input: touchscreen - drop unnecessary calls to input_set_drvdata

In reply to Guenter Roeck

Since there is no call to dev_get_drvdata() or input_get_drvdata(), the call to input_set_drvdata() is unnecessary and can be dropped.

The conversion was done automatically using the following coccinelle script.

@used@
@@

(
input_get_drvdata(...)
|
dev_get_drvdata(...)
)

@depends on !used@
@@

- input_set_drvdata(...);

---
 drivers/input/touchscreen/edt-ft5x06.c     | 1 -
 drivers/input/touchscreen/egalax_ts.c      | 2 --
 drivers/input/touchscreen/elants_i2c.c     | 2 --
 drivers/input/touchscreen/ili210x.c        | 1 -
 drivers/input/touchscreen/mcs5000_ts.c     | 1 -
 drivers/input/touchscreen/raydium_i2c_ts.c | 2 --
 6 files changed, 9 deletions(-)
drivers/input/touchscreen/edt-ft5x06.c +0 -1
index 8fc629fb023f..8cf8d8d5d4ef 100644
@@ -982,7 +982,6 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
 		return error;
 	}
 
-	input_set_drvdata(input, tsdata);
 	i2c_set_clientdata(client, tsdata);
 
 	irq_flags = irq_get_trigger_type(client->irq);
drivers/input/touchscreen/egalax_ts.c +0 -2
index 3592a946950b..752ae9cf4514 100644
@@ -214,8 +214,6 @@ static int egalax_ts_probe(struct i2c_client *client,
 			     ABS_MT_POSITION_Y, 0, EGALAX_MAX_Y, 0, 0);
 	input_mt_init_slots(input_dev, MAX_SUPPORT_POINTS, 0);
 
-	input_set_drvdata(input_dev, ts);
-
 	error = devm_request_threaded_irq(&client->dev, client->irq, NULL,
 					  egalax_ts_interrupt,
 					  IRQF_TRIGGER_LOW | IRQF_ONESHOT,
drivers/input/touchscreen/elants_i2c.c +0 -2
index 3e6003d32e56..872750eeca93 100644
@@ -1260,8 +1260,6 @@ static int elants_i2c_probe(struct i2c_client *client,
 	input_abs_set_res(ts->input, ABS_MT_POSITION_X, ts->x_res);
 	input_abs_set_res(ts->input, ABS_MT_POSITION_Y, ts->y_res);
 
-	input_set_drvdata(ts->input, ts);
-
 	error = input_register_device(ts->input);
 	if (error) {
 		dev_err(&client->dev,
drivers/input/touchscreen/ili210x.c +0 -1
index 91dc5fb34fe1..6f76eeedf465 100644
@@ -256,7 +256,6 @@ static int ili210x_i2c_probe(struct i2c_client *client,
 	input_set_abs_params(input, ABS_MT_POSITION_X, 0, xmax, 0, 0);
 	input_set_abs_params(input, ABS_MT_POSITION_Y, 0, ymax, 0, 0);
 
-	input_set_drvdata(input, priv);
 	i2c_set_clientdata(client, priv);
 
 	error = request_irq(client->irq, ili210x_irq, pdata->irq_flags,
drivers/input/touchscreen/mcs5000_ts.c +0 -1
index 8b47e1fecb25..90fc07dc98a6 100644
@@ -221,7 +221,6 @@ static int mcs5000_ts_probe(struct i2c_client *client,
 	input_set_abs_params(input_dev, ABS_X, 0, MCS5000_MAX_XC, 0, 0);
 	input_set_abs_params(input_dev, ABS_Y, 0, MCS5000_MAX_YC, 0, 0);
 
-	input_set_drvdata(input_dev, data);
 	data->input_dev = input_dev;
 
 	if (pdata->cfg_pin)
drivers/input/touchscreen/raydium_i2c_ts.c +0 -2
index 2658afa016c9..1252e49ccfa1 100644
@@ -1087,8 +1087,6 @@ static int raydium_i2c_probe(struct i2c_client *client,
 	ts->input->name = "Raydium Touchscreen";
 	ts->input->id.bustype = BUS_I2C;
 
-	input_set_drvdata(ts->input, ts);
-
 	input_set_abs_params(ts->input, ABS_MT_POSITION_X,
 			     0, le16_to_cpu(ts->info.x_max), 0, 0);
 	input_set_abs_params(ts->input, ABS_MT_POSITION_Y,
Signature · 1 line
2.7.4
maintainer
#6 lore raw
In reply to Guenter Roeck
Quoted 9 lines · Guenter Roeck

If there is not call to dev_get_drvdata() or input_get_drvdata(), the call to input_set_drvdata() is unnecessary and can be dropped.

The series was build tested on kerneltests.org and by the 0day build system.

The patch series is based on v4.10-rc4, with input/next (sha 2de8b4110c82) merged on top. For convenience, the series is available at:
git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git input-base

Quoted 7 lines

----------------------------------------------------------------
Guenter Roeck (5):
Input: keyboard - drop unnecessary calls to input_set_drvdata
Input: joystick/maplecontrol - drop unnecessary call to input_set_drvdata
Input: mouse - drop unnecessary calls to input_set_drvdata
Input: misc/dm355evm_keys - drop unnecessary call to input_set_drvdata
Input: touchscreen - drop unnecessary calls to input_set_drvdata

Applied the lot, thank you.

Signature · 1 line
Dmitry