diff --git a/apple-ib-als.c b/apple-ib-als.c index 6c2949d..e752c62 100644 --- a/apple-ib-als.c +++ b/apple-ib-als.c @@ -37,6 +37,7 @@ #include #include #include +#include #include "apple-ibridge.h" @@ -459,8 +460,11 @@ static int appleals_config_iio(struct appleals_device *als_dev) struct iio_trigger *iio_trig; struct appleals_device **priv; int rc; - +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0) iio_dev = iio_device_alloc(sizeof(als_dev)); +#else + iio_dev = iio_device_alloc(&als_dev->hid_dev->dev, sizeof(als_dev)); +#endif if (!iio_dev) return -ENOMEM; @@ -469,7 +473,9 @@ static int appleals_config_iio(struct appleals_device *als_dev) iio_dev->channels = appleals_channels; iio_dev->num_channels = ARRAY_SIZE(appleals_channels); +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0) iio_dev->dev.parent = &als_dev->hid_dev->dev; +#endif iio_dev->info = &appleals_info; iio_dev->name = "als"; iio_dev->modes = INDIO_DIRECT_MODE;