From 7204264f530797a2adb86795b535531c92c876b5 Mon Sep 17 00:00:00 2001 From: Julia Lawall Date: Thu, 29 Dec 2011 17:51:25 +0100 Subject: [PATCH] --- yaml --- r: 284063 b: refs/heads/master c: 8d9626d72833bf68791e4cf9ac151c96c44c0f87 h: refs/heads/master i: 284061: 17010863e8e2691b16e12270c617922d9a48caee 284059: 79fa8092f25ee7d914beceee68d1a19de0174ad6 284055: 74528928acc43866b2b56504836aa941748b49bb 284047: 497a2e3111f993f7a8995c04024f039006fa39f6 284031: cc028c4e80bcbad0b9f2c616fdca57cdad1c8cd9 v: v3 --- [refs] | 2 +- trunk/sound/soc/au1x/psc-ac97.c | 41 +++++++++++---------------------- 2 files changed, 15 insertions(+), 28 deletions(-) diff --git a/[refs] b/[refs] index fd67dbdabb9a..76b0fe44acfd 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: aa4079c110133e5ed86895a07bffb20dd20ed40e +refs/heads/master: 8d9626d72833bf68791e4cf9ac151c96c44c0f87 diff --git a/trunk/sound/soc/au1x/psc-ac97.c b/trunk/sound/soc/au1x/psc-ac97.c index 87daf456b1c9..476b79a1c11a 100644 --- a/trunk/sound/soc/au1x/psc-ac97.c +++ b/trunk/sound/soc/au1x/psc-ac97.c @@ -368,35 +368,35 @@ static int __devinit au1xpsc_ac97_drvprobe(struct platform_device *pdev) unsigned long sel; struct au1xpsc_audio_data *wd; - wd = kzalloc(sizeof(struct au1xpsc_audio_data), GFP_KERNEL); + wd = devm_kzalloc(&pdev->dev, sizeof(struct au1xpsc_audio_data), + GFP_KERNEL); if (!wd) return -ENOMEM; mutex_init(&wd->lock); iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); - if (!iores) { - ret = -ENODEV; - goto out0; - } + if (!iores) + return -ENODEV; - ret = -EBUSY; - if (!request_mem_region(iores->start, resource_size(iores), - pdev->name)) - goto out0; + if (!devm_request_mem_region(&pdev->dev, iores->start, + resource_size(iores), + pdev->name)) + return -EBUSY; - wd->mmio = ioremap(iores->start, resource_size(iores)); + wd->mmio = devm_ioremap(&pdev->dev, iores->start, + resource_size(iores)); if (!wd->mmio) - goto out1; + return -EBUSY; dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0); if (!dmares) - goto out2; + return -EBUSY; wd->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = dmares->start; dmares = platform_get_resource(pdev, IORESOURCE_DMA, 1); if (!dmares) - goto out2; + return -EBUSY; wd->dmaids[SNDRV_PCM_STREAM_CAPTURE] = dmares->start; /* configuration: max dma trigger threshold, enable ac97 */ @@ -421,24 +421,15 @@ static int __devinit au1xpsc_ac97_drvprobe(struct platform_device *pdev) ret = snd_soc_register_dai(&pdev->dev, &wd->dai_drv); if (ret) - goto out2; + return ret; au1xpsc_ac97_workdata = wd; return 0; - -out2: - iounmap(wd->mmio); -out1: - release_mem_region(iores->start, resource_size(iores)); -out0: - kfree(wd); - return ret; } static int __devexit au1xpsc_ac97_drvremove(struct platform_device *pdev) { struct au1xpsc_audio_data *wd = platform_get_drvdata(pdev); - struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0); snd_soc_unregister_dai(&pdev->dev); @@ -448,10 +439,6 @@ static int __devexit au1xpsc_ac97_drvremove(struct platform_device *pdev) au_writel(PSC_CTRL_DISABLE, PSC_CTRL(wd)); au_sync(); - iounmap(wd->mmio); - release_mem_region(r->start, resource_size(r)); - kfree(wd); - au1xpsc_ac97_workdata = NULL; /* MDEV */ return 0;