diff options
Diffstat (limited to 'include/linux')
43 files changed, 478 insertions, 254 deletions
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h index 3b73b9992b26..416bf62d6d46 100644 --- a/include/linux/blktrace_api.h +++ b/include/linux/blktrace_api.h | |||
@@ -150,8 +150,8 @@ struct blk_user_trace_setup { | |||
150 | struct blk_trace { | 150 | struct blk_trace { |
151 | int trace_state; | 151 | int trace_state; |
152 | struct rchan *rchan; | 152 | struct rchan *rchan; |
153 | unsigned long *sequence; | 153 | unsigned long __percpu *sequence; |
154 | unsigned char *msg_data; | 154 | unsigned char __percpu *msg_data; |
155 | u16 act_mask; | 155 | u16 act_mask; |
156 | u64 start_lba; | 156 | u64 start_lba; |
157 | u64 end_lba; | 157 | u64 end_lba; |
diff --git a/include/linux/bootmem.h b/include/linux/bootmem.h index b10ec49ee2dd..266ab9291232 100644 --- a/include/linux/bootmem.h +++ b/include/linux/bootmem.h | |||
@@ -23,6 +23,7 @@ extern unsigned long max_pfn; | |||
23 | extern unsigned long saved_max_pfn; | 23 | extern unsigned long saved_max_pfn; |
24 | #endif | 24 | #endif |
25 | 25 | ||
26 | #ifndef CONFIG_NO_BOOTMEM | ||
26 | /* | 27 | /* |
27 | * node_bootmem_map is a map pointer - the bits represent all physical | 28 | * node_bootmem_map is a map pointer - the bits represent all physical |
28 | * memory pages (including holes) on the node. | 29 | * memory pages (including holes) on the node. |
@@ -37,6 +38,7 @@ typedef struct bootmem_data { | |||
37 | } bootmem_data_t; | 38 | } bootmem_data_t; |
38 | 39 | ||
39 | extern bootmem_data_t bootmem_node_data[]; | 40 | extern bootmem_data_t bootmem_node_data[]; |
41 | #endif | ||
40 | 42 | ||
41 | extern unsigned long bootmem_bootmap_pages(unsigned long); | 43 | extern unsigned long bootmem_bootmap_pages(unsigned long); |
42 | 44 | ||
@@ -46,6 +48,7 @@ extern unsigned long init_bootmem_node(pg_data_t *pgdat, | |||
46 | unsigned long endpfn); | 48 | unsigned long endpfn); |
47 | extern unsigned long init_bootmem(unsigned long addr, unsigned long memend); | 49 | extern unsigned long init_bootmem(unsigned long addr, unsigned long memend); |
48 | 50 | ||
51 | unsigned long free_all_memory_core_early(int nodeid); | ||
49 | extern unsigned long free_all_bootmem_node(pg_data_t *pgdat); | 52 | extern unsigned long free_all_bootmem_node(pg_data_t *pgdat); |
50 | extern unsigned long free_all_bootmem(void); | 53 | extern unsigned long free_all_bootmem(void); |
51 | 54 | ||
@@ -84,6 +87,10 @@ extern void *__alloc_bootmem_node(pg_data_t *pgdat, | |||
84 | unsigned long size, | 87 | unsigned long size, |
85 | unsigned long align, | 88 | unsigned long align, |
86 | unsigned long goal); | 89 | unsigned long goal); |
90 | void *__alloc_bootmem_node_high(pg_data_t *pgdat, | ||
91 | unsigned long size, | ||
92 | unsigned long align, | ||
93 | unsigned long goal); | ||
87 | extern void *__alloc_bootmem_node_nopanic(pg_data_t *pgdat, | 94 | extern void *__alloc_bootmem_node_nopanic(pg_data_t *pgdat, |
88 | unsigned long size, | 95 | unsigned long size, |
89 | unsigned long align, | 96 | unsigned long align, |
diff --git a/include/linux/compiler.h b/include/linux/compiler.h index 188fcae10a99..a5a472b10746 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h | |||
@@ -5,7 +5,7 @@ | |||
5 | 5 | ||
6 | #ifdef __CHECKER__ | 6 | #ifdef __CHECKER__ |
7 | # define __user __attribute__((noderef, address_space(1))) | 7 | # define __user __attribute__((noderef, address_space(1))) |
8 | # define __kernel /* default address space */ | 8 | # define __kernel __attribute__((address_space(0))) |
9 | # define __safe __attribute__((safe)) | 9 | # define __safe __attribute__((safe)) |
10 | # define __force __attribute__((force)) | 10 | # define __force __attribute__((force)) |
11 | # define __nocast __attribute__((nocast)) | 11 | # define __nocast __attribute__((nocast)) |
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h index 78784982b33e..21fd9b7c6a40 100644 --- a/include/linux/dmaengine.h +++ b/include/linux/dmaengine.h | |||
@@ -162,7 +162,7 @@ struct dma_chan { | |||
162 | struct dma_chan_dev *dev; | 162 | struct dma_chan_dev *dev; |
163 | 163 | ||
164 | struct list_head device_node; | 164 | struct list_head device_node; |
165 | struct dma_chan_percpu *local; | 165 | struct dma_chan_percpu __percpu *local; |
166 | int client_count; | 166 | int client_count; |
167 | int table_count; | 167 | int table_count; |
168 | void *private; | 168 | void *private; |
diff --git a/include/linux/early_res.h b/include/linux/early_res.h new file mode 100644 index 000000000000..29c09f57a13c --- /dev/null +++ b/include/linux/early_res.h | |||
@@ -0,0 +1,23 @@ | |||
1 | #ifndef _LINUX_EARLY_RES_H | ||
2 | #define _LINUX_EARLY_RES_H | ||
3 | #ifdef __KERNEL__ | ||
4 | |||
5 | extern void reserve_early(u64 start, u64 end, char *name); | ||
6 | extern void reserve_early_overlap_ok(u64 start, u64 end, char *name); | ||
7 | extern void free_early(u64 start, u64 end); | ||
8 | void free_early_partial(u64 start, u64 end); | ||
9 | extern void early_res_to_bootmem(u64 start, u64 end); | ||
10 | |||
11 | void reserve_early_without_check(u64 start, u64 end, char *name); | ||
12 | u64 find_early_area(u64 ei_start, u64 ei_last, u64 start, u64 end, | ||
13 | u64 size, u64 align); | ||
14 | u64 find_early_area_size(u64 ei_start, u64 ei_last, u64 start, | ||
15 | u64 *sizep, u64 align); | ||
16 | u64 find_fw_memmap_area(u64 start, u64 end, u64 size, u64 align); | ||
17 | u64 get_max_mapped(void); | ||
18 | #include <linux/range.h> | ||
19 | int get_free_all_memory_range(struct range **rangep, int nodeid); | ||
20 | |||
21 | #endif /* __KERNEL__ */ | ||
22 | |||
23 | #endif /* _LINUX_EARLY_RES_H */ | ||
diff --git a/include/linux/fb.h b/include/linux/fb.h index 369767bd873e..c10163b4c40e 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h | |||
@@ -543,6 +543,8 @@ struct fb_cursor_user { | |||
543 | #define FB_EVENT_GET_REQ 0x0D | 543 | #define FB_EVENT_GET_REQ 0x0D |
544 | /* Unbind from the console if possible */ | 544 | /* Unbind from the console if possible */ |
545 | #define FB_EVENT_FB_UNBIND 0x0E | 545 | #define FB_EVENT_FB_UNBIND 0x0E |
546 | /* CONSOLE-SPECIFIC: remap all consoles to new fb - for vga switcheroo */ | ||
547 | #define FB_EVENT_REMAP_ALL_CONSOLE 0x0F | ||
546 | 548 | ||
547 | struct fb_event { | 549 | struct fb_event { |
548 | struct fb_info *info; | 550 | struct fb_info *info; |
diff --git a/include/linux/firewire-cdev.h b/include/linux/firewire-cdev.h index 520ecf86cbb3..40b11013408e 100644 --- a/include/linux/firewire-cdev.h +++ b/include/linux/firewire-cdev.h | |||
@@ -248,13 +248,20 @@ union fw_cdev_event { | |||
248 | #define FW_CDEV_IOC_SEND_BROADCAST_REQUEST _IOW('#', 0x12, struct fw_cdev_send_request) | 248 | #define FW_CDEV_IOC_SEND_BROADCAST_REQUEST _IOW('#', 0x12, struct fw_cdev_send_request) |
249 | #define FW_CDEV_IOC_SEND_STREAM_PACKET _IOW('#', 0x13, struct fw_cdev_send_stream_packet) | 249 | #define FW_CDEV_IOC_SEND_STREAM_PACKET _IOW('#', 0x13, struct fw_cdev_send_stream_packet) |
250 | 250 | ||
251 | /* available since kernel version 2.6.34 */ | ||
252 | #define FW_CDEV_IOC_GET_CYCLE_TIMER2 _IOWR('#', 0x14, struct fw_cdev_get_cycle_timer2) | ||
253 | |||
251 | /* | 254 | /* |
252 | * FW_CDEV_VERSION History | 255 | * FW_CDEV_VERSION History |
253 | * 1 (2.6.22) - initial version | 256 | * 1 (2.6.22) - initial version |
254 | * 2 (2.6.30) - changed &fw_cdev_event_iso_interrupt.header if | 257 | * 2 (2.6.30) - changed &fw_cdev_event_iso_interrupt.header if |
255 | * &fw_cdev_create_iso_context.header_size is 8 or more | 258 | * &fw_cdev_create_iso_context.header_size is 8 or more |
259 | * (2.6.32) - added time stamp to xmit &fw_cdev_event_iso_interrupt | ||
260 | * (2.6.33) - IR has always packet-per-buffer semantics now, not one of | ||
261 | * dual-buffer or packet-per-buffer depending on hardware | ||
262 | * 3 (2.6.34) - made &fw_cdev_get_cycle_timer reliable | ||
256 | */ | 263 | */ |
257 | #define FW_CDEV_VERSION 2 | 264 | #define FW_CDEV_VERSION 3 |
258 | 265 | ||
259 | /** | 266 | /** |
260 | * struct fw_cdev_get_info - General purpose information ioctl | 267 | * struct fw_cdev_get_info - General purpose information ioctl |
@@ -544,14 +551,18 @@ struct fw_cdev_stop_iso { | |||
544 | /** | 551 | /** |
545 | * struct fw_cdev_get_cycle_timer - read cycle timer register | 552 | * struct fw_cdev_get_cycle_timer - read cycle timer register |
546 | * @local_time: system time, in microseconds since the Epoch | 553 | * @local_time: system time, in microseconds since the Epoch |
547 | * @cycle_timer: isochronous cycle timer, as per OHCI 1.1 clause 5.13 | 554 | * @cycle_timer: Cycle Time register contents |
548 | * | 555 | * |
549 | * The %FW_CDEV_IOC_GET_CYCLE_TIMER ioctl reads the isochronous cycle timer | 556 | * The %FW_CDEV_IOC_GET_CYCLE_TIMER ioctl reads the isochronous cycle timer |
550 | * and also the system clock. This allows to express the receive time of an | 557 | * and also the system clock (%CLOCK_REALTIME). This allows to express the |
551 | * isochronous packet as a system time with microsecond accuracy. | 558 | * receive time of an isochronous packet as a system time. |
552 | * | 559 | * |
553 | * @cycle_timer consists of 7 bits cycleSeconds, 13 bits cycleCount, and | 560 | * @cycle_timer consists of 7 bits cycleSeconds, 13 bits cycleCount, and |
554 | * 12 bits cycleOffset, in host byte order. | 561 | * 12 bits cycleOffset, in host byte order. Cf. the Cycle Time register |
562 | * per IEEE 1394 or Isochronous Cycle Timer register per OHCI-1394. | ||
563 | * | ||
564 | * In version 1 and 2 of the ABI, this ioctl returned unreliable (non- | ||
565 | * monotonic) @cycle_timer values on certain controllers. | ||
555 | */ | 566 | */ |
556 | struct fw_cdev_get_cycle_timer { | 567 | struct fw_cdev_get_cycle_timer { |
557 | __u64 local_time; | 568 | __u64 local_time; |
@@ -559,6 +570,25 @@ struct fw_cdev_get_cycle_timer { | |||
559 | }; | 570 | }; |
560 | 571 | ||
561 | /** | 572 | /** |
573 | * struct fw_cdev_get_cycle_timer2 - read cycle timer register | ||
574 | * @tv_sec: system time, seconds | ||
575 | * @tv_nsec: system time, sub-seconds part in nanoseconds | ||
576 | * @clk_id: input parameter, clock from which to get the system time | ||
577 | * @cycle_timer: Cycle Time register contents | ||
578 | * | ||
579 | * The %FW_CDEV_IOC_GET_CYCLE_TIMER2 works like | ||
580 | * %FW_CDEV_IOC_GET_CYCLE_TIMER but lets you choose a clock like with POSIX' | ||
581 | * clock_gettime function. Supported @clk_id values are POSIX' %CLOCK_REALTIME | ||
582 | * and %CLOCK_MONOTONIC and Linux' %CLOCK_MONOTONIC_RAW. | ||
583 | */ | ||
584 | struct fw_cdev_get_cycle_timer2 { | ||
585 | __s64 tv_sec; | ||
586 | __s32 tv_nsec; | ||
587 | __s32 clk_id; | ||
588 | __u32 cycle_timer; | ||
589 | }; | ||
590 | |||
591 | /** | ||
562 | * struct fw_cdev_allocate_iso_resource - (De)allocate a channel or bandwidth | 592 | * struct fw_cdev_allocate_iso_resource - (De)allocate a channel or bandwidth |
563 | * @closure: Passed back to userspace in correponding iso resource events | 593 | * @closure: Passed back to userspace in correponding iso resource events |
564 | * @channels: Isochronous channels of which one is to be (de)allocated | 594 | * @channels: Isochronous channels of which one is to be (de)allocated |
diff --git a/include/linux/firewire.h b/include/linux/firewire.h index a0e67150a729..4bd94bf5e739 100644 --- a/include/linux/firewire.h +++ b/include/linux/firewire.h | |||
@@ -65,12 +65,13 @@ | |||
65 | #define CSR_DIRECTORY_ID 0x20 | 65 | #define CSR_DIRECTORY_ID 0x20 |
66 | 66 | ||
67 | struct fw_csr_iterator { | 67 | struct fw_csr_iterator { |
68 | u32 *p; | 68 | const u32 *p; |
69 | u32 *end; | 69 | const u32 *end; |
70 | }; | 70 | }; |
71 | 71 | ||
72 | void fw_csr_iterator_init(struct fw_csr_iterator *ci, u32 *p); | 72 | void fw_csr_iterator_init(struct fw_csr_iterator *ci, const u32 *p); |
73 | int fw_csr_iterator_next(struct fw_csr_iterator *ci, int *key, int *value); | 73 | int fw_csr_iterator_next(struct fw_csr_iterator *ci, int *key, int *value); |
74 | int fw_csr_string(const u32 *directory, int key, char *buf, size_t size); | ||
74 | 75 | ||
75 | extern struct bus_type fw_bus_type; | 76 | extern struct bus_type fw_bus_type; |
76 | 77 | ||
@@ -162,7 +163,7 @@ struct fw_device { | |||
162 | struct mutex client_list_mutex; | 163 | struct mutex client_list_mutex; |
163 | struct list_head client_list; | 164 | struct list_head client_list; |
164 | 165 | ||
165 | u32 *config_rom; | 166 | const u32 *config_rom; |
166 | size_t config_rom_length; | 167 | size_t config_rom_length; |
167 | int config_rom_retries; | 168 | int config_rom_retries; |
168 | unsigned is_local:1; | 169 | unsigned is_local:1; |
@@ -204,7 +205,7 @@ int fw_device_enable_phys_dma(struct fw_device *device); | |||
204 | */ | 205 | */ |
205 | struct fw_unit { | 206 | struct fw_unit { |
206 | struct device device; | 207 | struct device device; |
207 | u32 *directory; | 208 | const u32 *directory; |
208 | struct fw_attribute_group attribute_group; | 209 | struct fw_attribute_group attribute_group; |
209 | }; | 210 | }; |
210 | 211 | ||
diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 9717081c75ad..56b50514ab25 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h | |||
@@ -101,7 +101,7 @@ struct hd_struct { | |||
101 | unsigned long stamp; | 101 | unsigned long stamp; |
102 | int in_flight[2]; | 102 | int in_flight[2]; |
103 | #ifdef CONFIG_SMP | 103 | #ifdef CONFIG_SMP |
104 | struct disk_stats *dkstats; | 104 | struct disk_stats __percpu *dkstats; |
105 | #else | 105 | #else |
106 | struct disk_stats dkstats; | 106 | struct disk_stats dkstats; |
107 | #endif | 107 | #endif |
diff --git a/include/linux/gfs2_ondisk.h b/include/linux/gfs2_ondisk.h index 81f90a59cda6..4f4462974c14 100644 --- a/include/linux/gfs2_ondisk.h +++ b/include/linux/gfs2_ondisk.h | |||
@@ -180,33 +180,6 @@ struct gfs2_rgrp { | |||
180 | }; | 180 | }; |
181 | 181 | ||
182 | /* | 182 | /* |
183 | * quota linked list: user quotas and group quotas form two separate | ||
184 | * singly linked lists. ll_next stores uids or gids of next quotas in the | ||
185 | * linked list. | ||
186 | |||
187 | Given the uid/gid, how to calculate the quota file offsets for the corresponding | ||
188 | gfs2_quota structures on disk: | ||
189 | |||
190 | for user quotas, given uid, | ||
191 | offset = uid * sizeof(struct gfs2_quota); | ||
192 | |||
193 | for group quotas, given gid, | ||
194 | offset = (gid * sizeof(struct gfs2_quota)) + sizeof(struct gfs2_quota); | ||
195 | |||
196 | |||
197 | uid:0 gid:0 uid:12 gid:12 uid:17 gid:17 uid:5142 gid:5142 | ||
198 | +-------+-------+ +-------+-------+ +-------+- - - -+ +- - - -+-------+ | ||
199 | | valid | valid | :: | valid | valid | :: | valid | inval | :: | inval | valid | | ||
200 | +-------+-------+ +-------+-------+ +-------+- - - -+ +- - - -+-------+ | ||
201 | next:12 next:12 next:17 next:5142 next:NULL next:NULL | ||
202 | | | | | |<-- user quota list | | ||
203 | \______|___________/ \______|___________/ group quota list -->| | ||
204 | | | | | ||
205 | \__________________/ \_______________________________________/ | ||
206 | |||
207 | */ | ||
208 | |||
209 | /* | ||
210 | * quota structure | 183 | * quota structure |
211 | */ | 184 | */ |
212 | 185 | ||
@@ -214,8 +187,7 @@ struct gfs2_quota { | |||
214 | __be64 qu_limit; | 187 | __be64 qu_limit; |
215 | __be64 qu_warn; | 188 | __be64 qu_warn; |
216 | __be64 qu_value; | 189 | __be64 qu_value; |
217 | __be32 qu_ll_next; /* location of next quota in list */ | 190 | __u8 qu_reserved[64]; |
218 | __u8 qu_reserved[60]; | ||
219 | }; | 191 | }; |
220 | 192 | ||
221 | /* | 193 | /* |
diff --git a/include/linux/i2c-smbus.h b/include/linux/i2c-smbus.h new file mode 100644 index 000000000000..63f57a8c8b31 --- /dev/null +++ b/include/linux/i2c-smbus.h | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
2 | * i2c-smbus.h - SMBus extensions to the I2C protocol | ||
3 | * | ||
4 | * Copyright (C) 2010 Jean Delvare <khali@linux-fr.org> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef _LINUX_I2C_SMBUS_H | ||
22 | #define _LINUX_I2C_SMBUS_H | ||
23 | |||
24 | #include <linux/i2c.h> | ||
25 | |||
26 | |||
27 | /** | ||
28 | * i2c_smbus_alert_setup - platform data for the smbus_alert i2c client | ||
29 | * @alert_edge_triggered: whether the alert interrupt is edge (1) or level (0) | ||
30 | * triggered | ||
31 | * @irq: IRQ number, if the smbus_alert driver should take care of interrupt | ||
32 | * handling | ||
33 | * | ||
34 | * If irq is not specified, the smbus_alert driver doesn't take care of | ||
35 | * interrupt handling. In that case it is up to the I2C bus driver to either | ||
36 | * handle the interrupts or to poll for alerts. | ||
37 | * | ||
38 | * If irq is specified then it it crucial that alert_edge_triggered is | ||
39 | * properly set. | ||
40 | */ | ||
41 | struct i2c_smbus_alert_setup { | ||
42 | unsigned int alert_edge_triggered:1; | ||
43 | int irq; | ||
44 | }; | ||
45 | |||
46 | struct i2c_client *i2c_setup_smbus_alert(struct i2c_adapter *adapter, | ||
47 | struct i2c_smbus_alert_setup *setup); | ||
48 | int i2c_handle_smbus_alert(struct i2c_client *ara); | ||
49 | |||
50 | #endif /* _LINUX_I2C_SMBUS_H */ | ||
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 02fc617782ef..0a5da639b327 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -53,6 +53,7 @@ struct i2c_board_info; | |||
53 | * on a bus (or read from them). Apart from two basic transfer functions to | 53 | * on a bus (or read from them). Apart from two basic transfer functions to |
54 | * transmit one message at a time, a more complex version can be used to | 54 | * transmit one message at a time, a more complex version can be used to |
55 | * transmit an arbitrary number of messages without interruption. | 55 | * transmit an arbitrary number of messages without interruption. |
56 | * @count must be be less than 64k since msg.len is u16. | ||
56 | */ | 57 | */ |
57 | extern int i2c_master_send(struct i2c_client *client, const char *buf, | 58 | extern int i2c_master_send(struct i2c_client *client, const char *buf, |
58 | int count); | 59 | int count); |
@@ -152,6 +153,13 @@ struct i2c_driver { | |||
152 | int (*suspend)(struct i2c_client *, pm_message_t mesg); | 153 | int (*suspend)(struct i2c_client *, pm_message_t mesg); |
153 | int (*resume)(struct i2c_client *); | 154 | int (*resume)(struct i2c_client *); |
154 | 155 | ||
156 | /* Alert callback, for example for the SMBus alert protocol. | ||
157 | * The format and meaning of the data value depends on the protocol. | ||
158 | * For the SMBus alert protocol, there is a single bit of data passed | ||
159 | * as the alert response's low bit ("event flag"). | ||
160 | */ | ||
161 | void (*alert)(struct i2c_client *, unsigned int data); | ||
162 | |||
155 | /* a ioctl like command that can be used to perform specific functions | 163 | /* a ioctl like command that can be used to perform specific functions |
156 | * with the device. | 164 | * with the device. |
157 | */ | 165 | */ |
diff --git a/include/linux/irq.h b/include/linux/irq.h index d13492df57a1..707ab122e2e6 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -400,7 +400,9 @@ static inline int irq_has_action(unsigned int irq) | |||
400 | 400 | ||
401 | /* Dynamic irq helper functions */ | 401 | /* Dynamic irq helper functions */ |
402 | extern void dynamic_irq_init(unsigned int irq); | 402 | extern void dynamic_irq_init(unsigned int irq); |
403 | void dynamic_irq_init_keep_chip_data(unsigned int irq); | ||
403 | extern void dynamic_irq_cleanup(unsigned int irq); | 404 | extern void dynamic_irq_cleanup(unsigned int irq); |
405 | void dynamic_irq_cleanup_keep_chip_data(unsigned int irq); | ||
404 | 406 | ||
405 | /* Set/get chip/data for an IRQ: */ | 407 | /* Set/get chip/data for an IRQ: */ |
406 | extern int set_irq_chip(unsigned int irq, struct irq_chip *chip); | 408 | extern int set_irq_chip(unsigned int irq, struct irq_chip *chip); |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 1221d2331a6d..7f0707463360 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -44,6 +44,16 @@ extern const char linux_proc_banner[]; | |||
44 | 44 | ||
45 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) | 45 | #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr)) |
46 | 46 | ||
47 | /* | ||
48 | * This looks more complex than it should be. But we need to | ||
49 | * get the type for the ~ right in round_down (it needs to be | ||
50 | * as wide as the result!), and we want to evaluate the macro | ||
51 | * arguments just once each. | ||
52 | */ | ||
53 | #define __round_mask(x, y) ((__typeof__(x))((y)-1)) | ||
54 | #define round_up(x, y) ((((x)-1) | __round_mask(x, y))+1) | ||
55 | #define round_down(x, y) ((x) & ~__round_mask(x, y)) | ||
56 | |||
47 | #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) | 57 | #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) |
48 | #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) | 58 | #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) |
49 | #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) | 59 | #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) |
diff --git a/include/linux/kexec.h b/include/linux/kexec.h index c356b6914ffd..03e8e8dbc577 100644 --- a/include/linux/kexec.h +++ b/include/linux/kexec.h | |||
@@ -199,7 +199,7 @@ extern struct kimage *kexec_crash_image; | |||
199 | */ | 199 | */ |
200 | extern struct resource crashk_res; | 200 | extern struct resource crashk_res; |
201 | typedef u32 note_buf_t[KEXEC_NOTE_BYTES/4]; | 201 | typedef u32 note_buf_t[KEXEC_NOTE_BYTES/4]; |
202 | extern note_buf_t *crash_notes; | 202 | extern note_buf_t __percpu *crash_notes; |
203 | extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4]; | 203 | extern u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZE/4]; |
204 | extern size_t vmcoreinfo_size; | 204 | extern size_t vmcoreinfo_size; |
205 | extern size_t vmcoreinfo_max_size; | 205 | extern size_t vmcoreinfo_max_size; |
diff --git a/include/linux/mm.h b/include/linux/mm.h index 8b2fa8593c61..90957f14195c 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/prio_tree.h> | 12 | #include <linux/prio_tree.h> |
13 | #include <linux/debug_locks.h> | 13 | #include <linux/debug_locks.h> |
14 | #include <linux/mm_types.h> | 14 | #include <linux/mm_types.h> |
15 | #include <linux/range.h> | ||
15 | 16 | ||
16 | struct mempolicy; | 17 | struct mempolicy; |
17 | struct anon_vma; | 18 | struct anon_vma; |
@@ -1049,6 +1050,10 @@ extern void get_pfn_range_for_nid(unsigned int nid, | |||
1049 | extern unsigned long find_min_pfn_with_active_regions(void); | 1050 | extern unsigned long find_min_pfn_with_active_regions(void); |
1050 | extern void free_bootmem_with_active_regions(int nid, | 1051 | extern void free_bootmem_with_active_regions(int nid, |
1051 | unsigned long max_low_pfn); | 1052 | unsigned long max_low_pfn); |
1053 | int add_from_early_node_map(struct range *range, int az, | ||
1054 | int nr_range, int nid); | ||
1055 | void *__alloc_memory_core_early(int nodeid, u64 size, u64 align, | ||
1056 | u64 goal, u64 limit); | ||
1052 | typedef int (*work_fn_t)(unsigned long, unsigned long, void *); | 1057 | typedef int (*work_fn_t)(unsigned long, unsigned long, void *); |
1053 | extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data); | 1058 | extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data); |
1054 | extern void sparse_memory_present_with_active_regions(int nid); | 1059 | extern void sparse_memory_present_with_active_regions(int nid); |
@@ -1081,11 +1086,7 @@ extern void si_meminfo(struct sysinfo * val); | |||
1081 | extern void si_meminfo_node(struct sysinfo *val, int nid); | 1086 | extern void si_meminfo_node(struct sysinfo *val, int nid); |
1082 | extern int after_bootmem; | 1087 | extern int after_bootmem; |
1083 | 1088 | ||
1084 | #ifdef CONFIG_NUMA | ||
1085 | extern void setup_per_cpu_pageset(void); | 1089 | extern void setup_per_cpu_pageset(void); |
1086 | #else | ||
1087 | static inline void setup_per_cpu_pageset(void) {} | ||
1088 | #endif | ||
1089 | 1090 | ||
1090 | extern void zone_pcp_update(struct zone *zone); | 1091 | extern void zone_pcp_update(struct zone *zone); |
1091 | 1092 | ||
@@ -1321,12 +1322,19 @@ extern int randomize_va_space; | |||
1321 | const char * arch_vma_name(struct vm_area_struct *vma); | 1322 | const char * arch_vma_name(struct vm_area_struct *vma); |
1322 | void print_vma_addr(char *prefix, unsigned long rip); | 1323 | void print_vma_addr(char *prefix, unsigned long rip); |
1323 | 1324 | ||
1325 | void sparse_mem_maps_populate_node(struct page **map_map, | ||
1326 | unsigned long pnum_begin, | ||
1327 | unsigned long pnum_end, | ||
1328 | unsigned long map_count, | ||
1329 | int nodeid); | ||
1330 | |||
1324 | struct page *sparse_mem_map_populate(unsigned long pnum, int nid); | 1331 | struct page *sparse_mem_map_populate(unsigned long pnum, int nid); |
1325 | pgd_t *vmemmap_pgd_populate(unsigned long addr, int node); | 1332 | pgd_t *vmemmap_pgd_populate(unsigned long addr, int node); |
1326 | pud_t *vmemmap_pud_populate(pgd_t *pgd, unsigned long addr, int node); | 1333 | pud_t *vmemmap_pud_populate(pgd_t *pgd, unsigned long addr, int node); |
1327 | pmd_t *vmemmap_pmd_populate(pud_t *pud, unsigned long addr, int node); | 1334 | pmd_t *vmemmap_pmd_populate(pud_t *pud, unsigned long addr, int node); |
1328 | pte_t *vmemmap_pte_populate(pmd_t *pmd, unsigned long addr, int node); | 1335 | pte_t *vmemmap_pte_populate(pmd_t *pmd, unsigned long addr, int node); |
1329 | void *vmemmap_alloc_block(unsigned long size, int node); | 1336 | void *vmemmap_alloc_block(unsigned long size, int node); |
1337 | void *vmemmap_alloc_block_buf(unsigned long size, int node); | ||
1330 | void vmemmap_verify(pte_t *, int, unsigned long, unsigned long); | 1338 | void vmemmap_verify(pte_t *, int, unsigned long, unsigned long); |
1331 | int vmemmap_populate_basepages(struct page *start_page, | 1339 | int vmemmap_populate_basepages(struct page *start_page, |
1332 | unsigned long pages, int node); | 1340 | unsigned long pages, int node); |
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 30fe668c2542..a01a103341bd 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h | |||
@@ -184,13 +184,7 @@ struct per_cpu_pageset { | |||
184 | s8 stat_threshold; | 184 | s8 stat_threshold; |
185 | s8 vm_stat_diff[NR_VM_ZONE_STAT_ITEMS]; | 185 | s8 vm_stat_diff[NR_VM_ZONE_STAT_ITEMS]; |
186 | #endif | 186 | #endif |
187 | } ____cacheline_aligned_in_smp; | 187 | }; |
188 | |||
189 | #ifdef CONFIG_NUMA | ||
190 | #define zone_pcp(__z, __cpu) ((__z)->pageset[(__cpu)]) | ||
191 | #else | ||
192 | #define zone_pcp(__z, __cpu) (&(__z)->pageset[(__cpu)]) | ||
193 | #endif | ||
194 | 188 | ||
195 | #endif /* !__GENERATING_BOUNDS.H */ | 189 | #endif /* !__GENERATING_BOUNDS.H */ |
196 | 190 | ||
@@ -306,10 +300,8 @@ struct zone { | |||
306 | */ | 300 | */ |
307 | unsigned long min_unmapped_pages; | 301 | unsigned long min_unmapped_pages; |
308 | unsigned long min_slab_pages; | 302 | unsigned long min_slab_pages; |
309 | struct per_cpu_pageset *pageset[NR_CPUS]; | ||
310 | #else | ||
311 | struct per_cpu_pageset pageset[NR_CPUS]; | ||
312 | #endif | 303 | #endif |
304 | struct per_cpu_pageset __percpu *pageset; | ||
313 | /* | 305 | /* |
314 | * free areas of different sizes | 306 | * free areas of different sizes |
315 | */ | 307 | */ |
@@ -620,7 +612,9 @@ typedef struct pglist_data { | |||
620 | struct page_cgroup *node_page_cgroup; | 612 | struct page_cgroup *node_page_cgroup; |
621 | #endif | 613 | #endif |
622 | #endif | 614 | #endif |
615 | #ifndef CONFIG_NO_BOOTMEM | ||
623 | struct bootmem_data *bdata; | 616 | struct bootmem_data *bdata; |
617 | #endif | ||
624 | #ifdef CONFIG_MEMORY_HOTPLUG | 618 | #ifdef CONFIG_MEMORY_HOTPLUG |
625 | /* | 619 | /* |
626 | * Must be held any time you expect node_start_pfn, node_present_pages | 620 | * Must be held any time you expect node_start_pfn, node_present_pages |
diff --git a/include/linux/module.h b/include/linux/module.h index 6cb1a3cab5d3..dd618eb026aa 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -17,7 +17,7 @@ | |||
17 | #include <linux/moduleparam.h> | 17 | #include <linux/moduleparam.h> |
18 | #include <linux/tracepoint.h> | 18 | #include <linux/tracepoint.h> |
19 | 19 | ||
20 | #include <asm/local.h> | 20 | #include <linux/percpu.h> |
21 | #include <asm/module.h> | 21 | #include <asm/module.h> |
22 | 22 | ||
23 | #include <trace/events/module.h> | 23 | #include <trace/events/module.h> |
@@ -363,11 +363,9 @@ struct module | |||
363 | /* Destruction function. */ | 363 | /* Destruction function. */ |
364 | void (*exit)(void); | 364 | void (*exit)(void); |
365 | 365 | ||
366 | #ifdef CONFIG_SMP | 366 | struct module_ref { |
367 | char *refptr; | 367 | int count; |
368 | #else | 368 | } __percpu *refptr; |
369 | local_t ref; | ||
370 | #endif | ||
371 | #endif | 369 | #endif |
372 | 370 | ||
373 | #ifdef CONFIG_CONSTRUCTORS | 371 | #ifdef CONFIG_CONSTRUCTORS |
@@ -454,25 +452,16 @@ void __symbol_put(const char *symbol); | |||
454 | #define symbol_put(x) __symbol_put(MODULE_SYMBOL_PREFIX #x) | 452 | #define symbol_put(x) __symbol_put(MODULE_SYMBOL_PREFIX #x) |
455 | void symbol_put_addr(void *addr); | 453 | void symbol_put_addr(void *addr); |
456 | 454 | ||
457 | static inline local_t *__module_ref_addr(struct module *mod, int cpu) | ||
458 | { | ||
459 | #ifdef CONFIG_SMP | ||
460 | return (local_t *) (mod->refptr + per_cpu_offset(cpu)); | ||
461 | #else | ||
462 | return &mod->ref; | ||
463 | #endif | ||
464 | } | ||
465 | |||
466 | /* Sometimes we know we already have a refcount, and it's easier not | 455 | /* Sometimes we know we already have a refcount, and it's easier not |
467 | to handle the error case (which only happens with rmmod --wait). */ | 456 | to handle the error case (which only happens with rmmod --wait). */ |
468 | static inline void __module_get(struct module *module) | 457 | static inline void __module_get(struct module *module) |
469 | { | 458 | { |
470 | if (module) { | 459 | if (module) { |
471 | unsigned int cpu = get_cpu(); | 460 | preempt_disable(); |
472 | local_inc(__module_ref_addr(module, cpu)); | 461 | __this_cpu_inc(module->refptr->count); |
473 | trace_module_get(module, _THIS_IP_, | 462 | trace_module_get(module, _THIS_IP_, |
474 | local_read(__module_ref_addr(module, cpu))); | 463 | __this_cpu_read(module->refptr->count)); |
475 | put_cpu(); | 464 | preempt_enable(); |
476 | } | 465 | } |
477 | } | 466 | } |
478 | 467 | ||
@@ -481,15 +470,17 @@ static inline int try_module_get(struct module *module) | |||
481 | int ret = 1; | 470 | int ret = 1; |
482 | 471 | ||
483 | if (module) { | 472 | if (module) { |
484 | unsigned int cpu = get_cpu(); | 473 | preempt_disable(); |
474 | |||
485 | if (likely(module_is_live(module))) { | 475 | if (likely(module_is_live(module))) { |
486 | local_inc(__module_ref_addr(module, cpu)); | 476 | __this_cpu_inc(module->refptr->count); |
487 | trace_module_get(module, _THIS_IP_, | 477 | trace_module_get(module, _THIS_IP_, |
488 | local_read(__module_ref_addr(module, cpu))); | 478 | __this_cpu_read(module->refptr->count)); |
489 | } | 479 | } |
490 | else | 480 | else |
491 | ret = 0; | 481 | ret = 0; |
492 | put_cpu(); | 482 | |
483 | preempt_enable(); | ||
493 | } | 484 | } |
494 | return ret; | 485 | return ret; |
495 | } | 486 | } |
diff --git a/include/linux/mount.h b/include/linux/mount.h index 5d5275364867..b5f43a34ef88 100644 --- a/include/linux/mount.h +++ b/include/linux/mount.h | |||
@@ -66,7 +66,7 @@ struct vfsmount { | |||
66 | int mnt_pinned; | 66 | int mnt_pinned; |
67 | int mnt_ghosts; | 67 | int mnt_ghosts; |
68 | #ifdef CONFIG_SMP | 68 | #ifdef CONFIG_SMP |
69 | int *mnt_writers; | 69 | int __percpu *mnt_writers; |
70 | #else | 70 | #else |
71 | int mnt_writers; | 71 | int mnt_writers; |
72 | #endif | 72 | #endif |
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h index 34fc6be5bfcf..6a2e44fd75e2 100644 --- a/include/linux/nfs_fs_sb.h +++ b/include/linux/nfs_fs_sb.h | |||
@@ -105,7 +105,7 @@ struct nfs_server { | |||
105 | struct rpc_clnt * client; /* RPC client handle */ | 105 | struct rpc_clnt * client; /* RPC client handle */ |
106 | struct rpc_clnt * client_acl; /* ACL RPC client handle */ | 106 | struct rpc_clnt * client_acl; /* ACL RPC client handle */ |
107 | struct nlm_host *nlm_host; /* NLM client handle */ | 107 | struct nlm_host *nlm_host; /* NLM client handle */ |
108 | struct nfs_iostats * io_stats; /* I/O statistics */ | 108 | struct nfs_iostats __percpu *io_stats; /* I/O statistics */ |
109 | struct backing_dev_info backing_dev_info; | 109 | struct backing_dev_info backing_dev_info; |
110 | atomic_long_t writeback; /* number of writeback pages */ | 110 | atomic_long_t writeback; /* number of writeback pages */ |
111 | int flags; /* various flags */ | 111 | int flags; /* various flags */ |
diff --git a/include/linux/nilfs2_fs.h b/include/linux/nilfs2_fs.h index 3fe02cf8b65a..640702e97457 100644 --- a/include/linux/nilfs2_fs.h +++ b/include/linux/nilfs2_fs.h | |||
@@ -153,6 +153,7 @@ struct nilfs_super_root { | |||
153 | semantics also for data */ | 153 | semantics also for data */ |
154 | #define NILFS_MOUNT_NORECOVERY 0x4000 /* Disable write access during | 154 | #define NILFS_MOUNT_NORECOVERY 0x4000 /* Disable write access during |
155 | mount-time recovery */ | 155 | mount-time recovery */ |
156 | #define NILFS_MOUNT_DISCARD 0x8000 /* Issue DISCARD requests */ | ||
156 | 157 | ||
157 | 158 | ||
158 | /** | 159 | /** |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index 0be824320580..9f688d243b86 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -770,7 +770,6 @@ | |||
770 | #define PCI_VENDOR_ID_TI 0x104c | 770 | #define PCI_VENDOR_ID_TI 0x104c |
771 | #define PCI_DEVICE_ID_TI_TVP4020 0x3d07 | 771 | #define PCI_DEVICE_ID_TI_TVP4020 0x3d07 |
772 | #define PCI_DEVICE_ID_TI_4450 0x8011 | 772 | #define PCI_DEVICE_ID_TI_4450 0x8011 |
773 | #define PCI_DEVICE_ID_TI_TSB43AB22 0x8023 | ||
774 | #define PCI_DEVICE_ID_TI_XX21_XX11 0x8031 | 773 | #define PCI_DEVICE_ID_TI_XX21_XX11 0x8031 |
775 | #define PCI_DEVICE_ID_TI_XX21_XX11_FM 0x8033 | 774 | #define PCI_DEVICE_ID_TI_XX21_XX11_FM 0x8033 |
776 | #define PCI_DEVICE_ID_TI_XX21_XX11_SD 0x8034 | 775 | #define PCI_DEVICE_ID_TI_XX21_XX11_SD 0x8034 |
@@ -2333,6 +2332,8 @@ | |||
2333 | #define PCI_VENDOR_ID_KORENIX 0x1982 | 2332 | #define PCI_VENDOR_ID_KORENIX 0x1982 |
2334 | #define PCI_DEVICE_ID_KORENIX_JETCARDF0 0x1600 | 2333 | #define PCI_DEVICE_ID_KORENIX_JETCARDF0 0x1600 |
2335 | #define PCI_DEVICE_ID_KORENIX_JETCARDF1 0x16ff | 2334 | #define PCI_DEVICE_ID_KORENIX_JETCARDF1 0x16ff |
2335 | #define PCI_DEVICE_ID_KORENIX_JETCARDF2 0x1700 | ||
2336 | #define PCI_DEVICE_ID_KORENIX_JETCARDF3 0x17ff | ||
2336 | 2337 | ||
2337 | #define PCI_VENDOR_ID_QMI 0x1a32 | 2338 | #define PCI_VENDOR_ID_QMI 0x1a32 |
2338 | 2339 | ||
@@ -2697,6 +2698,7 @@ | |||
2697 | #define PCI_DEVICE_ID_NETMOS_9835 0x9835 | 2698 | #define PCI_DEVICE_ID_NETMOS_9835 0x9835 |
2698 | #define PCI_DEVICE_ID_NETMOS_9845 0x9845 | 2699 | #define PCI_DEVICE_ID_NETMOS_9845 0x9845 |
2699 | #define PCI_DEVICE_ID_NETMOS_9855 0x9855 | 2700 | #define PCI_DEVICE_ID_NETMOS_9855 0x9855 |
2701 | #define PCI_DEVICE_ID_NETMOS_9865 0x9865 | ||
2700 | #define PCI_DEVICE_ID_NETMOS_9901 0x9901 | 2702 | #define PCI_DEVICE_ID_NETMOS_9901 0x9901 |
2701 | 2703 | ||
2702 | #define PCI_VENDOR_ID_3COM_2 0xa727 | 2704 | #define PCI_VENDOR_ID_3COM_2 0xa727 |
diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h index 5a5d6ce4bd55..68567c0b3a5d 100644 --- a/include/linux/percpu-defs.h +++ b/include/linux/percpu-defs.h | |||
@@ -2,12 +2,6 @@ | |||
2 | #define _LINUX_PERCPU_DEFS_H | 2 | #define _LINUX_PERCPU_DEFS_H |
3 | 3 | ||
4 | /* | 4 | /* |
5 | * Determine the real variable name from the name visible in the | ||
6 | * kernel sources. | ||
7 | */ | ||
8 | #define per_cpu_var(var) per_cpu__##var | ||
9 | |||
10 | /* | ||
11 | * Base implementations of per-CPU variable declarations and definitions, where | 5 | * Base implementations of per-CPU variable declarations and definitions, where |
12 | * the section in which the variable is to be placed is provided by the | 6 | * the section in which the variable is to be placed is provided by the |
13 | * 'sec' argument. This may be used to affect the parameters governing the | 7 | * 'sec' argument. This may be used to affect the parameters governing the |
@@ -18,13 +12,23 @@ | |||
18 | * that section. | 12 | * that section. |
19 | */ | 13 | */ |
20 | #define __PCPU_ATTRS(sec) \ | 14 | #define __PCPU_ATTRS(sec) \ |
21 | __attribute__((section(PER_CPU_BASE_SECTION sec))) \ | 15 | __percpu __attribute__((section(PER_CPU_BASE_SECTION sec))) \ |
22 | PER_CPU_ATTRIBUTES | 16 | PER_CPU_ATTRIBUTES |
23 | 17 | ||
24 | #define __PCPU_DUMMY_ATTRS \ | 18 | #define __PCPU_DUMMY_ATTRS \ |
25 | __attribute__((section(".discard"), unused)) | 19 | __attribute__((section(".discard"), unused)) |
26 | 20 | ||
27 | /* | 21 | /* |
22 | * Macro which verifies @ptr is a percpu pointer without evaluating | ||
23 | * @ptr. This is to be used in percpu accessors to verify that the | ||
24 | * input parameter is a percpu pointer. | ||
25 | */ | ||
26 | #define __verify_pcpu_ptr(ptr) do { \ | ||
27 | const void __percpu *__vpp_verify = (typeof(ptr))NULL; \ | ||
28 | (void)__vpp_verify; \ | ||
29 | } while (0) | ||
30 | |||
31 | /* | ||
28 | * s390 and alpha modules require percpu variables to be defined as | 32 | * s390 and alpha modules require percpu variables to be defined as |
29 | * weak to force the compiler to generate GOT based external | 33 | * weak to force the compiler to generate GOT based external |
30 | * references for them. This is necessary because percpu sections | 34 | * references for them. This is necessary because percpu sections |
@@ -56,24 +60,24 @@ | |||
56 | */ | 60 | */ |
57 | #define DECLARE_PER_CPU_SECTION(type, name, sec) \ | 61 | #define DECLARE_PER_CPU_SECTION(type, name, sec) \ |
58 | extern __PCPU_DUMMY_ATTRS char __pcpu_scope_##name; \ | 62 | extern __PCPU_DUMMY_ATTRS char __pcpu_scope_##name; \ |
59 | extern __PCPU_ATTRS(sec) __typeof__(type) per_cpu__##name | 63 | extern __PCPU_ATTRS(sec) __typeof__(type) name |
60 | 64 | ||
61 | #define DEFINE_PER_CPU_SECTION(type, name, sec) \ | 65 | #define DEFINE_PER_CPU_SECTION(type, name, sec) \ |
62 | __PCPU_DUMMY_ATTRS char __pcpu_scope_##name; \ | 66 | __PCPU_DUMMY_ATTRS char __pcpu_scope_##name; \ |
63 | extern __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \ | 67 | extern __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \ |
64 | __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \ | 68 | __PCPU_DUMMY_ATTRS char __pcpu_unique_##name; \ |
65 | __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES __weak \ | 69 | __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES __weak \ |
66 | __typeof__(type) per_cpu__##name | 70 | __typeof__(type) name |
67 | #else | 71 | #else |
68 | /* | 72 | /* |
69 | * Normal declaration and definition macros. | 73 | * Normal declaration and definition macros. |
70 | */ | 74 | */ |
71 | #define DECLARE_PER_CPU_SECTION(type, name, sec) \ | 75 | #define DECLARE_PER_CPU_SECTION(type, name, sec) \ |
72 | extern __PCPU_ATTRS(sec) __typeof__(type) per_cpu__##name | 76 | extern __PCPU_ATTRS(sec) __typeof__(type) name |
73 | 77 | ||
74 | #define DEFINE_PER_CPU_SECTION(type, name, sec) \ | 78 | #define DEFINE_PER_CPU_SECTION(type, name, sec) \ |
75 | __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES \ | 79 | __PCPU_ATTRS(sec) PER_CPU_DEF_ATTRIBUTES \ |
76 | __typeof__(type) per_cpu__##name | 80 | __typeof__(type) name |
77 | #endif | 81 | #endif |
78 | 82 | ||
79 | /* | 83 | /* |
@@ -135,10 +139,16 @@ | |||
135 | __aligned(PAGE_SIZE) | 139 | __aligned(PAGE_SIZE) |
136 | 140 | ||
137 | /* | 141 | /* |
138 | * Intermodule exports for per-CPU variables. | 142 | * Intermodule exports for per-CPU variables. sparse forgets about |
143 | * address space across EXPORT_SYMBOL(), change EXPORT_SYMBOL() to | ||
144 | * noop if __CHECKER__. | ||
139 | */ | 145 | */ |
140 | #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(per_cpu__##var) | 146 | #ifndef __CHECKER__ |
141 | #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(per_cpu__##var) | 147 | #define EXPORT_PER_CPU_SYMBOL(var) EXPORT_SYMBOL(var) |
142 | 148 | #define EXPORT_PER_CPU_SYMBOL_GPL(var) EXPORT_SYMBOL_GPL(var) | |
149 | #else | ||
150 | #define EXPORT_PER_CPU_SYMBOL(var) | ||
151 | #define EXPORT_PER_CPU_SYMBOL_GPL(var) | ||
152 | #endif | ||
143 | 153 | ||
144 | #endif /* _LINUX_PERCPU_DEFS_H */ | 154 | #endif /* _LINUX_PERCPU_DEFS_H */ |
diff --git a/include/linux/percpu.h b/include/linux/percpu.h index cf5efbcf716c..a93e5bfdccb8 100644 --- a/include/linux/percpu.h +++ b/include/linux/percpu.h | |||
@@ -27,10 +27,17 @@ | |||
27 | * we force a syntax error here if it isn't. | 27 | * we force a syntax error here if it isn't. |
28 | */ | 28 | */ |
29 | #define get_cpu_var(var) (*({ \ | 29 | #define get_cpu_var(var) (*({ \ |
30 | extern int simple_identifier_##var(void); \ | ||
31 | preempt_disable(); \ | 30 | preempt_disable(); \ |
32 | &__get_cpu_var(var); })) | 31 | &__get_cpu_var(var); })) |
33 | #define put_cpu_var(var) preempt_enable() | 32 | |
33 | /* | ||
34 | * The weird & is necessary because sparse considers (void)(var) to be | ||
35 | * a direct dereference of percpu variable (var). | ||
36 | */ | ||
37 | #define put_cpu_var(var) do { \ | ||
38 | (void)&(var); \ | ||
39 | preempt_enable(); \ | ||
40 | } while (0) | ||
34 | 41 | ||
35 | #ifdef CONFIG_SMP | 42 | #ifdef CONFIG_SMP |
36 | 43 | ||
@@ -127,9 +134,9 @@ extern int __init pcpu_page_first_chunk(size_t reserved_size, | |||
127 | */ | 134 | */ |
128 | #define per_cpu_ptr(ptr, cpu) SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu))) | 135 | #define per_cpu_ptr(ptr, cpu) SHIFT_PERCPU_PTR((ptr), per_cpu_offset((cpu))) |
129 | 136 | ||
130 | extern void *__alloc_reserved_percpu(size_t size, size_t align); | 137 | extern void __percpu *__alloc_reserved_percpu(size_t size, size_t align); |
131 | extern void *__alloc_percpu(size_t size, size_t align); | 138 | extern void __percpu *__alloc_percpu(size_t size, size_t align); |
132 | extern void free_percpu(void *__pdata); | 139 | extern void free_percpu(void __percpu *__pdata); |
133 | extern phys_addr_t per_cpu_ptr_to_phys(void *addr); | 140 | extern phys_addr_t per_cpu_ptr_to_phys(void *addr); |
134 | 141 | ||
135 | #ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA | 142 | #ifndef CONFIG_HAVE_SETUP_PER_CPU_AREA |
@@ -140,7 +147,7 @@ extern void __init setup_per_cpu_areas(void); | |||
140 | 147 | ||
141 | #define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) | 148 | #define per_cpu_ptr(ptr, cpu) ({ (void)(cpu); (ptr); }) |
142 | 149 | ||
143 | static inline void *__alloc_percpu(size_t size, size_t align) | 150 | static inline void __percpu *__alloc_percpu(size_t size, size_t align) |
144 | { | 151 | { |
145 | /* | 152 | /* |
146 | * Can't easily make larger alignment work with kmalloc. WARN | 153 | * Can't easily make larger alignment work with kmalloc. WARN |
@@ -151,7 +158,7 @@ static inline void *__alloc_percpu(size_t size, size_t align) | |||
151 | return kzalloc(size, GFP_KERNEL); | 158 | return kzalloc(size, GFP_KERNEL); |
152 | } | 159 | } |
153 | 160 | ||
154 | static inline void free_percpu(void *p) | 161 | static inline void free_percpu(void __percpu *p) |
155 | { | 162 | { |
156 | kfree(p); | 163 | kfree(p); |
157 | } | 164 | } |
@@ -171,7 +178,7 @@ static inline void *pcpu_lpage_remapped(void *kaddr) | |||
171 | #endif /* CONFIG_SMP */ | 178 | #endif /* CONFIG_SMP */ |
172 | 179 | ||
173 | #define alloc_percpu(type) \ | 180 | #define alloc_percpu(type) \ |
174 | (typeof(type) *)__alloc_percpu(sizeof(type), __alignof__(type)) | 181 | (typeof(type) __percpu *)__alloc_percpu(sizeof(type), __alignof__(type)) |
175 | 182 | ||
176 | /* | 183 | /* |
177 | * Optional methods for optimized non-lvalue per-cpu variable access. | 184 | * Optional methods for optimized non-lvalue per-cpu variable access. |
@@ -188,17 +195,19 @@ static inline void *pcpu_lpage_remapped(void *kaddr) | |||
188 | #ifndef percpu_read | 195 | #ifndef percpu_read |
189 | # define percpu_read(var) \ | 196 | # define percpu_read(var) \ |
190 | ({ \ | 197 | ({ \ |
191 | typeof(per_cpu_var(var)) __tmp_var__; \ | 198 | typeof(var) *pr_ptr__ = &(var); \ |
192 | __tmp_var__ = get_cpu_var(var); \ | 199 | typeof(var) pr_ret__; \ |
193 | put_cpu_var(var); \ | 200 | pr_ret__ = get_cpu_var(*pr_ptr__); \ |
194 | __tmp_var__; \ | 201 | put_cpu_var(*pr_ptr__); \ |
202 | pr_ret__; \ | ||
195 | }) | 203 | }) |
196 | #endif | 204 | #endif |
197 | 205 | ||
198 | #define __percpu_generic_to_op(var, val, op) \ | 206 | #define __percpu_generic_to_op(var, val, op) \ |
199 | do { \ | 207 | do { \ |
200 | get_cpu_var(var) op val; \ | 208 | typeof(var) *pgto_ptr__ = &(var); \ |
201 | put_cpu_var(var); \ | 209 | get_cpu_var(*pgto_ptr__) op val; \ |
210 | put_cpu_var(*pgto_ptr__); \ | ||
202 | } while (0) | 211 | } while (0) |
203 | 212 | ||
204 | #ifndef percpu_write | 213 | #ifndef percpu_write |
@@ -234,6 +243,7 @@ extern void __bad_size_call_parameter(void); | |||
234 | 243 | ||
235 | #define __pcpu_size_call_return(stem, variable) \ | 244 | #define __pcpu_size_call_return(stem, variable) \ |
236 | ({ typeof(variable) pscr_ret__; \ | 245 | ({ typeof(variable) pscr_ret__; \ |
246 | __verify_pcpu_ptr(&(variable)); \ | ||
237 | switch(sizeof(variable)) { \ | 247 | switch(sizeof(variable)) { \ |
238 | case 1: pscr_ret__ = stem##1(variable);break; \ | 248 | case 1: pscr_ret__ = stem##1(variable);break; \ |
239 | case 2: pscr_ret__ = stem##2(variable);break; \ | 249 | case 2: pscr_ret__ = stem##2(variable);break; \ |
@@ -247,6 +257,7 @@ extern void __bad_size_call_parameter(void); | |||
247 | 257 | ||
248 | #define __pcpu_size_call(stem, variable, ...) \ | 258 | #define __pcpu_size_call(stem, variable, ...) \ |
249 | do { \ | 259 | do { \ |
260 | __verify_pcpu_ptr(&(variable)); \ | ||
250 | switch(sizeof(variable)) { \ | 261 | switch(sizeof(variable)) { \ |
251 | case 1: stem##1(variable, __VA_ARGS__);break; \ | 262 | case 1: stem##1(variable, __VA_ARGS__);break; \ |
252 | case 2: stem##2(variable, __VA_ARGS__);break; \ | 263 | case 2: stem##2(variable, __VA_ARGS__);break; \ |
@@ -259,8 +270,7 @@ do { \ | |||
259 | 270 | ||
260 | /* | 271 | /* |
261 | * Optimized manipulation for memory allocated through the per cpu | 272 | * Optimized manipulation for memory allocated through the per cpu |
262 | * allocator or for addresses of per cpu variables (can be determined | 273 | * allocator or for addresses of per cpu variables. |
263 | * using per_cpu_var(xx). | ||
264 | * | 274 | * |
265 | * These operation guarantee exclusivity of access for other operations | 275 | * These operation guarantee exclusivity of access for other operations |
266 | * on the *same* processor. The assumption is that per cpu data is only | 276 | * on the *same* processor. The assumption is that per cpu data is only |
@@ -311,7 +321,7 @@ do { \ | |||
311 | #define _this_cpu_generic_to_op(pcp, val, op) \ | 321 | #define _this_cpu_generic_to_op(pcp, val, op) \ |
312 | do { \ | 322 | do { \ |
313 | preempt_disable(); \ | 323 | preempt_disable(); \ |
314 | *__this_cpu_ptr(&pcp) op val; \ | 324 | *__this_cpu_ptr(&(pcp)) op val; \ |
315 | preempt_enable(); \ | 325 | preempt_enable(); \ |
316 | } while (0) | 326 | } while (0) |
317 | 327 | ||
diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h index 794662b2be5d..c88d67b59394 100644 --- a/include/linux/percpu_counter.h +++ b/include/linux/percpu_counter.h | |||
@@ -21,7 +21,7 @@ struct percpu_counter { | |||
21 | #ifdef CONFIG_HOTPLUG_CPU | 21 | #ifdef CONFIG_HOTPLUG_CPU |
22 | struct list_head list; /* All percpu_counters are on a list */ | 22 | struct list_head list; /* All percpu_counters are on a list */ |
23 | #endif | 23 | #endif |
24 | s32 *counters; | 24 | s32 __percpu *counters; |
25 | }; | 25 | }; |
26 | 26 | ||
27 | extern int percpu_counter_batch; | 27 | extern int percpu_counter_batch; |
diff --git a/include/linux/range.h b/include/linux/range.h new file mode 100644 index 000000000000..bd184a5db791 --- /dev/null +++ b/include/linux/range.h | |||
@@ -0,0 +1,30 @@ | |||
1 | #ifndef _LINUX_RANGE_H | ||
2 | #define _LINUX_RANGE_H | ||
3 | |||
4 | struct range { | ||
5 | u64 start; | ||
6 | u64 end; | ||
7 | }; | ||
8 | |||
9 | int add_range(struct range *range, int az, int nr_range, | ||
10 | u64 start, u64 end); | ||
11 | |||
12 | |||
13 | int add_range_with_merge(struct range *range, int az, int nr_range, | ||
14 | u64 start, u64 end); | ||
15 | |||
16 | void subtract_range(struct range *range, int az, u64 start, u64 end); | ||
17 | |||
18 | int clean_sort_range(struct range *range, int az); | ||
19 | |||
20 | void sort_range(struct range *range, int nr_range); | ||
21 | |||
22 | #define MAX_RESOURCE ((resource_size_t)~0) | ||
23 | static inline resource_size_t cap_resource(u64 val) | ||
24 | { | ||
25 | if (val > MAX_RESOURCE) | ||
26 | return MAX_RESOURCE; | ||
27 | |||
28 | return val; | ||
29 | } | ||
30 | #endif | ||
diff --git a/include/linux/security.h b/include/linux/security.h index 2c627d361c02..233d20b52c1b 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -76,7 +76,7 @@ extern int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3, | |||
76 | extern int cap_task_setscheduler(struct task_struct *p, int policy, struct sched_param *lp); | 76 | extern int cap_task_setscheduler(struct task_struct *p, int policy, struct sched_param *lp); |
77 | extern int cap_task_setioprio(struct task_struct *p, int ioprio); | 77 | extern int cap_task_setioprio(struct task_struct *p, int ioprio); |
78 | extern int cap_task_setnice(struct task_struct *p, int nice); | 78 | extern int cap_task_setnice(struct task_struct *p, int nice); |
79 | extern int cap_syslog(int type); | 79 | extern int cap_syslog(int type, bool from_file); |
80 | extern int cap_vm_enough_memory(struct mm_struct *mm, long pages); | 80 | extern int cap_vm_enough_memory(struct mm_struct *mm, long pages); |
81 | 81 | ||
82 | struct msghdr; | 82 | struct msghdr; |
@@ -95,6 +95,8 @@ 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 | void reset_security_ops(void); | ||
99 | |||
98 | #ifdef CONFIG_MMU | 100 | #ifdef CONFIG_MMU |
99 | extern unsigned long mmap_min_addr; | 101 | extern unsigned long mmap_min_addr; |
100 | extern unsigned long dac_mmap_min_addr; | 102 | extern unsigned long dac_mmap_min_addr; |
@@ -985,6 +987,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
985 | * Check permissions on incoming network packets. This hook is distinct | 987 | * Check permissions on incoming network packets. This hook is distinct |
986 | * from Netfilter's IP input hooks since it is the first time that the | 988 | * from Netfilter's IP input hooks since it is the first time that the |
987 | * incoming sk_buff @skb has been associated with a particular socket, @sk. | 989 | * incoming sk_buff @skb has been associated with a particular socket, @sk. |
990 | * Must not sleep inside this hook because some callers hold spinlocks. | ||
988 | * @sk contains the sock (not socket) associated with the incoming sk_buff. | 991 | * @sk contains the sock (not socket) associated with the incoming sk_buff. |
989 | * @skb contains the incoming network data. | 992 | * @skb contains the incoming network data. |
990 | * @socket_getpeersec_stream: | 993 | * @socket_getpeersec_stream: |
@@ -1348,6 +1351,7 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts) | |||
1348 | * logging to the console. | 1351 | * logging to the console. |
1349 | * See the syslog(2) manual page for an explanation of the @type values. | 1352 | * See the syslog(2) manual page for an explanation of the @type values. |
1350 | * @type contains the type of action. | 1353 | * @type contains the type of action. |
1354 | * @from_file indicates the context of action (if it came from /proc). | ||
1351 | * Return 0 if permission is granted. | 1355 | * Return 0 if permission is granted. |
1352 | * @settime: | 1356 | * @settime: |
1353 | * Check permission to change the system time. | 1357 | * Check permission to change the system time. |
@@ -1462,7 +1466,7 @@ struct security_operations { | |||
1462 | int (*sysctl) (struct ctl_table *table, int op); | 1466 | int (*sysctl) (struct ctl_table *table, int op); |
1463 | int (*quotactl) (int cmds, int type, int id, struct super_block *sb); | 1467 | int (*quotactl) (int cmds, int type, int id, struct super_block *sb); |
1464 | int (*quota_on) (struct dentry *dentry); | 1468 | int (*quota_on) (struct dentry *dentry); |
1465 | int (*syslog) (int type); | 1469 | int (*syslog) (int type, bool from_file); |
1466 | int (*settime) (struct timespec *ts, struct timezone *tz); | 1470 | int (*settime) (struct timespec *ts, struct timezone *tz); |
1467 | int (*vm_enough_memory) (struct mm_struct *mm, long pages); | 1471 | int (*vm_enough_memory) (struct mm_struct *mm, long pages); |
1468 | 1472 | ||
@@ -1761,7 +1765,7 @@ int security_acct(struct file *file); | |||
1761 | int security_sysctl(struct ctl_table *table, int op); | 1765 | int security_sysctl(struct ctl_table *table, int op); |
1762 | int security_quotactl(int cmds, int type, int id, struct super_block *sb); | 1766 | int security_quotactl(int cmds, int type, int id, struct super_block *sb); |
1763 | int security_quota_on(struct dentry *dentry); | 1767 | int security_quota_on(struct dentry *dentry); |
1764 | int security_syslog(int type); | 1768 | int security_syslog(int type, bool from_file); |
1765 | int security_settime(struct timespec *ts, struct timezone *tz); | 1769 | int security_settime(struct timespec *ts, struct timezone *tz); |
1766 | int security_vm_enough_memory(long pages); | 1770 | int security_vm_enough_memory(long pages); |
1767 | int security_vm_enough_memory_mm(struct mm_struct *mm, long pages); | 1771 | int security_vm_enough_memory_mm(struct mm_struct *mm, long pages); |
@@ -2007,9 +2011,9 @@ static inline int security_quota_on(struct dentry *dentry) | |||
2007 | return 0; | 2011 | return 0; |
2008 | } | 2012 | } |
2009 | 2013 | ||
2010 | static inline int security_syslog(int type) | 2014 | static inline int security_syslog(int type, bool from_file) |
2011 | { | 2015 | { |
2012 | return cap_syslog(type); | 2016 | return cap_syslog(type, from_file); |
2013 | } | 2017 | } |
2014 | 2018 | ||
2015 | static inline int security_settime(struct timespec *ts, struct timezone *tz) | 2019 | static inline int security_settime(struct timespec *ts, struct timezone *tz) |
diff --git a/include/linux/srcu.h b/include/linux/srcu.h index 3084f80909cd..4d5ecb222af9 100644 --- a/include/linux/srcu.h +++ b/include/linux/srcu.h | |||
@@ -33,7 +33,7 @@ struct srcu_struct_array { | |||
33 | 33 | ||
34 | struct srcu_struct { | 34 | struct srcu_struct { |
35 | int completed; | 35 | int completed; |
36 | struct srcu_struct_array *per_cpu_ref; | 36 | struct srcu_struct_array __percpu *per_cpu_ref; |
37 | struct mutex mutex; | 37 | struct mutex mutex; |
38 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 38 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
39 | struct lockdep_map dep_map; | 39 | struct lockdep_map dep_map; |
diff --git a/include/linux/syslog.h b/include/linux/syslog.h new file mode 100644 index 000000000000..38911391a139 --- /dev/null +++ b/include/linux/syslog.h | |||
@@ -0,0 +1,52 @@ | |||
1 | /* Syslog internals | ||
2 | * | ||
3 | * Copyright 2010 Canonical, Ltd. | ||
4 | * Author: Kees Cook <kees.cook@canonical.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License as published by | ||
8 | * the Free Software Foundation; either version 2, or (at your option) | ||
9 | * any later version. | ||
10 | * | ||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; see the file COPYING. If not, write to | ||
18 | * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef _LINUX_SYSLOG_H | ||
22 | #define _LINUX_SYSLOG_H | ||
23 | |||
24 | /* Close the log. Currently a NOP. */ | ||
25 | #define SYSLOG_ACTION_CLOSE 0 | ||
26 | /* Open the log. Currently a NOP. */ | ||
27 | #define SYSLOG_ACTION_OPEN 1 | ||
28 | /* Read from the log. */ | ||
29 | #define SYSLOG_ACTION_READ 2 | ||
30 | /* Read all messages remaining in the ring buffer. */ | ||
31 | #define SYSLOG_ACTION_READ_ALL 3 | ||
32 | /* Read and clear all messages remaining in the ring buffer */ | ||
33 | #define SYSLOG_ACTION_READ_CLEAR 4 | ||
34 | /* Clear ring buffer. */ | ||
35 | #define SYSLOG_ACTION_CLEAR 5 | ||
36 | /* Disable printk's to console */ | ||
37 | #define SYSLOG_ACTION_CONSOLE_OFF 6 | ||
38 | /* Enable printk's to console */ | ||
39 | #define SYSLOG_ACTION_CONSOLE_ON 7 | ||
40 | /* Set level of messages printed to console */ | ||
41 | #define SYSLOG_ACTION_CONSOLE_LEVEL 8 | ||
42 | /* Return number of unread characters in the log buffer */ | ||
43 | #define SYSLOG_ACTION_SIZE_UNREAD 9 | ||
44 | /* Return size of the log buffer */ | ||
45 | #define SYSLOG_ACTION_SIZE_BUFFER 10 | ||
46 | |||
47 | #define SYSLOG_FROM_CALL 0 | ||
48 | #define SYSLOG_FROM_FILE 1 | ||
49 | |||
50 | int do_syslog(int type, char __user *buf, int count, bool from_file); | ||
51 | |||
52 | #endif /* _LINUX_SYSLOG_H */ | ||
diff --git a/include/linux/tty.h b/include/linux/tty.h index 6abfcf5b5887..d96e5882f129 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -68,6 +68,16 @@ struct tty_buffer { | |||
68 | unsigned long data[0]; | 68 | unsigned long data[0]; |
69 | }; | 69 | }; |
70 | 70 | ||
71 | /* | ||
72 | * We default to dicing tty buffer allocations to this many characters | ||
73 | * in order to avoid multiple page allocations. We assume tty_buffer itself | ||
74 | * is under 256 bytes. See tty_buffer_find for the allocation logic this | ||
75 | * must match | ||
76 | */ | ||
77 | |||
78 | #define TTY_BUFFER_PAGE ((PAGE_SIZE - 256) / 2) | ||
79 | |||
80 | |||
71 | struct tty_bufhead { | 81 | struct tty_bufhead { |
72 | struct delayed_work work; | 82 | struct delayed_work work; |
73 | spinlock_t lock; | 83 | spinlock_t lock; |
diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h index eb677cf56106..9239d033a0a3 100644 --- a/include/linux/tty_flip.h +++ b/include/linux/tty_flip.h | |||
@@ -2,8 +2,8 @@ | |||
2 | #define _LINUX_TTY_FLIP_H | 2 | #define _LINUX_TTY_FLIP_H |
3 | 3 | ||
4 | extern int tty_buffer_request_room(struct tty_struct *tty, size_t size); | 4 | extern int tty_buffer_request_room(struct tty_struct *tty, size_t size); |
5 | extern int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars, size_t size); | ||
6 | extern int tty_insert_flip_string_flags(struct tty_struct *tty, const unsigned char *chars, const char *flags, size_t size); | 5 | extern int tty_insert_flip_string_flags(struct tty_struct *tty, const unsigned char *chars, const char *flags, size_t size); |
6 | extern int tty_insert_flip_string_fixed_flag(struct tty_struct *tty, const unsigned char *chars, char flag, size_t size); | ||
7 | extern int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size); | 7 | extern int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size); |
8 | extern int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size); | 8 | extern int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size); |
9 | void tty_schedule_flip(struct tty_struct *tty); | 9 | void tty_schedule_flip(struct tty_struct *tty); |
@@ -20,4 +20,9 @@ static inline int tty_insert_flip_char(struct tty_struct *tty, | |||
20 | return tty_insert_flip_string_flags(tty, &ch, &flag, 1); | 20 | return tty_insert_flip_string_flags(tty, &ch, &flag, 1); |
21 | } | 21 | } |
22 | 22 | ||
23 | static inline int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars, size_t size) | ||
24 | { | ||
25 | return tty_insert_flip_string_fixed_flag(tty, chars, TTY_NORMAL, size); | ||
26 | } | ||
27 | |||
23 | #endif /* _LINUX_TTY_FLIP_H */ | 28 | #endif /* _LINUX_TTY_FLIP_H */ |
diff --git a/include/linux/usb.h b/include/linux/usb.h index 332eaea61021..3492abf82e75 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -122,7 +122,6 @@ enum usb_interface_condition { | |||
122 | * number from the USB core by calling usb_register_dev(). | 122 | * number from the USB core by calling usb_register_dev(). |
123 | * @condition: binding state of the interface: not bound, binding | 123 | * @condition: binding state of the interface: not bound, binding |
124 | * (in probe()), bound to a driver, or unbinding (in disconnect()) | 124 | * (in probe()), bound to a driver, or unbinding (in disconnect()) |
125 | * @is_active: flag set when the interface is bound and not suspended. | ||
126 | * @sysfs_files_created: sysfs attributes exist | 125 | * @sysfs_files_created: sysfs attributes exist |
127 | * @ep_devs_created: endpoint child pseudo-devices exist | 126 | * @ep_devs_created: endpoint child pseudo-devices exist |
128 | * @unregistering: flag set when the interface is being unregistered | 127 | * @unregistering: flag set when the interface is being unregistered |
@@ -135,8 +134,7 @@ enum usb_interface_condition { | |||
135 | * @dev: driver model's view of this device | 134 | * @dev: driver model's view of this device |
136 | * @usb_dev: if an interface is bound to the USB major, this will point | 135 | * @usb_dev: if an interface is bound to the USB major, this will point |
137 | * to the sysfs representation for that device. | 136 | * to the sysfs representation for that device. |
138 | * @pm_usage_cnt: PM usage counter for this interface; autosuspend is not | 137 | * @pm_usage_cnt: PM usage counter for this interface |
139 | * allowed unless the counter is 0. | ||
140 | * @reset_ws: Used for scheduling resets from atomic context. | 138 | * @reset_ws: Used for scheduling resets from atomic context. |
141 | * @reset_running: set to 1 if the interface is currently running a | 139 | * @reset_running: set to 1 if the interface is currently running a |
142 | * queued reset so that usb_cancel_queued_reset() doesn't try to | 140 | * queued reset so that usb_cancel_queued_reset() doesn't try to |
@@ -184,7 +182,6 @@ struct usb_interface { | |||
184 | int minor; /* minor number this interface is | 182 | int minor; /* minor number this interface is |
185 | * bound to */ | 183 | * bound to */ |
186 | enum usb_interface_condition condition; /* state of binding */ | 184 | enum usb_interface_condition condition; /* state of binding */ |
187 | unsigned is_active:1; /* the interface is not suspended */ | ||
188 | unsigned sysfs_files_created:1; /* the sysfs attributes exist */ | 185 | unsigned sysfs_files_created:1; /* the sysfs attributes exist */ |
189 | unsigned ep_devs_created:1; /* endpoint "devices" exist */ | 186 | unsigned ep_devs_created:1; /* endpoint "devices" exist */ |
190 | unsigned unregistering:1; /* unregistration is in progress */ | 187 | unsigned unregistering:1; /* unregistration is in progress */ |
@@ -401,7 +398,6 @@ struct usb_tt; | |||
401 | * @portnum: parent port number (origin 1) | 398 | * @portnum: parent port number (origin 1) |
402 | * @level: number of USB hub ancestors | 399 | * @level: number of USB hub ancestors |
403 | * @can_submit: URBs may be submitted | 400 | * @can_submit: URBs may be submitted |
404 | * @discon_suspended: disconnected while suspended | ||
405 | * @persist_enabled: USB_PERSIST enabled for this device | 401 | * @persist_enabled: USB_PERSIST enabled for this device |
406 | * @have_langid: whether string_langid is valid | 402 | * @have_langid: whether string_langid is valid |
407 | * @authorized: policy has said we can use it; | 403 | * @authorized: policy has said we can use it; |
@@ -421,20 +417,15 @@ struct usb_tt; | |||
421 | * @usbfs_dentry: usbfs dentry entry for the device | 417 | * @usbfs_dentry: usbfs dentry entry for the device |
422 | * @maxchild: number of ports if hub | 418 | * @maxchild: number of ports if hub |
423 | * @children: child devices - USB devices that are attached to this hub | 419 | * @children: child devices - USB devices that are attached to this hub |
424 | * @pm_usage_cnt: usage counter for autosuspend | ||
425 | * @quirks: quirks of the whole device | 420 | * @quirks: quirks of the whole device |
426 | * @urbnum: number of URBs submitted for the whole device | 421 | * @urbnum: number of URBs submitted for the whole device |
427 | * @active_duration: total time device is not suspended | 422 | * @active_duration: total time device is not suspended |
428 | * @autosuspend: for delayed autosuspends | ||
429 | * @autoresume: for autoresumes requested while in_interrupt | ||
430 | * @pm_mutex: protects PM operations | ||
431 | * @last_busy: time of last use | 423 | * @last_busy: time of last use |
432 | * @autosuspend_delay: in jiffies | 424 | * @autosuspend_delay: in jiffies |
433 | * @connect_time: time device was first connected | 425 | * @connect_time: time device was first connected |
434 | * @do_remote_wakeup: remote wakeup should be enabled | 426 | * @do_remote_wakeup: remote wakeup should be enabled |
435 | * @reset_resume: needs reset instead of resume | 427 | * @reset_resume: needs reset instead of resume |
436 | * @autosuspend_disabled: autosuspend disabled by the user | 428 | * @autosuspend_disabled: autosuspend disabled by the user |
437 | * @skip_sys_resume: skip the next system resume | ||
438 | * @wusb_dev: if this is a Wireless USB device, link to the WUSB | 429 | * @wusb_dev: if this is a Wireless USB device, link to the WUSB |
439 | * specific data for the device. | 430 | * specific data for the device. |
440 | * @slot_id: Slot ID assigned by xHCI | 431 | * @slot_id: Slot ID assigned by xHCI |
@@ -475,7 +466,6 @@ struct usb_device { | |||
475 | u8 level; | 466 | u8 level; |
476 | 467 | ||
477 | unsigned can_submit:1; | 468 | unsigned can_submit:1; |
478 | unsigned discon_suspended:1; | ||
479 | unsigned persist_enabled:1; | 469 | unsigned persist_enabled:1; |
480 | unsigned have_langid:1; | 470 | unsigned have_langid:1; |
481 | unsigned authorized:1; | 471 | unsigned authorized:1; |
@@ -499,17 +489,12 @@ struct usb_device { | |||
499 | int maxchild; | 489 | int maxchild; |
500 | struct usb_device *children[USB_MAXCHILDREN]; | 490 | struct usb_device *children[USB_MAXCHILDREN]; |
501 | 491 | ||
502 | int pm_usage_cnt; | ||
503 | u32 quirks; | 492 | u32 quirks; |
504 | atomic_t urbnum; | 493 | atomic_t urbnum; |
505 | 494 | ||
506 | unsigned long active_duration; | 495 | unsigned long active_duration; |
507 | 496 | ||
508 | #ifdef CONFIG_PM | 497 | #ifdef CONFIG_PM |
509 | struct delayed_work autosuspend; | ||
510 | struct work_struct autoresume; | ||
511 | struct mutex pm_mutex; | ||
512 | |||
513 | unsigned long last_busy; | 498 | unsigned long last_busy; |
514 | int autosuspend_delay; | 499 | int autosuspend_delay; |
515 | unsigned long connect_time; | 500 | unsigned long connect_time; |
@@ -517,7 +502,6 @@ struct usb_device { | |||
517 | unsigned do_remote_wakeup:1; | 502 | unsigned do_remote_wakeup:1; |
518 | unsigned reset_resume:1; | 503 | unsigned reset_resume:1; |
519 | unsigned autosuspend_disabled:1; | 504 | unsigned autosuspend_disabled:1; |
520 | unsigned skip_sys_resume:1; | ||
521 | #endif | 505 | #endif |
522 | struct wusb_dev *wusb_dev; | 506 | struct wusb_dev *wusb_dev; |
523 | int slot_id; | 507 | int slot_id; |
@@ -542,21 +526,15 @@ extern struct usb_device *usb_find_device(u16 vendor_id, u16 product_id); | |||
542 | 526 | ||
543 | /* USB autosuspend and autoresume */ | 527 | /* USB autosuspend and autoresume */ |
544 | #ifdef CONFIG_USB_SUSPEND | 528 | #ifdef CONFIG_USB_SUSPEND |
529 | extern int usb_enable_autosuspend(struct usb_device *udev); | ||
530 | extern int usb_disable_autosuspend(struct usb_device *udev); | ||
531 | |||
545 | extern int usb_autopm_get_interface(struct usb_interface *intf); | 532 | extern int usb_autopm_get_interface(struct usb_interface *intf); |
546 | extern void usb_autopm_put_interface(struct usb_interface *intf); | 533 | extern void usb_autopm_put_interface(struct usb_interface *intf); |
547 | extern int usb_autopm_get_interface_async(struct usb_interface *intf); | 534 | extern int usb_autopm_get_interface_async(struct usb_interface *intf); |
548 | extern void usb_autopm_put_interface_async(struct usb_interface *intf); | 535 | extern void usb_autopm_put_interface_async(struct usb_interface *intf); |
549 | 536 | extern void usb_autopm_get_interface_no_resume(struct usb_interface *intf); | |
550 | static inline void usb_autopm_get_interface_no_resume( | 537 | extern void usb_autopm_put_interface_no_suspend(struct usb_interface *intf); |
551 | struct usb_interface *intf) | ||
552 | { | ||
553 | atomic_inc(&intf->pm_usage_cnt); | ||
554 | } | ||
555 | static inline void usb_autopm_put_interface_no_suspend( | ||
556 | struct usb_interface *intf) | ||
557 | { | ||
558 | atomic_dec(&intf->pm_usage_cnt); | ||
559 | } | ||
560 | 538 | ||
561 | static inline void usb_mark_last_busy(struct usb_device *udev) | 539 | static inline void usb_mark_last_busy(struct usb_device *udev) |
562 | { | 540 | { |
@@ -565,6 +543,11 @@ static inline void usb_mark_last_busy(struct usb_device *udev) | |||
565 | 543 | ||
566 | #else | 544 | #else |
567 | 545 | ||
546 | static inline int usb_enable_autosuspend(struct usb_device *udev) | ||
547 | { return 0; } | ||
548 | static inline int usb_disable_autosuspend(struct usb_device *udev) | ||
549 | { return 0; } | ||
550 | |||
568 | static inline int usb_autopm_get_interface(struct usb_interface *intf) | 551 | static inline int usb_autopm_get_interface(struct usb_interface *intf) |
569 | { return 0; } | 552 | { return 0; } |
570 | static inline int usb_autopm_get_interface_async(struct usb_interface *intf) | 553 | static inline int usb_autopm_get_interface_async(struct usb_interface *intf) |
@@ -1583,14 +1566,18 @@ extern void usb_register_notify(struct notifier_block *nb); | |||
1583 | extern void usb_unregister_notify(struct notifier_block *nb); | 1566 | extern void usb_unregister_notify(struct notifier_block *nb); |
1584 | 1567 | ||
1585 | #ifdef DEBUG | 1568 | #ifdef DEBUG |
1586 | #define dbg(format, arg...) printk(KERN_DEBUG "%s: " format "\n" , \ | 1569 | #define dbg(format, arg...) \ |
1587 | __FILE__ , ## arg) | 1570 | printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg) |
1588 | #else | 1571 | #else |
1589 | #define dbg(format, arg...) do {} while (0) | 1572 | #define dbg(format, arg...) \ |
1573 | do { \ | ||
1574 | if (0) \ | ||
1575 | printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \ | ||
1576 | } while (0) | ||
1590 | #endif | 1577 | #endif |
1591 | 1578 | ||
1592 | #define err(format, arg...) printk(KERN_ERR KBUILD_MODNAME ": " \ | 1579 | #define err(format, arg...) \ |
1593 | format "\n" , ## arg) | 1580 | printk(KERN_ERR KBUILD_MODNAME ": " format "\n", ##arg) |
1594 | 1581 | ||
1595 | /* debugfs stuff */ | 1582 | /* debugfs stuff */ |
1596 | extern struct dentry *usb_debug_root; | 1583 | extern struct dentry *usb_debug_root; |
diff --git a/include/linux/usb/Kbuild b/include/linux/usb/Kbuild index 54c446309a2a..29fd73b0bffc 100644 --- a/include/linux/usb/Kbuild +++ b/include/linux/usb/Kbuild | |||
@@ -5,4 +5,3 @@ header-y += gadgetfs.h | |||
5 | header-y += midi.h | 5 | header-y += midi.h |
6 | header-y += g_printer.h | 6 | header-y += g_printer.h |
7 | header-y += tmc.h | 7 | header-y += tmc.h |
8 | header-y += vstusb.h | ||
diff --git a/include/linux/usb/atmel_usba_udc.h b/include/linux/usb/atmel_usba_udc.h index 6311fa2d9f82..baf41c8616e9 100644 --- a/include/linux/usb/atmel_usba_udc.h +++ b/include/linux/usb/atmel_usba_udc.h | |||
@@ -15,6 +15,7 @@ struct usba_ep_data { | |||
15 | 15 | ||
16 | struct usba_platform_data { | 16 | struct usba_platform_data { |
17 | int vbus_pin; | 17 | int vbus_pin; |
18 | int vbus_pin_inverted; | ||
18 | int num_ep; | 19 | int num_ep; |
19 | struct usba_ep_data ep[0]; | 20 | struct usba_ep_data ep[0]; |
20 | }; | 21 | }; |
diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index 94012e649d86..e58369ff8168 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h | |||
@@ -775,7 +775,7 @@ enum usb_device_speed { | |||
775 | USB_SPEED_UNKNOWN = 0, /* enumerating */ | 775 | USB_SPEED_UNKNOWN = 0, /* enumerating */ |
776 | USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */ | 776 | USB_SPEED_LOW, USB_SPEED_FULL, /* usb 1.1 */ |
777 | USB_SPEED_HIGH, /* usb 2.0 */ | 777 | USB_SPEED_HIGH, /* usb 2.0 */ |
778 | USB_SPEED_VARIABLE, /* wireless (usb 2.5) */ | 778 | USB_SPEED_WIRELESS, /* wireless (usb 2.5) */ |
779 | USB_SPEED_SUPER, /* usb 3.0 */ | 779 | USB_SPEED_SUPER, /* usb 3.0 */ |
780 | }; | 780 | }; |
781 | 781 | ||
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h index 5dc2f227a0f1..7acef0234c0e 100644 --- a/include/linux/usb/musb.h +++ b/include/linux/usb/musb.h | |||
@@ -30,26 +30,26 @@ struct musb_hdrc_eps_bits { | |||
30 | struct musb_hdrc_config { | 30 | struct musb_hdrc_config { |
31 | /* MUSB configuration-specific details */ | 31 | /* MUSB configuration-specific details */ |
32 | unsigned multipoint:1; /* multipoint device */ | 32 | unsigned multipoint:1; /* multipoint device */ |
33 | unsigned dyn_fifo:1; /* supports dynamic fifo sizing */ | 33 | unsigned dyn_fifo:1 __deprecated; /* supports dynamic fifo sizing */ |
34 | unsigned soft_con:1; /* soft connect required */ | 34 | unsigned soft_con:1 __deprecated; /* soft connect required */ |
35 | unsigned utm_16:1; /* utm data witdh is 16 bits */ | 35 | unsigned utm_16:1 __deprecated; /* utm data witdh is 16 bits */ |
36 | unsigned big_endian:1; /* true if CPU uses big-endian */ | 36 | unsigned big_endian:1; /* true if CPU uses big-endian */ |
37 | unsigned mult_bulk_tx:1; /* Tx ep required for multbulk pkts */ | 37 | unsigned mult_bulk_tx:1; /* Tx ep required for multbulk pkts */ |
38 | unsigned mult_bulk_rx:1; /* Rx ep required for multbulk pkts */ | 38 | unsigned mult_bulk_rx:1; /* Rx ep required for multbulk pkts */ |
39 | unsigned high_iso_tx:1; /* Tx ep required for HB iso */ | 39 | unsigned high_iso_tx:1; /* Tx ep required for HB iso */ |
40 | unsigned high_iso_rx:1; /* Rx ep required for HD iso */ | 40 | unsigned high_iso_rx:1; /* Rx ep required for HD iso */ |
41 | unsigned dma:1; /* supports DMA */ | 41 | unsigned dma:1 __deprecated; /* supports DMA */ |
42 | unsigned vendor_req:1; /* vendor registers required */ | 42 | unsigned vendor_req:1 __deprecated; /* vendor registers required */ |
43 | 43 | ||
44 | u8 num_eps; /* number of endpoints _with_ ep0 */ | 44 | u8 num_eps; /* number of endpoints _with_ ep0 */ |
45 | u8 dma_channels; /* number of dma channels */ | 45 | u8 dma_channels __deprecated; /* number of dma channels */ |
46 | u8 dyn_fifo_size; /* dynamic size in bytes */ | 46 | u8 dyn_fifo_size; /* dynamic size in bytes */ |
47 | u8 vendor_ctrl; /* vendor control reg width */ | 47 | u8 vendor_ctrl __deprecated; /* vendor control reg width */ |
48 | u8 vendor_stat; /* vendor status reg witdh */ | 48 | u8 vendor_stat __deprecated; /* vendor status reg witdh */ |
49 | u8 dma_req_chan; /* bitmask for required dma channels */ | 49 | u8 dma_req_chan __deprecated; /* bitmask for required dma channels */ |
50 | u8 ram_bits; /* ram address size */ | 50 | u8 ram_bits; /* ram address size */ |
51 | 51 | ||
52 | struct musb_hdrc_eps_bits *eps_bits; | 52 | struct musb_hdrc_eps_bits *eps_bits __deprecated; |
53 | #ifdef CONFIG_BLACKFIN | 53 | #ifdef CONFIG_BLACKFIN |
54 | /* A GPIO controlling VRSEL in Blackfin */ | 54 | /* A GPIO controlling VRSEL in Blackfin */ |
55 | unsigned int gpio_vrsel; | 55 | unsigned int gpio_vrsel; |
@@ -76,6 +76,9 @@ struct musb_hdrc_platform_data { | |||
76 | /* (HOST or OTG) msec/2 after VBUS on till power good */ | 76 | /* (HOST or OTG) msec/2 after VBUS on till power good */ |
77 | u8 potpgt; | 77 | u8 potpgt; |
78 | 78 | ||
79 | /* (HOST or OTG) program PHY for external Vbus */ | ||
80 | unsigned extvbus:1; | ||
81 | |||
79 | /* Power the device on or off */ | 82 | /* Power the device on or off */ |
80 | int (*set_power)(int state); | 83 | int (*set_power)(int state); |
81 | 84 | ||
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h index fef0972c8146..f8302d036a76 100644 --- a/include/linux/usb/otg.h +++ b/include/linux/usb/otg.h | |||
@@ -9,6 +9,8 @@ | |||
9 | #ifndef __LINUX_USB_OTG_H | 9 | #ifndef __LINUX_USB_OTG_H |
10 | #define __LINUX_USB_OTG_H | 10 | #define __LINUX_USB_OTG_H |
11 | 11 | ||
12 | #include <linux/notifier.h> | ||
13 | |||
12 | /* OTG defines lots of enumeration states before device reset */ | 14 | /* OTG defines lots of enumeration states before device reset */ |
13 | enum usb_otg_state { | 15 | enum usb_otg_state { |
14 | OTG_STATE_UNDEFINED = 0, | 16 | OTG_STATE_UNDEFINED = 0, |
@@ -33,6 +35,14 @@ enum usb_otg_state { | |||
33 | OTG_STATE_A_VBUS_ERR, | 35 | OTG_STATE_A_VBUS_ERR, |
34 | }; | 36 | }; |
35 | 37 | ||
38 | enum usb_xceiv_events { | ||
39 | USB_EVENT_NONE, /* no events or cable disconnected */ | ||
40 | USB_EVENT_VBUS, /* vbus valid event */ | ||
41 | USB_EVENT_ID, /* id was grounded */ | ||
42 | USB_EVENT_CHARGER, /* usb dedicated charger */ | ||
43 | USB_EVENT_ENUMERATED, /* gadget driver enumerated */ | ||
44 | }; | ||
45 | |||
36 | #define USB_OTG_PULLUP_ID (1 << 0) | 46 | #define USB_OTG_PULLUP_ID (1 << 0) |
37 | #define USB_OTG_PULLDOWN_DP (1 << 1) | 47 | #define USB_OTG_PULLDOWN_DP (1 << 1) |
38 | #define USB_OTG_PULLDOWN_DM (1 << 2) | 48 | #define USB_OTG_PULLDOWN_DM (1 << 2) |
@@ -70,6 +80,9 @@ struct otg_transceiver { | |||
70 | struct otg_io_access_ops *io_ops; | 80 | struct otg_io_access_ops *io_ops; |
71 | void __iomem *io_priv; | 81 | void __iomem *io_priv; |
72 | 82 | ||
83 | /* for notification of usb_xceiv_events */ | ||
84 | struct blocking_notifier_head notifier; | ||
85 | |||
73 | /* to pass extra port status to the root hub */ | 86 | /* to pass extra port status to the root hub */ |
74 | u16 port_status; | 87 | u16 port_status; |
75 | u16 port_change; | 88 | u16 port_change; |
@@ -213,6 +226,18 @@ otg_start_srp(struct otg_transceiver *otg) | |||
213 | return otg->start_srp(otg); | 226 | return otg->start_srp(otg); |
214 | } | 227 | } |
215 | 228 | ||
229 | /* notifiers */ | ||
230 | static inline int | ||
231 | otg_register_notifier(struct otg_transceiver *otg, struct notifier_block *nb) | ||
232 | { | ||
233 | return blocking_notifier_chain_register(&otg->notifier, nb); | ||
234 | } | ||
235 | |||
236 | static inline void | ||
237 | otg_unregister_notifier(struct otg_transceiver *otg, struct notifier_block *nb) | ||
238 | { | ||
239 | blocking_notifier_chain_unregister(&otg->notifier, nb); | ||
240 | } | ||
216 | 241 | ||
217 | /* for OTG controller drivers (and maybe other stuff) */ | 242 | /* for OTG controller drivers (and maybe other stuff) */ |
218 | extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num); | 243 | extern int usb_bus_start_enum(struct usb_bus *bus, unsigned port_num); |
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h index 2526f3bbd273..0a555dd131fc 100644 --- a/include/linux/usb/quirks.h +++ b/include/linux/usb/quirks.h | |||
@@ -19,4 +19,7 @@ | |||
19 | /* device can't handle its Configuration or Interface strings */ | 19 | /* device can't handle its Configuration or Interface strings */ |
20 | #define USB_QUIRK_CONFIG_INTF_STRINGS 0x00000008 | 20 | #define USB_QUIRK_CONFIG_INTF_STRINGS 0x00000008 |
21 | 21 | ||
22 | /*device will morph if reset, don't use reset for handling errors */ | ||
23 | #define USB_QUIRK_RESET_MORPHS 0x00000010 | ||
24 | |||
22 | #endif /* __LINUX_USB_QUIRKS_H */ | 25 | #endif /* __LINUX_USB_QUIRKS_H */ |
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 1819396ed501..0a458b861933 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
@@ -351,14 +351,11 @@ static inline void usb_serial_debug_data(int debug, | |||
351 | 351 | ||
352 | /* Use our own dbg macro */ | 352 | /* Use our own dbg macro */ |
353 | #undef dbg | 353 | #undef dbg |
354 | #define dbg(format, arg...) \ | 354 | #define dbg(format, arg...) \ |
355 | do { \ | 355 | do { \ |
356 | if (debug) \ | 356 | if (debug) \ |
357 | printk(KERN_DEBUG "%s: " format "\n" , __FILE__ , \ | 357 | printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \ |
358 | ## arg); \ | 358 | } while (0) |
359 | } while (0) | ||
360 | |||
361 | |||
362 | 359 | ||
363 | #endif /* __LINUX_USB_SERIAL_H */ | 360 | #endif /* __LINUX_USB_SERIAL_H */ |
364 | 361 | ||
diff --git a/include/linux/usb/vstusb.h b/include/linux/usb/vstusb.h deleted file mode 100644 index 1cfac67191ff..000000000000 --- a/include/linux/usb/vstusb.h +++ /dev/null | |||
@@ -1,71 +0,0 @@ | |||
1 | /***************************************************************************** | ||
2 | * File: drivers/usb/misc/vstusb.h | ||
3 | * | ||
4 | * Purpose: Support for the bulk USB Vernier Spectrophotometers | ||
5 | * | ||
6 | * Author: EQware Engineering, Inc. | ||
7 | * Oregon City, OR, USA 97045 | ||
8 | * | ||
9 | * Copyright: 2007, 2008 | ||
10 | * Vernier Software & Technology | ||
11 | * Beaverton, OR, USA 97005 | ||
12 | * | ||
13 | * Web: www.vernier.com | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or modify | ||
16 | * it under the terms of the GNU General Public License version 2 as | ||
17 | * published by the Free Software Foundation. | ||
18 | * | ||
19 | *****************************************************************************/ | ||
20 | /***************************************************************************** | ||
21 | * | ||
22 | * The vstusb module is a standard usb 'client' driver running on top of the | ||
23 | * standard usb host controller stack. | ||
24 | * | ||
25 | * In general, vstusb supports standard bulk usb pipes. It supports multiple | ||
26 | * devices and multiple pipes per device. | ||
27 | * | ||
28 | * The vstusb driver supports two interfaces: | ||
29 | * 1 - ioctl SEND_PIPE/RECV_PIPE - a general bulk write/read msg | ||
30 | * interface to any pipe with timeout support; | ||
31 | * 2 - standard read/write with ioctl config - offers standard read/write | ||
32 | * interface with ioctl configured pipes and timeouts. | ||
33 | * | ||
34 | * Both interfaces can be signal from other process and will abort its i/o | ||
35 | * operation. | ||
36 | * | ||
37 | * A timeout of 0 means NO timeout. The user can still terminate the read via | ||
38 | * signal. | ||
39 | * | ||
40 | * If using multiple threads with this driver, the user should ensure that | ||
41 | * any reads, writes, or ioctls are complete before closing the device. | ||
42 | * Changing read/write timeouts or pipes takes effect on next read/write. | ||
43 | * | ||
44 | *****************************************************************************/ | ||
45 | |||
46 | struct vstusb_args { | ||
47 | union { | ||
48 | /* this struct is used for IOCTL_VSTUSB_SEND_PIPE, * | ||
49 | * IOCTL_VSTUSB_RECV_PIPE, and read()/write() fops */ | ||
50 | struct { | ||
51 | void __user *buffer; | ||
52 | size_t count; | ||
53 | unsigned int timeout_ms; | ||
54 | int pipe; | ||
55 | }; | ||
56 | |||
57 | /* this one is used for IOCTL_VSTUSB_CONFIG_RW */ | ||
58 | struct { | ||
59 | int rd_pipe; | ||
60 | int rd_timeout_ms; | ||
61 | int wr_pipe; | ||
62 | int wr_timeout_ms; | ||
63 | }; | ||
64 | }; | ||
65 | }; | ||
66 | |||
67 | #define VST_IOC_MAGIC 'L' | ||
68 | #define VST_IOC_FIRST 0x20 | ||
69 | #define IOCTL_VSTUSB_SEND_PIPE _IO(VST_IOC_MAGIC, VST_IOC_FIRST) | ||
70 | #define IOCTL_VSTUSB_RECV_PIPE _IO(VST_IOC_MAGIC, VST_IOC_FIRST + 1) | ||
71 | #define IOCTL_VSTUSB_CONFIG_RW _IO(VST_IOC_MAGIC, VST_IOC_FIRST + 2) | ||
diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h new file mode 100644 index 000000000000..ae9ab13b963d --- /dev/null +++ b/include/linux/vga_switcheroo.h | |||
@@ -0,0 +1,57 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2010 Red Hat Inc. | ||
3 | * Author : Dave Airlie <airlied@redhat.com> | ||
4 | * | ||
5 | * Licensed under GPLv2 | ||
6 | * | ||
7 | * vga_switcheroo.h - Support for laptop with dual GPU using one set of outputs | ||
8 | */ | ||
9 | |||
10 | #include <linux/fb.h> | ||
11 | |||
12 | enum vga_switcheroo_state { | ||
13 | VGA_SWITCHEROO_OFF, | ||
14 | VGA_SWITCHEROO_ON, | ||
15 | }; | ||
16 | |||
17 | enum vga_switcheroo_client_id { | ||
18 | VGA_SWITCHEROO_IGD, | ||
19 | VGA_SWITCHEROO_DIS, | ||
20 | VGA_SWITCHEROO_MAX_CLIENTS, | ||
21 | }; | ||
22 | |||
23 | struct vga_switcheroo_handler { | ||
24 | int (*switchto)(enum vga_switcheroo_client_id id); | ||
25 | int (*power_state)(enum vga_switcheroo_client_id id, | ||
26 | enum vga_switcheroo_state state); | ||
27 | int (*init)(void); | ||
28 | int (*get_client_id)(struct pci_dev *pdev); | ||
29 | }; | ||
30 | |||
31 | |||
32 | #if defined(CONFIG_VGA_SWITCHEROO) | ||
33 | void vga_switcheroo_unregister_client(struct pci_dev *dev); | ||
34 | int vga_switcheroo_register_client(struct pci_dev *dev, | ||
35 | void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state), | ||
36 | bool (*can_switch)(struct pci_dev *dev)); | ||
37 | |||
38 | void vga_switcheroo_client_fb_set(struct pci_dev *dev, | ||
39 | struct fb_info *info); | ||
40 | |||
41 | int vga_switcheroo_register_handler(struct vga_switcheroo_handler *handler); | ||
42 | void vga_switcheroo_unregister_handler(void); | ||
43 | |||
44 | int vga_switcheroo_process_delayed_switch(void); | ||
45 | |||
46 | #else | ||
47 | |||
48 | static inline void vga_switcheroo_unregister_client(struct pci_dev *dev) {} | ||
49 | static inline int vga_switcheroo_register_client(struct pci_dev *dev, | ||
50 | void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state), | ||
51 | bool (*can_switch)(struct pci_dev *dev)) { return 0; } | ||
52 | static inline void vga_switcheroo_client_fb_set(struct pci_dev *dev, struct fb_info *info) {} | ||
53 | static inline int vga_switcheroo_register_handler(struct vga_switcheroo_handler *handler) { return 0; } | ||
54 | static inline void vga_switcheroo_unregister_handler(void) {} | ||
55 | static inline int vga_switcheroo_process_delayed_switch(void) { return 0; } | ||
56 | |||
57 | #endif | ||
diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index ee03bba9c5df..117f0dd8ad03 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h | |||
@@ -78,22 +78,22 @@ DECLARE_PER_CPU(struct vm_event_state, vm_event_states); | |||
78 | 78 | ||
79 | static inline void __count_vm_event(enum vm_event_item item) | 79 | static inline void __count_vm_event(enum vm_event_item item) |
80 | { | 80 | { |
81 | __this_cpu_inc(per_cpu_var(vm_event_states).event[item]); | 81 | __this_cpu_inc(vm_event_states.event[item]); |
82 | } | 82 | } |
83 | 83 | ||
84 | static inline void count_vm_event(enum vm_event_item item) | 84 | static inline void count_vm_event(enum vm_event_item item) |
85 | { | 85 | { |
86 | this_cpu_inc(per_cpu_var(vm_event_states).event[item]); | 86 | this_cpu_inc(vm_event_states.event[item]); |
87 | } | 87 | } |
88 | 88 | ||
89 | static inline void __count_vm_events(enum vm_event_item item, long delta) | 89 | static inline void __count_vm_events(enum vm_event_item item, long delta) |
90 | { | 90 | { |
91 | __this_cpu_add(per_cpu_var(vm_event_states).event[item], delta); | 91 | __this_cpu_add(vm_event_states.event[item], delta); |
92 | } | 92 | } |
93 | 93 | ||
94 | static inline void count_vm_events(enum vm_event_item item, long delta) | 94 | static inline void count_vm_events(enum vm_event_item item, long delta) |
95 | { | 95 | { |
96 | this_cpu_add(per_cpu_var(vm_event_states).event[item], delta); | 96 | this_cpu_add(vm_event_states.event[item], delta); |
97 | } | 97 | } |
98 | 98 | ||
99 | extern void all_vm_events(unsigned long *); | 99 | extern void all_vm_events(unsigned long *); |
diff --git a/include/linux/vt.h b/include/linux/vt.h index d5dd0bc408fd..778b7b2a47d4 100644 --- a/include/linux/vt.h +++ b/include/linux/vt.h | |||
@@ -27,7 +27,7 @@ struct vt_mode { | |||
27 | #define VT_SETMODE 0x5602 /* set mode of active vt */ | 27 | #define VT_SETMODE 0x5602 /* set mode of active vt */ |
28 | #define VT_AUTO 0x00 /* auto vt switching */ | 28 | #define VT_AUTO 0x00 /* auto vt switching */ |
29 | #define VT_PROCESS 0x01 /* process controls switching */ | 29 | #define VT_PROCESS 0x01 /* process controls switching */ |
30 | #define VT_ACKACQ 0x02 /* acknowledge switch */ | 30 | #define VT_PROCESS_AUTO 0x02 /* process is notified of switching */ |
31 | 31 | ||
32 | struct vt_stat { | 32 | struct vt_stat { |
33 | unsigned short v_active; /* active vt */ | 33 | unsigned short v_active; /* active vt */ |
@@ -38,6 +38,7 @@ struct vt_stat { | |||
38 | #define VT_SENDSIG 0x5604 /* signal to send to bitmask of vts */ | 38 | #define VT_SENDSIG 0x5604 /* signal to send to bitmask of vts */ |
39 | 39 | ||
40 | #define VT_RELDISP 0x5605 /* release display */ | 40 | #define VT_RELDISP 0x5605 /* release display */ |
41 | #define VT_ACKACQ 0x02 /* acknowledge switch */ | ||
41 | 42 | ||
42 | #define VT_ACTIVATE 0x5606 /* make vt active */ | 43 | #define VT_ACTIVATE 0x5606 /* make vt active */ |
43 | #define VT_WAITACTIVE 0x5607 /* wait for vt active */ | 44 | #define VT_WAITACTIVE 0x5607 /* wait for vt active */ |