diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-11-14 11:06:44 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2012-11-29 12:29:17 -0500 |
commit | efce8a412161b0555254bd6ac1dcdfb7886bfd8c (patch) | |
tree | 57f388150e5aea913b1f6b5f9c3c4601b9b7fe6c /drivers/input/keyboard/tca8418_keypad.c | |
parent | bf7f5316cbacbcb7d3c337eba36322cab255dec0 (diff) |
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>
Diffstat (limited to 'drivers/input/keyboard/tca8418_keypad.c')
-rw-r--r-- | drivers/input/keyboard/tca8418_keypad.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/input/keyboard/tca8418_keypad.c b/drivers/input/keyboard/tca8418_keypad.c index ac4ff13f51cc..3bb981af8ac4 100644 --- a/drivers/input/keyboard/tca8418_keypad.c +++ b/drivers/input/keyboard/tca8418_keypad.c | |||
@@ -281,6 +281,7 @@ static int tca8418_configure(struct tca8418_keypad *keypad_data, | |||
281 | static int tca8418_keypad_probe(struct i2c_client *client, | 281 | static int tca8418_keypad_probe(struct i2c_client *client, |
282 | const struct i2c_device_id *id) | 282 | const struct i2c_device_id *id) |
283 | { | 283 | { |
284 | struct device *dev = &client->dev; | ||
284 | const struct tca8418_keypad_platform_data *pdata = | 285 | const struct tca8418_keypad_platform_data *pdata = |
285 | client->dev.platform_data; | 286 | client->dev.platform_data; |
286 | struct tca8418_keypad *keypad_data; | 287 | struct tca8418_keypad *keypad_data; |
@@ -294,7 +295,7 @@ static int tca8418_keypad_probe(struct i2c_client *client, | |||
294 | /* Copy the platform data */ | 295 | /* Copy the platform data */ |
295 | if (pdata) { | 296 | if (pdata) { |
296 | if (!pdata->keymap_data) { | 297 | if (!pdata->keymap_data) { |
297 | dev_err(&client->dev, "no keymap data defined\n"); | 298 | dev_err(dev, "no keymap data defined\n"); |
298 | return -EINVAL; | 299 | return -EINVAL; |
299 | } | 300 | } |
300 | keymap_data = pdata->keymap_data; | 301 | keymap_data = pdata->keymap_data; |
@@ -303,25 +304,25 @@ static int tca8418_keypad_probe(struct i2c_client *client, | |||
303 | rep = pdata->rep; | 304 | rep = pdata->rep; |
304 | irq_is_gpio = pdata->irq_is_gpio; | 305 | irq_is_gpio = pdata->irq_is_gpio; |
305 | } else { | 306 | } else { |
306 | struct device_node *np = client->dev.of_node; | 307 | struct device_node *np = dev->of_node; |
307 | of_property_read_u32(np, "keypad,num-rows", &rows); | 308 | of_property_read_u32(np, "keypad,num-rows", &rows); |
308 | of_property_read_u32(np, "keypad,num-columns", &cols); | 309 | of_property_read_u32(np, "keypad,num-columns", &cols); |
309 | rep = of_property_read_bool(np, "keypad,autorepeat"); | 310 | rep = of_property_read_bool(np, "keypad,autorepeat"); |
310 | } | 311 | } |
311 | 312 | ||
312 | if (!rows || rows > TCA8418_MAX_ROWS) { | 313 | if (!rows || rows > TCA8418_MAX_ROWS) { |
313 | dev_err(&client->dev, "invalid rows\n"); | 314 | dev_err(dev, "invalid rows\n"); |
314 | return -EINVAL; | 315 | return -EINVAL; |
315 | } | 316 | } |
316 | 317 | ||
317 | if (!cols || cols > TCA8418_MAX_COLS) { | 318 | if (!cols || cols > TCA8418_MAX_COLS) { |
318 | dev_err(&client->dev, "invalid columns\n"); | 319 | dev_err(dev, "invalid columns\n"); |
319 | return -EINVAL; | 320 | return -EINVAL; |
320 | } | 321 | } |
321 | 322 | ||
322 | /* Check i2c driver capabilities */ | 323 | /* Check i2c driver capabilities */ |
323 | if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE)) { | 324 | 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", |
325 | dev_driver_string(&client->adapter->dev)); | 326 | dev_driver_string(&client->adapter->dev)); |
326 | return -ENODEV; | 327 | return -ENODEV; |
327 | } | 328 | } |
@@ -362,7 +363,7 @@ static int tca8418_keypad_probe(struct i2c_client *client, | |||
362 | error = matrix_keypad_build_keymap(keymap_data, NULL, rows, cols, | 363 | error = matrix_keypad_build_keymap(keymap_data, NULL, rows, cols, |
363 | keypad_data->keymap, input); | 364 | keypad_data->keymap, input); |
364 | if (error) { | 365 | if (error) { |
365 | dev_dbg(&client->dev, "Failed to build keymap\n"); | 366 | dev_dbg(dev, "Failed to build keymap\n"); |
366 | goto fail2; | 367 | goto fail2; |
367 | } | 368 | } |
368 | 369 | ||
@@ -381,16 +382,15 @@ static int tca8418_keypad_probe(struct i2c_client *client, | |||
381 | IRQF_ONESHOT, | 382 | IRQF_ONESHOT, |
382 | client->name, keypad_data); | 383 | client->name, keypad_data); |
383 | if (error) { | 384 | if (error) { |
384 | dev_dbg(&client->dev, | 385 | dev_dbg(dev, "Unable to claim irq %d; error %d\n", |
385 | "Unable to claim irq %d; error %d\n", | ||
386 | client->irq, error); | 386 | client->irq, error); |
387 | goto fail2; | 387 | goto fail2; |
388 | } | 388 | } |
389 | 389 | ||
390 | error = input_register_device(input); | 390 | error = input_register_device(input); |
391 | if (error) { | 391 | if (error) { |
392 | dev_dbg(&client->dev, | 392 | dev_dbg(dev, "Unable to register input device, error: %d\n", |
393 | "Unable to register input device, error: %d\n", error); | 393 | error); |
394 | goto fail3; | 394 | goto fail3; |
395 | } | 395 | } |
396 | 396 | ||