[bootlin/training-materials updates] master: laba-dta: nunchuk driver: fix __init annotations (f1e34959)
Alexandre Belloni
alexandre.belloni at bootlin.com
Wed Jun 10 00:45:14 CEST 2020
Repository : https://github.com/bootlin/training-materials
On branch : master
Link : https://github.com/bootlin/training-materials/commit/f1e349592e7780f318377efc0438b985ad7ac4ef
>---------------------------------------------------------------
commit f1e349592e7780f318377efc0438b985ad7ac4ef
Author: Alexandre Belloni <alexandre.belloni at bootlin.com>
Date: Wed Jun 10 00:42:17 2020 +0200
laba-dta: nunchuk driver: fix __init annotations
There is no reason to have wiichuck_probe and wiichuck_match_table in the
init sections as the driver may be bound and unbound at runtime and this
would lead to a crash.
Signed-off-by: Alexandre Belloni <alexandre.belloni at bootlin.com>
>---------------------------------------------------------------
f1e349592e7780f318377efc0438b985ad7ac4ef
.../buildroot/buildroot-rootfs/linux/0001-Add-nunchuk-driver.patch | 4 ++--
.../bootlin-lab-data/nunchuk/linux/0001-Add-nunchuk-driver.patch | 6 +++---
.../bootlin-lab-data/nunchuk/linux/0001-Add-nunchuk-driver.patch | 4 ++--
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/lab-data/buildroot/buildroot-rootfs/linux/0001-Add-nunchuk-driver.patch b/lab-data/buildroot/buildroot-rootfs/linux/0001-Add-nunchuk-driver.patch
index 88d54be3..1e3b8034 100644
--- a/lab-data/buildroot/buildroot-rootfs/linux/0001-Add-nunchuk-driver.patch
+++ b/lab-data/buildroot/buildroot-rootfs/linux/0001-Add-nunchuk-driver.patch
@@ -339,7 +339,7 @@ index 000000000000..939cf0c27100
+ wiichuck->poll_dev->poll_interval = WIICHUCK_POLL_PERIOD;
+}
+
-+static int __init wiichuck_probe(struct i2c_client *client,
++static int wiichuck_probe(struct i2c_client *client,
+ const struct i2c_device_id *id)
+{
+ struct wiichuck_device *wiichuck;
@@ -451,7 +451,7 @@ index 000000000000..939cf0c27100
+MODULE_DEVICE_TABLE(i2c, wiichuck_id);
+
+#ifdef CONFIG_OF
-+static const struct of_device_id wiichuck_match_table[] __initdata = {
++static const struct of_device_id wiichuck_match_table[] = {
+ { .compatible = "nintendo,wiimote-extension", },
+ { }
+};
diff --git a/lab-data/yocto-stm32/bootlin-lab-data/nunchuk/linux/0001-Add-nunchuk-driver.patch b/lab-data/yocto-stm32/bootlin-lab-data/nunchuk/linux/0001-Add-nunchuk-driver.patch
index f3c3d1f7..721c55ad 100644
--- a/lab-data/yocto-stm32/bootlin-lab-data/nunchuk/linux/0001-Add-nunchuk-driver.patch
+++ b/lab-data/yocto-stm32/bootlin-lab-data/nunchuk/linux/0001-Add-nunchuk-driver.patch
@@ -338,7 +338,7 @@ index 000000000000..865f5ca9d941
+ wiichuck->poll_dev->poll_interval = WIICHUCK_POLL_PERIOD;
+}
+
-+static int __init wiichuck_probe(struct i2c_client *client,
++static int wiichuck_probe(struct i2c_client *client,
+ const struct i2c_device_id *id)
+{
+ struct wiichuck_device *wiichuck;
@@ -450,7 +450,7 @@ index 000000000000..865f5ca9d941
+MODULE_DEVICE_TABLE(i2c, wiichuck_id);
+
+#ifdef CONFIG_OF
-+static struct of_device_id wiichuck_match_table[] = {
++static const struct of_device_id wiichuck_match_table[] = {
+ { .compatible = "nintendo,wiimote-extension", },
+ { }
+};
@@ -468,7 +468,7 @@ index 000000000000..865f5ca9d941
+ .id_table = wiichuck_id,
+};
+
-+static int wiichuck_init(void)
++static int __init wiichuck_init(void)
+{
+ return i2c_add_driver(&wiichuck_driver);
+}
diff --git a/lab-data/yocto/bootlin-lab-data/nunchuk/linux/0001-Add-nunchuk-driver.patch b/lab-data/yocto/bootlin-lab-data/nunchuk/linux/0001-Add-nunchuk-driver.patch
index e7184096..6e6726ac 100644
--- a/lab-data/yocto/bootlin-lab-data/nunchuk/linux/0001-Add-nunchuk-driver.patch
+++ b/lab-data/yocto/bootlin-lab-data/nunchuk/linux/0001-Add-nunchuk-driver.patch
@@ -338,7 +338,7 @@ index 000000000000..ea7a1e078f2c
+ wiichuck->poll_dev->poll_interval = WIICHUCK_POLL_PERIOD;
+}
+
-+static int __init wiichuck_probe(struct i2c_client *client,
++static int wiichuck_probe(struct i2c_client *client,
+ const struct i2c_device_id *id)
+{
+ struct wiichuck_device *wiichuck;
@@ -450,7 +450,7 @@ index 000000000000..ea7a1e078f2c
+MODULE_DEVICE_TABLE(i2c, wiichuck_id);
+
+#ifdef CONFIG_OF
-+static struct of_device_id wiichuck_match_table[] __initdata = {
++static const struct of_device_id wiichuck_match_table[] = {
+ { .compatible = "nintendo,wiimote-extension", },
+ { }
+};
More information about the training-materials-updates
mailing list