Annotation of /trunk/kernel-alx/patches-3.18/0116-3.18.17-all-fixes.patch
Parent Directory | Revision Log
Revision 2617 -
(hide annotations)
(download)
Mon Jul 13 08:29:05 2015 UTC (9 years, 2 months ago) by niro
File size: 238602 byte(s)
Mon Jul 13 08:29:05 2015 UTC (9 years, 2 months ago) by niro
File size: 238602 byte(s)
-linux-3.18.17
1 | niro | 2617 | diff --git a/Documentation/networking/rds.txt b/Documentation/networking/rds.txt |
2 | index c67077cbeb80..e1a3d59bbe0f 100644 | ||
3 | --- a/Documentation/networking/rds.txt | ||
4 | +++ b/Documentation/networking/rds.txt | ||
5 | @@ -62,11 +62,10 @@ Socket Interface | ||
6 | ================ | ||
7 | |||
8 | AF_RDS, PF_RDS, SOL_RDS | ||
9 | - These constants haven't been assigned yet, because RDS isn't in | ||
10 | - mainline yet. Currently, the kernel module assigns some constant | ||
11 | - and publishes it to user space through two sysctl files | ||
12 | - /proc/sys/net/rds/pf_rds | ||
13 | - /proc/sys/net/rds/sol_rds | ||
14 | + AF_RDS and PF_RDS are the domain type to be used with socket(2) | ||
15 | + to create RDS sockets. SOL_RDS is the socket-level to be used | ||
16 | + with setsockopt(2) and getsockopt(2) for RDS specific socket | ||
17 | + options. | ||
18 | |||
19 | fd = socket(PF_RDS, SOCK_SEQPACKET, 0); | ||
20 | This creates a new, unbound RDS socket. | ||
21 | diff --git a/Documentation/pinctrl.txt b/Documentation/pinctrl.txt | ||
22 | index b8f2147b96dd..0df872a41053 100644 | ||
23 | --- a/Documentation/pinctrl.txt | ||
24 | +++ b/Documentation/pinctrl.txt | ||
25 | @@ -72,7 +72,6 @@ static struct pinctrl_desc foo_desc = { | ||
26 | .name = "foo", | ||
27 | .pins = foo_pins, | ||
28 | .npins = ARRAY_SIZE(foo_pins), | ||
29 | - .maxpin = 63, | ||
30 | .owner = THIS_MODULE, | ||
31 | }; | ||
32 | |||
33 | @@ -164,8 +163,8 @@ static const char *foo_get_group_name(struct pinctrl_dev *pctldev, | ||
34 | } | ||
35 | |||
36 | static int foo_get_group_pins(struct pinctrl_dev *pctldev, unsigned selector, | ||
37 | - unsigned ** const pins, | ||
38 | - unsigned * const num_pins) | ||
39 | + const unsigned **pins, | ||
40 | + unsigned *num_pins) | ||
41 | { | ||
42 | *pins = (unsigned *) foo_groups[selector].pins; | ||
43 | *num_pins = foo_groups[selector].num_pins; | ||
44 | @@ -570,9 +569,8 @@ is possible to perform the requested mux setting, poke the hardware so that | ||
45 | this happens. | ||
46 | |||
47 | Pinmux drivers are required to supply a few callback functions, some are | ||
48 | -optional. Usually the enable() and disable() functions are implemented, | ||
49 | -writing values into some certain registers to activate a certain mux setting | ||
50 | -for a certain pin. | ||
51 | +optional. Usually the set_mux() function is implemented, writing values into | ||
52 | +some certain registers to activate a certain mux setting for a certain pin. | ||
53 | |||
54 | A simple driver for the above example will work by setting bits 0, 1, 2, 3 or 4 | ||
55 | into some register named MUX to select a certain function with a certain | ||
56 | @@ -1266,7 +1264,7 @@ The semantics of the pinctrl APIs are: | ||
57 | |||
58 | Usually the pin control core handled the get/put pair and call out to the | ||
59 | device drivers bookkeeping operations, like checking available functions and | ||
60 | -the associated pins, whereas the enable/disable pass on to the pin controller | ||
61 | +the associated pins, whereas select_state pass on to the pin controller | ||
62 | driver which takes care of activating and/or deactivating the mux setting by | ||
63 | quickly poking some registers. | ||
64 | |||
65 | @@ -1363,8 +1361,9 @@ function, but with different named in the mapping as described under | ||
66 | "Advanced mapping" above. So that for an SPI device, we have two states named | ||
67 | "pos-A" and "pos-B". | ||
68 | |||
69 | -This snippet first muxes the function in the pins defined by group A, enables | ||
70 | -it, disables and releases it, and muxes it in on the pins defined by group B: | ||
71 | +This snippet first initializes a state object for both groups (in foo_probe()), | ||
72 | +then muxes the function in the pins defined by group A, and finally muxes it in | ||
73 | +on the pins defined by group B: | ||
74 | |||
75 | #include <linux/pinctrl/consumer.h> | ||
76 | |||
77 | diff --git a/Documentation/stable_kernel_rules.txt b/Documentation/stable_kernel_rules.txt | ||
78 | index 02f8331edb8b..58d0ac4df946 100644 | ||
79 | --- a/Documentation/stable_kernel_rules.txt | ||
80 | +++ b/Documentation/stable_kernel_rules.txt | ||
81 | @@ -81,6 +81,16 @@ format in the sign-off area: | ||
82 | git cherry-pick fd21073 | ||
83 | git cherry-pick <this commit> | ||
84 | |||
85 | +Also, some patches may have kernel version prerequisites. This can be | ||
86 | +specified in the following format in the sign-off area: | ||
87 | + | ||
88 | + Cc: <stable@vger.kernel.org> # 3.3.x- | ||
89 | + | ||
90 | + The tag has the meaning of: | ||
91 | + git cherry-pick <this commit> | ||
92 | + | ||
93 | + For each "-stable" tree starting with the specified version. | ||
94 | + | ||
95 | Following the submission: | ||
96 | |||
97 | - The sender will receive an ACK when the patch has been accepted into the | ||
98 | diff --git a/Makefile b/Makefile | ||
99 | index d84fdc6d02f4..95ee52f9432e 100644 | ||
100 | --- a/Makefile | ||
101 | +++ b/Makefile | ||
102 | @@ -1,6 +1,6 @@ | ||
103 | VERSION = 3 | ||
104 | PATCHLEVEL = 18 | ||
105 | -SUBLEVEL = 16 | ||
106 | +SUBLEVEL = 17 | ||
107 | EXTRAVERSION = | ||
108 | NAME = Diseased Newt | ||
109 | |||
110 | diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi | ||
111 | index e06c11fa8698..516d62ac25a9 100644 | ||
112 | --- a/arch/arm/boot/dts/r8a7791.dtsi | ||
113 | +++ b/arch/arm/boot/dts/r8a7791.dtsi | ||
114 | @@ -695,19 +695,19 @@ | ||
115 | }; | ||
116 | |||
117 | /* Variable factor clocks */ | ||
118 | - sd1_clk: sd2_clk@e6150078 { | ||
119 | + sd2_clk: sd2_clk@e6150078 { | ||
120 | compatible = "renesas,r8a7791-div6-clock", "renesas,cpg-div6-clock"; | ||
121 | reg = <0 0xe6150078 0 4>; | ||
122 | clocks = <&pll1_div2_clk>; | ||
123 | #clock-cells = <0>; | ||
124 | - clock-output-names = "sd1"; | ||
125 | + clock-output-names = "sd2"; | ||
126 | }; | ||
127 | - sd2_clk: sd3_clk@e615026c { | ||
128 | + sd3_clk: sd3_clk@e615026c { | ||
129 | compatible = "renesas,r8a7791-div6-clock", "renesas,cpg-div6-clock"; | ||
130 | reg = <0 0xe615026c 0 4>; | ||
131 | clocks = <&pll1_div2_clk>; | ||
132 | #clock-cells = <0>; | ||
133 | - clock-output-names = "sd2"; | ||
134 | + clock-output-names = "sd3"; | ||
135 | }; | ||
136 | mmc0_clk: mmc0_clk@e6150240 { | ||
137 | compatible = "renesas,r8a7791-div6-clock", "renesas,cpg-div6-clock"; | ||
138 | @@ -922,17 +922,20 @@ | ||
139 | mstp3_clks: mstp3_clks@e615013c { | ||
140 | compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks"; | ||
141 | reg = <0 0xe615013c 0 4>, <0 0xe6150048 0 4>; | ||
142 | - clocks = <&cp_clk>, <&sd2_clk>, <&sd1_clk>, <&cpg_clocks R8A7791_CLK_SD0>, | ||
143 | - <&mmc0_clk>, <&hp_clk>, <&mp_clk>, <&hp_clk>, <&mp_clk>, <&rclk_clk>; | ||
144 | + clocks = <&cp_clk>, <&sd3_clk>, <&sd2_clk>, <&cpg_clocks R8A7791_CLK_SD0>, | ||
145 | + <&mmc0_clk>, <&hp_clk>, <&mp_clk>, <&hp_clk>, <&mp_clk>, <&rclk_clk>, | ||
146 | + <&hp_clk>, <&hp_clk>; | ||
147 | #clock-cells = <1>; | ||
148 | renesas,clock-indices = < | ||
149 | R8A7791_CLK_TPU0 R8A7791_CLK_SDHI2 R8A7791_CLK_SDHI1 R8A7791_CLK_SDHI0 | ||
150 | R8A7791_CLK_MMCIF0 R8A7791_CLK_IIC0 R8A7791_CLK_PCIEC R8A7791_CLK_IIC1 | ||
151 | R8A7791_CLK_SSUSB R8A7791_CLK_CMT1 | ||
152 | + R8A7791_CLK_USBDMAC0 R8A7791_CLK_USBDMAC1 | ||
153 | >; | ||
154 | clock-output-names = | ||
155 | "tpu0", "sdhi2", "sdhi1", "sdhi0", | ||
156 | - "mmcif0", "i2c7", "pciec", "i2c8", "ssusb", "cmt1"; | ||
157 | + "mmcif0", "i2c7", "pciec", "i2c8", "ssusb", "cmt1", | ||
158 | + "usbdmac0", "usbdmac1"; | ||
159 | }; | ||
160 | mstp5_clks: mstp5_clks@e6150144 { | ||
161 | compatible = "renesas,r8a7791-mstp-clocks", "renesas,cpg-mstp-clocks"; | ||
162 | diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile | ||
163 | index 03120e656aea..2ecc7d15bc09 100644 | ||
164 | --- a/arch/arm/kernel/Makefile | ||
165 | +++ b/arch/arm/kernel/Makefile | ||
166 | @@ -84,6 +84,7 @@ obj-$(CONFIG_CPU_PJ4B) += pj4-cp0.o | ||
167 | obj-$(CONFIG_IWMMXT) += iwmmxt.o | ||
168 | obj-$(CONFIG_PERF_EVENTS) += perf_regs.o | ||
169 | obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o perf_event_cpu.o | ||
170 | +CFLAGS_pj4-cp0.o := -marm | ||
171 | AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt | ||
172 | obj-$(CONFIG_ARM_CPU_TOPOLOGY) += topology.o | ||
173 | |||
174 | diff --git a/arch/arm/kernel/iwmmxt.S b/arch/arm/kernel/iwmmxt.S | ||
175 | index ad58e565fe98..49fadbda8c63 100644 | ||
176 | --- a/arch/arm/kernel/iwmmxt.S | ||
177 | +++ b/arch/arm/kernel/iwmmxt.S | ||
178 | @@ -58,6 +58,7 @@ | ||
179 | #define MMX_SIZE (0x98) | ||
180 | |||
181 | .text | ||
182 | + .arm | ||
183 | |||
184 | /* | ||
185 | * Lazy switching of Concan coprocessor context | ||
186 | @@ -182,6 +183,8 @@ concan_load: | ||
187 | tmcr wCon, r2 | ||
188 | ret lr | ||
189 | |||
190 | +ENDPROC(iwmmxt_task_enable) | ||
191 | + | ||
192 | /* | ||
193 | * Back up Concan regs to save area and disable access to them | ||
194 | * (mainly for gdb or sleep mode usage) | ||
195 | @@ -232,6 +235,8 @@ ENTRY(iwmmxt_task_disable) | ||
196 | 1: msr cpsr_c, ip @ restore interrupt mode | ||
197 | ldmfd sp!, {r4, pc} | ||
198 | |||
199 | +ENDPROC(iwmmxt_task_disable) | ||
200 | + | ||
201 | /* | ||
202 | * Copy Concan state to given memory address | ||
203 | * | ||
204 | @@ -268,6 +273,8 @@ ENTRY(iwmmxt_task_copy) | ||
205 | msr cpsr_c, ip @ restore interrupt mode | ||
206 | ret r3 | ||
207 | |||
208 | +ENDPROC(iwmmxt_task_copy) | ||
209 | + | ||
210 | /* | ||
211 | * Restore Concan state from given memory address | ||
212 | * | ||
213 | @@ -304,6 +311,8 @@ ENTRY(iwmmxt_task_restore) | ||
214 | msr cpsr_c, ip @ restore interrupt mode | ||
215 | ret r3 | ||
216 | |||
217 | +ENDPROC(iwmmxt_task_restore) | ||
218 | + | ||
219 | /* | ||
220 | * Concan handling on task switch | ||
221 | * | ||
222 | @@ -335,6 +344,8 @@ ENTRY(iwmmxt_task_switch) | ||
223 | mrc p15, 0, r1, c2, c0, 0 | ||
224 | sub pc, lr, r1, lsr #32 @ cpwait and return | ||
225 | |||
226 | +ENDPROC(iwmmxt_task_switch) | ||
227 | + | ||
228 | /* | ||
229 | * Remove Concan ownership of given task | ||
230 | * | ||
231 | @@ -353,6 +364,8 @@ ENTRY(iwmmxt_task_release) | ||
232 | msr cpsr_c, r2 @ restore interrupts | ||
233 | ret lr | ||
234 | |||
235 | +ENDPROC(iwmmxt_task_release) | ||
236 | + | ||
237 | .data | ||
238 | concan_owner: | ||
239 | .word 0 | ||
240 | diff --git a/arch/arm/mach-shmobile/pm-r8a7790.c b/arch/arm/mach-shmobile/pm-r8a7790.c | ||
241 | index 80e8d95e54d3..23b61f170c22 100644 | ||
242 | --- a/arch/arm/mach-shmobile/pm-r8a7790.c | ||
243 | +++ b/arch/arm/mach-shmobile/pm-r8a7790.c | ||
244 | @@ -38,7 +38,7 @@ static void __init r8a7790_sysc_init(void) | ||
245 | void __iomem *base = rcar_sysc_init(0xe6180000); | ||
246 | |||
247 | /* enable all interrupt sources, but do not use interrupt handler */ | ||
248 | - iowrite32(0x0131000e, base + SYSCIER); | ||
249 | + iowrite32(0x013111ef, base + SYSCIER); | ||
250 | iowrite32(0, base + SYSCIMR); | ||
251 | } | ||
252 | |||
253 | diff --git a/arch/arm/mach-shmobile/pm-r8a7791.c b/arch/arm/mach-shmobile/pm-r8a7791.c | ||
254 | index 25f107bb3657..f7cfb3b72574 100644 | ||
255 | --- a/arch/arm/mach-shmobile/pm-r8a7791.c | ||
256 | +++ b/arch/arm/mach-shmobile/pm-r8a7791.c | ||
257 | @@ -33,7 +33,7 @@ static void __init r8a7791_sysc_init(void) | ||
258 | void __iomem *base = rcar_sysc_init(0xe6180000); | ||
259 | |||
260 | /* enable all interrupt sources, but do not use interrupt handler */ | ||
261 | - iowrite32(0x0131000e, base + SYSCIER); | ||
262 | + iowrite32(0x00111003, base + SYSCIER); | ||
263 | iowrite32(0, base + SYSCIMR); | ||
264 | } | ||
265 | |||
266 | diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c | ||
267 | index 1acf605a646d..3790a66d6898 100644 | ||
268 | --- a/arch/x86/boot/compressed/eboot.c | ||
269 | +++ b/arch/x86/boot/compressed/eboot.c | ||
270 | @@ -1110,6 +1110,8 @@ struct boot_params *make_boot_params(struct efi_config *c) | ||
271 | if (!cmdline_ptr) | ||
272 | goto fail; | ||
273 | hdr->cmd_line_ptr = (unsigned long)cmdline_ptr; | ||
274 | + /* Fill in upper bits of command line address, NOP on 32 bit */ | ||
275 | + boot_params->ext_cmd_line_ptr = (u64)(unsigned long)cmdline_ptr >> 32; | ||
276 | |||
277 | hdr->ramdisk_image = 0; | ||
278 | hdr->ramdisk_size = 0; | ||
279 | diff --git a/arch/x86/include/asm/iommu_table.h b/arch/x86/include/asm/iommu_table.h | ||
280 | index f42a04735a0a..e37d6b3ad983 100644 | ||
281 | --- a/arch/x86/include/asm/iommu_table.h | ||
282 | +++ b/arch/x86/include/asm/iommu_table.h | ||
283 | @@ -79,11 +79,12 @@ struct iommu_table_entry { | ||
284 | * d). Similar to the 'init', except that this gets called from pci_iommu_init | ||
285 | * where we do have a memory allocator. | ||
286 | * | ||
287 | - * The standard vs the _FINISH differs in that the _FINISH variant will | ||
288 | - * continue detecting other IOMMUs in the call list after the | ||
289 | - * the detection routine returns a positive number. The _FINISH will | ||
290 | - * stop the execution chain. Both will still call the 'init' and | ||
291 | - * 'late_init' functions if they are set. | ||
292 | + * The standard IOMMU_INIT differs from the IOMMU_INIT_FINISH variant | ||
293 | + * in that the former will continue detecting other IOMMUs in the call | ||
294 | + * list after the detection routine returns a positive number, while the | ||
295 | + * latter will stop the execution chain upon first successful detection. | ||
296 | + * Both variants will still call the 'init' and 'late_init' functions if | ||
297 | + * they are set. | ||
298 | */ | ||
299 | #define IOMMU_INIT_FINISH(_detect, _depend, _init, _late_init) \ | ||
300 | __IOMMU_INIT(_detect, _depend, _init, _late_init, 1) | ||
301 | diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h | ||
302 | index cd6e1610e29e..a9d76e02301b 100644 | ||
303 | --- a/arch/x86/include/asm/paravirt.h | ||
304 | +++ b/arch/x86/include/asm/paravirt.h | ||
305 | @@ -80,16 +80,16 @@ static inline void write_cr3(unsigned long x) | ||
306 | PVOP_VCALL1(pv_mmu_ops.write_cr3, x); | ||
307 | } | ||
308 | |||
309 | -static inline unsigned long read_cr4(void) | ||
310 | +static inline unsigned long __read_cr4(void) | ||
311 | { | ||
312 | return PVOP_CALL0(unsigned long, pv_cpu_ops.read_cr4); | ||
313 | } | ||
314 | -static inline unsigned long read_cr4_safe(void) | ||
315 | +static inline unsigned long __read_cr4_safe(void) | ||
316 | { | ||
317 | return PVOP_CALL0(unsigned long, pv_cpu_ops.read_cr4_safe); | ||
318 | } | ||
319 | |||
320 | -static inline void write_cr4(unsigned long x) | ||
321 | +static inline void __write_cr4(unsigned long x) | ||
322 | { | ||
323 | PVOP_VCALL1(pv_cpu_ops.write_cr4, x); | ||
324 | } | ||
325 | diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h | ||
326 | index eb71ec794732..ddd8d13a010f 100644 | ||
327 | --- a/arch/x86/include/asm/processor.h | ||
328 | +++ b/arch/x86/include/asm/processor.h | ||
329 | @@ -578,39 +578,6 @@ static inline void load_sp0(struct tss_struct *tss, | ||
330 | #define set_iopl_mask native_set_iopl_mask | ||
331 | #endif /* CONFIG_PARAVIRT */ | ||
332 | |||
333 | -/* | ||
334 | - * Save the cr4 feature set we're using (ie | ||
335 | - * Pentium 4MB enable and PPro Global page | ||
336 | - * enable), so that any CPU's that boot up | ||
337 | - * after us can get the correct flags. | ||
338 | - */ | ||
339 | -extern unsigned long mmu_cr4_features; | ||
340 | -extern u32 *trampoline_cr4_features; | ||
341 | - | ||
342 | -static inline void set_in_cr4(unsigned long mask) | ||
343 | -{ | ||
344 | - unsigned long cr4; | ||
345 | - | ||
346 | - mmu_cr4_features |= mask; | ||
347 | - if (trampoline_cr4_features) | ||
348 | - *trampoline_cr4_features = mmu_cr4_features; | ||
349 | - cr4 = read_cr4(); | ||
350 | - cr4 |= mask; | ||
351 | - write_cr4(cr4); | ||
352 | -} | ||
353 | - | ||
354 | -static inline void clear_in_cr4(unsigned long mask) | ||
355 | -{ | ||
356 | - unsigned long cr4; | ||
357 | - | ||
358 | - mmu_cr4_features &= ~mask; | ||
359 | - if (trampoline_cr4_features) | ||
360 | - *trampoline_cr4_features = mmu_cr4_features; | ||
361 | - cr4 = read_cr4(); | ||
362 | - cr4 &= ~mask; | ||
363 | - write_cr4(cr4); | ||
364 | -} | ||
365 | - | ||
366 | typedef struct { | ||
367 | unsigned long seg; | ||
368 | } mm_segment_t; | ||
369 | diff --git a/arch/x86/include/asm/special_insns.h b/arch/x86/include/asm/special_insns.h | ||
370 | index e820c080a4e9..6a4b00fafb00 100644 | ||
371 | --- a/arch/x86/include/asm/special_insns.h | ||
372 | +++ b/arch/x86/include/asm/special_insns.h | ||
373 | @@ -137,17 +137,17 @@ static inline void write_cr3(unsigned long x) | ||
374 | native_write_cr3(x); | ||
375 | } | ||
376 | |||
377 | -static inline unsigned long read_cr4(void) | ||
378 | +static inline unsigned long __read_cr4(void) | ||
379 | { | ||
380 | return native_read_cr4(); | ||
381 | } | ||
382 | |||
383 | -static inline unsigned long read_cr4_safe(void) | ||
384 | +static inline unsigned long __read_cr4_safe(void) | ||
385 | { | ||
386 | return native_read_cr4_safe(); | ||
387 | } | ||
388 | |||
389 | -static inline void write_cr4(unsigned long x) | ||
390 | +static inline void __write_cr4(unsigned long x) | ||
391 | { | ||
392 | native_write_cr4(x); | ||
393 | } | ||
394 | diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h | ||
395 | index 04905bfc508b..cd791948b286 100644 | ||
396 | --- a/arch/x86/include/asm/tlbflush.h | ||
397 | +++ b/arch/x86/include/asm/tlbflush.h | ||
398 | @@ -15,6 +15,75 @@ | ||
399 | #define __flush_tlb_single(addr) __native_flush_tlb_single(addr) | ||
400 | #endif | ||
401 | |||
402 | +struct tlb_state { | ||
403 | +#ifdef CONFIG_SMP | ||
404 | + struct mm_struct *active_mm; | ||
405 | + int state; | ||
406 | +#endif | ||
407 | + | ||
408 | + /* | ||
409 | + * Access to this CR4 shadow and to H/W CR4 is protected by | ||
410 | + * disabling interrupts when modifying either one. | ||
411 | + */ | ||
412 | + unsigned long cr4; | ||
413 | +}; | ||
414 | +DECLARE_PER_CPU_SHARED_ALIGNED(struct tlb_state, cpu_tlbstate); | ||
415 | + | ||
416 | +/* Initialize cr4 shadow for this CPU. */ | ||
417 | +static inline void cr4_init_shadow(void) | ||
418 | +{ | ||
419 | + this_cpu_write(cpu_tlbstate.cr4, __read_cr4()); | ||
420 | +} | ||
421 | + | ||
422 | +/* Set in this cpu's CR4. */ | ||
423 | +static inline void cr4_set_bits(unsigned long mask) | ||
424 | +{ | ||
425 | + unsigned long cr4; | ||
426 | + | ||
427 | + cr4 = this_cpu_read(cpu_tlbstate.cr4); | ||
428 | + if ((cr4 | mask) != cr4) { | ||
429 | + cr4 |= mask; | ||
430 | + this_cpu_write(cpu_tlbstate.cr4, cr4); | ||
431 | + __write_cr4(cr4); | ||
432 | + } | ||
433 | +} | ||
434 | + | ||
435 | +/* Clear in this cpu's CR4. */ | ||
436 | +static inline void cr4_clear_bits(unsigned long mask) | ||
437 | +{ | ||
438 | + unsigned long cr4; | ||
439 | + | ||
440 | + cr4 = this_cpu_read(cpu_tlbstate.cr4); | ||
441 | + if ((cr4 & ~mask) != cr4) { | ||
442 | + cr4 &= ~mask; | ||
443 | + this_cpu_write(cpu_tlbstate.cr4, cr4); | ||
444 | + __write_cr4(cr4); | ||
445 | + } | ||
446 | +} | ||
447 | + | ||
448 | +/* Read the CR4 shadow. */ | ||
449 | +static inline unsigned long cr4_read_shadow(void) | ||
450 | +{ | ||
451 | + return this_cpu_read(cpu_tlbstate.cr4); | ||
452 | +} | ||
453 | + | ||
454 | +/* | ||
455 | + * Save some of cr4 feature set we're using (e.g. Pentium 4MB | ||
456 | + * enable and PPro Global page enable), so that any CPU's that boot | ||
457 | + * up after us can get the correct flags. This should only be used | ||
458 | + * during boot on the boot cpu. | ||
459 | + */ | ||
460 | +extern unsigned long mmu_cr4_features; | ||
461 | +extern u32 *trampoline_cr4_features; | ||
462 | + | ||
463 | +static inline void cr4_set_bits_and_update_boot(unsigned long mask) | ||
464 | +{ | ||
465 | + mmu_cr4_features |= mask; | ||
466 | + if (trampoline_cr4_features) | ||
467 | + *trampoline_cr4_features = mmu_cr4_features; | ||
468 | + cr4_set_bits(mask); | ||
469 | +} | ||
470 | + | ||
471 | static inline void __native_flush_tlb(void) | ||
472 | { | ||
473 | native_write_cr3(native_read_cr3()); | ||
474 | @@ -24,7 +93,7 @@ static inline void __native_flush_tlb_global_irq_disabled(void) | ||
475 | { | ||
476 | unsigned long cr4; | ||
477 | |||
478 | - cr4 = native_read_cr4(); | ||
479 | + cr4 = this_cpu_read(cpu_tlbstate.cr4); | ||
480 | /* clear PGE */ | ||
481 | native_write_cr4(cr4 & ~X86_CR4_PGE); | ||
482 | /* write old PGE again and flush TLBs */ | ||
483 | @@ -184,12 +253,6 @@ void native_flush_tlb_others(const struct cpumask *cpumask, | ||
484 | #define TLBSTATE_OK 1 | ||
485 | #define TLBSTATE_LAZY 2 | ||
486 | |||
487 | -struct tlb_state { | ||
488 | - struct mm_struct *active_mm; | ||
489 | - int state; | ||
490 | -}; | ||
491 | -DECLARE_PER_CPU_SHARED_ALIGNED(struct tlb_state, cpu_tlbstate); | ||
492 | - | ||
493 | static inline void reset_lazy_tlbstate(void) | ||
494 | { | ||
495 | this_cpu_write(cpu_tlbstate.state, 0); | ||
496 | diff --git a/arch/x86/include/asm/virtext.h b/arch/x86/include/asm/virtext.h | ||
497 | index 5da71c27cc59..cce9ee68e335 100644 | ||
498 | --- a/arch/x86/include/asm/virtext.h | ||
499 | +++ b/arch/x86/include/asm/virtext.h | ||
500 | @@ -19,6 +19,7 @@ | ||
501 | |||
502 | #include <asm/vmx.h> | ||
503 | #include <asm/svm.h> | ||
504 | +#include <asm/tlbflush.h> | ||
505 | |||
506 | /* | ||
507 | * VMX functions: | ||
508 | @@ -40,12 +41,12 @@ static inline int cpu_has_vmx(void) | ||
509 | static inline void cpu_vmxoff(void) | ||
510 | { | ||
511 | asm volatile (ASM_VMX_VMXOFF : : : "cc"); | ||
512 | - write_cr4(read_cr4() & ~X86_CR4_VMXE); | ||
513 | + cr4_clear_bits(X86_CR4_VMXE); | ||
514 | } | ||
515 | |||
516 | static inline int cpu_vmx_enabled(void) | ||
517 | { | ||
518 | - return read_cr4() & X86_CR4_VMXE; | ||
519 | + return __read_cr4() & X86_CR4_VMXE; | ||
520 | } | ||
521 | |||
522 | /** Disable VMX if it is enabled on the current CPU | ||
523 | diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c | ||
524 | index 31368207837c..d1daead5fcdd 100644 | ||
525 | --- a/arch/x86/kernel/acpi/sleep.c | ||
526 | +++ b/arch/x86/kernel/acpi/sleep.c | ||
527 | @@ -78,7 +78,7 @@ int x86_acpi_suspend_lowlevel(void) | ||
528 | |||
529 | header->pmode_cr0 = read_cr0(); | ||
530 | if (__this_cpu_read(cpu_info.cpuid_level) >= 0) { | ||
531 | - header->pmode_cr4 = read_cr4(); | ||
532 | + header->pmode_cr4 = __read_cr4(); | ||
533 | header->pmode_behavior |= (1 << WAKEUP_BEHAVIOR_RESTORE_CR4); | ||
534 | } | ||
535 | if (!rdmsr_safe(MSR_IA32_MISC_ENABLE, | ||
536 | diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c | ||
537 | index cfa9b5b2c27a..7bc49c3b9684 100644 | ||
538 | --- a/arch/x86/kernel/cpu/common.c | ||
539 | +++ b/arch/x86/kernel/cpu/common.c | ||
540 | @@ -19,6 +19,7 @@ | ||
541 | #include <asm/archrandom.h> | ||
542 | #include <asm/hypervisor.h> | ||
543 | #include <asm/processor.h> | ||
544 | +#include <asm/tlbflush.h> | ||
545 | #include <asm/debugreg.h> | ||
546 | #include <asm/sections.h> | ||
547 | #include <asm/vsyscall.h> | ||
548 | @@ -278,7 +279,7 @@ __setup("nosmep", setup_disable_smep); | ||
549 | static __always_inline void setup_smep(struct cpuinfo_x86 *c) | ||
550 | { | ||
551 | if (cpu_has(c, X86_FEATURE_SMEP)) | ||
552 | - set_in_cr4(X86_CR4_SMEP); | ||
553 | + cr4_set_bits(X86_CR4_SMEP); | ||
554 | } | ||
555 | |||
556 | static __init int setup_disable_smap(char *arg) | ||
557 | @@ -298,9 +299,9 @@ static __always_inline void setup_smap(struct cpuinfo_x86 *c) | ||
558 | |||
559 | if (cpu_has(c, X86_FEATURE_SMAP)) { | ||
560 | #ifdef CONFIG_X86_SMAP | ||
561 | - set_in_cr4(X86_CR4_SMAP); | ||
562 | + cr4_set_bits(X86_CR4_SMAP); | ||
563 | #else | ||
564 | - clear_in_cr4(X86_CR4_SMAP); | ||
565 | + cr4_clear_bits(X86_CR4_SMAP); | ||
566 | #endif | ||
567 | } | ||
568 | } | ||
569 | @@ -1304,6 +1305,12 @@ void cpu_init(void) | ||
570 | wait_for_master_cpu(cpu); | ||
571 | |||
572 | /* | ||
573 | + * Initialize the CR4 shadow before doing anything that could | ||
574 | + * try to read it. | ||
575 | + */ | ||
576 | + cr4_init_shadow(); | ||
577 | + | ||
578 | + /* | ||
579 | * Load microcode on this cpu if a valid microcode is available. | ||
580 | * This is early microcode loading procedure. | ||
581 | */ | ||
582 | @@ -1322,7 +1329,7 @@ void cpu_init(void) | ||
583 | |||
584 | pr_debug("Initializing CPU#%d\n", cpu); | ||
585 | |||
586 | - clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE); | ||
587 | + cr4_clear_bits(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE); | ||
588 | |||
589 | /* | ||
590 | * Initialize the per-CPU GDT with the boot GDT, | ||
591 | @@ -1403,7 +1410,7 @@ void cpu_init(void) | ||
592 | printk(KERN_INFO "Initializing CPU#%d\n", cpu); | ||
593 | |||
594 | if (cpu_feature_enabled(X86_FEATURE_VME) || cpu_has_tsc || cpu_has_de) | ||
595 | - clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE); | ||
596 | + cr4_clear_bits(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE); | ||
597 | |||
598 | load_current_idt(); | ||
599 | switch_to_new_gdt(cpu); | ||
600 | diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c | ||
601 | index b5c2276317e2..bf44e45a2a76 100644 | ||
602 | --- a/arch/x86/kernel/cpu/mcheck/mce.c | ||
603 | +++ b/arch/x86/kernel/cpu/mcheck/mce.c | ||
604 | @@ -43,6 +43,7 @@ | ||
605 | #include <linux/export.h> | ||
606 | |||
607 | #include <asm/processor.h> | ||
608 | +#include <asm/tlbflush.h> | ||
609 | #include <asm/mce.h> | ||
610 | #include <asm/msr.h> | ||
611 | |||
612 | @@ -1460,7 +1461,7 @@ static void __mcheck_cpu_init_generic(void) | ||
613 | bitmap_fill(all_banks, MAX_NR_BANKS); | ||
614 | machine_check_poll(MCP_UC | m_fl, &all_banks); | ||
615 | |||
616 | - set_in_cr4(X86_CR4_MCE); | ||
617 | + cr4_set_bits(X86_CR4_MCE); | ||
618 | |||
619 | rdmsrl(MSR_IA32_MCG_CAP, cap); | ||
620 | if (cap & MCG_CTL_P) | ||
621 | diff --git a/arch/x86/kernel/cpu/mcheck/p5.c b/arch/x86/kernel/cpu/mcheck/p5.c | ||
622 | index a3042989398c..30692ac88d1e 100644 | ||
623 | --- a/arch/x86/kernel/cpu/mcheck/p5.c | ||
624 | +++ b/arch/x86/kernel/cpu/mcheck/p5.c | ||
625 | @@ -8,6 +8,7 @@ | ||
626 | #include <linux/smp.h> | ||
627 | |||
628 | #include <asm/processor.h> | ||
629 | +#include <asm/tlbflush.h> | ||
630 | #include <asm/mce.h> | ||
631 | #include <asm/msr.h> | ||
632 | |||
633 | @@ -59,7 +60,7 @@ void intel_p5_mcheck_init(struct cpuinfo_x86 *c) | ||
634 | "Intel old style machine check architecture supported.\n"); | ||
635 | |||
636 | /* Enable MCE: */ | ||
637 | - set_in_cr4(X86_CR4_MCE); | ||
638 | + cr4_set_bits(X86_CR4_MCE); | ||
639 | printk(KERN_INFO | ||
640 | "Intel old style machine check reporting enabled on CPU#%d.\n", | ||
641 | smp_processor_id()); | ||
642 | diff --git a/arch/x86/kernel/cpu/mcheck/winchip.c b/arch/x86/kernel/cpu/mcheck/winchip.c | ||
643 | index 7dc5564d0cdf..590cc753ba8f 100644 | ||
644 | --- a/arch/x86/kernel/cpu/mcheck/winchip.c | ||
645 | +++ b/arch/x86/kernel/cpu/mcheck/winchip.c | ||
646 | @@ -7,6 +7,7 @@ | ||
647 | #include <linux/types.h> | ||
648 | |||
649 | #include <asm/processor.h> | ||
650 | +#include <asm/tlbflush.h> | ||
651 | #include <asm/mce.h> | ||
652 | #include <asm/msr.h> | ||
653 | |||
654 | @@ -31,7 +32,7 @@ void winchip_mcheck_init(struct cpuinfo_x86 *c) | ||
655 | lo &= ~(1<<4); /* Enable MCE */ | ||
656 | wrmsr(MSR_IDT_FCR1, lo, hi); | ||
657 | |||
658 | - set_in_cr4(X86_CR4_MCE); | ||
659 | + cr4_set_bits(X86_CR4_MCE); | ||
660 | |||
661 | printk(KERN_INFO | ||
662 | "Winchip machine check reporting enabled on CPU#0.\n"); | ||
663 | diff --git a/arch/x86/kernel/cpu/mtrr/cyrix.c b/arch/x86/kernel/cpu/mtrr/cyrix.c | ||
664 | index 9e451b0876b5..f8c81ba0b465 100644 | ||
665 | --- a/arch/x86/kernel/cpu/mtrr/cyrix.c | ||
666 | +++ b/arch/x86/kernel/cpu/mtrr/cyrix.c | ||
667 | @@ -138,8 +138,8 @@ static void prepare_set(void) | ||
668 | |||
669 | /* Save value of CR4 and clear Page Global Enable (bit 7) */ | ||
670 | if (cpu_has_pge) { | ||
671 | - cr4 = read_cr4(); | ||
672 | - write_cr4(cr4 & ~X86_CR4_PGE); | ||
673 | + cr4 = __read_cr4(); | ||
674 | + __write_cr4(cr4 & ~X86_CR4_PGE); | ||
675 | } | ||
676 | |||
677 | /* | ||
678 | @@ -171,7 +171,7 @@ static void post_set(void) | ||
679 | |||
680 | /* Restore value of CR4 */ | ||
681 | if (cpu_has_pge) | ||
682 | - write_cr4(cr4); | ||
683 | + __write_cr4(cr4); | ||
684 | } | ||
685 | |||
686 | static void cyrix_set_arr(unsigned int reg, unsigned long base, | ||
687 | diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c | ||
688 | index 0e25a1bc5ab5..7d74f7b3c6ba 100644 | ||
689 | --- a/arch/x86/kernel/cpu/mtrr/generic.c | ||
690 | +++ b/arch/x86/kernel/cpu/mtrr/generic.c | ||
691 | @@ -678,8 +678,8 @@ static void prepare_set(void) __acquires(set_atomicity_lock) | ||
692 | |||
693 | /* Save value of CR4 and clear Page Global Enable (bit 7) */ | ||
694 | if (cpu_has_pge) { | ||
695 | - cr4 = read_cr4(); | ||
696 | - write_cr4(cr4 & ~X86_CR4_PGE); | ||
697 | + cr4 = __read_cr4(); | ||
698 | + __write_cr4(cr4 & ~X86_CR4_PGE); | ||
699 | } | ||
700 | |||
701 | /* Flush all TLBs via a mov %cr3, %reg; mov %reg, %cr3 */ | ||
702 | @@ -708,7 +708,7 @@ static void post_set(void) __releases(set_atomicity_lock) | ||
703 | |||
704 | /* Restore value of CR4 */ | ||
705 | if (cpu_has_pge) | ||
706 | - write_cr4(cr4); | ||
707 | + __write_cr4(cr4); | ||
708 | raw_spin_unlock(&set_atomicity_lock); | ||
709 | } | ||
710 | |||
711 | diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c | ||
712 | index 143e5f5dc855..6b5acd5f4a34 100644 | ||
713 | --- a/arch/x86/kernel/cpu/perf_event.c | ||
714 | +++ b/arch/x86/kernel/cpu/perf_event.c | ||
715 | @@ -31,6 +31,7 @@ | ||
716 | #include <asm/nmi.h> | ||
717 | #include <asm/smp.h> | ||
718 | #include <asm/alternative.h> | ||
719 | +#include <asm/tlbflush.h> | ||
720 | #include <asm/timer.h> | ||
721 | #include <asm/desc.h> | ||
722 | #include <asm/ldt.h> | ||
723 | @@ -1328,7 +1329,7 @@ x86_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu) | ||
724 | |||
725 | case CPU_STARTING: | ||
726 | if (x86_pmu.attr_rdpmc) | ||
727 | - set_in_cr4(X86_CR4_PCE); | ||
728 | + cr4_set_bits(X86_CR4_PCE); | ||
729 | if (x86_pmu.cpu_starting) | ||
730 | x86_pmu.cpu_starting(cpu); | ||
731 | break; | ||
732 | @@ -1834,9 +1835,9 @@ static void change_rdpmc(void *info) | ||
733 | bool enable = !!(unsigned long)info; | ||
734 | |||
735 | if (enable) | ||
736 | - set_in_cr4(X86_CR4_PCE); | ||
737 | + cr4_set_bits(X86_CR4_PCE); | ||
738 | else | ||
739 | - clear_in_cr4(X86_CR4_PCE); | ||
740 | + cr4_clear_bits(X86_CR4_PCE); | ||
741 | } | ||
742 | |||
743 | static ssize_t set_attr_rdpmc(struct device *cdev, | ||
744 | diff --git a/arch/x86/kernel/head32.c b/arch/x86/kernel/head32.c | ||
745 | index d6c1b9836995..2911ef3a9f1c 100644 | ||
746 | --- a/arch/x86/kernel/head32.c | ||
747 | +++ b/arch/x86/kernel/head32.c | ||
748 | @@ -31,6 +31,7 @@ static void __init i386_default_early_setup(void) | ||
749 | |||
750 | asmlinkage __visible void __init i386_start_kernel(void) | ||
751 | { | ||
752 | + cr4_init_shadow(); | ||
753 | sanitize_boot_params(&boot_params); | ||
754 | |||
755 | /* Call the subarch specific early setup function */ | ||
756 | diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c | ||
757 | index eda1a865641e..3b241f0ca005 100644 | ||
758 | --- a/arch/x86/kernel/head64.c | ||
759 | +++ b/arch/x86/kernel/head64.c | ||
760 | @@ -155,6 +155,8 @@ asmlinkage __visible void __init x86_64_start_kernel(char * real_mode_data) | ||
761 | (__START_KERNEL & PGDIR_MASK))); | ||
762 | BUILD_BUG_ON(__fix_to_virt(__end_of_fixed_addresses) <= MODULES_END); | ||
763 | |||
764 | + cr4_init_shadow(); | ||
765 | + | ||
766 | /* Kill off the identity-map trampoline */ | ||
767 | reset_early_page_tables(); | ||
768 | |||
769 | diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c | ||
770 | index ae0fdc86b7b6..8d6e954db2a7 100644 | ||
771 | --- a/arch/x86/kernel/i387.c | ||
772 | +++ b/arch/x86/kernel/i387.c | ||
773 | @@ -13,6 +13,7 @@ | ||
774 | #include <asm/sigcontext.h> | ||
775 | #include <asm/processor.h> | ||
776 | #include <asm/math_emu.h> | ||
777 | +#include <asm/tlbflush.h> | ||
778 | #include <asm/uaccess.h> | ||
779 | #include <asm/ptrace.h> | ||
780 | #include <asm/i387.h> | ||
781 | @@ -195,7 +196,7 @@ void fpu_init(void) | ||
782 | if (cpu_has_xmm) | ||
783 | cr4_mask |= X86_CR4_OSXMMEXCPT; | ||
784 | if (cr4_mask) | ||
785 | - set_in_cr4(cr4_mask); | ||
786 | + cr4_set_bits(cr4_mask); | ||
787 | |||
788 | cr0 = read_cr0(); | ||
789 | cr0 &= ~(X86_CR0_TS|X86_CR0_EM); /* clear TS and EM */ | ||
790 | diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c | ||
791 | index 6ad8a6396b75..a388bb883128 100644 | ||
792 | --- a/arch/x86/kernel/process.c | ||
793 | +++ b/arch/x86/kernel/process.c | ||
794 | @@ -29,6 +29,7 @@ | ||
795 | #include <asm/fpu-internal.h> | ||
796 | #include <asm/debugreg.h> | ||
797 | #include <asm/nmi.h> | ||
798 | +#include <asm/tlbflush.h> | ||
799 | |||
800 | /* | ||
801 | * per-CPU TSS segments. Threads are completely 'soft' on Linux, | ||
802 | @@ -142,7 +143,7 @@ void flush_thread(void) | ||
803 | |||
804 | static void hard_disable_TSC(void) | ||
805 | { | ||
806 | - write_cr4(read_cr4() | X86_CR4_TSD); | ||
807 | + cr4_set_bits(X86_CR4_TSD); | ||
808 | } | ||
809 | |||
810 | void disable_TSC(void) | ||
811 | @@ -159,7 +160,7 @@ void disable_TSC(void) | ||
812 | |||
813 | static void hard_enable_TSC(void) | ||
814 | { | ||
815 | - write_cr4(read_cr4() & ~X86_CR4_TSD); | ||
816 | + cr4_clear_bits(X86_CR4_TSD); | ||
817 | } | ||
818 | |||
819 | static void enable_TSC(void) | ||
820 | diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c | ||
821 | index 8f3ebfe710d0..603c4f99cb5a 100644 | ||
822 | --- a/arch/x86/kernel/process_32.c | ||
823 | +++ b/arch/x86/kernel/process_32.c | ||
824 | @@ -101,7 +101,7 @@ void __show_regs(struct pt_regs *regs, int all) | ||
825 | cr0 = read_cr0(); | ||
826 | cr2 = read_cr2(); | ||
827 | cr3 = read_cr3(); | ||
828 | - cr4 = read_cr4_safe(); | ||
829 | + cr4 = __read_cr4_safe(); | ||
830 | printk(KERN_DEFAULT "CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", | ||
831 | cr0, cr2, cr3, cr4); | ||
832 | |||
833 | diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c | ||
834 | index 5a2c02913af3..67fcc43577d2 100644 | ||
835 | --- a/arch/x86/kernel/process_64.c | ||
836 | +++ b/arch/x86/kernel/process_64.c | ||
837 | @@ -93,7 +93,7 @@ void __show_regs(struct pt_regs *regs, int all) | ||
838 | cr0 = read_cr0(); | ||
839 | cr2 = read_cr2(); | ||
840 | cr3 = read_cr3(); | ||
841 | - cr4 = read_cr4(); | ||
842 | + cr4 = __read_cr4(); | ||
843 | |||
844 | printk(KERN_DEFAULT "FS: %016lx(%04x) GS:%016lx(%04x) knlGS:%016lx\n", | ||
845 | fs, fsindex, gs, gsindex, shadowgs); | ||
846 | diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c | ||
847 | index ab08aa2276fb..87b6496a32f1 100644 | ||
848 | --- a/arch/x86/kernel/setup.c | ||
849 | +++ b/arch/x86/kernel/setup.c | ||
850 | @@ -1176,7 +1176,7 @@ void __init setup_arch(char **cmdline_p) | ||
851 | |||
852 | if (boot_cpu_data.cpuid_level >= 0) { | ||
853 | /* A CPU has %cr4 if and only if it has CPUID */ | ||
854 | - mmu_cr4_features = read_cr4(); | ||
855 | + mmu_cr4_features = __read_cr4(); | ||
856 | if (trampoline_cr4_features) | ||
857 | *trampoline_cr4_features = mmu_cr4_features; | ||
858 | } | ||
859 | diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c | ||
860 | index 8be1e1711203..cdc6cf903078 100644 | ||
861 | --- a/arch/x86/kernel/xsave.c | ||
862 | +++ b/arch/x86/kernel/xsave.c | ||
863 | @@ -12,6 +12,7 @@ | ||
864 | #include <asm/i387.h> | ||
865 | #include <asm/fpu-internal.h> | ||
866 | #include <asm/sigframe.h> | ||
867 | +#include <asm/tlbflush.h> | ||
868 | #include <asm/xcr.h> | ||
869 | |||
870 | /* | ||
871 | @@ -454,7 +455,7 @@ static void prepare_fx_sw_frame(void) | ||
872 | */ | ||
873 | static inline void xstate_enable(void) | ||
874 | { | ||
875 | - set_in_cr4(X86_CR4_OSXSAVE); | ||
876 | + cr4_set_bits(X86_CR4_OSXSAVE); | ||
877 | xsetbv(XCR_XFEATURE_ENABLED_MASK, pcntxt_mask); | ||
878 | } | ||
879 | |||
880 | diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c | ||
881 | index f7eaee1cbc54..170e7d49ba65 100644 | ||
882 | --- a/arch/x86/kvm/svm.c | ||
883 | +++ b/arch/x86/kvm/svm.c | ||
884 | @@ -1581,7 +1581,7 @@ static void svm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) | ||
885 | |||
886 | static int svm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) | ||
887 | { | ||
888 | - unsigned long host_cr4_mce = read_cr4() & X86_CR4_MCE; | ||
889 | + unsigned long host_cr4_mce = cr4_read_shadow() & X86_CR4_MCE; | ||
890 | unsigned long old_cr4 = to_svm(vcpu)->vmcb->save.cr4; | ||
891 | |||
892 | if (cr4 & X86_CR4_VMXE) | ||
893 | diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c | ||
894 | index 54bda28e6a12..0d7f1dcfcdac 100644 | ||
895 | --- a/arch/x86/kvm/vmx.c | ||
896 | +++ b/arch/x86/kvm/vmx.c | ||
897 | @@ -2744,7 +2744,7 @@ static int hardware_enable(void) | ||
898 | u64 phys_addr = __pa(per_cpu(vmxarea, cpu)); | ||
899 | u64 old, test_bits; | ||
900 | |||
901 | - if (read_cr4() & X86_CR4_VMXE) | ||
902 | + if (cr4_read_shadow() & X86_CR4_VMXE) | ||
903 | return -EBUSY; | ||
904 | |||
905 | INIT_LIST_HEAD(&per_cpu(loaded_vmcss_on_cpu, cpu)); | ||
906 | @@ -2771,7 +2771,7 @@ static int hardware_enable(void) | ||
907 | /* enable and lock */ | ||
908 | wrmsrl(MSR_IA32_FEATURE_CONTROL, old | test_bits); | ||
909 | } | ||
910 | - write_cr4(read_cr4() | X86_CR4_VMXE); /* FIXME: not cpu hotplug safe */ | ||
911 | + cr4_set_bits(X86_CR4_VMXE); | ||
912 | |||
913 | if (vmm_exclusive) { | ||
914 | kvm_cpu_vmxon(phys_addr); | ||
915 | @@ -2808,7 +2808,7 @@ static void hardware_disable(void) | ||
916 | vmclear_local_loaded_vmcss(); | ||
917 | kvm_cpu_vmxoff(); | ||
918 | } | ||
919 | - write_cr4(read_cr4() & ~X86_CR4_VMXE); | ||
920 | + cr4_clear_bits(X86_CR4_VMXE); | ||
921 | } | ||
922 | |||
923 | static __init int adjust_vmx_controls(u32 ctl_min, u32 ctl_opt, | ||
924 | @@ -3553,8 +3553,16 @@ static void vmx_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3) | ||
925 | |||
926 | static int vmx_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) | ||
927 | { | ||
928 | - unsigned long hw_cr4 = cr4 | (to_vmx(vcpu)->rmode.vm86_active ? | ||
929 | - KVM_RMODE_VM_CR4_ALWAYS_ON : KVM_PMODE_VM_CR4_ALWAYS_ON); | ||
930 | + /* | ||
931 | + * Pass through host's Machine Check Enable value to hw_cr4, which | ||
932 | + * is in force while we are in guest mode. Do not let guests control | ||
933 | + * this bit, even if host CR4.MCE == 0. | ||
934 | + */ | ||
935 | + unsigned long hw_cr4 = | ||
936 | + (cr4_read_shadow() & X86_CR4_MCE) | | ||
937 | + (cr4 & ~X86_CR4_MCE) | | ||
938 | + (to_vmx(vcpu)->rmode.vm86_active ? | ||
939 | + KVM_RMODE_VM_CR4_ALWAYS_ON : KVM_PMODE_VM_CR4_ALWAYS_ON); | ||
940 | |||
941 | if (cr4 & X86_CR4_VMXE) { | ||
942 | /* | ||
943 | @@ -4280,7 +4288,7 @@ static void vmx_set_constant_host_state(struct vcpu_vmx *vmx) | ||
944 | vmcs_writel(HOST_CR3, read_cr3()); /* 22.2.3 FIXME: shadow tables */ | ||
945 | |||
946 | /* Save the most likely value for this task's CR4 in the VMCS. */ | ||
947 | - cr4 = read_cr4(); | ||
948 | + cr4 = cr4_read_shadow(); | ||
949 | vmcs_writel(HOST_CR4, cr4); /* 22.2.3, 22.2.5 */ | ||
950 | vmx->host_state.vmcs_host_cr4 = cr4; | ||
951 | |||
952 | @@ -7563,7 +7571,7 @@ static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu) | ||
953 | if (test_bit(VCPU_REGS_RIP, (unsigned long *)&vcpu->arch.regs_dirty)) | ||
954 | vmcs_writel(GUEST_RIP, vcpu->arch.regs[VCPU_REGS_RIP]); | ||
955 | |||
956 | - cr4 = read_cr4(); | ||
957 | + cr4 = cr4_read_shadow(); | ||
958 | if (unlikely(cr4 != vmx->host_state.vmcs_host_cr4)) { | ||
959 | vmcs_writel(HOST_CR4, cr4); | ||
960 | vmx->host_state.vmcs_host_cr4 = cr4; | ||
961 | diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c | ||
962 | index 4d8ee827cb14..6fa245ae52c5 100644 | ||
963 | --- a/arch/x86/mm/fault.c | ||
964 | +++ b/arch/x86/mm/fault.c | ||
965 | @@ -600,7 +600,7 @@ show_fault_oops(struct pt_regs *regs, unsigned long error_code, | ||
966 | printk(nx_warning, from_kuid(&init_user_ns, current_uid())); | ||
967 | if (pte && pte_present(*pte) && pte_exec(*pte) && | ||
968 | (pgd_flags(*pgd) & _PAGE_USER) && | ||
969 | - (read_cr4() & X86_CR4_SMEP)) | ||
970 | + (__read_cr4() & X86_CR4_SMEP)) | ||
971 | printk(smep_warning, from_kuid(&init_user_ns, current_uid())); | ||
972 | } | ||
973 | |||
974 | diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c | ||
975 | index 66dba36f2343..0a59a63bcdad 100644 | ||
976 | --- a/arch/x86/mm/init.c | ||
977 | +++ b/arch/x86/mm/init.c | ||
978 | @@ -144,11 +144,11 @@ static void __init probe_page_size_mask(void) | ||
979 | |||
980 | /* Enable PSE if available */ | ||
981 | if (cpu_has_pse) | ||
982 | - set_in_cr4(X86_CR4_PSE); | ||
983 | + cr4_set_bits_and_update_boot(X86_CR4_PSE); | ||
984 | |||
985 | /* Enable PGE if available */ | ||
986 | if (cpu_has_pge) { | ||
987 | - set_in_cr4(X86_CR4_PGE); | ||
988 | + cr4_set_bits_and_update_boot(X86_CR4_PGE); | ||
989 | __supported_pte_mask |= _PAGE_GLOBAL; | ||
990 | } | ||
991 | } | ||
992 | @@ -687,3 +687,11 @@ void __init zone_sizes_init(void) | ||
993 | free_area_init_nodes(max_zone_pfns); | ||
994 | } | ||
995 | |||
996 | +DEFINE_PER_CPU_SHARED_ALIGNED(struct tlb_state, cpu_tlbstate) = { | ||
997 | +#ifdef CONFIG_SMP | ||
998 | + .active_mm = &init_mm, | ||
999 | + .state = 0, | ||
1000 | +#endif | ||
1001 | + .cr4 = ~0UL, /* fail hard if we screw up cr4 shadow initialization */ | ||
1002 | +}; | ||
1003 | +EXPORT_SYMBOL_GPL(cpu_tlbstate); | ||
1004 | diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c | ||
1005 | index ee61c36d64f8..3250f2371aea 100644 | ||
1006 | --- a/arch/x86/mm/tlb.c | ||
1007 | +++ b/arch/x86/mm/tlb.c | ||
1008 | @@ -14,9 +14,6 @@ | ||
1009 | #include <asm/uv/uv.h> | ||
1010 | #include <linux/debugfs.h> | ||
1011 | |||
1012 | -DEFINE_PER_CPU_SHARED_ALIGNED(struct tlb_state, cpu_tlbstate) | ||
1013 | - = { &init_mm, 0, }; | ||
1014 | - | ||
1015 | /* | ||
1016 | * Smarter SMP flushing macros. | ||
1017 | * c/o Linus Torvalds. | ||
1018 | diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c | ||
1019 | index 3f627345d51c..82003a36ad96 100644 | ||
1020 | --- a/arch/x86/net/bpf_jit_comp.c | ||
1021 | +++ b/arch/x86/net/bpf_jit_comp.c | ||
1022 | @@ -558,6 +558,13 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image, | ||
1023 | if (is_ereg(dst_reg)) | ||
1024 | EMIT1(0x41); | ||
1025 | EMIT3(0xC1, add_1reg(0xC8, dst_reg), 8); | ||
1026 | + | ||
1027 | + /* emit 'movzwl eax, ax' */ | ||
1028 | + if (is_ereg(dst_reg)) | ||
1029 | + EMIT3(0x45, 0x0F, 0xB7); | ||
1030 | + else | ||
1031 | + EMIT2(0x0F, 0xB7); | ||
1032 | + EMIT1(add_2reg(0xC0, dst_reg, dst_reg)); | ||
1033 | break; | ||
1034 | case 32: | ||
1035 | /* emit 'bswap eax' to swap lower 4 bytes */ | ||
1036 | @@ -576,6 +583,27 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image, | ||
1037 | break; | ||
1038 | |||
1039 | case BPF_ALU | BPF_END | BPF_FROM_LE: | ||
1040 | + switch (imm32) { | ||
1041 | + case 16: | ||
1042 | + /* emit 'movzwl eax, ax' to zero extend 16-bit | ||
1043 | + * into 64 bit | ||
1044 | + */ | ||
1045 | + if (is_ereg(dst_reg)) | ||
1046 | + EMIT3(0x45, 0x0F, 0xB7); | ||
1047 | + else | ||
1048 | + EMIT2(0x0F, 0xB7); | ||
1049 | + EMIT1(add_2reg(0xC0, dst_reg, dst_reg)); | ||
1050 | + break; | ||
1051 | + case 32: | ||
1052 | + /* emit 'mov eax, eax' to clear upper 32-bits */ | ||
1053 | + if (is_ereg(dst_reg)) | ||
1054 | + EMIT1(0x45); | ||
1055 | + EMIT2(0x89, add_2reg(0xC0, dst_reg, dst_reg)); | ||
1056 | + break; | ||
1057 | + case 64: | ||
1058 | + /* nop */ | ||
1059 | + break; | ||
1060 | + } | ||
1061 | break; | ||
1062 | |||
1063 | /* ST: *(u8*)(dst_reg + off) = imm */ | ||
1064 | @@ -936,7 +964,12 @@ void bpf_int_jit_compile(struct bpf_prog *prog) | ||
1065 | } | ||
1066 | ctx.cleanup_addr = proglen; | ||
1067 | |||
1068 | - for (pass = 0; pass < 10; pass++) { | ||
1069 | + /* JITed image shrinks with every pass and the loop iterates | ||
1070 | + * until the image stops shrinking. Very large bpf programs | ||
1071 | + * may converge on the last pass. In such case do one more | ||
1072 | + * pass to emit the final image | ||
1073 | + */ | ||
1074 | + for (pass = 0; pass < 10 || image; pass++) { | ||
1075 | proglen = do_jit(prog, addrs, image, oldproglen, &ctx); | ||
1076 | if (proglen <= 0) { | ||
1077 | image = NULL; | ||
1078 | diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu.c | ||
1079 | index 6ec7910f59bf..3e32ed5648a0 100644 | ||
1080 | --- a/arch/x86/power/cpu.c | ||
1081 | +++ b/arch/x86/power/cpu.c | ||
1082 | @@ -105,11 +105,8 @@ static void __save_processor_state(struct saved_context *ctxt) | ||
1083 | ctxt->cr0 = read_cr0(); | ||
1084 | ctxt->cr2 = read_cr2(); | ||
1085 | ctxt->cr3 = read_cr3(); | ||
1086 | -#ifdef CONFIG_X86_32 | ||
1087 | - ctxt->cr4 = read_cr4_safe(); | ||
1088 | -#else | ||
1089 | -/* CONFIG_X86_64 */ | ||
1090 | - ctxt->cr4 = read_cr4(); | ||
1091 | + ctxt->cr4 = __read_cr4_safe(); | ||
1092 | +#ifdef CONFIG_X86_64 | ||
1093 | ctxt->cr8 = read_cr8(); | ||
1094 | #endif | ||
1095 | ctxt->misc_enable_saved = !rdmsrl_safe(MSR_IA32_MISC_ENABLE, | ||
1096 | @@ -175,12 +172,12 @@ static void notrace __restore_processor_state(struct saved_context *ctxt) | ||
1097 | /* cr4 was introduced in the Pentium CPU */ | ||
1098 | #ifdef CONFIG_X86_32 | ||
1099 | if (ctxt->cr4) | ||
1100 | - write_cr4(ctxt->cr4); | ||
1101 | + __write_cr4(ctxt->cr4); | ||
1102 | #else | ||
1103 | /* CONFIG X86_64 */ | ||
1104 | wrmsrl(MSR_EFER, ctxt->efer); | ||
1105 | write_cr8(ctxt->cr8); | ||
1106 | - write_cr4(ctxt->cr4); | ||
1107 | + __write_cr4(ctxt->cr4); | ||
1108 | #endif | ||
1109 | write_cr3(ctxt->cr3); | ||
1110 | write_cr2(ctxt->cr2); | ||
1111 | diff --git a/arch/x86/realmode/init.c b/arch/x86/realmode/init.c | ||
1112 | index bad628a620c4..0b7a63d98440 100644 | ||
1113 | --- a/arch/x86/realmode/init.c | ||
1114 | +++ b/arch/x86/realmode/init.c | ||
1115 | @@ -81,7 +81,7 @@ void __init setup_real_mode(void) | ||
1116 | |||
1117 | trampoline_header->start = (u64) secondary_startup_64; | ||
1118 | trampoline_cr4_features = &trampoline_header->cr4; | ||
1119 | - *trampoline_cr4_features = read_cr4(); | ||
1120 | + *trampoline_cr4_features = __read_cr4(); | ||
1121 | |||
1122 | trampoline_pgd = (u64 *) __va(real_mode_header->trampoline_pgd); | ||
1123 | trampoline_pgd[0] = init_level4_pgt[pgd_index(__PAGE_OFFSET)].pgd; | ||
1124 | diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c | ||
1125 | index fac5e4f9607c..7d67146c3f87 100644 | ||
1126 | --- a/arch/x86/xen/enlighten.c | ||
1127 | +++ b/arch/x86/xen/enlighten.c | ||
1128 | @@ -1483,10 +1483,10 @@ static void xen_pvh_set_cr_flags(int cpu) | ||
1129 | * set them here. For all, OSFXSR OSXMMEXCPT are set in fpu_init. | ||
1130 | */ | ||
1131 | if (cpu_has_pse) | ||
1132 | - set_in_cr4(X86_CR4_PSE); | ||
1133 | + cr4_set_bits_and_update_boot(X86_CR4_PSE); | ||
1134 | |||
1135 | if (cpu_has_pge) | ||
1136 | - set_in_cr4(X86_CR4_PGE); | ||
1137 | + cr4_set_bits_and_update_boot(X86_CR4_PGE); | ||
1138 | } | ||
1139 | |||
1140 | /* | ||
1141 | diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig | ||
1142 | index 73d328f480e5..e28ef29b0b16 100644 | ||
1143 | --- a/arch/xtensa/Kconfig | ||
1144 | +++ b/arch/xtensa/Kconfig | ||
1145 | @@ -436,6 +436,36 @@ config XTFPGA_LCD_8BIT_ACCESS | ||
1146 | only be used with 8-bit interface. Please consult prototyping user | ||
1147 | guide for your board for the correct interface width. | ||
1148 | |||
1149 | +config XTFPGA_LCD | ||
1150 | + bool "Enable XTFPGA LCD driver" | ||
1151 | + depends on XTENSA_PLATFORM_XTFPGA | ||
1152 | + default n | ||
1153 | + help | ||
1154 | + There's a 2x16 LCD on most of XTFPGA boards, kernel may output | ||
1155 | + progress messages there during bootup/shutdown. It may be useful | ||
1156 | + during board bringup. | ||
1157 | + | ||
1158 | + If unsure, say N. | ||
1159 | + | ||
1160 | +config XTFPGA_LCD_BASE_ADDR | ||
1161 | + hex "XTFPGA LCD base address" | ||
1162 | + depends on XTFPGA_LCD | ||
1163 | + default "0x0d0c0000" | ||
1164 | + help | ||
1165 | + Base address of the LCD controller inside KIO region. | ||
1166 | + Different boards from XTFPGA family have LCD controller at different | ||
1167 | + addresses. Please consult prototyping user guide for your board for | ||
1168 | + the correct address. Wrong address here may lead to hardware lockup. | ||
1169 | + | ||
1170 | +config XTFPGA_LCD_8BIT_ACCESS | ||
1171 | + bool "Use 8-bit access to XTFPGA LCD" | ||
1172 | + depends on XTFPGA_LCD | ||
1173 | + default n | ||
1174 | + help | ||
1175 | + LCD may be connected with 4- or 8-bit interface, 8-bit access may | ||
1176 | + only be used with 8-bit interface. Please consult prototyping user | ||
1177 | + guide for your board for the correct interface width. | ||
1178 | + | ||
1179 | endmenu | ||
1180 | |||
1181 | menu "Executable file formats" | ||
1182 | diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile | ||
1183 | index c3b2fcb729f3..6d11522f0e48 100644 | ||
1184 | --- a/drivers/acpi/Makefile | ||
1185 | +++ b/drivers/acpi/Makefile | ||
1186 | @@ -47,6 +47,7 @@ acpi-y += int340x_thermal.o | ||
1187 | acpi-y += power.o | ||
1188 | acpi-y += event.o | ||
1189 | acpi-y += sysfs.o | ||
1190 | +acpi-y += property.o | ||
1191 | acpi-$(CONFIG_X86) += acpi_cmos_rtc.o | ||
1192 | acpi-$(CONFIG_DEBUG_FS) += debugfs.o | ||
1193 | acpi-$(CONFIG_ACPI_NUMA) += numa.o | ||
1194 | diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h | ||
1195 | index 447f6d679b29..163e82f536fa 100644 | ||
1196 | --- a/drivers/acpi/internal.h | ||
1197 | +++ b/drivers/acpi/internal.h | ||
1198 | @@ -173,4 +173,10 @@ static inline void suspend_nvs_restore(void) {} | ||
1199 | bool acpi_osi_is_win8(void); | ||
1200 | #endif | ||
1201 | |||
1202 | +/*-------------------------------------------------------------------------- | ||
1203 | + Device properties | ||
1204 | + -------------------------------------------------------------------------- */ | ||
1205 | +void acpi_init_properties(struct acpi_device *adev); | ||
1206 | +void acpi_free_properties(struct acpi_device *adev); | ||
1207 | + | ||
1208 | #endif /* _ACPI_INTERNAL_H_ */ | ||
1209 | diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c | ||
1210 | new file mode 100644 | ||
1211 | index 000000000000..2541b1fd1fa5 | ||
1212 | --- /dev/null | ||
1213 | +++ b/drivers/acpi/property.c | ||
1214 | @@ -0,0 +1,542 @@ | ||
1215 | +/* | ||
1216 | + * ACPI device specific properties support. | ||
1217 | + * | ||
1218 | + * Copyright (C) 2014, Intel Corporation | ||
1219 | + * All rights reserved. | ||
1220 | + * | ||
1221 | + * Authors: Mika Westerberg <mika.westerberg@linux.intel.com> | ||
1222 | + * Darren Hart <dvhart@linux.intel.com> | ||
1223 | + * Rafael J. Wysocki <rafael.j.wysocki@intel.com> | ||
1224 | + * | ||
1225 | + * This program is free software; you can redistribute it and/or modify | ||
1226 | + * it under the terms of the GNU General Public License version 2 as | ||
1227 | + * published by the Free Software Foundation. | ||
1228 | + */ | ||
1229 | + | ||
1230 | +#include <linux/acpi.h> | ||
1231 | +#include <linux/device.h> | ||
1232 | +#include <linux/export.h> | ||
1233 | + | ||
1234 | +#include "internal.h" | ||
1235 | + | ||
1236 | +/* ACPI _DSD device properties UUID: daffd814-6eba-4d8c-8a91-bc9bbf4aa301 */ | ||
1237 | +static const u8 prp_uuid[16] = { | ||
1238 | + 0x14, 0xd8, 0xff, 0xda, 0xba, 0x6e, 0x8c, 0x4d, | ||
1239 | + 0x8a, 0x91, 0xbc, 0x9b, 0xbf, 0x4a, 0xa3, 0x01 | ||
1240 | +}; | ||
1241 | + | ||
1242 | +static bool acpi_property_value_ok(const union acpi_object *value) | ||
1243 | +{ | ||
1244 | + int j; | ||
1245 | + | ||
1246 | + /* | ||
1247 | + * The value must be an integer, a string, a reference, or a package | ||
1248 | + * whose every element must be an integer, a string, or a reference. | ||
1249 | + */ | ||
1250 | + switch (value->type) { | ||
1251 | + case ACPI_TYPE_INTEGER: | ||
1252 | + case ACPI_TYPE_STRING: | ||
1253 | + case ACPI_TYPE_LOCAL_REFERENCE: | ||
1254 | + return true; | ||
1255 | + | ||
1256 | + case ACPI_TYPE_PACKAGE: | ||
1257 | + for (j = 0; j < value->package.count; j++) | ||
1258 | + switch (value->package.elements[j].type) { | ||
1259 | + case ACPI_TYPE_INTEGER: | ||
1260 | + case ACPI_TYPE_STRING: | ||
1261 | + case ACPI_TYPE_LOCAL_REFERENCE: | ||
1262 | + continue; | ||
1263 | + | ||
1264 | + default: | ||
1265 | + return false; | ||
1266 | + } | ||
1267 | + | ||
1268 | + return true; | ||
1269 | + } | ||
1270 | + return false; | ||
1271 | +} | ||
1272 | + | ||
1273 | +static bool acpi_properties_format_valid(const union acpi_object *properties) | ||
1274 | +{ | ||
1275 | + int i; | ||
1276 | + | ||
1277 | + for (i = 0; i < properties->package.count; i++) { | ||
1278 | + const union acpi_object *property; | ||
1279 | + | ||
1280 | + property = &properties->package.elements[i]; | ||
1281 | + /* | ||
1282 | + * Only two elements allowed, the first one must be a string and | ||
1283 | + * the second one has to satisfy certain conditions. | ||
1284 | + */ | ||
1285 | + if (property->package.count != 2 | ||
1286 | + || property->package.elements[0].type != ACPI_TYPE_STRING | ||
1287 | + || !acpi_property_value_ok(&property->package.elements[1])) | ||
1288 | + return false; | ||
1289 | + } | ||
1290 | + return true; | ||
1291 | +} | ||
1292 | + | ||
1293 | +void acpi_init_properties(struct acpi_device *adev) | ||
1294 | +{ | ||
1295 | + struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER }; | ||
1296 | + const union acpi_object *desc; | ||
1297 | + acpi_status status; | ||
1298 | + int i; | ||
1299 | + | ||
1300 | + status = acpi_evaluate_object_typed(adev->handle, "_DSD", NULL, &buf, | ||
1301 | + ACPI_TYPE_PACKAGE); | ||
1302 | + if (ACPI_FAILURE(status)) | ||
1303 | + return; | ||
1304 | + | ||
1305 | + desc = buf.pointer; | ||
1306 | + if (desc->package.count % 2) | ||
1307 | + goto fail; | ||
1308 | + | ||
1309 | + /* Look for the device properties UUID. */ | ||
1310 | + for (i = 0; i < desc->package.count; i += 2) { | ||
1311 | + const union acpi_object *uuid, *properties; | ||
1312 | + | ||
1313 | + uuid = &desc->package.elements[i]; | ||
1314 | + properties = &desc->package.elements[i + 1]; | ||
1315 | + | ||
1316 | + /* | ||
1317 | + * The first element must be a UUID and the second one must be | ||
1318 | + * a package. | ||
1319 | + */ | ||
1320 | + if (uuid->type != ACPI_TYPE_BUFFER || uuid->buffer.length != 16 | ||
1321 | + || properties->type != ACPI_TYPE_PACKAGE) | ||
1322 | + break; | ||
1323 | + | ||
1324 | + if (memcmp(uuid->buffer.pointer, prp_uuid, sizeof(prp_uuid))) | ||
1325 | + continue; | ||
1326 | + | ||
1327 | + /* | ||
1328 | + * We found the matching UUID. Now validate the format of the | ||
1329 | + * package immediately following it. | ||
1330 | + */ | ||
1331 | + if (!acpi_properties_format_valid(properties)) | ||
1332 | + break; | ||
1333 | + | ||
1334 | + adev->data.pointer = buf.pointer; | ||
1335 | + adev->data.properties = properties; | ||
1336 | + return; | ||
1337 | + } | ||
1338 | + | ||
1339 | + fail: | ||
1340 | + dev_warn(&adev->dev, "Returned _DSD data is not valid, skipping\n"); | ||
1341 | + ACPI_FREE(buf.pointer); | ||
1342 | +} | ||
1343 | + | ||
1344 | +void acpi_free_properties(struct acpi_device *adev) | ||
1345 | +{ | ||
1346 | + ACPI_FREE((void *)adev->data.pointer); | ||
1347 | + adev->data.pointer = NULL; | ||
1348 | + adev->data.properties = NULL; | ||
1349 | +} | ||
1350 | + | ||
1351 | +/** | ||
1352 | + * acpi_dev_get_property - return an ACPI property with given name | ||
1353 | + * @adev: ACPI device to get property | ||
1354 | + * @name: Name of the property | ||
1355 | + * @type: Expected property type | ||
1356 | + * @obj: Location to store the property value (if not %NULL) | ||
1357 | + * | ||
1358 | + * Look up a property with @name and store a pointer to the resulting ACPI | ||
1359 | + * object at the location pointed to by @obj if found. | ||
1360 | + * | ||
1361 | + * Callers must not attempt to free the returned objects. These objects will be | ||
1362 | + * freed by the ACPI core automatically during the removal of @adev. | ||
1363 | + * | ||
1364 | + * Return: %0 if property with @name has been found (success), | ||
1365 | + * %-EINVAL if the arguments are invalid, | ||
1366 | + * %-ENODATA if the property doesn't exist, | ||
1367 | + * %-EPROTO if the property value type doesn't match @type. | ||
1368 | + */ | ||
1369 | +int acpi_dev_get_property(struct acpi_device *adev, const char *name, | ||
1370 | + acpi_object_type type, const union acpi_object **obj) | ||
1371 | +{ | ||
1372 | + const union acpi_object *properties; | ||
1373 | + int i; | ||
1374 | + | ||
1375 | + if (!adev || !name) | ||
1376 | + return -EINVAL; | ||
1377 | + | ||
1378 | + if (!adev->data.pointer || !adev->data.properties) | ||
1379 | + return -ENODATA; | ||
1380 | + | ||
1381 | + properties = adev->data.properties; | ||
1382 | + for (i = 0; i < properties->package.count; i++) { | ||
1383 | + const union acpi_object *propname, *propvalue; | ||
1384 | + const union acpi_object *property; | ||
1385 | + | ||
1386 | + property = &properties->package.elements[i]; | ||
1387 | + | ||
1388 | + propname = &property->package.elements[0]; | ||
1389 | + propvalue = &property->package.elements[1]; | ||
1390 | + | ||
1391 | + if (!strcmp(name, propname->string.pointer)) { | ||
1392 | + if (type != ACPI_TYPE_ANY && propvalue->type != type) | ||
1393 | + return -EPROTO; | ||
1394 | + else if (obj) | ||
1395 | + *obj = propvalue; | ||
1396 | + | ||
1397 | + return 0; | ||
1398 | + } | ||
1399 | + } | ||
1400 | + return -ENODATA; | ||
1401 | +} | ||
1402 | +EXPORT_SYMBOL_GPL(acpi_dev_get_property); | ||
1403 | + | ||
1404 | +/** | ||
1405 | + * acpi_dev_get_property_array - return an ACPI array property with given name | ||
1406 | + * @adev: ACPI device to get property | ||
1407 | + * @name: Name of the property | ||
1408 | + * @type: Expected type of array elements | ||
1409 | + * @obj: Location to store a pointer to the property value (if not NULL) | ||
1410 | + * | ||
1411 | + * Look up an array property with @name and store a pointer to the resulting | ||
1412 | + * ACPI object at the location pointed to by @obj if found. | ||
1413 | + * | ||
1414 | + * Callers must not attempt to free the returned objects. Those objects will be | ||
1415 | + * freed by the ACPI core automatically during the removal of @adev. | ||
1416 | + * | ||
1417 | + * Return: %0 if array property (package) with @name has been found (success), | ||
1418 | + * %-EINVAL if the arguments are invalid, | ||
1419 | + * %-ENODATA if the property doesn't exist, | ||
1420 | + * %-EPROTO if the property is not a package or the type of its elements | ||
1421 | + * doesn't match @type. | ||
1422 | + */ | ||
1423 | +int acpi_dev_get_property_array(struct acpi_device *adev, const char *name, | ||
1424 | + acpi_object_type type, | ||
1425 | + const union acpi_object **obj) | ||
1426 | +{ | ||
1427 | + const union acpi_object *prop; | ||
1428 | + int ret, i; | ||
1429 | + | ||
1430 | + ret = acpi_dev_get_property(adev, name, ACPI_TYPE_PACKAGE, &prop); | ||
1431 | + if (ret) | ||
1432 | + return ret; | ||
1433 | + | ||
1434 | + if (type != ACPI_TYPE_ANY) { | ||
1435 | + /* Check that all elements are of correct type. */ | ||
1436 | + for (i = 0; i < prop->package.count; i++) | ||
1437 | + if (prop->package.elements[i].type != type) | ||
1438 | + return -EPROTO; | ||
1439 | + } | ||
1440 | + if (obj) | ||
1441 | + *obj = prop; | ||
1442 | + | ||
1443 | + return 0; | ||
1444 | +} | ||
1445 | +EXPORT_SYMBOL_GPL(acpi_dev_get_property_array); | ||
1446 | + | ||
1447 | +/** | ||
1448 | + * acpi_dev_get_property_reference - returns handle to the referenced object | ||
1449 | + * @adev: ACPI device to get property | ||
1450 | + * @name: Name of the property | ||
1451 | + * @size_prop: Name of the "size" property in referenced object | ||
1452 | + * @index: Index of the reference to return | ||
1453 | + * @args: Location to store the returned reference with optional arguments | ||
1454 | + * | ||
1455 | + * Find property with @name, verifify that it is a package containing at least | ||
1456 | + * one object reference and if so, store the ACPI device object pointer to the | ||
1457 | + * target object in @args->adev. | ||
1458 | + * | ||
1459 | + * If the reference includes arguments (@size_prop is not %NULL) follow the | ||
1460 | + * reference and check whether or not there is an integer property @size_prop | ||
1461 | + * under the target object and if so, whether or not its value matches the | ||
1462 | + * number of arguments that follow the reference. If there's more than one | ||
1463 | + * reference in the property value package, @index is used to select the one to | ||
1464 | + * return. | ||
1465 | + * | ||
1466 | + * Return: %0 on success, negative error code on failure. | ||
1467 | + */ | ||
1468 | +int acpi_dev_get_property_reference(struct acpi_device *adev, const char *name, | ||
1469 | + const char *size_prop, size_t index, | ||
1470 | + struct acpi_reference_args *args) | ||
1471 | +{ | ||
1472 | + const union acpi_object *element, *end; | ||
1473 | + const union acpi_object *obj; | ||
1474 | + struct acpi_device *device; | ||
1475 | + int ret, idx = 0; | ||
1476 | + | ||
1477 | + ret = acpi_dev_get_property(adev, name, ACPI_TYPE_ANY, &obj); | ||
1478 | + if (ret) | ||
1479 | + return ret; | ||
1480 | + | ||
1481 | + /* | ||
1482 | + * The simplest case is when the value is a single reference. Just | ||
1483 | + * return that reference then. | ||
1484 | + */ | ||
1485 | + if (obj->type == ACPI_TYPE_LOCAL_REFERENCE) { | ||
1486 | + if (size_prop || index) | ||
1487 | + return -EINVAL; | ||
1488 | + | ||
1489 | + ret = acpi_bus_get_device(obj->reference.handle, &device); | ||
1490 | + if (ret) | ||
1491 | + return ret; | ||
1492 | + | ||
1493 | + args->adev = device; | ||
1494 | + args->nargs = 0; | ||
1495 | + return 0; | ||
1496 | + } | ||
1497 | + | ||
1498 | + /* | ||
1499 | + * If it is not a single reference, then it is a package of | ||
1500 | + * references followed by number of ints as follows: | ||
1501 | + * | ||
1502 | + * Package () { REF, INT, REF, INT, INT } | ||
1503 | + * | ||
1504 | + * The index argument is then used to determine which reference | ||
1505 | + * the caller wants (along with the arguments). | ||
1506 | + */ | ||
1507 | + if (obj->type != ACPI_TYPE_PACKAGE || index >= obj->package.count) | ||
1508 | + return -EPROTO; | ||
1509 | + | ||
1510 | + element = obj->package.elements; | ||
1511 | + end = element + obj->package.count; | ||
1512 | + | ||
1513 | + while (element < end) { | ||
1514 | + u32 nargs, i; | ||
1515 | + | ||
1516 | + if (element->type != ACPI_TYPE_LOCAL_REFERENCE) | ||
1517 | + return -EPROTO; | ||
1518 | + | ||
1519 | + ret = acpi_bus_get_device(element->reference.handle, &device); | ||
1520 | + if (ret) | ||
1521 | + return -ENODEV; | ||
1522 | + | ||
1523 | + element++; | ||
1524 | + nargs = 0; | ||
1525 | + | ||
1526 | + if (size_prop) { | ||
1527 | + const union acpi_object *prop; | ||
1528 | + | ||
1529 | + /* | ||
1530 | + * Find out how many arguments the refenced object | ||
1531 | + * expects by reading its size_prop property. | ||
1532 | + */ | ||
1533 | + ret = acpi_dev_get_property(device, size_prop, | ||
1534 | + ACPI_TYPE_INTEGER, &prop); | ||
1535 | + if (ret) | ||
1536 | + return ret; | ||
1537 | + | ||
1538 | + nargs = prop->integer.value; | ||
1539 | + if (nargs > MAX_ACPI_REFERENCE_ARGS | ||
1540 | + || element + nargs > end) | ||
1541 | + return -EPROTO; | ||
1542 | + | ||
1543 | + /* | ||
1544 | + * Skip to the start of the arguments and verify | ||
1545 | + * that they all are in fact integers. | ||
1546 | + */ | ||
1547 | + for (i = 0; i < nargs; i++) | ||
1548 | + if (element[i].type != ACPI_TYPE_INTEGER) | ||
1549 | + return -EPROTO; | ||
1550 | + } else { | ||
1551 | + /* assume following integer elements are all args */ | ||
1552 | + for (i = 0; element + i < end; i++) { | ||
1553 | + int type = element[i].type; | ||
1554 | + | ||
1555 | + if (type == ACPI_TYPE_INTEGER) | ||
1556 | + nargs++; | ||
1557 | + else if (type == ACPI_TYPE_LOCAL_REFERENCE) | ||
1558 | + break; | ||
1559 | + else | ||
1560 | + return -EPROTO; | ||
1561 | + } | ||
1562 | + } | ||
1563 | + | ||
1564 | + if (idx++ == index) { | ||
1565 | + args->adev = device; | ||
1566 | + args->nargs = nargs; | ||
1567 | + for (i = 0; i < nargs; i++) | ||
1568 | + args->args[i] = element[i].integer.value; | ||
1569 | + | ||
1570 | + return 0; | ||
1571 | + } | ||
1572 | + | ||
1573 | + element += nargs; | ||
1574 | + } | ||
1575 | + | ||
1576 | + return -EPROTO; | ||
1577 | +} | ||
1578 | +EXPORT_SYMBOL_GPL(acpi_dev_get_property_reference); | ||
1579 | + | ||
1580 | +int acpi_dev_prop_get(struct acpi_device *adev, const char *propname, | ||
1581 | + void **valptr) | ||
1582 | +{ | ||
1583 | + return acpi_dev_get_property(adev, propname, ACPI_TYPE_ANY, | ||
1584 | + (const union acpi_object **)valptr); | ||
1585 | +} | ||
1586 | + | ||
1587 | +int acpi_dev_prop_read_single(struct acpi_device *adev, const char *propname, | ||
1588 | + enum dev_prop_type proptype, void *val) | ||
1589 | +{ | ||
1590 | + const union acpi_object *obj; | ||
1591 | + int ret; | ||
1592 | + | ||
1593 | + if (!val) | ||
1594 | + return -EINVAL; | ||
1595 | + | ||
1596 | + if (proptype >= DEV_PROP_U8 && proptype <= DEV_PROP_U64) { | ||
1597 | + ret = acpi_dev_get_property(adev, propname, ACPI_TYPE_INTEGER, &obj); | ||
1598 | + if (ret) | ||
1599 | + return ret; | ||
1600 | + | ||
1601 | + switch (proptype) { | ||
1602 | + case DEV_PROP_U8: | ||
1603 | + if (obj->integer.value > U8_MAX) | ||
1604 | + return -EOVERFLOW; | ||
1605 | + *(u8 *)val = obj->integer.value; | ||
1606 | + break; | ||
1607 | + case DEV_PROP_U16: | ||
1608 | + if (obj->integer.value > U16_MAX) | ||
1609 | + return -EOVERFLOW; | ||
1610 | + *(u16 *)val = obj->integer.value; | ||
1611 | + break; | ||
1612 | + case DEV_PROP_U32: | ||
1613 | + if (obj->integer.value > U32_MAX) | ||
1614 | + return -EOVERFLOW; | ||
1615 | + *(u32 *)val = obj->integer.value; | ||
1616 | + break; | ||
1617 | + default: | ||
1618 | + *(u64 *)val = obj->integer.value; | ||
1619 | + break; | ||
1620 | + } | ||
1621 | + } else if (proptype == DEV_PROP_STRING) { | ||
1622 | + ret = acpi_dev_get_property(adev, propname, ACPI_TYPE_STRING, &obj); | ||
1623 | + if (ret) | ||
1624 | + return ret; | ||
1625 | + | ||
1626 | + *(char **)val = obj->string.pointer; | ||
1627 | + } else { | ||
1628 | + ret = -EINVAL; | ||
1629 | + } | ||
1630 | + return ret; | ||
1631 | +} | ||
1632 | + | ||
1633 | +static int acpi_copy_property_array_u8(const union acpi_object *items, u8 *val, | ||
1634 | + size_t nval) | ||
1635 | +{ | ||
1636 | + int i; | ||
1637 | + | ||
1638 | + for (i = 0; i < nval; i++) { | ||
1639 | + if (items[i].type != ACPI_TYPE_INTEGER) | ||
1640 | + return -EPROTO; | ||
1641 | + if (items[i].integer.value > U8_MAX) | ||
1642 | + return -EOVERFLOW; | ||
1643 | + | ||
1644 | + val[i] = items[i].integer.value; | ||
1645 | + } | ||
1646 | + return 0; | ||
1647 | +} | ||
1648 | + | ||
1649 | +static int acpi_copy_property_array_u16(const union acpi_object *items, | ||
1650 | + u16 *val, size_t nval) | ||
1651 | +{ | ||
1652 | + int i; | ||
1653 | + | ||
1654 | + for (i = 0; i < nval; i++) { | ||
1655 | + if (items[i].type != ACPI_TYPE_INTEGER) | ||
1656 | + return -EPROTO; | ||
1657 | + if (items[i].integer.value > U16_MAX) | ||
1658 | + return -EOVERFLOW; | ||
1659 | + | ||
1660 | + val[i] = items[i].integer.value; | ||
1661 | + } | ||
1662 | + return 0; | ||
1663 | +} | ||
1664 | + | ||
1665 | +static int acpi_copy_property_array_u32(const union acpi_object *items, | ||
1666 | + u32 *val, size_t nval) | ||
1667 | +{ | ||
1668 | + int i; | ||
1669 | + | ||
1670 | + for (i = 0; i < nval; i++) { | ||
1671 | + if (items[i].type != ACPI_TYPE_INTEGER) | ||
1672 | + return -EPROTO; | ||
1673 | + if (items[i].integer.value > U32_MAX) | ||
1674 | + return -EOVERFLOW; | ||
1675 | + | ||
1676 | + val[i] = items[i].integer.value; | ||
1677 | + } | ||
1678 | + return 0; | ||
1679 | +} | ||
1680 | + | ||
1681 | +static int acpi_copy_property_array_u64(const union acpi_object *items, | ||
1682 | + u64 *val, size_t nval) | ||
1683 | +{ | ||
1684 | + int i; | ||
1685 | + | ||
1686 | + for (i = 0; i < nval; i++) { | ||
1687 | + if (items[i].type != ACPI_TYPE_INTEGER) | ||
1688 | + return -EPROTO; | ||
1689 | + | ||
1690 | + val[i] = items[i].integer.value; | ||
1691 | + } | ||
1692 | + return 0; | ||
1693 | +} | ||
1694 | + | ||
1695 | +static int acpi_copy_property_array_string(const union acpi_object *items, | ||
1696 | + char **val, size_t nval) | ||
1697 | +{ | ||
1698 | + int i; | ||
1699 | + | ||
1700 | + for (i = 0; i < nval; i++) { | ||
1701 | + if (items[i].type != ACPI_TYPE_STRING) | ||
1702 | + return -EPROTO; | ||
1703 | + | ||
1704 | + val[i] = items[i].string.pointer; | ||
1705 | + } | ||
1706 | + return 0; | ||
1707 | +} | ||
1708 | + | ||
1709 | +int acpi_dev_prop_read(struct acpi_device *adev, const char *propname, | ||
1710 | + enum dev_prop_type proptype, void *val, size_t nval) | ||
1711 | +{ | ||
1712 | + const union acpi_object *obj; | ||
1713 | + const union acpi_object *items; | ||
1714 | + int ret; | ||
1715 | + | ||
1716 | + if (val && nval == 1) { | ||
1717 | + ret = acpi_dev_prop_read_single(adev, propname, proptype, val); | ||
1718 | + if (!ret) | ||
1719 | + return ret; | ||
1720 | + } | ||
1721 | + | ||
1722 | + ret = acpi_dev_get_property_array(adev, propname, ACPI_TYPE_ANY, &obj); | ||
1723 | + if (ret) | ||
1724 | + return ret; | ||
1725 | + | ||
1726 | + if (!val) | ||
1727 | + return obj->package.count; | ||
1728 | + else if (nval <= 0) | ||
1729 | + return -EINVAL; | ||
1730 | + | ||
1731 | + if (nval > obj->package.count) | ||
1732 | + return -EOVERFLOW; | ||
1733 | + | ||
1734 | + items = obj->package.elements; | ||
1735 | + switch (proptype) { | ||
1736 | + case DEV_PROP_U8: | ||
1737 | + ret = acpi_copy_property_array_u8(items, (u8 *)val, nval); | ||
1738 | + break; | ||
1739 | + case DEV_PROP_U16: | ||
1740 | + ret = acpi_copy_property_array_u16(items, (u16 *)val, nval); | ||
1741 | + break; | ||
1742 | + case DEV_PROP_U32: | ||
1743 | + ret = acpi_copy_property_array_u32(items, (u32 *)val, nval); | ||
1744 | + break; | ||
1745 | + case DEV_PROP_U64: | ||
1746 | + ret = acpi_copy_property_array_u64(items, (u64 *)val, nval); | ||
1747 | + break; | ||
1748 | + case DEV_PROP_STRING: | ||
1749 | + ret = acpi_copy_property_array_string(items, (char **)val, nval); | ||
1750 | + break; | ||
1751 | + default: | ||
1752 | + ret = -EINVAL; | ||
1753 | + break; | ||
1754 | + } | ||
1755 | + return ret; | ||
1756 | +} | ||
1757 | diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c | ||
1758 | index 0446d0d5efa5..01aa1c7f4e9c 100644 | ||
1759 | --- a/drivers/acpi/scan.c | ||
1760 | +++ b/drivers/acpi/scan.c | ||
1761 | @@ -926,6 +926,7 @@ static void acpi_device_release(struct device *dev) | ||
1762 | { | ||
1763 | struct acpi_device *acpi_dev = to_acpi_device(dev); | ||
1764 | |||
1765 | + acpi_free_properties(acpi_dev); | ||
1766 | acpi_free_pnp_ids(&acpi_dev->pnp); | ||
1767 | acpi_free_power_resources_lists(acpi_dev); | ||
1768 | kfree(acpi_dev); | ||
1769 | @@ -1928,6 +1929,7 @@ void acpi_init_device_object(struct acpi_device *device, acpi_handle handle, | ||
1770 | acpi_set_device_status(device, sta); | ||
1771 | acpi_device_get_busid(device); | ||
1772 | acpi_set_pnp_ids(handle, &device->pnp, type); | ||
1773 | + acpi_init_properties(device); | ||
1774 | acpi_bus_get_flags(device); | ||
1775 | device->flags.match_driver = false; | ||
1776 | device->flags.initialized = true; | ||
1777 | diff --git a/drivers/base/Makefile b/drivers/base/Makefile | ||
1778 | index 6922cd6850a2..53c3fe1aeb29 100644 | ||
1779 | --- a/drivers/base/Makefile | ||
1780 | +++ b/drivers/base/Makefile | ||
1781 | @@ -4,7 +4,7 @@ obj-y := component.o core.o bus.o dd.o syscore.o \ | ||
1782 | driver.o class.o platform.o \ | ||
1783 | cpu.o firmware.o init.o map.o devres.o \ | ||
1784 | attribute_container.o transport_class.o \ | ||
1785 | - topology.o container.o | ||
1786 | + topology.o container.o property.o | ||
1787 | obj-$(CONFIG_DEVTMPFS) += devtmpfs.o | ||
1788 | obj-$(CONFIG_DMA_CMA) += dma-contiguous.o | ||
1789 | obj-y += power/ | ||
1790 | diff --git a/drivers/base/property.c b/drivers/base/property.c | ||
1791 | new file mode 100644 | ||
1792 | index 000000000000..6a94ef6e83c9 | ||
1793 | --- /dev/null | ||
1794 | +++ b/drivers/base/property.c | ||
1795 | @@ -0,0 +1,185 @@ | ||
1796 | +/* | ||
1797 | + * property.c - Unified device property interface. | ||
1798 | + * | ||
1799 | + * Copyright (C) 2014, Intel Corporation | ||
1800 | + * Authors: Rafael J. Wysocki <rafael.j.wysocki@intel.com> | ||
1801 | + * Mika Westerberg <mika.westerberg@linux.intel.com> | ||
1802 | + * | ||
1803 | + * This program is free software; you can redistribute it and/or modify | ||
1804 | + * it under the terms of the GNU General Public License version 2 as | ||
1805 | + * published by the Free Software Foundation. | ||
1806 | + */ | ||
1807 | + | ||
1808 | +#include <linux/property.h> | ||
1809 | +#include <linux/export.h> | ||
1810 | +#include <linux/acpi.h> | ||
1811 | +#include <linux/of.h> | ||
1812 | + | ||
1813 | +/** | ||
1814 | + * device_property_present - check if a property of a device is present | ||
1815 | + * @dev: Device whose property is being checked | ||
1816 | + * @propname: Name of the property | ||
1817 | + * | ||
1818 | + * Check if property @propname is present in the device firmware description. | ||
1819 | + */ | ||
1820 | +bool device_property_present(struct device *dev, const char *propname) | ||
1821 | +{ | ||
1822 | + if (IS_ENABLED(CONFIG_OF) && dev->of_node) | ||
1823 | + return of_property_read_bool(dev->of_node, propname); | ||
1824 | + | ||
1825 | + return !acpi_dev_prop_get(ACPI_COMPANION(dev), propname, NULL); | ||
1826 | +} | ||
1827 | +EXPORT_SYMBOL_GPL(device_property_present); | ||
1828 | + | ||
1829 | +#define OF_DEV_PROP_READ_ARRAY(node, propname, type, val, nval) \ | ||
1830 | + (val) ? of_property_read_##type##_array((node), (propname), (val), (nval)) \ | ||
1831 | + : of_property_count_elems_of_size((node), (propname), sizeof(type)) | ||
1832 | + | ||
1833 | +#define DEV_PROP_READ_ARRAY(_dev_, _propname_, _type_, _proptype_, _val_, _nval_) \ | ||
1834 | + IS_ENABLED(CONFIG_OF) && _dev_->of_node ? \ | ||
1835 | + (OF_DEV_PROP_READ_ARRAY(_dev_->of_node, _propname_, _type_, \ | ||
1836 | + _val_, _nval_)) : \ | ||
1837 | + acpi_dev_prop_read(ACPI_COMPANION(_dev_), _propname_, \ | ||
1838 | + _proptype_, _val_, _nval_) | ||
1839 | + | ||
1840 | +/** | ||
1841 | + * device_property_read_u8_array - return a u8 array property of a device | ||
1842 | + * @dev: Device to get the property of | ||
1843 | + * @propname: Name of the property | ||
1844 | + * @val: The values are stored here | ||
1845 | + * @nval: Size of the @val array | ||
1846 | + * | ||
1847 | + * Function reads an array of u8 properties with @propname from the device | ||
1848 | + * firmware description and stores them to @val if found. | ||
1849 | + * | ||
1850 | + * Return: %0 if the property was found (success), | ||
1851 | + * %-EINVAL if given arguments are not valid, | ||
1852 | + * %-ENODATA if the property does not have a value, | ||
1853 | + * %-EPROTO if the property is not an array of numbers, | ||
1854 | + * %-EOVERFLOW if the size of the property is not as expected. | ||
1855 | + */ | ||
1856 | +int device_property_read_u8_array(struct device *dev, const char *propname, | ||
1857 | + u8 *val, size_t nval) | ||
1858 | +{ | ||
1859 | + return DEV_PROP_READ_ARRAY(dev, propname, u8, DEV_PROP_U8, val, nval); | ||
1860 | +} | ||
1861 | +EXPORT_SYMBOL_GPL(device_property_read_u8_array); | ||
1862 | + | ||
1863 | +/** | ||
1864 | + * device_property_read_u16_array - return a u16 array property of a device | ||
1865 | + * @dev: Device to get the property of | ||
1866 | + * @propname: Name of the property | ||
1867 | + * @val: The values are stored here | ||
1868 | + * @nval: Size of the @val array | ||
1869 | + * | ||
1870 | + * Function reads an array of u16 properties with @propname from the device | ||
1871 | + * firmware description and stores them to @val if found. | ||
1872 | + * | ||
1873 | + * Return: %0 if the property was found (success), | ||
1874 | + * %-EINVAL if given arguments are not valid, | ||
1875 | + * %-ENODATA if the property does not have a value, | ||
1876 | + * %-EPROTO if the property is not an array of numbers, | ||
1877 | + * %-EOVERFLOW if the size of the property is not as expected. | ||
1878 | + */ | ||
1879 | +int device_property_read_u16_array(struct device *dev, const char *propname, | ||
1880 | + u16 *val, size_t nval) | ||
1881 | +{ | ||
1882 | + return DEV_PROP_READ_ARRAY(dev, propname, u16, DEV_PROP_U16, val, nval); | ||
1883 | +} | ||
1884 | +EXPORT_SYMBOL_GPL(device_property_read_u16_array); | ||
1885 | + | ||
1886 | +/** | ||
1887 | + * device_property_read_u32_array - return a u32 array property of a device | ||
1888 | + * @dev: Device to get the property of | ||
1889 | + * @propname: Name of the property | ||
1890 | + * @val: The values are stored here | ||
1891 | + * @nval: Size of the @val array | ||
1892 | + * | ||
1893 | + * Function reads an array of u32 properties with @propname from the device | ||
1894 | + * firmware description and stores them to @val if found. | ||
1895 | + * | ||
1896 | + * Return: %0 if the property was found (success), | ||
1897 | + * %-EINVAL if given arguments are not valid, | ||
1898 | + * %-ENODATA if the property does not have a value, | ||
1899 | + * %-EPROTO if the property is not an array of numbers, | ||
1900 | + * %-EOVERFLOW if the size of the property is not as expected. | ||
1901 | + */ | ||
1902 | +int device_property_read_u32_array(struct device *dev, const char *propname, | ||
1903 | + u32 *val, size_t nval) | ||
1904 | +{ | ||
1905 | + return DEV_PROP_READ_ARRAY(dev, propname, u32, DEV_PROP_U32, val, nval); | ||
1906 | +} | ||
1907 | +EXPORT_SYMBOL_GPL(device_property_read_u32_array); | ||
1908 | + | ||
1909 | +/** | ||
1910 | + * device_property_read_u64_array - return a u64 array property of a device | ||
1911 | + * @dev: Device to get the property of | ||
1912 | + * @propname: Name of the property | ||
1913 | + * @val: The values are stored here | ||
1914 | + * @nval: Size of the @val array | ||
1915 | + * | ||
1916 | + * Function reads an array of u64 properties with @propname from the device | ||
1917 | + * firmware description and stores them to @val if found. | ||
1918 | + * | ||
1919 | + * Return: %0 if the property was found (success), | ||
1920 | + * %-EINVAL if given arguments are not valid, | ||
1921 | + * %-ENODATA if the property does not have a value, | ||
1922 | + * %-EPROTO if the property is not an array of numbers, | ||
1923 | + * %-EOVERFLOW if the size of the property is not as expected. | ||
1924 | + */ | ||
1925 | +int device_property_read_u64_array(struct device *dev, const char *propname, | ||
1926 | + u64 *val, size_t nval) | ||
1927 | +{ | ||
1928 | + return DEV_PROP_READ_ARRAY(dev, propname, u64, DEV_PROP_U64, val, nval); | ||
1929 | +} | ||
1930 | +EXPORT_SYMBOL_GPL(device_property_read_u64_array); | ||
1931 | + | ||
1932 | +/** | ||
1933 | + * device_property_read_string_array - return a string array property of device | ||
1934 | + * @dev: Device to get the property of | ||
1935 | + * @propname: Name of the property | ||
1936 | + * @val: The values are stored here | ||
1937 | + * @nval: Size of the @val array | ||
1938 | + * | ||
1939 | + * Function reads an array of string properties with @propname from the device | ||
1940 | + * firmware description and stores them to @val if found. | ||
1941 | + * | ||
1942 | + * Return: %0 if the property was found (success), | ||
1943 | + * %-EINVAL if given arguments are not valid, | ||
1944 | + * %-ENODATA if the property does not have a value, | ||
1945 | + * %-EPROTO or %-EILSEQ if the property is not an array of strings, | ||
1946 | + * %-EOVERFLOW if the size of the property is not as expected. | ||
1947 | + */ | ||
1948 | +int device_property_read_string_array(struct device *dev, const char *propname, | ||
1949 | + const char **val, size_t nval) | ||
1950 | +{ | ||
1951 | + return IS_ENABLED(CONFIG_OF) && dev->of_node ? | ||
1952 | + of_property_read_string_array(dev->of_node, propname, val, nval) : | ||
1953 | + acpi_dev_prop_read(ACPI_COMPANION(dev), propname, | ||
1954 | + DEV_PROP_STRING, val, nval); | ||
1955 | +} | ||
1956 | +EXPORT_SYMBOL_GPL(device_property_read_string_array); | ||
1957 | + | ||
1958 | +/** | ||
1959 | + * device_property_read_string - return a string property of a device | ||
1960 | + * @dev: Device to get the property of | ||
1961 | + * @propname: Name of the property | ||
1962 | + * @val: The value is stored here | ||
1963 | + * | ||
1964 | + * Function reads property @propname from the device firmware description and | ||
1965 | + * stores the value into @val if found. The value is checked to be a string. | ||
1966 | + * | ||
1967 | + * Return: %0 if the property was found (success), | ||
1968 | + * %-EINVAL if given arguments are not valid, | ||
1969 | + * %-ENODATA if the property does not have a value, | ||
1970 | + * %-EPROTO or %-EILSEQ if the property type is not a string. | ||
1971 | + */ | ||
1972 | +int device_property_read_string(struct device *dev, const char *propname, | ||
1973 | + const char **val) | ||
1974 | +{ | ||
1975 | + return IS_ENABLED(CONFIG_OF) && dev->of_node ? | ||
1976 | + of_property_read_string(dev->of_node, propname, val) : | ||
1977 | + acpi_dev_prop_read(ACPI_COMPANION(dev), propname, | ||
1978 | + DEV_PROP_STRING, val, 1); | ||
1979 | +} | ||
1980 | +EXPORT_SYMBOL_GPL(device_property_read_string); | ||
1981 | diff --git a/drivers/dma/sh/shdmac.c b/drivers/dma/sh/shdmac.c | ||
1982 | index 58eb85770eba..8a083aa23748 100644 | ||
1983 | --- a/drivers/dma/sh/shdmac.c | ||
1984 | +++ b/drivers/dma/sh/shdmac.c | ||
1985 | @@ -443,7 +443,7 @@ static bool sh_dmae_reset(struct sh_dmae_device *shdev) | ||
1986 | return ret; | ||
1987 | } | ||
1988 | |||
1989 | -#if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARM) | ||
1990 | +#if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_SHMOBILE) | ||
1991 | static irqreturn_t sh_dmae_err(int irq, void *data) | ||
1992 | { | ||
1993 | struct sh_dmae_device *shdev = data; | ||
1994 | @@ -689,7 +689,7 @@ static int sh_dmae_probe(struct platform_device *pdev) | ||
1995 | const struct sh_dmae_pdata *pdata; | ||
1996 | unsigned long chan_flag[SH_DMAE_MAX_CHANNELS] = {}; | ||
1997 | int chan_irq[SH_DMAE_MAX_CHANNELS]; | ||
1998 | -#if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARM) | ||
1999 | +#if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_SHMOBILE) | ||
2000 | unsigned long irqflags = 0; | ||
2001 | int errirq; | ||
2002 | #endif | ||
2003 | diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig | ||
2004 | index f42df4dd58d2..6f299cd54e6d 100644 | ||
2005 | --- a/drivers/hid/Kconfig | ||
2006 | +++ b/drivers/hid/Kconfig | ||
2007 | @@ -378,6 +378,17 @@ config HID_LOGITECH_DJ | ||
2008 | generic USB_HID driver and all incoming events will be multiplexed | ||
2009 | into a single mouse and a single keyboard device. | ||
2010 | |||
2011 | +config HID_LOGITECH_HIDPP | ||
2012 | + tristate "Logitech HID++ devices support" | ||
2013 | + depends on HID_LOGITECH | ||
2014 | + ---help--- | ||
2015 | + Support for Logitech devices relyingon the HID++ Logitech specification | ||
2016 | + | ||
2017 | + Say Y if you want support for Logitech devices relying on the HID++ | ||
2018 | + specification. Such devices are the various Logitech Touchpads (T650, | ||
2019 | + T651, TK820), some mice (Zone Touch mouse), or even keyboards (Solar | ||
2020 | + Keayboard). | ||
2021 | + | ||
2022 | config LOGITECH_FF | ||
2023 | bool "Logitech force feedback support" | ||
2024 | depends on HID_LOGITECH | ||
2025 | diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile | ||
2026 | index e2850d8af9ca..b102774b4e16 100644 | ||
2027 | --- a/drivers/hid/Makefile | ||
2028 | +++ b/drivers/hid/Makefile | ||
2029 | @@ -63,6 +63,7 @@ obj-$(CONFIG_HID_LCPOWER) += hid-lcpower.o | ||
2030 | obj-$(CONFIG_HID_LENOVO) += hid-lenovo.o | ||
2031 | obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o | ||
2032 | obj-$(CONFIG_HID_LOGITECH_DJ) += hid-logitech-dj.o | ||
2033 | +obj-$(CONFIG_HID_LOGITECH_HIDPP) += hid-logitech-hidpp.o | ||
2034 | obj-$(CONFIG_HID_MAGICMOUSE) += hid-magicmouse.o | ||
2035 | obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o | ||
2036 | obj-$(CONFIG_HID_MONTEREY) += hid-monterey.o | ||
2037 | diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c | ||
2038 | index dfaccfca0688..77ba023cab95 100644 | ||
2039 | --- a/drivers/hid/hid-core.c | ||
2040 | +++ b/drivers/hid/hid-core.c | ||
2041 | @@ -1811,6 +1811,7 @@ static const struct hid_device_id hid_have_special_driver[] = { | ||
2042 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X) }, | ||
2043 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2) }, | ||
2044 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X) }, | ||
2045 | + { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_PENSKETCH_M912) }, | ||
2046 | { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, | ||
2047 | { HID_USB_DEVICE(USB_VENDOR_ID_LCPOWER, USB_DEVICE_ID_LCPOWER_LC1000 ) }, | ||
2048 | #if IS_ENABLED(CONFIG_HID_LENOVO) | ||
2049 | @@ -1823,6 +1824,7 @@ static const struct hid_device_id hid_have_special_driver[] = { | ||
2050 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2) }, | ||
2051 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RECEIVER) }, | ||
2052 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_PS3) }, | ||
2053 | + { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_T651) }, | ||
2054 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_DESKTOP) }, | ||
2055 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_EDGE) }, | ||
2056 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_MINI) }, | ||
2057 | @@ -1858,6 +1860,7 @@ static const struct hid_device_id hid_have_special_driver[] = { | ||
2058 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) }, | ||
2059 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K) }, | ||
2060 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP) }, | ||
2061 | + { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE7K) }, | ||
2062 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K) }, | ||
2063 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) }, | ||
2064 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) }, | ||
2065 | @@ -1909,6 +1912,7 @@ static const struct hid_device_id hid_have_special_driver[] = { | ||
2066 | #endif | ||
2067 | #if IS_ENABLED(CONFIG_HID_SAITEK) | ||
2068 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000) }, | ||
2069 | + { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7_OLD) }, | ||
2070 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7) }, | ||
2071 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7) }, | ||
2072 | #endif | ||
2073 | @@ -1954,6 +1958,7 @@ static const struct hid_device_id hid_have_special_driver[] = { | ||
2074 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_3_PRO) }, | ||
2075 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_DUAL_BOX_PRO) }, | ||
2076 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_5_PRO) }, | ||
2077 | + { HID_USB_DEVICE(USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII) }, | ||
2078 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH) }, | ||
2079 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH) }, | ||
2080 | { HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_Q_PAD) }, | ||
2081 | diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h | ||
2082 | index 0e28190480d7..07e19295fad9 100644 | ||
2083 | --- a/drivers/hid/hid-ids.h | ||
2084 | +++ b/drivers/hid/hid-ids.h | ||
2085 | @@ -164,6 +164,7 @@ | ||
2086 | #define USB_DEVICE_ID_ATEN_2PORTKVM 0x2204 | ||
2087 | #define USB_DEVICE_ID_ATEN_4PORTKVM 0x2205 | ||
2088 | #define USB_DEVICE_ID_ATEN_4PORTKVMC 0x2208 | ||
2089 | +#define USB_DEVICE_ID_ATEN_CS682 0x2213 | ||
2090 | |||
2091 | #define USB_VENDOR_ID_ATMEL 0x03eb | ||
2092 | #define USB_DEVICE_ID_ATMEL_MULTITOUCH 0x211c | ||
2093 | @@ -454,6 +455,11 @@ | ||
2094 | #define USB_DEVICE_ID_UGCI_FLYING 0x0020 | ||
2095 | #define USB_DEVICE_ID_UGCI_FIGHTING 0x0030 | ||
2096 | |||
2097 | +#define USB_VENDOR_ID_HP 0x03f0 | ||
2098 | +#define USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0A4A 0x0a4a | ||
2099 | +#define USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0B4A 0x0b4a | ||
2100 | +#define USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE 0x134a | ||
2101 | + | ||
2102 | #define USB_VENDOR_ID_HUION 0x256c | ||
2103 | #define USB_DEVICE_ID_HUION_TABLET 0x006e | ||
2104 | |||
2105 | @@ -528,6 +534,7 @@ | ||
2106 | #define USB_DEVICE_ID_KYE_MOUSEPEN_I608X 0x5011 | ||
2107 | #define USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2 0x501a | ||
2108 | #define USB_DEVICE_ID_KYE_EASYPEN_M610X 0x5013 | ||
2109 | +#define USB_DEVICE_ID_KYE_PENSKETCH_M912 0x5015 | ||
2110 | |||
2111 | #define USB_VENDOR_ID_LABTEC 0x1020 | ||
2112 | #define USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD 0x0006 | ||
2113 | @@ -580,10 +587,15 @@ | ||
2114 | |||
2115 | #define USB_VENDOR_ID_LOGITECH 0x046d | ||
2116 | #define USB_DEVICE_ID_LOGITECH_AUDIOHUB 0x0a0e | ||
2117 | +#define USB_DEVICE_ID_LOGITECH_T651 0xb00c | ||
2118 | +#define USB_DEVICE_ID_LOGITECH_C077 0xc007 | ||
2119 | #define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101 | ||
2120 | #define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST 0xc110 | ||
2121 | #define USB_DEVICE_ID_LOGITECH_HARMONY_LAST 0xc14f | ||
2122 | #define USB_DEVICE_ID_LOGITECH_HARMONY_PS3 0x0306 | ||
2123 | +#define USB_DEVICE_ID_LOGITECH_MOUSE_C01A 0xc01a | ||
2124 | +#define USB_DEVICE_ID_LOGITECH_MOUSE_C05A 0xc05a | ||
2125 | +#define USB_DEVICE_ID_LOGITECH_MOUSE_C06A 0xc06a | ||
2126 | #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD_CORD 0xc20a | ||
2127 | #define USB_DEVICE_ID_LOGITECH_RUMBLEPAD 0xc211 | ||
2128 | #define USB_DEVICE_ID_LOGITECH_EXTREME_3D 0xc215 | ||
2129 | @@ -646,6 +658,7 @@ | ||
2130 | #define USB_DEVICE_ID_MS_LK6K 0x00f9 | ||
2131 | #define USB_DEVICE_ID_MS_PRESENTER_8K_BT 0x0701 | ||
2132 | #define USB_DEVICE_ID_MS_PRESENTER_8K_USB 0x0713 | ||
2133 | +#define USB_DEVICE_ID_MS_NE7K 0x071d | ||
2134 | #define USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K 0x0730 | ||
2135 | #define USB_DEVICE_ID_MS_COMFORT_MOUSE_4500 0x076c | ||
2136 | #define USB_DEVICE_ID_MS_SURFACE_PRO_2 0x0799 | ||
2137 | @@ -787,6 +800,7 @@ | ||
2138 | #define USB_VENDOR_ID_SAITEK 0x06a3 | ||
2139 | #define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17 | ||
2140 | #define USB_DEVICE_ID_SAITEK_PS1000 0x0621 | ||
2141 | +#define USB_DEVICE_ID_SAITEK_RAT7_OLD 0x0ccb | ||
2142 | #define USB_DEVICE_ID_SAITEK_RAT7 0x0cd7 | ||
2143 | #define USB_DEVICE_ID_SAITEK_MMO7 0x0cd0 | ||
2144 | |||
2145 | @@ -997,10 +1011,18 @@ | ||
2146 | #define USB_DEVICE_ID_ZYTRONIC_ZXY100 0x0005 | ||
2147 | |||
2148 | #define USB_VENDOR_ID_PRIMAX 0x0461 | ||
2149 | +#define USB_DEVICE_ID_PRIMAX_MOUSE_4D22 0x4d22 | ||
2150 | #define USB_DEVICE_ID_PRIMAX_KEYBOARD 0x4e05 | ||
2151 | |||
2152 | |||
2153 | #define USB_VENDOR_ID_RISO_KAGAKU 0x1294 /* Riso Kagaku Corp. */ | ||
2154 | #define USB_DEVICE_ID_RI_KA_WEBMAIL 0x1320 /* Webmail Notifier */ | ||
2155 | |||
2156 | +#define USB_VENDOR_ID_MULTIPLE_1781 0x1781 | ||
2157 | +#define USB_DEVICE_ID_RAPHNET_4NES4SNES_OLD 0x0a8d | ||
2158 | + | ||
2159 | +#define USB_VENDOR_ID_DRACAL_RAPHNET 0x289b | ||
2160 | +#define USB_DEVICE_ID_RAPHNET_2NES2SNES 0x0002 | ||
2161 | +#define USB_DEVICE_ID_RAPHNET_4NES4SNES 0x0003 | ||
2162 | + | ||
2163 | #endif | ||
2164 | diff --git a/drivers/hid/hid-kye.c b/drivers/hid/hid-kye.c | ||
2165 | index 158fcf577fae..32e6d8d9ded0 100644 | ||
2166 | --- a/drivers/hid/hid-kye.c | ||
2167 | +++ b/drivers/hid/hid-kye.c | ||
2168 | @@ -268,6 +268,137 @@ static __u8 easypen_m610x_rdesc_fixed[] = { | ||
2169 | 0xC0 /* End Collection */ | ||
2170 | }; | ||
2171 | |||
2172 | + | ||
2173 | +/* Original PenSketch M912 report descriptor size */ | ||
2174 | +#define PENSKETCH_M912_RDESC_ORIG_SIZE 482 | ||
2175 | + | ||
2176 | +/* Fixed PenSketch M912 report descriptor */ | ||
2177 | +static __u8 pensketch_m912_rdesc_fixed[] = { | ||
2178 | + 0x05, 0x01, /* Usage Page (Desktop), */ | ||
2179 | + 0x08, /* Usage (00h), */ | ||
2180 | + 0xA1, 0x01, /* Collection (Application), */ | ||
2181 | + 0x85, 0x05, /* Report ID (5), */ | ||
2182 | + 0x06, 0x00, 0xFF, /* Usage Page (FF00h), */ | ||
2183 | + 0x09, 0x01, /* Usage (01h), */ | ||
2184 | + 0x15, 0x81, /* Logical Minimum (-127), */ | ||
2185 | + 0x25, 0x7F, /* Logical Maximum (127), */ | ||
2186 | + 0x75, 0x08, /* Report Size (8), */ | ||
2187 | + 0x95, 0x07, /* Report Count (7), */ | ||
2188 | + 0xB1, 0x02, /* Feature (Variable), */ | ||
2189 | + 0xC0, /* End Collection, */ | ||
2190 | + 0x05, 0x0D, /* Usage Page (Digitizer), */ | ||
2191 | + 0x09, 0x02, /* Usage (Pen), */ | ||
2192 | + 0xA1, 0x01, /* Collection (Application), */ | ||
2193 | + 0x85, 0x10, /* Report ID (16), */ | ||
2194 | + 0x09, 0x20, /* Usage (Stylus), */ | ||
2195 | + 0xA0, /* Collection (Physical), */ | ||
2196 | + 0x09, 0x42, /* Usage (Tip Switch), */ | ||
2197 | + 0x09, 0x44, /* Usage (Barrel Switch), */ | ||
2198 | + 0x09, 0x46, /* Usage (Tablet Pick), */ | ||
2199 | + 0x14, /* Logical Minimum (0), */ | ||
2200 | + 0x25, 0x01, /* Logical Maximum (1), */ | ||
2201 | + 0x75, 0x01, /* Report Size (1), */ | ||
2202 | + 0x95, 0x03, /* Report Count (3), */ | ||
2203 | + 0x81, 0x02, /* Input (Variable), */ | ||
2204 | + 0x95, 0x04, /* Report Count (4), */ | ||
2205 | + 0x81, 0x03, /* Input (Constant, Variable), */ | ||
2206 | + 0x09, 0x32, /* Usage (In Range), */ | ||
2207 | + 0x95, 0x01, /* Report Count (1), */ | ||
2208 | + 0x81, 0x02, /* Input (Variable), */ | ||
2209 | + 0x75, 0x10, /* Report Size (16), */ | ||
2210 | + 0x95, 0x01, /* Report Count (1), */ | ||
2211 | + 0xA4, /* Push, */ | ||
2212 | + 0x05, 0x01, /* Usage Page (Desktop), */ | ||
2213 | + 0x55, 0xFD, /* Unit Exponent (-3), */ | ||
2214 | + 0x65, 0x13, /* Unit (Inch), */ | ||
2215 | + 0x14, /* Logical Minimum (0), */ | ||
2216 | + 0x34, /* Physical Minimum (0), */ | ||
2217 | + 0x09, 0x30, /* Usage (X), */ | ||
2218 | + 0x27, 0x00, 0xF0, 0x00, 0x00, /* Logical Maximum (61440), */ | ||
2219 | + 0x46, 0xE0, 0x2E, /* Physical Maximum (12000), */ | ||
2220 | + 0x81, 0x02, /* Input (Variable), */ | ||
2221 | + 0x09, 0x31, /* Usage (Y), */ | ||
2222 | + 0x27, 0x00, 0xB4, 0x00, 0x00, /* Logical Maximum (46080), */ | ||
2223 | + 0x46, 0x28, 0x23, /* Physical Maximum (9000), */ | ||
2224 | + 0x81, 0x02, /* Input (Variable), */ | ||
2225 | + 0xB4, /* Pop, */ | ||
2226 | + 0x09, 0x30, /* Usage (Tip Pressure), */ | ||
2227 | + 0x14, /* Logical Minimum (0), */ | ||
2228 | + 0x26, 0xFF, 0x07, /* Logical Maximum (2047), */ | ||
2229 | + 0x81, 0x02, /* Input (Variable), */ | ||
2230 | + 0xC0, /* End Collection, */ | ||
2231 | + 0xC0, /* End Collection, */ | ||
2232 | + 0x05, 0x0D, /* Usage Page (Digitizer), */ | ||
2233 | + 0x09, 0x21, /* Usage (Puck), */ | ||
2234 | + 0xA1, 0x01, /* Collection (Application), */ | ||
2235 | + 0x85, 0x11, /* Report ID (17), */ | ||
2236 | + 0x09, 0x21, /* Usage (Puck), */ | ||
2237 | + 0xA0, /* Collection (Physical), */ | ||
2238 | + 0x05, 0x09, /* Usage Page (Button), */ | ||
2239 | + 0x75, 0x01, /* Report Size (1), */ | ||
2240 | + 0x19, 0x01, /* Usage Minimum (01h), */ | ||
2241 | + 0x29, 0x03, /* Usage Maximum (03h), */ | ||
2242 | + 0x14, /* Logical Minimum (0), */ | ||
2243 | + 0x25, 0x01, /* Logical Maximum (1), */ | ||
2244 | + 0x95, 0x03, /* Report Count (3), */ | ||
2245 | + 0x81, 0x02, /* Input (Variable), */ | ||
2246 | + 0x95, 0x04, /* Report Count (4), */ | ||
2247 | + 0x81, 0x01, /* Input (Constant), */ | ||
2248 | + 0x95, 0x01, /* Report Count (1), */ | ||
2249 | + 0x0B, 0x32, 0x00, 0x0D, 0x00, /* Usage (Digitizer In Range), */ | ||
2250 | + 0x14, /* Logical Minimum (0), */ | ||
2251 | + 0x25, 0x01, /* Logical Maximum (1), */ | ||
2252 | + 0x81, 0x02, /* Input (Variable), */ | ||
2253 | + 0xA4, /* Push, */ | ||
2254 | + 0x05, 0x01, /* Usage Page (Desktop), */ | ||
2255 | + 0x75, 0x10, /* Report Size (16), */ | ||
2256 | + 0x95, 0x01, /* Report Count (1), */ | ||
2257 | + 0x55, 0xFD, /* Unit Exponent (-3), */ | ||
2258 | + 0x65, 0x13, /* Unit (Inch), */ | ||
2259 | + 0x14, /* Logical Minimum (0), */ | ||
2260 | + 0x34, /* Physical Minimum (0), */ | ||
2261 | + 0x09, 0x30, /* Usage (X), */ | ||
2262 | + 0x27, 0x00, 0xF0, 0x00, 0x00, /* Logical Maximum (61440), */ | ||
2263 | + 0x46, 0xE0, 0x2E, /* Physical Maximum (12000), */ | ||
2264 | + 0x81, 0x02, /* Input (Variable), */ | ||
2265 | + 0x09, 0x31, /* Usage (Y), */ | ||
2266 | + 0x27, 0x00, 0xB4, 0x00, 0x00, /* Logical Maximum (46080), */ | ||
2267 | + 0x46, 0x28, 0x23, /* Physical Maximum (9000), */ | ||
2268 | + 0x81, 0x02, /* Input (Variable), */ | ||
2269 | + 0x09, 0x38, /* Usage (Wheel), */ | ||
2270 | + 0x75, 0x08, /* Report Size (8), */ | ||
2271 | + 0x95, 0x01, /* Report Count (1), */ | ||
2272 | + 0x15, 0xFF, /* Logical Minimum (-1), */ | ||
2273 | + 0x25, 0x01, /* Logical Maximum (1), */ | ||
2274 | + 0x34, /* Physical Minimum (0), */ | ||
2275 | + 0x44, /* Physical Maximum (0), */ | ||
2276 | + 0x81, 0x06, /* Input (Variable, Relative), */ | ||
2277 | + 0xB4, /* Pop, */ | ||
2278 | + 0xC0, /* End Collection, */ | ||
2279 | + 0xC0, /* End Collection, */ | ||
2280 | + 0x05, 0x0C, /* Usage Page (Consumer), */ | ||
2281 | + 0x09, 0x01, /* Usage (Consumer Control), */ | ||
2282 | + 0xA1, 0x01, /* Collection (Application), */ | ||
2283 | + 0x85, 0x12, /* Report ID (18), */ | ||
2284 | + 0x14, /* Logical Minimum (0), */ | ||
2285 | + 0x25, 0x01, /* Logical Maximum (1), */ | ||
2286 | + 0x75, 0x01, /* Report Size (1), */ | ||
2287 | + 0x95, 0x08, /* Report Count (8), */ | ||
2288 | + 0x05, 0x0C, /* Usage Page (Consumer), */ | ||
2289 | + 0x0A, 0x6A, 0x02, /* Usage (AC Delete), */ | ||
2290 | + 0x0A, 0x1A, 0x02, /* Usage (AC Undo), */ | ||
2291 | + 0x0A, 0x01, 0x02, /* Usage (AC New), */ | ||
2292 | + 0x0A, 0x2F, 0x02, /* Usage (AC Zoom), */ | ||
2293 | + 0x0A, 0x25, 0x02, /* Usage (AC Forward), */ | ||
2294 | + 0x0A, 0x24, 0x02, /* Usage (AC Back), */ | ||
2295 | + 0x0A, 0x2D, 0x02, /* Usage (AC Zoom In), */ | ||
2296 | + 0x0A, 0x2E, 0x02, /* Usage (AC Zoom Out), */ | ||
2297 | + 0x81, 0x02, /* Input (Variable), */ | ||
2298 | + 0x95, 0x30, /* Report Count (48), */ | ||
2299 | + 0x81, 0x03, /* Input (Constant, Variable), */ | ||
2300 | + 0xC0 /* End Collection */ | ||
2301 | +}; | ||
2302 | + | ||
2303 | static __u8 *kye_consumer_control_fixup(struct hid_device *hdev, __u8 *rdesc, | ||
2304 | unsigned int *rsize, int offset, const char *device_name) { | ||
2305 | /* | ||
2306 | @@ -335,6 +466,12 @@ static __u8 *kye_report_fixup(struct hid_device *hdev, __u8 *rdesc, | ||
2307 | *rsize = sizeof(easypen_m610x_rdesc_fixed); | ||
2308 | } | ||
2309 | break; | ||
2310 | + case USB_DEVICE_ID_KYE_PENSKETCH_M912: | ||
2311 | + if (*rsize == PENSKETCH_M912_RDESC_ORIG_SIZE) { | ||
2312 | + rdesc = pensketch_m912_rdesc_fixed; | ||
2313 | + *rsize = sizeof(pensketch_m912_rdesc_fixed); | ||
2314 | + } | ||
2315 | + break; | ||
2316 | case USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE: | ||
2317 | rdesc = kye_consumer_control_fixup(hdev, rdesc, rsize, 104, | ||
2318 | "Genius Gila Gaming Mouse"); | ||
2319 | @@ -418,6 +555,7 @@ static int kye_probe(struct hid_device *hdev, const struct hid_device_id *id) | ||
2320 | case USB_DEVICE_ID_KYE_MOUSEPEN_I608X: | ||
2321 | case USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2: | ||
2322 | case USB_DEVICE_ID_KYE_EASYPEN_M610X: | ||
2323 | + case USB_DEVICE_ID_KYE_PENSKETCH_M912: | ||
2324 | ret = kye_tablet_enable(hdev); | ||
2325 | if (ret) { | ||
2326 | hid_err(hdev, "tablet enabling failed\n"); | ||
2327 | @@ -457,6 +595,8 @@ static const struct hid_device_id kye_devices[] = { | ||
2328 | USB_DEVICE_ID_GENIUS_GX_IMPERATOR) }, | ||
2329 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, | ||
2330 | USB_DEVICE_ID_GENIUS_MANTICORE) }, | ||
2331 | + { HID_USB_DEVICE(USB_VENDOR_ID_KYE, | ||
2332 | + USB_DEVICE_ID_KYE_PENSKETCH_M912) }, | ||
2333 | { } | ||
2334 | }; | ||
2335 | MODULE_DEVICE_TABLE(hid, kye_devices); | ||
2336 | diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c | ||
2337 | new file mode 100644 | ||
2338 | index 000000000000..7dd9163f7e03 | ||
2339 | --- /dev/null | ||
2340 | +++ b/drivers/hid/hid-logitech-hidpp.c | ||
2341 | @@ -0,0 +1,842 @@ | ||
2342 | +/* | ||
2343 | + * HIDPP protocol for Logitech Unifying receivers | ||
2344 | + * | ||
2345 | + * Copyright (c) 2011 Logitech (c) | ||
2346 | + * Copyright (c) 2012-2013 Google (c) | ||
2347 | + * Copyright (c) 2013-2014 Red Hat Inc. | ||
2348 | + */ | ||
2349 | + | ||
2350 | +/* | ||
2351 | + * This program is free software; you can redistribute it and/or modify it | ||
2352 | + * under the terms of the GNU General Public License as published by the Free | ||
2353 | + * Software Foundation; version 2 of the License. | ||
2354 | + */ | ||
2355 | + | ||
2356 | +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
2357 | + | ||
2358 | +#include <linux/device.h> | ||
2359 | +#include <linux/hid.h> | ||
2360 | +#include <linux/module.h> | ||
2361 | +#include <linux/slab.h> | ||
2362 | +#include <linux/sched.h> | ||
2363 | +#include <linux/kfifo.h> | ||
2364 | +#include <linux/input/mt.h> | ||
2365 | +#include <asm/unaligned.h> | ||
2366 | +#include "hid-ids.h" | ||
2367 | + | ||
2368 | +MODULE_LICENSE("GPL"); | ||
2369 | +MODULE_AUTHOR("Benjamin Tissoires <benjamin.tissoires@gmail.com>"); | ||
2370 | +MODULE_AUTHOR("Nestor Lopez Casado <nlopezcasad@logitech.com>"); | ||
2371 | + | ||
2372 | +#define REPORT_ID_HIDPP_SHORT 0x10 | ||
2373 | +#define REPORT_ID_HIDPP_LONG 0x11 | ||
2374 | + | ||
2375 | +#define HIDPP_REPORT_SHORT_LENGTH 7 | ||
2376 | +#define HIDPP_REPORT_LONG_LENGTH 20 | ||
2377 | + | ||
2378 | +#define HIDPP_QUIRK_CLASS_WTP BIT(0) | ||
2379 | + | ||
2380 | +/* | ||
2381 | + * There are two hidpp protocols in use, the first version hidpp10 is known | ||
2382 | + * as register access protocol or RAP, the second version hidpp20 is known as | ||
2383 | + * feature access protocol or FAP | ||
2384 | + * | ||
2385 | + * Most older devices (including the Unifying usb receiver) use the RAP protocol | ||
2386 | + * where as most newer devices use the FAP protocol. Both protocols are | ||
2387 | + * compatible with the underlying transport, which could be usb, Unifiying, or | ||
2388 | + * bluetooth. The message lengths are defined by the hid vendor specific report | ||
2389 | + * descriptor for the HIDPP_SHORT report type (total message lenth 7 bytes) and | ||
2390 | + * the HIDPP_LONG report type (total message length 20 bytes) | ||
2391 | + * | ||
2392 | + * The RAP protocol uses both report types, whereas the FAP only uses HIDPP_LONG | ||
2393 | + * messages. The Unifying receiver itself responds to RAP messages (device index | ||
2394 | + * is 0xFF for the receiver), and all messages (short or long) with a device | ||
2395 | + * index between 1 and 6 are passed untouched to the corresponding paired | ||
2396 | + * Unifying device. | ||
2397 | + * | ||
2398 | + * The paired device can be RAP or FAP, it will receive the message untouched | ||
2399 | + * from the Unifiying receiver. | ||
2400 | + */ | ||
2401 | + | ||
2402 | +struct fap { | ||
2403 | + u8 feature_index; | ||
2404 | + u8 funcindex_clientid; | ||
2405 | + u8 params[HIDPP_REPORT_LONG_LENGTH - 4U]; | ||
2406 | +}; | ||
2407 | + | ||
2408 | +struct rap { | ||
2409 | + u8 sub_id; | ||
2410 | + u8 reg_address; | ||
2411 | + u8 params[HIDPP_REPORT_LONG_LENGTH - 4U]; | ||
2412 | +}; | ||
2413 | + | ||
2414 | +struct hidpp_report { | ||
2415 | + u8 report_id; | ||
2416 | + u8 device_index; | ||
2417 | + union { | ||
2418 | + struct fap fap; | ||
2419 | + struct rap rap; | ||
2420 | + u8 rawbytes[sizeof(struct fap)]; | ||
2421 | + }; | ||
2422 | +} __packed; | ||
2423 | + | ||
2424 | +struct hidpp_device { | ||
2425 | + struct hid_device *hid_dev; | ||
2426 | + struct mutex send_mutex; | ||
2427 | + void *send_receive_buf; | ||
2428 | + wait_queue_head_t wait; | ||
2429 | + bool answer_available; | ||
2430 | + u8 protocol_major; | ||
2431 | + u8 protocol_minor; | ||
2432 | + | ||
2433 | + void *private_data; | ||
2434 | + | ||
2435 | + unsigned long quirks; | ||
2436 | +}; | ||
2437 | + | ||
2438 | + | ||
2439 | +#define HIDPP_ERROR 0x8f | ||
2440 | +#define HIDPP_ERROR_SUCCESS 0x00 | ||
2441 | +#define HIDPP_ERROR_INVALID_SUBID 0x01 | ||
2442 | +#define HIDPP_ERROR_INVALID_ADRESS 0x02 | ||
2443 | +#define HIDPP_ERROR_INVALID_VALUE 0x03 | ||
2444 | +#define HIDPP_ERROR_CONNECT_FAIL 0x04 | ||
2445 | +#define HIDPP_ERROR_TOO_MANY_DEVICES 0x05 | ||
2446 | +#define HIDPP_ERROR_ALREADY_EXISTS 0x06 | ||
2447 | +#define HIDPP_ERROR_BUSY 0x07 | ||
2448 | +#define HIDPP_ERROR_UNKNOWN_DEVICE 0x08 | ||
2449 | +#define HIDPP_ERROR_RESOURCE_ERROR 0x09 | ||
2450 | +#define HIDPP_ERROR_REQUEST_UNAVAILABLE 0x0a | ||
2451 | +#define HIDPP_ERROR_INVALID_PARAM_VALUE 0x0b | ||
2452 | +#define HIDPP_ERROR_WRONG_PIN_CODE 0x0c | ||
2453 | + | ||
2454 | +static int __hidpp_send_report(struct hid_device *hdev, | ||
2455 | + struct hidpp_report *hidpp_report) | ||
2456 | +{ | ||
2457 | + int fields_count, ret; | ||
2458 | + | ||
2459 | + switch (hidpp_report->report_id) { | ||
2460 | + case REPORT_ID_HIDPP_SHORT: | ||
2461 | + fields_count = HIDPP_REPORT_SHORT_LENGTH; | ||
2462 | + break; | ||
2463 | + case REPORT_ID_HIDPP_LONG: | ||
2464 | + fields_count = HIDPP_REPORT_LONG_LENGTH; | ||
2465 | + break; | ||
2466 | + default: | ||
2467 | + return -ENODEV; | ||
2468 | + } | ||
2469 | + | ||
2470 | + /* | ||
2471 | + * set the device_index as the receiver, it will be overwritten by | ||
2472 | + * hid_hw_request if needed | ||
2473 | + */ | ||
2474 | + hidpp_report->device_index = 0xff; | ||
2475 | + | ||
2476 | + ret = hid_hw_raw_request(hdev, hidpp_report->report_id, | ||
2477 | + (u8 *)hidpp_report, fields_count, HID_OUTPUT_REPORT, | ||
2478 | + HID_REQ_SET_REPORT); | ||
2479 | + | ||
2480 | + return ret == fields_count ? 0 : -1; | ||
2481 | +} | ||
2482 | + | ||
2483 | +static int hidpp_send_message_sync(struct hidpp_device *hidpp, | ||
2484 | + struct hidpp_report *message, | ||
2485 | + struct hidpp_report *response) | ||
2486 | +{ | ||
2487 | + int ret; | ||
2488 | + | ||
2489 | + mutex_lock(&hidpp->send_mutex); | ||
2490 | + | ||
2491 | + hidpp->send_receive_buf = response; | ||
2492 | + hidpp->answer_available = false; | ||
2493 | + | ||
2494 | + /* | ||
2495 | + * So that we can later validate the answer when it arrives | ||
2496 | + * in hidpp_raw_event | ||
2497 | + */ | ||
2498 | + *response = *message; | ||
2499 | + | ||
2500 | + ret = __hidpp_send_report(hidpp->hid_dev, message); | ||
2501 | + | ||
2502 | + if (ret) { | ||
2503 | + dbg_hid("__hidpp_send_report returned err: %d\n", ret); | ||
2504 | + memset(response, 0, sizeof(struct hidpp_report)); | ||
2505 | + goto exit; | ||
2506 | + } | ||
2507 | + | ||
2508 | + if (!wait_event_timeout(hidpp->wait, hidpp->answer_available, | ||
2509 | + 5*HZ)) { | ||
2510 | + dbg_hid("%s:timeout waiting for response\n", __func__); | ||
2511 | + memset(response, 0, sizeof(struct hidpp_report)); | ||
2512 | + ret = -ETIMEDOUT; | ||
2513 | + } | ||
2514 | + | ||
2515 | + if (response->report_id == REPORT_ID_HIDPP_SHORT && | ||
2516 | + response->fap.feature_index == HIDPP_ERROR) { | ||
2517 | + ret = response->fap.params[1]; | ||
2518 | + dbg_hid("__hidpp_send_report got hidpp error %02X\n", ret); | ||
2519 | + goto exit; | ||
2520 | + } | ||
2521 | + | ||
2522 | +exit: | ||
2523 | + mutex_unlock(&hidpp->send_mutex); | ||
2524 | + return ret; | ||
2525 | + | ||
2526 | +} | ||
2527 | + | ||
2528 | +static int hidpp_send_fap_command_sync(struct hidpp_device *hidpp, | ||
2529 | + u8 feat_index, u8 funcindex_clientid, u8 *params, int param_count, | ||
2530 | + struct hidpp_report *response) | ||
2531 | +{ | ||
2532 | + struct hidpp_report *message = kzalloc(sizeof(struct hidpp_report), | ||
2533 | + GFP_KERNEL); | ||
2534 | + int ret; | ||
2535 | + | ||
2536 | + if (param_count > sizeof(message->fap.params)) | ||
2537 | + return -EINVAL; | ||
2538 | + | ||
2539 | + message->report_id = REPORT_ID_HIDPP_LONG; | ||
2540 | + message->fap.feature_index = feat_index; | ||
2541 | + message->fap.funcindex_clientid = funcindex_clientid; | ||
2542 | + memcpy(&message->fap.params, params, param_count); | ||
2543 | + | ||
2544 | + ret = hidpp_send_message_sync(hidpp, message, response); | ||
2545 | + kfree(message); | ||
2546 | + return ret; | ||
2547 | +} | ||
2548 | + | ||
2549 | +static inline bool hidpp_match_answer(struct hidpp_report *question, | ||
2550 | + struct hidpp_report *answer) | ||
2551 | +{ | ||
2552 | + return (answer->fap.feature_index == question->fap.feature_index) && | ||
2553 | + (answer->fap.funcindex_clientid == question->fap.funcindex_clientid); | ||
2554 | +} | ||
2555 | + | ||
2556 | +static inline bool hidpp_match_error(struct hidpp_report *question, | ||
2557 | + struct hidpp_report *answer) | ||
2558 | +{ | ||
2559 | + return (answer->fap.feature_index == HIDPP_ERROR) && | ||
2560 | + (answer->fap.funcindex_clientid == question->fap.feature_index) && | ||
2561 | + (answer->fap.params[0] == question->fap.funcindex_clientid); | ||
2562 | +} | ||
2563 | + | ||
2564 | +/* -------------------------------------------------------------------------- */ | ||
2565 | +/* 0x0000: Root */ | ||
2566 | +/* -------------------------------------------------------------------------- */ | ||
2567 | + | ||
2568 | +#define HIDPP_PAGE_ROOT 0x0000 | ||
2569 | +#define HIDPP_PAGE_ROOT_IDX 0x00 | ||
2570 | + | ||
2571 | +#define CMD_ROOT_GET_FEATURE 0x01 | ||
2572 | +#define CMD_ROOT_GET_PROTOCOL_VERSION 0x11 | ||
2573 | + | ||
2574 | +static int hidpp_root_get_feature(struct hidpp_device *hidpp, u16 feature, | ||
2575 | + u8 *feature_index, u8 *feature_type) | ||
2576 | +{ | ||
2577 | + struct hidpp_report response; | ||
2578 | + int ret; | ||
2579 | + u8 params[2] = { feature >> 8, feature & 0x00FF }; | ||
2580 | + | ||
2581 | + ret = hidpp_send_fap_command_sync(hidpp, | ||
2582 | + HIDPP_PAGE_ROOT_IDX, | ||
2583 | + CMD_ROOT_GET_FEATURE, | ||
2584 | + params, 2, &response); | ||
2585 | + if (ret) | ||
2586 | + return ret; | ||
2587 | + | ||
2588 | + *feature_index = response.fap.params[0]; | ||
2589 | + *feature_type = response.fap.params[1]; | ||
2590 | + | ||
2591 | + return ret; | ||
2592 | +} | ||
2593 | + | ||
2594 | +static int hidpp_root_get_protocol_version(struct hidpp_device *hidpp) | ||
2595 | +{ | ||
2596 | + struct hidpp_report response; | ||
2597 | + int ret; | ||
2598 | + | ||
2599 | + ret = hidpp_send_fap_command_sync(hidpp, | ||
2600 | + HIDPP_PAGE_ROOT_IDX, | ||
2601 | + CMD_ROOT_GET_PROTOCOL_VERSION, | ||
2602 | + NULL, 0, &response); | ||
2603 | + | ||
2604 | + if (ret == 1) { | ||
2605 | + hidpp->protocol_major = 1; | ||
2606 | + hidpp->protocol_minor = 0; | ||
2607 | + return 0; | ||
2608 | + } | ||
2609 | + | ||
2610 | + if (ret) | ||
2611 | + return -ret; | ||
2612 | + | ||
2613 | + hidpp->protocol_major = response.fap.params[0]; | ||
2614 | + hidpp->protocol_minor = response.fap.params[1]; | ||
2615 | + | ||
2616 | + return ret; | ||
2617 | +} | ||
2618 | + | ||
2619 | +static bool hidpp_is_connected(struct hidpp_device *hidpp) | ||
2620 | +{ | ||
2621 | + int ret; | ||
2622 | + | ||
2623 | + ret = hidpp_root_get_protocol_version(hidpp); | ||
2624 | + if (!ret) | ||
2625 | + hid_dbg(hidpp->hid_dev, "HID++ %u.%u device connected.\n", | ||
2626 | + hidpp->protocol_major, hidpp->protocol_minor); | ||
2627 | + return ret == 0; | ||
2628 | +} | ||
2629 | + | ||
2630 | +/* -------------------------------------------------------------------------- */ | ||
2631 | +/* 0x0005: GetDeviceNameType */ | ||
2632 | +/* -------------------------------------------------------------------------- */ | ||
2633 | + | ||
2634 | +#define HIDPP_PAGE_GET_DEVICE_NAME_TYPE 0x0005 | ||
2635 | + | ||
2636 | +#define CMD_GET_DEVICE_NAME_TYPE_GET_COUNT 0x01 | ||
2637 | +#define CMD_GET_DEVICE_NAME_TYPE_GET_DEVICE_NAME 0x11 | ||
2638 | +#define CMD_GET_DEVICE_NAME_TYPE_GET_TYPE 0x21 | ||
2639 | + | ||
2640 | +static int hidpp_devicenametype_get_count(struct hidpp_device *hidpp, | ||
2641 | + u8 feature_index, u8 *nameLength) | ||
2642 | +{ | ||
2643 | + struct hidpp_report response; | ||
2644 | + int ret; | ||
2645 | + | ||
2646 | + ret = hidpp_send_fap_command_sync(hidpp, feature_index, | ||
2647 | + CMD_GET_DEVICE_NAME_TYPE_GET_COUNT, NULL, 0, &response); | ||
2648 | + | ||
2649 | + if (ret) | ||
2650 | + return -ret; | ||
2651 | + | ||
2652 | + *nameLength = response.fap.params[0]; | ||
2653 | + | ||
2654 | + return ret; | ||
2655 | +} | ||
2656 | + | ||
2657 | +static int hidpp_devicenametype_get_device_name(struct hidpp_device *hidpp, | ||
2658 | + u8 feature_index, u8 char_index, char *device_name, int len_buf) | ||
2659 | +{ | ||
2660 | + struct hidpp_report response; | ||
2661 | + int ret, i; | ||
2662 | + int count; | ||
2663 | + | ||
2664 | + ret = hidpp_send_fap_command_sync(hidpp, feature_index, | ||
2665 | + CMD_GET_DEVICE_NAME_TYPE_GET_DEVICE_NAME, &char_index, 1, | ||
2666 | + &response); | ||
2667 | + | ||
2668 | + if (ret) | ||
2669 | + return -ret; | ||
2670 | + | ||
2671 | + if (response.report_id == REPORT_ID_HIDPP_LONG) | ||
2672 | + count = HIDPP_REPORT_LONG_LENGTH - 4; | ||
2673 | + else | ||
2674 | + count = HIDPP_REPORT_SHORT_LENGTH - 4; | ||
2675 | + | ||
2676 | + if (len_buf < count) | ||
2677 | + count = len_buf; | ||
2678 | + | ||
2679 | + for (i = 0; i < count; i++) | ||
2680 | + device_name[i] = response.fap.params[i]; | ||
2681 | + | ||
2682 | + return count; | ||
2683 | +} | ||
2684 | + | ||
2685 | +static char *hidpp_get_device_name(struct hidpp_device *hidpp, u8 *name_length) | ||
2686 | +{ | ||
2687 | + u8 feature_type; | ||
2688 | + u8 feature_index; | ||
2689 | + u8 __name_length; | ||
2690 | + char *name; | ||
2691 | + unsigned index = 0; | ||
2692 | + int ret; | ||
2693 | + | ||
2694 | + ret = hidpp_root_get_feature(hidpp, HIDPP_PAGE_GET_DEVICE_NAME_TYPE, | ||
2695 | + &feature_index, &feature_type); | ||
2696 | + if (ret) | ||
2697 | + goto out_err; | ||
2698 | + | ||
2699 | + ret = hidpp_devicenametype_get_count(hidpp, feature_index, | ||
2700 | + &__name_length); | ||
2701 | + if (ret) | ||
2702 | + goto out_err; | ||
2703 | + | ||
2704 | + name = kzalloc(__name_length + 1, GFP_KERNEL); | ||
2705 | + if (!name) | ||
2706 | + goto out_err; | ||
2707 | + | ||
2708 | + *name_length = __name_length + 1; | ||
2709 | + while (index < __name_length) | ||
2710 | + index += hidpp_devicenametype_get_device_name(hidpp, | ||
2711 | + feature_index, index, name + index, | ||
2712 | + __name_length - index); | ||
2713 | + | ||
2714 | + return name; | ||
2715 | + | ||
2716 | +out_err: | ||
2717 | + *name_length = 0; | ||
2718 | + return NULL; | ||
2719 | +} | ||
2720 | + | ||
2721 | +/* -------------------------------------------------------------------------- */ | ||
2722 | +/* 0x6100: TouchPadRawXY */ | ||
2723 | +/* -------------------------------------------------------------------------- */ | ||
2724 | + | ||
2725 | +#define HIDPP_PAGE_TOUCHPAD_RAW_XY 0x6100 | ||
2726 | + | ||
2727 | +#define CMD_TOUCHPAD_GET_RAW_INFO 0x01 | ||
2728 | + | ||
2729 | +#define TOUCHPAD_RAW_XY_ORIGIN_LOWER_LEFT 0x01 | ||
2730 | +#define TOUCHPAD_RAW_XY_ORIGIN_UPPER_LEFT 0x03 | ||
2731 | + | ||
2732 | +struct hidpp_touchpad_raw_info { | ||
2733 | + u16 x_size; | ||
2734 | + u16 y_size; | ||
2735 | + u8 z_range; | ||
2736 | + u8 area_range; | ||
2737 | + u8 timestamp_unit; | ||
2738 | + u8 maxcontacts; | ||
2739 | + u8 origin; | ||
2740 | + u16 res; | ||
2741 | +}; | ||
2742 | + | ||
2743 | +struct hidpp_touchpad_raw_xy_finger { | ||
2744 | + u8 contact_type; | ||
2745 | + u8 contact_status; | ||
2746 | + u16 x; | ||
2747 | + u16 y; | ||
2748 | + u8 z; | ||
2749 | + u8 area; | ||
2750 | + u8 finger_id; | ||
2751 | +}; | ||
2752 | + | ||
2753 | +struct hidpp_touchpad_raw_xy { | ||
2754 | + u16 timestamp; | ||
2755 | + struct hidpp_touchpad_raw_xy_finger fingers[2]; | ||
2756 | + u8 spurious_flag; | ||
2757 | + u8 end_of_frame; | ||
2758 | + u8 finger_count; | ||
2759 | + u8 button; | ||
2760 | +}; | ||
2761 | + | ||
2762 | +static int hidpp_touchpad_get_raw_info(struct hidpp_device *hidpp, | ||
2763 | + u8 feature_index, struct hidpp_touchpad_raw_info *raw_info) | ||
2764 | +{ | ||
2765 | + struct hidpp_report response; | ||
2766 | + int ret; | ||
2767 | + u8 *params = (u8 *)response.fap.params; | ||
2768 | + | ||
2769 | + ret = hidpp_send_fap_command_sync(hidpp, feature_index, | ||
2770 | + CMD_TOUCHPAD_GET_RAW_INFO, NULL, 0, &response); | ||
2771 | + | ||
2772 | + if (ret) | ||
2773 | + return -ret; | ||
2774 | + | ||
2775 | + raw_info->x_size = get_unaligned_be16(¶ms[0]); | ||
2776 | + raw_info->y_size = get_unaligned_be16(¶ms[2]); | ||
2777 | + raw_info->z_range = params[4]; | ||
2778 | + raw_info->area_range = params[5]; | ||
2779 | + raw_info->maxcontacts = params[7]; | ||
2780 | + raw_info->origin = params[8]; | ||
2781 | + /* res is given in unit per inch */ | ||
2782 | + raw_info->res = get_unaligned_be16(¶ms[13]) * 2 / 51; | ||
2783 | + | ||
2784 | + return ret; | ||
2785 | +} | ||
2786 | + | ||
2787 | +/* ************************************************************************** */ | ||
2788 | +/* */ | ||
2789 | +/* Device Support */ | ||
2790 | +/* */ | ||
2791 | +/* ************************************************************************** */ | ||
2792 | + | ||
2793 | +/* -------------------------------------------------------------------------- */ | ||
2794 | +/* Touchpad HID++ devices */ | ||
2795 | +/* -------------------------------------------------------------------------- */ | ||
2796 | + | ||
2797 | +struct wtp_data { | ||
2798 | + struct input_dev *input; | ||
2799 | + u16 x_size, y_size; | ||
2800 | + u8 finger_count; | ||
2801 | + u8 mt_feature_index; | ||
2802 | + u8 button_feature_index; | ||
2803 | + u8 maxcontacts; | ||
2804 | + bool flip_y; | ||
2805 | + unsigned int resolution; | ||
2806 | +}; | ||
2807 | + | ||
2808 | +static int wtp_input_mapping(struct hid_device *hdev, struct hid_input *hi, | ||
2809 | + struct hid_field *field, struct hid_usage *usage, | ||
2810 | + unsigned long **bit, int *max) | ||
2811 | +{ | ||
2812 | + return -1; | ||
2813 | +} | ||
2814 | + | ||
2815 | +static void wtp_input_configured(struct hid_device *hdev, | ||
2816 | + struct hid_input *hidinput) | ||
2817 | +{ | ||
2818 | + struct hidpp_device *hidpp = hid_get_drvdata(hdev); | ||
2819 | + struct wtp_data *wd = hidpp->private_data; | ||
2820 | + struct input_dev *input_dev = hidinput->input; | ||
2821 | + | ||
2822 | + __set_bit(EV_ABS, input_dev->evbit); | ||
2823 | + __set_bit(EV_KEY, input_dev->evbit); | ||
2824 | + __clear_bit(EV_REL, input_dev->evbit); | ||
2825 | + __clear_bit(EV_LED, input_dev->evbit); | ||
2826 | + | ||
2827 | + input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, wd->x_size, 0, 0); | ||
2828 | + input_abs_set_res(input_dev, ABS_MT_POSITION_X, wd->resolution); | ||
2829 | + input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, wd->y_size, 0, 0); | ||
2830 | + input_abs_set_res(input_dev, ABS_MT_POSITION_Y, wd->resolution); | ||
2831 | + | ||
2832 | + /* Max pressure is not given by the devices, pick one */ | ||
2833 | + input_set_abs_params(input_dev, ABS_MT_PRESSURE, 0, 50, 0, 0); | ||
2834 | + | ||
2835 | + input_set_capability(input_dev, EV_KEY, BTN_LEFT); | ||
2836 | + | ||
2837 | + __set_bit(INPUT_PROP_BUTTONPAD, input_dev->propbit); | ||
2838 | + | ||
2839 | + input_mt_init_slots(input_dev, wd->maxcontacts, INPUT_MT_POINTER | | ||
2840 | + INPUT_MT_DROP_UNUSED); | ||
2841 | + | ||
2842 | + wd->input = input_dev; | ||
2843 | +} | ||
2844 | + | ||
2845 | +static void wtp_touch_event(struct wtp_data *wd, | ||
2846 | + struct hidpp_touchpad_raw_xy_finger *touch_report) | ||
2847 | +{ | ||
2848 | + int slot; | ||
2849 | + | ||
2850 | + if (!touch_report->finger_id || touch_report->contact_type) | ||
2851 | + /* no actual data */ | ||
2852 | + return; | ||
2853 | + | ||
2854 | + slot = input_mt_get_slot_by_key(wd->input, touch_report->finger_id); | ||
2855 | + | ||
2856 | + input_mt_slot(wd->input, slot); | ||
2857 | + input_mt_report_slot_state(wd->input, MT_TOOL_FINGER, | ||
2858 | + touch_report->contact_status); | ||
2859 | + if (touch_report->contact_status) { | ||
2860 | + input_event(wd->input, EV_ABS, ABS_MT_POSITION_X, | ||
2861 | + touch_report->x); | ||
2862 | + input_event(wd->input, EV_ABS, ABS_MT_POSITION_Y, | ||
2863 | + wd->flip_y ? wd->y_size - touch_report->y : | ||
2864 | + touch_report->y); | ||
2865 | + input_event(wd->input, EV_ABS, ABS_MT_PRESSURE, | ||
2866 | + touch_report->area); | ||
2867 | + } | ||
2868 | +} | ||
2869 | + | ||
2870 | +static void wtp_send_raw_xy_event(struct hidpp_device *hidpp, | ||
2871 | + struct hidpp_touchpad_raw_xy *raw) | ||
2872 | +{ | ||
2873 | + struct wtp_data *wd = hidpp->private_data; | ||
2874 | + int i; | ||
2875 | + | ||
2876 | + for (i = 0; i < 2; i++) | ||
2877 | + wtp_touch_event(wd, &(raw->fingers[i])); | ||
2878 | + | ||
2879 | + if (raw->end_of_frame) | ||
2880 | + input_event(wd->input, EV_KEY, BTN_LEFT, raw->button); | ||
2881 | + | ||
2882 | + if (raw->end_of_frame || raw->finger_count <= 2) { | ||
2883 | + input_mt_sync_frame(wd->input); | ||
2884 | + input_sync(wd->input); | ||
2885 | + } | ||
2886 | +} | ||
2887 | + | ||
2888 | +static int wtp_mouse_raw_xy_event(struct hidpp_device *hidpp, u8 *data) | ||
2889 | +{ | ||
2890 | + struct wtp_data *wd = hidpp->private_data; | ||
2891 | + u8 c1_area = ((data[7] & 0xf) * (data[7] & 0xf) + | ||
2892 | + (data[7] >> 4) * (data[7] >> 4)) / 2; | ||
2893 | + u8 c2_area = ((data[13] & 0xf) * (data[13] & 0xf) + | ||
2894 | + (data[13] >> 4) * (data[13] >> 4)) / 2; | ||
2895 | + struct hidpp_touchpad_raw_xy raw = { | ||
2896 | + .timestamp = data[1], | ||
2897 | + .fingers = { | ||
2898 | + { | ||
2899 | + .contact_type = 0, | ||
2900 | + .contact_status = !!data[7], | ||
2901 | + .x = get_unaligned_le16(&data[3]), | ||
2902 | + .y = get_unaligned_le16(&data[5]), | ||
2903 | + .z = c1_area, | ||
2904 | + .area = c1_area, | ||
2905 | + .finger_id = data[2], | ||
2906 | + }, { | ||
2907 | + .contact_type = 0, | ||
2908 | + .contact_status = !!data[13], | ||
2909 | + .x = get_unaligned_le16(&data[9]), | ||
2910 | + .y = get_unaligned_le16(&data[11]), | ||
2911 | + .z = c2_area, | ||
2912 | + .area = c2_area, | ||
2913 | + .finger_id = data[8], | ||
2914 | + } | ||
2915 | + }, | ||
2916 | + .finger_count = wd->maxcontacts, | ||
2917 | + .spurious_flag = 0, | ||
2918 | + .end_of_frame = (data[0] >> 7) == 0, | ||
2919 | + .button = data[0] & 0x01, | ||
2920 | + }; | ||
2921 | + | ||
2922 | + wtp_send_raw_xy_event(hidpp, &raw); | ||
2923 | + | ||
2924 | + return 1; | ||
2925 | +} | ||
2926 | + | ||
2927 | +static int wtp_raw_event(struct hid_device *hdev, u8 *data, int size) | ||
2928 | +{ | ||
2929 | + struct hidpp_device *hidpp = hid_get_drvdata(hdev); | ||
2930 | + struct wtp_data *wd = hidpp->private_data; | ||
2931 | + | ||
2932 | + if (!wd || !wd->input || (data[0] != 0x02) || size < 21) | ||
2933 | + return 1; | ||
2934 | + | ||
2935 | + return wtp_mouse_raw_xy_event(hidpp, &data[7]); | ||
2936 | +} | ||
2937 | + | ||
2938 | +static int wtp_get_config(struct hidpp_device *hidpp) | ||
2939 | +{ | ||
2940 | + struct wtp_data *wd = hidpp->private_data; | ||
2941 | + struct hidpp_touchpad_raw_info raw_info = {0}; | ||
2942 | + u8 feature_type; | ||
2943 | + int ret; | ||
2944 | + | ||
2945 | + ret = hidpp_root_get_feature(hidpp, HIDPP_PAGE_TOUCHPAD_RAW_XY, | ||
2946 | + &wd->mt_feature_index, &feature_type); | ||
2947 | + if (ret) | ||
2948 | + /* means that the device is not powered up */ | ||
2949 | + return ret; | ||
2950 | + | ||
2951 | + ret = hidpp_touchpad_get_raw_info(hidpp, wd->mt_feature_index, | ||
2952 | + &raw_info); | ||
2953 | + if (ret) | ||
2954 | + return ret; | ||
2955 | + | ||
2956 | + wd->x_size = raw_info.x_size; | ||
2957 | + wd->y_size = raw_info.y_size; | ||
2958 | + wd->maxcontacts = raw_info.maxcontacts; | ||
2959 | + wd->flip_y = raw_info.origin == TOUCHPAD_RAW_XY_ORIGIN_LOWER_LEFT; | ||
2960 | + wd->resolution = raw_info.res; | ||
2961 | + | ||
2962 | + return 0; | ||
2963 | +} | ||
2964 | + | ||
2965 | +static int wtp_allocate(struct hid_device *hdev, const struct hid_device_id *id) | ||
2966 | +{ | ||
2967 | + struct hidpp_device *hidpp = hid_get_drvdata(hdev); | ||
2968 | + struct wtp_data *wd; | ||
2969 | + | ||
2970 | + wd = devm_kzalloc(&hdev->dev, sizeof(struct wtp_data), | ||
2971 | + GFP_KERNEL); | ||
2972 | + if (!wd) | ||
2973 | + return -ENOMEM; | ||
2974 | + | ||
2975 | + hidpp->private_data = wd; | ||
2976 | + | ||
2977 | + return 0; | ||
2978 | +}; | ||
2979 | + | ||
2980 | +/* -------------------------------------------------------------------------- */ | ||
2981 | +/* Generic HID++ devices */ | ||
2982 | +/* -------------------------------------------------------------------------- */ | ||
2983 | + | ||
2984 | +static int hidpp_input_mapping(struct hid_device *hdev, struct hid_input *hi, | ||
2985 | + struct hid_field *field, struct hid_usage *usage, | ||
2986 | + unsigned long **bit, int *max) | ||
2987 | +{ | ||
2988 | + struct hidpp_device *hidpp = hid_get_drvdata(hdev); | ||
2989 | + | ||
2990 | + if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) | ||
2991 | + return wtp_input_mapping(hdev, hi, field, usage, bit, max); | ||
2992 | + | ||
2993 | + return 0; | ||
2994 | +} | ||
2995 | + | ||
2996 | +static void hidpp_input_configured(struct hid_device *hdev, | ||
2997 | + struct hid_input *hidinput) | ||
2998 | +{ | ||
2999 | + struct hidpp_device *hidpp = hid_get_drvdata(hdev); | ||
3000 | + | ||
3001 | + if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) | ||
3002 | + wtp_input_configured(hdev, hidinput); | ||
3003 | +} | ||
3004 | + | ||
3005 | +static int hidpp_raw_hidpp_event(struct hidpp_device *hidpp, u8 *data, | ||
3006 | + int size) | ||
3007 | +{ | ||
3008 | + struct hidpp_report *question = hidpp->send_receive_buf; | ||
3009 | + struct hidpp_report *answer = hidpp->send_receive_buf; | ||
3010 | + struct hidpp_report *report = (struct hidpp_report *)data; | ||
3011 | + | ||
3012 | + /* | ||
3013 | + * If the mutex is locked then we have a pending answer from a | ||
3014 | + * previoulsly sent command | ||
3015 | + */ | ||
3016 | + if (unlikely(mutex_is_locked(&hidpp->send_mutex))) { | ||
3017 | + /* | ||
3018 | + * Check for a correct hidpp20 answer or the corresponding | ||
3019 | + * error | ||
3020 | + */ | ||
3021 | + if (hidpp_match_answer(question, report) || | ||
3022 | + hidpp_match_error(question, report)) { | ||
3023 | + *answer = *report; | ||
3024 | + hidpp->answer_available = true; | ||
3025 | + wake_up(&hidpp->wait); | ||
3026 | + /* | ||
3027 | + * This was an answer to a command that this driver sent | ||
3028 | + * We return 1 to hid-core to avoid forwarding the | ||
3029 | + * command upstream as it has been treated by the driver | ||
3030 | + */ | ||
3031 | + | ||
3032 | + return 1; | ||
3033 | + } | ||
3034 | + } | ||
3035 | + | ||
3036 | + if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) | ||
3037 | + return wtp_raw_event(hidpp->hid_dev, data, size); | ||
3038 | + | ||
3039 | + return 0; | ||
3040 | +} | ||
3041 | + | ||
3042 | +static int hidpp_raw_event(struct hid_device *hdev, struct hid_report *report, | ||
3043 | + u8 *data, int size) | ||
3044 | +{ | ||
3045 | + struct hidpp_device *hidpp = hid_get_drvdata(hdev); | ||
3046 | + | ||
3047 | + switch (data[0]) { | ||
3048 | + case REPORT_ID_HIDPP_LONG: | ||
3049 | + if (size != HIDPP_REPORT_LONG_LENGTH) { | ||
3050 | + hid_err(hdev, "received hid++ report of bad size (%d)", | ||
3051 | + size); | ||
3052 | + return 1; | ||
3053 | + } | ||
3054 | + return hidpp_raw_hidpp_event(hidpp, data, size); | ||
3055 | + case REPORT_ID_HIDPP_SHORT: | ||
3056 | + if (size != HIDPP_REPORT_SHORT_LENGTH) { | ||
3057 | + hid_err(hdev, "received hid++ report of bad size (%d)", | ||
3058 | + size); | ||
3059 | + return 1; | ||
3060 | + } | ||
3061 | + return hidpp_raw_hidpp_event(hidpp, data, size); | ||
3062 | + } | ||
3063 | + | ||
3064 | + if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) | ||
3065 | + return wtp_raw_event(hdev, data, size); | ||
3066 | + | ||
3067 | + return 0; | ||
3068 | +} | ||
3069 | + | ||
3070 | +static void hidpp_overwrite_name(struct hid_device *hdev) | ||
3071 | +{ | ||
3072 | + struct hidpp_device *hidpp = hid_get_drvdata(hdev); | ||
3073 | + char *name; | ||
3074 | + u8 name_length; | ||
3075 | + | ||
3076 | + name = hidpp_get_device_name(hidpp, &name_length); | ||
3077 | + | ||
3078 | + if (!name) | ||
3079 | + hid_err(hdev, "unable to retrieve the name of the device"); | ||
3080 | + else | ||
3081 | + snprintf(hdev->name, sizeof(hdev->name), "%s", name); | ||
3082 | + | ||
3083 | + kfree(name); | ||
3084 | +} | ||
3085 | + | ||
3086 | +static int hidpp_probe(struct hid_device *hdev, const struct hid_device_id *id) | ||
3087 | +{ | ||
3088 | + struct hidpp_device *hidpp; | ||
3089 | + int ret; | ||
3090 | + bool connected; | ||
3091 | + | ||
3092 | + hidpp = devm_kzalloc(&hdev->dev, sizeof(struct hidpp_device), | ||
3093 | + GFP_KERNEL); | ||
3094 | + if (!hidpp) | ||
3095 | + return -ENOMEM; | ||
3096 | + | ||
3097 | + hidpp->hid_dev = hdev; | ||
3098 | + hid_set_drvdata(hdev, hidpp); | ||
3099 | + | ||
3100 | + hidpp->quirks = id->driver_data; | ||
3101 | + | ||
3102 | + if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) { | ||
3103 | + ret = wtp_allocate(hdev, id); | ||
3104 | + if (ret) | ||
3105 | + return ret; | ||
3106 | + } | ||
3107 | + | ||
3108 | + mutex_init(&hidpp->send_mutex); | ||
3109 | + init_waitqueue_head(&hidpp->wait); | ||
3110 | + | ||
3111 | + ret = hid_parse(hdev); | ||
3112 | + if (ret) { | ||
3113 | + hid_err(hdev, "%s:parse failed\n", __func__); | ||
3114 | + goto hid_parse_fail; | ||
3115 | + } | ||
3116 | + | ||
3117 | + /* Allow incoming packets */ | ||
3118 | + hid_device_io_start(hdev); | ||
3119 | + | ||
3120 | + connected = hidpp_is_connected(hidpp); | ||
3121 | + if (!connected) { | ||
3122 | + hid_err(hdev, "Device not connected"); | ||
3123 | + goto hid_parse_fail; | ||
3124 | + } | ||
3125 | + | ||
3126 | + /* the device is connected, we can ask for its name */ | ||
3127 | + hid_info(hdev, "HID++ %u.%u device connected.\n", | ||
3128 | + hidpp->protocol_major, hidpp->protocol_minor); | ||
3129 | + hidpp_overwrite_name(hdev); | ||
3130 | + | ||
3131 | + if (hidpp->quirks & HIDPP_QUIRK_CLASS_WTP) { | ||
3132 | + ret = wtp_get_config(hidpp); | ||
3133 | + if (ret) | ||
3134 | + goto hid_parse_fail; | ||
3135 | + } | ||
3136 | + | ||
3137 | + /* Block incoming packets */ | ||
3138 | + hid_device_io_stop(hdev); | ||
3139 | + | ||
3140 | + ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); | ||
3141 | + if (ret) { | ||
3142 | + hid_err(hdev, "%s:hid_hw_start returned error\n", __func__); | ||
3143 | + goto hid_hw_start_fail; | ||
3144 | + } | ||
3145 | + | ||
3146 | + return ret; | ||
3147 | + | ||
3148 | +hid_hw_start_fail: | ||
3149 | +hid_parse_fail: | ||
3150 | + mutex_destroy(&hidpp->send_mutex); | ||
3151 | + hid_set_drvdata(hdev, NULL); | ||
3152 | + return ret; | ||
3153 | +} | ||
3154 | + | ||
3155 | +static void hidpp_remove(struct hid_device *hdev) | ||
3156 | +{ | ||
3157 | + struct hidpp_device *hidpp = hid_get_drvdata(hdev); | ||
3158 | + | ||
3159 | + mutex_destroy(&hidpp->send_mutex); | ||
3160 | + hid_hw_stop(hdev); | ||
3161 | +} | ||
3162 | + | ||
3163 | +static const struct hid_device_id hidpp_devices[] = { | ||
3164 | + { /* wireless touchpad T651 */ | ||
3165 | + HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, | ||
3166 | + USB_DEVICE_ID_LOGITECH_T651), | ||
3167 | + .driver_data = HIDPP_QUIRK_CLASS_WTP }, | ||
3168 | + {} | ||
3169 | +}; | ||
3170 | + | ||
3171 | +MODULE_DEVICE_TABLE(hid, hidpp_devices); | ||
3172 | + | ||
3173 | +static struct hid_driver hidpp_driver = { | ||
3174 | + .name = "logitech-hidpp-device", | ||
3175 | + .id_table = hidpp_devices, | ||
3176 | + .probe = hidpp_probe, | ||
3177 | + .remove = hidpp_remove, | ||
3178 | + .raw_event = hidpp_raw_event, | ||
3179 | + .input_configured = hidpp_input_configured, | ||
3180 | + .input_mapping = hidpp_input_mapping, | ||
3181 | +}; | ||
3182 | + | ||
3183 | +module_hid_driver(hidpp_driver); | ||
3184 | diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c | ||
3185 | index 8ba17a946f2a..0dbc2a0c25c0 100644 | ||
3186 | --- a/drivers/hid/hid-microsoft.c | ||
3187 | +++ b/drivers/hid/hid-microsoft.c | ||
3188 | @@ -264,6 +264,8 @@ static const struct hid_device_id ms_devices[] = { | ||
3189 | .driver_data = MS_ERGONOMY }, | ||
3190 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP), | ||
3191 | .driver_data = MS_ERGONOMY }, | ||
3192 | + { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE7K), | ||
3193 | + .driver_data = MS_ERGONOMY }, | ||
3194 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K), | ||
3195 | .driver_data = MS_ERGONOMY | MS_RDESC }, | ||
3196 | { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB), | ||
3197 | diff --git a/drivers/hid/hid-saitek.c b/drivers/hid/hid-saitek.c | ||
3198 | index 69cca1476a0c..ccd14204861f 100644 | ||
3199 | --- a/drivers/hid/hid-saitek.c | ||
3200 | +++ b/drivers/hid/hid-saitek.c | ||
3201 | @@ -177,6 +177,8 @@ static int saitek_event(struct hid_device *hdev, struct hid_field *field, | ||
3202 | static const struct hid_device_id saitek_devices[] = { | ||
3203 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000), | ||
3204 | .driver_data = SAITEK_FIX_PS1000 }, | ||
3205 | + { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7_OLD), | ||
3206 | + .driver_data = SAITEK_RELEASE_MODE_RAT7 }, | ||
3207 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7), | ||
3208 | .driver_data = SAITEK_RELEASE_MODE_RAT7 }, | ||
3209 | { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7), | ||
3210 | diff --git a/drivers/hid/hid-sjoy.c b/drivers/hid/hid-sjoy.c | ||
3211 | index 37845eccddb5..36b6470af947 100644 | ||
3212 | --- a/drivers/hid/hid-sjoy.c | ||
3213 | +++ b/drivers/hid/hid-sjoy.c | ||
3214 | @@ -166,6 +166,9 @@ static const struct hid_device_id sjoy_devices[] = { | ||
3215 | { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD), | ||
3216 | .driver_data = HID_QUIRK_MULTI_INPUT | | ||
3217 | HID_QUIRK_SKIP_OUTPUT_REPORTS }, | ||
3218 | + { HID_USB_DEVICE(USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII), | ||
3219 | + .driver_data = HID_QUIRK_MULTI_INPUT | | ||
3220 | + HID_QUIRK_SKIP_OUTPUT_REPORTS }, | ||
3221 | { } | ||
3222 | }; | ||
3223 | MODULE_DEVICE_TABLE(hid, sjoy_devices); | ||
3224 | diff --git a/drivers/hid/hid-uclogic.c b/drivers/hid/hid-uclogic.c | ||
3225 | index fb8b516ff0ed..22dccce6a85c 100644 | ||
3226 | --- a/drivers/hid/hid-uclogic.c | ||
3227 | +++ b/drivers/hid/hid-uclogic.c | ||
3228 | @@ -626,6 +626,32 @@ static __u8 *uclogic_report_fixup(struct hid_device *hdev, __u8 *rdesc, | ||
3229 | return rdesc; | ||
3230 | } | ||
3231 | |||
3232 | +static int uclogic_probe(struct hid_device *hdev, | ||
3233 | + const struct hid_device_id *id) | ||
3234 | +{ | ||
3235 | + int rc; | ||
3236 | + | ||
3237 | + /* | ||
3238 | + * libinput requires the pad interface to be on a different node | ||
3239 | + * than the pen, so use QUIRK_MULTI_INPUT for all tablets. | ||
3240 | + */ | ||
3241 | + hdev->quirks |= HID_QUIRK_MULTI_INPUT; | ||
3242 | + | ||
3243 | + rc = hid_parse(hdev); | ||
3244 | + if (rc) { | ||
3245 | + hid_err(hdev, "parse failed\n"); | ||
3246 | + return rc; | ||
3247 | + } | ||
3248 | + | ||
3249 | + rc = hid_hw_start(hdev, HID_CONNECT_DEFAULT); | ||
3250 | + if (rc) { | ||
3251 | + hid_err(hdev, "hw start failed\n"); | ||
3252 | + return rc; | ||
3253 | + } | ||
3254 | + | ||
3255 | + return 0; | ||
3256 | +} | ||
3257 | + | ||
3258 | static const struct hid_device_id uclogic_devices[] = { | ||
3259 | { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, | ||
3260 | USB_DEVICE_ID_UCLOGIC_TABLET_PF1209) }, | ||
3261 | @@ -648,6 +674,7 @@ MODULE_DEVICE_TABLE(hid, uclogic_devices); | ||
3262 | static struct hid_driver uclogic_driver = { | ||
3263 | .name = "uclogic", | ||
3264 | .id_table = uclogic_devices, | ||
3265 | + .probe = uclogic_probe, | ||
3266 | .report_fixup = uclogic_report_fixup, | ||
3267 | }; | ||
3268 | module_hid_driver(uclogic_driver); | ||
3269 | diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c | ||
3270 | index 4477eb7457de..509dee2e9b72 100644 | ||
3271 | --- a/drivers/hid/usbhid/hid-quirks.c | ||
3272 | +++ b/drivers/hid/usbhid/hid-quirks.c | ||
3273 | @@ -52,7 +52,6 @@ static const struct hid_blacklist { | ||
3274 | { USB_VENDOR_ID_ETURBOTOUCH, USB_DEVICE_ID_ETURBOTOUCH_2968, HID_QUIRK_MULTI_INPUT }, | ||
3275 | { USB_VENDOR_ID_GREENASIA, USB_DEVICE_ID_GREENASIA_DUAL_USB_JOYPAD, HID_QUIRK_MULTI_INPUT }, | ||
3276 | { USB_VENDOR_ID_PANTHERLORD, USB_DEVICE_ID_PANTHERLORD_TWIN_USB_JOYSTICK, HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS }, | ||
3277 | - { USB_VENDOR_ID_PLAYDOTCOM, USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII, HID_QUIRK_MULTI_INPUT }, | ||
3278 | { USB_VENDOR_ID_TOUCHPACK, USB_DEVICE_ID_TOUCHPACK_RTS, HID_QUIRK_MULTI_INPUT }, | ||
3279 | |||
3280 | { USB_VENDOR_ID_AIREN, USB_DEVICE_ID_AIREN_SLIMPLUS, HID_QUIRK_NOGET }, | ||
3281 | @@ -61,6 +60,7 @@ static const struct hid_blacklist { | ||
3282 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_2PORTKVM, HID_QUIRK_NOGET }, | ||
3283 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVM, HID_QUIRK_NOGET }, | ||
3284 | { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVMC, HID_QUIRK_NOGET }, | ||
3285 | + { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS682, HID_QUIRK_NOGET }, | ||
3286 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FIGHTERSTICK, HID_QUIRK_NOGET }, | ||
3287 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_COMBATSTICK, HID_QUIRK_NOGET }, | ||
3288 | { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FLIGHT_SIM_ECLIPSE_YOKE, HID_QUIRK_NOGET }, | ||
3289 | @@ -78,6 +78,13 @@ static const struct hid_blacklist { | ||
3290 | { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, | ||
3291 | { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS }, | ||
3292 | { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET }, | ||
3293 | + { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0A4A, HID_QUIRK_ALWAYS_POLL }, | ||
3294 | + { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_LOGITECH_OEM_USB_OPTICAL_MOUSE_0B4A, HID_QUIRK_ALWAYS_POLL }, | ||
3295 | + { USB_VENDOR_ID_HP, USB_PRODUCT_ID_HP_PIXART_OEM_USB_OPTICAL_MOUSE, HID_QUIRK_ALWAYS_POLL }, | ||
3296 | + { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_C077, HID_QUIRK_ALWAYS_POLL }, | ||
3297 | + { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOUSE_C01A, HID_QUIRK_ALWAYS_POLL }, | ||
3298 | + { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOUSE_C05A, HID_QUIRK_ALWAYS_POLL }, | ||
3299 | + { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_MOUSE_C06A, HID_QUIRK_ALWAYS_POLL }, | ||
3300 | { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET }, | ||
3301 | { USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL, HID_QUIRK_NO_INIT_REPORTS }, | ||
3302 | { USB_VENDOR_ID_NEXIO, USB_DEVICE_ID_NEXIO_MULTITOUCH_PTI0750, HID_QUIRK_NO_INIT_REPORTS }, | ||
3303 | @@ -89,6 +96,7 @@ static const struct hid_blacklist { | ||
3304 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN, HID_QUIRK_NO_INIT_REPORTS }, | ||
3305 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1, HID_QUIRK_NO_INIT_REPORTS }, | ||
3306 | { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2, HID_QUIRK_NO_INIT_REPORTS }, | ||
3307 | + { USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_MOUSE_4D22, HID_QUIRK_ALWAYS_POLL }, | ||
3308 | { USB_VENDOR_ID_PRODIGE, USB_DEVICE_ID_PRODIGE_CORDLESS, HID_QUIRK_NOGET }, | ||
3309 | { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001, HID_QUIRK_NOGET }, | ||
3310 | { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008, HID_QUIRK_NOGET }, | ||
3311 | @@ -104,12 +112,8 @@ static const struct hid_blacklist { | ||
3312 | { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_2, HID_QUIRK_NOGET }, | ||
3313 | { USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN, HID_QUIRK_NOGET }, | ||
3314 | { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD, HID_QUIRK_NOGET }, | ||
3315 | - { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209, HID_QUIRK_MULTI_INPUT }, | ||
3316 | - { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U, HID_QUIRK_MULTI_INPUT }, | ||
3317 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_KNA5, HID_QUIRK_MULTI_INPUT }, | ||
3318 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_TWA60, HID_QUIRK_MULTI_INPUT }, | ||
3319 | - { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP5540U, HID_QUIRK_MULTI_INPUT }, | ||
3320 | - { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP8060U, HID_QUIRK_MULTI_INPUT }, | ||
3321 | { USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH, HID_QUIRK_MULTI_INPUT }, | ||
3322 | { USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_14_1_INCH, HID_QUIRK_MULTI_INPUT }, | ||
3323 | { USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SIRIUS_BATTERY_FREE_TABLET, HID_QUIRK_MULTI_INPUT }, | ||
3324 | @@ -125,6 +129,7 @@ static const struct hid_blacklist { | ||
3325 | { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X, HID_QUIRK_MULTI_INPUT }, | ||
3326 | { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_MOUSEPEN_I608X_2, HID_QUIRK_MULTI_INPUT }, | ||
3327 | { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X, HID_QUIRK_MULTI_INPUT }, | ||
3328 | + { USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_PENSKETCH_M912, HID_QUIRK_MULTI_INPUT }, | ||
3329 | { USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_DUOSENSE, HID_QUIRK_NO_INIT_REPORTS }, | ||
3330 | { USB_VENDOR_ID_SEMICO, USB_DEVICE_ID_SEMICO_USB_KEYKOARD, HID_QUIRK_NO_INIT_REPORTS }, | ||
3331 | { USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_LTS1, HID_QUIRK_NO_INIT_REPORTS }, | ||
3332 | @@ -133,6 +138,9 @@ static const struct hid_blacklist { | ||
3333 | { USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_QUAD_HD, HID_QUIRK_NO_INIT_REPORTS }, | ||
3334 | { USB_VENDOR_ID_SYNAPTICS, USB_DEVICE_ID_SYNAPTICS_TP_V103, HID_QUIRK_NO_INIT_REPORTS }, | ||
3335 | { USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD_A096, HID_QUIRK_NO_INIT_INPUT_REPORTS }, | ||
3336 | + { USB_VENDOR_ID_MULTIPLE_1781, USB_DEVICE_ID_RAPHNET_4NES4SNES_OLD, HID_QUIRK_MULTI_INPUT }, | ||
3337 | + { USB_VENDOR_ID_DRACAL_RAPHNET, USB_DEVICE_ID_RAPHNET_2NES2SNES, HID_QUIRK_MULTI_INPUT }, | ||
3338 | + { USB_VENDOR_ID_DRACAL_RAPHNET, USB_DEVICE_ID_RAPHNET_4NES4SNES, HID_QUIRK_MULTI_INPUT }, | ||
3339 | |||
3340 | { 0, 0 } | ||
3341 | }; | ||
3342 | diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c | ||
3343 | index 0ff89b2ecdb5..3d1fc736a420 100644 | ||
3344 | --- a/drivers/iommu/intel-iommu.c | ||
3345 | +++ b/drivers/iommu/intel-iommu.c | ||
3346 | @@ -50,6 +50,7 @@ | ||
3347 | #define CONTEXT_SIZE VTD_PAGE_SIZE | ||
3348 | |||
3349 | #define IS_GFX_DEVICE(pdev) ((pdev->class >> 16) == PCI_BASE_CLASS_DISPLAY) | ||
3350 | +#define IS_USB_DEVICE(pdev) ((pdev->class >> 8) == PCI_CLASS_SERIAL_USB) | ||
3351 | #define IS_ISA_DEVICE(pdev) ((pdev->class >> 8) == PCI_CLASS_BRIDGE_ISA) | ||
3352 | #define IS_AZALIA(pdev) ((pdev)->vendor == 0x8086 && (pdev)->device == 0x3a3e) | ||
3353 | |||
3354 | @@ -2558,6 +2559,10 @@ static bool device_has_rmrr(struct device *dev) | ||
3355 | * In both cases we assume that PCI USB devices with RMRRs have them largely | ||
3356 | * for historical reasons and that the RMRR space is not actively used post | ||
3357 | * boot. This exclusion may change if vendors begin to abuse it. | ||
3358 | + * | ||
3359 | + * The same exception is made for graphics devices, with the requirement that | ||
3360 | + * any use of the RMRR regions will be torn down before assigning the device | ||
3361 | + * to a guest. | ||
3362 | */ | ||
3363 | static bool device_is_rmrr_locked(struct device *dev) | ||
3364 | { | ||
3365 | @@ -2567,7 +2572,7 @@ static bool device_is_rmrr_locked(struct device *dev) | ||
3366 | if (dev_is_pci(dev)) { | ||
3367 | struct pci_dev *pdev = to_pci_dev(dev); | ||
3368 | |||
3369 | - if ((pdev->class >> 8) == PCI_CLASS_SERIAL_USB) | ||
3370 | + if (IS_USB_DEVICE(pdev) || IS_GFX_DEVICE(pdev)) | ||
3371 | return false; | ||
3372 | } | ||
3373 | |||
3374 | diff --git a/drivers/lguest/x86/core.c b/drivers/lguest/x86/core.c | ||
3375 | index 922a1acbf652..6adfd7ba4c97 100644 | ||
3376 | --- a/drivers/lguest/x86/core.c | ||
3377 | +++ b/drivers/lguest/x86/core.c | ||
3378 | @@ -47,6 +47,7 @@ | ||
3379 | #include <asm/lguest.h> | ||
3380 | #include <asm/uaccess.h> | ||
3381 | #include <asm/i387.h> | ||
3382 | +#include <asm/tlbflush.h> | ||
3383 | #include "../lg.h" | ||
3384 | |||
3385 | static int cpu_had_pge; | ||
3386 | @@ -452,9 +453,9 @@ void lguest_arch_handle_trap(struct lg_cpu *cpu) | ||
3387 | static void adjust_pge(void *on) | ||
3388 | { | ||
3389 | if (on) | ||
3390 | - write_cr4(read_cr4() | X86_CR4_PGE); | ||
3391 | + cr4_set_bits(X86_CR4_PGE); | ||
3392 | else | ||
3393 | - write_cr4(read_cr4() & ~X86_CR4_PGE); | ||
3394 | + cr4_clear_bits(X86_CR4_PGE); | ||
3395 | } | ||
3396 | |||
3397 | /*H:020 | ||
3398 | diff --git a/drivers/media/dvb-frontends/a8293.h b/drivers/media/dvb-frontends/a8293.h | ||
3399 | index b6ef6427cfa5..5f0411939ffc 100644 | ||
3400 | --- a/drivers/media/dvb-frontends/a8293.h | ||
3401 | +++ b/drivers/media/dvb-frontends/a8293.h | ||
3402 | @@ -27,7 +27,7 @@ struct a8293_config { | ||
3403 | u8 i2c_addr; | ||
3404 | }; | ||
3405 | |||
3406 | -#if IS_ENABLED(CONFIG_DVB_A8293) | ||
3407 | +#if IS_REACHABLE(CONFIG_DVB_A8293) | ||
3408 | extern struct dvb_frontend *a8293_attach(struct dvb_frontend *fe, | ||
3409 | struct i2c_adapter *i2c, const struct a8293_config *cfg); | ||
3410 | #else | ||
3411 | diff --git a/drivers/media/dvb-frontends/af9013.h b/drivers/media/dvb-frontends/af9013.h | ||
3412 | index 09273b2cd310..1dcc936e1661 100644 | ||
3413 | --- a/drivers/media/dvb-frontends/af9013.h | ||
3414 | +++ b/drivers/media/dvb-frontends/af9013.h | ||
3415 | @@ -103,7 +103,7 @@ struct af9013_config { | ||
3416 | u8 gpio[4]; | ||
3417 | }; | ||
3418 | |||
3419 | -#if IS_ENABLED(CONFIG_DVB_AF9013) | ||
3420 | +#if IS_REACHABLE(CONFIG_DVB_AF9013) | ||
3421 | extern struct dvb_frontend *af9013_attach(const struct af9013_config *config, | ||
3422 | struct i2c_adapter *i2c); | ||
3423 | #else | ||
3424 | diff --git a/drivers/media/dvb-frontends/atbm8830.h b/drivers/media/dvb-frontends/atbm8830.h | ||
3425 | index 8e0ac98f8d08..5446d13fdfe8 100644 | ||
3426 | --- a/drivers/media/dvb-frontends/atbm8830.h | ||
3427 | +++ b/drivers/media/dvb-frontends/atbm8830.h | ||
3428 | @@ -61,7 +61,7 @@ struct atbm8830_config { | ||
3429 | u8 agc_hold_loop; | ||
3430 | }; | ||
3431 | |||
3432 | -#if IS_ENABLED(CONFIG_DVB_ATBM8830) | ||
3433 | +#if IS_REACHABLE(CONFIG_DVB_ATBM8830) | ||
3434 | extern struct dvb_frontend *atbm8830_attach(const struct atbm8830_config *config, | ||
3435 | struct i2c_adapter *i2c); | ||
3436 | #else | ||
3437 | diff --git a/drivers/media/dvb-frontends/au8522.h b/drivers/media/dvb-frontends/au8522.h | ||
3438 | index 83fe9a615619..5f48bd4fc51d 100644 | ||
3439 | --- a/drivers/media/dvb-frontends/au8522.h | ||
3440 | +++ b/drivers/media/dvb-frontends/au8522.h | ||
3441 | @@ -61,7 +61,7 @@ struct au8522_config { | ||
3442 | enum au8522_if_freq qam_if; | ||
3443 | }; | ||
3444 | |||
3445 | -#if IS_ENABLED(CONFIG_DVB_AU8522_DTV) | ||
3446 | +#if IS_REACHABLE(CONFIG_DVB_AU8522_DTV) | ||
3447 | extern struct dvb_frontend *au8522_attach(const struct au8522_config *config, | ||
3448 | struct i2c_adapter *i2c); | ||
3449 | #else | ||
3450 | diff --git a/drivers/media/dvb-frontends/bcm3510.h b/drivers/media/dvb-frontends/bcm3510.h | ||
3451 | index 5bd56b1623bf..ff66492fb940 100644 | ||
3452 | --- a/drivers/media/dvb-frontends/bcm3510.h | ||
3453 | +++ b/drivers/media/dvb-frontends/bcm3510.h | ||
3454 | @@ -34,7 +34,7 @@ struct bcm3510_config | ||
3455 | int (*request_firmware)(struct dvb_frontend* fe, const struct firmware **fw, char* name); | ||
3456 | }; | ||
3457 | |||
3458 | -#if IS_ENABLED(CONFIG_DVB_BCM3510) | ||
3459 | +#if IS_REACHABLE(CONFIG_DVB_BCM3510) | ||
3460 | extern struct dvb_frontend* bcm3510_attach(const struct bcm3510_config* config, | ||
3461 | struct i2c_adapter* i2c); | ||
3462 | #else | ||
3463 | diff --git a/drivers/media/dvb-frontends/cx22700.h b/drivers/media/dvb-frontends/cx22700.h | ||
3464 | index 382a7b1f3618..e0a764868e6f 100644 | ||
3465 | --- a/drivers/media/dvb-frontends/cx22700.h | ||
3466 | +++ b/drivers/media/dvb-frontends/cx22700.h | ||
3467 | @@ -31,7 +31,7 @@ struct cx22700_config | ||
3468 | u8 demod_address; | ||
3469 | }; | ||
3470 | |||
3471 | -#if IS_ENABLED(CONFIG_DVB_CX22700) | ||
3472 | +#if IS_REACHABLE(CONFIG_DVB_CX22700) | ||
3473 | extern struct dvb_frontend* cx22700_attach(const struct cx22700_config* config, | ||
3474 | struct i2c_adapter* i2c); | ||
3475 | #else | ||
3476 | diff --git a/drivers/media/dvb-frontends/cx22702.h b/drivers/media/dvb-frontends/cx22702.h | ||
3477 | index 0b1a6c2f9d5f..68b69a7660d2 100644 | ||
3478 | --- a/drivers/media/dvb-frontends/cx22702.h | ||
3479 | +++ b/drivers/media/dvb-frontends/cx22702.h | ||
3480 | @@ -41,7 +41,7 @@ struct cx22702_config { | ||
3481 | u8 output_mode; | ||
3482 | }; | ||
3483 | |||
3484 | -#if IS_ENABLED(CONFIG_DVB_CX22702) | ||
3485 | +#if IS_REACHABLE(CONFIG_DVB_CX22702) | ||
3486 | extern struct dvb_frontend *cx22702_attach( | ||
3487 | const struct cx22702_config *config, | ||
3488 | struct i2c_adapter *i2c); | ||
3489 | diff --git a/drivers/media/dvb-frontends/cx24110.h b/drivers/media/dvb-frontends/cx24110.h | ||
3490 | index 527aff1f2723..d5453ed20b28 100644 | ||
3491 | --- a/drivers/media/dvb-frontends/cx24110.h | ||
3492 | +++ b/drivers/media/dvb-frontends/cx24110.h | ||
3493 | @@ -46,7 +46,7 @@ static inline int cx24110_pll_write(struct dvb_frontend *fe, u32 val) | ||
3494 | return 0; | ||
3495 | } | ||
3496 | |||
3497 | -#if IS_ENABLED(CONFIG_DVB_CX24110) | ||
3498 | +#if IS_REACHABLE(CONFIG_DVB_CX24110) | ||
3499 | extern struct dvb_frontend* cx24110_attach(const struct cx24110_config* config, | ||
3500 | struct i2c_adapter* i2c); | ||
3501 | #else | ||
3502 | diff --git a/drivers/media/dvb-frontends/cx24113.h b/drivers/media/dvb-frontends/cx24113.h | ||
3503 | index 782711ba1a32..962919b9b6e6 100644 | ||
3504 | --- a/drivers/media/dvb-frontends/cx24113.h | ||
3505 | +++ b/drivers/media/dvb-frontends/cx24113.h | ||
3506 | @@ -32,7 +32,7 @@ struct cx24113_config { | ||
3507 | u32 xtal_khz; | ||
3508 | }; | ||
3509 | |||
3510 | -#if IS_ENABLED(CONFIG_DVB_TUNER_CX24113) | ||
3511 | +#if IS_REACHABLE(CONFIG_DVB_TUNER_CX24113) | ||
3512 | extern struct dvb_frontend *cx24113_attach(struct dvb_frontend *, | ||
3513 | const struct cx24113_config *config, struct i2c_adapter *i2c); | ||
3514 | |||
3515 | diff --git a/drivers/media/dvb-frontends/cx24116.h b/drivers/media/dvb-frontends/cx24116.h | ||
3516 | index 2ec84fae3f9f..f6dbabc1d62b 100644 | ||
3517 | --- a/drivers/media/dvb-frontends/cx24116.h | ||
3518 | +++ b/drivers/media/dvb-frontends/cx24116.h | ||
3519 | @@ -41,7 +41,7 @@ struct cx24116_config { | ||
3520 | u16 i2c_wr_max; | ||
3521 | }; | ||
3522 | |||
3523 | -#if IS_ENABLED(CONFIG_DVB_CX24116) | ||
3524 | +#if IS_REACHABLE(CONFIG_DVB_CX24116) | ||
3525 | extern struct dvb_frontend *cx24116_attach( | ||
3526 | const struct cx24116_config *config, | ||
3527 | struct i2c_adapter *i2c); | ||
3528 | diff --git a/drivers/media/dvb-frontends/cx24117.h b/drivers/media/dvb-frontends/cx24117.h | ||
3529 | index 4e59e9574fa7..1648ab432168 100644 | ||
3530 | --- a/drivers/media/dvb-frontends/cx24117.h | ||
3531 | +++ b/drivers/media/dvb-frontends/cx24117.h | ||
3532 | @@ -30,7 +30,7 @@ struct cx24117_config { | ||
3533 | u8 demod_address; | ||
3534 | }; | ||
3535 | |||
3536 | -#if IS_ENABLED(CONFIG_DVB_CX24117) | ||
3537 | +#if IS_REACHABLE(CONFIG_DVB_CX24117) | ||
3538 | extern struct dvb_frontend *cx24117_attach( | ||
3539 | const struct cx24117_config *config, | ||
3540 | struct i2c_adapter *i2c); | ||
3541 | diff --git a/drivers/media/dvb-frontends/cx24123.h b/drivers/media/dvb-frontends/cx24123.h | ||
3542 | index 102e70d17c43..758aee5a072f 100644 | ||
3543 | --- a/drivers/media/dvb-frontends/cx24123.h | ||
3544 | +++ b/drivers/media/dvb-frontends/cx24123.h | ||
3545 | @@ -39,7 +39,7 @@ struct cx24123_config { | ||
3546 | void (*agc_callback) (struct dvb_frontend *); | ||
3547 | }; | ||
3548 | |||
3549 | -#if IS_ENABLED(CONFIG_DVB_CX24123) | ||
3550 | +#if IS_REACHABLE(CONFIG_DVB_CX24123) | ||
3551 | extern struct dvb_frontend *cx24123_attach(const struct cx24123_config *config, | ||
3552 | struct i2c_adapter *i2c); | ||
3553 | extern struct i2c_adapter *cx24123_get_tuner_i2c_adapter(struct dvb_frontend *); | ||
3554 | diff --git a/drivers/media/dvb-frontends/cxd2820r.h b/drivers/media/dvb-frontends/cxd2820r.h | ||
3555 | index 6095dbcf7850..56d42760263d 100644 | ||
3556 | --- a/drivers/media/dvb-frontends/cxd2820r.h | ||
3557 | +++ b/drivers/media/dvb-frontends/cxd2820r.h | ||
3558 | @@ -72,7 +72,7 @@ struct cxd2820r_config { | ||
3559 | }; | ||
3560 | |||
3561 | |||
3562 | -#if IS_ENABLED(CONFIG_DVB_CXD2820R) | ||
3563 | +#if IS_REACHABLE(CONFIG_DVB_CXD2820R) | ||
3564 | extern struct dvb_frontend *cxd2820r_attach( | ||
3565 | const struct cxd2820r_config *config, | ||
3566 | struct i2c_adapter *i2c, | ||
3567 | diff --git a/drivers/media/dvb-frontends/dib0070.h b/drivers/media/dvb-frontends/dib0070.h | ||
3568 | index 0c6befcc9143..6c0b6672b1d9 100644 | ||
3569 | --- a/drivers/media/dvb-frontends/dib0070.h | ||
3570 | +++ b/drivers/media/dvb-frontends/dib0070.h | ||
3571 | @@ -48,7 +48,7 @@ struct dib0070_config { | ||
3572 | u8 vga_filter; | ||
3573 | }; | ||
3574 | |||
3575 | -#if IS_ENABLED(CONFIG_DVB_TUNER_DIB0070) | ||
3576 | +#if IS_REACHABLE(CONFIG_DVB_TUNER_DIB0070) | ||
3577 | extern struct dvb_frontend *dib0070_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dib0070_config *cfg); | ||
3578 | extern u16 dib0070_wbd_offset(struct dvb_frontend *); | ||
3579 | extern void dib0070_ctrl_agc_filter(struct dvb_frontend *, u8 open); | ||
3580 | diff --git a/drivers/media/dvb-frontends/dib0090.h b/drivers/media/dvb-frontends/dib0090.h | ||
3581 | index 6a090954fa10..ad74bc823f08 100644 | ||
3582 | --- a/drivers/media/dvb-frontends/dib0090.h | ||
3583 | +++ b/drivers/media/dvb-frontends/dib0090.h | ||
3584 | @@ -75,7 +75,7 @@ struct dib0090_config { | ||
3585 | u8 force_crystal_mode; | ||
3586 | }; | ||
3587 | |||
3588 | -#if IS_ENABLED(CONFIG_DVB_TUNER_DIB0090) | ||
3589 | +#if IS_REACHABLE(CONFIG_DVB_TUNER_DIB0090) | ||
3590 | extern struct dvb_frontend *dib0090_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, const struct dib0090_config *config); | ||
3591 | extern struct dvb_frontend *dib0090_fw_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, const struct dib0090_config *config); | ||
3592 | extern void dib0090_dcc_freq(struct dvb_frontend *fe, u8 fast); | ||
3593 | diff --git a/drivers/media/dvb-frontends/dib3000.h b/drivers/media/dvb-frontends/dib3000.h | ||
3594 | index 9b6c3bbc983a..6ae9899b5b45 100644 | ||
3595 | --- a/drivers/media/dvb-frontends/dib3000.h | ||
3596 | +++ b/drivers/media/dvb-frontends/dib3000.h | ||
3597 | @@ -41,7 +41,7 @@ struct dib_fe_xfer_ops | ||
3598 | int (*tuner_pass_ctrl)(struct dvb_frontend *fe, int onoff, u8 pll_ctrl); | ||
3599 | }; | ||
3600 | |||
3601 | -#if IS_ENABLED(CONFIG_DVB_DIB3000MB) | ||
3602 | +#if IS_REACHABLE(CONFIG_DVB_DIB3000MB) | ||
3603 | extern struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config, | ||
3604 | struct i2c_adapter* i2c, struct dib_fe_xfer_ops *xfer_ops); | ||
3605 | #else | ||
3606 | diff --git a/drivers/media/dvb-frontends/dib3000mc.h b/drivers/media/dvb-frontends/dib3000mc.h | ||
3607 | index 129d1425516a..74816f793611 100644 | ||
3608 | --- a/drivers/media/dvb-frontends/dib3000mc.h | ||
3609 | +++ b/drivers/media/dvb-frontends/dib3000mc.h | ||
3610 | @@ -41,7 +41,7 @@ struct dib3000mc_config { | ||
3611 | #define DEFAULT_DIB3000MC_I2C_ADDRESS 16 | ||
3612 | #define DEFAULT_DIB3000P_I2C_ADDRESS 24 | ||
3613 | |||
3614 | -#if IS_ENABLED(CONFIG_DVB_DIB3000MC) | ||
3615 | +#if IS_REACHABLE(CONFIG_DVB_DIB3000MC) | ||
3616 | extern struct dvb_frontend *dib3000mc_attach(struct i2c_adapter *i2c_adap, | ||
3617 | u8 i2c_addr, | ||
3618 | struct dib3000mc_config *cfg); | ||
3619 | diff --git a/drivers/media/dvb-frontends/dib7000m.h b/drivers/media/dvb-frontends/dib7000m.h | ||
3620 | index b585413f9a29..6468c278cc4d 100644 | ||
3621 | --- a/drivers/media/dvb-frontends/dib7000m.h | ||
3622 | +++ b/drivers/media/dvb-frontends/dib7000m.h | ||
3623 | @@ -40,7 +40,7 @@ struct dib7000m_config { | ||
3624 | |||
3625 | #define DEFAULT_DIB7000M_I2C_ADDRESS 18 | ||
3626 | |||
3627 | -#if IS_ENABLED(CONFIG_DVB_DIB7000M) | ||
3628 | +#if IS_REACHABLE(CONFIG_DVB_DIB7000M) | ||
3629 | extern struct dvb_frontend *dib7000m_attach(struct i2c_adapter *i2c_adap, | ||
3630 | u8 i2c_addr, | ||
3631 | struct dib7000m_config *cfg); | ||
3632 | diff --git a/drivers/media/dvb-frontends/dib7000p.h b/drivers/media/dvb-frontends/dib7000p.h | ||
3633 | index 1fea0e972654..baa278928cf3 100644 | ||
3634 | --- a/drivers/media/dvb-frontends/dib7000p.h | ||
3635 | +++ b/drivers/media/dvb-frontends/dib7000p.h | ||
3636 | @@ -66,7 +66,7 @@ struct dib7000p_ops { | ||
3637 | struct dvb_frontend *(*init)(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib7000p_config *cfg); | ||
3638 | }; | ||
3639 | |||
3640 | -#if IS_ENABLED(CONFIG_DVB_DIB7000P) | ||
3641 | +#if IS_REACHABLE(CONFIG_DVB_DIB7000P) | ||
3642 | void *dib7000p_attach(struct dib7000p_ops *ops); | ||
3643 | #else | ||
3644 | static inline void *dib7000p_attach(struct dib7000p_ops *ops) | ||
3645 | diff --git a/drivers/media/dvb-frontends/dib8000.h b/drivers/media/dvb-frontends/dib8000.h | ||
3646 | index 84cc10383dcd..780c37bdcb72 100644 | ||
3647 | --- a/drivers/media/dvb-frontends/dib8000.h | ||
3648 | +++ b/drivers/media/dvb-frontends/dib8000.h | ||
3649 | @@ -63,7 +63,7 @@ struct dib8000_ops { | ||
3650 | struct dvb_frontend *(*init)(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib8000_config *cfg); | ||
3651 | }; | ||
3652 | |||
3653 | -#if IS_ENABLED(CONFIG_DVB_DIB8000) | ||
3654 | +#if IS_REACHABLE(CONFIG_DVB_DIB8000) | ||
3655 | void *dib8000_attach(struct dib8000_ops *ops); | ||
3656 | #else | ||
3657 | static inline int dib8000_attach(struct dib8000_ops *ops) | ||
3658 | diff --git a/drivers/media/dvb-frontends/dib9000.h b/drivers/media/dvb-frontends/dib9000.h | ||
3659 | index f3639f045ff0..b10a70aa7c9f 100644 | ||
3660 | --- a/drivers/media/dvb-frontends/dib9000.h | ||
3661 | +++ b/drivers/media/dvb-frontends/dib9000.h | ||
3662 | @@ -27,7 +27,7 @@ struct dib9000_config { | ||
3663 | |||
3664 | #define DEFAULT_DIB9000_I2C_ADDRESS 18 | ||
3665 | |||
3666 | -#if IS_ENABLED(CONFIG_DVB_DIB9000) | ||
3667 | +#if IS_REACHABLE(CONFIG_DVB_DIB9000) | ||
3668 | extern struct dvb_frontend *dib9000_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, const struct dib9000_config *cfg); | ||
3669 | extern int dib9000_i2c_enumeration(struct i2c_adapter *host, int no_of_demods, u8 default_addr, u8 first_addr); | ||
3670 | extern struct i2c_adapter *dib9000_get_tuner_interface(struct dvb_frontend *fe); | ||
3671 | diff --git a/drivers/media/dvb-frontends/drxd.h b/drivers/media/dvb-frontends/drxd.h | ||
3672 | index d998e4d5a7fc..a47c22d6667e 100644 | ||
3673 | --- a/drivers/media/dvb-frontends/drxd.h | ||
3674 | +++ b/drivers/media/dvb-frontends/drxd.h | ||
3675 | @@ -52,7 +52,7 @@ struct drxd_config { | ||
3676 | s16(*osc_deviation) (void *priv, s16 dev, int flag); | ||
3677 | }; | ||
3678 | |||
3679 | -#if IS_ENABLED(CONFIG_DVB_DRXD) | ||
3680 | +#if IS_REACHABLE(CONFIG_DVB_DRXD) | ||
3681 | extern | ||
3682 | struct dvb_frontend *drxd_attach(const struct drxd_config *config, | ||
3683 | void *priv, struct i2c_adapter *i2c, | ||
3684 | diff --git a/drivers/media/dvb-frontends/drxk.h b/drivers/media/dvb-frontends/drxk.h | ||
3685 | index f6cb34660327..8f0b9eec528f 100644 | ||
3686 | --- a/drivers/media/dvb-frontends/drxk.h | ||
3687 | +++ b/drivers/media/dvb-frontends/drxk.h | ||
3688 | @@ -51,7 +51,7 @@ struct drxk_config { | ||
3689 | int qam_demod_parameter_count; | ||
3690 | }; | ||
3691 | |||
3692 | -#if IS_ENABLED(CONFIG_DVB_DRXK) | ||
3693 | +#if IS_REACHABLE(CONFIG_DVB_DRXK) | ||
3694 | extern struct dvb_frontend *drxk_attach(const struct drxk_config *config, | ||
3695 | struct i2c_adapter *i2c); | ||
3696 | #else | ||
3697 | diff --git a/drivers/media/dvb-frontends/ds3000.h b/drivers/media/dvb-frontends/ds3000.h | ||
3698 | index f9c21fb7af13..153169da9017 100644 | ||
3699 | --- a/drivers/media/dvb-frontends/ds3000.h | ||
3700 | +++ b/drivers/media/dvb-frontends/ds3000.h | ||
3701 | @@ -35,7 +35,7 @@ struct ds3000_config { | ||
3702 | void (*set_lock_led)(struct dvb_frontend *fe, int offon); | ||
3703 | }; | ||
3704 | |||
3705 | -#if IS_ENABLED(CONFIG_DVB_DS3000) | ||
3706 | +#if IS_REACHABLE(CONFIG_DVB_DS3000) | ||
3707 | extern struct dvb_frontend *ds3000_attach(const struct ds3000_config *config, | ||
3708 | struct i2c_adapter *i2c); | ||
3709 | #else | ||
3710 | diff --git a/drivers/media/dvb-frontends/dvb-pll.h b/drivers/media/dvb-frontends/dvb-pll.h | ||
3711 | index f4b5a0601c3a..bf9602a88b6c 100644 | ||
3712 | --- a/drivers/media/dvb-frontends/dvb-pll.h | ||
3713 | +++ b/drivers/media/dvb-frontends/dvb-pll.h | ||
3714 | @@ -38,7 +38,7 @@ | ||
3715 | * @param pll_desc_id dvb_pll_desc to use. | ||
3716 | * @return Frontend pointer on success, NULL on failure | ||
3717 | */ | ||
3718 | -#if IS_ENABLED(CONFIG_DVB_PLL) | ||
3719 | +#if IS_REACHABLE(CONFIG_DVB_PLL) | ||
3720 | extern struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, | ||
3721 | int pll_addr, | ||
3722 | struct i2c_adapter *i2c, | ||
3723 | diff --git a/drivers/media/dvb-frontends/dvb_dummy_fe.h b/drivers/media/dvb-frontends/dvb_dummy_fe.h | ||
3724 | index 0cbf96105631..15e4ceab869a 100644 | ||
3725 | --- a/drivers/media/dvb-frontends/dvb_dummy_fe.h | ||
3726 | +++ b/drivers/media/dvb-frontends/dvb_dummy_fe.h | ||
3727 | @@ -26,7 +26,7 @@ | ||
3728 | #include <linux/dvb/frontend.h> | ||
3729 | #include "dvb_frontend.h" | ||
3730 | |||
3731 | -#if IS_ENABLED(CONFIG_DVB_DUMMY_FE) | ||
3732 | +#if IS_REACHABLE(CONFIG_DVB_DUMMY_FE) | ||
3733 | extern struct dvb_frontend* dvb_dummy_fe_ofdm_attach(void); | ||
3734 | extern struct dvb_frontend* dvb_dummy_fe_qpsk_attach(void); | ||
3735 | extern struct dvb_frontend* dvb_dummy_fe_qam_attach(void); | ||
3736 | diff --git a/drivers/media/dvb-frontends/ec100.h b/drivers/media/dvb-frontends/ec100.h | ||
3737 | index 37558403068d..9544bab5cd1d 100644 | ||
3738 | --- a/drivers/media/dvb-frontends/ec100.h | ||
3739 | +++ b/drivers/media/dvb-frontends/ec100.h | ||
3740 | @@ -31,7 +31,7 @@ struct ec100_config { | ||
3741 | }; | ||
3742 | |||
3743 | |||
3744 | -#if IS_ENABLED(CONFIG_DVB_EC100) | ||
3745 | +#if IS_REACHABLE(CONFIG_DVB_EC100) | ||
3746 | extern struct dvb_frontend *ec100_attach(const struct ec100_config *config, | ||
3747 | struct i2c_adapter *i2c); | ||
3748 | #else | ||
3749 | diff --git a/drivers/media/dvb-frontends/hd29l2.h b/drivers/media/dvb-frontends/hd29l2.h | ||
3750 | index 05cd13028a91..48e9ab74c883 100644 | ||
3751 | --- a/drivers/media/dvb-frontends/hd29l2.h | ||
3752 | +++ b/drivers/media/dvb-frontends/hd29l2.h | ||
3753 | @@ -51,7 +51,7 @@ struct hd29l2_config { | ||
3754 | }; | ||
3755 | |||
3756 | |||
3757 | -#if IS_ENABLED(CONFIG_DVB_HD29L2) | ||
3758 | +#if IS_REACHABLE(CONFIG_DVB_HD29L2) | ||
3759 | extern struct dvb_frontend *hd29l2_attach(const struct hd29l2_config *config, | ||
3760 | struct i2c_adapter *i2c); | ||
3761 | #else | ||
3762 | diff --git a/drivers/media/dvb-frontends/isl6405.h b/drivers/media/dvb-frontends/isl6405.h | ||
3763 | index 8abb70c26fd9..3c148b830bd1 100644 | ||
3764 | --- a/drivers/media/dvb-frontends/isl6405.h | ||
3765 | +++ b/drivers/media/dvb-frontends/isl6405.h | ||
3766 | @@ -55,7 +55,7 @@ | ||
3767 | #define ISL6405_ENT2 0x20 | ||
3768 | #define ISL6405_ISEL2 0x40 | ||
3769 | |||
3770 | -#if IS_ENABLED(CONFIG_DVB_ISL6405) | ||
3771 | +#if IS_REACHABLE(CONFIG_DVB_ISL6405) | ||
3772 | /* override_set and override_clear control which system register bits (above) | ||
3773 | * to always set & clear | ||
3774 | */ | ||
3775 | diff --git a/drivers/media/dvb-frontends/isl6421.h b/drivers/media/dvb-frontends/isl6421.h | ||
3776 | index 630e7f8a150e..3273597833fd 100644 | ||
3777 | --- a/drivers/media/dvb-frontends/isl6421.h | ||
3778 | +++ b/drivers/media/dvb-frontends/isl6421.h | ||
3779 | @@ -39,7 +39,7 @@ | ||
3780 | #define ISL6421_ISEL1 0x20 | ||
3781 | #define ISL6421_DCL 0x40 | ||
3782 | |||
3783 | -#if IS_ENABLED(CONFIG_DVB_ISL6421) | ||
3784 | +#if IS_REACHABLE(CONFIG_DVB_ISL6421) | ||
3785 | /* override_set and override_clear control which system register bits (above) to always set & clear */ | ||
3786 | extern struct dvb_frontend *isl6421_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 i2c_addr, | ||
3787 | u8 override_set, u8 override_clear, bool override_tone); | ||
3788 | diff --git a/drivers/media/dvb-frontends/isl6423.h b/drivers/media/dvb-frontends/isl6423.h | ||
3789 | index 80dfd9cc4f41..a64df0ee256b 100644 | ||
3790 | --- a/drivers/media/dvb-frontends/isl6423.h | ||
3791 | +++ b/drivers/media/dvb-frontends/isl6423.h | ||
3792 | @@ -42,7 +42,7 @@ struct isl6423_config { | ||
3793 | u8 mod_extern; | ||
3794 | }; | ||
3795 | |||
3796 | -#if IS_ENABLED(CONFIG_DVB_ISL6423) | ||
3797 | +#if IS_REACHABLE(CONFIG_DVB_ISL6423) | ||
3798 | |||
3799 | |||
3800 | extern struct dvb_frontend *isl6423_attach(struct dvb_frontend *fe, | ||
3801 | diff --git a/drivers/media/dvb-frontends/itd1000.h b/drivers/media/dvb-frontends/itd1000.h | ||
3802 | index edae0902f4fd..a691bb6f26de 100644 | ||
3803 | --- a/drivers/media/dvb-frontends/itd1000.h | ||
3804 | +++ b/drivers/media/dvb-frontends/itd1000.h | ||
3805 | @@ -29,7 +29,7 @@ struct itd1000_config { | ||
3806 | u8 i2c_address; | ||
3807 | }; | ||
3808 | |||
3809 | -#if IS_ENABLED(CONFIG_DVB_TUNER_ITD1000) | ||
3810 | +#if IS_REACHABLE(CONFIG_DVB_TUNER_ITD1000) | ||
3811 | extern struct dvb_frontend *itd1000_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct itd1000_config *cfg); | ||
3812 | #else | ||
3813 | static inline struct dvb_frontend *itd1000_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct itd1000_config *cfg) | ||
3814 | diff --git a/drivers/media/dvb-frontends/ix2505v.h b/drivers/media/dvb-frontends/ix2505v.h | ||
3815 | index 1a735a75aa98..af107a2dd357 100644 | ||
3816 | --- a/drivers/media/dvb-frontends/ix2505v.h | ||
3817 | +++ b/drivers/media/dvb-frontends/ix2505v.h | ||
3818 | @@ -49,7 +49,7 @@ struct ix2505v_config { | ||
3819 | |||
3820 | }; | ||
3821 | |||
3822 | -#if IS_ENABLED(CONFIG_DVB_IX2505V) | ||
3823 | +#if IS_REACHABLE(CONFIG_DVB_IX2505V) | ||
3824 | extern struct dvb_frontend *ix2505v_attach(struct dvb_frontend *fe, | ||
3825 | const struct ix2505v_config *config, struct i2c_adapter *i2c); | ||
3826 | #else | ||
3827 | diff --git a/drivers/media/dvb-frontends/l64781.h b/drivers/media/dvb-frontends/l64781.h | ||
3828 | index 6813b08a774d..8697e2c2ba36 100644 | ||
3829 | --- a/drivers/media/dvb-frontends/l64781.h | ||
3830 | +++ b/drivers/media/dvb-frontends/l64781.h | ||
3831 | @@ -31,7 +31,7 @@ struct l64781_config | ||
3832 | u8 demod_address; | ||
3833 | }; | ||
3834 | |||
3835 | -#if IS_ENABLED(CONFIG_DVB_L64781) | ||
3836 | +#if IS_REACHABLE(CONFIG_DVB_L64781) | ||
3837 | extern struct dvb_frontend* l64781_attach(const struct l64781_config* config, | ||
3838 | struct i2c_adapter* i2c); | ||
3839 | #else | ||
3840 | diff --git a/drivers/media/dvb-frontends/lg2160.h b/drivers/media/dvb-frontends/lg2160.h | ||
3841 | index 194a07a78dc1..d20bd909de39 100644 | ||
3842 | --- a/drivers/media/dvb-frontends/lg2160.h | ||
3843 | +++ b/drivers/media/dvb-frontends/lg2160.h | ||
3844 | @@ -67,7 +67,7 @@ struct lg2160_config { | ||
3845 | enum lg_chip_type lg_chip; | ||
3846 | }; | ||
3847 | |||
3848 | -#if IS_ENABLED(CONFIG_DVB_LG2160) | ||
3849 | +#if IS_REACHABLE(CONFIG_DVB_LG2160) | ||
3850 | extern | ||
3851 | struct dvb_frontend *lg2160_attach(const struct lg2160_config *config, | ||
3852 | struct i2c_adapter *i2c_adap); | ||
3853 | diff --git a/drivers/media/dvb-frontends/lgdt3305.h b/drivers/media/dvb-frontends/lgdt3305.h | ||
3854 | index d9ab556c1b27..d8666043b3d2 100644 | ||
3855 | --- a/drivers/media/dvb-frontends/lgdt3305.h | ||
3856 | +++ b/drivers/media/dvb-frontends/lgdt3305.h | ||
3857 | @@ -74,7 +74,7 @@ struct lgdt3305_config { | ||
3858 | enum lgdt_demod_chip_type demod_chip; | ||
3859 | }; | ||
3860 | |||
3861 | -#if IS_ENABLED(CONFIG_DVB_LGDT3305) | ||
3862 | +#if IS_REACHABLE(CONFIG_DVB_LGDT3305) | ||
3863 | extern | ||
3864 | struct dvb_frontend *lgdt3305_attach(const struct lgdt3305_config *config, | ||
3865 | struct i2c_adapter *i2c_adap); | ||
3866 | diff --git a/drivers/media/dvb-frontends/lgdt330x.h b/drivers/media/dvb-frontends/lgdt330x.h | ||
3867 | index ca0eab562e1e..b4ee363b6578 100644 | ||
3868 | --- a/drivers/media/dvb-frontends/lgdt330x.h | ||
3869 | +++ b/drivers/media/dvb-frontends/lgdt330x.h | ||
3870 | @@ -52,7 +52,7 @@ struct lgdt330x_config | ||
3871 | int clock_polarity_flip; | ||
3872 | }; | ||
3873 | |||
3874 | -#if IS_ENABLED(CONFIG_DVB_LGDT330X) | ||
3875 | +#if IS_REACHABLE(CONFIG_DVB_LGDT330X) | ||
3876 | extern struct dvb_frontend* lgdt330x_attach(const struct lgdt330x_config* config, | ||
3877 | struct i2c_adapter* i2c); | ||
3878 | #else | ||
3879 | diff --git a/drivers/media/dvb-frontends/lgs8gl5.h b/drivers/media/dvb-frontends/lgs8gl5.h | ||
3880 | index c2da59614727..a5b3faf121f0 100644 | ||
3881 | --- a/drivers/media/dvb-frontends/lgs8gl5.h | ||
3882 | +++ b/drivers/media/dvb-frontends/lgs8gl5.h | ||
3883 | @@ -31,7 +31,7 @@ struct lgs8gl5_config { | ||
3884 | u8 demod_address; | ||
3885 | }; | ||
3886 | |||
3887 | -#if IS_ENABLED(CONFIG_DVB_LGS8GL5) | ||
3888 | +#if IS_REACHABLE(CONFIG_DVB_LGS8GL5) | ||
3889 | extern struct dvb_frontend *lgs8gl5_attach( | ||
3890 | const struct lgs8gl5_config *config, struct i2c_adapter *i2c); | ||
3891 | #else | ||
3892 | diff --git a/drivers/media/dvb-frontends/lgs8gxx.h b/drivers/media/dvb-frontends/lgs8gxx.h | ||
3893 | index dadb78bf61a9..368c9928ef7f 100644 | ||
3894 | --- a/drivers/media/dvb-frontends/lgs8gxx.h | ||
3895 | +++ b/drivers/media/dvb-frontends/lgs8gxx.h | ||
3896 | @@ -80,7 +80,7 @@ struct lgs8gxx_config { | ||
3897 | u8 tuner_address; | ||
3898 | }; | ||
3899 | |||
3900 | -#if IS_ENABLED(CONFIG_DVB_LGS8GXX) | ||
3901 | +#if IS_REACHABLE(CONFIG_DVB_LGS8GXX) | ||
3902 | extern struct dvb_frontend *lgs8gxx_attach(const struct lgs8gxx_config *config, | ||
3903 | struct i2c_adapter *i2c); | ||
3904 | #else | ||
3905 | diff --git a/drivers/media/dvb-frontends/lnbh24.h b/drivers/media/dvb-frontends/lnbh24.h | ||
3906 | index b327a4f31d16..a088b8ec1e53 100644 | ||
3907 | --- a/drivers/media/dvb-frontends/lnbh24.h | ||
3908 | +++ b/drivers/media/dvb-frontends/lnbh24.h | ||
3909 | @@ -37,7 +37,7 @@ | ||
3910 | |||
3911 | #include <linux/dvb/frontend.h> | ||
3912 | |||
3913 | -#if IS_ENABLED(CONFIG_DVB_LNBP21) | ||
3914 | +#if IS_REACHABLE(CONFIG_DVB_LNBP21) | ||
3915 | /* override_set and override_clear control which | ||
3916 | system register bits (above) to always set & clear */ | ||
3917 | extern struct dvb_frontend *lnbh24_attach(struct dvb_frontend *fe, | ||
3918 | diff --git a/drivers/media/dvb-frontends/lnbp21.h b/drivers/media/dvb-frontends/lnbp21.h | ||
3919 | index dbcbcc2f20a3..a9b530de62a6 100644 | ||
3920 | --- a/drivers/media/dvb-frontends/lnbp21.h | ||
3921 | +++ b/drivers/media/dvb-frontends/lnbp21.h | ||
3922 | @@ -57,7 +57,7 @@ | ||
3923 | |||
3924 | #include <linux/dvb/frontend.h> | ||
3925 | |||
3926 | -#if IS_ENABLED(CONFIG_DVB_LNBP21) | ||
3927 | +#if IS_REACHABLE(CONFIG_DVB_LNBP21) | ||
3928 | /* override_set and override_clear control which | ||
3929 | system register bits (above) to always set & clear */ | ||
3930 | extern struct dvb_frontend *lnbp21_attach(struct dvb_frontend *fe, | ||
3931 | diff --git a/drivers/media/dvb-frontends/lnbp22.h b/drivers/media/dvb-frontends/lnbp22.h | ||
3932 | index 63861b311dd8..628148385182 100644 | ||
3933 | --- a/drivers/media/dvb-frontends/lnbp22.h | ||
3934 | +++ b/drivers/media/dvb-frontends/lnbp22.h | ||
3935 | @@ -39,7 +39,7 @@ | ||
3936 | |||
3937 | #include <linux/dvb/frontend.h> | ||
3938 | |||
3939 | -#if IS_ENABLED(CONFIG_DVB_LNBP22) | ||
3940 | +#if IS_REACHABLE(CONFIG_DVB_LNBP22) | ||
3941 | /* | ||
3942 | * override_set and override_clear control which system register bits (above) | ||
3943 | * to always set & clear | ||
3944 | diff --git a/drivers/media/dvb-frontends/m88rs2000.h b/drivers/media/dvb-frontends/m88rs2000.h | ||
3945 | index 0a50ea90736b..de7430178e9e 100644 | ||
3946 | --- a/drivers/media/dvb-frontends/m88rs2000.h | ||
3947 | +++ b/drivers/media/dvb-frontends/m88rs2000.h | ||
3948 | @@ -41,7 +41,7 @@ enum { | ||
3949 | CALL_IS_READ, | ||
3950 | }; | ||
3951 | |||
3952 | -#if IS_ENABLED(CONFIG_DVB_M88RS2000) | ||
3953 | +#if IS_REACHABLE(CONFIG_DVB_M88RS2000) | ||
3954 | extern struct dvb_frontend *m88rs2000_attach( | ||
3955 | const struct m88rs2000_config *config, struct i2c_adapter *i2c); | ||
3956 | #else | ||
3957 | diff --git a/drivers/media/dvb-frontends/mb86a16.h b/drivers/media/dvb-frontends/mb86a16.h | ||
3958 | index 277ce061acf9..e486dc0d8e60 100644 | ||
3959 | --- a/drivers/media/dvb-frontends/mb86a16.h | ||
3960 | +++ b/drivers/media/dvb-frontends/mb86a16.h | ||
3961 | @@ -33,7 +33,7 @@ struct mb86a16_config { | ||
3962 | |||
3963 | |||
3964 | |||
3965 | -#if IS_ENABLED(CONFIG_DVB_MB86A16) | ||
3966 | +#if IS_REACHABLE(CONFIG_DVB_MB86A16) | ||
3967 | |||
3968 | extern struct dvb_frontend *mb86a16_attach(const struct mb86a16_config *config, | ||
3969 | struct i2c_adapter *i2c_adap); | ||
3970 | diff --git a/drivers/media/dvb-frontends/mb86a20s.h b/drivers/media/dvb-frontends/mb86a20s.h | ||
3971 | index cbeb941fba7c..f749c8ac5f39 100644 | ||
3972 | --- a/drivers/media/dvb-frontends/mb86a20s.h | ||
3973 | +++ b/drivers/media/dvb-frontends/mb86a20s.h | ||
3974 | @@ -34,7 +34,7 @@ struct mb86a20s_config { | ||
3975 | bool is_serial; | ||
3976 | }; | ||
3977 | |||
3978 | -#if IS_ENABLED(CONFIG_DVB_MB86A20S) | ||
3979 | +#if IS_REACHABLE(CONFIG_DVB_MB86A20S) | ||
3980 | extern struct dvb_frontend *mb86a20s_attach(const struct mb86a20s_config *config, | ||
3981 | struct i2c_adapter *i2c); | ||
3982 | extern struct i2c_adapter *mb86a20s_get_tuner_i2c_adapter(struct dvb_frontend *); | ||
3983 | diff --git a/drivers/media/dvb-frontends/mt312.h b/drivers/media/dvb-frontends/mt312.h | ||
3984 | index 5706621ad79d..386939a90555 100644 | ||
3985 | --- a/drivers/media/dvb-frontends/mt312.h | ||
3986 | +++ b/drivers/media/dvb-frontends/mt312.h | ||
3987 | @@ -36,7 +36,7 @@ struct mt312_config { | ||
3988 | unsigned int voltage_inverted:1; | ||
3989 | }; | ||
3990 | |||
3991 | -#if IS_ENABLED(CONFIG_DVB_MT312) | ||
3992 | +#if IS_REACHABLE(CONFIG_DVB_MT312) | ||
3993 | struct dvb_frontend *mt312_attach(const struct mt312_config *config, | ||
3994 | struct i2c_adapter *i2c); | ||
3995 | #else | ||
3996 | diff --git a/drivers/media/dvb-frontends/mt352.h b/drivers/media/dvb-frontends/mt352.h | ||
3997 | index 451d904e1500..5873263bd1af 100644 | ||
3998 | --- a/drivers/media/dvb-frontends/mt352.h | ||
3999 | +++ b/drivers/media/dvb-frontends/mt352.h | ||
4000 | @@ -51,7 +51,7 @@ struct mt352_config | ||
4001 | int (*demod_init)(struct dvb_frontend* fe); | ||
4002 | }; | ||
4003 | |||
4004 | -#if IS_ENABLED(CONFIG_DVB_MT352) | ||
4005 | +#if IS_REACHABLE(CONFIG_DVB_MT352) | ||
4006 | extern struct dvb_frontend* mt352_attach(const struct mt352_config* config, | ||
4007 | struct i2c_adapter* i2c); | ||
4008 | #else | ||
4009 | diff --git a/drivers/media/dvb-frontends/nxt200x.h b/drivers/media/dvb-frontends/nxt200x.h | ||
4010 | index b518d545609e..3b3d7a7fa591 100644 | ||
4011 | --- a/drivers/media/dvb-frontends/nxt200x.h | ||
4012 | +++ b/drivers/media/dvb-frontends/nxt200x.h | ||
4013 | @@ -42,7 +42,7 @@ struct nxt200x_config | ||
4014 | int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured); | ||
4015 | }; | ||
4016 | |||
4017 | -#if IS_ENABLED(CONFIG_DVB_NXT200X) | ||
4018 | +#if IS_REACHABLE(CONFIG_DVB_NXT200X) | ||
4019 | extern struct dvb_frontend* nxt200x_attach(const struct nxt200x_config* config, | ||
4020 | struct i2c_adapter* i2c); | ||
4021 | #else | ||
4022 | diff --git a/drivers/media/dvb-frontends/nxt6000.h b/drivers/media/dvb-frontends/nxt6000.h | ||
4023 | index b5867c2ae681..a94cefcc6dfd 100644 | ||
4024 | --- a/drivers/media/dvb-frontends/nxt6000.h | ||
4025 | +++ b/drivers/media/dvb-frontends/nxt6000.h | ||
4026 | @@ -33,7 +33,7 @@ struct nxt6000_config | ||
4027 | u8 clock_inversion:1; | ||
4028 | }; | ||
4029 | |||
4030 | -#if IS_ENABLED(CONFIG_DVB_NXT6000) | ||
4031 | +#if IS_REACHABLE(CONFIG_DVB_NXT6000) | ||
4032 | extern struct dvb_frontend* nxt6000_attach(const struct nxt6000_config* config, | ||
4033 | struct i2c_adapter* i2c); | ||
4034 | #else | ||
4035 | diff --git a/drivers/media/dvb-frontends/or51132.h b/drivers/media/dvb-frontends/or51132.h | ||
4036 | index 938958386cb1..aeaaffc84c2e 100644 | ||
4037 | --- a/drivers/media/dvb-frontends/or51132.h | ||
4038 | +++ b/drivers/media/dvb-frontends/or51132.h | ||
4039 | @@ -34,7 +34,7 @@ struct or51132_config | ||
4040 | int (*set_ts_params)(struct dvb_frontend* fe, int is_punctured); | ||
4041 | }; | ||
4042 | |||
4043 | -#if IS_ENABLED(CONFIG_DVB_OR51132) | ||
4044 | +#if IS_REACHABLE(CONFIG_DVB_OR51132) | ||
4045 | extern struct dvb_frontend* or51132_attach(const struct or51132_config* config, | ||
4046 | struct i2c_adapter* i2c); | ||
4047 | #else | ||
4048 | diff --git a/drivers/media/dvb-frontends/or51211.h b/drivers/media/dvb-frontends/or51211.h | ||
4049 | index 9a8ae936b62d..cc6adab63249 100644 | ||
4050 | --- a/drivers/media/dvb-frontends/or51211.h | ||
4051 | +++ b/drivers/media/dvb-frontends/or51211.h | ||
4052 | @@ -37,7 +37,7 @@ struct or51211_config | ||
4053 | void (*sleep)(struct dvb_frontend * fe); | ||
4054 | }; | ||
4055 | |||
4056 | -#if IS_ENABLED(CONFIG_DVB_OR51211) | ||
4057 | +#if IS_REACHABLE(CONFIG_DVB_OR51211) | ||
4058 | extern struct dvb_frontend* or51211_attach(const struct or51211_config* config, | ||
4059 | struct i2c_adapter* i2c); | ||
4060 | #else | ||
4061 | diff --git a/drivers/media/dvb-frontends/s5h1409.h b/drivers/media/dvb-frontends/s5h1409.h | ||
4062 | index 63b1e0a34e4e..7749efbeba28 100644 | ||
4063 | --- a/drivers/media/dvb-frontends/s5h1409.h | ||
4064 | +++ b/drivers/media/dvb-frontends/s5h1409.h | ||
4065 | @@ -67,7 +67,7 @@ struct s5h1409_config { | ||
4066 | u8 hvr1600_opt; | ||
4067 | }; | ||
4068 | |||
4069 | -#if IS_ENABLED(CONFIG_DVB_S5H1409) | ||
4070 | +#if IS_REACHABLE(CONFIG_DVB_S5H1409) | ||
4071 | extern struct dvb_frontend *s5h1409_attach(const struct s5h1409_config *config, | ||
4072 | struct i2c_adapter *i2c); | ||
4073 | #else | ||
4074 | diff --git a/drivers/media/dvb-frontends/s5h1411.h b/drivers/media/dvb-frontends/s5h1411.h | ||
4075 | index e4f56871f982..d63b5b590abe 100644 | ||
4076 | --- a/drivers/media/dvb-frontends/s5h1411.h | ||
4077 | +++ b/drivers/media/dvb-frontends/s5h1411.h | ||
4078 | @@ -69,7 +69,7 @@ struct s5h1411_config { | ||
4079 | u8 status_mode; | ||
4080 | }; | ||
4081 | |||
4082 | -#if IS_ENABLED(CONFIG_DVB_S5H1411) | ||
4083 | +#if IS_REACHABLE(CONFIG_DVB_S5H1411) | ||
4084 | extern struct dvb_frontend *s5h1411_attach(const struct s5h1411_config *config, | ||
4085 | struct i2c_adapter *i2c); | ||
4086 | #else | ||
4087 | diff --git a/drivers/media/dvb-frontends/s5h1420.h b/drivers/media/dvb-frontends/s5h1420.h | ||
4088 | index 210049b5cf30..142d93e7d02b 100644 | ||
4089 | --- a/drivers/media/dvb-frontends/s5h1420.h | ||
4090 | +++ b/drivers/media/dvb-frontends/s5h1420.h | ||
4091 | @@ -40,7 +40,7 @@ struct s5h1420_config | ||
4092 | u8 serial_mpeg:1; | ||
4093 | }; | ||
4094 | |||
4095 | -#if IS_ENABLED(CONFIG_DVB_S5H1420) | ||
4096 | +#if IS_REACHABLE(CONFIG_DVB_S5H1420) | ||
4097 | extern struct dvb_frontend *s5h1420_attach(const struct s5h1420_config *config, | ||
4098 | struct i2c_adapter *i2c); | ||
4099 | extern struct i2c_adapter *s5h1420_get_tuner_i2c_adapter(struct dvb_frontend *fe); | ||
4100 | diff --git a/drivers/media/dvb-frontends/s5h1432.h b/drivers/media/dvb-frontends/s5h1432.h | ||
4101 | index 70917dd2533a..f490c5ee5801 100644 | ||
4102 | --- a/drivers/media/dvb-frontends/s5h1432.h | ||
4103 | +++ b/drivers/media/dvb-frontends/s5h1432.h | ||
4104 | @@ -75,7 +75,7 @@ struct s5h1432_config { | ||
4105 | u8 status_mode; | ||
4106 | }; | ||
4107 | |||
4108 | -#if IS_ENABLED(CONFIG_DVB_S5H1432) | ||
4109 | +#if IS_REACHABLE(CONFIG_DVB_S5H1432) | ||
4110 | extern struct dvb_frontend *s5h1432_attach(const struct s5h1432_config *config, | ||
4111 | struct i2c_adapter *i2c); | ||
4112 | #else | ||
4113 | diff --git a/drivers/media/dvb-frontends/s921.h b/drivers/media/dvb-frontends/s921.h | ||
4114 | index 9b20c9e0eb88..7d3999a4e974 100644 | ||
4115 | --- a/drivers/media/dvb-frontends/s921.h | ||
4116 | +++ b/drivers/media/dvb-frontends/s921.h | ||
4117 | @@ -25,7 +25,7 @@ struct s921_config { | ||
4118 | u8 demod_address; | ||
4119 | }; | ||
4120 | |||
4121 | -#if IS_ENABLED(CONFIG_DVB_S921) | ||
4122 | +#if IS_REACHABLE(CONFIG_DVB_S921) | ||
4123 | extern struct dvb_frontend *s921_attach(const struct s921_config *config, | ||
4124 | struct i2c_adapter *i2c); | ||
4125 | extern struct i2c_adapter *s921_get_tuner_i2c_adapter(struct dvb_frontend *); | ||
4126 | diff --git a/drivers/media/dvb-frontends/si21xx.h b/drivers/media/dvb-frontends/si21xx.h | ||
4127 | index 1509fed44a3a..ef5f351ca68e 100644 | ||
4128 | --- a/drivers/media/dvb-frontends/si21xx.h | ||
4129 | +++ b/drivers/media/dvb-frontends/si21xx.h | ||
4130 | @@ -13,7 +13,7 @@ struct si21xx_config { | ||
4131 | int min_delay_ms; | ||
4132 | }; | ||
4133 | |||
4134 | -#if IS_ENABLED(CONFIG_DVB_SI21XX) | ||
4135 | +#if IS_REACHABLE(CONFIG_DVB_SI21XX) | ||
4136 | extern struct dvb_frontend *si21xx_attach(const struct si21xx_config *config, | ||
4137 | struct i2c_adapter *i2c); | ||
4138 | #else | ||
4139 | diff --git a/drivers/media/dvb-frontends/sp8870.h b/drivers/media/dvb-frontends/sp8870.h | ||
4140 | index 065ec67d4e30..f507b9fd707b 100644 | ||
4141 | --- a/drivers/media/dvb-frontends/sp8870.h | ||
4142 | +++ b/drivers/media/dvb-frontends/sp8870.h | ||
4143 | @@ -35,7 +35,7 @@ struct sp8870_config | ||
4144 | int (*request_firmware)(struct dvb_frontend* fe, const struct firmware **fw, char* name); | ||
4145 | }; | ||
4146 | |||
4147 | -#if IS_ENABLED(CONFIG_DVB_SP8870) | ||
4148 | +#if IS_REACHABLE(CONFIG_DVB_SP8870) | ||
4149 | extern struct dvb_frontend* sp8870_attach(const struct sp8870_config* config, | ||
4150 | struct i2c_adapter* i2c); | ||
4151 | #else | ||
4152 | diff --git a/drivers/media/dvb-frontends/sp887x.h b/drivers/media/dvb-frontends/sp887x.h | ||
4153 | index 2cdc4e8bc9cd..412f011e6dfd 100644 | ||
4154 | --- a/drivers/media/dvb-frontends/sp887x.h | ||
4155 | +++ b/drivers/media/dvb-frontends/sp887x.h | ||
4156 | @@ -17,7 +17,7 @@ struct sp887x_config | ||
4157 | int (*request_firmware)(struct dvb_frontend* fe, const struct firmware **fw, char* name); | ||
4158 | }; | ||
4159 | |||
4160 | -#if IS_ENABLED(CONFIG_DVB_SP887X) | ||
4161 | +#if IS_REACHABLE(CONFIG_DVB_SP887X) | ||
4162 | extern struct dvb_frontend* sp887x_attach(const struct sp887x_config* config, | ||
4163 | struct i2c_adapter* i2c); | ||
4164 | #else | ||
4165 | diff --git a/drivers/media/dvb-frontends/stb0899_drv.h b/drivers/media/dvb-frontends/stb0899_drv.h | ||
4166 | index 139264d19263..0a72131a57db 100644 | ||
4167 | --- a/drivers/media/dvb-frontends/stb0899_drv.h | ||
4168 | +++ b/drivers/media/dvb-frontends/stb0899_drv.h | ||
4169 | @@ -141,7 +141,7 @@ struct stb0899_config { | ||
4170 | int (*tuner_set_rfsiggain)(struct dvb_frontend *fe, u32 rf_gain); | ||
4171 | }; | ||
4172 | |||
4173 | -#if IS_ENABLED(CONFIG_DVB_STB0899) | ||
4174 | +#if IS_REACHABLE(CONFIG_DVB_STB0899) | ||
4175 | |||
4176 | extern struct dvb_frontend *stb0899_attach(struct stb0899_config *config, | ||
4177 | struct i2c_adapter *i2c); | ||
4178 | diff --git a/drivers/media/dvb-frontends/stb6000.h b/drivers/media/dvb-frontends/stb6000.h | ||
4179 | index a768189bfaad..da581b652cb9 100644 | ||
4180 | --- a/drivers/media/dvb-frontends/stb6000.h | ||
4181 | +++ b/drivers/media/dvb-frontends/stb6000.h | ||
4182 | @@ -35,7 +35,7 @@ | ||
4183 | * @param i2c i2c adapter to use. | ||
4184 | * @return FE pointer on success, NULL on failure. | ||
4185 | */ | ||
4186 | -#if IS_ENABLED(CONFIG_DVB_STB6000) | ||
4187 | +#if IS_REACHABLE(CONFIG_DVB_STB6000) | ||
4188 | extern struct dvb_frontend *stb6000_attach(struct dvb_frontend *fe, int addr, | ||
4189 | struct i2c_adapter *i2c); | ||
4190 | #else | ||
4191 | diff --git a/drivers/media/dvb-frontends/stb6100.h b/drivers/media/dvb-frontends/stb6100.h | ||
4192 | index 3a1e40f3b8be..218c8188865d 100644 | ||
4193 | --- a/drivers/media/dvb-frontends/stb6100.h | ||
4194 | +++ b/drivers/media/dvb-frontends/stb6100.h | ||
4195 | @@ -94,7 +94,7 @@ struct stb6100_state { | ||
4196 | u32 reference; | ||
4197 | }; | ||
4198 | |||
4199 | -#if IS_ENABLED(CONFIG_DVB_STB6100) | ||
4200 | +#if IS_REACHABLE(CONFIG_DVB_STB6100) | ||
4201 | |||
4202 | extern struct dvb_frontend *stb6100_attach(struct dvb_frontend *fe, | ||
4203 | const struct stb6100_config *config, | ||
4204 | diff --git a/drivers/media/dvb-frontends/stv0288.h b/drivers/media/dvb-frontends/stv0288.h | ||
4205 | index a0bd93107154..b58603c00c80 100644 | ||
4206 | --- a/drivers/media/dvb-frontends/stv0288.h | ||
4207 | +++ b/drivers/media/dvb-frontends/stv0288.h | ||
4208 | @@ -43,7 +43,7 @@ struct stv0288_config { | ||
4209 | int (*set_ts_params)(struct dvb_frontend *fe, int is_punctured); | ||
4210 | }; | ||
4211 | |||
4212 | -#if IS_ENABLED(CONFIG_DVB_STV0288) | ||
4213 | +#if IS_REACHABLE(CONFIG_DVB_STV0288) | ||
4214 | extern struct dvb_frontend *stv0288_attach(const struct stv0288_config *config, | ||
4215 | struct i2c_adapter *i2c); | ||
4216 | #else | ||
4217 | diff --git a/drivers/media/dvb-frontends/stv0297.h b/drivers/media/dvb-frontends/stv0297.h | ||
4218 | index c8ff3639ce00..b30632a67333 100644 | ||
4219 | --- a/drivers/media/dvb-frontends/stv0297.h | ||
4220 | +++ b/drivers/media/dvb-frontends/stv0297.h | ||
4221 | @@ -42,7 +42,7 @@ struct stv0297_config | ||
4222 | u8 stop_during_read:1; | ||
4223 | }; | ||
4224 | |||
4225 | -#if IS_ENABLED(CONFIG_DVB_STV0297) | ||
4226 | +#if IS_REACHABLE(CONFIG_DVB_STV0297) | ||
4227 | extern struct dvb_frontend* stv0297_attach(const struct stv0297_config* config, | ||
4228 | struct i2c_adapter* i2c); | ||
4229 | #else | ||
4230 | diff --git a/drivers/media/dvb-frontends/stv0299.h b/drivers/media/dvb-frontends/stv0299.h | ||
4231 | index 06f70fc8327b..0aca30a8ec25 100644 | ||
4232 | --- a/drivers/media/dvb-frontends/stv0299.h | ||
4233 | +++ b/drivers/media/dvb-frontends/stv0299.h | ||
4234 | @@ -95,7 +95,7 @@ struct stv0299_config | ||
4235 | int (*set_ts_params)(struct dvb_frontend *fe, int is_punctured); | ||
4236 | }; | ||
4237 | |||
4238 | -#if IS_ENABLED(CONFIG_DVB_STV0299) | ||
4239 | +#if IS_REACHABLE(CONFIG_DVB_STV0299) | ||
4240 | extern struct dvb_frontend *stv0299_attach(const struct stv0299_config *config, | ||
4241 | struct i2c_adapter *i2c); | ||
4242 | #else | ||
4243 | diff --git a/drivers/media/dvb-frontends/stv0367.h b/drivers/media/dvb-frontends/stv0367.h | ||
4244 | index ea80b341f094..92b3e85fb818 100644 | ||
4245 | --- a/drivers/media/dvb-frontends/stv0367.h | ||
4246 | +++ b/drivers/media/dvb-frontends/stv0367.h | ||
4247 | @@ -39,7 +39,7 @@ struct stv0367_config { | ||
4248 | int clk_pol; | ||
4249 | }; | ||
4250 | |||
4251 | -#if IS_ENABLED(CONFIG_DVB_STV0367) | ||
4252 | +#if IS_REACHABLE(CONFIG_DVB_STV0367) | ||
4253 | extern struct | ||
4254 | dvb_frontend *stv0367ter_attach(const struct stv0367_config *config, | ||
4255 | struct i2c_adapter *i2c); | ||
4256 | diff --git a/drivers/media/dvb-frontends/stv0900.h b/drivers/media/dvb-frontends/stv0900.h | ||
4257 | index e2a6dc69ecb4..c90bf00ea9ce 100644 | ||
4258 | --- a/drivers/media/dvb-frontends/stv0900.h | ||
4259 | +++ b/drivers/media/dvb-frontends/stv0900.h | ||
4260 | @@ -58,7 +58,7 @@ struct stv0900_config { | ||
4261 | void (*set_lock_led)(struct dvb_frontend *fe, int offon); | ||
4262 | }; | ||
4263 | |||
4264 | -#if IS_ENABLED(CONFIG_DVB_STV0900) | ||
4265 | +#if IS_REACHABLE(CONFIG_DVB_STV0900) | ||
4266 | extern struct dvb_frontend *stv0900_attach(const struct stv0900_config *config, | ||
4267 | struct i2c_adapter *i2c, int demod); | ||
4268 | #else | ||
4269 | diff --git a/drivers/media/dvb-frontends/stv090x.h b/drivers/media/dvb-frontends/stv090x.h | ||
4270 | index 0bd6adcfee8a..97ada6b246b7 100644 | ||
4271 | --- a/drivers/media/dvb-frontends/stv090x.h | ||
4272 | +++ b/drivers/media/dvb-frontends/stv090x.h | ||
4273 | @@ -103,7 +103,7 @@ struct stv090x_config { | ||
4274 | void (*tuner_i2c_lock) (struct dvb_frontend *fe, int lock); | ||
4275 | }; | ||
4276 | |||
4277 | -#if IS_ENABLED(CONFIG_DVB_STV090x) | ||
4278 | +#if IS_REACHABLE(CONFIG_DVB_STV090x) | ||
4279 | |||
4280 | extern struct dvb_frontend *stv090x_attach(const struct stv090x_config *config, | ||
4281 | struct i2c_adapter *i2c, | ||
4282 | diff --git a/drivers/media/dvb-frontends/stv6110.h b/drivers/media/dvb-frontends/stv6110.h | ||
4283 | index 8fa07e6a6745..f3c8a5c6b77d 100644 | ||
4284 | --- a/drivers/media/dvb-frontends/stv6110.h | ||
4285 | +++ b/drivers/media/dvb-frontends/stv6110.h | ||
4286 | @@ -46,7 +46,7 @@ struct stv6110_config { | ||
4287 | u8 clk_div; /* divisor value for the output clock */ | ||
4288 | }; | ||
4289 | |||
4290 | -#if IS_ENABLED(CONFIG_DVB_STV6110) | ||
4291 | +#if IS_REACHABLE(CONFIG_DVB_STV6110) | ||
4292 | extern struct dvb_frontend *stv6110_attach(struct dvb_frontend *fe, | ||
4293 | const struct stv6110_config *config, | ||
4294 | struct i2c_adapter *i2c); | ||
4295 | diff --git a/drivers/media/dvb-frontends/stv6110x.h b/drivers/media/dvb-frontends/stv6110x.h | ||
4296 | index bc4766db29c5..9f7eb251aec3 100644 | ||
4297 | --- a/drivers/media/dvb-frontends/stv6110x.h | ||
4298 | +++ b/drivers/media/dvb-frontends/stv6110x.h | ||
4299 | @@ -53,7 +53,7 @@ struct stv6110x_devctl { | ||
4300 | }; | ||
4301 | |||
4302 | |||
4303 | -#if IS_ENABLED(CONFIG_DVB_STV6110x) | ||
4304 | +#if IS_REACHABLE(CONFIG_DVB_STV6110x) | ||
4305 | |||
4306 | extern struct stv6110x_devctl *stv6110x_attach(struct dvb_frontend *fe, | ||
4307 | const struct stv6110x_config *config, | ||
4308 | diff --git a/drivers/media/dvb-frontends/tda1002x.h b/drivers/media/dvb-frontends/tda1002x.h | ||
4309 | index e404b6e44802..0d334613de1b 100644 | ||
4310 | --- a/drivers/media/dvb-frontends/tda1002x.h | ||
4311 | +++ b/drivers/media/dvb-frontends/tda1002x.h | ||
4312 | @@ -57,7 +57,7 @@ struct tda10023_config { | ||
4313 | u16 deltaf; | ||
4314 | }; | ||
4315 | |||
4316 | -#if IS_ENABLED(CONFIG_DVB_TDA10021) | ||
4317 | +#if IS_REACHABLE(CONFIG_DVB_TDA10021) | ||
4318 | extern struct dvb_frontend* tda10021_attach(const struct tda1002x_config* config, | ||
4319 | struct i2c_adapter* i2c, u8 pwm); | ||
4320 | #else | ||
4321 | @@ -69,7 +69,7 @@ static inline struct dvb_frontend* tda10021_attach(const struct tda1002x_config* | ||
4322 | } | ||
4323 | #endif // CONFIG_DVB_TDA10021 | ||
4324 | |||
4325 | -#if IS_ENABLED(CONFIG_DVB_TDA10023) | ||
4326 | +#if IS_REACHABLE(CONFIG_DVB_TDA10023) | ||
4327 | extern struct dvb_frontend *tda10023_attach( | ||
4328 | const struct tda10023_config *config, | ||
4329 | struct i2c_adapter *i2c, u8 pwm); | ||
4330 | diff --git a/drivers/media/dvb-frontends/tda10048.h b/drivers/media/dvb-frontends/tda10048.h | ||
4331 | index 5e7bf4e47cb3..bc77a7311de1 100644 | ||
4332 | --- a/drivers/media/dvb-frontends/tda10048.h | ||
4333 | +++ b/drivers/media/dvb-frontends/tda10048.h | ||
4334 | @@ -73,7 +73,7 @@ struct tda10048_config { | ||
4335 | u8 pll_n; | ||
4336 | }; | ||
4337 | |||
4338 | -#if IS_ENABLED(CONFIG_DVB_TDA10048) | ||
4339 | +#if IS_REACHABLE(CONFIG_DVB_TDA10048) | ||
4340 | extern struct dvb_frontend *tda10048_attach( | ||
4341 | const struct tda10048_config *config, | ||
4342 | struct i2c_adapter *i2c); | ||
4343 | diff --git a/drivers/media/dvb-frontends/tda1004x.h b/drivers/media/dvb-frontends/tda1004x.h | ||
4344 | index dd283fbb61c0..efd7659dace9 100644 | ||
4345 | --- a/drivers/media/dvb-frontends/tda1004x.h | ||
4346 | +++ b/drivers/media/dvb-frontends/tda1004x.h | ||
4347 | @@ -117,7 +117,7 @@ struct tda1004x_state { | ||
4348 | enum tda1004x_demod demod_type; | ||
4349 | }; | ||
4350 | |||
4351 | -#if IS_ENABLED(CONFIG_DVB_TDA1004X) | ||
4352 | +#if IS_REACHABLE(CONFIG_DVB_TDA1004X) | ||
4353 | extern struct dvb_frontend* tda10045_attach(const struct tda1004x_config* config, | ||
4354 | struct i2c_adapter* i2c); | ||
4355 | |||
4356 | diff --git a/drivers/media/dvb-frontends/tda10071.h b/drivers/media/dvb-frontends/tda10071.h | ||
4357 | index 331b5a819383..da89f4249846 100644 | ||
4358 | --- a/drivers/media/dvb-frontends/tda10071.h | ||
4359 | +++ b/drivers/media/dvb-frontends/tda10071.h | ||
4360 | @@ -72,7 +72,7 @@ struct tda10071_config { | ||
4361 | }; | ||
4362 | |||
4363 | |||
4364 | -#if IS_ENABLED(CONFIG_DVB_TDA10071) | ||
4365 | +#if IS_REACHABLE(CONFIG_DVB_TDA10071) | ||
4366 | extern struct dvb_frontend *tda10071_attach( | ||
4367 | const struct tda10071_config *config, struct i2c_adapter *i2c); | ||
4368 | #else | ||
4369 | diff --git a/drivers/media/dvb-frontends/tda10086.h b/drivers/media/dvb-frontends/tda10086.h | ||
4370 | index 458fe91c1b88..690e469995b6 100644 | ||
4371 | --- a/drivers/media/dvb-frontends/tda10086.h | ||
4372 | +++ b/drivers/media/dvb-frontends/tda10086.h | ||
4373 | @@ -46,7 +46,7 @@ struct tda10086_config | ||
4374 | enum tda10086_xtal xtal_freq; | ||
4375 | }; | ||
4376 | |||
4377 | -#if IS_ENABLED(CONFIG_DVB_TDA10086) | ||
4378 | +#if IS_REACHABLE(CONFIG_DVB_TDA10086) | ||
4379 | extern struct dvb_frontend* tda10086_attach(const struct tda10086_config* config, | ||
4380 | struct i2c_adapter* i2c); | ||
4381 | #else | ||
4382 | diff --git a/drivers/media/dvb-frontends/tda18271c2dd.h b/drivers/media/dvb-frontends/tda18271c2dd.h | ||
4383 | index dd84f7b69bec..7ebd8eaff4eb 100644 | ||
4384 | --- a/drivers/media/dvb-frontends/tda18271c2dd.h | ||
4385 | +++ b/drivers/media/dvb-frontends/tda18271c2dd.h | ||
4386 | @@ -3,7 +3,7 @@ | ||
4387 | |||
4388 | #include <linux/kconfig.h> | ||
4389 | |||
4390 | -#if IS_ENABLED(CONFIG_DVB_TDA18271C2DD) | ||
4391 | +#if IS_REACHABLE(CONFIG_DVB_TDA18271C2DD) | ||
4392 | struct dvb_frontend *tda18271c2dd_attach(struct dvb_frontend *fe, | ||
4393 | struct i2c_adapter *i2c, u8 adr); | ||
4394 | #else | ||
4395 | diff --git a/drivers/media/dvb-frontends/tda665x.h b/drivers/media/dvb-frontends/tda665x.h | ||
4396 | index 03a0da6d5cf2..baf520baa42e 100644 | ||
4397 | --- a/drivers/media/dvb-frontends/tda665x.h | ||
4398 | +++ b/drivers/media/dvb-frontends/tda665x.h | ||
4399 | @@ -31,7 +31,7 @@ struct tda665x_config { | ||
4400 | u32 ref_divider; | ||
4401 | }; | ||
4402 | |||
4403 | -#if IS_ENABLED(CONFIG_DVB_TDA665x) | ||
4404 | +#if IS_REACHABLE(CONFIG_DVB_TDA665x) | ||
4405 | |||
4406 | extern struct dvb_frontend *tda665x_attach(struct dvb_frontend *fe, | ||
4407 | const struct tda665x_config *config, | ||
4408 | diff --git a/drivers/media/dvb-frontends/tda8083.h b/drivers/media/dvb-frontends/tda8083.h | ||
4409 | index de6b1860dfdd..46be06fa7e0d 100644 | ||
4410 | --- a/drivers/media/dvb-frontends/tda8083.h | ||
4411 | +++ b/drivers/media/dvb-frontends/tda8083.h | ||
4412 | @@ -35,7 +35,7 @@ struct tda8083_config | ||
4413 | u8 demod_address; | ||
4414 | }; | ||
4415 | |||
4416 | -#if IS_ENABLED(CONFIG_DVB_TDA8083) | ||
4417 | +#if IS_REACHABLE(CONFIG_DVB_TDA8083) | ||
4418 | extern struct dvb_frontend* tda8083_attach(const struct tda8083_config* config, | ||
4419 | struct i2c_adapter* i2c); | ||
4420 | #else | ||
4421 | diff --git a/drivers/media/dvb-frontends/tda8261.h b/drivers/media/dvb-frontends/tda8261.h | ||
4422 | index 55cf4ffcbfdf..9fa5b3076d5b 100644 | ||
4423 | --- a/drivers/media/dvb-frontends/tda8261.h | ||
4424 | +++ b/drivers/media/dvb-frontends/tda8261.h | ||
4425 | @@ -34,7 +34,7 @@ struct tda8261_config { | ||
4426 | enum tda8261_step step_size; | ||
4427 | }; | ||
4428 | |||
4429 | -#if IS_ENABLED(CONFIG_DVB_TDA8261) | ||
4430 | +#if IS_REACHABLE(CONFIG_DVB_TDA8261) | ||
4431 | |||
4432 | extern struct dvb_frontend *tda8261_attach(struct dvb_frontend *fe, | ||
4433 | const struct tda8261_config *config, | ||
4434 | diff --git a/drivers/media/dvb-frontends/tda826x.h b/drivers/media/dvb-frontends/tda826x.h | ||
4435 | index 5f0f20e7e4f8..81abe1aebe9f 100644 | ||
4436 | --- a/drivers/media/dvb-frontends/tda826x.h | ||
4437 | +++ b/drivers/media/dvb-frontends/tda826x.h | ||
4438 | @@ -35,7 +35,7 @@ | ||
4439 | * @param has_loopthrough Set to 1 if the card has a loopthrough RF connector. | ||
4440 | * @return FE pointer on success, NULL on failure. | ||
4441 | */ | ||
4442 | -#if IS_ENABLED(CONFIG_DVB_TDA826X) | ||
4443 | +#if IS_REACHABLE(CONFIG_DVB_TDA826X) | ||
4444 | extern struct dvb_frontend* tda826x_attach(struct dvb_frontend *fe, int addr, | ||
4445 | struct i2c_adapter *i2c, | ||
4446 | int has_loopthrough); | ||
4447 | diff --git a/drivers/media/dvb-frontends/ts2020.h b/drivers/media/dvb-frontends/ts2020.h | ||
4448 | index b2fe6bb3a38b..595841def66d 100644 | ||
4449 | --- a/drivers/media/dvb-frontends/ts2020.h | ||
4450 | +++ b/drivers/media/dvb-frontends/ts2020.h | ||
4451 | @@ -31,7 +31,7 @@ struct ts2020_config { | ||
4452 | u32 frequency_div; | ||
4453 | }; | ||
4454 | |||
4455 | -#if IS_ENABLED(CONFIG_DVB_TS2020) | ||
4456 | +#if IS_REACHABLE(CONFIG_DVB_TS2020) | ||
4457 | |||
4458 | extern struct dvb_frontend *ts2020_attach( | ||
4459 | struct dvb_frontend *fe, | ||
4460 | diff --git a/drivers/media/dvb-frontends/tua6100.h b/drivers/media/dvb-frontends/tua6100.h | ||
4461 | index 83a9c30e67ca..52919e04e258 100644 | ||
4462 | --- a/drivers/media/dvb-frontends/tua6100.h | ||
4463 | +++ b/drivers/media/dvb-frontends/tua6100.h | ||
4464 | @@ -34,7 +34,7 @@ | ||
4465 | #include <linux/i2c.h> | ||
4466 | #include "dvb_frontend.h" | ||
4467 | |||
4468 | -#if IS_ENABLED(CONFIG_DVB_TUA6100) | ||
4469 | +#if IS_REACHABLE(CONFIG_DVB_TUA6100) | ||
4470 | extern struct dvb_frontend *tua6100_attach(struct dvb_frontend *fe, int addr, struct i2c_adapter *i2c); | ||
4471 | #else | ||
4472 | static inline struct dvb_frontend* tua6100_attach(struct dvb_frontend *fe, int addr, struct i2c_adapter *i2c) | ||
4473 | diff --git a/drivers/media/dvb-frontends/ves1820.h b/drivers/media/dvb-frontends/ves1820.h | ||
4474 | index c073f353ac38..ece46fdcd714 100644 | ||
4475 | --- a/drivers/media/dvb-frontends/ves1820.h | ||
4476 | +++ b/drivers/media/dvb-frontends/ves1820.h | ||
4477 | @@ -41,7 +41,7 @@ struct ves1820_config | ||
4478 | u8 selagc:1; | ||
4479 | }; | ||
4480 | |||
4481 | -#if IS_ENABLED(CONFIG_DVB_VES1820) | ||
4482 | +#if IS_REACHABLE(CONFIG_DVB_VES1820) | ||
4483 | extern struct dvb_frontend* ves1820_attach(const struct ves1820_config* config, | ||
4484 | struct i2c_adapter* i2c, u8 pwm); | ||
4485 | #else | ||
4486 | diff --git a/drivers/media/dvb-frontends/ves1x93.h b/drivers/media/dvb-frontends/ves1x93.h | ||
4487 | index 2307caea6aec..4510fe2f6676 100644 | ||
4488 | --- a/drivers/media/dvb-frontends/ves1x93.h | ||
4489 | +++ b/drivers/media/dvb-frontends/ves1x93.h | ||
4490 | @@ -40,7 +40,7 @@ struct ves1x93_config | ||
4491 | u8 invert_pwm:1; | ||
4492 | }; | ||
4493 | |||
4494 | -#if IS_ENABLED(CONFIG_DVB_VES1X93) | ||
4495 | +#if IS_REACHABLE(CONFIG_DVB_VES1X93) | ||
4496 | extern struct dvb_frontend* ves1x93_attach(const struct ves1x93_config* config, | ||
4497 | struct i2c_adapter* i2c); | ||
4498 | #else | ||
4499 | diff --git a/drivers/media/dvb-frontends/zl10036.h b/drivers/media/dvb-frontends/zl10036.h | ||
4500 | index 5f1e8217eeb6..670e76a654ee 100644 | ||
4501 | --- a/drivers/media/dvb-frontends/zl10036.h | ||
4502 | +++ b/drivers/media/dvb-frontends/zl10036.h | ||
4503 | @@ -38,7 +38,7 @@ struct zl10036_config { | ||
4504 | int rf_loop_enable; | ||
4505 | }; | ||
4506 | |||
4507 | -#if IS_ENABLED(CONFIG_DVB_ZL10036) | ||
4508 | +#if IS_REACHABLE(CONFIG_DVB_ZL10036) | ||
4509 | extern struct dvb_frontend *zl10036_attach(struct dvb_frontend *fe, | ||
4510 | const struct zl10036_config *config, struct i2c_adapter *i2c); | ||
4511 | #else | ||
4512 | diff --git a/drivers/media/dvb-frontends/zl10039.h b/drivers/media/dvb-frontends/zl10039.h | ||
4513 | index 750b9bca9d02..070929444e71 100644 | ||
4514 | --- a/drivers/media/dvb-frontends/zl10039.h | ||
4515 | +++ b/drivers/media/dvb-frontends/zl10039.h | ||
4516 | @@ -24,7 +24,7 @@ | ||
4517 | |||
4518 | #include <linux/kconfig.h> | ||
4519 | |||
4520 | -#if IS_ENABLED(CONFIG_DVB_ZL10039) | ||
4521 | +#if IS_REACHABLE(CONFIG_DVB_ZL10039) | ||
4522 | struct dvb_frontend *zl10039_attach(struct dvb_frontend *fe, | ||
4523 | u8 i2c_addr, | ||
4524 | struct i2c_adapter *i2c); | ||
4525 | diff --git a/drivers/media/dvb-frontends/zl10353.h b/drivers/media/dvb-frontends/zl10353.h | ||
4526 | index 50c1004aef36..37aa6e8f454a 100644 | ||
4527 | --- a/drivers/media/dvb-frontends/zl10353.h | ||
4528 | +++ b/drivers/media/dvb-frontends/zl10353.h | ||
4529 | @@ -47,7 +47,7 @@ struct zl10353_config | ||
4530 | u8 pll_0; /* default: 0x15 */ | ||
4531 | }; | ||
4532 | |||
4533 | -#if IS_ENABLED(CONFIG_DVB_ZL10353) | ||
4534 | +#if IS_REACHABLE(CONFIG_DVB_ZL10353) | ||
4535 | extern struct dvb_frontend* zl10353_attach(const struct zl10353_config *config, | ||
4536 | struct i2c_adapter *i2c); | ||
4537 | #else | ||
4538 | diff --git a/drivers/media/pci/cx23885/altera-ci.h b/drivers/media/pci/cx23885/altera-ci.h | ||
4539 | index 5028f0cf83f4..6c511723fd1b 100644 | ||
4540 | --- a/drivers/media/pci/cx23885/altera-ci.h | ||
4541 | +++ b/drivers/media/pci/cx23885/altera-ci.h | ||
4542 | @@ -39,7 +39,7 @@ struct altera_ci_config { | ||
4543 | int (*fpga_rw) (void *dev, int ad_rg, int val, int rw); | ||
4544 | }; | ||
4545 | |||
4546 | -#if IS_ENABLED(CONFIG_MEDIA_ALTERA_CI) | ||
4547 | +#if IS_REACHABLE(CONFIG_MEDIA_ALTERA_CI) | ||
4548 | |||
4549 | extern int altera_ci_init(struct altera_ci_config *config, int ci_nr); | ||
4550 | extern void altera_ci_release(void *dev, int ci_nr); | ||
4551 | diff --git a/drivers/media/tuners/fc0011.h b/drivers/media/tuners/fc0011.h | ||
4552 | index 43ec893a6877..81bb568d6943 100644 | ||
4553 | --- a/drivers/media/tuners/fc0011.h | ||
4554 | +++ b/drivers/media/tuners/fc0011.h | ||
4555 | @@ -23,7 +23,7 @@ enum fc0011_fe_callback_commands { | ||
4556 | FC0011_FE_CALLBACK_RESET, | ||
4557 | }; | ||
4558 | |||
4559 | -#if IS_ENABLED(CONFIG_MEDIA_TUNER_FC0011) | ||
4560 | +#if IS_REACHABLE(CONFIG_MEDIA_TUNER_FC0011) | ||
4561 | struct dvb_frontend *fc0011_attach(struct dvb_frontend *fe, | ||
4562 | struct i2c_adapter *i2c, | ||
4563 | const struct fc0011_config *config); | ||
4564 | diff --git a/drivers/media/tuners/fc0012.h b/drivers/media/tuners/fc0012.h | ||
4565 | index 1d08057e3275..9ad32859bab0 100644 | ||
4566 | --- a/drivers/media/tuners/fc0012.h | ||
4567 | +++ b/drivers/media/tuners/fc0012.h | ||
4568 | @@ -49,7 +49,7 @@ struct fc0012_config { | ||
4569 | bool clock_out; | ||
4570 | }; | ||
4571 | |||
4572 | -#if IS_ENABLED(CONFIG_MEDIA_TUNER_FC0012) | ||
4573 | +#if IS_REACHABLE(CONFIG_MEDIA_TUNER_FC0012) | ||
4574 | extern struct dvb_frontend *fc0012_attach(struct dvb_frontend *fe, | ||
4575 | struct i2c_adapter *i2c, | ||
4576 | const struct fc0012_config *cfg); | ||
4577 | diff --git a/drivers/media/tuners/fc0013.h b/drivers/media/tuners/fc0013.h | ||
4578 | index d65d5b37f56e..e130bd7a3230 100644 | ||
4579 | --- a/drivers/media/tuners/fc0013.h | ||
4580 | +++ b/drivers/media/tuners/fc0013.h | ||
4581 | @@ -26,7 +26,7 @@ | ||
4582 | #include "dvb_frontend.h" | ||
4583 | #include "fc001x-common.h" | ||
4584 | |||
4585 | -#if IS_ENABLED(CONFIG_MEDIA_TUNER_FC0013) | ||
4586 | +#if IS_REACHABLE(CONFIG_MEDIA_TUNER_FC0013) | ||
4587 | extern struct dvb_frontend *fc0013_attach(struct dvb_frontend *fe, | ||
4588 | struct i2c_adapter *i2c, | ||
4589 | u8 i2c_address, int dual_master, | ||
4590 | diff --git a/drivers/media/tuners/fc2580.h b/drivers/media/tuners/fc2580.h | ||
4591 | index 9c43c1cc82d9..b1ce6770f88e 100644 | ||
4592 | --- a/drivers/media/tuners/fc2580.h | ||
4593 | +++ b/drivers/media/tuners/fc2580.h | ||
4594 | @@ -37,7 +37,7 @@ struct fc2580_config { | ||
4595 | u32 clock; | ||
4596 | }; | ||
4597 | |||
4598 | -#if IS_ENABLED(CONFIG_MEDIA_TUNER_FC2580) | ||
4599 | +#if IS_REACHABLE(CONFIG_MEDIA_TUNER_FC2580) | ||
4600 | extern struct dvb_frontend *fc2580_attach(struct dvb_frontend *fe, | ||
4601 | struct i2c_adapter *i2c, const struct fc2580_config *cfg); | ||
4602 | #else | ||
4603 | diff --git a/drivers/media/tuners/max2165.h b/drivers/media/tuners/max2165.h | ||
4604 | index 26e1dc64bb67..5054f01a78fb 100644 | ||
4605 | --- a/drivers/media/tuners/max2165.h | ||
4606 | +++ b/drivers/media/tuners/max2165.h | ||
4607 | @@ -32,7 +32,7 @@ struct max2165_config { | ||
4608 | u8 osc_clk; /* in MHz, selectable values: 4,16,18,20,22,24,26,28 */ | ||
4609 | }; | ||
4610 | |||
4611 | -#if IS_ENABLED(CONFIG_MEDIA_TUNER_MAX2165) | ||
4612 | +#if IS_REACHABLE(CONFIG_MEDIA_TUNER_MAX2165) | ||
4613 | extern struct dvb_frontend *max2165_attach(struct dvb_frontend *fe, | ||
4614 | struct i2c_adapter *i2c, | ||
4615 | struct max2165_config *cfg); | ||
4616 | diff --git a/drivers/media/tuners/mc44s803.h b/drivers/media/tuners/mc44s803.h | ||
4617 | index 9aae50aca2b7..b3e614be657d 100644 | ||
4618 | --- a/drivers/media/tuners/mc44s803.h | ||
4619 | +++ b/drivers/media/tuners/mc44s803.h | ||
4620 | @@ -32,7 +32,7 @@ struct mc44s803_config { | ||
4621 | u8 dig_out; | ||
4622 | }; | ||
4623 | |||
4624 | -#if IS_ENABLED(CONFIG_MEDIA_TUNER_MC44S803) | ||
4625 | +#if IS_REACHABLE(CONFIG_MEDIA_TUNER_MC44S803) | ||
4626 | extern struct dvb_frontend *mc44s803_attach(struct dvb_frontend *fe, | ||
4627 | struct i2c_adapter *i2c, struct mc44s803_config *cfg); | ||
4628 | #else | ||
4629 | diff --git a/drivers/media/tuners/mt2060.h b/drivers/media/tuners/mt2060.h | ||
4630 | index c64fc19cb278..6efed359a24f 100644 | ||
4631 | --- a/drivers/media/tuners/mt2060.h | ||
4632 | +++ b/drivers/media/tuners/mt2060.h | ||
4633 | @@ -30,7 +30,7 @@ struct mt2060_config { | ||
4634 | u8 clock_out; /* 0 = off, 1 = CLK/4, 2 = CLK/2, 3 = CLK/1 */ | ||
4635 | }; | ||
4636 | |||
4637 | -#if IS_ENABLED(CONFIG_MEDIA_TUNER_MT2060) | ||
4638 | +#if IS_REACHABLE(CONFIG_MEDIA_TUNER_MT2060) | ||
4639 | extern struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1); | ||
4640 | #else | ||
4641 | static inline struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1) | ||
4642 | diff --git a/drivers/media/tuners/mt2063.h b/drivers/media/tuners/mt2063.h | ||
4643 | index e1acfc8e7ae3..e55e0a6dd1be 100644 | ||
4644 | --- a/drivers/media/tuners/mt2063.h | ||
4645 | +++ b/drivers/media/tuners/mt2063.h | ||
4646 | @@ -8,7 +8,7 @@ struct mt2063_config { | ||
4647 | u32 refclock; | ||
4648 | }; | ||
4649 | |||
4650 | -#if IS_ENABLED(CONFIG_MEDIA_TUNER_MT2063) | ||
4651 | +#if IS_REACHABLE(CONFIG_MEDIA_TUNER_MT2063) | ||
4652 | struct dvb_frontend *mt2063_attach(struct dvb_frontend *fe, | ||
4653 | struct mt2063_config *config, | ||
4654 | struct i2c_adapter *i2c); | ||
4655 | diff --git a/drivers/media/tuners/mt20xx.h b/drivers/media/tuners/mt20xx.h | ||
4656 | index f56241ccaa00..9912362b415e 100644 | ||
4657 | --- a/drivers/media/tuners/mt20xx.h | ||
4658 | +++ b/drivers/media/tuners/mt20xx.h | ||
4659 | @@ -20,7 +20,7 @@ | ||
4660 | #include <linux/i2c.h> | ||
4661 | #include "dvb_frontend.h" | ||
4662 | |||
4663 | -#if IS_ENABLED(CONFIG_MEDIA_TUNER_MT20XX) | ||
4664 | +#if IS_REACHABLE(CONFIG_MEDIA_TUNER_MT20XX) | ||
4665 | extern struct dvb_frontend *microtune_attach(struct dvb_frontend *fe, | ||
4666 | struct i2c_adapter* i2c_adap, | ||
4667 | u8 i2c_addr); | ||
4668 | diff --git a/drivers/media/tuners/mt2131.h b/drivers/media/tuners/mt2131.h | ||
4669 | index 09ceaf68e47c..f5896c931979 100644 | ||
4670 | --- a/drivers/media/tuners/mt2131.h | ||
4671 | +++ b/drivers/media/tuners/mt2131.h | ||
4672 | @@ -30,7 +30,7 @@ struct mt2131_config { | ||
4673 | u8 clock_out; /* 0 = off, 1 = CLK/4, 2 = CLK/2, 3 = CLK/1 */ | ||
4674 | }; | ||
4675 | |||
4676 | -#if IS_ENABLED(CONFIG_MEDIA_TUNER_MT2131) | ||
4677 | +#if IS_REACHABLE(CONFIG_MEDIA_TUNER_MT2131) | ||
4678 | extern struct dvb_frontend* mt2131_attach(struct dvb_frontend *fe, | ||
4679 | struct i2c_adapter *i2c, | ||
4680 | struct mt2131_config *cfg, | ||
4681 | diff --git a/drivers/media/tuners/mt2266.h b/drivers/media/tuners/mt2266.h | ||
4682 | index fad6dd657d77..69abefa18c37 100644 | ||
4683 | --- a/drivers/media/tuners/mt2266.h | ||
4684 | +++ b/drivers/media/tuners/mt2266.h | ||
4685 | @@ -24,7 +24,7 @@ struct mt2266_config { | ||
4686 | u8 i2c_address; | ||
4687 | }; | ||
4688 | |||
4689 | -#if IS_ENABLED(CONFIG_MEDIA_TUNER_MT2266) | ||
4690 | +#if IS_REACHABLE(CONFIG_MEDIA_TUNER_MT2266) | ||
4691 | extern struct dvb_frontend * mt2266_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2266_config *cfg); | ||
4692 | #else | ||
4693 | static inline struct dvb_frontend * mt2266_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2266_config *cfg) | ||
4694 | diff --git a/drivers/media/tuners/mxl5005s.h b/drivers/media/tuners/mxl5005s.h | ||
4695 | index ae8db885ad87..5764b12c5c7c 100644 | ||
4696 | --- a/drivers/media/tuners/mxl5005s.h | ||
4697 | +++ b/drivers/media/tuners/mxl5005s.h | ||
4698 | @@ -118,7 +118,7 @@ struct mxl5005s_config { | ||
4699 | u8 AgcMasterByte; | ||
4700 | }; | ||
4701 | |||
4702 | -#if IS_ENABLED(CONFIG_MEDIA_TUNER_MXL5005S) | ||
4703 | +#if IS_REACHABLE(CONFIG_MEDIA_TUNER_MXL5005S) | ||
4704 | extern struct dvb_frontend *mxl5005s_attach(struct dvb_frontend *fe, | ||
4705 | struct i2c_adapter *i2c, | ||
4706 | struct mxl5005s_config *config); | ||
4707 | diff --git a/drivers/media/tuners/mxl5007t.h b/drivers/media/tuners/mxl5007t.h | ||
4708 | index 37b0942e2385..d4861d74152b 100644 | ||
4709 | --- a/drivers/media/tuners/mxl5007t.h | ||
4710 | +++ b/drivers/media/tuners/mxl5007t.h | ||
4711 | @@ -77,7 +77,7 @@ struct mxl5007t_config { | ||
4712 | unsigned int clk_out_enable:1; | ||
4713 | }; | ||
4714 | |||
4715 | -#if IS_ENABLED(CONFIG_MEDIA_TUNER_MXL5007T) | ||
4716 | +#if IS_REACHABLE(CONFIG_MEDIA_TUNER_MXL5007T) | ||
4717 | extern struct dvb_frontend *mxl5007t_attach(struct dvb_frontend *fe, | ||
4718 | struct i2c_adapter *i2c, u8 addr, | ||
4719 | struct mxl5007t_config *cfg); | ||
4720 | diff --git a/drivers/media/tuners/qt1010.h b/drivers/media/tuners/qt1010.h | ||
4721 | index 8ab5d479749f..e3198f23437c 100644 | ||
4722 | --- a/drivers/media/tuners/qt1010.h | ||
4723 | +++ b/drivers/media/tuners/qt1010.h | ||
4724 | @@ -36,7 +36,7 @@ struct qt1010_config { | ||
4725 | * @param cfg tuner hw based configuration | ||
4726 | * @return fe pointer on success, NULL on failure | ||
4727 | */ | ||
4728 | -#if IS_ENABLED(CONFIG_MEDIA_TUNER_QT1010) | ||
4729 | +#if IS_REACHABLE(CONFIG_MEDIA_TUNER_QT1010) | ||
4730 | extern struct dvb_frontend *qt1010_attach(struct dvb_frontend *fe, | ||
4731 | struct i2c_adapter *i2c, | ||
4732 | struct qt1010_config *cfg); | ||
4733 | diff --git a/drivers/media/tuners/r820t.h b/drivers/media/tuners/r820t.h | ||
4734 | index 48af3548027d..b1e5661af1c7 100644 | ||
4735 | --- a/drivers/media/tuners/r820t.h | ||
4736 | +++ b/drivers/media/tuners/r820t.h | ||
4737 | @@ -42,7 +42,7 @@ struct r820t_config { | ||
4738 | bool use_predetect; | ||
4739 | }; | ||
4740 | |||
4741 | -#if IS_ENABLED(CONFIG_MEDIA_TUNER_R820T) | ||
4742 | +#if IS_REACHABLE(CONFIG_MEDIA_TUNER_R820T) | ||
4743 | struct dvb_frontend *r820t_attach(struct dvb_frontend *fe, | ||
4744 | struct i2c_adapter *i2c, | ||
4745 | const struct r820t_config *cfg); | ||
4746 | diff --git a/drivers/media/tuners/tda18218.h b/drivers/media/tuners/tda18218.h | ||
4747 | index 366410e0cc9a..1eacb4f84e93 100644 | ||
4748 | --- a/drivers/media/tuners/tda18218.h | ||
4749 | +++ b/drivers/media/tuners/tda18218.h | ||
4750 | @@ -30,7 +30,7 @@ struct tda18218_config { | ||
4751 | u8 loop_through:1; | ||
4752 | }; | ||
4753 | |||
4754 | -#if IS_ENABLED(CONFIG_MEDIA_TUNER_TDA18218) | ||
4755 | +#if IS_REACHABLE(CONFIG_MEDIA_TUNER_TDA18218) | ||
4756 | extern struct dvb_frontend *tda18218_attach(struct dvb_frontend *fe, | ||
4757 | struct i2c_adapter *i2c, struct tda18218_config *cfg); | ||
4758 | #else | ||
4759 | diff --git a/drivers/media/tuners/tda18271.h b/drivers/media/tuners/tda18271.h | ||
4760 | index 4c418d63f540..0a846333ce57 100644 | ||
4761 | --- a/drivers/media/tuners/tda18271.h | ||
4762 | +++ b/drivers/media/tuners/tda18271.h | ||
4763 | @@ -121,7 +121,7 @@ enum tda18271_mode { | ||
4764 | TDA18271_DIGITAL, | ||
4765 | }; | ||
4766 | |||
4767 | -#if IS_ENABLED(CONFIG_MEDIA_TUNER_TDA18271) | ||
4768 | +#if IS_REACHABLE(CONFIG_MEDIA_TUNER_TDA18271) | ||
4769 | extern struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr, | ||
4770 | struct i2c_adapter *i2c, | ||
4771 | struct tda18271_config *cfg); | ||
4772 | diff --git a/drivers/media/tuners/tda827x.h b/drivers/media/tuners/tda827x.h | ||
4773 | index b64292152baf..abf2e2fe5350 100644 | ||
4774 | --- a/drivers/media/tuners/tda827x.h | ||
4775 | +++ b/drivers/media/tuners/tda827x.h | ||
4776 | @@ -51,7 +51,7 @@ struct tda827x_config | ||
4777 | * @param cfg optional callback function pointers. | ||
4778 | * @return FE pointer on success, NULL on failure. | ||
4779 | */ | ||
4780 | -#if IS_ENABLED(CONFIG_MEDIA_TUNER_TDA827X) | ||
4781 | +#if IS_REACHABLE(CONFIG_MEDIA_TUNER_TDA827X) | ||
4782 | extern struct dvb_frontend* tda827x_attach(struct dvb_frontend *fe, int addr, | ||
4783 | struct i2c_adapter *i2c, | ||
4784 | struct tda827x_config *cfg); | ||
4785 | diff --git a/drivers/media/tuners/tda8290.h b/drivers/media/tuners/tda8290.h | ||
4786 | index cf96e585785e..901b8cac7105 100644 | ||
4787 | --- a/drivers/media/tuners/tda8290.h | ||
4788 | +++ b/drivers/media/tuners/tda8290.h | ||
4789 | @@ -38,7 +38,7 @@ struct tda829x_config { | ||
4790 | struct tda18271_std_map *tda18271_std_map; | ||
4791 | }; | ||
4792 | |||
4793 | -#if IS_ENABLED(CONFIG_MEDIA_TUNER_TDA8290) | ||
4794 | +#if IS_REACHABLE(CONFIG_MEDIA_TUNER_TDA8290) | ||
4795 | extern int tda829x_probe(struct i2c_adapter *i2c_adap, u8 i2c_addr); | ||
4796 | |||
4797 | extern struct dvb_frontend *tda829x_attach(struct dvb_frontend *fe, | ||
4798 | diff --git a/drivers/media/tuners/tda9887.h b/drivers/media/tuners/tda9887.h | ||
4799 | index 37a4a1123e0c..95070eca02ca 100644 | ||
4800 | --- a/drivers/media/tuners/tda9887.h | ||
4801 | +++ b/drivers/media/tuners/tda9887.h | ||
4802 | @@ -21,7 +21,7 @@ | ||
4803 | #include "dvb_frontend.h" | ||
4804 | |||
4805 | /* ------------------------------------------------------------------------ */ | ||
4806 | -#if IS_ENABLED(CONFIG_MEDIA_TUNER_TDA9887) | ||
4807 | +#if IS_REACHABLE(CONFIG_MEDIA_TUNER_TDA9887) | ||
4808 | extern struct dvb_frontend *tda9887_attach(struct dvb_frontend *fe, | ||
4809 | struct i2c_adapter *i2c_adap, | ||
4810 | u8 i2c_addr); | ||
4811 | diff --git a/drivers/media/tuners/tea5761.h b/drivers/media/tuners/tea5761.h | ||
4812 | index 933228ffb509..2d624d9919e3 100644 | ||
4813 | --- a/drivers/media/tuners/tea5761.h | ||
4814 | +++ b/drivers/media/tuners/tea5761.h | ||
4815 | @@ -20,7 +20,7 @@ | ||
4816 | #include <linux/i2c.h> | ||
4817 | #include "dvb_frontend.h" | ||
4818 | |||
4819 | -#if IS_ENABLED(CONFIG_MEDIA_TUNER_TEA5761) | ||
4820 | +#if IS_REACHABLE(CONFIG_MEDIA_TUNER_TEA5761) | ||
4821 | extern int tea5761_autodetection(struct i2c_adapter* i2c_adap, u8 i2c_addr); | ||
4822 | |||
4823 | extern struct dvb_frontend *tea5761_attach(struct dvb_frontend *fe, | ||
4824 | diff --git a/drivers/media/tuners/tea5767.h b/drivers/media/tuners/tea5767.h | ||
4825 | index c39101199383..4f6f6c92db78 100644 | ||
4826 | --- a/drivers/media/tuners/tea5767.h | ||
4827 | +++ b/drivers/media/tuners/tea5767.h | ||
4828 | @@ -39,7 +39,7 @@ struct tea5767_ctrl { | ||
4829 | enum tea5767_xtal xtal_freq; | ||
4830 | }; | ||
4831 | |||
4832 | -#if IS_ENABLED(CONFIG_MEDIA_TUNER_TEA5767) | ||
4833 | +#if IS_REACHABLE(CONFIG_MEDIA_TUNER_TEA5767) | ||
4834 | extern int tea5767_autodetection(struct i2c_adapter* i2c_adap, u8 i2c_addr); | ||
4835 | |||
4836 | extern struct dvb_frontend *tea5767_attach(struct dvb_frontend *fe, | ||
4837 | diff --git a/drivers/media/tuners/tua9001.h b/drivers/media/tuners/tua9001.h | ||
4838 | index 26358da1c100..2c3375c7aeb9 100644 | ||
4839 | --- a/drivers/media/tuners/tua9001.h | ||
4840 | +++ b/drivers/media/tuners/tua9001.h | ||
4841 | @@ -51,7 +51,7 @@ struct tua9001_config { | ||
4842 | #define TUA9001_CMD_RESETN 1 | ||
4843 | #define TUA9001_CMD_RXEN 2 | ||
4844 | |||
4845 | -#if IS_ENABLED(CONFIG_MEDIA_TUNER_TUA9001) | ||
4846 | +#if IS_REACHABLE(CONFIG_MEDIA_TUNER_TUA9001) | ||
4847 | extern struct dvb_frontend *tua9001_attach(struct dvb_frontend *fe, | ||
4848 | struct i2c_adapter *i2c, struct tua9001_config *cfg); | ||
4849 | #else | ||
4850 | diff --git a/drivers/media/tuners/tuner-simple.h b/drivers/media/tuners/tuner-simple.h | ||
4851 | index ffd12cfe650b..6399b45b0590 100644 | ||
4852 | --- a/drivers/media/tuners/tuner-simple.h | ||
4853 | +++ b/drivers/media/tuners/tuner-simple.h | ||
4854 | @@ -20,7 +20,7 @@ | ||
4855 | #include <linux/i2c.h> | ||
4856 | #include "dvb_frontend.h" | ||
4857 | |||
4858 | -#if IS_ENABLED(CONFIG_MEDIA_TUNER_SIMPLE) | ||
4859 | +#if IS_REACHABLE(CONFIG_MEDIA_TUNER_SIMPLE) | ||
4860 | extern struct dvb_frontend *simple_tuner_attach(struct dvb_frontend *fe, | ||
4861 | struct i2c_adapter *i2c_adap, | ||
4862 | u8 i2c_addr, | ||
4863 | diff --git a/drivers/media/tuners/tuner-xc2028.h b/drivers/media/tuners/tuner-xc2028.h | ||
4864 | index 181d087faec4..98e4effca896 100644 | ||
4865 | --- a/drivers/media/tuners/tuner-xc2028.h | ||
4866 | +++ b/drivers/media/tuners/tuner-xc2028.h | ||
4867 | @@ -56,7 +56,7 @@ struct xc2028_config { | ||
4868 | #define XC2028_RESET_CLK 1 | ||
4869 | #define XC2028_I2C_FLUSH 2 | ||
4870 | |||
4871 | -#if IS_ENABLED(CONFIG_MEDIA_TUNER_XC2028) | ||
4872 | +#if IS_REACHABLE(CONFIG_MEDIA_TUNER_XC2028) | ||
4873 | extern struct dvb_frontend *xc2028_attach(struct dvb_frontend *fe, | ||
4874 | struct xc2028_config *cfg); | ||
4875 | #else | ||
4876 | diff --git a/drivers/media/tuners/xc4000.h b/drivers/media/tuners/xc4000.h | ||
4877 | index 97c23de5296c..40517860cf67 100644 | ||
4878 | --- a/drivers/media/tuners/xc4000.h | ||
4879 | +++ b/drivers/media/tuners/xc4000.h | ||
4880 | @@ -50,7 +50,7 @@ struct xc4000_config { | ||
4881 | * it's passed back to a bridge during tuner_callback(). | ||
4882 | */ | ||
4883 | |||
4884 | -#if IS_ENABLED(CONFIG_MEDIA_TUNER_XC4000) | ||
4885 | +#if IS_REACHABLE(CONFIG_MEDIA_TUNER_XC4000) | ||
4886 | extern struct dvb_frontend *xc4000_attach(struct dvb_frontend *fe, | ||
4887 | struct i2c_adapter *i2c, | ||
4888 | struct xc4000_config *cfg); | ||
4889 | diff --git a/drivers/media/tuners/xc5000.h b/drivers/media/tuners/xc5000.h | ||
4890 | index 7245cae19f0c..f746a97e90bb 100644 | ||
4891 | --- a/drivers/media/tuners/xc5000.h | ||
4892 | +++ b/drivers/media/tuners/xc5000.h | ||
4893 | @@ -57,7 +57,7 @@ struct xc5000_config { | ||
4894 | * it's passed back to a bridge during tuner_callback(). | ||
4895 | */ | ||
4896 | |||
4897 | -#if IS_ENABLED(CONFIG_MEDIA_TUNER_XC5000) | ||
4898 | +#if IS_REACHABLE(CONFIG_MEDIA_TUNER_XC5000) | ||
4899 | extern struct dvb_frontend *xc5000_attach(struct dvb_frontend *fe, | ||
4900 | struct i2c_adapter *i2c, | ||
4901 | const struct xc5000_config *cfg); | ||
4902 | diff --git a/drivers/net/bonding/bond_options.c b/drivers/net/bonding/bond_options.c | ||
4903 | index b62697f4a3de..f1c53944a2c3 100644 | ||
4904 | --- a/drivers/net/bonding/bond_options.c | ||
4905 | +++ b/drivers/net/bonding/bond_options.c | ||
4906 | @@ -625,7 +625,7 @@ int __bond_opt_set(struct bonding *bond, | ||
4907 | out: | ||
4908 | if (ret) | ||
4909 | bond_opt_error_interpret(bond, opt, ret, val); | ||
4910 | - else | ||
4911 | + else if (bond->dev->reg_state == NETREG_REGISTERED) | ||
4912 | call_netdevice_notifiers(NETDEV_CHANGEINFODATA, bond->dev); | ||
4913 | |||
4914 | return ret; | ||
4915 | diff --git a/drivers/net/ethernet/emulex/benet/be_cmds.c b/drivers/net/ethernet/emulex/benet/be_cmds.c | ||
4916 | index fead5c65a4f0..9c827b7642e7 100644 | ||
4917 | --- a/drivers/net/ethernet/emulex/benet/be_cmds.c | ||
4918 | +++ b/drivers/net/ethernet/emulex/benet/be_cmds.c | ||
4919 | @@ -1705,9 +1705,9 @@ int be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf) | ||
4920 | total_size = buf_len; | ||
4921 | |||
4922 | get_fat_cmd.size = sizeof(struct be_cmd_req_get_fat) + 60*1024; | ||
4923 | - get_fat_cmd.va = pci_alloc_consistent(adapter->pdev, | ||
4924 | - get_fat_cmd.size, | ||
4925 | - &get_fat_cmd.dma); | ||
4926 | + get_fat_cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, | ||
4927 | + get_fat_cmd.size, | ||
4928 | + &get_fat_cmd.dma, GFP_ATOMIC); | ||
4929 | if (!get_fat_cmd.va) { | ||
4930 | dev_err(&adapter->pdev->dev, | ||
4931 | "Memory allocation failure while reading FAT data\n"); | ||
4932 | @@ -1752,8 +1752,8 @@ int be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf) | ||
4933 | log_offset += buf_size; | ||
4934 | } | ||
4935 | err: | ||
4936 | - pci_free_consistent(adapter->pdev, get_fat_cmd.size, | ||
4937 | - get_fat_cmd.va, get_fat_cmd.dma); | ||
4938 | + dma_free_coherent(&adapter->pdev->dev, get_fat_cmd.size, | ||
4939 | + get_fat_cmd.va, get_fat_cmd.dma); | ||
4940 | spin_unlock_bh(&adapter->mcc_lock); | ||
4941 | return status; | ||
4942 | } | ||
4943 | @@ -2223,12 +2223,12 @@ int be_cmd_read_port_transceiver_data(struct be_adapter *adapter, | ||
4944 | return -EINVAL; | ||
4945 | |||
4946 | cmd.size = sizeof(struct be_cmd_resp_port_type); | ||
4947 | - cmd.va = pci_alloc_consistent(adapter->pdev, cmd.size, &cmd.dma); | ||
4948 | + cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, | ||
4949 | + GFP_ATOMIC); | ||
4950 | if (!cmd.va) { | ||
4951 | dev_err(&adapter->pdev->dev, "Memory allocation failed\n"); | ||
4952 | return -ENOMEM; | ||
4953 | } | ||
4954 | - memset(cmd.va, 0, cmd.size); | ||
4955 | |||
4956 | spin_lock_bh(&adapter->mcc_lock); | ||
4957 | |||
4958 | @@ -2253,7 +2253,7 @@ int be_cmd_read_port_transceiver_data(struct be_adapter *adapter, | ||
4959 | } | ||
4960 | err: | ||
4961 | spin_unlock_bh(&adapter->mcc_lock); | ||
4962 | - pci_free_consistent(adapter->pdev, cmd.size, cmd.va, cmd.dma); | ||
4963 | + dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, cmd.dma); | ||
4964 | return status; | ||
4965 | } | ||
4966 | |||
4967 | @@ -2702,7 +2702,8 @@ int be_cmd_get_phy_info(struct be_adapter *adapter) | ||
4968 | goto err; | ||
4969 | } | ||
4970 | cmd.size = sizeof(struct be_cmd_req_get_phy_info); | ||
4971 | - cmd.va = pci_alloc_consistent(adapter->pdev, cmd.size, &cmd.dma); | ||
4972 | + cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, | ||
4973 | + GFP_ATOMIC); | ||
4974 | if (!cmd.va) { | ||
4975 | dev_err(&adapter->pdev->dev, "Memory alloc failure\n"); | ||
4976 | status = -ENOMEM; | ||
4977 | @@ -2736,7 +2737,7 @@ int be_cmd_get_phy_info(struct be_adapter *adapter) | ||
4978 | BE_SUPPORTED_SPEED_1GBPS; | ||
4979 | } | ||
4980 | } | ||
4981 | - pci_free_consistent(adapter->pdev, cmd.size, cmd.va, cmd.dma); | ||
4982 | + dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, cmd.dma); | ||
4983 | err: | ||
4984 | spin_unlock_bh(&adapter->mcc_lock); | ||
4985 | return status; | ||
4986 | @@ -2787,8 +2788,9 @@ int be_cmd_get_cntl_attributes(struct be_adapter *adapter) | ||
4987 | |||
4988 | memset(&attribs_cmd, 0, sizeof(struct be_dma_mem)); | ||
4989 | attribs_cmd.size = sizeof(struct be_cmd_resp_cntl_attribs); | ||
4990 | - attribs_cmd.va = pci_alloc_consistent(adapter->pdev, attribs_cmd.size, | ||
4991 | - &attribs_cmd.dma); | ||
4992 | + attribs_cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, | ||
4993 | + attribs_cmd.size, | ||
4994 | + &attribs_cmd.dma, GFP_ATOMIC); | ||
4995 | if (!attribs_cmd.va) { | ||
4996 | dev_err(&adapter->pdev->dev, "Memory allocation failure\n"); | ||
4997 | status = -ENOMEM; | ||
4998 | @@ -2815,8 +2817,8 @@ int be_cmd_get_cntl_attributes(struct be_adapter *adapter) | ||
4999 | err: | ||
5000 | mutex_unlock(&adapter->mbox_lock); | ||
5001 | if (attribs_cmd.va) | ||
5002 | - pci_free_consistent(adapter->pdev, attribs_cmd.size, | ||
5003 | - attribs_cmd.va, attribs_cmd.dma); | ||
5004 | + dma_free_coherent(&adapter->pdev->dev, attribs_cmd.size, | ||
5005 | + attribs_cmd.va, attribs_cmd.dma); | ||
5006 | return status; | ||
5007 | } | ||
5008 | |||
5009 | @@ -2954,9 +2956,10 @@ int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac, | ||
5010 | |||
5011 | memset(&get_mac_list_cmd, 0, sizeof(struct be_dma_mem)); | ||
5012 | get_mac_list_cmd.size = sizeof(struct be_cmd_resp_get_mac_list); | ||
5013 | - get_mac_list_cmd.va = pci_alloc_consistent(adapter->pdev, | ||
5014 | - get_mac_list_cmd.size, | ||
5015 | - &get_mac_list_cmd.dma); | ||
5016 | + get_mac_list_cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, | ||
5017 | + get_mac_list_cmd.size, | ||
5018 | + &get_mac_list_cmd.dma, | ||
5019 | + GFP_ATOMIC); | ||
5020 | |||
5021 | if (!get_mac_list_cmd.va) { | ||
5022 | dev_err(&adapter->pdev->dev, | ||
5023 | @@ -3029,8 +3032,8 @@ int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac, | ||
5024 | |||
5025 | out: | ||
5026 | spin_unlock_bh(&adapter->mcc_lock); | ||
5027 | - pci_free_consistent(adapter->pdev, get_mac_list_cmd.size, | ||
5028 | - get_mac_list_cmd.va, get_mac_list_cmd.dma); | ||
5029 | + dma_free_coherent(&adapter->pdev->dev, get_mac_list_cmd.size, | ||
5030 | + get_mac_list_cmd.va, get_mac_list_cmd.dma); | ||
5031 | return status; | ||
5032 | } | ||
5033 | |||
5034 | @@ -3083,8 +3086,8 @@ int be_cmd_set_mac_list(struct be_adapter *adapter, u8 *mac_array, | ||
5035 | |||
5036 | memset(&cmd, 0, sizeof(struct be_dma_mem)); | ||
5037 | cmd.size = sizeof(struct be_cmd_req_set_mac_list); | ||
5038 | - cmd.va = dma_alloc_coherent(&adapter->pdev->dev, cmd.size, | ||
5039 | - &cmd.dma, GFP_KERNEL); | ||
5040 | + cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, | ||
5041 | + GFP_KERNEL); | ||
5042 | if (!cmd.va) | ||
5043 | return -ENOMEM; | ||
5044 | |||
5045 | @@ -3255,7 +3258,8 @@ int be_cmd_get_acpi_wol_cap(struct be_adapter *adapter) | ||
5046 | |||
5047 | memset(&cmd, 0, sizeof(struct be_dma_mem)); | ||
5048 | cmd.size = sizeof(struct be_cmd_resp_acpi_wol_magic_config_v1); | ||
5049 | - cmd.va = pci_alloc_consistent(adapter->pdev, cmd.size, &cmd.dma); | ||
5050 | + cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, | ||
5051 | + GFP_ATOMIC); | ||
5052 | if (!cmd.va) { | ||
5053 | dev_err(&adapter->pdev->dev, "Memory allocation failure\n"); | ||
5054 | status = -ENOMEM; | ||
5055 | @@ -3290,7 +3294,8 @@ int be_cmd_get_acpi_wol_cap(struct be_adapter *adapter) | ||
5056 | err: | ||
5057 | mutex_unlock(&adapter->mbox_lock); | ||
5058 | if (cmd.va) | ||
5059 | - pci_free_consistent(adapter->pdev, cmd.size, cmd.va, cmd.dma); | ||
5060 | + dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, | ||
5061 | + cmd.dma); | ||
5062 | return status; | ||
5063 | |||
5064 | } | ||
5065 | @@ -3304,8 +3309,9 @@ int be_cmd_set_fw_log_level(struct be_adapter *adapter, u32 level) | ||
5066 | |||
5067 | memset(&extfat_cmd, 0, sizeof(struct be_dma_mem)); | ||
5068 | extfat_cmd.size = sizeof(struct be_cmd_resp_get_ext_fat_caps); | ||
5069 | - extfat_cmd.va = pci_alloc_consistent(adapter->pdev, extfat_cmd.size, | ||
5070 | - &extfat_cmd.dma); | ||
5071 | + extfat_cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, | ||
5072 | + extfat_cmd.size, &extfat_cmd.dma, | ||
5073 | + GFP_ATOMIC); | ||
5074 | if (!extfat_cmd.va) | ||
5075 | return -ENOMEM; | ||
5076 | |||
5077 | @@ -3327,8 +3333,8 @@ int be_cmd_set_fw_log_level(struct be_adapter *adapter, u32 level) | ||
5078 | |||
5079 | status = be_cmd_set_ext_fat_capabilites(adapter, &extfat_cmd, cfgs); | ||
5080 | err: | ||
5081 | - pci_free_consistent(adapter->pdev, extfat_cmd.size, extfat_cmd.va, | ||
5082 | - extfat_cmd.dma); | ||
5083 | + dma_free_coherent(&adapter->pdev->dev, extfat_cmd.size, extfat_cmd.va, | ||
5084 | + extfat_cmd.dma); | ||
5085 | return status; | ||
5086 | } | ||
5087 | |||
5088 | @@ -3341,8 +3347,9 @@ int be_cmd_get_fw_log_level(struct be_adapter *adapter) | ||
5089 | |||
5090 | memset(&extfat_cmd, 0, sizeof(struct be_dma_mem)); | ||
5091 | extfat_cmd.size = sizeof(struct be_cmd_resp_get_ext_fat_caps); | ||
5092 | - extfat_cmd.va = pci_alloc_consistent(adapter->pdev, extfat_cmd.size, | ||
5093 | - &extfat_cmd.dma); | ||
5094 | + extfat_cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, | ||
5095 | + extfat_cmd.size, &extfat_cmd.dma, | ||
5096 | + GFP_ATOMIC); | ||
5097 | |||
5098 | if (!extfat_cmd.va) { | ||
5099 | dev_err(&adapter->pdev->dev, "%s: Memory allocation failure\n", | ||
5100 | @@ -3360,8 +3367,8 @@ int be_cmd_get_fw_log_level(struct be_adapter *adapter) | ||
5101 | level = cfgs->module[0].trace_lvl[j].dbg_lvl; | ||
5102 | } | ||
5103 | } | ||
5104 | - pci_free_consistent(adapter->pdev, extfat_cmd.size, extfat_cmd.va, | ||
5105 | - extfat_cmd.dma); | ||
5106 | + dma_free_coherent(&adapter->pdev->dev, extfat_cmd.size, extfat_cmd.va, | ||
5107 | + extfat_cmd.dma); | ||
5108 | err: | ||
5109 | return level; | ||
5110 | } | ||
5111 | @@ -3567,7 +3574,8 @@ int be_cmd_get_func_config(struct be_adapter *adapter, struct be_resources *res) | ||
5112 | |||
5113 | memset(&cmd, 0, sizeof(struct be_dma_mem)); | ||
5114 | cmd.size = sizeof(struct be_cmd_resp_get_func_config); | ||
5115 | - cmd.va = pci_alloc_consistent(adapter->pdev, cmd.size, &cmd.dma); | ||
5116 | + cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, | ||
5117 | + GFP_ATOMIC); | ||
5118 | if (!cmd.va) { | ||
5119 | dev_err(&adapter->pdev->dev, "Memory alloc failure\n"); | ||
5120 | status = -ENOMEM; | ||
5121 | @@ -3607,7 +3615,8 @@ int be_cmd_get_func_config(struct be_adapter *adapter, struct be_resources *res) | ||
5122 | err: | ||
5123 | mutex_unlock(&adapter->mbox_lock); | ||
5124 | if (cmd.va) | ||
5125 | - pci_free_consistent(adapter->pdev, cmd.size, cmd.va, cmd.dma); | ||
5126 | + dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, | ||
5127 | + cmd.dma); | ||
5128 | return status; | ||
5129 | } | ||
5130 | |||
5131 | @@ -3628,7 +3637,8 @@ int be_cmd_get_profile_config(struct be_adapter *adapter, | ||
5132 | |||
5133 | memset(&cmd, 0, sizeof(struct be_dma_mem)); | ||
5134 | cmd.size = sizeof(struct be_cmd_resp_get_profile_config); | ||
5135 | - cmd.va = pci_alloc_consistent(adapter->pdev, cmd.size, &cmd.dma); | ||
5136 | + cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, | ||
5137 | + GFP_ATOMIC); | ||
5138 | if (!cmd.va) | ||
5139 | return -ENOMEM; | ||
5140 | |||
5141 | @@ -3667,7 +3677,8 @@ int be_cmd_get_profile_config(struct be_adapter *adapter, | ||
5142 | res->vf_if_cap_flags = vf_res->cap_flags; | ||
5143 | err: | ||
5144 | if (cmd.va) | ||
5145 | - pci_free_consistent(adapter->pdev, cmd.size, cmd.va, cmd.dma); | ||
5146 | + dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, | ||
5147 | + cmd.dma); | ||
5148 | return status; | ||
5149 | } | ||
5150 | |||
5151 | @@ -3682,7 +3693,8 @@ static int be_cmd_set_profile_config(struct be_adapter *adapter, void *desc, | ||
5152 | |||
5153 | memset(&cmd, 0, sizeof(struct be_dma_mem)); | ||
5154 | cmd.size = sizeof(struct be_cmd_req_set_profile_config); | ||
5155 | - cmd.va = pci_alloc_consistent(adapter->pdev, cmd.size, &cmd.dma); | ||
5156 | + cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, cmd.size, &cmd.dma, | ||
5157 | + GFP_ATOMIC); | ||
5158 | if (!cmd.va) | ||
5159 | return -ENOMEM; | ||
5160 | |||
5161 | @@ -3698,7 +3710,8 @@ static int be_cmd_set_profile_config(struct be_adapter *adapter, void *desc, | ||
5162 | status = be_cmd_notify_wait(adapter, &wrb); | ||
5163 | |||
5164 | if (cmd.va) | ||
5165 | - pci_free_consistent(adapter->pdev, cmd.size, cmd.va, cmd.dma); | ||
5166 | + dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, | ||
5167 | + cmd.dma); | ||
5168 | return status; | ||
5169 | } | ||
5170 | |||
5171 | diff --git a/drivers/net/ethernet/emulex/benet/be_ethtool.c b/drivers/net/ethernet/emulex/benet/be_ethtool.c | ||
5172 | index e42a791c1835..a11c5e05634b 100644 | ||
5173 | --- a/drivers/net/ethernet/emulex/benet/be_ethtool.c | ||
5174 | +++ b/drivers/net/ethernet/emulex/benet/be_ethtool.c | ||
5175 | @@ -266,8 +266,8 @@ static int lancer_cmd_read_file(struct be_adapter *adapter, u8 *file_name, | ||
5176 | int status = 0; | ||
5177 | |||
5178 | read_cmd.size = LANCER_READ_FILE_CHUNK; | ||
5179 | - read_cmd.va = pci_alloc_consistent(adapter->pdev, read_cmd.size, | ||
5180 | - &read_cmd.dma); | ||
5181 | + read_cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, read_cmd.size, | ||
5182 | + &read_cmd.dma, GFP_ATOMIC); | ||
5183 | |||
5184 | if (!read_cmd.va) { | ||
5185 | dev_err(&adapter->pdev->dev, | ||
5186 | @@ -291,8 +291,8 @@ static int lancer_cmd_read_file(struct be_adapter *adapter, u8 *file_name, | ||
5187 | break; | ||
5188 | } | ||
5189 | } | ||
5190 | - pci_free_consistent(adapter->pdev, read_cmd.size, read_cmd.va, | ||
5191 | - read_cmd.dma); | ||
5192 | + dma_free_coherent(&adapter->pdev->dev, read_cmd.size, read_cmd.va, | ||
5193 | + read_cmd.dma); | ||
5194 | |||
5195 | return status; | ||
5196 | } | ||
5197 | @@ -818,8 +818,9 @@ static int be_test_ddr_dma(struct be_adapter *adapter) | ||
5198 | }; | ||
5199 | |||
5200 | ddrdma_cmd.size = sizeof(struct be_cmd_req_ddrdma_test); | ||
5201 | - ddrdma_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, ddrdma_cmd.size, | ||
5202 | - &ddrdma_cmd.dma, GFP_KERNEL); | ||
5203 | + ddrdma_cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, | ||
5204 | + ddrdma_cmd.size, &ddrdma_cmd.dma, | ||
5205 | + GFP_KERNEL); | ||
5206 | if (!ddrdma_cmd.va) | ||
5207 | return -ENOMEM; | ||
5208 | |||
5209 | @@ -941,8 +942,9 @@ static int be_read_eeprom(struct net_device *netdev, | ||
5210 | |||
5211 | memset(&eeprom_cmd, 0, sizeof(struct be_dma_mem)); | ||
5212 | eeprom_cmd.size = sizeof(struct be_cmd_req_seeprom_read); | ||
5213 | - eeprom_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, eeprom_cmd.size, | ||
5214 | - &eeprom_cmd.dma, GFP_KERNEL); | ||
5215 | + eeprom_cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, | ||
5216 | + eeprom_cmd.size, &eeprom_cmd.dma, | ||
5217 | + GFP_KERNEL); | ||
5218 | |||
5219 | if (!eeprom_cmd.va) | ||
5220 | return -ENOMEM; | ||
5221 | diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c | ||
5222 | index e51faf0ca989..fdd36794c536 100644 | ||
5223 | --- a/drivers/net/ethernet/emulex/benet/be_main.c | ||
5224 | +++ b/drivers/net/ethernet/emulex/benet/be_main.c | ||
5225 | @@ -4113,8 +4113,8 @@ static int lancer_fw_download(struct be_adapter *adapter, | ||
5226 | |||
5227 | flash_cmd.size = sizeof(struct lancer_cmd_req_write_object) | ||
5228 | + LANCER_FW_DOWNLOAD_CHUNK; | ||
5229 | - flash_cmd.va = dma_alloc_coherent(dev, flash_cmd.size, | ||
5230 | - &flash_cmd.dma, GFP_KERNEL); | ||
5231 | + flash_cmd.va = dma_zalloc_coherent(dev, flash_cmd.size, | ||
5232 | + &flash_cmd.dma, GFP_KERNEL); | ||
5233 | if (!flash_cmd.va) | ||
5234 | return -ENOMEM; | ||
5235 | |||
5236 | @@ -4209,8 +4209,8 @@ static int be_fw_download(struct be_adapter *adapter, const struct firmware* fw) | ||
5237 | int status = 0, i = 0, num_imgs = 0, ufi_type = 0; | ||
5238 | |||
5239 | flash_cmd.size = sizeof(struct be_cmd_write_flashrom); | ||
5240 | - flash_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, flash_cmd.size, | ||
5241 | - &flash_cmd.dma, GFP_KERNEL); | ||
5242 | + flash_cmd.va = dma_zalloc_coherent(&adapter->pdev->dev, flash_cmd.size, | ||
5243 | + &flash_cmd.dma, GFP_KERNEL); | ||
5244 | if (!flash_cmd.va) { | ||
5245 | status = -ENOMEM; | ||
5246 | goto be_fw_exit; | ||
5247 | @@ -4587,10 +4587,10 @@ static int be_ctrl_init(struct be_adapter *adapter) | ||
5248 | goto done; | ||
5249 | |||
5250 | mbox_mem_alloc->size = sizeof(struct be_mcc_mailbox) + 16; | ||
5251 | - mbox_mem_alloc->va = dma_alloc_coherent(&adapter->pdev->dev, | ||
5252 | - mbox_mem_alloc->size, | ||
5253 | - &mbox_mem_alloc->dma, | ||
5254 | - GFP_KERNEL); | ||
5255 | + mbox_mem_alloc->va = dma_zalloc_coherent(&adapter->pdev->dev, | ||
5256 | + mbox_mem_alloc->size, | ||
5257 | + &mbox_mem_alloc->dma, | ||
5258 | + GFP_KERNEL); | ||
5259 | if (!mbox_mem_alloc->va) { | ||
5260 | status = -ENOMEM; | ||
5261 | goto unmap_pci_bars; | ||
5262 | diff --git a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | ||
5263 | index d476918ef269..aa78f07d3d5e 100644 | ||
5264 | --- a/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | ||
5265 | +++ b/drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c | ||
5266 | @@ -211,26 +211,28 @@ static int alloc_4k(struct mlx5_core_dev *dev, u64 *addr) | ||
5267 | return 0; | ||
5268 | } | ||
5269 | |||
5270 | +#define MLX5_U64_4K_PAGE_MASK ((~(u64)0U) << PAGE_SHIFT) | ||
5271 | + | ||
5272 | static void free_4k(struct mlx5_core_dev *dev, u64 addr) | ||
5273 | { | ||
5274 | struct fw_page *fwp; | ||
5275 | int n; | ||
5276 | |||
5277 | - fwp = find_fw_page(dev, addr & PAGE_MASK); | ||
5278 | + fwp = find_fw_page(dev, addr & MLX5_U64_4K_PAGE_MASK); | ||
5279 | if (!fwp) { | ||
5280 | mlx5_core_warn(dev, "page not found\n"); | ||
5281 | return; | ||
5282 | } | ||
5283 | |||
5284 | - n = (addr & ~PAGE_MASK) >> MLX5_ADAPTER_PAGE_SHIFT; | ||
5285 | + n = (addr & ~MLX5_U64_4K_PAGE_MASK) >> MLX5_ADAPTER_PAGE_SHIFT; | ||
5286 | fwp->free_count++; | ||
5287 | set_bit(n, &fwp->bitmask); | ||
5288 | if (fwp->free_count == MLX5_NUM_4K_IN_PAGE) { | ||
5289 | rb_erase(&fwp->rb_node, &dev->priv.page_root); | ||
5290 | if (fwp->free_count != 1) | ||
5291 | list_del(&fwp->list); | ||
5292 | - dma_unmap_page(&dev->pdev->dev, addr & PAGE_MASK, PAGE_SIZE, | ||
5293 | - DMA_BIDIRECTIONAL); | ||
5294 | + dma_unmap_page(&dev->pdev->dev, addr & MLX5_U64_4K_PAGE_MASK, | ||
5295 | + PAGE_SIZE, DMA_BIDIRECTIONAL); | ||
5296 | __free_page(fwp->page); | ||
5297 | kfree(fwp); | ||
5298 | } else if (fwp->free_count == 1) { | ||
5299 | diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c | ||
5300 | index e22e602beef3..c5789cdf7778 100644 | ||
5301 | --- a/drivers/net/phy/dp83640.c | ||
5302 | +++ b/drivers/net/phy/dp83640.c | ||
5303 | @@ -47,7 +47,7 @@ | ||
5304 | #define PSF_TX 0x1000 | ||
5305 | #define EXT_EVENT 1 | ||
5306 | #define CAL_EVENT 7 | ||
5307 | -#define CAL_TRIGGER 7 | ||
5308 | +#define CAL_TRIGGER 1 | ||
5309 | #define DP83640_N_PINS 12 | ||
5310 | |||
5311 | #define MII_DP83640_MICR 0x11 | ||
5312 | @@ -495,7 +495,9 @@ static int ptp_dp83640_enable(struct ptp_clock_info *ptp, | ||
5313 | else | ||
5314 | evnt |= EVNT_RISE; | ||
5315 | } | ||
5316 | + mutex_lock(&clock->extreg_lock); | ||
5317 | ext_write(0, phydev, PAGE5, PTP_EVNT, evnt); | ||
5318 | + mutex_unlock(&clock->extreg_lock); | ||
5319 | return 0; | ||
5320 | |||
5321 | case PTP_CLK_REQ_PEROUT: | ||
5322 | @@ -531,6 +533,8 @@ static u8 status_frame_src[6] = { 0x08, 0x00, 0x17, 0x0B, 0x6B, 0x0F }; | ||
5323 | |||
5324 | static void enable_status_frames(struct phy_device *phydev, bool on) | ||
5325 | { | ||
5326 | + struct dp83640_private *dp83640 = phydev->priv; | ||
5327 | + struct dp83640_clock *clock = dp83640->clock; | ||
5328 | u16 cfg0 = 0, ver; | ||
5329 | |||
5330 | if (on) | ||
5331 | @@ -538,9 +542,13 @@ static void enable_status_frames(struct phy_device *phydev, bool on) | ||
5332 | |||
5333 | ver = (PSF_PTPVER & VERSIONPTP_MASK) << VERSIONPTP_SHIFT; | ||
5334 | |||
5335 | + mutex_lock(&clock->extreg_lock); | ||
5336 | + | ||
5337 | ext_write(0, phydev, PAGE5, PSF_CFG0, cfg0); | ||
5338 | ext_write(0, phydev, PAGE6, PSF_CFG1, ver); | ||
5339 | |||
5340 | + mutex_unlock(&clock->extreg_lock); | ||
5341 | + | ||
5342 | if (!phydev->attached_dev) { | ||
5343 | pr_warn("expected to find an attached netdevice\n"); | ||
5344 | return; | ||
5345 | @@ -837,7 +845,7 @@ static void decode_rxts(struct dp83640_private *dp83640, | ||
5346 | list_del_init(&rxts->list); | ||
5347 | phy2rxts(phy_rxts, rxts); | ||
5348 | |||
5349 | - spin_lock_irqsave(&dp83640->rx_queue.lock, flags); | ||
5350 | + spin_lock(&dp83640->rx_queue.lock); | ||
5351 | skb_queue_walk(&dp83640->rx_queue, skb) { | ||
5352 | struct dp83640_skb_info *skb_info; | ||
5353 | |||
5354 | @@ -852,7 +860,7 @@ static void decode_rxts(struct dp83640_private *dp83640, | ||
5355 | break; | ||
5356 | } | ||
5357 | } | ||
5358 | - spin_unlock_irqrestore(&dp83640->rx_queue.lock, flags); | ||
5359 | + spin_unlock(&dp83640->rx_queue.lock); | ||
5360 | |||
5361 | if (!shhwtstamps) | ||
5362 | list_add_tail(&rxts->list, &dp83640->rxts); | ||
5363 | @@ -1172,11 +1180,18 @@ static int dp83640_config_init(struct phy_device *phydev) | ||
5364 | |||
5365 | if (clock->chosen && !list_empty(&clock->phylist)) | ||
5366 | recalibrate(clock); | ||
5367 | - else | ||
5368 | + else { | ||
5369 | + mutex_lock(&clock->extreg_lock); | ||
5370 | enable_broadcast(phydev, clock->page, 1); | ||
5371 | + mutex_unlock(&clock->extreg_lock); | ||
5372 | + } | ||
5373 | |||
5374 | enable_status_frames(phydev, true); | ||
5375 | + | ||
5376 | + mutex_lock(&clock->extreg_lock); | ||
5377 | ext_write(0, phydev, PAGE4, PTP_CTL, PTP_ENABLE); | ||
5378 | + mutex_unlock(&clock->extreg_lock); | ||
5379 | + | ||
5380 | return 0; | ||
5381 | } | ||
5382 | |||
5383 | diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c | ||
5384 | index dc1f6f07326a..91d6d03da963 100644 | ||
5385 | --- a/drivers/net/phy/phy.c | ||
5386 | +++ b/drivers/net/phy/phy.c | ||
5387 | @@ -1050,13 +1050,14 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable) | ||
5388 | { | ||
5389 | /* According to 802.3az,the EEE is supported only in full duplex-mode. | ||
5390 | * Also EEE feature is active when core is operating with MII, GMII | ||
5391 | - * or RGMII. Internal PHYs are also allowed to proceed and should | ||
5392 | - * return an error if they do not support EEE. | ||
5393 | + * or RGMII (all kinds). Internal PHYs are also allowed to proceed and | ||
5394 | + * should return an error if they do not support EEE. | ||
5395 | */ | ||
5396 | if ((phydev->duplex == DUPLEX_FULL) && | ||
5397 | ((phydev->interface == PHY_INTERFACE_MODE_MII) || | ||
5398 | (phydev->interface == PHY_INTERFACE_MODE_GMII) || | ||
5399 | - (phydev->interface == PHY_INTERFACE_MODE_RGMII) || | ||
5400 | + (phydev->interface >= PHY_INTERFACE_MODE_RGMII && | ||
5401 | + phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID) || | ||
5402 | phy_is_internal(phydev))) { | ||
5403 | int eee_lp, eee_cap, eee_adv; | ||
5404 | u32 lp, cap, adv; | ||
5405 | diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c | ||
5406 | index c3e4da9e79ca..8067b8fbb0ee 100644 | ||
5407 | --- a/drivers/net/usb/cdc_ncm.c | ||
5408 | +++ b/drivers/net/usb/cdc_ncm.c | ||
5409 | @@ -1182,7 +1182,7 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign) | ||
5410 | * payload data instead. | ||
5411 | */ | ||
5412 | usbnet_set_skb_tx_stats(skb_out, n, | ||
5413 | - ctx->tx_curr_frame_payload - skb_out->len); | ||
5414 | + (long)ctx->tx_curr_frame_payload - skb_out->len); | ||
5415 | |||
5416 | return skb_out; | ||
5417 | |||
5418 | diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c | ||
5419 | index c047282c4ee0..d9d1e2af50d0 100644 | ||
5420 | --- a/drivers/net/xen-netback/xenbus.c | ||
5421 | +++ b/drivers/net/xen-netback/xenbus.c | ||
5422 | @@ -34,6 +34,8 @@ struct backend_info { | ||
5423 | enum xenbus_state frontend_state; | ||
5424 | struct xenbus_watch hotplug_status_watch; | ||
5425 | u8 have_hotplug_status_watch:1; | ||
5426 | + | ||
5427 | + const char *hotplug_script; | ||
5428 | }; | ||
5429 | |||
5430 | static int connect_rings(struct backend_info *be, struct xenvif_queue *queue); | ||
5431 | @@ -236,6 +238,7 @@ static int netback_remove(struct xenbus_device *dev) | ||
5432 | xenvif_free(be->vif); | ||
5433 | be->vif = NULL; | ||
5434 | } | ||
5435 | + kfree(be->hotplug_script); | ||
5436 | kfree(be); | ||
5437 | dev_set_drvdata(&dev->dev, NULL); | ||
5438 | return 0; | ||
5439 | @@ -253,6 +256,7 @@ static int netback_probe(struct xenbus_device *dev, | ||
5440 | struct xenbus_transaction xbt; | ||
5441 | int err; | ||
5442 | int sg; | ||
5443 | + const char *script; | ||
5444 | struct backend_info *be = kzalloc(sizeof(struct backend_info), | ||
5445 | GFP_KERNEL); | ||
5446 | if (!be) { | ||
5447 | @@ -345,6 +349,15 @@ static int netback_probe(struct xenbus_device *dev, | ||
5448 | if (err) | ||
5449 | pr_debug("Error writing multi-queue-max-queues\n"); | ||
5450 | |||
5451 | + script = xenbus_read(XBT_NIL, dev->nodename, "script", NULL); | ||
5452 | + if (IS_ERR(script)) { | ||
5453 | + err = PTR_ERR(script); | ||
5454 | + xenbus_dev_fatal(dev, err, "reading script"); | ||
5455 | + goto fail; | ||
5456 | + } | ||
5457 | + | ||
5458 | + be->hotplug_script = script; | ||
5459 | + | ||
5460 | err = xenbus_switch_state(dev, XenbusStateInitWait); | ||
5461 | if (err) | ||
5462 | goto fail; | ||
5463 | @@ -377,22 +390,14 @@ static int netback_uevent(struct xenbus_device *xdev, | ||
5464 | struct kobj_uevent_env *env) | ||
5465 | { | ||
5466 | struct backend_info *be = dev_get_drvdata(&xdev->dev); | ||
5467 | - char *val; | ||
5468 | |||
5469 | - val = xenbus_read(XBT_NIL, xdev->nodename, "script", NULL); | ||
5470 | - if (IS_ERR(val)) { | ||
5471 | - int err = PTR_ERR(val); | ||
5472 | - xenbus_dev_fatal(xdev, err, "reading script"); | ||
5473 | - return err; | ||
5474 | - } else { | ||
5475 | - if (add_uevent_var(env, "script=%s", val)) { | ||
5476 | - kfree(val); | ||
5477 | - return -ENOMEM; | ||
5478 | - } | ||
5479 | - kfree(val); | ||
5480 | - } | ||
5481 | + if (!be) | ||
5482 | + return 0; | ||
5483 | + | ||
5484 | + if (add_uevent_var(env, "script=%s", be->hotplug_script)) | ||
5485 | + return -ENOMEM; | ||
5486 | |||
5487 | - if (!be || !be->vif) | ||
5488 | + if (!be->vif) | ||
5489 | return 0; | ||
5490 | |||
5491 | return add_uevent_var(env, "vif=%s", be->vif->dev->name); | ||
5492 | @@ -735,6 +740,7 @@ static void connect(struct backend_info *be) | ||
5493 | goto err; | ||
5494 | } | ||
5495 | |||
5496 | + queue->credit_bytes = credit_bytes; | ||
5497 | queue->remaining_credit = credit_bytes; | ||
5498 | queue->credit_usec = credit_usec; | ||
5499 | |||
5500 | diff --git a/drivers/of/base.c b/drivers/of/base.c | ||
5501 | index 3823edf2d012..4c2ccde42427 100644 | ||
5502 | --- a/drivers/of/base.c | ||
5503 | +++ b/drivers/of/base.c | ||
5504 | @@ -1250,6 +1250,39 @@ int of_property_read_u64(const struct device_node *np, const char *propname, | ||
5505 | EXPORT_SYMBOL_GPL(of_property_read_u64); | ||
5506 | |||
5507 | /** | ||
5508 | + * of_property_read_u64_array - Find and read an array of 64 bit integers | ||
5509 | + * from a property. | ||
5510 | + * | ||
5511 | + * @np: device node from which the property value is to be read. | ||
5512 | + * @propname: name of the property to be searched. | ||
5513 | + * @out_values: pointer to return value, modified only if return value is 0. | ||
5514 | + * @sz: number of array elements to read | ||
5515 | + * | ||
5516 | + * Search for a property in a device node and read 64-bit value(s) from | ||
5517 | + * it. Returns 0 on success, -EINVAL if the property does not exist, | ||
5518 | + * -ENODATA if property does not have a value, and -EOVERFLOW if the | ||
5519 | + * property data isn't large enough. | ||
5520 | + * | ||
5521 | + * The out_values is modified only if a valid u64 value can be decoded. | ||
5522 | + */ | ||
5523 | +int of_property_read_u64_array(const struct device_node *np, | ||
5524 | + const char *propname, u64 *out_values, | ||
5525 | + size_t sz) | ||
5526 | +{ | ||
5527 | + const __be32 *val = of_find_property_value_of_size(np, propname, | ||
5528 | + (sz * sizeof(*out_values))); | ||
5529 | + | ||
5530 | + if (IS_ERR(val)) | ||
5531 | + return PTR_ERR(val); | ||
5532 | + | ||
5533 | + while (sz--) { | ||
5534 | + *out_values++ = of_read_number(val, 2); | ||
5535 | + val += 2; | ||
5536 | + } | ||
5537 | + return 0; | ||
5538 | +} | ||
5539 | + | ||
5540 | +/** | ||
5541 | * of_property_read_string - Find and read a string from a property | ||
5542 | * @np: device node from which the property value is to be read. | ||
5543 | * @propname: name of the property to be searched. | ||
5544 | diff --git a/drivers/spi/spi-bitbang.c b/drivers/spi/spi-bitbang.c | ||
5545 | index dc7d2c2d643e..fecdda270c5d 100644 | ||
5546 | --- a/drivers/spi/spi-bitbang.c | ||
5547 | +++ b/drivers/spi/spi-bitbang.c | ||
5548 | @@ -184,7 +184,6 @@ int spi_bitbang_setup(struct spi_device *spi) | ||
5549 | { | ||
5550 | struct spi_bitbang_cs *cs = spi->controller_state; | ||
5551 | struct spi_bitbang *bitbang; | ||
5552 | - int retval; | ||
5553 | unsigned long flags; | ||
5554 | |||
5555 | bitbang = spi_master_get_devdata(spi->master); | ||
5556 | @@ -201,9 +200,11 @@ int spi_bitbang_setup(struct spi_device *spi) | ||
5557 | if (!cs->txrx_word) | ||
5558 | return -EINVAL; | ||
5559 | |||
5560 | - retval = bitbang->setup_transfer(spi, NULL); | ||
5561 | - if (retval < 0) | ||
5562 | - return retval; | ||
5563 | + if (bitbang->setup_transfer) { | ||
5564 | + int retval = bitbang->setup_transfer(spi, NULL); | ||
5565 | + if (retval < 0) | ||
5566 | + return retval; | ||
5567 | + } | ||
5568 | |||
5569 | dev_dbg(&spi->dev, "%s, %u nsec/bit\n", __func__, 2 * cs->nsecs); | ||
5570 | |||
5571 | @@ -299,9 +300,11 @@ static int spi_bitbang_transfer_one(struct spi_master *master, | ||
5572 | |||
5573 | /* init (-1) or override (1) transfer params */ | ||
5574 | if (do_setup != 0) { | ||
5575 | - status = bitbang->setup_transfer(spi, t); | ||
5576 | - if (status < 0) | ||
5577 | - break; | ||
5578 | + if (bitbang->setup_transfer) { | ||
5579 | + status = bitbang->setup_transfer(spi, t); | ||
5580 | + if (status < 0) | ||
5581 | + break; | ||
5582 | + } | ||
5583 | if (do_setup == -1) | ||
5584 | do_setup = 0; | ||
5585 | } | ||
5586 | diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c | ||
5587 | index a69e31e3410f..5c247d7943aa 100644 | ||
5588 | --- a/drivers/tty/serial/8250/8250_dw.c | ||
5589 | +++ b/drivers/tty/serial/8250/8250_dw.c | ||
5590 | @@ -316,10 +316,20 @@ static int dw8250_probe_of(struct uart_port *p, | ||
5591 | static int dw8250_probe_acpi(struct uart_8250_port *up, | ||
5592 | struct dw8250_data *data) | ||
5593 | { | ||
5594 | + const struct acpi_device_id *id; | ||
5595 | struct uart_port *p = &up->port; | ||
5596 | |||
5597 | dw8250_setup_port(up); | ||
5598 | |||
5599 | + id = acpi_match_device(p->dev->driver->acpi_match_table, p->dev); | ||
5600 | + if (!id) | ||
5601 | + return -ENODEV; | ||
5602 | + | ||
5603 | + if (!p->uartclk) | ||
5604 | + if (device_property_read_u32(p->dev, "clock-frequency", | ||
5605 | + &p->uartclk)) | ||
5606 | + return -EINVAL; | ||
5607 | + | ||
5608 | p->iotype = UPIO_MEM32; | ||
5609 | p->serial_in = dw8250_serial_in32; | ||
5610 | p->serial_out = dw8250_serial_out32; | ||
5611 | @@ -542,6 +552,8 @@ static const struct acpi_device_id dw8250_acpi_match[] = { | ||
5612 | { "INT3435", 0 }, | ||
5613 | { "80860F0A", 0 }, | ||
5614 | { "8086228A", 0 }, | ||
5615 | + { "APMC0D08", 0}, | ||
5616 | + { "AMD0020", 0 }, | ||
5617 | { }, | ||
5618 | }; | ||
5619 | MODULE_DEVICE_TABLE(acpi, dw8250_acpi_match); | ||
5620 | diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c | ||
5621 | index 8f62a3cec23e..369e18d9ab48 100644 | ||
5622 | --- a/drivers/tty/serial/imx.c | ||
5623 | +++ b/drivers/tty/serial/imx.c | ||
5624 | @@ -590,13 +590,6 @@ static void imx_start_tx(struct uart_port *port) | ||
5625 | temp &= ~(UCR1_RRDYEN); | ||
5626 | writel(temp, sport->port.membase + UCR1); | ||
5627 | } | ||
5628 | - /* Clear any pending ORE flag before enabling interrupt */ | ||
5629 | - temp = readl(sport->port.membase + USR2); | ||
5630 | - writel(temp | USR2_ORE, sport->port.membase + USR2); | ||
5631 | - | ||
5632 | - temp = readl(sport->port.membase + UCR4); | ||
5633 | - temp |= UCR4_OREN; | ||
5634 | - writel(temp, sport->port.membase + UCR4); | ||
5635 | |||
5636 | if (!sport->dma_is_enabled) { | ||
5637 | temp = readl(sport->port.membase + UCR1); | ||
5638 | @@ -771,7 +764,7 @@ static irqreturn_t imx_int(int irq, void *dev_id) | ||
5639 | if (sts2 & USR2_ORE) { | ||
5640 | dev_err(sport->port.dev, "Rx FIFO overrun\n"); | ||
5641 | sport->port.icount.overrun++; | ||
5642 | - writel(sts2 | USR2_ORE, sport->port.membase + USR2); | ||
5643 | + writel(USR2_ORE, sport->port.membase + USR2); | ||
5644 | } | ||
5645 | |||
5646 | return IRQ_HANDLED; | ||
5647 | @@ -1141,10 +1134,12 @@ static int imx_startup(struct uart_port *port) | ||
5648 | } | ||
5649 | |||
5650 | spin_lock_irqsave(&sport->port.lock, flags); | ||
5651 | + | ||
5652 | /* | ||
5653 | * Finally, clear and enable interrupts | ||
5654 | */ | ||
5655 | writel(USR1_RTSD, sport->port.membase + USR1); | ||
5656 | + writel(USR2_ORE, sport->port.membase + USR2); | ||
5657 | |||
5658 | temp = readl(sport->port.membase + UCR1); | ||
5659 | temp |= UCR1_RRDYEN | UCR1_RTSDEN | UCR1_UARTEN; | ||
5660 | @@ -1156,6 +1151,10 @@ static int imx_startup(struct uart_port *port) | ||
5661 | |||
5662 | writel(temp, sport->port.membase + UCR1); | ||
5663 | |||
5664 | + temp = readl(sport->port.membase + UCR4); | ||
5665 | + temp |= UCR4_OREN; | ||
5666 | + writel(temp, sport->port.membase + UCR4); | ||
5667 | + | ||
5668 | temp = readl(sport->port.membase + UCR2); | ||
5669 | temp |= (UCR2_RXEN | UCR2_TXEN); | ||
5670 | if (!sport->have_rtscts) | ||
5671 | diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c | ||
5672 | index 0a0e6f0ad15f..e749631d6a97 100644 | ||
5673 | --- a/drivers/usb/dwc2/hcd.c | ||
5674 | +++ b/drivers/usb/dwc2/hcd.c | ||
5675 | @@ -1517,7 +1517,7 @@ static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq, | ||
5676 | dev_dbg(hsotg->dev, | ||
5677 | "ClearPortFeature USB_PORT_FEAT_SUSPEND\n"); | ||
5678 | writel(0, hsotg->regs + PCGCTL); | ||
5679 | - usleep_range(20000, 40000); | ||
5680 | + msleep(USB_RESUME_TIMEOUT); | ||
5681 | |||
5682 | hprt0 = dwc2_read_hprt0(hsotg); | ||
5683 | hprt0 |= HPRT0_RES; | ||
5684 | diff --git a/firmware/ihex2fw.c b/firmware/ihex2fw.c | ||
5685 | index cf38e159131a..08d90e25abf0 100644 | ||
5686 | --- a/firmware/ihex2fw.c | ||
5687 | +++ b/firmware/ihex2fw.c | ||
5688 | @@ -86,6 +86,7 @@ int main(int argc, char **argv) | ||
5689 | case 'j': | ||
5690 | include_jump = 1; | ||
5691 | break; | ||
5692 | + default: | ||
5693 | return usage(); | ||
5694 | } | ||
5695 | } | ||
5696 | diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c | ||
5697 | index 3dd249787b11..e39fe28f1ea0 100644 | ||
5698 | --- a/fs/binfmt_elf.c | ||
5699 | +++ b/fs/binfmt_elf.c | ||
5700 | @@ -816,7 +816,7 @@ static int load_elf_binary(struct linux_binprm *bprm) | ||
5701 | total_size = total_mapping_size(elf_phdata, | ||
5702 | loc->elf_ex.e_phnum); | ||
5703 | if (!total_size) { | ||
5704 | - error = -EINVAL; | ||
5705 | + retval = -EINVAL; | ||
5706 | goto out_free_dentry; | ||
5707 | } | ||
5708 | } | ||
5709 | diff --git a/fs/efivarfs/super.c b/fs/efivarfs/super.c | ||
5710 | index 0a48886e069c..c2f421c30ccd 100644 | ||
5711 | --- a/fs/efivarfs/super.c | ||
5712 | +++ b/fs/efivarfs/super.c | ||
5713 | @@ -121,7 +121,7 @@ static int efivarfs_callback(efi_char16_t *name16, efi_guid_t vendor, | ||
5714 | int len, i; | ||
5715 | int err = -ENOMEM; | ||
5716 | |||
5717 | - entry = kmalloc(sizeof(*entry), GFP_KERNEL); | ||
5718 | + entry = kzalloc(sizeof(*entry), GFP_KERNEL); | ||
5719 | if (!entry) | ||
5720 | return err; | ||
5721 | |||
5722 | diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c | ||
5723 | index bada5a1fb695..447486425b8c 100644 | ||
5724 | --- a/fs/ext4/namei.c | ||
5725 | +++ b/fs/ext4/namei.c | ||
5726 | @@ -3261,12 +3261,18 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry, | ||
5727 | EXT4_INDEX_EXTRA_TRANS_BLOCKS + 2); | ||
5728 | if (!(flags & RENAME_WHITEOUT)) { | ||
5729 | handle = ext4_journal_start(old.dir, EXT4_HT_DIR, credits); | ||
5730 | - if (IS_ERR(handle)) | ||
5731 | - return PTR_ERR(handle); | ||
5732 | + if (IS_ERR(handle)) { | ||
5733 | + retval = PTR_ERR(handle); | ||
5734 | + handle = NULL; | ||
5735 | + goto end_rename; | ||
5736 | + } | ||
5737 | } else { | ||
5738 | whiteout = ext4_whiteout_for_rename(&old, credits, &handle); | ||
5739 | - if (IS_ERR(whiteout)) | ||
5740 | - return PTR_ERR(whiteout); | ||
5741 | + if (IS_ERR(whiteout)) { | ||
5742 | + retval = PTR_ERR(whiteout); | ||
5743 | + whiteout = NULL; | ||
5744 | + goto end_rename; | ||
5745 | + } | ||
5746 | } | ||
5747 | |||
5748 | if (IS_DIRSYNC(old.dir) || IS_DIRSYNC(new.dir)) | ||
5749 | @@ -3430,8 +3436,11 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry, | ||
5750 | handle = ext4_journal_start(old.dir, EXT4_HT_DIR, | ||
5751 | (2 * EXT4_DATA_TRANS_BLOCKS(old.dir->i_sb) + | ||
5752 | 2 * EXT4_INDEX_EXTRA_TRANS_BLOCKS + 2)); | ||
5753 | - if (IS_ERR(handle)) | ||
5754 | - return PTR_ERR(handle); | ||
5755 | + if (IS_ERR(handle)) { | ||
5756 | + retval = PTR_ERR(handle); | ||
5757 | + handle = NULL; | ||
5758 | + goto end_rename; | ||
5759 | + } | ||
5760 | |||
5761 | if (IS_DIRSYNC(old.dir) || IS_DIRSYNC(new.dir)) | ||
5762 | ext4_handle_sync(handle); | ||
5763 | diff --git a/fs/namespace.c b/fs/namespace.c | ||
5764 | index 8b60287a488b..a19d05c4ebe5 100644 | ||
5765 | --- a/fs/namespace.c | ||
5766 | +++ b/fs/namespace.c | ||
5767 | @@ -1490,7 +1490,7 @@ void __detach_mounts(struct dentry *dentry) | ||
5768 | |||
5769 | namespace_lock(); | ||
5770 | mp = lookup_mountpoint(dentry); | ||
5771 | - if (!mp) | ||
5772 | + if (IS_ERR_OR_NULL(mp)) | ||
5773 | goto out_unlock; | ||
5774 | |||
5775 | lock_mount_hash(); | ||
5776 | diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h | ||
5777 | index 8de31d472fad..20c757cdd391 100644 | ||
5778 | --- a/include/acpi/acpi_bus.h | ||
5779 | +++ b/include/acpi/acpi_bus.h | ||
5780 | @@ -338,6 +338,12 @@ struct acpi_device_physical_node { | ||
5781 | bool put_online:1; | ||
5782 | }; | ||
5783 | |||
5784 | +/* ACPI Device Specific Data (_DSD) */ | ||
5785 | +struct acpi_device_data { | ||
5786 | + const union acpi_object *pointer; | ||
5787 | + const union acpi_object *properties; | ||
5788 | +}; | ||
5789 | + | ||
5790 | /* Device */ | ||
5791 | struct acpi_device { | ||
5792 | int device_type; | ||
5793 | @@ -354,6 +360,7 @@ struct acpi_device { | ||
5794 | struct acpi_device_wakeup wakeup; | ||
5795 | struct acpi_device_perf performance; | ||
5796 | struct acpi_device_dir dir; | ||
5797 | + struct acpi_device_data data; | ||
5798 | struct acpi_scan_handler *handler; | ||
5799 | struct acpi_hotplug_context *hp; | ||
5800 | struct acpi_driver *driver; | ||
5801 | diff --git a/include/linux/acpi.h b/include/linux/acpi.h | ||
5802 | index 407a12f663eb..76d64d6a903a 100644 | ||
5803 | --- a/include/linux/acpi.h | ||
5804 | +++ b/include/linux/acpi.h | ||
5805 | @@ -28,6 +28,7 @@ | ||
5806 | #include <linux/errno.h> | ||
5807 | #include <linux/ioport.h> /* for struct resource */ | ||
5808 | #include <linux/device.h> | ||
5809 | +#include <linux/property.h> | ||
5810 | |||
5811 | #ifndef _LINUX | ||
5812 | #define _LINUX | ||
5813 | @@ -659,4 +660,75 @@ do { \ | ||
5814 | #endif | ||
5815 | #endif | ||
5816 | |||
5817 | +/* Device properties */ | ||
5818 | + | ||
5819 | +#define MAX_ACPI_REFERENCE_ARGS 8 | ||
5820 | +struct acpi_reference_args { | ||
5821 | + struct acpi_device *adev; | ||
5822 | + size_t nargs; | ||
5823 | + u64 args[MAX_ACPI_REFERENCE_ARGS]; | ||
5824 | +}; | ||
5825 | + | ||
5826 | +#ifdef CONFIG_ACPI | ||
5827 | +int acpi_dev_get_property(struct acpi_device *adev, const char *name, | ||
5828 | + acpi_object_type type, const union acpi_object **obj); | ||
5829 | +int acpi_dev_get_property_array(struct acpi_device *adev, const char *name, | ||
5830 | + acpi_object_type type, | ||
5831 | + const union acpi_object **obj); | ||
5832 | +int acpi_dev_get_property_reference(struct acpi_device *adev, const char *name, | ||
5833 | + const char *cells_name, size_t index, | ||
5834 | + struct acpi_reference_args *args); | ||
5835 | + | ||
5836 | +int acpi_dev_prop_get(struct acpi_device *adev, const char *propname, | ||
5837 | + void **valptr); | ||
5838 | +int acpi_dev_prop_read_single(struct acpi_device *adev, const char *propname, | ||
5839 | + enum dev_prop_type proptype, void *val); | ||
5840 | +int acpi_dev_prop_read(struct acpi_device *adev, const char *propname, | ||
5841 | + enum dev_prop_type proptype, void *val, size_t nval); | ||
5842 | +#else | ||
5843 | +static inline int acpi_dev_get_property(struct acpi_device *adev, | ||
5844 | + const char *name, acpi_object_type type, | ||
5845 | + const union acpi_object **obj) | ||
5846 | +{ | ||
5847 | + return -ENXIO; | ||
5848 | +} | ||
5849 | +static inline int acpi_dev_get_property_array(struct acpi_device *adev, | ||
5850 | + const char *name, | ||
5851 | + acpi_object_type type, | ||
5852 | + const union acpi_object **obj) | ||
5853 | +{ | ||
5854 | + return -ENXIO; | ||
5855 | +} | ||
5856 | +static inline int acpi_dev_get_property_reference(struct acpi_device *adev, | ||
5857 | + const char *name, const char *cells_name, | ||
5858 | + size_t index, struct acpi_reference_args *args) | ||
5859 | +{ | ||
5860 | + return -ENXIO; | ||
5861 | +} | ||
5862 | + | ||
5863 | +static inline int acpi_dev_prop_get(struct acpi_device *adev, | ||
5864 | + const char *propname, | ||
5865 | + void **valptr) | ||
5866 | +{ | ||
5867 | + return -ENXIO; | ||
5868 | +} | ||
5869 | + | ||
5870 | +static inline int acpi_dev_prop_read_single(struct acpi_device *adev, | ||
5871 | + const char *propname, | ||
5872 | + enum dev_prop_type proptype, | ||
5873 | + void *val) | ||
5874 | +{ | ||
5875 | + return -ENXIO; | ||
5876 | +} | ||
5877 | + | ||
5878 | +static inline int acpi_dev_prop_read(struct acpi_device *adev, | ||
5879 | + const char *propname, | ||
5880 | + enum dev_prop_type proptype, | ||
5881 | + void *val, size_t nval) | ||
5882 | +{ | ||
5883 | + return -ENXIO; | ||
5884 | +} | ||
5885 | + | ||
5886 | +#endif | ||
5887 | + | ||
5888 | #endif /*_LINUX_ACPI_H*/ | ||
5889 | diff --git a/include/linux/compiler.h b/include/linux/compiler.h | ||
5890 | index 33063f872ee3..000c5f90f08c 100644 | ||
5891 | --- a/include/linux/compiler.h | ||
5892 | +++ b/include/linux/compiler.h | ||
5893 | @@ -198,7 +198,7 @@ static __always_inline void data_access_exceeds_word_size(void) | ||
5894 | { | ||
5895 | } | ||
5896 | |||
5897 | -static __always_inline void __read_once_size(volatile void *p, void *res, int size) | ||
5898 | +static __always_inline void __read_once_size(const volatile void *p, void *res, int size) | ||
5899 | { | ||
5900 | switch (size) { | ||
5901 | case 1: *(__u8 *)res = *(volatile __u8 *)p; break; | ||
5902 | @@ -255,10 +255,10 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s | ||
5903 | */ | ||
5904 | |||
5905 | #define READ_ONCE(x) \ | ||
5906 | - ({ typeof(x) __val; __read_once_size(&x, &__val, sizeof(__val)); __val; }) | ||
5907 | + ({ union { typeof(x) __val; char __c[1]; } __u; __read_once_size(&(x), __u.__c, sizeof(x)); __u.__val; }) | ||
5908 | |||
5909 | #define WRITE_ONCE(x, val) \ | ||
5910 | - ({ typeof(x) __val; __val = val; __write_once_size(&x, &__val, sizeof(__val)); __val; }) | ||
5911 | + ({ typeof(x) __val = (val); __write_once_size(&(x), &__val, sizeof(__val)); __val; }) | ||
5912 | |||
5913 | #endif /* __KERNEL__ */ | ||
5914 | |||
5915 | diff --git a/include/linux/jhash.h b/include/linux/jhash.h | ||
5916 | index 47cb09edec1a..348c6f47e4cc 100644 | ||
5917 | --- a/include/linux/jhash.h | ||
5918 | +++ b/include/linux/jhash.h | ||
5919 | @@ -145,11 +145,11 @@ static inline u32 jhash2(const u32 *k, u32 length, u32 initval) | ||
5920 | } | ||
5921 | |||
5922 | |||
5923 | -/* jhash_3words - hash exactly 3, 2 or 1 word(s) */ | ||
5924 | -static inline u32 jhash_3words(u32 a, u32 b, u32 c, u32 initval) | ||
5925 | +/* __jhash_nwords - hash exactly 3, 2 or 1 word(s) */ | ||
5926 | +static inline u32 __jhash_nwords(u32 a, u32 b, u32 c, u32 initval) | ||
5927 | { | ||
5928 | - a += JHASH_INITVAL; | ||
5929 | - b += JHASH_INITVAL; | ||
5930 | + a += initval; | ||
5931 | + b += initval; | ||
5932 | c += initval; | ||
5933 | |||
5934 | __jhash_final(a, b, c); | ||
5935 | @@ -157,14 +157,19 @@ static inline u32 jhash_3words(u32 a, u32 b, u32 c, u32 initval) | ||
5936 | return c; | ||
5937 | } | ||
5938 | |||
5939 | +static inline u32 jhash_3words(u32 a, u32 b, u32 c, u32 initval) | ||
5940 | +{ | ||
5941 | + return __jhash_nwords(a, b, c, initval + JHASH_INITVAL + (3 << 2)); | ||
5942 | +} | ||
5943 | + | ||
5944 | static inline u32 jhash_2words(u32 a, u32 b, u32 initval) | ||
5945 | { | ||
5946 | - return jhash_3words(a, b, 0, initval); | ||
5947 | + return __jhash_nwords(a, b, 0, initval + JHASH_INITVAL + (2 << 2)); | ||
5948 | } | ||
5949 | |||
5950 | static inline u32 jhash_1word(u32 a, u32 initval) | ||
5951 | { | ||
5952 | - return jhash_3words(a, 0, 0, initval); | ||
5953 | + return __jhash_nwords(a, 0, 0, initval + JHASH_INITVAL + (1 << 2)); | ||
5954 | } | ||
5955 | |||
5956 | #endif /* _LINUX_JHASH_H */ | ||
5957 | diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h | ||
5958 | index be342b94c640..16cfb3448568 100644 | ||
5959 | --- a/include/linux/kconfig.h | ||
5960 | +++ b/include/linux/kconfig.h | ||
5961 | @@ -43,4 +43,13 @@ | ||
5962 | */ | ||
5963 | #define IS_MODULE(option) config_enabled(option##_MODULE) | ||
5964 | |||
5965 | +/* | ||
5966 | + * IS_REACHABLE(CONFIG_FOO) evaluates to 1 if the currently compiled | ||
5967 | + * code can call a function defined in code compiled based on CONFIG_FOO. | ||
5968 | + * This is similar to IS_ENABLED(), but returns false when invoked from | ||
5969 | + * built-in code when CONFIG_FOO is set to 'm'. | ||
5970 | + */ | ||
5971 | +#define IS_REACHABLE(option) (config_enabled(option) || \ | ||
5972 | + (config_enabled(option##_MODULE) && config_enabled(MODULE))) | ||
5973 | + | ||
5974 | #endif /* __LINUX_KCONFIG_H */ | ||
5975 | diff --git a/include/linux/of.h b/include/linux/of.h | ||
5976 | index 29f0adc5f3e4..ce9f6a2b3532 100644 | ||
5977 | --- a/include/linux/of.h | ||
5978 | +++ b/include/linux/of.h | ||
5979 | @@ -23,6 +23,7 @@ | ||
5980 | #include <linux/spinlock.h> | ||
5981 | #include <linux/topology.h> | ||
5982 | #include <linux/notifier.h> | ||
5983 | +#include <linux/property.h> | ||
5984 | |||
5985 | #include <asm/byteorder.h> | ||
5986 | #include <asm/errno.h> | ||
5987 | @@ -263,6 +264,10 @@ extern int of_property_read_u32_array(const struct device_node *np, | ||
5988 | size_t sz); | ||
5989 | extern int of_property_read_u64(const struct device_node *np, | ||
5990 | const char *propname, u64 *out_value); | ||
5991 | +extern int of_property_read_u64_array(const struct device_node *np, | ||
5992 | + const char *propname, | ||
5993 | + u64 *out_values, | ||
5994 | + size_t sz); | ||
5995 | |||
5996 | extern int of_property_read_string(struct device_node *np, | ||
5997 | const char *propname, | ||
5998 | @@ -477,6 +482,13 @@ static inline int of_property_read_u32_array(const struct device_node *np, | ||
5999 | return -ENOSYS; | ||
6000 | } | ||
6001 | |||
6002 | +static inline int of_property_read_u64_array(const struct device_node *np, | ||
6003 | + const char *propname, | ||
6004 | + u64 *out_values, size_t sz) | ||
6005 | +{ | ||
6006 | + return -ENOSYS; | ||
6007 | +} | ||
6008 | + | ||
6009 | static inline int of_property_read_string(struct device_node *np, | ||
6010 | const char *propname, | ||
6011 | const char **out_string) | ||
6012 | diff --git a/include/linux/property.h b/include/linux/property.h | ||
6013 | new file mode 100644 | ||
6014 | index 000000000000..9242fb0221ba | ||
6015 | --- /dev/null | ||
6016 | +++ b/include/linux/property.h | ||
6017 | @@ -0,0 +1,73 @@ | ||
6018 | +/* | ||
6019 | + * property.h - Unified device property interface. | ||
6020 | + * | ||
6021 | + * Copyright (C) 2014, Intel Corporation | ||
6022 | + * Authors: Rafael J. Wysocki <rafael.j.wysocki@intel.com> | ||
6023 | + * Mika Westerberg <mika.westerberg@linux.intel.com> | ||
6024 | + * | ||
6025 | + * This program is free software; you can redistribute it and/or modify | ||
6026 | + * it under the terms of the GNU General Public License version 2 as | ||
6027 | + * published by the Free Software Foundation. | ||
6028 | + */ | ||
6029 | + | ||
6030 | +#ifndef _LINUX_PROPERTY_H_ | ||
6031 | +#define _LINUX_PROPERTY_H_ | ||
6032 | + | ||
6033 | +#include <linux/types.h> | ||
6034 | + | ||
6035 | +struct device; | ||
6036 | + | ||
6037 | +enum dev_prop_type { | ||
6038 | + DEV_PROP_U8, | ||
6039 | + DEV_PROP_U16, | ||
6040 | + DEV_PROP_U32, | ||
6041 | + DEV_PROP_U64, | ||
6042 | + DEV_PROP_STRING, | ||
6043 | + DEV_PROP_MAX, | ||
6044 | +}; | ||
6045 | + | ||
6046 | +bool device_property_present(struct device *dev, const char *propname); | ||
6047 | +int device_property_read_u8_array(struct device *dev, const char *propname, | ||
6048 | + u8 *val, size_t nval); | ||
6049 | +int device_property_read_u16_array(struct device *dev, const char *propname, | ||
6050 | + u16 *val, size_t nval); | ||
6051 | +int device_property_read_u32_array(struct device *dev, const char *propname, | ||
6052 | + u32 *val, size_t nval); | ||
6053 | +int device_property_read_u64_array(struct device *dev, const char *propname, | ||
6054 | + u64 *val, size_t nval); | ||
6055 | +int device_property_read_string_array(struct device *dev, const char *propname, | ||
6056 | + const char **val, size_t nval); | ||
6057 | +int device_property_read_string(struct device *dev, const char *propname, | ||
6058 | + const char **val); | ||
6059 | + | ||
6060 | +static inline bool device_property_read_bool(struct device *dev, | ||
6061 | + const char *propname) | ||
6062 | +{ | ||
6063 | + return device_property_present(dev, propname); | ||
6064 | +} | ||
6065 | + | ||
6066 | +static inline int device_property_read_u8(struct device *dev, | ||
6067 | + const char *propname, u8 *val) | ||
6068 | +{ | ||
6069 | + return device_property_read_u8_array(dev, propname, val, 1); | ||
6070 | +} | ||
6071 | + | ||
6072 | +static inline int device_property_read_u16(struct device *dev, | ||
6073 | + const char *propname, u16 *val) | ||
6074 | +{ | ||
6075 | + return device_property_read_u16_array(dev, propname, val, 1); | ||
6076 | +} | ||
6077 | + | ||
6078 | +static inline int device_property_read_u32(struct device *dev, | ||
6079 | + const char *propname, u32 *val) | ||
6080 | +{ | ||
6081 | + return device_property_read_u32_array(dev, propname, val, 1); | ||
6082 | +} | ||
6083 | + | ||
6084 | +static inline int device_property_read_u64(struct device *dev, | ||
6085 | + const char *propname, u64 *val) | ||
6086 | +{ | ||
6087 | + return device_property_read_u64_array(dev, propname, val, 1); | ||
6088 | +} | ||
6089 | + | ||
6090 | +#endif /* _LINUX_PROPERTY_H_ */ | ||
6091 | diff --git a/include/net/inet_connection_sock.h b/include/net/inet_connection_sock.h | ||
6092 | index 848e85cb5c61..24d5c099d3ac 100644 | ||
6093 | --- a/include/net/inet_connection_sock.h | ||
6094 | +++ b/include/net/inet_connection_sock.h | ||
6095 | @@ -98,7 +98,8 @@ struct inet_connection_sock { | ||
6096 | const struct tcp_congestion_ops *icsk_ca_ops; | ||
6097 | const struct inet_connection_sock_af_ops *icsk_af_ops; | ||
6098 | unsigned int (*icsk_sync_mss)(struct sock *sk, u32 pmtu); | ||
6099 | - __u8 icsk_ca_state; | ||
6100 | + __u8 icsk_ca_state:7, | ||
6101 | + icsk_ca_setsockopt:1; | ||
6102 | __u8 icsk_retransmits; | ||
6103 | __u8 icsk_pending; | ||
6104 | __u8 icsk_backoff; | ||
6105 | diff --git a/include/net/sctp/sctp.h b/include/net/sctp/sctp.h | ||
6106 | index 856f01cb51dd..230775f5952a 100644 | ||
6107 | --- a/include/net/sctp/sctp.h | ||
6108 | +++ b/include/net/sctp/sctp.h | ||
6109 | @@ -571,11 +571,14 @@ static inline void sctp_v6_map_v4(union sctp_addr *addr) | ||
6110 | /* Map v4 address to v4-mapped v6 address */ | ||
6111 | static inline void sctp_v4_map_v6(union sctp_addr *addr) | ||
6112 | { | ||
6113 | + __be16 port; | ||
6114 | + | ||
6115 | + port = addr->v4.sin_port; | ||
6116 | + addr->v6.sin6_addr.s6_addr32[3] = addr->v4.sin_addr.s_addr; | ||
6117 | + addr->v6.sin6_port = port; | ||
6118 | addr->v6.sin6_family = AF_INET6; | ||
6119 | addr->v6.sin6_flowinfo = 0; | ||
6120 | addr->v6.sin6_scope_id = 0; | ||
6121 | - addr->v6.sin6_port = addr->v4.sin_port; | ||
6122 | - addr->v6.sin6_addr.s6_addr32[3] = addr->v4.sin_addr.s_addr; | ||
6123 | addr->v6.sin6_addr.s6_addr32[0] = 0; | ||
6124 | addr->v6.sin6_addr.s6_addr32[1] = 0; | ||
6125 | addr->v6.sin6_addr.s6_addr32[2] = htonl(0x0000ffff); | ||
6126 | diff --git a/include/net/sock.h b/include/net/sock.h | ||
6127 | index c8146ed9e66a..4406dbe491f0 100644 | ||
6128 | --- a/include/net/sock.h | ||
6129 | +++ b/include/net/sock.h | ||
6130 | @@ -67,6 +67,7 @@ | ||
6131 | #include <linux/atomic.h> | ||
6132 | #include <net/dst.h> | ||
6133 | #include <net/checksum.h> | ||
6134 | +#include <net/tcp_states.h> | ||
6135 | #include <linux/net_tstamp.h> | ||
6136 | |||
6137 | struct cgroup; | ||
6138 | @@ -2267,6 +2268,14 @@ static inline struct sock *skb_steal_sock(struct sk_buff *skb) | ||
6139 | return NULL; | ||
6140 | } | ||
6141 | |||
6142 | +/* This helper checks if a socket is a full socket, | ||
6143 | + * ie _not_ a timewait or request socket. | ||
6144 | + */ | ||
6145 | +static inline bool sk_fullsock(const struct sock *sk) | ||
6146 | +{ | ||
6147 | + return (1 << sk->sk_state) & ~(TCPF_TIME_WAIT | TCPF_NEW_SYN_RECV); | ||
6148 | +} | ||
6149 | + | ||
6150 | void sock_enable_timestamp(struct sock *sk, int flag); | ||
6151 | int sock_get_timestamp(struct sock *, struct timeval __user *); | ||
6152 | int sock_get_timestampns(struct sock *, struct timespec __user *); | ||
6153 | diff --git a/include/net/tcp_states.h b/include/net/tcp_states.h | ||
6154 | index b0b645988bd8..50e78a74d0df 100644 | ||
6155 | --- a/include/net/tcp_states.h | ||
6156 | +++ b/include/net/tcp_states.h | ||
6157 | @@ -25,6 +25,7 @@ enum { | ||
6158 | TCP_LAST_ACK, | ||
6159 | TCP_LISTEN, | ||
6160 | TCP_CLOSING, /* Now a valid state */ | ||
6161 | + TCP_NEW_SYN_RECV, | ||
6162 | |||
6163 | TCP_MAX_STATES /* Leave at the end! */ | ||
6164 | }; | ||
6165 | @@ -44,7 +45,8 @@ enum { | ||
6166 | TCPF_CLOSE_WAIT = (1 << 8), | ||
6167 | TCPF_LAST_ACK = (1 << 9), | ||
6168 | TCPF_LISTEN = (1 << 10), | ||
6169 | - TCPF_CLOSING = (1 << 11) | ||
6170 | + TCPF_CLOSING = (1 << 11), | ||
6171 | + TCPF_NEW_SYN_RECV = (1 << 12), | ||
6172 | }; | ||
6173 | |||
6174 | #endif /* _LINUX_TCP_STATES_H */ | ||
6175 | diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c | ||
6176 | index ef2b104b254c..2246a36050f9 100644 | ||
6177 | --- a/kernel/sched/fair.c | ||
6178 | +++ b/kernel/sched/fair.c | ||
6179 | @@ -1979,8 +1979,10 @@ void task_numa_work(struct callback_head *work) | ||
6180 | vma = mm->mmap; | ||
6181 | } | ||
6182 | for (; vma; vma = vma->vm_next) { | ||
6183 | - if (!vma_migratable(vma) || !vma_policy_mof(vma)) | ||
6184 | + if (!vma_migratable(vma) || !vma_policy_mof(vma) || | ||
6185 | + is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_MIXEDMAP)) { | ||
6186 | continue; | ||
6187 | + } | ||
6188 | |||
6189 | /* | ||
6190 | * Shared library pages mapped by multiple processes are not | ||
6191 | diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c | ||
6192 | index 6f6c95cfe8f2..eab8862d9f88 100644 | ||
6193 | --- a/net/bridge/br_fdb.c | ||
6194 | +++ b/net/bridge/br_fdb.c | ||
6195 | @@ -789,9 +789,11 @@ static int __br_fdb_add(struct ndmsg *ndm, struct net_bridge_port *p, | ||
6196 | int err = 0; | ||
6197 | |||
6198 | if (ndm->ndm_flags & NTF_USE) { | ||
6199 | + local_bh_disable(); | ||
6200 | rcu_read_lock(); | ||
6201 | br_fdb_update(p->br, p, addr, vid, true); | ||
6202 | rcu_read_unlock(); | ||
6203 | + local_bh_enable(); | ||
6204 | } else { | ||
6205 | spin_lock_bh(&p->br->hash_lock); | ||
6206 | err = fdb_add_entry(p, addr, ndm->ndm_state, | ||
6207 | diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c | ||
6208 | index c465876c7861..b0aee78dba41 100644 | ||
6209 | --- a/net/bridge/br_multicast.c | ||
6210 | +++ b/net/bridge/br_multicast.c | ||
6211 | @@ -1071,7 +1071,7 @@ static int br_ip6_multicast_mld2_report(struct net_bridge *br, | ||
6212 | |||
6213 | err = br_ip6_multicast_add_group(br, port, &grec->grec_mca, | ||
6214 | vid); | ||
6215 | - if (!err) | ||
6216 | + if (err) | ||
6217 | break; | ||
6218 | } | ||
6219 | |||
6220 | @@ -1821,7 +1821,7 @@ static void br_multicast_query_expired(struct net_bridge *br, | ||
6221 | if (query->startup_sent < br->multicast_startup_query_count) | ||
6222 | query->startup_sent++; | ||
6223 | |||
6224 | - RCU_INIT_POINTER(querier, NULL); | ||
6225 | + RCU_INIT_POINTER(querier->port, NULL); | ||
6226 | br_multicast_send_query(br, NULL, query); | ||
6227 | spin_unlock(&br->multicast_lock); | ||
6228 | } | ||
6229 | diff --git a/net/caif/caif_socket.c b/net/caif/caif_socket.c | ||
6230 | index 765c78110fa8..5e10ee0efffb 100644 | ||
6231 | --- a/net/caif/caif_socket.c | ||
6232 | +++ b/net/caif/caif_socket.c | ||
6233 | @@ -330,6 +330,10 @@ static long caif_stream_data_wait(struct sock *sk, long timeo) | ||
6234 | release_sock(sk); | ||
6235 | timeo = schedule_timeout(timeo); | ||
6236 | lock_sock(sk); | ||
6237 | + | ||
6238 | + if (sock_flag(sk, SOCK_DEAD)) | ||
6239 | + break; | ||
6240 | + | ||
6241 | clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); | ||
6242 | } | ||
6243 | |||
6244 | @@ -374,6 +378,10 @@ static int caif_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | ||
6245 | struct sk_buff *skb; | ||
6246 | |||
6247 | lock_sock(sk); | ||
6248 | + if (sock_flag(sk, SOCK_DEAD)) { | ||
6249 | + err = -ECONNRESET; | ||
6250 | + goto unlock; | ||
6251 | + } | ||
6252 | skb = skb_dequeue(&sk->sk_receive_queue); | ||
6253 | caif_check_flow_release(sk); | ||
6254 | |||
6255 | diff --git a/net/ceph/crush/mapper.c b/net/ceph/crush/mapper.c | ||
6256 | index a1ef53c04415..b1f2d1f44d37 100644 | ||
6257 | --- a/net/ceph/crush/mapper.c | ||
6258 | +++ b/net/ceph/crush/mapper.c | ||
6259 | @@ -290,6 +290,7 @@ static int is_out(const struct crush_map *map, | ||
6260 | * @type: the type of item to choose | ||
6261 | * @out: pointer to output vector | ||
6262 | * @outpos: our position in that vector | ||
6263 | + * @out_size: size of the out vector | ||
6264 | * @tries: number of attempts to make | ||
6265 | * @recurse_tries: number of attempts to have recursive chooseleaf make | ||
6266 | * @local_retries: localized retries | ||
6267 | @@ -304,6 +305,7 @@ static int crush_choose_firstn(const struct crush_map *map, | ||
6268 | const __u32 *weight, int weight_max, | ||
6269 | int x, int numrep, int type, | ||
6270 | int *out, int outpos, | ||
6271 | + int out_size, | ||
6272 | unsigned int tries, | ||
6273 | unsigned int recurse_tries, | ||
6274 | unsigned int local_retries, | ||
6275 | @@ -322,6 +324,7 @@ static int crush_choose_firstn(const struct crush_map *map, | ||
6276 | int item = 0; | ||
6277 | int itemtype; | ||
6278 | int collide, reject; | ||
6279 | + int count = out_size; | ||
6280 | |||
6281 | dprintk("CHOOSE%s bucket %d x %d outpos %d numrep %d tries %d recurse_tries %d local_retries %d local_fallback_retries %d parent_r %d\n", | ||
6282 | recurse_to_leaf ? "_LEAF" : "", | ||
6283 | @@ -329,7 +332,7 @@ static int crush_choose_firstn(const struct crush_map *map, | ||
6284 | tries, recurse_tries, local_retries, local_fallback_retries, | ||
6285 | parent_r); | ||
6286 | |||
6287 | - for (rep = outpos; rep < numrep; rep++) { | ||
6288 | + for (rep = outpos; rep < numrep && count > 0 ; rep++) { | ||
6289 | /* keep trying until we get a non-out, non-colliding item */ | ||
6290 | ftotal = 0; | ||
6291 | skip_rep = 0; | ||
6292 | @@ -403,7 +406,7 @@ static int crush_choose_firstn(const struct crush_map *map, | ||
6293 | map->buckets[-1-item], | ||
6294 | weight, weight_max, | ||
6295 | x, outpos+1, 0, | ||
6296 | - out2, outpos, | ||
6297 | + out2, outpos, count, | ||
6298 | recurse_tries, 0, | ||
6299 | local_retries, | ||
6300 | local_fallback_retries, | ||
6301 | @@ -463,6 +466,7 @@ reject: | ||
6302 | dprintk("CHOOSE got %d\n", item); | ||
6303 | out[outpos] = item; | ||
6304 | outpos++; | ||
6305 | + count--; | ||
6306 | } | ||
6307 | |||
6308 | dprintk("CHOOSE returns %d\n", outpos); | ||
6309 | @@ -654,6 +658,7 @@ int crush_do_rule(const struct crush_map *map, | ||
6310 | __u32 step; | ||
6311 | int i, j; | ||
6312 | int numrep; | ||
6313 | + int out_size; | ||
6314 | /* | ||
6315 | * the original choose_total_tries value was off by one (it | ||
6316 | * counted "retries" and not "tries"). add one. | ||
6317 | @@ -761,6 +766,7 @@ int crush_do_rule(const struct crush_map *map, | ||
6318 | x, numrep, | ||
6319 | curstep->arg2, | ||
6320 | o+osize, j, | ||
6321 | + result_max-osize, | ||
6322 | choose_tries, | ||
6323 | recurse_tries, | ||
6324 | choose_local_retries, | ||
6325 | @@ -770,11 +776,13 @@ int crush_do_rule(const struct crush_map *map, | ||
6326 | c+osize, | ||
6327 | 0); | ||
6328 | } else { | ||
6329 | + out_size = ((numrep < (result_max-osize)) ? | ||
6330 | + numrep : (result_max-osize)); | ||
6331 | crush_choose_indep( | ||
6332 | map, | ||
6333 | map->buckets[-1-w[i]], | ||
6334 | weight, weight_max, | ||
6335 | - x, numrep, numrep, | ||
6336 | + x, out_size, numrep, | ||
6337 | curstep->arg2, | ||
6338 | o+osize, j, | ||
6339 | choose_tries, | ||
6340 | @@ -783,7 +791,7 @@ int crush_do_rule(const struct crush_map *map, | ||
6341 | recurse_to_leaf, | ||
6342 | c+osize, | ||
6343 | 0); | ||
6344 | - osize += numrep; | ||
6345 | + osize += out_size; | ||
6346 | } | ||
6347 | } | ||
6348 | |||
6349 | diff --git a/net/core/dev.c b/net/core/dev.c | ||
6350 | index 5cdbc1bd9783..fb9625874b3c 100644 | ||
6351 | --- a/net/core/dev.c | ||
6352 | +++ b/net/core/dev.c | ||
6353 | @@ -5080,7 +5080,7 @@ static int __netdev_upper_dev_link(struct net_device *dev, | ||
6354 | if (__netdev_find_adj(upper_dev, dev, &upper_dev->all_adj_list.upper)) | ||
6355 | return -EBUSY; | ||
6356 | |||
6357 | - if (__netdev_find_adj(dev, upper_dev, &dev->all_adj_list.upper)) | ||
6358 | + if (__netdev_find_adj(dev, upper_dev, &dev->adj_list.upper)) | ||
6359 | return -EEXIST; | ||
6360 | |||
6361 | if (master && netdev_master_upper_dev_get(dev)) | ||
6362 | diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c | ||
6363 | index c522f7a00eab..24d3242f0e01 100644 | ||
6364 | --- a/net/core/rtnetlink.c | ||
6365 | +++ b/net/core/rtnetlink.c | ||
6366 | @@ -2229,6 +2229,9 @@ void rtmsg_ifinfo(int type, struct net_device *dev, unsigned int change, | ||
6367 | int err = -ENOBUFS; | ||
6368 | size_t if_info_size; | ||
6369 | |||
6370 | + if (dev->reg_state != NETREG_REGISTERED) | ||
6371 | + return; | ||
6372 | + | ||
6373 | skb = nlmsg_new((if_info_size = if_nlmsg_size(dev, 0)), flags); | ||
6374 | if (skb == NULL) | ||
6375 | goto errout; | ||
6376 | diff --git a/net/ipv4/route.c b/net/ipv4/route.c | ||
6377 | index d58dd0ec3e53..b7ac498fed5f 100644 | ||
6378 | --- a/net/ipv4/route.c | ||
6379 | +++ b/net/ipv4/route.c | ||
6380 | @@ -903,6 +903,10 @@ static int ip_error(struct sk_buff *skb) | ||
6381 | bool send; | ||
6382 | int code; | ||
6383 | |||
6384 | + /* IP on this device is disabled. */ | ||
6385 | + if (!in_dev) | ||
6386 | + goto out; | ||
6387 | + | ||
6388 | net = dev_net(rt->dst.dev); | ||
6389 | if (!IN_DEV_FORWARD(in_dev)) { | ||
6390 | switch (rt->dst.error) { | ||
6391 | diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c | ||
6392 | index 38c2bcb8dd5d..de6195485b31 100644 | ||
6393 | --- a/net/ipv4/tcp.c | ||
6394 | +++ b/net/ipv4/tcp.c | ||
6395 | @@ -2639,6 +2639,7 @@ void tcp_get_info(const struct sock *sk, struct tcp_info *info) | ||
6396 | const struct tcp_sock *tp = tcp_sk(sk); | ||
6397 | const struct inet_connection_sock *icsk = inet_csk(sk); | ||
6398 | u32 now = tcp_time_stamp; | ||
6399 | + u32 rate; | ||
6400 | |||
6401 | memset(info, 0, sizeof(*info)); | ||
6402 | |||
6403 | @@ -2699,10 +2700,11 @@ void tcp_get_info(const struct sock *sk, struct tcp_info *info) | ||
6404 | |||
6405 | info->tcpi_total_retrans = tp->total_retrans; | ||
6406 | |||
6407 | - info->tcpi_pacing_rate = sk->sk_pacing_rate != ~0U ? | ||
6408 | - sk->sk_pacing_rate : ~0ULL; | ||
6409 | - info->tcpi_max_pacing_rate = sk->sk_max_pacing_rate != ~0U ? | ||
6410 | - sk->sk_max_pacing_rate : ~0ULL; | ||
6411 | + rate = READ_ONCE(sk->sk_pacing_rate); | ||
6412 | + info->tcpi_pacing_rate = rate != ~0U ? rate : ~0ULL; | ||
6413 | + | ||
6414 | + rate = READ_ONCE(sk->sk_max_pacing_rate); | ||
6415 | + info->tcpi_max_pacing_rate = rate != ~0U ? rate : ~0ULL; | ||
6416 | } | ||
6417 | EXPORT_SYMBOL_GPL(tcp_get_info); | ||
6418 | |||
6419 | diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c | ||
6420 | index b1c5970d47a1..b3316c8279a0 100644 | ||
6421 | --- a/net/ipv4/tcp_cong.c | ||
6422 | +++ b/net/ipv4/tcp_cong.c | ||
6423 | @@ -248,9 +248,10 @@ int tcp_set_congestion_control(struct sock *sk, const char *name) | ||
6424 | ca = tcp_ca_find(name); | ||
6425 | |||
6426 | /* no change asking for existing value */ | ||
6427 | - if (ca == icsk->icsk_ca_ops) | ||
6428 | + if (ca == icsk->icsk_ca_ops) { | ||
6429 | + icsk->icsk_ca_setsockopt = 1; | ||
6430 | goto out; | ||
6431 | - | ||
6432 | + } | ||
6433 | #ifdef CONFIG_MODULES | ||
6434 | /* not found attempt to autoload module */ | ||
6435 | if (!ca && capable(CAP_NET_ADMIN)) { | ||
6436 | @@ -273,6 +274,7 @@ int tcp_set_congestion_control(struct sock *sk, const char *name) | ||
6437 | else { | ||
6438 | tcp_cleanup_congestion_control(sk); | ||
6439 | icsk->icsk_ca_ops = ca; | ||
6440 | + icsk->icsk_ca_setsockopt = 1; | ||
6441 | |||
6442 | if (sk->sk_state != TCP_CLOSE && icsk->icsk_ca_ops->init) | ||
6443 | icsk->icsk_ca_ops->init(sk); | ||
6444 | diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c | ||
6445 | index 63d2680b65db..2f6667116e85 100644 | ||
6446 | --- a/net/ipv4/tcp_minisocks.c | ||
6447 | +++ b/net/ipv4/tcp_minisocks.c | ||
6448 | @@ -297,7 +297,7 @@ void tcp_time_wait(struct sock *sk, int state, int timeo) | ||
6449 | tw->tw_v6_daddr = sk->sk_v6_daddr; | ||
6450 | tw->tw_v6_rcv_saddr = sk->sk_v6_rcv_saddr; | ||
6451 | tw->tw_tclass = np->tclass; | ||
6452 | - tw->tw_flowlabel = np->flow_label >> 12; | ||
6453 | + tw->tw_flowlabel = be32_to_cpu(np->flow_label & IPV6_FLOWLABEL_MASK); | ||
6454 | tw->tw_ipv6only = sk->sk_ipv6only; | ||
6455 | } | ||
6456 | #endif | ||
6457 | @@ -451,7 +451,8 @@ struct sock *tcp_create_openreq_child(struct sock *sk, struct request_sock *req, | ||
6458 | newtp->snd_cwnd = TCP_INIT_CWND; | ||
6459 | newtp->snd_cwnd_cnt = 0; | ||
6460 | |||
6461 | - if (!try_module_get(newicsk->icsk_ca_ops->owner)) | ||
6462 | + if (!newicsk->icsk_ca_setsockopt || | ||
6463 | + !try_module_get(newicsk->icsk_ca_ops->owner)) | ||
6464 | tcp_assign_congestion_control(newsk); | ||
6465 | |||
6466 | tcp_set_ca_state(newsk, TCP_CA_Open); | ||
6467 | diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c | ||
6468 | index cd0db5471bb5..c5e3194fd9a5 100644 | ||
6469 | --- a/net/ipv4/udp.c | ||
6470 | +++ b/net/ipv4/udp.c | ||
6471 | @@ -90,6 +90,7 @@ | ||
6472 | #include <linux/socket.h> | ||
6473 | #include <linux/sockios.h> | ||
6474 | #include <linux/igmp.h> | ||
6475 | +#include <linux/inetdevice.h> | ||
6476 | #include <linux/in.h> | ||
6477 | #include <linux/errno.h> | ||
6478 | #include <linux/timer.h> | ||
6479 | @@ -1336,10 +1337,8 @@ csum_copy_err: | ||
6480 | } | ||
6481 | unlock_sock_fast(sk, slow); | ||
6482 | |||
6483 | - if (noblock) | ||
6484 | - return -EAGAIN; | ||
6485 | - | ||
6486 | - /* starting over for a new packet */ | ||
6487 | + /* starting over for a new packet, but check if we need to yield */ | ||
6488 | + cond_resched(); | ||
6489 | msg->msg_flags &= ~MSG_TRUNC; | ||
6490 | goto try_again; | ||
6491 | } | ||
6492 | @@ -1950,6 +1949,7 @@ void udp_v4_early_demux(struct sk_buff *skb) | ||
6493 | struct sock *sk; | ||
6494 | struct dst_entry *dst; | ||
6495 | int dif = skb->dev->ifindex; | ||
6496 | + int ours; | ||
6497 | |||
6498 | /* validate the packet */ | ||
6499 | if (!pskb_may_pull(skb, skb_transport_offset(skb) + sizeof(struct udphdr))) | ||
6500 | @@ -1959,14 +1959,24 @@ void udp_v4_early_demux(struct sk_buff *skb) | ||
6501 | uh = udp_hdr(skb); | ||
6502 | |||
6503 | if (skb->pkt_type == PACKET_BROADCAST || | ||
6504 | - skb->pkt_type == PACKET_MULTICAST) | ||
6505 | + skb->pkt_type == PACKET_MULTICAST) { | ||
6506 | + struct in_device *in_dev = __in_dev_get_rcu(skb->dev); | ||
6507 | + | ||
6508 | + if (!in_dev) | ||
6509 | + return; | ||
6510 | + | ||
6511 | + ours = ip_check_mc_rcu(in_dev, iph->daddr, iph->saddr, | ||
6512 | + iph->protocol); | ||
6513 | + if (!ours) | ||
6514 | + return; | ||
6515 | sk = __udp4_lib_mcast_demux_lookup(net, uh->dest, iph->daddr, | ||
6516 | uh->source, iph->saddr, dif); | ||
6517 | - else if (skb->pkt_type == PACKET_HOST) | ||
6518 | + } else if (skb->pkt_type == PACKET_HOST) { | ||
6519 | sk = __udp4_lib_demux_lookup(net, uh->dest, iph->daddr, | ||
6520 | uh->source, iph->saddr, dif); | ||
6521 | - else | ||
6522 | + } else { | ||
6523 | return; | ||
6524 | + } | ||
6525 | |||
6526 | if (!sk) | ||
6527 | return; | ||
6528 | diff --git a/net/ipv6/ip6_vti.c b/net/ipv6/ip6_vti.c | ||
6529 | index bcda14de7f84..2459b7b0f705 100644 | ||
6530 | --- a/net/ipv6/ip6_vti.c | ||
6531 | +++ b/net/ipv6/ip6_vti.c | ||
6532 | @@ -271,8 +271,7 @@ static struct ip6_tnl *vti6_locate(struct net *net, struct __ip6_tnl_parm *p, | ||
6533 | static void vti6_dev_uninit(struct net_device *dev) | ||
6534 | { | ||
6535 | struct ip6_tnl *t = netdev_priv(dev); | ||
6536 | - struct net *net = dev_net(dev); | ||
6537 | - struct vti6_net *ip6n = net_generic(net, vti6_net_id); | ||
6538 | + struct vti6_net *ip6n = net_generic(t->net, vti6_net_id); | ||
6539 | |||
6540 | if (dev == ip6n->fb_tnl_dev) | ||
6541 | RCU_INIT_POINTER(ip6n->tnls_wc[0], NULL); | ||
6542 | diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c | ||
6543 | index 79fe58510ee8..a3f9f11abf4c 100644 | ||
6544 | --- a/net/ipv6/tcp_ipv6.c | ||
6545 | +++ b/net/ipv6/tcp_ipv6.c | ||
6546 | @@ -975,7 +975,7 @@ static void tcp_v6_timewait_ack(struct sock *sk, struct sk_buff *skb) | ||
6547 | tcptw->tw_rcv_wnd >> tw->tw_rcv_wscale, | ||
6548 | tcp_time_stamp + tcptw->tw_ts_offset, | ||
6549 | tcptw->tw_ts_recent, tw->tw_bound_dev_if, tcp_twsk_md5_key(tcptw), | ||
6550 | - tw->tw_tclass, (tw->tw_flowlabel << 12)); | ||
6551 | + tw->tw_tclass, cpu_to_be32(tw->tw_flowlabel)); | ||
6552 | |||
6553 | inet_twsk_put(tw); | ||
6554 | } | ||
6555 | diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c | ||
6556 | index f6ba535b6feb..dd530f0e5a8a 100644 | ||
6557 | --- a/net/ipv6/udp.c | ||
6558 | +++ b/net/ipv6/udp.c | ||
6559 | @@ -514,10 +514,8 @@ csum_copy_err: | ||
6560 | } | ||
6561 | unlock_sock_fast(sk, slow); | ||
6562 | |||
6563 | - if (noblock) | ||
6564 | - return -EAGAIN; | ||
6565 | - | ||
6566 | - /* starting over for a new packet */ | ||
6567 | + /* starting over for a new packet, but check if we need to yield */ | ||
6568 | + cond_resched(); | ||
6569 | msg->msg_flags &= ~MSG_TRUNC; | ||
6570 | goto try_again; | ||
6571 | } | ||
6572 | @@ -721,7 +719,9 @@ static bool __udp_v6_is_mcast_sock(struct net *net, struct sock *sk, | ||
6573 | (inet->inet_dport && inet->inet_dport != rmt_port) || | ||
6574 | (!ipv6_addr_any(&sk->sk_v6_daddr) && | ||
6575 | !ipv6_addr_equal(&sk->sk_v6_daddr, rmt_addr)) || | ||
6576 | - (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif)) | ||
6577 | + (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif) || | ||
6578 | + (!ipv6_addr_any(&sk->sk_v6_rcv_saddr) && | ||
6579 | + !ipv6_addr_equal(&sk->sk_v6_rcv_saddr, loc_addr))) | ||
6580 | return false; | ||
6581 | if (!inet6_mc_check(sk, loc_addr, rmt_addr)) | ||
6582 | return false; | ||
6583 | diff --git a/net/netfilter/xt_cgroup.c b/net/netfilter/xt_cgroup.c | ||
6584 | index 7198d660b4de..a1d126f29463 100644 | ||
6585 | --- a/net/netfilter/xt_cgroup.c | ||
6586 | +++ b/net/netfilter/xt_cgroup.c | ||
6587 | @@ -39,7 +39,7 @@ cgroup_mt(const struct sk_buff *skb, struct xt_action_param *par) | ||
6588 | { | ||
6589 | const struct xt_cgroup_info *info = par->matchinfo; | ||
6590 | |||
6591 | - if (skb->sk == NULL) | ||
6592 | + if (skb->sk == NULL || !sk_fullsock(skb->sk)) | ||
6593 | return false; | ||
6594 | |||
6595 | return (info->id == skb->sk->sk_classid) ^ info->invert; | ||
6596 | diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c | ||
6597 | index aad6a679fb13..fae88709aaa2 100644 | ||
6598 | --- a/net/sched/cls_api.c | ||
6599 | +++ b/net/sched/cls_api.c | ||
6600 | @@ -81,6 +81,11 @@ int unregister_tcf_proto_ops(struct tcf_proto_ops *ops) | ||
6601 | struct tcf_proto_ops *t; | ||
6602 | int rc = -ENOENT; | ||
6603 | |||
6604 | + /* Wait for outstanding call_rcu()s, if any, from a | ||
6605 | + * tcf_proto_ops's destroy() handler. | ||
6606 | + */ | ||
6607 | + rcu_barrier(); | ||
6608 | + | ||
6609 | write_lock(&cls_mod_lock); | ||
6610 | list_for_each_entry(t, &tcf_proto_base, head) { | ||
6611 | if (t == ops) { | ||
6612 | diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c | ||
6613 | index 76f402e05bd6..a25fae3c8ad6 100644 | ||
6614 | --- a/net/sched/sch_api.c | ||
6615 | +++ b/net/sched/sch_api.c | ||
6616 | @@ -815,10 +815,8 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent, | ||
6617 | if (dev->flags & IFF_UP) | ||
6618 | dev_deactivate(dev); | ||
6619 | |||
6620 | - if (new && new->ops->attach) { | ||
6621 | - new->ops->attach(new); | ||
6622 | - num_q = 0; | ||
6623 | - } | ||
6624 | + if (new && new->ops->attach) | ||
6625 | + goto skip; | ||
6626 | |||
6627 | for (i = 0; i < num_q; i++) { | ||
6628 | struct netdev_queue *dev_queue = dev_ingress_queue(dev); | ||
6629 | @@ -834,12 +832,16 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent, | ||
6630 | qdisc_destroy(old); | ||
6631 | } | ||
6632 | |||
6633 | +skip: | ||
6634 | if (!ingress) { | ||
6635 | notify_and_destroy(net, skb, n, classid, | ||
6636 | dev->qdisc, new); | ||
6637 | if (new && !new->ops->attach) | ||
6638 | atomic_inc(&new->refcnt); | ||
6639 | dev->qdisc = new ? : &noop_qdisc; | ||
6640 | + | ||
6641 | + if (new && new->ops->attach) | ||
6642 | + new->ops->attach(new); | ||
6643 | } else { | ||
6644 | notify_and_destroy(net, skb, n, classid, old, new); | ||
6645 | } | ||
6646 | diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c | ||
6647 | index 61c41298b4ea..6e5d5034b0f8 100644 | ||
6648 | --- a/net/sunrpc/xprtrdma/verbs.c | ||
6649 | +++ b/net/sunrpc/xprtrdma/verbs.c | ||
6650 | @@ -511,8 +511,8 @@ int | ||
6651 | rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr *addr, int memreg) | ||
6652 | { | ||
6653 | int rc, mem_priv; | ||
6654 | - struct ib_device_attr devattr; | ||
6655 | struct rpcrdma_ia *ia = &xprt->rx_ia; | ||
6656 | + struct ib_device_attr *devattr = &ia->ri_devattr; | ||
6657 | |||
6658 | ia->ri_id = rpcrdma_create_id(xprt, ia, addr); | ||
6659 | if (IS_ERR(ia->ri_id)) { | ||
6660 | @@ -528,28 +528,24 @@ rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr *addr, int memreg) | ||
6661 | goto out2; | ||
6662 | } | ||
6663 | |||
6664 | - /* | ||
6665 | - * Query the device to determine if the requested memory | ||
6666 | - * registration strategy is supported. If it isn't, set the | ||
6667 | - * strategy to a globally supported model. | ||
6668 | - */ | ||
6669 | - rc = ib_query_device(ia->ri_id->device, &devattr); | ||
6670 | + rc = ib_query_device(ia->ri_id->device, devattr); | ||
6671 | if (rc) { | ||
6672 | dprintk("RPC: %s: ib_query_device failed %d\n", | ||
6673 | __func__, rc); | ||
6674 | goto out2; | ||
6675 | } | ||
6676 | |||
6677 | - if (devattr.device_cap_flags & IB_DEVICE_LOCAL_DMA_LKEY) { | ||
6678 | + if (devattr->device_cap_flags & IB_DEVICE_LOCAL_DMA_LKEY) { | ||
6679 | ia->ri_have_dma_lkey = 1; | ||
6680 | ia->ri_dma_lkey = ia->ri_id->device->local_dma_lkey; | ||
6681 | } | ||
6682 | |||
6683 | if (memreg == RPCRDMA_FRMR) { | ||
6684 | /* Requires both frmr reg and local dma lkey */ | ||
6685 | - if ((devattr.device_cap_flags & | ||
6686 | + if (((devattr->device_cap_flags & | ||
6687 | (IB_DEVICE_MEM_MGT_EXTENSIONS|IB_DEVICE_LOCAL_DMA_LKEY)) != | ||
6688 | - (IB_DEVICE_MEM_MGT_EXTENSIONS|IB_DEVICE_LOCAL_DMA_LKEY)) { | ||
6689 | + (IB_DEVICE_MEM_MGT_EXTENSIONS|IB_DEVICE_LOCAL_DMA_LKEY)) || | ||
6690 | + (devattr->max_fast_reg_page_list_len == 0)) { | ||
6691 | dprintk("RPC: %s: FRMR registration " | ||
6692 | "not supported by HCA\n", __func__); | ||
6693 | memreg = RPCRDMA_MTHCAFMR; | ||
6694 | @@ -557,7 +553,7 @@ rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr *addr, int memreg) | ||
6695 | /* Mind the ia limit on FRMR page list depth */ | ||
6696 | ia->ri_max_frmr_depth = min_t(unsigned int, | ||
6697 | RPCRDMA_MAX_DATA_SEGS, | ||
6698 | - devattr.max_fast_reg_page_list_len); | ||
6699 | + devattr->max_fast_reg_page_list_len); | ||
6700 | } | ||
6701 | } | ||
6702 | if (memreg == RPCRDMA_MTHCAFMR) { | ||
6703 | @@ -655,20 +651,13 @@ int | ||
6704 | rpcrdma_ep_create(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia, | ||
6705 | struct rpcrdma_create_data_internal *cdata) | ||
6706 | { | ||
6707 | - struct ib_device_attr devattr; | ||
6708 | + struct ib_device_attr *devattr = &ia->ri_devattr; | ||
6709 | struct ib_cq *sendcq, *recvcq; | ||
6710 | int rc, err; | ||
6711 | |||
6712 | - rc = ib_query_device(ia->ri_id->device, &devattr); | ||
6713 | - if (rc) { | ||
6714 | - dprintk("RPC: %s: ib_query_device failed %d\n", | ||
6715 | - __func__, rc); | ||
6716 | - return rc; | ||
6717 | - } | ||
6718 | - | ||
6719 | /* check provider's send/recv wr limits */ | ||
6720 | - if (cdata->max_requests > devattr.max_qp_wr) | ||
6721 | - cdata->max_requests = devattr.max_qp_wr; | ||
6722 | + if (cdata->max_requests > devattr->max_qp_wr) | ||
6723 | + cdata->max_requests = devattr->max_qp_wr; | ||
6724 | |||
6725 | ep->rep_attr.event_handler = rpcrdma_qp_async_error_upcall; | ||
6726 | ep->rep_attr.qp_context = ep; | ||
6727 | @@ -703,8 +692,8 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia, | ||
6728 | |||
6729 | } | ||
6730 | ep->rep_attr.cap.max_send_wr *= depth; | ||
6731 | - if (ep->rep_attr.cap.max_send_wr > devattr.max_qp_wr) { | ||
6732 | - cdata->max_requests = devattr.max_qp_wr / depth; | ||
6733 | + if (ep->rep_attr.cap.max_send_wr > devattr->max_qp_wr) { | ||
6734 | + cdata->max_requests = devattr->max_qp_wr / depth; | ||
6735 | if (!cdata->max_requests) | ||
6736 | return -EINVAL; | ||
6737 | ep->rep_attr.cap.max_send_wr = cdata->max_requests * | ||
6738 | @@ -786,10 +775,11 @@ rpcrdma_ep_create(struct rpcrdma_ep *ep, struct rpcrdma_ia *ia, | ||
6739 | |||
6740 | /* Client offers RDMA Read but does not initiate */ | ||
6741 | ep->rep_remote_cma.initiator_depth = 0; | ||
6742 | - if (devattr.max_qp_rd_atom > 32) /* arbitrary but <= 255 */ | ||
6743 | + if (devattr->max_qp_rd_atom > 32) /* arbitrary but <= 255 */ | ||
6744 | ep->rep_remote_cma.responder_resources = 32; | ||
6745 | else | ||
6746 | - ep->rep_remote_cma.responder_resources = devattr.max_qp_rd_atom; | ||
6747 | + ep->rep_remote_cma.responder_resources = | ||
6748 | + devattr->max_qp_rd_atom; | ||
6749 | |||
6750 | ep->rep_remote_cma.retry_count = 7; | ||
6751 | ep->rep_remote_cma.flow_control = 0; | ||
6752 | diff --git a/net/sunrpc/xprtrdma/xprt_rdma.h b/net/sunrpc/xprtrdma/xprt_rdma.h | ||
6753 | index ac7fc9a31342..11f0e06f6623 100644 | ||
6754 | --- a/net/sunrpc/xprtrdma/xprt_rdma.h | ||
6755 | +++ b/net/sunrpc/xprtrdma/xprt_rdma.h | ||
6756 | @@ -70,6 +70,7 @@ struct rpcrdma_ia { | ||
6757 | int ri_async_rc; | ||
6758 | enum rpcrdma_memreg ri_memreg_strategy; | ||
6759 | unsigned int ri_max_frmr_depth; | ||
6760 | + struct ib_device_attr ri_devattr; | ||
6761 | }; | ||
6762 | |||
6763 | /* | ||
6764 | diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c | ||
6765 | index e96884380732..8232118b3f82 100644 | ||
6766 | --- a/net/unix/af_unix.c | ||
6767 | +++ b/net/unix/af_unix.c | ||
6768 | @@ -1899,6 +1899,10 @@ static long unix_stream_data_wait(struct sock *sk, long timeo, | ||
6769 | unix_state_unlock(sk); | ||
6770 | timeo = freezable_schedule_timeout(timeo); | ||
6771 | unix_state_lock(sk); | ||
6772 | + | ||
6773 | + if (sock_flag(sk, SOCK_DEAD)) | ||
6774 | + break; | ||
6775 | + | ||
6776 | clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); | ||
6777 | } | ||
6778 | |||
6779 | @@ -1963,6 +1967,10 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, | ||
6780 | struct sk_buff *skb, *last; | ||
6781 | |||
6782 | unix_state_lock(sk); | ||
6783 | + if (sock_flag(sk, SOCK_DEAD)) { | ||
6784 | + err = -ECONNRESET; | ||
6785 | + goto unlock; | ||
6786 | + } | ||
6787 | last = skb = skb_peek(&sk->sk_receive_queue); | ||
6788 | again: | ||
6789 | if (skb == NULL) { | ||
6790 | diff --git a/security/selinux/nlmsgtab.c b/security/selinux/nlmsgtab.c | ||
6791 | index 2df7b900e259..902b5e9cec7e 100644 | ||
6792 | --- a/security/selinux/nlmsgtab.c | ||
6793 | +++ b/security/selinux/nlmsgtab.c | ||
6794 | @@ -100,6 +100,13 @@ static struct nlmsg_perm nlmsg_xfrm_perms[] = | ||
6795 | { XFRM_MSG_FLUSHPOLICY, NETLINK_XFRM_SOCKET__NLMSG_WRITE }, | ||
6796 | { XFRM_MSG_NEWAE, NETLINK_XFRM_SOCKET__NLMSG_WRITE }, | ||
6797 | { XFRM_MSG_GETAE, NETLINK_XFRM_SOCKET__NLMSG_READ }, | ||
6798 | + { XFRM_MSG_REPORT, NETLINK_XFRM_SOCKET__NLMSG_READ }, | ||
6799 | + { XFRM_MSG_MIGRATE, NETLINK_XFRM_SOCKET__NLMSG_WRITE }, | ||
6800 | + { XFRM_MSG_NEWSADINFO, NETLINK_XFRM_SOCKET__NLMSG_READ }, | ||
6801 | + { XFRM_MSG_GETSADINFO, NETLINK_XFRM_SOCKET__NLMSG_READ }, | ||
6802 | + { XFRM_MSG_NEWSPDINFO, NETLINK_XFRM_SOCKET__NLMSG_WRITE }, | ||
6803 | + { XFRM_MSG_GETSPDINFO, NETLINK_XFRM_SOCKET__NLMSG_READ }, | ||
6804 | + { XFRM_MSG_MAPPING, NETLINK_XFRM_SOCKET__NLMSG_READ }, | ||
6805 | }; | ||
6806 | |||
6807 | static struct nlmsg_perm nlmsg_audit_perms[] = | ||
6808 | diff --git a/tools/vm/Makefile b/tools/vm/Makefile | ||
6809 | index c604f3ec628a..3d907dacf2ac 100644 | ||
6810 | --- a/tools/vm/Makefile | ||
6811 | +++ b/tools/vm/Makefile | ||
6812 | @@ -3,7 +3,7 @@ | ||
6813 | TARGETS=page-types slabinfo | ||
6814 | |||
6815 | LIB_DIR = ../lib/api | ||
6816 | -LIBS = $(LIB_DIR)/libapi.a | ||
6817 | +LIBS = $(LIB_DIR)/libapikfs.a | ||
6818 | |||
6819 | CC = $(CROSS_COMPILE)gcc | ||
6820 | CFLAGS = -Wall -Wextra -I../lib/ |