Skip to content

Commit 4f60b77

Browse files
committed
xpadneo: Remove deprecated ida_simple_xx() usage
Update to use ida_alloc() and ida_free() in place of the deprecated ida_simple_get() and ida_simple_remove() calls. Linux has removed this API in the v6.18 release candidates. ida_simple_xx() has been deprecated since v5.10 and the new API was introduced in v4.19. Closes: #562 Signed-off-by: Kai Krakow <[email protected]>
1 parent 3720340 commit 4f60b77

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

docs/README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,12 @@ These other projects may not support some of the advanced features of xpadneo.
4444

4545
## Breaking Changes
4646

47-
### Kernel 4.18 or newer required
47+
### Kernel 4.19 or newer required
4848

49-
As of xpadneo v0.10, we require kernel 4.18 or later to utilize `HID_QUIRK_INPUT_PER_APP` which splits the gamepad into
50-
multiple sub-devices to fix problems and incompatibilities at several layers.
49+
As of xpadneo v0.10, we require kernel 4.19 or later to utilize `HID_QUIRK_INPUT_PER_APP` (available in kernel 4.18+)
50+
which splits the gamepad into multiple sub-devices to fix problems and incompatibilities at several layers. We also
51+
require `ida_simple_{alloc,free}()` (available since kernel 4.19) which has been deprecated since kernel 5.10, and is
52+
no longer available in kernel 6.18+.
5153

5254

5355
### SDL2 2.28 Compatibility

hid-xpadneo/src/hid-xpadneo.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,7 @@ static int xpadneo_probe(struct hid_device *hdev, const struct hid_device_id *id
12351235
if (xdata == NULL)
12361236
return -ENOMEM;
12371237

1238-
index = ida_simple_get(&xpadneo_device_id_allocator, 0, 0, GFP_KERNEL);
1238+
index = ida_alloc(&xpadneo_device_id_allocator, GFP_KERNEL);
12391239
if (index < 0)
12401240
return index;
12411241
xdata->id = index;
@@ -1344,7 +1344,7 @@ static int xpadneo_probe(struct hid_device *hdev, const struct hid_device_id *id
13441344
static void xpadneo_release_device_id(struct xpadneo_devdata *xdata)
13451345
{
13461346
if (xdata->id >= 0) {
1347-
ida_simple_remove(&xpadneo_device_id_allocator, xdata->id);
1347+
ida_free(&xpadneo_device_id_allocator, xdata->id);
13481348
xdata->id = -1;
13491349
}
13501350
}

hid-xpadneo/src/xpadneo.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@
1616

1717
#include "hid-ids.h"
1818

19-
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,18,0)
19+
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 19, 0)
20+
#error "kernel version 4.19.0+ required for ida_simple_{alloc,free}()"
21+
#endif
22+
23+
#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 18, 0)
2024
#error "kernel version 4.18.0+ required for HID_QUIRK_INPUT_PER_APP"
2125
#endif
2226

0 commit comments

Comments
 (0)