Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: gadget: function: 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_max() 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/7cd361e2b377a5373968fa7deee4169229992a1e.1713107386.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Christophe JAILLET and committed by
Greg Kroah-Hartman
920e7522 3d122e6d

+8 -8
+3 -3
drivers/usb/gadget/function/f_hid.c
··· 1029 1029 { 1030 1030 int ret; 1031 1031 1032 - ret = ida_simple_get(&hidg_ida, 0, 0, GFP_KERNEL); 1032 + ret = ida_alloc(&hidg_ida, GFP_KERNEL); 1033 1033 if (ret >= HIDG_MINORS) { 1034 - ida_simple_remove(&hidg_ida, ret); 1034 + ida_free(&hidg_ida, ret); 1035 1035 ret = -ENODEV; 1036 1036 } 1037 1037 ··· 1176 1176 1177 1177 static inline void hidg_put_minor(int minor) 1178 1178 { 1179 - ida_simple_remove(&hidg_ida, minor); 1179 + ida_free(&hidg_ida, minor); 1180 1180 } 1181 1181 1182 1182 static void hidg_free_inst(struct usb_function_instance *f)
+3 -3
drivers/usb/gadget/function/f_printer.c
··· 1312 1312 { 1313 1313 int ret; 1314 1314 1315 - ret = ida_simple_get(&printer_ida, 0, 0, GFP_KERNEL); 1315 + ret = ida_alloc(&printer_ida, GFP_KERNEL); 1316 1316 if (ret >= PRINTER_MINORS) { 1317 - ida_simple_remove(&printer_ida, ret); 1317 + ida_free(&printer_ida, ret); 1318 1318 ret = -ENODEV; 1319 1319 } 1320 1320 ··· 1323 1323 1324 1324 static inline void gprinter_put_minor(int minor) 1325 1325 { 1326 - ida_simple_remove(&printer_ida, minor); 1326 + ida_free(&printer_ida, minor); 1327 1327 } 1328 1328 1329 1329 static int gprinter_setup(int);
+2 -2
drivers/usb/gadget/function/rndis.c
··· 869 869 870 870 static inline int rndis_get_nr(void) 871 871 { 872 - return ida_simple_get(&rndis_ida, 0, 1000, GFP_KERNEL); 872 + return ida_alloc_max(&rndis_ida, 999, GFP_KERNEL); 873 873 } 874 874 875 875 static inline void rndis_put_nr(int nr) 876 876 { 877 - ida_simple_remove(&rndis_ida, nr); 877 + ida_free(&rndis_ida, nr); 878 878 } 879 879 880 880 struct rndis_params *rndis_register(void (*resp_avail)(void *v), void *v)