diff options
author | Paulius Zaleckas <paulius.zaleckas@teltonika.lt> | 2008-06-25 08:25:13 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-07-03 11:39:57 -0400 |
commit | f7def13ed0775ee506c62a8612a124dce1776ac2 (patch) | |
tree | ef5dbefc1df0378a10e44971de083d46695ba694 | |
parent | 60a752ef34e23be5e6c91c0734d30447ce15b63b (diff) |
[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>
-rw-r--r-- | arch/arm/mach-imx/dma.c | 13 | ||||
-rw-r--r-- | drivers/mmc/host/imxmmc.c | 4 | ||||
-rw-r--r-- | drivers/spi/spi_imx.c | 16 | ||||
-rw-r--r-- | include/asm-arm/arch-imx/imx-dma.h | 2 |
4 files changed, 15 insertions, 20 deletions
diff --git a/arch/arm/mach-imx/dma.c b/arch/arm/mach-imx/dma.c index a59ff2987cb7..ee1c6f06ff64 100644 --- a/arch/arm/mach-imx/dma.c +++ b/arch/arm/mach-imx/dma.c | |||
@@ -410,7 +410,6 @@ void imx_dma_free(imx_dmach_t dma_ch) | |||
410 | 410 | ||
411 | /** | 411 | /** |
412 | * imx_dma_request_by_prio - find and request some of free channels best suiting requested priority | 412 | * imx_dma_request_by_prio - find and request some of free channels best suiting requested priority |
413 | * @dma_ch: i.MX DMA channel number | ||
414 | * @name: the driver/caller own non-%NULL identification | 413 | * @name: the driver/caller own non-%NULL identification |
415 | * @prio: one of the hardware distinguished priority level: | 414 | * @prio: one of the hardware distinguished priority level: |
416 | * %DMA_PRIO_HIGH, %DMA_PRIO_MEDIUM, %DMA_PRIO_LOW | 415 | * %DMA_PRIO_HIGH, %DMA_PRIO_MEDIUM, %DMA_PRIO_LOW |
@@ -420,11 +419,9 @@ void imx_dma_free(imx_dmach_t dma_ch) | |||
420 | * in the higher and then even lower priority groups. | 419 | * in the higher and then even lower priority groups. |
421 | * | 420 | * |
422 | * Return value: If there is no free channel to allocate, -%ENODEV is returned. | 421 | * Return value: If there is no free channel to allocate, -%ENODEV is returned. |
423 | * Zero value indicates successful channel allocation. | 422 | * On successful allocation channel is returned. |
424 | */ | 423 | */ |
425 | int | 424 | imx_dmach_t imx_dma_request_by_prio(const char *name, imx_dma_prio prio) |
426 | imx_dma_request_by_prio(imx_dmach_t * pdma_ch, const char *name, | ||
427 | imx_dma_prio prio) | ||
428 | { | 425 | { |
429 | int i; | 426 | int i; |
430 | int best; | 427 | int best; |
@@ -444,15 +441,13 @@ imx_dma_request_by_prio(imx_dmach_t * pdma_ch, const char *name, | |||
444 | 441 | ||
445 | for (i = best; i < IMX_DMA_CHANNELS; i++) { | 442 | for (i = best; i < IMX_DMA_CHANNELS; i++) { |
446 | if (!imx_dma_request(i, name)) { | 443 | if (!imx_dma_request(i, name)) { |
447 | *pdma_ch = i; | 444 | return i; |
448 | return 0; | ||
449 | } | 445 | } |
450 | } | 446 | } |
451 | 447 | ||
452 | for (i = best - 1; i >= 0; i--) { | 448 | for (i = best - 1; i >= 0; i--) { |
453 | if (!imx_dma_request(i, name)) { | 449 | if (!imx_dma_request(i, name)) { |
454 | *pdma_ch = i; | 450 | return i; |
455 | return 0; | ||
456 | } | 451 | } |
457 | } | 452 | } |
458 | 453 | ||
diff --git a/drivers/mmc/host/imxmmc.c b/drivers/mmc/host/imxmmc.c index 95f33e87a99c..c4349c746cb3 100644 --- a/drivers/mmc/host/imxmmc.c +++ b/drivers/mmc/host/imxmmc.c | |||
@@ -1017,8 +1017,8 @@ static int imxmci_probe(struct platform_device *pdev) | |||
1017 | host->imask = IMXMCI_INT_MASK_DEFAULT; | 1017 | host->imask = IMXMCI_INT_MASK_DEFAULT; |
1018 | MMC_INT_MASK = host->imask; | 1018 | MMC_INT_MASK = host->imask; |
1019 | 1019 | ||
1020 | 1020 | host->dma = imx_dma_request_by_prio(DRIVER_NAME, DMA_PRIO_LOW); | |
1021 | if(imx_dma_request_by_prio(&host->dma, DRIVER_NAME, DMA_PRIO_LOW)<0){ | 1021 | if(host->dma < 0) { |
1022 | dev_err(mmc_dev(host->mmc), "imx_dma_request_by_prio failed\n"); | 1022 | dev_err(mmc_dev(host->mmc), "imx_dma_request_by_prio failed\n"); |
1023 | ret = -EBUSY; | 1023 | ret = -EBUSY; |
1024 | goto out; | 1024 | goto out; |
diff --git a/drivers/spi/spi_imx.c b/drivers/spi/spi_imx.c index c730d05bfeb6..547e30298278 100644 --- a/drivers/spi/spi_imx.c +++ b/drivers/spi/spi_imx.c | |||
@@ -1526,24 +1526,24 @@ static int __init spi_imx_probe(struct platform_device *pdev) | |||
1526 | drv_data->rx_channel = -1; | 1526 | drv_data->rx_channel = -1; |
1527 | if (platform_info->enable_dma) { | 1527 | if (platform_info->enable_dma) { |
1528 | /* Get rx DMA channel */ | 1528 | /* Get rx DMA channel */ |
1529 | status = imx_dma_request_by_prio(&drv_data->rx_channel, | 1529 | drv_data->rx_channel = imx_dma_request_by_prio("spi_imx_rx", |
1530 | "spi_imx_rx", DMA_PRIO_HIGH); | 1530 | DMA_PRIO_HIGH); |
1531 | if (status < 0) { | 1531 | if (drv_data->rx_channel < 0) { |
1532 | dev_err(dev, | 1532 | dev_err(dev, |
1533 | "probe - problem (%d) requesting rx channel\n", | 1533 | "probe - problem (%d) requesting rx channel\n", |
1534 | status); | 1534 | drv_data->rx_channel); |
1535 | goto err_no_rxdma; | 1535 | goto err_no_rxdma; |
1536 | } else | 1536 | } else |
1537 | imx_dma_setup_handlers(drv_data->rx_channel, NULL, | 1537 | imx_dma_setup_handlers(drv_data->rx_channel, NULL, |
1538 | dma_err_handler, drv_data); | 1538 | dma_err_handler, drv_data); |
1539 | 1539 | ||
1540 | /* Get tx DMA channel */ | 1540 | /* Get tx DMA channel */ |
1541 | status = imx_dma_request_by_prio(&drv_data->tx_channel, | 1541 | drv_data->tx_channel = imx_dma_request_by_prio("spi_imx_tx", |
1542 | "spi_imx_tx", DMA_PRIO_MEDIUM); | 1542 | DMA_PRIO_MEDIUM); |
1543 | if (status < 0) { | 1543 | if (drv_data->tx_channel < 0) { |
1544 | dev_err(dev, | 1544 | dev_err(dev, |
1545 | "probe - problem (%d) requesting tx channel\n", | 1545 | "probe - problem (%d) requesting tx channel\n", |
1546 | status); | 1546 | drv_data->tx_channel); |
1547 | imx_dma_free(drv_data->rx_channel); | 1547 | imx_dma_free(drv_data->rx_channel); |
1548 | goto err_no_txdma; | 1548 | goto err_no_txdma; |
1549 | } else | 1549 | } else |
diff --git a/include/asm-arm/arch-imx/imx-dma.h b/include/asm-arm/arch-imx/imx-dma.h index 5b1066da4e1f..44d89c35539a 100644 --- a/include/asm-arm/arch-imx/imx-dma.h +++ b/include/asm-arm/arch-imx/imx-dma.h | |||
@@ -88,7 +88,7 @@ int imx_dma_request(imx_dmach_t dma_ch, const char *name); | |||
88 | 88 | ||
89 | void imx_dma_free(imx_dmach_t dma_ch); | 89 | void imx_dma_free(imx_dmach_t dma_ch); |
90 | 90 | ||
91 | int imx_dma_request_by_prio(imx_dmach_t *pdma_ch, const char *name, imx_dma_prio prio); | 91 | imx_dmach_t imx_dma_request_by_prio(const char *name, imx_dma_prio prio); |
92 | 92 | ||
93 | 93 | ||
94 | #endif /* _ASM_ARCH_IMX_DMA_H */ | 94 | #endif /* _ASM_ARCH_IMX_DMA_H */ |