summaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2019-02-06 22:01:30 -0800
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2019-02-06 22:18:13 -0800
commit122945776271efee91012c2a345b720d39b15b7c (patch)
tree98d4a668c689ca73fb5a48f1e26b0517c162e85c /drivers/input
parente3559442afd2a3d9b09eedc236f19698c515472e (diff)
downloadlinux-stable-122945776271efee91012c2a345b720d39b15b7c.tar.gz
linux-stable-122945776271efee91012c2a345b720d39b15b7c.tar.bz2
linux-stable-122945776271efee91012c2a345b720d39b15b7c.zip
Input: ili210x - reorder probe
Perform the register access only after the I2C client data are set, this is only done in preparation for the subsequent patch which uses the I2C client data in the register IO function. Signed-off-by: Marek Vasut <marex@denx.de> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/touchscreen/ili210x.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c
index c345d6df783f..ba2634582364 100644
--- a/drivers/input/touchscreen/ili210x.c
+++ b/drivers/input/touchscreen/ili210x.c
@@ -223,6 +223,22 @@ static int ili210x_i2c_probe(struct i2c_client *client,
msleep(100);
}
+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+ if (!priv)
+ return -ENOMEM;
+
+ input = devm_input_allocate_device(dev);
+ if (!input)
+ return -ENOMEM;
+
+ priv->client = client;
+ priv->input = input;
+ priv->poll_period = DEFAULT_POLL_PERIOD;
+ INIT_DELAYED_WORK(&priv->dwork, ili210x_work);
+ priv->reset_gpio = reset_gpio;
+
+ i2c_set_clientdata(client, priv);
+
/* Get firmware version */
error = ili210x_read_reg(client, REG_FIRMWARE_VERSION,
&firmware, sizeof(firmware));
@@ -243,20 +259,6 @@ static int ili210x_i2c_probe(struct i2c_client *client,
xmax = panel.x_low | (panel.x_high << 8);
ymax = panel.y_low | (panel.y_high << 8);
- priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
- if (!priv)
- return -ENOMEM;
-
- input = devm_input_allocate_device(dev);
- if (!input)
- return -ENOMEM;
-
- priv->client = client;
- priv->input = input;
- priv->poll_period = DEFAULT_POLL_PERIOD;
- INIT_DELAYED_WORK(&priv->dwork, ili210x_work);
- priv->reset_gpio = reset_gpio;
-
/* Setup input device */
input->name = "ILI210x Touchscreen";
input->id.bustype = BUS_I2C;
@@ -276,8 +278,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);
- i2c_set_clientdata(client, priv);
-
error = devm_add_action(dev, ili210x_cancel_work, priv);
if (error)
return error;