aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorStephen Warren <swarren@nvidia.com>2011-11-22 20:21:21 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-11-23 06:10:52 -0500
commit45c26091205eb6ad737329c5973f46fd7c122595 (patch)
tree93c7659c24f47cd5cc979b34572eafd17c67c42f /sound/soc
parente4e4c18a930ff11940ba2c525676566bd631706f (diff)
ASoC: Tegra TrimSlice machine: Use devm_ APIs and module_platform_driver
module_platform_driver saves some boiler-plate code. The devm_ APIs remove the need to manually clean up allocations, thus removing some code. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/tegra/trimslice.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/sound/soc/tegra/trimslice.c b/sound/soc/tegra/trimslice.c
index 2699a6fa45f9..d564b40756a9 100644
--- a/sound/soc/tegra/trimslice.c
+++ b/sound/soc/tegra/trimslice.c
@@ -170,15 +170,17 @@ static __devinit int tegra_snd_trimslice_probe(struct platform_device *pdev)
170 struct tegra_trimslice *trimslice; 170 struct tegra_trimslice *trimslice;
171 int ret; 171 int ret;
172 172
173 trimslice = kzalloc(sizeof(struct tegra_trimslice), GFP_KERNEL); 173 trimslice = devm_kzalloc(&pdev->dev, sizeof(struct tegra_trimslice),
174 GFP_KERNEL);
174 if (!trimslice) { 175 if (!trimslice) {
175 dev_err(&pdev->dev, "Can't allocate tegra_trimslice\n"); 176 dev_err(&pdev->dev, "Can't allocate tegra_trimslice\n");
176 return -ENOMEM; 177 ret = -ENOMEM;
178 goto err;
177 } 179 }
178 180
179 ret = tegra_asoc_utils_init(&trimslice->util_data, &pdev->dev); 181 ret = tegra_asoc_utils_init(&trimslice->util_data, &pdev->dev);
180 if (ret) 182 if (ret)
181 goto err_free_trimslice; 183 goto err;
182 184
183 card->dev = &pdev->dev; 185 card->dev = &pdev->dev;
184 platform_set_drvdata(pdev, card); 186 platform_set_drvdata(pdev, card);
@@ -195,8 +197,7 @@ static __devinit int tegra_snd_trimslice_probe(struct platform_device *pdev)
195 197
196err_fini_utils: 198err_fini_utils:
197 tegra_asoc_utils_fini(&trimslice->util_data); 199 tegra_asoc_utils_fini(&trimslice->util_data);
198err_free_trimslice: 200err:
199 kfree(trimslice);
200 return ret; 201 return ret;
201} 202}
202 203
@@ -209,8 +210,6 @@ static int __devexit tegra_snd_trimslice_remove(struct platform_device *pdev)
209 210
210 tegra_asoc_utils_fini(&trimslice->util_data); 211 tegra_asoc_utils_fini(&trimslice->util_data);
211 212
212 kfree(trimslice);
213
214 return 0; 213 return 0;
215} 214}
216 215
@@ -222,18 +221,7 @@ static struct platform_driver tegra_snd_trimslice_driver = {
222 .probe = tegra_snd_trimslice_probe, 221 .probe = tegra_snd_trimslice_probe,
223 .remove = __devexit_p(tegra_snd_trimslice_remove), 222 .remove = __devexit_p(tegra_snd_trimslice_remove),
224}; 223};
225 224module_platform_driver(tegra_snd_trimslice_driver);
226static int __init snd_tegra_trimslice_init(void)
227{
228 return platform_driver_register(&tegra_snd_trimslice_driver);
229}
230module_init(snd_tegra_trimslice_init);
231
232static void __exit snd_tegra_trimslice_exit(void)
233{
234 platform_driver_unregister(&tegra_snd_trimslice_driver);
235}
236module_exit(snd_tegra_trimslice_exit);
237 225
238MODULE_AUTHOR("Mike Rapoport <mike@compulab.co.il>"); 226MODULE_AUTHOR("Mike Rapoport <mike@compulab.co.il>");
239MODULE_DESCRIPTION("Trimslice machine ASoC driver"); 227MODULE_DESCRIPTION("Trimslice machine ASoC driver");