aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2019-02-07 01:01:30 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2019-02-07 01:18:13 -0500
commit122945776271efee91012c2a345b720d39b15b7c (patch)
tree98d4a668c689ca73fb5a48f1e26b0517c162e85c /drivers/input
parente3559442afd2a3d9b09eedc236f19698c515472e (diff)
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,
223 msleep(100); 223 msleep(100);
224 } 224 }
225 225
226 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
227 if (!priv)
228 return -ENOMEM;
229
230 input = devm_input_allocate_device(dev);
231 if (!input)
232 return -ENOMEM;
233
234 priv->client = client;
235 priv->input = input;
236 priv->poll_period = DEFAULT_POLL_PERIOD;
237 INIT_DELAYED_WORK(&priv->dwork, ili210x_work);
238 priv->reset_gpio = reset_gpio;
239
240 i2c_set_clientdata(client, priv);
241
226 /* Get firmware version */ 242 /* Get firmware version */
227 error = ili210x_read_reg(client, REG_FIRMWARE_VERSION, 243 error = ili210x_read_reg(client, REG_FIRMWARE_VERSION,
228 &firmware, sizeof(firmware)); 244 &firmware, sizeof(firmware));
@@ -243,20 +259,6 @@ static int ili210x_i2c_probe(struct i2c_client *client,
243 xmax = panel.x_low | (panel.x_high << 8); 259 xmax = panel.x_low | (panel.x_high << 8);
244 ymax = panel.y_low | (panel.y_high << 8); 260 ymax = panel.y_low | (panel.y_high << 8);
245 261
246 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
247 if (!priv)
248 return -ENOMEM;
249
250 input = devm_input_allocate_device(dev);
251 if (!input)
252 return -ENOMEM;
253
254 priv->client = client;
255 priv->input = input;
256 priv->poll_period = DEFAULT_POLL_PERIOD;
257 INIT_DELAYED_WORK(&priv->dwork, ili210x_work);
258 priv->reset_gpio = reset_gpio;
259
260 /* Setup input device */ 262 /* Setup input device */
261 input->name = "ILI210x Touchscreen"; 263 input->name = "ILI210x Touchscreen";
262 input->id.bustype = BUS_I2C; 264 input->id.bustype = BUS_I2C;
@@ -276,8 +278,6 @@ static int ili210x_i2c_probe(struct i2c_client *client,
276 input_set_abs_params(input, ABS_MT_POSITION_X, 0, xmax, 0, 0); 278 input_set_abs_params(input, ABS_MT_POSITION_X, 0, xmax, 0, 0);
277 input_set_abs_params(input, ABS_MT_POSITION_Y, 0, ymax, 0, 0); 279 input_set_abs_params(input, ABS_MT_POSITION_Y, 0, ymax, 0, 0);
278 280
279 i2c_set_clientdata(client, priv);
280
281 error = devm_add_action(dev, ili210x_cancel_work, priv); 281 error = devm_add_action(dev, ili210x_cancel_work, priv);
282 if (error) 282 if (error)
283 return error; 283 return error;