[PATCH 13/14] backport: convert int led activate op to void when needed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


From: Luca Coelho <luciano.coelho@xxxxxxxxx>

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

Signed-off-by: Luca Coelho <luciano.coelho@xxxxxxxxx>
 patches/led_activate.cocci | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 patches/led_activate.cocci

diff --git a/patches/led_activate.cocci b/patches/led_activate.cocci
new file mode 100644
index 000000000000..df8211d29462
--- /dev/null
+++ b/patches/led_activate.cocci
@@ -0,0 +1,24 @@
+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;
++p->m.activate = activate_fn_wrap;
+identifier act.activate_fn;
+identifier act.activate_fn_wrap;
+int activate_fn(...) {...}
++static void activate_fn_wrap(struct led_classdev *led_cdev)
++	activate_fn(led_cdev);

To unsubscribe from this list: send the line "unsubscribe backports" in

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux