Serial: AT91: Turn off hardware interrupts early in shutdown

This attempts to fix of null pointer dereference caused by a race condition.

Examination of a crash stack trace shows that the software interrupt was firing before we released it in the driver. Looking at the driver, it didn't disable the micro's uart interrupts until the end of the shutdown routine which could easily introduce this issue since it already freed everything else by the time it actually disabled interrupts. Moving the disable interrupt bit to the beginning before we start cleanup should kill this null dereference.


[<c02092b0>] (atmel_tasklet_func+0x514/0x814) from [<c001fd34>] (tasklet_action+0x70/0xa8)
[<c001fd34>] (tasklet_action+0x70/0xa8) from [<c001f60c>] (__do_softirq+0x90/0x144)
[<c001f60c>] (__do_softirq+0x90/0x144) from [<c001fa18>] (irq_exit+0x40/0x4c)
[<c001fa18>] (irq_exit+0x40/0x4c) from [<c000e298>] (handle_IRQ+0x64/0x84)
[<c000e298>] (handle_IRQ+0x64/0x84) from [<c000d6c0>] (__irq_svc+0x40/0x50)
[<c000d6c0>] (__irq_svc+0x40/0x50) from [<c0208060>] (atmel_rx_dma_release+0x88/0xb8)
[<c0208060>] (atmel_rx_dma_release+0x88/0xb8) from [<c0209740>] (atmel_shutdown+0x104/0x160)
[<c0209740>] (atmel_shutdown+0x104/0x160) from [<c0205e8c>] (uart_port_shutdown+0x2c/0x38)
[<c0205e8c>] (uart_port_shutdown+0x2c/0x38) from [<c0206018>] (uart_shutdown+0x9c/0xd4)
[<c0206018>] (uart_shutdown+0x9c/0xd4) from [<c0206c28>] (uart_close+0x7c/0x174)



Signed-off-by: Marek Roszko <mark.roszko@gmail.com>