summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2017-01-18 22:36:25 +0300
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2017-01-18 22:49:11 +0300
commit0265c324b8a2bbe502fee3007361d310de3b6d0c (patch)
tree217345b048992a4ce1f78aee4694af10078d3245
parentad03ae44baeb82b28024c8c582e18146b96d637e (diff)
downloadlinux-0265c324b8a2bbe502fee3007361d310de3b6d0c.tar.xz
Input: bfin_rotary - switch to using devm_add_action_or_reset()
Use local variable 'dev' instead of dereferencing it several times and replace devm_add_action() and manual error handling with devm_add_action_or_reset(). Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r--drivers/input/misc/bfin_rotary.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/input/misc/bfin_rotary.c b/drivers/input/misc/bfin_rotary.c
index a0fc18fdfc0c..799ce3d2820e 100644
--- a/drivers/input/misc/bfin_rotary.c
+++ b/drivers/input/misc/bfin_rotary.c
@@ -147,19 +147,18 @@ static int bfin_rotary_probe(struct platform_device *pdev)
if (pdata->pin_list) {
error = peripheral_request_list(pdata->pin_list,
- dev_name(&pdev->dev));
+ dev_name(dev));
if (error) {
dev_err(dev, "requesting peripherals failed: %d\n",
error);
return error;
}
- error = devm_add_action(dev, bfin_rotary_free_action,
- pdata->pin_list);
+ error = devm_add_action_or_reset(dev, bfin_rotary_free_action,
+ pdata->pin_list);
if (error) {
dev_err(dev, "setting cleanup action failed: %d\n",
error);
- peripheral_free_list(pdata->pin_list);
return error;
}
}
@@ -189,7 +188,7 @@ static int bfin_rotary_probe(struct platform_device *pdev)
input->name = pdev->name;
input->phys = "bfin-rotary/input0";
- input->dev.parent = &pdev->dev;
+ input->dev.parent = dev;
input_set_drvdata(input, rotary);
@@ -239,7 +238,7 @@ static int bfin_rotary_probe(struct platform_device *pdev)
}
platform_set_drvdata(pdev, rotary);
- device_init_wakeup(&pdev->dev, 1);
+ device_init_wakeup(dev, 1);
return 0;
}