diff options
| -rw-r--r-- | drivers/mfd/davinci_voicecodec.c | 48 | ||||
| -rw-r--r-- | include/linux/mfd/davinci_voicecodec.h | 2 |
2 files changed, 10 insertions, 40 deletions
diff --git a/drivers/mfd/davinci_voicecodec.c b/drivers/mfd/davinci_voicecodec.c index b6e297363946..fb64398506e9 100644 --- a/drivers/mfd/davinci_voicecodec.c +++ b/drivers/mfd/davinci_voicecodec.c | |||
| @@ -46,7 +46,7 @@ void davinci_vc_write(struct davinci_vc *davinci_vc, | |||
| 46 | static int __init davinci_vc_probe(struct platform_device *pdev) | 46 | static int __init davinci_vc_probe(struct platform_device *pdev) |
| 47 | { | 47 | { |
| 48 | struct davinci_vc *davinci_vc; | 48 | struct davinci_vc *davinci_vc; |
| 49 | struct resource *res, *mem; | 49 | struct resource *res; |
| 50 | struct mfd_cell *cell = NULL; | 50 | struct mfd_cell *cell = NULL; |
| 51 | int ret; | 51 | int ret; |
| 52 | 52 | ||
| @@ -58,7 +58,7 @@ static int __init davinci_vc_probe(struct platform_device *pdev) | |||
| 58 | return -ENOMEM; | 58 | return -ENOMEM; |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | davinci_vc->clk = clk_get(&pdev->dev, NULL); | 61 | davinci_vc->clk = devm_clk_get(&pdev->dev, NULL); |
| 62 | if (IS_ERR(davinci_vc->clk)) { | 62 | if (IS_ERR(davinci_vc->clk)) { |
| 63 | dev_dbg(&pdev->dev, | 63 | dev_dbg(&pdev->dev, |
| 64 | "could not get the clock for voice codec\n"); | 64 | "could not get the clock for voice codec\n"); |
| @@ -67,35 +67,18 @@ static int __init davinci_vc_probe(struct platform_device *pdev) | |||
| 67 | clk_enable(davinci_vc->clk); | 67 | clk_enable(davinci_vc->clk); |
| 68 | 68 | ||
| 69 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 69 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 70 | if (!res) { | ||
| 71 | dev_err(&pdev->dev, "no mem resource\n"); | ||
| 72 | ret = -ENODEV; | ||
| 73 | goto fail2; | ||
| 74 | } | ||
| 75 | |||
| 76 | davinci_vc->pbase = res->start; | ||
| 77 | davinci_vc->base_size = resource_size(res); | ||
| 78 | 70 | ||
| 79 | mem = request_mem_region(davinci_vc->pbase, davinci_vc->base_size, | 71 | davinci_vc->base = devm_ioremap_resource(&pdev->dev, res); |
| 80 | pdev->name); | 72 | if (IS_ERR(davinci_vc->base)) { |
| 81 | if (!mem) { | 73 | ret = PTR_ERR(davinci_vc->base); |
| 82 | dev_err(&pdev->dev, "VCIF region already claimed\n"); | 74 | goto fail; |
| 83 | ret = -EBUSY; | ||
| 84 | goto fail2; | ||
| 85 | } | ||
| 86 | |||
| 87 | davinci_vc->base = ioremap(davinci_vc->pbase, davinci_vc->base_size); | ||
| 88 | if (!davinci_vc->base) { | ||
| 89 | dev_err(&pdev->dev, "can't ioremap mem resource.\n"); | ||
| 90 | ret = -ENOMEM; | ||
| 91 | goto fail3; | ||
| 92 | } | 75 | } |
| 93 | 76 | ||
| 94 | res = platform_get_resource(pdev, IORESOURCE_DMA, 0); | 77 | res = platform_get_resource(pdev, IORESOURCE_DMA, 0); |
| 95 | if (!res) { | 78 | if (!res) { |
| 96 | dev_err(&pdev->dev, "no DMA resource\n"); | 79 | dev_err(&pdev->dev, "no DMA resource\n"); |
| 97 | ret = -ENXIO; | 80 | ret = -ENXIO; |
| 98 | goto fail4; | 81 | goto fail; |
| 99 | } | 82 | } |
| 100 | 83 | ||
| 101 | davinci_vc->davinci_vcif.dma_tx_channel = res->start; | 84 | davinci_vc->davinci_vcif.dma_tx_channel = res->start; |
| @@ -106,7 +89,7 @@ static int __init davinci_vc_probe(struct platform_device *pdev) | |||
| 106 | if (!res) { | 89 | if (!res) { |
| 107 | dev_err(&pdev->dev, "no DMA resource\n"); | 90 | dev_err(&pdev->dev, "no DMA resource\n"); |
| 108 | ret = -ENXIO; | 91 | ret = -ENXIO; |
| 109 | goto fail4; | 92 | goto fail; |
| 110 | } | 93 | } |
| 111 | 94 | ||
| 112 | davinci_vc->davinci_vcif.dma_rx_channel = res->start; | 95 | davinci_vc->davinci_vcif.dma_rx_channel = res->start; |
| @@ -132,19 +115,13 @@ static int __init davinci_vc_probe(struct platform_device *pdev) | |||
| 132 | DAVINCI_VC_CELLS, NULL, 0, NULL); | 115 | DAVINCI_VC_CELLS, NULL, 0, NULL); |
| 133 | if (ret != 0) { | 116 | if (ret != 0) { |
| 134 | dev_err(&pdev->dev, "fail to register client devices\n"); | 117 | dev_err(&pdev->dev, "fail to register client devices\n"); |
| 135 | goto fail4; | 118 | goto fail; |
| 136 | } | 119 | } |
| 137 | 120 | ||
| 138 | return 0; | 121 | return 0; |
| 139 | 122 | ||
| 140 | fail4: | 123 | fail: |
| 141 | iounmap(davinci_vc->base); | ||
| 142 | fail3: | ||
| 143 | release_mem_region(davinci_vc->pbase, davinci_vc->base_size); | ||
| 144 | fail2: | ||
| 145 | clk_disable(davinci_vc->clk); | 124 | clk_disable(davinci_vc->clk); |
| 146 | clk_put(davinci_vc->clk); | ||
| 147 | davinci_vc->clk = NULL; | ||
| 148 | 125 | ||
| 149 | return ret; | 126 | return ret; |
| 150 | } | 127 | } |
| @@ -155,12 +132,7 @@ static int davinci_vc_remove(struct platform_device *pdev) | |||
| 155 | 132 | ||
| 156 | mfd_remove_devices(&pdev->dev); | 133 | mfd_remove_devices(&pdev->dev); |
| 157 | 134 | ||
| 158 | iounmap(davinci_vc->base); | ||
| 159 | release_mem_region(davinci_vc->pbase, davinci_vc->base_size); | ||
| 160 | |||
| 161 | clk_disable(davinci_vc->clk); | 135 | clk_disable(davinci_vc->clk); |
| 162 | clk_put(davinci_vc->clk); | ||
| 163 | davinci_vc->clk = NULL; | ||
| 164 | 136 | ||
| 165 | return 0; | 137 | return 0; |
| 166 | } | 138 | } |
diff --git a/include/linux/mfd/davinci_voicecodec.h b/include/linux/mfd/davinci_voicecodec.h index 0ab61320ffa8..94c53d4819c7 100644 --- a/include/linux/mfd/davinci_voicecodec.h +++ b/include/linux/mfd/davinci_voicecodec.h | |||
| @@ -112,8 +112,6 @@ struct davinci_vc { | |||
| 112 | 112 | ||
| 113 | /* Memory resources */ | 113 | /* Memory resources */ |
| 114 | void __iomem *base; | 114 | void __iomem *base; |
| 115 | resource_size_t pbase; | ||
| 116 | size_t base_size; | ||
| 117 | 115 | ||
| 118 | /* MFD cells */ | 116 | /* MFD cells */ |
| 119 | struct mfd_cell cells[DAVINCI_VC_CELLS]; | 117 | struct mfd_cell cells[DAVINCI_VC_CELLS]; |
