1 2 struct list_head { 3 struct list_head *next, *prev; 4 }; 5 struct ib_fmr { 6 int *device; 7 struct list_head list; 8 }; 9 static inline to_mfmr(struct ib_fmr * ibmr)10struct mthca_fmr *to_mfmr(struct ib_fmr *ibmr) 11 { 12 const struct ib_fmr *__mptr = (ibmr); 13 return (struct mthca_fmr *)( (char *)__mptr ); 14 } mthca_unmap_fmr(struct list_head * fmr_list)15void mthca_unmap_fmr(struct list_head *fmr_list) 16 { 17 struct ib_fmr *fmr; 18 if (mthca_is_memfree()) 19 { 20 for (fmr = 21 ({ const struct list_head *__mptr = ((fmr_list)->next); (struct ib_fmr *)( 22 (char *)__mptr - 8 );}); 23 &fmr->list != (fmr_list); 24 fmr = ({ const struct list_head *__mptr = (fmr->list.next); (struct ib_fmr 25 *)( (char *)__mptr - 8);}) 26 ) 27 mthca_arbel_fmr_unmap(to_mfmr(fmr)); 28 } 29 else 30 for (fmr = 31 ({ const struct list_head *__mptr = ((fmr_list)->next); (struct ib_fmr *)( 32 (char *)__mptr - 8);}); 33 &fmr->list != (fmr_list); 34 fmr = ({ const struct list_head *__mptr = (fmr->list.next); (struct ib_fmr 35 *)( (char *)__mptr - 8);}) 36 ) 37 mthca_tavor_fmr_unmap(to_mfmr(fmr)); 38 } 39