浏览代码

[ARM] 5122/1: imx_dma_request_by_prio simpilfication

imx_dma_request_by_prio can return channel number by itself.
No need to supply variable address through parameters.

Also converted all drivers using this function.

Signed-off-by: Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Paulius Zaleckas 17 年之前
父节点
当前提交
f7def13ed0
共有 4 个文件被更改,包括 15 次插入20 次删除
  1. 4 9
      arch/arm/mach-imx/dma.c
  2. 2 2
      drivers/mmc/host/imxmmc.c
  3. 8 8
      drivers/spi/spi_imx.c
  4. 1 1
      include/asm-arm/arch-imx/imx-dma.h

+ 4 - 9
arch/arm/mach-imx/dma.c

@@ -410,7 +410,6 @@ void imx_dma_free(imx_dmach_t dma_ch)
 
 
 /**
 /**
  * imx_dma_request_by_prio - find and request some of free channels best suiting requested priority
  * imx_dma_request_by_prio - find and request some of free channels best suiting requested priority
- * @dma_ch: i.MX DMA channel number
  * @name: the driver/caller own non-%NULL identification
  * @name: the driver/caller own non-%NULL identification
  * @prio: one of the hardware distinguished priority level:
  * @prio: one of the hardware distinguished priority level:
  *        %DMA_PRIO_HIGH, %DMA_PRIO_MEDIUM, %DMA_PRIO_LOW
  *        %DMA_PRIO_HIGH, %DMA_PRIO_MEDIUM, %DMA_PRIO_LOW
@@ -420,11 +419,9 @@ void imx_dma_free(imx_dmach_t dma_ch)
  * in the higher and then even lower priority groups.
  * in the higher and then even lower priority groups.
  *
  *
  * Return value: If there is no free channel to allocate, -%ENODEV is returned.
  * Return value: If there is no free channel to allocate, -%ENODEV is returned.
- *               Zero value indicates successful channel allocation.
+ *               On successful allocation channel is returned.
  */
  */
-int
-imx_dma_request_by_prio(imx_dmach_t * pdma_ch, const char *name,
-			imx_dma_prio prio)
+imx_dmach_t imx_dma_request_by_prio(const char *name, imx_dma_prio prio)
 {
 {
 	int i;
 	int i;
 	int best;
 	int best;
@@ -444,15 +441,13 @@ imx_dma_request_by_prio(imx_dmach_t * pdma_ch, const char *name,
 
 
 	for (i = best; i < IMX_DMA_CHANNELS; i++) {
 	for (i = best; i < IMX_DMA_CHANNELS; i++) {
 		if (!imx_dma_request(i, name)) {
 		if (!imx_dma_request(i, name)) {
-			*pdma_ch = i;
-			return 0;
+			return i;
 		}
 		}
 	}
 	}
 
 
 	for (i = best - 1; i >= 0; i--) {
 	for (i = best - 1; i >= 0; i--) {
 		if (!imx_dma_request(i, name)) {
 		if (!imx_dma_request(i, name)) {
-			*pdma_ch = i;
-			return 0;
+			return i;
 		}
 		}
 	}
 	}
 
 

+ 2 - 2
drivers/mmc/host/imxmmc.c

@@ -1017,8 +1017,8 @@ static int imxmci_probe(struct platform_device *pdev)
 	host->imask = IMXMCI_INT_MASK_DEFAULT;
 	host->imask = IMXMCI_INT_MASK_DEFAULT;
 	MMC_INT_MASK = host->imask;
 	MMC_INT_MASK = host->imask;
 
 
-
-	if(imx_dma_request_by_prio(&host->dma, DRIVER_NAME, DMA_PRIO_LOW)<0){
+	host->dma = imx_dma_request_by_prio(DRIVER_NAME, DMA_PRIO_LOW);
+	if(host->dma < 0) {
 		dev_err(mmc_dev(host->mmc), "imx_dma_request_by_prio failed\n");
 		dev_err(mmc_dev(host->mmc), "imx_dma_request_by_prio failed\n");
 		ret = -EBUSY;
 		ret = -EBUSY;
 		goto out;
 		goto out;

+ 8 - 8
drivers/spi/spi_imx.c

@@ -1526,24 +1526,24 @@ static int __init spi_imx_probe(struct platform_device *pdev)
 	drv_data->rx_channel = -1;
 	drv_data->rx_channel = -1;
 	if (platform_info->enable_dma) {
 	if (platform_info->enable_dma) {
 		/* Get rx DMA channel */
 		/* Get rx DMA channel */
-		status = imx_dma_request_by_prio(&drv_data->rx_channel,
-			"spi_imx_rx", DMA_PRIO_HIGH);
-		if (status < 0) {
+		drv_data->rx_channel = imx_dma_request_by_prio("spi_imx_rx",
+							       DMA_PRIO_HIGH);
+		if (drv_data->rx_channel < 0) {
 			dev_err(dev,
 			dev_err(dev,
 				"probe - problem (%d) requesting rx channel\n",
 				"probe - problem (%d) requesting rx channel\n",
-				status);
+				drv_data->rx_channel);
 			goto err_no_rxdma;
 			goto err_no_rxdma;
 		} else
 		} else
 			imx_dma_setup_handlers(drv_data->rx_channel, NULL,
 			imx_dma_setup_handlers(drv_data->rx_channel, NULL,
 						dma_err_handler, drv_data);
 						dma_err_handler, drv_data);
 
 
 		/* Get tx DMA channel */
 		/* Get tx DMA channel */
-		status = imx_dma_request_by_prio(&drv_data->tx_channel,
-						"spi_imx_tx", DMA_PRIO_MEDIUM);
-		if (status < 0) {
+		drv_data->tx_channel = imx_dma_request_by_prio("spi_imx_tx",
+							       DMA_PRIO_MEDIUM);
+		if (drv_data->tx_channel < 0) {
 			dev_err(dev,
 			dev_err(dev,
 				"probe - problem (%d) requesting tx channel\n",
 				"probe - problem (%d) requesting tx channel\n",
-				status);
+				drv_data->tx_channel);
 			imx_dma_free(drv_data->rx_channel);
 			imx_dma_free(drv_data->rx_channel);
 			goto err_no_txdma;
 			goto err_no_txdma;
 		} else
 		} else

+ 1 - 1
include/asm-arm/arch-imx/imx-dma.h

@@ -88,7 +88,7 @@ int imx_dma_request(imx_dmach_t dma_ch, const char *name);
 
 
 void imx_dma_free(imx_dmach_t dma_ch);
 void imx_dma_free(imx_dmach_t dma_ch);
 
 
-int imx_dma_request_by_prio(imx_dmach_t *pdma_ch, const char *name, imx_dma_prio prio);
+imx_dmach_t imx_dma_request_by_prio(const char *name, imx_dma_prio prio);
 
 
 
 
 #endif	/* _ASM_ARCH_IMX_DMA_H */
 #endif	/* _ASM_ARCH_IMX_DMA_H */