diff options
author | Axel Lin <axel.lin@ingics.com> | 2015-08-24 04:52:30 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-08-25 05:32:15 -0400 |
commit | 552ef80389ec2567566be1ccc0dd79f08ba32cce (patch) | |
tree | 4673cc654ea65956b3b1d70a4f0d4586291a3296 | |
parent | bc0195aad0daa2ad5b0d76cce22b167bc3435590 (diff) |
ASoC: SPEAr: Convert to use devm_ioremap_resource
Use devm_ioremap_resource() instead of open code.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/spear/spdif_in.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/sound/soc/spear/spdif_in.c b/sound/soc/spear/spdif_in.c index a4028601da01..977a078eb92f 100644 --- a/sound/soc/spear/spdif_in.c +++ b/sound/soc/spear/spdif_in.c | |||
@@ -203,35 +203,25 @@ static int spdif_in_probe(struct platform_device *pdev) | |||
203 | struct spdif_in_dev *host; | 203 | struct spdif_in_dev *host; |
204 | struct spear_spdif_platform_data *pdata; | 204 | struct spear_spdif_platform_data *pdata; |
205 | struct resource *res, *res_fifo; | 205 | struct resource *res, *res_fifo; |
206 | void __iomem *io_base; | ||
206 | int ret; | 207 | int ret; |
207 | 208 | ||
208 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 209 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
209 | if (!res) | 210 | io_base = devm_ioremap_resource(&pdev->dev, res); |
210 | return -EINVAL; | 211 | if (IS_ERR(io_base)) |
212 | return PTR_ERR(io_base); | ||
211 | 213 | ||
212 | res_fifo = platform_get_resource(pdev, IORESOURCE_IO, 0); | 214 | res_fifo = platform_get_resource(pdev, IORESOURCE_IO, 0); |
213 | if (!res_fifo) | 215 | if (!res_fifo) |
214 | return -EINVAL; | 216 | return -EINVAL; |
215 | 217 | ||
216 | if (!devm_request_mem_region(&pdev->dev, res->start, | ||
217 | resource_size(res), pdev->name)) { | ||
218 | dev_warn(&pdev->dev, "Failed to get memory resourse\n"); | ||
219 | return -ENOENT; | ||
220 | } | ||
221 | |||
222 | host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL); | 218 | host = devm_kzalloc(&pdev->dev, sizeof(*host), GFP_KERNEL); |
223 | if (!host) { | 219 | if (!host) { |
224 | dev_warn(&pdev->dev, "kzalloc fail\n"); | 220 | dev_warn(&pdev->dev, "kzalloc fail\n"); |
225 | return -ENOMEM; | 221 | return -ENOMEM; |
226 | } | 222 | } |
227 | 223 | ||
228 | host->io_base = devm_ioremap(&pdev->dev, res->start, | 224 | host->io_base = io_base; |
229 | resource_size(res)); | ||
230 | if (!host->io_base) { | ||
231 | dev_warn(&pdev->dev, "ioremap failed\n"); | ||
232 | return -ENOMEM; | ||
233 | } | ||
234 | |||
235 | host->irq = platform_get_irq(pdev, 0); | 225 | host->irq = platform_get_irq(pdev, 0); |
236 | if (host->irq < 0) | 226 | if (host->irq < 0) |
237 | return -EINVAL; | 227 | return -EINVAL; |