/* * Generic thunking code to convert data between host and target CPU * * Copyright (c) 2003 Fabrice Bellard * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef THUNK_H #define THUNK_H #include #include "cpu.h" /* types enums definitions */ typedef enum argtype { TYPE_NULL, TYPE_CHAR, TYPE_SHORT, TYPE_INT, TYPE_LONG, TYPE_ULONG, TYPE_PTRVOID, /* pointer on unknown data */ TYPE_LONGLONG, TYPE_ULONGLONG, TYPE_PTR, TYPE_ARRAY, TYPE_STRUCT, } argtype; #define MK_PTR(type) TYPE_PTR, type #define MK_ARRAY(type, size) TYPE_ARRAY, size, type #define MK_STRUCT(id) TYPE_STRUCT, id #define THUNK_TARGET 0 #define THUNK_HOST 1 typedef struct { /* standard struct handling */ const argtype *field_types; int nb_fields; int *field_offsets[2]; /* special handling */ void (*convert[2])(void *dst, const void *src); int size[2]; int align[2]; const char *name; } StructEntry; /* Translation table for bitmasks... */ typedef struct bitmask_transtbl { unsigned int x86_mask; unsigned int x86_bits; unsigned int alpha_mask; unsigned int alpha_bits; } bitmask_transtbl; void thunk_register_struct(int id, const char *name, const argtype *types); void thunk_register_struct_direct(int id, const char *name, StructEntry *se1); const argtype *thunk_convert(void *dst, const void *src, const argtype *type_ptr, int to_host); #ifndef NO_THUNK_TYPE_SIZE extern StructEntry struct_entries[]; static inline int thunk_type_size(const argtype *type_ptr, int is_host) { int type, size; const StructEntry *se; type = *type_ptr; switch(type) { case TYPE_CHAR: return 1; case TYPE_SHORT: return 2; case TYPE_INT: return 4; case TYPE_LONGLONG: case TYPE_ULONGLONG: return 8; case TYPE_LONG: case TYPE_ULONG: case TYPE_PTRVOID: case TYPE_PTR: if (is_host) { return HOST_LONG_SIZE; } else { return TARGET_LONG_SIZE; } break; case TYPE_ARRAY: size = type_ptr[1]; return size * thunk_type_size(type_ptr + 2, is_host); case TYPE_STRUCT: se = struct_entries + type_ptr[1]; return se->size[is_host]; default: return -1; } } static inline int thunk_type_align(const argtype *type_ptr, int is_host) { int type; const StructEntry *se; type = *type_ptr; switch(type) { case TYPE_CHAR: return 1; case TYPE_SHORT: return 2; case TYPE_INT: return 4; case TYPE_LONGLONG: case TYPE_ULONGLONG: return 8; case TYPE_LONG: case TYPE_ULONG: case TYPE_PTRVOID: case TYPE_PTR: if (is_host) { return HOST_LONG_SIZE; } else { return TARGET_LONG_SIZE; } break; case TYPE_ARRAY: return thunk_type_align(type_ptr + 2, is_host); case TYPE_STRUCT: se = struct_entries + type_ptr[1]; return se->align[is_host]; default: return -1; } } #endif /* NO_THUNK_TYPE_SIZE */ unsigned int target_to_host_bitmask(unsigned int x86_mask, bitmask_transtbl * trans_tbl); unsigned int host_to_target_bitmask(unsigned int alpha_mask, bitmask_transtbl * trans_tbl); #endif 19/280-rfkill-stubs.patch?id=57f4eab6771c5b099a09cea4e661bf5ccebbbb95'>plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
From 236c1acdfef5958010ac9814a9872e0a46fd78ee Mon Sep 17 00:00:00 2001
From: John Crispin <john@phrozen.org>
Date: Fri, 7 Jul 2017 17:13:44 +0200
Subject: rfkill: add fake rfkill support

allow building of modules depending on RFKILL even if RFKILL is not enabled.

Signed-off-by: John Crispin <john@phrozen.org>
---
 include/linux/rfkill.h |  2 +-
 net/Makefile           |  2 +-
 net/rfkill/Kconfig     | 14 +++++++++-----
 net/rfkill/Makefile    |  2 +-
 4 files changed, 12 insertions(+), 8 deletions(-)

--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -64,7 +64,7 @@ struct rfkill_ops {
 	int	(*set_block)(void *data, bool blocked);
 };
 
-#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
+#if defined(CONFIG_RFKILL_FULL) || defined(CONFIG_RFKILL_FULL_MODULE)
 /**
  * rfkill_alloc - Allocate rfkill structure
  * @name: name of the struct -- the string is not copied internally
--- a/net/Makefile
+++ b/net/Makefile
@@ -53,7 +53,7 @@ obj-$(CONFIG_TIPC)		+= tipc/
 obj-$(CONFIG_NETLABEL)		+= netlabel/
 obj-$(CONFIG_IUCV)		+= iucv/
 obj-$(CONFIG_SMC)		+= smc/
-obj-$(CONFIG_RFKILL)		+= rfkill/
+obj-$(CONFIG_RFKILL_FULL)	+= rfkill/
 obj-$(CONFIG_NET_9P)		+= 9p/
 obj-$(CONFIG_CAIF)		+= caif/
 ifneq ($(CONFIG_DCB),)
--- a/net/rfkill/Kconfig
+++ b/net/rfkill/Kconfig
@@ -1,7 +1,11 @@
 #
 # RF switch subsystem configuration
 #
-menuconfig RFKILL
+config RFKILL
+	bool
+	default y
+
+menuconfig RFKILL_FULL
 	tristate "RF switch subsystem support"
 	help
 	  Say Y here if you want to have control over RF switches
@@ -13,19 +17,19 @@ menuconfig RFKILL
 # LED trigger support
 config RFKILL_LEDS
 	bool
-	depends on RFKILL
+	depends on RFKILL_FULL
 	depends on LEDS_TRIGGERS = y || RFKILL = LEDS_TRIGGERS
 	default y
 
 config RFKILL_INPUT
 	bool "RF switch input support" if EXPERT
-	depends on RFKILL
+	depends on RFKILL_FULL
 	depends on INPUT = y || RFKILL = INPUT
 	default y if !EXPERT
 
 config RFKILL_GPIO
 	tristate "GPIO RFKILL driver"
-	depends on RFKILL
+	depends on RFKILL_FULL
 	depends on GPIOLIB || COMPILE_TEST
 	default n
 	help
--- a/net/rfkill/Makefile
+++ b/net/rfkill/Makefile
@@ -4,5 +4,5 @@
 
 rfkill-y			+= core.o
 rfkill-$(CONFIG_RFKILL_INPUT)	+= input.o
-obj-$(CONFIG_RFKILL)		+= rfkill.o
+obj-$(CONFIG_RFKILL_FULL)	+= rfkill.o
 obj-$(CONFIG_RFKILL_GPIO)	+= rfkill-gpio.o