summaryrefslogtreecommitdiff
path: root/drivers/input/misc/sparcspkr.c
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2013-05-23 20:20:21 +0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2013-05-23 20:34:13 +0400
commit35c4b1227e1f3ea8b8536834aaa96c2cc7c0cfa0 (patch)
tree4eb6b6dc23e75a80e75667299d248278be402d22 /drivers/input/misc/sparcspkr.c
parentd52014556d8a1f3be57db4f04d6fdce06af87493 (diff)
downloadlinux-35c4b1227e1f3ea8b8536834aaa96c2cc7c0cfa0.tar.xz
Input: misc - use platform_{get,set}_drvdata()
Use the wrapper functions for getting and setting the driver data using platform_device instead of using dev_{get,set}_drvdata() with &pdev->dev, so we can directly pass a struct platform_device. Also, unnecessary dev_set_drvdata() is removed, because the driver core clears the driver data to NULL after device_release or on probe failure. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input/misc/sparcspkr.c')
-rw-r--r--drivers/input/misc/sparcspkr.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/input/misc/sparcspkr.c b/drivers/input/misc/sparcspkr.c
index a53586a7fbdb..65fd3150919b 100644
--- a/drivers/input/misc/sparcspkr.c
+++ b/drivers/input/misc/sparcspkr.c
@@ -175,7 +175,7 @@ static int sparcspkr_probe(struct device *dev)
static void sparcspkr_shutdown(struct platform_device *dev)
{
- struct sparcspkr_state *state = dev_get_drvdata(&dev->dev);
+ struct sparcspkr_state *state = platform_get_drvdata(dev);
struct input_dev *input_dev = state->input_dev;
/* turn off the speaker */
@@ -211,7 +211,7 @@ static int bbc_beep_probe(struct platform_device *op)
if (!info->regs)
goto out_free;
- dev_set_drvdata(&op->dev, state);
+ platform_set_drvdata(op, state);
err = sparcspkr_probe(&op->dev);
if (err)
@@ -220,7 +220,6 @@ static int bbc_beep_probe(struct platform_device *op)
return 0;
out_clear_drvdata:
- dev_set_drvdata(&op->dev, NULL);
of_iounmap(&op->resource[0], info->regs, 6);
out_free:
@@ -231,7 +230,7 @@ out_err:
static int bbc_remove(struct platform_device *op)
{
- struct sparcspkr_state *state = dev_get_drvdata(&op->dev);
+ struct sparcspkr_state *state = platform_get_drvdata(op);
struct input_dev *input_dev = state->input_dev;
struct bbc_beep_info *info = &state->u.bbc;
@@ -242,7 +241,6 @@ static int bbc_remove(struct platform_device *op)
of_iounmap(&op->resource[0], info->regs, 6);
- dev_set_drvdata(&op->dev, NULL);
kfree(state);
return 0;
@@ -290,7 +288,7 @@ static int grover_beep_probe(struct platform_device *op)
if (!info->enable_reg)
goto out_unmap_freq_regs;
- dev_set_drvdata(&op->dev, state);
+ platform_set_drvdata(op, state);
err = sparcspkr_probe(&op->dev);
if (err)
@@ -299,7 +297,6 @@ static int grover_beep_probe(struct platform_device *op)
return 0;
out_clear_drvdata:
- dev_set_drvdata(&op->dev, NULL);
of_iounmap(&op->resource[3], info->enable_reg, 1);
out_unmap_freq_regs:
@@ -312,7 +309,7 @@ out_err:
static int grover_remove(struct platform_device *op)
{
- struct sparcspkr_state *state = dev_get_drvdata(&op->dev);
+ struct sparcspkr_state *state = platform_get_drvdata(op);
struct grover_beep_info *info = &state->u.grover;
struct input_dev *input_dev = state->input_dev;
@@ -324,7 +321,6 @@ static int grover_remove(struct platform_device *op)
of_iounmap(&op->resource[3], info->enable_reg, 1);
of_iounmap(&op->resource[2], info->freq_regs, 2);
- dev_set_drvdata(&op->dev, NULL);
kfree(state);
return 0;