@@ -260,32 +260,33 @@ static int __watchdog_register_device(struct watchdog_device *wdd)
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 ;
272
272
wdd -> id = 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
}
@@ -309,7 +310,7 @@ static int __watchdog_register_device(struct watchdog_device *wdd)
309
310
pr_err ("watchdog%d: Cannot register reboot notifier (%d)\n" ,
310
311
wdd -> id , ret );
311
312
watchdog_dev_unregister (wdd );
312
- ida_simple_remove (& watchdog_ida , id );
313
+ ida_free (& watchdog_ida , id );
313
314
return ret ;
314
315
}
315
316
}
@@ -382,7 +383,7 @@ static void __watchdog_unregister_device(struct watchdog_device *wdd)
382
383
unregister_reboot_notifier (& wdd -> reboot_nb );
383
384
384
385
watchdog_dev_unregister (wdd );
385
- ida_simple_remove (& watchdog_ida , wdd -> id );
386
+ ida_free (& watchdog_ida , wdd -> id );
386
387
}
387
388
388
389
/**
0 commit comments