[PATCH V2 08/10] input: touchscreen: ili210x: Reorder probe

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>
Cc: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
Cc: Henrik Rydberg <rydberg@xxxxxxxxxxx>
Cc: Olivier Sobrie <olivier@xxxxxxxxx>
Cc: Philipp Puschmann <pp@xxxxxxxxx>
To: linux-input@xxxxxxxxxxxxxxx
---
V2: No change
---
 drivers/input/touchscreen/ili210x.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c
index ab0e6c9a614c..b6143f7c2477 100644
--- a/drivers/input/touchscreen/ili210x.c
+++ b/drivers/input/touchscreen/ili210x.c
@@ -208,6 +208,19 @@ static int ili210x_i2c_probe(struct i2c_client *client,
 		mdelay(100);
 	}
 
+	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+	input = devm_input_allocate_device(dev);
+	if (!priv || !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));
@@ -228,17 +241,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);
-	input = devm_input_allocate_device(dev);
-	if (!priv || !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;
@@ -258,8 +260,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_request_threaded_irq(dev, client->irq, NULL, ili210x_irq,
 				 IRQF_ONESHOT, client->name, priv);
 	if (error) {
-- 
2.19.2




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux