mailbox: bcm-flexrm-mailbox: using dev_get_drvdata directly
authorFuqian Huang <huangfq.daxian@gmail.com>
Thu, 4 Jul 2019 02:36:27 +0000 (10:36 +0800)
committerJassi Brar <jaswinder.singh@linaro.org>
Thu, 11 Jul 2019 04:08:44 +0000 (23:08 -0500)
Several drivers cast a struct device pointer to a struct
platform_device pointer only to then call platform_get_drvdata().
To improve readability, these constructs can be simplified
by using dev_get_drvdata() directly.

Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
drivers/mailbox/bcm-flexrm-mailbox.c

index a64116586b4cccbfbe6b8e26c38209eb7ac5cd10..0cfdd53d04a1a1f9d8ef3a6b77d4665a5ccbde69 100644 (file)
@@ -1165,8 +1165,7 @@ static int flexrm_process_completions(struct flexrm_ring *ring)
 
 static int flexrm_debugfs_conf_show(struct seq_file *file, void *offset)
 {
-       struct platform_device *pdev = to_platform_device(file->private);
-       struct flexrm_mbox *mbox = platform_get_drvdata(pdev);
+       struct flexrm_mbox *mbox = dev_get_drvdata(file->private);
 
        /* Write config in file */
        flexrm_write_config_in_seqfile(mbox, file);
@@ -1176,8 +1175,7 @@ static int flexrm_debugfs_conf_show(struct seq_file *file, void *offset)
 
 static int flexrm_debugfs_stats_show(struct seq_file *file, void *offset)
 {
-       struct platform_device *pdev = to_platform_device(file->private);
-       struct flexrm_mbox *mbox = platform_get_drvdata(pdev);
+       struct flexrm_mbox *mbox = dev_get_drvdata(file->private);
 
        /* Write stats in file */
        flexrm_write_stats_in_seqfile(mbox, file);