Add version checks for struct iio_info.driver_module
b/135170504
Change-Id: I6070968879d4bff682b546800a1d70af11ff6793
diff --git a/coral-enviro-drivers/debian/changelog b/coral-enviro-drivers/debian/changelog
index d6ef17c..b412fe6 100644
--- a/coral-enviro-drivers/debian/changelog
+++ b/coral-enviro-drivers/debian/changelog
@@ -1,5 +1,6 @@
coral-enviro-drivers-dkms (1.4) stable; urgency=medium
+ * Wrap struct iio_info.driver_module in version check
* Enforce linux-headers version (>=4.9)
-- Coral <coral-support@google.com> Tue, 21 May 2019 15:17:40 +0200
diff --git a/coral-enviro-drivers/humidity/hdc20x0.c b/coral-enviro-drivers/humidity/hdc20x0.c
index e4733b0..c786ef2 100644
--- a/coral-enviro-drivers/humidity/hdc20x0.c
+++ b/coral-enviro-drivers/humidity/hdc20x0.c
@@ -20,6 +20,7 @@
#include <linux/init.h>
#include <linux/module.h>
#include <linux/regmap.h>
+#include <linux/version.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
@@ -256,7 +257,9 @@
.read_raw = hdc20x0_read_raw,
.write_raw = hdc20x0_write_raw,
.attrs = &hdc20x0_attribute_group,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0))
.driver_module = THIS_MODULE,
+#endif
};
static int hdc20x0_probe(
diff --git a/coral-enviro-drivers/pressure/bmp280.c b/coral-enviro-drivers/pressure/bmp280.c
index a2602d8..2f52565 100644
--- a/coral-enviro-drivers/pressure/bmp280.c
+++ b/coral-enviro-drivers/pressure/bmp280.c
@@ -15,6 +15,7 @@
#include <linux/i2c.h>
#include <linux/acpi.h>
#include <linux/regmap.h>
+#include <linux/version.h>
#include <linux/iio/iio.h>
#include <linux/iio/sysfs.h>
@@ -311,7 +312,9 @@
}
static const struct iio_info bmp280_info = {
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 15, 0))
.driver_module = THIS_MODULE,
+#endif
.read_raw = &bmp280_read_raw,
};