static int __devinit au1xac97c_drvprobe(struct platform_device *pdev)
{
int ret;
- struct resource *r;
+ struct resource *iores, *dmares;
struct au1xpsc_audio_data *ctx;
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
mutex_init(&ctx->lock);
- r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!r) {
+ iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!iores) {
ret = -ENODEV;
goto out0;
}
ret = -EBUSY;
- if (!request_mem_region(r->start, resource_size(r), pdev->name))
+ if (!request_mem_region(iores->start, resource_size(iores),
+ pdev->name))
goto out0;
- ctx->mmio = ioremap_nocache(r->start, resource_size(r));
+ ctx->mmio = ioremap_nocache(iores->start, resource_size(iores));
if (!ctx->mmio)
goto out1;
- r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
- if (!r)
- goto out1;
- ctx->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = r->start;
+ dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
+ if (!dmares)
+ goto out2;
+ ctx->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = dmares->start;
- r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
- if (!r)
- goto out1;
- ctx->dmaids[SNDRV_PCM_STREAM_CAPTURE] = r->start;
+ dmares = platform_get_resource(pdev, IORESOURCE_DMA, 1);
+ if (!dmares)
+ goto out2;
+ ctx->dmaids[SNDRV_PCM_STREAM_CAPTURE] = dmares->start;
/* switch it on */
WR(ctx, AC97_ENABLE, EN_D | EN_CE);
ret = snd_soc_register_dai(&pdev->dev, &au1xac97c_dai_driver);
if (ret)
- goto out1;
+ goto out2;
ac97c_workdata = ctx;
return 0;
+out2:
+ iounmap(ctx->mmio);
out1:
- release_mem_region(r->start, resource_size(r));
+ release_mem_region(iores->start, resource_size(iores));
out0:
kfree(ctx);
return ret;
static int __devinit au1xi2s_drvprobe(struct platform_device *pdev)
{
int ret;
- struct resource *r;
+ struct resource *iores, *dmares;
struct au1xpsc_audio_data *ctx;
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
if (!ctx)
return -ENOMEM;
- r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!r) {
+ iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!iores) {
ret = -ENODEV;
goto out0;
}
ret = -EBUSY;
- if (!request_mem_region(r->start, resource_size(r), pdev->name))
+ if (!request_mem_region(iores->start, resource_size(iores),
+ pdev->name))
goto out0;
- ctx->mmio = ioremap_nocache(r->start, resource_size(r));
+ ctx->mmio = ioremap_nocache(iores->start, resource_size(iores));
if (!ctx->mmio)
goto out1;
- r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
- if (!r)
- goto out1;
- ctx->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = r->start;
+ dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
+ if (!dmares)
+ goto out2;
+ ctx->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = dmares->start;
- r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
- if (!r)
- goto out1;
- ctx->dmaids[SNDRV_PCM_STREAM_CAPTURE] = r->start;
+ dmares = platform_get_resource(pdev, IORESOURCE_DMA, 1);
+ if (!dmares)
+ goto out2;
+ ctx->dmaids[SNDRV_PCM_STREAM_CAPTURE] = dmares->start;
platform_set_drvdata(pdev, ctx);
ret = snd_soc_register_dai(&pdev->dev, &au1xi2s_dai_driver);
if (ret)
- goto out1;
+ goto out2;
return 0;
+out2:
+ iounmap(ctx->mmio);
out1:
- release_mem_region(r->start, resource_size(r));
+ release_mem_region(iores->start, resource_size(iores));
out0:
kfree(ctx);
return ret;
static int __devinit au1xpsc_ac97_drvprobe(struct platform_device *pdev)
{
int ret;
- struct resource *r;
+ struct resource *iores, *dmares;
unsigned long sel;
struct au1xpsc_audio_data *wd;
mutex_init(&wd->lock);
- r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!r) {
+ iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!iores) {
ret = -ENODEV;
goto out0;
}
ret = -EBUSY;
- if (!request_mem_region(r->start, resource_size(r), pdev->name))
+ if (!request_mem_region(iores->start, resource_size(iores),
+ pdev->name))
goto out0;
- wd->mmio = ioremap(r->start, resource_size(r));
+ wd->mmio = ioremap(iores->start, resource_size(iores));
if (!wd->mmio)
goto out1;
- r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
- if (!r)
+ dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
+ if (!dmares)
goto out2;
- wd->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = r->start;
+ wd->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = dmares->start;
- r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
- if (!r)
+ dmares = platform_get_resource(pdev, IORESOURCE_DMA, 1);
+ if (!dmares)
goto out2;
- wd->dmaids[SNDRV_PCM_STREAM_CAPTURE] = r->start;
+ wd->dmaids[SNDRV_PCM_STREAM_CAPTURE] = dmares->start;
/* configuration: max dma trigger threshold, enable ac97 */
wd->cfg = PSC_AC97CFG_RT_FIFO8 | PSC_AC97CFG_TT_FIFO8 |
out2:
iounmap(wd->mmio);
out1:
- release_mem_region(r->start, resource_size(r));
+ release_mem_region(iores->start, resource_size(iores));
out0:
kfree(wd);
return ret;
static int __devinit au1xpsc_i2s_drvprobe(struct platform_device *pdev)
{
- struct resource *r;
+ struct resource *iores, *dmares;
unsigned long sel;
int ret;
struct au1xpsc_audio_data *wd;
if (!wd)
return -ENOMEM;
- r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!r) {
+ iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!iores) {
ret = -ENODEV;
goto out0;
}
ret = -EBUSY;
- if (!request_mem_region(r->start, resource_size(r), pdev->name))
+ if (!request_mem_region(iores->start, resource_size(iores),
+ pdev->name))
goto out0;
- wd->mmio = ioremap(r->start, resource_size(r));
+ wd->mmio = ioremap(iores->start, resource_size(iores));
if (!wd->mmio)
goto out1;
- r = platform_get_resource(pdev, IORESOURCE_DMA, 0);
- if (!r)
+ dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
+ if (!dmares)
goto out2;
- wd->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = r->start;
+ wd->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = dmares->start;
- r = platform_get_resource(pdev, IORESOURCE_DMA, 1);
- if (!r)
+ dmares = platform_get_resource(pdev, IORESOURCE_DMA, 1);
+ if (!dmares)
goto out2;
- wd->dmaids[SNDRV_PCM_STREAM_CAPTURE] = r->start;
+ wd->dmaids[SNDRV_PCM_STREAM_CAPTURE] = dmares->start;
/* preserve PSC clock source set up by platform (dev.platform_data
* is already occupied by soc layer)
out2:
iounmap(wd->mmio);
out1:
- release_mem_region(r->start, resource_size(r));
+ release_mem_region(iores->start, resource_size(iores));
out0:
kfree(wd);
return ret;
static int mxs_saif_probe(struct platform_device *pdev)
{
- struct resource *res;
+ struct resource *iores, *dmares;
struct mxs_saif *saif;
struct mxs_saif_platform_data *pdata;
int ret = 0;
goto failed_clk;
}
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
+ iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!iores) {
ret = -ENODEV;
dev_err(&pdev->dev, "failed to get io resource: %d\n",
ret);
goto failed_get_resource;
}
- if (!request_mem_region(res->start, resource_size(res), "mxs-saif")) {
+ if (!request_mem_region(iores->start, resource_size(iores),
+ "mxs-saif")) {
dev_err(&pdev->dev, "request_mem_region failed\n");
ret = -EBUSY;
goto failed_get_resource;
}
- saif->base = ioremap(res->start, resource_size(res));
+ saif->base = ioremap(iores->start, resource_size(iores));
if (!saif->base) {
dev_err(&pdev->dev, "ioremap failed\n");
ret = -ENODEV;
goto failed_ioremap;
}
- res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
- if (!res) {
+ dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
+ if (!dmares) {
ret = -ENODEV;
dev_err(&pdev->dev, "failed to get dma resource: %d\n",
ret);
goto failed_ioremap;
}
- saif->dma_param.chan_num = res->start;
+ saif->dma_param.chan_num = dmares->start;
saif->irq = platform_get_irq(pdev, 0);
if (saif->irq < 0) {
failed_get_irq1:
iounmap(saif->base);
failed_ioremap:
- release_mem_region(res->start, resource_size(res));
+ release_mem_region(iores->start, resource_size(iores));
failed_get_resource:
clk_put(saif->clk);
failed_clk: