From 35430f867adfccb27c2981bd5dab17565cdc7117 Mon Sep 17 00:00:00 2001 From: Luca Coelho Date: Thu, 20 Sep 2018 14:28:41 +0300 Subject: backport: convert int led activate op to void when needed In kernel v4.19-rc1, the activate op in struct led_trigger, changed from void to int. To solve this, add a semantic patch to insert a wrapper function that returns void and calls the function that returns int. Signed-off-by: Luca Coelho [use <+... ...+> as suggested by Hauke] Signed-off-by: Johannes Berg --- patches/0087-led-activate.cocci | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 patches/0087-led-activate.cocci (limited to 'patches') diff --git a/patches/0087-led-activate.cocci b/patches/0087-led-activate.cocci new file mode 100644 index 00000000..674db046 --- /dev/null +++ b/patches/0087-led-activate.cocci @@ -0,0 +1,24 @@ +@act@ +identifier activate_fn, p; +identifier m =~ "rx_led|tx_led|assoc_led|radio_led|tpt_led"; +fresh identifier activate_fn_wrap = "bp_" ## activate_fn; +@@ +<+... ++#if LINUX_VERSION_IS_GEQ(4,19,0) +p->m.activate = activate_fn; ++#else ++p->m.activate = activate_fn_wrap; ++#endif +...+> + +@@ +identifier act.activate_fn; +identifier act.activate_fn_wrap; +@@ +int activate_fn(...) {...} ++#if LINUX_VERSION_IS_LESS(4,19,0) ++static void activate_fn_wrap(struct led_classdev *led_cdev) ++{ ++ activate_fn(led_cdev); ++} ++#endif -- cgit v1.2.3