ltq-vdsl-mei: add locking to interrupt handler
[openwrt/staging/jow.git] / package / kernel / lantiq / ltq-vdsl-mei / patches / 200-interrupt-lock.patch
1 --- a/src/drv_mei_cpe_common.c
2 +++ b/src/drv_mei_cpe_common.c
3 @@ -104,6 +104,8 @@ IFX_uint32_t MEI_FsmStateSetMsgPreAction
4 MEI_DEVCFG_DATA_T MEI_DevCfgData;
5 #endif
6
7 +static DEFINE_SPINLOCK(MEI_InterruptLock);
8 +
9 /* ============================================================================
10 Proc-FS and debug variable definitions
11 ========================================================================= */
12 @@ -2134,6 +2136,9 @@ IFX_int32_t MEI_ProcessIntPerIrq(MEIX_CN
13 #if (MEI_SUPPORT_DEBUG_STREAMS == 1)
14 IFX_int_t extraDbgStreamLoop = 0;
15 #endif
16 + unsigned long flags;
17 +
18 + spin_lock_irqsave(&MEI_InterruptLock, flags);
19
20 /* get the actual chip device from the list and step through the VRX devices */
21 while(pNextXCntrl)
22 @@ -2167,6 +2172,8 @@ IFX_int32_t MEI_ProcessIntPerIrq(MEIX_CN
23 }
24 #endif
25
26 + spin_unlock_irqrestore(&MEI_InterruptLock, flags);
27 +
28 return meiIntCnt;
29 }
30
31 @@ -2639,9 +2646,14 @@ IFX_int32_t MEI_MsgSendPreAction(
32 */
33 IFX_void_t MEI_DisableDeviceInt(MEI_DEV_T *pMeiDev)
34 {
35 + unsigned long flags;
36 + spin_lock_irqsave(&MEI_InterruptLock, flags);
37 +
38 MEI_MaskInterrupts( &pMeiDev->meiDrvCntrl,
39 ME_ARC2ME_INTERRUPT_MASK_ALL);
40
41 + spin_unlock_irqrestore(&MEI_InterruptLock, flags);
42 +
43 return;
44 }
45