mirror of https://gitee.com/openkylin/linux.git
ASoC: davinci: Convert to use devm_ioremap_resource
Use devm_ioremap_resource() instead of open code. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
bc0195aad0
commit
508a43fdd7
|
@ -651,23 +651,15 @@ static const struct snd_soc_component_driver davinci_i2s_component = {
|
||||||
static int davinci_i2s_probe(struct platform_device *pdev)
|
static int davinci_i2s_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct davinci_mcbsp_dev *dev;
|
struct davinci_mcbsp_dev *dev;
|
||||||
struct resource *mem, *ioarea, *res;
|
struct resource *mem, *res;
|
||||||
|
void __iomem *io_base;
|
||||||
int *dma;
|
int *dma;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||||
if (!mem) {
|
io_base = devm_ioremap_resource(&pdev->dev, mem);
|
||||||
dev_err(&pdev->dev, "no mem resource?\n");
|
if (IS_ERR(io_base))
|
||||||
return -ENODEV;
|
return PTR_ERR(io_base);
|
||||||
}
|
|
||||||
|
|
||||||
ioarea = devm_request_mem_region(&pdev->dev, mem->start,
|
|
||||||
resource_size(mem),
|
|
||||||
pdev->name);
|
|
||||||
if (!ioarea) {
|
|
||||||
dev_err(&pdev->dev, "McBSP region already claimed\n");
|
|
||||||
return -EBUSY;
|
|
||||||
}
|
|
||||||
|
|
||||||
dev = devm_kzalloc(&pdev->dev, sizeof(struct davinci_mcbsp_dev),
|
dev = devm_kzalloc(&pdev->dev, sizeof(struct davinci_mcbsp_dev),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
|
@ -679,12 +671,7 @@ static int davinci_i2s_probe(struct platform_device *pdev)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
clk_enable(dev->clk);
|
clk_enable(dev->clk);
|
||||||
|
|
||||||
dev->base = devm_ioremap(&pdev->dev, mem->start, resource_size(mem));
|
dev->base = io_base;
|
||||||
if (!dev->base) {
|
|
||||||
dev_err(&pdev->dev, "ioremap failed\n");
|
|
||||||
ret = -ENOMEM;
|
|
||||||
goto err_release_clk;
|
|
||||||
}
|
|
||||||
|
|
||||||
dev->dma_data[SNDRV_PCM_STREAM_PLAYBACK].addr =
|
dev->dma_data[SNDRV_PCM_STREAM_PLAYBACK].addr =
|
||||||
(dma_addr_t)(mem->start + DAVINCI_MCBSP_DXR_REG);
|
(dma_addr_t)(mem->start + DAVINCI_MCBSP_DXR_REG);
|
||||||
|
|
|
@ -1613,7 +1613,7 @@ static int davinci_mcasp_get_dma_type(struct davinci_mcasp *mcasp)
|
||||||
static int davinci_mcasp_probe(struct platform_device *pdev)
|
static int davinci_mcasp_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct snd_dmaengine_dai_dma_data *dma_data;
|
struct snd_dmaengine_dai_dma_data *dma_data;
|
||||||
struct resource *mem, *ioarea, *res, *dat;
|
struct resource *mem, *res, *dat;
|
||||||
struct davinci_mcasp_pdata *pdata;
|
struct davinci_mcasp_pdata *pdata;
|
||||||
struct davinci_mcasp *mcasp;
|
struct davinci_mcasp *mcasp;
|
||||||
char *irq_name;
|
char *irq_name;
|
||||||
|
@ -1648,22 +1648,12 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ioarea = devm_request_mem_region(&pdev->dev, mem->start,
|
mcasp->base = devm_ioremap_resource(&pdev->dev, mem);
|
||||||
resource_size(mem), pdev->name);
|
if (IS_ERR(mcasp->base))
|
||||||
if (!ioarea) {
|
return PTR_ERR(mcasp->base);
|
||||||
dev_err(&pdev->dev, "Audio region already claimed\n");
|
|
||||||
return -EBUSY;
|
|
||||||
}
|
|
||||||
|
|
||||||
pm_runtime_enable(&pdev->dev);
|
pm_runtime_enable(&pdev->dev);
|
||||||
|
|
||||||
mcasp->base = devm_ioremap(&pdev->dev, mem->start, resource_size(mem));
|
|
||||||
if (!mcasp->base) {
|
|
||||||
dev_err(&pdev->dev, "ioremap failed\n");
|
|
||||||
ret = -ENOMEM;
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
|
|
||||||
mcasp->op_mode = pdata->op_mode;
|
mcasp->op_mode = pdata->op_mode;
|
||||||
/* sanity check for tdm slots parameter */
|
/* sanity check for tdm slots parameter */
|
||||||
if (mcasp->op_mode == DAVINCI_MCASP_IIS_MODE) {
|
if (mcasp->op_mode == DAVINCI_MCASP_IIS_MODE) {
|
||||||
|
|
Loading…
Reference in New Issue