diff options
Diffstat (limited to 'include')
73 files changed, 2614 insertions, 942 deletions
diff --git a/include/asm-generic/dma-mapping-broken.h b/include/asm-generic/dma-mapping-broken.h index 82cd0cb1c3fe..ccf7b4f34a3c 100644 --- a/include/asm-generic/dma-mapping-broken.h +++ b/include/asm-generic/dma-mapping-broken.h | |||
@@ -72,9 +72,6 @@ dma_set_mask(struct device *dev, u64 mask); | |||
72 | extern int | 72 | extern int |
73 | dma_get_cache_alignment(void); | 73 | dma_get_cache_alignment(void); |
74 | 74 | ||
75 | extern int | ||
76 | dma_is_consistent(struct device *dev, dma_addr_t dma_handle); | ||
77 | |||
78 | extern void | 75 | extern void |
79 | dma_cache_sync(struct device *dev, void *vaddr, size_t size, | 76 | dma_cache_sync(struct device *dev, void *vaddr, size_t size, |
80 | enum dma_data_direction direction); | 77 | enum dma_data_direction direction); |
diff --git a/include/asm-generic/fcntl.h b/include/asm-generic/fcntl.h index e3cbc38bdcc2..a70b2d2bfc14 100644 --- a/include/asm-generic/fcntl.h +++ b/include/asm-generic/fcntl.h | |||
@@ -11,6 +11,10 @@ | |||
11 | * -Eric Paris | 11 | * -Eric Paris |
12 | */ | 12 | */ |
13 | 13 | ||
14 | /* | ||
15 | * When introducing new O_* bits, please check its uniqueness in fcntl_init(). | ||
16 | */ | ||
17 | |||
14 | #define O_ACCMODE 00000003 | 18 | #define O_ACCMODE 00000003 |
15 | #define O_RDONLY 00000000 | 19 | #define O_RDONLY 00000000 |
16 | #define O_WRONLY 00000001 | 20 | #define O_WRONLY 00000001 |
diff --git a/include/asm-generic/ioctls.h b/include/asm-generic/ioctls.h index a799e20a769e..8554cb6a81b9 100644 --- a/include/asm-generic/ioctls.h +++ b/include/asm-generic/ioctls.h | |||
@@ -69,6 +69,7 @@ | |||
69 | #define TCSETX 0x5433 | 69 | #define TCSETX 0x5433 |
70 | #define TCSETXF 0x5434 | 70 | #define TCSETXF 0x5434 |
71 | #define TCSETXW 0x5435 | 71 | #define TCSETXW 0x5435 |
72 | #define TIOCSIG _IOW('T', 0x36, int) /* pty: generate signal */ | ||
72 | 73 | ||
73 | #define FIONCLEX 0x5450 | 74 | #define FIONCLEX 0x5450 |
74 | #define FIOCLEX 0x5451 | 75 | #define FIOCLEX 0x5451 |
@@ -87,12 +88,10 @@ | |||
87 | #define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ | 88 | #define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ |
88 | 89 | ||
89 | /* | 90 | /* |
90 | * some architectures define FIOQSIZE as 0x545E, which is used for | 91 | * Some arches already define FIOQSIZE due to a historical |
91 | * TIOCGHAYESESP on others | 92 | * conflict with a Hayes modem-specific ioctl value. |
92 | */ | 93 | */ |
93 | #ifndef FIOQSIZE | 94 | #ifndef FIOQSIZE |
94 | # define TIOCGHAYESESP 0x545E /* Get Hayes ESP configuration */ | ||
95 | # define TIOCSHAYESESP 0x545F /* Set Hayes ESP configuration */ | ||
96 | # define FIOQSIZE 0x5460 | 95 | # define FIOQSIZE 0x5460 |
97 | #endif | 96 | #endif |
98 | 97 | ||
@@ -104,6 +103,7 @@ | |||
104 | #define TIOCPKT_START 8 | 103 | #define TIOCPKT_START 8 |
105 | #define TIOCPKT_NOSTOP 16 | 104 | #define TIOCPKT_NOSTOP 16 |
106 | #define TIOCPKT_DOSTOP 32 | 105 | #define TIOCPKT_DOSTOP 32 |
106 | #define TIOCPKT_IOCTL 64 | ||
107 | 107 | ||
108 | #define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ | 108 | #define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ |
109 | 109 | ||
diff --git a/include/asm-generic/termbits.h b/include/asm-generic/termbits.h index 1c9773d48cb0..232b4781aef3 100644 --- a/include/asm-generic/termbits.h +++ b/include/asm-generic/termbits.h | |||
@@ -178,6 +178,7 @@ struct ktermios { | |||
178 | #define FLUSHO 0010000 | 178 | #define FLUSHO 0010000 |
179 | #define PENDIN 0040000 | 179 | #define PENDIN 0040000 |
180 | #define IEXTEN 0100000 | 180 | #define IEXTEN 0100000 |
181 | #define EXTPROC 0200000 | ||
181 | 182 | ||
182 | /* tcflow() and TCXONC use these */ | 183 | /* tcflow() and TCXONC use these */ |
183 | #define TCOOFF 0 | 184 | #define TCOOFF 0 |
diff --git a/include/linux/Kbuild b/include/linux/Kbuild index 2547daf2aef2..9d65d4d0bd9c 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild | |||
@@ -39,6 +39,7 @@ header-y += ax25.h | |||
39 | header-y += b1lli.h | 39 | header-y += b1lli.h |
40 | header-y += baycom.h | 40 | header-y += baycom.h |
41 | header-y += bfs_fs.h | 41 | header-y += bfs_fs.h |
42 | header-y += blk_types.h | ||
42 | header-y += blkpg.h | 43 | header-y += blkpg.h |
43 | header-y += bpqether.h | 44 | header-y += bpqether.h |
44 | header-y += bsg.h | 45 | header-y += bsg.h |
diff --git a/include/linux/audit.h b/include/linux/audit.h index f391d45c8aea..e24afabc548f 100644 --- a/include/linux/audit.h +++ b/include/linux/audit.h | |||
@@ -544,7 +544,7 @@ extern int audit_signals; | |||
544 | #define audit_putname(n) do { ; } while (0) | 544 | #define audit_putname(n) do { ; } while (0) |
545 | #define __audit_inode(n,d) do { ; } while (0) | 545 | #define __audit_inode(n,d) do { ; } while (0) |
546 | #define __audit_inode_child(i,p) do { ; } while (0) | 546 | #define __audit_inode_child(i,p) do { ; } while (0) |
547 | #define audit_inode(n,d) do { ; } while (0) | 547 | #define audit_inode(n,d) do { (void)(d); } while (0) |
548 | #define audit_inode_child(i,p) do { ; } while (0) | 548 | #define audit_inode_child(i,p) do { ; } while (0) |
549 | #define audit_core_dumps(i) do { ; } while (0) | 549 | #define audit_core_dumps(i) do { ; } while (0) |
550 | #define auditsc_get_stamp(c,t,s) (0) | 550 | #define auditsc_get_stamp(c,t,s) (0) |
diff --git a/include/linux/auto_fs.h b/include/linux/auto_fs.h index 7b09c8348fd3..da64e15004b6 100644 --- a/include/linux/auto_fs.h +++ b/include/linux/auto_fs.h | |||
@@ -79,6 +79,7 @@ struct autofs_packet_expire { | |||
79 | #define AUTOFS_IOC_FAIL _IO(0x93,0x61) | 79 | #define AUTOFS_IOC_FAIL _IO(0x93,0x61) |
80 | #define AUTOFS_IOC_CATATONIC _IO(0x93,0x62) | 80 | #define AUTOFS_IOC_CATATONIC _IO(0x93,0x62) |
81 | #define AUTOFS_IOC_PROTOVER _IOR(0x93,0x63,int) | 81 | #define AUTOFS_IOC_PROTOVER _IOR(0x93,0x63,int) |
82 | #define AUTOFS_IOC_SETTIMEOUT32 _IOWR(0x93,0x64,compat_ulong_t) | ||
82 | #define AUTOFS_IOC_SETTIMEOUT _IOWR(0x93,0x64,unsigned long) | 83 | #define AUTOFS_IOC_SETTIMEOUT _IOWR(0x93,0x64,unsigned long) |
83 | #define AUTOFS_IOC_EXPIRE _IOR(0x93,0x65,struct autofs_packet_expire) | 84 | #define AUTOFS_IOC_EXPIRE _IOR(0x93,0x65,struct autofs_packet_expire) |
84 | 85 | ||
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index e9aec0d099df..7628219e5386 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h | |||
@@ -45,22 +45,21 @@ enum bdi_stat_item { | |||
45 | #define BDI_STAT_BATCH (8*(1+ilog2(nr_cpu_ids))) | 45 | #define BDI_STAT_BATCH (8*(1+ilog2(nr_cpu_ids))) |
46 | 46 | ||
47 | struct bdi_writeback { | 47 | struct bdi_writeback { |
48 | struct list_head list; /* hangs off the bdi */ | 48 | struct backing_dev_info *bdi; /* our parent bdi */ |
49 | |||
50 | struct backing_dev_info *bdi; /* our parent bdi */ | ||
51 | unsigned int nr; | 49 | unsigned int nr; |
52 | 50 | ||
53 | unsigned long last_old_flush; /* last old data flush */ | 51 | unsigned long last_old_flush; /* last old data flush */ |
52 | unsigned long last_active; /* last time bdi thread was active */ | ||
54 | 53 | ||
55 | struct task_struct *task; /* writeback task */ | 54 | struct task_struct *task; /* writeback thread */ |
56 | struct list_head b_dirty; /* dirty inodes */ | 55 | struct timer_list wakeup_timer; /* used for delayed bdi thread wakeup */ |
57 | struct list_head b_io; /* parked for writeback */ | 56 | struct list_head b_dirty; /* dirty inodes */ |
58 | struct list_head b_more_io; /* parked for more writeback */ | 57 | struct list_head b_io; /* parked for writeback */ |
58 | struct list_head b_more_io; /* parked for more writeback */ | ||
59 | }; | 59 | }; |
60 | 60 | ||
61 | struct backing_dev_info { | 61 | struct backing_dev_info { |
62 | struct list_head bdi_list; | 62 | struct list_head bdi_list; |
63 | struct rcu_head rcu_head; | ||
64 | unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */ | 63 | unsigned long ra_pages; /* max readahead in PAGE_CACHE_SIZE units */ |
65 | unsigned long state; /* Always use atomic bitops on this */ | 64 | unsigned long state; /* Always use atomic bitops on this */ |
66 | unsigned int capabilities; /* Device capabilities */ | 65 | unsigned int capabilities; /* Device capabilities */ |
@@ -80,8 +79,7 @@ struct backing_dev_info { | |||
80 | unsigned int max_ratio, max_prop_frac; | 79 | unsigned int max_ratio, max_prop_frac; |
81 | 80 | ||
82 | struct bdi_writeback wb; /* default writeback info for this bdi */ | 81 | struct bdi_writeback wb; /* default writeback info for this bdi */ |
83 | spinlock_t wb_lock; /* protects update side of wb_list */ | 82 | spinlock_t wb_lock; /* protects work_list */ |
84 | struct list_head wb_list; /* the flusher threads hanging off this bdi */ | ||
85 | 83 | ||
86 | struct list_head work_list; | 84 | struct list_head work_list; |
87 | 85 | ||
@@ -105,9 +103,10 @@ void bdi_unregister(struct backing_dev_info *bdi); | |||
105 | int bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int); | 103 | int bdi_setup_and_register(struct backing_dev_info *, char *, unsigned int); |
106 | void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages); | 104 | void bdi_start_writeback(struct backing_dev_info *bdi, long nr_pages); |
107 | void bdi_start_background_writeback(struct backing_dev_info *bdi); | 105 | void bdi_start_background_writeback(struct backing_dev_info *bdi); |
108 | int bdi_writeback_task(struct bdi_writeback *wb); | 106 | int bdi_writeback_thread(void *data); |
109 | int bdi_has_dirty_io(struct backing_dev_info *bdi); | 107 | int bdi_has_dirty_io(struct backing_dev_info *bdi); |
110 | void bdi_arm_supers_timer(void); | 108 | void bdi_arm_supers_timer(void); |
109 | void bdi_wakeup_thread_delayed(struct backing_dev_info *bdi); | ||
111 | 110 | ||
112 | extern spinlock_t bdi_lock; | 111 | extern spinlock_t bdi_lock; |
113 | extern struct list_head bdi_list; | 112 | extern struct list_head bdi_list; |
diff --git a/include/linux/bio.h b/include/linux/bio.h index 7fc5606e6ea5..5274103434ad 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h | |||
@@ -9,7 +9,7 @@ | |||
9 | * | 9 | * |
10 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | 12 | * | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | * GNU General Public License for more details. | 14 | * GNU General Public License for more details. |
15 | * | 15 | * |
@@ -28,6 +28,9 @@ | |||
28 | 28 | ||
29 | #include <asm/io.h> | 29 | #include <asm/io.h> |
30 | 30 | ||
31 | /* struct bio, bio_vec and BIO_* flags are defined in blk_types.h */ | ||
32 | #include <linux/blk_types.h> | ||
33 | |||
31 | #define BIO_DEBUG | 34 | #define BIO_DEBUG |
32 | 35 | ||
33 | #ifdef BIO_DEBUG | 36 | #ifdef BIO_DEBUG |
@@ -41,154 +44,6 @@ | |||
41 | #define BIO_MAX_SECTORS (BIO_MAX_SIZE >> 9) | 44 | #define BIO_MAX_SECTORS (BIO_MAX_SIZE >> 9) |
42 | 45 | ||
43 | /* | 46 | /* |
44 | * was unsigned short, but we might as well be ready for > 64kB I/O pages | ||
45 | */ | ||
46 | struct bio_vec { | ||
47 | struct page *bv_page; | ||
48 | unsigned int bv_len; | ||
49 | unsigned int bv_offset; | ||
50 | }; | ||
51 | |||
52 | struct bio_set; | ||
53 | struct bio; | ||
54 | struct bio_integrity_payload; | ||
55 | typedef void (bio_end_io_t) (struct bio *, int); | ||
56 | typedef void (bio_destructor_t) (struct bio *); | ||
57 | |||
58 | /* | ||
59 | * main unit of I/O for the block layer and lower layers (ie drivers and | ||
60 | * stacking drivers) | ||
61 | */ | ||
62 | struct bio { | ||
63 | sector_t bi_sector; /* device address in 512 byte | ||
64 | sectors */ | ||
65 | struct bio *bi_next; /* request queue link */ | ||
66 | struct block_device *bi_bdev; | ||
67 | unsigned long bi_flags; /* status, command, etc */ | ||
68 | unsigned long bi_rw; /* bottom bits READ/WRITE, | ||
69 | * top bits priority | ||
70 | */ | ||
71 | |||
72 | unsigned short bi_vcnt; /* how many bio_vec's */ | ||
73 | unsigned short bi_idx; /* current index into bvl_vec */ | ||
74 | |||
75 | /* Number of segments in this BIO after | ||
76 | * physical address coalescing is performed. | ||
77 | */ | ||
78 | unsigned int bi_phys_segments; | ||
79 | |||
80 | unsigned int bi_size; /* residual I/O count */ | ||
81 | |||
82 | /* | ||
83 | * To keep track of the max segment size, we account for the | ||
84 | * sizes of the first and last mergeable segments in this bio. | ||
85 | */ | ||
86 | unsigned int bi_seg_front_size; | ||
87 | unsigned int bi_seg_back_size; | ||
88 | |||
89 | unsigned int bi_max_vecs; /* max bvl_vecs we can hold */ | ||
90 | |||
91 | unsigned int bi_comp_cpu; /* completion CPU */ | ||
92 | |||
93 | atomic_t bi_cnt; /* pin count */ | ||
94 | |||
95 | struct bio_vec *bi_io_vec; /* the actual vec list */ | ||
96 | |||
97 | bio_end_io_t *bi_end_io; | ||
98 | |||
99 | void *bi_private; | ||
100 | #if defined(CONFIG_BLK_DEV_INTEGRITY) | ||
101 | struct bio_integrity_payload *bi_integrity; /* data integrity */ | ||
102 | #endif | ||
103 | |||
104 | bio_destructor_t *bi_destructor; /* destructor */ | ||
105 | |||
106 | /* | ||
107 | * We can inline a number of vecs at the end of the bio, to avoid | ||
108 | * double allocations for a small number of bio_vecs. This member | ||
109 | * MUST obviously be kept at the very end of the bio. | ||
110 | */ | ||
111 | struct bio_vec bi_inline_vecs[0]; | ||
112 | }; | ||
113 | |||
114 | /* | ||
115 | * bio flags | ||
116 | */ | ||
117 | #define BIO_UPTODATE 0 /* ok after I/O completion */ | ||
118 | #define BIO_RW_BLOCK 1 /* RW_AHEAD set, and read/write would block */ | ||
119 | #define BIO_EOF 2 /* out-out-bounds error */ | ||
120 | #define BIO_SEG_VALID 3 /* bi_phys_segments valid */ | ||
121 | #define BIO_CLONED 4 /* doesn't own data */ | ||
122 | #define BIO_BOUNCED 5 /* bio is a bounce bio */ | ||
123 | #define BIO_USER_MAPPED 6 /* contains user pages */ | ||
124 | #define BIO_EOPNOTSUPP 7 /* not supported */ | ||
125 | #define BIO_CPU_AFFINE 8 /* complete bio on same CPU as submitted */ | ||
126 | #define BIO_NULL_MAPPED 9 /* contains invalid user pages */ | ||
127 | #define BIO_FS_INTEGRITY 10 /* fs owns integrity data, not block layer */ | ||
128 | #define BIO_QUIET 11 /* Make BIO Quiet */ | ||
129 | #define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag))) | ||
130 | |||
131 | /* | ||
132 | * top 4 bits of bio flags indicate the pool this bio came from | ||
133 | */ | ||
134 | #define BIO_POOL_BITS (4) | ||
135 | #define BIO_POOL_NONE ((1UL << BIO_POOL_BITS) - 1) | ||
136 | #define BIO_POOL_OFFSET (BITS_PER_LONG - BIO_POOL_BITS) | ||
137 | #define BIO_POOL_MASK (1UL << BIO_POOL_OFFSET) | ||
138 | #define BIO_POOL_IDX(bio) ((bio)->bi_flags >> BIO_POOL_OFFSET) | ||
139 | |||
140 | /* | ||
141 | * bio bi_rw flags | ||
142 | * | ||
143 | * bit 0 -- data direction | ||
144 | * If not set, bio is a read from device. If set, it's a write to device. | ||
145 | * bit 1 -- fail fast device errors | ||
146 | * bit 2 -- fail fast transport errors | ||
147 | * bit 3 -- fail fast driver errors | ||
148 | * bit 4 -- rw-ahead when set | ||
149 | * bit 5 -- barrier | ||
150 | * Insert a serialization point in the IO queue, forcing previously | ||
151 | * submitted IO to be completed before this one is issued. | ||
152 | * bit 6 -- synchronous I/O hint. | ||
153 | * bit 7 -- Unplug the device immediately after submitting this bio. | ||
154 | * bit 8 -- metadata request | ||
155 | * Used for tracing to differentiate metadata and data IO. May also | ||
156 | * get some preferential treatment in the IO scheduler | ||
157 | * bit 9 -- discard sectors | ||
158 | * Informs the lower level device that this range of sectors is no longer | ||
159 | * used by the file system and may thus be freed by the device. Used | ||
160 | * for flash based storage. | ||
161 | * Don't want driver retries for any fast fail whatever the reason. | ||
162 | * bit 10 -- Tell the IO scheduler not to wait for more requests after this | ||
163 | one has been submitted, even if it is a SYNC request. | ||
164 | */ | ||
165 | enum bio_rw_flags { | ||
166 | BIO_RW, | ||
167 | BIO_RW_FAILFAST_DEV, | ||
168 | BIO_RW_FAILFAST_TRANSPORT, | ||
169 | BIO_RW_FAILFAST_DRIVER, | ||
170 | /* above flags must match REQ_* */ | ||
171 | BIO_RW_AHEAD, | ||
172 | BIO_RW_BARRIER, | ||
173 | BIO_RW_SYNCIO, | ||
174 | BIO_RW_UNPLUG, | ||
175 | BIO_RW_META, | ||
176 | BIO_RW_DISCARD, | ||
177 | BIO_RW_NOIDLE, | ||
178 | }; | ||
179 | |||
180 | /* | ||
181 | * First four bits must match between bio->bi_rw and rq->cmd_flags, make | ||
182 | * that explicit here. | ||
183 | */ | ||
184 | #define BIO_RW_RQ_MASK 0xf | ||
185 | |||
186 | static inline bool bio_rw_flagged(struct bio *bio, enum bio_rw_flags flag) | ||
187 | { | ||
188 | return (bio->bi_rw & (1 << flag)) != 0; | ||
189 | } | ||
190 | |||
191 | /* | ||
192 | * upper 16 bits of bi_rw define the io priority of this bio | 47 | * upper 16 bits of bi_rw define the io priority of this bio |
193 | */ | 48 | */ |
194 | #define BIO_PRIO_SHIFT (8 * sizeof(unsigned long) - IOPRIO_BITS) | 49 | #define BIO_PRIO_SHIFT (8 * sizeof(unsigned long) - IOPRIO_BITS) |
@@ -211,7 +66,10 @@ static inline bool bio_rw_flagged(struct bio *bio, enum bio_rw_flags flag) | |||
211 | #define bio_offset(bio) bio_iovec((bio))->bv_offset | 66 | #define bio_offset(bio) bio_iovec((bio))->bv_offset |
212 | #define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx) | 67 | #define bio_segments(bio) ((bio)->bi_vcnt - (bio)->bi_idx) |
213 | #define bio_sectors(bio) ((bio)->bi_size >> 9) | 68 | #define bio_sectors(bio) ((bio)->bi_size >> 9) |
214 | #define bio_empty_barrier(bio) (bio_rw_flagged(bio, BIO_RW_BARRIER) && !bio_has_data(bio) && !bio_rw_flagged(bio, BIO_RW_DISCARD)) | 69 | #define bio_empty_barrier(bio) \ |
70 | ((bio->bi_rw & REQ_HARDBARRIER) && \ | ||
71 | !bio_has_data(bio) && \ | ||
72 | !(bio->bi_rw & REQ_DISCARD)) | ||
215 | 73 | ||
216 | static inline unsigned int bio_cur_bytes(struct bio *bio) | 74 | static inline unsigned int bio_cur_bytes(struct bio *bio) |
217 | { | 75 | { |
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h new file mode 100644 index 000000000000..53691774d34e --- /dev/null +++ b/include/linux/blk_types.h | |||
@@ -0,0 +1,194 @@ | |||
1 | /* | ||
2 | * Block data types and constants. Directly include this file only to | ||
3 | * break include dependency loop. | ||
4 | */ | ||
5 | #ifndef __LINUX_BLK_TYPES_H | ||
6 | #define __LINUX_BLK_TYPES_H | ||
7 | |||
8 | #ifdef CONFIG_BLOCK | ||
9 | |||
10 | #include <linux/types.h> | ||
11 | |||
12 | struct bio_set; | ||
13 | struct bio; | ||
14 | struct bio_integrity_payload; | ||
15 | struct page; | ||
16 | struct block_device; | ||
17 | typedef void (bio_end_io_t) (struct bio *, int); | ||
18 | typedef void (bio_destructor_t) (struct bio *); | ||
19 | |||
20 | /* | ||
21 | * was unsigned short, but we might as well be ready for > 64kB I/O pages | ||
22 | */ | ||
23 | struct bio_vec { | ||
24 | struct page *bv_page; | ||
25 | unsigned int bv_len; | ||
26 | unsigned int bv_offset; | ||
27 | }; | ||
28 | |||
29 | /* | ||
30 | * main unit of I/O for the block layer and lower layers (ie drivers and | ||
31 | * stacking drivers) | ||
32 | */ | ||
33 | struct bio { | ||
34 | sector_t bi_sector; /* device address in 512 byte | ||
35 | sectors */ | ||
36 | struct bio *bi_next; /* request queue link */ | ||
37 | struct block_device *bi_bdev; | ||
38 | unsigned long bi_flags; /* status, command, etc */ | ||
39 | unsigned long bi_rw; /* bottom bits READ/WRITE, | ||
40 | * top bits priority | ||
41 | */ | ||
42 | |||
43 | unsigned short bi_vcnt; /* how many bio_vec's */ | ||
44 | unsigned short bi_idx; /* current index into bvl_vec */ | ||
45 | |||
46 | /* Number of segments in this BIO after | ||
47 | * physical address coalescing is performed. | ||
48 | */ | ||
49 | unsigned int bi_phys_segments; | ||
50 | |||
51 | unsigned int bi_size; /* residual I/O count */ | ||
52 | |||
53 | /* | ||
54 | * To keep track of the max segment size, we account for the | ||
55 | * sizes of the first and last mergeable segments in this bio. | ||
56 | */ | ||
57 | unsigned int bi_seg_front_size; | ||
58 | unsigned int bi_seg_back_size; | ||
59 | |||
60 | unsigned int bi_max_vecs; /* max bvl_vecs we can hold */ | ||
61 | |||
62 | unsigned int bi_comp_cpu; /* completion CPU */ | ||
63 | |||
64 | atomic_t bi_cnt; /* pin count */ | ||
65 | |||
66 | struct bio_vec *bi_io_vec; /* the actual vec list */ | ||
67 | |||
68 | bio_end_io_t *bi_end_io; | ||
69 | |||
70 | void *bi_private; | ||
71 | #if defined(CONFIG_BLK_DEV_INTEGRITY) | ||
72 | struct bio_integrity_payload *bi_integrity; /* data integrity */ | ||
73 | #endif | ||
74 | |||
75 | bio_destructor_t *bi_destructor; /* destructor */ | ||
76 | |||
77 | /* | ||
78 | * We can inline a number of vecs at the end of the bio, to avoid | ||
79 | * double allocations for a small number of bio_vecs. This member | ||
80 | * MUST obviously be kept at the very end of the bio. | ||
81 | */ | ||
82 | struct bio_vec bi_inline_vecs[0]; | ||
83 | }; | ||
84 | |||
85 | /* | ||
86 | * bio flags | ||
87 | */ | ||
88 | #define BIO_UPTODATE 0 /* ok after I/O completion */ | ||
89 | #define BIO_RW_BLOCK 1 /* RW_AHEAD set, and read/write would block */ | ||
90 | #define BIO_EOF 2 /* out-out-bounds error */ | ||
91 | #define BIO_SEG_VALID 3 /* bi_phys_segments valid */ | ||
92 | #define BIO_CLONED 4 /* doesn't own data */ | ||
93 | #define BIO_BOUNCED 5 /* bio is a bounce bio */ | ||
94 | #define BIO_USER_MAPPED 6 /* contains user pages */ | ||
95 | #define BIO_EOPNOTSUPP 7 /* not supported */ | ||
96 | #define BIO_CPU_AFFINE 8 /* complete bio on same CPU as submitted */ | ||
97 | #define BIO_NULL_MAPPED 9 /* contains invalid user pages */ | ||
98 | #define BIO_FS_INTEGRITY 10 /* fs owns integrity data, not block layer */ | ||
99 | #define BIO_QUIET 11 /* Make BIO Quiet */ | ||
100 | #define bio_flagged(bio, flag) ((bio)->bi_flags & (1 << (flag))) | ||
101 | |||
102 | /* | ||
103 | * top 4 bits of bio flags indicate the pool this bio came from | ||
104 | */ | ||
105 | #define BIO_POOL_BITS (4) | ||
106 | #define BIO_POOL_NONE ((1UL << BIO_POOL_BITS) - 1) | ||
107 | #define BIO_POOL_OFFSET (BITS_PER_LONG - BIO_POOL_BITS) | ||
108 | #define BIO_POOL_MASK (1UL << BIO_POOL_OFFSET) | ||
109 | #define BIO_POOL_IDX(bio) ((bio)->bi_flags >> BIO_POOL_OFFSET) | ||
110 | |||
111 | #endif /* CONFIG_BLOCK */ | ||
112 | |||
113 | /* | ||
114 | * Request flags. For use in the cmd_flags field of struct request, and in | ||
115 | * bi_rw of struct bio. Note that some flags are only valid in either one. | ||
116 | */ | ||
117 | enum rq_flag_bits { | ||
118 | /* common flags */ | ||
119 | __REQ_WRITE, /* not set, read. set, write */ | ||
120 | __REQ_FAILFAST_DEV, /* no driver retries of device errors */ | ||
121 | __REQ_FAILFAST_TRANSPORT, /* no driver retries of transport errors */ | ||
122 | __REQ_FAILFAST_DRIVER, /* no driver retries of driver errors */ | ||
123 | |||
124 | __REQ_HARDBARRIER, /* may not be passed by drive either */ | ||
125 | __REQ_SYNC, /* request is sync (sync write or read) */ | ||
126 | __REQ_META, /* metadata io request */ | ||
127 | __REQ_DISCARD, /* request to discard sectors */ | ||
128 | __REQ_NOIDLE, /* don't anticipate more IO after this one */ | ||
129 | |||
130 | /* bio only flags */ | ||
131 | __REQ_UNPLUG, /* unplug the immediately after submission */ | ||
132 | __REQ_RAHEAD, /* read ahead, can fail anytime */ | ||
133 | |||
134 | /* request only flags */ | ||
135 | __REQ_SORTED, /* elevator knows about this request */ | ||
136 | __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */ | ||
137 | __REQ_FUA, /* forced unit access */ | ||
138 | __REQ_NOMERGE, /* don't touch this for merging */ | ||
139 | __REQ_STARTED, /* drive already may have started this one */ | ||
140 | __REQ_DONTPREP, /* don't call prep for this one */ | ||
141 | __REQ_QUEUED, /* uses queueing */ | ||
142 | __REQ_ELVPRIV, /* elevator private data attached */ | ||
143 | __REQ_FAILED, /* set if the request failed */ | ||
144 | __REQ_QUIET, /* don't worry about errors */ | ||
145 | __REQ_PREEMPT, /* set for "ide_preempt" requests */ | ||
146 | __REQ_ORDERED_COLOR, /* is before or after barrier */ | ||
147 | __REQ_ALLOCED, /* request came from our alloc pool */ | ||
148 | __REQ_COPY_USER, /* contains copies of user pages */ | ||
149 | __REQ_INTEGRITY, /* integrity metadata has been remapped */ | ||
150 | __REQ_FLUSH, /* request for cache flush */ | ||
151 | __REQ_IO_STAT, /* account I/O stat */ | ||
152 | __REQ_MIXED_MERGE, /* merge of different types, fail separately */ | ||
153 | __REQ_NR_BITS, /* stops here */ | ||
154 | }; | ||
155 | |||
156 | #define REQ_WRITE (1 << __REQ_WRITE) | ||
157 | #define REQ_FAILFAST_DEV (1 << __REQ_FAILFAST_DEV) | ||
158 | #define REQ_FAILFAST_TRANSPORT (1 << __REQ_FAILFAST_TRANSPORT) | ||
159 | #define REQ_FAILFAST_DRIVER (1 << __REQ_FAILFAST_DRIVER) | ||
160 | #define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER) | ||
161 | #define REQ_SYNC (1 << __REQ_SYNC) | ||
162 | #define REQ_META (1 << __REQ_META) | ||
163 | #define REQ_DISCARD (1 << __REQ_DISCARD) | ||
164 | #define REQ_NOIDLE (1 << __REQ_NOIDLE) | ||
165 | |||
166 | #define REQ_FAILFAST_MASK \ | ||
167 | (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | REQ_FAILFAST_DRIVER) | ||
168 | #define REQ_COMMON_MASK \ | ||
169 | (REQ_WRITE | REQ_FAILFAST_MASK | REQ_HARDBARRIER | REQ_SYNC | \ | ||
170 | REQ_META| REQ_DISCARD | REQ_NOIDLE) | ||
171 | |||
172 | #define REQ_UNPLUG (1 << __REQ_UNPLUG) | ||
173 | #define REQ_RAHEAD (1 << __REQ_RAHEAD) | ||
174 | |||
175 | #define REQ_SORTED (1 << __REQ_SORTED) | ||
176 | #define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER) | ||
177 | #define REQ_FUA (1 << __REQ_FUA) | ||
178 | #define REQ_NOMERGE (1 << __REQ_NOMERGE) | ||
179 | #define REQ_STARTED (1 << __REQ_STARTED) | ||
180 | #define REQ_DONTPREP (1 << __REQ_DONTPREP) | ||
181 | #define REQ_QUEUED (1 << __REQ_QUEUED) | ||
182 | #define REQ_ELVPRIV (1 << __REQ_ELVPRIV) | ||
183 | #define REQ_FAILED (1 << __REQ_FAILED) | ||
184 | #define REQ_QUIET (1 << __REQ_QUIET) | ||
185 | #define REQ_PREEMPT (1 << __REQ_PREEMPT) | ||
186 | #define REQ_ORDERED_COLOR (1 << __REQ_ORDERED_COLOR) | ||
187 | #define REQ_ALLOCED (1 << __REQ_ALLOCED) | ||
188 | #define REQ_COPY_USER (1 << __REQ_COPY_USER) | ||
189 | #define REQ_INTEGRITY (1 << __REQ_INTEGRITY) | ||
190 | #define REQ_FLUSH (1 << __REQ_FLUSH) | ||
191 | #define REQ_IO_STAT (1 << __REQ_IO_STAT) | ||
192 | #define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE) | ||
193 | |||
194 | #endif /* __LINUX_BLK_TYPES_H */ | ||
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 09a840264d6f..89c855c5655c 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -60,7 +60,6 @@ enum rq_cmd_type_bits { | |||
60 | REQ_TYPE_PM_RESUME, /* resume request */ | 60 | REQ_TYPE_PM_RESUME, /* resume request */ |
61 | REQ_TYPE_PM_SHUTDOWN, /* shutdown request */ | 61 | REQ_TYPE_PM_SHUTDOWN, /* shutdown request */ |
62 | REQ_TYPE_SPECIAL, /* driver defined type */ | 62 | REQ_TYPE_SPECIAL, /* driver defined type */ |
63 | REQ_TYPE_LINUX_BLOCK, /* generic block layer message */ | ||
64 | /* | 63 | /* |
65 | * for ATA/ATAPI devices. this really doesn't belong here, ide should | 64 | * for ATA/ATAPI devices. this really doesn't belong here, ide should |
66 | * use REQ_TYPE_SPECIAL and use rq->cmd[0] with the range of driver | 65 | * use REQ_TYPE_SPECIAL and use rq->cmd[0] with the range of driver |
@@ -70,84 +69,6 @@ enum rq_cmd_type_bits { | |||
70 | REQ_TYPE_ATA_PC, | 69 | REQ_TYPE_ATA_PC, |
71 | }; | 70 | }; |
72 | 71 | ||
73 | /* | ||
74 | * For request of type REQ_TYPE_LINUX_BLOCK, rq->cmd[0] is the opcode being | ||
75 | * sent down (similar to how REQ_TYPE_BLOCK_PC means that ->cmd[] holds a | ||
76 | * SCSI cdb. | ||
77 | * | ||
78 | * 0x00 -> 0x3f are driver private, to be used for whatever purpose they need, | ||
79 | * typically to differentiate REQ_TYPE_SPECIAL requests. | ||
80 | * | ||
81 | */ | ||
82 | enum { | ||
83 | REQ_LB_OP_EJECT = 0x40, /* eject request */ | ||
84 | REQ_LB_OP_FLUSH = 0x41, /* flush request */ | ||
85 | }; | ||
86 | |||
87 | /* | ||
88 | * request type modified bits. first four bits match BIO_RW* bits, important | ||
89 | */ | ||
90 | enum rq_flag_bits { | ||
91 | __REQ_RW, /* not set, read. set, write */ | ||
92 | __REQ_FAILFAST_DEV, /* no driver retries of device errors */ | ||
93 | __REQ_FAILFAST_TRANSPORT, /* no driver retries of transport errors */ | ||
94 | __REQ_FAILFAST_DRIVER, /* no driver retries of driver errors */ | ||
95 | /* above flags must match BIO_RW_* */ | ||
96 | __REQ_DISCARD, /* request to discard sectors */ | ||
97 | __REQ_SORTED, /* elevator knows about this request */ | ||
98 | __REQ_SOFTBARRIER, /* may not be passed by ioscheduler */ | ||
99 | __REQ_HARDBARRIER, /* may not be passed by drive either */ | ||
100 | __REQ_FUA, /* forced unit access */ | ||
101 | __REQ_NOMERGE, /* don't touch this for merging */ | ||
102 | __REQ_STARTED, /* drive already may have started this one */ | ||
103 | __REQ_DONTPREP, /* don't call prep for this one */ | ||
104 | __REQ_QUEUED, /* uses queueing */ | ||
105 | __REQ_ELVPRIV, /* elevator private data attached */ | ||
106 | __REQ_FAILED, /* set if the request failed */ | ||
107 | __REQ_QUIET, /* don't worry about errors */ | ||
108 | __REQ_PREEMPT, /* set for "ide_preempt" requests */ | ||
109 | __REQ_ORDERED_COLOR, /* is before or after barrier */ | ||
110 | __REQ_RW_SYNC, /* request is sync (sync write or read) */ | ||
111 | __REQ_ALLOCED, /* request came from our alloc pool */ | ||
112 | __REQ_RW_META, /* metadata io request */ | ||
113 | __REQ_COPY_USER, /* contains copies of user pages */ | ||
114 | __REQ_INTEGRITY, /* integrity metadata has been remapped */ | ||
115 | __REQ_NOIDLE, /* Don't anticipate more IO after this one */ | ||
116 | __REQ_IO_STAT, /* account I/O stat */ | ||
117 | __REQ_MIXED_MERGE, /* merge of different types, fail separately */ | ||
118 | __REQ_NR_BITS, /* stops here */ | ||
119 | }; | ||
120 | |||
121 | #define REQ_RW (1 << __REQ_RW) | ||
122 | #define REQ_FAILFAST_DEV (1 << __REQ_FAILFAST_DEV) | ||
123 | #define REQ_FAILFAST_TRANSPORT (1 << __REQ_FAILFAST_TRANSPORT) | ||
124 | #define REQ_FAILFAST_DRIVER (1 << __REQ_FAILFAST_DRIVER) | ||
125 | #define REQ_DISCARD (1 << __REQ_DISCARD) | ||
126 | #define REQ_SORTED (1 << __REQ_SORTED) | ||
127 | #define REQ_SOFTBARRIER (1 << __REQ_SOFTBARRIER) | ||
128 | #define REQ_HARDBARRIER (1 << __REQ_HARDBARRIER) | ||
129 | #define REQ_FUA (1 << __REQ_FUA) | ||
130 | #define REQ_NOMERGE (1 << __REQ_NOMERGE) | ||
131 | #define REQ_STARTED (1 << __REQ_STARTED) | ||
132 | #define REQ_DONTPREP (1 << __REQ_DONTPREP) | ||
133 | #define REQ_QUEUED (1 << __REQ_QUEUED) | ||
134 | #define REQ_ELVPRIV (1 << __REQ_ELVPRIV) | ||
135 | #define REQ_FAILED (1 << __REQ_FAILED) | ||
136 | #define REQ_QUIET (1 << __REQ_QUIET) | ||
137 | #define REQ_PREEMPT (1 << __REQ_PREEMPT) | ||
138 | #define REQ_ORDERED_COLOR (1 << __REQ_ORDERED_COLOR) | ||
139 | #define REQ_RW_SYNC (1 << __REQ_RW_SYNC) | ||
140 | #define REQ_ALLOCED (1 << __REQ_ALLOCED) | ||
141 | #define REQ_RW_META (1 << __REQ_RW_META) | ||
142 | #define REQ_COPY_USER (1 << __REQ_COPY_USER) | ||
143 | #define REQ_INTEGRITY (1 << __REQ_INTEGRITY) | ||
144 | #define REQ_NOIDLE (1 << __REQ_NOIDLE) | ||
145 | #define REQ_IO_STAT (1 << __REQ_IO_STAT) | ||
146 | #define REQ_MIXED_MERGE (1 << __REQ_MIXED_MERGE) | ||
147 | |||
148 | #define REQ_FAILFAST_MASK (REQ_FAILFAST_DEV | REQ_FAILFAST_TRANSPORT | \ | ||
149 | REQ_FAILFAST_DRIVER) | ||
150 | |||
151 | #define BLK_MAX_CDB 16 | 72 | #define BLK_MAX_CDB 16 |
152 | 73 | ||
153 | /* | 74 | /* |
@@ -264,6 +185,7 @@ struct request_pm_state | |||
264 | typedef void (request_fn_proc) (struct request_queue *q); | 185 | typedef void (request_fn_proc) (struct request_queue *q); |
265 | typedef int (make_request_fn) (struct request_queue *q, struct bio *bio); | 186 | typedef int (make_request_fn) (struct request_queue *q, struct bio *bio); |
266 | typedef int (prep_rq_fn) (struct request_queue *, struct request *); | 187 | typedef int (prep_rq_fn) (struct request_queue *, struct request *); |
188 | typedef void (unprep_rq_fn) (struct request_queue *, struct request *); | ||
267 | typedef void (unplug_fn) (struct request_queue *); | 189 | typedef void (unplug_fn) (struct request_queue *); |
268 | 190 | ||
269 | struct bio_vec; | 191 | struct bio_vec; |
@@ -275,7 +197,6 @@ struct bvec_merge_data { | |||
275 | }; | 197 | }; |
276 | typedef int (merge_bvec_fn) (struct request_queue *, struct bvec_merge_data *, | 198 | typedef int (merge_bvec_fn) (struct request_queue *, struct bvec_merge_data *, |
277 | struct bio_vec *); | 199 | struct bio_vec *); |
278 | typedef void (prepare_flush_fn) (struct request_queue *, struct request *); | ||
279 | typedef void (softirq_done_fn)(struct request *); | 200 | typedef void (softirq_done_fn)(struct request *); |
280 | typedef int (dma_drain_needed_fn)(struct request *); | 201 | typedef int (dma_drain_needed_fn)(struct request *); |
281 | typedef int (lld_busy_fn) (struct request_queue *q); | 202 | typedef int (lld_busy_fn) (struct request_queue *q); |
@@ -346,9 +267,9 @@ struct request_queue | |||
346 | request_fn_proc *request_fn; | 267 | request_fn_proc *request_fn; |
347 | make_request_fn *make_request_fn; | 268 | make_request_fn *make_request_fn; |
348 | prep_rq_fn *prep_rq_fn; | 269 | prep_rq_fn *prep_rq_fn; |
270 | unprep_rq_fn *unprep_rq_fn; | ||
349 | unplug_fn *unplug_fn; | 271 | unplug_fn *unplug_fn; |
350 | merge_bvec_fn *merge_bvec_fn; | 272 | merge_bvec_fn *merge_bvec_fn; |
351 | prepare_flush_fn *prepare_flush_fn; | ||
352 | softirq_done_fn *softirq_done_fn; | 273 | softirq_done_fn *softirq_done_fn; |
353 | rq_timed_out_fn *rq_timed_out_fn; | 274 | rq_timed_out_fn *rq_timed_out_fn; |
354 | dma_drain_needed_fn *dma_drain_needed; | 275 | dma_drain_needed_fn *dma_drain_needed; |
@@ -467,11 +388,13 @@ struct request_queue | |||
467 | #define QUEUE_FLAG_IO_STAT 15 /* do IO stats */ | 388 | #define QUEUE_FLAG_IO_STAT 15 /* do IO stats */ |
468 | #define QUEUE_FLAG_DISCARD 16 /* supports DISCARD */ | 389 | #define QUEUE_FLAG_DISCARD 16 /* supports DISCARD */ |
469 | #define QUEUE_FLAG_NOXMERGES 17 /* No extended merges */ | 390 | #define QUEUE_FLAG_NOXMERGES 17 /* No extended merges */ |
391 | #define QUEUE_FLAG_ADD_RANDOM 18 /* Contributes to random pool */ | ||
470 | 392 | ||
471 | #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ | 393 | #define QUEUE_FLAG_DEFAULT ((1 << QUEUE_FLAG_IO_STAT) | \ |
472 | (1 << QUEUE_FLAG_CLUSTER) | \ | 394 | (1 << QUEUE_FLAG_CLUSTER) | \ |
473 | (1 << QUEUE_FLAG_STACKABLE) | \ | 395 | (1 << QUEUE_FLAG_STACKABLE) | \ |
474 | (1 << QUEUE_FLAG_SAME_COMP)) | 396 | (1 << QUEUE_FLAG_SAME_COMP) | \ |
397 | (1 << QUEUE_FLAG_ADD_RANDOM)) | ||
475 | 398 | ||
476 | static inline int queue_is_locked(struct request_queue *q) | 399 | static inline int queue_is_locked(struct request_queue *q) |
477 | { | 400 | { |
@@ -596,38 +519,26 @@ enum { | |||
596 | test_bit(QUEUE_FLAG_NOXMERGES, &(q)->queue_flags) | 519 | test_bit(QUEUE_FLAG_NOXMERGES, &(q)->queue_flags) |
597 | #define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags) | 520 | #define blk_queue_nonrot(q) test_bit(QUEUE_FLAG_NONROT, &(q)->queue_flags) |
598 | #define blk_queue_io_stat(q) test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags) | 521 | #define blk_queue_io_stat(q) test_bit(QUEUE_FLAG_IO_STAT, &(q)->queue_flags) |
522 | #define blk_queue_add_random(q) test_bit(QUEUE_FLAG_ADD_RANDOM, &(q)->queue_flags) | ||
599 | #define blk_queue_flushing(q) ((q)->ordseq) | 523 | #define blk_queue_flushing(q) ((q)->ordseq) |
600 | #define blk_queue_stackable(q) \ | 524 | #define blk_queue_stackable(q) \ |
601 | test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags) | 525 | test_bit(QUEUE_FLAG_STACKABLE, &(q)->queue_flags) |
602 | #define blk_queue_discard(q) test_bit(QUEUE_FLAG_DISCARD, &(q)->queue_flags) | 526 | #define blk_queue_discard(q) test_bit(QUEUE_FLAG_DISCARD, &(q)->queue_flags) |
603 | 527 | ||
604 | #define blk_fs_request(rq) ((rq)->cmd_type == REQ_TYPE_FS) | 528 | #define blk_noretry_request(rq) \ |
605 | #define blk_pc_request(rq) ((rq)->cmd_type == REQ_TYPE_BLOCK_PC) | 529 | ((rq)->cmd_flags & (REQ_FAILFAST_DEV|REQ_FAILFAST_TRANSPORT| \ |
606 | #define blk_special_request(rq) ((rq)->cmd_type == REQ_TYPE_SPECIAL) | 530 | REQ_FAILFAST_DRIVER)) |
607 | #define blk_sense_request(rq) ((rq)->cmd_type == REQ_TYPE_SENSE) | 531 | |
608 | 532 | #define blk_account_rq(rq) \ | |
609 | #define blk_failfast_dev(rq) ((rq)->cmd_flags & REQ_FAILFAST_DEV) | 533 | (((rq)->cmd_flags & REQ_STARTED) && \ |
610 | #define blk_failfast_transport(rq) ((rq)->cmd_flags & REQ_FAILFAST_TRANSPORT) | 534 | ((rq)->cmd_type == REQ_TYPE_FS || \ |
611 | #define blk_failfast_driver(rq) ((rq)->cmd_flags & REQ_FAILFAST_DRIVER) | 535 | ((rq)->cmd_flags & REQ_DISCARD))) |
612 | #define blk_noretry_request(rq) (blk_failfast_dev(rq) || \ | 536 | |
613 | blk_failfast_transport(rq) || \ | ||
614 | blk_failfast_driver(rq)) | ||
615 | #define blk_rq_started(rq) ((rq)->cmd_flags & REQ_STARTED) | ||
616 | #define blk_rq_io_stat(rq) ((rq)->cmd_flags & REQ_IO_STAT) | ||
617 | #define blk_rq_quiet(rq) ((rq)->cmd_flags & REQ_QUIET) | ||
618 | |||
619 | #define blk_account_rq(rq) (blk_rq_started(rq) && (blk_fs_request(rq) || blk_discard_rq(rq))) | ||
620 | |||
621 | #define blk_pm_suspend_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_SUSPEND) | ||
622 | #define blk_pm_resume_request(rq) ((rq)->cmd_type == REQ_TYPE_PM_RESUME) | ||
623 | #define blk_pm_request(rq) \ | 537 | #define blk_pm_request(rq) \ |
624 | (blk_pm_suspend_request(rq) || blk_pm_resume_request(rq)) | 538 | ((rq)->cmd_type == REQ_TYPE_PM_SUSPEND || \ |
539 | (rq)->cmd_type == REQ_TYPE_PM_RESUME) | ||
625 | 540 | ||
626 | #define blk_rq_cpu_valid(rq) ((rq)->cpu != -1) | 541 | #define blk_rq_cpu_valid(rq) ((rq)->cpu != -1) |
627 | #define blk_sorted_rq(rq) ((rq)->cmd_flags & REQ_SORTED) | ||
628 | #define blk_barrier_rq(rq) ((rq)->cmd_flags & REQ_HARDBARRIER) | ||
629 | #define blk_fua_rq(rq) ((rq)->cmd_flags & REQ_FUA) | ||
630 | #define blk_discard_rq(rq) ((rq)->cmd_flags & REQ_DISCARD) | ||
631 | #define blk_bidi_rq(rq) ((rq)->next_rq != NULL) | 542 | #define blk_bidi_rq(rq) ((rq)->next_rq != NULL) |
632 | /* rq->queuelist of dequeued request must be list_empty() */ | 543 | /* rq->queuelist of dequeued request must be list_empty() */ |
633 | #define blk_queued_rq(rq) (!list_empty(&(rq)->queuelist)) | 544 | #define blk_queued_rq(rq) (!list_empty(&(rq)->queuelist)) |
@@ -641,7 +552,7 @@ enum { | |||
641 | */ | 552 | */ |
642 | static inline bool rw_is_sync(unsigned int rw_flags) | 553 | static inline bool rw_is_sync(unsigned int rw_flags) |
643 | { | 554 | { |
644 | return !(rw_flags & REQ_RW) || (rw_flags & REQ_RW_SYNC); | 555 | return !(rw_flags & REQ_WRITE) || (rw_flags & REQ_SYNC); |
645 | } | 556 | } |
646 | 557 | ||
647 | static inline bool rq_is_sync(struct request *rq) | 558 | static inline bool rq_is_sync(struct request *rq) |
@@ -649,9 +560,6 @@ static inline bool rq_is_sync(struct request *rq) | |||
649 | return rw_is_sync(rq->cmd_flags); | 560 | return rw_is_sync(rq->cmd_flags); |
650 | } | 561 | } |
651 | 562 | ||
652 | #define rq_is_meta(rq) ((rq)->cmd_flags & REQ_RW_META) | ||
653 | #define rq_noidle(rq) ((rq)->cmd_flags & REQ_NOIDLE) | ||
654 | |||
655 | static inline int blk_queue_full(struct request_queue *q, int sync) | 563 | static inline int blk_queue_full(struct request_queue *q, int sync) |
656 | { | 564 | { |
657 | if (sync) | 565 | if (sync) |
@@ -684,7 +592,8 @@ static inline void blk_clear_queue_full(struct request_queue *q, int sync) | |||
684 | (REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER) | 592 | (REQ_NOMERGE | REQ_STARTED | REQ_HARDBARRIER | REQ_SOFTBARRIER) |
685 | #define rq_mergeable(rq) \ | 593 | #define rq_mergeable(rq) \ |
686 | (!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && \ | 594 | (!((rq)->cmd_flags & RQ_NOMERGE_FLAGS) && \ |
687 | (blk_discard_rq(rq) || blk_fs_request((rq)))) | 595 | (((rq)->cmd_flags & REQ_DISCARD) || \ |
596 | (rq)->cmd_type == REQ_TYPE_FS)) | ||
688 | 597 | ||
689 | /* | 598 | /* |
690 | * q->prep_rq_fn return values | 599 | * q->prep_rq_fn return values |
@@ -709,7 +618,7 @@ extern unsigned long blk_max_low_pfn, blk_max_pfn; | |||
709 | #define BLK_BOUNCE_HIGH -1ULL | 618 | #define BLK_BOUNCE_HIGH -1ULL |
710 | #endif | 619 | #endif |
711 | #define BLK_BOUNCE_ANY (-1ULL) | 620 | #define BLK_BOUNCE_ANY (-1ULL) |
712 | #define BLK_BOUNCE_ISA (ISA_DMA_THRESHOLD) | 621 | #define BLK_BOUNCE_ISA (DMA_BIT_MASK(24)) |
713 | 622 | ||
714 | /* | 623 | /* |
715 | * default timeout for SG_IO if none specified | 624 | * default timeout for SG_IO if none specified |
@@ -781,6 +690,8 @@ extern struct request *blk_make_request(struct request_queue *, struct bio *, | |||
781 | gfp_t); | 690 | gfp_t); |
782 | extern void blk_insert_request(struct request_queue *, struct request *, int, void *); | 691 | extern void blk_insert_request(struct request_queue *, struct request *, int, void *); |
783 | extern void blk_requeue_request(struct request_queue *, struct request *); | 692 | extern void blk_requeue_request(struct request_queue *, struct request *); |
693 | extern void blk_add_request_payload(struct request *rq, struct page *page, | ||
694 | unsigned int len); | ||
784 | extern int blk_rq_check_limits(struct request_queue *q, struct request *rq); | 695 | extern int blk_rq_check_limits(struct request_queue *q, struct request *rq); |
785 | extern int blk_lld_busy(struct request_queue *q); | 696 | extern int blk_lld_busy(struct request_queue *q); |
786 | extern int blk_rq_prep_clone(struct request *rq, struct request *rq_src, | 697 | extern int blk_rq_prep_clone(struct request *rq, struct request *rq_src, |
@@ -915,6 +826,7 @@ extern void blk_complete_request(struct request *); | |||
915 | extern void __blk_complete_request(struct request *); | 826 | extern void __blk_complete_request(struct request *); |
916 | extern void blk_abort_request(struct request *); | 827 | extern void blk_abort_request(struct request *); |
917 | extern void blk_abort_queue(struct request_queue *); | 828 | extern void blk_abort_queue(struct request_queue *); |
829 | extern void blk_unprep_request(struct request *); | ||
918 | 830 | ||
919 | /* | 831 | /* |
920 | * Access functions for manipulating queue properties | 832 | * Access functions for manipulating queue properties |
@@ -959,6 +871,7 @@ extern int blk_queue_dma_drain(struct request_queue *q, | |||
959 | extern void blk_queue_lld_busy(struct request_queue *q, lld_busy_fn *fn); | 871 | extern void blk_queue_lld_busy(struct request_queue *q, lld_busy_fn *fn); |
960 | extern void blk_queue_segment_boundary(struct request_queue *, unsigned long); | 872 | extern void blk_queue_segment_boundary(struct request_queue *, unsigned long); |
961 | extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn); | 873 | extern void blk_queue_prep_rq(struct request_queue *, prep_rq_fn *pfn); |
874 | extern void blk_queue_unprep_rq(struct request_queue *, unprep_rq_fn *ufn); | ||
962 | extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *); | 875 | extern void blk_queue_merge_bvec(struct request_queue *, merge_bvec_fn *); |
963 | extern void blk_queue_dma_alignment(struct request_queue *, int); | 876 | extern void blk_queue_dma_alignment(struct request_queue *, int); |
964 | extern void blk_queue_update_dma_alignment(struct request_queue *, int); | 877 | extern void blk_queue_update_dma_alignment(struct request_queue *, int); |
@@ -966,7 +879,7 @@ extern void blk_queue_softirq_done(struct request_queue *, softirq_done_fn *); | |||
966 | extern void blk_queue_rq_timed_out(struct request_queue *, rq_timed_out_fn *); | 879 | extern void blk_queue_rq_timed_out(struct request_queue *, rq_timed_out_fn *); |
967 | extern void blk_queue_rq_timeout(struct request_queue *, unsigned int); | 880 | extern void blk_queue_rq_timeout(struct request_queue *, unsigned int); |
968 | extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); | 881 | extern struct backing_dev_info *blk_get_backing_dev_info(struct block_device *bdev); |
969 | extern int blk_queue_ordered(struct request_queue *, unsigned, prepare_flush_fn *); | 882 | extern int blk_queue_ordered(struct request_queue *, unsigned); |
970 | extern bool blk_do_ordered(struct request_queue *, struct request **); | 883 | extern bool blk_do_ordered(struct request_queue *, struct request **); |
971 | extern unsigned blk_ordered_cur_seq(struct request_queue *); | 884 | extern unsigned blk_ordered_cur_seq(struct request_queue *); |
972 | extern unsigned blk_ordered_req_seq(struct request *); | 885 | extern unsigned blk_ordered_req_seq(struct request *); |
@@ -1020,7 +933,7 @@ static inline int sb_issue_discard(struct super_block *sb, | |||
1020 | { | 933 | { |
1021 | block <<= (sb->s_blocksize_bits - 9); | 934 | block <<= (sb->s_blocksize_bits - 9); |
1022 | nr_blocks <<= (sb->s_blocksize_bits - 9); | 935 | nr_blocks <<= (sb->s_blocksize_bits - 9); |
1023 | return blkdev_issue_discard(sb->s_bdev, block, nr_blocks, GFP_KERNEL, | 936 | return blkdev_issue_discard(sb->s_bdev, block, nr_blocks, GFP_NOFS, |
1024 | BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER); | 937 | BLKDEV_IFL_WAIT | BLKDEV_IFL_BARRIER); |
1025 | } | 938 | } |
1026 | 939 | ||
@@ -1333,7 +1246,6 @@ static inline int blk_integrity_rq(struct request *rq) | |||
1333 | struct block_device_operations { | 1246 | struct block_device_operations { |
1334 | int (*open) (struct block_device *, fmode_t); | 1247 | int (*open) (struct block_device *, fmode_t); |
1335 | int (*release) (struct gendisk *, fmode_t); | 1248 | int (*release) (struct gendisk *, fmode_t); |
1336 | int (*locked_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); | ||
1337 | int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); | 1249 | int (*ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); |
1338 | int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); | 1250 | int (*compat_ioctl) (struct block_device *, fmode_t, unsigned, unsigned long); |
1339 | int (*direct_access) (struct block_device *, sector_t, | 1251 | int (*direct_access) (struct block_device *, sector_t, |
diff --git a/include/linux/blktrace_api.h b/include/linux/blktrace_api.h index 416bf62d6d46..3395cf7130f5 100644 --- a/include/linux/blktrace_api.h +++ b/include/linux/blktrace_api.h | |||
@@ -5,6 +5,7 @@ | |||
5 | #ifdef __KERNEL__ | 5 | #ifdef __KERNEL__ |
6 | #include <linux/blkdev.h> | 6 | #include <linux/blkdev.h> |
7 | #include <linux/relay.h> | 7 | #include <linux/relay.h> |
8 | #include <linux/compat.h> | ||
8 | #endif | 9 | #endif |
9 | 10 | ||
10 | /* | 11 | /* |
@@ -220,11 +221,26 @@ static inline int blk_trace_init_sysfs(struct device *dev) | |||
220 | 221 | ||
221 | #endif /* CONFIG_BLK_DEV_IO_TRACE */ | 222 | #endif /* CONFIG_BLK_DEV_IO_TRACE */ |
222 | 223 | ||
224 | #ifdef CONFIG_COMPAT | ||
225 | |||
226 | struct compat_blk_user_trace_setup { | ||
227 | char name[32]; | ||
228 | u16 act_mask; | ||
229 | u32 buf_size; | ||
230 | u32 buf_nr; | ||
231 | compat_u64 start_lba; | ||
232 | compat_u64 end_lba; | ||
233 | u32 pid; | ||
234 | }; | ||
235 | #define BLKTRACESETUP32 _IOWR(0x12, 115, struct compat_blk_user_trace_setup) | ||
236 | |||
237 | #endif | ||
238 | |||
223 | #if defined(CONFIG_EVENT_TRACING) && defined(CONFIG_BLOCK) | 239 | #if defined(CONFIG_EVENT_TRACING) && defined(CONFIG_BLOCK) |
224 | 240 | ||
225 | static inline int blk_cmd_buf_len(struct request *rq) | 241 | static inline int blk_cmd_buf_len(struct request *rq) |
226 | { | 242 | { |
227 | return blk_pc_request(rq) ? rq->cmd_len * 3 : 1; | 243 | return (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? rq->cmd_len * 3 : 1; |
228 | } | 244 | } |
229 | 245 | ||
230 | extern void blk_dump_cmd(char *buf, struct request *rq); | 246 | extern void blk_dump_cmd(char *buf, struct request *rq); |
diff --git a/include/linux/coda_psdev.h b/include/linux/coda_psdev.h index 8859e2ede9fe..284b520934a0 100644 --- a/include/linux/coda_psdev.h +++ b/include/linux/coda_psdev.h | |||
@@ -86,9 +86,9 @@ struct upc_req { | |||
86 | wait_queue_head_t uc_sleep; /* process' wait queue */ | 86 | wait_queue_head_t uc_sleep; /* process' wait queue */ |
87 | }; | 87 | }; |
88 | 88 | ||
89 | #define REQ_ASYNC 0x1 | 89 | #define CODA_REQ_ASYNC 0x1 |
90 | #define REQ_READ 0x2 | 90 | #define CODA_REQ_READ 0x2 |
91 | #define REQ_WRITE 0x4 | 91 | #define CODA_REQ_WRITE 0x4 |
92 | #define REQ_ABORT 0x8 | 92 | #define CODA_REQ_ABORT 0x8 |
93 | 93 | ||
94 | #endif | 94 | #endif |
diff --git a/include/linux/console_struct.h b/include/linux/console_struct.h index 38fe59dc89ae..7f0c32908568 100644 --- a/include/linux/console_struct.h +++ b/include/linux/console_struct.h | |||
@@ -21,6 +21,8 @@ struct vt_struct; | |||
21 | #define NPAR 16 | 21 | #define NPAR 16 |
22 | 22 | ||
23 | struct vc_data { | 23 | struct vc_data { |
24 | struct tty_port port; /* Upper level data */ | ||
25 | |||
24 | unsigned short vc_num; /* Console number */ | 26 | unsigned short vc_num; /* Console number */ |
25 | unsigned int vc_cols; /* [#] Console size */ | 27 | unsigned int vc_cols; /* [#] Console size */ |
26 | unsigned int vc_rows; | 28 | unsigned int vc_rows; |
@@ -56,7 +58,6 @@ struct vc_data { | |||
56 | /* VT terminal data */ | 58 | /* VT terminal data */ |
57 | unsigned int vc_state; /* Escape sequence parser state */ | 59 | unsigned int vc_state; /* Escape sequence parser state */ |
58 | unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */ | 60 | unsigned int vc_npar,vc_par[NPAR]; /* Parameters of current escape sequence */ |
59 | struct tty_struct *vc_tty; /* TTY we are attached to */ | ||
60 | /* data for manual vt switching */ | 61 | /* data for manual vt switching */ |
61 | struct vt_mode vt_mode; | 62 | struct vt_mode vt_mode; |
62 | struct pid *vt_pid; | 63 | struct pid *vt_pid; |
@@ -105,6 +106,7 @@ struct vc_data { | |||
105 | struct vc_data **vc_display_fg; /* [!] Ptr to var holding fg console for this display */ | 106 | struct vc_data **vc_display_fg; /* [!] Ptr to var holding fg console for this display */ |
106 | unsigned long vc_uni_pagedir; | 107 | unsigned long vc_uni_pagedir; |
107 | unsigned long *vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */ | 108 | unsigned long *vc_uni_pagedir_loc; /* [!] Location of uni_pagedir variable for this console */ |
109 | bool vc_panic_force_write; /* when oops/panic this VC can accept forced output/blanking */ | ||
108 | /* additional information is in vt_kern.h */ | 110 | /* additional information is in vt_kern.h */ |
109 | }; | 111 | }; |
110 | 112 | ||
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 89b7e1a605b8..e0670a512056 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h | |||
@@ -142,6 +142,14 @@ static inline int dma_set_seg_boundary(struct device *dev, unsigned long mask) | |||
142 | return -EIO; | 142 | return -EIO; |
143 | } | 143 | } |
144 | 144 | ||
145 | static inline int dma_get_cache_alignment(void) | ||
146 | { | ||
147 | #ifdef ARCH_DMA_MINALIGN | ||
148 | return ARCH_DMA_MINALIGN; | ||
149 | #endif | ||
150 | return 1; | ||
151 | } | ||
152 | |||
145 | /* flags for the coherent memory api */ | 153 | /* flags for the coherent memory api */ |
146 | #define DMA_MEMORY_MAP 0x01 | 154 | #define DMA_MEMORY_MAP 0x01 |
147 | #define DMA_MEMORY_IO 0x02 | 155 | #define DMA_MEMORY_IO 0x02 |
diff --git a/include/linux/drbd.h b/include/linux/drbd.h index b8d2516668aa..479ee3a1d901 100644 --- a/include/linux/drbd.h +++ b/include/linux/drbd.h | |||
@@ -53,7 +53,7 @@ | |||
53 | 53 | ||
54 | 54 | ||
55 | extern const char *drbd_buildtag(void); | 55 | extern const char *drbd_buildtag(void); |
56 | #define REL_VERSION "8.3.8" | 56 | #define REL_VERSION "8.3.8.1" |
57 | #define API_VERSION 88 | 57 | #define API_VERSION 88 |
58 | #define PRO_VERSION_MIN 86 | 58 | #define PRO_VERSION_MIN 86 |
59 | #define PRO_VERSION_MAX 94 | 59 | #define PRO_VERSION_MAX 94 |
diff --git a/include/linux/drbd_nl.h b/include/linux/drbd_nl.h index ce77a746fc9d..5f042810a56c 100644 --- a/include/linux/drbd_nl.h +++ b/include/linux/drbd_nl.h | |||
@@ -78,10 +78,11 @@ NL_PACKET(syncer_conf, 8, | |||
78 | NL_INTEGER( 30, T_MAY_IGNORE, rate) | 78 | NL_INTEGER( 30, T_MAY_IGNORE, rate) |
79 | NL_INTEGER( 31, T_MAY_IGNORE, after) | 79 | NL_INTEGER( 31, T_MAY_IGNORE, after) |
80 | NL_INTEGER( 32, T_MAY_IGNORE, al_extents) | 80 | NL_INTEGER( 32, T_MAY_IGNORE, al_extents) |
81 | NL_INTEGER( 71, T_MAY_IGNORE, dp_volume) | 81 | /* NL_INTEGER( 71, T_MAY_IGNORE, dp_volume) |
82 | NL_INTEGER( 72, T_MAY_IGNORE, dp_interval) | 82 | * NL_INTEGER( 72, T_MAY_IGNORE, dp_interval) |
83 | NL_INTEGER( 73, T_MAY_IGNORE, throttle_th) | 83 | * NL_INTEGER( 73, T_MAY_IGNORE, throttle_th) |
84 | NL_INTEGER( 74, T_MAY_IGNORE, hold_off_th) | 84 | * NL_INTEGER( 74, T_MAY_IGNORE, hold_off_th) |
85 | * feature will be reimplemented differently with 8.3.9 */ | ||
85 | NL_STRING( 52, T_MAY_IGNORE, verify_alg, SHARED_SECRET_MAX) | 86 | NL_STRING( 52, T_MAY_IGNORE, verify_alg, SHARED_SECRET_MAX) |
86 | NL_STRING( 51, T_MAY_IGNORE, cpu_mask, 32) | 87 | NL_STRING( 51, T_MAY_IGNORE, cpu_mask, 32) |
87 | NL_STRING( 64, T_MAY_IGNORE, csums_alg, SHARED_SECRET_MAX) | 88 | NL_STRING( 64, T_MAY_IGNORE, csums_alg, SHARED_SECRET_MAX) |
diff --git a/include/linux/fb.h b/include/linux/fb.h index 0c5659c41b01..f0268deca658 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h | |||
@@ -825,6 +825,10 @@ struct fb_tile_ops { | |||
825 | */ | 825 | */ |
826 | #define FBINFO_BE_MATH 0x100000 | 826 | #define FBINFO_BE_MATH 0x100000 |
827 | 827 | ||
828 | /* report to the VT layer that this fb driver can accept forced console | ||
829 | output like oopses */ | ||
830 | #define FBINFO_CAN_FORCE_OUTPUT 0x200000 | ||
831 | |||
828 | struct fb_info { | 832 | struct fb_info { |
829 | int node; | 833 | int node; |
830 | int flags; | 834 | int flags; |
diff --git a/include/linux/fs.h b/include/linux/fs.h index a8ccf85b8691..267d02630517 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -8,6 +8,7 @@ | |||
8 | 8 | ||
9 | #include <linux/limits.h> | 9 | #include <linux/limits.h> |
10 | #include <linux/ioctl.h> | 10 | #include <linux/ioctl.h> |
11 | #include <linux/blk_types.h> | ||
11 | 12 | ||
12 | /* | 13 | /* |
13 | * It's silly to have NR_OPEN bigger than NR_FILE, but you can change | 14 | * It's silly to have NR_OPEN bigger than NR_FILE, but you can change |
@@ -92,7 +93,7 @@ struct inodes_stat_t { | |||
92 | #define FMODE_RANDOM ((__force fmode_t)0x1000) | 93 | #define FMODE_RANDOM ((__force fmode_t)0x1000) |
93 | 94 | ||
94 | /* File was opened by fanotify and shouldn't generate fanotify events */ | 95 | /* File was opened by fanotify and shouldn't generate fanotify events */ |
95 | #define FMODE_NONOTIFY ((__force fmode_t)16777216) /* 0x1000000 */ | 96 | #define FMODE_NONOTIFY ((__force fmode_t)0x1000000) |
96 | 97 | ||
97 | /* | 98 | /* |
98 | * The below are the various read and write types that we support. Some of | 99 | * The below are the various read and write types that we support. Some of |
@@ -121,7 +122,7 @@ struct inodes_stat_t { | |||
121 | * immediately wait on this read without caring about | 122 | * immediately wait on this read without caring about |
122 | * unplugging. | 123 | * unplugging. |
123 | * READA Used for read-ahead operations. Lower priority, and the | 124 | * READA Used for read-ahead operations. Lower priority, and the |
124 | * block layer could (in theory) choose to ignore this | 125 | * block layer could (in theory) choose to ignore this |
125 | * request if it runs into resource problems. | 126 | * request if it runs into resource problems. |
126 | * WRITE A normal async write. Device will be plugged. | 127 | * WRITE A normal async write. Device will be plugged. |
127 | * SWRITE Like WRITE, but a special case for ll_rw_block() that | 128 | * SWRITE Like WRITE, but a special case for ll_rw_block() that |
@@ -140,7 +141,7 @@ struct inodes_stat_t { | |||
140 | * SWRITE_SYNC | 141 | * SWRITE_SYNC |
141 | * SWRITE_SYNC_PLUG Like WRITE_SYNC/WRITE_SYNC_PLUG, but locks the buffer. | 142 | * SWRITE_SYNC_PLUG Like WRITE_SYNC/WRITE_SYNC_PLUG, but locks the buffer. |
142 | * See SWRITE. | 143 | * See SWRITE. |
143 | * WRITE_BARRIER Like WRITE, but tells the block layer that all | 144 | * WRITE_BARRIER Like WRITE_SYNC, but tells the block layer that all |
144 | * previously submitted writes must be safely on storage | 145 | * previously submitted writes must be safely on storage |
145 | * before this one is started. Also guarantees that when | 146 | * before this one is started. Also guarantees that when |
146 | * this write is complete, it itself is also safely on | 147 | * this write is complete, it itself is also safely on |
@@ -148,29 +149,31 @@ struct inodes_stat_t { | |||
148 | * of this IO. | 149 | * of this IO. |
149 | * | 150 | * |
150 | */ | 151 | */ |
151 | #define RW_MASK 1 | 152 | #define RW_MASK REQ_WRITE |
152 | #define RWA_MASK 2 | 153 | #define RWA_MASK REQ_RAHEAD |
153 | #define READ 0 | 154 | |
154 | #define WRITE 1 | 155 | #define READ 0 |
155 | #define READA 2 /* read-ahead - don't block if no resources */ | 156 | #define WRITE RW_MASK |
156 | #define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */ | 157 | #define READA RWA_MASK |
157 | #define READ_SYNC (READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) | 158 | #define SWRITE (WRITE | READA) |
158 | #define READ_META (READ | (1 << BIO_RW_META)) | 159 | |
159 | #define WRITE_SYNC_PLUG (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) | 160 | #define READ_SYNC (READ | REQ_SYNC | REQ_UNPLUG) |
160 | #define WRITE_SYNC (WRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) | 161 | #define READ_META (READ | REQ_META) |
161 | #define WRITE_ODIRECT_PLUG (WRITE | (1 << BIO_RW_SYNCIO)) | 162 | #define WRITE_SYNC_PLUG (WRITE | REQ_SYNC | REQ_NOIDLE) |
162 | #define WRITE_META (WRITE | (1 << BIO_RW_META)) | 163 | #define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG) |
163 | #define SWRITE_SYNC_PLUG \ | 164 | #define WRITE_ODIRECT_PLUG (WRITE | REQ_SYNC) |
164 | (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) | 165 | #define WRITE_META (WRITE | REQ_META) |
165 | #define SWRITE_SYNC (SWRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) | 166 | #define WRITE_BARRIER (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \ |
166 | #define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER)) | 167 | REQ_HARDBARRIER) |
168 | #define SWRITE_SYNC_PLUG (SWRITE | REQ_SYNC | REQ_NOIDLE) | ||
169 | #define SWRITE_SYNC (SWRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG) | ||
167 | 170 | ||
168 | /* | 171 | /* |
169 | * These aren't really reads or writes, they pass down information about | 172 | * These aren't really reads or writes, they pass down information about |
170 | * parts of device that are now unused by the file system. | 173 | * parts of device that are now unused by the file system. |
171 | */ | 174 | */ |
172 | #define DISCARD_NOBARRIER (WRITE | (1 << BIO_RW_DISCARD)) | 175 | #define DISCARD_NOBARRIER (WRITE | REQ_DISCARD) |
173 | #define DISCARD_BARRIER (DISCARD_NOBARRIER | (1 << BIO_RW_BARRIER)) | 176 | #define DISCARD_BARRIER (WRITE | REQ_DISCARD | REQ_HARDBARRIER) |
174 | 177 | ||
175 | #define SEL_IN 1 | 178 | #define SEL_IN 1 |
176 | #define SEL_OUT 2 | 179 | #define SEL_OUT 2 |
@@ -2196,7 +2199,6 @@ static inline void insert_inode_hash(struct inode *inode) { | |||
2196 | extern void file_move(struct file *f, struct list_head *list); | 2199 | extern void file_move(struct file *f, struct list_head *list); |
2197 | extern void file_kill(struct file *f); | 2200 | extern void file_kill(struct file *f); |
2198 | #ifdef CONFIG_BLOCK | 2201 | #ifdef CONFIG_BLOCK |
2199 | struct bio; | ||
2200 | extern void submit_bio(int, struct bio *); | 2202 | extern void submit_bio(int, struct bio *); |
2201 | extern int bdev_read_only(struct block_device *); | 2203 | extern int bdev_read_only(struct block_device *); |
2202 | #endif | 2204 | #endif |
@@ -2263,7 +2265,6 @@ static inline int xip_truncate_page(struct address_space *mapping, loff_t from) | |||
2263 | #endif | 2265 | #endif |
2264 | 2266 | ||
2265 | #ifdef CONFIG_BLOCK | 2267 | #ifdef CONFIG_BLOCK |
2266 | struct bio; | ||
2267 | typedef void (dio_submit_t)(int rw, struct bio *bio, struct inode *inode, | 2268 | typedef void (dio_submit_t)(int rw, struct bio *bio, struct inode *inode, |
2268 | loff_t file_offset); | 2269 | loff_t file_offset); |
2269 | 2270 | ||
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h index cd0b3f30f48e..ce73a30113b4 100644 --- a/include/linux/gpio_keys.h +++ b/include/linux/gpio_keys.h | |||
@@ -17,6 +17,8 @@ struct gpio_keys_platform_data { | |||
17 | struct gpio_keys_button *buttons; | 17 | struct gpio_keys_button *buttons; |
18 | int nbuttons; | 18 | int nbuttons; |
19 | unsigned int rep:1; /* enable input subsystem auto repeat */ | 19 | unsigned int rep:1; /* enable input subsystem auto repeat */ |
20 | int (*enable)(struct device *dev); | ||
21 | void (*disable)(struct device *dev); | ||
20 | }; | 22 | }; |
21 | 23 | ||
22 | #endif | 24 | #endif |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 21067b418536..38dd4025aa4e 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -108,6 +108,7 @@ extern s32 i2c_smbus_write_i2c_block_data(struct i2c_client *client, | |||
108 | * @shutdown: Callback for device shutdown | 108 | * @shutdown: Callback for device shutdown |
109 | * @suspend: Callback for device suspend | 109 | * @suspend: Callback for device suspend |
110 | * @resume: Callback for device resume | 110 | * @resume: Callback for device resume |
111 | * @alert: Alert callback, for example for the SMBus alert protocol | ||
111 | * @command: Callback for bus-wide signaling (optional) | 112 | * @command: Callback for bus-wide signaling (optional) |
112 | * @driver: Device driver model driver | 113 | * @driver: Device driver model driver |
113 | * @id_table: List of I2C devices supported by this driver | 114 | * @id_table: List of I2C devices supported by this driver |
@@ -233,6 +234,7 @@ static inline void i2c_set_clientdata(struct i2c_client *dev, void *data) | |||
233 | * @addr: stored in i2c_client.addr | 234 | * @addr: stored in i2c_client.addr |
234 | * @platform_data: stored in i2c_client.dev.platform_data | 235 | * @platform_data: stored in i2c_client.dev.platform_data |
235 | * @archdata: copied into i2c_client.dev.archdata | 236 | * @archdata: copied into i2c_client.dev.archdata |
237 | * @of_node: pointer to OpenFirmware device node | ||
236 | * @irq: stored in i2c_client.irq | 238 | * @irq: stored in i2c_client.irq |
237 | * | 239 | * |
238 | * I2C doesn't actually support hardware probing, although controllers and | 240 | * I2C doesn't actually support hardware probing, although controllers and |
diff --git a/include/linux/i2c/sx150x.h b/include/linux/i2c/sx150x.h new file mode 100644 index 000000000000..ee3049cb9ba5 --- /dev/null +++ b/include/linux/i2c/sx150x.h | |||
@@ -0,0 +1,78 @@ | |||
1 | /* | ||
2 | * Driver for the Semtech SX150x I2C GPIO Expanders | ||
3 | * | ||
4 | * Copyright (c) 2010, Code Aurora Forum. All rights reserved. | ||
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 and | ||
8 | * only version 2 as published by the Free Software Foundation. | ||
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., 51 Franklin Street, Fifth Floor, Boston, MA | ||
18 | * 02110-1301, USA. | ||
19 | */ | ||
20 | #ifndef __LINUX_I2C_SX150X_H | ||
21 | #define __LINUX_I2C_SX150X_H | ||
22 | |||
23 | /** | ||
24 | * struct sx150x_platform_data - config data for SX150x driver | ||
25 | * @gpio_base: The index number of the first GPIO assigned to this | ||
26 | * GPIO expander. The expander will create a block of | ||
27 | * consecutively numbered gpios beginning at the given base, | ||
28 | * with the size of the block depending on the model of the | ||
29 | * expander chip. | ||
30 | * @oscio_is_gpo: If set to true, the driver will configure OSCIO as a GPO | ||
31 | * instead of as an oscillator, increasing the size of the | ||
32 | * GP(I)O pool created by this expander by one. The | ||
33 | * output-only GPO pin will be added at the end of the block. | ||
34 | * @io_pullup_ena: A bit-mask which enables or disables the pull-up resistor | ||
35 | * for each IO line in the expander. Setting the bit at | ||
36 | * position n will enable the pull-up for the IO at | ||
37 | * the corresponding offset. For chips with fewer than | ||
38 | * 16 IO pins, high-end bits are ignored. | ||
39 | * @io_pulldn_ena: A bit-mask which enables-or disables the pull-down | ||
40 | * resistor for each IO line in the expander. Setting the | ||
41 | * bit at position n will enable the pull-down for the IO at | ||
42 | * the corresponding offset. For chips with fewer than | ||
43 | * 16 IO pins, high-end bits are ignored. | ||
44 | * @io_open_drain_ena: A bit-mask which enables-or disables open-drain | ||
45 | * operation for each IO line in the expander. Setting the | ||
46 | * bit at position n enables open-drain operation for | ||
47 | * the IO at the corresponding offset. Clearing the bit | ||
48 | * enables regular push-pull operation for that IO. | ||
49 | * For chips with fewer than 16 IO pins, high-end bits | ||
50 | * are ignored. | ||
51 | * @io_polarity: A bit-mask which enables polarity inversion for each IO line | ||
52 | * in the expander. Setting the bit at position n inverts | ||
53 | * the polarity of that IO line, while clearing it results | ||
54 | * in normal polarity. For chips with fewer than 16 IO pins, | ||
55 | * high-end bits are ignored. | ||
56 | * @irq_summary: The 'summary IRQ' line to which the GPIO expander's INT line | ||
57 | * is connected, via which it reports interrupt events | ||
58 | * across all GPIO lines. This must be a real, | ||
59 | * pre-existing IRQ line. | ||
60 | * Setting this value < 0 disables the irq_chip functionality | ||
61 | * of the driver. | ||
62 | * @irq_base: The first 'virtual IRQ' line at which our block of GPIO-based | ||
63 | * IRQ lines will appear. Similarly to gpio_base, the expander | ||
64 | * will create a block of irqs beginning at this number. | ||
65 | * This value is ignored if irq_summary is < 0. | ||
66 | */ | ||
67 | struct sx150x_platform_data { | ||
68 | unsigned gpio_base; | ||
69 | bool oscio_is_gpo; | ||
70 | u16 io_pullup_ena; | ||
71 | u16 io_pulldn_ena; | ||
72 | u16 io_open_drain_ena; | ||
73 | u16 io_polarity; | ||
74 | int irq_summary; | ||
75 | unsigned irq_base; | ||
76 | }; | ||
77 | |||
78 | #endif /* __LINUX_I2C_SX150X_H */ | ||
diff --git a/include/linux/input.h b/include/linux/input.h index 339d043ccb53..896a92227bc4 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
@@ -776,6 +776,7 @@ struct input_absinfo { | |||
776 | #define REP_DELAY 0x00 | 776 | #define REP_DELAY 0x00 |
777 | #define REP_PERIOD 0x01 | 777 | #define REP_PERIOD 0x01 |
778 | #define REP_MAX 0x01 | 778 | #define REP_MAX 0x01 |
779 | #define REP_CNT (REP_MAX+1) | ||
779 | 780 | ||
780 | /* | 781 | /* |
781 | * Sounds | 782 | * Sounds |
@@ -1099,21 +1100,18 @@ struct input_mt_slot { | |||
1099 | * @repeat_key: stores key code of the last key pressed; used to implement | 1100 | * @repeat_key: stores key code of the last key pressed; used to implement |
1100 | * software autorepeat | 1101 | * software autorepeat |
1101 | * @timer: timer for software autorepeat | 1102 | * @timer: timer for software autorepeat |
1102 | * @abs: current values for reports from absolute axes | ||
1103 | * @rep: current values for autorepeat parameters (delay, rate) | 1103 | * @rep: current values for autorepeat parameters (delay, rate) |
1104 | * @mt: pointer to array of struct input_mt_slot holding current values | 1104 | * @mt: pointer to array of struct input_mt_slot holding current values |
1105 | * of tracked contacts | 1105 | * of tracked contacts |
1106 | * @mtsize: number of MT slots the device uses | 1106 | * @mtsize: number of MT slots the device uses |
1107 | * @slot: MT slot currently being transmitted | 1107 | * @slot: MT slot currently being transmitted |
1108 | * @absinfo: array of &struct absinfo elements holding information | ||
1109 | * about absolute axes (current value, min, max, flat, fuzz, | ||
1110 | * resolution) | ||
1108 | * @key: reflects current state of device's keys/buttons | 1111 | * @key: reflects current state of device's keys/buttons |
1109 | * @led: reflects current state of device's LEDs | 1112 | * @led: reflects current state of device's LEDs |
1110 | * @snd: reflects current state of sound effects | 1113 | * @snd: reflects current state of sound effects |
1111 | * @sw: reflects current state of device's switches | 1114 | * @sw: reflects current state of device's switches |
1112 | * @absmax: maximum values for events coming from absolute axes | ||
1113 | * @absmin: minimum values for events coming from absolute axes | ||
1114 | * @absfuzz: describes noisiness for axes | ||
1115 | * @absflat: size of the center flat position (used by joydev) | ||
1116 | * @absres: resolution used for events coming form absolute axes | ||
1117 | * @open: this method is called when the very first user calls | 1115 | * @open: this method is called when the very first user calls |
1118 | * input_open_device(). The driver must prepare the device | 1116 | * input_open_device(). The driver must prepare the device |
1119 | * to start generating events (start polling thread, | 1117 | * to start generating events (start polling thread, |
@@ -1180,24 +1178,19 @@ struct input_dev { | |||
1180 | unsigned int repeat_key; | 1178 | unsigned int repeat_key; |
1181 | struct timer_list timer; | 1179 | struct timer_list timer; |
1182 | 1180 | ||
1183 | int abs[ABS_CNT]; | 1181 | int rep[REP_CNT]; |
1184 | int rep[REP_MAX + 1]; | ||
1185 | 1182 | ||
1186 | struct input_mt_slot *mt; | 1183 | struct input_mt_slot *mt; |
1187 | int mtsize; | 1184 | int mtsize; |
1188 | int slot; | 1185 | int slot; |
1189 | 1186 | ||
1187 | struct input_absinfo *absinfo; | ||
1188 | |||
1190 | unsigned long key[BITS_TO_LONGS(KEY_CNT)]; | 1189 | unsigned long key[BITS_TO_LONGS(KEY_CNT)]; |
1191 | unsigned long led[BITS_TO_LONGS(LED_CNT)]; | 1190 | unsigned long led[BITS_TO_LONGS(LED_CNT)]; |
1192 | unsigned long snd[BITS_TO_LONGS(SND_CNT)]; | 1191 | unsigned long snd[BITS_TO_LONGS(SND_CNT)]; |
1193 | unsigned long sw[BITS_TO_LONGS(SW_CNT)]; | 1192 | unsigned long sw[BITS_TO_LONGS(SW_CNT)]; |
1194 | 1193 | ||
1195 | int absmax[ABS_CNT]; | ||
1196 | int absmin[ABS_CNT]; | ||
1197 | int absfuzz[ABS_CNT]; | ||
1198 | int absflat[ABS_CNT]; | ||
1199 | int absres[ABS_CNT]; | ||
1200 | |||
1201 | int (*open)(struct input_dev *dev); | 1194 | int (*open)(struct input_dev *dev); |
1202 | void (*close)(struct input_dev *dev); | 1195 | void (*close)(struct input_dev *dev); |
1203 | int (*flush)(struct input_dev *dev, struct file *file); | 1196 | int (*flush)(struct input_dev *dev, struct file *file); |
@@ -1459,16 +1452,32 @@ static inline void input_set_events_per_packet(struct input_dev *dev, int n_even | |||
1459 | dev->hint_events_per_packet = n_events; | 1452 | dev->hint_events_per_packet = n_events; |
1460 | } | 1453 | } |
1461 | 1454 | ||
1462 | static inline void input_set_abs_params(struct input_dev *dev, int axis, int min, int max, int fuzz, int flat) | 1455 | void input_alloc_absinfo(struct input_dev *dev); |
1463 | { | 1456 | void input_set_abs_params(struct input_dev *dev, unsigned int axis, |
1464 | dev->absmin[axis] = min; | 1457 | int min, int max, int fuzz, int flat); |
1465 | dev->absmax[axis] = max; | 1458 | |
1466 | dev->absfuzz[axis] = fuzz; | 1459 | #define INPUT_GENERATE_ABS_ACCESSORS(_suffix, _item) \ |
1467 | dev->absflat[axis] = flat; | 1460 | static inline int input_abs_get_##_suffix(struct input_dev *dev, \ |
1468 | 1461 | unsigned int axis) \ | |
1469 | dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis); | 1462 | { \ |
1463 | return dev->absinfo ? dev->absinfo[axis]._item : 0; \ | ||
1464 | } \ | ||
1465 | \ | ||
1466 | static inline void input_abs_set_##_suffix(struct input_dev *dev, \ | ||
1467 | unsigned int axis, int val) \ | ||
1468 | { \ | ||
1469 | input_alloc_absinfo(dev); \ | ||
1470 | if (dev->absinfo) \ | ||
1471 | dev->absinfo[axis]._item = val; \ | ||
1470 | } | 1472 | } |
1471 | 1473 | ||
1474 | INPUT_GENERATE_ABS_ACCESSORS(val, value) | ||
1475 | INPUT_GENERATE_ABS_ACCESSORS(min, minimum) | ||
1476 | INPUT_GENERATE_ABS_ACCESSORS(max, maximum) | ||
1477 | INPUT_GENERATE_ABS_ACCESSORS(fuzz, fuzz) | ||
1478 | INPUT_GENERATE_ABS_ACCESSORS(flat, flat) | ||
1479 | INPUT_GENERATE_ABS_ACCESSORS(res, resolution) | ||
1480 | |||
1472 | int input_get_keycode(struct input_dev *dev, | 1481 | int input_get_keycode(struct input_dev *dev, |
1473 | unsigned int scancode, unsigned int *keycode); | 1482 | unsigned int scancode, unsigned int *keycode); |
1474 | int input_set_keycode(struct input_dev *dev, | 1483 | int input_set_keycode(struct input_dev *dev, |
diff --git a/include/linux/istallion.h b/include/linux/istallion.h index 7faca98c7d14..ad700a60c158 100644 --- a/include/linux/istallion.h +++ b/include/linux/istallion.h | |||
@@ -86,7 +86,7 @@ struct stlibrd { | |||
86 | unsigned long magic; | 86 | unsigned long magic; |
87 | unsigned int brdnr; | 87 | unsigned int brdnr; |
88 | unsigned int brdtype; | 88 | unsigned int brdtype; |
89 | unsigned int state; | 89 | unsigned long state; |
90 | unsigned int nrpanels; | 90 | unsigned int nrpanels; |
91 | unsigned int nrports; | 91 | unsigned int nrports; |
92 | unsigned int nrdevs; | 92 | unsigned int nrdevs; |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 5b57236dfbd0..d848cb854655 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -177,11 +177,12 @@ struct va_format { | |||
177 | }; | 177 | }; |
178 | 178 | ||
179 | extern struct atomic_notifier_head panic_notifier_list; | 179 | extern struct atomic_notifier_head panic_notifier_list; |
180 | extern long (*panic_blink)(long time); | 180 | extern long (*panic_blink)(int state); |
181 | NORET_TYPE void panic(const char * fmt, ...) | 181 | NORET_TYPE void panic(const char * fmt, ...) |
182 | __attribute__ ((NORET_AND format (printf, 1, 2))) __cold; | 182 | __attribute__ ((NORET_AND format (printf, 1, 2))) __cold; |
183 | extern void oops_enter(void); | 183 | extern void oops_enter(void); |
184 | extern void oops_exit(void); | 184 | extern void oops_exit(void); |
185 | void print_oops_end_marker(void); | ||
185 | extern int oops_may_print(void); | 186 | extern int oops_may_print(void); |
186 | NORET_TYPE void do_exit(long error_code) | 187 | NORET_TYPE void do_exit(long error_code) |
187 | ATTRIB_NORET; | 188 | ATTRIB_NORET; |
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h index 9fad0527344f..311f8753d713 100644 --- a/include/linux/kfifo.h +++ b/include/linux/kfifo.h | |||
@@ -1,8 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * A generic kernel FIFO implementation. | 2 | * A generic kernel FIFO implementation |
3 | * | 3 | * |
4 | * Copyright (C) 2009 Stefani Seibold <stefani@seibold.net> | 4 | * Copyright (C) 2009/2010 Stefani Seibold <stefani@seibold.net> |
5 | * Copyright (C) 2004 Stelian Pop <stelian@popies.net> | ||
6 | * | 5 | * |
7 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
@@ -20,8 +19,11 @@ | |||
20 | * | 19 | * |
21 | */ | 20 | */ |
22 | 21 | ||
22 | #ifndef _LINUX_KFIFO_H | ||
23 | #define _LINUX_KFIFO_H | ||
24 | |||
23 | /* | 25 | /* |
24 | * Howto porting drivers to the new generic fifo API: | 26 | * How to porting drivers to the new generic FIFO API: |
25 | * | 27 | * |
26 | * - Modify the declaration of the "struct kfifo *" object into a | 28 | * - Modify the declaration of the "struct kfifo *" object into a |
27 | * in-place "struct kfifo" object | 29 | * in-place "struct kfifo" object |
@@ -30,586 +32,813 @@ | |||
30 | * passed as the first argument to this functions | 32 | * passed as the first argument to this functions |
31 | * - Replace the use of __kfifo_put into kfifo_in and __kfifo_get | 33 | * - Replace the use of __kfifo_put into kfifo_in and __kfifo_get |
32 | * into kfifo_out | 34 | * into kfifo_out |
33 | * - Replace the use of kfifo_put into kfifo_in_locked and kfifo_get | 35 | * - Replace the use of kfifo_put into kfifo_in_spinlocked and kfifo_get |
34 | * into kfifo_out_locked | 36 | * into kfifo_out_spinlocked |
35 | * Note: the spinlock pointer formerly passed to kfifo_init/kfifo_alloc | 37 | * 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 | 38 | * must be passed now to the kfifo_in_spinlocked and kfifo_out_spinlocked |
37 | * as the last parameter. | 39 | * as the last parameter |
38 | * - All formerly name __kfifo_* functions has been renamed into kfifo_* | 40 | * - The formerly __kfifo_* functions are renamed into kfifo_* |
39 | */ | 41 | */ |
40 | 42 | ||
41 | #ifndef _LINUX_KFIFO_H | 43 | /* |
42 | #define _LINUX_KFIFO_H | 44 | * Note about locking : There is no locking required until only * one reader |
45 | * and one writer is using the fifo and no kfifo_reset() will be * called | ||
46 | * kfifo_reset_out() can be safely used, until it will be only called | ||
47 | * in the reader thread. | ||
48 | * For multiple writer and one reader there is only a need to lock the writer. | ||
49 | * And vice versa for only one writer and multiple reader there is only a need | ||
50 | * to lock the reader. | ||
51 | */ | ||
43 | 52 | ||
44 | #include <linux/kernel.h> | 53 | #include <linux/kernel.h> |
45 | #include <linux/spinlock.h> | 54 | #include <linux/spinlock.h> |
46 | 55 | #include <linux/stddef.h> | |
47 | struct kfifo { | 56 | #include <linux/scatterlist.h> |
48 | unsigned char *buffer; /* the buffer holding the data */ | 57 | |
49 | unsigned int size; /* the size of the allocated buffer */ | 58 | struct __kfifo { |
50 | unsigned int in; /* data is added at offset (in % size) */ | 59 | unsigned int in; |
51 | unsigned int out; /* data is extracted from off. (out % size) */ | 60 | unsigned int out; |
61 | unsigned int mask; | ||
62 | unsigned int esize; | ||
63 | void *data; | ||
52 | }; | 64 | }; |
53 | 65 | ||
54 | /* | 66 | #define __STRUCT_KFIFO_COMMON(datatype, recsize, ptrtype) \ |
55 | * Macros for declaration and initialization of the kfifo datatype | 67 | union { \ |
56 | */ | 68 | struct __kfifo kfifo; \ |
57 | 69 | datatype *type; \ | |
58 | /* helper macro */ | 70 | char (*rectype)[recsize]; \ |
59 | #define __kfifo_initializer(s, b) \ | 71 | ptrtype *ptr; \ |
60 | (struct kfifo) { \ | 72 | const ptrtype *ptr_const; \ |
61 | .size = s, \ | ||
62 | .in = 0, \ | ||
63 | .out = 0, \ | ||
64 | .buffer = b \ | ||
65 | } | 73 | } |
66 | 74 | ||
67 | /** | 75 | #define __STRUCT_KFIFO(type, size, recsize, ptrtype) \ |
68 | * DECLARE_KFIFO - macro to declare a kfifo and the associated buffer | 76 | { \ |
69 | * @name: name of the declared kfifo datatype | 77 | __STRUCT_KFIFO_COMMON(type, recsize, ptrtype); \ |
70 | * @size: size of the fifo buffer. Must be a power of two. | 78 | type buf[((size < 2) || (size & (size - 1))) ? -1 : size]; \ |
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 | } | 79 | } |
82 | 80 | ||
83 | /** | 81 | #define STRUCT_KFIFO(type, size) \ |
84 | * INIT_KFIFO - Initialize a kfifo declared by DECLARE_KFIFO | 82 | struct __STRUCT_KFIFO(type, size, 0, type) |
85 | * @name: name of the declared kfifo datatype | 83 | |
84 | #define __STRUCT_KFIFO_PTR(type, recsize, ptrtype) \ | ||
85 | { \ | ||
86 | __STRUCT_KFIFO_COMMON(type, recsize, ptrtype); \ | ||
87 | type buf[0]; \ | ||
88 | } | ||
89 | |||
90 | #define STRUCT_KFIFO_PTR(type) \ | ||
91 | struct __STRUCT_KFIFO_PTR(type, 0, type) | ||
92 | |||
93 | /* | ||
94 | * define compatibility "struct kfifo" for dynamic allocated fifos | ||
86 | */ | 95 | */ |
87 | #define INIT_KFIFO(name) \ | 96 | struct kfifo __STRUCT_KFIFO_PTR(unsigned char, 0, void); |
88 | name = __kfifo_initializer(sizeof(name##kfifo_buffer) - \ | ||
89 | sizeof(struct kfifo), \ | ||
90 | name##kfifo_buffer + sizeof(struct kfifo)) | ||
91 | 97 | ||
92 | /** | 98 | #define STRUCT_KFIFO_REC_1(size) \ |
93 | * DEFINE_KFIFO - macro to define and initialize a kfifo | 99 | struct __STRUCT_KFIFO(unsigned char, size, 1, void) |
94 | * @name: name of the declared kfifo datatype | 100 | |
95 | * @size: size of the fifo buffer. Must be a power of two. | 101 | #define STRUCT_KFIFO_REC_2(size) \ |
96 | * | 102 | struct __STRUCT_KFIFO(unsigned char, size, 2, void) |
97 | * Note1: the macro can be used for global and local kfifo data type variables | 103 | |
98 | * Note2: the macro creates two objects: | 104 | /* |
99 | * A kfifo object with the given name and a buffer for the kfifo | 105 | * define kfifo_rec types |
100 | * object named name##kfifo_buffer | ||
101 | */ | 106 | */ |
102 | #define DEFINE_KFIFO(name, size) \ | 107 | struct kfifo_rec_ptr_1 __STRUCT_KFIFO_PTR(unsigned char, 1, void); |
103 | unsigned char name##kfifo_buffer[size]; \ | 108 | struct kfifo_rec_ptr_2 __STRUCT_KFIFO_PTR(unsigned char, 2, void); |
104 | struct kfifo name = __kfifo_initializer(size, name##kfifo_buffer) | ||
105 | 109 | ||
106 | extern void kfifo_init(struct kfifo *fifo, void *buffer, | 110 | /* |
107 | unsigned int size); | 111 | * helper macro to distinguish between real in place fifo where the fifo |
108 | extern __must_check int kfifo_alloc(struct kfifo *fifo, unsigned int size, | 112 | * array is a part of the structure and the fifo type where the array is |
109 | gfp_t gfp_mask); | 113 | * outside of the fifo structure. |
110 | extern void kfifo_free(struct kfifo *fifo); | 114 | */ |
111 | extern unsigned int kfifo_in(struct kfifo *fifo, | 115 | #define __is_kfifo_ptr(fifo) (sizeof(*fifo) == sizeof(struct __kfifo)) |
112 | const void *from, unsigned int len); | ||
113 | extern __must_check unsigned int kfifo_out(struct kfifo *fifo, | ||
114 | void *to, unsigned int len); | ||
115 | extern __must_check unsigned int kfifo_out_peek(struct kfifo *fifo, | ||
116 | void *to, unsigned int len, unsigned offset); | ||
117 | 116 | ||
118 | /** | 117 | /** |
119 | * kfifo_initialized - Check if kfifo is initialized. | 118 | * DECLARE_KFIFO_PTR - macro to declare a fifo pointer object |
120 | * @fifo: fifo to check | 119 | * @fifo: name of the declared fifo |
121 | * Return %true if FIFO is initialized, otherwise %false. | 120 | * @type: type of the fifo elements |
122 | * Assumes the fifo was 0 before. | ||
123 | */ | 121 | */ |
124 | static inline bool kfifo_initialized(struct kfifo *fifo) | 122 | #define DECLARE_KFIFO_PTR(fifo, type) STRUCT_KFIFO_PTR(type) fifo |
125 | { | ||
126 | return fifo->buffer != NULL; | ||
127 | } | ||
128 | 123 | ||
129 | /** | 124 | /** |
130 | * kfifo_reset - removes the entire FIFO contents | 125 | * DECLARE_KFIFO - macro to declare a fifo object |
131 | * @fifo: the fifo to be emptied. | 126 | * @fifo: name of the declared fifo |
127 | * @type: type of the fifo elements | ||
128 | * @size: the number of elements in the fifo, this must be a power of 2 | ||
132 | */ | 129 | */ |
133 | static inline void kfifo_reset(struct kfifo *fifo) | 130 | #define DECLARE_KFIFO(fifo, type, size) STRUCT_KFIFO(type, size) fifo |
134 | { | ||
135 | fifo->in = fifo->out = 0; | ||
136 | } | ||
137 | 131 | ||
138 | /** | 132 | /** |
139 | * kfifo_reset_out - skip FIFO contents | 133 | * INIT_KFIFO - Initialize a fifo declared by DECLARE_KFIFO |
140 | * @fifo: the fifo to be emptied. | 134 | * @fifo: name of the declared fifo datatype |
141 | */ | 135 | */ |
142 | static inline void kfifo_reset_out(struct kfifo *fifo) | 136 | #define INIT_KFIFO(fifo) \ |
143 | { | 137 | (void)({ \ |
144 | smp_mb(); | 138 | typeof(&(fifo)) __tmp = &(fifo); \ |
145 | fifo->out = fifo->in; | 139 | struct __kfifo *__kfifo = &__tmp->kfifo; \ |
146 | } | 140 | __kfifo->in = 0; \ |
141 | __kfifo->out = 0; \ | ||
142 | __kfifo->mask = __is_kfifo_ptr(__tmp) ? 0 : ARRAY_SIZE(__tmp->buf) - 1;\ | ||
143 | __kfifo->esize = sizeof(*__tmp->buf); \ | ||
144 | __kfifo->data = __is_kfifo_ptr(__tmp) ? NULL : __tmp->buf; \ | ||
145 | }) | ||
147 | 146 | ||
148 | /** | 147 | /** |
149 | * kfifo_size - returns the size of the fifo in bytes | 148 | * DEFINE_KFIFO - macro to define and initialize a fifo |
150 | * @fifo: the fifo to be used. | 149 | * @fifo: name of the declared fifo datatype |
151 | */ | 150 | * @type: type of the fifo elements |
152 | static inline __must_check unsigned int kfifo_size(struct kfifo *fifo) | 151 | * @size: the number of elements in the fifo, this must be a power of 2 |
152 | * | ||
153 | * Note: the macro can be used for global and local fifo data type variables. | ||
154 | */ | ||
155 | #define DEFINE_KFIFO(fifo, type, size) \ | ||
156 | DECLARE_KFIFO(fifo, type, size) = \ | ||
157 | (typeof(fifo)) { \ | ||
158 | { \ | ||
159 | { \ | ||
160 | .in = 0, \ | ||
161 | .out = 0, \ | ||
162 | .mask = __is_kfifo_ptr(&(fifo)) ? \ | ||
163 | 0 : \ | ||
164 | ARRAY_SIZE((fifo).buf) - 1, \ | ||
165 | .esize = sizeof(*(fifo).buf), \ | ||
166 | .data = __is_kfifo_ptr(&(fifo)) ? \ | ||
167 | NULL : \ | ||
168 | (fifo).buf, \ | ||
169 | } \ | ||
170 | } \ | ||
171 | } | ||
172 | |||
173 | |||
174 | static inline unsigned int __must_check | ||
175 | __kfifo_must_check_helper(unsigned int val) | ||
153 | { | 176 | { |
154 | return fifo->size; | 177 | return val; |
155 | } | 178 | } |
156 | 179 | ||
157 | /** | 180 | /** |
158 | * kfifo_len - returns the number of used bytes in the FIFO | 181 | * kfifo_initialized - Check if the fifo is initialized |
159 | * @fifo: the fifo to be used. | 182 | * @fifo: address of the fifo to check |
183 | * | ||
184 | * Return %true if fifo is initialized, otherwise %false. | ||
185 | * Assumes the fifo was 0 before. | ||
160 | */ | 186 | */ |
161 | static inline unsigned int kfifo_len(struct kfifo *fifo) | 187 | #define kfifo_initialized(fifo) ((fifo)->kfifo.mask) |
162 | { | ||
163 | register unsigned int out; | ||
164 | |||
165 | out = fifo->out; | ||
166 | smp_rmb(); | ||
167 | return fifo->in - out; | ||
168 | } | ||
169 | 188 | ||
170 | /** | 189 | /** |
171 | * kfifo_is_empty - returns true if the fifo is empty | 190 | * kfifo_esize - returns the size of the element managed by the fifo |
172 | * @fifo: the fifo to be used. | 191 | * @fifo: address of the fifo to be used |
173 | */ | 192 | */ |
174 | static inline __must_check int kfifo_is_empty(struct kfifo *fifo) | 193 | #define kfifo_esize(fifo) ((fifo)->kfifo.esize) |
175 | { | ||
176 | return fifo->in == fifo->out; | ||
177 | } | ||
178 | 194 | ||
179 | /** | 195 | /** |
180 | * kfifo_is_full - returns true if the fifo is full | 196 | * kfifo_recsize - returns the size of the record length field |
181 | * @fifo: the fifo to be used. | 197 | * @fifo: address of the fifo to be used |
182 | */ | 198 | */ |
183 | static inline __must_check int kfifo_is_full(struct kfifo *fifo) | 199 | #define kfifo_recsize(fifo) (sizeof(*(fifo)->rectype)) |
184 | { | ||
185 | return kfifo_len(fifo) == kfifo_size(fifo); | ||
186 | } | ||
187 | 200 | ||
188 | /** | 201 | /** |
189 | * kfifo_avail - returns the number of bytes available in the FIFO | 202 | * kfifo_size - returns the size of the fifo in elements |
190 | * @fifo: the fifo to be used. | 203 | * @fifo: address of the fifo to be used |
191 | */ | 204 | */ |
192 | static inline __must_check unsigned int kfifo_avail(struct kfifo *fifo) | 205 | #define kfifo_size(fifo) ((fifo)->kfifo.mask + 1) |
193 | { | ||
194 | return kfifo_size(fifo) - kfifo_len(fifo); | ||
195 | } | ||
196 | 206 | ||
197 | /** | 207 | /** |
198 | * kfifo_in_locked - puts some data into the FIFO using a spinlock for locking | 208 | * kfifo_reset - removes the entire fifo content |
199 | * @fifo: the fifo to be used. | 209 | * @fifo: address of the fifo to be used |
200 | * @from: the data to be added. | ||
201 | * @n: the length of the data to be added. | ||
202 | * @lock: pointer to the spinlock to use for locking. | ||
203 | * | 210 | * |
204 | * This function copies at most @n bytes from the @from buffer into | 211 | * Note: usage of kfifo_reset() is dangerous. It should be only called when the |
205 | * the FIFO depending on the free space, and returns the number of | 212 | * fifo is exclusived locked or when it is secured that no other thread is |
206 | * bytes copied. | 213 | * accessing the fifo. |
207 | */ | 214 | */ |
208 | static inline unsigned int kfifo_in_locked(struct kfifo *fifo, | 215 | #define kfifo_reset(fifo) \ |
209 | const void *from, unsigned int n, spinlock_t *lock) | 216 | (void)({ \ |
210 | { | 217 | typeof(fifo + 1) __tmp = (fifo); \ |
211 | unsigned long flags; | 218 | __tmp->kfifo.in = __tmp->kfifo.out = 0; \ |
212 | unsigned int ret; | 219 | }) |
213 | |||
214 | spin_lock_irqsave(lock, flags); | ||
215 | |||
216 | ret = kfifo_in(fifo, from, n); | ||
217 | |||
218 | spin_unlock_irqrestore(lock, flags); | ||
219 | |||
220 | return ret; | ||
221 | } | ||
222 | 220 | ||
223 | /** | 221 | /** |
224 | * kfifo_out_locked - gets some data from the FIFO using a spinlock for locking | 222 | * kfifo_reset_out - skip fifo content |
225 | * @fifo: the fifo to be used. | 223 | * @fifo: address of the fifo to be used |
226 | * @to: where the data must be copied. | ||
227 | * @n: the size of the destination buffer. | ||
228 | * @lock: pointer to the spinlock to use for locking. | ||
229 | * | 224 | * |
230 | * This function copies at most @n bytes from the FIFO into the | 225 | * Note: The usage of kfifo_reset_out() is safe until it will be only called |
231 | * @to buffer and returns the number of copied bytes. | 226 | * from the reader thread and there is only one concurrent reader. Otherwise |
232 | */ | 227 | * it is dangerous and must be handled in the same way as kfifo_reset(). |
233 | static inline __must_check unsigned int kfifo_out_locked(struct kfifo *fifo, | ||
234 | void *to, unsigned int n, spinlock_t *lock) | ||
235 | { | ||
236 | unsigned long flags; | ||
237 | unsigned int ret; | ||
238 | |||
239 | spin_lock_irqsave(lock, flags); | ||
240 | |||
241 | ret = kfifo_out(fifo, to, n); | ||
242 | |||
243 | spin_unlock_irqrestore(lock, flags); | ||
244 | |||
245 | return ret; | ||
246 | } | ||
247 | |||
248 | extern void kfifo_skip(struct kfifo *fifo, unsigned int len); | ||
249 | |||
250 | extern __must_check int kfifo_from_user(struct kfifo *fifo, | ||
251 | const void __user *from, unsigned int n, unsigned *lenout); | ||
252 | |||
253 | extern __must_check int kfifo_to_user(struct kfifo *fifo, | ||
254 | void __user *to, unsigned int n, unsigned *lenout); | ||
255 | |||
256 | /* | ||
257 | * __kfifo_add_out internal helper function for updating the out offset | ||
258 | */ | 228 | */ |
259 | static inline void __kfifo_add_out(struct kfifo *fifo, | 229 | #define kfifo_reset_out(fifo) \ |
260 | unsigned int off) | 230 | (void)({ \ |
261 | { | 231 | typeof(fifo + 1) __tmp = (fifo); \ |
262 | smp_mb(); | 232 | __tmp->kfifo.out = __tmp->kfifo.in; \ |
263 | fifo->out += off; | 233 | }) |
264 | } | ||
265 | 234 | ||
266 | /* | 235 | /** |
267 | * __kfifo_add_in internal helper function for updating the in offset | 236 | * kfifo_len - returns the number of used elements in the fifo |
237 | * @fifo: address of the fifo to be used | ||
268 | */ | 238 | */ |
269 | static inline void __kfifo_add_in(struct kfifo *fifo, | 239 | #define kfifo_len(fifo) \ |
270 | unsigned int off) | 240 | ({ \ |
271 | { | 241 | typeof(fifo + 1) __tmpl = (fifo); \ |
272 | smp_wmb(); | 242 | __tmpl->kfifo.in - __tmpl->kfifo.out; \ |
273 | fifo->in += off; | 243 | }) |
274 | } | ||
275 | 244 | ||
276 | /* | 245 | /** |
277 | * __kfifo_off internal helper function for calculating the index of a | 246 | * kfifo_is_empty - returns true if the fifo is empty |
278 | * given offeset | 247 | * @fifo: address of the fifo to be used |
279 | */ | 248 | */ |
280 | static inline unsigned int __kfifo_off(struct kfifo *fifo, unsigned int off) | 249 | #define kfifo_is_empty(fifo) \ |
281 | { | 250 | ({ \ |
282 | return off & (fifo->size - 1); | 251 | typeof(fifo + 1) __tmpq = (fifo); \ |
283 | } | 252 | __tmpq->kfifo.in == __tmpq->kfifo.out; \ |
253 | }) | ||
284 | 254 | ||
285 | /* | 255 | /** |
286 | * __kfifo_peek_n internal helper function for determinate the length of | 256 | * kfifo_is_full - returns true if the fifo is full |
287 | * the next record in the fifo | 257 | * @fifo: address of the fifo to be used |
288 | */ | 258 | */ |
289 | static inline unsigned int __kfifo_peek_n(struct kfifo *fifo, | 259 | #define kfifo_is_full(fifo) \ |
290 | unsigned int recsize) | 260 | ({ \ |
291 | { | 261 | typeof(fifo + 1) __tmpq = (fifo); \ |
292 | #define __KFIFO_GET(fifo, off, shift) \ | 262 | kfifo_len(__tmpq) > __tmpq->kfifo.mask; \ |
293 | ((fifo)->buffer[__kfifo_off((fifo), (fifo)->out+(off))] << (shift)) | 263 | }) |
294 | 264 | ||
295 | unsigned int l; | 265 | /** |
266 | * kfifo_avail - returns the number of unused elements in the fifo | ||
267 | * @fifo: address of the fifo to be used | ||
268 | */ | ||
269 | #define kfifo_avail(fifo) \ | ||
270 | __kfifo_must_check_helper( \ | ||
271 | ({ \ | ||
272 | typeof(fifo + 1) __tmpq = (fifo); \ | ||
273 | const size_t __recsize = sizeof(*__tmpq->rectype); \ | ||
274 | unsigned int __avail = kfifo_size(__tmpq) - kfifo_len(__tmpq); \ | ||
275 | (__recsize) ? ((__avail <= __recsize) ? 0 : \ | ||
276 | __kfifo_max_r(__avail - __recsize, __recsize)) : \ | ||
277 | __avail; \ | ||
278 | }) \ | ||
279 | ) | ||
296 | 280 | ||
297 | l = __KFIFO_GET(fifo, 0, 0); | 281 | /** |
282 | * kfifo_skip - skip output data | ||
283 | * @fifo: address of the fifo to be used | ||
284 | */ | ||
285 | #define kfifo_skip(fifo) \ | ||
286 | (void)({ \ | ||
287 | typeof(fifo + 1) __tmp = (fifo); \ | ||
288 | const size_t __recsize = sizeof(*__tmp->rectype); \ | ||
289 | struct __kfifo *__kfifo = &__tmp->kfifo; \ | ||
290 | if (__recsize) \ | ||
291 | __kfifo_skip_r(__kfifo, __recsize); \ | ||
292 | else \ | ||
293 | __kfifo->out++; \ | ||
294 | }) | ||
298 | 295 | ||
299 | if (--recsize) | 296 | /** |
300 | l |= __KFIFO_GET(fifo, 1, 8); | 297 | * kfifo_peek_len - gets the size of the next fifo record |
298 | * @fifo: address of the fifo to be used | ||
299 | * | ||
300 | * This function returns the size of the next fifo record in number of bytes. | ||
301 | */ | ||
302 | #define kfifo_peek_len(fifo) \ | ||
303 | __kfifo_must_check_helper( \ | ||
304 | ({ \ | ||
305 | typeof(fifo + 1) __tmp = (fifo); \ | ||
306 | const size_t __recsize = sizeof(*__tmp->rectype); \ | ||
307 | struct __kfifo *__kfifo = &__tmp->kfifo; \ | ||
308 | (!__recsize) ? kfifo_len(__tmp) * sizeof(*__tmp->type) : \ | ||
309 | __kfifo_len_r(__kfifo, __recsize); \ | ||
310 | }) \ | ||
311 | ) | ||
301 | 312 | ||
302 | return l; | 313 | /** |
303 | #undef __KFIFO_GET | 314 | * kfifo_alloc - dynamically allocates a new fifo buffer |
304 | } | 315 | * @fifo: pointer to the fifo |
316 | * @size: the number of elements in the fifo, this must be a power of 2 | ||
317 | * @gfp_mask: get_free_pages mask, passed to kmalloc() | ||
318 | * | ||
319 | * This macro dynamically allocates a new fifo buffer. | ||
320 | * | ||
321 | * The numer of elements will be rounded-up to a power of 2. | ||
322 | * The fifo will be release with kfifo_free(). | ||
323 | * Return 0 if no error, otherwise an error code. | ||
324 | */ | ||
325 | #define kfifo_alloc(fifo, size, gfp_mask) \ | ||
326 | __kfifo_must_check_helper( \ | ||
327 | ({ \ | ||
328 | typeof(fifo + 1) __tmp = (fifo); \ | ||
329 | struct __kfifo *__kfifo = &__tmp->kfifo; \ | ||
330 | __is_kfifo_ptr(__tmp) ? \ | ||
331 | __kfifo_alloc(__kfifo, size, sizeof(*__tmp->type), gfp_mask) : \ | ||
332 | -EINVAL; \ | ||
333 | }) \ | ||
334 | ) | ||
305 | 335 | ||
306 | /* | 336 | /** |
307 | * __kfifo_poke_n internal helper function for storing the length of | 337 | * kfifo_free - frees the fifo |
308 | * the next record into the fifo | 338 | * @fifo: the fifo to be freed |
309 | */ | 339 | */ |
310 | static inline void __kfifo_poke_n(struct kfifo *fifo, | 340 | #define kfifo_free(fifo) \ |
311 | unsigned int recsize, unsigned int n) | 341 | ({ \ |
312 | { | 342 | typeof(fifo + 1) __tmp = (fifo); \ |
313 | #define __KFIFO_PUT(fifo, off, val, shift) \ | 343 | struct __kfifo *__kfifo = &__tmp->kfifo; \ |
314 | ( \ | 344 | if (__is_kfifo_ptr(__tmp)) \ |
315 | (fifo)->buffer[__kfifo_off((fifo), (fifo)->in+(off))] = \ | 345 | __kfifo_free(__kfifo); \ |
316 | (unsigned char)((val) >> (shift)) \ | 346 | }) |
317 | ) | ||
318 | 347 | ||
319 | __KFIFO_PUT(fifo, 0, n, 0); | 348 | /** |
349 | * kfifo_init - initialize a fifo using a preallocated buffer | ||
350 | * @fifo: the fifo to assign the buffer | ||
351 | * @buffer: the preallocated buffer to be used | ||
352 | * @size: the size of the internal buffer, this have to be a power of 2 | ||
353 | * | ||
354 | * This macro initialize a fifo using a preallocated buffer. | ||
355 | * | ||
356 | * The numer of elements will be rounded-up to a power of 2. | ||
357 | * Return 0 if no error, otherwise an error code. | ||
358 | */ | ||
359 | #define kfifo_init(fifo, buffer, size) \ | ||
360 | ({ \ | ||
361 | typeof(fifo + 1) __tmp = (fifo); \ | ||
362 | struct __kfifo *__kfifo = &__tmp->kfifo; \ | ||
363 | __is_kfifo_ptr(__tmp) ? \ | ||
364 | __kfifo_init(__kfifo, buffer, size, sizeof(*__tmp->type)) : \ | ||
365 | -EINVAL; \ | ||
366 | }) | ||
320 | 367 | ||
321 | if (--recsize) | 368 | /** |
322 | __KFIFO_PUT(fifo, 1, n, 8); | 369 | * kfifo_put - put data into the fifo |
323 | #undef __KFIFO_PUT | 370 | * @fifo: address of the fifo to be used |
324 | } | 371 | * @val: the data to be added |
372 | * | ||
373 | * This macro copies the given value into the fifo. | ||
374 | * It returns 0 if the fifo was full. Otherwise it returns the number | ||
375 | * processed elements. | ||
376 | * | ||
377 | * Note that with only one concurrent reader and one concurrent | ||
378 | * writer, you don't need extra locking to use these macro. | ||
379 | */ | ||
380 | #define kfifo_put(fifo, val) \ | ||
381 | ({ \ | ||
382 | typeof(fifo + 1) __tmp = (fifo); \ | ||
383 | typeof(val + 1) __val = (val); \ | ||
384 | unsigned int __ret; \ | ||
385 | const size_t __recsize = sizeof(*__tmp->rectype); \ | ||
386 | struct __kfifo *__kfifo = &__tmp->kfifo; \ | ||
387 | if (0) { \ | ||
388 | typeof(__tmp->ptr_const) __dummy __attribute__ ((unused)); \ | ||
389 | __dummy = (typeof(__val))NULL; \ | ||
390 | } \ | ||
391 | if (__recsize) \ | ||
392 | __ret = __kfifo_in_r(__kfifo, __val, sizeof(*__val), \ | ||
393 | __recsize); \ | ||
394 | else { \ | ||
395 | __ret = !kfifo_is_full(__tmp); \ | ||
396 | if (__ret) { \ | ||
397 | (__is_kfifo_ptr(__tmp) ? \ | ||
398 | ((typeof(__tmp->type))__kfifo->data) : \ | ||
399 | (__tmp->buf) \ | ||
400 | )[__kfifo->in & __tmp->kfifo.mask] = \ | ||
401 | *(typeof(__tmp->type))__val; \ | ||
402 | smp_wmb(); \ | ||
403 | __kfifo->in++; \ | ||
404 | } \ | ||
405 | } \ | ||
406 | __ret; \ | ||
407 | }) | ||
325 | 408 | ||
326 | /* | 409 | /** |
327 | * __kfifo_in_... internal functions for put date into the fifo | 410 | * kfifo_get - get data from the fifo |
328 | * do not call it directly, use kfifo_in_rec() instead | 411 | * @fifo: address of the fifo to be used |
329 | */ | 412 | * @val: the var where to store the data to be added |
330 | extern unsigned int __kfifo_in_n(struct kfifo *fifo, | 413 | * |
331 | const void *from, unsigned int n, unsigned int recsize); | 414 | * This macro reads the data from the fifo. |
415 | * It returns 0 if the fifo was empty. Otherwise it returns the number | ||
416 | * processed elements. | ||
417 | * | ||
418 | * Note that with only one concurrent reader and one concurrent | ||
419 | * writer, you don't need extra locking to use these macro. | ||
420 | */ | ||
421 | #define kfifo_get(fifo, val) \ | ||
422 | __kfifo_must_check_helper( \ | ||
423 | ({ \ | ||
424 | typeof(fifo + 1) __tmp = (fifo); \ | ||
425 | typeof(val + 1) __val = (val); \ | ||
426 | unsigned int __ret; \ | ||
427 | const size_t __recsize = sizeof(*__tmp->rectype); \ | ||
428 | struct __kfifo *__kfifo = &__tmp->kfifo; \ | ||
429 | if (0) \ | ||
430 | __val = (typeof(__tmp->ptr))0; \ | ||
431 | if (__recsize) \ | ||
432 | __ret = __kfifo_out_r(__kfifo, __val, sizeof(*__val), \ | ||
433 | __recsize); \ | ||
434 | else { \ | ||
435 | __ret = !kfifo_is_empty(__tmp); \ | ||
436 | if (__ret) { \ | ||
437 | *(typeof(__tmp->type))__val = \ | ||
438 | (__is_kfifo_ptr(__tmp) ? \ | ||
439 | ((typeof(__tmp->type))__kfifo->data) : \ | ||
440 | (__tmp->buf) \ | ||
441 | )[__kfifo->out & __tmp->kfifo.mask]; \ | ||
442 | smp_wmb(); \ | ||
443 | __kfifo->out++; \ | ||
444 | } \ | ||
445 | } \ | ||
446 | __ret; \ | ||
447 | }) \ | ||
448 | ) | ||
332 | 449 | ||
333 | extern unsigned int __kfifo_in_generic(struct kfifo *fifo, | 450 | /** |
334 | const void *from, unsigned int n, unsigned int recsize); | 451 | * kfifo_peek - get data from the fifo without removing |
452 | * @fifo: address of the fifo to be used | ||
453 | * @val: the var where to store the data to be added | ||
454 | * | ||
455 | * This reads the data from the fifo without removing it from the fifo. | ||
456 | * It returns 0 if the fifo was empty. Otherwise it returns the number | ||
457 | * processed elements. | ||
458 | * | ||
459 | * Note that with only one concurrent reader and one concurrent | ||
460 | * writer, you don't need extra locking to use these macro. | ||
461 | */ | ||
462 | #define kfifo_peek(fifo, val) \ | ||
463 | __kfifo_must_check_helper( \ | ||
464 | ({ \ | ||
465 | typeof(fifo + 1) __tmp = (fifo); \ | ||
466 | typeof(val + 1) __val = (val); \ | ||
467 | unsigned int __ret; \ | ||
468 | const size_t __recsize = sizeof(*__tmp->rectype); \ | ||
469 | struct __kfifo *__kfifo = &__tmp->kfifo; \ | ||
470 | if (0) \ | ||
471 | __val = (typeof(__tmp->ptr))NULL; \ | ||
472 | if (__recsize) \ | ||
473 | __ret = __kfifo_out_peek_r(__kfifo, __val, sizeof(*__val), \ | ||
474 | __recsize); \ | ||
475 | else { \ | ||
476 | __ret = !kfifo_is_empty(__tmp); \ | ||
477 | if (__ret) { \ | ||
478 | *(typeof(__tmp->type))__val = \ | ||
479 | (__is_kfifo_ptr(__tmp) ? \ | ||
480 | ((typeof(__tmp->type))__kfifo->data) : \ | ||
481 | (__tmp->buf) \ | ||
482 | )[__kfifo->out & __tmp->kfifo.mask]; \ | ||
483 | smp_wmb(); \ | ||
484 | } \ | ||
485 | } \ | ||
486 | __ret; \ | ||
487 | }) \ | ||
488 | ) | ||
335 | 489 | ||
336 | static inline unsigned int __kfifo_in_rec(struct kfifo *fifo, | 490 | /** |
337 | const void *from, unsigned int n, unsigned int recsize) | 491 | * kfifo_in - put data into the fifo |
338 | { | 492 | * @fifo: address of the fifo to be used |
339 | unsigned int ret; | 493 | * @buf: the data to be added |
494 | * @n: number of elements to be added | ||
495 | * | ||
496 | * This macro copies the given buffer into the fifo and returns the | ||
497 | * number of copied elements. | ||
498 | * | ||
499 | * Note that with only one concurrent reader and one concurrent | ||
500 | * writer, you don't need extra locking to use these macro. | ||
501 | */ | ||
502 | #define kfifo_in(fifo, buf, n) \ | ||
503 | ({ \ | ||
504 | typeof(fifo + 1) __tmp = (fifo); \ | ||
505 | typeof(buf + 1) __buf = (buf); \ | ||
506 | unsigned long __n = (n); \ | ||
507 | const size_t __recsize = sizeof(*__tmp->rectype); \ | ||
508 | struct __kfifo *__kfifo = &__tmp->kfifo; \ | ||
509 | if (0) { \ | ||
510 | typeof(__tmp->ptr_const) __dummy __attribute__ ((unused)); \ | ||
511 | __dummy = (typeof(__buf))NULL; \ | ||
512 | } \ | ||
513 | (__recsize) ?\ | ||
514 | __kfifo_in_r(__kfifo, __buf, __n, __recsize) : \ | ||
515 | __kfifo_in(__kfifo, __buf, __n); \ | ||
516 | }) | ||
340 | 517 | ||
341 | ret = __kfifo_in_n(fifo, from, n, recsize); | 518 | /** |
519 | * kfifo_in_spinlocked - put data into the fifo using a spinlock for locking | ||
520 | * @fifo: address of the fifo to be used | ||
521 | * @buf: the data to be added | ||
522 | * @n: number of elements to be added | ||
523 | * @lock: pointer to the spinlock to use for locking | ||
524 | * | ||
525 | * This macro copies the given values buffer into the fifo and returns the | ||
526 | * number of copied elements. | ||
527 | */ | ||
528 | #define kfifo_in_spinlocked(fifo, buf, n, lock) \ | ||
529 | ({ \ | ||
530 | unsigned long __flags; \ | ||
531 | unsigned int __ret; \ | ||
532 | spin_lock_irqsave(lock, __flags); \ | ||
533 | __ret = kfifo_in(fifo, buf, n); \ | ||
534 | spin_unlock_irqrestore(lock, __flags); \ | ||
535 | __ret; \ | ||
536 | }) | ||
537 | |||
538 | /* alias for kfifo_in_spinlocked, will be removed in a future release */ | ||
539 | #define kfifo_in_locked(fifo, buf, n, lock) \ | ||
540 | kfifo_in_spinlocked(fifo, buf, n, lock) | ||
342 | 541 | ||
343 | if (likely(ret == 0)) { | 542 | /** |
344 | if (recsize) | 543 | * kfifo_out - get data from the fifo |
345 | __kfifo_poke_n(fifo, recsize, n); | 544 | * @fifo: address of the fifo to be used |
346 | __kfifo_add_in(fifo, n + recsize); | 545 | * @buf: pointer to the storage buffer |
347 | } | 546 | * @n: max. number of elements to get |
348 | return ret; | 547 | * |
349 | } | 548 | * This macro get some data from the fifo and return the numbers of elements |
549 | * copied. | ||
550 | * | ||
551 | * Note that with only one concurrent reader and one concurrent | ||
552 | * writer, you don't need extra locking to use these macro. | ||
553 | */ | ||
554 | #define kfifo_out(fifo, buf, n) \ | ||
555 | __kfifo_must_check_helper( \ | ||
556 | ({ \ | ||
557 | typeof(fifo + 1) __tmp = (fifo); \ | ||
558 | typeof(buf + 1) __buf = (buf); \ | ||
559 | unsigned long __n = (n); \ | ||
560 | const size_t __recsize = sizeof(*__tmp->rectype); \ | ||
561 | struct __kfifo *__kfifo = &__tmp->kfifo; \ | ||
562 | if (0) { \ | ||
563 | typeof(__tmp->ptr) __dummy = NULL; \ | ||
564 | __buf = __dummy; \ | ||
565 | } \ | ||
566 | (__recsize) ?\ | ||
567 | __kfifo_out_r(__kfifo, __buf, __n, __recsize) : \ | ||
568 | __kfifo_out(__kfifo, __buf, __n); \ | ||
569 | }) \ | ||
570 | ) | ||
571 | |||
572 | /** | ||
573 | * kfifo_out_spinlocked - get data from the fifo using a spinlock for locking | ||
574 | * @fifo: address of the fifo to be used | ||
575 | * @buf: pointer to the storage buffer | ||
576 | * @n: max. number of elements to get | ||
577 | * @lock: pointer to the spinlock to use for locking | ||
578 | * | ||
579 | * This macro get the data from the fifo and return the numbers of elements | ||
580 | * copied. | ||
581 | */ | ||
582 | #define kfifo_out_spinlocked(fifo, buf, n, lock) \ | ||
583 | __kfifo_must_check_helper( \ | ||
584 | ({ \ | ||
585 | unsigned long __flags; \ | ||
586 | unsigned int __ret; \ | ||
587 | spin_lock_irqsave(lock, __flags); \ | ||
588 | __ret = kfifo_out(fifo, buf, n); \ | ||
589 | spin_unlock_irqrestore(lock, __flags); \ | ||
590 | __ret; \ | ||
591 | }) \ | ||
592 | ) | ||
593 | |||
594 | /* alias for kfifo_out_spinlocked, will be removed in a future release */ | ||
595 | #define kfifo_out_locked(fifo, buf, n, lock) \ | ||
596 | kfifo_out_spinlocked(fifo, buf, n, lock) | ||
350 | 597 | ||
351 | /** | 598 | /** |
352 | * kfifo_in_rec - puts some record data into the FIFO | 599 | * kfifo_from_user - puts some data from user space into the fifo |
353 | * @fifo: the fifo to be used. | 600 | * @fifo: address of the fifo to be used |
354 | * @from: the data to be added. | 601 | * @from: pointer to the data to be added |
355 | * @n: the length of the data to be added. | 602 | * @len: the length of the data to be added |
356 | * @recsize: size of record field | 603 | * @copied: pointer to output variable to store the number of copied bytes |
357 | * | 604 | * |
358 | * This function copies @n bytes from the @from into the FIFO and returns | 605 | * This macro copies at most @len bytes from the @from into the |
359 | * the number of bytes which cannot be copied. | 606 | * fifo, depending of the available space and returns -EFAULT/0. |
360 | * A returned value greater than the @n value means that the record doesn't | ||
361 | * fit into the buffer. | ||
362 | * | 607 | * |
363 | * Note that with only one concurrent reader and one concurrent | 608 | * Note that with only one concurrent reader and one concurrent |
364 | * writer, you don't need extra locking to use these functions. | 609 | * writer, you don't need extra locking to use these macro. |
365 | */ | 610 | */ |
366 | static inline __must_check unsigned int kfifo_in_rec(struct kfifo *fifo, | 611 | #define kfifo_from_user(fifo, from, len, copied) \ |
367 | void *from, unsigned int n, unsigned int recsize) | 612 | __kfifo_must_check_helper( \ |
368 | { | 613 | ({ \ |
369 | if (!__builtin_constant_p(recsize)) | 614 | typeof(fifo + 1) __tmp = (fifo); \ |
370 | return __kfifo_in_generic(fifo, from, n, recsize); | 615 | const void __user *__from = (from); \ |
371 | return __kfifo_in_rec(fifo, from, n, recsize); | 616 | unsigned int __len = (len); \ |
372 | } | 617 | unsigned int *__copied = (copied); \ |
618 | const size_t __recsize = sizeof(*__tmp->rectype); \ | ||
619 | struct __kfifo *__kfifo = &__tmp->kfifo; \ | ||
620 | (__recsize) ? \ | ||
621 | __kfifo_from_user_r(__kfifo, __from, __len, __copied, __recsize) : \ | ||
622 | __kfifo_from_user(__kfifo, __from, __len, __copied); \ | ||
623 | }) \ | ||
624 | ) | ||
373 | 625 | ||
374 | /* | 626 | /** |
375 | * __kfifo_out_... internal functions for get date from the fifo | 627 | * kfifo_to_user - copies data from the fifo into user space |
376 | * do not call it directly, use kfifo_out_rec() instead | 628 | * @fifo: address of the fifo to be used |
377 | */ | 629 | * @to: where the data must be copied |
378 | extern unsigned int __kfifo_out_n(struct kfifo *fifo, | 630 | * @len: the size of the destination buffer |
379 | void *to, unsigned int reclen, unsigned int recsize); | 631 | * @copied: pointer to output variable to store the number of copied bytes |
632 | * | ||
633 | * This macro copies at most @len bytes from the fifo into the | ||
634 | * @to buffer and returns -EFAULT/0. | ||
635 | * | ||
636 | * Note that with only one concurrent reader and one concurrent | ||
637 | * writer, you don't need extra locking to use these macro. | ||
638 | */ | ||
639 | #define kfifo_to_user(fifo, to, len, copied) \ | ||
640 | __kfifo_must_check_helper( \ | ||
641 | ({ \ | ||
642 | typeof(fifo + 1) __tmp = (fifo); \ | ||
643 | void __user *__to = (to); \ | ||
644 | unsigned int __len = (len); \ | ||
645 | unsigned int *__copied = (copied); \ | ||
646 | const size_t __recsize = sizeof(*__tmp->rectype); \ | ||
647 | struct __kfifo *__kfifo = &__tmp->kfifo; \ | ||
648 | (__recsize) ? \ | ||
649 | __kfifo_to_user_r(__kfifo, __to, __len, __copied, __recsize) : \ | ||
650 | __kfifo_to_user(__kfifo, __to, __len, __copied); \ | ||
651 | }) \ | ||
652 | ) | ||
653 | |||
654 | /** | ||
655 | * kfifo_dma_in_prepare - setup a scatterlist for DMA input | ||
656 | * @fifo: address of the fifo to be used | ||
657 | * @sgl: pointer to the scatterlist array | ||
658 | * @nents: number of entries in the scatterlist array | ||
659 | * @len: number of elements to transfer | ||
660 | * | ||
661 | * This macro fills a scatterlist for DMA input. | ||
662 | * It returns the number entries in the scatterlist array. | ||
663 | * | ||
664 | * Note that with only one concurrent reader and one concurrent | ||
665 | * writer, you don't need extra locking to use these macros. | ||
666 | */ | ||
667 | #define kfifo_dma_in_prepare(fifo, sgl, nents, len) \ | ||
668 | ({ \ | ||
669 | typeof(fifo + 1) __tmp = (fifo); \ | ||
670 | struct scatterlist *__sgl = (sgl); \ | ||
671 | int __nents = (nents); \ | ||
672 | unsigned int __len = (len); \ | ||
673 | const size_t __recsize = sizeof(*__tmp->rectype); \ | ||
674 | struct __kfifo *__kfifo = &__tmp->kfifo; \ | ||
675 | (__recsize) ? \ | ||
676 | __kfifo_dma_in_prepare_r(__kfifo, __sgl, __nents, __len, __recsize) : \ | ||
677 | __kfifo_dma_in_prepare(__kfifo, __sgl, __nents, __len); \ | ||
678 | }) | ||
380 | 679 | ||
381 | extern unsigned int __kfifo_out_generic(struct kfifo *fifo, | 680 | /** |
382 | void *to, unsigned int n, | 681 | * kfifo_dma_in_finish - finish a DMA IN operation |
383 | unsigned int recsize, unsigned int *total); | 682 | * @fifo: address of the fifo to be used |
683 | * @len: number of bytes to received | ||
684 | * | ||
685 | * This macro finish a DMA IN operation. The in counter will be updated by | ||
686 | * the len parameter. No error checking will be done. | ||
687 | * | ||
688 | * Note that with only one concurrent reader and one concurrent | ||
689 | * writer, you don't need extra locking to use these macros. | ||
690 | */ | ||
691 | #define kfifo_dma_in_finish(fifo, len) \ | ||
692 | (void)({ \ | ||
693 | typeof(fifo + 1) __tmp = (fifo); \ | ||
694 | unsigned int __len = (len); \ | ||
695 | const size_t __recsize = sizeof(*__tmp->rectype); \ | ||
696 | struct __kfifo *__kfifo = &__tmp->kfifo; \ | ||
697 | if (__recsize) \ | ||
698 | __kfifo_dma_in_finish_r(__kfifo, __len, __recsize); \ | ||
699 | else \ | ||
700 | __kfifo->in += __len / sizeof(*__tmp->type); \ | ||
701 | }) | ||
384 | 702 | ||
385 | static inline unsigned int __kfifo_out_rec(struct kfifo *fifo, | 703 | /** |
386 | void *to, unsigned int n, unsigned int recsize, | 704 | * kfifo_dma_out_prepare - setup a scatterlist for DMA output |
387 | unsigned int *total) | 705 | * @fifo: address of the fifo to be used |
388 | { | 706 | * @sgl: pointer to the scatterlist array |
389 | unsigned int l; | 707 | * @nents: number of entries in the scatterlist array |
390 | 708 | * @len: number of elements to transfer | |
391 | if (!recsize) { | 709 | * |
392 | l = n; | 710 | * This macro fills a scatterlist for DMA output which at most @len bytes |
393 | if (total) | 711 | * to transfer. |
394 | *total = l; | 712 | * It returns the number entries in the scatterlist array. |
395 | } else { | 713 | * A zero means there is no space available and the scatterlist is not filled. |
396 | l = __kfifo_peek_n(fifo, recsize); | 714 | * |
397 | if (total) | 715 | * Note that with only one concurrent reader and one concurrent |
398 | *total = l; | 716 | * writer, you don't need extra locking to use these macros. |
399 | if (n < l) | 717 | */ |
400 | return l; | 718 | #define kfifo_dma_out_prepare(fifo, sgl, nents, len) \ |
401 | } | 719 | ({ \ |
720 | typeof(fifo + 1) __tmp = (fifo); \ | ||
721 | struct scatterlist *__sgl = (sgl); \ | ||
722 | int __nents = (nents); \ | ||
723 | unsigned int __len = (len); \ | ||
724 | const size_t __recsize = sizeof(*__tmp->rectype); \ | ||
725 | struct __kfifo *__kfifo = &__tmp->kfifo; \ | ||
726 | (__recsize) ? \ | ||
727 | __kfifo_dma_out_prepare_r(__kfifo, __sgl, __nents, __len, __recsize) : \ | ||
728 | __kfifo_dma_out_prepare(__kfifo, __sgl, __nents, __len); \ | ||
729 | }) | ||
402 | 730 | ||
403 | return __kfifo_out_n(fifo, to, l, recsize); | 731 | /** |
404 | } | 732 | * kfifo_dma_out_finish - finish a DMA OUT operation |
733 | * @fifo: address of the fifo to be used | ||
734 | * @len: number of bytes transferd | ||
735 | * | ||
736 | * This macro finish a DMA OUT operation. The out counter will be updated by | ||
737 | * the len parameter. No error checking will be done. | ||
738 | * | ||
739 | * Note that with only one concurrent reader and one concurrent | ||
740 | * writer, you don't need extra locking to use these macros. | ||
741 | */ | ||
742 | #define kfifo_dma_out_finish(fifo, len) \ | ||
743 | (void)({ \ | ||
744 | typeof(fifo + 1) __tmp = (fifo); \ | ||
745 | unsigned int __len = (len); \ | ||
746 | const size_t __recsize = sizeof(*__tmp->rectype); \ | ||
747 | struct __kfifo *__kfifo = &__tmp->kfifo; \ | ||
748 | if (__recsize) \ | ||
749 | __kfifo_dma_out_finish_r(__kfifo, __recsize); \ | ||
750 | else \ | ||
751 | __kfifo->out += __len / sizeof(*__tmp->type); \ | ||
752 | }) | ||
405 | 753 | ||
406 | /** | 754 | /** |
407 | * kfifo_out_rec - gets some record data from the FIFO | 755 | * kfifo_out_peek - gets some data from the fifo |
408 | * @fifo: the fifo to be used. | 756 | * @fifo: address of the fifo to be used |
409 | * @to: where the data must be copied. | 757 | * @buf: pointer to the storage buffer |
410 | * @n: the size of the destination buffer. | 758 | * @n: max. number of elements to get |
411 | * @recsize: size of record field | ||
412 | * @total: pointer where the total number of to copied bytes should stored | ||
413 | * | 759 | * |
414 | * This function copies at most @n bytes from the FIFO to @to and returns the | 760 | * This macro get the data from the fifo and return the numbers of elements |
415 | * number of bytes which cannot be copied. | 761 | * copied. The data is not removed from the fifo. |
416 | * A returned value greater than the @n value means that the record doesn't | ||
417 | * fit into the @to buffer. | ||
418 | * | 762 | * |
419 | * Note that with only one concurrent reader and one concurrent | 763 | * Note that with only one concurrent reader and one concurrent |
420 | * writer, you don't need extra locking to use these functions. | 764 | * writer, you don't need extra locking to use these macro. |
421 | */ | 765 | */ |
422 | static inline __must_check unsigned int kfifo_out_rec(struct kfifo *fifo, | 766 | #define kfifo_out_peek(fifo, buf, n) \ |
423 | void *to, unsigned int n, unsigned int recsize, | 767 | __kfifo_must_check_helper( \ |
424 | unsigned int *total) | 768 | ({ \ |
769 | typeof(fifo + 1) __tmp = (fifo); \ | ||
770 | typeof(buf + 1) __buf = (buf); \ | ||
771 | unsigned long __n = (n); \ | ||
772 | const size_t __recsize = sizeof(*__tmp->rectype); \ | ||
773 | struct __kfifo *__kfifo = &__tmp->kfifo; \ | ||
774 | if (0) { \ | ||
775 | typeof(__tmp->ptr) __dummy __attribute__ ((unused)) = NULL; \ | ||
776 | __buf = __dummy; \ | ||
777 | } \ | ||
778 | (__recsize) ? \ | ||
779 | __kfifo_out_peek_r(__kfifo, __buf, __n, __recsize) : \ | ||
780 | __kfifo_out_peek(__kfifo, __buf, __n); \ | ||
781 | }) \ | ||
782 | ) | ||
425 | 783 | ||
426 | { | 784 | extern int __kfifo_alloc(struct __kfifo *fifo, unsigned int size, |
427 | if (!__builtin_constant_p(recsize)) | 785 | size_t esize, gfp_t gfp_mask); |
428 | return __kfifo_out_generic(fifo, to, n, recsize, total); | ||
429 | return __kfifo_out_rec(fifo, to, n, recsize, total); | ||
430 | } | ||
431 | 786 | ||
432 | /* | 787 | extern void __kfifo_free(struct __kfifo *fifo); |
433 | * __kfifo_from_user_... internal functions for transfer from user space into | ||
434 | * the fifo. do not call it directly, use kfifo_from_user_rec() instead | ||
435 | */ | ||
436 | extern unsigned int __kfifo_from_user_n(struct kfifo *fifo, | ||
437 | const void __user *from, unsigned int n, unsigned int recsize); | ||
438 | 788 | ||
439 | extern unsigned int __kfifo_from_user_generic(struct kfifo *fifo, | 789 | extern int __kfifo_init(struct __kfifo *fifo, void *buffer, |
440 | const void __user *from, unsigned int n, unsigned int recsize); | 790 | unsigned int size, size_t esize); |
441 | 791 | ||
442 | static inline unsigned int __kfifo_from_user_rec(struct kfifo *fifo, | 792 | extern unsigned int __kfifo_in(struct __kfifo *fifo, |
443 | const void __user *from, unsigned int n, unsigned int recsize) | 793 | const void *buf, unsigned int len); |
444 | { | ||
445 | unsigned int ret; | ||
446 | 794 | ||
447 | ret = __kfifo_from_user_n(fifo, from, n, recsize); | 795 | extern unsigned int __kfifo_out(struct __kfifo *fifo, |
796 | void *buf, unsigned int len); | ||
448 | 797 | ||
449 | if (likely(ret == 0)) { | 798 | extern int __kfifo_from_user(struct __kfifo *fifo, |
450 | if (recsize) | 799 | const void __user *from, unsigned long len, unsigned int *copied); |
451 | __kfifo_poke_n(fifo, recsize, n); | ||
452 | __kfifo_add_in(fifo, n + recsize); | ||
453 | } | ||
454 | return ret; | ||
455 | } | ||
456 | 800 | ||
457 | /** | 801 | extern int __kfifo_to_user(struct __kfifo *fifo, |
458 | * kfifo_from_user_rec - puts some data from user space into the FIFO | 802 | void __user *to, unsigned long len, unsigned int *copied); |
459 | * @fifo: the fifo to be used. | ||
460 | * @from: pointer to the data to be added. | ||
461 | * @n: the length of the data to be added. | ||
462 | * @recsize: size of record field | ||
463 | * | ||
464 | * This function copies @n bytes from the @from into the | ||
465 | * FIFO and returns the number of bytes which cannot be copied. | ||
466 | * | ||
467 | * If the returned value is equal or less the @n value, the copy_from_user() | ||
468 | * functions has failed. Otherwise the record doesn't fit into the buffer. | ||
469 | * | ||
470 | * Note that with only one concurrent reader and one concurrent | ||
471 | * writer, you don't need extra locking to use these functions. | ||
472 | */ | ||
473 | static inline __must_check unsigned int kfifo_from_user_rec(struct kfifo *fifo, | ||
474 | const void __user *from, unsigned int n, unsigned int recsize) | ||
475 | { | ||
476 | if (!__builtin_constant_p(recsize)) | ||
477 | return __kfifo_from_user_generic(fifo, from, n, recsize); | ||
478 | return __kfifo_from_user_rec(fifo, from, n, recsize); | ||
479 | } | ||
480 | 803 | ||
481 | /* | 804 | extern unsigned int __kfifo_dma_in_prepare(struct __kfifo *fifo, |
482 | * __kfifo_to_user_... internal functions for transfer fifo data into user space | 805 | struct scatterlist *sgl, int nents, unsigned int len); |
483 | * do not call it directly, use kfifo_to_user_rec() instead | ||
484 | */ | ||
485 | extern unsigned int __kfifo_to_user_n(struct kfifo *fifo, | ||
486 | void __user *to, unsigned int n, unsigned int reclen, | ||
487 | unsigned int recsize); | ||
488 | 806 | ||
489 | extern unsigned int __kfifo_to_user_generic(struct kfifo *fifo, | 807 | extern unsigned int __kfifo_dma_out_prepare(struct __kfifo *fifo, |
490 | void __user *to, unsigned int n, unsigned int recsize, | 808 | struct scatterlist *sgl, int nents, unsigned int len); |
491 | unsigned int *total); | ||
492 | 809 | ||
493 | static inline unsigned int __kfifo_to_user_rec(struct kfifo *fifo, | 810 | extern unsigned int __kfifo_out_peek(struct __kfifo *fifo, |
494 | void __user *to, unsigned int n, | 811 | void *buf, unsigned int len); |
495 | unsigned int recsize, unsigned int *total) | ||
496 | { | ||
497 | unsigned int l; | ||
498 | |||
499 | if (!recsize) { | ||
500 | l = n; | ||
501 | if (total) | ||
502 | *total = l; | ||
503 | } else { | ||
504 | l = __kfifo_peek_n(fifo, recsize); | ||
505 | if (total) | ||
506 | *total = l; | ||
507 | if (n < l) | ||
508 | return l; | ||
509 | } | ||
510 | 812 | ||
511 | return __kfifo_to_user_n(fifo, to, n, l, recsize); | 813 | extern unsigned int __kfifo_in_r(struct __kfifo *fifo, |
512 | } | 814 | const void *buf, unsigned int len, size_t recsize); |
513 | 815 | ||
514 | /** | 816 | extern unsigned int __kfifo_out_r(struct __kfifo *fifo, |
515 | * kfifo_to_user_rec - gets data from the FIFO and write it to user space | 817 | void *buf, unsigned int len, size_t recsize); |
516 | * @fifo: the fifo to be used. | ||
517 | * @to: where the data must be copied. | ||
518 | * @n: the size of the destination buffer. | ||
519 | * @recsize: size of record field | ||
520 | * @total: pointer where the total number of to copied bytes should stored | ||
521 | * | ||
522 | * This function copies at most @n bytes from the FIFO to the @to. | ||
523 | * In case of an error, the function returns the number of bytes which cannot | ||
524 | * be copied. | ||
525 | * If the returned value is equal or less the @n value, the copy_to_user() | ||
526 | * functions has failed. Otherwise the record doesn't fit into the @to buffer. | ||
527 | * | ||
528 | * Note that with only one concurrent reader and one concurrent | ||
529 | * writer, you don't need extra locking to use these functions. | ||
530 | */ | ||
531 | static inline __must_check unsigned int kfifo_to_user_rec(struct kfifo *fifo, | ||
532 | void __user *to, unsigned int n, unsigned int recsize, | ||
533 | unsigned int *total) | ||
534 | { | ||
535 | if (!__builtin_constant_p(recsize)) | ||
536 | return __kfifo_to_user_generic(fifo, to, n, recsize, total); | ||
537 | return __kfifo_to_user_rec(fifo, to, n, recsize, total); | ||
538 | } | ||
539 | 818 | ||
540 | /* | 819 | extern int __kfifo_from_user_r(struct __kfifo *fifo, |
541 | * __kfifo_peek_... internal functions for peek into the next fifo record | 820 | const void __user *from, unsigned long len, unsigned int *copied, |
542 | * do not call it directly, use kfifo_peek_rec() instead | 821 | size_t recsize); |
543 | */ | ||
544 | extern unsigned int __kfifo_peek_generic(struct kfifo *fifo, | ||
545 | unsigned int recsize); | ||
546 | 822 | ||
547 | /** | 823 | extern int __kfifo_to_user_r(struct __kfifo *fifo, void __user *to, |
548 | * kfifo_peek_rec - gets the size of the next FIFO record data | 824 | unsigned long len, unsigned int *copied, size_t recsize); |
549 | * @fifo: the fifo to be used. | ||
550 | * @recsize: size of record field | ||
551 | * | ||
552 | * This function returns the size of the next FIFO record in number of bytes | ||
553 | */ | ||
554 | static inline __must_check unsigned int kfifo_peek_rec(struct kfifo *fifo, | ||
555 | unsigned int recsize) | ||
556 | { | ||
557 | if (!__builtin_constant_p(recsize)) | ||
558 | return __kfifo_peek_generic(fifo, recsize); | ||
559 | if (!recsize) | ||
560 | return kfifo_len(fifo); | ||
561 | return __kfifo_peek_n(fifo, recsize); | ||
562 | } | ||
563 | 825 | ||
564 | /* | 826 | extern unsigned int __kfifo_dma_in_prepare_r(struct __kfifo *fifo, |
565 | * __kfifo_skip_... internal functions for skip the next fifo record | 827 | struct scatterlist *sgl, int nents, unsigned int len, size_t recsize); |
566 | * do not call it directly, use kfifo_skip_rec() instead | ||
567 | */ | ||
568 | extern void __kfifo_skip_generic(struct kfifo *fifo, unsigned int recsize); | ||
569 | 828 | ||
570 | static inline void __kfifo_skip_rec(struct kfifo *fifo, | 829 | extern void __kfifo_dma_in_finish_r(struct __kfifo *fifo, |
571 | unsigned int recsize) | 830 | unsigned int len, size_t recsize); |
572 | { | ||
573 | unsigned int l; | ||
574 | 831 | ||
575 | if (recsize) { | 832 | extern unsigned int __kfifo_dma_out_prepare_r(struct __kfifo *fifo, |
576 | l = __kfifo_peek_n(fifo, recsize); | 833 | struct scatterlist *sgl, int nents, unsigned int len, size_t recsize); |
577 | 834 | ||
578 | if (l + recsize <= kfifo_len(fifo)) { | 835 | extern void __kfifo_dma_out_finish_r(struct __kfifo *fifo, size_t recsize); |
579 | __kfifo_add_out(fifo, l + recsize); | ||
580 | return; | ||
581 | } | ||
582 | } | ||
583 | kfifo_reset_out(fifo); | ||
584 | } | ||
585 | 836 | ||
586 | /** | 837 | extern unsigned int __kfifo_len_r(struct __kfifo *fifo, size_t recsize); |
587 | * kfifo_skip_rec - skip the next fifo out record | ||
588 | * @fifo: the fifo to be used. | ||
589 | * @recsize: size of record field | ||
590 | * | ||
591 | * This function skips the next FIFO record | ||
592 | */ | ||
593 | static inline void kfifo_skip_rec(struct kfifo *fifo, | ||
594 | unsigned int recsize) | ||
595 | { | ||
596 | if (!__builtin_constant_p(recsize)) | ||
597 | __kfifo_skip_generic(fifo, recsize); | ||
598 | else | ||
599 | __kfifo_skip_rec(fifo, recsize); | ||
600 | } | ||
601 | 838 | ||
602 | /** | 839 | extern unsigned int __kfifo_out_peek_r(struct __kfifo *fifo, |
603 | * kfifo_avail_rec - returns the number of bytes available in a record FIFO | 840 | void *buf, unsigned int len, size_t recsize); |
604 | * @fifo: the fifo to be used. | ||
605 | * @recsize: size of record field | ||
606 | */ | ||
607 | static inline __must_check unsigned int kfifo_avail_rec(struct kfifo *fifo, | ||
608 | unsigned int recsize) | ||
609 | { | ||
610 | unsigned int l = kfifo_size(fifo) - kfifo_len(fifo); | ||
611 | 841 | ||
612 | return (l > recsize) ? l - recsize : 0; | 842 | extern unsigned int __kfifo_max_r(unsigned int len, size_t recsize); |
613 | } | ||
614 | 843 | ||
615 | #endif | 844 | #endif |
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 73564cac38c7..159a0762aeaf 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h | |||
@@ -123,8 +123,7 @@ static inline bool mem_cgroup_disabled(void) | |||
123 | 123 | ||
124 | void mem_cgroup_update_file_mapped(struct page *page, int val); | 124 | void mem_cgroup_update_file_mapped(struct page *page, int val); |
125 | unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, | 125 | unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, |
126 | gfp_t gfp_mask, int nid, | 126 | gfp_t gfp_mask); |
127 | int zid); | ||
128 | u64 mem_cgroup_get_limit(struct mem_cgroup *mem); | 127 | u64 mem_cgroup_get_limit(struct mem_cgroup *mem); |
129 | 128 | ||
130 | #else /* CONFIG_CGROUP_MEM_RES_CTLR */ | 129 | #else /* CONFIG_CGROUP_MEM_RES_CTLR */ |
@@ -301,7 +300,7 @@ static inline void mem_cgroup_update_file_mapped(struct page *page, | |||
301 | 300 | ||
302 | static inline | 301 | static inline |
303 | unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, | 302 | unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, |
304 | gfp_t gfp_mask, int nid, int zid) | 303 | gfp_t gfp_mask) |
305 | { | 304 | { |
306 | return 0; | 305 | return 0; |
307 | } | 306 | } |
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index d02d2c6e0cfe..4d893eaf8174 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h | |||
@@ -24,6 +24,7 @@ struct mmc_cid { | |||
24 | }; | 24 | }; |
25 | 25 | ||
26 | struct mmc_csd { | 26 | struct mmc_csd { |
27 | unsigned char structure; | ||
27 | unsigned char mmca_vsn; | 28 | unsigned char mmca_vsn; |
28 | unsigned short cmdclass; | 29 | unsigned short cmdclass; |
29 | unsigned short tacc_clks; | 30 | unsigned short tacc_clks; |
@@ -92,6 +93,7 @@ struct mmc_card { | |||
92 | #define MMC_TYPE_MMC 0 /* MMC card */ | 93 | #define MMC_TYPE_MMC 0 /* MMC card */ |
93 | #define MMC_TYPE_SD 1 /* SD card */ | 94 | #define MMC_TYPE_SD 1 /* SD card */ |
94 | #define MMC_TYPE_SDIO 2 /* SDIO card */ | 95 | #define MMC_TYPE_SDIO 2 /* SDIO card */ |
96 | #define MMC_TYPE_SD_COMBO 3 /* SD combo (IO+mem) card */ | ||
95 | unsigned int state; /* (our) card state */ | 97 | unsigned int state; /* (our) card state */ |
96 | #define MMC_STATE_PRESENT (1<<0) /* present in sysfs */ | 98 | #define MMC_STATE_PRESENT (1<<0) /* present in sysfs */ |
97 | #define MMC_STATE_READONLY (1<<1) /* card is read-only */ | 99 | #define MMC_STATE_READONLY (1<<1) /* card is read-only */ |
@@ -101,6 +103,8 @@ struct mmc_card { | |||
101 | #define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */ | 103 | #define MMC_QUIRK_LENIENT_FN0 (1<<0) /* allow SDIO FN0 writes outside of the VS CCCR range */ |
102 | #define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */ | 104 | #define MMC_QUIRK_BLKSZ_FOR_BYTE_MODE (1<<1) /* use func->cur_blksize */ |
103 | /* for byte mode */ | 105 | /* for byte mode */ |
106 | #define MMC_QUIRK_NONSTD_SDIO (1<<2) /* non-standard SDIO card attached */ | ||
107 | /* (missing CIA registers) */ | ||
104 | 108 | ||
105 | u32 raw_cid[4]; /* raw card CID */ | 109 | u32 raw_cid[4]; /* raw card CID */ |
106 | u32 raw_csd[4]; /* raw card CSD */ | 110 | u32 raw_csd[4]; /* raw card CSD */ |
diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index f65913c9f5a4..513ff0376b09 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h | |||
@@ -124,6 +124,7 @@ struct mmc_host { | |||
124 | unsigned int f_min; | 124 | unsigned int f_min; |
125 | unsigned int f_max; | 125 | unsigned int f_max; |
126 | u32 ocr_avail; | 126 | u32 ocr_avail; |
127 | struct notifier_block pm_notify; | ||
127 | 128 | ||
128 | #define MMC_VDD_165_195 0x00000080 /* VDD voltage 1.65 - 1.95 */ | 129 | #define MMC_VDD_165_195 0x00000080 /* VDD voltage 1.65 - 1.95 */ |
129 | #define MMC_VDD_20_21 0x00000100 /* VDD voltage 2.0 ~ 2.1 */ | 130 | #define MMC_VDD_20_21 0x00000100 /* VDD voltage 2.0 ~ 2.1 */ |
@@ -183,6 +184,7 @@ struct mmc_host { | |||
183 | 184 | ||
184 | /* Only used with MMC_CAP_DISABLE */ | 185 | /* Only used with MMC_CAP_DISABLE */ |
185 | int enabled; /* host is enabled */ | 186 | int enabled; /* host is enabled */ |
187 | int rescan_disable; /* disable card detection */ | ||
186 | int nesting_cnt; /* "enable" nesting count */ | 188 | int nesting_cnt; /* "enable" nesting count */ |
187 | int en_dis_recurs; /* detect recursion */ | 189 | int en_dis_recurs; /* detect recursion */ |
188 | unsigned int disable_delay; /* disable delay in msecs */ | 190 | unsigned int disable_delay; /* disable delay in msecs */ |
@@ -257,6 +259,7 @@ int mmc_card_can_sleep(struct mmc_host *host); | |||
257 | int mmc_host_enable(struct mmc_host *host); | 259 | int mmc_host_enable(struct mmc_host *host); |
258 | int mmc_host_disable(struct mmc_host *host); | 260 | int mmc_host_disable(struct mmc_host *host); |
259 | int mmc_host_lazy_disable(struct mmc_host *host); | 261 | int mmc_host_lazy_disable(struct mmc_host *host); |
262 | int mmc_pm_notify(struct notifier_block *notify_block, unsigned long, void *); | ||
260 | 263 | ||
261 | static inline void mmc_set_disable_delay(struct mmc_host *host, | 264 | static inline void mmc_set_disable_delay(struct mmc_host *host, |
262 | unsigned int disable_delay) | 265 | unsigned int disable_delay) |
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h index 8a49cbf0376d..52ce98866287 100644 --- a/include/linux/mmc/mmc.h +++ b/include/linux/mmc/mmc.h | |||
@@ -254,6 +254,7 @@ struct _mmc_csd { | |||
254 | #define EXT_CSD_BUS_WIDTH 183 /* R/W */ | 254 | #define EXT_CSD_BUS_WIDTH 183 /* R/W */ |
255 | #define EXT_CSD_HS_TIMING 185 /* R/W */ | 255 | #define EXT_CSD_HS_TIMING 185 /* R/W */ |
256 | #define EXT_CSD_CARD_TYPE 196 /* RO */ | 256 | #define EXT_CSD_CARD_TYPE 196 /* RO */ |
257 | #define EXT_CSD_STRUCTURE 194 /* RO */ | ||
257 | #define EXT_CSD_REV 192 /* RO */ | 258 | #define EXT_CSD_REV 192 /* RO */ |
258 | #define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */ | 259 | #define EXT_CSD_SEC_CNT 212 /* RO, 4 bytes */ |
259 | #define EXT_CSD_S_A_TIMEOUT 217 | 260 | #define EXT_CSD_S_A_TIMEOUT 217 |
diff --git a/include/linux/oom.h b/include/linux/oom.h index f209b683e118..5e3aa8311c5e 100644 --- a/include/linux/oom.h +++ b/include/linux/oom.h | |||
@@ -66,6 +66,8 @@ static inline void oom_killer_enable(void) | |||
66 | extern unsigned long badness(struct task_struct *p, struct mem_cgroup *mem, | 66 | extern unsigned long badness(struct task_struct *p, struct mem_cgroup *mem, |
67 | const nodemask_t *nodemask, unsigned long uptime); | 67 | const nodemask_t *nodemask, unsigned long uptime); |
68 | 68 | ||
69 | extern struct task_struct *find_lock_task_mm(struct task_struct *p); | ||
70 | |||
69 | /* sysctls */ | 71 | /* sysctls */ |
70 | extern int sysctl_oom_dump_tasks; | 72 | extern int sysctl_oom_dump_tasks; |
71 | extern int sysctl_oom_kill_allocating_task; | 73 | extern int sysctl_oom_kill_allocating_task; |
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h index c81eec4d3c35..f6a3b2d36cad 100644 --- a/include/linux/pci_ids.h +++ b/include/linux/pci_ids.h | |||
@@ -2372,6 +2372,9 @@ | |||
2372 | #define PCI_VENDOR_ID_AKS 0x416c | 2372 | #define PCI_VENDOR_ID_AKS 0x416c |
2373 | #define PCI_DEVICE_ID_AKS_ALADDINCARD 0x0100 | 2373 | #define PCI_DEVICE_ID_AKS_ALADDINCARD 0x0100 |
2374 | 2374 | ||
2375 | #define PCI_VENDOR_ID_ACCESSIO 0x494f | ||
2376 | #define PCI_DEVICE_ID_ACCESSIO_WDG_CSM 0x22c0 | ||
2377 | |||
2375 | #define PCI_VENDOR_ID_S3 0x5333 | 2378 | #define PCI_VENDOR_ID_S3 0x5333 |
2376 | #define PCI_DEVICE_ID_S3_TRIO 0x8811 | 2379 | #define PCI_DEVICE_ID_S3_TRIO 0x8811 |
2377 | #define PCI_DEVICE_ID_S3_868 0x8880 | 2380 | #define PCI_DEVICE_ID_S3_868 0x8880 |
diff --git a/include/linux/serial.h b/include/linux/serial.h index c8613c3ff9d3..1ebc694a6d52 100644 --- a/include/linux/serial.h +++ b/include/linux/serial.h | |||
@@ -77,7 +77,8 @@ struct serial_struct { | |||
77 | #define PORT_16654 11 | 77 | #define PORT_16654 11 |
78 | #define PORT_16850 12 | 78 | #define PORT_16850 12 |
79 | #define PORT_RSA 13 /* RSA-DV II/S card */ | 79 | #define PORT_RSA 13 /* RSA-DV II/S card */ |
80 | #define PORT_MAX 13 | 80 | #define PORT_U6_16550A 14 |
81 | #define PORT_MAX 14 | ||
81 | 82 | ||
82 | #define SERIAL_IO_PORT 0 | 83 | #define SERIAL_IO_PORT 0 |
83 | #define SERIAL_IO_HUB6 1 | 84 | #define SERIAL_IO_HUB6 1 |
@@ -151,7 +152,7 @@ struct serial_uart_config { | |||
151 | #define ASYNC_BUGGY_UART (1U << ASYNCB_BUGGY_UART) | 152 | #define ASYNC_BUGGY_UART (1U << ASYNCB_BUGGY_UART) |
152 | #define ASYNC_AUTOPROBE (1U << ASYNCB_AUTOPROBE) | 153 | #define ASYNC_AUTOPROBE (1U << ASYNCB_AUTOPROBE) |
153 | 154 | ||
154 | #define ASYNC_FLAGS ((1U << ASYNCB_LAST_USER) - 1) | 155 | #define ASYNC_FLAGS ((1U << (ASYNCB_LAST_USER + 1)) - 1) |
155 | #define ASYNC_USR_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI| \ | 156 | #define ASYNC_USR_MASK (ASYNC_SPD_HI|ASYNC_SPD_VHI| \ |
156 | ASYNC_CALLOUT_NOHUP|ASYNC_SPD_SHI|ASYNC_LOW_LATENCY) | 157 | ASYNC_CALLOUT_NOHUP|ASYNC_SPD_SHI|ASYNC_LOW_LATENCY) |
157 | #define ASYNC_SPD_CUST (ASYNC_SPD_HI|ASYNC_SPD_VHI) | 158 | #define ASYNC_SPD_CUST (ASYNC_SPD_HI|ASYNC_SPD_VHI) |
@@ -210,8 +211,10 @@ struct serial_rs485 { | |||
210 | #define SER_RS485_ENABLED (1 << 0) | 211 | #define SER_RS485_ENABLED (1 << 0) |
211 | #define SER_RS485_RTS_ON_SEND (1 << 1) | 212 | #define SER_RS485_RTS_ON_SEND (1 << 1) |
212 | #define SER_RS485_RTS_AFTER_SEND (1 << 2) | 213 | #define SER_RS485_RTS_AFTER_SEND (1 << 2) |
214 | #define SER_RS485_RTS_BEFORE_SEND (1 << 3) | ||
213 | __u32 delay_rts_before_send; /* Milliseconds */ | 215 | __u32 delay_rts_before_send; /* Milliseconds */ |
214 | __u32 padding[6]; /* Memory is cheap, new structs | 216 | __u32 delay_rts_after_send; /* Milliseconds */ |
217 | __u32 padding[5]; /* Memory is cheap, new structs | ||
215 | are a royal PITA .. */ | 218 | are a royal PITA .. */ |
216 | }; | 219 | }; |
217 | 220 | ||
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h index fb46aba11fb5..7638deaaba65 100644 --- a/include/linux/serial_8250.h +++ b/include/linux/serial_8250.h | |||
@@ -32,6 +32,9 @@ struct plat_serial8250_port { | |||
32 | unsigned int type; /* If UPF_FIXED_TYPE */ | 32 | unsigned int type; /* If UPF_FIXED_TYPE */ |
33 | unsigned int (*serial_in)(struct uart_port *, int); | 33 | unsigned int (*serial_in)(struct uart_port *, int); |
34 | void (*serial_out)(struct uart_port *, int, int); | 34 | void (*serial_out)(struct uart_port *, int, int); |
35 | void (*set_termios)(struct uart_port *, | ||
36 | struct ktermios *new, | ||
37 | struct ktermios *old); | ||
35 | }; | 38 | }; |
36 | 39 | ||
37 | /* | 40 | /* |
@@ -71,5 +74,7 @@ extern int early_serial_setup(struct uart_port *port); | |||
71 | extern int serial8250_find_port(struct uart_port *p); | 74 | extern int serial8250_find_port(struct uart_port *p); |
72 | extern int serial8250_find_port_for_earlycon(void); | 75 | extern int serial8250_find_port_for_earlycon(void); |
73 | extern int setup_early_serial8250_console(char *cmdline); | 76 | extern int setup_early_serial8250_console(char *cmdline); |
77 | extern void serial8250_do_set_termios(struct uart_port *port, | ||
78 | struct ktermios *termios, struct ktermios *old); | ||
74 | 79 | ||
75 | #endif | 80 | #endif |
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index f10db6e5f3b5..3c2ad99fed34 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h | |||
@@ -186,6 +186,15 @@ | |||
186 | #define PORT_ALTERA_JTAGUART 91 | 186 | #define PORT_ALTERA_JTAGUART 91 |
187 | #define PORT_ALTERA_UART 92 | 187 | #define PORT_ALTERA_UART 92 |
188 | 188 | ||
189 | /* SH-SCI */ | ||
190 | #define PORT_SCIFB 93 | ||
191 | |||
192 | /* MAX3107 */ | ||
193 | #define PORT_MAX3107 94 | ||
194 | |||
195 | /* High Speed UART for Medfield */ | ||
196 | #define PORT_MFD 95 | ||
197 | |||
189 | #ifdef __KERNEL__ | 198 | #ifdef __KERNEL__ |
190 | 199 | ||
191 | #include <linux/compiler.h> | 200 | #include <linux/compiler.h> |
@@ -220,7 +229,7 @@ struct uart_ops { | |||
220 | void (*flush_buffer)(struct uart_port *); | 229 | void (*flush_buffer)(struct uart_port *); |
221 | void (*set_termios)(struct uart_port *, struct ktermios *new, | 230 | void (*set_termios)(struct uart_port *, struct ktermios *new, |
222 | struct ktermios *old); | 231 | struct ktermios *old); |
223 | void (*set_ldisc)(struct uart_port *); | 232 | void (*set_ldisc)(struct uart_port *, int new); |
224 | void (*pm)(struct uart_port *, unsigned int state, | 233 | void (*pm)(struct uart_port *, unsigned int state, |
225 | unsigned int oldstate); | 234 | unsigned int oldstate); |
226 | int (*set_wake)(struct uart_port *, unsigned int state); | 235 | int (*set_wake)(struct uart_port *, unsigned int state); |
@@ -276,6 +285,9 @@ struct uart_port { | |||
276 | unsigned char __iomem *membase; /* read/write[bwl] */ | 285 | unsigned char __iomem *membase; /* read/write[bwl] */ |
277 | unsigned int (*serial_in)(struct uart_port *, int); | 286 | unsigned int (*serial_in)(struct uart_port *, int); |
278 | void (*serial_out)(struct uart_port *, int, int); | 287 | void (*serial_out)(struct uart_port *, int, int); |
288 | void (*set_termios)(struct uart_port *, | ||
289 | struct ktermios *new, | ||
290 | struct ktermios *old); | ||
279 | unsigned int irq; /* irq number */ | 291 | unsigned int irq; /* irq number */ |
280 | unsigned long irqflags; /* irq flags */ | 292 | unsigned long irqflags; /* irq flags */ |
281 | unsigned int uartclk; /* base uart clock */ | 293 | unsigned int uartclk; /* base uart clock */ |
diff --git a/include/linux/serial_mfd.h b/include/linux/serial_mfd.h new file mode 100644 index 000000000000..2b071e0b034d --- /dev/null +++ b/include/linux/serial_mfd.h | |||
@@ -0,0 +1,47 @@ | |||
1 | #ifndef _SERIAL_MFD_H_ | ||
2 | #define _SERIAL_MFD_H_ | ||
3 | |||
4 | /* HW register offset definition */ | ||
5 | #define UART_FOR 0x08 | ||
6 | #define UART_PS 0x0C | ||
7 | #define UART_MUL 0x0D | ||
8 | #define UART_DIV 0x0E | ||
9 | |||
10 | #define HSU_GBL_IEN 0x0 | ||
11 | #define HSU_GBL_IST 0x4 | ||
12 | |||
13 | #define HSU_GBL_INT_BIT_PORT0 0x0 | ||
14 | #define HSU_GBL_INT_BIT_PORT1 0x1 | ||
15 | #define HSU_GBL_INT_BIT_PORT2 0x2 | ||
16 | #define HSU_GBL_INT_BIT_IRI 0x3 | ||
17 | #define HSU_GBL_INT_BIT_HDLC 0x4 | ||
18 | #define HSU_GBL_INT_BIT_DMA 0x5 | ||
19 | |||
20 | #define HSU_GBL_ISR 0x8 | ||
21 | #define HSU_GBL_DMASR 0x400 | ||
22 | #define HSU_GBL_DMAISR 0x404 | ||
23 | |||
24 | #define HSU_PORT_REG_OFFSET 0x80 | ||
25 | #define HSU_PORT0_REG_OFFSET 0x80 | ||
26 | #define HSU_PORT1_REG_OFFSET 0x100 | ||
27 | #define HSU_PORT2_REG_OFFSET 0x180 | ||
28 | #define HSU_PORT_REG_LENGTH 0x80 | ||
29 | |||
30 | #define HSU_DMA_CHANS_REG_OFFSET 0x500 | ||
31 | #define HSU_DMA_CHANS_REG_LENGTH 0x40 | ||
32 | |||
33 | #define HSU_CH_SR 0x0 /* channel status reg */ | ||
34 | #define HSU_CH_CR 0x4 /* control reg */ | ||
35 | #define HSU_CH_DCR 0x8 /* descriptor control reg */ | ||
36 | #define HSU_CH_BSR 0x10 /* max fifo buffer size reg */ | ||
37 | #define HSU_CH_MOTSR 0x14 /* minimum ocp transfer size */ | ||
38 | #define HSU_CH_D0SAR 0x20 /* desc 0 start addr */ | ||
39 | #define HSU_CH_D0TSR 0x24 /* desc 0 transfer size */ | ||
40 | #define HSU_CH_D1SAR 0x28 | ||
41 | #define HSU_CH_D1TSR 0x2C | ||
42 | #define HSU_CH_D2SAR 0x30 | ||
43 | #define HSU_CH_D2TSR 0x34 | ||
44 | #define HSU_CH_D3SAR 0x38 | ||
45 | #define HSU_CH_D3TSR 0x3C | ||
46 | |||
47 | #endif | ||
diff --git a/include/linux/serial_reg.h b/include/linux/serial_reg.h index cf9327c051ad..c7a0ce11cd47 100644 --- a/include/linux/serial_reg.h +++ b/include/linux/serial_reg.h | |||
@@ -221,8 +221,24 @@ | |||
221 | #define UART_FCR_PXAR16 0x80 /* receive FIFO threshold = 16 */ | 221 | #define UART_FCR_PXAR16 0x80 /* receive FIFO threshold = 16 */ |
222 | #define UART_FCR_PXAR32 0xc0 /* receive FIFO threshold = 32 */ | 222 | #define UART_FCR_PXAR32 0xc0 /* receive FIFO threshold = 32 */ |
223 | 223 | ||
224 | /* | ||
225 | * Intel MID on-chip HSU (High Speed UART) defined bits | ||
226 | */ | ||
227 | #define UART_FCR_HSU_64_1B 0x00 /* receive FIFO treshold = 1 */ | ||
228 | #define UART_FCR_HSU_64_16B 0x40 /* receive FIFO treshold = 16 */ | ||
229 | #define UART_FCR_HSU_64_32B 0x80 /* receive FIFO treshold = 32 */ | ||
230 | #define UART_FCR_HSU_64_56B 0xc0 /* receive FIFO treshold = 56 */ | ||
231 | |||
232 | #define UART_FCR_HSU_16_1B 0x00 /* receive FIFO treshold = 1 */ | ||
233 | #define UART_FCR_HSU_16_4B 0x40 /* receive FIFO treshold = 4 */ | ||
234 | #define UART_FCR_HSU_16_8B 0x80 /* receive FIFO treshold = 8 */ | ||
235 | #define UART_FCR_HSU_16_14B 0xc0 /* receive FIFO treshold = 14 */ | ||
224 | 236 | ||
237 | #define UART_FCR_HSU_64B_FIFO 0x20 /* chose 64 bytes FIFO */ | ||
238 | #define UART_FCR_HSU_16B_FIFO 0x00 /* chose 16 bytes FIFO */ | ||
225 | 239 | ||
240 | #define UART_FCR_HALF_EMPT_TXI 0x00 /* trigger TX_EMPT IRQ for half empty */ | ||
241 | #define UART_FCR_FULL_EMPT_TXI 0x08 /* trigger TX_EMPT IRQ for full empty */ | ||
226 | 242 | ||
227 | /* | 243 | /* |
228 | * These register definitions are for the 16C950 | 244 | * These register definitions are for the 16C950 |
diff --git a/include/linux/sh_clk.h b/include/linux/sh_clk.h index 1636d1e2a5f1..875ce50719a9 100644 --- a/include/linux/sh_clk.h +++ b/include/linux/sh_clk.h | |||
@@ -25,6 +25,10 @@ struct clk { | |||
25 | int id; | 25 | int id; |
26 | 26 | ||
27 | struct clk *parent; | 27 | struct clk *parent; |
28 | struct clk **parent_table; /* list of parents to */ | ||
29 | unsigned short parent_num; /* choose between */ | ||
30 | unsigned char src_shift; /* source clock field in the */ | ||
31 | unsigned char src_width; /* configuration register */ | ||
28 | struct clk_ops *ops; | 32 | struct clk_ops *ops; |
29 | 33 | ||
30 | struct list_head children; | 34 | struct list_head children; |
@@ -138,13 +142,22 @@ int sh_clk_div4_enable_register(struct clk *clks, int nr, | |||
138 | int sh_clk_div4_reparent_register(struct clk *clks, int nr, | 142 | int sh_clk_div4_reparent_register(struct clk *clks, int nr, |
139 | struct clk_div4_table *table); | 143 | struct clk_div4_table *table); |
140 | 144 | ||
141 | #define SH_CLK_DIV6(_parent, _reg, _flags) \ | 145 | #define SH_CLK_DIV6_EXT(_parent, _reg, _flags, _parents, \ |
142 | { \ | 146 | _num_parents, _src_shift, _src_width) \ |
143 | .parent = _parent, \ | 147 | { \ |
144 | .enable_reg = (void __iomem *)_reg, \ | 148 | .parent = _parent, \ |
145 | .flags = _flags, \ | 149 | .enable_reg = (void __iomem *)_reg, \ |
150 | .flags = _flags, \ | ||
151 | .parent_table = _parents, \ | ||
152 | .parent_num = _num_parents, \ | ||
153 | .src_shift = _src_shift, \ | ||
154 | .src_width = _src_width, \ | ||
146 | } | 155 | } |
147 | 156 | ||
157 | #define SH_CLK_DIV6(_parent, _reg, _flags) \ | ||
158 | SH_CLK_DIV6_EXT(_parent, _reg, _flags, NULL, 0, 0, 0) | ||
159 | |||
148 | int sh_clk_div6_register(struct clk *clks, int nr); | 160 | int sh_clk_div6_register(struct clk *clks, int nr); |
161 | int sh_clk_div6_reparent_register(struct clk *clks, int nr); | ||
149 | 162 | ||
150 | #endif /* __SH_CLOCK_H */ | 163 | #endif /* __SH_CLOCK_H */ |
diff --git a/include/linux/slab_def.h b/include/linux/slab_def.h index 1acfa73ce2ac..791a502f6906 100644 --- a/include/linux/slab_def.h +++ b/include/linux/slab_def.h | |||
@@ -17,7 +17,6 @@ | |||
17 | 17 | ||
18 | #include <trace/events/kmem.h> | 18 | #include <trace/events/kmem.h> |
19 | 19 | ||
20 | #ifndef ARCH_KMALLOC_MINALIGN | ||
21 | /* | 20 | /* |
22 | * Enforce a minimum alignment for the kmalloc caches. | 21 | * Enforce a minimum alignment for the kmalloc caches. |
23 | * Usually, the kmalloc caches are cache_line_size() aligned, except when | 22 | * Usually, the kmalloc caches are cache_line_size() aligned, except when |
@@ -27,6 +26,9 @@ | |||
27 | * ARCH_KMALLOC_MINALIGN allows that. | 26 | * ARCH_KMALLOC_MINALIGN allows that. |
28 | * Note that increasing this value may disable some debug features. | 27 | * Note that increasing this value may disable some debug features. |
29 | */ | 28 | */ |
29 | #ifdef ARCH_DMA_MINALIGN | ||
30 | #define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN | ||
31 | #else | ||
30 | #define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long) | 32 | #define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long) |
31 | #endif | 33 | #endif |
32 | 34 | ||
diff --git a/include/linux/slob_def.h b/include/linux/slob_def.h index 62667f72c2ef..4382db09df4f 100644 --- a/include/linux/slob_def.h +++ b/include/linux/slob_def.h | |||
@@ -1,7 +1,9 @@ | |||
1 | #ifndef __LINUX_SLOB_DEF_H | 1 | #ifndef __LINUX_SLOB_DEF_H |
2 | #define __LINUX_SLOB_DEF_H | 2 | #define __LINUX_SLOB_DEF_H |
3 | 3 | ||
4 | #ifndef ARCH_KMALLOC_MINALIGN | 4 | #ifdef ARCH_DMA_MINALIGN |
5 | #define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN | ||
6 | #else | ||
5 | #define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long) | 7 | #define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long) |
6 | #endif | 8 | #endif |
7 | 9 | ||
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index 6447a723ecb1..6d14409c4d9a 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h | |||
@@ -106,15 +106,17 @@ struct kmem_cache { | |||
106 | /* | 106 | /* |
107 | * Kmalloc subsystem. | 107 | * Kmalloc subsystem. |
108 | */ | 108 | */ |
109 | #if defined(ARCH_KMALLOC_MINALIGN) && ARCH_KMALLOC_MINALIGN > 8 | 109 | #if defined(ARCH_DMA_MINALIGN) && ARCH_DMA_MINALIGN > 8 |
110 | #define KMALLOC_MIN_SIZE ARCH_KMALLOC_MINALIGN | 110 | #define KMALLOC_MIN_SIZE ARCH_DMA_MINALIGN |
111 | #else | 111 | #else |
112 | #define KMALLOC_MIN_SIZE 8 | 112 | #define KMALLOC_MIN_SIZE 8 |
113 | #endif | 113 | #endif |
114 | 114 | ||
115 | #define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE) | 115 | #define KMALLOC_SHIFT_LOW ilog2(KMALLOC_MIN_SIZE) |
116 | 116 | ||
117 | #ifndef ARCH_KMALLOC_MINALIGN | 117 | #ifdef ARCH_DMA_MINALIGN |
118 | #define ARCH_KMALLOC_MINALIGN ARCH_DMA_MINALIGN | ||
119 | #else | ||
118 | #define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long) | 120 | #define ARCH_KMALLOC_MINALIGN __alignof__(unsigned long long) |
119 | #endif | 121 | #endif |
120 | 122 | ||
diff --git a/include/linux/spi/max7301.h b/include/linux/spi/max7301.h index 34af0a3477bf..bcaa2f762cc1 100644 --- a/include/linux/spi/max7301.h +++ b/include/linux/spi/max7301.h | |||
@@ -11,6 +11,7 @@ struct max7301 { | |||
11 | struct mutex lock; | 11 | struct mutex lock; |
12 | u8 port_config[8]; /* field 0 is unused */ | 12 | u8 port_config[8]; /* field 0 is unused */ |
13 | u32 out_level; /* cached output levels */ | 13 | u32 out_level; /* cached output levels */ |
14 | u32 input_pullup_active; | ||
14 | struct gpio_chip chip; | 15 | struct gpio_chip chip; |
15 | struct device *dev; | 16 | struct device *dev; |
16 | int (*write)(struct device *dev, unsigned int reg, unsigned int val); | 17 | int (*write)(struct device *dev, unsigned int reg, unsigned int val); |
@@ -20,6 +21,13 @@ struct max7301 { | |||
20 | struct max7301_platform_data { | 21 | struct max7301_platform_data { |
21 | /* number assigned to the first GPIO */ | 22 | /* number assigned to the first GPIO */ |
22 | unsigned base; | 23 | unsigned base; |
24 | /* | ||
25 | * bitmask controlling the pullup configuration, | ||
26 | * | ||
27 | * _note_ the 4 lowest bits are unused, because the first 4 | ||
28 | * ports of the controller are not used, too. | ||
29 | */ | ||
30 | u32 input_pullup_active; | ||
23 | }; | 31 | }; |
24 | 32 | ||
25 | extern int __max730x_remove(struct device *dev); | 33 | extern int __max730x_remove(struct device *dev); |
diff --git a/include/linux/swap.h b/include/linux/swap.h index 91c9d3fc8513..2fee51a11b73 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h | |||
@@ -244,8 +244,7 @@ extern unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *mem, | |||
244 | extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem, | 244 | extern unsigned long mem_cgroup_shrink_node_zone(struct mem_cgroup *mem, |
245 | gfp_t gfp_mask, bool noswap, | 245 | gfp_t gfp_mask, bool noswap, |
246 | unsigned int swappiness, | 246 | unsigned int swappiness, |
247 | struct zone *zone, | 247 | struct zone *zone); |
248 | int nid); | ||
249 | extern int __isolate_lru_page(struct page *page, int mode, int file); | 248 | extern int __isolate_lru_page(struct page *page, int mode, int file); |
250 | extern unsigned long shrink_all_memory(unsigned long nr_pages); | 249 | extern unsigned long shrink_all_memory(unsigned long nr_pages); |
251 | extern int vm_swappiness; | 250 | extern int vm_swappiness; |
diff --git a/include/linux/tty.h b/include/linux/tty.h index 7802a243ee13..1437da3ddc62 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/tty_driver.h> | 13 | #include <linux/tty_driver.h> |
14 | #include <linux/tty_ldisc.h> | 14 | #include <linux/tty_ldisc.h> |
15 | #include <linux/mutex.h> | 15 | #include <linux/mutex.h> |
16 | #include <linux/smp_lock.h> | ||
16 | 17 | ||
17 | #include <asm/system.h> | 18 | #include <asm/system.h> |
18 | 19 | ||
@@ -179,6 +180,7 @@ struct tty_bufhead { | |||
179 | #define L_FLUSHO(tty) _L_FLAG((tty), FLUSHO) | 180 | #define L_FLUSHO(tty) _L_FLAG((tty), FLUSHO) |
180 | #define L_PENDIN(tty) _L_FLAG((tty), PENDIN) | 181 | #define L_PENDIN(tty) _L_FLAG((tty), PENDIN) |
181 | #define L_IEXTEN(tty) _L_FLAG((tty), IEXTEN) | 182 | #define L_IEXTEN(tty) _L_FLAG((tty), IEXTEN) |
183 | #define L_EXTPROC(tty) _L_FLAG((tty), EXTPROC) | ||
182 | 184 | ||
183 | struct device; | 185 | struct device; |
184 | struct signal_struct; | 186 | struct signal_struct; |
@@ -415,6 +417,7 @@ extern int is_ignored(int sig); | |||
415 | extern int tty_signal(int sig, struct tty_struct *tty); | 417 | extern int tty_signal(int sig, struct tty_struct *tty); |
416 | extern void tty_hangup(struct tty_struct *tty); | 418 | extern void tty_hangup(struct tty_struct *tty); |
417 | extern void tty_vhangup(struct tty_struct *tty); | 419 | extern void tty_vhangup(struct tty_struct *tty); |
420 | extern void tty_vhangup_locked(struct tty_struct *tty); | ||
418 | extern void tty_vhangup_self(void); | 421 | extern void tty_vhangup_self(void); |
419 | extern void tty_unhangup(struct file *filp); | 422 | extern void tty_unhangup(struct file *filp); |
420 | extern int tty_hung_up_p(struct file *filp); | 423 | extern int tty_hung_up_p(struct file *filp); |
@@ -575,5 +578,54 @@ extern int vt_ioctl(struct tty_struct *tty, struct file *file, | |||
575 | extern long vt_compat_ioctl(struct tty_struct *tty, struct file * file, | 578 | extern long vt_compat_ioctl(struct tty_struct *tty, struct file * file, |
576 | unsigned int cmd, unsigned long arg); | 579 | unsigned int cmd, unsigned long arg); |
577 | 580 | ||
581 | /* tty_mutex.c */ | ||
582 | /* functions for preparation of BKL removal */ | ||
583 | extern void __lockfunc tty_lock(void) __acquires(tty_lock); | ||
584 | extern void __lockfunc tty_unlock(void) __releases(tty_lock); | ||
585 | extern struct task_struct *__big_tty_mutex_owner; | ||
586 | #define tty_locked() (current == __big_tty_mutex_owner) | ||
587 | |||
588 | /* | ||
589 | * wait_event_interruptible_tty -- wait for a condition with the tty lock held | ||
590 | * | ||
591 | * The condition we are waiting for might take a long time to | ||
592 | * become true, or might depend on another thread taking the | ||
593 | * BTM. In either case, we need to drop the BTM to guarantee | ||
594 | * forward progress. This is a leftover from the conversion | ||
595 | * from the BKL and should eventually get removed as the BTM | ||
596 | * falls out of use. | ||
597 | * | ||
598 | * Do not use in new code. | ||
599 | */ | ||
600 | #define wait_event_interruptible_tty(wq, condition) \ | ||
601 | ({ \ | ||
602 | int __ret = 0; \ | ||
603 | if (!(condition)) { \ | ||
604 | __wait_event_interruptible_tty(wq, condition, __ret); \ | ||
605 | } \ | ||
606 | __ret; \ | ||
607 | }) | ||
608 | |||
609 | #define __wait_event_interruptible_tty(wq, condition, ret) \ | ||
610 | do { \ | ||
611 | DEFINE_WAIT(__wait); \ | ||
612 | \ | ||
613 | for (;;) { \ | ||
614 | prepare_to_wait(&wq, &__wait, TASK_INTERRUPTIBLE); \ | ||
615 | if (condition) \ | ||
616 | break; \ | ||
617 | if (!signal_pending(current)) { \ | ||
618 | tty_unlock(); \ | ||
619 | schedule(); \ | ||
620 | tty_lock(); \ | ||
621 | continue; \ | ||
622 | } \ | ||
623 | ret = -ERESTARTSYS; \ | ||
624 | break; \ | ||
625 | } \ | ||
626 | finish_wait(&wq, &__wait); \ | ||
627 | } while (0) | ||
628 | |||
629 | |||
578 | #endif /* __KERNEL__ */ | 630 | #endif /* __KERNEL__ */ |
579 | #endif | 631 | #endif |
diff --git a/include/linux/usb.h b/include/linux/usb.h index d5922a877994..35fe6ab222bb 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -127,6 +127,8 @@ enum usb_interface_condition { | |||
127 | * queued reset so that usb_cancel_queued_reset() doesn't try to | 127 | * queued reset so that usb_cancel_queued_reset() doesn't try to |
128 | * remove from the workqueue when running inside the worker | 128 | * remove from the workqueue when running inside the worker |
129 | * thread. See __usb_queue_reset_device(). | 129 | * thread. See __usb_queue_reset_device(). |
130 | * @resetting_device: USB core reset the device, so use alt setting 0 as | ||
131 | * current; needs bandwidth alloc after reset. | ||
130 | * | 132 | * |
131 | * USB device drivers attach to interfaces on a physical device. Each | 133 | * USB device drivers attach to interfaces on a physical device. Each |
132 | * interface encapsulates a single high level function, such as feeding | 134 | * interface encapsulates a single high level function, such as feeding |
@@ -843,7 +845,7 @@ struct usb_driver { | |||
843 | 845 | ||
844 | void (*disconnect) (struct usb_interface *intf); | 846 | void (*disconnect) (struct usb_interface *intf); |
845 | 847 | ||
846 | int (*ioctl) (struct usb_interface *intf, unsigned int code, | 848 | int (*unlocked_ioctl) (struct usb_interface *intf, unsigned int code, |
847 | void *buf); | 849 | void *buf); |
848 | 850 | ||
849 | int (*suspend) (struct usb_interface *intf, pm_message_t message); | 851 | int (*suspend) (struct usb_interface *intf, pm_message_t message); |
@@ -1015,6 +1017,7 @@ typedef void (*usb_complete_t)(struct urb *); | |||
1015 | * is a different endpoint (and pipe) from "out" endpoint two. | 1017 | * is a different endpoint (and pipe) from "out" endpoint two. |
1016 | * The current configuration controls the existence, type, and | 1018 | * The current configuration controls the existence, type, and |
1017 | * maximum packet size of any given endpoint. | 1019 | * maximum packet size of any given endpoint. |
1020 | * @stream_id: the endpoint's stream ID for bulk streams | ||
1018 | * @dev: Identifies the USB device to perform the request. | 1021 | * @dev: Identifies the USB device to perform the request. |
1019 | * @status: This is read in non-iso completion functions to get the | 1022 | * @status: This is read in non-iso completion functions to get the |
1020 | * status of the particular request. ISO requests only use it | 1023 | * status of the particular request. ISO requests only use it |
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index 139353efad34..890bc1472190 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h | |||
@@ -276,6 +276,8 @@ struct usb_composite_driver { | |||
276 | int (*bind)(struct usb_composite_dev *); | 276 | int (*bind)(struct usb_composite_dev *); |
277 | int (*unbind)(struct usb_composite_dev *); | 277 | int (*unbind)(struct usb_composite_dev *); |
278 | 278 | ||
279 | void (*disconnect)(struct usb_composite_dev *); | ||
280 | |||
279 | /* global suspend hooks */ | 281 | /* global suspend hooks */ |
280 | void (*suspend)(struct usb_composite_dev *); | 282 | void (*suspend)(struct usb_composite_dev *); |
281 | void (*resume)(struct usb_composite_dev *); | 283 | void (*resume)(struct usb_composite_dev *); |
@@ -342,6 +344,10 @@ struct usb_composite_dev { | |||
342 | }; | 344 | }; |
343 | 345 | ||
344 | extern int usb_string_id(struct usb_composite_dev *c); | 346 | extern int usb_string_id(struct usb_composite_dev *c); |
347 | extern int usb_string_ids_tab(struct usb_composite_dev *c, | ||
348 | struct usb_string *str); | ||
349 | extern int usb_string_ids_n(struct usb_composite_dev *c, unsigned n); | ||
350 | |||
345 | 351 | ||
346 | /* messaging utils */ | 352 | /* messaging utils */ |
347 | #define DBG(d, fmt, args...) \ | 353 | #define DBG(d, fmt, args...) \ |
diff --git a/include/linux/usb/ehci_def.h b/include/linux/usb/ehci_def.h index 80287af2a738..2e262cb15425 100644 --- a/include/linux/usb/ehci_def.h +++ b/include/linux/usb/ehci_def.h | |||
@@ -39,6 +39,12 @@ struct ehci_caps { | |||
39 | #define HCS_N_PORTS(p) (((p)>>0)&0xf) /* bits 3:0, ports on HC */ | 39 | #define HCS_N_PORTS(p) (((p)>>0)&0xf) /* bits 3:0, ports on HC */ |
40 | 40 | ||
41 | u32 hcc_params; /* HCCPARAMS - offset 0x8 */ | 41 | u32 hcc_params; /* HCCPARAMS - offset 0x8 */ |
42 | /* EHCI 1.1 addendum */ | ||
43 | #define HCC_32FRAME_PERIODIC_LIST(p) ((p)&(1 << 19)) | ||
44 | #define HCC_PER_PORT_CHANGE_EVENT(p) ((p)&(1 << 18)) | ||
45 | #define HCC_LPM(p) ((p)&(1 << 17)) | ||
46 | #define HCC_HW_PREFETCH(p) ((p)&(1 << 16)) | ||
47 | |||
42 | #define HCC_EXT_CAPS(p) (((p)>>8)&0xff) /* for pci extended caps */ | 48 | #define HCC_EXT_CAPS(p) (((p)>>8)&0xff) /* for pci extended caps */ |
43 | #define HCC_ISOC_CACHE(p) ((p)&(1 << 7)) /* true: can cache isoc frame */ | 49 | #define HCC_ISOC_CACHE(p) ((p)&(1 << 7)) /* true: can cache isoc frame */ |
44 | #define HCC_ISOC_THRES(p) (((p)>>4)&0x7) /* bits 6:4, uframes cached */ | 50 | #define HCC_ISOC_THRES(p) (((p)>>4)&0x7) /* bits 6:4, uframes cached */ |
@@ -54,6 +60,13 @@ struct ehci_regs { | |||
54 | 60 | ||
55 | /* USBCMD: offset 0x00 */ | 61 | /* USBCMD: offset 0x00 */ |
56 | u32 command; | 62 | u32 command; |
63 | |||
64 | /* EHCI 1.1 addendum */ | ||
65 | #define CMD_HIRD (0xf<<24) /* host initiated resume duration */ | ||
66 | #define CMD_PPCEE (1<<15) /* per port change event enable */ | ||
67 | #define CMD_FSP (1<<14) /* fully synchronized prefetch */ | ||
68 | #define CMD_ASPE (1<<13) /* async schedule prefetch enable */ | ||
69 | #define CMD_PSPE (1<<12) /* periodic schedule prefetch enable */ | ||
57 | /* 23:16 is r/w intr rate, in microframes; default "8" == 1/msec */ | 70 | /* 23:16 is r/w intr rate, in microframes; default "8" == 1/msec */ |
58 | #define CMD_PARK (1<<11) /* enable "park" on async qh */ | 71 | #define CMD_PARK (1<<11) /* enable "park" on async qh */ |
59 | #define CMD_PARK_CNT(c) (((c)>>8)&3) /* how many transfers to park for */ | 72 | #define CMD_PARK_CNT(c) (((c)>>8)&3) /* how many transfers to park for */ |
@@ -67,6 +80,7 @@ struct ehci_regs { | |||
67 | 80 | ||
68 | /* USBSTS: offset 0x04 */ | 81 | /* USBSTS: offset 0x04 */ |
69 | u32 status; | 82 | u32 status; |
83 | #define STS_PPCE_MASK (0xff<<16) /* Per-Port change event 1-16 */ | ||
70 | #define STS_ASS (1<<15) /* Async Schedule Status */ | 84 | #define STS_ASS (1<<15) /* Async Schedule Status */ |
71 | #define STS_PSS (1<<14) /* Periodic Schedule Status */ | 85 | #define STS_PSS (1<<14) /* Periodic Schedule Status */ |
72 | #define STS_RECL (1<<13) /* Reclamation */ | 86 | #define STS_RECL (1<<13) /* Reclamation */ |
@@ -100,6 +114,14 @@ struct ehci_regs { | |||
100 | 114 | ||
101 | /* PORTSC: offset 0x44 */ | 115 | /* PORTSC: offset 0x44 */ |
102 | u32 port_status[0]; /* up to N_PORTS */ | 116 | u32 port_status[0]; /* up to N_PORTS */ |
117 | /* EHCI 1.1 addendum */ | ||
118 | #define PORTSC_SUSPEND_STS_ACK 0 | ||
119 | #define PORTSC_SUSPEND_STS_NYET 1 | ||
120 | #define PORTSC_SUSPEND_STS_STALL 2 | ||
121 | #define PORTSC_SUSPEND_STS_ERR 3 | ||
122 | |||
123 | #define PORT_DEV_ADDR (0x7f<<25) /* device address */ | ||
124 | #define PORT_SSTS (0x3<<23) /* suspend status */ | ||
103 | /* 31:23 reserved */ | 125 | /* 31:23 reserved */ |
104 | #define PORT_WKOC_E (1<<22) /* wake on overcurrent (enable) */ | 126 | #define PORT_WKOC_E (1<<22) /* wake on overcurrent (enable) */ |
105 | #define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */ | 127 | #define PORT_WKDISC_E (1<<21) /* wake on disconnect (enable) */ |
@@ -115,6 +137,7 @@ struct ehci_regs { | |||
115 | #define PORT_USB11(x) (((x)&(3<<10)) == (1<<10)) /* USB 1.1 device */ | 137 | #define PORT_USB11(x) (((x)&(3<<10)) == (1<<10)) /* USB 1.1 device */ |
116 | /* 11:10 for detecting lowspeed devices (reset vs release ownership) */ | 138 | /* 11:10 for detecting lowspeed devices (reset vs release ownership) */ |
117 | /* 9 reserved */ | 139 | /* 9 reserved */ |
140 | #define PORT_LPM (1<<9) /* LPM transaction */ | ||
118 | #define PORT_RESET (1<<8) /* reset port */ | 141 | #define PORT_RESET (1<<8) /* reset port */ |
119 | #define PORT_SUSPEND (1<<7) /* suspend port */ | 142 | #define PORT_SUSPEND (1<<7) /* suspend port */ |
120 | #define PORT_RESUME (1<<6) /* resume it */ | 143 | #define PORT_RESUME (1<<6) /* resume it */ |
diff --git a/include/linux/usb/functionfs.h b/include/linux/usb/functionfs.h index a34a2a043b21..6f649c13193b 100644 --- a/include/linux/usb/functionfs.h +++ b/include/linux/usb/functionfs.h | |||
@@ -180,9 +180,9 @@ static int functionfs_bind(struct ffs_data *ffs, struct usb_composite_dev *cdev) | |||
180 | static void functionfs_unbind(struct ffs_data *ffs) | 180 | static void functionfs_unbind(struct ffs_data *ffs) |
181 | __attribute__((nonnull)); | 181 | __attribute__((nonnull)); |
182 | 182 | ||
183 | static int functionfs_add(struct usb_composite_dev *cdev, | 183 | static int functionfs_bind_config(struct usb_composite_dev *cdev, |
184 | struct usb_configuration *c, | 184 | struct usb_configuration *c, |
185 | struct ffs_data *ffs) | 185 | struct ffs_data *ffs) |
186 | __attribute__((warn_unused_result, nonnull)); | 186 | __attribute__((warn_unused_result, nonnull)); |
187 | 187 | ||
188 | 188 | ||
diff --git a/include/linux/usb/hcd.h b/include/linux/usb/hcd.h index 2e3a4ea1a3da..3b571f1ffbb3 100644 --- a/include/linux/usb/hcd.h +++ b/include/linux/usb/hcd.h | |||
@@ -89,18 +89,33 @@ struct usb_hcd { | |||
89 | */ | 89 | */ |
90 | const struct hc_driver *driver; /* hw-specific hooks */ | 90 | const struct hc_driver *driver; /* hw-specific hooks */ |
91 | 91 | ||
92 | /* Flags that need to be manipulated atomically */ | 92 | /* Flags that need to be manipulated atomically because they can |
93 | * change while the host controller is running. Always use | ||
94 | * set_bit() or clear_bit() to change their values. | ||
95 | */ | ||
93 | unsigned long flags; | 96 | unsigned long flags; |
94 | #define HCD_FLAG_HW_ACCESSIBLE 0x00000001 | 97 | #define HCD_FLAG_HW_ACCESSIBLE 0 /* at full power */ |
95 | #define HCD_FLAG_SAW_IRQ 0x00000002 | 98 | #define HCD_FLAG_SAW_IRQ 1 |
99 | #define HCD_FLAG_POLL_RH 2 /* poll for rh status? */ | ||
100 | #define HCD_FLAG_POLL_PENDING 3 /* status has changed? */ | ||
101 | #define HCD_FLAG_WAKEUP_PENDING 4 /* root hub is resuming? */ | ||
102 | |||
103 | /* The flags can be tested using these macros; they are likely to | ||
104 | * be slightly faster than test_bit(). | ||
105 | */ | ||
106 | #define HCD_HW_ACCESSIBLE(hcd) ((hcd)->flags & (1U << HCD_FLAG_HW_ACCESSIBLE)) | ||
107 | #define HCD_SAW_IRQ(hcd) ((hcd)->flags & (1U << HCD_FLAG_SAW_IRQ)) | ||
108 | #define HCD_POLL_RH(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_RH)) | ||
109 | #define HCD_POLL_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_POLL_PENDING)) | ||
110 | #define HCD_WAKEUP_PENDING(hcd) ((hcd)->flags & (1U << HCD_FLAG_WAKEUP_PENDING)) | ||
96 | 111 | ||
112 | /* Flags that get set only during HCD registration or removal. */ | ||
97 | unsigned rh_registered:1;/* is root hub registered? */ | 113 | unsigned rh_registered:1;/* is root hub registered? */ |
114 | unsigned rh_pollable:1; /* may we poll the root hub? */ | ||
98 | 115 | ||
99 | /* The next flag is a stopgap, to be removed when all the HCDs | 116 | /* The next flag is a stopgap, to be removed when all the HCDs |
100 | * support the new root-hub polling mechanism. */ | 117 | * support the new root-hub polling mechanism. */ |
101 | unsigned uses_new_polling:1; | 118 | unsigned uses_new_polling:1; |
102 | unsigned poll_rh:1; /* poll for rh status? */ | ||
103 | unsigned poll_pending:1; /* status has changed? */ | ||
104 | unsigned wireless:1; /* Wireless USB HCD */ | 119 | unsigned wireless:1; /* Wireless USB HCD */ |
105 | unsigned authorized_default:1; | 120 | unsigned authorized_default:1; |
106 | unsigned has_tt:1; /* Integrated TT in root hub */ | 121 | unsigned has_tt:1; /* Integrated TT in root hub */ |
@@ -198,7 +213,7 @@ struct hc_driver { | |||
198 | * a whole, not just the root hub; they're for PCI bus glue. | 213 | * a whole, not just the root hub; they're for PCI bus glue. |
199 | */ | 214 | */ |
200 | /* called after suspending the hub, before entering D3 etc */ | 215 | /* called after suspending the hub, before entering D3 etc */ |
201 | int (*pci_suspend)(struct usb_hcd *hcd); | 216 | int (*pci_suspend)(struct usb_hcd *hcd, bool do_wakeup); |
202 | 217 | ||
203 | /* called after entering D0 (etc), before resuming the hub */ | 218 | /* called after entering D0 (etc), before resuming the hub */ |
204 | int (*pci_resume)(struct usb_hcd *hcd, bool hibernated); | 219 | int (*pci_resume)(struct usb_hcd *hcd, bool hibernated); |
@@ -299,6 +314,10 @@ struct hc_driver { | |||
299 | int (*update_hub_device)(struct usb_hcd *, struct usb_device *hdev, | 314 | int (*update_hub_device)(struct usb_hcd *, struct usb_device *hdev, |
300 | struct usb_tt *tt, gfp_t mem_flags); | 315 | struct usb_tt *tt, gfp_t mem_flags); |
301 | int (*reset_device)(struct usb_hcd *, struct usb_device *); | 316 | int (*reset_device)(struct usb_hcd *, struct usb_device *); |
317 | /* Notifies the HCD after a device is connected and its | ||
318 | * address is set | ||
319 | */ | ||
320 | int (*update_device)(struct usb_hcd *, struct usb_device *); | ||
302 | }; | 321 | }; |
303 | 322 | ||
304 | extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb); | 323 | extern int usb_hcd_link_urb_to_ep(struct usb_hcd *hcd, struct urb *urb); |
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h index f8302d036a76..545cba73ccaf 100644 --- a/include/linux/usb/otg.h +++ b/include/linux/usb/otg.h | |||
@@ -43,13 +43,6 @@ enum usb_xceiv_events { | |||
43 | USB_EVENT_ENUMERATED, /* gadget driver enumerated */ | 43 | USB_EVENT_ENUMERATED, /* gadget driver enumerated */ |
44 | }; | 44 | }; |
45 | 45 | ||
46 | #define USB_OTG_PULLUP_ID (1 << 0) | ||
47 | #define USB_OTG_PULLDOWN_DP (1 << 1) | ||
48 | #define USB_OTG_PULLDOWN_DM (1 << 2) | ||
49 | #define USB_OTG_EXT_VBUS_INDICATOR (1 << 3) | ||
50 | #define USB_OTG_DRV_VBUS (1 << 4) | ||
51 | #define USB_OTG_DRV_VBUS_EXT (1 << 5) | ||
52 | |||
53 | struct otg_transceiver; | 46 | struct otg_transceiver; |
54 | 47 | ||
55 | /* for transceivers connected thru an ULPI interface, the user must | 48 | /* for transceivers connected thru an ULPI interface, the user must |
@@ -146,10 +139,10 @@ static inline int otg_io_read(struct otg_transceiver *otg, u32 reg) | |||
146 | return -EINVAL; | 139 | return -EINVAL; |
147 | } | 140 | } |
148 | 141 | ||
149 | static inline int otg_io_write(struct otg_transceiver *otg, u32 reg, u32 val) | 142 | static inline int otg_io_write(struct otg_transceiver *otg, u32 val, u32 reg) |
150 | { | 143 | { |
151 | if (otg->io_ops && otg->io_ops->write) | 144 | if (otg->io_ops && otg->io_ops->write) |
152 | return otg->io_ops->write(otg, reg, val); | 145 | return otg->io_ops->write(otg, val, reg); |
153 | 146 | ||
154 | return -EINVAL; | 147 | return -EINVAL; |
155 | } | 148 | } |
diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h index 16b7f3347545..3e93de7ecbc3 100644 --- a/include/linux/usb/quirks.h +++ b/include/linux/usb/quirks.h | |||
@@ -26,4 +26,8 @@ | |||
26 | and can't handle talking to these interfaces */ | 26 | and can't handle talking to these interfaces */ |
27 | #define USB_QUIRK_HONOR_BNUMINTERFACES 0x00000020 | 27 | #define USB_QUIRK_HONOR_BNUMINTERFACES 0x00000020 |
28 | 28 | ||
29 | /* device needs a pause during initialization, after we read the device | ||
30 | descriptor */ | ||
31 | #define USB_QUIRK_DELAY_INIT 0x00000040 | ||
32 | |||
29 | #endif /* __LINUX_USB_QUIRKS_H */ | 33 | #endif /* __LINUX_USB_QUIRKS_H */ |
diff --git a/include/linux/usb/ulpi.h b/include/linux/usb/ulpi.h index 2369d07c3c87..82b1507f4735 100644 --- a/include/linux/usb/ulpi.h +++ b/include/linux/usb/ulpi.h | |||
@@ -11,6 +11,42 @@ | |||
11 | #ifndef __LINUX_USB_ULPI_H | 11 | #ifndef __LINUX_USB_ULPI_H |
12 | #define __LINUX_USB_ULPI_H | 12 | #define __LINUX_USB_ULPI_H |
13 | 13 | ||
14 | #include <linux/usb/otg.h> | ||
15 | /*-------------------------------------------------------------------------*/ | ||
16 | |||
17 | /* | ||
18 | * ULPI Flags | ||
19 | */ | ||
20 | #define ULPI_OTG_ID_PULLUP (1 << 0) | ||
21 | #define ULPI_OTG_DP_PULLDOWN_DIS (1 << 1) | ||
22 | #define ULPI_OTG_DM_PULLDOWN_DIS (1 << 2) | ||
23 | #define ULPI_OTG_DISCHRGVBUS (1 << 3) | ||
24 | #define ULPI_OTG_CHRGVBUS (1 << 4) | ||
25 | #define ULPI_OTG_DRVVBUS (1 << 5) | ||
26 | #define ULPI_OTG_DRVVBUS_EXT (1 << 6) | ||
27 | #define ULPI_OTG_EXTVBUSIND (1 << 7) | ||
28 | |||
29 | #define ULPI_IC_6PIN_SERIAL (1 << 8) | ||
30 | #define ULPI_IC_3PIN_SERIAL (1 << 9) | ||
31 | #define ULPI_IC_CARKIT (1 << 10) | ||
32 | #define ULPI_IC_CLKSUSPM (1 << 11) | ||
33 | #define ULPI_IC_AUTORESUME (1 << 12) | ||
34 | #define ULPI_IC_EXTVBUS_INDINV (1 << 13) | ||
35 | #define ULPI_IC_IND_PASSTHRU (1 << 14) | ||
36 | #define ULPI_IC_PROTECT_DIS (1 << 15) | ||
37 | |||
38 | #define ULPI_FC_HS (1 << 16) | ||
39 | #define ULPI_FC_FS (1 << 17) | ||
40 | #define ULPI_FC_LS (1 << 18) | ||
41 | #define ULPI_FC_FS4LS (1 << 19) | ||
42 | #define ULPI_FC_TERMSEL (1 << 20) | ||
43 | #define ULPI_FC_OP_NORM (1 << 21) | ||
44 | #define ULPI_FC_OP_NODRV (1 << 22) | ||
45 | #define ULPI_FC_OP_DIS_NRZI (1 << 23) | ||
46 | #define ULPI_FC_OP_NSYNC_NEOP (1 << 24) | ||
47 | #define ULPI_FC_RST (1 << 25) | ||
48 | #define ULPI_FC_SUSPM (1 << 26) | ||
49 | |||
14 | /*-------------------------------------------------------------------------*/ | 50 | /*-------------------------------------------------------------------------*/ |
15 | 51 | ||
16 | /* | 52 | /* |
@@ -58,6 +94,10 @@ | |||
58 | 94 | ||
59 | /*-------------------------------------------------------------------------*/ | 95 | /*-------------------------------------------------------------------------*/ |
60 | 96 | ||
97 | /* | ||
98 | * Register Bits | ||
99 | */ | ||
100 | |||
61 | /* Function Control */ | 101 | /* Function Control */ |
62 | #define ULPI_FUNC_CTRL_XCVRSEL (1 << 0) | 102 | #define ULPI_FUNC_CTRL_XCVRSEL (1 << 0) |
63 | #define ULPI_FUNC_CTRL_XCVRSEL_MASK (3 << 0) | 103 | #define ULPI_FUNC_CTRL_XCVRSEL_MASK (3 << 0) |
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 047f7e6edb86..61490c6dcdbd 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
@@ -277,6 +277,7 @@ struct v4l2_pix_format { | |||
277 | #define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */ | 277 | #define V4L2_PIX_FMT_RGB565 v4l2_fourcc('R', 'G', 'B', 'P') /* 16 RGB-5-6-5 */ |
278 | #define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16 RGB-5-5-5 BE */ | 278 | #define V4L2_PIX_FMT_RGB555X v4l2_fourcc('R', 'G', 'B', 'Q') /* 16 RGB-5-5-5 BE */ |
279 | #define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */ | 279 | #define V4L2_PIX_FMT_RGB565X v4l2_fourcc('R', 'G', 'B', 'R') /* 16 RGB-5-6-5 BE */ |
280 | #define V4L2_PIX_FMT_BGR666 v4l2_fourcc('B', 'G', 'R', 'H') /* 18 BGR-6-6-6 */ | ||
280 | #define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */ | 281 | #define V4L2_PIX_FMT_BGR24 v4l2_fourcc('B', 'G', 'R', '3') /* 24 BGR-8-8-8 */ |
281 | #define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */ | 282 | #define V4L2_PIX_FMT_RGB24 v4l2_fourcc('R', 'G', 'B', '3') /* 24 RGB-8-8-8 */ |
282 | #define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */ | 283 | #define V4L2_PIX_FMT_BGR32 v4l2_fourcc('B', 'G', 'R', '4') /* 32 BGR-8-8-8-8 */ |
diff --git a/include/linux/virtio_9p.h b/include/linux/virtio_9p.h index 395c38a47adb..1faa80d92f05 100644 --- a/include/linux/virtio_9p.h +++ b/include/linux/virtio_9p.h | |||
@@ -2,6 +2,7 @@ | |||
2 | #define _LINUX_VIRTIO_9P_H | 2 | #define _LINUX_VIRTIO_9P_H |
3 | /* This header is BSD licensed so anyone can use the definitions to implement | 3 | /* This header is BSD licensed so anyone can use the definitions to implement |
4 | * compatible drivers/servers. */ | 4 | * compatible drivers/servers. */ |
5 | #include <linux/types.h> | ||
5 | #include <linux/virtio_ids.h> | 6 | #include <linux/virtio_ids.h> |
6 | #include <linux/virtio_config.h> | 7 | #include <linux/virtio_config.h> |
7 | #include <linux/types.h> | 8 | #include <linux/types.h> |
diff --git a/include/linux/vt_kern.h b/include/linux/vt_kern.h index 7f56db4a79f0..6625cc1ab758 100644 --- a/include/linux/vt_kern.h +++ b/include/linux/vt_kern.h | |||
@@ -76,17 +76,52 @@ int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc); | |||
76 | #define vc_translate(vc, c) ((vc)->vc_translate[(c) | \ | 76 | #define vc_translate(vc, c) ((vc)->vc_translate[(c) | \ |
77 | ((vc)->vc_toggle_meta ? 0x80 : 0)]) | 77 | ((vc)->vc_toggle_meta ? 0x80 : 0)]) |
78 | #else | 78 | #else |
79 | #define con_set_trans_old(arg) (0) | 79 | static inline int con_set_trans_old(unsigned char __user *table) |
80 | #define con_get_trans_old(arg) (-EINVAL) | 80 | { |
81 | #define con_set_trans_new(arg) (0) | 81 | return 0; |
82 | #define con_get_trans_new(arg) (-EINVAL) | 82 | } |
83 | #define con_clear_unimap(vc, ui) (0) | 83 | static inline int con_get_trans_old(unsigned char __user *table) |
84 | #define con_set_unimap(vc, ct, list) (0) | 84 | { |
85 | #define con_set_default_unimap(vc) (0) | 85 | return -EINVAL; |
86 | #define con_copy_unimap(d, s) (0) | 86 | } |
87 | #define con_get_unimap(vc, ct, uct, list) (-EINVAL) | 87 | static inline int con_set_trans_new(unsigned short __user *table) |
88 | #define con_free_unimap(vc) do { ; } while (0) | 88 | { |
89 | #define con_protect_unimap(vc, rdonly) do { ; } while (0) | 89 | return 0; |
90 | } | ||
91 | static inline int con_get_trans_new(unsigned short __user *table) | ||
92 | { | ||
93 | return -EINVAL; | ||
94 | } | ||
95 | static inline int con_clear_unimap(struct vc_data *vc, struct unimapinit *ui) | ||
96 | { | ||
97 | return 0; | ||
98 | } | ||
99 | static inline | ||
100 | int con_set_unimap(struct vc_data *vc, ushort ct, struct unipair __user *list) | ||
101 | { | ||
102 | return 0; | ||
103 | } | ||
104 | static inline | ||
105 | int con_get_unimap(struct vc_data *vc, ushort ct, ushort __user *uct, | ||
106 | struct unipair __user *list) | ||
107 | { | ||
108 | return -EINVAL; | ||
109 | } | ||
110 | static inline int con_set_default_unimap(struct vc_data *vc) | ||
111 | { | ||
112 | return 0; | ||
113 | } | ||
114 | static inline void con_free_unimap(struct vc_data *vc) | ||
115 | { | ||
116 | } | ||
117 | static inline void con_protect_unimap(struct vc_data *vc, int rdonly) | ||
118 | { | ||
119 | } | ||
120 | static inline | ||
121 | int con_copy_unimap(struct vc_data *dst_vc, struct vc_data *src_vc) | ||
122 | { | ||
123 | return 0; | ||
124 | } | ||
90 | 125 | ||
91 | #define vc_translate(vc, c) (c) | 126 | #define vc_translate(vc, c) (c) |
92 | #endif | 127 | #endif |
@@ -100,6 +135,13 @@ extern int unbind_con_driver(const struct consw *csw, int first, int last, | |||
100 | int deflt); | 135 | int deflt); |
101 | int vty_init(const struct file_operations *console_fops); | 136 | int vty_init(const struct file_operations *console_fops); |
102 | 137 | ||
138 | static inline bool vt_force_oops_output(struct vc_data *vc) | ||
139 | { | ||
140 | if (oops_in_progress && vc->vc_panic_force_write) | ||
141 | return true; | ||
142 | return false; | ||
143 | } | ||
144 | |||
103 | /* | 145 | /* |
104 | * vc_screen.c shares this temporary buffer with the console write code so that | 146 | * vc_screen.c shares this temporary buffer with the console write code so that |
105 | * we can easily avoid touching user space while holding the console spinlock. | 147 | * we can easily avoid touching user space while holding the console spinlock. |
diff --git a/include/linux/wm97xx_batt.h b/include/linux/wm97xx_batt.h deleted file mode 100644 index a1d6419c2ff8..000000000000 --- a/include/linux/wm97xx_batt.h +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | #ifndef _LINUX_WM97XX_BAT_H | ||
2 | #define _LINUX_WM97XX_BAT_H | ||
3 | |||
4 | #include <linux/wm97xx.h> | ||
5 | |||
6 | #warning This file will be removed soon, use wm97xx.h instead! | ||
7 | |||
8 | #define wm97xx_batt_info wm97xx_batt_pdata | ||
9 | |||
10 | #ifdef CONFIG_BATTERY_WM97XX | ||
11 | void wm97xx_bat_set_pdata(struct wm97xx_batt_info *data); | ||
12 | #else | ||
13 | static inline void wm97xx_bat_set_pdata(struct wm97xx_batt_info *data) {} | ||
14 | #endif | ||
15 | |||
16 | #endif | ||
diff --git a/include/media/cx2341x.h b/include/media/cx2341x.h index 9ebe8558b9b6..8d08ebfe20b7 100644 --- a/include/media/cx2341x.h +++ b/include/media/cx2341x.h | |||
@@ -19,6 +19,8 @@ | |||
19 | #ifndef CX2341X_H | 19 | #ifndef CX2341X_H |
20 | #define CX2341X_H | 20 | #define CX2341X_H |
21 | 21 | ||
22 | #include <media/v4l2-ctrls.h> | ||
23 | |||
22 | enum cx2341x_port { | 24 | enum cx2341x_port { |
23 | CX2341X_PORT_MEMORY = 0, | 25 | CX2341X_PORT_MEMORY = 0, |
24 | CX2341X_PORT_STREAMING = 1, | 26 | CX2341X_PORT_STREAMING = 1, |
@@ -99,6 +101,101 @@ int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params, int busy, | |||
99 | void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p); | 101 | void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p); |
100 | void cx2341x_log_status(const struct cx2341x_mpeg_params *p, const char *prefix); | 102 | void cx2341x_log_status(const struct cx2341x_mpeg_params *p, const char *prefix); |
101 | 103 | ||
104 | struct cx2341x_handler; | ||
105 | |||
106 | struct cx2341x_handler_ops { | ||
107 | /* needed for the video clock freq */ | ||
108 | int (*s_audio_sampling_freq)(struct cx2341x_handler *hdl, u32 val); | ||
109 | /* needed for dualwatch */ | ||
110 | int (*s_audio_mode)(struct cx2341x_handler *hdl, u32 val); | ||
111 | /* needed for setting up the video resolution */ | ||
112 | int (*s_video_encoding)(struct cx2341x_handler *hdl, u32 val); | ||
113 | /* needed for setting up the sliced vbi insertion data structures */ | ||
114 | int (*s_stream_vbi_fmt)(struct cx2341x_handler *hdl, u32 val); | ||
115 | }; | ||
116 | |||
117 | struct cx2341x_handler { | ||
118 | u32 capabilities; | ||
119 | enum cx2341x_port port; | ||
120 | u16 width; | ||
121 | u16 height; | ||
122 | u16 is_50hz; | ||
123 | u32 audio_properties; | ||
124 | |||
125 | struct v4l2_ctrl_handler hdl; | ||
126 | void *priv; | ||
127 | cx2341x_mbox_func func; | ||
128 | const struct cx2341x_handler_ops *ops; | ||
129 | |||
130 | struct v4l2_ctrl *stream_vbi_fmt; | ||
131 | |||
132 | struct { | ||
133 | /* audio cluster */ | ||
134 | struct v4l2_ctrl *audio_sampling_freq; | ||
135 | struct v4l2_ctrl *audio_encoding; | ||
136 | struct v4l2_ctrl *audio_l2_bitrate; | ||
137 | struct v4l2_ctrl *audio_mode; | ||
138 | struct v4l2_ctrl *audio_mode_extension; | ||
139 | struct v4l2_ctrl *audio_emphasis; | ||
140 | struct v4l2_ctrl *audio_crc; | ||
141 | struct v4l2_ctrl *audio_ac3_bitrate; | ||
142 | }; | ||
143 | |||
144 | struct { | ||
145 | /* video gop cluster */ | ||
146 | struct v4l2_ctrl *video_b_frames; | ||
147 | struct v4l2_ctrl *video_gop_size; | ||
148 | }; | ||
149 | |||
150 | struct { | ||
151 | /* stream type cluster */ | ||
152 | struct v4l2_ctrl *stream_type; | ||
153 | struct v4l2_ctrl *video_encoding; | ||
154 | struct v4l2_ctrl *video_bitrate_mode; | ||
155 | struct v4l2_ctrl *video_bitrate; | ||
156 | struct v4l2_ctrl *video_bitrate_peak; | ||
157 | }; | ||
158 | |||
159 | struct { | ||
160 | /* video mute cluster */ | ||
161 | struct v4l2_ctrl *video_mute; | ||
162 | struct v4l2_ctrl *video_mute_yuv; | ||
163 | }; | ||
164 | |||
165 | struct { | ||
166 | /* video filter mode cluster */ | ||
167 | struct v4l2_ctrl *video_spatial_filter_mode; | ||
168 | struct v4l2_ctrl *video_temporal_filter_mode; | ||
169 | struct v4l2_ctrl *video_median_filter_type; | ||
170 | }; | ||
171 | |||
172 | struct { | ||
173 | /* video filter type cluster */ | ||
174 | struct v4l2_ctrl *video_luma_spatial_filter_type; | ||
175 | struct v4l2_ctrl *video_chroma_spatial_filter_type; | ||
176 | }; | ||
177 | |||
178 | struct { | ||
179 | /* video filter cluster */ | ||
180 | struct v4l2_ctrl *video_spatial_filter; | ||
181 | struct v4l2_ctrl *video_temporal_filter; | ||
182 | }; | ||
183 | |||
184 | struct { | ||
185 | /* video median cluster */ | ||
186 | struct v4l2_ctrl *video_luma_median_filter_top; | ||
187 | struct v4l2_ctrl *video_luma_median_filter_bottom; | ||
188 | struct v4l2_ctrl *video_chroma_median_filter_top; | ||
189 | struct v4l2_ctrl *video_chroma_median_filter_bottom; | ||
190 | }; | ||
191 | }; | ||
192 | |||
193 | int cx2341x_handler_init(struct cx2341x_handler *cxhdl, | ||
194 | unsigned nr_of_controls_hint); | ||
195 | void cx2341x_handler_set_50hz(struct cx2341x_handler *cxhdl, int is_50hz); | ||
196 | int cx2341x_handler_setup(struct cx2341x_handler *cxhdl); | ||
197 | void cx2341x_handler_set_busy(struct cx2341x_handler *cxhdl, int busy); | ||
198 | |||
102 | /* Firmware names */ | 199 | /* Firmware names */ |
103 | #define CX2341X_FIRM_ENC_FILENAME "v4l-cx2341x-enc.fw" | 200 | #define CX2341X_FIRM_ENC_FILENAME "v4l-cx2341x-enc.fw" |
104 | /* Decoder firmware for the cx23415 only */ | 201 | /* Decoder firmware for the cx23415 only */ |
diff --git a/include/media/cx25840.h b/include/media/cx25840.h index 0b0cb1776796..46d1a141208e 100644 --- a/include/media/cx25840.h +++ b/include/media/cx25840.h | |||
@@ -97,4 +97,91 @@ enum cx25840_audio_input { | |||
97 | CX25840_AUDIO8, | 97 | CX25840_AUDIO8, |
98 | }; | 98 | }; |
99 | 99 | ||
100 | enum cx25840_io_pin { | ||
101 | CX25840_PIN_DVALID_PRGM0 = 0, | ||
102 | CX25840_PIN_FIELD_PRGM1, | ||
103 | CX25840_PIN_HRESET_PRGM2, | ||
104 | CX25840_PIN_VRESET_HCTL_PRGM3, | ||
105 | CX25840_PIN_IRQ_N_PRGM4, | ||
106 | CX25840_PIN_IR_TX_PRGM6, | ||
107 | CX25840_PIN_IR_RX_PRGM5, | ||
108 | CX25840_PIN_GPIO0_PRGM8, | ||
109 | CX25840_PIN_GPIO1_PRGM9, | ||
110 | CX25840_PIN_SA_SDIN, /* Alternate GP Input only */ | ||
111 | CX25840_PIN_SA_SDOUT, /* Alternate GP Input only */ | ||
112 | CX25840_PIN_PLL_CLK_PRGM7, | ||
113 | CX25840_PIN_CHIP_SEL_VIPCLK, /* Output only */ | ||
114 | }; | ||
115 | |||
116 | enum cx25840_io_pad { | ||
117 | /* Output pads */ | ||
118 | CX25840_PAD_DEFAULT = 0, | ||
119 | CX25840_PAD_ACTIVE, | ||
120 | CX25840_PAD_VACTIVE, | ||
121 | CX25840_PAD_CBFLAG, | ||
122 | CX25840_PAD_VID_DATA_EXT0, | ||
123 | CX25840_PAD_VID_DATA_EXT1, | ||
124 | CX25840_PAD_GPO0, | ||
125 | CX25840_PAD_GPO1, | ||
126 | CX25840_PAD_GPO2, | ||
127 | CX25840_PAD_GPO3, | ||
128 | CX25840_PAD_IRQ_N, | ||
129 | CX25840_PAD_AC_SYNC, | ||
130 | CX25840_PAD_AC_SDOUT, | ||
131 | CX25840_PAD_PLL_CLK, | ||
132 | CX25840_PAD_VRESET, | ||
133 | CX25840_PAD_RESERVED, | ||
134 | /* Pads for PLL_CLK output only */ | ||
135 | CX25840_PAD_XTI_X5_DLL, | ||
136 | CX25840_PAD_AUX_PLL, | ||
137 | CX25840_PAD_VID_PLL, | ||
138 | CX25840_PAD_XTI, | ||
139 | /* Input Pads */ | ||
140 | CX25840_PAD_GPI0, | ||
141 | CX25840_PAD_GPI1, | ||
142 | CX25840_PAD_GPI2, | ||
143 | CX25840_PAD_GPI3, | ||
144 | }; | ||
145 | |||
146 | enum cx25840_io_pin_strength { | ||
147 | CX25840_PIN_DRIVE_MEDIUM = 0, | ||
148 | CX25840_PIN_DRIVE_SLOW, | ||
149 | CX25840_PIN_DRIVE_FAST, | ||
150 | }; | ||
151 | |||
152 | enum cx23885_io_pin { | ||
153 | CX23885_PIN_IR_RX_GPIO19, | ||
154 | CX23885_PIN_IR_TX_GPIO20, | ||
155 | CX23885_PIN_I2S_SDAT_GPIO21, | ||
156 | CX23885_PIN_I2S_WCLK_GPIO22, | ||
157 | CX23885_PIN_I2S_BCLK_GPIO23, | ||
158 | CX23885_PIN_IRQ_N_GPIO16, | ||
159 | }; | ||
160 | |||
161 | enum cx23885_io_pad { | ||
162 | CX23885_PAD_IR_RX, | ||
163 | CX23885_PAD_GPIO19, | ||
164 | CX23885_PAD_IR_TX, | ||
165 | CX23885_PAD_GPIO20, | ||
166 | CX23885_PAD_I2S_SDAT, | ||
167 | CX23885_PAD_GPIO21, | ||
168 | CX23885_PAD_I2S_WCLK, | ||
169 | CX23885_PAD_GPIO22, | ||
170 | CX23885_PAD_I2S_BCLK, | ||
171 | CX23885_PAD_GPIO23, | ||
172 | CX23885_PAD_IRQ_N, | ||
173 | CX23885_PAD_GPIO16, | ||
174 | }; | ||
175 | |||
176 | /* pvr150_workaround activates a workaround for a hardware bug that is | ||
177 | present in Hauppauge PVR-150 (and possibly PVR-500) cards that have | ||
178 | certain NTSC tuners (tveeprom tuner model numbers 85, 99 and 112). The | ||
179 | audio autodetect fails on some channels for these models and the workaround | ||
180 | is to select the audio standard explicitly. Many thanks to Hauppauge for | ||
181 | providing this information. | ||
182 | This platform data only needs to be supplied by the ivtv driver. */ | ||
183 | struct cx25840_platform_data { | ||
184 | int pvr150_workaround; | ||
185 | }; | ||
186 | |||
100 | #endif | 187 | #endif |
diff --git a/include/media/ir-core.h b/include/media/ir-core.h index 513e60dd1010..eb7fddf8f607 100644 --- a/include/media/ir-core.h +++ b/include/media/ir-core.h | |||
@@ -41,6 +41,11 @@ enum rc_driver_type { | |||
41 | * anything with it. Yet, as the same keycode table can be used with other | 41 | * anything with it. Yet, as the same keycode table can be used with other |
42 | * devices, a mask is provided to allow its usage. Drivers should generally | 42 | * devices, a mask is provided to allow its usage. Drivers should generally |
43 | * leave this field in blank | 43 | * leave this field in blank |
44 | * @timeout: optional time after which device stops sending data | ||
45 | * @min_timeout: minimum timeout supported by device | ||
46 | * @max_timeout: maximum timeout supported by device | ||
47 | * @rx_resolution : resolution (in ns) of input sampler | ||
48 | * @tx_resolution: resolution (in ns) of output sampler | ||
44 | * @priv: driver-specific data, to be used on the callbacks | 49 | * @priv: driver-specific data, to be used on the callbacks |
45 | * @change_protocol: allow changing the protocol used on hardware decoders | 50 | * @change_protocol: allow changing the protocol used on hardware decoders |
46 | * @open: callback to allow drivers to enable polling/irq when IR input device | 51 | * @open: callback to allow drivers to enable polling/irq when IR input device |
@@ -49,19 +54,36 @@ enum rc_driver_type { | |||
49 | * is opened. | 54 | * is opened. |
50 | * @s_tx_mask: set transmitter mask (for devices with multiple tx outputs) | 55 | * @s_tx_mask: set transmitter mask (for devices with multiple tx outputs) |
51 | * @s_tx_carrier: set transmit carrier frequency | 56 | * @s_tx_carrier: set transmit carrier frequency |
57 | * @s_tx_duty_cycle: set transmit duty cycle (0% - 100%) | ||
58 | * @s_rx_carrier: inform driver about carrier it is expected to handle | ||
52 | * @tx_ir: transmit IR | 59 | * @tx_ir: transmit IR |
60 | * @s_idle: optional: enable/disable hardware idle mode, upon which, | ||
61 | device doesn't interrupt host until it sees IR pulses | ||
62 | * @s_learning_mode: enable wide band receiver used for learning | ||
53 | */ | 63 | */ |
54 | struct ir_dev_props { | 64 | struct ir_dev_props { |
55 | enum rc_driver_type driver_type; | 65 | enum rc_driver_type driver_type; |
56 | unsigned long allowed_protos; | 66 | unsigned long allowed_protos; |
57 | u32 scanmask; | 67 | u32 scanmask; |
68 | |||
69 | u32 timeout; | ||
70 | u32 min_timeout; | ||
71 | u32 max_timeout; | ||
72 | |||
73 | u32 rx_resolution; | ||
74 | u32 tx_resolution; | ||
75 | |||
58 | void *priv; | 76 | void *priv; |
59 | int (*change_protocol)(void *priv, u64 ir_type); | 77 | int (*change_protocol)(void *priv, u64 ir_type); |
60 | int (*open)(void *priv); | 78 | int (*open)(void *priv); |
61 | void (*close)(void *priv); | 79 | void (*close)(void *priv); |
62 | int (*s_tx_mask)(void *priv, u32 mask); | 80 | int (*s_tx_mask)(void *priv, u32 mask); |
63 | int (*s_tx_carrier)(void *priv, u32 carrier); | 81 | int (*s_tx_carrier)(void *priv, u32 carrier); |
82 | int (*s_tx_duty_cycle)(void *priv, u32 duty_cycle); | ||
83 | int (*s_rx_carrier_range)(void *priv, u32 min, u32 max); | ||
64 | int (*tx_ir)(void *priv, int *txbuf, u32 n); | 84 | int (*tx_ir)(void *priv, int *txbuf, u32 n); |
85 | void (*s_idle)(void *priv, int enable); | ||
86 | int (*s_learning_mode)(void *priv, int enable); | ||
65 | }; | 87 | }; |
66 | 88 | ||
67 | struct ir_input_dev { | 89 | struct ir_input_dev { |
@@ -69,9 +91,10 @@ struct ir_input_dev { | |||
69 | char *driver_name; /* Name of the driver module */ | 91 | char *driver_name; /* Name of the driver module */ |
70 | struct ir_scancode_table rc_tab; /* scan/key table */ | 92 | struct ir_scancode_table rc_tab; /* scan/key table */ |
71 | unsigned long devno; /* device number */ | 93 | unsigned long devno; /* device number */ |
72 | const struct ir_dev_props *props; /* Device properties */ | 94 | struct ir_dev_props *props; /* Device properties */ |
73 | struct ir_raw_event_ctrl *raw; /* for raw pulse/space events */ | 95 | struct ir_raw_event_ctrl *raw; /* for raw pulse/space events */ |
74 | struct input_dev *input_dev; /* the input device associated with this device */ | 96 | struct input_dev *input_dev; /* the input device associated with this device */ |
97 | bool idle; | ||
75 | 98 | ||
76 | /* key info - needed by IR keycode handlers */ | 99 | /* key info - needed by IR keycode handlers */ |
77 | spinlock_t keylock; /* protects the below members */ | 100 | spinlock_t keylock; /* protects the below members */ |
@@ -95,12 +118,12 @@ enum raw_event_type { | |||
95 | /* From ir-keytable.c */ | 118 | /* From ir-keytable.c */ |
96 | int __ir_input_register(struct input_dev *dev, | 119 | int __ir_input_register(struct input_dev *dev, |
97 | const struct ir_scancode_table *ir_codes, | 120 | const struct ir_scancode_table *ir_codes, |
98 | const struct ir_dev_props *props, | 121 | struct ir_dev_props *props, |
99 | const char *driver_name); | 122 | const char *driver_name); |
100 | 123 | ||
101 | static inline int ir_input_register(struct input_dev *dev, | 124 | static inline int ir_input_register(struct input_dev *dev, |
102 | const char *map_name, | 125 | const char *map_name, |
103 | const struct ir_dev_props *props, | 126 | struct ir_dev_props *props, |
104 | const char *driver_name) { | 127 | const char *driver_name) { |
105 | struct ir_scancode_table *ir_codes; | 128 | struct ir_scancode_table *ir_codes; |
106 | struct ir_input_dev *ir_dev; | 129 | struct ir_input_dev *ir_dev; |
@@ -110,8 +133,12 @@ static inline int ir_input_register(struct input_dev *dev, | |||
110 | return -EINVAL; | 133 | return -EINVAL; |
111 | 134 | ||
112 | ir_codes = get_rc_map(map_name); | 135 | ir_codes = get_rc_map(map_name); |
113 | if (!ir_codes) | 136 | if (!ir_codes) { |
114 | return -EINVAL; | 137 | ir_codes = get_rc_map(RC_MAP_EMPTY); |
138 | |||
139 | if (!ir_codes) | ||
140 | return -EINVAL; | ||
141 | } | ||
115 | 142 | ||
116 | rc = __ir_input_register(dev, ir_codes, props, driver_name); | 143 | rc = __ir_input_register(dev, ir_codes, props, driver_name); |
117 | if (rc < 0) | 144 | if (rc < 0) |
@@ -144,6 +171,10 @@ struct ir_raw_event { | |||
144 | void ir_raw_event_handle(struct input_dev *input_dev); | 171 | void ir_raw_event_handle(struct input_dev *input_dev); |
145 | int ir_raw_event_store(struct input_dev *input_dev, struct ir_raw_event *ev); | 172 | int ir_raw_event_store(struct input_dev *input_dev, struct ir_raw_event *ev); |
146 | int ir_raw_event_store_edge(struct input_dev *input_dev, enum raw_event_type type); | 173 | int ir_raw_event_store_edge(struct input_dev *input_dev, enum raw_event_type type); |
174 | int ir_raw_event_store_with_filter(struct input_dev *input_dev, | ||
175 | struct ir_raw_event *ev); | ||
176 | void ir_raw_event_set_idle(struct input_dev *input_dev, int idle); | ||
177 | |||
147 | static inline void ir_raw_event_reset(struct input_dev *input_dev) | 178 | static inline void ir_raw_event_reset(struct input_dev *input_dev) |
148 | { | 179 | { |
149 | struct ir_raw_event ev = { .pulse = false, .duration = 0 }; | 180 | struct ir_raw_event ev = { .pulse = false, .duration = 0 }; |
diff --git a/include/media/lirc.h b/include/media/lirc.h index 42c467c50519..6678a169fd9e 100644 --- a/include/media/lirc.h +++ b/include/media/lirc.h | |||
@@ -77,6 +77,7 @@ | |||
77 | #define LIRC_CAN_SET_REC_FILTER 0x08000000 | 77 | #define LIRC_CAN_SET_REC_FILTER 0x08000000 |
78 | 78 | ||
79 | #define LIRC_CAN_MEASURE_CARRIER 0x02000000 | 79 | #define LIRC_CAN_MEASURE_CARRIER 0x02000000 |
80 | #define LIRC_CAN_USE_WIDEBAND_RECEIVER 0x04000000 | ||
80 | 81 | ||
81 | #define LIRC_CAN_SEND(x) ((x)&LIRC_CAN_SEND_MASK) | 82 | #define LIRC_CAN_SEND(x) ((x)&LIRC_CAN_SEND_MASK) |
82 | #define LIRC_CAN_REC(x) ((x)&LIRC_CAN_REC_MASK) | 83 | #define LIRC_CAN_REC(x) ((x)&LIRC_CAN_REC_MASK) |
@@ -145,7 +146,7 @@ | |||
145 | * if enabled from the next key press on the driver will send | 146 | * if enabled from the next key press on the driver will send |
146 | * LIRC_MODE2_FREQUENCY packets | 147 | * LIRC_MODE2_FREQUENCY packets |
147 | */ | 148 | */ |
148 | #define LIRC_SET_MEASURE_CARRIER_MODE _IOW('i', 0x0000001d, __u32) | 149 | #define LIRC_SET_MEASURE_CARRIER_MODE _IOW('i', 0x0000001d, __u32) |
149 | 150 | ||
150 | /* | 151 | /* |
151 | * to set a range use | 152 | * to set a range use |
@@ -162,4 +163,6 @@ | |||
162 | #define LIRC_SETUP_START _IO('i', 0x00000021) | 163 | #define LIRC_SETUP_START _IO('i', 0x00000021) |
163 | #define LIRC_SETUP_END _IO('i', 0x00000022) | 164 | #define LIRC_SETUP_END _IO('i', 0x00000022) |
164 | 165 | ||
166 | #define LIRC_SET_WIDEBAND_RECEIVER _IOW('i', 0x00000023, __u32) | ||
167 | |||
165 | #endif | 168 | #endif |
diff --git a/include/media/rc-map.h b/include/media/rc-map.h index 9569d0863f8b..a9c041d49662 100644 --- a/include/media/rc-map.h +++ b/include/media/rc-map.h | |||
@@ -114,6 +114,7 @@ void rc_map_init(void); | |||
114 | #define RC_MAP_PURPLETV "rc-purpletv" | 114 | #define RC_MAP_PURPLETV "rc-purpletv" |
115 | #define RC_MAP_PV951 "rc-pv951" | 115 | #define RC_MAP_PV951 "rc-pv951" |
116 | #define RC_MAP_RC5_HAUPPAUGE_NEW "rc-rc5-hauppauge-new" | 116 | #define RC_MAP_RC5_HAUPPAUGE_NEW "rc-rc5-hauppauge-new" |
117 | #define RC_MAP_RC5_STREAMZAP "rc-rc5-streamzap" | ||
117 | #define RC_MAP_RC5_TV "rc-rc5-tv" | 118 | #define RC_MAP_RC5_TV "rc-rc5-tv" |
118 | #define RC_MAP_RC6_MCE "rc-rc6-mce" | 119 | #define RC_MAP_RC6_MCE "rc-rc6-mce" |
119 | #define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys" | 120 | #define RC_MAP_REAL_AUDIO_220_32_KEYS "rc-real-audio-220-32-keys" |
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h new file mode 100644 index 000000000000..9b7bea928a88 --- /dev/null +++ b/include/media/v4l2-ctrls.h | |||
@@ -0,0 +1,460 @@ | |||
1 | /* | ||
2 | V4L2 controls support header. | ||
3 | |||
4 | Copyright (C) 2010 Hans Verkuil <hverkuil@xs4all.nl> | ||
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | */ | ||
20 | |||
21 | #ifndef _V4L2_CTRLS_H | ||
22 | #define _V4L2_CTRLS_H | ||
23 | |||
24 | #include <linux/list.h> | ||
25 | #include <linux/device.h> | ||
26 | |||
27 | /* forward references */ | ||
28 | struct v4l2_ctrl_handler; | ||
29 | struct v4l2_ctrl; | ||
30 | struct video_device; | ||
31 | struct v4l2_subdev; | ||
32 | |||
33 | /** struct v4l2_ctrl_ops - The control operations that the driver has to provide. | ||
34 | * @g_volatile_ctrl: Get a new value for this control. Generally only relevant | ||
35 | * for volatile (and usually read-only) controls such as a control | ||
36 | * that returns the current signal strength which changes | ||
37 | * continuously. | ||
38 | * If not set, then the currently cached value will be returned. | ||
39 | * @try_ctrl: Test whether the control's value is valid. Only relevant when | ||
40 | * the usual min/max/step checks are not sufficient. | ||
41 | * @s_ctrl: Actually set the new control value. s_ctrl is compulsory. The | ||
42 | * ctrl->handler->lock is held when these ops are called, so no | ||
43 | * one else can access controls owned by that handler. | ||
44 | */ | ||
45 | struct v4l2_ctrl_ops { | ||
46 | int (*g_volatile_ctrl)(struct v4l2_ctrl *ctrl); | ||
47 | int (*try_ctrl)(struct v4l2_ctrl *ctrl); | ||
48 | int (*s_ctrl)(struct v4l2_ctrl *ctrl); | ||
49 | }; | ||
50 | |||
51 | /** struct v4l2_ctrl - The control structure. | ||
52 | * @node: The list node. | ||
53 | * @handler: The handler that owns the control. | ||
54 | * @cluster: Point to start of cluster array. | ||
55 | * @ncontrols: Number of controls in cluster array. | ||
56 | * @has_new: Internal flag: set when there is a valid new value. | ||
57 | * @done: Internal flag: set for each processed control. | ||
58 | * @is_private: If set, then this control is private to its handler and it | ||
59 | * will not be added to any other handlers. Drivers can set | ||
60 | * this flag. | ||
61 | * @is_volatile: If set, then this control is volatile. This means that the | ||
62 | * control's current value cannot be cached and needs to be | ||
63 | * retrieved through the g_volatile_ctrl op. Drivers can set | ||
64 | * this flag. | ||
65 | * @ops: The control ops. | ||
66 | * @id: The control ID. | ||
67 | * @name: The control name. | ||
68 | * @type: The control type. | ||
69 | * @minimum: The control's minimum value. | ||
70 | * @maximum: The control's maximum value. | ||
71 | * @default_value: The control's default value. | ||
72 | * @step: The control's step value for non-menu controls. | ||
73 | * @menu_skip_mask: The control's skip mask for menu controls. This makes it | ||
74 | * easy to skip menu items that are not valid. If bit X is set, | ||
75 | * then menu item X is skipped. Of course, this only works for | ||
76 | * menus with <= 32 menu items. There are no menus that come | ||
77 | * close to that number, so this is OK. Should we ever need more, | ||
78 | * then this will have to be extended to a u64 or a bit array. | ||
79 | * @qmenu: A const char * array for all menu items. Array entries that are | ||
80 | * empty strings ("") correspond to non-existing menu items (this | ||
81 | * is in addition to the menu_skip_mask above). The last entry | ||
82 | * must be NULL. | ||
83 | * @flags: The control's flags. | ||
84 | * @cur: The control's current value. | ||
85 | * @val: The control's new s32 value. | ||
86 | * @val64: The control's new s64 value. | ||
87 | * @string: The control's new string value. | ||
88 | * @priv: The control's private pointer. For use by the driver. It is | ||
89 | * untouched by the control framework. Note that this pointer is | ||
90 | * not freed when the control is deleted. Should this be needed | ||
91 | * then a new internal bitfield can be added to tell the framework | ||
92 | * to free this pointer. | ||
93 | */ | ||
94 | struct v4l2_ctrl { | ||
95 | /* Administrative fields */ | ||
96 | struct list_head node; | ||
97 | struct v4l2_ctrl_handler *handler; | ||
98 | struct v4l2_ctrl **cluster; | ||
99 | unsigned ncontrols; | ||
100 | unsigned int has_new:1; | ||
101 | unsigned int done:1; | ||
102 | |||
103 | unsigned int is_private:1; | ||
104 | unsigned int is_volatile:1; | ||
105 | |||
106 | const struct v4l2_ctrl_ops *ops; | ||
107 | u32 id; | ||
108 | const char *name; | ||
109 | enum v4l2_ctrl_type type; | ||
110 | s32 minimum, maximum, default_value; | ||
111 | union { | ||
112 | u32 step; | ||
113 | u32 menu_skip_mask; | ||
114 | }; | ||
115 | const char **qmenu; | ||
116 | unsigned long flags; | ||
117 | union { | ||
118 | s32 val; | ||
119 | s64 val64; | ||
120 | char *string; | ||
121 | } cur; | ||
122 | union { | ||
123 | s32 val; | ||
124 | s64 val64; | ||
125 | char *string; | ||
126 | }; | ||
127 | void *priv; | ||
128 | }; | ||
129 | |||
130 | /** struct v4l2_ctrl_ref - The control reference. | ||
131 | * @node: List node for the sorted list. | ||
132 | * @next: Single-link list node for the hash. | ||
133 | * @ctrl: The actual control information. | ||
134 | * | ||
135 | * Each control handler has a list of these refs. The list_head is used to | ||
136 | * keep a sorted-by-control-ID list of all controls, while the next pointer | ||
137 | * is used to link the control in the hash's bucket. | ||
138 | */ | ||
139 | struct v4l2_ctrl_ref { | ||
140 | struct list_head node; | ||
141 | struct v4l2_ctrl_ref *next; | ||
142 | struct v4l2_ctrl *ctrl; | ||
143 | }; | ||
144 | |||
145 | /** struct v4l2_ctrl_handler - The control handler keeps track of all the | ||
146 | * controls: both the controls owned by the handler and those inherited | ||
147 | * from other handlers. | ||
148 | * @lock: Lock to control access to this handler and its controls. | ||
149 | * @ctrls: The list of controls owned by this handler. | ||
150 | * @ctrl_refs: The list of control references. | ||
151 | * @cached: The last found control reference. It is common that the same | ||
152 | * control is needed multiple times, so this is a simple | ||
153 | * optimization. | ||
154 | * @buckets: Buckets for the hashing. Allows for quick control lookup. | ||
155 | * @nr_of_buckets: Total number of buckets in the array. | ||
156 | * @error: The error code of the first failed control addition. | ||
157 | */ | ||
158 | struct v4l2_ctrl_handler { | ||
159 | struct mutex lock; | ||
160 | struct list_head ctrls; | ||
161 | struct list_head ctrl_refs; | ||
162 | struct v4l2_ctrl_ref *cached; | ||
163 | struct v4l2_ctrl_ref **buckets; | ||
164 | u16 nr_of_buckets; | ||
165 | int error; | ||
166 | }; | ||
167 | |||
168 | /** struct v4l2_ctrl_config - Control configuration structure. | ||
169 | * @ops: The control ops. | ||
170 | * @id: The control ID. | ||
171 | * @name: The control name. | ||
172 | * @type: The control type. | ||
173 | * @min: The control's minimum value. | ||
174 | * @max: The control's maximum value. | ||
175 | * @step: The control's step value for non-menu controls. | ||
176 | * @def: The control's default value. | ||
177 | * @flags: The control's flags. | ||
178 | * @menu_skip_mask: The control's skip mask for menu controls. This makes it | ||
179 | * easy to skip menu items that are not valid. If bit X is set, | ||
180 | * then menu item X is skipped. Of course, this only works for | ||
181 | * menus with <= 32 menu items. There are no menus that come | ||
182 | * close to that number, so this is OK. Should we ever need more, | ||
183 | * then this will have to be extended to a u64 or a bit array. | ||
184 | * @qmenu: A const char * array for all menu items. Array entries that are | ||
185 | * empty strings ("") correspond to non-existing menu items (this | ||
186 | * is in addition to the menu_skip_mask above). The last entry | ||
187 | * must be NULL. | ||
188 | * @is_private: If set, then this control is private to its handler and it | ||
189 | * will not be added to any other handlers. | ||
190 | * @is_volatile: If set, then this control is volatile. This means that the | ||
191 | * control's current value cannot be cached and needs to be | ||
192 | * retrieved through the g_volatile_ctrl op. | ||
193 | */ | ||
194 | struct v4l2_ctrl_config { | ||
195 | const struct v4l2_ctrl_ops *ops; | ||
196 | u32 id; | ||
197 | const char *name; | ||
198 | enum v4l2_ctrl_type type; | ||
199 | s32 min; | ||
200 | s32 max; | ||
201 | u32 step; | ||
202 | s32 def; | ||
203 | u32 flags; | ||
204 | u32 menu_skip_mask; | ||
205 | const char **qmenu; | ||
206 | unsigned int is_private:1; | ||
207 | unsigned int is_volatile:1; | ||
208 | }; | ||
209 | |||
210 | /** v4l2_ctrl_fill() - Fill in the control fields based on the control ID. | ||
211 | * | ||
212 | * This works for all standard V4L2 controls. | ||
213 | * For non-standard controls it will only fill in the given arguments | ||
214 | * and @name will be NULL. | ||
215 | * | ||
216 | * This function will overwrite the contents of @name, @type and @flags. | ||
217 | * The contents of @min, @max, @step and @def may be modified depending on | ||
218 | * the type. | ||
219 | * | ||
220 | * Do not use in drivers! It is used internally for backwards compatibility | ||
221 | * control handling only. Once all drivers are converted to use the new | ||
222 | * control framework this function will no longer be exported. | ||
223 | */ | ||
224 | void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, | ||
225 | s32 *min, s32 *max, s32 *step, s32 *def, u32 *flags); | ||
226 | |||
227 | |||
228 | /** v4l2_ctrl_handler_init() - Initialize the control handler. | ||
229 | * @hdl: The control handler. | ||
230 | * @nr_of_controls_hint: A hint of how many controls this handler is | ||
231 | * expected to refer to. This is the total number, so including | ||
232 | * any inherited controls. It doesn't have to be precise, but if | ||
233 | * it is way off, then you either waste memory (too many buckets | ||
234 | * are allocated) or the control lookup becomes slower (not enough | ||
235 | * buckets are allocated, so there are more slow list lookups). | ||
236 | * It will always work, though. | ||
237 | * | ||
238 | * Returns an error if the buckets could not be allocated. This error will | ||
239 | * also be stored in @hdl->error. | ||
240 | */ | ||
241 | int v4l2_ctrl_handler_init(struct v4l2_ctrl_handler *hdl, | ||
242 | unsigned nr_of_controls_hint); | ||
243 | |||
244 | /** v4l2_ctrl_handler_free() - Free all controls owned by the handler and free | ||
245 | * the control list. | ||
246 | * @hdl: The control handler. | ||
247 | * | ||
248 | * Does nothing if @hdl == NULL. | ||
249 | */ | ||
250 | void v4l2_ctrl_handler_free(struct v4l2_ctrl_handler *hdl); | ||
251 | |||
252 | /** v4l2_ctrl_handler_setup() - Call the s_ctrl op for all controls belonging | ||
253 | * to the handler to initialize the hardware to the current control values. | ||
254 | * @hdl: The control handler. | ||
255 | * | ||
256 | * Button controls will be skipped, as are read-only controls. | ||
257 | * | ||
258 | * If @hdl == NULL, then this just returns 0. | ||
259 | */ | ||
260 | int v4l2_ctrl_handler_setup(struct v4l2_ctrl_handler *hdl); | ||
261 | |||
262 | /** v4l2_ctrl_handler_log_status() - Log all controls owned by the handler. | ||
263 | * @hdl: The control handler. | ||
264 | * @prefix: The prefix to use when logging the control values. If the | ||
265 | * prefix does not end with a space, then ": " will be added | ||
266 | * after the prefix. If @prefix == NULL, then no prefix will be | ||
267 | * used. | ||
268 | * | ||
269 | * For use with VIDIOC_LOG_STATUS. | ||
270 | * | ||
271 | * Does nothing if @hdl == NULL. | ||
272 | */ | ||
273 | void v4l2_ctrl_handler_log_status(struct v4l2_ctrl_handler *hdl, | ||
274 | const char *prefix); | ||
275 | |||
276 | /** v4l2_ctrl_new_custom() - Allocate and initialize a new custom V4L2 | ||
277 | * control. | ||
278 | * @hdl: The control handler. | ||
279 | * @cfg: The control's configuration data. | ||
280 | * @priv: The control's driver-specific private data. | ||
281 | * | ||
282 | * If the &v4l2_ctrl struct could not be allocated then NULL is returned | ||
283 | * and @hdl->error is set to the error code (if it wasn't set already). | ||
284 | */ | ||
285 | struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl, | ||
286 | const struct v4l2_ctrl_config *cfg, void *priv); | ||
287 | |||
288 | /** v4l2_ctrl_new_std() - Allocate and initialize a new standard V4L2 non-menu control. | ||
289 | * @hdl: The control handler. | ||
290 | * @ops: The control ops. | ||
291 | * @id: The control ID. | ||
292 | * @min: The control's minimum value. | ||
293 | * @max: The control's maximum value. | ||
294 | * @step: The control's step value | ||
295 | * @def: The control's default value. | ||
296 | * | ||
297 | * If the &v4l2_ctrl struct could not be allocated, or the control | ||
298 | * ID is not known, then NULL is returned and @hdl->error is set to the | ||
299 | * appropriate error code (if it wasn't set already). | ||
300 | * | ||
301 | * If @id refers to a menu control, then this function will return NULL. | ||
302 | * | ||
303 | * Use v4l2_ctrl_new_std_menu() when adding menu controls. | ||
304 | */ | ||
305 | struct v4l2_ctrl *v4l2_ctrl_new_std(struct v4l2_ctrl_handler *hdl, | ||
306 | const struct v4l2_ctrl_ops *ops, | ||
307 | u32 id, s32 min, s32 max, u32 step, s32 def); | ||
308 | |||
309 | /** v4l2_ctrl_new_std_menu() - Allocate and initialize a new standard V4L2 menu control. | ||
310 | * @hdl: The control handler. | ||
311 | * @ops: The control ops. | ||
312 | * @id: The control ID. | ||
313 | * @max: The control's maximum value. | ||
314 | * @mask: The control's skip mask for menu controls. This makes it | ||
315 | * easy to skip menu items that are not valid. If bit X is set, | ||
316 | * then menu item X is skipped. Of course, this only works for | ||
317 | * menus with <= 32 menu items. There are no menus that come | ||
318 | * close to that number, so this is OK. Should we ever need more, | ||
319 | * then this will have to be extended to a u64 or a bit array. | ||
320 | * @def: The control's default value. | ||
321 | * | ||
322 | * Same as v4l2_ctrl_new_std(), but @min is set to 0 and the @mask value | ||
323 | * determines which menu items are to be skipped. | ||
324 | * | ||
325 | * If @id refers to a non-menu control, then this function will return NULL. | ||
326 | */ | ||
327 | struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl, | ||
328 | const struct v4l2_ctrl_ops *ops, | ||
329 | u32 id, s32 max, s32 mask, s32 def); | ||
330 | |||
331 | /** v4l2_ctrl_add_ctrl() - Add a control from another handler to this handler. | ||
332 | * @hdl: The control handler. | ||
333 | * @ctrl: The control to add. | ||
334 | * | ||
335 | * It will return NULL if it was unable to add the control reference. | ||
336 | * If the control already belonged to the handler, then it will do | ||
337 | * nothing and just return @ctrl. | ||
338 | */ | ||
339 | struct v4l2_ctrl *v4l2_ctrl_add_ctrl(struct v4l2_ctrl_handler *hdl, | ||
340 | struct v4l2_ctrl *ctrl); | ||
341 | |||
342 | /** v4l2_ctrl_add_handler() - Add all controls from handler @add to | ||
343 | * handler @hdl. | ||
344 | * @hdl: The control handler. | ||
345 | * @add: The control handler whose controls you want to add to | ||
346 | * the @hdl control handler. | ||
347 | * | ||
348 | * Does nothing if either of the two is a NULL pointer. | ||
349 | * In case of an error @hdl->error will be set to the error code (if it | ||
350 | * wasn't set already). | ||
351 | */ | ||
352 | int v4l2_ctrl_add_handler(struct v4l2_ctrl_handler *hdl, | ||
353 | struct v4l2_ctrl_handler *add); | ||
354 | |||
355 | |||
356 | /** v4l2_ctrl_cluster() - Mark all controls in the cluster as belonging to that cluster. | ||
357 | * @ncontrols: The number of controls in this cluster. | ||
358 | * @controls: The cluster control array of size @ncontrols. | ||
359 | */ | ||
360 | void v4l2_ctrl_cluster(unsigned ncontrols, struct v4l2_ctrl **controls); | ||
361 | |||
362 | |||
363 | /** v4l2_ctrl_find() - Find a control with the given ID. | ||
364 | * @hdl: The control handler. | ||
365 | * @id: The control ID to find. | ||
366 | * | ||
367 | * If @hdl == NULL this will return NULL as well. Will lock the handler so | ||
368 | * do not use from inside &v4l2_ctrl_ops. | ||
369 | */ | ||
370 | struct v4l2_ctrl *v4l2_ctrl_find(struct v4l2_ctrl_handler *hdl, u32 id); | ||
371 | |||
372 | /** v4l2_ctrl_activate() - Make the control active or inactive. | ||
373 | * @ctrl: The control to (de)activate. | ||
374 | * @active: True if the control should become active. | ||
375 | * | ||
376 | * This sets or clears the V4L2_CTRL_FLAG_INACTIVE flag atomically. | ||
377 | * Does nothing if @ctrl == NULL. | ||
378 | * This will usually be called from within the s_ctrl op. | ||
379 | * | ||
380 | * This function can be called regardless of whether the control handler | ||
381 | * is locked or not. | ||
382 | */ | ||
383 | void v4l2_ctrl_activate(struct v4l2_ctrl *ctrl, bool active); | ||
384 | |||
385 | /** v4l2_ctrl_grab() - Mark the control as grabbed or not grabbed. | ||
386 | * @ctrl: The control to (de)activate. | ||
387 | * @grabbed: True if the control should become grabbed. | ||
388 | * | ||
389 | * This sets or clears the V4L2_CTRL_FLAG_GRABBED flag atomically. | ||
390 | * Does nothing if @ctrl == NULL. | ||
391 | * This will usually be called when starting or stopping streaming in the | ||
392 | * driver. | ||
393 | * | ||
394 | * This function can be called regardless of whether the control handler | ||
395 | * is locked or not. | ||
396 | */ | ||
397 | void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed); | ||
398 | |||
399 | /** v4l2_ctrl_lock() - Helper function to lock the handler | ||
400 | * associated with the control. | ||
401 | * @ctrl: The control to lock. | ||
402 | */ | ||
403 | static inline void v4l2_ctrl_lock(struct v4l2_ctrl *ctrl) | ||
404 | { | ||
405 | mutex_lock(&ctrl->handler->lock); | ||
406 | } | ||
407 | |||
408 | /** v4l2_ctrl_lock() - Helper function to unlock the handler | ||
409 | * associated with the control. | ||
410 | * @ctrl: The control to unlock. | ||
411 | */ | ||
412 | static inline void v4l2_ctrl_unlock(struct v4l2_ctrl *ctrl) | ||
413 | { | ||
414 | mutex_unlock(&ctrl->handler->lock); | ||
415 | } | ||
416 | |||
417 | /** v4l2_ctrl_g_ctrl() - Helper function to get the control's value from within a driver. | ||
418 | * @ctrl: The control. | ||
419 | * | ||
420 | * This returns the control's value safely by going through the control | ||
421 | * framework. This function will lock the control's handler, so it cannot be | ||
422 | * used from within the &v4l2_ctrl_ops functions. | ||
423 | * | ||
424 | * This function is for integer type controls only. | ||
425 | */ | ||
426 | s32 v4l2_ctrl_g_ctrl(struct v4l2_ctrl *ctrl); | ||
427 | |||
428 | /** v4l2_ctrl_s_ctrl() - Helper function to set the control's value from within a driver. | ||
429 | * @ctrl: The control. | ||
430 | * @val: The new value. | ||
431 | * | ||
432 | * This set the control's new value safely by going through the control | ||
433 | * framework. This function will lock the control's handler, so it cannot be | ||
434 | * used from within the &v4l2_ctrl_ops functions. | ||
435 | * | ||
436 | * This function is for integer type controls only. | ||
437 | */ | ||
438 | int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val); | ||
439 | |||
440 | |||
441 | /* Helpers for ioctl_ops. If hdl == NULL then they will all return -EINVAL. */ | ||
442 | int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc); | ||
443 | int v4l2_querymenu(struct v4l2_ctrl_handler *hdl, struct v4l2_querymenu *qm); | ||
444 | int v4l2_g_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_control *ctrl); | ||
445 | int v4l2_s_ctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_control *ctrl); | ||
446 | int v4l2_g_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *c); | ||
447 | int v4l2_try_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *c); | ||
448 | int v4l2_s_ext_ctrls(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *c); | ||
449 | |||
450 | /* Helpers for subdevices. If the associated ctrl_handler == NULL then they | ||
451 | will all return -EINVAL. */ | ||
452 | int v4l2_subdev_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc); | ||
453 | int v4l2_subdev_querymenu(struct v4l2_subdev *sd, struct v4l2_querymenu *qm); | ||
454 | int v4l2_subdev_g_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls *cs); | ||
455 | int v4l2_subdev_try_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls *cs); | ||
456 | int v4l2_subdev_s_ext_ctrls(struct v4l2_subdev *sd, struct v4l2_ext_controls *cs); | ||
457 | int v4l2_subdev_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl); | ||
458 | int v4l2_subdev_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl); | ||
459 | |||
460 | #endif | ||
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h index bebe44b03e0f..1efcacbed01a 100644 --- a/include/media/v4l2-dev.h +++ b/include/media/v4l2-dev.h | |||
@@ -27,6 +27,7 @@ | |||
27 | struct v4l2_ioctl_callbacks; | 27 | struct v4l2_ioctl_callbacks; |
28 | struct video_device; | 28 | struct video_device; |
29 | struct v4l2_device; | 29 | struct v4l2_device; |
30 | struct v4l2_ctrl_handler; | ||
30 | 31 | ||
31 | /* Flag to mark the video_device struct as registered. | 32 | /* Flag to mark the video_device struct as registered. |
32 | Drivers can clear this flag if they want to block all future | 33 | Drivers can clear this flag if they want to block all future |
@@ -67,6 +68,9 @@ struct video_device | |||
67 | struct device *parent; /* device parent */ | 68 | struct device *parent; /* device parent */ |
68 | struct v4l2_device *v4l2_dev; /* v4l2_device parent */ | 69 | struct v4l2_device *v4l2_dev; /* v4l2_device parent */ |
69 | 70 | ||
71 | /* Control handler associated with this device node. May be NULL. */ | ||
72 | struct v4l2_ctrl_handler *ctrl_handler; | ||
73 | |||
70 | /* device info */ | 74 | /* device info */ |
71 | char name[32]; | 75 | char name[32]; |
72 | int vfl_type; | 76 | int vfl_type; |
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h index 5d5d550e63ad..8bcbd7a0271c 100644 --- a/include/media/v4l2-device.h +++ b/include/media/v4l2-device.h | |||
@@ -32,6 +32,8 @@ | |||
32 | 32 | ||
33 | #define V4L2_DEVICE_NAME_SIZE (20 + 16) | 33 | #define V4L2_DEVICE_NAME_SIZE (20 + 16) |
34 | 34 | ||
35 | struct v4l2_ctrl_handler; | ||
36 | |||
35 | struct v4l2_device { | 37 | struct v4l2_device { |
36 | /* dev->driver_data points to this struct. | 38 | /* dev->driver_data points to this struct. |
37 | Note: dev might be NULL if there is no parent device | 39 | Note: dev might be NULL if there is no parent device |
@@ -47,6 +49,8 @@ struct v4l2_device { | |||
47 | /* notify callback called by some sub-devices. */ | 49 | /* notify callback called by some sub-devices. */ |
48 | void (*notify)(struct v4l2_subdev *sd, | 50 | void (*notify)(struct v4l2_subdev *sd, |
49 | unsigned int notification, void *arg); | 51 | unsigned int notification, void *arg); |
52 | /* The control handler. May be NULL. */ | ||
53 | struct v4l2_ctrl_handler *ctrl_handler; | ||
50 | }; | 54 | }; |
51 | 55 | ||
52 | /* Initialize v4l2_dev and make dev->driver_data point to v4l2_dev. | 56 | /* Initialize v4l2_dev and make dev->driver_data point to v4l2_dev. |
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 02c6f4d11ed3..4a97d7341a94 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h | |||
@@ -35,6 +35,7 @@ | |||
35 | #define V4L2_SUBDEV_IR_TX_FIFO_SERVICE_REQ 0x00000001 | 35 | #define V4L2_SUBDEV_IR_TX_FIFO_SERVICE_REQ 0x00000001 |
36 | 36 | ||
37 | struct v4l2_device; | 37 | struct v4l2_device; |
38 | struct v4l2_ctrl_handler; | ||
38 | struct v4l2_subdev; | 39 | struct v4l2_subdev; |
39 | struct tuner_setup; | 40 | struct tuner_setup; |
40 | 41 | ||
@@ -90,10 +91,31 @@ struct v4l2_decode_vbi_line { | |||
90 | not yet implemented) since ops provide proper type-checking. | 91 | not yet implemented) since ops provide proper type-checking. |
91 | */ | 92 | */ |
92 | 93 | ||
94 | /* Subdevice external IO pin configuration */ | ||
95 | #define V4L2_SUBDEV_IO_PIN_DISABLE (1 << 0) /* ENABLE assumed */ | ||
96 | #define V4L2_SUBDEV_IO_PIN_OUTPUT (1 << 1) | ||
97 | #define V4L2_SUBDEV_IO_PIN_INPUT (1 << 2) | ||
98 | #define V4L2_SUBDEV_IO_PIN_SET_VALUE (1 << 3) /* Set output value */ | ||
99 | #define V4L2_SUBDEV_IO_PIN_ACTIVE_LOW (1 << 4) /* ACTIVE HIGH assumed */ | ||
100 | |||
101 | struct v4l2_subdev_io_pin_config { | ||
102 | u32 flags; /* V4L2_SUBDEV_IO_PIN_* flags for this pin's config */ | ||
103 | u8 pin; /* Chip external IO pin to configure */ | ||
104 | u8 function; /* Internal signal pad/function to route to IO pin */ | ||
105 | u8 value; /* Initial value for pin - e.g. GPIO output value */ | ||
106 | u8 strength; /* Pin drive strength */ | ||
107 | }; | ||
108 | |||
93 | /* s_config: if set, then it is always called by the v4l2_i2c_new_subdev* | 109 | /* s_config: if set, then it is always called by the v4l2_i2c_new_subdev* |
94 | functions after the v4l2_subdev was registered. It is used to pass | 110 | functions after the v4l2_subdev was registered. It is used to pass |
95 | platform data to the subdev which can be used during initialization. | 111 | platform data to the subdev which can be used during initialization. |
96 | 112 | ||
113 | s_io_pin_config: configure one or more chip I/O pins for chips that | ||
114 | multiplex different internal signal pads out to IO pins. This function | ||
115 | takes a pointer to an array of 'n' pin configuration entries, one for | ||
116 | each pin being configured. This function could be called at times | ||
117 | other than just subdevice initialization. | ||
118 | |||
97 | init: initialize the sensor registors to some sort of reasonable default | 119 | init: initialize the sensor registors to some sort of reasonable default |
98 | values. Do not use for new drivers and should be removed in existing | 120 | values. Do not use for new drivers and should be removed in existing |
99 | drivers. | 121 | drivers. |
@@ -110,11 +132,18 @@ struct v4l2_decode_vbi_line { | |||
110 | 132 | ||
111 | s_power: puts subdevice in power saving mode (on == 0) or normal operation | 133 | s_power: puts subdevice in power saving mode (on == 0) or normal operation |
112 | mode (on == 1). | 134 | mode (on == 1). |
135 | |||
136 | interrupt_service_routine: Called by the bridge chip's interrupt service | ||
137 | handler, when an interrupt status has be raised due to this subdev, | ||
138 | so that this subdev can handle the details. It may schedule work to be | ||
139 | performed later. It must not sleep. *Called from an IRQ context*. | ||
113 | */ | 140 | */ |
114 | struct v4l2_subdev_core_ops { | 141 | struct v4l2_subdev_core_ops { |
115 | int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip); | 142 | int (*g_chip_ident)(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip); |
116 | int (*log_status)(struct v4l2_subdev *sd); | 143 | int (*log_status)(struct v4l2_subdev *sd); |
117 | int (*s_config)(struct v4l2_subdev *sd, int irq, void *platform_data); | 144 | int (*s_config)(struct v4l2_subdev *sd, int irq, void *platform_data); |
145 | int (*s_io_pin_config)(struct v4l2_subdev *sd, size_t n, | ||
146 | struct v4l2_subdev_io_pin_config *pincfg); | ||
118 | int (*init)(struct v4l2_subdev *sd, u32 val); | 147 | int (*init)(struct v4l2_subdev *sd, u32 val); |
119 | int (*load_fw)(struct v4l2_subdev *sd); | 148 | int (*load_fw)(struct v4l2_subdev *sd); |
120 | int (*reset)(struct v4l2_subdev *sd, u32 val); | 149 | int (*reset)(struct v4l2_subdev *sd, u32 val); |
@@ -133,6 +162,8 @@ struct v4l2_subdev_core_ops { | |||
133 | int (*s_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); | 162 | int (*s_register)(struct v4l2_subdev *sd, struct v4l2_dbg_register *reg); |
134 | #endif | 163 | #endif |
135 | int (*s_power)(struct v4l2_subdev *sd, int on); | 164 | int (*s_power)(struct v4l2_subdev *sd, int on); |
165 | int (*interrupt_service_routine)(struct v4l2_subdev *sd, | ||
166 | u32 status, bool *handled); | ||
136 | }; | 167 | }; |
137 | 168 | ||
138 | /* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio. | 169 | /* s_mode: switch the tuner to a specific tuner mode. Replacement of s_radio. |
@@ -307,11 +338,6 @@ struct v4l2_subdev_sensor_ops { | |||
307 | }; | 338 | }; |
308 | 339 | ||
309 | /* | 340 | /* |
310 | interrupt_service_routine: Called by the bridge chip's interrupt service | ||
311 | handler, when an IR interrupt status has be raised due to this subdev, | ||
312 | so that this subdev can handle the details. It may schedule work to be | ||
313 | performed later. It must not sleep. *Called from an IRQ context*. | ||
314 | |||
315 | [rt]x_g_parameters: Get the current operating parameters and state of the | 341 | [rt]x_g_parameters: Get the current operating parameters and state of the |
316 | the IR receiver or transmitter. | 342 | the IR receiver or transmitter. |
317 | 343 | ||
@@ -335,14 +361,9 @@ struct v4l2_subdev_sensor_ops { | |||
335 | */ | 361 | */ |
336 | 362 | ||
337 | enum v4l2_subdev_ir_mode { | 363 | enum v4l2_subdev_ir_mode { |
338 | V4L2_SUBDEV_IR_MODE_PULSE_WIDTH, /* space & mark widths in nanosecs */ | 364 | V4L2_SUBDEV_IR_MODE_PULSE_WIDTH, /* uses struct ir_raw_event records */ |
339 | }; | 365 | }; |
340 | 366 | ||
341 | /* Data format of data read or written for V4L2_SUBDEV_IR_MODE_PULSE_WIDTH */ | ||
342 | #define V4L2_SUBDEV_IR_PULSE_MAX_WIDTH_NS 0x7fffffff | ||
343 | #define V4L2_SUBDEV_IR_PULSE_LEVEL_MASK 0x80000000 | ||
344 | #define V4L2_SUBDEV_IR_PULSE_RX_SEQ_END 0xffffffff | ||
345 | |||
346 | struct v4l2_subdev_ir_parameters { | 367 | struct v4l2_subdev_ir_parameters { |
347 | /* Either Rx or Tx */ | 368 | /* Either Rx or Tx */ |
348 | unsigned int bytes_per_data_element; /* of data in read or write call */ | 369 | unsigned int bytes_per_data_element; /* of data in read or write call */ |
@@ -356,7 +377,10 @@ struct v4l2_subdev_ir_parameters { | |||
356 | u32 max_pulse_width; /* ns, valid only for baseband signal */ | 377 | u32 max_pulse_width; /* ns, valid only for baseband signal */ |
357 | unsigned int carrier_freq; /* Hz, valid only for modulated signal*/ | 378 | unsigned int carrier_freq; /* Hz, valid only for modulated signal*/ |
358 | unsigned int duty_cycle; /* percent, valid only for modulated signal*/ | 379 | unsigned int duty_cycle; /* percent, valid only for modulated signal*/ |
359 | bool invert; /* logically invert sense of mark/space */ | 380 | bool invert_level; /* invert signal level */ |
381 | |||
382 | /* Tx only */ | ||
383 | bool invert_carrier_sense; /* Send 0/space as a carrier burst */ | ||
360 | 384 | ||
361 | /* Rx only */ | 385 | /* Rx only */ |
362 | u32 noise_filter_min_width; /* ns, min time of a valid pulse */ | 386 | u32 noise_filter_min_width; /* ns, min time of a valid pulse */ |
@@ -366,10 +390,6 @@ struct v4l2_subdev_ir_parameters { | |||
366 | }; | 390 | }; |
367 | 391 | ||
368 | struct v4l2_subdev_ir_ops { | 392 | struct v4l2_subdev_ir_ops { |
369 | /* Common to receiver and transmitter */ | ||
370 | int (*interrupt_service_routine)(struct v4l2_subdev *sd, | ||
371 | u32 status, bool *handled); | ||
372 | |||
373 | /* Receiver */ | 393 | /* Receiver */ |
374 | int (*rx_read)(struct v4l2_subdev *sd, u8 *buf, size_t count, | 394 | int (*rx_read)(struct v4l2_subdev *sd, u8 *buf, size_t count, |
375 | ssize_t *num); | 395 | ssize_t *num); |
@@ -415,6 +435,8 @@ struct v4l2_subdev { | |||
415 | u32 flags; | 435 | u32 flags; |
416 | struct v4l2_device *v4l2_dev; | 436 | struct v4l2_device *v4l2_dev; |
417 | const struct v4l2_subdev_ops *ops; | 437 | const struct v4l2_subdev_ops *ops; |
438 | /* The control handler of this subdev. May be NULL. */ | ||
439 | struct v4l2_ctrl_handler *ctrl_handler; | ||
418 | /* name must be unique */ | 440 | /* name must be unique */ |
419 | char name[V4L2_SUBDEV_NAME_SIZE]; | 441 | char name[V4L2_SUBDEV_NAME_SIZE]; |
420 | /* can be used to group similar subdevs, value is driver-specific */ | 442 | /* can be used to group similar subdevs, value is driver-specific */ |
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h index 9ae5c613131b..8fcb6e0e9e72 100644 --- a/include/scsi/scsi.h +++ b/include/scsi/scsi.h | |||
@@ -151,10 +151,10 @@ struct scsi_cmnd; | |||
151 | 151 | ||
152 | /* defined in T10 SCSI Primary Commands-2 (SPC2) */ | 152 | /* defined in T10 SCSI Primary Commands-2 (SPC2) */ |
153 | struct scsi_varlen_cdb_hdr { | 153 | struct scsi_varlen_cdb_hdr { |
154 | u8 opcode; /* opcode always == VARIABLE_LENGTH_CMD */ | 154 | __u8 opcode; /* opcode always == VARIABLE_LENGTH_CMD */ |
155 | u8 control; | 155 | __u8 control; |
156 | u8 misc[5]; | 156 | __u8 misc[5]; |
157 | u8 additional_cdb_length; /* total cdb length - 8 */ | 157 | __u8 additional_cdb_length; /* total cdb length - 8 */ |
158 | __be16 service_action; | 158 | __be16 service_action; |
159 | /* service specific data follows */ | 159 | /* service specific data follows */ |
160 | }; | 160 | }; |
diff --git a/include/scsi/scsi_netlink.h b/include/scsi/scsi_netlink.h index 536752c40d41..58ce8fe44783 100644 --- a/include/scsi/scsi_netlink.h +++ b/include/scsi/scsi_netlink.h | |||
@@ -105,8 +105,8 @@ struct scsi_nl_host_vendor_msg { | |||
105 | * PCI : ID data is the 16 bit PCI Registered Vendor ID | 105 | * PCI : ID data is the 16 bit PCI Registered Vendor ID |
106 | */ | 106 | */ |
107 | #define SCSI_NL_VID_TYPE_SHIFT 56 | 107 | #define SCSI_NL_VID_TYPE_SHIFT 56 |
108 | #define SCSI_NL_VID_TYPE_MASK ((u64)0xFF << SCSI_NL_VID_TYPE_SHIFT) | 108 | #define SCSI_NL_VID_TYPE_MASK ((__u64)0xFF << SCSI_NL_VID_TYPE_SHIFT) |
109 | #define SCSI_NL_VID_TYPE_PCI ((u64)0x01 << SCSI_NL_VID_TYPE_SHIFT) | 109 | #define SCSI_NL_VID_TYPE_PCI ((__u64)0x01 << SCSI_NL_VID_TYPE_SHIFT) |
110 | #define SCSI_NL_VID_ID_MASK (~ SCSI_NL_VID_TYPE_MASK) | 110 | #define SCSI_NL_VID_ID_MASK (~ SCSI_NL_VID_TYPE_MASK) |
111 | 111 | ||
112 | 112 | ||
diff --git a/include/trace/events/block.h b/include/trace/events/block.h index d870a918559c..d8ce278515c3 100644 --- a/include/trace/events/block.h +++ b/include/trace/events/block.h | |||
@@ -25,8 +25,10 @@ DECLARE_EVENT_CLASS(block_rq_with_error, | |||
25 | 25 | ||
26 | TP_fast_assign( | 26 | TP_fast_assign( |
27 | __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0; | 27 | __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0; |
28 | __entry->sector = blk_pc_request(rq) ? 0 : blk_rq_pos(rq); | 28 | __entry->sector = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? |
29 | __entry->nr_sector = blk_pc_request(rq) ? 0 : blk_rq_sectors(rq); | 29 | 0 : blk_rq_pos(rq); |
30 | __entry->nr_sector = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? | ||
31 | 0 : blk_rq_sectors(rq); | ||
30 | __entry->errors = rq->errors; | 32 | __entry->errors = rq->errors; |
31 | 33 | ||
32 | blk_fill_rwbs_rq(__entry->rwbs, rq); | 34 | blk_fill_rwbs_rq(__entry->rwbs, rq); |
@@ -109,9 +111,12 @@ DECLARE_EVENT_CLASS(block_rq, | |||
109 | 111 | ||
110 | TP_fast_assign( | 112 | TP_fast_assign( |
111 | __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0; | 113 | __entry->dev = rq->rq_disk ? disk_devt(rq->rq_disk) : 0; |
112 | __entry->sector = blk_pc_request(rq) ? 0 : blk_rq_pos(rq); | 114 | __entry->sector = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? |
113 | __entry->nr_sector = blk_pc_request(rq) ? 0 : blk_rq_sectors(rq); | 115 | 0 : blk_rq_pos(rq); |
114 | __entry->bytes = blk_pc_request(rq) ? blk_rq_bytes(rq) : 0; | 116 | __entry->nr_sector = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? |
117 | 0 : blk_rq_sectors(rq); | ||
118 | __entry->bytes = (rq->cmd_type == REQ_TYPE_BLOCK_PC) ? | ||
119 | blk_rq_bytes(rq) : 0; | ||
115 | 120 | ||
116 | blk_fill_rwbs_rq(__entry->rwbs, rq); | 121 | blk_fill_rwbs_rq(__entry->rwbs, rq); |
117 | blk_dump_cmd(__get_str(cmd), rq); | 122 | blk_dump_cmd(__get_str(cmd), rq); |
diff --git a/include/trace/events/writeback.h b/include/trace/events/writeback.h new file mode 100644 index 000000000000..f345f66ae9d1 --- /dev/null +++ b/include/trace/events/writeback.h | |||
@@ -0,0 +1,159 @@ | |||
1 | #undef TRACE_SYSTEM | ||
2 | #define TRACE_SYSTEM writeback | ||
3 | |||
4 | #if !defined(_TRACE_WRITEBACK_H) || defined(TRACE_HEADER_MULTI_READ) | ||
5 | #define _TRACE_WRITEBACK_H | ||
6 | |||
7 | #include <linux/backing-dev.h> | ||
8 | #include <linux/device.h> | ||
9 | #include <linux/writeback.h> | ||
10 | |||
11 | struct wb_writeback_work; | ||
12 | |||
13 | DECLARE_EVENT_CLASS(writeback_work_class, | ||
14 | TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), | ||
15 | TP_ARGS(bdi, work), | ||
16 | TP_STRUCT__entry( | ||
17 | __array(char, name, 32) | ||
18 | __field(long, nr_pages) | ||
19 | __field(dev_t, sb_dev) | ||
20 | __field(int, sync_mode) | ||
21 | __field(int, for_kupdate) | ||
22 | __field(int, range_cyclic) | ||
23 | __field(int, for_background) | ||
24 | ), | ||
25 | TP_fast_assign( | ||
26 | strncpy(__entry->name, dev_name(bdi->dev), 32); | ||
27 | __entry->nr_pages = work->nr_pages; | ||
28 | __entry->sb_dev = work->sb ? work->sb->s_dev : 0; | ||
29 | __entry->sync_mode = work->sync_mode; | ||
30 | __entry->for_kupdate = work->for_kupdate; | ||
31 | __entry->range_cyclic = work->range_cyclic; | ||
32 | __entry->for_background = work->for_background; | ||
33 | ), | ||
34 | TP_printk("bdi %s: sb_dev %d:%d nr_pages=%ld sync_mode=%d " | ||
35 | "kupdate=%d range_cyclic=%d background=%d", | ||
36 | __entry->name, | ||
37 | MAJOR(__entry->sb_dev), MINOR(__entry->sb_dev), | ||
38 | __entry->nr_pages, | ||
39 | __entry->sync_mode, | ||
40 | __entry->for_kupdate, | ||
41 | __entry->range_cyclic, | ||
42 | __entry->for_background | ||
43 | ) | ||
44 | ); | ||
45 | #define DEFINE_WRITEBACK_WORK_EVENT(name) \ | ||
46 | DEFINE_EVENT(writeback_work_class, name, \ | ||
47 | TP_PROTO(struct backing_dev_info *bdi, struct wb_writeback_work *work), \ | ||
48 | TP_ARGS(bdi, work)) | ||
49 | DEFINE_WRITEBACK_WORK_EVENT(writeback_nothread); | ||
50 | DEFINE_WRITEBACK_WORK_EVENT(writeback_queue); | ||
51 | DEFINE_WRITEBACK_WORK_EVENT(writeback_exec); | ||
52 | |||
53 | TRACE_EVENT(writeback_pages_written, | ||
54 | TP_PROTO(long pages_written), | ||
55 | TP_ARGS(pages_written), | ||
56 | TP_STRUCT__entry( | ||
57 | __field(long, pages) | ||
58 | ), | ||
59 | TP_fast_assign( | ||
60 | __entry->pages = pages_written; | ||
61 | ), | ||
62 | TP_printk("%ld", __entry->pages) | ||
63 | ); | ||
64 | |||
65 | DECLARE_EVENT_CLASS(writeback_class, | ||
66 | TP_PROTO(struct backing_dev_info *bdi), | ||
67 | TP_ARGS(bdi), | ||
68 | TP_STRUCT__entry( | ||
69 | __array(char, name, 32) | ||
70 | ), | ||
71 | TP_fast_assign( | ||
72 | strncpy(__entry->name, dev_name(bdi->dev), 32); | ||
73 | ), | ||
74 | TP_printk("bdi %s", | ||
75 | __entry->name | ||
76 | ) | ||
77 | ); | ||
78 | #define DEFINE_WRITEBACK_EVENT(name) \ | ||
79 | DEFINE_EVENT(writeback_class, name, \ | ||
80 | TP_PROTO(struct backing_dev_info *bdi), \ | ||
81 | TP_ARGS(bdi)) | ||
82 | |||
83 | DEFINE_WRITEBACK_EVENT(writeback_nowork); | ||
84 | DEFINE_WRITEBACK_EVENT(writeback_wake_thread); | ||
85 | DEFINE_WRITEBACK_EVENT(writeback_wake_forker_thread); | ||
86 | DEFINE_WRITEBACK_EVENT(writeback_bdi_register); | ||
87 | DEFINE_WRITEBACK_EVENT(writeback_bdi_unregister); | ||
88 | DEFINE_WRITEBACK_EVENT(writeback_thread_start); | ||
89 | DEFINE_WRITEBACK_EVENT(writeback_thread_stop); | ||
90 | |||
91 | DECLARE_EVENT_CLASS(wbc_class, | ||
92 | TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), | ||
93 | TP_ARGS(wbc, bdi), | ||
94 | TP_STRUCT__entry( | ||
95 | __array(char, name, 32) | ||
96 | __field(long, nr_to_write) | ||
97 | __field(long, pages_skipped) | ||
98 | __field(int, sync_mode) | ||
99 | __field(int, nonblocking) | ||
100 | __field(int, encountered_congestion) | ||
101 | __field(int, for_kupdate) | ||
102 | __field(int, for_background) | ||
103 | __field(int, for_reclaim) | ||
104 | __field(int, range_cyclic) | ||
105 | __field(int, more_io) | ||
106 | __field(unsigned long, older_than_this) | ||
107 | __field(long, range_start) | ||
108 | __field(long, range_end) | ||
109 | ), | ||
110 | |||
111 | TP_fast_assign( | ||
112 | strncpy(__entry->name, dev_name(bdi->dev), 32); | ||
113 | __entry->nr_to_write = wbc->nr_to_write; | ||
114 | __entry->pages_skipped = wbc->pages_skipped; | ||
115 | __entry->sync_mode = wbc->sync_mode; | ||
116 | __entry->for_kupdate = wbc->for_kupdate; | ||
117 | __entry->for_background = wbc->for_background; | ||
118 | __entry->for_reclaim = wbc->for_reclaim; | ||
119 | __entry->range_cyclic = wbc->range_cyclic; | ||
120 | __entry->more_io = wbc->more_io; | ||
121 | __entry->older_than_this = wbc->older_than_this ? | ||
122 | *wbc->older_than_this : 0; | ||
123 | __entry->range_start = (long)wbc->range_start; | ||
124 | __entry->range_end = (long)wbc->range_end; | ||
125 | ), | ||
126 | |||
127 | TP_printk("bdi %s: towrt=%ld skip=%ld mode=%d kupd=%d " | ||
128 | "bgrd=%d reclm=%d cyclic=%d more=%d older=0x%lx " | ||
129 | "start=0x%lx end=0x%lx", | ||
130 | __entry->name, | ||
131 | __entry->nr_to_write, | ||
132 | __entry->pages_skipped, | ||
133 | __entry->sync_mode, | ||
134 | __entry->for_kupdate, | ||
135 | __entry->for_background, | ||
136 | __entry->for_reclaim, | ||
137 | __entry->range_cyclic, | ||
138 | __entry->more_io, | ||
139 | __entry->older_than_this, | ||
140 | __entry->range_start, | ||
141 | __entry->range_end) | ||
142 | ) | ||
143 | |||
144 | #define DEFINE_WBC_EVENT(name) \ | ||
145 | DEFINE_EVENT(wbc_class, name, \ | ||
146 | TP_PROTO(struct writeback_control *wbc, struct backing_dev_info *bdi), \ | ||
147 | TP_ARGS(wbc, bdi)) | ||
148 | DEFINE_WBC_EVENT(wbc_writeback_start); | ||
149 | DEFINE_WBC_EVENT(wbc_writeback_written); | ||
150 | DEFINE_WBC_EVENT(wbc_writeback_wait); | ||
151 | DEFINE_WBC_EVENT(wbc_balance_dirty_start); | ||
152 | DEFINE_WBC_EVENT(wbc_balance_dirty_written); | ||
153 | DEFINE_WBC_EVENT(wbc_balance_dirty_wait); | ||
154 | DEFINE_WBC_EVENT(wbc_writepage); | ||
155 | |||
156 | #endif /* _TRACE_WRITEBACK_H */ | ||
157 | |||
158 | /* This part must be outside protection */ | ||
159 | #include <trace/define_trace.h> | ||
diff --git a/include/video/mipi_display.h b/include/video/mipi_display.h new file mode 100644 index 000000000000..ddcc8ca7316b --- /dev/null +++ b/include/video/mipi_display.h | |||
@@ -0,0 +1,130 @@ | |||
1 | /* | ||
2 | * Defines for Mobile Industry Processor Interface (MIPI(R)) | ||
3 | * Display Working Group standards: DSI, DCS, DBI, DPI | ||
4 | * | ||
5 | * Copyright (C) 2010 Guennadi Liakhovetski <g.liakhovetski@gmx.de> | ||
6 | * Copyright (C) 2006 Nokia Corporation | ||
7 | * Author: Imre Deak <imre.deak@nokia.com> | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
12 | */ | ||
13 | #ifndef MIPI_DISPLAY_H | ||
14 | #define MIPI_DISPLAY_H | ||
15 | |||
16 | /* MIPI DSI Processor-to-Peripheral transaction types */ | ||
17 | enum { | ||
18 | MIPI_DSI_V_SYNC_START = 0x01, | ||
19 | MIPI_DSI_V_SYNC_END = 0x11, | ||
20 | MIPI_DSI_H_SYNC_START = 0x21, | ||
21 | MIPI_DSI_H_SYNC_END = 0x31, | ||
22 | |||
23 | MIPI_DSI_COLOR_MODE_OFF = 0x02, | ||
24 | MIPI_DSI_COLOR_MODE_ON = 0x12, | ||
25 | MIPI_DSI_SHUTDOWN_PERIPHERAL = 0x22, | ||
26 | MIPI_DSI_TURN_ON_PERIPHERAL = 0x32, | ||
27 | |||
28 | MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM = 0x03, | ||
29 | MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM = 0x13, | ||
30 | MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM = 0x23, | ||
31 | |||
32 | MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM = 0x04, | ||
33 | MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM = 0x14, | ||
34 | MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM = 0x24, | ||
35 | |||
36 | MIPI_DSI_DCS_SHORT_WRITE = 0x05, | ||
37 | MIPI_DSI_DCS_SHORT_WRITE_PARAM = 0x15, | ||
38 | |||
39 | MIPI_DSI_DCS_READ = 0x06, | ||
40 | |||
41 | MIPI_DSI_SET_MAXIMUM_RETURN_PACKET_SIZE = 0x37, | ||
42 | |||
43 | MIPI_DSI_END_OF_TRANSMISSION = 0x08, | ||
44 | |||
45 | MIPI_DSI_NULL_PACKET = 0x09, | ||
46 | MIPI_DSI_BLANKING_PACKET = 0x19, | ||
47 | MIPI_DSI_GENERIC_LONG_WRITE = 0x29, | ||
48 | MIPI_DSI_DCS_LONG_WRITE = 0x39, | ||
49 | |||
50 | MIPI_DSI_LOOSELY_PACKED_PIXEL_STREAM_YCBCR20 = 0x0c, | ||
51 | MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR24 = 0x1c, | ||
52 | MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR16 = 0x2c, | ||
53 | |||
54 | MIPI_DSI_PACKED_PIXEL_STREAM_30 = 0x0d, | ||
55 | MIPI_DSI_PACKED_PIXEL_STREAM_36 = 0x1d, | ||
56 | MIPI_DSI_PACKED_PIXEL_STREAM_YCBCR12 = 0x3d, | ||
57 | |||
58 | MIPI_DSI_PACKED_PIXEL_STREAM_16 = 0x0e, | ||
59 | MIPI_DSI_PACKED_PIXEL_STREAM_18 = 0x1e, | ||
60 | MIPI_DSI_PIXEL_STREAM_3BYTE_18 = 0x2e, | ||
61 | MIPI_DSI_PACKED_PIXEL_STREAM_24 = 0x3e, | ||
62 | }; | ||
63 | |||
64 | /* MIPI DSI Peripheral-to-Processor transaction types */ | ||
65 | enum { | ||
66 | MIPI_DSI_RX_ACKNOWLEDGE_AND_ERROR_REPORT = 0x02, | ||
67 | MIPI_DSI_RX_END_OF_TRANSMISSION = 0x08, | ||
68 | MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_1BYTE = 0x11, | ||
69 | MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_2BYTE = 0x12, | ||
70 | MIPI_DSI_RX_GENERIC_LONG_READ_RESPONSE = 0x1a, | ||
71 | MIPI_DSI_RX_DCS_LONG_READ_RESPONSE = 0x1c, | ||
72 | MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_1BYTE = 0x21, | ||
73 | MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_2BYTE = 0x22, | ||
74 | }; | ||
75 | |||
76 | /* MIPI DCS commands */ | ||
77 | enum { | ||
78 | MIPI_DCS_NOP = 0x00, | ||
79 | MIPI_DCS_SOFT_RESET = 0x01, | ||
80 | MIPI_DCS_GET_DISPLAY_ID = 0x04, | ||
81 | MIPI_DCS_GET_RED_CHANNEL = 0x06, | ||
82 | MIPI_DCS_GET_GREEN_CHANNEL = 0x07, | ||
83 | MIPI_DCS_GET_BLUE_CHANNEL = 0x08, | ||
84 | MIPI_DCS_GET_DISPLAY_STATUS = 0x09, | ||
85 | MIPI_DCS_GET_POWER_MODE = 0x0A, | ||
86 | MIPI_DCS_GET_ADDRESS_MODE = 0x0B, | ||
87 | MIPI_DCS_GET_PIXEL_FORMAT = 0x0C, | ||
88 | MIPI_DCS_GET_DISPLAY_MODE = 0x0D, | ||
89 | MIPI_DCS_GET_SIGNAL_MODE = 0x0E, | ||
90 | MIPI_DCS_GET_DIAGNOSTIC_RESULT = 0x0F, | ||
91 | MIPI_DCS_ENTER_SLEEP_MODE = 0x10, | ||
92 | MIPI_DCS_EXIT_SLEEP_MODE = 0x11, | ||
93 | MIPI_DCS_ENTER_PARTIAL_MODE = 0x12, | ||
94 | MIPI_DCS_ENTER_NORMAL_MODE = 0x13, | ||
95 | MIPI_DCS_EXIT_INVERT_MODE = 0x20, | ||
96 | MIPI_DCS_ENTER_INVERT_MODE = 0x21, | ||
97 | MIPI_DCS_SET_GAMMA_CURVE = 0x26, | ||
98 | MIPI_DCS_SET_DISPLAY_OFF = 0x28, | ||
99 | MIPI_DCS_SET_DISPLAY_ON = 0x29, | ||
100 | MIPI_DCS_SET_COLUMN_ADDRESS = 0x2A, | ||
101 | MIPI_DCS_SET_PAGE_ADDRESS = 0x2B, | ||
102 | MIPI_DCS_WRITE_MEMORY_START = 0x2C, | ||
103 | MIPI_DCS_WRITE_LUT = 0x2D, | ||
104 | MIPI_DCS_READ_MEMORY_START = 0x2E, | ||
105 | MIPI_DCS_SET_PARTIAL_AREA = 0x30, | ||
106 | MIPI_DCS_SET_SCROLL_AREA = 0x33, | ||
107 | MIPI_DCS_SET_TEAR_OFF = 0x34, | ||
108 | MIPI_DCS_SET_TEAR_ON = 0x35, | ||
109 | MIPI_DCS_SET_ADDRESS_MODE = 0x36, | ||
110 | MIPI_DCS_SET_SCROLL_START = 0x37, | ||
111 | MIPI_DCS_EXIT_IDLE_MODE = 0x38, | ||
112 | MIPI_DCS_ENTER_IDLE_MODE = 0x39, | ||
113 | MIPI_DCS_SET_PIXEL_FORMAT = 0x3A, | ||
114 | MIPI_DCS_WRITE_MEMORY_CONTINUE = 0x3C, | ||
115 | MIPI_DCS_READ_MEMORY_CONTINUE = 0x3E, | ||
116 | MIPI_DCS_SET_TEAR_SCANLINE = 0x44, | ||
117 | MIPI_DCS_GET_SCANLINE = 0x45, | ||
118 | MIPI_DCS_READ_DDB_START = 0xA1, | ||
119 | MIPI_DCS_READ_DDB_CONTINUE = 0xA8, | ||
120 | }; | ||
121 | |||
122 | /* MIPI DCS pixel formats */ | ||
123 | #define MIPI_DCS_PIXEL_FMT_24BIT 7 | ||
124 | #define MIPI_DCS_PIXEL_FMT_18BIT 6 | ||
125 | #define MIPI_DCS_PIXEL_FMT_16BIT 5 | ||
126 | #define MIPI_DCS_PIXEL_FMT_12BIT 3 | ||
127 | #define MIPI_DCS_PIXEL_FMT_8BIT 2 | ||
128 | #define MIPI_DCS_PIXEL_FMT_3BIT 1 | ||
129 | |||
130 | #endif | ||
diff --git a/include/video/sh_mipi_dsi.h b/include/video/sh_mipi_dsi.h new file mode 100644 index 000000000000..18bca08f9f59 --- /dev/null +++ b/include/video/sh_mipi_dsi.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | * Public SH-mobile MIPI DSI header | ||
3 | * | ||
4 | * Copyright (C) 2010 Guennadi Liakhovetski <g.liakhovetski@gmx.de> | ||
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 | #ifndef VIDEO_SH_MIPI_DSI_H | ||
11 | #define VIDEO_SH_MIPI_DSI_H | ||
12 | |||
13 | enum sh_mipi_dsi_data_fmt { | ||
14 | MIPI_RGB888, | ||
15 | MIPI_RGB565, | ||
16 | MIPI_RGB666_LP, | ||
17 | MIPI_RGB666, | ||
18 | MIPI_BGR888, | ||
19 | MIPI_BGR565, | ||
20 | MIPI_BGR666_LP, | ||
21 | MIPI_BGR666, | ||
22 | MIPI_YUYV, | ||
23 | MIPI_UYVY, | ||
24 | MIPI_YUV420_L, | ||
25 | MIPI_YUV420, | ||
26 | }; | ||
27 | |||
28 | struct sh_mobile_lcdc_chan_cfg; | ||
29 | |||
30 | struct sh_mipi_dsi_info { | ||
31 | enum sh_mipi_dsi_data_fmt data_format; | ||
32 | struct sh_mobile_lcdc_chan_cfg *lcd_chan; | ||
33 | }; | ||
34 | |||
35 | #endif | ||
diff --git a/include/video/sh_mobile_hdmi.h b/include/video/sh_mobile_hdmi.h new file mode 100644 index 000000000000..577cf18cce89 --- /dev/null +++ b/include/video/sh_mobile_hdmi.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * SH-Mobile High-Definition Multimedia Interface (HDMI) | ||
3 | * | ||
4 | * Copyright (C) 2010, Guennadi Liakhovetski <g.liakhovetski@gmx.de> | ||
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 | #ifndef SH_MOBILE_HDMI_H | ||
12 | #define SH_MOBILE_HDMI_H | ||
13 | |||
14 | struct sh_mobile_lcdc_chan_cfg; | ||
15 | struct device; | ||
16 | |||
17 | struct sh_mobile_hdmi_info { | ||
18 | struct sh_mobile_lcdc_chan_cfg *lcd_chan; | ||
19 | struct device *lcd_dev; | ||
20 | }; | ||
21 | |||
22 | #endif | ||
diff --git a/include/video/sh_mobile_lcdc.h b/include/video/sh_mobile_lcdc.h index 288205457713..55d700e8566e 100644 --- a/include/video/sh_mobile_lcdc.h +++ b/include/video/sh_mobile_lcdc.h | |||
@@ -3,24 +3,27 @@ | |||
3 | 3 | ||
4 | #include <linux/fb.h> | 4 | #include <linux/fb.h> |
5 | 5 | ||
6 | enum { RGB8, /* 24bpp, 8:8:8 */ | 6 | enum { |
7 | RGB9, /* 18bpp, 9:9 */ | 7 | RGB8, /* 24bpp, 8:8:8 */ |
8 | RGB12A, /* 24bpp, 12:12 */ | 8 | RGB9, /* 18bpp, 9:9 */ |
9 | RGB12B, /* 12bpp */ | 9 | RGB12A, /* 24bpp, 12:12 */ |
10 | RGB16, /* 16bpp */ | 10 | RGB12B, /* 12bpp */ |
11 | RGB18, /* 18bpp */ | 11 | RGB16, /* 16bpp */ |
12 | RGB24, /* 24bpp */ | 12 | RGB18, /* 18bpp */ |
13 | SYS8A, /* 24bpp, 8:8:8 */ | 13 | RGB24, /* 24bpp */ |
14 | SYS8B, /* 18bpp, 8:8:2 */ | 14 | YUV422, /* 16bpp */ |
15 | SYS8C, /* 18bpp, 2:8:8 */ | 15 | SYS8A, /* 24bpp, 8:8:8 */ |
16 | SYS8D, /* 16bpp, 8:8 */ | 16 | SYS8B, /* 18bpp, 8:8:2 */ |
17 | SYS9, /* 18bpp, 9:9 */ | 17 | SYS8C, /* 18bpp, 2:8:8 */ |
18 | SYS12, /* 24bpp, 12:12 */ | 18 | SYS8D, /* 16bpp, 8:8 */ |
19 | SYS16A, /* 16bpp */ | 19 | SYS9, /* 18bpp, 9:9 */ |
20 | SYS16B, /* 18bpp, 16:2 */ | 20 | SYS12, /* 24bpp, 12:12 */ |
21 | SYS16C, /* 18bpp, 2:16 */ | 21 | SYS16A, /* 16bpp */ |
22 | SYS18, /* 18bpp */ | 22 | SYS16B, /* 18bpp, 16:2 */ |
23 | SYS24 };/* 24bpp */ | 23 | SYS16C, /* 18bpp, 2:16 */ |
24 | SYS18, /* 18bpp */ | ||
25 | SYS24, /* 24bpp */ | ||
26 | }; | ||
24 | 27 | ||
25 | enum { LCDC_CHAN_DISABLED = 0, | 28 | enum { LCDC_CHAN_DISABLED = 0, |
26 | LCDC_CHAN_MAINLCD, | 29 | LCDC_CHAN_MAINLCD, |
@@ -52,7 +55,7 @@ struct sh_mobile_lcdc_board_cfg { | |||
52 | struct sh_mobile_lcdc_sys_bus_ops *sys_ops); | 55 | struct sh_mobile_lcdc_sys_bus_ops *sys_ops); |
53 | void (*start_transfer)(void *board_data, void *sys_ops_handle, | 56 | void (*start_transfer)(void *board_data, void *sys_ops_handle, |
54 | struct sh_mobile_lcdc_sys_bus_ops *sys_ops); | 57 | struct sh_mobile_lcdc_sys_bus_ops *sys_ops); |
55 | void (*display_on)(void *board_data); | 58 | void (*display_on)(void *board_data, struct fb_info *info); |
56 | void (*display_off)(void *board_data); | 59 | void (*display_off)(void *board_data); |
57 | }; | 60 | }; |
58 | 61 | ||