Skip to content

Commit 2a99241

Browse files
tititiou36dtor
authored andcommitted
Input: 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(). Note that the upper limit of ida_simple_get() is exclusive, but the one of ida_alloc_range() is inclusive. So a -1 has been added when needed. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/a885de14beead2cc3c1c946f192b8b178dac696a.1705349930.git.christophe.jaillet@wanadoo.fr Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent bc49961 commit 2a99241

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

drivers/input/input.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2629,17 +2629,15 @@ int input_get_new_minor(int legacy_base, unsigned int legacy_num,
26292629
* locking is needed here.
26302630
*/
26312631
if (legacy_base >= 0) {
2632-
int minor = ida_simple_get(&input_ida,
2633-
legacy_base,
2634-
legacy_base + legacy_num,
2635-
GFP_KERNEL);
2632+
int minor = ida_alloc_range(&input_ida, legacy_base,
2633+
legacy_base + legacy_num - 1,
2634+
GFP_KERNEL);
26362635
if (minor >= 0 || !allow_dynamic)
26372636
return minor;
26382637
}
26392638

2640-
return ida_simple_get(&input_ida,
2641-
INPUT_FIRST_DYNAMIC_DEV, INPUT_MAX_CHAR_DEVICES,
2642-
GFP_KERNEL);
2639+
return ida_alloc_range(&input_ida, INPUT_FIRST_DYNAMIC_DEV,
2640+
INPUT_MAX_CHAR_DEVICES - 1, GFP_KERNEL);
26432641
}
26442642
EXPORT_SYMBOL(input_get_new_minor);
26452643

@@ -2652,7 +2650,7 @@ EXPORT_SYMBOL(input_get_new_minor);
26522650
*/
26532651
void input_free_minor(unsigned int minor)
26542652
{
2655-
ida_simple_remove(&input_ida, minor);
2653+
ida_free(&input_ida, minor);
26562654
}
26572655
EXPORT_SYMBOL(input_free_minor);
26582656

0 commit comments

Comments
 (0)