aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/au1x/psc-ac97.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/au1x/psc-ac97.c')
-rw-r--r--sound/soc/au1x/psc-ac97.c43
1 files changed, 15 insertions, 28 deletions
diff --git a/sound/soc/au1x/psc-ac97.c b/sound/soc/au1x/psc-ac97.c
index 0c6acd54714..476b79a1c11 100644
--- a/sound/soc/au1x/psc-ac97.c
+++ b/sound/soc/au1x/psc-ac97.c
@@ -337,7 +337,7 @@ static int au1xpsc_ac97_probe(struct snd_soc_dai *dai)
337 return au1xpsc_ac97_workdata ? 0 : -ENODEV; 337 return au1xpsc_ac97_workdata ? 0 : -ENODEV;
338} 338}
339 339
340static struct snd_soc_dai_ops au1xpsc_ac97_dai_ops = { 340static const struct snd_soc_dai_ops au1xpsc_ac97_dai_ops = {
341 .startup = au1xpsc_ac97_startup, 341 .startup = au1xpsc_ac97_startup,
342 .trigger = au1xpsc_ac97_trigger, 342 .trigger = au1xpsc_ac97_trigger,
343 .hw_params = au1xpsc_ac97_hw_params, 343 .hw_params = au1xpsc_ac97_hw_params,
@@ -368,35 +368,35 @@ static int __devinit au1xpsc_ac97_drvprobe(struct platform_device *pdev)
368 unsigned long sel; 368 unsigned long sel;
369 struct au1xpsc_audio_data *wd; 369 struct au1xpsc_audio_data *wd;
370 370
371 wd = kzalloc(sizeof(struct au1xpsc_audio_data), GFP_KERNEL); 371 wd = devm_kzalloc(&pdev->dev, sizeof(struct au1xpsc_audio_data),
372 GFP_KERNEL);
372 if (!wd) 373 if (!wd)
373 return -ENOMEM; 374 return -ENOMEM;
374 375
375 mutex_init(&wd->lock); 376 mutex_init(&wd->lock);
376 377
377 iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); 378 iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
378 if (!iores) { 379 if (!iores)
379 ret = -ENODEV; 380 return -ENODEV;
380 goto out0;
381 }
382 381
383 ret = -EBUSY; 382 if (!devm_request_mem_region(&pdev->dev, iores->start,
384 if (!request_mem_region(iores->start, resource_size(iores), 383 resource_size(iores),
385 pdev->name)) 384 pdev->name))
386 goto out0; 385 return -EBUSY;
387 386
388 wd->mmio = ioremap(iores->start, resource_size(iores)); 387 wd->mmio = devm_ioremap(&pdev->dev, iores->start,
388 resource_size(iores));
389 if (!wd->mmio) 389 if (!wd->mmio)
390 goto out1; 390 return -EBUSY;
391 391
392 dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0); 392 dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
393 if (!dmares) 393 if (!dmares)
394 goto out2; 394 return -EBUSY;
395 wd->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = dmares->start; 395 wd->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = dmares->start;
396 396
397 dmares = platform_get_resource(pdev, IORESOURCE_DMA, 1); 397 dmares = platform_get_resource(pdev, IORESOURCE_DMA, 1);
398 if (!dmares) 398 if (!dmares)
399 goto out2; 399 return -EBUSY;
400 wd->dmaids[SNDRV_PCM_STREAM_CAPTURE] = dmares->start; 400 wd->dmaids[SNDRV_PCM_STREAM_CAPTURE] = dmares->start;
401 401
402 /* configuration: max dma trigger threshold, enable ac97 */ 402 /* configuration: max dma trigger threshold, enable ac97 */
@@ -421,24 +421,15 @@ static int __devinit au1xpsc_ac97_drvprobe(struct platform_device *pdev)
421 421
422 ret = snd_soc_register_dai(&pdev->dev, &wd->dai_drv); 422 ret = snd_soc_register_dai(&pdev->dev, &wd->dai_drv);
423 if (ret) 423 if (ret)
424 goto out2; 424 return ret;
425 425
426 au1xpsc_ac97_workdata = wd; 426 au1xpsc_ac97_workdata = wd;
427 return 0; 427 return 0;
428
429out2:
430 iounmap(wd->mmio);
431out1:
432 release_mem_region(iores->start, resource_size(iores));
433out0:
434 kfree(wd);
435 return ret;
436} 428}
437 429
438static int __devexit au1xpsc_ac97_drvremove(struct platform_device *pdev) 430static int __devexit au1xpsc_ac97_drvremove(struct platform_device *pdev)
439{ 431{
440 struct au1xpsc_audio_data *wd = platform_get_drvdata(pdev); 432 struct au1xpsc_audio_data *wd = platform_get_drvdata(pdev);
441 struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
442 433
443 snd_soc_unregister_dai(&pdev->dev); 434 snd_soc_unregister_dai(&pdev->dev);
444 435
@@ -448,10 +439,6 @@ static int __devexit au1xpsc_ac97_drvremove(struct platform_device *pdev)
448 au_writel(PSC_CTRL_DISABLE, PSC_CTRL(wd)); 439 au_writel(PSC_CTRL_DISABLE, PSC_CTRL(wd));
449 au_sync(); 440 au_sync();
450 441
451 iounmap(wd->mmio);
452 release_mem_region(r->start, resource_size(r));
453 kfree(wd);
454
455 au1xpsc_ac97_workdata = NULL; /* MDEV */ 442 au1xpsc_ac97_workdata = NULL; /* MDEV */
456 443
457 return 0; 444 return 0;