Input: keyboard - use local variables consistently
authorGuenter Roeck <linux@roeck-us.net>
Sun, 22 Jan 2017 07:40:45 +0000 (23:40 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Sun, 22 Jan 2017 07:51:54 +0000 (23:51 -0800)
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>
drivers/input/keyboard/davinci_keyscan.c
drivers/input/keyboard/gpio_keys.c
drivers/input/keyboard/gpio_keys_polled.c
drivers/input/keyboard/mpr121_touchkey.c

index f363d1d2907afbec9b2df607bfa6d1301a714c61..b20a5d044caa096f1fd05ef90a781b0cde0de00f 100644 (file)
@@ -172,7 +172,7 @@ static int __init davinci_ks_probe(struct platform_device *pdev)
        struct input_dev *key_dev;
        struct resource *res, *mem;
        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;
 
        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->phys = "davinci_keyscan/input0";
-       key_dev->dev.parent = &pdev->dev;
+       key_dev->dev.parent = dev;
        key_dev->id.bustype = BUS_HOST;
        key_dev->id.vendor = 0x0001;
        key_dev->id.product = 0x0001;
index 858bbc16b900602eaccdfc6d1116ec4c3410d526..50b19b95269856d5aad7fe55b098766c950dbd62 100644 (file)
@@ -518,8 +518,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
                if (button->active_low)
                        flags |= GPIOF_ACTIVE_LOW;
 
-               error = devm_gpio_request_one(&pdev->dev, button->gpio, flags,
-                                             desc);
+               error = devm_gpio_request_one(dev, button->gpio, flags, desc);
                if (error < 0) {
                        dev_err(dev, "Failed to request GPIO %d, error %d\n",
                                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
         * 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) {
-               dev_err(&pdev->dev,
-                       "failed to register quiesce action, error: %d\n",
+               dev_err(dev, "failed to register quiesce action, error: %d\n",
                        error);
                return error;
        }
@@ -604,8 +602,8 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
        if (!button->can_disable)
                irqflags |= IRQF_SHARED;
 
-       error = devm_request_any_context_irq(&pdev->dev, bdata->irq,
-                                            isr, irqflags, desc, bdata);
+       error = devm_request_any_context_irq(dev, bdata->irq, isr, irqflags,
+                                            desc, bdata);
        if (error < 0) {
                dev_err(dev, "Unable to claim irq %d; error %d\n",
                        bdata->irq, error);
@@ -777,7 +775,7 @@ static int gpio_keys_probe(struct platform_device *pdev)
 
        input->name = pdata->name ? : pdev->name;
        input->phys = "gpio-keys/input0";
-       input->dev.parent = &pdev->dev;
+       input->dev.parent = dev;
        input->open = gpio_keys_open;
        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];
 
                if (!dev_get_platdata(dev)) {
-                       child = device_get_next_child_node(&pdev->dev, child);
+                       child = device_get_next_child_node(dev, child);
                        if (!child) {
-                               dev_err(&pdev->dev,
+                               dev_err(dev,
                                        "missing child device node for entry %d\n",
                                        i);
                                return -EINVAL;
@@ -820,7 +818,7 @@ static int gpio_keys_probe(struct platform_device *pdev)
 
        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) {
                dev_err(dev, "Unable to export keys/switches, error: %d\n",
                        error);
@@ -834,12 +832,12 @@ static int gpio_keys_probe(struct platform_device *pdev)
                goto err_remove_group;
        }
 
-       device_init_wakeup(&pdev->dev, wakeup);
+       device_init_wakeup(dev, wakeup);
 
        return 0;
 
 err_remove_group:
-       sysfs_remove_group(&pdev->dev.kobj, &gpio_keys_attr_group);
+       sysfs_remove_group(&dev->kobj, &gpio_keys_attr_group);
        return error;
 }
 
index cc193e665358f1bcbc02a2d2df7f40109f37d540..4fce43a6a0e0c12f851944cbe175de74e1cb53f1 100644 (file)
@@ -252,13 +252,13 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
 
        size = sizeof(struct gpio_keys_polled_dev) +
                        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) {
                dev_err(dev, "no memory for private data\n");
                return -ENOMEM;
        }
 
-       poll_dev = devm_input_allocate_polled_device(&pdev->dev);
+       poll_dev = devm_input_allocate_polled_device(dev);
        if (!poll_dev) {
                dev_err(dev, "no memory for polled device\n");
                return -ENOMEM;
@@ -332,7 +332,7 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
                        if (button->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);
                        if (error) {
                                dev_err(dev,
index 989ca66f63afb297423eddbae5f257f4da9d58a4..884a74d8a7edf50b26f9e62a4ce731d77d9f2c8e 100644 (file)
@@ -237,7 +237,7 @@ static int mpr_touchkey_probe(struct i2c_client *client,
        int i;
 
        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;
        }
 
@@ -247,11 +247,11 @@ static int mpr_touchkey_probe(struct i2c_client *client,
 
        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)
                return -ENOMEM;
 
-       input_dev = devm_input_allocate_device(&client->dev);
+       input_dev = devm_input_allocate_device(dev);
        if (!input_dev)
                return -ENOMEM;
 
@@ -275,7 +275,7 @@ static int mpr_touchkey_probe(struct i2c_client *client,
 
        input_dev->name = "Freescale MPR121 Touchkey";
        input_dev->id.bustype = BUS_I2C;
-       input_dev->dev.parent = &client->dev;
+       input_dev->dev.parent = dev;
        if (device_property_read_bool(dev, "autorepeat"))
                __set_bit(EV_REP, input_dev->evbit);
        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);
        if (error) {
-               dev_err(&client->dev, "Failed to init register\n");
+               dev_err(dev, "Failed to init register\n");
                return error;
        }
 
-       error = devm_request_threaded_irq(&client->dev, client->irq,
-                                         NULL, mpr_touchkey_interrupt,
+       error = devm_request_threaded_irq(dev, client->irq, NULL,
+                                         mpr_touchkey_interrupt,
                                          IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
-                                         client->dev.driver->name, mpr121);
+                                         dev->driver->name, mpr121);
        if (error) {
-               dev_err(&client->dev, "Failed to register interrupt\n");
+               dev_err(dev, "Failed to register interrupt\n");
                return error;
        }