diff options
Diffstat (limited to 'include')
28 files changed, 868 insertions, 534 deletions
diff --git a/include/linux/backlight.h b/include/linux/backlight.h index 0f5f57858a23..8c4f884db6b4 100644 --- a/include/linux/backlight.h +++ b/include/linux/backlight.h | |||
| @@ -36,18 +36,18 @@ struct backlight_device; | |||
| 36 | struct fb_info; | 36 | struct fb_info; |
| 37 | 37 | ||
| 38 | struct backlight_ops { | 38 | struct backlight_ops { |
| 39 | unsigned int options; | 39 | const unsigned int options; |
| 40 | 40 | ||
| 41 | #define BL_CORE_SUSPENDRESUME (1 << 0) | 41 | #define BL_CORE_SUSPENDRESUME (1 << 0) |
| 42 | 42 | ||
| 43 | /* Notify the backlight driver some property has changed */ | 43 | /* Notify the backlight driver some property has changed */ |
| 44 | int (*update_status)(struct backlight_device *); | 44 | int (* const update_status)(struct backlight_device *); |
| 45 | /* Return the current backlight brightness (accounting for power, | 45 | /* Return the current backlight brightness (accounting for power, |
| 46 | fb_blank etc.) */ | 46 | fb_blank etc.) */ |
| 47 | int (*get_brightness)(struct backlight_device *); | 47 | int (* const get_brightness)(struct backlight_device *); |
| 48 | /* Check if given framebuffer device is the one bound to this backlight; | 48 | /* Check if given framebuffer device is the one bound to this backlight; |
| 49 | return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */ | 49 | return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */ |
| 50 | int (*check_fb)(struct fb_info *); | 50 | int (* const check_fb)(struct fb_info *); |
| 51 | }; | 51 | }; |
| 52 | 52 | ||
| 53 | /* This structure defines all the properties of a backlight */ | 53 | /* This structure defines all the properties of a backlight */ |
| @@ -86,7 +86,7 @@ struct backlight_device { | |||
| 86 | registered this device has been unloaded, and if class_get_devdata() | 86 | registered this device has been unloaded, and if class_get_devdata() |
| 87 | points to something in the body of that driver, it is also invalid. */ | 87 | points to something in the body of that driver, it is also invalid. */ |
| 88 | struct mutex ops_lock; | 88 | struct mutex ops_lock; |
| 89 | struct backlight_ops *ops; | 89 | const struct backlight_ops *ops; |
| 90 | 90 | ||
| 91 | /* The framebuffer notifier block */ | 91 | /* The framebuffer notifier block */ |
| 92 | struct notifier_block fb_notif; | 92 | struct notifier_block fb_notif; |
| @@ -103,7 +103,7 @@ static inline void backlight_update_status(struct backlight_device *bd) | |||
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | extern struct backlight_device *backlight_device_register(const char *name, | 105 | extern struct backlight_device *backlight_device_register(const char *name, |
| 106 | struct device *dev, void *devdata, struct backlight_ops *ops); | 106 | struct device *dev, void *devdata, const struct backlight_ops *ops); |
| 107 | extern void backlight_device_unregister(struct backlight_device *bd); | 107 | extern void backlight_device_unregister(struct backlight_device *bd); |
| 108 | extern void backlight_force_update(struct backlight_device *bd, | 108 | extern void backlight_force_update(struct backlight_device *bd, |
| 109 | enum backlight_update_reason reason); | 109 | enum backlight_update_reason reason); |
diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h index aece486ac734..cd4349bdc34e 100644 --- a/include/linux/binfmts.h +++ b/include/linux/binfmts.h | |||
| @@ -68,6 +68,14 @@ struct linux_binprm{ | |||
| 68 | 68 | ||
| 69 | #define BINPRM_MAX_RECURSION 4 | 69 | #define BINPRM_MAX_RECURSION 4 |
| 70 | 70 | ||
| 71 | /* Function parameter for binfmt->coredump */ | ||
| 72 | struct coredump_params { | ||
| 73 | long signr; | ||
| 74 | struct pt_regs *regs; | ||
| 75 | struct file *file; | ||
| 76 | unsigned long limit; | ||
| 77 | }; | ||
| 78 | |||
| 71 | /* | 79 | /* |
| 72 | * This structure defines the functions that are used to load the binary formats that | 80 | * This structure defines the functions that are used to load the binary formats that |
| 73 | * linux accepts. | 81 | * linux accepts. |
| @@ -77,7 +85,7 @@ struct linux_binfmt { | |||
| 77 | struct module *module; | 85 | struct module *module; |
| 78 | int (*load_binary)(struct linux_binprm *, struct pt_regs * regs); | 86 | int (*load_binary)(struct linux_binprm *, struct pt_regs * regs); |
| 79 | int (*load_shlib)(struct file *); | 87 | int (*load_shlib)(struct file *); |
| 80 | int (*core_dump)(long signr, struct pt_regs *regs, struct file *file, unsigned long limit); | 88 | int (*core_dump)(struct coredump_params *cprm); |
| 81 | unsigned long min_coredump; /* minimal dump size */ | 89 | unsigned long min_coredump; /* minimal dump size */ |
| 82 | int hasvdso; | 90 | int hasvdso; |
| 83 | }; | 91 | }; |
diff --git a/include/linux/decompress/mm.h b/include/linux/decompress/mm.h index 12ff8c3f1d05..5032b9a31ae7 100644 --- a/include/linux/decompress/mm.h +++ b/include/linux/decompress/mm.h | |||
| @@ -25,7 +25,7 @@ static void *malloc(int size) | |||
| 25 | void *p; | 25 | void *p; |
| 26 | 26 | ||
| 27 | if (size < 0) | 27 | if (size < 0) |
| 28 | error("Malloc error"); | 28 | return NULL; |
| 29 | if (!malloc_ptr) | 29 | if (!malloc_ptr) |
| 30 | malloc_ptr = free_mem_ptr; | 30 | malloc_ptr = free_mem_ptr; |
| 31 | 31 | ||
| @@ -35,7 +35,7 @@ static void *malloc(int size) | |||
| 35 | malloc_ptr += size; | 35 | malloc_ptr += size; |
| 36 | 36 | ||
| 37 | if (free_mem_end_ptr && malloc_ptr >= free_mem_end_ptr) | 37 | if (free_mem_end_ptr && malloc_ptr >= free_mem_end_ptr) |
| 38 | error("Out of memory"); | 38 | return NULL; |
| 39 | 39 | ||
| 40 | malloc_count++; | 40 | malloc_count++; |
| 41 | return p; | 41 | return p; |
diff --git a/include/linux/elf.h b/include/linux/elf.h index 90a4ed0ea0e5..0cc4d55151b7 100644 --- a/include/linux/elf.h +++ b/include/linux/elf.h | |||
| @@ -361,7 +361,7 @@ typedef struct elf64_shdr { | |||
| 361 | #define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ | 361 | #define NT_PPC_VSX 0x102 /* PowerPC VSX registers */ |
| 362 | #define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ | 362 | #define NT_386_TLS 0x200 /* i386 TLS slots (struct user_desc) */ |
| 363 | #define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ | 363 | #define NT_386_IOPERM 0x201 /* x86 io permission bitmap (1=deny) */ |
| 364 | #define NT_PRXSTATUS 0x300 /* s390 upper register halves */ | 364 | #define NT_S390_HIGH_GPRS 0x300 /* s390 upper register halves */ |
| 365 | 365 | ||
| 366 | 366 | ||
| 367 | /* Note header in a PT_NOTE section */ | 367 | /* Note header in a PT_NOTE section */ |
diff --git a/include/linux/enclosure.h b/include/linux/enclosure.h index 90d1c2184112..9a33c5f7e126 100644 --- a/include/linux/enclosure.h +++ b/include/linux/enclosure.h | |||
| @@ -42,6 +42,8 @@ enum enclosure_status { | |||
| 42 | ENCLOSURE_STATUS_NOT_INSTALLED, | 42 | ENCLOSURE_STATUS_NOT_INSTALLED, |
| 43 | ENCLOSURE_STATUS_UNKNOWN, | 43 | ENCLOSURE_STATUS_UNKNOWN, |
| 44 | ENCLOSURE_STATUS_UNAVAILABLE, | 44 | ENCLOSURE_STATUS_UNAVAILABLE, |
| 45 | /* last element for counting purposes */ | ||
| 46 | ENCLOSURE_STATUS_MAX | ||
| 45 | }; | 47 | }; |
| 46 | 48 | ||
| 47 | /* SFF-8485 activity light settings */ | 49 | /* SFF-8485 activity light settings */ |
diff --git a/include/linux/fs.h b/include/linux/fs.h index cca191933ff6..7e3012e0ac06 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -1624,8 +1624,6 @@ struct super_operations { | |||
| 1624 | * on the bit address once it is done. | 1624 | * on the bit address once it is done. |
| 1625 | * | 1625 | * |
| 1626 | * Q: What is the difference between I_WILL_FREE and I_FREEING? | 1626 | * Q: What is the difference between I_WILL_FREE and I_FREEING? |
| 1627 | * Q: igrab() only checks on (I_FREEING|I_WILL_FREE). Should it also check on | ||
| 1628 | * I_CLEAR? If not, why? | ||
| 1629 | */ | 1627 | */ |
| 1630 | #define I_DIRTY_SYNC 1 | 1628 | #define I_DIRTY_SYNC 1 |
| 1631 | #define I_DIRTY_DATASYNC 2 | 1629 | #define I_DIRTY_DATASYNC 2 |
| @@ -2464,5 +2462,8 @@ int proc_nr_files(struct ctl_table *table, int write, | |||
| 2464 | 2462 | ||
| 2465 | int __init get_filesystem_list(char *buf); | 2463 | int __init get_filesystem_list(char *buf); |
| 2466 | 2464 | ||
| 2465 | #define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE]) | ||
| 2466 | #define OPEN_FMODE(flag) ((__force fmode_t)((flag + 1) & O_ACCMODE)) | ||
| 2467 | |||
| 2467 | #endif /* __KERNEL__ */ | 2468 | #endif /* __KERNEL__ */ |
| 2468 | #endif /* _LINUX_FS_H */ | 2469 | #endif /* _LINUX_FS_H */ |
diff --git a/include/linux/init_task.h b/include/linux/init_task.h index 5ed8b9c50355..abec69b63d7e 100644 --- a/include/linux/init_task.h +++ b/include/linux/init_task.h | |||
| @@ -111,12 +111,6 @@ extern struct cred init_cred; | |||
| 111 | # define INIT_PERF_EVENTS(tsk) | 111 | # define INIT_PERF_EVENTS(tsk) |
| 112 | #endif | 112 | #endif |
| 113 | 113 | ||
| 114 | #ifdef CONFIG_FS_JOURNAL_INFO | ||
| 115 | #define INIT_JOURNAL_INFO .journal_info = NULL, | ||
| 116 | #else | ||
| 117 | #define INIT_JOURNAL_INFO | ||
| 118 | #endif | ||
| 119 | |||
| 120 | /* | 114 | /* |
| 121 | * INIT_TASK is used to set up the first task table, touch at | 115 | * INIT_TASK is used to set up the first task table, touch at |
| 122 | * your own risk!. Base=0, limit=0x1fffff (=2MB) | 116 | * your own risk!. Base=0, limit=0x1fffff (=2MB) |
| @@ -168,6 +162,7 @@ extern struct cred init_cred; | |||
| 168 | .signal = {{0}}}, \ | 162 | .signal = {{0}}}, \ |
| 169 | .blocked = {{0}}, \ | 163 | .blocked = {{0}}, \ |
| 170 | .alloc_lock = __SPIN_LOCK_UNLOCKED(tsk.alloc_lock), \ | 164 | .alloc_lock = __SPIN_LOCK_UNLOCKED(tsk.alloc_lock), \ |
| 165 | .journal_info = NULL, \ | ||
| 171 | .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \ | 166 | .cpu_timers = INIT_CPU_TIMERS(tsk.cpu_timers), \ |
| 172 | .fs_excl = ATOMIC_INIT(0), \ | 167 | .fs_excl = ATOMIC_INIT(0), \ |
| 173 | .pi_lock = __RAW_SPIN_LOCK_UNLOCKED(tsk.pi_lock), \ | 168 | .pi_lock = __RAW_SPIN_LOCK_UNLOCKED(tsk.pi_lock), \ |
| @@ -178,7 +173,6 @@ extern struct cred init_cred; | |||
| 178 | [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \ | 173 | [PIDTYPE_SID] = INIT_PID_LINK(PIDTYPE_SID), \ |
| 179 | }, \ | 174 | }, \ |
| 180 | .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \ | 175 | .dirties = INIT_PROP_LOCAL_SINGLE(dirties), \ |
| 181 | INIT_JOURNAL_INFO \ | ||
| 182 | INIT_IDS \ | 176 | INIT_IDS \ |
| 183 | INIT_PERF_EVENTS(tsk) \ | 177 | INIT_PERF_EVENTS(tsk) \ |
| 184 | INIT_TRACE_IRQFLAGS \ | 178 | INIT_TRACE_IRQFLAGS \ |
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h index ad6bdf5a5970..486e8ad3bb50 100644 --- a/include/linux/kfifo.h +++ b/include/linux/kfifo.h | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * A simple kernel FIFO implementation. | 2 | * A generic kernel FIFO implementation. |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2009 Stefani Seibold <stefani@seibold.net> | ||
| 4 | * Copyright (C) 2004 Stelian Pop <stelian@popies.net> | 5 | * Copyright (C) 2004 Stelian Pop <stelian@popies.net> |
| 5 | * | 6 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
| @@ -18,6 +19,25 @@ | |||
| 18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 19 | * | 20 | * |
| 20 | */ | 21 | */ |
| 22 | |||
| 23 | /* | ||
| 24 | * Howto porting drivers to the new generic fifo API: | ||
| 25 | * | ||
| 26 | * - Modify the declaration of the "struct kfifo *" object into a | ||
| 27 | * in-place "struct kfifo" object | ||
| 28 | * - Init the in-place object with kfifo_alloc() or kfifo_init() | ||
| 29 | * Note: The address of the in-place "struct kfifo" object must be | ||
| 30 | * passed as the first argument to this functions | ||
| 31 | * - Replace the use of __kfifo_put into kfifo_in and __kfifo_get | ||
| 32 | * into kfifo_out | ||
| 33 | * - Replace the use of kfifo_put into kfifo_in_locked and kfifo_get | ||
| 34 | * into kfifo_out_locked | ||
| 35 | * Note: the spinlock pointer formerly passed to kfifo_init/kfifo_alloc | ||
| 36 | * must be passed now to the kfifo_in_locked and kfifo_out_locked | ||
| 37 | * as the last parameter. | ||
| 38 | * - All formerly name __kfifo_* functions has been renamed into kfifo_* | ||
| 39 | */ | ||
| 40 | |||
| 21 | #ifndef _LINUX_KFIFO_H | 41 | #ifndef _LINUX_KFIFO_H |
| 22 | #define _LINUX_KFIFO_H | 42 | #define _LINUX_KFIFO_H |
| 23 | 43 | ||
| @@ -29,124 +49,563 @@ struct kfifo { | |||
| 29 | unsigned int size; /* the size of the allocated buffer */ | 49 | unsigned int size; /* the size of the allocated buffer */ |
| 30 | unsigned int in; /* data is added at offset (in % size) */ | 50 | unsigned int in; /* data is added at offset (in % size) */ |
| 31 | unsigned int out; /* data is extracted from off. (out % size) */ | 51 | unsigned int out; /* data is extracted from off. (out % size) */ |
| 32 | spinlock_t *lock; /* protects concurrent modifications */ | ||
| 33 | }; | 52 | }; |
| 34 | 53 | ||
| 35 | extern struct kfifo *kfifo_init(unsigned char *buffer, unsigned int size, | 54 | /* |
| 36 | gfp_t gfp_mask, spinlock_t *lock); | 55 | * Macros for declaration and initialization of the kfifo datatype |
| 37 | extern struct kfifo *kfifo_alloc(unsigned int size, gfp_t gfp_mask, | 56 | */ |
| 38 | spinlock_t *lock); | 57 | |
| 58 | /* helper macro */ | ||
| 59 | #define __kfifo_initializer(s, b) \ | ||
| 60 | (struct kfifo) { \ | ||
| 61 | .size = s, \ | ||
| 62 | .in = 0, \ | ||
| 63 | .out = 0, \ | ||
| 64 | .buffer = b \ | ||
| 65 | } | ||
| 66 | |||
| 67 | /** | ||
| 68 | * DECLARE_KFIFO - macro to declare a kfifo and the associated buffer | ||
| 69 | * @name: name of the declared kfifo datatype | ||
| 70 | * @size: size of the fifo buffer | ||
| 71 | * | ||
| 72 | * Note: the macro can be used inside struct or union declaration | ||
| 73 | * Note: the macro creates two objects: | ||
| 74 | * A kfifo object with the given name and a buffer for the kfifo | ||
| 75 | * object named name##kfifo_buffer | ||
| 76 | */ | ||
| 77 | #define DECLARE_KFIFO(name, size) \ | ||
| 78 | union { \ | ||
| 79 | struct kfifo name; \ | ||
| 80 | unsigned char name##kfifo_buffer[size + sizeof(struct kfifo)]; \ | ||
| 81 | } | ||
| 82 | |||
| 83 | /** | ||
| 84 | * INIT_KFIFO - Initialize a kfifo declared by DECLARED_KFIFO | ||
| 85 | * @name: name of the declared kfifo datatype | ||
| 86 | * @size: size of the fifo buffer | ||
| 87 | */ | ||
| 88 | #define INIT_KFIFO(name) \ | ||
| 89 | name = __kfifo_initializer(sizeof(name##kfifo_buffer) - \ | ||
| 90 | sizeof(struct kfifo), name##kfifo_buffer) | ||
| 91 | |||
| 92 | /** | ||
| 93 | * DEFINE_KFIFO - macro to define and initialize a kfifo | ||
| 94 | * @name: name of the declared kfifo datatype | ||
| 95 | * @size: size of the fifo buffer | ||
| 96 | * | ||
| 97 | * Note: the macro can be used for global and local kfifo data type variables | ||
| 98 | * Note: the macro creates two objects: | ||
| 99 | * A kfifo object with the given name and a buffer for the kfifo | ||
| 100 | * object named name##kfifo_buffer | ||
| 101 | */ | ||
| 102 | #define DEFINE_KFIFO(name, size) \ | ||
| 103 | unsigned char name##kfifo_buffer[size]; \ | ||
| 104 | struct kfifo name = __kfifo_initializer(size, name##kfifo_buffer) | ||
| 105 | |||
| 106 | #undef __kfifo_initializer | ||
| 107 | |||
| 108 | extern void kfifo_init(struct kfifo *fifo, unsigned char *buffer, | ||
| 109 | unsigned int size); | ||
| 110 | extern __must_check int kfifo_alloc(struct kfifo *fifo, unsigned int size, | ||
| 111 | gfp_t gfp_mask); | ||
| 39 | extern void kfifo_free(struct kfifo *fifo); | 112 | extern void kfifo_free(struct kfifo *fifo); |
| 40 | extern unsigned int __kfifo_put(struct kfifo *fifo, | 113 | extern unsigned int kfifo_in(struct kfifo *fifo, |
| 41 | const unsigned char *buffer, unsigned int len); | 114 | const unsigned char *from, unsigned int len); |
| 42 | extern unsigned int __kfifo_get(struct kfifo *fifo, | 115 | extern __must_check unsigned int kfifo_out(struct kfifo *fifo, |
| 43 | unsigned char *buffer, unsigned int len); | 116 | unsigned char *to, unsigned int len); |
| 44 | 117 | ||
| 45 | /** | 118 | /** |
| 46 | * __kfifo_reset - removes the entire FIFO contents, no locking version | 119 | * kfifo_reset - removes the entire FIFO contents |
| 47 | * @fifo: the fifo to be emptied. | 120 | * @fifo: the fifo to be emptied. |
| 48 | */ | 121 | */ |
| 49 | static inline void __kfifo_reset(struct kfifo *fifo) | 122 | static inline void kfifo_reset(struct kfifo *fifo) |
| 50 | { | 123 | { |
| 51 | fifo->in = fifo->out = 0; | 124 | fifo->in = fifo->out = 0; |
| 52 | } | 125 | } |
| 53 | 126 | ||
| 54 | /** | 127 | /** |
| 55 | * kfifo_reset - removes the entire FIFO contents | 128 | * kfifo_reset_out - skip FIFO contents |
| 56 | * @fifo: the fifo to be emptied. | 129 | * @fifo: the fifo to be emptied. |
| 57 | */ | 130 | */ |
| 58 | static inline void kfifo_reset(struct kfifo *fifo) | 131 | static inline void kfifo_reset_out(struct kfifo *fifo) |
| 59 | { | 132 | { |
| 60 | unsigned long flags; | 133 | smp_mb(); |
| 134 | fifo->out = fifo->in; | ||
| 135 | } | ||
| 61 | 136 | ||
| 62 | spin_lock_irqsave(fifo->lock, flags); | 137 | /** |
| 138 | * kfifo_size - returns the size of the fifo in bytes | ||
| 139 | * @fifo: the fifo to be used. | ||
| 140 | */ | ||
| 141 | static inline __must_check unsigned int kfifo_size(struct kfifo *fifo) | ||
| 142 | { | ||
| 143 | return fifo->size; | ||
| 144 | } | ||
| 63 | 145 | ||
| 64 | __kfifo_reset(fifo); | 146 | /** |
| 147 | * kfifo_len - returns the number of used bytes in the FIFO | ||
| 148 | * @fifo: the fifo to be used. | ||
| 149 | */ | ||
| 150 | static inline unsigned int kfifo_len(struct kfifo *fifo) | ||
| 151 | { | ||
| 152 | register unsigned int out; | ||
| 65 | 153 | ||
| 66 | spin_unlock_irqrestore(fifo->lock, flags); | 154 | out = fifo->out; |
| 155 | smp_rmb(); | ||
| 156 | return fifo->in - out; | ||
| 67 | } | 157 | } |
| 68 | 158 | ||
| 69 | /** | 159 | /** |
| 70 | * kfifo_put - puts some data into the FIFO | 160 | * kfifo_is_empty - returns true if the fifo is empty |
| 71 | * @fifo: the fifo to be used. | 161 | * @fifo: the fifo to be used. |
| 72 | * @buffer: the data to be added. | 162 | */ |
| 73 | * @len: the length of the data to be added. | 163 | static inline __must_check int kfifo_is_empty(struct kfifo *fifo) |
| 164 | { | ||
| 165 | return fifo->in == fifo->out; | ||
| 166 | } | ||
| 167 | |||
| 168 | /** | ||
| 169 | * kfifo_is_full - returns true if the fifo is full | ||
| 170 | * @fifo: the fifo to be used. | ||
| 171 | */ | ||
| 172 | static inline __must_check int kfifo_is_full(struct kfifo *fifo) | ||
| 173 | { | ||
| 174 | return kfifo_len(fifo) == kfifo_size(fifo); | ||
| 175 | } | ||
| 176 | |||
| 177 | /** | ||
| 178 | * kfifo_avail - returns the number of bytes available in the FIFO | ||
| 179 | * @fifo: the fifo to be used. | ||
| 180 | */ | ||
| 181 | static inline __must_check unsigned int kfifo_avail(struct kfifo *fifo) | ||
| 182 | { | ||
| 183 | return kfifo_size(fifo) - kfifo_len(fifo); | ||
| 184 | } | ||
| 185 | |||
| 186 | /** | ||
| 187 | * kfifo_in_locked - puts some data into the FIFO using a spinlock for locking | ||
| 188 | * @fifo: the fifo to be used. | ||
| 189 | * @from: the data to be added. | ||
| 190 | * @n: the length of the data to be added. | ||
| 191 | * @lock: pointer to the spinlock to use for locking. | ||
| 74 | * | 192 | * |
| 75 | * This function copies at most @len bytes from the @buffer into | 193 | * This function copies at most @len bytes from the @from buffer into |
| 76 | * the FIFO depending on the free space, and returns the number of | 194 | * the FIFO depending on the free space, and returns the number of |
| 77 | * bytes copied. | 195 | * bytes copied. |
| 78 | */ | 196 | */ |
| 79 | static inline unsigned int kfifo_put(struct kfifo *fifo, | 197 | static inline unsigned int kfifo_in_locked(struct kfifo *fifo, |
| 80 | const unsigned char *buffer, unsigned int len) | 198 | const unsigned char *from, unsigned int n, spinlock_t *lock) |
| 81 | { | 199 | { |
| 82 | unsigned long flags; | 200 | unsigned long flags; |
| 83 | unsigned int ret; | 201 | unsigned int ret; |
| 84 | 202 | ||
| 85 | spin_lock_irqsave(fifo->lock, flags); | 203 | spin_lock_irqsave(lock, flags); |
| 86 | 204 | ||
| 87 | ret = __kfifo_put(fifo, buffer, len); | 205 | ret = kfifo_in(fifo, from, n); |
| 88 | 206 | ||
| 89 | spin_unlock_irqrestore(fifo->lock, flags); | 207 | spin_unlock_irqrestore(lock, flags); |
| 90 | 208 | ||
| 91 | return ret; | 209 | return ret; |
| 92 | } | 210 | } |
| 93 | 211 | ||
| 94 | /** | 212 | /** |
| 95 | * kfifo_get - gets some data from the FIFO | 213 | * kfifo_out_locked - gets some data from the FIFO using a spinlock for locking |
| 96 | * @fifo: the fifo to be used. | 214 | * @fifo: the fifo to be used. |
| 97 | * @buffer: where the data must be copied. | 215 | * @to: where the data must be copied. |
| 98 | * @len: the size of the destination buffer. | 216 | * @n: the size of the destination buffer. |
| 217 | * @lock: pointer to the spinlock to use for locking. | ||
| 99 | * | 218 | * |
| 100 | * This function copies at most @len bytes from the FIFO into the | 219 | * This function copies at most @len bytes from the FIFO into the |
| 101 | * @buffer and returns the number of copied bytes. | 220 | * @to buffer and returns the number of copied bytes. |
| 102 | */ | 221 | */ |
| 103 | static inline unsigned int kfifo_get(struct kfifo *fifo, | 222 | static inline __must_check unsigned int kfifo_out_locked(struct kfifo *fifo, |
| 104 | unsigned char *buffer, unsigned int len) | 223 | unsigned char *to, unsigned int n, spinlock_t *lock) |
| 105 | { | 224 | { |
| 106 | unsigned long flags; | 225 | unsigned long flags; |
| 107 | unsigned int ret; | 226 | unsigned int ret; |
| 108 | 227 | ||
| 109 | spin_lock_irqsave(fifo->lock, flags); | 228 | spin_lock_irqsave(lock, flags); |
| 110 | 229 | ||
| 111 | ret = __kfifo_get(fifo, buffer, len); | 230 | ret = kfifo_out(fifo, to, n); |
| 112 | 231 | ||
| 113 | /* | 232 | /* |
| 114 | * optimization: if the FIFO is empty, set the indices to 0 | 233 | * optimization: if the FIFO is empty, set the indices to 0 |
| 115 | * so we don't wrap the next time | 234 | * so we don't wrap the next time |
| 116 | */ | 235 | */ |
| 117 | if (fifo->in == fifo->out) | 236 | if (kfifo_is_empty(fifo)) |
| 118 | fifo->in = fifo->out = 0; | 237 | kfifo_reset(fifo); |
| 238 | |||
| 239 | spin_unlock_irqrestore(lock, flags); | ||
| 240 | |||
| 241 | return ret; | ||
| 242 | } | ||
| 243 | |||
| 244 | extern void kfifo_skip(struct kfifo *fifo, unsigned int len); | ||
| 245 | |||
| 246 | extern __must_check unsigned int kfifo_from_user(struct kfifo *fifo, | ||
| 247 | const void __user *from, unsigned int n); | ||
| 248 | |||
| 249 | extern __must_check unsigned int kfifo_to_user(struct kfifo *fifo, | ||
| 250 | void __user *to, unsigned int n); | ||
| 251 | |||
| 252 | /** | ||
| 253 | * __kfifo_add_out internal helper function for updating the out offset | ||
| 254 | */ | ||
| 255 | static inline void __kfifo_add_out(struct kfifo *fifo, | ||
| 256 | unsigned int off) | ||
| 257 | { | ||
| 258 | smp_mb(); | ||
| 259 | fifo->out += off; | ||
| 260 | } | ||
| 261 | |||
| 262 | /** | ||
| 263 | * __kfifo_add_in internal helper function for updating the in offset | ||
| 264 | */ | ||
| 265 | static inline void __kfifo_add_in(struct kfifo *fifo, | ||
| 266 | unsigned int off) | ||
| 267 | { | ||
| 268 | smp_wmb(); | ||
| 269 | fifo->in += off; | ||
| 270 | } | ||
| 271 | |||
| 272 | /** | ||
| 273 | * __kfifo_off internal helper function for calculating the index of a | ||
| 274 | * given offeset | ||
| 275 | */ | ||
| 276 | static inline unsigned int __kfifo_off(struct kfifo *fifo, unsigned int off) | ||
| 277 | { | ||
| 278 | return off & (fifo->size - 1); | ||
| 279 | } | ||
| 280 | |||
| 281 | /** | ||
| 282 | * __kfifo_peek_n internal helper function for determinate the length of | ||
| 283 | * the next record in the fifo | ||
| 284 | */ | ||
| 285 | static inline unsigned int __kfifo_peek_n(struct kfifo *fifo, | ||
| 286 | unsigned int recsize) | ||
| 287 | { | ||
| 288 | #define __KFIFO_GET(fifo, off, shift) \ | ||
| 289 | ((fifo)->buffer[__kfifo_off((fifo), (fifo)->out+(off))] << (shift)) | ||
| 290 | |||
| 291 | unsigned int l; | ||
| 292 | |||
| 293 | l = __KFIFO_GET(fifo, 0, 0); | ||
| 294 | |||
| 295 | if (--recsize) | ||
| 296 | l |= __KFIFO_GET(fifo, 1, 8); | ||
| 297 | |||
| 298 | return l; | ||
| 299 | #undef __KFIFO_GET | ||
| 300 | } | ||
| 301 | |||
| 302 | /** | ||
| 303 | * __kfifo_poke_n internal helper function for storing the length of | ||
| 304 | * the next record into the fifo | ||
| 305 | */ | ||
| 306 | static inline void __kfifo_poke_n(struct kfifo *fifo, | ||
| 307 | unsigned int recsize, unsigned int n) | ||
| 308 | { | ||
| 309 | #define __KFIFO_PUT(fifo, off, val, shift) \ | ||
| 310 | ( \ | ||
| 311 | (fifo)->buffer[__kfifo_off((fifo), (fifo)->in+(off))] = \ | ||
| 312 | (unsigned char)((val) >> (shift)) \ | ||
| 313 | ) | ||
| 119 | 314 | ||
| 120 | spin_unlock_irqrestore(fifo->lock, flags); | 315 | __KFIFO_PUT(fifo, 0, n, 0); |
| 121 | 316 | ||
| 317 | if (--recsize) | ||
| 318 | __KFIFO_PUT(fifo, 1, n, 8); | ||
| 319 | #undef __KFIFO_PUT | ||
| 320 | } | ||
| 321 | |||
| 322 | /** | ||
| 323 | * __kfifo_in_... internal functions for put date into the fifo | ||
| 324 | * do not call it directly, use kfifo_in_rec() instead | ||
| 325 | */ | ||
| 326 | extern unsigned int __kfifo_in_n(struct kfifo *fifo, | ||
| 327 | const void *from, unsigned int n, unsigned int recsize); | ||
| 328 | |||
| 329 | extern unsigned int __kfifo_in_generic(struct kfifo *fifo, | ||
| 330 | const void *from, unsigned int n, unsigned int recsize); | ||
| 331 | |||
| 332 | static inline unsigned int __kfifo_in_rec(struct kfifo *fifo, | ||
| 333 | const void *from, unsigned int n, unsigned int recsize) | ||
| 334 | { | ||
| 335 | unsigned int ret; | ||
| 336 | |||
| 337 | ret = __kfifo_in_n(fifo, from, n, recsize); | ||
| 338 | |||
| 339 | if (likely(ret == 0)) { | ||
| 340 | if (recsize) | ||
| 341 | __kfifo_poke_n(fifo, recsize, n); | ||
| 342 | __kfifo_add_in(fifo, n + recsize); | ||
| 343 | } | ||
| 122 | return ret; | 344 | return ret; |
| 123 | } | 345 | } |
| 124 | 346 | ||
| 125 | /** | 347 | /** |
| 126 | * __kfifo_len - returns the number of bytes available in the FIFO, no locking version | 348 | * kfifo_in_rec - puts some record data into the FIFO |
| 127 | * @fifo: the fifo to be used. | 349 | * @fifo: the fifo to be used. |
| 350 | * @from: the data to be added. | ||
| 351 | * @n: the length of the data to be added. | ||
| 352 | * @recsize: size of record field | ||
| 353 | * | ||
| 354 | * This function copies @n bytes from the @from into the FIFO and returns | ||
| 355 | * the number of bytes which cannot be copied. | ||
| 356 | * A returned value greater than the @n value means that the record doesn't | ||
| 357 | * fit into the buffer. | ||
| 358 | * | ||
| 359 | * Note that with only one concurrent reader and one concurrent | ||
| 360 | * writer, you don't need extra locking to use these functions. | ||
| 128 | */ | 361 | */ |
| 129 | static inline unsigned int __kfifo_len(struct kfifo *fifo) | 362 | static inline __must_check unsigned int kfifo_in_rec(struct kfifo *fifo, |
| 363 | void *from, unsigned int n, unsigned int recsize) | ||
| 130 | { | 364 | { |
| 131 | return fifo->in - fifo->out; | 365 | if (!__builtin_constant_p(recsize)) |
| 366 | return __kfifo_in_generic(fifo, from, n, recsize); | ||
| 367 | return __kfifo_in_rec(fifo, from, n, recsize); | ||
| 132 | } | 368 | } |
| 133 | 369 | ||
| 134 | /** | 370 | /** |
| 135 | * kfifo_len - returns the number of bytes available in the FIFO | 371 | * __kfifo_out_... internal functions for get date from the fifo |
| 372 | * do not call it directly, use kfifo_out_rec() instead | ||
| 373 | */ | ||
| 374 | extern unsigned int __kfifo_out_n(struct kfifo *fifo, | ||
| 375 | void *to, unsigned int reclen, unsigned int recsize); | ||
| 376 | |||
| 377 | extern unsigned int __kfifo_out_generic(struct kfifo *fifo, | ||
| 378 | void *to, unsigned int n, | ||
| 379 | unsigned int recsize, unsigned int *total); | ||
| 380 | |||
| 381 | static inline unsigned int __kfifo_out_rec(struct kfifo *fifo, | ||
| 382 | void *to, unsigned int n, unsigned int recsize, | ||
| 383 | unsigned int *total) | ||
| 384 | { | ||
| 385 | unsigned int l; | ||
| 386 | |||
| 387 | if (!recsize) { | ||
| 388 | l = n; | ||
| 389 | if (total) | ||
| 390 | *total = l; | ||
| 391 | } else { | ||
| 392 | l = __kfifo_peek_n(fifo, recsize); | ||
| 393 | if (total) | ||
| 394 | *total = l; | ||
| 395 | if (n < l) | ||
| 396 | return l; | ||
| 397 | } | ||
| 398 | |||
| 399 | return __kfifo_out_n(fifo, to, l, recsize); | ||
| 400 | } | ||
| 401 | |||
| 402 | /** | ||
| 403 | * kfifo_out_rec - gets some record data from the FIFO | ||
| 136 | * @fifo: the fifo to be used. | 404 | * @fifo: the fifo to be used. |
| 405 | * @to: where the data must be copied. | ||
| 406 | * @n: the size of the destination buffer. | ||
| 407 | * @recsize: size of record field | ||
| 408 | * @total: pointer where the total number of to copied bytes should stored | ||
| 409 | * | ||
| 410 | * This function copies at most @n bytes from the FIFO to @to and returns the | ||
| 411 | * number of bytes which cannot be copied. | ||
| 412 | * A returned value greater than the @n value means that the record doesn't | ||
| 413 | * fit into the @to buffer. | ||
| 414 | * | ||
| 415 | * Note that with only one concurrent reader and one concurrent | ||
| 416 | * writer, you don't need extra locking to use these functions. | ||
| 137 | */ | 417 | */ |
| 138 | static inline unsigned int kfifo_len(struct kfifo *fifo) | 418 | static inline __must_check unsigned int kfifo_out_rec(struct kfifo *fifo, |
| 419 | void *to, unsigned int n, unsigned int recsize, | ||
| 420 | unsigned int *total) | ||
| 421 | |||
| 139 | { | 422 | { |
| 140 | unsigned long flags; | 423 | if (!__builtin_constant_p(recsize)) |
| 141 | unsigned int ret; | 424 | return __kfifo_out_generic(fifo, to, n, recsize, total); |
| 425 | return __kfifo_out_rec(fifo, to, n, recsize, total); | ||
| 426 | } | ||
| 427 | |||
| 428 | /** | ||
| 429 | * __kfifo_from_user_... internal functions for transfer from user space into | ||
| 430 | * the fifo. do not call it directly, use kfifo_from_user_rec() instead | ||
| 431 | */ | ||
| 432 | extern unsigned int __kfifo_from_user_n(struct kfifo *fifo, | ||
| 433 | const void __user *from, unsigned int n, unsigned int recsize); | ||
| 142 | 434 | ||
| 143 | spin_lock_irqsave(fifo->lock, flags); | 435 | extern unsigned int __kfifo_from_user_generic(struct kfifo *fifo, |
| 436 | const void __user *from, unsigned int n, unsigned int recsize); | ||
| 144 | 437 | ||
| 145 | ret = __kfifo_len(fifo); | 438 | static inline unsigned int __kfifo_from_user_rec(struct kfifo *fifo, |
| 439 | const void __user *from, unsigned int n, unsigned int recsize) | ||
| 440 | { | ||
| 441 | unsigned int ret; | ||
| 146 | 442 | ||
| 147 | spin_unlock_irqrestore(fifo->lock, flags); | 443 | ret = __kfifo_from_user_n(fifo, from, n, recsize); |
| 148 | 444 | ||
| 445 | if (likely(ret == 0)) { | ||
| 446 | if (recsize) | ||
| 447 | __kfifo_poke_n(fifo, recsize, n); | ||
| 448 | __kfifo_add_in(fifo, n + recsize); | ||
| 449 | } | ||
| 149 | return ret; | 450 | return ret; |
| 150 | } | 451 | } |
| 151 | 452 | ||
| 453 | /** | ||
| 454 | * kfifo_from_user_rec - puts some data from user space into the FIFO | ||
| 455 | * @fifo: the fifo to be used. | ||
| 456 | * @from: pointer to the data to be added. | ||
| 457 | * @n: the length of the data to be added. | ||
| 458 | * @recsize: size of record field | ||
| 459 | * | ||
| 460 | * This function copies @n bytes from the @from into the | ||
| 461 | * FIFO and returns the number of bytes which cannot be copied. | ||
| 462 | * | ||
| 463 | * If the returned value is equal or less the @n value, the copy_from_user() | ||
| 464 | * functions has failed. Otherwise the record doesn't fit into the buffer. | ||
| 465 | * | ||
| 466 | * Note that with only one concurrent reader and one concurrent | ||
| 467 | * writer, you don't need extra locking to use these functions. | ||
| 468 | */ | ||
| 469 | static inline __must_check unsigned int kfifo_from_user_rec(struct kfifo *fifo, | ||
| 470 | const void __user *from, unsigned int n, unsigned int recsize) | ||
| 471 | { | ||
| 472 | if (!__builtin_constant_p(recsize)) | ||
| 473 | return __kfifo_from_user_generic(fifo, from, n, recsize); | ||
| 474 | return __kfifo_from_user_rec(fifo, from, n, recsize); | ||
| 475 | } | ||
| 476 | |||
| 477 | /** | ||
| 478 | * __kfifo_to_user_... internal functions for transfer fifo data into user space | ||
| 479 | * do not call it directly, use kfifo_to_user_rec() instead | ||
| 480 | */ | ||
| 481 | extern unsigned int __kfifo_to_user_n(struct kfifo *fifo, | ||
| 482 | void __user *to, unsigned int n, unsigned int reclen, | ||
| 483 | unsigned int recsize); | ||
| 484 | |||
| 485 | extern unsigned int __kfifo_to_user_generic(struct kfifo *fifo, | ||
| 486 | void __user *to, unsigned int n, unsigned int recsize, | ||
| 487 | unsigned int *total); | ||
| 488 | |||
| 489 | static inline unsigned int __kfifo_to_user_rec(struct kfifo *fifo, | ||
| 490 | void __user *to, unsigned int n, | ||
| 491 | unsigned int recsize, unsigned int *total) | ||
| 492 | { | ||
| 493 | unsigned int l; | ||
| 494 | |||
| 495 | if (!recsize) { | ||
| 496 | l = n; | ||
| 497 | if (total) | ||
| 498 | *total = l; | ||
| 499 | } else { | ||
| 500 | l = __kfifo_peek_n(fifo, recsize); | ||
| 501 | if (total) | ||
| 502 | *total = l; | ||
| 503 | if (n < l) | ||
| 504 | return l; | ||
| 505 | } | ||
| 506 | |||
| 507 | return __kfifo_to_user_n(fifo, to, n, l, recsize); | ||
| 508 | } | ||
| 509 | |||
| 510 | /** | ||
| 511 | * kfifo_to_user_rec - gets data from the FIFO and write it to user space | ||
| 512 | * @fifo: the fifo to be used. | ||
| 513 | * @to: where the data must be copied. | ||
| 514 | * @n: the size of the destination buffer. | ||
| 515 | * @recsize: size of record field | ||
| 516 | * @total: pointer where the total number of to copied bytes should stored | ||
| 517 | * | ||
| 518 | * This function copies at most @n bytes from the FIFO to the @to. | ||
| 519 | * In case of an error, the function returns the number of bytes which cannot | ||
| 520 | * be copied. | ||
| 521 | * If the returned value is equal or less the @n value, the copy_to_user() | ||
| 522 | * functions has failed. Otherwise the record doesn't fit into the @to buffer. | ||
| 523 | * | ||
| 524 | * Note that with only one concurrent reader and one concurrent | ||
| 525 | * writer, you don't need extra locking to use these functions. | ||
| 526 | */ | ||
| 527 | static inline __must_check unsigned int kfifo_to_user_rec(struct kfifo *fifo, | ||
| 528 | void __user *to, unsigned int n, unsigned int recsize, | ||
| 529 | unsigned int *total) | ||
| 530 | { | ||
| 531 | if (!__builtin_constant_p(recsize)) | ||
| 532 | return __kfifo_to_user_generic(fifo, to, n, recsize, total); | ||
| 533 | return __kfifo_to_user_rec(fifo, to, n, recsize, total); | ||
| 534 | } | ||
| 535 | |||
| 536 | /** | ||
| 537 | * __kfifo_peek_... internal functions for peek into the next fifo record | ||
| 538 | * do not call it directly, use kfifo_peek_rec() instead | ||
| 539 | */ | ||
| 540 | extern unsigned int __kfifo_peek_generic(struct kfifo *fifo, | ||
| 541 | unsigned int recsize); | ||
| 542 | |||
| 543 | /** | ||
| 544 | * kfifo_peek_rec - gets the size of the next FIFO record data | ||
| 545 | * @fifo: the fifo to be used. | ||
| 546 | * @recsize: size of record field | ||
| 547 | * | ||
| 548 | * This function returns the size of the next FIFO record in number of bytes | ||
| 549 | */ | ||
| 550 | static inline __must_check unsigned int kfifo_peek_rec(struct kfifo *fifo, | ||
| 551 | unsigned int recsize) | ||
| 552 | { | ||
| 553 | if (!__builtin_constant_p(recsize)) | ||
| 554 | return __kfifo_peek_generic(fifo, recsize); | ||
| 555 | if (!recsize) | ||
| 556 | return kfifo_len(fifo); | ||
| 557 | return __kfifo_peek_n(fifo, recsize); | ||
| 558 | } | ||
| 559 | |||
| 560 | /** | ||
| 561 | * __kfifo_skip_... internal functions for skip the next fifo record | ||
| 562 | * do not call it directly, use kfifo_skip_rec() instead | ||
| 563 | */ | ||
| 564 | extern void __kfifo_skip_generic(struct kfifo *fifo, unsigned int recsize); | ||
| 565 | |||
| 566 | static inline void __kfifo_skip_rec(struct kfifo *fifo, | ||
| 567 | unsigned int recsize) | ||
| 568 | { | ||
| 569 | unsigned int l; | ||
| 570 | |||
| 571 | if (recsize) { | ||
| 572 | l = __kfifo_peek_n(fifo, recsize); | ||
| 573 | |||
| 574 | if (l + recsize <= kfifo_len(fifo)) { | ||
| 575 | __kfifo_add_out(fifo, l + recsize); | ||
| 576 | return; | ||
| 577 | } | ||
| 578 | } | ||
| 579 | kfifo_reset_out(fifo); | ||
| 580 | } | ||
| 581 | |||
| 582 | /** | ||
| 583 | * kfifo_skip_rec - skip the next fifo out record | ||
| 584 | * @fifo: the fifo to be used. | ||
| 585 | * @recsize: size of record field | ||
| 586 | * | ||
| 587 | * This function skips the next FIFO record | ||
| 588 | */ | ||
| 589 | static inline void kfifo_skip_rec(struct kfifo *fifo, | ||
| 590 | unsigned int recsize) | ||
| 591 | { | ||
| 592 | if (!__builtin_constant_p(recsize)) | ||
| 593 | __kfifo_skip_generic(fifo, recsize); | ||
| 594 | else | ||
| 595 | __kfifo_skip_rec(fifo, recsize); | ||
| 596 | } | ||
| 597 | |||
| 598 | /** | ||
| 599 | * kfifo_avail_rec - returns the number of bytes available in a record FIFO | ||
| 600 | * @fifo: the fifo to be used. | ||
| 601 | * @recsize: size of record field | ||
| 602 | */ | ||
| 603 | static inline __must_check unsigned int kfifo_avail_rec(struct kfifo *fifo, | ||
| 604 | unsigned int recsize) | ||
| 605 | { | ||
| 606 | unsigned int l = kfifo_size(fifo) - kfifo_len(fifo); | ||
| 607 | |||
| 608 | return (l > recsize) ? l - recsize : 0; | ||
| 609 | } | ||
| 610 | |||
| 152 | #endif | 611 | #endif |
diff --git a/include/linux/kmemleak.h b/include/linux/kmemleak.h index 3c7497d46ee9..99d9a6766f7e 100644 --- a/include/linux/kmemleak.h +++ b/include/linux/kmemleak.h | |||
| @@ -32,8 +32,7 @@ extern void kmemleak_padding(const void *ptr, unsigned long offset, | |||
| 32 | size_t size) __ref; | 32 | size_t size) __ref; |
| 33 | extern void kmemleak_not_leak(const void *ptr) __ref; | 33 | extern void kmemleak_not_leak(const void *ptr) __ref; |
| 34 | extern void kmemleak_ignore(const void *ptr) __ref; | 34 | extern void kmemleak_ignore(const void *ptr) __ref; |
| 35 | extern void kmemleak_scan_area(const void *ptr, unsigned long offset, | 35 | extern void kmemleak_scan_area(const void *ptr, size_t size, gfp_t gfp) __ref; |
| 36 | size_t length, gfp_t gfp) __ref; | ||
| 37 | extern void kmemleak_no_scan(const void *ptr) __ref; | 36 | extern void kmemleak_no_scan(const void *ptr) __ref; |
| 38 | 37 | ||
| 39 | static inline void kmemleak_alloc_recursive(const void *ptr, size_t size, | 38 | static inline void kmemleak_alloc_recursive(const void *ptr, size_t size, |
| @@ -84,8 +83,7 @@ static inline void kmemleak_not_leak(const void *ptr) | |||
| 84 | static inline void kmemleak_ignore(const void *ptr) | 83 | static inline void kmemleak_ignore(const void *ptr) |
| 85 | { | 84 | { |
| 86 | } | 85 | } |
| 87 | static inline void kmemleak_scan_area(const void *ptr, unsigned long offset, | 86 | static inline void kmemleak_scan_area(const void *ptr, size_t size, gfp_t gfp) |
| 88 | size_t length, gfp_t gfp) | ||
| 89 | { | 87 | { |
| 90 | } | 88 | } |
| 91 | static inline void kmemleak_erase(void **ptr) | 89 | static inline void kmemleak_erase(void **ptr) |
diff --git a/include/linux/leds-lp3944.h b/include/linux/leds-lp3944.h index afc9f9fd70f5..2618aa9063bc 100644 --- a/include/linux/leds-lp3944.h +++ b/include/linux/leds-lp3944.h | |||
| @@ -12,9 +12,6 @@ | |||
| 12 | #ifndef __LINUX_LEDS_LP3944_H | 12 | #ifndef __LINUX_LEDS_LP3944_H |
| 13 | #define __LINUX_LEDS_LP3944_H | 13 | #define __LINUX_LEDS_LP3944_H |
| 14 | 14 | ||
| 15 | #include <linux/leds.h> | ||
| 16 | #include <linux/workqueue.h> | ||
| 17 | |||
| 18 | #define LP3944_LED0 0 | 15 | #define LP3944_LED0 0 |
| 19 | #define LP3944_LED1 1 | 16 | #define LP3944_LED1 1 |
| 20 | #define LP3944_LED2 2 | 17 | #define LP3944_LED2 2 |
diff --git a/include/linux/leds-pca9532.h b/include/linux/leds-pca9532.h index 96eea90f01a8..f158eb1149aa 100644 --- a/include/linux/leds-pca9532.h +++ b/include/linux/leds-pca9532.h | |||
| @@ -32,7 +32,7 @@ struct pca9532_led { | |||
| 32 | struct i2c_client *client; | 32 | struct i2c_client *client; |
| 33 | char *name; | 33 | char *name; |
| 34 | struct led_classdev ldev; | 34 | struct led_classdev ldev; |
| 35 | struct work_struct work; | 35 | struct work_struct work; |
| 36 | enum pca9532_type type; | 36 | enum pca9532_type type; |
| 37 | enum pca9532_state state; | 37 | enum pca9532_state state; |
| 38 | }; | 38 | }; |
diff --git a/include/linux/leds-regulator.h b/include/linux/leds-regulator.h new file mode 100644 index 000000000000..5a8eb389aab8 --- /dev/null +++ b/include/linux/leds-regulator.h | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | /* | ||
| 2 | * leds-regulator.h - platform data structure for regulator driven LEDs. | ||
| 3 | * | ||
| 4 | * Copyright (C) 2009 Antonio Ospite <ospite@studenti.unina.it> | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License version 2 as | ||
| 8 | * published by the Free Software Foundation. | ||
| 9 | * | ||
| 10 | */ | ||
| 11 | |||
| 12 | #ifndef __LINUX_LEDS_REGULATOR_H | ||
| 13 | #define __LINUX_LEDS_REGULATOR_H | ||
| 14 | |||
| 15 | /* | ||
| 16 | * Use "vled" as supply id when declaring the regulator consumer: | ||
| 17 | * | ||
| 18 | * static struct regulator_consumer_supply pcap_regulator_VVIB_consumers [] = { | ||
| 19 | * { .dev_name = "leds-regulator.0", supply = "vled" }, | ||
| 20 | * }; | ||
| 21 | * | ||
| 22 | * If you have several regulator driven LEDs, you can append a numerical id to | ||
| 23 | * .dev_name as done above, and use the same id when declaring the platform | ||
| 24 | * device: | ||
| 25 | * | ||
| 26 | * static struct led_regulator_platform_data a780_vibrator_data = { | ||
| 27 | * .name = "a780::vibrator", | ||
| 28 | * }; | ||
| 29 | * | ||
| 30 | * static struct platform_device a780_vibrator = { | ||
| 31 | * .name = "leds-regulator", | ||
| 32 | * .id = 0, | ||
| 33 | * .dev = { | ||
| 34 | * .platform_data = &a780_vibrator_data, | ||
| 35 | * }, | ||
| 36 | * }; | ||
| 37 | */ | ||
| 38 | |||
| 39 | #include <linux/leds.h> | ||
| 40 | |||
| 41 | struct led_regulator_platform_data { | ||
| 42 | char *name; /* LED name as expected by LED class */ | ||
| 43 | enum led_brightness brightness; /* initial brightness value */ | ||
| 44 | }; | ||
| 45 | |||
| 46 | #endif /* __LINUX_LEDS_REGULATOR_H */ | ||
diff --git a/include/linux/memory.h b/include/linux/memory.h index 37fa19b34ef5..1adfe779eb99 100644 --- a/include/linux/memory.h +++ b/include/linux/memory.h | |||
| @@ -50,6 +50,19 @@ struct memory_notify { | |||
| 50 | int status_change_nid; | 50 | int status_change_nid; |
| 51 | }; | 51 | }; |
| 52 | 52 | ||
| 53 | /* | ||
| 54 | * During pageblock isolation, count the number of pages within the | ||
| 55 | * range [start_pfn, start_pfn + nr_pages) which are owned by code | ||
| 56 | * in the notifier chain. | ||
| 57 | */ | ||
| 58 | #define MEM_ISOLATE_COUNT (1<<0) | ||
| 59 | |||
| 60 | struct memory_isolate_notify { | ||
| 61 | unsigned long start_pfn; /* Start of range to check */ | ||
| 62 | unsigned int nr_pages; /* # pages in range to check */ | ||
| 63 | unsigned int pages_found; /* # pages owned found by callbacks */ | ||
| 64 | }; | ||
| 65 | |||
| 53 | struct notifier_block; | 66 | struct notifier_block; |
| 54 | struct mem_section; | 67 | struct mem_section; |
| 55 | 68 | ||
| @@ -76,14 +89,28 @@ static inline int memory_notify(unsigned long val, void *v) | |||
| 76 | { | 89 | { |
| 77 | return 0; | 90 | return 0; |
| 78 | } | 91 | } |
| 92 | static inline int register_memory_isolate_notifier(struct notifier_block *nb) | ||
| 93 | { | ||
| 94 | return 0; | ||
| 95 | } | ||
| 96 | static inline void unregister_memory_isolate_notifier(struct notifier_block *nb) | ||
| 97 | { | ||
| 98 | } | ||
| 99 | static inline int memory_isolate_notify(unsigned long val, void *v) | ||
| 100 | { | ||
| 101 | return 0; | ||
| 102 | } | ||
| 79 | #else | 103 | #else |
| 80 | extern int register_memory_notifier(struct notifier_block *nb); | 104 | extern int register_memory_notifier(struct notifier_block *nb); |
| 81 | extern void unregister_memory_notifier(struct notifier_block *nb); | 105 | extern void unregister_memory_notifier(struct notifier_block *nb); |
| 106 | extern int register_memory_isolate_notifier(struct notifier_block *nb); | ||
| 107 | extern void unregister_memory_isolate_notifier(struct notifier_block *nb); | ||
| 82 | extern int register_new_memory(int, struct mem_section *); | 108 | extern int register_new_memory(int, struct mem_section *); |
| 83 | extern int unregister_memory_section(struct mem_section *); | 109 | extern int unregister_memory_section(struct mem_section *); |
| 84 | extern int memory_dev_init(void); | 110 | extern int memory_dev_init(void); |
| 85 | extern int remove_memory_block(unsigned long, struct mem_section *, int); | 111 | extern int remove_memory_block(unsigned long, struct mem_section *, int); |
| 86 | extern int memory_notify(unsigned long val, void *v); | 112 | extern int memory_notify(unsigned long val, void *v); |
| 113 | extern int memory_isolate_notify(unsigned long val, void *v); | ||
| 87 | extern struct memory_block *find_memory_block(struct mem_section *); | 114 | extern struct memory_block *find_memory_block(struct mem_section *); |
| 88 | #define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT) | 115 | #define CONFIG_MEM_BLOCK_SIZE (PAGES_PER_SECTION<<PAGE_SHIFT) |
| 89 | enum mem_add_context { BOOT, HOTPLUG }; | 116 | enum mem_add_context { BOOT, HOTPLUG }; |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 849b4a61bd8f..2265f28eb47a 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
| @@ -1037,6 +1037,9 @@ extern void add_active_range(unsigned int nid, unsigned long start_pfn, | |||
| 1037 | extern void remove_active_range(unsigned int nid, unsigned long start_pfn, | 1037 | extern void remove_active_range(unsigned int nid, unsigned long start_pfn, |
| 1038 | unsigned long end_pfn); | 1038 | unsigned long end_pfn); |
| 1039 | extern void remove_all_active_ranges(void); | 1039 | extern void remove_all_active_ranges(void); |
| 1040 | void sort_node_map(void); | ||
| 1041 | unsigned long __absent_pages_in_range(int nid, unsigned long start_pfn, | ||
| 1042 | unsigned long end_pfn); | ||
| 1040 | extern unsigned long absent_pages_in_range(unsigned long start_pfn, | 1043 | extern unsigned long absent_pages_in_range(unsigned long start_pfn, |
| 1041 | unsigned long end_pfn); | 1044 | unsigned long end_pfn); |
| 1042 | extern void get_pfn_range_for_nid(unsigned int nid, | 1045 | extern void get_pfn_range_for_nid(unsigned int nid, |
diff --git a/include/linux/mnt_namespace.h b/include/linux/mnt_namespace.h index d9ebf1037dfa..d74785c2393a 100644 --- a/include/linux/mnt_namespace.h +++ b/include/linux/mnt_namespace.h | |||
| @@ -23,6 +23,7 @@ struct proc_mounts { | |||
| 23 | 23 | ||
| 24 | struct fs_struct; | 24 | struct fs_struct; |
| 25 | 25 | ||
| 26 | extern struct mnt_namespace *create_mnt_ns(struct vfsmount *mnt); | ||
| 26 | extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *, | 27 | extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *, |
| 27 | struct fs_struct *); | 28 | struct fs_struct *); |
| 28 | extern void put_mnt_ns(struct mnt_namespace *ns); | 29 | extern void put_mnt_ns(struct mnt_namespace *ns); |
diff --git a/include/linux/namei.h b/include/linux/namei.h index 028946750289..05b441d93642 100644 --- a/include/linux/namei.h +++ b/include/linux/namei.h | |||
| @@ -72,8 +72,6 @@ extern int vfs_path_lookup(struct dentry *, struct vfsmount *, | |||
| 72 | 72 | ||
| 73 | extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry, | 73 | extern struct file *lookup_instantiate_filp(struct nameidata *nd, struct dentry *dentry, |
| 74 | int (*open)(struct inode *, struct file *)); | 74 | int (*open)(struct inode *, struct file *)); |
| 75 | extern struct file *nameidata_to_filp(struct nameidata *nd, int flags); | ||
| 76 | extern void release_open_intent(struct nameidata *); | ||
| 77 | 75 | ||
| 78 | extern struct dentry *lookup_one_len(const char *, struct dentry *, int); | 76 | extern struct dentry *lookup_one_len(const char *, struct dentry *, int); |
| 79 | 77 | ||
diff --git a/include/linux/perf_counter.h b/include/linux/perf_counter.h deleted file mode 100644 index e3fb25606706..000000000000 --- a/include/linux/perf_counter.h +++ /dev/null | |||
| @@ -1,444 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * NOTE: this file will be removed in a future kernel release, it is | ||
| 3 | * provided as a courtesy copy of user-space code that relies on the | ||
| 4 | * old (pre-rename) symbols and constants. | ||
| 5 | * | ||
| 6 | * Performance events: | ||
| 7 | * | ||
| 8 | * Copyright (C) 2008-2009, Thomas Gleixner <tglx@linutronix.de> | ||
| 9 | * Copyright (C) 2008-2009, Red Hat, Inc., Ingo Molnar | ||
| 10 | * Copyright (C) 2008-2009, Red Hat, Inc., Peter Zijlstra | ||
| 11 | * | ||
| 12 | * Data type definitions, declarations, prototypes. | ||
| 13 | * | ||
| 14 | * Started by: Thomas Gleixner and Ingo Molnar | ||
| 15 | * | ||
| 16 | * For licencing details see kernel-base/COPYING | ||
| 17 | */ | ||
| 18 | #ifndef _LINUX_PERF_COUNTER_H | ||
| 19 | #define _LINUX_PERF_COUNTER_H | ||
| 20 | |||
| 21 | #include <linux/types.h> | ||
| 22 | #include <linux/ioctl.h> | ||
| 23 | #include <asm/byteorder.h> | ||
| 24 | |||
| 25 | /* | ||
| 26 | * User-space ABI bits: | ||
| 27 | */ | ||
| 28 | |||
| 29 | /* | ||
| 30 | * attr.type | ||
| 31 | */ | ||
| 32 | enum perf_type_id { | ||
| 33 | PERF_TYPE_HARDWARE = 0, | ||
| 34 | PERF_TYPE_SOFTWARE = 1, | ||
| 35 | PERF_TYPE_TRACEPOINT = 2, | ||
| 36 | PERF_TYPE_HW_CACHE = 3, | ||
| 37 | PERF_TYPE_RAW = 4, | ||
| 38 | |||
| 39 | PERF_TYPE_MAX, /* non-ABI */ | ||
| 40 | }; | ||
| 41 | |||
| 42 | /* | ||
| 43 | * Generalized performance counter event types, used by the | ||
| 44 | * attr.event_id parameter of the sys_perf_counter_open() | ||
| 45 | * syscall: | ||
| 46 | */ | ||
| 47 | enum perf_hw_id { | ||
| 48 | /* | ||
| 49 | * Common hardware events, generalized by the kernel: | ||
| 50 | */ | ||
| 51 | PERF_COUNT_HW_CPU_CYCLES = 0, | ||
| 52 | PERF_COUNT_HW_INSTRUCTIONS = 1, | ||
| 53 | PERF_COUNT_HW_CACHE_REFERENCES = 2, | ||
| 54 | PERF_COUNT_HW_CACHE_MISSES = 3, | ||
| 55 | PERF_COUNT_HW_BRANCH_INSTRUCTIONS = 4, | ||
| 56 | PERF_COUNT_HW_BRANCH_MISSES = 5, | ||
| 57 | PERF_COUNT_HW_BUS_CYCLES = 6, | ||
| 58 | |||
| 59 | PERF_COUNT_HW_MAX, /* non-ABI */ | ||
| 60 | }; | ||
| 61 | |||
| 62 | /* | ||
| 63 | * Generalized hardware cache counters: | ||
| 64 | * | ||
| 65 | * { L1-D, L1-I, LLC, ITLB, DTLB, BPU } x | ||
| 66 | * { read, write, prefetch } x | ||
| 67 | * { accesses, misses } | ||
| 68 | */ | ||
| 69 | enum perf_hw_cache_id { | ||
| 70 | PERF_COUNT_HW_CACHE_L1D = 0, | ||
| 71 | PERF_COUNT_HW_CACHE_L1I = 1, | ||
| 72 | PERF_COUNT_HW_CACHE_LL = 2, | ||
| 73 | PERF_COUNT_HW_CACHE_DTLB = 3, | ||
| 74 | PERF_COUNT_HW_CACHE_ITLB = 4, | ||
| 75 | PERF_COUNT_HW_CACHE_BPU = 5, | ||
| 76 | |||
| 77 | PERF_COUNT_HW_CACHE_MAX, /* non-ABI */ | ||
| 78 | }; | ||
| 79 | |||
| 80 | enum perf_hw_cache_op_id { | ||
| 81 | PERF_COUNT_HW_CACHE_OP_READ = 0, | ||
| 82 | PERF_COUNT_HW_CACHE_OP_WRITE = 1, | ||
| 83 | PERF_COUNT_HW_CACHE_OP_PREFETCH = 2, | ||
| 84 | |||
| 85 | PERF_COUNT_HW_CACHE_OP_MAX, /* non-ABI */ | ||
| 86 | }; | ||
| 87 | |||
| 88 | enum perf_hw_cache_op_result_id { | ||
| 89 | PERF_COUNT_HW_CACHE_RESULT_ACCESS = 0, | ||
| 90 | PERF_COUNT_HW_CACHE_RESULT_MISS = 1, | ||
| 91 | |||
| 92 | PERF_COUNT_HW_CACHE_RESULT_MAX, /* non-ABI */ | ||
| 93 | }; | ||
| 94 | |||
| 95 | /* | ||
| 96 | * Special "software" counters provided by the kernel, even if the hardware | ||
| 97 | * does not support performance counters. These counters measure various | ||
| 98 | * physical and sw events of the kernel (and allow the profiling of them as | ||
| 99 | * well): | ||
| 100 | */ | ||
| 101 | enum perf_sw_ids { | ||
| 102 | PERF_COUNT_SW_CPU_CLOCK = 0, | ||
| 103 | PERF_COUNT_SW_TASK_CLOCK = 1, | ||
| 104 | PERF_COUNT_SW_PAGE_FAULTS = 2, | ||
| 105 | PERF_COUNT_SW_CONTEXT_SWITCHES = 3, | ||
| 106 | PERF_COUNT_SW_CPU_MIGRATIONS = 4, | ||
| 107 | PERF_COUNT_SW_PAGE_FAULTS_MIN = 5, | ||
| 108 | PERF_COUNT_SW_PAGE_FAULTS_MAJ = 6, | ||
| 109 | PERF_COUNT_SW_ALIGNMENT_FAULTS = 7, | ||
| 110 | PERF_COUNT_SW_EMULATION_FAULTS = 8, | ||
| 111 | |||
| 112 | PERF_COUNT_SW_MAX, /* non-ABI */ | ||
| 113 | }; | ||
| 114 | |||
| 115 | /* | ||
| 116 | * Bits that can be set in attr.sample_type to request information | ||
| 117 | * in the overflow packets. | ||
| 118 | */ | ||
| 119 | enum perf_counter_sample_format { | ||
| 120 | PERF_SAMPLE_IP = 1U << 0, | ||
| 121 | PERF_SAMPLE_TID = 1U << 1, | ||
| 122 | PERF_SAMPLE_TIME = 1U << 2, | ||
| 123 | PERF_SAMPLE_ADDR = 1U << 3, | ||
| 124 | PERF_SAMPLE_READ = 1U << 4, | ||
| 125 | PERF_SAMPLE_CALLCHAIN = 1U << 5, | ||
| 126 | PERF_SAMPLE_ID = 1U << 6, | ||
| 127 | PERF_SAMPLE_CPU = 1U << 7, | ||
| 128 | PERF_SAMPLE_PERIOD = 1U << 8, | ||
| 129 | PERF_SAMPLE_STREAM_ID = 1U << 9, | ||
| 130 | PERF_SAMPLE_RAW = 1U << 10, | ||
| 131 | |||
| 132 | PERF_SAMPLE_MAX = 1U << 11, /* non-ABI */ | ||
| 133 | }; | ||
| 134 | |||
| 135 | /* | ||
| 136 | * The format of the data returned by read() on a perf counter fd, | ||
| 137 | * as specified by attr.read_format: | ||
| 138 | * | ||
| 139 | * struct read_format { | ||
| 140 | * { u64 value; | ||
| 141 | * { u64 time_enabled; } && PERF_FORMAT_ENABLED | ||
| 142 | * { u64 time_running; } && PERF_FORMAT_RUNNING | ||
| 143 | * { u64 id; } && PERF_FORMAT_ID | ||
| 144 | * } && !PERF_FORMAT_GROUP | ||
| 145 | * | ||
| 146 | * { u64 nr; | ||
| 147 | * { u64 time_enabled; } && PERF_FORMAT_ENABLED | ||
| 148 | * { u64 time_running; } && PERF_FORMAT_RUNNING | ||
| 149 | * { u64 value; | ||
| 150 | * { u64 id; } && PERF_FORMAT_ID | ||
| 151 | * } cntr[nr]; | ||
| 152 | * } && PERF_FORMAT_GROUP | ||
| 153 | * }; | ||
| 154 | */ | ||
| 155 | enum perf_counter_read_format { | ||
| 156 | PERF_FORMAT_TOTAL_TIME_ENABLED = 1U << 0, | ||
| 157 | PERF_FORMAT_TOTAL_TIME_RUNNING = 1U << 1, | ||
| 158 | PERF_FORMAT_ID = 1U << 2, | ||
| 159 | PERF_FORMAT_GROUP = 1U << 3, | ||
| 160 | |||
| 161 | PERF_FORMAT_MAX = 1U << 4, /* non-ABI */ | ||
| 162 | }; | ||
| 163 | |||
| 164 | #define PERF_ATTR_SIZE_VER0 64 /* sizeof first published struct */ | ||
| 165 | |||
| 166 | /* | ||
| 167 | * Hardware event to monitor via a performance monitoring counter: | ||
| 168 | */ | ||
| 169 | struct perf_counter_attr { | ||
| 170 | |||
| 171 | /* | ||
| 172 | * Major type: hardware/software/tracepoint/etc. | ||
| 173 | */ | ||
| 174 | __u32 type; | ||
| 175 | |||
| 176 | /* | ||
| 177 | * Size of the attr structure, for fwd/bwd compat. | ||
| 178 | */ | ||
| 179 | __u32 size; | ||
| 180 | |||
| 181 | /* | ||
| 182 | * Type specific configuration information. | ||
| 183 | */ | ||
| 184 | __u64 config; | ||
| 185 | |||
| 186 | union { | ||
| 187 | __u64 sample_period; | ||
| 188 | __u64 sample_freq; | ||
| 189 | }; | ||
| 190 | |||
| 191 | __u64 sample_type; | ||
| 192 | __u64 read_format; | ||
| 193 | |||
| 194 | __u64 disabled : 1, /* off by default */ | ||
| 195 | inherit : 1, /* children inherit it */ | ||
| 196 | pinned : 1, /* must always be on PMU */ | ||
| 197 | exclusive : 1, /* only group on PMU */ | ||
| 198 | exclude_user : 1, /* don't count user */ | ||
| 199 | exclude_kernel : 1, /* ditto kernel */ | ||
| 200 | exclude_hv : 1, /* ditto hypervisor */ | ||
| 201 | exclude_idle : 1, /* don't count when idle */ | ||
| 202 | mmap : 1, /* include mmap data */ | ||
| 203 | comm : 1, /* include comm data */ | ||
| 204 | freq : 1, /* use freq, not period */ | ||
| 205 | inherit_stat : 1, /* per task counts */ | ||
| 206 | enable_on_exec : 1, /* next exec enables */ | ||
| 207 | task : 1, /* trace fork/exit */ | ||
| 208 | watermark : 1, /* wakeup_watermark */ | ||
| 209 | |||
| 210 | __reserved_1 : 49; | ||
| 211 | |||
| 212 | union { | ||
| 213 | __u32 wakeup_events; /* wakeup every n events */ | ||
| 214 | __u32 wakeup_watermark; /* bytes before wakeup */ | ||
| 215 | }; | ||
| 216 | __u32 __reserved_2; | ||
| 217 | |||
| 218 | __u64 __reserved_3; | ||
| 219 | }; | ||
| 220 | |||
| 221 | /* | ||
| 222 | * Ioctls that can be done on a perf counter fd: | ||
| 223 | */ | ||
| 224 | #define PERF_COUNTER_IOC_ENABLE _IO ('$', 0) | ||
| 225 | #define PERF_COUNTER_IOC_DISABLE _IO ('$', 1) | ||
| 226 | #define PERF_COUNTER_IOC_REFRESH _IO ('$', 2) | ||
| 227 | #define PERF_COUNTER_IOC_RESET _IO ('$', 3) | ||
| 228 | #define PERF_COUNTER_IOC_PERIOD _IOW('$', 4, u64) | ||
| 229 | #define PERF_COUNTER_IOC_SET_OUTPUT _IO ('$', 5) | ||
| 230 | #define PERF_COUNTER_IOC_SET_FILTER _IOW('$', 6, char *) | ||
| 231 | |||
| 232 | enum perf_counter_ioc_flags { | ||
| 233 | PERF_IOC_FLAG_GROUP = 1U << 0, | ||
| 234 | }; | ||
| 235 | |||
| 236 | /* | ||
| 237 | * Structure of the page that can be mapped via mmap | ||
| 238 | */ | ||
| 239 | struct perf_counter_mmap_page { | ||
| 240 | __u32 version; /* version number of this structure */ | ||
| 241 | __u32 compat_version; /* lowest version this is compat with */ | ||
| 242 | |||
| 243 | /* | ||
| 244 | * Bits needed to read the hw counters in user-space. | ||
| 245 | * | ||
| 246 | * u32 seq; | ||
| 247 | * s64 count; | ||
| 248 | * | ||
| 249 | * do { | ||
| 250 | * seq = pc->lock; | ||
| 251 | * | ||
| 252 | * barrier() | ||
| 253 | * if (pc->index) { | ||
| 254 | * count = pmc_read(pc->index - 1); | ||
| 255 | * count += pc->offset; | ||
| 256 | * } else | ||
| 257 | * goto regular_read; | ||
| 258 | * | ||
| 259 | * barrier(); | ||
| 260 | * } while (pc->lock != seq); | ||
| 261 | * | ||
| 262 | * NOTE: for obvious reason this only works on self-monitoring | ||
| 263 | * processes. | ||
| 264 | */ | ||
| 265 | __u32 lock; /* seqlock for synchronization */ | ||
| 266 | __u32 index; /* hardware counter identifier */ | ||
| 267 | __s64 offset; /* add to hardware counter value */ | ||
| 268 | __u64 time_enabled; /* time counter active */ | ||
| 269 | __u64 time_running; /* time counter on cpu */ | ||
| 270 | |||
| 271 | /* | ||
| 272 | * Hole for extension of the self monitor capabilities | ||
| 273 | */ | ||
| 274 | |||
| 275 | __u64 __reserved[123]; /* align to 1k */ | ||
| 276 | |||
| 277 | /* | ||
| 278 | * Control data for the mmap() data buffer. | ||
| 279 | * | ||
| 280 | * User-space reading the @data_head value should issue an rmb(), on | ||
| 281 | * SMP capable platforms, after reading this value -- see | ||
| 282 | * perf_counter_wakeup(). | ||
| 283 | * | ||
| 284 | * When the mapping is PROT_WRITE the @data_tail value should be | ||
| 285 | * written by userspace to reflect the last read data. In this case | ||
| 286 | * the kernel will not over-write unread data. | ||
| 287 | */ | ||
| 288 | __u64 data_head; /* head in the data section */ | ||
| 289 | __u64 data_tail; /* user-space written tail */ | ||
| 290 | }; | ||
| 291 | |||
| 292 | #define PERF_EVENT_MISC_CPUMODE_MASK (3 << 0) | ||
| 293 | #define PERF_EVENT_MISC_CPUMODE_UNKNOWN (0 << 0) | ||
| 294 | #define PERF_EVENT_MISC_KERNEL (1 << 0) | ||
| 295 | #define PERF_EVENT_MISC_USER (2 << 0) | ||
| 296 | #define PERF_EVENT_MISC_HYPERVISOR (3 << 0) | ||
| 297 | |||
| 298 | struct perf_event_header { | ||
| 299 | __u32 type; | ||
| 300 | __u16 misc; | ||
| 301 | __u16 size; | ||
| 302 | }; | ||
| 303 | |||
| 304 | enum perf_event_type { | ||
| 305 | |||
| 306 | /* | ||
| 307 | * The MMAP events record the PROT_EXEC mappings so that we can | ||
| 308 | * correlate userspace IPs to code. They have the following structure: | ||
| 309 | * | ||
| 310 | * struct { | ||
| 311 | * struct perf_event_header header; | ||
| 312 | * | ||
| 313 | * u32 pid, tid; | ||
| 314 | * u64 addr; | ||
| 315 | * u64 len; | ||
| 316 | * u64 pgoff; | ||
| 317 | * char filename[]; | ||
| 318 | * }; | ||
| 319 | */ | ||
| 320 | PERF_EVENT_MMAP = 1, | ||
| 321 | |||
| 322 | /* | ||
| 323 | * struct { | ||
| 324 | * struct perf_event_header header; | ||
| 325 | * u64 id; | ||
| 326 | * u64 lost; | ||
| 327 | * }; | ||
| 328 | */ | ||
| 329 | PERF_EVENT_LOST = 2, | ||
| 330 | |||
| 331 | /* | ||
| 332 | * struct { | ||
| 333 | * struct perf_event_header header; | ||
| 334 | * | ||
| 335 | * u32 pid, tid; | ||
| 336 | * char comm[]; | ||
| 337 | * }; | ||
| 338 | */ | ||
| 339 | PERF_EVENT_COMM = 3, | ||
| 340 | |||
| 341 | /* | ||
| 342 | * struct { | ||
| 343 | * struct perf_event_header header; | ||
| 344 | * u32 pid, ppid; | ||
| 345 | * u32 tid, ptid; | ||
| 346 | * u64 time; | ||
| 347 | * }; | ||
| 348 | */ | ||
| 349 | PERF_EVENT_EXIT = 4, | ||
| 350 | |||
| 351 | /* | ||
| 352 | * struct { | ||
| 353 | * struct perf_event_header header; | ||
| 354 | * u64 time; | ||
| 355 | * u64 id; | ||
| 356 | * u64 stream_id; | ||
| 357 | * }; | ||
| 358 | */ | ||
| 359 | PERF_EVENT_THROTTLE = 5, | ||
| 360 | PERF_EVENT_UNTHROTTLE = 6, | ||
| 361 | |||
| 362 | /* | ||
| 363 | * struct { | ||
| 364 | * struct perf_event_header header; | ||
| 365 | * u32 pid, ppid; | ||
| 366 | * u32 tid, ptid; | ||
| 367 | * u64 time; | ||
| 368 | * }; | ||
| 369 | */ | ||
| 370 | PERF_EVENT_FORK = 7, | ||
| 371 | |||
| 372 | /* | ||
| 373 | * struct { | ||
| 374 | * struct perf_event_header header; | ||
| 375 | * u32 pid, tid; | ||
| 376 | * | ||
| 377 | * struct read_format values; | ||
| 378 | * }; | ||
| 379 | */ | ||
| 380 | PERF_EVENT_READ = 8, | ||
| 381 | |||
| 382 | /* | ||
| 383 | * struct { | ||
| 384 | * struct perf_event_header header; | ||
| 385 | * | ||
| 386 | * { u64 ip; } && PERF_SAMPLE_IP | ||
| 387 | * { u32 pid, tid; } && PERF_SAMPLE_TID | ||
| 388 | * { u64 time; } && PERF_SAMPLE_TIME | ||
| 389 | * { u64 addr; } && PERF_SAMPLE_ADDR | ||
| 390 | * { u64 id; } && PERF_SAMPLE_ID | ||
| 391 | * { u64 stream_id;} && PERF_SAMPLE_STREAM_ID | ||
| 392 | * { u32 cpu, res; } && PERF_SAMPLE_CPU | ||
| 393 | * { u64 period; } && PERF_SAMPLE_PERIOD | ||
| 394 | * | ||
| 395 | * { struct read_format values; } && PERF_SAMPLE_READ | ||
| 396 | * | ||
| 397 | * { u64 nr, | ||
| 398 | * u64 ips[nr]; } && PERF_SAMPLE_CALLCHAIN | ||
| 399 | * | ||
| 400 | * # | ||
| 401 | * # The RAW record below is opaque data wrt the ABI | ||
| 402 | * # | ||
| 403 | * # That is, the ABI doesn't make any promises wrt to | ||
| 404 | * # the stability of its content, it may vary depending | ||
| 405 | * # on event, hardware, kernel version and phase of | ||
| 406 | * # the moon. | ||
| 407 | * # | ||
| 408 | * # In other words, PERF_SAMPLE_RAW contents are not an ABI. | ||
| 409 | * # | ||
| 410 | * | ||
| 411 | * { u32 size; | ||
| 412 | * char data[size];}&& PERF_SAMPLE_RAW | ||
| 413 | * }; | ||
| 414 | */ | ||
| 415 | PERF_EVENT_SAMPLE = 9, | ||
| 416 | |||
| 417 | PERF_EVENT_MAX, /* non-ABI */ | ||
| 418 | }; | ||
| 419 | |||
| 420 | enum perf_callchain_context { | ||
| 421 | PERF_CONTEXT_HV = (__u64)-32, | ||
| 422 | PERF_CONTEXT_KERNEL = (__u64)-128, | ||
| 423 | PERF_CONTEXT_USER = (__u64)-512, | ||
| 424 | |||
| 425 | PERF_CONTEXT_GUEST = (__u64)-2048, | ||
| 426 | PERF_CONTEXT_GUEST_KERNEL = (__u64)-2176, | ||
| 427 | PERF_CONTEXT_GUEST_USER = (__u64)-2560, | ||
| 428 | |||
| 429 | PERF_CONTEXT_MAX = (__u64)-4095, | ||
| 430 | }; | ||
| 431 | |||
| 432 | #define PERF_FLAG_FD_NO_GROUP (1U << 0) | ||
| 433 | #define PERF_FLAG_FD_OUTPUT (1U << 1) | ||
| 434 | |||
| 435 | /* | ||
| 436 | * In case some app still references the old symbols: | ||
| 437 | */ | ||
| 438 | |||
| 439 | #define __NR_perf_counter_open __NR_perf_event_open | ||
| 440 | |||
| 441 | #define PR_TASK_PERF_COUNTERS_DISABLE PR_TASK_PERF_EVENTS_DISABLE | ||
| 442 | #define PR_TASK_PERF_COUNTERS_ENABLE PR_TASK_PERF_EVENTS_ENABLE | ||
| 443 | |||
| 444 | #endif /* _LINUX_PERF_COUNTER_H */ | ||
diff --git a/include/linux/pwm_backlight.h b/include/linux/pwm_backlight.h index 7a9754c96775..01b3d759f1fc 100644 --- a/include/linux/pwm_backlight.h +++ b/include/linux/pwm_backlight.h | |||
| @@ -10,7 +10,7 @@ struct platform_pwm_backlight_data { | |||
| 10 | unsigned int dft_brightness; | 10 | unsigned int dft_brightness; |
| 11 | unsigned int pwm_period_ns; | 11 | unsigned int pwm_period_ns; |
| 12 | int (*init)(struct device *dev); | 12 | int (*init)(struct device *dev); |
| 13 | int (*notify)(int brightness); | 13 | int (*notify)(struct device *dev, int brightness); |
| 14 | void (*exit)(struct device *dev); | 14 | void (*exit)(struct device *dev); |
| 15 | }; | 15 | }; |
| 16 | 16 | ||
diff --git a/include/linux/rcutiny.h b/include/linux/rcutiny.h index c4ba9a78721e..96cc307ed9f4 100644 --- a/include/linux/rcutiny.h +++ b/include/linux/rcutiny.h | |||
| @@ -101,4 +101,9 @@ static inline void exit_rcu(void) | |||
| 101 | { | 101 | { |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | static inline int rcu_preempt_depth(void) | ||
| 105 | { | ||
| 106 | return 0; | ||
| 107 | } | ||
| 108 | |||
| 104 | #endif /* __LINUX_RCUTINY_H */ | 109 | #endif /* __LINUX_RCUTINY_H */ |
diff --git a/include/linux/rcutree.h b/include/linux/rcutree.h index c93eee5911b0..8044b1b94333 100644 --- a/include/linux/rcutree.h +++ b/include/linux/rcutree.h | |||
| @@ -45,6 +45,12 @@ extern void __rcu_read_unlock(void); | |||
| 45 | extern void synchronize_rcu(void); | 45 | extern void synchronize_rcu(void); |
| 46 | extern void exit_rcu(void); | 46 | extern void exit_rcu(void); |
| 47 | 47 | ||
| 48 | /* | ||
| 49 | * Defined as macro as it is a very low level header | ||
| 50 | * included from areas that don't even know about current | ||
| 51 | */ | ||
| 52 | #define rcu_preempt_depth() (current->rcu_read_lock_nesting) | ||
| 53 | |||
| 48 | #else /* #ifdef CONFIG_TREE_PREEMPT_RCU */ | 54 | #else /* #ifdef CONFIG_TREE_PREEMPT_RCU */ |
| 49 | 55 | ||
| 50 | static inline void __rcu_read_lock(void) | 56 | static inline void __rcu_read_lock(void) |
| @@ -63,6 +69,11 @@ static inline void exit_rcu(void) | |||
| 63 | { | 69 | { |
| 64 | } | 70 | } |
| 65 | 71 | ||
| 72 | static inline int rcu_preempt_depth(void) | ||
| 73 | { | ||
| 74 | return 0; | ||
| 75 | } | ||
| 76 | |||
| 66 | #endif /* #else #ifdef CONFIG_TREE_PREEMPT_RCU */ | 77 | #endif /* #else #ifdef CONFIG_TREE_PREEMPT_RCU */ |
| 67 | 78 | ||
| 68 | static inline void __rcu_read_lock_bh(void) | 79 | static inline void __rcu_read_lock_bh(void) |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 244c287a5ac1..f2f842db03ce 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
| @@ -192,6 +192,12 @@ print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq) | |||
| 192 | #define TASK_DEAD 64 | 192 | #define TASK_DEAD 64 |
| 193 | #define TASK_WAKEKILL 128 | 193 | #define TASK_WAKEKILL 128 |
| 194 | #define TASK_WAKING 256 | 194 | #define TASK_WAKING 256 |
| 195 | #define TASK_STATE_MAX 512 | ||
| 196 | |||
| 197 | #define TASK_STATE_TO_CHAR_STR "RSDTtZXxKW" | ||
| 198 | |||
| 199 | extern char ___assert_task_state[1 - 2*!!( | ||
| 200 | sizeof(TASK_STATE_TO_CHAR_STR)-1 != ilog2(TASK_STATE_MAX)+1)]; | ||
| 195 | 201 | ||
| 196 | /* Convenience macros for the sake of set_task_state */ | 202 | /* Convenience macros for the sake of set_task_state */ |
| 197 | #define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE) | 203 | #define TASK_KILLABLE (TASK_WAKEKILL | TASK_UNINTERRUPTIBLE) |
| @@ -1091,7 +1097,8 @@ struct sched_class { | |||
| 1091 | enum cpu_idle_type idle); | 1097 | enum cpu_idle_type idle); |
| 1092 | void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); | 1098 | void (*pre_schedule) (struct rq *this_rq, struct task_struct *task); |
| 1093 | void (*post_schedule) (struct rq *this_rq); | 1099 | void (*post_schedule) (struct rq *this_rq); |
| 1094 | void (*task_wake_up) (struct rq *this_rq, struct task_struct *task); | 1100 | void (*task_waking) (struct rq *this_rq, struct task_struct *task); |
| 1101 | void (*task_woken) (struct rq *this_rq, struct task_struct *task); | ||
| 1095 | 1102 | ||
| 1096 | void (*set_cpus_allowed)(struct task_struct *p, | 1103 | void (*set_cpus_allowed)(struct task_struct *p, |
| 1097 | const struct cpumask *newmask); | 1104 | const struct cpumask *newmask); |
| @@ -1115,7 +1122,7 @@ struct sched_class { | |||
| 1115 | struct task_struct *task); | 1122 | struct task_struct *task); |
| 1116 | 1123 | ||
| 1117 | #ifdef CONFIG_FAIR_GROUP_SCHED | 1124 | #ifdef CONFIG_FAIR_GROUP_SCHED |
| 1118 | void (*moved_group) (struct task_struct *p); | 1125 | void (*moved_group) (struct task_struct *p, int on_rq); |
| 1119 | #endif | 1126 | #endif |
| 1120 | }; | 1127 | }; |
| 1121 | 1128 | ||
| @@ -1446,10 +1453,8 @@ struct task_struct { | |||
| 1446 | gfp_t lockdep_reclaim_gfp; | 1453 | gfp_t lockdep_reclaim_gfp; |
| 1447 | #endif | 1454 | #endif |
| 1448 | 1455 | ||
| 1449 | #ifdef CONFIG_FS_JOURNAL_INFO | ||
| 1450 | /* journalling filesystem info */ | 1456 | /* journalling filesystem info */ |
| 1451 | void *journal_info; | 1457 | void *journal_info; |
| 1452 | #endif | ||
| 1453 | 1458 | ||
| 1454 | /* stacked block device info */ | 1459 | /* stacked block device info */ |
| 1455 | struct bio *bio_list, **bio_tail; | 1460 | struct bio *bio_list, **bio_tail; |
| @@ -1555,7 +1560,7 @@ struct task_struct { | |||
| 1555 | }; | 1560 | }; |
| 1556 | 1561 | ||
| 1557 | /* Future-safe accessor for struct task_struct's cpus_allowed. */ | 1562 | /* Future-safe accessor for struct task_struct's cpus_allowed. */ |
| 1558 | #define tsk_cpumask(tsk) (&(tsk)->cpus_allowed) | 1563 | #define tsk_cpus_allowed(tsk) (&(tsk)->cpus_allowed) |
| 1559 | 1564 | ||
| 1560 | /* | 1565 | /* |
| 1561 | * Priority of a process goes from 0..MAX_PRIO-1, valid RT | 1566 | * Priority of a process goes from 0..MAX_PRIO-1, valid RT |
| @@ -2596,8 +2601,6 @@ static inline void mm_init_owner(struct mm_struct *mm, struct task_struct *p) | |||
| 2596 | } | 2601 | } |
| 2597 | #endif /* CONFIG_MM_OWNER */ | 2602 | #endif /* CONFIG_MM_OWNER */ |
| 2598 | 2603 | ||
| 2599 | #define TASK_STATE_TO_CHAR_STR "RSDTtZX" | ||
| 2600 | |||
| 2601 | #endif /* __KERNEL__ */ | 2604 | #endif /* __KERNEL__ */ |
| 2602 | 2605 | ||
| 2603 | #endif | 2606 | #endif |
diff --git a/include/linux/security.h b/include/linux/security.h index 466cbadbd1ef..2c627d361c02 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
| @@ -95,8 +95,13 @@ struct seq_file; | |||
| 95 | extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); | 95 | extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb); |
| 96 | extern int cap_netlink_recv(struct sk_buff *skb, int cap); | 96 | extern int cap_netlink_recv(struct sk_buff *skb, int cap); |
| 97 | 97 | ||
| 98 | #ifdef CONFIG_MMU | ||
| 98 | extern unsigned long mmap_min_addr; | 99 | extern unsigned long mmap_min_addr; |
| 99 | extern unsigned long dac_mmap_min_addr; | 100 | extern unsigned long dac_mmap_min_addr; |
| 101 | #else | ||
| 102 | #define dac_mmap_min_addr 0UL | ||
| 103 | #endif | ||
| 104 | |||
| 100 | /* | 105 | /* |
| 101 | * Values used in the task_security_ops calls | 106 | * Values used in the task_security_ops calls |
| 102 | */ | 107 | */ |
| @@ -121,6 +126,7 @@ struct request_sock; | |||
| 121 | #define LSM_UNSAFE_PTRACE 2 | 126 | #define LSM_UNSAFE_PTRACE 2 |
| 122 | #define LSM_UNSAFE_PTRACE_CAP 4 | 127 | #define LSM_UNSAFE_PTRACE_CAP 4 |
| 123 | 128 | ||
| 129 | #ifdef CONFIG_MMU | ||
| 124 | /* | 130 | /* |
| 125 | * If a hint addr is less than mmap_min_addr change hint to be as | 131 | * If a hint addr is less than mmap_min_addr change hint to be as |
| 126 | * low as possible but still greater than mmap_min_addr | 132 | * low as possible but still greater than mmap_min_addr |
| @@ -135,6 +141,7 @@ static inline unsigned long round_hint_to_min(unsigned long hint) | |||
| 135 | } | 141 | } |
| 136 | extern int mmap_min_addr_handler(struct ctl_table *table, int write, | 142 | extern int mmap_min_addr_handler(struct ctl_table *table, int write, |
| 137 | void __user *buffer, size_t *lenp, loff_t *ppos); | 143 | void __user *buffer, size_t *lenp, loff_t *ppos); |
| 144 | #endif | ||
| 138 | 145 | ||
| 139 | #ifdef CONFIG_SECURITY | 146 | #ifdef CONFIG_SECURITY |
| 140 | 147 | ||
diff --git a/include/linux/spi/dw_spi.h b/include/linux/spi/dw_spi.h new file mode 100644 index 000000000000..51b3e771a9a3 --- /dev/null +++ b/include/linux/spi/dw_spi.h | |||
| @@ -0,0 +1,212 @@ | |||
| 1 | #ifndef DW_SPI_HEADER_H | ||
| 2 | #define DW_SPI_HEADER_H | ||
| 3 | #include <linux/io.h> | ||
| 4 | |||
| 5 | /* Bit fields in CTRLR0 */ | ||
| 6 | #define SPI_DFS_OFFSET 0 | ||
| 7 | |||
| 8 | #define SPI_FRF_OFFSET 4 | ||
| 9 | #define SPI_FRF_SPI 0x0 | ||
| 10 | #define SPI_FRF_SSP 0x1 | ||
| 11 | #define SPI_FRF_MICROWIRE 0x2 | ||
| 12 | #define SPI_FRF_RESV 0x3 | ||
| 13 | |||
| 14 | #define SPI_MODE_OFFSET 6 | ||
| 15 | #define SPI_SCPH_OFFSET 6 | ||
| 16 | #define SPI_SCOL_OFFSET 7 | ||
| 17 | #define SPI_TMOD_OFFSET 8 | ||
| 18 | #define SPI_TMOD_TR 0x0 /* xmit & recv */ | ||
| 19 | #define SPI_TMOD_TO 0x1 /* xmit only */ | ||
| 20 | #define SPI_TMOD_RO 0x2 /* recv only */ | ||
| 21 | #define SPI_TMOD_EPROMREAD 0x3 /* eeprom read mode */ | ||
| 22 | |||
| 23 | #define SPI_SLVOE_OFFSET 10 | ||
| 24 | #define SPI_SRL_OFFSET 11 | ||
| 25 | #define SPI_CFS_OFFSET 12 | ||
| 26 | |||
| 27 | /* Bit fields in SR, 7 bits */ | ||
| 28 | #define SR_MASK 0x7f /* cover 7 bits */ | ||
| 29 | #define SR_BUSY (1 << 0) | ||
| 30 | #define SR_TF_NOT_FULL (1 << 1) | ||
| 31 | #define SR_TF_EMPT (1 << 2) | ||
| 32 | #define SR_RF_NOT_EMPT (1 << 3) | ||
| 33 | #define SR_RF_FULL (1 << 4) | ||
| 34 | #define SR_TX_ERR (1 << 5) | ||
| 35 | #define SR_DCOL (1 << 6) | ||
| 36 | |||
| 37 | /* Bit fields in ISR, IMR, RISR, 7 bits */ | ||
| 38 | #define SPI_INT_TXEI (1 << 0) | ||
| 39 | #define SPI_INT_TXOI (1 << 1) | ||
| 40 | #define SPI_INT_RXUI (1 << 2) | ||
| 41 | #define SPI_INT_RXOI (1 << 3) | ||
| 42 | #define SPI_INT_RXFI (1 << 4) | ||
| 43 | #define SPI_INT_MSTI (1 << 5) | ||
| 44 | |||
| 45 | /* TX RX interrupt level threshhold, max can be 256 */ | ||
| 46 | #define SPI_INT_THRESHOLD 32 | ||
| 47 | |||
| 48 | enum dw_ssi_type { | ||
| 49 | SSI_MOTO_SPI = 0, | ||
| 50 | SSI_TI_SSP, | ||
| 51 | SSI_NS_MICROWIRE, | ||
| 52 | }; | ||
| 53 | |||
| 54 | struct dw_spi_reg { | ||
| 55 | u32 ctrl0; | ||
| 56 | u32 ctrl1; | ||
| 57 | u32 ssienr; | ||
| 58 | u32 mwcr; | ||
| 59 | u32 ser; | ||
| 60 | u32 baudr; | ||
| 61 | u32 txfltr; | ||
| 62 | u32 rxfltr; | ||
| 63 | u32 txflr; | ||
| 64 | u32 rxflr; | ||
| 65 | u32 sr; | ||
| 66 | u32 imr; | ||
| 67 | u32 isr; | ||
| 68 | u32 risr; | ||
| 69 | u32 txoicr; | ||
| 70 | u32 rxoicr; | ||
| 71 | u32 rxuicr; | ||
| 72 | u32 msticr; | ||
| 73 | u32 icr; | ||
| 74 | u32 dmacr; | ||
| 75 | u32 dmatdlr; | ||
| 76 | u32 dmardlr; | ||
| 77 | u32 idr; | ||
| 78 | u32 version; | ||
| 79 | u32 dr; /* Currently oper as 32 bits, | ||
| 80 | though only low 16 bits matters */ | ||
| 81 | } __packed; | ||
| 82 | |||
| 83 | struct dw_spi { | ||
| 84 | struct spi_master *master; | ||
| 85 | struct spi_device *cur_dev; | ||
| 86 | struct device *parent_dev; | ||
| 87 | enum dw_ssi_type type; | ||
| 88 | |||
| 89 | void __iomem *regs; | ||
| 90 | unsigned long paddr; | ||
| 91 | u32 iolen; | ||
| 92 | int irq; | ||
| 93 | u32 max_freq; /* max bus freq supported */ | ||
| 94 | |||
| 95 | u16 bus_num; | ||
| 96 | u16 num_cs; /* supported slave numbers */ | ||
| 97 | |||
| 98 | /* Driver message queue */ | ||
| 99 | struct workqueue_struct *workqueue; | ||
| 100 | struct work_struct pump_messages; | ||
| 101 | spinlock_t lock; | ||
| 102 | struct list_head queue; | ||
| 103 | int busy; | ||
| 104 | int run; | ||
| 105 | |||
| 106 | /* Message Transfer pump */ | ||
| 107 | struct tasklet_struct pump_transfers; | ||
| 108 | |||
| 109 | /* Current message transfer state info */ | ||
| 110 | struct spi_message *cur_msg; | ||
| 111 | struct spi_transfer *cur_transfer; | ||
| 112 | struct chip_data *cur_chip; | ||
| 113 | struct chip_data *prev_chip; | ||
| 114 | size_t len; | ||
| 115 | void *tx; | ||
| 116 | void *tx_end; | ||
| 117 | void *rx; | ||
| 118 | void *rx_end; | ||
| 119 | int dma_mapped; | ||
| 120 | dma_addr_t rx_dma; | ||
| 121 | dma_addr_t tx_dma; | ||
| 122 | size_t rx_map_len; | ||
| 123 | size_t tx_map_len; | ||
| 124 | u8 n_bytes; /* current is a 1/2 bytes op */ | ||
| 125 | u8 max_bits_per_word; /* maxim is 16b */ | ||
| 126 | u32 dma_width; | ||
| 127 | int cs_change; | ||
| 128 | int (*write)(struct dw_spi *dws); | ||
| 129 | int (*read)(struct dw_spi *dws); | ||
| 130 | irqreturn_t (*transfer_handler)(struct dw_spi *dws); | ||
| 131 | void (*cs_control)(u32 command); | ||
| 132 | |||
| 133 | /* Dma info */ | ||
| 134 | int dma_inited; | ||
| 135 | struct dma_chan *txchan; | ||
| 136 | struct dma_chan *rxchan; | ||
| 137 | int txdma_done; | ||
| 138 | int rxdma_done; | ||
| 139 | u64 tx_param; | ||
| 140 | u64 rx_param; | ||
| 141 | struct device *dma_dev; | ||
| 142 | dma_addr_t dma_addr; | ||
| 143 | |||
| 144 | /* Bus interface info */ | ||
| 145 | void *priv; | ||
| 146 | #ifdef CONFIG_DEBUG_FS | ||
| 147 | struct dentry *debugfs; | ||
| 148 | #endif | ||
| 149 | }; | ||
| 150 | |||
| 151 | #define dw_readl(dw, name) \ | ||
| 152 | __raw_readl(&(((struct dw_spi_reg *)dw->regs)->name)) | ||
| 153 | #define dw_writel(dw, name, val) \ | ||
| 154 | __raw_writel((val), &(((struct dw_spi_reg *)dw->regs)->name)) | ||
| 155 | #define dw_readw(dw, name) \ | ||
| 156 | __raw_readw(&(((struct dw_spi_reg *)dw->regs)->name)) | ||
| 157 | #define dw_writew(dw, name, val) \ | ||
| 158 | __raw_writew((val), &(((struct dw_spi_reg *)dw->regs)->name)) | ||
| 159 | |||
| 160 | static inline void spi_enable_chip(struct dw_spi *dws, int enable) | ||
| 161 | { | ||
| 162 | dw_writel(dws, ssienr, (enable ? 1 : 0)); | ||
| 163 | } | ||
| 164 | |||
| 165 | static inline void spi_set_clk(struct dw_spi *dws, u16 div) | ||
| 166 | { | ||
| 167 | dw_writel(dws, baudr, div); | ||
| 168 | } | ||
| 169 | |||
| 170 | static inline void spi_chip_sel(struct dw_spi *dws, u16 cs) | ||
| 171 | { | ||
| 172 | if (cs > dws->num_cs) | ||
| 173 | return; | ||
| 174 | dw_writel(dws, ser, 1 << cs); | ||
| 175 | } | ||
| 176 | |||
| 177 | /* Disable IRQ bits */ | ||
| 178 | static inline void spi_mask_intr(struct dw_spi *dws, u32 mask) | ||
| 179 | { | ||
| 180 | u32 new_mask; | ||
| 181 | |||
| 182 | new_mask = dw_readl(dws, imr) & ~mask; | ||
| 183 | dw_writel(dws, imr, new_mask); | ||
| 184 | } | ||
| 185 | |||
| 186 | /* Enable IRQ bits */ | ||
| 187 | static inline void spi_umask_intr(struct dw_spi *dws, u32 mask) | ||
| 188 | { | ||
| 189 | u32 new_mask; | ||
| 190 | |||
| 191 | new_mask = dw_readl(dws, imr) | mask; | ||
| 192 | dw_writel(dws, imr, new_mask); | ||
| 193 | } | ||
| 194 | |||
| 195 | /* | ||
| 196 | * Each SPI slave device to work with dw_api controller should | ||
| 197 | * has such a structure claiming its working mode (PIO/DMA etc), | ||
| 198 | * which can be save in the "controller_data" member of the | ||
| 199 | * struct spi_device | ||
| 200 | */ | ||
| 201 | struct dw_spi_chip { | ||
| 202 | u8 poll_mode; /* 0 for contoller polling mode */ | ||
| 203 | u8 type; /* SPI/SSP/Micrwire */ | ||
| 204 | u8 enable_dma; | ||
| 205 | void (*cs_control)(u32 command); | ||
| 206 | }; | ||
| 207 | |||
| 208 | extern int dw_spi_add_host(struct dw_spi *dws); | ||
| 209 | extern void dw_spi_remove_host(struct dw_spi *dws); | ||
| 210 | extern int dw_spi_suspend_host(struct dw_spi *dws); | ||
| 211 | extern int dw_spi_resume_host(struct dw_spi *dws); | ||
| 212 | #endif /* DW_SPI_HEADER_H */ | ||
diff --git a/include/linux/vt.h b/include/linux/vt.h index 3fb9944e50a6..d5dd0bc408fd 100644 --- a/include/linux/vt.h +++ b/include/linux/vt.h | |||
| @@ -84,6 +84,8 @@ struct vt_setactivate { | |||
| 84 | 84 | ||
| 85 | #define VT_SETACTIVATE 0x560F /* Activate and set the mode of a console */ | 85 | #define VT_SETACTIVATE 0x560F /* Activate and set the mode of a console */ |
| 86 | 86 | ||
| 87 | #ifdef __KERNEL__ | ||
| 88 | |||
| 87 | #ifdef CONFIG_VT_CONSOLE | 89 | #ifdef CONFIG_VT_CONSOLE |
| 88 | 90 | ||
| 89 | extern int vt_kmsg_redirect(int new); | 91 | extern int vt_kmsg_redirect(int new); |
| @@ -97,6 +99,8 @@ static inline int vt_kmsg_redirect(int new) | |||
| 97 | 99 | ||
| 98 | #endif | 100 | #endif |
| 99 | 101 | ||
| 102 | #endif /* __KERNEL__ */ | ||
| 103 | |||
| 100 | #define vt_get_kmsg_redirect() vt_kmsg_redirect(-1) | 104 | #define vt_get_kmsg_redirect() vt_kmsg_redirect(-1) |
| 101 | 105 | ||
| 102 | #endif /* _LINUX_VT_H */ | 106 | #endif /* _LINUX_VT_H */ |
diff --git a/include/scsi/libiscsi.h b/include/scsi/libiscsi.h index 7394e3bc8f4b..ff92b46f5153 100644 --- a/include/scsi/libiscsi.h +++ b/include/scsi/libiscsi.h | |||
| @@ -28,6 +28,7 @@ | |||
| 28 | #include <linux/mutex.h> | 28 | #include <linux/mutex.h> |
| 29 | #include <linux/timer.h> | 29 | #include <linux/timer.h> |
| 30 | #include <linux/workqueue.h> | 30 | #include <linux/workqueue.h> |
| 31 | #include <linux/kfifo.h> | ||
| 31 | #include <scsi/iscsi_proto.h> | 32 | #include <scsi/iscsi_proto.h> |
| 32 | #include <scsi/iscsi_if.h> | 33 | #include <scsi/iscsi_if.h> |
| 33 | #include <scsi/scsi_transport_iscsi.h> | 34 | #include <scsi/scsi_transport_iscsi.h> |
| @@ -231,7 +232,7 @@ struct iscsi_conn { | |||
| 231 | }; | 232 | }; |
| 232 | 233 | ||
| 233 | struct iscsi_pool { | 234 | struct iscsi_pool { |
| 234 | struct kfifo *queue; /* FIFO Queue */ | 235 | struct kfifo queue; /* FIFO Queue */ |
| 235 | void **pool; /* Pool of elements */ | 236 | void **pool; /* Pool of elements */ |
| 236 | int max; /* Max number of elements */ | 237 | int max; /* Max number of elements */ |
| 237 | }; | 238 | }; |
diff --git a/include/scsi/libiscsi_tcp.h b/include/scsi/libiscsi_tcp.h index 9e3182e659db..741ae7ed4394 100644 --- a/include/scsi/libiscsi_tcp.h +++ b/include/scsi/libiscsi_tcp.h | |||
| @@ -80,7 +80,7 @@ struct iscsi_tcp_task { | |||
| 80 | int data_offset; | 80 | int data_offset; |
| 81 | struct iscsi_r2t_info *r2t; /* in progress solict R2T */ | 81 | struct iscsi_r2t_info *r2t; /* in progress solict R2T */ |
| 82 | struct iscsi_pool r2tpool; | 82 | struct iscsi_pool r2tpool; |
| 83 | struct kfifo *r2tqueue; | 83 | struct kfifo r2tqueue; |
| 84 | void *dd_data; | 84 | void *dd_data; |
| 85 | }; | 85 | }; |
| 86 | 86 | ||
diff --git a/include/scsi/libsrp.h b/include/scsi/libsrp.h index ba615e4c1d7c..07e3adde21d9 100644 --- a/include/scsi/libsrp.h +++ b/include/scsi/libsrp.h | |||
| @@ -21,7 +21,7 @@ struct srp_buf { | |||
| 21 | struct srp_queue { | 21 | struct srp_queue { |
| 22 | void *pool; | 22 | void *pool; |
| 23 | void *items; | 23 | void *items; |
| 24 | struct kfifo *queue; | 24 | struct kfifo queue; |
| 25 | spinlock_t lock; | 25 | spinlock_t lock; |
| 26 | }; | 26 | }; |
| 27 | 27 | ||
diff --git a/include/scsi/osd_initiator.h b/include/scsi/osd_initiator.h index 39d6d1097153..a8f370126632 100644 --- a/include/scsi/osd_initiator.h +++ b/include/scsi/osd_initiator.h | |||
| @@ -142,6 +142,7 @@ struct osd_request { | |||
| 142 | struct _osd_io_info { | 142 | struct _osd_io_info { |
| 143 | struct bio *bio; | 143 | struct bio *bio; |
| 144 | u64 total_bytes; | 144 | u64 total_bytes; |
| 145 | u64 residual; | ||
| 145 | struct request *req; | 146 | struct request *req; |
| 146 | struct _osd_req_data_segment *last_seg; | 147 | struct _osd_req_data_segment *last_seg; |
| 147 | u8 *pad_buff; | 148 | u8 *pad_buff; |
| @@ -150,12 +151,14 @@ struct osd_request { | |||
| 150 | gfp_t alloc_flags; | 151 | gfp_t alloc_flags; |
| 151 | unsigned timeout; | 152 | unsigned timeout; |
| 152 | unsigned retries; | 153 | unsigned retries; |
| 154 | unsigned sense_len; | ||
| 153 | u8 sense[OSD_MAX_SENSE_LEN]; | 155 | u8 sense[OSD_MAX_SENSE_LEN]; |
| 154 | enum osd_attributes_mode attributes_mode; | 156 | enum osd_attributes_mode attributes_mode; |
| 155 | 157 | ||
| 156 | osd_req_done_fn *async_done; | 158 | osd_req_done_fn *async_done; |
| 157 | void *async_private; | 159 | void *async_private; |
| 158 | int async_error; | 160 | int async_error; |
| 161 | int req_errors; | ||
| 159 | }; | 162 | }; |
| 160 | 163 | ||
| 161 | static inline bool osd_req_is_ver1(struct osd_request *or) | 164 | static inline bool osd_req_is_ver1(struct osd_request *or) |
| @@ -297,8 +300,6 @@ enum osd_err_priority { | |||
| 297 | }; | 300 | }; |
| 298 | 301 | ||
| 299 | struct osd_sense_info { | 302 | struct osd_sense_info { |
| 300 | u64 out_resid; /* Zero on success otherwise out residual */ | ||
| 301 | u64 in_resid; /* Zero on success otherwise in residual */ | ||
| 302 | enum osd_err_priority osd_err_pri; | 303 | enum osd_err_priority osd_err_pri; |
| 303 | 304 | ||
| 304 | int key; /* one of enum scsi_sense_keys */ | 305 | int key; /* one of enum scsi_sense_keys */ |
