Input: keyboard - use local variables consistently

If a function declares a variable to access a structure element,
use it consistently.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
Guenter Roeck 2017-01-21 23:40:45 -08:00 committed by Dmitry Torokhov
parent 8300445cc7
commit b4e66e7d19
4 changed files with 25 additions and 27 deletions

View File

@ -172,7 +172,7 @@ static int __init davinci_ks_probe(struct platform_device *pdev)
struct input_dev *key_dev; struct input_dev *key_dev;
struct resource *res, *mem; struct resource *res, *mem;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct davinci_ks_platform_data *pdata = dev_get_platdata(&pdev->dev); struct davinci_ks_platform_data *pdata = dev_get_platdata(dev);
int error, i; int error, i;
if (pdata->device_enable) { if (pdata->device_enable) {
@ -255,7 +255,7 @@ static int __init davinci_ks_probe(struct platform_device *pdev)
key_dev->name = "davinci_keyscan"; key_dev->name = "davinci_keyscan";
key_dev->phys = "davinci_keyscan/input0"; key_dev->phys = "davinci_keyscan/input0";
key_dev->dev.parent = &pdev->dev; key_dev->dev.parent = dev;
key_dev->id.bustype = BUS_HOST; key_dev->id.bustype = BUS_HOST;
key_dev->id.vendor = 0x0001; key_dev->id.vendor = 0x0001;
key_dev->id.product = 0x0001; key_dev->id.product = 0x0001;

View File

@ -518,8 +518,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
if (button->active_low) if (button->active_low)
flags |= GPIOF_ACTIVE_LOW; flags |= GPIOF_ACTIVE_LOW;
error = devm_gpio_request_one(&pdev->dev, button->gpio, flags, error = devm_gpio_request_one(dev, button->gpio, flags, desc);
desc);
if (error < 0) { if (error < 0) {
dev_err(dev, "Failed to request GPIO %d, error %d\n", dev_err(dev, "Failed to request GPIO %d, error %d\n",
button->gpio, error); button->gpio, error);
@ -589,10 +588,9 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
* Install custom action to cancel release timer and * Install custom action to cancel release timer and
* workqueue item. * workqueue item.
*/ */
error = devm_add_action(&pdev->dev, gpio_keys_quiesce_key, bdata); error = devm_add_action(dev, gpio_keys_quiesce_key, bdata);
if (error) { if (error) {
dev_err(&pdev->dev, dev_err(dev, "failed to register quiesce action, error: %d\n",
"failed to register quiesce action, error: %d\n",
error); error);
return error; return error;
} }
@ -604,8 +602,8 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
if (!button->can_disable) if (!button->can_disable)
irqflags |= IRQF_SHARED; irqflags |= IRQF_SHARED;
error = devm_request_any_context_irq(&pdev->dev, bdata->irq, error = devm_request_any_context_irq(dev, bdata->irq, isr, irqflags,
isr, irqflags, desc, bdata); desc, bdata);
if (error < 0) { if (error < 0) {
dev_err(dev, "Unable to claim irq %d; error %d\n", dev_err(dev, "Unable to claim irq %d; error %d\n",
bdata->irq, error); bdata->irq, error);
@ -777,7 +775,7 @@ static int gpio_keys_probe(struct platform_device *pdev)
input->name = pdata->name ? : pdev->name; input->name = pdata->name ? : pdev->name;
input->phys = "gpio-keys/input0"; input->phys = "gpio-keys/input0";
input->dev.parent = &pdev->dev; input->dev.parent = dev;
input->open = gpio_keys_open; input->open = gpio_keys_open;
input->close = gpio_keys_close; input->close = gpio_keys_close;
@ -798,9 +796,9 @@ static int gpio_keys_probe(struct platform_device *pdev)
const struct gpio_keys_button *button = &pdata->buttons[i]; const struct gpio_keys_button *button = &pdata->buttons[i];
if (!dev_get_platdata(dev)) { if (!dev_get_platdata(dev)) {
child = device_get_next_child_node(&pdev->dev, child); child = device_get_next_child_node(dev, child);
if (!child) { if (!child) {
dev_err(&pdev->dev, dev_err(dev,
"missing child device node for entry %d\n", "missing child device node for entry %d\n",
i); i);
return -EINVAL; return -EINVAL;
@ -820,7 +818,7 @@ static int gpio_keys_probe(struct platform_device *pdev)
fwnode_handle_put(child); fwnode_handle_put(child);
error = sysfs_create_group(&pdev->dev.kobj, &gpio_keys_attr_group); error = sysfs_create_group(&dev->kobj, &gpio_keys_attr_group);
if (error) { if (error) {
dev_err(dev, "Unable to export keys/switches, error: %d\n", dev_err(dev, "Unable to export keys/switches, error: %d\n",
error); error);
@ -834,12 +832,12 @@ static int gpio_keys_probe(struct platform_device *pdev)
goto err_remove_group; goto err_remove_group;
} }
device_init_wakeup(&pdev->dev, wakeup); device_init_wakeup(dev, wakeup);
return 0; return 0;
err_remove_group: err_remove_group:
sysfs_remove_group(&pdev->dev.kobj, &gpio_keys_attr_group); sysfs_remove_group(&dev->kobj, &gpio_keys_attr_group);
return error; return error;
} }

View File

@ -252,13 +252,13 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
size = sizeof(struct gpio_keys_polled_dev) + size = sizeof(struct gpio_keys_polled_dev) +
pdata->nbuttons * sizeof(struct gpio_keys_button_data); pdata->nbuttons * sizeof(struct gpio_keys_button_data);
bdev = devm_kzalloc(&pdev->dev, size, GFP_KERNEL); bdev = devm_kzalloc(dev, size, GFP_KERNEL);
if (!bdev) { if (!bdev) {
dev_err(dev, "no memory for private data\n"); dev_err(dev, "no memory for private data\n");
return -ENOMEM; return -ENOMEM;
} }
poll_dev = devm_input_allocate_polled_device(&pdev->dev); poll_dev = devm_input_allocate_polled_device(dev);
if (!poll_dev) { if (!poll_dev) {
dev_err(dev, "no memory for polled device\n"); dev_err(dev, "no memory for polled device\n");
return -ENOMEM; return -ENOMEM;
@ -332,7 +332,7 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
if (button->active_low) if (button->active_low)
flags |= GPIOF_ACTIVE_LOW; flags |= GPIOF_ACTIVE_LOW;
error = devm_gpio_request_one(&pdev->dev, button->gpio, error = devm_gpio_request_one(dev, button->gpio,
flags, button->desc ? : DRV_NAME); flags, button->desc ? : DRV_NAME);
if (error) { if (error) {
dev_err(dev, dev_err(dev,

View File

@ -237,7 +237,7 @@ static int mpr_touchkey_probe(struct i2c_client *client,
int i; int i;
if (!client->irq) { if (!client->irq) {
dev_err(&client->dev, "irq number should not be zero\n"); dev_err(dev, "irq number should not be zero\n");
return -EINVAL; return -EINVAL;
} }
@ -247,11 +247,11 @@ static int mpr_touchkey_probe(struct i2c_client *client,
vdd_uv = regulator_get_voltage(vdd_supply); vdd_uv = regulator_get_voltage(vdd_supply);
mpr121 = devm_kzalloc(&client->dev, sizeof(*mpr121), GFP_KERNEL); mpr121 = devm_kzalloc(dev, sizeof(*mpr121), GFP_KERNEL);
if (!mpr121) if (!mpr121)
return -ENOMEM; return -ENOMEM;
input_dev = devm_input_allocate_device(&client->dev); input_dev = devm_input_allocate_device(dev);
if (!input_dev) if (!input_dev)
return -ENOMEM; return -ENOMEM;
@ -275,7 +275,7 @@ static int mpr_touchkey_probe(struct i2c_client *client,
input_dev->name = "Freescale MPR121 Touchkey"; input_dev->name = "Freescale MPR121 Touchkey";
input_dev->id.bustype = BUS_I2C; input_dev->id.bustype = BUS_I2C;
input_dev->dev.parent = &client->dev; input_dev->dev.parent = dev;
if (device_property_read_bool(dev, "autorepeat")) if (device_property_read_bool(dev, "autorepeat"))
__set_bit(EV_REP, input_dev->evbit); __set_bit(EV_REP, input_dev->evbit);
input_set_capability(input_dev, EV_MSC, MSC_SCAN); input_set_capability(input_dev, EV_MSC, MSC_SCAN);
@ -289,16 +289,16 @@ static int mpr_touchkey_probe(struct i2c_client *client,
error = mpr121_phys_init(mpr121, client, vdd_uv); error = mpr121_phys_init(mpr121, client, vdd_uv);
if (error) { if (error) {
dev_err(&client->dev, "Failed to init register\n"); dev_err(dev, "Failed to init register\n");
return error; return error;
} }
error = devm_request_threaded_irq(&client->dev, client->irq, error = devm_request_threaded_irq(dev, client->irq, NULL,
NULL, mpr_touchkey_interrupt, mpr_touchkey_interrupt,
IRQF_TRIGGER_FALLING | IRQF_ONESHOT, IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
client->dev.driver->name, mpr121); dev->driver->name, mpr121);
if (error) { if (error) {
dev_err(&client->dev, "Failed to register interrupt\n"); dev_err(dev, "Failed to register interrupt\n");
return error; return error;
} }