Skip to content

Commit ebfee7a

Browse files
tititiou36Steve French
authored andcommitted
ksmbd: Remove usage of the deprecated ida_simple_xx() API
ida_alloc() and ida_free() should be preferred to the deprecated ida_simple_get() and ida_simple_remove(). This is less verbose. Note that the upper limit of ida_simple_get() is exclusive, but the one of ida_alloc_range() is inclusive. So change a 0xFFFFFFFF into a 0xFFFFFFFE in order to keep the same behavior. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Acked-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent b6e9a44 commit ebfee7a

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

fs/smb/server/mgmt/ksmbd_ida.c

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,42 +5,33 @@
55

66
#include "ksmbd_ida.h"
77

8-
static inline int __acquire_id(struct ida *ida, int from, int to)
9-
{
10-
return ida_simple_get(ida, from, to, GFP_KERNEL);
11-
}
12-
138
int ksmbd_acquire_smb2_tid(struct ida *ida)
149
{
15-
int id;
16-
17-
id = __acquire_id(ida, 1, 0xFFFFFFFF);
18-
19-
return id;
10+
return ida_alloc_range(ida, 1, 0xFFFFFFFE, GFP_KERNEL);
2011
}
2112

2213
int ksmbd_acquire_smb2_uid(struct ida *ida)
2314
{
2415
int id;
2516

26-
id = __acquire_id(ida, 1, 0);
17+
id = ida_alloc_min(ida, 1, GFP_KERNEL);
2718
if (id == 0xFFFE)
28-
id = __acquire_id(ida, 1, 0);
19+
id = ida_alloc_min(ida, 1, GFP_KERNEL);
2920

3021
return id;
3122
}
3223

3324
int ksmbd_acquire_async_msg_id(struct ida *ida)
3425
{
35-
return __acquire_id(ida, 1, 0);
26+
return ida_alloc_min(ida, 1, GFP_KERNEL);
3627
}
3728

3829
int ksmbd_acquire_id(struct ida *ida)
3930
{
40-
return __acquire_id(ida, 0, 0);
31+
return ida_alloc(ida, GFP_KERNEL);
4132
}
4233

4334
void ksmbd_release_id(struct ida *ida, int id)
4435
{
45-
ida_simple_remove(ida, id);
36+
ida_free(ida, id);
4637
}

0 commit comments

Comments
 (0)