diff options
author | Luca Coelho <luciano.coelho@intel.com> | 2018-09-20 14:28:41 +0300 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2018-09-24 09:28:51 +0200 |
commit | 35430f867adfccb27c2981bd5dab17565cdc7117 (patch) | |
tree | 426c8eb254c8f783bf4cd9720ad9156797f7db72 | |
parent | 4c4892004e0f42759c3f95d7b17dd908375e8238 (diff) |
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 <luciano.coelho@intel.com>
[use <+... ...+> as suggested by Hauke]
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r-- | patches/0087-led-activate.cocci | 24 |
1 files changed, 24 insertions, 0 deletions
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 |