Merge tag 'dm-4.1-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/device...
[firefly-linux-kernel-4.4.55.git] / sound / soc / fsl / fsl_ssi.c
index 6b0c8f717ec2c0781af066cfb1bc3bcce8567791..e8bb8eef1d16bee3d9d8ca5e4b7e4d5a7a026267 100644 (file)
@@ -1288,7 +1288,7 @@ static int fsl_ssi_probe(struct platform_device *pdev)
        const struct of_device_id *of_id;
        const char *p, *sprop;
        const uint32_t *iprop;
-       struct resource res;
+       struct resource *res;
        void __iomem *iomem;
        char name[64];
 
@@ -1335,19 +1335,11 @@ static int fsl_ssi_probe(struct platform_device *pdev)
        }
        ssi_private->cpu_dai_drv.name = dev_name(&pdev->dev);
 
-       /* Get the addresses and IRQ */
-       ret = of_address_to_resource(np, 0, &res);
-       if (ret) {
-               dev_err(&pdev->dev, "could not determine device resources\n");
-               return ret;
-       }
-       ssi_private->ssi_phys = res.start;
-
-       iomem = devm_ioremap(&pdev->dev, res.start, resource_size(&res));
-       if (!iomem) {
-               dev_err(&pdev->dev, "could not map device resources\n");
-               return -ENOMEM;
-       }
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       iomem = devm_ioremap_resource(&pdev->dev, res);
+       if (IS_ERR(iomem))
+               return PTR_ERR(iomem);
+       ssi_private->ssi_phys = res->start;
 
        ret = of_property_match_string(np, "clock-names", "ipg");
        if (ret < 0) {
@@ -1393,8 +1385,8 @@ static int fsl_ssi_probe(struct platform_device *pdev)
                        return ret;
        }
 
-       ret = snd_soc_register_component(&pdev->dev, &fsl_ssi_component,
-                                        &ssi_private->cpu_dai_drv, 1);
+       ret = devm_snd_soc_register_component(&pdev->dev, &fsl_ssi_component,
+                                             &ssi_private->cpu_dai_drv, 1);
        if (ret) {
                dev_err(&pdev->dev, "failed to register DAI: %d\n", ret);
                goto error_asoc_register;
@@ -1407,13 +1399,13 @@ static int fsl_ssi_probe(struct platform_device *pdev)
                if (ret < 0) {
                        dev_err(&pdev->dev, "could not claim irq %u\n",
                                        ssi_private->irq);
-                       goto error_irq;
+                       goto error_asoc_register;
                }
        }
 
        ret = fsl_ssi_debugfs_create(&ssi_private->dbg_stats, &pdev->dev);
        if (ret)
-               goto error_irq;
+               goto error_asoc_register;
 
        /*
         * If codec-handle property is missing from SSI node, we assume
@@ -1454,9 +1446,6 @@ done:
 error_sound_card:
        fsl_ssi_debugfs_remove(&ssi_private->dbg_stats);
 
-error_irq:
-       snd_soc_unregister_component(&pdev->dev);
-
 error_asoc_register:
        if (ssi_private->soc->imx)
                fsl_ssi_imx_clean(pdev, ssi_private);
@@ -1472,7 +1461,6 @@ static int fsl_ssi_remove(struct platform_device *pdev)
 
        if (ssi_private->pdev)
                platform_device_unregister(ssi_private->pdev);
-       snd_soc_unregister_component(&pdev->dev);
 
        if (ssi_private->soc->imx)
                fsl_ssi_imx_clean(pdev, ssi_private);