summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorSylwester Nawrocki <s.nawrocki@samsung.com>2016-04-08 12:52:45 -0400
committerMark Brown <broonie@kernel.org>2016-05-30 11:20:03 -0400
commit2f7b5d14206eab0cc99399b19eda92ca2738d0db (patch)
tree6785097e5a482d15f4b428ec8a8ad3ec677878be /sound
parent42b926b8d0bad977be4a56db980a97784556f84a (diff)
ASoC: samsung: Use of_device_get_match_data() helper
Simplify the code a little by using a standard function for getting the match data. Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/samsung/i2s.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index 7ea030edd3f7..27ca116ef31f 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -18,6 +18,7 @@
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/of.h> 20#include <linux/of.h>
21#include <linux/of_device.h>
21#include <linux/of_gpio.h> 22#include <linux/of_gpio.h>
22#include <linux/pm_runtime.h> 23#include <linux/pm_runtime.h>
23 24
@@ -1106,21 +1107,6 @@ static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec)
1106 return i2s; 1107 return i2s;
1107} 1108}
1108 1109
1109static const struct of_device_id exynos_i2s_match[];
1110
1111static inline const struct samsung_i2s_dai_data *samsung_i2s_get_driver_data(
1112 struct platform_device *pdev)
1113{
1114 if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) {
1115 const struct of_device_id *match;
1116 match = of_match_node(exynos_i2s_match, pdev->dev.of_node);
1117 return match ? match->data : NULL;
1118 } else {
1119 return (struct samsung_i2s_dai_data *)
1120 platform_get_device_id(pdev)->driver_data;
1121 }
1122}
1123
1124#ifdef CONFIG_PM 1110#ifdef CONFIG_PM
1125static int i2s_runtime_suspend(struct device *dev) 1111static int i2s_runtime_suspend(struct device *dev)
1126{ 1112{
@@ -1233,9 +1219,13 @@ static int samsung_i2s_probe(struct platform_device *pdev)
1233 const struct samsung_i2s_dai_data *i2s_dai_data; 1219 const struct samsung_i2s_dai_data *i2s_dai_data;
1234 int ret; 1220 int ret;
1235 1221
1236 /* Call during Seconday interface registration */ 1222 if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node)
1237 i2s_dai_data = samsung_i2s_get_driver_data(pdev); 1223 i2s_dai_data = of_device_get_match_data(&pdev->dev);
1224 else
1225 i2s_dai_data = (struct samsung_i2s_dai_data *)
1226 platform_get_device_id(pdev)->driver_data;
1238 1227
1228 /* Call during the secondary interface registration */
1239 if (i2s_dai_data->dai_type == TYPE_SEC) { 1229 if (i2s_dai_data->dai_type == TYPE_SEC) {
1240 sec_dai = dev_get_drvdata(&pdev->dev); 1230 sec_dai = dev_get_drvdata(&pdev->dev);
1241 if (!sec_dai) { 1231 if (!sec_dai) {