aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@armlinux.org.uk>2016-09-06 11:01:32 -0400
committerRussell King <rmk+kernel@armlinux.org.uk>2016-09-20 09:21:08 -0400
commitccb7d854d65a09ffe4b6c8342b8d1c6bee6740bb (patch)
tree528ca775ea8a240d1061e4d53d1a2f780bdf2338
parentdeee856a5c6293c50ad6589c9f8a1cca5ed08ae9 (diff)
ARM: sa1111: move irq cleanup to separate function
Move the SA1111 interrupt cleanup to a separate function, so it can be re-used in the probe error cleanup path. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
-rw-r--r--arch/arm/common/sa1111.c33
1 files changed, 19 insertions, 14 deletions
diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c
index 09a4f932c2ec..eaa818d921a9 100644
--- a/arch/arm/common/sa1111.c
+++ b/arch/arm/common/sa1111.c
@@ -509,6 +509,24 @@ static int sa1111_setup_irq(struct sa1111 *sachip, unsigned irq_base)
509 return 0; 509 return 0;
510} 510}
511 511
512static void sa1111_remove_irq(struct sa1111 *sachip)
513{
514 void __iomem *irqbase = sachip->base + SA1111_INTC;
515
516 /* disable all IRQs */
517 sa1111_writel(0, irqbase + SA1111_INTEN0);
518 sa1111_writel(0, irqbase + SA1111_INTEN1);
519 sa1111_writel(0, irqbase + SA1111_WAKEEN0);
520 sa1111_writel(0, irqbase + SA1111_WAKEEN1);
521
522 if (sachip->irq != NO_IRQ) {
523 irq_set_chained_handler_and_data(sachip->irq, NULL, NULL);
524 irq_free_descs(sachip->irq_base, SA1111_IRQ_NR);
525
526 release_mem_region(sachip->phys + SA1111_INTC, 512);
527 }
528}
529
512/* 530/*
513 * Bring the SA1111 out of reset. This requires a set procedure: 531 * Bring the SA1111 out of reset. This requires a set procedure:
514 * 1. nRESET asserted (by hardware) 532 * 1. nRESET asserted (by hardware)
@@ -819,26 +837,13 @@ static int sa1111_remove_one(struct device *dev, void *data)
819 837
820static void __sa1111_remove(struct sa1111 *sachip) 838static void __sa1111_remove(struct sa1111 *sachip)
821{ 839{
822 void __iomem *irqbase = sachip->base + SA1111_INTC;
823
824 device_for_each_child(sachip->dev, NULL, sa1111_remove_one); 840 device_for_each_child(sachip->dev, NULL, sa1111_remove_one);
825 841
826 /* disable all IRQs */ 842 sa1111_remove_irq(sachip);
827 sa1111_writel(0, irqbase + SA1111_INTEN0);
828 sa1111_writel(0, irqbase + SA1111_INTEN1);
829 sa1111_writel(0, irqbase + SA1111_WAKEEN0);
830 sa1111_writel(0, irqbase + SA1111_WAKEEN1);
831 843
832 clk_disable(sachip->clk); 844 clk_disable(sachip->clk);
833 clk_unprepare(sachip->clk); 845 clk_unprepare(sachip->clk);
834 846
835 if (sachip->irq != NO_IRQ) {
836 irq_set_chained_handler_and_data(sachip->irq, NULL, NULL);
837 irq_free_descs(sachip->irq_base, SA1111_IRQ_NR);
838
839 release_mem_region(sachip->phys + SA1111_INTC, 512);
840 }
841
842 iounmap(sachip->base); 847 iounmap(sachip->base);
843} 848}
844 849