Skip to content

Commit efce8a4

Browse files
committed
Input: tca8418_keypad - use a temporary variable for parent device
Use a temporary variable for our parent device (coming from I2C client structure); we'll be also using it during conversion to managed resources. Reviewed-by: Alban Bedel <alban.bedel@avionic-design.de> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent bf7f531 commit efce8a4

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

‎drivers/input/keyboard/tca8418_keypad.c‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,7 @@ static int tca8418_configure(struct tca8418_keypad *keypad_data,
281281
static int tca8418_keypad_probe(struct i2c_client *client,
282282
const struct i2c_device_id *id)
283283
{
284+
struct device *dev = &client->dev;
284285
const struct tca8418_keypad_platform_data *pdata =
285286
client->dev.platform_data;
286287
struct tca8418_keypad *keypad_data;
@@ -294,7 +295,7 @@ static int tca8418_keypad_probe(struct i2c_client *client,
294295
/* Copy the platform data */
295296
if (pdata) {
296297
if (!pdata->keymap_data) {
297-
dev_err(&client->dev, "no keymap data defined\n");
298+
dev_err(dev, "no keymap data defined\n");
298299
return -EINVAL;
299300
}
300301
keymap_data = pdata->keymap_data;
@@ -303,25 +304,25 @@ static int tca8418_keypad_probe(struct i2c_client *client,
303304
rep = pdata->rep;
304305
irq_is_gpio = pdata->irq_is_gpio;
305306
} else {
306-
struct device_node *np = client->dev.of_node;
307+
struct device_node *np = dev->of_node;
307308
of_property_read_u32(np, "keypad,num-rows", &rows);
308309
of_property_read_u32(np, "keypad,num-columns", &cols);
309310
rep = of_property_read_bool(np, "keypad,autorepeat");
310311
}
311312

312313
if (!rows || rows > TCA8418_MAX_ROWS) {
313-
dev_err(&client->dev, "invalid rows\n");
314+
dev_err(dev, "invalid rows\n");
314315
return -EINVAL;
315316
}
316317

317318
if (!cols || cols > TCA8418_MAX_COLS) {
318-
dev_err(&client->dev, "invalid columns\n");
319+
dev_err(dev, "invalid columns\n");
319320
return -EINVAL;
320321
}
321322

322323
/* Check i2c driver capabilities */
323324
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE)) {
324-
dev_err(&client->dev, "%s adapter not supported\n",
325+
dev_err(dev, "%s adapter not supported\n",
325326
dev_driver_string(&client->adapter->dev));
326327
return -ENODEV;
327328
}
@@ -362,7 +363,7 @@ static int tca8418_keypad_probe(struct i2c_client *client,
362363
error = matrix_keypad_build_keymap(keymap_data, NULL, rows, cols,
363364
keypad_data->keymap, input);
364365
if (error) {
365-
dev_dbg(&client->dev, "Failed to build keymap\n");
366+
dev_dbg(dev, "Failed to build keymap\n");
366367
goto fail2;
367368
}
368369

@@ -381,16 +382,15 @@ static int tca8418_keypad_probe(struct i2c_client *client,
381382
IRQF_ONESHOT,
382383
client->name, keypad_data);
383384
if (error) {
384-
dev_dbg(&client->dev,
385-
"Unable to claim irq %d; error %d\n",
385+
dev_dbg(dev, "Unable to claim irq %d; error %d\n",
386386
client->irq, error);
387387
goto fail2;
388388
}
389389

390390
error = input_register_device(input);
391391
if (error) {
392-
dev_dbg(&client->dev,
393-
"Unable to register input device, error: %d\n", error);
392+
dev_dbg(dev, "Unable to register input device, error: %d\n",
393+
error);
394394
goto fail3;
395395
}
396396

0 commit comments

Comments
 (0)