u32 type, vf;
 
        for (type = 0; type < MAX_CONN_TYPES; type++) {
-               kfree(p_mngr->acquired[type].cid_map);
+               bitmap_free(p_mngr->acquired[type].cid_map);
                p_mngr->acquired[type].max_count = 0;
                p_mngr->acquired[type].start_cid = 0;
 
                for (vf = 0; vf < MAX_NUM_VFS; vf++) {
-                       kfree(p_mngr->acquired_vf[type][vf].cid_map);
+                       bitmap_free(p_mngr->acquired_vf[type][vf].cid_map);
                        p_mngr->acquired_vf[type][vf].max_count = 0;
                        p_mngr->acquired_vf[type][vf].start_cid = 0;
                }
                         u32 cid_start,
                         u32 cid_count, struct qed_cid_acquired_map *p_map)
 {
-       u32 size;
-
        if (!cid_count)
                return 0;
 
-       size = DIV_ROUND_UP(cid_count,
-                           sizeof(unsigned long) * BITS_PER_BYTE) *
-              sizeof(unsigned long);
-       p_map->cid_map = kzalloc(size, GFP_KERNEL);
+       p_map->cid_map = bitmap_zalloc(cid_count, GFP_KERNEL);
        if (!p_map->cid_map)
                return -ENOMEM;
 
        struct qed_cid_acquired_map *p_map;
        struct qed_conn_type_cfg *p_cfg;
        int type;
-       u32 len;
 
        /* Reset acquired cids */
        for (type = 0; type < MAX_CONN_TYPES; type++) {
                p_cfg = &p_mngr->conn_cfg[type];
                if (p_cfg->cid_count) {
                        p_map = &p_mngr->acquired[type];
-                       len = DIV_ROUND_UP(p_map->max_count,
-                                          sizeof(unsigned long) *
-                                          BITS_PER_BYTE) *
-                             sizeof(unsigned long);
-                       memset(p_map->cid_map, 0, len);
+                       bitmap_zero(p_map->cid_map, p_map->max_count);
                }
 
                if (!p_cfg->cids_per_vf)
 
                for (vf = 0; vf < MAX_NUM_VFS; vf++) {
                        p_map = &p_mngr->acquired_vf[type][vf];
-                       len = DIV_ROUND_UP(p_map->max_count,
-                                          sizeof(unsigned long) *
-                                          BITS_PER_BYTE) *
-                             sizeof(unsigned long);
-                       memset(p_map->cid_map, 0, len);
+                       bitmap_zero(p_map->cid_map, p_map->max_count);
                }
        }
 }