From aead90963b756abdfe3016534d8daf8ee7f37c4b Mon Sep 17 00:00:00 2001 From: laranjeiro Date: Fri, 21 May 2010 16:07:05 +0000 Subject: cesar/bsu: factorise some source code git-svn-id: svn+ssh://pessac/svn/cesar/trunk@7127 017c9cb6-072f-447c-8318-d5b54f68fe89 --- cesar/bsu/src/bsu.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'cesar') diff --git a/cesar/bsu/src/bsu.c b/cesar/bsu/src/bsu.c index 78d8d3262a..dc7623433e 100644 --- a/cesar/bsu/src/bsu.c +++ b/cesar/bsu/src/bsu.c @@ -34,6 +34,22 @@ /** Static declaration. */ static bsu_t bsu_global; +/** + * Remove the MFS beacon. + * \param ctx the module context. + * \param index the MFS index. + */ +static inline void +bsu_mfs_remove (bsu_t *ctx, uint index) +{ + ca_mfs_remove (ctx->ca, ctx->mfs_beacons[index]); + pbproc_mfs_remove_all (ctx->mfs_beacons[index]); + mac_store_mfs_remove (ctx->mac_store, + PARENT_OF (mfs_t, tx, ctx->mfs_beacons[index])); + blk_release (ctx->mfs_beacons[index]); + ctx->mfs_beacons[index] = NULL; +} + /** * Reprogram bsu timer. * \param ctx the module context. @@ -446,11 +462,7 @@ bsu_uninit (bsu_t *ctx) for (i = 0; i < COUNT (ctx->mfs_beacons); i++) { if (ctx->mfs_beacons[i]) - { - mac_store_mfs_remove (ctx->mac_store, - PARENT_OF (mfs_t, tx, ctx->mfs_beacons[i])); - blk_release (ctx->mfs_beacons[i]); - } + bsu_mfs_remove (ctx, i); } bsu_trace_uninit (ctx); } @@ -667,12 +679,7 @@ bsu_track_avln (u64 nid, u16 snid, u8 tei, mac_coexistence_mode_t hm) for (i = 0; i < COUNT (ctx->mfs_beacons); i++) { if (ctx->mfs_beacons[i]) - { - ca_mfs_remove (ctx->ca, ctx->mfs_beacons[i]); - pbproc_mfs_remove_all (ctx->mfs_beacons[i]); - blk_release (ctx->mfs_beacons[i]); - ctx->mfs_beacons[i] = NULL; - } + bsu_mfs_remove (ctx, i); } arch_dsr_unlock (); } -- cgit v1.2.3