aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/acpi/actbl1.h14
-rw-r--r--include/acpi/ghes.h2
-rw-r--r--include/asm-generic/preempt.h105
-rw-r--r--include/clocksource/arm_arch_timer.h10
-rw-r--r--include/dt-bindings/mfd/dbx500-prcmu.h83
-rw-r--r--include/dt-bindings/pinctrl/am43xx.h31
-rw-r--r--include/dt-bindings/pinctrl/dra.h50
-rw-r--r--include/linux/acpi.h1
-rw-r--r--include/linux/atmel_serial.h1
-rw-r--r--include/linux/bitops.h8
-rw-r--r--include/linux/clk/mxs.h2
-rw-r--r--include/linux/clk/sunxi.h22
-rw-r--r--include/linux/clockchips.h1
-rw-r--r--include/linux/clocksource.h2
-rw-r--r--include/linux/completion.h2
-rw-r--r--include/linux/cper.h13
-rw-r--r--include/linux/debugfs.h12
-rw-r--r--include/linux/device.h64
-rw-r--r--include/linux/dmi.h5
-rw-r--r--include/linux/edac.h2
-rw-r--r--include/linux/efi.h58
-rw-r--r--include/linux/extcon.h72
-rw-r--r--include/linux/extcon/extcon-adc-jack.h42
-rw-r--r--include/linux/extcon/extcon-gpio.h20
-rw-r--r--include/linux/fs.h5
-rw-r--r--include/linux/fscache-cache.h50
-rw-r--r--include/linux/fscache.h113
-rw-r--r--include/linux/hardirq.h8
-rw-r--r--include/linux/hashtable.h15
-rw-r--r--include/linux/hid-sensor-hub.h18
-rw-r--r--include/linux/hwmon-vid.h2
-rw-r--r--include/linux/hwmon.h10
-rw-r--r--include/linux/hyperv.h37
-rw-r--r--include/linux/i2c/twl.h2
-rw-r--r--include/linux/ide.h2
-rw-r--r--include/linux/iio/buffer.h61
-rw-r--r--include/linux/iio/common/st_sensors.h6
-rw-r--r--include/linux/iio/consumer.h2
-rw-r--r--include/linux/iio/events.h14
-rw-r--r--include/linux/iio/iio.h93
-rw-r--r--include/linux/iio/sysfs.h15
-rw-r--r--include/linux/iio/types.h20
-rw-r--r--include/linux/interrupt.h11
-rw-r--r--include/linux/irqchip/bcm2835.h29
-rw-r--r--include/linux/kdb.h1
-rw-r--r--include/linux/kgdb.h1
-rw-r--r--include/linux/kobj_completion.h18
-rw-r--r--include/linux/kobject.h1
-rw-r--r--include/linux/lockref.h6
-rw-r--r--include/linux/mempolicy.h1
-rw-r--r--include/linux/mfd/core.h6
-rw-r--r--include/linux/mfd/dbx500-prcmu.h70
-rw-r--r--include/linux/mfd/syscon/imx6q-iomuxc-gpr.h5
-rw-r--r--include/linux/mfd/ti_am335x_tscadc.h9
-rw-r--r--include/linux/migrate.h7
-rw-r--r--include/linux/mm.h132
-rw-r--r--include/linux/mm_types.h17
-rw-r--r--include/linux/netdevice.h16
-rw-r--r--include/linux/netpoll.h5
-rw-r--r--include/linux/nfs4.h5
-rw-r--r--include/linux/nfs_fs.h8
-rw-r--r--include/linux/nfs_fs_sb.h10
-rw-r--r--include/linux/nfs_xdr.h24
-rw-r--r--include/linux/of.h2
-rw-r--r--include/linux/page-flags-layout.h28
-rw-r--r--include/linux/page-flags.h4
-rw-r--r--include/linux/perf_event.h5
-rw-r--r--include/linux/phy/phy.h270
-rw-r--r--include/linux/platform_data/clk-nomadik.h2
-rw-r--r--include/linux/platform_data/clk-ux500.h3
-rw-r--r--include/linux/platform_data/dma-s3c24xx.h46
-rw-r--r--include/linux/platform_data/gpio-davinci.h60
-rw-r--r--include/linux/platform_data/mipi-csis.h9
-rw-r--r--include/linux/platform_data/pinctrl-single.h12
-rw-r--r--include/linux/platform_data/usb-ehci-s5p.h21
-rw-r--r--include/linux/platform_data/usb-ohci-exynos.h21
-rw-r--r--include/linux/platform_data/usb-rcar-gen2-phy.h22
-rw-r--r--include/linux/platform_device.h1
-rw-r--r--include/linux/preempt.h112
-rw-r--r--include/linux/printk.h16
-rw-r--r--include/linux/rculist.h23
-rw-r--r--include/linux/rcupdate.h24
-rw-r--r--include/linux/rcutiny.h17
-rw-r--r--include/linux/rcutree.h2
-rw-r--r--include/linux/regmap.h9
-rw-r--r--include/linux/regulator/consumer.h79
-rw-r--r--include/linux/regulator/driver.h18
-rw-r--r--include/linux/regulator/machine.h7
-rw-r--r--include/linux/sched.h167
-rw-r--r--include/linux/sched/sysctl.h1
-rw-r--r--include/linux/sched_clock.h4
-rw-r--r--include/linux/serial_core.h1
-rw-r--r--include/linux/serial_sci.h2
-rw-r--r--include/linux/sfi.h3
-rw-r--r--include/linux/spi/rspi.h2
-rw-r--r--include/linux/spi/spi.h61
-rw-r--r--include/linux/stop_machine.h1
-rw-r--r--include/linux/sunrpc/clnt.h6
-rw-r--r--include/linux/sunrpc/sched.h1
-rw-r--r--include/linux/sunrpc/xprt.h2
-rw-r--r--include/linux/sysfs.h88
-rw-r--r--include/linux/sysrq.h3
-rw-r--r--include/linux/tegra-powergate.h9
-rw-r--r--include/linux/thread_info.h17
-rw-r--r--include/linux/topology.h6
-rw-r--r--include/linux/tty.h29
-rw-r--r--include/linux/uaccess.h8
-rw-r--r--include/linux/uprobes.h15
-rw-r--r--include/linux/usb.h10
-rw-r--r--include/linux/usb/hcd.h16
-rw-r--r--include/linux/usb/intel_mid_otg.h180
-rw-r--r--include/linux/usb/musb.h2
-rw-r--r--include/linux/usb/omap_control_usb.h33
-rw-r--r--include/linux/usb/serial.h2
-rw-r--r--include/linux/usb/usb_phy_gen_xceiv.h3
-rw-r--r--include/linux/usb/wusb-wa.h51
-rw-r--r--include/linux/wait.h374
-rw-r--r--include/net/ip6_fib.h1
-rw-r--r--include/trace/events/rcu.h80
-rw-r--r--include/trace/events/sched.h2
-rw-r--r--include/trace/events/spi.h156
-rw-r--r--include/uapi/linux/Kbuild2
-rw-r--r--include/uapi/linux/audit.h1
-rw-r--r--include/uapi/linux/elf-em.h1
-rw-r--r--include/uapi/linux/mic_common.h240
-rw-r--r--include/uapi/linux/mic_ioctl.h76
-rw-r--r--include/uapi/linux/nfs_mount.h2
-rw-r--r--include/uapi/linux/perf_event.h25
-rw-r--r--include/video/exynos_dp.h131
-rw-r--r--include/video/exynos_mipi_dsim.h5
130 files changed, 2854 insertions, 1255 deletions
diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h
index 0bd750ebeb49..556c83ee6b42 100644
--- a/include/acpi/actbl1.h
+++ b/include/acpi/actbl1.h
@@ -596,7 +596,7 @@ struct acpi_hest_generic {
596 596
597/* Generic Error Status block */ 597/* Generic Error Status block */
598 598
599struct acpi_hest_generic_status { 599struct acpi_generic_status {
600 u32 block_status; 600 u32 block_status;
601 u32 raw_data_offset; 601 u32 raw_data_offset;
602 u32 raw_data_length; 602 u32 raw_data_length;
@@ -606,15 +606,15 @@ struct acpi_hest_generic_status {
606 606
607/* Values for block_status flags above */ 607/* Values for block_status flags above */
608 608
609#define ACPI_HEST_UNCORRECTABLE (1) 609#define ACPI_GEN_ERR_UC BIT(0)
610#define ACPI_HEST_CORRECTABLE (1<<1) 610#define ACPI_GEN_ERR_CE BIT(1)
611#define ACPI_HEST_MULTIPLE_UNCORRECTABLE (1<<2) 611#define ACPI_GEN_ERR_MULTI_UC BIT(2)
612#define ACPI_HEST_MULTIPLE_CORRECTABLE (1<<3) 612#define ACPI_GEN_ERR_MULTI_CE BIT(3)
613#define ACPI_HEST_ERROR_ENTRY_COUNT (0xFF<<4) /* 8 bits, error count */ 613#define ACPI_GEN_ERR_COUNT_SHIFT (0xFF<<4) /* 8 bits, error count */
614 614
615/* Generic Error Data entry */ 615/* Generic Error Data entry */
616 616
617struct acpi_hest_generic_data { 617struct acpi_generic_data {
618 u8 section_type[16]; 618 u8 section_type[16];
619 u32 error_severity; 619 u32 error_severity;
620 u16 revision; 620 u16 revision;
diff --git a/include/acpi/ghes.h b/include/acpi/ghes.h
index 720446cb243e..dfd60d0bfd27 100644
--- a/include/acpi/ghes.h
+++ b/include/acpi/ghes.h
@@ -14,7 +14,7 @@
14 14
15struct ghes { 15struct ghes {
16 struct acpi_hest_generic *generic; 16 struct acpi_hest_generic *generic;
17 struct acpi_hest_generic_status *estatus; 17 struct acpi_generic_status *estatus;
18 u64 buffer_paddr; 18 u64 buffer_paddr;
19 unsigned long flags; 19 unsigned long flags;
20 union { 20 union {
diff --git a/include/asm-generic/preempt.h b/include/asm-generic/preempt.h
new file mode 100644
index 000000000000..ddf2b420ac8f
--- /dev/null
+++ b/include/asm-generic/preempt.h
@@ -0,0 +1,105 @@
1#ifndef __ASM_PREEMPT_H
2#define __ASM_PREEMPT_H
3
4#include <linux/thread_info.h>
5
6/*
7 * We mask the PREEMPT_NEED_RESCHED bit so as not to confuse all current users
8 * that think a non-zero value indicates we cannot preempt.
9 */
10static __always_inline int preempt_count(void)
11{
12 return current_thread_info()->preempt_count & ~PREEMPT_NEED_RESCHED;
13}
14
15static __always_inline int *preempt_count_ptr(void)
16{
17 return &current_thread_info()->preempt_count;
18}
19
20/*
21 * We now loose PREEMPT_NEED_RESCHED and cause an extra reschedule; however the
22 * alternative is loosing a reschedule. Better schedule too often -- also this
23 * should be a very rare operation.
24 */
25static __always_inline void preempt_count_set(int pc)
26{
27 *preempt_count_ptr() = pc;
28}
29
30/*
31 * must be macros to avoid header recursion hell
32 */
33#define task_preempt_count(p) \
34 (task_thread_info(p)->preempt_count & ~PREEMPT_NEED_RESCHED)
35
36#define init_task_preempt_count(p) do { \
37 task_thread_info(p)->preempt_count = PREEMPT_DISABLED; \
38} while (0)
39
40#define init_idle_preempt_count(p, cpu) do { \
41 task_thread_info(p)->preempt_count = PREEMPT_ENABLED; \
42} while (0)
43
44/*
45 * We fold the NEED_RESCHED bit into the preempt count such that
46 * preempt_enable() can decrement and test for needing to reschedule with a
47 * single instruction.
48 *
49 * We invert the actual bit, so that when the decrement hits 0 we know we both
50 * need to resched (the bit is cleared) and can resched (no preempt count).
51 */
52
53static __always_inline void set_preempt_need_resched(void)
54{
55 *preempt_count_ptr() &= ~PREEMPT_NEED_RESCHED;
56}
57
58static __always_inline void clear_preempt_need_resched(void)
59{
60 *preempt_count_ptr() |= PREEMPT_NEED_RESCHED;
61}
62
63static __always_inline bool test_preempt_need_resched(void)
64{
65 return !(*preempt_count_ptr() & PREEMPT_NEED_RESCHED);
66}
67
68/*
69 * The various preempt_count add/sub methods
70 */
71
72static __always_inline void __preempt_count_add(int val)
73{
74 *preempt_count_ptr() += val;
75}
76
77static __always_inline void __preempt_count_sub(int val)
78{
79 *preempt_count_ptr() -= val;
80}
81
82static __always_inline bool __preempt_count_dec_and_test(void)
83{
84 return !--*preempt_count_ptr();
85}
86
87/*
88 * Returns true when we need to resched and can (barring IRQ state).
89 */
90static __always_inline bool should_resched(void)
91{
92 return unlikely(!*preempt_count_ptr());
93}
94
95#ifdef CONFIG_PREEMPT
96extern asmlinkage void preempt_schedule(void);
97#define __preempt_schedule() preempt_schedule()
98
99#ifdef CONFIG_CONTEXT_TRACKING
100extern asmlinkage void preempt_schedule_context(void);
101#define __preempt_schedule_context() preempt_schedule_context()
102#endif
103#endif /* CONFIG_PREEMPT */
104
105#endif /* __ASM_PREEMPT_H */
diff --git a/include/clocksource/arm_arch_timer.h b/include/clocksource/arm_arch_timer.h
index 93b7f96f9c59..6d26b40cbf5d 100644
--- a/include/clocksource/arm_arch_timer.h
+++ b/include/clocksource/arm_arch_timer.h
@@ -33,6 +33,16 @@ enum arch_timer_reg {
33#define ARCH_TIMER_MEM_PHYS_ACCESS 2 33#define ARCH_TIMER_MEM_PHYS_ACCESS 2
34#define ARCH_TIMER_MEM_VIRT_ACCESS 3 34#define ARCH_TIMER_MEM_VIRT_ACCESS 3
35 35
36#define ARCH_TIMER_USR_PCT_ACCESS_EN (1 << 0) /* physical counter */
37#define ARCH_TIMER_USR_VCT_ACCESS_EN (1 << 1) /* virtual counter */
38#define ARCH_TIMER_VIRT_EVT_EN (1 << 2)
39#define ARCH_TIMER_EVT_TRIGGER_SHIFT (4)
40#define ARCH_TIMER_EVT_TRIGGER_MASK (0xF << ARCH_TIMER_EVT_TRIGGER_SHIFT)
41#define ARCH_TIMER_USR_VT_ACCESS_EN (1 << 8) /* virtual timer registers */
42#define ARCH_TIMER_USR_PT_ACCESS_EN (1 << 9) /* physical timer registers */
43
44#define ARCH_TIMER_EVT_STREAM_FREQ 10000 /* 100us */
45
36#ifdef CONFIG_ARM_ARCH_TIMER 46#ifdef CONFIG_ARM_ARCH_TIMER
37 47
38extern u32 arch_timer_get_rate(void); 48extern u32 arch_timer_get_rate(void);
diff --git a/include/dt-bindings/mfd/dbx500-prcmu.h b/include/dt-bindings/mfd/dbx500-prcmu.h
new file mode 100644
index 000000000000..552a2d174f01
--- /dev/null
+++ b/include/dt-bindings/mfd/dbx500-prcmu.h
@@ -0,0 +1,83 @@
1/*
2 * This header provides constants for the PRCMU bindings.
3 *
4 */
5
6#ifndef _DT_BINDINGS_MFD_PRCMU_H
7#define _DT_BINDINGS_MFD_PRCMU_H
8
9/*
10 * Clock identifiers.
11 */
12#define ARMCLK 0
13#define PRCMU_ACLK 1
14#define PRCMU_SVAMMCSPCLK 2
15#define PRCMU_SDMMCHCLK 2 /* DBx540 only. */
16#define PRCMU_SIACLK 3
17#define PRCMU_SIAMMDSPCLK 3 /* DBx540 only. */
18#define PRCMU_SGACLK 4
19#define PRCMU_UARTCLK 5
20#define PRCMU_MSP02CLK 6
21#define PRCMU_MSP1CLK 7
22#define PRCMU_I2CCLK 8
23#define PRCMU_SDMMCCLK 9
24#define PRCMU_SLIMCLK 10
25#define PRCMU_CAMCLK 10 /* DBx540 only. */
26#define PRCMU_PER1CLK 11
27#define PRCMU_PER2CLK 12
28#define PRCMU_PER3CLK 13
29#define PRCMU_PER5CLK 14
30#define PRCMU_PER6CLK 15
31#define PRCMU_PER7CLK 16
32#define PRCMU_LCDCLK 17
33#define PRCMU_BMLCLK 18
34#define PRCMU_HSITXCLK 19
35#define PRCMU_HSIRXCLK 20
36#define PRCMU_HDMICLK 21
37#define PRCMU_APEATCLK 22
38#define PRCMU_APETRACECLK 23
39#define PRCMU_MCDECLK 24
40#define PRCMU_IPI2CCLK 25
41#define PRCMU_DSIALTCLK 26
42#define PRCMU_DMACLK 27
43#define PRCMU_B2R2CLK 28
44#define PRCMU_TVCLK 29
45#define SPARE_UNIPROCLK 30
46#define PRCMU_SSPCLK 31
47#define PRCMU_RNGCLK 32
48#define PRCMU_UICCCLK 33
49#define PRCMU_G1CLK 34 /* DBx540 only. */
50#define PRCMU_HVACLK 35 /* DBx540 only. */
51#define PRCMU_SPARE1CLK 36
52#define PRCMU_SPARE2CLK 37
53
54#define PRCMU_NUM_REG_CLOCKS 38
55
56#define PRCMU_RTCCLK PRCMU_NUM_REG_CLOCKS
57#define PRCMU_SYSCLK 39
58#define PRCMU_CDCLK 40
59#define PRCMU_TIMCLK 41
60#define PRCMU_PLLSOC0 42
61#define PRCMU_PLLSOC1 43
62#define PRCMU_ARMSS 44
63#define PRCMU_PLLDDR 45
64
65/* DSI Clocks */
66#define PRCMU_PLLDSI 46
67#define PRCMU_DSI0CLK 47
68#define PRCMU_DSI1CLK 48
69#define PRCMU_DSI0ESCCLK 49
70#define PRCMU_DSI1ESCCLK 50
71#define PRCMU_DSI2ESCCLK 51
72
73/* LCD DSI PLL - Ux540 only */
74#define PRCMU_PLLDSI_LCD 52
75#define PRCMU_DSI0CLK_LCD 53
76#define PRCMU_DSI1CLK_LCD 54
77#define PRCMU_DSI0ESCCLK_LCD 55
78#define PRCMU_DSI1ESCCLK_LCD 56
79#define PRCMU_DSI2ESCCLK_LCD 57
80
81#define PRCMU_NUM_CLKS 58
82
83#endif
diff --git a/include/dt-bindings/pinctrl/am43xx.h b/include/dt-bindings/pinctrl/am43xx.h
new file mode 100644
index 000000000000..eb6c366adfba
--- /dev/null
+++ b/include/dt-bindings/pinctrl/am43xx.h
@@ -0,0 +1,31 @@
1/*
2 * This header provides constants specific to AM43XX pinctrl bindings.
3 */
4
5#ifndef _DT_BINDINGS_PINCTRL_AM43XX_H
6#define _DT_BINDINGS_PINCTRL_AM43XX_H
7
8#define MUX_MODE0 0
9#define MUX_MODE1 1
10#define MUX_MODE2 2
11#define MUX_MODE3 3
12#define MUX_MODE4 4
13#define MUX_MODE5 5
14#define MUX_MODE6 6
15#define MUX_MODE7 7
16
17#define PULL_DISABLE (1 << 16)
18#define PULL_UP (1 << 17)
19#define INPUT_EN (1 << 18)
20#define SLEWCTRL_FAST (1 << 19)
21#define DS0_PULL_UP_DOWN_EN (1 << 27)
22
23#define PIN_OUTPUT (PULL_DISABLE)
24#define PIN_OUTPUT_PULLUP (PULL_UP)
25#define PIN_OUTPUT_PULLDOWN 0
26#define PIN_INPUT (INPUT_EN | PULL_DISABLE)
27#define PIN_INPUT_PULLUP (INPUT_EN | PULL_UP)
28#define PIN_INPUT_PULLDOWN (INPUT_EN)
29
30#endif
31
diff --git a/include/dt-bindings/pinctrl/dra.h b/include/dt-bindings/pinctrl/dra.h
new file mode 100644
index 000000000000..002a2855c046
--- /dev/null
+++ b/include/dt-bindings/pinctrl/dra.h
@@ -0,0 +1,50 @@
1/*
2 * This header provides constants for DRA pinctrl bindings.
3 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
5 * Author: Rajendra Nayak <rnayak@ti.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _DT_BINDINGS_PINCTRL_DRA_H
13#define _DT_BINDINGS_PINCTRL_DRA_H
14
15/* DRA7 mux mode options for each pin. See TRM for options */
16#define MUX_MODE0 0x0
17#define MUX_MODE1 0x1
18#define MUX_MODE2 0x2
19#define MUX_MODE3 0x3
20#define MUX_MODE4 0x4
21#define MUX_MODE5 0x5
22#define MUX_MODE6 0x6
23#define MUX_MODE7 0x7
24#define MUX_MODE8 0x8
25#define MUX_MODE9 0x9
26#define MUX_MODE10 0xa
27#define MUX_MODE11 0xb
28#define MUX_MODE12 0xc
29#define MUX_MODE13 0xd
30#define MUX_MODE14 0xe
31#define MUX_MODE15 0xf
32
33#define PULL_ENA (1 << 16)
34#define PULL_UP (1 << 17)
35#define INPUT_EN (1 << 18)
36#define SLEWCONTROL (1 << 19)
37#define WAKEUP_EN (1 << 24)
38#define WAKEUP_EVENT (1 << 25)
39
40/* Active pin states */
41#define PIN_OUTPUT 0
42#define PIN_OUTPUT_PULLUP (PIN_OUTPUT | PULL_ENA | PULL_UP)
43#define PIN_OUTPUT_PULLDOWN (PIN_OUTPUT | PULL_ENA)
44#define PIN_INPUT INPUT_EN
45#define PIN_INPUT_SLEW (INPUT_EN | SLEWCONTROL)
46#define PIN_INPUT_PULLUP (PULL_ENA | INPUT_EN | PULL_UP)
47#define PIN_INPUT_PULLDOWN (PULL_ENA | INPUT_EN)
48
49#endif
50
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index a5db4aeefa36..c30bac8503bc 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -311,6 +311,7 @@ struct acpi_osc_context {
311#define OSC_INVALID_REVISION_ERROR 8 311#define OSC_INVALID_REVISION_ERROR 8
312#define OSC_CAPABILITIES_MASK_ERROR 16 312#define OSC_CAPABILITIES_MASK_ERROR 16
313 313
314acpi_status acpi_str_to_uuid(char *str, u8 *uuid);
314acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context); 315acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context);
315 316
316/* platform-wide _OSC bits */ 317/* platform-wide _OSC bits */
diff --git a/include/linux/atmel_serial.h b/include/linux/atmel_serial.h
index be201ca2990c..00beddf6be20 100644
--- a/include/linux/atmel_serial.h
+++ b/include/linux/atmel_serial.h
@@ -125,5 +125,6 @@
125#define ATMEL_US_IF 0x4c /* IrDA Filter Register */ 125#define ATMEL_US_IF 0x4c /* IrDA Filter Register */
126 126
127#define ATMEL_US_NAME 0xf0 /* Ip Name */ 127#define ATMEL_US_NAME 0xf0 /* Ip Name */
128#define ATMEL_US_VERSION 0xfc /* Ip Version */
128 129
129#endif 130#endif
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index a3b6b82108b9..bd0c4598d03b 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -10,6 +10,14 @@
10#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long)) 10#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
11#endif 11#endif
12 12
13/*
14 * Create a contiguous bitmask starting at bit position @l and ending at
15 * position @h. For example
16 * GENMASK_ULL(39, 21) gives us the 64bit vector 0x000000ffffe00000.
17 */
18#define GENMASK(h, l) (((U32_C(1) << ((h) - (l) + 1)) - 1) << (l))
19#define GENMASK_ULL(h, l) (((U64_C(1) << ((h) - (l) + 1)) - 1) << (l))
20
13extern unsigned int __sw_hweight8(unsigned int w); 21extern unsigned int __sw_hweight8(unsigned int w);
14extern unsigned int __sw_hweight16(unsigned int w); 22extern unsigned int __sw_hweight16(unsigned int w);
15extern unsigned int __sw_hweight32(unsigned int w); 23extern unsigned int __sw_hweight32(unsigned int w);
diff --git a/include/linux/clk/mxs.h b/include/linux/clk/mxs.h
index 90c30dc3efc7..5138a90e018c 100644
--- a/include/linux/clk/mxs.h
+++ b/include/linux/clk/mxs.h
@@ -9,8 +9,6 @@
9#ifndef __LINUX_CLK_MXS_H 9#ifndef __LINUX_CLK_MXS_H
10#define __LINUX_CLK_MXS_H 10#define __LINUX_CLK_MXS_H
11 11
12int mx23_clocks_init(void);
13int mx28_clocks_init(void);
14int mxs_saif_clkmux_select(unsigned int clkmux); 12int mxs_saif_clkmux_select(unsigned int clkmux);
15 13
16#endif 14#endif
diff --git a/include/linux/clk/sunxi.h b/include/linux/clk/sunxi.h
deleted file mode 100644
index e074fdd5a236..000000000000
--- a/include/linux/clk/sunxi.h
+++ /dev/null
@@ -1,22 +0,0 @@
1/*
2 * Copyright 2012 Maxime Ripard
3 *
4 * Maxime Ripard <maxime.ripard@free-electrons.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#ifndef __LINUX_CLK_SUNXI_H_
18#define __LINUX_CLK_SUNXI_H_
19
20void __init sunxi_init_clocks(void);
21
22#endif
diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index 0857922e8ad0..493aa021c7a9 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -60,6 +60,7 @@ enum clock_event_mode {
60 * Core shall set the interrupt affinity dynamically in broadcast mode 60 * Core shall set the interrupt affinity dynamically in broadcast mode
61 */ 61 */
62#define CLOCK_EVT_FEAT_DYNIRQ 0x000020 62#define CLOCK_EVT_FEAT_DYNIRQ 0x000020
63#define CLOCK_EVT_FEAT_PERCPU 0x000040
63 64
64/** 65/**
65 * struct clock_event_device - clock event device descriptor 66 * struct clock_event_device - clock event device descriptor
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index dbbf8aa7731b..67301a405712 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -292,6 +292,8 @@ extern void clocksource_resume(void);
292extern struct clocksource * __init __weak clocksource_default_clock(void); 292extern struct clocksource * __init __weak clocksource_default_clock(void);
293extern void clocksource_mark_unstable(struct clocksource *cs); 293extern void clocksource_mark_unstable(struct clocksource *cs);
294 294
295extern u64
296clocks_calc_max_nsecs(u32 mult, u32 shift, u32 maxadj, u64 mask);
295extern void 297extern void
296clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec); 298clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 minsec);
297 299
diff --git a/include/linux/completion.h b/include/linux/completion.h
index 3cd574d5b19e..22c33e35bcb2 100644
--- a/include/linux/completion.h
+++ b/include/linux/completion.h
@@ -5,7 +5,7 @@
5 * (C) Copyright 2001 Linus Torvalds 5 * (C) Copyright 2001 Linus Torvalds
6 * 6 *
7 * Atomic wait-for-completion handler data structures. 7 * Atomic wait-for-completion handler data structures.
8 * See kernel/sched/core.c for details. 8 * See kernel/sched/completion.c for details.
9 */ 9 */
10 10
11#include <linux/wait.h> 11#include <linux/wait.h>
diff --git a/include/linux/cper.h b/include/linux/cper.h
index c23049496531..2fc0ec3d89cc 100644
--- a/include/linux/cper.h
+++ b/include/linux/cper.h
@@ -218,8 +218,8 @@ enum {
218#define CPER_PROC_VALID_IP 0x1000 218#define CPER_PROC_VALID_IP 0x1000
219 219
220#define CPER_MEM_VALID_ERROR_STATUS 0x0001 220#define CPER_MEM_VALID_ERROR_STATUS 0x0001
221#define CPER_MEM_VALID_PHYSICAL_ADDRESS 0x0002 221#define CPER_MEM_VALID_PA 0x0002
222#define CPER_MEM_VALID_PHYSICAL_ADDRESS_MASK 0x0004 222#define CPER_MEM_VALID_PA_MASK 0x0004
223#define CPER_MEM_VALID_NODE 0x0008 223#define CPER_MEM_VALID_NODE 0x0008
224#define CPER_MEM_VALID_CARD 0x0010 224#define CPER_MEM_VALID_CARD 0x0010
225#define CPER_MEM_VALID_MODULE 0x0020 225#define CPER_MEM_VALID_MODULE 0x0020
@@ -232,6 +232,9 @@ enum {
232#define CPER_MEM_VALID_RESPONDER_ID 0x1000 232#define CPER_MEM_VALID_RESPONDER_ID 0x1000
233#define CPER_MEM_VALID_TARGET_ID 0x2000 233#define CPER_MEM_VALID_TARGET_ID 0x2000
234#define CPER_MEM_VALID_ERROR_TYPE 0x4000 234#define CPER_MEM_VALID_ERROR_TYPE 0x4000
235#define CPER_MEM_VALID_RANK_NUMBER 0x8000
236#define CPER_MEM_VALID_CARD_HANDLE 0x10000
237#define CPER_MEM_VALID_MODULE_HANDLE 0x20000
235 238
236#define CPER_PCIE_VALID_PORT_TYPE 0x0001 239#define CPER_PCIE_VALID_PORT_TYPE 0x0001
237#define CPER_PCIE_VALID_VERSION 0x0002 240#define CPER_PCIE_VALID_VERSION 0x0002
@@ -347,6 +350,10 @@ struct cper_sec_mem_err {
347 __u64 responder_id; 350 __u64 responder_id;
348 __u64 target_id; 351 __u64 target_id;
349 __u8 error_type; 352 __u8 error_type;
353 __u8 reserved;
354 __u16 rank;
355 __u16 mem_array_handle; /* card handle in UEFI 2.4 */
356 __u16 mem_dev_handle; /* module handle in UEFI 2.4 */
350}; 357};
351 358
352struct cper_sec_pcie { 359struct cper_sec_pcie {
@@ -389,6 +396,6 @@ struct cper_sec_pcie {
389 396
390u64 cper_next_record_id(void); 397u64 cper_next_record_id(void);
391void cper_print_bits(const char *prefix, unsigned int bits, 398void cper_print_bits(const char *prefix, unsigned int bits,
392 const char *strs[], unsigned int strs_size); 399 const char * const strs[], unsigned int strs_size);
393 400
394#endif 401#endif
diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h
index 263489d0788d..4d0b4d1aa132 100644
--- a/include/linux/debugfs.h
+++ b/include/linux/debugfs.h
@@ -206,6 +206,12 @@ static inline struct dentry *debugfs_create_size_t(const char *name, umode_t mod
206 return ERR_PTR(-ENODEV); 206 return ERR_PTR(-ENODEV);
207} 207}
208 208
209static inline struct dentry *debugfs_create_atomic_t(const char *name, umode_t mode,
210 struct dentry *parent, atomic_t *value)
211{
212 return ERR_PTR(-ENODEV);
213}
214
209static inline struct dentry *debugfs_create_bool(const char *name, umode_t mode, 215static inline struct dentry *debugfs_create_bool(const char *name, umode_t mode,
210 struct dentry *parent, 216 struct dentry *parent,
211 u32 *value) 217 u32 *value)
@@ -227,6 +233,12 @@ static inline struct dentry *debugfs_create_regset32(const char *name,
227 return ERR_PTR(-ENODEV); 233 return ERR_PTR(-ENODEV);
228} 234}
229 235
236static inline int debugfs_print_regs32(struct seq_file *s, const struct debugfs_reg32 *regs,
237 int nregs, void __iomem *base, char *prefix)
238{
239 return 0;
240}
241
230static inline bool debugfs_initialized(void) 242static inline bool debugfs_initialized(void)
231{ 243{
232 return false; 244 return false;
diff --git a/include/linux/device.h b/include/linux/device.h
index 2a9d6ed59579..b025925df7f7 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -26,6 +26,7 @@
26#include <linux/atomic.h> 26#include <linux/atomic.h>
27#include <linux/ratelimit.h> 27#include <linux/ratelimit.h>
28#include <linux/uidgid.h> 28#include <linux/uidgid.h>
29#include <linux/gfp.h>
29#include <asm/device.h> 30#include <asm/device.h>
30 31
31struct device; 32struct device;
@@ -63,9 +64,7 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
63 * @name: The name of the bus. 64 * @name: The name of the bus.
64 * @dev_name: Used for subsystems to enumerate devices like ("foo%u", dev->id). 65 * @dev_name: Used for subsystems to enumerate devices like ("foo%u", dev->id).
65 * @dev_root: Default device to use as the parent. 66 * @dev_root: Default device to use as the parent.
66 * @bus_attrs: Default attributes of the bus.
67 * @dev_attrs: Default attributes of the devices on the bus. 67 * @dev_attrs: Default attributes of the devices on the bus.
68 * @drv_attrs: Default attributes of the device drivers on the bus.
69 * @bus_groups: Default attributes of the bus. 68 * @bus_groups: Default attributes of the bus.
70 * @dev_groups: Default attributes of the devices on the bus. 69 * @dev_groups: Default attributes of the devices on the bus.
71 * @drv_groups: Default attributes of the device drivers on the bus. 70 * @drv_groups: Default attributes of the device drivers on the bus.
@@ -106,9 +105,7 @@ struct bus_type {
106 const char *name; 105 const char *name;
107 const char *dev_name; 106 const char *dev_name;
108 struct device *dev_root; 107 struct device *dev_root;
109 struct bus_attribute *bus_attrs; /* use bus_groups instead */
110 struct device_attribute *dev_attrs; /* use dev_groups instead */ 108 struct device_attribute *dev_attrs; /* use dev_groups instead */
111 struct driver_attribute *drv_attrs; /* use drv_groups instead */
112 const struct attribute_group **bus_groups; 109 const struct attribute_group **bus_groups;
113 const struct attribute_group **dev_groups; 110 const struct attribute_group **dev_groups;
114 const struct attribute_group **drv_groups; 111 const struct attribute_group **drv_groups;
@@ -329,8 +326,6 @@ int subsys_virtual_register(struct bus_type *subsys,
329 * @owner: The module owner. 326 * @owner: The module owner.
330 * @class_attrs: Default attributes of this class. 327 * @class_attrs: Default attributes of this class.
331 * @dev_groups: Default attributes of the devices that belong to the class. 328 * @dev_groups: Default attributes of the devices that belong to the class.
332 * @dev_attrs: Default attributes of the devices belong to the class.
333 * @dev_bin_attrs: Default binary attributes of the devices belong to the class.
334 * @dev_kobj: The kobject that represents this class and links it into the hierarchy. 329 * @dev_kobj: The kobject that represents this class and links it into the hierarchy.
335 * @dev_uevent: Called when a device is added, removed from this class, or a 330 * @dev_uevent: Called when a device is added, removed from this class, or a
336 * few other things that generate uevents to add the environment 331 * few other things that generate uevents to add the environment
@@ -358,9 +353,7 @@ struct class {
358 struct module *owner; 353 struct module *owner;
359 354
360 struct class_attribute *class_attrs; 355 struct class_attribute *class_attrs;
361 struct device_attribute *dev_attrs; /* use dev_groups instead */
362 const struct attribute_group **dev_groups; 356 const struct attribute_group **dev_groups;
363 struct bin_attribute *dev_bin_attrs;
364 struct kobject *dev_kobj; 357 struct kobject *dev_kobj;
365 358
366 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); 359 int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
@@ -427,8 +420,6 @@ struct class_attribute {
427 char *buf); 420 char *buf);
428 ssize_t (*store)(struct class *class, struct class_attribute *attr, 421 ssize_t (*store)(struct class *class, struct class_attribute *attr,
429 const char *buf, size_t count); 422 const char *buf, size_t count);
430 const void *(*namespace)(struct class *class,
431 const struct class_attribute *attr);
432}; 423};
433 424
434#define CLASS_ATTR(_name, _mode, _show, _store) \ 425#define CLASS_ATTR(_name, _mode, _show, _store) \
@@ -438,10 +429,24 @@ struct class_attribute {
438#define CLASS_ATTR_RO(_name) \ 429#define CLASS_ATTR_RO(_name) \
439 struct class_attribute class_attr_##_name = __ATTR_RO(_name) 430 struct class_attribute class_attr_##_name = __ATTR_RO(_name)
440 431
441extern int __must_check class_create_file(struct class *class, 432extern int __must_check class_create_file_ns(struct class *class,
442 const struct class_attribute *attr); 433 const struct class_attribute *attr,
443extern void class_remove_file(struct class *class, 434 const void *ns);
444 const struct class_attribute *attr); 435extern void class_remove_file_ns(struct class *class,
436 const struct class_attribute *attr,
437 const void *ns);
438
439static inline int __must_check class_create_file(struct class *class,
440 const struct class_attribute *attr)
441{
442 return class_create_file_ns(class, attr, NULL);
443}
444
445static inline void class_remove_file(struct class *class,
446 const struct class_attribute *attr)
447{
448 return class_remove_file_ns(class, attr, NULL);
449}
445 450
446/* Simple class attribute that is just a static string */ 451/* Simple class attribute that is just a static string */
447struct class_attribute_string { 452struct class_attribute_string {
@@ -602,8 +607,24 @@ extern void devres_close_group(struct device *dev, void *id);
602extern void devres_remove_group(struct device *dev, void *id); 607extern void devres_remove_group(struct device *dev, void *id);
603extern int devres_release_group(struct device *dev, void *id); 608extern int devres_release_group(struct device *dev, void *id);
604 609
605/* managed kzalloc/kfree for device drivers, no kmalloc, always use kzalloc */ 610/* managed devm_k.alloc/kfree for device drivers */
606extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp); 611extern void *devm_kmalloc(struct device *dev, size_t size, gfp_t gfp);
612static inline void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp)
613{
614 return devm_kmalloc(dev, size, gfp | __GFP_ZERO);
615}
616static inline void *devm_kmalloc_array(struct device *dev,
617 size_t n, size_t size, gfp_t flags)
618{
619 if (size != 0 && n > SIZE_MAX / size)
620 return NULL;
621 return devm_kmalloc(dev, n * size, flags);
622}
623static inline void *devm_kcalloc(struct device *dev,
624 size_t n, size_t size, gfp_t flags)
625{
626 return devm_kmalloc_array(dev, n, size, flags | __GFP_ZERO);
627}
607extern void devm_kfree(struct device *dev, void *p); 628extern void devm_kfree(struct device *dev, void *p);
608 629
609void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res); 630void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res);
@@ -1149,16 +1170,15 @@ do { \
1149#endif 1170#endif
1150 1171
1151/* 1172/*
1152 * dev_WARN*() acts like dev_printk(), but with the key difference 1173 * dev_WARN*() acts like dev_printk(), but with the key difference of
1153 * of using a WARN/WARN_ON to get the message out, including the 1174 * using WARN/WARN_ONCE to include file/line information and a backtrace.
1154 * file/line information and a backtrace.
1155 */ 1175 */
1156#define dev_WARN(dev, format, arg...) \ 1176#define dev_WARN(dev, format, arg...) \
1157 WARN(1, "Device: %s\n" format, dev_driver_string(dev), ## arg); 1177 WARN(1, "%s %s: " format, dev_driver_string(dev), dev_name(dev), ## arg);
1158 1178
1159#define dev_WARN_ONCE(dev, condition, format, arg...) \ 1179#define dev_WARN_ONCE(dev, condition, format, arg...) \
1160 WARN_ONCE(condition, "Device %s\n" format, \ 1180 WARN_ONCE(condition, "%s %s: " format, \
1161 dev_driver_string(dev), ## arg) 1181 dev_driver_string(dev), dev_name(dev), ## arg)
1162 1182
1163/* Create alias, so I can be autoloaded. */ 1183/* Create alias, so I can be autoloaded. */
1164#define MODULE_ALIAS_CHARDEV(major,minor) \ 1184#define MODULE_ALIAS_CHARDEV(major,minor) \
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index b6eb7a05d58e..f820f0a336c9 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -99,6 +99,7 @@ extern const char * dmi_get_system_info(int field);
99extern const struct dmi_device * dmi_find_device(int type, const char *name, 99extern const struct dmi_device * dmi_find_device(int type, const char *name,
100 const struct dmi_device *from); 100 const struct dmi_device *from);
101extern void dmi_scan_machine(void); 101extern void dmi_scan_machine(void);
102extern void dmi_memdev_walk(void);
102extern void dmi_set_dump_stack_arch_desc(void); 103extern void dmi_set_dump_stack_arch_desc(void);
103extern bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp); 104extern bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp);
104extern int dmi_name_in_vendors(const char *str); 105extern int dmi_name_in_vendors(const char *str);
@@ -107,6 +108,7 @@ extern int dmi_available;
107extern int dmi_walk(void (*decode)(const struct dmi_header *, void *), 108extern int dmi_walk(void (*decode)(const struct dmi_header *, void *),
108 void *private_data); 109 void *private_data);
109extern bool dmi_match(enum dmi_field f, const char *str); 110extern bool dmi_match(enum dmi_field f, const char *str);
111extern void dmi_memdev_name(u16 handle, const char **bank, const char **device);
110 112
111#else 113#else
112 114
@@ -115,6 +117,7 @@ static inline const char * dmi_get_system_info(int field) { return NULL; }
115static inline const struct dmi_device * dmi_find_device(int type, const char *name, 117static inline const struct dmi_device * dmi_find_device(int type, const char *name,
116 const struct dmi_device *from) { return NULL; } 118 const struct dmi_device *from) { return NULL; }
117static inline void dmi_scan_machine(void) { return; } 119static inline void dmi_scan_machine(void) { return; }
120static inline void dmi_memdev_walk(void) { }
118static inline void dmi_set_dump_stack_arch_desc(void) { } 121static inline void dmi_set_dump_stack_arch_desc(void) { }
119static inline bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp) 122static inline bool dmi_get_date(int field, int *yearp, int *monthp, int *dayp)
120{ 123{
@@ -133,6 +136,8 @@ static inline int dmi_walk(void (*decode)(const struct dmi_header *, void *),
133 void *private_data) { return -1; } 136 void *private_data) { return -1; }
134static inline bool dmi_match(enum dmi_field f, const char *str) 137static inline bool dmi_match(enum dmi_field f, const char *str)
135 { return false; } 138 { return false; }
139static inline void dmi_memdev_name(u16 handle, const char **bank,
140 const char **device) { }
136static inline const struct dmi_system_id * 141static inline const struct dmi_system_id *
137 dmi_first_match(const struct dmi_system_id *list) { return NULL; } 142 dmi_first_match(const struct dmi_system_id *list) { return NULL; }
138 143
diff --git a/include/linux/edac.h b/include/linux/edac.h
index 5c6d7fbaf89e..dbdffe8d4469 100644
--- a/include/linux/edac.h
+++ b/include/linux/edac.h
@@ -51,7 +51,7 @@ static inline void opstate_init(void)
51#define EDAC_MC_LABEL_LEN 31 51#define EDAC_MC_LABEL_LEN 31
52 52
53/* Maximum size of the location string */ 53/* Maximum size of the location string */
54#define LOCATION_SIZE 80 54#define LOCATION_SIZE 256
55 55
56/* Defines the maximum number of labels that can be reported */ 56/* Defines the maximum number of labels that can be reported */
57#define EDAC_MAX_LABELS 8 57#define EDAC_MAX_LABELS 8
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 5f8f176154f7..bc5687d0f315 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -39,6 +39,8 @@
39typedef unsigned long efi_status_t; 39typedef unsigned long efi_status_t;
40typedef u8 efi_bool_t; 40typedef u8 efi_bool_t;
41typedef u16 efi_char16_t; /* UNICODE character */ 41typedef u16 efi_char16_t; /* UNICODE character */
42typedef u64 efi_physical_addr_t;
43typedef void *efi_handle_t;
42 44
43 45
44typedef struct { 46typedef struct {
@@ -96,6 +98,7 @@ typedef struct {
96#define EFI_MEMORY_DESCRIPTOR_VERSION 1 98#define EFI_MEMORY_DESCRIPTOR_VERSION 1
97 99
98#define EFI_PAGE_SHIFT 12 100#define EFI_PAGE_SHIFT 12
101#define EFI_PAGE_SIZE (1UL << EFI_PAGE_SHIFT)
99 102
100typedef struct { 103typedef struct {
101 u32 type; 104 u32 type;
@@ -157,11 +160,13 @@ typedef struct {
157 efi_table_hdr_t hdr; 160 efi_table_hdr_t hdr;
158 void *raise_tpl; 161 void *raise_tpl;
159 void *restore_tpl; 162 void *restore_tpl;
160 void *allocate_pages; 163 efi_status_t (*allocate_pages)(int, int, unsigned long,
161 void *free_pages; 164 efi_physical_addr_t *);
162 void *get_memory_map; 165 efi_status_t (*free_pages)(efi_physical_addr_t, unsigned long);
163 void *allocate_pool; 166 efi_status_t (*get_memory_map)(unsigned long *, void *, unsigned long *,
164 void *free_pool; 167 unsigned long *, u32 *);
168 efi_status_t (*allocate_pool)(int, unsigned long, void **);
169 efi_status_t (*free_pool)(void *);
165 void *create_event; 170 void *create_event;
166 void *set_timer; 171 void *set_timer;
167 void *wait_for_event; 172 void *wait_for_event;
@@ -171,7 +176,7 @@ typedef struct {
171 void *install_protocol_interface; 176 void *install_protocol_interface;
172 void *reinstall_protocol_interface; 177 void *reinstall_protocol_interface;
173 void *uninstall_protocol_interface; 178 void *uninstall_protocol_interface;
174 void *handle_protocol; 179 efi_status_t (*handle_protocol)(efi_handle_t, efi_guid_t *, void **);
175 void *__reserved; 180 void *__reserved;
176 void *register_protocol_notify; 181 void *register_protocol_notify;
177 void *locate_handle; 182 void *locate_handle;
@@ -181,7 +186,7 @@ typedef struct {
181 void *start_image; 186 void *start_image;
182 void *exit; 187 void *exit;
183 void *unload_image; 188 void *unload_image;
184 void *exit_boot_services; 189 efi_status_t (*exit_boot_services)(efi_handle_t, unsigned long);
185 void *get_next_monotonic_count; 190 void *get_next_monotonic_count;
186 void *stall; 191 void *stall;
187 void *set_watchdog_timer; 192 void *set_watchdog_timer;
@@ -404,6 +409,12 @@ typedef struct {
404 unsigned long table; 409 unsigned long table;
405} efi_config_table_t; 410} efi_config_table_t;
406 411
412typedef struct {
413 efi_guid_t guid;
414 const char *name;
415 unsigned long *ptr;
416} efi_config_table_type_t;
417
407#define EFI_SYSTEM_TABLE_SIGNATURE ((u64)0x5453595320494249ULL) 418#define EFI_SYSTEM_TABLE_SIGNATURE ((u64)0x5453595320494249ULL)
408 419
409#define EFI_2_30_SYSTEM_TABLE_REVISION ((2 << 16) | (30)) 420#define EFI_2_30_SYSTEM_TABLE_REVISION ((2 << 16) | (30))
@@ -488,10 +499,6 @@ typedef struct {
488 unsigned long unload; 499 unsigned long unload;
489} efi_loaded_image_t; 500} efi_loaded_image_t;
490 501
491typedef struct {
492 u64 revision;
493 void *open_volume;
494} efi_file_io_interface_t;
495 502
496typedef struct { 503typedef struct {
497 u64 size; 504 u64 size;
@@ -504,20 +511,30 @@ typedef struct {
504 efi_char16_t filename[1]; 511 efi_char16_t filename[1];
505} efi_file_info_t; 512} efi_file_info_t;
506 513
507typedef struct { 514typedef struct _efi_file_handle {
508 u64 revision; 515 u64 revision;
509 void *open; 516 efi_status_t (*open)(struct _efi_file_handle *,
510 void *close; 517 struct _efi_file_handle **,
518 efi_char16_t *, u64, u64);
519 efi_status_t (*close)(struct _efi_file_handle *);
511 void *delete; 520 void *delete;
512 void *read; 521 efi_status_t (*read)(struct _efi_file_handle *, unsigned long *,
522 void *);
513 void *write; 523 void *write;
514 void *get_position; 524 void *get_position;
515 void *set_position; 525 void *set_position;
516 void *get_info; 526 efi_status_t (*get_info)(struct _efi_file_handle *, efi_guid_t *,
527 unsigned long *, void *);
517 void *set_info; 528 void *set_info;
518 void *flush; 529 void *flush;
519} efi_file_handle_t; 530} efi_file_handle_t;
520 531
532typedef struct _efi_file_io_interface {
533 u64 revision;
534 int (*open_volume)(struct _efi_file_io_interface *,
535 efi_file_handle_t **);
536} efi_file_io_interface_t;
537
521#define EFI_FILE_MODE_READ 0x0000000000000001 538#define EFI_FILE_MODE_READ 0x0000000000000001
522#define EFI_FILE_MODE_WRITE 0x0000000000000002 539#define EFI_FILE_MODE_WRITE 0x0000000000000002
523#define EFI_FILE_MODE_CREATE 0x8000000000000000 540#define EFI_FILE_MODE_CREATE 0x8000000000000000
@@ -552,6 +569,7 @@ extern struct efi {
552 efi_get_next_high_mono_count_t *get_next_high_mono_count; 569 efi_get_next_high_mono_count_t *get_next_high_mono_count;
553 efi_reset_system_t *reset_system; 570 efi_reset_system_t *reset_system;
554 efi_set_virtual_address_map_t *set_virtual_address_map; 571 efi_set_virtual_address_map_t *set_virtual_address_map;
572 struct efi_memory_map *memmap;
555} efi; 573} efi;
556 574
557static inline int 575static inline int
@@ -587,6 +605,7 @@ static inline efi_status_t efi_query_variable_store(u32 attributes, unsigned lon
587} 605}
588#endif 606#endif
589extern void __iomem *efi_lookup_mapped_addr(u64 phys_addr); 607extern void __iomem *efi_lookup_mapped_addr(u64 phys_addr);
608extern int efi_config_init(efi_config_table_type_t *arch_tables);
590extern u64 efi_get_iobase (void); 609extern u64 efi_get_iobase (void);
591extern u32 efi_mem_type (unsigned long phys_addr); 610extern u32 efi_mem_type (unsigned long phys_addr);
592extern u64 efi_mem_attributes (unsigned long phys_addr); 611extern u64 efi_mem_attributes (unsigned long phys_addr);
@@ -784,6 +803,13 @@ struct efivar_entry {
784 struct kobject kobj; 803 struct kobject kobj;
785}; 804};
786 805
806
807struct efi_simple_text_output_protocol {
808 void *reset;
809 efi_status_t (*output_string)(void *, void *);
810 void *test_string;
811};
812
787extern struct list_head efivar_sysfs_list; 813extern struct list_head efivar_sysfs_list;
788 814
789static inline void 815static inline void
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index fcb51c88319f..21c59af1150b 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -51,10 +51,10 @@
51enum extcon_cable_name { 51enum extcon_cable_name {
52 EXTCON_USB = 0, 52 EXTCON_USB = 0,
53 EXTCON_USB_HOST, 53 EXTCON_USB_HOST,
54 EXTCON_TA, /* Travel Adaptor */ 54 EXTCON_TA, /* Travel Adaptor */
55 EXTCON_FAST_CHARGER, 55 EXTCON_FAST_CHARGER,
56 EXTCON_SLOW_CHARGER, 56 EXTCON_SLOW_CHARGER,
57 EXTCON_CHARGE_DOWNSTREAM, /* Charging an external device */ 57 EXTCON_CHARGE_DOWNSTREAM, /* Charging an external device */
58 EXTCON_HDMI, 58 EXTCON_HDMI,
59 EXTCON_MHL, 59 EXTCON_MHL,
60 EXTCON_DVI, 60 EXTCON_DVI,
@@ -76,8 +76,8 @@ struct extcon_cable;
76 76
77/** 77/**
78 * struct extcon_dev - An extcon device represents one external connector. 78 * struct extcon_dev - An extcon device represents one external connector.
79 * @name: The name of this extcon device. Parent device name is used 79 * @name: The name of this extcon device. Parent device name is
80 * if NULL. 80 * used if NULL.
81 * @supported_cable: Array of supported cable names ending with NULL. 81 * @supported_cable: Array of supported cable names ending with NULL.
82 * If supported_cable is NULL, cable name related APIs 82 * If supported_cable is NULL, cable name related APIs
83 * are disabled. 83 * are disabled.
@@ -89,21 +89,21 @@ struct extcon_cable;
89 * be attached simulataneously. {0x7, 0} is equivalent to 89 * be attached simulataneously. {0x7, 0} is equivalent to
90 * {0x3, 0x6, 0x5, 0}. If it is {0xFFFFFFFF, 0}, there 90 * {0x3, 0x6, 0x5, 0}. If it is {0xFFFFFFFF, 0}, there
91 * can be no simultaneous connections. 91 * can be no simultaneous connections.
92 * @print_name: An optional callback to override the method to print the 92 * @print_name: An optional callback to override the method to print the
93 * name of the extcon device. 93 * name of the extcon device.
94 * @print_state: An optional callback to override the method to print the 94 * @print_state: An optional callback to override the method to print the
95 * status of the extcon device. 95 * status of the extcon device.
96 * @dev: Device of this extcon. Do not provide at register-time. 96 * @dev: Device of this extcon.
97 * @state: Attach/detach state of this extcon. Do not provide at 97 * @state: Attach/detach state of this extcon. Do not provide at
98 * register-time 98 * register-time.
99 * @nh: Notifier for the state change events from this extcon 99 * @nh: Notifier for the state change events from this extcon
100 * @entry: To support list of extcon devices so that users can search 100 * @entry: To support list of extcon devices so that users can search
101 * for extcon devices based on the extcon name. 101 * for extcon devices based on the extcon name.
102 * @lock: 102 * @lock:
103 * @max_supported: Internal value to store the number of cables. 103 * @max_supported: Internal value to store the number of cables.
104 * @extcon_dev_type: Device_type struct to provide attribute_groups 104 * @extcon_dev_type: Device_type struct to provide attribute_groups
105 * customized for each extcon device. 105 * customized for each extcon device.
106 * @cables: Sysfs subdirectories. Each represents one cable. 106 * @cables: Sysfs subdirectories. Each represents one cable.
107 * 107 *
108 * In most cases, users only need to provide "User initializing data" of 108 * In most cases, users only need to provide "User initializing data" of
109 * this struct when registering an extcon. In some exceptional cases, 109 * this struct when registering an extcon. In some exceptional cases,
@@ -111,26 +111,27 @@ struct extcon_cable;
111 * are overwritten by register function. 111 * are overwritten by register function.
112 */ 112 */
113struct extcon_dev { 113struct extcon_dev {
114 /* --- Optional user initializing data --- */ 114 /* Optional user initializing data */
115 const char *name; 115 const char *name;
116 const char **supported_cable; 116 const char **supported_cable;
117 const u32 *mutually_exclusive; 117 const u32 *mutually_exclusive;
118 118
119 /* --- Optional callbacks to override class functions --- */ 119 /* Optional callbacks to override class functions */
120 ssize_t (*print_name)(struct extcon_dev *edev, char *buf); 120 ssize_t (*print_name)(struct extcon_dev *edev, char *buf);
121 ssize_t (*print_state)(struct extcon_dev *edev, char *buf); 121 ssize_t (*print_state)(struct extcon_dev *edev, char *buf);
122 122
123 /* --- Internal data. Please do not set. --- */ 123 /* Internal data. Please do not set. */
124 struct device *dev; 124 struct device dev;
125 u32 state;
126 struct raw_notifier_head nh; 125 struct raw_notifier_head nh;
127 struct list_head entry; 126 struct list_head entry;
128 spinlock_t lock; /* could be called by irq handler */
129 int max_supported; 127 int max_supported;
128 spinlock_t lock; /* could be called by irq handler */
129 u32 state;
130 130
131 /* /sys/class/extcon/.../cable.n/... */ 131 /* /sys/class/extcon/.../cable.n/... */
132 struct device_type extcon_dev_type; 132 struct device_type extcon_dev_type;
133 struct extcon_cable *cables; 133 struct extcon_cable *cables;
134
134 /* /sys/class/extcon/.../mutually_exclusive/... */ 135 /* /sys/class/extcon/.../mutually_exclusive/... */
135 struct attribute_group attr_g_muex; 136 struct attribute_group attr_g_muex;
136 struct attribute **attrs_muex; 137 struct attribute **attrs_muex;
@@ -138,13 +139,13 @@ struct extcon_dev {
138}; 139};
139 140
140/** 141/**
141 * struct extcon_cable - An internal data for each cable of extcon device. 142 * struct extcon_cable - An internal data for each cable of extcon device.
142 * @edev: The extcon device 143 * @edev: The extcon device
143 * @cable_index: Index of this cable in the edev 144 * @cable_index: Index of this cable in the edev
144 * @attr_g: Attribute group for the cable 145 * @attr_g: Attribute group for the cable
145 * @attr_name: "name" sysfs entry 146 * @attr_name: "name" sysfs entry
146 * @attr_state: "state" sysfs entry 147 * @attr_state: "state" sysfs entry
147 * @attrs: Array pointing to attr_name and attr_state for attr_g 148 * @attrs: Array pointing to attr_name and attr_state for attr_g
148 */ 149 */
149struct extcon_cable { 150struct extcon_cable {
150 struct extcon_dev *edev; 151 struct extcon_dev *edev;
@@ -159,11 +160,13 @@ struct extcon_cable {
159 160
160/** 161/**
161 * struct extcon_specific_cable_nb - An internal data for 162 * struct extcon_specific_cable_nb - An internal data for
162 * extcon_register_interest(). 163 * extcon_register_interest().
163 * @internal_nb: a notifier block bridging extcon notifier and cable notifier. 164 * @internal_nb: A notifier block bridging extcon notifier
164 * @user_nb: user provided notifier block for events from a specific cable. 165 * and cable notifier.
166 * @user_nb: user provided notifier block for events from
167 * a specific cable.
165 * @cable_index: the target cable. 168 * @cable_index: the target cable.
166 * @edev: the target extcon device. 169 * @edev: the target extcon device.
167 * @previous_value: the saved previous event value. 170 * @previous_value: the saved previous event value.
168 */ 171 */
169struct extcon_specific_cable_nb { 172struct extcon_specific_cable_nb {
@@ -180,7 +183,7 @@ struct extcon_specific_cable_nb {
180 * Following APIs are for notifiers or configurations. 183 * Following APIs are for notifiers or configurations.
181 * Notifiers are the external port and connection devices. 184 * Notifiers are the external port and connection devices.
182 */ 185 */
183extern int extcon_dev_register(struct extcon_dev *edev, struct device *dev); 186extern int extcon_dev_register(struct extcon_dev *edev);
184extern void extcon_dev_unregister(struct extcon_dev *edev); 187extern void extcon_dev_unregister(struct extcon_dev *edev);
185extern struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name); 188extern struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name);
186 189
@@ -238,8 +241,7 @@ extern int extcon_register_notifier(struct extcon_dev *edev,
238extern int extcon_unregister_notifier(struct extcon_dev *edev, 241extern int extcon_unregister_notifier(struct extcon_dev *edev,
239 struct notifier_block *nb); 242 struct notifier_block *nb);
240#else /* CONFIG_EXTCON */ 243#else /* CONFIG_EXTCON */
241static inline int extcon_dev_register(struct extcon_dev *edev, 244static inline int extcon_dev_register(struct extcon_dev *edev)
242 struct device *dev)
243{ 245{
244 return 0; 246 return 0;
245} 247}
diff --git a/include/linux/extcon/extcon-adc-jack.h b/include/linux/extcon/extcon-adc-jack.h
index 20e9eef25d4c..9ca958c4e94c 100644
--- a/include/linux/extcon/extcon-adc-jack.h
+++ b/include/linux/extcon/extcon-adc-jack.h
@@ -20,10 +20,10 @@
20 20
21/** 21/**
22 * struct adc_jack_cond - condition to use an extcon state 22 * struct adc_jack_cond - condition to use an extcon state
23 * @state - the corresponding extcon state (if 0, this struct denotes 23 * @state: the corresponding extcon state (if 0, this struct
24 * the last adc_jack_cond element among the array) 24 * denotes the last adc_jack_cond element among the array)
25 * @min_adc - min adc value for this condition 25 * @min_adc: min adc value for this condition
26 * @max_adc - max adc value for this condition 26 * @max_adc: max adc value for this condition
27 * 27 *
28 * For example, if { .state = 0x3, .min_adc = 100, .max_adc = 200}, it means 28 * For example, if { .state = 0x3, .min_adc = 100, .max_adc = 200}, it means
29 * that if ADC value is between (inclusive) 100 and 200, than the cable 0 and 29 * that if ADC value is between (inclusive) 100 and 200, than the cable 0 and
@@ -33,34 +33,34 @@
33 * because when no adc_jack_cond is met, state = 0 is automatically chosen. 33 * because when no adc_jack_cond is met, state = 0 is automatically chosen.
34 */ 34 */
35struct adc_jack_cond { 35struct adc_jack_cond {
36 u32 state; /* extcon state value. 0 if invalid */ 36 u32 state; /* extcon state value. 0 if invalid */
37 u32 min_adc; 37 u32 min_adc;
38 u32 max_adc; 38 u32 max_adc;
39}; 39};
40 40
41/** 41/**
42 * struct adc_jack_pdata - platform data for adc jack device. 42 * struct adc_jack_pdata - platform data for adc jack device.
43 * @name - name of the extcon device. If null, "adc-jack" is used. 43 * @name: name of the extcon device. If null, "adc-jack" is used.
44 * @consumer_channel - Unique name to identify the channel on the consumer 44 * @consumer_channel: Unique name to identify the channel on the consumer
45 * side. This typically describes the channels used within 45 * side. This typically describes the channels used within
46 * the consumer. E.g. 'battery_voltage' 46 * the consumer. E.g. 'battery_voltage'
47 * @cable_names - array of cable names ending with null. 47 * @cable_names: array of cable names ending with null.
48 * @adc_contitions - array of struct adc_jack_cond conditions ending 48 * @adc_contitions: array of struct adc_jack_cond conditions ending
49 * with .state = 0 entry. This describes how to decode 49 * with .state = 0 entry. This describes how to decode
50 * adc values into extcon state. 50 * adc values into extcon state.
51 * @irq_flags - irq flags used for the @irq 51 * @irq_flags: irq flags used for the @irq
52 * @handling_delay_ms - in some devices, we need to read ADC value some 52 * @handling_delay_ms: in some devices, we need to read ADC value some
53 * milli-seconds after the interrupt occurs. You may 53 * milli-seconds after the interrupt occurs. You may
54 * describe such delays with @handling_delay_ms, which 54 * describe such delays with @handling_delay_ms, which
55 * is rounded-off by jiffies. 55 * is rounded-off by jiffies.
56 */ 56 */
57struct adc_jack_pdata { 57struct adc_jack_pdata {
58 const char *name; 58 const char *name;
59 const char *consumer_channel; 59 const char *consumer_channel;
60 /* 60
61 * The last entry should be NULL 61 /* The last entry should be NULL */
62 */
63 const char **cable_names; 62 const char **cable_names;
63
64 /* The last entry's state should be 0 */ 64 /* The last entry's state should be 0 */
65 struct adc_jack_cond *adc_conditions; 65 struct adc_jack_cond *adc_conditions;
66 66
diff --git a/include/linux/extcon/extcon-gpio.h b/include/linux/extcon/extcon-gpio.h
index 2d8307f7d67d..4195810f87fe 100644
--- a/include/linux/extcon/extcon-gpio.h
+++ b/include/linux/extcon/extcon-gpio.h
@@ -25,14 +25,17 @@
25 25
26/** 26/**
27 * struct gpio_extcon_platform_data - A simple GPIO-controlled extcon device. 27 * struct gpio_extcon_platform_data - A simple GPIO-controlled extcon device.
28 * @name The name of this GPIO extcon device. 28 * @name: The name of this GPIO extcon device.
29 * @gpio Corresponding GPIO. 29 * @gpio: Corresponding GPIO.
30 * @debounce Debounce time for GPIO IRQ in ms. 30 * @gpio_active_low: Boolean describing whether gpio active state is 1 or 0
31 * @irq_flags IRQ Flags (e.g., IRQF_TRIGGER_LOW). 31 * If true, low state of gpio means active.
32 * @state_on print_state is overriden with state_on if attached. If Null, 32 * If false, high state of gpio means active.
33 * default method of extcon class is used. 33 * @debounce: Debounce time for GPIO IRQ in ms.
34 * @state_off print_state is overriden with state_on if detached. If Null, 34 * @irq_flags: IRQ Flags (e.g., IRQF_TRIGGER_LOW).
35 * default method of extcon class is used. 35 * @state_on: print_state is overriden with state_on if attached.
36 * If NULL, default method of extcon class is used.
37 * @state_off: print_state is overriden with state_on if detached.
38 * If NUll, default method of extcon class is used.
36 * 39 *
37 * Note that in order for state_on or state_off to be valid, both state_on 40 * Note that in order for state_on or state_off to be valid, both state_on
38 * and state_off should be not NULL. If at least one of them is NULL, 41 * and state_off should be not NULL. If at least one of them is NULL,
@@ -41,6 +44,7 @@
41struct gpio_extcon_platform_data { 44struct gpio_extcon_platform_data {
42 const char *name; 45 const char *name;
43 unsigned gpio; 46 unsigned gpio;
47 bool gpio_active_low;
44 unsigned long debounce; 48 unsigned long debounce;
45 unsigned long irq_flags; 49 unsigned long irq_flags;
46 50
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 3f40547ba191..955dff5da56a 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2292,6 +2292,11 @@ static inline void allow_write_access(struct file *file)
2292 if (file) 2292 if (file)
2293 atomic_inc(&file_inode(file)->i_writecount); 2293 atomic_inc(&file_inode(file)->i_writecount);
2294} 2294}
2295static inline bool inode_is_open_for_write(const struct inode *inode)
2296{
2297 return atomic_read(&inode->i_writecount) > 0;
2298}
2299
2295#ifdef CONFIG_IMA 2300#ifdef CONFIG_IMA
2296static inline void i_readcount_dec(struct inode *inode) 2301static inline void i_readcount_dec(struct inode *inode)
2297{ 2302{
diff --git a/include/linux/fscache-cache.h b/include/linux/fscache-cache.h
index 7823e9ef995e..771484993ca7 100644
--- a/include/linux/fscache-cache.h
+++ b/include/linux/fscache-cache.h
@@ -308,36 +308,6 @@ struct fscache_cache_ops {
308 void (*dissociate_pages)(struct fscache_cache *cache); 308 void (*dissociate_pages)(struct fscache_cache *cache);
309}; 309};
310 310
311/*
312 * data file or index object cookie
313 * - a file will only appear in one cache
314 * - a request to cache a file may or may not be honoured, subject to
315 * constraints such as disk space
316 * - indices are created on disk just-in-time
317 */
318struct fscache_cookie {
319 atomic_t usage; /* number of users of this cookie */
320 atomic_t n_children; /* number of children of this cookie */
321 atomic_t n_active; /* number of active users of netfs ptrs */
322 spinlock_t lock;
323 spinlock_t stores_lock; /* lock on page store tree */
324 struct hlist_head backing_objects; /* object(s) backing this file/index */
325 const struct fscache_cookie_def *def; /* definition */
326 struct fscache_cookie *parent; /* parent of this entry */
327 void *netfs_data; /* back pointer to netfs */
328 struct radix_tree_root stores; /* pages to be stored on this cookie */
329#define FSCACHE_COOKIE_PENDING_TAG 0 /* pages tag: pending write to cache */
330#define FSCACHE_COOKIE_STORING_TAG 1 /* pages tag: writing to cache */
331
332 unsigned long flags;
333#define FSCACHE_COOKIE_LOOKING_UP 0 /* T if non-index cookie being looked up still */
334#define FSCACHE_COOKIE_NO_DATA_YET 1 /* T if new object with no cached data yet */
335#define FSCACHE_COOKIE_UNAVAILABLE 2 /* T if cookie is unavailable (error, etc) */
336#define FSCACHE_COOKIE_INVALIDATING 3 /* T if cookie is being invalidated */
337#define FSCACHE_COOKIE_RELINQUISHED 4 /* T if cookie has been relinquished */
338#define FSCACHE_COOKIE_RETIRED 5 /* T if cookie was retired */
339};
340
341extern struct fscache_cookie fscache_fsdef_index; 311extern struct fscache_cookie fscache_fsdef_index;
342 312
343/* 313/*
@@ -400,6 +370,7 @@ struct fscache_object {
400#define FSCACHE_OBJECT_IS_LIVE 3 /* T if object is not withdrawn or relinquished */ 370#define FSCACHE_OBJECT_IS_LIVE 3 /* T if object is not withdrawn or relinquished */
401#define FSCACHE_OBJECT_IS_LOOKED_UP 4 /* T if object has been looked up */ 371#define FSCACHE_OBJECT_IS_LOOKED_UP 4 /* T if object has been looked up */
402#define FSCACHE_OBJECT_IS_AVAILABLE 5 /* T if object has become active */ 372#define FSCACHE_OBJECT_IS_AVAILABLE 5 /* T if object has become active */
373#define FSCACHE_OBJECT_RETIRED 6 /* T if object was retired on relinquishment */
403 374
404 struct list_head cache_link; /* link in cache->object_list */ 375 struct list_head cache_link; /* link in cache->object_list */
405 struct hlist_node cookie_link; /* link in cookie->backing_objects */ 376 struct hlist_node cookie_link; /* link in cookie->backing_objects */
@@ -511,6 +482,11 @@ static inline void fscache_end_io(struct fscache_retrieval *op,
511 op->end_io_func(page, op->context, error); 482 op->end_io_func(page, op->context, error);
512} 483}
513 484
485static inline void __fscache_use_cookie(struct fscache_cookie *cookie)
486{
487 atomic_inc(&cookie->n_active);
488}
489
514/** 490/**
515 * fscache_use_cookie - Request usage of cookie attached to an object 491 * fscache_use_cookie - Request usage of cookie attached to an object
516 * @object: Object description 492 * @object: Object description
@@ -524,6 +500,16 @@ static inline bool fscache_use_cookie(struct fscache_object *object)
524 return atomic_inc_not_zero(&cookie->n_active) != 0; 500 return atomic_inc_not_zero(&cookie->n_active) != 0;
525} 501}
526 502
503static inline bool __fscache_unuse_cookie(struct fscache_cookie *cookie)
504{
505 return atomic_dec_and_test(&cookie->n_active);
506}
507
508static inline void __fscache_wake_unused_cookie(struct fscache_cookie *cookie)
509{
510 wake_up_atomic_t(&cookie->n_active);
511}
512
527/** 513/**
528 * fscache_unuse_cookie - Cease usage of cookie attached to an object 514 * fscache_unuse_cookie - Cease usage of cookie attached to an object
529 * @object: Object description 515 * @object: Object description
@@ -534,8 +520,8 @@ static inline bool fscache_use_cookie(struct fscache_object *object)
534static inline void fscache_unuse_cookie(struct fscache_object *object) 520static inline void fscache_unuse_cookie(struct fscache_object *object)
535{ 521{
536 struct fscache_cookie *cookie = object->cookie; 522 struct fscache_cookie *cookie = object->cookie;
537 if (atomic_dec_and_test(&cookie->n_active)) 523 if (__fscache_unuse_cookie(cookie))
538 wake_up_atomic_t(&cookie->n_active); 524 __fscache_wake_unused_cookie(cookie);
539} 525}
540 526
541/* 527/*
diff --git a/include/linux/fscache.h b/include/linux/fscache.h
index 19b46458e4e8..115bb81912cc 100644
--- a/include/linux/fscache.h
+++ b/include/linux/fscache.h
@@ -167,6 +167,42 @@ struct fscache_netfs {
167}; 167};
168 168
169/* 169/*
170 * data file or index object cookie
171 * - a file will only appear in one cache
172 * - a request to cache a file may or may not be honoured, subject to
173 * constraints such as disk space
174 * - indices are created on disk just-in-time
175 */
176struct fscache_cookie {
177 atomic_t usage; /* number of users of this cookie */
178 atomic_t n_children; /* number of children of this cookie */
179 atomic_t n_active; /* number of active users of netfs ptrs */
180 spinlock_t lock;
181 spinlock_t stores_lock; /* lock on page store tree */
182 struct hlist_head backing_objects; /* object(s) backing this file/index */
183 const struct fscache_cookie_def *def; /* definition */
184 struct fscache_cookie *parent; /* parent of this entry */
185 void *netfs_data; /* back pointer to netfs */
186 struct radix_tree_root stores; /* pages to be stored on this cookie */
187#define FSCACHE_COOKIE_PENDING_TAG 0 /* pages tag: pending write to cache */
188#define FSCACHE_COOKIE_STORING_TAG 1 /* pages tag: writing to cache */
189
190 unsigned long flags;
191#define FSCACHE_COOKIE_LOOKING_UP 0 /* T if non-index cookie being looked up still */
192#define FSCACHE_COOKIE_NO_DATA_YET 1 /* T if new object with no cached data yet */
193#define FSCACHE_COOKIE_UNAVAILABLE 2 /* T if cookie is unavailable (error, etc) */
194#define FSCACHE_COOKIE_INVALIDATING 3 /* T if cookie is being invalidated */
195#define FSCACHE_COOKIE_RELINQUISHED 4 /* T if cookie has been relinquished */
196#define FSCACHE_COOKIE_ENABLED 5 /* T if cookie is enabled */
197#define FSCACHE_COOKIE_ENABLEMENT_LOCK 6 /* T if cookie is being en/disabled */
198};
199
200static inline bool fscache_cookie_enabled(struct fscache_cookie *cookie)
201{
202 return test_bit(FSCACHE_COOKIE_ENABLED, &cookie->flags);
203}
204
205/*
170 * slow-path functions for when there is actually caching available, and the 206 * slow-path functions for when there is actually caching available, and the
171 * netfs does actually have a valid token 207 * netfs does actually have a valid token
172 * - these are not to be called directly 208 * - these are not to be called directly
@@ -181,8 +217,8 @@ extern void __fscache_release_cache_tag(struct fscache_cache_tag *);
181extern struct fscache_cookie *__fscache_acquire_cookie( 217extern struct fscache_cookie *__fscache_acquire_cookie(
182 struct fscache_cookie *, 218 struct fscache_cookie *,
183 const struct fscache_cookie_def *, 219 const struct fscache_cookie_def *,
184 void *); 220 void *, bool);
185extern void __fscache_relinquish_cookie(struct fscache_cookie *, int); 221extern void __fscache_relinquish_cookie(struct fscache_cookie *, bool);
186extern int __fscache_check_consistency(struct fscache_cookie *); 222extern int __fscache_check_consistency(struct fscache_cookie *);
187extern void __fscache_update_cookie(struct fscache_cookie *); 223extern void __fscache_update_cookie(struct fscache_cookie *);
188extern int __fscache_attr_changed(struct fscache_cookie *); 224extern int __fscache_attr_changed(struct fscache_cookie *);
@@ -211,6 +247,9 @@ extern void __fscache_uncache_all_inode_pages(struct fscache_cookie *,
211 struct inode *); 247 struct inode *);
212extern void __fscache_readpages_cancel(struct fscache_cookie *cookie, 248extern void __fscache_readpages_cancel(struct fscache_cookie *cookie,
213 struct list_head *pages); 249 struct list_head *pages);
250extern void __fscache_disable_cookie(struct fscache_cookie *, bool);
251extern void __fscache_enable_cookie(struct fscache_cookie *,
252 bool (*)(void *), void *);
214 253
215/** 254/**
216 * fscache_register_netfs - Register a filesystem as desiring caching services 255 * fscache_register_netfs - Register a filesystem as desiring caching services
@@ -289,6 +328,7 @@ void fscache_release_cache_tag(struct fscache_cache_tag *tag)
289 * @def: A description of the cache object, including callback operations 328 * @def: A description of the cache object, including callback operations
290 * @netfs_data: An arbitrary piece of data to be kept in the cookie to 329 * @netfs_data: An arbitrary piece of data to be kept in the cookie to
291 * represent the cache object to the netfs 330 * represent the cache object to the netfs
331 * @enable: Whether or not to enable a data cookie immediately
292 * 332 *
293 * This function is used to inform FS-Cache about part of an index hierarchy 333 * This function is used to inform FS-Cache about part of an index hierarchy
294 * that can be used to locate files. This is done by requesting a cookie for 334 * that can be used to locate files. This is done by requesting a cookie for
@@ -301,10 +341,12 @@ static inline
301struct fscache_cookie *fscache_acquire_cookie( 341struct fscache_cookie *fscache_acquire_cookie(
302 struct fscache_cookie *parent, 342 struct fscache_cookie *parent,
303 const struct fscache_cookie_def *def, 343 const struct fscache_cookie_def *def,
304 void *netfs_data) 344 void *netfs_data,
345 bool enable)
305{ 346{
306 if (fscache_cookie_valid(parent)) 347 if (fscache_cookie_valid(parent) && fscache_cookie_enabled(parent))
307 return __fscache_acquire_cookie(parent, def, netfs_data); 348 return __fscache_acquire_cookie(parent, def, netfs_data,
349 enable);
308 else 350 else
309 return NULL; 351 return NULL;
310} 352}
@@ -322,7 +364,7 @@ struct fscache_cookie *fscache_acquire_cookie(
322 * description. 364 * description.
323 */ 365 */
324static inline 366static inline
325void fscache_relinquish_cookie(struct fscache_cookie *cookie, int retire) 367void fscache_relinquish_cookie(struct fscache_cookie *cookie, bool retire)
326{ 368{
327 if (fscache_cookie_valid(cookie)) 369 if (fscache_cookie_valid(cookie))
328 __fscache_relinquish_cookie(cookie, retire); 370 __fscache_relinquish_cookie(cookie, retire);
@@ -341,7 +383,7 @@ void fscache_relinquish_cookie(struct fscache_cookie *cookie, int retire)
341static inline 383static inline
342int fscache_check_consistency(struct fscache_cookie *cookie) 384int fscache_check_consistency(struct fscache_cookie *cookie)
343{ 385{
344 if (fscache_cookie_valid(cookie)) 386 if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie))
345 return __fscache_check_consistency(cookie); 387 return __fscache_check_consistency(cookie);
346 else 388 else
347 return 0; 389 return 0;
@@ -360,7 +402,7 @@ int fscache_check_consistency(struct fscache_cookie *cookie)
360static inline 402static inline
361void fscache_update_cookie(struct fscache_cookie *cookie) 403void fscache_update_cookie(struct fscache_cookie *cookie)
362{ 404{
363 if (fscache_cookie_valid(cookie)) 405 if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie))
364 __fscache_update_cookie(cookie); 406 __fscache_update_cookie(cookie);
365} 407}
366 408
@@ -407,7 +449,7 @@ void fscache_unpin_cookie(struct fscache_cookie *cookie)
407static inline 449static inline
408int fscache_attr_changed(struct fscache_cookie *cookie) 450int fscache_attr_changed(struct fscache_cookie *cookie)
409{ 451{
410 if (fscache_cookie_valid(cookie)) 452 if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie))
411 return __fscache_attr_changed(cookie); 453 return __fscache_attr_changed(cookie);
412 else 454 else
413 return -ENOBUFS; 455 return -ENOBUFS;
@@ -429,7 +471,7 @@ int fscache_attr_changed(struct fscache_cookie *cookie)
429static inline 471static inline
430void fscache_invalidate(struct fscache_cookie *cookie) 472void fscache_invalidate(struct fscache_cookie *cookie)
431{ 473{
432 if (fscache_cookie_valid(cookie)) 474 if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie))
433 __fscache_invalidate(cookie); 475 __fscache_invalidate(cookie);
434} 476}
435 477
@@ -503,7 +545,7 @@ int fscache_read_or_alloc_page(struct fscache_cookie *cookie,
503 void *context, 545 void *context,
504 gfp_t gfp) 546 gfp_t gfp)
505{ 547{
506 if (fscache_cookie_valid(cookie)) 548 if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie))
507 return __fscache_read_or_alloc_page(cookie, page, end_io_func, 549 return __fscache_read_or_alloc_page(cookie, page, end_io_func,
508 context, gfp); 550 context, gfp);
509 else 551 else
@@ -554,7 +596,7 @@ int fscache_read_or_alloc_pages(struct fscache_cookie *cookie,
554 void *context, 596 void *context,
555 gfp_t gfp) 597 gfp_t gfp)
556{ 598{
557 if (fscache_cookie_valid(cookie)) 599 if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie))
558 return __fscache_read_or_alloc_pages(cookie, mapping, pages, 600 return __fscache_read_or_alloc_pages(cookie, mapping, pages,
559 nr_pages, end_io_func, 601 nr_pages, end_io_func,
560 context, gfp); 602 context, gfp);
@@ -585,7 +627,7 @@ int fscache_alloc_page(struct fscache_cookie *cookie,
585 struct page *page, 627 struct page *page,
586 gfp_t gfp) 628 gfp_t gfp)
587{ 629{
588 if (fscache_cookie_valid(cookie)) 630 if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie))
589 return __fscache_alloc_page(cookie, page, gfp); 631 return __fscache_alloc_page(cookie, page, gfp);
590 else 632 else
591 return -ENOBUFS; 633 return -ENOBUFS;
@@ -634,7 +676,7 @@ int fscache_write_page(struct fscache_cookie *cookie,
634 struct page *page, 676 struct page *page,
635 gfp_t gfp) 677 gfp_t gfp)
636{ 678{
637 if (fscache_cookie_valid(cookie)) 679 if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie))
638 return __fscache_write_page(cookie, page, gfp); 680 return __fscache_write_page(cookie, page, gfp);
639 else 681 else
640 return -ENOBUFS; 682 return -ENOBUFS;
@@ -744,4 +786,47 @@ void fscache_uncache_all_inode_pages(struct fscache_cookie *cookie,
744 __fscache_uncache_all_inode_pages(cookie, inode); 786 __fscache_uncache_all_inode_pages(cookie, inode);
745} 787}
746 788
789/**
790 * fscache_disable_cookie - Disable a cookie
791 * @cookie: The cookie representing the cache object
792 * @invalidate: Invalidate the backing object
793 *
794 * Disable a cookie from accepting further alloc, read, write, invalidate,
795 * update or acquire operations. Outstanding operations can still be waited
796 * upon and pages can still be uncached and the cookie relinquished.
797 *
798 * This will not return until all outstanding operations have completed.
799 *
800 * If @invalidate is set, then the backing object will be invalidated and
801 * detached, otherwise it will just be detached.
802 */
803static inline
804void fscache_disable_cookie(struct fscache_cookie *cookie, bool invalidate)
805{
806 if (fscache_cookie_valid(cookie) && fscache_cookie_enabled(cookie))
807 __fscache_disable_cookie(cookie, invalidate);
808}
809
810/**
811 * fscache_enable_cookie - Reenable a cookie
812 * @cookie: The cookie representing the cache object
813 * @can_enable: A function to permit enablement once lock is held
814 * @data: Data for can_enable()
815 *
816 * Reenable a previously disabled cookie, allowing it to accept further alloc,
817 * read, write, invalidate, update or acquire operations. An attempt will be
818 * made to immediately reattach the cookie to a backing object.
819 *
820 * The can_enable() function is called (if not NULL) once the enablement lock
821 * is held to rule on whether enablement is still permitted to go ahead.
822 */
823static inline
824void fscache_enable_cookie(struct fscache_cookie *cookie,
825 bool (*can_enable)(void *data),
826 void *data)
827{
828 if (fscache_cookie_valid(cookie) && !fscache_cookie_enabled(cookie))
829 __fscache_enable_cookie(cookie, can_enable, data);
830}
831
747#endif /* _LINUX_FSCACHE_H */ 832#endif /* _LINUX_FSCACHE_H */
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index 1e041063b226..d9cf963ac832 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -33,7 +33,7 @@ extern void rcu_nmi_exit(void);
33#define __irq_enter() \ 33#define __irq_enter() \
34 do { \ 34 do { \
35 account_irq_enter_time(current); \ 35 account_irq_enter_time(current); \
36 add_preempt_count(HARDIRQ_OFFSET); \ 36 preempt_count_add(HARDIRQ_OFFSET); \
37 trace_hardirq_enter(); \ 37 trace_hardirq_enter(); \
38 } while (0) 38 } while (0)
39 39
@@ -49,7 +49,7 @@ extern void irq_enter(void);
49 do { \ 49 do { \
50 trace_hardirq_exit(); \ 50 trace_hardirq_exit(); \
51 account_irq_exit_time(current); \ 51 account_irq_exit_time(current); \
52 sub_preempt_count(HARDIRQ_OFFSET); \ 52 preempt_count_sub(HARDIRQ_OFFSET); \
53 } while (0) 53 } while (0)
54 54
55/* 55/*
@@ -62,7 +62,7 @@ extern void irq_exit(void);
62 lockdep_off(); \ 62 lockdep_off(); \
63 ftrace_nmi_enter(); \ 63 ftrace_nmi_enter(); \
64 BUG_ON(in_nmi()); \ 64 BUG_ON(in_nmi()); \
65 add_preempt_count(NMI_OFFSET + HARDIRQ_OFFSET); \ 65 preempt_count_add(NMI_OFFSET + HARDIRQ_OFFSET); \
66 rcu_nmi_enter(); \ 66 rcu_nmi_enter(); \
67 trace_hardirq_enter(); \ 67 trace_hardirq_enter(); \
68 } while (0) 68 } while (0)
@@ -72,7 +72,7 @@ extern void irq_exit(void);
72 trace_hardirq_exit(); \ 72 trace_hardirq_exit(); \
73 rcu_nmi_exit(); \ 73 rcu_nmi_exit(); \
74 BUG_ON(!in_nmi()); \ 74 BUG_ON(!in_nmi()); \
75 sub_preempt_count(NMI_OFFSET + HARDIRQ_OFFSET); \ 75 preempt_count_sub(NMI_OFFSET + HARDIRQ_OFFSET); \
76 ftrace_nmi_exit(); \ 76 ftrace_nmi_exit(); \
77 lockdep_on(); \ 77 lockdep_on(); \
78 } while (0) 78 } while (0)
diff --git a/include/linux/hashtable.h b/include/linux/hashtable.h
index a9df51f5d54c..519b6e2d769e 100644
--- a/include/linux/hashtable.h
+++ b/include/linux/hashtable.h
@@ -174,6 +174,21 @@ static inline void hash_del_rcu(struct hlist_node *node)
174 member) 174 member)
175 175
176/** 176/**
177 * hash_for_each_possible_rcu_notrace - iterate over all possible objects hashing
178 * to the same bucket in an rcu enabled hashtable in a rcu enabled hashtable
179 * @name: hashtable to iterate
180 * @obj: the type * to use as a loop cursor for each entry
181 * @member: the name of the hlist_node within the struct
182 * @key: the key of the objects to iterate over
183 *
184 * This is the same as hash_for_each_possible_rcu() except that it does
185 * not do any RCU debugging or tracing.
186 */
187#define hash_for_each_possible_rcu_notrace(name, obj, member, key) \
188 hlist_for_each_entry_rcu_notrace(obj, \
189 &name[hash_min(key, HASH_BITS(name))], member)
190
191/**
177 * hash_for_each_possible_safe - iterate over all possible objects hashing to the 192 * hash_for_each_possible_safe - iterate over all possible objects hashing to the
178 * same bucket safe against removals 193 * same bucket safe against removals
179 * @name: hashtable to iterate 194 * @name: hashtable to iterate
diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h
index 32ba45158d39..a265af294ea4 100644
--- a/include/linux/hid-sensor-hub.h
+++ b/include/linux/hid-sensor-hub.h
@@ -47,11 +47,13 @@ struct hid_sensor_hub_attribute_info {
47 * @hdev: Stores the hid instance. 47 * @hdev: Stores the hid instance.
48 * @vendor_id: Vendor id of hub device. 48 * @vendor_id: Vendor id of hub device.
49 * @product_id: Product id of hub device. 49 * @product_id: Product id of hub device.
50 * @ref_cnt: Number of MFD clients have opened this device
50 */ 51 */
51struct hid_sensor_hub_device { 52struct hid_sensor_hub_device {
52 struct hid_device *hdev; 53 struct hid_device *hdev;
53 u32 vendor_id; 54 u32 vendor_id;
54 u32 product_id; 55 u32 product_id;
56 int ref_cnt;
55}; 57};
56 58
57/** 59/**
@@ -74,6 +76,22 @@ struct hid_sensor_hub_callbacks {
74 void *priv); 76 void *priv);
75}; 77};
76 78
79/**
80* sensor_hub_device_open() - Open hub device
81* @hsdev: Hub device instance.
82*
83* Used to open hid device for sensor hub.
84*/
85int sensor_hub_device_open(struct hid_sensor_hub_device *hsdev);
86
87/**
88* sensor_hub_device_clode() - Close hub device
89* @hsdev: Hub device instance.
90*
91* Used to clode hid device for sensor hub.
92*/
93void sensor_hub_device_close(struct hid_sensor_hub_device *hsdev);
94
77/* Registration functions */ 95/* Registration functions */
78 96
79/** 97/**
diff --git a/include/linux/hwmon-vid.h b/include/linux/hwmon-vid.h
index f346e4d5381c..da0a680e2f6d 100644
--- a/include/linux/hwmon-vid.h
+++ b/include/linux/hwmon-vid.h
@@ -38,7 +38,7 @@ static inline int vid_to_reg(int val, u8 vrm)
38 return ((val >= 1100) && (val <= 1850) ? 38 return ((val >= 1100) && (val <= 1850) ?
39 ((18499 - val * 10) / 25 + 5) / 10 : -1); 39 ((18499 - val * 10) / 25 + 5) / 10 : -1);
40 default: 40 default:
41 return -1; 41 return -EINVAL;
42 } 42 }
43} 43}
44 44
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index b2514f70d591..09354f6c1d63 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -15,9 +15,19 @@
15#define _HWMON_H_ 15#define _HWMON_H_
16 16
17struct device; 17struct device;
18struct attribute_group;
18 19
19struct device *hwmon_device_register(struct device *dev); 20struct device *hwmon_device_register(struct device *dev);
21struct device *
22hwmon_device_register_with_groups(struct device *dev, const char *name,
23 void *drvdata,
24 const struct attribute_group **groups);
25struct device *
26devm_hwmon_device_register_with_groups(struct device *dev, const char *name,
27 void *drvdata,
28 const struct attribute_group **groups);
20 29
21void hwmon_device_unregister(struct device *dev); 30void hwmon_device_unregister(struct device *dev);
31void devm_hwmon_device_unregister(struct device *dev);
22 32
23#endif 33#endif
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h
index d98503bde7e9..15da677478dd 100644
--- a/include/linux/hyperv.h
+++ b/include/linux/hyperv.h
@@ -432,15 +432,6 @@ struct hv_ring_buffer_info {
432 u32 ring_data_startoffset; 432 u32 ring_data_startoffset;
433}; 433};
434 434
435struct hv_ring_buffer_debug_info {
436 u32 current_interrupt_mask;
437 u32 current_read_index;
438 u32 current_write_index;
439 u32 bytes_avail_toread;
440 u32 bytes_avail_towrite;
441};
442
443
444/* 435/*
445 * 436 *
446 * hv_get_ringbuffer_availbytes() 437 * hv_get_ringbuffer_availbytes()
@@ -902,23 +893,6 @@ enum vmbus_channel_state {
902 CHANNEL_OPENED_STATE, 893 CHANNEL_OPENED_STATE,
903}; 894};
904 895
905struct vmbus_channel_debug_info {
906 u32 relid;
907 enum vmbus_channel_state state;
908 uuid_le interfacetype;
909 uuid_le interface_instance;
910 u32 monitorid;
911 u32 servermonitor_pending;
912 u32 servermonitor_latency;
913 u32 servermonitor_connectionid;
914 u32 clientmonitor_pending;
915 u32 clientmonitor_latency;
916 u32 clientmonitor_connectionid;
917
918 struct hv_ring_buffer_debug_info inbound;
919 struct hv_ring_buffer_debug_info outbound;
920};
921
922/* 896/*
923 * Represents each channel msg on the vmbus connection This is a 897 * Represents each channel msg on the vmbus connection This is a
924 * variable-size data structure depending on the msg type itself 898 * variable-size data structure depending on the msg type itself
@@ -1184,19 +1158,8 @@ extern int vmbus_recvpacket_raw(struct vmbus_channel *channel,
1184 u64 *requestid); 1158 u64 *requestid);
1185 1159
1186 1160
1187extern void vmbus_get_debug_info(struct vmbus_channel *channel,
1188 struct vmbus_channel_debug_info *debug);
1189
1190extern void vmbus_ontimer(unsigned long data); 1161extern void vmbus_ontimer(unsigned long data);
1191 1162
1192struct hv_dev_port_info {
1193 u32 int_mask;
1194 u32 read_idx;
1195 u32 write_idx;
1196 u32 bytes_avail_toread;
1197 u32 bytes_avail_towrite;
1198};
1199
1200/* Base driver object */ 1163/* Base driver object */
1201struct hv_driver { 1164struct hv_driver {
1202 const char *name; 1165 const char *name;
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
index 81cbbdb96aae..673a3ce67f31 100644
--- a/include/linux/i2c/twl.h
+++ b/include/linux/i2c/twl.h
@@ -26,6 +26,7 @@
26#define __TWL_H_ 26#define __TWL_H_
27 27
28#include <linux/types.h> 28#include <linux/types.h>
29#include <linux/phy/phy.h>
29#include <linux/input/matrix_keypad.h> 30#include <linux/input/matrix_keypad.h>
30 31
31/* 32/*
@@ -615,6 +616,7 @@ enum twl4030_usb_mode {
615struct twl4030_usb_data { 616struct twl4030_usb_data {
616 enum twl4030_usb_mode usb_mode; 617 enum twl4030_usb_mode usb_mode;
617 unsigned long features; 618 unsigned long features;
619 struct phy_init_data *init_data;
618 620
619 int (*phy_init)(struct device *dev); 621 int (*phy_init)(struct device *dev);
620 int (*phy_exit)(struct device *dev); 622 int (*phy_exit)(struct device *dev);
diff --git a/include/linux/ide.h b/include/linux/ide.h
index b17974917dbf..46a14229a162 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1514,7 +1514,7 @@ static inline void ide_set_max_pio(ide_drive_t *drive)
1514 1514
1515char *ide_media_string(ide_drive_t *); 1515char *ide_media_string(ide_drive_t *);
1516 1516
1517extern struct device_attribute ide_dev_attrs[]; 1517extern const struct attribute_group *ide_dev_groups[];
1518extern struct bus_type ide_bus_type; 1518extern struct bus_type ide_bus_type;
1519extern struct class *ide_port_class; 1519extern struct class *ide_port_class;
1520 1520
diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h
index 2bac0eb8948d..15607b45221a 100644
--- a/include/linux/iio/buffer.h
+++ b/include/linux/iio/buffer.h
@@ -11,6 +11,7 @@
11#define _IIO_BUFFER_GENERIC_H_ 11#define _IIO_BUFFER_GENERIC_H_
12#include <linux/sysfs.h> 12#include <linux/sysfs.h>
13#include <linux/iio/iio.h> 13#include <linux/iio/iio.h>
14#include <linux/kref.h>
14 15
15#ifdef CONFIG_IIO_BUFFER 16#ifdef CONFIG_IIO_BUFFER
16 17
@@ -26,6 +27,8 @@ struct iio_buffer;
26 * @set_bytes_per_datum:set number of bytes per datum 27 * @set_bytes_per_datum:set number of bytes per datum
27 * @get_length: get number of datums in buffer 28 * @get_length: get number of datums in buffer
28 * @set_length: set number of datums in buffer 29 * @set_length: set number of datums in buffer
30 * @release: called when the last reference to the buffer is dropped,
31 * should free all resources allocated by the buffer.
29 * 32 *
30 * The purpose of this structure is to make the buffer element 33 * The purpose of this structure is to make the buffer element
31 * modular as event for a given driver, different usecases may require 34 * modular as event for a given driver, different usecases may require
@@ -36,7 +39,7 @@ struct iio_buffer;
36 * any of them not existing. 39 * any of them not existing.
37 **/ 40 **/
38struct iio_buffer_access_funcs { 41struct iio_buffer_access_funcs {
39 int (*store_to)(struct iio_buffer *buffer, u8 *data); 42 int (*store_to)(struct iio_buffer *buffer, const void *data);
40 int (*read_first_n)(struct iio_buffer *buffer, 43 int (*read_first_n)(struct iio_buffer *buffer,
41 size_t n, 44 size_t n,
42 char __user *buf); 45 char __user *buf);
@@ -47,6 +50,8 @@ struct iio_buffer_access_funcs {
47 int (*set_bytes_per_datum)(struct iio_buffer *buffer, size_t bpd); 50 int (*set_bytes_per_datum)(struct iio_buffer *buffer, size_t bpd);
48 int (*get_length)(struct iio_buffer *buffer); 51 int (*get_length)(struct iio_buffer *buffer);
49 int (*set_length)(struct iio_buffer *buffer, int length); 52 int (*set_length)(struct iio_buffer *buffer, int length);
53
54 void (*release)(struct iio_buffer *buffer);
50}; 55};
51 56
52/** 57/**
@@ -67,6 +72,7 @@ struct iio_buffer_access_funcs {
67 * @demux_list: [INTERN] list of operations required to demux the scan. 72 * @demux_list: [INTERN] list of operations required to demux the scan.
68 * @demux_bounce: [INTERN] buffer for doing gather from incoming scan. 73 * @demux_bounce: [INTERN] buffer for doing gather from incoming scan.
69 * @buffer_list: [INTERN] entry in the devices list of current buffers. 74 * @buffer_list: [INTERN] entry in the devices list of current buffers.
75 * @ref: [INTERN] reference count of the buffer.
70 */ 76 */
71struct iio_buffer { 77struct iio_buffer {
72 int length; 78 int length;
@@ -81,8 +87,9 @@ struct iio_buffer {
81 bool stufftoread; 87 bool stufftoread;
82 const struct attribute_group *attrs; 88 const struct attribute_group *attrs;
83 struct list_head demux_list; 89 struct list_head demux_list;
84 unsigned char *demux_bounce; 90 void *demux_bounce;
85 struct list_head buffer_list; 91 struct list_head buffer_list;
92 struct kref ref;
86}; 93};
87 94
88/** 95/**
@@ -120,7 +127,32 @@ int iio_scan_mask_set(struct iio_dev *indio_dev,
120 * @indio_dev: iio_dev structure for device. 127 * @indio_dev: iio_dev structure for device.
121 * @data: Full scan. 128 * @data: Full scan.
122 */ 129 */
123int iio_push_to_buffers(struct iio_dev *indio_dev, unsigned char *data); 130int iio_push_to_buffers(struct iio_dev *indio_dev, const void *data);
131
132/*
133 * iio_push_to_buffers_with_timestamp() - push data and timestamp to buffers
134 * @indio_dev: iio_dev structure for device.
135 * @data: sample data
136 * @timestamp: timestamp for the sample data
137 *
138 * Pushes data to the IIO device's buffers. If timestamps are enabled for the
139 * device the function will store the supplied timestamp as the last element in
140 * the sample data buffer before pushing it to the device buffers. The sample
141 * data buffer needs to be large enough to hold the additional timestamp
142 * (usually the buffer should be indio->scan_bytes bytes large).
143 *
144 * Returns 0 on success, a negative error code otherwise.
145 */
146static inline int iio_push_to_buffers_with_timestamp(struct iio_dev *indio_dev,
147 void *data, int64_t timestamp)
148{
149 if (indio_dev->scan_timestamp) {
150 size_t ts_offset = indio_dev->scan_bytes / sizeof(int64_t) - 1;
151 ((int64_t *)data)[ts_offset] = timestamp;
152 }
153
154 return iio_push_to_buffers(indio_dev, data);
155}
124 156
125int iio_update_demux(struct iio_dev *indio_dev); 157int iio_update_demux(struct iio_dev *indio_dev);
126 158
@@ -174,11 +206,27 @@ ssize_t iio_buffer_show_enable(struct device *dev,
174 iio_buffer_show_enable, \ 206 iio_buffer_show_enable, \
175 iio_buffer_store_enable) 207 iio_buffer_store_enable)
176 208
177int iio_sw_buffer_preenable(struct iio_dev *indio_dev);
178
179bool iio_validate_scan_mask_onehot(struct iio_dev *indio_dev, 209bool iio_validate_scan_mask_onehot(struct iio_dev *indio_dev,
180 const unsigned long *mask); 210 const unsigned long *mask);
181 211
212struct iio_buffer *iio_buffer_get(struct iio_buffer *buffer);
213void iio_buffer_put(struct iio_buffer *buffer);
214
215/**
216 * iio_device_attach_buffer - Attach a buffer to a IIO device
217 * @indio_dev: The device the buffer should be attached to
218 * @buffer: The buffer to attach to the device
219 *
220 * This function attaches a buffer to a IIO device. The buffer stays attached to
221 * the device until the device is freed. The function should only be called at
222 * most once per device.
223 */
224static inline void iio_device_attach_buffer(struct iio_dev *indio_dev,
225 struct iio_buffer *buffer)
226{
227 indio_dev->buffer = iio_buffer_get(buffer);
228}
229
182#else /* CONFIG_IIO_BUFFER */ 230#else /* CONFIG_IIO_BUFFER */
183 231
184static inline int iio_buffer_register(struct iio_dev *indio_dev, 232static inline int iio_buffer_register(struct iio_dev *indio_dev,
@@ -191,6 +239,9 @@ static inline int iio_buffer_register(struct iio_dev *indio_dev,
191static inline void iio_buffer_unregister(struct iio_dev *indio_dev) 239static inline void iio_buffer_unregister(struct iio_dev *indio_dev)
192{} 240{}
193 241
242static inline void iio_buffer_get(struct iio_buffer *buffer) {}
243static inline void iio_buffer_put(struct iio_buffer *buffer) {}
244
194#endif /* CONFIG_IIO_BUFFER */ 245#endif /* CONFIG_IIO_BUFFER */
195 246
196#endif /* _IIO_BUFFER_GENERIC_H_ */ 247#endif /* _IIO_BUFFER_GENERIC_H_ */
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index e51f65480ea5..3c005eb3a0a4 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -16,6 +16,7 @@
16#include <linux/irqreturn.h> 16#include <linux/irqreturn.h>
17#include <linux/iio/trigger.h> 17#include <linux/iio/trigger.h>
18#include <linux/bitops.h> 18#include <linux/bitops.h>
19#include <linux/regulator/consumer.h>
19 20
20#include <linux/platform_data/st_sensors_pdata.h> 21#include <linux/platform_data/st_sensors_pdata.h>
21 22
@@ -184,6 +185,7 @@ struct st_sensors {
184 u8 wai; 185 u8 wai;
185 char sensors_supported[ST_SENSORS_MAX_4WAI][ST_SENSORS_MAX_NAME]; 186 char sensors_supported[ST_SENSORS_MAX_4WAI][ST_SENSORS_MAX_NAME];
186 struct iio_chan_spec *ch; 187 struct iio_chan_spec *ch;
188 int num_ch;
187 struct st_sensor_odr odr; 189 struct st_sensor_odr odr;
188 struct st_sensor_power pw; 190 struct st_sensor_power pw;
189 struct st_sensor_axis enable_axis; 191 struct st_sensor_axis enable_axis;
@@ -200,6 +202,8 @@ struct st_sensors {
200 * @trig: The trigger in use by the core driver. 202 * @trig: The trigger in use by the core driver.
201 * @sensor: Pointer to the current sensor struct in use. 203 * @sensor: Pointer to the current sensor struct in use.
202 * @current_fullscale: Maximum range of measure by the sensor. 204 * @current_fullscale: Maximum range of measure by the sensor.
205 * @vdd: Pointer to sensor's Vdd power supply
206 * @vdd_io: Pointer to sensor's Vdd-IO power supply
203 * @enabled: Status of the sensor (false->off, true->on). 207 * @enabled: Status of the sensor (false->off, true->on).
204 * @multiread_bit: Use or not particular bit for [I2C/SPI] multiread. 208 * @multiread_bit: Use or not particular bit for [I2C/SPI] multiread.
205 * @buffer_data: Data used by buffer part. 209 * @buffer_data: Data used by buffer part.
@@ -215,6 +219,8 @@ struct st_sensor_data {
215 struct iio_trigger *trig; 219 struct iio_trigger *trig;
216 struct st_sensors *sensor; 220 struct st_sensors *sensor;
217 struct st_sensor_fullscale_avl *current_fullscale; 221 struct st_sensor_fullscale_avl *current_fullscale;
222 struct regulator *vdd;
223 struct regulator *vdd_io;
218 224
219 bool enabled; 225 bool enabled;
220 bool multiread_bit; 226 bool multiread_bit;
diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h
index 833926c91aa8..2752b1fd12be 100644
--- a/include/linux/iio/consumer.h
+++ b/include/linux/iio/consumer.h
@@ -77,7 +77,7 @@ struct iio_cb_buffer;
77 * fail. 77 * fail.
78 */ 78 */
79struct iio_cb_buffer *iio_channel_get_all_cb(struct device *dev, 79struct iio_cb_buffer *iio_channel_get_all_cb(struct device *dev,
80 int (*cb)(u8 *data, 80 int (*cb)(const void *data,
81 void *private), 81 void *private),
82 void *private); 82 void *private);
83/** 83/**
diff --git a/include/linux/iio/events.h b/include/linux/iio/events.h
index 13ce220c7003..5dab2c41031f 100644
--- a/include/linux/iio/events.h
+++ b/include/linux/iio/events.h
@@ -26,20 +26,6 @@ struct iio_event_data {
26 26
27#define IIO_GET_EVENT_FD_IOCTL _IOR('i', 0x90, int) 27#define IIO_GET_EVENT_FD_IOCTL _IOR('i', 0x90, int)
28 28
29enum iio_event_type {
30 IIO_EV_TYPE_THRESH,
31 IIO_EV_TYPE_MAG,
32 IIO_EV_TYPE_ROC,
33 IIO_EV_TYPE_THRESH_ADAPTIVE,
34 IIO_EV_TYPE_MAG_ADAPTIVE,
35};
36
37enum iio_event_direction {
38 IIO_EV_DIR_EITHER,
39 IIO_EV_DIR_RISING,
40 IIO_EV_DIR_FALLING,
41};
42
43/** 29/**
44 * IIO_EVENT_CODE() - create event identifier 30 * IIO_EVENT_CODE() - create event identifier
45 * @chan_type: Type of the channel. Should be one of enum iio_chan_type. 31 * @chan_type: Type of the channel. Should be one of enum iio_chan_type.
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 2103cc32a5fb..256a90a1bea6 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -36,6 +36,14 @@ enum iio_chan_info_enum {
36 IIO_CHAN_INFO_PHASE, 36 IIO_CHAN_INFO_PHASE,
37 IIO_CHAN_INFO_HARDWAREGAIN, 37 IIO_CHAN_INFO_HARDWAREGAIN,
38 IIO_CHAN_INFO_HYSTERESIS, 38 IIO_CHAN_INFO_HYSTERESIS,
39 IIO_CHAN_INFO_INT_TIME,
40};
41
42enum iio_shared_by {
43 IIO_SEPARATE,
44 IIO_SHARED_BY_TYPE,
45 IIO_SHARED_BY_DIR,
46 IIO_SHARED_BY_ALL
39}; 47};
40 48
41enum iio_endian { 49enum iio_endian {
@@ -57,7 +65,7 @@ struct iio_dev;
57 */ 65 */
58struct iio_chan_spec_ext_info { 66struct iio_chan_spec_ext_info {
59 const char *name; 67 const char *name;
60 bool shared; 68 enum iio_shared_by shared;
61 ssize_t (*read)(struct iio_dev *, uintptr_t private, 69 ssize_t (*read)(struct iio_dev *, uintptr_t private,
62 struct iio_chan_spec const *, char *buf); 70 struct iio_chan_spec const *, char *buf);
63 ssize_t (*write)(struct iio_dev *, uintptr_t private, 71 ssize_t (*write)(struct iio_dev *, uintptr_t private,
@@ -125,12 +133,35 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev,
125#define IIO_ENUM_AVAILABLE(_name, _e) \ 133#define IIO_ENUM_AVAILABLE(_name, _e) \
126{ \ 134{ \
127 .name = (_name "_available"), \ 135 .name = (_name "_available"), \
128 .shared = true, \ 136 .shared = IIO_SHARED_BY_TYPE, \
129 .read = iio_enum_available_read, \ 137 .read = iio_enum_available_read, \
130 .private = (uintptr_t)(_e), \ 138 .private = (uintptr_t)(_e), \
131} 139}
132 140
133/** 141/**
142 * struct iio_event_spec - specification for a channel event
143 * @type: Type of the event
144 * @dir: Direction of the event
145 * @mask_separate: Bit mask of enum iio_event_info values. Attributes
146 * set in this mask will be registered per channel.
147 * @mask_shared_by_type: Bit mask of enum iio_event_info values. Attributes
148 * set in this mask will be shared by channel type.
149 * @mask_shared_by_dir: Bit mask of enum iio_event_info values. Attributes
150 * set in this mask will be shared by channel type and
151 * direction.
152 * @mask_shared_by_all: Bit mask of enum iio_event_info values. Attributes
153 * set in this mask will be shared by all channels.
154 */
155struct iio_event_spec {
156 enum iio_event_type type;
157 enum iio_event_direction dir;
158 unsigned long mask_separate;
159 unsigned long mask_shared_by_type;
160 unsigned long mask_shared_by_dir;
161 unsigned long mask_shared_by_all;
162};
163
164/**
134 * struct iio_chan_spec - specification of a single channel 165 * struct iio_chan_spec - specification of a single channel
135 * @type: What type of measurement is the channel making. 166 * @type: What type of measurement is the channel making.
136 * @channel: What number do we wish to assign the channel. 167 * @channel: What number do we wish to assign the channel.
@@ -146,13 +177,18 @@ ssize_t iio_enum_write(struct iio_dev *indio_dev,
146 * shift: Shift right by this before masking out 177 * shift: Shift right by this before masking out
147 * realbits. 178 * realbits.
148 * endianness: little or big endian 179 * endianness: little or big endian
149 * @info_mask: What information is to be exported about this channel.
150 * This includes calibbias, scale etc.
151 * @info_mask_separate: What information is to be exported that is specific to 180 * @info_mask_separate: What information is to be exported that is specific to
152 * this channel. 181 * this channel.
153 * @info_mask_shared_by_type: What information is to be exported that is shared 182 * @info_mask_shared_by_type: What information is to be exported that is shared
154* by all channels of the same type. 183 * by all channels of the same type.
184 * @info_mask_shared_by_dir: What information is to be exported that is shared
185 * by all channels of the same direction.
186 * @info_mask_shared_by_all: What information is to be exported that is shared
187 * by all channels.
155 * @event_mask: What events can this channel produce. 188 * @event_mask: What events can this channel produce.
189 * @event_spec: Array of events which should be registered for this
190 * channel.
191 * @num_event_specs: Size of the event_spec array.
156 * @ext_info: Array of extended info attributes for this channel. 192 * @ext_info: Array of extended info attributes for this channel.
157 * The array is NULL terminated, the last element should 193 * The array is NULL terminated, the last element should
158 * have its name field set to NULL. 194 * have its name field set to NULL.
@@ -186,10 +222,13 @@ struct iio_chan_spec {
186 u8 shift; 222 u8 shift;
187 enum iio_endian endianness; 223 enum iio_endian endianness;
188 } scan_type; 224 } scan_type;
189 long info_mask;
190 long info_mask_separate; 225 long info_mask_separate;
191 long info_mask_shared_by_type; 226 long info_mask_shared_by_type;
227 long info_mask_shared_by_dir;
228 long info_mask_shared_by_all;
192 long event_mask; 229 long event_mask;
230 const struct iio_event_spec *event_spec;
231 unsigned int num_event_specs;
193 const struct iio_chan_spec_ext_info *ext_info; 232 const struct iio_chan_spec_ext_info *ext_info;
194 const char *extend_name; 233 const char *extend_name;
195 const char *datasheet_name; 234 const char *datasheet_name;
@@ -212,7 +251,9 @@ static inline bool iio_channel_has_info(const struct iio_chan_spec *chan,
212 enum iio_chan_info_enum type) 251 enum iio_chan_info_enum type)
213{ 252{
214 return (chan->info_mask_separate & BIT(type)) | 253 return (chan->info_mask_separate & BIT(type)) |
215 (chan->info_mask_shared_by_type & BIT(type)); 254 (chan->info_mask_shared_by_type & BIT(type)) |
255 (chan->info_mask_shared_by_dir & BIT(type)) |
256 (chan->info_mask_shared_by_all & BIT(type));
216} 257}
217 258
218#define IIO_ST(si, rb, sb, sh) \ 259#define IIO_ST(si, rb, sb, sh) \
@@ -270,6 +311,12 @@ struct iio_dev;
270 * is event dependant. event_code specifies which event. 311 * is event dependant. event_code specifies which event.
271 * @write_event_value: write the value associated with the event. 312 * @write_event_value: write the value associated with the event.
272 * Meaning is event dependent. 313 * Meaning is event dependent.
314 * @read_event_config_new: find out if the event is enabled. New style interface.
315 * @write_event_config_new: set if the event is enabled. New style interface.
316 * @read_event_value_new: read a configuration value associated with the event.
317 * New style interface.
318 * @write_event_value_new: write a configuration value for the event. New style
319 * interface.
273 * @validate_trigger: function to validate the trigger when the 320 * @validate_trigger: function to validate the trigger when the
274 * current trigger gets changed. 321 * current trigger gets changed.
275 * @update_scan_mode: function to configure device and scan buffer when 322 * @update_scan_mode: function to configure device and scan buffer when
@@ -310,6 +357,30 @@ struct iio_info {
310 int (*write_event_value)(struct iio_dev *indio_dev, 357 int (*write_event_value)(struct iio_dev *indio_dev,
311 u64 event_code, 358 u64 event_code,
312 int val); 359 int val);
360
361 int (*read_event_config_new)(struct iio_dev *indio_dev,
362 const struct iio_chan_spec *chan,
363 enum iio_event_type type,
364 enum iio_event_direction dir);
365
366 int (*write_event_config_new)(struct iio_dev *indio_dev,
367 const struct iio_chan_spec *chan,
368 enum iio_event_type type,
369 enum iio_event_direction dir,
370 int state);
371
372 int (*read_event_value_new)(struct iio_dev *indio_dev,
373 const struct iio_chan_spec *chan,
374 enum iio_event_type type,
375 enum iio_event_direction dir,
376 enum iio_event_info info, int *val, int *val2);
377
378 int (*write_event_value_new)(struct iio_dev *indio_dev,
379 const struct iio_chan_spec *chan,
380 enum iio_event_type type,
381 enum iio_event_direction dir,
382 enum iio_event_info info, int val, int val2);
383
313 int (*validate_trigger)(struct iio_dev *indio_dev, 384 int (*validate_trigger)(struct iio_dev *indio_dev,
314 struct iio_trigger *trig); 385 struct iio_trigger *trig);
315 int (*update_scan_mode)(struct iio_dev *indio_dev, 386 int (*update_scan_mode)(struct iio_dev *indio_dev,
@@ -457,7 +528,7 @@ static inline void iio_device_put(struct iio_dev *indio_dev)
457{ 528{
458 if (indio_dev) 529 if (indio_dev)
459 put_device(&indio_dev->dev); 530 put_device(&indio_dev->dev);
460}; 531}
461 532
462/** 533/**
463 * dev_to_iio_dev() - Get IIO device struct from a device struct 534 * dev_to_iio_dev() - Get IIO device struct from a device struct
@@ -593,7 +664,7 @@ static inline bool iio_buffer_enabled(struct iio_dev *indio_dev)
593{ 664{
594 return indio_dev->currentmode 665 return indio_dev->currentmode
595 & (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE); 666 & (INDIO_BUFFER_TRIGGERED | INDIO_BUFFER_HARDWARE);
596}; 667}
597 668
598/** 669/**
599 * iio_get_debugfs_dentry() - helper function to get the debugfs_dentry 670 * iio_get_debugfs_dentry() - helper function to get the debugfs_dentry
@@ -603,12 +674,12 @@ static inline bool iio_buffer_enabled(struct iio_dev *indio_dev)
603static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev) 674static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev)
604{ 675{
605 return indio_dev->debugfs_dentry; 676 return indio_dev->debugfs_dentry;
606}; 677}
607#else 678#else
608static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev) 679static inline struct dentry *iio_get_debugfs_dentry(struct iio_dev *indio_dev)
609{ 680{
610 return NULL; 681 return NULL;
611}; 682}
612#endif 683#endif
613 684
614int iio_str_to_fixpoint(const char *str, int fract_mult, int *integer, 685int iio_str_to_fixpoint(const char *str, int fract_mult, int *integer,
diff --git a/include/linux/iio/sysfs.h b/include/linux/iio/sysfs.h
index 2958c960003a..8a1d18640ab9 100644
--- a/include/linux/iio/sysfs.h
+++ b/include/linux/iio/sysfs.h
@@ -100,6 +100,21 @@ struct iio_const_attr {
100#define IIO_CONST_ATTR_SAMP_FREQ_AVAIL(_string) \ 100#define IIO_CONST_ATTR_SAMP_FREQ_AVAIL(_string) \
101 IIO_CONST_ATTR(sampling_frequency_available, _string) 101 IIO_CONST_ATTR(sampling_frequency_available, _string)
102 102
103/**
104 * IIO_DEV_ATTR_INT_TIME_AVAIL - list available integration times
105 * @_show: output method for the attribute
106 **/
107#define IIO_DEV_ATTR_INT_TIME_AVAIL(_show) \
108 IIO_DEVICE_ATTR(integration_time_available, S_IRUGO, _show, NULL, 0)
109/**
110 * IIO_CONST_ATTR_INT_TIME_AVAIL - list available integration times
111 * @_string: frequency string for the attribute
112 *
113 * Constant version
114 **/
115#define IIO_CONST_ATTR_INT_TIME_AVAIL(_string) \
116 IIO_CONST_ATTR(integration_time_available, _string)
117
103#define IIO_DEV_ATTR_TEMP_RAW(_show) \ 118#define IIO_DEV_ATTR_TEMP_RAW(_show) \
104 IIO_DEVICE_ATTR(in_temp_raw, S_IRUGO, _show, NULL, 0) 119 IIO_DEVICE_ATTR(in_temp_raw, S_IRUGO, _show, NULL, 0)
105 120
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
index 88bf0f0d27b4..4ac928ee31c5 100644
--- a/include/linux/iio/types.h
+++ b/include/linux/iio/types.h
@@ -54,6 +54,26 @@ enum iio_modifier {
54 IIO_MOD_LIGHT_BLUE, 54 IIO_MOD_LIGHT_BLUE,
55}; 55};
56 56
57enum iio_event_type {
58 IIO_EV_TYPE_THRESH,
59 IIO_EV_TYPE_MAG,
60 IIO_EV_TYPE_ROC,
61 IIO_EV_TYPE_THRESH_ADAPTIVE,
62 IIO_EV_TYPE_MAG_ADAPTIVE,
63};
64
65enum iio_event_info {
66 IIO_EV_INFO_ENABLE,
67 IIO_EV_INFO_VALUE,
68 IIO_EV_INFO_HYSTERESIS,
69};
70
71enum iio_event_direction {
72 IIO_EV_DIR_EITHER,
73 IIO_EV_DIR_RISING,
74 IIO_EV_DIR_FALLING,
75};
76
57#define IIO_VAL_INT 1 77#define IIO_VAL_INT 1
58#define IIO_VAL_INT_PLUS_MICRO 2 78#define IIO_VAL_INT_PLUS_MICRO 2
59#define IIO_VAL_INT_PLUS_NANO 3 79#define IIO_VAL_INT_PLUS_NANO 3
diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 5e865b554940..c9e831dc80bc 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -19,6 +19,7 @@
19 19
20#include <linux/atomic.h> 20#include <linux/atomic.h>
21#include <asm/ptrace.h> 21#include <asm/ptrace.h>
22#include <asm/irq.h>
22 23
23/* 24/*
24 * These correspond to the IORESOURCE_IRQ_* defines in 25 * These correspond to the IORESOURCE_IRQ_* defines in
@@ -374,6 +375,16 @@ struct softirq_action
374 375
375asmlinkage void do_softirq(void); 376asmlinkage void do_softirq(void);
376asmlinkage void __do_softirq(void); 377asmlinkage void __do_softirq(void);
378
379#ifdef __ARCH_HAS_DO_SOFTIRQ
380void do_softirq_own_stack(void);
381#else
382static inline void do_softirq_own_stack(void)
383{
384 __do_softirq();
385}
386#endif
387
377extern void open_softirq(int nr, void (*action)(struct softirq_action *)); 388extern void open_softirq(int nr, void (*action)(struct softirq_action *));
378extern void softirq_init(void); 389extern void softirq_init(void);
379extern void __raise_softirq_irqoff(unsigned int nr); 390extern void __raise_softirq_irqoff(unsigned int nr);
diff --git a/include/linux/irqchip/bcm2835.h b/include/linux/irqchip/bcm2835.h
deleted file mode 100644
index 48a859bc9dca..000000000000
--- a/include/linux/irqchip/bcm2835.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * Copyright (C) 2010 Broadcom
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#ifndef __LINUX_IRQCHIP_BCM2835_H_
20#define __LINUX_IRQCHIP_BCM2835_H_
21
22#include <asm/exception.h>
23
24extern void bcm2835_init_irq(void);
25
26extern asmlinkage void __exception_irq_entry bcm2835_handle_irq(
27 struct pt_regs *regs);
28
29#endif
diff --git a/include/linux/kdb.h b/include/linux/kdb.h
index 7f6fe6e015bc..290db1269c4c 100644
--- a/include/linux/kdb.h
+++ b/include/linux/kdb.h
@@ -109,6 +109,7 @@ typedef enum {
109 KDB_REASON_RECURSE, /* Recursive entry to kdb; 109 KDB_REASON_RECURSE, /* Recursive entry to kdb;
110 * regs probably valid */ 110 * regs probably valid */
111 KDB_REASON_SSTEP, /* Single Step trap. - regs valid */ 111 KDB_REASON_SSTEP, /* Single Step trap. - regs valid */
112 KDB_REASON_SYSTEM_NMI, /* In NMI due to SYSTEM cmd; regs valid */
112} kdb_reason_t; 113} kdb_reason_t;
113 114
114extern int kdb_trap_printk; 115extern int kdb_trap_printk;
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
index c6e091bf39a5..dfb4f2ffdaa2 100644
--- a/include/linux/kgdb.h
+++ b/include/linux/kgdb.h
@@ -310,6 +310,7 @@ extern int
310kgdb_handle_exception(int ex_vector, int signo, int err_code, 310kgdb_handle_exception(int ex_vector, int signo, int err_code,
311 struct pt_regs *regs); 311 struct pt_regs *regs);
312extern int kgdb_nmicallback(int cpu, void *regs); 312extern int kgdb_nmicallback(int cpu, void *regs);
313extern int kgdb_nmicallin(int cpu, int trapnr, void *regs, atomic_t *snd_rdy);
313extern void gdbstub_exit(int status); 314extern void gdbstub_exit(int status);
314 315
315extern int kgdb_single_step; 316extern int kgdb_single_step;
diff --git a/include/linux/kobj_completion.h b/include/linux/kobj_completion.h
new file mode 100644
index 000000000000..a428f6436063
--- /dev/null
+++ b/include/linux/kobj_completion.h
@@ -0,0 +1,18 @@
1#ifndef _KOBJ_COMPLETION_H_
2#define _KOBJ_COMPLETION_H_
3
4#include <linux/kobject.h>
5#include <linux/completion.h>
6
7struct kobj_completion {
8 struct kobject kc_kobj;
9 struct completion kc_unregister;
10};
11
12#define kobj_to_kobj_completion(kobj) \
13 container_of(kobj, struct kobj_completion, kc_kobj)
14
15void kobj_completion_init(struct kobj_completion *kc, struct kobj_type *ktype);
16void kobj_completion_release(struct kobject *kobj);
17void kobj_completion_del_and_wait(struct kobj_completion *kc);
18#endif /* _KOBJ_COMPLETION_H_ */
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index de6dcbcc6ef7..e7ba650086ce 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -107,6 +107,7 @@ extern int __must_check kobject_move(struct kobject *, struct kobject *);
107extern struct kobject *kobject_get(struct kobject *kobj); 107extern struct kobject *kobject_get(struct kobject *kobj);
108extern void kobject_put(struct kobject *kobj); 108extern void kobject_put(struct kobject *kobj);
109 109
110extern const void *kobject_namespace(struct kobject *kobj);
110extern char *kobject_get_path(struct kobject *kobj, gfp_t flag); 111extern char *kobject_get_path(struct kobject *kobj, gfp_t flag);
111 112
112struct kobj_type { 113struct kobj_type {
diff --git a/include/linux/lockref.h b/include/linux/lockref.h
index f279ed9a9163..13dfd36a3294 100644
--- a/include/linux/lockref.h
+++ b/include/linux/lockref.h
@@ -36,4 +36,10 @@ extern int lockref_put_or_lock(struct lockref *);
36extern void lockref_mark_dead(struct lockref *); 36extern void lockref_mark_dead(struct lockref *);
37extern int lockref_get_not_dead(struct lockref *); 37extern int lockref_get_not_dead(struct lockref *);
38 38
39/* Must be called under spinlock for reliable results */
40static inline int __lockref_is_dead(const struct lockref *l)
41{
42 return ((int)l->count < 0);
43}
44
39#endif /* __LINUX_LOCKREF_H */ 45#endif /* __LINUX_LOCKREF_H */
diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
index da6716b9e3fe..ea4d2495c646 100644
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -136,6 +136,7 @@ struct mempolicy *mpol_shared_policy_lookup(struct shared_policy *sp,
136 136
137struct mempolicy *get_vma_policy(struct task_struct *tsk, 137struct mempolicy *get_vma_policy(struct task_struct *tsk,
138 struct vm_area_struct *vma, unsigned long addr); 138 struct vm_area_struct *vma, unsigned long addr);
139bool vma_policy_mof(struct task_struct *task, struct vm_area_struct *vma);
139 140
140extern void numa_default_policy(void); 141extern void numa_default_policy(void);
141extern void numa_policy_init(void); 142extern void numa_policy_init(void);
diff --git a/include/linux/mfd/core.h b/include/linux/mfd/core.h
index cebe97ee98b8..7314fc4e6d25 100644
--- a/include/linux/mfd/core.h
+++ b/include/linux/mfd/core.h
@@ -59,6 +59,12 @@ struct mfd_cell {
59 * pm_runtime_no_callbacks(). 59 * pm_runtime_no_callbacks().
60 */ 60 */
61 bool pm_runtime_no_callbacks; 61 bool pm_runtime_no_callbacks;
62
63 /* A list of regulator supplies that should be mapped to the MFD
64 * device rather than the child device when requested
65 */
66 const char **parent_supplies;
67 int num_parent_supplies;
62}; 68};
63 69
64/* 70/*
diff --git a/include/linux/mfd/dbx500-prcmu.h b/include/linux/mfd/dbx500-prcmu.h
index ca0790fba2f5..060e11256fbc 100644
--- a/include/linux/mfd/dbx500-prcmu.h
+++ b/include/linux/mfd/dbx500-prcmu.h
@@ -12,6 +12,8 @@
12#include <linux/notifier.h> 12#include <linux/notifier.h>
13#include <linux/err.h> 13#include <linux/err.h>
14 14
15#include <dt-bindings/mfd/dbx500-prcmu.h> /* For clock identifiers */
16
15/* Offset for the firmware version within the TCPM */ 17/* Offset for the firmware version within the TCPM */
16#define DB8500_PRCMU_FW_VERSION_OFFSET 0xA4 18#define DB8500_PRCMU_FW_VERSION_OFFSET 0xA4
17#define DBX540_PRCMU_FW_VERSION_OFFSET 0xA8 19#define DBX540_PRCMU_FW_VERSION_OFFSET 0xA8
@@ -94,74 +96,6 @@ enum prcmu_wakeup_index {
94#define PRCMU_CLKSRC_ARMCLKFIX 0x46 96#define PRCMU_CLKSRC_ARMCLKFIX 0x46
95#define PRCMU_CLKSRC_HDMICLK 0x47 97#define PRCMU_CLKSRC_HDMICLK 0x47
96 98
97/*
98 * Clock identifiers.
99 */
100enum prcmu_clock {
101 PRCMU_SGACLK,
102 PRCMU_UARTCLK,
103 PRCMU_MSP02CLK,
104 PRCMU_MSP1CLK,
105 PRCMU_I2CCLK,
106 PRCMU_SDMMCCLK,
107 PRCMU_SPARE1CLK,
108 PRCMU_SLIMCLK,
109 PRCMU_PER1CLK,
110 PRCMU_PER2CLK,
111 PRCMU_PER3CLK,
112 PRCMU_PER5CLK,
113 PRCMU_PER6CLK,
114 PRCMU_PER7CLK,
115 PRCMU_LCDCLK,
116 PRCMU_BMLCLK,
117 PRCMU_HSITXCLK,
118 PRCMU_HSIRXCLK,
119 PRCMU_HDMICLK,
120 PRCMU_APEATCLK,
121 PRCMU_APETRACECLK,
122 PRCMU_MCDECLK,
123 PRCMU_IPI2CCLK,
124 PRCMU_DSIALTCLK,
125 PRCMU_DMACLK,
126 PRCMU_B2R2CLK,
127 PRCMU_TVCLK,
128 PRCMU_SSPCLK,
129 PRCMU_RNGCLK,
130 PRCMU_UICCCLK,
131 PRCMU_PWMCLK,
132 PRCMU_IRDACLK,
133 PRCMU_IRRCCLK,
134 PRCMU_SIACLK,
135 PRCMU_SVACLK,
136 PRCMU_ACLK,
137 PRCMU_HVACLK, /* Ux540 only */
138 PRCMU_G1CLK, /* Ux540 only */
139 PRCMU_SDMMCHCLK,
140 PRCMU_CAMCLK,
141 PRCMU_BML8580CLK,
142 PRCMU_NUM_REG_CLOCKS,
143 PRCMU_SYSCLK = PRCMU_NUM_REG_CLOCKS,
144 PRCMU_CDCLK,
145 PRCMU_TIMCLK,
146 PRCMU_PLLSOC0,
147 PRCMU_PLLSOC1,
148 PRCMU_ARMSS,
149 PRCMU_PLLDDR,
150 PRCMU_PLLDSI,
151 PRCMU_DSI0CLK,
152 PRCMU_DSI1CLK,
153 PRCMU_DSI0ESCCLK,
154 PRCMU_DSI1ESCCLK,
155 PRCMU_DSI2ESCCLK,
156 /* LCD DSI PLL - Ux540 only */
157 PRCMU_PLLDSI_LCD,
158 PRCMU_DSI0CLK_LCD,
159 PRCMU_DSI1CLK_LCD,
160 PRCMU_DSI0ESCCLK_LCD,
161 PRCMU_DSI1ESCCLK_LCD,
162 PRCMU_DSI2ESCCLK_LCD,
163};
164
165/** 99/**
166 * enum prcmu_wdog_id - PRCMU watchdog IDs 100 * enum prcmu_wdog_id - PRCMU watchdog IDs
167 * @PRCMU_WDOG_ALL: use all timers 101 * @PRCMU_WDOG_ALL: use all timers
diff --git a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
index b6bdcd66c07d..7086b2248c8f 100644
--- a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
+++ b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
@@ -363,4 +363,9 @@
363#define IMX6Q_GPR13_SATA_TX_LVL_1_240_V (0x1f << 2) 363#define IMX6Q_GPR13_SATA_TX_LVL_1_240_V (0x1f << 2)
364#define IMX6Q_GPR13_SATA_MPLL_CLK_EN BIT(1) 364#define IMX6Q_GPR13_SATA_MPLL_CLK_EN BIT(1)
365#define IMX6Q_GPR13_SATA_TX_EDGE_RATE BIT(0) 365#define IMX6Q_GPR13_SATA_TX_EDGE_RATE BIT(0)
366
367/* For imx6sl iomux gpr register field define */
368#define IMX6SL_GPR1_FEC_CLOCK_MUX1_SEL_MASK (0x3 << 17)
369#define IMX6SL_GPR1_FEC_CLOCK_MUX2_SEL_MASK (0x1 << 14)
370
366#endif /* __LINUX_IMX6Q_IOMUXC_GPR_H */ 371#endif /* __LINUX_IMX6Q_IOMUXC_GPR_H */
diff --git a/include/linux/mfd/ti_am335x_tscadc.h b/include/linux/mfd/ti_am335x_tscadc.h
index 25f2c611ab01..08cce7f96ab9 100644
--- a/include/linux/mfd/ti_am335x_tscadc.h
+++ b/include/linux/mfd/ti_am335x_tscadc.h
@@ -46,16 +46,24 @@
46/* Step Enable */ 46/* Step Enable */
47#define STEPENB_MASK (0x1FFFF << 0) 47#define STEPENB_MASK (0x1FFFF << 0)
48#define STEPENB(val) ((val) << 0) 48#define STEPENB(val) ((val) << 0)
49#define ENB(val) (1 << (val))
50#define STPENB_STEPENB STEPENB(0x1FFFF)
51#define STPENB_STEPENB_TC STEPENB(0x1FFF)
49 52
50/* IRQ enable */ 53/* IRQ enable */
51#define IRQENB_HW_PEN BIT(0) 54#define IRQENB_HW_PEN BIT(0)
52#define IRQENB_FIFO0THRES BIT(2) 55#define IRQENB_FIFO0THRES BIT(2)
56#define IRQENB_FIFO0OVRRUN BIT(3)
57#define IRQENB_FIFO0UNDRFLW BIT(4)
53#define IRQENB_FIFO1THRES BIT(5) 58#define IRQENB_FIFO1THRES BIT(5)
59#define IRQENB_FIFO1OVRRUN BIT(6)
60#define IRQENB_FIFO1UNDRFLW BIT(7)
54#define IRQENB_PENUP BIT(9) 61#define IRQENB_PENUP BIT(9)
55 62
56/* Step Configuration */ 63/* Step Configuration */
57#define STEPCONFIG_MODE_MASK (3 << 0) 64#define STEPCONFIG_MODE_MASK (3 << 0)
58#define STEPCONFIG_MODE(val) ((val) << 0) 65#define STEPCONFIG_MODE(val) ((val) << 0)
66#define STEPCONFIG_MODE_SWCNT STEPCONFIG_MODE(1)
59#define STEPCONFIG_MODE_HWSYNC STEPCONFIG_MODE(2) 67#define STEPCONFIG_MODE_HWSYNC STEPCONFIG_MODE(2)
60#define STEPCONFIG_AVG_MASK (7 << 2) 68#define STEPCONFIG_AVG_MASK (7 << 2)
61#define STEPCONFIG_AVG(val) ((val) << 2) 69#define STEPCONFIG_AVG(val) ((val) << 2)
@@ -123,6 +131,7 @@
123#define ADC_CLK 3000000 131#define ADC_CLK 3000000
124#define TOTAL_STEPS 16 132#define TOTAL_STEPS 16
125#define TOTAL_CHANNELS 8 133#define TOTAL_CHANNELS 8
134#define FIFO1_THRESHOLD 19
126 135
127/* 136/*
128* ADC runs at 3MHz, and it takes 137* ADC runs at 3MHz, and it takes
diff --git a/include/linux/migrate.h b/include/linux/migrate.h
index 8d3c57fdf221..f5096b58b20d 100644
--- a/include/linux/migrate.h
+++ b/include/linux/migrate.h
@@ -90,11 +90,12 @@ static inline int migrate_huge_page_move_mapping(struct address_space *mapping,
90#endif /* CONFIG_MIGRATION */ 90#endif /* CONFIG_MIGRATION */
91 91
92#ifdef CONFIG_NUMA_BALANCING 92#ifdef CONFIG_NUMA_BALANCING
93extern int migrate_misplaced_page(struct page *page, int node); 93extern int migrate_misplaced_page(struct page *page,
94extern int migrate_misplaced_page(struct page *page, int node); 94 struct vm_area_struct *vma, int node);
95extern bool migrate_ratelimited(int node); 95extern bool migrate_ratelimited(int node);
96#else 96#else
97static inline int migrate_misplaced_page(struct page *page, int node) 97static inline int migrate_misplaced_page(struct page *page,
98 struct vm_area_struct *vma, int node)
98{ 99{
99 return -EAGAIN; /* can't migrate now */ 100 return -EAGAIN; /* can't migrate now */
100} 101}
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 8b6e55ee8855..8aa4006b9636 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -297,12 +297,26 @@ static inline int put_page_testzero(struct page *page)
297/* 297/*
298 * Try to grab a ref unless the page has a refcount of zero, return false if 298 * Try to grab a ref unless the page has a refcount of zero, return false if
299 * that is the case. 299 * that is the case.
300 * This can be called when MMU is off so it must not access
301 * any of the virtual mappings.
300 */ 302 */
301static inline int get_page_unless_zero(struct page *page) 303static inline int get_page_unless_zero(struct page *page)
302{ 304{
303 return atomic_inc_not_zero(&page->_count); 305 return atomic_inc_not_zero(&page->_count);
304} 306}
305 307
308/*
309 * Try to drop a ref unless the page has a refcount of one, return false if
310 * that is the case.
311 * This is to make sure that the refcount won't become zero after this drop.
312 * This can be called when MMU is off so it must not access
313 * any of the virtual mappings.
314 */
315static inline int put_page_unless_one(struct page *page)
316{
317 return atomic_add_unless(&page->_count, -1, 1);
318}
319
306extern int page_is_ram(unsigned long pfn); 320extern int page_is_ram(unsigned long pfn);
307 321
308/* Support for virtually mapped pages */ 322/* Support for virtually mapped pages */
@@ -581,11 +595,11 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
581 * sets it, so none of the operations on it need to be atomic. 595 * sets it, so none of the operations on it need to be atomic.
582 */ 596 */
583 597
584/* Page flags: | [SECTION] | [NODE] | ZONE | [LAST_NID] | ... | FLAGS | */ 598/* Page flags: | [SECTION] | [NODE] | ZONE | [LAST_CPUPID] | ... | FLAGS | */
585#define SECTIONS_PGOFF ((sizeof(unsigned long)*8) - SECTIONS_WIDTH) 599#define SECTIONS_PGOFF ((sizeof(unsigned long)*8) - SECTIONS_WIDTH)
586#define NODES_PGOFF (SECTIONS_PGOFF - NODES_WIDTH) 600#define NODES_PGOFF (SECTIONS_PGOFF - NODES_WIDTH)
587#define ZONES_PGOFF (NODES_PGOFF - ZONES_WIDTH) 601#define ZONES_PGOFF (NODES_PGOFF - ZONES_WIDTH)
588#define LAST_NID_PGOFF (ZONES_PGOFF - LAST_NID_WIDTH) 602#define LAST_CPUPID_PGOFF (ZONES_PGOFF - LAST_CPUPID_WIDTH)
589 603
590/* 604/*
591 * Define the bit shifts to access each section. For non-existent 605 * Define the bit shifts to access each section. For non-existent
@@ -595,7 +609,7 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
595#define SECTIONS_PGSHIFT (SECTIONS_PGOFF * (SECTIONS_WIDTH != 0)) 609#define SECTIONS_PGSHIFT (SECTIONS_PGOFF * (SECTIONS_WIDTH != 0))
596#define NODES_PGSHIFT (NODES_PGOFF * (NODES_WIDTH != 0)) 610#define NODES_PGSHIFT (NODES_PGOFF * (NODES_WIDTH != 0))
597#define ZONES_PGSHIFT (ZONES_PGOFF * (ZONES_WIDTH != 0)) 611#define ZONES_PGSHIFT (ZONES_PGOFF * (ZONES_WIDTH != 0))
598#define LAST_NID_PGSHIFT (LAST_NID_PGOFF * (LAST_NID_WIDTH != 0)) 612#define LAST_CPUPID_PGSHIFT (LAST_CPUPID_PGOFF * (LAST_CPUPID_WIDTH != 0))
599 613
600/* NODE:ZONE or SECTION:ZONE is used to ID a zone for the buddy allocator */ 614/* NODE:ZONE or SECTION:ZONE is used to ID a zone for the buddy allocator */
601#ifdef NODE_NOT_IN_PAGE_FLAGS 615#ifdef NODE_NOT_IN_PAGE_FLAGS
@@ -617,7 +631,7 @@ static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
617#define ZONES_MASK ((1UL << ZONES_WIDTH) - 1) 631#define ZONES_MASK ((1UL << ZONES_WIDTH) - 1)
618#define NODES_MASK ((1UL << NODES_WIDTH) - 1) 632#define NODES_MASK ((1UL << NODES_WIDTH) - 1)
619#define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1) 633#define SECTIONS_MASK ((1UL << SECTIONS_WIDTH) - 1)
620#define LAST_NID_MASK ((1UL << LAST_NID_WIDTH) - 1) 634#define LAST_CPUPID_MASK ((1UL << LAST_CPUPID_WIDTH) - 1)
621#define ZONEID_MASK ((1UL << ZONEID_SHIFT) - 1) 635#define ZONEID_MASK ((1UL << ZONEID_SHIFT) - 1)
622 636
623static inline enum zone_type page_zonenum(const struct page *page) 637static inline enum zone_type page_zonenum(const struct page *page)
@@ -661,51 +675,117 @@ static inline int page_to_nid(const struct page *page)
661#endif 675#endif
662 676
663#ifdef CONFIG_NUMA_BALANCING 677#ifdef CONFIG_NUMA_BALANCING
664#ifdef LAST_NID_NOT_IN_PAGE_FLAGS 678static inline int cpu_pid_to_cpupid(int cpu, int pid)
665static inline int page_nid_xchg_last(struct page *page, int nid)
666{ 679{
667 return xchg(&page->_last_nid, nid); 680 return ((cpu & LAST__CPU_MASK) << LAST__PID_SHIFT) | (pid & LAST__PID_MASK);
668} 681}
669 682
670static inline int page_nid_last(struct page *page) 683static inline int cpupid_to_pid(int cpupid)
671{ 684{
672 return page->_last_nid; 685 return cpupid & LAST__PID_MASK;
673} 686}
674static inline void page_nid_reset_last(struct page *page) 687
688static inline int cpupid_to_cpu(int cpupid)
675{ 689{
676 page->_last_nid = -1; 690 return (cpupid >> LAST__PID_SHIFT) & LAST__CPU_MASK;
677} 691}
678#else 692
679static inline int page_nid_last(struct page *page) 693static inline int cpupid_to_nid(int cpupid)
694{
695 return cpu_to_node(cpupid_to_cpu(cpupid));
696}
697
698static inline bool cpupid_pid_unset(int cpupid)
680{ 699{
681 return (page->flags >> LAST_NID_PGSHIFT) & LAST_NID_MASK; 700 return cpupid_to_pid(cpupid) == (-1 & LAST__PID_MASK);
682} 701}
683 702
684extern int page_nid_xchg_last(struct page *page, int nid); 703static inline bool cpupid_cpu_unset(int cpupid)
704{
705 return cpupid_to_cpu(cpupid) == (-1 & LAST__CPU_MASK);
706}
707
708static inline bool __cpupid_match_pid(pid_t task_pid, int cpupid)
709{
710 return (task_pid & LAST__PID_MASK) == cpupid_to_pid(cpupid);
711}
685 712
686static inline void page_nid_reset_last(struct page *page) 713#define cpupid_match_pid(task, cpupid) __cpupid_match_pid(task->pid, cpupid)
714#ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS
715static inline int page_cpupid_xchg_last(struct page *page, int cpupid)
687{ 716{
688 int nid = (1 << LAST_NID_SHIFT) - 1; 717 return xchg(&page->_last_cpupid, cpupid);
718}
689 719
690 page->flags &= ~(LAST_NID_MASK << LAST_NID_PGSHIFT); 720static inline int page_cpupid_last(struct page *page)
691 page->flags |= (nid & LAST_NID_MASK) << LAST_NID_PGSHIFT; 721{
722 return page->_last_cpupid;
723}
724static inline void page_cpupid_reset_last(struct page *page)
725{
726 page->_last_cpupid = -1;
692} 727}
693#endif /* LAST_NID_NOT_IN_PAGE_FLAGS */
694#else 728#else
695static inline int page_nid_xchg_last(struct page *page, int nid) 729static inline int page_cpupid_last(struct page *page)
696{ 730{
697 return page_to_nid(page); 731 return (page->flags >> LAST_CPUPID_PGSHIFT) & LAST_CPUPID_MASK;
698} 732}
699 733
700static inline int page_nid_last(struct page *page) 734extern int page_cpupid_xchg_last(struct page *page, int cpupid);
735
736static inline void page_cpupid_reset_last(struct page *page)
701{ 737{
702 return page_to_nid(page); 738 int cpupid = (1 << LAST_CPUPID_SHIFT) - 1;
739
740 page->flags &= ~(LAST_CPUPID_MASK << LAST_CPUPID_PGSHIFT);
741 page->flags |= (cpupid & LAST_CPUPID_MASK) << LAST_CPUPID_PGSHIFT;
742}
743#endif /* LAST_CPUPID_NOT_IN_PAGE_FLAGS */
744#else /* !CONFIG_NUMA_BALANCING */
745static inline int page_cpupid_xchg_last(struct page *page, int cpupid)
746{
747 return page_to_nid(page); /* XXX */
703} 748}
704 749
705static inline void page_nid_reset_last(struct page *page) 750static inline int page_cpupid_last(struct page *page)
706{ 751{
752 return page_to_nid(page); /* XXX */
707} 753}
708#endif 754
755static inline int cpupid_to_nid(int cpupid)
756{
757 return -1;
758}
759
760static inline int cpupid_to_pid(int cpupid)
761{
762 return -1;
763}
764
765static inline int cpupid_to_cpu(int cpupid)
766{
767 return -1;
768}
769
770static inline int cpu_pid_to_cpupid(int nid, int pid)
771{
772 return -1;
773}
774
775static inline bool cpupid_pid_unset(int cpupid)
776{
777 return 1;
778}
779
780static inline void page_cpupid_reset_last(struct page *page)
781{
782}
783
784static inline bool cpupid_match_pid(struct task_struct *task, int cpupid)
785{
786 return false;
787}
788#endif /* CONFIG_NUMA_BALANCING */
709 789
710static inline struct zone *page_zone(const struct page *page) 790static inline struct zone *page_zone(const struct page *page)
711{ 791{
diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
index d9851eeb6e1d..a3198e5aaf4e 100644
--- a/include/linux/mm_types.h
+++ b/include/linux/mm_types.h
@@ -174,8 +174,8 @@ struct page {
174 void *shadow; 174 void *shadow;
175#endif 175#endif
176 176
177#ifdef LAST_NID_NOT_IN_PAGE_FLAGS 177#ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS
178 int _last_nid; 178 int _last_cpupid;
179#endif 179#endif
180} 180}
181/* 181/*
@@ -420,28 +420,15 @@ struct mm_struct {
420 */ 420 */
421 unsigned long numa_next_scan; 421 unsigned long numa_next_scan;
422 422
423 /* numa_next_reset is when the PTE scanner period will be reset */
424 unsigned long numa_next_reset;
425
426 /* Restart point for scanning and setting pte_numa */ 423 /* Restart point for scanning and setting pte_numa */
427 unsigned long numa_scan_offset; 424 unsigned long numa_scan_offset;
428 425
429 /* numa_scan_seq prevents two threads setting pte_numa */ 426 /* numa_scan_seq prevents two threads setting pte_numa */
430 int numa_scan_seq; 427 int numa_scan_seq;
431
432 /*
433 * The first node a task was scheduled on. If a task runs on
434 * a different node than Make PTE Scan Go Now.
435 */
436 int first_nid;
437#endif 428#endif
438 struct uprobes_state uprobes_state; 429 struct uprobes_state uprobes_state;
439}; 430};
440 431
441/* first nid will either be a valid NID or one of these values */
442#define NUMA_PTE_SCAN_INIT -1
443#define NUMA_PTE_SCAN_ACTIVE -2
444
445static inline void mm_init_cpumask(struct mm_struct *mm) 432static inline void mm_init_cpumask(struct mm_struct *mm)
446{ 433{
447#ifdef CONFIG_CPUMASK_OFFSTACK 434#ifdef CONFIG_CPUMASK_OFFSTACK
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 25f5d2d11e7c..adf4070586d6 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2874,8 +2874,20 @@ extern int __init dev_proc_init(void);
2874#define dev_proc_init() 0 2874#define dev_proc_init() 0
2875#endif 2875#endif
2876 2876
2877extern int netdev_class_create_file(struct class_attribute *class_attr); 2877extern int netdev_class_create_file_ns(struct class_attribute *class_attr,
2878extern void netdev_class_remove_file(struct class_attribute *class_attr); 2878 const void *ns);
2879extern void netdev_class_remove_file_ns(struct class_attribute *class_attr,
2880 const void *ns);
2881
2882static inline int netdev_class_create_file(struct class_attribute *class_attr)
2883{
2884 return netdev_class_create_file_ns(class_attr, NULL);
2885}
2886
2887static inline void netdev_class_remove_file(struct class_attribute *class_attr)
2888{
2889 netdev_class_remove_file_ns(class_attr, NULL);
2890}
2879 2891
2880extern struct kobj_ns_type_operations net_ns_type_operations; 2892extern struct kobj_ns_type_operations net_ns_type_operations;
2881 2893
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h
index f3c7c24bec1c..fbfdb9d8d3a7 100644
--- a/include/linux/netpoll.h
+++ b/include/linux/netpoll.h
@@ -24,7 +24,8 @@ struct netpoll {
24 struct net_device *dev; 24 struct net_device *dev;
25 char dev_name[IFNAMSIZ]; 25 char dev_name[IFNAMSIZ];
26 const char *name; 26 const char *name;
27 void (*rx_hook)(struct netpoll *, int, char *, int); 27 void (*rx_skb_hook)(struct netpoll *np, int source, struct sk_buff *skb,
28 int offset, int len);
28 29
29 union inet_addr local_ip, remote_ip; 30 union inet_addr local_ip, remote_ip;
30 bool ipv6; 31 bool ipv6;
@@ -41,7 +42,7 @@ struct netpoll_info {
41 unsigned long rx_flags; 42 unsigned long rx_flags;
42 spinlock_t rx_lock; 43 spinlock_t rx_lock;
43 struct semaphore dev_lock; 44 struct semaphore dev_lock;
44 struct list_head rx_np; /* netpolls that registered an rx_hook */ 45 struct list_head rx_np; /* netpolls that registered an rx_skb_hook */
45 46
46 struct sk_buff_head neigh_tx; /* list of neigh requests to reply to */ 47 struct sk_buff_head neigh_tx; /* list of neigh requests to reply to */
47 struct sk_buff_head txq; 48 struct sk_buff_head txq;
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index e36dee52f224..c6f41b616965 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -395,7 +395,9 @@ enum lock_type4 {
395#define FATTR4_WORD1_FS_LAYOUT_TYPES (1UL << 30) 395#define FATTR4_WORD1_FS_LAYOUT_TYPES (1UL << 30)
396#define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1) 396#define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1)
397#define FATTR4_WORD2_MDSTHRESHOLD (1UL << 4) 397#define FATTR4_WORD2_MDSTHRESHOLD (1UL << 4)
398#define FATTR4_WORD2_SECURITY_LABEL (1UL << 17) 398#define FATTR4_WORD2_SECURITY_LABEL (1UL << 16)
399#define FATTR4_WORD2_CHANGE_SECURITY_LABEL \
400 (1UL << 17)
399 401
400/* MDS threshold bitmap bits */ 402/* MDS threshold bitmap bits */
401#define THRESHOLD_RD (1UL << 0) 403#define THRESHOLD_RD (1UL << 0)
@@ -460,6 +462,7 @@ enum {
460 NFSPROC4_CLNT_FS_LOCATIONS, 462 NFSPROC4_CLNT_FS_LOCATIONS,
461 NFSPROC4_CLNT_RELEASE_LOCKOWNER, 463 NFSPROC4_CLNT_RELEASE_LOCKOWNER,
462 NFSPROC4_CLNT_SECINFO, 464 NFSPROC4_CLNT_SECINFO,
465 NFSPROC4_CLNT_FSID_PRESENT,
463 466
464 /* nfs41 */ 467 /* nfs41 */
465 NFSPROC4_CLNT_EXCHANGE_ID, 468 NFSPROC4_CLNT_EXCHANGE_ID,
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 3ea4cde8701c..14a48207a304 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -269,9 +269,13 @@ static inline int NFS_STALE(const struct inode *inode)
269 return test_bit(NFS_INO_STALE, &NFS_I(inode)->flags); 269 return test_bit(NFS_INO_STALE, &NFS_I(inode)->flags);
270} 270}
271 271
272static inline int NFS_FSCACHE(const struct inode *inode) 272static inline struct fscache_cookie *nfs_i_fscache(struct inode *inode)
273{ 273{
274 return test_bit(NFS_INO_FSCACHE, &NFS_I(inode)->flags); 274#ifdef CONFIG_NFS_FSCACHE
275 return NFS_I(inode)->fscache;
276#else
277 return NULL;
278#endif
275} 279}
276 280
277static inline __u64 NFS_FILEID(const struct inode *inode) 281static inline __u64 NFS_FILEID(const struct inode *inode)
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index b8cedced50c9..1150ea41b626 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -41,6 +41,7 @@ struct nfs_client {
41#define NFS_CS_DISCRTRY 1 /* - disconnect on RPC retry */ 41#define NFS_CS_DISCRTRY 1 /* - disconnect on RPC retry */
42#define NFS_CS_MIGRATION 2 /* - transparent state migr */ 42#define NFS_CS_MIGRATION 2 /* - transparent state migr */
43#define NFS_CS_INFINITE_SLOTS 3 /* - don't limit TCP slots */ 43#define NFS_CS_INFINITE_SLOTS 3 /* - don't limit TCP slots */
44#define NFS_CS_NO_RETRANS_TIMEOUT 4 /* - Disable retransmit timeouts */
44 struct sockaddr_storage cl_addr; /* server identifier */ 45 struct sockaddr_storage cl_addr; /* server identifier */
45 size_t cl_addrlen; 46 size_t cl_addrlen;
46 char * cl_hostname; /* hostname of server */ 47 char * cl_hostname; /* hostname of server */
@@ -78,6 +79,7 @@ struct nfs_client {
78 char cl_ipaddr[48]; 79 char cl_ipaddr[48];
79 u32 cl_cb_ident; /* v4.0 callback identifier */ 80 u32 cl_cb_ident; /* v4.0 callback identifier */
80 const struct nfs4_minor_version_ops *cl_mvops; 81 const struct nfs4_minor_version_ops *cl_mvops;
82 unsigned long cl_mig_gen;
81 83
82 /* NFSv4.0 transport blocking */ 84 /* NFSv4.0 transport blocking */
83 struct nfs4_slot_table *cl_slot_tbl; 85 struct nfs4_slot_table *cl_slot_tbl;
@@ -147,7 +149,9 @@ struct nfs_server {
147 __u64 maxfilesize; /* maximum file size */ 149 __u64 maxfilesize; /* maximum file size */
148 struct timespec time_delta; /* smallest time granularity */ 150 struct timespec time_delta; /* smallest time granularity */
149 unsigned long mount_time; /* when this fs was mounted */ 151 unsigned long mount_time; /* when this fs was mounted */
152 struct super_block *super; /* VFS super block */
150 dev_t s_dev; /* superblock dev numbers */ 153 dev_t s_dev; /* superblock dev numbers */
154 struct nfs_auth_info auth_info; /* parsed auth flavors */
151 155
152#ifdef CONFIG_NFS_FSCACHE 156#ifdef CONFIG_NFS_FSCACHE
153 struct nfs_fscache_key *fscache_key; /* unique key for superblock */ 157 struct nfs_fscache_key *fscache_key; /* unique key for superblock */
@@ -187,6 +191,12 @@ struct nfs_server {
187 struct list_head state_owners_lru; 191 struct list_head state_owners_lru;
188 struct list_head layouts; 192 struct list_head layouts;
189 struct list_head delegations; 193 struct list_head delegations;
194
195 unsigned long mig_gen;
196 unsigned long mig_status;
197#define NFS_MIG_IN_TRANSITION (1)
198#define NFS_MIG_FAILED (2)
199
190 void (*destroy)(struct nfs_server *); 200 void (*destroy)(struct nfs_server *);
191 201
192 atomic_t active; /* Keep trace of any activity to this server */ 202 atomic_t active; /* Keep trace of any activity to this server */
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 49f52c8f4422..3ccfcecf8999 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -591,6 +591,13 @@ struct nfs_renameres {
591 struct nfs_fattr *new_fattr; 591 struct nfs_fattr *new_fattr;
592}; 592};
593 593
594/* parsed sec= options */
595#define NFS_AUTH_INFO_MAX_FLAVORS 12 /* see fs/nfs/super.c */
596struct nfs_auth_info {
597 unsigned int flavor_len;
598 rpc_authflavor_t flavors[NFS_AUTH_INFO_MAX_FLAVORS];
599};
600
594/* 601/*
595 * Argument struct for decode_entry function 602 * Argument struct for decode_entry function
596 */ 603 */
@@ -1053,14 +1060,18 @@ struct nfs4_fs_locations {
1053struct nfs4_fs_locations_arg { 1060struct nfs4_fs_locations_arg {
1054 struct nfs4_sequence_args seq_args; 1061 struct nfs4_sequence_args seq_args;
1055 const struct nfs_fh *dir_fh; 1062 const struct nfs_fh *dir_fh;
1063 const struct nfs_fh *fh;
1056 const struct qstr *name; 1064 const struct qstr *name;
1057 struct page *page; 1065 struct page *page;
1058 const u32 *bitmask; 1066 const u32 *bitmask;
1067 clientid4 clientid;
1068 unsigned char migration:1, renew:1;
1059}; 1069};
1060 1070
1061struct nfs4_fs_locations_res { 1071struct nfs4_fs_locations_res {
1062 struct nfs4_sequence_res seq_res; 1072 struct nfs4_sequence_res seq_res;
1063 struct nfs4_fs_locations *fs_locations; 1073 struct nfs4_fs_locations *fs_locations;
1074 unsigned char migration:1, renew:1;
1064}; 1075};
1065 1076
1066struct nfs4_secinfo4 { 1077struct nfs4_secinfo4 {
@@ -1084,6 +1095,19 @@ struct nfs4_secinfo_res {
1084 struct nfs4_secinfo_flavors *flavors; 1095 struct nfs4_secinfo_flavors *flavors;
1085}; 1096};
1086 1097
1098struct nfs4_fsid_present_arg {
1099 struct nfs4_sequence_args seq_args;
1100 const struct nfs_fh *fh;
1101 clientid4 clientid;
1102 unsigned char renew:1;
1103};
1104
1105struct nfs4_fsid_present_res {
1106 struct nfs4_sequence_res seq_res;
1107 struct nfs_fh *fh;
1108 unsigned char renew:1;
1109};
1110
1087#endif /* CONFIG_NFS_V4 */ 1111#endif /* CONFIG_NFS_V4 */
1088 1112
1089struct nfstime4 { 1113struct nfstime4 {
diff --git a/include/linux/of.h b/include/linux/of.h
index f95aee391e30..c08c07e249b3 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -226,6 +226,8 @@ static inline int of_get_child_count(const struct device_node *np)
226 return num; 226 return num;
227} 227}
228 228
229/* cache lookup */
230extern struct device_node *of_find_next_cache_node(const struct device_node *);
229extern struct device_node *of_find_node_with_property( 231extern struct device_node *of_find_node_with_property(
230 struct device_node *from, const char *prop_name); 232 struct device_node *from, const char *prop_name);
231#define for_each_node_with_property(dn, prop_name) \ 233#define for_each_node_with_property(dn, prop_name) \
diff --git a/include/linux/page-flags-layout.h b/include/linux/page-flags-layout.h
index 93506a114034..da523661500a 100644
--- a/include/linux/page-flags-layout.h
+++ b/include/linux/page-flags-layout.h
@@ -38,10 +38,10 @@
38 * The last is when there is insufficient space in page->flags and a separate 38 * The last is when there is insufficient space in page->flags and a separate
39 * lookup is necessary. 39 * lookup is necessary.
40 * 40 *
41 * No sparsemem or sparsemem vmemmap: | NODE | ZONE | ... | FLAGS | 41 * No sparsemem or sparsemem vmemmap: | NODE | ZONE | ... | FLAGS |
42 * " plus space for last_nid: | NODE | ZONE | LAST_NID ... | FLAGS | 42 * " plus space for last_cpupid: | NODE | ZONE | LAST_CPUPID ... | FLAGS |
43 * classic sparse with space for node:| SECTION | NODE | ZONE | ... | FLAGS | 43 * classic sparse with space for node:| SECTION | NODE | ZONE | ... | FLAGS |
44 * " plus space for last_nid: | SECTION | NODE | ZONE | LAST_NID ... | FLAGS | 44 * " plus space for last_cpupid: | SECTION | NODE | ZONE | LAST_CPUPID ... | FLAGS |
45 * classic sparse no space for node: | SECTION | ZONE | ... | FLAGS | 45 * classic sparse no space for node: | SECTION | ZONE | ... | FLAGS |
46 */ 46 */
47#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP) 47#if defined(CONFIG_SPARSEMEM) && !defined(CONFIG_SPARSEMEM_VMEMMAP)
@@ -62,15 +62,21 @@
62#endif 62#endif
63 63
64#ifdef CONFIG_NUMA_BALANCING 64#ifdef CONFIG_NUMA_BALANCING
65#define LAST_NID_SHIFT NODES_SHIFT 65#define LAST__PID_SHIFT 8
66#define LAST__PID_MASK ((1 << LAST__PID_SHIFT)-1)
67
68#define LAST__CPU_SHIFT NR_CPUS_BITS
69#define LAST__CPU_MASK ((1 << LAST__CPU_SHIFT)-1)
70
71#define LAST_CPUPID_SHIFT (LAST__PID_SHIFT+LAST__CPU_SHIFT)
66#else 72#else
67#define LAST_NID_SHIFT 0 73#define LAST_CPUPID_SHIFT 0
68#endif 74#endif
69 75
70#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT+LAST_NID_SHIFT <= BITS_PER_LONG - NR_PAGEFLAGS 76#if SECTIONS_WIDTH+ZONES_WIDTH+NODES_SHIFT+LAST_CPUPID_SHIFT <= BITS_PER_LONG - NR_PAGEFLAGS
71#define LAST_NID_WIDTH LAST_NID_SHIFT 77#define LAST_CPUPID_WIDTH LAST_CPUPID_SHIFT
72#else 78#else
73#define LAST_NID_WIDTH 0 79#define LAST_CPUPID_WIDTH 0
74#endif 80#endif
75 81
76/* 82/*
@@ -81,8 +87,8 @@
81#define NODE_NOT_IN_PAGE_FLAGS 87#define NODE_NOT_IN_PAGE_FLAGS
82#endif 88#endif
83 89
84#if defined(CONFIG_NUMA_BALANCING) && LAST_NID_WIDTH == 0 90#if defined(CONFIG_NUMA_BALANCING) && LAST_CPUPID_WIDTH == 0
85#define LAST_NID_NOT_IN_PAGE_FLAGS 91#define LAST_CPUPID_NOT_IN_PAGE_FLAGS
86#endif 92#endif
87 93
88#endif /* _LINUX_PAGE_FLAGS_LAYOUT */ 94#endif /* _LINUX_PAGE_FLAGS_LAYOUT */
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index 6d53675c2b54..98ada58f9942 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -329,7 +329,9 @@ static inline void set_page_writeback(struct page *page)
329 * System with lots of page flags available. This allows separate 329 * System with lots of page flags available. This allows separate
330 * flags for PageHead() and PageTail() checks of compound pages so that bit 330 * flags for PageHead() and PageTail() checks of compound pages so that bit
331 * tests can be used in performance sensitive paths. PageCompound is 331 * tests can be used in performance sensitive paths. PageCompound is
332 * generally not used in hot code paths. 332 * generally not used in hot code paths except arch/powerpc/mm/init_64.c
333 * and arch/powerpc/kvm/book3s_64_vio_hv.c which use it to detect huge pages
334 * and avoid handling those in real mode.
333 */ 335 */
334__PAGEFLAG(Head, head) CLEARPAGEFLAG(Head, head) 336__PAGEFLAG(Head, head) CLEARPAGEFLAG(Head, head)
335__PAGEFLAG(Tail, tail) 337__PAGEFLAG(Tail, tail)
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index c8ba627c1d60..2e069d1288df 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -584,6 +584,10 @@ struct perf_sample_data {
584 struct perf_regs_user regs_user; 584 struct perf_regs_user regs_user;
585 u64 stack_user_size; 585 u64 stack_user_size;
586 u64 weight; 586 u64 weight;
587 /*
588 * Transaction flags for abort events:
589 */
590 u64 txn;
587}; 591};
588 592
589static inline void perf_sample_data_init(struct perf_sample_data *data, 593static inline void perf_sample_data_init(struct perf_sample_data *data,
@@ -599,6 +603,7 @@ static inline void perf_sample_data_init(struct perf_sample_data *data,
599 data->stack_user_size = 0; 603 data->stack_user_size = 0;
600 data->weight = 0; 604 data->weight = 0;
601 data->data_src.val = 0; 605 data->data_src.val = 0;
606 data->txn = 0;
602} 607}
603 608
604extern void perf_output_sample(struct perf_output_handle *handle, 609extern void perf_output_sample(struct perf_output_handle *handle,
diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
new file mode 100644
index 000000000000..6d722695e027
--- /dev/null
+++ b/include/linux/phy/phy.h
@@ -0,0 +1,270 @@
1/*
2 * phy.h -- generic phy header file
3 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
5 *
6 * Author: Kishon Vijay Abraham I <kishon@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13
14#ifndef __DRIVERS_PHY_H
15#define __DRIVERS_PHY_H
16
17#include <linux/err.h>
18#include <linux/of.h>
19#include <linux/device.h>
20#include <linux/pm_runtime.h>
21
22struct phy;
23
24/**
25 * struct phy_ops - set of function pointers for performing phy operations
26 * @init: operation to be performed for initializing phy
27 * @exit: operation to be performed while exiting
28 * @power_on: powering on the phy
29 * @power_off: powering off the phy
30 * @owner: the module owner containing the ops
31 */
32struct phy_ops {
33 int (*init)(struct phy *phy);
34 int (*exit)(struct phy *phy);
35 int (*power_on)(struct phy *phy);
36 int (*power_off)(struct phy *phy);
37 struct module *owner;
38};
39
40/**
41 * struct phy - represents the phy device
42 * @dev: phy device
43 * @id: id of the phy device
44 * @ops: function pointers for performing phy operations
45 * @init_data: list of PHY consumers (non-dt only)
46 * @mutex: mutex to protect phy_ops
47 * @init_count: used to protect when the PHY is used by multiple consumers
48 * @power_count: used to protect when the PHY is used by multiple consumers
49 */
50struct phy {
51 struct device dev;
52 int id;
53 const struct phy_ops *ops;
54 struct phy_init_data *init_data;
55 struct mutex mutex;
56 int init_count;
57 int power_count;
58};
59
60/**
61 * struct phy_provider - represents the phy provider
62 * @dev: phy provider device
63 * @owner: the module owner having of_xlate
64 * @of_xlate: function pointer to obtain phy instance from phy pointer
65 * @list: to maintain a linked list of PHY providers
66 */
67struct phy_provider {
68 struct device *dev;
69 struct module *owner;
70 struct list_head list;
71 struct phy * (*of_xlate)(struct device *dev,
72 struct of_phandle_args *args);
73};
74
75/**
76 * struct phy_consumer - represents the phy consumer
77 * @dev_name: the device name of the controller that will use this PHY device
78 * @port: name given to the consumer port
79 */
80struct phy_consumer {
81 const char *dev_name;
82 const char *port;
83};
84
85/**
86 * struct phy_init_data - contains the list of PHY consumers
87 * @num_consumers: number of consumers for this PHY device
88 * @consumers: list of PHY consumers
89 */
90struct phy_init_data {
91 unsigned int num_consumers;
92 struct phy_consumer *consumers;
93};
94
95#define PHY_CONSUMER(_dev_name, _port) \
96{ \
97 .dev_name = _dev_name, \
98 .port = _port, \
99}
100
101#define to_phy(dev) (container_of((dev), struct phy, dev))
102
103#define of_phy_provider_register(dev, xlate) \
104 __of_phy_provider_register((dev), THIS_MODULE, (xlate))
105
106#define devm_of_phy_provider_register(dev, xlate) \
107 __devm_of_phy_provider_register((dev), THIS_MODULE, (xlate))
108
109static inline void phy_set_drvdata(struct phy *phy, void *data)
110{
111 dev_set_drvdata(&phy->dev, data);
112}
113
114static inline void *phy_get_drvdata(struct phy *phy)
115{
116 return dev_get_drvdata(&phy->dev);
117}
118
119#if IS_ENABLED(CONFIG_GENERIC_PHY)
120int phy_pm_runtime_get(struct phy *phy);
121int phy_pm_runtime_get_sync(struct phy *phy);
122int phy_pm_runtime_put(struct phy *phy);
123int phy_pm_runtime_put_sync(struct phy *phy);
124void phy_pm_runtime_allow(struct phy *phy);
125void phy_pm_runtime_forbid(struct phy *phy);
126int phy_init(struct phy *phy);
127int phy_exit(struct phy *phy);
128int phy_power_on(struct phy *phy);
129int phy_power_off(struct phy *phy);
130struct phy *phy_get(struct device *dev, const char *string);
131struct phy *devm_phy_get(struct device *dev, const char *string);
132void phy_put(struct phy *phy);
133void devm_phy_put(struct device *dev, struct phy *phy);
134struct phy *of_phy_simple_xlate(struct device *dev,
135 struct of_phandle_args *args);
136struct phy *phy_create(struct device *dev, const struct phy_ops *ops,
137 struct phy_init_data *init_data);
138struct phy *devm_phy_create(struct device *dev,
139 const struct phy_ops *ops, struct phy_init_data *init_data);
140void phy_destroy(struct phy *phy);
141void devm_phy_destroy(struct device *dev, struct phy *phy);
142struct phy_provider *__of_phy_provider_register(struct device *dev,
143 struct module *owner, struct phy * (*of_xlate)(struct device *dev,
144 struct of_phandle_args *args));
145struct phy_provider *__devm_of_phy_provider_register(struct device *dev,
146 struct module *owner, struct phy * (*of_xlate)(struct device *dev,
147 struct of_phandle_args *args));
148void of_phy_provider_unregister(struct phy_provider *phy_provider);
149void devm_of_phy_provider_unregister(struct device *dev,
150 struct phy_provider *phy_provider);
151#else
152static inline int phy_pm_runtime_get(struct phy *phy)
153{
154 return -ENOSYS;
155}
156
157static inline int phy_pm_runtime_get_sync(struct phy *phy)
158{
159 return -ENOSYS;
160}
161
162static inline int phy_pm_runtime_put(struct phy *phy)
163{
164 return -ENOSYS;
165}
166
167static inline int phy_pm_runtime_put_sync(struct phy *phy)
168{
169 return -ENOSYS;
170}
171
172static inline void phy_pm_runtime_allow(struct phy *phy)
173{
174 return;
175}
176
177static inline void phy_pm_runtime_forbid(struct phy *phy)
178{
179 return;
180}
181
182static inline int phy_init(struct phy *phy)
183{
184 return -ENOSYS;
185}
186
187static inline int phy_exit(struct phy *phy)
188{
189 return -ENOSYS;
190}
191
192static inline int phy_power_on(struct phy *phy)
193{
194 return -ENOSYS;
195}
196
197static inline int phy_power_off(struct phy *phy)
198{
199 return -ENOSYS;
200}
201
202static inline struct phy *phy_get(struct device *dev, const char *string)
203{
204 return ERR_PTR(-ENOSYS);
205}
206
207static inline struct phy *devm_phy_get(struct device *dev, const char *string)
208{
209 return ERR_PTR(-ENOSYS);
210}
211
212static inline void phy_put(struct phy *phy)
213{
214}
215
216static inline void devm_phy_put(struct device *dev, struct phy *phy)
217{
218}
219
220static inline struct phy *of_phy_simple_xlate(struct device *dev,
221 struct of_phandle_args *args)
222{
223 return ERR_PTR(-ENOSYS);
224}
225
226static inline struct phy *phy_create(struct device *dev,
227 const struct phy_ops *ops, struct phy_init_data *init_data)
228{
229 return ERR_PTR(-ENOSYS);
230}
231
232static inline struct phy *devm_phy_create(struct device *dev,
233 const struct phy_ops *ops, struct phy_init_data *init_data)
234{
235 return ERR_PTR(-ENOSYS);
236}
237
238static inline void phy_destroy(struct phy *phy)
239{
240}
241
242static inline void devm_phy_destroy(struct device *dev, struct phy *phy)
243{
244}
245
246static inline struct phy_provider *__of_phy_provider_register(
247 struct device *dev, struct module *owner, struct phy * (*of_xlate)(
248 struct device *dev, struct of_phandle_args *args))
249{
250 return ERR_PTR(-ENOSYS);
251}
252
253static inline struct phy_provider *__devm_of_phy_provider_register(struct device
254 *dev, struct module *owner, struct phy * (*of_xlate)(struct device *dev,
255 struct of_phandle_args *args))
256{
257 return ERR_PTR(-ENOSYS);
258}
259
260static inline void of_phy_provider_unregister(struct phy_provider *phy_provider)
261{
262}
263
264static inline void devm_of_phy_provider_unregister(struct device *dev,
265 struct phy_provider *phy_provider)
266{
267}
268#endif
269
270#endif /* __DRIVERS_PHY_H */
diff --git a/include/linux/platform_data/clk-nomadik.h b/include/linux/platform_data/clk-nomadik.h
deleted file mode 100644
index 5713c87b2477..000000000000
--- a/include/linux/platform_data/clk-nomadik.h
+++ /dev/null
@@ -1,2 +0,0 @@
1/* Minimal platform data header */
2void nomadik_clk_init(void);
diff --git a/include/linux/platform_data/clk-ux500.h b/include/linux/platform_data/clk-ux500.h
index 9d98f3aaa16c..97baf831e071 100644
--- a/include/linux/platform_data/clk-ux500.h
+++ b/include/linux/platform_data/clk-ux500.h
@@ -10,6 +10,9 @@
10#ifndef __CLK_UX500_H 10#ifndef __CLK_UX500_H
11#define __CLK_UX500_H 11#define __CLK_UX500_H
12 12
13void u8500_of_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base,
14 u32 clkrst5_base, u32 clkrst6_base);
15
13void u8500_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base, 16void u8500_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base,
14 u32 clkrst5_base, u32 clkrst6_base); 17 u32 clkrst5_base, u32 clkrst6_base);
15void u9540_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base, 18void u9540_clk_init(u32 clkrst1_base, u32 clkrst2_base, u32 clkrst3_base,
diff --git a/include/linux/platform_data/dma-s3c24xx.h b/include/linux/platform_data/dma-s3c24xx.h
new file mode 100644
index 000000000000..89ba1b0c90e4
--- /dev/null
+++ b/include/linux/platform_data/dma-s3c24xx.h
@@ -0,0 +1,46 @@
1/*
2 * S3C24XX DMA handling
3 *
4 * Copyright (c) 2013 Heiko Stuebner <heiko@sntech.de>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the Free
8 * Software Foundation; either version 2 of the License, or (at your option)
9 * any later version.
10 */
11
12/* Helper to encode the source selection constraints for early s3c socs. */
13#define S3C24XX_DMA_CHANREQ(src, chan) ((BIT(3) | src) << chan * 4)
14
15enum s3c24xx_dma_bus {
16 S3C24XX_DMA_APB,
17 S3C24XX_DMA_AHB,
18};
19
20/**
21 * @bus: on which bus does the peripheral reside - AHB or APB.
22 * @handshake: is a handshake with the peripheral necessary
23 * @chansel: channel selection information, depending on variant; reqsel for
24 * s3c2443 and later and channel-selection map for earlier SoCs
25 * see CHANSEL doc in s3c2443-dma.c
26 */
27struct s3c24xx_dma_channel {
28 enum s3c24xx_dma_bus bus;
29 bool handshake;
30 u16 chansel;
31};
32
33/**
34 * struct s3c24xx_dma_platdata - platform specific settings
35 * @num_phy_channels: number of physical channels
36 * @channels: array of virtual channel descriptions
37 * @num_channels: number of virtual channels
38 */
39struct s3c24xx_dma_platdata {
40 int num_phy_channels;
41 struct s3c24xx_dma_channel *channels;
42 int num_channels;
43};
44
45struct dma_chan;
46bool s3c24xx_dma_filter(struct dma_chan *chan, void *param);
diff --git a/include/linux/platform_data/gpio-davinci.h b/include/linux/platform_data/gpio-davinci.h
new file mode 100644
index 000000000000..6efd20264585
--- /dev/null
+++ b/include/linux/platform_data/gpio-davinci.h
@@ -0,0 +1,60 @@
1/*
2 * DaVinci GPIO Platform Related Defines
3 *
4 * Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com/
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation version 2.
9 *
10 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11 * kind, whether express or implied; without even the implied warranty
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#ifndef __DAVINCI_GPIO_PLATFORM_H
17#define __DAVINCI_GPIO_PLATFORM_H
18
19#include <linux/io.h>
20#include <linux/spinlock.h>
21
22#include <asm-generic/gpio.h>
23
24enum davinci_gpio_type {
25 GPIO_TYPE_TNETV107X = 0,
26};
27
28struct davinci_gpio_platform_data {
29 u32 ngpio;
30 u32 gpio_unbanked;
31 u32 intc_irq_num;
32};
33
34
35struct davinci_gpio_controller {
36 struct gpio_chip chip;
37 int irq_base;
38 /* Serialize access to GPIO registers */
39 spinlock_t lock;
40 void __iomem *regs;
41 void __iomem *set_data;
42 void __iomem *clr_data;
43 void __iomem *in_data;
44 int gpio_unbanked;
45 unsigned gpio_irq;
46};
47
48/*
49 * basic gpio routines
50 */
51#define GPIO(X) (X) /* 0 <= X <= (DAVINCI_N_GPIO - 1) */
52
53/* Convert GPIO signal to GPIO pin number */
54#define GPIO_TO_PIN(bank, gpio) (16 * (bank) + (gpio))
55
56static inline u32 __gpio_mask(unsigned gpio)
57{
58 return 1 << (gpio % 32);
59}
60#endif
diff --git a/include/linux/platform_data/mipi-csis.h b/include/linux/platform_data/mipi-csis.h
index bf34e17cee7f..c2fd9024717c 100644
--- a/include/linux/platform_data/mipi-csis.h
+++ b/include/linux/platform_data/mipi-csis.h
@@ -25,13 +25,4 @@ struct s5p_platform_mipi_csis {
25 u8 hs_settle; 25 u8 hs_settle;
26}; 26};
27 27
28/**
29 * s5p_csis_phy_enable - global MIPI-CSI receiver D-PHY control
30 * @id: MIPI-CSIS harware instance index (0...1)
31 * @on: true to enable D-PHY and deassert its reset
32 * false to disable D-PHY
33 * @return: 0 on success, or negative error code on failure
34 */
35int s5p_csis_phy_enable(int id, bool on);
36
37#endif /* __PLAT_SAMSUNG_MIPI_CSIS_H_ */ 28#endif /* __PLAT_SAMSUNG_MIPI_CSIS_H_ */
diff --git a/include/linux/platform_data/pinctrl-single.h b/include/linux/platform_data/pinctrl-single.h
new file mode 100644
index 000000000000..72eacda9b360
--- /dev/null
+++ b/include/linux/platform_data/pinctrl-single.h
@@ -0,0 +1,12 @@
1/**
2 * irq: optional wake-up interrupt
3 * rearm: optional soc specific rearm function
4 *
5 * Note that the irq and rearm setup should come from device
6 * tree except for omap where there are still some dependencies
7 * to the legacy PRM code.
8 */
9struct pcs_pdata {
10 int irq;
11 void (*rearm)(void);
12};
diff --git a/include/linux/platform_data/usb-ehci-s5p.h b/include/linux/platform_data/usb-ehci-s5p.h
deleted file mode 100644
index 5f28cae18582..000000000000
--- a/include/linux/platform_data/usb-ehci-s5p.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * Copyright (C) 2011 Samsung Electronics Co.Ltd
3 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10
11#ifndef __PLAT_SAMSUNG_EHCI_H
12#define __PLAT_SAMSUNG_EHCI_H __FILE__
13
14struct s5p_ehci_platdata {
15 int (*phy_init)(struct platform_device *pdev, int type);
16 int (*phy_exit)(struct platform_device *pdev, int type);
17};
18
19extern void s5p_ehci_set_platdata(struct s5p_ehci_platdata *pd);
20
21#endif /* __PLAT_SAMSUNG_EHCI_H */
diff --git a/include/linux/platform_data/usb-ohci-exynos.h b/include/linux/platform_data/usb-ohci-exynos.h
deleted file mode 100644
index c256c595be5e..000000000000
--- a/include/linux/platform_data/usb-ohci-exynos.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * Copyright (C) 2011 Samsung Electronics Co.Ltd
3 * http://www.samsung.com/
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10
11#ifndef __MACH_EXYNOS_OHCI_H
12#define __MACH_EXYNOS_OHCI_H
13
14struct exynos4_ohci_platdata {
15 int (*phy_init)(struct platform_device *pdev, int type);
16 int (*phy_exit)(struct platform_device *pdev, int type);
17};
18
19extern void exynos4_ohci_set_platdata(struct exynos4_ohci_platdata *pd);
20
21#endif /* __MACH_EXYNOS_OHCI_H */
diff --git a/include/linux/platform_data/usb-rcar-gen2-phy.h b/include/linux/platform_data/usb-rcar-gen2-phy.h
new file mode 100644
index 000000000000..dd3ba46c0d90
--- /dev/null
+++ b/include/linux/platform_data/usb-rcar-gen2-phy.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright (C) 2013 Renesas Solutions Corp.
3 * Copyright (C) 2013 Cogent Embedded, Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#ifndef __USB_RCAR_GEN2_PHY_H
11#define __USB_RCAR_GEN2_PHY_H
12
13#include <linux/types.h>
14
15struct rcar_gen2_phy_platform_data {
16 /* USB channel 0 configuration */
17 bool chan0_pci:1; /* true: PCI USB host 0, false: USBHS */
18 /* USB channel 2 configuration */
19 bool chan2_pci:1; /* true: PCI USB host 2, false: USBSS */
20};
21
22#endif
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index ce8e4ffd78c7..16f6654082dd 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -178,6 +178,7 @@ struct platform_driver {
178 int (*resume)(struct platform_device *); 178 int (*resume)(struct platform_device *);
179 struct device_driver driver; 179 struct device_driver driver;
180 const struct platform_device_id *id_table; 180 const struct platform_device_id *id_table;
181 bool prevent_deferred_probe;
181}; 182};
182 183
183#define to_platform_driver(drv) (container_of((drv), struct platform_driver, \ 184#define to_platform_driver(drv) (container_of((drv), struct platform_driver, \
diff --git a/include/linux/preempt.h b/include/linux/preempt.h
index f5d4723cdb3d..a3d9dc8c2c00 100644
--- a/include/linux/preempt.h
+++ b/include/linux/preempt.h
@@ -6,106 +6,95 @@
6 * preempt_count (used for kernel preemption, interrupt count, etc.) 6 * preempt_count (used for kernel preemption, interrupt count, etc.)
7 */ 7 */
8 8
9#include <linux/thread_info.h>
10#include <linux/linkage.h> 9#include <linux/linkage.h>
11#include <linux/list.h> 10#include <linux/list.h>
12 11
13#if defined(CONFIG_DEBUG_PREEMPT) || defined(CONFIG_PREEMPT_TRACER) 12/*
14 extern void add_preempt_count(int val); 13 * We use the MSB mostly because its available; see <linux/preempt_mask.h> for
15 extern void sub_preempt_count(int val); 14 * the other bits -- can't include that header due to inclusion hell.
16#else 15 */
17# define add_preempt_count(val) do { preempt_count() += (val); } while (0) 16#define PREEMPT_NEED_RESCHED 0x80000000
18# define sub_preempt_count(val) do { preempt_count() -= (val); } while (0)
19#endif
20
21#define inc_preempt_count() add_preempt_count(1)
22#define dec_preempt_count() sub_preempt_count(1)
23
24#define preempt_count() (current_thread_info()->preempt_count)
25
26#ifdef CONFIG_PREEMPT
27
28asmlinkage void preempt_schedule(void);
29
30#define preempt_check_resched() \
31do { \
32 if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \
33 preempt_schedule(); \
34} while (0)
35
36#ifdef CONFIG_CONTEXT_TRACKING
37 17
38void preempt_schedule_context(void); 18#include <asm/preempt.h>
39 19
40#define preempt_check_resched_context() \ 20#if defined(CONFIG_DEBUG_PREEMPT) || defined(CONFIG_PREEMPT_TRACER)
41do { \ 21extern void preempt_count_add(int val);
42 if (unlikely(test_thread_flag(TIF_NEED_RESCHED))) \ 22extern void preempt_count_sub(int val);
43 preempt_schedule_context(); \ 23#define preempt_count_dec_and_test() ({ preempt_count_sub(1); should_resched(); })
44} while (0)
45#else 24#else
25#define preempt_count_add(val) __preempt_count_add(val)
26#define preempt_count_sub(val) __preempt_count_sub(val)
27#define preempt_count_dec_and_test() __preempt_count_dec_and_test()
28#endif
46 29
47#define preempt_check_resched_context() preempt_check_resched() 30#define __preempt_count_inc() __preempt_count_add(1)
48 31#define __preempt_count_dec() __preempt_count_sub(1)
49#endif /* CONFIG_CONTEXT_TRACKING */
50
51#else /* !CONFIG_PREEMPT */
52
53#define preempt_check_resched() do { } while (0)
54#define preempt_check_resched_context() do { } while (0)
55
56#endif /* CONFIG_PREEMPT */
57 32
33#define preempt_count_inc() preempt_count_add(1)
34#define preempt_count_dec() preempt_count_sub(1)
58 35
59#ifdef CONFIG_PREEMPT_COUNT 36#ifdef CONFIG_PREEMPT_COUNT
60 37
61#define preempt_disable() \ 38#define preempt_disable() \
62do { \ 39do { \
63 inc_preempt_count(); \ 40 preempt_count_inc(); \
64 barrier(); \ 41 barrier(); \
65} while (0) 42} while (0)
66 43
67#define sched_preempt_enable_no_resched() \ 44#define sched_preempt_enable_no_resched() \
68do { \ 45do { \
69 barrier(); \ 46 barrier(); \
70 dec_preempt_count(); \ 47 preempt_count_dec(); \
71} while (0) 48} while (0)
72 49
73#define preempt_enable_no_resched() sched_preempt_enable_no_resched() 50#define preempt_enable_no_resched() sched_preempt_enable_no_resched()
74 51
52#ifdef CONFIG_PREEMPT
75#define preempt_enable() \ 53#define preempt_enable() \
76do { \ 54do { \
77 preempt_enable_no_resched(); \
78 barrier(); \ 55 barrier(); \
79 preempt_check_resched(); \ 56 if (unlikely(preempt_count_dec_and_test())) \
57 __preempt_schedule(); \
58} while (0)
59
60#define preempt_check_resched() \
61do { \
62 if (should_resched()) \
63 __preempt_schedule(); \
80} while (0) 64} while (0)
81 65
82/* For debugging and tracer internals only! */ 66#else
83#define add_preempt_count_notrace(val) \ 67#define preempt_enable() preempt_enable_no_resched()
84 do { preempt_count() += (val); } while (0) 68#define preempt_check_resched() do { } while (0)
85#define sub_preempt_count_notrace(val) \ 69#endif
86 do { preempt_count() -= (val); } while (0)
87#define inc_preempt_count_notrace() add_preempt_count_notrace(1)
88#define dec_preempt_count_notrace() sub_preempt_count_notrace(1)
89 70
90#define preempt_disable_notrace() \ 71#define preempt_disable_notrace() \
91do { \ 72do { \
92 inc_preempt_count_notrace(); \ 73 __preempt_count_inc(); \
93 barrier(); \ 74 barrier(); \
94} while (0) 75} while (0)
95 76
96#define preempt_enable_no_resched_notrace() \ 77#define preempt_enable_no_resched_notrace() \
97do { \ 78do { \
98 barrier(); \ 79 barrier(); \
99 dec_preempt_count_notrace(); \ 80 __preempt_count_dec(); \
100} while (0) 81} while (0)
101 82
102/* preempt_check_resched is OK to trace */ 83#ifdef CONFIG_PREEMPT
84
85#ifndef CONFIG_CONTEXT_TRACKING
86#define __preempt_schedule_context() __preempt_schedule()
87#endif
88
103#define preempt_enable_notrace() \ 89#define preempt_enable_notrace() \
104do { \ 90do { \
105 preempt_enable_no_resched_notrace(); \
106 barrier(); \ 91 barrier(); \
107 preempt_check_resched_context(); \ 92 if (unlikely(__preempt_count_dec_and_test())) \
93 __preempt_schedule_context(); \
108} while (0) 94} while (0)
95#else
96#define preempt_enable_notrace() preempt_enable_no_resched_notrace()
97#endif
109 98
110#else /* !CONFIG_PREEMPT_COUNT */ 99#else /* !CONFIG_PREEMPT_COUNT */
111 100
@@ -115,10 +104,11 @@ do { \
115 * that can cause faults and scheduling migrate into our preempt-protected 104 * that can cause faults and scheduling migrate into our preempt-protected
116 * region. 105 * region.
117 */ 106 */
118#define preempt_disable() barrier() 107#define preempt_disable() barrier()
119#define sched_preempt_enable_no_resched() barrier() 108#define sched_preempt_enable_no_resched() barrier()
120#define preempt_enable_no_resched() barrier() 109#define preempt_enable_no_resched() barrier()
121#define preempt_enable() barrier() 110#define preempt_enable() barrier()
111#define preempt_check_resched() do { } while (0)
122 112
123#define preempt_disable_notrace() barrier() 113#define preempt_disable_notrace() barrier()
124#define preempt_enable_no_resched_notrace() barrier() 114#define preempt_enable_no_resched_notrace() barrier()
diff --git a/include/linux/printk.h b/include/linux/printk.h
index e6131a782481..694925837a16 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -233,6 +233,8 @@ extern asmlinkage void dump_stack(void) __cold;
233 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) 233 no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
234#endif 234#endif
235 235
236#include <linux/dynamic_debug.h>
237
236/* If you are writing a driver, please use dev_dbg instead */ 238/* If you are writing a driver, please use dev_dbg instead */
237#if defined(CONFIG_DYNAMIC_DEBUG) 239#if defined(CONFIG_DYNAMIC_DEBUG)
238/* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */ 240/* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */
@@ -343,7 +345,19 @@ extern asmlinkage void dump_stack(void) __cold;
343#endif 345#endif
344 346
345/* If you are writing a driver, please use dev_dbg instead */ 347/* If you are writing a driver, please use dev_dbg instead */
346#if defined(DEBUG) 348#if defined(CONFIG_DYNAMIC_DEBUG)
349/* descriptor check is first to prevent flooding with "callbacks suppressed" */
350#define pr_debug_ratelimited(fmt, ...) \
351do { \
352 static DEFINE_RATELIMIT_STATE(_rs, \
353 DEFAULT_RATELIMIT_INTERVAL, \
354 DEFAULT_RATELIMIT_BURST); \
355 DEFINE_DYNAMIC_DEBUG_METADATA(descriptor, fmt); \
356 if (unlikely(descriptor.flags & _DPRINTK_FLAGS_PRINT) && \
357 __ratelimit(&_rs)) \
358 __dynamic_pr_debug(&descriptor, fmt, ##__VA_ARGS__); \
359} while (0)
360#elif defined(DEBUG)
347#define pr_debug_ratelimited(fmt, ...) \ 361#define pr_debug_ratelimited(fmt, ...) \
348 printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) 362 printk_ratelimited(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
349#else 363#else
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index 4106721c4e5e..45a0a9e81478 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -19,6 +19,21 @@
19 */ 19 */
20 20
21/* 21/*
22 * INIT_LIST_HEAD_RCU - Initialize a list_head visible to RCU readers
23 * @list: list to be initialized
24 *
25 * You should instead use INIT_LIST_HEAD() for normal initialization and
26 * cleanup tasks, when readers have no access to the list being initialized.
27 * However, if the list being initialized is visible to readers, you
28 * need to keep the compiler from being too mischievous.
29 */
30static inline void INIT_LIST_HEAD_RCU(struct list_head *list)
31{
32 ACCESS_ONCE(list->next) = list;
33 ACCESS_ONCE(list->prev) = list;
34}
35
36/*
22 * return the ->next pointer of a list_head in an rcu safe 37 * return the ->next pointer of a list_head in an rcu safe
23 * way, we must not access it directly 38 * way, we must not access it directly
24 */ 39 */
@@ -191,9 +206,13 @@ static inline void list_splice_init_rcu(struct list_head *list,
191 if (list_empty(list)) 206 if (list_empty(list))
192 return; 207 return;
193 208
194 /* "first" and "last" tracking list, so initialize it. */ 209 /*
210 * "first" and "last" tracking list, so initialize it. RCU readers
211 * have access to this list, so we must use INIT_LIST_HEAD_RCU()
212 * instead of INIT_LIST_HEAD().
213 */
195 214
196 INIT_LIST_HEAD(list); 215 INIT_LIST_HEAD_RCU(list);
197 216
198 /* 217 /*
199 * At this point, the list body still points to the source list. 218 * At this point, the list body still points to the source list.
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index f1f1bc39346b..39cbb889e20d 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -261,6 +261,10 @@ static inline void rcu_user_hooks_switch(struct task_struct *prev,
261 rcu_irq_exit(); \ 261 rcu_irq_exit(); \
262 } while (0) 262 } while (0)
263 263
264#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP)
265extern bool __rcu_is_watching(void);
266#endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) */
267
264/* 268/*
265 * Infrastructure to implement the synchronize_() primitives in 269 * Infrastructure to implement the synchronize_() primitives in
266 * TREE_RCU and rcu_barrier_() primitives in TINY_RCU. 270 * TREE_RCU and rcu_barrier_() primitives in TINY_RCU.
@@ -297,10 +301,6 @@ static inline void destroy_rcu_head_on_stack(struct rcu_head *head)
297} 301}
298#endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */ 302#endif /* #else !CONFIG_DEBUG_OBJECTS_RCU_HEAD */
299 303
300#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_SMP)
301extern int rcu_is_cpu_idle(void);
302#endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_SMP) */
303
304#if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) 304#if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU)
305bool rcu_lockdep_current_cpu_online(void); 305bool rcu_lockdep_current_cpu_online(void);
306#else /* #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) */ 306#else /* #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) */
@@ -351,7 +351,7 @@ static inline int rcu_read_lock_held(void)
351{ 351{
352 if (!debug_lockdep_rcu_enabled()) 352 if (!debug_lockdep_rcu_enabled())
353 return 1; 353 return 1;
354 if (rcu_is_cpu_idle()) 354 if (!rcu_is_watching())
355 return 0; 355 return 0;
356 if (!rcu_lockdep_current_cpu_online()) 356 if (!rcu_lockdep_current_cpu_online())
357 return 0; 357 return 0;
@@ -402,7 +402,7 @@ static inline int rcu_read_lock_sched_held(void)
402 402
403 if (!debug_lockdep_rcu_enabled()) 403 if (!debug_lockdep_rcu_enabled())
404 return 1; 404 return 1;
405 if (rcu_is_cpu_idle()) 405 if (!rcu_is_watching())
406 return 0; 406 return 0;
407 if (!rcu_lockdep_current_cpu_online()) 407 if (!rcu_lockdep_current_cpu_online())
408 return 0; 408 return 0;
@@ -771,7 +771,7 @@ static inline void rcu_read_lock(void)
771 __rcu_read_lock(); 771 __rcu_read_lock();
772 __acquire(RCU); 772 __acquire(RCU);
773 rcu_lock_acquire(&rcu_lock_map); 773 rcu_lock_acquire(&rcu_lock_map);
774 rcu_lockdep_assert(!rcu_is_cpu_idle(), 774 rcu_lockdep_assert(rcu_is_watching(),
775 "rcu_read_lock() used illegally while idle"); 775 "rcu_read_lock() used illegally while idle");
776} 776}
777 777
@@ -792,7 +792,7 @@ static inline void rcu_read_lock(void)
792 */ 792 */
793static inline void rcu_read_unlock(void) 793static inline void rcu_read_unlock(void)
794{ 794{
795 rcu_lockdep_assert(!rcu_is_cpu_idle(), 795 rcu_lockdep_assert(rcu_is_watching(),
796 "rcu_read_unlock() used illegally while idle"); 796 "rcu_read_unlock() used illegally while idle");
797 rcu_lock_release(&rcu_lock_map); 797 rcu_lock_release(&rcu_lock_map);
798 __release(RCU); 798 __release(RCU);
@@ -821,7 +821,7 @@ static inline void rcu_read_lock_bh(void)
821 local_bh_disable(); 821 local_bh_disable();
822 __acquire(RCU_BH); 822 __acquire(RCU_BH);
823 rcu_lock_acquire(&rcu_bh_lock_map); 823 rcu_lock_acquire(&rcu_bh_lock_map);
824 rcu_lockdep_assert(!rcu_is_cpu_idle(), 824 rcu_lockdep_assert(rcu_is_watching(),
825 "rcu_read_lock_bh() used illegally while idle"); 825 "rcu_read_lock_bh() used illegally while idle");
826} 826}
827 827
@@ -832,7 +832,7 @@ static inline void rcu_read_lock_bh(void)
832 */ 832 */
833static inline void rcu_read_unlock_bh(void) 833static inline void rcu_read_unlock_bh(void)
834{ 834{
835 rcu_lockdep_assert(!rcu_is_cpu_idle(), 835 rcu_lockdep_assert(rcu_is_watching(),
836 "rcu_read_unlock_bh() used illegally while idle"); 836 "rcu_read_unlock_bh() used illegally while idle");
837 rcu_lock_release(&rcu_bh_lock_map); 837 rcu_lock_release(&rcu_bh_lock_map);
838 __release(RCU_BH); 838 __release(RCU_BH);
@@ -857,7 +857,7 @@ static inline void rcu_read_lock_sched(void)
857 preempt_disable(); 857 preempt_disable();
858 __acquire(RCU_SCHED); 858 __acquire(RCU_SCHED);
859 rcu_lock_acquire(&rcu_sched_lock_map); 859 rcu_lock_acquire(&rcu_sched_lock_map);
860 rcu_lockdep_assert(!rcu_is_cpu_idle(), 860 rcu_lockdep_assert(rcu_is_watching(),
861 "rcu_read_lock_sched() used illegally while idle"); 861 "rcu_read_lock_sched() used illegally while idle");
862} 862}
863 863
@@ -875,7 +875,7 @@ static inline notrace void rcu_read_lock_sched_notrace(void)
875 */ 875 */
876static inline void rcu_read_unlock_sched(void) 876static inline void rcu_read_unlock_sched(void)
877{ 877{
878 rcu_lockdep_assert(!rcu_is_cpu_idle(), 878 rcu_lockdep_assert(rcu_is_watching(),
879 "rcu_read_unlock_sched() used illegally while idle"); 879 "rcu_read_unlock_sched() used illegally while idle");
880 rcu_lock_release(&rcu_sched_lock_map); 880 rcu_lock_release(&rcu_sched_lock_map);
881 __release(RCU_SCHED); 881 __release(RCU_SCHED);
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index e31005ee339e..09ebcbe9fd78 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -132,4 +132,21 @@ static inline void rcu_scheduler_starting(void)
132} 132}
133#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 133#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */
134 134
135#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE)
136
137static inline bool rcu_is_watching(void)
138{
139 return __rcu_is_watching();
140}
141
142#else /* defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) */
143
144static inline bool rcu_is_watching(void)
145{
146 return true;
147}
148
149
150#endif /* #else defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) */
151
135#endif /* __LINUX_RCUTINY_H */ 152#endif /* __LINUX_RCUTINY_H */
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index 226169d1bd2b..4b9c81548742 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -90,4 +90,6 @@ extern void exit_rcu(void);
90extern void rcu_scheduler_starting(void); 90extern void rcu_scheduler_starting(void);
91extern int rcu_scheduler_active __read_mostly; 91extern int rcu_scheduler_active __read_mostly;
92 92
93extern bool rcu_is_watching(void);
94
93#endif /* __LINUX_RCUTREE_H */ 95#endif /* __LINUX_RCUTREE_H */
diff --git a/include/linux/regmap.h b/include/linux/regmap.h
index dc90b8c134a1..e55907804d39 100644
--- a/include/linux/regmap.h
+++ b/include/linux/regmap.h
@@ -23,6 +23,7 @@ struct device;
23struct i2c_client; 23struct i2c_client;
24struct irq_domain; 24struct irq_domain;
25struct spi_device; 25struct spi_device;
26struct spmi_device;
26struct regmap; 27struct regmap;
27struct regmap_range_cfg; 28struct regmap_range_cfg;
28struct regmap_field; 29struct regmap_field;
@@ -70,6 +71,8 @@ struct regmap_range {
70 unsigned int range_max; 71 unsigned int range_max;
71}; 72};
72 73
74#define regmap_reg_range(low, high) { .range_min = low, .range_max = high, }
75
73/* 76/*
74 * A table of ranges including some yes ranges and some no ranges. 77 * A table of ranges including some yes ranges and some no ranges.
75 * If a register belongs to a no_range, the corresponding check function 78 * If a register belongs to a no_range, the corresponding check function
@@ -318,6 +321,8 @@ struct regmap *regmap_init_i2c(struct i2c_client *i2c,
318 const struct regmap_config *config); 321 const struct regmap_config *config);
319struct regmap *regmap_init_spi(struct spi_device *dev, 322struct regmap *regmap_init_spi(struct spi_device *dev,
320 const struct regmap_config *config); 323 const struct regmap_config *config);
324struct regmap *regmap_init_spmi(struct spmi_device *dev,
325 const struct regmap_config *config);
321struct regmap *regmap_init_mmio_clk(struct device *dev, const char *clk_id, 326struct regmap *regmap_init_mmio_clk(struct device *dev, const char *clk_id,
322 void __iomem *regs, 327 void __iomem *regs,
323 const struct regmap_config *config); 328 const struct regmap_config *config);
@@ -330,6 +335,8 @@ struct regmap *devm_regmap_init_i2c(struct i2c_client *i2c,
330 const struct regmap_config *config); 335 const struct regmap_config *config);
331struct regmap *devm_regmap_init_spi(struct spi_device *dev, 336struct regmap *devm_regmap_init_spi(struct spi_device *dev,
332 const struct regmap_config *config); 337 const struct regmap_config *config);
338struct regmap *devm_regmap_init_spmi(struct spmi_device *dev,
339 const struct regmap_config *config);
333struct regmap *devm_regmap_init_mmio_clk(struct device *dev, const char *clk_id, 340struct regmap *devm_regmap_init_mmio_clk(struct device *dev, const char *clk_id,
334 void __iomem *regs, 341 void __iomem *regs,
335 const struct regmap_config *config); 342 const struct regmap_config *config);
@@ -379,6 +386,8 @@ int regmap_raw_write(struct regmap *map, unsigned int reg,
379 const void *val, size_t val_len); 386 const void *val, size_t val_len);
380int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val, 387int regmap_bulk_write(struct regmap *map, unsigned int reg, const void *val,
381 size_t val_count); 388 size_t val_count);
389int regmap_multi_reg_write(struct regmap *map, struct reg_default *regs,
390 int num_regs);
382int regmap_raw_write_async(struct regmap *map, unsigned int reg, 391int regmap_raw_write_async(struct regmap *map, unsigned int reg,
383 const void *val, size_t val_len); 392 const void *val, size_t val_len);
384int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val); 393int regmap_read(struct regmap *map, unsigned int reg, unsigned int *val);
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 27be915caa96..e530681bea70 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -146,6 +146,32 @@ struct regulator *__must_check devm_regulator_get_optional(struct device *dev,
146void regulator_put(struct regulator *regulator); 146void regulator_put(struct regulator *regulator);
147void devm_regulator_put(struct regulator *regulator); 147void devm_regulator_put(struct regulator *regulator);
148 148
149int regulator_register_supply_alias(struct device *dev, const char *id,
150 struct device *alias_dev,
151 const char *alias_id);
152void regulator_unregister_supply_alias(struct device *dev, const char *id);
153
154int regulator_bulk_register_supply_alias(struct device *dev, const char **id,
155 struct device *alias_dev,
156 const char **alias_id, int num_id);
157void regulator_bulk_unregister_supply_alias(struct device *dev,
158 const char **id, int num_id);
159
160int devm_regulator_register_supply_alias(struct device *dev, const char *id,
161 struct device *alias_dev,
162 const char *alias_id);
163void devm_regulator_unregister_supply_alias(struct device *dev,
164 const char *id);
165
166int devm_regulator_bulk_register_supply_alias(struct device *dev,
167 const char **id,
168 struct device *alias_dev,
169 const char **alias_id,
170 int num_id);
171void devm_regulator_bulk_unregister_supply_alias(struct device *dev,
172 const char **id,
173 int num_id);
174
149/* regulator output control and status */ 175/* regulator output control and status */
150int __must_check regulator_enable(struct regulator *regulator); 176int __must_check regulator_enable(struct regulator *regulator);
151int regulator_disable(struct regulator *regulator); 177int regulator_disable(struct regulator *regulator);
@@ -250,6 +276,59 @@ static inline void devm_regulator_put(struct regulator *regulator)
250{ 276{
251} 277}
252 278
279static inline int regulator_register_supply_alias(struct device *dev,
280 const char *id,
281 struct device *alias_dev,
282 const char *alias_id)
283{
284 return 0;
285}
286
287static inline void regulator_unregister_supply_alias(struct device *dev,
288 const char *id)
289{
290}
291
292static inline int regulator_bulk_register_supply_alias(struct device *dev,
293 const char **id,
294 struct device *alias_dev,
295 const char **alias_id,
296 int num_id)
297{
298 return 0;
299}
300
301static inline void regulator_bulk_unregister_supply_alias(struct device *dev,
302 const char **id,
303 int num_id)
304{
305}
306
307static inline int devm_regulator_register_supply_alias(struct device *dev,
308 const char *id,
309 struct device *alias_dev,
310 const char *alias_id)
311{
312 return 0;
313}
314
315static inline void devm_regulator_unregister_supply_alias(struct device *dev,
316 const char *id)
317{
318}
319
320static inline int devm_regulator_bulk_register_supply_alias(
321 struct device *dev, const char **id, struct device *alias_dev,
322 const char **alias_id, int num_id)
323{
324 return 0;
325}
326
327static inline void devm_regulator_bulk_unregister_supply_alias(
328 struct device *dev, const char **id, int num_id)
329{
330}
331
253static inline int regulator_enable(struct regulator *regulator) 332static inline int regulator_enable(struct regulator *regulator)
254{ 333{
255 return 0; 334 return 0;
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index 9bdad43ad228..9370e65348a4 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -46,19 +46,26 @@ enum regulator_status {
46 * regulator_list_linear_range(). 46 * regulator_list_linear_range().
47 * 47 *
48 * @min_uV: Lowest voltage in range 48 * @min_uV: Lowest voltage in range
49 * @max_uV: Highest voltage in range
50 * @min_sel: Lowest selector for range 49 * @min_sel: Lowest selector for range
51 * @max_sel: Highest selector for range 50 * @max_sel: Highest selector for range
52 * @uV_step: Step size 51 * @uV_step: Step size
53 */ 52 */
54struct regulator_linear_range { 53struct regulator_linear_range {
55 unsigned int min_uV; 54 unsigned int min_uV;
56 unsigned int max_uV;
57 unsigned int min_sel; 55 unsigned int min_sel;
58 unsigned int max_sel; 56 unsigned int max_sel;
59 unsigned int uV_step; 57 unsigned int uV_step;
60}; 58};
61 59
60/* Initialize struct regulator_linear_range */
61#define REGULATOR_LINEAR_RANGE(_min_uV, _min_sel, _max_sel, _step_uV) \
62{ \
63 .min_uV = _min_uV, \
64 .min_sel = _min_sel, \
65 .max_sel = _max_sel, \
66 .uV_step = _step_uV, \
67}
68
62/** 69/**
63 * struct regulator_ops - regulator operations. 70 * struct regulator_ops - regulator operations.
64 * 71 *
@@ -209,6 +216,7 @@ enum regulator_type {
209 * @min_uV: Voltage given by the lowest selector (if linear mapping) 216 * @min_uV: Voltage given by the lowest selector (if linear mapping)
210 * @uV_step: Voltage increase with each selector (if linear mapping) 217 * @uV_step: Voltage increase with each selector (if linear mapping)
211 * @linear_min_sel: Minimal selector for starting linear mapping 218 * @linear_min_sel: Minimal selector for starting linear mapping
219 * @fixed_uV: Fixed voltage of rails.
212 * @ramp_delay: Time to settle down after voltage change (unit: uV/us) 220 * @ramp_delay: Time to settle down after voltage change (unit: uV/us)
213 * @volt_table: Voltage mapping table (if table based mapping) 221 * @volt_table: Voltage mapping table (if table based mapping)
214 * 222 *
@@ -241,6 +249,7 @@ struct regulator_desc {
241 unsigned int min_uV; 249 unsigned int min_uV;
242 unsigned int uV_step; 250 unsigned int uV_step;
243 unsigned int linear_min_sel; 251 unsigned int linear_min_sel;
252 int fixed_uV;
244 unsigned int ramp_delay; 253 unsigned int ramp_delay;
245 254
246 const struct regulator_linear_range *linear_ranges; 255 const struct regulator_linear_range *linear_ranges;
@@ -336,7 +345,12 @@ struct regulator_dev {
336struct regulator_dev * 345struct regulator_dev *
337regulator_register(const struct regulator_desc *regulator_desc, 346regulator_register(const struct regulator_desc *regulator_desc,
338 const struct regulator_config *config); 347 const struct regulator_config *config);
348struct regulator_dev *
349devm_regulator_register(struct device *dev,
350 const struct regulator_desc *regulator_desc,
351 const struct regulator_config *config);
339void regulator_unregister(struct regulator_dev *rdev); 352void regulator_unregister(struct regulator_dev *rdev);
353void devm_regulator_unregister(struct device *dev, struct regulator_dev *rdev);
340 354
341int regulator_notifier_call_chain(struct regulator_dev *rdev, 355int regulator_notifier_call_chain(struct regulator_dev *rdev,
342 unsigned long event, void *data); 356 unsigned long event, void *data);
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h
index 999b20ce06cf..730e638c5589 100644
--- a/include/linux/regulator/machine.h
+++ b/include/linux/regulator/machine.h
@@ -95,6 +95,7 @@ struct regulator_state {
95 * @initial_state: Suspend state to set by default. 95 * @initial_state: Suspend state to set by default.
96 * @initial_mode: Mode to set at startup. 96 * @initial_mode: Mode to set at startup.
97 * @ramp_delay: Time to settle down after voltage change (unit: uV/us) 97 * @ramp_delay: Time to settle down after voltage change (unit: uV/us)
98 * @enable_time: Turn-on time of the rails (unit: microseconds)
98 */ 99 */
99struct regulation_constraints { 100struct regulation_constraints {
100 101
@@ -129,6 +130,7 @@ struct regulation_constraints {
129 unsigned int initial_mode; 130 unsigned int initial_mode;
130 131
131 unsigned int ramp_delay; 132 unsigned int ramp_delay;
133 unsigned int enable_time;
132 134
133 /* constraint flags */ 135 /* constraint flags */
134 unsigned always_on:1; /* regulator never off when system is on */ 136 unsigned always_on:1; /* regulator never off when system is on */
@@ -193,15 +195,10 @@ int regulator_suspend_finish(void);
193 195
194#ifdef CONFIG_REGULATOR 196#ifdef CONFIG_REGULATOR
195void regulator_has_full_constraints(void); 197void regulator_has_full_constraints(void);
196void regulator_use_dummy_regulator(void);
197#else 198#else
198static inline void regulator_has_full_constraints(void) 199static inline void regulator_has_full_constraints(void)
199{ 200{
200} 201}
201
202static inline void regulator_use_dummy_regulator(void)
203{
204}
205#endif 202#endif
206 203
207#endif 204#endif
diff --git a/include/linux/sched.h b/include/linux/sched.h
index e27baeeda3f4..045b0d227846 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -22,6 +22,7 @@ struct sched_param {
22#include <linux/errno.h> 22#include <linux/errno.h>
23#include <linux/nodemask.h> 23#include <linux/nodemask.h>
24#include <linux/mm_types.h> 24#include <linux/mm_types.h>
25#include <linux/preempt.h>
25 26
26#include <asm/page.h> 27#include <asm/page.h>
27#include <asm/ptrace.h> 28#include <asm/ptrace.h>
@@ -427,6 +428,14 @@ struct task_cputime {
427 .sum_exec_runtime = 0, \ 428 .sum_exec_runtime = 0, \
428 } 429 }
429 430
431#define PREEMPT_ENABLED (PREEMPT_NEED_RESCHED)
432
433#ifdef CONFIG_PREEMPT_COUNT
434#define PREEMPT_DISABLED (1 + PREEMPT_ENABLED)
435#else
436#define PREEMPT_DISABLED PREEMPT_ENABLED
437#endif
438
430/* 439/*
431 * Disable preemption until the scheduler is running. 440 * Disable preemption until the scheduler is running.
432 * Reset by start_kernel()->sched_init()->init_idle(). 441 * Reset by start_kernel()->sched_init()->init_idle().
@@ -434,7 +443,7 @@ struct task_cputime {
434 * We include PREEMPT_ACTIVE to avoid cond_resched() from working 443 * We include PREEMPT_ACTIVE to avoid cond_resched() from working
435 * before the scheduler is active -- see should_resched(). 444 * before the scheduler is active -- see should_resched().
436 */ 445 */
437#define INIT_PREEMPT_COUNT (1 + PREEMPT_ACTIVE) 446#define INIT_PREEMPT_COUNT (PREEMPT_DISABLED + PREEMPT_ACTIVE)
438 447
439/** 448/**
440 * struct thread_group_cputimer - thread group interval timer counts 449 * struct thread_group_cputimer - thread group interval timer counts
@@ -768,6 +777,7 @@ enum cpu_idle_type {
768#define SD_ASYM_PACKING 0x0800 /* Place busy groups earlier in the domain */ 777#define SD_ASYM_PACKING 0x0800 /* Place busy groups earlier in the domain */
769#define SD_PREFER_SIBLING 0x1000 /* Prefer to place tasks in a sibling domain */ 778#define SD_PREFER_SIBLING 0x1000 /* Prefer to place tasks in a sibling domain */
770#define SD_OVERLAP 0x2000 /* sched_domains of this level overlap */ 779#define SD_OVERLAP 0x2000 /* sched_domains of this level overlap */
780#define SD_NUMA 0x4000 /* cross-node balancing */
771 781
772extern int __weak arch_sd_sibiling_asym_packing(void); 782extern int __weak arch_sd_sibiling_asym_packing(void);
773 783
@@ -811,6 +821,10 @@ struct sched_domain {
811 821
812 u64 last_update; 822 u64 last_update;
813 823
824 /* idle_balance() stats */
825 u64 max_newidle_lb_cost;
826 unsigned long next_decay_max_lb_cost;
827
814#ifdef CONFIG_SCHEDSTATS 828#ifdef CONFIG_SCHEDSTATS
815 /* load_balance() stats */ 829 /* load_balance() stats */
816 unsigned int lb_count[CPU_MAX_IDLE_TYPES]; 830 unsigned int lb_count[CPU_MAX_IDLE_TYPES];
@@ -1029,6 +1043,8 @@ struct task_struct {
1029 struct task_struct *last_wakee; 1043 struct task_struct *last_wakee;
1030 unsigned long wakee_flips; 1044 unsigned long wakee_flips;
1031 unsigned long wakee_flip_decay_ts; 1045 unsigned long wakee_flip_decay_ts;
1046
1047 int wake_cpu;
1032#endif 1048#endif
1033 int on_rq; 1049 int on_rq;
1034 1050
@@ -1324,10 +1340,41 @@ struct task_struct {
1324#endif 1340#endif
1325#ifdef CONFIG_NUMA_BALANCING 1341#ifdef CONFIG_NUMA_BALANCING
1326 int numa_scan_seq; 1342 int numa_scan_seq;
1327 int numa_migrate_seq;
1328 unsigned int numa_scan_period; 1343 unsigned int numa_scan_period;
1344 unsigned int numa_scan_period_max;
1345 int numa_preferred_nid;
1346 int numa_migrate_deferred;
1347 unsigned long numa_migrate_retry;
1329 u64 node_stamp; /* migration stamp */ 1348 u64 node_stamp; /* migration stamp */
1330 struct callback_head numa_work; 1349 struct callback_head numa_work;
1350
1351 struct list_head numa_entry;
1352 struct numa_group *numa_group;
1353
1354 /*
1355 * Exponential decaying average of faults on a per-node basis.
1356 * Scheduling placement decisions are made based on the these counts.
1357 * The values remain static for the duration of a PTE scan
1358 */
1359 unsigned long *numa_faults;
1360 unsigned long total_numa_faults;
1361
1362 /*
1363 * numa_faults_buffer records faults per node during the current
1364 * scan window. When the scan completes, the counts in numa_faults
1365 * decay and these values are copied.
1366 */
1367 unsigned long *numa_faults_buffer;
1368
1369 /*
1370 * numa_faults_locality tracks if faults recorded during the last
1371 * scan window were remote/local. The task scan period is adapted
1372 * based on the locality of the faults with different weights
1373 * depending on whether they were shared or private faults
1374 */
1375 unsigned long numa_faults_locality[2];
1376
1377 unsigned long numa_pages_migrated;
1331#endif /* CONFIG_NUMA_BALANCING */ 1378#endif /* CONFIG_NUMA_BALANCING */
1332 1379
1333 struct rcu_head rcu; 1380 struct rcu_head rcu;
@@ -1412,16 +1459,33 @@ struct task_struct {
1412/* Future-safe accessor for struct task_struct's cpus_allowed. */ 1459/* Future-safe accessor for struct task_struct's cpus_allowed. */
1413#define tsk_cpus_allowed(tsk) (&(tsk)->cpus_allowed) 1460#define tsk_cpus_allowed(tsk) (&(tsk)->cpus_allowed)
1414 1461
1462#define TNF_MIGRATED 0x01
1463#define TNF_NO_GROUP 0x02
1464#define TNF_SHARED 0x04
1465#define TNF_FAULT_LOCAL 0x08
1466
1415#ifdef CONFIG_NUMA_BALANCING 1467#ifdef CONFIG_NUMA_BALANCING
1416extern void task_numa_fault(int node, int pages, bool migrated); 1468extern void task_numa_fault(int last_node, int node, int pages, int flags);
1469extern pid_t task_numa_group_id(struct task_struct *p);
1417extern void set_numabalancing_state(bool enabled); 1470extern void set_numabalancing_state(bool enabled);
1471extern void task_numa_free(struct task_struct *p);
1472
1473extern unsigned int sysctl_numa_balancing_migrate_deferred;
1418#else 1474#else
1419static inline void task_numa_fault(int node, int pages, bool migrated) 1475static inline void task_numa_fault(int last_node, int node, int pages,
1476 int flags)
1420{ 1477{
1421} 1478}
1479static inline pid_t task_numa_group_id(struct task_struct *p)
1480{
1481 return 0;
1482}
1422static inline void set_numabalancing_state(bool enabled) 1483static inline void set_numabalancing_state(bool enabled)
1423{ 1484{
1424} 1485}
1486static inline void task_numa_free(struct task_struct *p)
1487{
1488}
1425#endif 1489#endif
1426 1490
1427static inline struct pid *task_pid(struct task_struct *task) 1491static inline struct pid *task_pid(struct task_struct *task)
@@ -1974,7 +2038,7 @@ extern void wake_up_new_task(struct task_struct *tsk);
1974#else 2038#else
1975 static inline void kick_process(struct task_struct *tsk) { } 2039 static inline void kick_process(struct task_struct *tsk) { }
1976#endif 2040#endif
1977extern void sched_fork(struct task_struct *p); 2041extern void sched_fork(unsigned long clone_flags, struct task_struct *p);
1978extern void sched_dead(struct task_struct *p); 2042extern void sched_dead(struct task_struct *p);
1979 2043
1980extern void proc_caches_init(void); 2044extern void proc_caches_init(void);
@@ -2401,11 +2465,6 @@ static inline int signal_pending_state(long state, struct task_struct *p)
2401 return (state & TASK_INTERRUPTIBLE) || __fatal_signal_pending(p); 2465 return (state & TASK_INTERRUPTIBLE) || __fatal_signal_pending(p);
2402} 2466}
2403 2467
2404static inline int need_resched(void)
2405{
2406 return unlikely(test_thread_flag(TIF_NEED_RESCHED));
2407}
2408
2409/* 2468/*
2410 * cond_resched() and cond_resched_lock(): latency reduction via 2469 * cond_resched() and cond_resched_lock(): latency reduction via
2411 * explicit rescheduling in places that are safe. The return 2470 * explicit rescheduling in places that are safe. The return
@@ -2474,36 +2533,105 @@ static inline int tsk_is_polling(struct task_struct *p)
2474{ 2533{
2475 return task_thread_info(p)->status & TS_POLLING; 2534 return task_thread_info(p)->status & TS_POLLING;
2476} 2535}
2477static inline void current_set_polling(void) 2536static inline void __current_set_polling(void)
2478{ 2537{
2479 current_thread_info()->status |= TS_POLLING; 2538 current_thread_info()->status |= TS_POLLING;
2480} 2539}
2481 2540
2482static inline void current_clr_polling(void) 2541static inline bool __must_check current_set_polling_and_test(void)
2542{
2543 __current_set_polling();
2544
2545 /*
2546 * Polling state must be visible before we test NEED_RESCHED,
2547 * paired by resched_task()
2548 */
2549 smp_mb();
2550
2551 return unlikely(tif_need_resched());
2552}
2553
2554static inline void __current_clr_polling(void)
2483{ 2555{
2484 current_thread_info()->status &= ~TS_POLLING; 2556 current_thread_info()->status &= ~TS_POLLING;
2485 smp_mb__after_clear_bit(); 2557}
2558
2559static inline bool __must_check current_clr_polling_and_test(void)
2560{
2561 __current_clr_polling();
2562
2563 /*
2564 * Polling state must be visible before we test NEED_RESCHED,
2565 * paired by resched_task()
2566 */
2567 smp_mb();
2568
2569 return unlikely(tif_need_resched());
2486} 2570}
2487#elif defined(TIF_POLLING_NRFLAG) 2571#elif defined(TIF_POLLING_NRFLAG)
2488static inline int tsk_is_polling(struct task_struct *p) 2572static inline int tsk_is_polling(struct task_struct *p)
2489{ 2573{
2490 return test_tsk_thread_flag(p, TIF_POLLING_NRFLAG); 2574 return test_tsk_thread_flag(p, TIF_POLLING_NRFLAG);
2491} 2575}
2492static inline void current_set_polling(void) 2576
2577static inline void __current_set_polling(void)
2493{ 2578{
2494 set_thread_flag(TIF_POLLING_NRFLAG); 2579 set_thread_flag(TIF_POLLING_NRFLAG);
2495} 2580}
2496 2581
2497static inline void current_clr_polling(void) 2582static inline bool __must_check current_set_polling_and_test(void)
2583{
2584 __current_set_polling();
2585
2586 /*
2587 * Polling state must be visible before we test NEED_RESCHED,
2588 * paired by resched_task()
2589 *
2590 * XXX: assumes set/clear bit are identical barrier wise.
2591 */
2592 smp_mb__after_clear_bit();
2593
2594 return unlikely(tif_need_resched());
2595}
2596
2597static inline void __current_clr_polling(void)
2498{ 2598{
2499 clear_thread_flag(TIF_POLLING_NRFLAG); 2599 clear_thread_flag(TIF_POLLING_NRFLAG);
2500} 2600}
2601
2602static inline bool __must_check current_clr_polling_and_test(void)
2603{
2604 __current_clr_polling();
2605
2606 /*
2607 * Polling state must be visible before we test NEED_RESCHED,
2608 * paired by resched_task()
2609 */
2610 smp_mb__after_clear_bit();
2611
2612 return unlikely(tif_need_resched());
2613}
2614
2501#else 2615#else
2502static inline int tsk_is_polling(struct task_struct *p) { return 0; } 2616static inline int tsk_is_polling(struct task_struct *p) { return 0; }
2503static inline void current_set_polling(void) { } 2617static inline void __current_set_polling(void) { }
2504static inline void current_clr_polling(void) { } 2618static inline void __current_clr_polling(void) { }
2619
2620static inline bool __must_check current_set_polling_and_test(void)
2621{
2622 return unlikely(tif_need_resched());
2623}
2624static inline bool __must_check current_clr_polling_and_test(void)
2625{
2626 return unlikely(tif_need_resched());
2627}
2505#endif 2628#endif
2506 2629
2630static __always_inline bool need_resched(void)
2631{
2632 return unlikely(tif_need_resched());
2633}
2634
2507/* 2635/*
2508 * Thread group CPU time accounting. 2636 * Thread group CPU time accounting.
2509 */ 2637 */
@@ -2545,6 +2673,11 @@ static inline unsigned int task_cpu(const struct task_struct *p)
2545 return task_thread_info(p)->cpu; 2673 return task_thread_info(p)->cpu;
2546} 2674}
2547 2675
2676static inline int task_node(const struct task_struct *p)
2677{
2678 return cpu_to_node(task_cpu(p));
2679}
2680
2548extern void set_task_cpu(struct task_struct *p, unsigned int cpu); 2681extern void set_task_cpu(struct task_struct *p, unsigned int cpu);
2549 2682
2550#else 2683#else
diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
index bf8086b2506e..10d16c4fbe89 100644
--- a/include/linux/sched/sysctl.h
+++ b/include/linux/sched/sysctl.h
@@ -47,7 +47,6 @@ extern enum sched_tunable_scaling sysctl_sched_tunable_scaling;
47extern unsigned int sysctl_numa_balancing_scan_delay; 47extern unsigned int sysctl_numa_balancing_scan_delay;
48extern unsigned int sysctl_numa_balancing_scan_period_min; 48extern unsigned int sysctl_numa_balancing_scan_period_min;
49extern unsigned int sysctl_numa_balancing_scan_period_max; 49extern unsigned int sysctl_numa_balancing_scan_period_max;
50extern unsigned int sysctl_numa_balancing_scan_period_reset;
51extern unsigned int sysctl_numa_balancing_scan_size; 50extern unsigned int sysctl_numa_balancing_scan_size;
52extern unsigned int sysctl_numa_balancing_settle_count; 51extern unsigned int sysctl_numa_balancing_settle_count;
53 52
diff --git a/include/linux/sched_clock.h b/include/linux/sched_clock.h
index fa7922c80a41..cddf0c2940b6 100644
--- a/include/linux/sched_clock.h
+++ b/include/linux/sched_clock.h
@@ -15,7 +15,7 @@ static inline void sched_clock_postinit(void) { }
15#endif 15#endif
16 16
17extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate); 17extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate);
18 18extern void sched_clock_register(u64 (*read)(void), int bits,
19extern unsigned long long (*sched_clock_func)(void); 19 unsigned long rate);
20 20
21#endif 21#endif
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index b98291ac7f14..f729be981da0 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -66,7 +66,6 @@ struct uart_ops {
66 void (*set_ldisc)(struct uart_port *, int new); 66 void (*set_ldisc)(struct uart_port *, int new);
67 void (*pm)(struct uart_port *, unsigned int state, 67 void (*pm)(struct uart_port *, unsigned int state,
68 unsigned int oldstate); 68 unsigned int oldstate);
69 int (*set_wake)(struct uart_port *, unsigned int state);
70 69
71 /* 70 /*
72 * Return a string describing the type of the port 71 * Return a string describing the type of the port
diff --git a/include/linux/serial_sci.h b/include/linux/serial_sci.h
index d34049712a4d..50fe651da965 100644
--- a/include/linux/serial_sci.h
+++ b/include/linux/serial_sci.h
@@ -5,7 +5,7 @@
5#include <linux/sh_dma.h> 5#include <linux/sh_dma.h>
6 6
7/* 7/*
8 * Generic header for SuperH (H)SCI(F) (used by sh/sh64/h8300 and related parts) 8 * Generic header for SuperH (H)SCI(F) (used by sh/sh64 and related parts)
9 */ 9 */
10 10
11#define SCIx_NOT_SUPPORTED (-1) 11#define SCIx_NOT_SUPPORTED (-1)
diff --git a/include/linux/sfi.h b/include/linux/sfi.h
index fe817918b30e..d9b436f09925 100644
--- a/include/linux/sfi.h
+++ b/include/linux/sfi.h
@@ -59,6 +59,9 @@
59#ifndef _LINUX_SFI_H 59#ifndef _LINUX_SFI_H
60#define _LINUX_SFI_H 60#define _LINUX_SFI_H
61 61
62#include <linux/init.h>
63#include <linux/types.h>
64
62/* Table signatures reserved by the SFI specification */ 65/* Table signatures reserved by the SFI specification */
63#define SFI_SIG_SYST "SYST" 66#define SFI_SIG_SYST "SYST"
64#define SFI_SIG_FREQ "FREQ" 67#define SFI_SIG_FREQ "FREQ"
diff --git a/include/linux/spi/rspi.h b/include/linux/spi/rspi.h
index 900f0e328235..a25bd6f65e7f 100644
--- a/include/linux/spi/rspi.h
+++ b/include/linux/spi/rspi.h
@@ -26,6 +26,8 @@ struct rspi_plat_data {
26 unsigned int dma_rx_id; 26 unsigned int dma_rx_id;
27 27
28 unsigned dma_width_16bit:1; /* DMAC read/write width = 16-bit */ 28 unsigned dma_width_16bit:1; /* DMAC read/write width = 16-bit */
29
30 u16 num_chipselect;
29}; 31};
30 32
31#endif 33#endif
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h
index 887116dbce2c..8c62ba74dd91 100644
--- a/include/linux/spi/spi.h
+++ b/include/linux/spi/spi.h
@@ -23,6 +23,7 @@
23#include <linux/mod_devicetable.h> 23#include <linux/mod_devicetable.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/kthread.h> 25#include <linux/kthread.h>
26#include <linux/completion.h>
26 27
27/* 28/*
28 * INTERFACES between SPI master-side drivers and SPI infrastructure. 29 * INTERFACES between SPI master-side drivers and SPI infrastructure.
@@ -150,8 +151,7 @@ static inline void *spi_get_drvdata(struct spi_device *spi)
150} 151}
151 152
152struct spi_message; 153struct spi_message;
153 154struct spi_transfer;
154
155 155
156/** 156/**
157 * struct spi_driver - Host side "protocol" driver 157 * struct spi_driver - Host side "protocol" driver
@@ -257,6 +257,9 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
257 * @queue_lock: spinlock to syncronise access to message queue 257 * @queue_lock: spinlock to syncronise access to message queue
258 * @queue: message queue 258 * @queue: message queue
259 * @cur_msg: the currently in-flight message 259 * @cur_msg: the currently in-flight message
260 * @cur_msg_prepared: spi_prepare_message was called for the currently
261 * in-flight message
262 * @xfer_completion: used by core tranfer_one_message()
260 * @busy: message pump is busy 263 * @busy: message pump is busy
261 * @running: message pump is running 264 * @running: message pump is running
262 * @rt: whether this queue is set to run as a realtime task 265 * @rt: whether this queue is set to run as a realtime task
@@ -274,6 +277,16 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
274 * @unprepare_transfer_hardware: there are currently no more messages on the 277 * @unprepare_transfer_hardware: there are currently no more messages on the
275 * queue so the subsystem notifies the driver that it may relax the 278 * queue so the subsystem notifies the driver that it may relax the
276 * hardware by issuing this call 279 * hardware by issuing this call
280 * @set_cs: assert or deassert chip select, true to assert. May be called
281 * from interrupt context.
282 * @prepare_message: set up the controller to transfer a single message,
283 * for example doing DMA mapping. Called from threaded
284 * context.
285 * @transfer_one: transfer a single spi_transfer. When the
286 * driver is finished with this transfer it must call
287 * spi_finalize_current_transfer() so the subsystem can issue
288 * the next transfer
289 * @unprepare_message: undo any work done by prepare_message().
277 * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS 290 * @cs_gpios: Array of GPIOs to use as chip select lines; one per CS
278 * number. Any individual value may be -ENOENT for CS lines that 291 * number. Any individual value may be -ENOENT for CS lines that
279 * are not GPIOs (driven by the SPI controller itself). 292 * are not GPIOs (driven by the SPI controller itself).
@@ -388,11 +401,25 @@ struct spi_master {
388 bool running; 401 bool running;
389 bool rt; 402 bool rt;
390 bool auto_runtime_pm; 403 bool auto_runtime_pm;
404 bool cur_msg_prepared;
405 struct completion xfer_completion;
391 406
392 int (*prepare_transfer_hardware)(struct spi_master *master); 407 int (*prepare_transfer_hardware)(struct spi_master *master);
393 int (*transfer_one_message)(struct spi_master *master, 408 int (*transfer_one_message)(struct spi_master *master,
394 struct spi_message *mesg); 409 struct spi_message *mesg);
395 int (*unprepare_transfer_hardware)(struct spi_master *master); 410 int (*unprepare_transfer_hardware)(struct spi_master *master);
411 int (*prepare_message)(struct spi_master *master,
412 struct spi_message *message);
413 int (*unprepare_message)(struct spi_master *master,
414 struct spi_message *message);
415
416 /*
417 * These hooks are for drivers that use a generic implementation
418 * of transfer_one_message() provied by the core.
419 */
420 void (*set_cs)(struct spi_device *spi, bool enable);
421 int (*transfer_one)(struct spi_master *master, struct spi_device *spi,
422 struct spi_transfer *transfer);
396 423
397 /* gpio chip select */ 424 /* gpio chip select */
398 int *cs_gpios; 425 int *cs_gpios;
@@ -428,12 +455,15 @@ extern int spi_master_resume(struct spi_master *master);
428/* Calls the driver make to interact with the message queue */ 455/* Calls the driver make to interact with the message queue */
429extern struct spi_message *spi_get_next_queued_message(struct spi_master *master); 456extern struct spi_message *spi_get_next_queued_message(struct spi_master *master);
430extern void spi_finalize_current_message(struct spi_master *master); 457extern void spi_finalize_current_message(struct spi_master *master);
458extern void spi_finalize_current_transfer(struct spi_master *master);
431 459
432/* the spi driver core manages memory for the spi_master classdev */ 460/* the spi driver core manages memory for the spi_master classdev */
433extern struct spi_master * 461extern struct spi_master *
434spi_alloc_master(struct device *host, unsigned size); 462spi_alloc_master(struct device *host, unsigned size);
435 463
436extern int spi_register_master(struct spi_master *master); 464extern int spi_register_master(struct spi_master *master);
465extern int devm_spi_register_master(struct device *dev,
466 struct spi_master *master);
437extern void spi_unregister_master(struct spi_master *master); 467extern void spi_unregister_master(struct spi_master *master);
438 468
439extern struct spi_master *spi_busnum_to_master(u16 busnum); 469extern struct spi_master *spi_busnum_to_master(u16 busnum);
@@ -823,6 +853,33 @@ static inline ssize_t spi_w8r16(struct spi_device *spi, u8 cmd)
823 return (status < 0) ? status : result; 853 return (status < 0) ? status : result;
824} 854}
825 855
856/**
857 * spi_w8r16be - SPI synchronous 8 bit write followed by 16 bit big-endian read
858 * @spi: device with which data will be exchanged
859 * @cmd: command to be written before data is read back
860 * Context: can sleep
861 *
862 * This returns the (unsigned) sixteen bit number returned by the device in cpu
863 * endianness, or else a negative error code. Callable only from contexts that
864 * can sleep.
865 *
866 * This function is similar to spi_w8r16, with the exception that it will
867 * convert the read 16 bit data word from big-endian to native endianness.
868 *
869 */
870static inline ssize_t spi_w8r16be(struct spi_device *spi, u8 cmd)
871
872{
873 ssize_t status;
874 __be16 result;
875
876 status = spi_write_then_read(spi, &cmd, 1, &result, 2);
877 if (status < 0)
878 return status;
879
880 return be16_to_cpu(result);
881}
882
826/*---------------------------------------------------------------------------*/ 883/*---------------------------------------------------------------------------*/
827 884
828/* 885/*
diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h
index 3b5e910d14ca..d2abbdb8c6aa 100644
--- a/include/linux/stop_machine.h
+++ b/include/linux/stop_machine.h
@@ -28,6 +28,7 @@ struct cpu_stop_work {
28}; 28};
29 29
30int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, void *arg); 30int stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, void *arg);
31int stop_two_cpus(unsigned int cpu1, unsigned int cpu2, cpu_stop_fn_t fn, void *arg);
31void stop_one_cpu_nowait(unsigned int cpu, cpu_stop_fn_t fn, void *arg, 32void stop_one_cpu_nowait(unsigned int cpu, cpu_stop_fn_t fn, void *arg,
32 struct cpu_stop_work *work_buf); 33 struct cpu_stop_work *work_buf);
33int stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg); 34int stop_cpus(const struct cpumask *cpumask, cpu_stop_fn_t fn, void *arg);
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h
index 6740801aa71a..8af2804bab16 100644
--- a/include/linux/sunrpc/clnt.h
+++ b/include/linux/sunrpc/clnt.h
@@ -49,6 +49,7 @@ struct rpc_clnt {
49 49
50 unsigned int cl_softrtry : 1,/* soft timeouts */ 50 unsigned int cl_softrtry : 1,/* soft timeouts */
51 cl_discrtry : 1,/* disconnect before retry */ 51 cl_discrtry : 1,/* disconnect before retry */
52 cl_noretranstimeo: 1,/* No retransmit timeouts */
52 cl_autobind : 1,/* use getport() */ 53 cl_autobind : 1,/* use getport() */
53 cl_chatty : 1;/* be verbose */ 54 cl_chatty : 1;/* be verbose */
54 55
@@ -126,6 +127,7 @@ struct rpc_create_args {
126#define RPC_CLNT_CREATE_QUIET (1UL << 6) 127#define RPC_CLNT_CREATE_QUIET (1UL << 6)
127#define RPC_CLNT_CREATE_INFINITE_SLOTS (1UL << 7) 128#define RPC_CLNT_CREATE_INFINITE_SLOTS (1UL << 7)
128#define RPC_CLNT_CREATE_NO_IDLE_TIMEOUT (1UL << 8) 129#define RPC_CLNT_CREATE_NO_IDLE_TIMEOUT (1UL << 8)
130#define RPC_CLNT_CREATE_NO_RETRANS_TIMEOUT (1UL << 9)
129 131
130struct rpc_clnt *rpc_create(struct rpc_create_args *args); 132struct rpc_clnt *rpc_create(struct rpc_create_args *args);
131struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *, 133struct rpc_clnt *rpc_bind_new_program(struct rpc_clnt *,
@@ -134,6 +136,10 @@ void rpc_task_reset_client(struct rpc_task *task, struct rpc_clnt *clnt);
134struct rpc_clnt *rpc_clone_client(struct rpc_clnt *); 136struct rpc_clnt *rpc_clone_client(struct rpc_clnt *);
135struct rpc_clnt *rpc_clone_client_set_auth(struct rpc_clnt *, 137struct rpc_clnt *rpc_clone_client_set_auth(struct rpc_clnt *,
136 rpc_authflavor_t); 138 rpc_authflavor_t);
139int rpc_switch_client_transport(struct rpc_clnt *,
140 struct xprt_create *,
141 const struct rpc_timeout *);
142
137void rpc_shutdown_client(struct rpc_clnt *); 143void rpc_shutdown_client(struct rpc_clnt *);
138void rpc_release_client(struct rpc_clnt *); 144void rpc_release_client(struct rpc_clnt *);
139void rpc_task_release_client(struct rpc_task *); 145void rpc_task_release_client(struct rpc_task *);
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 096ee58be11a..3a847de83fab 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -122,6 +122,7 @@ struct rpc_task_setup {
122#define RPC_TASK_SENT 0x0800 /* message was sent */ 122#define RPC_TASK_SENT 0x0800 /* message was sent */
123#define RPC_TASK_TIMEOUT 0x1000 /* fail with ETIMEDOUT on timeout */ 123#define RPC_TASK_TIMEOUT 0x1000 /* fail with ETIMEDOUT on timeout */
124#define RPC_TASK_NOCONNECT 0x2000 /* return ENOTCONN if not connected */ 124#define RPC_TASK_NOCONNECT 0x2000 /* return ENOTCONN if not connected */
125#define RPC_TASK_NO_RETRANS_TIMEOUT 0x4000 /* wait forever for a reply */
125 126
126#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC) 127#define RPC_IS_ASYNC(t) ((t)->tk_flags & RPC_TASK_ASYNC)
127#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER) 128#define RPC_IS_SWAPPER(t) ((t)->tk_flags & RPC_TASK_SWAPPER)
diff --git a/include/linux/sunrpc/xprt.h b/include/linux/sunrpc/xprt.h
index cec7b9b5e1bf..8097b9df6773 100644
--- a/include/linux/sunrpc/xprt.h
+++ b/include/linux/sunrpc/xprt.h
@@ -288,7 +288,7 @@ int xprt_reserve_xprt(struct rpc_xprt *xprt, struct rpc_task *task);
288int xprt_reserve_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task); 288int xprt_reserve_xprt_cong(struct rpc_xprt *xprt, struct rpc_task *task);
289void xprt_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task); 289void xprt_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task);
290void xprt_lock_and_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task); 290void xprt_lock_and_alloc_slot(struct rpc_xprt *xprt, struct rpc_task *task);
291int xprt_prepare_transmit(struct rpc_task *task); 291bool xprt_prepare_transmit(struct rpc_task *task);
292void xprt_transmit(struct rpc_task *task); 292void xprt_transmit(struct rpc_task *task);
293void xprt_end_transmit(struct rpc_task *task); 293void xprt_end_transmit(struct rpc_task *task);
294int xprt_adjust_timeout(struct rpc_rqst *req); 294int xprt_adjust_timeout(struct rpc_rqst *req);
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 11baec7c9b26..6695040a0317 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -173,7 +173,6 @@ struct bin_attribute bin_attr_##_name = __BIN_ATTR_RW(_name, _size)
173struct sysfs_ops { 173struct sysfs_ops {
174 ssize_t (*show)(struct kobject *, struct attribute *, char *); 174 ssize_t (*show)(struct kobject *, struct attribute *, char *);
175 ssize_t (*store)(struct kobject *, struct attribute *, const char *, size_t); 175 ssize_t (*store)(struct kobject *, struct attribute *, const char *, size_t);
176 const void *(*namespace)(struct kobject *, const struct attribute *);
177}; 176};
178 177
179struct sysfs_dirent; 178struct sysfs_dirent;
@@ -183,19 +182,23 @@ struct sysfs_dirent;
183int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *), 182int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *),
184 void *data, struct module *owner); 183 void *data, struct module *owner);
185 184
186int __must_check sysfs_create_dir(struct kobject *kobj); 185int __must_check sysfs_create_dir_ns(struct kobject *kobj, const void *ns);
187void sysfs_remove_dir(struct kobject *kobj); 186void sysfs_remove_dir(struct kobject *kobj);
188int __must_check sysfs_rename_dir(struct kobject *kobj, const char *new_name); 187int __must_check sysfs_rename_dir_ns(struct kobject *kobj, const char *new_name,
189int __must_check sysfs_move_dir(struct kobject *kobj, 188 const void *new_ns);
190 struct kobject *new_parent_kobj); 189int __must_check sysfs_move_dir_ns(struct kobject *kobj,
191 190 struct kobject *new_parent_kobj,
192int __must_check sysfs_create_file(struct kobject *kobj, 191 const void *new_ns);
193 const struct attribute *attr); 192
193int __must_check sysfs_create_file_ns(struct kobject *kobj,
194 const struct attribute *attr,
195 const void *ns);
194int __must_check sysfs_create_files(struct kobject *kobj, 196int __must_check sysfs_create_files(struct kobject *kobj,
195 const struct attribute **attr); 197 const struct attribute **attr);
196int __must_check sysfs_chmod_file(struct kobject *kobj, 198int __must_check sysfs_chmod_file(struct kobject *kobj,
197 const struct attribute *attr, umode_t mode); 199 const struct attribute *attr, umode_t mode);
198void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); 200void sysfs_remove_file_ns(struct kobject *kobj, const struct attribute *attr,
201 const void *ns);
199void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr); 202void sysfs_remove_files(struct kobject *kobj, const struct attribute **attr);
200 203
201int __must_check sysfs_create_bin_file(struct kobject *kobj, 204int __must_check sysfs_create_bin_file(struct kobject *kobj,
@@ -210,8 +213,9 @@ int __must_check sysfs_create_link_nowarn(struct kobject *kobj,
210 const char *name); 213 const char *name);
211void sysfs_remove_link(struct kobject *kobj, const char *name); 214void sysfs_remove_link(struct kobject *kobj, const char *name);
212 215
213int sysfs_rename_link(struct kobject *kobj, struct kobject *target, 216int sysfs_rename_link_ns(struct kobject *kobj, struct kobject *target,
214 const char *old_name, const char *new_name); 217 const char *old_name, const char *new_name,
218 const void *new_ns);
215 219
216void sysfs_delete_link(struct kobject *dir, struct kobject *targ, 220void sysfs_delete_link(struct kobject *dir, struct kobject *targ,
217 const char *name); 221 const char *name);
@@ -241,9 +245,9 @@ void sysfs_remove_link_from_group(struct kobject *kobj, const char *group_name,
241 245
242void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr); 246void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr);
243void sysfs_notify_dirent(struct sysfs_dirent *sd); 247void sysfs_notify_dirent(struct sysfs_dirent *sd);
244struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, 248struct sysfs_dirent *sysfs_get_dirent_ns(struct sysfs_dirent *parent_sd,
245 const void *ns, 249 const unsigned char *name,
246 const unsigned char *name); 250 const void *ns);
247struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd); 251struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd);
248void sysfs_put(struct sysfs_dirent *sd); 252void sysfs_put(struct sysfs_dirent *sd);
249 253
@@ -257,7 +261,7 @@ static inline int sysfs_schedule_callback(struct kobject *kobj,
257 return -ENOSYS; 261 return -ENOSYS;
258} 262}
259 263
260static inline int sysfs_create_dir(struct kobject *kobj) 264static inline int sysfs_create_dir_ns(struct kobject *kobj, const void *ns)
261{ 265{
262 return 0; 266 return 0;
263} 267}
@@ -266,19 +270,22 @@ static inline void sysfs_remove_dir(struct kobject *kobj)
266{ 270{
267} 271}
268 272
269static inline int sysfs_rename_dir(struct kobject *kobj, const char *new_name) 273static inline int sysfs_rename_dir_ns(struct kobject *kobj,
274 const char *new_name, const void *new_ns)
270{ 275{
271 return 0; 276 return 0;
272} 277}
273 278
274static inline int sysfs_move_dir(struct kobject *kobj, 279static inline int sysfs_move_dir_ns(struct kobject *kobj,
275 struct kobject *new_parent_kobj) 280 struct kobject *new_parent_kobj,
281 const void *new_ns)
276{ 282{
277 return 0; 283 return 0;
278} 284}
279 285
280static inline int sysfs_create_file(struct kobject *kobj, 286static inline int sysfs_create_file_ns(struct kobject *kobj,
281 const struct attribute *attr) 287 const struct attribute *attr,
288 const void *ns)
282{ 289{
283 return 0; 290 return 0;
284} 291}
@@ -295,8 +302,9 @@ static inline int sysfs_chmod_file(struct kobject *kobj,
295 return 0; 302 return 0;
296} 303}
297 304
298static inline void sysfs_remove_file(struct kobject *kobj, 305static inline void sysfs_remove_file_ns(struct kobject *kobj,
299 const struct attribute *attr) 306 const struct attribute *attr,
307 const void *ns)
300{ 308{
301} 309}
302 310
@@ -333,8 +341,9 @@ static inline void sysfs_remove_link(struct kobject *kobj, const char *name)
333{ 341{
334} 342}
335 343
336static inline int sysfs_rename_link(struct kobject *k, struct kobject *t, 344static inline int sysfs_rename_link_ns(struct kobject *k, struct kobject *t,
337 const char *old_name, const char *new_name) 345 const char *old_name,
346 const char *new_name, const void *ns)
338{ 347{
339 return 0; 348 return 0;
340} 349}
@@ -413,10 +422,9 @@ static inline void sysfs_notify(struct kobject *kobj, const char *dir,
413static inline void sysfs_notify_dirent(struct sysfs_dirent *sd) 422static inline void sysfs_notify_dirent(struct sysfs_dirent *sd)
414{ 423{
415} 424}
416static inline 425static inline struct sysfs_dirent *
417struct sysfs_dirent *sysfs_get_dirent(struct sysfs_dirent *parent_sd, 426sysfs_get_dirent_ns(struct sysfs_dirent *parent_sd, const unsigned char *name,
418 const void *ns, 427 const void *ns)
419 const unsigned char *name)
420{ 428{
421 return NULL; 429 return NULL;
422} 430}
@@ -435,4 +443,28 @@ static inline int __must_check sysfs_init(void)
435 443
436#endif /* CONFIG_SYSFS */ 444#endif /* CONFIG_SYSFS */
437 445
446static inline int __must_check sysfs_create_file(struct kobject *kobj,
447 const struct attribute *attr)
448{
449 return sysfs_create_file_ns(kobj, attr, NULL);
450}
451
452static inline void sysfs_remove_file(struct kobject *kobj,
453 const struct attribute *attr)
454{
455 return sysfs_remove_file_ns(kobj, attr, NULL);
456}
457
458static inline int sysfs_rename_link(struct kobject *kobj, struct kobject *target,
459 const char *old_name, const char *new_name)
460{
461 return sysfs_rename_link_ns(kobj, target, old_name, new_name, NULL);
462}
463
464static inline struct sysfs_dirent *
465sysfs_get_dirent(struct sysfs_dirent *parent_sd, const unsigned char *name)
466{
467 return sysfs_get_dirent_ns(parent_sd, name, NULL);
468}
469
438#endif /* _SYSFS_H_ */ 470#endif /* _SYSFS_H_ */
diff --git a/include/linux/sysrq.h b/include/linux/sysrq.h
index 7faf933cced7..387fa7d05c98 100644
--- a/include/linux/sysrq.h
+++ b/include/linux/sysrq.h
@@ -17,9 +17,6 @@
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/types.h> 18#include <linux/types.h>
19 19
20/* Enable/disable SYSRQ support by default (0==no, 1==yes). */
21#define SYSRQ_DEFAULT_ENABLE 1
22
23/* Possible values of bitmask for enabling sysrq functions */ 20/* Possible values of bitmask for enabling sysrq functions */
24/* 0x0001 is reserved for enable everything */ 21/* 0x0001 is reserved for enable everything */
25#define SYSRQ_ENABLE_LOG 0x0002 22#define SYSRQ_ENABLE_LOG 0x0002
diff --git a/include/linux/tegra-powergate.h b/include/linux/tegra-powergate.h
index 55c29a8d5015..c98cfa406952 100644
--- a/include/linux/tegra-powergate.h
+++ b/include/linux/tegra-powergate.h
@@ -34,8 +34,15 @@ struct clk;
34#define TEGRA_POWERGATE_CPU3 11 34#define TEGRA_POWERGATE_CPU3 11
35#define TEGRA_POWERGATE_CELP 12 35#define TEGRA_POWERGATE_CELP 12
36#define TEGRA_POWERGATE_3D1 13 36#define TEGRA_POWERGATE_3D1 13
37#define TEGRA_POWERGATE_CPU0 14
38#define TEGRA_POWERGATE_C0NC 15
39#define TEGRA_POWERGATE_C1NC 16
40#define TEGRA_POWERGATE_DIS 18
41#define TEGRA_POWERGATE_DISB 19
42#define TEGRA_POWERGATE_XUSBA 20
43#define TEGRA_POWERGATE_XUSBB 21
44#define TEGRA_POWERGATE_XUSBC 22
37 45
38#define TEGRA_POWERGATE_CPU0 TEGRA_POWERGATE_CPU
39#define TEGRA_POWERGATE_3D0 TEGRA_POWERGATE_3D 46#define TEGRA_POWERGATE_3D0 TEGRA_POWERGATE_3D
40 47
41int tegra_powergate_is_powered(int id); 48int tegra_powergate_is_powered(int id);
diff --git a/include/linux/thread_info.h b/include/linux/thread_info.h
index e7e04736802f..fddbe2023a5d 100644
--- a/include/linux/thread_info.h
+++ b/include/linux/thread_info.h
@@ -104,8 +104,21 @@ static inline int test_ti_thread_flag(struct thread_info *ti, int flag)
104#define test_thread_flag(flag) \ 104#define test_thread_flag(flag) \
105 test_ti_thread_flag(current_thread_info(), flag) 105 test_ti_thread_flag(current_thread_info(), flag)
106 106
107#define set_need_resched() set_thread_flag(TIF_NEED_RESCHED) 107static inline __deprecated void set_need_resched(void)
108#define clear_need_resched() clear_thread_flag(TIF_NEED_RESCHED) 108{
109 /*
110 * Use of this function in deprecated.
111 *
112 * As of this writing there are only a few users in the DRM tree left
113 * all of which are wrong and can be removed without causing too much
114 * grief.
115 *
116 * The DRM people are aware and are working on removing the last few
117 * instances.
118 */
119}
120
121#define tif_need_resched() test_thread_flag(TIF_NEED_RESCHED)
109 122
110#if defined TIF_RESTORE_SIGMASK && !defined HAVE_SET_RESTORE_SIGMASK 123#if defined TIF_RESTORE_SIGMASK && !defined HAVE_SET_RESTORE_SIGMASK
111/* 124/*
diff --git a/include/linux/topology.h b/include/linux/topology.h
index d3cf0d6e7712..12ae6ce997d6 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -106,6 +106,8 @@ int arch_update_cpu_topology(void);
106 .last_balance = jiffies, \ 106 .last_balance = jiffies, \
107 .balance_interval = 1, \ 107 .balance_interval = 1, \
108 .smt_gain = 1178, /* 15% */ \ 108 .smt_gain = 1178, /* 15% */ \
109 .max_newidle_lb_cost = 0, \
110 .next_decay_max_lb_cost = jiffies, \
109} 111}
110#endif 112#endif
111#endif /* CONFIG_SCHED_SMT */ 113#endif /* CONFIG_SCHED_SMT */
@@ -135,6 +137,8 @@ int arch_update_cpu_topology(void);
135 , \ 137 , \
136 .last_balance = jiffies, \ 138 .last_balance = jiffies, \
137 .balance_interval = 1, \ 139 .balance_interval = 1, \
140 .max_newidle_lb_cost = 0, \
141 .next_decay_max_lb_cost = jiffies, \
138} 142}
139#endif 143#endif
140#endif /* CONFIG_SCHED_MC */ 144#endif /* CONFIG_SCHED_MC */
@@ -166,6 +170,8 @@ int arch_update_cpu_topology(void);
166 , \ 170 , \
167 .last_balance = jiffies, \ 171 .last_balance = jiffies, \
168 .balance_interval = 1, \ 172 .balance_interval = 1, \
173 .max_newidle_lb_cost = 0, \
174 .next_decay_max_lb_cost = jiffies, \
169} 175}
170#endif 176#endif
171 177
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 64f864651d86..97d660ed70c1 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -180,7 +180,6 @@ struct tty_port_operations {
180 IFF the port was initialized. Do not use to free resources. Called 180 IFF the port was initialized. Do not use to free resources. Called
181 under the port mutex to serialize against activate/shutdowns */ 181 under the port mutex to serialize against activate/shutdowns */
182 void (*shutdown)(struct tty_port *port); 182 void (*shutdown)(struct tty_port *port);
183 void (*drop)(struct tty_port *port);
184 /* Called under the port mutex from tty_port_open, serialized using 183 /* Called under the port mutex from tty_port_open, serialized using
185 the port mutex */ 184 the port mutex */
186 /* FIXME: long term getting the tty argument *out* of this would be 185 /* FIXME: long term getting the tty argument *out* of this would be
@@ -672,31 +671,17 @@ static inline void tty_wait_until_sent_from_close(struct tty_struct *tty,
672#define wait_event_interruptible_tty(tty, wq, condition) \ 671#define wait_event_interruptible_tty(tty, wq, condition) \
673({ \ 672({ \
674 int __ret = 0; \ 673 int __ret = 0; \
675 if (!(condition)) { \ 674 if (!(condition)) \
676 __wait_event_interruptible_tty(tty, wq, condition, __ret); \ 675 __ret = __wait_event_interruptible_tty(tty, wq, \
677 } \ 676 condition); \
678 __ret; \ 677 __ret; \
679}) 678})
680 679
681#define __wait_event_interruptible_tty(tty, wq, condition, ret) \ 680#define __wait_event_interruptible_tty(tty, wq, condition) \
682do { \ 681 ___wait_event(wq, condition, TASK_INTERRUPTIBLE, 0, 0, \
683 DEFINE_WAIT(__wait); \ 682 tty_unlock(tty); \
684 \
685 for (;;) { \
686 prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \
687 if (condition) \
688 break; \
689 if (!signal_pending(current)) { \
690 tty_unlock(tty); \
691 schedule(); \ 683 schedule(); \
692 tty_lock(tty); \ 684 tty_lock(tty))
693 continue; \
694 } \
695 ret = -ERESTARTSYS; \
696 break; \
697 } \
698 finish_wait(&wq, &__wait); \
699} while (0)
700 685
701#ifdef CONFIG_PROC_FS 686#ifdef CONFIG_PROC_FS
702extern void proc_tty_register_driver(struct tty_driver *); 687extern void proc_tty_register_driver(struct tty_driver *);
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
index 5ca0951e1855..9d8cf056e661 100644
--- a/include/linux/uaccess.h
+++ b/include/linux/uaccess.h
@@ -15,7 +15,7 @@
15 */ 15 */
16static inline void pagefault_disable(void) 16static inline void pagefault_disable(void)
17{ 17{
18 inc_preempt_count(); 18 preempt_count_inc();
19 /* 19 /*
20 * make sure to have issued the store before a pagefault 20 * make sure to have issued the store before a pagefault
21 * can hit. 21 * can hit.
@@ -30,11 +30,7 @@ static inline void pagefault_enable(void)
30 * the pagefault handler again. 30 * the pagefault handler again.
31 */ 31 */
32 barrier(); 32 barrier();
33 dec_preempt_count(); 33 preempt_count_dec();
34 /*
35 * make sure we do..
36 */
37 barrier();
38 preempt_check_resched(); 34 preempt_check_resched();
39} 35}
40 36
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index 06f28beed7c2..319eae70fe84 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -30,6 +30,7 @@
30struct vm_area_struct; 30struct vm_area_struct;
31struct mm_struct; 31struct mm_struct;
32struct inode; 32struct inode;
33struct notifier_block;
33 34
34#ifdef CONFIG_ARCH_SUPPORTS_UPROBES 35#ifdef CONFIG_ARCH_SUPPORTS_UPROBES
35# include <asm/uprobes.h> 36# include <asm/uprobes.h>
@@ -108,6 +109,7 @@ extern int __weak set_swbp(struct arch_uprobe *aup, struct mm_struct *mm, unsign
108extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr); 109extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr);
109extern bool __weak is_swbp_insn(uprobe_opcode_t *insn); 110extern bool __weak is_swbp_insn(uprobe_opcode_t *insn);
110extern bool __weak is_trap_insn(uprobe_opcode_t *insn); 111extern bool __weak is_trap_insn(uprobe_opcode_t *insn);
112extern int uprobe_write_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_t);
111extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); 113extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
112extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool); 114extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool);
113extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); 115extern void uprobe_unregister(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
@@ -117,14 +119,21 @@ extern void uprobe_start_dup_mmap(void);
117extern void uprobe_end_dup_mmap(void); 119extern void uprobe_end_dup_mmap(void);
118extern void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm); 120extern void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm);
119extern void uprobe_free_utask(struct task_struct *t); 121extern void uprobe_free_utask(struct task_struct *t);
120extern void uprobe_copy_process(struct task_struct *t); 122extern void uprobe_copy_process(struct task_struct *t, unsigned long flags);
121extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs); 123extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs);
122extern int uprobe_post_sstep_notifier(struct pt_regs *regs); 124extern int uprobe_post_sstep_notifier(struct pt_regs *regs);
123extern int uprobe_pre_sstep_notifier(struct pt_regs *regs); 125extern int uprobe_pre_sstep_notifier(struct pt_regs *regs);
124extern void uprobe_notify_resume(struct pt_regs *regs); 126extern void uprobe_notify_resume(struct pt_regs *regs);
125extern bool uprobe_deny_signal(void); 127extern bool uprobe_deny_signal(void);
126extern bool __weak arch_uprobe_skip_sstep(struct arch_uprobe *aup, struct pt_regs *regs); 128extern bool arch_uprobe_skip_sstep(struct arch_uprobe *aup, struct pt_regs *regs);
127extern void uprobe_clear_state(struct mm_struct *mm); 129extern void uprobe_clear_state(struct mm_struct *mm);
130extern int arch_uprobe_analyze_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long addr);
131extern int arch_uprobe_pre_xol(struct arch_uprobe *aup, struct pt_regs *regs);
132extern int arch_uprobe_post_xol(struct arch_uprobe *aup, struct pt_regs *regs);
133extern bool arch_uprobe_xol_was_trapped(struct task_struct *tsk);
134extern int arch_uprobe_exception_notify(struct notifier_block *self, unsigned long val, void *data);
135extern void arch_uprobe_abort_xol(struct arch_uprobe *aup, struct pt_regs *regs);
136extern unsigned long arch_uretprobe_hijack_return_addr(unsigned long trampoline_vaddr, struct pt_regs *regs);
128#else /* !CONFIG_UPROBES */ 137#else /* !CONFIG_UPROBES */
129struct uprobes_state { 138struct uprobes_state {
130}; 139};
@@ -174,7 +183,7 @@ static inline unsigned long uprobe_get_swbp_addr(struct pt_regs *regs)
174static inline void uprobe_free_utask(struct task_struct *t) 183static inline void uprobe_free_utask(struct task_struct *t)
175{ 184{
176} 185}
177static inline void uprobe_copy_process(struct task_struct *t) 186static inline void uprobe_copy_process(struct task_struct *t, unsigned long flags)
178{ 187{
179} 188}
180static inline void uprobe_clear_state(struct mm_struct *mm) 189static inline void uprobe_clear_state(struct mm_struct *mm)
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 001629cd1a97..7454865ad148 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -475,7 +475,8 @@ struct usb3_lpm_parameters {
475 * @lpm_capable: device supports LPM 475 * @lpm_capable: device supports LPM
476 * @usb2_hw_lpm_capable: device can perform USB2 hardware LPM 476 * @usb2_hw_lpm_capable: device can perform USB2 hardware LPM
477 * @usb2_hw_lpm_besl_capable: device can perform USB2 hardware BESL LPM 477 * @usb2_hw_lpm_besl_capable: device can perform USB2 hardware BESL LPM
478 * @usb2_hw_lpm_enabled: USB2 hardware LPM enabled 478 * @usb2_hw_lpm_enabled: USB2 hardware LPM is enabled
479 * @usb2_hw_lpm_allowed: Userspace allows USB 2.0 LPM to be enabled
479 * @usb3_lpm_enabled: USB3 hardware LPM enabled 480 * @usb3_lpm_enabled: USB3 hardware LPM enabled
480 * @string_langid: language ID for strings 481 * @string_langid: language ID for strings
481 * @product: iProduct string, if present (static) 482 * @product: iProduct string, if present (static)
@@ -548,6 +549,7 @@ struct usb_device {
548 unsigned usb2_hw_lpm_capable:1; 549 unsigned usb2_hw_lpm_capable:1;
549 unsigned usb2_hw_lpm_besl_capable:1; 550 unsigned usb2_hw_lpm_besl_capable:1;
550 unsigned usb2_hw_lpm_enabled:1; 551 unsigned usb2_hw_lpm_enabled:1;
552 unsigned usb2_hw_lpm_allowed:1;
551 unsigned usb3_lpm_enabled:1; 553 unsigned usb3_lpm_enabled:1;
552 int string_langid; 554 int string_langid;
553 555
@@ -702,7 +704,7 @@ extern int usb_alloc_streams(struct usb_interface *interface,
702 unsigned int num_streams, gfp_t mem_flags); 704 unsigned int num_streams, gfp_t mem_flags);
703 705
704/* Reverts a group of bulk endpoints back to not using stream IDs. */ 706/* Reverts a group of bulk endpoints back to not using stream IDs. */
705extern void usb_free_streams(struct usb_interface *interface, 707extern int usb_free_streams(struct usb_interface *interface,
706 struct usb_host_endpoint **eps, unsigned int num_eps, 708 struct usb_host_endpoint **eps, unsigned int num_eps,
707 gfp_t mem_flags); 709 gfp_t mem_flags);
708 710
@@ -1209,11 +1211,13 @@ struct usb_anchor {
1209 struct list_head urb_list; 1211 struct list_head urb_list;
1210 wait_queue_head_t wait; 1212 wait_queue_head_t wait;
1211 spinlock_t lock; 1213 spinlock_t lock;
1214 atomic_t suspend_wakeups;
1212 unsigned int poisoned:1; 1215 unsigned int poisoned:1;
1213}; 1216};
1214 1217
1215static inline void init_usb_anchor(struct usb_anchor *anchor) 1218static inline void init_usb_anchor(struct usb_anchor *anchor)
1216{ 1219{
1220 memset(anchor, 0, sizeof(*anchor));
1217 INIT_LIST_HEAD(&anchor->urb_list); 1221 INIT_LIST_HEAD(&anchor->urb_list);
1218 init_waitqueue_head(&anchor->wait); 1222 init_waitqueue_head(&anchor->wait);
1219 spin_lock_init(&anchor->lock); 1223 spin_lock_init(&anchor->lock);
@@ -1574,6 +1578,8 @@ extern void usb_kill_anchored_urbs(struct usb_anchor *anchor);
1574extern void usb_poison_anchored_urbs(struct usb_anchor *anchor); 1578extern void usb_poison_anchored_urbs(struct usb_anchor *anchor);
1575extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor); 1579extern void usb_unpoison_anchored_urbs(struct usb_anchor *anchor);
1576extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor); 1580extern void usb_unlink_anchored_urbs(struct usb_anchor *anchor);
1581extern void usb_anchor_suspend_wakeups(struct usb_anchor *anchor);
1582extern void usb_anchor_resume_wakeups(struct usb_anchor *anchor);
1577extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor); 1583extern void usb_anchor_urb(struct urb *urb, struct usb_anchor *anchor);
1578extern void usb_unanchor_urb(struct urb *urb); 1584extern void usb_unanchor_urb(struct urb *urb);
1579extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor, 1585extern int usb_wait_anchor_empty_timeout(struct usb_anchor *anchor,
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index 75efc45eaa2f..b8aba196f7f1 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -73,6 +73,7 @@ struct giveback_urb_bh {
73 spinlock_t lock; 73 spinlock_t lock;
74 struct list_head head; 74 struct list_head head;
75 struct tasklet_struct bh; 75 struct tasklet_struct bh;
76 struct usb_host_endpoint *completing_ep;
76}; 77};
77 78
78struct usb_hcd { 79struct usb_hcd {
@@ -140,6 +141,7 @@ struct usb_hcd {
140 unsigned wireless:1; /* Wireless USB HCD */ 141 unsigned wireless:1; /* Wireless USB HCD */
141 unsigned authorized_default:1; 142 unsigned authorized_default:1;
142 unsigned has_tt:1; /* Integrated TT in root hub */ 143 unsigned has_tt:1; /* Integrated TT in root hub */
144 unsigned amd_resume_bug:1; /* AMD remote wakeup quirk */
143 145
144 unsigned int irq; /* irq allocated */ 146 unsigned int irq; /* irq allocated */
145 void __iomem *regs; /* device memory/io */ 147 void __iomem *regs; /* device memory/io */
@@ -378,6 +380,12 @@ static inline int hcd_giveback_urb_in_bh(struct usb_hcd *hcd)
378 return hcd->driver->flags & HCD_BH; 380 return hcd->driver->flags & HCD_BH;
379} 381}
380 382
383static inline bool hcd_periodic_completion_in_progress(struct usb_hcd *hcd,
384 struct usb_host_endpoint *ep)
385{
386 return hcd->high_prio_bh.completing_ep == ep;
387}
388
381extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb); 389extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb);
382extern int usb_hcd_check_unlink_urb(struct usb_hcd *hcd, struct urb *urb, 390extern int usb_hcd_check_unlink_urb(struct usb_hcd *hcd, struct urb *urb,
383 int status); 391 int status);
@@ -428,6 +436,8 @@ extern int usb_hcd_pci_probe(struct pci_dev *dev,
428extern void usb_hcd_pci_remove(struct pci_dev *dev); 436extern void usb_hcd_pci_remove(struct pci_dev *dev);
429extern void usb_hcd_pci_shutdown(struct pci_dev *dev); 437extern void usb_hcd_pci_shutdown(struct pci_dev *dev);
430 438
439extern int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *dev);
440
431#ifdef CONFIG_PM 441#ifdef CONFIG_PM
432extern const struct dev_pm_ops usb_hcd_pci_pm_ops; 442extern const struct dev_pm_ops usb_hcd_pci_pm_ops;
433#endif 443#endif
@@ -496,6 +506,7 @@ struct usb_tt {
496 struct usb_device *hub; /* upstream highspeed hub */ 506 struct usb_device *hub; /* upstream highspeed hub */
497 int multi; /* true means one TT per port */ 507 int multi; /* true means one TT per port */
498 unsigned think_time; /* think time in ns */ 508 unsigned think_time; /* think time in ns */
509 void *hcpriv; /* HCD private data */
499 510
500 /* for control/bulk error recovery (CLEAR_TT_BUFFER) */ 511 /* for control/bulk error recovery (CLEAR_TT_BUFFER) */
501 spinlock_t lock; 512 spinlock_t lock;
@@ -554,9 +565,8 @@ extern void usb_ep0_reinit(struct usb_device *);
554 * of (7/6 * 8 * bytecount) = 9.33 * bytecount */ 565 * of (7/6 * 8 * bytecount) = 9.33 * bytecount */
555 /* bytecount = data payload byte count */ 566 /* bytecount = data payload byte count */
556 567
557#define NS_TO_US(ns) ((ns + 500L) / 1000L) 568#define NS_TO_US(ns) DIV_ROUND_UP(ns, 1000L)
558 /* convert & round nanoseconds to microseconds */ 569 /* convert nanoseconds to microseconds, rounding up */
559
560 570
561/* 571/*
562 * Full/low speed bandwidth allocation constants/support. 572 * Full/low speed bandwidth allocation constants/support.
diff --git a/include/linux/usb/intel_mid_otg.h b/include/linux/usb/intel_mid_otg.h
deleted file mode 100644
index 756cf5543ffd..000000000000
--- a/include/linux/usb/intel_mid_otg.h
+++ /dev/null
@@ -1,180 +0,0 @@
1/*
2 * Intel MID (Langwell/Penwell) USB OTG Transceiver driver
3 * Copyright (C) 2008 - 2010, Intel Corporation.
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
8 *
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along with
15 * this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
17 *
18 */
19
20#ifndef __INTEL_MID_OTG_H
21#define __INTEL_MID_OTG_H
22
23#include <linux/pm.h>
24#include <linux/usb/otg.h>
25#include <linux/notifier.h>
26
27struct intel_mid_otg_xceiv;
28
29/* This is a common data structure for Intel MID platform to
30 * save values of the OTG state machine */
31struct otg_hsm {
32 /* Input */
33 int a_bus_resume;
34 int a_bus_suspend;
35 int a_conn;
36 int a_sess_vld;
37 int a_srp_det;
38 int a_vbus_vld;
39 int b_bus_resume;
40 int b_bus_suspend;
41 int b_conn;
42 int b_se0_srp;
43 int b_ssend_srp;
44 int b_sess_end;
45 int b_sess_vld;
46 int id;
47/* id values */
48#define ID_B 0x05
49#define ID_A 0x04
50#define ID_ACA_C 0x03
51#define ID_ACA_B 0x02
52#define ID_ACA_A 0x01
53 int power_up;
54 int adp_change;
55 int test_device;
56
57 /* Internal variables */
58 int a_set_b_hnp_en;
59 int b_srp_done;
60 int b_hnp_enable;
61 int hnp_poll_enable;
62
63 /* Timeout indicator for timers */
64 int a_wait_vrise_tmout;
65 int a_wait_bcon_tmout;
66 int a_aidl_bdis_tmout;
67 int a_bidl_adis_tmout;
68 int a_bidl_adis_tmr;
69 int a_wait_vfall_tmout;
70 int b_ase0_brst_tmout;
71 int b_bus_suspend_tmout;
72 int b_srp_init_tmout;
73 int b_srp_fail_tmout;
74 int b_srp_fail_tmr;
75 int b_adp_sense_tmout;
76
77 /* Informative variables */
78 int a_bus_drop;
79 int a_bus_req;
80 int a_clr_err;
81 int b_bus_req;
82 int a_suspend_req;
83 int b_bus_suspend_vld;
84
85 /* Output */
86 int drv_vbus;
87 int loc_conn;
88 int loc_sof;
89
90 /* Others */
91 int vbus_srp_up;
92};
93
94/* must provide ULPI access function to read/write registers implemented in
95 * ULPI address space */
96struct iotg_ulpi_access_ops {
97 int (*read)(struct intel_mid_otg_xceiv *iotg, u8 reg, u8 *val);
98 int (*write)(struct intel_mid_otg_xceiv *iotg, u8 reg, u8 val);
99};
100
101#define OTG_A_DEVICE 0x0
102#define OTG_B_DEVICE 0x1
103
104/*
105 * the Intel MID (Langwell/Penwell) otg transceiver driver needs to interact
106 * with device and host drivers to implement the USB OTG related feature. More
107 * function members are added based on usb_phy data structure for this
108 * purpose.
109 */
110struct intel_mid_otg_xceiv {
111 struct usb_phy otg;
112 struct otg_hsm hsm;
113
114 /* base address */
115 void __iomem *base;
116
117 /* ops to access ulpi */
118 struct iotg_ulpi_access_ops ulpi_ops;
119
120 /* atomic notifier for interrupt context */
121 struct atomic_notifier_head iotg_notifier;
122
123 /* start/stop USB Host function */
124 int (*start_host)(struct intel_mid_otg_xceiv *iotg);
125 int (*stop_host)(struct intel_mid_otg_xceiv *iotg);
126
127 /* start/stop USB Peripheral function */
128 int (*start_peripheral)(struct intel_mid_otg_xceiv *iotg);
129 int (*stop_peripheral)(struct intel_mid_otg_xceiv *iotg);
130
131 /* start/stop ADP sense/probe function */
132 int (*set_adp_probe)(struct intel_mid_otg_xceiv *iotg,
133 bool enabled, int dev);
134 int (*set_adp_sense)(struct intel_mid_otg_xceiv *iotg,
135 bool enabled);
136
137#ifdef CONFIG_PM
138 /* suspend/resume USB host function */
139 int (*suspend_host)(struct intel_mid_otg_xceiv *iotg,
140 pm_message_t message);
141 int (*resume_host)(struct intel_mid_otg_xceiv *iotg);
142
143 int (*suspend_peripheral)(struct intel_mid_otg_xceiv *iotg,
144 pm_message_t message);
145 int (*resume_peripheral)(struct intel_mid_otg_xceiv *iotg);
146#endif
147
148};
149static inline
150struct intel_mid_otg_xceiv *otg_to_mid_xceiv(struct usb_phy *otg)
151{
152 return container_of(otg, struct intel_mid_otg_xceiv, otg);
153}
154
155#define MID_OTG_NOTIFY_CONNECT 0x0001
156#define MID_OTG_NOTIFY_DISCONN 0x0002
157#define MID_OTG_NOTIFY_HSUSPEND 0x0003
158#define MID_OTG_NOTIFY_HRESUME 0x0004
159#define MID_OTG_NOTIFY_CSUSPEND 0x0005
160#define MID_OTG_NOTIFY_CRESUME 0x0006
161#define MID_OTG_NOTIFY_HOSTADD 0x0007
162#define MID_OTG_NOTIFY_HOSTREMOVE 0x0008
163#define MID_OTG_NOTIFY_CLIENTADD 0x0009
164#define MID_OTG_NOTIFY_CLIENTREMOVE 0x000a
165
166static inline int
167intel_mid_otg_register_notifier(struct intel_mid_otg_xceiv *iotg,
168 struct notifier_block *nb)
169{
170 return atomic_notifier_chain_register(&iotg->iotg_notifier, nb);
171}
172
173static inline void
174intel_mid_otg_unregister_notifier(struct intel_mid_otg_xceiv *iotg,
175 struct notifier_block *nb)
176{
177 atomic_notifier_chain_unregister(&iotg->iotg_notifier, nb);
178}
179
180#endif /* __INTEL_MID_OTG_H */
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h
index 053c26841cc3..eb505250940a 100644
--- a/include/linux/usb/musb.h
+++ b/include/linux/usb/musb.h
@@ -99,8 +99,6 @@ struct musb_hdrc_platform_data {
99 /* MUSB_HOST, MUSB_PERIPHERAL, or MUSB_OTG */ 99 /* MUSB_HOST, MUSB_PERIPHERAL, or MUSB_OTG */
100 u8 mode; 100 u8 mode;
101 101
102 u8 has_mailbox:1;
103
104 /* for clk_get() */ 102 /* for clk_get() */
105 const char *clock; 103 const char *clock;
106 104
diff --git a/include/linux/usb/omap_control_usb.h b/include/linux/usb/omap_control_usb.h
index 27b5b8c931b0..596b01918813 100644
--- a/include/linux/usb/omap_control_usb.h
+++ b/include/linux/usb/omap_control_usb.h
@@ -19,20 +19,23 @@
19#ifndef __OMAP_CONTROL_USB_H__ 19#ifndef __OMAP_CONTROL_USB_H__
20#define __OMAP_CONTROL_USB_H__ 20#define __OMAP_CONTROL_USB_H__
21 21
22enum omap_control_usb_type {
23 OMAP_CTRL_TYPE_OTGHS = 1, /* Mailbox OTGHS_CONTROL */
24 OMAP_CTRL_TYPE_USB2, /* USB2_PHY, power down in CONTROL_DEV_CONF */
25 OMAP_CTRL_TYPE_PIPE3, /* PIPE3 PHY, DPLL & seperate Rx/Tx power */
26 OMAP_CTRL_TYPE_DRA7USB2, /* USB2 PHY, power and power_aux e.g. DRA7 */
27};
28
22struct omap_control_usb { 29struct omap_control_usb {
23 struct device *dev; 30 struct device *dev;
24 31
25 u32 __iomem *dev_conf;
26 u32 __iomem *otghs_control; 32 u32 __iomem *otghs_control;
27 u32 __iomem *phy_power; 33 u32 __iomem *power;
34 u32 __iomem *power_aux;
28 35
29 struct clk *sys_clk; 36 struct clk *sys_clk;
30 37
31 u32 type; 38 enum omap_control_usb_type type;
32};
33
34struct omap_control_usb_platform_data {
35 u8 type;
36}; 39};
37 40
38enum omap_control_usb_mode { 41enum omap_control_usb_mode {
@@ -42,10 +45,6 @@ enum omap_control_usb_mode {
42 USB_MODE_DISCONNECT, 45 USB_MODE_DISCONNECT,
43}; 46};
44 47
45/* To differentiate ctrl module IP having either mailbox or USB3 PHY power */
46#define OMAP_CTRL_DEV_TYPE1 0x1
47#define OMAP_CTRL_DEV_TYPE2 0x2
48
49#define OMAP_CTRL_DEV_PHY_PD BIT(0) 48#define OMAP_CTRL_DEV_PHY_PD BIT(0)
50 49
51#define OMAP_CTRL_DEV_AVALID BIT(0) 50#define OMAP_CTRL_DEV_AVALID BIT(0)
@@ -63,26 +62,18 @@ enum omap_control_usb_mode {
63#define OMAP_CTRL_USB3_PHY_TX_RX_POWERON 0x3 62#define OMAP_CTRL_USB3_PHY_TX_RX_POWERON 0x3
64#define OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF 0x0 63#define OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF 0x0
65 64
65#define OMAP_CTRL_USB2_PHY_PD BIT(28)
66
66#if IS_ENABLED(CONFIG_OMAP_CONTROL_USB) 67#if IS_ENABLED(CONFIG_OMAP_CONTROL_USB)
67extern struct device *omap_get_control_dev(void);
68extern void omap_control_usb_phy_power(struct device *dev, int on); 68extern void omap_control_usb_phy_power(struct device *dev, int on);
69extern void omap_control_usb3_phy_power(struct device *dev, bool on);
70extern void omap_control_usb_set_mode(struct device *dev, 69extern void omap_control_usb_set_mode(struct device *dev,
71 enum omap_control_usb_mode mode); 70 enum omap_control_usb_mode mode);
72#else 71#else
73static inline struct device *omap_get_control_dev(void)
74{
75 return ERR_PTR(-ENODEV);
76}
77 72
78static inline void omap_control_usb_phy_power(struct device *dev, int on) 73static inline void omap_control_usb_phy_power(struct device *dev, int on)
79{ 74{
80} 75}
81 76
82static inline void omap_control_usb3_phy_power(struct device *dev, int on)
83{
84}
85
86static inline void omap_control_usb_set_mode(struct device *dev, 77static inline void omap_control_usb_set_mode(struct device *dev,
87 enum omap_control_usb_mode mode) 78 enum omap_control_usb_mode mode)
88{ 79{
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index d528b8045150..704a1ab8240c 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -320,6 +320,8 @@ extern struct usb_serial_port *usb_serial_port_get_by_minor(unsigned int minor);
320extern void usb_serial_put(struct usb_serial *serial); 320extern void usb_serial_put(struct usb_serial *serial);
321extern int usb_serial_generic_open(struct tty_struct *tty, 321extern int usb_serial_generic_open(struct tty_struct *tty,
322 struct usb_serial_port *port); 322 struct usb_serial_port *port);
323extern int usb_serial_generic_write_start(struct usb_serial_port *port,
324 gfp_t mem_flags);
323extern int usb_serial_generic_write(struct tty_struct *tty, 325extern int usb_serial_generic_write(struct tty_struct *tty,
324 struct usb_serial_port *port, const unsigned char *buf, int count); 326 struct usb_serial_port *port, const unsigned char *buf, int count);
325extern void usb_serial_generic_close(struct usb_serial_port *port); 327extern void usb_serial_generic_close(struct usb_serial_port *port);
diff --git a/include/linux/usb/usb_phy_gen_xceiv.h b/include/linux/usb/usb_phy_gen_xceiv.h
index 11d85b9c1b08..cc8d818a83be 100644
--- a/include/linux/usb/usb_phy_gen_xceiv.h
+++ b/include/linux/usb/usb_phy_gen_xceiv.h
@@ -9,7 +9,8 @@ struct usb_phy_gen_xceiv_platform_data {
9 9
10 /* if set fails with -EPROBE_DEFER if can't get regulator */ 10 /* if set fails with -EPROBE_DEFER if can't get regulator */
11 unsigned int needs_vcc:1; 11 unsigned int needs_vcc:1;
12 unsigned int needs_reset:1; 12 unsigned int needs_reset:1; /* deprecated */
13 int gpio_reset;
13}; 14};
14 15
15#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE)) 16#if defined(CONFIG_NOP_USB_XCEIV) || (defined(CONFIG_NOP_USB_XCEIV_MODULE) && defined(MODULE))
diff --git a/include/linux/usb/wusb-wa.h b/include/linux/usb/wusb-wa.h
index 4ff744e2b678..c1257130769b 100644
--- a/include/linux/usb/wusb-wa.h
+++ b/include/linux/usb/wusb-wa.h
@@ -142,7 +142,7 @@ enum wa_notif_type {
142struct wa_notif_hdr { 142struct wa_notif_hdr {
143 u8 bLength; 143 u8 bLength;
144 u8 bNotifyType; /* enum wa_notif_type */ 144 u8 bNotifyType; /* enum wa_notif_type */
145} __attribute__((packed)); 145} __packed;
146 146
147/** 147/**
148 * HWA DN Received notification [(WUSB] section 8.5.4.2) 148 * HWA DN Received notification [(WUSB] section 8.5.4.2)
@@ -158,7 +158,7 @@ struct hwa_notif_dn {
158 u8 bSourceDeviceAddr; /* from errata 2005/07 */ 158 u8 bSourceDeviceAddr; /* from errata 2005/07 */
159 u8 bmAttributes; 159 u8 bmAttributes;
160 struct wusb_dn_hdr dndata[]; 160 struct wusb_dn_hdr dndata[];
161} __attribute__((packed)); 161} __packed;
162 162
163/* [WUSB] section 8.3.3 */ 163/* [WUSB] section 8.3.3 */
164enum wa_xfer_type { 164enum wa_xfer_type {
@@ -167,6 +167,8 @@ enum wa_xfer_type {
167 WA_XFER_TYPE_ISO = 0x82, 167 WA_XFER_TYPE_ISO = 0x82,
168 WA_XFER_RESULT = 0x83, 168 WA_XFER_RESULT = 0x83,
169 WA_XFER_ABORT = 0x84, 169 WA_XFER_ABORT = 0x84,
170 WA_XFER_ISO_PACKET_INFO = 0xA0,
171 WA_XFER_ISO_PACKET_STATUS = 0xA1,
170}; 172};
171 173
172/* [WUSB] section 8.3.3 */ 174/* [WUSB] section 8.3.3 */
@@ -177,28 +179,47 @@ struct wa_xfer_hdr {
177 __le32 dwTransferID; /* Host-assigned ID */ 179 __le32 dwTransferID; /* Host-assigned ID */
178 __le32 dwTransferLength; /* Length of data to xfer */ 180 __le32 dwTransferLength; /* Length of data to xfer */
179 u8 bTransferSegment; 181 u8 bTransferSegment;
180} __attribute__((packed)); 182} __packed;
181 183
182struct wa_xfer_ctl { 184struct wa_xfer_ctl {
183 struct wa_xfer_hdr hdr; 185 struct wa_xfer_hdr hdr;
184 u8 bmAttribute; 186 u8 bmAttribute;
185 __le16 wReserved; 187 __le16 wReserved;
186 struct usb_ctrlrequest baSetupData; 188 struct usb_ctrlrequest baSetupData;
187} __attribute__((packed)); 189} __packed;
188 190
189struct wa_xfer_bi { 191struct wa_xfer_bi {
190 struct wa_xfer_hdr hdr; 192 struct wa_xfer_hdr hdr;
191 u8 bReserved; 193 u8 bReserved;
192 __le16 wReserved; 194 __le16 wReserved;
193} __attribute__((packed)); 195} __packed;
194 196
197/* [WUSB] section 8.5.5 */
195struct wa_xfer_hwaiso { 198struct wa_xfer_hwaiso {
196 struct wa_xfer_hdr hdr; 199 struct wa_xfer_hdr hdr;
197 u8 bReserved; 200 u8 bReserved;
198 __le16 wPresentationTime; 201 __le16 wPresentationTime;
199 __le32 dwNumOfPackets; 202 __le32 dwNumOfPackets;
200 /* FIXME: u8 pktdata[]? */ 203} __packed;
201} __attribute__((packed)); 204
205struct wa_xfer_packet_info_hwaiso {
206 __le16 wLength;
207 u8 bPacketType;
208 u8 bReserved;
209 __le16 PacketLength[0];
210} __packed;
211
212struct wa_xfer_packet_status_len_hwaiso {
213 __le16 PacketLength;
214 __le16 PacketStatus;
215} __packed;
216
217struct wa_xfer_packet_status_hwaiso {
218 __le16 wLength;
219 u8 bPacketType;
220 u8 bReserved;
221 struct wa_xfer_packet_status_len_hwaiso PacketStatus[0];
222} __packed;
202 223
203/* [WUSB] section 8.3.3.5 */ 224/* [WUSB] section 8.3.3.5 */
204struct wa_xfer_abort { 225struct wa_xfer_abort {
@@ -206,7 +227,7 @@ struct wa_xfer_abort {
206 u8 bRequestType; 227 u8 bRequestType;
207 __le16 wRPipe; /* RPipe index */ 228 __le16 wRPipe; /* RPipe index */
208 __le32 dwTransferID; /* Host-assigned ID */ 229 __le32 dwTransferID; /* Host-assigned ID */
209} __attribute__((packed)); 230} __packed;
210 231
211/** 232/**
212 * WA Transfer Complete notification ([WUSB] section 8.3.3.3) 233 * WA Transfer Complete notification ([WUSB] section 8.3.3.3)
@@ -216,7 +237,7 @@ struct wa_notif_xfer {
216 struct wa_notif_hdr hdr; 237 struct wa_notif_hdr hdr;
217 u8 bEndpoint; 238 u8 bEndpoint;
218 u8 Reserved; 239 u8 Reserved;
219} __attribute__((packed)); 240} __packed;
220 241
221/** Transfer result basic codes [WUSB] table 8-15 */ 242/** Transfer result basic codes [WUSB] table 8-15 */
222enum { 243enum {
@@ -243,7 +264,7 @@ struct wa_xfer_result {
243 u8 bTransferSegment; 264 u8 bTransferSegment;
244 u8 bTransferStatus; 265 u8 bTransferStatus;
245 __le32 dwNumOfPackets; 266 __le32 dwNumOfPackets;
246} __attribute__((packed)); 267} __packed;
247 268
248/** 269/**
249 * Wire Adapter Class Descriptor ([WUSB] section 8.5.2.7). 270 * Wire Adapter Class Descriptor ([WUSB] section 8.5.2.7).
@@ -258,16 +279,16 @@ struct wa_xfer_result {
258struct usb_wa_descriptor { 279struct usb_wa_descriptor {
259 u8 bLength; 280 u8 bLength;
260 u8 bDescriptorType; 281 u8 bDescriptorType;
261 u16 bcdWAVersion; 282 __le16 bcdWAVersion;
262 u8 bNumPorts; /* don't use!! */ 283 u8 bNumPorts; /* don't use!! */
263 u8 bmAttributes; /* Reserved == 0 */ 284 u8 bmAttributes; /* Reserved == 0 */
264 u16 wNumRPipes; 285 __le16 wNumRPipes;
265 u16 wRPipeMaxBlock; 286 __le16 wRPipeMaxBlock;
266 u8 bRPipeBlockSize; 287 u8 bRPipeBlockSize;
267 u8 bPwrOn2PwrGood; 288 u8 bPwrOn2PwrGood;
268 u8 bNumMMCIEs; 289 u8 bNumMMCIEs;
269 u8 DeviceRemovable; /* FIXME: in DWA this is up to 16 bytes */ 290 u8 DeviceRemovable; /* FIXME: in DWA this is up to 16 bytes */
270} __attribute__((packed)); 291} __packed;
271 292
272/** 293/**
273 * HWA Device Information Buffer (WUSB1.0[T8.54]) 294 * HWA Device Information Buffer (WUSB1.0[T8.54])
@@ -277,6 +298,6 @@ struct hwa_dev_info {
277 u8 bDeviceAddress; 298 u8 bDeviceAddress;
278 __le16 wPHYRates; 299 __le16 wPHYRates;
279 u8 bmDeviceAttribute; 300 u8 bmDeviceAttribute;
280} __attribute__((packed)); 301} __packed;
281 302
282#endif /* #ifndef __LINUX_USB_WUSB_WA_H */ 303#endif /* #ifndef __LINUX_USB_WUSB_WA_H */
diff --git a/include/linux/wait.h b/include/linux/wait.h
index a67fc1635592..61939ba30aa0 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -1,7 +1,8 @@
1#ifndef _LINUX_WAIT_H 1#ifndef _LINUX_WAIT_H
2#define _LINUX_WAIT_H 2#define _LINUX_WAIT_H
3 3/*
4 4 * Linux wait queue related types and methods
5 */
5#include <linux/list.h> 6#include <linux/list.h>
6#include <linux/stddef.h> 7#include <linux/stddef.h>
7#include <linux/spinlock.h> 8#include <linux/spinlock.h>
@@ -13,27 +14,27 @@ typedef int (*wait_queue_func_t)(wait_queue_t *wait, unsigned mode, int flags, v
13int default_wake_function(wait_queue_t *wait, unsigned mode, int flags, void *key); 14int default_wake_function(wait_queue_t *wait, unsigned mode, int flags, void *key);
14 15
15struct __wait_queue { 16struct __wait_queue {
16 unsigned int flags; 17 unsigned int flags;
17#define WQ_FLAG_EXCLUSIVE 0x01 18#define WQ_FLAG_EXCLUSIVE 0x01
18 void *private; 19 void *private;
19 wait_queue_func_t func; 20 wait_queue_func_t func;
20 struct list_head task_list; 21 struct list_head task_list;
21}; 22};
22 23
23struct wait_bit_key { 24struct wait_bit_key {
24 void *flags; 25 void *flags;
25 int bit_nr; 26 int bit_nr;
26#define WAIT_ATOMIC_T_BIT_NR -1 27#define WAIT_ATOMIC_T_BIT_NR -1
27}; 28};
28 29
29struct wait_bit_queue { 30struct wait_bit_queue {
30 struct wait_bit_key key; 31 struct wait_bit_key key;
31 wait_queue_t wait; 32 wait_queue_t wait;
32}; 33};
33 34
34struct __wait_queue_head { 35struct __wait_queue_head {
35 spinlock_t lock; 36 spinlock_t lock;
36 struct list_head task_list; 37 struct list_head task_list;
37}; 38};
38typedef struct __wait_queue_head wait_queue_head_t; 39typedef struct __wait_queue_head wait_queue_head_t;
39 40
@@ -84,17 +85,17 @@ extern void __init_waitqueue_head(wait_queue_head_t *q, const char *name, struct
84 85
85static inline void init_waitqueue_entry(wait_queue_t *q, struct task_struct *p) 86static inline void init_waitqueue_entry(wait_queue_t *q, struct task_struct *p)
86{ 87{
87 q->flags = 0; 88 q->flags = 0;
88 q->private = p; 89 q->private = p;
89 q->func = default_wake_function; 90 q->func = default_wake_function;
90} 91}
91 92
92static inline void init_waitqueue_func_entry(wait_queue_t *q, 93static inline void
93 wait_queue_func_t func) 94init_waitqueue_func_entry(wait_queue_t *q, wait_queue_func_t func)
94{ 95{
95 q->flags = 0; 96 q->flags = 0;
96 q->private = NULL; 97 q->private = NULL;
97 q->func = func; 98 q->func = func;
98} 99}
99 100
100static inline int waitqueue_active(wait_queue_head_t *q) 101static inline int waitqueue_active(wait_queue_head_t *q)
@@ -114,8 +115,8 @@ static inline void __add_wait_queue(wait_queue_head_t *head, wait_queue_t *new)
114/* 115/*
115 * Used for wake-one threads: 116 * Used for wake-one threads:
116 */ 117 */
117static inline void __add_wait_queue_exclusive(wait_queue_head_t *q, 118static inline void
118 wait_queue_t *wait) 119__add_wait_queue_exclusive(wait_queue_head_t *q, wait_queue_t *wait)
119{ 120{
120 wait->flags |= WQ_FLAG_EXCLUSIVE; 121 wait->flags |= WQ_FLAG_EXCLUSIVE;
121 __add_wait_queue(q, wait); 122 __add_wait_queue(q, wait);
@@ -127,23 +128,22 @@ static inline void __add_wait_queue_tail(wait_queue_head_t *head,
127 list_add_tail(&new->task_list, &head->task_list); 128 list_add_tail(&new->task_list, &head->task_list);
128} 129}
129 130
130static inline void __add_wait_queue_tail_exclusive(wait_queue_head_t *q, 131static inline void
131 wait_queue_t *wait) 132__add_wait_queue_tail_exclusive(wait_queue_head_t *q, wait_queue_t *wait)
132{ 133{
133 wait->flags |= WQ_FLAG_EXCLUSIVE; 134 wait->flags |= WQ_FLAG_EXCLUSIVE;
134 __add_wait_queue_tail(q, wait); 135 __add_wait_queue_tail(q, wait);
135} 136}
136 137
137static inline void __remove_wait_queue(wait_queue_head_t *head, 138static inline void
138 wait_queue_t *old) 139__remove_wait_queue(wait_queue_head_t *head, wait_queue_t *old)
139{ 140{
140 list_del(&old->task_list); 141 list_del(&old->task_list);
141} 142}
142 143
143void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key); 144void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key);
144void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key); 145void __wake_up_locked_key(wait_queue_head_t *q, unsigned int mode, void *key);
145void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr, 146void __wake_up_sync_key(wait_queue_head_t *q, unsigned int mode, int nr, void *key);
146 void *key);
147void __wake_up_locked(wait_queue_head_t *q, unsigned int mode, int nr); 147void __wake_up_locked(wait_queue_head_t *q, unsigned int mode, int nr);
148void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr); 148void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr);
149void __wake_up_bit(wait_queue_head_t *, void *, int); 149void __wake_up_bit(wait_queue_head_t *, void *, int);
@@ -170,27 +170,64 @@ wait_queue_head_t *bit_waitqueue(void *, int);
170/* 170/*
171 * Wakeup macros to be used to report events to the targets. 171 * Wakeup macros to be used to report events to the targets.
172 */ 172 */
173#define wake_up_poll(x, m) \ 173#define wake_up_poll(x, m) \
174 __wake_up(x, TASK_NORMAL, 1, (void *) (m)) 174 __wake_up(x, TASK_NORMAL, 1, (void *) (m))
175#define wake_up_locked_poll(x, m) \ 175#define wake_up_locked_poll(x, m) \
176 __wake_up_locked_key((x), TASK_NORMAL, (void *) (m)) 176 __wake_up_locked_key((x), TASK_NORMAL, (void *) (m))
177#define wake_up_interruptible_poll(x, m) \ 177#define wake_up_interruptible_poll(x, m) \
178 __wake_up(x, TASK_INTERRUPTIBLE, 1, (void *) (m)) 178 __wake_up(x, TASK_INTERRUPTIBLE, 1, (void *) (m))
179#define wake_up_interruptible_sync_poll(x, m) \ 179#define wake_up_interruptible_sync_poll(x, m) \
180 __wake_up_sync_key((x), TASK_INTERRUPTIBLE, 1, (void *) (m)) 180 __wake_up_sync_key((x), TASK_INTERRUPTIBLE, 1, (void *) (m))
181 181
182#define __wait_event(wq, condition) \ 182#define ___wait_cond_timeout(condition) \
183do { \ 183({ \
184 DEFINE_WAIT(__wait); \ 184 bool __cond = (condition); \
185 if (__cond && !__ret) \
186 __ret = 1; \
187 __cond || !__ret; \
188})
189
190#define ___wait_is_interruptible(state) \
191 (!__builtin_constant_p(state) || \
192 state == TASK_INTERRUPTIBLE || state == TASK_KILLABLE) \
193
194#define ___wait_event(wq, condition, state, exclusive, ret, cmd) \
195({ \
196 __label__ __out; \
197 wait_queue_t __wait; \
198 long __ret = ret; \
199 \
200 INIT_LIST_HEAD(&__wait.task_list); \
201 if (exclusive) \
202 __wait.flags = WQ_FLAG_EXCLUSIVE; \
203 else \
204 __wait.flags = 0; \
185 \ 205 \
186 for (;;) { \ 206 for (;;) { \
187 prepare_to_wait(&wq, &__wait, TASK_UNINTERRUPTIBLE); \ 207 long __int = prepare_to_wait_event(&wq, &__wait, state);\
208 \
188 if (condition) \ 209 if (condition) \
189 break; \ 210 break; \
190 schedule(); \ 211 \
212 if (___wait_is_interruptible(state) && __int) { \
213 __ret = __int; \
214 if (exclusive) { \
215 abort_exclusive_wait(&wq, &__wait, \
216 state, NULL); \
217 goto __out; \
218 } \
219 break; \
220 } \
221 \
222 cmd; \
191 } \ 223 } \
192 finish_wait(&wq, &__wait); \ 224 finish_wait(&wq, &__wait); \
193} while (0) 225__out: __ret; \
226})
227
228#define __wait_event(wq, condition) \
229 (void)___wait_event(wq, condition, TASK_UNINTERRUPTIBLE, 0, 0, \
230 schedule())
194 231
195/** 232/**
196 * wait_event - sleep until a condition gets true 233 * wait_event - sleep until a condition gets true
@@ -204,29 +241,17 @@ do { \
204 * wake_up() has to be called after changing any variable that could 241 * wake_up() has to be called after changing any variable that could
205 * change the result of the wait condition. 242 * change the result of the wait condition.
206 */ 243 */
207#define wait_event(wq, condition) \ 244#define wait_event(wq, condition) \
208do { \ 245do { \
209 if (condition) \ 246 if (condition) \
210 break; \ 247 break; \
211 __wait_event(wq, condition); \ 248 __wait_event(wq, condition); \
212} while (0) 249} while (0)
213 250
214#define __wait_event_timeout(wq, condition, ret) \ 251#define __wait_event_timeout(wq, condition, timeout) \
215do { \ 252 ___wait_event(wq, ___wait_cond_timeout(condition), \
216 DEFINE_WAIT(__wait); \ 253 TASK_UNINTERRUPTIBLE, 0, timeout, \
217 \ 254 __ret = schedule_timeout(__ret))
218 for (;;) { \
219 prepare_to_wait(&wq, &__wait, TASK_UNINTERRUPTIBLE); \
220 if (condition) \
221 break; \
222 ret = schedule_timeout(ret); \
223 if (!ret) \
224 break; \
225 } \
226 if (!ret && (condition)) \
227 ret = 1; \
228 finish_wait(&wq, &__wait); \
229} while (0)
230 255
231/** 256/**
232 * wait_event_timeout - sleep until a condition gets true or a timeout elapses 257 * wait_event_timeout - sleep until a condition gets true or a timeout elapses
@@ -248,28 +273,14 @@ do { \
248#define wait_event_timeout(wq, condition, timeout) \ 273#define wait_event_timeout(wq, condition, timeout) \
249({ \ 274({ \
250 long __ret = timeout; \ 275 long __ret = timeout; \
251 if (!(condition)) \ 276 if (!___wait_cond_timeout(condition)) \
252 __wait_event_timeout(wq, condition, __ret); \ 277 __ret = __wait_event_timeout(wq, condition, timeout); \
253 __ret; \ 278 __ret; \
254}) 279})
255 280
256#define __wait_event_interruptible(wq, condition, ret) \ 281#define __wait_event_interruptible(wq, condition) \
257do { \ 282 ___wait_event(wq, condition, TASK_INTERRUPTIBLE, 0, 0, \
258 DEFINE_WAIT(__wait); \ 283 schedule())
259 \
260 for (;;) { \
261 prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \
262 if (condition) \
263 break; \
264 if (!signal_pending(current)) { \
265 schedule(); \
266 continue; \
267 } \
268 ret = -ERESTARTSYS; \
269 break; \
270 } \
271 finish_wait(&wq, &__wait); \
272} while (0)
273 284
274/** 285/**
275 * wait_event_interruptible - sleep until a condition gets true 286 * wait_event_interruptible - sleep until a condition gets true
@@ -290,31 +301,14 @@ do { \
290({ \ 301({ \
291 int __ret = 0; \ 302 int __ret = 0; \
292 if (!(condition)) \ 303 if (!(condition)) \
293 __wait_event_interruptible(wq, condition, __ret); \ 304 __ret = __wait_event_interruptible(wq, condition); \
294 __ret; \ 305 __ret; \
295}) 306})
296 307
297#define __wait_event_interruptible_timeout(wq, condition, ret) \ 308#define __wait_event_interruptible_timeout(wq, condition, timeout) \
298do { \ 309 ___wait_event(wq, ___wait_cond_timeout(condition), \
299 DEFINE_WAIT(__wait); \ 310 TASK_INTERRUPTIBLE, 0, timeout, \
300 \ 311 __ret = schedule_timeout(__ret))
301 for (;;) { \
302 prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \
303 if (condition) \
304 break; \
305 if (!signal_pending(current)) { \
306 ret = schedule_timeout(ret); \
307 if (!ret) \
308 break; \
309 continue; \
310 } \
311 ret = -ERESTARTSYS; \
312 break; \
313 } \
314 if (!ret && (condition)) \
315 ret = 1; \
316 finish_wait(&wq, &__wait); \
317} while (0)
318 312
319/** 313/**
320 * wait_event_interruptible_timeout - sleep until a condition gets true or a timeout elapses 314 * wait_event_interruptible_timeout - sleep until a condition gets true or a timeout elapses
@@ -337,15 +331,15 @@ do { \
337#define wait_event_interruptible_timeout(wq, condition, timeout) \ 331#define wait_event_interruptible_timeout(wq, condition, timeout) \
338({ \ 332({ \
339 long __ret = timeout; \ 333 long __ret = timeout; \
340 if (!(condition)) \ 334 if (!___wait_cond_timeout(condition)) \
341 __wait_event_interruptible_timeout(wq, condition, __ret); \ 335 __ret = __wait_event_interruptible_timeout(wq, \
336 condition, timeout); \
342 __ret; \ 337 __ret; \
343}) 338})
344 339
345#define __wait_event_hrtimeout(wq, condition, timeout, state) \ 340#define __wait_event_hrtimeout(wq, condition, timeout, state) \
346({ \ 341({ \
347 int __ret = 0; \ 342 int __ret = 0; \
348 DEFINE_WAIT(__wait); \
349 struct hrtimer_sleeper __t; \ 343 struct hrtimer_sleeper __t; \
350 \ 344 \
351 hrtimer_init_on_stack(&__t.timer, CLOCK_MONOTONIC, \ 345 hrtimer_init_on_stack(&__t.timer, CLOCK_MONOTONIC, \
@@ -356,25 +350,15 @@ do { \
356 current->timer_slack_ns, \ 350 current->timer_slack_ns, \
357 HRTIMER_MODE_REL); \ 351 HRTIMER_MODE_REL); \
358 \ 352 \
359 for (;;) { \ 353 __ret = ___wait_event(wq, condition, state, 0, 0, \
360 prepare_to_wait(&wq, &__wait, state); \
361 if (condition) \
362 break; \
363 if (state == TASK_INTERRUPTIBLE && \
364 signal_pending(current)) { \
365 __ret = -ERESTARTSYS; \
366 break; \
367 } \
368 if (!__t.task) { \ 354 if (!__t.task) { \
369 __ret = -ETIME; \ 355 __ret = -ETIME; \
370 break; \ 356 break; \
371 } \ 357 } \
372 schedule(); \ 358 schedule()); \
373 } \
374 \ 359 \
375 hrtimer_cancel(&__t.timer); \ 360 hrtimer_cancel(&__t.timer); \
376 destroy_hrtimer_on_stack(&__t.timer); \ 361 destroy_hrtimer_on_stack(&__t.timer); \
377 finish_wait(&wq, &__wait); \
378 __ret; \ 362 __ret; \
379}) 363})
380 364
@@ -428,33 +412,15 @@ do { \
428 __ret; \ 412 __ret; \
429}) 413})
430 414
431#define __wait_event_interruptible_exclusive(wq, condition, ret) \ 415#define __wait_event_interruptible_exclusive(wq, condition) \
432do { \ 416 ___wait_event(wq, condition, TASK_INTERRUPTIBLE, 1, 0, \
433 DEFINE_WAIT(__wait); \ 417 schedule())
434 \
435 for (;;) { \
436 prepare_to_wait_exclusive(&wq, &__wait, \
437 TASK_INTERRUPTIBLE); \
438 if (condition) { \
439 finish_wait(&wq, &__wait); \
440 break; \
441 } \
442 if (!signal_pending(current)) { \
443 schedule(); \
444 continue; \
445 } \
446 ret = -ERESTARTSYS; \
447 abort_exclusive_wait(&wq, &__wait, \
448 TASK_INTERRUPTIBLE, NULL); \
449 break; \
450 } \
451} while (0)
452 418
453#define wait_event_interruptible_exclusive(wq, condition) \ 419#define wait_event_interruptible_exclusive(wq, condition) \
454({ \ 420({ \
455 int __ret = 0; \ 421 int __ret = 0; \
456 if (!(condition)) \ 422 if (!(condition)) \
457 __wait_event_interruptible_exclusive(wq, condition, __ret);\ 423 __ret = __wait_event_interruptible_exclusive(wq, condition);\
458 __ret; \ 424 __ret; \
459}) 425})
460 426
@@ -606,24 +572,8 @@ do { \
606 ? 0 : __wait_event_interruptible_locked(wq, condition, 1, 1)) 572 ? 0 : __wait_event_interruptible_locked(wq, condition, 1, 1))
607 573
608 574
609 575#define __wait_event_killable(wq, condition) \
610#define __wait_event_killable(wq, condition, ret) \ 576 ___wait_event(wq, condition, TASK_KILLABLE, 0, 0, schedule())
611do { \
612 DEFINE_WAIT(__wait); \
613 \
614 for (;;) { \
615 prepare_to_wait(&wq, &__wait, TASK_KILLABLE); \
616 if (condition) \
617 break; \
618 if (!fatal_signal_pending(current)) { \
619 schedule(); \
620 continue; \
621 } \
622 ret = -ERESTARTSYS; \
623 break; \
624 } \
625 finish_wait(&wq, &__wait); \
626} while (0)
627 577
628/** 578/**
629 * wait_event_killable - sleep until a condition gets true 579 * wait_event_killable - sleep until a condition gets true
@@ -644,26 +594,17 @@ do { \
644({ \ 594({ \
645 int __ret = 0; \ 595 int __ret = 0; \
646 if (!(condition)) \ 596 if (!(condition)) \
647 __wait_event_killable(wq, condition, __ret); \ 597 __ret = __wait_event_killable(wq, condition); \
648 __ret; \ 598 __ret; \
649}) 599})
650 600
651 601
652#define __wait_event_lock_irq(wq, condition, lock, cmd) \ 602#define __wait_event_lock_irq(wq, condition, lock, cmd) \
653do { \ 603 (void)___wait_event(wq, condition, TASK_UNINTERRUPTIBLE, 0, 0, \
654 DEFINE_WAIT(__wait); \ 604 spin_unlock_irq(&lock); \
655 \ 605 cmd; \
656 for (;;) { \ 606 schedule(); \
657 prepare_to_wait(&wq, &__wait, TASK_UNINTERRUPTIBLE); \ 607 spin_lock_irq(&lock))
658 if (condition) \
659 break; \
660 spin_unlock_irq(&lock); \
661 cmd; \
662 schedule(); \
663 spin_lock_irq(&lock); \
664 } \
665 finish_wait(&wq, &__wait); \
666} while (0)
667 608
668/** 609/**
669 * wait_event_lock_irq_cmd - sleep until a condition gets true. The 610 * wait_event_lock_irq_cmd - sleep until a condition gets true. The
@@ -723,26 +664,12 @@ do { \
723} while (0) 664} while (0)
724 665
725 666
726#define __wait_event_interruptible_lock_irq(wq, condition, \ 667#define __wait_event_interruptible_lock_irq(wq, condition, lock, cmd) \
727 lock, ret, cmd) \ 668 ___wait_event(wq, condition, TASK_INTERRUPTIBLE, 0, 0, \
728do { \ 669 spin_unlock_irq(&lock); \
729 DEFINE_WAIT(__wait); \ 670 cmd; \
730 \ 671 schedule(); \
731 for (;;) { \ 672 spin_lock_irq(&lock))
732 prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \
733 if (condition) \
734 break; \
735 if (signal_pending(current)) { \
736 ret = -ERESTARTSYS; \
737 break; \
738 } \
739 spin_unlock_irq(&lock); \
740 cmd; \
741 schedule(); \
742 spin_lock_irq(&lock); \
743 } \
744 finish_wait(&wq, &__wait); \
745} while (0)
746 673
747/** 674/**
748 * wait_event_interruptible_lock_irq_cmd - sleep until a condition gets true. 675 * wait_event_interruptible_lock_irq_cmd - sleep until a condition gets true.
@@ -772,10 +699,9 @@ do { \
772#define wait_event_interruptible_lock_irq_cmd(wq, condition, lock, cmd) \ 699#define wait_event_interruptible_lock_irq_cmd(wq, condition, lock, cmd) \
773({ \ 700({ \
774 int __ret = 0; \ 701 int __ret = 0; \
775 \
776 if (!(condition)) \ 702 if (!(condition)) \
777 __wait_event_interruptible_lock_irq(wq, condition, \ 703 __ret = __wait_event_interruptible_lock_irq(wq, \
778 lock, __ret, cmd); \ 704 condition, lock, cmd); \
779 __ret; \ 705 __ret; \
780}) 706})
781 707
@@ -804,39 +730,24 @@ do { \
804#define wait_event_interruptible_lock_irq(wq, condition, lock) \ 730#define wait_event_interruptible_lock_irq(wq, condition, lock) \
805({ \ 731({ \
806 int __ret = 0; \ 732 int __ret = 0; \
807 \
808 if (!(condition)) \ 733 if (!(condition)) \
809 __wait_event_interruptible_lock_irq(wq, condition, \ 734 __ret = __wait_event_interruptible_lock_irq(wq, \
810 lock, __ret, ); \ 735 condition, lock,); \
811 __ret; \ 736 __ret; \
812}) 737})
813 738
814#define __wait_event_interruptible_lock_irq_timeout(wq, condition, \ 739#define __wait_event_interruptible_lock_irq_timeout(wq, condition, \
815 lock, ret) \ 740 lock, timeout) \
816do { \ 741 ___wait_event(wq, ___wait_cond_timeout(condition), \
817 DEFINE_WAIT(__wait); \ 742 TASK_INTERRUPTIBLE, 0, timeout, \
818 \ 743 spin_unlock_irq(&lock); \
819 for (;;) { \ 744 __ret = schedule_timeout(__ret); \
820 prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \ 745 spin_lock_irq(&lock));
821 if (condition) \
822 break; \
823 if (signal_pending(current)) { \
824 ret = -ERESTARTSYS; \
825 break; \
826 } \
827 spin_unlock_irq(&lock); \
828 ret = schedule_timeout(ret); \
829 spin_lock_irq(&lock); \
830 if (!ret) \
831 break; \
832 } \
833 finish_wait(&wq, &__wait); \
834} while (0)
835 746
836/** 747/**
837 * wait_event_interruptible_lock_irq_timeout - sleep until a condition gets true or a timeout elapses. 748 * wait_event_interruptible_lock_irq_timeout - sleep until a condition gets
838 * The condition is checked under the lock. This is expected 749 * true or a timeout elapses. The condition is checked under
839 * to be called with the lock taken. 750 * the lock. This is expected to be called with the lock taken.
840 * @wq: the waitqueue to wait on 751 * @wq: the waitqueue to wait on
841 * @condition: a C expression for the event to wait for 752 * @condition: a C expression for the event to wait for
842 * @lock: a locked spinlock_t, which will be released before schedule() 753 * @lock: a locked spinlock_t, which will be released before schedule()
@@ -860,11 +771,10 @@ do { \
860#define wait_event_interruptible_lock_irq_timeout(wq, condition, lock, \ 771#define wait_event_interruptible_lock_irq_timeout(wq, condition, lock, \
861 timeout) \ 772 timeout) \
862({ \ 773({ \
863 int __ret = timeout; \ 774 long __ret = timeout; \
864 \ 775 if (!___wait_cond_timeout(condition)) \
865 if (!(condition)) \ 776 __ret = __wait_event_interruptible_lock_irq_timeout( \
866 __wait_event_interruptible_lock_irq_timeout( \ 777 wq, condition, lock, timeout); \
867 wq, condition, lock, __ret); \
868 __ret; \ 778 __ret; \
869}) 779})
870 780
@@ -875,20 +785,18 @@ do { \
875 * We plan to remove these interfaces. 785 * We plan to remove these interfaces.
876 */ 786 */
877extern void sleep_on(wait_queue_head_t *q); 787extern void sleep_on(wait_queue_head_t *q);
878extern long sleep_on_timeout(wait_queue_head_t *q, 788extern long sleep_on_timeout(wait_queue_head_t *q, signed long timeout);
879 signed long timeout);
880extern void interruptible_sleep_on(wait_queue_head_t *q); 789extern void interruptible_sleep_on(wait_queue_head_t *q);
881extern long interruptible_sleep_on_timeout(wait_queue_head_t *q, 790extern long interruptible_sleep_on_timeout(wait_queue_head_t *q, signed long timeout);
882 signed long timeout);
883 791
884/* 792/*
885 * Waitqueues which are removed from the waitqueue_head at wakeup time 793 * Waitqueues which are removed from the waitqueue_head at wakeup time
886 */ 794 */
887void prepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state); 795void prepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state);
888void prepare_to_wait_exclusive(wait_queue_head_t *q, wait_queue_t *wait, int state); 796void prepare_to_wait_exclusive(wait_queue_head_t *q, wait_queue_t *wait, int state);
797long prepare_to_wait_event(wait_queue_head_t *q, wait_queue_t *wait, int state);
889void finish_wait(wait_queue_head_t *q, wait_queue_t *wait); 798void finish_wait(wait_queue_head_t *q, wait_queue_t *wait);
890void abort_exclusive_wait(wait_queue_head_t *q, wait_queue_t *wait, 799void abort_exclusive_wait(wait_queue_head_t *q, wait_queue_t *wait, unsigned int mode, void *key);
891 unsigned int mode, void *key);
892int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key); 800int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
893int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key); 801int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
894 802
@@ -934,8 +842,8 @@ int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
934 * One uses wait_on_bit() where one is waiting for the bit to clear, 842 * One uses wait_on_bit() where one is waiting for the bit to clear,
935 * but has no intention of setting it. 843 * but has no intention of setting it.
936 */ 844 */
937static inline int wait_on_bit(void *word, int bit, 845static inline int
938 int (*action)(void *), unsigned mode) 846wait_on_bit(void *word, int bit, int (*action)(void *), unsigned mode)
939{ 847{
940 if (!test_bit(bit, word)) 848 if (!test_bit(bit, word))
941 return 0; 849 return 0;
@@ -958,8 +866,8 @@ static inline int wait_on_bit(void *word, int bit,
958 * One uses wait_on_bit_lock() where one is waiting for the bit to 866 * One uses wait_on_bit_lock() where one is waiting for the bit to
959 * clear with the intention of setting it, and when done, clearing it. 867 * clear with the intention of setting it, and when done, clearing it.
960 */ 868 */
961static inline int wait_on_bit_lock(void *word, int bit, 869static inline int
962 int (*action)(void *), unsigned mode) 870wait_on_bit_lock(void *word, int bit, int (*action)(void *), unsigned mode)
963{ 871{
964 if (!test_and_set_bit(bit, word)) 872 if (!test_and_set_bit(bit, word))
965 return 0; 873 return 0;
@@ -983,5 +891,5 @@ int wait_on_atomic_t(atomic_t *val, int (*action)(atomic_t *), unsigned mode)
983 return 0; 891 return 0;
984 return out_of_line_wait_on_atomic_t(val, action, mode); 892 return out_of_line_wait_on_atomic_t(val, action, mode);
985} 893}
986 894
987#endif 895#endif /* _LINUX_WAIT_H */
diff --git a/include/net/ip6_fib.h b/include/net/ip6_fib.h
index 48ec25a7fcb6..5e661a979694 100644
--- a/include/net/ip6_fib.h
+++ b/include/net/ip6_fib.h
@@ -165,6 +165,7 @@ static inline struct inet6_dev *ip6_dst_idev(struct dst_entry *dst)
165static inline void rt6_clean_expires(struct rt6_info *rt) 165static inline void rt6_clean_expires(struct rt6_info *rt)
166{ 166{
167 rt->rt6i_flags &= ~RTF_EXPIRES; 167 rt->rt6i_flags &= ~RTF_EXPIRES;
168 rt->dst.expires = 0;
168} 169}
169 170
170static inline void rt6_set_expires(struct rt6_info *rt, unsigned long expires) 171static inline void rt6_set_expires(struct rt6_info *rt, unsigned long expires)
diff --git a/include/trace/events/rcu.h b/include/trace/events/rcu.h
index ee2376cfaab3..aca382266411 100644
--- a/include/trace/events/rcu.h
+++ b/include/trace/events/rcu.h
@@ -39,15 +39,26 @@ TRACE_EVENT(rcu_utilization,
39#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) 39#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)
40 40
41/* 41/*
42 * Tracepoint for grace-period events: starting and ending a grace 42 * Tracepoint for grace-period events. Takes a string identifying the
43 * period ("start" and "end", respectively), a CPU noting the start 43 * RCU flavor, the grace-period number, and a string identifying the
44 * of a new grace period or the end of an old grace period ("cpustart" 44 * grace-period-related event as follows:
45 * and "cpuend", respectively), a CPU passing through a quiescent 45 *
46 * state ("cpuqs"), a CPU coming online or going offline ("cpuonl" 46 * "AccReadyCB": CPU acclerates new callbacks to RCU_NEXT_READY_TAIL.
47 * and "cpuofl", respectively), a CPU being kicked for being too 47 * "AccWaitCB": CPU accelerates new callbacks to RCU_WAIT_TAIL.
48 * long in dyntick-idle mode ("kick"), a CPU accelerating its new 48 * "newreq": Request a new grace period.
49 * callbacks to RCU_NEXT_READY_TAIL ("AccReadyCB"), and a CPU 49 * "start": Start a grace period.
50 * accelerating its new callbacks to RCU_WAIT_TAIL ("AccWaitCB"). 50 * "cpustart": CPU first notices a grace-period start.
51 * "cpuqs": CPU passes through a quiescent state.
52 * "cpuonl": CPU comes online.
53 * "cpuofl": CPU goes offline.
54 * "reqwait": GP kthread sleeps waiting for grace-period request.
55 * "reqwaitsig": GP kthread awakened by signal from reqwait state.
56 * "fqswait": GP kthread waiting until time to force quiescent states.
57 * "fqsstart": GP kthread starts forcing quiescent states.
58 * "fqsend": GP kthread done forcing quiescent states.
59 * "fqswaitsig": GP kthread awakened by signal from fqswait state.
60 * "end": End a grace period.
61 * "cpuend": CPU first notices a grace-period end.
51 */ 62 */
52TRACE_EVENT(rcu_grace_period, 63TRACE_EVENT(rcu_grace_period,
53 64
@@ -161,6 +172,46 @@ TRACE_EVENT(rcu_grace_period_init,
161); 172);
162 173
163/* 174/*
175 * Tracepoint for RCU no-CBs CPU callback handoffs. This event is intended
176 * to assist debugging of these handoffs.
177 *
178 * The first argument is the name of the RCU flavor, and the second is
179 * the number of the offloaded CPU are extracted. The third and final
180 * argument is a string as follows:
181 *
182 * "WakeEmpty": Wake rcuo kthread, first CB to empty list.
183 * "WakeOvf": Wake rcuo kthread, CB list is huge.
184 * "WakeNot": Don't wake rcuo kthread.
185 * "WakeNotPoll": Don't wake rcuo kthread because it is polling.
186 * "Poll": Start of new polling cycle for rcu_nocb_poll.
187 * "Sleep": Sleep waiting for CBs for !rcu_nocb_poll.
188 * "WokeEmpty": rcuo kthread woke to find empty list.
189 * "WokeNonEmpty": rcuo kthread woke to find non-empty list.
190 * "WaitQueue": Enqueue partially done, timed wait for it to complete.
191 * "WokeQueue": Partial enqueue now complete.
192 */
193TRACE_EVENT(rcu_nocb_wake,
194
195 TP_PROTO(const char *rcuname, int cpu, const char *reason),
196
197 TP_ARGS(rcuname, cpu, reason),
198
199 TP_STRUCT__entry(
200 __field(const char *, rcuname)
201 __field(int, cpu)
202 __field(const char *, reason)
203 ),
204
205 TP_fast_assign(
206 __entry->rcuname = rcuname;
207 __entry->cpu = cpu;
208 __entry->reason = reason;
209 ),
210
211 TP_printk("%s %d %s", __entry->rcuname, __entry->cpu, __entry->reason)
212);
213
214/*
164 * Tracepoint for tasks blocking within preemptible-RCU read-side 215 * Tracepoint for tasks blocking within preemptible-RCU read-side
165 * critical sections. Track the type of RCU (which one day might 216 * critical sections. Track the type of RCU (which one day might
166 * include SRCU), the grace-period number that the task is blocking 217 * include SRCU), the grace-period number that the task is blocking
@@ -540,17 +591,17 @@ TRACE_EVENT(rcu_invoke_kfree_callback,
540TRACE_EVENT(rcu_batch_end, 591TRACE_EVENT(rcu_batch_end,
541 592
542 TP_PROTO(const char *rcuname, int callbacks_invoked, 593 TP_PROTO(const char *rcuname, int callbacks_invoked,
543 bool cb, bool nr, bool iit, bool risk), 594 char cb, char nr, char iit, char risk),
544 595
545 TP_ARGS(rcuname, callbacks_invoked, cb, nr, iit, risk), 596 TP_ARGS(rcuname, callbacks_invoked, cb, nr, iit, risk),
546 597
547 TP_STRUCT__entry( 598 TP_STRUCT__entry(
548 __field(const char *, rcuname) 599 __field(const char *, rcuname)
549 __field(int, callbacks_invoked) 600 __field(int, callbacks_invoked)
550 __field(bool, cb) 601 __field(char, cb)
551 __field(bool, nr) 602 __field(char, nr)
552 __field(bool, iit) 603 __field(char, iit)
553 __field(bool, risk) 604 __field(char, risk)
554 ), 605 ),
555 606
556 TP_fast_assign( 607 TP_fast_assign(
@@ -656,6 +707,7 @@ TRACE_EVENT(rcu_barrier,
656#define trace_rcu_future_grace_period(rcuname, gpnum, completed, c, \ 707#define trace_rcu_future_grace_period(rcuname, gpnum, completed, c, \
657 level, grplo, grphi, event) \ 708 level, grplo, grphi, event) \
658 do { } while (0) 709 do { } while (0)
710#define trace_rcu_nocb_wake(rcuname, cpu, reason) do { } while (0)
659#define trace_rcu_preempt_task(rcuname, pid, gpnum) do { } while (0) 711#define trace_rcu_preempt_task(rcuname, pid, gpnum) do { } while (0)
660#define trace_rcu_unlock_preempted_task(rcuname, gpnum, pid) do { } while (0) 712#define trace_rcu_unlock_preempted_task(rcuname, gpnum, pid) do { } while (0)
661#define trace_rcu_quiescent_state_report(rcuname, gpnum, mask, qsmask, level, \ 713#define trace_rcu_quiescent_state_report(rcuname, gpnum, mask, qsmask, level, \
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index 2e7d9947a10d..613381bcde40 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h
@@ -100,7 +100,7 @@ static inline long __trace_sched_switch_state(struct task_struct *p)
100 /* 100 /*
101 * For all intents and purposes a preempted task is a running task. 101 * For all intents and purposes a preempted task is a running task.
102 */ 102 */
103 if (task_thread_info(p)->preempt_count & PREEMPT_ACTIVE) 103 if (task_preempt_count(p) & PREEMPT_ACTIVE)
104 state = TASK_RUNNING | TASK_STATE_MAX; 104 state = TASK_RUNNING | TASK_STATE_MAX;
105#endif 105#endif
106 106
diff --git a/include/trace/events/spi.h b/include/trace/events/spi.h
new file mode 100644
index 000000000000..7e02c983bbe2
--- /dev/null
+++ b/include/trace/events/spi.h
@@ -0,0 +1,156 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM spi
3
4#if !defined(_TRACE_SPI_H) || defined(TRACE_HEADER_MULTI_READ)
5#define _TRACE_SPI_H
6
7#include <linux/ktime.h>
8#include <linux/tracepoint.h>
9
10DECLARE_EVENT_CLASS(spi_master,
11
12 TP_PROTO(struct spi_master *master),
13
14 TP_ARGS(master),
15
16 TP_STRUCT__entry(
17 __field( int, bus_num )
18 ),
19
20 TP_fast_assign(
21 __entry->bus_num = master->bus_num;
22 ),
23
24 TP_printk("spi%d", (int)__entry->bus_num)
25
26);
27
28DEFINE_EVENT(spi_master, spi_master_idle,
29
30 TP_PROTO(struct spi_master *master),
31
32 TP_ARGS(master)
33
34);
35
36DEFINE_EVENT(spi_master, spi_master_busy,
37
38 TP_PROTO(struct spi_master *master),
39
40 TP_ARGS(master)
41
42);
43
44DECLARE_EVENT_CLASS(spi_message,
45
46 TP_PROTO(struct spi_message *msg),
47
48 TP_ARGS(msg),
49
50 TP_STRUCT__entry(
51 __field( int, bus_num )
52 __field( int, chip_select )
53 __field( struct spi_message *, msg )
54 ),
55
56 TP_fast_assign(
57 __entry->bus_num = msg->spi->master->bus_num;
58 __entry->chip_select = msg->spi->chip_select;
59 __entry->msg = msg;
60 ),
61
62 TP_printk("spi%d.%d %p", (int)__entry->bus_num,
63 (int)__entry->chip_select,
64 (struct spi_message *)__entry->msg)
65);
66
67DEFINE_EVENT(spi_message, spi_message_submit,
68
69 TP_PROTO(struct spi_message *msg),
70
71 TP_ARGS(msg)
72
73);
74
75DEFINE_EVENT(spi_message, spi_message_start,
76
77 TP_PROTO(struct spi_message *msg),
78
79 TP_ARGS(msg)
80
81);
82
83TRACE_EVENT(spi_message_done,
84
85 TP_PROTO(struct spi_message *msg),
86
87 TP_ARGS(msg),
88
89 TP_STRUCT__entry(
90 __field( int, bus_num )
91 __field( int, chip_select )
92 __field( struct spi_message *, msg )
93 __field( unsigned, frame )
94 __field( unsigned, actual )
95 ),
96
97 TP_fast_assign(
98 __entry->bus_num = msg->spi->master->bus_num;
99 __entry->chip_select = msg->spi->chip_select;
100 __entry->msg = msg;
101 __entry->frame = msg->frame_length;
102 __entry->actual = msg->actual_length;
103 ),
104
105 TP_printk("spi%d.%d %p len=%u/%u", (int)__entry->bus_num,
106 (int)__entry->chip_select,
107 (struct spi_message *)__entry->msg,
108 (unsigned)__entry->actual, (unsigned)__entry->frame)
109);
110
111DECLARE_EVENT_CLASS(spi_transfer,
112
113 TP_PROTO(struct spi_message *msg, struct spi_transfer *xfer),
114
115 TP_ARGS(msg, xfer),
116
117 TP_STRUCT__entry(
118 __field( int, bus_num )
119 __field( int, chip_select )
120 __field( struct spi_transfer *, xfer )
121 __field( int, len )
122 ),
123
124 TP_fast_assign(
125 __entry->bus_num = msg->spi->master->bus_num;
126 __entry->chip_select = msg->spi->chip_select;
127 __entry->xfer = xfer;
128 __entry->len = xfer->len;
129 ),
130
131 TP_printk("spi%d.%d %p len=%d", (int)__entry->bus_num,
132 (int)__entry->chip_select,
133 (struct spi_message *)__entry->xfer,
134 (int)__entry->len)
135);
136
137DEFINE_EVENT(spi_transfer, spi_transfer_start,
138
139 TP_PROTO(struct spi_message *msg, struct spi_transfer *xfer),
140
141 TP_ARGS(msg, xfer)
142
143);
144
145DEFINE_EVENT(spi_transfer, spi_transfer_stop,
146
147 TP_PROTO(struct spi_message *msg, struct spi_transfer *xfer),
148
149 TP_ARGS(msg, xfer)
150
151);
152
153#endif /* _TRACE_POWER_H */
154
155/* This part must be outside protection */
156#include <trace/define_trace.h>
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index 115add2515aa..33d2b8fe166d 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -241,6 +241,8 @@ header-y += media.h
241header-y += mei.h 241header-y += mei.h
242header-y += mempolicy.h 242header-y += mempolicy.h
243header-y += meye.h 243header-y += meye.h
244header-y += mic_common.h
245header-y += mic_ioctl.h
244header-y += mii.h 246header-y += mii.h
245header-y += minix_fs.h 247header-y += minix_fs.h
246header-y += mman.h 248header-y += mman.h
diff --git a/include/uapi/linux/audit.h b/include/uapi/linux/audit.h
index 75cef3fd97ad..db0b825b4810 100644
--- a/include/uapi/linux/audit.h
+++ b/include/uapi/linux/audit.h
@@ -329,7 +329,6 @@ enum {
329#define AUDIT_ARCH_ARMEB (EM_ARM) 329#define AUDIT_ARCH_ARMEB (EM_ARM)
330#define AUDIT_ARCH_CRIS (EM_CRIS|__AUDIT_ARCH_LE) 330#define AUDIT_ARCH_CRIS (EM_CRIS|__AUDIT_ARCH_LE)
331#define AUDIT_ARCH_FRV (EM_FRV) 331#define AUDIT_ARCH_FRV (EM_FRV)
332#define AUDIT_ARCH_H8300 (EM_H8_300)
333#define AUDIT_ARCH_I386 (EM_386|__AUDIT_ARCH_LE) 332#define AUDIT_ARCH_I386 (EM_386|__AUDIT_ARCH_LE)
334#define AUDIT_ARCH_IA64 (EM_IA_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE) 333#define AUDIT_ARCH_IA64 (EM_IA_64|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
335#define AUDIT_ARCH_M32R (EM_M32R) 334#define AUDIT_ARCH_M32R (EM_M32R)
diff --git a/include/uapi/linux/elf-em.h b/include/uapi/linux/elf-em.h
index 59c17a2d38ad..01529bd96438 100644
--- a/include/uapi/linux/elf-em.h
+++ b/include/uapi/linux/elf-em.h
@@ -31,7 +31,6 @@
31#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */ 31#define EM_CRIS 76 /* Axis Communications 32-bit embedded processor */
32#define EM_V850 87 /* NEC v850 */ 32#define EM_V850 87 /* NEC v850 */
33#define EM_M32R 88 /* Renesas M32R */ 33#define EM_M32R 88 /* Renesas M32R */
34#define EM_H8_300 46 /* Renesas H8/300,300H,H8S */
35#define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */ 34#define EM_MN10300 89 /* Panasonic/MEI MN10300, AM33 */
36#define EM_BLACKFIN 106 /* ADI Blackfin Processor */ 35#define EM_BLACKFIN 106 /* ADI Blackfin Processor */
37#define EM_TI_C6000 140 /* TI C6X DSPs */ 36#define EM_TI_C6000 140 /* TI C6X DSPs */
diff --git a/include/uapi/linux/mic_common.h b/include/uapi/linux/mic_common.h
new file mode 100644
index 000000000000..17e7d95e4f53
--- /dev/null
+++ b/include/uapi/linux/mic_common.h
@@ -0,0 +1,240 @@
1/*
2 * Intel MIC Platform Software Stack (MPSS)
3 *
4 * Copyright(c) 2013 Intel Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License, version 2, as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * The full GNU General Public License is included in this distribution in
16 * the file called "COPYING".
17 *
18 * Intel MIC driver.
19 *
20 */
21#ifndef __MIC_COMMON_H_
22#define __MIC_COMMON_H_
23
24#include <linux/virtio_ring.h>
25
26#ifndef __KERNEL__
27#define ALIGN(a, x) (((a) + (x) - 1) & ~((x) - 1))
28#define __aligned(x) __attribute__ ((aligned(x)))
29#endif
30
31#define mic_aligned_size(x) ALIGN(sizeof(x), 8)
32
33/**
34 * struct mic_device_desc: Virtio device information shared between the
35 * virtio driver and userspace backend
36 *
37 * @type: Device type: console/network/disk etc. Type 0/-1 terminates.
38 * @num_vq: Number of virtqueues.
39 * @feature_len: Number of bytes of feature bits. Multiply by 2: one for
40 host features and one for guest acknowledgements.
41 * @config_len: Number of bytes of the config array after virtqueues.
42 * @status: A status byte, written by the Guest.
43 * @config: Start of the following variable length config.
44 */
45struct mic_device_desc {
46 __s8 type;
47 __u8 num_vq;
48 __u8 feature_len;
49 __u8 config_len;
50 __u8 status;
51 __u64 config[0];
52} __aligned(8);
53
54/**
55 * struct mic_device_ctrl: Per virtio device information in the device page
56 * used internally by the host and card side drivers.
57 *
58 * @vdev: Used for storing MIC vdev information by the guest.
59 * @config_change: Set to 1 by host when a config change is requested.
60 * @vdev_reset: Set to 1 by guest to indicate virtio device has been reset.
61 * @guest_ack: Set to 1 by guest to ack a command.
62 * @host_ack: Set to 1 by host to ack a command.
63 * @used_address_updated: Set to 1 by guest when the used address should be
64 * updated.
65 * @c2h_vdev_db: The doorbell number to be used by guest. Set by host.
66 * @h2c_vdev_db: The doorbell number to be used by host. Set by guest.
67 */
68struct mic_device_ctrl {
69 __u64 vdev;
70 __u8 config_change;
71 __u8 vdev_reset;
72 __u8 guest_ack;
73 __u8 host_ack;
74 __u8 used_address_updated;
75 __s8 c2h_vdev_db;
76 __s8 h2c_vdev_db;
77} __aligned(8);
78
79/**
80 * struct mic_bootparam: Virtio device independent information in device page
81 *
82 * @magic: A magic value used by the card to ensure it can see the host
83 * @c2h_shutdown_db: Card to Host shutdown doorbell set by host
84 * @h2c_shutdown_db: Host to Card shutdown doorbell set by card
85 * @h2c_config_db: Host to Card Virtio config doorbell set by card
86 * @shutdown_status: Card shutdown status set by card
87 * @shutdown_card: Set to 1 by the host when a card shutdown is initiated
88 */
89struct mic_bootparam {
90 __u32 magic;
91 __s8 c2h_shutdown_db;
92 __s8 h2c_shutdown_db;
93 __s8 h2c_config_db;
94 __u8 shutdown_status;
95 __u8 shutdown_card;
96} __aligned(8);
97
98/**
99 * struct mic_device_page: High level representation of the device page
100 *
101 * @bootparam: The bootparam structure is used for sharing information and
102 * status updates between MIC host and card drivers.
103 * @desc: Array of MIC virtio device descriptors.
104 */
105struct mic_device_page {
106 struct mic_bootparam bootparam;
107 struct mic_device_desc desc[0];
108};
109/**
110 * struct mic_vqconfig: This is how we expect the device configuration field
111 * for a virtqueue to be laid out in config space.
112 *
113 * @address: Guest/MIC physical address of the virtio ring
114 * (avail and desc rings)
115 * @used_address: Guest/MIC physical address of the used ring
116 * @num: The number of entries in the virtio_ring
117 */
118struct mic_vqconfig {
119 __u64 address;
120 __u64 used_address;
121 __u16 num;
122} __aligned(8);
123
124/*
125 * The alignment to use between consumer and producer parts of vring.
126 * This is pagesize for historical reasons.
127 */
128#define MIC_VIRTIO_RING_ALIGN 4096
129
130#define MIC_MAX_VRINGS 4
131#define MIC_VRING_ENTRIES 128
132
133/*
134 * Max vring entries (power of 2) to ensure desc and avail rings
135 * fit in a single page
136 */
137#define MIC_MAX_VRING_ENTRIES 128
138
139/**
140 * Max size of the desc block in bytes: includes:
141 * - struct mic_device_desc
142 * - struct mic_vqconfig (num_vq of these)
143 * - host and guest features
144 * - virtio device config space
145 */
146#define MIC_MAX_DESC_BLK_SIZE 256
147
148/**
149 * struct _mic_vring_info - Host vring info exposed to userspace backend
150 * for the avail index and magic for the card.
151 *
152 * @avail_idx: host avail idx
153 * @magic: A magic debug cookie.
154 */
155struct _mic_vring_info {
156 __u16 avail_idx;
157 int magic;
158};
159
160/**
161 * struct mic_vring - Vring information.
162 *
163 * @vr: The virtio ring.
164 * @info: Host vring information exposed to the userspace backend for the
165 * avail index and magic for the card.
166 * @va: The va for the buffer allocated for vr and info.
167 * @len: The length of the buffer required for allocating vr and info.
168 */
169struct mic_vring {
170 struct vring vr;
171 struct _mic_vring_info *info;
172 void *va;
173 int len;
174};
175
176#define mic_aligned_desc_size(d) ALIGN(mic_desc_size(d), 8)
177
178#ifndef INTEL_MIC_CARD
179static inline unsigned mic_desc_size(const struct mic_device_desc *desc)
180{
181 return mic_aligned_size(*desc)
182 + desc->num_vq * mic_aligned_size(struct mic_vqconfig)
183 + desc->feature_len * 2
184 + desc->config_len;
185}
186
187static inline struct mic_vqconfig *
188mic_vq_config(const struct mic_device_desc *desc)
189{
190 return (struct mic_vqconfig *)(desc + 1);
191}
192
193static inline __u8 *mic_vq_features(const struct mic_device_desc *desc)
194{
195 return (__u8 *)(mic_vq_config(desc) + desc->num_vq);
196}
197
198static inline __u8 *mic_vq_configspace(const struct mic_device_desc *desc)
199{
200 return mic_vq_features(desc) + desc->feature_len * 2;
201}
202static inline unsigned mic_total_desc_size(struct mic_device_desc *desc)
203{
204 return mic_aligned_desc_size(desc) +
205 mic_aligned_size(struct mic_device_ctrl);
206}
207#endif
208
209/* Device page size */
210#define MIC_DP_SIZE 4096
211
212#define MIC_MAGIC 0xc0ffee00
213
214/**
215 * enum mic_states - MIC states.
216 */
217enum mic_states {
218 MIC_OFFLINE = 0,
219 MIC_ONLINE,
220 MIC_SHUTTING_DOWN,
221 MIC_RESET_FAILED,
222 MIC_SUSPENDING,
223 MIC_SUSPENDED,
224 MIC_LAST
225};
226
227/**
228 * enum mic_status - MIC status reported by card after
229 * a host or card initiated shutdown or a card crash.
230 */
231enum mic_status {
232 MIC_NOP = 0,
233 MIC_CRASHED,
234 MIC_HALTED,
235 MIC_POWER_OFF,
236 MIC_RESTART,
237 MIC_STATUS_LAST
238};
239
240#endif
diff --git a/include/uapi/linux/mic_ioctl.h b/include/uapi/linux/mic_ioctl.h
new file mode 100644
index 000000000000..7fabba5059cf
--- /dev/null
+++ b/include/uapi/linux/mic_ioctl.h
@@ -0,0 +1,76 @@
1/*
2 * Intel MIC Platform Software Stack (MPSS)
3 *
4 * Copyright(c) 2013 Intel Corporation.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License, version 2, as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 *
15 * The full GNU General Public License is included in this distribution in
16 * the file called "COPYING".
17 *
18 * Intel MIC Host driver.
19 *
20 */
21#ifndef _MIC_IOCTL_H_
22#define _MIC_IOCTL_H_
23
24#include <linux/types.h>
25
26/*
27 * mic_copy - MIC virtio descriptor copy.
28 *
29 * @iov: An array of IOVEC structures containing user space buffers.
30 * @iovcnt: Number of IOVEC structures in iov.
31 * @vr_idx: The vring index.
32 * @update_used: A non zero value results in used index being updated.
33 * @out_len: The aggregate of the total length written to or read from
34 * the virtio device.
35 */
36struct mic_copy_desc {
37#ifdef __KERNEL__
38 struct iovec __user *iov;
39#else
40 struct iovec *iov;
41#endif
42 int iovcnt;
43 __u8 vr_idx;
44 __u8 update_used;
45 __u32 out_len;
46};
47
48/*
49 * Add a new virtio device
50 * The (struct mic_device_desc *) pointer points to a device page entry
51 * for the virtio device consisting of:
52 * - struct mic_device_desc
53 * - struct mic_vqconfig (num_vq of these)
54 * - host and guest features
55 * - virtio device config space
56 * The total size referenced by the pointer should equal the size returned
57 * by desc_size() in mic_common.h
58 */
59#define MIC_VIRTIO_ADD_DEVICE _IOWR('s', 1, struct mic_device_desc *)
60
61/*
62 * Copy the number of entries in the iovec and update the used index
63 * if requested by the user.
64 */
65#define MIC_VIRTIO_COPY_DESC _IOWR('s', 2, struct mic_copy_desc *)
66
67/*
68 * Notify virtio device of a config change
69 * The (__u8 *) pointer points to config space values for the device
70 * as they should be written into the device page. The total size
71 * referenced by the pointer should equal the config_len field of struct
72 * mic_device_desc.
73 */
74#define MIC_VIRTIO_CONFIG_CHANGE _IOWR('s', 5, __u8 *)
75
76#endif
diff --git a/include/uapi/linux/nfs_mount.h b/include/uapi/linux/nfs_mount.h
index 576bddd72e04..64b0f22f5c4c 100644
--- a/include/uapi/linux/nfs_mount.h
+++ b/include/uapi/linux/nfs_mount.h
@@ -60,7 +60,7 @@ struct nfs_mount_data {
60#define NFS_MOUNT_BROKEN_SUID 0x0400 /* 4 */ 60#define NFS_MOUNT_BROKEN_SUID 0x0400 /* 4 */
61#define NFS_MOUNT_NOACL 0x0800 /* 4 */ 61#define NFS_MOUNT_NOACL 0x0800 /* 4 */
62#define NFS_MOUNT_STRICTLOCK 0x1000 /* reserved for NFSv4 */ 62#define NFS_MOUNT_STRICTLOCK 0x1000 /* reserved for NFSv4 */
63#define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 */ 63#define NFS_MOUNT_SECFLAVOUR 0x2000 /* 5 non-text parsed mount data only */
64#define NFS_MOUNT_NORDIRPLUS 0x4000 /* 5 */ 64#define NFS_MOUNT_NORDIRPLUS 0x4000 /* 5 */
65#define NFS_MOUNT_UNSHARED 0x8000 /* 5 */ 65#define NFS_MOUNT_UNSHARED 0x8000 /* 5 */
66#define NFS_MOUNT_FLAGMASK 0xFFFF 66#define NFS_MOUNT_FLAGMASK 0xFFFF
diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
index 2fc1602e23bb..e1802d6153ae 100644
--- a/include/uapi/linux/perf_event.h
+++ b/include/uapi/linux/perf_event.h
@@ -136,8 +136,9 @@ enum perf_event_sample_format {
136 PERF_SAMPLE_WEIGHT = 1U << 14, 136 PERF_SAMPLE_WEIGHT = 1U << 14,
137 PERF_SAMPLE_DATA_SRC = 1U << 15, 137 PERF_SAMPLE_DATA_SRC = 1U << 15,
138 PERF_SAMPLE_IDENTIFIER = 1U << 16, 138 PERF_SAMPLE_IDENTIFIER = 1U << 16,
139 PERF_SAMPLE_TRANSACTION = 1U << 17,
139 140
140 PERF_SAMPLE_MAX = 1U << 17, /* non-ABI */ 141 PERF_SAMPLE_MAX = 1U << 18, /* non-ABI */
141}; 142};
142 143
143/* 144/*
@@ -181,6 +182,28 @@ enum perf_sample_regs_abi {
181}; 182};
182 183
183/* 184/*
185 * Values for the memory transaction event qualifier, mostly for
186 * abort events. Multiple bits can be set.
187 */
188enum {
189 PERF_TXN_ELISION = (1 << 0), /* From elision */
190 PERF_TXN_TRANSACTION = (1 << 1), /* From transaction */
191 PERF_TXN_SYNC = (1 << 2), /* Instruction is related */
192 PERF_TXN_ASYNC = (1 << 3), /* Instruction not related */
193 PERF_TXN_RETRY = (1 << 4), /* Retry possible */
194 PERF_TXN_CONFLICT = (1 << 5), /* Conflict abort */
195 PERF_TXN_CAPACITY_WRITE = (1 << 6), /* Capacity write abort */
196 PERF_TXN_CAPACITY_READ = (1 << 7), /* Capacity read abort */
197
198 PERF_TXN_MAX = (1 << 8), /* non-ABI */
199
200 /* bits 32..63 are reserved for the abort code */
201
202 PERF_TXN_ABORT_MASK = (0xffffffffULL << 32),
203 PERF_TXN_ABORT_SHIFT = 32,
204};
205
206/*
184 * The format of the data returned by read() on a perf event fd, 207 * The format of the data returned by read() on a perf event fd,
185 * as specified by attr.read_format: 208 * as specified by attr.read_format:
186 * 209 *
diff --git a/include/video/exynos_dp.h b/include/video/exynos_dp.h
deleted file mode 100644
index bd8cabd344db..000000000000
--- a/include/video/exynos_dp.h
+++ /dev/null
@@ -1,131 +0,0 @@
1/*
2 * Samsung SoC DP device support
3 *
4 * Copyright (C) 2012 Samsung Electronics Co., Ltd.
5 * Author: Jingoo Han <jg1.han@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _EXYNOS_DP_H
13#define _EXYNOS_DP_H
14
15#define DP_TIMEOUT_LOOP_COUNT 100
16#define MAX_CR_LOOP 5
17#define MAX_EQ_LOOP 5
18
19enum link_rate_type {
20 LINK_RATE_1_62GBPS = 0x06,
21 LINK_RATE_2_70GBPS = 0x0a
22};
23
24enum link_lane_count_type {
25 LANE_COUNT1 = 1,
26 LANE_COUNT2 = 2,
27 LANE_COUNT4 = 4
28};
29
30enum link_training_state {
31 START,
32 CLOCK_RECOVERY,
33 EQUALIZER_TRAINING,
34 FINISHED,
35 FAILED
36};
37
38enum voltage_swing_level {
39 VOLTAGE_LEVEL_0,
40 VOLTAGE_LEVEL_1,
41 VOLTAGE_LEVEL_2,
42 VOLTAGE_LEVEL_3,
43};
44
45enum pre_emphasis_level {
46 PRE_EMPHASIS_LEVEL_0,
47 PRE_EMPHASIS_LEVEL_1,
48 PRE_EMPHASIS_LEVEL_2,
49 PRE_EMPHASIS_LEVEL_3,
50};
51
52enum pattern_set {
53 PRBS7,
54 D10_2,
55 TRAINING_PTN1,
56 TRAINING_PTN2,
57 DP_NONE
58};
59
60enum color_space {
61 COLOR_RGB,
62 COLOR_YCBCR422,
63 COLOR_YCBCR444
64};
65
66enum color_depth {
67 COLOR_6,
68 COLOR_8,
69 COLOR_10,
70 COLOR_12
71};
72
73enum color_coefficient {
74 COLOR_YCBCR601,
75 COLOR_YCBCR709
76};
77
78enum dynamic_range {
79 VESA,
80 CEA
81};
82
83enum pll_status {
84 PLL_UNLOCKED,
85 PLL_LOCKED
86};
87
88enum clock_recovery_m_value_type {
89 CALCULATED_M,
90 REGISTER_M
91};
92
93enum video_timing_recognition_type {
94 VIDEO_TIMING_FROM_CAPTURE,
95 VIDEO_TIMING_FROM_REGISTER
96};
97
98enum analog_power_block {
99 AUX_BLOCK,
100 CH0_BLOCK,
101 CH1_BLOCK,
102 CH2_BLOCK,
103 CH3_BLOCK,
104 ANALOG_TOTAL,
105 POWER_ALL
106};
107
108struct video_info {
109 char *name;
110
111 bool h_sync_polarity;
112 bool v_sync_polarity;
113 bool interlaced;
114
115 enum color_space color_space;
116 enum dynamic_range dynamic_range;
117 enum color_coefficient ycbcr_coeff;
118 enum color_depth color_depth;
119
120 enum link_rate_type link_rate;
121 enum link_lane_count_type lane_count;
122};
123
124struct exynos_dp_platdata {
125 struct video_info *video_info;
126
127 void (*phy_init)(void);
128 void (*phy_exit)(void);
129};
130
131#endif /* _EXYNOS_DP_H */
diff --git a/include/video/exynos_mipi_dsim.h b/include/video/exynos_mipi_dsim.h
index 89dc88a171af..6a578f8a1b3e 100644
--- a/include/video/exynos_mipi_dsim.h
+++ b/include/video/exynos_mipi_dsim.h
@@ -216,6 +216,7 @@ struct mipi_dsim_config {
216 * automatically. 216 * automatically.
217 * @e_clk_src: select byte clock source. 217 * @e_clk_src: select byte clock source.
218 * @pd: pointer to MIPI-DSI driver platform data. 218 * @pd: pointer to MIPI-DSI driver platform data.
219 * @phy: pointer to the MIPI-DSI PHY
219 */ 220 */
220struct mipi_dsim_device { 221struct mipi_dsim_device {
221 struct device *dev; 222 struct device *dev;
@@ -236,6 +237,7 @@ struct mipi_dsim_device {
236 bool suspended; 237 bool suspended;
237 238
238 struct mipi_dsim_platform_data *pd; 239 struct mipi_dsim_platform_data *pd;
240 struct phy *phy;
239}; 241};
240 242
241/* 243/*
@@ -248,7 +250,6 @@ struct mipi_dsim_device {
248 * @enabled: indicate whether mipi controller got enabled or not. 250 * @enabled: indicate whether mipi controller got enabled or not.
249 * @lcd_panel_info: pointer for lcd panel specific structure. 251 * @lcd_panel_info: pointer for lcd panel specific structure.
250 * this structure specifies width, height, timing and polarity and so on. 252 * this structure specifies width, height, timing and polarity and so on.
251 * @phy_enable: pointer to a callback controlling D-PHY enable/reset
252 */ 253 */
253struct mipi_dsim_platform_data { 254struct mipi_dsim_platform_data {
254 char lcd_panel_name[PANEL_NAME_SIZE]; 255 char lcd_panel_name[PANEL_NAME_SIZE];
@@ -256,8 +257,6 @@ struct mipi_dsim_platform_data {
256 struct mipi_dsim_config *dsim_config; 257 struct mipi_dsim_config *dsim_config;
257 unsigned int enabled; 258 unsigned int enabled;
258 void *lcd_panel_info; 259 void *lcd_panel_info;
259
260 int (*phy_enable)(struct platform_device *pdev, bool on);
261}; 260};
262 261
263/* 262/*