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.

watchdog: core: 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()/ida_alloc_max() is inclusive. So a -1 has been added when
needed.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Link: https://lore.kernel.org/r/bc5b82db59ccac69f2612ba104e2f5100401a862.1705009009.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>

authored by

Christophe JAILLET and committed by
Wim Van Sebroeck
b568b150 41bccc98

+9 -8
+9 -8
drivers/watchdog/watchdog_core.c
··· 260 260 if (wdd->parent) { 261 261 ret = of_alias_get_id(wdd->parent->of_node, "watchdog"); 262 262 if (ret >= 0) 263 - id = ida_simple_get(&watchdog_ida, ret, 264 - ret + 1, GFP_KERNEL); 263 + id = ida_alloc_range(&watchdog_ida, ret, ret, 264 + GFP_KERNEL); 265 265 } 266 266 267 267 if (id < 0) 268 - id = ida_simple_get(&watchdog_ida, 0, MAX_DOGS, GFP_KERNEL); 268 + id = ida_alloc_max(&watchdog_ida, MAX_DOGS - 1, GFP_KERNEL); 269 269 270 270 if (id < 0) 271 271 return id; ··· 273 273 274 274 ret = watchdog_dev_register(wdd); 275 275 if (ret) { 276 - ida_simple_remove(&watchdog_ida, id); 276 + ida_free(&watchdog_ida, id); 277 277 if (!(id == 0 && ret == -EBUSY)) 278 278 return ret; 279 279 280 280 /* Retry in case a legacy watchdog module exists */ 281 - id = ida_simple_get(&watchdog_ida, 1, MAX_DOGS, GFP_KERNEL); 281 + id = ida_alloc_range(&watchdog_ida, 1, MAX_DOGS - 1, 282 + GFP_KERNEL); 282 283 if (id < 0) 283 284 return id; 284 285 wdd->id = id; 285 286 286 287 ret = watchdog_dev_register(wdd); 287 288 if (ret) { 288 - ida_simple_remove(&watchdog_ida, id); 289 + ida_free(&watchdog_ida, id); 289 290 return ret; 290 291 } 291 292 } ··· 310 309 pr_err("watchdog%d: Cannot register reboot notifier (%d)\n", 311 310 wdd->id, ret); 312 311 watchdog_dev_unregister(wdd); 313 - ida_simple_remove(&watchdog_ida, id); 312 + ida_free(&watchdog_ida, id); 314 313 return ret; 315 314 } 316 315 } ··· 383 382 unregister_reboot_notifier(&wdd->reboot_nb); 384 383 385 384 watchdog_dev_unregister(wdd); 386 - ida_simple_remove(&watchdog_ida, wdd->id); 385 + ida_free(&watchdog_ida, wdd->id); 387 386 } 388 387 389 388 /**