diff options
author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2014-05-13 03:26:01 -0400 |
---|---|---|
committer | Sekhar Nori <nsekhar@ti.com> | 2014-05-22 00:59:27 -0400 |
commit | 441617672810482b1f92878b7f82a56cd4f0fcf6 (patch) | |
tree | 14796e895aa9ebda802fd64599ae2a1832f8736f | |
parent | b0cce4ca3e740b5224d75634aa9d9abe9dfceabb (diff) |
ARM: edma: Clean up and simplify the code around irq request
Get the two interrupt line number at the same time by merging the two
instance of if(node){}else{} places.
replace the &pdev->dev with the already existing dev which makes it possible
to collapse lines with devm_request_irq()
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
-rw-r--r-- | arch/arm/common/edma.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/arch/arm/common/edma.c b/arch/arm/common/edma.c index 25fa735abc6c..b9bd42ad2d6e 100644 --- a/arch/arm/common/edma.c +++ b/arch/arm/common/edma.c | |||
@@ -1598,7 +1598,6 @@ static int edma_probe(struct platform_device *pdev) | |||
1598 | struct resource *r[EDMA_MAX_CC] = {NULL}; | 1598 | struct resource *r[EDMA_MAX_CC] = {NULL}; |
1599 | struct resource res[EDMA_MAX_CC]; | 1599 | struct resource res[EDMA_MAX_CC]; |
1600 | char res_name[10]; | 1600 | char res_name[10]; |
1601 | char irq_name[10]; | ||
1602 | struct device_node *node = pdev->dev.of_node; | 1601 | struct device_node *node = pdev->dev.of_node; |
1603 | struct device *dev = &pdev->dev; | 1602 | struct device *dev = &pdev->dev; |
1604 | int ret; | 1603 | int ret; |
@@ -1720,14 +1719,21 @@ static int edma_probe(struct platform_device *pdev) | |||
1720 | 1719 | ||
1721 | if (node) { | 1720 | if (node) { |
1722 | irq[j] = irq_of_parse_and_map(node, 0); | 1721 | irq[j] = irq_of_parse_and_map(node, 0); |
1722 | err_irq[j] = irq_of_parse_and_map(node, 2); | ||
1723 | } else { | 1723 | } else { |
1724 | char irq_name[10]; | ||
1725 | |||
1724 | sprintf(irq_name, "edma%d", j); | 1726 | sprintf(irq_name, "edma%d", j); |
1725 | irq[j] = platform_get_irq_byname(pdev, irq_name); | 1727 | irq[j] = platform_get_irq_byname(pdev, irq_name); |
1728 | |||
1729 | sprintf(irq_name, "edma%d_err", j); | ||
1730 | err_irq[j] = platform_get_irq_byname(pdev, irq_name); | ||
1726 | } | 1731 | } |
1727 | edma_cc[j]->irq_res_start = irq[j]; | 1732 | edma_cc[j]->irq_res_start = irq[j]; |
1728 | status = devm_request_irq(&pdev->dev, irq[j], | 1733 | edma_cc[j]->irq_res_end = err_irq[j]; |
1729 | dma_irq_handler, 0, "edma", | 1734 | |
1730 | &pdev->dev); | 1735 | status = devm_request_irq(dev, irq[j], dma_irq_handler, 0, |
1736 | "edma", dev); | ||
1731 | if (status < 0) { | 1737 | if (status < 0) { |
1732 | dev_dbg(&pdev->dev, | 1738 | dev_dbg(&pdev->dev, |
1733 | "devm_request_irq %d failed --> %d\n", | 1739 | "devm_request_irq %d failed --> %d\n", |
@@ -1735,16 +1741,8 @@ static int edma_probe(struct platform_device *pdev) | |||
1735 | return status; | 1741 | return status; |
1736 | } | 1742 | } |
1737 | 1743 | ||
1738 | if (node) { | 1744 | status = devm_request_irq(dev, err_irq[j], dma_ccerr_handler, 0, |
1739 | err_irq[j] = irq_of_parse_and_map(node, 2); | 1745 | "edma_error", dev); |
1740 | } else { | ||
1741 | sprintf(irq_name, "edma%d_err", j); | ||
1742 | err_irq[j] = platform_get_irq_byname(pdev, irq_name); | ||
1743 | } | ||
1744 | edma_cc[j]->irq_res_end = err_irq[j]; | ||
1745 | status = devm_request_irq(&pdev->dev, err_irq[j], | ||
1746 | dma_ccerr_handler, 0, | ||
1747 | "edma_error", &pdev->dev); | ||
1748 | if (status < 0) { | 1746 | if (status < 0) { |
1749 | dev_dbg(&pdev->dev, | 1747 | dev_dbg(&pdev->dev, |
1750 | "devm_request_irq %d failed --> %d\n", | 1748 | "devm_request_irq %d failed --> %d\n", |