aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/barrier.h55
-rw-r--r--include/linux/acpi_gpio.h51
-rw-r--r--include/linux/bottom_half.h32
-rw-r--r--include/linux/compiler.h9
-rw-r--r--include/linux/component.h32
-rw-r--r--include/linux/context_tracking.h10
-rw-r--r--include/linux/context_tracking_state.h11
-rw-r--r--include/linux/crash_dump.h2
-rw-r--r--include/linux/edac.h28
-rw-r--r--include/linux/efi.h17
-rw-r--r--include/linux/extcon/extcon-gpio.h1
-rw-r--r--include/linux/firmware.h7
-rw-r--r--include/linux/gpio.h1
-rw-r--r--include/linux/gpio/driver.h56
-rw-r--r--include/linux/hardirq.h1
-rw-r--r--include/linux/hid-sensor-ids.h12
-rw-r--r--include/linux/i2c-pnx.h1
-rw-r--r--include/linux/i2c.h2
-rw-r--r--include/linux/iio/buffer.h3
-rw-r--r--include/linux/iio/events.h4
-rw-r--r--include/linux/iio/iio.h115
-rw-r--r--include/linux/iio/types.h1
-rw-r--r--include/linux/init.h2
-rw-r--r--include/linux/init_task.h10
-rw-r--r--include/linux/irqdesc.h8
-rw-r--r--include/linux/jump_label.h19
-rw-r--r--include/linux/kernel.h9
-rw-r--r--include/linux/kernfs.h376
-rw-r--r--include/linux/kobj_completion.h18
-rw-r--r--include/linux/kobject.h2
-rw-r--r--include/linux/memory.h1
-rw-r--r--include/linux/mfd/arizona/registers.h9
-rw-r--r--include/linux/mfd/as3722.h1
-rw-r--r--include/linux/mfd/syscon/imx6q-iomuxc-gpr.h1
-rw-r--r--include/linux/perf_event.h1
-rw-r--r--include/linux/phy/phy.h28
-rw-r--r--include/linux/pinctrl/pinconf-generic.h10
-rw-r--r--include/linux/pinctrl/pinctrl.h2
-rw-r--r--include/linux/platform_data/gpio-lpc32xx.h50
-rw-r--r--include/linux/platform_data/hwmon-s3c.h10
-rw-r--r--include/linux/platform_data/i2c-nomadik.h39
-rw-r--r--include/linux/platform_data/max197.h5
-rw-r--r--include/linux/platform_data/sht15.h5
-rw-r--r--include/linux/platform_data/usb-ehci-orion.h6
-rw-r--r--include/linux/platform_data/usb-omap1.h53
-rw-r--r--include/linux/preempt.h37
-rw-r--r--include/linux/preempt_mask.h16
-rw-r--r--include/linux/rculist.h4
-rw-r--r--include/linux/rcupdate.h153
-rw-r--r--include/linux/rcutiny.h2
-rw-r--r--include/linux/rcutree.h36
-rw-r--r--include/linux/rtmutex.h18
-rw-r--r--include/linux/rwlock_api_smp.h12
-rw-r--r--include/linux/scatterlist.h1
-rw-r--r--include/linux/sched.h141
-rw-r--r--include/linux/sched/deadline.h24
-rw-r--r--include/linux/sched/rt.h5
-rw-r--r--include/linux/sched/sysctl.h1
-rw-r--r--include/linux/seqlock.h27
-rw-r--r--include/linux/spi/74x164.h9
-rw-r--r--include/linux/spinlock.h10
-rw-r--r--include/linux/spinlock_api_smp.h12
-rw-r--r--include/linux/spinlock_api_up.h16
-rw-r--r--include/linux/syscalls.h6
-rw-r--r--include/linux/sysfs.h47
-rw-r--r--include/linux/tick.h8
-rw-r--r--include/linux/tpm.h12
-rw-r--r--include/linux/tty.h9
-rw-r--r--include/linux/tty_flip.h11
-rw-r--r--include/linux/tty_ldisc.h6
-rw-r--r--include/linux/uaccess.h5
-rw-r--r--include/linux/uprobes.h52
-rw-r--r--include/linux/usb.h1
-rw-r--r--include/linux/usb/chipidea.h1
-rw-r--r--include/linux/usb/composite.h2
-rw-r--r--include/linux/usb/functionfs.h30
-rw-r--r--include/linux/usb/gadget.h58
-rw-r--r--include/linux/usb/hcd.h3
-rw-r--r--include/linux/usb/musb.h3
-rw-r--r--include/linux/usb/omap_control_usb.h6
-rw-r--r--include/linux/usb/otg-fsm.h244
-rw-r--r--include/linux/uwb/umc.h2
-rw-r--r--include/linux/vme.h3
-rw-r--r--include/linux/vtime.h4
-rw-r--r--include/linux/zorro.h121
-rw-r--r--include/net/busy_poll.h19
-rw-r--r--include/net/if_inet6.h1
-rw-r--r--include/trace/events/ras.h10
-rw-r--r--include/uapi/asm-generic/statfs.h2
-rw-r--r--include/uapi/linux/Kbuild2
-rw-r--r--include/uapi/linux/genwqe/genwqe_card.h500
-rw-r--r--include/uapi/linux/kexec.h1
-rw-r--r--include/uapi/linux/perf_event.h1
-rw-r--r--include/uapi/linux/sched.h6
-rw-r--r--include/uapi/linux/zorro.h113
-rw-r--r--include/uapi/linux/zorro_ids.h (renamed from include/linux/zorro_ids.h)0
-rw-r--r--include/xen/interface/callback.h2
-rw-r--r--include/xen/interface/io/protocols.h3
98 files changed, 2241 insertions, 693 deletions
diff --git a/include/asm-generic/barrier.h b/include/asm-generic/barrier.h
index 639d7a4d033b..6f692f8ac664 100644
--- a/include/asm-generic/barrier.h
+++ b/include/asm-generic/barrier.h
@@ -1,4 +1,5 @@
1/* Generic barrier definitions, based on MN10300 definitions. 1/*
2 * Generic barrier definitions, originally based on MN10300 definitions.
2 * 3 *
3 * It should be possible to use these on really simple architectures, 4 * It should be possible to use these on really simple architectures,
4 * but it serves more as a starting point for new ports. 5 * but it serves more as a starting point for new ports.
@@ -16,35 +17,65 @@
16 17
17#ifndef __ASSEMBLY__ 18#ifndef __ASSEMBLY__
18 19
19#define nop() asm volatile ("nop") 20#include <linux/compiler.h>
21
22#ifndef nop
23#define nop() asm volatile ("nop")
24#endif
20 25
21/* 26/*
22 * Force strict CPU ordering. 27 * Force strict CPU ordering. And yes, this is required on UP too when we're
23 * And yes, this is required on UP too when we're talking 28 * talking to devices.
24 * to devices.
25 * 29 *
26 * This implementation only contains a compiler barrier. 30 * Fall back to compiler barriers if nothing better is provided.
27 */ 31 */
28 32
29#define mb() asm volatile ("": : :"memory") 33#ifndef mb
34#define mb() barrier()
35#endif
36
37#ifndef rmb
30#define rmb() mb() 38#define rmb() mb()
31#define wmb() asm volatile ("": : :"memory") 39#endif
40
41#ifndef wmb
42#define wmb() mb()
43#endif
44
45#ifndef read_barrier_depends
46#define read_barrier_depends() do { } while (0)
47#endif
32 48
33#ifdef CONFIG_SMP 49#ifdef CONFIG_SMP
34#define smp_mb() mb() 50#define smp_mb() mb()
35#define smp_rmb() rmb() 51#define smp_rmb() rmb()
36#define smp_wmb() wmb() 52#define smp_wmb() wmb()
53#define smp_read_barrier_depends() read_barrier_depends()
37#else 54#else
38#define smp_mb() barrier() 55#define smp_mb() barrier()
39#define smp_rmb() barrier() 56#define smp_rmb() barrier()
40#define smp_wmb() barrier() 57#define smp_wmb() barrier()
58#define smp_read_barrier_depends() do { } while (0)
59#endif
60
61#ifndef set_mb
62#define set_mb(var, value) do { (var) = (value); mb(); } while (0)
41#endif 63#endif
42 64
43#define set_mb(var, value) do { var = value; mb(); } while (0) 65#define smp_store_release(p, v) \
44#define set_wmb(var, value) do { var = value; wmb(); } while (0) 66do { \
67 compiletime_assert_atomic_type(*p); \
68 smp_mb(); \
69 ACCESS_ONCE(*p) = (v); \
70} while (0)
45 71
46#define read_barrier_depends() do {} while (0) 72#define smp_load_acquire(p) \
47#define smp_read_barrier_depends() do {} while (0) 73({ \
74 typeof(*p) ___p1 = ACCESS_ONCE(*p); \
75 compiletime_assert_atomic_type(*p); \
76 smp_mb(); \
77 ___p1; \
78})
48 79
49#endif /* !__ASSEMBLY__ */ 80#endif /* !__ASSEMBLY__ */
50#endif /* __ASM_GENERIC_BARRIER_H */ 81#endif /* __ASM_GENERIC_BARRIER_H */
diff --git a/include/linux/acpi_gpio.h b/include/linux/acpi_gpio.h
deleted file mode 100644
index d875bc3dba3c..000000000000
--- a/include/linux/acpi_gpio.h
+++ /dev/null
@@ -1,51 +0,0 @@
1#ifndef _LINUX_ACPI_GPIO_H_
2#define _LINUX_ACPI_GPIO_H_
3
4#include <linux/device.h>
5#include <linux/err.h>
6#include <linux/errno.h>
7#include <linux/gpio.h>
8#include <linux/gpio/consumer.h>
9
10/**
11 * struct acpi_gpio_info - ACPI GPIO specific information
12 * @gpioint: if %true this GPIO is of type GpioInt otherwise type is GpioIo
13 * @active_low: in case of @gpioint, the pin is active low
14 */
15struct acpi_gpio_info {
16 bool gpioint;
17 bool active_low;
18};
19
20#ifdef CONFIG_GPIO_ACPI
21
22struct gpio_desc *acpi_get_gpiod_by_index(struct device *dev, int index,
23 struct acpi_gpio_info *info);
24void acpi_gpiochip_request_interrupts(struct gpio_chip *chip);
25void acpi_gpiochip_free_interrupts(struct gpio_chip *chip);
26
27#else /* CONFIG_GPIO_ACPI */
28
29static inline struct gpio_desc *
30acpi_get_gpiod_by_index(struct device *dev, int index,
31 struct acpi_gpio_info *info)
32{
33 return ERR_PTR(-ENOSYS);
34}
35
36static inline void acpi_gpiochip_request_interrupts(struct gpio_chip *chip) { }
37static inline void acpi_gpiochip_free_interrupts(struct gpio_chip *chip) { }
38
39#endif /* CONFIG_GPIO_ACPI */
40
41static inline int acpi_get_gpio_by_index(struct device *dev, int index,
42 struct acpi_gpio_info *info)
43{
44 struct gpio_desc *desc = acpi_get_gpiod_by_index(dev, index, info);
45
46 if (IS_ERR(desc))
47 return PTR_ERR(desc);
48 return desc_to_gpio(desc);
49}
50
51#endif /* _LINUX_ACPI_GPIO_H_ */
diff --git a/include/linux/bottom_half.h b/include/linux/bottom_half.h
index 27b1bcffe408..86c12c93e3cf 100644
--- a/include/linux/bottom_half.h
+++ b/include/linux/bottom_half.h
@@ -1,9 +1,35 @@
1#ifndef _LINUX_BH_H 1#ifndef _LINUX_BH_H
2#define _LINUX_BH_H 2#define _LINUX_BH_H
3 3
4extern void local_bh_disable(void); 4#include <linux/preempt.h>
5#include <linux/preempt_mask.h>
6
7#ifdef CONFIG_TRACE_IRQFLAGS
8extern void __local_bh_disable_ip(unsigned long ip, unsigned int cnt);
9#else
10static __always_inline void __local_bh_disable_ip(unsigned long ip, unsigned int cnt)
11{
12 preempt_count_add(cnt);
13 barrier();
14}
15#endif
16
17static inline void local_bh_disable(void)
18{
19 __local_bh_disable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
20}
21
5extern void _local_bh_enable(void); 22extern void _local_bh_enable(void);
6extern void local_bh_enable(void); 23extern void __local_bh_enable_ip(unsigned long ip, unsigned int cnt);
7extern void local_bh_enable_ip(unsigned long ip); 24
25static inline void local_bh_enable_ip(unsigned long ip)
26{
27 __local_bh_enable_ip(ip, SOFTIRQ_DISABLE_OFFSET);
28}
29
30static inline void local_bh_enable(void)
31{
32 __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_DISABLE_OFFSET);
33}
8 34
9#endif /* _LINUX_BH_H */ 35#endif /* _LINUX_BH_H */
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 92669cd182a6..fe7a686dfd8d 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -298,6 +298,11 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
298# define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) 298# define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b))
299#endif 299#endif
300 300
301/* Is this type a native word size -- useful for atomic operations */
302#ifndef __native_word
303# define __native_word(t) (sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
304#endif
305
301/* Compile time object size, -1 for unknown */ 306/* Compile time object size, -1 for unknown */
302#ifndef __compiletime_object_size 307#ifndef __compiletime_object_size
303# define __compiletime_object_size(obj) -1 308# define __compiletime_object_size(obj) -1
@@ -337,6 +342,10 @@ void ftrace_likely_update(struct ftrace_branch_data *f, int val, int expect);
337#define compiletime_assert(condition, msg) \ 342#define compiletime_assert(condition, msg) \
338 _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__) 343 _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
339 344
345#define compiletime_assert_atomic_type(t) \
346 compiletime_assert(__native_word(t), \
347 "Need native word sized stores/loads for atomicity.")
348
340/* 349/*
341 * Prevent the compiler from merging or refetching accesses. The compiler 350 * Prevent the compiler from merging or refetching accesses. The compiler
342 * is also forbidden from reordering successive instances of ACCESS_ONCE(), 351 * is also forbidden from reordering successive instances of ACCESS_ONCE(),
diff --git a/include/linux/component.h b/include/linux/component.h
new file mode 100644
index 000000000000..68870182ca1e
--- /dev/null
+++ b/include/linux/component.h
@@ -0,0 +1,32 @@
1#ifndef COMPONENT_H
2#define COMPONENT_H
3
4struct device;
5
6struct component_ops {
7 int (*bind)(struct device *, struct device *, void *);
8 void (*unbind)(struct device *, struct device *, void *);
9};
10
11int component_add(struct device *, const struct component_ops *);
12void component_del(struct device *, const struct component_ops *);
13
14int component_bind_all(struct device *, void *);
15void component_unbind_all(struct device *, void *);
16
17struct master;
18
19struct component_master_ops {
20 int (*add_components)(struct device *, struct master *);
21 int (*bind)(struct device *);
22 void (*unbind)(struct device *);
23};
24
25int component_master_add(struct device *, const struct component_master_ops *);
26void component_master_del(struct device *,
27 const struct component_master_ops *);
28
29int component_master_add_child(struct master *master,
30 int (*compare)(struct device *, void *), void *compare_data);
31
32#endif
diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h
index 158158704c30..37b81bd51ec0 100644
--- a/include/linux/context_tracking.h
+++ b/include/linux/context_tracking.h
@@ -17,13 +17,13 @@ extern void __context_tracking_task_switch(struct task_struct *prev,
17 17
18static inline void user_enter(void) 18static inline void user_enter(void)
19{ 19{
20 if (static_key_false(&context_tracking_enabled)) 20 if (context_tracking_is_enabled())
21 context_tracking_user_enter(); 21 context_tracking_user_enter();
22 22
23} 23}
24static inline void user_exit(void) 24static inline void user_exit(void)
25{ 25{
26 if (static_key_false(&context_tracking_enabled)) 26 if (context_tracking_is_enabled())
27 context_tracking_user_exit(); 27 context_tracking_user_exit();
28} 28}
29 29
@@ -31,7 +31,7 @@ static inline enum ctx_state exception_enter(void)
31{ 31{
32 enum ctx_state prev_ctx; 32 enum ctx_state prev_ctx;
33 33
34 if (!static_key_false(&context_tracking_enabled)) 34 if (!context_tracking_is_enabled())
35 return 0; 35 return 0;
36 36
37 prev_ctx = this_cpu_read(context_tracking.state); 37 prev_ctx = this_cpu_read(context_tracking.state);
@@ -42,7 +42,7 @@ static inline enum ctx_state exception_enter(void)
42 42
43static inline void exception_exit(enum ctx_state prev_ctx) 43static inline void exception_exit(enum ctx_state prev_ctx)
44{ 44{
45 if (static_key_false(&context_tracking_enabled)) { 45 if (context_tracking_is_enabled()) {
46 if (prev_ctx == IN_USER) 46 if (prev_ctx == IN_USER)
47 context_tracking_user_enter(); 47 context_tracking_user_enter();
48 } 48 }
@@ -51,7 +51,7 @@ static inline void exception_exit(enum ctx_state prev_ctx)
51static inline void context_tracking_task_switch(struct task_struct *prev, 51static inline void context_tracking_task_switch(struct task_struct *prev,
52 struct task_struct *next) 52 struct task_struct *next)
53{ 53{
54 if (static_key_false(&context_tracking_enabled)) 54 if (context_tracking_is_enabled())
55 __context_tracking_task_switch(prev, next); 55 __context_tracking_task_switch(prev, next);
56} 56}
57#else 57#else
diff --git a/include/linux/context_tracking_state.h b/include/linux/context_tracking_state.h
index 0f1979d0674f..97a81225d037 100644
--- a/include/linux/context_tracking_state.h
+++ b/include/linux/context_tracking_state.h
@@ -22,15 +22,20 @@ struct context_tracking {
22extern struct static_key context_tracking_enabled; 22extern struct static_key context_tracking_enabled;
23DECLARE_PER_CPU(struct context_tracking, context_tracking); 23DECLARE_PER_CPU(struct context_tracking, context_tracking);
24 24
25static inline bool context_tracking_in_user(void) 25static inline bool context_tracking_is_enabled(void)
26{ 26{
27 return __this_cpu_read(context_tracking.state) == IN_USER; 27 return static_key_false(&context_tracking_enabled);
28} 28}
29 29
30static inline bool context_tracking_active(void) 30static inline bool context_tracking_cpu_is_enabled(void)
31{ 31{
32 return __this_cpu_read(context_tracking.active); 32 return __this_cpu_read(context_tracking.active);
33} 33}
34
35static inline bool context_tracking_in_user(void)
36{
37 return __this_cpu_read(context_tracking.state) == IN_USER;
38}
34#else 39#else
35static inline bool context_tracking_in_user(void) { return false; } 40static inline bool context_tracking_in_user(void) { return false; }
36static inline bool context_tracking_active(void) { return false; } 41static inline bool context_tracking_active(void) { return false; }
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h
index fe68a5a98583..7032518f8542 100644
--- a/include/linux/crash_dump.h
+++ b/include/linux/crash_dump.h
@@ -6,6 +6,8 @@
6#include <linux/proc_fs.h> 6#include <linux/proc_fs.h>
7#include <linux/elf.h> 7#include <linux/elf.h>
8 8
9#include <asm/pgtable.h> /* for pgprot_t */
10
9#define ELFCORE_ADDR_MAX (-1ULL) 11#define ELFCORE_ADDR_MAX (-1ULL)
10#define ELFCORE_ADDR_ERR (-2ULL) 12#define ELFCORE_ADDR_ERR (-2ULL)
11 13
diff --git a/include/linux/edac.h b/include/linux/edac.h
index dbdffe8d4469..8e6c20af11a2 100644
--- a/include/linux/edac.h
+++ b/include/linux/edac.h
@@ -35,6 +35,34 @@ extern void edac_atomic_assert_error(void);
35extern struct bus_type *edac_get_sysfs_subsys(void); 35extern struct bus_type *edac_get_sysfs_subsys(void);
36extern void edac_put_sysfs_subsys(void); 36extern void edac_put_sysfs_subsys(void);
37 37
38enum {
39 EDAC_REPORTING_ENABLED,
40 EDAC_REPORTING_DISABLED,
41 EDAC_REPORTING_FORCE
42};
43
44extern int edac_report_status;
45#ifdef CONFIG_EDAC
46static inline int get_edac_report_status(void)
47{
48 return edac_report_status;
49}
50
51static inline void set_edac_report_status(int new)
52{
53 edac_report_status = new;
54}
55#else
56static inline int get_edac_report_status(void)
57{
58 return EDAC_REPORTING_DISABLED;
59}
60
61static inline void set_edac_report_status(int new)
62{
63}
64#endif
65
38static inline void opstate_init(void) 66static inline void opstate_init(void)
39{ 67{
40 switch (edac_op_state) { 68 switch (edac_op_state) {
diff --git a/include/linux/efi.h b/include/linux/efi.h
index 11ce6784a196..0a819e7a60c9 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -556,6 +556,9 @@ extern struct efi {
556 unsigned long hcdp; /* HCDP table */ 556 unsigned long hcdp; /* HCDP table */
557 unsigned long uga; /* UGA table */ 557 unsigned long uga; /* UGA table */
558 unsigned long uv_systab; /* UV system table */ 558 unsigned long uv_systab; /* UV system table */
559 unsigned long fw_vendor; /* fw_vendor */
560 unsigned long runtime; /* runtime table */
561 unsigned long config_table; /* config tables */
559 efi_get_time_t *get_time; 562 efi_get_time_t *get_time;
560 efi_set_time_t *set_time; 563 efi_set_time_t *set_time;
561 efi_get_wakeup_time_t *get_wakeup_time; 564 efi_get_wakeup_time_t *get_wakeup_time;
@@ -653,6 +656,7 @@ extern int __init efi_setup_pcdp_console(char *);
653#define EFI_RUNTIME_SERVICES 3 /* Can we use runtime services? */ 656#define EFI_RUNTIME_SERVICES 3 /* Can we use runtime services? */
654#define EFI_MEMMAP 4 /* Can we use EFI memory map? */ 657#define EFI_MEMMAP 4 /* Can we use EFI memory map? */
655#define EFI_64BIT 5 /* Is the firmware 64-bit? */ 658#define EFI_64BIT 5 /* Is the firmware 64-bit? */
659#define EFI_ARCH_1 6 /* First arch-specific bit */
656 660
657#ifdef CONFIG_EFI 661#ifdef CONFIG_EFI
658# ifdef CONFIG_X86 662# ifdef CONFIG_X86
@@ -872,4 +876,17 @@ int efivars_sysfs_init(void);
872 876
873#endif /* CONFIG_EFI_VARS */ 877#endif /* CONFIG_EFI_VARS */
874 878
879#ifdef CONFIG_EFI_RUNTIME_MAP
880int efi_runtime_map_init(struct kobject *);
881void efi_runtime_map_setup(void *, int, u32);
882#else
883static inline int efi_runtime_map_init(struct kobject *kobj)
884{
885 return 0;
886}
887
888static inline void
889efi_runtime_map_setup(void *map, int nr_entries, u32 desc_size) {}
890#endif
891
875#endif /* _LINUX_EFI_H */ 892#endif /* _LINUX_EFI_H */
diff --git a/include/linux/extcon/extcon-gpio.h b/include/linux/extcon/extcon-gpio.h
index 4195810f87fe..8900fdf511c6 100644
--- a/include/linux/extcon/extcon-gpio.h
+++ b/include/linux/extcon/extcon-gpio.h
@@ -51,6 +51,7 @@ struct gpio_extcon_platform_data {
51 /* if NULL, "0" or "1" will be printed */ 51 /* if NULL, "0" or "1" will be printed */
52 const char *state_on; 52 const char *state_on;
53 const char *state_off; 53 const char *state_off;
54 bool check_on_resume;
54}; 55};
55 56
56#endif /* __EXTCON_GPIO_H__ */ 57#endif /* __EXTCON_GPIO_H__ */
diff --git a/include/linux/firmware.h b/include/linux/firmware.h
index e154c1005cd1..59529330efd6 100644
--- a/include/linux/firmware.h
+++ b/include/linux/firmware.h
@@ -68,4 +68,11 @@ static inline void release_firmware(const struct firmware *fw)
68 68
69#endif 69#endif
70 70
71#ifdef CONFIG_FW_LOADER_USER_HELPER
72int request_firmware_direct(const struct firmware **fw, const char *name,
73 struct device *device);
74#else
75#define request_firmware_direct request_firmware
76#endif
77
71#endif 78#endif
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index 13dfd24d01ab..b581b13d29d9 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -90,7 +90,6 @@ void devm_gpio_free(struct device *dev, unsigned int gpio);
90 90
91#include <linux/kernel.h> 91#include <linux/kernel.h>
92#include <linux/types.h> 92#include <linux/types.h>
93#include <linux/errno.h>
94#include <linux/bug.h> 93#include <linux/bug.h>
95#include <linux/pinctrl/pinctrl.h> 94#include <linux/pinctrl/pinctrl.h>
96 95
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 3ea2cf6b0e6c..a3e181e09636 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -39,14 +39,15 @@ struct seq_file;
39 * @ngpio: the number of GPIOs handled by this controller; the last GPIO 39 * @ngpio: the number of GPIOs handled by this controller; the last GPIO
40 * handled is (base + ngpio - 1). 40 * handled is (base + ngpio - 1).
41 * @desc: array of ngpio descriptors. Private. 41 * @desc: array of ngpio descriptors. Private.
42 * @can_sleep: flag must be set iff get()/set() methods sleep, as they
43 * must while accessing GPIO expander chips over I2C or SPI
44 * @names: if set, must be an array of strings to use as alternative 42 * @names: if set, must be an array of strings to use as alternative
45 * names for the GPIOs in this chip. Any entry in the array 43 * names for the GPIOs in this chip. Any entry in the array
46 * may be NULL if there is no alias for the GPIO, however the 44 * may be NULL if there is no alias for the GPIO, however the
47 * array must be @ngpio entries long. A name can include a single printk 45 * array must be @ngpio entries long. A name can include a single printk
48 * format specifier for an unsigned int. It is substituted by the actual 46 * format specifier for an unsigned int. It is substituted by the actual
49 * number of the gpio. 47 * number of the gpio.
48 * @can_sleep: flag must be set iff get()/set() methods sleep, as they
49 * must while accessing GPIO expander chips over I2C or SPI
50 * @exported: flags if the gpiochip is exported for use from sysfs. Private.
50 * 51 *
51 * A gpio_chip can help platforms abstract various sources of GPIOs so 52 * A gpio_chip can help platforms abstract various sources of GPIOs so
52 * they can all be accessed through a common programing interface. 53 * they can all be accessed through a common programing interface.
@@ -91,8 +92,8 @@ struct gpio_chip {
91 u16 ngpio; 92 u16 ngpio;
92 struct gpio_desc *desc; 93 struct gpio_desc *desc;
93 const char *const *names; 94 const char *const *names;
94 unsigned can_sleep:1; 95 bool can_sleep;
95 unsigned exported:1; 96 bool exported;
96 97
97#if defined(CONFIG_OF_GPIO) 98#if defined(CONFIG_OF_GPIO)
98 /* 99 /*
@@ -136,59 +137,50 @@ enum gpio_lookup_flags {
136}; 137};
137 138
138/** 139/**
139 * Lookup table for associating GPIOs to specific devices and functions using 140 * struct gpiod_lookup - lookup table
140 * platform data. 141 * @chip_label: name of the chip the GPIO belongs to
142 * @chip_hwnum: hardware number (i.e. relative to the chip) of the GPIO
143 * @con_id: name of the GPIO from the device's point of view
144 * @idx: index of the GPIO in case several GPIOs share the same name
145 * @flags: mask of GPIO_* values
146 *
147 * gpiod_lookup is a lookup table for associating GPIOs to specific devices and
148 * functions using platform data.
141 */ 149 */
142struct gpiod_lookup { 150struct gpiod_lookup {
143 struct list_head list;
144 /*
145 * name of the chip the GPIO belongs to
146 */
147 const char *chip_label; 151 const char *chip_label;
148 /*
149 * hardware number (i.e. relative to the chip) of the GPIO
150 */
151 u16 chip_hwnum; 152 u16 chip_hwnum;
152 /*
153 * name of device that can claim this GPIO
154 */
155 const char *dev_id;
156 /*
157 * name of the GPIO from the device's point of view
158 */
159 const char *con_id; 153 const char *con_id;
160 /*
161 * index of the GPIO in case several GPIOs share the same name
162 */
163 unsigned int idx; 154 unsigned int idx;
164 /*
165 * mask of GPIO_* values
166 */
167 enum gpio_lookup_flags flags; 155 enum gpio_lookup_flags flags;
168}; 156};
169 157
158struct gpiod_lookup_table {
159 struct list_head list;
160 const char *dev_id;
161 struct gpiod_lookup table[];
162};
163
170/* 164/*
171 * Simple definition of a single GPIO under a con_id 165 * Simple definition of a single GPIO under a con_id
172 */ 166 */
173#define GPIO_LOOKUP(_chip_label, _chip_hwnum, _dev_id, _con_id, _flags) \ 167#define GPIO_LOOKUP(_chip_label, _chip_hwnum, _con_id, _flags) \
174 GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _dev_id, _con_id, 0, _flags) 168 GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _con_id, 0, _flags)
175 169
176/* 170/*
177 * Use this macro if you need to have several GPIOs under the same con_id. 171 * Use this macro if you need to have several GPIOs under the same con_id.
178 * Each GPIO needs to use a different index and can be accessed using 172 * Each GPIO needs to use a different index and can be accessed using
179 * gpiod_get_index() 173 * gpiod_get_index()
180 */ 174 */
181#define GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _dev_id, _con_id, _idx, \ 175#define GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _con_id, _idx, _flags) \
182 _flags) \
183{ \ 176{ \
184 .chip_label = _chip_label, \ 177 .chip_label = _chip_label, \
185 .chip_hwnum = _chip_hwnum, \ 178 .chip_hwnum = _chip_hwnum, \
186 .dev_id = _dev_id, \
187 .con_id = _con_id, \ 179 .con_id = _con_id, \
188 .idx = _idx, \ 180 .idx = _idx, \
189 .flags = _flags, \ 181 .flags = _flags, \
190} 182}
191 183
192void gpiod_add_table(struct gpiod_lookup *table, size_t size); 184void gpiod_add_lookup_table(struct gpiod_lookup_table *table);
193 185
194#endif 186#endif
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index d9cf963ac832..12d5f972f23f 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -5,6 +5,7 @@
5#include <linux/lockdep.h> 5#include <linux/lockdep.h>
6#include <linux/ftrace_irq.h> 6#include <linux/ftrace_irq.h>
7#include <linux/vtime.h> 7#include <linux/vtime.h>
8#include <asm/hardirq.h>
8 9
9 10
10extern void synchronize_irq(unsigned int irq); 11extern void synchronize_irq(unsigned int irq);
diff --git a/include/linux/hid-sensor-ids.h b/include/linux/hid-sensor-ids.h
index 8323775ac21d..beaf965621c1 100644
--- a/include/linux/hid-sensor-ids.h
+++ b/include/linux/hid-sensor-ids.h
@@ -23,22 +23,26 @@
23 23
24/* Accel 3D (200073) */ 24/* Accel 3D (200073) */
25#define HID_USAGE_SENSOR_ACCEL_3D 0x200073 25#define HID_USAGE_SENSOR_ACCEL_3D 0x200073
26#define HID_USAGE_SENSOR_DATA_ACCELERATION 0x200452
26#define HID_USAGE_SENSOR_ACCEL_X_AXIS 0x200453 27#define HID_USAGE_SENSOR_ACCEL_X_AXIS 0x200453
27#define HID_USAGE_SENSOR_ACCEL_Y_AXIS 0x200454 28#define HID_USAGE_SENSOR_ACCEL_Y_AXIS 0x200454
28#define HID_USAGE_SENSOR_ACCEL_Z_AXIS 0x200455 29#define HID_USAGE_SENSOR_ACCEL_Z_AXIS 0x200455
29 30
30/* ALS (200041) */ 31/* ALS (200041) */
31#define HID_USAGE_SENSOR_ALS 0x200041 32#define HID_USAGE_SENSOR_ALS 0x200041
33#define HID_USAGE_SENSOR_DATA_LIGHT 0x2004d0
32#define HID_USAGE_SENSOR_LIGHT_ILLUM 0x2004d1 34#define HID_USAGE_SENSOR_LIGHT_ILLUM 0x2004d1
33 35
34/* Gyro 3D: (200076) */ 36/* Gyro 3D: (200076) */
35#define HID_USAGE_SENSOR_GYRO_3D 0x200076 37#define HID_USAGE_SENSOR_GYRO_3D 0x200076
38#define HID_USAGE_SENSOR_DATA_ANGL_VELOCITY 0x200456
36#define HID_USAGE_SENSOR_ANGL_VELOCITY_X_AXIS 0x200457 39#define HID_USAGE_SENSOR_ANGL_VELOCITY_X_AXIS 0x200457
37#define HID_USAGE_SENSOR_ANGL_VELOCITY_Y_AXIS 0x200458 40#define HID_USAGE_SENSOR_ANGL_VELOCITY_Y_AXIS 0x200458
38#define HID_USAGE_SENSOR_ANGL_VELOCITY_Z_AXIS 0x200459 41#define HID_USAGE_SENSOR_ANGL_VELOCITY_Z_AXIS 0x200459
39 42
40/* ORIENTATION: Compass 3D: (200083) */ 43/* ORIENTATION: Compass 3D: (200083) */
41#define HID_USAGE_SENSOR_COMPASS_3D 0x200083 44#define HID_USAGE_SENSOR_COMPASS_3D 0x200083
45#define HID_USAGE_SENSOR_DATA_ORIENTATION 0x200470
42#define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING 0x200471 46#define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING 0x200471
43#define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING_X 0x200472 47#define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING_X 0x200472
44#define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING_Y 0x200473 48#define HID_USAGE_SENSOR_ORIENT_MAGN_HEADING_Y 0x200473
@@ -54,10 +58,14 @@
54#define HID_USAGE_SENSOR_ORIENT_DISTANCE_Y 0x20047B 58#define HID_USAGE_SENSOR_ORIENT_DISTANCE_Y 0x20047B
55#define HID_USAGE_SENSOR_ORIENT_DISTANCE_Z 0x20047C 59#define HID_USAGE_SENSOR_ORIENT_DISTANCE_Z 0x20047C
56#define HID_USAGE_SENSOR_ORIENT_DISTANCE_OUT_OF_RANGE 0x20047D 60#define HID_USAGE_SENSOR_ORIENT_DISTANCE_OUT_OF_RANGE 0x20047D
61
62/* ORIENTATION: Inclinometer 3D: (200086) */
63#define HID_USAGE_SENSOR_INCLINOMETER_3D 0x200086
57#define HID_USAGE_SENSOR_ORIENT_TILT 0x20047E 64#define HID_USAGE_SENSOR_ORIENT_TILT 0x20047E
58#define HID_USAGE_SENSOR_ORIENT_TILT_X 0x20047F 65#define HID_USAGE_SENSOR_ORIENT_TILT_X 0x20047F
59#define HID_USAGE_SENSOR_ORIENT_TILT_Y 0x200480 66#define HID_USAGE_SENSOR_ORIENT_TILT_Y 0x200480
60#define HID_USAGE_SENSOR_ORIENT_TILT_Z 0x200481 67#define HID_USAGE_SENSOR_ORIENT_TILT_Z 0x200481
68
61#define HID_USAGE_SENSOR_ORIENT_ROTATION_MATRIX 0x200482 69#define HID_USAGE_SENSOR_ORIENT_ROTATION_MATRIX 0x200482
62#define HID_USAGE_SENSOR_ORIENT_QUATERNION 0x200483 70#define HID_USAGE_SENSOR_ORIENT_QUATERNION 0x200483
63#define HID_USAGE_SENSOR_ORIENT_MAGN_FLUX 0x200484 71#define HID_USAGE_SENSOR_ORIENT_MAGN_FLUX 0x200484
@@ -117,6 +125,10 @@
117#define HID_USAGE_SENSOR_PROP_REPORT_STATE 0x200316 125#define HID_USAGE_SENSOR_PROP_REPORT_STATE 0x200316
118#define HID_USAGE_SENSOR_PROY_POWER_STATE 0x200319 126#define HID_USAGE_SENSOR_PROY_POWER_STATE 0x200319
119 127
128/* Per data field properties */
129#define HID_USAGE_SENSOR_DATA_MOD_NONE 0x00
130#define HID_USAGE_SENSOR_DATA_MOD_CHANGE_SENSITIVITY_ABS 0x1000
131
120/* Power state enumerations */ 132/* Power state enumerations */
121#define HID_USAGE_SENSOR_PROP_POWER_STATE_UNDEFINED_ENUM 0x00 133#define HID_USAGE_SENSOR_PROP_POWER_STATE_UNDEFINED_ENUM 0x00
122#define HID_USAGE_SENSOR_PROP_POWER_STATE_D0_FULL_POWER_ENUM 0x01 134#define HID_USAGE_SENSOR_PROP_POWER_STATE_D0_FULL_POWER_ENUM 0x01
diff --git a/include/linux/i2c-pnx.h b/include/linux/i2c-pnx.h
index 49ed17fdf055..5388326fbbff 100644
--- a/include/linux/i2c-pnx.h
+++ b/include/linux/i2c-pnx.h
@@ -31,7 +31,6 @@ struct i2c_pnx_algo_data {
31 int last; 31 int last;
32 struct clk *clk; 32 struct clk *clk;
33 struct i2c_adapter adapter; 33 struct i2c_adapter adapter;
34 phys_addr_t base;
35 int irq; 34 int irq;
36 u32 timeout; 35 u32 timeout;
37}; 36};
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index eff50e062be8..d9c8dbd3373f 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -445,7 +445,7 @@ static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data)
445static inline struct i2c_adapter * 445static inline struct i2c_adapter *
446i2c_parent_is_i2c_adapter(const struct i2c_adapter *adapter) 446i2c_parent_is_i2c_adapter(const struct i2c_adapter *adapter)
447{ 447{
448#if IS_ENABLED(I2C_MUX) 448#if IS_ENABLED(CONFIG_I2C_MUX)
449 struct device *parent = adapter->dev.parent; 449 struct device *parent = adapter->dev.parent;
450 450
451 if (parent != NULL && parent->type == &i2c_adapter_type) 451 if (parent != NULL && parent->type == &i2c_adapter_type)
diff --git a/include/linux/iio/buffer.h b/include/linux/iio/buffer.h
index 15607b45221a..519392763393 100644
--- a/include/linux/iio/buffer.h
+++ b/include/linux/iio/buffer.h
@@ -21,6 +21,8 @@ struct iio_buffer;
21 * struct iio_buffer_access_funcs - access functions for buffers. 21 * struct iio_buffer_access_funcs - access functions for buffers.
22 * @store_to: actually store stuff to the buffer 22 * @store_to: actually store stuff to the buffer
23 * @read_first_n: try to get a specified number of bytes (must exist) 23 * @read_first_n: try to get a specified number of bytes (must exist)
24 * @data_available: indicates whether data for reading from the buffer is
25 * available.
24 * @request_update: if a parameter change has been marked, update underlying 26 * @request_update: if a parameter change has been marked, update underlying
25 * storage. 27 * storage.
26 * @get_bytes_per_datum:get current bytes per datum 28 * @get_bytes_per_datum:get current bytes per datum
@@ -43,6 +45,7 @@ struct iio_buffer_access_funcs {
43 int (*read_first_n)(struct iio_buffer *buffer, 45 int (*read_first_n)(struct iio_buffer *buffer,
44 size_t n, 46 size_t n,
45 char __user *buf); 47 char __user *buf);
48 bool (*data_available)(struct iio_buffer *buffer);
46 49
47 int (*request_update)(struct iio_buffer *buffer); 50 int (*request_update)(struct iio_buffer *buffer);
48 51
diff --git a/include/linux/iio/events.h b/include/linux/iio/events.h
index 5dab2c41031f..8bbd7bc1043d 100644
--- a/include/linux/iio/events.h
+++ b/include/linux/iio/events.h
@@ -46,10 +46,6 @@ struct iio_event_data {
46 ((u16)chan)) 46 ((u16)chan))
47 47
48 48
49#define IIO_EV_DIR_MAX 4
50#define IIO_EV_BIT(type, direction) \
51 (1 << (type*IIO_EV_DIR_MAX + direction))
52
53/** 49/**
54 * IIO_MOD_EVENT_CODE() - create event identifier for modified channels 50 * IIO_MOD_EVENT_CODE() - create event identifier for modified channels
55 * @chan_type: Type of the channel. Should be one of enum iio_chan_type. 51 * @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 256a90a1bea6..75a8a20c8179 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -185,7 +185,6 @@ struct iio_event_spec {
185 * by all channels of the same direction. 185 * by all channels of the same direction.
186 * @info_mask_shared_by_all: What information is to be exported that is shared 186 * @info_mask_shared_by_all: What information is to be exported that is shared
187 * by all channels. 187 * by all channels.
188 * @event_mask: What events can this channel produce.
189 * @event_spec: Array of events which should be registered for this 188 * @event_spec: Array of events which should be registered for this
190 * channel. 189 * channel.
191 * @num_event_specs: Size of the event_spec array. 190 * @num_event_specs: Size of the event_spec array.
@@ -226,7 +225,6 @@ struct iio_chan_spec {
226 long info_mask_shared_by_type; 225 long info_mask_shared_by_type;
227 long info_mask_shared_by_dir; 226 long info_mask_shared_by_dir;
228 long info_mask_shared_by_all; 227 long info_mask_shared_by_all;
229 long event_mask;
230 const struct iio_event_spec *event_spec; 228 const struct iio_event_spec *event_spec;
231 unsigned int num_event_specs; 229 unsigned int num_event_specs;
232 const struct iio_chan_spec_ext_info *ext_info; 230 const struct iio_chan_spec_ext_info *ext_info;
@@ -307,16 +305,8 @@ struct iio_dev;
307 * returns IIO_VAL_INT_PLUS_MICRO. 305 * returns IIO_VAL_INT_PLUS_MICRO.
308 * @read_event_config: find out if the event is enabled. 306 * @read_event_config: find out if the event is enabled.
309 * @write_event_config: set if the event is enabled. 307 * @write_event_config: set if the event is enabled.
310 * @read_event_value: read a value associated with the event. Meaning 308 * @read_event_value: read a configuration value associated with the event.
311 * is event dependant. event_code specifies which event. 309 * @write_event_value: write a configuration value for the event.
312 * @write_event_value: write the value associated with the event.
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.
320 * @validate_trigger: function to validate the trigger when the 310 * @validate_trigger: function to validate the trigger when the
321 * current trigger gets changed. 311 * current trigger gets changed.
322 * @update_scan_mode: function to configure device and scan buffer when 312 * @update_scan_mode: function to configure device and scan buffer when
@@ -345,37 +335,23 @@ struct iio_info {
345 long mask); 335 long mask);
346 336
347 int (*read_event_config)(struct iio_dev *indio_dev, 337 int (*read_event_config)(struct iio_dev *indio_dev,
348 u64 event_code);
349
350 int (*write_event_config)(struct iio_dev *indio_dev,
351 u64 event_code,
352 int state);
353
354 int (*read_event_value)(struct iio_dev *indio_dev,
355 u64 event_code,
356 int *val);
357 int (*write_event_value)(struct iio_dev *indio_dev,
358 u64 event_code,
359 int val);
360
361 int (*read_event_config_new)(struct iio_dev *indio_dev,
362 const struct iio_chan_spec *chan, 338 const struct iio_chan_spec *chan,
363 enum iio_event_type type, 339 enum iio_event_type type,
364 enum iio_event_direction dir); 340 enum iio_event_direction dir);
365 341
366 int (*write_event_config_new)(struct iio_dev *indio_dev, 342 int (*write_event_config)(struct iio_dev *indio_dev,
367 const struct iio_chan_spec *chan, 343 const struct iio_chan_spec *chan,
368 enum iio_event_type type, 344 enum iio_event_type type,
369 enum iio_event_direction dir, 345 enum iio_event_direction dir,
370 int state); 346 int state);
371 347
372 int (*read_event_value_new)(struct iio_dev *indio_dev, 348 int (*read_event_value)(struct iio_dev *indio_dev,
373 const struct iio_chan_spec *chan, 349 const struct iio_chan_spec *chan,
374 enum iio_event_type type, 350 enum iio_event_type type,
375 enum iio_event_direction dir, 351 enum iio_event_direction dir,
376 enum iio_event_info info, int *val, int *val2); 352 enum iio_event_info info, int *val, int *val2);
377 353
378 int (*write_event_value_new)(struct iio_dev *indio_dev, 354 int (*write_event_value)(struct iio_dev *indio_dev,
379 const struct iio_chan_spec *chan, 355 const struct iio_chan_spec *chan,
380 enum iio_event_type type, 356 enum iio_event_type type,
381 enum iio_event_direction dir, 357 enum iio_event_direction dir,
@@ -490,32 +466,12 @@ struct iio_dev {
490#endif 466#endif
491}; 467};
492 468
493/**
494 * iio_find_channel_from_si() - get channel from its scan index
495 * @indio_dev: device
496 * @si: scan index to match
497 */
498const struct iio_chan_spec 469const struct iio_chan_spec
499*iio_find_channel_from_si(struct iio_dev *indio_dev, int si); 470*iio_find_channel_from_si(struct iio_dev *indio_dev, int si);
500
501/**
502 * iio_device_register() - register a device with the IIO subsystem
503 * @indio_dev: Device structure filled by the device driver
504 **/
505int iio_device_register(struct iio_dev *indio_dev); 471int iio_device_register(struct iio_dev *indio_dev);
506
507/**
508 * iio_device_unregister() - unregister a device from the IIO subsystem
509 * @indio_dev: Device structure representing the device.
510 **/
511void iio_device_unregister(struct iio_dev *indio_dev); 472void iio_device_unregister(struct iio_dev *indio_dev);
512 473int devm_iio_device_register(struct device *dev, struct iio_dev *indio_dev);
513/** 474void devm_iio_device_unregister(struct device *dev, struct iio_dev *indio_dev);
514 * iio_push_event() - try to add event to the list for userspace reading
515 * @indio_dev: IIO device structure
516 * @ev_code: What event
517 * @timestamp: When the event occurred
518 **/
519int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestamp); 475int iio_push_event(struct iio_dev *indio_dev, u64 ev_code, s64 timestamp);
520 476
521extern struct bus_type iio_bus_type; 477extern struct bus_type iio_bus_type;
@@ -579,10 +535,6 @@ static inline void *iio_device_get_drvdata(struct iio_dev *indio_dev)
579 535
580/* Can we make this smaller? */ 536/* Can we make this smaller? */
581#define IIO_ALIGN L1_CACHE_BYTES 537#define IIO_ALIGN L1_CACHE_BYTES
582/**
583 * iio_device_alloc() - allocate an iio_dev from a driver
584 * @sizeof_priv: Space to allocate for private structure.
585 **/
586struct iio_dev *iio_device_alloc(int sizeof_priv); 538struct iio_dev *iio_device_alloc(int sizeof_priv);
587 539
588static inline void *iio_priv(const struct iio_dev *indio_dev) 540static inline void *iio_priv(const struct iio_dev *indio_dev)
@@ -596,64 +548,11 @@ static inline struct iio_dev *iio_priv_to_dev(void *priv)
596 ALIGN(sizeof(struct iio_dev), IIO_ALIGN)); 548 ALIGN(sizeof(struct iio_dev), IIO_ALIGN));
597} 549}
598 550
599/**
600 * iio_device_free() - free an iio_dev from a driver
601 * @indio_dev: the iio_dev associated with the device
602 **/
603void iio_device_free(struct iio_dev *indio_dev); 551void iio_device_free(struct iio_dev *indio_dev);
604
605/**
606 * devm_iio_device_alloc - Resource-managed iio_device_alloc()
607 * @dev: Device to allocate iio_dev for
608 * @sizeof_priv: Space to allocate for private structure.
609 *
610 * Managed iio_device_alloc. iio_dev allocated with this function is
611 * automatically freed on driver detach.
612 *
613 * If an iio_dev allocated with this function needs to be freed separately,
614 * devm_iio_device_free() must be used.
615 *
616 * RETURNS:
617 * Pointer to allocated iio_dev on success, NULL on failure.
618 */
619struct iio_dev *devm_iio_device_alloc(struct device *dev, int sizeof_priv); 552struct iio_dev *devm_iio_device_alloc(struct device *dev, int sizeof_priv);
620
621/**
622 * devm_iio_device_free - Resource-managed iio_device_free()
623 * @dev: Device this iio_dev belongs to
624 * @indio_dev: the iio_dev associated with the device
625 *
626 * Free iio_dev allocated with devm_iio_device_alloc().
627 */
628void devm_iio_device_free(struct device *dev, struct iio_dev *indio_dev); 553void devm_iio_device_free(struct device *dev, struct iio_dev *indio_dev);
629
630/**
631 * devm_iio_trigger_alloc - Resource-managed iio_trigger_alloc()
632 * @dev: Device to allocate iio_trigger for
633 * @fmt: trigger name format. If it includes format
634 * specifiers, the additional arguments following
635 * format are formatted and inserted in the resulting
636 * string replacing their respective specifiers.
637 *
638 * Managed iio_trigger_alloc. iio_trigger allocated with this function is
639 * automatically freed on driver detach.
640 *
641 * If an iio_trigger allocated with this function needs to be freed separately,
642 * devm_iio_trigger_free() must be used.
643 *
644 * RETURNS:
645 * Pointer to allocated iio_trigger on success, NULL on failure.
646 */
647struct iio_trigger *devm_iio_trigger_alloc(struct device *dev, 554struct iio_trigger *devm_iio_trigger_alloc(struct device *dev,
648 const char *fmt, ...); 555 const char *fmt, ...);
649
650/**
651 * devm_iio_trigger_free - Resource-managed iio_trigger_free()
652 * @dev: Device this iio_dev belongs to
653 * @iio_trig: the iio_trigger associated with the device
654 *
655 * Free iio_trigger allocated with devm_iio_trigger_alloc().
656 */
657void devm_iio_trigger_free(struct device *dev, struct iio_trigger *iio_trig); 556void devm_iio_trigger_free(struct device *dev, struct iio_trigger *iio_trig);
658 557
659/** 558/**
diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
index 4ac928ee31c5..084d882fe01b 100644
--- a/include/linux/iio/types.h
+++ b/include/linux/iio/types.h
@@ -29,6 +29,7 @@ enum iio_chan_type {
29 IIO_ALTVOLTAGE, 29 IIO_ALTVOLTAGE,
30 IIO_CCT, 30 IIO_CCT,
31 IIO_PRESSURE, 31 IIO_PRESSURE,
32 IIO_HUMIDITYRELATIVE,
32}; 33};
33 34
34enum iio_modifier { 35enum iio_modifier {
diff --git a/include/linux/init.h b/include/linux/init.h
index 8e68a64bfe00..e1688802964f 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -286,9 +286,11 @@ void __init parse_early_options(char *cmdline);
286#define arch_initcall(fn) module_init(fn) 286#define arch_initcall(fn) module_init(fn)
287#define subsys_initcall(fn) module_init(fn) 287#define subsys_initcall(fn) module_init(fn)
288#define fs_initcall(fn) module_init(fn) 288#define fs_initcall(fn) module_init(fn)
289#define rootfs_initcall(fn) module_init(fn)
289#define device_initcall(fn) module_init(fn) 290#define device_initcall(fn) module_init(fn)
290#define late_initcall(fn) module_init(fn) 291#define late_initcall(fn) module_init(fn)
291 292
293#define console_initcall(fn) module_init(fn)
292#define security_initcall(fn) module_init(fn) 294#define security_initcall(fn) module_init(fn)
293 295
294/* Each module must use one module_init(). */ 296/* Each module must use one module_init(). */
diff --git a/include/linux/init_task.h b/include/linux/init_task.h
index b0ed422e4e4a..f0e52383a001 100644
--- a/include/linux/init_task.h
+++ b/include/linux/init_task.h
@@ -11,6 +11,7 @@
11#include <linux/user_namespace.h> 11#include <linux/user_namespace.h>
12#include <linux/securebits.h> 12#include <linux/securebits.h>
13#include <linux/seqlock.h> 13#include <linux/seqlock.h>
14#include <linux/rbtree.h>
14#include <net/net_namespace.h> 15#include <net/net_namespace.h>
15#include <linux/sched/rt.h> 16#include <linux/sched/rt.h>
16 17
@@ -154,6 +155,14 @@ extern struct task_group root_task_group;
154 155
155#define INIT_TASK_COMM "swapper" 156#define INIT_TASK_COMM "swapper"
156 157
158#ifdef CONFIG_RT_MUTEXES
159# define INIT_RT_MUTEXES(tsk) \
160 .pi_waiters = RB_ROOT, \
161 .pi_waiters_leftmost = NULL,
162#else
163# define INIT_RT_MUTEXES(tsk)
164#endif
165
157/* 166/*
158 * INIT_TASK is used to set up the first task table, touch at 167 * INIT_TASK is used to set up the first task table, touch at
159 * your own risk!. Base=0, limit=0x1fffff (=2MB) 168 * your own risk!. Base=0, limit=0x1fffff (=2MB)
@@ -221,6 +230,7 @@ extern struct task_group root_task_group;
221 INIT_TRACE_RECURSION \ 230 INIT_TRACE_RECURSION \
222 INIT_TASK_RCU_PREEMPT(tsk) \ 231 INIT_TASK_RCU_PREEMPT(tsk) \
223 INIT_CPUSET_SEQ(tsk) \ 232 INIT_CPUSET_SEQ(tsk) \
233 INIT_RT_MUTEXES(tsk) \
224 INIT_VTIME(tsk) \ 234 INIT_VTIME(tsk) \
225} 235}
226 236
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index 56fb646909dc..26e2661d3935 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -152,6 +152,14 @@ static inline int irq_balancing_disabled(unsigned int irq)
152 return desc->status_use_accessors & IRQ_NO_BALANCING_MASK; 152 return desc->status_use_accessors & IRQ_NO_BALANCING_MASK;
153} 153}
154 154
155static inline int irq_is_percpu(unsigned int irq)
156{
157 struct irq_desc *desc;
158
159 desc = irq_to_desc(irq);
160 return desc->status_use_accessors & IRQ_PER_CPU;
161}
162
155static inline void 163static inline void
156irq_set_lockdep_class(unsigned int irq, struct lock_class_key *class) 164irq_set_lockdep_class(unsigned int irq, struct lock_class_key *class)
157{ 165{
diff --git a/include/linux/jump_label.h b/include/linux/jump_label.h
index 39999775b922..5c1dfb2a9e73 100644
--- a/include/linux/jump_label.h
+++ b/include/linux/jump_label.h
@@ -81,18 +81,21 @@ struct module;
81#include <linux/atomic.h> 81#include <linux/atomic.h>
82#ifdef HAVE_JUMP_LABEL 82#ifdef HAVE_JUMP_LABEL
83 83
84#define JUMP_LABEL_TRUE_BRANCH 1UL 84#define JUMP_LABEL_TYPE_FALSE_BRANCH 0UL
85#define JUMP_LABEL_TYPE_TRUE_BRANCH 1UL
86#define JUMP_LABEL_TYPE_MASK 1UL
85 87
86static 88static
87inline struct jump_entry *jump_label_get_entries(struct static_key *key) 89inline struct jump_entry *jump_label_get_entries(struct static_key *key)
88{ 90{
89 return (struct jump_entry *)((unsigned long)key->entries 91 return (struct jump_entry *)((unsigned long)key->entries
90 & ~JUMP_LABEL_TRUE_BRANCH); 92 & ~JUMP_LABEL_TYPE_MASK);
91} 93}
92 94
93static inline bool jump_label_get_branch_default(struct static_key *key) 95static inline bool jump_label_get_branch_default(struct static_key *key)
94{ 96{
95 if ((unsigned long)key->entries & JUMP_LABEL_TRUE_BRANCH) 97 if (((unsigned long)key->entries & JUMP_LABEL_TYPE_MASK) ==
98 JUMP_LABEL_TYPE_TRUE_BRANCH)
96 return true; 99 return true;
97 return false; 100 return false;
98} 101}
@@ -122,10 +125,12 @@ extern void static_key_slow_inc(struct static_key *key);
122extern void static_key_slow_dec(struct static_key *key); 125extern void static_key_slow_dec(struct static_key *key);
123extern void jump_label_apply_nops(struct module *mod); 126extern void jump_label_apply_nops(struct module *mod);
124 127
125#define STATIC_KEY_INIT_TRUE ((struct static_key) \ 128#define STATIC_KEY_INIT_TRUE ((struct static_key) \
126 { .enabled = ATOMIC_INIT(1), .entries = (void *)1 }) 129 { .enabled = ATOMIC_INIT(1), \
127#define STATIC_KEY_INIT_FALSE ((struct static_key) \ 130 .entries = (void *)JUMP_LABEL_TYPE_TRUE_BRANCH })
128 { .enabled = ATOMIC_INIT(0), .entries = (void *)0 }) 131#define STATIC_KEY_INIT_FALSE ((struct static_key) \
132 { .enabled = ATOMIC_INIT(0), \
133 .entries = (void *)JUMP_LABEL_TYPE_FALSE_BRANCH })
129 134
130#else /* !HAVE_JUMP_LABEL */ 135#else /* !HAVE_JUMP_LABEL */
131 136
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index ecb87544cc5d..2aa3d4b000e6 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -394,6 +394,15 @@ extern int panic_on_oops;
394extern int panic_on_unrecovered_nmi; 394extern int panic_on_unrecovered_nmi;
395extern int panic_on_io_nmi; 395extern int panic_on_io_nmi;
396extern int sysctl_panic_on_stackoverflow; 396extern int sysctl_panic_on_stackoverflow;
397/*
398 * Only to be used by arch init code. If the user over-wrote the default
399 * CONFIG_PANIC_TIMEOUT, honor it.
400 */
401static inline void set_arch_panic_timeout(int timeout, int arch_default_timeout)
402{
403 if (panic_timeout == arch_default_timeout)
404 panic_timeout = timeout;
405}
397extern const char *print_tainted(void); 406extern const char *print_tainted(void);
398enum lockdep_ok { 407enum lockdep_ok {
399 LOCKDEP_STILL_OK, 408 LOCKDEP_STILL_OK,
diff --git a/include/linux/kernfs.h b/include/linux/kernfs.h
new file mode 100644
index 000000000000..5be9f0228a3b
--- /dev/null
+++ b/include/linux/kernfs.h
@@ -0,0 +1,376 @@
1/*
2 * kernfs.h - pseudo filesystem decoupled from vfs locking
3 *
4 * This file is released under the GPLv2.
5 */
6
7#ifndef __LINUX_KERNFS_H
8#define __LINUX_KERNFS_H
9
10#include <linux/kernel.h>
11#include <linux/err.h>
12#include <linux/list.h>
13#include <linux/mutex.h>
14#include <linux/idr.h>
15#include <linux/lockdep.h>
16#include <linux/rbtree.h>
17#include <linux/atomic.h>
18#include <linux/completion.h>
19
20struct file;
21struct dentry;
22struct iattr;
23struct seq_file;
24struct vm_area_struct;
25struct super_block;
26struct file_system_type;
27
28struct kernfs_open_node;
29struct kernfs_iattrs;
30
31enum kernfs_node_type {
32 KERNFS_DIR = 0x0001,
33 KERNFS_FILE = 0x0002,
34 KERNFS_LINK = 0x0004,
35};
36
37#define KERNFS_TYPE_MASK 0x000f
38#define KERNFS_ACTIVE_REF KERNFS_FILE
39#define KERNFS_FLAG_MASK ~KERNFS_TYPE_MASK
40
41enum kernfs_node_flag {
42 KERNFS_REMOVED = 0x0010,
43 KERNFS_NS = 0x0020,
44 KERNFS_HAS_SEQ_SHOW = 0x0040,
45 KERNFS_HAS_MMAP = 0x0080,
46 KERNFS_LOCKDEP = 0x0100,
47 KERNFS_STATIC_NAME = 0x0200,
48};
49
50/* type-specific structures for kernfs_node union members */
51struct kernfs_elem_dir {
52 unsigned long subdirs;
53 /* children rbtree starts here and goes through kn->rb */
54 struct rb_root children;
55
56 /*
57 * The kernfs hierarchy this directory belongs to. This fits
58 * better directly in kernfs_node but is here to save space.
59 */
60 struct kernfs_root *root;
61};
62
63struct kernfs_elem_symlink {
64 struct kernfs_node *target_kn;
65};
66
67struct kernfs_elem_attr {
68 const struct kernfs_ops *ops;
69 struct kernfs_open_node *open;
70 loff_t size;
71};
72
73/*
74 * kernfs_node - the building block of kernfs hierarchy. Each and every
75 * kernfs node is represented by single kernfs_node. Most fields are
76 * private to kernfs and shouldn't be accessed directly by kernfs users.
77 *
78 * As long as s_count reference is held, the kernfs_node itself is
79 * accessible. Dereferencing elem or any other outer entity requires
80 * active reference.
81 */
82struct kernfs_node {
83 atomic_t count;
84 atomic_t active;
85#ifdef CONFIG_DEBUG_LOCK_ALLOC
86 struct lockdep_map dep_map;
87#endif
88 /* the following two fields are published */
89 struct kernfs_node *parent;
90 const char *name;
91
92 struct rb_node rb;
93
94 union {
95 struct completion *completion;
96 struct kernfs_node *removed_list;
97 } u;
98
99 const void *ns; /* namespace tag */
100 unsigned int hash; /* ns + name hash */
101 union {
102 struct kernfs_elem_dir dir;
103 struct kernfs_elem_symlink symlink;
104 struct kernfs_elem_attr attr;
105 };
106
107 void *priv;
108
109 unsigned short flags;
110 umode_t mode;
111 unsigned int ino;
112 struct kernfs_iattrs *iattr;
113};
114
115/*
116 * kernfs_dir_ops may be specified on kernfs_create_root() to support
117 * directory manipulation syscalls. These optional callbacks are invoked
118 * on the matching syscalls and can perform any kernfs operations which
119 * don't necessarily have to be the exact operation requested.
120 */
121struct kernfs_dir_ops {
122 int (*mkdir)(struct kernfs_node *parent, const char *name,
123 umode_t mode);
124 int (*rmdir)(struct kernfs_node *kn);
125 int (*rename)(struct kernfs_node *kn, struct kernfs_node *new_parent,
126 const char *new_name);
127};
128
129struct kernfs_root {
130 /* published fields */
131 struct kernfs_node *kn;
132
133 /* private fields, do not use outside kernfs proper */
134 struct ida ino_ida;
135 struct kernfs_dir_ops *dir_ops;
136};
137
138struct kernfs_open_file {
139 /* published fields */
140 struct kernfs_node *kn;
141 struct file *file;
142
143 /* private fields, do not use outside kernfs proper */
144 struct mutex mutex;
145 int event;
146 struct list_head list;
147
148 bool mmapped;
149 const struct vm_operations_struct *vm_ops;
150};
151
152struct kernfs_ops {
153 /*
154 * Read is handled by either seq_file or raw_read().
155 *
156 * If seq_show() is present, seq_file path is active. Other seq
157 * operations are optional and if not implemented, the behavior is
158 * equivalent to single_open(). @sf->private points to the
159 * associated kernfs_open_file.
160 *
161 * read() is bounced through kernel buffer and a read larger than
162 * PAGE_SIZE results in partial operation of PAGE_SIZE.
163 */
164 int (*seq_show)(struct seq_file *sf, void *v);
165
166 void *(*seq_start)(struct seq_file *sf, loff_t *ppos);
167 void *(*seq_next)(struct seq_file *sf, void *v, loff_t *ppos);
168 void (*seq_stop)(struct seq_file *sf, void *v);
169
170 ssize_t (*read)(struct kernfs_open_file *of, char *buf, size_t bytes,
171 loff_t off);
172
173 /*
174 * write() is bounced through kernel buffer and a write larger than
175 * PAGE_SIZE results in partial operation of PAGE_SIZE.
176 */
177 ssize_t (*write)(struct kernfs_open_file *of, char *buf, size_t bytes,
178 loff_t off);
179
180 int (*mmap)(struct kernfs_open_file *of, struct vm_area_struct *vma);
181
182#ifdef CONFIG_DEBUG_LOCK_ALLOC
183 struct lock_class_key lockdep_key;
184#endif
185};
186
187#ifdef CONFIG_SYSFS
188
189static inline enum kernfs_node_type kernfs_type(struct kernfs_node *kn)
190{
191 return kn->flags & KERNFS_TYPE_MASK;
192}
193
194/**
195 * kernfs_enable_ns - enable namespace under a directory
196 * @kn: directory of interest, should be empty
197 *
198 * This is to be called right after @kn is created to enable namespace
199 * under it. All children of @kn must have non-NULL namespace tags and
200 * only the ones which match the super_block's tag will be visible.
201 */
202static inline void kernfs_enable_ns(struct kernfs_node *kn)
203{
204 WARN_ON_ONCE(kernfs_type(kn) != KERNFS_DIR);
205 WARN_ON_ONCE(!RB_EMPTY_ROOT(&kn->dir.children));
206 kn->flags |= KERNFS_NS;
207}
208
209/**
210 * kernfs_ns_enabled - test whether namespace is enabled
211 * @kn: the node to test
212 *
213 * Test whether namespace filtering is enabled for the children of @ns.
214 */
215static inline bool kernfs_ns_enabled(struct kernfs_node *kn)
216{
217 return kn->flags & KERNFS_NS;
218}
219
220struct kernfs_node *kernfs_find_and_get_ns(struct kernfs_node *parent,
221 const char *name, const void *ns);
222void kernfs_get(struct kernfs_node *kn);
223void kernfs_put(struct kernfs_node *kn);
224
225struct kernfs_root *kernfs_create_root(struct kernfs_dir_ops *kdops,
226 void *priv);
227void kernfs_destroy_root(struct kernfs_root *root);
228
229struct kernfs_node *kernfs_create_dir_ns(struct kernfs_node *parent,
230 const char *name, umode_t mode,
231 void *priv, const void *ns);
232struct kernfs_node *__kernfs_create_file(struct kernfs_node *parent,
233 const char *name,
234 umode_t mode, loff_t size,
235 const struct kernfs_ops *ops,
236 void *priv, const void *ns,
237 bool name_is_static,
238 struct lock_class_key *key);
239struct kernfs_node *kernfs_create_link(struct kernfs_node *parent,
240 const char *name,
241 struct kernfs_node *target);
242void kernfs_remove(struct kernfs_node *kn);
243int kernfs_remove_by_name_ns(struct kernfs_node *parent, const char *name,
244 const void *ns);
245int kernfs_rename_ns(struct kernfs_node *kn, struct kernfs_node *new_parent,
246 const char *new_name, const void *new_ns);
247int kernfs_setattr(struct kernfs_node *kn, const struct iattr *iattr);
248void kernfs_notify(struct kernfs_node *kn);
249
250const void *kernfs_super_ns(struct super_block *sb);
251struct dentry *kernfs_mount_ns(struct file_system_type *fs_type, int flags,
252 struct kernfs_root *root, const void *ns);
253void kernfs_kill_sb(struct super_block *sb);
254
255void kernfs_init(void);
256
257#else /* CONFIG_SYSFS */
258
259static inline enum kernfs_node_type kernfs_type(struct kernfs_node *kn)
260{ return 0; } /* whatever */
261
262static inline void kernfs_enable_ns(struct kernfs_node *kn) { }
263
264static inline bool kernfs_ns_enabled(struct kernfs_node *kn)
265{ return false; }
266
267static inline struct kernfs_node *
268kernfs_find_and_get_ns(struct kernfs_node *parent, const char *name,
269 const void *ns)
270{ return NULL; }
271
272static inline void kernfs_get(struct kernfs_node *kn) { }
273static inline void kernfs_put(struct kernfs_node *kn) { }
274
275static inline struct kernfs_root *
276kernfs_create_root(struct kernfs_dir_ops *kdops, void *priv)
277{ return ERR_PTR(-ENOSYS); }
278
279static inline void kernfs_destroy_root(struct kernfs_root *root) { }
280
281static inline struct kernfs_node *
282kernfs_create_dir_ns(struct kernfs_node *parent, const char *name,
283 umode_t mode, void *priv, const void *ns)
284{ return ERR_PTR(-ENOSYS); }
285
286static inline struct kernfs_node *
287__kernfs_create_file(struct kernfs_node *parent, const char *name,
288 umode_t mode, loff_t size, const struct kernfs_ops *ops,
289 void *priv, const void *ns, bool name_is_static,
290 struct lock_class_key *key)
291{ return ERR_PTR(-ENOSYS); }
292
293static inline struct kernfs_node *
294kernfs_create_link(struct kernfs_node *parent, const char *name,
295 struct kernfs_node *target)
296{ return ERR_PTR(-ENOSYS); }
297
298static inline void kernfs_remove(struct kernfs_node *kn) { }
299
300static inline int kernfs_remove_by_name_ns(struct kernfs_node *kn,
301 const char *name, const void *ns)
302{ return -ENOSYS; }
303
304static inline int kernfs_rename_ns(struct kernfs_node *kn,
305 struct kernfs_node *new_parent,
306 const char *new_name, const void *new_ns)
307{ return -ENOSYS; }
308
309static inline int kernfs_setattr(struct kernfs_node *kn,
310 const struct iattr *iattr)
311{ return -ENOSYS; }
312
313static inline void kernfs_notify(struct kernfs_node *kn) { }
314
315static inline const void *kernfs_super_ns(struct super_block *sb)
316{ return NULL; }
317
318static inline struct dentry *
319kernfs_mount_ns(struct file_system_type *fs_type, int flags,
320 struct kernfs_root *root, const void *ns)
321{ return ERR_PTR(-ENOSYS); }
322
323static inline void kernfs_kill_sb(struct super_block *sb) { }
324
325static inline void kernfs_init(void) { }
326
327#endif /* CONFIG_SYSFS */
328
329static inline struct kernfs_node *
330kernfs_find_and_get(struct kernfs_node *kn, const char *name)
331{
332 return kernfs_find_and_get_ns(kn, name, NULL);
333}
334
335static inline struct kernfs_node *
336kernfs_create_dir(struct kernfs_node *parent, const char *name, umode_t mode,
337 void *priv)
338{
339 return kernfs_create_dir_ns(parent, name, mode, priv, NULL);
340}
341
342static inline struct kernfs_node *
343kernfs_create_file_ns(struct kernfs_node *parent, const char *name,
344 umode_t mode, loff_t size, const struct kernfs_ops *ops,
345 void *priv, const void *ns)
346{
347 struct lock_class_key *key = NULL;
348
349#ifdef CONFIG_DEBUG_LOCK_ALLOC
350 key = (struct lock_class_key *)&ops->lockdep_key;
351#endif
352 return __kernfs_create_file(parent, name, mode, size, ops, priv, ns,
353 false, key);
354}
355
356static inline struct kernfs_node *
357kernfs_create_file(struct kernfs_node *parent, const char *name, umode_t mode,
358 loff_t size, const struct kernfs_ops *ops, void *priv)
359{
360 return kernfs_create_file_ns(parent, name, mode, size, ops, priv, NULL);
361}
362
363static inline int kernfs_remove_by_name(struct kernfs_node *parent,
364 const char *name)
365{
366 return kernfs_remove_by_name_ns(parent, name, NULL);
367}
368
369static inline struct dentry *
370kernfs_mount(struct file_system_type *fs_type, int flags,
371 struct kernfs_root *root)
372{
373 return kernfs_mount_ns(fs_type, flags, root, NULL);
374}
375
376#endif /* __LINUX_KERNFS_H */
diff --git a/include/linux/kobj_completion.h b/include/linux/kobj_completion.h
deleted file mode 100644
index a428f6436063..000000000000
--- a/include/linux/kobj_completion.h
+++ /dev/null
@@ -1,18 +0,0 @@
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 e7ba650086ce..926afb6f6b5f 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -64,7 +64,7 @@ struct kobject {
64 struct kobject *parent; 64 struct kobject *parent;
65 struct kset *kset; 65 struct kset *kset;
66 struct kobj_type *ktype; 66 struct kobj_type *ktype;
67 struct sysfs_dirent *sd; 67 struct kernfs_node *sd;
68 struct kref kref; 68 struct kref kref;
69#ifdef CONFIG_DEBUG_KOBJECT_RELEASE 69#ifdef CONFIG_DEBUG_KOBJECT_RELEASE
70 struct delayed_work release; 70 struct delayed_work release;
diff --git a/include/linux/memory.h b/include/linux/memory.h
index 9a6bbf76452d..bb7384e3c3d8 100644
--- a/include/linux/memory.h
+++ b/include/linux/memory.h
@@ -35,6 +35,7 @@ struct memory_block {
35}; 35};
36 36
37int arch_get_memory_phys_device(unsigned long start_pfn); 37int arch_get_memory_phys_device(unsigned long start_pfn);
38unsigned long __weak memory_block_size_bytes(void);
38 39
39/* These states are exposed to userspace as text strings in sysfs */ 40/* These states are exposed to userspace as text strings in sysfs */
40#define MEM_ONLINE (1<<0) /* exposed to userspace */ 41#define MEM_ONLINE (1<<0) /* exposed to userspace */
diff --git a/include/linux/mfd/arizona/registers.h b/include/linux/mfd/arizona/registers.h
index 19883aeb1ac8..fdf3aa376eb2 100644
--- a/include/linux/mfd/arizona/registers.h
+++ b/include/linux/mfd/arizona/registers.h
@@ -2233,6 +2233,15 @@
2233/* 2233/*
2234 * R677 (0x2A5) - Mic Detect 3 2234 * R677 (0x2A5) - Mic Detect 3
2235 */ 2235 */
2236#define ARIZONA_MICD_LVL_0 0x0004 /* MICD_LVL - [2] */
2237#define ARIZONA_MICD_LVL_1 0x0008 /* MICD_LVL - [3] */
2238#define ARIZONA_MICD_LVL_2 0x0010 /* MICD_LVL - [4] */
2239#define ARIZONA_MICD_LVL_3 0x0020 /* MICD_LVL - [5] */
2240#define ARIZONA_MICD_LVL_4 0x0040 /* MICD_LVL - [6] */
2241#define ARIZONA_MICD_LVL_5 0x0080 /* MICD_LVL - [7] */
2242#define ARIZONA_MICD_LVL_6 0x0100 /* MICD_LVL - [8] */
2243#define ARIZONA_MICD_LVL_7 0x0200 /* MICD_LVL - [9] */
2244#define ARIZONA_MICD_LVL_8 0x0400 /* MICD_LVL - [10] */
2236#define ARIZONA_MICD_LVL_MASK 0x07FC /* MICD_LVL - [10:2] */ 2245#define ARIZONA_MICD_LVL_MASK 0x07FC /* MICD_LVL - [10:2] */
2237#define ARIZONA_MICD_LVL_SHIFT 2 /* MICD_LVL - [10:2] */ 2246#define ARIZONA_MICD_LVL_SHIFT 2 /* MICD_LVL - [10:2] */
2238#define ARIZONA_MICD_LVL_WIDTH 9 /* MICD_LVL - [10:2] */ 2247#define ARIZONA_MICD_LVL_WIDTH 9 /* MICD_LVL - [10:2] */
diff --git a/include/linux/mfd/as3722.h b/include/linux/mfd/as3722.h
index 16bf8a0dcd97..f654a7a42260 100644
--- a/include/linux/mfd/as3722.h
+++ b/include/linux/mfd/as3722.h
@@ -314,6 +314,7 @@
314#define AS3722_GPIO_IOSF_GPIO_INTERRUPT_IN AS3722_GPIO_IOSF_VAL(3) 314#define AS3722_GPIO_IOSF_GPIO_INTERRUPT_IN AS3722_GPIO_IOSF_VAL(3)
315#define AS3722_GPIO_IOSF_ISINK_PWM_IN AS3722_GPIO_IOSF_VAL(4) 315#define AS3722_GPIO_IOSF_ISINK_PWM_IN AS3722_GPIO_IOSF_VAL(4)
316#define AS3722_GPIO_IOSF_VOLTAGE_STBY AS3722_GPIO_IOSF_VAL(5) 316#define AS3722_GPIO_IOSF_VOLTAGE_STBY AS3722_GPIO_IOSF_VAL(5)
317#define AS3722_GPIO_IOSF_SD0_OUT AS3722_GPIO_IOSF_VAL(6)
317#define AS3722_GPIO_IOSF_PWR_GOOD_OUT AS3722_GPIO_IOSF_VAL(7) 318#define AS3722_GPIO_IOSF_PWR_GOOD_OUT AS3722_GPIO_IOSF_VAL(7)
318#define AS3722_GPIO_IOSF_Q32K_OUT AS3722_GPIO_IOSF_VAL(8) 319#define AS3722_GPIO_IOSF_Q32K_OUT AS3722_GPIO_IOSF_VAL(8)
319#define AS3722_GPIO_IOSF_WATCHDOG_IN AS3722_GPIO_IOSF_VAL(9) 320#define AS3722_GPIO_IOSF_WATCHDOG_IN AS3722_GPIO_IOSF_VAL(9)
diff --git a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
index b6d36b38b99c..866e355fa409 100644
--- a/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
+++ b/include/linux/mfd/syscon/imx6q-iomuxc-gpr.h
@@ -212,6 +212,7 @@
212#define IMX6Q_GPR3_MIPI_MUX_CTL_IPU1_DI1 (0x1 << 4) 212#define IMX6Q_GPR3_MIPI_MUX_CTL_IPU1_DI1 (0x1 << 4)
213#define IMX6Q_GPR3_MIPI_MUX_CTL_IPU2_DI0 (0x2 << 4) 213#define IMX6Q_GPR3_MIPI_MUX_CTL_IPU2_DI0 (0x2 << 4)
214#define IMX6Q_GPR3_MIPI_MUX_CTL_IPU2_DI1 (0x3 << 4) 214#define IMX6Q_GPR3_MIPI_MUX_CTL_IPU2_DI1 (0x3 << 4)
215#define IMX6Q_GPR3_HDMI_MUX_CTL_SHIFT 2
215#define IMX6Q_GPR3_HDMI_MUX_CTL_MASK (0x3 << 2) 216#define IMX6Q_GPR3_HDMI_MUX_CTL_MASK (0x3 << 2)
216#define IMX6Q_GPR3_HDMI_MUX_CTL_IPU1_DI0 (0x0 << 2) 217#define IMX6Q_GPR3_HDMI_MUX_CTL_IPU1_DI0 (0x0 << 2)
217#define IMX6Q_GPR3_HDMI_MUX_CTL_IPU1_DI1 (0x1 << 2) 218#define IMX6Q_GPR3_HDMI_MUX_CTL_IPU1_DI1 (0x1 << 2)
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 2e069d1288df..e56b07f5c9b6 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -320,6 +320,7 @@ struct perf_event {
320 struct list_head migrate_entry; 320 struct list_head migrate_entry;
321 321
322 struct hlist_node hlist_entry; 322 struct hlist_node hlist_entry;
323 struct list_head active_entry;
323 int nr_siblings; 324 int nr_siblings;
324 int group_flags; 325 int group_flags;
325 struct perf_event *group_leader; 326 struct perf_event *group_leader;
diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
index 6d722695e027..e273e5ac19c9 100644
--- a/include/linux/phy/phy.h
+++ b/include/linux/phy/phy.h
@@ -38,6 +38,14 @@ struct phy_ops {
38}; 38};
39 39
40/** 40/**
41 * struct phy_attrs - represents phy attributes
42 * @bus_width: Data path width implemented by PHY
43 */
44struct phy_attrs {
45 u32 bus_width;
46};
47
48/**
41 * struct phy - represents the phy device 49 * struct phy - represents the phy device
42 * @dev: phy device 50 * @dev: phy device
43 * @id: id of the phy device 51 * @id: id of the phy device
@@ -46,6 +54,7 @@ struct phy_ops {
46 * @mutex: mutex to protect phy_ops 54 * @mutex: mutex to protect phy_ops
47 * @init_count: used to protect when the PHY is used by multiple consumers 55 * @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 56 * @power_count: used to protect when the PHY is used by multiple consumers
57 * @phy_attrs: used to specify PHY specific attributes
49 */ 58 */
50struct phy { 59struct phy {
51 struct device dev; 60 struct device dev;
@@ -55,6 +64,7 @@ struct phy {
55 struct mutex mutex; 64 struct mutex mutex;
56 int init_count; 65 int init_count;
57 int power_count; 66 int power_count;
67 struct phy_attrs attrs;
58}; 68};
59 69
60/** 70/**
@@ -127,6 +137,14 @@ int phy_init(struct phy *phy);
127int phy_exit(struct phy *phy); 137int phy_exit(struct phy *phy);
128int phy_power_on(struct phy *phy); 138int phy_power_on(struct phy *phy);
129int phy_power_off(struct phy *phy); 139int phy_power_off(struct phy *phy);
140static inline int phy_get_bus_width(struct phy *phy)
141{
142 return phy->attrs.bus_width;
143}
144static inline void phy_set_bus_width(struct phy *phy, int bus_width)
145{
146 phy->attrs.bus_width = bus_width;
147}
130struct phy *phy_get(struct device *dev, const char *string); 148struct phy *phy_get(struct device *dev, const char *string);
131struct phy *devm_phy_get(struct device *dev, const char *string); 149struct phy *devm_phy_get(struct device *dev, const char *string);
132void phy_put(struct phy *phy); 150void phy_put(struct phy *phy);
@@ -199,6 +217,16 @@ static inline int phy_power_off(struct phy *phy)
199 return -ENOSYS; 217 return -ENOSYS;
200} 218}
201 219
220static inline int phy_get_bus_width(struct phy *phy)
221{
222 return -ENOSYS;
223}
224
225static inline void phy_set_bus_width(struct phy *phy, int bus_width)
226{
227 return;
228}
229
202static inline struct phy *phy_get(struct device *dev, const char *string) 230static inline struct phy *phy_get(struct device *dev, const char *string)
203{ 231{
204 return ERR_PTR(-ENOSYS); 232 return ERR_PTR(-ENOSYS);
diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h
index fb90ef5eb038..a15f10727eb8 100644
--- a/include/linux/pinctrl/pinconf-generic.h
+++ b/include/linux/pinctrl/pinconf-generic.h
@@ -61,6 +61,9 @@
61 * argument is ignored. 61 * argument is ignored.
62 * @PIN_CONFIG_DRIVE_STRENGTH: the pin will sink or source at most the current 62 * @PIN_CONFIG_DRIVE_STRENGTH: the pin will sink or source at most the current
63 * passed as argument. The argument is in mA. 63 * passed as argument. The argument is in mA.
64 * @PIN_CONFIG_INPUT_ENABLE: enable the pin's input. Note that this does not
65 * affect the pin's ability to drive output. 1 enables input, 0 disables
66 * input.
64 * @PIN_CONFIG_INPUT_SCHMITT_ENABLE: control schmitt-trigger mode on the pin. 67 * @PIN_CONFIG_INPUT_SCHMITT_ENABLE: control schmitt-trigger mode on the pin.
65 * If the argument != 0, schmitt-trigger mode is enabled. If it's 0, 68 * If the argument != 0, schmitt-trigger mode is enabled. If it's 0,
66 * schmitt-trigger mode is disabled. 69 * schmitt-trigger mode is disabled.
@@ -82,8 +85,10 @@
82 * operation, if several modes of operation are supported these can be 85 * operation, if several modes of operation are supported these can be
83 * passed in the argument on a custom form, else just use argument 1 86 * passed in the argument on a custom form, else just use argument 1
84 * to indicate low power mode, argument 0 turns low power mode off. 87 * to indicate low power mode, argument 0 turns low power mode off.
85 * @PIN_CONFIG_OUTPUT: this will configure the pin in output, use argument 88 * @PIN_CONFIG_OUTPUT: this will configure the pin as an output. Use argument
86 * 1 to indicate high level, argument 0 to indicate low level. 89 * 1 to indicate high level, argument 0 to indicate low level. (Please
90 * see Documentation/pinctrl.txt, section "GPIO mode pitfalls" for a
91 * discussion around this parameter.)
87 * @PIN_CONFIG_END: this is the last enumerator for pin configurations, if 92 * @PIN_CONFIG_END: this is the last enumerator for pin configurations, if
88 * you need to pass in custom configurations to the pin controller, use 93 * you need to pass in custom configurations to the pin controller, use
89 * PIN_CONFIG_END+1 as the base offset. 94 * PIN_CONFIG_END+1 as the base offset.
@@ -99,6 +104,7 @@ enum pin_config_param {
99 PIN_CONFIG_DRIVE_OPEN_DRAIN, 104 PIN_CONFIG_DRIVE_OPEN_DRAIN,
100 PIN_CONFIG_DRIVE_OPEN_SOURCE, 105 PIN_CONFIG_DRIVE_OPEN_SOURCE,
101 PIN_CONFIG_DRIVE_STRENGTH, 106 PIN_CONFIG_DRIVE_STRENGTH,
107 PIN_CONFIG_INPUT_ENABLE,
102 PIN_CONFIG_INPUT_SCHMITT_ENABLE, 108 PIN_CONFIG_INPUT_SCHMITT_ENABLE,
103 PIN_CONFIG_INPUT_SCHMITT, 109 PIN_CONFIG_INPUT_SCHMITT,
104 PIN_CONFIG_INPUT_DEBOUNCE, 110 PIN_CONFIG_INPUT_DEBOUNCE,
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
index fefb88663975..cc8e1aff0e28 100644
--- a/include/linux/pinctrl/pinctrl.h
+++ b/include/linux/pinctrl/pinctrl.h
@@ -32,10 +32,12 @@ struct device_node;
32 * pins, pads or other muxable units in this struct 32 * pins, pads or other muxable units in this struct
33 * @number: unique pin number from the global pin number space 33 * @number: unique pin number from the global pin number space
34 * @name: a name for this pin 34 * @name: a name for this pin
35 * @drv_data: driver-defined per-pin data. pinctrl core does not touch this
35 */ 36 */
36struct pinctrl_pin_desc { 37struct pinctrl_pin_desc {
37 unsigned number; 38 unsigned number;
38 const char *name; 39 const char *name;
40 void *drv_data;
39}; 41};
40 42
41/* Convenience macro to define a single named or anonymous pin descriptor */ 43/* Convenience macro to define a single named or anonymous pin descriptor */
diff --git a/include/linux/platform_data/gpio-lpc32xx.h b/include/linux/platform_data/gpio-lpc32xx.h
new file mode 100644
index 000000000000..a544e962a818
--- /dev/null
+++ b/include/linux/platform_data/gpio-lpc32xx.h
@@ -0,0 +1,50 @@
1/*
2 * Author: Kevin Wells <kevin.wells@nxp.com>
3 *
4 * Copyright (C) 2010 NXP Semiconductors
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 __MACH_GPIO_LPC32XX_H
18#define __MACH_GPIO_LPC32XX_H
19
20/*
21 * Note!
22 * Muxed GP pins need to be setup to the GP state in the board level
23 * code prior to using this driver.
24 * GPI pins : 28xP3 group
25 * GPO pins : 24xP3 group
26 * GPIO pins: 8xP0 group, 24xP1 group, 13xP2 group, 6xP3 group
27 */
28
29#define LPC32XX_GPIO_P0_MAX 8
30#define LPC32XX_GPIO_P1_MAX 24
31#define LPC32XX_GPIO_P2_MAX 13
32#define LPC32XX_GPIO_P3_MAX 6
33#define LPC32XX_GPI_P3_MAX 29
34#define LPC32XX_GPO_P3_MAX 24
35
36#define LPC32XX_GPIO_P0_GRP 0
37#define LPC32XX_GPIO_P1_GRP (LPC32XX_GPIO_P0_GRP + LPC32XX_GPIO_P0_MAX)
38#define LPC32XX_GPIO_P2_GRP (LPC32XX_GPIO_P1_GRP + LPC32XX_GPIO_P1_MAX)
39#define LPC32XX_GPIO_P3_GRP (LPC32XX_GPIO_P2_GRP + LPC32XX_GPIO_P2_MAX)
40#define LPC32XX_GPI_P3_GRP (LPC32XX_GPIO_P3_GRP + LPC32XX_GPIO_P3_MAX)
41#define LPC32XX_GPO_P3_GRP (LPC32XX_GPI_P3_GRP + LPC32XX_GPI_P3_MAX)
42
43/*
44 * A specific GPIO can be selected with this macro
45 * ie, GPIO_05 can be selected with LPC32XX_GPIO(LPC32XX_GPIO_P3_GRP, 5)
46 * See the LPC32x0 User's guide for GPIO group numbers
47 */
48#define LPC32XX_GPIO(x, y) ((x) + (y))
49
50#endif /* __MACH_GPIO_LPC32XX_H */
diff --git a/include/linux/platform_data/hwmon-s3c.h b/include/linux/platform_data/hwmon-s3c.h
index c167e4429bc7..0e3cce130fe2 100644
--- a/include/linux/platform_data/hwmon-s3c.h
+++ b/include/linux/platform_data/hwmon-s3c.h
@@ -1,5 +1,4 @@
1/* linux/arch/arm/plat-s3c/include/plat/hwmon.h 1/*
2 *
3 * Copyright 2005 Simtec Electronics 2 * Copyright 2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk> 3 * Ben Dooks <ben@simtec.co.uk>
5 * http://armlinux.simtec.co.uk/ 4 * http://armlinux.simtec.co.uk/
@@ -11,8 +10,8 @@
11 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
12*/ 11*/
13 12
14#ifndef __ASM_ARCH_ADC_HWMON_H 13#ifndef __HWMON_S3C_H__
15#define __ASM_ARCH_ADC_HWMON_H __FILE__ 14#define __HWMON_S3C_H__
16 15
17/** 16/**
18 * s3c_hwmon_chcfg - channel configuration 17 * s3c_hwmon_chcfg - channel configuration
@@ -47,5 +46,4 @@ struct s3c_hwmon_pdata {
47 */ 46 */
48extern void __init s3c_hwmon_set_platdata(struct s3c_hwmon_pdata *pd); 47extern void __init s3c_hwmon_set_platdata(struct s3c_hwmon_pdata *pd);
49 48
50#endif /* __ASM_ARCH_ADC_HWMON_H */ 49#endif /* __HWMON_S3C_H__ */
51
diff --git a/include/linux/platform_data/i2c-nomadik.h b/include/linux/platform_data/i2c-nomadik.h
deleted file mode 100644
index 3a8be9cdc95c..000000000000
--- a/include/linux/platform_data/i2c-nomadik.h
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 * Copyright (C) 2009 ST-Ericsson
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 version 2, as
6 * published by the Free Software Foundation.
7 */
8#ifndef __PDATA_I2C_NOMADIK_H
9#define __PDATA_I2C_NOMADIK_H
10
11enum i2c_freq_mode {
12 I2C_FREQ_MODE_STANDARD, /* up to 100 Kb/s */
13 I2C_FREQ_MODE_FAST, /* up to 400 Kb/s */
14 I2C_FREQ_MODE_HIGH_SPEED, /* up to 3.4 Mb/s */
15 I2C_FREQ_MODE_FAST_PLUS, /* up to 1 Mb/s */
16};
17
18/**
19 * struct nmk_i2c_controller - client specific controller configuration
20 * @clk_freq: clock frequency for the operation mode
21 * @slsu: Slave data setup time in ns.
22 * The needed setup time for three modes of operation
23 * are 250ns, 100ns and 10ns respectively thus leading
24 * to the values of 14, 6, 2 for a 48 MHz i2c clk
25 * @tft: Tx FIFO Threshold in bytes
26 * @rft: Rx FIFO Threshold in bytes
27 * @timeout Slave response timeout(ms)
28 * @sm: speed mode
29 */
30struct nmk_i2c_controller {
31 u32 clk_freq;
32 unsigned short slsu;
33 unsigned char tft;
34 unsigned char rft;
35 int timeout;
36 enum i2c_freq_mode sm;
37};
38
39#endif /* __PDATA_I2C_NOMADIK_H */
diff --git a/include/linux/platform_data/max197.h b/include/linux/platform_data/max197.h
index e2a41dd7690c..8da8f94ee15c 100644
--- a/include/linux/platform_data/max197.h
+++ b/include/linux/platform_data/max197.h
@@ -11,6 +11,9 @@
11 * For further information, see the Documentation/hwmon/max197 file. 11 * For further information, see the Documentation/hwmon/max197 file.
12 */ 12 */
13 13
14#ifndef _PDATA_MAX197_H
15#define _PDATA_MAX197_H
16
14/** 17/**
15 * struct max197_platform_data - MAX197 connectivity info 18 * struct max197_platform_data - MAX197 connectivity info
16 * @convert: Function used to start a conversion with control byte ctrl. 19 * @convert: Function used to start a conversion with control byte ctrl.
@@ -19,3 +22,5 @@
19struct max197_platform_data { 22struct max197_platform_data {
20 int (*convert)(u8 ctrl); 23 int (*convert)(u8 ctrl);
21}; 24};
25
26#endif /* _PDATA_MAX197_H */
diff --git a/include/linux/platform_data/sht15.h b/include/linux/platform_data/sht15.h
index 33e0fd27225e..12289c1e9413 100644
--- a/include/linux/platform_data/sht15.h
+++ b/include/linux/platform_data/sht15.h
@@ -12,6 +12,9 @@
12 * For further information, see the Documentation/hwmon/sht15 file. 12 * For further information, see the Documentation/hwmon/sht15 file.
13 */ 13 */
14 14
15#ifndef _PDATA_SHT15_H
16#define _PDATA_SHT15_H
17
15/** 18/**
16 * struct sht15_platform_data - sht15 connectivity info 19 * struct sht15_platform_data - sht15 connectivity info
17 * @gpio_data: no. of gpio to which bidirectional data line is 20 * @gpio_data: no. of gpio to which bidirectional data line is
@@ -31,3 +34,5 @@ struct sht15_platform_data {
31 bool no_otp_reload; 34 bool no_otp_reload;
32 bool low_resolution; 35 bool low_resolution;
33}; 36};
37
38#endif /* _PDATA_SHT15_H */
diff --git a/include/linux/platform_data/usb-ehci-orion.h b/include/linux/platform_data/usb-ehci-orion.h
index 6fc78e430420..52b0acb35fd7 100644
--- a/include/linux/platform_data/usb-ehci-orion.h
+++ b/include/linux/platform_data/usb-ehci-orion.h
@@ -1,13 +1,11 @@
1/* 1/*
2 * arch/arm/plat-orion/include/plat/ehci-orion.h
3 *
4 * This file is licensed under the terms of the GNU General Public 2 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any 3 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied. 4 * warranty of any kind, whether express or implied.
7 */ 5 */
8 6
9#ifndef __PLAT_EHCI_ORION_H 7#ifndef __USB_EHCI_ORION_H
10#define __PLAT_EHCI_ORION_H 8#define __USB_EHCI_ORION_H
11 9
12#include <linux/mbus.h> 10#include <linux/mbus.h>
13 11
diff --git a/include/linux/platform_data/usb-omap1.h b/include/linux/platform_data/usb-omap1.h
new file mode 100644
index 000000000000..43b5ce139c37
--- /dev/null
+++ b/include/linux/platform_data/usb-omap1.h
@@ -0,0 +1,53 @@
1/*
2 * Platform data for OMAP1 USB
3 *
4 * This file is subject to the terms and conditions of the GNU General Public
5 * License. See the file "COPYING" in the main directory of this archive for
6 * more details.
7 */
8#ifndef __LINUX_USB_OMAP1_H
9#define __LINUX_USB_OMAP1_H
10
11#include <linux/platform_device.h>
12
13struct omap_usb_config {
14 /* Configure drivers according to the connectors on your board:
15 * - "A" connector (rectagular)
16 * ... for host/OHCI use, set "register_host".
17 * - "B" connector (squarish) or "Mini-B"
18 * ... for device/gadget use, set "register_dev".
19 * - "Mini-AB" connector (very similar to Mini-B)
20 * ... for OTG use as device OR host, initialize "otg"
21 */
22 unsigned register_host:1;
23 unsigned register_dev:1;
24 u8 otg; /* port number, 1-based: usb1 == 2 */
25
26 const char *extcon; /* extcon device for OTG */
27
28 u8 hmc_mode;
29
30 /* implicitly true if otg: host supports remote wakeup? */
31 u8 rwc;
32
33 /* signaling pins used to talk to transceiver on usbN:
34 * 0 == usbN unused
35 * 2 == usb0-only, using internal transceiver
36 * 3 == 3 wire bidirectional
37 * 4 == 4 wire bidirectional
38 * 6 == 6 wire unidirectional (or TLL)
39 */
40 u8 pins[3];
41
42 struct platform_device *udc_device;
43 struct platform_device *ohci_device;
44 struct platform_device *otg_device;
45
46 u32 (*usb0_init)(unsigned nwires, unsigned is_device);
47 u32 (*usb1_init)(unsigned nwires);
48 u32 (*usb2_init)(unsigned nwires, unsigned alt_pingroup);
49
50 int (*ocpi_enable)(void);
51};
52
53#endif /* __LINUX_USB_OMAP1_H */
diff --git a/include/linux/preempt.h b/include/linux/preempt.h
index a3d9dc8c2c00..59749fc48328 100644
--- a/include/linux/preempt.h
+++ b/include/linux/preempt.h
@@ -64,7 +64,11 @@ do { \
64} while (0) 64} while (0)
65 65
66#else 66#else
67#define preempt_enable() preempt_enable_no_resched() 67#define preempt_enable() \
68do { \
69 barrier(); \
70 preempt_count_dec(); \
71} while (0)
68#define preempt_check_resched() do { } while (0) 72#define preempt_check_resched() do { } while (0)
69#endif 73#endif
70 74
@@ -93,7 +97,11 @@ do { \
93 __preempt_schedule_context(); \ 97 __preempt_schedule_context(); \
94} while (0) 98} while (0)
95#else 99#else
96#define preempt_enable_notrace() preempt_enable_no_resched_notrace() 100#define preempt_enable_notrace() \
101do { \
102 barrier(); \
103 __preempt_count_dec(); \
104} while (0)
97#endif 105#endif
98 106
99#else /* !CONFIG_PREEMPT_COUNT */ 107#else /* !CONFIG_PREEMPT_COUNT */
@@ -116,6 +124,31 @@ do { \
116 124
117#endif /* CONFIG_PREEMPT_COUNT */ 125#endif /* CONFIG_PREEMPT_COUNT */
118 126
127#ifdef MODULE
128/*
129 * Modules have no business playing preemption tricks.
130 */
131#undef sched_preempt_enable_no_resched
132#undef preempt_enable_no_resched
133#undef preempt_enable_no_resched_notrace
134#undef preempt_check_resched
135#endif
136
137#ifdef CONFIG_PREEMPT
138#define preempt_set_need_resched() \
139do { \
140 set_preempt_need_resched(); \
141} while (0)
142#define preempt_fold_need_resched() \
143do { \
144 if (tif_need_resched()) \
145 set_preempt_need_resched(); \
146} while (0)
147#else
148#define preempt_set_need_resched() do { } while (0)
149#define preempt_fold_need_resched() do { } while (0)
150#endif
151
119#ifdef CONFIG_PREEMPT_NOTIFIERS 152#ifdef CONFIG_PREEMPT_NOTIFIERS
120 153
121struct preempt_notifier; 154struct preempt_notifier;
diff --git a/include/linux/preempt_mask.h b/include/linux/preempt_mask.h
index d169820203dd..dbeec4d4a3be 100644
--- a/include/linux/preempt_mask.h
+++ b/include/linux/preempt_mask.h
@@ -2,7 +2,6 @@
2#define LINUX_PREEMPT_MASK_H 2#define LINUX_PREEMPT_MASK_H
3 3
4#include <linux/preempt.h> 4#include <linux/preempt.h>
5#include <asm/hardirq.h>
6 5
7/* 6/*
8 * We put the hardirq and softirq counter into the preemption 7 * We put the hardirq and softirq counter into the preemption
@@ -79,6 +78,21 @@
79#endif 78#endif
80 79
81/* 80/*
81 * The preempt_count offset needed for things like:
82 *
83 * spin_lock_bh()
84 *
85 * Which need to disable both preemption (CONFIG_PREEMPT_COUNT) and
86 * softirqs, such that unlock sequences of:
87 *
88 * spin_unlock();
89 * local_bh_enable();
90 *
91 * Work as expected.
92 */
93#define SOFTIRQ_LOCK_OFFSET (SOFTIRQ_DISABLE_OFFSET + PREEMPT_CHECK_OFFSET)
94
95/*
82 * Are we running in atomic context? WARNING: this macro cannot 96 * Are we running in atomic context? WARNING: this macro cannot
83 * always detect atomic context; in particular, it cannot know about 97 * always detect atomic context; in particular, it cannot know about
84 * held spinlocks in non-preemptible kernels. Thus it should not be 98 * held spinlocks in non-preemptible kernels. Thus it should not be
diff --git a/include/linux/rculist.h b/include/linux/rculist.h
index 45a0a9e81478..dbaf99084112 100644
--- a/include/linux/rculist.h
+++ b/include/linux/rculist.h
@@ -55,8 +55,8 @@ static inline void __list_add_rcu(struct list_head *new,
55 next->prev = new; 55 next->prev = new;
56} 56}
57#else 57#else
58extern void __list_add_rcu(struct list_head *new, 58void __list_add_rcu(struct list_head *new,
59 struct list_head *prev, struct list_head *next); 59 struct list_head *prev, struct list_head *next);
60#endif 60#endif
61 61
62/** 62/**
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index 39cbb889e20d..3e355c688618 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -50,13 +50,13 @@ extern int rcutorture_runnable; /* for sysctl */
50#endif /* #ifdef CONFIG_RCU_TORTURE_TEST */ 50#endif /* #ifdef CONFIG_RCU_TORTURE_TEST */
51 51
52#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU) 52#if defined(CONFIG_TREE_RCU) || defined(CONFIG_TREE_PREEMPT_RCU)
53extern void rcutorture_record_test_transition(void); 53void rcutorture_record_test_transition(void);
54extern void rcutorture_record_progress(unsigned long vernum); 54void rcutorture_record_progress(unsigned long vernum);
55extern void do_trace_rcu_torture_read(const char *rcutorturename, 55void do_trace_rcu_torture_read(const char *rcutorturename,
56 struct rcu_head *rhp, 56 struct rcu_head *rhp,
57 unsigned long secs, 57 unsigned long secs,
58 unsigned long c_old, 58 unsigned long c_old,
59 unsigned long c); 59 unsigned long c);
60#else 60#else
61static inline void rcutorture_record_test_transition(void) 61static inline void rcutorture_record_test_transition(void)
62{ 62{
@@ -65,11 +65,11 @@ static inline void rcutorture_record_progress(unsigned long vernum)
65{ 65{
66} 66}
67#ifdef CONFIG_RCU_TRACE 67#ifdef CONFIG_RCU_TRACE
68extern void do_trace_rcu_torture_read(const char *rcutorturename, 68void do_trace_rcu_torture_read(const char *rcutorturename,
69 struct rcu_head *rhp, 69 struct rcu_head *rhp,
70 unsigned long secs, 70 unsigned long secs,
71 unsigned long c_old, 71 unsigned long c_old,
72 unsigned long c); 72 unsigned long c);
73#else 73#else
74#define do_trace_rcu_torture_read(rcutorturename, rhp, secs, c_old, c) \ 74#define do_trace_rcu_torture_read(rcutorturename, rhp, secs, c_old, c) \
75 do { } while (0) 75 do { } while (0)
@@ -118,8 +118,8 @@ extern void do_trace_rcu_torture_read(const char *rcutorturename,
118 * if CPU A and CPU B are the same CPU (but again only if the system has 118 * if CPU A and CPU B are the same CPU (but again only if the system has
119 * more than one CPU). 119 * more than one CPU).
120 */ 120 */
121extern void call_rcu(struct rcu_head *head, 121void call_rcu(struct rcu_head *head,
122 void (*func)(struct rcu_head *head)); 122 void (*func)(struct rcu_head *head));
123 123
124#else /* #ifdef CONFIG_PREEMPT_RCU */ 124#else /* #ifdef CONFIG_PREEMPT_RCU */
125 125
@@ -149,8 +149,8 @@ extern void call_rcu(struct rcu_head *head,
149 * See the description of call_rcu() for more detailed information on 149 * See the description of call_rcu() for more detailed information on
150 * memory ordering guarantees. 150 * memory ordering guarantees.
151 */ 151 */
152extern void call_rcu_bh(struct rcu_head *head, 152void call_rcu_bh(struct rcu_head *head,
153 void (*func)(struct rcu_head *head)); 153 void (*func)(struct rcu_head *head));
154 154
155/** 155/**
156 * call_rcu_sched() - Queue an RCU for invocation after sched grace period. 156 * call_rcu_sched() - Queue an RCU for invocation after sched grace period.
@@ -171,16 +171,16 @@ extern void call_rcu_bh(struct rcu_head *head,
171 * See the description of call_rcu() for more detailed information on 171 * See the description of call_rcu() for more detailed information on
172 * memory ordering guarantees. 172 * memory ordering guarantees.
173 */ 173 */
174extern void call_rcu_sched(struct rcu_head *head, 174void call_rcu_sched(struct rcu_head *head,
175 void (*func)(struct rcu_head *rcu)); 175 void (*func)(struct rcu_head *rcu));
176 176
177extern void synchronize_sched(void); 177void synchronize_sched(void);
178 178
179#ifdef CONFIG_PREEMPT_RCU 179#ifdef CONFIG_PREEMPT_RCU
180 180
181extern void __rcu_read_lock(void); 181void __rcu_read_lock(void);
182extern void __rcu_read_unlock(void); 182void __rcu_read_unlock(void);
183extern void rcu_read_unlock_special(struct task_struct *t); 183void rcu_read_unlock_special(struct task_struct *t);
184void synchronize_rcu(void); 184void synchronize_rcu(void);
185 185
186/* 186/*
@@ -216,19 +216,19 @@ static inline int rcu_preempt_depth(void)
216#endif /* #else #ifdef CONFIG_PREEMPT_RCU */ 216#endif /* #else #ifdef CONFIG_PREEMPT_RCU */
217 217
218/* Internal to kernel */ 218/* Internal to kernel */
219extern void rcu_init(void); 219void rcu_init(void);
220extern void rcu_sched_qs(int cpu); 220void rcu_sched_qs(int cpu);
221extern void rcu_bh_qs(int cpu); 221void rcu_bh_qs(int cpu);
222extern void rcu_check_callbacks(int cpu, int user); 222void rcu_check_callbacks(int cpu, int user);
223struct notifier_block; 223struct notifier_block;
224extern void rcu_idle_enter(void); 224void rcu_idle_enter(void);
225extern void rcu_idle_exit(void); 225void rcu_idle_exit(void);
226extern void rcu_irq_enter(void); 226void rcu_irq_enter(void);
227extern void rcu_irq_exit(void); 227void rcu_irq_exit(void);
228 228
229#ifdef CONFIG_RCU_USER_QS 229#ifdef CONFIG_RCU_USER_QS
230extern void rcu_user_enter(void); 230void rcu_user_enter(void);
231extern void rcu_user_exit(void); 231void rcu_user_exit(void);
232#else 232#else
233static inline void rcu_user_enter(void) { } 233static inline void rcu_user_enter(void) { }
234static inline void rcu_user_exit(void) { } 234static inline void rcu_user_exit(void) { }
@@ -262,7 +262,7 @@ static inline void rcu_user_hooks_switch(struct task_struct *prev,
262 } while (0) 262 } while (0)
263 263
264#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) 264#if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP)
265extern bool __rcu_is_watching(void); 265bool __rcu_is_watching(void);
266#endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) */ 266#endif /* #if defined(CONFIG_DEBUG_LOCK_ALLOC) || defined(CONFIG_RCU_TRACE) || defined(CONFIG_SMP) */
267 267
268/* 268/*
@@ -289,8 +289,8 @@ void wait_rcu_gp(call_rcu_func_t crf);
289 * initialization. 289 * initialization.
290 */ 290 */
291#ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD 291#ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD
292extern void init_rcu_head_on_stack(struct rcu_head *head); 292void init_rcu_head_on_stack(struct rcu_head *head);
293extern void destroy_rcu_head_on_stack(struct rcu_head *head); 293void destroy_rcu_head_on_stack(struct rcu_head *head);
294#else /* !CONFIG_DEBUG_OBJECTS_RCU_HEAD */ 294#else /* !CONFIG_DEBUG_OBJECTS_RCU_HEAD */
295static inline void init_rcu_head_on_stack(struct rcu_head *head) 295static inline void init_rcu_head_on_stack(struct rcu_head *head)
296{ 296{
@@ -325,6 +325,7 @@ static inline void rcu_lock_release(struct lockdep_map *map)
325extern struct lockdep_map rcu_lock_map; 325extern struct lockdep_map rcu_lock_map;
326extern struct lockdep_map rcu_bh_lock_map; 326extern struct lockdep_map rcu_bh_lock_map;
327extern struct lockdep_map rcu_sched_lock_map; 327extern struct lockdep_map rcu_sched_lock_map;
328extern struct lockdep_map rcu_callback_map;
328extern int debug_lockdep_rcu_enabled(void); 329extern int debug_lockdep_rcu_enabled(void);
329 330
330/** 331/**
@@ -362,7 +363,7 @@ static inline int rcu_read_lock_held(void)
362 * rcu_read_lock_bh_held() is defined out of line to avoid #include-file 363 * rcu_read_lock_bh_held() is defined out of line to avoid #include-file
363 * hell. 364 * hell.
364 */ 365 */
365extern int rcu_read_lock_bh_held(void); 366int rcu_read_lock_bh_held(void);
366 367
367/** 368/**
368 * rcu_read_lock_sched_held() - might we be in RCU-sched read-side critical section? 369 * rcu_read_lock_sched_held() - might we be in RCU-sched read-side critical section?
@@ -448,7 +449,7 @@ static inline int rcu_read_lock_sched_held(void)
448 449
449#ifdef CONFIG_PROVE_RCU 450#ifdef CONFIG_PROVE_RCU
450 451
451extern int rcu_my_thread_group_empty(void); 452int rcu_my_thread_group_empty(void);
452 453
453/** 454/**
454 * rcu_lockdep_assert - emit lockdep splat if specified condition not met 455 * rcu_lockdep_assert - emit lockdep splat if specified condition not met
@@ -548,10 +549,48 @@ static inline void rcu_preempt_sleep_check(void)
548 smp_read_barrier_depends(); \ 549 smp_read_barrier_depends(); \
549 (_________p1); \ 550 (_________p1); \
550 }) 551 })
551#define __rcu_assign_pointer(p, v, space) \ 552
553/**
554 * RCU_INITIALIZER() - statically initialize an RCU-protected global variable
555 * @v: The value to statically initialize with.
556 */
557#define RCU_INITIALIZER(v) (typeof(*(v)) __force __rcu *)(v)
558
559/**
560 * rcu_assign_pointer() - assign to RCU-protected pointer
561 * @p: pointer to assign to
562 * @v: value to assign (publish)
563 *
564 * Assigns the specified value to the specified RCU-protected
565 * pointer, ensuring that any concurrent RCU readers will see
566 * any prior initialization.
567 *
568 * Inserts memory barriers on architectures that require them
569 * (which is most of them), and also prevents the compiler from
570 * reordering the code that initializes the structure after the pointer
571 * assignment. More importantly, this call documents which pointers
572 * will be dereferenced by RCU read-side code.
573 *
574 * In some special cases, you may use RCU_INIT_POINTER() instead
575 * of rcu_assign_pointer(). RCU_INIT_POINTER() is a bit faster due
576 * to the fact that it does not constrain either the CPU or the compiler.
577 * That said, using RCU_INIT_POINTER() when you should have used
578 * rcu_assign_pointer() is a very bad thing that results in
579 * impossible-to-diagnose memory corruption. So please be careful.
580 * See the RCU_INIT_POINTER() comment header for details.
581 *
582 * Note that rcu_assign_pointer() evaluates each of its arguments only
583 * once, appearances notwithstanding. One of the "extra" evaluations
584 * is in typeof() and the other visible only to sparse (__CHECKER__),
585 * neither of which actually execute the argument. As with most cpp
586 * macros, this execute-arguments-only-once property is important, so
587 * please be careful when making changes to rcu_assign_pointer() and the
588 * other macros that it invokes.
589 */
590#define rcu_assign_pointer(p, v) \
552 do { \ 591 do { \
553 smp_wmb(); \ 592 smp_wmb(); \
554 (p) = (typeof(*v) __force space *)(v); \ 593 ACCESS_ONCE(p) = RCU_INITIALIZER(v); \
555 } while (0) 594 } while (0)
556 595
557 596
@@ -890,32 +929,6 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
890} 929}
891 930
892/** 931/**
893 * rcu_assign_pointer() - assign to RCU-protected pointer
894 * @p: pointer to assign to
895 * @v: value to assign (publish)
896 *
897 * Assigns the specified value to the specified RCU-protected
898 * pointer, ensuring that any concurrent RCU readers will see
899 * any prior initialization.
900 *
901 * Inserts memory barriers on architectures that require them
902 * (which is most of them), and also prevents the compiler from
903 * reordering the code that initializes the structure after the pointer
904 * assignment. More importantly, this call documents which pointers
905 * will be dereferenced by RCU read-side code.
906 *
907 * In some special cases, you may use RCU_INIT_POINTER() instead
908 * of rcu_assign_pointer(). RCU_INIT_POINTER() is a bit faster due
909 * to the fact that it does not constrain either the CPU or the compiler.
910 * That said, using RCU_INIT_POINTER() when you should have used
911 * rcu_assign_pointer() is a very bad thing that results in
912 * impossible-to-diagnose memory corruption. So please be careful.
913 * See the RCU_INIT_POINTER() comment header for details.
914 */
915#define rcu_assign_pointer(p, v) \
916 __rcu_assign_pointer((p), (v), __rcu)
917
918/**
919 * RCU_INIT_POINTER() - initialize an RCU protected pointer 932 * RCU_INIT_POINTER() - initialize an RCU protected pointer
920 * 933 *
921 * Initialize an RCU-protected pointer in special cases where readers 934 * Initialize an RCU-protected pointer in special cases where readers
@@ -949,7 +962,7 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
949 */ 962 */
950#define RCU_INIT_POINTER(p, v) \ 963#define RCU_INIT_POINTER(p, v) \
951 do { \ 964 do { \
952 p = (typeof(*v) __force __rcu *)(v); \ 965 p = RCU_INITIALIZER(v); \
953 } while (0) 966 } while (0)
954 967
955/** 968/**
@@ -958,7 +971,7 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
958 * GCC-style initialization for an RCU-protected pointer in a structure field. 971 * GCC-style initialization for an RCU-protected pointer in a structure field.
959 */ 972 */
960#define RCU_POINTER_INITIALIZER(p, v) \ 973#define RCU_POINTER_INITIALIZER(p, v) \
961 .p = (typeof(*v) __force __rcu *)(v) 974 .p = RCU_INITIALIZER(v)
962 975
963/* 976/*
964 * Does the specified offset indicate that the corresponding rcu_head 977 * Does the specified offset indicate that the corresponding rcu_head
@@ -1005,7 +1018,7 @@ static inline notrace void rcu_read_unlock_sched_notrace(void)
1005 __kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head)) 1018 __kfree_rcu(&((ptr)->rcu_head), offsetof(typeof(*(ptr)), rcu_head))
1006 1019
1007#ifdef CONFIG_RCU_NOCB_CPU 1020#ifdef CONFIG_RCU_NOCB_CPU
1008extern bool rcu_is_nocb_cpu(int cpu); 1021bool rcu_is_nocb_cpu(int cpu);
1009#else 1022#else
1010static inline bool rcu_is_nocb_cpu(int cpu) { return false; } 1023static inline bool rcu_is_nocb_cpu(int cpu) { return false; }
1011#endif /* #else #ifdef CONFIG_RCU_NOCB_CPU */ 1024#endif /* #else #ifdef CONFIG_RCU_NOCB_CPU */
@@ -1013,8 +1026,8 @@ static inline bool rcu_is_nocb_cpu(int cpu) { return false; }
1013 1026
1014/* Only for use by adaptive-ticks code. */ 1027/* Only for use by adaptive-ticks code. */
1015#ifdef CONFIG_NO_HZ_FULL_SYSIDLE 1028#ifdef CONFIG_NO_HZ_FULL_SYSIDLE
1016extern bool rcu_sys_is_idle(void); 1029bool rcu_sys_is_idle(void);
1017extern void rcu_sysidle_force_exit(void); 1030void rcu_sysidle_force_exit(void);
1018#else /* #ifdef CONFIG_NO_HZ_FULL_SYSIDLE */ 1031#else /* #ifdef CONFIG_NO_HZ_FULL_SYSIDLE */
1019 1032
1020static inline bool rcu_sys_is_idle(void) 1033static inline bool rcu_sys_is_idle(void)
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h
index 09ebcbe9fd78..6f01771b571c 100644
--- a/include/linux/rcutiny.h
+++ b/include/linux/rcutiny.h
@@ -125,7 +125,7 @@ static inline void exit_rcu(void)
125 125
126#ifdef CONFIG_DEBUG_LOCK_ALLOC 126#ifdef CONFIG_DEBUG_LOCK_ALLOC
127extern int rcu_scheduler_active __read_mostly; 127extern int rcu_scheduler_active __read_mostly;
128extern void rcu_scheduler_starting(void); 128void rcu_scheduler_starting(void);
129#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */ 129#else /* #ifdef CONFIG_DEBUG_LOCK_ALLOC */
130static inline void rcu_scheduler_starting(void) 130static inline void rcu_scheduler_starting(void)
131{ 131{
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h
index 4b9c81548742..72137ee8c603 100644
--- a/include/linux/rcutree.h
+++ b/include/linux/rcutree.h
@@ -30,9 +30,9 @@
30#ifndef __LINUX_RCUTREE_H 30#ifndef __LINUX_RCUTREE_H
31#define __LINUX_RCUTREE_H 31#define __LINUX_RCUTREE_H
32 32
33extern void rcu_note_context_switch(int cpu); 33void rcu_note_context_switch(int cpu);
34extern int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies); 34int rcu_needs_cpu(int cpu, unsigned long *delta_jiffies);
35extern void rcu_cpu_stall_reset(void); 35void rcu_cpu_stall_reset(void);
36 36
37/* 37/*
38 * Note a virtualization-based context switch. This is simply a 38 * Note a virtualization-based context switch. This is simply a
@@ -44,9 +44,9 @@ static inline void rcu_virt_note_context_switch(int cpu)
44 rcu_note_context_switch(cpu); 44 rcu_note_context_switch(cpu);
45} 45}
46 46
47extern void synchronize_rcu_bh(void); 47void synchronize_rcu_bh(void);
48extern void synchronize_sched_expedited(void); 48void synchronize_sched_expedited(void);
49extern void synchronize_rcu_expedited(void); 49void synchronize_rcu_expedited(void);
50 50
51void kfree_call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu)); 51void kfree_call_rcu(struct rcu_head *head, void (*func)(struct rcu_head *rcu));
52 52
@@ -71,25 +71,25 @@ static inline void synchronize_rcu_bh_expedited(void)
71 synchronize_sched_expedited(); 71 synchronize_sched_expedited();
72} 72}
73 73
74extern void rcu_barrier(void); 74void rcu_barrier(void);
75extern void rcu_barrier_bh(void); 75void rcu_barrier_bh(void);
76extern void rcu_barrier_sched(void); 76void rcu_barrier_sched(void);
77 77
78extern unsigned long rcutorture_testseq; 78extern unsigned long rcutorture_testseq;
79extern unsigned long rcutorture_vernum; 79extern unsigned long rcutorture_vernum;
80extern long rcu_batches_completed(void); 80long rcu_batches_completed(void);
81extern long rcu_batches_completed_bh(void); 81long rcu_batches_completed_bh(void);
82extern long rcu_batches_completed_sched(void); 82long rcu_batches_completed_sched(void);
83 83
84extern void rcu_force_quiescent_state(void); 84void rcu_force_quiescent_state(void);
85extern void rcu_bh_force_quiescent_state(void); 85void rcu_bh_force_quiescent_state(void);
86extern void rcu_sched_force_quiescent_state(void); 86void rcu_sched_force_quiescent_state(void);
87 87
88extern void exit_rcu(void); 88void exit_rcu(void);
89 89
90extern void rcu_scheduler_starting(void); 90void 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); 93bool rcu_is_watching(void);
94 94
95#endif /* __LINUX_RCUTREE_H */ 95#endif /* __LINUX_RCUTREE_H */
diff --git a/include/linux/rtmutex.h b/include/linux/rtmutex.h
index de17134244f3..3aed8d737e1a 100644
--- a/include/linux/rtmutex.h
+++ b/include/linux/rtmutex.h
@@ -13,7 +13,7 @@
13#define __LINUX_RT_MUTEX_H 13#define __LINUX_RT_MUTEX_H
14 14
15#include <linux/linkage.h> 15#include <linux/linkage.h>
16#include <linux/plist.h> 16#include <linux/rbtree.h>
17#include <linux/spinlock_types.h> 17#include <linux/spinlock_types.h>
18 18
19extern int max_lock_depth; /* for sysctl */ 19extern int max_lock_depth; /* for sysctl */
@@ -22,12 +22,14 @@ extern int max_lock_depth; /* for sysctl */
22 * The rt_mutex structure 22 * The rt_mutex structure
23 * 23 *
24 * @wait_lock: spinlock to protect the structure 24 * @wait_lock: spinlock to protect the structure
25 * @wait_list: pilist head to enqueue waiters in priority order 25 * @waiters: rbtree root to enqueue waiters in priority order
26 * @waiters_leftmost: top waiter
26 * @owner: the mutex owner 27 * @owner: the mutex owner
27 */ 28 */
28struct rt_mutex { 29struct rt_mutex {
29 raw_spinlock_t wait_lock; 30 raw_spinlock_t wait_lock;
30 struct plist_head wait_list; 31 struct rb_root waiters;
32 struct rb_node *waiters_leftmost;
31 struct task_struct *owner; 33 struct task_struct *owner;
32#ifdef CONFIG_DEBUG_RT_MUTEXES 34#ifdef CONFIG_DEBUG_RT_MUTEXES
33 int save_state; 35 int save_state;
@@ -66,7 +68,7 @@ struct hrtimer_sleeper;
66 68
67#define __RT_MUTEX_INITIALIZER(mutexname) \ 69#define __RT_MUTEX_INITIALIZER(mutexname) \
68 { .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(mutexname.wait_lock) \ 70 { .wait_lock = __RAW_SPIN_LOCK_UNLOCKED(mutexname.wait_lock) \
69 , .wait_list = PLIST_HEAD_INIT(mutexname.wait_list) \ 71 , .waiters = RB_ROOT \
70 , .owner = NULL \ 72 , .owner = NULL \
71 __DEBUG_RT_MUTEX_INITIALIZER(mutexname)} 73 __DEBUG_RT_MUTEX_INITIALIZER(mutexname)}
72 74
@@ -98,12 +100,4 @@ extern int rt_mutex_trylock(struct rt_mutex *lock);
98 100
99extern void rt_mutex_unlock(struct rt_mutex *lock); 101extern void rt_mutex_unlock(struct rt_mutex *lock);
100 102
101#ifdef CONFIG_RT_MUTEXES
102# define INIT_RT_MUTEXES(tsk) \
103 .pi_waiters = PLIST_HEAD_INIT(tsk.pi_waiters), \
104 INIT_RT_MUTEX_DEBUG(tsk)
105#else
106# define INIT_RT_MUTEXES(tsk)
107#endif
108
109#endif 103#endif
diff --git a/include/linux/rwlock_api_smp.h b/include/linux/rwlock_api_smp.h
index 9c9f0495d37c..5b9b84b20407 100644
--- a/include/linux/rwlock_api_smp.h
+++ b/include/linux/rwlock_api_smp.h
@@ -172,8 +172,7 @@ static inline void __raw_read_lock_irq(rwlock_t *lock)
172 172
173static inline void __raw_read_lock_bh(rwlock_t *lock) 173static inline void __raw_read_lock_bh(rwlock_t *lock)
174{ 174{
175 local_bh_disable(); 175 __local_bh_disable_ip(_RET_IP_, SOFTIRQ_LOCK_OFFSET);
176 preempt_disable();
177 rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_); 176 rwlock_acquire_read(&lock->dep_map, 0, 0, _RET_IP_);
178 LOCK_CONTENDED(lock, do_raw_read_trylock, do_raw_read_lock); 177 LOCK_CONTENDED(lock, do_raw_read_trylock, do_raw_read_lock);
179} 178}
@@ -200,8 +199,7 @@ static inline void __raw_write_lock_irq(rwlock_t *lock)
200 199
201static inline void __raw_write_lock_bh(rwlock_t *lock) 200static inline void __raw_write_lock_bh(rwlock_t *lock)
202{ 201{
203 local_bh_disable(); 202 __local_bh_disable_ip(_RET_IP_, SOFTIRQ_LOCK_OFFSET);
204 preempt_disable();
205 rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_); 203 rwlock_acquire(&lock->dep_map, 0, 0, _RET_IP_);
206 LOCK_CONTENDED(lock, do_raw_write_trylock, do_raw_write_lock); 204 LOCK_CONTENDED(lock, do_raw_write_trylock, do_raw_write_lock);
207} 205}
@@ -250,8 +248,7 @@ static inline void __raw_read_unlock_bh(rwlock_t *lock)
250{ 248{
251 rwlock_release(&lock->dep_map, 1, _RET_IP_); 249 rwlock_release(&lock->dep_map, 1, _RET_IP_);
252 do_raw_read_unlock(lock); 250 do_raw_read_unlock(lock);
253 preempt_enable_no_resched(); 251 __local_bh_enable_ip(_RET_IP_, SOFTIRQ_LOCK_OFFSET);
254 local_bh_enable_ip((unsigned long)__builtin_return_address(0));
255} 252}
256 253
257static inline void __raw_write_unlock_irqrestore(rwlock_t *lock, 254static inline void __raw_write_unlock_irqrestore(rwlock_t *lock,
@@ -275,8 +272,7 @@ static inline void __raw_write_unlock_bh(rwlock_t *lock)
275{ 272{
276 rwlock_release(&lock->dep_map, 1, _RET_IP_); 273 rwlock_release(&lock->dep_map, 1, _RET_IP_);
277 do_raw_write_unlock(lock); 274 do_raw_write_unlock(lock);
278 preempt_enable_no_resched(); 275 __local_bh_enable_ip(_RET_IP_, SOFTIRQ_LOCK_OFFSET);
279 local_bh_enable_ip((unsigned long)__builtin_return_address(0));
280} 276}
281 277
282#endif /* __LINUX_RWLOCK_API_SMP_H */ 278#endif /* __LINUX_RWLOCK_API_SMP_H */
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index adae88f5b0ab..a964f7285600 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -345,6 +345,7 @@ struct sg_mapping_iter {
345 345
346void sg_miter_start(struct sg_mapping_iter *miter, struct scatterlist *sgl, 346void sg_miter_start(struct sg_mapping_iter *miter, struct scatterlist *sgl,
347 unsigned int nents, unsigned int flags); 347 unsigned int nents, unsigned int flags);
348bool sg_miter_skip(struct sg_mapping_iter *miter, off_t offset);
348bool sg_miter_next(struct sg_mapping_iter *miter); 349bool sg_miter_next(struct sg_mapping_iter *miter);
349void sg_miter_stop(struct sg_mapping_iter *miter); 350void sg_miter_stop(struct sg_mapping_iter *miter);
350 351
diff --git a/include/linux/sched.h b/include/linux/sched.h
index 53f97eb8dbc7..ffccdad050b5 100644
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -16,6 +16,7 @@ struct sched_param {
16#include <linux/types.h> 16#include <linux/types.h>
17#include <linux/timex.h> 17#include <linux/timex.h>
18#include <linux/jiffies.h> 18#include <linux/jiffies.h>
19#include <linux/plist.h>
19#include <linux/rbtree.h> 20#include <linux/rbtree.h>
20#include <linux/thread_info.h> 21#include <linux/thread_info.h>
21#include <linux/cpumask.h> 22#include <linux/cpumask.h>
@@ -56,6 +57,70 @@ struct sched_param {
56 57
57#include <asm/processor.h> 58#include <asm/processor.h>
58 59
60#define SCHED_ATTR_SIZE_VER0 48 /* sizeof first published struct */
61
62/*
63 * Extended scheduling parameters data structure.
64 *
65 * This is needed because the original struct sched_param can not be
66 * altered without introducing ABI issues with legacy applications
67 * (e.g., in sched_getparam()).
68 *
69 * However, the possibility of specifying more than just a priority for
70 * the tasks may be useful for a wide variety of application fields, e.g.,
71 * multimedia, streaming, automation and control, and many others.
72 *
73 * This variant (sched_attr) is meant at describing a so-called
74 * sporadic time-constrained task. In such model a task is specified by:
75 * - the activation period or minimum instance inter-arrival time;
76 * - the maximum (or average, depending on the actual scheduling
77 * discipline) computation time of all instances, a.k.a. runtime;
78 * - the deadline (relative to the actual activation time) of each
79 * instance.
80 * Very briefly, a periodic (sporadic) task asks for the execution of
81 * some specific computation --which is typically called an instance--
82 * (at most) every period. Moreover, each instance typically lasts no more
83 * than the runtime and must be completed by time instant t equal to
84 * the instance activation time + the deadline.
85 *
86 * This is reflected by the actual fields of the sched_attr structure:
87 *
88 * @size size of the structure, for fwd/bwd compat.
89 *
90 * @sched_policy task's scheduling policy
91 * @sched_flags for customizing the scheduler behaviour
92 * @sched_nice task's nice value (SCHED_NORMAL/BATCH)
93 * @sched_priority task's static priority (SCHED_FIFO/RR)
94 * @sched_deadline representative of the task's deadline
95 * @sched_runtime representative of the task's runtime
96 * @sched_period representative of the task's period
97 *
98 * Given this task model, there are a multiplicity of scheduling algorithms
99 * and policies, that can be used to ensure all the tasks will make their
100 * timing constraints.
101 *
102 * As of now, the SCHED_DEADLINE policy (sched_dl scheduling class) is the
103 * only user of this new interface. More information about the algorithm
104 * available in the scheduling class file or in Documentation/.
105 */
106struct sched_attr {
107 u32 size;
108
109 u32 sched_policy;
110 u64 sched_flags;
111
112 /* SCHED_NORMAL, SCHED_BATCH */
113 s32 sched_nice;
114
115 /* SCHED_FIFO, SCHED_RR */
116 u32 sched_priority;
117
118 /* SCHED_DEADLINE */
119 u64 sched_runtime;
120 u64 sched_deadline;
121 u64 sched_period;
122};
123
59struct exec_domain; 124struct exec_domain;
60struct futex_pi_state; 125struct futex_pi_state;
61struct robust_list_head; 126struct robust_list_head;
@@ -168,7 +233,6 @@ extern char ___assert_task_state[1 - 2*!!(
168 233
169#define task_is_traced(task) ((task->state & __TASK_TRACED) != 0) 234#define task_is_traced(task) ((task->state & __TASK_TRACED) != 0)
170#define task_is_stopped(task) ((task->state & __TASK_STOPPED) != 0) 235#define task_is_stopped(task) ((task->state & __TASK_STOPPED) != 0)
171#define task_is_dead(task) ((task)->exit_state != 0)
172#define task_is_stopped_or_traced(task) \ 236#define task_is_stopped_or_traced(task) \
173 ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0) 237 ((task->state & (__TASK_STOPPED | __TASK_TRACED)) != 0)
174#define task_contributes_to_load(task) \ 238#define task_contributes_to_load(task) \
@@ -1029,6 +1093,51 @@ struct sched_rt_entity {
1029#endif 1093#endif
1030}; 1094};
1031 1095
1096struct sched_dl_entity {
1097 struct rb_node rb_node;
1098
1099 /*
1100 * Original scheduling parameters. Copied here from sched_attr
1101 * during sched_setscheduler2(), they will remain the same until
1102 * the next sched_setscheduler2().
1103 */
1104 u64 dl_runtime; /* maximum runtime for each instance */
1105 u64 dl_deadline; /* relative deadline of each instance */
1106 u64 dl_period; /* separation of two instances (period) */
1107 u64 dl_bw; /* dl_runtime / dl_deadline */
1108
1109 /*
1110 * Actual scheduling parameters. Initialized with the values above,
1111 * they are continously updated during task execution. Note that
1112 * the remaining runtime could be < 0 in case we are in overrun.
1113 */
1114 s64 runtime; /* remaining runtime for this instance */
1115 u64 deadline; /* absolute deadline for this instance */
1116 unsigned int flags; /* specifying the scheduler behaviour */
1117
1118 /*
1119 * Some bool flags:
1120 *
1121 * @dl_throttled tells if we exhausted the runtime. If so, the
1122 * task has to wait for a replenishment to be performed at the
1123 * next firing of dl_timer.
1124 *
1125 * @dl_new tells if a new instance arrived. If so we must
1126 * start executing it with full runtime and reset its absolute
1127 * deadline;
1128 *
1129 * @dl_boosted tells if we are boosted due to DI. If so we are
1130 * outside bandwidth enforcement mechanism (but only until we
1131 * exit the critical section).
1132 */
1133 int dl_throttled, dl_new, dl_boosted;
1134
1135 /*
1136 * Bandwidth enforcement timer. Each -deadline task has its
1137 * own bandwidth to be enforced, thus we need one timer per task.
1138 */
1139 struct hrtimer dl_timer;
1140};
1032 1141
1033struct rcu_node; 1142struct rcu_node;
1034 1143
@@ -1065,6 +1174,7 @@ struct task_struct {
1065#ifdef CONFIG_CGROUP_SCHED 1174#ifdef CONFIG_CGROUP_SCHED
1066 struct task_group *sched_task_group; 1175 struct task_group *sched_task_group;
1067#endif 1176#endif
1177 struct sched_dl_entity dl;
1068 1178
1069#ifdef CONFIG_PREEMPT_NOTIFIERS 1179#ifdef CONFIG_PREEMPT_NOTIFIERS
1070 /* list of struct preempt_notifier: */ 1180 /* list of struct preempt_notifier: */
@@ -1098,6 +1208,7 @@ struct task_struct {
1098 struct list_head tasks; 1208 struct list_head tasks;
1099#ifdef CONFIG_SMP 1209#ifdef CONFIG_SMP
1100 struct plist_node pushable_tasks; 1210 struct plist_node pushable_tasks;
1211 struct rb_node pushable_dl_tasks;
1101#endif 1212#endif
1102 1213
1103 struct mm_struct *mm, *active_mm; 1214 struct mm_struct *mm, *active_mm;
@@ -1249,9 +1360,12 @@ struct task_struct {
1249 1360
1250#ifdef CONFIG_RT_MUTEXES 1361#ifdef CONFIG_RT_MUTEXES
1251 /* PI waiters blocked on a rt_mutex held by this task */ 1362 /* PI waiters blocked on a rt_mutex held by this task */
1252 struct plist_head pi_waiters; 1363 struct rb_root pi_waiters;
1364 struct rb_node *pi_waiters_leftmost;
1253 /* Deadlock detection and priority inheritance handling */ 1365 /* Deadlock detection and priority inheritance handling */
1254 struct rt_mutex_waiter *pi_blocked_on; 1366 struct rt_mutex_waiter *pi_blocked_on;
1367 /* Top pi_waiters task */
1368 struct task_struct *pi_top_task;
1255#endif 1369#endif
1256 1370
1257#ifdef CONFIG_DEBUG_MUTEXES 1371#ifdef CONFIG_DEBUG_MUTEXES
@@ -1880,7 +1994,9 @@ static inline void sched_clock_idle_wakeup_event(u64 delta_ns)
1880 * but then during bootup it turns out that sched_clock() 1994 * but then during bootup it turns out that sched_clock()
1881 * is reliable after all: 1995 * is reliable after all:
1882 */ 1996 */
1883extern int sched_clock_stable; 1997extern int sched_clock_stable(void);
1998extern void set_sched_clock_stable(void);
1999extern void clear_sched_clock_stable(void);
1884 2000
1885extern void sched_clock_tick(void); 2001extern void sched_clock_tick(void);
1886extern void sched_clock_idle_sleep_event(void); 2002extern void sched_clock_idle_sleep_event(void);
@@ -1959,6 +2075,8 @@ extern int sched_setscheduler(struct task_struct *, int,
1959 const struct sched_param *); 2075 const struct sched_param *);
1960extern int sched_setscheduler_nocheck(struct task_struct *, int, 2076extern int sched_setscheduler_nocheck(struct task_struct *, int,
1961 const struct sched_param *); 2077 const struct sched_param *);
2078extern int sched_setattr(struct task_struct *,
2079 const struct sched_attr *);
1962extern struct task_struct *idle_task(int cpu); 2080extern struct task_struct *idle_task(int cpu);
1963/** 2081/**
1964 * is_idle_task - is the specified task an idle task? 2082 * is_idle_task - is the specified task an idle task?
@@ -2038,7 +2156,7 @@ extern void wake_up_new_task(struct task_struct *tsk);
2038#else 2156#else
2039 static inline void kick_process(struct task_struct *tsk) { } 2157 static inline void kick_process(struct task_struct *tsk) { }
2040#endif 2158#endif
2041extern void sched_fork(unsigned long clone_flags, struct task_struct *p); 2159extern int sched_fork(unsigned long clone_flags, struct task_struct *p);
2042extern void sched_dead(struct task_struct *p); 2160extern void sched_dead(struct task_struct *p);
2043 2161
2044extern void proc_caches_init(void); 2162extern void proc_caches_init(void);
@@ -2627,6 +2745,21 @@ static inline bool __must_check current_clr_polling_and_test(void)
2627} 2745}
2628#endif 2746#endif
2629 2747
2748static inline void current_clr_polling(void)
2749{
2750 __current_clr_polling();
2751
2752 /*
2753 * Ensure we check TIF_NEED_RESCHED after we clear the polling bit.
2754 * Once the bit is cleared, we'll get IPIs with every new
2755 * TIF_NEED_RESCHED and the IPI handler, scheduler_ipi(), will also
2756 * fold.
2757 */
2758 smp_mb(); /* paired with resched_task() */
2759
2760 preempt_fold_need_resched();
2761}
2762
2630static __always_inline bool need_resched(void) 2763static __always_inline bool need_resched(void)
2631{ 2764{
2632 return unlikely(tif_need_resched()); 2765 return unlikely(tif_need_resched());
diff --git a/include/linux/sched/deadline.h b/include/linux/sched/deadline.h
new file mode 100644
index 000000000000..9d303b8847df
--- /dev/null
+++ b/include/linux/sched/deadline.h
@@ -0,0 +1,24 @@
1#ifndef _SCHED_DEADLINE_H
2#define _SCHED_DEADLINE_H
3
4/*
5 * SCHED_DEADLINE tasks has negative priorities, reflecting
6 * the fact that any of them has higher prio than RT and
7 * NORMAL/BATCH tasks.
8 */
9
10#define MAX_DL_PRIO 0
11
12static inline int dl_prio(int prio)
13{
14 if (unlikely(prio < MAX_DL_PRIO))
15 return 1;
16 return 0;
17}
18
19static inline int dl_task(struct task_struct *p)
20{
21 return dl_prio(p->prio);
22}
23
24#endif /* _SCHED_DEADLINE_H */
diff --git a/include/linux/sched/rt.h b/include/linux/sched/rt.h
index 440434df3627..34e4ebea8fce 100644
--- a/include/linux/sched/rt.h
+++ b/include/linux/sched/rt.h
@@ -35,6 +35,7 @@ static inline int rt_task(struct task_struct *p)
35#ifdef CONFIG_RT_MUTEXES 35#ifdef CONFIG_RT_MUTEXES
36extern int rt_mutex_getprio(struct task_struct *p); 36extern int rt_mutex_getprio(struct task_struct *p);
37extern void rt_mutex_setprio(struct task_struct *p, int prio); 37extern void rt_mutex_setprio(struct task_struct *p, int prio);
38extern struct task_struct *rt_mutex_get_top_task(struct task_struct *task);
38extern void rt_mutex_adjust_pi(struct task_struct *p); 39extern void rt_mutex_adjust_pi(struct task_struct *p);
39static inline bool tsk_is_pi_blocked(struct task_struct *tsk) 40static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
40{ 41{
@@ -45,6 +46,10 @@ static inline int rt_mutex_getprio(struct task_struct *p)
45{ 46{
46 return p->normal_prio; 47 return p->normal_prio;
47} 48}
49static inline struct task_struct *rt_mutex_get_top_task(struct task_struct *task)
50{
51 return NULL;
52}
48# define rt_mutex_adjust_pi(p) do { } while (0) 53# define rt_mutex_adjust_pi(p) do { } while (0)
49static inline bool tsk_is_pi_blocked(struct task_struct *tsk) 54static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
50{ 55{
diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h
index 41467f8ff8ec..31e0193cb0c5 100644
--- a/include/linux/sched/sysctl.h
+++ b/include/linux/sched/sysctl.h
@@ -48,7 +48,6 @@ extern 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_size; 50extern unsigned int sysctl_numa_balancing_scan_size;
51extern unsigned int sysctl_numa_balancing_settle_count;
52 51
53#ifdef CONFIG_SCHED_DEBUG 52#ifdef CONFIG_SCHED_DEBUG
54extern unsigned int sysctl_sched_migration_cost; 53extern unsigned int sysctl_sched_migration_cost;
diff --git a/include/linux/seqlock.h b/include/linux/seqlock.h
index cf87a24c0f92..535f158977b9 100644
--- a/include/linux/seqlock.h
+++ b/include/linux/seqlock.h
@@ -117,15 +117,15 @@ repeat:
117} 117}
118 118
119/** 119/**
120 * read_seqcount_begin_no_lockdep - start seq-read critical section w/o lockdep 120 * raw_read_seqcount_begin - start seq-read critical section w/o lockdep
121 * @s: pointer to seqcount_t 121 * @s: pointer to seqcount_t
122 * Returns: count to be passed to read_seqcount_retry 122 * Returns: count to be passed to read_seqcount_retry
123 * 123 *
124 * read_seqcount_begin_no_lockdep opens a read critical section of the given 124 * raw_read_seqcount_begin opens a read critical section of the given
125 * seqcount, but without any lockdep checking. Validity of the critical 125 * seqcount, but without any lockdep checking. Validity of the critical
126 * section is tested by checking read_seqcount_retry function. 126 * section is tested by checking read_seqcount_retry function.
127 */ 127 */
128static inline unsigned read_seqcount_begin_no_lockdep(const seqcount_t *s) 128static inline unsigned raw_read_seqcount_begin(const seqcount_t *s)
129{ 129{
130 unsigned ret = __read_seqcount_begin(s); 130 unsigned ret = __read_seqcount_begin(s);
131 smp_rmb(); 131 smp_rmb();
@@ -144,7 +144,7 @@ static inline unsigned read_seqcount_begin_no_lockdep(const seqcount_t *s)
144static inline unsigned read_seqcount_begin(const seqcount_t *s) 144static inline unsigned read_seqcount_begin(const seqcount_t *s)
145{ 145{
146 seqcount_lockdep_reader_access(s); 146 seqcount_lockdep_reader_access(s);
147 return read_seqcount_begin_no_lockdep(s); 147 return raw_read_seqcount_begin(s);
148} 148}
149 149
150/** 150/**
@@ -206,14 +206,26 @@ static inline int read_seqcount_retry(const seqcount_t *s, unsigned start)
206} 206}
207 207
208 208
209
210static inline void raw_write_seqcount_begin(seqcount_t *s)
211{
212 s->sequence++;
213 smp_wmb();
214}
215
216static inline void raw_write_seqcount_end(seqcount_t *s)
217{
218 smp_wmb();
219 s->sequence++;
220}
221
209/* 222/*
210 * Sequence counter only version assumes that callers are using their 223 * Sequence counter only version assumes that callers are using their
211 * own mutexing. 224 * own mutexing.
212 */ 225 */
213static inline void write_seqcount_begin_nested(seqcount_t *s, int subclass) 226static inline void write_seqcount_begin_nested(seqcount_t *s, int subclass)
214{ 227{
215 s->sequence++; 228 raw_write_seqcount_begin(s);
216 smp_wmb();
217 seqcount_acquire(&s->dep_map, subclass, 0, _RET_IP_); 229 seqcount_acquire(&s->dep_map, subclass, 0, _RET_IP_);
218} 230}
219 231
@@ -225,8 +237,7 @@ static inline void write_seqcount_begin(seqcount_t *s)
225static inline void write_seqcount_end(seqcount_t *s) 237static inline void write_seqcount_end(seqcount_t *s)
226{ 238{
227 seqcount_release(&s->dep_map, 1, _RET_IP_); 239 seqcount_release(&s->dep_map, 1, _RET_IP_);
228 smp_wmb(); 240 raw_write_seqcount_end(s);
229 s->sequence++;
230} 241}
231 242
232/** 243/**
diff --git a/include/linux/spi/74x164.h b/include/linux/spi/74x164.h
deleted file mode 100644
index 0aa6acc73317..000000000000
--- a/include/linux/spi/74x164.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef LINUX_SPI_74X164_H
2#define LINUX_SPI_74X164_H
3
4struct gen_74x164_chip_platform_data {
5 /* number assigned to the first GPIO */
6 unsigned base;
7};
8
9#endif
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 75f34949d9ab..3f2867ff0ced 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -130,6 +130,16 @@ do { \
130#define smp_mb__before_spinlock() smp_wmb() 130#define smp_mb__before_spinlock() smp_wmb()
131#endif 131#endif
132 132
133/*
134 * Place this after a lock-acquisition primitive to guarantee that
135 * an UNLOCK+LOCK pair act as a full barrier. This guarantee applies
136 * if the UNLOCK and LOCK are executed by the same CPU or if the
137 * UNLOCK and LOCK operate on the same lock variable.
138 */
139#ifndef smp_mb__after_unlock_lock
140#define smp_mb__after_unlock_lock() do { } while (0)
141#endif
142
133/** 143/**
134 * raw_spin_unlock_wait - wait until the spinlock gets unlocked 144 * raw_spin_unlock_wait - wait until the spinlock gets unlocked
135 * @lock: the spinlock in question. 145 * @lock: the spinlock in question.
diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h
index bdb9993f0fda..42dfab89e740 100644
--- a/include/linux/spinlock_api_smp.h
+++ b/include/linux/spinlock_api_smp.h
@@ -131,8 +131,7 @@ static inline void __raw_spin_lock_irq(raw_spinlock_t *lock)
131 131
132static inline void __raw_spin_lock_bh(raw_spinlock_t *lock) 132static inline void __raw_spin_lock_bh(raw_spinlock_t *lock)
133{ 133{
134 local_bh_disable(); 134 __local_bh_disable_ip(_RET_IP_, SOFTIRQ_LOCK_OFFSET);
135 preempt_disable();
136 spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); 135 spin_acquire(&lock->dep_map, 0, 0, _RET_IP_);
137 LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock); 136 LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock);
138} 137}
@@ -174,20 +173,17 @@ static inline void __raw_spin_unlock_bh(raw_spinlock_t *lock)
174{ 173{
175 spin_release(&lock->dep_map, 1, _RET_IP_); 174 spin_release(&lock->dep_map, 1, _RET_IP_);
176 do_raw_spin_unlock(lock); 175 do_raw_spin_unlock(lock);
177 preempt_enable_no_resched(); 176 __local_bh_enable_ip(_RET_IP_, SOFTIRQ_LOCK_OFFSET);
178 local_bh_enable_ip((unsigned long)__builtin_return_address(0));
179} 177}
180 178
181static inline int __raw_spin_trylock_bh(raw_spinlock_t *lock) 179static inline int __raw_spin_trylock_bh(raw_spinlock_t *lock)
182{ 180{
183 local_bh_disable(); 181 __local_bh_disable_ip(_RET_IP_, SOFTIRQ_LOCK_OFFSET);
184 preempt_disable();
185 if (do_raw_spin_trylock(lock)) { 182 if (do_raw_spin_trylock(lock)) {
186 spin_acquire(&lock->dep_map, 0, 1, _RET_IP_); 183 spin_acquire(&lock->dep_map, 0, 1, _RET_IP_);
187 return 1; 184 return 1;
188 } 185 }
189 preempt_enable_no_resched(); 186 __local_bh_enable_ip(_RET_IP_, SOFTIRQ_LOCK_OFFSET);
190 local_bh_enable_ip((unsigned long)__builtin_return_address(0));
191 return 0; 187 return 0;
192} 188}
193 189
diff --git a/include/linux/spinlock_api_up.h b/include/linux/spinlock_api_up.h
index af1f47229e70..d0d188861ad6 100644
--- a/include/linux/spinlock_api_up.h
+++ b/include/linux/spinlock_api_up.h
@@ -24,11 +24,14 @@
24 * flags straight, to suppress compiler warnings of unused lock 24 * flags straight, to suppress compiler warnings of unused lock
25 * variables, and to add the proper checker annotations: 25 * variables, and to add the proper checker annotations:
26 */ 26 */
27#define ___LOCK(lock) \
28 do { __acquire(lock); (void)(lock); } while (0)
29
27#define __LOCK(lock) \ 30#define __LOCK(lock) \
28 do { preempt_disable(); __acquire(lock); (void)(lock); } while (0) 31 do { preempt_disable(); ___LOCK(lock); } while (0)
29 32
30#define __LOCK_BH(lock) \ 33#define __LOCK_BH(lock) \
31 do { local_bh_disable(); __LOCK(lock); } while (0) 34 do { __local_bh_disable_ip(_THIS_IP_, SOFTIRQ_LOCK_OFFSET); ___LOCK(lock); } while (0)
32 35
33#define __LOCK_IRQ(lock) \ 36#define __LOCK_IRQ(lock) \
34 do { local_irq_disable(); __LOCK(lock); } while (0) 37 do { local_irq_disable(); __LOCK(lock); } while (0)
@@ -36,12 +39,15 @@
36#define __LOCK_IRQSAVE(lock, flags) \ 39#define __LOCK_IRQSAVE(lock, flags) \
37 do { local_irq_save(flags); __LOCK(lock); } while (0) 40 do { local_irq_save(flags); __LOCK(lock); } while (0)
38 41
42#define ___UNLOCK(lock) \
43 do { __release(lock); (void)(lock); } while (0)
44
39#define __UNLOCK(lock) \ 45#define __UNLOCK(lock) \
40 do { preempt_enable(); __release(lock); (void)(lock); } while (0) 46 do { preempt_enable(); ___UNLOCK(lock); } while (0)
41 47
42#define __UNLOCK_BH(lock) \ 48#define __UNLOCK_BH(lock) \
43 do { preempt_enable_no_resched(); local_bh_enable(); \ 49 do { __local_bh_enable_ip(_THIS_IP_, SOFTIRQ_LOCK_OFFSET); \
44 __release(lock); (void)(lock); } while (0) 50 ___UNLOCK(lock); } while (0)
45 51
46#define __UNLOCK_IRQ(lock) \ 52#define __UNLOCK_IRQ(lock) \
47 do { local_irq_enable(); __UNLOCK(lock); } while (0) 53 do { local_irq_enable(); __UNLOCK(lock); } while (0)
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index 94273bbe6050..40ed9e9a77e5 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -38,6 +38,7 @@ struct rlimit;
38struct rlimit64; 38struct rlimit64;
39struct rusage; 39struct rusage;
40struct sched_param; 40struct sched_param;
41struct sched_attr;
41struct sel_arg_struct; 42struct sel_arg_struct;
42struct semaphore; 43struct semaphore;
43struct sembuf; 44struct sembuf;
@@ -279,9 +280,14 @@ asmlinkage long sys_sched_setscheduler(pid_t pid, int policy,
279 struct sched_param __user *param); 280 struct sched_param __user *param);
280asmlinkage long sys_sched_setparam(pid_t pid, 281asmlinkage long sys_sched_setparam(pid_t pid,
281 struct sched_param __user *param); 282 struct sched_param __user *param);
283asmlinkage long sys_sched_setattr(pid_t pid,
284 struct sched_attr __user *attr);
282asmlinkage long sys_sched_getscheduler(pid_t pid); 285asmlinkage long sys_sched_getscheduler(pid_t pid);
283asmlinkage long sys_sched_getparam(pid_t pid, 286asmlinkage long sys_sched_getparam(pid_t pid,
284 struct sched_param __user *param); 287 struct sched_param __user *param);
288asmlinkage long sys_sched_getattr(pid_t pid,
289 struct sched_attr __user *attr,
290 unsigned int size);
285asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len, 291asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len,
286 unsigned long __user *user_mask_ptr); 292 unsigned long __user *user_mask_ptr);
287asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len, 293asmlinkage long sys_sched_getaffinity(pid_t pid, unsigned int len,
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 6695040a0317..30b2ebee6439 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -12,6 +12,7 @@
12#ifndef _SYSFS_H_ 12#ifndef _SYSFS_H_
13#define _SYSFS_H_ 13#define _SYSFS_H_
14 14
15#include <linux/kernfs.h>
15#include <linux/compiler.h> 16#include <linux/compiler.h>
16#include <linux/errno.h> 17#include <linux/errno.h>
17#include <linux/list.h> 18#include <linux/list.h>
@@ -175,8 +176,6 @@ struct sysfs_ops {
175 ssize_t (*store)(struct kobject *, struct attribute *, const char *, size_t); 176 ssize_t (*store)(struct kobject *, struct attribute *, const char *, size_t);
176}; 177};
177 178
178struct sysfs_dirent;
179
180#ifdef CONFIG_SYSFS 179#ifdef CONFIG_SYSFS
181 180
182int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *), 181int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *),
@@ -244,12 +243,6 @@ void sysfs_remove_link_from_group(struct kobject *kobj, const char *group_name,
244 const char *link_name); 243 const char *link_name);
245 244
246void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr); 245void sysfs_notify(struct kobject *kobj, const char *dir, const char *attr);
247void sysfs_notify_dirent(struct sysfs_dirent *sd);
248struct sysfs_dirent *sysfs_get_dirent_ns(struct sysfs_dirent *parent_sd,
249 const unsigned char *name,
250 const void *ns);
251struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd);
252void sysfs_put(struct sysfs_dirent *sd);
253 246
254int __must_check sysfs_init(void); 247int __must_check sysfs_init(void);
255 248
@@ -419,22 +412,6 @@ static inline void sysfs_notify(struct kobject *kobj, const char *dir,
419 const char *attr) 412 const char *attr)
420{ 413{
421} 414}
422static inline void sysfs_notify_dirent(struct sysfs_dirent *sd)
423{
424}
425static inline struct sysfs_dirent *
426sysfs_get_dirent_ns(struct sysfs_dirent *parent_sd, const unsigned char *name,
427 const void *ns)
428{
429 return NULL;
430}
431static inline struct sysfs_dirent *sysfs_get(struct sysfs_dirent *sd)
432{
433 return NULL;
434}
435static inline void sysfs_put(struct sysfs_dirent *sd)
436{
437}
438 415
439static inline int __must_check sysfs_init(void) 416static inline int __must_check sysfs_init(void)
440{ 417{
@@ -461,10 +438,26 @@ static inline int sysfs_rename_link(struct kobject *kobj, struct kobject *target
461 return sysfs_rename_link_ns(kobj, target, old_name, new_name, NULL); 438 return sysfs_rename_link_ns(kobj, target, old_name, new_name, NULL);
462} 439}
463 440
464static inline struct sysfs_dirent * 441static inline void sysfs_notify_dirent(struct kernfs_node *kn)
465sysfs_get_dirent(struct sysfs_dirent *parent_sd, const unsigned char *name) 442{
443 kernfs_notify(kn);
444}
445
446static inline struct kernfs_node *sysfs_get_dirent(struct kernfs_node *parent,
447 const unsigned char *name)
448{
449 return kernfs_find_and_get(parent, name);
450}
451
452static inline struct kernfs_node *sysfs_get(struct kernfs_node *kn)
453{
454 kernfs_get(kn);
455 return kn;
456}
457
458static inline void sysfs_put(struct kernfs_node *kn)
466{ 459{
467 return sysfs_get_dirent_ns(parent_sd, name, NULL); 460 kernfs_put(kn);
468} 461}
469 462
470#endif /* _SYSFS_H_ */ 463#endif /* _SYSFS_H_ */
diff --git a/include/linux/tick.h b/include/linux/tick.h
index 5128d33bbb39..0175d8663b6c 100644
--- a/include/linux/tick.h
+++ b/include/linux/tick.h
@@ -104,7 +104,7 @@ extern struct cpumask *tick_get_broadcast_oneshot_mask(void);
104extern void tick_clock_notify(void); 104extern void tick_clock_notify(void);
105extern int tick_check_oneshot_change(int allow_nohz); 105extern int tick_check_oneshot_change(int allow_nohz);
106extern struct tick_sched *tick_get_tick_sched(int cpu); 106extern struct tick_sched *tick_get_tick_sched(int cpu);
107extern void tick_check_idle(int cpu); 107extern void tick_check_idle(void);
108extern int tick_oneshot_mode_active(void); 108extern int tick_oneshot_mode_active(void);
109# ifndef arch_needs_cpu 109# ifndef arch_needs_cpu
110# define arch_needs_cpu(cpu) (0) 110# define arch_needs_cpu(cpu) (0)
@@ -112,7 +112,7 @@ extern int tick_oneshot_mode_active(void);
112# else 112# else
113static inline void tick_clock_notify(void) { } 113static inline void tick_clock_notify(void) { }
114static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } 114static inline int tick_check_oneshot_change(int allow_nohz) { return 0; }
115static inline void tick_check_idle(int cpu) { } 115static inline void tick_check_idle(void) { }
116static inline int tick_oneshot_mode_active(void) { return 0; } 116static inline int tick_oneshot_mode_active(void) { return 0; }
117# endif 117# endif
118 118
@@ -121,7 +121,7 @@ static inline void tick_init(void) { }
121static inline void tick_cancel_sched_timer(int cpu) { } 121static inline void tick_cancel_sched_timer(int cpu) { }
122static inline void tick_clock_notify(void) { } 122static inline void tick_clock_notify(void) { }
123static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } 123static inline int tick_check_oneshot_change(int allow_nohz) { return 0; }
124static inline void tick_check_idle(int cpu) { } 124static inline void tick_check_idle(void) { }
125static inline int tick_oneshot_mode_active(void) { return 0; } 125static inline int tick_oneshot_mode_active(void) { return 0; }
126#endif /* !CONFIG_GENERIC_CLOCKEVENTS */ 126#endif /* !CONFIG_GENERIC_CLOCKEVENTS */
127 127
@@ -165,7 +165,7 @@ extern cpumask_var_t tick_nohz_full_mask;
165 165
166static inline bool tick_nohz_full_enabled(void) 166static inline bool tick_nohz_full_enabled(void)
167{ 167{
168 if (!static_key_false(&context_tracking_enabled)) 168 if (!context_tracking_is_enabled())
169 return false; 169 return false;
170 170
171 return tick_nohz_full_running; 171 return tick_nohz_full_running;
diff --git a/include/linux/tpm.h b/include/linux/tpm.h
index 9a9051bb1a03..fff1d0976f80 100644
--- a/include/linux/tpm.h
+++ b/include/linux/tpm.h
@@ -29,6 +29,18 @@
29 */ 29 */
30#define TPM_ANY_NUM 0xFFFF 30#define TPM_ANY_NUM 0xFFFF
31 31
32struct tpm_chip;
33
34struct tpm_class_ops {
35 const u8 req_complete_mask;
36 const u8 req_complete_val;
37 bool (*req_canceled)(struct tpm_chip *chip, u8 status);
38 int (*recv) (struct tpm_chip *chip, u8 *buf, size_t len);
39 int (*send) (struct tpm_chip *chip, u8 *buf, size_t len);
40 void (*cancel) (struct tpm_chip *chip);
41 u8 (*status) (struct tpm_chip *chip);
42};
43
32#if defined(CONFIG_TCG_TPM) || defined(CONFIG_TCG_TPM_MODULE) 44#if defined(CONFIG_TCG_TPM) || defined(CONFIG_TCG_TPM_MODULE)
33 45
34extern int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf); 46extern int tpm_pcr_read(u32 chip_num, int pcr_idx, u8 *res_buf);
diff --git a/include/linux/tty.h b/include/linux/tty.h
index 97d660ed70c1..90b4fdc8a61f 100644
--- a/include/linux/tty.h
+++ b/include/linux/tty.h
@@ -39,10 +39,14 @@ struct tty_buffer {
39 int size; 39 int size;
40 int commit; 40 int commit;
41 int read; 41 int read;
42 int flags;
42 /* Data points here */ 43 /* Data points here */
43 unsigned long data[0]; 44 unsigned long data[0];
44}; 45};
45 46
47/* Values for .flags field of tty_buffer */
48#define TTYB_NORMAL 1 /* buffer has no flags buffer */
49
46static inline unsigned char *char_buf_ptr(struct tty_buffer *b, int ofs) 50static inline unsigned char *char_buf_ptr(struct tty_buffer *b, int ofs)
47{ 51{
48 return ((unsigned char *)b->data) + ofs; 52 return ((unsigned char *)b->data) + ofs;
@@ -60,7 +64,8 @@ struct tty_bufhead {
60 atomic_t priority; 64 atomic_t priority;
61 struct tty_buffer sentinel; 65 struct tty_buffer sentinel;
62 struct llist_head free; /* Free queue head */ 66 struct llist_head free; /* Free queue head */
63 atomic_t memory_used; /* In-use buffers excluding free list */ 67 atomic_t mem_used; /* In-use buffers excluding free list */
68 int mem_limit;
64 struct tty_buffer *tail; /* Active buffer */ 69 struct tty_buffer *tail; /* Active buffer */
65}; 70};
66/* 71/*
@@ -137,6 +142,7 @@ struct tty_bufhead {
137#define C_CLOCAL(tty) _C_FLAG((tty), CLOCAL) 142#define C_CLOCAL(tty) _C_FLAG((tty), CLOCAL)
138#define C_CIBAUD(tty) _C_FLAG((tty), CIBAUD) 143#define C_CIBAUD(tty) _C_FLAG((tty), CIBAUD)
139#define C_CRTSCTS(tty) _C_FLAG((tty), CRTSCTS) 144#define C_CRTSCTS(tty) _C_FLAG((tty), CRTSCTS)
145#define C_CMSPAR(tty) _C_FLAG((tty), CMSPAR)
140 146
141#define L_ISIG(tty) _L_FLAG((tty), ISIG) 147#define L_ISIG(tty) _L_FLAG((tty), ISIG)
142#define L_ICANON(tty) _L_FLAG((tty), ICANON) 148#define L_ICANON(tty) _L_FLAG((tty), ICANON)
@@ -422,7 +428,6 @@ extern int is_ignored(int sig);
422extern int tty_signal(int sig, struct tty_struct *tty); 428extern int tty_signal(int sig, struct tty_struct *tty);
423extern void tty_hangup(struct tty_struct *tty); 429extern void tty_hangup(struct tty_struct *tty);
424extern void tty_vhangup(struct tty_struct *tty); 430extern void tty_vhangup(struct tty_struct *tty);
425extern void tty_vhangup_locked(struct tty_struct *tty);
426extern void tty_unhangup(struct file *filp); 431extern void tty_unhangup(struct file *filp);
427extern int tty_hung_up_p(struct file *filp); 432extern int tty_hung_up_p(struct file *filp);
428extern void do_SAK(struct tty_struct *tty); 433extern void do_SAK(struct tty_struct *tty);
diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h
index 21ddd7d9ea1f..c28dd523f96e 100644
--- a/include/linux/tty_flip.h
+++ b/include/linux/tty_flip.h
@@ -1,6 +1,7 @@
1#ifndef _LINUX_TTY_FLIP_H 1#ifndef _LINUX_TTY_FLIP_H
2#define _LINUX_TTY_FLIP_H 2#define _LINUX_TTY_FLIP_H
3 3
4extern int tty_buffer_set_limit(struct tty_port *port, int limit);
4extern int tty_buffer_space_avail(struct tty_port *port); 5extern int tty_buffer_space_avail(struct tty_port *port);
5extern int tty_buffer_request_room(struct tty_port *port, size_t size); 6extern int tty_buffer_request_room(struct tty_port *port, size_t size);
6extern int tty_insert_flip_string_flags(struct tty_port *port, 7extern int tty_insert_flip_string_flags(struct tty_port *port,
@@ -9,8 +10,6 @@ extern int tty_insert_flip_string_fixed_flag(struct tty_port *port,
9 const unsigned char *chars, char flag, size_t size); 10 const unsigned char *chars, char flag, size_t size);
10extern int tty_prepare_flip_string(struct tty_port *port, 11extern int tty_prepare_flip_string(struct tty_port *port,
11 unsigned char **chars, size_t size); 12 unsigned char **chars, size_t size);
12extern int tty_prepare_flip_string_flags(struct tty_port *port,
13 unsigned char **chars, char **flags, size_t size);
14extern void tty_flip_buffer_push(struct tty_port *port); 13extern void tty_flip_buffer_push(struct tty_port *port);
15void tty_schedule_flip(struct tty_port *port); 14void tty_schedule_flip(struct tty_port *port);
16 15
@@ -18,8 +17,12 @@ static inline int tty_insert_flip_char(struct tty_port *port,
18 unsigned char ch, char flag) 17 unsigned char ch, char flag)
19{ 18{
20 struct tty_buffer *tb = port->buf.tail; 19 struct tty_buffer *tb = port->buf.tail;
21 if (tb && tb->used < tb->size) { 20 int change;
22 *flag_buf_ptr(tb, tb->used) = flag; 21
22 change = (tb->flags & TTYB_NORMAL) && (flag != TTY_NORMAL);
23 if (!change && tb->used < tb->size) {
24 if (~tb->flags & TTYB_NORMAL)
25 *flag_buf_ptr(tb, tb->used) = flag;
23 *char_buf_ptr(tb, tb->used++) = ch; 26 *char_buf_ptr(tb, tb->used++) = ch;
24 return 1; 27 return 1;
25 } 28 }
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index f15c898ff462..b8347c207cb8 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -84,7 +84,8 @@
84 * processing. <cp> is a pointer to the buffer of input 84 * processing. <cp> is a pointer to the buffer of input
85 * character received by the device. <fp> is a pointer to a 85 * character received by the device. <fp> is a pointer to a
86 * pointer of flag bytes which indicate whether a character was 86 * pointer of flag bytes which indicate whether a character was
87 * received with a parity error, etc. 87 * received with a parity error, etc. <fp> may be NULL to indicate
88 * all data received is TTY_NORMAL.
88 * 89 *
89 * void (*write_wakeup)(struct tty_struct *); 90 * void (*write_wakeup)(struct tty_struct *);
90 * 91 *
@@ -118,7 +119,8 @@
118 * processing. <cp> is a pointer to the buffer of input 119 * processing. <cp> is a pointer to the buffer of input
119 * character received by the device. <fp> is a pointer to a 120 * character received by the device. <fp> is a pointer to a
120 * pointer of flag bytes which indicate whether a character was 121 * pointer of flag bytes which indicate whether a character was
121 * received with a parity error, etc. 122 * received with a parity error, etc. <fp> may be NULL to indicate
123 * all data received is TTY_NORMAL.
122 * If assigned, prefer this function for automatic flow control. 124 * If assigned, prefer this function for automatic flow control.
123 */ 125 */
124 126
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h
index 9d8cf056e661..ecd3319dac33 100644
--- a/include/linux/uaccess.h
+++ b/include/linux/uaccess.h
@@ -25,13 +25,16 @@ static inline void pagefault_disable(void)
25 25
26static inline void pagefault_enable(void) 26static inline void pagefault_enable(void)
27{ 27{
28#ifndef CONFIG_PREEMPT
28 /* 29 /*
29 * make sure to issue those last loads/stores before enabling 30 * make sure to issue those last loads/stores before enabling
30 * the pagefault handler again. 31 * the pagefault handler again.
31 */ 32 */
32 barrier(); 33 barrier();
33 preempt_count_dec(); 34 preempt_count_dec();
34 preempt_check_resched(); 35#else
36 preempt_enable();
37#endif
35} 38}
36 39
37#ifndef ARCH_HAS_NOCACHE_UACCESS 40#ifndef ARCH_HAS_NOCACHE_UACCESS
diff --git a/include/linux/uprobes.h b/include/linux/uprobes.h
index 319eae70fe84..e32251e00e62 100644
--- a/include/linux/uprobes.h
+++ b/include/linux/uprobes.h
@@ -26,16 +26,13 @@
26 26
27#include <linux/errno.h> 27#include <linux/errno.h>
28#include <linux/rbtree.h> 28#include <linux/rbtree.h>
29#include <linux/types.h>
29 30
30struct vm_area_struct; 31struct vm_area_struct;
31struct mm_struct; 32struct mm_struct;
32struct inode; 33struct inode;
33struct notifier_block; 34struct notifier_block;
34 35
35#ifdef CONFIG_ARCH_SUPPORTS_UPROBES
36# include <asm/uprobes.h>
37#endif
38
39#define UPROBE_HANDLER_REMOVE 1 36#define UPROBE_HANDLER_REMOVE 1
40#define UPROBE_HANDLER_MASK 1 37#define UPROBE_HANDLER_MASK 1
41 38
@@ -60,6 +57,8 @@ struct uprobe_consumer {
60}; 57};
61 58
62#ifdef CONFIG_UPROBES 59#ifdef CONFIG_UPROBES
60#include <asm/uprobes.h>
61
63enum uprobe_task_state { 62enum uprobe_task_state {
64 UTASK_RUNNING, 63 UTASK_RUNNING,
65 UTASK_SSTEP, 64 UTASK_SSTEP,
@@ -72,35 +71,28 @@ enum uprobe_task_state {
72 */ 71 */
73struct uprobe_task { 72struct uprobe_task {
74 enum uprobe_task_state state; 73 enum uprobe_task_state state;
75 struct arch_uprobe_task autask;
76 74
77 struct return_instance *return_instances; 75 union {
78 unsigned int depth; 76 struct {
79 struct uprobe *active_uprobe; 77 struct arch_uprobe_task autask;
78 unsigned long vaddr;
79 };
80 80
81 struct {
82 struct callback_head dup_xol_work;
83 unsigned long dup_xol_addr;
84 };
85 };
86
87 struct uprobe *active_uprobe;
81 unsigned long xol_vaddr; 88 unsigned long xol_vaddr;
82 unsigned long vaddr;
83};
84 89
85/* 90 struct return_instance *return_instances;
86 * On a breakpoint hit, thread contests for a slot. It frees the 91 unsigned int depth;
87 * slot after singlestep. Currently a fixed number of slots are
88 * allocated.
89 */
90struct xol_area {
91 wait_queue_head_t wq; /* if all slots are busy */
92 atomic_t slot_count; /* number of in-use slots */
93 unsigned long *bitmap; /* 0 = free slot */
94 struct page *page;
95
96 /*
97 * We keep the vma's vm_start rather than a pointer to the vma
98 * itself. The probed process or a naughty kernel module could make
99 * the vma go away, and we must handle that reasonably gracefully.
100 */
101 unsigned long vaddr; /* Page(s) of instruction slots */
102}; 92};
103 93
94struct xol_area;
95
104struct uprobes_state { 96struct uprobes_state {
105 struct xol_area *xol_area; 97 struct xol_area *xol_area;
106}; 98};
@@ -109,6 +101,7 @@ extern int __weak set_swbp(struct arch_uprobe *aup, struct mm_struct *mm, unsign
109extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr); 101extern int __weak set_orig_insn(struct arch_uprobe *aup, struct mm_struct *mm, unsigned long vaddr);
110extern bool __weak is_swbp_insn(uprobe_opcode_t *insn); 102extern bool __weak is_swbp_insn(uprobe_opcode_t *insn);
111extern bool __weak is_trap_insn(uprobe_opcode_t *insn); 103extern bool __weak is_trap_insn(uprobe_opcode_t *insn);
104extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs);
112extern int uprobe_write_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_t); 105extern int uprobe_write_opcode(struct mm_struct *mm, unsigned long vaddr, uprobe_opcode_t);
113extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc); 106extern int uprobe_register(struct inode *inode, loff_t offset, struct uprobe_consumer *uc);
114extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool); 107extern int uprobe_apply(struct inode *inode, loff_t offset, struct uprobe_consumer *uc, bool);
@@ -120,7 +113,6 @@ extern void uprobe_end_dup_mmap(void);
120extern void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm); 113extern void uprobe_dup_mmap(struct mm_struct *oldmm, struct mm_struct *newmm);
121extern void uprobe_free_utask(struct task_struct *t); 114extern void uprobe_free_utask(struct task_struct *t);
122extern void uprobe_copy_process(struct task_struct *t, unsigned long flags); 115extern void uprobe_copy_process(struct task_struct *t, unsigned long flags);
123extern unsigned long __weak uprobe_get_swbp_addr(struct pt_regs *regs);
124extern int uprobe_post_sstep_notifier(struct pt_regs *regs); 116extern int uprobe_post_sstep_notifier(struct pt_regs *regs);
125extern int uprobe_pre_sstep_notifier(struct pt_regs *regs); 117extern int uprobe_pre_sstep_notifier(struct pt_regs *regs);
126extern void uprobe_notify_resume(struct pt_regs *regs); 118extern void uprobe_notify_resume(struct pt_regs *regs);
@@ -176,10 +168,6 @@ static inline bool uprobe_deny_signal(void)
176{ 168{
177 return false; 169 return false;
178} 170}
179static inline unsigned long uprobe_get_swbp_addr(struct pt_regs *regs)
180{
181 return 0;
182}
183static inline void uprobe_free_utask(struct task_struct *t) 171static inline void uprobe_free_utask(struct task_struct *t)
184{ 172{
185} 173}
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 512ab162832c..c716da18c668 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -965,6 +965,7 @@ struct usb_dynid {
965}; 965};
966 966
967extern ssize_t usb_store_new_id(struct usb_dynids *dynids, 967extern ssize_t usb_store_new_id(struct usb_dynids *dynids,
968 const struct usb_device_id *id_table,
968 struct device_driver *driver, 969 struct device_driver *driver,
969 const char *buf, size_t count); 970 const char *buf, size_t count);
970 971
diff --git a/include/linux/usb/chipidea.h b/include/linux/usb/chipidea.h
index 7d399671a566..708bd119627f 100644
--- a/include/linux/usb/chipidea.h
+++ b/include/linux/usb/chipidea.h
@@ -24,6 +24,7 @@ struct ci_hdrc_platform_data {
24 * but otg is not supported (no register otgsc). 24 * but otg is not supported (no register otgsc).
25 */ 25 */
26#define CI_HDRC_DUAL_ROLE_NOT_OTG BIT(4) 26#define CI_HDRC_DUAL_ROLE_NOT_OTG BIT(4)
27#define CI_HDRC_IMX28_WRITE_FIX BIT(5)
27 enum usb_dr_mode dr_mode; 28 enum usb_dr_mode dr_mode;
28#define CI_HDRC_CONTROLLER_RESET_EVENT 0 29#define CI_HDRC_CONTROLLER_RESET_EVENT 0
29#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1 30#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 5e61589fc166..dba63f53906c 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -468,6 +468,8 @@ struct usb_function_instance {
468 struct config_group group; 468 struct config_group group;
469 struct list_head cfs_list; 469 struct list_head cfs_list;
470 struct usb_function_driver *fd; 470 struct usb_function_driver *fd;
471 int (*set_inst_name)(struct usb_function_instance *inst,
472 const char *name);
471 void (*free_func_inst)(struct usb_function_instance *inst); 473 void (*free_func_inst)(struct usb_function_instance *inst);
472}; 474};
473 475
diff --git a/include/linux/usb/functionfs.h b/include/linux/usb/functionfs.h
index 65d0a88dbc67..71190663f1ee 100644
--- a/include/linux/usb/functionfs.h
+++ b/include/linux/usb/functionfs.h
@@ -3,34 +3,4 @@
3 3
4#include <uapi/linux/usb/functionfs.h> 4#include <uapi/linux/usb/functionfs.h>
5 5
6
7struct ffs_data;
8struct usb_composite_dev;
9struct usb_configuration;
10
11
12static int functionfs_init(void) __attribute__((warn_unused_result));
13static void functionfs_cleanup(void);
14
15static int functionfs_bind(struct ffs_data *ffs, struct usb_composite_dev *cdev)
16 __attribute__((warn_unused_result, nonnull));
17static void functionfs_unbind(struct ffs_data *ffs)
18 __attribute__((nonnull));
19
20static int functionfs_bind_config(struct usb_composite_dev *cdev,
21 struct usb_configuration *c,
22 struct ffs_data *ffs)
23 __attribute__((warn_unused_result, nonnull));
24
25
26static int functionfs_ready_callback(struct ffs_data *ffs)
27 __attribute__((warn_unused_result, nonnull));
28static void functionfs_closed_callback(struct ffs_data *ffs)
29 __attribute__((nonnull));
30static void *functionfs_acquire_dev_callback(const char *dev_name)
31 __attribute__((warn_unused_result, nonnull));
32static void functionfs_release_dev_callback(struct ffs_data *ffs_data)
33 __attribute__((nonnull));
34
35
36#endif 6#endif
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 942ef5e053bf..c3a61853cd13 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -148,6 +148,9 @@ struct usb_ep_ops {
148 * @maxpacket:The maximum packet size used on this endpoint. The initial 148 * @maxpacket:The maximum packet size used on this endpoint. The initial
149 * value can sometimes be reduced (hardware allowing), according to 149 * value can sometimes be reduced (hardware allowing), according to
150 * the endpoint descriptor used to configure the endpoint. 150 * the endpoint descriptor used to configure the endpoint.
151 * @maxpacket_limit:The maximum packet size value which can be handled by this
152 * endpoint. It's set once by UDC driver when endpoint is initialized, and
153 * should not be changed. Should not be confused with maxpacket.
151 * @max_streams: The maximum number of streams supported 154 * @max_streams: The maximum number of streams supported
152 * by this EP (0 - 16, actual number is 2^n) 155 * by this EP (0 - 16, actual number is 2^n)
153 * @mult: multiplier, 'mult' value for SS Isoc EPs 156 * @mult: multiplier, 'mult' value for SS Isoc EPs
@@ -171,6 +174,7 @@ struct usb_ep {
171 const struct usb_ep_ops *ops; 174 const struct usb_ep_ops *ops;
172 struct list_head ep_list; 175 struct list_head ep_list;
173 unsigned maxpacket:16; 176 unsigned maxpacket:16;
177 unsigned maxpacket_limit:16;
174 unsigned max_streams:16; 178 unsigned max_streams:16;
175 unsigned mult:2; 179 unsigned mult:2;
176 unsigned maxburst:5; 180 unsigned maxburst:5;
@@ -182,6 +186,21 @@ struct usb_ep {
182/*-------------------------------------------------------------------------*/ 186/*-------------------------------------------------------------------------*/
183 187
184/** 188/**
189 * usb_ep_set_maxpacket_limit - set maximum packet size limit for endpoint
190 * @ep:the endpoint being configured
191 * @maxpacket_limit:value of maximum packet size limit
192 *
193 * This function shoud be used only in UDC drivers to initialize endpoint
194 * (usually in probe function).
195 */
196static inline void usb_ep_set_maxpacket_limit(struct usb_ep *ep,
197 unsigned maxpacket_limit)
198{
199 ep->maxpacket_limit = maxpacket_limit;
200 ep->maxpacket = maxpacket_limit;
201}
202
203/**
185 * usb_ep_enable - configure endpoint, making it usable 204 * usb_ep_enable - configure endpoint, making it usable
186 * @ep:the endpoint being configured. may not be the endpoint named "ep0". 205 * @ep:the endpoint being configured. may not be the endpoint named "ep0".
187 * drivers discover endpoints through the ep_list of a usb_gadget. 206 * drivers discover endpoints through the ep_list of a usb_gadget.
@@ -485,6 +504,11 @@ struct usb_gadget_ops {
485 * @max_speed: Maximal speed the UDC can handle. UDC must support this 504 * @max_speed: Maximal speed the UDC can handle. UDC must support this
486 * and all slower speeds. 505 * and all slower speeds.
487 * @state: the state we are now (attached, suspended, configured, etc) 506 * @state: the state we are now (attached, suspended, configured, etc)
507 * @name: Identifies the controller hardware type. Used in diagnostics
508 * and sometimes configuration.
509 * @dev: Driver model state for this abstract device.
510 * @out_epnum: last used out ep number
511 * @in_epnum: last used in ep number
488 * @sg_supported: true if we can handle scatter-gather 512 * @sg_supported: true if we can handle scatter-gather
489 * @is_otg: True if the USB device port uses a Mini-AB jack, so that the 513 * @is_otg: True if the USB device port uses a Mini-AB jack, so that the
490 * gadget driver must provide a USB OTG descriptor. 514 * gadget driver must provide a USB OTG descriptor.
@@ -497,11 +521,8 @@ struct usb_gadget_ops {
497 * only supports HNP on a different root port. 521 * only supports HNP on a different root port.
498 * @b_hnp_enable: OTG device feature flag, indicating that the A-Host 522 * @b_hnp_enable: OTG device feature flag, indicating that the A-Host
499 * enabled HNP support. 523 * enabled HNP support.
500 * @name: Identifies the controller hardware type. Used in diagnostics 524 * @quirk_ep_out_aligned_size: epout requires buffer size to be aligned to
501 * and sometimes configuration. 525 * MaxPacketSize.
502 * @dev: Driver model state for this abstract device.
503 * @out_epnum: last used out ep number
504 * @in_epnum: last used in ep number
505 * 526 *
506 * Gadgets have a mostly-portable "gadget driver" implementing device 527 * Gadgets have a mostly-portable "gadget driver" implementing device
507 * functions, handling all usb configurations and interfaces. Gadget 528 * functions, handling all usb configurations and interfaces. Gadget
@@ -530,16 +551,18 @@ struct usb_gadget {
530 enum usb_device_speed speed; 551 enum usb_device_speed speed;
531 enum usb_device_speed max_speed; 552 enum usb_device_speed max_speed;
532 enum usb_device_state state; 553 enum usb_device_state state;
554 const char *name;
555 struct device dev;
556 unsigned out_epnum;
557 unsigned in_epnum;
558
533 unsigned sg_supported:1; 559 unsigned sg_supported:1;
534 unsigned is_otg:1; 560 unsigned is_otg:1;
535 unsigned is_a_peripheral:1; 561 unsigned is_a_peripheral:1;
536 unsigned b_hnp_enable:1; 562 unsigned b_hnp_enable:1;
537 unsigned a_hnp_support:1; 563 unsigned a_hnp_support:1;
538 unsigned a_alt_hnp_support:1; 564 unsigned a_alt_hnp_support:1;
539 const char *name; 565 unsigned quirk_ep_out_aligned_size:1;
540 struct device dev;
541 unsigned out_epnum;
542 unsigned in_epnum;
543}; 566};
544#define work_to_gadget(w) (container_of((w), struct usb_gadget, work)) 567#define work_to_gadget(w) (container_of((w), struct usb_gadget, work))
545 568
@@ -558,6 +581,23 @@ static inline struct usb_gadget *dev_to_usb_gadget(struct device *dev)
558 581
559 582
560/** 583/**
584 * usb_ep_align_maybe - returns @len aligned to ep's maxpacketsize if gadget
585 * requires quirk_ep_out_aligned_size, otherwise reguens len.
586 * @g: controller to check for quirk
587 * @ep: the endpoint whose maxpacketsize is used to align @len
588 * @len: buffer size's length to align to @ep's maxpacketsize
589 *
590 * This helper is used in case it's required for any reason to check and maybe
591 * align buffer's size to an ep's maxpacketsize.
592 */
593static inline size_t
594usb_ep_align_maybe(struct usb_gadget *g, struct usb_ep *ep, size_t len)
595{
596 return !g->quirk_ep_out_aligned_size ? len :
597 round_up(len, (size_t)ep->desc->wMaxPacketSize);
598}
599
600/**
561 * gadget_is_dualspeed - return true iff the hardware handles high speed 601 * gadget_is_dualspeed - return true iff the hardware handles high speed
562 * @g: controller that might support both high and full speeds 602 * @g: controller that might support both high and full speeds
563 */ 603 */
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h
index b8aba196f7f1..efe8d8a7c7ad 100644
--- a/include/linux/usb/hcd.h
+++ b/include/linux/usb/hcd.h
@@ -134,6 +134,7 @@ struct usb_hcd {
134 unsigned rh_registered:1;/* is root hub registered? */ 134 unsigned rh_registered:1;/* is root hub registered? */
135 unsigned rh_pollable:1; /* may we poll the root hub? */ 135 unsigned rh_pollable:1; /* may we poll the root hub? */
136 unsigned msix_enabled:1; /* driver has MSI-X enabled? */ 136 unsigned msix_enabled:1; /* driver has MSI-X enabled? */
137 unsigned remove_phy:1; /* auto-remove USB phy */
137 138
138 /* The next flag is a stopgap, to be removed when all the HCDs 139 /* The next flag is a stopgap, to be removed when all the HCDs
139 * support the new root-hub polling mechanism. */ 140 * support the new root-hub polling mechanism. */
@@ -352,6 +353,8 @@ struct hc_driver {
352 void (*reset_bandwidth)(struct usb_hcd *, struct usb_device *); 353 void (*reset_bandwidth)(struct usb_hcd *, struct usb_device *);
353 /* Returns the hardware-chosen device address */ 354 /* Returns the hardware-chosen device address */
354 int (*address_device)(struct usb_hcd *, struct usb_device *udev); 355 int (*address_device)(struct usb_hcd *, struct usb_device *udev);
356 /* prepares the hardware to send commands to the device */
357 int (*enable_device)(struct usb_hcd *, struct usb_device *udev);
355 /* Notifies the HCD after a hub descriptor is fetched. 358 /* Notifies the HCD after a hub descriptor is fetched.
356 * Will block. 359 * Will block.
357 */ 360 */
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h
index eb505250940a..a4ee1b582183 100644
--- a/include/linux/usb/musb.h
+++ b/include/linux/usb/musb.h
@@ -76,6 +76,9 @@ struct musb_hdrc_config {
76 unsigned dma:1 __deprecated; /* supports DMA */ 76 unsigned dma:1 __deprecated; /* supports DMA */
77 unsigned vendor_req:1 __deprecated; /* vendor registers required */ 77 unsigned vendor_req:1 __deprecated; /* vendor registers required */
78 78
79 /* need to explicitly de-assert the port reset after resume? */
80 unsigned host_port_deassert_reset_at_resume:1;
81
79 u8 num_eps; /* number of endpoints _with_ ep0 */ 82 u8 num_eps; /* number of endpoints _with_ ep0 */
80 u8 dma_channels __deprecated; /* number of dma channels */ 83 u8 dma_channels __deprecated; /* number of dma channels */
81 u8 dyn_fifo_size; /* dynamic size in bytes */ 84 u8 dyn_fifo_size; /* dynamic size in bytes */
diff --git a/include/linux/usb/omap_control_usb.h b/include/linux/usb/omap_control_usb.h
index 596b01918813..69ae383ee3cc 100644
--- a/include/linux/usb/omap_control_usb.h
+++ b/include/linux/usb/omap_control_usb.h
@@ -24,6 +24,7 @@ enum omap_control_usb_type {
24 OMAP_CTRL_TYPE_USB2, /* USB2_PHY, power down in CONTROL_DEV_CONF */ 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 */ 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 */ 26 OMAP_CTRL_TYPE_DRA7USB2, /* USB2 PHY, power and power_aux e.g. DRA7 */
27 OMAP_CTRL_TYPE_AM437USB2, /* USB2 PHY, power e.g. AM437x */
27}; 28};
28 29
29struct omap_control_usb { 30struct omap_control_usb {
@@ -64,6 +65,11 @@ enum omap_control_usb_mode {
64 65
65#define OMAP_CTRL_USB2_PHY_PD BIT(28) 66#define OMAP_CTRL_USB2_PHY_PD BIT(28)
66 67
68#define AM437X_CTRL_USB2_PHY_PD BIT(0)
69#define AM437X_CTRL_USB2_OTG_PD BIT(1)
70#define AM437X_CTRL_USB2_OTGVDET_EN BIT(19)
71#define AM437X_CTRL_USB2_OTGSESSEND_EN BIT(20)
72
67#if IS_ENABLED(CONFIG_OMAP_CONTROL_USB) 73#if IS_ENABLED(CONFIG_OMAP_CONTROL_USB)
68extern void omap_control_usb_phy_power(struct device *dev, int on); 74extern void omap_control_usb_phy_power(struct device *dev, int on);
69extern void omap_control_usb_set_mode(struct device *dev, 75extern void omap_control_usb_set_mode(struct device *dev,
diff --git a/include/linux/usb/otg-fsm.h b/include/linux/usb/otg-fsm.h
new file mode 100644
index 000000000000..b6ba1bfb86f2
--- /dev/null
+++ b/include/linux/usb/otg-fsm.h
@@ -0,0 +1,244 @@
1/* Copyright (C) 2007,2008 Freescale Semiconductor, Inc.
2 *
3 * This program is free software; you can redistribute it and/or modify it
4 * under the terms of the GNU General Public License as published by the
5 * Free Software Foundation; either version 2 of the License, or (at your
6 * option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 675 Mass Ave, Cambridge, MA 02139, USA.
16 */
17
18#ifndef __LINUX_USB_OTG_FSM_H
19#define __LINUX_USB_OTG_FSM_H
20
21#include <linux/mutex.h>
22#include <linux/errno.h>
23
24#undef VERBOSE
25
26#ifdef VERBOSE
27#define VDBG(fmt, args...) pr_debug("[%s] " fmt , \
28 __func__, ## args)
29#else
30#define VDBG(stuff...) do {} while (0)
31#endif
32
33#ifdef VERBOSE
34#define MPC_LOC printk("Current Location [%s]:[%d]\n", __FILE__, __LINE__)
35#else
36#define MPC_LOC do {} while (0)
37#endif
38
39#define PROTO_UNDEF (0)
40#define PROTO_HOST (1)
41#define PROTO_GADGET (2)
42
43enum otg_fsm_timer {
44 /* Standard OTG timers */
45 A_WAIT_VRISE,
46 A_WAIT_VFALL,
47 A_WAIT_BCON,
48 A_AIDL_BDIS,
49 B_ASE0_BRST,
50 A_BIDL_ADIS,
51
52 /* Auxiliary timers */
53 B_SE0_SRP,
54 B_SRP_FAIL,
55 A_WAIT_ENUM,
56
57 NUM_OTG_FSM_TIMERS,
58};
59
60/* OTG state machine according to the OTG spec */
61struct otg_fsm {
62 /* Input */
63 int id;
64 int adp_change;
65 int power_up;
66 int test_device;
67 int a_bus_drop;
68 int a_bus_req;
69 int a_srp_det;
70 int a_vbus_vld;
71 int b_conn;
72 int a_bus_resume;
73 int a_bus_suspend;
74 int a_conn;
75 int b_bus_req;
76 int b_se0_srp;
77 int b_ssend_srp;
78 int b_sess_vld;
79 /* Auxilary inputs */
80 int a_sess_vld;
81 int b_bus_resume;
82 int b_bus_suspend;
83
84 /* Output */
85 int data_pulse;
86 int drv_vbus;
87 int loc_conn;
88 int loc_sof;
89 int adp_prb;
90 int adp_sns;
91
92 /* Internal variables */
93 int a_set_b_hnp_en;
94 int b_srp_done;
95 int b_hnp_enable;
96 int a_clr_err;
97
98 /* Informative variables */
99 int a_bus_drop_inf;
100 int a_bus_req_inf;
101 int a_clr_err_inf;
102 int b_bus_req_inf;
103 /* Auxilary informative variables */
104 int a_suspend_req_inf;
105
106 /* Timeout indicator for timers */
107 int a_wait_vrise_tmout;
108 int a_wait_vfall_tmout;
109 int a_wait_bcon_tmout;
110 int a_aidl_bdis_tmout;
111 int b_ase0_brst_tmout;
112 int a_bidl_adis_tmout;
113
114 struct otg_fsm_ops *ops;
115 struct usb_otg *otg;
116
117 /* Current usb protocol used: 0:undefine; 1:host; 2:client */
118 int protocol;
119 struct mutex lock;
120};
121
122struct otg_fsm_ops {
123 void (*chrg_vbus)(struct otg_fsm *fsm, int on);
124 void (*drv_vbus)(struct otg_fsm *fsm, int on);
125 void (*loc_conn)(struct otg_fsm *fsm, int on);
126 void (*loc_sof)(struct otg_fsm *fsm, int on);
127 void (*start_pulse)(struct otg_fsm *fsm);
128 void (*start_adp_prb)(struct otg_fsm *fsm);
129 void (*start_adp_sns)(struct otg_fsm *fsm);
130 void (*add_timer)(struct otg_fsm *fsm, enum otg_fsm_timer timer);
131 void (*del_timer)(struct otg_fsm *fsm, enum otg_fsm_timer timer);
132 int (*start_host)(struct otg_fsm *fsm, int on);
133 int (*start_gadget)(struct otg_fsm *fsm, int on);
134};
135
136
137static inline int otg_chrg_vbus(struct otg_fsm *fsm, int on)
138{
139 if (!fsm->ops->chrg_vbus)
140 return -EOPNOTSUPP;
141 fsm->ops->chrg_vbus(fsm, on);
142 return 0;
143}
144
145static inline int otg_drv_vbus(struct otg_fsm *fsm, int on)
146{
147 if (!fsm->ops->drv_vbus)
148 return -EOPNOTSUPP;
149 if (fsm->drv_vbus != on) {
150 fsm->drv_vbus = on;
151 fsm->ops->drv_vbus(fsm, on);
152 }
153 return 0;
154}
155
156static inline int otg_loc_conn(struct otg_fsm *fsm, int on)
157{
158 if (!fsm->ops->loc_conn)
159 return -EOPNOTSUPP;
160 if (fsm->loc_conn != on) {
161 fsm->loc_conn = on;
162 fsm->ops->loc_conn(fsm, on);
163 }
164 return 0;
165}
166
167static inline int otg_loc_sof(struct otg_fsm *fsm, int on)
168{
169 if (!fsm->ops->loc_sof)
170 return -EOPNOTSUPP;
171 if (fsm->loc_sof != on) {
172 fsm->loc_sof = on;
173 fsm->ops->loc_sof(fsm, on);
174 }
175 return 0;
176}
177
178static inline int otg_start_pulse(struct otg_fsm *fsm)
179{
180 if (!fsm->ops->start_pulse)
181 return -EOPNOTSUPP;
182 if (!fsm->data_pulse) {
183 fsm->data_pulse = 1;
184 fsm->ops->start_pulse(fsm);
185 }
186 return 0;
187}
188
189static inline int otg_start_adp_prb(struct otg_fsm *fsm)
190{
191 if (!fsm->ops->start_adp_prb)
192 return -EOPNOTSUPP;
193 if (!fsm->adp_prb) {
194 fsm->adp_sns = 0;
195 fsm->adp_prb = 1;
196 fsm->ops->start_adp_prb(fsm);
197 }
198 return 0;
199}
200
201static inline int otg_start_adp_sns(struct otg_fsm *fsm)
202{
203 if (!fsm->ops->start_adp_sns)
204 return -EOPNOTSUPP;
205 if (!fsm->adp_sns) {
206 fsm->adp_sns = 1;
207 fsm->ops->start_adp_sns(fsm);
208 }
209 return 0;
210}
211
212static inline int otg_add_timer(struct otg_fsm *fsm, enum otg_fsm_timer timer)
213{
214 if (!fsm->ops->add_timer)
215 return -EOPNOTSUPP;
216 fsm->ops->add_timer(fsm, timer);
217 return 0;
218}
219
220static inline int otg_del_timer(struct otg_fsm *fsm, enum otg_fsm_timer timer)
221{
222 if (!fsm->ops->del_timer)
223 return -EOPNOTSUPP;
224 fsm->ops->del_timer(fsm, timer);
225 return 0;
226}
227
228static inline int otg_start_host(struct otg_fsm *fsm, int on)
229{
230 if (!fsm->ops->start_host)
231 return -EOPNOTSUPP;
232 return fsm->ops->start_host(fsm, on);
233}
234
235static inline int otg_start_gadget(struct otg_fsm *fsm, int on)
236{
237 if (!fsm->ops->start_gadget)
238 return -EOPNOTSUPP;
239 return fsm->ops->start_gadget(fsm, on);
240}
241
242int otg_statemachine(struct otg_fsm *fsm);
243
244#endif /* __LINUX_USB_OTG_FSM_H */
diff --git a/include/linux/uwb/umc.h b/include/linux/uwb/umc.h
index 891d1d5f3947..ba82f03d8287 100644
--- a/include/linux/uwb/umc.h
+++ b/include/linux/uwb/umc.h
@@ -143,7 +143,7 @@ int umc_match_pci_id(struct umc_driver *umc_drv, struct umc_dev *umc);
143static inline struct pci_dev *umc_parent_pci_dev(struct umc_dev *umc_dev) 143static inline struct pci_dev *umc_parent_pci_dev(struct umc_dev *umc_dev)
144{ 144{
145 struct pci_dev *pci_dev = NULL; 145 struct pci_dev *pci_dev = NULL;
146 if (umc_dev->dev.parent->bus == &pci_bus_type) 146 if (dev_is_pci(umc_dev->dev.parent))
147 pci_dev = to_pci_dev(umc_dev->dev.parent); 147 pci_dev = to_pci_dev(umc_dev->dev.parent);
148 return pci_dev; 148 return pci_dev;
149} 149}
diff --git a/include/linux/vme.h b/include/linux/vme.h
index c9d65bf14cec..8cd6f19ca518 100644
--- a/include/linux/vme.h
+++ b/include/linux/vme.h
@@ -164,7 +164,8 @@ int vme_lm_attach(struct vme_resource *, int, void (*callback)(int));
164int vme_lm_detach(struct vme_resource *, int); 164int vme_lm_detach(struct vme_resource *, int);
165void vme_lm_free(struct vme_resource *); 165void vme_lm_free(struct vme_resource *);
166 166
167int vme_slot_get(struct vme_dev *); 167int vme_slot_num(struct vme_dev *);
168int vme_bus_num(struct vme_dev *);
168 169
169int vme_register_driver(struct vme_driver *, unsigned int); 170int vme_register_driver(struct vme_driver *, unsigned int);
170void vme_unregister_driver(struct vme_driver *); 171void vme_unregister_driver(struct vme_driver *);
diff --git a/include/linux/vtime.h b/include/linux/vtime.h
index f5b72b364bda..c5165fd256f9 100644
--- a/include/linux/vtime.h
+++ b/include/linux/vtime.h
@@ -19,8 +19,8 @@ static inline bool vtime_accounting_enabled(void) { return true; }
19#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN 19#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
20static inline bool vtime_accounting_enabled(void) 20static inline bool vtime_accounting_enabled(void)
21{ 21{
22 if (static_key_false(&context_tracking_enabled)) { 22 if (context_tracking_is_enabled()) {
23 if (context_tracking_active()) 23 if (context_tracking_cpu_is_enabled())
24 return true; 24 return true;
25 } 25 }
26 26
diff --git a/include/linux/zorro.h b/include/linux/zorro.h
index dff42025649b..63fbba0740c2 100644
--- a/include/linux/zorro.h
+++ b/include/linux/zorro.h
@@ -11,107 +11,10 @@
11#ifndef _LINUX_ZORRO_H 11#ifndef _LINUX_ZORRO_H
12#define _LINUX_ZORRO_H 12#define _LINUX_ZORRO_H
13 13
14#include <linux/device.h>
15
16
17 /*
18 * Each Zorro board has a 32-bit ID of the form
19 *
20 * mmmmmmmmmmmmmmmmppppppppeeeeeeee
21 *
22 * with
23 *
24 * mmmmmmmmmmmmmmmm 16-bit Manufacturer ID (assigned by CBM (sigh))
25 * pppppppp 8-bit Product ID (assigned by manufacturer)
26 * eeeeeeee 8-bit Extended Product ID (currently only used
27 * for some GVP boards)
28 */
29
30
31#define ZORRO_MANUF(id) ((id) >> 16)
32#define ZORRO_PROD(id) (((id) >> 8) & 0xff)
33#define ZORRO_EPC(id) ((id) & 0xff)
34
35#define ZORRO_ID(manuf, prod, epc) \
36 ((ZORRO_MANUF_##manuf << 16) | ((prod) << 8) | (epc))
37
38typedef __u32 zorro_id;
39
40
41/* Include the ID list */
42#include <linux/zorro_ids.h>
43
44 14
45 /* 15#include <uapi/linux/zorro.h>
46 * GVP identifies most of its products through the 'extended product code'
47 * (epc). The epc has to be ANDed with the GVP_PRODMASK before the
48 * identification.
49 */
50
51#define GVP_PRODMASK (0xf8)
52#define GVP_SCSICLKMASK (0x01)
53
54enum GVP_flags {
55 GVP_IO = 0x01,
56 GVP_ACCEL = 0x02,
57 GVP_SCSI = 0x04,
58 GVP_24BITDMA = 0x08,
59 GVP_25BITDMA = 0x10,
60 GVP_NOBANK = 0x20,
61 GVP_14MHZ = 0x40,
62};
63
64
65struct Node {
66 struct Node *ln_Succ; /* Pointer to next (successor) */
67 struct Node *ln_Pred; /* Pointer to previous (predecessor) */
68 __u8 ln_Type;
69 __s8 ln_Pri; /* Priority, for sorting */
70 __s8 *ln_Name; /* ID string, null terminated */
71} __attribute__ ((packed));
72
73struct ExpansionRom {
74 /* -First 16 bytes of the expansion ROM */
75 __u8 er_Type; /* Board type, size and flags */
76 __u8 er_Product; /* Product number, assigned by manufacturer */
77 __u8 er_Flags; /* Flags */
78 __u8 er_Reserved03; /* Must be zero ($ff inverted) */
79 __u16 er_Manufacturer; /* Unique ID, ASSIGNED BY COMMODORE-AMIGA! */
80 __u32 er_SerialNumber; /* Available for use by manufacturer */
81 __u16 er_InitDiagVec; /* Offset to optional "DiagArea" structure */
82 __u8 er_Reserved0c;
83 __u8 er_Reserved0d;
84 __u8 er_Reserved0e;
85 __u8 er_Reserved0f;
86} __attribute__ ((packed));
87
88/* er_Type board type bits */
89#define ERT_TYPEMASK 0xc0
90#define ERT_ZORROII 0xc0
91#define ERT_ZORROIII 0x80
92
93/* other bits defined in er_Type */
94#define ERTB_MEMLIST 5 /* Link RAM into free memory list */
95#define ERTF_MEMLIST (1<<5)
96
97struct ConfigDev {
98 struct Node cd_Node;
99 __u8 cd_Flags; /* (read/write) */
100 __u8 cd_Pad; /* reserved */
101 struct ExpansionRom cd_Rom; /* copy of board's expansion ROM */
102 void *cd_BoardAddr; /* where in memory the board was placed */
103 __u32 cd_BoardSize; /* size of board in bytes */
104 __u16 cd_SlotAddr; /* which slot number (PRIVATE) */
105 __u16 cd_SlotSize; /* number of slots (PRIVATE) */
106 void *cd_Driver; /* pointer to node of driver */
107 struct ConfigDev *cd_NextCD; /* linked list of drivers to config */
108 __u32 cd_Unused[4]; /* for whatever the driver wants */
109} __attribute__ ((packed));
110
111#define ZORRO_NUM_AUTO 16
112
113#ifdef __KERNEL__
114 16
17#include <linux/device.h>
115#include <linux/init.h> 18#include <linux/init.h>
116#include <linux/ioport.h> 19#include <linux/ioport.h>
117#include <linux/mod_devicetable.h> 20#include <linux/mod_devicetable.h>
@@ -175,7 +78,23 @@ static inline struct zorro_driver *zorro_dev_driver(const struct zorro_dev *z)
175 78
176 79
177extern unsigned int zorro_num_autocon; /* # of autoconfig devices found */ 80extern unsigned int zorro_num_autocon; /* # of autoconfig devices found */
178extern struct zorro_dev zorro_autocon[ZORRO_NUM_AUTO]; 81extern struct zorro_dev *zorro_autocon;
82
83
84 /*
85 * Minimal information about a Zorro device, passed from bootinfo
86 * Only available temporarily, i.e. until initmem has been freed!
87 */
88
89struct zorro_dev_init {
90 struct ExpansionRom rom;
91 u16 slotaddr;
92 u16 slotsize;
93 u32 boardaddr;
94 u32 boardsize;
95};
96
97extern struct zorro_dev_init zorro_autocon_init[ZORRO_NUM_AUTO] __initdata;
179 98
180 99
181 /* 100 /*
@@ -229,6 +148,4 @@ extern DECLARE_BITMAP(zorro_unused_z2ram, 128);
229#define Z2RAM_CHUNKSHIFT (16) 148#define Z2RAM_CHUNKSHIFT (16)
230 149
231 150
232#endif /* __KERNEL__ */
233
234#endif /* _LINUX_ZORRO_H */ 151#endif /* _LINUX_ZORRO_H */
diff --git a/include/net/busy_poll.h b/include/net/busy_poll.h
index 829627d7b846..1d67fb6b23a0 100644
--- a/include/net/busy_poll.h
+++ b/include/net/busy_poll.h
@@ -42,27 +42,10 @@ static inline bool net_busy_loop_on(void)
42 return sysctl_net_busy_poll; 42 return sysctl_net_busy_poll;
43} 43}
44 44
45/* a wrapper to make debug_smp_processor_id() happy
46 * we can use sched_clock() because we don't care much about precision
47 * we only care that the average is bounded
48 */
49#ifdef CONFIG_DEBUG_PREEMPT
50static inline u64 busy_loop_us_clock(void)
51{
52 u64 rc;
53
54 preempt_disable_notrace();
55 rc = sched_clock();
56 preempt_enable_no_resched_notrace();
57
58 return rc >> 10;
59}
60#else /* CONFIG_DEBUG_PREEMPT */
61static inline u64 busy_loop_us_clock(void) 45static inline u64 busy_loop_us_clock(void)
62{ 46{
63 return sched_clock() >> 10; 47 return local_clock() >> 10;
64} 48}
65#endif /* CONFIG_DEBUG_PREEMPT */
66 49
67static inline unsigned long sk_busy_loop_end_time(struct sock *sk) 50static inline unsigned long sk_busy_loop_end_time(struct sock *sk)
68{ 51{
diff --git a/include/net/if_inet6.h b/include/net/if_inet6.h
index 76d54270f2e2..65bb13035598 100644
--- a/include/net/if_inet6.h
+++ b/include/net/if_inet6.h
@@ -165,7 +165,6 @@ struct inet6_dev {
165 struct net_device *dev; 165 struct net_device *dev;
166 166
167 struct list_head addr_list; 167 struct list_head addr_list;
168 int valid_ll_addr_cnt;
169 168
170 struct ifmcaddr6 *mc_list; 169 struct ifmcaddr6 *mc_list;
171 struct ifmcaddr6 *mc_tomb; 170 struct ifmcaddr6 *mc_tomb;
diff --git a/include/trace/events/ras.h b/include/trace/events/ras.h
index 88b878383797..1c875ad1ee5f 100644
--- a/include/trace/events/ras.h
+++ b/include/trace/events/ras.h
@@ -5,7 +5,7 @@
5#define _TRACE_AER_H 5#define _TRACE_AER_H
6 6
7#include <linux/tracepoint.h> 7#include <linux/tracepoint.h>
8#include <linux/edac.h> 8#include <linux/aer.h>
9 9
10 10
11/* 11/*
@@ -63,10 +63,10 @@ TRACE_EVENT(aer_event,
63 63
64 TP_printk("%s PCIe Bus Error: severity=%s, %s\n", 64 TP_printk("%s PCIe Bus Error: severity=%s, %s\n",
65 __get_str(dev_name), 65 __get_str(dev_name),
66 __entry->severity == HW_EVENT_ERR_CORRECTED ? "Corrected" : 66 __entry->severity == AER_CORRECTABLE ? "Corrected" :
67 __entry->severity == HW_EVENT_ERR_FATAL ? 67 __entry->severity == AER_FATAL ?
68 "Fatal" : "Uncorrected", 68 "Fatal" : "Uncorrected, non-fatal",
69 __entry->severity == HW_EVENT_ERR_CORRECTED ? 69 __entry->severity == AER_CORRECTABLE ?
70 __print_flags(__entry->status, "|", aer_correctable_errors) : 70 __print_flags(__entry->status, "|", aer_correctable_errors) :
71 __print_flags(__entry->status, "|", aer_uncorrectable_errors)) 71 __print_flags(__entry->status, "|", aer_uncorrectable_errors))
72); 72);
diff --git a/include/uapi/asm-generic/statfs.h b/include/uapi/asm-generic/statfs.h
index 0999647fca13..cb89cc730f0b 100644
--- a/include/uapi/asm-generic/statfs.h
+++ b/include/uapi/asm-generic/statfs.h
@@ -13,7 +13,7 @@
13 */ 13 */
14#ifndef __statfs_word 14#ifndef __statfs_word
15#if __BITS_PER_LONG == 64 15#if __BITS_PER_LONG == 64
16#define __statfs_word long 16#define __statfs_word __kernel_long_t
17#else 17#else
18#define __statfs_word __u32 18#define __statfs_word __u32
19#endif 19#endif
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index 33d2b8fe166d..3ce25b5d75a9 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -426,3 +426,5 @@ header-y += x25.h
426header-y += xattr.h 426header-y += xattr.h
427header-y += xfrm.h 427header-y += xfrm.h
428header-y += hw_breakpoint.h 428header-y += hw_breakpoint.h
429header-y += zorro.h
430header-y += zorro_ids.h
diff --git a/include/uapi/linux/genwqe/genwqe_card.h b/include/uapi/linux/genwqe/genwqe_card.h
new file mode 100644
index 000000000000..795e957bb840
--- /dev/null
+++ b/include/uapi/linux/genwqe/genwqe_card.h
@@ -0,0 +1,500 @@
1#ifndef __GENWQE_CARD_H__
2#define __GENWQE_CARD_H__
3
4/**
5 * IBM Accelerator Family 'GenWQE'
6 *
7 * (C) Copyright IBM Corp. 2013
8 *
9 * Author: Frank Haverkamp <haver@linux.vnet.ibm.com>
10 * Author: Joerg-Stephan Vogt <jsvogt@de.ibm.com>
11 * Author: Michael Jung <mijung@de.ibm.com>
12 * Author: Michael Ruettger <michael@ibmra.de>
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License (version 2 only)
16 * as published by the Free Software Foundation.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 */
23
24/*
25 * User-space API for the GenWQE card. For debugging and test purposes
26 * the register addresses are included here too.
27 */
28
29#include <linux/types.h>
30#include <linux/ioctl.h>
31
32/* Basename of sysfs, debugfs and /dev interfaces */
33#define GENWQE_DEVNAME "genwqe"
34
35#define GENWQE_TYPE_ALTERA_230 0x00 /* GenWQE4 Stratix-IV-230 */
36#define GENWQE_TYPE_ALTERA_530 0x01 /* GenWQE4 Stratix-IV-530 */
37#define GENWQE_TYPE_ALTERA_A4 0x02 /* GenWQE5 A4 Stratix-V-A4 */
38#define GENWQE_TYPE_ALTERA_A7 0x03 /* GenWQE5 A7 Stratix-V-A7 */
39
40/* MMIO Unit offsets: Each UnitID occupies a defined address range */
41#define GENWQE_UID_OFFS(uid) ((uid) << 24)
42#define GENWQE_SLU_OFFS GENWQE_UID_OFFS(0)
43#define GENWQE_HSU_OFFS GENWQE_UID_OFFS(1)
44#define GENWQE_APP_OFFS GENWQE_UID_OFFS(2)
45#define GENWQE_MAX_UNITS 3
46
47/* Common offsets per UnitID */
48#define IO_EXTENDED_ERROR_POINTER 0x00000048
49#define IO_ERROR_INJECT_SELECTOR 0x00000060
50#define IO_EXTENDED_DIAG_SELECTOR 0x00000070
51#define IO_EXTENDED_DIAG_READ_MBX 0x00000078
52#define IO_EXTENDED_DIAG_MAP(ring) (0x00000500 | ((ring) << 3))
53
54#define GENWQE_EXTENDED_DIAG_SELECTOR(ring, trace) (((ring) << 8) | (trace))
55
56/* UnitID 0: Service Layer Unit (SLU) */
57
58/* SLU: Unit Configuration Register */
59#define IO_SLU_UNITCFG 0x00000000
60#define IO_SLU_UNITCFG_TYPE_MASK 0x000000000ff00000 /* 27:20 */
61
62/* SLU: Fault Isolation Register (FIR) (ac_slu_fir) */
63#define IO_SLU_FIR 0x00000008 /* read only, wr direct */
64#define IO_SLU_FIR_CLR 0x00000010 /* read and clear */
65
66/* SLU: First Error Capture Register (FEC/WOF) */
67#define IO_SLU_FEC 0x00000018
68
69#define IO_SLU_ERR_ACT_MASK 0x00000020
70#define IO_SLU_ERR_ATTN_MASK 0x00000028
71#define IO_SLU_FIRX1_ACT_MASK 0x00000030
72#define IO_SLU_FIRX0_ACT_MASK 0x00000038
73#define IO_SLU_SEC_LEM_DEBUG_OVR 0x00000040
74#define IO_SLU_EXTENDED_ERR_PTR 0x00000048
75#define IO_SLU_COMMON_CONFIG 0x00000060
76
77#define IO_SLU_FLASH_FIR 0x00000108
78#define IO_SLU_SLC_FIR 0x00000110
79#define IO_SLU_RIU_TRAP 0x00000280
80#define IO_SLU_FLASH_FEC 0x00000308
81#define IO_SLU_SLC_FEC 0x00000310
82
83/*
84 * The Virtual Function's Access is from offset 0x00010000
85 * The Physical Function's Access is from offset 0x00050000
86 * Single Shared Registers exists only at offset 0x00060000
87 *
88 * SLC: Queue Virtual Window Window for accessing into a specific VF
89 * queue. When accessing the 0x10000 space using the 0x50000 address
90 * segment, the value indicated here is used to specify which VF
91 * register is decoded. This register, and the 0x50000 register space
92 * can only be accessed by the PF. Example, if this register is set to
93 * 0x2, then a read from 0x50000 is the same as a read from 0x10000
94 * from VF=2.
95 */
96
97/* SLC: Queue Segment */
98#define IO_SLC_QUEUE_SEGMENT 0x00010000
99#define IO_SLC_VF_QUEUE_SEGMENT 0x00050000
100
101/* SLC: Queue Offset */
102#define IO_SLC_QUEUE_OFFSET 0x00010008
103#define IO_SLC_VF_QUEUE_OFFSET 0x00050008
104
105/* SLC: Queue Configuration */
106#define IO_SLC_QUEUE_CONFIG 0x00010010
107#define IO_SLC_VF_QUEUE_CONFIG 0x00050010
108
109/* SLC: Job Timout/Only accessible for the PF */
110#define IO_SLC_APPJOB_TIMEOUT 0x00010018
111#define IO_SLC_VF_APPJOB_TIMEOUT 0x00050018
112#define TIMEOUT_250MS 0x0000000f
113#define HEARTBEAT_DISABLE 0x0000ff00
114
115/* SLC: Queue InitSequence Register */
116#define IO_SLC_QUEUE_INITSQN 0x00010020
117#define IO_SLC_VF_QUEUE_INITSQN 0x00050020
118
119/* SLC: Queue Wrap */
120#define IO_SLC_QUEUE_WRAP 0x00010028
121#define IO_SLC_VF_QUEUE_WRAP 0x00050028
122
123/* SLC: Queue Status */
124#define IO_SLC_QUEUE_STATUS 0x00010100
125#define IO_SLC_VF_QUEUE_STATUS 0x00050100
126
127/* SLC: Queue Working Time */
128#define IO_SLC_QUEUE_WTIME 0x00010030
129#define IO_SLC_VF_QUEUE_WTIME 0x00050030
130
131/* SLC: Queue Error Counts */
132#define IO_SLC_QUEUE_ERRCNTS 0x00010038
133#define IO_SLC_VF_QUEUE_ERRCNTS 0x00050038
134
135/* SLC: Queue Loast Response Word */
136#define IO_SLC_QUEUE_LRW 0x00010040
137#define IO_SLC_VF_QUEUE_LRW 0x00050040
138
139/* SLC: Freerunning Timer */
140#define IO_SLC_FREE_RUNNING_TIMER 0x00010108
141#define IO_SLC_VF_FREE_RUNNING_TIMER 0x00050108
142
143/* SLC: Queue Virtual Access Region */
144#define IO_PF_SLC_VIRTUAL_REGION 0x00050000
145
146/* SLC: Queue Virtual Window */
147#define IO_PF_SLC_VIRTUAL_WINDOW 0x00060000
148
149/* SLC: DDCB Application Job Pending [n] (n=0:63) */
150#define IO_PF_SLC_JOBPEND(n) (0x00061000 + 8*(n))
151#define IO_SLC_JOBPEND(n) IO_PF_SLC_JOBPEND(n)
152
153/* SLC: Parser Trap RAM [n] (n=0:31) */
154#define IO_SLU_SLC_PARSE_TRAP(n) (0x00011000 + 8*(n))
155
156/* SLC: Dispatcher Trap RAM [n] (n=0:31) */
157#define IO_SLU_SLC_DISP_TRAP(n) (0x00011200 + 8*(n))
158
159/* Global Fault Isolation Register (GFIR) */
160#define IO_SLC_CFGREG_GFIR 0x00020000
161#define GFIR_ERR_TRIGGER 0x0000ffff
162
163/* SLU: Soft Reset Register */
164#define IO_SLC_CFGREG_SOFTRESET 0x00020018
165
166/* SLU: Misc Debug Register */
167#define IO_SLC_MISC_DEBUG 0x00020060
168#define IO_SLC_MISC_DEBUG_CLR 0x00020068
169#define IO_SLC_MISC_DEBUG_SET 0x00020070
170
171/* Temperature Sensor Reading */
172#define IO_SLU_TEMPERATURE_SENSOR 0x00030000
173#define IO_SLU_TEMPERATURE_CONFIG 0x00030008
174
175/* Voltage Margining Control */
176#define IO_SLU_VOLTAGE_CONTROL 0x00030080
177#define IO_SLU_VOLTAGE_NOMINAL 0x00000000
178#define IO_SLU_VOLTAGE_DOWN5 0x00000006
179#define IO_SLU_VOLTAGE_UP5 0x00000007
180
181/* Direct LED Control Register */
182#define IO_SLU_LEDCONTROL 0x00030100
183
184/* SLU: Flashbus Direct Access -A5 */
185#define IO_SLU_FLASH_DIRECTACCESS 0x00040010
186
187/* SLU: Flashbus Direct Access2 -A5 */
188#define IO_SLU_FLASH_DIRECTACCESS2 0x00040020
189
190/* SLU: Flashbus Command Interface -A5 */
191#define IO_SLU_FLASH_CMDINTF 0x00040030
192
193/* SLU: BitStream Loaded */
194#define IO_SLU_BITSTREAM 0x00040040
195
196/* This Register has a switch which will change the CAs to UR */
197#define IO_HSU_ERR_BEHAVIOR 0x01001010
198
199#define IO_SLC2_SQB_TRAP 0x00062000
200#define IO_SLC2_QUEUE_MANAGER_TRAP 0x00062008
201#define IO_SLC2_FLS_MASTER_TRAP 0x00062010
202
203/* UnitID 1: HSU Registers */
204#define IO_HSU_UNITCFG 0x01000000
205#define IO_HSU_FIR 0x01000008
206#define IO_HSU_FIR_CLR 0x01000010
207#define IO_HSU_FEC 0x01000018
208#define IO_HSU_ERR_ACT_MASK 0x01000020
209#define IO_HSU_ERR_ATTN_MASK 0x01000028
210#define IO_HSU_FIRX1_ACT_MASK 0x01000030
211#define IO_HSU_FIRX0_ACT_MASK 0x01000038
212#define IO_HSU_SEC_LEM_DEBUG_OVR 0x01000040
213#define IO_HSU_EXTENDED_ERR_PTR 0x01000048
214#define IO_HSU_COMMON_CONFIG 0x01000060
215
216/* UnitID 2: Application Unit (APP) */
217#define IO_APP_UNITCFG 0x02000000
218#define IO_APP_FIR 0x02000008
219#define IO_APP_FIR_CLR 0x02000010
220#define IO_APP_FEC 0x02000018
221#define IO_APP_ERR_ACT_MASK 0x02000020
222#define IO_APP_ERR_ATTN_MASK 0x02000028
223#define IO_APP_FIRX1_ACT_MASK 0x02000030
224#define IO_APP_FIRX0_ACT_MASK 0x02000038
225#define IO_APP_SEC_LEM_DEBUG_OVR 0x02000040
226#define IO_APP_EXTENDED_ERR_PTR 0x02000048
227#define IO_APP_COMMON_CONFIG 0x02000060
228
229#define IO_APP_DEBUG_REG_01 0x02010000
230#define IO_APP_DEBUG_REG_02 0x02010008
231#define IO_APP_DEBUG_REG_03 0x02010010
232#define IO_APP_DEBUG_REG_04 0x02010018
233#define IO_APP_DEBUG_REG_05 0x02010020
234#define IO_APP_DEBUG_REG_06 0x02010028
235#define IO_APP_DEBUG_REG_07 0x02010030
236#define IO_APP_DEBUG_REG_08 0x02010038
237#define IO_APP_DEBUG_REG_09 0x02010040
238#define IO_APP_DEBUG_REG_10 0x02010048
239#define IO_APP_DEBUG_REG_11 0x02010050
240#define IO_APP_DEBUG_REG_12 0x02010058
241#define IO_APP_DEBUG_REG_13 0x02010060
242#define IO_APP_DEBUG_REG_14 0x02010068
243#define IO_APP_DEBUG_REG_15 0x02010070
244#define IO_APP_DEBUG_REG_16 0x02010078
245#define IO_APP_DEBUG_REG_17 0x02010080
246#define IO_APP_DEBUG_REG_18 0x02010088
247
248/* Read/write from/to registers */
249struct genwqe_reg_io {
250 __u64 num; /* register offset/address */
251 __u64 val64;
252};
253
254/*
255 * All registers of our card will return values not equal this values.
256 * If we see IO_ILLEGAL_VALUE on any of our MMIO register reads, the
257 * card can be considered as unusable. It will need recovery.
258 */
259#define IO_ILLEGAL_VALUE 0xffffffffffffffffull
260
261/*
262 * Generic DDCB execution interface.
263 *
264 * This interface is a first prototype resulting from discussions we
265 * had with other teams which wanted to use the Genwqe card. It allows
266 * to issue a DDCB request in a generic way. The request will block
267 * until it finishes or time out with error.
268 *
269 * Some DDCBs require DMA addresses to be specified in the ASIV
270 * block. The interface provies the capability to let the kernel
271 * driver know where those addresses are by specifying the ATS field,
272 * such that it can replace the user-space addresses with appropriate
273 * DMA addresses or DMA addresses of a scatter gather list which is
274 * dynamically created.
275 *
276 * Our hardware will refuse DDCB execution if the ATS field is not as
277 * expected. That means the DDCB execution engine in the chip knows
278 * where it expects DMA addresses within the ASIV part of the DDCB and
279 * will check that against the ATS field definition. Any invalid or
280 * unknown ATS content will lead to DDCB refusal.
281 */
282
283/* Genwqe chip Units */
284#define DDCB_ACFUNC_SLU 0x00 /* chip service layer unit */
285#define DDCB_ACFUNC_APP 0x01 /* chip application */
286
287/* DDCB return codes (RETC) */
288#define DDCB_RETC_IDLE 0x0000 /* Unexecuted/DDCB created */
289#define DDCB_RETC_PENDING 0x0101 /* Pending Execution */
290#define DDCB_RETC_COMPLETE 0x0102 /* Cmd complete. No error */
291#define DDCB_RETC_FAULT 0x0104 /* App Err, recoverable */
292#define DDCB_RETC_ERROR 0x0108 /* App Err, non-recoverable */
293#define DDCB_RETC_FORCED_ERROR 0x01ff /* overwritten by driver */
294
295#define DDCB_RETC_UNEXEC 0x0110 /* Unexe/Removed from queue */
296#define DDCB_RETC_TERM 0x0120 /* Terminated */
297#define DDCB_RETC_RES0 0x0140 /* Reserved */
298#define DDCB_RETC_RES1 0x0180 /* Reserved */
299
300/* DDCB Command Options (CMDOPT) */
301#define DDCB_OPT_ECHO_FORCE_NO 0x0000 /* ECHO DDCB */
302#define DDCB_OPT_ECHO_FORCE_102 0x0001 /* force return code */
303#define DDCB_OPT_ECHO_FORCE_104 0x0002
304#define DDCB_OPT_ECHO_FORCE_108 0x0003
305
306#define DDCB_OPT_ECHO_FORCE_110 0x0004 /* only on PF ! */
307#define DDCB_OPT_ECHO_FORCE_120 0x0005
308#define DDCB_OPT_ECHO_FORCE_140 0x0006
309#define DDCB_OPT_ECHO_FORCE_180 0x0007
310
311#define DDCB_OPT_ECHO_COPY_NONE (0 << 5)
312#define DDCB_OPT_ECHO_COPY_ALL (1 << 5)
313
314/* Definitions of Service Layer Commands */
315#define SLCMD_ECHO_SYNC 0x00 /* PF/VF */
316#define SLCMD_MOVE_FLASH 0x06 /* PF only */
317#define SLCMD_MOVE_FLASH_FLAGS_MODE 0x03 /* bit 0 and 1 used for mode */
318#define SLCMD_MOVE_FLASH_FLAGS_DLOAD 0 /* mode: download */
319#define SLCMD_MOVE_FLASH_FLAGS_EMUL 1 /* mode: emulation */
320#define SLCMD_MOVE_FLASH_FLAGS_UPLOAD 2 /* mode: upload */
321#define SLCMD_MOVE_FLASH_FLAGS_VERIFY 3 /* mode: verify */
322#define SLCMD_MOVE_FLASH_FLAG_NOTAP (1 << 2)/* just dump DDCB and exit */
323#define SLCMD_MOVE_FLASH_FLAG_POLL (1 << 3)/* wait for RETC >= 0102 */
324#define SLCMD_MOVE_FLASH_FLAG_PARTITION (1 << 4)
325#define SLCMD_MOVE_FLASH_FLAG_ERASE (1 << 5)
326
327enum genwqe_card_state {
328 GENWQE_CARD_UNUSED = 0,
329 GENWQE_CARD_USED = 1,
330 GENWQE_CARD_FATAL_ERROR = 2,
331 GENWQE_CARD_STATE_MAX,
332};
333
334/* common struct for chip image exchange */
335struct genwqe_bitstream {
336 __u64 data_addr; /* pointer to image data */
337 __u32 size; /* size of image file */
338 __u32 crc; /* crc of this image */
339 __u64 target_addr; /* starting address in Flash */
340 __u32 partition; /* '0', '1', or 'v' */
341 __u32 uid; /* 1=host/x=dram */
342
343 __u64 slu_id; /* informational/sim: SluID */
344 __u64 app_id; /* informational/sim: AppID */
345
346 __u16 retc; /* returned from processing */
347 __u16 attn; /* attention code from processing */
348 __u32 progress; /* progress code from processing */
349};
350
351/* Issuing a specific DDCB command */
352#define DDCB_LENGTH 256 /* for debug data */
353#define DDCB_ASIV_LENGTH 104 /* len of the DDCB ASIV array */
354#define DDCB_ASIV_LENGTH_ATS 96 /* ASIV in ATS architecture */
355#define DDCB_ASV_LENGTH 64 /* len of the DDCB ASV array */
356#define DDCB_FIXUPS 12 /* maximum number of fixups */
357
358struct genwqe_debug_data {
359 char driver_version[64];
360 __u64 slu_unitcfg;
361 __u64 app_unitcfg;
362
363 __u8 ddcb_before[DDCB_LENGTH];
364 __u8 ddcb_prev[DDCB_LENGTH];
365 __u8 ddcb_finished[DDCB_LENGTH];
366};
367
368/*
369 * Address Translation Specification (ATS) definitions
370 *
371 * Each 4 bit within the ATS 64-bit word specify the required address
372 * translation at the defined offset.
373 *
374 * 63 LSB
375 * 6666.5555.5555.5544.4444.4443.3333.3333 ... 11
376 * 3210.9876.5432.1098.7654.3210.9876.5432 ... 1098.7654.3210
377 *
378 * offset: 0x00 0x08 0x10 0x18 0x20 0x28 0x30 0x38 ... 0x68 0x70 0x78
379 * res res res res ASIV ...
380 * The first 4 entries in the ATS word are reserved. The following nibbles
381 * each describe at an 8 byte offset the format of the required data.
382 */
383#define ATS_TYPE_DATA 0x0ull /* data */
384#define ATS_TYPE_FLAT_RD 0x4ull /* flat buffer read only */
385#define ATS_TYPE_FLAT_RDWR 0x5ull /* flat buffer read/write */
386#define ATS_TYPE_SGL_RD 0x6ull /* sgl read only */
387#define ATS_TYPE_SGL_RDWR 0x7ull /* sgl read/write */
388
389#define ATS_SET_FLAGS(_struct, _field, _flags) \
390 (((_flags) & 0xf) << (44 - (4 * (offsetof(_struct, _field) / 8))))
391
392#define ATS_GET_FLAGS(_ats, _byte_offs) \
393 (((_ats) >> (44 - (4 * ((_byte_offs) / 8)))) & 0xf)
394
395/**
396 * struct genwqe_ddcb_cmd - User parameter for generic DDCB commands
397 *
398 * On the way into the kernel the driver will read the whole data
399 * structure. On the way out the driver will not copy the ASIV data
400 * back to user-space.
401 */
402struct genwqe_ddcb_cmd {
403 /* START of data copied to/from driver */
404 __u64 next_addr; /* chaining genwqe_ddcb_cmd */
405 __u64 flags; /* reserved */
406
407 __u8 acfunc; /* accelerators functional unit */
408 __u8 cmd; /* command to execute */
409 __u8 asiv_length; /* used parameter length */
410 __u8 asv_length; /* length of valid return values */
411 __u16 cmdopts; /* command options */
412 __u16 retc; /* return code from processing */
413
414 __u16 attn; /* attention code from processing */
415 __u16 vcrc; /* variant crc16 */
416 __u32 progress; /* progress code from processing */
417
418 __u64 deque_ts; /* dequeue time stamp */
419 __u64 cmplt_ts; /* completion time stamp */
420 __u64 disp_ts; /* SW processing start */
421
422 /* move to end and avoid copy-back */
423 __u64 ddata_addr; /* collect debug data */
424
425 /* command specific values */
426 __u8 asv[DDCB_ASV_LENGTH];
427
428 /* END of data copied from driver */
429 union {
430 struct {
431 __u64 ats;
432 __u8 asiv[DDCB_ASIV_LENGTH_ATS];
433 };
434 /* used for flash update to keep it backward compatible */
435 __u8 __asiv[DDCB_ASIV_LENGTH];
436 };
437 /* END of data copied to driver */
438};
439
440#define GENWQE_IOC_CODE 0xa5
441
442/* Access functions */
443#define GENWQE_READ_REG64 _IOR(GENWQE_IOC_CODE, 30, struct genwqe_reg_io)
444#define GENWQE_WRITE_REG64 _IOW(GENWQE_IOC_CODE, 31, struct genwqe_reg_io)
445#define GENWQE_READ_REG32 _IOR(GENWQE_IOC_CODE, 32, struct genwqe_reg_io)
446#define GENWQE_WRITE_REG32 _IOW(GENWQE_IOC_CODE, 33, struct genwqe_reg_io)
447#define GENWQE_READ_REG16 _IOR(GENWQE_IOC_CODE, 34, struct genwqe_reg_io)
448#define GENWQE_WRITE_REG16 _IOW(GENWQE_IOC_CODE, 35, struct genwqe_reg_io)
449
450#define GENWQE_GET_CARD_STATE _IOR(GENWQE_IOC_CODE, 36, enum genwqe_card_state)
451
452/**
453 * struct genwqe_mem - Memory pinning/unpinning information
454 * @addr: virtual user space address
455 * @size: size of the area pin/dma-map/unmap
456 * direction: 0: read/1: read and write
457 *
458 * Avoid pinning and unpinning of memory pages dynamically. Instead
459 * the idea is to pin the whole buffer space required for DDCB
460 * opertionas in advance. The driver will reuse this pinning and the
461 * memory associated with it to setup the sglists for the DDCB
462 * requests without the need to allocate and free memory or map and
463 * unmap to get the DMA addresses.
464 *
465 * The inverse operation needs to be called after the pinning is not
466 * needed anymore. The pinnings else the pinnings will get removed
467 * after the device is closed. Note that pinnings will required
468 * memory.
469 */
470struct genwqe_mem {
471 __u64 addr;
472 __u64 size;
473 __u64 direction;
474 __u64 flags;
475};
476
477#define GENWQE_PIN_MEM _IOWR(GENWQE_IOC_CODE, 40, struct genwqe_mem)
478#define GENWQE_UNPIN_MEM _IOWR(GENWQE_IOC_CODE, 41, struct genwqe_mem)
479
480/*
481 * Generic synchronous DDCB execution interface.
482 * Synchronously execute a DDCB.
483 *
484 * Return: 0 on success or negative error code.
485 * -EINVAL: Invalid parameters (ASIV_LEN, ASV_LEN, illegal fixups
486 * no mappings found/could not create mappings
487 * -EFAULT: illegal addresses in fixups, purging failed
488 * -EBADMSG: enqueing failed, retc != DDCB_RETC_COMPLETE
489 */
490#define GENWQE_EXECUTE_DDCB \
491 _IOWR(GENWQE_IOC_CODE, 50, struct genwqe_ddcb_cmd)
492
493#define GENWQE_EXECUTE_RAW_DDCB \
494 _IOWR(GENWQE_IOC_CODE, 51, struct genwqe_ddcb_cmd)
495
496/* Service Layer functions (PF only) */
497#define GENWQE_SLU_UPDATE _IOWR(GENWQE_IOC_CODE, 80, struct genwqe_bitstream)
498#define GENWQE_SLU_READ _IOWR(GENWQE_IOC_CODE, 81, struct genwqe_bitstream)
499
500#endif /* __GENWQE_CARD_H__ */
diff --git a/include/uapi/linux/kexec.h b/include/uapi/linux/kexec.h
index 104838f65bc1..d6629d49a243 100644
--- a/include/uapi/linux/kexec.h
+++ b/include/uapi/linux/kexec.h
@@ -18,6 +18,7 @@
18 */ 18 */
19#define KEXEC_ARCH_DEFAULT ( 0 << 16) 19#define KEXEC_ARCH_DEFAULT ( 0 << 16)
20#define KEXEC_ARCH_386 ( 3 << 16) 20#define KEXEC_ARCH_386 ( 3 << 16)
21#define KEXEC_ARCH_68K ( 4 << 16)
21#define KEXEC_ARCH_X86_64 (62 << 16) 22#define KEXEC_ARCH_X86_64 (62 << 16)
22#define KEXEC_ARCH_PPC (20 << 16) 23#define KEXEC_ARCH_PPC (20 << 16)
23#define KEXEC_ARCH_PPC64 (21 << 16) 24#define KEXEC_ARCH_PPC64 (21 << 16)
diff --git a/include/uapi/linux/perf_event.h b/include/uapi/linux/perf_event.h
index 959d454f76a1..e244ed412745 100644
--- a/include/uapi/linux/perf_event.h
+++ b/include/uapi/linux/perf_event.h
@@ -725,6 +725,7 @@ enum perf_callchain_context {
725#define PERF_FLAG_FD_NO_GROUP (1U << 0) 725#define PERF_FLAG_FD_NO_GROUP (1U << 0)
726#define PERF_FLAG_FD_OUTPUT (1U << 1) 726#define PERF_FLAG_FD_OUTPUT (1U << 1)
727#define PERF_FLAG_PID_CGROUP (1U << 2) /* pid=cgroup id, per-cpu mode only */ 727#define PERF_FLAG_PID_CGROUP (1U << 2) /* pid=cgroup id, per-cpu mode only */
728#define PERF_FLAG_FD_CLOEXEC (1U << 3) /* O_CLOEXEC */
728 729
729union perf_mem_data_src { 730union perf_mem_data_src {
730 __u64 val; 731 __u64 val;
diff --git a/include/uapi/linux/sched.h b/include/uapi/linux/sched.h
index 5a0f945927ac..34f9d7387d13 100644
--- a/include/uapi/linux/sched.h
+++ b/include/uapi/linux/sched.h
@@ -39,8 +39,14 @@
39#define SCHED_BATCH 3 39#define SCHED_BATCH 3
40/* SCHED_ISO: reserved but not implemented yet */ 40/* SCHED_ISO: reserved but not implemented yet */
41#define SCHED_IDLE 5 41#define SCHED_IDLE 5
42#define SCHED_DEADLINE 6
43
42/* Can be ORed in to make sure the process is reverted back to SCHED_NORMAL on fork */ 44/* Can be ORed in to make sure the process is reverted back to SCHED_NORMAL on fork */
43#define SCHED_RESET_ON_FORK 0x40000000 45#define SCHED_RESET_ON_FORK 0x40000000
44 46
47/*
48 * For the sched_{set,get}attr() calls
49 */
50#define SCHED_FLAG_RESET_ON_FORK 0x01
45 51
46#endif /* _UAPI_LINUX_SCHED_H */ 52#endif /* _UAPI_LINUX_SCHED_H */
diff --git a/include/uapi/linux/zorro.h b/include/uapi/linux/zorro.h
new file mode 100644
index 000000000000..59d021b242ed
--- /dev/null
+++ b/include/uapi/linux/zorro.h
@@ -0,0 +1,113 @@
1/*
2 * linux/zorro.h -- Amiga AutoConfig (Zorro) Bus Definitions
3 *
4 * Copyright (C) 1995--2003 Geert Uytterhoeven
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive
8 * for more details.
9 */
10
11#ifndef _UAPI_LINUX_ZORRO_H
12#define _UAPI_LINUX_ZORRO_H
13
14#include <linux/types.h>
15
16
17 /*
18 * Each Zorro board has a 32-bit ID of the form
19 *
20 * mmmmmmmmmmmmmmmmppppppppeeeeeeee
21 *
22 * with
23 *
24 * mmmmmmmmmmmmmmmm 16-bit Manufacturer ID (assigned by CBM (sigh))
25 * pppppppp 8-bit Product ID (assigned by manufacturer)
26 * eeeeeeee 8-bit Extended Product ID (currently only used
27 * for some GVP boards)
28 */
29
30
31#define ZORRO_MANUF(id) ((id) >> 16)
32#define ZORRO_PROD(id) (((id) >> 8) & 0xff)
33#define ZORRO_EPC(id) ((id) & 0xff)
34
35#define ZORRO_ID(manuf, prod, epc) \
36 ((ZORRO_MANUF_##manuf << 16) | ((prod) << 8) | (epc))
37
38typedef __u32 zorro_id;
39
40
41/* Include the ID list */
42#include <linux/zorro_ids.h>
43
44
45 /*
46 * GVP identifies most of its products through the 'extended product code'
47 * (epc). The epc has to be ANDed with the GVP_PRODMASK before the
48 * identification.
49 */
50
51#define GVP_PRODMASK (0xf8)
52#define GVP_SCSICLKMASK (0x01)
53
54enum GVP_flags {
55 GVP_IO = 0x01,
56 GVP_ACCEL = 0x02,
57 GVP_SCSI = 0x04,
58 GVP_24BITDMA = 0x08,
59 GVP_25BITDMA = 0x10,
60 GVP_NOBANK = 0x20,
61 GVP_14MHZ = 0x40,
62};
63
64
65struct Node {
66 __be32 ln_Succ; /* Pointer to next (successor) */
67 __be32 ln_Pred; /* Pointer to previous (predecessor) */
68 __u8 ln_Type;
69 __s8 ln_Pri; /* Priority, for sorting */
70 __be32 ln_Name; /* ID string, null terminated */
71} __packed;
72
73struct ExpansionRom {
74 /* -First 16 bytes of the expansion ROM */
75 __u8 er_Type; /* Board type, size and flags */
76 __u8 er_Product; /* Product number, assigned by manufacturer */
77 __u8 er_Flags; /* Flags */
78 __u8 er_Reserved03; /* Must be zero ($ff inverted) */
79 __be16 er_Manufacturer; /* Unique ID, ASSIGNED BY COMMODORE-AMIGA! */
80 __be32 er_SerialNumber; /* Available for use by manufacturer */
81 __be16 er_InitDiagVec; /* Offset to optional "DiagArea" structure */
82 __u8 er_Reserved0c;
83 __u8 er_Reserved0d;
84 __u8 er_Reserved0e;
85 __u8 er_Reserved0f;
86} __packed;
87
88/* er_Type board type bits */
89#define ERT_TYPEMASK 0xc0
90#define ERT_ZORROII 0xc0
91#define ERT_ZORROIII 0x80
92
93/* other bits defined in er_Type */
94#define ERTB_MEMLIST 5 /* Link RAM into free memory list */
95#define ERTF_MEMLIST (1<<5)
96
97struct ConfigDev {
98 struct Node cd_Node;
99 __u8 cd_Flags; /* (read/write) */
100 __u8 cd_Pad; /* reserved */
101 struct ExpansionRom cd_Rom; /* copy of board's expansion ROM */
102 __be32 cd_BoardAddr; /* where in memory the board was placed */
103 __be32 cd_BoardSize; /* size of board in bytes */
104 __be16 cd_SlotAddr; /* which slot number (PRIVATE) */
105 __be16 cd_SlotSize; /* number of slots (PRIVATE) */
106 __be32 cd_Driver; /* pointer to node of driver */
107 __be32 cd_NextCD; /* linked list of drivers to config */
108 __be32 cd_Unused[4]; /* for whatever the driver wants */
109} __packed;
110
111#define ZORRO_NUM_AUTO 16
112
113#endif /* _UAPI_LINUX_ZORRO_H */
diff --git a/include/linux/zorro_ids.h b/include/uapi/linux/zorro_ids.h
index 74bc53bcfdcf..74bc53bcfdcf 100644
--- a/include/linux/zorro_ids.h
+++ b/include/uapi/linux/zorro_ids.h
diff --git a/include/xen/interface/callback.h b/include/xen/interface/callback.h
index 8c5fa0e20155..dc3193f4b581 100644
--- a/include/xen/interface/callback.h
+++ b/include/xen/interface/callback.h
@@ -36,7 +36,7 @@
36 * @extra_args == Operation-specific extra arguments (NULL if none). 36 * @extra_args == Operation-specific extra arguments (NULL if none).
37 */ 37 */
38 38
39/* ia64, x86: Callback for event delivery. */ 39/* x86: Callback for event delivery. */
40#define CALLBACKTYPE_event 0 40#define CALLBACKTYPE_event 0
41 41
42/* x86: Failsafe callback when guest state cannot be restored by Xen. */ 42/* x86: Failsafe callback when guest state cannot be restored by Xen. */
diff --git a/include/xen/interface/io/protocols.h b/include/xen/interface/io/protocols.h
index 056744b4b05e..545a14ba0bb3 100644
--- a/include/xen/interface/io/protocols.h
+++ b/include/xen/interface/io/protocols.h
@@ -3,7 +3,6 @@
3 3
4#define XEN_IO_PROTO_ABI_X86_32 "x86_32-abi" 4#define XEN_IO_PROTO_ABI_X86_32 "x86_32-abi"
5#define XEN_IO_PROTO_ABI_X86_64 "x86_64-abi" 5#define XEN_IO_PROTO_ABI_X86_64 "x86_64-abi"
6#define XEN_IO_PROTO_ABI_IA64 "ia64-abi"
7#define XEN_IO_PROTO_ABI_POWERPC64 "powerpc64-abi" 6#define XEN_IO_PROTO_ABI_POWERPC64 "powerpc64-abi"
8#define XEN_IO_PROTO_ABI_ARM "arm-abi" 7#define XEN_IO_PROTO_ABI_ARM "arm-abi"
9 8
@@ -11,8 +10,6 @@
11# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_32 10# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_32
12#elif defined(__x86_64__) 11#elif defined(__x86_64__)
13# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_64 12# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_X86_64
14#elif defined(__ia64__)
15# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_IA64
16#elif defined(__powerpc64__) 13#elif defined(__powerpc64__)
17# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_POWERPC64 14# define XEN_IO_PROTO_ABI_NATIVE XEN_IO_PROTO_ABI_POWERPC64
18#elif defined(__arm__) || defined(__aarch64__) 15#elif defined(__arm__) || defined(__aarch64__)