diff options
| author | Ingo Molnar <mingo@elte.hu> | 2010-01-13 03:58:37 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@elte.hu> | 2010-01-13 04:08:50 -0500 |
| commit | 61405fea92c42d072d9b8bd189689f1502a838af (patch) | |
| tree | 013ea3e7ed71f4114004d5852d40b6e89e128f76 /include/linux | |
| parent | 9c443dfdd31eddea6cbe6ee0ca469fbcc4e1dc3b (diff) | |
| parent | 1703f2c321a8a531c393e137a82602e16c6061cb (diff) | |
Merge branch 'perf/urgent' into perf/core
Merge reason: queue up dependent patch, update to -rc4
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include/linux')
66 files changed, 1187 insertions, 796 deletions
diff --git a/include/linux/Kbuild b/include/linux/Kbuild index f72914db2a11..756f831cbdd5 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild | |||
| @@ -118,6 +118,7 @@ header-y += mtio.h | |||
| 118 | header-y += ncp_no.h | 118 | header-y += ncp_no.h |
| 119 | header-y += neighbour.h | 119 | header-y += neighbour.h |
| 120 | header-y += net_dropmon.h | 120 | header-y += net_dropmon.h |
| 121 | header-y += net_tstamp.h | ||
| 121 | header-y += netfilter_arp.h | 122 | header-y += netfilter_arp.h |
| 122 | header-y += netrom.h | 123 | header-y += netrom.h |
| 123 | header-y += nfs2.h | 124 | header-y += nfs2.h |
diff --git a/include/linux/acpi.h b/include/linux/acpi.h index ce945d4845fc..36924255c0d5 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h | |||
| @@ -251,6 +251,7 @@ int acpi_check_mem_region(resource_size_t start, resource_size_t n, | |||
| 251 | void __init acpi_no_s4_hw_signature(void); | 251 | void __init acpi_no_s4_hw_signature(void); |
| 252 | void __init acpi_old_suspend_ordering(void); | 252 | void __init acpi_old_suspend_ordering(void); |
| 253 | void __init acpi_s4_no_nvs(void); | 253 | void __init acpi_s4_no_nvs(void); |
| 254 | void __init acpi_set_sci_en_on_resume(void); | ||
| 254 | #endif /* CONFIG_PM_SLEEP */ | 255 | #endif /* CONFIG_PM_SLEEP */ |
| 255 | 256 | ||
| 256 | struct acpi_osc_context { | 257 | struct acpi_osc_context { |
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/blkdev.h b/include/linux/blkdev.h index 784a919aa0d0..9b98173a8184 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
| @@ -845,7 +845,6 @@ static inline struct request_queue *bdev_get_queue(struct block_device *bdev) | |||
| 845 | * blk_rq_err_bytes() : bytes left till the next error boundary | 845 | * blk_rq_err_bytes() : bytes left till the next error boundary |
| 846 | * blk_rq_sectors() : sectors left in the entire request | 846 | * blk_rq_sectors() : sectors left in the entire request |
| 847 | * blk_rq_cur_sectors() : sectors left in the current segment | 847 | * blk_rq_cur_sectors() : sectors left in the current segment |
| 848 | * blk_rq_err_sectors() : sectors left till the next error boundary | ||
| 849 | */ | 848 | */ |
| 850 | static inline sector_t blk_rq_pos(const struct request *rq) | 849 | static inline sector_t blk_rq_pos(const struct request *rq) |
| 851 | { | 850 | { |
| @@ -874,11 +873,6 @@ static inline unsigned int blk_rq_cur_sectors(const struct request *rq) | |||
| 874 | return blk_rq_cur_bytes(rq) >> 9; | 873 | return blk_rq_cur_bytes(rq) >> 9; |
| 875 | } | 874 | } |
| 876 | 875 | ||
| 877 | static inline unsigned int blk_rq_err_sectors(const struct request *rq) | ||
| 878 | { | ||
| 879 | return blk_rq_err_bytes(rq) >> 9; | ||
| 880 | } | ||
| 881 | |||
| 882 | /* | 876 | /* |
| 883 | * Request issue related functions. | 877 | * Request issue related functions. |
| 884 | */ | 878 | */ |
| @@ -1116,11 +1110,18 @@ static inline int queue_alignment_offset(struct request_queue *q) | |||
| 1116 | return q->limits.alignment_offset; | 1110 | return q->limits.alignment_offset; |
| 1117 | } | 1111 | } |
| 1118 | 1112 | ||
| 1113 | static inline int queue_limit_alignment_offset(struct queue_limits *lim, sector_t offset) | ||
| 1114 | { | ||
| 1115 | unsigned int granularity = max(lim->physical_block_size, lim->io_min); | ||
| 1116 | |||
| 1117 | offset &= granularity - 1; | ||
| 1118 | return (granularity + lim->alignment_offset - offset) & (granularity - 1); | ||
| 1119 | } | ||
| 1120 | |||
| 1119 | static inline int queue_sector_alignment_offset(struct request_queue *q, | 1121 | static inline int queue_sector_alignment_offset(struct request_queue *q, |
| 1120 | sector_t sector) | 1122 | sector_t sector) |
| 1121 | { | 1123 | { |
| 1122 | return ((sector << 9) - q->limits.alignment_offset) | 1124 | return queue_limit_alignment_offset(&q->limits, sector << 9); |
| 1123 | & (q->limits.io_min - 1); | ||
| 1124 | } | 1125 | } |
| 1125 | 1126 | ||
| 1126 | static inline int bdev_alignment_offset(struct block_device *bdev) | 1127 | static inline int bdev_alignment_offset(struct block_device *bdev) |
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/decompress/unlzo.h b/include/linux/decompress/unlzo.h new file mode 100644 index 000000000000..987229752519 --- /dev/null +++ b/include/linux/decompress/unlzo.h | |||
| @@ -0,0 +1,10 @@ | |||
| 1 | #ifndef DECOMPRESS_UNLZO_H | ||
| 2 | #define DECOMPRESS_UNLZO_H | ||
| 3 | |||
| 4 | int unlzo(unsigned char *inbuf, int len, | ||
| 5 | int(*fill)(void*, unsigned int), | ||
| 6 | int(*flush)(void*, unsigned int), | ||
| 7 | unsigned char *output, | ||
| 8 | int *pos, | ||
| 9 | void(*error)(char *x)); | ||
| 10 | #endif | ||
diff --git a/include/linux/device.h b/include/linux/device.h index 2a73d9bcbc9c..a62799f2ab00 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -166,9 +166,9 @@ struct driver_attribute driver_attr_##_name = \ | |||
| 166 | __ATTR(_name, _mode, _show, _store) | 166 | __ATTR(_name, _mode, _show, _store) |
| 167 | 167 | ||
| 168 | extern int __must_check driver_create_file(struct device_driver *driver, | 168 | extern int __must_check driver_create_file(struct device_driver *driver, |
| 169 | struct driver_attribute *attr); | 169 | const struct driver_attribute *attr); |
| 170 | extern void driver_remove_file(struct device_driver *driver, | 170 | extern void driver_remove_file(struct device_driver *driver, |
| 171 | struct driver_attribute *attr); | 171 | const struct driver_attribute *attr); |
| 172 | 172 | ||
| 173 | extern int __must_check driver_add_kobj(struct device_driver *drv, | 173 | extern int __must_check driver_add_kobj(struct device_driver *drv, |
| 174 | struct kobject *kobj, | 174 | struct kobject *kobj, |
| @@ -319,13 +319,13 @@ struct device_attribute { | |||
| 319 | struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) | 319 | struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) |
| 320 | 320 | ||
| 321 | extern int __must_check device_create_file(struct device *device, | 321 | extern int __must_check device_create_file(struct device *device, |
| 322 | struct device_attribute *entry); | 322 | const struct device_attribute *entry); |
| 323 | extern void device_remove_file(struct device *dev, | 323 | extern void device_remove_file(struct device *dev, |
| 324 | struct device_attribute *attr); | 324 | const struct device_attribute *attr); |
| 325 | extern int __must_check device_create_bin_file(struct device *dev, | 325 | extern int __must_check device_create_bin_file(struct device *dev, |
| 326 | struct bin_attribute *attr); | 326 | const struct bin_attribute *attr); |
| 327 | extern void device_remove_bin_file(struct device *dev, | 327 | extern void device_remove_bin_file(struct device *dev, |
| 328 | struct bin_attribute *attr); | 328 | const struct bin_attribute *attr); |
| 329 | extern int device_schedule_callback_owner(struct device *dev, | 329 | extern int device_schedule_callback_owner(struct device *dev, |
| 330 | void (*func)(struct device *dev), struct module *owner); | 330 | void (*func)(struct device *dev), struct module *owner); |
| 331 | 331 | ||
diff --git a/include/linux/dst.h b/include/linux/dst.h deleted file mode 100644 index e26fed84b1aa..000000000000 --- a/include/linux/dst.h +++ /dev/null | |||
| @@ -1,587 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * 2007+ Copyright (c) Evgeniy Polyakov <johnpol@2ka.mipt.ru> | ||
| 3 | * All rights reserved. | ||
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; either version 2 of the License, or | ||
| 8 | * (at your option) any later version. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | */ | ||
| 15 | |||
| 16 | #ifndef __DST_H | ||
| 17 | #define __DST_H | ||
| 18 | |||
| 19 | #include <linux/types.h> | ||
| 20 | #include <linux/connector.h> | ||
| 21 | |||
| 22 | #define DST_NAMELEN 32 | ||
| 23 | #define DST_NAME "dst" | ||
| 24 | |||
| 25 | enum { | ||
| 26 | /* Remove node with given id from storage */ | ||
| 27 | DST_DEL_NODE = 0, | ||
| 28 | /* Add remote node with given id to the storage */ | ||
| 29 | DST_ADD_REMOTE, | ||
| 30 | /* Add local node with given id to the storage to be exported and used by remote peers */ | ||
| 31 | DST_ADD_EXPORT, | ||
| 32 | /* Crypto initialization command (hash/cipher used to protect the connection) */ | ||
| 33 | DST_CRYPTO, | ||
| 34 | /* Security attributes for given connection (permissions for example) */ | ||
| 35 | DST_SECURITY, | ||
| 36 | /* Register given node in the block layer subsystem */ | ||
| 37 | DST_START, | ||
| 38 | DST_CMD_MAX | ||
| 39 | }; | ||
| 40 | |||
| 41 | struct dst_ctl | ||
| 42 | { | ||
| 43 | /* Storage name */ | ||
| 44 | char name[DST_NAMELEN]; | ||
| 45 | /* Command flags */ | ||
| 46 | __u32 flags; | ||
| 47 | /* Command itself (see above) */ | ||
| 48 | __u32 cmd; | ||
| 49 | /* Maximum number of pages per single request in this device */ | ||
| 50 | __u32 max_pages; | ||
| 51 | /* Stale/error transaction scanning timeout in milliseconds */ | ||
| 52 | __u32 trans_scan_timeout; | ||
| 53 | /* Maximum number of retry sends before completing transaction as broken */ | ||
| 54 | __u32 trans_max_retries; | ||
| 55 | /* Storage size */ | ||
| 56 | __u64 size; | ||
| 57 | }; | ||
| 58 | |||
| 59 | /* Reply command carries completion status */ | ||
| 60 | struct dst_ctl_ack | ||
| 61 | { | ||
| 62 | struct cn_msg msg; | ||
| 63 | int error; | ||
| 64 | int unused[3]; | ||
| 65 | }; | ||
| 66 | |||
| 67 | /* | ||
| 68 | * Unfortunaltely socket address structure is not exported to userspace | ||
| 69 | * and is redefined there. | ||
| 70 | */ | ||
| 71 | #define SADDR_MAX_DATA 128 | ||
| 72 | |||
| 73 | struct saddr { | ||
| 74 | /* address family, AF_xxx */ | ||
| 75 | unsigned short sa_family; | ||
| 76 | /* 14 bytes of protocol address */ | ||
| 77 | char sa_data[SADDR_MAX_DATA]; | ||
| 78 | /* Number of bytes used in sa_data */ | ||
| 79 | unsigned short sa_data_len; | ||
| 80 | }; | ||
| 81 | |||
| 82 | /* Address structure */ | ||
| 83 | struct dst_network_ctl | ||
| 84 | { | ||
| 85 | /* Socket type: datagram, stream...*/ | ||
| 86 | unsigned int type; | ||
| 87 | /* Let me guess, is it a Jupiter diameter? */ | ||
| 88 | unsigned int proto; | ||
| 89 | /* Peer's address */ | ||
| 90 | struct saddr addr; | ||
| 91 | }; | ||
| 92 | |||
| 93 | struct dst_crypto_ctl | ||
| 94 | { | ||
| 95 | /* Cipher and hash names */ | ||
| 96 | char cipher_algo[DST_NAMELEN]; | ||
| 97 | char hash_algo[DST_NAMELEN]; | ||
| 98 | |||
| 99 | /* Key sizes. Can be zero for digest for example */ | ||
| 100 | unsigned int cipher_keysize, hash_keysize; | ||
| 101 | /* Alignment. Calculated by the DST itself. */ | ||
| 102 | unsigned int crypto_attached_size; | ||
| 103 | /* Number of threads to perform crypto operations */ | ||
| 104 | int thread_num; | ||
| 105 | }; | ||
| 106 | |||
| 107 | /* Export security attributes have this bits checked in when client connects */ | ||
| 108 | #define DST_PERM_READ (1<<0) | ||
| 109 | #define DST_PERM_WRITE (1<<1) | ||
| 110 | |||
| 111 | /* | ||
| 112 | * Right now it is simple model, where each remote address | ||
| 113 | * is assigned to set of permissions it is allowed to perform. | ||
| 114 | * In real world block device does not know anything but | ||
| 115 | * reading and writing, so it should be more than enough. | ||
| 116 | */ | ||
| 117 | struct dst_secure_user | ||
| 118 | { | ||
| 119 | unsigned int permissions; | ||
| 120 | struct saddr addr; | ||
| 121 | }; | ||
| 122 | |||
| 123 | /* | ||
| 124 | * Export control command: device to export and network address to accept | ||
| 125 | * clients to work with given device | ||
| 126 | */ | ||
| 127 | struct dst_export_ctl | ||
| 128 | { | ||
| 129 | char device[DST_NAMELEN]; | ||
| 130 | struct dst_network_ctl ctl; | ||
| 131 | }; | ||
| 132 | |||
| 133 | enum { | ||
| 134 | DST_CFG = 1, /* Request remote configuration */ | ||
| 135 | DST_IO, /* IO command */ | ||
| 136 | DST_IO_RESPONSE, /* IO response */ | ||
| 137 | DST_PING, /* Keepalive message */ | ||
| 138 | DST_NCMD_MAX, | ||
| 139 | }; | ||
| 140 | |||
| 141 | struct dst_cmd | ||
| 142 | { | ||
| 143 | /* Network command itself, see above */ | ||
| 144 | __u32 cmd; | ||
| 145 | /* | ||
| 146 | * Size of the attached data | ||
| 147 | * (in most cases, for READ command it means how many bytes were requested) | ||
| 148 | */ | ||
| 149 | __u32 size; | ||
| 150 | /* Crypto size: number of attached bytes with digest/hmac */ | ||
| 151 | __u32 csize; | ||
| 152 | /* Here we can carry secret data */ | ||
| 153 | __u32 reserved; | ||
| 154 | /* Read/write bits, see how they are encoded in bio structure */ | ||
| 155 | __u64 rw; | ||
| 156 | /* BIO flags */ | ||
| 157 | __u64 flags; | ||
| 158 | /* Unique command id (like transaction ID) */ | ||
| 159 | __u64 id; | ||
| 160 | /* Sector to start IO from */ | ||
| 161 | __u64 sector; | ||
| 162 | /* Hash data is placed after this header */ | ||
| 163 | __u8 hash[0]; | ||
| 164 | }; | ||
| 165 | |||
| 166 | /* | ||
| 167 | * Convert command to/from network byte order. | ||
| 168 | * We do not use hton*() functions, since there is | ||
| 169 | * no 64-bit implementation. | ||
| 170 | */ | ||
| 171 | static inline void dst_convert_cmd(struct dst_cmd *c) | ||
| 172 | { | ||
| 173 | c->cmd = __cpu_to_be32(c->cmd); | ||
| 174 | c->csize = __cpu_to_be32(c->csize); | ||
| 175 | c->size = __cpu_to_be32(c->size); | ||
| 176 | c->sector = __cpu_to_be64(c->sector); | ||
| 177 | c->id = __cpu_to_be64(c->id); | ||
| 178 | c->flags = __cpu_to_be64(c->flags); | ||
| 179 | c->rw = __cpu_to_be64(c->rw); | ||
| 180 | } | ||
| 181 | |||
| 182 | /* Transaction id */ | ||
| 183 | typedef __u64 dst_gen_t; | ||
| 184 | |||
| 185 | #ifdef __KERNEL__ | ||
| 186 | |||
| 187 | #include <linux/blkdev.h> | ||
| 188 | #include <linux/bio.h> | ||
| 189 | #include <linux/device.h> | ||
| 190 | #include <linux/mempool.h> | ||
| 191 | #include <linux/net.h> | ||
| 192 | #include <linux/poll.h> | ||
| 193 | #include <linux/rbtree.h> | ||
| 194 | |||
| 195 | #ifdef CONFIG_DST_DEBUG | ||
| 196 | #define dprintk(f, a...) printk(KERN_NOTICE f, ##a) | ||
| 197 | #else | ||
| 198 | static inline void __attribute__ ((format (printf, 1, 2))) | ||
| 199 | dprintk(const char *fmt, ...) {} | ||
| 200 | #endif | ||
| 201 | |||
| 202 | struct dst_node; | ||
| 203 | |||
| 204 | struct dst_trans | ||
| 205 | { | ||
| 206 | /* DST node we are working with */ | ||
| 207 | struct dst_node *n; | ||
| 208 | |||
| 209 | /* Entry inside transaction tree */ | ||
| 210 | struct rb_node trans_entry; | ||
| 211 | |||
| 212 | /* Merlin kills this transaction when this memory cell equals zero */ | ||
| 213 | atomic_t refcnt; | ||
| 214 | |||
| 215 | /* How this transaction should be processed by crypto engine */ | ||
| 216 | short enc; | ||
| 217 | /* How many times this transaction was resent */ | ||
| 218 | short retries; | ||
| 219 | /* Completion status */ | ||
| 220 | int error; | ||
| 221 | |||
| 222 | /* When did we send it to the remote peer */ | ||
| 223 | long send_time; | ||
| 224 | |||
| 225 | /* My name is... | ||
| 226 | * Well, computers does not speak, they have unique id instead */ | ||
| 227 | dst_gen_t gen; | ||
| 228 | |||
| 229 | /* Block IO we are working with */ | ||
| 230 | struct bio *bio; | ||
| 231 | |||
| 232 | /* Network command for above block IO request */ | ||
| 233 | struct dst_cmd cmd; | ||
| 234 | }; | ||
| 235 | |||
| 236 | struct dst_crypto_engine | ||
| 237 | { | ||
| 238 | /* What should we do with all block requests */ | ||
| 239 | struct crypto_hash *hash; | ||
| 240 | struct crypto_ablkcipher *cipher; | ||
| 241 | |||
| 242 | /* Pool of pages used to encrypt data into before sending */ | ||
| 243 | int page_num; | ||
| 244 | struct page **pages; | ||
| 245 | |||
| 246 | /* What to do with current request */ | ||
| 247 | int enc; | ||
| 248 | /* Who we are and where do we go */ | ||
| 249 | struct scatterlist *src, *dst; | ||
| 250 | |||
| 251 | /* Maximum timeout waiting for encryption to be completed */ | ||
| 252 | long timeout; | ||
| 253 | /* IV is a 64-bit sequential counter */ | ||
| 254 | u64 iv; | ||
| 255 | |||
| 256 | /* Secret data */ | ||
| 257 | void *private; | ||
| 258 | |||
| 259 | /* Cached temporary data lives here */ | ||
| 260 | int size; | ||
| 261 | void *data; | ||
| 262 | }; | ||
| 263 | |||
| 264 | struct dst_state | ||
| 265 | { | ||
| 266 | /* The main state protection */ | ||
| 267 | struct mutex state_lock; | ||
| 268 | |||
| 269 | /* Polling machinery for sockets */ | ||
| 270 | wait_queue_t wait; | ||
| 271 | wait_queue_head_t *whead; | ||
| 272 | /* Most of events are being waited here */ | ||
| 273 | wait_queue_head_t thread_wait; | ||
| 274 | |||
| 275 | /* Who owns this? */ | ||
| 276 | struct dst_node *node; | ||
| 277 | |||
| 278 | /* Network address for this state */ | ||
| 279 | struct dst_network_ctl ctl; | ||
| 280 | |||
| 281 | /* Permissions to work with: read-only or rw connection */ | ||
| 282 | u32 permissions; | ||
| 283 | |||
| 284 | /* Called when we need to clean private data */ | ||
| 285 | void (* cleanup)(struct dst_state *st); | ||
| 286 | |||
| 287 | /* Used by the server: BIO completion queues BIOs here */ | ||
| 288 | struct list_head request_list; | ||
| 289 | spinlock_t request_lock; | ||
| 290 | |||
| 291 | /* Guess what? No, it is not number of planets */ | ||
| 292 | atomic_t refcnt; | ||
| 293 | |||
| 294 | /* This flags is set when connection should be dropped */ | ||
| 295 | int need_exit; | ||
| 296 | |||
| 297 | /* | ||
| 298 | * Socket to work with. Second pointer is used for | ||
| 299 | * lockless check if socket was changed before performing | ||
| 300 | * next action (like working with cached polling result) | ||
| 301 | */ | ||
| 302 | struct socket *socket, *read_socket; | ||
| 303 | |||
| 304 | /* Cached preallocated data */ | ||
| 305 | void *data; | ||
| 306 | unsigned int size; | ||
| 307 | |||
| 308 | /* Currently processed command */ | ||
| 309 | struct dst_cmd cmd; | ||
| 310 | }; | ||
| 311 | |||
| 312 | struct dst_info | ||
| 313 | { | ||
| 314 | /* Device size */ | ||
| 315 | u64 size; | ||
| 316 | |||
| 317 | /* Local device name for export devices */ | ||
| 318 | char local[DST_NAMELEN]; | ||
| 319 | |||
| 320 | /* Network setup */ | ||
| 321 | struct dst_network_ctl net; | ||
| 322 | |||
| 323 | /* Sysfs bits use this */ | ||
| 324 | struct device device; | ||
| 325 | }; | ||
| 326 | |||
| 327 | struct dst_node | ||
| 328 | { | ||
| 329 | struct list_head node_entry; | ||
| 330 | |||
| 331 | /* Hi, my name is stored here */ | ||
| 332 | char name[DST_NAMELEN]; | ||
| 333 | /* My cache name is stored here */ | ||
| 334 | char cache_name[DST_NAMELEN]; | ||
| 335 | |||
| 336 | /* Block device attached to given node. | ||
| 337 | * Only valid for exporting nodes */ | ||
| 338 | struct block_device *bdev; | ||
| 339 | /* Network state machine for given peer */ | ||
| 340 | struct dst_state *state; | ||
| 341 | |||
| 342 | /* Block IO machinery */ | ||
| 343 | struct request_queue *queue; | ||
| 344 | struct gendisk *disk; | ||
| 345 | |||
| 346 | /* Number of threads in processing pool */ | ||
| 347 | int thread_num; | ||
| 348 | /* Maximum number of pages in single IO */ | ||
| 349 | int max_pages; | ||
| 350 | |||
| 351 | /* I'm that big in bytes */ | ||
| 352 | loff_t size; | ||
| 353 | |||
| 354 | /* Exported to userspace node information */ | ||
| 355 | struct dst_info *info; | ||
| 356 | |||
| 357 | /* | ||
| 358 | * Security attribute list. | ||
| 359 | * Used only by exporting node currently. | ||
| 360 | */ | ||
| 361 | struct list_head security_list; | ||
| 362 | struct mutex security_lock; | ||
| 363 | |||
| 364 | /* | ||
| 365 | * When this unerflows below zero, university collapses. | ||
| 366 | * But this will not happen, since node will be freed, | ||
| 367 | * when reference counter reaches zero. | ||
| 368 | */ | ||
| 369 | atomic_t refcnt; | ||
| 370 | |||
| 371 | /* How precisely should I be started? */ | ||
| 372 | int (*start)(struct dst_node *); | ||
| 373 | |||
| 374 | /* Crypto capabilities */ | ||
| 375 | struct dst_crypto_ctl crypto; | ||
| 376 | u8 *hash_key; | ||
| 377 | u8 *cipher_key; | ||
| 378 | |||
| 379 | /* Pool of processing thread */ | ||
| 380 | struct thread_pool *pool; | ||
| 381 | |||
| 382 | /* Transaction IDs live here */ | ||
| 383 | atomic_long_t gen; | ||
| 384 | |||
| 385 | /* | ||
| 386 | * How frequently and how many times transaction | ||
| 387 | * tree should be scanned to drop stale objects. | ||
| 388 | */ | ||
| 389 | long trans_scan_timeout; | ||
| 390 | int trans_max_retries; | ||
| 391 | |||
| 392 | /* Small gnomes live here */ | ||
| 393 | struct rb_root trans_root; | ||
| 394 | struct mutex trans_lock; | ||
| 395 | |||
| 396 | /* | ||
| 397 | * Transaction cache/memory pool. | ||
| 398 | * It is big enough to contain not only transaction | ||
| 399 | * itself, but additional crypto data (digest/hmac). | ||
| 400 | */ | ||
| 401 | struct kmem_cache *trans_cache; | ||
| 402 | mempool_t *trans_pool; | ||
| 403 | |||
| 404 | /* This entity scans transaction tree */ | ||
| 405 | struct delayed_work trans_work; | ||
| 406 | |||
| 407 | wait_queue_head_t wait; | ||
| 408 | }; | ||
| 409 | |||
| 410 | /* Kernel representation of the security attribute */ | ||
| 411 | struct dst_secure | ||
| 412 | { | ||
| 413 | struct list_head sec_entry; | ||
| 414 | struct dst_secure_user sec; | ||
| 415 | }; | ||
| 416 | |||
| 417 | int dst_process_bio(struct dst_node *n, struct bio *bio); | ||
| 418 | |||
| 419 | int dst_node_init_connected(struct dst_node *n, struct dst_network_ctl *r); | ||
| 420 | int dst_node_init_listened(struct dst_node *n, struct dst_export_ctl *le); | ||
| 421 | |||
| 422 | static inline struct dst_state *dst_state_get(struct dst_state *st) | ||
| 423 | { | ||
| 424 | BUG_ON(atomic_read(&st->refcnt) == 0); | ||
| 425 | atomic_inc(&st->refcnt); | ||
| 426 | return st; | ||
| 427 | } | ||
| 428 | |||
| 429 | void dst_state_put(struct dst_state *st); | ||
| 430 | |||
| 431 | struct dst_state *dst_state_alloc(struct dst_node *n); | ||
| 432 | int dst_state_socket_create(struct dst_state *st); | ||
| 433 | void dst_state_socket_release(struct dst_state *st); | ||
| 434 | |||
| 435 | void dst_state_exit_connected(struct dst_state *st); | ||
| 436 | |||
| 437 | int dst_state_schedule_receiver(struct dst_state *st); | ||
| 438 | |||
| 439 | void dst_dump_addr(struct socket *sk, struct sockaddr *sa, char *str); | ||
| 440 | |||
| 441 | static inline void dst_state_lock(struct dst_state *st) | ||
| 442 | { | ||
| 443 | mutex_lock(&st->state_lock); | ||
| 444 | } | ||
| 445 | |||
| 446 | static inline void dst_state_unlock(struct dst_state *st) | ||
| 447 | { | ||
| 448 | mutex_unlock(&st->state_lock); | ||
| 449 | } | ||
| 450 | |||
| 451 | void dst_poll_exit(struct dst_state *st); | ||
| 452 | int dst_poll_init(struct dst_state *st); | ||
| 453 | |||
| 454 | static inline unsigned int dst_state_poll(struct dst_state *st) | ||
| 455 | { | ||
| 456 | unsigned int revents = POLLHUP | POLLERR; | ||
| 457 | |||
| 458 | dst_state_lock(st); | ||
| 459 | if (st->socket) | ||
| 460 | revents = st->socket->ops->poll(NULL, st->socket, NULL); | ||
| 461 | dst_state_unlock(st); | ||
| 462 | |||
| 463 | return revents; | ||
| 464 | } | ||
| 465 | |||
| 466 | static inline int dst_thread_setup(void *private, void *data) | ||
| 467 | { | ||
| 468 | return 0; | ||
| 469 | } | ||
| 470 | |||
| 471 | void dst_node_put(struct dst_node *n); | ||
| 472 | |||
| 473 | static inline struct dst_node *dst_node_get(struct dst_node *n) | ||
| 474 | { | ||
| 475 | atomic_inc(&n->refcnt); | ||
| 476 | return n; | ||
| 477 | } | ||
| 478 | |||
| 479 | int dst_data_recv(struct dst_state *st, void *data, unsigned int size); | ||
| 480 | int dst_recv_cdata(struct dst_state *st, void *cdata); | ||
| 481 | int dst_data_send_header(struct socket *sock, | ||
| 482 | void *data, unsigned int size, int more); | ||
| 483 | |||
| 484 | int dst_send_bio(struct dst_state *st, struct dst_cmd *cmd, struct bio *bio); | ||
| 485 | |||
| 486 | int dst_process_io(struct dst_state *st); | ||
| 487 | int dst_export_crypto(struct dst_node *n, struct bio *bio); | ||
| 488 | int dst_export_send_bio(struct bio *bio); | ||
| 489 | int dst_start_export(struct dst_node *n); | ||
| 490 | |||
| 491 | int __init dst_export_init(void); | ||
| 492 | void dst_export_exit(void); | ||
| 493 | |||
| 494 | /* Private structure for export block IO requests */ | ||
| 495 | struct dst_export_priv | ||
| 496 | { | ||
| 497 | struct list_head request_entry; | ||
| 498 | struct dst_state *state; | ||
| 499 | struct bio *bio; | ||
| 500 | struct dst_cmd cmd; | ||
| 501 | }; | ||
| 502 | |||
| 503 | static inline void dst_trans_get(struct dst_trans *t) | ||
| 504 | { | ||
| 505 | atomic_inc(&t->refcnt); | ||
| 506 | } | ||
| 507 | |||
| 508 | struct dst_trans *dst_trans_search(struct dst_node *node, dst_gen_t gen); | ||
| 509 | int dst_trans_remove(struct dst_trans *t); | ||
| 510 | int dst_trans_remove_nolock(struct dst_trans *t); | ||
| 511 | void dst_trans_put(struct dst_trans *t); | ||
| 512 | |||
| 513 | /* | ||
| 514 | * Convert bio into network command. | ||
| 515 | */ | ||
| 516 | static inline void dst_bio_to_cmd(struct bio *bio, struct dst_cmd *cmd, | ||
| 517 | u32 command, u64 id) | ||
| 518 | { | ||
| 519 | cmd->cmd = command; | ||
| 520 | cmd->flags = (bio->bi_flags << BIO_POOL_BITS) >> BIO_POOL_BITS; | ||
| 521 | cmd->rw = bio->bi_rw; | ||
| 522 | cmd->size = bio->bi_size; | ||
| 523 | cmd->csize = 0; | ||
| 524 | cmd->id = id; | ||
| 525 | cmd->sector = bio->bi_sector; | ||
| 526 | }; | ||
| 527 | |||
| 528 | int dst_trans_send(struct dst_trans *t); | ||
| 529 | int dst_trans_crypto(struct dst_trans *t); | ||
| 530 | |||
| 531 | int dst_node_crypto_init(struct dst_node *n, struct dst_crypto_ctl *ctl); | ||
| 532 | void dst_node_crypto_exit(struct dst_node *n); | ||
| 533 | |||
| 534 | static inline int dst_need_crypto(struct dst_node *n) | ||
| 535 | { | ||
| 536 | struct dst_crypto_ctl *c = &n->crypto; | ||
| 537 | /* | ||
| 538 | * Logical OR is appropriate here, but boolean one produces | ||
| 539 | * more optimal code, so it is used instead. | ||
| 540 | */ | ||
| 541 | return (c->hash_algo[0] | c->cipher_algo[0]); | ||
| 542 | } | ||
| 543 | |||
| 544 | int dst_node_trans_init(struct dst_node *n, unsigned int size); | ||
| 545 | void dst_node_trans_exit(struct dst_node *n); | ||
| 546 | |||
| 547 | /* | ||
| 548 | * Pool of threads. | ||
| 549 | * Ready list contains threads currently free to be used, | ||
| 550 | * active one contains threads with some work scheduled for them. | ||
| 551 | * Caller can wait in given queue when thread is ready. | ||
| 552 | */ | ||
| 553 | struct thread_pool | ||
| 554 | { | ||
| 555 | int thread_num; | ||
| 556 | struct mutex thread_lock; | ||
| 557 | struct list_head ready_list, active_list; | ||
| 558 | |||
| 559 | wait_queue_head_t wait; | ||
| 560 | }; | ||
| 561 | |||
| 562 | void thread_pool_del_worker(struct thread_pool *p); | ||
| 563 | void thread_pool_del_worker_id(struct thread_pool *p, unsigned int id); | ||
| 564 | int thread_pool_add_worker(struct thread_pool *p, | ||
| 565 | char *name, | ||
| 566 | unsigned int id, | ||
| 567 | void *(* init)(void *data), | ||
| 568 | void (* cleanup)(void *data), | ||
| 569 | void *data); | ||
| 570 | |||
| 571 | void thread_pool_destroy(struct thread_pool *p); | ||
| 572 | struct thread_pool *thread_pool_create(int num, char *name, | ||
| 573 | void *(* init)(void *data), | ||
| 574 | void (* cleanup)(void *data), | ||
| 575 | void *data); | ||
| 576 | |||
| 577 | int thread_pool_schedule(struct thread_pool *p, | ||
| 578 | int (* setup)(void *stored_private, void *setup_data), | ||
| 579 | int (* action)(void *stored_private, void *setup_data), | ||
| 580 | void *setup_data, long timeout); | ||
| 581 | int thread_pool_schedule_private(struct thread_pool *p, | ||
| 582 | int (* setup)(void *private, void *data), | ||
| 583 | int (* action)(void *private, void *data), | ||
| 584 | void *data, long timeout, void *id); | ||
| 585 | |||
| 586 | #endif /* __KERNEL__ */ | ||
| 587 | #endif /* __DST_H */ | ||
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/ext3_fs_sb.h b/include/linux/ext3_fs_sb.h index f07f34de2f0e..258088ab3c6b 100644 --- a/include/linux/ext3_fs_sb.h +++ b/include/linux/ext3_fs_sb.h | |||
| @@ -72,6 +72,8 @@ struct ext3_sb_info { | |||
| 72 | struct inode * s_journal_inode; | 72 | struct inode * s_journal_inode; |
| 73 | struct journal_s * s_journal; | 73 | struct journal_s * s_journal; |
| 74 | struct list_head s_orphan; | 74 | struct list_head s_orphan; |
| 75 | struct mutex s_orphan_lock; | ||
| 76 | struct mutex s_resize_lock; | ||
| 75 | unsigned long s_commit_interval; | 77 | unsigned long s_commit_interval; |
| 76 | struct block_device *journal_bdev; | 78 | struct block_device *journal_bdev; |
| 77 | #ifdef CONFIG_JBD_DEBUG | 79 | #ifdef CONFIG_JBD_DEBUG |
diff --git a/include/linux/ext3_jbd.h b/include/linux/ext3_jbd.h index cf82d519be40..d7b5ddca99c2 100644 --- a/include/linux/ext3_jbd.h +++ b/include/linux/ext3_jbd.h | |||
| @@ -44,13 +44,13 @@ | |||
| 44 | 44 | ||
| 45 | #define EXT3_DATA_TRANS_BLOCKS(sb) (EXT3_SINGLEDATA_TRANS_BLOCKS + \ | 45 | #define EXT3_DATA_TRANS_BLOCKS(sb) (EXT3_SINGLEDATA_TRANS_BLOCKS + \ |
| 46 | EXT3_XATTR_TRANS_BLOCKS - 2 + \ | 46 | EXT3_XATTR_TRANS_BLOCKS - 2 + \ |
| 47 | 2*EXT3_QUOTA_TRANS_BLOCKS(sb)) | 47 | EXT3_MAXQUOTAS_TRANS_BLOCKS(sb)) |
| 48 | 48 | ||
| 49 | /* Delete operations potentially hit one directory's namespace plus an | 49 | /* Delete operations potentially hit one directory's namespace plus an |
| 50 | * entire inode, plus arbitrary amounts of bitmap/indirection data. Be | 50 | * entire inode, plus arbitrary amounts of bitmap/indirection data. Be |
| 51 | * generous. We can grow the delete transaction later if necessary. */ | 51 | * generous. We can grow the delete transaction later if necessary. */ |
| 52 | 52 | ||
| 53 | #define EXT3_DELETE_TRANS_BLOCKS(sb) (2 * EXT3_DATA_TRANS_BLOCKS(sb) + 64) | 53 | #define EXT3_DELETE_TRANS_BLOCKS(sb) (EXT3_MAXQUOTAS_TRANS_BLOCKS(sb) + 64) |
| 54 | 54 | ||
| 55 | /* Define an arbitrary limit for the amount of data we will anticipate | 55 | /* Define an arbitrary limit for the amount of data we will anticipate |
| 56 | * writing to any given transaction. For unbounded transactions such as | 56 | * writing to any given transaction. For unbounded transactions such as |
| @@ -86,6 +86,9 @@ | |||
| 86 | #define EXT3_QUOTA_INIT_BLOCKS(sb) 0 | 86 | #define EXT3_QUOTA_INIT_BLOCKS(sb) 0 |
| 87 | #define EXT3_QUOTA_DEL_BLOCKS(sb) 0 | 87 | #define EXT3_QUOTA_DEL_BLOCKS(sb) 0 |
| 88 | #endif | 88 | #endif |
| 89 | #define EXT3_MAXQUOTAS_TRANS_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_TRANS_BLOCKS(sb)) | ||
| 90 | #define EXT3_MAXQUOTAS_INIT_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_INIT_BLOCKS(sb)) | ||
| 91 | #define EXT3_MAXQUOTAS_DEL_BLOCKS(sb) (MAXQUOTAS*EXT3_QUOTA_DEL_BLOCKS(sb)) | ||
| 89 | 92 | ||
| 90 | int | 93 | int |
| 91 | ext3_mark_iloc_dirty(handle_t *handle, | 94 | ext3_mark_iloc_dirty(handle_t *handle, |
diff --git a/include/linux/fiemap.h b/include/linux/fiemap.h index 934e22d65801..d830747f5c0b 100644 --- a/include/linux/fiemap.h +++ b/include/linux/fiemap.h | |||
| @@ -62,5 +62,7 @@ struct fiemap { | |||
| 62 | #define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively | 62 | #define FIEMAP_EXTENT_MERGED 0x00001000 /* File does not natively |
| 63 | * support extents. Result | 63 | * support extents. Result |
| 64 | * merged for efficiency. */ | 64 | * merged for efficiency. */ |
| 65 | #define FIEMAP_EXTENT_SHARED 0x00002000 /* Space shared with other | ||
| 66 | * files. */ | ||
| 65 | 67 | ||
| 66 | #endif /* _LINUX_FIEMAP_H */ | 68 | #endif /* _LINUX_FIEMAP_H */ |
diff --git a/include/linux/firewire-cdev.h b/include/linux/firewire-cdev.h index c6b3ca3af6df..1f716d9f714b 100644 --- a/include/linux/firewire-cdev.h +++ b/include/linux/firewire-cdev.h | |||
| @@ -340,6 +340,9 @@ struct fw_cdev_send_response { | |||
| 340 | * The @closure field is passed back to userspace in the response event. | 340 | * The @closure field is passed back to userspace in the response event. |
| 341 | * The @handle field is an out parameter, returning a handle to the allocated | 341 | * The @handle field is an out parameter, returning a handle to the allocated |
| 342 | * range to be used for later deallocation of the range. | 342 | * range to be used for later deallocation of the range. |
| 343 | * | ||
| 344 | * The address range is allocated on all local nodes. The address allocation | ||
| 345 | * is exclusive except for the FCP command and response registers. | ||
| 343 | */ | 346 | */ |
| 344 | struct fw_cdev_allocate { | 347 | struct fw_cdev_allocate { |
| 345 | __u64 offset; | 348 | __u64 offset; |
diff --git a/include/linux/firewire.h b/include/linux/firewire.h index 9416a461b696..a0e67150a729 100644 --- a/include/linux/firewire.h +++ b/include/linux/firewire.h | |||
| @@ -248,8 +248,8 @@ typedef void (*fw_transaction_callback_t)(struct fw_card *card, int rcode, | |||
| 248 | void *data, size_t length, | 248 | void *data, size_t length, |
| 249 | void *callback_data); | 249 | void *callback_data); |
| 250 | /* | 250 | /* |
| 251 | * Important note: The callback must guarantee that either fw_send_response() | 251 | * Important note: Except for the FCP registers, the callback must guarantee |
| 252 | * or kfree() is called on the @request. | 252 | * that either fw_send_response() or kfree() is called on the @request. |
| 253 | */ | 253 | */ |
| 254 | typedef void (*fw_address_callback_t)(struct fw_card *card, | 254 | typedef void (*fw_address_callback_t)(struct fw_card *card, |
| 255 | struct fw_request *request, | 255 | struct fw_request *request, |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 66bc0a54b284..9147ca88f253 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
| @@ -1095,10 +1095,6 @@ struct file_lock { | |||
| 1095 | 1095 | ||
| 1096 | extern void send_sigio(struct fown_struct *fown, int fd, int band); | 1096 | extern void send_sigio(struct fown_struct *fown, int fd, int band); |
| 1097 | 1097 | ||
| 1098 | /* fs/sync.c */ | ||
| 1099 | extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset, | ||
| 1100 | loff_t endbyte, unsigned int flags); | ||
| 1101 | |||
| 1102 | #ifdef CONFIG_FILE_LOCKING | 1098 | #ifdef CONFIG_FILE_LOCKING |
| 1103 | extern int fcntl_getlk(struct file *, struct flock __user *); | 1099 | extern int fcntl_getlk(struct file *, struct flock __user *); |
| 1104 | extern int fcntl_setlk(unsigned int, struct file *, unsigned int, | 1100 | extern int fcntl_setlk(unsigned int, struct file *, unsigned int, |
| @@ -1591,7 +1587,7 @@ struct super_operations { | |||
| 1591 | * until that flag is cleared. I_WILL_FREE, I_FREEING and I_CLEAR are set at | 1587 | * until that flag is cleared. I_WILL_FREE, I_FREEING and I_CLEAR are set at |
| 1592 | * various stages of removing an inode. | 1588 | * various stages of removing an inode. |
| 1593 | * | 1589 | * |
| 1594 | * Two bits are used for locking and completion notification, I_LOCK and I_SYNC. | 1590 | * Two bits are used for locking and completion notification, I_NEW and I_SYNC. |
| 1595 | * | 1591 | * |
| 1596 | * I_DIRTY_SYNC Inode is dirty, but doesn't have to be written on | 1592 | * I_DIRTY_SYNC Inode is dirty, but doesn't have to be written on |
| 1597 | * fdatasync(). i_atime is the usual cause. | 1593 | * fdatasync(). i_atime is the usual cause. |
| @@ -1600,8 +1596,14 @@ struct super_operations { | |||
| 1600 | * don't have to write inode on fdatasync() when only | 1596 | * don't have to write inode on fdatasync() when only |
| 1601 | * mtime has changed in it. | 1597 | * mtime has changed in it. |
| 1602 | * I_DIRTY_PAGES Inode has dirty pages. Inode itself may be clean. | 1598 | * I_DIRTY_PAGES Inode has dirty pages. Inode itself may be clean. |
| 1603 | * I_NEW get_new_inode() sets i_state to I_LOCK|I_NEW. Both | 1599 | * I_NEW Serves as both a mutex and completion notification. |
| 1604 | * are cleared by unlock_new_inode(), called from iget(). | 1600 | * New inodes set I_NEW. If two processes both create |
| 1601 | * the same inode, one of them will release its inode and | ||
| 1602 | * wait for I_NEW to be released before returning. | ||
| 1603 | * Inodes in I_WILL_FREE, I_FREEING or I_CLEAR state can | ||
| 1604 | * also cause waiting on I_NEW, without I_NEW actually | ||
| 1605 | * being set. find_inode() uses this to prevent returning | ||
| 1606 | * nearly-dead inodes. | ||
| 1605 | * I_WILL_FREE Must be set when calling write_inode_now() if i_count | 1607 | * I_WILL_FREE Must be set when calling write_inode_now() if i_count |
| 1606 | * is zero. I_FREEING must be set when I_WILL_FREE is | 1608 | * is zero. I_FREEING must be set when I_WILL_FREE is |
| 1607 | * cleared. | 1609 | * cleared. |
| @@ -1615,35 +1617,23 @@ struct super_operations { | |||
| 1615 | * prohibited for many purposes. iget() must wait for | 1617 | * prohibited for many purposes. iget() must wait for |
| 1616 | * the inode to be completely released, then create it | 1618 | * the inode to be completely released, then create it |
| 1617 | * anew. Other functions will just ignore such inodes, | 1619 | * anew. Other functions will just ignore such inodes, |
| 1618 | * if appropriate. I_LOCK is used for waiting. | 1620 | * if appropriate. I_NEW is used for waiting. |
| 1619 | * | 1621 | * |
| 1620 | * I_LOCK Serves as both a mutex and completion notification. | 1622 | * I_SYNC Synchonized write of dirty inode data. The bits is |
| 1621 | * New inodes set I_LOCK. If two processes both create | 1623 | * set during data writeback, and cleared with a wakeup |
| 1622 | * the same inode, one of them will release its inode and | 1624 | * on the bit address once it is done. |
| 1623 | * wait for I_LOCK to be released before returning. | ||
| 1624 | * Inodes in I_WILL_FREE, I_FREEING or I_CLEAR state can | ||
| 1625 | * also cause waiting on I_LOCK, without I_LOCK actually | ||
| 1626 | * being set. find_inode() uses this to prevent returning | ||
| 1627 | * nearly-dead inodes. | ||
| 1628 | * I_SYNC Similar to I_LOCK, but limited in scope to writeback | ||
| 1629 | * of inode dirty data. Having a separate lock for this | ||
| 1630 | * purpose reduces latency and prevents some filesystem- | ||
| 1631 | * specific deadlocks. | ||
| 1632 | * | 1625 | * |
| 1633 | * 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? |
| 1634 | * Q: igrab() only checks on (I_FREEING|I_WILL_FREE). Should it also check on | ||
| 1635 | * I_CLEAR? If not, why? | ||
| 1636 | */ | 1627 | */ |
| 1637 | #define I_DIRTY_SYNC 1 | 1628 | #define I_DIRTY_SYNC 1 |
| 1638 | #define I_DIRTY_DATASYNC 2 | 1629 | #define I_DIRTY_DATASYNC 2 |
| 1639 | #define I_DIRTY_PAGES 4 | 1630 | #define I_DIRTY_PAGES 4 |
| 1640 | #define I_NEW 8 | 1631 | #define __I_NEW 3 |
| 1632 | #define I_NEW (1 << __I_NEW) | ||
| 1641 | #define I_WILL_FREE 16 | 1633 | #define I_WILL_FREE 16 |
| 1642 | #define I_FREEING 32 | 1634 | #define I_FREEING 32 |
| 1643 | #define I_CLEAR 64 | 1635 | #define I_CLEAR 64 |
| 1644 | #define __I_LOCK 7 | 1636 | #define __I_SYNC 7 |
| 1645 | #define I_LOCK (1 << __I_LOCK) | ||
| 1646 | #define __I_SYNC 8 | ||
| 1647 | #define I_SYNC (1 << __I_SYNC) | 1637 | #define I_SYNC (1 << __I_SYNC) |
| 1648 | 1638 | ||
| 1649 | #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) | 1639 | #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) |
| @@ -2307,6 +2297,7 @@ extern const struct inode_operations page_symlink_inode_operations; | |||
| 2307 | extern int generic_readlink(struct dentry *, char __user *, int); | 2297 | extern int generic_readlink(struct dentry *, char __user *, int); |
| 2308 | extern void generic_fillattr(struct inode *, struct kstat *); | 2298 | extern void generic_fillattr(struct inode *, struct kstat *); |
| 2309 | extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); | 2299 | extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); |
| 2300 | void __inode_add_bytes(struct inode *inode, loff_t bytes); | ||
| 2310 | void inode_add_bytes(struct inode *inode, loff_t bytes); | 2301 | void inode_add_bytes(struct inode *inode, loff_t bytes); |
| 2311 | void inode_sub_bytes(struct inode *inode, loff_t bytes); | 2302 | void inode_sub_bytes(struct inode *inode, loff_t bytes); |
| 2312 | loff_t inode_get_bytes(struct inode *inode); | 2303 | loff_t inode_get_bytes(struct inode *inode); |
| @@ -2472,5 +2463,8 @@ int proc_nr_files(struct ctl_table *table, int write, | |||
| 2472 | 2463 | ||
| 2473 | int __init get_filesystem_list(char *buf); | 2464 | int __init get_filesystem_list(char *buf); |
| 2474 | 2465 | ||
| 2466 | #define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE]) | ||
| 2467 | #define OPEN_FMODE(flag) ((__force fmode_t)((flag + 1) & O_ACCMODE)) | ||
| 2468 | |||
| 2475 | #endif /* __KERNEL__ */ | 2469 | #endif /* __KERNEL__ */ |
| 2476 | #endif /* _LINUX_FS_H */ | 2470 | #endif /* _LINUX_FS_H */ |
diff --git a/include/linux/fs_stack.h b/include/linux/fs_stack.h index bb516ceeefc9..da317c7163ab 100644 --- a/include/linux/fs_stack.h +++ b/include/linux/fs_stack.h | |||
| @@ -8,10 +8,8 @@ | |||
| 8 | #include <linux/fs.h> | 8 | #include <linux/fs.h> |
| 9 | 9 | ||
| 10 | /* externs for fs/stack.c */ | 10 | /* externs for fs/stack.c */ |
| 11 | extern void fsstack_copy_attr_all(struct inode *dest, const struct inode *src, | 11 | extern void fsstack_copy_attr_all(struct inode *dest, const struct inode *src); |
| 12 | int (*get_nlinks)(struct inode *)); | 12 | extern void fsstack_copy_inode_size(struct inode *dst, struct inode *src); |
| 13 | |||
| 14 | extern void fsstack_copy_inode_size(struct inode *dst, const struct inode *src); | ||
| 15 | 13 | ||
| 16 | /* inlines */ | 14 | /* inlines */ |
| 17 | static inline void fsstack_copy_attr_atime(struct inode *dest, | 15 | static inline void fsstack_copy_attr_atime(struct inode *dest, |
diff --git a/include/linux/highmem.h b/include/linux/highmem.h index 211ff4497269..ab2cc20e21a5 100644 --- a/include/linux/highmem.h +++ b/include/linux/highmem.h | |||
| @@ -46,7 +46,7 @@ void kmap_flush_unused(void); | |||
| 46 | 46 | ||
| 47 | static inline unsigned int nr_free_highpages(void) { return 0; } | 47 | static inline unsigned int nr_free_highpages(void) { return 0; } |
| 48 | 48 | ||
| 49 | #define totalhigh_pages 0 | 49 | #define totalhigh_pages 0UL |
| 50 | 50 | ||
| 51 | #ifndef ARCH_HAS_KMAP | 51 | #ifndef ARCH_HAS_KMAP |
| 52 | static inline void *kmap(struct page *page) | 52 | static inline void *kmap(struct page *page) |
diff --git a/include/linux/i2c/adp5588.h b/include/linux/i2c/adp5588.h index fc5db826b48e..02c9af374741 100644 --- a/include/linux/i2c/adp5588.h +++ b/include/linux/i2c/adp5588.h | |||
| @@ -89,4 +89,16 @@ struct adp5588_kpad_platform_data { | |||
| 89 | unsigned short unlock_key2; /* Unlock Key 2 */ | 89 | unsigned short unlock_key2; /* Unlock Key 2 */ |
| 90 | }; | 90 | }; |
| 91 | 91 | ||
| 92 | struct adp5588_gpio_platform_data { | ||
| 93 | unsigned gpio_start; /* GPIO Chip base # */ | ||
| 94 | unsigned pullup_dis_mask; /* Pull-Up Disable Mask */ | ||
| 95 | int (*setup)(struct i2c_client *client, | ||
| 96 | int gpio, unsigned ngpio, | ||
| 97 | void *context); | ||
| 98 | int (*teardown)(struct i2c_client *client, | ||
| 99 | int gpio, unsigned ngpio, | ||
| 100 | void *context); | ||
| 101 | void *context; | ||
| 102 | }; | ||
| 103 | |||
| 92 | #endif | 104 | #endif |
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index d9724a28c0c2..163c840437d6 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h | |||
| @@ -832,7 +832,7 @@ struct ieee80211_ht_cap { | |||
| 832 | #define IEEE80211_HT_CAP_DELAY_BA 0x0400 | 832 | #define IEEE80211_HT_CAP_DELAY_BA 0x0400 |
| 833 | #define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 | 833 | #define IEEE80211_HT_CAP_MAX_AMSDU 0x0800 |
| 834 | #define IEEE80211_HT_CAP_DSSSCCK40 0x1000 | 834 | #define IEEE80211_HT_CAP_DSSSCCK40 0x1000 |
| 835 | #define IEEE80211_HT_CAP_PSMP_SUPPORT 0x2000 | 835 | #define IEEE80211_HT_CAP_RESERVED 0x2000 |
| 836 | #define IEEE80211_HT_CAP_40MHZ_INTOLERANT 0x4000 | 836 | #define IEEE80211_HT_CAP_40MHZ_INTOLERANT 0x4000 |
| 837 | #define IEEE80211_HT_CAP_LSIG_TXOP_PROT 0x8000 | 837 | #define IEEE80211_HT_CAP_LSIG_TXOP_PROT 0x8000 |
| 838 | 838 | ||
diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h index 699e85c01a4d..b2304929434e 100644 --- a/include/linux/inetdevice.h +++ b/include/linux/inetdevice.h | |||
| @@ -81,6 +81,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev) | |||
| 81 | #define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING) | 81 | #define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING) |
| 82 | #define IN_DEV_MFORWARD(in_dev) IN_DEV_ANDCONF((in_dev), MC_FORWARDING) | 82 | #define IN_DEV_MFORWARD(in_dev) IN_DEV_ANDCONF((in_dev), MC_FORWARDING) |
| 83 | #define IN_DEV_RPFILTER(in_dev) IN_DEV_MAXCONF((in_dev), RP_FILTER) | 83 | #define IN_DEV_RPFILTER(in_dev) IN_DEV_MAXCONF((in_dev), RP_FILTER) |
| 84 | #define IN_DEV_SRC_VMARK(in_dev) IN_DEV_ORCONF((in_dev), SRC_VMARK) | ||
| 84 | #define IN_DEV_SOURCE_ROUTE(in_dev) IN_DEV_ANDCONF((in_dev), \ | 85 | #define IN_DEV_SOURCE_ROUTE(in_dev) IN_DEV_ANDCONF((in_dev), \ |
| 85 | ACCEPT_SOURCE_ROUTE) | 86 | ACCEPT_SOURCE_ROUTE) |
| 86 | #define IN_DEV_ACCEPT_LOCAL(in_dev) IN_DEV_ORCONF((in_dev), ACCEPT_LOCAL) | 87 | #define IN_DEV_ACCEPT_LOCAL(in_dev) IN_DEV_ORCONF((in_dev), ACCEPT_LOCAL) |
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/jbd2.h b/include/linux/jbd2.h index f1011f7f3d41..638ce4554c76 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h | |||
| @@ -653,6 +653,7 @@ struct transaction_s | |||
| 653 | * waiting for it to finish. | 653 | * waiting for it to finish. |
| 654 | */ | 654 | */ |
| 655 | unsigned int t_synchronous_commit:1; | 655 | unsigned int t_synchronous_commit:1; |
| 656 | unsigned int t_flushed_data_blocks:1; | ||
| 656 | 657 | ||
| 657 | /* | 658 | /* |
| 658 | * For use by the filesystem to store fs-specific data | 659 | * For use by the filesystem to store fs-specific data |
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h index ad6bdf5a5970..7c6b32a1421c 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,562 @@ 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 | * Note1: the macro can be used inside struct or union declaration | ||
| 73 | * Note2: 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 DECLARE_KFIFO | ||
| 85 | * @name: name of the declared kfifo datatype | ||
| 86 | */ | ||
| 87 | #define INIT_KFIFO(name) \ | ||
| 88 | name = __kfifo_initializer(sizeof(name##kfifo_buffer) - \ | ||
| 89 | sizeof(struct kfifo), name##kfifo_buffer) | ||
| 90 | |||
| 91 | /** | ||
| 92 | * DEFINE_KFIFO - macro to define and initialize a kfifo | ||
| 93 | * @name: name of the declared kfifo datatype | ||
| 94 | * @size: size of the fifo buffer | ||
| 95 | * | ||
| 96 | * Note1: the macro can be used for global and local kfifo data type variables | ||
| 97 | * Note2: the macro creates two objects: | ||
| 98 | * A kfifo object with the given name and a buffer for the kfifo | ||
| 99 | * object named name##kfifo_buffer | ||
| 100 | */ | ||
| 101 | #define DEFINE_KFIFO(name, size) \ | ||
| 102 | unsigned char name##kfifo_buffer[size]; \ | ||
| 103 | struct kfifo name = __kfifo_initializer(size, name##kfifo_buffer) | ||
| 104 | |||
| 105 | #undef __kfifo_initializer | ||
| 106 | |||
| 107 | extern void kfifo_init(struct kfifo *fifo, unsigned char *buffer, | ||
| 108 | unsigned int size); | ||
| 109 | extern __must_check int kfifo_alloc(struct kfifo *fifo, unsigned int size, | ||
| 110 | gfp_t gfp_mask); | ||
| 39 | extern void kfifo_free(struct kfifo *fifo); | 111 | extern void kfifo_free(struct kfifo *fifo); |
| 40 | extern unsigned int __kfifo_put(struct kfifo *fifo, | 112 | extern unsigned int kfifo_in(struct kfifo *fifo, |
| 41 | const unsigned char *buffer, unsigned int len); | 113 | const unsigned char *from, unsigned int len); |
| 42 | extern unsigned int __kfifo_get(struct kfifo *fifo, | 114 | extern __must_check unsigned int kfifo_out(struct kfifo *fifo, |
| 43 | unsigned char *buffer, unsigned int len); | 115 | unsigned char *to, unsigned int len); |
| 44 | 116 | ||
| 45 | /** | 117 | /** |
| 46 | * __kfifo_reset - removes the entire FIFO contents, no locking version | 118 | * kfifo_reset - removes the entire FIFO contents |
| 47 | * @fifo: the fifo to be emptied. | 119 | * @fifo: the fifo to be emptied. |
| 48 | */ | 120 | */ |
| 49 | static inline void __kfifo_reset(struct kfifo *fifo) | 121 | static inline void kfifo_reset(struct kfifo *fifo) |
| 50 | { | 122 | { |
| 51 | fifo->in = fifo->out = 0; | 123 | fifo->in = fifo->out = 0; |
| 52 | } | 124 | } |
| 53 | 125 | ||
| 54 | /** | 126 | /** |
| 55 | * kfifo_reset - removes the entire FIFO contents | 127 | * kfifo_reset_out - skip FIFO contents |
| 56 | * @fifo: the fifo to be emptied. | 128 | * @fifo: the fifo to be emptied. |
| 57 | */ | 129 | */ |
| 58 | static inline void kfifo_reset(struct kfifo *fifo) | 130 | static inline void kfifo_reset_out(struct kfifo *fifo) |
| 59 | { | 131 | { |
| 60 | unsigned long flags; | 132 | smp_mb(); |
| 133 | fifo->out = fifo->in; | ||
| 134 | } | ||
| 61 | 135 | ||
| 62 | spin_lock_irqsave(fifo->lock, flags); | 136 | /** |
| 137 | * kfifo_size - returns the size of the fifo in bytes | ||
| 138 | * @fifo: the fifo to be used. | ||
| 139 | */ | ||
| 140 | static inline __must_check unsigned int kfifo_size(struct kfifo *fifo) | ||
| 141 | { | ||
| 142 | return fifo->size; | ||
| 143 | } | ||
| 63 | 144 | ||
| 64 | __kfifo_reset(fifo); | 145 | /** |
| 146 | * kfifo_len - returns the number of used bytes in the FIFO | ||
| 147 | * @fifo: the fifo to be used. | ||
| 148 | */ | ||
| 149 | static inline unsigned int kfifo_len(struct kfifo *fifo) | ||
| 150 | { | ||
| 151 | register unsigned int out; | ||
| 65 | 152 | ||
| 66 | spin_unlock_irqrestore(fifo->lock, flags); | 153 | out = fifo->out; |
| 154 | smp_rmb(); | ||
| 155 | return fifo->in - out; | ||
| 67 | } | 156 | } |
| 68 | 157 | ||
| 69 | /** | 158 | /** |
| 70 | * kfifo_put - puts some data into the FIFO | 159 | * kfifo_is_empty - returns true if the fifo is empty |
| 71 | * @fifo: the fifo to be used. | 160 | * @fifo: the fifo to be used. |
| 72 | * @buffer: the data to be added. | 161 | */ |
| 73 | * @len: the length of the data to be added. | 162 | static inline __must_check int kfifo_is_empty(struct kfifo *fifo) |
| 163 | { | ||
| 164 | return fifo->in == fifo->out; | ||
| 165 | } | ||
| 166 | |||
| 167 | /** | ||
| 168 | * kfifo_is_full - returns true if the fifo is full | ||
| 169 | * @fifo: the fifo to be used. | ||
| 170 | */ | ||
| 171 | static inline __must_check int kfifo_is_full(struct kfifo *fifo) | ||
| 172 | { | ||
| 173 | return kfifo_len(fifo) == kfifo_size(fifo); | ||
| 174 | } | ||
| 175 | |||
| 176 | /** | ||
| 177 | * kfifo_avail - returns the number of bytes available in the FIFO | ||
| 178 | * @fifo: the fifo to be used. | ||
| 179 | */ | ||
| 180 | static inline __must_check unsigned int kfifo_avail(struct kfifo *fifo) | ||
| 181 | { | ||
| 182 | return kfifo_size(fifo) - kfifo_len(fifo); | ||
| 183 | } | ||
| 184 | |||
| 185 | /** | ||
| 186 | * kfifo_in_locked - puts some data into the FIFO using a spinlock for locking | ||
| 187 | * @fifo: the fifo to be used. | ||
| 188 | * @from: the data to be added. | ||
| 189 | * @n: the length of the data to be added. | ||
| 190 | * @lock: pointer to the spinlock to use for locking. | ||
| 74 | * | 191 | * |
| 75 | * This function copies at most @len bytes from the @buffer into | 192 | * 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 | 193 | * the FIFO depending on the free space, and returns the number of |
| 77 | * bytes copied. | 194 | * bytes copied. |
| 78 | */ | 195 | */ |
| 79 | static inline unsigned int kfifo_put(struct kfifo *fifo, | 196 | static inline unsigned int kfifo_in_locked(struct kfifo *fifo, |
| 80 | const unsigned char *buffer, unsigned int len) | 197 | const unsigned char *from, unsigned int n, spinlock_t *lock) |
| 81 | { | 198 | { |
| 82 | unsigned long flags; | 199 | unsigned long flags; |
| 83 | unsigned int ret; | 200 | unsigned int ret; |
| 84 | 201 | ||
| 85 | spin_lock_irqsave(fifo->lock, flags); | 202 | spin_lock_irqsave(lock, flags); |
| 86 | 203 | ||
| 87 | ret = __kfifo_put(fifo, buffer, len); | 204 | ret = kfifo_in(fifo, from, n); |
| 88 | 205 | ||
| 89 | spin_unlock_irqrestore(fifo->lock, flags); | 206 | spin_unlock_irqrestore(lock, flags); |
| 90 | 207 | ||
| 91 | return ret; | 208 | return ret; |
| 92 | } | 209 | } |
| 93 | 210 | ||
| 94 | /** | 211 | /** |
| 95 | * kfifo_get - gets some data from the FIFO | 212 | * kfifo_out_locked - gets some data from the FIFO using a spinlock for locking |
| 96 | * @fifo: the fifo to be used. | 213 | * @fifo: the fifo to be used. |
| 97 | * @buffer: where the data must be copied. | 214 | * @to: where the data must be copied. |
| 98 | * @len: the size of the destination buffer. | 215 | * @n: the size of the destination buffer. |
| 216 | * @lock: pointer to the spinlock to use for locking. | ||
| 99 | * | 217 | * |
| 100 | * This function copies at most @len bytes from the FIFO into the | 218 | * This function copies at most @len bytes from the FIFO into the |
| 101 | * @buffer and returns the number of copied bytes. | 219 | * @to buffer and returns the number of copied bytes. |
| 102 | */ | 220 | */ |
| 103 | static inline unsigned int kfifo_get(struct kfifo *fifo, | 221 | static inline __must_check unsigned int kfifo_out_locked(struct kfifo *fifo, |
| 104 | unsigned char *buffer, unsigned int len) | 222 | unsigned char *to, unsigned int n, spinlock_t *lock) |
| 105 | { | 223 | { |
| 106 | unsigned long flags; | 224 | unsigned long flags; |
| 107 | unsigned int ret; | 225 | unsigned int ret; |
| 108 | 226 | ||
| 109 | spin_lock_irqsave(fifo->lock, flags); | 227 | spin_lock_irqsave(lock, flags); |
| 110 | 228 | ||
| 111 | ret = __kfifo_get(fifo, buffer, len); | 229 | ret = kfifo_out(fifo, to, n); |
| 112 | 230 | ||
| 113 | /* | 231 | /* |
| 114 | * optimization: if the FIFO is empty, set the indices to 0 | 232 | * optimization: if the FIFO is empty, set the indices to 0 |
| 115 | * so we don't wrap the next time | 233 | * so we don't wrap the next time |
| 116 | */ | 234 | */ |
| 117 | if (fifo->in == fifo->out) | 235 | if (kfifo_is_empty(fifo)) |
| 118 | fifo->in = fifo->out = 0; | 236 | kfifo_reset(fifo); |
| 237 | |||
| 238 | spin_unlock_irqrestore(lock, flags); | ||
| 239 | |||
| 240 | return ret; | ||
| 241 | } | ||
| 242 | |||
| 243 | extern void kfifo_skip(struct kfifo *fifo, unsigned int len); | ||
| 244 | |||
| 245 | extern __must_check unsigned int kfifo_from_user(struct kfifo *fifo, | ||
| 246 | const void __user *from, unsigned int n); | ||
| 247 | |||
| 248 | extern __must_check unsigned int kfifo_to_user(struct kfifo *fifo, | ||
| 249 | void __user *to, unsigned int n); | ||
| 250 | |||
| 251 | /* | ||
| 252 | * __kfifo_add_out internal helper function for updating the out offset | ||
| 253 | */ | ||
| 254 | static inline void __kfifo_add_out(struct kfifo *fifo, | ||
| 255 | unsigned int off) | ||
| 256 | { | ||
| 257 | smp_mb(); | ||
| 258 | fifo->out += off; | ||
| 259 | } | ||
| 260 | |||
| 261 | /* | ||
| 262 | * __kfifo_add_in internal helper function for updating the in offset | ||
| 263 | */ | ||
| 264 | static inline void __kfifo_add_in(struct kfifo *fifo, | ||
| 265 | unsigned int off) | ||
| 266 | { | ||
| 267 | smp_wmb(); | ||
| 268 | fifo->in += off; | ||
| 269 | } | ||
| 270 | |||
| 271 | /* | ||
| 272 | * __kfifo_off internal helper function for calculating the index of a | ||
| 273 | * given offeset | ||
| 274 | */ | ||
| 275 | static inline unsigned int __kfifo_off(struct kfifo *fifo, unsigned int off) | ||
| 276 | { | ||
| 277 | return off & (fifo->size - 1); | ||
| 278 | } | ||
| 279 | |||
| 280 | /* | ||
| 281 | * __kfifo_peek_n internal helper function for determinate the length of | ||
| 282 | * the next record in the fifo | ||
| 283 | */ | ||
| 284 | static inline unsigned int __kfifo_peek_n(struct kfifo *fifo, | ||
| 285 | unsigned int recsize) | ||
| 286 | { | ||
| 287 | #define __KFIFO_GET(fifo, off, shift) \ | ||
| 288 | ((fifo)->buffer[__kfifo_off((fifo), (fifo)->out+(off))] << (shift)) | ||
| 289 | |||
| 290 | unsigned int l; | ||
| 291 | |||
| 292 | l = __KFIFO_GET(fifo, 0, 0); | ||
| 293 | |||
| 294 | if (--recsize) | ||
| 295 | l |= __KFIFO_GET(fifo, 1, 8); | ||
| 296 | |||
| 297 | return l; | ||
| 298 | #undef __KFIFO_GET | ||
| 299 | } | ||
| 300 | |||
| 301 | /* | ||
| 302 | * __kfifo_poke_n internal helper function for storing the length of | ||
| 303 | * the next record into the fifo | ||
| 304 | */ | ||
| 305 | static inline void __kfifo_poke_n(struct kfifo *fifo, | ||
| 306 | unsigned int recsize, unsigned int n) | ||
| 307 | { | ||
| 308 | #define __KFIFO_PUT(fifo, off, val, shift) \ | ||
| 309 | ( \ | ||
| 310 | (fifo)->buffer[__kfifo_off((fifo), (fifo)->in+(off))] = \ | ||
| 311 | (unsigned char)((val) >> (shift)) \ | ||
| 312 | ) | ||
| 119 | 313 | ||
| 120 | spin_unlock_irqrestore(fifo->lock, flags); | 314 | __KFIFO_PUT(fifo, 0, n, 0); |
| 121 | 315 | ||
| 316 | if (--recsize) | ||
| 317 | __KFIFO_PUT(fifo, 1, n, 8); | ||
| 318 | #undef __KFIFO_PUT | ||
| 319 | } | ||
| 320 | |||
| 321 | /* | ||
| 322 | * __kfifo_in_... internal functions for put date into the fifo | ||
| 323 | * do not call it directly, use kfifo_in_rec() instead | ||
| 324 | */ | ||
| 325 | extern unsigned int __kfifo_in_n(struct kfifo *fifo, | ||
| 326 | const void *from, unsigned int n, unsigned int recsize); | ||
| 327 | |||
| 328 | extern unsigned int __kfifo_in_generic(struct kfifo *fifo, | ||
| 329 | const void *from, unsigned int n, unsigned int recsize); | ||
| 330 | |||
| 331 | static inline unsigned int __kfifo_in_rec(struct kfifo *fifo, | ||
| 332 | const void *from, unsigned int n, unsigned int recsize) | ||
| 333 | { | ||
| 334 | unsigned int ret; | ||
| 335 | |||
| 336 | ret = __kfifo_in_n(fifo, from, n, recsize); | ||
| 337 | |||
| 338 | if (likely(ret == 0)) { | ||
| 339 | if (recsize) | ||
| 340 | __kfifo_poke_n(fifo, recsize, n); | ||
| 341 | __kfifo_add_in(fifo, n + recsize); | ||
| 342 | } | ||
| 122 | return ret; | 343 | return ret; |
| 123 | } | 344 | } |
| 124 | 345 | ||
| 125 | /** | 346 | /** |
| 126 | * __kfifo_len - returns the number of bytes available in the FIFO, no locking version | 347 | * kfifo_in_rec - puts some record data into the FIFO |
| 127 | * @fifo: the fifo to be used. | 348 | * @fifo: the fifo to be used. |
| 349 | * @from: the data to be added. | ||
| 350 | * @n: the length of the data to be added. | ||
| 351 | * @recsize: size of record field | ||
| 352 | * | ||
| 353 | * This function copies @n bytes from the @from into the FIFO and returns | ||
| 354 | * the number of bytes which cannot be copied. | ||
| 355 | * A returned value greater than the @n value means that the record doesn't | ||
| 356 | * fit into the buffer. | ||
| 357 | * | ||
| 358 | * Note that with only one concurrent reader and one concurrent | ||
| 359 | * writer, you don't need extra locking to use these functions. | ||
| 128 | */ | 360 | */ |
| 129 | static inline unsigned int __kfifo_len(struct kfifo *fifo) | 361 | static inline __must_check unsigned int kfifo_in_rec(struct kfifo *fifo, |
| 362 | void *from, unsigned int n, unsigned int recsize) | ||
| 130 | { | 363 | { |
| 131 | return fifo->in - fifo->out; | 364 | if (!__builtin_constant_p(recsize)) |
| 365 | return __kfifo_in_generic(fifo, from, n, recsize); | ||
| 366 | return __kfifo_in_rec(fifo, from, n, recsize); | ||
| 367 | } | ||
| 368 | |||
| 369 | /* | ||
| 370 | * __kfifo_out_... internal functions for get date from the fifo | ||
| 371 | * do not call it directly, use kfifo_out_rec() instead | ||
| 372 | */ | ||
| 373 | extern unsigned int __kfifo_out_n(struct kfifo *fifo, | ||
| 374 | void *to, unsigned int reclen, unsigned int recsize); | ||
| 375 | |||
| 376 | extern unsigned int __kfifo_out_generic(struct kfifo *fifo, | ||
| 377 | void *to, unsigned int n, | ||
| 378 | unsigned int recsize, unsigned int *total); | ||
| 379 | |||
| 380 | static inline unsigned int __kfifo_out_rec(struct kfifo *fifo, | ||
| 381 | void *to, unsigned int n, unsigned int recsize, | ||
| 382 | unsigned int *total) | ||
| 383 | { | ||
| 384 | unsigned int l; | ||
| 385 | |||
| 386 | if (!recsize) { | ||
| 387 | l = n; | ||
| 388 | if (total) | ||
| 389 | *total = l; | ||
| 390 | } else { | ||
| 391 | l = __kfifo_peek_n(fifo, recsize); | ||
| 392 | if (total) | ||
| 393 | *total = l; | ||
| 394 | if (n < l) | ||
| 395 | return l; | ||
| 396 | } | ||
| 397 | |||
| 398 | return __kfifo_out_n(fifo, to, l, recsize); | ||
| 132 | } | 399 | } |
| 133 | 400 | ||
| 134 | /** | 401 | /** |
| 135 | * kfifo_len - returns the number of bytes available in the FIFO | 402 | * kfifo_out_rec - gets some record data from the FIFO |
| 136 | * @fifo: the fifo to be used. | 403 | * @fifo: the fifo to be used. |
| 404 | * @to: where the data must be copied. | ||
| 405 | * @n: the size of the destination buffer. | ||
| 406 | * @recsize: size of record field | ||
| 407 | * @total: pointer where the total number of to copied bytes should stored | ||
| 408 | * | ||
| 409 | * This function copies at most @n bytes from the FIFO to @to and returns the | ||
| 410 | * number of bytes which cannot be copied. | ||
| 411 | * A returned value greater than the @n value means that the record doesn't | ||
| 412 | * fit into the @to buffer. | ||
| 413 | * | ||
| 414 | * Note that with only one concurrent reader and one concurrent | ||
| 415 | * writer, you don't need extra locking to use these functions. | ||
| 137 | */ | 416 | */ |
| 138 | static inline unsigned int kfifo_len(struct kfifo *fifo) | 417 | static inline __must_check unsigned int kfifo_out_rec(struct kfifo *fifo, |
| 418 | void *to, unsigned int n, unsigned int recsize, | ||
| 419 | unsigned int *total) | ||
| 420 | |||
| 139 | { | 421 | { |
| 140 | unsigned long flags; | 422 | if (!__builtin_constant_p(recsize)) |
| 141 | unsigned int ret; | 423 | return __kfifo_out_generic(fifo, to, n, recsize, total); |
| 424 | return __kfifo_out_rec(fifo, to, n, recsize, total); | ||
| 425 | } | ||
| 426 | |||
| 427 | /* | ||
| 428 | * __kfifo_from_user_... internal functions for transfer from user space into | ||
| 429 | * the fifo. do not call it directly, use kfifo_from_user_rec() instead | ||
| 430 | */ | ||
| 431 | extern unsigned int __kfifo_from_user_n(struct kfifo *fifo, | ||
| 432 | const void __user *from, unsigned int n, unsigned int recsize); | ||
| 142 | 433 | ||
| 143 | spin_lock_irqsave(fifo->lock, flags); | 434 | extern unsigned int __kfifo_from_user_generic(struct kfifo *fifo, |
| 435 | const void __user *from, unsigned int n, unsigned int recsize); | ||
| 144 | 436 | ||
| 145 | ret = __kfifo_len(fifo); | 437 | static inline unsigned int __kfifo_from_user_rec(struct kfifo *fifo, |
| 438 | const void __user *from, unsigned int n, unsigned int recsize) | ||
| 439 | { | ||
| 440 | unsigned int ret; | ||
| 146 | 441 | ||
| 147 | spin_unlock_irqrestore(fifo->lock, flags); | 442 | ret = __kfifo_from_user_n(fifo, from, n, recsize); |
| 148 | 443 | ||
| 444 | if (likely(ret == 0)) { | ||
| 445 | if (recsize) | ||
| 446 | __kfifo_poke_n(fifo, recsize, n); | ||
| 447 | __kfifo_add_in(fifo, n + recsize); | ||
| 448 | } | ||
| 149 | return ret; | 449 | return ret; |
| 150 | } | 450 | } |
| 151 | 451 | ||
| 452 | /** | ||
| 453 | * kfifo_from_user_rec - puts some data from user space into the FIFO | ||
| 454 | * @fifo: the fifo to be used. | ||
| 455 | * @from: pointer to the data to be added. | ||
| 456 | * @n: the length of the data to be added. | ||
| 457 | * @recsize: size of record field | ||
| 458 | * | ||
| 459 | * This function copies @n bytes from the @from into the | ||
| 460 | * FIFO and returns the number of bytes which cannot be copied. | ||
| 461 | * | ||
| 462 | * If the returned value is equal or less the @n value, the copy_from_user() | ||
| 463 | * functions has failed. Otherwise the record doesn't fit into the buffer. | ||
| 464 | * | ||
| 465 | * Note that with only one concurrent reader and one concurrent | ||
| 466 | * writer, you don't need extra locking to use these functions. | ||
| 467 | */ | ||
| 468 | static inline __must_check unsigned int kfifo_from_user_rec(struct kfifo *fifo, | ||
| 469 | const void __user *from, unsigned int n, unsigned int recsize) | ||
| 470 | { | ||
| 471 | if (!__builtin_constant_p(recsize)) | ||
| 472 | return __kfifo_from_user_generic(fifo, from, n, recsize); | ||
| 473 | return __kfifo_from_user_rec(fifo, from, n, recsize); | ||
| 474 | } | ||
| 475 | |||
| 476 | /* | ||
| 477 | * __kfifo_to_user_... internal functions for transfer fifo data into user space | ||
| 478 | * do not call it directly, use kfifo_to_user_rec() instead | ||
| 479 | */ | ||
| 480 | extern unsigned int __kfifo_to_user_n(struct kfifo *fifo, | ||
| 481 | void __user *to, unsigned int n, unsigned int reclen, | ||
| 482 | unsigned int recsize); | ||
| 483 | |||
| 484 | extern unsigned int __kfifo_to_user_generic(struct kfifo *fifo, | ||
| 485 | void __user *to, unsigned int n, unsigned int recsize, | ||
| 486 | unsigned int *total); | ||
| 487 | |||
| 488 | static inline unsigned int __kfifo_to_user_rec(struct kfifo *fifo, | ||
| 489 | void __user *to, unsigned int n, | ||
| 490 | unsigned int recsize, unsigned int *total) | ||
| 491 | { | ||
| 492 | unsigned int l; | ||
| 493 | |||
| 494 | if (!recsize) { | ||
| 495 | l = n; | ||
| 496 | if (total) | ||
| 497 | *total = l; | ||
| 498 | } else { | ||
| 499 | l = __kfifo_peek_n(fifo, recsize); | ||
| 500 | if (total) | ||
| 501 | *total = l; | ||
| 502 | if (n < l) | ||
| 503 | return l; | ||
| 504 | } | ||
| 505 | |||
| 506 | return __kfifo_to_user_n(fifo, to, n, l, recsize); | ||
| 507 | } | ||
| 508 | |||
| 509 | /** | ||
| 510 | * kfifo_to_user_rec - gets data from the FIFO and write it to user space | ||
| 511 | * @fifo: the fifo to be used. | ||
| 512 | * @to: where the data must be copied. | ||
| 513 | * @n: the size of the destination buffer. | ||
| 514 | * @recsize: size of record field | ||
| 515 | * @total: pointer where the total number of to copied bytes should stored | ||
| 516 | * | ||
| 517 | * This function copies at most @n bytes from the FIFO to the @to. | ||
| 518 | * In case of an error, the function returns the number of bytes which cannot | ||
| 519 | * be copied. | ||
| 520 | * If the returned value is equal or less the @n value, the copy_to_user() | ||
| 521 | * functions has failed. Otherwise the record doesn't fit into the @to buffer. | ||
| 522 | * | ||
| 523 | * Note that with only one concurrent reader and one concurrent | ||
| 524 | * writer, you don't need extra locking to use these functions. | ||
| 525 | */ | ||
| 526 | static inline __must_check unsigned int kfifo_to_user_rec(struct kfifo *fifo, | ||
| 527 | void __user *to, unsigned int n, unsigned int recsize, | ||
| 528 | unsigned int *total) | ||
| 529 | { | ||
| 530 | if (!__builtin_constant_p(recsize)) | ||
| 531 | return __kfifo_to_user_generic(fifo, to, n, recsize, total); | ||
| 532 | return __kfifo_to_user_rec(fifo, to, n, recsize, total); | ||
| 533 | } | ||
| 534 | |||
| 535 | /* | ||
| 536 | * __kfifo_peek_... internal functions for peek into the next fifo record | ||
| 537 | * do not call it directly, use kfifo_peek_rec() instead | ||
| 538 | */ | ||
| 539 | extern unsigned int __kfifo_peek_generic(struct kfifo *fifo, | ||
| 540 | unsigned int recsize); | ||
| 541 | |||
| 542 | /** | ||
| 543 | * kfifo_peek_rec - gets the size of the next FIFO record data | ||
| 544 | * @fifo: the fifo to be used. | ||
| 545 | * @recsize: size of record field | ||
| 546 | * | ||
| 547 | * This function returns the size of the next FIFO record in number of bytes | ||
| 548 | */ | ||
| 549 | static inline __must_check unsigned int kfifo_peek_rec(struct kfifo *fifo, | ||
| 550 | unsigned int recsize) | ||
| 551 | { | ||
| 552 | if (!__builtin_constant_p(recsize)) | ||
| 553 | return __kfifo_peek_generic(fifo, recsize); | ||
| 554 | if (!recsize) | ||
| 555 | return kfifo_len(fifo); | ||
| 556 | return __kfifo_peek_n(fifo, recsize); | ||
| 557 | } | ||
| 558 | |||
| 559 | /* | ||
| 560 | * __kfifo_skip_... internal functions for skip the next fifo record | ||
| 561 | * do not call it directly, use kfifo_skip_rec() instead | ||
| 562 | */ | ||
| 563 | extern void __kfifo_skip_generic(struct kfifo *fifo, unsigned int recsize); | ||
| 564 | |||
| 565 | static inline void __kfifo_skip_rec(struct kfifo *fifo, | ||
| 566 | unsigned int recsize) | ||
| 567 | { | ||
| 568 | unsigned int l; | ||
| 569 | |||
| 570 | if (recsize) { | ||
| 571 | l = __kfifo_peek_n(fifo, recsize); | ||
| 572 | |||
| 573 | if (l + recsize <= kfifo_len(fifo)) { | ||
| 574 | __kfifo_add_out(fifo, l + recsize); | ||
| 575 | return; | ||
| 576 | } | ||
| 577 | } | ||
| 578 | kfifo_reset_out(fifo); | ||
| 579 | } | ||
| 580 | |||
| 581 | /** | ||
| 582 | * kfifo_skip_rec - skip the next fifo out record | ||
| 583 | * @fifo: the fifo to be used. | ||
| 584 | * @recsize: size of record field | ||
| 585 | * | ||
| 586 | * This function skips the next FIFO record | ||
| 587 | */ | ||
| 588 | static inline void kfifo_skip_rec(struct kfifo *fifo, | ||
| 589 | unsigned int recsize) | ||
| 590 | { | ||
| 591 | if (!__builtin_constant_p(recsize)) | ||
| 592 | __kfifo_skip_generic(fifo, recsize); | ||
| 593 | else | ||
| 594 | __kfifo_skip_rec(fifo, recsize); | ||
| 595 | } | ||
| 596 | |||
| 597 | /** | ||
| 598 | * kfifo_avail_rec - returns the number of bytes available in a record FIFO | ||
| 599 | * @fifo: the fifo to be used. | ||
| 600 | * @recsize: size of record field | ||
| 601 | */ | ||
| 602 | static inline __must_check unsigned int kfifo_avail_rec(struct kfifo *fifo, | ||
| 603 | unsigned int recsize) | ||
| 604 | { | ||
| 605 | unsigned int l = kfifo_size(fifo) - kfifo_len(fifo); | ||
| 606 | |||
| 607 | return (l > recsize) ? l - recsize : 0; | ||
| 608 | } | ||
| 609 | |||
| 152 | #endif | 610 | #endif |
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h index 6adcc297e354..19ec41a183f5 100644 --- a/include/linux/kgdb.h +++ b/include/linux/kgdb.h | |||
| @@ -29,8 +29,7 @@ struct pt_regs; | |||
| 29 | * | 29 | * |
| 30 | * On some architectures it is required to skip a breakpoint | 30 | * On some architectures it is required to skip a breakpoint |
| 31 | * exception when it occurs after a breakpoint has been removed. | 31 | * exception when it occurs after a breakpoint has been removed. |
| 32 | * This can be implemented in the architecture specific portion of | 32 | * This can be implemented in the architecture specific portion of kgdb. |
| 33 | * for kgdb. | ||
| 34 | */ | 33 | */ |
| 35 | extern int kgdb_skipexception(int exception, struct pt_regs *regs); | 34 | extern int kgdb_skipexception(int exception, struct pt_regs *regs); |
| 36 | 35 | ||
| @@ -65,7 +64,7 @@ struct uart_port; | |||
| 65 | /** | 64 | /** |
| 66 | * kgdb_breakpoint - compiled in breakpoint | 65 | * kgdb_breakpoint - compiled in breakpoint |
| 67 | * | 66 | * |
| 68 | * This will be impelmented a static inline per architecture. This | 67 | * This will be implemented as a static inline per architecture. This |
| 69 | * function is called by the kgdb core to execute an architecture | 68 | * function is called by the kgdb core to execute an architecture |
| 70 | * specific trap to cause kgdb to enter the exception processing. | 69 | * specific trap to cause kgdb to enter the exception processing. |
| 71 | * | 70 | * |
| @@ -190,7 +189,7 @@ kgdb_arch_handle_exception(int vector, int signo, int err_code, | |||
| 190 | * @flags: Current IRQ state | 189 | * @flags: Current IRQ state |
| 191 | * | 190 | * |
| 192 | * On SMP systems, we need to get the attention of the other CPUs | 191 | * On SMP systems, we need to get the attention of the other CPUs |
| 193 | * and get them be in a known state. This should do what is needed | 192 | * and get them into a known state. This should do what is needed |
| 194 | * to get the other CPUs to call kgdb_wait(). Note that on some arches, | 193 | * to get the other CPUs to call kgdb_wait(). Note that on some arches, |
| 195 | * the NMI approach is not used for rounding up all the CPUs. For example, | 194 | * the NMI approach is not used for rounding up all the CPUs. For example, |
| 196 | * in case of MIPS, smp_call_function() is used to roundup CPUs. In | 195 | * in case of MIPS, smp_call_function() is used to roundup CPUs. In |
diff --git a/include/linux/kmemcheck.h b/include/linux/kmemcheck.h index e880d4cf9e22..08d7dc4ddf40 100644 --- a/include/linux/kmemcheck.h +++ b/include/linux/kmemcheck.h | |||
| @@ -36,6 +36,56 @@ int kmemcheck_hide_addr(unsigned long address); | |||
| 36 | 36 | ||
| 37 | bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size); | 37 | bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size); |
| 38 | 38 | ||
| 39 | /* | ||
| 40 | * Bitfield annotations | ||
| 41 | * | ||
| 42 | * How to use: If you have a struct using bitfields, for example | ||
| 43 | * | ||
| 44 | * struct a { | ||
| 45 | * int x:8, y:8; | ||
| 46 | * }; | ||
| 47 | * | ||
| 48 | * then this should be rewritten as | ||
| 49 | * | ||
| 50 | * struct a { | ||
| 51 | * kmemcheck_bitfield_begin(flags); | ||
| 52 | * int x:8, y:8; | ||
| 53 | * kmemcheck_bitfield_end(flags); | ||
| 54 | * }; | ||
| 55 | * | ||
| 56 | * Now the "flags_begin" and "flags_end" members may be used to refer to the | ||
| 57 | * beginning and end, respectively, of the bitfield (and things like | ||
| 58 | * &x.flags_begin is allowed). As soon as the struct is allocated, the bit- | ||
| 59 | * fields should be annotated: | ||
| 60 | * | ||
| 61 | * struct a *a = kmalloc(sizeof(struct a), GFP_KERNEL); | ||
| 62 | * kmemcheck_annotate_bitfield(a, flags); | ||
| 63 | */ | ||
| 64 | #define kmemcheck_bitfield_begin(name) \ | ||
| 65 | int name##_begin[0]; | ||
| 66 | |||
| 67 | #define kmemcheck_bitfield_end(name) \ | ||
| 68 | int name##_end[0]; | ||
| 69 | |||
| 70 | #define kmemcheck_annotate_bitfield(ptr, name) \ | ||
| 71 | do { \ | ||
| 72 | int _n; \ | ||
| 73 | \ | ||
| 74 | if (!ptr) \ | ||
| 75 | break; \ | ||
| 76 | \ | ||
| 77 | _n = (long) &((ptr)->name##_end) \ | ||
| 78 | - (long) &((ptr)->name##_begin); \ | ||
| 79 | MAYBE_BUILD_BUG_ON(_n < 0); \ | ||
| 80 | \ | ||
| 81 | kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \ | ||
| 82 | } while (0) | ||
| 83 | |||
| 84 | #define kmemcheck_annotate_variable(var) \ | ||
| 85 | do { \ | ||
| 86 | kmemcheck_mark_initialized(&(var), sizeof(var)); \ | ||
| 87 | } while (0) \ | ||
| 88 | |||
| 39 | #else | 89 | #else |
| 40 | #define kmemcheck_enabled 0 | 90 | #define kmemcheck_enabled 0 |
| 41 | 91 | ||
| @@ -106,60 +156,16 @@ static inline bool kmemcheck_is_obj_initialized(unsigned long addr, size_t size) | |||
| 106 | return true; | 156 | return true; |
| 107 | } | 157 | } |
| 108 | 158 | ||
| 109 | #endif /* CONFIG_KMEMCHECK */ | 159 | #define kmemcheck_bitfield_begin(name) |
| 110 | 160 | #define kmemcheck_bitfield_end(name) | |
| 111 | /* | 161 | #define kmemcheck_annotate_bitfield(ptr, name) \ |
| 112 | * Bitfield annotations | 162 | do { \ |
| 113 | * | 163 | } while (0) |
| 114 | * How to use: If you have a struct using bitfields, for example | ||
| 115 | * | ||
| 116 | * struct a { | ||
| 117 | * int x:8, y:8; | ||
| 118 | * }; | ||
| 119 | * | ||
| 120 | * then this should be rewritten as | ||
| 121 | * | ||
| 122 | * struct a { | ||
| 123 | * kmemcheck_bitfield_begin(flags); | ||
| 124 | * int x:8, y:8; | ||
| 125 | * kmemcheck_bitfield_end(flags); | ||
| 126 | * }; | ||
| 127 | * | ||
| 128 | * Now the "flags_begin" and "flags_end" members may be used to refer to the | ||
| 129 | * beginning and end, respectively, of the bitfield (and things like | ||
| 130 | * &x.flags_begin is allowed). As soon as the struct is allocated, the bit- | ||
| 131 | * fields should be annotated: | ||
| 132 | * | ||
| 133 | * struct a *a = kmalloc(sizeof(struct a), GFP_KERNEL); | ||
| 134 | * kmemcheck_annotate_bitfield(a, flags); | ||
| 135 | * | ||
| 136 | * Note: We provide the same definitions for both kmemcheck and non- | ||
| 137 | * kmemcheck kernels. This makes it harder to introduce accidental errors. It | ||
| 138 | * is also allowed to pass NULL pointers to kmemcheck_annotate_bitfield(). | ||
| 139 | */ | ||
| 140 | #define kmemcheck_bitfield_begin(name) \ | ||
| 141 | int name##_begin[0]; | ||
| 142 | |||
| 143 | #define kmemcheck_bitfield_end(name) \ | ||
| 144 | int name##_end[0]; | ||
| 145 | 164 | ||
| 146 | #define kmemcheck_annotate_bitfield(ptr, name) \ | 165 | #define kmemcheck_annotate_variable(var) \ |
| 147 | do { \ | 166 | do { \ |
| 148 | int _n; \ | ||
| 149 | \ | ||
| 150 | if (!ptr) \ | ||
| 151 | break; \ | ||
| 152 | \ | ||
| 153 | _n = (long) &((ptr)->name##_end) \ | ||
| 154 | - (long) &((ptr)->name##_begin); \ | ||
| 155 | MAYBE_BUILD_BUG_ON(_n < 0); \ | ||
| 156 | \ | ||
| 157 | kmemcheck_mark_initialized(&((ptr)->name##_begin), _n); \ | ||
| 158 | } while (0) | 167 | } while (0) |
| 159 | 168 | ||
| 160 | #define kmemcheck_annotate_variable(var) \ | 169 | #endif /* CONFIG_KMEMCHECK */ |
| 161 | do { \ | ||
| 162 | kmemcheck_mark_initialized(&(var), sizeof(var)); \ | ||
| 163 | } while (0) \ | ||
| 164 | 170 | ||
| 165 | #endif /* LINUX_KMEMCHECK_H */ | 171 | #endif /* LINUX_KMEMCHECK_H */ |
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/libata.h b/include/linux/libata.h index 6a9c4ddd3d95..73112250862c 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
| @@ -354,6 +354,9 @@ enum { | |||
| 354 | /* max tries if error condition is still set after ->error_handler */ | 354 | /* max tries if error condition is still set after ->error_handler */ |
| 355 | ATA_EH_MAX_TRIES = 5, | 355 | ATA_EH_MAX_TRIES = 5, |
| 356 | 356 | ||
| 357 | /* sometimes resuming a link requires several retries */ | ||
| 358 | ATA_LINK_RESUME_TRIES = 5, | ||
| 359 | |||
| 357 | /* how hard are we gonna try to probe/recover devices */ | 360 | /* how hard are we gonna try to probe/recover devices */ |
| 358 | ATA_PROBE_MAX_TRIES = 3, | 361 | ATA_PROBE_MAX_TRIES = 3, |
| 359 | ATA_EH_DEV_TRIES = 3, | 362 | ATA_EH_DEV_TRIES = 3, |
diff --git a/include/linux/list_sort.h b/include/linux/list_sort.h new file mode 100644 index 000000000000..1a2df2efb771 --- /dev/null +++ b/include/linux/list_sort.h | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | #ifndef _LINUX_LIST_SORT_H | ||
| 2 | #define _LINUX_LIST_SORT_H | ||
| 3 | |||
| 4 | #include <linux/types.h> | ||
| 5 | |||
| 6 | struct list_head; | ||
| 7 | |||
| 8 | void list_sort(void *priv, struct list_head *head, | ||
| 9 | int (*cmp)(void *priv, struct list_head *a, | ||
| 10 | struct list_head *b)); | ||
| 11 | #endif | ||
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/mfd/wm831x/pdata.h b/include/linux/mfd/wm831x/pdata.h index 415c228743d5..fd322aca33ba 100644 --- a/include/linux/mfd/wm831x/pdata.h +++ b/include/linux/mfd/wm831x/pdata.h | |||
| @@ -41,6 +41,23 @@ struct wm831x_battery_pdata { | |||
| 41 | int timeout; /** Charge cycle timeout, in minutes */ | 41 | int timeout; /** Charge cycle timeout, in minutes */ |
| 42 | }; | 42 | }; |
| 43 | 43 | ||
| 44 | /** | ||
| 45 | * Configuration for the WM831x DC-DC BuckWise convertors. This | ||
| 46 | * should be passed as driver_data in the regulator_init_data. | ||
| 47 | * | ||
| 48 | * Currently all the configuration is for the fast DVS switching | ||
| 49 | * support of the devices. This allows MFPs on the device to be | ||
| 50 | * configured as an input to switch between two output voltages, | ||
| 51 | * allowing voltage transitions without the expense of an access over | ||
| 52 | * I2C or SPI buses. | ||
| 53 | */ | ||
| 54 | struct wm831x_buckv_pdata { | ||
| 55 | int dvs_gpio; /** CPU GPIO to use for DVS switching */ | ||
| 56 | int dvs_control_src; /** Hardware DVS source to use (1 or 2) */ | ||
| 57 | int dvs_init_state; /** DVS state to expect on startup */ | ||
| 58 | int dvs_state_gpio; /** CPU GPIO to use for monitoring status */ | ||
| 59 | }; | ||
| 60 | |||
| 44 | /* Sources for status LED configuration. Values are register values | 61 | /* Sources for status LED configuration. Values are register values |
| 45 | * plus 1 to allow for a zero default for preserve. | 62 | * plus 1 to allow for a zero default for preserve. |
| 46 | */ | 63 | */ |
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/mm_types.h b/include/linux/mm_types.h index 84a524afb3dc..84d020bed083 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h | |||
| @@ -123,6 +123,8 @@ struct vm_region { | |||
| 123 | struct file *vm_file; /* the backing file or NULL */ | 123 | struct file *vm_file; /* the backing file or NULL */ |
| 124 | 124 | ||
| 125 | atomic_t vm_usage; /* region usage count */ | 125 | atomic_t vm_usage; /* region usage count */ |
| 126 | bool vm_icache_flushed : 1; /* true if the icache has been flushed for | ||
| 127 | * this region */ | ||
| 126 | }; | 128 | }; |
| 127 | 129 | ||
| 128 | /* | 130 | /* |
diff --git a/include/linux/mmdebug.h b/include/linux/mmdebug.h index 8a5509877192..ee24ef8ab616 100644 --- a/include/linux/mmdebug.h +++ b/include/linux/mmdebug.h | |||
| @@ -1,8 +1,6 @@ | |||
| 1 | #ifndef LINUX_MM_DEBUG_H | 1 | #ifndef LINUX_MM_DEBUG_H |
| 2 | #define LINUX_MM_DEBUG_H 1 | 2 | #define LINUX_MM_DEBUG_H 1 |
| 3 | 3 | ||
| 4 | #include <linux/autoconf.h> | ||
| 5 | |||
| 6 | #ifdef CONFIG_DEBUG_VM | 4 | #ifdef CONFIG_DEBUG_VM |
| 7 | #define VM_BUG_ON(cond) BUG_ON(cond) | 5 | #define VM_BUG_ON(cond) BUG_ON(cond) |
| 8 | #else | 6 | #else |
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 6f7561730d88..30fe668c2542 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | #include <linux/seqlock.h> | 15 | #include <linux/seqlock.h> |
| 16 | #include <linux/nodemask.h> | 16 | #include <linux/nodemask.h> |
| 17 | #include <linux/pageblock-flags.h> | 17 | #include <linux/pageblock-flags.h> |
| 18 | #include <linux/bounds.h> | 18 | #include <generated/bounds.h> |
| 19 | #include <asm/atomic.h> | 19 | #include <asm/atomic.h> |
| 20 | #include <asm/page.h> | 20 | #include <asm/page.h> |
| 21 | 21 | ||
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/page-flags.h b/include/linux/page-flags.h index feee2ba8d06a..5b59f35dcb8f 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #include <linux/types.h> | 8 | #include <linux/types.h> |
| 9 | #ifndef __GENERATING_BOUNDS_H | 9 | #ifndef __GENERATING_BOUNDS_H |
| 10 | #include <linux/mm_types.h> | 10 | #include <linux/mm_types.h> |
| 11 | #include <linux/bounds.h> | 11 | #include <generated/bounds.h> |
| 12 | #endif /* !__GENERATING_BOUNDS_H */ | 12 | #endif /* !__GENERATING_BOUNDS_H */ |
| 13 | 13 | ||
| 14 | /* | 14 | /* |
diff --git a/include/linux/pci.h b/include/linux/pci.h index bf1e67080849..174e5392e51e 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
| @@ -243,6 +243,7 @@ struct pci_dev { | |||
| 243 | unsigned int d2_support:1; /* Low power state D2 is supported */ | 243 | unsigned int d2_support:1; /* Low power state D2 is supported */ |
| 244 | unsigned int no_d1d2:1; /* Only allow D0 and D3 */ | 244 | unsigned int no_d1d2:1; /* Only allow D0 and D3 */ |
| 245 | unsigned int wakeup_prepared:1; | 245 | unsigned int wakeup_prepared:1; |
| 246 | unsigned int d3_delay; /* D3->D0 transition time in ms */ | ||
| 246 | 247 | ||
| 247 | #ifdef CONFIG_PCIEASPM | 248 | #ifdef CONFIG_PCIEASPM |
| 248 | struct pcie_link_state *link_state; /* ASPM link state. */ | 249 | struct pcie_link_state *link_state; /* ASPM link state. */ |
| @@ -566,6 +567,9 @@ void pcibios_align_resource(void *, struct resource *, resource_size_t, | |||
| 566 | resource_size_t); | 567 | resource_size_t); |
| 567 | void pcibios_update_irq(struct pci_dev *, int irq); | 568 | void pcibios_update_irq(struct pci_dev *, int irq); |
| 568 | 569 | ||
| 570 | /* Weak but can be overriden by arch */ | ||
| 571 | void pci_fixup_cardbus(struct pci_bus *); | ||
| 572 | |||
| 569 | /* Generic PCI functions used internally */ | 573 | /* Generic PCI functions used internally */ |
| 570 | 574 | ||
| 571 | extern struct pci_bus *pci_find_bus(int domain, int busnr); | 575 | extern struct pci_bus *pci_find_bus(int domain, int busnr); |
diff --git a/include/linux/phy.h b/include/linux/phy.h index b1368b8f6572..7968defd2fa7 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h | |||
| @@ -447,6 +447,7 @@ struct phy_device* get_phy_device(struct mii_bus *bus, int addr); | |||
| 447 | int phy_device_register(struct phy_device *phy); | 447 | int phy_device_register(struct phy_device *phy); |
| 448 | int phy_clear_interrupt(struct phy_device *phydev); | 448 | int phy_clear_interrupt(struct phy_device *phydev); |
| 449 | int phy_config_interrupt(struct phy_device *phydev, u32 interrupts); | 449 | int phy_config_interrupt(struct phy_device *phydev, u32 interrupts); |
| 450 | int phy_init_hw(struct phy_device *phydev); | ||
| 450 | int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, | 451 | int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, |
| 451 | u32 flags, phy_interface_t interface); | 452 | u32 flags, phy_interface_t interface); |
| 452 | struct phy_device * phy_attach(struct net_device *dev, | 453 | struct phy_device * phy_attach(struct net_device *dev, |
diff --git a/include/linux/poison.h b/include/linux/poison.h index 7fc194aef8c2..2110a81c5e2a 100644 --- a/include/linux/poison.h +++ b/include/linux/poison.h | |||
| @@ -2,13 +2,25 @@ | |||
| 2 | #define _LINUX_POISON_H | 2 | #define _LINUX_POISON_H |
| 3 | 3 | ||
| 4 | /********** include/linux/list.h **********/ | 4 | /********** include/linux/list.h **********/ |
| 5 | |||
| 6 | /* | ||
| 7 | * Architectures might want to move the poison pointer offset | ||
| 8 | * into some well-recognized area such as 0xdead000000000000, | ||
| 9 | * that is also not mappable by user-space exploits: | ||
| 10 | */ | ||
| 11 | #ifdef CONFIG_ILLEGAL_POINTER_VALUE | ||
| 12 | # define POISON_POINTER_DELTA _AC(CONFIG_ILLEGAL_POINTER_VALUE, UL) | ||
| 13 | #else | ||
| 14 | # define POISON_POINTER_DELTA 0 | ||
| 15 | #endif | ||
| 16 | |||
| 5 | /* | 17 | /* |
| 6 | * These are non-NULL pointers that will result in page faults | 18 | * These are non-NULL pointers that will result in page faults |
| 7 | * under normal circumstances, used to verify that nobody uses | 19 | * under normal circumstances, used to verify that nobody uses |
| 8 | * non-initialized list entries. | 20 | * non-initialized list entries. |
| 9 | */ | 21 | */ |
| 10 | #define LIST_POISON1 ((void *) 0x00100100) | 22 | #define LIST_POISON1 ((void *) 0x00100100 + POISON_POINTER_DELTA) |
| 11 | #define LIST_POISON2 ((void *) 0x00200200) | 23 | #define LIST_POISON2 ((void *) 0x00200200 + POISON_POINTER_DELTA) |
| 12 | 24 | ||
| 13 | /********** include/linux/timer.h **********/ | 25 | /********** include/linux/timer.h **********/ |
| 14 | /* | 26 | /* |
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/quota.h b/include/linux/quota.h index e70e62194243..a6861f117480 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h | |||
| @@ -315,8 +315,9 @@ struct dquot_operations { | |||
| 315 | int (*claim_space) (struct inode *, qsize_t); | 315 | int (*claim_space) (struct inode *, qsize_t); |
| 316 | /* release rsved quota for delayed alloc */ | 316 | /* release rsved quota for delayed alloc */ |
| 317 | void (*release_rsv) (struct inode *, qsize_t); | 317 | void (*release_rsv) (struct inode *, qsize_t); |
| 318 | /* get reserved quota for delayed alloc */ | 318 | /* get reserved quota for delayed alloc, value returned is managed by |
| 319 | qsize_t (*get_reserved_space) (struct inode *); | 319 | * quota code only */ |
| 320 | qsize_t *(*get_reserved_space) (struct inode *); | ||
| 320 | }; | 321 | }; |
| 321 | 322 | ||
| 322 | /* Operations handling requests from userspace */ | 323 | /* Operations handling requests from userspace */ |
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/regulator/consumer.h b/include/linux/regulator/consumer.h index 490c5b37b6d7..030d92255c7a 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h | |||
| @@ -35,6 +35,8 @@ | |||
| 35 | #ifndef __LINUX_REGULATOR_CONSUMER_H_ | 35 | #ifndef __LINUX_REGULATOR_CONSUMER_H_ |
| 36 | #define __LINUX_REGULATOR_CONSUMER_H_ | 36 | #define __LINUX_REGULATOR_CONSUMER_H_ |
| 37 | 37 | ||
| 38 | #include <linux/device.h> | ||
| 39 | |||
| 38 | /* | 40 | /* |
| 39 | * Regulator operating modes. | 41 | * Regulator operating modes. |
| 40 | * | 42 | * |
diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h index 87f5f176d4ef..234a8476cba8 100644 --- a/include/linux/regulator/machine.h +++ b/include/linux/regulator/machine.h | |||
| @@ -43,16 +43,20 @@ struct regulator; | |||
| 43 | /** | 43 | /** |
| 44 | * struct regulator_state - regulator state during low power system states | 44 | * struct regulator_state - regulator state during low power system states |
| 45 | * | 45 | * |
| 46 | * This describes a regulators state during a system wide low power state. | 46 | * This describes a regulators state during a system wide low power |
| 47 | * state. One of enabled or disabled must be set for the | ||
| 48 | * configuration to be applied. | ||
| 47 | * | 49 | * |
| 48 | * @uV: Operating voltage during suspend. | 50 | * @uV: Operating voltage during suspend. |
| 49 | * @mode: Operating mode during suspend. | 51 | * @mode: Operating mode during suspend. |
| 50 | * @enabled: Enabled during suspend. | 52 | * @enabled: Enabled during suspend. |
| 53 | * @disabled: Disabled during suspend. | ||
| 51 | */ | 54 | */ |
| 52 | struct regulator_state { | 55 | struct regulator_state { |
| 53 | int uV; /* suspend voltage */ | 56 | int uV; /* suspend voltage */ |
| 54 | unsigned int mode; /* suspend regulator operating mode */ | 57 | unsigned int mode; /* suspend regulator operating mode */ |
| 55 | int enabled; /* is regulator enabled in this suspend state */ | 58 | int enabled; /* is regulator enabled in this suspend state */ |
| 59 | int disabled; /* is the regulator disbled in this suspend state */ | ||
| 56 | }; | 60 | }; |
| 57 | 61 | ||
| 58 | /** | 62 | /** |
diff --git a/include/linux/regulator/max8660.h b/include/linux/regulator/max8660.h new file mode 100644 index 000000000000..9936763621c7 --- /dev/null +++ b/include/linux/regulator/max8660.h | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | /* | ||
| 2 | * max8660.h -- Voltage regulation for the Maxim 8660/8661 | ||
| 3 | * | ||
| 4 | * Copyright (C) 2009 Wolfram Sang, Pengutronix e.K. | ||
| 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; version 2 of the License. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with this program; if not, write to the Free Software | ||
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 18 | */ | ||
| 19 | |||
| 20 | #ifndef __LINUX_REGULATOR_MAX8660_H | ||
| 21 | #define __LINUX_REGULATOR_MAX8660_H | ||
| 22 | |||
| 23 | #include <linux/regulator/machine.h> | ||
| 24 | |||
| 25 | enum { | ||
| 26 | MAX8660_V3, | ||
| 27 | MAX8660_V4, | ||
| 28 | MAX8660_V5, | ||
| 29 | MAX8660_V6, | ||
| 30 | MAX8660_V7, | ||
| 31 | MAX8660_V_END, | ||
| 32 | }; | ||
| 33 | |||
| 34 | /** | ||
| 35 | * max8660_subdev_data - regulator subdev data | ||
| 36 | * @id: regulator id | ||
| 37 | * @name: regulator name | ||
| 38 | * @platform_data: regulator init data | ||
| 39 | */ | ||
| 40 | struct max8660_subdev_data { | ||
| 41 | int id; | ||
| 42 | char *name; | ||
| 43 | struct regulator_init_data *platform_data; | ||
| 44 | }; | ||
| 45 | |||
| 46 | /** | ||
| 47 | * max8660_platform_data - platform data for max8660 | ||
| 48 | * @num_subdevs: number of regulators used | ||
| 49 | * @subdevs: pointer to regulators used | ||
| 50 | * @en34_is_high: if EN34 is driven high, regulators cannot be en-/disabled. | ||
| 51 | */ | ||
| 52 | struct max8660_platform_data { | ||
| 53 | int num_subdevs; | ||
| 54 | struct max8660_subdev_data *subdevs; | ||
| 55 | unsigned en34_is_high:1; | ||
| 56 | }; | ||
| 57 | #endif | ||
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index c96c1858fe2c..1ba3cf6edfbb 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h | |||
| @@ -62,6 +62,12 @@ void reiserfs_write_unlock(struct super_block *s); | |||
| 62 | int reiserfs_write_lock_once(struct super_block *s); | 62 | int reiserfs_write_lock_once(struct super_block *s); |
| 63 | void reiserfs_write_unlock_once(struct super_block *s, int lock_depth); | 63 | void reiserfs_write_unlock_once(struct super_block *s, int lock_depth); |
| 64 | 64 | ||
| 65 | #ifdef CONFIG_REISERFS_CHECK | ||
| 66 | void reiserfs_lock_check_recursive(struct super_block *s); | ||
| 67 | #else | ||
| 68 | static inline void reiserfs_lock_check_recursive(struct super_block *s) { } | ||
| 69 | #endif | ||
| 70 | |||
| 65 | /* | 71 | /* |
| 66 | * Several mutexes depend on the write lock. | 72 | * Several mutexes depend on the write lock. |
| 67 | * However sometimes we want to relax the write lock while we hold | 73 | * However sometimes we want to relax the write lock while we hold |
| @@ -92,11 +98,31 @@ void reiserfs_write_unlock_once(struct super_block *s, int lock_depth); | |||
| 92 | static inline void reiserfs_mutex_lock_safe(struct mutex *m, | 98 | static inline void reiserfs_mutex_lock_safe(struct mutex *m, |
| 93 | struct super_block *s) | 99 | struct super_block *s) |
| 94 | { | 100 | { |
| 101 | reiserfs_lock_check_recursive(s); | ||
| 95 | reiserfs_write_unlock(s); | 102 | reiserfs_write_unlock(s); |
| 96 | mutex_lock(m); | 103 | mutex_lock(m); |
| 97 | reiserfs_write_lock(s); | 104 | reiserfs_write_lock(s); |
| 98 | } | 105 | } |
| 99 | 106 | ||
| 107 | static inline void | ||
| 108 | reiserfs_mutex_lock_nested_safe(struct mutex *m, unsigned int subclass, | ||
| 109 | struct super_block *s) | ||
| 110 | { | ||
| 111 | reiserfs_lock_check_recursive(s); | ||
| 112 | reiserfs_write_unlock(s); | ||
| 113 | mutex_lock_nested(m, subclass); | ||
| 114 | reiserfs_write_lock(s); | ||
| 115 | } | ||
| 116 | |||
| 117 | static inline void | ||
| 118 | reiserfs_down_read_safe(struct rw_semaphore *sem, struct super_block *s) | ||
| 119 | { | ||
| 120 | reiserfs_lock_check_recursive(s); | ||
| 121 | reiserfs_write_unlock(s); | ||
| 122 | down_read(sem); | ||
| 123 | reiserfs_write_lock(s); | ||
| 124 | } | ||
| 125 | |||
| 100 | /* | 126 | /* |
| 101 | * When we schedule, we usually want to also release the write lock, | 127 | * When we schedule, we usually want to also release the write lock, |
| 102 | * according to the previous bkl based locking scheme of reiserfs. | 128 | * according to the previous bkl based locking scheme of reiserfs. |
diff --git a/include/linux/resource.h b/include/linux/resource.h index 40fc7e626082..f1e914eefeab 100644 --- a/include/linux/resource.h +++ b/include/linux/resource.h | |||
| @@ -3,8 +3,6 @@ | |||
| 3 | 3 | ||
| 4 | #include <linux/time.h> | 4 | #include <linux/time.h> |
| 5 | 5 | ||
| 6 | struct task_struct; | ||
| 7 | |||
| 8 | /* | 6 | /* |
| 9 | * Resource control/accounting header file for linux | 7 | * Resource control/accounting header file for linux |
| 10 | */ | 8 | */ |
| @@ -70,6 +68,12 @@ struct rlimit { | |||
| 70 | */ | 68 | */ |
| 71 | #include <asm/resource.h> | 69 | #include <asm/resource.h> |
| 72 | 70 | ||
| 71 | #ifdef __KERNEL__ | ||
| 72 | |||
| 73 | struct task_struct; | ||
| 74 | |||
| 73 | int getrusage(struct task_struct *p, int who, struct rusage __user *ru); | 75 | int getrusage(struct task_struct *p, int who, struct rusage __user *ru); |
| 74 | 76 | ||
| 77 | #endif /* __KERNEL__ */ | ||
| 78 | |||
| 75 | #endif | 79 | #endif |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 244c287a5ac1..8d4991be9d53 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,7 +2601,27 @@ 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" | 2604 | static inline unsigned long task_rlimit(const struct task_struct *tsk, |
| 2605 | unsigned int limit) | ||
| 2606 | { | ||
| 2607 | return ACCESS_ONCE(tsk->signal->rlim[limit].rlim_cur); | ||
| 2608 | } | ||
| 2609 | |||
| 2610 | static inline unsigned long task_rlimit_max(const struct task_struct *tsk, | ||
| 2611 | unsigned int limit) | ||
| 2612 | { | ||
| 2613 | return ACCESS_ONCE(tsk->signal->rlim[limit].rlim_max); | ||
| 2614 | } | ||
| 2615 | |||
| 2616 | static inline unsigned long rlimit(unsigned int limit) | ||
| 2617 | { | ||
| 2618 | return task_rlimit(current, limit); | ||
| 2619 | } | ||
| 2620 | |||
| 2621 | static inline unsigned long rlimit_max(unsigned int limit) | ||
| 2622 | { | ||
| 2623 | return task_rlimit_max(current, limit); | ||
| 2624 | } | ||
| 2600 | 2625 | ||
| 2601 | #endif /* __KERNEL__ */ | 2626 | #endif /* __KERNEL__ */ |
| 2602 | 2627 | ||
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/sonypi.h b/include/linux/sonypi.h index 34c4475ac4a2..4f95c1aac2fd 100644 --- a/include/linux/sonypi.h +++ b/include/linux/sonypi.h | |||
| @@ -111,6 +111,7 @@ | |||
| 111 | #define SONYPI_EVENT_VOLUME_INC_PRESSED 69 | 111 | #define SONYPI_EVENT_VOLUME_INC_PRESSED 69 |
| 112 | #define SONYPI_EVENT_VOLUME_DEC_PRESSED 70 | 112 | #define SONYPI_EVENT_VOLUME_DEC_PRESSED 70 |
| 113 | #define SONYPI_EVENT_BRIGHTNESS_PRESSED 71 | 113 | #define SONYPI_EVENT_BRIGHTNESS_PRESSED 71 |
| 114 | #define SONYPI_EVENT_MEDIA_PRESSED 72 | ||
| 114 | 115 | ||
| 115 | /* get/set brightness */ | 116 | /* get/set brightness */ |
| 116 | #define SONYPI_IOCGBRT _IOR('v', 0, __u8) | 117 | #define SONYPI_IOCGBRT _IOR('v', 0, __u8) |
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/syscalls.h b/include/linux/syscalls.h index b7c7fcf7790b..feee739afe21 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
| @@ -195,7 +195,7 @@ struct perf_event_attr; | |||
| 195 | static const struct syscall_metadata __used \ | 195 | static const struct syscall_metadata __used \ |
| 196 | __attribute__((__aligned__(4))) \ | 196 | __attribute__((__aligned__(4))) \ |
| 197 | __attribute__((section("__syscalls_metadata"))) \ | 197 | __attribute__((section("__syscalls_metadata"))) \ |
| 198 | __syscall_meta_##sname = { \ | 198 | __syscall_meta__##sname = { \ |
| 199 | .name = "sys_"#sname, \ | 199 | .name = "sys_"#sname, \ |
| 200 | .nb_args = 0, \ | 200 | .nb_args = 0, \ |
| 201 | .enter_event = &event_enter__##sname, \ | 201 | .enter_event = &event_enter__##sname, \ |
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 877ba039e6a4..bd27fbc9db62 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
| @@ -482,6 +482,7 @@ enum | |||
| 482 | NET_IPV4_CONF_ARP_ACCEPT=21, | 482 | NET_IPV4_CONF_ARP_ACCEPT=21, |
| 483 | NET_IPV4_CONF_ARP_NOTIFY=22, | 483 | NET_IPV4_CONF_ARP_NOTIFY=22, |
| 484 | NET_IPV4_CONF_ACCEPT_LOCAL=23, | 484 | NET_IPV4_CONF_ACCEPT_LOCAL=23, |
| 485 | NET_IPV4_CONF_SRC_VMARK=24, | ||
| 485 | __NET_IPV4_CONF_MAX | 486 | __NET_IPV4_CONF_MAX |
| 486 | }; | 487 | }; |
| 487 | 488 | ||
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 9d68fed50f11..cfa83083a2d4 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
| @@ -99,8 +99,9 @@ int __must_check sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, | |||
| 99 | void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); | 99 | void sysfs_remove_file(struct kobject *kobj, const struct attribute *attr); |
| 100 | 100 | ||
| 101 | int __must_check sysfs_create_bin_file(struct kobject *kobj, | 101 | int __must_check sysfs_create_bin_file(struct kobject *kobj, |
| 102 | struct bin_attribute *attr); | 102 | const struct bin_attribute *attr); |
| 103 | void sysfs_remove_bin_file(struct kobject *kobj, struct bin_attribute *attr); | 103 | void sysfs_remove_bin_file(struct kobject *kobj, |
| 104 | const struct bin_attribute *attr); | ||
| 104 | 105 | ||
| 105 | int __must_check sysfs_create_link(struct kobject *kobj, struct kobject *target, | 106 | int __must_check sysfs_create_link(struct kobject *kobj, struct kobject *target, |
| 106 | const char *name); | 107 | const char *name); |
| @@ -175,13 +176,13 @@ static inline void sysfs_remove_file(struct kobject *kobj, | |||
| 175 | } | 176 | } |
| 176 | 177 | ||
| 177 | static inline int sysfs_create_bin_file(struct kobject *kobj, | 178 | static inline int sysfs_create_bin_file(struct kobject *kobj, |
| 178 | struct bin_attribute *attr) | 179 | const struct bin_attribute *attr) |
| 179 | { | 180 | { |
| 180 | return 0; | 181 | return 0; |
| 181 | } | 182 | } |
| 182 | 183 | ||
| 183 | static inline void sysfs_remove_bin_file(struct kobject *kobj, | 184 | static inline void sysfs_remove_bin_file(struct kobject *kobj, |
| 184 | struct bin_attribute *attr) | 185 | const struct bin_attribute *attr) |
| 185 | { | 186 | { |
| 186 | } | 187 | } |
| 187 | 188 | ||
diff --git a/include/linux/uaccess.h b/include/linux/uaccess.h index 6b58367d145e..d512d98dfb7d 100644 --- a/include/linux/uaccess.h +++ b/include/linux/uaccess.h | |||
| @@ -94,6 +94,7 @@ static inline unsigned long __copy_from_user_nocache(void *to, | |||
| 94 | * happens, handle that and return -EFAULT. | 94 | * happens, handle that and return -EFAULT. |
| 95 | */ | 95 | */ |
| 96 | extern long probe_kernel_read(void *dst, void *src, size_t size); | 96 | extern long probe_kernel_read(void *dst, void *src, size_t size); |
| 97 | extern long __probe_kernel_read(void *dst, void *src, size_t size); | ||
| 97 | 98 | ||
| 98 | /* | 99 | /* |
| 99 | * probe_kernel_write(): safely attempt to write to a location | 100 | * probe_kernel_write(): safely attempt to write to a location |
| @@ -104,6 +105,7 @@ extern long probe_kernel_read(void *dst, void *src, size_t size); | |||
| 104 | * Safely write to address @dst from the buffer at @src. If a kernel fault | 105 | * Safely write to address @dst from the buffer at @src. If a kernel fault |
| 105 | * happens, handle that and return -EFAULT. | 106 | * happens, handle that and return -EFAULT. |
| 106 | */ | 107 | */ |
| 107 | extern long probe_kernel_write(void *dst, void *src, size_t size); | 108 | extern long notrace probe_kernel_write(void *dst, void *src, size_t size); |
| 109 | extern long notrace __probe_kernel_write(void *dst, void *src, size_t size); | ||
| 108 | 110 | ||
| 109 | #endif /* __LINUX_UACCESS_H__ */ | 111 | #endif /* __LINUX_UACCESS_H__ */ |
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index acf6e457c04b..1819396ed501 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | #include <linux/kref.h> | 16 | #include <linux/kref.h> |
| 17 | #include <linux/mutex.h> | 17 | #include <linux/mutex.h> |
| 18 | #include <linux/sysrq.h> | 18 | #include <linux/sysrq.h> |
| 19 | #include <linux/kfifo.h> | ||
| 19 | 20 | ||
| 20 | #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ | 21 | #define SERIAL_TTY_MAJOR 188 /* Nice legal number now */ |
| 21 | #define SERIAL_TTY_MINORS 254 /* loads of devices :) */ | 22 | #define SERIAL_TTY_MINORS 254 /* loads of devices :) */ |
| @@ -94,7 +95,7 @@ struct usb_serial_port { | |||
| 94 | unsigned char *bulk_out_buffer; | 95 | unsigned char *bulk_out_buffer; |
| 95 | int bulk_out_size; | 96 | int bulk_out_size; |
| 96 | struct urb *write_urb; | 97 | struct urb *write_urb; |
| 97 | struct kfifo *write_fifo; | 98 | struct kfifo write_fifo; |
| 98 | int write_urb_busy; | 99 | int write_urb_busy; |
| 99 | __u8 bulk_out_endpointAddress; | 100 | __u8 bulk_out_endpointAddress; |
| 100 | 101 | ||
diff --git a/include/linux/vermagic.h b/include/linux/vermagic.h index 79b9837d9ca0..cf97b5b9d1fe 100644 --- a/include/linux/vermagic.h +++ b/include/linux/vermagic.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | #include <linux/utsrelease.h> | 1 | #include <generated/utsrelease.h> |
| 2 | #include <linux/module.h> | 2 | #include <linux/module.h> |
| 3 | 3 | ||
| 4 | /* Simply sanity version stamp for modules. */ | 4 | /* Simply sanity version stamp for modules. */ |
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/linux/writeback.h b/include/linux/writeback.h index 705f01fe413a..76e8903cd204 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h | |||
| @@ -70,6 +70,7 @@ struct writeback_control { | |||
| 70 | struct bdi_writeback; | 70 | struct bdi_writeback; |
| 71 | int inode_wait(void *); | 71 | int inode_wait(void *); |
| 72 | void writeback_inodes_sb(struct super_block *); | 72 | void writeback_inodes_sb(struct super_block *); |
| 73 | int writeback_inodes_sb_if_idle(struct super_block *); | ||
| 73 | void sync_inodes_sb(struct super_block *); | 74 | void sync_inodes_sb(struct super_block *); |
| 74 | void writeback_inodes_wbc(struct writeback_control *wbc); | 75 | void writeback_inodes_wbc(struct writeback_control *wbc); |
| 75 | long wb_do_writeback(struct bdi_writeback *wb, int force_wait); | 76 | long wb_do_writeback(struct bdi_writeback *wb, int force_wait); |
| @@ -79,8 +80,7 @@ void wakeup_flusher_threads(long nr_pages); | |||
| 79 | static inline void wait_on_inode(struct inode *inode) | 80 | static inline void wait_on_inode(struct inode *inode) |
| 80 | { | 81 | { |
| 81 | might_sleep(); | 82 | might_sleep(); |
| 82 | wait_on_bit(&inode->i_state, __I_LOCK, inode_wait, | 83 | wait_on_bit(&inode->i_state, __I_NEW, inode_wait, TASK_UNINTERRUPTIBLE); |
| 83 | TASK_UNINTERRUPTIBLE); | ||
| 84 | } | 84 | } |
| 85 | static inline void inode_sync_wait(struct inode *inode) | 85 | static inline void inode_sync_wait(struct inode *inode) |
| 86 | { | 86 | { |
