staging: ccree: Convert to platform_{get,set}_drvdata()

Platform devices are expected to use wrapper functions,
platform_{get,set}_drvdata() with platform_device as argument,
for getting and setting the driver data. dev_{get,set}_drvdata()
are using &plat_dev->dev.
For wrapper functions we can directly pass a struct platform_device.

dev_set_drvdata() is redundant and therefore removed. The driver core
clears the driver data to NULL after device_release or on probe failure.

Signed-off-by: Suniel Mahesh <sunil.m@techveda.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Suniel Mahesh 2017-10-04 13:15:37 +05:30 committed by Greg Kroah-Hartman
parent 3e6c508693
commit 006e202fe6
1 changed files with 2 additions and 4 deletions

View File

@ -215,7 +215,7 @@ static int init_cc_resources(struct platform_device *plat_dev)
rc = -ENOMEM; rc = -ENOMEM;
goto post_drvdata_err; goto post_drvdata_err;
} }
dev_set_drvdata(dev, new_drvdata); platform_set_drvdata(plat_dev, new_drvdata);
new_drvdata->plat_dev = plat_dev; new_drvdata->plat_dev = plat_dev;
new_drvdata->clk = of_clk_get(np, 0); new_drvdata->clk = of_clk_get(np, 0);
@ -393,7 +393,6 @@ post_clk_err:
cc_clk_off(new_drvdata); cc_clk_off(new_drvdata);
post_drvdata_err: post_drvdata_err:
dev_err(dev, "ccree init error occurred!\n"); dev_err(dev, "ccree init error occurred!\n");
dev_set_drvdata(dev, NULL);
return rc; return rc;
} }
@ -407,7 +406,7 @@ void fini_cc_regs(struct ssi_drvdata *drvdata)
static void cleanup_cc_resources(struct platform_device *plat_dev) static void cleanup_cc_resources(struct platform_device *plat_dev)
{ {
struct ssi_drvdata *drvdata = struct ssi_drvdata *drvdata =
(struct ssi_drvdata *)dev_get_drvdata(&plat_dev->dev); (struct ssi_drvdata *)platform_get_drvdata(plat_dev);
ssi_aead_free(drvdata); ssi_aead_free(drvdata);
ssi_hash_free(drvdata); ssi_hash_free(drvdata);
@ -423,7 +422,6 @@ static void cleanup_cc_resources(struct platform_device *plat_dev)
#endif #endif
fini_cc_regs(drvdata); fini_cc_regs(drvdata);
cc_clk_off(drvdata); cc_clk_off(drvdata);
dev_set_drvdata(&plat_dev->dev, NULL);
} }
int cc_clk_on(struct ssi_drvdata *drvdata) int cc_clk_on(struct ssi_drvdata *drvdata)