aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/mISDN/tei.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/isdn/mISDN/tei.c')
-rw-r--r--drivers/isdn/mISDN/tei.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/isdn/mISDN/tei.c b/drivers/isdn/mISDN/tei.c
index be88728f1106..592f597d8951 100644
--- a/drivers/isdn/mISDN/tei.c
+++ b/drivers/isdn/mISDN/tei.c
@@ -250,7 +250,7 @@ tei_debug(struct FsmInst *fi, char *fmt, ...)
250static int 250static int
251get_free_id(struct manager *mgr) 251get_free_id(struct manager *mgr)
252{ 252{
253 u64 ids = 0; 253 DECLARE_BITMAP(ids, 64) = { [0 ... BITS_TO_LONGS(64) - 1] = 0 };
254 int i; 254 int i;
255 struct layer2 *l2; 255 struct layer2 *l2;
256 256
@@ -261,11 +261,11 @@ get_free_id(struct manager *mgr)
261 __func__); 261 __func__);
262 return -EBUSY; 262 return -EBUSY;
263 } 263 }
264 test_and_set_bit(l2->ch.nr, (u_long *)&ids); 264 __set_bit(l2->ch.nr, ids);
265 } 265 }
266 for (i = 1; i < 64; i++) 266 i = find_next_zero_bit(ids, 64, 1);
267 if (!test_bit(i, (u_long *)&ids)) 267 if (i < 64)
268 return i; 268 return i;
269 printk(KERN_WARNING "%s: more as 63 layer2 for one device\n", 269 printk(KERN_WARNING "%s: more as 63 layer2 for one device\n",
270 __func__); 270 __func__);
271 return -EBUSY; 271 return -EBUSY;
@@ -274,7 +274,7 @@ get_free_id(struct manager *mgr)
274static int 274static int
275get_free_tei(struct manager *mgr) 275get_free_tei(struct manager *mgr)
276{ 276{
277 u64 ids = 0; 277 DECLARE_BITMAP(ids, 64) = { [0 ... BITS_TO_LONGS(64) - 1] = 0 };
278 int i; 278 int i;
279 struct layer2 *l2; 279 struct layer2 *l2;
280 280
@@ -288,11 +288,11 @@ get_free_tei(struct manager *mgr)
288 continue; 288 continue;
289 i -= 64; 289 i -= 64;
290 290
291 test_and_set_bit(i, (u_long *)&ids); 291 __set_bit(i, ids);
292 } 292 }
293 for (i = 0; i < 64; i++) 293 i = find_first_zero_bit(ids, 64);
294 if (!test_bit(i, (u_long *)&ids)) 294 if (i < 64)
295 return i + 64; 295 return i + 64;
296 printk(KERN_WARNING "%s: more as 63 dynamic tei for one device\n", 296 printk(KERN_WARNING "%s: more as 63 dynamic tei for one device\n",
297 __func__); 297 __func__);
298 return -1; 298 return -1;