Date:2012-09-13 20:33:21 (7 years 8 months ago)
Author:Lars C.
Commit:ca86dff05dedd2210c8920e467f6e40b8a54d44b
Message:ASoC: jz4740: Use devm_request_and_ioremap

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Files: sound/soc/codecs/jz4740.c (2 diffs)

Change Details

sound/soc/codecs/jz4740.c
7474
7575struct jz4740_codec {
7676    void __iomem *base;
77    struct resource *mem;
7877};
7978
8079static unsigned int jz4740_codec_read(struct snd_soc_codec *codec,
...... 
370369        return -ENOMEM;
371370
372371    mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
373    if (!mem) {
374        dev_err(&pdev->dev, "Failed to get mmio memory resource\n");
375        ret = -ENOENT;
376        goto err_out;
377    }
378
379    mem = request_mem_region(mem->start, resource_size(mem), pdev->name);
380    if (!mem) {
381        dev_err(&pdev->dev, "Failed to request mmio memory region\n");
382        ret = -EBUSY;
383        goto err_out;
384    }
385
386    jz4740_codec->base = ioremap(mem->start, resource_size(mem));
387    if (!jz4740_codec->base) {
388        dev_err(&pdev->dev, "Failed to ioremap mmio memory\n");
389        ret = -EBUSY;
390        goto err_release_mem_region;
391    }
392    jz4740_codec->mem = mem;
372    jz4740_codec->base = devm_request_and_ioremap(&pdev->dev, mem);
373    if (!jz4740_codec->base)
374        return -EBUSY;
393375
394376    platform_set_drvdata(pdev, jz4740_codec);
395377
396378    ret = snd_soc_register_codec(&pdev->dev,
397379            &soc_codec_dev_jz4740_codec, &jz4740_codec_dai, 1);
398    if (ret) {
380    if (ret)
399381        dev_err(&pdev->dev, "Failed to register codec\n");
400        goto err_iounmap;
401    }
402
403    return 0;
404382
405err_iounmap:
406    iounmap(jz4740_codec->base);
407err_release_mem_region:
408    release_mem_region(mem->start, resource_size(mem));
409err_out:
410383    return ret;
411384}
412385
413386static int __devexit jz4740_codec_remove(struct platform_device *pdev)
414387{
415    struct jz4740_codec *jz4740_codec = platform_get_drvdata(pdev);
416    struct resource *mem = jz4740_codec->mem;
417
418388    snd_soc_unregister_codec(&pdev->dev);
419389
420    iounmap(jz4740_codec->base);
421    release_mem_region(mem->start, resource_size(mem));
422
423390    platform_set_drvdata(pdev, NULL);
424391
425392    return 0;

Archive Download the corresponding diff file



interactive