1 rfkill was re-implemented on 2.6.31. We port it to
2 older kernels with a simple hack, just rename the
3 module as a new one rfkill_backport, and every
4 exported symbol gets redefined with a _backport
5 postfix through compat-2.6.31.h. The changes below
6 are the ones we could not do through compat-2.6.31.h
8 Do older kernels have /dev/rfkill ? I not then we can
9 just keep /dev/rfkill and not /dev/rfkill_backport.
11 Note that 2.6.31 added netdevice notifier upon interface
12 dev_open() which on cfg80211 will check if checks to see
13 if rfkill is enabled (or if the mode of operation is not
14 supported) on the cfg80211_netdev_notifier_call() and if
15 so deny bringing the interface up. This was added via
16 commit:
18 3b8bcfd5d31ea0fec58681d035544ace707d2536
20 Since older kernels will not have the notifier call
21 on dev_open() if we *really want* to port this we could have
22 mac80211's subif_open() call :
24 ret = call_netdevice_notifiers(NETDEV_PRE_UP, dev);
25 ret = notifier_to_errno(ret);
26 if (ret)
27 return ret;
29 This would do the policing from within mac80211.
31 --- a/net/rfkill/Makefile
32 +++ b/net/rfkill/Makefile
33 @@ -2,7 +2,7 @@
34 # Makefile for the RF switch subsystem.
35 #
37 -rfkill-y += core.o
38 -rfkill-$(CONFIG_RFKILL_INPUT) += input.o
39 -obj-$(CONFIG_RFKILL) += rfkill.o
40 +rfkill_backport-y += core.o
41 +rfkill_backport-$(CONFIG_RFKILL_BACKPORT_INPUT) += input.o
42 +obj-$(CONFIG_RFKILL_BACKPORT) += rfkill_backport.o
43 obj-$(CONFIG_RFKILL_REGULATOR) += rfkill-regulator.o
44 --- a/net/rfkill/input.c
45 +++ b/net/rfkill/input.c
46 @@ -232,7 +232,7 @@ static int rfkill_connect(struct input_h
48 handle->dev = dev;
49 handle->handler = handler;
50 - handle->name = "rfkill";
51 + handle->name = "rfkill_backport";
53 /* causes rfkill_start() to be called */
54 error = input_register_handle(handle);
55 --- a/net/rfkill/core.c
56 +++ b/net/rfkill/core.c
57 @@ -658,7 +658,7 @@ static int rfkill_resume(struct device *
58 }
60 static struct class rfkill_class = {
61 - .name = "rfkill",
62 + .name = "rfkill_backport",
63 .dev_release = rfkill_release,
64 .dev_attrs = rfkill_dev_attrs,
65 .dev_uevent = rfkill_dev_uevent,