Gentoo Archives: gentoo-commits

From: "Mike Pagano (mpagano)" <mpagano@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] linux-patches r1674 - genpatches-2.6/trunk/2.6.33
Date: Thu, 18 Feb 2010 15:59:07
Message-Id: E1Ni8lZ-0000nI-PT@stork.gentoo.org
1 Author: mpagano
2 Date: 2010-02-18 15:58:13 +0000 (Thu, 18 Feb 2010)
3 New Revision: 1674
4
5 Removed:
6 genpatches-2.6/trunk/2.6.33/1000_linux-2.6.32.1.patch
7 genpatches-2.6/trunk/2.6.33/1001_linux-2.6.32.2.patch
8 genpatches-2.6/trunk/2.6.33/1002_linux-2.6.32.3.patch
9 genpatches-2.6/trunk/2.6.33/1003_linux-2.6.32.4.patch
10 genpatches-2.6/trunk/2.6.33/1004_linux-2.6.32.5.patch
11 genpatches-2.6/trunk/2.6.33/1005_linux-2.6.32.6.patch
12 genpatches-2.6/trunk/2.6.33/1006_linux-2.6.32.7.patch
13 genpatches-2.6/trunk/2.6.33/1007_linux-2.6.32.8.patch
14 genpatches-2.6/trunk/2.6.33/2410_rtl8187se-compilation-fix.patch
15 genpatches-2.6/trunk/2.6.33/2500_libata-fix-truncated-LBA48-ret-vals.patch
16 Modified:
17 genpatches-2.6/trunk/2.6.33/0000_README
18 Log:
19 Preparing 2.6.33 genpatches
20
21 Modified: genpatches-2.6/trunk/2.6.33/0000_README
22 ===================================================================
23 --- genpatches-2.6/trunk/2.6.33/0000_README 2010-02-18 15:55:49 UTC (rev 1673)
24 +++ genpatches-2.6/trunk/2.6.33/0000_README 2010-02-18 15:58:13 UTC (rev 1674)
25 @@ -39,46 +39,6 @@
26 Individual Patch Descriptions:
27 --------------------------------------------------------------------------
28
29 -Patch: 1000_linux-2.6.32.1.patch
30 -From: http://www.kernel.org
31 -Desc: Linux 2.6.32.1
32 -
33 -Patch: 1001_linux-2.6.32.2.patch
34 -From: http://www.kernel.org
35 -Desc: Linux 2.6.32.2
36 -
37 -Patch: 1002_linux-2.6.32.3.patch
38 -From: http://www.kernel.org
39 -Desc: Linux 2.6.32.3
40 -
41 -Patch: 1003_linux-2.6.32.4.patch
42 -From: http://www.kernel.org
43 -Desc: Linux 2.6.32.4
44 -
45 -Patch: 1004_linux-2.6.32.5.patch
46 -From: http://www.kernel.org
47 -Desc: Linux 2.6.32.5
48 -
49 -Patch: 1005_linux-2.6.32.6.patch
50 -From: http://www.kernel.org
51 -Desc: Linux 2.6.32.6
52 -
53 -Patch: 1006_linux-2.6.32.7.patch
54 -From: http://www.kernel.org
55 -Desc: Linux 2.6.32.7
56 -
57 -Patch: 1007_linux-2.6.32.8.patch
58 -From: http://www.kernel.org
59 -Desc: Linux 2.6.32.8
60 -
61 -Patch: 2410_rtl8187se-compilation-fix.patch
62 -From: http://bugs.gentoo.org/show_bug.cgi?id=296920
63 -Desc: Fix rtl8187se compilation errors with mac80211
64 -
65 -Patch: 2500_libata-fix-truncated-LBA48-ret-vals.patch
66 -From: http://bugs.gentoo.org/show_bug.cgi?id=303313
67 -Desc: Fix bug which truncated LBA48 return values
68 -
69 Patch: 4200_fbcondecor-0.9.6.patch
70 From: http://dev.gentoo.org/~spock
71 Desc: Bootsplash successor by Michal Januszewski
72
73 Deleted: genpatches-2.6/trunk/2.6.33/1000_linux-2.6.32.1.patch
74 ===================================================================
75 --- genpatches-2.6/trunk/2.6.33/1000_linux-2.6.32.1.patch 2010-02-18 15:55:49 UTC (rev 1673)
76 +++ genpatches-2.6/trunk/2.6.33/1000_linux-2.6.32.1.patch 2010-02-18 15:58:13 UTC (rev 1674)
77 @@ -1,1833 +0,0 @@
78 -diff --git a/Documentation/filesystems/ext4.txt b/Documentation/filesystems/ext4.txt
79 -index 6d94e06..af6885c 100644
80 ---- a/Documentation/filesystems/ext4.txt
81 -+++ b/Documentation/filesystems/ext4.txt
82 -@@ -153,8 +153,8 @@ journal_dev=devnum When the external journal device's major/minor numbers
83 - identified through its new major/minor numbers encoded
84 - in devnum.
85 -
86 --noload Don't load the journal on mounting. Note that
87 -- if the filesystem was not unmounted cleanly,
88 -+norecovery Don't load the journal on mounting. Note that
89 -+noload if the filesystem was not unmounted cleanly,
90 - skipping the journal replay will lead to the
91 - filesystem containing inconsistencies that can
92 - lead to any number of problems.
93 -@@ -353,6 +353,12 @@ noauto_da_alloc replacing existing files via patterns such as
94 - system crashes before the delayed allocation
95 - blocks are forced to disk.
96 -
97 -+discard Controls whether ext4 should issue discard/TRIM
98 -+nodiscard(*) commands to the underlying block device when
99 -+ blocks are freed. This is useful for SSD devices
100 -+ and sparse/thinly-provisioned LUNs, but it is off
101 -+ by default until sufficient testing has been done.
102 -+
103 - Data Mode
104 - =========
105 - There are 3 different data modes:
106 -diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
107 -index c968cc3..554626e 100644
108 ---- a/drivers/scsi/hosts.c
109 -+++ b/drivers/scsi/hosts.c
110 -@@ -180,14 +180,20 @@ void scsi_remove_host(struct Scsi_Host *shost)
111 - EXPORT_SYMBOL(scsi_remove_host);
112 -
113 - /**
114 -- * scsi_add_host - add a scsi host
115 -+ * scsi_add_host_with_dma - add a scsi host with dma device
116 - * @shost: scsi host pointer to add
117 - * @dev: a struct device of type scsi class
118 -+ * @dma_dev: dma device for the host
119 -+ *
120 -+ * Note: You rarely need to worry about this unless you're in a
121 -+ * virtualised host environments, so use the simpler scsi_add_host()
122 -+ * function instead.
123 - *
124 - * Return value:
125 - * 0 on success / != 0 for error
126 - **/
127 --int scsi_add_host(struct Scsi_Host *shost, struct device *dev)
128 -+int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
129 -+ struct device *dma_dev)
130 - {
131 - struct scsi_host_template *sht = shost->hostt;
132 - int error = -EINVAL;
133 -@@ -207,6 +213,7 @@ int scsi_add_host(struct Scsi_Host *shost, struct device *dev)
134 -
135 - if (!shost->shost_gendev.parent)
136 - shost->shost_gendev.parent = dev ? dev : &platform_bus;
137 -+ shost->dma_dev = dma_dev;
138 -
139 - error = device_add(&shost->shost_gendev);
140 - if (error)
141 -@@ -262,7 +269,7 @@ int scsi_add_host(struct Scsi_Host *shost, struct device *dev)
142 - fail:
143 - return error;
144 - }
145 --EXPORT_SYMBOL(scsi_add_host);
146 -+EXPORT_SYMBOL(scsi_add_host_with_dma);
147 -
148 - static void scsi_host_dev_release(struct device *dev)
149 - {
150 -diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
151 -index 562d8ce..f913f1e 100644
152 ---- a/drivers/scsi/lpfc/lpfc_init.c
153 -+++ b/drivers/scsi/lpfc/lpfc_init.c
154 -@@ -2408,7 +2408,7 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev)
155 - vport->els_tmofunc.function = lpfc_els_timeout;
156 - vport->els_tmofunc.data = (unsigned long)vport;
157 -
158 -- error = scsi_add_host(shost, dev);
159 -+ error = scsi_add_host_with_dma(shost, dev, &phba->pcidev->dev);
160 - if (error)
161 - goto out_put_shost;
162 -
163 -diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c
164 -index a39addc..507ccc6 100644
165 ---- a/drivers/scsi/megaraid/megaraid_sas.c
166 -+++ b/drivers/scsi/megaraid/megaraid_sas.c
167 -@@ -3032,7 +3032,7 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
168 - int error = 0, i;
169 - void *sense = NULL;
170 - dma_addr_t sense_handle;
171 -- u32 *sense_ptr;
172 -+ unsigned long *sense_ptr;
173 -
174 - memset(kbuff_arr, 0, sizeof(kbuff_arr));
175 -
176 -@@ -3109,7 +3109,7 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
177 - }
178 -
179 - sense_ptr =
180 -- (u32 *) ((unsigned long)cmd->frame + ioc->sense_off);
181 -+ (unsigned long *) ((unsigned long)cmd->frame + ioc->sense_off);
182 - *sense_ptr = sense_handle;
183 - }
184 -
185 -@@ -3140,8 +3140,8 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
186 - * sense_ptr points to the location that has the user
187 - * sense buffer address
188 - */
189 -- sense_ptr = (u32 *) ((unsigned long)ioc->frame.raw +
190 -- ioc->sense_off);
191 -+ sense_ptr = (unsigned long *) ((unsigned long)ioc->frame.raw +
192 -+ ioc->sense_off);
193 -
194 - if (copy_to_user((void __user *)((unsigned long)(*sense_ptr)),
195 - sense, ioc->sense_len)) {
196 -diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
197 -index fbcb82a..21e2bc4 100644
198 ---- a/drivers/scsi/qla2xxx/qla_attr.c
199 -+++ b/drivers/scsi/qla2xxx/qla_attr.c
200 -@@ -1654,7 +1654,8 @@ qla24xx_vport_create(struct fc_vport *fc_vport, bool disable)
201 - fc_vport_set_state(fc_vport, FC_VPORT_LINKDOWN);
202 - }
203 -
204 -- if (scsi_add_host(vha->host, &fc_vport->dev)) {
205 -+ if (scsi_add_host_with_dma(vha->host, &fc_vport->dev,
206 -+ &ha->pdev->dev)) {
207 - DEBUG15(printk("scsi(%ld): scsi_add_host failure for VP[%d].\n",
208 - vha->host_no, vha->vp_idx));
209 - goto vport_create_failed_2;
210 -diff --git a/drivers/scsi/scsi_lib_dma.c b/drivers/scsi/scsi_lib_dma.c
211 -index ac6855c..dcd1285 100644
212 ---- a/drivers/scsi/scsi_lib_dma.c
213 -+++ b/drivers/scsi/scsi_lib_dma.c
214 -@@ -23,7 +23,7 @@ int scsi_dma_map(struct scsi_cmnd *cmd)
215 - int nseg = 0;
216 -
217 - if (scsi_sg_count(cmd)) {
218 -- struct device *dev = cmd->device->host->shost_gendev.parent;
219 -+ struct device *dev = cmd->device->host->dma_dev;
220 -
221 - nseg = dma_map_sg(dev, scsi_sglist(cmd), scsi_sg_count(cmd),
222 - cmd->sc_data_direction);
223 -@@ -41,7 +41,7 @@ EXPORT_SYMBOL(scsi_dma_map);
224 - void scsi_dma_unmap(struct scsi_cmnd *cmd)
225 - {
226 - if (scsi_sg_count(cmd)) {
227 -- struct device *dev = cmd->device->host->shost_gendev.parent;
228 -+ struct device *dev = cmd->device->host->dma_dev;
229 -
230 - dma_unmap_sg(dev, scsi_sglist(cmd), scsi_sg_count(cmd),
231 - cmd->sc_data_direction);
232 -diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
233 -index 1d04189..f3032c9 100644
234 ---- a/fs/ext4/balloc.c
235 -+++ b/fs/ext4/balloc.c
236 -@@ -761,7 +761,13 @@ static unsigned long ext4_bg_num_gdb_meta(struct super_block *sb,
237 - static unsigned long ext4_bg_num_gdb_nometa(struct super_block *sb,
238 - ext4_group_t group)
239 - {
240 -- return ext4_bg_has_super(sb, group) ? EXT4_SB(sb)->s_gdb_count : 0;
241 -+ if (!ext4_bg_has_super(sb, group))
242 -+ return 0;
243 -+
244 -+ if (EXT4_HAS_INCOMPAT_FEATURE(sb,EXT4_FEATURE_INCOMPAT_META_BG))
245 -+ return le32_to_cpu(EXT4_SB(sb)->s_es->s_first_meta_bg);
246 -+ else
247 -+ return EXT4_SB(sb)->s_gdb_count;
248 - }
249 -
250 - /**
251 -diff --git a/fs/ext4/block_validity.c b/fs/ext4/block_validity.c
252 -index 50784ef..dc79b75 100644
253 ---- a/fs/ext4/block_validity.c
254 -+++ b/fs/ext4/block_validity.c
255 -@@ -160,7 +160,7 @@ int ext4_setup_system_zone(struct super_block *sb)
256 - if (ext4_bg_has_super(sb, i) &&
257 - ((i < 5) || ((i % flex_size) == 0)))
258 - add_system_zone(sbi, ext4_group_first_block_no(sb, i),
259 -- sbi->s_gdb_count + 1);
260 -+ ext4_bg_num_gdb(sb, i) + 1);
261 - gdp = ext4_get_group_desc(sb, i, NULL);
262 - ret = add_system_zone(sbi, ext4_block_bitmap(sb, gdp), 1);
263 - if (ret)
264 -diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
265 -index 8825515..bd2a9dd 100644
266 ---- a/fs/ext4/ext4.h
267 -+++ b/fs/ext4/ext4.h
268 -@@ -703,6 +703,13 @@ struct ext4_inode_info {
269 - struct list_head i_aio_dio_complete_list;
270 - /* current io_end structure for async DIO write*/
271 - ext4_io_end_t *cur_aio_dio;
272 -+
273 -+ /*
274 -+ * Transactions that contain inode's metadata needed to complete
275 -+ * fsync and fdatasync, respectively.
276 -+ */
277 -+ tid_t i_sync_tid;
278 -+ tid_t i_datasync_tid;
279 - };
280 -
281 - /*
282 -@@ -750,6 +757,7 @@ struct ext4_inode_info {
283 - #define EXT4_MOUNT_DELALLOC 0x8000000 /* Delalloc support */
284 - #define EXT4_MOUNT_DATA_ERR_ABORT 0x10000000 /* Abort on file data write */
285 - #define EXT4_MOUNT_BLOCK_VALIDITY 0x20000000 /* Block validity checking */
286 -+#define EXT4_MOUNT_DISCARD 0x40000000 /* Issue DISCARD requests */
287 -
288 - #define clear_opt(o, opt) o &= ~EXT4_MOUNT_##opt
289 - #define set_opt(o, opt) o |= EXT4_MOUNT_##opt
290 -diff --git a/fs/ext4/ext4_jbd2.h b/fs/ext4/ext4_jbd2.h
291 -index a286598..1892a77 100644
292 ---- a/fs/ext4/ext4_jbd2.h
293 -+++ b/fs/ext4/ext4_jbd2.h
294 -@@ -49,7 +49,7 @@
295 -
296 - #define EXT4_DATA_TRANS_BLOCKS(sb) (EXT4_SINGLEDATA_TRANS_BLOCKS(sb) + \
297 - EXT4_XATTR_TRANS_BLOCKS - 2 + \
298 -- 2*EXT4_QUOTA_TRANS_BLOCKS(sb))
299 -+ EXT4_MAXQUOTAS_TRANS_BLOCKS(sb))
300 -
301 - /*
302 - * Define the number of metadata blocks we need to account to modify data.
303 -@@ -57,7 +57,7 @@
304 - * This include super block, inode block, quota blocks and xattr blocks
305 - */
306 - #define EXT4_META_TRANS_BLOCKS(sb) (EXT4_XATTR_TRANS_BLOCKS + \
307 -- 2*EXT4_QUOTA_TRANS_BLOCKS(sb))
308 -+ EXT4_MAXQUOTAS_TRANS_BLOCKS(sb))
309 -
310 - /* Delete operations potentially hit one directory's namespace plus an
311 - * entire inode, plus arbitrary amounts of bitmap/indirection data. Be
312 -@@ -92,6 +92,7 @@
313 - * but inode, sb and group updates are done only once */
314 - #define EXT4_QUOTA_INIT_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_INIT_ALLOC*\
315 - (EXT4_SINGLEDATA_TRANS_BLOCKS(sb)-3)+3+DQUOT_INIT_REWRITE) : 0)
316 -+
317 - #define EXT4_QUOTA_DEL_BLOCKS(sb) (test_opt(sb, QUOTA) ? (DQUOT_DEL_ALLOC*\
318 - (EXT4_SINGLEDATA_TRANS_BLOCKS(sb)-3)+3+DQUOT_DEL_REWRITE) : 0)
319 - #else
320 -@@ -99,6 +100,9 @@
321 - #define EXT4_QUOTA_INIT_BLOCKS(sb) 0
322 - #define EXT4_QUOTA_DEL_BLOCKS(sb) 0
323 - #endif
324 -+#define EXT4_MAXQUOTAS_TRANS_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_TRANS_BLOCKS(sb))
325 -+#define EXT4_MAXQUOTAS_INIT_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_INIT_BLOCKS(sb))
326 -+#define EXT4_MAXQUOTAS_DEL_BLOCKS(sb) (MAXQUOTAS*EXT4_QUOTA_DEL_BLOCKS(sb))
327 -
328 - int
329 - ext4_mark_iloc_dirty(handle_t *handle,
330 -@@ -254,6 +258,19 @@ static inline int ext4_jbd2_file_inode(handle_t *handle, struct inode *inode)
331 - return 0;
332 - }
333 -
334 -+static inline void ext4_update_inode_fsync_trans(handle_t *handle,
335 -+ struct inode *inode,
336 -+ int datasync)
337 -+{
338 -+ struct ext4_inode_info *ei = EXT4_I(inode);
339 -+
340 -+ if (ext4_handle_valid(handle)) {
341 -+ ei->i_sync_tid = handle->h_transaction->t_tid;
342 -+ if (datasync)
343 -+ ei->i_datasync_tid = handle->h_transaction->t_tid;
344 -+ }
345 -+}
346 -+
347 - /* super.c */
348 - int ext4_force_commit(struct super_block *sb);
349 -
350 -diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
351 -index 715264b..8b8bae4 100644
352 ---- a/fs/ext4/extents.c
353 -+++ b/fs/ext4/extents.c
354 -@@ -1761,7 +1761,9 @@ int ext4_ext_walk_space(struct inode *inode, ext4_lblk_t block,
355 - while (block < last && block != EXT_MAX_BLOCK) {
356 - num = last - block;
357 - /* find extent for this block */
358 -+ down_read(&EXT4_I(inode)->i_data_sem);
359 - path = ext4_ext_find_extent(inode, block, path);
360 -+ up_read(&EXT4_I(inode)->i_data_sem);
361 - if (IS_ERR(path)) {
362 - err = PTR_ERR(path);
363 - path = NULL;
364 -@@ -2074,7 +2076,7 @@ static int ext4_remove_blocks(handle_t *handle, struct inode *inode,
365 - ext_debug("free last %u blocks starting %llu\n", num, start);
366 - for (i = 0; i < num; i++) {
367 - bh = sb_find_get_block(inode->i_sb, start + i);
368 -- ext4_forget(handle, 0, inode, bh, start + i);
369 -+ ext4_forget(handle, metadata, inode, bh, start + i);
370 - }
371 - ext4_free_blocks(handle, inode, start, num, metadata);
372 - } else if (from == le32_to_cpu(ex->ee_block)
373 -@@ -2167,7 +2169,7 @@ ext4_ext_rm_leaf(handle_t *handle, struct inode *inode,
374 - correct_index = 1;
375 - credits += (ext_depth(inode)) + 1;
376 - }
377 -- credits += 2 * EXT4_QUOTA_TRANS_BLOCKS(inode->i_sb);
378 -+ credits += EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb);
379 -
380 - err = ext4_ext_truncate_extend_restart(handle, inode, credits);
381 - if (err)
382 -@@ -3064,6 +3066,8 @@ ext4_ext_handle_uninitialized_extents(handle_t *handle, struct inode *inode,
383 - if (flags == EXT4_GET_BLOCKS_DIO_CONVERT_EXT) {
384 - ret = ext4_convert_unwritten_extents_dio(handle, inode,
385 - path);
386 -+ if (ret >= 0)
387 -+ ext4_update_inode_fsync_trans(handle, inode, 1);
388 - goto out2;
389 - }
390 - /* buffered IO case */
391 -@@ -3091,6 +3095,8 @@ ext4_ext_handle_uninitialized_extents(handle_t *handle, struct inode *inode,
392 - ret = ext4_ext_convert_to_initialized(handle, inode,
393 - path, iblock,
394 - max_blocks);
395 -+ if (ret >= 0)
396 -+ ext4_update_inode_fsync_trans(handle, inode, 1);
397 - out:
398 - if (ret <= 0) {
399 - err = ret;
400 -@@ -3329,10 +3335,16 @@ int ext4_ext_get_blocks(handle_t *handle, struct inode *inode,
401 - allocated = ext4_ext_get_actual_len(&newex);
402 - set_buffer_new(bh_result);
403 -
404 -- /* Cache only when it is _not_ an uninitialized extent */
405 -- if ((flags & EXT4_GET_BLOCKS_UNINIT_EXT) == 0)
406 -+ /*
407 -+ * Cache the extent and update transaction to commit on fdatasync only
408 -+ * when it is _not_ an uninitialized extent.
409 -+ */
410 -+ if ((flags & EXT4_GET_BLOCKS_UNINIT_EXT) == 0) {
411 - ext4_ext_put_in_cache(inode, iblock, allocated, newblock,
412 - EXT4_EXT_CACHE_EXTENT);
413 -+ ext4_update_inode_fsync_trans(handle, inode, 1);
414 -+ } else
415 -+ ext4_update_inode_fsync_trans(handle, inode, 0);
416 - out:
417 - if (allocated > max_blocks)
418 - allocated = max_blocks;
419 -@@ -3720,10 +3732,8 @@ int ext4_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
420 - * Walk the extent tree gathering extent information.
421 - * ext4_ext_fiemap_cb will push extents back to user.
422 - */
423 -- down_read(&EXT4_I(inode)->i_data_sem);
424 - error = ext4_ext_walk_space(inode, start_blk, len_blks,
425 - ext4_ext_fiemap_cb, fieinfo);
426 -- up_read(&EXT4_I(inode)->i_data_sem);
427 - }
428 -
429 - return error;
430 -diff --git a/fs/ext4/fsync.c b/fs/ext4/fsync.c
431 -index 2b15312..d6049e4 100644
432 ---- a/fs/ext4/fsync.c
433 -+++ b/fs/ext4/fsync.c
434 -@@ -51,25 +51,30 @@
435 - int ext4_sync_file(struct file *file, struct dentry *dentry, int datasync)
436 - {
437 - struct inode *inode = dentry->d_inode;
438 -+ struct ext4_inode_info *ei = EXT4_I(inode);
439 - journal_t *journal = EXT4_SB(inode->i_sb)->s_journal;
440 -- int err, ret = 0;
441 -+ int ret;
442 -+ tid_t commit_tid;
443 -
444 - J_ASSERT(ext4_journal_current_handle() == NULL);
445 -
446 - trace_ext4_sync_file(file, dentry, datasync);
447 -
448 -+ if (inode->i_sb->s_flags & MS_RDONLY)
449 -+ return 0;
450 -+
451 - ret = flush_aio_dio_completed_IO(inode);
452 - if (ret < 0)
453 -- goto out;
454 -+ return ret;
455 -+
456 -+ if (!journal)
457 -+ return simple_fsync(file, dentry, datasync);
458 -+
459 - /*
460 -- * data=writeback:
461 -+ * data=writeback,ordered:
462 - * The caller's filemap_fdatawrite()/wait will sync the data.
463 -- * sync_inode() will sync the metadata
464 -- *
465 -- * data=ordered:
466 -- * The caller's filemap_fdatawrite() will write the data and
467 -- * sync_inode() will write the inode if it is dirty. Then the caller's
468 -- * filemap_fdatawait() will wait on the pages.
469 -+ * Metadata is in the journal, we wait for proper transaction to
470 -+ * commit here.
471 - *
472 - * data=journal:
473 - * filemap_fdatawrite won't do anything (the buffers are clean).
474 -@@ -79,32 +84,13 @@ int ext4_sync_file(struct file *file, struct dentry *dentry, int datasync)
475 - * (they were dirtied by commit). But that's OK - the blocks are
476 - * safe in-journal, which is all fsync() needs to ensure.
477 - */
478 -- if (ext4_should_journal_data(inode)) {
479 -- ret = ext4_force_commit(inode->i_sb);
480 -- goto out;
481 -- }
482 -+ if (ext4_should_journal_data(inode))
483 -+ return ext4_force_commit(inode->i_sb);
484 -
485 -- if (!journal)
486 -- ret = sync_mapping_buffers(inode->i_mapping);
487 --
488 -- if (datasync && !(inode->i_state & I_DIRTY_DATASYNC))
489 -- goto out;
490 --
491 -- /*
492 -- * The VFS has written the file data. If the inode is unaltered
493 -- * then we need not start a commit.
494 -- */
495 -- if (inode->i_state & (I_DIRTY_SYNC|I_DIRTY_DATASYNC)) {
496 -- struct writeback_control wbc = {
497 -- .sync_mode = WB_SYNC_ALL,
498 -- .nr_to_write = 0, /* sys_fsync did this */
499 -- };
500 -- err = sync_inode(inode, &wbc);
501 -- if (ret == 0)
502 -- ret = err;
503 -- }
504 --out:
505 -- if (journal && (journal->j_flags & JBD2_BARRIER))
506 -+ commit_tid = datasync ? ei->i_datasync_tid : ei->i_sync_tid;
507 -+ if (jbd2_log_start_commit(journal, commit_tid))
508 -+ jbd2_log_wait_commit(journal, commit_tid);
509 -+ else if (journal->j_flags & JBD2_BARRIER)
510 - blkdev_issue_flush(inode->i_sb->s_bdev, NULL);
511 - return ret;
512 - }
513 -diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
514 -index 2c8caa5..1dae9a4 100644
515 ---- a/fs/ext4/inode.c
516 -+++ b/fs/ext4/inode.c
517 -@@ -1021,10 +1021,12 @@ static int ext4_ind_get_blocks(handle_t *handle, struct inode *inode,
518 - if (!err)
519 - err = ext4_splice_branch(handle, inode, iblock,
520 - partial, indirect_blks, count);
521 -- else
522 -+ if (err)
523 - goto cleanup;
524 -
525 - set_buffer_new(bh_result);
526 -+
527 -+ ext4_update_inode_fsync_trans(handle, inode, 1);
528 - got_it:
529 - map_bh(bh_result, inode->i_sb, le32_to_cpu(chain[depth-1].key));
530 - if (count > blocks_to_boundary)
531 -@@ -1052,7 +1054,7 @@ qsize_t ext4_get_reserved_space(struct inode *inode)
532 - EXT4_I(inode)->i_reserved_meta_blocks;
533 - spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
534 -
535 -- return total;
536 -+ return (total << inode->i_blkbits);
537 - }
538 - /*
539 - * Calculate the number of metadata blocks need to reserve
540 -@@ -1534,6 +1536,16 @@ static int do_journal_get_write_access(handle_t *handle,
541 - return ext4_journal_get_write_access(handle, bh);
542 - }
543 -
544 -+/*
545 -+ * Truncate blocks that were not used by write. We have to truncate the
546 -+ * pagecache as well so that corresponding buffers get properly unmapped.
547 -+ */
548 -+static void ext4_truncate_failed_write(struct inode *inode)
549 -+{
550 -+ truncate_inode_pages(inode->i_mapping, inode->i_size);
551 -+ ext4_truncate(inode);
552 -+}
553 -+
554 - static int ext4_write_begin(struct file *file, struct address_space *mapping,
555 - loff_t pos, unsigned len, unsigned flags,
556 - struct page **pagep, void **fsdata)
557 -@@ -1599,7 +1611,7 @@ retry:
558 -
559 - ext4_journal_stop(handle);
560 - if (pos + len > inode->i_size) {
561 -- ext4_truncate(inode);
562 -+ ext4_truncate_failed_write(inode);
563 - /*
564 - * If truncate failed early the inode might
565 - * still be on the orphan list; we need to
566 -@@ -1709,7 +1721,7 @@ static int ext4_ordered_write_end(struct file *file,
567 - ret = ret2;
568 -
569 - if (pos + len > inode->i_size) {
570 -- ext4_truncate(inode);
571 -+ ext4_truncate_failed_write(inode);
572 - /*
573 - * If truncate failed early the inode might still be
574 - * on the orphan list; we need to make sure the inode
575 -@@ -1751,7 +1763,7 @@ static int ext4_writeback_write_end(struct file *file,
576 - ret = ret2;
577 -
578 - if (pos + len > inode->i_size) {
579 -- ext4_truncate(inode);
580 -+ ext4_truncate_failed_write(inode);
581 - /*
582 - * If truncate failed early the inode might still be
583 - * on the orphan list; we need to make sure the inode
584 -@@ -1814,7 +1826,7 @@ static int ext4_journalled_write_end(struct file *file,
585 - if (!ret)
586 - ret = ret2;
587 - if (pos + len > inode->i_size) {
588 -- ext4_truncate(inode);
589 -+ ext4_truncate_failed_write(inode);
590 - /*
591 - * If truncate failed early the inode might still be
592 - * on the orphan list; we need to make sure the inode
593 -@@ -2788,7 +2800,7 @@ static int ext4_da_writepages_trans_blocks(struct inode *inode)
594 - * number of contiguous block. So we will limit
595 - * number of contiguous block to a sane value
596 - */
597 -- if (!(inode->i_flags & EXT4_EXTENTS_FL) &&
598 -+ if (!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL) &&
599 - (max_blocks > EXT4_MAX_TRANS_DATA))
600 - max_blocks = EXT4_MAX_TRANS_DATA;
601 -
602 -@@ -3091,7 +3103,7 @@ retry:
603 - * i_size_read because we hold i_mutex.
604 - */
605 - if (pos + len > inode->i_size)
606 -- ext4_truncate(inode);
607 -+ ext4_truncate_failed_write(inode);
608 - }
609 -
610 - if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
611 -@@ -4120,6 +4132,8 @@ static void ext4_clear_blocks(handle_t *handle, struct inode *inode,
612 - __le32 *last)
613 - {
614 - __le32 *p;
615 -+ int is_metadata = S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode);
616 -+
617 - if (try_to_extend_transaction(handle, inode)) {
618 - if (bh) {
619 - BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata");
620 -@@ -4150,11 +4164,11 @@ static void ext4_clear_blocks(handle_t *handle, struct inode *inode,
621 -
622 - *p = 0;
623 - tbh = sb_find_get_block(inode->i_sb, nr);
624 -- ext4_forget(handle, 0, inode, tbh, nr);
625 -+ ext4_forget(handle, is_metadata, inode, tbh, nr);
626 - }
627 - }
628 -
629 -- ext4_free_blocks(handle, inode, block_to_free, count, 0);
630 -+ ext4_free_blocks(handle, inode, block_to_free, count, is_metadata);
631 - }
632 -
633 - /**
634 -@@ -4781,8 +4795,8 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
635 - struct ext4_iloc iloc;
636 - struct ext4_inode *raw_inode;
637 - struct ext4_inode_info *ei;
638 -- struct buffer_head *bh;
639 - struct inode *inode;
640 -+ journal_t *journal = EXT4_SB(sb)->s_journal;
641 - long ret;
642 - int block;
643 -
644 -@@ -4793,11 +4807,11 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
645 - return inode;
646 -
647 - ei = EXT4_I(inode);
648 -+ iloc.bh = 0;
649 -
650 - ret = __ext4_get_inode_loc(inode, &iloc, 0);
651 - if (ret < 0)
652 - goto bad_inode;
653 -- bh = iloc.bh;
654 - raw_inode = ext4_raw_inode(&iloc);
655 - inode->i_mode = le16_to_cpu(raw_inode->i_mode);
656 - inode->i_uid = (uid_t)le16_to_cpu(raw_inode->i_uid_low);
657 -@@ -4820,7 +4834,6 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
658 - if (inode->i_mode == 0 ||
659 - !(EXT4_SB(inode->i_sb)->s_mount_state & EXT4_ORPHAN_FS)) {
660 - /* this inode is deleted */
661 -- brelse(bh);
662 - ret = -ESTALE;
663 - goto bad_inode;
664 - }
665 -@@ -4848,11 +4861,35 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
666 - ei->i_data[block] = raw_inode->i_block[block];
667 - INIT_LIST_HEAD(&ei->i_orphan);
668 -
669 -+ /*
670 -+ * Set transaction id's of transactions that have to be committed
671 -+ * to finish f[data]sync. We set them to currently running transaction
672 -+ * as we cannot be sure that the inode or some of its metadata isn't
673 -+ * part of the transaction - the inode could have been reclaimed and
674 -+ * now it is reread from disk.
675 -+ */
676 -+ if (journal) {
677 -+ transaction_t *transaction;
678 -+ tid_t tid;
679 -+
680 -+ spin_lock(&journal->j_state_lock);
681 -+ if (journal->j_running_transaction)
682 -+ transaction = journal->j_running_transaction;
683 -+ else
684 -+ transaction = journal->j_committing_transaction;
685 -+ if (transaction)
686 -+ tid = transaction->t_tid;
687 -+ else
688 -+ tid = journal->j_commit_sequence;
689 -+ spin_unlock(&journal->j_state_lock);
690 -+ ei->i_sync_tid = tid;
691 -+ ei->i_datasync_tid = tid;
692 -+ }
693 -+
694 - if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE) {
695 - ei->i_extra_isize = le16_to_cpu(raw_inode->i_extra_isize);
696 - if (EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize >
697 - EXT4_INODE_SIZE(inode->i_sb)) {
698 -- brelse(bh);
699 - ret = -EIO;
700 - goto bad_inode;
701 - }
702 -@@ -4884,10 +4921,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
703 -
704 - ret = 0;
705 - if (ei->i_file_acl &&
706 -- ((ei->i_file_acl <
707 -- (le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block) +
708 -- EXT4_SB(sb)->s_gdb_count)) ||
709 -- (ei->i_file_acl >= ext4_blocks_count(EXT4_SB(sb)->s_es)))) {
710 -+ !ext4_data_block_valid(EXT4_SB(sb), ei->i_file_acl, 1)) {
711 - ext4_error(sb, __func__,
712 - "bad extended attribute block %llu in inode #%lu",
713 - ei->i_file_acl, inode->i_ino);
714 -@@ -4905,10 +4939,8 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
715 - /* Validate block references which are part of inode */
716 - ret = ext4_check_inode_blockref(inode);
717 - }
718 -- if (ret) {
719 -- brelse(bh);
720 -+ if (ret)
721 - goto bad_inode;
722 -- }
723 -
724 - if (S_ISREG(inode->i_mode)) {
725 - inode->i_op = &ext4_file_inode_operations;
726 -@@ -4936,7 +4968,6 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
727 - init_special_inode(inode, inode->i_mode,
728 - new_decode_dev(le32_to_cpu(raw_inode->i_block[1])));
729 - } else {
730 -- brelse(bh);
731 - ret = -EIO;
732 - ext4_error(inode->i_sb, __func__,
733 - "bogus i_mode (%o) for inode=%lu",
734 -@@ -4949,6 +4980,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
735 - return inode;
736 -
737 - bad_inode:
738 -+ brelse(iloc.bh);
739 - iget_failed(inode);
740 - return ERR_PTR(ret);
741 - }
742 -@@ -5108,6 +5140,7 @@ static int ext4_do_update_inode(handle_t *handle,
743 - err = rc;
744 - ei->i_state &= ~EXT4_STATE_NEW;
745 -
746 -+ ext4_update_inode_fsync_trans(handle, inode, 0);
747 - out_brelse:
748 - brelse(bh);
749 - ext4_std_error(inode->i_sb, err);
750 -@@ -5227,8 +5260,8 @@ int ext4_setattr(struct dentry *dentry, struct iattr *attr)
751 -
752 - /* (user+group)*(old+new) structure, inode write (sb,
753 - * inode block, ? - but truncate inode update has it) */
754 -- handle = ext4_journal_start(inode, 2*(EXT4_QUOTA_INIT_BLOCKS(inode->i_sb)+
755 -- EXT4_QUOTA_DEL_BLOCKS(inode->i_sb))+3);
756 -+ handle = ext4_journal_start(inode, (EXT4_MAXQUOTAS_INIT_BLOCKS(inode->i_sb)+
757 -+ EXT4_MAXQUOTAS_DEL_BLOCKS(inode->i_sb))+3);
758 - if (IS_ERR(handle)) {
759 - error = PTR_ERR(handle);
760 - goto err_out;
761 -diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
762 -index c1cdf61..b63d193 100644
763 ---- a/fs/ext4/ioctl.c
764 -+++ b/fs/ext4/ioctl.c
765 -@@ -221,31 +221,38 @@ setversion_out:
766 - struct file *donor_filp;
767 - int err;
768 -
769 -+ if (!(filp->f_mode & FMODE_READ) ||
770 -+ !(filp->f_mode & FMODE_WRITE))
771 -+ return -EBADF;
772 -+
773 - if (copy_from_user(&me,
774 - (struct move_extent __user *)arg, sizeof(me)))
775 - return -EFAULT;
776 -+ me.moved_len = 0;
777 -
778 - donor_filp = fget(me.donor_fd);
779 - if (!donor_filp)
780 - return -EBADF;
781 -
782 -- if (!capable(CAP_DAC_OVERRIDE)) {
783 -- if ((current->real_cred->fsuid != inode->i_uid) ||
784 -- !(inode->i_mode & S_IRUSR) ||
785 -- !(donor_filp->f_dentry->d_inode->i_mode &
786 -- S_IRUSR)) {
787 -- fput(donor_filp);
788 -- return -EACCES;
789 -- }
790 -+ if (!(donor_filp->f_mode & FMODE_WRITE)) {
791 -+ err = -EBADF;
792 -+ goto mext_out;
793 - }
794 -
795 -+ err = mnt_want_write(filp->f_path.mnt);
796 -+ if (err)
797 -+ goto mext_out;
798 -+
799 - err = ext4_move_extents(filp, donor_filp, me.orig_start,
800 - me.donor_start, me.len, &me.moved_len);
801 -- fput(donor_filp);
802 -+ mnt_drop_write(filp->f_path.mnt);
803 -+ if (me.moved_len > 0)
804 -+ file_remove_suid(donor_filp);
805 -
806 - if (copy_to_user((struct move_extent *)arg, &me, sizeof(me)))
807 -- return -EFAULT;
808 --
809 -+ err = -EFAULT;
810 -+mext_out:
811 -+ fput(donor_filp);
812 - return err;
813 - }
814 -
815 -diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
816 -index bba1282..7d71148 100644
817 ---- a/fs/ext4/mballoc.c
818 -+++ b/fs/ext4/mballoc.c
819 -@@ -2529,7 +2529,6 @@ static void release_blocks_on_commit(journal_t *journal, transaction_t *txn)
820 - struct ext4_group_info *db;
821 - int err, count = 0, count2 = 0;
822 - struct ext4_free_data *entry;
823 -- ext4_fsblk_t discard_block;
824 - struct list_head *l, *ltmp;
825 -
826 - list_for_each_safe(l, ltmp, &txn->t_private_list) {
827 -@@ -2559,13 +2558,19 @@ static void release_blocks_on_commit(journal_t *journal, transaction_t *txn)
828 - page_cache_release(e4b.bd_bitmap_page);
829 - }
830 - ext4_unlock_group(sb, entry->group);
831 -- discard_block = (ext4_fsblk_t) entry->group * EXT4_BLOCKS_PER_GROUP(sb)
832 -- + entry->start_blk
833 -- + le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block);
834 -- trace_ext4_discard_blocks(sb, (unsigned long long)discard_block,
835 -- entry->count);
836 -- sb_issue_discard(sb, discard_block, entry->count);
837 --
838 -+ if (test_opt(sb, DISCARD)) {
839 -+ ext4_fsblk_t discard_block;
840 -+ struct ext4_super_block *es = EXT4_SB(sb)->s_es;
841 -+
842 -+ discard_block = (ext4_fsblk_t)entry->group *
843 -+ EXT4_BLOCKS_PER_GROUP(sb)
844 -+ + entry->start_blk
845 -+ + le32_to_cpu(es->s_first_data_block);
846 -+ trace_ext4_discard_blocks(sb,
847 -+ (unsigned long long)discard_block,
848 -+ entry->count);
849 -+ sb_issue_discard(sb, discard_block, entry->count);
850 -+ }
851 - kmem_cache_free(ext4_free_ext_cachep, entry);
852 - ext4_mb_release_desc(&e4b);
853 - }
854 -@@ -3006,6 +3011,24 @@ static void ext4_mb_collect_stats(struct ext4_allocation_context *ac)
855 - }
856 -
857 - /*
858 -+ * Called on failure; free up any blocks from the inode PA for this
859 -+ * context. We don't need this for MB_GROUP_PA because we only change
860 -+ * pa_free in ext4_mb_release_context(), but on failure, we've already
861 -+ * zeroed out ac->ac_b_ex.fe_len, so group_pa->pa_free is not changed.
862 -+ */
863 -+static void ext4_discard_allocated_blocks(struct ext4_allocation_context *ac)
864 -+{
865 -+ struct ext4_prealloc_space *pa = ac->ac_pa;
866 -+ int len;
867 -+
868 -+ if (pa && pa->pa_type == MB_INODE_PA) {
869 -+ len = ac->ac_b_ex.fe_len;
870 -+ pa->pa_free += len;
871 -+ }
872 -+
873 -+}
874 -+
875 -+/*
876 - * use blocks preallocated to inode
877 - */
878 - static void ext4_mb_use_inode_pa(struct ext4_allocation_context *ac,
879 -@@ -4290,6 +4313,7 @@ repeat:
880 - ac->ac_status = AC_STATUS_CONTINUE;
881 - goto repeat;
882 - } else if (*errp) {
883 -+ ext4_discard_allocated_blocks(ac);
884 - ac->ac_b_ex.fe_len = 0;
885 - ar->len = 0;
886 - ext4_mb_show_ac(ac);
887 -diff --git a/fs/ext4/migrate.c b/fs/ext4/migrate.c
888 -index a93d5b8..8646149 100644
889 ---- a/fs/ext4/migrate.c
890 -+++ b/fs/ext4/migrate.c
891 -@@ -238,7 +238,7 @@ static int extend_credit_for_blkdel(handle_t *handle, struct inode *inode)
892 - * So allocate a credit of 3. We may update
893 - * quota (user and group).
894 - */
895 -- needed = 3 + 2*EXT4_QUOTA_TRANS_BLOCKS(inode->i_sb);
896 -+ needed = 3 + EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb);
897 -
898 - if (ext4_journal_extend(handle, needed) != 0)
899 - retval = ext4_journal_restart(handle, needed);
900 -@@ -477,7 +477,7 @@ int ext4_ext_migrate(struct inode *inode)
901 - handle = ext4_journal_start(inode,
902 - EXT4_DATA_TRANS_BLOCKS(inode->i_sb) +
903 - EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3 +
904 -- 2 * EXT4_QUOTA_INIT_BLOCKS(inode->i_sb)
905 -+ EXT4_MAXQUOTAS_INIT_BLOCKS(inode->i_sb)
906 - + 1);
907 - if (IS_ERR(handle)) {
908 - retval = PTR_ERR(handle);
909 -diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c
910 -index 25b6b14..f5b03a1 100644
911 ---- a/fs/ext4/move_extent.c
912 -+++ b/fs/ext4/move_extent.c
913 -@@ -77,12 +77,14 @@ static int
914 - mext_next_extent(struct inode *inode, struct ext4_ext_path *path,
915 - struct ext4_extent **extent)
916 - {
917 -+ struct ext4_extent_header *eh;
918 - int ppos, leaf_ppos = path->p_depth;
919 -
920 - ppos = leaf_ppos;
921 - if (EXT_LAST_EXTENT(path[ppos].p_hdr) > path[ppos].p_ext) {
922 - /* leaf block */
923 - *extent = ++path[ppos].p_ext;
924 -+ path[ppos].p_block = ext_pblock(path[ppos].p_ext);
925 - return 0;
926 - }
927 -
928 -@@ -119,9 +121,18 @@ mext_next_extent(struct inode *inode, struct ext4_ext_path *path,
929 - ext_block_hdr(path[cur_ppos+1].p_bh);
930 - }
931 -
932 -+ path[leaf_ppos].p_ext = *extent = NULL;
933 -+
934 -+ eh = path[leaf_ppos].p_hdr;
935 -+ if (le16_to_cpu(eh->eh_entries) == 0)
936 -+ /* empty leaf is found */
937 -+ return -ENODATA;
938 -+
939 - /* leaf block */
940 - path[leaf_ppos].p_ext = *extent =
941 - EXT_FIRST_EXTENT(path[leaf_ppos].p_hdr);
942 -+ path[leaf_ppos].p_block =
943 -+ ext_pblock(path[leaf_ppos].p_ext);
944 - return 0;
945 - }
946 - }
947 -@@ -155,40 +166,15 @@ mext_check_null_inode(struct inode *inode1, struct inode *inode2,
948 - }
949 -
950 - /**
951 -- * mext_double_down_read - Acquire two inodes' read semaphore
952 -- *
953 -- * @orig_inode: original inode structure
954 -- * @donor_inode: donor inode structure
955 -- * Acquire read semaphore of the two inodes (orig and donor) by i_ino order.
956 -- */
957 --static void
958 --mext_double_down_read(struct inode *orig_inode, struct inode *donor_inode)
959 --{
960 -- struct inode *first = orig_inode, *second = donor_inode;
961 --
962 -- /*
963 -- * Use the inode number to provide the stable locking order instead
964 -- * of its address, because the C language doesn't guarantee you can
965 -- * compare pointers that don't come from the same array.
966 -- */
967 -- if (donor_inode->i_ino < orig_inode->i_ino) {
968 -- first = donor_inode;
969 -- second = orig_inode;
970 -- }
971 --
972 -- down_read(&EXT4_I(first)->i_data_sem);
973 -- down_read(&EXT4_I(second)->i_data_sem);
974 --}
975 --
976 --/**
977 -- * mext_double_down_write - Acquire two inodes' write semaphore
978 -+ * double_down_write_data_sem - Acquire two inodes' write lock of i_data_sem
979 - *
980 - * @orig_inode: original inode structure
981 - * @donor_inode: donor inode structure
982 -- * Acquire write semaphore of the two inodes (orig and donor) by i_ino order.
983 -+ * Acquire write lock of i_data_sem of the two inodes (orig and donor) by
984 -+ * i_ino order.
985 - */
986 - static void
987 --mext_double_down_write(struct inode *orig_inode, struct inode *donor_inode)
988 -+double_down_write_data_sem(struct inode *orig_inode, struct inode *donor_inode)
989 - {
990 - struct inode *first = orig_inode, *second = donor_inode;
991 -
992 -@@ -203,32 +189,18 @@ mext_double_down_write(struct inode *orig_inode, struct inode *donor_inode)
993 - }
994 -
995 - down_write(&EXT4_I(first)->i_data_sem);
996 -- down_write(&EXT4_I(second)->i_data_sem);
997 -+ down_write_nested(&EXT4_I(second)->i_data_sem, SINGLE_DEPTH_NESTING);
998 - }
999 -
1000 - /**
1001 -- * mext_double_up_read - Release two inodes' read semaphore
1002 -+ * double_up_write_data_sem - Release two inodes' write lock of i_data_sem
1003 - *
1004 - * @orig_inode: original inode structure to be released its lock first
1005 - * @donor_inode: donor inode structure to be released its lock second
1006 -- * Release read semaphore of two inodes (orig and donor).
1007 -+ * Release write lock of i_data_sem of two inodes (orig and donor).
1008 - */
1009 - static void
1010 --mext_double_up_read(struct inode *orig_inode, struct inode *donor_inode)
1011 --{
1012 -- up_read(&EXT4_I(orig_inode)->i_data_sem);
1013 -- up_read(&EXT4_I(donor_inode)->i_data_sem);
1014 --}
1015 --
1016 --/**
1017 -- * mext_double_up_write - Release two inodes' write semaphore
1018 -- *
1019 -- * @orig_inode: original inode structure to be released its lock first
1020 -- * @donor_inode: donor inode structure to be released its lock second
1021 -- * Release write semaphore of two inodes (orig and donor).
1022 -- */
1023 --static void
1024 --mext_double_up_write(struct inode *orig_inode, struct inode *donor_inode)
1025 -+double_up_write_data_sem(struct inode *orig_inode, struct inode *donor_inode)
1026 - {
1027 - up_write(&EXT4_I(orig_inode)->i_data_sem);
1028 - up_write(&EXT4_I(donor_inode)->i_data_sem);
1029 -@@ -661,6 +633,7 @@ mext_calc_swap_extents(struct ext4_extent *tmp_dext,
1030 - * @donor_inode: donor inode
1031 - * @from: block offset of orig_inode
1032 - * @count: block count to be replaced
1033 -+ * @err: pointer to save return value
1034 - *
1035 - * Replace original inode extents and donor inode extents page by page.
1036 - * We implement this replacement in the following three steps:
1037 -@@ -671,33 +644,33 @@ mext_calc_swap_extents(struct ext4_extent *tmp_dext,
1038 - * 3. Change the block information of donor inode to point at the saved
1039 - * original inode blocks in the dummy extents.
1040 - *
1041 -- * Return 0 on success, or a negative error value on failure.
1042 -+ * Return replaced block count.
1043 - */
1044 - static int
1045 - mext_replace_branches(handle_t *handle, struct inode *orig_inode,
1046 - struct inode *donor_inode, ext4_lblk_t from,
1047 -- ext4_lblk_t count)
1048 -+ ext4_lblk_t count, int *err)
1049 - {
1050 - struct ext4_ext_path *orig_path = NULL;
1051 - struct ext4_ext_path *donor_path = NULL;
1052 - struct ext4_extent *oext, *dext;
1053 - struct ext4_extent tmp_dext, tmp_oext;
1054 - ext4_lblk_t orig_off = from, donor_off = from;
1055 -- int err = 0;
1056 - int depth;
1057 - int replaced_count = 0;
1058 - int dext_alen;
1059 -
1060 -- mext_double_down_write(orig_inode, donor_inode);
1061 -+ /* Protect extent trees against block allocations via delalloc */
1062 -+ double_down_write_data_sem(orig_inode, donor_inode);
1063 -
1064 - /* Get the original extent for the block "orig_off" */
1065 -- err = get_ext_path(orig_inode, orig_off, &orig_path);
1066 -- if (err)
1067 -+ *err = get_ext_path(orig_inode, orig_off, &orig_path);
1068 -+ if (*err)
1069 - goto out;
1070 -
1071 - /* Get the donor extent for the head */
1072 -- err = get_ext_path(donor_inode, donor_off, &donor_path);
1073 -- if (err)
1074 -+ *err = get_ext_path(donor_inode, donor_off, &donor_path);
1075 -+ if (*err)
1076 - goto out;
1077 - depth = ext_depth(orig_inode);
1078 - oext = orig_path[depth].p_ext;
1079 -@@ -707,9 +680,9 @@ mext_replace_branches(handle_t *handle, struct inode *orig_inode,
1080 - dext = donor_path[depth].p_ext;
1081 - tmp_dext = *dext;
1082 -
1083 -- err = mext_calc_swap_extents(&tmp_dext, &tmp_oext, orig_off,
1084 -+ *err = mext_calc_swap_extents(&tmp_dext, &tmp_oext, orig_off,
1085 - donor_off, count);
1086 -- if (err)
1087 -+ if (*err)
1088 - goto out;
1089 -
1090 - /* Loop for the donor extents */
1091 -@@ -718,7 +691,7 @@ mext_replace_branches(handle_t *handle, struct inode *orig_inode,
1092 - if (!dext) {
1093 - ext4_error(donor_inode->i_sb, __func__,
1094 - "The extent for donor must be found");
1095 -- err = -EIO;
1096 -+ *err = -EIO;
1097 - goto out;
1098 - } else if (donor_off != le32_to_cpu(tmp_dext.ee_block)) {
1099 - ext4_error(donor_inode->i_sb, __func__,
1100 -@@ -726,20 +699,20 @@ mext_replace_branches(handle_t *handle, struct inode *orig_inode,
1101 - "extent(%u) should be equal",
1102 - donor_off,
1103 - le32_to_cpu(tmp_dext.ee_block));
1104 -- err = -EIO;
1105 -+ *err = -EIO;
1106 - goto out;
1107 - }
1108 -
1109 - /* Set donor extent to orig extent */
1110 -- err = mext_leaf_block(handle, orig_inode,
1111 -+ *err = mext_leaf_block(handle, orig_inode,
1112 - orig_path, &tmp_dext, &orig_off);
1113 -- if (err < 0)
1114 -+ if (*err)
1115 - goto out;
1116 -
1117 - /* Set orig extent to donor extent */
1118 -- err = mext_leaf_block(handle, donor_inode,
1119 -+ *err = mext_leaf_block(handle, donor_inode,
1120 - donor_path, &tmp_oext, &donor_off);
1121 -- if (err < 0)
1122 -+ if (*err)
1123 - goto out;
1124 -
1125 - dext_alen = ext4_ext_get_actual_len(&tmp_dext);
1126 -@@ -753,35 +726,25 @@ mext_replace_branches(handle_t *handle, struct inode *orig_inode,
1127 -
1128 - if (orig_path)
1129 - ext4_ext_drop_refs(orig_path);
1130 -- err = get_ext_path(orig_inode, orig_off, &orig_path);
1131 -- if (err)
1132 -+ *err = get_ext_path(orig_inode, orig_off, &orig_path);
1133 -+ if (*err)
1134 - goto out;
1135 - depth = ext_depth(orig_inode);
1136 - oext = orig_path[depth].p_ext;
1137 -- if (le32_to_cpu(oext->ee_block) +
1138 -- ext4_ext_get_actual_len(oext) <= orig_off) {
1139 -- err = 0;
1140 -- goto out;
1141 -- }
1142 - tmp_oext = *oext;
1143 -
1144 - if (donor_path)
1145 - ext4_ext_drop_refs(donor_path);
1146 -- err = get_ext_path(donor_inode, donor_off, &donor_path);
1147 -- if (err)
1148 -+ *err = get_ext_path(donor_inode, donor_off, &donor_path);
1149 -+ if (*err)
1150 - goto out;
1151 - depth = ext_depth(donor_inode);
1152 - dext = donor_path[depth].p_ext;
1153 -- if (le32_to_cpu(dext->ee_block) +
1154 -- ext4_ext_get_actual_len(dext) <= donor_off) {
1155 -- err = 0;
1156 -- goto out;
1157 -- }
1158 - tmp_dext = *dext;
1159 -
1160 -- err = mext_calc_swap_extents(&tmp_dext, &tmp_oext, orig_off,
1161 -+ *err = mext_calc_swap_extents(&tmp_dext, &tmp_oext, orig_off,
1162 - donor_off, count - replaced_count);
1163 -- if (err)
1164 -+ if (*err)
1165 - goto out;
1166 - }
1167 -
1168 -@@ -795,8 +758,12 @@ out:
1169 - kfree(donor_path);
1170 - }
1171 -
1172 -- mext_double_up_write(orig_inode, donor_inode);
1173 -- return err;
1174 -+ ext4_ext_invalidate_cache(orig_inode);
1175 -+ ext4_ext_invalidate_cache(donor_inode);
1176 -+
1177 -+ double_up_write_data_sem(orig_inode, donor_inode);
1178 -+
1179 -+ return replaced_count;
1180 - }
1181 -
1182 - /**
1183 -@@ -808,16 +775,17 @@ out:
1184 - * @data_offset_in_page: block index where data swapping starts
1185 - * @block_len_in_page: the number of blocks to be swapped
1186 - * @uninit: orig extent is uninitialized or not
1187 -+ * @err: pointer to save return value
1188 - *
1189 - * Save the data in original inode blocks and replace original inode extents
1190 - * with donor inode extents by calling mext_replace_branches().
1191 -- * Finally, write out the saved data in new original inode blocks. Return 0
1192 -- * on success, or a negative error value on failure.
1193 -+ * Finally, write out the saved data in new original inode blocks. Return
1194 -+ * replaced block count.
1195 - */
1196 - static int
1197 - move_extent_per_page(struct file *o_filp, struct inode *donor_inode,
1198 - pgoff_t orig_page_offset, int data_offset_in_page,
1199 -- int block_len_in_page, int uninit)
1200 -+ int block_len_in_page, int uninit, int *err)
1201 - {
1202 - struct inode *orig_inode = o_filp->f_dentry->d_inode;
1203 - struct address_space *mapping = orig_inode->i_mapping;
1204 -@@ -829,9 +797,11 @@ move_extent_per_page(struct file *o_filp, struct inode *donor_inode,
1205 - long long offs = orig_page_offset << PAGE_CACHE_SHIFT;
1206 - unsigned long blocksize = orig_inode->i_sb->s_blocksize;
1207 - unsigned int w_flags = 0;
1208 -- unsigned int tmp_data_len, data_len;
1209 -+ unsigned int tmp_data_size, data_size, replaced_size;
1210 - void *fsdata;
1211 -- int ret, i, jblocks;
1212 -+ int i, jblocks;
1213 -+ int err2 = 0;
1214 -+ int replaced_count = 0;
1215 - int blocks_per_page = PAGE_CACHE_SIZE >> orig_inode->i_blkbits;
1216 -
1217 - /*
1218 -@@ -841,8 +811,8 @@ move_extent_per_page(struct file *o_filp, struct inode *donor_inode,
1219 - jblocks = ext4_writepage_trans_blocks(orig_inode) * 2;
1220 - handle = ext4_journal_start(orig_inode, jblocks);
1221 - if (IS_ERR(handle)) {
1222 -- ret = PTR_ERR(handle);
1223 -- return ret;
1224 -+ *err = PTR_ERR(handle);
1225 -+ return 0;
1226 - }
1227 -
1228 - if (segment_eq(get_fs(), KERNEL_DS))
1229 -@@ -858,39 +828,36 @@ move_extent_per_page(struct file *o_filp, struct inode *donor_inode,
1230 - * Just swap data blocks between orig and donor.
1231 - */
1232 - if (uninit) {
1233 -- ret = mext_replace_branches(handle, orig_inode,
1234 -- donor_inode, orig_blk_offset,
1235 -- block_len_in_page);
1236 --
1237 -- /* Clear the inode cache not to refer to the old data */
1238 -- ext4_ext_invalidate_cache(orig_inode);
1239 -- ext4_ext_invalidate_cache(donor_inode);
1240 -+ replaced_count = mext_replace_branches(handle, orig_inode,
1241 -+ donor_inode, orig_blk_offset,
1242 -+ block_len_in_page, err);
1243 - goto out2;
1244 - }
1245 -
1246 - offs = (long long)orig_blk_offset << orig_inode->i_blkbits;
1247 -
1248 -- /* Calculate data_len */
1249 -+ /* Calculate data_size */
1250 - if ((orig_blk_offset + block_len_in_page - 1) ==
1251 - ((orig_inode->i_size - 1) >> orig_inode->i_blkbits)) {
1252 - /* Replace the last block */
1253 -- tmp_data_len = orig_inode->i_size & (blocksize - 1);
1254 -+ tmp_data_size = orig_inode->i_size & (blocksize - 1);
1255 - /*
1256 -- * If data_len equal zero, it shows data_len is multiples of
1257 -+ * If data_size equal zero, it shows data_size is multiples of
1258 - * blocksize. So we set appropriate value.
1259 - */
1260 -- if (tmp_data_len == 0)
1261 -- tmp_data_len = blocksize;
1262 -+ if (tmp_data_size == 0)
1263 -+ tmp_data_size = blocksize;
1264 -
1265 -- data_len = tmp_data_len +
1266 -+ data_size = tmp_data_size +
1267 - ((block_len_in_page - 1) << orig_inode->i_blkbits);
1268 -- } else {
1269 -- data_len = block_len_in_page << orig_inode->i_blkbits;
1270 -- }
1271 -+ } else
1272 -+ data_size = block_len_in_page << orig_inode->i_blkbits;
1273 -+
1274 -+ replaced_size = data_size;
1275 -
1276 -- ret = a_ops->write_begin(o_filp, mapping, offs, data_len, w_flags,
1277 -+ *err = a_ops->write_begin(o_filp, mapping, offs, data_size, w_flags,
1278 - &page, &fsdata);
1279 -- if (unlikely(ret < 0))
1280 -+ if (unlikely(*err < 0))
1281 - goto out;
1282 -
1283 - if (!PageUptodate(page)) {
1284 -@@ -911,14 +878,17 @@ move_extent_per_page(struct file *o_filp, struct inode *donor_inode,
1285 - /* Release old bh and drop refs */
1286 - try_to_release_page(page, 0);
1287 -
1288 -- ret = mext_replace_branches(handle, orig_inode, donor_inode,
1289 -- orig_blk_offset, block_len_in_page);
1290 -- if (ret < 0)
1291 -- goto out;
1292 --
1293 -- /* Clear the inode cache not to refer to the old data */
1294 -- ext4_ext_invalidate_cache(orig_inode);
1295 -- ext4_ext_invalidate_cache(donor_inode);
1296 -+ replaced_count = mext_replace_branches(handle, orig_inode, donor_inode,
1297 -+ orig_blk_offset, block_len_in_page,
1298 -+ &err2);
1299 -+ if (err2) {
1300 -+ if (replaced_count) {
1301 -+ block_len_in_page = replaced_count;
1302 -+ replaced_size =
1303 -+ block_len_in_page << orig_inode->i_blkbits;
1304 -+ } else
1305 -+ goto out;
1306 -+ }
1307 -
1308 - if (!page_has_buffers(page))
1309 - create_empty_buffers(page, 1 << orig_inode->i_blkbits, 0);
1310 -@@ -928,16 +898,16 @@ move_extent_per_page(struct file *o_filp, struct inode *donor_inode,
1311 - bh = bh->b_this_page;
1312 -
1313 - for (i = 0; i < block_len_in_page; i++) {
1314 -- ret = ext4_get_block(orig_inode,
1315 -+ *err = ext4_get_block(orig_inode,
1316 - (sector_t)(orig_blk_offset + i), bh, 0);
1317 -- if (ret < 0)
1318 -+ if (*err < 0)
1319 - goto out;
1320 -
1321 - if (bh->b_this_page != NULL)
1322 - bh = bh->b_this_page;
1323 - }
1324 -
1325 -- ret = a_ops->write_end(o_filp, mapping, offs, data_len, data_len,
1326 -+ *err = a_ops->write_end(o_filp, mapping, offs, data_size, replaced_size,
1327 - page, fsdata);
1328 - page = NULL;
1329 -
1330 -@@ -951,7 +921,10 @@ out:
1331 - out2:
1332 - ext4_journal_stop(handle);
1333 -
1334 -- return ret < 0 ? ret : 0;
1335 -+ if (err2)
1336 -+ *err = err2;
1337 -+
1338 -+ return replaced_count;
1339 - }
1340 -
1341 - /**
1342 -@@ -962,7 +935,6 @@ out2:
1343 - * @orig_start: logical start offset in block for orig
1344 - * @donor_start: logical start offset in block for donor
1345 - * @len: the number of blocks to be moved
1346 -- * @moved_len: moved block length
1347 - *
1348 - * Check the arguments of ext4_move_extents() whether the files can be
1349 - * exchanged with each other.
1350 -@@ -970,8 +942,8 @@ out2:
1351 - */
1352 - static int
1353 - mext_check_arguments(struct inode *orig_inode,
1354 -- struct inode *donor_inode, __u64 orig_start,
1355 -- __u64 donor_start, __u64 *len, __u64 moved_len)
1356 -+ struct inode *donor_inode, __u64 orig_start,
1357 -+ __u64 donor_start, __u64 *len)
1358 - {
1359 - ext4_lblk_t orig_blocks, donor_blocks;
1360 - unsigned int blkbits = orig_inode->i_blkbits;
1361 -@@ -985,6 +957,13 @@ mext_check_arguments(struct inode *orig_inode,
1362 - return -EINVAL;
1363 - }
1364 -
1365 -+ if (donor_inode->i_mode & (S_ISUID|S_ISGID)) {
1366 -+ ext4_debug("ext4 move extent: suid or sgid is set"
1367 -+ " to donor file [ino:orig %lu, donor %lu]\n",
1368 -+ orig_inode->i_ino, donor_inode->i_ino);
1369 -+ return -EINVAL;
1370 -+ }
1371 -+
1372 - /* Ext4 move extent does not support swapfile */
1373 - if (IS_SWAPFILE(orig_inode) || IS_SWAPFILE(donor_inode)) {
1374 - ext4_debug("ext4 move extent: The argument files should "
1375 -@@ -1025,13 +1004,6 @@ mext_check_arguments(struct inode *orig_inode,
1376 - return -EINVAL;
1377 - }
1378 -
1379 -- if (moved_len) {
1380 -- ext4_debug("ext4 move extent: moved_len should be 0 "
1381 -- "[ino:orig %lu, donor %lu]\n", orig_inode->i_ino,
1382 -- donor_inode->i_ino);
1383 -- return -EINVAL;
1384 -- }
1385 --
1386 - if ((orig_start > EXT_MAX_BLOCK) ||
1387 - (donor_start > EXT_MAX_BLOCK) ||
1388 - (*len > EXT_MAX_BLOCK) ||
1389 -@@ -1232,16 +1204,16 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp,
1390 - return -EINVAL;
1391 - }
1392 -
1393 -- /* protect orig and donor against a truncate */
1394 -+ /* Protect orig and donor inodes against a truncate */
1395 - ret1 = mext_inode_double_lock(orig_inode, donor_inode);
1396 - if (ret1 < 0)
1397 - return ret1;
1398 -
1399 -- mext_double_down_read(orig_inode, donor_inode);
1400 -+ /* Protect extent tree against block allocations via delalloc */
1401 -+ double_down_write_data_sem(orig_inode, donor_inode);
1402 - /* Check the filesystem environment whether move_extent can be done */
1403 - ret1 = mext_check_arguments(orig_inode, donor_inode, orig_start,
1404 -- donor_start, &len, *moved_len);
1405 -- mext_double_up_read(orig_inode, donor_inode);
1406 -+ donor_start, &len);
1407 - if (ret1)
1408 - goto out;
1409 -
1410 -@@ -1355,36 +1327,39 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp,
1411 - seq_start = le32_to_cpu(ext_cur->ee_block);
1412 - rest_blocks = seq_blocks;
1413 -
1414 -- /* Discard preallocations of two inodes */
1415 -- down_write(&EXT4_I(orig_inode)->i_data_sem);
1416 -- ext4_discard_preallocations(orig_inode);
1417 -- up_write(&EXT4_I(orig_inode)->i_data_sem);
1418 --
1419 -- down_write(&EXT4_I(donor_inode)->i_data_sem);
1420 -- ext4_discard_preallocations(donor_inode);
1421 -- up_write(&EXT4_I(donor_inode)->i_data_sem);
1422 -+ /*
1423 -+ * Up semaphore to avoid following problems:
1424 -+ * a. transaction deadlock among ext4_journal_start,
1425 -+ * ->write_begin via pagefault, and jbd2_journal_commit
1426 -+ * b. racing with ->readpage, ->write_begin, and ext4_get_block
1427 -+ * in move_extent_per_page
1428 -+ */
1429 -+ double_up_write_data_sem(orig_inode, donor_inode);
1430 -
1431 - while (orig_page_offset <= seq_end_page) {
1432 -
1433 - /* Swap original branches with new branches */
1434 -- ret1 = move_extent_per_page(o_filp, donor_inode,
1435 -+ block_len_in_page = move_extent_per_page(
1436 -+ o_filp, donor_inode,
1437 - orig_page_offset,
1438 - data_offset_in_page,
1439 -- block_len_in_page, uninit);
1440 -- if (ret1 < 0)
1441 -- goto out;
1442 -- orig_page_offset++;
1443 -+ block_len_in_page, uninit,
1444 -+ &ret1);
1445 -+
1446 - /* Count how many blocks we have exchanged */
1447 - *moved_len += block_len_in_page;
1448 -+ if (ret1 < 0)
1449 -+ break;
1450 - if (*moved_len > len) {
1451 - ext4_error(orig_inode->i_sb, __func__,
1452 - "We replaced blocks too much! "
1453 - "sum of replaced: %llu requested: %llu",
1454 - *moved_len, len);
1455 - ret1 = -EIO;
1456 -- goto out;
1457 -+ break;
1458 - }
1459 -
1460 -+ orig_page_offset++;
1461 - data_offset_in_page = 0;
1462 - rest_blocks -= block_len_in_page;
1463 - if (rest_blocks > blocks_per_page)
1464 -@@ -1393,6 +1368,10 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp,
1465 - block_len_in_page = rest_blocks;
1466 - }
1467 -
1468 -+ double_down_write_data_sem(orig_inode, donor_inode);
1469 -+ if (ret1 < 0)
1470 -+ break;
1471 -+
1472 - /* Decrease buffer counter */
1473 - if (holecheck_path)
1474 - ext4_ext_drop_refs(holecheck_path);
1475 -@@ -1414,6 +1393,11 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp,
1476 -
1477 - }
1478 - out:
1479 -+ if (*moved_len) {
1480 -+ ext4_discard_preallocations(orig_inode);
1481 -+ ext4_discard_preallocations(donor_inode);
1482 -+ }
1483 -+
1484 - if (orig_path) {
1485 - ext4_ext_drop_refs(orig_path);
1486 - kfree(orig_path);
1487 -@@ -1422,7 +1406,7 @@ out:
1488 - ext4_ext_drop_refs(holecheck_path);
1489 - kfree(holecheck_path);
1490 - }
1491 --
1492 -+ double_up_write_data_sem(orig_inode, donor_inode);
1493 - ret2 = mext_inode_double_unlock(orig_inode, donor_inode);
1494 -
1495 - if (ret1)
1496 -diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
1497 -index 6d2c1b8..17a17e1 100644
1498 ---- a/fs/ext4/namei.c
1499 -+++ b/fs/ext4/namei.c
1500 -@@ -1292,9 +1292,6 @@ errout:
1501 - * add_dirent_to_buf will attempt search the directory block for
1502 - * space. It will return -ENOSPC if no space is available, and -EIO
1503 - * and -EEXIST if directory entry already exists.
1504 -- *
1505 -- * NOTE! bh is NOT released in the case where ENOSPC is returned. In
1506 -- * all other cases bh is released.
1507 - */
1508 - static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
1509 - struct inode *inode, struct ext4_dir_entry_2 *de,
1510 -@@ -1315,14 +1312,10 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
1511 - top = bh->b_data + blocksize - reclen;
1512 - while ((char *) de <= top) {
1513 - if (!ext4_check_dir_entry("ext4_add_entry", dir, de,
1514 -- bh, offset)) {
1515 -- brelse(bh);
1516 -+ bh, offset))
1517 - return -EIO;
1518 -- }
1519 -- if (ext4_match(namelen, name, de)) {
1520 -- brelse(bh);
1521 -+ if (ext4_match(namelen, name, de))
1522 - return -EEXIST;
1523 -- }
1524 - nlen = EXT4_DIR_REC_LEN(de->name_len);
1525 - rlen = ext4_rec_len_from_disk(de->rec_len, blocksize);
1526 - if ((de->inode? rlen - nlen: rlen) >= reclen)
1527 -@@ -1337,7 +1330,6 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
1528 - err = ext4_journal_get_write_access(handle, bh);
1529 - if (err) {
1530 - ext4_std_error(dir->i_sb, err);
1531 -- brelse(bh);
1532 - return err;
1533 - }
1534 -
1535 -@@ -1377,7 +1369,6 @@ static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry,
1536 - err = ext4_handle_dirty_metadata(handle, dir, bh);
1537 - if (err)
1538 - ext4_std_error(dir->i_sb, err);
1539 -- brelse(bh);
1540 - return 0;
1541 - }
1542 -
1543 -@@ -1471,7 +1462,9 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry,
1544 - if (!(de))
1545 - return retval;
1546 -
1547 -- return add_dirent_to_buf(handle, dentry, inode, de, bh);
1548 -+ retval = add_dirent_to_buf(handle, dentry, inode, de, bh);
1549 -+ brelse(bh);
1550 -+ return retval;
1551 - }
1552 -
1553 - /*
1554 -@@ -1514,8 +1507,10 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
1555 - if(!bh)
1556 - return retval;
1557 - retval = add_dirent_to_buf(handle, dentry, inode, NULL, bh);
1558 -- if (retval != -ENOSPC)
1559 -+ if (retval != -ENOSPC) {
1560 -+ brelse(bh);
1561 - return retval;
1562 -+ }
1563 -
1564 - if (blocks == 1 && !dx_fallback &&
1565 - EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_DIR_INDEX))
1566 -@@ -1528,7 +1523,9 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
1567 - de = (struct ext4_dir_entry_2 *) bh->b_data;
1568 - de->inode = 0;
1569 - de->rec_len = ext4_rec_len_to_disk(blocksize, blocksize);
1570 -- return add_dirent_to_buf(handle, dentry, inode, de, bh);
1571 -+ retval = add_dirent_to_buf(handle, dentry, inode, de, bh);
1572 -+ brelse(bh);
1573 -+ return retval;
1574 - }
1575 -
1576 - /*
1577 -@@ -1561,10 +1558,8 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
1578 - goto journal_error;
1579 -
1580 - err = add_dirent_to_buf(handle, dentry, inode, NULL, bh);
1581 -- if (err != -ENOSPC) {
1582 -- bh = NULL;
1583 -+ if (err != -ENOSPC)
1584 - goto cleanup;
1585 -- }
1586 -
1587 - /* Block full, should compress but for now just split */
1588 - dxtrace(printk(KERN_DEBUG "using %u of %u node entries\n",
1589 -@@ -1657,7 +1652,6 @@ static int ext4_dx_add_entry(handle_t *handle, struct dentry *dentry,
1590 - if (!de)
1591 - goto cleanup;
1592 - err = add_dirent_to_buf(handle, dentry, inode, de, bh);
1593 -- bh = NULL;
1594 - goto cleanup;
1595 -
1596 - journal_error:
1597 -@@ -1775,7 +1769,7 @@ static int ext4_create(struct inode *dir, struct dentry *dentry, int mode,
1598 - retry:
1599 - handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
1600 - EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3 +
1601 -- 2*EXT4_QUOTA_INIT_BLOCKS(dir->i_sb));
1602 -+ EXT4_MAXQUOTAS_INIT_BLOCKS(dir->i_sb));
1603 - if (IS_ERR(handle))
1604 - return PTR_ERR(handle);
1605 -
1606 -@@ -1809,7 +1803,7 @@ static int ext4_mknod(struct inode *dir, struct dentry *dentry,
1607 - retry:
1608 - handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
1609 - EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3 +
1610 -- 2*EXT4_QUOTA_INIT_BLOCKS(dir->i_sb));
1611 -+ EXT4_MAXQUOTAS_INIT_BLOCKS(dir->i_sb));
1612 - if (IS_ERR(handle))
1613 - return PTR_ERR(handle);
1614 -
1615 -@@ -1846,7 +1840,7 @@ static int ext4_mkdir(struct inode *dir, struct dentry *dentry, int mode)
1616 - retry:
1617 - handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
1618 - EXT4_INDEX_EXTRA_TRANS_BLOCKS + 3 +
1619 -- 2*EXT4_QUOTA_INIT_BLOCKS(dir->i_sb));
1620 -+ EXT4_MAXQUOTAS_INIT_BLOCKS(dir->i_sb));
1621 - if (IS_ERR(handle))
1622 - return PTR_ERR(handle);
1623 -
1624 -@@ -2259,7 +2253,7 @@ static int ext4_symlink(struct inode *dir,
1625 - retry:
1626 - handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) +
1627 - EXT4_INDEX_EXTRA_TRANS_BLOCKS + 5 +
1628 -- 2*EXT4_QUOTA_INIT_BLOCKS(dir->i_sb));
1629 -+ EXT4_MAXQUOTAS_INIT_BLOCKS(dir->i_sb));
1630 - if (IS_ERR(handle))
1631 - return PTR_ERR(handle);
1632 -
1633 -diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
1634 -index 3cfc343..3b2c554 100644
1635 ---- a/fs/ext4/resize.c
1636 -+++ b/fs/ext4/resize.c
1637 -@@ -247,7 +247,7 @@ static int setup_new_group_blocks(struct super_block *sb,
1638 - goto exit_bh;
1639 -
1640 - if (IS_ERR(gdb = bclean(handle, sb, block))) {
1641 -- err = PTR_ERR(bh);
1642 -+ err = PTR_ERR(gdb);
1643 - goto exit_bh;
1644 - }
1645 - ext4_handle_dirty_metadata(handle, NULL, gdb);
1646 -diff --git a/fs/ext4/super.c b/fs/ext4/super.c
1647 -index d4ca92a..9ae5217 100644
1648 ---- a/fs/ext4/super.c
1649 -+++ b/fs/ext4/super.c
1650 -@@ -603,10 +603,6 @@ static void ext4_put_super(struct super_block *sb)
1651 - if (sb->s_dirt)
1652 - ext4_commit_super(sb, 1);
1653 -
1654 -- ext4_release_system_zone(sb);
1655 -- ext4_mb_release(sb);
1656 -- ext4_ext_release(sb);
1657 -- ext4_xattr_put_super(sb);
1658 - if (sbi->s_journal) {
1659 - err = jbd2_journal_destroy(sbi->s_journal);
1660 - sbi->s_journal = NULL;
1661 -@@ -614,6 +610,12 @@ static void ext4_put_super(struct super_block *sb)
1662 - ext4_abort(sb, __func__,
1663 - "Couldn't clean up the journal");
1664 - }
1665 -+
1666 -+ ext4_release_system_zone(sb);
1667 -+ ext4_mb_release(sb);
1668 -+ ext4_ext_release(sb);
1669 -+ ext4_xattr_put_super(sb);
1670 -+
1671 - if (!(sb->s_flags & MS_RDONLY)) {
1672 - EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER);
1673 - es->s_state = cpu_to_le16(sbi->s_mount_state);
1674 -@@ -704,6 +706,8 @@ static struct inode *ext4_alloc_inode(struct super_block *sb)
1675 - spin_lock_init(&(ei->i_block_reservation_lock));
1676 - INIT_LIST_HEAD(&ei->i_aio_dio_complete_list);
1677 - ei->cur_aio_dio = NULL;
1678 -+ ei->i_sync_tid = 0;
1679 -+ ei->i_datasync_tid = 0;
1680 -
1681 - return &ei->vfs_inode;
1682 - }
1683 -@@ -899,6 +903,12 @@ static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs)
1684 - if (test_opt(sb, NO_AUTO_DA_ALLOC))
1685 - seq_puts(seq, ",noauto_da_alloc");
1686 -
1687 -+ if (test_opt(sb, DISCARD))
1688 -+ seq_puts(seq, ",discard");
1689 -+
1690 -+ if (test_opt(sb, NOLOAD))
1691 -+ seq_puts(seq, ",norecovery");
1692 -+
1693 - ext4_show_quota_options(seq, sb);
1694 -
1695 - return 0;
1696 -@@ -1079,7 +1089,8 @@ enum {
1697 - Opt_usrquota, Opt_grpquota, Opt_i_version,
1698 - Opt_stripe, Opt_delalloc, Opt_nodelalloc,
1699 - Opt_block_validity, Opt_noblock_validity,
1700 -- Opt_inode_readahead_blks, Opt_journal_ioprio
1701 -+ Opt_inode_readahead_blks, Opt_journal_ioprio,
1702 -+ Opt_discard, Opt_nodiscard,
1703 - };
1704 -
1705 - static const match_table_t tokens = {
1706 -@@ -1104,6 +1115,7 @@ static const match_table_t tokens = {
1707 - {Opt_acl, "acl"},
1708 - {Opt_noacl, "noacl"},
1709 - {Opt_noload, "noload"},
1710 -+ {Opt_noload, "norecovery"},
1711 - {Opt_nobh, "nobh"},
1712 - {Opt_bh, "bh"},
1713 - {Opt_commit, "commit=%u"},
1714 -@@ -1144,6 +1156,8 @@ static const match_table_t tokens = {
1715 - {Opt_auto_da_alloc, "auto_da_alloc=%u"},
1716 - {Opt_auto_da_alloc, "auto_da_alloc"},
1717 - {Opt_noauto_da_alloc, "noauto_da_alloc"},
1718 -+ {Opt_discard, "discard"},
1719 -+ {Opt_nodiscard, "nodiscard"},
1720 - {Opt_err, NULL},
1721 - };
1722 -
1723 -@@ -1565,6 +1579,12 @@ set_qf_format:
1724 - else
1725 - set_opt(sbi->s_mount_opt,NO_AUTO_DA_ALLOC);
1726 - break;
1727 -+ case Opt_discard:
1728 -+ set_opt(sbi->s_mount_opt, DISCARD);
1729 -+ break;
1730 -+ case Opt_nodiscard:
1731 -+ clear_opt(sbi->s_mount_opt, DISCARD);
1732 -+ break;
1733 - default:
1734 - ext4_msg(sb, KERN_ERR,
1735 - "Unrecognized mount option \"%s\" "
1736 -@@ -1673,14 +1693,14 @@ static int ext4_fill_flex_info(struct super_block *sb)
1737 - size_t size;
1738 - int i;
1739 -
1740 -- if (!sbi->s_es->s_log_groups_per_flex) {
1741 -+ sbi->s_log_groups_per_flex = sbi->s_es->s_log_groups_per_flex;
1742 -+ groups_per_flex = 1 << sbi->s_log_groups_per_flex;
1743 -+
1744 -+ if (groups_per_flex < 2) {
1745 - sbi->s_log_groups_per_flex = 0;
1746 - return 1;
1747 - }
1748 -
1749 -- sbi->s_log_groups_per_flex = sbi->s_es->s_log_groups_per_flex;
1750 -- groups_per_flex = 1 << sbi->s_log_groups_per_flex;
1751 --
1752 - /* We allocate both existing and potentially added groups */
1753 - flex_group_count = ((sbi->s_groups_count + groups_per_flex - 1) +
1754 - ((le16_to_cpu(sbi->s_es->s_reserved_gdt_blocks) + 1) <<
1755 -@@ -3668,13 +3688,11 @@ static int ext4_statfs(struct dentry *dentry, struct kstatfs *buf)
1756 - buf->f_blocks = ext4_blocks_count(es) - sbi->s_overhead_last;
1757 - buf->f_bfree = percpu_counter_sum_positive(&sbi->s_freeblocks_counter) -
1758 - percpu_counter_sum_positive(&sbi->s_dirtyblocks_counter);
1759 -- ext4_free_blocks_count_set(es, buf->f_bfree);
1760 - buf->f_bavail = buf->f_bfree - ext4_r_blocks_count(es);
1761 - if (buf->f_bfree < ext4_r_blocks_count(es))
1762 - buf->f_bavail = 0;
1763 - buf->f_files = le32_to_cpu(es->s_inodes_count);
1764 - buf->f_ffree = percpu_counter_sum_positive(&sbi->s_freeinodes_counter);
1765 -- es->s_free_inodes_count = cpu_to_le32(buf->f_ffree);
1766 - buf->f_namelen = EXT4_NAME_LEN;
1767 - fsid = le64_to_cpup((void *)es->s_uuid) ^
1768 - le64_to_cpup((void *)es->s_uuid + sizeof(u64));
1769 -diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
1770 -index fed5b01..0257019 100644
1771 ---- a/fs/ext4/xattr.c
1772 -+++ b/fs/ext4/xattr.c
1773 -@@ -988,6 +988,10 @@ ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
1774 - if (error)
1775 - goto cleanup;
1776 -
1777 -+ error = ext4_journal_get_write_access(handle, is.iloc.bh);
1778 -+ if (error)
1779 -+ goto cleanup;
1780 -+
1781 - if (EXT4_I(inode)->i_state & EXT4_STATE_NEW) {
1782 - struct ext4_inode *raw_inode = ext4_raw_inode(&is.iloc);
1783 - memset(raw_inode, 0, EXT4_SB(inode->i_sb)->s_inode_size);
1784 -@@ -1013,9 +1017,6 @@ ext4_xattr_set_handle(handle_t *handle, struct inode *inode, int name_index,
1785 - if (flags & XATTR_CREATE)
1786 - goto cleanup;
1787 - }
1788 -- error = ext4_journal_get_write_access(handle, is.iloc.bh);
1789 -- if (error)
1790 -- goto cleanup;
1791 - if (!value) {
1792 - if (!is.s.not_found)
1793 - error = ext4_xattr_ibody_set(handle, inode, &i, &is);
1794 -diff --git a/fs/jbd2/commit.c b/fs/jbd2/commit.c
1795 -index d4cfd6d..8896c1d 100644
1796 ---- a/fs/jbd2/commit.c
1797 -+++ b/fs/jbd2/commit.c
1798 -@@ -636,6 +636,10 @@ void jbd2_journal_commit_transaction(journal_t *journal)
1799 - JBUFFER_TRACE(jh, "ph3: write metadata");
1800 - flags = jbd2_journal_write_metadata_buffer(commit_transaction,
1801 - jh, &new_jh, blocknr);
1802 -+ if (flags < 0) {
1803 -+ jbd2_journal_abort(journal, flags);
1804 -+ continue;
1805 -+ }
1806 - set_bit(BH_JWrite, &jh2bh(new_jh)->b_state);
1807 - wbuf[bufs++] = jh2bh(new_jh);
1808 -
1809 -diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
1810 -index fed8538..82c295d 100644
1811 ---- a/fs/jbd2/journal.c
1812 -+++ b/fs/jbd2/journal.c
1813 -@@ -78,6 +78,7 @@ EXPORT_SYMBOL(jbd2_journal_errno);
1814 - EXPORT_SYMBOL(jbd2_journal_ack_err);
1815 - EXPORT_SYMBOL(jbd2_journal_clear_err);
1816 - EXPORT_SYMBOL(jbd2_log_wait_commit);
1817 -+EXPORT_SYMBOL(jbd2_log_start_commit);
1818 - EXPORT_SYMBOL(jbd2_journal_start_commit);
1819 - EXPORT_SYMBOL(jbd2_journal_force_commit_nested);
1820 - EXPORT_SYMBOL(jbd2_journal_wipe);
1821 -@@ -358,6 +359,10 @@ repeat:
1822 -
1823 - jbd_unlock_bh_state(bh_in);
1824 - tmp = jbd2_alloc(bh_in->b_size, GFP_NOFS);
1825 -+ if (!tmp) {
1826 -+ jbd2_journal_put_journal_head(new_jh);
1827 -+ return -ENOMEM;
1828 -+ }
1829 - jbd_lock_bh_state(bh_in);
1830 - if (jh_in->b_frozen_data) {
1831 - jbd2_free(tmp, bh_in->b_size);
1832 -diff --git a/include/linux/sched.h b/include/linux/sched.h
1833 -index 75e6e60..0f67914 100644
1834 ---- a/include/linux/sched.h
1835 -+++ b/include/linux/sched.h
1836 -@@ -2086,11 +2086,18 @@ static inline int is_si_special(const struct siginfo *info)
1837 - return info <= SEND_SIG_FORCED;
1838 - }
1839 -
1840 --/* True if we are on the alternate signal stack. */
1841 --
1842 -+/*
1843 -+ * True if we are on the alternate signal stack.
1844 -+ */
1845 - static inline int on_sig_stack(unsigned long sp)
1846 - {
1847 -- return (sp - current->sas_ss_sp < current->sas_ss_size);
1848 -+#ifdef CONFIG_STACK_GROWSUP
1849 -+ return sp >= current->sas_ss_sp &&
1850 -+ sp - current->sas_ss_sp < current->sas_ss_size;
1851 -+#else
1852 -+ return sp > current->sas_ss_sp &&
1853 -+ sp - current->sas_ss_sp <= current->sas_ss_size;
1854 -+#endif
1855 - }
1856 -
1857 - static inline int sas_ss_flags(unsigned long sp)
1858 -diff --git a/include/scsi/osd_protocol.h b/include/scsi/osd_protocol.h
1859 -index 2cc8e8b..6856612 100644
1860 ---- a/include/scsi/osd_protocol.h
1861 -+++ b/include/scsi/osd_protocol.h
1862 -@@ -17,6 +17,7 @@
1863 - #define __OSD_PROTOCOL_H__
1864 -
1865 - #include <linux/types.h>
1866 -+#include <linux/kernel.h>
1867 - #include <asm/unaligned.h>
1868 - #include <scsi/scsi.h>
1869 -
1870 -diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h
1871 -index 47941fc..0b4baba 100644
1872 ---- a/include/scsi/scsi_host.h
1873 -+++ b/include/scsi/scsi_host.h
1874 -@@ -677,6 +677,12 @@ struct Scsi_Host {
1875 - void *shost_data;
1876 -
1877 - /*
1878 -+ * Points to the physical bus device we'd use to do DMA
1879 -+ * Needed just in case we have virtual hosts.
1880 -+ */
1881 -+ struct device *dma_dev;
1882 -+
1883 -+ /*
1884 - * We should ensure that this is aligned, both for better performance
1885 - * and also because some compilers (m68k) don't automatically force
1886 - * alignment to a long boundary.
1887 -@@ -720,7 +726,9 @@ extern int scsi_queue_work(struct Scsi_Host *, struct work_struct *);
1888 - extern void scsi_flush_work(struct Scsi_Host *);
1889 -
1890 - extern struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *, int);
1891 --extern int __must_check scsi_add_host(struct Scsi_Host *, struct device *);
1892 -+extern int __must_check scsi_add_host_with_dma(struct Scsi_Host *,
1893 -+ struct device *,
1894 -+ struct device *);
1895 - extern void scsi_scan_host(struct Scsi_Host *);
1896 - extern void scsi_rescan_device(struct device *);
1897 - extern void scsi_remove_host(struct Scsi_Host *);
1898 -@@ -731,6 +739,12 @@ extern const char *scsi_host_state_name(enum scsi_host_state);
1899 -
1900 - extern u64 scsi_calculate_bounce_limit(struct Scsi_Host *);
1901 -
1902 -+static inline int __must_check scsi_add_host(struct Scsi_Host *host,
1903 -+ struct device *dev)
1904 -+{
1905 -+ return scsi_add_host_with_dma(host, dev, dev);
1906 -+}
1907 -+
1908 - static inline struct device *scsi_get_device(struct Scsi_Host *shost)
1909 - {
1910 - return shost->shost_gendev.parent;
1911
1912 Deleted: genpatches-2.6/trunk/2.6.33/1001_linux-2.6.32.2.patch
1913 ===================================================================
1914 --- genpatches-2.6/trunk/2.6.33/1001_linux-2.6.32.2.patch 2010-02-18 15:55:49 UTC (rev 1673)
1915 +++ genpatches-2.6/trunk/2.6.33/1001_linux-2.6.32.2.patch 2010-02-18 15:58:13 UTC (rev 1674)
1916 @@ -1,5445 +0,0 @@
1917 -diff --git a/Documentation/Changes b/Documentation/Changes
1918 -index 6d0f1ef..f08b313 100644
1919 ---- a/Documentation/Changes
1920 -+++ b/Documentation/Changes
1921 -@@ -49,6 +49,8 @@ o oprofile 0.9 # oprofiled --version
1922 - o udev 081 # udevinfo -V
1923 - o grub 0.93 # grub --version
1924 - o mcelog 0.6
1925 -+o iptables 1.4.1 # iptables -V
1926 -+
1927 -
1928 - Kernel compilation
1929 - ==================
1930 -diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
1931 -index 9107b38..5bc4eaa 100644
1932 ---- a/Documentation/kernel-parameters.txt
1933 -+++ b/Documentation/kernel-parameters.txt
1934 -@@ -2645,6 +2645,8 @@ and is between 256 and 4096 characters. It is defined in the file
1935 - to a common usb-storage quirk flag as follows:
1936 - a = SANE_SENSE (collect more than 18 bytes
1937 - of sense data);
1938 -+ b = BAD_SENSE (don't collect more than 18
1939 -+ bytes of sense data);
1940 - c = FIX_CAPACITY (decrease the reported
1941 - device capacity by one sector);
1942 - h = CAPACITY_HEURISTICS (decrease the
1943 -diff --git a/Documentation/video4linux/gspca.txt b/Documentation/video4linux/gspca.txt
1944 -index 3f61825..90e85a8 100644
1945 ---- a/Documentation/video4linux/gspca.txt
1946 -+++ b/Documentation/video4linux/gspca.txt
1947 -@@ -37,6 +37,7 @@ ov519 041e:405f Creative Live! VISTA VF0330
1948 - ov519 041e:4060 Creative Live! VISTA VF0350
1949 - ov519 041e:4061 Creative Live! VISTA VF0400
1950 - ov519 041e:4064 Creative Live! VISTA VF0420
1951 -+ov519 041e:4067 Creative Live! Cam Video IM (VF0350)
1952 - ov519 041e:4068 Creative Live! VISTA VF0470
1953 - spca561 0458:7004 Genius VideoCAM Express V2
1954 - sunplus 0458:7006 Genius Dsc 1.3 Smart
1955 -diff --git a/MAINTAINERS b/MAINTAINERS
1956 -index 4f96ac8..c57d396 100644
1957 ---- a/MAINTAINERS
1958 -+++ b/MAINTAINERS
1959 -@@ -5594,9 +5594,11 @@ S: Maintained
1960 - F: drivers/net/wireless/rndis_wlan.c
1961 -
1962 - USB XHCI DRIVER
1963 --M: Sarah Sharp <sarah.a.sharp@×××××.com>
1964 -+M: Sarah Sharp <sarah.a.sharp@×××××××××××.com>
1965 - L: linux-usb@×××××××××××.org
1966 - S: Supported
1967 -+F: drivers/usb/host/xhci*
1968 -+F: drivers/usb/host/pci-quirks*
1969 -
1970 - USB ZC0301 DRIVER
1971 - M: Luca Risolia <luca.risolia@××××××××××××.it>
1972 -diff --git a/arch/arm/mach-pxa/em-x270.c b/arch/arm/mach-pxa/em-x270.c
1973 -index aec7f42..86a8732 100644
1974 ---- a/arch/arm/mach-pxa/em-x270.c
1975 -+++ b/arch/arm/mach-pxa/em-x270.c
1976 -@@ -497,16 +497,15 @@ static int em_x270_usb_hub_init(void)
1977 - goto err_free_vbus_gpio;
1978 -
1979 - /* USB Hub power-on and reset */
1980 -- gpio_direction_output(usb_hub_reset, 0);
1981 -+ gpio_direction_output(usb_hub_reset, 1);
1982 -+ gpio_direction_output(GPIO9_USB_VBUS_EN, 0);
1983 - regulator_enable(em_x270_usb_ldo);
1984 -- gpio_set_value(usb_hub_reset, 1);
1985 - gpio_set_value(usb_hub_reset, 0);
1986 -+ gpio_set_value(usb_hub_reset, 1);
1987 - regulator_disable(em_x270_usb_ldo);
1988 - regulator_enable(em_x270_usb_ldo);
1989 -- gpio_set_value(usb_hub_reset, 1);
1990 --
1991 -- /* enable VBUS */
1992 -- gpio_direction_output(GPIO9_USB_VBUS_EN, 1);
1993 -+ gpio_set_value(usb_hub_reset, 0);
1994 -+ gpio_set_value(GPIO9_USB_VBUS_EN, 1);
1995 -
1996 - return 0;
1997 -
1998 -diff --git a/arch/ia64/include/asm/io.h b/arch/ia64/include/asm/io.h
1999 -index 0d9d16e..cc8335e 100644
2000 ---- a/arch/ia64/include/asm/io.h
2001 -+++ b/arch/ia64/include/asm/io.h
2002 -@@ -424,6 +424,8 @@ __writeq (unsigned long val, volatile void __iomem *addr)
2003 - extern void __iomem * ioremap(unsigned long offset, unsigned long size);
2004 - extern void __iomem * ioremap_nocache (unsigned long offset, unsigned long size);
2005 - extern void iounmap (volatile void __iomem *addr);
2006 -+extern void __iomem * early_ioremap (unsigned long phys_addr, unsigned long size);
2007 -+extern void early_iounmap (volatile void __iomem *addr, unsigned long size);
2008 -
2009 - /*
2010 - * String version of IO memory access ops:
2011 -diff --git a/arch/ia64/mm/ioremap.c b/arch/ia64/mm/ioremap.c
2012 -index 2a14062..3dccdd8 100644
2013 ---- a/arch/ia64/mm/ioremap.c
2014 -+++ b/arch/ia64/mm/ioremap.c
2015 -@@ -22,6 +22,12 @@ __ioremap (unsigned long phys_addr)
2016 - }
2017 -
2018 - void __iomem *
2019 -+early_ioremap (unsigned long phys_addr, unsigned long size)
2020 -+{
2021 -+ return __ioremap(phys_addr);
2022 -+}
2023 -+
2024 -+void __iomem *
2025 - ioremap (unsigned long phys_addr, unsigned long size)
2026 - {
2027 - void __iomem *addr;
2028 -@@ -102,6 +108,11 @@ ioremap_nocache (unsigned long phys_addr, unsigned long size)
2029 - EXPORT_SYMBOL(ioremap_nocache);
2030 -
2031 - void
2032 -+early_iounmap (volatile void __iomem *addr, unsigned long size)
2033 -+{
2034 -+}
2035 -+
2036 -+void
2037 - iounmap (volatile void __iomem *addr)
2038 - {
2039 - if (REGION_NUMBER(addr) == RGN_GATE)
2040 -diff --git a/arch/powerpc/kernel/vector.S b/arch/powerpc/kernel/vector.S
2041 -index 67b6916..fe46048 100644
2042 ---- a/arch/powerpc/kernel/vector.S
2043 -+++ b/arch/powerpc/kernel/vector.S
2044 -@@ -58,7 +58,7 @@ _GLOBAL(load_up_altivec)
2045 - * all 1's
2046 - */
2047 - mfspr r4,SPRN_VRSAVE
2048 -- cmpdi 0,r4,0
2049 -+ cmpwi 0,r4,0
2050 - bne+ 1f
2051 - li r4,-1
2052 - mtspr SPRN_VRSAVE,r4
2053 -diff --git a/arch/s390/include/asm/kvm.h b/arch/s390/include/asm/kvm.h
2054 -index 3dfcaeb..82b32a1 100644
2055 ---- a/arch/s390/include/asm/kvm.h
2056 -+++ b/arch/s390/include/asm/kvm.h
2057 -@@ -1,6 +1,5 @@
2058 - #ifndef __LINUX_KVM_S390_H
2059 - #define __LINUX_KVM_S390_H
2060 --
2061 - /*
2062 - * asm-s390/kvm.h - KVM s390 specific structures and definitions
2063 - *
2064 -@@ -15,6 +14,8 @@
2065 - */
2066 - #include <linux/types.h>
2067 -
2068 -+#define __KVM_S390
2069 -+
2070 - /* for KVM_GET_REGS and KVM_SET_REGS */
2071 - struct kvm_regs {
2072 - /* general purpose regs for s390 */
2073 -diff --git a/arch/s390/kernel/head64.S b/arch/s390/kernel/head64.S
2074 -index 6a25080..d984a2a 100644
2075 ---- a/arch/s390/kernel/head64.S
2076 -+++ b/arch/s390/kernel/head64.S
2077 -@@ -83,6 +83,8 @@ startup_continue:
2078 - slr %r0,%r0 # set cpuid to zero
2079 - sigp %r1,%r0,0x12 # switch to esame mode
2080 - sam64 # switch to 64 bit mode
2081 -+ llgfr %r13,%r13 # clear high-order half of base reg
2082 -+ lmh %r0,%r15,.Lzero64-.LPG1(%r13) # clear high-order half
2083 - lctlg %c0,%c15,.Lctl-.LPG1(%r13) # load control registers
2084 - lg %r12,.Lparmaddr-.LPG1(%r13) # pointer to parameter area
2085 - # move IPL device to lowcore
2086 -@@ -127,6 +129,7 @@ startup_continue:
2087 - .L4malign:.quad 0xffffffffffc00000
2088 - .Lscan2g:.quad 0x80000000 + 0x20000 - 8 # 2GB + 128K - 8
2089 - .Lnop: .long 0x07000700
2090 -+.Lzero64:.fill 16,4,0x0
2091 - #ifdef CONFIG_ZFCPDUMP
2092 - .Lcurrent_cpu:
2093 - .long 0x0
2094 -diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
2095 -index 07ced89..ca2d312 100644
2096 ---- a/arch/s390/kvm/kvm-s390.c
2097 -+++ b/arch/s390/kvm/kvm-s390.c
2098 -@@ -116,10 +116,16 @@ long kvm_arch_dev_ioctl(struct file *filp,
2099 -
2100 - int kvm_dev_ioctl_check_extension(long ext)
2101 - {
2102 -+ int r;
2103 -+
2104 - switch (ext) {
2105 -+ case KVM_CAP_S390_PSW:
2106 -+ r = 1;
2107 -+ break;
2108 - default:
2109 -- return 0;
2110 -+ r = 0;
2111 - }
2112 -+ return r;
2113 - }
2114 -
2115 - /* Section: vm related */
2116 -@@ -419,8 +425,10 @@ static int kvm_arch_vcpu_ioctl_set_initial_psw(struct kvm_vcpu *vcpu, psw_t psw)
2117 - vcpu_load(vcpu);
2118 - if (atomic_read(&vcpu->arch.sie_block->cpuflags) & CPUSTAT_RUNNING)
2119 - rc = -EBUSY;
2120 -- else
2121 -- vcpu->arch.sie_block->gpsw = psw;
2122 -+ else {
2123 -+ vcpu->run->psw_mask = psw.mask;
2124 -+ vcpu->run->psw_addr = psw.addr;
2125 -+ }
2126 - vcpu_put(vcpu);
2127 - return rc;
2128 - }
2129 -@@ -508,9 +516,6 @@ rerun_vcpu:
2130 -
2131 - switch (kvm_run->exit_reason) {
2132 - case KVM_EXIT_S390_SIEIC:
2133 -- vcpu->arch.sie_block->gpsw.mask = kvm_run->s390_sieic.mask;
2134 -- vcpu->arch.sie_block->gpsw.addr = kvm_run->s390_sieic.addr;
2135 -- break;
2136 - case KVM_EXIT_UNKNOWN:
2137 - case KVM_EXIT_INTR:
2138 - case KVM_EXIT_S390_RESET:
2139 -@@ -519,6 +524,9 @@ rerun_vcpu:
2140 - BUG();
2141 - }
2142 -
2143 -+ vcpu->arch.sie_block->gpsw.mask = kvm_run->psw_mask;
2144 -+ vcpu->arch.sie_block->gpsw.addr = kvm_run->psw_addr;
2145 -+
2146 - might_fault();
2147 -
2148 - do {
2149 -@@ -538,8 +546,6 @@ rerun_vcpu:
2150 - /* intercept cannot be handled in-kernel, prepare kvm-run */
2151 - kvm_run->exit_reason = KVM_EXIT_S390_SIEIC;
2152 - kvm_run->s390_sieic.icptcode = vcpu->arch.sie_block->icptcode;
2153 -- kvm_run->s390_sieic.mask = vcpu->arch.sie_block->gpsw.mask;
2154 -- kvm_run->s390_sieic.addr = vcpu->arch.sie_block->gpsw.addr;
2155 - kvm_run->s390_sieic.ipa = vcpu->arch.sie_block->ipa;
2156 - kvm_run->s390_sieic.ipb = vcpu->arch.sie_block->ipb;
2157 - rc = 0;
2158 -@@ -551,6 +557,9 @@ rerun_vcpu:
2159 - rc = 0;
2160 - }
2161 -
2162 -+ kvm_run->psw_mask = vcpu->arch.sie_block->gpsw.mask;
2163 -+ kvm_run->psw_addr = vcpu->arch.sie_block->gpsw.addr;
2164 -+
2165 - if (vcpu->sigset_active)
2166 - sigprocmask(SIG_SETMASK, &sigsaved, NULL);
2167 -
2168 -diff --git a/arch/s390/kvm/sigp.c b/arch/s390/kvm/sigp.c
2169 -index 40c8c67..15ee111 100644
2170 ---- a/arch/s390/kvm/sigp.c
2171 -+++ b/arch/s390/kvm/sigp.c
2172 -@@ -188,9 +188,9 @@ static int __sigp_set_prefix(struct kvm_vcpu *vcpu, u16 cpu_addr, u32 address,
2173 -
2174 - /* make sure that the new value is valid memory */
2175 - address = address & 0x7fffe000u;
2176 -- if ((copy_from_guest(vcpu, &tmp,
2177 -- (u64) (address + vcpu->arch.sie_block->gmsor) , 1)) ||
2178 -- (copy_from_guest(vcpu, &tmp, (u64) (address +
2179 -+ if ((copy_from_user(&tmp, (void __user *)
2180 -+ (address + vcpu->arch.sie_block->gmsor) , 1)) ||
2181 -+ (copy_from_user(&tmp, (void __user *)(address +
2182 - vcpu->arch.sie_block->gmsor + PAGE_SIZE), 1))) {
2183 - *reg |= SIGP_STAT_INVALID_PARAMETER;
2184 - return 1; /* invalid parameter */
2185 -diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile
2186 -index dfe272d..113225b 100644
2187 ---- a/arch/sparc/Makefile
2188 -+++ b/arch/sparc/Makefile
2189 -@@ -27,6 +27,7 @@ AS := $(AS) -32
2190 - LDFLAGS := -m elf32_sparc
2191 - CHECKFLAGS += -D__sparc__
2192 - export BITS := 32
2193 -+UTS_MACHINE := sparc
2194 -
2195 - #KBUILD_CFLAGS += -g -pipe -fcall-used-g5 -fcall-used-g7
2196 - KBUILD_CFLAGS += -m32 -pipe -mno-fpu -fcall-used-g5 -fcall-used-g7
2197 -@@ -46,6 +47,7 @@ CHECKFLAGS += -D__sparc__ -D__sparc_v9__ -D__arch64__ -m64
2198 -
2199 - LDFLAGS := -m elf64_sparc
2200 - export BITS := 64
2201 -+UTS_MACHINE := sparc64
2202 -
2203 - KBUILD_CFLAGS += -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow \
2204 - -ffixed-g4 -ffixed-g5 -fcall-used-g7 -Wno-sign-compare \
2205 -diff --git a/arch/sparc/kernel/ldc.c b/arch/sparc/kernel/ldc.c
2206 -index cb3c72c..e0ba898 100644
2207 ---- a/arch/sparc/kernel/ldc.c
2208 -+++ b/arch/sparc/kernel/ldc.c
2209 -@@ -1242,13 +1242,13 @@ int ldc_bind(struct ldc_channel *lp, const char *name)
2210 - snprintf(lp->tx_irq_name, LDC_IRQ_NAME_MAX, "%s TX", name);
2211 -
2212 - err = request_irq(lp->cfg.rx_irq, ldc_rx,
2213 -- IRQF_SAMPLE_RANDOM | IRQF_DISABLED | IRQF_SHARED,
2214 -+ IRQF_SAMPLE_RANDOM | IRQF_DISABLED,
2215 - lp->rx_irq_name, lp);
2216 - if (err)
2217 - return err;
2218 -
2219 - err = request_irq(lp->cfg.tx_irq, ldc_tx,
2220 -- IRQF_SAMPLE_RANDOM | IRQF_DISABLED | IRQF_SHARED,
2221 -+ IRQF_SAMPLE_RANDOM | IRQF_DISABLED,
2222 - lp->tx_irq_name, lp);
2223 - if (err) {
2224 - free_irq(lp->cfg.rx_irq, lp);
2225 -diff --git a/arch/sparc/kernel/of_device_64.c b/arch/sparc/kernel/of_device_64.c
2226 -index 881947e..0a6f2d1 100644
2227 ---- a/arch/sparc/kernel/of_device_64.c
2228 -+++ b/arch/sparc/kernel/of_device_64.c
2229 -@@ -104,9 +104,19 @@ static int of_bus_pci_map(u32 *addr, const u32 *range,
2230 - int i;
2231 -
2232 - /* Check address type match */
2233 -- if ((addr[0] ^ range[0]) & 0x03000000)
2234 -- return -EINVAL;
2235 -+ if (!((addr[0] ^ range[0]) & 0x03000000))
2236 -+ goto type_match;
2237 -+
2238 -+ /* Special exception, we can map a 64-bit address into
2239 -+ * a 32-bit range.
2240 -+ */
2241 -+ if ((addr[0] & 0x03000000) == 0x03000000 &&
2242 -+ (range[0] & 0x03000000) == 0x02000000)
2243 -+ goto type_match;
2244 -+
2245 -+ return -EINVAL;
2246 -
2247 -+type_match:
2248 - if (of_out_of_range(addr + 1, range + 1, range + na + pna,
2249 - na - 1, ns))
2250 - return -EINVAL;
2251 -diff --git a/arch/sparc/lib/mcount.S b/arch/sparc/lib/mcount.S
2252 -index 7ce9c65..24b8b12 100644
2253 ---- a/arch/sparc/lib/mcount.S
2254 -+++ b/arch/sparc/lib/mcount.S
2255 -@@ -64,8 +64,9 @@ mcount:
2256 - 2: sethi %hi(softirq_stack), %g3
2257 - or %g3, %lo(softirq_stack), %g3
2258 - ldx [%g3 + %g1], %g7
2259 -+ sub %g7, STACK_BIAS, %g7
2260 - cmp %sp, %g7
2261 -- bleu,pt %xcc, 2f
2262 -+ bleu,pt %xcc, 3f
2263 - sethi %hi(THREAD_SIZE), %g3
2264 - add %g7, %g3, %g7
2265 - cmp %sp, %g7
2266 -@@ -75,7 +76,7 @@ mcount:
2267 - * again, we are already trying to output the stack overflow
2268 - * message.
2269 - */
2270 -- sethi %hi(ovstack), %g7 ! cant move to panic stack fast enough
2271 -+3: sethi %hi(ovstack), %g7 ! cant move to panic stack fast enough
2272 - or %g7, %lo(ovstack), %g7
2273 - add %g7, OVSTACKSIZE, %g3
2274 - sub %g3, STACK_BIAS + 192, %g3
2275 -diff --git a/arch/x86/Makefile_32.cpu b/arch/x86/Makefile_32.cpu
2276 -index 30e9a26..1937226 100644
2277 ---- a/arch/x86/Makefile_32.cpu
2278 -+++ b/arch/x86/Makefile_32.cpu
2279 -@@ -46,6 +46,13 @@ cflags-$(CONFIG_MGEODEGX1) += -march=pentium-mmx
2280 - # cpu entries
2281 - cflags-$(CONFIG_X86_GENERIC) += $(call tune,generic,$(call tune,i686))
2282 -
2283 -+# Work around the pentium-mmx code generator madness of gcc4.4.x which
2284 -+# does stack alignment by generating horrible code _before_ the mcount
2285 -+# prologue (push %ebp, mov %esp, %ebp) which breaks the function graph
2286 -+# tracer assumptions. For i686, generic, core2 this is set by the
2287 -+# compiler anyway
2288 -+cflags-$(CONFIG_FUNCTION_GRAPH_TRACER) += $(call cc-option,-maccumulate-outgoing-args)
2289 -+
2290 - # Bug fix for binutils: this option is required in order to keep
2291 - # binutils from generating NOPL instructions against our will.
2292 - ifneq ($(CONFIG_X86_P6_NOP),y)
2293 -diff --git a/arch/x86/include/asm/irq_vectors.h b/arch/x86/include/asm/irq_vectors.h
2294 -index 5b21f0e..6e90a04 100644
2295 ---- a/arch/x86/include/asm/irq_vectors.h
2296 -+++ b/arch/x86/include/asm/irq_vectors.h
2297 -@@ -113,7 +113,7 @@
2298 - */
2299 - #define LOCAL_PENDING_VECTOR 0xec
2300 -
2301 --#define UV_BAU_MESSAGE 0xec
2302 -+#define UV_BAU_MESSAGE 0xea
2303 -
2304 - /*
2305 - * Self IPI vector for machine checks
2306 -diff --git a/arch/x86/include/asm/kvm_emulate.h b/arch/x86/include/asm/kvm_emulate.h
2307 -index b7ed2c4..7c18e12 100644
2308 ---- a/arch/x86/include/asm/kvm_emulate.h
2309 -+++ b/arch/x86/include/asm/kvm_emulate.h
2310 -@@ -129,7 +129,7 @@ struct decode_cache {
2311 - u8 seg_override;
2312 - unsigned int d;
2313 - unsigned long regs[NR_VCPU_REGS];
2314 -- unsigned long eip;
2315 -+ unsigned long eip, eip_orig;
2316 - /* modrm */
2317 - u8 modrm;
2318 - u8 modrm_mod;
2319 -diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
2320 -index f1363b7..a479023 100644
2321 ---- a/arch/x86/include/asm/mce.h
2322 -+++ b/arch/x86/include/asm/mce.h
2323 -@@ -214,5 +214,11 @@ void intel_init_thermal(struct cpuinfo_x86 *c);
2324 -
2325 - void mce_log_therm_throt_event(__u64 status);
2326 -
2327 -+#ifdef CONFIG_X86_THERMAL_VECTOR
2328 -+extern void mcheck_intel_therm_init(void);
2329 -+#else
2330 -+static inline void mcheck_intel_therm_init(void) { }
2331 -+#endif
2332 -+
2333 - #endif /* __KERNEL__ */
2334 - #endif /* _ASM_X86_MCE_H */
2335 -diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
2336 -index 59cdfa4..2e837f5 100644
2337 ---- a/arch/x86/kernel/acpi/cstate.c
2338 -+++ b/arch/x86/kernel/acpi/cstate.c
2339 -@@ -48,7 +48,7 @@ void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags,
2340 - * P4, Core and beyond CPUs
2341 - */
2342 - if (c->x86_vendor == X86_VENDOR_INTEL &&
2343 -- (c->x86 > 0xf || (c->x86 == 6 && c->x86_model >= 14)))
2344 -+ (c->x86 > 0xf || (c->x86 == 6 && c->x86_model >= 0x0f)))
2345 - flags->bm_control = 0;
2346 - }
2347 - EXPORT_SYMBOL(acpi_processor_power_init_bm_check);
2348 -diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
2349 -index 0285521..90b9b55 100644
2350 ---- a/arch/x86/kernel/amd_iommu.c
2351 -+++ b/arch/x86/kernel/amd_iommu.c
2352 -@@ -2047,10 +2047,10 @@ static void prealloc_protection_domains(void)
2353 - struct pci_dev *dev = NULL;
2354 - struct dma_ops_domain *dma_dom;
2355 - struct amd_iommu *iommu;
2356 -- u16 devid;
2357 -+ u16 devid, __devid;
2358 -
2359 - while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
2360 -- devid = calc_devid(dev->bus->number, dev->devfn);
2361 -+ __devid = devid = calc_devid(dev->bus->number, dev->devfn);
2362 - if (devid > amd_iommu_last_bdf)
2363 - continue;
2364 - devid = amd_iommu_alias_table[devid];
2365 -@@ -2065,6 +2065,10 @@ static void prealloc_protection_domains(void)
2366 - init_unity_mappings_for_device(dma_dom, devid);
2367 - dma_dom->target_dev = devid;
2368 -
2369 -+ attach_device(iommu, &dma_dom->domain, devid);
2370 -+ if (__devid != devid)
2371 -+ attach_device(iommu, &dma_dom->domain, __devid);
2372 -+
2373 - list_add_tail(&dma_dom->list, &iommu_pd_list);
2374 - }
2375 - }
2376 -diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
2377 -index c20001e..e0b3130 100644
2378 ---- a/arch/x86/kernel/amd_iommu_init.c
2379 -+++ b/arch/x86/kernel/amd_iommu_init.c
2380 -@@ -925,7 +925,7 @@ static int __init init_iommu_all(struct acpi_table_header *table)
2381 - *
2382 - ****************************************************************************/
2383 -
2384 --static int __init iommu_setup_msi(struct amd_iommu *iommu)
2385 -+static int iommu_setup_msi(struct amd_iommu *iommu)
2386 - {
2387 - int r;
2388 -
2389 -diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
2390 -index 894aa97..c86dbcf 100644
2391 ---- a/arch/x86/kernel/apic/apic.c
2392 -+++ b/arch/x86/kernel/apic/apic.c
2393 -@@ -246,7 +246,7 @@ static int modern_apic(void)
2394 - */
2395 - static void native_apic_write_dummy(u32 reg, u32 v)
2396 - {
2397 -- WARN_ON_ONCE((cpu_has_apic || !disable_apic));
2398 -+ WARN_ON_ONCE(cpu_has_apic && !disable_apic);
2399 - }
2400 -
2401 - static u32 native_apic_read_dummy(u32 reg)
2402 -diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
2403 -index 804c40e..8178d03 100644
2404 ---- a/arch/x86/kernel/cpu/intel_cacheinfo.c
2405 -+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
2406 -@@ -94,7 +94,7 @@ static const struct _cache_table __cpuinitconst cache_table[] =
2407 - { 0xd1, LVL_3, 1024 }, /* 4-way set assoc, 64 byte line size */
2408 - { 0xd2, LVL_3, 2048 }, /* 4-way set assoc, 64 byte line size */
2409 - { 0xd6, LVL_3, 1024 }, /* 8-way set assoc, 64 byte line size */
2410 -- { 0xd7, LVL_3, 2038 }, /* 8-way set assoc, 64 byte line size */
2411 -+ { 0xd7, LVL_3, 2048 }, /* 8-way set assoc, 64 byte line size */
2412 - { 0xd8, LVL_3, 4096 }, /* 12-way set assoc, 64 byte line size */
2413 - { 0xdc, LVL_3, 2048 }, /* 12-way set assoc, 64 byte line size */
2414 - { 0xdd, LVL_3, 4096 }, /* 12-way set assoc, 64 byte line size */
2415 -@@ -102,6 +102,9 @@ static const struct _cache_table __cpuinitconst cache_table[] =
2416 - { 0xe2, LVL_3, 2048 }, /* 16-way set assoc, 64 byte line size */
2417 - { 0xe3, LVL_3, 4096 }, /* 16-way set assoc, 64 byte line size */
2418 - { 0xe4, LVL_3, 8192 }, /* 16-way set assoc, 64 byte line size */
2419 -+ { 0xea, LVL_3, 12288 }, /* 24-way set assoc, 64 byte line size */
2420 -+ { 0xeb, LVL_3, 18432 }, /* 24-way set assoc, 64 byte line size */
2421 -+ { 0xec, LVL_3, 24576 }, /* 24-way set assoc, 64 byte line size */
2422 - { 0x00, 0, 0}
2423 - };
2424 -
2425 -diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
2426 -index 721a77c..0f16a2b 100644
2427 ---- a/arch/x86/kernel/cpu/mcheck/mce.c
2428 -+++ b/arch/x86/kernel/cpu/mcheck/mce.c
2429 -@@ -1374,13 +1374,14 @@ static void mce_init_timer(void)
2430 - struct timer_list *t = &__get_cpu_var(mce_timer);
2431 - int *n = &__get_cpu_var(mce_next_interval);
2432 -
2433 -+ setup_timer(t, mcheck_timer, smp_processor_id());
2434 -+
2435 - if (mce_ignore_ce)
2436 - return;
2437 -
2438 - *n = check_interval * HZ;
2439 - if (!*n)
2440 - return;
2441 -- setup_timer(t, mcheck_timer, smp_processor_id());
2442 - t->expires = round_jiffies(jiffies + *n);
2443 - add_timer_on(t, smp_processor_id());
2444 - }
2445 -@@ -1991,9 +1992,11 @@ mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
2446 - break;
2447 - case CPU_DOWN_FAILED:
2448 - case CPU_DOWN_FAILED_FROZEN:
2449 -- t->expires = round_jiffies(jiffies +
2450 -+ if (!mce_ignore_ce && check_interval) {
2451 -+ t->expires = round_jiffies(jiffies +
2452 - __get_cpu_var(mce_next_interval));
2453 -- add_timer_on(t, cpu);
2454 -+ add_timer_on(t, cpu);
2455 -+ }
2456 - smp_call_function_single(cpu, mce_reenable_cpu, &action, 1);
2457 - break;
2458 - case CPU_POST_DEAD:
2459 -diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c
2460 -index b3a1dba..4fef985 100644
2461 ---- a/arch/x86/kernel/cpu/mcheck/therm_throt.c
2462 -+++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c
2463 -@@ -49,6 +49,8 @@ static DEFINE_PER_CPU(struct thermal_state, thermal_state);
2464 -
2465 - static atomic_t therm_throt_en = ATOMIC_INIT(0);
2466 -
2467 -+static u32 lvtthmr_init __read_mostly;
2468 -+
2469 - #ifdef CONFIG_SYSFS
2470 - #define define_therm_throt_sysdev_one_ro(_name) \
2471 - static SYSDEV_ATTR(_name, 0444, therm_throt_sysdev_show_##_name, NULL)
2472 -@@ -254,6 +256,18 @@ asmlinkage void smp_thermal_interrupt(struct pt_regs *regs)
2473 - ack_APIC_irq();
2474 - }
2475 -
2476 -+void __init mcheck_intel_therm_init(void)
2477 -+{
2478 -+ /*
2479 -+ * This function is only called on boot CPU. Save the init thermal
2480 -+ * LVT value on BSP and use that value to restore APs' thermal LVT
2481 -+ * entry BIOS programmed later
2482 -+ */
2483 -+ if (cpu_has(&boot_cpu_data, X86_FEATURE_ACPI) &&
2484 -+ cpu_has(&boot_cpu_data, X86_FEATURE_ACC))
2485 -+ lvtthmr_init = apic_read(APIC_LVTTHMR);
2486 -+}
2487 -+
2488 - void intel_init_thermal(struct cpuinfo_x86 *c)
2489 - {
2490 - unsigned int cpu = smp_processor_id();
2491 -@@ -270,7 +284,20 @@ void intel_init_thermal(struct cpuinfo_x86 *c)
2492 - * since it might be delivered via SMI already:
2493 - */
2494 - rdmsr(MSR_IA32_MISC_ENABLE, l, h);
2495 -- h = apic_read(APIC_LVTTHMR);
2496 -+
2497 -+ /*
2498 -+ * The initial value of thermal LVT entries on all APs always reads
2499 -+ * 0x10000 because APs are woken up by BSP issuing INIT-SIPI-SIPI
2500 -+ * sequence to them and LVT registers are reset to 0s except for
2501 -+ * the mask bits which are set to 1s when APs receive INIT IPI.
2502 -+ * Always restore the value that BIOS has programmed on AP based on
2503 -+ * BSP's info we saved since BIOS is always setting the same value
2504 -+ * for all threads/cores
2505 -+ */
2506 -+ apic_write(APIC_LVTTHMR, lvtthmr_init);
2507 -+
2508 -+ h = lvtthmr_init;
2509 -+
2510 - if ((l & MSR_IA32_MISC_ENABLE_TM1) && (h & APIC_DM_SMI)) {
2511 - printk(KERN_DEBUG
2512 - "CPU%d: Thermal monitoring handled by SMI\n", cpu);
2513 -diff --git a/arch/x86/kernel/cpu/perfctr-watchdog.c b/arch/x86/kernel/cpu/perfctr-watchdog.c
2514 -index fab786f..898df97 100644
2515 ---- a/arch/x86/kernel/cpu/perfctr-watchdog.c
2516 -+++ b/arch/x86/kernel/cpu/perfctr-watchdog.c
2517 -@@ -712,7 +712,7 @@ static void probe_nmi_watchdog(void)
2518 - switch (boot_cpu_data.x86_vendor) {
2519 - case X86_VENDOR_AMD:
2520 - if (boot_cpu_data.x86 != 6 && boot_cpu_data.x86 != 15 &&
2521 -- boot_cpu_data.x86 != 16)
2522 -+ boot_cpu_data.x86 != 16 && boot_cpu_data.x86 != 17)
2523 - return;
2524 - wd_ops = &k7_wd_ops;
2525 - break;
2526 -diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c
2527 -index 971a3be..e6ec8a2 100644
2528 ---- a/arch/x86/kernel/pci-calgary_64.c
2529 -+++ b/arch/x86/kernel/pci-calgary_64.c
2530 -@@ -318,13 +318,15 @@ static inline struct iommu_table *find_iommu_table(struct device *dev)
2531 -
2532 - pdev = to_pci_dev(dev);
2533 -
2534 -+ /* search up the device tree for an iommu */
2535 - pbus = pdev->bus;
2536 --
2537 -- /* is the device behind a bridge? Look for the root bus */
2538 -- while (pbus->parent)
2539 -+ do {
2540 -+ tbl = pci_iommu(pbus);
2541 -+ if (tbl && tbl->it_busno == pbus->number)
2542 -+ break;
2543 -+ tbl = NULL;
2544 - pbus = pbus->parent;
2545 --
2546 -- tbl = pci_iommu(pbus);
2547 -+ } while (pbus);
2548 -
2549 - BUG_ON(tbl && (tbl->it_busno != pbus->number));
2550 -
2551 -diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
2552 -index a6e804d..6ac3931 100644
2553 ---- a/arch/x86/kernel/pci-dma.c
2554 -+++ b/arch/x86/kernel/pci-dma.c
2555 -@@ -214,7 +214,7 @@ static __init int iommu_setup(char *p)
2556 - if (!strncmp(p, "allowdac", 8))
2557 - forbid_dac = 0;
2558 - if (!strncmp(p, "nodac", 5))
2559 -- forbid_dac = -1;
2560 -+ forbid_dac = 1;
2561 - if (!strncmp(p, "usedac", 6)) {
2562 - forbid_dac = -1;
2563 - return 1;
2564 -diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
2565 -index a7f1b64..fcc0b5c 100644
2566 ---- a/arch/x86/kernel/pci-gart_64.c
2567 -+++ b/arch/x86/kernel/pci-gart_64.c
2568 -@@ -856,7 +856,7 @@ void __init gart_parse_options(char *p)
2569 - #endif
2570 - if (isdigit(*p) && get_option(&p, &arg))
2571 - iommu_size = arg;
2572 -- if (!strncmp(p, "fullflush", 8))
2573 -+ if (!strncmp(p, "fullflush", 9))
2574 - iommu_fullflush = 1;
2575 - if (!strncmp(p, "nofullflush", 11))
2576 - iommu_fullflush = 0;
2577 -diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
2578 -index f930787..6caf260 100644
2579 ---- a/arch/x86/kernel/reboot.c
2580 -+++ b/arch/x86/kernel/reboot.c
2581 -@@ -259,6 +259,14 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
2582 - DMI_MATCH(DMI_PRODUCT_NAME, "SBC-FITPC2"),
2583 - },
2584 - },
2585 -+ { /* Handle problems with rebooting on ASUS P4S800 */
2586 -+ .callback = set_bios_reboot,
2587 -+ .ident = "ASUS P4S800",
2588 -+ .matches = {
2589 -+ DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
2590 -+ DMI_MATCH(DMI_BOARD_NAME, "P4S800"),
2591 -+ },
2592 -+ },
2593 - { }
2594 - };
2595 -
2596 -diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
2597 -index 2a34f9c..51aa5b2 100644
2598 ---- a/arch/x86/kernel/setup.c
2599 -+++ b/arch/x86/kernel/setup.c
2600 -@@ -109,6 +109,7 @@
2601 - #ifdef CONFIG_X86_64
2602 - #include <asm/numa_64.h>
2603 - #endif
2604 -+#include <asm/mce.h>
2605 -
2606 - /*
2607 - * end_pfn only includes RAM, while max_pfn_mapped includes all e820 entries.
2608 -@@ -1031,6 +1032,8 @@ void __init setup_arch(char **cmdline_p)
2609 - #endif
2610 - #endif
2611 - x86_init.oem.banner();
2612 -+
2613 -+ mcheck_intel_therm_init();
2614 - }
2615 -
2616 - #ifdef CONFIG_X86_32
2617 -diff --git a/arch/x86/kernel/tlb_uv.c b/arch/x86/kernel/tlb_uv.c
2618 -index 1740c85..364d015 100644
2619 ---- a/arch/x86/kernel/tlb_uv.c
2620 -+++ b/arch/x86/kernel/tlb_uv.c
2621 -@@ -817,10 +817,8 @@ static int __init uv_init_blade(int blade)
2622 - */
2623 - apicid = blade_to_first_apicid(blade);
2624 - pa = uv_read_global_mmr64(pnode, UVH_BAU_DATA_CONFIG);
2625 -- if ((pa & 0xff) != UV_BAU_MESSAGE) {
2626 -- uv_write_global_mmr64(pnode, UVH_BAU_DATA_CONFIG,
2627 -+ uv_write_global_mmr64(pnode, UVH_BAU_DATA_CONFIG,
2628 - ((apicid << 32) | UV_BAU_MESSAGE));
2629 -- }
2630 - return 0;
2631 - }
2632 -
2633 -diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
2634 -index 1be5cd6..e02dbb6 100644
2635 ---- a/arch/x86/kvm/emulate.c
2636 -+++ b/arch/x86/kvm/emulate.c
2637 -@@ -613,6 +613,9 @@ static int do_insn_fetch(struct x86_emulate_ctxt *ctxt,
2638 - {
2639 - int rc = 0;
2640 -
2641 -+ /* x86 instructions are limited to 15 bytes. */
2642 -+ if (eip + size - ctxt->decode.eip_orig > 15)
2643 -+ return X86EMUL_UNHANDLEABLE;
2644 - eip += ctxt->cs_base;
2645 - while (size--) {
2646 - rc = do_fetch_insn_byte(ctxt, ops, eip++, dest++);
2647 -@@ -871,7 +874,7 @@ x86_decode_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
2648 - /* Shadow copy of register state. Committed on successful emulation. */
2649 -
2650 - memset(c, 0, sizeof(struct decode_cache));
2651 -- c->eip = kvm_rip_read(ctxt->vcpu);
2652 -+ c->eip = c->eip_orig = kvm_rip_read(ctxt->vcpu);
2653 - ctxt->cs_base = seg_base(ctxt, VCPU_SREG_CS);
2654 - memcpy(c->regs, ctxt->vcpu->arch.regs, sizeof c->regs);
2655 -
2656 -diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
2657 -index ae07d26..97b31fa 100644
2658 ---- a/arch/x86/kvm/x86.c
2659 -+++ b/arch/x86/kvm/x86.c
2660 -@@ -484,16 +484,19 @@ static inline u32 bit(int bitno)
2661 - * and KVM_SET_MSRS, and KVM_GET_MSR_INDEX_LIST.
2662 - *
2663 - * This list is modified at module load time to reflect the
2664 -- * capabilities of the host cpu.
2665 -+ * capabilities of the host cpu. This capabilities test skips MSRs that are
2666 -+ * kvm-specific. Those are put in the beginning of the list.
2667 - */
2668 -+
2669 -+#define KVM_SAVE_MSRS_BEGIN 2
2670 - static u32 msrs_to_save[] = {
2671 -+ MSR_KVM_SYSTEM_TIME, MSR_KVM_WALL_CLOCK,
2672 - MSR_IA32_SYSENTER_CS, MSR_IA32_SYSENTER_ESP, MSR_IA32_SYSENTER_EIP,
2673 - MSR_K6_STAR,
2674 - #ifdef CONFIG_X86_64
2675 - MSR_CSTAR, MSR_KERNEL_GS_BASE, MSR_SYSCALL_MASK, MSR_LSTAR,
2676 - #endif
2677 -- MSR_IA32_TSC, MSR_KVM_SYSTEM_TIME, MSR_KVM_WALL_CLOCK,
2678 -- MSR_IA32_PERF_STATUS, MSR_IA32_CR_PAT, MSR_VM_HSAVE_PA
2679 -+ MSR_IA32_TSC, MSR_IA32_PERF_STATUS, MSR_IA32_CR_PAT, MSR_VM_HSAVE_PA
2680 - };
2681 -
2682 - static unsigned num_msrs_to_save;
2683 -@@ -2433,7 +2436,8 @@ static void kvm_init_msr_list(void)
2684 - u32 dummy[2];
2685 - unsigned i, j;
2686 -
2687 -- for (i = j = 0; i < ARRAY_SIZE(msrs_to_save); i++) {
2688 -+ /* skip the first msrs in the list. KVM-specific */
2689 -+ for (i = j = KVM_SAVE_MSRS_BEGIN; i < ARRAY_SIZE(msrs_to_save); i++) {
2690 - if (rdmsr_safe(msrs_to_save[i], &dummy[0], &dummy[1]) < 0)
2691 - continue;
2692 - if (j < i)
2693 -diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
2694 -index dfbf70e..79f9738 100644
2695 ---- a/arch/x86/xen/enlighten.c
2696 -+++ b/arch/x86/xen/enlighten.c
2697 -@@ -138,24 +138,23 @@ static void xen_vcpu_setup(int cpu)
2698 - */
2699 - void xen_vcpu_restore(void)
2700 - {
2701 -- if (have_vcpu_info_placement) {
2702 -- int cpu;
2703 -+ int cpu;
2704 -
2705 -- for_each_online_cpu(cpu) {
2706 -- bool other_cpu = (cpu != smp_processor_id());
2707 -+ for_each_online_cpu(cpu) {
2708 -+ bool other_cpu = (cpu != smp_processor_id());
2709 -
2710 -- if (other_cpu &&
2711 -- HYPERVISOR_vcpu_op(VCPUOP_down, cpu, NULL))
2712 -- BUG();
2713 -+ if (other_cpu &&
2714 -+ HYPERVISOR_vcpu_op(VCPUOP_down, cpu, NULL))
2715 -+ BUG();
2716 -
2717 -- xen_vcpu_setup(cpu);
2718 -+ xen_setup_runstate_info(cpu);
2719 -
2720 -- if (other_cpu &&
2721 -- HYPERVISOR_vcpu_op(VCPUOP_up, cpu, NULL))
2722 -- BUG();
2723 -- }
2724 -+ if (have_vcpu_info_placement)
2725 -+ xen_vcpu_setup(cpu);
2726 -
2727 -- BUG_ON(!have_vcpu_info_placement);
2728 -+ if (other_cpu &&
2729 -+ HYPERVISOR_vcpu_op(VCPUOP_up, cpu, NULL))
2730 -+ BUG();
2731 - }
2732 - }
2733 -
2734 -@@ -1182,6 +1181,8 @@ asmlinkage void __init xen_start_kernel(void)
2735 -
2736 - xen_raw_console_write("about to get started...\n");
2737 -
2738 -+ xen_setup_runstate_info(0);
2739 -+
2740 - /* Start the world */
2741 - #ifdef CONFIG_X86_32
2742 - i386_start_kernel();
2743 -diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
2744 -index 3bf7b1d..bf4cd6b 100644
2745 ---- a/arch/x86/xen/mmu.c
2746 -+++ b/arch/x86/xen/mmu.c
2747 -@@ -185,7 +185,7 @@ static inline unsigned p2m_index(unsigned long pfn)
2748 - }
2749 -
2750 - /* Build the parallel p2m_top_mfn structures */
2751 --static void __init xen_build_mfn_list_list(void)
2752 -+void xen_build_mfn_list_list(void)
2753 - {
2754 - unsigned pfn, idx;
2755 -
2756 -diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
2757 -index fe03eee..360f8d8 100644
2758 ---- a/arch/x86/xen/smp.c
2759 -+++ b/arch/x86/xen/smp.c
2760 -@@ -295,6 +295,7 @@ static int __cpuinit xen_cpu_up(unsigned int cpu)
2761 - (unsigned long)task_stack_page(idle) -
2762 - KERNEL_STACK_OFFSET + THREAD_SIZE;
2763 - #endif
2764 -+ xen_setup_runstate_info(cpu);
2765 - xen_setup_timer(cpu);
2766 - xen_init_lock_cpu(cpu);
2767 -
2768 -diff --git a/arch/x86/xen/suspend.c b/arch/x86/xen/suspend.c
2769 -index 95be7b4..987267f 100644
2770 ---- a/arch/x86/xen/suspend.c
2771 -+++ b/arch/x86/xen/suspend.c
2772 -@@ -1,4 +1,5 @@
2773 - #include <linux/types.h>
2774 -+#include <linux/clockchips.h>
2775 -
2776 - #include <xen/interface/xen.h>
2777 - #include <xen/grant_table.h>
2778 -@@ -27,6 +28,8 @@ void xen_pre_suspend(void)
2779 -
2780 - void xen_post_suspend(int suspend_cancelled)
2781 - {
2782 -+ xen_build_mfn_list_list();
2783 -+
2784 - xen_setup_shared_info();
2785 -
2786 - if (suspend_cancelled) {
2787 -@@ -44,7 +47,19 @@ void xen_post_suspend(int suspend_cancelled)
2788 -
2789 - }
2790 -
2791 -+static void xen_vcpu_notify_restore(void *data)
2792 -+{
2793 -+ unsigned long reason = (unsigned long)data;
2794 -+
2795 -+ /* Boot processor notified via generic timekeeping_resume() */
2796 -+ if ( smp_processor_id() == 0)
2797 -+ return;
2798 -+
2799 -+ clockevents_notify(reason, NULL);
2800 -+}
2801 -+
2802 - void xen_arch_resume(void)
2803 - {
2804 -- /* nothing */
2805 -+ smp_call_function(xen_vcpu_notify_restore,
2806 -+ (void *)CLOCK_EVT_NOTIFY_RESUME, 1);
2807 - }
2808 -diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
2809 -index 0a5aa44..9d1f853 100644
2810 ---- a/arch/x86/xen/time.c
2811 -+++ b/arch/x86/xen/time.c
2812 -@@ -100,7 +100,7 @@ bool xen_vcpu_stolen(int vcpu)
2813 - return per_cpu(runstate, vcpu).state == RUNSTATE_runnable;
2814 - }
2815 -
2816 --static void setup_runstate_info(int cpu)
2817 -+void xen_setup_runstate_info(int cpu)
2818 - {
2819 - struct vcpu_register_runstate_memory_area area;
2820 -
2821 -@@ -434,7 +434,7 @@ void xen_setup_timer(int cpu)
2822 - name = "<timer kasprintf failed>";
2823 -
2824 - irq = bind_virq_to_irqhandler(VIRQ_TIMER, cpu, xen_timer_interrupt,
2825 -- IRQF_DISABLED|IRQF_PERCPU|IRQF_NOBALANCING,
2826 -+ IRQF_DISABLED|IRQF_PERCPU|IRQF_NOBALANCING|IRQF_TIMER,
2827 - name, NULL);
2828 -
2829 - evt = &per_cpu(xen_clock_events, cpu);
2830 -@@ -442,8 +442,6 @@ void xen_setup_timer(int cpu)
2831 -
2832 - evt->cpumask = cpumask_of(cpu);
2833 - evt->irq = irq;
2834 --
2835 -- setup_runstate_info(cpu);
2836 - }
2837 -
2838 - void xen_teardown_timer(int cpu)
2839 -@@ -494,6 +492,7 @@ __init void xen_time_init(void)
2840 -
2841 - setup_force_cpu_cap(X86_FEATURE_TSC);
2842 -
2843 -+ xen_setup_runstate_info(cpu);
2844 - xen_setup_timer(cpu);
2845 - xen_setup_cpu_clockevents();
2846 - }
2847 -diff --git a/arch/x86/xen/xen-asm_64.S b/arch/x86/xen/xen-asm_64.S
2848 -index 02f496a..53adefd 100644
2849 ---- a/arch/x86/xen/xen-asm_64.S
2850 -+++ b/arch/x86/xen/xen-asm_64.S
2851 -@@ -96,7 +96,7 @@ ENTRY(xen_sysret32)
2852 - pushq $__USER32_CS
2853 - pushq %rcx
2854 -
2855 -- pushq $VGCF_in_syscall
2856 -+ pushq $0
2857 - 1: jmp hypercall_iret
2858 - ENDPATCH(xen_sysret32)
2859 - RELOC(xen_sysret32, 1b+1)
2860 -@@ -151,7 +151,7 @@ ENTRY(xen_syscall32_target)
2861 - ENTRY(xen_sysenter_target)
2862 - lea 16(%rsp), %rsp /* strip %rcx, %r11 */
2863 - mov $-ENOSYS, %rax
2864 -- pushq $VGCF_in_syscall
2865 -+ pushq $0
2866 - jmp hypercall_iret
2867 - ENDPROC(xen_syscall32_target)
2868 - ENDPROC(xen_sysenter_target)
2869 -diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
2870 -index 355fa6b..f9153a3 100644
2871 ---- a/arch/x86/xen/xen-ops.h
2872 -+++ b/arch/x86/xen/xen-ops.h
2873 -@@ -25,6 +25,7 @@ extern struct shared_info *HYPERVISOR_shared_info;
2874 -
2875 - void xen_setup_mfn_list_list(void);
2876 - void xen_setup_shared_info(void);
2877 -+void xen_build_mfn_list_list(void);
2878 - void xen_setup_machphys_mapping(void);
2879 - pgd_t *xen_setup_kernel_pagetable(pgd_t *pgd, unsigned long max_pfn);
2880 - void xen_ident_map_ISA(void);
2881 -@@ -41,6 +42,7 @@ void __init xen_build_dynamic_phys_to_machine(void);
2882 -
2883 - void xen_init_irq_ops(void);
2884 - void xen_setup_timer(int cpu);
2885 -+void xen_setup_runstate_info(int cpu);
2886 - void xen_teardown_timer(int cpu);
2887 - cycle_t xen_clocksource_read(void);
2888 - void xen_setup_cpu_clockevents(void);
2889 -diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c
2890 -index d0a7df2..ec07c53 100644
2891 ---- a/drivers/ata/pata_hpt37x.c
2892 -+++ b/drivers/ata/pata_hpt37x.c
2893 -@@ -24,7 +24,7 @@
2894 - #include <linux/libata.h>
2895 -
2896 - #define DRV_NAME "pata_hpt37x"
2897 --#define DRV_VERSION "0.6.12"
2898 -+#define DRV_VERSION "0.6.14"
2899 -
2900 - struct hpt_clock {
2901 - u8 xfer_speed;
2902 -@@ -404,9 +404,8 @@ static void hpt370_set_piomode(struct ata_port *ap, struct ata_device *adev)
2903 -
2904 - pci_read_config_dword(pdev, addr1, &reg);
2905 - mode = hpt37x_find_mode(ap, adev->pio_mode);
2906 -- mode &= ~0x8000000; /* No FIFO in PIO */
2907 -- mode &= ~0x30070000; /* Leave config bits alone */
2908 -- reg &= 0x30070000; /* Strip timing bits */
2909 -+ mode &= 0xCFC3FFFF; /* Leave DMA bits alone */
2910 -+ reg &= ~0xCFC3FFFF; /* Strip timing bits */
2911 - pci_write_config_dword(pdev, addr1, reg | mode);
2912 - }
2913 -
2914 -@@ -423,8 +422,7 @@ static void hpt370_set_dmamode(struct ata_port *ap, struct ata_device *adev)
2915 - {
2916 - struct pci_dev *pdev = to_pci_dev(ap->host->dev);
2917 - u32 addr1, addr2;
2918 -- u32 reg;
2919 -- u32 mode;
2920 -+ u32 reg, mode, mask;
2921 - u8 fast;
2922 -
2923 - addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no);
2924 -@@ -436,11 +434,12 @@ static void hpt370_set_dmamode(struct ata_port *ap, struct ata_device *adev)
2925 - fast |= 0x01;
2926 - pci_write_config_byte(pdev, addr2, fast);
2927 -
2928 -+ mask = adev->dma_mode < XFER_UDMA_0 ? 0x31C001FF : 0x303C0000;
2929 -+
2930 - pci_read_config_dword(pdev, addr1, &reg);
2931 - mode = hpt37x_find_mode(ap, adev->dma_mode);
2932 -- mode |= 0x8000000; /* FIFO in MWDMA or UDMA */
2933 -- mode &= ~0xC0000000; /* Leave config bits alone */
2934 -- reg &= 0xC0000000; /* Strip timing bits */
2935 -+ mode &= mask;
2936 -+ reg &= ~mask;
2937 - pci_write_config_dword(pdev, addr1, reg | mode);
2938 - }
2939 -
2940 -@@ -508,9 +507,8 @@ static void hpt372_set_piomode(struct ata_port *ap, struct ata_device *adev)
2941 - mode = hpt37x_find_mode(ap, adev->pio_mode);
2942 -
2943 - printk("Find mode for %d reports %X\n", adev->pio_mode, mode);
2944 -- mode &= ~0x80000000; /* No FIFO in PIO */
2945 -- mode &= ~0x30070000; /* Leave config bits alone */
2946 -- reg &= 0x30070000; /* Strip timing bits */
2947 -+ mode &= 0xCFC3FFFF; /* Leave DMA bits alone */
2948 -+ reg &= ~0xCFC3FFFF; /* Strip timing bits */
2949 - pci_write_config_dword(pdev, addr1, reg | mode);
2950 - }
2951 -
2952 -@@ -527,8 +525,7 @@ static void hpt372_set_dmamode(struct ata_port *ap, struct ata_device *adev)
2953 - {
2954 - struct pci_dev *pdev = to_pci_dev(ap->host->dev);
2955 - u32 addr1, addr2;
2956 -- u32 reg;
2957 -- u32 mode;
2958 -+ u32 reg, mode, mask;
2959 - u8 fast;
2960 -
2961 - addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no);
2962 -@@ -539,12 +536,13 @@ static void hpt372_set_dmamode(struct ata_port *ap, struct ata_device *adev)
2963 - fast &= ~0x07;
2964 - pci_write_config_byte(pdev, addr2, fast);
2965 -
2966 -+ mask = adev->dma_mode < XFER_UDMA_0 ? 0x31C001FF : 0x303C0000;
2967 -+
2968 - pci_read_config_dword(pdev, addr1, &reg);
2969 - mode = hpt37x_find_mode(ap, adev->dma_mode);
2970 - printk("Find mode for DMA %d reports %X\n", adev->dma_mode, mode);
2971 -- mode &= ~0xC0000000; /* Leave config bits alone */
2972 -- mode |= 0x80000000; /* FIFO in MWDMA or UDMA */
2973 -- reg &= 0xC0000000; /* Strip timing bits */
2974 -+ mode &= mask;
2975 -+ reg &= ~mask;
2976 - pci_write_config_dword(pdev, addr1, reg | mode);
2977 - }
2978 -
2979 -diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c
2980 -index 3d59fe0..21c5bd6 100644
2981 ---- a/drivers/ata/pata_hpt3x2n.c
2982 -+++ b/drivers/ata/pata_hpt3x2n.c
2983 -@@ -25,7 +25,7 @@
2984 - #include <linux/libata.h>
2985 -
2986 - #define DRV_NAME "pata_hpt3x2n"
2987 --#define DRV_VERSION "0.3.4"
2988 -+#define DRV_VERSION "0.3.7"
2989 -
2990 - enum {
2991 - HPT_PCI_FAST = (1 << 31),
2992 -@@ -185,9 +185,8 @@ static void hpt3x2n_set_piomode(struct ata_port *ap, struct ata_device *adev)
2993 -
2994 - pci_read_config_dword(pdev, addr1, &reg);
2995 - mode = hpt3x2n_find_mode(ap, adev->pio_mode);
2996 -- mode &= ~0x8000000; /* No FIFO in PIO */
2997 -- mode &= ~0x30070000; /* Leave config bits alone */
2998 -- reg &= 0x30070000; /* Strip timing bits */
2999 -+ mode &= 0xCFC3FFFF; /* Leave DMA bits alone */
3000 -+ reg &= ~0xCFC3FFFF; /* Strip timing bits */
3001 - pci_write_config_dword(pdev, addr1, reg | mode);
3002 - }
3003 -
3004 -@@ -204,8 +203,7 @@ static void hpt3x2n_set_dmamode(struct ata_port *ap, struct ata_device *adev)
3005 - {
3006 - struct pci_dev *pdev = to_pci_dev(ap->host->dev);
3007 - u32 addr1, addr2;
3008 -- u32 reg;
3009 -- u32 mode;
3010 -+ u32 reg, mode, mask;
3011 - u8 fast;
3012 -
3013 - addr1 = 0x40 + 4 * (adev->devno + 2 * ap->port_no);
3014 -@@ -216,11 +214,12 @@ static void hpt3x2n_set_dmamode(struct ata_port *ap, struct ata_device *adev)
3015 - fast &= ~0x07;
3016 - pci_write_config_byte(pdev, addr2, fast);
3017 -
3018 -+ mask = adev->dma_mode < XFER_UDMA_0 ? 0x31C001FF : 0x303C0000;
3019 -+
3020 - pci_read_config_dword(pdev, addr1, &reg);
3021 - mode = hpt3x2n_find_mode(ap, adev->dma_mode);
3022 -- mode |= 0x8000000; /* FIFO in MWDMA or UDMA */
3023 -- mode &= ~0xC0000000; /* Leave config bits alone */
3024 -- reg &= 0xC0000000; /* Strip timing bits */
3025 -+ mode &= mask;
3026 -+ reg &= ~mask;
3027 - pci_write_config_dword(pdev, addr1, reg | mode);
3028 - }
3029 -
3030 -diff --git a/drivers/base/core.c b/drivers/base/core.c
3031 -index 6bee6af..1093179 100644
3032 ---- a/drivers/base/core.c
3033 -+++ b/drivers/base/core.c
3034 -@@ -56,7 +56,14 @@ static inline int device_is_not_partition(struct device *dev)
3035 - */
3036 - const char *dev_driver_string(const struct device *dev)
3037 - {
3038 -- return dev->driver ? dev->driver->name :
3039 -+ struct device_driver *drv;
3040 -+
3041 -+ /* dev->driver can change to NULL underneath us because of unbinding,
3042 -+ * so be careful about accessing it. dev->bus and dev->class should
3043 -+ * never change once they are set, so they don't need special care.
3044 -+ */
3045 -+ drv = ACCESS_ONCE(dev->driver);
3046 -+ return drv ? drv->name :
3047 - (dev->bus ? dev->bus->name :
3048 - (dev->class ? dev->class->name : ""));
3049 - }
3050 -diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
3051 -index 846d89e..0a4b75f 100644
3052 ---- a/drivers/base/power/runtime.c
3053 -+++ b/drivers/base/power/runtime.c
3054 -@@ -777,7 +777,7 @@ int __pm_runtime_set_status(struct device *dev, unsigned int status)
3055 - }
3056 -
3057 - if (parent) {
3058 -- spin_lock(&parent->power.lock);
3059 -+ spin_lock_nested(&parent->power.lock, SINGLE_DEPTH_NESTING);
3060 -
3061 - /*
3062 - * It is invalid to put an active child under a parent that is
3063 -diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
3064 -index 94260aa..1e504de 100644
3065 ---- a/drivers/firewire/ohci.c
3066 -+++ b/drivers/firewire/ohci.c
3067 -@@ -2209,6 +2209,13 @@ static int ohci_queue_iso_receive_dualbuffer(struct fw_iso_context *base,
3068 - page = payload >> PAGE_SHIFT;
3069 - offset = payload & ~PAGE_MASK;
3070 - rest = p->payload_length;
3071 -+ /*
3072 -+ * The controllers I've tested have not worked correctly when
3073 -+ * second_req_count is zero. Rather than do something we know won't
3074 -+ * work, return an error
3075 -+ */
3076 -+ if (rest == 0)
3077 -+ return -EINVAL;
3078 -
3079 - /* FIXME: make packet-per-buffer/dual-buffer a context option */
3080 - while (rest > 0) {
3081 -@@ -2262,7 +2269,7 @@ static int ohci_queue_iso_receive_packet_per_buffer(struct fw_iso_context *base,
3082 - unsigned long payload)
3083 - {
3084 - struct iso_context *ctx = container_of(base, struct iso_context, base);
3085 -- struct descriptor *d = NULL, *pd = NULL;
3086 -+ struct descriptor *d, *pd;
3087 - struct fw_iso_packet *p = packet;
3088 - dma_addr_t d_bus, page_bus;
3089 - u32 z, header_z, rest;
3090 -@@ -2300,8 +2307,9 @@ static int ohci_queue_iso_receive_packet_per_buffer(struct fw_iso_context *base,
3091 - d->data_address = cpu_to_le32(d_bus + (z * sizeof(*d)));
3092 -
3093 - rest = payload_per_buffer;
3094 -+ pd = d;
3095 - for (j = 1; j < z; j++) {
3096 -- pd = d + j;
3097 -+ pd++;
3098 - pd->control = cpu_to_le16(DESCRIPTOR_STATUS |
3099 - DESCRIPTOR_INPUT_MORE);
3100 -
3101 -diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
3102 -index 0a6f0b3..332d743 100644
3103 ---- a/drivers/gpu/drm/drm_irq.c
3104 -+++ b/drivers/gpu/drm/drm_irq.c
3105 -@@ -429,15 +429,21 @@ int drm_vblank_get(struct drm_device *dev, int crtc)
3106 -
3107 - spin_lock_irqsave(&dev->vbl_lock, irqflags);
3108 - /* Going from 0->1 means we have to enable interrupts again */
3109 -- if (atomic_add_return(1, &dev->vblank_refcount[crtc]) == 1 &&
3110 -- !dev->vblank_enabled[crtc]) {
3111 -- ret = dev->driver->enable_vblank(dev, crtc);
3112 -- DRM_DEBUG("enabling vblank on crtc %d, ret: %d\n", crtc, ret);
3113 -- if (ret)
3114 -+ if (atomic_add_return(1, &dev->vblank_refcount[crtc]) == 1) {
3115 -+ if (!dev->vblank_enabled[crtc]) {
3116 -+ ret = dev->driver->enable_vblank(dev, crtc);
3117 -+ DRM_DEBUG("enabling vblank on crtc %d, ret: %d\n", crtc, ret);
3118 -+ if (ret)
3119 -+ atomic_dec(&dev->vblank_refcount[crtc]);
3120 -+ else {
3121 -+ dev->vblank_enabled[crtc] = 1;
3122 -+ drm_update_vblank_count(dev, crtc);
3123 -+ }
3124 -+ }
3125 -+ } else {
3126 -+ if (!dev->vblank_enabled[crtc]) {
3127 - atomic_dec(&dev->vblank_refcount[crtc]);
3128 -- else {
3129 -- dev->vblank_enabled[crtc] = 1;
3130 -- drm_update_vblank_count(dev, crtc);
3131 -+ ret = -EINVAL;
3132 - }
3133 - }
3134 - spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
3135 -@@ -464,6 +470,18 @@ void drm_vblank_put(struct drm_device *dev, int crtc)
3136 - }
3137 - EXPORT_SYMBOL(drm_vblank_put);
3138 -
3139 -+void drm_vblank_off(struct drm_device *dev, int crtc)
3140 -+{
3141 -+ unsigned long irqflags;
3142 -+
3143 -+ spin_lock_irqsave(&dev->vbl_lock, irqflags);
3144 -+ DRM_WAKEUP(&dev->vbl_queue[crtc]);
3145 -+ dev->vblank_enabled[crtc] = 0;
3146 -+ dev->last_vblank[crtc] = dev->driver->get_vblank_counter(dev, crtc);
3147 -+ spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
3148 -+}
3149 -+EXPORT_SYMBOL(drm_vblank_off);
3150 -+
3151 - /**
3152 - * drm_vblank_pre_modeset - account for vblanks across mode sets
3153 - * @dev: DRM device
3154 -diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
3155 -index a725f65..ecbafd0 100644
3156 ---- a/drivers/gpu/drm/i915/i915_drv.h
3157 -+++ b/drivers/gpu/drm/i915/i915_drv.h
3158 -@@ -957,6 +957,7 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
3159 - #define IS_I85X(dev) ((dev)->pci_device == 0x3582)
3160 - #define IS_I855(dev) ((dev)->pci_device == 0x3582)
3161 - #define IS_I865G(dev) ((dev)->pci_device == 0x2572)
3162 -+#define IS_I8XX(dev) (IS_I830(dev) || IS_845G(dev) || IS_I85X(dev) || IS_I865G(dev))
3163 -
3164 - #define IS_I915G(dev) ((dev)->pci_device == 0x2582 || (dev)->pci_device == 0x258a)
3165 - #define IS_I915GM(dev) ((dev)->pci_device == 0x2592)
3166 -@@ -1018,9 +1019,12 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
3167 - */
3168 - #define HAS_128_BYTE_Y_TILING(dev) (IS_I9XX(dev) && !(IS_I915G(dev) || \
3169 - IS_I915GM(dev)))
3170 -+#define SUPPORTS_DIGITAL_OUTPUTS(dev) (IS_I9XX(dev) && !IS_IGD(dev))
3171 - #define SUPPORTS_INTEGRATED_HDMI(dev) (IS_G4X(dev) || IS_IGDNG(dev))
3172 - #define SUPPORTS_INTEGRATED_DP(dev) (IS_G4X(dev) || IS_IGDNG(dev))
3173 - #define SUPPORTS_EDP(dev) (IS_IGDNG_M(dev))
3174 -+#define SUPPORTS_TV(dev) (IS_I9XX(dev) && IS_MOBILE(dev) && \
3175 -+ !IS_IGDNG(dev) && !IS_IGD(dev))
3176 - #define I915_HAS_HOTPLUG(dev) (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev) || IS_I965G(dev))
3177 - /* dsparb controlled by hw only */
3178 - #define DSPARB_HWCONTROL(dev) (IS_G4X(dev) || IS_IGDNG(dev))
3179 -diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
3180 -index abfc27b..5ddbd38 100644
3181 ---- a/drivers/gpu/drm/i915/i915_gem.c
3182 -+++ b/drivers/gpu/drm/i915/i915_gem.c
3183 -@@ -1288,6 +1288,7 @@ i915_gem_create_mmap_offset(struct drm_gem_object *obj)
3184 - list->hash.key = list->file_offset_node->start;
3185 - if (drm_ht_insert_item(&mm->offset_hash, &list->hash)) {
3186 - DRM_ERROR("failed to add to map hash\n");
3187 -+ ret = -ENOMEM;
3188 - goto out_free_mm;
3189 - }
3190 -
3191 -diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
3192 -index 099f420..f1de53b 100644
3193 ---- a/drivers/gpu/drm/i915/intel_display.c
3194 -+++ b/drivers/gpu/drm/i915/intel_display.c
3195 -@@ -1482,6 +1482,15 @@ static void igdng_crtc_dpms(struct drm_crtc *crtc, int mode)
3196 - case DRM_MODE_DPMS_STANDBY:
3197 - case DRM_MODE_DPMS_SUSPEND:
3198 - DRM_DEBUG("crtc %d dpms on\n", pipe);
3199 -+
3200 -+ if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
3201 -+ temp = I915_READ(PCH_LVDS);
3202 -+ if ((temp & LVDS_PORT_EN) == 0) {
3203 -+ I915_WRITE(PCH_LVDS, temp | LVDS_PORT_EN);
3204 -+ POSTING_READ(PCH_LVDS);
3205 -+ }
3206 -+ }
3207 -+
3208 - if (HAS_eDP) {
3209 - /* enable eDP PLL */
3210 - igdng_enable_pll_edp(crtc);
3211 -@@ -1666,8 +1675,6 @@ static void igdng_crtc_dpms(struct drm_crtc *crtc, int mode)
3212 - case DRM_MODE_DPMS_OFF:
3213 - DRM_DEBUG("crtc %d dpms off\n", pipe);
3214 -
3215 -- i915_disable_vga(dev);
3216 --
3217 - /* Disable display plane */
3218 - temp = I915_READ(dspcntr_reg);
3219 - if ((temp & DISPLAY_PLANE_ENABLE) != 0) {
3220 -@@ -1677,6 +1684,8 @@ static void igdng_crtc_dpms(struct drm_crtc *crtc, int mode)
3221 - I915_READ(dspbase_reg);
3222 - }
3223 -
3224 -+ i915_disable_vga(dev);
3225 -+
3226 - /* disable cpu pipe, disable after all planes disabled */
3227 - temp = I915_READ(pipeconf_reg);
3228 - if ((temp & PIPEACONF_ENABLE) != 0) {
3229 -@@ -1697,9 +1706,15 @@ static void igdng_crtc_dpms(struct drm_crtc *crtc, int mode)
3230 - } else
3231 - DRM_DEBUG("crtc %d is disabled\n", pipe);
3232 -
3233 -- if (HAS_eDP) {
3234 -- igdng_disable_pll_edp(crtc);
3235 -+ udelay(100);
3236 -+
3237 -+ /* Disable PF */
3238 -+ temp = I915_READ(pf_ctl_reg);
3239 -+ if ((temp & PF_ENABLE) != 0) {
3240 -+ I915_WRITE(pf_ctl_reg, temp & ~PF_ENABLE);
3241 -+ I915_READ(pf_ctl_reg);
3242 - }
3243 -+ I915_WRITE(pf_win_size, 0);
3244 -
3245 - /* disable CPU FDI tx and PCH FDI rx */
3246 - temp = I915_READ(fdi_tx_reg);
3247 -@@ -1725,6 +1740,13 @@ static void igdng_crtc_dpms(struct drm_crtc *crtc, int mode)
3248 -
3249 - udelay(100);
3250 -
3251 -+ if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS)) {
3252 -+ temp = I915_READ(PCH_LVDS);
3253 -+ I915_WRITE(PCH_LVDS, temp & ~LVDS_PORT_EN);
3254 -+ I915_READ(PCH_LVDS);
3255 -+ udelay(100);
3256 -+ }
3257 -+
3258 - /* disable PCH transcoder */
3259 - temp = I915_READ(transconf_reg);
3260 - if ((temp & TRANS_ENABLE) != 0) {
3261 -@@ -1744,6 +1766,8 @@ static void igdng_crtc_dpms(struct drm_crtc *crtc, int mode)
3262 - }
3263 - }
3264 -
3265 -+ udelay(100);
3266 -+
3267 - /* disable PCH DPLL */
3268 - temp = I915_READ(pch_dpll_reg);
3269 - if ((temp & DPLL_VCO_ENABLE) != 0) {
3270 -@@ -1751,14 +1775,20 @@ static void igdng_crtc_dpms(struct drm_crtc *crtc, int mode)
3271 - I915_READ(pch_dpll_reg);
3272 - }
3273 -
3274 -- temp = I915_READ(fdi_rx_reg);
3275 -- if ((temp & FDI_RX_PLL_ENABLE) != 0) {
3276 -- temp &= ~FDI_SEL_PCDCLK;
3277 -- temp &= ~FDI_RX_PLL_ENABLE;
3278 -- I915_WRITE(fdi_rx_reg, temp);
3279 -- I915_READ(fdi_rx_reg);
3280 -+ if (HAS_eDP) {
3281 -+ igdng_disable_pll_edp(crtc);
3282 - }
3283 -
3284 -+ temp = I915_READ(fdi_rx_reg);
3285 -+ temp &= ~FDI_SEL_PCDCLK;
3286 -+ I915_WRITE(fdi_rx_reg, temp);
3287 -+ I915_READ(fdi_rx_reg);
3288 -+
3289 -+ temp = I915_READ(fdi_rx_reg);
3290 -+ temp &= ~FDI_RX_PLL_ENABLE;
3291 -+ I915_WRITE(fdi_rx_reg, temp);
3292 -+ I915_READ(fdi_rx_reg);
3293 -+
3294 - /* Disable CPU FDI TX PLL */
3295 - temp = I915_READ(fdi_tx_reg);
3296 - if ((temp & FDI_TX_PLL_ENABLE) != 0) {
3297 -@@ -1767,16 +1797,8 @@ static void igdng_crtc_dpms(struct drm_crtc *crtc, int mode)
3298 - udelay(100);
3299 - }
3300 -
3301 -- /* Disable PF */
3302 -- temp = I915_READ(pf_ctl_reg);
3303 -- if ((temp & PF_ENABLE) != 0) {
3304 -- I915_WRITE(pf_ctl_reg, temp & ~PF_ENABLE);
3305 -- I915_READ(pf_ctl_reg);
3306 -- }
3307 -- I915_WRITE(pf_win_size, 0);
3308 --
3309 - /* Wait for the clocks to turn off. */
3310 -- udelay(150);
3311 -+ udelay(100);
3312 - break;
3313 - }
3314 - }
3315 -@@ -1845,6 +1867,7 @@ static void i9xx_crtc_dpms(struct drm_crtc *crtc, int mode)
3316 - intel_update_watermarks(dev);
3317 - /* Give the overlay scaler a chance to disable if it's on this pipe */
3318 - //intel_crtc_dpms_video(crtc, FALSE); TODO
3319 -+ drm_vblank_off(dev, pipe);
3320 -
3321 - if (dev_priv->cfb_plane == plane &&
3322 - dev_priv->display.disable_fbc)
3323 -@@ -4118,7 +4141,7 @@ static void intel_setup_outputs(struct drm_device *dev)
3324 - if (I915_READ(PCH_DP_D) & DP_DETECTED)
3325 - intel_dp_init(dev, PCH_DP_D);
3326 -
3327 -- } else if (IS_I9XX(dev)) {
3328 -+ } else if (SUPPORTS_DIGITAL_OUTPUTS(dev)) {
3329 - bool found = false;
3330 -
3331 - if (I915_READ(SDVOB) & SDVO_DETECTED) {
3332 -@@ -4145,10 +4168,10 @@ static void intel_setup_outputs(struct drm_device *dev)
3333 -
3334 - if (SUPPORTS_INTEGRATED_DP(dev) && (I915_READ(DP_D) & DP_DETECTED))
3335 - intel_dp_init(dev, DP_D);
3336 -- } else
3337 -+ } else if (IS_I8XX(dev))
3338 - intel_dvo_init(dev);
3339 -
3340 -- if (IS_I9XX(dev) && IS_MOBILE(dev) && !IS_IGDNG(dev))
3341 -+ if (SUPPORTS_TV(dev))
3342 - intel_tv_init(dev);
3343 -
3344 - list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
3345 -diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
3346 -index d834475..92a3d7b 100644
3347 ---- a/drivers/gpu/drm/i915/intel_dp.c
3348 -+++ b/drivers/gpu/drm/i915/intel_dp.c
3349 -@@ -1254,11 +1254,11 @@ intel_dp_init(struct drm_device *dev, int output_reg)
3350 - else
3351 - intel_output->type = INTEL_OUTPUT_DISPLAYPORT;
3352 -
3353 -- if (output_reg == DP_B)
3354 -+ if (output_reg == DP_B || output_reg == PCH_DP_B)
3355 - intel_output->clone_mask = (1 << INTEL_DP_B_CLONE_BIT);
3356 -- else if (output_reg == DP_C)
3357 -+ else if (output_reg == DP_C || output_reg == PCH_DP_C)
3358 - intel_output->clone_mask = (1 << INTEL_DP_C_CLONE_BIT);
3359 -- else if (output_reg == DP_D)
3360 -+ else if (output_reg == DP_D || output_reg == PCH_DP_D)
3361 - intel_output->clone_mask = (1 << INTEL_DP_D_CLONE_BIT);
3362 -
3363 - if (IS_eDP(intel_output)) {
3364 -diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
3365 -index 9ca9179..5b28b4e 100644
3366 ---- a/drivers/gpu/drm/i915/intel_tv.c
3367 -+++ b/drivers/gpu/drm/i915/intel_tv.c
3368 -@@ -1213,20 +1213,17 @@ intel_tv_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
3369 - tv_ctl |= TV_TRILEVEL_SYNC;
3370 - if (tv_mode->pal_burst)
3371 - tv_ctl |= TV_PAL_BURST;
3372 -+
3373 - scctl1 = 0;
3374 -- /* dda1 implies valid video levels */
3375 -- if (tv_mode->dda1_inc) {
3376 -+ if (tv_mode->dda1_inc)
3377 - scctl1 |= TV_SC_DDA1_EN;
3378 -- }
3379 --
3380 - if (tv_mode->dda2_inc)
3381 - scctl1 |= TV_SC_DDA2_EN;
3382 --
3383 - if (tv_mode->dda3_inc)
3384 - scctl1 |= TV_SC_DDA3_EN;
3385 --
3386 - scctl1 |= tv_mode->sc_reset;
3387 -- scctl1 |= video_levels->burst << TV_BURST_LEVEL_SHIFT;
3388 -+ if (video_levels)
3389 -+ scctl1 |= video_levels->burst << TV_BURST_LEVEL_SHIFT;
3390 - scctl1 |= tv_mode->dda1_inc << TV_SCDDA1_INC_SHIFT;
3391 -
3392 - scctl2 = tv_mode->dda2_size << TV_SCDDA2_SIZE_SHIFT |
3393 -diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
3394 -index c15287a..c6777cb 100644
3395 ---- a/drivers/gpu/drm/radeon/atombios_crtc.c
3396 -+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
3397 -@@ -241,6 +241,7 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode)
3398 - {
3399 - struct drm_device *dev = crtc->dev;
3400 - struct radeon_device *rdev = dev->dev_private;
3401 -+ struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
3402 -
3403 - switch (mode) {
3404 - case DRM_MODE_DPMS_ON:
3405 -@@ -248,20 +249,19 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode)
3406 - if (ASIC_IS_DCE3(rdev))
3407 - atombios_enable_crtc_memreq(crtc, 1);
3408 - atombios_blank_crtc(crtc, 0);
3409 -+ drm_vblank_post_modeset(dev, radeon_crtc->crtc_id);
3410 -+ radeon_crtc_load_lut(crtc);
3411 - break;
3412 - case DRM_MODE_DPMS_STANDBY:
3413 - case DRM_MODE_DPMS_SUSPEND:
3414 - case DRM_MODE_DPMS_OFF:
3415 -+ drm_vblank_pre_modeset(dev, radeon_crtc->crtc_id);
3416 - atombios_blank_crtc(crtc, 1);
3417 - if (ASIC_IS_DCE3(rdev))
3418 - atombios_enable_crtc_memreq(crtc, 0);
3419 - atombios_enable_crtc(crtc, 0);
3420 - break;
3421 - }
3422 --
3423 -- if (mode != DRM_MODE_DPMS_OFF) {
3424 -- radeon_crtc_load_lut(crtc);
3425 -- }
3426 - }
3427 -
3428 - static void
3429 -diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
3430 -index 2ed88a8..969502a 100644
3431 ---- a/drivers/gpu/drm/radeon/radeon_atombios.c
3432 -+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
3433 -@@ -135,6 +135,14 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev,
3434 - }
3435 - }
3436 -
3437 -+ /* HIS X1300 is DVI+VGA, not DVI+DVI */
3438 -+ if ((dev->pdev->device == 0x7146) &&
3439 -+ (dev->pdev->subsystem_vendor == 0x17af) &&
3440 -+ (dev->pdev->subsystem_device == 0x2058)) {
3441 -+ if (supported_device == ATOM_DEVICE_DFP1_SUPPORT)
3442 -+ return false;
3443 -+ }
3444 -+
3445 - /* Funky macbooks */
3446 - if ((dev->pdev->device == 0x71C5) &&
3447 - (dev->pdev->subsystem_vendor == 0x106b) &&
3448 -diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
3449 -index 8d0b7aa..22ce4d6 100644
3450 ---- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
3451 -+++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
3452 -@@ -292,8 +292,7 @@ void radeon_crtc_dpms(struct drm_crtc *crtc, int mode)
3453 - uint32_t mask;
3454 -
3455 - if (radeon_crtc->crtc_id)
3456 -- mask = (RADEON_CRTC2_EN |
3457 -- RADEON_CRTC2_DISP_DIS |
3458 -+ mask = (RADEON_CRTC2_DISP_DIS |
3459 - RADEON_CRTC2_VSYNC_DIS |
3460 - RADEON_CRTC2_HSYNC_DIS |
3461 - RADEON_CRTC2_DISP_REQ_EN_B);
3462 -@@ -305,7 +304,7 @@ void radeon_crtc_dpms(struct drm_crtc *crtc, int mode)
3463 - switch (mode) {
3464 - case DRM_MODE_DPMS_ON:
3465 - if (radeon_crtc->crtc_id)
3466 -- WREG32_P(RADEON_CRTC2_GEN_CNTL, RADEON_CRTC2_EN, ~mask);
3467 -+ WREG32_P(RADEON_CRTC2_GEN_CNTL, RADEON_CRTC2_EN, ~(RADEON_CRTC2_EN | mask));
3468 - else {
3469 - WREG32_P(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_EN, ~(RADEON_CRTC_EN |
3470 - RADEON_CRTC_DISP_REQ_EN_B));
3471 -@@ -319,7 +318,7 @@ void radeon_crtc_dpms(struct drm_crtc *crtc, int mode)
3472 - case DRM_MODE_DPMS_OFF:
3473 - drm_vblank_pre_modeset(dev, radeon_crtc->crtc_id);
3474 - if (radeon_crtc->crtc_id)
3475 -- WREG32_P(RADEON_CRTC2_GEN_CNTL, mask, ~mask);
3476 -+ WREG32_P(RADEON_CRTC2_GEN_CNTL, mask, ~(RADEON_CRTC2_EN | mask));
3477 - else {
3478 - WREG32_P(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_DISP_REQ_EN_B, ~(RADEON_CRTC_EN |
3479 - RADEON_CRTC_DISP_REQ_EN_B));
3480 -diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
3481 -index 5f117cd..4444f48 100644
3482 ---- a/drivers/gpu/drm/radeon/rs600.c
3483 -+++ b/drivers/gpu/drm/radeon/rs600.c
3484 -@@ -301,9 +301,7 @@ int rs600_mc_wait_for_idle(struct radeon_device *rdev)
3485 -
3486 - void rs600_gpu_init(struct radeon_device *rdev)
3487 - {
3488 -- /* FIXME: HDP same place on rs600 ? */
3489 - r100_hdp_reset(rdev);
3490 -- /* FIXME: is this correct ? */
3491 - r420_pipes_init(rdev);
3492 - /* Wait for mc idle */
3493 - if (rs600_mc_wait_for_idle(rdev))
3494 -@@ -312,9 +310,20 @@ void rs600_gpu_init(struct radeon_device *rdev)
3495 -
3496 - void rs600_vram_info(struct radeon_device *rdev)
3497 - {
3498 -- /* FIXME: to do or is these values sane ? */
3499 - rdev->mc.vram_is_ddr = true;
3500 - rdev->mc.vram_width = 128;
3501 -+
3502 -+ rdev->mc.real_vram_size = RREG32(RADEON_CONFIG_MEMSIZE);
3503 -+ rdev->mc.mc_vram_size = rdev->mc.real_vram_size;
3504 -+
3505 -+ rdev->mc.aper_base = drm_get_resource_start(rdev->ddev, 0);
3506 -+ rdev->mc.aper_size = drm_get_resource_len(rdev->ddev, 0);
3507 -+
3508 -+ if (rdev->mc.mc_vram_size > rdev->mc.aper_size)
3509 -+ rdev->mc.mc_vram_size = rdev->mc.aper_size;
3510 -+
3511 -+ if (rdev->mc.real_vram_size > rdev->mc.aper_size)
3512 -+ rdev->mc.real_vram_size = rdev->mc.aper_size;
3513 - }
3514 -
3515 - void rs600_bandwidth_update(struct radeon_device *rdev)
3516 -diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c
3517 -index 2754717..b12ff76 100644
3518 ---- a/drivers/gpu/drm/radeon/rs690.c
3519 -+++ b/drivers/gpu/drm/radeon/rs690.c
3520 -@@ -131,24 +131,25 @@ void rs690_pm_info(struct radeon_device *rdev)
3521 -
3522 - void rs690_vram_info(struct radeon_device *rdev)
3523 - {
3524 -- uint32_t tmp;
3525 - fixed20_12 a;
3526 -
3527 - rs400_gart_adjust_size(rdev);
3528 -- /* DDR for all card after R300 & IGP */
3529 -+
3530 - rdev->mc.vram_is_ddr = true;
3531 -- /* FIXME: is this correct for RS690/RS740 ? */
3532 -- tmp = RREG32(RADEON_MEM_CNTL);
3533 -- if (tmp & R300_MEM_NUM_CHANNELS_MASK) {
3534 -- rdev->mc.vram_width = 128;
3535 -- } else {
3536 -- rdev->mc.vram_width = 64;
3537 -- }
3538 -+ rdev->mc.vram_width = 128;
3539 -+
3540 - rdev->mc.real_vram_size = RREG32(RADEON_CONFIG_MEMSIZE);
3541 - rdev->mc.mc_vram_size = rdev->mc.real_vram_size;
3542 -
3543 - rdev->mc.aper_base = drm_get_resource_start(rdev->ddev, 0);
3544 - rdev->mc.aper_size = drm_get_resource_len(rdev->ddev, 0);
3545 -+
3546 -+ if (rdev->mc.mc_vram_size > rdev->mc.aper_size)
3547 -+ rdev->mc.mc_vram_size = rdev->mc.aper_size;
3548 -+
3549 -+ if (rdev->mc.real_vram_size > rdev->mc.aper_size)
3550 -+ rdev->mc.real_vram_size = rdev->mc.aper_size;
3551 -+
3552 - rs690_pm_info(rdev);
3553 - /* FIXME: we should enforce default clock in case GPU is not in
3554 - * default setup
3555 -diff --git a/drivers/ide/slc90e66.c b/drivers/ide/slc90e66.c
3556 -index 9aec78d..1ccfb40 100644
3557 ---- a/drivers/ide/slc90e66.c
3558 -+++ b/drivers/ide/slc90e66.c
3559 -@@ -91,8 +91,7 @@ static void slc90e66_set_dma_mode(ide_drive_t *drive, const u8 speed)
3560 -
3561 - if (!(reg48 & u_flag))
3562 - pci_write_config_word(dev, 0x48, reg48|u_flag);
3563 -- /* FIXME: (reg4a & a_speed) ? */
3564 -- if ((reg4a & u_speed) != u_speed) {
3565 -+ if ((reg4a & a_speed) != u_speed) {
3566 - pci_write_config_word(dev, 0x4a, reg4a & ~a_speed);
3567 - pci_read_config_word(dev, 0x4a, &reg4a);
3568 - pci_write_config_word(dev, 0x4a, reg4a|u_speed);
3569 -diff --git a/drivers/macintosh/therm_adt746x.c b/drivers/macintosh/therm_adt746x.c
3570 -index 556f0fe..386a797 100644
3571 ---- a/drivers/macintosh/therm_adt746x.c
3572 -+++ b/drivers/macintosh/therm_adt746x.c
3573 -@@ -79,6 +79,7 @@ struct thermostat {
3574 - u8 limits[3];
3575 - int last_speed[2];
3576 - int last_var[2];
3577 -+ int pwm_inv[2];
3578 - };
3579 -
3580 - static enum {ADT7460, ADT7467} therm_type;
3581 -@@ -229,19 +230,23 @@ static void write_fan_speed(struct thermostat *th, int speed, int fan)
3582 -
3583 - if (speed >= 0) {
3584 - manual = read_reg(th, MANUAL_MODE[fan]);
3585 -+ manual &= ~INVERT_MASK;
3586 - write_reg(th, MANUAL_MODE[fan],
3587 -- (manual|MANUAL_MASK) & (~INVERT_MASK));
3588 -+ manual | MANUAL_MASK | th->pwm_inv[fan]);
3589 - write_reg(th, FAN_SPD_SET[fan], speed);
3590 - } else {
3591 - /* back to automatic */
3592 - if(therm_type == ADT7460) {
3593 - manual = read_reg(th,
3594 - MANUAL_MODE[fan]) & (~MANUAL_MASK);
3595 --
3596 -+ manual &= ~INVERT_MASK;
3597 -+ manual |= th->pwm_inv[fan];
3598 - write_reg(th,
3599 - MANUAL_MODE[fan], manual|REM_CONTROL[fan]);
3600 - } else {
3601 - manual = read_reg(th, MANUAL_MODE[fan]);
3602 -+ manual &= ~INVERT_MASK;
3603 -+ manual |= th->pwm_inv[fan];
3604 - write_reg(th, MANUAL_MODE[fan], manual&(~AUTO_MASK));
3605 - }
3606 - }
3607 -@@ -418,6 +423,10 @@ static int probe_thermostat(struct i2c_client *client,
3608 -
3609 - thermostat = th;
3610 -
3611 -+ /* record invert bit status because fw can corrupt it after suspend */
3612 -+ th->pwm_inv[0] = read_reg(th, MANUAL_MODE[0]) & INVERT_MASK;
3613 -+ th->pwm_inv[1] = read_reg(th, MANUAL_MODE[1]) & INVERT_MASK;
3614 -+
3615 - /* be sure to really write fan speed the first time */
3616 - th->last_speed[0] = -2;
3617 - th->last_speed[1] = -2;
3618 -diff --git a/drivers/macintosh/windfarm_smu_controls.c b/drivers/macintosh/windfarm_smu_controls.c
3619 -index 961fa0e..6c68b9e 100644
3620 ---- a/drivers/macintosh/windfarm_smu_controls.c
3621 -+++ b/drivers/macintosh/windfarm_smu_controls.c
3622 -@@ -202,6 +202,8 @@ static struct smu_fan_control *smu_fan_create(struct device_node *node,
3623 - fct->ctrl.name = "cpu-front-fan-1";
3624 - else if (!strcmp(l, "CPU A PUMP"))
3625 - fct->ctrl.name = "cpu-pump-0";
3626 -+ else if (!strcmp(l, "CPU B PUMP"))
3627 -+ fct->ctrl.name = "cpu-pump-1";
3628 - else if (!strcmp(l, "Slots Fan") || !strcmp(l, "Slots fan") ||
3629 - !strcmp(l, "EXPANSION SLOTS INTAKE"))
3630 - fct->ctrl.name = "slots-fan";
3631 -diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
3632 -index 60e2b32..a5e5f2f 100644
3633 ---- a/drivers/md/bitmap.c
3634 -+++ b/drivers/md/bitmap.c
3635 -@@ -1078,23 +1078,31 @@ static bitmap_counter_t *bitmap_get_counter(struct bitmap *bitmap,
3636 - * out to disk
3637 - */
3638 -
3639 --void bitmap_daemon_work(struct bitmap *bitmap)
3640 -+void bitmap_daemon_work(mddev_t *mddev)
3641 - {
3642 -+ struct bitmap *bitmap;
3643 - unsigned long j;
3644 - unsigned long flags;
3645 - struct page *page = NULL, *lastpage = NULL;
3646 - int blocks;
3647 - void *paddr;
3648 -
3649 -- if (bitmap == NULL)
3650 -+ /* Use a mutex to guard daemon_work against
3651 -+ * bitmap_destroy.
3652 -+ */
3653 -+ mutex_lock(&mddev->bitmap_mutex);
3654 -+ bitmap = mddev->bitmap;
3655 -+ if (bitmap == NULL) {
3656 -+ mutex_unlock(&mddev->bitmap_mutex);
3657 - return;
3658 -+ }
3659 - if (time_before(jiffies, bitmap->daemon_lastrun + bitmap->daemon_sleep*HZ))
3660 - goto done;
3661 -
3662 - bitmap->daemon_lastrun = jiffies;
3663 - if (bitmap->allclean) {
3664 - bitmap->mddev->thread->timeout = MAX_SCHEDULE_TIMEOUT;
3665 -- return;
3666 -+ goto done;
3667 - }
3668 - bitmap->allclean = 1;
3669 -
3670 -@@ -1203,6 +1211,7 @@ void bitmap_daemon_work(struct bitmap *bitmap)
3671 - done:
3672 - if (bitmap->allclean == 0)
3673 - bitmap->mddev->thread->timeout = bitmap->daemon_sleep * HZ;
3674 -+ mutex_unlock(&mddev->bitmap_mutex);
3675 - }
3676 -
3677 - static bitmap_counter_t *bitmap_get_counter(struct bitmap *bitmap,
3678 -@@ -1541,9 +1550,9 @@ void bitmap_flush(mddev_t *mddev)
3679 - */
3680 - sleep = bitmap->daemon_sleep;
3681 - bitmap->daemon_sleep = 0;
3682 -- bitmap_daemon_work(bitmap);
3683 -- bitmap_daemon_work(bitmap);
3684 -- bitmap_daemon_work(bitmap);
3685 -+ bitmap_daemon_work(mddev);
3686 -+ bitmap_daemon_work(mddev);
3687 -+ bitmap_daemon_work(mddev);
3688 - bitmap->daemon_sleep = sleep;
3689 - bitmap_update_sb(bitmap);
3690 - }
3691 -@@ -1574,6 +1583,7 @@ static void bitmap_free(struct bitmap *bitmap)
3692 - kfree(bp);
3693 - kfree(bitmap);
3694 - }
3695 -+
3696 - void bitmap_destroy(mddev_t *mddev)
3697 - {
3698 - struct bitmap *bitmap = mddev->bitmap;
3699 -@@ -1581,7 +1591,9 @@ void bitmap_destroy(mddev_t *mddev)
3700 - if (!bitmap) /* there was no bitmap */
3701 - return;
3702 -
3703 -+ mutex_lock(&mddev->bitmap_mutex);
3704 - mddev->bitmap = NULL; /* disconnect from the md device */
3705 -+ mutex_unlock(&mddev->bitmap_mutex);
3706 - if (mddev->thread)
3707 - mddev->thread->timeout = MAX_SCHEDULE_TIMEOUT;
3708 -
3709 -diff --git a/drivers/md/bitmap.h b/drivers/md/bitmap.h
3710 -index e989006..7e38d13 100644
3711 ---- a/drivers/md/bitmap.h
3712 -+++ b/drivers/md/bitmap.h
3713 -@@ -282,7 +282,7 @@ void bitmap_close_sync(struct bitmap *bitmap);
3714 - void bitmap_cond_end_sync(struct bitmap *bitmap, sector_t sector);
3715 -
3716 - void bitmap_unplug(struct bitmap *bitmap);
3717 --void bitmap_daemon_work(struct bitmap *bitmap);
3718 -+void bitmap_daemon_work(mddev_t *mddev);
3719 - #endif
3720 -
3721 - #endif
3722 -diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
3723 -index ed10381..959d6d1 100644
3724 ---- a/drivers/md/dm-crypt.c
3725 -+++ b/drivers/md/dm-crypt.c
3726 -@@ -1,7 +1,7 @@
3727 - /*
3728 - * Copyright (C) 2003 Christophe Saout <christophe@×××××.de>
3729 - * Copyright (C) 2004 Clemens Fruhwirth <clemens@×××××××××.org>
3730 -- * Copyright (C) 2006-2008 Red Hat, Inc. All rights reserved.
3731 -+ * Copyright (C) 2006-2009 Red Hat, Inc. All rights reserved.
3732 - *
3733 - * This file is released under the GPL.
3734 - */
3735 -@@ -71,10 +71,21 @@ struct crypt_iv_operations {
3736 - int (*ctr)(struct crypt_config *cc, struct dm_target *ti,
3737 - const char *opts);
3738 - void (*dtr)(struct crypt_config *cc);
3739 -- const char *(*status)(struct crypt_config *cc);
3740 -+ int (*init)(struct crypt_config *cc);
3741 -+ int (*wipe)(struct crypt_config *cc);
3742 - int (*generator)(struct crypt_config *cc, u8 *iv, sector_t sector);
3743 - };
3744 -
3745 -+struct iv_essiv_private {
3746 -+ struct crypto_cipher *tfm;
3747 -+ struct crypto_hash *hash_tfm;
3748 -+ u8 *salt;
3749 -+};
3750 -+
3751 -+struct iv_benbi_private {
3752 -+ int shift;
3753 -+};
3754 -+
3755 - /*
3756 - * Crypt: maps a linear range of a block device
3757 - * and encrypts / decrypts at the same time.
3758 -@@ -102,8 +113,8 @@ struct crypt_config {
3759 - struct crypt_iv_operations *iv_gen_ops;
3760 - char *iv_mode;
3761 - union {
3762 -- struct crypto_cipher *essiv_tfm;
3763 -- int benbi_shift;
3764 -+ struct iv_essiv_private essiv;
3765 -+ struct iv_benbi_private benbi;
3766 - } iv_gen_private;
3767 - sector_t iv_offset;
3768 - unsigned int iv_size;
3769 -@@ -169,88 +180,114 @@ static int crypt_iv_plain_gen(struct crypt_config *cc, u8 *iv, sector_t sector)
3770 - return 0;
3771 - }
3772 -
3773 --static int crypt_iv_essiv_ctr(struct crypt_config *cc, struct dm_target *ti,
3774 -- const char *opts)
3775 -+/* Initialise ESSIV - compute salt but no local memory allocations */
3776 -+static int crypt_iv_essiv_init(struct crypt_config *cc)
3777 - {
3778 -- struct crypto_cipher *essiv_tfm;
3779 -- struct crypto_hash *hash_tfm;
3780 -+ struct iv_essiv_private *essiv = &cc->iv_gen_private.essiv;
3781 - struct hash_desc desc;
3782 - struct scatterlist sg;
3783 -- unsigned int saltsize;
3784 -- u8 *salt;
3785 - int err;
3786 -
3787 -- if (opts == NULL) {
3788 -+ sg_init_one(&sg, cc->key, cc->key_size);
3789 -+ desc.tfm = essiv->hash_tfm;
3790 -+ desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP;
3791 -+
3792 -+ err = crypto_hash_digest(&desc, &sg, cc->key_size, essiv->salt);
3793 -+ if (err)
3794 -+ return err;
3795 -+
3796 -+ return crypto_cipher_setkey(essiv->tfm, essiv->salt,
3797 -+ crypto_hash_digestsize(essiv->hash_tfm));
3798 -+}
3799 -+
3800 -+/* Wipe salt and reset key derived from volume key */
3801 -+static int crypt_iv_essiv_wipe(struct crypt_config *cc)
3802 -+{
3803 -+ struct iv_essiv_private *essiv = &cc->iv_gen_private.essiv;
3804 -+ unsigned salt_size = crypto_hash_digestsize(essiv->hash_tfm);
3805 -+
3806 -+ memset(essiv->salt, 0, salt_size);
3807 -+
3808 -+ return crypto_cipher_setkey(essiv->tfm, essiv->salt, salt_size);
3809 -+}
3810 -+
3811 -+static void crypt_iv_essiv_dtr(struct crypt_config *cc)
3812 -+{
3813 -+ struct iv_essiv_private *essiv = &cc->iv_gen_private.essiv;
3814 -+
3815 -+ crypto_free_cipher(essiv->tfm);
3816 -+ essiv->tfm = NULL;
3817 -+
3818 -+ crypto_free_hash(essiv->hash_tfm);
3819 -+ essiv->hash_tfm = NULL;
3820 -+
3821 -+ kzfree(essiv->salt);
3822 -+ essiv->salt = NULL;
3823 -+}
3824 -+
3825 -+static int crypt_iv_essiv_ctr(struct crypt_config *cc, struct dm_target *ti,
3826 -+ const char *opts)
3827 -+{
3828 -+ struct crypto_cipher *essiv_tfm = NULL;
3829 -+ struct crypto_hash *hash_tfm = NULL;
3830 -+ u8 *salt = NULL;
3831 -+ int err;
3832 -+
3833 -+ if (!opts) {
3834 - ti->error = "Digest algorithm missing for ESSIV mode";
3835 - return -EINVAL;
3836 - }
3837 -
3838 -- /* Hash the cipher key with the given hash algorithm */
3839 -+ /* Allocate hash algorithm */
3840 - hash_tfm = crypto_alloc_hash(opts, 0, CRYPTO_ALG_ASYNC);
3841 - if (IS_ERR(hash_tfm)) {
3842 - ti->error = "Error initializing ESSIV hash";
3843 -- return PTR_ERR(hash_tfm);
3844 -+ err = PTR_ERR(hash_tfm);
3845 -+ goto bad;
3846 - }
3847 -
3848 -- saltsize = crypto_hash_digestsize(hash_tfm);
3849 -- salt = kmalloc(saltsize, GFP_KERNEL);
3850 -- if (salt == NULL) {
3851 -+ salt = kzalloc(crypto_hash_digestsize(hash_tfm), GFP_KERNEL);
3852 -+ if (!salt) {
3853 - ti->error = "Error kmallocing salt storage in ESSIV";
3854 -- crypto_free_hash(hash_tfm);
3855 -- return -ENOMEM;
3856 -+ err = -ENOMEM;
3857 -+ goto bad;
3858 - }
3859 -
3860 -- sg_init_one(&sg, cc->key, cc->key_size);
3861 -- desc.tfm = hash_tfm;
3862 -- desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP;
3863 -- err = crypto_hash_digest(&desc, &sg, cc->key_size, salt);
3864 -- crypto_free_hash(hash_tfm);
3865 --
3866 -- if (err) {
3867 -- ti->error = "Error calculating hash in ESSIV";
3868 -- kfree(salt);
3869 -- return err;
3870 -- }
3871 --
3872 -- /* Setup the essiv_tfm with the given salt */
3873 -+ /* Allocate essiv_tfm */
3874 - essiv_tfm = crypto_alloc_cipher(cc->cipher, 0, CRYPTO_ALG_ASYNC);
3875 - if (IS_ERR(essiv_tfm)) {
3876 - ti->error = "Error allocating crypto tfm for ESSIV";
3877 -- kfree(salt);
3878 -- return PTR_ERR(essiv_tfm);
3879 -+ err = PTR_ERR(essiv_tfm);
3880 -+ goto bad;
3881 - }
3882 - if (crypto_cipher_blocksize(essiv_tfm) !=
3883 - crypto_ablkcipher_ivsize(cc->tfm)) {
3884 - ti->error = "Block size of ESSIV cipher does "
3885 - "not match IV size of block cipher";
3886 -- crypto_free_cipher(essiv_tfm);
3887 -- kfree(salt);
3888 -- return -EINVAL;
3889 -- }
3890 -- err = crypto_cipher_setkey(essiv_tfm, salt, saltsize);
3891 -- if (err) {
3892 -- ti->error = "Failed to set key for ESSIV cipher";
3893 -- crypto_free_cipher(essiv_tfm);
3894 -- kfree(salt);
3895 -- return err;
3896 -+ err = -EINVAL;
3897 -+ goto bad;
3898 - }
3899 -- kfree(salt);
3900 -
3901 -- cc->iv_gen_private.essiv_tfm = essiv_tfm;
3902 -+ cc->iv_gen_private.essiv.salt = salt;
3903 -+ cc->iv_gen_private.essiv.tfm = essiv_tfm;
3904 -+ cc->iv_gen_private.essiv.hash_tfm = hash_tfm;
3905 -+
3906 - return 0;
3907 --}
3908 -
3909 --static void crypt_iv_essiv_dtr(struct crypt_config *cc)
3910 --{
3911 -- crypto_free_cipher(cc->iv_gen_private.essiv_tfm);
3912 -- cc->iv_gen_private.essiv_tfm = NULL;
3913 -+bad:
3914 -+ if (essiv_tfm && !IS_ERR(essiv_tfm))
3915 -+ crypto_free_cipher(essiv_tfm);
3916 -+ if (hash_tfm && !IS_ERR(hash_tfm))
3917 -+ crypto_free_hash(hash_tfm);
3918 -+ kfree(salt);
3919 -+ return err;
3920 - }
3921 -
3922 - static int crypt_iv_essiv_gen(struct crypt_config *cc, u8 *iv, sector_t sector)
3923 - {
3924 - memset(iv, 0, cc->iv_size);
3925 - *(u64 *)iv = cpu_to_le64(sector);
3926 -- crypto_cipher_encrypt_one(cc->iv_gen_private.essiv_tfm, iv, iv);
3927 -+ crypto_cipher_encrypt_one(cc->iv_gen_private.essiv.tfm, iv, iv);
3928 - return 0;
3929 - }
3930 -
3931 -@@ -273,7 +310,7 @@ static int crypt_iv_benbi_ctr(struct crypt_config *cc, struct dm_target *ti,
3932 - return -EINVAL;
3933 - }
3934 -
3935 -- cc->iv_gen_private.benbi_shift = 9 - log;
3936 -+ cc->iv_gen_private.benbi.shift = 9 - log;
3937 -
3938 - return 0;
3939 - }
3940 -@@ -288,7 +325,7 @@ static int crypt_iv_benbi_gen(struct crypt_config *cc, u8 *iv, sector_t sector)
3941 -
3942 - memset(iv, 0, cc->iv_size - sizeof(u64)); /* rest is cleared below */
3943 -
3944 -- val = cpu_to_be64(((u64)sector << cc->iv_gen_private.benbi_shift) + 1);
3945 -+ val = cpu_to_be64(((u64)sector << cc->iv_gen_private.benbi.shift) + 1);
3946 - put_unaligned(val, (__be64 *)(iv + cc->iv_size - sizeof(u64)));
3947 -
3948 - return 0;
3949 -@@ -308,6 +345,8 @@ static struct crypt_iv_operations crypt_iv_plain_ops = {
3950 - static struct crypt_iv_operations crypt_iv_essiv_ops = {
3951 - .ctr = crypt_iv_essiv_ctr,
3952 - .dtr = crypt_iv_essiv_dtr,
3953 -+ .init = crypt_iv_essiv_init,
3954 -+ .wipe = crypt_iv_essiv_wipe,
3955 - .generator = crypt_iv_essiv_gen
3956 - };
3957 -
3958 -@@ -1039,6 +1078,12 @@ static int crypt_ctr(struct dm_target *ti, unsigned int argc, char **argv)
3959 - cc->iv_gen_ops->ctr(cc, ti, ivopts) < 0)
3960 - goto bad_ivmode;
3961 -
3962 -+ if (cc->iv_gen_ops && cc->iv_gen_ops->init &&
3963 -+ cc->iv_gen_ops->init(cc) < 0) {
3964 -+ ti->error = "Error initialising IV";
3965 -+ goto bad_slab_pool;
3966 -+ }
3967 -+
3968 - cc->iv_size = crypto_ablkcipher_ivsize(tfm);
3969 - if (cc->iv_size)
3970 - /* at least a 64 bit sector number should fit in our buffer */
3971 -@@ -1278,6 +1323,7 @@ static void crypt_resume(struct dm_target *ti)
3972 - static int crypt_message(struct dm_target *ti, unsigned argc, char **argv)
3973 - {
3974 - struct crypt_config *cc = ti->private;
3975 -+ int ret = -EINVAL;
3976 -
3977 - if (argc < 2)
3978 - goto error;
3979 -@@ -1287,10 +1333,22 @@ static int crypt_message(struct dm_target *ti, unsigned argc, char **argv)
3980 - DMWARN("not suspended during key manipulation.");
3981 - return -EINVAL;
3982 - }
3983 -- if (argc == 3 && !strnicmp(argv[1], MESG_STR("set")))
3984 -- return crypt_set_key(cc, argv[2]);
3985 -- if (argc == 2 && !strnicmp(argv[1], MESG_STR("wipe")))
3986 -+ if (argc == 3 && !strnicmp(argv[1], MESG_STR("set"))) {
3987 -+ ret = crypt_set_key(cc, argv[2]);
3988 -+ if (ret)
3989 -+ return ret;
3990 -+ if (cc->iv_gen_ops && cc->iv_gen_ops->init)
3991 -+ ret = cc->iv_gen_ops->init(cc);
3992 -+ return ret;
3993 -+ }
3994 -+ if (argc == 2 && !strnicmp(argv[1], MESG_STR("wipe"))) {
3995 -+ if (cc->iv_gen_ops && cc->iv_gen_ops->wipe) {
3996 -+ ret = cc->iv_gen_ops->wipe(cc);
3997 -+ if (ret)
3998 -+ return ret;
3999 -+ }
4000 - return crypt_wipe_key(cc);
4001 -+ }
4002 - }
4003 -
4004 - error:
4005 -diff --git a/drivers/md/dm-exception-store.c b/drivers/md/dm-exception-store.c
4006 -index 7dbe652..2052159 100644
4007 ---- a/drivers/md/dm-exception-store.c
4008 -+++ b/drivers/md/dm-exception-store.c
4009 -@@ -216,7 +216,8 @@ int dm_exception_store_create(struct dm_target *ti, int argc, char **argv,
4010 - type = get_type("N");
4011 - else {
4012 - ti->error = "Persistent flag is not P or N";
4013 -- return -EINVAL;
4014 -+ r = -EINVAL;
4015 -+ goto bad_type;
4016 - }
4017 -
4018 - if (!type) {
4019 -diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
4020 -index a679429..d19854c 100644
4021 ---- a/drivers/md/dm-ioctl.c
4022 -+++ b/drivers/md/dm-ioctl.c
4023 -@@ -56,6 +56,11 @@ static void dm_hash_remove_all(int keep_open_devices);
4024 - */
4025 - static DECLARE_RWSEM(_hash_lock);
4026 -
4027 -+/*
4028 -+ * Protects use of mdptr to obtain hash cell name and uuid from mapped device.
4029 -+ */
4030 -+static DEFINE_MUTEX(dm_hash_cells_mutex);
4031 -+
4032 - static void init_buckets(struct list_head *buckets)
4033 - {
4034 - unsigned int i;
4035 -@@ -206,7 +211,9 @@ static int dm_hash_insert(const char *name, const char *uuid, struct mapped_devi
4036 - list_add(&cell->uuid_list, _uuid_buckets + hash_str(uuid));
4037 - }
4038 - dm_get(md);
4039 -+ mutex_lock(&dm_hash_cells_mutex);
4040 - dm_set_mdptr(md, cell);
4041 -+ mutex_unlock(&dm_hash_cells_mutex);
4042 - up_write(&_hash_lock);
4043 -
4044 - return 0;
4045 -@@ -224,7 +231,9 @@ static void __hash_remove(struct hash_cell *hc)
4046 - /* remove from the dev hash */
4047 - list_del(&hc->uuid_list);
4048 - list_del(&hc->name_list);
4049 -+ mutex_lock(&dm_hash_cells_mutex);
4050 - dm_set_mdptr(hc->md, NULL);
4051 -+ mutex_unlock(&dm_hash_cells_mutex);
4052 -
4053 - table = dm_get_table(hc->md);
4054 - if (table) {
4055 -@@ -321,7 +330,9 @@ static int dm_hash_rename(uint32_t cookie, const char *old, const char *new)
4056 - */
4057 - list_del(&hc->name_list);
4058 - old_name = hc->name;
4059 -+ mutex_lock(&dm_hash_cells_mutex);
4060 - hc->name = new_name;
4061 -+ mutex_unlock(&dm_hash_cells_mutex);
4062 - list_add(&hc->name_list, _name_buckets + hash_str(new_name));
4063 -
4064 - /*
4065 -@@ -1582,8 +1593,7 @@ int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid)
4066 - if (!md)
4067 - return -ENXIO;
4068 -
4069 -- dm_get(md);
4070 -- down_read(&_hash_lock);
4071 -+ mutex_lock(&dm_hash_cells_mutex);
4072 - hc = dm_get_mdptr(md);
4073 - if (!hc || hc->md != md) {
4074 - r = -ENXIO;
4075 -@@ -1596,8 +1606,7 @@ int dm_copy_name_and_uuid(struct mapped_device *md, char *name, char *uuid)
4076 - strcpy(uuid, hc->uuid ? : "");
4077 -
4078 - out:
4079 -- up_read(&_hash_lock);
4080 -- dm_put(md);
4081 -+ mutex_unlock(&dm_hash_cells_mutex);
4082 -
4083 - return r;
4084 - }
4085 -diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c
4086 -index 3a3ba46..8a4a9c8 100644
4087 ---- a/drivers/md/dm-snap.c
4088 -+++ b/drivers/md/dm-snap.c
4089 -@@ -553,6 +553,8 @@ static int init_hash_tables(struct dm_snapshot *s)
4090 - hash_size = min(origin_dev_size, cow_dev_size) >> s->store->chunk_shift;
4091 - hash_size = min(hash_size, max_buckets);
4092 -
4093 -+ if (hash_size < 64)
4094 -+ hash_size = 64;
4095 - hash_size = rounddown_pow_of_two(hash_size);
4096 - if (init_exception_table(&s->complete, hash_size,
4097 - DM_CHUNK_CONSECUTIVE_BITS))
4098 -@@ -1152,10 +1154,11 @@ static int snapshot_status(struct dm_target *ti, status_type_t type,
4099 - unsigned sz = 0;
4100 - struct dm_snapshot *snap = ti->private;
4101 -
4102 -- down_write(&snap->lock);
4103 --
4104 - switch (type) {
4105 - case STATUSTYPE_INFO:
4106 -+
4107 -+ down_write(&snap->lock);
4108 -+
4109 - if (!snap->valid)
4110 - DMEMIT("Invalid");
4111 - else {
4112 -@@ -1171,6 +1174,9 @@ static int snapshot_status(struct dm_target *ti, status_type_t type,
4113 - else
4114 - DMEMIT("Unknown");
4115 - }
4116 -+
4117 -+ up_write(&snap->lock);
4118 -+
4119 - break;
4120 -
4121 - case STATUSTYPE_TABLE:
4122 -@@ -1185,8 +1191,6 @@ static int snapshot_status(struct dm_target *ti, status_type_t type,
4123 - break;
4124 - }
4125 -
4126 -- up_write(&snap->lock);
4127 --
4128 - return 0;
4129 - }
4130 -
4131 -diff --git a/drivers/md/dm-uevent.c b/drivers/md/dm-uevent.c
4132 -index 6f65883..c7c555a 100644
4133 ---- a/drivers/md/dm-uevent.c
4134 -+++ b/drivers/md/dm-uevent.c
4135 -@@ -139,14 +139,13 @@ void dm_send_uevents(struct list_head *events, struct kobject *kobj)
4136 - list_del_init(&event->elist);
4137 -
4138 - /*
4139 -- * Need to call dm_copy_name_and_uuid from here for now.
4140 -- * Context of previous var adds and locking used for
4141 -- * hash_cell not compatable.
4142 -+ * When a device is being removed this copy fails and we
4143 -+ * discard these unsent events.
4144 - */
4145 - if (dm_copy_name_and_uuid(event->md, event->name,
4146 - event->uuid)) {
4147 -- DMERR("%s: dm_copy_name_and_uuid() failed",
4148 -- __func__);
4149 -+ DMINFO("%s: skipping sending uevent for lost device",
4150 -+ __func__);
4151 - goto uevent_free;
4152 - }
4153 -
4154 -diff --git a/drivers/md/md.c b/drivers/md/md.c
4155 -index b182f86..02e4551 100644
4156 ---- a/drivers/md/md.c
4157 -+++ b/drivers/md/md.c
4158 -@@ -367,6 +367,7 @@ static mddev_t * mddev_find(dev_t unit)
4159 -
4160 - mutex_init(&new->open_mutex);
4161 - mutex_init(&new->reconfig_mutex);
4162 -+ mutex_init(&new->bitmap_mutex);
4163 - INIT_LIST_HEAD(&new->disks);
4164 - INIT_LIST_HEAD(&new->all_mddevs);
4165 - init_timer(&new->safemode_timer);
4166 -@@ -6629,7 +6630,7 @@ void md_check_recovery(mddev_t *mddev)
4167 -
4168 -
4169 - if (mddev->bitmap)
4170 -- bitmap_daemon_work(mddev->bitmap);
4171 -+ bitmap_daemon_work(mddev);
4172 -
4173 - if (mddev->ro)
4174 - return;
4175 -diff --git a/drivers/md/md.h b/drivers/md/md.h
4176 -index f184b69..87430fe 100644
4177 ---- a/drivers/md/md.h
4178 -+++ b/drivers/md/md.h
4179 -@@ -289,6 +289,7 @@ struct mddev_s
4180 - * hot-adding a bitmap. It should
4181 - * eventually be settable by sysfs.
4182 - */
4183 -+ struct mutex bitmap_mutex;
4184 -
4185 - struct list_head all_mddevs;
4186 - };
4187 -diff --git a/drivers/media/common/tuners/mxl5007t.c b/drivers/media/common/tuners/mxl5007t.c
4188 -index 2d02698..7eb1bf7 100644
4189 ---- a/drivers/media/common/tuners/mxl5007t.c
4190 -+++ b/drivers/media/common/tuners/mxl5007t.c
4191 -@@ -196,7 +196,7 @@ static void copy_reg_bits(struct reg_pair_t *reg_pair1,
4192 - i = j = 0;
4193 -
4194 - while (reg_pair1[i].reg || reg_pair1[i].val) {
4195 -- while (reg_pair2[j].reg || reg_pair2[j].reg) {
4196 -+ while (reg_pair2[j].reg || reg_pair2[j].val) {
4197 - if (reg_pair1[i].reg != reg_pair2[j].reg) {
4198 - j++;
4199 - continue;
4200 -diff --git a/drivers/media/video/gspca/ov519.c b/drivers/media/video/gspca/ov519.c
4201 -index a5c190e..e165578 100644
4202 ---- a/drivers/media/video/gspca/ov519.c
4203 -+++ b/drivers/media/video/gspca/ov519.c
4204 -@@ -3364,6 +3364,7 @@ static const __devinitdata struct usb_device_id device_table[] = {
4205 - {USB_DEVICE(0x041e, 0x4061), .driver_info = BRIDGE_OV519 },
4206 - {USB_DEVICE(0x041e, 0x4064),
4207 - .driver_info = BRIDGE_OV519 | BRIDGE_INVERT_LED },
4208 -+ {USB_DEVICE(0x041e, 0x4067), .driver_info = BRIDGE_OV519 },
4209 - {USB_DEVICE(0x041e, 0x4068),
4210 - .driver_info = BRIDGE_OV519 | BRIDGE_INVERT_LED },
4211 - {USB_DEVICE(0x045e, 0x028c), .driver_info = BRIDGE_OV519 },
4212 -diff --git a/drivers/mtd/ubi/upd.c b/drivers/mtd/ubi/upd.c
4213 -index 74fdc40..c1d7b88 100644
4214 ---- a/drivers/mtd/ubi/upd.c
4215 -+++ b/drivers/mtd/ubi/upd.c
4216 -@@ -147,12 +147,14 @@ int ubi_start_update(struct ubi_device *ubi, struct ubi_volume *vol,
4217 - }
4218 -
4219 - if (bytes == 0) {
4220 -+ err = ubi_wl_flush(ubi);
4221 -+ if (err)
4222 -+ return err;
4223 -+
4224 - err = clear_update_marker(ubi, vol, 0);
4225 - if (err)
4226 - return err;
4227 -- err = ubi_wl_flush(ubi);
4228 -- if (!err)
4229 -- vol->updating = 0;
4230 -+ vol->updating = 0;
4231 - }
4232 -
4233 - vol->upd_buf = vmalloc(ubi->leb_size);
4234 -@@ -362,16 +364,16 @@ int ubi_more_update_data(struct ubi_device *ubi, struct ubi_volume *vol,
4235 -
4236 - ubi_assert(vol->upd_received <= vol->upd_bytes);
4237 - if (vol->upd_received == vol->upd_bytes) {
4238 -+ err = ubi_wl_flush(ubi);
4239 -+ if (err)
4240 -+ return err;
4241 - /* The update is finished, clear the update marker */
4242 - err = clear_update_marker(ubi, vol, vol->upd_bytes);
4243 - if (err)
4244 - return err;
4245 -- err = ubi_wl_flush(ubi);
4246 -- if (err == 0) {
4247 -- vol->updating = 0;
4248 -- err = to_write;
4249 -- vfree(vol->upd_buf);
4250 -- }
4251 -+ vol->updating = 0;
4252 -+ err = to_write;
4253 -+ vfree(vol->upd_buf);
4254 - }
4255 -
4256 - return err;
4257 -diff --git a/drivers/net/b44.c b/drivers/net/b44.c
4258 -index 2a91323..4869adb 100644
4259 ---- a/drivers/net/b44.c
4260 -+++ b/drivers/net/b44.c
4261 -@@ -1505,8 +1505,7 @@ static int b44_magic_pattern(u8 *macaddr, u8 *ppattern, u8 *pmask, int offset)
4262 - for (k = 0; k< ethaddr_bytes; k++) {
4263 - ppattern[offset + magicsync +
4264 - (j * ETH_ALEN) + k] = macaddr[k];
4265 -- len++;
4266 -- set_bit(len, (unsigned long *) pmask);
4267 -+ set_bit(len++, (unsigned long *) pmask);
4268 - }
4269 - }
4270 - return len - 1;
4271 -diff --git a/drivers/net/bcm63xx_enet.c b/drivers/net/bcm63xx_enet.c
4272 -index ba29dc3..d110c1b 100644
4273 ---- a/drivers/net/bcm63xx_enet.c
4274 -+++ b/drivers/net/bcm63xx_enet.c
4275 -@@ -1248,9 +1248,15 @@ static void bcm_enet_get_drvinfo(struct net_device *netdev,
4276 - drvinfo->n_stats = BCM_ENET_STATS_LEN;
4277 - }
4278 -
4279 --static int bcm_enet_get_stats_count(struct net_device *netdev)
4280 -+static int bcm_enet_get_sset_count(struct net_device *netdev,
4281 -+ int string_set)
4282 - {
4283 -- return BCM_ENET_STATS_LEN;
4284 -+ switch (string_set) {
4285 -+ case ETH_SS_STATS:
4286 -+ return BCM_ENET_STATS_LEN;
4287 -+ default:
4288 -+ return -EINVAL;
4289 -+ }
4290 - }
4291 -
4292 - static void bcm_enet_get_strings(struct net_device *netdev,
4293 -@@ -1476,7 +1482,7 @@ static int bcm_enet_set_pauseparam(struct net_device *dev,
4294 -
4295 - static struct ethtool_ops bcm_enet_ethtool_ops = {
4296 - .get_strings = bcm_enet_get_strings,
4297 -- .get_stats_count = bcm_enet_get_stats_count,
4298 -+ .get_sset_count = bcm_enet_get_sset_count,
4299 - .get_ethtool_stats = bcm_enet_get_ethtool_stats,
4300 - .get_settings = bcm_enet_get_settings,
4301 - .set_settings = bcm_enet_set_settings,
4302 -diff --git a/drivers/net/wireless/ath/ath5k/eeprom.c b/drivers/net/wireless/ath/ath5k/eeprom.c
4303 -index 644962a..7918852 100644
4304 ---- a/drivers/net/wireless/ath/ath5k/eeprom.c
4305 -+++ b/drivers/net/wireless/ath/ath5k/eeprom.c
4306 -@@ -97,6 +97,7 @@ ath5k_eeprom_init_header(struct ath5k_hw *ah)
4307 - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
4308 - int ret;
4309 - u16 val;
4310 -+ u32 cksum, offset;
4311 -
4312 - /*
4313 - * Read values from EEPROM and store them in the capability structure
4314 -@@ -111,7 +112,6 @@ ath5k_eeprom_init_header(struct ath5k_hw *ah)
4315 - if (ah->ah_ee_version < AR5K_EEPROM_VERSION_3_0)
4316 - return 0;
4317 -
4318 --#ifdef notyet
4319 - /*
4320 - * Validate the checksum of the EEPROM date. There are some
4321 - * devices with invalid EEPROMs.
4322 -@@ -124,7 +124,6 @@ ath5k_eeprom_init_header(struct ath5k_hw *ah)
4323 - ATH5K_ERR(ah->ah_sc, "Invalid EEPROM checksum 0x%04x\n", cksum);
4324 - return -EIO;
4325 - }
4326 --#endif
4327 -
4328 - AR5K_EEPROM_READ_HDR(AR5K_EEPROM_ANT_GAIN(ah->ah_ee_version),
4329 - ee_ant_gain);
4330 -diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
4331 -index 1a039f2..9d67647 100644
4332 ---- a/drivers/net/wireless/ath/ath5k/phy.c
4333 -+++ b/drivers/net/wireless/ath/ath5k/phy.c
4334 -@@ -2954,8 +2954,6 @@ ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel,
4335 - ATH5K_ERR(ah->ah_sc, "invalid tx power: %u\n", txpower);
4336 - return -EINVAL;
4337 - }
4338 -- if (txpower == 0)
4339 -- txpower = AR5K_TUNE_DEFAULT_TXPOWER;
4340 -
4341 - /* Reset TX power values */
4342 - memset(&ah->ah_txpower, 0, sizeof(ah->ah_txpower));
4343 -diff --git a/drivers/net/wireless/ath/ath9k/ath9k.h b/drivers/net/wireless/ath/ath9k/ath9k.h
4344 -index 1d59f10..cdb90c5 100644
4345 ---- a/drivers/net/wireless/ath/ath9k/ath9k.h
4346 -+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
4347 -@@ -139,6 +139,7 @@ struct ath_buf {
4348 - dma_addr_t bf_daddr; /* physical addr of desc */
4349 - dma_addr_t bf_buf_addr; /* physical addr of data buffer */
4350 - bool bf_stale;
4351 -+ bool bf_isnullfunc;
4352 - u16 bf_flags;
4353 - struct ath_buf_state bf_state;
4354 - dma_addr_t bf_dmacontext;
4355 -@@ -524,6 +525,8 @@ struct ath_led {
4356 - #define SC_OP_BEACON_SYNC BIT(19)
4357 - #define SC_OP_BTCOEX_ENABLED BIT(20)
4358 - #define SC_OP_BT_PRIORITY_DETECTED BIT(21)
4359 -+#define SC_OP_NULLFUNC_COMPLETED BIT(22)
4360 -+#define SC_OP_PS_ENABLED BIT(23)
4361 -
4362 - struct ath_bus_ops {
4363 - void (*read_cachesize)(struct ath_softc *sc, int *csz);
4364 -diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
4365 -index ca7694c..c7aa05a 100644
4366 ---- a/drivers/net/wireless/ath/ath9k/hw.c
4367 -+++ b/drivers/net/wireless/ath/ath9k/hw.c
4368 -@@ -937,6 +937,11 @@ int ath9k_hw_init(struct ath_hw *ah)
4369 - DPRINTF(ah->ah_sc, ATH_DBG_RESET, "serialize_regmode is %d\n",
4370 - ah->config.serialize_regmode);
4371 -
4372 -+ if (AR_SREV_9285(ah) || AR_SREV_9271(ah))
4373 -+ ah->config.max_txtrig_level = MAX_TX_FIFO_THRESHOLD >> 1;
4374 -+ else
4375 -+ ah->config.max_txtrig_level = MAX_TX_FIFO_THRESHOLD;
4376 -+
4377 - if (!ath9k_hw_macversion_supported(ah->hw_version.macVersion)) {
4378 - DPRINTF(ah->ah_sc, ATH_DBG_FATAL,
4379 - "Mac Chip Rev 0x%02x.%x is not supported by "
4380 -@@ -3670,7 +3675,11 @@ void ath9k_hw_fill_cap_info(struct ath_hw *ah)
4381 - pCap->keycache_size = AR_KEYTABLE_SIZE;
4382 -
4383 - pCap->hw_caps |= ATH9K_HW_CAP_FASTCC;
4384 -- pCap->tx_triglevel_max = MAX_TX_FIFO_THRESHOLD;
4385 -+
4386 -+ if (AR_SREV_9285(ah) || AR_SREV_9271(ah))
4387 -+ pCap->tx_triglevel_max = MAX_TX_FIFO_THRESHOLD >> 1;
4388 -+ else
4389 -+ pCap->tx_triglevel_max = MAX_TX_FIFO_THRESHOLD;
4390 -
4391 - if (AR_SREV_9285_10_OR_LATER(ah))
4392 - pCap->num_gpio_pins = AR9285_NUM_GPIO;
4393 -diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
4394 -index b892345..57f1463 100644
4395 ---- a/drivers/net/wireless/ath/ath9k/hw.h
4396 -+++ b/drivers/net/wireless/ath/ath9k/hw.h
4397 -@@ -218,6 +218,7 @@ struct ath9k_ops_config {
4398 - #define AR_SPUR_FEEQ_BOUND_HT20 10
4399 - int spurmode;
4400 - u16 spurchans[AR_EEPROM_MODAL_SPURS][2];
4401 -+ u8 max_txtrig_level;
4402 - };
4403 -
4404 - enum ath9k_int {
4405 -diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c
4406 -index 800bfab..d4d9d82 100644
4407 ---- a/drivers/net/wireless/ath/ath9k/mac.c
4408 -+++ b/drivers/net/wireless/ath/ath9k/mac.c
4409 -@@ -70,7 +70,7 @@ bool ath9k_hw_updatetxtriglevel(struct ath_hw *ah, bool bIncTrigLevel)
4410 - u32 txcfg, curLevel, newLevel;
4411 - enum ath9k_int omask;
4412 -
4413 -- if (ah->tx_trig_level >= MAX_TX_FIFO_THRESHOLD)
4414 -+ if (ah->tx_trig_level >= ah->config.max_txtrig_level)
4415 - return false;
4416 -
4417 - omask = ath9k_hw_set_interrupts(ah, ah->mask_reg & ~ATH9K_INT_GLOBAL);
4418 -@@ -79,7 +79,7 @@ bool ath9k_hw_updatetxtriglevel(struct ath_hw *ah, bool bIncTrigLevel)
4419 - curLevel = MS(txcfg, AR_FTRIG);
4420 - newLevel = curLevel;
4421 - if (bIncTrigLevel) {
4422 -- if (curLevel < MAX_TX_FIFO_THRESHOLD)
4423 -+ if (curLevel < ah->config.max_txtrig_level)
4424 - newLevel++;
4425 - } else if (curLevel > MIN_TX_FIFO_THRESHOLD)
4426 - newLevel--;
4427 -@@ -222,6 +222,8 @@ int ath9k_hw_txprocdesc(struct ath_hw *ah, struct ath_desc *ds)
4428 - ds->ds_txstat.ts_status = 0;
4429 - ds->ds_txstat.ts_flags = 0;
4430 -
4431 -+ if (ads->ds_txstatus1 & AR_FrmXmitOK)
4432 -+ ds->ds_txstat.ts_status |= ATH9K_TX_ACKED;
4433 - if (ads->ds_txstatus1 & AR_ExcessiveRetries)
4434 - ds->ds_txstat.ts_status |= ATH9K_TXERR_XRETRY;
4435 - if (ads->ds_txstatus1 & AR_Filtered)
4436 -diff --git a/drivers/net/wireless/ath/ath9k/mac.h b/drivers/net/wireless/ath/ath9k/mac.h
4437 -index f56e77d..ff65f85 100644
4438 ---- a/drivers/net/wireless/ath/ath9k/mac.h
4439 -+++ b/drivers/net/wireless/ath/ath9k/mac.h
4440 -@@ -76,6 +76,7 @@
4441 - #define ATH9K_TXERR_FIFO 0x04
4442 - #define ATH9K_TXERR_XTXOP 0x08
4443 - #define ATH9K_TXERR_TIMER_EXPIRED 0x10
4444 -+#define ATH9K_TX_ACKED 0x20
4445 -
4446 - #define ATH9K_TX_BA 0x01
4447 - #define ATH9K_TX_PWRMGMT 0x02
4448 -diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
4449 -index 43d2be9..59359e3 100644
4450 ---- a/drivers/net/wireless/ath/ath9k/main.c
4451 -+++ b/drivers/net/wireless/ath/ath9k/main.c
4452 -@@ -2327,6 +2327,7 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
4453 -
4454 - if (changed & IEEE80211_CONF_CHANGE_PS) {
4455 - if (conf->flags & IEEE80211_CONF_PS) {
4456 -+ sc->sc_flags |= SC_OP_PS_ENABLED;
4457 - if (!(ah->caps.hw_caps &
4458 - ATH9K_HW_CAP_AUTOSLEEP)) {
4459 - if ((sc->imask & ATH9K_INT_TIM_TIMER) == 0) {
4460 -@@ -2334,11 +2335,17 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
4461 - ath9k_hw_set_interrupts(sc->sc_ah,
4462 - sc->imask);
4463 - }
4464 -- ath9k_hw_setrxabort(sc->sc_ah, 1);
4465 - }
4466 - sc->ps_enabled = true;
4467 -+ if ((sc->sc_flags & SC_OP_NULLFUNC_COMPLETED)) {
4468 -+ sc->sc_flags &= ~SC_OP_NULLFUNC_COMPLETED;
4469 -+ sc->ps_enabled = true;
4470 -+ ath9k_hw_setrxabort(sc->sc_ah, 1);
4471 -+ }
4472 - } else {
4473 - sc->ps_enabled = false;
4474 -+ sc->sc_flags &= ~(SC_OP_PS_ENABLED |
4475 -+ SC_OP_NULLFUNC_COMPLETED);
4476 - ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE);
4477 - if (!(ah->caps.hw_caps &
4478 - ATH9K_HW_CAP_AUTOSLEEP)) {
4479 -diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
4480 -index 42551a4..4753909 100644
4481 ---- a/drivers/net/wireless/ath/ath9k/xmit.c
4482 -+++ b/drivers/net/wireless/ath/ath9k/xmit.c
4483 -@@ -1592,6 +1592,13 @@ static int ath_tx_setup_buffer(struct ieee80211_hw *hw, struct ath_buf *bf,
4484 - }
4485 -
4486 - bf->bf_buf_addr = bf->bf_dmacontext;
4487 -+
4488 -+ if (ieee80211_is_nullfunc(fc) && ieee80211_has_pm(fc)) {
4489 -+ bf->bf_isnullfunc = true;
4490 -+ sc->sc_flags &= ~SC_OP_NULLFUNC_COMPLETED;
4491 -+ } else
4492 -+ bf->bf_isnullfunc = false;
4493 -+
4494 - return 0;
4495 - }
4496 -
4497 -@@ -1989,6 +1996,15 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
4498 - if (ds == txq->axq_gatingds)
4499 - txq->axq_gatingds = NULL;
4500 -
4501 -+ if (bf->bf_isnullfunc &&
4502 -+ (ds->ds_txstat.ts_status & ATH9K_TX_ACKED)) {
4503 -+ if ((sc->sc_flags & SC_OP_PS_ENABLED)) {
4504 -+ sc->ps_enabled = true;
4505 -+ ath9k_hw_setrxabort(sc->sc_ah, 1);
4506 -+ } else
4507 -+ sc->sc_flags |= SC_OP_NULLFUNC_COMPLETED;
4508 -+ }
4509 -+
4510 - /*
4511 - * Remove ath_buf's of the same transmit unit from txq,
4512 - * however leave the last descriptor back as the holding
4513 -@@ -2004,7 +2020,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
4514 - if (bf_isaggr(bf))
4515 - txq->axq_aggr_depth--;
4516 -
4517 -- txok = (ds->ds_txstat.ts_status == 0);
4518 -+ txok = !(ds->ds_txstat.ts_status & ATH9K_TXERR_FILT);
4519 - txq->axq_tx_inprogress = false;
4520 - spin_unlock_bh(&txq->axq_lock);
4521 -
4522 -@@ -2065,7 +2081,9 @@ static void ath_tx_complete_poll_work(struct work_struct *work)
4523 -
4524 - if (needreset) {
4525 - DPRINTF(sc, ATH_DBG_RESET, "tx hung, resetting the chip\n");
4526 -+ ath9k_ps_wakeup(sc);
4527 - ath_reset(sc, false);
4528 -+ ath9k_ps_restore(sc);
4529 - }
4530 -
4531 - ieee80211_queue_delayed_work(sc->hw, &sc->tx_complete_work,
4532 -diff --git a/drivers/net/wireless/b43legacy/rfkill.c b/drivers/net/wireless/b43legacy/rfkill.c
4533 -index 8783022..d579df7 100644
4534 ---- a/drivers/net/wireless/b43legacy/rfkill.c
4535 -+++ b/drivers/net/wireless/b43legacy/rfkill.c
4536 -@@ -34,6 +34,13 @@ bool b43legacy_is_hw_radio_enabled(struct b43legacy_wldev *dev)
4537 - & B43legacy_MMIO_RADIO_HWENABLED_HI_MASK))
4538 - return 1;
4539 - } else {
4540 -+ /* To prevent CPU fault on PPC, do not read a register
4541 -+ * unless the interface is started; however, on resume
4542 -+ * for hibernation, this routine is entered early. When
4543 -+ * that happens, unconditionally return TRUE.
4544 -+ */
4545 -+ if (b43legacy_status(dev) < B43legacy_STAT_STARTED)
4546 -+ return 1;
4547 - if (b43legacy_read16(dev, B43legacy_MMIO_RADIO_HWENABLED_LO)
4548 - & B43legacy_MMIO_RADIO_HWENABLED_LO_MASK)
4549 - return 1;
4550 -diff --git a/drivers/net/wireless/ipw2x00/ipw2100.c b/drivers/net/wireless/ipw2x00/ipw2100.c
4551 -index 6e2fc0c..43102bf 100644
4552 ---- a/drivers/net/wireless/ipw2x00/ipw2100.c
4553 -+++ b/drivers/net/wireless/ipw2x00/ipw2100.c
4554 -@@ -6487,6 +6487,16 @@ static int ipw2100_resume(struct pci_dev *pci_dev)
4555 - }
4556 - #endif
4557 -
4558 -+static void ipw2100_shutdown(struct pci_dev *pci_dev)
4559 -+{
4560 -+ struct ipw2100_priv *priv = pci_get_drvdata(pci_dev);
4561 -+
4562 -+ /* Take down the device; powers it off, etc. */
4563 -+ ipw2100_down(priv);
4564 -+
4565 -+ pci_disable_device(pci_dev);
4566 -+}
4567 -+
4568 - #define IPW2100_DEV_ID(x) { PCI_VENDOR_ID_INTEL, 0x1043, 0x8086, x }
4569 -
4570 - static struct pci_device_id ipw2100_pci_id_table[] __devinitdata = {
4571 -@@ -6550,6 +6560,7 @@ static struct pci_driver ipw2100_pci_driver = {
4572 - .suspend = ipw2100_suspend,
4573 - .resume = ipw2100_resume,
4574 - #endif
4575 -+ .shutdown = ipw2100_shutdown,
4576 - };
4577 -
4578 - /**
4579 -diff --git a/drivers/net/wireless/rtl818x/rtl8187.h b/drivers/net/wireless/rtl818x/rtl8187.h
4580 -index bf9175a..99406bf 100644
4581 ---- a/drivers/net/wireless/rtl818x/rtl8187.h
4582 -+++ b/drivers/net/wireless/rtl818x/rtl8187.h
4583 -@@ -23,6 +23,7 @@
4584 - #define RTL8187_EEPROM_TXPWR_CHAN_1 0x16 /* 3 channels */
4585 - #define RTL8187_EEPROM_TXPWR_CHAN_6 0x1B /* 2 channels */
4586 - #define RTL8187_EEPROM_TXPWR_CHAN_4 0x3D /* 2 channels */
4587 -+#define RTL8187_EEPROM_SELECT_GPIO 0x3B
4588 -
4589 - #define RTL8187_REQT_READ 0xC0
4590 - #define RTL8187_REQT_WRITE 0x40
4591 -@@ -31,6 +32,9 @@
4592 -
4593 - #define RTL8187_MAX_RX 0x9C4
4594 -
4595 -+#define RFKILL_MASK_8187_89_97 0x2
4596 -+#define RFKILL_MASK_8198 0x4
4597 -+
4598 - struct rtl8187_rx_info {
4599 - struct urb *urb;
4600 - struct ieee80211_hw *dev;
4601 -@@ -123,6 +127,7 @@ struct rtl8187_priv {
4602 - u8 noise;
4603 - u8 slot_time;
4604 - u8 aifsn[4];
4605 -+ u8 rfkill_mask;
4606 - struct {
4607 - __le64 buf;
4608 - struct sk_buff_head queue;
4609 -diff --git a/drivers/net/wireless/rtl818x/rtl8187_dev.c b/drivers/net/wireless/rtl818x/rtl8187_dev.c
4610 -index 2017ccc..ea49918 100644
4611 ---- a/drivers/net/wireless/rtl818x/rtl8187_dev.c
4612 -+++ b/drivers/net/wireless/rtl818x/rtl8187_dev.c
4613 -@@ -1329,6 +1329,7 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
4614 - struct ieee80211_channel *channel;
4615 - const char *chip_name;
4616 - u16 txpwr, reg;
4617 -+ u16 product_id = le16_to_cpu(udev->descriptor.idProduct);
4618 - int err, i;
4619 -
4620 - dev = ieee80211_alloc_hw(sizeof(*priv), &rtl8187_ops);
4621 -@@ -1488,6 +1489,13 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
4622 - (*channel++).hw_value = txpwr & 0xFF;
4623 - (*channel++).hw_value = txpwr >> 8;
4624 - }
4625 -+ /* Handle the differing rfkill GPIO bit in different models */
4626 -+ priv->rfkill_mask = RFKILL_MASK_8187_89_97;
4627 -+ if (product_id == 0x8197 || product_id == 0x8198) {
4628 -+ eeprom_93cx6_read(&eeprom, RTL8187_EEPROM_SELECT_GPIO, &reg);
4629 -+ if (reg & 0xFF00)
4630 -+ priv->rfkill_mask = RFKILL_MASK_8198;
4631 -+ }
4632 -
4633 - /*
4634 - * XXX: Once this driver supports anything that requires
4635 -@@ -1516,9 +1524,9 @@ static int __devinit rtl8187_probe(struct usb_interface *intf,
4636 - mutex_init(&priv->conf_mutex);
4637 - skb_queue_head_init(&priv->b_tx_status.queue);
4638 -
4639 -- printk(KERN_INFO "%s: hwaddr %pM, %s V%d + %s\n",
4640 -+ printk(KERN_INFO "%s: hwaddr %pM, %s V%d + %s, rfkill mask %d\n",
4641 - wiphy_name(dev->wiphy), dev->wiphy->perm_addr,
4642 -- chip_name, priv->asic_rev, priv->rf->name);
4643 -+ chip_name, priv->asic_rev, priv->rf->name, priv->rfkill_mask);
4644 -
4645 - #ifdef CONFIG_RTL8187_LEDS
4646 - eeprom_93cx6_read(&eeprom, 0x3F, &reg);
4647 -diff --git a/drivers/net/wireless/rtl818x/rtl8187_rfkill.c b/drivers/net/wireless/rtl818x/rtl8187_rfkill.c
4648 -index cad8037..03555e1 100644
4649 ---- a/drivers/net/wireless/rtl818x/rtl8187_rfkill.c
4650 -+++ b/drivers/net/wireless/rtl818x/rtl8187_rfkill.c
4651 -@@ -25,10 +25,10 @@ static bool rtl8187_is_radio_enabled(struct rtl8187_priv *priv)
4652 - u8 gpio;
4653 -
4654 - gpio = rtl818x_ioread8(priv, &priv->map->GPIO0);
4655 -- rtl818x_iowrite8(priv, &priv->map->GPIO0, gpio & ~0x02);
4656 -+ rtl818x_iowrite8(priv, &priv->map->GPIO0, gpio & ~priv->rfkill_mask);
4657 - gpio = rtl818x_ioread8(priv, &priv->map->GPIO1);
4658 -
4659 -- return gpio & 0x02;
4660 -+ return gpio & priv->rfkill_mask;
4661 - }
4662 -
4663 - void rtl8187_rfkill_init(struct ieee80211_hw *hw)
4664 -diff --git a/drivers/pci/dmar.c b/drivers/pci/dmar.c
4665 -index b952ebc..5753036 100644
4666 ---- a/drivers/pci/dmar.c
4667 -+++ b/drivers/pci/dmar.c
4668 -@@ -582,6 +582,8 @@ int __init dmar_table_init(void)
4669 - return 0;
4670 - }
4671 -
4672 -+static int bios_warned;
4673 -+
4674 - int __init check_zero_address(void)
4675 - {
4676 - struct acpi_table_dmar *dmar;
4677 -@@ -601,6 +603,9 @@ int __init check_zero_address(void)
4678 - }
4679 -
4680 - if (entry_header->type == ACPI_DMAR_TYPE_HARDWARE_UNIT) {
4681 -+ void __iomem *addr;
4682 -+ u64 cap, ecap;
4683 -+
4684 - drhd = (void *)entry_header;
4685 - if (!drhd->address) {
4686 - /* Promote an attitude of violence to a BIOS engineer today */
4687 -@@ -609,17 +614,40 @@ int __init check_zero_address(void)
4688 - dmi_get_system_info(DMI_BIOS_VENDOR),
4689 - dmi_get_system_info(DMI_BIOS_VERSION),
4690 - dmi_get_system_info(DMI_PRODUCT_VERSION));
4691 --#ifdef CONFIG_DMAR
4692 -- dmar_disabled = 1;
4693 --#endif
4694 -- return 0;
4695 -+ bios_warned = 1;
4696 -+ goto failed;
4697 -+ }
4698 -+
4699 -+ addr = early_ioremap(drhd->address, VTD_PAGE_SIZE);
4700 -+ if (!addr ) {
4701 -+ printk("IOMMU: can't validate: %llx\n", drhd->address);
4702 -+ goto failed;
4703 -+ }
4704 -+ cap = dmar_readq(addr + DMAR_CAP_REG);
4705 -+ ecap = dmar_readq(addr + DMAR_ECAP_REG);
4706 -+ early_iounmap(addr, VTD_PAGE_SIZE);
4707 -+ if (cap == (uint64_t)-1 && ecap == (uint64_t)-1) {
4708 -+ /* Promote an attitude of violence to a BIOS engineer today */
4709 -+ WARN(1, "Your BIOS is broken; DMAR reported at address %llx returns all ones!\n"
4710 -+ "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
4711 -+ drhd->address,
4712 -+ dmi_get_system_info(DMI_BIOS_VENDOR),
4713 -+ dmi_get_system_info(DMI_BIOS_VERSION),
4714 -+ dmi_get_system_info(DMI_PRODUCT_VERSION));
4715 -+ bios_warned = 1;
4716 -+ goto failed;
4717 - }
4718 -- break;
4719 - }
4720 -
4721 - entry_header = ((void *)entry_header + entry_header->length);
4722 - }
4723 - return 1;
4724 -+
4725 -+failed:
4726 -+#ifdef CONFIG_DMAR
4727 -+ dmar_disabled = 1;
4728 -+#endif
4729 -+ return 0;
4730 - }
4731 -
4732 - void __init detect_intel_iommu(void)
4733 -@@ -664,6 +692,18 @@ int alloc_iommu(struct dmar_drhd_unit *drhd)
4734 - int agaw = 0;
4735 - int msagaw = 0;
4736 -
4737 -+ if (!drhd->reg_base_addr) {
4738 -+ if (!bios_warned) {
4739 -+ WARN(1, "Your BIOS is broken; DMAR reported at address zero!\n"
4740 -+ "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
4741 -+ dmi_get_system_info(DMI_BIOS_VENDOR),
4742 -+ dmi_get_system_info(DMI_BIOS_VERSION),
4743 -+ dmi_get_system_info(DMI_PRODUCT_VERSION));
4744 -+ bios_warned = 1;
4745 -+ }
4746 -+ return -EINVAL;
4747 -+ }
4748 -+
4749 - iommu = kzalloc(sizeof(*iommu), GFP_KERNEL);
4750 - if (!iommu)
4751 - return -ENOMEM;
4752 -@@ -680,13 +720,16 @@ int alloc_iommu(struct dmar_drhd_unit *drhd)
4753 - iommu->ecap = dmar_readq(iommu->reg + DMAR_ECAP_REG);
4754 -
4755 - if (iommu->cap == (uint64_t)-1 && iommu->ecap == (uint64_t)-1) {
4756 -- /* Promote an attitude of violence to a BIOS engineer today */
4757 -- WARN(1, "Your BIOS is broken; DMAR reported at address %llx returns all ones!\n"
4758 -- "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
4759 -- drhd->reg_base_addr,
4760 -- dmi_get_system_info(DMI_BIOS_VENDOR),
4761 -- dmi_get_system_info(DMI_BIOS_VERSION),
4762 -- dmi_get_system_info(DMI_PRODUCT_VERSION));
4763 -+ if (!bios_warned) {
4764 -+ /* Promote an attitude of violence to a BIOS engineer today */
4765 -+ WARN(1, "Your BIOS is broken; DMAR reported at address %llx returns all ones!\n"
4766 -+ "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
4767 -+ drhd->reg_base_addr,
4768 -+ dmi_get_system_info(DMI_BIOS_VENDOR),
4769 -+ dmi_get_system_info(DMI_BIOS_VERSION),
4770 -+ dmi_get_system_info(DMI_PRODUCT_VERSION));
4771 -+ bios_warned = 1;
4772 -+ }
4773 - goto err_unmap;
4774 - }
4775 -
4776 -diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
4777 -index 1840a05..2498602 100644
4778 ---- a/drivers/pci/intel-iommu.c
4779 -+++ b/drivers/pci/intel-iommu.c
4780 -@@ -1523,12 +1523,15 @@ static int domain_context_mapping_one(struct dmar_domain *domain, int segment,
4781 -
4782 - /* Skip top levels of page tables for
4783 - * iommu which has less agaw than default.
4784 -+ * Unnecessary for PT mode.
4785 - */
4786 -- for (agaw = domain->agaw; agaw != iommu->agaw; agaw--) {
4787 -- pgd = phys_to_virt(dma_pte_addr(pgd));
4788 -- if (!dma_pte_present(pgd)) {
4789 -- spin_unlock_irqrestore(&iommu->lock, flags);
4790 -- return -ENOMEM;
4791 -+ if (translation != CONTEXT_TT_PASS_THROUGH) {
4792 -+ for (agaw = domain->agaw; agaw != iommu->agaw; agaw--) {
4793 -+ pgd = phys_to_virt(dma_pte_addr(pgd));
4794 -+ if (!dma_pte_present(pgd)) {
4795 -+ spin_unlock_irqrestore(&iommu->lock, flags);
4796 -+ return -ENOMEM;
4797 -+ }
4798 - }
4799 - }
4800 - }
4801 -@@ -1991,6 +1994,16 @@ static int iommu_prepare_identity_map(struct pci_dev *pdev,
4802 - "IOMMU: Setting identity map for device %s [0x%Lx - 0x%Lx]\n",
4803 - pci_name(pdev), start, end);
4804 -
4805 -+ if (end < start) {
4806 -+ WARN(1, "Your BIOS is broken; RMRR ends before it starts!\n"
4807 -+ "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
4808 -+ dmi_get_system_info(DMI_BIOS_VENDOR),
4809 -+ dmi_get_system_info(DMI_BIOS_VERSION),
4810 -+ dmi_get_system_info(DMI_PRODUCT_VERSION));
4811 -+ ret = -EIO;
4812 -+ goto error;
4813 -+ }
4814 -+
4815 - if (end >> agaw_to_width(domain->agaw)) {
4816 - WARN(1, "Your BIOS is broken; RMRR exceeds permitted address width (%d bits)\n"
4817 - "BIOS vendor: %s; Ver: %s; Product Version: %s\n",
4818 -@@ -3228,6 +3241,9 @@ static int device_notifier(struct notifier_block *nb,
4819 - struct pci_dev *pdev = to_pci_dev(dev);
4820 - struct dmar_domain *domain;
4821 -
4822 -+ if (iommu_no_mapping(dev))
4823 -+ return 0;
4824 -+
4825 - domain = find_domain(pdev);
4826 - if (!domain)
4827 - return 0;
4828 -diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
4829 -index ab64522..d8b4229 100644
4830 ---- a/drivers/platform/x86/acerhdf.c
4831 -+++ b/drivers/platform/x86/acerhdf.c
4832 -@@ -52,7 +52,7 @@
4833 - */
4834 - #undef START_IN_KERNEL_MODE
4835 -
4836 --#define DRV_VER "0.5.18"
4837 -+#define DRV_VER "0.5.20"
4838 -
4839 - /*
4840 - * According to the Atom N270 datasheet,
4841 -@@ -112,12 +112,14 @@ module_param_string(force_product, force_product, 16, 0);
4842 - MODULE_PARM_DESC(force_product, "Force BIOS product and omit BIOS check");
4843 -
4844 - /*
4845 -- * cmd_off: to switch the fan completely off / to check if the fan is off
4846 -+ * cmd_off: to switch the fan completely off
4847 -+ * chk_off: to check if the fan is off
4848 - * cmd_auto: to set the BIOS in control of the fan. The BIOS regulates then
4849 - * the fan speed depending on the temperature
4850 - */
4851 - struct fancmd {
4852 - u8 cmd_off;
4853 -+ u8 chk_off;
4854 - u8 cmd_auto;
4855 - };
4856 -
4857 -@@ -134,32 +136,41 @@ struct bios_settings_t {
4858 - /* Register addresses and values for different BIOS versions */
4859 - static const struct bios_settings_t bios_tbl[] = {
4860 - /* AOA110 */
4861 -- {"Acer", "AOA110", "v0.3109", 0x55, 0x58, {0x1f, 0x00} },
4862 -- {"Acer", "AOA110", "v0.3114", 0x55, 0x58, {0x1f, 0x00} },
4863 -- {"Acer", "AOA110", "v0.3301", 0x55, 0x58, {0xaf, 0x00} },
4864 -- {"Acer", "AOA110", "v0.3304", 0x55, 0x58, {0xaf, 0x00} },
4865 -- {"Acer", "AOA110", "v0.3305", 0x55, 0x58, {0xaf, 0x00} },
4866 -- {"Acer", "AOA110", "v0.3307", 0x55, 0x58, {0xaf, 0x00} },
4867 -- {"Acer", "AOA110", "v0.3308", 0x55, 0x58, {0x21, 0x00} },
4868 -- {"Acer", "AOA110", "v0.3309", 0x55, 0x58, {0x21, 0x00} },
4869 -- {"Acer", "AOA110", "v0.3310", 0x55, 0x58, {0x21, 0x00} },
4870 -+ {"Acer", "AOA110", "v0.3109", 0x55, 0x58, {0x1f, 0x1f, 0x00} },
4871 -+ {"Acer", "AOA110", "v0.3114", 0x55, 0x58, {0x1f, 0x1f, 0x00} },
4872 -+ {"Acer", "AOA110", "v0.3301", 0x55, 0x58, {0xaf, 0xaf, 0x00} },
4873 -+ {"Acer", "AOA110", "v0.3304", 0x55, 0x58, {0xaf, 0xaf, 0x00} },
4874 -+ {"Acer", "AOA110", "v0.3305", 0x55, 0x58, {0xaf, 0xaf, 0x00} },
4875 -+ {"Acer", "AOA110", "v0.3307", 0x55, 0x58, {0xaf, 0xaf, 0x00} },
4876 -+ {"Acer", "AOA110", "v0.3308", 0x55, 0x58, {0x21, 0x21, 0x00} },
4877 -+ {"Acer", "AOA110", "v0.3309", 0x55, 0x58, {0x21, 0x21, 0x00} },
4878 -+ {"Acer", "AOA110", "v0.3310", 0x55, 0x58, {0x21, 0x21, 0x00} },
4879 - /* AOA150 */
4880 -- {"Acer", "AOA150", "v0.3114", 0x55, 0x58, {0x20, 0x00} },
4881 -- {"Acer", "AOA150", "v0.3301", 0x55, 0x58, {0x20, 0x00} },
4882 -- {"Acer", "AOA150", "v0.3304", 0x55, 0x58, {0x20, 0x00} },
4883 -- {"Acer", "AOA150", "v0.3305", 0x55, 0x58, {0x20, 0x00} },
4884 -- {"Acer", "AOA150", "v0.3307", 0x55, 0x58, {0x20, 0x00} },
4885 -- {"Acer", "AOA150", "v0.3308", 0x55, 0x58, {0x20, 0x00} },
4886 -- {"Acer", "AOA150", "v0.3309", 0x55, 0x58, {0x20, 0x00} },
4887 -- {"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x00} },
4888 -+ {"Acer", "AOA150", "v0.3114", 0x55, 0x58, {0x20, 0x20, 0x00} },
4889 -+ {"Acer", "AOA150", "v0.3301", 0x55, 0x58, {0x20, 0x20, 0x00} },
4890 -+ {"Acer", "AOA150", "v0.3304", 0x55, 0x58, {0x20, 0x20, 0x00} },
4891 -+ {"Acer", "AOA150", "v0.3305", 0x55, 0x58, {0x20, 0x20, 0x00} },
4892 -+ {"Acer", "AOA150", "v0.3307", 0x55, 0x58, {0x20, 0x20, 0x00} },
4893 -+ {"Acer", "AOA150", "v0.3308", 0x55, 0x58, {0x20, 0x20, 0x00} },
4894 -+ {"Acer", "AOA150", "v0.3309", 0x55, 0x58, {0x20, 0x20, 0x00} },
4895 -+ {"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x20, 0x00} },
4896 -+ /* Acer 1410 */
4897 -+ {"Acer", "Aspire 1410", "v0.3120", 0x55, 0x58, {0x9e, 0x9e, 0x00} },
4898 - /* special BIOS / other */
4899 -- {"Gateway", "AOA110", "v0.3103", 0x55, 0x58, {0x21, 0x00} },
4900 -- {"Gateway", "AOA150", "v0.3103", 0x55, 0x58, {0x20, 0x00} },
4901 -- {"Packard Bell", "DOA150", "v0.3104", 0x55, 0x58, {0x21, 0x00} },
4902 -- {"Packard Bell", "AOA110", "v0.3105", 0x55, 0x58, {0x21, 0x00} },
4903 -- {"Packard Bell", "AOA150", "v0.3105", 0x55, 0x58, {0x20, 0x00} },
4904 -+ {"Gateway", "AOA110", "v0.3103", 0x55, 0x58, {0x21, 0x21, 0x00} },
4905 -+ {"Gateway", "AOA150", "v0.3103", 0x55, 0x58, {0x20, 0x20, 0x00} },
4906 -+ {"Gateway ", "LT31 ", "v1.3103 ", 0x55, 0x58,
4907 -+ {0x10, 0x0f, 0x00} },
4908 -+ {"Gateway ", "LT31 ", "v1.3201 ", 0x55, 0x58,
4909 -+ {0x10, 0x0f, 0x00} },
4910 -+ {"Gateway ", "LT31 ", "v1.3302 ", 0x55, 0x58,
4911 -+ {0x10, 0x0f, 0x00} },
4912 -+ {"Packard Bell", "DOA150", "v0.3104", 0x55, 0x58, {0x21, 0x21, 0x00} },
4913 -+ {"Packard Bell", "DOA150", "v0.3105", 0x55, 0x58, {0x20, 0x20, 0x00} },
4914 -+ {"Packard Bell", "AOA110", "v0.3105", 0x55, 0x58, {0x21, 0x21, 0x00} },
4915 -+ {"Packard Bell", "AOA150", "v0.3105", 0x55, 0x58, {0x20, 0x20, 0x00} },
4916 - /* pewpew-terminator */
4917 -- {"", "", "", 0, 0, {0, 0} }
4918 -+ {"", "", "", 0, 0, {0, 0, 0} }
4919 - };
4920 -
4921 - static const struct bios_settings_t *bios_cfg __read_mostly;
4922 -@@ -183,7 +194,7 @@ static int acerhdf_get_fanstate(int *state)
4923 - if (ec_read(bios_cfg->fanreg, &fan))
4924 - return -EINVAL;
4925 -
4926 -- if (fan != bios_cfg->cmd.cmd_off)
4927 -+ if (fan != bios_cfg->cmd.chk_off)
4928 - *state = ACERHDF_FAN_AUTO;
4929 - else
4930 - *state = ACERHDF_FAN_OFF;
4931 -diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c
4932 -index b39d2bb..849359a 100644
4933 ---- a/drivers/platform/x86/asus-laptop.c
4934 -+++ b/drivers/platform/x86/asus-laptop.c
4935 -@@ -1283,8 +1283,8 @@ static int asus_hotk_add(struct acpi_device *device)
4936 - hotk->ledd_status = 0xFFF;
4937 -
4938 - /* Set initial values of light sensor and level */
4939 -- hotk->light_switch = 1; /* Default to light sensor disabled */
4940 -- hotk->light_level = 0; /* level 5 for sensor sensitivity */
4941 -+ hotk->light_switch = 0; /* Default to light sensor disabled */
4942 -+ hotk->light_level = 5; /* level 5 for sensor sensitivity */
4943 -
4944 - if (ls_switch_handle)
4945 - set_light_sens_switch(hotk->light_switch);
4946 -diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
4947 -index a848c7e..1ee734c 100644
4948 ---- a/drivers/platform/x86/thinkpad_acpi.c
4949 -+++ b/drivers/platform/x86/thinkpad_acpi.c
4950 -@@ -3866,15 +3866,6 @@ enum {
4951 -
4952 - #define TPACPI_RFK_BLUETOOTH_SW_NAME "tpacpi_bluetooth_sw"
4953 -
4954 --static void bluetooth_suspend(pm_message_t state)
4955 --{
4956 -- /* Try to make sure radio will resume powered off */
4957 -- if (!acpi_evalf(NULL, NULL, "\\BLTH", "vd",
4958 -- TP_ACPI_BLTH_PWR_OFF_ON_RESUME))
4959 -- vdbg_printk(TPACPI_DBG_RFKILL,
4960 -- "bluetooth power down on resume request failed\n");
4961 --}
4962 --
4963 - static int bluetooth_get_status(void)
4964 - {
4965 - int status;
4966 -@@ -3908,10 +3899,9 @@ static int bluetooth_set_status(enum tpacpi_rfkill_state state)
4967 - #endif
4968 -
4969 - /* We make sure to keep TP_ACPI_BLUETOOTH_RESUMECTRL off */
4970 -+ status = TP_ACPI_BLUETOOTH_RESUMECTRL;
4971 - if (state == TPACPI_RFK_RADIO_ON)
4972 -- status = TP_ACPI_BLUETOOTH_RADIOSSW;
4973 -- else
4974 -- status = 0;
4975 -+ status |= TP_ACPI_BLUETOOTH_RADIOSSW;
4976 -
4977 - if (!acpi_evalf(hkey_handle, NULL, "SBDC", "vd", status))
4978 - return -EIO;
4979 -@@ -4050,7 +4040,6 @@ static struct ibm_struct bluetooth_driver_data = {
4980 - .read = bluetooth_read,
4981 - .write = bluetooth_write,
4982 - .exit = bluetooth_exit,
4983 -- .suspend = bluetooth_suspend,
4984 - .shutdown = bluetooth_shutdown,
4985 - };
4986 -
4987 -@@ -4068,15 +4057,6 @@ enum {
4988 -
4989 - #define TPACPI_RFK_WWAN_SW_NAME "tpacpi_wwan_sw"
4990 -
4991 --static void wan_suspend(pm_message_t state)
4992 --{
4993 -- /* Try to make sure radio will resume powered off */
4994 -- if (!acpi_evalf(NULL, NULL, "\\WGSV", "qvd",
4995 -- TP_ACPI_WGSV_PWR_OFF_ON_RESUME))
4996 -- vdbg_printk(TPACPI_DBG_RFKILL,
4997 -- "WWAN power down on resume request failed\n");
4998 --}
4999 --
5000 - static int wan_get_status(void)
5001 - {
5002 - int status;
5003 -@@ -4109,11 +4089,10 @@ static int wan_set_status(enum tpacpi_rfkill_state state)
5004 - }
5005 - #endif
5006 -
5007 -- /* We make sure to keep TP_ACPI_WANCARD_RESUMECTRL off */
5008 -+ /* We make sure to set TP_ACPI_WANCARD_RESUMECTRL */
5009 -+ status = TP_ACPI_WANCARD_RESUMECTRL;
5010 - if (state == TPACPI_RFK_RADIO_ON)
5011 -- status = TP_ACPI_WANCARD_RADIOSSW;
5012 -- else
5013 -- status = 0;
5014 -+ status |= TP_ACPI_WANCARD_RADIOSSW;
5015 -
5016 - if (!acpi_evalf(hkey_handle, NULL, "SWAN", "vd", status))
5017 - return -EIO;
5018 -@@ -4251,7 +4230,6 @@ static struct ibm_struct wan_driver_data = {
5019 - .read = wan_read,
5020 - .write = wan_write,
5021 - .exit = wan_exit,
5022 -- .suspend = wan_suspend,
5023 - .shutdown = wan_shutdown,
5024 - };
5025 -
5026 -@@ -6123,8 +6101,8 @@ static const struct tpacpi_quirk brightness_quirk_table[] __initconst = {
5027 -
5028 - /* Models with Intel Extreme Graphics 2 */
5029 - TPACPI_Q_IBM('1', 'U', TPACPI_BRGHT_Q_NOEC),
5030 -- TPACPI_Q_IBM('1', 'V', TPACPI_BRGHT_Q_ASK|TPACPI_BRGHT_Q_NOEC),
5031 -- TPACPI_Q_IBM('1', 'W', TPACPI_BRGHT_Q_ASK|TPACPI_BRGHT_Q_NOEC),
5032 -+ TPACPI_Q_IBM('1', 'V', TPACPI_BRGHT_Q_ASK|TPACPI_BRGHT_Q_EC),
5033 -+ TPACPI_Q_IBM('1', 'W', TPACPI_BRGHT_Q_ASK|TPACPI_BRGHT_Q_EC),
5034 -
5035 - /* Models with Intel GMA900 */
5036 - TPACPI_Q_IBM('7', '0', TPACPI_BRGHT_Q_NOEC), /* T43, R52 */
5037 -diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
5038 -index 737b4c9..807042b 100644
5039 ---- a/drivers/serial/8250.c
5040 -+++ b/drivers/serial/8250.c
5041 -@@ -1339,14 +1339,12 @@ static void serial8250_start_tx(struct uart_port *port)
5042 - serial_out(up, UART_IER, up->ier);
5043 -
5044 - if (up->bugs & UART_BUG_TXEN) {
5045 -- unsigned char lsr, iir;
5046 -+ unsigned char lsr;
5047 - lsr = serial_in(up, UART_LSR);
5048 - up->lsr_saved_flags |= lsr & LSR_SAVE_FLAGS;
5049 -- iir = serial_in(up, UART_IIR) & 0x0f;
5050 - if ((up->port.type == PORT_RM9000) ?
5051 -- (lsr & UART_LSR_THRE &&
5052 -- (iir == UART_IIR_NO_INT || iir == UART_IIR_THRI)) :
5053 -- (lsr & UART_LSR_TEMT && iir & UART_IIR_NO_INT))
5054 -+ (lsr & UART_LSR_THRE) :
5055 -+ (lsr & UART_LSR_TEMT))
5056 - transmit_chars(up);
5057 - }
5058 - }
5059 -diff --git a/drivers/ssb/sprom.c b/drivers/ssb/sprom.c
5060 -index 8943015..eb70843 100644
5061 ---- a/drivers/ssb/sprom.c
5062 -+++ b/drivers/ssb/sprom.c
5063 -@@ -13,6 +13,8 @@
5064 -
5065 - #include "ssb_private.h"
5066 -
5067 -+#include <linux/ctype.h>
5068 -+
5069 -
5070 - static const struct ssb_sprom *fallback_sprom;
5071 -
5072 -@@ -33,17 +35,27 @@ static int sprom2hex(const u16 *sprom, char *buf, size_t buf_len,
5073 - static int hex2sprom(u16 *sprom, const char *dump, size_t len,
5074 - size_t sprom_size_words)
5075 - {
5076 -- char tmp[5] = { 0 };
5077 -- int cnt = 0;
5078 -+ char c, tmp[5] = { 0 };
5079 -+ int err, cnt = 0;
5080 - unsigned long parsed;
5081 -
5082 -- if (len < sprom_size_words * 2)
5083 -+ /* Strip whitespace at the end. */
5084 -+ while (len) {
5085 -+ c = dump[len - 1];
5086 -+ if (!isspace(c) && c != '\0')
5087 -+ break;
5088 -+ len--;
5089 -+ }
5090 -+ /* Length must match exactly. */
5091 -+ if (len != sprom_size_words * 4)
5092 - return -EINVAL;
5093 -
5094 - while (cnt < sprom_size_words) {
5095 - memcpy(tmp, dump, 4);
5096 - dump += 4;
5097 -- parsed = simple_strtoul(tmp, NULL, 16);
5098 -+ err = strict_strtoul(tmp, 16, &parsed);
5099 -+ if (err)
5100 -+ return err;
5101 - sprom[cnt++] = swab16((u16)parsed);
5102 - }
5103 -
5104 -diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c
5105 -index 2473cf0..d9461c9 100644
5106 ---- a/drivers/usb/class/usbtmc.c
5107 -+++ b/drivers/usb/class/usbtmc.c
5108 -@@ -562,10 +562,16 @@ static ssize_t usbtmc_write(struct file *filp, const char __user *buf,
5109 - n_bytes = roundup(12 + this_part, 4);
5110 - memset(buffer + 12 + this_part, 0, n_bytes - (12 + this_part));
5111 -
5112 -- retval = usb_bulk_msg(data->usb_dev,
5113 -- usb_sndbulkpipe(data->usb_dev,
5114 -- data->bulk_out),
5115 -- buffer, n_bytes, &actual, USBTMC_TIMEOUT);
5116 -+ do {
5117 -+ retval = usb_bulk_msg(data->usb_dev,
5118 -+ usb_sndbulkpipe(data->usb_dev,
5119 -+ data->bulk_out),
5120 -+ buffer, n_bytes,
5121 -+ &actual, USBTMC_TIMEOUT);
5122 -+ if (retval != 0)
5123 -+ break;
5124 -+ n_bytes -= actual;
5125 -+ } while (n_bytes);
5126 -
5127 - data->bTag_last_write = data->bTag;
5128 - data->bTag++;
5129 -diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
5130 -index b1b85ab..52e5e31 100644
5131 ---- a/drivers/usb/core/usb.c
5132 -+++ b/drivers/usb/core/usb.c
5133 -@@ -132,7 +132,7 @@ EXPORT_SYMBOL_GPL(usb_altnum_to_altsetting);
5134 -
5135 - struct find_interface_arg {
5136 - int minor;
5137 -- struct usb_interface *interface;
5138 -+ struct device_driver *drv;
5139 - };
5140 -
5141 - static int __find_interface(struct device *dev, void *data)
5142 -@@ -143,12 +143,10 @@ static int __find_interface(struct device *dev, void *data)
5143 - if (!is_usb_interface(dev))
5144 - return 0;
5145 -
5146 -+ if (dev->driver != arg->drv)
5147 -+ return 0;
5148 - intf = to_usb_interface(dev);
5149 -- if (intf->minor != -1 && intf->minor == arg->minor) {
5150 -- arg->interface = intf;
5151 -- return 1;
5152 -- }
5153 -- return 0;
5154 -+ return intf->minor == arg->minor;
5155 - }
5156 -
5157 - /**
5158 -@@ -156,21 +154,24 @@ static int __find_interface(struct device *dev, void *data)
5159 - * @drv: the driver whose current configuration is considered
5160 - * @minor: the minor number of the desired device
5161 - *
5162 -- * This walks the driver device list and returns a pointer to the interface
5163 -- * with the matching minor. Note, this only works for devices that share the
5164 -- * USB major number.
5165 -+ * This walks the bus device list and returns a pointer to the interface
5166 -+ * with the matching minor and driver. Note, this only works for devices
5167 -+ * that share the USB major number.
5168 - */
5169 - struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor)
5170 - {
5171 - struct find_interface_arg argb;
5172 -- int retval;
5173 -+ struct device *dev;
5174 -
5175 - argb.minor = minor;
5176 -- argb.interface = NULL;
5177 -- /* eat the error, it will be in argb.interface */
5178 -- retval = driver_for_each_device(&drv->drvwrap.driver, NULL, &argb,
5179 -- __find_interface);
5180 -- return argb.interface;
5181 -+ argb.drv = &drv->drvwrap.driver;
5182 -+
5183 -+ dev = bus_find_device(&usb_bus_type, NULL, &argb, __find_interface);
5184 -+
5185 -+ /* Drop reference count from bus_find_device */
5186 -+ put_device(dev);
5187 -+
5188 -+ return dev ? to_usb_interface(dev) : NULL;
5189 - }
5190 - EXPORT_SYMBOL_GPL(usb_find_interface);
5191 -
5192 -diff --git a/drivers/usb/musb/musb_gadget_ep0.c b/drivers/usb/musb/musb_gadget_ep0.c
5193 -index 522efb3..1c44b97 100644
5194 ---- a/drivers/usb/musb/musb_gadget_ep0.c
5195 -+++ b/drivers/usb/musb/musb_gadget_ep0.c
5196 -@@ -199,7 +199,6 @@ service_in_request(struct musb *musb, const struct usb_ctrlrequest *ctrlrequest)
5197 - static void musb_g_ep0_giveback(struct musb *musb, struct usb_request *req)
5198 - {
5199 - musb_g_giveback(&musb->endpoints[0].ep_in, req, 0);
5200 -- musb->ep0_state = MUSB_EP0_STAGE_SETUP;
5201 - }
5202 -
5203 - /*
5204 -diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
5205 -index 0577e4b..dffc8a1 100644
5206 ---- a/drivers/usb/serial/option.c
5207 -+++ b/drivers/usb/serial/option.c
5208 -@@ -580,12 +580,48 @@ static struct usb_device_id option_ids[] = {
5209 - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0086, 0xff, 0xff, 0xff) },
5210 - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2002, 0xff, 0xff, 0xff) },
5211 - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x2003, 0xff, 0xff, 0xff) },
5212 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0104, 0xff, 0xff, 0xff) },
5213 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0106, 0xff, 0xff, 0xff) },
5214 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0108, 0xff, 0xff, 0xff) },
5215 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0113, 0xff, 0xff, 0xff) },
5216 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0117, 0xff, 0xff, 0xff) },
5217 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0118, 0xff, 0xff, 0xff) },
5218 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0121, 0xff, 0xff, 0xff) },
5219 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0122, 0xff, 0xff, 0xff) },
5220 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0123, 0xff, 0xff, 0xff) },
5221 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0124, 0xff, 0xff, 0xff) },
5222 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0125, 0xff, 0xff, 0xff) },
5223 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0126, 0xff, 0xff, 0xff) },
5224 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0128, 0xff, 0xff, 0xff) },
5225 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0142, 0xff, 0xff, 0xff) },
5226 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0143, 0xff, 0xff, 0xff) },
5227 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0144, 0xff, 0xff, 0xff) },
5228 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0145, 0xff, 0xff, 0xff) },
5229 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0146, 0xff, 0xff, 0xff) },
5230 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0147, 0xff, 0xff, 0xff) },
5231 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0148, 0xff, 0xff, 0xff) },
5232 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0149, 0xff, 0xff, 0xff) },
5233 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0150, 0xff, 0xff, 0xff) },
5234 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0151, 0xff, 0xff, 0xff) },
5235 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0152, 0xff, 0xff, 0xff) },
5236 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0153, 0xff, 0xff, 0xff) },
5237 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0154, 0xff, 0xff, 0xff) },
5238 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0155, 0xff, 0xff, 0xff) },
5239 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0156, 0xff, 0xff, 0xff) },
5240 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0157, 0xff, 0xff, 0xff) },
5241 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0158, 0xff, 0xff, 0xff) },
5242 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0159, 0xff, 0xff, 0xff) },
5243 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0160, 0xff, 0xff, 0xff) },
5244 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0161, 0xff, 0xff, 0xff) },
5245 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0162, 0xff, 0xff, 0xff) },
5246 - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0014, 0xff, 0xff, 0xff) }, /* ZTE CDMA products */
5247 - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0027, 0xff, 0xff, 0xff) },
5248 - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0059, 0xff, 0xff, 0xff) },
5249 - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0060, 0xff, 0xff, 0xff) },
5250 - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0070, 0xff, 0xff, 0xff) },
5251 - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0073, 0xff, 0xff, 0xff) },
5252 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0130, 0xff, 0xff, 0xff) },
5253 -+ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0141, 0xff, 0xff, 0xff) },
5254 - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH, 0xff, 0xff, 0xff) },
5255 - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC8710, 0xff, 0xff, 0xff) },
5256 - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, ZTE_PRODUCT_AC2726, 0xff, 0xff, 0xff) },
5257 -@@ -599,6 +635,7 @@ static struct usb_device_id option_ids[] = {
5258 - { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_G450) },
5259 - { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_HSDPA_MINICARD ) }, /* Toshiba 3G HSDPA == Novatel Expedite EU870D MiniCard */
5260 - { USB_DEVICE(ALINK_VENDOR_ID, 0x9000) },
5261 -+ { USB_DEVICE(ALINK_VENDOR_ID, 0xce16) },
5262 - { USB_DEVICE_AND_INTERFACE_INFO(ALINK_VENDOR_ID, ALINK_PRODUCT_3GU, 0xff, 0xff, 0xff) },
5263 - { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S) },
5264 - { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) },
5265 -diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
5266 -index 589f6b4..cc313d1 100644
5267 ---- a/drivers/usb/storage/transport.c
5268 -+++ b/drivers/usb/storage/transport.c
5269 -@@ -666,10 +666,11 @@ void usb_stor_invoke_transport(struct scsi_cmnd *srb, struct us_data *us)
5270 - * to wait for at least one CHECK_CONDITION to determine
5271 - * SANE_SENSE support
5272 - */
5273 -- if ((srb->cmnd[0] == ATA_16 || srb->cmnd[0] == ATA_12) &&
5274 -+ if (unlikely((srb->cmnd[0] == ATA_16 || srb->cmnd[0] == ATA_12) &&
5275 - result == USB_STOR_TRANSPORT_GOOD &&
5276 - !(us->fflags & US_FL_SANE_SENSE) &&
5277 -- !(srb->cmnd[2] & 0x20)) {
5278 -+ !(us->fflags & US_FL_BAD_SENSE) &&
5279 -+ !(srb->cmnd[2] & 0x20))) {
5280 - US_DEBUGP("-- SAT supported, increasing auto-sense\n");
5281 - us->fflags |= US_FL_SANE_SENSE;
5282 - }
5283 -@@ -718,6 +719,12 @@ Retry_Sense:
5284 - if (test_bit(US_FLIDX_TIMED_OUT, &us->dflags)) {
5285 - US_DEBUGP("-- auto-sense aborted\n");
5286 - srb->result = DID_ABORT << 16;
5287 -+
5288 -+ /* If SANE_SENSE caused this problem, disable it */
5289 -+ if (sense_size != US_SENSE_SIZE) {
5290 -+ us->fflags &= ~US_FL_SANE_SENSE;
5291 -+ us->fflags |= US_FL_BAD_SENSE;
5292 -+ }
5293 - goto Handle_Errors;
5294 - }
5295 -
5296 -@@ -727,10 +734,11 @@ Retry_Sense:
5297 - * (small) sense request. This fixes some USB GSM modems
5298 - */
5299 - if (temp_result == USB_STOR_TRANSPORT_FAILED &&
5300 -- (us->fflags & US_FL_SANE_SENSE) &&
5301 -- sense_size != US_SENSE_SIZE) {
5302 -+ sense_size != US_SENSE_SIZE) {
5303 - US_DEBUGP("-- auto-sense failure, retry small sense\n");
5304 - sense_size = US_SENSE_SIZE;
5305 -+ us->fflags &= ~US_FL_SANE_SENSE;
5306 -+ us->fflags |= US_FL_BAD_SENSE;
5307 - goto Retry_Sense;
5308 - }
5309 -
5310 -@@ -754,6 +762,7 @@ Retry_Sense:
5311 - */
5312 - if (srb->sense_buffer[7] > (US_SENSE_SIZE - 8) &&
5313 - !(us->fflags & US_FL_SANE_SENSE) &&
5314 -+ !(us->fflags & US_FL_BAD_SENSE) &&
5315 - (srb->sense_buffer[0] & 0x7C) == 0x70) {
5316 - US_DEBUGP("-- SANE_SENSE support enabled\n");
5317 - us->fflags |= US_FL_SANE_SENSE;
5318 -diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
5319 -index d4f034e..64a0a2c 100644
5320 ---- a/drivers/usb/storage/unusual_devs.h
5321 -+++ b/drivers/usb/storage/unusual_devs.h
5322 -@@ -818,6 +818,13 @@ UNUSUAL_DEV( 0x066f, 0x8000, 0x0001, 0x0001,
5323 - US_SC_DEVICE, US_PR_DEVICE, NULL,
5324 - US_FL_FIX_CAPACITY ),
5325 -
5326 -+/* Reported by Daniel Kukula <daniel.kuku@×××××.com> */
5327 -+UNUSUAL_DEV( 0x067b, 0x1063, 0x0100, 0x0100,
5328 -+ "Prolific Technology, Inc.",
5329 -+ "Prolific Storage Gadget",
5330 -+ US_SC_DEVICE, US_PR_DEVICE, NULL,
5331 -+ US_FL_BAD_SENSE ),
5332 -+
5333 - /* Reported by Rogerio Brito <rbrito@×××××××.br> */
5334 - UNUSUAL_DEV( 0x067b, 0x2317, 0x0001, 0x001,
5335 - "Prolific Technology, Inc.",
5336 -diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
5337 -index 8060b85..716c8d7 100644
5338 ---- a/drivers/usb/storage/usb.c
5339 -+++ b/drivers/usb/storage/usb.c
5340 -@@ -228,6 +228,7 @@ void fill_inquiry_response(struct us_data *us, unsigned char *data,
5341 - if (data_len<36) // You lose.
5342 - return;
5343 -
5344 -+ memset(data+8, ' ', 28);
5345 - if(data[0]&0x20) { /* USB device currently not connected. Return
5346 - peripheral qualifier 001b ("...however, the
5347 - physical device is not currently connected
5348 -@@ -237,15 +238,15 @@ void fill_inquiry_response(struct us_data *us, unsigned char *data,
5349 - device, it may return zeros or ASCII spaces
5350 - (20h) in those fields until the data is
5351 - available from the device."). */
5352 -- memset(data+8,0,28);
5353 - } else {
5354 - u16 bcdDevice = le16_to_cpu(us->pusb_dev->descriptor.bcdDevice);
5355 -- memcpy(data+8, us->unusual_dev->vendorName,
5356 -- strlen(us->unusual_dev->vendorName) > 8 ? 8 :
5357 -- strlen(us->unusual_dev->vendorName));
5358 -- memcpy(data+16, us->unusual_dev->productName,
5359 -- strlen(us->unusual_dev->productName) > 16 ? 16 :
5360 -- strlen(us->unusual_dev->productName));
5361 -+ int n;
5362 -+
5363 -+ n = strlen(us->unusual_dev->vendorName);
5364 -+ memcpy(data+8, us->unusual_dev->vendorName, min(8, n));
5365 -+ n = strlen(us->unusual_dev->productName);
5366 -+ memcpy(data+16, us->unusual_dev->productName, min(16, n));
5367 -+
5368 - data[32] = 0x30 + ((bcdDevice>>12) & 0x0F);
5369 - data[33] = 0x30 + ((bcdDevice>>8) & 0x0F);
5370 - data[34] = 0x30 + ((bcdDevice>>4) & 0x0F);
5371 -@@ -459,6 +460,9 @@ static void adjust_quirks(struct us_data *us)
5372 - case 'a':
5373 - f |= US_FL_SANE_SENSE;
5374 - break;
5375 -+ case 'b':
5376 -+ f |= US_FL_BAD_SENSE;
5377 -+ break;
5378 - case 'c':
5379 - f |= US_FL_FIX_CAPACITY;
5380 - break;
5381 -diff --git a/drivers/video/matrox/g450_pll.c b/drivers/video/matrox/g450_pll.c
5382 -index 09f6e04..c15f8a5 100644
5383 ---- a/drivers/video/matrox/g450_pll.c
5384 -+++ b/drivers/video/matrox/g450_pll.c
5385 -@@ -368,7 +368,8 @@ static int __g450_setclk(struct matrox_fb_info *minfo, unsigned int fout,
5386 - M1064_XDVICLKCTRL_C1DVICLKEN |
5387 - M1064_XDVICLKCTRL_DVILOOPCTL |
5388 - M1064_XDVICLKCTRL_P1LOOPBWDTCTL;
5389 -- matroxfb_DAC_out(minfo, M1064_XDVICLKCTRL, tmp);
5390 -+ /* Setting this breaks PC systems so don't do it */
5391 -+ /* matroxfb_DAC_out(minfo, M1064_XDVICLKCTRL, tmp); */
5392 - matroxfb_DAC_out(minfo, M1064_XPWRCTRL,
5393 - xpwrctrl);
5394 -
5395 -diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
5396 -index d31505b..4204336 100644
5397 ---- a/drivers/xen/balloon.c
5398 -+++ b/drivers/xen/balloon.c
5399 -@@ -66,8 +66,6 @@ struct balloon_stats {
5400 - /* We aim for 'current allocation' == 'target allocation'. */
5401 - unsigned long current_pages;
5402 - unsigned long target_pages;
5403 -- /* We may hit the hard limit in Xen. If we do then we remember it. */
5404 -- unsigned long hard_limit;
5405 - /*
5406 - * Drivers may alter the memory reservation independently, but they
5407 - * must inform the balloon driver so we avoid hitting the hard limit.
5408 -@@ -136,6 +134,8 @@ static void balloon_append(struct page *page)
5409 - list_add(&page->lru, &ballooned_pages);
5410 - balloon_stats.balloon_low++;
5411 - }
5412 -+
5413 -+ totalram_pages--;
5414 - }
5415 -
5416 - /* balloon_retrieve: rescue a page from the balloon, if it is not empty. */
5417 -@@ -156,6 +156,8 @@ static struct page *balloon_retrieve(void)
5418 - else
5419 - balloon_stats.balloon_low--;
5420 -
5421 -+ totalram_pages++;
5422 -+
5423 - return page;
5424 - }
5425 -
5426 -@@ -181,7 +183,7 @@ static void balloon_alarm(unsigned long unused)
5427 -
5428 - static unsigned long current_target(void)
5429 - {
5430 -- unsigned long target = min(balloon_stats.target_pages, balloon_stats.hard_limit);
5431 -+ unsigned long target = balloon_stats.target_pages;
5432 -
5433 - target = min(target,
5434 - balloon_stats.current_pages +
5435 -@@ -217,23 +219,10 @@ static int increase_reservation(unsigned long nr_pages)
5436 - set_xen_guest_handle(reservation.extent_start, frame_list);
5437 - reservation.nr_extents = nr_pages;
5438 - rc = HYPERVISOR_memory_op(XENMEM_populate_physmap, &reservation);
5439 -- if (rc < nr_pages) {
5440 -- if (rc > 0) {
5441 -- int ret;
5442 --
5443 -- /* We hit the Xen hard limit: reprobe. */
5444 -- reservation.nr_extents = rc;
5445 -- ret = HYPERVISOR_memory_op(XENMEM_decrease_reservation,
5446 -- &reservation);
5447 -- BUG_ON(ret != rc);
5448 -- }
5449 -- if (rc >= 0)
5450 -- balloon_stats.hard_limit = (balloon_stats.current_pages + rc -
5451 -- balloon_stats.driver_pages);
5452 -+ if (rc < 0)
5453 - goto out;
5454 -- }
5455 -
5456 -- for (i = 0; i < nr_pages; i++) {
5457 -+ for (i = 0; i < rc; i++) {
5458 - page = balloon_retrieve();
5459 - BUG_ON(page == NULL);
5460 -
5461 -@@ -259,13 +248,12 @@ static int increase_reservation(unsigned long nr_pages)
5462 - __free_page(page);
5463 - }
5464 -
5465 -- balloon_stats.current_pages += nr_pages;
5466 -- totalram_pages = balloon_stats.current_pages;
5467 -+ balloon_stats.current_pages += rc;
5468 -
5469 - out:
5470 - spin_unlock_irqrestore(&balloon_lock, flags);
5471 -
5472 -- return 0;
5473 -+ return rc < 0 ? rc : rc != nr_pages;
5474 - }
5475 -
5476 - static int decrease_reservation(unsigned long nr_pages)
5477 -@@ -323,7 +311,6 @@ static int decrease_reservation(unsigned long nr_pages)
5478 - BUG_ON(ret != nr_pages);
5479 -
5480 - balloon_stats.current_pages -= nr_pages;
5481 -- totalram_pages = balloon_stats.current_pages;
5482 -
5483 - spin_unlock_irqrestore(&balloon_lock, flags);
5484 -
5485 -@@ -367,7 +354,6 @@ static void balloon_process(struct work_struct *work)
5486 - static void balloon_set_new_target(unsigned long target)
5487 - {
5488 - /* No need for lock. Not read-modify-write updates. */
5489 -- balloon_stats.hard_limit = ~0UL;
5490 - balloon_stats.target_pages = target;
5491 - schedule_work(&balloon_worker);
5492 - }
5493 -@@ -422,12 +408,10 @@ static int __init balloon_init(void)
5494 - pr_info("xen_balloon: Initialising balloon driver.\n");
5495 -
5496 - balloon_stats.current_pages = min(xen_start_info->nr_pages, max_pfn);
5497 -- totalram_pages = balloon_stats.current_pages;
5498 - balloon_stats.target_pages = balloon_stats.current_pages;
5499 - balloon_stats.balloon_low = 0;
5500 - balloon_stats.balloon_high = 0;
5501 - balloon_stats.driver_pages = 0UL;
5502 -- balloon_stats.hard_limit = ~0UL;
5503 -
5504 - init_timer(&balloon_timer);
5505 - balloon_timer.data = 0;
5506 -@@ -472,9 +456,6 @@ module_exit(balloon_exit);
5507 - BALLOON_SHOW(current_kb, "%lu\n", PAGES2KB(balloon_stats.current_pages));
5508 - BALLOON_SHOW(low_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_low));
5509 - BALLOON_SHOW(high_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_high));
5510 --BALLOON_SHOW(hard_limit_kb,
5511 -- (balloon_stats.hard_limit!=~0UL) ? "%lu\n" : "???\n",
5512 -- (balloon_stats.hard_limit!=~0UL) ? PAGES2KB(balloon_stats.hard_limit) : 0);
5513 - BALLOON_SHOW(driver_kb, "%lu\n", PAGES2KB(balloon_stats.driver_pages));
5514 -
5515 - static ssize_t show_target_kb(struct sys_device *dev, struct sysdev_attribute *attr,
5516 -@@ -544,7 +525,6 @@ static struct attribute *balloon_info_attrs[] = {
5517 - &attr_current_kb.attr,
5518 - &attr_low_kb.attr,
5519 - &attr_high_kb.attr,
5520 -- &attr_hard_limit_kb.attr,
5521 - &attr_driver_kb.attr,
5522 - NULL
5523 - };
5524 -diff --git a/drivers/xen/events.c b/drivers/xen/events.c
5525 -index 2f57276..ce602dd 100644
5526 ---- a/drivers/xen/events.c
5527 -+++ b/drivers/xen/events.c
5528 -@@ -474,6 +474,9 @@ static void unbind_from_irq(unsigned int irq)
5529 - bind_evtchn_to_cpu(evtchn, 0);
5530 -
5531 - evtchn_to_irq[evtchn] = -1;
5532 -+ }
5533 -+
5534 -+ if (irq_info[irq].type != IRQT_UNBOUND) {
5535 - irq_info[irq] = mk_unbound_info();
5536 -
5537 - dynamic_irq_cleanup(irq);
5538 -diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c
5539 -index 10d03d7..c499793 100644
5540 ---- a/drivers/xen/manage.c
5541 -+++ b/drivers/xen/manage.c
5542 -@@ -43,7 +43,6 @@ static int xen_suspend(void *data)
5543 - if (err) {
5544 - printk(KERN_ERR "xen_suspend: sysdev_suspend failed: %d\n",
5545 - err);
5546 -- dpm_resume_noirq(PMSG_RESUME);
5547 - return err;
5548 - }
5549 -
5550 -@@ -69,7 +68,6 @@ static int xen_suspend(void *data)
5551 - }
5552 -
5553 - sysdev_resume();
5554 -- dpm_resume_noirq(PMSG_RESUME);
5555 -
5556 - return 0;
5557 - }
5558 -@@ -81,6 +79,12 @@ static void do_suspend(void)
5559 -
5560 - shutting_down = SHUTDOWN_SUSPEND;
5561 -
5562 -+ err = stop_machine_create();
5563 -+ if (err) {
5564 -+ printk(KERN_ERR "xen suspend: failed to setup stop_machine %d\n", err);
5565 -+ goto out;
5566 -+ }
5567 -+
5568 - #ifdef CONFIG_PREEMPT
5569 - /* If the kernel is preemptible, we need to freeze all the processes
5570 - to prevent them from being in the middle of a pagetable update
5571 -@@ -88,29 +92,32 @@ static void do_suspend(void)
5572 - err = freeze_processes();
5573 - if (err) {
5574 - printk(KERN_ERR "xen suspend: freeze failed %d\n", err);
5575 -- return;
5576 -+ goto out_destroy_sm;
5577 - }
5578 - #endif
5579 -
5580 - err = dpm_suspend_start(PMSG_SUSPEND);
5581 - if (err) {
5582 - printk(KERN_ERR "xen suspend: dpm_suspend_start %d\n", err);
5583 -- goto out;
5584 -+ goto out_thaw;
5585 - }
5586 -
5587 -- printk(KERN_DEBUG "suspending xenstore...\n");
5588 -- xs_suspend();
5589 --
5590 - err = dpm_suspend_noirq(PMSG_SUSPEND);
5591 - if (err) {
5592 - printk(KERN_ERR "dpm_suspend_noirq failed: %d\n", err);
5593 -- goto resume_devices;
5594 -+ goto out_resume;
5595 - }
5596 -
5597 -+ printk(KERN_DEBUG "suspending xenstore...\n");
5598 -+ xs_suspend();
5599 -+
5600 - err = stop_machine(xen_suspend, &cancelled, cpumask_of(0));
5601 -+
5602 -+ dpm_resume_noirq(PMSG_RESUME);
5603 -+
5604 - if (err) {
5605 - printk(KERN_ERR "failed to start xen_suspend: %d\n", err);
5606 -- goto out;
5607 -+ cancelled = 1;
5608 - }
5609 -
5610 - if (!cancelled) {
5611 -@@ -119,17 +126,21 @@ static void do_suspend(void)
5612 - } else
5613 - xs_suspend_cancel();
5614 -
5615 -- dpm_resume_noirq(PMSG_RESUME);
5616 --
5617 --resume_devices:
5618 -+out_resume:
5619 - dpm_resume_end(PMSG_RESUME);
5620 -
5621 - /* Make sure timer events get retriggered on all CPUs */
5622 - clock_was_set();
5623 --out:
5624 -+
5625 -+out_thaw:
5626 - #ifdef CONFIG_PREEMPT
5627 - thaw_processes();
5628 -+
5629 -+out_destroy_sm:
5630 - #endif
5631 -+ stop_machine_destroy();
5632 -+
5633 -+out:
5634 - shutting_down = SHUTDOWN_INVALID;
5635 - }
5636 - #endif /* CONFIG_PM_SLEEP */
5637 -diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
5638 -index d42e25d..3800da7 100644
5639 ---- a/drivers/xen/xenbus/xenbus_probe.c
5640 -+++ b/drivers/xen/xenbus/xenbus_probe.c
5641 -@@ -454,21 +454,21 @@ static ssize_t xendev_show_nodename(struct device *dev,
5642 - {
5643 - return sprintf(buf, "%s\n", to_xenbus_device(dev)->nodename);
5644 - }
5645 --DEVICE_ATTR(nodename, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_nodename, NULL);
5646 -+static DEVICE_ATTR(nodename, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_nodename, NULL);
5647 -
5648 - static ssize_t xendev_show_devtype(struct device *dev,
5649 - struct device_attribute *attr, char *buf)
5650 - {
5651 - return sprintf(buf, "%s\n", to_xenbus_device(dev)->devicetype);
5652 - }
5653 --DEVICE_ATTR(devtype, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_devtype, NULL);
5654 -+static DEVICE_ATTR(devtype, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_devtype, NULL);
5655 -
5656 - static ssize_t xendev_show_modalias(struct device *dev,
5657 - struct device_attribute *attr, char *buf)
5658 - {
5659 - return sprintf(buf, "xen:%s\n", to_xenbus_device(dev)->devicetype);
5660 - }
5661 --DEVICE_ATTR(modalias, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_modalias, NULL);
5662 -+static DEVICE_ATTR(modalias, S_IRUSR | S_IRGRP | S_IROTH, xendev_show_modalias, NULL);
5663 -
5664 - int xenbus_probe_node(struct xen_bus_type *bus,
5665 - const char *type,
5666 -diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
5667 -index d22438e..39c6ee8 100644
5668 ---- a/fs/debugfs/inode.c
5669 -+++ b/fs/debugfs/inode.c
5670 -@@ -32,7 +32,9 @@ static struct vfsmount *debugfs_mount;
5671 - static int debugfs_mount_count;
5672 - static bool debugfs_registered;
5673 -
5674 --static struct inode *debugfs_get_inode(struct super_block *sb, int mode, dev_t dev)
5675 -+static struct inode *debugfs_get_inode(struct super_block *sb, int mode, dev_t dev,
5676 -+ void *data, const struct file_operations *fops)
5677 -+
5678 - {
5679 - struct inode *inode = new_inode(sb);
5680 -
5681 -@@ -44,14 +46,18 @@ static struct inode *debugfs_get_inode(struct super_block *sb, int mode, dev_t d
5682 - init_special_inode(inode, mode, dev);
5683 - break;
5684 - case S_IFREG:
5685 -- inode->i_fop = &debugfs_file_operations;
5686 -+ inode->i_fop = fops ? fops : &debugfs_file_operations;
5687 -+ inode->i_private = data;
5688 - break;
5689 - case S_IFLNK:
5690 - inode->i_op = &debugfs_link_operations;
5691 -+ inode->i_fop = fops;
5692 -+ inode->i_private = data;
5693 - break;
5694 - case S_IFDIR:
5695 - inode->i_op = &simple_dir_inode_operations;
5696 -- inode->i_fop = &simple_dir_operations;
5697 -+ inode->i_fop = fops ? fops : &simple_dir_operations;
5698 -+ inode->i_private = data;
5699 -
5700 - /* directory inodes start off with i_nlink == 2
5701 - * (for "." entry) */
5702 -@@ -64,7 +70,8 @@ static struct inode *debugfs_get_inode(struct super_block *sb, int mode, dev_t d
5703 -
5704 - /* SMP-safe */
5705 - static int debugfs_mknod(struct inode *dir, struct dentry *dentry,
5706 -- int mode, dev_t dev)
5707 -+ int mode, dev_t dev, void *data,
5708 -+ const struct file_operations *fops)
5709 - {
5710 - struct inode *inode;
5711 - int error = -EPERM;
5712 -@@ -72,7 +79,7 @@ static int debugfs_mknod(struct inode *dir, struct dentry *dentry,
5713 - if (dentry->d_inode)
5714 - return -EEXIST;
5715 -
5716 -- inode = debugfs_get_inode(dir->i_sb, mode, dev);
5717 -+ inode = debugfs_get_inode(dir->i_sb, mode, dev, data, fops);
5718 - if (inode) {
5719 - d_instantiate(dentry, inode);
5720 - dget(dentry);
5721 -@@ -81,12 +88,13 @@ static int debugfs_mknod(struct inode *dir, struct dentry *dentry,
5722 - return error;
5723 - }
5724 -
5725 --static int debugfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
5726 -+static int debugfs_mkdir(struct inode *dir, struct dentry *dentry, int mode,
5727 -+ void *data, const struct file_operations *fops)
5728 - {
5729 - int res;
5730 -
5731 - mode = (mode & (S_IRWXUGO | S_ISVTX)) | S_IFDIR;
5732 -- res = debugfs_mknod(dir, dentry, mode, 0);
5733 -+ res = debugfs_mknod(dir, dentry, mode, 0, data, fops);
5734 - if (!res) {
5735 - inc_nlink(dir);
5736 - fsnotify_mkdir(dir, dentry);
5737 -@@ -94,18 +102,20 @@ static int debugfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
5738 - return res;
5739 - }
5740 -
5741 --static int debugfs_link(struct inode *dir, struct dentry *dentry, int mode)
5742 -+static int debugfs_link(struct inode *dir, struct dentry *dentry, int mode,
5743 -+ void *data, const struct file_operations *fops)
5744 - {
5745 - mode = (mode & S_IALLUGO) | S_IFLNK;
5746 -- return debugfs_mknod(dir, dentry, mode, 0);
5747 -+ return debugfs_mknod(dir, dentry, mode, 0, data, fops);
5748 - }
5749 -
5750 --static int debugfs_create(struct inode *dir, struct dentry *dentry, int mode)
5751 -+static int debugfs_create(struct inode *dir, struct dentry *dentry, int mode,
5752 -+ void *data, const struct file_operations *fops)
5753 - {
5754 - int res;
5755 -
5756 - mode = (mode & S_IALLUGO) | S_IFREG;
5757 -- res = debugfs_mknod(dir, dentry, mode, 0);
5758 -+ res = debugfs_mknod(dir, dentry, mode, 0, data, fops);
5759 - if (!res)
5760 - fsnotify_create(dir, dentry);
5761 - return res;
5762 -@@ -139,7 +149,9 @@ static struct file_system_type debug_fs_type = {
5763 -
5764 - static int debugfs_create_by_name(const char *name, mode_t mode,
5765 - struct dentry *parent,
5766 -- struct dentry **dentry)
5767 -+ struct dentry **dentry,
5768 -+ void *data,
5769 -+ const struct file_operations *fops)
5770 - {
5771 - int error = 0;
5772 -
5773 -@@ -164,13 +176,16 @@ static int debugfs_create_by_name(const char *name, mode_t mode,
5774 - if (!IS_ERR(*dentry)) {
5775 - switch (mode & S_IFMT) {
5776 - case S_IFDIR:
5777 -- error = debugfs_mkdir(parent->d_inode, *dentry, mode);
5778 -+ error = debugfs_mkdir(parent->d_inode, *dentry, mode,
5779 -+ data, fops);
5780 - break;
5781 - case S_IFLNK:
5782 -- error = debugfs_link(parent->d_inode, *dentry, mode);
5783 -+ error = debugfs_link(parent->d_inode, *dentry, mode,
5784 -+ data, fops);
5785 - break;
5786 - default:
5787 -- error = debugfs_create(parent->d_inode, *dentry, mode);
5788 -+ error = debugfs_create(parent->d_inode, *dentry, mode,
5789 -+ data, fops);
5790 - break;
5791 - }
5792 - dput(*dentry);
5793 -@@ -221,19 +236,13 @@ struct dentry *debugfs_create_file(const char *name, mode_t mode,
5794 - if (error)
5795 - goto exit;
5796 -
5797 -- error = debugfs_create_by_name(name, mode, parent, &dentry);
5798 -+ error = debugfs_create_by_name(name, mode, parent, &dentry,
5799 -+ data, fops);
5800 - if (error) {
5801 - dentry = NULL;
5802 - simple_release_fs(&debugfs_mount, &debugfs_mount_count);
5803 - goto exit;
5804 - }
5805 --
5806 -- if (dentry->d_inode) {
5807 -- if (data)
5808 -- dentry->d_inode->i_private = data;
5809 -- if (fops)
5810 -- dentry->d_inode->i_fop = fops;
5811 -- }
5812 - exit:
5813 - return dentry;
5814 - }
5815 -diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
5816 -index d5f8c96..8882ecc 100644
5817 ---- a/fs/devpts/inode.c
5818 -+++ b/fs/devpts/inode.c
5819 -@@ -517,11 +517,23 @@ int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty)
5820 -
5821 - struct tty_struct *devpts_get_tty(struct inode *pts_inode, int number)
5822 - {
5823 -+ struct dentry *dentry;
5824 -+ struct tty_struct *tty;
5825 -+
5826 - BUG_ON(pts_inode->i_rdev == MKDEV(TTYAUX_MAJOR, PTMX_MINOR));
5827 -
5828 -+ /* Ensure dentry has not been deleted by devpts_pty_kill() */
5829 -+ dentry = d_find_alias(pts_inode);
5830 -+ if (!dentry)
5831 -+ return NULL;
5832 -+
5833 -+ tty = NULL;
5834 - if (pts_inode->i_sb->s_magic == DEVPTS_SUPER_MAGIC)
5835 -- return (struct tty_struct *)pts_inode->i_private;
5836 -- return NULL;
5837 -+ tty = (struct tty_struct *)pts_inode->i_private;
5838 -+
5839 -+ dput(dentry);
5840 -+
5841 -+ return tty;
5842 - }
5843 -
5844 - void devpts_pty_kill(struct tty_struct *tty)
5845 -diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
5846 -index 354ed3b..f9d6937 100644
5847 ---- a/fs/ext3/inode.c
5848 -+++ b/fs/ext3/inode.c
5849 -@@ -1151,6 +1151,16 @@ static int do_journal_get_write_access(handle_t *handle,
5850 - return ext3_journal_get_write_access(handle, bh);
5851 - }
5852 -
5853 -+/*
5854 -+ * Truncate blocks that were not used by write. We have to truncate the
5855 -+ * pagecache as well so that corresponding buffers get properly unmapped.
5856 -+ */
5857 -+static void ext3_truncate_failed_write(struct inode *inode)
5858 -+{
5859 -+ truncate_inode_pages(inode->i_mapping, inode->i_size);
5860 -+ ext3_truncate(inode);
5861 -+}
5862 -+
5863 - static int ext3_write_begin(struct file *file, struct address_space *mapping,
5864 - loff_t pos, unsigned len, unsigned flags,
5865 - struct page **pagep, void **fsdata)
5866 -@@ -1209,7 +1219,7 @@ write_begin_failed:
5867 - unlock_page(page);
5868 - page_cache_release(page);
5869 - if (pos + len > inode->i_size)
5870 -- ext3_truncate(inode);
5871 -+ ext3_truncate_failed_write(inode);
5872 - }
5873 - if (ret == -ENOSPC && ext3_should_retry_alloc(inode->i_sb, &retries))
5874 - goto retry;
5875 -@@ -1304,7 +1314,7 @@ static int ext3_ordered_write_end(struct file *file,
5876 - page_cache_release(page);
5877 -
5878 - if (pos + len > inode->i_size)
5879 -- ext3_truncate(inode);
5880 -+ ext3_truncate_failed_write(inode);
5881 - return ret ? ret : copied;
5882 - }
5883 -
5884 -@@ -1330,7 +1340,7 @@ static int ext3_writeback_write_end(struct file *file,
5885 - page_cache_release(page);
5886 -
5887 - if (pos + len > inode->i_size)
5888 -- ext3_truncate(inode);
5889 -+ ext3_truncate_failed_write(inode);
5890 - return ret ? ret : copied;
5891 - }
5892 -
5893 -@@ -1383,7 +1393,7 @@ static int ext3_journalled_write_end(struct file *file,
5894 - page_cache_release(page);
5895 -
5896 - if (pos + len > inode->i_size)
5897 -- ext3_truncate(inode);
5898 -+ ext3_truncate_failed_write(inode);
5899 - return ret ? ret : copied;
5900 - }
5901 -
5902 -diff --git a/fs/hfs/catalog.c b/fs/hfs/catalog.c
5903 -index 6d98f11..424b033 100644
5904 ---- a/fs/hfs/catalog.c
5905 -+++ b/fs/hfs/catalog.c
5906 -@@ -289,6 +289,10 @@ int hfs_cat_move(u32 cnid, struct inode *src_dir, struct qstr *src_name,
5907 - err = hfs_brec_find(&src_fd);
5908 - if (err)
5909 - goto out;
5910 -+ if (src_fd.entrylength > sizeof(entry) || src_fd.entrylength < 0) {
5911 -+ err = -EIO;
5912 -+ goto out;
5913 -+ }
5914 -
5915 - hfs_bnode_read(src_fd.bnode, &entry, src_fd.entryoffset,
5916 - src_fd.entrylength);
5917 -diff --git a/fs/hfs/dir.c b/fs/hfs/dir.c
5918 -index 7c69b98..2b3b861 100644
5919 ---- a/fs/hfs/dir.c
5920 -+++ b/fs/hfs/dir.c
5921 -@@ -79,6 +79,11 @@ static int hfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
5922 - filp->f_pos++;
5923 - /* fall through */
5924 - case 1:
5925 -+ if (fd.entrylength > sizeof(entry) || fd.entrylength < 0) {
5926 -+ err = -EIO;
5927 -+ goto out;
5928 -+ }
5929 -+
5930 - hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, fd.entrylength);
5931 - if (entry.type != HFS_CDR_THD) {
5932 - printk(KERN_ERR "hfs: bad catalog folder thread\n");
5933 -@@ -109,6 +114,12 @@ static int hfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
5934 - err = -EIO;
5935 - goto out;
5936 - }
5937 -+
5938 -+ if (fd.entrylength > sizeof(entry) || fd.entrylength < 0) {
5939 -+ err = -EIO;
5940 -+ goto out;
5941 -+ }
5942 -+
5943 - hfs_bnode_read(fd.bnode, &entry, fd.entryoffset, fd.entrylength);
5944 - type = entry.type;
5945 - len = hfs_mac2asc(sb, strbuf, &fd.key->cat.CName);
5946 -diff --git a/fs/hfs/super.c b/fs/hfs/super.c
5947 -index f7fcbe4..5ed7252 100644
5948 ---- a/fs/hfs/super.c
5949 -+++ b/fs/hfs/super.c
5950 -@@ -409,8 +409,13 @@ static int hfs_fill_super(struct super_block *sb, void *data, int silent)
5951 - /* try to get the root inode */
5952 - hfs_find_init(HFS_SB(sb)->cat_tree, &fd);
5953 - res = hfs_cat_find_brec(sb, HFS_ROOT_CNID, &fd);
5954 -- if (!res)
5955 -+ if (!res) {
5956 -+ if (fd.entrylength > sizeof(rec) || fd.entrylength < 0) {
5957 -+ res = -EIO;
5958 -+ goto bail;
5959 -+ }
5960 - hfs_bnode_read(fd.bnode, &rec, fd.entryoffset, fd.entrylength);
5961 -+ }
5962 - if (res) {
5963 - hfs_find_exit(&fd);
5964 - goto bail_no_root;
5965 -diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
5966 -index 82c295d..b7ca3a9 100644
5967 ---- a/fs/jbd2/journal.c
5968 -+++ b/fs/jbd2/journal.c
5969 -@@ -1253,6 +1253,13 @@ int jbd2_journal_load(journal_t *journal)
5970 - if (jbd2_journal_recover(journal))
5971 - goto recovery_error;
5972 -
5973 -+ if (journal->j_failed_commit) {
5974 -+ printk(KERN_ERR "JBD2: journal transaction %u on %s "
5975 -+ "is corrupt.\n", journal->j_failed_commit,
5976 -+ journal->j_devname);
5977 -+ return -EIO;
5978 -+ }
5979 -+
5980 - /* OK, we've finished with the dynamic journal bits:
5981 - * reinitialise the dynamic contents of the superblock in memory
5982 - * and reset them on disk. */
5983 -diff --git a/fs/jffs2/gc.c b/fs/jffs2/gc.c
5984 -index 090c556..3b6f2fa 100644
5985 ---- a/fs/jffs2/gc.c
5986 -+++ b/fs/jffs2/gc.c
5987 -@@ -700,7 +700,8 @@ static int jffs2_garbage_collect_metadata(struct jffs2_sb_info *c, struct jffs2_
5988 - struct jffs2_raw_inode ri;
5989 - struct jffs2_node_frag *last_frag;
5990 - union jffs2_device_node dev;
5991 -- char *mdata = NULL, mdatalen = 0;
5992 -+ char *mdata = NULL;
5993 -+ int mdatalen = 0;
5994 - uint32_t alloclen, ilen;
5995 - int ret;
5996 -
5997 -diff --git a/fs/nfs/write.c b/fs/nfs/write.c
5998 -index 53eb26c..6fc3776 100644
5999 ---- a/fs/nfs/write.c
6000 -+++ b/fs/nfs/write.c
6001 -@@ -1612,15 +1612,16 @@ int nfs_migrate_page(struct address_space *mapping, struct page *newpage,
6002 - if (ret)
6003 - goto out_unlock;
6004 - page_cache_get(newpage);
6005 -+ spin_lock(&mapping->host->i_lock);
6006 - req->wb_page = newpage;
6007 - SetPagePrivate(newpage);
6008 -- set_page_private(newpage, page_private(page));
6009 -+ set_page_private(newpage, (unsigned long)req);
6010 - ClearPagePrivate(page);
6011 - set_page_private(page, 0);
6012 -+ spin_unlock(&mapping->host->i_lock);
6013 - page_cache_release(page);
6014 - out_unlock:
6015 - nfs_clear_page_tag_locked(req);
6016 -- nfs_release_request(req);
6017 - out:
6018 - return ret;
6019 - }
6020 -diff --git a/include/drm/drmP.h b/include/drm/drmP.h
6021 -index c8e64bb..9d3d684 100644
6022 ---- a/include/drm/drmP.h
6023 -+++ b/include/drm/drmP.h
6024 -@@ -1295,6 +1295,7 @@ extern u32 drm_vblank_count(struct drm_device *dev, int crtc);
6025 - extern void drm_handle_vblank(struct drm_device *dev, int crtc);
6026 - extern int drm_vblank_get(struct drm_device *dev, int crtc);
6027 - extern void drm_vblank_put(struct drm_device *dev, int crtc);
6028 -+extern void drm_vblank_off(struct drm_device *dev, int crtc);
6029 - extern void drm_vblank_cleanup(struct drm_device *dev);
6030 - /* Modesetting support */
6031 - extern void drm_vblank_pre_modeset(struct drm_device *dev, int crtc);
6032 -diff --git a/include/drm/ttm/ttm_memory.h b/include/drm/ttm/ttm_memory.h
6033 -index 6983a7c..b199170 100644
6034 ---- a/include/drm/ttm/ttm_memory.h
6035 -+++ b/include/drm/ttm/ttm_memory.h
6036 -@@ -33,6 +33,7 @@
6037 - #include <linux/wait.h>
6038 - #include <linux/errno.h>
6039 - #include <linux/kobject.h>
6040 -+#include <linux/mm.h>
6041 -
6042 - /**
6043 - * struct ttm_mem_shrink - callback to shrink TTM memory usage.
6044 -diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
6045 -index ff037f0..9bace4b 100644
6046 ---- a/include/linux/hrtimer.h
6047 -+++ b/include/linux/hrtimer.h
6048 -@@ -446,7 +446,7 @@ extern void timer_stats_update_stats(void *timer, pid_t pid, void *startf,
6049 -
6050 - static inline void timer_stats_account_hrtimer(struct hrtimer *timer)
6051 - {
6052 -- if (likely(!timer->start_site))
6053 -+ if (likely(!timer_stats_active))
6054 - return;
6055 - timer_stats_update_stats(timer, timer->start_pid, timer->start_site,
6056 - timer->function, timer->start_comm, 0);
6057 -@@ -457,8 +457,6 @@ extern void __timer_stats_hrtimer_set_start_info(struct hrtimer *timer,
6058 -
6059 - static inline void timer_stats_hrtimer_set_start_info(struct hrtimer *timer)
6060 - {
6061 -- if (likely(!timer_stats_active))
6062 -- return;
6063 - __timer_stats_hrtimer_set_start_info(timer, __builtin_return_address(0));
6064 - }
6065 -
6066 -diff --git a/include/linux/kvm.h b/include/linux/kvm.h
6067 -index f8f8900..8908dd6 100644
6068 ---- a/include/linux/kvm.h
6069 -+++ b/include/linux/kvm.h
6070 -@@ -116,6 +116,11 @@ struct kvm_run {
6071 - __u64 cr8;
6072 - __u64 apic_base;
6073 -
6074 -+#ifdef __KVM_S390
6075 -+ /* the processor status word for s390 */
6076 -+ __u64 psw_mask; /* psw upper half */
6077 -+ __u64 psw_addr; /* psw lower half */
6078 -+#endif
6079 - union {
6080 - /* KVM_EXIT_UNKNOWN */
6081 - struct {
6082 -@@ -167,8 +172,6 @@ struct kvm_run {
6083 - /* KVM_EXIT_S390_SIEIC */
6084 - struct {
6085 - __u8 icptcode;
6086 -- __u64 mask; /* psw upper half */
6087 -- __u64 addr; /* psw lower half */
6088 - __u16 ipa;
6089 - __u32 ipb;
6090 - } s390_sieic;
6091 -@@ -474,6 +477,7 @@ struct kvm_irq_routing {
6092 - };
6093 -
6094 - #endif
6095 -+#define KVM_CAP_S390_PSW 42
6096 -
6097 - #ifdef KVM_CAP_MCE
6098 - /* x86 MCE */
6099 -diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
6100 -index 9e70126..81c9689 100644
6101 ---- a/include/linux/perf_event.h
6102 -+++ b/include/linux/perf_event.h
6103 -@@ -219,7 +219,7 @@ struct perf_event_attr {
6104 - #define PERF_EVENT_IOC_DISABLE _IO ('$', 1)
6105 - #define PERF_EVENT_IOC_REFRESH _IO ('$', 2)
6106 - #define PERF_EVENT_IOC_RESET _IO ('$', 3)
6107 --#define PERF_EVENT_IOC_PERIOD _IOW('$', 4, u64)
6108 -+#define PERF_EVENT_IOC_PERIOD _IOW('$', 4, __u64)
6109 - #define PERF_EVENT_IOC_SET_OUTPUT _IO ('$', 5)
6110 -
6111 - enum perf_event_ioc_flags {
6112 -diff --git a/include/linux/usb_usual.h b/include/linux/usb_usual.h
6113 -index 3d15fb9..a4b947e 100644
6114 ---- a/include/linux/usb_usual.h
6115 -+++ b/include/linux/usb_usual.h
6116 -@@ -56,7 +56,9 @@
6117 - US_FLAG(SANE_SENSE, 0x00008000) \
6118 - /* Sane Sense (> 18 bytes) */ \
6119 - US_FLAG(CAPACITY_OK, 0x00010000) \
6120 -- /* READ CAPACITY response is correct */
6121 -+ /* READ CAPACITY response is correct */ \
6122 -+ US_FLAG(BAD_SENSE, 0x00020000) \
6123 -+ /* Bad Sense (never more than 18 bytes) */
6124 -
6125 - #define US_FLAG(name, value) US_FL_##name = value ,
6126 - enum { US_DO_ALL_FLAGS };
6127 -diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
6128 -index 227c2a5..3c123c3 100644
6129 ---- a/include/linux/vmalloc.h
6130 -+++ b/include/linux/vmalloc.h
6131 -@@ -115,9 +115,11 @@ extern rwlock_t vmlist_lock;
6132 - extern struct vm_struct *vmlist;
6133 - extern __init void vm_area_register_early(struct vm_struct *vm, size_t align);
6134 -
6135 -+#ifndef CONFIG_HAVE_LEGACY_PER_CPU_AREA
6136 - struct vm_struct **pcpu_get_vm_areas(const unsigned long *offsets,
6137 - const size_t *sizes, int nr_vms,
6138 - size_t align, gfp_t gfp_mask);
6139 -+#endif
6140 -
6141 - void pcpu_free_vm_areas(struct vm_struct **vms, int nr_vms);
6142 -
6143 -diff --git a/include/net/tcp.h b/include/net/tcp.h
6144 -index 03a49c7..842ac4d 100644
6145 ---- a/include/net/tcp.h
6146 -+++ b/include/net/tcp.h
6147 -@@ -1263,14 +1263,20 @@ static inline struct sk_buff *tcp_write_queue_prev(struct sock *sk, struct sk_bu
6148 - * TCP connection after "boundary" unsucessful, exponentially backed-off
6149 - * retransmissions with an initial RTO of TCP_RTO_MIN.
6150 - */
6151 --static inline bool retransmits_timed_out(const struct sock *sk,
6152 -+static inline bool retransmits_timed_out(struct sock *sk,
6153 - unsigned int boundary)
6154 - {
6155 - unsigned int timeout, linear_backoff_thresh;
6156 -+ unsigned int start_ts;
6157 -
6158 - if (!inet_csk(sk)->icsk_retransmits)
6159 - return false;
6160 -
6161 -+ if (unlikely(!tcp_sk(sk)->retrans_stamp))
6162 -+ start_ts = TCP_SKB_CB(tcp_write_queue_head(sk))->when;
6163 -+ else
6164 -+ start_ts = tcp_sk(sk)->retrans_stamp;
6165 -+
6166 - linear_backoff_thresh = ilog2(TCP_RTO_MAX/TCP_RTO_MIN);
6167 -
6168 - if (boundary <= linear_backoff_thresh)
6169 -@@ -1279,7 +1285,7 @@ static inline bool retransmits_timed_out(const struct sock *sk,
6170 - timeout = ((2 << linear_backoff_thresh) - 1) * TCP_RTO_MIN +
6171 - (boundary - linear_backoff_thresh) * TCP_RTO_MAX;
6172 -
6173 -- return (tcp_time_stamp - tcp_sk(sk)->retrans_stamp) >= timeout;
6174 -+ return (tcp_time_stamp - start_ts) >= timeout;
6175 - }
6176 -
6177 - static inline struct sk_buff *tcp_send_head(struct sock *sk)
6178 -diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
6179 -index cc0d966..dacb8ef 100644
6180 ---- a/include/trace/ftrace.h
6181 -+++ b/include/trace/ftrace.h
6182 -@@ -159,7 +159,7 @@
6183 - #undef __get_str
6184 -
6185 - #undef TP_printk
6186 --#define TP_printk(fmt, args...) "%s, %s\n", #fmt, __stringify(args)
6187 -+#define TP_printk(fmt, args...) "\"%s\", %s\n", fmt, __stringify(args)
6188 -
6189 - #undef TP_fast_assign
6190 - #define TP_fast_assign(args...) args
6191 -diff --git a/kernel/acct.c b/kernel/acct.c
6192 -index 9a4715a..a6605ca 100644
6193 ---- a/kernel/acct.c
6194 -+++ b/kernel/acct.c
6195 -@@ -536,7 +536,8 @@ static void do_acct_process(struct bsd_acct_struct *acct,
6196 - do_div(elapsed, AHZ);
6197 - ac.ac_btime = get_seconds() - elapsed;
6198 - /* we really need to bite the bullet and change layout */
6199 -- current_uid_gid(&ac.ac_uid, &ac.ac_gid);
6200 -+ ac.ac_uid = orig_cred->uid;
6201 -+ ac.ac_gid = orig_cred->gid;
6202 - #if ACCT_VERSION==2
6203 - ac.ac_ahz = AHZ;
6204 - #endif
6205 -diff --git a/kernel/futex.c b/kernel/futex.c
6206 -index fb65e82..d73ef1f 100644
6207 ---- a/kernel/futex.c
6208 -+++ b/kernel/futex.c
6209 -@@ -304,8 +304,14 @@ void put_futex_key(int fshared, union futex_key *key)
6210 - */
6211 - static int fault_in_user_writeable(u32 __user *uaddr)
6212 - {
6213 -- int ret = get_user_pages(current, current->mm, (unsigned long)uaddr,
6214 -- 1, 1, 0, NULL, NULL);
6215 -+ struct mm_struct *mm = current->mm;
6216 -+ int ret;
6217 -+
6218 -+ down_read(&mm->mmap_sem);
6219 -+ ret = get_user_pages(current, mm, (unsigned long)uaddr,
6220 -+ 1, 1, 0, NULL, NULL);
6221 -+ up_read(&mm->mmap_sem);
6222 -+
6223 - return ret < 0 ? ret : 0;
6224 - }
6225 -
6226 -diff --git a/kernel/perf_event.c b/kernel/perf_event.c
6227 -index 7f29643..6eee915 100644
6228 ---- a/kernel/perf_event.c
6229 -+++ b/kernel/perf_event.c
6230 -@@ -1583,7 +1583,7 @@ static struct perf_event_context *find_get_context(pid_t pid, int cpu)
6231 - if (perf_paranoid_cpu() && !capable(CAP_SYS_ADMIN))
6232 - return ERR_PTR(-EACCES);
6233 -
6234 -- if (cpu < 0 || cpu > num_possible_cpus())
6235 -+ if (cpu < 0 || cpu >= nr_cpumask_bits)
6236 - return ERR_PTR(-EINVAL);
6237 -
6238 - /*
6239 -@@ -2174,6 +2174,7 @@ static void perf_mmap_data_free(struct perf_mmap_data *data)
6240 - perf_mmap_free_page((unsigned long)data->user_page);
6241 - for (i = 0; i < data->nr_pages; i++)
6242 - perf_mmap_free_page((unsigned long)data->data_pages[i]);
6243 -+ kfree(data);
6244 - }
6245 -
6246 - #else
6247 -@@ -2214,6 +2215,7 @@ static void perf_mmap_data_free_work(struct work_struct *work)
6248 - perf_mmap_unmark_page(base + (i * PAGE_SIZE));
6249 -
6250 - vfree(base);
6251 -+ kfree(data);
6252 - }
6253 -
6254 - static void perf_mmap_data_free(struct perf_mmap_data *data)
6255 -@@ -2319,7 +2321,6 @@ static void perf_mmap_data_free_rcu(struct rcu_head *rcu_head)
6256 -
6257 - data = container_of(rcu_head, struct perf_mmap_data, rcu_head);
6258 - perf_mmap_data_free(data);
6259 -- kfree(data);
6260 - }
6261 -
6262 - static void perf_mmap_data_release(struct perf_event *event)
6263 -@@ -3949,6 +3950,7 @@ static enum hrtimer_restart perf_swevent_hrtimer(struct hrtimer *hrtimer)
6264 - event->pmu->read(event);
6265 -
6266 - data.addr = 0;
6267 -+ data.period = event->hw.last_period;
6268 - regs = get_irq_regs();
6269 - /*
6270 - * In case we exclude kernel IPs or are somehow not in interrupt
6271 -diff --git a/kernel/rcutree.c b/kernel/rcutree.c
6272 -index f3077c0..683c4f3 100644
6273 ---- a/kernel/rcutree.c
6274 -+++ b/kernel/rcutree.c
6275 -@@ -176,9 +176,29 @@ static struct rcu_node *rcu_get_root(struct rcu_state *rsp)
6276 - return &rsp->node[0];
6277 - }
6278 -
6279 -+/*
6280 -+ * Record the specified "completed" value, which is later used to validate
6281 -+ * dynticks counter manipulations and CPU-offline checks. Specify
6282 -+ * "rsp->completed - 1" to unconditionally invalidate any future dynticks
6283 -+ * manipulations and CPU-offline checks. Such invalidation is useful at
6284 -+ * the beginning of a grace period.
6285 -+ */
6286 -+static void dyntick_record_completed(struct rcu_state *rsp, long comp)
6287 -+{
6288 -+ rsp->dynticks_completed = comp;
6289 -+}
6290 -+
6291 - #ifdef CONFIG_SMP
6292 -
6293 - /*
6294 -+ * Recall the previously recorded value of the completion for dynticks.
6295 -+ */
6296 -+static long dyntick_recall_completed(struct rcu_state *rsp)
6297 -+{
6298 -+ return rsp->dynticks_completed;
6299 -+}
6300 -+
6301 -+/*
6302 - * If the specified CPU is offline, tell the caller that it is in
6303 - * a quiescent state. Otherwise, whack it with a reschedule IPI.
6304 - * Grace periods can end up waiting on an offline CPU when that
6305 -@@ -335,28 +355,9 @@ void rcu_irq_exit(void)
6306 - set_need_resched();
6307 - }
6308 -
6309 --/*
6310 -- * Record the specified "completed" value, which is later used to validate
6311 -- * dynticks counter manipulations. Specify "rsp->completed - 1" to
6312 -- * unconditionally invalidate any future dynticks manipulations (which is
6313 -- * useful at the beginning of a grace period).
6314 -- */
6315 --static void dyntick_record_completed(struct rcu_state *rsp, long comp)
6316 --{
6317 -- rsp->dynticks_completed = comp;
6318 --}
6319 --
6320 - #ifdef CONFIG_SMP
6321 -
6322 - /*
6323 -- * Recall the previously recorded value of the completion for dynticks.
6324 -- */
6325 --static long dyntick_recall_completed(struct rcu_state *rsp)
6326 --{
6327 -- return rsp->dynticks_completed;
6328 --}
6329 --
6330 --/*
6331 - * Snapshot the specified CPU's dynticks counter so that we can later
6332 - * credit them with an implicit quiescent state. Return 1 if this CPU
6333 - * is in dynticks idle mode, which is an extended quiescent state.
6334 -@@ -419,24 +420,8 @@ static int rcu_implicit_dynticks_qs(struct rcu_data *rdp)
6335 -
6336 - #else /* #ifdef CONFIG_NO_HZ */
6337 -
6338 --static void dyntick_record_completed(struct rcu_state *rsp, long comp)
6339 --{
6340 --}
6341 --
6342 - #ifdef CONFIG_SMP
6343 -
6344 --/*
6345 -- * If there are no dynticks, then the only way that a CPU can passively
6346 -- * be in a quiescent state is to be offline. Unlike dynticks idle, which
6347 -- * is a point in time during the prior (already finished) grace period,
6348 -- * an offline CPU is always in a quiescent state, and thus can be
6349 -- * unconditionally applied. So just return the current value of completed.
6350 -- */
6351 --static long dyntick_recall_completed(struct rcu_state *rsp)
6352 --{
6353 -- return rsp->completed;
6354 --}
6355 --
6356 - static int dyntick_save_progress_counter(struct rcu_data *rdp)
6357 - {
6358 - return 0;
6359 -@@ -553,13 +538,33 @@ static void check_cpu_stall(struct rcu_state *rsp, struct rcu_data *rdp)
6360 - /*
6361 - * Update CPU-local rcu_data state to record the newly noticed grace period.
6362 - * This is used both when we started the grace period and when we notice
6363 -- * that someone else started the grace period.
6364 -+ * that someone else started the grace period. The caller must hold the
6365 -+ * ->lock of the leaf rcu_node structure corresponding to the current CPU,
6366 -+ * and must have irqs disabled.
6367 - */
6368 -+static void __note_new_gpnum(struct rcu_state *rsp, struct rcu_node *rnp, struct rcu_data *rdp)
6369 -+{
6370 -+ if (rdp->gpnum != rnp->gpnum) {
6371 -+ rdp->qs_pending = 1;
6372 -+ rdp->passed_quiesc = 0;
6373 -+ rdp->gpnum = rnp->gpnum;
6374 -+ }
6375 -+}
6376 -+
6377 - static void note_new_gpnum(struct rcu_state *rsp, struct rcu_data *rdp)
6378 - {
6379 -- rdp->qs_pending = 1;
6380 -- rdp->passed_quiesc = 0;
6381 -- rdp->gpnum = rsp->gpnum;
6382 -+ unsigned long flags;
6383 -+ struct rcu_node *rnp;
6384 -+
6385 -+ local_irq_save(flags);
6386 -+ rnp = rdp->mynode;
6387 -+ if (rdp->gpnum == ACCESS_ONCE(rnp->gpnum) || /* outside lock. */
6388 -+ !spin_trylock(&rnp->lock)) { /* irqs already off, retry later. */
6389 -+ local_irq_restore(flags);
6390 -+ return;
6391 -+ }
6392 -+ __note_new_gpnum(rsp, rnp, rdp);
6393 -+ spin_unlock_irqrestore(&rnp->lock, flags);
6394 - }
6395 -
6396 - /*
6397 -@@ -583,6 +588,79 @@ check_for_new_grace_period(struct rcu_state *rsp, struct rcu_data *rdp)
6398 - }
6399 -
6400 - /*
6401 -+ * Advance this CPU's callbacks, but only if the current grace period
6402 -+ * has ended. This may be called only from the CPU to whom the rdp
6403 -+ * belongs. In addition, the corresponding leaf rcu_node structure's
6404 -+ * ->lock must be held by the caller, with irqs disabled.
6405 -+ */
6406 -+static void
6407 -+__rcu_process_gp_end(struct rcu_state *rsp, struct rcu_node *rnp, struct rcu_data *rdp)
6408 -+{
6409 -+ /* Did another grace period end? */
6410 -+ if (rdp->completed != rnp->completed) {
6411 -+
6412 -+ /* Advance callbacks. No harm if list empty. */
6413 -+ rdp->nxttail[RCU_DONE_TAIL] = rdp->nxttail[RCU_WAIT_TAIL];
6414 -+ rdp->nxttail[RCU_WAIT_TAIL] = rdp->nxttail[RCU_NEXT_READY_TAIL];
6415 -+ rdp->nxttail[RCU_NEXT_READY_TAIL] = rdp->nxttail[RCU_NEXT_TAIL];
6416 -+
6417 -+ /* Remember that we saw this grace-period completion. */
6418 -+ rdp->completed = rnp->completed;
6419 -+ }
6420 -+}
6421 -+
6422 -+/*
6423 -+ * Advance this CPU's callbacks, but only if the current grace period
6424 -+ * has ended. This may be called only from the CPU to whom the rdp
6425 -+ * belongs.
6426 -+ */
6427 -+static void
6428 -+rcu_process_gp_end(struct rcu_state *rsp, struct rcu_data *rdp)
6429 -+{
6430 -+ unsigned long flags;
6431 -+ struct rcu_node *rnp;
6432 -+
6433 -+ local_irq_save(flags);
6434 -+ rnp = rdp->mynode;
6435 -+ if (rdp->completed == ACCESS_ONCE(rnp->completed) || /* outside lock. */
6436 -+ !spin_trylock(&rnp->lock)) { /* irqs already off, retry later. */
6437 -+ local_irq_restore(flags);
6438 -+ return;
6439 -+ }
6440 -+ __rcu_process_gp_end(rsp, rnp, rdp);
6441 -+ spin_unlock_irqrestore(&rnp->lock, flags);
6442 -+}
6443 -+
6444 -+/*
6445 -+ * Do per-CPU grace-period initialization for running CPU. The caller
6446 -+ * must hold the lock of the leaf rcu_node structure corresponding to
6447 -+ * this CPU.
6448 -+ */
6449 -+static void
6450 -+rcu_start_gp_per_cpu(struct rcu_state *rsp, struct rcu_node *rnp, struct rcu_data *rdp)
6451 -+{
6452 -+ /* Prior grace period ended, so advance callbacks for current CPU. */
6453 -+ __rcu_process_gp_end(rsp, rnp, rdp);
6454 -+
6455 -+ /*
6456 -+ * Because this CPU just now started the new grace period, we know
6457 -+ * that all of its callbacks will be covered by this upcoming grace
6458 -+ * period, even the ones that were registered arbitrarily recently.
6459 -+ * Therefore, advance all outstanding callbacks to RCU_WAIT_TAIL.
6460 -+ *
6461 -+ * Other CPUs cannot be sure exactly when the grace period started.
6462 -+ * Therefore, their recently registered callbacks must pass through
6463 -+ * an additional RCU_NEXT_READY stage, so that they will be handled
6464 -+ * by the next RCU grace period.
6465 -+ */
6466 -+ rdp->nxttail[RCU_NEXT_READY_TAIL] = rdp->nxttail[RCU_NEXT_TAIL];
6467 -+ rdp->nxttail[RCU_WAIT_TAIL] = rdp->nxttail[RCU_NEXT_TAIL];
6468 -+
6469 -+ /* Set state so that this CPU will detect the next quiescent state. */
6470 -+ __note_new_gpnum(rsp, rnp, rdp);
6471 -+}
6472 -+
6473 -+/*
6474 - * Start a new RCU grace period if warranted, re-initializing the hierarchy
6475 - * in preparation for detecting the next grace period. The caller must hold
6476 - * the root node's ->lock, which is released before return. Hard irqs must
6477 -@@ -607,28 +685,15 @@ rcu_start_gp(struct rcu_state *rsp, unsigned long flags)
6478 - rsp->jiffies_force_qs = jiffies + RCU_JIFFIES_TILL_FORCE_QS;
6479 - record_gp_stall_check_time(rsp);
6480 - dyntick_record_completed(rsp, rsp->completed - 1);
6481 -- note_new_gpnum(rsp, rdp);
6482 --
6483 -- /*
6484 -- * Because this CPU just now started the new grace period, we know
6485 -- * that all of its callbacks will be covered by this upcoming grace
6486 -- * period, even the ones that were registered arbitrarily recently.
6487 -- * Therefore, advance all outstanding callbacks to RCU_WAIT_TAIL.
6488 -- *
6489 -- * Other CPUs cannot be sure exactly when the grace period started.
6490 -- * Therefore, their recently registered callbacks must pass through
6491 -- * an additional RCU_NEXT_READY stage, so that they will be handled
6492 -- * by the next RCU grace period.
6493 -- */
6494 -- rdp->nxttail[RCU_NEXT_READY_TAIL] = rdp->nxttail[RCU_NEXT_TAIL];
6495 -- rdp->nxttail[RCU_WAIT_TAIL] = rdp->nxttail[RCU_NEXT_TAIL];
6496 -
6497 - /* Special-case the common single-level case. */
6498 - if (NUM_RCU_NODES == 1) {
6499 - rcu_preempt_check_blocked_tasks(rnp);
6500 - rnp->qsmask = rnp->qsmaskinit;
6501 - rnp->gpnum = rsp->gpnum;
6502 -+ rnp->completed = rsp->completed;
6503 - rsp->signaled = RCU_SIGNAL_INIT; /* force_quiescent_state OK. */
6504 -+ rcu_start_gp_per_cpu(rsp, rnp, rdp);
6505 - spin_unlock_irqrestore(&rnp->lock, flags);
6506 - return;
6507 - }
6508 -@@ -661,6 +726,9 @@ rcu_start_gp(struct rcu_state *rsp, unsigned long flags)
6509 - rcu_preempt_check_blocked_tasks(rnp);
6510 - rnp->qsmask = rnp->qsmaskinit;
6511 - rnp->gpnum = rsp->gpnum;
6512 -+ rnp->completed = rsp->completed;
6513 -+ if (rnp == rdp->mynode)
6514 -+ rcu_start_gp_per_cpu(rsp, rnp, rdp);
6515 - spin_unlock(&rnp->lock); /* irqs remain disabled. */
6516 - }
6517 -
6518 -@@ -672,34 +740,6 @@ rcu_start_gp(struct rcu_state *rsp, unsigned long flags)
6519 - }
6520 -
6521 - /*
6522 -- * Advance this CPU's callbacks, but only if the current grace period
6523 -- * has ended. This may be called only from the CPU to whom the rdp
6524 -- * belongs.
6525 -- */
6526 --static void
6527 --rcu_process_gp_end(struct rcu_state *rsp, struct rcu_data *rdp)
6528 --{
6529 -- long completed_snap;
6530 -- unsigned long flags;
6531 --
6532 -- local_irq_save(flags);
6533 -- completed_snap = ACCESS_ONCE(rsp->completed); /* outside of lock. */
6534 --
6535 -- /* Did another grace period end? */
6536 -- if (rdp->completed != completed_snap) {
6537 --
6538 -- /* Advance callbacks. No harm if list empty. */
6539 -- rdp->nxttail[RCU_DONE_TAIL] = rdp->nxttail[RCU_WAIT_TAIL];
6540 -- rdp->nxttail[RCU_WAIT_TAIL] = rdp->nxttail[RCU_NEXT_READY_TAIL];
6541 -- rdp->nxttail[RCU_NEXT_READY_TAIL] = rdp->nxttail[RCU_NEXT_TAIL];
6542 --
6543 -- /* Remember that we saw this grace-period completion. */
6544 -- rdp->completed = completed_snap;
6545 -- }
6546 -- local_irq_restore(flags);
6547 --}
6548 --
6549 --/*
6550 - * Clean up after the prior grace period and let rcu_start_gp() start up
6551 - * the next grace period if one is needed. Note that the caller must
6552 - * hold rnp->lock, as required by rcu_start_gp(), which will release it.
6553 -@@ -710,7 +750,6 @@ static void cpu_quiet_msk_finish(struct rcu_state *rsp, unsigned long flags)
6554 - WARN_ON_ONCE(!rcu_gp_in_progress(rsp));
6555 - rsp->completed = rsp->gpnum;
6556 - rsp->signaled = RCU_GP_IDLE;
6557 -- rcu_process_gp_end(rsp, rsp->rda[smp_processor_id()]);
6558 - rcu_start_gp(rsp, flags); /* releases root node's rnp->lock. */
6559 - }
6560 -
6561 -@@ -1144,6 +1183,7 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed)
6562 - long lastcomp;
6563 - struct rcu_node *rnp = rcu_get_root(rsp);
6564 - u8 signaled;
6565 -+ u8 forcenow;
6566 -
6567 - if (!rcu_gp_in_progress(rsp))
6568 - return; /* No grace period in progress, nothing to force. */
6569 -@@ -1180,16 +1220,23 @@ static void force_quiescent_state(struct rcu_state *rsp, int relaxed)
6570 - if (rcu_process_dyntick(rsp, lastcomp,
6571 - dyntick_save_progress_counter))
6572 - goto unlock_ret;
6573 -+ /* fall into next case. */
6574 -+
6575 -+ case RCU_SAVE_COMPLETED:
6576 -
6577 - /* Update state, record completion counter. */
6578 -+ forcenow = 0;
6579 - spin_lock(&rnp->lock);
6580 - if (lastcomp == rsp->completed &&
6581 -- rsp->signaled == RCU_SAVE_DYNTICK) {
6582 -+ rsp->signaled == signaled) {
6583 - rsp->signaled = RCU_FORCE_QS;
6584 - dyntick_record_completed(rsp, lastcomp);
6585 -+ forcenow = signaled == RCU_SAVE_COMPLETED;
6586 - }
6587 - spin_unlock(&rnp->lock);
6588 -- break;
6589 -+ if (!forcenow)
6590 -+ break;
6591 -+ /* fall into next case. */
6592 -
6593 - case RCU_FORCE_QS:
6594 -
6595 -@@ -1544,21 +1591,16 @@ static void __cpuinit
6596 - rcu_init_percpu_data(int cpu, struct rcu_state *rsp, int preemptable)
6597 - {
6598 - unsigned long flags;
6599 -- long lastcomp;
6600 - unsigned long mask;
6601 - struct rcu_data *rdp = rsp->rda[cpu];
6602 - struct rcu_node *rnp = rcu_get_root(rsp);
6603 -
6604 - /* Set up local state, ensuring consistent view of global state. */
6605 - spin_lock_irqsave(&rnp->lock, flags);
6606 -- lastcomp = rsp->completed;
6607 -- rdp->completed = lastcomp;
6608 -- rdp->gpnum = lastcomp;
6609 - rdp->passed_quiesc = 0; /* We could be racing with new GP, */
6610 - rdp->qs_pending = 1; /* so set up to respond to current GP. */
6611 - rdp->beenonline = 1; /* We have now been online. */
6612 - rdp->preemptable = preemptable;
6613 -- rdp->passed_quiesc_completed = lastcomp - 1;
6614 - rdp->qlen_last_fqs_check = 0;
6615 - rdp->n_force_qs_snap = rsp->n_force_qs;
6616 - rdp->blimit = blimit;
6617 -@@ -1580,6 +1622,11 @@ rcu_init_percpu_data(int cpu, struct rcu_state *rsp, int preemptable)
6618 - spin_lock(&rnp->lock); /* irqs already disabled. */
6619 - rnp->qsmaskinit |= mask;
6620 - mask = rnp->grpmask;
6621 -+ if (rnp == rdp->mynode) {
6622 -+ rdp->gpnum = rnp->completed; /* if GP in progress... */
6623 -+ rdp->completed = rnp->completed;
6624 -+ rdp->passed_quiesc_completed = rnp->completed - 1;
6625 -+ }
6626 - spin_unlock(&rnp->lock); /* irqs already disabled. */
6627 - rnp = rnp->parent;
6628 - } while (rnp != NULL && !(rnp->qsmaskinit & mask));
6629 -diff --git a/kernel/rcutree.h b/kernel/rcutree.h
6630 -index 1899023..ddb79ec 100644
6631 ---- a/kernel/rcutree.h
6632 -+++ b/kernel/rcutree.h
6633 -@@ -84,6 +84,9 @@ struct rcu_node {
6634 - long gpnum; /* Current grace period for this node. */
6635 - /* This will either be equal to or one */
6636 - /* behind the root rcu_node's gpnum. */
6637 -+ long completed; /* Last grace period completed for this node. */
6638 -+ /* This will either be equal to or one */
6639 -+ /* behind the root rcu_node's gpnum. */
6640 - unsigned long qsmask; /* CPUs or groups that need to switch in */
6641 - /* order for current grace period to proceed.*/
6642 - /* In leaf rcu_node, each bit corresponds to */
6643 -@@ -204,11 +207,12 @@ struct rcu_data {
6644 - #define RCU_GP_IDLE 0 /* No grace period in progress. */
6645 - #define RCU_GP_INIT 1 /* Grace period being initialized. */
6646 - #define RCU_SAVE_DYNTICK 2 /* Need to scan dyntick state. */
6647 --#define RCU_FORCE_QS 3 /* Need to force quiescent state. */
6648 -+#define RCU_SAVE_COMPLETED 3 /* Need to save rsp->completed. */
6649 -+#define RCU_FORCE_QS 4 /* Need to force quiescent state. */
6650 - #ifdef CONFIG_NO_HZ
6651 - #define RCU_SIGNAL_INIT RCU_SAVE_DYNTICK
6652 - #else /* #ifdef CONFIG_NO_HZ */
6653 --#define RCU_SIGNAL_INIT RCU_FORCE_QS
6654 -+#define RCU_SIGNAL_INIT RCU_SAVE_COMPLETED
6655 - #endif /* #else #ifdef CONFIG_NO_HZ */
6656 -
6657 - #define RCU_JIFFIES_TILL_FORCE_QS 3 /* for rsp->jiffies_force_qs */
6658 -@@ -274,9 +278,8 @@ struct rcu_state {
6659 - unsigned long jiffies_stall; /* Time at which to check */
6660 - /* for CPU stalls. */
6661 - #endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */
6662 --#ifdef CONFIG_NO_HZ
6663 - long dynticks_completed; /* Value of completed @ snap. */
6664 --#endif /* #ifdef CONFIG_NO_HZ */
6665 -+ /* Protected by fqslock. */
6666 - };
6667 -
6668 - #ifdef RCU_TREE_NONCORE
6669 -@@ -298,7 +301,7 @@ DECLARE_PER_CPU(struct rcu_data, rcu_preempt_data);
6670 - #else /* #ifdef RCU_TREE_NONCORE */
6671 -
6672 - /* Forward declarations for rcutree_plugin.h */
6673 --static inline void rcu_bootup_announce(void);
6674 -+static void rcu_bootup_announce(void);
6675 - long rcu_batches_completed(void);
6676 - static void rcu_preempt_note_context_switch(int cpu);
6677 - static int rcu_preempted_readers(struct rcu_node *rnp);
6678 -diff --git a/kernel/rcutree_plugin.h b/kernel/rcutree_plugin.h
6679 -index ef2a58c..c03edf7 100644
6680 ---- a/kernel/rcutree_plugin.h
6681 -+++ b/kernel/rcutree_plugin.h
6682 -@@ -33,7 +33,7 @@ DEFINE_PER_CPU(struct rcu_data, rcu_preempt_data);
6683 - /*
6684 - * Tell them what RCU they are running.
6685 - */
6686 --static inline void rcu_bootup_announce(void)
6687 -+static void rcu_bootup_announce(void)
6688 - {
6689 - printk(KERN_INFO
6690 - "Experimental preemptable hierarchical RCU implementation.\n");
6691 -@@ -481,7 +481,7 @@ void exit_rcu(void)
6692 - /*
6693 - * Tell them what RCU they are running.
6694 - */
6695 --static inline void rcu_bootup_announce(void)
6696 -+static void rcu_bootup_announce(void)
6697 - {
6698 - printk(KERN_INFO "Hierarchical RCU implementation.\n");
6699 - }
6700 -diff --git a/kernel/sched.c b/kernel/sched.c
6701 -index 3c11ae0..d079a9f 100644
6702 ---- a/kernel/sched.c
6703 -+++ b/kernel/sched.c
6704 -@@ -591,6 +591,8 @@ struct rq {
6705 -
6706 - u64 rt_avg;
6707 - u64 age_stamp;
6708 -+ u64 idle_stamp;
6709 -+ u64 avg_idle;
6710 - #endif
6711 -
6712 - /* calc_load related fields */
6713 -@@ -2440,6 +2442,17 @@ out_running:
6714 - #ifdef CONFIG_SMP
6715 - if (p->sched_class->task_wake_up)
6716 - p->sched_class->task_wake_up(rq, p);
6717 -+
6718 -+ if (unlikely(rq->idle_stamp)) {
6719 -+ u64 delta = rq->clock - rq->idle_stamp;
6720 -+ u64 max = 2*sysctl_sched_migration_cost;
6721 -+
6722 -+ if (delta > max)
6723 -+ rq->avg_idle = max;
6724 -+ else
6725 -+ update_avg(&rq->avg_idle, delta);
6726 -+ rq->idle_stamp = 0;
6727 -+ }
6728 - #endif
6729 - out:
6730 - task_rq_unlock(rq, &flags);
6731 -@@ -4126,7 +4139,7 @@ static int load_balance(int this_cpu, struct rq *this_rq,
6732 - unsigned long flags;
6733 - struct cpumask *cpus = __get_cpu_var(load_balance_tmpmask);
6734 -
6735 -- cpumask_setall(cpus);
6736 -+ cpumask_copy(cpus, cpu_online_mask);
6737 -
6738 - /*
6739 - * When power savings policy is enabled for the parent domain, idle
6740 -@@ -4289,7 +4302,7 @@ load_balance_newidle(int this_cpu, struct rq *this_rq, struct sched_domain *sd)
6741 - int all_pinned = 0;
6742 - struct cpumask *cpus = __get_cpu_var(load_balance_tmpmask);
6743 -
6744 -- cpumask_setall(cpus);
6745 -+ cpumask_copy(cpus, cpu_online_mask);
6746 -
6747 - /*
6748 - * When power savings policy is enabled for the parent domain, idle
6749 -@@ -4429,6 +4442,11 @@ static void idle_balance(int this_cpu, struct rq *this_rq)
6750 - int pulled_task = 0;
6751 - unsigned long next_balance = jiffies + HZ;
6752 -
6753 -+ this_rq->idle_stamp = this_rq->clock;
6754 -+
6755 -+ if (this_rq->avg_idle < sysctl_sched_migration_cost)
6756 -+ return;
6757 -+
6758 - for_each_domain(this_cpu, sd) {
6759 - unsigned long interval;
6760 -
6761 -@@ -4443,8 +4461,10 @@ static void idle_balance(int this_cpu, struct rq *this_rq)
6762 - interval = msecs_to_jiffies(sd->balance_interval);
6763 - if (time_after(next_balance, sd->last_balance + interval))
6764 - next_balance = sd->last_balance + interval;
6765 -- if (pulled_task)
6766 -+ if (pulled_task) {
6767 -+ this_rq->idle_stamp = 0;
6768 - break;
6769 -+ }
6770 - }
6771 - if (pulled_task || time_after(jiffies, this_rq->next_balance)) {
6772 - /*
6773 -@@ -9522,6 +9542,8 @@ void __init sched_init(void)
6774 - rq->cpu = i;
6775 - rq->online = 0;
6776 - rq->migration_thread = NULL;
6777 -+ rq->idle_stamp = 0;
6778 -+ rq->avg_idle = 2*sysctl_sched_migration_cost;
6779 - INIT_LIST_HEAD(&rq->migration_queue);
6780 - rq_attach_root(rq, &def_root_domain);
6781 - #endif
6782 -diff --git a/kernel/sched_debug.c b/kernel/sched_debug.c
6783 -index efb8440..6988cf0 100644
6784 ---- a/kernel/sched_debug.c
6785 -+++ b/kernel/sched_debug.c
6786 -@@ -285,12 +285,16 @@ static void print_cpu(struct seq_file *m, int cpu)
6787 -
6788 - #ifdef CONFIG_SCHEDSTATS
6789 - #define P(n) SEQ_printf(m, " .%-30s: %d\n", #n, rq->n);
6790 -+#define P64(n) SEQ_printf(m, " .%-30s: %Ld\n", #n, rq->n);
6791 -
6792 - P(yld_count);
6793 -
6794 - P(sched_switch);
6795 - P(sched_count);
6796 - P(sched_goidle);
6797 -+#ifdef CONFIG_SMP
6798 -+ P64(avg_idle);
6799 -+#endif
6800 -
6801 - P(ttwu_count);
6802 - P(ttwu_local);
6803 -diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
6804 -index 37087a7..5488a5d 100644
6805 ---- a/kernel/sched_fair.c
6806 -+++ b/kernel/sched_fair.c
6807 -@@ -1398,11 +1398,38 @@ static int select_task_rq_fair(struct task_struct *p, int sd_flag, int wake_flag
6808 - want_sd = 0;
6809 - }
6810 -
6811 -- if (want_affine && (tmp->flags & SD_WAKE_AFFINE) &&
6812 -- cpumask_test_cpu(prev_cpu, sched_domain_span(tmp))) {
6813 -+ if (want_affine && (tmp->flags & SD_WAKE_AFFINE)) {
6814 -+ int candidate = -1, i;
6815 -
6816 -- affine_sd = tmp;
6817 -- want_affine = 0;
6818 -+ if (cpumask_test_cpu(prev_cpu, sched_domain_span(tmp)))
6819 -+ candidate = cpu;
6820 -+
6821 -+ /*
6822 -+ * Check for an idle shared cache.
6823 -+ */
6824 -+ if (tmp->flags & SD_PREFER_SIBLING) {
6825 -+ if (candidate == cpu) {
6826 -+ if (!cpu_rq(prev_cpu)->cfs.nr_running)
6827 -+ candidate = prev_cpu;
6828 -+ }
6829 -+
6830 -+ if (candidate == -1 || candidate == cpu) {
6831 -+ for_each_cpu(i, sched_domain_span(tmp)) {
6832 -+ if (!cpumask_test_cpu(i, &p->cpus_allowed))
6833 -+ continue;
6834 -+ if (!cpu_rq(i)->cfs.nr_running) {
6835 -+ candidate = i;
6836 -+ break;
6837 -+ }
6838 -+ }
6839 -+ }
6840 -+ }
6841 -+
6842 -+ if (candidate >= 0) {
6843 -+ affine_sd = tmp;
6844 -+ want_affine = 0;
6845 -+ cpu = candidate;
6846 -+ }
6847 - }
6848 -
6849 - if (!want_sd && !want_affine)
6850 -diff --git a/mm/memcontrol.c b/mm/memcontrol.c
6851 -index f99f599..6314015 100644
6852 ---- a/mm/memcontrol.c
6853 -+++ b/mm/memcontrol.c
6854 -@@ -2541,6 +2541,7 @@ static u64 mem_cgroup_read(struct cgroup *cont, struct cftype *cft)
6855 - val += idx_val;
6856 - mem_cgroup_get_recursive_idx_stat(mem,
6857 - MEM_CGROUP_STAT_SWAPOUT, &idx_val);
6858 -+ val += idx_val;
6859 - val <<= PAGE_SHIFT;
6860 - } else
6861 - val = res_counter_read_u64(&mem->memsw, name);
6862 -diff --git a/mm/memory.c b/mm/memory.c
6863 -index 6ab19dd..4e59455 100644
6864 ---- a/mm/memory.c
6865 -+++ b/mm/memory.c
6866 -@@ -2514,7 +2514,7 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma,
6867 - ret = VM_FAULT_HWPOISON;
6868 - } else {
6869 - print_bad_pte(vma, address, orig_pte, NULL);
6870 -- ret = VM_FAULT_OOM;
6871 -+ ret = VM_FAULT_SIGBUS;
6872 - }
6873 - goto out;
6874 - }
6875 -@@ -2910,7 +2910,7 @@ static int do_nonlinear_fault(struct mm_struct *mm, struct vm_area_struct *vma,
6876 - * Page table corrupted: show pte and kill process.
6877 - */
6878 - print_bad_pte(vma, address, orig_pte, NULL);
6879 -- return VM_FAULT_OOM;
6880 -+ return VM_FAULT_SIGBUS;
6881 - }
6882 -
6883 - pgoff = pte_to_pgoff(orig_pte);
6884 -diff --git a/mm/mincore.c b/mm/mincore.c
6885 -index 8cb508f..7a3436e 100644
6886 ---- a/mm/mincore.c
6887 -+++ b/mm/mincore.c
6888 -@@ -14,6 +14,7 @@
6889 - #include <linux/syscalls.h>
6890 - #include <linux/swap.h>
6891 - #include <linux/swapops.h>
6892 -+#include <linux/hugetlb.h>
6893 -
6894 - #include <asm/uaccess.h>
6895 - #include <asm/pgtable.h>
6896 -@@ -72,6 +73,42 @@ static long do_mincore(unsigned long addr, unsigned char *vec, unsigned long pag
6897 - if (!vma || addr < vma->vm_start)
6898 - return -ENOMEM;
6899 -
6900 -+#ifdef CONFIG_HUGETLB_PAGE
6901 -+ if (is_vm_hugetlb_page(vma)) {
6902 -+ struct hstate *h;
6903 -+ unsigned long nr_huge;
6904 -+ unsigned char present;
6905 -+
6906 -+ i = 0;
6907 -+ nr = min(pages, (vma->vm_end - addr) >> PAGE_SHIFT);
6908 -+ h = hstate_vma(vma);
6909 -+ nr_huge = ((addr + pages * PAGE_SIZE - 1) >> huge_page_shift(h))
6910 -+ - (addr >> huge_page_shift(h)) + 1;
6911 -+ nr_huge = min(nr_huge,
6912 -+ (vma->vm_end - addr) >> huge_page_shift(h));
6913 -+ while (1) {
6914 -+ /* hugepage always in RAM for now,
6915 -+ * but generally it needs to be check */
6916 -+ ptep = huge_pte_offset(current->mm,
6917 -+ addr & huge_page_mask(h));
6918 -+ present = !!(ptep &&
6919 -+ !huge_pte_none(huge_ptep_get(ptep)));
6920 -+ while (1) {
6921 -+ vec[i++] = present;
6922 -+ addr += PAGE_SIZE;
6923 -+ /* reach buffer limit */
6924 -+ if (i == nr)
6925 -+ return nr;
6926 -+ /* check hugepage border */
6927 -+ if (!((addr & ~huge_page_mask(h))
6928 -+ >> PAGE_SHIFT))
6929 -+ break;
6930 -+ }
6931 -+ }
6932 -+ return nr;
6933 -+ }
6934 -+#endif
6935 -+
6936 - /*
6937 - * Calculate how many pages there are left in the last level of the
6938 - * PTE array for our address.
6939 -diff --git a/mm/pagewalk.c b/mm/pagewalk.c
6940 -index d5878be..a286915 100644
6941 ---- a/mm/pagewalk.c
6942 -+++ b/mm/pagewalk.c
6943 -@@ -1,6 +1,7 @@
6944 - #include <linux/mm.h>
6945 - #include <linux/highmem.h>
6946 - #include <linux/sched.h>
6947 -+#include <linux/hugetlb.h>
6948 -
6949 - static int walk_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end,
6950 - struct mm_walk *walk)
6951 -@@ -107,6 +108,7 @@ int walk_page_range(unsigned long addr, unsigned long end,
6952 - pgd_t *pgd;
6953 - unsigned long next;
6954 - int err = 0;
6955 -+ struct vm_area_struct *vma;
6956 -
6957 - if (addr >= end)
6958 - return err;
6959 -@@ -117,11 +119,22 @@ int walk_page_range(unsigned long addr, unsigned long end,
6960 - pgd = pgd_offset(walk->mm, addr);
6961 - do {
6962 - next = pgd_addr_end(addr, end);
6963 -+
6964 -+ /* skip hugetlb vma to avoid hugepage PMD being cleared
6965 -+ * in pmd_none_or_clear_bad(). */
6966 -+ vma = find_vma(walk->mm, addr);
6967 -+ if (vma && is_vm_hugetlb_page(vma)) {
6968 -+ if (vma->vm_end < next)
6969 -+ next = vma->vm_end;
6970 -+ continue;
6971 -+ }
6972 -+
6973 - if (pgd_none_or_clear_bad(pgd)) {
6974 - if (walk->pte_hole)
6975 - err = walk->pte_hole(addr, next, walk);
6976 - if (err)
6977 - break;
6978 -+ pgd++;
6979 - continue;
6980 - }
6981 - if (walk->pgd_entry)
6982 -@@ -131,7 +144,8 @@ int walk_page_range(unsigned long addr, unsigned long end,
6983 - err = walk_pud_range(pgd, addr, next, walk);
6984 - if (err)
6985 - break;
6986 -- } while (pgd++, addr = next, addr != end);
6987 -+ pgd++;
6988 -+ } while (addr = next, addr != end);
6989 -
6990 - return err;
6991 - }
6992 -diff --git a/mm/vmalloc.c b/mm/vmalloc.c
6993 -index 0f551a4..7758726 100644
6994 ---- a/mm/vmalloc.c
6995 -+++ b/mm/vmalloc.c
6996 -@@ -1993,6 +1993,7 @@ void free_vm_area(struct vm_struct *area)
6997 - }
6998 - EXPORT_SYMBOL_GPL(free_vm_area);
6999 -
7000 -+#ifndef CONFIG_HAVE_LEGACY_PER_CPU_AREA
7001 - static struct vmap_area *node_to_va(struct rb_node *n)
7002 - {
7003 - return n ? rb_entry(n, struct vmap_area, rb_node) : NULL;
7004 -@@ -2257,6 +2258,7 @@ err_free:
7005 - kfree(vms);
7006 - return NULL;
7007 - }
7008 -+#endif
7009 -
7010 - /**
7011 - * pcpu_free_vm_areas - free vmalloc areas for percpu allocator
7012 -diff --git a/net/core/dev.c b/net/core/dev.c
7013 -index fe10551..584046e 100644
7014 ---- a/net/core/dev.c
7015 -+++ b/net/core/dev.c
7016 -@@ -4860,6 +4860,11 @@ int register_netdevice(struct net_device *dev)
7017 - rollback_registered(dev);
7018 - dev->reg_state = NETREG_UNREGISTERED;
7019 - }
7020 -+ /*
7021 -+ * Prevent userspace races by waiting until the network
7022 -+ * device is fully setup before sending notifications.
7023 -+ */
7024 -+ rtmsg_ifinfo(RTM_NEWLINK, dev, ~0U);
7025 -
7026 - out:
7027 - return ret;
7028 -@@ -5398,6 +5403,12 @@ int dev_change_net_namespace(struct net_device *dev, struct net *net, const char
7029 - /* Notify protocols, that a new device appeared. */
7030 - call_netdevice_notifiers(NETDEV_REGISTER, dev);
7031 -
7032 -+ /*
7033 -+ * Prevent userspace races by waiting until the network
7034 -+ * device is fully setup before sending notifications.
7035 -+ */
7036 -+ rtmsg_ifinfo(RTM_NEWLINK, dev, ~0U);
7037 -+
7038 - synchronize_net();
7039 - err = 0;
7040 - out:
7041 -diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
7042 -index eb42873..d4fd895 100644
7043 ---- a/net/core/rtnetlink.c
7044 -+++ b/net/core/rtnetlink.c
7045 -@@ -1334,13 +1334,11 @@ static int rtnetlink_event(struct notifier_block *this, unsigned long event, voi
7046 - case NETDEV_UNREGISTER:
7047 - rtmsg_ifinfo(RTM_DELLINK, dev, ~0U);
7048 - break;
7049 -- case NETDEV_REGISTER:
7050 -- rtmsg_ifinfo(RTM_NEWLINK, dev, ~0U);
7051 -- break;
7052 - case NETDEV_UP:
7053 - case NETDEV_DOWN:
7054 - rtmsg_ifinfo(RTM_NEWLINK, dev, IFF_UP|IFF_RUNNING);
7055 - break;
7056 -+ case NETDEV_REGISTER:
7057 - case NETDEV_CHANGE:
7058 - case NETDEV_GOING_DOWN:
7059 - break;
7060 -diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
7061 -index f989518..4d50daa 100644
7062 ---- a/net/ipv4/ip_output.c
7063 -+++ b/net/ipv4/ip_output.c
7064 -@@ -501,8 +501,8 @@ int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *))
7065 - if (skb->sk) {
7066 - frag->sk = skb->sk;
7067 - frag->destructor = sock_wfree;
7068 -- truesizes += frag->truesize;
7069 - }
7070 -+ truesizes += frag->truesize;
7071 - }
7072 -
7073 - /* Everything is OK. Generate! */
7074 -diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
7075 -index 7b5131b..cca675e 100644
7076 ---- a/net/mac80211/cfg.c
7077 -+++ b/net/mac80211/cfg.c
7078 -@@ -338,7 +338,8 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
7079 - sinfo->rx_packets = sta->rx_packets;
7080 - sinfo->tx_packets = sta->tx_packets;
7081 -
7082 -- if (sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) {
7083 -+ if ((sta->local->hw.flags & IEEE80211_HW_SIGNAL_DBM) ||
7084 -+ (sta->local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)) {
7085 - sinfo->filled |= STATION_INFO_SIGNAL;
7086 - sinfo->signal = (s8)sta->last_signal;
7087 - }
7088 -diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
7089 -index 10d316e..5a46164 100644
7090 ---- a/net/mac80211/ieee80211_i.h
7091 -+++ b/net/mac80211/ieee80211_i.h
7092 -@@ -808,6 +808,7 @@ struct ieee80211_local {
7093 - unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */
7094 -
7095 - bool pspolling;
7096 -+ bool scan_ps_enabled;
7097 - /*
7098 - * PS can only be enabled when we have exactly one managed
7099 - * interface (and monitors) in PS, this then points there.
7100 -diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h
7101 -index dd1c193..010ff2f 100644
7102 ---- a/net/mac80211/mesh.h
7103 -+++ b/net/mac80211/mesh.h
7104 -@@ -186,8 +186,9 @@ struct mesh_rmc {
7105 - */
7106 - #define MESH_PREQ_MIN_INT 10
7107 - #define MESH_DIAM_TRAVERSAL_TIME 50
7108 --/* Paths will be refreshed if they are closer than PATH_REFRESH_TIME to their
7109 -- * expiration
7110 -+/* A path will be refreshed if it is used PATH_REFRESH_TIME milliseconds before
7111 -+ * timing out. This way it will remain ACTIVE and no data frames will be
7112 -+ * unnecesarily held in the pending queue.
7113 - */
7114 - #define MESH_PATH_REFRESH_TIME 1000
7115 - #define MESH_MIN_DISCOVERY_TIMEOUT (2 * MESH_DIAM_TRAVERSAL_TIME)
7116 -diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c
7117 -index 29b82e9..93c49fc 100644
7118 ---- a/net/mac80211/mesh_hwmp.c
7119 -+++ b/net/mac80211/mesh_hwmp.c
7120 -@@ -813,7 +813,7 @@ int mesh_nexthop_lookup(struct sk_buff *skb,
7121 - }
7122 -
7123 - if (mpath->flags & MESH_PATH_ACTIVE) {
7124 -- if (time_after(jiffies, mpath->exp_time +
7125 -+ if (time_after(jiffies, mpath->exp_time -
7126 - msecs_to_jiffies(sdata->u.mesh.mshcfg.path_refresh_time))
7127 - && !memcmp(sdata->dev->dev_addr, hdr->addr4,
7128 - ETH_ALEN)
7129 -diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
7130 -index 7170bf4..4e14754 100644
7131 ---- a/net/mac80211/rx.c
7132 -+++ b/net/mac80211/rx.c
7133 -@@ -1514,7 +1514,6 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
7134 - mpp_path_add(mesh_hdr->eaddr2, hdr->addr4, sdata);
7135 - } else {
7136 - spin_lock_bh(&mppath->state_lock);
7137 -- mppath->exp_time = jiffies;
7138 - if (compare_ether_addr(mppath->mpp, hdr->addr4) != 0)
7139 - memcpy(mppath->mpp, hdr->addr4, ETH_ALEN);
7140 - spin_unlock_bh(&mppath->state_lock);
7141 -diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
7142 -index 71e10ca..1a41909 100644
7143 ---- a/net/mac80211/scan.c
7144 -+++ b/net/mac80211/scan.c
7145 -@@ -196,7 +196,8 @@ ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb)
7146 - static void ieee80211_scan_ps_enable(struct ieee80211_sub_if_data *sdata)
7147 - {
7148 - struct ieee80211_local *local = sdata->local;
7149 -- bool ps = false;
7150 -+
7151 -+ local->scan_ps_enabled = false;
7152 -
7153 - /* FIXME: what to do when local->pspolling is true? */
7154 -
7155 -@@ -204,12 +205,13 @@ static void ieee80211_scan_ps_enable(struct ieee80211_sub_if_data *sdata)
7156 - cancel_work_sync(&local->dynamic_ps_enable_work);
7157 -
7158 - if (local->hw.conf.flags & IEEE80211_CONF_PS) {
7159 -- ps = true;
7160 -+ local->scan_ps_enabled = true;
7161 - local->hw.conf.flags &= ~IEEE80211_CONF_PS;
7162 - ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
7163 - }
7164 -
7165 -- if (!ps || !(local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK))
7166 -+ if (!(local->scan_ps_enabled) ||
7167 -+ !(local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK))
7168 - /*
7169 - * If power save was enabled, no need to send a nullfunc
7170 - * frame because AP knows that we are sleeping. But if the
7171 -@@ -230,7 +232,7 @@ static void ieee80211_scan_ps_disable(struct ieee80211_sub_if_data *sdata)
7172 -
7173 - if (!local->ps_sdata)
7174 - ieee80211_send_nullfunc(local, sdata, 0);
7175 -- else {
7176 -+ else if (local->scan_ps_enabled) {
7177 - /*
7178 - * In !IEEE80211_HW_PS_NULLFUNC_STACK case the hardware
7179 - * will send a nullfunc frame with the powersave bit set
7180 -@@ -246,6 +248,16 @@ static void ieee80211_scan_ps_disable(struct ieee80211_sub_if_data *sdata)
7181 - */
7182 - local->hw.conf.flags |= IEEE80211_CONF_PS;
7183 - ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
7184 -+ } else if (local->hw.conf.dynamic_ps_timeout > 0) {
7185 -+ /*
7186 -+ * If IEEE80211_CONF_PS was not set and the dynamic_ps_timer
7187 -+ * had been running before leaving the operating channel,
7188 -+ * restart the timer now and send a nullfunc frame to inform
7189 -+ * the AP that we are awake.
7190 -+ */
7191 -+ ieee80211_send_nullfunc(local, sdata, 0);
7192 -+ mod_timer(&local->dynamic_ps_timer, jiffies +
7193 -+ msecs_to_jiffies(local->hw.conf.dynamic_ps_timeout));
7194 - }
7195 - }
7196 -
7197 -@@ -264,10 +276,14 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
7198 -
7199 - mutex_lock(&local->scan_mtx);
7200 -
7201 -- if (WARN_ON(!local->scanning)) {
7202 -- mutex_unlock(&local->scan_mtx);
7203 -- return;
7204 -- }
7205 -+ /*
7206 -+ * It's ok to abort a not-yet-running scan (that
7207 -+ * we have one at all will be verified by checking
7208 -+ * local->scan_req next), but not to complete it
7209 -+ * successfully.
7210 -+ */
7211 -+ if (WARN_ON(!local->scanning && !aborted))
7212 -+ aborted = true;
7213 -
7214 - if (WARN_ON(!local->scan_req)) {
7215 - mutex_unlock(&local->scan_mtx);
7216 -diff --git a/net/mac80211/util.c b/net/mac80211/util.c
7217 -index e6c08da..cbc5d20 100644
7218 ---- a/net/mac80211/util.c
7219 -+++ b/net/mac80211/util.c
7220 -@@ -579,7 +579,7 @@ u32 ieee802_11_parse_elems_crc(u8 *start, size_t len,
7221 - if (elen > left)
7222 - break;
7223 -
7224 -- if (calc_crc && id < 64 && (filter & BIT(id)))
7225 -+ if (calc_crc && id < 64 && (filter & (1ULL << id)))
7226 - crc = crc32_be(crc, pos - 2, elen + 2);
7227 -
7228 - switch (id) {
7229 -diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c
7230 -index 446e9bd..02b2610 100644
7231 ---- a/net/netfilter/ipvs/ip_vs_ctl.c
7232 -+++ b/net/netfilter/ipvs/ip_vs_ctl.c
7233 -@@ -2714,6 +2714,8 @@ static int ip_vs_genl_parse_service(struct ip_vs_service_user_kern *usvc,
7234 - if (!(nla_af && (nla_fwmark || (nla_port && nla_protocol && nla_addr))))
7235 - return -EINVAL;
7236 -
7237 -+ memset(usvc, 0, sizeof(*usvc));
7238 -+
7239 - usvc->af = nla_get_u16(nla_af);
7240 - #ifdef CONFIG_IP_VS_IPV6
7241 - if (usvc->af != AF_INET && usvc->af != AF_INET6)
7242 -@@ -2901,6 +2903,8 @@ static int ip_vs_genl_parse_dest(struct ip_vs_dest_user_kern *udest,
7243 - if (!(nla_addr && nla_port))
7244 - return -EINVAL;
7245 -
7246 -+ memset(udest, 0, sizeof(*udest));
7247 -+
7248 - nla_memcpy(&udest->addr, nla_addr, sizeof(udest->addr));
7249 - udest->port = nla_get_u16(nla_port);
7250 -
7251 -diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
7252 -index fc6a43c..129d75e 100644
7253 ---- a/net/sunrpc/auth_gss/auth_gss.c
7254 -+++ b/net/sunrpc/auth_gss/auth_gss.c
7255 -@@ -485,7 +485,7 @@ gss_refresh_upcall(struct rpc_task *task)
7256 - dprintk("RPC: %5u gss_refresh_upcall for uid %u\n", task->tk_pid,
7257 - cred->cr_uid);
7258 - gss_msg = gss_setup_upcall(task->tk_client, gss_auth, cred);
7259 -- if (IS_ERR(gss_msg) == -EAGAIN) {
7260 -+ if (PTR_ERR(gss_msg) == -EAGAIN) {
7261 - /* XXX: warning on the first, under the assumption we
7262 - * shouldn't normally hit this case on a refresh. */
7263 - warn_gssd();
7264 -diff --git a/sound/core/hrtimer.c b/sound/core/hrtimer.c
7265 -index 34c7d48..7f4d744 100644
7266 ---- a/sound/core/hrtimer.c
7267 -+++ b/sound/core/hrtimer.c
7268 -@@ -37,14 +37,22 @@ static unsigned int resolution;
7269 - struct snd_hrtimer {
7270 - struct snd_timer *timer;
7271 - struct hrtimer hrt;
7272 -+ atomic_t running;
7273 - };
7274 -
7275 - static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt)
7276 - {
7277 - struct snd_hrtimer *stime = container_of(hrt, struct snd_hrtimer, hrt);
7278 - struct snd_timer *t = stime->timer;
7279 -+
7280 -+ if (!atomic_read(&stime->running))
7281 -+ return HRTIMER_NORESTART;
7282 -+
7283 - hrtimer_forward_now(hrt, ns_to_ktime(t->sticks * resolution));
7284 - snd_timer_interrupt(stime->timer, t->sticks);
7285 -+
7286 -+ if (!atomic_read(&stime->running))
7287 -+ return HRTIMER_NORESTART;
7288 - return HRTIMER_RESTART;
7289 - }
7290 -
7291 -@@ -58,6 +66,7 @@ static int snd_hrtimer_open(struct snd_timer *t)
7292 - hrtimer_init(&stime->hrt, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
7293 - stime->timer = t;
7294 - stime->hrt.function = snd_hrtimer_callback;
7295 -+ atomic_set(&stime->running, 0);
7296 - t->private_data = stime;
7297 - return 0;
7298 - }
7299 -@@ -78,16 +87,18 @@ static int snd_hrtimer_start(struct snd_timer *t)
7300 - {
7301 - struct snd_hrtimer *stime = t->private_data;
7302 -
7303 -+ atomic_set(&stime->running, 0);
7304 -+ hrtimer_cancel(&stime->hrt);
7305 - hrtimer_start(&stime->hrt, ns_to_ktime(t->sticks * resolution),
7306 - HRTIMER_MODE_REL);
7307 -+ atomic_set(&stime->running, 1);
7308 - return 0;
7309 - }
7310 -
7311 - static int snd_hrtimer_stop(struct snd_timer *t)
7312 - {
7313 - struct snd_hrtimer *stime = t->private_data;
7314 --
7315 -- hrtimer_cancel(&stime->hrt);
7316 -+ atomic_set(&stime->running, 0);
7317 - return 0;
7318 - }
7319 -
7320 -diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
7321 -index 6517f58..7e4ee4e 100644
7322 ---- a/sound/pci/hda/hda_intel.c
7323 -+++ b/sound/pci/hda/hda_intel.c
7324 -@@ -2436,6 +2436,11 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
7325 - }
7326 - }
7327 -
7328 -+ /* disable 64bit DMA address for Teradici */
7329 -+ /* it does not work with device 6549:1200 subsys e4a2:040b */
7330 -+ if (chip->driver_type == AZX_DRIVER_TERA)
7331 -+ gcap &= ~ICH6_GCAP_64OK;
7332 -+
7333 - /* allow 64bit DMA address if supported by H/W */
7334 - if ((gcap & ICH6_GCAP_64OK) && !pci_set_dma_mask(pci, DMA_BIT_MASK(64)))
7335 - pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(64));
7336 -diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
7337 -index 001663f..03e5b21 100644
7338 ---- a/virt/kvm/irq_comm.c
7339 -+++ b/virt/kvm/irq_comm.c
7340 -@@ -205,10 +205,9 @@ int kvm_request_irq_source_id(struct kvm *kvm)
7341 - int irq_source_id;
7342 -
7343 - mutex_lock(&kvm->irq_lock);
7344 -- irq_source_id = find_first_zero_bit(bitmap,
7345 -- sizeof(kvm->arch.irq_sources_bitmap));
7346 -+ irq_source_id = find_first_zero_bit(bitmap, BITS_PER_LONG);
7347 -
7348 -- if (irq_source_id >= sizeof(kvm->arch.irq_sources_bitmap)) {
7349 -+ if (irq_source_id >= BITS_PER_LONG) {
7350 - printk(KERN_WARNING "kvm: exhaust allocatable IRQ sources!\n");
7351 - return -EFAULT;
7352 - }
7353 -@@ -228,7 +227,7 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id)
7354 -
7355 - mutex_lock(&kvm->irq_lock);
7356 - if (irq_source_id < 0 ||
7357 -- irq_source_id >= sizeof(kvm->arch.irq_sources_bitmap)) {
7358 -+ irq_source_id >= BITS_PER_LONG) {
7359 - printk(KERN_ERR "kvm: IRQ source ID out of range!\n");
7360 - return;
7361 - }
7362
7363 Deleted: genpatches-2.6/trunk/2.6.33/1002_linux-2.6.32.3.patch
7364 ===================================================================
7365 --- genpatches-2.6/trunk/2.6.33/1002_linux-2.6.32.3.patch 2010-02-18 15:55:49 UTC (rev 1673)
7366 +++ genpatches-2.6/trunk/2.6.33/1002_linux-2.6.32.3.patch 2010-02-18 15:58:13 UTC (rev 1674)
7367 @@ -1,4876 +0,0 @@
7368 -diff --git a/Documentation/filesystems/ext4.txt b/Documentation/filesystems/ext4.txt
7369 -index af6885c..e1def17 100644
7370 ---- a/Documentation/filesystems/ext4.txt
7371 -+++ b/Documentation/filesystems/ext4.txt
7372 -@@ -196,7 +196,7 @@ nobarrier This also requires an IO stack which can support
7373 - also be used to enable or disable barriers, for
7374 - consistency with other ext4 mount options.
7375 -
7376 --inode_readahead=n This tuning parameter controls the maximum
7377 -+inode_readahead_blks=n This tuning parameter controls the maximum
7378 - number of inode table blocks that ext4's inode
7379 - table readahead algorithm will pre-read into
7380 - the buffer cache. The default value is 32 blocks.
7381 -diff --git a/arch/powerpc/kernel/align.c b/arch/powerpc/kernel/align.c
7382 -index a5b632e..f0c624f 100644
7383 ---- a/arch/powerpc/kernel/align.c
7384 -+++ b/arch/powerpc/kernel/align.c
7385 -@@ -642,10 +642,14 @@ static int emulate_spe(struct pt_regs *regs, unsigned int reg,
7386 - */
7387 - static int emulate_vsx(unsigned char __user *addr, unsigned int reg,
7388 - unsigned int areg, struct pt_regs *regs,
7389 -- unsigned int flags, unsigned int length)
7390 -+ unsigned int flags, unsigned int length,
7391 -+ unsigned int elsize)
7392 - {
7393 - char *ptr;
7394 -+ unsigned long *lptr;
7395 - int ret = 0;
7396 -+ int sw = 0;
7397 -+ int i, j;
7398 -
7399 - flush_vsx_to_thread(current);
7400 -
7401 -@@ -654,19 +658,35 @@ static int emulate_vsx(unsigned char __user *addr, unsigned int reg,
7402 - else
7403 - ptr = (char *) &current->thread.vr[reg - 32];
7404 -
7405 -- if (flags & ST)
7406 -- ret = __copy_to_user(addr, ptr, length);
7407 -- else {
7408 -- if (flags & SPLT){
7409 -- ret = __copy_from_user(ptr, addr, length);
7410 -- ptr += length;
7411 -+ lptr = (unsigned long *) ptr;
7412 -+
7413 -+ if (flags & SW)
7414 -+ sw = elsize-1;
7415 -+
7416 -+ for (j = 0; j < length; j += elsize) {
7417 -+ for (i = 0; i < elsize; ++i) {
7418 -+ if (flags & ST)
7419 -+ ret |= __put_user(ptr[i^sw], addr + i);
7420 -+ else
7421 -+ ret |= __get_user(ptr[i^sw], addr + i);
7422 - }
7423 -- ret |= __copy_from_user(ptr, addr, length);
7424 -+ ptr += elsize;
7425 -+ addr += elsize;
7426 - }
7427 -- if (flags & U)
7428 -- regs->gpr[areg] = regs->dar;
7429 -- if (ret)
7430 -+
7431 -+ if (!ret) {
7432 -+ if (flags & U)
7433 -+ regs->gpr[areg] = regs->dar;
7434 -+
7435 -+ /* Splat load copies the same data to top and bottom 8 bytes */
7436 -+ if (flags & SPLT)
7437 -+ lptr[1] = lptr[0];
7438 -+ /* For 8 byte loads, zero the top 8 bytes */
7439 -+ else if (!(flags & ST) && (8 == length))
7440 -+ lptr[1] = 0;
7441 -+ } else
7442 - return -EFAULT;
7443 -+
7444 - return 1;
7445 - }
7446 - #endif
7447 -@@ -767,16 +787,25 @@ int fix_alignment(struct pt_regs *regs)
7448 -
7449 - #ifdef CONFIG_VSX
7450 - if ((instruction & 0xfc00003e) == 0x7c000018) {
7451 -- /* Additional register addressing bit (64 VSX vs 32 FPR/GPR */
7452 -+ unsigned int elsize;
7453 -+
7454 -+ /* Additional register addressing bit (64 VSX vs 32 FPR/GPR) */
7455 - reg |= (instruction & 0x1) << 5;
7456 - /* Simple inline decoder instead of a table */
7457 -+ /* VSX has only 8 and 16 byte memory accesses */
7458 -+ nb = 8;
7459 - if (instruction & 0x200)
7460 - nb = 16;
7461 -- else if (instruction & 0x080)
7462 -- nb = 8;
7463 -- else
7464 -- nb = 4;
7465 -+
7466 -+ /* Vector stores in little-endian mode swap individual
7467 -+ elements, so process them separately */
7468 -+ elsize = 4;
7469 -+ if (instruction & 0x80)
7470 -+ elsize = 8;
7471 -+
7472 - flags = 0;
7473 -+ if (regs->msr & MSR_LE)
7474 -+ flags |= SW;
7475 - if (instruction & 0x100)
7476 - flags |= ST;
7477 - if (instruction & 0x040)
7478 -@@ -787,7 +816,7 @@ int fix_alignment(struct pt_regs *regs)
7479 - nb = 8;
7480 - }
7481 - PPC_WARN_EMULATED(vsx);
7482 -- return emulate_vsx(addr, reg, areg, regs, flags, nb);
7483 -+ return emulate_vsx(addr, reg, areg, regs, flags, nb, elsize);
7484 - }
7485 - #endif
7486 - /* A size of 0 indicates an instruction we don't support, with
7487 -diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h
7488 -index 7e2b6ba..0e3e728 100644
7489 ---- a/arch/x86/include/asm/msr.h
7490 -+++ b/arch/x86/include/asm/msr.h
7491 -@@ -27,6 +27,18 @@ struct msr {
7492 - };
7493 - };
7494 -
7495 -+struct msr_info {
7496 -+ u32 msr_no;
7497 -+ struct msr reg;
7498 -+ struct msr *msrs;
7499 -+ int err;
7500 -+};
7501 -+
7502 -+struct msr_regs_info {
7503 -+ u32 *regs;
7504 -+ int err;
7505 -+};
7506 -+
7507 - static inline unsigned long long native_read_tscp(unsigned int *aux)
7508 - {
7509 - unsigned long low, high;
7510 -@@ -244,11 +256,14 @@ do { \
7511 -
7512 - #define write_rdtscp_aux(val) wrmsr(0xc0000103, (val), 0)
7513 -
7514 -+struct msr *msrs_alloc(void);
7515 -+void msrs_free(struct msr *msrs);
7516 -+
7517 - #ifdef CONFIG_SMP
7518 - int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h);
7519 - int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h);
7520 --void rdmsr_on_cpus(const cpumask_t *mask, u32 msr_no, struct msr *msrs);
7521 --void wrmsr_on_cpus(const cpumask_t *mask, u32 msr_no, struct msr *msrs);
7522 -+void rdmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs);
7523 -+void wrmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs);
7524 - int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h);
7525 - int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h);
7526 - int rdmsr_safe_regs_on_cpu(unsigned int cpu, u32 regs[8]);
7527 -diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
7528 -index c978648..13b1885 100644
7529 ---- a/arch/x86/include/asm/processor.h
7530 -+++ b/arch/x86/include/asm/processor.h
7531 -@@ -180,7 +180,7 @@ static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
7532 - unsigned int *ecx, unsigned int *edx)
7533 - {
7534 - /* ecx is often an input as well as an output. */
7535 -- asm("cpuid"
7536 -+ asm volatile("cpuid"
7537 - : "=a" (*eax),
7538 - "=b" (*ebx),
7539 - "=c" (*ecx),
7540 -diff --git a/arch/x86/include/asm/uv/uv_hub.h b/arch/x86/include/asm/uv/uv_hub.h
7541 -index d1414af..e90a8a9 100644
7542 ---- a/arch/x86/include/asm/uv/uv_hub.h
7543 -+++ b/arch/x86/include/asm/uv/uv_hub.h
7544 -@@ -31,20 +31,20 @@
7545 - * contiguous (although various IO spaces may punch holes in
7546 - * it)..
7547 - *
7548 -- * N - Number of bits in the node portion of a socket physical
7549 -- * address.
7550 -+ * N - Number of bits in the node portion of a socket physical
7551 -+ * address.
7552 - *
7553 -- * NASID - network ID of a router, Mbrick or Cbrick. Nasid values of
7554 -- * routers always have low bit of 1, C/MBricks have low bit
7555 -- * equal to 0. Most addressing macros that target UV hub chips
7556 -- * right shift the NASID by 1 to exclude the always-zero bit.
7557 -- * NASIDs contain up to 15 bits.
7558 -+ * NASID - network ID of a router, Mbrick or Cbrick. Nasid values of
7559 -+ * routers always have low bit of 1, C/MBricks have low bit
7560 -+ * equal to 0. Most addressing macros that target UV hub chips
7561 -+ * right shift the NASID by 1 to exclude the always-zero bit.
7562 -+ * NASIDs contain up to 15 bits.
7563 - *
7564 - * GNODE - NASID right shifted by 1 bit. Most mmrs contain gnodes instead
7565 - * of nasids.
7566 - *
7567 -- * PNODE - the low N bits of the GNODE. The PNODE is the most useful variant
7568 -- * of the nasid for socket usage.
7569 -+ * PNODE - the low N bits of the GNODE. The PNODE is the most useful variant
7570 -+ * of the nasid for socket usage.
7571 - *
7572 - *
7573 - * NumaLink Global Physical Address Format:
7574 -@@ -71,12 +71,12 @@
7575 - *
7576 - *
7577 - * APICID format
7578 -- * NOTE!!!!!! This is the current format of the APICID. However, code
7579 -- * should assume that this will change in the future. Use functions
7580 -- * in this file for all APICID bit manipulations and conversion.
7581 -+ * NOTE!!!!!! This is the current format of the APICID. However, code
7582 -+ * should assume that this will change in the future. Use functions
7583 -+ * in this file for all APICID bit manipulations and conversion.
7584 - *
7585 -- * 1111110000000000
7586 -- * 5432109876543210
7587 -+ * 1111110000000000
7588 -+ * 5432109876543210
7589 - * pppppppppplc0cch
7590 - * sssssssssss
7591 - *
7592 -@@ -89,9 +89,9 @@
7593 - * Note: Processor only supports 12 bits in the APICID register. The ACPI
7594 - * tables hold all 16 bits. Software needs to be aware of this.
7595 - *
7596 -- * Unless otherwise specified, all references to APICID refer to
7597 -- * the FULL value contained in ACPI tables, not the subset in the
7598 -- * processor APICID register.
7599 -+ * Unless otherwise specified, all references to APICID refer to
7600 -+ * the FULL value contained in ACPI tables, not the subset in the
7601 -+ * processor APICID register.
7602 - */
7603 -
7604 -
7605 -@@ -151,16 +151,16 @@ struct uv_hub_info_s {
7606 - };
7607 -
7608 - DECLARE_PER_CPU(struct uv_hub_info_s, __uv_hub_info);
7609 --#define uv_hub_info (&__get_cpu_var(__uv_hub_info))
7610 -+#define uv_hub_info (&__get_cpu_var(__uv_hub_info))
7611 - #define uv_cpu_hub_info(cpu) (&per_cpu(__uv_hub_info, cpu))
7612 -
7613 - /*
7614 - * Local & Global MMR space macros.
7615 -- * Note: macros are intended to be used ONLY by inline functions
7616 -- * in this file - not by other kernel code.
7617 -- * n - NASID (full 15-bit global nasid)
7618 -- * g - GNODE (full 15-bit global nasid, right shifted 1)
7619 -- * p - PNODE (local part of nsids, right shifted 1)
7620 -+ * Note: macros are intended to be used ONLY by inline functions
7621 -+ * in this file - not by other kernel code.
7622 -+ * n - NASID (full 15-bit global nasid)
7623 -+ * g - GNODE (full 15-bit global nasid, right shifted 1)
7624 -+ * p - PNODE (local part of nsids, right shifted 1)
7625 - */
7626 - #define UV_NASID_TO_PNODE(n) (((n) >> 1) & uv_hub_info->pnode_mask)
7627 - #define UV_PNODE_TO_GNODE(p) ((p) |uv_hub_info->gnode_extra)
7628 -@@ -213,8 +213,8 @@ DECLARE_PER_CPU(struct uv_hub_info_s, __uv_hub_info);
7629 - /*
7630 - * Macros for converting between kernel virtual addresses, socket local physical
7631 - * addresses, and UV global physical addresses.
7632 -- * Note: use the standard __pa() & __va() macros for converting
7633 -- * between socket virtual and socket physical addresses.
7634 -+ * Note: use the standard __pa() & __va() macros for converting
7635 -+ * between socket virtual and socket physical addresses.
7636 - */
7637 -
7638 - /* socket phys RAM --> UV global physical address */
7639 -@@ -265,21 +265,18 @@ static inline int uv_apicid_to_pnode(int apicid)
7640 - * Access global MMRs using the low memory MMR32 space. This region supports
7641 - * faster MMR access but not all MMRs are accessible in this space.
7642 - */
7643 --static inline unsigned long *uv_global_mmr32_address(int pnode,
7644 -- unsigned long offset)
7645 -+static inline unsigned long *uv_global_mmr32_address(int pnode, unsigned long offset)
7646 - {
7647 - return __va(UV_GLOBAL_MMR32_BASE |
7648 - UV_GLOBAL_MMR32_PNODE_BITS(pnode) | offset);
7649 - }
7650 -
7651 --static inline void uv_write_global_mmr32(int pnode, unsigned long offset,
7652 -- unsigned long val)
7653 -+static inline void uv_write_global_mmr32(int pnode, unsigned long offset, unsigned long val)
7654 - {
7655 - writeq(val, uv_global_mmr32_address(pnode, offset));
7656 - }
7657 -
7658 --static inline unsigned long uv_read_global_mmr32(int pnode,
7659 -- unsigned long offset)
7660 -+static inline unsigned long uv_read_global_mmr32(int pnode, unsigned long offset)
7661 - {
7662 - return readq(uv_global_mmr32_address(pnode, offset));
7663 - }
7664 -@@ -288,25 +285,32 @@ static inline unsigned long uv_read_global_mmr32(int pnode,
7665 - * Access Global MMR space using the MMR space located at the top of physical
7666 - * memory.
7667 - */
7668 --static inline unsigned long *uv_global_mmr64_address(int pnode,
7669 -- unsigned long offset)
7670 -+static inline unsigned long *uv_global_mmr64_address(int pnode, unsigned long offset)
7671 - {
7672 - return __va(UV_GLOBAL_MMR64_BASE |
7673 - UV_GLOBAL_MMR64_PNODE_BITS(pnode) | offset);
7674 - }
7675 -
7676 --static inline void uv_write_global_mmr64(int pnode, unsigned long offset,
7677 -- unsigned long val)
7678 -+static inline void uv_write_global_mmr64(int pnode, unsigned long offset, unsigned long val)
7679 - {
7680 - writeq(val, uv_global_mmr64_address(pnode, offset));
7681 - }
7682 -
7683 --static inline unsigned long uv_read_global_mmr64(int pnode,
7684 -- unsigned long offset)
7685 -+static inline unsigned long uv_read_global_mmr64(int pnode, unsigned long offset)
7686 - {
7687 - return readq(uv_global_mmr64_address(pnode, offset));
7688 - }
7689 -
7690 -+static inline void uv_write_global_mmr8(int pnode, unsigned long offset, unsigned char val)
7691 -+{
7692 -+ writeb(val, uv_global_mmr64_address(pnode, offset));
7693 -+}
7694 -+
7695 -+static inline unsigned char uv_read_global_mmr8(int pnode, unsigned long offset)
7696 -+{
7697 -+ return readb(uv_global_mmr64_address(pnode, offset));
7698 -+}
7699 -+
7700 - /*
7701 - * Access hub local MMRs. Faster than using global space but only local MMRs
7702 - * are accessible.
7703 -@@ -426,11 +430,17 @@ static inline void uv_set_scir_bits(unsigned char value)
7704 - }
7705 - }
7706 -
7707 -+static inline unsigned long uv_scir_offset(int apicid)
7708 -+{
7709 -+ return SCIR_LOCAL_MMR_BASE | (apicid & 0x3f);
7710 -+}
7711 -+
7712 - static inline void uv_set_cpu_scir_bits(int cpu, unsigned char value)
7713 - {
7714 - if (uv_cpu_hub_info(cpu)->scir.state != value) {
7715 -+ uv_write_global_mmr8(uv_cpu_to_pnode(cpu),
7716 -+ uv_cpu_hub_info(cpu)->scir.offset, value);
7717 - uv_cpu_hub_info(cpu)->scir.state = value;
7718 -- uv_write_local_mmr8(uv_cpu_hub_info(cpu)->scir.offset, value);
7719 - }
7720 - }
7721 -
7722 -diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c
7723 -index e0b3130..c8243f0 100644
7724 ---- a/arch/x86/kernel/amd_iommu_init.c
7725 -+++ b/arch/x86/kernel/amd_iommu_init.c
7726 -@@ -136,6 +136,11 @@ LIST_HEAD(amd_iommu_list); /* list of all AMD IOMMUs in the
7727 - system */
7728 -
7729 - /*
7730 -+ * Set to true if ACPI table parsing and hardware intialization went properly
7731 -+ */
7732 -+static bool amd_iommu_initialized;
7733 -+
7734 -+/*
7735 - * Pointer to the device table which is shared by all AMD IOMMUs
7736 - * it is indexed by the PCI device id or the HT unit id and contains
7737 - * information about the domain the device belongs to as well as the
7738 -@@ -913,6 +918,8 @@ static int __init init_iommu_all(struct acpi_table_header *table)
7739 - }
7740 - WARN_ON(p != end);
7741 -
7742 -+ amd_iommu_initialized = true;
7743 -+
7744 - return 0;
7745 - }
7746 -
7747 -@@ -1263,6 +1270,9 @@ int __init amd_iommu_init(void)
7748 - if (acpi_table_parse("IVRS", init_iommu_all) != 0)
7749 - goto free;
7750 -
7751 -+ if (!amd_iommu_initialized)
7752 -+ goto free;
7753 -+
7754 - if (acpi_table_parse("IVRS", init_memory_definitions) != 0)
7755 - goto free;
7756 -
7757 -diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
7758 -index 326c254..2ab3535 100644
7759 ---- a/arch/x86/kernel/apic/x2apic_uv_x.c
7760 -+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
7761 -@@ -607,8 +607,10 @@ void __init uv_system_init(void)
7762 - uv_rtc_init();
7763 -
7764 - for_each_present_cpu(cpu) {
7765 -+ int apicid = per_cpu(x86_cpu_to_apicid, cpu);
7766 -+
7767 - nid = cpu_to_node(cpu);
7768 -- pnode = uv_apicid_to_pnode(per_cpu(x86_cpu_to_apicid, cpu));
7769 -+ pnode = uv_apicid_to_pnode(apicid);
7770 - blade = boot_pnode_to_blade(pnode);
7771 - lcpu = uv_blade_info[blade].nr_possible_cpus;
7772 - uv_blade_info[blade].nr_possible_cpus++;
7773 -@@ -629,15 +631,13 @@ void __init uv_system_init(void)
7774 - uv_cpu_hub_info(cpu)->gnode_extra = gnode_extra;
7775 - uv_cpu_hub_info(cpu)->global_mmr_base = mmr_base;
7776 - uv_cpu_hub_info(cpu)->coherency_domain_number = sn_coherency_id;
7777 -- uv_cpu_hub_info(cpu)->scir.offset = SCIR_LOCAL_MMR_BASE + lcpu;
7778 -+ uv_cpu_hub_info(cpu)->scir.offset = uv_scir_offset(apicid);
7779 - uv_node_to_blade[nid] = blade;
7780 - uv_cpu_to_blade[cpu] = blade;
7781 - max_pnode = max(pnode, max_pnode);
7782 -
7783 -- printk(KERN_DEBUG "UV: cpu %d, apicid 0x%x, pnode %d, nid %d, "
7784 -- "lcpu %d, blade %d\n",
7785 -- cpu, per_cpu(x86_cpu_to_apicid, cpu), pnode, nid,
7786 -- lcpu, blade);
7787 -+ printk(KERN_DEBUG "UV: cpu %d, apicid 0x%x, pnode %d, nid %d, lcpu %d, blade %d\n",
7788 -+ cpu, apicid, pnode, nid, lcpu, blade);
7789 - }
7790 -
7791 - /* Add blade/pnode info for nodes without cpus */
7792 -diff --git a/arch/x86/kernel/ptrace.c b/arch/x86/kernel/ptrace.c
7793 -index 7b058a2..c06acdd 100644
7794 ---- a/arch/x86/kernel/ptrace.c
7795 -+++ b/arch/x86/kernel/ptrace.c
7796 -@@ -408,14 +408,14 @@ static int genregs_get(struct task_struct *target,
7797 - {
7798 - if (kbuf) {
7799 - unsigned long *k = kbuf;
7800 -- while (count > 0) {
7801 -+ while (count >= sizeof(*k)) {
7802 - *k++ = getreg(target, pos);
7803 - count -= sizeof(*k);
7804 - pos += sizeof(*k);
7805 - }
7806 - } else {
7807 - unsigned long __user *u = ubuf;
7808 -- while (count > 0) {
7809 -+ while (count >= sizeof(*u)) {
7810 - if (__put_user(getreg(target, pos), u++))
7811 - return -EFAULT;
7812 - count -= sizeof(*u);
7813 -@@ -434,14 +434,14 @@ static int genregs_set(struct task_struct *target,
7814 - int ret = 0;
7815 - if (kbuf) {
7816 - const unsigned long *k = kbuf;
7817 -- while (count > 0 && !ret) {
7818 -+ while (count >= sizeof(*k) && !ret) {
7819 - ret = putreg(target, pos, *k++);
7820 - count -= sizeof(*k);
7821 - pos += sizeof(*k);
7822 - }
7823 - } else {
7824 - const unsigned long __user *u = ubuf;
7825 -- while (count > 0 && !ret) {
7826 -+ while (count >= sizeof(*u) && !ret) {
7827 - unsigned long word;
7828 - ret = __get_user(word, u++);
7829 - if (ret)
7830 -@@ -1219,14 +1219,14 @@ static int genregs32_get(struct task_struct *target,
7831 - {
7832 - if (kbuf) {
7833 - compat_ulong_t *k = kbuf;
7834 -- while (count > 0) {
7835 -+ while (count >= sizeof(*k)) {
7836 - getreg32(target, pos, k++);
7837 - count -= sizeof(*k);
7838 - pos += sizeof(*k);
7839 - }
7840 - } else {
7841 - compat_ulong_t __user *u = ubuf;
7842 -- while (count > 0) {
7843 -+ while (count >= sizeof(*u)) {
7844 - compat_ulong_t word;
7845 - getreg32(target, pos, &word);
7846 - if (__put_user(word, u++))
7847 -@@ -1247,14 +1247,14 @@ static int genregs32_set(struct task_struct *target,
7848 - int ret = 0;
7849 - if (kbuf) {
7850 - const compat_ulong_t *k = kbuf;
7851 -- while (count > 0 && !ret) {
7852 -+ while (count >= sizeof(*k) && !ret) {
7853 - ret = putreg32(target, pos, *k++);
7854 - count -= sizeof(*k);
7855 - pos += sizeof(*k);
7856 - }
7857 - } else {
7858 - const compat_ulong_t __user *u = ubuf;
7859 -- while (count > 0 && !ret) {
7860 -+ while (count >= sizeof(*u) && !ret) {
7861 - compat_ulong_t word;
7862 - ret = __get_user(word, u++);
7863 - if (ret)
7864 -diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
7865 -index 23c2176..41659fb 100644
7866 ---- a/arch/x86/kvm/lapic.c
7867 -+++ b/arch/x86/kvm/lapic.c
7868 -@@ -1156,6 +1156,7 @@ void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu)
7869 - hrtimer_cancel(&apic->lapic_timer.timer);
7870 - update_divide_count(apic);
7871 - start_apic_timer(apic);
7872 -+ apic->irr_pending = true;
7873 - }
7874 -
7875 - void __kvm_migrate_apic_timer(struct kvm_vcpu *vcpu)
7876 -diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
7877 -index 72558f8..85e12cd 100644
7878 ---- a/arch/x86/kvm/paging_tmpl.h
7879 -+++ b/arch/x86/kvm/paging_tmpl.h
7880 -@@ -455,8 +455,6 @@ out_unlock:
7881 - static void FNAME(invlpg)(struct kvm_vcpu *vcpu, gva_t gva)
7882 - {
7883 - struct kvm_shadow_walk_iterator iterator;
7884 -- pt_element_t gpte;
7885 -- gpa_t pte_gpa = -1;
7886 - int level;
7887 - u64 *sptep;
7888 - int need_flush = 0;
7889 -@@ -471,10 +469,6 @@ static void FNAME(invlpg)(struct kvm_vcpu *vcpu, gva_t gva)
7890 - if (level == PT_PAGE_TABLE_LEVEL ||
7891 - ((level == PT_DIRECTORY_LEVEL && is_large_pte(*sptep))) ||
7892 - ((level == PT_PDPE_LEVEL && is_large_pte(*sptep)))) {
7893 -- struct kvm_mmu_page *sp = page_header(__pa(sptep));
7894 --
7895 -- pte_gpa = (sp->gfn << PAGE_SHIFT);
7896 -- pte_gpa += (sptep - sp->spt) * sizeof(pt_element_t);
7897 -
7898 - if (is_shadow_present_pte(*sptep)) {
7899 - rmap_remove(vcpu->kvm, sptep);
7900 -@@ -493,18 +487,6 @@ static void FNAME(invlpg)(struct kvm_vcpu *vcpu, gva_t gva)
7901 - if (need_flush)
7902 - kvm_flush_remote_tlbs(vcpu->kvm);
7903 - spin_unlock(&vcpu->kvm->mmu_lock);
7904 --
7905 -- if (pte_gpa == -1)
7906 -- return;
7907 -- if (kvm_read_guest_atomic(vcpu->kvm, pte_gpa, &gpte,
7908 -- sizeof(pt_element_t)))
7909 -- return;
7910 -- if (is_present_gpte(gpte) && (gpte & PT_ACCESSED_MASK)) {
7911 -- if (mmu_topup_memory_caches(vcpu))
7912 -- return;
7913 -- kvm_mmu_pte_write(vcpu, pte_gpa, (const u8 *)&gpte,
7914 -- sizeof(pt_element_t), 0);
7915 -- }
7916 - }
7917 -
7918 - static gpa_t FNAME(gva_to_gpa)(struct kvm_vcpu *vcpu, gva_t vaddr)
7919 -diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
7920 -index 85f5db9..c2b6f39 100644
7921 ---- a/arch/x86/lib/Makefile
7922 -+++ b/arch/x86/lib/Makefile
7923 -@@ -2,14 +2,14 @@
7924 - # Makefile for x86 specific library files.
7925 - #
7926 -
7927 --obj-$(CONFIG_SMP) := msr.o
7928 -+obj-$(CONFIG_SMP) += msr-smp.o
7929 -
7930 - lib-y := delay.o
7931 - lib-y += thunk_$(BITS).o
7932 - lib-y += usercopy_$(BITS).o getuser.o putuser.o
7933 - lib-y += memcpy_$(BITS).o
7934 -
7935 --obj-y += msr-reg.o msr-reg-export.o
7936 -+obj-y += msr.o msr-reg.o msr-reg-export.o
7937 -
7938 - ifeq ($(CONFIG_X86_32),y)
7939 - obj-y += atomic64_32.o
7940 -diff --git a/arch/x86/lib/msr-smp.c b/arch/x86/lib/msr-smp.c
7941 -new file mode 100644
7942 -index 0000000..a6b1b86
7943 ---- /dev/null
7944 -+++ b/arch/x86/lib/msr-smp.c
7945 -@@ -0,0 +1,204 @@
7946 -+#include <linux/module.h>
7947 -+#include <linux/preempt.h>
7948 -+#include <linux/smp.h>
7949 -+#include <asm/msr.h>
7950 -+
7951 -+static void __rdmsr_on_cpu(void *info)
7952 -+{
7953 -+ struct msr_info *rv = info;
7954 -+ struct msr *reg;
7955 -+ int this_cpu = raw_smp_processor_id();
7956 -+
7957 -+ if (rv->msrs)
7958 -+ reg = per_cpu_ptr(rv->msrs, this_cpu);
7959 -+ else
7960 -+ reg = &rv->reg;
7961 -+
7962 -+ rdmsr(rv->msr_no, reg->l, reg->h);
7963 -+}
7964 -+
7965 -+static void __wrmsr_on_cpu(void *info)
7966 -+{
7967 -+ struct msr_info *rv = info;
7968 -+ struct msr *reg;
7969 -+ int this_cpu = raw_smp_processor_id();
7970 -+
7971 -+ if (rv->msrs)
7972 -+ reg = per_cpu_ptr(rv->msrs, this_cpu);
7973 -+ else
7974 -+ reg = &rv->reg;
7975 -+
7976 -+ wrmsr(rv->msr_no, reg->l, reg->h);
7977 -+}
7978 -+
7979 -+int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
7980 -+{
7981 -+ int err;
7982 -+ struct msr_info rv;
7983 -+
7984 -+ memset(&rv, 0, sizeof(rv));
7985 -+
7986 -+ rv.msr_no = msr_no;
7987 -+ err = smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 1);
7988 -+ *l = rv.reg.l;
7989 -+ *h = rv.reg.h;
7990 -+
7991 -+ return err;
7992 -+}
7993 -+EXPORT_SYMBOL(rdmsr_on_cpu);
7994 -+
7995 -+int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
7996 -+{
7997 -+ int err;
7998 -+ struct msr_info rv;
7999 -+
8000 -+ memset(&rv, 0, sizeof(rv));
8001 -+
8002 -+ rv.msr_no = msr_no;
8003 -+ rv.reg.l = l;
8004 -+ rv.reg.h = h;
8005 -+ err = smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 1);
8006 -+
8007 -+ return err;
8008 -+}
8009 -+EXPORT_SYMBOL(wrmsr_on_cpu);
8010 -+
8011 -+static void __rwmsr_on_cpus(const struct cpumask *mask, u32 msr_no,
8012 -+ struct msr *msrs,
8013 -+ void (*msr_func) (void *info))
8014 -+{
8015 -+ struct msr_info rv;
8016 -+ int this_cpu;
8017 -+
8018 -+ memset(&rv, 0, sizeof(rv));
8019 -+
8020 -+ rv.msrs = msrs;
8021 -+ rv.msr_no = msr_no;
8022 -+
8023 -+ this_cpu = get_cpu();
8024 -+
8025 -+ if (cpumask_test_cpu(this_cpu, mask))
8026 -+ msr_func(&rv);
8027 -+
8028 -+ smp_call_function_many(mask, msr_func, &rv, 1);
8029 -+ put_cpu();
8030 -+}
8031 -+
8032 -+/* rdmsr on a bunch of CPUs
8033 -+ *
8034 -+ * @mask: which CPUs
8035 -+ * @msr_no: which MSR
8036 -+ * @msrs: array of MSR values
8037 -+ *
8038 -+ */
8039 -+void rdmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs)
8040 -+{
8041 -+ __rwmsr_on_cpus(mask, msr_no, msrs, __rdmsr_on_cpu);
8042 -+}
8043 -+EXPORT_SYMBOL(rdmsr_on_cpus);
8044 -+
8045 -+/*
8046 -+ * wrmsr on a bunch of CPUs
8047 -+ *
8048 -+ * @mask: which CPUs
8049 -+ * @msr_no: which MSR
8050 -+ * @msrs: array of MSR values
8051 -+ *
8052 -+ */
8053 -+void wrmsr_on_cpus(const struct cpumask *mask, u32 msr_no, struct msr *msrs)
8054 -+{
8055 -+ __rwmsr_on_cpus(mask, msr_no, msrs, __wrmsr_on_cpu);
8056 -+}
8057 -+EXPORT_SYMBOL(wrmsr_on_cpus);
8058 -+
8059 -+/* These "safe" variants are slower and should be used when the target MSR
8060 -+ may not actually exist. */
8061 -+static void __rdmsr_safe_on_cpu(void *info)
8062 -+{
8063 -+ struct msr_info *rv = info;
8064 -+
8065 -+ rv->err = rdmsr_safe(rv->msr_no, &rv->reg.l, &rv->reg.h);
8066 -+}
8067 -+
8068 -+static void __wrmsr_safe_on_cpu(void *info)
8069 -+{
8070 -+ struct msr_info *rv = info;
8071 -+
8072 -+ rv->err = wrmsr_safe(rv->msr_no, rv->reg.l, rv->reg.h);
8073 -+}
8074 -+
8075 -+int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
8076 -+{
8077 -+ int err;
8078 -+ struct msr_info rv;
8079 -+
8080 -+ memset(&rv, 0, sizeof(rv));
8081 -+
8082 -+ rv.msr_no = msr_no;
8083 -+ err = smp_call_function_single(cpu, __rdmsr_safe_on_cpu, &rv, 1);
8084 -+ *l = rv.reg.l;
8085 -+ *h = rv.reg.h;
8086 -+
8087 -+ return err ? err : rv.err;
8088 -+}
8089 -+EXPORT_SYMBOL(rdmsr_safe_on_cpu);
8090 -+
8091 -+int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
8092 -+{
8093 -+ int err;
8094 -+ struct msr_info rv;
8095 -+
8096 -+ memset(&rv, 0, sizeof(rv));
8097 -+
8098 -+ rv.msr_no = msr_no;
8099 -+ rv.reg.l = l;
8100 -+ rv.reg.h = h;
8101 -+ err = smp_call_function_single(cpu, __wrmsr_safe_on_cpu, &rv, 1);
8102 -+
8103 -+ return err ? err : rv.err;
8104 -+}
8105 -+EXPORT_SYMBOL(wrmsr_safe_on_cpu);
8106 -+
8107 -+/*
8108 -+ * These variants are significantly slower, but allows control over
8109 -+ * the entire 32-bit GPR set.
8110 -+ */
8111 -+static void __rdmsr_safe_regs_on_cpu(void *info)
8112 -+{
8113 -+ struct msr_regs_info *rv = info;
8114 -+
8115 -+ rv->err = rdmsr_safe_regs(rv->regs);
8116 -+}
8117 -+
8118 -+static void __wrmsr_safe_regs_on_cpu(void *info)
8119 -+{
8120 -+ struct msr_regs_info *rv = info;
8121 -+
8122 -+ rv->err = wrmsr_safe_regs(rv->regs);
8123 -+}
8124 -+
8125 -+int rdmsr_safe_regs_on_cpu(unsigned int cpu, u32 *regs)
8126 -+{
8127 -+ int err;
8128 -+ struct msr_regs_info rv;
8129 -+
8130 -+ rv.regs = regs;
8131 -+ rv.err = -EIO;
8132 -+ err = smp_call_function_single(cpu, __rdmsr_safe_regs_on_cpu, &rv, 1);
8133 -+
8134 -+ return err ? err : rv.err;
8135 -+}
8136 -+EXPORT_SYMBOL(rdmsr_safe_regs_on_cpu);
8137 -+
8138 -+int wrmsr_safe_regs_on_cpu(unsigned int cpu, u32 *regs)
8139 -+{
8140 -+ int err;
8141 -+ struct msr_regs_info rv;
8142 -+
8143 -+ rv.regs = regs;
8144 -+ rv.err = -EIO;
8145 -+ err = smp_call_function_single(cpu, __wrmsr_safe_regs_on_cpu, &rv, 1);
8146 -+
8147 -+ return err ? err : rv.err;
8148 -+}
8149 -+EXPORT_SYMBOL(wrmsr_safe_regs_on_cpu);
8150 -diff --git a/arch/x86/lib/msr.c b/arch/x86/lib/msr.c
8151 -index 33a1e3c..8f8eebd 100644
8152 ---- a/arch/x86/lib/msr.c
8153 -+++ b/arch/x86/lib/msr.c
8154 -@@ -1,226 +1,23 @@
8155 - #include <linux/module.h>
8156 - #include <linux/preempt.h>
8157 --#include <linux/smp.h>
8158 - #include <asm/msr.h>
8159 -
8160 --struct msr_info {
8161 -- u32 msr_no;
8162 -- struct msr reg;
8163 -- struct msr *msrs;
8164 -- int off;
8165 -- int err;
8166 --};
8167 --
8168 --static void __rdmsr_on_cpu(void *info)
8169 --{
8170 -- struct msr_info *rv = info;
8171 -- struct msr *reg;
8172 -- int this_cpu = raw_smp_processor_id();
8173 --
8174 -- if (rv->msrs)
8175 -- reg = &rv->msrs[this_cpu - rv->off];
8176 -- else
8177 -- reg = &rv->reg;
8178 --
8179 -- rdmsr(rv->msr_no, reg->l, reg->h);
8180 --}
8181 --
8182 --static void __wrmsr_on_cpu(void *info)
8183 --{
8184 -- struct msr_info *rv = info;
8185 -- struct msr *reg;
8186 -- int this_cpu = raw_smp_processor_id();
8187 --
8188 -- if (rv->msrs)
8189 -- reg = &rv->msrs[this_cpu - rv->off];
8190 -- else
8191 -- reg = &rv->reg;
8192 --
8193 -- wrmsr(rv->msr_no, reg->l, reg->h);
8194 --}
8195 --
8196 --int rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
8197 --{
8198 -- int err;
8199 -- struct msr_info rv;
8200 --
8201 -- memset(&rv, 0, sizeof(rv));
8202 --
8203 -- rv.msr_no = msr_no;
8204 -- err = smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 1);
8205 -- *l = rv.reg.l;
8206 -- *h = rv.reg.h;
8207 --
8208 -- return err;
8209 --}
8210 --EXPORT_SYMBOL(rdmsr_on_cpu);
8211 --
8212 --int wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
8213 --{
8214 -- int err;
8215 -- struct msr_info rv;
8216 --
8217 -- memset(&rv, 0, sizeof(rv));
8218 --
8219 -- rv.msr_no = msr_no;
8220 -- rv.reg.l = l;
8221 -- rv.reg.h = h;
8222 -- err = smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 1);
8223 --
8224 -- return err;
8225 --}
8226 --EXPORT_SYMBOL(wrmsr_on_cpu);
8227 --
8228 --/* rdmsr on a bunch of CPUs
8229 -- *
8230 -- * @mask: which CPUs
8231 -- * @msr_no: which MSR
8232 -- * @msrs: array of MSR values
8233 -- *
8234 -- */
8235 --void rdmsr_on_cpus(const cpumask_t *mask, u32 msr_no, struct msr *msrs)
8236 --{
8237 -- struct msr_info rv;
8238 -- int this_cpu;
8239 --
8240 -- memset(&rv, 0, sizeof(rv));
8241 --
8242 -- rv.off = cpumask_first(mask);
8243 -- rv.msrs = msrs;
8244 -- rv.msr_no = msr_no;
8245 --
8246 -- this_cpu = get_cpu();
8247 --
8248 -- if (cpumask_test_cpu(this_cpu, mask))
8249 -- __rdmsr_on_cpu(&rv);
8250 --
8251 -- smp_call_function_many(mask, __rdmsr_on_cpu, &rv, 1);
8252 -- put_cpu();
8253 --}
8254 --EXPORT_SYMBOL(rdmsr_on_cpus);
8255 --
8256 --/*
8257 -- * wrmsr on a bunch of CPUs
8258 -- *
8259 -- * @mask: which CPUs
8260 -- * @msr_no: which MSR
8261 -- * @msrs: array of MSR values
8262 -- *
8263 -- */
8264 --void wrmsr_on_cpus(const cpumask_t *mask, u32 msr_no, struct msr *msrs)
8265 --{
8266 -- struct msr_info rv;
8267 -- int this_cpu;
8268 --
8269 -- memset(&rv, 0, sizeof(rv));
8270 --
8271 -- rv.off = cpumask_first(mask);
8272 -- rv.msrs = msrs;
8273 -- rv.msr_no = msr_no;
8274 --
8275 -- this_cpu = get_cpu();
8276 --
8277 -- if (cpumask_test_cpu(this_cpu, mask))
8278 -- __wrmsr_on_cpu(&rv);
8279 --
8280 -- smp_call_function_many(mask, __wrmsr_on_cpu, &rv, 1);
8281 -- put_cpu();
8282 --}
8283 --EXPORT_SYMBOL(wrmsr_on_cpus);
8284 --
8285 --/* These "safe" variants are slower and should be used when the target MSR
8286 -- may not actually exist. */
8287 --static void __rdmsr_safe_on_cpu(void *info)
8288 --{
8289 -- struct msr_info *rv = info;
8290 --
8291 -- rv->err = rdmsr_safe(rv->msr_no, &rv->reg.l, &rv->reg.h);
8292 --}
8293 --
8294 --static void __wrmsr_safe_on_cpu(void *info)
8295 --{
8296 -- struct msr_info *rv = info;
8297 --
8298 -- rv->err = wrmsr_safe(rv->msr_no, rv->reg.l, rv->reg.h);
8299 --}
8300 --
8301 --int rdmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h)
8302 -+struct msr *msrs_alloc(void)
8303 - {
8304 -- int err;
8305 -- struct msr_info rv;
8306 -+ struct msr *msrs = NULL;
8307 -
8308 -- memset(&rv, 0, sizeof(rv));
8309 -+ msrs = alloc_percpu(struct msr);
8310 -+ if (!msrs) {
8311 -+ pr_warning("%s: error allocating msrs\n", __func__);
8312 -+ return NULL;
8313 -+ }
8314 -
8315 -- rv.msr_no = msr_no;
8316 -- err = smp_call_function_single(cpu, __rdmsr_safe_on_cpu, &rv, 1);
8317 -- *l = rv.reg.l;
8318 -- *h = rv.reg.h;
8319 --
8320 -- return err ? err : rv.err;
8321 -+ return msrs;
8322 - }
8323 --EXPORT_SYMBOL(rdmsr_safe_on_cpu);
8324 -+EXPORT_SYMBOL(msrs_alloc);
8325 -
8326 --int wrmsr_safe_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h)
8327 -+void msrs_free(struct msr *msrs)
8328 - {
8329 -- int err;
8330 -- struct msr_info rv;
8331 --
8332 -- memset(&rv, 0, sizeof(rv));
8333 --
8334 -- rv.msr_no = msr_no;
8335 -- rv.reg.l = l;
8336 -- rv.reg.h = h;
8337 -- err = smp_call_function_single(cpu, __wrmsr_safe_on_cpu, &rv, 1);
8338 --
8339 -- return err ? err : rv.err;
8340 --}
8341 --EXPORT_SYMBOL(wrmsr_safe_on_cpu);
8342 --
8343 --/*
8344 -- * These variants are significantly slower, but allows control over
8345 -- * the entire 32-bit GPR set.
8346 -- */
8347 --struct msr_regs_info {
8348 -- u32 *regs;
8349 -- int err;
8350 --};
8351 --
8352 --static void __rdmsr_safe_regs_on_cpu(void *info)
8353 --{
8354 -- struct msr_regs_info *rv = info;
8355 --
8356 -- rv->err = rdmsr_safe_regs(rv->regs);
8357 --}
8358 --
8359 --static void __wrmsr_safe_regs_on_cpu(void *info)
8360 --{
8361 -- struct msr_regs_info *rv = info;
8362 --
8363 -- rv->err = wrmsr_safe_regs(rv->regs);
8364 --}
8365 --
8366 --int rdmsr_safe_regs_on_cpu(unsigned int cpu, u32 *regs)
8367 --{
8368 -- int err;
8369 -- struct msr_regs_info rv;
8370 --
8371 -- rv.regs = regs;
8372 -- rv.err = -EIO;
8373 -- err = smp_call_function_single(cpu, __rdmsr_safe_regs_on_cpu, &rv, 1);
8374 --
8375 -- return err ? err : rv.err;
8376 --}
8377 --EXPORT_SYMBOL(rdmsr_safe_regs_on_cpu);
8378 --
8379 --int wrmsr_safe_regs_on_cpu(unsigned int cpu, u32 *regs)
8380 --{
8381 -- int err;
8382 -- struct msr_regs_info rv;
8383 --
8384 -- rv.regs = regs;
8385 -- rv.err = -EIO;
8386 -- err = smp_call_function_single(cpu, __wrmsr_safe_regs_on_cpu, &rv, 1);
8387 --
8388 -- return err ? err : rv.err;
8389 -+ free_percpu(msrs);
8390 - }
8391 --EXPORT_SYMBOL(wrmsr_safe_regs_on_cpu);
8392 -+EXPORT_SYMBOL(msrs_free);
8393 -diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c
8394 -index 0c9c6a9..8a95e83 100644
8395 ---- a/drivers/acpi/button.c
8396 -+++ b/drivers/acpi/button.c
8397 -@@ -282,6 +282,13 @@ static int acpi_lid_send_state(struct acpi_device *device)
8398 - if (ret == NOTIFY_DONE)
8399 - ret = blocking_notifier_call_chain(&acpi_lid_notifier, state,
8400 - device);
8401 -+ if (ret == NOTIFY_DONE || ret == NOTIFY_OK) {
8402 -+ /*
8403 -+ * It is also regarded as success if the notifier_chain
8404 -+ * returns NOTIFY_OK or NOTIFY_DONE.
8405 -+ */
8406 -+ ret = 0;
8407 -+ }
8408 - return ret;
8409 - }
8410 -
8411 -diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
8412 -index baef28c..7511029 100644
8413 ---- a/drivers/acpi/ec.c
8414 -+++ b/drivers/acpi/ec.c
8415 -@@ -916,6 +916,7 @@ static int ec_validate_ecdt(const struct dmi_system_id *id)
8416 - /* MSI EC needs special treatment, enable it */
8417 - static int ec_flag_msi(const struct dmi_system_id *id)
8418 - {
8419 -+ printk(KERN_DEBUG PREFIX "Detected MSI hardware, enabling workarounds.\n");
8420 - EC_FLAGS_MSI = 1;
8421 - EC_FLAGS_VALIDATE_ECDT = 1;
8422 - return 0;
8423 -@@ -928,8 +929,13 @@ static struct dmi_system_id __initdata ec_dmi_table[] = {
8424 - DMI_MATCH(DMI_BOARD_NAME, "JFL92") }, NULL},
8425 - {
8426 - ec_flag_msi, "MSI hardware", {
8427 -- DMI_MATCH(DMI_BIOS_VENDOR, "Micro-Star"),
8428 -- DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-Star") }, NULL},
8429 -+ DMI_MATCH(DMI_BIOS_VENDOR, "Micro-Star")}, NULL},
8430 -+ {
8431 -+ ec_flag_msi, "MSI hardware", {
8432 -+ DMI_MATCH(DMI_SYS_VENDOR, "Micro-Star")}, NULL},
8433 -+ {
8434 -+ ec_flag_msi, "MSI hardware", {
8435 -+ DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-Star")}, NULL},
8436 - {
8437 - ec_validate_ecdt, "ASUS hardware", {
8438 - DMI_MATCH(DMI_BIOS_VENDOR, "ASUS") }, NULL},
8439 -diff --git a/drivers/ata/pata_cmd64x.c b/drivers/ata/pata_cmd64x.c
8440 -index f98dffe..f0bad9b 100644
8441 ---- a/drivers/ata/pata_cmd64x.c
8442 -+++ b/drivers/ata/pata_cmd64x.c
8443 -@@ -219,7 +219,7 @@ static void cmd64x_set_dmamode(struct ata_port *ap, struct ata_device *adev)
8444 - regU |= udma_data[adev->dma_mode - XFER_UDMA_0] << shift;
8445 - /* Merge the control bits */
8446 - regU |= 1 << adev->devno; /* UDMA on */
8447 -- if (adev->dma_mode > 2) /* 15nS timing */
8448 -+ if (adev->dma_mode > XFER_UDMA_2) /* 15nS timing */
8449 - regU |= 4 << adev->devno;
8450 - } else {
8451 - regU &= ~ (1 << adev->devno); /* UDMA off */
8452 -diff --git a/drivers/ata/pata_hpt3x2n.c b/drivers/ata/pata_hpt3x2n.c
8453 -index 21c5bd6..d16e87e 100644
8454 ---- a/drivers/ata/pata_hpt3x2n.c
8455 -+++ b/drivers/ata/pata_hpt3x2n.c
8456 -@@ -8,7 +8,7 @@
8457 - * Copyright (C) 1999-2003 Andre Hedrick <andre@×××××××××.org>
8458 - * Portions Copyright (C) 2001 Sun Microsystems, Inc.
8459 - * Portions Copyright (C) 2003 Red Hat Inc
8460 -- * Portions Copyright (C) 2005-2007 MontaVista Software, Inc.
8461 -+ * Portions Copyright (C) 2005-2009 MontaVista Software, Inc.
8462 - *
8463 - *
8464 - * TODO
8465 -@@ -25,7 +25,7 @@
8466 - #include <linux/libata.h>
8467 -
8468 - #define DRV_NAME "pata_hpt3x2n"
8469 --#define DRV_VERSION "0.3.7"
8470 -+#define DRV_VERSION "0.3.8"
8471 -
8472 - enum {
8473 - HPT_PCI_FAST = (1 << 31),
8474 -@@ -262,7 +262,7 @@ static void hpt3x2n_bmdma_stop(struct ata_queued_cmd *qc)
8475 -
8476 - static void hpt3x2n_set_clock(struct ata_port *ap, int source)
8477 - {
8478 -- void __iomem *bmdma = ap->ioaddr.bmdma_addr;
8479 -+ void __iomem *bmdma = ap->ioaddr.bmdma_addr - ap->port_no * 8;
8480 -
8481 - /* Tristate the bus */
8482 - iowrite8(0x80, bmdma+0x73);
8483 -@@ -272,9 +272,9 @@ static void hpt3x2n_set_clock(struct ata_port *ap, int source)
8484 - iowrite8(source, bmdma+0x7B);
8485 - iowrite8(0xC0, bmdma+0x79);
8486 -
8487 -- /* Reset state machines */
8488 -- iowrite8(0x37, bmdma+0x70);
8489 -- iowrite8(0x37, bmdma+0x74);
8490 -+ /* Reset state machines, avoid enabling the disabled channels */
8491 -+ iowrite8(ioread8(bmdma+0x70) | 0x32, bmdma+0x70);
8492 -+ iowrite8(ioread8(bmdma+0x74) | 0x32, bmdma+0x74);
8493 -
8494 - /* Complete reset */
8495 - iowrite8(0x00, bmdma+0x79);
8496 -@@ -284,21 +284,10 @@ static void hpt3x2n_set_clock(struct ata_port *ap, int source)
8497 - iowrite8(0x00, bmdma+0x77);
8498 - }
8499 -
8500 --/* Check if our partner interface is busy */
8501 --
8502 --static int hpt3x2n_pair_idle(struct ata_port *ap)
8503 --{
8504 -- struct ata_host *host = ap->host;
8505 -- struct ata_port *pair = host->ports[ap->port_no ^ 1];
8506 --
8507 -- if (pair->hsm_task_state == HSM_ST_IDLE)
8508 -- return 1;
8509 -- return 0;
8510 --}
8511 --
8512 - static int hpt3x2n_use_dpll(struct ata_port *ap, int writing)
8513 - {
8514 - long flags = (long)ap->host->private_data;
8515 -+
8516 - /* See if we should use the DPLL */
8517 - if (writing)
8518 - return USE_DPLL; /* Needed for write */
8519 -@@ -307,20 +296,35 @@ static int hpt3x2n_use_dpll(struct ata_port *ap, int writing)
8520 - return 0;
8521 - }
8522 -
8523 -+static int hpt3x2n_qc_defer(struct ata_queued_cmd *qc)
8524 -+{
8525 -+ struct ata_port *ap = qc->ap;
8526 -+ struct ata_port *alt = ap->host->ports[ap->port_no ^ 1];
8527 -+ int rc, flags = (long)ap->host->private_data;
8528 -+ int dpll = hpt3x2n_use_dpll(ap, qc->tf.flags & ATA_TFLAG_WRITE);
8529 -+
8530 -+ /* First apply the usual rules */
8531 -+ rc = ata_std_qc_defer(qc);
8532 -+ if (rc != 0)
8533 -+ return rc;
8534 -+
8535 -+ if ((flags & USE_DPLL) != dpll && alt->qc_active)
8536 -+ return ATA_DEFER_PORT;
8537 -+ return 0;
8538 -+}
8539 -+
8540 - static unsigned int hpt3x2n_qc_issue(struct ata_queued_cmd *qc)
8541 - {
8542 -- struct ata_taskfile *tf = &qc->tf;
8543 - struct ata_port *ap = qc->ap;
8544 - int flags = (long)ap->host->private_data;
8545 -+ int dpll = hpt3x2n_use_dpll(ap, qc->tf.flags & ATA_TFLAG_WRITE);
8546 -
8547 -- if (hpt3x2n_pair_idle(ap)) {
8548 -- int dpll = hpt3x2n_use_dpll(ap, (tf->flags & ATA_TFLAG_WRITE));
8549 -- if ((flags & USE_DPLL) != dpll) {
8550 -- if (dpll == 1)
8551 -- hpt3x2n_set_clock(ap, 0x21);
8552 -- else
8553 -- hpt3x2n_set_clock(ap, 0x23);
8554 -- }
8555 -+ if ((flags & USE_DPLL) != dpll) {
8556 -+ flags &= ~USE_DPLL;
8557 -+ flags |= dpll;
8558 -+ ap->host->private_data = (void *)(long)flags;
8559 -+
8560 -+ hpt3x2n_set_clock(ap, dpll ? 0x21 : 0x23);
8561 - }
8562 - return ata_sff_qc_issue(qc);
8563 - }
8564 -@@ -337,6 +341,8 @@ static struct ata_port_operations hpt3x2n_port_ops = {
8565 - .inherits = &ata_bmdma_port_ops,
8566 -
8567 - .bmdma_stop = hpt3x2n_bmdma_stop,
8568 -+
8569 -+ .qc_defer = hpt3x2n_qc_defer,
8570 - .qc_issue = hpt3x2n_qc_issue,
8571 -
8572 - .cable_detect = hpt3x2n_cable_detect,
8573 -@@ -454,7 +460,7 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id)
8574 - unsigned int f_low, f_high;
8575 - int adjust;
8576 - unsigned long iobase = pci_resource_start(dev, 4);
8577 -- void *hpriv = NULL;
8578 -+ void *hpriv = (void *)USE_DPLL;
8579 - int rc;
8580 -
8581 - rc = pcim_enable_device(dev);
8582 -@@ -542,7 +548,7 @@ static int hpt3x2n_init_one(struct pci_dev *dev, const struct pci_device_id *id)
8583 - /* Set our private data up. We only need a few flags so we use
8584 - it directly */
8585 - if (pci_mhz > 60) {
8586 -- hpriv = (void *)PCI66;
8587 -+ hpriv = (void *)(PCI66 | USE_DPLL);
8588 - /*
8589 - * On HPT371N, if ATA clock is 66 MHz we must set bit 2 in
8590 - * the MISC. register to stretch the UltraDMA Tss timing.
8591 -diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
8592 -index 44bc8bb..1be7631 100644
8593 ---- a/drivers/bluetooth/btusb.c
8594 -+++ b/drivers/bluetooth/btusb.c
8595 -@@ -307,6 +307,7 @@ static void btusb_bulk_complete(struct urb *urb)
8596 - return;
8597 -
8598 - usb_anchor_urb(urb, &data->bulk_anchor);
8599 -+ usb_mark_last_busy(data->udev);
8600 -
8601 - err = usb_submit_urb(urb, GFP_ATOMIC);
8602 - if (err < 0) {
8603 -diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
8604 -index 7585c41..c558fa1 100644
8605 ---- a/drivers/dma/at_hdmac.c
8606 -+++ b/drivers/dma/at_hdmac.c
8607 -@@ -815,7 +815,7 @@ atc_is_tx_complete(struct dma_chan *chan,
8608 - dev_vdbg(chan2dev(chan), "is_tx_complete: %d (d%d, u%d)\n",
8609 - cookie, done ? *done : 0, used ? *used : 0);
8610 -
8611 -- spin_lock_bh(atchan->lock);
8612 -+ spin_lock_bh(&atchan->lock);
8613 -
8614 - last_complete = atchan->completed_cookie;
8615 - last_used = chan->cookie;
8616 -@@ -830,7 +830,7 @@ atc_is_tx_complete(struct dma_chan *chan,
8617 - ret = dma_async_is_complete(cookie, last_complete, last_used);
8618 - }
8619 -
8620 -- spin_unlock_bh(atchan->lock);
8621 -+ spin_unlock_bh(&atchan->lock);
8622 -
8623 - if (done)
8624 - *done = last_complete;
8625 -diff --git a/drivers/dma/ioat/dma.c b/drivers/dma/ioat/dma.c
8626 -index c524d36..dcc4ab7 100644
8627 ---- a/drivers/dma/ioat/dma.c
8628 -+++ b/drivers/dma/ioat/dma.c
8629 -@@ -1032,7 +1032,7 @@ int __devinit ioat_probe(struct ioatdma_device *device)
8630 - dma->dev = &pdev->dev;
8631 -
8632 - if (!dma->chancnt) {
8633 -- dev_err(dev, "zero channels detected\n");
8634 -+ dev_err(dev, "channel enumeration error\n");
8635 - goto err_setup_interrupts;
8636 - }
8637 -
8638 -diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h
8639 -index 45edde9..bbc3e78 100644
8640 ---- a/drivers/dma/ioat/dma.h
8641 -+++ b/drivers/dma/ioat/dma.h
8642 -@@ -60,6 +60,7 @@
8643 - * @dca: direct cache access context
8644 - * @intr_quirk: interrupt setup quirk (for ioat_v1 devices)
8645 - * @enumerate_channels: hw version specific channel enumeration
8646 -+ * @reset_hw: hw version specific channel (re)initialization
8647 - * @cleanup_tasklet: select between the v2 and v3 cleanup routines
8648 - * @timer_fn: select between the v2 and v3 timer watchdog routines
8649 - * @self_test: hardware version specific self test for each supported op type
8650 -@@ -78,6 +79,7 @@ struct ioatdma_device {
8651 - struct dca_provider *dca;
8652 - void (*intr_quirk)(struct ioatdma_device *device);
8653 - int (*enumerate_channels)(struct ioatdma_device *device);
8654 -+ int (*reset_hw)(struct ioat_chan_common *chan);
8655 - void (*cleanup_tasklet)(unsigned long data);
8656 - void (*timer_fn)(unsigned long data);
8657 - int (*self_test)(struct ioatdma_device *device);
8658 -@@ -264,6 +266,22 @@ static inline void ioat_suspend(struct ioat_chan_common *chan)
8659 - writeb(IOAT_CHANCMD_SUSPEND, chan->reg_base + IOAT_CHANCMD_OFFSET(ver));
8660 - }
8661 -
8662 -+static inline void ioat_reset(struct ioat_chan_common *chan)
8663 -+{
8664 -+ u8 ver = chan->device->version;
8665 -+
8666 -+ writeb(IOAT_CHANCMD_RESET, chan->reg_base + IOAT_CHANCMD_OFFSET(ver));
8667 -+}
8668 -+
8669 -+static inline bool ioat_reset_pending(struct ioat_chan_common *chan)
8670 -+{
8671 -+ u8 ver = chan->device->version;
8672 -+ u8 cmd;
8673 -+
8674 -+ cmd = readb(chan->reg_base + IOAT_CHANCMD_OFFSET(ver));
8675 -+ return (cmd & IOAT_CHANCMD_RESET) == IOAT_CHANCMD_RESET;
8676 -+}
8677 -+
8678 - static inline void ioat_set_chainaddr(struct ioat_dma_chan *ioat, u64 addr)
8679 - {
8680 - struct ioat_chan_common *chan = &ioat->base;
8681 -diff --git a/drivers/dma/ioat/dma_v2.c b/drivers/dma/ioat/dma_v2.c
8682 -index 8f1f7f0..5f7a500 100644
8683 ---- a/drivers/dma/ioat/dma_v2.c
8684 -+++ b/drivers/dma/ioat/dma_v2.c
8685 -@@ -239,20 +239,50 @@ void __ioat2_restart_chan(struct ioat2_dma_chan *ioat)
8686 - __ioat2_start_null_desc(ioat);
8687 - }
8688 -
8689 --static void ioat2_restart_channel(struct ioat2_dma_chan *ioat)
8690 -+int ioat2_quiesce(struct ioat_chan_common *chan, unsigned long tmo)
8691 - {
8692 -- struct ioat_chan_common *chan = &ioat->base;
8693 -- unsigned long phys_complete;
8694 -+ unsigned long end = jiffies + tmo;
8695 -+ int err = 0;
8696 - u32 status;
8697 -
8698 - status = ioat_chansts(chan);
8699 - if (is_ioat_active(status) || is_ioat_idle(status))
8700 - ioat_suspend(chan);
8701 - while (is_ioat_active(status) || is_ioat_idle(status)) {
8702 -+ if (end && time_after(jiffies, end)) {
8703 -+ err = -ETIMEDOUT;
8704 -+ break;
8705 -+ }
8706 - status = ioat_chansts(chan);
8707 - cpu_relax();
8708 - }
8709 -
8710 -+ return err;
8711 -+}
8712 -+
8713 -+int ioat2_reset_sync(struct ioat_chan_common *chan, unsigned long tmo)
8714 -+{
8715 -+ unsigned long end = jiffies + tmo;
8716 -+ int err = 0;
8717 -+
8718 -+ ioat_reset(chan);
8719 -+ while (ioat_reset_pending(chan)) {
8720 -+ if (end && time_after(jiffies, end)) {
8721 -+ err = -ETIMEDOUT;
8722 -+ break;
8723 -+ }
8724 -+ cpu_relax();
8725 -+ }
8726 -+
8727 -+ return err;
8728 -+}
8729 -+
8730 -+static void ioat2_restart_channel(struct ioat2_dma_chan *ioat)
8731 -+{
8732 -+ struct ioat_chan_common *chan = &ioat->base;
8733 -+ unsigned long phys_complete;
8734 -+
8735 -+ ioat2_quiesce(chan, 0);
8736 - if (ioat_cleanup_preamble(chan, &phys_complete))
8737 - __cleanup(ioat, phys_complete);
8738 -
8739 -@@ -318,6 +348,19 @@ void ioat2_timer_event(unsigned long data)
8740 - spin_unlock_bh(&chan->cleanup_lock);
8741 - }
8742 -
8743 -+static int ioat2_reset_hw(struct ioat_chan_common *chan)
8744 -+{
8745 -+ /* throw away whatever the channel was doing and get it initialized */
8746 -+ u32 chanerr;
8747 -+
8748 -+ ioat2_quiesce(chan, msecs_to_jiffies(100));
8749 -+
8750 -+ chanerr = readl(chan->reg_base + IOAT_CHANERR_OFFSET);
8751 -+ writel(chanerr, chan->reg_base + IOAT_CHANERR_OFFSET);
8752 -+
8753 -+ return ioat2_reset_sync(chan, msecs_to_jiffies(200));
8754 -+}
8755 -+
8756 - /**
8757 - * ioat2_enumerate_channels - find and initialize the device's channels
8758 - * @device: the device to be enumerated
8759 -@@ -360,6 +403,10 @@ int ioat2_enumerate_channels(struct ioatdma_device *device)
8760 - (unsigned long) ioat);
8761 - ioat->xfercap_log = xfercap_log;
8762 - spin_lock_init(&ioat->ring_lock);
8763 -+ if (device->reset_hw(&ioat->base)) {
8764 -+ i = 0;
8765 -+ break;
8766 -+ }
8767 - }
8768 - dma->chancnt = i;
8769 - return i;
8770 -@@ -467,7 +514,6 @@ int ioat2_alloc_chan_resources(struct dma_chan *c)
8771 - struct ioat2_dma_chan *ioat = to_ioat2_chan(c);
8772 - struct ioat_chan_common *chan = &ioat->base;
8773 - struct ioat_ring_ent **ring;
8774 -- u32 chanerr;
8775 - int order;
8776 -
8777 - /* have we already been set up? */
8778 -@@ -477,12 +523,6 @@ int ioat2_alloc_chan_resources(struct dma_chan *c)
8779 - /* Setup register to interrupt and write completion status on error */
8780 - writew(IOAT_CHANCTRL_RUN, chan->reg_base + IOAT_CHANCTRL_OFFSET);
8781 -
8782 -- chanerr = readl(chan->reg_base + IOAT_CHANERR_OFFSET);
8783 -- if (chanerr) {
8784 -- dev_err(to_dev(chan), "CHANERR = %x, clearing\n", chanerr);
8785 -- writel(chanerr, chan->reg_base + IOAT_CHANERR_OFFSET);
8786 -- }
8787 --
8788 - /* allocate a completion writeback area */
8789 - /* doing 2 32bit writes to mmio since 1 64b write doesn't work */
8790 - chan->completion = pci_pool_alloc(chan->device->completion_pool,
8791 -@@ -746,13 +786,7 @@ void ioat2_free_chan_resources(struct dma_chan *c)
8792 - tasklet_disable(&chan->cleanup_task);
8793 - del_timer_sync(&chan->timer);
8794 - device->cleanup_tasklet((unsigned long) ioat);
8795 --
8796 -- /* Delay 100ms after reset to allow internal DMA logic to quiesce
8797 -- * before removing DMA descriptor resources.
8798 -- */
8799 -- writeb(IOAT_CHANCMD_RESET,
8800 -- chan->reg_base + IOAT_CHANCMD_OFFSET(chan->device->version));
8801 -- mdelay(100);
8802 -+ device->reset_hw(chan);
8803 -
8804 - spin_lock_bh(&ioat->ring_lock);
8805 - descs = ioat2_ring_space(ioat);
8806 -@@ -839,6 +873,7 @@ int __devinit ioat2_dma_probe(struct ioatdma_device *device, int dca)
8807 - int err;
8808 -
8809 - device->enumerate_channels = ioat2_enumerate_channels;
8810 -+ device->reset_hw = ioat2_reset_hw;
8811 - device->cleanup_tasklet = ioat2_cleanup_tasklet;
8812 - device->timer_fn = ioat2_timer_event;
8813 - device->self_test = ioat_dma_self_test;
8814 -diff --git a/drivers/dma/ioat/dma_v2.h b/drivers/dma/ioat/dma_v2.h
8815 -index 1d849ef..3afad8d 100644
8816 ---- a/drivers/dma/ioat/dma_v2.h
8817 -+++ b/drivers/dma/ioat/dma_v2.h
8818 -@@ -185,6 +185,8 @@ bool reshape_ring(struct ioat2_dma_chan *ioat, int order);
8819 - void __ioat2_issue_pending(struct ioat2_dma_chan *ioat);
8820 - void ioat2_cleanup_tasklet(unsigned long data);
8821 - void ioat2_timer_event(unsigned long data);
8822 -+int ioat2_quiesce(struct ioat_chan_common *chan, unsigned long tmo);
8823 -+int ioat2_reset_sync(struct ioat_chan_common *chan, unsigned long tmo);
8824 - extern struct kobj_type ioat2_ktype;
8825 - extern struct kmem_cache *ioat2_cache;
8826 - #endif /* IOATDMA_V2_H */
8827 -diff --git a/drivers/dma/ioat/dma_v3.c b/drivers/dma/ioat/dma_v3.c
8828 -index 42f6f10..9908c9e 100644
8829 ---- a/drivers/dma/ioat/dma_v3.c
8830 -+++ b/drivers/dma/ioat/dma_v3.c
8831 -@@ -650,9 +650,11 @@ __ioat3_prep_pq_lock(struct dma_chan *c, enum sum_check_flags *result,
8832 -
8833 - num_descs = ioat2_xferlen_to_descs(ioat, len);
8834 - /* we need 2x the number of descriptors to cover greater than 3
8835 -- * sources
8836 -+ * sources (we need 1 extra source in the q-only continuation
8837 -+ * case and 3 extra sources in the p+q continuation case.
8838 - */
8839 -- if (src_cnt > 3 || flags & DMA_PREP_CONTINUE) {
8840 -+ if (src_cnt + dmaf_p_disabled_continue(flags) > 3 ||
8841 -+ (dmaf_continue(flags) && !dmaf_p_disabled_continue(flags))) {
8842 - with_ext = 1;
8843 - num_descs *= 2;
8844 - } else
8845 -@@ -1128,6 +1130,45 @@ static int __devinit ioat3_dma_self_test(struct ioatdma_device *device)
8846 - return 0;
8847 - }
8848 -
8849 -+static int ioat3_reset_hw(struct ioat_chan_common *chan)
8850 -+{
8851 -+ /* throw away whatever the channel was doing and get it
8852 -+ * initialized, with ioat3 specific workarounds
8853 -+ */
8854 -+ struct ioatdma_device *device = chan->device;
8855 -+ struct pci_dev *pdev = device->pdev;
8856 -+ u32 chanerr;
8857 -+ u16 dev_id;
8858 -+ int err;
8859 -+
8860 -+ ioat2_quiesce(chan, msecs_to_jiffies(100));
8861 -+
8862 -+ chanerr = readl(chan->reg_base + IOAT_CHANERR_OFFSET);
8863 -+ writel(chanerr, chan->reg_base + IOAT_CHANERR_OFFSET);
8864 -+
8865 -+ /* -= IOAT ver.3 workarounds =- */
8866 -+ /* Write CHANERRMSK_INT with 3E07h to mask out the errors
8867 -+ * that can cause stability issues for IOAT ver.3, and clear any
8868 -+ * pending errors
8869 -+ */
8870 -+ pci_write_config_dword(pdev, IOAT_PCI_CHANERRMASK_INT_OFFSET, 0x3e07);
8871 -+ err = pci_read_config_dword(pdev, IOAT_PCI_CHANERR_INT_OFFSET, &chanerr);
8872 -+ if (err) {
8873 -+ dev_err(&pdev->dev, "channel error register unreachable\n");
8874 -+ return err;
8875 -+ }
8876 -+ pci_write_config_dword(pdev, IOAT_PCI_CHANERR_INT_OFFSET, chanerr);
8877 -+
8878 -+ /* Clear DMAUNCERRSTS Cfg-Reg Parity Error status bit
8879 -+ * (workaround for spurious config parity error after restart)
8880 -+ */
8881 -+ pci_read_config_word(pdev, IOAT_PCI_DEVICE_ID_OFFSET, &dev_id);
8882 -+ if (dev_id == PCI_DEVICE_ID_INTEL_IOAT_TBG0)
8883 -+ pci_write_config_dword(pdev, IOAT_PCI_DMAUNCERRSTS_OFFSET, 0x10);
8884 -+
8885 -+ return ioat2_reset_sync(chan, msecs_to_jiffies(200));
8886 -+}
8887 -+
8888 - int __devinit ioat3_dma_probe(struct ioatdma_device *device, int dca)
8889 - {
8890 - struct pci_dev *pdev = device->pdev;
8891 -@@ -1137,10 +1178,10 @@ int __devinit ioat3_dma_probe(struct ioatdma_device *device, int dca)
8892 - struct ioat_chan_common *chan;
8893 - bool is_raid_device = false;
8894 - int err;
8895 -- u16 dev_id;
8896 - u32 cap;
8897 -
8898 - device->enumerate_channels = ioat2_enumerate_channels;
8899 -+ device->reset_hw = ioat3_reset_hw;
8900 - device->self_test = ioat3_dma_self_test;
8901 - dma = &device->common;
8902 - dma->device_prep_dma_memcpy = ioat2_dma_prep_memcpy_lock;
8903 -@@ -1216,19 +1257,6 @@ int __devinit ioat3_dma_probe(struct ioatdma_device *device, int dca)
8904 - dma->device_prep_dma_xor_val = NULL;
8905 - #endif
8906 -
8907 -- /* -= IOAT ver.3 workarounds =- */
8908 -- /* Write CHANERRMSK_INT with 3E07h to mask out the errors
8909 -- * that can cause stability issues for IOAT ver.3
8910 -- */
8911 -- pci_write_config_dword(pdev, IOAT_PCI_CHANERRMASK_INT_OFFSET, 0x3e07);
8912 --
8913 -- /* Clear DMAUNCERRSTS Cfg-Reg Parity Error status bit
8914 -- * (workaround for spurious config parity error after restart)
8915 -- */
8916 -- pci_read_config_word(pdev, IOAT_PCI_DEVICE_ID_OFFSET, &dev_id);
8917 -- if (dev_id == PCI_DEVICE_ID_INTEL_IOAT_TBG0)
8918 -- pci_write_config_dword(pdev, IOAT_PCI_DMAUNCERRSTS_OFFSET, 0x10);
8919 --
8920 - err = ioat_probe(device);
8921 - if (err)
8922 - return err;
8923 -diff --git a/drivers/dma/ioat/registers.h b/drivers/dma/ioat/registers.h
8924 -index f015ec1..e8ae63b 100644
8925 ---- a/drivers/dma/ioat/registers.h
8926 -+++ b/drivers/dma/ioat/registers.h
8927 -@@ -27,6 +27,7 @@
8928 -
8929 - #define IOAT_PCI_DEVICE_ID_OFFSET 0x02
8930 - #define IOAT_PCI_DMAUNCERRSTS_OFFSET 0x148
8931 -+#define IOAT_PCI_CHANERR_INT_OFFSET 0x180
8932 - #define IOAT_PCI_CHANERRMASK_INT_OFFSET 0x184
8933 -
8934 - /* MMIO Device Registers */
8935 -diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
8936 -index a38831c..a0bcfba 100644
8937 ---- a/drivers/edac/amd64_edac.c
8938 -+++ b/drivers/edac/amd64_edac.c
8939 -@@ -13,6 +13,8 @@ module_param(report_gart_errors, int, 0644);
8940 - static int ecc_enable_override;
8941 - module_param(ecc_enable_override, int, 0644);
8942 -
8943 -+static struct msr *msrs;
8944 -+
8945 - /* Lookup table for all possible MC control instances */
8946 - struct amd64_pvt;
8947 - static struct mem_ctl_info *mci_lookup[EDAC_MAX_NUMNODES];
8948 -@@ -2618,6 +2620,90 @@ static int amd64_init_csrows(struct mem_ctl_info *mci)
8949 - return empty;
8950 - }
8951 -
8952 -+/* get all cores on this DCT */
8953 -+static void get_cpus_on_this_dct_cpumask(struct cpumask *mask, int nid)
8954 -+{
8955 -+ int cpu;
8956 -+
8957 -+ for_each_online_cpu(cpu)
8958 -+ if (amd_get_nb_id(cpu) == nid)
8959 -+ cpumask_set_cpu(cpu, mask);
8960 -+}
8961 -+
8962 -+/* check MCG_CTL on all the cpus on this node */
8963 -+static bool amd64_nb_mce_bank_enabled_on_node(int nid)
8964 -+{
8965 -+ cpumask_var_t mask;
8966 -+ int cpu, nbe;
8967 -+ bool ret = false;
8968 -+
8969 -+ if (!zalloc_cpumask_var(&mask, GFP_KERNEL)) {
8970 -+ amd64_printk(KERN_WARNING, "%s: error allocating mask\n",
8971 -+ __func__);
8972 -+ return false;
8973 -+ }
8974 -+
8975 -+ get_cpus_on_this_dct_cpumask(mask, nid);
8976 -+
8977 -+ rdmsr_on_cpus(mask, MSR_IA32_MCG_CTL, msrs);
8978 -+
8979 -+ for_each_cpu(cpu, mask) {
8980 -+ struct msr *reg = per_cpu_ptr(msrs, cpu);
8981 -+ nbe = reg->l & K8_MSR_MCGCTL_NBE;
8982 -+
8983 -+ debugf0("core: %u, MCG_CTL: 0x%llx, NB MSR is %s\n",
8984 -+ cpu, reg->q,
8985 -+ (nbe ? "enabled" : "disabled"));
8986 -+
8987 -+ if (!nbe)
8988 -+ goto out;
8989 -+ }
8990 -+ ret = true;
8991 -+
8992 -+out:
8993 -+ free_cpumask_var(mask);
8994 -+ return ret;
8995 -+}
8996 -+
8997 -+static int amd64_toggle_ecc_err_reporting(struct amd64_pvt *pvt, bool on)
8998 -+{
8999 -+ cpumask_var_t cmask;
9000 -+ int cpu;
9001 -+
9002 -+ if (!zalloc_cpumask_var(&cmask, GFP_KERNEL)) {
9003 -+ amd64_printk(KERN_WARNING, "%s: error allocating mask\n",
9004 -+ __func__);
9005 -+ return false;
9006 -+ }
9007 -+
9008 -+ get_cpus_on_this_dct_cpumask(cmask, pvt->mc_node_id);
9009 -+
9010 -+ rdmsr_on_cpus(cmask, MSR_IA32_MCG_CTL, msrs);
9011 -+
9012 -+ for_each_cpu(cpu, cmask) {
9013 -+
9014 -+ struct msr *reg = per_cpu_ptr(msrs, cpu);
9015 -+
9016 -+ if (on) {
9017 -+ if (reg->l & K8_MSR_MCGCTL_NBE)
9018 -+ pvt->flags.ecc_report = 1;
9019 -+
9020 -+ reg->l |= K8_MSR_MCGCTL_NBE;
9021 -+ } else {
9022 -+ /*
9023 -+ * Turn off ECC reporting only when it was off before
9024 -+ */
9025 -+ if (!pvt->flags.ecc_report)
9026 -+ reg->l &= ~K8_MSR_MCGCTL_NBE;
9027 -+ }
9028 -+ }
9029 -+ wrmsr_on_cpus(cmask, MSR_IA32_MCG_CTL, msrs);
9030 -+
9031 -+ free_cpumask_var(cmask);
9032 -+
9033 -+ return 0;
9034 -+}
9035 -+
9036 - /*
9037 - * Only if 'ecc_enable_override' is set AND BIOS had ECC disabled, do "we"
9038 - * enable it.
9039 -@@ -2625,17 +2711,12 @@ static int amd64_init_csrows(struct mem_ctl_info *mci)
9040 - static void amd64_enable_ecc_error_reporting(struct mem_ctl_info *mci)
9041 - {
9042 - struct amd64_pvt *pvt = mci->pvt_info;
9043 -- const cpumask_t *cpumask = cpumask_of_node(pvt->mc_node_id);
9044 -- int cpu, idx = 0, err = 0;
9045 -- struct msr msrs[cpumask_weight(cpumask)];
9046 -- u32 value;
9047 -- u32 mask = K8_NBCTL_CECCEn | K8_NBCTL_UECCEn;
9048 -+ int err = 0;
9049 -+ u32 value, mask = K8_NBCTL_CECCEn | K8_NBCTL_UECCEn;
9050 -
9051 - if (!ecc_enable_override)
9052 - return;
9053 -
9054 -- memset(msrs, 0, sizeof(msrs));
9055 --
9056 - amd64_printk(KERN_WARNING,
9057 - "'ecc_enable_override' parameter is active, "
9058 - "Enabling AMD ECC hardware now: CAUTION\n");
9059 -@@ -2651,16 +2732,9 @@ static void amd64_enable_ecc_error_reporting(struct mem_ctl_info *mci)
9060 - value |= mask;
9061 - pci_write_config_dword(pvt->misc_f3_ctl, K8_NBCTL, value);
9062 -
9063 -- rdmsr_on_cpus(cpumask, K8_MSR_MCGCTL, msrs);
9064 --
9065 -- for_each_cpu(cpu, cpumask) {
9066 -- if (msrs[idx].l & K8_MSR_MCGCTL_NBE)
9067 -- set_bit(idx, &pvt->old_mcgctl);
9068 --
9069 -- msrs[idx].l |= K8_MSR_MCGCTL_NBE;
9070 -- idx++;
9071 -- }
9072 -- wrmsr_on_cpus(cpumask, K8_MSR_MCGCTL, msrs);
9073 -+ if (amd64_toggle_ecc_err_reporting(pvt, ON))
9074 -+ amd64_printk(KERN_WARNING, "Error enabling ECC reporting over "
9075 -+ "MCGCTL!\n");
9076 -
9077 - err = pci_read_config_dword(pvt->misc_f3_ctl, K8_NBCFG, &value);
9078 - if (err)
9079 -@@ -2701,17 +2775,12 @@ static void amd64_enable_ecc_error_reporting(struct mem_ctl_info *mci)
9080 -
9081 - static void amd64_restore_ecc_error_reporting(struct amd64_pvt *pvt)
9082 - {
9083 -- const cpumask_t *cpumask = cpumask_of_node(pvt->mc_node_id);
9084 -- int cpu, idx = 0, err = 0;
9085 -- struct msr msrs[cpumask_weight(cpumask)];
9086 -- u32 value;
9087 -- u32 mask = K8_NBCTL_CECCEn | K8_NBCTL_UECCEn;
9088 -+ int err = 0;
9089 -+ u32 value, mask = K8_NBCTL_CECCEn | K8_NBCTL_UECCEn;
9090 -
9091 - if (!pvt->nbctl_mcgctl_saved)
9092 - return;
9093 -
9094 -- memset(msrs, 0, sizeof(msrs));
9095 --
9096 - err = pci_read_config_dword(pvt->misc_f3_ctl, K8_NBCTL, &value);
9097 - if (err)
9098 - debugf0("Reading K8_NBCTL failed\n");
9099 -@@ -2721,66 +2790,9 @@ static void amd64_restore_ecc_error_reporting(struct amd64_pvt *pvt)
9100 - /* restore the NB Enable MCGCTL bit */
9101 - pci_write_config_dword(pvt->misc_f3_ctl, K8_NBCTL, value);
9102 -
9103 -- rdmsr_on_cpus(cpumask, K8_MSR_MCGCTL, msrs);
9104 --
9105 -- for_each_cpu(cpu, cpumask) {
9106 -- msrs[idx].l &= ~K8_MSR_MCGCTL_NBE;
9107 -- msrs[idx].l |=
9108 -- test_bit(idx, &pvt->old_mcgctl) << K8_MSR_MCGCTL_NBE;
9109 -- idx++;
9110 -- }
9111 --
9112 -- wrmsr_on_cpus(cpumask, K8_MSR_MCGCTL, msrs);
9113 --}
9114 --
9115 --/* get all cores on this DCT */
9116 --static void get_cpus_on_this_dct_cpumask(cpumask_t *mask, int nid)
9117 --{
9118 -- int cpu;
9119 --
9120 -- for_each_online_cpu(cpu)
9121 -- if (amd_get_nb_id(cpu) == nid)
9122 -- cpumask_set_cpu(cpu, mask);
9123 --}
9124 --
9125 --/* check MCG_CTL on all the cpus on this node */
9126 --static bool amd64_nb_mce_bank_enabled_on_node(int nid)
9127 --{
9128 -- cpumask_t mask;
9129 -- struct msr *msrs;
9130 -- int cpu, nbe, idx = 0;
9131 -- bool ret = false;
9132 --
9133 -- cpumask_clear(&mask);
9134 --
9135 -- get_cpus_on_this_dct_cpumask(&mask, nid);
9136 --
9137 -- msrs = kzalloc(sizeof(struct msr) * cpumask_weight(&mask), GFP_KERNEL);
9138 -- if (!msrs) {
9139 -- amd64_printk(KERN_WARNING, "%s: error allocating msrs\n",
9140 -- __func__);
9141 -- return false;
9142 -- }
9143 --
9144 -- rdmsr_on_cpus(&mask, MSR_IA32_MCG_CTL, msrs);
9145 --
9146 -- for_each_cpu(cpu, &mask) {
9147 -- nbe = msrs[idx].l & K8_MSR_MCGCTL_NBE;
9148 --
9149 -- debugf0("core: %u, MCG_CTL: 0x%llx, NB MSR is %s\n",
9150 -- cpu, msrs[idx].q,
9151 -- (nbe ? "enabled" : "disabled"));
9152 --
9153 -- if (!nbe)
9154 -- goto out;
9155 --
9156 -- idx++;
9157 -- }
9158 -- ret = true;
9159 --
9160 --out:
9161 -- kfree(msrs);
9162 -- return ret;
9163 -+ if (amd64_toggle_ecc_err_reporting(pvt, OFF))
9164 -+ amd64_printk(KERN_WARNING, "Error restoring ECC reporting over "
9165 -+ "MCGCTL!\n");
9166 - }
9167 -
9168 - /*
9169 -@@ -2824,9 +2836,8 @@ static int amd64_check_ecc_enabled(struct amd64_pvt *pvt)
9170 - amd64_printk(KERN_WARNING, "%s", ecc_warning);
9171 - return -ENODEV;
9172 - }
9173 -- } else
9174 -- /* CLEAR the override, since BIOS controlled it */
9175 - ecc_enable_override = 0;
9176 -+ }
9177 -
9178 - return 0;
9179 - }
9180 -@@ -2909,7 +2920,6 @@ static int amd64_probe_one_instance(struct pci_dev *dram_f2_ctl,
9181 - pvt->ext_model = boot_cpu_data.x86_model >> 4;
9182 - pvt->mc_type_index = mc_type_index;
9183 - pvt->ops = family_ops(mc_type_index);
9184 -- pvt->old_mcgctl = 0;
9185 -
9186 - /*
9187 - * We have the dram_f2_ctl device as an argument, now go reserve its
9188 -@@ -3071,16 +3081,15 @@ static void __devexit amd64_remove_one_instance(struct pci_dev *pdev)
9189 -
9190 - amd64_free_mc_sibling_devices(pvt);
9191 -
9192 -- kfree(pvt);
9193 -- mci->pvt_info = NULL;
9194 --
9195 -- mci_lookup[pvt->mc_node_id] = NULL;
9196 --
9197 - /* unregister from EDAC MCE */
9198 - amd_report_gart_errors(false);
9199 - amd_unregister_ecc_decoder(amd64_decode_bus_error);
9200 -
9201 - /* Free the EDAC CORE resources */
9202 -+ mci->pvt_info = NULL;
9203 -+ mci_lookup[pvt->mc_node_id] = NULL;
9204 -+
9205 -+ kfree(pvt);
9206 - edac_mc_free(mci);
9207 - }
9208 -
9209 -@@ -3157,23 +3166,29 @@ static void amd64_setup_pci_device(void)
9210 - static int __init amd64_edac_init(void)
9211 - {
9212 - int nb, err = -ENODEV;
9213 -+ bool load_ok = false;
9214 -
9215 - edac_printk(KERN_INFO, EDAC_MOD_STR, EDAC_AMD64_VERSION "\n");
9216 -
9217 - opstate_init();
9218 -
9219 - if (cache_k8_northbridges() < 0)
9220 -- return err;
9221 -+ goto err_ret;
9222 -+
9223 -+ msrs = msrs_alloc();
9224 -+ if (!msrs)
9225 -+ goto err_ret;
9226 -
9227 - err = pci_register_driver(&amd64_pci_driver);
9228 - if (err)
9229 -- return err;
9230 -+ goto err_pci;
9231 -
9232 - /*
9233 - * At this point, the array 'pvt_lookup[]' contains pointers to alloc'd
9234 - * amd64_pvt structs. These will be used in the 2nd stage init function
9235 - * to finish initialization of the MC instances.
9236 - */
9237 -+ err = -ENODEV;
9238 - for (nb = 0; nb < num_k8_northbridges; nb++) {
9239 - if (!pvt_lookup[nb])
9240 - continue;
9241 -@@ -3181,16 +3196,21 @@ static int __init amd64_edac_init(void)
9242 - err = amd64_init_2nd_stage(pvt_lookup[nb]);
9243 - if (err)
9244 - goto err_2nd_stage;
9245 -- }
9246 -
9247 -- amd64_setup_pci_device();
9248 -+ load_ok = true;
9249 -+ }
9250 -
9251 -- return 0;
9252 -+ if (load_ok) {
9253 -+ amd64_setup_pci_device();
9254 -+ return 0;
9255 -+ }
9256 -
9257 - err_2nd_stage:
9258 -- debugf0("2nd stage failed\n");
9259 - pci_unregister_driver(&amd64_pci_driver);
9260 --
9261 -+err_pci:
9262 -+ msrs_free(msrs);
9263 -+ msrs = NULL;
9264 -+err_ret:
9265 - return err;
9266 - }
9267 -
9268 -@@ -3200,6 +3220,9 @@ static void __exit amd64_edac_exit(void)
9269 - edac_pci_release_generic_ctl(amd64_ctl_pci);
9270 -
9271 - pci_unregister_driver(&amd64_pci_driver);
9272 -+
9273 -+ msrs_free(msrs);
9274 -+ msrs = NULL;
9275 - }
9276 -
9277 - module_init(amd64_edac_init);
9278 -diff --git a/drivers/edac/amd64_edac.h b/drivers/edac/amd64_edac.h
9279 -index c6f359a..bba6c94 100644
9280 ---- a/drivers/edac/amd64_edac.h
9281 -+++ b/drivers/edac/amd64_edac.h
9282 -@@ -147,6 +147,8 @@
9283 - #define MAX_CS_COUNT 8
9284 - #define DRAM_REG_COUNT 8
9285 -
9286 -+#define ON true
9287 -+#define OFF false
9288 -
9289 - /*
9290 - * PCI-defined configuration space registers
9291 -@@ -386,10 +388,7 @@ enum {
9292 - #define K8_NBCAP_DUAL_NODE BIT(1)
9293 - #define K8_NBCAP_DCT_DUAL BIT(0)
9294 -
9295 --/*
9296 -- * MSR Regs
9297 -- */
9298 --#define K8_MSR_MCGCTL 0x017b
9299 -+/* MSRs */
9300 - #define K8_MSR_MCGCTL_NBE BIT(4)
9301 -
9302 - #define K8_MSR_MC4CTL 0x0410
9303 -@@ -487,7 +486,6 @@ struct amd64_pvt {
9304 - /* Save old hw registers' values before we modified them */
9305 - u32 nbctl_mcgctl_saved; /* When true, following 2 are valid */
9306 - u32 old_nbctl;
9307 -- unsigned long old_mcgctl; /* per core on this node */
9308 -
9309 - /* MC Type Index value: socket F vs Family 10h */
9310 - u32 mc_type_index;
9311 -@@ -495,6 +493,7 @@ struct amd64_pvt {
9312 - /* misc settings */
9313 - struct flags {
9314 - unsigned long cf8_extcfg:1;
9315 -+ unsigned long ecc_report:1;
9316 - } flags;
9317 - };
9318 -
9319 -diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
9320 -index bbfd110..afed886 100644
9321 ---- a/drivers/gpu/drm/drm_crtc_helper.c
9322 -+++ b/drivers/gpu/drm/drm_crtc_helper.c
9323 -@@ -1020,6 +1020,9 @@ bool drm_helper_initial_config(struct drm_device *dev)
9324 - {
9325 - int count = 0;
9326 -
9327 -+ /* disable all the possible outputs/crtcs before entering KMS mode */
9328 -+ drm_helper_disable_unused_functions(dev);
9329 -+
9330 - drm_fb_helper_parse_command_line(dev);
9331 -
9332 - count = drm_helper_probe_connector_modes(dev,
9333 -diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
9334 -index c6777cb..19f93f2 100644
9335 ---- a/drivers/gpu/drm/radeon/atombios_crtc.c
9336 -+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
9337 -@@ -249,13 +249,15 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode)
9338 - if (ASIC_IS_DCE3(rdev))
9339 - atombios_enable_crtc_memreq(crtc, 1);
9340 - atombios_blank_crtc(crtc, 0);
9341 -- drm_vblank_post_modeset(dev, radeon_crtc->crtc_id);
9342 -+ if (rdev->family < CHIP_R600)
9343 -+ drm_vblank_post_modeset(dev, radeon_crtc->crtc_id);
9344 - radeon_crtc_load_lut(crtc);
9345 - break;
9346 - case DRM_MODE_DPMS_STANDBY:
9347 - case DRM_MODE_DPMS_SUSPEND:
9348 - case DRM_MODE_DPMS_OFF:
9349 -- drm_vblank_pre_modeset(dev, radeon_crtc->crtc_id);
9350 -+ if (rdev->family < CHIP_R600)
9351 -+ drm_vblank_pre_modeset(dev, radeon_crtc->crtc_id);
9352 - atombios_blank_crtc(crtc, 1);
9353 - if (ASIC_IS_DCE3(rdev))
9354 - atombios_enable_crtc_memreq(crtc, 0);
9355 -diff --git a/drivers/gpu/drm/radeon/radeon_test.c b/drivers/gpu/drm/radeon/radeon_test.c
9356 -index f8a465d..c8942ca 100644
9357 ---- a/drivers/gpu/drm/radeon/radeon_test.c
9358 -+++ b/drivers/gpu/drm/radeon/radeon_test.c
9359 -@@ -42,8 +42,8 @@ void radeon_test_moves(struct radeon_device *rdev)
9360 - /* Number of tests =
9361 - * (Total GTT - IB pool - writeback page - ring buffer) / test size
9362 - */
9363 -- n = (rdev->mc.gtt_size - RADEON_IB_POOL_SIZE*64*1024 - RADEON_GPU_PAGE_SIZE -
9364 -- rdev->cp.ring_size) / size;
9365 -+ n = ((u32)(rdev->mc.gtt_size - RADEON_IB_POOL_SIZE*64*1024 - RADEON_GPU_PAGE_SIZE -
9366 -+ rdev->cp.ring_size)) / size;
9367 -
9368 - gtt_obj = kzalloc(n * sizeof(*gtt_obj), GFP_KERNEL);
9369 - if (!gtt_obj) {
9370 -diff --git a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c
9371 -index ebe38b6..864a371 100644
9372 ---- a/drivers/hwmon/sht15.c
9373 -+++ b/drivers/hwmon/sht15.c
9374 -@@ -305,7 +305,7 @@ static inline int sht15_calc_temp(struct sht15_data *data)
9375 - int d1 = 0;
9376 - int i;
9377 -
9378 -- for (i = 1; i < ARRAY_SIZE(temppoints) - 1; i++)
9379 -+ for (i = 1; i < ARRAY_SIZE(temppoints); i++)
9380 - /* Find pointer to interpolate */
9381 - if (data->supply_uV > temppoints[i - 1].vdd) {
9382 - d1 = (data->supply_uV/1000 - temppoints[i - 1].vdd)
9383 -@@ -332,12 +332,12 @@ static inline int sht15_calc_humid(struct sht15_data *data)
9384 -
9385 - const int c1 = -4;
9386 - const int c2 = 40500; /* x 10 ^ -6 */
9387 -- const int c3 = 2800; /* x10 ^ -9 */
9388 -+ const int c3 = -2800; /* x10 ^ -9 */
9389 -
9390 - RHlinear = c1*1000
9391 - + c2 * data->val_humid/1000
9392 - + (data->val_humid * data->val_humid * c3)/1000000;
9393 -- return (temp - 25000) * (10000 + 800 * data->val_humid)
9394 -+ return (temp - 25000) * (10000 + 80 * data->val_humid)
9395 - / 1000000 + RHlinear;
9396 - }
9397 -
9398 -diff --git a/drivers/lguest/segments.c b/drivers/lguest/segments.c
9399 -index 951c57b..ede4658 100644
9400 ---- a/drivers/lguest/segments.c
9401 -+++ b/drivers/lguest/segments.c
9402 -@@ -179,8 +179,10 @@ void load_guest_gdt_entry(struct lg_cpu *cpu, u32 num, u32 lo, u32 hi)
9403 - * We assume the Guest has the same number of GDT entries as the
9404 - * Host, otherwise we'd have to dynamically allocate the Guest GDT.
9405 - */
9406 -- if (num >= ARRAY_SIZE(cpu->arch.gdt))
9407 -+ if (num >= ARRAY_SIZE(cpu->arch.gdt)) {
9408 - kill_guest(cpu, "too many gdt entries %i", num);
9409 -+ return;
9410 -+ }
9411 -
9412 - /* Set it up, then fix it. */
9413 - cpu->arch.gdt[num].a = lo;
9414 -diff --git a/drivers/md/md.c b/drivers/md/md.c
9415 -index 02e4551..c6a6685 100644
9416 ---- a/drivers/md/md.c
9417 -+++ b/drivers/md/md.c
9418 -@@ -282,7 +282,9 @@ static void mddev_put(mddev_t *mddev)
9419 - if (!atomic_dec_and_lock(&mddev->active, &all_mddevs_lock))
9420 - return;
9421 - if (!mddev->raid_disks && list_empty(&mddev->disks) &&
9422 -- !mddev->hold_active) {
9423 -+ mddev->ctime == 0 && !mddev->hold_active) {
9424 -+ /* Array is not configured at all, and not held active,
9425 -+ * so destroy it */
9426 - list_del(&mddev->all_mddevs);
9427 - if (mddev->gendisk) {
9428 - /* we did a probe so need to clean up.
9429 -@@ -5071,6 +5073,10 @@ static int set_array_info(mddev_t * mddev, mdu_array_info_t *info)
9430 - mddev->minor_version = info->minor_version;
9431 - mddev->patch_version = info->patch_version;
9432 - mddev->persistent = !info->not_persistent;
9433 -+ /* ensure mddev_put doesn't delete this now that there
9434 -+ * is some minimal configuration.
9435 -+ */
9436 -+ mddev->ctime = get_seconds();
9437 - return 0;
9438 - }
9439 - mddev->major_version = MD_MAJOR_VERSION;
9440 -diff --git a/drivers/media/video/ov511.c b/drivers/media/video/ov511.c
9441 -index 0bc2cf5..2bed9e2 100644
9442 ---- a/drivers/media/video/ov511.c
9443 -+++ b/drivers/media/video/ov511.c
9444 -@@ -5878,7 +5878,7 @@ ov51x_probe(struct usb_interface *intf, const struct usb_device_id *id)
9445 - goto error;
9446 - }
9447 -
9448 -- mutex_lock(&ov->lock);
9449 -+ mutex_unlock(&ov->lock);
9450 -
9451 - return 0;
9452 -
9453 -diff --git a/drivers/net/e100.c b/drivers/net/e100.c
9454 -index d269a68..0c53c92 100644
9455 ---- a/drivers/net/e100.c
9456 -+++ b/drivers/net/e100.c
9457 -@@ -1817,6 +1817,7 @@ static int e100_alloc_cbs(struct nic *nic)
9458 - &nic->cbs_dma_addr);
9459 - if (!nic->cbs)
9460 - return -ENOMEM;
9461 -+ memset(nic->cbs, 0, count * sizeof(struct cb));
9462 -
9463 - for (cb = nic->cbs, i = 0; i < count; cb++, i++) {
9464 - cb->next = (i + 1 < count) ? cb + 1 : nic->cbs;
9465 -@@ -1825,7 +1826,6 @@ static int e100_alloc_cbs(struct nic *nic)
9466 - cb->dma_addr = nic->cbs_dma_addr + i * sizeof(struct cb);
9467 - cb->link = cpu_to_le32(nic->cbs_dma_addr +
9468 - ((i+1) % count) * sizeof(struct cb));
9469 -- cb->skb = NULL;
9470 - }
9471 -
9472 - nic->cb_to_use = nic->cb_to_send = nic->cb_to_clean = nic->cbs;
9473 -diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
9474 -index b091e20..f14d225 100644
9475 ---- a/drivers/net/usb/rtl8150.c
9476 -+++ b/drivers/net/usb/rtl8150.c
9477 -@@ -324,7 +324,7 @@ static int rtl8150_set_mac_address(struct net_device *netdev, void *p)
9478 - dbg("%02X:", netdev->dev_addr[i]);
9479 - dbg("%02X\n", netdev->dev_addr[i]);
9480 - /* Set the IDR registers. */
9481 -- set_registers(dev, IDR, sizeof(netdev->dev_addr), netdev->dev_addr);
9482 -+ set_registers(dev, IDR, netdev->addr_len, netdev->dev_addr);
9483 - #ifdef EEPROM_WRITE
9484 - {
9485 - u8 cr;
9486 -diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
9487 -index 95a8e23..8a82c75 100644
9488 ---- a/drivers/net/wireless/ath/ath5k/base.c
9489 -+++ b/drivers/net/wireless/ath/ath5k/base.c
9490 -@@ -2349,6 +2349,9 @@ ath5k_init(struct ath5k_softc *sc)
9491 - */
9492 - ath5k_stop_locked(sc);
9493 -
9494 -+ /* Set PHY calibration interval */
9495 -+ ah->ah_cal_intval = ath5k_calinterval;
9496 -+
9497 - /*
9498 - * The basic interface to setting the hardware in a good
9499 - * state is ``reset''. On return the hardware is known to
9500 -@@ -2376,10 +2379,6 @@ ath5k_init(struct ath5k_softc *sc)
9501 -
9502 - /* Set ack to be sent at low bit-rates */
9503 - ath5k_hw_set_ack_bitrate_high(ah, false);
9504 --
9505 -- /* Set PHY calibration inteval */
9506 -- ah->ah_cal_intval = ath5k_calinterval;
9507 --
9508 - ret = 0;
9509 - done:
9510 - mmiowb();
9511 -diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
9512 -index 57f1463..ff4383b 100644
9513 ---- a/drivers/net/wireless/ath/ath9k/hw.h
9514 -+++ b/drivers/net/wireless/ath/ath9k/hw.h
9515 -@@ -408,7 +408,7 @@ struct ath9k_hw_version {
9516 - * Using de Bruijin sequence to to look up 1's index in a 32 bit number
9517 - * debruijn32 = 0000 0111 0111 1100 1011 0101 0011 0001
9518 - */
9519 --#define debruijn32 0x077CB531UL
9520 -+#define debruijn32 0x077CB531U
9521 -
9522 - struct ath_gen_timer_configuration {
9523 - u32 next_addr;
9524 -diff --git a/drivers/net/wireless/ath/ath9k/mac.c b/drivers/net/wireless/ath/ath9k/mac.c
9525 -index d4d9d82..110c16d 100644
9526 ---- a/drivers/net/wireless/ath/ath9k/mac.c
9527 -+++ b/drivers/net/wireless/ath/ath9k/mac.c
9528 -@@ -155,7 +155,7 @@ bool ath9k_hw_stoptxdma(struct ath_hw *ah, u32 q)
9529 - wait = wait_time;
9530 - while (ath9k_hw_numtxpending(ah, q)) {
9531 - if ((--wait) == 0) {
9532 -- DPRINTF(ah->ah_sc, ATH_DBG_QUEUE,
9533 -+ DPRINTF(ah->ah_sc, ATH_DBG_FATAL,
9534 - "Failed to stop TX DMA in 100 "
9535 - "msec after killing last frame\n");
9536 - break;
9537 -diff --git a/drivers/net/wireless/ath/ath9k/mac.h b/drivers/net/wireless/ath/ath9k/mac.h
9538 -index ff65f85..9720c4d 100644
9539 ---- a/drivers/net/wireless/ath/ath9k/mac.h
9540 -+++ b/drivers/net/wireless/ath/ath9k/mac.h
9541 -@@ -77,6 +77,9 @@
9542 - #define ATH9K_TXERR_XTXOP 0x08
9543 - #define ATH9K_TXERR_TIMER_EXPIRED 0x10
9544 - #define ATH9K_TX_ACKED 0x20
9545 -+#define ATH9K_TXERR_MASK \
9546 -+ (ATH9K_TXERR_XRETRY | ATH9K_TXERR_FILT | ATH9K_TXERR_FIFO | \
9547 -+ ATH9K_TXERR_XTXOP | ATH9K_TXERR_TIMER_EXPIRED)
9548 -
9549 - #define ATH9K_TX_BA 0x01
9550 - #define ATH9K_TX_PWRMGMT 0x02
9551 -diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
9552 -index 59359e3..80df8f3 100644
9553 ---- a/drivers/net/wireless/ath/ath9k/main.c
9554 -+++ b/drivers/net/wireless/ath/ath9k/main.c
9555 -@@ -2147,6 +2147,9 @@ static void ath9k_stop(struct ieee80211_hw *hw)
9556 - return; /* another wiphy still in use */
9557 - }
9558 -
9559 -+ /* Ensure HW is awake when we try to shut it down. */
9560 -+ ath9k_ps_wakeup(sc);
9561 -+
9562 - if (sc->sc_flags & SC_OP_BTCOEX_ENABLED) {
9563 - ath9k_hw_btcoex_disable(sc->sc_ah);
9564 - if (sc->btcoex_info.btcoex_scheme == ATH_BTCOEX_CFG_3WIRE)
9565 -@@ -2167,6 +2170,9 @@ static void ath9k_stop(struct ieee80211_hw *hw)
9566 - /* disable HAL and put h/w to sleep */
9567 - ath9k_hw_disable(sc->sc_ah);
9568 - ath9k_hw_configpcipowersave(sc->sc_ah, 1, 1);
9569 -+ ath9k_ps_restore(sc);
9570 -+
9571 -+ /* Finally, put the chip in FULL SLEEP mode */
9572 - ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_FULL_SLEEP);
9573 -
9574 - sc->sc_flags |= SC_OP_INVALID;
9575 -@@ -2277,8 +2283,10 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
9576 - if ((sc->sc_ah->opmode == NL80211_IFTYPE_AP) ||
9577 - (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) ||
9578 - (sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT)) {
9579 -+ ath9k_ps_wakeup(sc);
9580 - ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq);
9581 - ath_beacon_return(sc, avp);
9582 -+ ath9k_ps_restore(sc);
9583 - }
9584 -
9585 - sc->sc_flags &= ~SC_OP_BEACONS;
9586 -@@ -2724,15 +2732,21 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw,
9587 - case IEEE80211_AMPDU_RX_STOP:
9588 - break;
9589 - case IEEE80211_AMPDU_TX_START:
9590 -+ ath9k_ps_wakeup(sc);
9591 - ath_tx_aggr_start(sc, sta, tid, ssn);
9592 - ieee80211_start_tx_ba_cb_irqsafe(hw, sta->addr, tid);
9593 -+ ath9k_ps_restore(sc);
9594 - break;
9595 - case IEEE80211_AMPDU_TX_STOP:
9596 -+ ath9k_ps_wakeup(sc);
9597 - ath_tx_aggr_stop(sc, sta, tid);
9598 - ieee80211_stop_tx_ba_cb_irqsafe(hw, sta->addr, tid);
9599 -+ ath9k_ps_restore(sc);
9600 - break;
9601 - case IEEE80211_AMPDU_TX_OPERATIONAL:
9602 -+ ath9k_ps_wakeup(sc);
9603 - ath_tx_aggr_resume(sc, sta, tid);
9604 -+ ath9k_ps_restore(sc);
9605 - break;
9606 - default:
9607 - DPRINTF(sc, ATH_DBG_FATAL, "Unknown AMPDU action\n");
9608 -diff --git a/drivers/net/wireless/ath/ath9k/reg.h b/drivers/net/wireless/ath/ath9k/reg.h
9609 -index d83b77f..c0d7e65 100644
9610 ---- a/drivers/net/wireless/ath/ath9k/reg.h
9611 -+++ b/drivers/net/wireless/ath/ath9k/reg.h
9612 -@@ -969,10 +969,10 @@ enum {
9613 - #define AR_GPIO_INPUT_EN_VAL_BT_ACTIVE_S 4
9614 - #define AR_GPIO_INPUT_EN_VAL_RFSILENT_DEF 0x00000080
9615 - #define AR_GPIO_INPUT_EN_VAL_RFSILENT_DEF_S 7
9616 -+#define AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_BB 0x00000400
9617 -+#define AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_BB_S 10
9618 - #define AR_GPIO_INPUT_EN_VAL_BT_ACTIVE_BB 0x00001000
9619 - #define AR_GPIO_INPUT_EN_VAL_BT_ACTIVE_BB_S 12
9620 --#define AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_BB 0x00001000
9621 --#define AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_BB_S 1
9622 - #define AR_GPIO_INPUT_EN_VAL_RFSILENT_BB 0x00008000
9623 - #define AR_GPIO_INPUT_EN_VAL_RFSILENT_BB_S 15
9624 - #define AR_GPIO_RTC_RESET_OVERRIDE_ENABLE 0x00010000
9625 -diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
9626 -index 4753909..2c6b063 100644
9627 ---- a/drivers/net/wireless/ath/ath9k/xmit.c
9628 -+++ b/drivers/net/wireless/ath/ath9k/xmit.c
9629 -@@ -1076,10 +1076,10 @@ void ath_drain_all_txq(struct ath_softc *sc, bool retry_tx)
9630 - if (npend) {
9631 - int r;
9632 -
9633 -- DPRINTF(sc, ATH_DBG_XMIT, "Unable to stop TxDMA. Reset HAL!\n");
9634 -+ DPRINTF(sc, ATH_DBG_FATAL, "Unable to stop TxDMA. Reset HAL!\n");
9635 -
9636 - spin_lock_bh(&sc->sc_resetlock);
9637 -- r = ath9k_hw_reset(ah, sc->sc_ah->curchan, true);
9638 -+ r = ath9k_hw_reset(ah, sc->sc_ah->curchan, false);
9639 - if (r)
9640 - DPRINTF(sc, ATH_DBG_FATAL,
9641 - "Unable to reset hardware; reset status %d\n",
9642 -@@ -2020,7 +2020,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
9643 - if (bf_isaggr(bf))
9644 - txq->axq_aggr_depth--;
9645 -
9646 -- txok = !(ds->ds_txstat.ts_status & ATH9K_TXERR_FILT);
9647 -+ txok = !(ds->ds_txstat.ts_status & ATH9K_TXERR_MASK);
9648 - txq->axq_tx_inprogress = false;
9649 - spin_unlock_bh(&txq->axq_lock);
9650 -
9651 -diff --git a/drivers/net/wireless/b43/rfkill.c b/drivers/net/wireless/b43/rfkill.c
9652 -index ffdce6f..78016ae 100644
9653 ---- a/drivers/net/wireless/b43/rfkill.c
9654 -+++ b/drivers/net/wireless/b43/rfkill.c
9655 -@@ -33,8 +33,14 @@ bool b43_is_hw_radio_enabled(struct b43_wldev *dev)
9656 - & B43_MMIO_RADIO_HWENABLED_HI_MASK))
9657 - return 1;
9658 - } else {
9659 -- if (b43_status(dev) >= B43_STAT_STARTED &&
9660 -- b43_read16(dev, B43_MMIO_RADIO_HWENABLED_LO)
9661 -+ /* To prevent CPU fault on PPC, do not read a register
9662 -+ * unless the interface is started; however, on resume
9663 -+ * for hibernation, this routine is entered early. When
9664 -+ * that happens, unconditionally return TRUE.
9665 -+ */
9666 -+ if (b43_status(dev) < B43_STAT_STARTED)
9667 -+ return 1;
9668 -+ if (b43_read16(dev, B43_MMIO_RADIO_HWENABLED_LO)
9669 - & B43_MMIO_RADIO_HWENABLED_LO_MASK)
9670 - return 1;
9671 - }
9672 -diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
9673 -index f059b49..9d60f6c 100644
9674 ---- a/drivers/net/wireless/iwlwifi/iwl-3945.c
9675 -+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
9676 -@@ -2895,6 +2895,7 @@ static struct iwl_cfg iwl3945_bg_cfg = {
9677 - .mod_params = &iwl3945_mod_params,
9678 - .use_isr_legacy = true,
9679 - .ht_greenfield_support = false,
9680 -+ .broken_powersave = true,
9681 - };
9682 -
9683 - static struct iwl_cfg iwl3945_abg_cfg = {
9684 -@@ -2909,6 +2910,7 @@ static struct iwl_cfg iwl3945_abg_cfg = {
9685 - .mod_params = &iwl3945_mod_params,
9686 - .use_isr_legacy = true,
9687 - .ht_greenfield_support = false,
9688 -+ .broken_powersave = true,
9689 - };
9690 -
9691 - struct pci_device_id iwl3945_hw_card_ids[] = {
9692 -diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
9693 -index 6f703a0..f4e2e84 100644
9694 ---- a/drivers/net/wireless/iwlwifi/iwl-4965.c
9695 -+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
9696 -@@ -1337,7 +1337,7 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
9697 - iwl4965_interpolate_chan(priv, channel, &ch_eeprom_info);
9698 -
9699 - /* calculate tx gain adjustment based on power supply voltage */
9700 -- voltage = priv->calib_info->voltage;
9701 -+ voltage = le16_to_cpu(priv->calib_info->voltage);
9702 - init_voltage = (s32)le32_to_cpu(priv->card_alive_init.voltage);
9703 - voltage_compensation =
9704 - iwl4965_get_voltage_compensation(voltage, init_voltage);
9705 -diff --git a/drivers/net/wireless/iwlwifi/iwl-5000-hw.h b/drivers/net/wireless/iwlwifi/iwl-5000-hw.h
9706 -index 4ef6804..bc056e9 100644
9707 ---- a/drivers/net/wireless/iwlwifi/iwl-5000-hw.h
9708 -+++ b/drivers/net/wireless/iwlwifi/iwl-5000-hw.h
9709 -@@ -92,11 +92,15 @@
9710 -
9711 - static inline s32 iwl_temp_calib_to_offset(struct iwl_priv *priv)
9712 - {
9713 -- u16 *temp_calib = (u16 *)iwl_eeprom_query_addr(priv,
9714 -- EEPROM_5000_TEMPERATURE);
9715 -- /* offset = temperature - voltage / coef */
9716 -- s32 offset = (s32)(temp_calib[0] - temp_calib[1] / IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF);
9717 -- return offset;
9718 -+ u16 temperature, voltage;
9719 -+ __le16 *temp_calib =
9720 -+ (__le16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_TEMPERATURE);
9721 -+
9722 -+ temperature = le16_to_cpu(temp_calib[0]);
9723 -+ voltage = le16_to_cpu(temp_calib[1]);
9724 -+
9725 -+ /* offset = temp - volt / coeff */
9726 -+ return (s32)(temperature - voltage / IWL_5150_VOLTAGE_TO_TEMPERATURE_COEFF);
9727 - }
9728 -
9729 - /* Fixed (non-configurable) rx data from phy */
9730 -diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
9731 -index 6e6f516..94a1225 100644
9732 ---- a/drivers/net/wireless/iwlwifi/iwl-5000.c
9733 -+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
9734 -@@ -460,14 +460,15 @@ static void iwl5000_set_ct_threshold(struct iwl_priv *priv)
9735 - static int iwl5000_set_Xtal_calib(struct iwl_priv *priv)
9736 - {
9737 - struct iwl_calib_xtal_freq_cmd cmd;
9738 -- u16 *xtal_calib = (u16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_XTAL);
9739 -+ __le16 *xtal_calib =
9740 -+ (__le16 *)iwl_eeprom_query_addr(priv, EEPROM_5000_XTAL);
9741 -
9742 - cmd.hdr.op_code = IWL_PHY_CALIBRATE_CRYSTAL_FRQ_CMD;
9743 - cmd.hdr.first_group = 0;
9744 - cmd.hdr.groups_num = 1;
9745 - cmd.hdr.data_valid = 1;
9746 -- cmd.cap_pin1 = (u8)xtal_calib[0];
9747 -- cmd.cap_pin2 = (u8)xtal_calib[1];
9748 -+ cmd.cap_pin1 = le16_to_cpu(xtal_calib[0]);
9749 -+ cmd.cap_pin2 = le16_to_cpu(xtal_calib[1]);
9750 - return iwl_calib_set(&priv->calib_results[IWL_CALIB_XTAL],
9751 - (u8 *)&cmd, sizeof(cmd));
9752 - }
9753 -diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
9754 -index 028d505..c2d9b7a 100644
9755 ---- a/drivers/net/wireless/iwlwifi/iwl-dev.h
9756 -+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
9757 -@@ -1149,7 +1149,7 @@ struct iwl_priv {
9758 - u32 last_beacon_time;
9759 - u64 last_tsf;
9760 -
9761 -- /* eeprom */
9762 -+ /* eeprom -- this is in the card's little endian byte order */
9763 - u8 *eeprom;
9764 - int nvm_device_type;
9765 - struct iwl_eeprom_calib_info *calib_info;
9766 -diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.c b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
9767 -index e14c995..18dc3a4 100644
9768 ---- a/drivers/net/wireless/iwlwifi/iwl-eeprom.c
9769 -+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.c
9770 -@@ -337,7 +337,7 @@ static int iwl_init_otp_access(struct iwl_priv *priv)
9771 - return ret;
9772 - }
9773 -
9774 --static int iwl_read_otp_word(struct iwl_priv *priv, u16 addr, u16 *eeprom_data)
9775 -+static int iwl_read_otp_word(struct iwl_priv *priv, u16 addr, __le16 *eeprom_data)
9776 - {
9777 - int ret = 0;
9778 - u32 r;
9779 -@@ -370,7 +370,7 @@ static int iwl_read_otp_word(struct iwl_priv *priv, u16 addr, u16 *eeprom_data)
9780 - CSR_OTP_GP_REG_ECC_CORR_STATUS_MSK);
9781 - IWL_ERR(priv, "Correctable OTP ECC error, continue read\n");
9782 - }
9783 -- *eeprom_data = le16_to_cpu((__force __le16)(r >> 16));
9784 -+ *eeprom_data = cpu_to_le16(r >> 16);
9785 - return 0;
9786 - }
9787 -
9788 -@@ -379,7 +379,8 @@ static int iwl_read_otp_word(struct iwl_priv *priv, u16 addr, u16 *eeprom_data)
9789 - */
9790 - static bool iwl_is_otp_empty(struct iwl_priv *priv)
9791 - {
9792 -- u16 next_link_addr = 0, link_value;
9793 -+ u16 next_link_addr = 0;
9794 -+ __le16 link_value;
9795 - bool is_empty = false;
9796 -
9797 - /* locate the beginning of OTP link list */
9798 -@@ -409,7 +410,8 @@ static bool iwl_is_otp_empty(struct iwl_priv *priv)
9799 - static int iwl_find_otp_image(struct iwl_priv *priv,
9800 - u16 *validblockaddr)
9801 - {
9802 -- u16 next_link_addr = 0, link_value = 0, valid_addr;
9803 -+ u16 next_link_addr = 0, valid_addr;
9804 -+ __le16 link_value = 0;
9805 - int usedblocks = 0;
9806 -
9807 - /* set addressing mode to absolute to traverse the link list */
9808 -@@ -429,7 +431,7 @@ static int iwl_find_otp_image(struct iwl_priv *priv,
9809 - * check for more block on the link list
9810 - */
9811 - valid_addr = next_link_addr;
9812 -- next_link_addr = link_value * sizeof(u16);
9813 -+ next_link_addr = le16_to_cpu(link_value) * sizeof(u16);
9814 - IWL_DEBUG_INFO(priv, "OTP blocks %d addr 0x%x\n",
9815 - usedblocks, next_link_addr);
9816 - if (iwl_read_otp_word(priv, next_link_addr, &link_value))
9817 -@@ -463,7 +465,7 @@ static int iwl_find_otp_image(struct iwl_priv *priv,
9818 - */
9819 - int iwl_eeprom_init(struct iwl_priv *priv)
9820 - {
9821 -- u16 *e;
9822 -+ __le16 *e;
9823 - u32 gp = iwl_read32(priv, CSR_EEPROM_GP);
9824 - int sz;
9825 - int ret;
9826 -@@ -482,7 +484,7 @@ int iwl_eeprom_init(struct iwl_priv *priv)
9827 - ret = -ENOMEM;
9828 - goto alloc_err;
9829 - }
9830 -- e = (u16 *)priv->eeprom;
9831 -+ e = (__le16 *)priv->eeprom;
9832 -
9833 - ret = priv->cfg->ops->lib->eeprom_ops.verify_signature(priv);
9834 - if (ret < 0) {
9835 -@@ -521,7 +523,7 @@ int iwl_eeprom_init(struct iwl_priv *priv)
9836 - }
9837 - for (addr = validblockaddr; addr < validblockaddr + sz;
9838 - addr += sizeof(u16)) {
9839 -- u16 eeprom_data;
9840 -+ __le16 eeprom_data;
9841 -
9842 - ret = iwl_read_otp_word(priv, addr, &eeprom_data);
9843 - if (ret)
9844 -@@ -545,7 +547,7 @@ int iwl_eeprom_init(struct iwl_priv *priv)
9845 - goto done;
9846 - }
9847 - r = _iwl_read_direct32(priv, CSR_EEPROM_REG);
9848 -- e[addr / 2] = le16_to_cpu((__force __le16)(r >> 16));
9849 -+ e[addr / 2] = cpu_to_le16(r >> 16);
9850 - }
9851 - }
9852 - ret = 0;
9853 -@@ -709,7 +711,8 @@ static int iwl_mod_ht40_chan_info(struct iwl_priv *priv,
9854 - ch_info->ht40_min_power = 0;
9855 - ch_info->ht40_scan_power = eeprom_ch->max_power_avg;
9856 - ch_info->ht40_flags = eeprom_ch->flags;
9857 -- ch_info->ht40_extension_channel &= ~clear_ht40_extension_channel;
9858 -+ if (eeprom_ch->flags & EEPROM_CHANNEL_VALID)
9859 -+ ch_info->ht40_extension_channel &= ~clear_ht40_extension_channel;
9860 -
9861 - return 0;
9862 - }
9863 -diff --git a/drivers/net/wireless/iwlwifi/iwl-eeprom.h b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
9864 -index 80b9e45..fc93f12 100644
9865 ---- a/drivers/net/wireless/iwlwifi/iwl-eeprom.h
9866 -+++ b/drivers/net/wireless/iwlwifi/iwl-eeprom.h
9867 -@@ -133,7 +133,7 @@ struct iwl_eeprom_channel {
9868 - *
9869 - */
9870 - struct iwl_eeprom_enhanced_txpwr {
9871 -- u16 reserved;
9872 -+ __le16 common;
9873 - s8 chain_a_max;
9874 - s8 chain_b_max;
9875 - s8 chain_c_max;
9876 -@@ -347,7 +347,7 @@ struct iwl_eeprom_calib_subband_info {
9877 - struct iwl_eeprom_calib_info {
9878 - u8 saturation_power24; /* half-dBm (e.g. "34" = 17 dBm) */
9879 - u8 saturation_power52; /* half-dBm */
9880 -- s16 voltage; /* signed */
9881 -+ __le16 voltage; /* signed */
9882 - struct iwl_eeprom_calib_subband_info
9883 - band_info[EEPROM_TX_POWER_BANDS];
9884 - } __attribute__ ((packed));
9885 -diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
9886 -index d00a803..5f26c93 100644
9887 ---- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
9888 -+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
9889 -@@ -562,6 +562,9 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
9890 - txq = &priv->txq[txq_id];
9891 - q = &txq->q;
9892 -
9893 -+ if ((iwl_queue_space(q) < q->high_mark))
9894 -+ goto drop;
9895 -+
9896 - spin_lock_irqsave(&priv->lock, flags);
9897 -
9898 - idx = get_cmd_index(q, q->write_ptr, 0);
9899 -@@ -3854,9 +3857,11 @@ static int iwl3945_setup_mac(struct iwl_priv *priv)
9900 - /* Tell mac80211 our characteristics */
9901 - hw->flags = IEEE80211_HW_SIGNAL_DBM |
9902 - IEEE80211_HW_NOISE_DBM |
9903 -- IEEE80211_HW_SPECTRUM_MGMT |
9904 -- IEEE80211_HW_SUPPORTS_PS |
9905 -- IEEE80211_HW_SUPPORTS_DYNAMIC_PS;
9906 -+ IEEE80211_HW_SPECTRUM_MGMT;
9907 -+
9908 -+ if (!priv->cfg->broken_powersave)
9909 -+ hw->flags |= IEEE80211_HW_SUPPORTS_PS |
9910 -+ IEEE80211_HW_SUPPORTS_DYNAMIC_PS;
9911 -
9912 - hw->wiphy->interface_modes =
9913 - BIT(NL80211_IFTYPE_STATION) |
9914 -diff --git a/drivers/net/wireless/iwmc3200wifi/iwm.h b/drivers/net/wireless/iwmc3200wifi/iwm.h
9915 -index 1b02a4e..93c8989 100644
9916 ---- a/drivers/net/wireless/iwmc3200wifi/iwm.h
9917 -+++ b/drivers/net/wireless/iwmc3200wifi/iwm.h
9918 -@@ -258,7 +258,7 @@ struct iwm_priv {
9919 -
9920 - struct sk_buff_head rx_list;
9921 - struct list_head rx_tickets;
9922 -- struct list_head rx_packets[IWM_RX_ID_HASH];
9923 -+ struct list_head rx_packets[IWM_RX_ID_HASH + 1];
9924 - struct workqueue_struct *rx_wq;
9925 - struct work_struct rx_worker;
9926 -
9927 -diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
9928 -index be837a0..01c738b 100644
9929 ---- a/drivers/net/wireless/libertas/wext.c
9930 -+++ b/drivers/net/wireless/libertas/wext.c
9931 -@@ -1953,10 +1953,8 @@ static int lbs_get_essid(struct net_device *dev, struct iw_request_info *info,
9932 - if (priv->connect_status == LBS_CONNECTED) {
9933 - memcpy(extra, priv->curbssparams.ssid,
9934 - priv->curbssparams.ssid_len);
9935 -- extra[priv->curbssparams.ssid_len] = '\0';
9936 - } else {
9937 - memset(extra, 0, 32);
9938 -- extra[priv->curbssparams.ssid_len] = '\0';
9939 - }
9940 - /*
9941 - * If none, we may want to get the one that was set
9942 -diff --git a/drivers/net/wireless/orinoco/wext.c b/drivers/net/wireless/orinoco/wext.c
9943 -index 7698fdd..31ca241 100644
9944 ---- a/drivers/net/wireless/orinoco/wext.c
9945 -+++ b/drivers/net/wireless/orinoco/wext.c
9946 -@@ -23,7 +23,7 @@
9947 - #define MAX_RID_LEN 1024
9948 -
9949 - /* Helper routine to record keys
9950 -- * Do not call from interrupt context */
9951 -+ * It is called under orinoco_lock so it may not sleep */
9952 - static int orinoco_set_key(struct orinoco_private *priv, int index,
9953 - enum orinoco_alg alg, const u8 *key, int key_len,
9954 - const u8 *seq, int seq_len)
9955 -@@ -32,14 +32,14 @@ static int orinoco_set_key(struct orinoco_private *priv, int index,
9956 - kzfree(priv->keys[index].seq);
9957 -
9958 - if (key_len) {
9959 -- priv->keys[index].key = kzalloc(key_len, GFP_KERNEL);
9960 -+ priv->keys[index].key = kzalloc(key_len, GFP_ATOMIC);
9961 - if (!priv->keys[index].key)
9962 - goto nomem;
9963 - } else
9964 - priv->keys[index].key = NULL;
9965 -
9966 - if (seq_len) {
9967 -- priv->keys[index].seq = kzalloc(seq_len, GFP_KERNEL);
9968 -+ priv->keys[index].seq = kzalloc(seq_len, GFP_ATOMIC);
9969 - if (!priv->keys[index].seq)
9970 - goto free_key;
9971 - } else
9972 -diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c
9973 -index b20e3ea..9a6ceb4 100644
9974 ---- a/drivers/net/wireless/rt2x00/rt61pci.c
9975 -+++ b/drivers/net/wireless/rt2x00/rt61pci.c
9976 -@@ -2538,6 +2538,11 @@ static int rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
9977 - unsigned int i;
9978 -
9979 - /*
9980 -+ * Disable powersaving as default.
9981 -+ */
9982 -+ rt2x00dev->hw->wiphy->ps_default = false;
9983 -+
9984 -+ /*
9985 - * Initialize all hw fields.
9986 - */
9987 - rt2x00dev->hw->flags =
9988 -diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
9989 -index d8b4229..4d922e4 100644
9990 ---- a/drivers/platform/x86/acerhdf.c
9991 -+++ b/drivers/platform/x86/acerhdf.c
9992 -@@ -640,9 +640,10 @@ static void __exit acerhdf_exit(void)
9993 - MODULE_LICENSE("GPL");
9994 - MODULE_AUTHOR("Peter Feuerer");
9995 - MODULE_DESCRIPTION("Aspire One temperature and fan driver");
9996 --MODULE_ALIAS("dmi:*:*Acer*:*:");
9997 --MODULE_ALIAS("dmi:*:*Gateway*:*:");
9998 --MODULE_ALIAS("dmi:*:*Packard Bell*:*:");
9999 -+MODULE_ALIAS("dmi:*:*Acer*:pnAOA*:");
10000 -+MODULE_ALIAS("dmi:*:*Gateway*:pnAOA*:");
10001 -+MODULE_ALIAS("dmi:*:*Packard Bell*:pnAOA*:");
10002 -+MODULE_ALIAS("dmi:*:*Packard Bell*:pnDOA*:");
10003 -
10004 - module_init(acerhdf_init);
10005 - module_exit(acerhdf_exit);
10006 -diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c
10007 -index 4e49b4a..8174ec9 100644
10008 ---- a/drivers/s390/block/dasd_diag.c
10009 -+++ b/drivers/s390/block/dasd_diag.c
10010 -@@ -145,6 +145,15 @@ dasd_diag_erp(struct dasd_device *device)
10011 -
10012 - mdsk_term_io(device);
10013 - rc = mdsk_init_io(device, device->block->bp_block, 0, NULL);
10014 -+ if (rc == 4) {
10015 -+ if (!(device->features & DASD_FEATURE_READONLY)) {
10016 -+ dev_warn(&device->cdev->dev,
10017 -+ "The access mode of a DIAG device changed"
10018 -+ " to read-only");
10019 -+ device->features |= DASD_FEATURE_READONLY;
10020 -+ }
10021 -+ rc = 0;
10022 -+ }
10023 - if (rc)
10024 - dev_warn(&device->cdev->dev, "DIAG ERP failed with "
10025 - "rc=%d\n", rc);
10026 -@@ -433,16 +442,20 @@ dasd_diag_check_device(struct dasd_device *device)
10027 - for (sb = 512; sb < bsize; sb = sb << 1)
10028 - block->s2b_shift++;
10029 - rc = mdsk_init_io(device, block->bp_block, 0, NULL);
10030 -- if (rc) {
10031 -+ if (rc && (rc != 4)) {
10032 - dev_warn(&device->cdev->dev, "DIAG initialization "
10033 - "failed with rc=%d\n", rc);
10034 - rc = -EIO;
10035 - } else {
10036 -+ if (rc == 4)
10037 -+ device->features |= DASD_FEATURE_READONLY;
10038 - dev_info(&device->cdev->dev,
10039 -- "New DASD with %ld byte/block, total size %ld KB\n",
10040 -+ "New DASD with %ld byte/block, total size %ld KB%s\n",
10041 - (unsigned long) block->bp_block,
10042 - (unsigned long) (block->blocks <<
10043 -- block->s2b_shift) >> 1);
10044 -+ block->s2b_shift) >> 1,
10045 -+ (rc == 4) ? ", read-only device" : "");
10046 -+ rc = 0;
10047 - }
10048 - out_label:
10049 - free_page((long) label);
10050 -diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c
10051 -index 76d294f..c3ff9a6 100644
10052 ---- a/drivers/scsi/ipr.c
10053 -+++ b/drivers/scsi/ipr.c
10054 -@@ -6516,6 +6516,7 @@ static int ipr_reset_restore_cfg_space(struct ipr_cmnd *ipr_cmd)
10055 - int rc;
10056 -
10057 - ENTER;
10058 -+ ioa_cfg->pdev->state_saved = true;
10059 - rc = pci_restore_state(ioa_cfg->pdev);
10060 -
10061 - if (rc != PCIBIOS_SUCCESSFUL) {
10062 -diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
10063 -index b79fca7..06bbe0d 100644
10064 ---- a/drivers/scsi/qla2xxx/qla_os.c
10065 -+++ b/drivers/scsi/qla2xxx/qla_os.c
10066 -@@ -2016,13 +2016,13 @@ skip_dpc:
10067 - DEBUG2(printk("DEBUG: detect hba %ld at address = %p\n",
10068 - base_vha->host_no, ha));
10069 -
10070 -- base_vha->flags.init_done = 1;
10071 -- base_vha->flags.online = 1;
10072 --
10073 - ret = scsi_add_host(host, &pdev->dev);
10074 - if (ret)
10075 - goto probe_failed;
10076 -
10077 -+ base_vha->flags.init_done = 1;
10078 -+ base_vha->flags.online = 1;
10079 -+
10080 - ha->isp_ops->enable_intrs(ha);
10081 -
10082 - scsi_scan_host(host);
10083 -diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
10084 -index c6f70da..45be82f 100644
10085 ---- a/drivers/scsi/scsi_transport_fc.c
10086 -+++ b/drivers/scsi/scsi_transport_fc.c
10087 -@@ -648,11 +648,22 @@ static __init int fc_transport_init(void)
10088 - return error;
10089 - error = transport_class_register(&fc_vport_class);
10090 - if (error)
10091 -- return error;
10092 -+ goto unreg_host_class;
10093 - error = transport_class_register(&fc_rport_class);
10094 - if (error)
10095 -- return error;
10096 -- return transport_class_register(&fc_transport_class);
10097 -+ goto unreg_vport_class;
10098 -+ error = transport_class_register(&fc_transport_class);
10099 -+ if (error)
10100 -+ goto unreg_rport_class;
10101 -+ return 0;
10102 -+
10103 -+unreg_rport_class:
10104 -+ transport_class_unregister(&fc_rport_class);
10105 -+unreg_vport_class:
10106 -+ transport_class_unregister(&fc_vport_class);
10107 -+unreg_host_class:
10108 -+ transport_class_unregister(&fc_host_class);
10109 -+ return error;
10110 - }
10111 -
10112 - static void __exit fc_transport_exit(void)
10113 -diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
10114 -index 12d58a7..5081f97 100644
10115 ---- a/drivers/scsi/st.c
10116 -+++ b/drivers/scsi/st.c
10117 -@@ -552,13 +552,15 @@ st_do_scsi(struct st_request * SRpnt, struct scsi_tape * STp, unsigned char *cmd
10118 - SRpnt->waiting = waiting;
10119 -
10120 - if (STp->buffer->do_dio) {
10121 -+ mdata->page_order = 0;
10122 - mdata->nr_entries = STp->buffer->sg_segs;
10123 - mdata->pages = STp->buffer->mapped_pages;
10124 - } else {
10125 -+ mdata->page_order = STp->buffer->reserved_page_order;
10126 - mdata->nr_entries =
10127 - DIV_ROUND_UP(bytes, PAGE_SIZE << mdata->page_order);
10128 -- STp->buffer->map_data.pages = STp->buffer->reserved_pages;
10129 -- STp->buffer->map_data.offset = 0;
10130 -+ mdata->pages = STp->buffer->reserved_pages;
10131 -+ mdata->offset = 0;
10132 - }
10133 -
10134 - memcpy(SRpnt->cmd, cmd, sizeof(SRpnt->cmd));
10135 -@@ -3718,7 +3720,7 @@ static int enlarge_buffer(struct st_buffer * STbuffer, int new_size, int need_dm
10136 - priority |= __GFP_ZERO;
10137 -
10138 - if (STbuffer->frp_segs) {
10139 -- order = STbuffer->map_data.page_order;
10140 -+ order = STbuffer->reserved_page_order;
10141 - b_size = PAGE_SIZE << order;
10142 - } else {
10143 - for (b_size = PAGE_SIZE, order = 0;
10144 -@@ -3751,7 +3753,7 @@ static int enlarge_buffer(struct st_buffer * STbuffer, int new_size, int need_dm
10145 - segs++;
10146 - }
10147 - STbuffer->b_data = page_address(STbuffer->reserved_pages[0]);
10148 -- STbuffer->map_data.page_order = order;
10149 -+ STbuffer->reserved_page_order = order;
10150 -
10151 - return 1;
10152 - }
10153 -@@ -3764,7 +3766,7 @@ static void clear_buffer(struct st_buffer * st_bp)
10154 -
10155 - for (i=0; i < st_bp->frp_segs; i++)
10156 - memset(page_address(st_bp->reserved_pages[i]), 0,
10157 -- PAGE_SIZE << st_bp->map_data.page_order);
10158 -+ PAGE_SIZE << st_bp->reserved_page_order);
10159 - st_bp->cleared = 1;
10160 - }
10161 -
10162 -@@ -3772,7 +3774,7 @@ static void clear_buffer(struct st_buffer * st_bp)
10163 - /* Release the extra buffer */
10164 - static void normalize_buffer(struct st_buffer * STbuffer)
10165 - {
10166 -- int i, order = STbuffer->map_data.page_order;
10167 -+ int i, order = STbuffer->reserved_page_order;
10168 -
10169 - for (i = 0; i < STbuffer->frp_segs; i++) {
10170 - __free_pages(STbuffer->reserved_pages[i], order);
10171 -@@ -3780,7 +3782,7 @@ static void normalize_buffer(struct st_buffer * STbuffer)
10172 - }
10173 - STbuffer->frp_segs = 0;
10174 - STbuffer->sg_segs = 0;
10175 -- STbuffer->map_data.page_order = 0;
10176 -+ STbuffer->reserved_page_order = 0;
10177 - STbuffer->map_data.offset = 0;
10178 - }
10179 -
10180 -@@ -3790,7 +3792,7 @@ static void normalize_buffer(struct st_buffer * STbuffer)
10181 - static int append_to_buffer(const char __user *ubp, struct st_buffer * st_bp, int do_count)
10182 - {
10183 - int i, cnt, res, offset;
10184 -- int length = PAGE_SIZE << st_bp->map_data.page_order;
10185 -+ int length = PAGE_SIZE << st_bp->reserved_page_order;
10186 -
10187 - for (i = 0, offset = st_bp->buffer_bytes;
10188 - i < st_bp->frp_segs && offset >= length; i++)
10189 -@@ -3822,7 +3824,7 @@ static int append_to_buffer(const char __user *ubp, struct st_buffer * st_bp, in
10190 - static int from_buffer(struct st_buffer * st_bp, char __user *ubp, int do_count)
10191 - {
10192 - int i, cnt, res, offset;
10193 -- int length = PAGE_SIZE << st_bp->map_data.page_order;
10194 -+ int length = PAGE_SIZE << st_bp->reserved_page_order;
10195 -
10196 - for (i = 0, offset = st_bp->read_pointer;
10197 - i < st_bp->frp_segs && offset >= length; i++)
10198 -@@ -3855,7 +3857,7 @@ static void move_buffer_data(struct st_buffer * st_bp, int offset)
10199 - {
10200 - int src_seg, dst_seg, src_offset = 0, dst_offset;
10201 - int count, total;
10202 -- int length = PAGE_SIZE << st_bp->map_data.page_order;
10203 -+ int length = PAGE_SIZE << st_bp->reserved_page_order;
10204 -
10205 - if (offset == 0)
10206 - return;
10207 -@@ -4577,7 +4579,6 @@ static int sgl_map_user_pages(struct st_buffer *STbp,
10208 - }
10209 -
10210 - mdata->offset = uaddr & ~PAGE_MASK;
10211 -- mdata->page_order = 0;
10212 - STbp->mapped_pages = pages;
10213 -
10214 - return nr_pages;
10215 -diff --git a/drivers/scsi/st.h b/drivers/scsi/st.h
10216 -index 544dc6b..f91a67c 100644
10217 ---- a/drivers/scsi/st.h
10218 -+++ b/drivers/scsi/st.h
10219 -@@ -46,6 +46,7 @@ struct st_buffer {
10220 - struct st_request *last_SRpnt;
10221 - struct st_cmdstatus cmdstat;
10222 - struct page **reserved_pages;
10223 -+ int reserved_page_order;
10224 - struct page **mapped_pages;
10225 - struct rq_map_data map_data;
10226 - unsigned char *b_data;
10227 -diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
10228 -index 0f857e6..8b0c235 100644
10229 ---- a/drivers/usb/core/hub.c
10230 -+++ b/drivers/usb/core/hub.c
10231 -@@ -1612,12 +1612,12 @@ static inline void announce_device(struct usb_device *udev) { }
10232 - #endif
10233 -
10234 - /**
10235 -- * usb_configure_device_otg - FIXME (usbcore-internal)
10236 -+ * usb_enumerate_device_otg - FIXME (usbcore-internal)
10237 - * @udev: newly addressed device (in ADDRESS state)
10238 - *
10239 -- * Do configuration for On-The-Go devices
10240 -+ * Finish enumeration for On-The-Go devices
10241 - */
10242 --static int usb_configure_device_otg(struct usb_device *udev)
10243 -+static int usb_enumerate_device_otg(struct usb_device *udev)
10244 - {
10245 - int err = 0;
10246 -
10247 -@@ -1688,7 +1688,7 @@ fail:
10248 -
10249 -
10250 - /**
10251 -- * usb_configure_device - Detect and probe device intfs/otg (usbcore-internal)
10252 -+ * usb_enumerate_device - Read device configs/intfs/otg (usbcore-internal)
10253 - * @udev: newly addressed device (in ADDRESS state)
10254 - *
10255 - * This is only called by usb_new_device() and usb_authorize_device()
10256 -@@ -1699,7 +1699,7 @@ fail:
10257 - * the string descriptors, as they will be errored out by the device
10258 - * until it has been authorized.
10259 - */
10260 --static int usb_configure_device(struct usb_device *udev)
10261 -+static int usb_enumerate_device(struct usb_device *udev)
10262 - {
10263 - int err;
10264 -
10265 -@@ -1723,7 +1723,7 @@ static int usb_configure_device(struct usb_device *udev)
10266 - udev->descriptor.iManufacturer);
10267 - udev->serial = usb_cache_string(udev, udev->descriptor.iSerialNumber);
10268 - }
10269 -- err = usb_configure_device_otg(udev);
10270 -+ err = usb_enumerate_device_otg(udev);
10271 - fail:
10272 - return err;
10273 - }
10274 -@@ -1733,8 +1733,8 @@ fail:
10275 - * usb_new_device - perform initial device setup (usbcore-internal)
10276 - * @udev: newly addressed device (in ADDRESS state)
10277 - *
10278 -- * This is called with devices which have been enumerated, but not yet
10279 -- * configured. The device descriptor is available, but not descriptors
10280 -+ * This is called with devices which have been detected but not fully
10281 -+ * enumerated. The device descriptor is available, but not descriptors
10282 - * for any device configuration. The caller must have locked either
10283 - * the parent hub (if udev is a normal device) or else the
10284 - * usb_bus_list_lock (if udev is a root hub). The parent's pointer to
10285 -@@ -1757,8 +1757,8 @@ int usb_new_device(struct usb_device *udev)
10286 - if (udev->parent)
10287 - usb_autoresume_device(udev->parent);
10288 -
10289 -- usb_detect_quirks(udev); /* Determine quirks */
10290 -- err = usb_configure_device(udev); /* detect & probe dev/intfs */
10291 -+ usb_detect_quirks(udev);
10292 -+ err = usb_enumerate_device(udev); /* Read descriptors */
10293 - if (err < 0)
10294 - goto fail;
10295 - dev_dbg(&udev->dev, "udev %d, busnum %d, minor = %d\n",
10296 -@@ -1803,21 +1803,23 @@ fail:
10297 - */
10298 - int usb_deauthorize_device(struct usb_device *usb_dev)
10299 - {
10300 -- unsigned cnt;
10301 - usb_lock_device(usb_dev);
10302 - if (usb_dev->authorized == 0)
10303 - goto out_unauthorized;
10304 -+
10305 - usb_dev->authorized = 0;
10306 - usb_set_configuration(usb_dev, -1);
10307 -+
10308 -+ kfree(usb_dev->product);
10309 - usb_dev->product = kstrdup("n/a (unauthorized)", GFP_KERNEL);
10310 -+ kfree(usb_dev->manufacturer);
10311 - usb_dev->manufacturer = kstrdup("n/a (unauthorized)", GFP_KERNEL);
10312 -+ kfree(usb_dev->serial);
10313 - usb_dev->serial = kstrdup("n/a (unauthorized)", GFP_KERNEL);
10314 -- kfree(usb_dev->config);
10315 -- usb_dev->config = NULL;
10316 -- for (cnt = 0; cnt < usb_dev->descriptor.bNumConfigurations; cnt++)
10317 -- kfree(usb_dev->rawdescriptors[cnt]);
10318 -+
10319 -+ usb_destroy_configuration(usb_dev);
10320 - usb_dev->descriptor.bNumConfigurations = 0;
10321 -- kfree(usb_dev->rawdescriptors);
10322 -+
10323 - out_unauthorized:
10324 - usb_unlock_device(usb_dev);
10325 - return 0;
10326 -@@ -1827,15 +1829,11 @@ out_unauthorized:
10327 - int usb_authorize_device(struct usb_device *usb_dev)
10328 - {
10329 - int result = 0, c;
10330 -+
10331 - usb_lock_device(usb_dev);
10332 - if (usb_dev->authorized == 1)
10333 - goto out_authorized;
10334 -- kfree(usb_dev->product);
10335 -- usb_dev->product = NULL;
10336 -- kfree(usb_dev->manufacturer);
10337 -- usb_dev->manufacturer = NULL;
10338 -- kfree(usb_dev->serial);
10339 -- usb_dev->serial = NULL;
10340 -+
10341 - result = usb_autoresume_device(usb_dev);
10342 - if (result < 0) {
10343 - dev_err(&usb_dev->dev,
10344 -@@ -1848,10 +1846,18 @@ int usb_authorize_device(struct usb_device *usb_dev)
10345 - "authorization: %d\n", result);
10346 - goto error_device_descriptor;
10347 - }
10348 -+
10349 -+ kfree(usb_dev->product);
10350 -+ usb_dev->product = NULL;
10351 -+ kfree(usb_dev->manufacturer);
10352 -+ usb_dev->manufacturer = NULL;
10353 -+ kfree(usb_dev->serial);
10354 -+ usb_dev->serial = NULL;
10355 -+
10356 - usb_dev->authorized = 1;
10357 -- result = usb_configure_device(usb_dev);
10358 -+ result = usb_enumerate_device(usb_dev);
10359 - if (result < 0)
10360 -- goto error_configure;
10361 -+ goto error_enumerate;
10362 - /* Choose and set the configuration. This registers the interfaces
10363 - * with the driver core and lets interface drivers bind to them.
10364 - */
10365 -@@ -1866,8 +1872,10 @@ int usb_authorize_device(struct usb_device *usb_dev)
10366 - }
10367 - }
10368 - dev_info(&usb_dev->dev, "authorized to connect\n");
10369 --error_configure:
10370 -+
10371 -+error_enumerate:
10372 - error_device_descriptor:
10373 -+ usb_autosuspend_device(usb_dev);
10374 - error_autoresume:
10375 - out_authorized:
10376 - usb_unlock_device(usb_dev); // complements locktree
10377 -diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
10378 -index 7ec3041..8752e55 100644
10379 ---- a/drivers/usb/core/sysfs.c
10380 -+++ b/drivers/usb/core/sysfs.c
10381 -@@ -82,9 +82,13 @@ static ssize_t show_##name(struct device *dev, \
10382 - struct device_attribute *attr, char *buf) \
10383 - { \
10384 - struct usb_device *udev; \
10385 -+ int retval; \
10386 - \
10387 - udev = to_usb_device(dev); \
10388 -- return sprintf(buf, "%s\n", udev->name); \
10389 -+ usb_lock_device(udev); \
10390 -+ retval = sprintf(buf, "%s\n", udev->name); \
10391 -+ usb_unlock_device(udev); \
10392 -+ return retval; \
10393 - } \
10394 - static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL);
10395 -
10396 -diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c
10397 -index 1d8e39a..62ff5e7 100644
10398 ---- a/drivers/usb/misc/appledisplay.c
10399 -+++ b/drivers/usb/misc/appledisplay.c
10400 -@@ -72,8 +72,8 @@ struct appledisplay {
10401 - struct usb_device *udev; /* usb device */
10402 - struct urb *urb; /* usb request block */
10403 - struct backlight_device *bd; /* backlight device */
10404 -- char *urbdata; /* interrupt URB data buffer */
10405 -- char *msgdata; /* control message data buffer */
10406 -+ u8 *urbdata; /* interrupt URB data buffer */
10407 -+ u8 *msgdata; /* control message data buffer */
10408 -
10409 - struct delayed_work work;
10410 - int button_pressed;
10411 -diff --git a/drivers/usb/misc/emi62.c b/drivers/usb/misc/emi62.c
10412 -index 602ee05..59860b3 100644
10413 ---- a/drivers/usb/misc/emi62.c
10414 -+++ b/drivers/usb/misc/emi62.c
10415 -@@ -167,7 +167,7 @@ static int emi62_load_firmware (struct usb_device *dev)
10416 - err("%s - error loading firmware: error = %d", __func__, err);
10417 - goto wraperr;
10418 - }
10419 -- } while (i > 0);
10420 -+ } while (rec);
10421 -
10422 - /* Assert reset (stop the CPU in the EMI) */
10423 - err = emi62_set_reset(dev,1);
10424 -diff --git a/drivers/usb/musb/musb_gadget_ep0.c b/drivers/usb/musb/musb_gadget_ep0.c
10425 -index 1c44b97..067e5a9 100644
10426 ---- a/drivers/usb/musb/musb_gadget_ep0.c
10427 -+++ b/drivers/usb/musb/musb_gadget_ep0.c
10428 -@@ -647,7 +647,7 @@ irqreturn_t musb_g_ep0_irq(struct musb *musb)
10429 - musb->ep0_state = MUSB_EP0_STAGE_STATUSIN;
10430 - break;
10431 - default:
10432 -- ERR("SetupEnd came in a wrong ep0stage %s",
10433 -+ ERR("SetupEnd came in a wrong ep0stage %s\n",
10434 - decode_ep0stage(musb->ep0_state));
10435 - }
10436 - csr = musb_readw(regs, MUSB_CSR0);
10437 -@@ -770,12 +770,18 @@ setup:
10438 - handled = service_zero_data_request(
10439 - musb, &setup);
10440 -
10441 -+ /*
10442 -+ * We're expecting no data in any case, so
10443 -+ * always set the DATAEND bit -- doing this
10444 -+ * here helps avoid SetupEnd interrupt coming
10445 -+ * in the idle stage when we're stalling...
10446 -+ */
10447 -+ musb->ackpend |= MUSB_CSR0_P_DATAEND;
10448 -+
10449 - /* status stage might be immediate */
10450 -- if (handled > 0) {
10451 -- musb->ackpend |= MUSB_CSR0_P_DATAEND;
10452 -+ if (handled > 0)
10453 - musb->ep0_state =
10454 - MUSB_EP0_STAGE_STATUSIN;
10455 -- }
10456 - break;
10457 -
10458 - /* sequence #1 (IN to host), includes GET_STATUS
10459 -diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c
10460 -index dffc8a1..be3dff1 100644
10461 ---- a/drivers/usb/serial/option.c
10462 -+++ b/drivers/usb/serial/option.c
10463 -@@ -340,6 +340,10 @@ static int option_resume(struct usb_serial *serial);
10464 - #define FOUR_G_SYSTEMS_VENDOR_ID 0x1c9e
10465 - #define FOUR_G_SYSTEMS_PRODUCT_W14 0x9603
10466 -
10467 -+/* Haier products */
10468 -+#define HAIER_VENDOR_ID 0x201e
10469 -+#define HAIER_PRODUCT_CE100 0x2009
10470 -+
10471 - static struct usb_device_id option_ids[] = {
10472 - { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
10473 - { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
10474 -@@ -641,6 +645,7 @@ static struct usb_device_id option_ids[] = {
10475 - { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) },
10476 - { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) },
10477 - { USB_DEVICE(FOUR_G_SYSTEMS_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14) },
10478 -+ { USB_DEVICE(HAIER_VENDOR_ID, HAIER_PRODUCT_CE100) },
10479 - { } /* Terminating entry */
10480 - };
10481 - MODULE_DEVICE_TABLE(usb, option_ids);
10482 -diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
10483 -index 3800da7..649fcdf 100644
10484 ---- a/drivers/xen/xenbus/xenbus_probe.c
10485 -+++ b/drivers/xen/xenbus/xenbus_probe.c
10486 -@@ -843,7 +843,7 @@ postcore_initcall(xenbus_probe_init);
10487 -
10488 - MODULE_LICENSE("GPL");
10489 -
10490 --static int is_disconnected_device(struct device *dev, void *data)
10491 -+static int is_device_connecting(struct device *dev, void *data)
10492 - {
10493 - struct xenbus_device *xendev = to_xenbus_device(dev);
10494 - struct device_driver *drv = data;
10495 -@@ -861,14 +861,15 @@ static int is_disconnected_device(struct device *dev, void *data)
10496 - return 0;
10497 -
10498 - xendrv = to_xenbus_driver(dev->driver);
10499 -- return (xendev->state != XenbusStateConnected ||
10500 -- (xendrv->is_ready && !xendrv->is_ready(xendev)));
10501 -+ return (xendev->state < XenbusStateConnected ||
10502 -+ (xendev->state == XenbusStateConnected &&
10503 -+ xendrv->is_ready && !xendrv->is_ready(xendev)));
10504 - }
10505 -
10506 --static int exists_disconnected_device(struct device_driver *drv)
10507 -+static int exists_connecting_device(struct device_driver *drv)
10508 - {
10509 - return bus_for_each_dev(&xenbus_frontend.bus, NULL, drv,
10510 -- is_disconnected_device);
10511 -+ is_device_connecting);
10512 - }
10513 -
10514 - static int print_device_status(struct device *dev, void *data)
10515 -@@ -884,10 +885,13 @@ static int print_device_status(struct device *dev, void *data)
10516 - /* Information only: is this too noisy? */
10517 - printk(KERN_INFO "XENBUS: Device with no driver: %s\n",
10518 - xendev->nodename);
10519 -- } else if (xendev->state != XenbusStateConnected) {
10520 -+ } else if (xendev->state < XenbusStateConnected) {
10521 -+ enum xenbus_state rstate = XenbusStateUnknown;
10522 -+ if (xendev->otherend)
10523 -+ rstate = xenbus_read_driver_state(xendev->otherend);
10524 - printk(KERN_WARNING "XENBUS: Timeout connecting "
10525 -- "to device: %s (state %d)\n",
10526 -- xendev->nodename, xendev->state);
10527 -+ "to device: %s (local state %d, remote state %d)\n",
10528 -+ xendev->nodename, xendev->state, rstate);
10529 - }
10530 -
10531 - return 0;
10532 -@@ -897,7 +901,7 @@ static int print_device_status(struct device *dev, void *data)
10533 - static int ready_to_wait_for_devices;
10534 -
10535 - /*
10536 -- * On a 10 second timeout, wait for all devices currently configured. We need
10537 -+ * On a 5-minute timeout, wait for all devices currently configured. We need
10538 - * to do this to guarantee that the filesystems and / or network devices
10539 - * needed for boot are available, before we can allow the boot to proceed.
10540 - *
10541 -@@ -912,18 +916,30 @@ static int ready_to_wait_for_devices;
10542 - */
10543 - static void wait_for_devices(struct xenbus_driver *xendrv)
10544 - {
10545 -- unsigned long timeout = jiffies + 10*HZ;
10546 -+ unsigned long start = jiffies;
10547 - struct device_driver *drv = xendrv ? &xendrv->driver : NULL;
10548 -+ unsigned int seconds_waited = 0;
10549 -
10550 - if (!ready_to_wait_for_devices || !xen_domain())
10551 - return;
10552 -
10553 -- while (exists_disconnected_device(drv)) {
10554 -- if (time_after(jiffies, timeout))
10555 -- break;
10556 -+ while (exists_connecting_device(drv)) {
10557 -+ if (time_after(jiffies, start + (seconds_waited+5)*HZ)) {
10558 -+ if (!seconds_waited)
10559 -+ printk(KERN_WARNING "XENBUS: Waiting for "
10560 -+ "devices to initialise: ");
10561 -+ seconds_waited += 5;
10562 -+ printk("%us...", 300 - seconds_waited);
10563 -+ if (seconds_waited == 300)
10564 -+ break;
10565 -+ }
10566 -+
10567 - schedule_timeout_interruptible(HZ/10);
10568 - }
10569 -
10570 -+ if (seconds_waited)
10571 -+ printk("\n");
10572 -+
10573 - bus_for_each_dev(&xenbus_frontend.bus, NULL, drv,
10574 - print_device_status);
10575 - }
10576 -diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
10577 -index 63ea83f..3bbcaa7 100644
10578 ---- a/fs/cifs/connect.c
10579 -+++ b/fs/cifs/connect.c
10580 -@@ -2287,12 +2287,12 @@ int
10581 - cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
10582 - char *mount_data_global, const char *devname)
10583 - {
10584 -- int rc = 0;
10585 -+ int rc;
10586 - int xid;
10587 - struct smb_vol *volume_info;
10588 -- struct cifsSesInfo *pSesInfo = NULL;
10589 -- struct cifsTconInfo *tcon = NULL;
10590 -- struct TCP_Server_Info *srvTcp = NULL;
10591 -+ struct cifsSesInfo *pSesInfo;
10592 -+ struct cifsTconInfo *tcon;
10593 -+ struct TCP_Server_Info *srvTcp;
10594 - char *full_path;
10595 - char *mount_data = mount_data_global;
10596 - #ifdef CONFIG_CIFS_DFS_UPCALL
10597 -@@ -2301,6 +2301,10 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
10598 - int referral_walks_count = 0;
10599 - try_mount_again:
10600 - #endif
10601 -+ rc = 0;
10602 -+ tcon = NULL;
10603 -+ pSesInfo = NULL;
10604 -+ srvTcp = NULL;
10605 - full_path = NULL;
10606 -
10607 - xid = GetXid();
10608 -@@ -2597,6 +2601,7 @@ remote_path_check:
10609 -
10610 - cleanup_volume_info(&volume_info);
10611 - referral_walks_count++;
10612 -+ FreeXid(xid);
10613 - goto try_mount_again;
10614 - }
10615 - #else /* No DFS support, return error on mount */
10616 -diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
10617 -index bd2a9dd..d0a2afb 100644
10618 ---- a/fs/ext4/ext4.h
10619 -+++ b/fs/ext4/ext4.h
10620 -@@ -698,6 +698,10 @@ struct ext4_inode_info {
10621 - __u16 i_extra_isize;
10622 -
10623 - spinlock_t i_block_reservation_lock;
10624 -+#ifdef CONFIG_QUOTA
10625 -+ /* quota space reservation, managed internally by quota code */
10626 -+ qsize_t i_reserved_quota;
10627 -+#endif
10628 -
10629 - /* completed async DIOs that might need unwritten extents handling */
10630 - struct list_head i_aio_dio_complete_list;
10631 -@@ -1432,7 +1436,7 @@ extern int ext4_chunk_trans_blocks(struct inode *, int nrblocks);
10632 - extern int ext4_block_truncate_page(handle_t *handle,
10633 - struct address_space *mapping, loff_t from);
10634 - extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf);
10635 --extern qsize_t ext4_get_reserved_space(struct inode *inode);
10636 -+extern qsize_t *ext4_get_reserved_space(struct inode *inode);
10637 - extern int flush_aio_dio_completed_IO(struct inode *inode);
10638 - /* ioctl.c */
10639 - extern long ext4_ioctl(struct file *, unsigned int, unsigned long);
10640 -diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
10641 -index 1dae9a4..e233879 100644
10642 ---- a/fs/ext4/inode.c
10643 -+++ b/fs/ext4/inode.c
10644 -@@ -1045,17 +1045,12 @@ out:
10645 - return err;
10646 - }
10647 -
10648 --qsize_t ext4_get_reserved_space(struct inode *inode)
10649 -+#ifdef CONFIG_QUOTA
10650 -+qsize_t *ext4_get_reserved_space(struct inode *inode)
10651 - {
10652 -- unsigned long long total;
10653 --
10654 -- spin_lock(&EXT4_I(inode)->i_block_reservation_lock);
10655 -- total = EXT4_I(inode)->i_reserved_data_blocks +
10656 -- EXT4_I(inode)->i_reserved_meta_blocks;
10657 -- spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
10658 --
10659 -- return (total << inode->i_blkbits);
10660 -+ return &EXT4_I(inode)->i_reserved_quota;
10661 - }
10662 -+#endif
10663 - /*
10664 - * Calculate the number of metadata blocks need to reserve
10665 - * to allocate @blocks for non extent file based file
10666 -@@ -1858,19 +1853,17 @@ repeat:
10667 -
10668 - md_needed = mdblocks - EXT4_I(inode)->i_reserved_meta_blocks;
10669 - total = md_needed + nrblocks;
10670 -+ spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
10671 -
10672 - /*
10673 - * Make quota reservation here to prevent quota overflow
10674 - * later. Real quota accounting is done at pages writeout
10675 - * time.
10676 - */
10677 -- if (vfs_dq_reserve_block(inode, total)) {
10678 -- spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
10679 -+ if (vfs_dq_reserve_block(inode, total))
10680 - return -EDQUOT;
10681 -- }
10682 -
10683 - if (ext4_claim_free_blocks(sbi, total)) {
10684 -- spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
10685 - vfs_dq_release_reservation_block(inode, total);
10686 - if (ext4_should_retry_alloc(inode->i_sb, &retries)) {
10687 - yield();
10688 -@@ -1878,10 +1871,11 @@ repeat:
10689 - }
10690 - return -ENOSPC;
10691 - }
10692 -+ spin_lock(&EXT4_I(inode)->i_block_reservation_lock);
10693 - EXT4_I(inode)->i_reserved_data_blocks += nrblocks;
10694 -- EXT4_I(inode)->i_reserved_meta_blocks = mdblocks;
10695 --
10696 -+ EXT4_I(inode)->i_reserved_meta_blocks += md_needed;
10697 - spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
10698 -+
10699 - return 0; /* success */
10700 - }
10701 -
10702 -@@ -4850,6 +4844,9 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
10703 - ((__u64)le16_to_cpu(raw_inode->i_file_acl_high)) << 32;
10704 - inode->i_size = ext4_isize(raw_inode);
10705 - ei->i_disksize = inode->i_size;
10706 -+#ifdef CONFIG_QUOTA
10707 -+ ei->i_reserved_quota = 0;
10708 -+#endif
10709 - inode->i_generation = le32_to_cpu(raw_inode->i_generation);
10710 - ei->i_block_group = iloc.block_group;
10711 - ei->i_last_alloc_group = ~0;
10712 -diff --git a/fs/ext4/super.c b/fs/ext4/super.c
10713 -index 9ae5217..92943f2 100644
10714 ---- a/fs/ext4/super.c
10715 -+++ b/fs/ext4/super.c
10716 -@@ -704,6 +704,9 @@ static struct inode *ext4_alloc_inode(struct super_block *sb)
10717 - ei->i_allocated_meta_blocks = 0;
10718 - ei->i_delalloc_reserved_flag = 0;
10719 - spin_lock_init(&(ei->i_block_reservation_lock));
10720 -+#ifdef CONFIG_QUOTA
10721 -+ ei->i_reserved_quota = 0;
10722 -+#endif
10723 - INIT_LIST_HEAD(&ei->i_aio_dio_complete_list);
10724 - ei->cur_aio_dio = NULL;
10725 - ei->i_sync_tid = 0;
10726 -@@ -1001,7 +1004,9 @@ static const struct dquot_operations ext4_quota_operations = {
10727 - .reserve_space = dquot_reserve_space,
10728 - .claim_space = dquot_claim_space,
10729 - .release_rsv = dquot_release_reserved_space,
10730 -+#ifdef CONFIG_QUOTA
10731 - .get_reserved_space = ext4_get_reserved_space,
10732 -+#endif
10733 - .alloc_inode = dquot_alloc_inode,
10734 - .free_space = dquot_free_space,
10735 - .free_inode = dquot_free_inode,
10736 -diff --git a/fs/namei.c b/fs/namei.c
10737 -index d11f404..a2b3c28 100644
10738 ---- a/fs/namei.c
10739 -+++ b/fs/namei.c
10740 -@@ -234,6 +234,7 @@ int generic_permission(struct inode *inode, int mask,
10741 - /*
10742 - * Searching includes executable on directories, else just read.
10743 - */
10744 -+ mask &= MAY_READ | MAY_WRITE | MAY_EXEC;
10745 - if (mask == MAY_READ || (S_ISDIR(inode->i_mode) && !(mask & MAY_WRITE)))
10746 - if (capable(CAP_DAC_READ_SEARCH))
10747 - return 0;
10748 -diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
10749 -index 39b49c4..c4d07a8 100644
10750 ---- a/fs/quota/dquot.c
10751 -+++ b/fs/quota/dquot.c
10752 -@@ -1388,6 +1388,67 @@ void vfs_dq_drop(struct inode *inode)
10753 - EXPORT_SYMBOL(vfs_dq_drop);
10754 -
10755 - /*
10756 -+ * inode_reserved_space is managed internally by quota, and protected by
10757 -+ * i_lock similar to i_blocks+i_bytes.
10758 -+ */
10759 -+static qsize_t *inode_reserved_space(struct inode * inode)
10760 -+{
10761 -+ /* Filesystem must explicitly define it's own method in order to use
10762 -+ * quota reservation interface */
10763 -+ BUG_ON(!inode->i_sb->dq_op->get_reserved_space);
10764 -+ return inode->i_sb->dq_op->get_reserved_space(inode);
10765 -+}
10766 -+
10767 -+static void inode_add_rsv_space(struct inode *inode, qsize_t number)
10768 -+{
10769 -+ spin_lock(&inode->i_lock);
10770 -+ *inode_reserved_space(inode) += number;
10771 -+ spin_unlock(&inode->i_lock);
10772 -+}
10773 -+
10774 -+
10775 -+static void inode_claim_rsv_space(struct inode *inode, qsize_t number)
10776 -+{
10777 -+ spin_lock(&inode->i_lock);
10778 -+ *inode_reserved_space(inode) -= number;
10779 -+ __inode_add_bytes(inode, number);
10780 -+ spin_unlock(&inode->i_lock);
10781 -+}
10782 -+
10783 -+static void inode_sub_rsv_space(struct inode *inode, qsize_t number)
10784 -+{
10785 -+ spin_lock(&inode->i_lock);
10786 -+ *inode_reserved_space(inode) -= number;
10787 -+ spin_unlock(&inode->i_lock);
10788 -+}
10789 -+
10790 -+static qsize_t inode_get_rsv_space(struct inode *inode)
10791 -+{
10792 -+ qsize_t ret;
10793 -+ spin_lock(&inode->i_lock);
10794 -+ ret = *inode_reserved_space(inode);
10795 -+ spin_unlock(&inode->i_lock);
10796 -+ return ret;
10797 -+}
10798 -+
10799 -+static void inode_incr_space(struct inode *inode, qsize_t number,
10800 -+ int reserve)
10801 -+{
10802 -+ if (reserve)
10803 -+ inode_add_rsv_space(inode, number);
10804 -+ else
10805 -+ inode_add_bytes(inode, number);
10806 -+}
10807 -+
10808 -+static void inode_decr_space(struct inode *inode, qsize_t number, int reserve)
10809 -+{
10810 -+ if (reserve)
10811 -+ inode_sub_rsv_space(inode, number);
10812 -+ else
10813 -+ inode_sub_bytes(inode, number);
10814 -+}
10815 -+
10816 -+/*
10817 - * Following four functions update i_blocks+i_bytes fields and
10818 - * quota information (together with appropriate checks)
10819 - * NOTE: We absolutely rely on the fact that caller dirties
10820 -@@ -1405,6 +1466,21 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number,
10821 - int cnt, ret = QUOTA_OK;
10822 - char warntype[MAXQUOTAS];
10823 -
10824 -+ /*
10825 -+ * First test before acquiring mutex - solves deadlocks when we
10826 -+ * re-enter the quota code and are already holding the mutex
10827 -+ */
10828 -+ if (IS_NOQUOTA(inode)) {
10829 -+ inode_incr_space(inode, number, reserve);
10830 -+ goto out;
10831 -+ }
10832 -+
10833 -+ down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
10834 -+ if (IS_NOQUOTA(inode)) {
10835 -+ inode_incr_space(inode, number, reserve);
10836 -+ goto out_unlock;
10837 -+ }
10838 -+
10839 - for (cnt = 0; cnt < MAXQUOTAS; cnt++)
10840 - warntype[cnt] = QUOTA_NL_NOWARN;
10841 -
10842 -@@ -1415,7 +1491,8 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number,
10843 - if (check_bdq(inode->i_dquot[cnt], number, warn, warntype+cnt)
10844 - == NO_QUOTA) {
10845 - ret = NO_QUOTA;
10846 -- goto out_unlock;
10847 -+ spin_unlock(&dq_data_lock);
10848 -+ goto out_flush_warn;
10849 - }
10850 - }
10851 - for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
10852 -@@ -1426,64 +1503,32 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number,
10853 - else
10854 - dquot_incr_space(inode->i_dquot[cnt], number);
10855 - }
10856 -- if (!reserve)
10857 -- inode_add_bytes(inode, number);
10858 --out_unlock:
10859 -+ inode_incr_space(inode, number, reserve);
10860 - spin_unlock(&dq_data_lock);
10861 -- flush_warnings(inode->i_dquot, warntype);
10862 -- return ret;
10863 --}
10864 --
10865 --int dquot_alloc_space(struct inode *inode, qsize_t number, int warn)
10866 --{
10867 -- int cnt, ret = QUOTA_OK;
10868 --
10869 -- /*
10870 -- * First test before acquiring mutex - solves deadlocks when we
10871 -- * re-enter the quota code and are already holding the mutex
10872 -- */
10873 -- if (IS_NOQUOTA(inode)) {
10874 -- inode_add_bytes(inode, number);
10875 -- goto out;
10876 -- }
10877 --
10878 -- down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
10879 -- if (IS_NOQUOTA(inode)) {
10880 -- inode_add_bytes(inode, number);
10881 -- goto out_unlock;
10882 -- }
10883 --
10884 -- ret = __dquot_alloc_space(inode, number, warn, 0);
10885 -- if (ret == NO_QUOTA)
10886 -- goto out_unlock;
10887 -
10888 -+ if (reserve)
10889 -+ goto out_flush_warn;
10890 - /* Dirtify all the dquots - this can block when journalling */
10891 - for (cnt = 0; cnt < MAXQUOTAS; cnt++)
10892 - if (inode->i_dquot[cnt])
10893 - mark_dquot_dirty(inode->i_dquot[cnt]);
10894 -+out_flush_warn:
10895 -+ flush_warnings(inode->i_dquot, warntype);
10896 - out_unlock:
10897 - up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
10898 - out:
10899 - return ret;
10900 - }
10901 -+
10902 -+int dquot_alloc_space(struct inode *inode, qsize_t number, int warn)
10903 -+{
10904 -+ return __dquot_alloc_space(inode, number, warn, 0);
10905 -+}
10906 - EXPORT_SYMBOL(dquot_alloc_space);
10907 -
10908 - int dquot_reserve_space(struct inode *inode, qsize_t number, int warn)
10909 - {
10910 -- int ret = QUOTA_OK;
10911 --
10912 -- if (IS_NOQUOTA(inode))
10913 -- goto out;
10914 --
10915 -- down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
10916 -- if (IS_NOQUOTA(inode))
10917 -- goto out_unlock;
10918 --
10919 -- ret = __dquot_alloc_space(inode, number, warn, 1);
10920 --out_unlock:
10921 -- up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
10922 --out:
10923 -- return ret;
10924 -+ return __dquot_alloc_space(inode, number, warn, 1);
10925 - }
10926 - EXPORT_SYMBOL(dquot_reserve_space);
10927 -
10928 -@@ -1540,14 +1585,14 @@ int dquot_claim_space(struct inode *inode, qsize_t number)
10929 - int ret = QUOTA_OK;
10930 -
10931 - if (IS_NOQUOTA(inode)) {
10932 -- inode_add_bytes(inode, number);
10933 -+ inode_claim_rsv_space(inode, number);
10934 - goto out;
10935 - }
10936 -
10937 - down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
10938 - if (IS_NOQUOTA(inode)) {
10939 - up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
10940 -- inode_add_bytes(inode, number);
10941 -+ inode_claim_rsv_space(inode, number);
10942 - goto out;
10943 - }
10944 -
10945 -@@ -1559,7 +1604,7 @@ int dquot_claim_space(struct inode *inode, qsize_t number)
10946 - number);
10947 - }
10948 - /* Update inode bytes */
10949 -- inode_add_bytes(inode, number);
10950 -+ inode_claim_rsv_space(inode, number);
10951 - spin_unlock(&dq_data_lock);
10952 - /* Dirtify all the dquots - this can block when journalling */
10953 - for (cnt = 0; cnt < MAXQUOTAS; cnt++)
10954 -@@ -1572,38 +1617,9 @@ out:
10955 - EXPORT_SYMBOL(dquot_claim_space);
10956 -
10957 - /*
10958 -- * Release reserved quota space
10959 -- */
10960 --void dquot_release_reserved_space(struct inode *inode, qsize_t number)
10961 --{
10962 -- int cnt;
10963 --
10964 -- if (IS_NOQUOTA(inode))
10965 -- goto out;
10966 --
10967 -- down_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
10968 -- if (IS_NOQUOTA(inode))
10969 -- goto out_unlock;
10970 --
10971 -- spin_lock(&dq_data_lock);
10972 -- /* Release reserved dquots */
10973 -- for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
10974 -- if (inode->i_dquot[cnt])
10975 -- dquot_free_reserved_space(inode->i_dquot[cnt], number);
10976 -- }
10977 -- spin_unlock(&dq_data_lock);
10978 --
10979 --out_unlock:
10980 -- up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
10981 --out:
10982 -- return;
10983 --}
10984 --EXPORT_SYMBOL(dquot_release_reserved_space);
10985 --
10986 --/*
10987 - * This operation can block, but only after everything is updated
10988 - */
10989 --int dquot_free_space(struct inode *inode, qsize_t number)
10990 -+int __dquot_free_space(struct inode *inode, qsize_t number, int reserve)
10991 - {
10992 - unsigned int cnt;
10993 - char warntype[MAXQUOTAS];
10994 -@@ -1612,7 +1628,7 @@ int dquot_free_space(struct inode *inode, qsize_t number)
10995 - * re-enter the quota code and are already holding the mutex */
10996 - if (IS_NOQUOTA(inode)) {
10997 - out_sub:
10998 -- inode_sub_bytes(inode, number);
10999 -+ inode_decr_space(inode, number, reserve);
11000 - return QUOTA_OK;
11001 - }
11002 -
11003 -@@ -1627,21 +1643,43 @@ out_sub:
11004 - if (!inode->i_dquot[cnt])
11005 - continue;
11006 - warntype[cnt] = info_bdq_free(inode->i_dquot[cnt], number);
11007 -- dquot_decr_space(inode->i_dquot[cnt], number);
11008 -+ if (reserve)
11009 -+ dquot_free_reserved_space(inode->i_dquot[cnt], number);
11010 -+ else
11011 -+ dquot_decr_space(inode->i_dquot[cnt], number);
11012 - }
11013 -- inode_sub_bytes(inode, number);
11014 -+ inode_decr_space(inode, number, reserve);
11015 - spin_unlock(&dq_data_lock);
11016 -+
11017 -+ if (reserve)
11018 -+ goto out_unlock;
11019 - /* Dirtify all the dquots - this can block when journalling */
11020 - for (cnt = 0; cnt < MAXQUOTAS; cnt++)
11021 - if (inode->i_dquot[cnt])
11022 - mark_dquot_dirty(inode->i_dquot[cnt]);
11023 -+out_unlock:
11024 - flush_warnings(inode->i_dquot, warntype);
11025 - up_read(&sb_dqopt(inode->i_sb)->dqptr_sem);
11026 - return QUOTA_OK;
11027 - }
11028 -+
11029 -+int dquot_free_space(struct inode *inode, qsize_t number)
11030 -+{
11031 -+ return __dquot_free_space(inode, number, 0);
11032 -+}
11033 - EXPORT_SYMBOL(dquot_free_space);
11034 -
11035 - /*
11036 -+ * Release reserved quota space
11037 -+ */
11038 -+void dquot_release_reserved_space(struct inode *inode, qsize_t number)
11039 -+{
11040 -+ __dquot_free_space(inode, number, 1);
11041 -+
11042 -+}
11043 -+EXPORT_SYMBOL(dquot_release_reserved_space);
11044 -+
11045 -+/*
11046 - * This operation can block, but only after everything is updated
11047 - */
11048 - int dquot_free_inode(const struct inode *inode, qsize_t number)
11049 -@@ -1679,19 +1717,6 @@ int dquot_free_inode(const struct inode *inode, qsize_t number)
11050 - EXPORT_SYMBOL(dquot_free_inode);
11051 -
11052 - /*
11053 -- * call back function, get reserved quota space from underlying fs
11054 -- */
11055 --qsize_t dquot_get_reserved_space(struct inode *inode)
11056 --{
11057 -- qsize_t reserved_space = 0;
11058 --
11059 -- if (sb_any_quota_active(inode->i_sb) &&
11060 -- inode->i_sb->dq_op->get_reserved_space)
11061 -- reserved_space = inode->i_sb->dq_op->get_reserved_space(inode);
11062 -- return reserved_space;
11063 --}
11064 --
11065 --/*
11066 - * Transfer the number of inode and blocks from one diskquota to an other.
11067 - *
11068 - * This operation can block, but only after everything is updated
11069 -@@ -1734,7 +1759,7 @@ int dquot_transfer(struct inode *inode, struct iattr *iattr)
11070 - }
11071 - spin_lock(&dq_data_lock);
11072 - cur_space = inode_get_bytes(inode);
11073 -- rsv_space = dquot_get_reserved_space(inode);
11074 -+ rsv_space = inode_get_rsv_space(inode);
11075 - space = cur_space + rsv_space;
11076 - /* Build the transfer_from list and check the limits */
11077 - for (cnt = 0; cnt < MAXQUOTAS; cnt++) {
11078 -diff --git a/fs/stat.c b/fs/stat.c
11079 -index 075694e..c4ecd52 100644
11080 ---- a/fs/stat.c
11081 -+++ b/fs/stat.c
11082 -@@ -401,9 +401,9 @@ SYSCALL_DEFINE4(fstatat64, int, dfd, char __user *, filename,
11083 - }
11084 - #endif /* __ARCH_WANT_STAT64 */
11085 -
11086 --void inode_add_bytes(struct inode *inode, loff_t bytes)
11087 -+/* Caller is here responsible for sufficient locking (ie. inode->i_lock) */
11088 -+void __inode_add_bytes(struct inode *inode, loff_t bytes)
11089 - {
11090 -- spin_lock(&inode->i_lock);
11091 - inode->i_blocks += bytes >> 9;
11092 - bytes &= 511;
11093 - inode->i_bytes += bytes;
11094 -@@ -411,6 +411,12 @@ void inode_add_bytes(struct inode *inode, loff_t bytes)
11095 - inode->i_blocks++;
11096 - inode->i_bytes -= 512;
11097 - }
11098 -+}
11099 -+
11100 -+void inode_add_bytes(struct inode *inode, loff_t bytes)
11101 -+{
11102 -+ spin_lock(&inode->i_lock);
11103 -+ __inode_add_bytes(inode, bytes);
11104 - spin_unlock(&inode->i_lock);
11105 - }
11106 -
11107 -diff --git a/fs/udf/super.c b/fs/udf/super.c
11108 -index 9d1b8c2..1e4543c 100644
11109 ---- a/fs/udf/super.c
11110 -+++ b/fs/udf/super.c
11111 -@@ -1078,21 +1078,39 @@ static int udf_fill_partdesc_info(struct super_block *sb,
11112 - return 0;
11113 - }
11114 -
11115 --static int udf_load_vat(struct super_block *sb, int p_index, int type1_index)
11116 -+static void udf_find_vat_block(struct super_block *sb, int p_index,
11117 -+ int type1_index, sector_t start_block)
11118 - {
11119 - struct udf_sb_info *sbi = UDF_SB(sb);
11120 - struct udf_part_map *map = &sbi->s_partmaps[p_index];
11121 -+ sector_t vat_block;
11122 - struct kernel_lb_addr ino;
11123 -+
11124 -+ /*
11125 -+ * VAT file entry is in the last recorded block. Some broken disks have
11126 -+ * it a few blocks before so try a bit harder...
11127 -+ */
11128 -+ ino.partitionReferenceNum = type1_index;
11129 -+ for (vat_block = start_block;
11130 -+ vat_block >= map->s_partition_root &&
11131 -+ vat_block >= start_block - 3 &&
11132 -+ !sbi->s_vat_inode; vat_block--) {
11133 -+ ino.logicalBlockNum = vat_block - map->s_partition_root;
11134 -+ sbi->s_vat_inode = udf_iget(sb, &ino);
11135 -+ }
11136 -+}
11137 -+
11138 -+static int udf_load_vat(struct super_block *sb, int p_index, int type1_index)
11139 -+{
11140 -+ struct udf_sb_info *sbi = UDF_SB(sb);
11141 -+ struct udf_part_map *map = &sbi->s_partmaps[p_index];
11142 - struct buffer_head *bh = NULL;
11143 - struct udf_inode_info *vati;
11144 - uint32_t pos;
11145 - struct virtualAllocationTable20 *vat20;
11146 - sector_t blocks = sb->s_bdev->bd_inode->i_size >> sb->s_blocksize_bits;
11147 -
11148 -- /* VAT file entry is in the last recorded block */
11149 -- ino.partitionReferenceNum = type1_index;
11150 -- ino.logicalBlockNum = sbi->s_last_block - map->s_partition_root;
11151 -- sbi->s_vat_inode = udf_iget(sb, &ino);
11152 -+ udf_find_vat_block(sb, p_index, type1_index, sbi->s_last_block);
11153 - if (!sbi->s_vat_inode &&
11154 - sbi->s_last_block != blocks - 1) {
11155 - printk(KERN_NOTICE "UDF-fs: Failed to read VAT inode from the"
11156 -@@ -1100,9 +1118,7 @@ static int udf_load_vat(struct super_block *sb, int p_index, int type1_index)
11157 - "block of the device (%lu).\n",
11158 - (unsigned long)sbi->s_last_block,
11159 - (unsigned long)blocks - 1);
11160 -- ino.partitionReferenceNum = type1_index;
11161 -- ino.logicalBlockNum = blocks - 1 - map->s_partition_root;
11162 -- sbi->s_vat_inode = udf_iget(sb, &ino);
11163 -+ udf_find_vat_block(sb, p_index, type1_index, blocks - 1);
11164 - }
11165 - if (!sbi->s_vat_inode)
11166 - return 1;
11167 -diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h
11168 -index 789cf5f..d77b547 100644
11169 ---- a/include/linux/cpumask.h
11170 -+++ b/include/linux/cpumask.h
11171 -@@ -84,6 +84,7 @@ extern const struct cpumask *const cpu_active_mask;
11172 - #define num_online_cpus() cpumask_weight(cpu_online_mask)
11173 - #define num_possible_cpus() cpumask_weight(cpu_possible_mask)
11174 - #define num_present_cpus() cpumask_weight(cpu_present_mask)
11175 -+#define num_active_cpus() cpumask_weight(cpu_active_mask)
11176 - #define cpu_online(cpu) cpumask_test_cpu((cpu), cpu_online_mask)
11177 - #define cpu_possible(cpu) cpumask_test_cpu((cpu), cpu_possible_mask)
11178 - #define cpu_present(cpu) cpumask_test_cpu((cpu), cpu_present_mask)
11179 -@@ -92,6 +93,7 @@ extern const struct cpumask *const cpu_active_mask;
11180 - #define num_online_cpus() 1
11181 - #define num_possible_cpus() 1
11182 - #define num_present_cpus() 1
11183 -+#define num_active_cpus() 1
11184 - #define cpu_online(cpu) ((cpu) == 0)
11185 - #define cpu_possible(cpu) ((cpu) == 0)
11186 - #define cpu_present(cpu) ((cpu) == 0)
11187 -diff --git a/include/linux/fs.h b/include/linux/fs.h
11188 -index 2620a8c..98ea200 100644
11189 ---- a/include/linux/fs.h
11190 -+++ b/include/linux/fs.h
11191 -@@ -2314,6 +2314,7 @@ extern const struct inode_operations page_symlink_inode_operations;
11192 - extern int generic_readlink(struct dentry *, char __user *, int);
11193 - extern void generic_fillattr(struct inode *, struct kstat *);
11194 - extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
11195 -+void __inode_add_bytes(struct inode *inode, loff_t bytes);
11196 - void inode_add_bytes(struct inode *inode, loff_t bytes);
11197 - void inode_sub_bytes(struct inode *inode, loff_t bytes);
11198 - loff_t inode_get_bytes(struct inode *inode);
11199 -diff --git a/include/linux/quota.h b/include/linux/quota.h
11200 -index 78c4889..8fd8efc 100644
11201 ---- a/include/linux/quota.h
11202 -+++ b/include/linux/quota.h
11203 -@@ -313,8 +313,9 @@ struct dquot_operations {
11204 - int (*claim_space) (struct inode *, qsize_t);
11205 - /* release rsved quota for delayed alloc */
11206 - void (*release_rsv) (struct inode *, qsize_t);
11207 -- /* get reserved quota for delayed alloc */
11208 -- qsize_t (*get_reserved_space) (struct inode *);
11209 -+ /* get reserved quota for delayed alloc, value returned is managed by
11210 -+ * quota code only */
11211 -+ qsize_t *(*get_reserved_space) (struct inode *);
11212 - };
11213 -
11214 - /* Operations handling requests from userspace */
11215 -diff --git a/include/linux/security.h b/include/linux/security.h
11216 -index 239e40d..d40d23f 100644
11217 ---- a/include/linux/security.h
11218 -+++ b/include/linux/security.h
11219 -@@ -95,8 +95,13 @@ struct seq_file;
11220 - extern int cap_netlink_send(struct sock *sk, struct sk_buff *skb);
11221 - extern int cap_netlink_recv(struct sk_buff *skb, int cap);
11222 -
11223 -+#ifdef CONFIG_MMU
11224 - extern unsigned long mmap_min_addr;
11225 - extern unsigned long dac_mmap_min_addr;
11226 -+#else
11227 -+#define dac_mmap_min_addr 0UL
11228 -+#endif
11229 -+
11230 - /*
11231 - * Values used in the task_security_ops calls
11232 - */
11233 -@@ -121,6 +126,7 @@ struct request_sock;
11234 - #define LSM_UNSAFE_PTRACE 2
11235 - #define LSM_UNSAFE_PTRACE_CAP 4
11236 -
11237 -+#ifdef CONFIG_MMU
11238 - /*
11239 - * If a hint addr is less than mmap_min_addr change hint to be as
11240 - * low as possible but still greater than mmap_min_addr
11241 -@@ -135,6 +141,7 @@ static inline unsigned long round_hint_to_min(unsigned long hint)
11242 - }
11243 - extern int mmap_min_addr_handler(struct ctl_table *table, int write,
11244 - void __user *buffer, size_t *lenp, loff_t *ppos);
11245 -+#endif
11246 -
11247 - #ifdef CONFIG_SECURITY
11248 -
11249 -diff --git a/include/net/ip.h b/include/net/ip.h
11250 -index 2f47e54..69db943 100644
11251 ---- a/include/net/ip.h
11252 -+++ b/include/net/ip.h
11253 -@@ -342,6 +342,7 @@ enum ip_defrag_users
11254 - IP_DEFRAG_CALL_RA_CHAIN,
11255 - IP_DEFRAG_CONNTRACK_IN,
11256 - IP_DEFRAG_CONNTRACK_OUT,
11257 -+ IP_DEFRAG_CONNTRACK_BRIDGE_IN,
11258 - IP_DEFRAG_VS_IN,
11259 - IP_DEFRAG_VS_OUT,
11260 - IP_DEFRAG_VS_FWD
11261 -diff --git a/include/net/ipv6.h b/include/net/ipv6.h
11262 -index 8c31d8a..639bbf0 100644
11263 ---- a/include/net/ipv6.h
11264 -+++ b/include/net/ipv6.h
11265 -@@ -354,8 +354,16 @@ static inline int ipv6_prefix_equal(const struct in6_addr *a1,
11266 -
11267 - struct inet_frag_queue;
11268 -
11269 -+enum ip6_defrag_users {
11270 -+ IP6_DEFRAG_LOCAL_DELIVER,
11271 -+ IP6_DEFRAG_CONNTRACK_IN,
11272 -+ IP6_DEFRAG_CONNTRACK_OUT,
11273 -+ IP6_DEFRAG_CONNTRACK_BRIDGE_IN,
11274 -+};
11275 -+
11276 - struct ip6_create_arg {
11277 - __be32 id;
11278 -+ u32 user;
11279 - struct in6_addr *src;
11280 - struct in6_addr *dst;
11281 - };
11282 -diff --git a/include/net/netfilter/ipv6/nf_conntrack_ipv6.h b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h
11283 -index abc55ad..1ee717e 100644
11284 ---- a/include/net/netfilter/ipv6/nf_conntrack_ipv6.h
11285 -+++ b/include/net/netfilter/ipv6/nf_conntrack_ipv6.h
11286 -@@ -9,7 +9,7 @@ extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmpv6;
11287 -
11288 - extern int nf_ct_frag6_init(void);
11289 - extern void nf_ct_frag6_cleanup(void);
11290 --extern struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb);
11291 -+extern struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb, u32 user);
11292 - extern void nf_ct_frag6_output(unsigned int hooknum, struct sk_buff *skb,
11293 - struct net_device *in,
11294 - struct net_device *out,
11295 -diff --git a/kernel/cpu.c b/kernel/cpu.c
11296 -index 6ba0f1e..b216886 100644
11297 ---- a/kernel/cpu.c
11298 -+++ b/kernel/cpu.c
11299 -@@ -212,6 +212,8 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
11300 - err = __raw_notifier_call_chain(&cpu_chain, CPU_DOWN_PREPARE | mod,
11301 - hcpu, -1, &nr_calls);
11302 - if (err == NOTIFY_BAD) {
11303 -+ set_cpu_active(cpu, true);
11304 -+
11305 - nr_calls--;
11306 - __raw_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED | mod,
11307 - hcpu, nr_calls, NULL);
11308 -@@ -223,11 +225,11 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen)
11309 -
11310 - /* Ensure that we are not runnable on dying cpu */
11311 - cpumask_copy(old_allowed, &current->cpus_allowed);
11312 -- set_cpus_allowed_ptr(current,
11313 -- cpumask_of(cpumask_any_but(cpu_online_mask, cpu)));
11314 -+ set_cpus_allowed_ptr(current, cpu_active_mask);
11315 -
11316 - err = __stop_machine(take_cpu_down, &tcd_param, cpumask_of(cpu));
11317 - if (err) {
11318 -+ set_cpu_active(cpu, true);
11319 - /* CPU didn't die: tell everyone. Can't complain. */
11320 - if (raw_notifier_call_chain(&cpu_chain, CPU_DOWN_FAILED | mod,
11321 - hcpu) == NOTIFY_BAD)
11322 -@@ -292,9 +294,6 @@ int __ref cpu_down(unsigned int cpu)
11323 -
11324 - err = _cpu_down(cpu, 0);
11325 -
11326 -- if (cpu_online(cpu))
11327 -- set_cpu_active(cpu, true);
11328 --
11329 - out:
11330 - cpu_maps_update_done();
11331 - stop_machine_destroy();
11332 -@@ -387,6 +386,15 @@ int disable_nonboot_cpus(void)
11333 - * with the userspace trying to use the CPU hotplug at the same time
11334 - */
11335 - cpumask_clear(frozen_cpus);
11336 -+
11337 -+ for_each_online_cpu(cpu) {
11338 -+ if (cpu == first_cpu)
11339 -+ continue;
11340 -+ set_cpu_active(cpu, false);
11341 -+ }
11342 -+
11343 -+ synchronize_sched();
11344 -+
11345 - printk("Disabling non-boot CPUs ...\n");
11346 - for_each_online_cpu(cpu) {
11347 - if (cpu == first_cpu)
11348 -diff --git a/kernel/cpuset.c b/kernel/cpuset.c
11349 -index b5cb469..39e5121 100644
11350 ---- a/kernel/cpuset.c
11351 -+++ b/kernel/cpuset.c
11352 -@@ -873,7 +873,7 @@ static int update_cpumask(struct cpuset *cs, struct cpuset *trialcs,
11353 - if (retval < 0)
11354 - return retval;
11355 -
11356 -- if (!cpumask_subset(trialcs->cpus_allowed, cpu_online_mask))
11357 -+ if (!cpumask_subset(trialcs->cpus_allowed, cpu_active_mask))
11358 - return -EINVAL;
11359 - }
11360 - retval = validate_change(cs, trialcs);
11361 -@@ -2011,7 +2011,7 @@ static void scan_for_empty_cpusets(struct cpuset *root)
11362 - }
11363 -
11364 - /* Continue past cpusets with all cpus, mems online */
11365 -- if (cpumask_subset(cp->cpus_allowed, cpu_online_mask) &&
11366 -+ if (cpumask_subset(cp->cpus_allowed, cpu_active_mask) &&
11367 - nodes_subset(cp->mems_allowed, node_states[N_HIGH_MEMORY]))
11368 - continue;
11369 -
11370 -@@ -2020,7 +2020,7 @@ static void scan_for_empty_cpusets(struct cpuset *root)
11371 - /* Remove offline cpus and mems from this cpuset. */
11372 - mutex_lock(&callback_mutex);
11373 - cpumask_and(cp->cpus_allowed, cp->cpus_allowed,
11374 -- cpu_online_mask);
11375 -+ cpu_active_mask);
11376 - nodes_and(cp->mems_allowed, cp->mems_allowed,
11377 - node_states[N_HIGH_MEMORY]);
11378 - mutex_unlock(&callback_mutex);
11379 -@@ -2058,8 +2058,10 @@ static int cpuset_track_online_cpus(struct notifier_block *unused_nb,
11380 - switch (phase) {
11381 - case CPU_ONLINE:
11382 - case CPU_ONLINE_FROZEN:
11383 -- case CPU_DEAD:
11384 -- case CPU_DEAD_FROZEN:
11385 -+ case CPU_DOWN_PREPARE:
11386 -+ case CPU_DOWN_PREPARE_FROZEN:
11387 -+ case CPU_DOWN_FAILED:
11388 -+ case CPU_DOWN_FAILED_FROZEN:
11389 - break;
11390 -
11391 - default:
11392 -@@ -2068,7 +2070,7 @@ static int cpuset_track_online_cpus(struct notifier_block *unused_nb,
11393 -
11394 - cgroup_lock();
11395 - mutex_lock(&callback_mutex);
11396 -- cpumask_copy(top_cpuset.cpus_allowed, cpu_online_mask);
11397 -+ cpumask_copy(top_cpuset.cpus_allowed, cpu_active_mask);
11398 - mutex_unlock(&callback_mutex);
11399 - scan_for_empty_cpusets(&top_cpuset);
11400 - ndoms = generate_sched_domains(&doms, &attr);
11401 -@@ -2115,7 +2117,7 @@ static int cpuset_track_online_nodes(struct notifier_block *self,
11402 -
11403 - void __init cpuset_init_smp(void)
11404 - {
11405 -- cpumask_copy(top_cpuset.cpus_allowed, cpu_online_mask);
11406 -+ cpumask_copy(top_cpuset.cpus_allowed, cpu_active_mask);
11407 - top_cpuset.mems_allowed = node_states[N_HIGH_MEMORY];
11408 -
11409 - hotcpu_notifier(cpuset_track_online_cpus, 0);
11410 -diff --git a/kernel/sched.c b/kernel/sched.c
11411 -index d079a9f..dd0dccd 100644
11412 ---- a/kernel/sched.c
11413 -+++ b/kernel/sched.c
11414 -@@ -2036,6 +2036,9 @@ task_hot(struct task_struct *p, u64 now, struct sched_domain *sd)
11415 - {
11416 - s64 delta;
11417 -
11418 -+ if (p->sched_class != &fair_sched_class)
11419 -+ return 0;
11420 -+
11421 - /*
11422 - * Buddy candidates are cache hot:
11423 - */
11424 -@@ -2044,9 +2047,6 @@ task_hot(struct task_struct *p, u64 now, struct sched_domain *sd)
11425 - &p->se == cfs_rq_of(&p->se)->last))
11426 - return 1;
11427 -
11428 -- if (p->sched_class != &fair_sched_class)
11429 -- return 0;
11430 --
11431 - if (sysctl_sched_migration_cost == -1)
11432 - return 1;
11433 - if (sysctl_sched_migration_cost == 0)
11434 -@@ -4139,7 +4139,7 @@ static int load_balance(int this_cpu, struct rq *this_rq,
11435 - unsigned long flags;
11436 - struct cpumask *cpus = __get_cpu_var(load_balance_tmpmask);
11437 -
11438 -- cpumask_copy(cpus, cpu_online_mask);
11439 -+ cpumask_copy(cpus, cpu_active_mask);
11440 -
11441 - /*
11442 - * When power savings policy is enabled for the parent domain, idle
11443 -@@ -4302,7 +4302,7 @@ load_balance_newidle(int this_cpu, struct rq *this_rq, struct sched_domain *sd)
11444 - int all_pinned = 0;
11445 - struct cpumask *cpus = __get_cpu_var(load_balance_tmpmask);
11446 -
11447 -- cpumask_copy(cpus, cpu_online_mask);
11448 -+ cpumask_copy(cpus, cpu_active_mask);
11449 -
11450 - /*
11451 - * When power savings policy is enabled for the parent domain, idle
11452 -@@ -4699,7 +4699,7 @@ int select_nohz_load_balancer(int stop_tick)
11453 - cpumask_set_cpu(cpu, nohz.cpu_mask);
11454 -
11455 - /* time for ilb owner also to sleep */
11456 -- if (cpumask_weight(nohz.cpu_mask) == num_online_cpus()) {
11457 -+ if (cpumask_weight(nohz.cpu_mask) == num_active_cpus()) {
11458 - if (atomic_read(&nohz.load_balancer) == cpu)
11459 - atomic_set(&nohz.load_balancer, -1);
11460 - return 0;
11461 -@@ -7075,7 +7075,7 @@ int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask)
11462 - int ret = 0;
11463 -
11464 - rq = task_rq_lock(p, &flags);
11465 -- if (!cpumask_intersects(new_mask, cpu_online_mask)) {
11466 -+ if (!cpumask_intersects(new_mask, cpu_active_mask)) {
11467 - ret = -EINVAL;
11468 - goto out;
11469 - }
11470 -@@ -7097,7 +7097,7 @@ int set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask)
11471 - if (cpumask_test_cpu(task_cpu(p), new_mask))
11472 - goto out;
11473 -
11474 -- if (migrate_task(p, cpumask_any_and(cpu_online_mask, new_mask), &req)) {
11475 -+ if (migrate_task(p, cpumask_any_and(cpu_active_mask, new_mask), &req)) {
11476 - /* Need help from migration thread: drop lock and wait. */
11477 - struct task_struct *mt = rq->migration_thread;
11478 -
11479 -@@ -7251,19 +7251,19 @@ static void move_task_off_dead_cpu(int dead_cpu, struct task_struct *p)
11480 -
11481 - again:
11482 - /* Look for allowed, online CPU in same node. */
11483 -- for_each_cpu_and(dest_cpu, nodemask, cpu_online_mask)
11484 -+ for_each_cpu_and(dest_cpu, nodemask, cpu_active_mask)
11485 - if (cpumask_test_cpu(dest_cpu, &p->cpus_allowed))
11486 - goto move;
11487 -
11488 - /* Any allowed, online CPU? */
11489 -- dest_cpu = cpumask_any_and(&p->cpus_allowed, cpu_online_mask);
11490 -+ dest_cpu = cpumask_any_and(&p->cpus_allowed, cpu_active_mask);
11491 - if (dest_cpu < nr_cpu_ids)
11492 - goto move;
11493 -
11494 - /* No more Mr. Nice Guy. */
11495 - if (dest_cpu >= nr_cpu_ids) {
11496 - cpuset_cpus_allowed_locked(p, &p->cpus_allowed);
11497 -- dest_cpu = cpumask_any_and(cpu_online_mask, &p->cpus_allowed);
11498 -+ dest_cpu = cpumask_any_and(cpu_active_mask, &p->cpus_allowed);
11499 -
11500 - /*
11501 - * Don't tell them about moving exiting tasks or
11502 -@@ -7292,7 +7292,7 @@ move:
11503 - */
11504 - static void migrate_nr_uninterruptible(struct rq *rq_src)
11505 - {
11506 -- struct rq *rq_dest = cpu_rq(cpumask_any(cpu_online_mask));
11507 -+ struct rq *rq_dest = cpu_rq(cpumask_any(cpu_active_mask));
11508 - unsigned long flags;
11509 -
11510 - local_irq_save(flags);
11511 -@@ -7546,7 +7546,7 @@ static ctl_table *sd_alloc_ctl_cpu_table(int cpu)
11512 - static struct ctl_table_header *sd_sysctl_header;
11513 - static void register_sched_domain_sysctl(void)
11514 - {
11515 -- int i, cpu_num = num_online_cpus();
11516 -+ int i, cpu_num = num_possible_cpus();
11517 - struct ctl_table *entry = sd_alloc_ctl_entry(cpu_num + 1);
11518 - char buf[32];
11519 -
11520 -@@ -7556,7 +7556,7 @@ static void register_sched_domain_sysctl(void)
11521 - if (entry == NULL)
11522 - return;
11523 -
11524 -- for_each_online_cpu(i) {
11525 -+ for_each_possible_cpu(i) {
11526 - snprintf(buf, 32, "cpu%d", i);
11527 - entry->procname = kstrdup(buf, GFP_KERNEL);
11528 - entry->mode = 0555;
11529 -@@ -7925,6 +7925,8 @@ sd_parent_degenerate(struct sched_domain *sd, struct sched_domain *parent)
11530 -
11531 - static void free_rootdomain(struct root_domain *rd)
11532 - {
11533 -+ synchronize_sched();
11534 -+
11535 - cpupri_cleanup(&rd->cpupri);
11536 -
11537 - free_cpumask_var(rd->rto_mask);
11538 -@@ -9042,7 +9044,7 @@ match1:
11539 - if (doms_new == NULL) {
11540 - ndoms_cur = 0;
11541 - doms_new = fallback_doms;
11542 -- cpumask_andnot(&doms_new[0], cpu_online_mask, cpu_isolated_map);
11543 -+ cpumask_andnot(&doms_new[0], cpu_active_mask, cpu_isolated_map);
11544 - WARN_ON_ONCE(dattr_new);
11545 - }
11546 -
11547 -@@ -9173,8 +9175,10 @@ static int update_sched_domains(struct notifier_block *nfb,
11548 - switch (action) {
11549 - case CPU_ONLINE:
11550 - case CPU_ONLINE_FROZEN:
11551 -- case CPU_DEAD:
11552 -- case CPU_DEAD_FROZEN:
11553 -+ case CPU_DOWN_PREPARE:
11554 -+ case CPU_DOWN_PREPARE_FROZEN:
11555 -+ case CPU_DOWN_FAILED:
11556 -+ case CPU_DOWN_FAILED_FROZEN:
11557 - partition_sched_domains(1, NULL, NULL);
11558 - return NOTIFY_OK;
11559 -
11560 -@@ -9221,7 +9225,7 @@ void __init sched_init_smp(void)
11561 - #endif
11562 - get_online_cpus();
11563 - mutex_lock(&sched_domains_mutex);
11564 -- arch_init_sched_domains(cpu_online_mask);
11565 -+ arch_init_sched_domains(cpu_active_mask);
11566 - cpumask_andnot(non_isolated_cpus, cpu_possible_mask, cpu_isolated_map);
11567 - if (cpumask_empty(non_isolated_cpus))
11568 - cpumask_set_cpu(smp_processor_id(), non_isolated_cpus);
11569 -diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
11570 -index 5488a5d..199228b 100644
11571 ---- a/kernel/sched_fair.c
11572 -+++ b/kernel/sched_fair.c
11573 -@@ -1374,6 +1374,9 @@ static int select_task_rq_fair(struct task_struct *p, int sd_flag, int wake_flag
11574 -
11575 - rcu_read_lock();
11576 - for_each_domain(cpu, tmp) {
11577 -+ if (!(tmp->flags & SD_LOAD_BALANCE))
11578 -+ continue;
11579 -+
11580 - /*
11581 - * If power savings logic is enabled for a domain, see if we
11582 - * are not overloaded, if so, don't balance wider.
11583 -diff --git a/kernel/sysctl.c b/kernel/sysctl.c
11584 -index 0d949c5..dd84be9 100644
11585 ---- a/kernel/sysctl.c
11586 -+++ b/kernel/sysctl.c
11587 -@@ -1200,6 +1200,7 @@ static struct ctl_table vm_table[] = {
11588 - .extra2 = (void *)&hugetlb_infinity,
11589 - },
11590 - #endif
11591 -+#ifdef CONFIG_MMU
11592 - {
11593 - .ctl_name = VM_LOWMEM_RESERVE_RATIO,
11594 - .procname = "lowmem_reserve_ratio",
11595 -@@ -1353,6 +1354,7 @@ static struct ctl_table vm_table[] = {
11596 - .mode = 0644,
11597 - .proc_handler = &mmap_min_addr_handler,
11598 - },
11599 -+#endif
11600 - #ifdef CONFIG_NUMA
11601 - {
11602 - .ctl_name = CTL_UNNUMBERED,
11603 -@@ -1605,7 +1607,8 @@ static struct ctl_table debug_table[] = {
11604 - .data = &show_unhandled_signals,
11605 - .maxlen = sizeof(int),
11606 - .mode = 0644,
11607 -- .proc_handler = proc_dointvec
11608 -+ .proc_handler = proc_dointvec_minmax,
11609 -+ .extra1 = &zero,
11610 - },
11611 - #endif
11612 - { .ctl_name = 0 }
11613 -diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
11614 -index 620b58a..9484be4 100644
11615 ---- a/kernel/time/clockevents.c
11616 -+++ b/kernel/time/clockevents.c
11617 -@@ -237,8 +237,9 @@ void clockevents_exchange_device(struct clock_event_device *old,
11618 - */
11619 - void clockevents_notify(unsigned long reason, void *arg)
11620 - {
11621 -- struct list_head *node, *tmp;
11622 -+ struct clock_event_device *dev, *tmp;
11623 - unsigned long flags;
11624 -+ int cpu;
11625 -
11626 - spin_lock_irqsave(&clockevents_lock, flags);
11627 - clockevents_do_notify(reason, arg);
11628 -@@ -249,8 +250,19 @@ void clockevents_notify(unsigned long reason, void *arg)
11629 - * Unregister the clock event devices which were
11630 - * released from the users in the notify chain.
11631 - */
11632 -- list_for_each_safe(node, tmp, &clockevents_released)
11633 -- list_del(node);
11634 -+ list_for_each_entry_safe(dev, tmp, &clockevents_released, list)
11635 -+ list_del(&dev->list);
11636 -+ /*
11637 -+ * Now check whether the CPU has left unused per cpu devices
11638 -+ */
11639 -+ cpu = *((int *)arg);
11640 -+ list_for_each_entry_safe(dev, tmp, &clockevent_devices, list) {
11641 -+ if (cpumask_test_cpu(cpu, dev->cpumask) &&
11642 -+ cpumask_weight(dev->cpumask) == 1) {
11643 -+ BUG_ON(dev->mode != CLOCK_EVT_MODE_UNUSED);
11644 -+ list_del(&dev->list);
11645 -+ }
11646 -+ }
11647 - break;
11648 - default:
11649 - break;
11650 -diff --git a/lib/dma-debug.c b/lib/dma-debug.c
11651 -index ce6b7ea..5a77c7c 100644
11652 ---- a/lib/dma-debug.c
11653 -+++ b/lib/dma-debug.c
11654 -@@ -670,12 +670,13 @@ static int device_dma_allocations(struct device *dev)
11655 - return count;
11656 - }
11657 -
11658 --static int dma_debug_device_change(struct notifier_block *nb,
11659 -- unsigned long action, void *data)
11660 -+static int dma_debug_device_change(struct notifier_block *nb, unsigned long action, void *data)
11661 - {
11662 - struct device *dev = data;
11663 - int count;
11664 -
11665 -+ if (global_disable)
11666 -+ return 0;
11667 -
11668 - switch (action) {
11669 - case BUS_NOTIFY_UNBOUND_DRIVER:
11670 -@@ -697,6 +698,9 @@ void dma_debug_add_bus(struct bus_type *bus)
11671 - {
11672 - struct notifier_block *nb;
11673 -
11674 -+ if (global_disable)
11675 -+ return;
11676 -+
11677 - nb = kzalloc(sizeof(struct notifier_block), GFP_KERNEL);
11678 - if (nb == NULL) {
11679 - pr_err("dma_debug_add_bus: out of memory\n");
11680 -diff --git a/mm/Kconfig b/mm/Kconfig
11681 -index 44cf6f0..2c19c0b 100644
11682 ---- a/mm/Kconfig
11683 -+++ b/mm/Kconfig
11684 -@@ -227,6 +227,7 @@ config KSM
11685 -
11686 - config DEFAULT_MMAP_MIN_ADDR
11687 - int "Low address space to protect from user allocation"
11688 -+ depends on MMU
11689 - default 4096
11690 - help
11691 - This is the portion of low virtual memory which should be protected
11692 -diff --git a/mm/internal.h b/mm/internal.h
11693 -index 22ec8d2..17bc0df 100644
11694 ---- a/mm/internal.h
11695 -+++ b/mm/internal.h
11696 -@@ -107,9 +107,10 @@ static inline int is_mlocked_vma(struct vm_area_struct *vma, struct page *page)
11697 - }
11698 -
11699 - /*
11700 -- * must be called with vma's mmap_sem held for read, and page locked.
11701 -+ * must be called with vma's mmap_sem held for read or write, and page locked.
11702 - */
11703 - extern void mlock_vma_page(struct page *page);
11704 -+extern void munlock_vma_page(struct page *page);
11705 -
11706 - /*
11707 - * Clear the page's PageMlocked(). This can be useful in a situation where
11708 -diff --git a/mm/ksm.c b/mm/ksm.c
11709 -index 5575f86..e9501f8 100644
11710 ---- a/mm/ksm.c
11711 -+++ b/mm/ksm.c
11712 -@@ -34,6 +34,7 @@
11713 - #include <linux/ksm.h>
11714 -
11715 - #include <asm/tlbflush.h>
11716 -+#include "internal.h"
11717 -
11718 - /*
11719 - * A few notes about the KSM scanning process,
11720 -@@ -767,15 +768,14 @@ static int try_to_merge_one_page(struct vm_area_struct *vma,
11721 - * ptes are necessarily already write-protected. But in either
11722 - * case, we need to lock and check page_count is not raised.
11723 - */
11724 -- if (write_protect_page(vma, oldpage, &orig_pte)) {
11725 -- unlock_page(oldpage);
11726 -- goto out_putpage;
11727 -- }
11728 -- unlock_page(oldpage);
11729 --
11730 -- if (pages_identical(oldpage, newpage))
11731 -+ if (write_protect_page(vma, oldpage, &orig_pte) == 0 &&
11732 -+ pages_identical(oldpage, newpage))
11733 - err = replace_page(vma, oldpage, newpage, orig_pte);
11734 -
11735 -+ if ((vma->vm_flags & VM_LOCKED) && !err)
11736 -+ munlock_vma_page(oldpage);
11737 -+
11738 -+ unlock_page(oldpage);
11739 - out_putpage:
11740 - put_page(oldpage);
11741 - put_page(newpage);
11742 -diff --git a/mm/memcontrol.c b/mm/memcontrol.c
11743 -index 6314015..5dc1037 100644
11744 ---- a/mm/memcontrol.c
11745 -+++ b/mm/memcontrol.c
11746 -@@ -758,7 +758,13 @@ int task_in_mem_cgroup(struct task_struct *task, const struct mem_cgroup *mem)
11747 - task_unlock(task);
11748 - if (!curr)
11749 - return 0;
11750 -- if (curr->use_hierarchy)
11751 -+ /*
11752 -+ * We should check use_hierarchy of "mem" not "curr". Because checking
11753 -+ * use_hierarchy of "curr" here make this function true if hierarchy is
11754 -+ * enabled in "curr" and "curr" is a child of "mem" in *cgroup*
11755 -+ * hierarchy(even if use_hierarchy is disabled in "mem").
11756 -+ */
11757 -+ if (mem->use_hierarchy)
11758 - ret = css_is_ancestor(&curr->css, &mem->css);
11759 - else
11760 - ret = (curr == mem);
11761 -diff --git a/mm/mlock.c b/mm/mlock.c
11762 -index bd6f0e4..2e05c97 100644
11763 ---- a/mm/mlock.c
11764 -+++ b/mm/mlock.c
11765 -@@ -99,14 +99,14 @@ void mlock_vma_page(struct page *page)
11766 - * not get another chance to clear PageMlocked. If we successfully
11767 - * isolate the page and try_to_munlock() detects other VM_LOCKED vmas
11768 - * mapping the page, it will restore the PageMlocked state, unless the page
11769 -- * is mapped in a non-linear vma. So, we go ahead and SetPageMlocked(),
11770 -+ * is mapped in a non-linear vma. So, we go ahead and ClearPageMlocked(),
11771 - * perhaps redundantly.
11772 - * If we lose the isolation race, and the page is mapped by other VM_LOCKED
11773 - * vmas, we'll detect this in vmscan--via try_to_munlock() or try_to_unmap()
11774 - * either of which will restore the PageMlocked state by calling
11775 - * mlock_vma_page() above, if it can grab the vma's mmap sem.
11776 - */
11777 --static void munlock_vma_page(struct page *page)
11778 -+void munlock_vma_page(struct page *page)
11779 - {
11780 - BUG_ON(!PageLocked(page));
11781 -
11782 -diff --git a/mm/oom_kill.c b/mm/oom_kill.c
11783 -index ea2147d..9092b43 100644
11784 ---- a/mm/oom_kill.c
11785 -+++ b/mm/oom_kill.c
11786 -@@ -404,7 +404,7 @@ static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order,
11787 - cpuset_print_task_mems_allowed(current);
11788 - task_unlock(current);
11789 - dump_stack();
11790 -- mem_cgroup_print_oom_info(mem, current);
11791 -+ mem_cgroup_print_oom_info(mem, p);
11792 - show_mem();
11793 - if (sysctl_oom_dump_tasks)
11794 - dump_tasks(mem);
11795 -diff --git a/mm/vmscan.c b/mm/vmscan.c
11796 -index 777af57..692807f 100644
11797 ---- a/mm/vmscan.c
11798 -+++ b/mm/vmscan.c
11799 -@@ -1464,20 +1464,26 @@ static int inactive_file_is_low(struct zone *zone, struct scan_control *sc)
11800 - return low;
11801 - }
11802 -
11803 -+static int inactive_list_is_low(struct zone *zone, struct scan_control *sc,
11804 -+ int file)
11805 -+{
11806 -+ if (file)
11807 -+ return inactive_file_is_low(zone, sc);
11808 -+ else
11809 -+ return inactive_anon_is_low(zone, sc);
11810 -+}
11811 -+
11812 - static unsigned long shrink_list(enum lru_list lru, unsigned long nr_to_scan,
11813 - struct zone *zone, struct scan_control *sc, int priority)
11814 - {
11815 - int file = is_file_lru(lru);
11816 -
11817 -- if (lru == LRU_ACTIVE_FILE && inactive_file_is_low(zone, sc)) {
11818 -- shrink_active_list(nr_to_scan, zone, sc, priority, file);
11819 -+ if (is_active_lru(lru)) {
11820 -+ if (inactive_list_is_low(zone, sc, file))
11821 -+ shrink_active_list(nr_to_scan, zone, sc, priority, file);
11822 - return 0;
11823 - }
11824 -
11825 -- if (lru == LRU_ACTIVE_ANON && inactive_anon_is_low(zone, sc)) {
11826 -- shrink_active_list(nr_to_scan, zone, sc, priority, file);
11827 -- return 0;
11828 -- }
11829 - return shrink_inactive_list(nr_to_scan, zone, sc, priority, file);
11830 - }
11831 -
11832 -diff --git a/net/ipv4/netfilter/nf_defrag_ipv4.c b/net/ipv4/netfilter/nf_defrag_ipv4.c
11833 -index fa2d6b6..331ead3 100644
11834 ---- a/net/ipv4/netfilter/nf_defrag_ipv4.c
11835 -+++ b/net/ipv4/netfilter/nf_defrag_ipv4.c
11836 -@@ -14,6 +14,7 @@
11837 - #include <net/route.h>
11838 - #include <net/ip.h>
11839 -
11840 -+#include <linux/netfilter_bridge.h>
11841 - #include <linux/netfilter_ipv4.h>
11842 - #include <net/netfilter/ipv4/nf_defrag_ipv4.h>
11843 -
11844 -@@ -34,6 +35,20 @@ static int nf_ct_ipv4_gather_frags(struct sk_buff *skb, u_int32_t user)
11845 - return err;
11846 - }
11847 -
11848 -+static enum ip_defrag_users nf_ct_defrag_user(unsigned int hooknum,
11849 -+ struct sk_buff *skb)
11850 -+{
11851 -+#ifdef CONFIG_BRIDGE_NETFILTER
11852 -+ if (skb->nf_bridge &&
11853 -+ skb->nf_bridge->mask & BRNF_NF_BRIDGE_PREROUTING)
11854 -+ return IP_DEFRAG_CONNTRACK_BRIDGE_IN;
11855 -+#endif
11856 -+ if (hooknum == NF_INET_PRE_ROUTING)
11857 -+ return IP_DEFRAG_CONNTRACK_IN;
11858 -+ else
11859 -+ return IP_DEFRAG_CONNTRACK_OUT;
11860 -+}
11861 -+
11862 - static unsigned int ipv4_conntrack_defrag(unsigned int hooknum,
11863 - struct sk_buff *skb,
11864 - const struct net_device *in,
11865 -@@ -50,10 +65,8 @@ static unsigned int ipv4_conntrack_defrag(unsigned int hooknum,
11866 - #endif
11867 - /* Gather fragments. */
11868 - if (ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)) {
11869 -- if (nf_ct_ipv4_gather_frags(skb,
11870 -- hooknum == NF_INET_PRE_ROUTING ?
11871 -- IP_DEFRAG_CONNTRACK_IN :
11872 -- IP_DEFRAG_CONNTRACK_OUT))
11873 -+ enum ip_defrag_users user = nf_ct_defrag_user(hooknum, skb);
11874 -+ if (nf_ct_ipv4_gather_frags(skb, user))
11875 - return NF_STOLEN;
11876 - }
11877 - return NF_ACCEPT;
11878 -diff --git a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
11879 -index 5f2ec20..0956eba 100644
11880 ---- a/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
11881 -+++ b/net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
11882 -@@ -20,6 +20,7 @@
11883 - #include <net/ipv6.h>
11884 - #include <net/inet_frag.h>
11885 -
11886 -+#include <linux/netfilter_bridge.h>
11887 - #include <linux/netfilter_ipv6.h>
11888 - #include <net/netfilter/nf_conntrack.h>
11889 - #include <net/netfilter/nf_conntrack_helper.h>
11890 -@@ -187,6 +188,21 @@ out:
11891 - return nf_conntrack_confirm(skb);
11892 - }
11893 -
11894 -+static enum ip6_defrag_users nf_ct6_defrag_user(unsigned int hooknum,
11895 -+ struct sk_buff *skb)
11896 -+{
11897 -+#ifdef CONFIG_BRIDGE_NETFILTER
11898 -+ if (skb->nf_bridge &&
11899 -+ skb->nf_bridge->mask & BRNF_NF_BRIDGE_PREROUTING)
11900 -+ return IP6_DEFRAG_CONNTRACK_BRIDGE_IN;
11901 -+#endif
11902 -+ if (hooknum == NF_INET_PRE_ROUTING)
11903 -+ return IP6_DEFRAG_CONNTRACK_IN;
11904 -+ else
11905 -+ return IP6_DEFRAG_CONNTRACK_OUT;
11906 -+
11907 -+}
11908 -+
11909 - static unsigned int ipv6_defrag(unsigned int hooknum,
11910 - struct sk_buff *skb,
11911 - const struct net_device *in,
11912 -@@ -199,8 +215,7 @@ static unsigned int ipv6_defrag(unsigned int hooknum,
11913 - if (skb->nfct)
11914 - return NF_ACCEPT;
11915 -
11916 -- reasm = nf_ct_frag6_gather(skb);
11917 --
11918 -+ reasm = nf_ct_frag6_gather(skb, nf_ct6_defrag_user(hooknum, skb));
11919 - /* queued */
11920 - if (reasm == NULL)
11921 - return NF_STOLEN;
11922 -diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
11923 -index f3aba25..4b6a539 100644
11924 ---- a/net/ipv6/netfilter/nf_conntrack_reasm.c
11925 -+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
11926 -@@ -170,13 +170,14 @@ out:
11927 - /* Creation primitives. */
11928 -
11929 - static __inline__ struct nf_ct_frag6_queue *
11930 --fq_find(__be32 id, struct in6_addr *src, struct in6_addr *dst)
11931 -+fq_find(__be32 id, u32 user, struct in6_addr *src, struct in6_addr *dst)
11932 - {
11933 - struct inet_frag_queue *q;
11934 - struct ip6_create_arg arg;
11935 - unsigned int hash;
11936 -
11937 - arg.id = id;
11938 -+ arg.user = user;
11939 - arg.src = src;
11940 - arg.dst = dst;
11941 -
11942 -@@ -561,7 +562,7 @@ find_prev_fhdr(struct sk_buff *skb, u8 *prevhdrp, int *prevhoff, int *fhoff)
11943 - return 0;
11944 - }
11945 -
11946 --struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb)
11947 -+struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb, u32 user)
11948 - {
11949 - struct sk_buff *clone;
11950 - struct net_device *dev = skb->dev;
11951 -@@ -607,7 +608,7 @@ struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb)
11952 - if (atomic_read(&nf_init_frags.mem) > nf_init_frags.high_thresh)
11953 - nf_ct_frag6_evictor();
11954 -
11955 -- fq = fq_find(fhdr->identification, &hdr->saddr, &hdr->daddr);
11956 -+ fq = fq_find(fhdr->identification, user, &hdr->saddr, &hdr->daddr);
11957 - if (fq == NULL) {
11958 - pr_debug("Can't find and can't create new queue\n");
11959 - goto ret_orig;
11960 -diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
11961 -index da5bd0e..4d18699 100644
11962 ---- a/net/ipv6/reassembly.c
11963 -+++ b/net/ipv6/reassembly.c
11964 -@@ -72,6 +72,7 @@ struct frag_queue
11965 - struct inet_frag_queue q;
11966 -
11967 - __be32 id; /* fragment id */
11968 -+ u32 user;
11969 - struct in6_addr saddr;
11970 - struct in6_addr daddr;
11971 -
11972 -@@ -141,7 +142,7 @@ int ip6_frag_match(struct inet_frag_queue *q, void *a)
11973 - struct ip6_create_arg *arg = a;
11974 -
11975 - fq = container_of(q, struct frag_queue, q);
11976 -- return (fq->id == arg->id &&
11977 -+ return (fq->id == arg->id && fq->user == arg->user &&
11978 - ipv6_addr_equal(&fq->saddr, arg->src) &&
11979 - ipv6_addr_equal(&fq->daddr, arg->dst));
11980 - }
11981 -@@ -163,6 +164,7 @@ void ip6_frag_init(struct inet_frag_queue *q, void *a)
11982 - struct ip6_create_arg *arg = a;
11983 -
11984 - fq->id = arg->id;
11985 -+ fq->user = arg->user;
11986 - ipv6_addr_copy(&fq->saddr, arg->src);
11987 - ipv6_addr_copy(&fq->daddr, arg->dst);
11988 - }
11989 -@@ -244,6 +246,7 @@ fq_find(struct net *net, __be32 id, struct in6_addr *src, struct in6_addr *dst,
11990 - unsigned int hash;
11991 -
11992 - arg.id = id;
11993 -+ arg.user = IP6_DEFRAG_LOCAL_DELIVER;
11994 - arg.src = src;
11995 - arg.dst = dst;
11996 -
11997 -diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c
11998 -index f1362f3..fbffce9 100644
11999 ---- a/net/mac80211/ibss.c
12000 -+++ b/net/mac80211/ibss.c
12001 -@@ -455,6 +455,10 @@ static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata)
12002 -
12003 - ieee80211_sta_expire(sdata, IEEE80211_IBSS_INACTIVITY_LIMIT);
12004 -
12005 -+ if (time_before(jiffies, ifibss->last_scan_completed +
12006 -+ IEEE80211_IBSS_MERGE_INTERVAL))
12007 -+ return;
12008 -+
12009 - if (ieee80211_sta_active_ibss(sdata))
12010 - return;
12011 -
12012 -diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
12013 -index dc5049d..f13d181 100644
12014 ---- a/net/mac80211/mlme.c
12015 -+++ b/net/mac80211/mlme.c
12016 -@@ -904,6 +904,14 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
12017 - sdata->u.mgd.flags &= ~(IEEE80211_STA_CONNECTION_POLL |
12018 - IEEE80211_STA_BEACON_POLL);
12019 -
12020 -+ /*
12021 -+ * Always handle WMM once after association regardless
12022 -+ * of the first value the AP uses. Setting -1 here has
12023 -+ * that effect because the AP values is an unsigned
12024 -+ * 4-bit value.
12025 -+ */
12026 -+ sdata->u.mgd.wmm_last_param_set = -1;
12027 -+
12028 - ieee80211_led_assoc(local, 1);
12029 -
12030 - sdata->vif.bss_conf.assoc = 1;
12031 -diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
12032 -index eaa4118..d398197 100644
12033 ---- a/net/mac80211/tx.c
12034 -+++ b/net/mac80211/tx.c
12035 -@@ -1401,6 +1401,7 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
12036 -
12037 - if ((local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) &&
12038 - local->hw.conf.dynamic_ps_timeout > 0 &&
12039 -+ !local->quiescing &&
12040 - !(local->scanning) && local->ps_sdata) {
12041 - if (local->hw.conf.flags & IEEE80211_CONF_PS) {
12042 - ieee80211_stop_queues_by_reason(&local->hw,
12043 -diff --git a/net/mac80211/util.c b/net/mac80211/util.c
12044 -index cbc5d20..51e0bd2 100644
12045 ---- a/net/mac80211/util.c
12046 -+++ b/net/mac80211/util.c
12047 -@@ -1031,7 +1031,19 @@ int ieee80211_reconfig(struct ieee80211_local *local)
12048 -
12049 - /* restart hardware */
12050 - if (local->open_count) {
12051 -+ /*
12052 -+ * Upon resume hardware can sometimes be goofy due to
12053 -+ * various platform / driver / bus issues, so restarting
12054 -+ * the device may at times not work immediately. Propagate
12055 -+ * the error.
12056 -+ */
12057 - res = drv_start(local);
12058 -+ if (res) {
12059 -+ WARN(local->suspended, "Harware became unavailable "
12060 -+ "upon resume. This is could be a software issue"
12061 -+ "prior to suspend or a harware issue\n");
12062 -+ return res;
12063 -+ }
12064 -
12065 - ieee80211_led_radio(local, true);
12066 - }
12067 -diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
12068 -index 0a6b7a0..0d86248 100644
12069 ---- a/net/wireless/mlme.c
12070 -+++ b/net/wireless/mlme.c
12071 -@@ -94,7 +94,18 @@ void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len)
12072 - }
12073 - }
12074 -
12075 -- WARN_ON(!bss);
12076 -+ /*
12077 -+ * We might be coming here because the driver reported
12078 -+ * a successful association at the same time as the
12079 -+ * user requested a deauth. In that case, we will have
12080 -+ * removed the BSS from the auth_bsses list due to the
12081 -+ * deauth request when the assoc response makes it. If
12082 -+ * the two code paths acquire the lock the other way
12083 -+ * around, that's just the standard situation of a
12084 -+ * deauth being requested while connected.
12085 -+ */
12086 -+ if (!bss)
12087 -+ goto out;
12088 - } else if (wdev->conn) {
12089 - cfg80211_sme_failed_assoc(wdev);
12090 - need_connect_result = false;
12091 -diff --git a/security/Makefile b/security/Makefile
12092 -index 95ecc06..510bbc8 100644
12093 ---- a/security/Makefile
12094 -+++ b/security/Makefile
12095 -@@ -8,7 +8,8 @@ subdir-$(CONFIG_SECURITY_SMACK) += smack
12096 - subdir-$(CONFIG_SECURITY_TOMOYO) += tomoyo
12097 -
12098 - # always enable default capabilities
12099 --obj-y += commoncap.o min_addr.o
12100 -+obj-y += commoncap.o
12101 -+obj-$(CONFIG_MMU) += min_addr.o
12102 -
12103 - # Object file lists
12104 - obj-$(CONFIG_SECURITY) += security.o capability.o
12105 -diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c
12106 -index 06ec722..1cad4c7 100644
12107 ---- a/security/keys/keyctl.c
12108 -+++ b/security/keys/keyctl.c
12109 -@@ -1236,6 +1236,7 @@ long keyctl_get_security(key_serial_t keyid,
12110 - */
12111 - long keyctl_session_to_parent(void)
12112 - {
12113 -+#ifdef TIF_NOTIFY_RESUME
12114 - struct task_struct *me, *parent;
12115 - const struct cred *mycred, *pcred;
12116 - struct cred *cred, *oldcred;
12117 -@@ -1326,6 +1327,15 @@ not_permitted:
12118 - error_keyring:
12119 - key_ref_put(keyring_r);
12120 - return ret;
12121 -+
12122 -+#else /* !TIF_NOTIFY_RESUME */
12123 -+ /*
12124 -+ * To be removed when TIF_NOTIFY_RESUME has been implemented on
12125 -+ * m68k/xtensa
12126 -+ */
12127 -+#warning TIF_NOTIFY_RESUME not implemented
12128 -+ return -EOPNOTSUPP;
12129 -+#endif /* !TIF_NOTIFY_RESUME */
12130 - }
12131 -
12132 - /*****************************************************************************/
12133 -diff --git a/sound/mips/sgio2audio.c b/sound/mips/sgio2audio.c
12134 -index 8691f4c..f1d9d16 100644
12135 ---- a/sound/mips/sgio2audio.c
12136 -+++ b/sound/mips/sgio2audio.c
12137 -@@ -609,7 +609,7 @@ static int snd_sgio2audio_pcm_hw_params(struct snd_pcm_substream *substream,
12138 - /* alloc virtual 'dma' area */
12139 - if (runtime->dma_area)
12140 - vfree(runtime->dma_area);
12141 -- runtime->dma_area = vmalloc(size);
12142 -+ runtime->dma_area = vmalloc_user(size);
12143 - if (runtime->dma_area == NULL)
12144 - return -ENOMEM;
12145 - runtime->dma_bytes = size;
12146 -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
12147 -index 7058371..e40d31f 100644
12148 ---- a/sound/pci/hda/patch_realtek.c
12149 -+++ b/sound/pci/hda/patch_realtek.c
12150 -@@ -9141,6 +9141,8 @@ static struct alc_config_preset alc882_presets[] = {
12151 - .dac_nids = alc883_dac_nids,
12152 - .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
12153 - .adc_nids = alc889_adc_nids,
12154 -+ .capsrc_nids = alc889_capsrc_nids,
12155 -+ .capsrc_nids = alc889_capsrc_nids,
12156 - .dig_out_nid = ALC883_DIGOUT_NID,
12157 - .dig_in_nid = ALC883_DIGIN_NID,
12158 - .slave_dig_outs = alc883_slave_dig_outs,
12159 -@@ -9187,6 +9189,7 @@ static struct alc_config_preset alc882_presets[] = {
12160 - .dac_nids = alc883_dac_nids,
12161 - .adc_nids = alc883_adc_nids_alt,
12162 - .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
12163 -+ .capsrc_nids = alc883_capsrc_nids,
12164 - .dig_out_nid = ALC883_DIGOUT_NID,
12165 - .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
12166 - .channel_mode = alc883_3ST_2ch_modes,
12167 -@@ -9333,6 +9336,7 @@ static struct alc_config_preset alc882_presets[] = {
12168 - .dac_nids = alc883_dac_nids,
12169 - .adc_nids = alc883_adc_nids_alt,
12170 - .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
12171 -+ .capsrc_nids = alc883_capsrc_nids,
12172 - .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
12173 - .channel_mode = alc883_sixstack_modes,
12174 - .input_mux = &alc883_capture_source,
12175 -@@ -9394,6 +9398,7 @@ static struct alc_config_preset alc882_presets[] = {
12176 - .dac_nids = alc883_dac_nids,
12177 - .adc_nids = alc883_adc_nids_alt,
12178 - .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
12179 -+ .capsrc_nids = alc883_capsrc_nids,
12180 - .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
12181 - .channel_mode = alc883_3ST_2ch_modes,
12182 - .input_mux = &alc883_lenovo_101e_capture_source,
12183 -@@ -9573,6 +9578,7 @@ static struct alc_config_preset alc882_presets[] = {
12184 - alc880_gpio1_init_verbs },
12185 - .adc_nids = alc883_adc_nids,
12186 - .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
12187 -+ .capsrc_nids = alc883_capsrc_nids,
12188 - .dac_nids = alc883_dac_nids,
12189 - .num_dacs = ARRAY_SIZE(alc883_dac_nids),
12190 - .channel_mode = alc889A_mb31_6ch_modes,
12191 -diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
12192 -index d057e64..5cfa608 100644
12193 ---- a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
12194 -+++ b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
12195 -@@ -51,7 +51,7 @@ static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, size_t s
12196 - return 0; /* already enough large */
12197 - vfree(runtime->dma_area);
12198 - }
12199 -- runtime->dma_area = vmalloc_32(size);
12200 -+ runtime->dma_area = vmalloc_32_user(size);
12201 - if (! runtime->dma_area)
12202 - return -ENOMEM;
12203 - runtime->dma_bytes = size;
12204 -diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c
12205 -index 98d663a..b0bd1c0 100644
12206 ---- a/sound/soc/codecs/wm8974.c
12207 -+++ b/sound/soc/codecs/wm8974.c
12208 -@@ -47,7 +47,7 @@ static const u16 wm8974_reg[WM8974_CACHEREGNUM] = {
12209 - };
12210 -
12211 - #define WM8974_POWER1_BIASEN 0x08
12212 --#define WM8974_POWER1_BUFIOEN 0x10
12213 -+#define WM8974_POWER1_BUFIOEN 0x04
12214 -
12215 - struct wm8974_priv {
12216 - struct snd_soc_codec codec;
12217 -diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c
12218 -index 1fd4e88..e9123f5 100644
12219 ---- a/sound/soc/codecs/wm9712.c
12220 -+++ b/sound/soc/codecs/wm9712.c
12221 -@@ -464,7 +464,8 @@ static int ac97_write(struct snd_soc_codec *codec, unsigned int reg,
12222 - {
12223 - u16 *cache = codec->reg_cache;
12224 -
12225 -- soc_ac97_ops.write(codec->ac97, reg, val);
12226 -+ if (reg < 0x7c)
12227 -+ soc_ac97_ops.write(codec->ac97, reg, val);
12228 - reg = reg >> 1;
12229 - if (reg < (ARRAY_SIZE(wm9712_reg)))
12230 - cache[reg] = val;
12231 -diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
12232 -index 8db0374..8803d9d 100644
12233 ---- a/sound/usb/usbaudio.c
12234 -+++ b/sound/usb/usbaudio.c
12235 -@@ -752,7 +752,7 @@ static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, size_t s
12236 - return 0; /* already large enough */
12237 - vfree(runtime->dma_area);
12238 - }
12239 -- runtime->dma_area = vmalloc(size);
12240 -+ runtime->dma_area = vmalloc_user(size);
12241 - if (!runtime->dma_area)
12242 - return -ENOMEM;
12243 - runtime->dma_bytes = size;
12244
12245 Deleted: genpatches-2.6/trunk/2.6.33/1003_linux-2.6.32.4.patch
12246 ===================================================================
12247 --- genpatches-2.6/trunk/2.6.33/1003_linux-2.6.32.4.patch 2010-02-18 15:55:49 UTC (rev 1673)
12248 +++ genpatches-2.6/trunk/2.6.33/1003_linux-2.6.32.4.patch 2010-02-18 15:58:13 UTC (rev 1674)
12249 @@ -1,4649 +0,0 @@
12250 -diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
12251 -index 9a3334a..62619f2 100644
12252 ---- a/arch/alpha/kernel/osf_sys.c
12253 -+++ b/arch/alpha/kernel/osf_sys.c
12254 -@@ -178,25 +178,18 @@ SYSCALL_DEFINE6(osf_mmap, unsigned long, addr, unsigned long, len,
12255 - unsigned long, prot, unsigned long, flags, unsigned long, fd,
12256 - unsigned long, off)
12257 - {
12258 -- struct file *file = NULL;
12259 -- unsigned long ret = -EBADF;
12260 -+ unsigned long ret = -EINVAL;
12261 -
12262 - #if 0
12263 - if (flags & (_MAP_HASSEMAPHORE | _MAP_INHERIT | _MAP_UNALIGNED))
12264 - printk("%s: unimplemented OSF mmap flags %04lx\n",
12265 - current->comm, flags);
12266 - #endif
12267 -- if (!(flags & MAP_ANONYMOUS)) {
12268 -- file = fget(fd);
12269 -- if (!file)
12270 -- goto out;
12271 -- }
12272 -- flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
12273 -- down_write(&current->mm->mmap_sem);
12274 -- ret = do_mmap(file, addr, len, prot, flags, off);
12275 -- up_write(&current->mm->mmap_sem);
12276 -- if (file)
12277 -- fput(file);
12278 -+ if ((off + PAGE_ALIGN(len)) < off)
12279 -+ goto out;
12280 -+ if (off & ~PAGE_MASK)
12281 -+ goto out;
12282 -+ ret = sys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
12283 - out:
12284 - return ret;
12285 - }
12286 -diff --git a/arch/arm/include/asm/mman.h b/arch/arm/include/asm/mman.h
12287 -index 8eebf89..41f99c5 100644
12288 ---- a/arch/arm/include/asm/mman.h
12289 -+++ b/arch/arm/include/asm/mman.h
12290 -@@ -1 +1,4 @@
12291 - #include <asm-generic/mman.h>
12292 -+
12293 -+#define arch_mmap_check(addr, len, flags) \
12294 -+ (((flags) & MAP_FIXED && (addr) < FIRST_USER_ADDRESS) ? -EINVAL : 0)
12295 -diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S
12296 -index fafce1b..4f07168 100644
12297 ---- a/arch/arm/kernel/calls.S
12298 -+++ b/arch/arm/kernel/calls.S
12299 -@@ -172,7 +172,7 @@
12300 - /* 160 */ CALL(sys_sched_get_priority_min)
12301 - CALL(sys_sched_rr_get_interval)
12302 - CALL(sys_nanosleep)
12303 -- CALL(sys_arm_mremap)
12304 -+ CALL(sys_mremap)
12305 - CALL(sys_setresuid16)
12306 - /* 165 */ CALL(sys_getresuid16)
12307 - CALL(sys_ni_syscall) /* vm86 */
12308 -diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
12309 -index f0fe95b..2c1db77 100644
12310 ---- a/arch/arm/kernel/entry-common.S
12311 -+++ b/arch/arm/kernel/entry-common.S
12312 -@@ -416,12 +416,12 @@ sys_mmap2:
12313 - tst r5, #PGOFF_MASK
12314 - moveq r5, r5, lsr #PAGE_SHIFT - 12
12315 - streq r5, [sp, #4]
12316 -- beq do_mmap2
12317 -+ beq sys_mmap_pgoff
12318 - mov r0, #-EINVAL
12319 - mov pc, lr
12320 - #else
12321 - str r5, [sp, #4]
12322 -- b do_mmap2
12323 -+ b sys_mmap_pgoff
12324 - #endif
12325 - ENDPROC(sys_mmap2)
12326 -
12327 -diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c
12328 -index 78ecaac..ae4027b 100644
12329 ---- a/arch/arm/kernel/sys_arm.c
12330 -+++ b/arch/arm/kernel/sys_arm.c
12331 -@@ -28,41 +28,6 @@
12332 - #include <linux/ipc.h>
12333 - #include <linux/uaccess.h>
12334 -
12335 --extern unsigned long do_mremap(unsigned long addr, unsigned long old_len,
12336 -- unsigned long new_len, unsigned long flags,
12337 -- unsigned long new_addr);
12338 --
12339 --/* common code for old and new mmaps */
12340 --inline long do_mmap2(
12341 -- unsigned long addr, unsigned long len,
12342 -- unsigned long prot, unsigned long flags,
12343 -- unsigned long fd, unsigned long pgoff)
12344 --{
12345 -- int error = -EINVAL;
12346 -- struct file * file = NULL;
12347 --
12348 -- flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
12349 --
12350 -- if (flags & MAP_FIXED && addr < FIRST_USER_ADDRESS)
12351 -- goto out;
12352 --
12353 -- error = -EBADF;
12354 -- if (!(flags & MAP_ANONYMOUS)) {
12355 -- file = fget(fd);
12356 -- if (!file)
12357 -- goto out;
12358 -- }
12359 --
12360 -- down_write(&current->mm->mmap_sem);
12361 -- error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
12362 -- up_write(&current->mm->mmap_sem);
12363 --
12364 -- if (file)
12365 -- fput(file);
12366 --out:
12367 -- return error;
12368 --}
12369 --
12370 - struct mmap_arg_struct {
12371 - unsigned long addr;
12372 - unsigned long len;
12373 -@@ -84,29 +49,11 @@ asmlinkage int old_mmap(struct mmap_arg_struct __user *arg)
12374 - if (a.offset & ~PAGE_MASK)
12375 - goto out;
12376 -
12377 -- error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT);
12378 -+ error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT);
12379 - out:
12380 - return error;
12381 - }
12382 -
12383 --asmlinkage unsigned long
12384 --sys_arm_mremap(unsigned long addr, unsigned long old_len,
12385 -- unsigned long new_len, unsigned long flags,
12386 -- unsigned long new_addr)
12387 --{
12388 -- unsigned long ret = -EINVAL;
12389 --
12390 -- if (flags & MREMAP_FIXED && new_addr < FIRST_USER_ADDRESS)
12391 -- goto out;
12392 --
12393 -- down_write(&current->mm->mmap_sem);
12394 -- ret = do_mremap(addr, old_len, new_len, flags, new_addr);
12395 -- up_write(&current->mm->mmap_sem);
12396 --
12397 --out:
12398 -- return ret;
12399 --}
12400 --
12401 - /*
12402 - * Perform the select(nd, in, out, ex, tv) and mmap() system
12403 - * calls.
12404 -diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c
12405 -index 2b79964..f5abc51 100644
12406 ---- a/arch/arm/mm/mmap.c
12407 -+++ b/arch/arm/mm/mmap.c
12408 -@@ -54,7 +54,8 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
12409 - * We enforce the MAP_FIXED case.
12410 - */
12411 - if (flags & MAP_FIXED) {
12412 -- if (aliasing && flags & MAP_SHARED && addr & (SHMLBA - 1))
12413 -+ if (aliasing && flags & MAP_SHARED &&
12414 -+ (addr - (pgoff << PAGE_SHIFT)) & (SHMLBA - 1))
12415 - return -EINVAL;
12416 - return addr;
12417 - }
12418 -diff --git a/arch/avr32/include/asm/syscalls.h b/arch/avr32/include/asm/syscalls.h
12419 -index 483d666..66a1972 100644
12420 ---- a/arch/avr32/include/asm/syscalls.h
12421 -+++ b/arch/avr32/include/asm/syscalls.h
12422 -@@ -29,10 +29,6 @@ asmlinkage int sys_sigaltstack(const stack_t __user *, stack_t __user *,
12423 - struct pt_regs *);
12424 - asmlinkage int sys_rt_sigreturn(struct pt_regs *);
12425 -
12426 --/* kernel/sys_avr32.c */
12427 --asmlinkage long sys_mmap2(unsigned long, unsigned long, unsigned long,
12428 -- unsigned long, unsigned long, off_t);
12429 --
12430 - /* mm/cache.c */
12431 - asmlinkage int sys_cacheflush(int, void __user *, size_t);
12432 -
12433 -diff --git a/arch/avr32/kernel/sys_avr32.c b/arch/avr32/kernel/sys_avr32.c
12434 -index 5d2daea..459349b 100644
12435 ---- a/arch/avr32/kernel/sys_avr32.c
12436 -+++ b/arch/avr32/kernel/sys_avr32.c
12437 -@@ -5,39 +5,8 @@
12438 - * it under the terms of the GNU General Public License version 2 as
12439 - * published by the Free Software Foundation.
12440 - */
12441 --#include <linux/errno.h>
12442 --#include <linux/fs.h>
12443 --#include <linux/file.h>
12444 --#include <linux/mm.h>
12445 - #include <linux/unistd.h>
12446 -
12447 --#include <asm/mman.h>
12448 --#include <asm/uaccess.h>
12449 --#include <asm/syscalls.h>
12450 --
12451 --asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
12452 -- unsigned long prot, unsigned long flags,
12453 -- unsigned long fd, off_t offset)
12454 --{
12455 -- int error = -EBADF;
12456 -- struct file *file = NULL;
12457 --
12458 -- flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
12459 -- if (!(flags & MAP_ANONYMOUS)) {
12460 -- file = fget(fd);
12461 -- if (!file)
12462 -- return error;
12463 -- }
12464 --
12465 -- down_write(&current->mm->mmap_sem);
12466 -- error = do_mmap_pgoff(file, addr, len, prot, flags, offset);
12467 -- up_write(&current->mm->mmap_sem);
12468 --
12469 -- if (file)
12470 -- fput(file);
12471 -- return error;
12472 --}
12473 --
12474 - int kernel_execve(const char *file, char **argv, char **envp)
12475 - {
12476 - register long scno asm("r8") = __NR_execve;
12477 -diff --git a/arch/avr32/kernel/syscall-stubs.S b/arch/avr32/kernel/syscall-stubs.S
12478 -index f7244cd..0447a3e 100644
12479 ---- a/arch/avr32/kernel/syscall-stubs.S
12480 -+++ b/arch/avr32/kernel/syscall-stubs.S
12481 -@@ -61,7 +61,7 @@ __sys_execve:
12482 - __sys_mmap2:
12483 - pushm lr
12484 - st.w --sp, ARG6
12485 -- call sys_mmap2
12486 -+ call sys_mmap_pgoff
12487 - sub sp, -4
12488 - popm pc
12489 -
12490 -diff --git a/arch/blackfin/kernel/sys_bfin.c b/arch/blackfin/kernel/sys_bfin.c
12491 -index afcef12..2e7f8e1 100644
12492 ---- a/arch/blackfin/kernel/sys_bfin.c
12493 -+++ b/arch/blackfin/kernel/sys_bfin.c
12494 -@@ -22,39 +22,6 @@
12495 - #include <asm/cacheflush.h>
12496 - #include <asm/dma.h>
12497 -
12498 --/* common code for old and new mmaps */
12499 --static inline long
12500 --do_mmap2(unsigned long addr, unsigned long len,
12501 -- unsigned long prot, unsigned long flags,
12502 -- unsigned long fd, unsigned long pgoff)
12503 --{
12504 -- int error = -EBADF;
12505 -- struct file *file = NULL;
12506 --
12507 -- flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
12508 -- if (!(flags & MAP_ANONYMOUS)) {
12509 -- file = fget(fd);
12510 -- if (!file)
12511 -- goto out;
12512 -- }
12513 --
12514 -- down_write(&current->mm->mmap_sem);
12515 -- error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
12516 -- up_write(&current->mm->mmap_sem);
12517 --
12518 -- if (file)
12519 -- fput(file);
12520 -- out:
12521 -- return error;
12522 --}
12523 --
12524 --asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
12525 -- unsigned long prot, unsigned long flags,
12526 -- unsigned long fd, unsigned long pgoff)
12527 --{
12528 -- return do_mmap2(addr, len, prot, flags, fd, pgoff);
12529 --}
12530 --
12531 - asmlinkage void *sys_sram_alloc(size_t size, unsigned long flags)
12532 - {
12533 - return sram_alloc_with_lsl(size, flags);
12534 -diff --git a/arch/blackfin/mach-common/entry.S b/arch/blackfin/mach-common/entry.S
12535 -index 94a0375..1d8f00a 100644
12536 ---- a/arch/blackfin/mach-common/entry.S
12537 -+++ b/arch/blackfin/mach-common/entry.S
12538 -@@ -1422,7 +1422,7 @@ ENTRY(_sys_call_table)
12539 - .long _sys_ni_syscall /* streams2 */
12540 - .long _sys_vfork /* 190 */
12541 - .long _sys_getrlimit
12542 -- .long _sys_mmap2
12543 -+ .long _sys_mmap_pgoff
12544 - .long _sys_truncate64
12545 - .long _sys_ftruncate64
12546 - .long _sys_stat64 /* 195 */
12547 -diff --git a/arch/cris/kernel/sys_cris.c b/arch/cris/kernel/sys_cris.c
12548 -index 2ad962c..c2bbb1a 100644
12549 ---- a/arch/cris/kernel/sys_cris.c
12550 -+++ b/arch/cris/kernel/sys_cris.c
12551 -@@ -26,31 +26,6 @@
12552 - #include <asm/uaccess.h>
12553 - #include <asm/segment.h>
12554 -
12555 --/* common code for old and new mmaps */
12556 --static inline long
12557 --do_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
12558 -- unsigned long flags, unsigned long fd, unsigned long pgoff)
12559 --{
12560 -- int error = -EBADF;
12561 -- struct file * file = NULL;
12562 --
12563 -- flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
12564 -- if (!(flags & MAP_ANONYMOUS)) {
12565 -- file = fget(fd);
12566 -- if (!file)
12567 -- goto out;
12568 -- }
12569 --
12570 -- down_write(&current->mm->mmap_sem);
12571 -- error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
12572 -- up_write(&current->mm->mmap_sem);
12573 --
12574 -- if (file)
12575 -- fput(file);
12576 --out:
12577 -- return error;
12578 --}
12579 --
12580 - asmlinkage unsigned long old_mmap(unsigned long __user *args)
12581 - {
12582 - unsigned long buffer[6];
12583 -@@ -63,7 +38,7 @@ asmlinkage unsigned long old_mmap(unsigned long __user *args)
12584 - if (buffer[5] & ~PAGE_MASK) /* verify that offset is on page boundary */
12585 - goto out;
12586 -
12587 -- err = do_mmap2(buffer[0], buffer[1], buffer[2], buffer[3],
12588 -+ err = sys_mmap_pgoff(buffer[0], buffer[1], buffer[2], buffer[3],
12589 - buffer[4], buffer[5] >> PAGE_SHIFT);
12590 - out:
12591 - return err;
12592 -@@ -73,7 +48,8 @@ asmlinkage long
12593 - sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
12594 - unsigned long flags, unsigned long fd, unsigned long pgoff)
12595 - {
12596 -- return do_mmap2(addr, len, prot, flags, fd, pgoff);
12597 -+ /* bug(?): 8Kb pages here */
12598 -+ return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
12599 - }
12600 -
12601 - /*
12602 -diff --git a/arch/frv/kernel/sys_frv.c b/arch/frv/kernel/sys_frv.c
12603 -index 2b6b528..1d3d4c9 100644
12604 ---- a/arch/frv/kernel/sys_frv.c
12605 -+++ b/arch/frv/kernel/sys_frv.c
12606 -@@ -31,9 +31,6 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
12607 - unsigned long prot, unsigned long flags,
12608 - unsigned long fd, unsigned long pgoff)
12609 - {
12610 -- int error = -EBADF;
12611 -- struct file * file = NULL;
12612 --
12613 - /* As with sparc32, make sure the shift for mmap2 is constant
12614 - (12), no matter what PAGE_SIZE we have.... */
12615 -
12616 -@@ -41,69 +38,10 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
12617 - trying to map something we can't */
12618 - if (pgoff & ((1 << (PAGE_SHIFT - 12)) - 1))
12619 - return -EINVAL;
12620 -- pgoff >>= PAGE_SHIFT - 12;
12621 --
12622 -- flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
12623 -- if (!(flags & MAP_ANONYMOUS)) {
12624 -- file = fget(fd);
12625 -- if (!file)
12626 -- goto out;
12627 -- }
12628 --
12629 -- down_write(&current->mm->mmap_sem);
12630 -- error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
12631 -- up_write(&current->mm->mmap_sem);
12632 --
12633 -- if (file)
12634 -- fput(file);
12635 --out:
12636 -- return error;
12637 --}
12638 --
12639 --#if 0 /* DAVIDM - do we want this */
12640 --struct mmap_arg_struct64 {
12641 -- __u32 addr;
12642 -- __u32 len;
12643 -- __u32 prot;
12644 -- __u32 flags;
12645 -- __u64 offset; /* 64 bits */
12646 -- __u32 fd;
12647 --};
12648 --
12649 --asmlinkage long sys_mmap64(struct mmap_arg_struct64 *arg)
12650 --{
12651 -- int error = -EFAULT;
12652 -- struct file * file = NULL;
12653 -- struct mmap_arg_struct64 a;
12654 -- unsigned long pgoff;
12655 --
12656 -- if (copy_from_user(&a, arg, sizeof(a)))
12657 -- return -EFAULT;
12658 --
12659 -- if ((long)a.offset & ~PAGE_MASK)
12660 -- return -EINVAL;
12661 --
12662 -- pgoff = a.offset >> PAGE_SHIFT;
12663 -- if ((a.offset >> PAGE_SHIFT) != pgoff)
12664 -- return -EINVAL;
12665 --
12666 -- if (!(a.flags & MAP_ANONYMOUS)) {
12667 -- error = -EBADF;
12668 -- file = fget(a.fd);
12669 -- if (!file)
12670 -- goto out;
12671 -- }
12672 -- a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
12673 -
12674 -- down_write(&current->mm->mmap_sem);
12675 -- error = do_mmap_pgoff(file, a.addr, a.len, a.prot, a.flags, pgoff);
12676 -- up_write(&current->mm->mmap_sem);
12677 -- if (file)
12678 -- fput(file);
12679 --out:
12680 -- return error;
12681 -+ return sys_mmap_pgoff(addr, len, prot, flags, fd,
12682 -+ pgoff >> (PAGE_SHIFT - 12));
12683 - }
12684 --#endif
12685 -
12686 - /*
12687 - * sys_ipc() is the de-multiplexer for the SysV IPC calls..
12688 -diff --git a/arch/h8300/kernel/sys_h8300.c b/arch/h8300/kernel/sys_h8300.c
12689 -index 8cb5d73..b5969db 100644
12690 ---- a/arch/h8300/kernel/sys_h8300.c
12691 -+++ b/arch/h8300/kernel/sys_h8300.c
12692 -@@ -26,39 +26,6 @@
12693 - #include <asm/traps.h>
12694 - #include <asm/unistd.h>
12695 -
12696 --/* common code for old and new mmaps */
12697 --static inline long do_mmap2(
12698 -- unsigned long addr, unsigned long len,
12699 -- unsigned long prot, unsigned long flags,
12700 -- unsigned long fd, unsigned long pgoff)
12701 --{
12702 -- int error = -EBADF;
12703 -- struct file * file = NULL;
12704 --
12705 -- flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
12706 -- if (!(flags & MAP_ANONYMOUS)) {
12707 -- file = fget(fd);
12708 -- if (!file)
12709 -- goto out;
12710 -- }
12711 --
12712 -- down_write(&current->mm->mmap_sem);
12713 -- error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
12714 -- up_write(&current->mm->mmap_sem);
12715 --
12716 -- if (file)
12717 -- fput(file);
12718 --out:
12719 -- return error;
12720 --}
12721 --
12722 --asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
12723 -- unsigned long prot, unsigned long flags,
12724 -- unsigned long fd, unsigned long pgoff)
12725 --{
12726 -- return do_mmap2(addr, len, prot, flags, fd, pgoff);
12727 --}
12728 --
12729 - /*
12730 - * Perform the select(nd, in, out, ex, tv) and mmap() system
12731 - * calls. Linux/m68k cloned Linux/i386, which didn't use to be able to
12732 -@@ -87,57 +54,11 @@ asmlinkage int old_mmap(struct mmap_arg_struct *arg)
12733 - if (a.offset & ~PAGE_MASK)
12734 - goto out;
12735 -
12736 -- a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
12737 --
12738 -- error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT);
12739 --out:
12740 -- return error;
12741 --}
12742 --
12743 --#if 0 /* DAVIDM - do we want this */
12744 --struct mmap_arg_struct64 {
12745 -- __u32 addr;
12746 -- __u32 len;
12747 -- __u32 prot;
12748 -- __u32 flags;
12749 -- __u64 offset; /* 64 bits */
12750 -- __u32 fd;
12751 --};
12752 --
12753 --asmlinkage long sys_mmap64(struct mmap_arg_struct64 *arg)
12754 --{
12755 -- int error = -EFAULT;
12756 -- struct file * file = NULL;
12757 -- struct mmap_arg_struct64 a;
12758 -- unsigned long pgoff;
12759 --
12760 -- if (copy_from_user(&a, arg, sizeof(a)))
12761 -- return -EFAULT;
12762 --
12763 -- if ((long)a.offset & ~PAGE_MASK)
12764 -- return -EINVAL;
12765 --
12766 -- pgoff = a.offset >> PAGE_SHIFT;
12767 -- if ((a.offset >> PAGE_SHIFT) != pgoff)
12768 -- return -EINVAL;
12769 --
12770 -- if (!(a.flags & MAP_ANONYMOUS)) {
12771 -- error = -EBADF;
12772 -- file = fget(a.fd);
12773 -- if (!file)
12774 -- goto out;
12775 -- }
12776 -- a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
12777 --
12778 -- down_write(&current->mm->mmap_sem);
12779 -- error = do_mmap_pgoff(file, a.addr, a.len, a.prot, a.flags, pgoff);
12780 -- up_write(&current->mm->mmap_sem);
12781 -- if (file)
12782 -- fput(file);
12783 -+ error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd,
12784 -+ a.offset >> PAGE_SHIFT);
12785 - out:
12786 - return error;
12787 - }
12788 --#endif
12789 -
12790 - struct sel_arg_struct {
12791 - unsigned long n;
12792 -diff --git a/arch/h8300/kernel/syscalls.S b/arch/h8300/kernel/syscalls.S
12793 -index 4eb67fa..2d69881 100644
12794 ---- a/arch/h8300/kernel/syscalls.S
12795 -+++ b/arch/h8300/kernel/syscalls.S
12796 -@@ -206,7 +206,7 @@ SYMBOL_NAME_LABEL(sys_call_table)
12797 - .long SYMBOL_NAME(sys_ni_syscall) /* streams2 */
12798 - .long SYMBOL_NAME(sys_vfork) /* 190 */
12799 - .long SYMBOL_NAME(sys_getrlimit)
12800 -- .long SYMBOL_NAME(sys_mmap2)
12801 -+ .long SYMBOL_NAME(sys_mmap_pgoff)
12802 - .long SYMBOL_NAME(sys_truncate64)
12803 - .long SYMBOL_NAME(sys_ftruncate64)
12804 - .long SYMBOL_NAME(sys_stat64) /* 195 */
12805 -diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
12806 -index 625ed8f..e031ee8 100644
12807 ---- a/arch/ia64/ia32/sys_ia32.c
12808 -+++ b/arch/ia64/ia32/sys_ia32.c
12809 -@@ -858,6 +858,9 @@ ia32_do_mmap (struct file *file, unsigned long addr, unsigned long len, int prot
12810 -
12811 - prot = get_prot32(prot);
12812 -
12813 -+ if (flags & MAP_HUGETLB)
12814 -+ return -ENOMEM;
12815 -+
12816 - #if PAGE_SHIFT > IA32_PAGE_SHIFT
12817 - mutex_lock(&ia32_mmap_mutex);
12818 - {
12819 -diff --git a/arch/ia64/kernel/sys_ia64.c b/arch/ia64/kernel/sys_ia64.c
12820 -index 92ed83f..609d500 100644
12821 ---- a/arch/ia64/kernel/sys_ia64.c
12822 -+++ b/arch/ia64/kernel/sys_ia64.c
12823 -@@ -100,51 +100,7 @@ sys_getpagesize (void)
12824 - asmlinkage unsigned long
12825 - ia64_brk (unsigned long brk)
12826 - {
12827 -- unsigned long rlim, retval, newbrk, oldbrk;
12828 -- struct mm_struct *mm = current->mm;
12829 --
12830 -- /*
12831 -- * Most of this replicates the code in sys_brk() except for an additional safety
12832 -- * check and the clearing of r8. However, we can't call sys_brk() because we need
12833 -- * to acquire the mmap_sem before we can do the test...
12834 -- */
12835 -- down_write(&mm->mmap_sem);
12836 --
12837 -- if (brk < mm->end_code)
12838 -- goto out;
12839 -- newbrk = PAGE_ALIGN(brk);
12840 -- oldbrk = PAGE_ALIGN(mm->brk);
12841 -- if (oldbrk == newbrk)
12842 -- goto set_brk;
12843 --
12844 -- /* Always allow shrinking brk. */
12845 -- if (brk <= mm->brk) {
12846 -- if (!do_munmap(mm, newbrk, oldbrk-newbrk))
12847 -- goto set_brk;
12848 -- goto out;
12849 -- }
12850 --
12851 -- /* Check against unimplemented/unmapped addresses: */
12852 -- if ((newbrk - oldbrk) > RGN_MAP_LIMIT || REGION_OFFSET(newbrk) > RGN_MAP_LIMIT)
12853 -- goto out;
12854 --
12855 -- /* Check against rlimit.. */
12856 -- rlim = current->signal->rlim[RLIMIT_DATA].rlim_cur;
12857 -- if (rlim < RLIM_INFINITY && brk - mm->start_data > rlim)
12858 -- goto out;
12859 --
12860 -- /* Check against existing mmap mappings. */
12861 -- if (find_vma_intersection(mm, oldbrk, newbrk+PAGE_SIZE))
12862 -- goto out;
12863 --
12864 -- /* Ok, looks good - let it rip. */
12865 -- if (do_brk(oldbrk, newbrk-oldbrk) != oldbrk)
12866 -- goto out;
12867 --set_brk:
12868 -- mm->brk = brk;
12869 --out:
12870 -- retval = mm->brk;
12871 -- up_write(&mm->mmap_sem);
12872 -+ unsigned long retval = sys_brk(brk);
12873 - force_successful_syscall_return();
12874 - return retval;
12875 - }
12876 -@@ -185,39 +141,6 @@ int ia64_mmap_check(unsigned long addr, unsigned long len,
12877 - return 0;
12878 - }
12879 -
12880 --static inline unsigned long
12881 --do_mmap2 (unsigned long addr, unsigned long len, int prot, int flags, int fd, unsigned long pgoff)
12882 --{
12883 -- struct file *file = NULL;
12884 --
12885 -- flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
12886 -- if (!(flags & MAP_ANONYMOUS)) {
12887 -- file = fget(fd);
12888 -- if (!file)
12889 -- return -EBADF;
12890 --
12891 -- if (!file->f_op || !file->f_op->mmap) {
12892 -- addr = -ENODEV;
12893 -- goto out;
12894 -- }
12895 -- }
12896 --
12897 -- /* Careful about overflows.. */
12898 -- len = PAGE_ALIGN(len);
12899 -- if (!len || len > TASK_SIZE) {
12900 -- addr = -EINVAL;
12901 -- goto out;
12902 -- }
12903 --
12904 -- down_write(&current->mm->mmap_sem);
12905 -- addr = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
12906 -- up_write(&current->mm->mmap_sem);
12907 --
12908 --out: if (file)
12909 -- fput(file);
12910 -- return addr;
12911 --}
12912 --
12913 - /*
12914 - * mmap2() is like mmap() except that the offset is expressed in units
12915 - * of PAGE_SIZE (instead of bytes). This allows to mmap2() (pieces
12916 -@@ -226,7 +149,7 @@ out: if (file)
12917 - asmlinkage unsigned long
12918 - sys_mmap2 (unsigned long addr, unsigned long len, int prot, int flags, int fd, long pgoff)
12919 - {
12920 -- addr = do_mmap2(addr, len, prot, flags, fd, pgoff);
12921 -+ addr = sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
12922 - if (!IS_ERR((void *) addr))
12923 - force_successful_syscall_return();
12924 - return addr;
12925 -@@ -238,7 +161,7 @@ sys_mmap (unsigned long addr, unsigned long len, int prot, int flags, int fd, lo
12926 - if (offset_in_page(off) != 0)
12927 - return -EINVAL;
12928 -
12929 -- addr = do_mmap2(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
12930 -+ addr = sys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
12931 - if (!IS_ERR((void *) addr))
12932 - force_successful_syscall_return();
12933 - return addr;
12934 -diff --git a/arch/m32r/kernel/sys_m32r.c b/arch/m32r/kernel/sys_m32r.c
12935 -index 305ac85..d3c865c 100644
12936 ---- a/arch/m32r/kernel/sys_m32r.c
12937 -+++ b/arch/m32r/kernel/sys_m32r.c
12938 -@@ -76,30 +76,6 @@ asmlinkage int sys_tas(int __user *addr)
12939 - return oldval;
12940 - }
12941 -
12942 --asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
12943 -- unsigned long prot, unsigned long flags,
12944 -- unsigned long fd, unsigned long pgoff)
12945 --{
12946 -- int error = -EBADF;
12947 -- struct file *file = NULL;
12948 --
12949 -- flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
12950 -- if (!(flags & MAP_ANONYMOUS)) {
12951 -- file = fget(fd);
12952 -- if (!file)
12953 -- goto out;
12954 -- }
12955 --
12956 -- down_write(&current->mm->mmap_sem);
12957 -- error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
12958 -- up_write(&current->mm->mmap_sem);
12959 --
12960 -- if (file)
12961 -- fput(file);
12962 --out:
12963 -- return error;
12964 --}
12965 --
12966 - /*
12967 - * sys_ipc() is the de-multiplexer for the SysV IPC calls..
12968 - *
12969 -diff --git a/arch/m32r/kernel/syscall_table.S b/arch/m32r/kernel/syscall_table.S
12970 -index aa3bf4c..60536e2 100644
12971 ---- a/arch/m32r/kernel/syscall_table.S
12972 -+++ b/arch/m32r/kernel/syscall_table.S
12973 -@@ -191,7 +191,7 @@ ENTRY(sys_call_table)
12974 - .long sys_ni_syscall /* streams2 */
12975 - .long sys_vfork /* 190 */
12976 - .long sys_getrlimit
12977 -- .long sys_mmap2
12978 -+ .long sys_mmap_pgoff
12979 - .long sys_truncate64
12980 - .long sys_ftruncate64
12981 - .long sys_stat64 /* 195 */
12982 -diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c
12983 -index 7deb402..218f441 100644
12984 ---- a/arch/m68k/kernel/sys_m68k.c
12985 -+++ b/arch/m68k/kernel/sys_m68k.c
12986 -@@ -29,37 +29,16 @@
12987 - #include <asm/page.h>
12988 - #include <asm/unistd.h>
12989 -
12990 --/* common code for old and new mmaps */
12991 --static inline long do_mmap2(
12992 -- unsigned long addr, unsigned long len,
12993 -- unsigned long prot, unsigned long flags,
12994 -- unsigned long fd, unsigned long pgoff)
12995 --{
12996 -- int error = -EBADF;
12997 -- struct file * file = NULL;
12998 --
12999 -- flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
13000 -- if (!(flags & MAP_ANONYMOUS)) {
13001 -- file = fget(fd);
13002 -- if (!file)
13003 -- goto out;
13004 -- }
13005 --
13006 -- down_write(&current->mm->mmap_sem);
13007 -- error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
13008 -- up_write(&current->mm->mmap_sem);
13009 --
13010 -- if (file)
13011 -- fput(file);
13012 --out:
13013 -- return error;
13014 --}
13015 --
13016 - asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
13017 - unsigned long prot, unsigned long flags,
13018 - unsigned long fd, unsigned long pgoff)
13019 - {
13020 -- return do_mmap2(addr, len, prot, flags, fd, pgoff);
13021 -+ /*
13022 -+ * This is wrong for sun3 - there PAGE_SIZE is 8Kb,
13023 -+ * so we need to shift the argument down by 1; m68k mmap64(3)
13024 -+ * (in libc) expects the last argument of mmap2 in 4Kb units.
13025 -+ */
13026 -+ return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
13027 - }
13028 -
13029 - /*
13030 -@@ -90,57 +69,11 @@ asmlinkage int old_mmap(struct mmap_arg_struct __user *arg)
13031 - if (a.offset & ~PAGE_MASK)
13032 - goto out;
13033 -
13034 -- a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
13035 --
13036 -- error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT);
13037 --out:
13038 -- return error;
13039 --}
13040 --
13041 --#if 0
13042 --struct mmap_arg_struct64 {
13043 -- __u32 addr;
13044 -- __u32 len;
13045 -- __u32 prot;
13046 -- __u32 flags;
13047 -- __u64 offset; /* 64 bits */
13048 -- __u32 fd;
13049 --};
13050 --
13051 --asmlinkage long sys_mmap64(struct mmap_arg_struct64 *arg)
13052 --{
13053 -- int error = -EFAULT;
13054 -- struct file * file = NULL;
13055 -- struct mmap_arg_struct64 a;
13056 -- unsigned long pgoff;
13057 --
13058 -- if (copy_from_user(&a, arg, sizeof(a)))
13059 -- return -EFAULT;
13060 --
13061 -- if ((long)a.offset & ~PAGE_MASK)
13062 -- return -EINVAL;
13063 --
13064 -- pgoff = a.offset >> PAGE_SHIFT;
13065 -- if ((a.offset >> PAGE_SHIFT) != pgoff)
13066 -- return -EINVAL;
13067 --
13068 -- if (!(a.flags & MAP_ANONYMOUS)) {
13069 -- error = -EBADF;
13070 -- file = fget(a.fd);
13071 -- if (!file)
13072 -- goto out;
13073 -- }
13074 -- a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
13075 --
13076 -- down_write(&current->mm->mmap_sem);
13077 -- error = do_mmap_pgoff(file, a.addr, a.len, a.prot, a.flags, pgoff);
13078 -- up_write(&current->mm->mmap_sem);
13079 -- if (file)
13080 -- fput(file);
13081 -+ error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd,
13082 -+ a.offset >> PAGE_SHIFT);
13083 - out:
13084 - return error;
13085 - }
13086 --#endif
13087 -
13088 - struct sel_arg_struct {
13089 - unsigned long n;
13090 -diff --git a/arch/m68knommu/kernel/sys_m68k.c b/arch/m68knommu/kernel/sys_m68k.c
13091 -index efdd090..b67cbc7 100644
13092 ---- a/arch/m68knommu/kernel/sys_m68k.c
13093 -+++ b/arch/m68knommu/kernel/sys_m68k.c
13094 -@@ -27,39 +27,6 @@
13095 - #include <asm/cacheflush.h>
13096 - #include <asm/unistd.h>
13097 -
13098 --/* common code for old and new mmaps */
13099 --static inline long do_mmap2(
13100 -- unsigned long addr, unsigned long len,
13101 -- unsigned long prot, unsigned long flags,
13102 -- unsigned long fd, unsigned long pgoff)
13103 --{
13104 -- int error = -EBADF;
13105 -- struct file * file = NULL;
13106 --
13107 -- flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
13108 -- if (!(flags & MAP_ANONYMOUS)) {
13109 -- file = fget(fd);
13110 -- if (!file)
13111 -- goto out;
13112 -- }
13113 --
13114 -- down_write(&current->mm->mmap_sem);
13115 -- error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
13116 -- up_write(&current->mm->mmap_sem);
13117 --
13118 -- if (file)
13119 -- fput(file);
13120 --out:
13121 -- return error;
13122 --}
13123 --
13124 --asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
13125 -- unsigned long prot, unsigned long flags,
13126 -- unsigned long fd, unsigned long pgoff)
13127 --{
13128 -- return do_mmap2(addr, len, prot, flags, fd, pgoff);
13129 --}
13130 --
13131 - /*
13132 - * Perform the select(nd, in, out, ex, tv) and mmap() system
13133 - * calls. Linux/m68k cloned Linux/i386, which didn't use to be able to
13134 -@@ -88,9 +55,8 @@ asmlinkage int old_mmap(struct mmap_arg_struct *arg)
13135 - if (a.offset & ~PAGE_MASK)
13136 - goto out;
13137 -
13138 -- a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
13139 --
13140 -- error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT);
13141 -+ error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd,
13142 -+ a.offset >> PAGE_SHIFT);
13143 - out:
13144 - return error;
13145 - }
13146 -diff --git a/arch/m68knommu/kernel/syscalltable.S b/arch/m68knommu/kernel/syscalltable.S
13147 -index 23535cc..486837e 100644
13148 ---- a/arch/m68knommu/kernel/syscalltable.S
13149 -+++ b/arch/m68knommu/kernel/syscalltable.S
13150 -@@ -210,7 +210,7 @@ ENTRY(sys_call_table)
13151 - .long sys_ni_syscall /* streams2 */
13152 - .long sys_vfork /* 190 */
13153 - .long sys_getrlimit
13154 -- .long sys_mmap2
13155 -+ .long sys_mmap_pgoff
13156 - .long sys_truncate64
13157 - .long sys_ftruncate64
13158 - .long sys_stat64 /* 195 */
13159 -diff --git a/arch/microblaze/kernel/sys_microblaze.c b/arch/microblaze/kernel/sys_microblaze.c
13160 -index 07cabed..9f3c205 100644
13161 ---- a/arch/microblaze/kernel/sys_microblaze.c
13162 -+++ b/arch/microblaze/kernel/sys_microblaze.c
13163 -@@ -62,46 +62,14 @@ out:
13164 - return error;
13165 - }
13166 -
13167 --asmlinkage long
13168 --sys_mmap2(unsigned long addr, unsigned long len,
13169 -- unsigned long prot, unsigned long flags,
13170 -- unsigned long fd, unsigned long pgoff)
13171 --{
13172 -- struct file *file = NULL;
13173 -- int ret = -EBADF;
13174 --
13175 -- flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
13176 -- if (!(flags & MAP_ANONYMOUS)) {
13177 -- file = fget(fd);
13178 -- if (!file) {
13179 -- printk(KERN_INFO "no fd in mmap\r\n");
13180 -- goto out;
13181 -- }
13182 -- }
13183 --
13184 -- down_write(&current->mm->mmap_sem);
13185 -- ret = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
13186 -- up_write(&current->mm->mmap_sem);
13187 -- if (file)
13188 -- fput(file);
13189 --out:
13190 -- return ret;
13191 --}
13192 --
13193 - asmlinkage long sys_mmap(unsigned long addr, unsigned long len,
13194 - unsigned long prot, unsigned long flags,
13195 - unsigned long fd, off_t pgoff)
13196 - {
13197 -- int err = -EINVAL;
13198 --
13199 -- if (pgoff & ~PAGE_MASK) {
13200 -- printk(KERN_INFO "no pagemask in mmap\r\n");
13201 -- goto out;
13202 -- }
13203 -+ if (pgoff & ~PAGE_MASK)
13204 -+ return -EINVAL;
13205 -
13206 -- err = sys_mmap2(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT);
13207 --out:
13208 -- return err;
13209 -+ return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT);
13210 - }
13211 -
13212 - /*
13213 -diff --git a/arch/microblaze/kernel/syscall_table.S b/arch/microblaze/kernel/syscall_table.S
13214 -index ecec191..eb50ce5 100644
13215 ---- a/arch/microblaze/kernel/syscall_table.S
13216 -+++ b/arch/microblaze/kernel/syscall_table.S
13217 -@@ -196,7 +196,7 @@ ENTRY(sys_call_table)
13218 - .long sys_ni_syscall /* reserved for streams2 */
13219 - .long sys_vfork /* 190 */
13220 - .long sys_getrlimit
13221 -- .long sys_mmap2 /* mmap2 */
13222 -+ .long sys_mmap_pgoff /* mmap2 */
13223 - .long sys_truncate64
13224 - .long sys_ftruncate64
13225 - .long sys_stat64 /* 195 */
13226 -diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
13227 -index b77fefa..ea4a746 100644
13228 ---- a/arch/mips/kernel/linux32.c
13229 -+++ b/arch/mips/kernel/linux32.c
13230 -@@ -67,28 +67,13 @@ SYSCALL_DEFINE6(32_mmap2, unsigned long, addr, unsigned long, len,
13231 - unsigned long, prot, unsigned long, flags, unsigned long, fd,
13232 - unsigned long, pgoff)
13233 - {
13234 -- struct file * file = NULL;
13235 - unsigned long error;
13236 -
13237 - error = -EINVAL;
13238 - if (pgoff & (~PAGE_MASK >> 12))
13239 - goto out;
13240 -- pgoff >>= PAGE_SHIFT-12;
13241 --
13242 -- if (!(flags & MAP_ANONYMOUS)) {
13243 -- error = -EBADF;
13244 -- file = fget(fd);
13245 -- if (!file)
13246 -- goto out;
13247 -- }
13248 -- flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
13249 --
13250 -- down_write(&current->mm->mmap_sem);
13251 -- error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
13252 -- up_write(&current->mm->mmap_sem);
13253 -- if (file)
13254 -- fput(file);
13255 --
13256 -+ error = sys_mmap_pgoff(addr, len, prot, flags, fd,
13257 -+ pgoff >> (PAGE_SHIFT-12));
13258 - out:
13259 - return error;
13260 - }
13261 -diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
13262 -index fe0d798..3f7f466 100644
13263 ---- a/arch/mips/kernel/syscall.c
13264 -+++ b/arch/mips/kernel/syscall.c
13265 -@@ -93,7 +93,8 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
13266 - * We do not accept a shared mapping if it would violate
13267 - * cache aliasing constraints.
13268 - */
13269 -- if ((flags & MAP_SHARED) && (addr & shm_align_mask))
13270 -+ if ((flags & MAP_SHARED) &&
13271 -+ ((addr - (pgoff << PAGE_SHIFT)) & shm_align_mask))
13272 - return -EINVAL;
13273 - return addr;
13274 - }
13275 -@@ -129,31 +130,6 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
13276 - }
13277 - }
13278 -
13279 --/* common code for old and new mmaps */
13280 --static inline unsigned long
13281 --do_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
13282 -- unsigned long flags, unsigned long fd, unsigned long pgoff)
13283 --{
13284 -- unsigned long error = -EBADF;
13285 -- struct file * file = NULL;
13286 --
13287 -- flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
13288 -- if (!(flags & MAP_ANONYMOUS)) {
13289 -- file = fget(fd);
13290 -- if (!file)
13291 -- goto out;
13292 -- }
13293 --
13294 -- down_write(&current->mm->mmap_sem);
13295 -- error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
13296 -- up_write(&current->mm->mmap_sem);
13297 --
13298 -- if (file)
13299 -- fput(file);
13300 --out:
13301 -- return error;
13302 --}
13303 --
13304 - SYSCALL_DEFINE6(mips_mmap, unsigned long, addr, unsigned long, len,
13305 - unsigned long, prot, unsigned long, flags, unsigned long,
13306 - fd, off_t, offset)
13307 -@@ -164,7 +140,7 @@ SYSCALL_DEFINE6(mips_mmap, unsigned long, addr, unsigned long, len,
13308 - if (offset & ~PAGE_MASK)
13309 - goto out;
13310 -
13311 -- result = do_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
13312 -+ result = sys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
13313 -
13314 - out:
13315 - return result;
13316 -@@ -177,7 +153,7 @@ SYSCALL_DEFINE6(mips_mmap2, unsigned long, addr, unsigned long, len,
13317 - if (pgoff & (~PAGE_MASK >> 12))
13318 - return -EINVAL;
13319 -
13320 -- return do_mmap2(addr, len, prot, flags, fd, pgoff >> (PAGE_SHIFT-12));
13321 -+ return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff >> (PAGE_SHIFT-12));
13322 - }
13323 -
13324 - save_static_function(sys_fork);
13325 -diff --git a/arch/mn10300/include/asm/mman.h b/arch/mn10300/include/asm/mman.h
13326 -index 8eebf89..db5c53d 100644
13327 ---- a/arch/mn10300/include/asm/mman.h
13328 -+++ b/arch/mn10300/include/asm/mman.h
13329 -@@ -1 +1,6 @@
13330 - #include <asm-generic/mman.h>
13331 -+
13332 -+#define MIN_MAP_ADDR PAGE_SIZE /* minimum fixed mmap address */
13333 -+
13334 -+#define arch_mmap_check(addr, len, flags) \
13335 -+ (((flags) & MAP_FIXED && (addr) < MIN_MAP_ADDR) ? -EINVAL : 0)
13336 -diff --git a/arch/mn10300/kernel/entry.S b/arch/mn10300/kernel/entry.S
13337 -index a94e7ea..c9ee6c0 100644
13338 ---- a/arch/mn10300/kernel/entry.S
13339 -+++ b/arch/mn10300/kernel/entry.S
13340 -@@ -578,7 +578,7 @@ ENTRY(sys_call_table)
13341 - .long sys_ni_syscall /* reserved for streams2 */
13342 - .long sys_vfork /* 190 */
13343 - .long sys_getrlimit
13344 -- .long sys_mmap2
13345 -+ .long sys_mmap_pgoff
13346 - .long sys_truncate64
13347 - .long sys_ftruncate64
13348 - .long sys_stat64 /* 195 */
13349 -diff --git a/arch/mn10300/kernel/sys_mn10300.c b/arch/mn10300/kernel/sys_mn10300.c
13350 -index 8ca5af0..17cc6ce 100644
13351 ---- a/arch/mn10300/kernel/sys_mn10300.c
13352 -+++ b/arch/mn10300/kernel/sys_mn10300.c
13353 -@@ -23,47 +23,13 @@
13354 -
13355 - #include <asm/uaccess.h>
13356 -
13357 --#define MIN_MAP_ADDR PAGE_SIZE /* minimum fixed mmap address */
13358 --
13359 --/*
13360 -- * memory mapping syscall
13361 -- */
13362 --asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
13363 -- unsigned long prot, unsigned long flags,
13364 -- unsigned long fd, unsigned long pgoff)
13365 --{
13366 -- struct file *file = NULL;
13367 -- long error = -EINVAL;
13368 --
13369 -- flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
13370 --
13371 -- if (flags & MAP_FIXED && addr < MIN_MAP_ADDR)
13372 -- goto out;
13373 --
13374 -- error = -EBADF;
13375 -- if (!(flags & MAP_ANONYMOUS)) {
13376 -- file = fget(fd);
13377 -- if (!file)
13378 -- goto out;
13379 -- }
13380 --
13381 -- down_write(&current->mm->mmap_sem);
13382 -- error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
13383 -- up_write(&current->mm->mmap_sem);
13384 --
13385 -- if (file)
13386 -- fput(file);
13387 --out:
13388 -- return error;
13389 --}
13390 --
13391 - asmlinkage long old_mmap(unsigned long addr, unsigned long len,
13392 - unsigned long prot, unsigned long flags,
13393 - unsigned long fd, unsigned long offset)
13394 - {
13395 - if (offset & ~PAGE_MASK)
13396 - return -EINVAL;
13397 -- return sys_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
13398 -+ return sys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
13399 - }
13400 -
13401 - struct sel_arg_struct {
13402 -diff --git a/arch/parisc/kernel/sys_parisc.c b/arch/parisc/kernel/sys_parisc.c
13403 -index 71b3195..9147391 100644
13404 ---- a/arch/parisc/kernel/sys_parisc.c
13405 -+++ b/arch/parisc/kernel/sys_parisc.c
13406 -@@ -110,37 +110,14 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
13407 - return addr;
13408 - }
13409 -
13410 --static unsigned long do_mmap2(unsigned long addr, unsigned long len,
13411 -- unsigned long prot, unsigned long flags, unsigned long fd,
13412 -- unsigned long pgoff)
13413 --{
13414 -- struct file * file = NULL;
13415 -- unsigned long error = -EBADF;
13416 -- if (!(flags & MAP_ANONYMOUS)) {
13417 -- file = fget(fd);
13418 -- if (!file)
13419 -- goto out;
13420 -- }
13421 --
13422 -- flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
13423 --
13424 -- down_write(&current->mm->mmap_sem);
13425 -- error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
13426 -- up_write(&current->mm->mmap_sem);
13427 --
13428 -- if (file != NULL)
13429 -- fput(file);
13430 --out:
13431 -- return error;
13432 --}
13433 --
13434 - asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len,
13435 - unsigned long prot, unsigned long flags, unsigned long fd,
13436 - unsigned long pgoff)
13437 - {
13438 - /* Make sure the shift for mmap2 is constant (12), no matter what PAGE_SIZE
13439 - we have. */
13440 -- return do_mmap2(addr, len, prot, flags, fd, pgoff >> (PAGE_SHIFT - 12));
13441 -+ return sys_mmap_pgoff(addr, len, prot, flags, fd,
13442 -+ pgoff >> (PAGE_SHIFT - 12));
13443 - }
13444 -
13445 - asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len,
13446 -@@ -148,7 +125,8 @@ asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len,
13447 - unsigned long offset)
13448 - {
13449 - if (!(offset & ~PAGE_MASK)) {
13450 -- return do_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
13451 -+ return sys_mmap_pgoff(addr, len, prot, flags, fd,
13452 -+ offset >> PAGE_SHIFT);
13453 - } else {
13454 - return -EINVAL;
13455 - }
13456 -diff --git a/arch/powerpc/include/asm/module.h b/arch/powerpc/include/asm/module.h
13457 -index 0845488..0192a4e 100644
13458 ---- a/arch/powerpc/include/asm/module.h
13459 -+++ b/arch/powerpc/include/asm/module.h
13460 -@@ -87,5 +87,10 @@ struct exception_table_entry;
13461 - void sort_ex_table(struct exception_table_entry *start,
13462 - struct exception_table_entry *finish);
13463 -
13464 -+#ifdef CONFIG_MODVERSIONS
13465 -+#define ARCH_RELOCATES_KCRCTAB
13466 -+
13467 -+extern const unsigned long reloc_start[];
13468 -+#endif
13469 - #endif /* __KERNEL__ */
13470 - #endif /* _ASM_POWERPC_MODULE_H */
13471 -diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c
13472 -index c04832c..3370e62 100644
13473 ---- a/arch/powerpc/kernel/syscalls.c
13474 -+++ b/arch/powerpc/kernel/syscalls.c
13475 -@@ -140,7 +140,6 @@ static inline unsigned long do_mmap2(unsigned long addr, size_t len,
13476 - unsigned long prot, unsigned long flags,
13477 - unsigned long fd, unsigned long off, int shift)
13478 - {
13479 -- struct file * file = NULL;
13480 - unsigned long ret = -EINVAL;
13481 -
13482 - if (!arch_validate_prot(prot))
13483 -@@ -151,20 +150,8 @@ static inline unsigned long do_mmap2(unsigned long addr, size_t len,
13484 - goto out;
13485 - off >>= shift;
13486 - }
13487 --
13488 -- ret = -EBADF;
13489 -- if (!(flags & MAP_ANONYMOUS)) {
13490 -- if (!(file = fget(fd)))
13491 -- goto out;
13492 -- }
13493 --
13494 -- flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
13495 -
13496 -- down_write(&current->mm->mmap_sem);
13497 -- ret = do_mmap_pgoff(file, addr, len, prot, flags, off);
13498 -- up_write(&current->mm->mmap_sem);
13499 -- if (file)
13500 -- fput(file);
13501 -+ ret = sys_mmap_pgoff(addr, len, prot, flags, fd, off);
13502 - out:
13503 - return ret;
13504 - }
13505 -diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
13506 -index 27735a7..dcd01c8 100644
13507 ---- a/arch/powerpc/kernel/vmlinux.lds.S
13508 -+++ b/arch/powerpc/kernel/vmlinux.lds.S
13509 -@@ -38,6 +38,9 @@ jiffies = jiffies_64 + 4;
13510 - #endif
13511 - SECTIONS
13512 - {
13513 -+ . = 0;
13514 -+ reloc_start = .;
13515 -+
13516 - . = KERNELBASE;
13517 -
13518 - /*
13519 -diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
13520 -index 0debcec..9c746c0 100644
13521 ---- a/arch/s390/kernel/compat_linux.c
13522 -+++ b/arch/s390/kernel/compat_linux.c
13523 -@@ -683,38 +683,6 @@ struct mmap_arg_struct_emu31 {
13524 - u32 offset;
13525 - };
13526 -
13527 --/* common code for old and new mmaps */
13528 --static inline long do_mmap2(
13529 -- unsigned long addr, unsigned long len,
13530 -- unsigned long prot, unsigned long flags,
13531 -- unsigned long fd, unsigned long pgoff)
13532 --{
13533 -- struct file * file = NULL;
13534 -- unsigned long error = -EBADF;
13535 --
13536 -- flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
13537 -- if (!(flags & MAP_ANONYMOUS)) {
13538 -- file = fget(fd);
13539 -- if (!file)
13540 -- goto out;
13541 -- }
13542 --
13543 -- down_write(&current->mm->mmap_sem);
13544 -- error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
13545 -- if (!IS_ERR((void *) error) && error + len >= 0x80000000ULL) {
13546 -- /* Result is out of bounds. */
13547 -- do_munmap(current->mm, addr, len);
13548 -- error = -ENOMEM;
13549 -- }
13550 -- up_write(&current->mm->mmap_sem);
13551 --
13552 -- if (file)
13553 -- fput(file);
13554 --out:
13555 -- return error;
13556 --}
13557 --
13558 --
13559 - asmlinkage unsigned long
13560 - old32_mmap(struct mmap_arg_struct_emu31 __user *arg)
13561 - {
13562 -@@ -728,7 +696,8 @@ old32_mmap(struct mmap_arg_struct_emu31 __user *arg)
13563 - if (a.offset & ~PAGE_MASK)
13564 - goto out;
13565 -
13566 -- error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT);
13567 -+ error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd,
13568 -+ a.offset >> PAGE_SHIFT);
13569 - out:
13570 - return error;
13571 - }
13572 -@@ -741,7 +710,7 @@ sys32_mmap2(struct mmap_arg_struct_emu31 __user *arg)
13573 -
13574 - if (copy_from_user(&a, arg, sizeof(a)))
13575 - goto out;
13576 -- error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset);
13577 -+ error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset);
13578 - out:
13579 - return error;
13580 - }
13581 -diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
13582 -index e9d94f6..86a74c9 100644
13583 ---- a/arch/s390/kernel/sys_s390.c
13584 -+++ b/arch/s390/kernel/sys_s390.c
13585 -@@ -32,32 +32,6 @@
13586 - #include <asm/uaccess.h>
13587 - #include "entry.h"
13588 -
13589 --/* common code for old and new mmaps */
13590 --static inline long do_mmap2(
13591 -- unsigned long addr, unsigned long len,
13592 -- unsigned long prot, unsigned long flags,
13593 -- unsigned long fd, unsigned long pgoff)
13594 --{
13595 -- long error = -EBADF;
13596 -- struct file * file = NULL;
13597 --
13598 -- flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
13599 -- if (!(flags & MAP_ANONYMOUS)) {
13600 -- file = fget(fd);
13601 -- if (!file)
13602 -- goto out;
13603 -- }
13604 --
13605 -- down_write(&current->mm->mmap_sem);
13606 -- error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
13607 -- up_write(&current->mm->mmap_sem);
13608 --
13609 -- if (file)
13610 -- fput(file);
13611 --out:
13612 -- return error;
13613 --}
13614 --
13615 - /*
13616 - * Perform the select(nd, in, out, ex, tv) and mmap() system
13617 - * calls. Linux for S/390 isn't able to handle more than 5
13618 -@@ -81,7 +55,7 @@ SYSCALL_DEFINE1(mmap2, struct mmap_arg_struct __user *, arg)
13619 -
13620 - if (copy_from_user(&a, arg, sizeof(a)))
13621 - goto out;
13622 -- error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset);
13623 -+ error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset);
13624 - out:
13625 - return error;
13626 - }
13627 -@@ -98,7 +72,7 @@ SYSCALL_DEFINE1(s390_old_mmap, struct mmap_arg_struct __user *, arg)
13628 - if (a.offset & ~PAGE_MASK)
13629 - goto out;
13630 -
13631 -- error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT);
13632 -+ error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT);
13633 - out:
13634 - return error;
13635 - }
13636 -diff --git a/arch/score/kernel/sys_score.c b/arch/score/kernel/sys_score.c
13637 -index 0012494..856ed68 100644
13638 ---- a/arch/score/kernel/sys_score.c
13639 -+++ b/arch/score/kernel/sys_score.c
13640 -@@ -36,34 +36,16 @@ asmlinkage long
13641 - sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
13642 - unsigned long flags, unsigned long fd, unsigned long pgoff)
13643 - {
13644 -- int error = -EBADF;
13645 -- struct file *file = NULL;
13646 --
13647 -- if (pgoff & (~PAGE_MASK >> 12))
13648 -- return -EINVAL;
13649 --
13650 -- flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
13651 -- if (!(flags & MAP_ANONYMOUS)) {
13652 -- file = fget(fd);
13653 -- if (!file)
13654 -- return error;
13655 -- }
13656 --
13657 -- down_write(&current->mm->mmap_sem);
13658 -- error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
13659 -- up_write(&current->mm->mmap_sem);
13660 --
13661 -- if (file)
13662 -- fput(file);
13663 --
13664 -- return error;
13665 -+ return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
13666 - }
13667 -
13668 - asmlinkage long
13669 - sys_mmap(unsigned long addr, unsigned long len, unsigned long prot,
13670 -- unsigned long flags, unsigned long fd, off_t pgoff)
13671 -+ unsigned long flags, unsigned long fd, off_t offset)
13672 - {
13673 -- return sys_mmap2(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT);
13674 -+ if (unlikely(offset & ~PAGE_MASK))
13675 -+ return -EINVAL;
13676 -+ return sys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
13677 - }
13678 -
13679 - asmlinkage long
13680 -diff --git a/arch/sh/kernel/sys_sh.c b/arch/sh/kernel/sys_sh.c
13681 -index 8aa5d1c..71399cd 100644
13682 ---- a/arch/sh/kernel/sys_sh.c
13683 -+++ b/arch/sh/kernel/sys_sh.c
13684 -@@ -28,37 +28,13 @@
13685 - #include <asm/cacheflush.h>
13686 - #include <asm/cachectl.h>
13687 -
13688 --static inline long
13689 --do_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
13690 -- unsigned long flags, int fd, unsigned long pgoff)
13691 --{
13692 -- int error = -EBADF;
13693 -- struct file *file = NULL;
13694 --
13695 -- flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
13696 -- if (!(flags & MAP_ANONYMOUS)) {
13697 -- file = fget(fd);
13698 -- if (!file)
13699 -- goto out;
13700 -- }
13701 --
13702 -- down_write(&current->mm->mmap_sem);
13703 -- error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
13704 -- up_write(&current->mm->mmap_sem);
13705 --
13706 -- if (file)
13707 -- fput(file);
13708 --out:
13709 -- return error;
13710 --}
13711 --
13712 - asmlinkage int old_mmap(unsigned long addr, unsigned long len,
13713 - unsigned long prot, unsigned long flags,
13714 - int fd, unsigned long off)
13715 - {
13716 - if (off & ~PAGE_MASK)
13717 - return -EINVAL;
13718 -- return do_mmap2(addr, len, prot, flags, fd, off>>PAGE_SHIFT);
13719 -+ return sys_mmap_pgoff(addr, len, prot, flags, fd, off>>PAGE_SHIFT);
13720 - }
13721 -
13722 - asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
13723 -@@ -74,7 +50,7 @@ asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
13724 -
13725 - pgoff >>= PAGE_SHIFT - 12;
13726 -
13727 -- return do_mmap2(addr, len, prot, flags, fd, pgoff);
13728 -+ return sys_mmap_pgoff(addr, len, prot, flags, fd, pgoff);
13729 - }
13730 -
13731 - /*
13732 -diff --git a/arch/sh/mm/mmap.c b/arch/sh/mm/mmap.c
13733 -index d2984fa..afeb710 100644
13734 ---- a/arch/sh/mm/mmap.c
13735 -+++ b/arch/sh/mm/mmap.c
13736 -@@ -54,7 +54,8 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
13737 - /* We do not accept a shared mapping if it would violate
13738 - * cache aliasing constraints.
13739 - */
13740 -- if ((flags & MAP_SHARED) && (addr & shm_align_mask))
13741 -+ if ((flags & MAP_SHARED) &&
13742 -+ ((addr - (pgoff << PAGE_SHIFT)) & shm_align_mask))
13743 - return -EINVAL;
13744 - return addr;
13745 - }
13746 -diff --git a/arch/sparc/kernel/sys_sparc_32.c b/arch/sparc/kernel/sys_sparc_32.c
13747 -index 03035c8..3a82e65 100644
13748 ---- a/arch/sparc/kernel/sys_sparc_32.c
13749 -+++ b/arch/sparc/kernel/sys_sparc_32.c
13750 -@@ -45,7 +45,8 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
13751 - /* We do not accept a shared mapping if it would violate
13752 - * cache aliasing constraints.
13753 - */
13754 -- if ((flags & MAP_SHARED) && (addr & (SHMLBA - 1)))
13755 -+ if ((flags & MAP_SHARED) &&
13756 -+ ((addr - (pgoff << PAGE_SHIFT)) & (SHMLBA - 1)))
13757 - return -EINVAL;
13758 - return addr;
13759 - }
13760 -@@ -79,15 +80,6 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr, unsi
13761 - }
13762 - }
13763 -
13764 --asmlinkage unsigned long sparc_brk(unsigned long brk)
13765 --{
13766 -- if(ARCH_SUN4C) {
13767 -- if ((brk & 0xe0000000) != (current->mm->brk & 0xe0000000))
13768 -- return current->mm->brk;
13769 -- }
13770 -- return sys_brk(brk);
13771 --}
13772 --
13773 - /*
13774 - * sys_pipe() is the normal C calling standard for creating
13775 - * a pipe. It's not the way unix traditionally does this, though.
13776 -@@ -234,31 +226,6 @@ int sparc_mmap_check(unsigned long addr, unsigned long len)
13777 - }
13778 -
13779 - /* Linux version of mmap */
13780 --static unsigned long do_mmap2(unsigned long addr, unsigned long len,
13781 -- unsigned long prot, unsigned long flags, unsigned long fd,
13782 -- unsigned long pgoff)
13783 --{
13784 -- struct file * file = NULL;
13785 -- unsigned long retval = -EBADF;
13786 --
13787 -- if (!(flags & MAP_ANONYMOUS)) {
13788 -- file = fget(fd);
13789 -- if (!file)
13790 -- goto out;
13791 -- }
13792 --
13793 -- len = PAGE_ALIGN(len);
13794 -- flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
13795 --
13796 -- down_write(&current->mm->mmap_sem);
13797 -- retval = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
13798 -- up_write(&current->mm->mmap_sem);
13799 --
13800 -- if (file)
13801 -- fput(file);
13802 --out:
13803 -- return retval;
13804 --}
13805 -
13806 - asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len,
13807 - unsigned long prot, unsigned long flags, unsigned long fd,
13808 -@@ -266,14 +233,16 @@ asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len,
13809 - {
13810 - /* Make sure the shift for mmap2 is constant (12), no matter what PAGE_SIZE
13811 - we have. */
13812 -- return do_mmap2(addr, len, prot, flags, fd, pgoff >> (PAGE_SHIFT - 12));
13813 -+ return sys_mmap_pgoff(addr, len, prot, flags, fd,
13814 -+ pgoff >> (PAGE_SHIFT - 12));
13815 - }
13816 -
13817 - asmlinkage unsigned long sys_mmap(unsigned long addr, unsigned long len,
13818 - unsigned long prot, unsigned long flags, unsigned long fd,
13819 - unsigned long off)
13820 - {
13821 -- return do_mmap2(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
13822 -+ /* no alignment check? */
13823 -+ return sys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
13824 - }
13825 -
13826 - long sparc_remap_file_pages(unsigned long start, unsigned long size,
13827 -@@ -287,27 +256,6 @@ long sparc_remap_file_pages(unsigned long start, unsigned long size,
13828 - (pgoff >> (PAGE_SHIFT - 12)), flags);
13829 - }
13830 -
13831 --extern unsigned long do_mremap(unsigned long addr,
13832 -- unsigned long old_len, unsigned long new_len,
13833 -- unsigned long flags, unsigned long new_addr);
13834 --
13835 --asmlinkage unsigned long sparc_mremap(unsigned long addr,
13836 -- unsigned long old_len, unsigned long new_len,
13837 -- unsigned long flags, unsigned long new_addr)
13838 --{
13839 -- unsigned long ret = -EINVAL;
13840 --
13841 -- if (unlikely(sparc_mmap_check(addr, old_len)))
13842 -- goto out;
13843 -- if (unlikely(sparc_mmap_check(new_addr, new_len)))
13844 -- goto out;
13845 -- down_write(&current->mm->mmap_sem);
13846 -- ret = do_mremap(addr, old_len, new_len, flags, new_addr);
13847 -- up_write(&current->mm->mmap_sem);
13848 --out:
13849 -- return ret;
13850 --}
13851 --
13852 - /* we come to here via sys_nis_syscall so it can setup the regs argument */
13853 - asmlinkage unsigned long
13854 - c_sys_nis_syscall (struct pt_regs *regs)
13855 -diff --git a/arch/sparc/kernel/sys_sparc_64.c b/arch/sparc/kernel/sys_sparc_64.c
13856 -index e2d1024..cfa0e19 100644
13857 ---- a/arch/sparc/kernel/sys_sparc_64.c
13858 -+++ b/arch/sparc/kernel/sys_sparc_64.c
13859 -@@ -317,10 +317,14 @@ bottomup:
13860 - unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, unsigned long len, unsigned long pgoff, unsigned long flags)
13861 - {
13862 - unsigned long align_goal, addr = -ENOMEM;
13863 -+ unsigned long (*get_area)(struct file *, unsigned long,
13864 -+ unsigned long, unsigned long, unsigned long);
13865 -+
13866 -+ get_area = current->mm->get_unmapped_area;
13867 -
13868 - if (flags & MAP_FIXED) {
13869 - /* Ok, don't mess with it. */
13870 -- return get_unmapped_area(NULL, orig_addr, len, pgoff, flags);
13871 -+ return get_area(NULL, orig_addr, len, pgoff, flags);
13872 - }
13873 - flags &= ~MAP_SHARED;
13874 -
13875 -@@ -333,7 +337,7 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, u
13876 - align_goal = (64UL * 1024);
13877 -
13878 - do {
13879 -- addr = get_unmapped_area(NULL, orig_addr, len + (align_goal - PAGE_SIZE), pgoff, flags);
13880 -+ addr = get_area(NULL, orig_addr, len + (align_goal - PAGE_SIZE), pgoff, flags);
13881 - if (!(addr & ~PAGE_MASK)) {
13882 - addr = (addr + (align_goal - 1UL)) & ~(align_goal - 1UL);
13883 - break;
13884 -@@ -351,7 +355,7 @@ unsigned long get_fb_unmapped_area(struct file *filp, unsigned long orig_addr, u
13885 - * be obtained.
13886 - */
13887 - if (addr & ~PAGE_MASK)
13888 -- addr = get_unmapped_area(NULL, orig_addr, len, pgoff, flags);
13889 -+ addr = get_area(NULL, orig_addr, len, pgoff, flags);
13890 -
13891 - return addr;
13892 - }
13893 -@@ -399,18 +403,6 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
13894 - }
13895 - }
13896 -
13897 --SYSCALL_DEFINE1(sparc_brk, unsigned long, brk)
13898 --{
13899 -- /* People could try to be nasty and use ta 0x6d in 32bit programs */
13900 -- if (test_thread_flag(TIF_32BIT) && brk >= STACK_TOP32)
13901 -- return current->mm->brk;
13902 --
13903 -- if (unlikely(straddles_64bit_va_hole(current->mm->brk, brk)))
13904 -- return current->mm->brk;
13905 --
13906 -- return sys_brk(brk);
13907 --}
13908 --
13909 - /*
13910 - * sys_pipe() is the normal C calling standard for creating
13911 - * a pipe. It's not the way unix traditionally does this, though.
13912 -@@ -568,23 +560,13 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
13913 - unsigned long, prot, unsigned long, flags, unsigned long, fd,
13914 - unsigned long, off)
13915 - {
13916 -- struct file * file = NULL;
13917 -- unsigned long retval = -EBADF;
13918 --
13919 -- if (!(flags & MAP_ANONYMOUS)) {
13920 -- file = fget(fd);
13921 -- if (!file)
13922 -- goto out;
13923 -- }
13924 -- flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
13925 -- len = PAGE_ALIGN(len);
13926 -+ unsigned long retval = -EINVAL;
13927 -
13928 -- down_write(&current->mm->mmap_sem);
13929 -- retval = do_mmap(file, addr, len, prot, flags, off);
13930 -- up_write(&current->mm->mmap_sem);
13931 --
13932 -- if (file)
13933 -- fput(file);
13934 -+ if ((off + PAGE_ALIGN(len)) < off)
13935 -+ goto out;
13936 -+ if (off & ~PAGE_MASK)
13937 -+ goto out;
13938 -+ retval = sys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
13939 - out:
13940 - return retval;
13941 - }
13942 -@@ -614,12 +596,6 @@ SYSCALL_DEFINE5(64_mremap, unsigned long, addr, unsigned long, old_len,
13943 -
13944 - if (test_thread_flag(TIF_32BIT))
13945 - goto out;
13946 -- if (unlikely(new_len >= VA_EXCLUDE_START))
13947 -- goto out;
13948 -- if (unlikely(sparc_mmap_check(addr, old_len)))
13949 -- goto out;
13950 -- if (unlikely(sparc_mmap_check(new_addr, new_len)))
13951 -- goto out;
13952 -
13953 - down_write(&current->mm->mmap_sem);
13954 - ret = do_mremap(addr, old_len, new_len, flags, new_addr);
13955 -diff --git a/arch/sparc/kernel/systbls.h b/arch/sparc/kernel/systbls.h
13956 -index a63c5d2..d2f999a 100644
13957 ---- a/arch/sparc/kernel/systbls.h
13958 -+++ b/arch/sparc/kernel/systbls.h
13959 -@@ -9,7 +9,6 @@
13960 - struct new_utsname;
13961 -
13962 - extern asmlinkage unsigned long sys_getpagesize(void);
13963 --extern asmlinkage unsigned long sparc_brk(unsigned long brk);
13964 - extern asmlinkage long sparc_pipe(struct pt_regs *regs);
13965 - extern asmlinkage long sys_ipc(unsigned int call, int first,
13966 - unsigned long second,
13967 -diff --git a/arch/sparc/kernel/systbls_32.S b/arch/sparc/kernel/systbls_32.S
13968 -index 0f1658d..14f950a 100644
13969 ---- a/arch/sparc/kernel/systbls_32.S
13970 -+++ b/arch/sparc/kernel/systbls_32.S
13971 -@@ -19,7 +19,7 @@ sys_call_table:
13972 - /*0*/ .long sys_restart_syscall, sys_exit, sys_fork, sys_read, sys_write
13973 - /*5*/ .long sys_open, sys_close, sys_wait4, sys_creat, sys_link
13974 - /*10*/ .long sys_unlink, sunos_execv, sys_chdir, sys_chown16, sys_mknod
13975 --/*15*/ .long sys_chmod, sys_lchown16, sparc_brk, sys_nis_syscall, sys_lseek
13976 -+/*15*/ .long sys_chmod, sys_lchown16, sys_brk, sys_nis_syscall, sys_lseek
13977 - /*20*/ .long sys_getpid, sys_capget, sys_capset, sys_setuid16, sys_getuid16
13978 - /*25*/ .long sys_vmsplice, sys_ptrace, sys_alarm, sys_sigaltstack, sys_pause
13979 - /*30*/ .long sys_utime, sys_lchown, sys_fchown, sys_access, sys_nice
13980 -@@ -67,7 +67,7 @@ sys_call_table:
13981 - /*235*/ .long sys_fstatfs64, sys_llseek, sys_mlock, sys_munlock, sys_mlockall
13982 - /*240*/ .long sys_munlockall, sys_sched_setparam, sys_sched_getparam, sys_sched_setscheduler, sys_sched_getscheduler
13983 - /*245*/ .long sys_sched_yield, sys_sched_get_priority_max, sys_sched_get_priority_min, sys_sched_rr_get_interval, sys_nanosleep
13984 --/*250*/ .long sparc_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl
13985 -+/*250*/ .long sys_mremap, sys_sysctl, sys_getsid, sys_fdatasync, sys_nfsservctl
13986 - /*255*/ .long sys_sync_file_range, sys_clock_settime, sys_clock_gettime, sys_clock_getres, sys_clock_nanosleep
13987 - /*260*/ .long sys_sched_getaffinity, sys_sched_setaffinity, sys_timer_settime, sys_timer_gettime, sys_timer_getoverrun
13988 - /*265*/ .long sys_timer_delete, sys_timer_create, sys_nis_syscall, sys_io_setup, sys_io_destroy
13989 -diff --git a/arch/sparc/kernel/systbls_64.S b/arch/sparc/kernel/systbls_64.S
13990 -index 009825f..f63c871 100644
13991 ---- a/arch/sparc/kernel/systbls_64.S
13992 -+++ b/arch/sparc/kernel/systbls_64.S
13993 -@@ -21,7 +21,7 @@ sys_call_table32:
13994 - /*0*/ .word sys_restart_syscall, sys32_exit, sys_fork, sys_read, sys_write
13995 - /*5*/ .word sys32_open, sys_close, sys32_wait4, sys32_creat, sys_link
13996 - /*10*/ .word sys_unlink, sunos_execv, sys_chdir, sys_chown16, sys32_mknod
13997 --/*15*/ .word sys_chmod, sys_lchown16, sys_sparc_brk, sys32_perfctr, sys32_lseek
13998 -+/*15*/ .word sys_chmod, sys_lchown16, sys_brk, sys32_perfctr, sys32_lseek
13999 - /*20*/ .word sys_getpid, sys_capget, sys_capset, sys_setuid16, sys_getuid16
14000 - /*25*/ .word sys32_vmsplice, compat_sys_ptrace, sys_alarm, sys32_sigaltstack, sys_pause
14001 - /*30*/ .word compat_sys_utime, sys_lchown, sys_fchown, sys32_access, sys32_nice
14002 -@@ -96,7 +96,7 @@ sys_call_table:
14003 - /*0*/ .word sys_restart_syscall, sparc_exit, sys_fork, sys_read, sys_write
14004 - /*5*/ .word sys_open, sys_close, sys_wait4, sys_creat, sys_link
14005 - /*10*/ .word sys_unlink, sys_nis_syscall, sys_chdir, sys_chown, sys_mknod
14006 --/*15*/ .word sys_chmod, sys_lchown, sys_sparc_brk, sys_perfctr, sys_lseek
14007 -+/*15*/ .word sys_chmod, sys_lchown, sys_brk, sys_perfctr, sys_lseek
14008 - /*20*/ .word sys_getpid, sys_capget, sys_capset, sys_setuid, sys_getuid
14009 - /*25*/ .word sys_vmsplice, sys_ptrace, sys_alarm, sys_sigaltstack, sys_nis_syscall
14010 - /*30*/ .word sys_utime, sys_nis_syscall, sys_nis_syscall, sys_access, sys_nice
14011 -diff --git a/arch/um/kernel/syscall.c b/arch/um/kernel/syscall.c
14012 -index a4625c7..cccab85 100644
14013 ---- a/arch/um/kernel/syscall.c
14014 -+++ b/arch/um/kernel/syscall.c
14015 -@@ -8,6 +8,7 @@
14016 - #include "linux/mm.h"
14017 - #include "linux/sched.h"
14018 - #include "linux/utsname.h"
14019 -+#include "linux/syscalls.h"
14020 - #include "asm/current.h"
14021 - #include "asm/mman.h"
14022 - #include "asm/uaccess.h"
14023 -@@ -37,31 +38,6 @@ long sys_vfork(void)
14024 - return ret;
14025 - }
14026 -
14027 --/* common code for old and new mmaps */
14028 --long sys_mmap2(unsigned long addr, unsigned long len,
14029 -- unsigned long prot, unsigned long flags,
14030 -- unsigned long fd, unsigned long pgoff)
14031 --{
14032 -- long error = -EBADF;
14033 -- struct file * file = NULL;
14034 --
14035 -- flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
14036 -- if (!(flags & MAP_ANONYMOUS)) {
14037 -- file = fget(fd);
14038 -- if (!file)
14039 -- goto out;
14040 -- }
14041 --
14042 -- down_write(&current->mm->mmap_sem);
14043 -- error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
14044 -- up_write(&current->mm->mmap_sem);
14045 --
14046 -- if (file)
14047 -- fput(file);
14048 -- out:
14049 -- return error;
14050 --}
14051 --
14052 - long old_mmap(unsigned long addr, unsigned long len,
14053 - unsigned long prot, unsigned long flags,
14054 - unsigned long fd, unsigned long offset)
14055 -@@ -70,7 +46,7 @@ long old_mmap(unsigned long addr, unsigned long len,
14056 - if (offset & ~PAGE_MASK)
14057 - goto out;
14058 -
14059 -- err = sys_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
14060 -+ err = sys_mmap_pgoff(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
14061 - out:
14062 - return err;
14063 - }
14064 -diff --git a/arch/um/sys-i386/shared/sysdep/syscalls.h b/arch/um/sys-i386/shared/sysdep/syscalls.h
14065 -index 9056981..e778767 100644
14066 ---- a/arch/um/sys-i386/shared/sysdep/syscalls.h
14067 -+++ b/arch/um/sys-i386/shared/sysdep/syscalls.h
14068 -@@ -20,7 +20,3 @@ extern syscall_handler_t *sys_call_table[];
14069 - #define EXECUTE_SYSCALL(syscall, regs) \
14070 - ((long (*)(struct syscall_args)) \
14071 - (*sys_call_table[syscall]))(SYSCALL_ARGS(&regs->regs))
14072 --
14073 --extern long sys_mmap2(unsigned long addr, unsigned long len,
14074 -- unsigned long prot, unsigned long flags,
14075 -- unsigned long fd, unsigned long pgoff);
14076 -diff --git a/arch/x86/Kconfig.cpu b/arch/x86/Kconfig.cpu
14077 -index 2649840..f2824fb 100644
14078 ---- a/arch/x86/Kconfig.cpu
14079 -+++ b/arch/x86/Kconfig.cpu
14080 -@@ -400,7 +400,7 @@ config X86_TSC
14081 -
14082 - config X86_CMPXCHG64
14083 - def_bool y
14084 -- depends on !M386 && !M486
14085 -+ depends on X86_PAE || X86_64 || MCORE2 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MATOM
14086 -
14087 - # this should be set for all -march=.. options where the compiler
14088 - # generates cmov.
14089 -diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S
14090 -index 581b056..5294d84 100644
14091 ---- a/arch/x86/ia32/ia32entry.S
14092 -+++ b/arch/x86/ia32/ia32entry.S
14093 -@@ -696,7 +696,7 @@ ia32_sys_call_table:
14094 - .quad quiet_ni_syscall /* streams2 */
14095 - .quad stub32_vfork /* 190 */
14096 - .quad compat_sys_getrlimit
14097 -- .quad sys32_mmap2
14098 -+ .quad sys_mmap_pgoff
14099 - .quad sys32_truncate64
14100 - .quad sys32_ftruncate64
14101 - .quad sys32_stat64 /* 195 */
14102 -diff --git a/arch/x86/ia32/sys_ia32.c b/arch/x86/ia32/sys_ia32.c
14103 -index 9f55271..016218c 100644
14104 ---- a/arch/x86/ia32/sys_ia32.c
14105 -+++ b/arch/x86/ia32/sys_ia32.c
14106 -@@ -155,9 +155,6 @@ struct mmap_arg_struct {
14107 - asmlinkage long sys32_mmap(struct mmap_arg_struct __user *arg)
14108 - {
14109 - struct mmap_arg_struct a;
14110 -- struct file *file = NULL;
14111 -- unsigned long retval;
14112 -- struct mm_struct *mm ;
14113 -
14114 - if (copy_from_user(&a, arg, sizeof(a)))
14115 - return -EFAULT;
14116 -@@ -165,22 +162,8 @@ asmlinkage long sys32_mmap(struct mmap_arg_struct __user *arg)
14117 - if (a.offset & ~PAGE_MASK)
14118 - return -EINVAL;
14119 -
14120 -- if (!(a.flags & MAP_ANONYMOUS)) {
14121 -- file = fget(a.fd);
14122 -- if (!file)
14123 -- return -EBADF;
14124 -- }
14125 --
14126 -- mm = current->mm;
14127 -- down_write(&mm->mmap_sem);
14128 -- retval = do_mmap_pgoff(file, a.addr, a.len, a.prot, a.flags,
14129 -+ return sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd,
14130 - a.offset>>PAGE_SHIFT);
14131 -- if (file)
14132 -- fput(file);
14133 --
14134 -- up_write(&mm->mmap_sem);
14135 --
14136 -- return retval;
14137 - }
14138 -
14139 - asmlinkage long sys32_mprotect(unsigned long start, size_t len,
14140 -@@ -539,30 +522,6 @@ asmlinkage long sys32_sendfile(int out_fd, int in_fd,
14141 - return ret;
14142 - }
14143 -
14144 --asmlinkage long sys32_mmap2(unsigned long addr, unsigned long len,
14145 -- unsigned long prot, unsigned long flags,
14146 -- unsigned long fd, unsigned long pgoff)
14147 --{
14148 -- struct mm_struct *mm = current->mm;
14149 -- unsigned long error;
14150 -- struct file *file = NULL;
14151 --
14152 -- flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
14153 -- if (!(flags & MAP_ANONYMOUS)) {
14154 -- file = fget(fd);
14155 -- if (!file)
14156 -- return -EBADF;
14157 -- }
14158 --
14159 -- down_write(&mm->mmap_sem);
14160 -- error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
14161 -- up_write(&mm->mmap_sem);
14162 --
14163 -- if (file)
14164 -- fput(file);
14165 -- return error;
14166 --}
14167 --
14168 - asmlinkage long sys32_olduname(struct oldold_utsname __user *name)
14169 - {
14170 - char *arch = "x86_64";
14171 -diff --git a/arch/x86/include/asm/sys_ia32.h b/arch/x86/include/asm/sys_ia32.h
14172 -index 72a6dcd..77c1184 100644
14173 ---- a/arch/x86/include/asm/sys_ia32.h
14174 -+++ b/arch/x86/include/asm/sys_ia32.h
14175 -@@ -62,9 +62,6 @@ asmlinkage long sys32_pwrite(unsigned int, char __user *, u32, u32, u32);
14176 - asmlinkage long sys32_personality(unsigned long);
14177 - asmlinkage long sys32_sendfile(int, int, compat_off_t __user *, s32);
14178 -
14179 --asmlinkage long sys32_mmap2(unsigned long, unsigned long, unsigned long,
14180 -- unsigned long, unsigned long, unsigned long);
14181 --
14182 - struct oldold_utsname;
14183 - struct old_utsname;
14184 - asmlinkage long sys32_olduname(struct oldold_utsname __user *);
14185 -diff --git a/arch/x86/include/asm/syscalls.h b/arch/x86/include/asm/syscalls.h
14186 -index 372b76e..1bb6e39 100644
14187 ---- a/arch/x86/include/asm/syscalls.h
14188 -+++ b/arch/x86/include/asm/syscalls.h
14189 -@@ -55,8 +55,6 @@ struct sel_arg_struct;
14190 - struct oldold_utsname;
14191 - struct old_utsname;
14192 -
14193 --asmlinkage long sys_mmap2(unsigned long, unsigned long, unsigned long,
14194 -- unsigned long, unsigned long, unsigned long);
14195 - asmlinkage int old_mmap(struct mmap_arg_struct __user *);
14196 - asmlinkage int old_select(struct sel_arg_struct __user *);
14197 - asmlinkage int sys_ipc(uint, int, int, int, void __user *, long);
14198 -diff --git a/arch/x86/kernel/sys_i386_32.c b/arch/x86/kernel/sys_i386_32.c
14199 -index 1884a8d..dee1ff7 100644
14200 ---- a/arch/x86/kernel/sys_i386_32.c
14201 -+++ b/arch/x86/kernel/sys_i386_32.c
14202 -@@ -24,31 +24,6 @@
14203 -
14204 - #include <asm/syscalls.h>
14205 -
14206 --asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
14207 -- unsigned long prot, unsigned long flags,
14208 -- unsigned long fd, unsigned long pgoff)
14209 --{
14210 -- int error = -EBADF;
14211 -- struct file *file = NULL;
14212 -- struct mm_struct *mm = current->mm;
14213 --
14214 -- flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
14215 -- if (!(flags & MAP_ANONYMOUS)) {
14216 -- file = fget(fd);
14217 -- if (!file)
14218 -- goto out;
14219 -- }
14220 --
14221 -- down_write(&mm->mmap_sem);
14222 -- error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
14223 -- up_write(&mm->mmap_sem);
14224 --
14225 -- if (file)
14226 -- fput(file);
14227 --out:
14228 -- return error;
14229 --}
14230 --
14231 - /*
14232 - * Perform the select(nd, in, out, ex, tv) and mmap() system
14233 - * calls. Linux/i386 didn't use to be able to handle more than
14234 -@@ -77,7 +52,7 @@ asmlinkage int old_mmap(struct mmap_arg_struct __user *arg)
14235 - if (a.offset & ~PAGE_MASK)
14236 - goto out;
14237 -
14238 -- err = sys_mmap2(a.addr, a.len, a.prot, a.flags,
14239 -+ err = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags,
14240 - a.fd, a.offset >> PAGE_SHIFT);
14241 - out:
14242 - return err;
14243 -diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c
14244 -index 45e00eb..8aa2057 100644
14245 ---- a/arch/x86/kernel/sys_x86_64.c
14246 -+++ b/arch/x86/kernel/sys_x86_64.c
14247 -@@ -23,26 +23,11 @@ SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
14248 - unsigned long, fd, unsigned long, off)
14249 - {
14250 - long error;
14251 -- struct file *file;
14252 --
14253 - error = -EINVAL;
14254 - if (off & ~PAGE_MASK)
14255 - goto out;
14256 -
14257 -- error = -EBADF;
14258 -- file = NULL;
14259 -- flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
14260 -- if (!(flags & MAP_ANONYMOUS)) {
14261 -- file = fget(fd);
14262 -- if (!file)
14263 -- goto out;
14264 -- }
14265 -- down_write(&current->mm->mmap_sem);
14266 -- error = do_mmap_pgoff(file, addr, len, prot, flags, off >> PAGE_SHIFT);
14267 -- up_write(&current->mm->mmap_sem);
14268 --
14269 -- if (file)
14270 -- fput(file);
14271 -+ error = sys_mmap_pgoff(addr, len, prot, flags, fd, off >> PAGE_SHIFT);
14272 - out:
14273 - return error;
14274 - }
14275 -diff --git a/arch/x86/kernel/syscall_table_32.S b/arch/x86/kernel/syscall_table_32.S
14276 -index 0157cd2..76d70a4 100644
14277 ---- a/arch/x86/kernel/syscall_table_32.S
14278 -+++ b/arch/x86/kernel/syscall_table_32.S
14279 -@@ -191,7 +191,7 @@ ENTRY(sys_call_table)
14280 - .long sys_ni_syscall /* reserved for streams2 */
14281 - .long ptregs_vfork /* 190 */
14282 - .long sys_getrlimit
14283 -- .long sys_mmap2
14284 -+ .long sys_mmap_pgoff
14285 - .long sys_truncate64
14286 - .long sys_ftruncate64
14287 - .long sys_stat64 /* 195 */
14288 -diff --git a/arch/xtensa/include/asm/syscall.h b/arch/xtensa/include/asm/syscall.h
14289 -index 05cebf8..4352dbe 100644
14290 ---- a/arch/xtensa/include/asm/syscall.h
14291 -+++ b/arch/xtensa/include/asm/syscall.h
14292 -@@ -13,8 +13,6 @@ struct sigaction;
14293 - asmlinkage long xtensa_execve(char*, char**, char**, struct pt_regs*);
14294 - asmlinkage long xtensa_clone(unsigned long, unsigned long, struct pt_regs*);
14295 - asmlinkage long xtensa_pipe(int __user *);
14296 --asmlinkage long xtensa_mmap2(unsigned long, unsigned long, unsigned long,
14297 -- unsigned long, unsigned long, unsigned long);
14298 - asmlinkage long xtensa_ptrace(long, long, long, long);
14299 - asmlinkage long xtensa_sigreturn(struct pt_regs*);
14300 - asmlinkage long xtensa_rt_sigreturn(struct pt_regs*);
14301 -diff --git a/arch/xtensa/include/asm/unistd.h b/arch/xtensa/include/asm/unistd.h
14302 -index c092c8f..9a5c354 100644
14303 ---- a/arch/xtensa/include/asm/unistd.h
14304 -+++ b/arch/xtensa/include/asm/unistd.h
14305 -@@ -189,7 +189,7 @@ __SYSCALL( 79, sys_fremovexattr, 2)
14306 - /* File Map / Shared Memory Operations */
14307 -
14308 - #define __NR_mmap2 80
14309 --__SYSCALL( 80, xtensa_mmap2, 6)
14310 -+__SYSCALL( 80, sys_mmap_pgoff, 6)
14311 - #define __NR_munmap 81
14312 - __SYSCALL( 81, sys_munmap, 2)
14313 - #define __NR_mprotect 82
14314 -diff --git a/arch/xtensa/kernel/syscall.c b/arch/xtensa/kernel/syscall.c
14315 -index ac15ecb..1e67bab 100644
14316 ---- a/arch/xtensa/kernel/syscall.c
14317 -+++ b/arch/xtensa/kernel/syscall.c
14318 -@@ -57,31 +57,6 @@ asmlinkage long xtensa_pipe(int __user *userfds)
14319 - return error;
14320 - }
14321 -
14322 --
14323 --asmlinkage long xtensa_mmap2(unsigned long addr, unsigned long len,
14324 -- unsigned long prot, unsigned long flags,
14325 -- unsigned long fd, unsigned long pgoff)
14326 --{
14327 -- int error = -EBADF;
14328 -- struct file * file = NULL;
14329 --
14330 -- flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
14331 -- if (!(flags & MAP_ANONYMOUS)) {
14332 -- file = fget(fd);
14333 -- if (!file)
14334 -- goto out;
14335 -- }
14336 --
14337 -- down_write(&current->mm->mmap_sem);
14338 -- error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
14339 -- up_write(&current->mm->mmap_sem);
14340 --
14341 -- if (file)
14342 -- fput(file);
14343 --out:
14344 -- return error;
14345 --}
14346 --
14347 - asmlinkage long xtensa_shmat(int shmid, char __user *shmaddr, int shmflg)
14348 - {
14349 - unsigned long ret;
14350 -diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c
14351 -index 3cb56a0..4dcfef0 100644
14352 ---- a/drivers/char/agp/intel-agp.c
14353 -+++ b/drivers/char/agp/intel-agp.c
14354 -@@ -178,6 +178,7 @@ static struct _intel_private {
14355 - * popup and for the GTT.
14356 - */
14357 - int gtt_entries; /* i830+ */
14358 -+ int gtt_total_size;
14359 - union {
14360 - void __iomem *i9xx_flush_page;
14361 - void *i8xx_flush_page;
14362 -@@ -1153,7 +1154,7 @@ static int intel_i915_configure(void)
14363 - readl(intel_private.registers+I810_PGETBL_CTL); /* PCI Posting. */
14364 -
14365 - if (agp_bridge->driver->needs_scratch_page) {
14366 -- for (i = intel_private.gtt_entries; i < current_size->num_entries; i++) {
14367 -+ for (i = intel_private.gtt_entries; i < intel_private.gtt_total_size; i++) {
14368 - writel(agp_bridge->scratch_page, intel_private.gtt+i);
14369 - }
14370 - readl(intel_private.gtt+i-1); /* PCI Posting. */
14371 -@@ -1308,6 +1309,8 @@ static int intel_i915_create_gatt_table(struct agp_bridge_data *bridge)
14372 - if (!intel_private.gtt)
14373 - return -ENOMEM;
14374 -
14375 -+ intel_private.gtt_total_size = gtt_map_size / 4;
14376 -+
14377 - temp &= 0xfff80000;
14378 -
14379 - intel_private.registers = ioremap(temp, 128 * 4096);
14380 -@@ -1395,6 +1398,8 @@ static int intel_i965_create_gatt_table(struct agp_bridge_data *bridge)
14381 - if (!intel_private.gtt)
14382 - return -ENOMEM;
14383 -
14384 -+ intel_private.gtt_total_size = gtt_size / 4;
14385 -+
14386 - intel_private.registers = ioremap(temp, 128 * 4096);
14387 - if (!intel_private.registers) {
14388 - iounmap(intel_private.gtt);
14389 -diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c
14390 -index 6810443..73655ae 100644
14391 ---- a/drivers/cpuidle/governors/menu.c
14392 -+++ b/drivers/cpuidle/governors/menu.c
14393 -@@ -18,6 +18,7 @@
14394 - #include <linux/hrtimer.h>
14395 - #include <linux/tick.h>
14396 - #include <linux/sched.h>
14397 -+#include <linux/math64.h>
14398 -
14399 - #define BUCKETS 12
14400 - #define RESOLUTION 1024
14401 -@@ -169,6 +170,12 @@ static DEFINE_PER_CPU(struct menu_device, menu_devices);
14402 -
14403 - static void menu_update(struct cpuidle_device *dev);
14404 -
14405 -+/* This implements DIV_ROUND_CLOSEST but avoids 64 bit division */
14406 -+static u64 div_round64(u64 dividend, u32 divisor)
14407 -+{
14408 -+ return div_u64(dividend + (divisor / 2), divisor);
14409 -+}
14410 -+
14411 - /**
14412 - * menu_select - selects the next idle state to enter
14413 - * @dev: the CPU
14414 -@@ -209,9 +216,8 @@ static int menu_select(struct cpuidle_device *dev)
14415 - data->correction_factor[data->bucket] = RESOLUTION * DECAY;
14416 -
14417 - /* Make sure to round up for half microseconds */
14418 -- data->predicted_us = DIV_ROUND_CLOSEST(
14419 -- data->expected_us * data->correction_factor[data->bucket],
14420 -- RESOLUTION * DECAY);
14421 -+ data->predicted_us = div_round64(data->expected_us * data->correction_factor[data->bucket],
14422 -+ RESOLUTION * DECAY);
14423 -
14424 - /*
14425 - * We want to default to C1 (hlt), not to busy polling
14426 -diff --git a/drivers/gpu/drm/ati_pcigart.c b/drivers/gpu/drm/ati_pcigart.c
14427 -index 628eae3..a1fce68 100644
14428 ---- a/drivers/gpu/drm/ati_pcigart.c
14429 -+++ b/drivers/gpu/drm/ati_pcigart.c
14430 -@@ -39,8 +39,7 @@ static int drm_ati_alloc_pcigart_table(struct drm_device *dev,
14431 - struct drm_ati_pcigart_info *gart_info)
14432 - {
14433 - gart_info->table_handle = drm_pci_alloc(dev, gart_info->table_size,
14434 -- PAGE_SIZE,
14435 -- gart_info->table_mask);
14436 -+ PAGE_SIZE);
14437 - if (gart_info->table_handle == NULL)
14438 - return -ENOMEM;
14439 -
14440 -@@ -112,6 +111,13 @@ int drm_ati_pcigart_init(struct drm_device *dev, struct drm_ati_pcigart_info *ga
14441 - if (gart_info->gart_table_location == DRM_ATI_GART_MAIN) {
14442 - DRM_DEBUG("PCI: no table in VRAM: using normal RAM\n");
14443 -
14444 -+ if (pci_set_dma_mask(dev->pdev, gart_info->table_mask)) {
14445 -+ DRM_ERROR("fail to set dma mask to 0x%Lx\n",
14446 -+ gart_info->table_mask);
14447 -+ ret = 1;
14448 -+ goto done;
14449 -+ }
14450 -+
14451 - ret = drm_ati_alloc_pcigart_table(dev, gart_info);
14452 - if (ret) {
14453 - DRM_ERROR("cannot allocate PCI GART page!\n");
14454 -diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
14455 -index 3d09e30..8417cc4 100644
14456 ---- a/drivers/gpu/drm/drm_bufs.c
14457 -+++ b/drivers/gpu/drm/drm_bufs.c
14458 -@@ -326,7 +326,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,
14459 - * As we're limiting the address to 2^32-1 (or less),
14460 - * casting it down to 32 bits is no problem, but we
14461 - * need to point to a 64bit variable first. */
14462 -- dmah = drm_pci_alloc(dev, map->size, map->size, 0xffffffffUL);
14463 -+ dmah = drm_pci_alloc(dev, map->size, map->size);
14464 - if (!dmah) {
14465 - kfree(map);
14466 - return -ENOMEM;
14467 -@@ -885,7 +885,7 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request)
14468 -
14469 - while (entry->buf_count < count) {
14470 -
14471 -- dmah = drm_pci_alloc(dev, PAGE_SIZE << page_order, 0x1000, 0xfffffffful);
14472 -+ dmah = drm_pci_alloc(dev, PAGE_SIZE << page_order, 0x1000);
14473 -
14474 - if (!dmah) {
14475 - /* Set count correctly so we free the proper amount. */
14476 -diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
14477 -index 577094f..e68ebf9 100644
14478 ---- a/drivers/gpu/drm/drm_pci.c
14479 -+++ b/drivers/gpu/drm/drm_pci.c
14480 -@@ -47,8 +47,7 @@
14481 - /**
14482 - * \brief Allocate a PCI consistent memory block, for DMA.
14483 - */
14484 --drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t align,
14485 -- dma_addr_t maxaddr)
14486 -+drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t align)
14487 - {
14488 - drm_dma_handle_t *dmah;
14489 - #if 1
14490 -@@ -63,11 +62,6 @@ drm_dma_handle_t *drm_pci_alloc(struct drm_device * dev, size_t size, size_t ali
14491 - if (align > size)
14492 - return NULL;
14493 -
14494 -- if (pci_set_dma_mask(dev->pdev, maxaddr) != 0) {
14495 -- DRM_ERROR("Setting pci dma mask failed\n");
14496 -- return NULL;
14497 -- }
14498 --
14499 - dmah = kmalloc(sizeof(drm_dma_handle_t), GFP_KERNEL);
14500 - if (!dmah)
14501 - return NULL;
14502 -diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
14503 -index e5b138b..bc2db7d 100644
14504 ---- a/drivers/gpu/drm/i915/i915_dma.c
14505 -+++ b/drivers/gpu/drm/i915/i915_dma.c
14506 -@@ -123,7 +123,7 @@ static int i915_init_phys_hws(struct drm_device *dev)
14507 - drm_i915_private_t *dev_priv = dev->dev_private;
14508 - /* Program Hardware Status Page */
14509 - dev_priv->status_page_dmah =
14510 -- drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE, 0xffffffff);
14511 -+ drm_pci_alloc(dev, PAGE_SIZE, PAGE_SIZE);
14512 -
14513 - if (!dev_priv->status_page_dmah) {
14514 - DRM_ERROR("Can not allocate hardware status page\n");
14515 -@@ -1111,7 +1111,8 @@ static void i915_setup_compression(struct drm_device *dev, int size)
14516 - {
14517 - struct drm_i915_private *dev_priv = dev->dev_private;
14518 - struct drm_mm_node *compressed_fb, *compressed_llb;
14519 -- unsigned long cfb_base, ll_base;
14520 -+ unsigned long cfb_base;
14521 -+ unsigned long ll_base = 0;
14522 -
14523 - /* Leave 1M for line length buffer & misc. */
14524 - compressed_fb = drm_mm_search_free(&dev_priv->vram, size, 4096, 0);
14525 -diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
14526 -index ecbafd0..791fded 100644
14527 ---- a/drivers/gpu/drm/i915/i915_drv.h
14528 -+++ b/drivers/gpu/drm/i915/i915_drv.h
14529 -@@ -546,6 +546,7 @@ typedef struct drm_i915_private {
14530 - struct timer_list idle_timer;
14531 - bool busy;
14532 - u16 orig_clock;
14533 -+ struct drm_connector *int_lvds_connector;
14534 - } drm_i915_private_t;
14535 -
14536 - /** driver private structure attached to each drm_gem_object */
14537 -diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
14538 -index 5ddbd38..df2c625 100644
14539 ---- a/drivers/gpu/drm/i915/i915_gem.c
14540 -+++ b/drivers/gpu/drm/i915/i915_gem.c
14541 -@@ -2010,9 +2010,6 @@ i915_gem_object_unbind(struct drm_gem_object *obj)
14542 - /* blow away mappings if mapped through GTT */
14543 - i915_gem_release_mmap(obj);
14544 -
14545 -- if (obj_priv->fence_reg != I915_FENCE_REG_NONE)
14546 -- i915_gem_clear_fence_reg(obj);
14547 --
14548 - /* Move the object to the CPU domain to ensure that
14549 - * any possible CPU writes while it's not in the GTT
14550 - * are flushed when we go to remap it. This will
14551 -@@ -2028,6 +2025,10 @@ i915_gem_object_unbind(struct drm_gem_object *obj)
14552 -
14553 - BUG_ON(obj_priv->active);
14554 -
14555 -+ /* release the fence reg _after_ flushing */
14556 -+ if (obj_priv->fence_reg != I915_FENCE_REG_NONE)
14557 -+ i915_gem_clear_fence_reg(obj);
14558 -+
14559 - if (obj_priv->agp_mem != NULL) {
14560 - drm_unbind_agp(obj_priv->agp_mem);
14561 - drm_free_agp(obj_priv->agp_mem, obj->size / PAGE_SIZE);
14562 -@@ -2570,9 +2571,6 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment)
14563 - bool retry_alloc = false;
14564 - int ret;
14565 -
14566 -- if (dev_priv->mm.suspended)
14567 -- return -EBUSY;
14568 --
14569 - if (obj_priv->madv != I915_MADV_WILLNEED) {
14570 - DRM_ERROR("Attempting to bind a purgeable object\n");
14571 - return -EINVAL;
14572 -@@ -4639,7 +4637,7 @@ int i915_gem_init_phys_object(struct drm_device *dev,
14573 -
14574 - phys_obj->id = id;
14575 -
14576 -- phys_obj->handle = drm_pci_alloc(dev, size, 0, 0xffffffff);
14577 -+ phys_obj->handle = drm_pci_alloc(dev, size, 0);
14578 - if (!phys_obj->handle) {
14579 - ret = -ENOMEM;
14580 - goto kfree_obj;
14581 -diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
14582 -index 1687edf..54e5907 100644
14583 ---- a/drivers/gpu/drm/i915/i915_reg.h
14584 -+++ b/drivers/gpu/drm/i915/i915_reg.h
14585 -@@ -968,6 +968,8 @@
14586 - #define LVDS_PORT_EN (1 << 31)
14587 - /* Selects pipe B for LVDS data. Must be set on pre-965. */
14588 - #define LVDS_PIPEB_SELECT (1 << 30)
14589 -+/* LVDS dithering flag on 965/g4x platform */
14590 -+#define LVDS_ENABLE_DITHER (1 << 25)
14591 - /* Enable border for unscaled (or aspect-scaled) display */
14592 - #define LVDS_BORDER_ENABLE (1 << 15)
14593 - /*
14594 -@@ -1737,6 +1739,8 @@
14595 -
14596 - /* Display & cursor control */
14597 -
14598 -+/* dithering flag on Ironlake */
14599 -+#define PIPE_ENABLE_DITHER (1 << 4)
14600 - /* Pipe A */
14601 - #define PIPEADSL 0x70000
14602 - #define PIPEACONF 0x70008
14603 -diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
14604 -index f1de53b..121b92e 100644
14605 ---- a/drivers/gpu/drm/i915/intel_display.c
14606 -+++ b/drivers/gpu/drm/i915/intel_display.c
14607 -@@ -1473,6 +1473,10 @@ static void igdng_crtc_dpms(struct drm_crtc *crtc, int mode)
14608 - int trans_vsync_reg = (pipe == 0) ? TRANS_VSYNC_A : TRANS_VSYNC_B;
14609 - u32 temp;
14610 - int tries = 5, j, n;
14611 -+ u32 pipe_bpc;
14612 -+
14613 -+ temp = I915_READ(pipeconf_reg);
14614 -+ pipe_bpc = temp & PIPE_BPC_MASK;
14615 -
14616 - /* XXX: When our outputs are all unaware of DPMS modes other than off
14617 - * and on, we should map those modes to DRM_MODE_DPMS_OFF in the CRTC.
14618 -@@ -1504,6 +1508,12 @@ static void igdng_crtc_dpms(struct drm_crtc *crtc, int mode)
14619 -
14620 - /* enable PCH FDI RX PLL, wait warmup plus DMI latency */
14621 - temp = I915_READ(fdi_rx_reg);
14622 -+ /*
14623 -+ * make the BPC in FDI Rx be consistent with that in
14624 -+ * pipeconf reg.
14625 -+ */
14626 -+ temp &= ~(0x7 << 16);
14627 -+ temp |= (pipe_bpc << 11);
14628 - I915_WRITE(fdi_rx_reg, temp | FDI_RX_PLL_ENABLE |
14629 - FDI_SEL_PCDCLK |
14630 - FDI_DP_PORT_WIDTH_X4); /* default 4 lanes */
14631 -@@ -1644,6 +1654,12 @@ static void igdng_crtc_dpms(struct drm_crtc *crtc, int mode)
14632 -
14633 - /* enable PCH transcoder */
14634 - temp = I915_READ(transconf_reg);
14635 -+ /*
14636 -+ * make the BPC in transcoder be consistent with
14637 -+ * that in pipeconf reg.
14638 -+ */
14639 -+ temp &= ~PIPE_BPC_MASK;
14640 -+ temp |= pipe_bpc;
14641 - I915_WRITE(transconf_reg, temp | TRANS_ENABLE);
14642 - I915_READ(transconf_reg);
14643 -
14644 -@@ -1722,6 +1738,9 @@ static void igdng_crtc_dpms(struct drm_crtc *crtc, int mode)
14645 - I915_READ(fdi_tx_reg);
14646 -
14647 - temp = I915_READ(fdi_rx_reg);
14648 -+ /* BPC in FDI rx is consistent with that in pipeconf */
14649 -+ temp &= ~(0x07 << 16);
14650 -+ temp |= (pipe_bpc << 11);
14651 - I915_WRITE(fdi_rx_reg, temp & ~FDI_RX_ENABLE);
14652 - I915_READ(fdi_rx_reg);
14653 -
14654 -@@ -1765,7 +1784,12 @@ static void igdng_crtc_dpms(struct drm_crtc *crtc, int mode)
14655 - }
14656 - }
14657 - }
14658 --
14659 -+ temp = I915_READ(transconf_reg);
14660 -+ /* BPC in transcoder is consistent with that in pipeconf */
14661 -+ temp &= ~PIPE_BPC_MASK;
14662 -+ temp |= pipe_bpc;
14663 -+ I915_WRITE(transconf_reg, temp);
14664 -+ I915_READ(transconf_reg);
14665 - udelay(100);
14666 -
14667 - /* disable PCH DPLL */
14668 -@@ -2877,6 +2901,18 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
14669 -
14670 - /* determine panel color depth */
14671 - temp = I915_READ(pipeconf_reg);
14672 -+ temp &= ~PIPE_BPC_MASK;
14673 -+ if (is_lvds) {
14674 -+ int lvds_reg = I915_READ(PCH_LVDS);
14675 -+ /* the BPC will be 6 if it is 18-bit LVDS panel */
14676 -+ if ((lvds_reg & LVDS_A3_POWER_MASK) == LVDS_A3_POWER_UP)
14677 -+ temp |= PIPE_8BPC;
14678 -+ else
14679 -+ temp |= PIPE_6BPC;
14680 -+ } else
14681 -+ temp |= PIPE_8BPC;
14682 -+ I915_WRITE(pipeconf_reg, temp);
14683 -+ I915_READ(pipeconf_reg);
14684 -
14685 - switch (temp & PIPE_BPC_MASK) {
14686 - case PIPE_8BPC:
14687 -@@ -3104,7 +3140,20 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
14688 - * appropriately here, but we need to look more thoroughly into how
14689 - * panels behave in the two modes.
14690 - */
14691 --
14692 -+ /* set the dithering flag */
14693 -+ if (IS_I965G(dev)) {
14694 -+ if (dev_priv->lvds_dither) {
14695 -+ if (IS_IGDNG(dev))
14696 -+ pipeconf |= PIPE_ENABLE_DITHER;
14697 -+ else
14698 -+ lvds |= LVDS_ENABLE_DITHER;
14699 -+ } else {
14700 -+ if (IS_IGDNG(dev))
14701 -+ pipeconf &= ~PIPE_ENABLE_DITHER;
14702 -+ else
14703 -+ lvds &= ~LVDS_ENABLE_DITHER;
14704 -+ }
14705 -+ }
14706 - I915_WRITE(lvds_reg, lvds);
14707 - I915_READ(lvds_reg);
14708 - }
14709 -@@ -3688,125 +3737,6 @@ static void intel_gpu_idle_timer(unsigned long arg)
14710 - queue_work(dev_priv->wq, &dev_priv->idle_work);
14711 - }
14712 -
14713 --void intel_increase_renderclock(struct drm_device *dev, bool schedule)
14714 --{
14715 -- drm_i915_private_t *dev_priv = dev->dev_private;
14716 --
14717 -- if (IS_IGDNG(dev))
14718 -- return;
14719 --
14720 -- if (!dev_priv->render_reclock_avail) {
14721 -- DRM_DEBUG("not reclocking render clock\n");
14722 -- return;
14723 -- }
14724 --
14725 -- /* Restore render clock frequency to original value */
14726 -- if (IS_G4X(dev) || IS_I9XX(dev))
14727 -- pci_write_config_word(dev->pdev, GCFGC, dev_priv->orig_clock);
14728 -- else if (IS_I85X(dev))
14729 -- pci_write_config_word(dev->pdev, HPLLCC, dev_priv->orig_clock);
14730 -- DRM_DEBUG("increasing render clock frequency\n");
14731 --
14732 -- /* Schedule downclock */
14733 -- if (schedule)
14734 -- mod_timer(&dev_priv->idle_timer, jiffies +
14735 -- msecs_to_jiffies(GPU_IDLE_TIMEOUT));
14736 --}
14737 --
14738 --void intel_decrease_renderclock(struct drm_device *dev)
14739 --{
14740 -- drm_i915_private_t *dev_priv = dev->dev_private;
14741 --
14742 -- if (IS_IGDNG(dev))
14743 -- return;
14744 --
14745 -- if (!dev_priv->render_reclock_avail) {
14746 -- DRM_DEBUG("not reclocking render clock\n");
14747 -- return;
14748 -- }
14749 --
14750 -- if (IS_G4X(dev)) {
14751 -- u16 gcfgc;
14752 --
14753 -- /* Adjust render clock... */
14754 -- pci_read_config_word(dev->pdev, GCFGC, &gcfgc);
14755 --
14756 -- /* Down to minimum... */
14757 -- gcfgc &= ~GM45_GC_RENDER_CLOCK_MASK;
14758 -- gcfgc |= GM45_GC_RENDER_CLOCK_266_MHZ;
14759 --
14760 -- pci_write_config_word(dev->pdev, GCFGC, gcfgc);
14761 -- } else if (IS_I965G(dev)) {
14762 -- u16 gcfgc;
14763 --
14764 -- /* Adjust render clock... */
14765 -- pci_read_config_word(dev->pdev, GCFGC, &gcfgc);
14766 --
14767 -- /* Down to minimum... */
14768 -- gcfgc &= ~I965_GC_RENDER_CLOCK_MASK;
14769 -- gcfgc |= I965_GC_RENDER_CLOCK_267_MHZ;
14770 --
14771 -- pci_write_config_word(dev->pdev, GCFGC, gcfgc);
14772 -- } else if (IS_I945G(dev) || IS_I945GM(dev)) {
14773 -- u16 gcfgc;
14774 --
14775 -- /* Adjust render clock... */
14776 -- pci_read_config_word(dev->pdev, GCFGC, &gcfgc);
14777 --
14778 -- /* Down to minimum... */
14779 -- gcfgc &= ~I945_GC_RENDER_CLOCK_MASK;
14780 -- gcfgc |= I945_GC_RENDER_CLOCK_166_MHZ;
14781 --
14782 -- pci_write_config_word(dev->pdev, GCFGC, gcfgc);
14783 -- } else if (IS_I915G(dev)) {
14784 -- u16 gcfgc;
14785 --
14786 -- /* Adjust render clock... */
14787 -- pci_read_config_word(dev->pdev, GCFGC, &gcfgc);
14788 --
14789 -- /* Down to minimum... */
14790 -- gcfgc &= ~I915_GC_RENDER_CLOCK_MASK;
14791 -- gcfgc |= I915_GC_RENDER_CLOCK_166_MHZ;
14792 --
14793 -- pci_write_config_word(dev->pdev, GCFGC, gcfgc);
14794 -- } else if (IS_I85X(dev)) {
14795 -- u16 hpllcc;
14796 --
14797 -- /* Adjust render clock... */
14798 -- pci_read_config_word(dev->pdev, HPLLCC, &hpllcc);
14799 --
14800 -- /* Up to maximum... */
14801 -- hpllcc &= ~GC_CLOCK_CONTROL_MASK;
14802 -- hpllcc |= GC_CLOCK_133_200;
14803 --
14804 -- pci_write_config_word(dev->pdev, HPLLCC, hpllcc);
14805 -- }
14806 -- DRM_DEBUG("decreasing render clock frequency\n");
14807 --}
14808 --
14809 --/* Note that no increase function is needed for this - increase_renderclock()
14810 -- * will also rewrite these bits
14811 -- */
14812 --void intel_decrease_displayclock(struct drm_device *dev)
14813 --{
14814 -- if (IS_IGDNG(dev))
14815 -- return;
14816 --
14817 -- if (IS_I945G(dev) || IS_I945GM(dev) || IS_I915G(dev) ||
14818 -- IS_I915GM(dev)) {
14819 -- u16 gcfgc;
14820 --
14821 -- /* Adjust render clock... */
14822 -- pci_read_config_word(dev->pdev, GCFGC, &gcfgc);
14823 --
14824 -- /* Down to minimum... */
14825 -- gcfgc &= ~0xf0;
14826 -- gcfgc |= 0x80;
14827 --
14828 -- pci_write_config_word(dev->pdev, GCFGC, gcfgc);
14829 -- }
14830 --}
14831 --
14832 - #define CRTC_IDLE_TIMEOUT 1000 /* ms */
14833 -
14834 - static void intel_crtc_idle_timer(unsigned long arg)
14835 -@@ -3920,12 +3850,6 @@ static void intel_idle_update(struct work_struct *work)
14836 -
14837 - mutex_lock(&dev->struct_mutex);
14838 -
14839 -- /* GPU isn't processing, downclock it. */
14840 -- if (!dev_priv->busy) {
14841 -- intel_decrease_renderclock(dev);
14842 -- intel_decrease_displayclock(dev);
14843 -- }
14844 --
14845 - list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
14846 - /* Skip inactive CRTCs */
14847 - if (!crtc->fb)
14848 -@@ -3960,7 +3884,6 @@ void intel_mark_busy(struct drm_device *dev, struct drm_gem_object *obj)
14849 - return;
14850 -
14851 - dev_priv->busy = true;
14852 -- intel_increase_renderclock(dev, true);
14853 -
14854 - list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
14855 - if (!crtc->fb)
14856 -@@ -4465,7 +4388,6 @@ void intel_modeset_cleanup(struct drm_device *dev)
14857 - del_timer_sync(&intel_crtc->idle_timer);
14858 - }
14859 -
14860 -- intel_increase_renderclock(dev, false);
14861 - del_timer_sync(&dev_priv->idle_timer);
14862 -
14863 - mutex_unlock(&dev->struct_mutex);
14864 -diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
14865 -index 05598ae..0e0e4b4 100644
14866 ---- a/drivers/gpu/drm/i915/intel_lvds.c
14867 -+++ b/drivers/gpu/drm/i915/intel_lvds.c
14868 -@@ -679,7 +679,14 @@ static int intel_lid_notify(struct notifier_block *nb, unsigned long val,
14869 - struct drm_i915_private *dev_priv =
14870 - container_of(nb, struct drm_i915_private, lid_notifier);
14871 - struct drm_device *dev = dev_priv->dev;
14872 -+ struct drm_connector *connector = dev_priv->int_lvds_connector;
14873 -
14874 -+ /*
14875 -+ * check and update the status of LVDS connector after receiving
14876 -+ * the LID nofication event.
14877 -+ */
14878 -+ if (connector)
14879 -+ connector->status = connector->funcs->detect(connector);
14880 - if (!acpi_lid_open()) {
14881 - dev_priv->modeset_on_lid = 1;
14882 - return NOTIFY_OK;
14883 -@@ -1085,6 +1092,8 @@ out:
14884 - DRM_DEBUG("lid notifier registration failed\n");
14885 - dev_priv->lid_notifier.notifier_call = NULL;
14886 - }
14887 -+ /* keep the LVDS connector */
14888 -+ dev_priv->int_lvds_connector = connector;
14889 - drm_sysfs_connector_add(connector);
14890 - return;
14891 -
14892 -diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
14893 -index 700e93a..c1f7ea0 100644
14894 ---- a/drivers/hwmon/Kconfig
14895 -+++ b/drivers/hwmon/Kconfig
14896 -@@ -374,7 +374,7 @@ config SENSORS_GL520SM
14897 -
14898 - config SENSORS_CORETEMP
14899 - tristate "Intel Core/Core2/Atom temperature sensor"
14900 -- depends on X86 && EXPERIMENTAL
14901 -+ depends on X86 && PCI && EXPERIMENTAL
14902 - help
14903 - If you say yes here you get support for the temperature
14904 - sensor inside your CPU. Most of the family 6 CPUs
14905 -diff --git a/drivers/hwmon/adt7462.c b/drivers/hwmon/adt7462.c
14906 -index 1852f27..262c133 100644
14907 ---- a/drivers/hwmon/adt7462.c
14908 -+++ b/drivers/hwmon/adt7462.c
14909 -@@ -97,7 +97,7 @@ I2C_CLIENT_INSMOD_1(adt7462);
14910 - #define ADT7462_PIN24_SHIFT 6
14911 - #define ADT7462_PIN26_VOLT_INPUT 0x08
14912 - #define ADT7462_PIN25_VOLT_INPUT 0x20
14913 --#define ADT7462_PIN28_SHIFT 6 /* cfg3 */
14914 -+#define ADT7462_PIN28_SHIFT 4 /* cfg3 */
14915 - #define ADT7462_PIN28_VOLT 0x5
14916 -
14917 - #define ADT7462_REG_ALARM1 0xB8
14918 -diff --git a/drivers/hwmon/coretemp.c b/drivers/hwmon/coretemp.c
14919 -index caef39c..2d7bcee 100644
14920 ---- a/drivers/hwmon/coretemp.c
14921 -+++ b/drivers/hwmon/coretemp.c
14922 -@@ -33,6 +33,7 @@
14923 - #include <linux/list.h>
14924 - #include <linux/platform_device.h>
14925 - #include <linux/cpu.h>
14926 -+#include <linux/pci.h>
14927 - #include <asm/msr.h>
14928 - #include <asm/processor.h>
14929 -
14930 -@@ -161,6 +162,7 @@ static int __devinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *
14931 - int usemsr_ee = 1;
14932 - int err;
14933 - u32 eax, edx;
14934 -+ struct pci_dev *host_bridge;
14935 -
14936 - /* Early chips have no MSR for TjMax */
14937 -
14938 -@@ -168,11 +170,21 @@ static int __devinit adjust_tjmax(struct cpuinfo_x86 *c, u32 id, struct device *
14939 - usemsr_ee = 0;
14940 - }
14941 -
14942 -- /* Atoms seems to have TjMax at 90C */
14943 -+ /* Atom CPUs */
14944 -
14945 - if (c->x86_model == 0x1c) {
14946 - usemsr_ee = 0;
14947 -- tjmax = 90000;
14948 -+
14949 -+ host_bridge = pci_get_bus_and_slot(0, PCI_DEVFN(0, 0));
14950 -+
14951 -+ if (host_bridge && host_bridge->vendor == PCI_VENDOR_ID_INTEL
14952 -+ && (host_bridge->device == 0xa000 /* NM10 based nettop */
14953 -+ || host_bridge->device == 0xa010)) /* NM10 based netbook */
14954 -+ tjmax = 100000;
14955 -+ else
14956 -+ tjmax = 90000;
14957 -+
14958 -+ pci_dev_put(host_bridge);
14959 - }
14960 -
14961 - if ((c->x86_model > 0xe) && (usemsr_ee)) {
14962 -diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
14963 -index 85f0e8c..1f552c6 100644
14964 ---- a/drivers/mmc/card/block.c
14965 -+++ b/drivers/mmc/card/block.c
14966 -@@ -85,7 +85,14 @@ static void mmc_blk_put(struct mmc_blk_data *md)
14967 - mutex_lock(&open_lock);
14968 - md->usage--;
14969 - if (md->usage == 0) {
14970 -+ int devmaj = MAJOR(disk_devt(md->disk));
14971 - int devidx = MINOR(disk_devt(md->disk)) >> MMC_SHIFT;
14972 -+
14973 -+ if (!devmaj)
14974 -+ devidx = md->disk->first_minor >> MMC_SHIFT;
14975 -+
14976 -+ blk_cleanup_queue(md->queue.queue);
14977 -+
14978 - __clear_bit(devidx, dev_use);
14979 -
14980 - put_disk(md->disk);
14981 -@@ -613,6 +620,7 @@ static int mmc_blk_probe(struct mmc_card *card)
14982 - return 0;
14983 -
14984 - out:
14985 -+ mmc_cleanup_queue(&md->queue);
14986 - mmc_blk_put(md);
14987 -
14988 - return err;
14989 -diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
14990 -index 49e5823..c5a7a85 100644
14991 ---- a/drivers/mmc/card/queue.c
14992 -+++ b/drivers/mmc/card/queue.c
14993 -@@ -90,9 +90,10 @@ static void mmc_request(struct request_queue *q)
14994 - struct request *req;
14995 -
14996 - if (!mq) {
14997 -- printk(KERN_ERR "MMC: killing requests for dead queue\n");
14998 -- while ((req = blk_fetch_request(q)) != NULL)
14999 -+ while ((req = blk_fetch_request(q)) != NULL) {
15000 -+ req->cmd_flags |= REQ_QUIET;
15001 - __blk_end_request_all(req, -EIO);
15002 -+ }
15003 - return;
15004 - }
15005 -
15006 -@@ -223,17 +224,18 @@ void mmc_cleanup_queue(struct mmc_queue *mq)
15007 - struct request_queue *q = mq->queue;
15008 - unsigned long flags;
15009 -
15010 -- /* Mark that we should start throwing out stragglers */
15011 -- spin_lock_irqsave(q->queue_lock, flags);
15012 -- q->queuedata = NULL;
15013 -- spin_unlock_irqrestore(q->queue_lock, flags);
15014 --
15015 - /* Make sure the queue isn't suspended, as that will deadlock */
15016 - mmc_queue_resume(mq);
15017 -
15018 - /* Then terminate our worker thread */
15019 - kthread_stop(mq->thread);
15020 -
15021 -+ /* Empty the queue */
15022 -+ spin_lock_irqsave(q->queue_lock, flags);
15023 -+ q->queuedata = NULL;
15024 -+ blk_start_queue(q);
15025 -+ spin_unlock_irqrestore(q->queue_lock, flags);
15026 -+
15027 - if (mq->bounce_sg)
15028 - kfree(mq->bounce_sg);
15029 - mq->bounce_sg = NULL;
15030 -@@ -245,8 +247,6 @@ void mmc_cleanup_queue(struct mmc_queue *mq)
15031 - kfree(mq->bounce_buf);
15032 - mq->bounce_buf = NULL;
15033 -
15034 -- blk_cleanup_queue(mq->queue);
15035 --
15036 - mq->card = NULL;
15037 - }
15038 - EXPORT_SYMBOL(mmc_cleanup_queue);
15039 -diff --git a/drivers/net/wireless/ath/ath5k/eeprom.c b/drivers/net/wireless/ath/ath5k/eeprom.c
15040 -index 7918852..9a96550 100644
15041 ---- a/drivers/net/wireless/ath/ath5k/eeprom.c
15042 -+++ b/drivers/net/wireless/ath/ath5k/eeprom.c
15043 -@@ -97,7 +97,7 @@ ath5k_eeprom_init_header(struct ath5k_hw *ah)
15044 - struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
15045 - int ret;
15046 - u16 val;
15047 -- u32 cksum, offset;
15048 -+ u32 cksum, offset, eep_max = AR5K_EEPROM_INFO_MAX;
15049 -
15050 - /*
15051 - * Read values from EEPROM and store them in the capability structure
15052 -@@ -116,12 +116,38 @@ ath5k_eeprom_init_header(struct ath5k_hw *ah)
15053 - * Validate the checksum of the EEPROM date. There are some
15054 - * devices with invalid EEPROMs.
15055 - */
15056 -- for (cksum = 0, offset = 0; offset < AR5K_EEPROM_INFO_MAX; offset++) {
15057 -+ AR5K_EEPROM_READ(AR5K_EEPROM_SIZE_UPPER, val);
15058 -+ if (val) {
15059 -+ eep_max = (val & AR5K_EEPROM_SIZE_UPPER_MASK) <<
15060 -+ AR5K_EEPROM_SIZE_ENDLOC_SHIFT;
15061 -+ AR5K_EEPROM_READ(AR5K_EEPROM_SIZE_LOWER, val);
15062 -+ eep_max = (eep_max | val) - AR5K_EEPROM_INFO_BASE;
15063 -+
15064 -+ /*
15065 -+ * Fail safe check to prevent stupid loops due
15066 -+ * to busted EEPROMs. XXX: This value is likely too
15067 -+ * big still, waiting on a better value.
15068 -+ */
15069 -+ if (eep_max > (3 * AR5K_EEPROM_INFO_MAX)) {
15070 -+ ATH5K_ERR(ah->ah_sc, "Invalid max custom EEPROM size: "
15071 -+ "%d (0x%04x) max expected: %d (0x%04x)\n",
15072 -+ eep_max, eep_max,
15073 -+ 3 * AR5K_EEPROM_INFO_MAX,
15074 -+ 3 * AR5K_EEPROM_INFO_MAX);
15075 -+ return -EIO;
15076 -+ }
15077 -+ }
15078 -+
15079 -+ for (cksum = 0, offset = 0; offset < eep_max; offset++) {
15080 - AR5K_EEPROM_READ(AR5K_EEPROM_INFO(offset), val);
15081 - cksum ^= val;
15082 - }
15083 - if (cksum != AR5K_EEPROM_INFO_CKSUM) {
15084 -- ATH5K_ERR(ah->ah_sc, "Invalid EEPROM checksum 0x%04x\n", cksum);
15085 -+ ATH5K_ERR(ah->ah_sc, "Invalid EEPROM "
15086 -+ "checksum: 0x%04x eep_max: 0x%04x (%s)\n",
15087 -+ cksum, eep_max,
15088 -+ eep_max == AR5K_EEPROM_INFO_MAX ?
15089 -+ "default size" : "custom size");
15090 - return -EIO;
15091 - }
15092 -
15093 -diff --git a/drivers/net/wireless/ath/ath5k/eeprom.h b/drivers/net/wireless/ath/ath5k/eeprom.h
15094 -index 0123f35..473a483 100644
15095 ---- a/drivers/net/wireless/ath/ath5k/eeprom.h
15096 -+++ b/drivers/net/wireless/ath/ath5k/eeprom.h
15097 -@@ -37,6 +37,14 @@
15098 - #define AR5K_EEPROM_RFKILL_POLARITY_S 1
15099 -
15100 - #define AR5K_EEPROM_REG_DOMAIN 0x00bf /* EEPROM regdom */
15101 -+
15102 -+/* FLASH(EEPROM) Defines for AR531X chips */
15103 -+#define AR5K_EEPROM_SIZE_LOWER 0x1b /* size info -- lower */
15104 -+#define AR5K_EEPROM_SIZE_UPPER 0x1c /* size info -- upper */
15105 -+#define AR5K_EEPROM_SIZE_UPPER_MASK 0xfff0
15106 -+#define AR5K_EEPROM_SIZE_UPPER_SHIFT 4
15107 -+#define AR5K_EEPROM_SIZE_ENDLOC_SHIFT 12
15108 -+
15109 - #define AR5K_EEPROM_CHECKSUM 0x00c0 /* EEPROM checksum */
15110 - #define AR5K_EEPROM_INFO_BASE 0x00c0 /* EEPROM header */
15111 - #define AR5K_EEPROM_INFO_MAX (0x400 - AR5K_EEPROM_INFO_BASE)
15112 -diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
15113 -index f4e2e84..99331ed 100644
15114 ---- a/drivers/net/wireless/iwlwifi/iwl-4965.c
15115 -+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
15116 -@@ -2087,7 +2087,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
15117 - struct ieee80211_tx_info *info;
15118 - struct iwl4965_tx_resp *tx_resp = (void *)&pkt->u.raw[0];
15119 - u32 status = le32_to_cpu(tx_resp->u.status);
15120 -- int tid = MAX_TID_COUNT;
15121 -+ int tid = MAX_TID_COUNT - 1;
15122 - int sta_id;
15123 - int freed;
15124 - u8 *qc = NULL;
15125 -diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
15126 -index c2d9b7a..cea2ee2 100644
15127 ---- a/drivers/net/wireless/iwlwifi/iwl-dev.h
15128 -+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
15129 -@@ -703,7 +703,7 @@ extern void iwl_txq_ctx_stop(struct iwl_priv *priv);
15130 - extern int iwl_queue_space(const struct iwl_queue *q);
15131 - static inline int iwl_queue_used(const struct iwl_queue *q, int i)
15132 - {
15133 -- return q->write_ptr > q->read_ptr ?
15134 -+ return q->write_ptr >= q->read_ptr ?
15135 - (i >= q->read_ptr && i < q->write_ptr) :
15136 - !(i < q->read_ptr && i >= q->write_ptr);
15137 - }
15138 -diff --git a/drivers/net/wireless/libertas/scan.c b/drivers/net/wireless/libertas/scan.c
15139 -index 6c95af3..06d66a1 100644
15140 ---- a/drivers/net/wireless/libertas/scan.c
15141 -+++ b/drivers/net/wireless/libertas/scan.c
15142 -@@ -399,11 +399,8 @@ int lbs_scan_networks(struct lbs_private *priv, int full_scan)
15143 - chan_count = lbs_scan_create_channel_list(priv, chan_list);
15144 -
15145 - netif_stop_queue(priv->dev);
15146 -- netif_carrier_off(priv->dev);
15147 -- if (priv->mesh_dev) {
15148 -+ if (priv->mesh_dev)
15149 - netif_stop_queue(priv->mesh_dev);
15150 -- netif_carrier_off(priv->mesh_dev);
15151 -- }
15152 -
15153 - /* Prepare to continue an interrupted scan */
15154 - lbs_deb_scan("chan_count %d, scan_channel %d\n",
15155 -@@ -467,16 +464,13 @@ out2:
15156 - priv->scan_channel = 0;
15157 -
15158 - out:
15159 -- if (priv->connect_status == LBS_CONNECTED) {
15160 -- netif_carrier_on(priv->dev);
15161 -- if (!priv->tx_pending_len)
15162 -- netif_wake_queue(priv->dev);
15163 -- }
15164 -- if (priv->mesh_dev && (priv->mesh_connect_status == LBS_CONNECTED)) {
15165 -- netif_carrier_on(priv->mesh_dev);
15166 -- if (!priv->tx_pending_len)
15167 -- netif_wake_queue(priv->mesh_dev);
15168 -- }
15169 -+ if (priv->connect_status == LBS_CONNECTED && !priv->tx_pending_len)
15170 -+ netif_wake_queue(priv->dev);
15171 -+
15172 -+ if (priv->mesh_dev && (priv->mesh_connect_status == LBS_CONNECTED) &&
15173 -+ !priv->tx_pending_len)
15174 -+ netif_wake_queue(priv->mesh_dev);
15175 -+
15176 - kfree(chan_list);
15177 -
15178 - lbs_deb_leave_args(LBS_DEB_SCAN, "ret %d", ret);
15179 -diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
15180 -index f7a4701..473e5f2 100644
15181 ---- a/drivers/rtc/rtc-cmos.c
15182 -+++ b/drivers/rtc/rtc-cmos.c
15183 -@@ -1099,9 +1099,9 @@ static int cmos_pnp_resume(struct pnp_dev *pnp)
15184 - #define cmos_pnp_resume NULL
15185 - #endif
15186 -
15187 --static void cmos_pnp_shutdown(struct device *pdev)
15188 -+static void cmos_pnp_shutdown(struct pnp_dev *pnp)
15189 - {
15190 -- if (system_state == SYSTEM_POWER_OFF && !cmos_poweroff(pdev))
15191 -+ if (system_state == SYSTEM_POWER_OFF && !cmos_poweroff(&pnp->dev))
15192 - return;
15193 -
15194 - cmos_do_shutdown();
15195 -@@ -1120,15 +1120,12 @@ static struct pnp_driver cmos_pnp_driver = {
15196 - .id_table = rtc_ids,
15197 - .probe = cmos_pnp_probe,
15198 - .remove = __exit_p(cmos_pnp_remove),
15199 -+ .shutdown = cmos_pnp_shutdown,
15200 -
15201 - /* flag ensures resume() gets called, and stops syslog spam */
15202 - .flags = PNP_DRIVER_RES_DO_NOT_CHANGE,
15203 - .suspend = cmos_pnp_suspend,
15204 - .resume = cmos_pnp_resume,
15205 -- .driver = {
15206 -- .name = (char *)driver_name,
15207 -- .shutdown = cmos_pnp_shutdown,
15208 -- }
15209 - };
15210 -
15211 - #endif /* CONFIG_PNP */
15212 -diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c
15213 -index c499793..5d42d55 100644
15214 ---- a/drivers/xen/manage.c
15215 -+++ b/drivers/xen/manage.c
15216 -@@ -102,15 +102,15 @@ static void do_suspend(void)
15217 - goto out_thaw;
15218 - }
15219 -
15220 -+ printk(KERN_DEBUG "suspending xenstore...\n");
15221 -+ xs_suspend();
15222 -+
15223 - err = dpm_suspend_noirq(PMSG_SUSPEND);
15224 - if (err) {
15225 - printk(KERN_ERR "dpm_suspend_noirq failed: %d\n", err);
15226 - goto out_resume;
15227 - }
15228 -
15229 -- printk(KERN_DEBUG "suspending xenstore...\n");
15230 -- xs_suspend();
15231 --
15232 - err = stop_machine(xen_suspend, &cancelled, cpumask_of(0));
15233 -
15234 - dpm_resume_noirq(PMSG_RESUME);
15235 -@@ -120,13 +120,13 @@ static void do_suspend(void)
15236 - cancelled = 1;
15237 - }
15238 -
15239 -+out_resume:
15240 - if (!cancelled) {
15241 - xen_arch_resume();
15242 - xs_resume();
15243 - } else
15244 - xs_suspend_cancel();
15245 -
15246 --out_resume:
15247 - dpm_resume_end(PMSG_RESUME);
15248 -
15249 - /* Make sure timer events get retriggered on all CPUs */
15250 -diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c
15251 -index 6c10f74..6f7df0f 100644
15252 ---- a/fs/exofs/inode.c
15253 -+++ b/fs/exofs/inode.c
15254 -@@ -731,13 +731,28 @@ static int exofs_write_begin_export(struct file *file,
15255 - fsdata);
15256 - }
15257 -
15258 -+static int exofs_write_end(struct file *file, struct address_space *mapping,
15259 -+ loff_t pos, unsigned len, unsigned copied,
15260 -+ struct page *page, void *fsdata)
15261 -+{
15262 -+ struct inode *inode = mapping->host;
15263 -+ /* According to comment in simple_write_end i_mutex is held */
15264 -+ loff_t i_size = inode->i_size;
15265 -+ int ret;
15266 -+
15267 -+ ret = simple_write_end(file, mapping,pos, len, copied, page, fsdata);
15268 -+ if (i_size != inode->i_size)
15269 -+ mark_inode_dirty(inode);
15270 -+ return ret;
15271 -+}
15272 -+
15273 - const struct address_space_operations exofs_aops = {
15274 - .readpage = exofs_readpage,
15275 - .readpages = exofs_readpages,
15276 - .writepage = exofs_writepage,
15277 - .writepages = exofs_writepages,
15278 - .write_begin = exofs_write_begin_export,
15279 -- .write_end = simple_write_end,
15280 -+ .write_end = exofs_write_end,
15281 - };
15282 -
15283 - /******************************************************************************
15284 -diff --git a/fs/fcntl.c b/fs/fcntl.c
15285 -index 2cf93ec..97e01dc 100644
15286 ---- a/fs/fcntl.c
15287 -+++ b/fs/fcntl.c
15288 -@@ -618,60 +618,90 @@ static DEFINE_RWLOCK(fasync_lock);
15289 - static struct kmem_cache *fasync_cache __read_mostly;
15290 -
15291 - /*
15292 -- * fasync_helper() is used by almost all character device drivers
15293 -- * to set up the fasync queue. It returns negative on error, 0 if it did
15294 -- * no changes and positive if it added/deleted the entry.
15295 -+ * Remove a fasync entry. If successfully removed, return
15296 -+ * positive and clear the FASYNC flag. If no entry exists,
15297 -+ * do nothing and return 0.
15298 -+ *
15299 -+ * NOTE! It is very important that the FASYNC flag always
15300 -+ * match the state "is the filp on a fasync list".
15301 -+ *
15302 -+ * We always take the 'filp->f_lock', in since fasync_lock
15303 -+ * needs to be irq-safe.
15304 - */
15305 --int fasync_helper(int fd, struct file * filp, int on, struct fasync_struct **fapp)
15306 -+static int fasync_remove_entry(struct file *filp, struct fasync_struct **fapp)
15307 - {
15308 - struct fasync_struct *fa, **fp;
15309 -- struct fasync_struct *new = NULL;
15310 - int result = 0;
15311 -
15312 -- if (on) {
15313 -- new = kmem_cache_alloc(fasync_cache, GFP_KERNEL);
15314 -- if (!new)
15315 -- return -ENOMEM;
15316 -+ spin_lock(&filp->f_lock);
15317 -+ write_lock_irq(&fasync_lock);
15318 -+ for (fp = fapp; (fa = *fp) != NULL; fp = &fa->fa_next) {
15319 -+ if (fa->fa_file != filp)
15320 -+ continue;
15321 -+ *fp = fa->fa_next;
15322 -+ kmem_cache_free(fasync_cache, fa);
15323 -+ filp->f_flags &= ~FASYNC;
15324 -+ result = 1;
15325 -+ break;
15326 - }
15327 -+ write_unlock_irq(&fasync_lock);
15328 -+ spin_unlock(&filp->f_lock);
15329 -+ return result;
15330 -+}
15331 -+
15332 -+/*
15333 -+ * Add a fasync entry. Return negative on error, positive if
15334 -+ * added, and zero if did nothing but change an existing one.
15335 -+ *
15336 -+ * NOTE! It is very important that the FASYNC flag always
15337 -+ * match the state "is the filp on a fasync list".
15338 -+ */
15339 -+static int fasync_add_entry(int fd, struct file *filp, struct fasync_struct **fapp)
15340 -+{
15341 -+ struct fasync_struct *new, *fa, **fp;
15342 -+ int result = 0;
15343 -+
15344 -+ new = kmem_cache_alloc(fasync_cache, GFP_KERNEL);
15345 -+ if (!new)
15346 -+ return -ENOMEM;
15347 -
15348 -- /*
15349 -- * We need to take f_lock first since it's not an IRQ-safe
15350 -- * lock.
15351 -- */
15352 - spin_lock(&filp->f_lock);
15353 - write_lock_irq(&fasync_lock);
15354 - for (fp = fapp; (fa = *fp) != NULL; fp = &fa->fa_next) {
15355 -- if (fa->fa_file == filp) {
15356 -- if(on) {
15357 -- fa->fa_fd = fd;
15358 -- kmem_cache_free(fasync_cache, new);
15359 -- } else {
15360 -- *fp = fa->fa_next;
15361 -- kmem_cache_free(fasync_cache, fa);
15362 -- result = 1;
15363 -- }
15364 -- goto out;
15365 -- }
15366 -+ if (fa->fa_file != filp)
15367 -+ continue;
15368 -+ fa->fa_fd = fd;
15369 -+ kmem_cache_free(fasync_cache, new);
15370 -+ goto out;
15371 - }
15372 -
15373 -- if (on) {
15374 -- new->magic = FASYNC_MAGIC;
15375 -- new->fa_file = filp;
15376 -- new->fa_fd = fd;
15377 -- new->fa_next = *fapp;
15378 -- *fapp = new;
15379 -- result = 1;
15380 -- }
15381 -+ new->magic = FASYNC_MAGIC;
15382 -+ new->fa_file = filp;
15383 -+ new->fa_fd = fd;
15384 -+ new->fa_next = *fapp;
15385 -+ *fapp = new;
15386 -+ result = 1;
15387 -+ filp->f_flags |= FASYNC;
15388 -+
15389 - out:
15390 -- if (on)
15391 -- filp->f_flags |= FASYNC;
15392 -- else
15393 -- filp->f_flags &= ~FASYNC;
15394 - write_unlock_irq(&fasync_lock);
15395 - spin_unlock(&filp->f_lock);
15396 - return result;
15397 - }
15398 -
15399 -+/*
15400 -+ * fasync_helper() is used by almost all character device drivers
15401 -+ * to set up the fasync queue, and for regular files by the file
15402 -+ * lease code. It returns negative on error, 0 if it did no changes
15403 -+ * and positive if it added/deleted the entry.
15404 -+ */
15405 -+int fasync_helper(int fd, struct file * filp, int on, struct fasync_struct **fapp)
15406 -+{
15407 -+ if (!on)
15408 -+ return fasync_remove_entry(filp, fapp);
15409 -+ return fasync_add_entry(fd, filp, fapp);
15410 -+}
15411 -+
15412 - EXPORT_SYMBOL(fasync_helper);
15413 -
15414 - void __kill_fasync(struct fasync_struct *fa, int sig, int band)
15415 -diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
15416 -index a293f02..570dd1c 100644
15417 ---- a/fs/nfsd/vfs.c
15418 -+++ b/fs/nfsd/vfs.c
15419 -@@ -774,12 +774,9 @@ static inline int nfsd_dosync(struct file *filp, struct dentry *dp,
15420 - int (*fsync) (struct file *, struct dentry *, int);
15421 - int err;
15422 -
15423 -- err = filemap_fdatawrite(inode->i_mapping);
15424 -+ err = filemap_write_and_wait(inode->i_mapping);
15425 - if (err == 0 && fop && (fsync = fop->fsync))
15426 - err = fsync(filp, dp, 0);
15427 -- if (err == 0)
15428 -- err = filemap_fdatawait(inode->i_mapping);
15429 --
15430 - return err;
15431 - }
15432 -
15433 -diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c
15434 -index c4d07a8..2534987 100644
15435 ---- a/fs/quota/dquot.c
15436 -+++ b/fs/quota/dquot.c
15437 -@@ -1425,6 +1425,9 @@ static void inode_sub_rsv_space(struct inode *inode, qsize_t number)
15438 - static qsize_t inode_get_rsv_space(struct inode *inode)
15439 - {
15440 - qsize_t ret;
15441 -+
15442 -+ if (!inode->i_sb->dq_op->get_reserved_space)
15443 -+ return 0;
15444 - spin_lock(&inode->i_lock);
15445 - ret = *inode_reserved_space(inode);
15446 - spin_unlock(&inode->i_lock);
15447 -diff --git a/include/drm/drmP.h b/include/drm/drmP.h
15448 -index 9d3d684..7ad3faa 100644
15449 ---- a/include/drm/drmP.h
15450 -+++ b/include/drm/drmP.h
15451 -@@ -1402,7 +1402,7 @@ extern int drm_ati_pcigart_cleanup(struct drm_device *dev,
15452 - struct drm_ati_pcigart_info * gart_info);
15453 -
15454 - extern drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size,
15455 -- size_t align, dma_addr_t maxaddr);
15456 -+ size_t align);
15457 - extern void __drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah);
15458 - extern void drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah);
15459 -
15460 -diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
15461 -index a990ace..93515c6 100644
15462 ---- a/include/linux/syscalls.h
15463 -+++ b/include/linux/syscalls.h
15464 -@@ -879,4 +879,8 @@ int kernel_execve(const char *filename, char *const argv[], char *const envp[]);
15465 - asmlinkage long sys_perf_event_open(
15466 - struct perf_event_attr __user *attr_uptr,
15467 - pid_t pid, int cpu, int group_fd, unsigned long flags);
15468 -+
15469 -+asmlinkage long sys_mmap_pgoff(unsigned long addr, unsigned long len,
15470 -+ unsigned long prot, unsigned long flags,
15471 -+ unsigned long fd, unsigned long pgoff);
15472 - #endif
15473 -diff --git a/ipc/shm.c b/ipc/shm.c
15474 -index 464694e..11bec62 100644
15475 ---- a/ipc/shm.c
15476 -+++ b/ipc/shm.c
15477 -@@ -290,28 +290,28 @@ static unsigned long shm_get_unmapped_area(struct file *file,
15478 - unsigned long flags)
15479 - {
15480 - struct shm_file_data *sfd = shm_file_data(file);
15481 -- return get_unmapped_area(sfd->file, addr, len, pgoff, flags);
15482 --}
15483 --
15484 --int is_file_shm_hugepages(struct file *file)
15485 --{
15486 -- int ret = 0;
15487 --
15488 -- if (file->f_op == &shm_file_operations) {
15489 -- struct shm_file_data *sfd;
15490 -- sfd = shm_file_data(file);
15491 -- ret = is_file_hugepages(sfd->file);
15492 -- }
15493 -- return ret;
15494 -+ return sfd->file->f_op->get_unmapped_area(sfd->file, addr, len,
15495 -+ pgoff, flags);
15496 - }
15497 -
15498 - static const struct file_operations shm_file_operations = {
15499 - .mmap = shm_mmap,
15500 - .fsync = shm_fsync,
15501 - .release = shm_release,
15502 -+};
15503 -+
15504 -+static const struct file_operations shm_file_operations_huge = {
15505 -+ .mmap = shm_mmap,
15506 -+ .fsync = shm_fsync,
15507 -+ .release = shm_release,
15508 - .get_unmapped_area = shm_get_unmapped_area,
15509 - };
15510 -
15511 -+int is_file_shm_hugepages(struct file *file)
15512 -+{
15513 -+ return file->f_op == &shm_file_operations_huge;
15514 -+}
15515 -+
15516 - static const struct vm_operations_struct shm_vm_ops = {
15517 - .open = shm_open, /* callback for a new vm-area open */
15518 - .close = shm_close, /* callback for when the vm-area is released */
15519 -@@ -889,7 +889,10 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
15520 - if (!sfd)
15521 - goto out_put_dentry;
15522 -
15523 -- file = alloc_file(path.mnt, path.dentry, f_mode, &shm_file_operations);
15524 -+ file = alloc_file(path.mnt, path.dentry, f_mode,
15525 -+ is_file_hugepages(shp->shm_file) ?
15526 -+ &shm_file_operations_huge :
15527 -+ &shm_file_operations);
15528 - if (!file)
15529 - goto out_free;
15530 - ima_counts_get(file);
15531 -diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c
15532 -index 2451dc6..4b05bd9 100644
15533 ---- a/kernel/audit_tree.c
15534 -+++ b/kernel/audit_tree.c
15535 -@@ -277,7 +277,7 @@ static void untag_chunk(struct node *p)
15536 - owner->root = NULL;
15537 - }
15538 -
15539 -- for (i = j = 0; i < size; i++, j++) {
15540 -+ for (i = j = 0; j <= size; i++, j++) {
15541 - struct audit_tree *s;
15542 - if (&chunk->owners[j] == p) {
15543 - list_del_init(&p->list);
15544 -@@ -290,7 +290,7 @@ static void untag_chunk(struct node *p)
15545 - if (!s) /* result of earlier fallback */
15546 - continue;
15547 - get_tree(s);
15548 -- list_replace_init(&chunk->owners[i].list, &new->owners[j].list);
15549 -+ list_replace_init(&chunk->owners[j].list, &new->owners[i].list);
15550 - }
15551 -
15552 - list_replace_rcu(&chunk->hash, &new->hash);
15553 -@@ -373,15 +373,17 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
15554 - for (n = 0; n < old->count; n++) {
15555 - if (old->owners[n].owner == tree) {
15556 - spin_unlock(&hash_lock);
15557 -- put_inotify_watch(watch);
15558 -+ put_inotify_watch(&old->watch);
15559 - return 0;
15560 - }
15561 - }
15562 - spin_unlock(&hash_lock);
15563 -
15564 - chunk = alloc_chunk(old->count + 1);
15565 -- if (!chunk)
15566 -+ if (!chunk) {
15567 -+ put_inotify_watch(&old->watch);
15568 - return -ENOMEM;
15569 -+ }
15570 -
15571 - mutex_lock(&inode->inotify_mutex);
15572 - if (inotify_clone_watch(&old->watch, &chunk->watch) < 0) {
15573 -@@ -425,7 +427,8 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
15574 - spin_unlock(&hash_lock);
15575 - inotify_evict_watch(&old->watch);
15576 - mutex_unlock(&inode->inotify_mutex);
15577 -- put_inotify_watch(&old->watch);
15578 -+ put_inotify_watch(&old->watch); /* pair to inotify_find_watch */
15579 -+ put_inotify_watch(&old->watch); /* and kill it */
15580 - return 0;
15581 - }
15582 -
15583 -diff --git a/kernel/cgroup.c b/kernel/cgroup.c
15584 -index 0249f4b..1fbcc74 100644
15585 ---- a/kernel/cgroup.c
15586 -+++ b/kernel/cgroup.c
15587 -@@ -2468,7 +2468,6 @@ static struct cgroup_pidlist *cgroup_pidlist_find(struct cgroup *cgrp,
15588 - /* make sure l doesn't vanish out from under us */
15589 - down_write(&l->mutex);
15590 - mutex_unlock(&cgrp->pidlist_mutex);
15591 -- l->use_count++;
15592 - return l;
15593 - }
15594 - }
15595 -diff --git a/kernel/module.c b/kernel/module.c
15596 -index 5842a71..dfa33e8 100644
15597 ---- a/kernel/module.c
15598 -+++ b/kernel/module.c
15599 -@@ -1030,11 +1030,23 @@ static int try_to_force_load(struct module *mod, const char *reason)
15600 - }
15601 -
15602 - #ifdef CONFIG_MODVERSIONS
15603 -+/* If the arch applies (non-zero) relocations to kernel kcrctab, unapply it. */
15604 -+static unsigned long maybe_relocated(unsigned long crc,
15605 -+ const struct module *crc_owner)
15606 -+{
15607 -+#ifdef ARCH_RELOCATES_KCRCTAB
15608 -+ if (crc_owner == NULL)
15609 -+ return crc - (unsigned long)reloc_start;
15610 -+#endif
15611 -+ return crc;
15612 -+}
15613 -+
15614 - static int check_version(Elf_Shdr *sechdrs,
15615 - unsigned int versindex,
15616 - const char *symname,
15617 - struct module *mod,
15618 -- const unsigned long *crc)
15619 -+ const unsigned long *crc,
15620 -+ const struct module *crc_owner)
15621 - {
15622 - unsigned int i, num_versions;
15623 - struct modversion_info *versions;
15624 -@@ -1055,10 +1067,10 @@ static int check_version(Elf_Shdr *sechdrs,
15625 - if (strcmp(versions[i].name, symname) != 0)
15626 - continue;
15627 -
15628 -- if (versions[i].crc == *crc)
15629 -+ if (versions[i].crc == maybe_relocated(*crc, crc_owner))
15630 - return 1;
15631 - DEBUGP("Found checksum %lX vs module %lX\n",
15632 -- *crc, versions[i].crc);
15633 -+ maybe_relocated(*crc, crc_owner), versions[i].crc);
15634 - goto bad_version;
15635 - }
15636 -
15637 -@@ -1081,7 +1093,8 @@ static inline int check_modstruct_version(Elf_Shdr *sechdrs,
15638 - if (!find_symbol(MODULE_SYMBOL_PREFIX "module_layout", NULL,
15639 - &crc, true, false))
15640 - BUG();
15641 -- return check_version(sechdrs, versindex, "module_layout", mod, crc);
15642 -+ return check_version(sechdrs, versindex, "module_layout", mod, crc,
15643 -+ NULL);
15644 - }
15645 -
15646 - /* First part is kernel version, which we ignore if module has crcs. */
15647 -@@ -1099,7 +1112,8 @@ static inline int check_version(Elf_Shdr *sechdrs,
15648 - unsigned int versindex,
15649 - const char *symname,
15650 - struct module *mod,
15651 -- const unsigned long *crc)
15652 -+ const unsigned long *crc,
15653 -+ const struct module *crc_owner)
15654 - {
15655 - return 1;
15656 - }
15657 -@@ -1134,8 +1148,8 @@ static const struct kernel_symbol *resolve_symbol(Elf_Shdr *sechdrs,
15658 - /* use_module can fail due to OOM,
15659 - or module initialization or unloading */
15660 - if (sym) {
15661 -- if (!check_version(sechdrs, versindex, name, mod, crc) ||
15662 -- !use_module(mod, owner))
15663 -+ if (!check_version(sechdrs, versindex, name, mod, crc, owner)
15664 -+ || !use_module(mod, owner))
15665 - sym = NULL;
15666 - }
15667 - return sym;
15668 -@@ -1146,6 +1160,12 @@ static const struct kernel_symbol *resolve_symbol(Elf_Shdr *sechdrs,
15669 - * J. Corbet <corbet@×××.net>
15670 - */
15671 - #if defined(CONFIG_KALLSYMS) && defined(CONFIG_SYSFS)
15672 -+
15673 -+static inline bool sect_empty(const Elf_Shdr *sect)
15674 -+{
15675 -+ return !(sect->sh_flags & SHF_ALLOC) || sect->sh_size == 0;
15676 -+}
15677 -+
15678 - struct module_sect_attr
15679 - {
15680 - struct module_attribute mattr;
15681 -@@ -1187,8 +1207,7 @@ static void add_sect_attrs(struct module *mod, unsigned int nsect,
15682 -
15683 - /* Count loaded sections and allocate structures */
15684 - for (i = 0; i < nsect; i++)
15685 -- if (sechdrs[i].sh_flags & SHF_ALLOC
15686 -- && sechdrs[i].sh_size)
15687 -+ if (!sect_empty(&sechdrs[i]))
15688 - nloaded++;
15689 - size[0] = ALIGN(sizeof(*sect_attrs)
15690 - + nloaded * sizeof(sect_attrs->attrs[0]),
15691 -@@ -1206,9 +1225,7 @@ static void add_sect_attrs(struct module *mod, unsigned int nsect,
15692 - sattr = &sect_attrs->attrs[0];
15693 - gattr = &sect_attrs->grp.attrs[0];
15694 - for (i = 0; i < nsect; i++) {
15695 -- if (! (sechdrs[i].sh_flags & SHF_ALLOC))
15696 -- continue;
15697 -- if (!sechdrs[i].sh_size)
15698 -+ if (sect_empty(&sechdrs[i]))
15699 - continue;
15700 - sattr->address = sechdrs[i].sh_addr;
15701 - sattr->name = kstrdup(secstrings + sechdrs[i].sh_name,
15702 -@@ -1292,7 +1309,7 @@ static void add_notes_attrs(struct module *mod, unsigned int nsect,
15703 - /* Count notes sections and allocate structures. */
15704 - notes = 0;
15705 - for (i = 0; i < nsect; i++)
15706 -- if ((sechdrs[i].sh_flags & SHF_ALLOC) &&
15707 -+ if (!sect_empty(&sechdrs[i]) &&
15708 - (sechdrs[i].sh_type == SHT_NOTE))
15709 - ++notes;
15710 -
15711 -@@ -1308,7 +1325,7 @@ static void add_notes_attrs(struct module *mod, unsigned int nsect,
15712 - notes_attrs->notes = notes;
15713 - nattr = &notes_attrs->attrs[0];
15714 - for (loaded = i = 0; i < nsect; ++i) {
15715 -- if (!(sechdrs[i].sh_flags & SHF_ALLOC))
15716 -+ if (sect_empty(&sechdrs[i]))
15717 - continue;
15718 - if (sechdrs[i].sh_type == SHT_NOTE) {
15719 - nattr->attr.name = mod->sect_attrs->attrs[loaded].name;
15720 -diff --git a/kernel/signal.c b/kernel/signal.c
15721 -index 6705320..4d0658d 100644
15722 ---- a/kernel/signal.c
15723 -+++ b/kernel/signal.c
15724 -@@ -939,7 +939,8 @@ static void print_fatal_signal(struct pt_regs *regs, int signr)
15725 - for (i = 0; i < 16; i++) {
15726 - unsigned char insn;
15727 -
15728 -- __get_user(insn, (unsigned char *)(regs->ip + i));
15729 -+ if (get_user(insn, (unsigned char *)(regs->ip + i)))
15730 -+ break;
15731 - printk("%02x ", insn);
15732 - }
15733 - }
15734 -diff --git a/kernel/sysctl.c b/kernel/sysctl.c
15735 -index dd84be9..b8bd058 100644
15736 ---- a/kernel/sysctl.c
15737 -+++ b/kernel/sysctl.c
15738 -@@ -1200,7 +1200,6 @@ static struct ctl_table vm_table[] = {
15739 - .extra2 = (void *)&hugetlb_infinity,
15740 - },
15741 - #endif
15742 --#ifdef CONFIG_MMU
15743 - {
15744 - .ctl_name = VM_LOWMEM_RESERVE_RATIO,
15745 - .procname = "lowmem_reserve_ratio",
15746 -@@ -1346,6 +1345,7 @@ static struct ctl_table vm_table[] = {
15747 - .strategy = &sysctl_jiffies,
15748 - },
15749 - #endif
15750 -+#ifdef CONFIG_MMU
15751 - {
15752 - .ctl_name = CTL_UNNUMBERED,
15753 - .procname = "mmap_min_addr",
15754 -diff --git a/lib/dma-debug.c b/lib/dma-debug.c
15755 -index 5a77c7c..084e879 100644
15756 ---- a/lib/dma-debug.c
15757 -+++ b/lib/dma-debug.c
15758 -@@ -913,6 +913,9 @@ static void check_sync(struct device *dev,
15759 - ref->size);
15760 - }
15761 -
15762 -+ if (entry->direction == DMA_BIDIRECTIONAL)
15763 -+ goto out;
15764 -+
15765 - if (ref->direction != entry->direction) {
15766 - err_printk(dev, entry, "DMA-API: device driver syncs "
15767 - "DMA memory with different direction "
15768 -@@ -923,9 +926,6 @@ static void check_sync(struct device *dev,
15769 - dir2name[ref->direction]);
15770 - }
15771 -
15772 -- if (entry->direction == DMA_BIDIRECTIONAL)
15773 -- goto out;
15774 --
15775 - if (to_cpu && !(entry->direction == DMA_FROM_DEVICE) &&
15776 - !(ref->direction == DMA_TO_DEVICE))
15777 - err_printk(dev, entry, "DMA-API: device driver syncs "
15778 -@@ -948,7 +948,6 @@ static void check_sync(struct device *dev,
15779 -
15780 - out:
15781 - put_hash_bucket(bucket, &flags);
15782 --
15783 - }
15784 -
15785 - void debug_dma_map_page(struct device *dev, struct page *page, size_t offset,
15786 -diff --git a/lib/rational.c b/lib/rational.c
15787 -index b3c099b..3ed247b 100644
15788 ---- a/lib/rational.c
15789 -+++ b/lib/rational.c
15790 -@@ -7,6 +7,7 @@
15791 - */
15792 -
15793 - #include <linux/rational.h>
15794 -+#include <linux/module.h>
15795 -
15796 - /*
15797 - * calculate best rational approximation for a given fraction
15798 -diff --git a/mm/mmap.c b/mm/mmap.c
15799 -index 73f5e4b..ae19746 100644
15800 ---- a/mm/mmap.c
15801 -+++ b/mm/mmap.c
15802 -@@ -932,13 +932,9 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
15803 - if (!(flags & MAP_FIXED))
15804 - addr = round_hint_to_min(addr);
15805 -
15806 -- error = arch_mmap_check(addr, len, flags);
15807 -- if (error)
15808 -- return error;
15809 --
15810 - /* Careful about overflows.. */
15811 - len = PAGE_ALIGN(len);
15812 -- if (!len || len > TASK_SIZE)
15813 -+ if (!len)
15814 - return -ENOMEM;
15815 -
15816 - /* offset overflow? */
15817 -@@ -949,24 +945,6 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
15818 - if (mm->map_count > sysctl_max_map_count)
15819 - return -ENOMEM;
15820 -
15821 -- if (flags & MAP_HUGETLB) {
15822 -- struct user_struct *user = NULL;
15823 -- if (file)
15824 -- return -EINVAL;
15825 --
15826 -- /*
15827 -- * VM_NORESERVE is used because the reservations will be
15828 -- * taken when vm_ops->mmap() is called
15829 -- * A dummy user value is used because we are not locking
15830 -- * memory so no accounting is necessary
15831 -- */
15832 -- len = ALIGN(len, huge_page_size(&default_hstate));
15833 -- file = hugetlb_file_setup(HUGETLB_ANON_FILE, len, VM_NORESERVE,
15834 -- &user, HUGETLB_ANONHUGE_INODE);
15835 -- if (IS_ERR(file))
15836 -- return PTR_ERR(file);
15837 -- }
15838 --
15839 - /* Obtain the address to map to. we verify (or select) it and ensure
15840 - * that it represents a valid section of the address space.
15841 - */
15842 -@@ -1459,6 +1437,14 @@ get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
15843 - unsigned long (*get_area)(struct file *, unsigned long,
15844 - unsigned long, unsigned long, unsigned long);
15845 -
15846 -+ unsigned long error = arch_mmap_check(addr, len, flags);
15847 -+ if (error)
15848 -+ return error;
15849 -+
15850 -+ /* Careful about overflows.. */
15851 -+ if (len > TASK_SIZE)
15852 -+ return -ENOMEM;
15853 -+
15854 - get_area = current->mm->get_unmapped_area;
15855 - if (file && file->f_op && file->f_op->get_unmapped_area)
15856 - get_area = file->f_op->get_unmapped_area;
15857 -@@ -2003,20 +1989,14 @@ unsigned long do_brk(unsigned long addr, unsigned long len)
15858 - if (!len)
15859 - return addr;
15860 -
15861 -- if ((addr + len) > TASK_SIZE || (addr + len) < addr)
15862 -- return -EINVAL;
15863 --
15864 -- if (is_hugepage_only_range(mm, addr, len))
15865 -- return -EINVAL;
15866 --
15867 - error = security_file_mmap(NULL, 0, 0, 0, addr, 1);
15868 - if (error)
15869 - return error;
15870 -
15871 - flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags;
15872 -
15873 -- error = arch_mmap_check(addr, len, flags);
15874 -- if (error)
15875 -+ error = get_unmapped_area(NULL, addr, len, 0, MAP_FIXED);
15876 -+ if (error & ~PAGE_MASK)
15877 - return error;
15878 -
15879 - /*
15880 -diff --git a/mm/mremap.c b/mm/mremap.c
15881 -index 97bff25..8451908 100644
15882 ---- a/mm/mremap.c
15883 -+++ b/mm/mremap.c
15884 -@@ -261,6 +261,137 @@ static unsigned long move_vma(struct vm_area_struct *vma,
15885 - return new_addr;
15886 - }
15887 -
15888 -+static struct vm_area_struct *vma_to_resize(unsigned long addr,
15889 -+ unsigned long old_len, unsigned long new_len, unsigned long *p)
15890 -+{
15891 -+ struct mm_struct *mm = current->mm;
15892 -+ struct vm_area_struct *vma = find_vma(mm, addr);
15893 -+
15894 -+ if (!vma || vma->vm_start > addr)
15895 -+ goto Efault;
15896 -+
15897 -+ if (is_vm_hugetlb_page(vma))
15898 -+ goto Einval;
15899 -+
15900 -+ /* We can't remap across vm area boundaries */
15901 -+ if (old_len > vma->vm_end - addr)
15902 -+ goto Efault;
15903 -+
15904 -+ if (vma->vm_flags & (VM_DONTEXPAND | VM_PFNMAP)) {
15905 -+ if (new_len > old_len)
15906 -+ goto Efault;
15907 -+ }
15908 -+
15909 -+ if (vma->vm_flags & VM_LOCKED) {
15910 -+ unsigned long locked, lock_limit;
15911 -+ locked = mm->locked_vm << PAGE_SHIFT;
15912 -+ lock_limit = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur;
15913 -+ locked += new_len - old_len;
15914 -+ if (locked > lock_limit && !capable(CAP_IPC_LOCK))
15915 -+ goto Eagain;
15916 -+ }
15917 -+
15918 -+ if (!may_expand_vm(mm, (new_len - old_len) >> PAGE_SHIFT))
15919 -+ goto Enomem;
15920 -+
15921 -+ if (vma->vm_flags & VM_ACCOUNT) {
15922 -+ unsigned long charged = (new_len - old_len) >> PAGE_SHIFT;
15923 -+ if (security_vm_enough_memory(charged))
15924 -+ goto Efault;
15925 -+ *p = charged;
15926 -+ }
15927 -+
15928 -+ return vma;
15929 -+
15930 -+Efault: /* very odd choice for most of the cases, but... */
15931 -+ return ERR_PTR(-EFAULT);
15932 -+Einval:
15933 -+ return ERR_PTR(-EINVAL);
15934 -+Enomem:
15935 -+ return ERR_PTR(-ENOMEM);
15936 -+Eagain:
15937 -+ return ERR_PTR(-EAGAIN);
15938 -+}
15939 -+
15940 -+static unsigned long mremap_to(unsigned long addr,
15941 -+ unsigned long old_len, unsigned long new_addr,
15942 -+ unsigned long new_len)
15943 -+{
15944 -+ struct mm_struct *mm = current->mm;
15945 -+ struct vm_area_struct *vma;
15946 -+ unsigned long ret = -EINVAL;
15947 -+ unsigned long charged = 0;
15948 -+ unsigned long map_flags;
15949 -+
15950 -+ if (new_addr & ~PAGE_MASK)
15951 -+ goto out;
15952 -+
15953 -+ if (new_len > TASK_SIZE || new_addr > TASK_SIZE - new_len)
15954 -+ goto out;
15955 -+
15956 -+ /* Check if the location we're moving into overlaps the
15957 -+ * old location at all, and fail if it does.
15958 -+ */
15959 -+ if ((new_addr <= addr) && (new_addr+new_len) > addr)
15960 -+ goto out;
15961 -+
15962 -+ if ((addr <= new_addr) && (addr+old_len) > new_addr)
15963 -+ goto out;
15964 -+
15965 -+ ret = security_file_mmap(NULL, 0, 0, 0, new_addr, 1);
15966 -+ if (ret)
15967 -+ goto out;
15968 -+
15969 -+ ret = do_munmap(mm, new_addr, new_len);
15970 -+ if (ret)
15971 -+ goto out;
15972 -+
15973 -+ if (old_len >= new_len) {
15974 -+ ret = do_munmap(mm, addr+new_len, old_len - new_len);
15975 -+ if (ret && old_len != new_len)
15976 -+ goto out;
15977 -+ old_len = new_len;
15978 -+ }
15979 -+
15980 -+ vma = vma_to_resize(addr, old_len, new_len, &charged);
15981 -+ if (IS_ERR(vma)) {
15982 -+ ret = PTR_ERR(vma);
15983 -+ goto out;
15984 -+ }
15985 -+
15986 -+ map_flags = MAP_FIXED;
15987 -+ if (vma->vm_flags & VM_MAYSHARE)
15988 -+ map_flags |= MAP_SHARED;
15989 -+
15990 -+ ret = get_unmapped_area(vma->vm_file, new_addr, new_len, vma->vm_pgoff +
15991 -+ ((addr - vma->vm_start) >> PAGE_SHIFT),
15992 -+ map_flags);
15993 -+ if (ret & ~PAGE_MASK)
15994 -+ goto out1;
15995 -+
15996 -+ ret = move_vma(vma, addr, old_len, new_len, new_addr);
15997 -+ if (!(ret & ~PAGE_MASK))
15998 -+ goto out;
15999 -+out1:
16000 -+ vm_unacct_memory(charged);
16001 -+
16002 -+out:
16003 -+ return ret;
16004 -+}
16005 -+
16006 -+static int vma_expandable(struct vm_area_struct *vma, unsigned long delta)
16007 -+{
16008 -+ unsigned long end = vma->vm_end + delta;
16009 -+ if (end < vma->vm_end) /* overflow */
16010 -+ return 0;
16011 -+ if (vma->vm_next && vma->vm_next->vm_start < end) /* intersection */
16012 -+ return 0;
16013 -+ if (get_unmapped_area(NULL, vma->vm_start, end - vma->vm_start,
16014 -+ 0, MAP_FIXED) & ~PAGE_MASK)
16015 -+ return 0;
16016 -+ return 1;
16017 -+}
16018 -+
16019 - /*
16020 - * Expand (or shrink) an existing mapping, potentially moving it at the
16021 - * same time (controlled by the MREMAP_MAYMOVE flag and available VM space)
16022 -@@ -294,32 +425,10 @@ unsigned long do_mremap(unsigned long addr,
16023 - if (!new_len)
16024 - goto out;
16025 -
16026 -- /* new_addr is only valid if MREMAP_FIXED is specified */
16027 - if (flags & MREMAP_FIXED) {
16028 -- if (new_addr & ~PAGE_MASK)
16029 -- goto out;
16030 -- if (!(flags & MREMAP_MAYMOVE))
16031 -- goto out;
16032 --
16033 -- if (new_len > TASK_SIZE || new_addr > TASK_SIZE - new_len)
16034 -- goto out;
16035 --
16036 -- /* Check if the location we're moving into overlaps the
16037 -- * old location at all, and fail if it does.
16038 -- */
16039 -- if ((new_addr <= addr) && (new_addr+new_len) > addr)
16040 -- goto out;
16041 --
16042 -- if ((addr <= new_addr) && (addr+old_len) > new_addr)
16043 -- goto out;
16044 --
16045 -- ret = security_file_mmap(NULL, 0, 0, 0, new_addr, 1);
16046 -- if (ret)
16047 -- goto out;
16048 --
16049 -- ret = do_munmap(mm, new_addr, new_len);
16050 -- if (ret)
16051 -- goto out;
16052 -+ if (flags & MREMAP_MAYMOVE)
16053 -+ ret = mremap_to(addr, old_len, new_addr, new_len);
16054 -+ goto out;
16055 - }
16056 -
16057 - /*
16058 -@@ -332,60 +441,23 @@ unsigned long do_mremap(unsigned long addr,
16059 - if (ret && old_len != new_len)
16060 - goto out;
16061 - ret = addr;
16062 -- if (!(flags & MREMAP_FIXED) || (new_addr == addr))
16063 -- goto out;
16064 -- old_len = new_len;
16065 -+ goto out;
16066 - }
16067 -
16068 - /*
16069 -- * Ok, we need to grow.. or relocate.
16070 -+ * Ok, we need to grow..
16071 - */
16072 -- ret = -EFAULT;
16073 -- vma = find_vma(mm, addr);
16074 -- if (!vma || vma->vm_start > addr)
16075 -- goto out;
16076 -- if (is_vm_hugetlb_page(vma)) {
16077 -- ret = -EINVAL;
16078 -- goto out;
16079 -- }
16080 -- /* We can't remap across vm area boundaries */
16081 -- if (old_len > vma->vm_end - addr)
16082 -- goto out;
16083 -- if (vma->vm_flags & (VM_DONTEXPAND | VM_PFNMAP)) {
16084 -- if (new_len > old_len)
16085 -- goto out;
16086 -- }
16087 -- if (vma->vm_flags & VM_LOCKED) {
16088 -- unsigned long locked, lock_limit;
16089 -- locked = mm->locked_vm << PAGE_SHIFT;
16090 -- lock_limit = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur;
16091 -- locked += new_len - old_len;
16092 -- ret = -EAGAIN;
16093 -- if (locked > lock_limit && !capable(CAP_IPC_LOCK))
16094 -- goto out;
16095 -- }
16096 -- if (!may_expand_vm(mm, (new_len - old_len) >> PAGE_SHIFT)) {
16097 -- ret = -ENOMEM;
16098 -+ vma = vma_to_resize(addr, old_len, new_len, &charged);
16099 -+ if (IS_ERR(vma)) {
16100 -+ ret = PTR_ERR(vma);
16101 - goto out;
16102 - }
16103 -
16104 -- if (vma->vm_flags & VM_ACCOUNT) {
16105 -- charged = (new_len - old_len) >> PAGE_SHIFT;
16106 -- if (security_vm_enough_memory(charged))
16107 -- goto out_nc;
16108 -- }
16109 --
16110 - /* old_len exactly to the end of the area..
16111 -- * And we're not relocating the area.
16112 - */
16113 -- if (old_len == vma->vm_end - addr &&
16114 -- !((flags & MREMAP_FIXED) && (addr != new_addr)) &&
16115 -- (old_len != new_len || !(flags & MREMAP_MAYMOVE))) {
16116 -- unsigned long max_addr = TASK_SIZE;
16117 -- if (vma->vm_next)
16118 -- max_addr = vma->vm_next->vm_start;
16119 -+ if (old_len == vma->vm_end - addr) {
16120 - /* can we just expand the current mapping? */
16121 -- if (max_addr - addr >= new_len) {
16122 -+ if (vma_expandable(vma, new_len - old_len)) {
16123 - int pages = (new_len - old_len) >> PAGE_SHIFT;
16124 -
16125 - vma_adjust(vma, vma->vm_start,
16126 -@@ -409,28 +481,27 @@ unsigned long do_mremap(unsigned long addr,
16127 - */
16128 - ret = -ENOMEM;
16129 - if (flags & MREMAP_MAYMOVE) {
16130 -- if (!(flags & MREMAP_FIXED)) {
16131 -- unsigned long map_flags = 0;
16132 -- if (vma->vm_flags & VM_MAYSHARE)
16133 -- map_flags |= MAP_SHARED;
16134 --
16135 -- new_addr = get_unmapped_area(vma->vm_file, 0, new_len,
16136 -- vma->vm_pgoff, map_flags);
16137 -- if (new_addr & ~PAGE_MASK) {
16138 -- ret = new_addr;
16139 -- goto out;
16140 -- }
16141 --
16142 -- ret = security_file_mmap(NULL, 0, 0, 0, new_addr, 1);
16143 -- if (ret)
16144 -- goto out;
16145 -+ unsigned long map_flags = 0;
16146 -+ if (vma->vm_flags & VM_MAYSHARE)
16147 -+ map_flags |= MAP_SHARED;
16148 -+
16149 -+ new_addr = get_unmapped_area(vma->vm_file, 0, new_len,
16150 -+ vma->vm_pgoff +
16151 -+ ((addr - vma->vm_start) >> PAGE_SHIFT),
16152 -+ map_flags);
16153 -+ if (new_addr & ~PAGE_MASK) {
16154 -+ ret = new_addr;
16155 -+ goto out;
16156 - }
16157 -+
16158 -+ ret = security_file_mmap(NULL, 0, 0, 0, new_addr, 1);
16159 -+ if (ret)
16160 -+ goto out;
16161 - ret = move_vma(vma, addr, old_len, new_len, new_addr);
16162 - }
16163 - out:
16164 - if (ret & ~PAGE_MASK)
16165 - vm_unacct_memory(charged);
16166 --out_nc:
16167 - return ret;
16168 - }
16169 -
16170 -diff --git a/mm/util.c b/mm/util.c
16171 -index 7c35ad9..b377ce4 100644
16172 ---- a/mm/util.c
16173 -+++ b/mm/util.c
16174 -@@ -4,6 +4,10 @@
16175 - #include <linux/module.h>
16176 - #include <linux/err.h>
16177 - #include <linux/sched.h>
16178 -+#include <linux/hugetlb.h>
16179 -+#include <linux/syscalls.h>
16180 -+#include <linux/mman.h>
16181 -+#include <linux/file.h>
16182 - #include <asm/uaccess.h>
16183 -
16184 - #define CREATE_TRACE_POINTS
16185 -@@ -268,6 +272,46 @@ int __attribute__((weak)) get_user_pages_fast(unsigned long start,
16186 - }
16187 - EXPORT_SYMBOL_GPL(get_user_pages_fast);
16188 -
16189 -+SYSCALL_DEFINE6(mmap_pgoff, unsigned long, addr, unsigned long, len,
16190 -+ unsigned long, prot, unsigned long, flags,
16191 -+ unsigned long, fd, unsigned long, pgoff)
16192 -+{
16193 -+ struct file * file = NULL;
16194 -+ unsigned long retval = -EBADF;
16195 -+
16196 -+ if (!(flags & MAP_ANONYMOUS)) {
16197 -+ if (unlikely(flags & MAP_HUGETLB))
16198 -+ return -EINVAL;
16199 -+ file = fget(fd);
16200 -+ if (!file)
16201 -+ goto out;
16202 -+ } else if (flags & MAP_HUGETLB) {
16203 -+ struct user_struct *user = NULL;
16204 -+ /*
16205 -+ * VM_NORESERVE is used because the reservations will be
16206 -+ * taken when vm_ops->mmap() is called
16207 -+ * A dummy user value is used because we are not locking
16208 -+ * memory so no accounting is necessary
16209 -+ */
16210 -+ len = ALIGN(len, huge_page_size(&default_hstate));
16211 -+ file = hugetlb_file_setup(HUGETLB_ANON_FILE, len, VM_NORESERVE,
16212 -+ &user, HUGETLB_ANONHUGE_INODE);
16213 -+ if (IS_ERR(file))
16214 -+ return PTR_ERR(file);
16215 -+ }
16216 -+
16217 -+ flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
16218 -+
16219 -+ down_write(&current->mm->mmap_sem);
16220 -+ retval = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
16221 -+ up_write(&current->mm->mmap_sem);
16222 -+
16223 -+ if (file)
16224 -+ fput(file);
16225 -+out:
16226 -+ return retval;
16227 -+}
16228 -+
16229 - /* Tracepoints definitions. */
16230 - EXPORT_TRACEPOINT_SYMBOL(kmalloc);
16231 - EXPORT_TRACEPOINT_SYMBOL(kmem_cache_alloc);
16232 -diff --git a/net/bridge/netfilter/ebtables.c b/net/bridge/netfilter/ebtables.c
16233 -index bd1c654..0b7f262 100644
16234 ---- a/net/bridge/netfilter/ebtables.c
16235 -+++ b/net/bridge/netfilter/ebtables.c
16236 -@@ -1406,6 +1406,9 @@ static int do_ebt_set_ctl(struct sock *sk,
16237 - {
16238 - int ret;
16239 -
16240 -+ if (!capable(CAP_NET_ADMIN))
16241 -+ return -EPERM;
16242 -+
16243 - switch(cmd) {
16244 - case EBT_SO_SET_ENTRIES:
16245 - ret = do_replace(sock_net(sk), user, len);
16246 -@@ -1425,6 +1428,9 @@ static int do_ebt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len)
16247 - struct ebt_replace tmp;
16248 - struct ebt_table *t;
16249 -
16250 -+ if (!capable(CAP_NET_ADMIN))
16251 -+ return -EPERM;
16252 -+
16253 - if (copy_from_user(&tmp, user, sizeof(tmp)))
16254 - return -EFAULT;
16255 -
16256 -diff --git a/net/ipv6/exthdrs.c b/net/ipv6/exthdrs.c
16257 -index df159ff..4bac362 100644
16258 ---- a/net/ipv6/exthdrs.c
16259 -+++ b/net/ipv6/exthdrs.c
16260 -@@ -559,6 +559,11 @@ static inline struct inet6_dev *ipv6_skb_idev(struct sk_buff *skb)
16261 - return skb_dst(skb) ? ip6_dst_idev(skb_dst(skb)) : __in6_dev_get(skb->dev);
16262 - }
16263 -
16264 -+static inline struct net *ipv6_skb_net(struct sk_buff *skb)
16265 -+{
16266 -+ return skb_dst(skb) ? dev_net(skb_dst(skb)->dev) : dev_net(skb->dev);
16267 -+}
16268 -+
16269 - /* Router Alert as of RFC 2711 */
16270 -
16271 - static int ipv6_hop_ra(struct sk_buff *skb, int optoff)
16272 -@@ -580,8 +585,8 @@ static int ipv6_hop_ra(struct sk_buff *skb, int optoff)
16273 - static int ipv6_hop_jumbo(struct sk_buff *skb, int optoff)
16274 - {
16275 - const unsigned char *nh = skb_network_header(skb);
16276 -+ struct net *net = ipv6_skb_net(skb);
16277 - u32 pkt_len;
16278 -- struct net *net = dev_net(skb_dst(skb)->dev);
16279 -
16280 - if (nh[optoff + 1] != 4 || (optoff & 3) != 2) {
16281 - LIMIT_NETDEBUG(KERN_DEBUG "ipv6_hop_jumbo: wrong jumbo opt length/alignment %d\n",
16282 -diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
16283 -index b8295cb..079c500 100644
16284 ---- a/net/mac80211/iface.c
16285 -+++ b/net/mac80211/iface.c
16286 -@@ -15,12 +15,14 @@
16287 - #include <linux/netdevice.h>
16288 - #include <linux/rtnetlink.h>
16289 - #include <net/mac80211.h>
16290 -+#include <net/ieee80211_radiotap.h>
16291 - #include "ieee80211_i.h"
16292 - #include "sta_info.h"
16293 - #include "debugfs_netdev.h"
16294 - #include "mesh.h"
16295 - #include "led.h"
16296 - #include "driver-ops.h"
16297 -+#include "wme.h"
16298 -
16299 - /**
16300 - * DOC: Interface list locking
16301 -@@ -642,6 +644,12 @@ static void ieee80211_teardown_sdata(struct net_device *dev)
16302 - WARN_ON(flushed);
16303 - }
16304 -
16305 -+static u16 ieee80211_netdev_select_queue(struct net_device *dev,
16306 -+ struct sk_buff *skb)
16307 -+{
16308 -+ return ieee80211_select_queue(IEEE80211_DEV_TO_SUB_IF(dev), skb);
16309 -+}
16310 -+
16311 - static const struct net_device_ops ieee80211_dataif_ops = {
16312 - .ndo_open = ieee80211_open,
16313 - .ndo_stop = ieee80211_stop,
16314 -@@ -650,8 +658,35 @@ static const struct net_device_ops ieee80211_dataif_ops = {
16315 - .ndo_set_multicast_list = ieee80211_set_multicast_list,
16316 - .ndo_change_mtu = ieee80211_change_mtu,
16317 - .ndo_set_mac_address = eth_mac_addr,
16318 -+ .ndo_select_queue = ieee80211_netdev_select_queue,
16319 - };
16320 -
16321 -+static u16 ieee80211_monitor_select_queue(struct net_device *dev,
16322 -+ struct sk_buff *skb)
16323 -+{
16324 -+ struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
16325 -+ struct ieee80211_local *local = sdata->local;
16326 -+ struct ieee80211_hdr *hdr;
16327 -+ struct ieee80211_radiotap_header *rtap = (void *)skb->data;
16328 -+
16329 -+ if (local->hw.queues < 4)
16330 -+ return 0;
16331 -+
16332 -+ if (skb->len < 4 ||
16333 -+ skb->len < le16_to_cpu(rtap->it_len) + 2 /* frame control */)
16334 -+ return 0; /* doesn't matter, frame will be dropped */
16335 -+
16336 -+ hdr = (void *)((u8 *)skb->data + le16_to_cpu(rtap->it_len));
16337 -+
16338 -+ if (!ieee80211_is_data(hdr->frame_control)) {
16339 -+ skb->priority = 7;
16340 -+ return ieee802_1d_to_ac[skb->priority];
16341 -+ }
16342 -+
16343 -+ skb->priority = 0;
16344 -+ return ieee80211_downgrade_queue(local, skb);
16345 -+}
16346 -+
16347 - static const struct net_device_ops ieee80211_monitorif_ops = {
16348 - .ndo_open = ieee80211_open,
16349 - .ndo_stop = ieee80211_stop,
16350 -@@ -660,6 +695,7 @@ static const struct net_device_ops ieee80211_monitorif_ops = {
16351 - .ndo_set_multicast_list = ieee80211_set_multicast_list,
16352 - .ndo_change_mtu = ieee80211_change_mtu,
16353 - .ndo_set_mac_address = eth_mac_addr,
16354 -+ .ndo_select_queue = ieee80211_monitor_select_queue,
16355 - };
16356 -
16357 - static void ieee80211_if_setup(struct net_device *dev)
16358 -@@ -768,8 +804,8 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
16359 -
16360 - ASSERT_RTNL();
16361 -
16362 -- ndev = alloc_netdev(sizeof(*sdata) + local->hw.vif_data_size,
16363 -- name, ieee80211_if_setup);
16364 -+ ndev = alloc_netdev_mq(sizeof(*sdata) + local->hw.vif_data_size,
16365 -+ name, ieee80211_if_setup, local->hw.queues);
16366 - if (!ndev)
16367 - return -ENOMEM;
16368 - dev_net_set(ndev, wiphy_net(local->hw.wiphy));
16369 -diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
16370 -index f13d181..6cae295 100644
16371 ---- a/net/mac80211/mlme.c
16372 -+++ b/net/mac80211/mlme.c
16373 -@@ -1953,7 +1953,9 @@ static void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
16374 - rma = ieee80211_rx_mgmt_disassoc(sdata, mgmt, skb->len);
16375 - break;
16376 - case IEEE80211_STYPE_ACTION:
16377 -- /* XXX: differentiate, can only happen for CSA now! */
16378 -+ if (mgmt->u.action.category != WLAN_CATEGORY_SPECTRUM_MGMT)
16379 -+ break;
16380 -+
16381 - ieee80211_sta_process_chanswitch(sdata,
16382 - &mgmt->u.action.u.chan_switch.sw_elem,
16383 - ifmgd->associated);
16384 -diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
16385 -index 4e14754..16c6cdc 100644
16386 ---- a/net/mac80211/rx.c
16387 -+++ b/net/mac80211/rx.c
16388 -@@ -1548,7 +1548,9 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx)
16389 - memset(info, 0, sizeof(*info));
16390 - info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING;
16391 - info->control.vif = &rx->sdata->vif;
16392 -- ieee80211_select_queue(local, fwd_skb);
16393 -+ skb_set_queue_mapping(skb,
16394 -+ ieee80211_select_queue(rx->sdata, fwd_skb));
16395 -+ ieee80211_set_qos_hdr(local, skb);
16396 - if (is_multicast_ether_addr(fwd_hdr->addr1))
16397 - IEEE80211_IFSTA_MESH_CTR_INC(&sdata->u.mesh,
16398 - fwded_mcast);
16399 -@@ -1808,6 +1810,10 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
16400 - }
16401 - break;
16402 - default:
16403 -+ /* do not process rejected action frames */
16404 -+ if (mgmt->u.action.category & 0x80)
16405 -+ return RX_DROP_MONITOR;
16406 -+
16407 - return RX_CONTINUE;
16408 - }
16409 -
16410 -diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
16411 -index d398197..441f68e 100644
16412 ---- a/net/mac80211/tx.c
16413 -+++ b/net/mac80211/tx.c
16414 -@@ -1482,7 +1482,7 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
16415 - return;
16416 - }
16417 -
16418 -- ieee80211_select_queue(local, skb);
16419 -+ ieee80211_set_qos_hdr(local, skb);
16420 - ieee80211_tx(sdata, skb, false);
16421 - dev_put(sdata->dev);
16422 - }
16423 -@@ -2226,6 +2226,9 @@ void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb,
16424 - if (!encrypt)
16425 - info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
16426 -
16427 -+ /* send all internal mgmt frames on VO */
16428 -+ skb_set_queue_mapping(skb, 0);
16429 -+
16430 - /*
16431 - * The other path calling ieee80211_xmit is from the tasklet,
16432 - * and while we can handle concurrent transmissions locking
16433 -diff --git a/net/mac80211/util.c b/net/mac80211/util.c
16434 -index 51e0bd2..553cffe 100644
16435 ---- a/net/mac80211/util.c
16436 -+++ b/net/mac80211/util.c
16437 -@@ -269,6 +269,7 @@ static void __ieee80211_wake_queue(struct ieee80211_hw *hw, int queue,
16438 - enum queue_stop_reason reason)
16439 - {
16440 - struct ieee80211_local *local = hw_to_local(hw);
16441 -+ struct ieee80211_sub_if_data *sdata;
16442 -
16443 - if (WARN_ON(queue >= hw->queues))
16444 - return;
16445 -@@ -281,6 +282,11 @@ static void __ieee80211_wake_queue(struct ieee80211_hw *hw, int queue,
16446 -
16447 - if (!skb_queue_empty(&local->pending[queue]))
16448 - tasklet_schedule(&local->tx_pending_tasklet);
16449 -+
16450 -+ rcu_read_lock();
16451 -+ list_for_each_entry_rcu(sdata, &local->interfaces, list)
16452 -+ netif_tx_wake_queue(netdev_get_tx_queue(sdata->dev, queue));
16453 -+ rcu_read_unlock();
16454 - }
16455 -
16456 - void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue,
16457 -@@ -305,11 +311,17 @@ static void __ieee80211_stop_queue(struct ieee80211_hw *hw, int queue,
16458 - enum queue_stop_reason reason)
16459 - {
16460 - struct ieee80211_local *local = hw_to_local(hw);
16461 -+ struct ieee80211_sub_if_data *sdata;
16462 -
16463 - if (WARN_ON(queue >= hw->queues))
16464 - return;
16465 -
16466 - __set_bit(reason, &local->queue_stop_reasons[queue]);
16467 -+
16468 -+ rcu_read_lock();
16469 -+ list_for_each_entry_rcu(sdata, &local->interfaces, list)
16470 -+ netif_tx_stop_queue(netdev_get_tx_queue(sdata->dev, queue));
16471 -+ rcu_read_unlock();
16472 - }
16473 -
16474 - void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue,
16475 -diff --git a/net/mac80211/wme.c b/net/mac80211/wme.c
16476 -index b19b769..6d32ebf 100644
16477 ---- a/net/mac80211/wme.c
16478 -+++ b/net/mac80211/wme.c
16479 -@@ -44,22 +44,62 @@ static int wme_downgrade_ac(struct sk_buff *skb)
16480 - }
16481 -
16482 -
16483 --/* Indicate which queue to use. */
16484 --static u16 classify80211(struct ieee80211_local *local, struct sk_buff *skb)
16485 -+/* Indicate which queue to use. */
16486 -+u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
16487 -+ struct sk_buff *skb)
16488 - {
16489 -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
16490 -+ struct ieee80211_local *local = sdata->local;
16491 -+ struct sta_info *sta = NULL;
16492 -+ u32 sta_flags = 0;
16493 -+ const u8 *ra = NULL;
16494 -+ bool qos = false;
16495 -
16496 -- if (!ieee80211_is_data(hdr->frame_control)) {
16497 -- /* management frames go on AC_VO queue, but are sent
16498 -- * without QoS control fields */
16499 -- return 0;
16500 -+ if (local->hw.queues < 4 || skb->len < 6) {
16501 -+ skb->priority = 0; /* required for correct WPA/11i MIC */
16502 -+ return min_t(u16, local->hw.queues - 1,
16503 -+ ieee802_1d_to_ac[skb->priority]);
16504 - }
16505 -
16506 -- if (0 /* injected */) {
16507 -- /* use AC from radiotap */
16508 -+ rcu_read_lock();
16509 -+ switch (sdata->vif.type) {
16510 -+ case NL80211_IFTYPE_AP_VLAN:
16511 -+ case NL80211_IFTYPE_AP:
16512 -+ ra = skb->data;
16513 -+ break;
16514 -+ case NL80211_IFTYPE_WDS:
16515 -+ ra = sdata->u.wds.remote_addr;
16516 -+ break;
16517 -+#ifdef CONFIG_MAC80211_MESH
16518 -+ case NL80211_IFTYPE_MESH_POINT:
16519 -+ /*
16520 -+ * XXX: This is clearly broken ... but already was before,
16521 -+ * because ieee80211_fill_mesh_addresses() would clear A1
16522 -+ * except for multicast addresses.
16523 -+ */
16524 -+ break;
16525 -+#endif
16526 -+ case NL80211_IFTYPE_STATION:
16527 -+ ra = sdata->u.mgd.bssid;
16528 -+ break;
16529 -+ case NL80211_IFTYPE_ADHOC:
16530 -+ ra = skb->data;
16531 -+ break;
16532 -+ default:
16533 -+ break;
16534 - }
16535 -
16536 -- if (!ieee80211_is_data_qos(hdr->frame_control)) {
16537 -+ if (!sta && ra && !is_multicast_ether_addr(ra)) {
16538 -+ sta = sta_info_get(local, ra);
16539 -+ if (sta)
16540 -+ sta_flags = get_sta_flags(sta);
16541 -+ }
16542 -+
16543 -+ if (sta_flags & WLAN_STA_WME)
16544 -+ qos = true;
16545 -+
16546 -+ rcu_read_unlock();
16547 -+
16548 -+ if (!qos) {
16549 - skb->priority = 0; /* required for correct WPA/11i MIC */
16550 - return ieee802_1d_to_ac[skb->priority];
16551 - }
16552 -@@ -68,6 +108,12 @@ static u16 classify80211(struct ieee80211_local *local, struct sk_buff *skb)
16553 - * data frame has */
16554 - skb->priority = cfg80211_classify8021d(skb);
16555 -
16556 -+ return ieee80211_downgrade_queue(local, skb);
16557 -+}
16558 -+
16559 -+u16 ieee80211_downgrade_queue(struct ieee80211_local *local,
16560 -+ struct sk_buff *skb)
16561 -+{
16562 - /* in case we are a client verify acm is not set for this ac */
16563 - while (unlikely(local->wmm_acm & BIT(skb->priority))) {
16564 - if (wme_downgrade_ac(skb)) {
16565 -@@ -85,24 +131,17 @@ static u16 classify80211(struct ieee80211_local *local, struct sk_buff *skb)
16566 - return ieee802_1d_to_ac[skb->priority];
16567 - }
16568 -
16569 --void ieee80211_select_queue(struct ieee80211_local *local, struct sk_buff *skb)
16570 -+void ieee80211_set_qos_hdr(struct ieee80211_local *local, struct sk_buff *skb)
16571 - {
16572 -- struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
16573 -- u16 queue;
16574 -- u8 tid;
16575 --
16576 -- queue = classify80211(local, skb);
16577 -- if (unlikely(queue >= local->hw.queues))
16578 -- queue = local->hw.queues - 1;
16579 --
16580 -- /*
16581 -- * Now we know the 1d priority, fill in the QoS header if
16582 -- * there is one (and we haven't done this before).
16583 -- */
16584 -+ struct ieee80211_hdr *hdr = (void *)skb->data;
16585 -+
16586 -+ /* Fill in the QoS header if there is one. */
16587 - if (ieee80211_is_data_qos(hdr->frame_control)) {
16588 - u8 *p = ieee80211_get_qos_ctl(hdr);
16589 -- u8 ack_policy = 0;
16590 -+ u8 ack_policy = 0, tid;
16591 -+
16592 - tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
16593 -+
16594 - if (unlikely(local->wifi_wme_noack_test))
16595 - ack_policy |= QOS_CONTROL_ACK_POLICY_NOACK <<
16596 - QOS_CONTROL_ACK_POLICY_SHIFT;
16597 -@@ -110,6 +149,4 @@ void ieee80211_select_queue(struct ieee80211_local *local, struct sk_buff *skb)
16598 - *p++ = ack_policy | tid;
16599 - *p = 0;
16600 - }
16601 --
16602 -- skb_set_queue_mapping(skb, queue);
16603 - }
16604 -diff --git a/net/mac80211/wme.h b/net/mac80211/wme.h
16605 -index d4fd87c..6053b1c 100644
16606 ---- a/net/mac80211/wme.h
16607 -+++ b/net/mac80211/wme.h
16608 -@@ -20,7 +20,11 @@
16609 -
16610 - extern const int ieee802_1d_to_ac[8];
16611 -
16612 --void ieee80211_select_queue(struct ieee80211_local *local,
16613 -- struct sk_buff *skb);
16614 -+u16 ieee80211_select_queue(struct ieee80211_sub_if_data *sdata,
16615 -+ struct sk_buff *skb);
16616 -+void ieee80211_set_qos_hdr(struct ieee80211_local *local, struct sk_buff *skb);
16617 -+u16 ieee80211_downgrade_queue(struct ieee80211_local *local,
16618 -+ struct sk_buff *skb);
16619 -+
16620 -
16621 - #endif /* _WME_H */
16622 -diff --git a/net/netfilter/nf_conntrack_ftp.c b/net/netfilter/nf_conntrack_ftp.c
16623 -index 5509dd1..7dfd469 100644
16624 ---- a/net/netfilter/nf_conntrack_ftp.c
16625 -+++ b/net/netfilter/nf_conntrack_ftp.c
16626 -@@ -323,24 +323,24 @@ static void update_nl_seq(struct nf_conn *ct, u32 nl_seq,
16627 - struct nf_ct_ftp_master *info, int dir,
16628 - struct sk_buff *skb)
16629 - {
16630 -- unsigned int i, oldest = NUM_SEQ_TO_REMEMBER;
16631 -+ unsigned int i, oldest;
16632 -
16633 - /* Look for oldest: if we find exact match, we're done. */
16634 - for (i = 0; i < info->seq_aft_nl_num[dir]; i++) {
16635 - if (info->seq_aft_nl[dir][i] == nl_seq)
16636 - return;
16637 --
16638 -- if (oldest == info->seq_aft_nl_num[dir] ||
16639 -- before(info->seq_aft_nl[dir][i],
16640 -- info->seq_aft_nl[dir][oldest]))
16641 -- oldest = i;
16642 - }
16643 -
16644 - if (info->seq_aft_nl_num[dir] < NUM_SEQ_TO_REMEMBER) {
16645 - info->seq_aft_nl[dir][info->seq_aft_nl_num[dir]++] = nl_seq;
16646 -- } else if (oldest != NUM_SEQ_TO_REMEMBER &&
16647 -- after(nl_seq, info->seq_aft_nl[dir][oldest])) {
16648 -- info->seq_aft_nl[dir][oldest] = nl_seq;
16649 -+ } else {
16650 -+ if (before(info->seq_aft_nl[dir][0], info->seq_aft_nl[dir][1]))
16651 -+ oldest = 0;
16652 -+ else
16653 -+ oldest = 1;
16654 -+
16655 -+ if (after(nl_seq, info->seq_aft_nl[dir][oldest]))
16656 -+ info->seq_aft_nl[dir][oldest] = nl_seq;
16657 - }
16658 - }
16659 -
16660 -diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
16661 -index 129d75e..9c5a19d 100644
16662 ---- a/net/sunrpc/auth_gss/auth_gss.c
16663 -+++ b/net/sunrpc/auth_gss/auth_gss.c
16664 -@@ -644,7 +644,22 @@ gss_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
16665 - p = gss_fill_context(p, end, ctx, gss_msg->auth->mech);
16666 - if (IS_ERR(p)) {
16667 - err = PTR_ERR(p);
16668 -- gss_msg->msg.errno = (err == -EAGAIN) ? -EAGAIN : -EACCES;
16669 -+ switch (err) {
16670 -+ case -EACCES:
16671 -+ gss_msg->msg.errno = err;
16672 -+ err = mlen;
16673 -+ break;
16674 -+ case -EFAULT:
16675 -+ case -ENOMEM:
16676 -+ case -EINVAL:
16677 -+ case -ENOSYS:
16678 -+ gss_msg->msg.errno = -EAGAIN;
16679 -+ break;
16680 -+ default:
16681 -+ printk(KERN_CRIT "%s: bad return from "
16682 -+ "gss_fill_context: %ld\n", __func__, err);
16683 -+ BUG();
16684 -+ }
16685 - goto err_release_msg;
16686 - }
16687 - gss_msg->ctx = gss_get_ctx(ctx);
16688 -diff --git a/net/sunrpc/auth_gss/gss_krb5_mech.c b/net/sunrpc/auth_gss/gss_krb5_mech.c
16689 -index ef45eba..2deb0ed 100644
16690 ---- a/net/sunrpc/auth_gss/gss_krb5_mech.c
16691 -+++ b/net/sunrpc/auth_gss/gss_krb5_mech.c
16692 -@@ -131,8 +131,10 @@ gss_import_sec_context_kerberos(const void *p,
16693 - struct krb5_ctx *ctx;
16694 - int tmp;
16695 -
16696 -- if (!(ctx = kzalloc(sizeof(*ctx), GFP_NOFS)))
16697 -+ if (!(ctx = kzalloc(sizeof(*ctx), GFP_NOFS))) {
16698 -+ p = ERR_PTR(-ENOMEM);
16699 - goto out_err;
16700 -+ }
16701 -
16702 - p = simple_get_bytes(p, end, &ctx->initiate, sizeof(ctx->initiate));
16703 - if (IS_ERR(p))
16704 -diff --git a/net/sunrpc/auth_gss/gss_mech_switch.c b/net/sunrpc/auth_gss/gss_mech_switch.c
16705 -index 6efbb0c..76e4c6f 100644
16706 ---- a/net/sunrpc/auth_gss/gss_mech_switch.c
16707 -+++ b/net/sunrpc/auth_gss/gss_mech_switch.c
16708 -@@ -252,7 +252,7 @@ gss_import_sec_context(const void *input_token, size_t bufsize,
16709 - struct gss_ctx **ctx_id)
16710 - {
16711 - if (!(*ctx_id = kzalloc(sizeof(**ctx_id), GFP_KERNEL)))
16712 -- return GSS_S_FAILURE;
16713 -+ return -ENOMEM;
16714 - (*ctx_id)->mech_type = gss_mech_get(mech);
16715 -
16716 - return mech->gm_ops
16717 -diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
16718 -index df124f7..0266cca 100644
16719 ---- a/net/sunrpc/svc_xprt.c
16720 -+++ b/net/sunrpc/svc_xprt.c
16721 -@@ -711,7 +711,8 @@ int svc_recv(struct svc_rqst *rqstp, long timeout)
16722 - spin_unlock_bh(&pool->sp_lock);
16723 -
16724 - len = 0;
16725 -- if (test_bit(XPT_LISTENER, &xprt->xpt_flags)) {
16726 -+ if (test_bit(XPT_LISTENER, &xprt->xpt_flags) &&
16727 -+ !test_bit(XPT_CLOSE, &xprt->xpt_flags)) {
16728 - struct svc_xprt *newxpt;
16729 - newxpt = xprt->xpt_ops->xpo_accept(xprt);
16730 - if (newxpt) {
16731 -diff --git a/net/wireless/reg.c b/net/wireless/reg.c
16732 -index f256dff..efd24a7 100644
16733 ---- a/net/wireless/reg.c
16734 -+++ b/net/wireless/reg.c
16735 -@@ -1714,7 +1714,7 @@ int regulatory_hint_user(const char *alpha2)
16736 - request->wiphy_idx = WIPHY_IDX_STALE;
16737 - request->alpha2[0] = alpha2[0];
16738 - request->alpha2[1] = alpha2[1];
16739 -- request->initiator = NL80211_REGDOM_SET_BY_USER,
16740 -+ request->initiator = NL80211_REGDOM_SET_BY_USER;
16741 -
16742 - queue_regulatory_request(request);
16743 -
16744 -diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c
16745 -index 7337abd..67ca440 100644
16746 ---- a/sound/pci/ac97/ac97_patch.c
16747 -+++ b/sound/pci/ac97/ac97_patch.c
16748 -@@ -1870,6 +1870,7 @@ static unsigned int ad1981_jacks_blacklist[] = {
16749 - 0x10140554, /* Thinkpad T42p/R50p */
16750 - 0x10140567, /* Thinkpad T43p 2668-G7U */
16751 - 0x10140581, /* Thinkpad X41-2527 */
16752 -+ 0x10280160, /* Dell Dimension 2400 */
16753 - 0x104380b0, /* Asus A7V8X-MX */
16754 - 0x11790241, /* Toshiba Satellite A-15 S127 */
16755 - 0x144dc01a, /* Samsung NP-X20C004/SEG */
16756 -diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
16757 -index d6752df..42b4fbb 100644
16758 ---- a/sound/pci/atiixp.c
16759 -+++ b/sound/pci/atiixp.c
16760 -@@ -297,6 +297,7 @@ static struct pci_device_id snd_atiixp_ids[] = {
16761 - MODULE_DEVICE_TABLE(pci, snd_atiixp_ids);
16762 -
16763 - static struct snd_pci_quirk atiixp_quirks[] __devinitdata = {
16764 -+ SND_PCI_QUIRK(0x105b, 0x0c81, "Foxconn RC4107MA-RS2", 0),
16765 - SND_PCI_QUIRK(0x15bd, 0x3100, "DFI RS482", 0),
16766 - { } /* terminator */
16767 - };
16768 -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
16769 -index e40d31f..a4cb183 100644
16770 ---- a/sound/pci/hda/patch_realtek.c
16771 -+++ b/sound/pci/hda/patch_realtek.c
16772 -@@ -15323,7 +15323,7 @@ static struct alc_config_preset alc861vd_presets[] = {
16773 - static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
16774 - const struct auto_pin_cfg *cfg)
16775 - {
16776 -- return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);
16777 -+ return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x22, 0);
16778 - }
16779 -
16780 -
16781 -diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c
16782 -index 593d5b9..2089fe7 100644
16783 ---- a/sound/soc/codecs/wm8350.c
16784 -+++ b/sound/soc/codecs/wm8350.c
16785 -@@ -925,7 +925,7 @@ static int wm8350_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
16786 - iface |= 0x3 << 8;
16787 - break;
16788 - case SND_SOC_DAIFMT_DSP_B:
16789 -- iface |= 0x3 << 8; /* lg not sure which mode */
16790 -+ iface |= 0x3 << 8 | WM8350_AIF_LRCLK_INV;
16791 - break;
16792 - default:
16793 - return -EINVAL;
16794 -diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c
16795 -index 060d5d0..8db62e2 100644
16796 ---- a/sound/soc/codecs/wm8510.c
16797 -+++ b/sound/soc/codecs/wm8510.c
16798 -@@ -425,23 +425,23 @@ static int wm8510_pcm_hw_params(struct snd_pcm_substream *substream,
16799 -
16800 - /* filter coefficient */
16801 - switch (params_rate(params)) {
16802 -- case SNDRV_PCM_RATE_8000:
16803 -+ case 8000:
16804 - adn |= 0x5 << 1;
16805 - break;
16806 -- case SNDRV_PCM_RATE_11025:
16807 -+ case 11025:
16808 - adn |= 0x4 << 1;
16809 - break;
16810 -- case SNDRV_PCM_RATE_16000:
16811 -+ case 16000:
16812 - adn |= 0x3 << 1;
16813 - break;
16814 -- case SNDRV_PCM_RATE_22050:
16815 -+ case 22050:
16816 - adn |= 0x2 << 1;
16817 - break;
16818 -- case SNDRV_PCM_RATE_32000:
16819 -+ case 32000:
16820 - adn |= 0x1 << 1;
16821 - break;
16822 -- case SNDRV_PCM_RATE_44100:
16823 -- case SNDRV_PCM_RATE_48000:
16824 -+ case 44100:
16825 -+ case 48000:
16826 - break;
16827 - }
16828 -
16829 -diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c
16830 -index 1ef2454..63bc2ae 100644
16831 ---- a/sound/soc/codecs/wm8940.c
16832 -+++ b/sound/soc/codecs/wm8940.c
16833 -@@ -379,23 +379,23 @@ static int wm8940_i2s_hw_params(struct snd_pcm_substream *substream,
16834 - iface |= (1 << 9);
16835 -
16836 - switch (params_rate(params)) {
16837 -- case SNDRV_PCM_RATE_8000:
16838 -+ case 8000:
16839 - addcntrl |= (0x5 << 1);
16840 - break;
16841 -- case SNDRV_PCM_RATE_11025:
16842 -+ case 11025:
16843 - addcntrl |= (0x4 << 1);
16844 - break;
16845 -- case SNDRV_PCM_RATE_16000:
16846 -+ case 16000:
16847 - addcntrl |= (0x3 << 1);
16848 - break;
16849 -- case SNDRV_PCM_RATE_22050:
16850 -+ case 22050:
16851 - addcntrl |= (0x2 << 1);
16852 - break;
16853 -- case SNDRV_PCM_RATE_32000:
16854 -+ case 32000:
16855 - addcntrl |= (0x1 << 1);
16856 - break;
16857 -- case SNDRV_PCM_RATE_44100:
16858 -- case SNDRV_PCM_RATE_48000:
16859 -+ case 44100:
16860 -+ case 48000:
16861 - break;
16862 - }
16863 - ret = snd_soc_write(codec, WM8940_ADDCNTRL, addcntrl);
16864 -diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c
16865 -index b0bd1c0..0dbf6fe 100644
16866 ---- a/sound/soc/codecs/wm8974.c
16867 -+++ b/sound/soc/codecs/wm8974.c
16868 -@@ -480,23 +480,23 @@ static int wm8974_pcm_hw_params(struct snd_pcm_substream *substream,
16869 -
16870 - /* filter coefficient */
16871 - switch (params_rate(params)) {
16872 -- case SNDRV_PCM_RATE_8000:
16873 -+ case 8000:
16874 - adn |= 0x5 << 1;
16875 - break;
16876 -- case SNDRV_PCM_RATE_11025:
16877 -+ case 11025:
16878 - adn |= 0x4 << 1;
16879 - break;
16880 -- case SNDRV_PCM_RATE_16000:
16881 -+ case 16000:
16882 - adn |= 0x3 << 1;
16883 - break;
16884 -- case SNDRV_PCM_RATE_22050:
16885 -+ case 22050:
16886 - adn |= 0x2 << 1;
16887 - break;
16888 -- case SNDRV_PCM_RATE_32000:
16889 -+ case 32000:
16890 - adn |= 0x1 << 1;
16891 - break;
16892 -- case SNDRV_PCM_RATE_44100:
16893 -- case SNDRV_PCM_RATE_48000:
16894 -+ case 44100:
16895 -+ case 48000:
16896 - break;
16897 - }
16898 -
16899
16900 Deleted: genpatches-2.6/trunk/2.6.33/1004_linux-2.6.32.5.patch
16901 ===================================================================
16902 --- genpatches-2.6/trunk/2.6.33/1004_linux-2.6.32.5.patch 2010-02-18 15:55:49 UTC (rev 1673)
16903 +++ genpatches-2.6/trunk/2.6.33/1004_linux-2.6.32.5.patch 2010-02-18 15:58:13 UTC (rev 1674)
16904 @@ -1,1019 +0,0 @@
16905 -diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
16906 -index e8dfdbd..cadbed6 100644
16907 ---- a/arch/powerpc/kernel/pci-common.c
16908 -+++ b/arch/powerpc/kernel/pci-common.c
16909 -@@ -1107,6 +1107,12 @@ void __devinit pcibios_setup_bus_devices(struct pci_bus *bus)
16910 - list_for_each_entry(dev, &bus->devices, bus_list) {
16911 - struct dev_archdata *sd = &dev->dev.archdata;
16912 -
16913 -+ /* Cardbus can call us to add new devices to a bus, so ignore
16914 -+ * those who are already fully discovered
16915 -+ */
16916 -+ if (dev->is_added)
16917 -+ continue;
16918 -+
16919 - /* Setup OF node pointer in archdata */
16920 - sd->of_node = pci_device_to_OF_node(dev);
16921 -
16922 -@@ -1147,6 +1153,13 @@ void __devinit pcibios_fixup_bus(struct pci_bus *bus)
16923 - }
16924 - EXPORT_SYMBOL(pcibios_fixup_bus);
16925 -
16926 -+void __devinit pci_fixup_cardbus(struct pci_bus *bus)
16927 -+{
16928 -+ /* Now fixup devices on that bus */
16929 -+ pcibios_setup_bus_devices(bus);
16930 -+}
16931 -+
16932 -+
16933 - static int skip_isa_ioresource_align(struct pci_dev *dev)
16934 - {
16935 - if ((ppc_pci_flags & PPC_PCI_CAN_SKIP_ISA_ALIGN) &&
16936 -diff --git a/arch/sparc/kernel/nmi.c b/arch/sparc/kernel/nmi.c
16937 -index b129611..4771274 100644
16938 ---- a/arch/sparc/kernel/nmi.c
16939 -+++ b/arch/sparc/kernel/nmi.c
16940 -@@ -96,7 +96,6 @@ notrace __kprobes void perfctr_irq(int irq, struct pt_regs *regs)
16941 - int cpu = smp_processor_id();
16942 -
16943 - clear_softint(1 << irq);
16944 -- pcr_ops->write(PCR_PIC_PRIV);
16945 -
16946 - local_cpu_data().__nmi_count++;
16947 -
16948 -@@ -105,6 +104,8 @@ notrace __kprobes void perfctr_irq(int irq, struct pt_regs *regs)
16949 - if (notify_die(DIE_NMI, "nmi", regs, 0,
16950 - pt_regs_trap_type(regs), SIGINT) == NOTIFY_STOP)
16951 - touched = 1;
16952 -+ else
16953 -+ pcr_ops->write(PCR_PIC_PRIV);
16954 -
16955 - sum = kstat_irqs_cpu(0, cpu);
16956 - if (__get_cpu_var(nmi_touch)) {
16957 -diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
16958 -index fa5936e..198fb4e 100644
16959 ---- a/arch/sparc/kernel/perf_event.c
16960 -+++ b/arch/sparc/kernel/perf_event.c
16961 -@@ -986,6 +986,17 @@ static int __kprobes perf_event_nmi_handler(struct notifier_block *self,
16962 - data.addr = 0;
16963 -
16964 - cpuc = &__get_cpu_var(cpu_hw_events);
16965 -+
16966 -+ /* If the PMU has the TOE IRQ enable bits, we need to do a
16967 -+ * dummy write to the %pcr to clear the overflow bits and thus
16968 -+ * the interrupt.
16969 -+ *
16970 -+ * Do this before we peek at the counters to determine
16971 -+ * overflow so we don't lose any events.
16972 -+ */
16973 -+ if (sparc_pmu->irq_bit)
16974 -+ pcr_ops->write(cpuc->pcr);
16975 -+
16976 - for (idx = 0; idx < MAX_HWEVENTS; idx++) {
16977 - struct perf_event *event = cpuc->events[idx];
16978 - struct hw_perf_event *hwc;
16979 -diff --git a/arch/x86/kernel/apic/apic_flat_64.c b/arch/x86/kernel/apic/apic_flat_64.c
16980 -index d0c99ab..873f81f 100644
16981 ---- a/arch/x86/kernel/apic/apic_flat_64.c
16982 -+++ b/arch/x86/kernel/apic/apic_flat_64.c
16983 -@@ -240,6 +240,11 @@ static int physflat_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
16984 - printk(KERN_DEBUG "system APIC only can use physical flat");
16985 - return 1;
16986 - }
16987 -+
16988 -+ if (!strncmp(oem_id, "IBM", 3) && !strncmp(oem_table_id, "EXA", 3)) {
16989 -+ printk(KERN_DEBUG "IBM Summit detected, will use apic physical");
16990 -+ return 1;
16991 -+ }
16992 - #endif
16993 -
16994 - return 0;
16995 -diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
16996 -index 2ab3535..9ee87cf 100644
16997 ---- a/arch/x86/kernel/apic/x2apic_uv_x.c
16998 -+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
16999 -@@ -364,13 +364,13 @@ static __init void get_lowmem_redirect(unsigned long *base, unsigned long *size)
17000 -
17001 - enum map_type {map_wb, map_uc};
17002 -
17003 --static __init void map_high(char *id, unsigned long base, int shift,
17004 -- int max_pnode, enum map_type map_type)
17005 -+static __init void map_high(char *id, unsigned long base, int pshift,
17006 -+ int bshift, int max_pnode, enum map_type map_type)
17007 - {
17008 - unsigned long bytes, paddr;
17009 -
17010 -- paddr = base << shift;
17011 -- bytes = (1UL << shift) * (max_pnode + 1);
17012 -+ paddr = base << pshift;
17013 -+ bytes = (1UL << bshift) * (max_pnode + 1);
17014 - printk(KERN_INFO "UV: Map %s_HI 0x%lx - 0x%lx\n", id, paddr,
17015 - paddr + bytes);
17016 - if (map_type == map_uc)
17017 -@@ -386,7 +386,7 @@ static __init void map_gru_high(int max_pnode)
17018 -
17019 - gru.v = uv_read_local_mmr(UVH_RH_GAM_GRU_OVERLAY_CONFIG_MMR);
17020 - if (gru.s.enable)
17021 -- map_high("GRU", gru.s.base, shift, max_pnode, map_wb);
17022 -+ map_high("GRU", gru.s.base, shift, shift, max_pnode, map_wb);
17023 - }
17024 -
17025 - static __init void map_mmr_high(int max_pnode)
17026 -@@ -396,7 +396,7 @@ static __init void map_mmr_high(int max_pnode)
17027 -
17028 - mmr.v = uv_read_local_mmr(UVH_RH_GAM_MMR_OVERLAY_CONFIG_MMR);
17029 - if (mmr.s.enable)
17030 -- map_high("MMR", mmr.s.base, shift, max_pnode, map_uc);
17031 -+ map_high("MMR", mmr.s.base, shift, shift, max_pnode, map_uc);
17032 - }
17033 -
17034 - static __init void map_mmioh_high(int max_pnode)
17035 -@@ -406,7 +406,8 @@ static __init void map_mmioh_high(int max_pnode)
17036 -
17037 - mmioh.v = uv_read_local_mmr(UVH_RH_GAM_MMIOH_OVERLAY_CONFIG_MMR);
17038 - if (mmioh.s.enable)
17039 -- map_high("MMIOH", mmioh.s.base, shift, max_pnode, map_uc);
17040 -+ map_high("MMIOH", mmioh.s.base, shift, mmioh.s.m_io,
17041 -+ max_pnode, map_uc);
17042 - }
17043 -
17044 - static __init void uv_rtc_init(void)
17045 -diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c
17046 -index 4fef985..687638e 100644
17047 ---- a/arch/x86/kernel/cpu/mcheck/therm_throt.c
17048 -+++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c
17049 -@@ -274,8 +274,9 @@ void intel_init_thermal(struct cpuinfo_x86 *c)
17050 - int tm2 = 0;
17051 - u32 l, h;
17052 -
17053 -- /* Thermal monitoring depends on ACPI and clock modulation*/
17054 -- if (!cpu_has(c, X86_FEATURE_ACPI) || !cpu_has(c, X86_FEATURE_ACC))
17055 -+ /* Thermal monitoring depends on APIC, ACPI and clock modulation */
17056 -+ if (!cpu_has_apic || !cpu_has(c, X86_FEATURE_ACPI) ||
17057 -+ !cpu_has(c, X86_FEATURE_ACC))
17058 - return;
17059 -
17060 - /*
17061 -diff --git a/drivers/edac/i5000_edac.c b/drivers/edac/i5000_edac.c
17062 -index 77a9579..adc10a2 100644
17063 ---- a/drivers/edac/i5000_edac.c
17064 -+++ b/drivers/edac/i5000_edac.c
17065 -@@ -577,7 +577,13 @@ static void i5000_process_nonfatal_error_info(struct mem_ctl_info *mci,
17066 - debugf0("\tUncorrected bits= 0x%x\n", ue_errors);
17067 -
17068 - branch = EXTRACT_FBDCHAN_INDX(info->ferr_nf_fbd);
17069 -- channel = branch;
17070 -+
17071 -+ /*
17072 -+ * According with i5000 datasheet, bit 28 has no significance
17073 -+ * for errors M4Err-M12Err and M17Err-M21Err, on FERR_NF_FBD
17074 -+ */
17075 -+ channel = branch & 2;
17076 -+
17077 - bank = NREC_BANK(info->nrecmema);
17078 - rank = NREC_RANK(info->nrecmema);
17079 - rdwr = NREC_RDWR(info->nrecmema);
17080 -diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
17081 -index aa7fd82..7d1357e 100644
17082 ---- a/drivers/gpu/drm/i915/i915_irq.c
17083 -+++ b/drivers/gpu/drm/i915/i915_irq.c
17084 -@@ -255,7 +255,6 @@ irqreturn_t igdng_irq_handler(struct drm_device *dev)
17085 - drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
17086 - int ret = IRQ_NONE;
17087 - u32 de_iir, gt_iir, de_ier;
17088 -- u32 new_de_iir, new_gt_iir;
17089 - struct drm_i915_master_private *master_priv;
17090 -
17091 - /* disable master interrupt before clearing iir */
17092 -@@ -266,35 +265,29 @@ irqreturn_t igdng_irq_handler(struct drm_device *dev)
17093 - de_iir = I915_READ(DEIIR);
17094 - gt_iir = I915_READ(GTIIR);
17095 -
17096 -- for (;;) {
17097 -- if (de_iir == 0 && gt_iir == 0)
17098 -- break;
17099 --
17100 -- ret = IRQ_HANDLED;
17101 --
17102 -- I915_WRITE(DEIIR, de_iir);
17103 -- new_de_iir = I915_READ(DEIIR);
17104 -- I915_WRITE(GTIIR, gt_iir);
17105 -- new_gt_iir = I915_READ(GTIIR);
17106 -+ if (de_iir == 0 && gt_iir == 0)
17107 -+ goto done;
17108 -
17109 -- if (dev->primary->master) {
17110 -- master_priv = dev->primary->master->driver_priv;
17111 -- if (master_priv->sarea_priv)
17112 -- master_priv->sarea_priv->last_dispatch =
17113 -- READ_BREADCRUMB(dev_priv);
17114 -- }
17115 -+ ret = IRQ_HANDLED;
17116 -
17117 -- if (gt_iir & GT_USER_INTERRUPT) {
17118 -- u32 seqno = i915_get_gem_seqno(dev);
17119 -- dev_priv->mm.irq_gem_seqno = seqno;
17120 -- trace_i915_gem_request_complete(dev, seqno);
17121 -- DRM_WAKEUP(&dev_priv->irq_queue);
17122 -- }
17123 -+ if (dev->primary->master) {
17124 -+ master_priv = dev->primary->master->driver_priv;
17125 -+ if (master_priv->sarea_priv)
17126 -+ master_priv->sarea_priv->last_dispatch =
17127 -+ READ_BREADCRUMB(dev_priv);
17128 -+ }
17129 -
17130 -- de_iir = new_de_iir;
17131 -- gt_iir = new_gt_iir;
17132 -+ if (gt_iir & GT_USER_INTERRUPT) {
17133 -+ u32 seqno = i915_get_gem_seqno(dev);
17134 -+ dev_priv->mm.irq_gem_seqno = seqno;
17135 -+ trace_i915_gem_request_complete(dev, seqno);
17136 -+ DRM_WAKEUP(&dev_priv->irq_queue);
17137 - }
17138 -
17139 -+ I915_WRITE(GTIIR, gt_iir);
17140 -+ I915_WRITE(DEIIR, de_iir);
17141 -+
17142 -+done:
17143 - I915_WRITE(DEIER, de_ier);
17144 - (void)I915_READ(DEIER);
17145 -
17146 -diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
17147 -index 4b96e7a..5b4d66d 100644
17148 ---- a/drivers/hid/hid-apple.c
17149 -+++ b/drivers/hid/hid-apple.c
17150 -@@ -431,6 +431,13 @@ static const struct hid_device_id apple_devices[] = {
17151 - .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
17152 - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS),
17153 - .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
17154 -+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI),
17155 -+ .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
17156 -+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO),
17157 -+ .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
17158 -+ APPLE_ISO_KEYBOARD },
17159 -+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS),
17160 -+ .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
17161 - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY),
17162 - .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
17163 - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY),
17164 -diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
17165 -index 7d05c4b..9678354 100644
17166 ---- a/drivers/hid/hid-core.c
17167 -+++ b/drivers/hid/hid-core.c
17168 -@@ -1287,6 +1287,9 @@ static const struct hid_device_id hid_blacklist[] = {
17169 - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI) },
17170 - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_ISO) },
17171 - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING3_JIS) },
17172 -+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) },
17173 -+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) },
17174 -+ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) },
17175 - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
17176 - { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
17177 - { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) },
17178 -diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
17179 -index adbef5d..e380e7b 100644
17180 ---- a/drivers/hid/hid-ids.h
17181 -+++ b/drivers/hid/hid-ids.h
17182 -@@ -88,6 +88,9 @@
17183 - #define USB_DEVICE_ID_APPLE_WELLSPRING3_ANSI 0x0236
17184 - #define USB_DEVICE_ID_APPLE_WELLSPRING3_ISO 0x0237
17185 - #define USB_DEVICE_ID_APPLE_WELLSPRING3_JIS 0x0238
17186 -+#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI 0x0239
17187 -+#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO 0x023a
17188 -+#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b
17189 - #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY 0x030a
17190 - #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY 0x030b
17191 - #define USB_DEVICE_ID_APPLE_ATV_IRCONTROL 0x8241
17192 -diff --git a/drivers/i2c/busses/i2c-pca-isa.c b/drivers/i2c/busses/i2c-pca-isa.c
17193 -index 0ed68e2..f7346a9 100644
17194 ---- a/drivers/i2c/busses/i2c-pca-isa.c
17195 -+++ b/drivers/i2c/busses/i2c-pca-isa.c
17196 -@@ -75,7 +75,7 @@ static int pca_isa_waitforcompletion(void *pd)
17197 - unsigned long timeout;
17198 -
17199 - if (irq > -1) {
17200 -- ret = wait_event_interruptible_timeout(pca_wait,
17201 -+ ret = wait_event_timeout(pca_wait,
17202 - pca_isa_readbyte(pd, I2C_PCA_CON)
17203 - & I2C_PCA_CON_SI, pca_isa_ops.timeout);
17204 - } else {
17205 -@@ -96,7 +96,7 @@ static void pca_isa_resetchip(void *pd)
17206 - }
17207 -
17208 - static irqreturn_t pca_handler(int this_irq, void *dev_id) {
17209 -- wake_up_interruptible(&pca_wait);
17210 -+ wake_up(&pca_wait);
17211 - return IRQ_HANDLED;
17212 - }
17213 -
17214 -diff --git a/drivers/i2c/busses/i2c-pca-platform.c b/drivers/i2c/busses/i2c-pca-platform.c
17215 -index c4df9d4..5b2213d 100644
17216 ---- a/drivers/i2c/busses/i2c-pca-platform.c
17217 -+++ b/drivers/i2c/busses/i2c-pca-platform.c
17218 -@@ -84,7 +84,7 @@ static int i2c_pca_pf_waitforcompletion(void *pd)
17219 - unsigned long timeout;
17220 -
17221 - if (i2c->irq) {
17222 -- ret = wait_event_interruptible_timeout(i2c->wait,
17223 -+ ret = wait_event_timeout(i2c->wait,
17224 - i2c->algo_data.read_byte(i2c, I2C_PCA_CON)
17225 - & I2C_PCA_CON_SI, i2c->adap.timeout);
17226 - } else {
17227 -@@ -122,7 +122,7 @@ static irqreturn_t i2c_pca_pf_handler(int this_irq, void *dev_id)
17228 - if ((i2c->algo_data.read_byte(i2c, I2C_PCA_CON) & I2C_PCA_CON_SI) == 0)
17229 - return IRQ_NONE;
17230 -
17231 -- wake_up_interruptible(&i2c->wait);
17232 -+ wake_up(&i2c->wait);
17233 -
17234 - return IRQ_HANDLED;
17235 - }
17236 -diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
17237 -index 2965043..3bf7b0a 100644
17238 ---- a/drivers/i2c/i2c-core.c
17239 -+++ b/drivers/i2c/i2c-core.c
17240 -@@ -801,6 +801,9 @@ int i2c_del_adapter(struct i2c_adapter *adap)
17241 - adap->dev.parent);
17242 - #endif
17243 -
17244 -+ /* device name is gone after device_unregister */
17245 -+ dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name);
17246 -+
17247 - /* clean up the sysfs representation */
17248 - init_completion(&adap->dev_released);
17249 - device_unregister(&adap->dev);
17250 -@@ -813,8 +816,6 @@ int i2c_del_adapter(struct i2c_adapter *adap)
17251 - idr_remove(&i2c_adapter_idr, adap->nr);
17252 - mutex_unlock(&core_lock);
17253 -
17254 -- dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name);
17255 --
17256 - /* Clear the device structure in case this adapter is ever going to be
17257 - added again */
17258 - memset(&adap->dev, 0, sizeof(adap->dev));
17259 -diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
17260 -index 07c5379..0876d82 100644
17261 ---- a/drivers/input/mouse/psmouse-base.c
17262 -+++ b/drivers/input/mouse/psmouse-base.c
17263 -@@ -667,19 +667,6 @@ static int psmouse_extensions(struct psmouse *psmouse,
17264 - max_proto = PSMOUSE_IMEX;
17265 - }
17266 -
17267 --/*
17268 -- * Try Finger Sensing Pad
17269 -- */
17270 -- if (max_proto > PSMOUSE_IMEX) {
17271 -- if (fsp_detect(psmouse, set_properties) == 0) {
17272 -- if (!set_properties || fsp_init(psmouse) == 0)
17273 -- return PSMOUSE_FSP;
17274 --/*
17275 -- * Init failed, try basic relative protocols
17276 -- */
17277 -- max_proto = PSMOUSE_IMEX;
17278 -- }
17279 -- }
17280 -
17281 - if (max_proto > PSMOUSE_IMEX) {
17282 - if (genius_detect(psmouse, set_properties) == 0)
17283 -@@ -696,6 +683,21 @@ static int psmouse_extensions(struct psmouse *psmouse,
17284 - }
17285 -
17286 - /*
17287 -+ * Try Finger Sensing Pad. We do it here because its probe upsets
17288 -+ * Trackpoint devices (causing TP_READ_ID command to time out).
17289 -+ */
17290 -+ if (max_proto > PSMOUSE_IMEX) {
17291 -+ if (fsp_detect(psmouse, set_properties) == 0) {
17292 -+ if (!set_properties || fsp_init(psmouse) == 0)
17293 -+ return PSMOUSE_FSP;
17294 -+/*
17295 -+ * Init failed, try basic relative protocols
17296 -+ */
17297 -+ max_proto = PSMOUSE_IMEX;
17298 -+ }
17299 -+ }
17300 -+
17301 -+/*
17302 - * Reset to defaults in case the device got confused by extended
17303 - * protocol probes. Note that we follow up with full reset because
17304 - * some mice put themselves to sleep when they see PSMOUSE_RESET_DIS.
17305 -diff --git a/drivers/media/video/gspca/sn9c20x.c b/drivers/media/video/gspca/sn9c20x.c
17306 -index cdad3db..e0a3b75 100644
17307 ---- a/drivers/media/video/gspca/sn9c20x.c
17308 -+++ b/drivers/media/video/gspca/sn9c20x.c
17309 -@@ -2319,7 +2319,7 @@ static void do_autogain(struct gspca_dev *gspca_dev, u16 avg_lum)
17310 - }
17311 - }
17312 - if (avg_lum > MAX_AVG_LUM) {
17313 -- if (sd->gain - 1 >= 0) {
17314 -+ if (sd->gain >= 1) {
17315 - sd->gain--;
17316 - set_gain(gspca_dev);
17317 - }
17318 -diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c
17319 -index ba27c9d..ca6b098 100644
17320 ---- a/drivers/mfd/wm8350-core.c
17321 -+++ b/drivers/mfd/wm8350-core.c
17322 -@@ -134,8 +134,7 @@ static inline int is_reg_locked(struct wm8350 *wm8350, u8 reg)
17323 - wm8350->reg_cache[WM8350_SECURITY] == WM8350_UNLOCK_KEY)
17324 - return 0;
17325 -
17326 -- if ((reg == WM8350_GPIO_CONFIGURATION_I_O) ||
17327 -- (reg >= WM8350_GPIO_FUNCTION_SELECT_1 &&
17328 -+ if ((reg >= WM8350_GPIO_FUNCTION_SELECT_1 &&
17329 - reg <= WM8350_GPIO_FUNCTION_SELECT_4) ||
17330 - (reg >= WM8350_BATTERY_CHARGER_CONTROL_1 &&
17331 - reg <= WM8350_BATTERY_CHARGER_CONTROL_3))
17332 -diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
17333 -index 4e4c295..6477722 100644
17334 ---- a/drivers/pci/pci.c
17335 -+++ b/drivers/pci/pci.c
17336 -@@ -2723,6 +2723,11 @@ int __attribute__ ((weak)) pci_ext_cfg_avail(struct pci_dev *dev)
17337 - return 1;
17338 - }
17339 -
17340 -+void __weak pci_fixup_cardbus(struct pci_bus *bus)
17341 -+{
17342 -+}
17343 -+EXPORT_SYMBOL(pci_fixup_cardbus);
17344 -+
17345 - static int __init pci_setup(char *str)
17346 - {
17347 - while (str) {
17348 -diff --git a/drivers/pcmcia/cardbus.c b/drivers/pcmcia/cardbus.c
17349 -index db77e1f..5c26793 100644
17350 ---- a/drivers/pcmcia/cardbus.c
17351 -+++ b/drivers/pcmcia/cardbus.c
17352 -@@ -214,7 +214,7 @@ int __ref cb_alloc(struct pcmcia_socket * s)
17353 - unsigned int max, pass;
17354 -
17355 - s->functions = pci_scan_slot(bus, PCI_DEVFN(0, 0));
17356 --// pcibios_fixup_bus(bus);
17357 -+ pci_fixup_cardbus(bus);
17358 -
17359 - max = bus->secondary;
17360 - for (pass = 0; pass < 2; pass++)
17361 -diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c
17362 -index 849359a..767cb61 100644
17363 ---- a/drivers/platform/x86/asus-laptop.c
17364 -+++ b/drivers/platform/x86/asus-laptop.c
17365 -@@ -221,6 +221,7 @@ static struct asus_hotk *hotk;
17366 - */
17367 - static const struct acpi_device_id asus_device_ids[] = {
17368 - {"ATK0100", 0},
17369 -+ {"ATK0101", 0},
17370 - {"", 0},
17371 - };
17372 - MODULE_DEVICE_TABLE(acpi, asus_device_ids);
17373 -@@ -293,6 +294,11 @@ struct key_entry {
17374 - enum { KE_KEY, KE_END };
17375 -
17376 - static struct key_entry asus_keymap[] = {
17377 -+ {KE_KEY, 0x02, KEY_SCREENLOCK},
17378 -+ {KE_KEY, 0x05, KEY_WLAN},
17379 -+ {KE_KEY, 0x08, BTN_TOUCH},
17380 -+ {KE_KEY, 0x17, KEY_ZOOM},
17381 -+ {KE_KEY, 0x1f, KEY_BATTERY},
17382 - {KE_KEY, 0x30, KEY_VOLUMEUP},
17383 - {KE_KEY, 0x31, KEY_VOLUMEDOWN},
17384 - {KE_KEY, 0x32, KEY_MUTE},
17385 -@@ -312,6 +318,8 @@ static struct key_entry asus_keymap[] = {
17386 - {KE_KEY, 0x5F, KEY_WLAN},
17387 - {KE_KEY, 0x60, KEY_SWITCHVIDEOMODE},
17388 - {KE_KEY, 0x61, KEY_SWITCHVIDEOMODE},
17389 -+ {KE_KEY, 0x62, KEY_SWITCHVIDEOMODE},
17390 -+ {KE_KEY, 0x63, KEY_SWITCHVIDEOMODE},
17391 - {KE_KEY, 0x6B, BTN_TOUCH}, /* Lock Mouse */
17392 - {KE_KEY, 0x82, KEY_CAMERA},
17393 - {KE_KEY, 0x8A, KEY_PROG1},
17394 -diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c
17395 -index 507ccc6..518712c 100644
17396 ---- a/drivers/scsi/megaraid/megaraid_sas.c
17397 -+++ b/drivers/scsi/megaraid/megaraid_sas.c
17398 -@@ -3451,7 +3451,7 @@ out:
17399 - return retval;
17400 - }
17401 -
17402 --static DRIVER_ATTR(poll_mode_io, S_IRUGO|S_IWUGO,
17403 -+static DRIVER_ATTR(poll_mode_io, S_IRUGO|S_IWUSR,
17404 - megasas_sysfs_show_poll_mode_io,
17405 - megasas_sysfs_set_poll_mode_io);
17406 -
17407 -diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c
17408 -index d71dfe3..0cce8a4 100644
17409 ---- a/drivers/serial/8250_pnp.c
17410 -+++ b/drivers/serial/8250_pnp.c
17411 -@@ -354,6 +354,8 @@ static const struct pnp_device_id pnp_dev_table[] = {
17412 - { "FUJ02E5", 0 },
17413 - /* Fujitsu P-series tablet PC device */
17414 - { "FUJ02E6", 0 },
17415 -+ /* Fujitsu Wacom 2FGT Tablet PC device */
17416 -+ { "FUJ02E7", 0 },
17417 - /*
17418 - * LG C1 EXPRESS DUAL (C1-PB11A3) touch screen (actually a FUJ02E6 in
17419 - * disguise)
17420 -diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
17421 -index adf9632..53cb722 100644
17422 ---- a/drivers/video/s3c-fb.c
17423 -+++ b/drivers/video/s3c-fb.c
17424 -@@ -211,21 +211,23 @@ static int s3c_fb_check_var(struct fb_var_screeninfo *var,
17425 -
17426 - /**
17427 - * s3c_fb_calc_pixclk() - calculate the divider to create the pixel clock.
17428 -- * @id: window id.
17429 - * @sfb: The hardware state.
17430 - * @pixclock: The pixel clock wanted, in picoseconds.
17431 - *
17432 - * Given the specified pixel clock, work out the necessary divider to get
17433 - * close to the output frequency.
17434 - */
17435 --static int s3c_fb_calc_pixclk(unsigned char id, struct s3c_fb *sfb, unsigned int pixclk)
17436 -+static int s3c_fb_calc_pixclk(struct s3c_fb *sfb, unsigned int pixclk)
17437 - {
17438 -- struct s3c_fb_pd_win *win = sfb->pdata->win[id];
17439 - unsigned long clk = clk_get_rate(sfb->bus_clk);
17440 -+ unsigned long long tmp;
17441 - unsigned int result;
17442 -
17443 -- pixclk *= win->win_mode.refresh;
17444 -- result = clk / pixclk;
17445 -+ tmp = (unsigned long long)clk;
17446 -+ tmp *= pixclk;
17447 -+
17448 -+ do_div(tmp, 1000000000UL);
17449 -+ result = (unsigned int)tmp / 1000;
17450 -
17451 - dev_dbg(sfb->dev, "pixclk=%u, clk=%lu, div=%d (%lu)\n",
17452 - pixclk, clk, result, clk / result);
17453 -@@ -301,7 +303,7 @@ static int s3c_fb_set_par(struct fb_info *info)
17454 - /* use window 0 as the basis for the lcd output timings */
17455 -
17456 - if (win_no == 0) {
17457 -- clkdiv = s3c_fb_calc_pixclk(win_no, sfb, var->pixclock);
17458 -+ clkdiv = s3c_fb_calc_pixclk(sfb, var->pixclock);
17459 -
17460 - data = sfb->pdata->vidcon0;
17461 - data &= ~(VIDCON0_CLKVAL_F_MASK | VIDCON0_CLKDIR);
17462 -diff --git a/fs/notify/inotify/inotify_fsnotify.c b/fs/notify/inotify/inotify_fsnotify.c
17463 -index c9ee67b..1afb0a1 100644
17464 ---- a/fs/notify/inotify/inotify_fsnotify.c
17465 -+++ b/fs/notify/inotify/inotify_fsnotify.c
17466 -@@ -121,7 +121,7 @@ static int idr_callback(int id, void *p, void *data)
17467 - if (warned)
17468 - return 0;
17469 -
17470 -- warned = false;
17471 -+ warned = true;
17472 - entry = p;
17473 - ientry = container_of(entry, struct inotify_inode_mark_entry, fsn_entry);
17474 -
17475 -diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
17476 -index dcd2040..ca44337 100644
17477 ---- a/fs/notify/inotify/inotify_user.c
17478 -+++ b/fs/notify/inotify/inotify_user.c
17479 -@@ -558,7 +558,7 @@ retry:
17480 -
17481 - spin_lock(&group->inotify_data.idr_lock);
17482 - ret = idr_get_new_above(&group->inotify_data.idr, &tmp_ientry->fsn_entry,
17483 -- group->inotify_data.last_wd,
17484 -+ group->inotify_data.last_wd+1,
17485 - &tmp_ientry->wd);
17486 - spin_unlock(&group->inotify_data.idr_lock);
17487 - if (ret) {
17488 -@@ -638,7 +638,7 @@ static struct fsnotify_group *inotify_new_group(struct user_struct *user, unsign
17489 -
17490 - spin_lock_init(&group->inotify_data.idr_lock);
17491 - idr_init(&group->inotify_data.idr);
17492 -- group->inotify_data.last_wd = 1;
17493 -+ group->inotify_data.last_wd = 0;
17494 - group->inotify_data.user = user;
17495 - group->inotify_data.fa = NULL;
17496 -
17497 -diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
17498 -index a14d6cd..d240c15 100644
17499 ---- a/fs/reiserfs/inode.c
17500 -+++ b/fs/reiserfs/inode.c
17501 -@@ -2531,6 +2531,12 @@ static int reiserfs_writepage(struct page *page, struct writeback_control *wbc)
17502 - return reiserfs_write_full_page(page, wbc);
17503 - }
17504 -
17505 -+static void reiserfs_truncate_failed_write(struct inode *inode)
17506 -+{
17507 -+ truncate_inode_pages(inode->i_mapping, inode->i_size);
17508 -+ reiserfs_truncate_file(inode, 0);
17509 -+}
17510 -+
17511 - static int reiserfs_write_begin(struct file *file,
17512 - struct address_space *mapping,
17513 - loff_t pos, unsigned len, unsigned flags,
17514 -@@ -2597,6 +2603,8 @@ static int reiserfs_write_begin(struct file *file,
17515 - if (ret) {
17516 - unlock_page(page);
17517 - page_cache_release(page);
17518 -+ /* Truncate allocated blocks */
17519 -+ reiserfs_truncate_failed_write(inode);
17520 - }
17521 - return ret;
17522 - }
17523 -@@ -2689,8 +2697,7 @@ static int reiserfs_write_end(struct file *file, struct address_space *mapping,
17524 - ** transaction tracking stuff when the size changes. So, we have
17525 - ** to do the i_size updates here.
17526 - */
17527 -- pos += copied;
17528 -- if (pos > inode->i_size) {
17529 -+ if (pos + copied > inode->i_size) {
17530 - struct reiserfs_transaction_handle myth;
17531 - reiserfs_write_lock(inode->i_sb);
17532 - /* If the file have grown beyond the border where it
17533 -@@ -2708,7 +2715,7 @@ static int reiserfs_write_end(struct file *file, struct address_space *mapping,
17534 - goto journal_error;
17535 - }
17536 - reiserfs_update_inode_transaction(inode);
17537 -- inode->i_size = pos;
17538 -+ inode->i_size = pos + copied;
17539 - /*
17540 - * this will just nest into our transaction. It's important
17541 - * to use mark_inode_dirty so the inode gets pushed around on the
17542 -@@ -2735,6 +2742,10 @@ static int reiserfs_write_end(struct file *file, struct address_space *mapping,
17543 - out:
17544 - unlock_page(page);
17545 - page_cache_release(page);
17546 -+
17547 -+ if (pos + len > inode->i_size)
17548 -+ reiserfs_truncate_failed_write(inode);
17549 -+
17550 - return ret == 0 ? copied : ret;
17551 -
17552 - journal_error:
17553 -diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
17554 -index 221cecd..adf99c6 100644
17555 ---- a/include/linux/blkdev.h
17556 -+++ b/include/linux/blkdev.h
17557 -@@ -1114,11 +1114,18 @@ static inline int queue_alignment_offset(struct request_queue *q)
17558 - return q->limits.alignment_offset;
17559 - }
17560 -
17561 -+static inline int queue_limit_alignment_offset(struct queue_limits *lim, sector_t offset)
17562 -+{
17563 -+ unsigned int granularity = max(lim->physical_block_size, lim->io_min);
17564 -+
17565 -+ offset &= granularity - 1;
17566 -+ return (granularity + lim->alignment_offset - offset) & (granularity - 1);
17567 -+}
17568 -+
17569 - static inline int queue_sector_alignment_offset(struct request_queue *q,
17570 - sector_t sector)
17571 - {
17572 -- return ((sector << 9) - q->limits.alignment_offset)
17573 -- & (q->limits.io_min - 1);
17574 -+ return queue_limit_alignment_offset(&q->limits, sector << 9);
17575 - }
17576 -
17577 - static inline int bdev_alignment_offset(struct block_device *bdev)
17578 -diff --git a/include/linux/mfd/wm8350/pmic.h b/include/linux/mfd/wm8350/pmic.h
17579 -index be3264e..e786fe9 100644
17580 ---- a/include/linux/mfd/wm8350/pmic.h
17581 -+++ b/include/linux/mfd/wm8350/pmic.h
17582 -@@ -666,20 +666,20 @@
17583 - #define WM8350_ISINK_FLASH_DUR_64MS (1 << 8)
17584 - #define WM8350_ISINK_FLASH_DUR_96MS (2 << 8)
17585 - #define WM8350_ISINK_FLASH_DUR_1024MS (3 << 8)
17586 --#define WM8350_ISINK_FLASH_ON_INSTANT (0 << 4)
17587 --#define WM8350_ISINK_FLASH_ON_0_25S (1 << 4)
17588 --#define WM8350_ISINK_FLASH_ON_0_50S (2 << 4)
17589 --#define WM8350_ISINK_FLASH_ON_1_00S (3 << 4)
17590 --#define WM8350_ISINK_FLASH_ON_1_95S (1 << 4)
17591 --#define WM8350_ISINK_FLASH_ON_3_91S (2 << 4)
17592 --#define WM8350_ISINK_FLASH_ON_7_80S (3 << 4)
17593 --#define WM8350_ISINK_FLASH_OFF_INSTANT (0 << 0)
17594 --#define WM8350_ISINK_FLASH_OFF_0_25S (1 << 0)
17595 --#define WM8350_ISINK_FLASH_OFF_0_50S (2 << 0)
17596 --#define WM8350_ISINK_FLASH_OFF_1_00S (3 << 0)
17597 --#define WM8350_ISINK_FLASH_OFF_1_95S (1 << 0)
17598 --#define WM8350_ISINK_FLASH_OFF_3_91S (2 << 0)
17599 --#define WM8350_ISINK_FLASH_OFF_7_80S (3 << 0)
17600 -+#define WM8350_ISINK_FLASH_ON_INSTANT (0 << 0)
17601 -+#define WM8350_ISINK_FLASH_ON_0_25S (1 << 0)
17602 -+#define WM8350_ISINK_FLASH_ON_0_50S (2 << 0)
17603 -+#define WM8350_ISINK_FLASH_ON_1_00S (3 << 0)
17604 -+#define WM8350_ISINK_FLASH_ON_1_95S (1 << 0)
17605 -+#define WM8350_ISINK_FLASH_ON_3_91S (2 << 0)
17606 -+#define WM8350_ISINK_FLASH_ON_7_80S (3 << 0)
17607 -+#define WM8350_ISINK_FLASH_OFF_INSTANT (0 << 4)
17608 -+#define WM8350_ISINK_FLASH_OFF_0_25S (1 << 4)
17609 -+#define WM8350_ISINK_FLASH_OFF_0_50S (2 << 4)
17610 -+#define WM8350_ISINK_FLASH_OFF_1_00S (3 << 4)
17611 -+#define WM8350_ISINK_FLASH_OFF_1_95S (1 << 4)
17612 -+#define WM8350_ISINK_FLASH_OFF_3_91S (2 << 4)
17613 -+#define WM8350_ISINK_FLASH_OFF_7_80S (3 << 4)
17614 -
17615 - /*
17616 - * Regulator Interrupts.
17617 -diff --git a/include/linux/pci.h b/include/linux/pci.h
17618 -index f5c7cd3..2547515 100644
17619 ---- a/include/linux/pci.h
17620 -+++ b/include/linux/pci.h
17621 -@@ -564,6 +564,9 @@ void pcibios_align_resource(void *, struct resource *, resource_size_t,
17622 - resource_size_t);
17623 - void pcibios_update_irq(struct pci_dev *, int irq);
17624 -
17625 -+/* Weak but can be overriden by arch */
17626 -+void pci_fixup_cardbus(struct pci_bus *);
17627 -+
17628 - /* Generic PCI functions used internally */
17629 -
17630 - extern struct pci_bus *pci_find_bus(int domain, int busnr);
17631 -diff --git a/kernel/futex.c b/kernel/futex.c
17632 -index d73ef1f..3b74909 100644
17633 ---- a/kernel/futex.c
17634 -+++ b/kernel/futex.c
17635 -@@ -203,8 +203,6 @@ static void drop_futex_key_refs(union futex_key *key)
17636 - * @uaddr: virtual address of the futex
17637 - * @fshared: 0 for a PROCESS_PRIVATE futex, 1 for PROCESS_SHARED
17638 - * @key: address where result is stored.
17639 -- * @rw: mapping needs to be read/write (values: VERIFY_READ,
17640 -- * VERIFY_WRITE)
17641 - *
17642 - * Returns a negative error code or 0
17643 - * The key words are stored in *key on success.
17644 -@@ -216,7 +214,7 @@ static void drop_futex_key_refs(union futex_key *key)
17645 - * lock_page() might sleep, the caller should not hold a spinlock.
17646 - */
17647 - static int
17648 --get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key, int rw)
17649 -+get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key)
17650 - {
17651 - unsigned long address = (unsigned long)uaddr;
17652 - struct mm_struct *mm = current->mm;
17653 -@@ -239,7 +237,7 @@ get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key, int rw)
17654 - * but access_ok() should be faster than find_vma()
17655 - */
17656 - if (!fshared) {
17657 -- if (unlikely(!access_ok(rw, uaddr, sizeof(u32))))
17658 -+ if (unlikely(!access_ok(VERIFY_WRITE, uaddr, sizeof(u32))))
17659 - return -EFAULT;
17660 - key->private.mm = mm;
17661 - key->private.address = address;
17662 -@@ -248,7 +246,7 @@ get_futex_key(u32 __user *uaddr, int fshared, union futex_key *key, int rw)
17663 - }
17664 -
17665 - again:
17666 -- err = get_user_pages_fast(address, 1, rw == VERIFY_WRITE, &page);
17667 -+ err = get_user_pages_fast(address, 1, 1, &page);
17668 - if (err < 0)
17669 - return err;
17670 -
17671 -@@ -867,7 +865,7 @@ static int futex_wake(u32 __user *uaddr, int fshared, int nr_wake, u32 bitset)
17672 - if (!bitset)
17673 - return -EINVAL;
17674 -
17675 -- ret = get_futex_key(uaddr, fshared, &key, VERIFY_READ);
17676 -+ ret = get_futex_key(uaddr, fshared, &key);
17677 - if (unlikely(ret != 0))
17678 - goto out;
17679 -
17680 -@@ -913,10 +911,10 @@ futex_wake_op(u32 __user *uaddr1, int fshared, u32 __user *uaddr2,
17681 - int ret, op_ret;
17682 -
17683 - retry:
17684 -- ret = get_futex_key(uaddr1, fshared, &key1, VERIFY_READ);
17685 -+ ret = get_futex_key(uaddr1, fshared, &key1);
17686 - if (unlikely(ret != 0))
17687 - goto out;
17688 -- ret = get_futex_key(uaddr2, fshared, &key2, VERIFY_WRITE);
17689 -+ ret = get_futex_key(uaddr2, fshared, &key2);
17690 - if (unlikely(ret != 0))
17691 - goto out_put_key1;
17692 -
17693 -@@ -1175,11 +1173,10 @@ retry:
17694 - pi_state = NULL;
17695 - }
17696 -
17697 -- ret = get_futex_key(uaddr1, fshared, &key1, VERIFY_READ);
17698 -+ ret = get_futex_key(uaddr1, fshared, &key1);
17699 - if (unlikely(ret != 0))
17700 - goto out;
17701 -- ret = get_futex_key(uaddr2, fshared, &key2,
17702 -- requeue_pi ? VERIFY_WRITE : VERIFY_READ);
17703 -+ ret = get_futex_key(uaddr2, fshared, &key2);
17704 - if (unlikely(ret != 0))
17705 - goto out_put_key1;
17706 -
17707 -@@ -1738,7 +1735,7 @@ static int futex_wait_setup(u32 __user *uaddr, u32 val, int fshared,
17708 - */
17709 - retry:
17710 - q->key = FUTEX_KEY_INIT;
17711 -- ret = get_futex_key(uaddr, fshared, &q->key, VERIFY_READ);
17712 -+ ret = get_futex_key(uaddr, fshared, &q->key);
17713 - if (unlikely(ret != 0))
17714 - return ret;
17715 -
17716 -@@ -1904,7 +1901,7 @@ static int futex_lock_pi(u32 __user *uaddr, int fshared,
17717 - q.requeue_pi_key = NULL;
17718 - retry:
17719 - q.key = FUTEX_KEY_INIT;
17720 -- ret = get_futex_key(uaddr, fshared, &q.key, VERIFY_WRITE);
17721 -+ ret = get_futex_key(uaddr, fshared, &q.key);
17722 - if (unlikely(ret != 0))
17723 - goto out;
17724 -
17725 -@@ -2023,7 +2020,7 @@ retry:
17726 - if ((uval & FUTEX_TID_MASK) != task_pid_vnr(current))
17727 - return -EPERM;
17728 -
17729 -- ret = get_futex_key(uaddr, fshared, &key, VERIFY_WRITE);
17730 -+ ret = get_futex_key(uaddr, fshared, &key);
17731 - if (unlikely(ret != 0))
17732 - goto out;
17733 -
17734 -@@ -2215,7 +2212,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, int fshared,
17735 - rt_waiter.task = NULL;
17736 -
17737 - key2 = FUTEX_KEY_INIT;
17738 -- ret = get_futex_key(uaddr2, fshared, &key2, VERIFY_WRITE);
17739 -+ ret = get_futex_key(uaddr2, fshared, &key2);
17740 - if (unlikely(ret != 0))
17741 - goto out;
17742 -
17743 -diff --git a/kernel/sched.c b/kernel/sched.c
17744 -index dd0dccd..bf841d8 100644
17745 ---- a/kernel/sched.c
17746 -+++ b/kernel/sched.c
17747 -@@ -3177,10 +3177,6 @@ static void pull_task(struct rq *src_rq, struct task_struct *p,
17748 - deactivate_task(src_rq, p, 0);
17749 - set_task_cpu(p, this_cpu);
17750 - activate_task(this_rq, p, 0);
17751 -- /*
17752 -- * Note that idle threads have a prio of MAX_PRIO, for this test
17753 -- * to be always true for them.
17754 -- */
17755 - check_preempt_curr(this_rq, p, 0);
17756 - }
17757 -
17758 -@@ -6982,7 +6978,6 @@ void __cpuinit init_idle(struct task_struct *idle, int cpu)
17759 - __sched_fork(idle);
17760 - idle->se.exec_start = sched_clock();
17761 -
17762 -- idle->prio = idle->normal_prio = MAX_PRIO;
17763 - cpumask_copy(&idle->cpus_allowed, cpumask_of(cpu));
17764 - __set_task_cpu(idle, cpu);
17765 -
17766 -@@ -7686,7 +7681,6 @@ migration_call(struct notifier_block *nfb, unsigned long action, void *hcpu)
17767 - spin_lock_irq(&rq->lock);
17768 - update_rq_clock(rq);
17769 - deactivate_task(rq, rq->idle, 0);
17770 -- rq->idle->static_prio = MAX_PRIO;
17771 - __setscheduler(rq, rq->idle, SCHED_NORMAL, 0);
17772 - rq->idle->sched_class = &idle_sched_class;
17773 - migrate_dead_tasks(cpu);
17774 -diff --git a/kernel/sched_clock.c b/kernel/sched_clock.c
17775 -index 479ce56..5b49613 100644
17776 ---- a/kernel/sched_clock.c
17777 -+++ b/kernel/sched_clock.c
17778 -@@ -236,6 +236,18 @@ void sched_clock_idle_wakeup_event(u64 delta_ns)
17779 - }
17780 - EXPORT_SYMBOL_GPL(sched_clock_idle_wakeup_event);
17781 -
17782 -+unsigned long long cpu_clock(int cpu)
17783 -+{
17784 -+ unsigned long long clock;
17785 -+ unsigned long flags;
17786 -+
17787 -+ local_irq_save(flags);
17788 -+ clock = sched_clock_cpu(cpu);
17789 -+ local_irq_restore(flags);
17790 -+
17791 -+ return clock;
17792 -+}
17793 -+
17794 - #else /* CONFIG_HAVE_UNSTABLE_SCHED_CLOCK */
17795 -
17796 - void sched_clock_init(void)
17797 -@@ -251,17 +263,12 @@ u64 sched_clock_cpu(int cpu)
17798 - return sched_clock();
17799 - }
17800 -
17801 --#endif /* CONFIG_HAVE_UNSTABLE_SCHED_CLOCK */
17802 -
17803 - unsigned long long cpu_clock(int cpu)
17804 - {
17805 -- unsigned long long clock;
17806 -- unsigned long flags;
17807 -+ return sched_clock_cpu(cpu);
17808 -+}
17809 -
17810 -- local_irq_save(flags);
17811 -- clock = sched_clock_cpu(cpu);
17812 -- local_irq_restore(flags);
17813 -+#endif /* CONFIG_HAVE_UNSTABLE_SCHED_CLOCK */
17814 -
17815 -- return clock;
17816 --}
17817 - EXPORT_SYMBOL_GPL(cpu_clock);
17818 -diff --git a/mm/memcontrol.c b/mm/memcontrol.c
17819 -index 5dc1037..66035bf 100644
17820 ---- a/mm/memcontrol.c
17821 -+++ b/mm/memcontrol.c
17822 -@@ -2381,7 +2381,7 @@ static int mem_cgroup_force_empty(struct mem_cgroup *mem, bool free_all)
17823 - if (free_all)
17824 - goto try_to_free;
17825 - move_account:
17826 -- while (mem->res.usage > 0) {
17827 -+ do {
17828 - ret = -EBUSY;
17829 - if (cgroup_task_count(cgrp) || !list_empty(&cgrp->children))
17830 - goto out;
17831 -@@ -2408,8 +2408,8 @@ move_account:
17832 - if (ret == -ENOMEM)
17833 - goto try_to_free;
17834 - cond_resched();
17835 -- }
17836 -- ret = 0;
17837 -+ /* "ret" should also be checked to ensure all lists are empty. */
17838 -+ } while (mem->res.usage > 0 || ret);
17839 - out:
17840 - css_put(&mem->css);
17841 - return ret;
17842 -@@ -2442,10 +2442,7 @@ try_to_free:
17843 - }
17844 - lru_add_drain();
17845 - /* try move_account...there may be some *locked* pages. */
17846 -- if (mem->res.usage)
17847 -- goto move_account;
17848 -- ret = 0;
17849 -- goto out;
17850 -+ goto move_account;
17851 - }
17852 -
17853 - int mem_cgroup_force_empty_write(struct cgroup *cont, unsigned int event)
17854 -diff --git a/mm/page_alloc.c b/mm/page_alloc.c
17855 -index 2bc2ac6..3a78e2e 100644
17856 ---- a/mm/page_alloc.c
17857 -+++ b/mm/page_alloc.c
17858 -@@ -1225,10 +1225,10 @@ again:
17859 - }
17860 - spin_lock_irqsave(&zone->lock, flags);
17861 - page = __rmqueue(zone, order, migratetype);
17862 -- __mod_zone_page_state(zone, NR_FREE_PAGES, -(1 << order));
17863 - spin_unlock(&zone->lock);
17864 - if (!page)
17865 - goto failed;
17866 -+ __mod_zone_page_state(zone, NR_FREE_PAGES, -(1 << order));
17867 - }
17868 -
17869 - __count_zone_vm_events(PGALLOC, zone, 1 << order);
17870 -diff --git a/mm/truncate.c b/mm/truncate.c
17871 -index 450cebd..258bda7 100644
17872 ---- a/mm/truncate.c
17873 -+++ b/mm/truncate.c
17874 -@@ -516,22 +516,20 @@ EXPORT_SYMBOL_GPL(invalidate_inode_pages2);
17875 - */
17876 - void truncate_pagecache(struct inode *inode, loff_t old, loff_t new)
17877 - {
17878 -- if (new < old) {
17879 -- struct address_space *mapping = inode->i_mapping;
17880 --
17881 -- /*
17882 -- * unmap_mapping_range is called twice, first simply for
17883 -- * efficiency so that truncate_inode_pages does fewer
17884 -- * single-page unmaps. However after this first call, and
17885 -- * before truncate_inode_pages finishes, it is possible for
17886 -- * private pages to be COWed, which remain after
17887 -- * truncate_inode_pages finishes, hence the second
17888 -- * unmap_mapping_range call must be made for correctness.
17889 -- */
17890 -- unmap_mapping_range(mapping, new + PAGE_SIZE - 1, 0, 1);
17891 -- truncate_inode_pages(mapping, new);
17892 -- unmap_mapping_range(mapping, new + PAGE_SIZE - 1, 0, 1);
17893 -- }
17894 -+ struct address_space *mapping = inode->i_mapping;
17895 -+
17896 -+ /*
17897 -+ * unmap_mapping_range is called twice, first simply for
17898 -+ * efficiency so that truncate_inode_pages does fewer
17899 -+ * single-page unmaps. However after this first call, and
17900 -+ * before truncate_inode_pages finishes, it is possible for
17901 -+ * private pages to be COWed, which remain after
17902 -+ * truncate_inode_pages finishes, hence the second
17903 -+ * unmap_mapping_range call must be made for correctness.
17904 -+ */
17905 -+ unmap_mapping_range(mapping, new + PAGE_SIZE - 1, 0, 1);
17906 -+ truncate_inode_pages(mapping, new);
17907 -+ unmap_mapping_range(mapping, new + PAGE_SIZE - 1, 0, 1);
17908 - }
17909 - EXPORT_SYMBOL(truncate_pagecache);
17910 -
17911 -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
17912 -index a4cb183..075c3a6 100644
17913 ---- a/sound/pci/hda/patch_realtek.c
17914 -+++ b/sound/pci/hda/patch_realtek.c
17915 -@@ -14685,6 +14685,8 @@ static int patch_alc861(struct hda_codec *codec)
17916 - spec->stream_digital_playback = &alc861_pcm_digital_playback;
17917 - spec->stream_digital_capture = &alc861_pcm_digital_capture;
17918 -
17919 -+ if (!spec->cap_mixer)
17920 -+ set_capture_mixer(codec);
17921 - set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
17922 -
17923 - spec->vmaster_nid = 0x03;
17924
17925 Deleted: genpatches-2.6/trunk/2.6.33/1005_linux-2.6.32.6.patch
17926 ===================================================================
17927 --- genpatches-2.6/trunk/2.6.33/1005_linux-2.6.32.6.patch 2010-02-18 15:55:49 UTC (rev 1673)
17928 +++ genpatches-2.6/trunk/2.6.33/1005_linux-2.6.32.6.patch 2010-02-18 15:58:13 UTC (rev 1674)
17929 @@ -1,1322 +0,0 @@
17930 -diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c
17931 -index 6a52d4b..f8590c5 100644
17932 ---- a/arch/x86/kernel/cpuid.c
17933 -+++ b/arch/x86/kernel/cpuid.c
17934 -@@ -192,7 +192,8 @@ static int __init cpuid_init(void)
17935 - int i, err = 0;
17936 - i = 0;
17937 -
17938 -- if (register_chrdev(CPUID_MAJOR, "cpu/cpuid", &cpuid_fops)) {
17939 -+ if (__register_chrdev(CPUID_MAJOR, 0, NR_CPUS,
17940 -+ "cpu/cpuid", &cpuid_fops)) {
17941 - printk(KERN_ERR "cpuid: unable to get major %d for cpuid\n",
17942 - CPUID_MAJOR);
17943 - err = -EBUSY;
17944 -@@ -221,7 +222,7 @@ out_class:
17945 - }
17946 - class_destroy(cpuid_class);
17947 - out_chrdev:
17948 -- unregister_chrdev(CPUID_MAJOR, "cpu/cpuid");
17949 -+ __unregister_chrdev(CPUID_MAJOR, 0, NR_CPUS, "cpu/cpuid");
17950 - out:
17951 - return err;
17952 - }
17953 -diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c
17954 -index 6a3cefc..b42e63b 100644
17955 ---- a/arch/x86/kernel/msr.c
17956 -+++ b/arch/x86/kernel/msr.c
17957 -@@ -251,7 +251,7 @@ static int __init msr_init(void)
17958 - int i, err = 0;
17959 - i = 0;
17960 -
17961 -- if (register_chrdev(MSR_MAJOR, "cpu/msr", &msr_fops)) {
17962 -+ if (__register_chrdev(MSR_MAJOR, 0, NR_CPUS, "cpu/msr", &msr_fops)) {
17963 - printk(KERN_ERR "msr: unable to get major %d for msr\n",
17964 - MSR_MAJOR);
17965 - err = -EBUSY;
17966 -@@ -279,7 +279,7 @@ out_class:
17967 - msr_device_destroy(i);
17968 - class_destroy(msr_class);
17969 - out_chrdev:
17970 -- unregister_chrdev(MSR_MAJOR, "cpu/msr");
17971 -+ __unregister_chrdev(MSR_MAJOR, 0, NR_CPUS, "cpu/msr");
17972 - out:
17973 - return err;
17974 - }
17975 -diff --git a/arch/x86/pci/i386.c b/arch/x86/pci/i386.c
17976 -index b22d13b..a672f12 100644
17977 ---- a/arch/x86/pci/i386.c
17978 -+++ b/arch/x86/pci/i386.c
17979 -@@ -282,6 +282,15 @@ int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
17980 - return -EINVAL;
17981 -
17982 - prot = pgprot_val(vma->vm_page_prot);
17983 -+
17984 -+ /*
17985 -+ * Return error if pat is not enabled and write_combine is requested.
17986 -+ * Caller can followup with UC MINUS request and add a WC mtrr if there
17987 -+ * is a free mtrr slot.
17988 -+ */
17989 -+ if (!pat_enabled && write_combine)
17990 -+ return -EINVAL;
17991 -+
17992 - if (pat_enabled && write_combine)
17993 - prot |= _PAGE_CACHE_WC;
17994 - else if (pat_enabled || boot_cpu_data.x86 > 3)
17995 -diff --git a/block/blk-settings.c b/block/blk-settings.c
17996 -index 66d4aa8..d5aa886 100644
17997 ---- a/block/blk-settings.c
17998 -+++ b/block/blk-settings.c
17999 -@@ -560,6 +560,28 @@ int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
18000 - EXPORT_SYMBOL(blk_stack_limits);
18001 -
18002 - /**
18003 -+ * bdev_stack_limits - adjust queue limits for stacked drivers
18004 -+ * @t: the stacking driver limits (top device)
18005 -+ * @bdev: the component block_device (bottom)
18006 -+ * @start: first data sector within component device
18007 -+ *
18008 -+ * Description:
18009 -+ * Merges queue limits for a top device and a block_device. Returns
18010 -+ * 0 if alignment didn't change. Returns -1 if adding the bottom
18011 -+ * device caused misalignment.
18012 -+ */
18013 -+int bdev_stack_limits(struct queue_limits *t, struct block_device *bdev,
18014 -+ sector_t start)
18015 -+{
18016 -+ struct request_queue *bq = bdev_get_queue(bdev);
18017 -+
18018 -+ start += get_start_sect(bdev);
18019 -+
18020 -+ return blk_stack_limits(t, &bq->limits, start << 9);
18021 -+}
18022 -+EXPORT_SYMBOL(bdev_stack_limits);
18023 -+
18024 -+/**
18025 - * disk_stack_limits - adjust queue limits for stacked drivers
18026 - * @disk: MD/DM gendisk (top)
18027 - * @bdev: the underlying block device (bottom)
18028 -diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
18029 -index 7511029..f1670e0 100644
18030 ---- a/drivers/acpi/ec.c
18031 -+++ b/drivers/acpi/ec.c
18032 -@@ -201,14 +201,13 @@ unlock:
18033 - spin_unlock_irqrestore(&ec->curr_lock, flags);
18034 - }
18035 -
18036 --static void acpi_ec_gpe_query(void *ec_cxt);
18037 -+static int acpi_ec_sync_query(struct acpi_ec *ec);
18038 -
18039 --static int ec_check_sci(struct acpi_ec *ec, u8 state)
18040 -+static int ec_check_sci_sync(struct acpi_ec *ec, u8 state)
18041 - {
18042 - if (state & ACPI_EC_FLAG_SCI) {
18043 - if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags))
18044 -- return acpi_os_execute(OSL_EC_BURST_HANDLER,
18045 -- acpi_ec_gpe_query, ec);
18046 -+ return acpi_ec_sync_query(ec);
18047 - }
18048 - return 0;
18049 - }
18050 -@@ -249,11 +248,6 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec,
18051 - {
18052 - unsigned long tmp;
18053 - int ret = 0;
18054 -- pr_debug(PREFIX "transaction start\n");
18055 -- /* disable GPE during transaction if storm is detected */
18056 -- if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) {
18057 -- acpi_disable_gpe(NULL, ec->gpe);
18058 -- }
18059 - if (EC_FLAGS_MSI)
18060 - udelay(ACPI_EC_MSI_UDELAY);
18061 - /* start transaction */
18062 -@@ -265,20 +259,9 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec,
18063 - clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags);
18064 - spin_unlock_irqrestore(&ec->curr_lock, tmp);
18065 - ret = ec_poll(ec);
18066 -- pr_debug(PREFIX "transaction end\n");
18067 - spin_lock_irqsave(&ec->curr_lock, tmp);
18068 - ec->curr = NULL;
18069 - spin_unlock_irqrestore(&ec->curr_lock, tmp);
18070 -- if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) {
18071 -- /* check if we received SCI during transaction */
18072 -- ec_check_sci(ec, acpi_ec_read_status(ec));
18073 -- /* it is safe to enable GPE outside of transaction */
18074 -- acpi_enable_gpe(NULL, ec->gpe);
18075 -- } else if (t->irq_count > ACPI_EC_STORM_THRESHOLD) {
18076 -- pr_info(PREFIX "GPE storm detected, "
18077 -- "transactions will use polling mode\n");
18078 -- set_bit(EC_FLAGS_GPE_STORM, &ec->flags);
18079 -- }
18080 - return ret;
18081 - }
18082 -
18083 -@@ -321,7 +304,26 @@ static int acpi_ec_transaction(struct acpi_ec *ec, struct transaction *t)
18084 - status = -ETIME;
18085 - goto end;
18086 - }
18087 -+ pr_debug(PREFIX "transaction start\n");
18088 -+ /* disable GPE during transaction if storm is detected */
18089 -+ if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) {
18090 -+ acpi_disable_gpe(NULL, ec->gpe);
18091 -+ }
18092 -+
18093 - status = acpi_ec_transaction_unlocked(ec, t);
18094 -+
18095 -+ /* check if we received SCI during transaction */
18096 -+ ec_check_sci_sync(ec, acpi_ec_read_status(ec));
18097 -+ if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) {
18098 -+ msleep(1);
18099 -+ /* it is safe to enable GPE outside of transaction */
18100 -+ acpi_enable_gpe(NULL, ec->gpe);
18101 -+ } else if (t->irq_count > ACPI_EC_STORM_THRESHOLD) {
18102 -+ pr_info(PREFIX "GPE storm detected, "
18103 -+ "transactions will use polling mode\n");
18104 -+ set_bit(EC_FLAGS_GPE_STORM, &ec->flags);
18105 -+ }
18106 -+ pr_debug(PREFIX "transaction end\n");
18107 - end:
18108 - if (ec->global_lock)
18109 - acpi_release_global_lock(glk);
18110 -@@ -443,7 +445,7 @@ int ec_transaction(u8 command,
18111 -
18112 - EXPORT_SYMBOL(ec_transaction);
18113 -
18114 --static int acpi_ec_query(struct acpi_ec *ec, u8 * data)
18115 -+static int acpi_ec_query_unlocked(struct acpi_ec *ec, u8 * data)
18116 - {
18117 - int result;
18118 - u8 d;
18119 -@@ -452,20 +454,16 @@ static int acpi_ec_query(struct acpi_ec *ec, u8 * data)
18120 - .wlen = 0, .rlen = 1};
18121 - if (!ec || !data)
18122 - return -EINVAL;
18123 --
18124 - /*
18125 - * Query the EC to find out which _Qxx method we need to evaluate.
18126 - * Note that successful completion of the query causes the ACPI_EC_SCI
18127 - * bit to be cleared (and thus clearing the interrupt source).
18128 - */
18129 --
18130 -- result = acpi_ec_transaction(ec, &t);
18131 -+ result = acpi_ec_transaction_unlocked(ec, &t);
18132 - if (result)
18133 - return result;
18134 --
18135 - if (!d)
18136 - return -ENODATA;
18137 --
18138 - *data = d;
18139 - return 0;
18140 - }
18141 -@@ -509,43 +507,78 @@ void acpi_ec_remove_query_handler(struct acpi_ec *ec, u8 query_bit)
18142 -
18143 - EXPORT_SYMBOL_GPL(acpi_ec_remove_query_handler);
18144 -
18145 --static void acpi_ec_gpe_query(void *ec_cxt)
18146 -+static void acpi_ec_run(void *cxt)
18147 - {
18148 -- struct acpi_ec *ec = ec_cxt;
18149 -- u8 value = 0;
18150 -- struct acpi_ec_query_handler *handler, copy;
18151 --
18152 -- if (!ec || acpi_ec_query(ec, &value))
18153 -+ struct acpi_ec_query_handler *handler = cxt;
18154 -+ if (!handler)
18155 - return;
18156 -- mutex_lock(&ec->lock);
18157 -+ pr_debug(PREFIX "start query execution\n");
18158 -+ if (handler->func)
18159 -+ handler->func(handler->data);
18160 -+ else if (handler->handle)
18161 -+ acpi_evaluate_object(handler->handle, NULL, NULL, NULL);
18162 -+ pr_debug(PREFIX "stop query execution\n");
18163 -+ kfree(handler);
18164 -+}
18165 -+
18166 -+static int acpi_ec_sync_query(struct acpi_ec *ec)
18167 -+{
18168 -+ u8 value = 0;
18169 -+ int status;
18170 -+ struct acpi_ec_query_handler *handler, *copy;
18171 -+ if ((status = acpi_ec_query_unlocked(ec, &value)))
18172 -+ return status;
18173 - list_for_each_entry(handler, &ec->list, node) {
18174 - if (value == handler->query_bit) {
18175 - /* have custom handler for this bit */
18176 -- memcpy(&copy, handler, sizeof(copy));
18177 -- mutex_unlock(&ec->lock);
18178 -- if (copy.func) {
18179 -- copy.func(copy.data);
18180 -- } else if (copy.handle) {
18181 -- acpi_evaluate_object(copy.handle, NULL, NULL, NULL);
18182 -- }
18183 -- return;
18184 -+ copy = kmalloc(sizeof(*handler), GFP_KERNEL);
18185 -+ if (!copy)
18186 -+ return -ENOMEM;
18187 -+ memcpy(copy, handler, sizeof(*copy));
18188 -+ pr_debug(PREFIX "push query execution (0x%2x) on queue\n", value);
18189 -+ return acpi_os_execute(OSL_GPE_HANDLER,
18190 -+ acpi_ec_run, copy);
18191 - }
18192 - }
18193 -+ return 0;
18194 -+}
18195 -+
18196 -+static void acpi_ec_gpe_query(void *ec_cxt)
18197 -+{
18198 -+ struct acpi_ec *ec = ec_cxt;
18199 -+ if (!ec)
18200 -+ return;
18201 -+ mutex_lock(&ec->lock);
18202 -+ acpi_ec_sync_query(ec);
18203 - mutex_unlock(&ec->lock);
18204 - }
18205 -
18206 -+static void acpi_ec_gpe_query(void *ec_cxt);
18207 -+
18208 -+static int ec_check_sci(struct acpi_ec *ec, u8 state)
18209 -+{
18210 -+ if (state & ACPI_EC_FLAG_SCI) {
18211 -+ if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) {
18212 -+ pr_debug(PREFIX "push gpe query to the queue\n");
18213 -+ return acpi_os_execute(OSL_NOTIFY_HANDLER,
18214 -+ acpi_ec_gpe_query, ec);
18215 -+ }
18216 -+ }
18217 -+ return 0;
18218 -+}
18219 -+
18220 - static u32 acpi_ec_gpe_handler(void *data)
18221 - {
18222 - struct acpi_ec *ec = data;
18223 -- u8 status;
18224 -
18225 - pr_debug(PREFIX "~~~> interrupt\n");
18226 -- status = acpi_ec_read_status(ec);
18227 -
18228 -- advance_transaction(ec, status);
18229 -- if (ec_transaction_done(ec) && (status & ACPI_EC_FLAG_IBF) == 0)
18230 -+ advance_transaction(ec, acpi_ec_read_status(ec));
18231 -+ if (ec_transaction_done(ec) &&
18232 -+ (acpi_ec_read_status(ec) & ACPI_EC_FLAG_IBF) == 0) {
18233 - wake_up(&ec->wait);
18234 -- ec_check_sci(ec, status);
18235 -+ ec_check_sci(ec, acpi_ec_read_status(ec));
18236 -+ }
18237 - return ACPI_INTERRUPT_HANDLED;
18238 - }
18239 -
18240 -diff --git a/drivers/char/nozomi.c b/drivers/char/nozomi.c
18241 -index d3400b2..dc52f75 100644
18242 ---- a/drivers/char/nozomi.c
18243 -+++ b/drivers/char/nozomi.c
18244 -@@ -1629,10 +1629,10 @@ static void ntty_close(struct tty_struct *tty, struct file *file)
18245 -
18246 - dc->open_ttys--;
18247 - port->count--;
18248 -- tty_port_tty_set(port, NULL);
18249 -
18250 - if (port->count == 0) {
18251 - DBG1("close: %d", nport->token_dl);
18252 -+ tty_port_tty_set(port, NULL);
18253 - spin_lock_irqsave(&dc->spin_mutex, flags);
18254 - dc->last_ier &= ~(nport->token_dl);
18255 - writew(dc->last_ier, dc->reg_ier);
18256 -diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
18257 -index 59499ee..e919bd9 100644
18258 ---- a/drivers/char/tty_io.c
18259 -+++ b/drivers/char/tty_io.c
18260 -@@ -1930,8 +1930,8 @@ static int tty_fasync(int fd, struct file *filp, int on)
18261 - pid = task_pid(current);
18262 - type = PIDTYPE_PID;
18263 - }
18264 -- spin_unlock_irqrestore(&tty->ctrl_lock, flags);
18265 - retval = __f_setown(filp, pid, type, 0);
18266 -+ spin_unlock_irqrestore(&tty->ctrl_lock, flags);
18267 - if (retval)
18268 - goto out;
18269 - } else {
18270 -diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
18271 -index 083bec2..29e21d3 100644
18272 ---- a/drivers/gpu/drm/i915/intel_sdvo.c
18273 -+++ b/drivers/gpu/drm/i915/intel_sdvo.c
18274 -@@ -472,14 +472,63 @@ static int intel_sdvo_get_pixel_multiplier(struct drm_display_mode *mode)
18275 - }
18276 -
18277 - /**
18278 -- * Don't check status code from this as it switches the bus back to the
18279 -- * SDVO chips which defeats the purpose of doing a bus switch in the first
18280 -- * place.
18281 -+ * Try to read the response after issuie the DDC switch command. But it
18282 -+ * is noted that we must do the action of reading response and issuing DDC
18283 -+ * switch command in one I2C transaction. Otherwise when we try to start
18284 -+ * another I2C transaction after issuing the DDC bus switch, it will be
18285 -+ * switched to the internal SDVO register.
18286 - */
18287 - static void intel_sdvo_set_control_bus_switch(struct intel_output *intel_output,
18288 - u8 target)
18289 - {
18290 -- intel_sdvo_write_cmd(intel_output, SDVO_CMD_SET_CONTROL_BUS_SWITCH, &target, 1);
18291 -+ struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv;
18292 -+ u8 out_buf[2], cmd_buf[2], ret_value[2], ret;
18293 -+ struct i2c_msg msgs[] = {
18294 -+ {
18295 -+ .addr = sdvo_priv->slave_addr >> 1,
18296 -+ .flags = 0,
18297 -+ .len = 2,
18298 -+ .buf = out_buf,
18299 -+ },
18300 -+ /* the following two are to read the response */
18301 -+ {
18302 -+ .addr = sdvo_priv->slave_addr >> 1,
18303 -+ .flags = 0,
18304 -+ .len = 1,
18305 -+ .buf = cmd_buf,
18306 -+ },
18307 -+ {
18308 -+ .addr = sdvo_priv->slave_addr >> 1,
18309 -+ .flags = I2C_M_RD,
18310 -+ .len = 1,
18311 -+ .buf = ret_value,
18312 -+ },
18313 -+ };
18314 -+
18315 -+ intel_sdvo_debug_write(intel_output, SDVO_CMD_SET_CONTROL_BUS_SWITCH,
18316 -+ &target, 1);
18317 -+ /* write the DDC switch command argument */
18318 -+ intel_sdvo_write_byte(intel_output, SDVO_I2C_ARG_0, target);
18319 -+
18320 -+ out_buf[0] = SDVO_I2C_OPCODE;
18321 -+ out_buf[1] = SDVO_CMD_SET_CONTROL_BUS_SWITCH;
18322 -+ cmd_buf[0] = SDVO_I2C_CMD_STATUS;
18323 -+ cmd_buf[1] = 0;
18324 -+ ret_value[0] = 0;
18325 -+ ret_value[1] = 0;
18326 -+
18327 -+ ret = i2c_transfer(intel_output->i2c_bus, msgs, 3);
18328 -+ if (ret != 3) {
18329 -+ /* failure in I2C transfer */
18330 -+ DRM_DEBUG_KMS("I2c transfer returned %d\n", ret);
18331 -+ return;
18332 -+ }
18333 -+ if (ret_value[0] != SDVO_CMD_STATUS_SUCCESS) {
18334 -+ DRM_DEBUG_KMS("DDC switch command returns response %d\n",
18335 -+ ret_value[0]);
18336 -+ return;
18337 -+ }
18338 -+ return;
18339 - }
18340 -
18341 - static bool intel_sdvo_set_target_input(struct intel_output *intel_output, bool target_0, bool target_1)
18342 -@@ -1589,6 +1638,32 @@ intel_sdvo_hdmi_sink_detect(struct drm_connector *connector, u16 response)
18343 - edid = drm_get_edid(&intel_output->base,
18344 - intel_output->ddc_bus);
18345 -
18346 -+ /* This is only applied to SDVO cards with multiple outputs */
18347 -+ if (edid == NULL && intel_sdvo_multifunc_encoder(intel_output)) {
18348 -+ uint8_t saved_ddc, temp_ddc;
18349 -+ saved_ddc = sdvo_priv->ddc_bus;
18350 -+ temp_ddc = sdvo_priv->ddc_bus >> 1;
18351 -+ /*
18352 -+ * Don't use the 1 as the argument of DDC bus switch to get
18353 -+ * the EDID. It is used for SDVO SPD ROM.
18354 -+ */
18355 -+ while(temp_ddc > 1) {
18356 -+ sdvo_priv->ddc_bus = temp_ddc;
18357 -+ edid = drm_get_edid(&intel_output->base,
18358 -+ intel_output->ddc_bus);
18359 -+ if (edid) {
18360 -+ /*
18361 -+ * When we can get the EDID, maybe it is the
18362 -+ * correct DDC bus. Update it.
18363 -+ */
18364 -+ sdvo_priv->ddc_bus = temp_ddc;
18365 -+ break;
18366 -+ }
18367 -+ temp_ddc >>= 1;
18368 -+ }
18369 -+ if (edid == NULL)
18370 -+ sdvo_priv->ddc_bus = saved_ddc;
18371 -+ }
18372 - /* when there is no edid and no monitor is connected with VGA
18373 - * port, try to use the CRT ddc to read the EDID for DVI-connector
18374 - */
18375 -diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c
18376 -index 1a6cb3c..e869128 100644
18377 ---- a/drivers/md/dm-table.c
18378 -+++ b/drivers/md/dm-table.c
18379 -@@ -499,16 +499,15 @@ int dm_set_device_limits(struct dm_target *ti, struct dm_dev *dev,
18380 - return 0;
18381 - }
18382 -
18383 -- if (blk_stack_limits(limits, &q->limits, start << 9) < 0)
18384 -- DMWARN("%s: target device %s is misaligned: "
18385 -+ if (bdev_stack_limits(limits, bdev, start) < 0)
18386 -+ DMWARN("%s: adding target device %s caused an alignment inconsistency: "
18387 - "physical_block_size=%u, logical_block_size=%u, "
18388 - "alignment_offset=%u, start=%llu",
18389 - dm_device_name(ti->table->md), bdevname(bdev, b),
18390 - q->limits.physical_block_size,
18391 - q->limits.logical_block_size,
18392 - q->limits.alignment_offset,
18393 -- (unsigned long long) start << 9);
18394 --
18395 -+ (unsigned long long) start << SECTOR_SHIFT);
18396 -
18397 - /*
18398 - * Check if merge fn is supported.
18399 -@@ -1025,9 +1024,9 @@ combine_limits:
18400 - * for the table.
18401 - */
18402 - if (blk_stack_limits(limits, &ti_limits, 0) < 0)
18403 -- DMWARN("%s: target device "
18404 -+ DMWARN("%s: adding target device "
18405 - "(start sect %llu len %llu) "
18406 -- "is misaligned",
18407 -+ "caused an alignment inconsistency",
18408 - dm_device_name(table->md),
18409 - (unsigned long long) ti->begin,
18410 - (unsigned long long) ti->len);
18411 -@@ -1079,15 +1078,6 @@ void dm_table_set_restrictions(struct dm_table *t, struct request_queue *q,
18412 - struct queue_limits *limits)
18413 - {
18414 - /*
18415 -- * Each target device in the table has a data area that should normally
18416 -- * be aligned such that the DM device's alignment_offset is 0.
18417 -- * FIXME: Propagate alignment_offsets up the stack and warn of
18418 -- * sub-optimal or inconsistent settings.
18419 -- */
18420 -- limits->alignment_offset = 0;
18421 -- limits->misaligned = 0;
18422 --
18423 -- /*
18424 - * Copy table's limits to the DM device's request_queue
18425 - */
18426 - q->limits = *limits;
18427 -diff --git a/drivers/media/video/gspca/sunplus.c b/drivers/media/video/gspca/sunplus.c
18428 -index aa8f995..28b4625 100644
18429 ---- a/drivers/media/video/gspca/sunplus.c
18430 -+++ b/drivers/media/video/gspca/sunplus.c
18431 -@@ -705,7 +705,7 @@ static void spca504B_SetSizeType(struct gspca_dev *gspca_dev)
18432 - rc = spca504B_PollingDataReady(gspca_dev);
18433 -
18434 - /* Init the cam width height with some values get on init ? */
18435 -- reg_w_riv(dev, 0x31, 0, 0x04);
18436 -+ reg_w_riv(dev, 0x31, 0x04, 0);
18437 - spca504B_WaitCmdStatus(gspca_dev);
18438 - rc = spca504B_PollingDataReady(gspca_dev);
18439 - break;
18440 -@@ -807,14 +807,14 @@ static void init_ctl_reg(struct gspca_dev *gspca_dev)
18441 - default:
18442 - /* case BRIDGE_SPCA533: */
18443 - /* case BRIDGE_SPCA504B: */
18444 -- reg_w_riv(dev, 0, 0x00, 0x21ad); /* hue */
18445 -- reg_w_riv(dev, 0, 0x01, 0x21ac); /* sat/hue */
18446 -- reg_w_riv(dev, 0, 0x00, 0x21a3); /* gamma */
18447 -+ reg_w_riv(dev, 0, 0x21ad, 0x00); /* hue */
18448 -+ reg_w_riv(dev, 0, 0x21ac, 0x01); /* sat/hue */
18449 -+ reg_w_riv(dev, 0, 0x21a3, 0x00); /* gamma */
18450 - break;
18451 - case BRIDGE_SPCA536:
18452 -- reg_w_riv(dev, 0, 0x40, 0x20f5);
18453 -- reg_w_riv(dev, 0, 0x01, 0x20f4);
18454 -- reg_w_riv(dev, 0, 0x00, 0x2089);
18455 -+ reg_w_riv(dev, 0, 0x20f5, 0x40);
18456 -+ reg_w_riv(dev, 0, 0x20f4, 0x01);
18457 -+ reg_w_riv(dev, 0, 0x2089, 0x00);
18458 - break;
18459 - }
18460 - if (pollreg)
18461 -@@ -888,11 +888,11 @@ static int sd_init(struct gspca_dev *gspca_dev)
18462 - switch (sd->bridge) {
18463 - case BRIDGE_SPCA504B:
18464 - reg_w_riv(dev, 0x1d, 0x00, 0);
18465 -- reg_w_riv(dev, 0, 0x01, 0x2306);
18466 -- reg_w_riv(dev, 0, 0x00, 0x0d04);
18467 -- reg_w_riv(dev, 0, 0x00, 0x2000);
18468 -- reg_w_riv(dev, 0, 0x13, 0x2301);
18469 -- reg_w_riv(dev, 0, 0x00, 0x2306);
18470 -+ reg_w_riv(dev, 0, 0x2306, 0x01);
18471 -+ reg_w_riv(dev, 0, 0x0d04, 0x00);
18472 -+ reg_w_riv(dev, 0, 0x2000, 0x00);
18473 -+ reg_w_riv(dev, 0, 0x2301, 0x13);
18474 -+ reg_w_riv(dev, 0, 0x2306, 0x00);
18475 - /* fall thru */
18476 - case BRIDGE_SPCA533:
18477 - spca504B_PollingDataReady(gspca_dev);
18478 -@@ -1011,7 +1011,7 @@ static int sd_start(struct gspca_dev *gspca_dev)
18479 - spca504B_WaitCmdStatus(gspca_dev);
18480 - break;
18481 - default:
18482 -- reg_w_riv(dev, 0x31, 0, 0x04);
18483 -+ reg_w_riv(dev, 0x31, 0x04, 0);
18484 - spca504B_WaitCmdStatus(gspca_dev);
18485 - spca504B_PollingDataReady(gspca_dev);
18486 - break;
18487 -diff --git a/drivers/misc/enclosure.c b/drivers/misc/enclosure.c
18488 -index e9eae4a..1eac626 100644
18489 ---- a/drivers/misc/enclosure.c
18490 -+++ b/drivers/misc/enclosure.c
18491 -@@ -391,6 +391,7 @@ static const char *const enclosure_status [] = {
18492 - [ENCLOSURE_STATUS_NOT_INSTALLED] = "not installed",
18493 - [ENCLOSURE_STATUS_UNKNOWN] = "unknown",
18494 - [ENCLOSURE_STATUS_UNAVAILABLE] = "unavailable",
18495 -+ [ENCLOSURE_STATUS_MAX] = NULL,
18496 - };
18497 -
18498 - static const char *const enclosure_type [] = {
18499 -diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c
18500 -index 0cce8a4..deac67e 100644
18501 ---- a/drivers/serial/8250_pnp.c
18502 -+++ b/drivers/serial/8250_pnp.c
18503 -@@ -328,15 +328,7 @@ static const struct pnp_device_id pnp_dev_table[] = {
18504 - /* U.S. Robotics 56K Voice INT PnP*/
18505 - { "USR9190", 0 },
18506 - /* Wacom tablets */
18507 -- { "WACF004", 0 },
18508 -- { "WACF005", 0 },
18509 -- { "WACF006", 0 },
18510 -- { "WACF007", 0 },
18511 -- { "WACF008", 0 },
18512 -- { "WACF009", 0 },
18513 -- { "WACF00A", 0 },
18514 -- { "WACF00B", 0 },
18515 -- { "WACF00C", 0 },
18516 -+ { "WACFXXX", 0 },
18517 - /* Compaq touchscreen */
18518 - { "FPI2002", 0 },
18519 - /* Fujitsu Stylistic touchscreens */
18520 -diff --git a/drivers/staging/asus_oled/asus_oled.c b/drivers/staging/asus_oled/asus_oled.c
18521 -index f4c2657..43c57b7 100644
18522 ---- a/drivers/staging/asus_oled/asus_oled.c
18523 -+++ b/drivers/staging/asus_oled/asus_oled.c
18524 -@@ -194,9 +194,11 @@ static ssize_t set_enabled(struct device *dev, struct device_attribute *attr,
18525 - {
18526 - struct usb_interface *intf = to_usb_interface(dev);
18527 - struct asus_oled_dev *odev = usb_get_intfdata(intf);
18528 -- int temp = strict_strtoul(buf, 10, NULL);
18529 -+ unsigned long value;
18530 -+ if (strict_strtoul(buf, 10, &value))
18531 -+ return -EINVAL;
18532 -
18533 -- enable_oled(odev, temp);
18534 -+ enable_oled(odev, value);
18535 -
18536 - return count;
18537 - }
18538 -@@ -207,10 +209,12 @@ static ssize_t class_set_enabled(struct device *device,
18539 - {
18540 - struct asus_oled_dev *odev =
18541 - (struct asus_oled_dev *) dev_get_drvdata(device);
18542 -+ unsigned long value;
18543 -
18544 -- int temp = strict_strtoul(buf, 10, NULL);
18545 -+ if (strict_strtoul(buf, 10, &value))
18546 -+ return -EINVAL;
18547 -
18548 -- enable_oled(odev, temp);
18549 -+ enable_oled(odev, value);
18550 -
18551 - return count;
18552 - }
18553 -diff --git a/drivers/staging/hv/Hv.c b/drivers/staging/hv/Hv.c
18554 -index c5b6613..c2809f2 100644
18555 ---- a/drivers/staging/hv/Hv.c
18556 -+++ b/drivers/staging/hv/Hv.c
18557 -@@ -386,7 +386,7 @@ u16 HvSignalEvent(void)
18558 - * retrieve the initialized message and event pages. Otherwise, we create and
18559 - * initialize the message and event pages.
18560 - */
18561 --int HvSynicInit(u32 irqVector)
18562 -+void HvSynicInit(void *irqarg)
18563 - {
18564 - u64 version;
18565 - union hv_synic_simp simp;
18566 -@@ -394,13 +394,14 @@ int HvSynicInit(u32 irqVector)
18567 - union hv_synic_sint sharedSint;
18568 - union hv_synic_scontrol sctrl;
18569 - u64 guestID;
18570 -- int ret = 0;
18571 -+ u32 irqVector = *((u32 *)(irqarg));
18572 -+ int cpu = smp_processor_id();
18573 -
18574 - DPRINT_ENTER(VMBUS);
18575 -
18576 - if (!gHvContext.HypercallPage) {
18577 - DPRINT_EXIT(VMBUS);
18578 -- return ret;
18579 -+ return;
18580 - }
18581 -
18582 - /* Check the version */
18583 -@@ -425,27 +426,27 @@ int HvSynicInit(u32 irqVector)
18584 - */
18585 - rdmsrl(HV_X64_MSR_GUEST_OS_ID, guestID);
18586 - if (guestID == HV_LINUX_GUEST_ID) {
18587 -- gHvContext.synICMessagePage[0] =
18588 -+ gHvContext.synICMessagePage[cpu] =
18589 - phys_to_virt(simp.BaseSimpGpa << PAGE_SHIFT);
18590 -- gHvContext.synICEventPage[0] =
18591 -+ gHvContext.synICEventPage[cpu] =
18592 - phys_to_virt(siefp.BaseSiefpGpa << PAGE_SHIFT);
18593 - } else {
18594 - DPRINT_ERR(VMBUS, "unknown guest id!!");
18595 - goto Cleanup;
18596 - }
18597 - DPRINT_DBG(VMBUS, "MAPPED: Simp: %p, Sifep: %p",
18598 -- gHvContext.synICMessagePage[0],
18599 -- gHvContext.synICEventPage[0]);
18600 -+ gHvContext.synICMessagePage[cpu],
18601 -+ gHvContext.synICEventPage[cpu]);
18602 - } else {
18603 -- gHvContext.synICMessagePage[0] = osd_PageAlloc(1);
18604 -- if (gHvContext.synICMessagePage[0] == NULL) {
18605 -+ gHvContext.synICMessagePage[cpu] = (void *)get_zeroed_page(GFP_ATOMIC);
18606 -+ if (gHvContext.synICMessagePage[cpu] == NULL) {
18607 - DPRINT_ERR(VMBUS,
18608 - "unable to allocate SYNIC message page!!");
18609 - goto Cleanup;
18610 - }
18611 -
18612 -- gHvContext.synICEventPage[0] = osd_PageAlloc(1);
18613 -- if (gHvContext.synICEventPage[0] == NULL) {
18614 -+ gHvContext.synICEventPage[cpu] = (void *)get_zeroed_page(GFP_ATOMIC);
18615 -+ if (gHvContext.synICEventPage[cpu] == NULL) {
18616 - DPRINT_ERR(VMBUS,
18617 - "unable to allocate SYNIC event page!!");
18618 - goto Cleanup;
18619 -@@ -454,7 +455,7 @@ int HvSynicInit(u32 irqVector)
18620 - /* Setup the Synic's message page */
18621 - rdmsrl(HV_X64_MSR_SIMP, simp.AsUINT64);
18622 - simp.SimpEnabled = 1;
18623 -- simp.BaseSimpGpa = virt_to_phys(gHvContext.synICMessagePage[0])
18624 -+ simp.BaseSimpGpa = virt_to_phys(gHvContext.synICMessagePage[cpu])
18625 - >> PAGE_SHIFT;
18626 -
18627 - DPRINT_DBG(VMBUS, "HV_X64_MSR_SIMP msr set to: %llx",
18628 -@@ -465,7 +466,7 @@ int HvSynicInit(u32 irqVector)
18629 - /* Setup the Synic's event page */
18630 - rdmsrl(HV_X64_MSR_SIEFP, siefp.AsUINT64);
18631 - siefp.SiefpEnabled = 1;
18632 -- siefp.BaseSiefpGpa = virt_to_phys(gHvContext.synICEventPage[0])
18633 -+ siefp.BaseSiefpGpa = virt_to_phys(gHvContext.synICEventPage[cpu])
18634 - >> PAGE_SHIFT;
18635 -
18636 - DPRINT_DBG(VMBUS, "HV_X64_MSR_SIEFP msr set to: %llx",
18637 -@@ -501,32 +502,30 @@ int HvSynicInit(u32 irqVector)
18638 -
18639 - DPRINT_EXIT(VMBUS);
18640 -
18641 -- return ret;
18642 -+ return;
18643 -
18644 - Cleanup:
18645 -- ret = -1;
18646 --
18647 - if (gHvContext.GuestId == HV_LINUX_GUEST_ID) {
18648 -- if (gHvContext.synICEventPage[0])
18649 -- osd_PageFree(gHvContext.synICEventPage[0], 1);
18650 -+ if (gHvContext.synICEventPage[cpu])
18651 -+ osd_PageFree(gHvContext.synICEventPage[cpu], 1);
18652 -
18653 -- if (gHvContext.synICMessagePage[0])
18654 -- osd_PageFree(gHvContext.synICMessagePage[0], 1);
18655 -+ if (gHvContext.synICMessagePage[cpu])
18656 -+ osd_PageFree(gHvContext.synICMessagePage[cpu], 1);
18657 - }
18658 -
18659 - DPRINT_EXIT(VMBUS);
18660 --
18661 -- return ret;
18662 -+ return;
18663 - }
18664 -
18665 - /**
18666 - * HvSynicCleanup - Cleanup routine for HvSynicInit().
18667 - */
18668 --void HvSynicCleanup(void)
18669 -+void HvSynicCleanup(void *arg)
18670 - {
18671 - union hv_synic_sint sharedSint;
18672 - union hv_synic_simp simp;
18673 - union hv_synic_siefp siefp;
18674 -+ int cpu = smp_processor_id();
18675 -
18676 - DPRINT_ENTER(VMBUS);
18677 -
18678 -@@ -539,6 +538,7 @@ void HvSynicCleanup(void)
18679 -
18680 - sharedSint.Masked = 1;
18681 -
18682 -+ /* Need to correctly cleanup in the case of SMP!!! */
18683 - /* Disable the interrupt */
18684 - wrmsrl(HV_X64_MSR_SINT0 + VMBUS_MESSAGE_SINT, sharedSint.AsUINT64);
18685 -
18686 -@@ -560,8 +560,8 @@ void HvSynicCleanup(void)
18687 -
18688 - wrmsrl(HV_X64_MSR_SIEFP, siefp.AsUINT64);
18689 -
18690 -- osd_PageFree(gHvContext.synICMessagePage[0], 1);
18691 -- osd_PageFree(gHvContext.synICEventPage[0], 1);
18692 -+ osd_PageFree(gHvContext.synICMessagePage[cpu], 1);
18693 -+ osd_PageFree(gHvContext.synICEventPage[cpu], 1);
18694 - }
18695 -
18696 - DPRINT_EXIT(VMBUS);
18697 -diff --git a/drivers/staging/hv/Hv.h b/drivers/staging/hv/Hv.h
18698 -index 5379e4b..fce4b5c 100644
18699 ---- a/drivers/staging/hv/Hv.h
18700 -+++ b/drivers/staging/hv/Hv.h
18701 -@@ -93,7 +93,7 @@ static const struct hv_guid VMBUS_SERVICE_ID = {
18702 - },
18703 - };
18704 -
18705 --#define MAX_NUM_CPUS 1
18706 -+#define MAX_NUM_CPUS 32
18707 -
18708 -
18709 - struct hv_input_signal_event_buffer {
18710 -@@ -137,8 +137,8 @@ extern u16 HvPostMessage(union hv_connection_id connectionId,
18711 -
18712 - extern u16 HvSignalEvent(void);
18713 -
18714 --extern int HvSynicInit(u32 irqVector);
18715 -+extern void HvSynicInit(void *irqarg);
18716 -
18717 --extern void HvSynicCleanup(void);
18718 -+extern void HvSynicCleanup(void *arg);
18719 -
18720 - #endif /* __HV_H__ */
18721 -diff --git a/drivers/staging/hv/Vmbus.c b/drivers/staging/hv/Vmbus.c
18722 -index a4dd06f..35a023e 100644
18723 ---- a/drivers/staging/hv/Vmbus.c
18724 -+++ b/drivers/staging/hv/Vmbus.c
18725 -@@ -129,7 +129,7 @@ static int VmbusOnDeviceAdd(struct hv_device *dev, void *AdditionalInfo)
18726 -
18727 - /* strcpy(dev->name, "vmbus"); */
18728 - /* SynIC setup... */
18729 -- ret = HvSynicInit(*irqvector);
18730 -+ on_each_cpu(HvSynicInit, (void *)irqvector, 1);
18731 -
18732 - /* Connect to VMBus in the root partition */
18733 - ret = VmbusConnect();
18734 -@@ -150,7 +150,7 @@ static int VmbusOnDeviceRemove(struct hv_device *dev)
18735 - DPRINT_ENTER(VMBUS);
18736 - VmbusChannelReleaseUnattachedChannels();
18737 - VmbusDisconnect();
18738 -- HvSynicCleanup();
18739 -+ on_each_cpu(HvSynicCleanup, NULL, 1);
18740 - DPRINT_EXIT(VMBUS);
18741 -
18742 - return ret;
18743 -@@ -173,7 +173,8 @@ static void VmbusOnCleanup(struct hv_driver *drv)
18744 - */
18745 - static void VmbusOnMsgDPC(struct hv_driver *drv)
18746 - {
18747 -- void *page_addr = gHvContext.synICMessagePage[0];
18748 -+ int cpu = smp_processor_id();
18749 -+ void *page_addr = gHvContext.synICMessagePage[cpu];
18750 - struct hv_message *msg = (struct hv_message *)page_addr +
18751 - VMBUS_MESSAGE_SINT;
18752 - struct hv_message *copied;
18753 -@@ -230,11 +231,12 @@ static void VmbusOnEventDPC(struct hv_driver *drv)
18754 - static int VmbusOnISR(struct hv_driver *drv)
18755 - {
18756 - int ret = 0;
18757 -+ int cpu = smp_processor_id();
18758 - void *page_addr;
18759 - struct hv_message *msg;
18760 - union hv_synic_event_flags *event;
18761 -
18762 -- page_addr = gHvContext.synICMessagePage[0];
18763 -+ page_addr = gHvContext.synICMessagePage[cpu];
18764 - msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT;
18765 -
18766 - DPRINT_ENTER(VMBUS);
18767 -@@ -248,7 +250,7 @@ static int VmbusOnISR(struct hv_driver *drv)
18768 - }
18769 -
18770 - /* TODO: Check if there are events to be process */
18771 -- page_addr = gHvContext.synICEventPage[0];
18772 -+ page_addr = gHvContext.synICEventPage[cpu];
18773 - event = (union hv_synic_event_flags *)page_addr + VMBUS_MESSAGE_SINT;
18774 -
18775 - /* Since we are a child, we only need to check bit 0 */
18776 -diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c
18777 -index 96f1171..355dffc 100644
18778 ---- a/drivers/usb/core/devices.c
18779 -+++ b/drivers/usb/core/devices.c
18780 -@@ -494,7 +494,7 @@ static ssize_t usb_device_dump(char __user **buffer, size_t *nbytes,
18781 - return 0;
18782 - /* allocate 2^1 pages = 8K (on i386);
18783 - * should be more than enough for one device */
18784 -- pages_start = (char *)__get_free_pages(GFP_KERNEL, 1);
18785 -+ pages_start = (char *)__get_free_pages(GFP_NOIO, 1);
18786 - if (!pages_start)
18787 - return -ENOMEM;
18788 -
18789 -diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
18790 -index 8b0c235..1a7d54b 100644
18791 ---- a/drivers/usb/core/hub.c
18792 -+++ b/drivers/usb/core/hub.c
18793 -@@ -3286,6 +3286,9 @@ static void hub_events(void)
18794 - USB_PORT_FEAT_C_SUSPEND);
18795 - udev = hdev->children[i-1];
18796 - if (udev) {
18797 -+ /* TRSMRCY = 10 msec */
18798 -+ msleep(10);
18799 -+
18800 - usb_lock_device(udev);
18801 - ret = remote_wakeup(hdev->
18802 - children[i-1]);
18803 -diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
18804 -index da718e8..980a8d2 100644
18805 ---- a/drivers/usb/core/message.c
18806 -+++ b/drivers/usb/core/message.c
18807 -@@ -911,11 +911,11 @@ char *usb_cache_string(struct usb_device *udev, int index)
18808 - if (index <= 0)
18809 - return NULL;
18810 -
18811 -- buf = kmalloc(MAX_USB_STRING_SIZE, GFP_KERNEL);
18812 -+ buf = kmalloc(MAX_USB_STRING_SIZE, GFP_NOIO);
18813 - if (buf) {
18814 - len = usb_string(udev, index, buf, MAX_USB_STRING_SIZE);
18815 - if (len > 0) {
18816 -- smallbuf = kmalloc(++len, GFP_KERNEL);
18817 -+ smallbuf = kmalloc(++len, GFP_NOIO);
18818 - if (!smallbuf)
18819 - return buf;
18820 - memcpy(smallbuf, buf, len);
18821 -@@ -1682,7 +1682,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
18822 - if (cp) {
18823 - nintf = cp->desc.bNumInterfaces;
18824 - new_interfaces = kmalloc(nintf * sizeof(*new_interfaces),
18825 -- GFP_KERNEL);
18826 -+ GFP_NOIO);
18827 - if (!new_interfaces) {
18828 - dev_err(&dev->dev, "Out of memory\n");
18829 - return -ENOMEM;
18830 -@@ -1691,7 +1691,7 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
18831 - for (; n < nintf; ++n) {
18832 - new_interfaces[n] = kzalloc(
18833 - sizeof(struct usb_interface),
18834 -- GFP_KERNEL);
18835 -+ GFP_NOIO);
18836 - if (!new_interfaces[n]) {
18837 - dev_err(&dev->dev, "Out of memory\n");
18838 - ret = -ENOMEM;
18839 -diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c
18840 -index 8752e55..fcdcad4 100644
18841 ---- a/drivers/usb/core/sysfs.c
18842 -+++ b/drivers/usb/core/sysfs.c
18843 -@@ -115,6 +115,12 @@ show_speed(struct device *dev, struct device_attribute *attr, char *buf)
18844 - case USB_SPEED_HIGH:
18845 - speed = "480";
18846 - break;
18847 -+ case USB_SPEED_VARIABLE:
18848 -+ speed = "480";
18849 -+ break;
18850 -+ case USB_SPEED_SUPER:
18851 -+ speed = "5000";
18852 -+ break;
18853 - default:
18854 - speed = "unknown";
18855 - }
18856 -diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
18857 -index f5f5601..e18c677 100644
18858 ---- a/drivers/usb/host/ehci-hcd.c
18859 -+++ b/drivers/usb/host/ehci-hcd.c
18860 -@@ -785,9 +785,10 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd)
18861 -
18862 - /* start 20 msec resume signaling from this port,
18863 - * and make khubd collect PORT_STAT_C_SUSPEND to
18864 -- * stop that signaling.
18865 -+ * stop that signaling. Use 5 ms extra for safety,
18866 -+ * like usb_port_resume() does.
18867 - */
18868 -- ehci->reset_done [i] = jiffies + msecs_to_jiffies (20);
18869 -+ ehci->reset_done[i] = jiffies + msecs_to_jiffies(25);
18870 - ehci_dbg (ehci, "port %d remote wakeup\n", i + 1);
18871 - mod_timer(&hcd->rh_timer, ehci->reset_done[i]);
18872 - }
18873 -diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
18874 -index 1b6f1c0..698f461 100644
18875 ---- a/drivers/usb/host/ehci-hub.c
18876 -+++ b/drivers/usb/host/ehci-hub.c
18877 -@@ -120,9 +120,26 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
18878 - del_timer_sync(&ehci->watchdog);
18879 - del_timer_sync(&ehci->iaa_watchdog);
18880 -
18881 -- port = HCS_N_PORTS (ehci->hcs_params);
18882 - spin_lock_irq (&ehci->lock);
18883 -
18884 -+ /* Once the controller is stopped, port resumes that are already
18885 -+ * in progress won't complete. Hence if remote wakeup is enabled
18886 -+ * for the root hub and any ports are in the middle of a resume or
18887 -+ * remote wakeup, we must fail the suspend.
18888 -+ */
18889 -+ if (hcd->self.root_hub->do_remote_wakeup) {
18890 -+ port = HCS_N_PORTS(ehci->hcs_params);
18891 -+ while (port--) {
18892 -+ if (ehci->reset_done[port] != 0) {
18893 -+ spin_unlock_irq(&ehci->lock);
18894 -+ ehci_dbg(ehci, "suspend failed because "
18895 -+ "port %d is resuming\n",
18896 -+ port + 1);
18897 -+ return -EBUSY;
18898 -+ }
18899 -+ }
18900 -+ }
18901 -+
18902 - /* stop schedules, clean any completed work */
18903 - if (HC_IS_RUNNING(hcd->state)) {
18904 - ehci_quiesce (ehci);
18905 -@@ -138,6 +155,7 @@ static int ehci_bus_suspend (struct usb_hcd *hcd)
18906 - */
18907 - ehci->bus_suspended = 0;
18908 - ehci->owned_ports = 0;
18909 -+ port = HCS_N_PORTS(ehci->hcs_params);
18910 - while (port--) {
18911 - u32 __iomem *reg = &ehci->regs->port_status [port];
18912 - u32 t1 = ehci_readl(ehci, reg) & ~PORT_RWC_BITS;
18913 -diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
18914 -index 139a2cc..c0d4b39 100644
18915 ---- a/drivers/usb/host/ehci-q.c
18916 -+++ b/drivers/usb/host/ehci-q.c
18917 -@@ -827,9 +827,10 @@ qh_make (
18918 - * But interval 1 scheduling is simpler, and
18919 - * includes high bandwidth.
18920 - */
18921 -- dbg ("intr period %d uframes, NYET!",
18922 -- urb->interval);
18923 -- goto done;
18924 -+ urb->interval = 1;
18925 -+ } else if (qh->period > ehci->periodic_size) {
18926 -+ qh->period = ehci->periodic_size;
18927 -+ urb->interval = qh->period << 3;
18928 - }
18929 - } else {
18930 - int think_time;
18931 -@@ -852,6 +853,10 @@ qh_make (
18932 - usb_calc_bus_time (urb->dev->speed,
18933 - is_input, 0, max_packet (maxp)));
18934 - qh->period = urb->interval;
18935 -+ if (qh->period > ehci->periodic_size) {
18936 -+ qh->period = ehci->periodic_size;
18937 -+ urb->interval = qh->period;
18938 -+ }
18939 - }
18940 - }
18941 -
18942 -diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
18943 -index 5cd0e48..99cd00f 100644
18944 ---- a/drivers/usb/host/uhci-hcd.c
18945 -+++ b/drivers/usb/host/uhci-hcd.c
18946 -@@ -749,7 +749,20 @@ static int uhci_rh_suspend(struct usb_hcd *hcd)
18947 - spin_lock_irq(&uhci->lock);
18948 - if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags))
18949 - rc = -ESHUTDOWN;
18950 -- else if (!uhci->dead)
18951 -+ else if (uhci->dead)
18952 -+ ; /* Dead controllers tell no tales */
18953 -+
18954 -+ /* Once the controller is stopped, port resumes that are already
18955 -+ * in progress won't complete. Hence if remote wakeup is enabled
18956 -+ * for the root hub and any ports are in the middle of a resume or
18957 -+ * remote wakeup, we must fail the suspend.
18958 -+ */
18959 -+ else if (hcd->self.root_hub->do_remote_wakeup &&
18960 -+ uhci->resuming_ports) {
18961 -+ dev_dbg(uhci_dev(uhci), "suspend failed because a port "
18962 -+ "is resuming\n");
18963 -+ rc = -EBUSY;
18964 -+ } else
18965 - suspend_rh(uhci, UHCI_RH_SUSPENDED);
18966 - spin_unlock_irq(&uhci->lock);
18967 - return rc;
18968 -diff --git a/drivers/usb/host/uhci-hub.c b/drivers/usb/host/uhci-hub.c
18969 -index 885b585..8270055 100644
18970 ---- a/drivers/usb/host/uhci-hub.c
18971 -+++ b/drivers/usb/host/uhci-hub.c
18972 -@@ -167,7 +167,7 @@ static void uhci_check_ports(struct uhci_hcd *uhci)
18973 - /* Port received a wakeup request */
18974 - set_bit(port, &uhci->resuming_ports);
18975 - uhci->ports_timeout = jiffies +
18976 -- msecs_to_jiffies(20);
18977 -+ msecs_to_jiffies(25);
18978 -
18979 - /* Make sure we see the port again
18980 - * after the resuming period is over. */
18981 -diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
18982 -index bbe005c..e0fb294 100644
18983 ---- a/drivers/usb/serial/generic.c
18984 -+++ b/drivers/usb/serial/generic.c
18985 -@@ -489,6 +489,8 @@ void usb_serial_generic_write_bulk_callback(struct urb *urb)
18986 - dbg("%s - port %d", __func__, port->number);
18987 -
18988 - if (port->serial->type->max_in_flight_urbs) {
18989 -+ kfree(urb->transfer_buffer);
18990 -+
18991 - spin_lock_irqsave(&port->lock, flags);
18992 - --port->urbs_in_flight;
18993 - port->tx_bytes_flight -= urb->transfer_buffer_length;
18994 -diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
18995 -index 64a0a2c..c932f90 100644
18996 ---- a/drivers/usb/storage/unusual_devs.h
18997 -+++ b/drivers/usb/storage/unusual_devs.h
18998 -@@ -1807,13 +1807,6 @@ UNUSUAL_DEV( 0x2735, 0x100b, 0x0000, 0x9999,
18999 - US_SC_DEVICE, US_PR_DEVICE, NULL,
19000 - US_FL_GO_SLOW ),
19001 -
19002 --/* Reported by Rohan Hart <rohan.hart17@×××××.com> */
19003 --UNUSUAL_DEV( 0x2770, 0x915d, 0x0010, 0x0010,
19004 -- "INTOVA",
19005 -- "Pixtreme",
19006 -- US_SC_DEVICE, US_PR_DEVICE, NULL,
19007 -- US_FL_FIX_CAPACITY ),
19008 --
19009 - /* Reported by Frederic Marchal <frederic.marchal@××××××××××.com>
19010 - * Mio Moov 330
19011 - */
19012 -diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c
19013 -index 716c8d7..33197fa 100644
19014 ---- a/drivers/usb/storage/usb.c
19015 -+++ b/drivers/usb/storage/usb.c
19016 -@@ -430,7 +430,8 @@ static void adjust_quirks(struct us_data *us)
19017 - u16 vid = le16_to_cpu(us->pusb_dev->descriptor.idVendor);
19018 - u16 pid = le16_to_cpu(us->pusb_dev->descriptor.idProduct);
19019 - unsigned f = 0;
19020 -- unsigned int mask = (US_FL_SANE_SENSE | US_FL_FIX_CAPACITY |
19021 -+ unsigned int mask = (US_FL_SANE_SENSE | US_FL_BAD_SENSE |
19022 -+ US_FL_FIX_CAPACITY |
19023 - US_FL_CAPACITY_HEURISTICS | US_FL_IGNORE_DEVICE |
19024 - US_FL_NOT_LOCKABLE | US_FL_MAX_SECTORS_64 |
19025 - US_FL_CAPACITY_OK | US_FL_IGNORE_RESIDUE |
19026 -diff --git a/fs/ecryptfs/crypto.c b/fs/ecryptfs/crypto.c
19027 -index fbb6e5e..7cb0a59 100644
19028 ---- a/fs/ecryptfs/crypto.c
19029 -+++ b/fs/ecryptfs/crypto.c
19030 -@@ -1748,7 +1748,7 @@ ecryptfs_process_key_cipher(struct crypto_blkcipher **key_tfm,
19031 - char *cipher_name, size_t *key_size)
19032 - {
19033 - char dummy_key[ECRYPTFS_MAX_KEY_BYTES];
19034 -- char *full_alg_name;
19035 -+ char *full_alg_name = NULL;
19036 - int rc;
19037 -
19038 - *key_tfm = NULL;
19039 -@@ -1763,7 +1763,6 @@ ecryptfs_process_key_cipher(struct crypto_blkcipher **key_tfm,
19040 - if (rc)
19041 - goto out;
19042 - *key_tfm = crypto_alloc_blkcipher(full_alg_name, 0, CRYPTO_ALG_ASYNC);
19043 -- kfree(full_alg_name);
19044 - if (IS_ERR(*key_tfm)) {
19045 - rc = PTR_ERR(*key_tfm);
19046 - printk(KERN_ERR "Unable to allocate crypto cipher with name "
19047 -@@ -1786,6 +1785,7 @@ ecryptfs_process_key_cipher(struct crypto_blkcipher **key_tfm,
19048 - goto out;
19049 - }
19050 - out:
19051 -+ kfree(full_alg_name);
19052 - return rc;
19053 - }
19054 -
19055 -diff --git a/fs/ecryptfs/file.c b/fs/ecryptfs/file.c
19056 -index 9e94405..1744f17 100644
19057 ---- a/fs/ecryptfs/file.c
19058 -+++ b/fs/ecryptfs/file.c
19059 -@@ -191,13 +191,6 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
19060 - | ECRYPTFS_ENCRYPTED);
19061 - }
19062 - mutex_unlock(&crypt_stat->cs_mutex);
19063 -- if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_RDONLY)
19064 -- && !(file->f_flags & O_RDONLY)) {
19065 -- rc = -EPERM;
19066 -- printk(KERN_WARNING "%s: Lower persistent file is RO; eCryptfs "
19067 -- "file must hence be opened RO\n", __func__);
19068 -- goto out;
19069 -- }
19070 - if (!ecryptfs_inode_to_private(inode)->lower_file) {
19071 - rc = ecryptfs_init_persistent_file(ecryptfs_dentry);
19072 - if (rc) {
19073 -@@ -208,6 +201,13 @@ static int ecryptfs_open(struct inode *inode, struct file *file)
19074 - goto out;
19075 - }
19076 - }
19077 -+ if ((ecryptfs_inode_to_private(inode)->lower_file->f_flags & O_RDONLY)
19078 -+ && !(file->f_flags & O_RDONLY)) {
19079 -+ rc = -EPERM;
19080 -+ printk(KERN_WARNING "%s: Lower persistent file is RO; eCryptfs "
19081 -+ "file must hence be opened RO\n", __func__);
19082 -+ goto out;
19083 -+ }
19084 - ecryptfs_set_file_lower(
19085 - file, ecryptfs_inode_to_private(inode)->lower_file);
19086 - if (S_ISDIR(ecryptfs_dentry->d_inode->i_mode)) {
19087 -diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
19088 -index adf99c6..912b8ff 100644
19089 ---- a/include/linux/blkdev.h
19090 -+++ b/include/linux/blkdev.h
19091 -@@ -942,6 +942,8 @@ extern void blk_queue_io_opt(struct request_queue *q, unsigned int opt);
19092 - extern void blk_set_default_limits(struct queue_limits *lim);
19093 - extern int blk_stack_limits(struct queue_limits *t, struct queue_limits *b,
19094 - sector_t offset);
19095 -+extern int bdev_stack_limits(struct queue_limits *t, struct block_device *bdev,
19096 -+ sector_t offset);
19097 - extern void disk_stack_limits(struct gendisk *disk, struct block_device *bdev,
19098 - sector_t offset);
19099 - extern void blk_queue_stack_limits(struct request_queue *t, struct request_queue *b);
19100 -diff --git a/include/linux/enclosure.h b/include/linux/enclosure.h
19101 -index 90d1c21..9a33c5f 100644
19102 ---- a/include/linux/enclosure.h
19103 -+++ b/include/linux/enclosure.h
19104 -@@ -42,6 +42,8 @@ enum enclosure_status {
19105 - ENCLOSURE_STATUS_NOT_INSTALLED,
19106 - ENCLOSURE_STATUS_UNKNOWN,
19107 - ENCLOSURE_STATUS_UNAVAILABLE,
19108 -+ /* last element for counting purposes */
19109 -+ ENCLOSURE_STATUS_MAX
19110 - };
19111 -
19112 - /* SFF-8485 activity light settings */
19113 -diff --git a/kernel/perf_event.c b/kernel/perf_event.c
19114 -index 6eee915..413d101 100644
19115 ---- a/kernel/perf_event.c
19116 -+++ b/kernel/perf_event.c
19117 -@@ -1359,6 +1359,9 @@ static void perf_ctx_adjust_freq(struct perf_event_context *ctx)
19118 - if (event->state != PERF_EVENT_STATE_ACTIVE)
19119 - continue;
19120 -
19121 -+ if (event->cpu != -1 && event->cpu != smp_processor_id())
19122 -+ continue;
19123 -+
19124 - hwc = &event->hw;
19125 -
19126 - interrupts = hwc->interrupts;
19127 -@@ -3226,6 +3229,12 @@ static void perf_event_task_output(struct perf_event *event,
19128 -
19129 - static int perf_event_task_match(struct perf_event *event)
19130 - {
19131 -+ if (event->state != PERF_EVENT_STATE_ACTIVE)
19132 -+ return 0;
19133 -+
19134 -+ if (event->cpu != -1 && event->cpu != smp_processor_id())
19135 -+ return 0;
19136 -+
19137 - if (event->attr.comm || event->attr.mmap || event->attr.task)
19138 - return 1;
19139 -
19140 -@@ -3255,13 +3264,13 @@ static void perf_event_task_event(struct perf_task_event *task_event)
19141 -
19142 - cpuctx = &get_cpu_var(perf_cpu_context);
19143 - perf_event_task_ctx(&cpuctx->ctx, task_event);
19144 -- put_cpu_var(perf_cpu_context);
19145 -
19146 - rcu_read_lock();
19147 - if (!ctx)
19148 - ctx = rcu_dereference(task_event->task->perf_event_ctxp);
19149 - if (ctx)
19150 - perf_event_task_ctx(ctx, task_event);
19151 -+ put_cpu_var(perf_cpu_context);
19152 - rcu_read_unlock();
19153 - }
19154 -
19155 -@@ -3338,6 +3347,12 @@ static void perf_event_comm_output(struct perf_event *event,
19156 -
19157 - static int perf_event_comm_match(struct perf_event *event)
19158 - {
19159 -+ if (event->state != PERF_EVENT_STATE_ACTIVE)
19160 -+ return 0;
19161 -+
19162 -+ if (event->cpu != -1 && event->cpu != smp_processor_id())
19163 -+ return 0;
19164 -+
19165 - if (event->attr.comm)
19166 - return 1;
19167 -
19168 -@@ -3378,7 +3393,6 @@ static void perf_event_comm_event(struct perf_comm_event *comm_event)
19169 -
19170 - cpuctx = &get_cpu_var(perf_cpu_context);
19171 - perf_event_comm_ctx(&cpuctx->ctx, comm_event);
19172 -- put_cpu_var(perf_cpu_context);
19173 -
19174 - rcu_read_lock();
19175 - /*
19176 -@@ -3388,6 +3402,7 @@ static void perf_event_comm_event(struct perf_comm_event *comm_event)
19177 - ctx = rcu_dereference(current->perf_event_ctxp);
19178 - if (ctx)
19179 - perf_event_comm_ctx(ctx, comm_event);
19180 -+ put_cpu_var(perf_cpu_context);
19181 - rcu_read_unlock();
19182 - }
19183 -
19184 -@@ -3462,6 +3477,12 @@ static void perf_event_mmap_output(struct perf_event *event,
19185 - static int perf_event_mmap_match(struct perf_event *event,
19186 - struct perf_mmap_event *mmap_event)
19187 - {
19188 -+ if (event->state != PERF_EVENT_STATE_ACTIVE)
19189 -+ return 0;
19190 -+
19191 -+ if (event->cpu != -1 && event->cpu != smp_processor_id())
19192 -+ return 0;
19193 -+
19194 - if (event->attr.mmap)
19195 - return 1;
19196 -
19197 -@@ -3539,7 +3560,6 @@ got_name:
19198 -
19199 - cpuctx = &get_cpu_var(perf_cpu_context);
19200 - perf_event_mmap_ctx(&cpuctx->ctx, mmap_event);
19201 -- put_cpu_var(perf_cpu_context);
19202 -
19203 - rcu_read_lock();
19204 - /*
19205 -@@ -3549,6 +3569,7 @@ got_name:
19206 - ctx = rcu_dereference(current->perf_event_ctxp);
19207 - if (ctx)
19208 - perf_event_mmap_ctx(ctx, mmap_event);
19209 -+ put_cpu_var(perf_cpu_context);
19210 - rcu_read_unlock();
19211 -
19212 - kfree(buf);
19213 -@@ -3811,6 +3832,9 @@ static int perf_swevent_match(struct perf_event *event,
19214 - enum perf_type_id type,
19215 - u32 event_id, struct pt_regs *regs)
19216 - {
19217 -+ if (event->cpu != -1 && event->cpu != smp_processor_id())
19218 -+ return 0;
19219 -+
19220 - if (!perf_swevent_is_counting(event))
19221 - return 0;
19222 -
19223 -diff --git a/mm/vmalloc.c b/mm/vmalloc.c
19224 -index 7758726..a3a99d3 100644
19225 ---- a/mm/vmalloc.c
19226 -+++ b/mm/vmalloc.c
19227 -@@ -555,10 +555,8 @@ static void __purge_vmap_area_lazy(unsigned long *start, unsigned long *end,
19228 - }
19229 - rcu_read_unlock();
19230 -
19231 -- if (nr) {
19232 -- BUG_ON(nr > atomic_read(&vmap_lazy_nr));
19233 -+ if (nr)
19234 - atomic_sub(nr, &vmap_lazy_nr);
19235 -- }
19236 -
19237 - if (nr || force_flush)
19238 - flush_tlb_kernel_range(*start, *end);
19239 -diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
19240 -index e8a510d..4101afe 100644
19241 ---- a/tools/perf/builtin-timechart.c
19242 -+++ b/tools/perf/builtin-timechart.c
19243 -@@ -275,7 +275,7 @@ static u64 cpus_pstate_state[MAX_CPUS];
19244 - static int
19245 - process_comm_event(event_t *event)
19246 - {
19247 -- pid_set_comm(event->comm.pid, event->comm.comm);
19248 -+ pid_set_comm(event->comm.tid, event->comm.comm);
19249 - return 0;
19250 - }
19251 - static int
19252
19253 Deleted: genpatches-2.6/trunk/2.6.33/1006_linux-2.6.32.7.patch
19254 ===================================================================
19255 --- genpatches-2.6/trunk/2.6.33/1006_linux-2.6.32.7.patch 2010-02-18 15:55:49 UTC (rev 1673)
19256 +++ genpatches-2.6/trunk/2.6.33/1006_linux-2.6.32.7.patch 2010-02-18 15:58:13 UTC (rev 1674)
19257 @@ -1,4401 +0,0 @@
19258 -diff --git a/Documentation/DocBook/Makefile b/Documentation/DocBook/Makefile
19259 -index ab8300f..50075df 100644
19260 ---- a/Documentation/DocBook/Makefile
19261 -+++ b/Documentation/DocBook/Makefile
19262 -@@ -32,10 +32,10 @@ PS_METHOD = $(prefer-db2x)
19263 -
19264 - ###
19265 - # The targets that may be used.
19266 --PHONY += xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs cleandocs media
19267 -+PHONY += xmldocs sgmldocs psdocs pdfdocs htmldocs mandocs installmandocs cleandocs xmldoclinks
19268 -
19269 - BOOKS := $(addprefix $(obj)/,$(DOCBOOKS))
19270 --xmldocs: $(BOOKS)
19271 -+xmldocs: $(BOOKS) xmldoclinks
19272 - sgmldocs: xmldocs
19273 -
19274 - PS := $(patsubst %.xml, %.ps, $(BOOKS))
19275 -@@ -45,15 +45,24 @@ PDF := $(patsubst %.xml, %.pdf, $(BOOKS))
19276 - pdfdocs: $(PDF)
19277 -
19278 - HTML := $(sort $(patsubst %.xml, %.html, $(BOOKS)))
19279 --htmldocs: media $(HTML)
19280 -+htmldocs: $(HTML)
19281 - $(call build_main_index)
19282 -+ $(call build_images)
19283 -
19284 - MAN := $(patsubst %.xml, %.9, $(BOOKS))
19285 - mandocs: $(MAN)
19286 -
19287 --media:
19288 -- mkdir -p $(srctree)/Documentation/DocBook/media/
19289 -- cp $(srctree)/Documentation/DocBook/dvb/*.png $(srctree)/Documentation/DocBook/v4l/*.gif $(srctree)/Documentation/DocBook/media/
19290 -+build_images = mkdir -p $(objtree)/Documentation/DocBook/media/ && \
19291 -+ cp $(srctree)/Documentation/DocBook/dvb/*.png $(srctree)/Documentation/DocBook/v4l/*.gif $(objtree)/Documentation/DocBook/media/
19292 -+
19293 -+xmldoclinks:
19294 -+ifneq ($(objtree),$(srctree))
19295 -+ for dep in dvb media-entities.tmpl media-indices.tmpl v4l; do \
19296 -+ rm -f $(objtree)/Documentation/DocBook/$$dep \
19297 -+ && ln -s $(srctree)/Documentation/DocBook/$$dep $(objtree)/Documentation/DocBook/ \
19298 -+ || exit; \
19299 -+ done
19300 -+endif
19301 -
19302 - installmandocs: mandocs
19303 - mkdir -p /usr/local/man/man9/
19304 -diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134
19305 -index 2620d60..94e255a 100644
19306 ---- a/Documentation/video4linux/CARDLIST.saa7134
19307 -+++ b/Documentation/video4linux/CARDLIST.saa7134
19308 -@@ -172,3 +172,4 @@
19309 - 171 -> Beholder BeholdTV X7 [5ace:7595]
19310 - 172 -> RoverMedia TV Link Pro FM [19d1:0138]
19311 - 173 -> Zolid Hybrid TV Tuner PCI [1131:2004]
19312 -+174 -> Asus Europa Hybrid OEM [1043:4847]
19313 -diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c
19314 -index 0976049..36e4fb4 100644
19315 ---- a/arch/arm/mach-davinci/dm646x.c
19316 -+++ b/arch/arm/mach-davinci/dm646x.c
19317 -@@ -789,7 +789,14 @@ static struct davinci_id dm646x_ids[] = {
19318 - .part_no = 0xb770,
19319 - .manufacturer = 0x017,
19320 - .cpu_id = DAVINCI_CPU_ID_DM6467,
19321 -- .name = "dm6467",
19322 -+ .name = "dm6467_rev1.x",
19323 -+ },
19324 -+ {
19325 -+ .variant = 0x1,
19326 -+ .part_no = 0xb770,
19327 -+ .manufacturer = 0x017,
19328 -+ .cpu_id = DAVINCI_CPU_ID_DM6467,
19329 -+ .name = "dm6467_rev3.x",
19330 - },
19331 - };
19332 -
19333 -diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
19334 -index ae88b14..e82749b 100644
19335 ---- a/arch/powerpc/sysdev/fsl_pci.c
19336 -+++ b/arch/powerpc/sysdev/fsl_pci.c
19337 -@@ -392,8 +392,22 @@ DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8536, quirk_fsl_pcie_header);
19338 - DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8641, quirk_fsl_pcie_header);
19339 - DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8641D, quirk_fsl_pcie_header);
19340 - DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8610, quirk_fsl_pcie_header);
19341 -+DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1011E, quirk_fsl_pcie_header);
19342 -+DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1011, quirk_fsl_pcie_header);
19343 -+DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1013E, quirk_fsl_pcie_header);
19344 -+DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1013, quirk_fsl_pcie_header);
19345 -+DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1020E, quirk_fsl_pcie_header);
19346 -+DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1020, quirk_fsl_pcie_header);
19347 -+DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1022E, quirk_fsl_pcie_header);
19348 -+DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P1022, quirk_fsl_pcie_header);
19349 -+DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P2010E, quirk_fsl_pcie_header);
19350 -+DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P2010, quirk_fsl_pcie_header);
19351 - DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P2020E, quirk_fsl_pcie_header);
19352 - DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P2020, quirk_fsl_pcie_header);
19353 -+DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P4040E, quirk_fsl_pcie_header);
19354 -+DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P4040, quirk_fsl_pcie_header);
19355 -+DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P4080E, quirk_fsl_pcie_header);
19356 -+DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P4080, quirk_fsl_pcie_header);
19357 - #endif /* CONFIG_PPC_85xx || CONFIG_PPC_86xx */
19358 -
19359 - #if defined(CONFIG_PPC_83xx) || defined(CONFIG_PPC_MPC512x)
19360 -diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c
19361 -index ba9d8a7..b400964 100644
19362 ---- a/arch/s390/kvm/intercept.c
19363 -+++ b/arch/s390/kvm/intercept.c
19364 -@@ -213,7 +213,7 @@ static int handle_instruction_and_prog(struct kvm_vcpu *vcpu)
19365 - return rc2;
19366 - }
19367 -
19368 --static const intercept_handler_t intercept_funcs[0x48 >> 2] = {
19369 -+static const intercept_handler_t intercept_funcs[] = {
19370 - [0x00 >> 2] = handle_noop,
19371 - [0x04 >> 2] = handle_instruction,
19372 - [0x08 >> 2] = handle_prog,
19373 -@@ -230,7 +230,7 @@ int kvm_handle_sie_intercept(struct kvm_vcpu *vcpu)
19374 - intercept_handler_t func;
19375 - u8 code = vcpu->arch.sie_block->icptcode;
19376 -
19377 -- if (code & 3 || code > 0x48)
19378 -+ if (code & 3 || (code >> 2) >= ARRAY_SIZE(intercept_funcs))
19379 - return -ENOTSUPP;
19380 - func = intercept_funcs[code >> 2];
19381 - if (func)
19382 -diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
19383 -index 40e1835..a2a03cf 100644
19384 ---- a/arch/x86/kernel/cpu/intel.c
19385 -+++ b/arch/x86/kernel/cpu/intel.c
19386 -@@ -70,7 +70,6 @@ static void __cpuinit early_init_intel(struct cpuinfo_x86 *c)
19387 - if (c->x86_power & (1 << 8)) {
19388 - set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
19389 - set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
19390 -- set_cpu_cap(c, X86_FEATURE_TSC_RELIABLE);
19391 - sched_clock_stable = 1;
19392 - }
19393 -
19394 -diff --git a/arch/x86/kernel/cpuid.c b/arch/x86/kernel/cpuid.c
19395 -index f8590c5..0c91110 100644
19396 ---- a/arch/x86/kernel/cpuid.c
19397 -+++ b/arch/x86/kernel/cpuid.c
19398 -@@ -234,7 +234,7 @@ static void __exit cpuid_exit(void)
19399 - for_each_online_cpu(cpu)
19400 - cpuid_device_destroy(cpu);
19401 - class_destroy(cpuid_class);
19402 -- unregister_chrdev(CPUID_MAJOR, "cpu/cpuid");
19403 -+ __unregister_chrdev(CPUID_MAJOR, 0, NR_CPUS, "cpu/cpuid");
19404 - unregister_hotcpu_notifier(&cpuid_class_cpu_notifier);
19405 - }
19406 -
19407 -diff --git a/arch/x86/kernel/msr.c b/arch/x86/kernel/msr.c
19408 -index b42e63b..5eaeb5e 100644
19409 ---- a/arch/x86/kernel/msr.c
19410 -+++ b/arch/x86/kernel/msr.c
19411 -@@ -290,7 +290,7 @@ static void __exit msr_exit(void)
19412 - for_each_online_cpu(cpu)
19413 - msr_device_destroy(cpu);
19414 - class_destroy(msr_class);
19415 -- unregister_chrdev(MSR_MAJOR, "cpu/msr");
19416 -+ __unregister_chrdev(MSR_MAJOR, 0, NR_CPUS, "cpu/msr");
19417 - unregister_hotcpu_notifier(&msr_class_cpu_notifier);
19418 - }
19419 -
19420 -diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
19421 -index cd982f4..597683a 100644
19422 ---- a/arch/x86/kernel/tsc.c
19423 -+++ b/arch/x86/kernel/tsc.c
19424 -@@ -763,6 +763,7 @@ void mark_tsc_unstable(char *reason)
19425 - {
19426 - if (!tsc_unstable) {
19427 - tsc_unstable = 1;
19428 -+ sched_clock_stable = 0;
19429 - printk(KERN_INFO "Marking TSC unstable due to %s\n", reason);
19430 - /* Change only the rating, when not registered */
19431 - if (clocksource_tsc.mult)
19432 -diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
19433 -index 41659fb..8dfeaaa 100644
19434 ---- a/arch/x86/kvm/lapic.c
19435 -+++ b/arch/x86/kvm/lapic.c
19436 -@@ -374,6 +374,12 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode,
19437 - if (unlikely(!apic_enabled(apic)))
19438 - break;
19439 -
19440 -+ if (trig_mode) {
19441 -+ apic_debug("level trig mode for vector %d", vector);
19442 -+ apic_set_vector(vector, apic->regs + APIC_TMR);
19443 -+ } else
19444 -+ apic_clear_vector(vector, apic->regs + APIC_TMR);
19445 -+
19446 - result = !apic_test_and_set_irr(vector, apic);
19447 - trace_kvm_apic_accept_irq(vcpu->vcpu_id, delivery_mode,
19448 - trig_mode, vector, !result);
19449 -@@ -384,11 +390,6 @@ static int __apic_accept_irq(struct kvm_lapic *apic, int delivery_mode,
19450 - break;
19451 - }
19452 -
19453 -- if (trig_mode) {
19454 -- apic_debug("level trig mode for vector %d", vector);
19455 -- apic_set_vector(vector, apic->regs + APIC_TMR);
19456 -- } else
19457 -- apic_clear_vector(vector, apic->regs + APIC_TMR);
19458 - kvm_vcpu_kick(vcpu);
19459 - break;
19460 -
19461 -diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
19462 -index 818b92a..3a01519 100644
19463 ---- a/arch/x86/kvm/mmu.c
19464 -+++ b/arch/x86/kvm/mmu.c
19465 -@@ -477,7 +477,7 @@ static int host_mapping_level(struct kvm *kvm, gfn_t gfn)
19466 -
19467 - addr = gfn_to_hva(kvm, gfn);
19468 - if (kvm_is_error_hva(addr))
19469 -- return page_size;
19470 -+ return PT_PAGE_TABLE_LEVEL;
19471 -
19472 - down_read(&current->mm->mmap_sem);
19473 - vma = find_vma(current->mm, addr);
19474 -@@ -515,11 +515,9 @@ static int mapping_level(struct kvm_vcpu *vcpu, gfn_t large_gfn)
19475 - if (host_level == PT_PAGE_TABLE_LEVEL)
19476 - return host_level;
19477 -
19478 -- for (level = PT_DIRECTORY_LEVEL; level <= host_level; ++level) {
19479 --
19480 -+ for (level = PT_DIRECTORY_LEVEL; level <= host_level; ++level)
19481 - if (has_wrprotected_page(vcpu->kvm, large_gfn, level))
19482 - break;
19483 -- }
19484 -
19485 - return level - 1;
19486 - }
19487 -diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
19488 -index 85e12cd..5fa3325 100644
19489 ---- a/arch/x86/kvm/paging_tmpl.h
19490 -+++ b/arch/x86/kvm/paging_tmpl.h
19491 -@@ -150,7 +150,9 @@ walk:
19492 - walker->table_gfn[walker->level - 1] = table_gfn;
19493 - walker->pte_gpa[walker->level - 1] = pte_gpa;
19494 -
19495 -- kvm_read_guest(vcpu->kvm, pte_gpa, &pte, sizeof(pte));
19496 -+ if (kvm_read_guest(vcpu->kvm, pte_gpa, &pte, sizeof(pte)))
19497 -+ goto not_present;
19498 -+
19499 - trace_kvm_mmu_paging_element(pte, walker->level);
19500 -
19501 - if (!is_present_gpte(pte))
19502 -diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
19503 -index 97b31fa..6378e07 100644
19504 ---- a/arch/x86/kvm/x86.c
19505 -+++ b/arch/x86/kvm/x86.c
19506 -@@ -4766,12 +4766,13 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
19507 - GFP_KERNEL);
19508 - if (!vcpu->arch.mce_banks) {
19509 - r = -ENOMEM;
19510 -- goto fail_mmu_destroy;
19511 -+ goto fail_free_lapic;
19512 - }
19513 - vcpu->arch.mcg_cap = KVM_MAX_MCE_BANKS;
19514 -
19515 - return 0;
19516 --
19517 -+fail_free_lapic:
19518 -+ kvm_free_lapic(vcpu);
19519 - fail_mmu_destroy:
19520 - kvm_mmu_destroy(vcpu);
19521 - fail_free_pio_data:
19522 -@@ -4782,6 +4783,7 @@ fail:
19523 -
19524 - void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
19525 - {
19526 -+ kfree(vcpu->arch.mce_banks);
19527 - kvm_free_lapic(vcpu);
19528 - down_read(&vcpu->kvm->slots_lock);
19529 - kvm_mmu_destroy(vcpu);
19530 -diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
19531 -index bbd066e..a8f3ca6 100644
19532 ---- a/drivers/acpi/processor_idle.c
19533 -+++ b/drivers/acpi/processor_idle.c
19534 -@@ -299,6 +299,17 @@ static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
19535 - pr->power.states[ACPI_STATE_C2].latency = acpi_gbl_FADT.C2latency;
19536 - pr->power.states[ACPI_STATE_C3].latency = acpi_gbl_FADT.C3latency;
19537 -
19538 -+ /*
19539 -+ * FADT specified C2 latency must be less than or equal to
19540 -+ * 100 microseconds.
19541 -+ */
19542 -+ if (acpi_gbl_FADT.C2latency > ACPI_PROCESSOR_MAX_C2_LATENCY) {
19543 -+ ACPI_DEBUG_PRINT((ACPI_DB_INFO,
19544 -+ "C2 latency too large [%d]\n", acpi_gbl_FADT.C2latency));
19545 -+ /* invalidate C2 */
19546 -+ pr->power.states[ACPI_STATE_C2].address = 0;
19547 -+ }
19548 -+
19549 - ACPI_DEBUG_PRINT((ACPI_DB_INFO,
19550 - "lvl2[0x%08x] lvl3[0x%08x]\n",
19551 - pr->power.states[ACPI_STATE_C2].address,
19552 -@@ -495,16 +506,6 @@ static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx)
19553 - return;
19554 -
19555 - /*
19556 -- * C2 latency must be less than or equal to 100
19557 -- * microseconds.
19558 -- */
19559 -- else if (cx->latency > ACPI_PROCESSOR_MAX_C2_LATENCY) {
19560 -- ACPI_DEBUG_PRINT((ACPI_DB_INFO,
19561 -- "latency too large [%d]\n", cx->latency));
19562 -- return;
19563 -- }
19564 --
19565 -- /*
19566 - * Otherwise we've met all of our C2 requirements.
19567 - * Normalize the C2 latency to expidite policy
19568 - */
19569 -diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
19570 -index a3241a1..9519c77 100644
19571 ---- a/drivers/ata/ahci.c
19572 -+++ b/drivers/ata/ahci.c
19573 -@@ -113,6 +113,7 @@ enum {
19574 - board_ahci_mcp65 = 6,
19575 - board_ahci_nopmp = 7,
19576 - board_ahci_yesncq = 8,
19577 -+ board_ahci_nosntf = 9,
19578 -
19579 - /* global controller registers */
19580 - HOST_CAP = 0x00, /* host capabilities */
19581 -@@ -235,6 +236,7 @@ enum {
19582 - AHCI_HFLAG_NO_SUSPEND = (1 << 10), /* don't suspend */
19583 - AHCI_HFLAG_SRST_TOUT_IS_OFFLINE = (1 << 11), /* treat SRST timeout as
19584 - link offline */
19585 -+ AHCI_HFLAG_NO_SNTF = (1 << 12), /* no sntf */
19586 -
19587 - /* ap->flags bits */
19588 -
19589 -@@ -508,7 +510,7 @@ static const struct ata_port_info ahci_port_info[] = {
19590 - .udma_mask = ATA_UDMA6,
19591 - .port_ops = &ahci_ops,
19592 - },
19593 -- /* board_ahci_yesncq */
19594 -+ [board_ahci_yesncq] =
19595 - {
19596 - AHCI_HFLAGS (AHCI_HFLAG_YES_NCQ),
19597 - .flags = AHCI_FLAG_COMMON,
19598 -@@ -516,6 +518,14 @@ static const struct ata_port_info ahci_port_info[] = {
19599 - .udma_mask = ATA_UDMA6,
19600 - .port_ops = &ahci_ops,
19601 - },
19602 -+ [board_ahci_nosntf] =
19603 -+ {
19604 -+ AHCI_HFLAGS (AHCI_HFLAG_NO_SNTF),
19605 -+ .flags = AHCI_FLAG_COMMON,
19606 -+ .pio_mask = ATA_PIO4,
19607 -+ .udma_mask = ATA_UDMA6,
19608 -+ .port_ops = &ahci_ops,
19609 -+ },
19610 - };
19611 -
19612 - static const struct pci_device_id ahci_pci_tbl[] = {
19613 -@@ -531,7 +541,7 @@ static const struct pci_device_id ahci_pci_tbl[] = {
19614 - { PCI_VDEVICE(INTEL, 0x2683), board_ahci }, /* ESB2 */
19615 - { PCI_VDEVICE(INTEL, 0x27c6), board_ahci }, /* ICH7-M DH */
19616 - { PCI_VDEVICE(INTEL, 0x2821), board_ahci }, /* ICH8 */
19617 -- { PCI_VDEVICE(INTEL, 0x2822), board_ahci }, /* ICH8 */
19618 -+ { PCI_VDEVICE(INTEL, 0x2822), board_ahci_nosntf }, /* ICH8 */
19619 - { PCI_VDEVICE(INTEL, 0x2824), board_ahci }, /* ICH8 */
19620 - { PCI_VDEVICE(INTEL, 0x2829), board_ahci }, /* ICH8M */
19621 - { PCI_VDEVICE(INTEL, 0x282a), board_ahci }, /* ICH8M */
19622 -@@ -849,6 +859,12 @@ static void ahci_save_initial_config(struct pci_dev *pdev,
19623 - cap &= ~HOST_CAP_PMP;
19624 - }
19625 -
19626 -+ if ((cap & HOST_CAP_SNTF) && (hpriv->flags & AHCI_HFLAG_NO_SNTF)) {
19627 -+ dev_printk(KERN_INFO, &pdev->dev,
19628 -+ "controller can't do SNTF, turning off CAP_SNTF\n");
19629 -+ cap &= ~HOST_CAP_SNTF;
19630 -+ }
19631 -+
19632 - if (pdev->vendor == PCI_VENDOR_ID_JMICRON && pdev->device == 0x2361 &&
19633 - port_map != 1) {
19634 - dev_printk(KERN_INFO, &pdev->dev,
19635 -diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c
19636 -index 9ac4e37..0c6155f 100644
19637 ---- a/drivers/ata/ata_piix.c
19638 -+++ b/drivers/ata/ata_piix.c
19639 -@@ -869,10 +869,10 @@ static void do_pata_set_dmamode(struct ata_port *ap, struct ata_device *adev, in
19640 - (timings[pio][1] << 8);
19641 - }
19642 -
19643 -- if (ap->udma_mask) {
19644 -+ if (ap->udma_mask)
19645 - udma_enable &= ~(1 << devid);
19646 -- pci_write_config_word(dev, master_port, master_data);
19647 -- }
19648 -+
19649 -+ pci_write_config_word(dev, master_port, master_data);
19650 - }
19651 - /* Don't scribble on 0x48 if the controller does not support UDMA */
19652 - if (ap->udma_mask)
19653 -diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
19654 -index a1cb5af..33faaa2 100644
19655 ---- a/drivers/base/devtmpfs.c
19656 -+++ b/drivers/base/devtmpfs.c
19657 -@@ -353,6 +353,7 @@ int __init devtmpfs_init(void)
19658 - {
19659 - int err;
19660 - struct vfsmount *mnt;
19661 -+ char options[] = "mode=0755";
19662 -
19663 - err = register_filesystem(&dev_fs_type);
19664 - if (err) {
19665 -@@ -361,7 +362,7 @@ int __init devtmpfs_init(void)
19666 - return err;
19667 - }
19668 -
19669 -- mnt = kern_mount(&dev_fs_type);
19670 -+ mnt = kern_mount_data(&dev_fs_type, options);
19671 - if (IS_ERR(mnt)) {
19672 - err = PTR_ERR(mnt);
19673 - printk(KERN_ERR "devtmpfs: unable to create devtmpfs %i\n", err);
19674 -diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c
19675 -index 938100f..3a2ccb0 100644
19676 ---- a/drivers/firmware/dmi_scan.c
19677 -+++ b/drivers/firmware/dmi_scan.c
19678 -@@ -429,7 +429,7 @@ static bool dmi_matches(const struct dmi_system_id *dmi)
19679 - for (i = 0; i < ARRAY_SIZE(dmi->matches); i++) {
19680 - int s = dmi->matches[i].slot;
19681 - if (s == DMI_NONE)
19682 -- continue;
19683 -+ break;
19684 - if (dmi_ident[s]
19685 - && strstr(dmi_ident[s], dmi->matches[i].substr))
19686 - continue;
19687 -@@ -440,6 +440,15 @@ static bool dmi_matches(const struct dmi_system_id *dmi)
19688 - }
19689 -
19690 - /**
19691 -+ * dmi_is_end_of_table - check for end-of-table marker
19692 -+ * @dmi: pointer to the dmi_system_id structure to check
19693 -+ */
19694 -+static bool dmi_is_end_of_table(const struct dmi_system_id *dmi)
19695 -+{
19696 -+ return dmi->matches[0].slot == DMI_NONE;
19697 -+}
19698 -+
19699 -+/**
19700 - * dmi_check_system - check system DMI data
19701 - * @list: array of dmi_system_id structures to match against
19702 - * All non-null elements of the list must match
19703 -@@ -457,7 +466,7 @@ int dmi_check_system(const struct dmi_system_id *list)
19704 - int count = 0;
19705 - const struct dmi_system_id *d;
19706 -
19707 -- for (d = list; d->ident; d++)
19708 -+ for (d = list; !dmi_is_end_of_table(d); d++)
19709 - if (dmi_matches(d)) {
19710 - count++;
19711 - if (d->callback && d->callback(d))
19712 -@@ -484,7 +493,7 @@ const struct dmi_system_id *dmi_first_match(const struct dmi_system_id *list)
19713 - {
19714 - const struct dmi_system_id *d;
19715 -
19716 -- for (d = list; d->ident; d++)
19717 -+ for (d = list; !dmi_is_end_of_table(d); d++)
19718 - if (dmi_matches(d))
19719 - return d;
19720 -
19721 -diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
19722 -index 03bd703..5d901f6 100644
19723 ---- a/drivers/hid/usbhid/hid-core.c
19724 -+++ b/drivers/hid/usbhid/hid-core.c
19725 -@@ -998,7 +998,8 @@ static int usbhid_start(struct hid_device *hid)
19726 - usbhid->urbctrl->transfer_dma = usbhid->ctrlbuf_dma;
19727 - usbhid->urbctrl->transfer_flags |= (URB_NO_TRANSFER_DMA_MAP | URB_NO_SETUP_DMA_MAP);
19728 -
19729 -- usbhid_init_reports(hid);
19730 -+ if (!(hid->quirks & HID_QUIRK_NO_INIT_REPORTS))
19731 -+ usbhid_init_reports(hid);
19732 -
19733 - set_bit(HID_STARTED, &usbhid->iofl);
19734 -
19735 -diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
19736 -index 0d9045a..5713b93 100644
19737 ---- a/drivers/hid/usbhid/hid-quirks.c
19738 -+++ b/drivers/hid/usbhid/hid-quirks.c
19739 -@@ -280,7 +280,7 @@ u32 usbhid_lookup_quirk(const u16 idVendor, const u16 idProduct)
19740 - if (idVendor == USB_VENDOR_ID_NCR &&
19741 - idProduct >= USB_DEVICE_ID_NCR_FIRST &&
19742 - idProduct <= USB_DEVICE_ID_NCR_LAST)
19743 -- return HID_QUIRK_NOGET;
19744 -+ return HID_QUIRK_NO_INIT_REPORTS;
19745 -
19746 - down_read(&dquirks_rwsem);
19747 - bl_entry = usbhid_exists_dquirk(idVendor, idProduct);
19748 -diff --git a/drivers/hwmon/fschmd.c b/drivers/hwmon/fschmd.c
19749 -index da1b1f9..f600813 100644
19750 ---- a/drivers/hwmon/fschmd.c
19751 -+++ b/drivers/hwmon/fschmd.c
19752 -@@ -767,6 +767,7 @@ leave:
19753 - static int watchdog_open(struct inode *inode, struct file *filp)
19754 - {
19755 - struct fschmd_data *pos, *data = NULL;
19756 -+ int watchdog_is_open;
19757 -
19758 - /* We get called from drivers/char/misc.c with misc_mtx hold, and we
19759 - call misc_register() from fschmd_probe() with watchdog_data_mutex
19760 -@@ -781,10 +782,12 @@ static int watchdog_open(struct inode *inode, struct file *filp)
19761 - }
19762 - }
19763 - /* Note we can never not have found data, so we don't check for this */
19764 -- kref_get(&data->kref);
19765 -+ watchdog_is_open = test_and_set_bit(0, &data->watchdog_is_open);
19766 -+ if (!watchdog_is_open)
19767 -+ kref_get(&data->kref);
19768 - mutex_unlock(&watchdog_data_mutex);
19769 -
19770 -- if (test_and_set_bit(0, &data->watchdog_is_open))
19771 -+ if (watchdog_is_open)
19772 - return -EBUSY;
19773 -
19774 - /* Start the watchdog */
19775 -diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
19776 -index 2bf5116..df3eb8c 100644
19777 ---- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
19778 -+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
19779 -@@ -884,6 +884,7 @@ struct ipoib_neigh *ipoib_neigh_alloc(struct neighbour *neighbour,
19780 -
19781 - neigh->neighbour = neighbour;
19782 - neigh->dev = dev;
19783 -+ memset(&neigh->dgid.raw, 0, sizeof (union ib_gid));
19784 - *to_ipoib_neigh(neighbour) = neigh;
19785 - skb_queue_head_init(&neigh->queue);
19786 - ipoib_cm_set(neigh, NULL);
19787 -diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c
19788 -index f361106..fc8823b 100644
19789 ---- a/drivers/input/mouse/alps.c
19790 -+++ b/drivers/input/mouse/alps.c
19791 -@@ -5,6 +5,7 @@
19792 - * Copyright (c) 2003-2005 Peter Osterlund <petero2@×××××.com>
19793 - * Copyright (c) 2004 Dmitry Torokhov <dtor@××××.ru>
19794 - * Copyright (c) 2005 Vojtech Pavlik <vojtech@××××.cz>
19795 -+ * Copyright (c) 2009 Sebastian Kapfer <sebastian_kapfer@×××.net>
19796 - *
19797 - * ALPS detection, tap switching and status querying info is taken from
19798 - * tpconfig utility (by C. Scott Ananian and Bruce Kall).
19799 -@@ -35,6 +36,8 @@
19800 - #define ALPS_OLDPROTO 0x10
19801 - #define ALPS_PASS 0x20
19802 - #define ALPS_FW_BK_2 0x40
19803 -+#define ALPS_PS2_INTERLEAVED 0x80 /* 3-byte PS/2 packet interleaved with
19804 -+ 6-byte ALPS packet */
19805 -
19806 - static const struct alps_model_info alps_model_data[] = {
19807 - { { 0x32, 0x02, 0x14 }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* Toshiba Salellite Pro M10 */
19808 -@@ -55,7 +58,9 @@ static const struct alps_model_info alps_model_data[] = {
19809 - { { 0x20, 0x02, 0x0e }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT }, /* XXX */
19810 - { { 0x22, 0x02, 0x0a }, 0xf8, 0xf8, ALPS_PASS | ALPS_DUALPOINT },
19811 - { { 0x22, 0x02, 0x14 }, 0xff, 0xff, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude D600 */
19812 -- { { 0x62, 0x02, 0x14 }, 0xcf, 0xcf, ALPS_PASS | ALPS_DUALPOINT }, /* Dell Latitude E6500 */
19813 -+ /* Dell Latitude E5500, E6400, E6500, Precision M4400 */
19814 -+ { { 0x62, 0x02, 0x14 }, 0xcf, 0xcf,
19815 -+ ALPS_PASS | ALPS_DUALPOINT | ALPS_PS2_INTERLEAVED },
19816 - { { 0x73, 0x02, 0x50 }, 0xcf, 0xcf, ALPS_FW_BK_1 }, /* Dell Vostro 1400 */
19817 - };
19818 -
19819 -@@ -66,20 +71,88 @@ static const struct alps_model_info alps_model_data[] = {
19820 - */
19821 -
19822 - /*
19823 -- * ALPS abolute Mode - new format
19824 -+ * PS/2 packet format
19825 -+ *
19826 -+ * byte 0: 0 0 YSGN XSGN 1 M R L
19827 -+ * byte 1: X7 X6 X5 X4 X3 X2 X1 X0
19828 -+ * byte 2: Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0
19829 -+ *
19830 -+ * Note that the device never signals overflow condition.
19831 -+ *
19832 -+ * ALPS absolute Mode - new format
19833 - *
19834 - * byte 0: 1 ? ? ? 1 ? ? ?
19835 - * byte 1: 0 x6 x5 x4 x3 x2 x1 x0
19836 -- * byte 2: 0 x10 x9 x8 x7 ? fin ges
19837 -+ * byte 2: 0 x10 x9 x8 x7 ? fin ges
19838 - * byte 3: 0 y9 y8 y7 1 M R L
19839 - * byte 4: 0 y6 y5 y4 y3 y2 y1 y0
19840 - * byte 5: 0 z6 z5 z4 z3 z2 z1 z0
19841 - *
19842 -+ * Dualpoint device -- interleaved packet format
19843 -+ *
19844 -+ * byte 0: 1 1 0 0 1 1 1 1
19845 -+ * byte 1: 0 x6 x5 x4 x3 x2 x1 x0
19846 -+ * byte 2: 0 x10 x9 x8 x7 0 fin ges
19847 -+ * byte 3: 0 0 YSGN XSGN 1 1 1 1
19848 -+ * byte 4: X7 X6 X5 X4 X3 X2 X1 X0
19849 -+ * byte 5: Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0
19850 -+ * byte 6: 0 y9 y8 y7 1 m r l
19851 -+ * byte 7: 0 y6 y5 y4 y3 y2 y1 y0
19852 -+ * byte 8: 0 z6 z5 z4 z3 z2 z1 z0
19853 -+ *
19854 -+ * CAPITALS = stick, miniscules = touchpad
19855 -+ *
19856 - * ?'s can have different meanings on different models,
19857 - * such as wheel rotation, extra buttons, stick buttons
19858 - * on a dualpoint, etc.
19859 - */
19860 -
19861 -+static bool alps_is_valid_first_byte(const struct alps_model_info *model,
19862 -+ unsigned char data)
19863 -+{
19864 -+ return (data & model->mask0) == model->byte0;
19865 -+}
19866 -+
19867 -+static void alps_report_buttons(struct psmouse *psmouse,
19868 -+ struct input_dev *dev1, struct input_dev *dev2,
19869 -+ int left, int right, int middle)
19870 -+{
19871 -+ struct alps_data *priv = psmouse->private;
19872 -+ const struct alps_model_info *model = priv->i;
19873 -+
19874 -+ if (model->flags & ALPS_PS2_INTERLEAVED) {
19875 -+ struct input_dev *dev;
19876 -+
19877 -+ /*
19878 -+ * If shared button has already been reported on the
19879 -+ * other device (dev2) then this event should be also
19880 -+ * sent through that device.
19881 -+ */
19882 -+ dev = test_bit(BTN_LEFT, dev2->key) ? dev2 : dev1;
19883 -+ input_report_key(dev, BTN_LEFT, left);
19884 -+
19885 -+ dev = test_bit(BTN_RIGHT, dev2->key) ? dev2 : dev1;
19886 -+ input_report_key(dev, BTN_RIGHT, right);
19887 -+
19888 -+ dev = test_bit(BTN_MIDDLE, dev2->key) ? dev2 : dev1;
19889 -+ input_report_key(dev, BTN_MIDDLE, middle);
19890 -+
19891 -+ /*
19892 -+ * Sync the _other_ device now, we'll do the first
19893 -+ * device later once we report the rest of the events.
19894 -+ */
19895 -+ input_sync(dev2);
19896 -+ } else {
19897 -+ /*
19898 -+ * For devices with non-interleaved packets we know what
19899 -+ * device buttons belong to so we can simply report them.
19900 -+ */
19901 -+ input_report_key(dev1, BTN_LEFT, left);
19902 -+ input_report_key(dev1, BTN_RIGHT, right);
19903 -+ input_report_key(dev1, BTN_MIDDLE, middle);
19904 -+ }
19905 -+}
19906 -+
19907 - static void alps_process_packet(struct psmouse *psmouse)
19908 - {
19909 - struct alps_data *priv = psmouse->private;
19910 -@@ -89,18 +162,6 @@ static void alps_process_packet(struct psmouse *psmouse)
19911 - int x, y, z, ges, fin, left, right, middle;
19912 - int back = 0, forward = 0;
19913 -
19914 -- if ((packet[0] & 0xc8) == 0x08) { /* 3-byte PS/2 packet */
19915 -- input_report_key(dev2, BTN_LEFT, packet[0] & 1);
19916 -- input_report_key(dev2, BTN_RIGHT, packet[0] & 2);
19917 -- input_report_key(dev2, BTN_MIDDLE, packet[0] & 4);
19918 -- input_report_rel(dev2, REL_X,
19919 -- packet[1] ? packet[1] - ((packet[0] << 4) & 0x100) : 0);
19920 -- input_report_rel(dev2, REL_Y,
19921 -- packet[2] ? ((packet[0] << 3) & 0x100) - packet[2] : 0);
19922 -- input_sync(dev2);
19923 -- return;
19924 -- }
19925 --
19926 - if (priv->i->flags & ALPS_OLDPROTO) {
19927 - left = packet[2] & 0x10;
19928 - right = packet[2] & 0x08;
19929 -@@ -136,18 +197,13 @@ static void alps_process_packet(struct psmouse *psmouse)
19930 - input_report_rel(dev2, REL_X, (x > 383 ? (x - 768) : x));
19931 - input_report_rel(dev2, REL_Y, -(y > 255 ? (y - 512) : y));
19932 -
19933 -- input_report_key(dev2, BTN_LEFT, left);
19934 -- input_report_key(dev2, BTN_RIGHT, right);
19935 -- input_report_key(dev2, BTN_MIDDLE, middle);
19936 -+ alps_report_buttons(psmouse, dev2, dev, left, right, middle);
19937 -
19938 -- input_sync(dev);
19939 - input_sync(dev2);
19940 - return;
19941 - }
19942 -
19943 -- input_report_key(dev, BTN_LEFT, left);
19944 -- input_report_key(dev, BTN_RIGHT, right);
19945 -- input_report_key(dev, BTN_MIDDLE, middle);
19946 -+ alps_report_buttons(psmouse, dev, dev2, left, right, middle);
19947 -
19948 - /* Convert hardware tap to a reasonable Z value */
19949 - if (ges && !fin) z = 40;
19950 -@@ -188,25 +244,168 @@ static void alps_process_packet(struct psmouse *psmouse)
19951 - input_sync(dev);
19952 - }
19953 -
19954 -+static void alps_report_bare_ps2_packet(struct psmouse *psmouse,
19955 -+ unsigned char packet[],
19956 -+ bool report_buttons)
19957 -+{
19958 -+ struct alps_data *priv = psmouse->private;
19959 -+ struct input_dev *dev2 = priv->dev2;
19960 -+
19961 -+ if (report_buttons)
19962 -+ alps_report_buttons(psmouse, dev2, psmouse->dev,
19963 -+ packet[0] & 1, packet[0] & 2, packet[0] & 4);
19964 -+
19965 -+ input_report_rel(dev2, REL_X,
19966 -+ packet[1] ? packet[1] - ((packet[0] << 4) & 0x100) : 0);
19967 -+ input_report_rel(dev2, REL_Y,
19968 -+ packet[2] ? ((packet[0] << 3) & 0x100) - packet[2] : 0);
19969 -+
19970 -+ input_sync(dev2);
19971 -+}
19972 -+
19973 -+static psmouse_ret_t alps_handle_interleaved_ps2(struct psmouse *psmouse)
19974 -+{
19975 -+ struct alps_data *priv = psmouse->private;
19976 -+
19977 -+ if (psmouse->pktcnt < 6)
19978 -+ return PSMOUSE_GOOD_DATA;
19979 -+
19980 -+ if (psmouse->pktcnt == 6) {
19981 -+ /*
19982 -+ * Start a timer to flush the packet if it ends up last
19983 -+ * 6-byte packet in the stream. Timer needs to fire
19984 -+ * psmouse core times out itself. 20 ms should be enough
19985 -+ * to decide if we are getting more data or not.
19986 -+ */
19987 -+ mod_timer(&priv->timer, jiffies + msecs_to_jiffies(20));
19988 -+ return PSMOUSE_GOOD_DATA;
19989 -+ }
19990 -+
19991 -+ del_timer(&priv->timer);
19992 -+
19993 -+ if (psmouse->packet[6] & 0x80) {
19994 -+
19995 -+ /*
19996 -+ * Highest bit is set - that means we either had
19997 -+ * complete ALPS packet and this is start of the
19998 -+ * next packet or we got garbage.
19999 -+ */
20000 -+
20001 -+ if (((psmouse->packet[3] |
20002 -+ psmouse->packet[4] |
20003 -+ psmouse->packet[5]) & 0x80) ||
20004 -+ (!alps_is_valid_first_byte(priv->i, psmouse->packet[6]))) {
20005 -+ dbg("refusing packet %x %x %x %x "
20006 -+ "(suspected interleaved ps/2)\n",
20007 -+ psmouse->packet[3], psmouse->packet[4],
20008 -+ psmouse->packet[5], psmouse->packet[6]);
20009 -+ return PSMOUSE_BAD_DATA;
20010 -+ }
20011 -+
20012 -+ alps_process_packet(psmouse);
20013 -+
20014 -+ /* Continue with the next packet */
20015 -+ psmouse->packet[0] = psmouse->packet[6];
20016 -+ psmouse->pktcnt = 1;
20017 -+
20018 -+ } else {
20019 -+
20020 -+ /*
20021 -+ * High bit is 0 - that means that we indeed got a PS/2
20022 -+ * packet in the middle of ALPS packet.
20023 -+ *
20024 -+ * There is also possibility that we got 6-byte ALPS
20025 -+ * packet followed by 3-byte packet from trackpoint. We
20026 -+ * can not distinguish between these 2 scenarios but
20027 -+ * becase the latter is unlikely to happen in course of
20028 -+ * normal operation (user would need to press all
20029 -+ * buttons on the pad and start moving trackpoint
20030 -+ * without touching the pad surface) we assume former.
20031 -+ * Even if we are wrong the wost thing that would happen
20032 -+ * the cursor would jump but we should not get protocol
20033 -+ * desynchronization.
20034 -+ */
20035 -+
20036 -+ alps_report_bare_ps2_packet(psmouse, &psmouse->packet[3],
20037 -+ false);
20038 -+
20039 -+ /*
20040 -+ * Continue with the standard ALPS protocol handling,
20041 -+ * but make sure we won't process it as an interleaved
20042 -+ * packet again, which may happen if all buttons are
20043 -+ * pressed. To avoid this let's reset the 4th bit which
20044 -+ * is normally 1.
20045 -+ */
20046 -+ psmouse->packet[3] = psmouse->packet[6] & 0xf7;
20047 -+ psmouse->pktcnt = 4;
20048 -+ }
20049 -+
20050 -+ return PSMOUSE_GOOD_DATA;
20051 -+}
20052 -+
20053 -+static void alps_flush_packet(unsigned long data)
20054 -+{
20055 -+ struct psmouse *psmouse = (struct psmouse *)data;
20056 -+
20057 -+ serio_pause_rx(psmouse->ps2dev.serio);
20058 -+
20059 -+ if (psmouse->pktcnt == 6) {
20060 -+
20061 -+ /*
20062 -+ * We did not any more data in reasonable amount of time.
20063 -+ * Validate the last 3 bytes and process as a standard
20064 -+ * ALPS packet.
20065 -+ */
20066 -+ if ((psmouse->packet[3] |
20067 -+ psmouse->packet[4] |
20068 -+ psmouse->packet[5]) & 0x80) {
20069 -+ dbg("refusing packet %x %x %x "
20070 -+ "(suspected interleaved ps/2)\n",
20071 -+ psmouse->packet[3], psmouse->packet[4],
20072 -+ psmouse->packet[5]);
20073 -+ } else {
20074 -+ alps_process_packet(psmouse);
20075 -+ }
20076 -+ psmouse->pktcnt = 0;
20077 -+ }
20078 -+
20079 -+ serio_continue_rx(psmouse->ps2dev.serio);
20080 -+}
20081 -+
20082 - static psmouse_ret_t alps_process_byte(struct psmouse *psmouse)
20083 - {
20084 - struct alps_data *priv = psmouse->private;
20085 -+ const struct alps_model_info *model = priv->i;
20086 -
20087 - if ((psmouse->packet[0] & 0xc8) == 0x08) { /* PS/2 packet */
20088 - if (psmouse->pktcnt == 3) {
20089 -- alps_process_packet(psmouse);
20090 -+ alps_report_bare_ps2_packet(psmouse, psmouse->packet,
20091 -+ true);
20092 - return PSMOUSE_FULL_PACKET;
20093 - }
20094 - return PSMOUSE_GOOD_DATA;
20095 - }
20096 -
20097 -- if ((psmouse->packet[0] & priv->i->mask0) != priv->i->byte0)
20098 -+ /* Check for PS/2 packet stuffed in the middle of ALPS packet. */
20099 -+
20100 -+ if ((model->flags & ALPS_PS2_INTERLEAVED) &&
20101 -+ psmouse->pktcnt >= 4 && (psmouse->packet[3] & 0x0f) == 0x0f) {
20102 -+ return alps_handle_interleaved_ps2(psmouse);
20103 -+ }
20104 -+
20105 -+ if (!alps_is_valid_first_byte(model, psmouse->packet[0])) {
20106 -+ dbg("refusing packet[0] = %x (mask0 = %x, byte0 = %x)\n",
20107 -+ psmouse->packet[0], model->mask0, model->byte0);
20108 - return PSMOUSE_BAD_DATA;
20109 -+ }
20110 -
20111 - /* Bytes 2 - 6 should have 0 in the highest bit */
20112 - if (psmouse->pktcnt >= 2 && psmouse->pktcnt <= 6 &&
20113 -- (psmouse->packet[psmouse->pktcnt - 1] & 0x80))
20114 -+ (psmouse->packet[psmouse->pktcnt - 1] & 0x80)) {
20115 -+ dbg("refusing packet[%i] = %x\n",
20116 -+ psmouse->pktcnt - 1, psmouse->packet[psmouse->pktcnt - 1]);
20117 - return PSMOUSE_BAD_DATA;
20118 -+ }
20119 -
20120 - if (psmouse->pktcnt == 6) {
20121 - alps_process_packet(psmouse);
20122 -@@ -445,6 +644,7 @@ static void alps_disconnect(struct psmouse *psmouse)
20123 - struct alps_data *priv = psmouse->private;
20124 -
20125 - psmouse_reset(psmouse);
20126 -+ del_timer_sync(&priv->timer);
20127 - input_unregister_device(priv->dev2);
20128 - kfree(priv);
20129 - }
20130 -@@ -461,6 +661,8 @@ int alps_init(struct psmouse *psmouse)
20131 - goto init_fail;
20132 -
20133 - priv->dev2 = dev2;
20134 -+ setup_timer(&priv->timer, alps_flush_packet, (unsigned long)psmouse);
20135 -+
20136 - psmouse->private = priv;
20137 -
20138 - if (alps_hw_init(psmouse, &version))
20139 -diff --git a/drivers/input/mouse/alps.h b/drivers/input/mouse/alps.h
20140 -index bc87936..904ed8b 100644
20141 ---- a/drivers/input/mouse/alps.h
20142 -+++ b/drivers/input/mouse/alps.h
20143 -@@ -23,6 +23,7 @@ struct alps_data {
20144 - char phys[32]; /* Phys */
20145 - const struct alps_model_info *i;/* Info */
20146 - int prev_fin; /* Finger bit from previous packet */
20147 -+ struct timer_list timer;
20148 - };
20149 -
20150 - #ifdef CONFIG_MOUSE_PS2_ALPS
20151 -diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
20152 -index 2bcf1ac..2a5982e 100644
20153 ---- a/drivers/input/serio/i8042-x86ia64io.h
20154 -+++ b/drivers/input/serio/i8042-x86ia64io.h
20155 -@@ -67,10 +67,12 @@ static inline void i8042_write_command(int val)
20156 -
20157 - #include <linux/dmi.h>
20158 -
20159 --static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = {
20160 -+static const struct dmi_system_id __initconst i8042_dmi_noloop_table[] = {
20161 - {
20162 -- /* AUX LOOP command does not raise AUX IRQ */
20163 -- .ident = "Arima-Rioworks HDAMB",
20164 -+ /*
20165 -+ * Arima-Rioworks HDAMB -
20166 -+ * AUX LOOP command does not raise AUX IRQ
20167 -+ */
20168 - .matches = {
20169 - DMI_MATCH(DMI_BOARD_VENDOR, "RIOWORKS"),
20170 - DMI_MATCH(DMI_BOARD_NAME, "HDAMB"),
20171 -@@ -78,7 +80,7 @@ static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = {
20172 - },
20173 - },
20174 - {
20175 -- .ident = "ASUS G1S",
20176 -+ /* ASUS G1S */
20177 - .matches = {
20178 - DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer Inc."),
20179 - DMI_MATCH(DMI_BOARD_NAME, "G1S"),
20180 -@@ -86,8 +88,7 @@ static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = {
20181 - },
20182 - },
20183 - {
20184 -- /* AUX LOOP command does not raise AUX IRQ */
20185 -- .ident = "ASUS P65UP5",
20186 -+ /* ASUS P65UP5 - AUX LOOP command does not raise AUX IRQ */
20187 - .matches = {
20188 - DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
20189 - DMI_MATCH(DMI_BOARD_NAME, "P/I-P65UP5"),
20190 -@@ -95,7 +96,6 @@ static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = {
20191 - },
20192 - },
20193 - {
20194 -- .ident = "Compaq Proliant 8500",
20195 - .matches = {
20196 - DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
20197 - DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"),
20198 -@@ -103,7 +103,6 @@ static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = {
20199 - },
20200 - },
20201 - {
20202 -- .ident = "Compaq Proliant DL760",
20203 - .matches = {
20204 - DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
20205 - DMI_MATCH(DMI_PRODUCT_NAME , "ProLiant"),
20206 -@@ -111,7 +110,7 @@ static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = {
20207 - },
20208 - },
20209 - {
20210 -- .ident = "OQO Model 01",
20211 -+ /* OQO Model 01 */
20212 - .matches = {
20213 - DMI_MATCH(DMI_SYS_VENDOR, "OQO"),
20214 - DMI_MATCH(DMI_PRODUCT_NAME, "ZEPTO"),
20215 -@@ -119,8 +118,7 @@ static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = {
20216 - },
20217 - },
20218 - {
20219 -- /* AUX LOOP does not work properly */
20220 -- .ident = "ULI EV4873",
20221 -+ /* ULI EV4873 - AUX LOOP does not work properly */
20222 - .matches = {
20223 - DMI_MATCH(DMI_SYS_VENDOR, "ULI"),
20224 - DMI_MATCH(DMI_PRODUCT_NAME, "EV4873"),
20225 -@@ -128,7 +126,7 @@ static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = {
20226 - },
20227 - },
20228 - {
20229 -- .ident = "Microsoft Virtual Machine",
20230 -+ /* Microsoft Virtual Machine */
20231 - .matches = {
20232 - DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
20233 - DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"),
20234 -@@ -136,7 +134,7 @@ static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = {
20235 - },
20236 - },
20237 - {
20238 -- .ident = "Medion MAM 2070",
20239 -+ /* Medion MAM 2070 */
20240 - .matches = {
20241 - DMI_MATCH(DMI_SYS_VENDOR, "Notebook"),
20242 - DMI_MATCH(DMI_PRODUCT_NAME, "MAM 2070"),
20243 -@@ -144,7 +142,7 @@ static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = {
20244 - },
20245 - },
20246 - {
20247 -- .ident = "Blue FB5601",
20248 -+ /* Blue FB5601 */
20249 - .matches = {
20250 - DMI_MATCH(DMI_SYS_VENDOR, "blue"),
20251 - DMI_MATCH(DMI_PRODUCT_NAME, "FB5601"),
20252 -@@ -152,7 +150,7 @@ static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = {
20253 - },
20254 - },
20255 - {
20256 -- .ident = "Gigabyte M912",
20257 -+ /* Gigabyte M912 */
20258 - .matches = {
20259 - DMI_MATCH(DMI_SYS_VENDOR, "GIGABYTE"),
20260 - DMI_MATCH(DMI_PRODUCT_NAME, "M912"),
20261 -@@ -160,7 +158,14 @@ static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = {
20262 - },
20263 - },
20264 - {
20265 -- .ident = "HP DV9700",
20266 -+ /* Gigabyte M1022M netbook */
20267 -+ .matches = {
20268 -+ DMI_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co.,Ltd."),
20269 -+ DMI_MATCH(DMI_BOARD_NAME, "M1022E"),
20270 -+ DMI_MATCH(DMI_BOARD_VERSION, "1.02"),
20271 -+ },
20272 -+ },
20273 -+ {
20274 - .matches = {
20275 - DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
20276 - DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion dv9700"),
20277 -@@ -177,72 +182,72 @@ static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = {
20278 - * ... apparently some Toshibas don't like MUX mode either and
20279 - * die horrible death on reboot.
20280 - */
20281 --static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = {
20282 -+static const struct dmi_system_id __initconst i8042_dmi_nomux_table[] = {
20283 - {
20284 -- .ident = "Fujitsu Lifebook P7010/P7010D",
20285 -+ /* Fujitsu Lifebook P7010/P7010D */
20286 - .matches = {
20287 - DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
20288 - DMI_MATCH(DMI_PRODUCT_NAME, "P7010"),
20289 - },
20290 - },
20291 - {
20292 -- .ident = "Fujitsu Lifebook P7010",
20293 -+ /* Fujitsu Lifebook P7010 */
20294 - .matches = {
20295 - DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
20296 - DMI_MATCH(DMI_PRODUCT_NAME, "0000000000"),
20297 - },
20298 - },
20299 - {
20300 -- .ident = "Fujitsu Lifebook P5020D",
20301 -+ /* Fujitsu Lifebook P5020D */
20302 - .matches = {
20303 - DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
20304 - DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook P Series"),
20305 - },
20306 - },
20307 - {
20308 -- .ident = "Fujitsu Lifebook S2000",
20309 -+ /* Fujitsu Lifebook S2000 */
20310 - .matches = {
20311 - DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
20312 - DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S Series"),
20313 - },
20314 - },
20315 - {
20316 -- .ident = "Fujitsu Lifebook S6230",
20317 -+ /* Fujitsu Lifebook S6230 */
20318 - .matches = {
20319 - DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
20320 - DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook S6230"),
20321 - },
20322 - },
20323 - {
20324 -- .ident = "Fujitsu T70H",
20325 -+ /* Fujitsu T70H */
20326 - .matches = {
20327 - DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
20328 - DMI_MATCH(DMI_PRODUCT_NAME, "FMVLT70H"),
20329 - },
20330 - },
20331 - {
20332 -- .ident = "Fujitsu-Siemens Lifebook T3010",
20333 -+ /* Fujitsu-Siemens Lifebook T3010 */
20334 - .matches = {
20335 - DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
20336 - DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK T3010"),
20337 - },
20338 - },
20339 - {
20340 -- .ident = "Fujitsu-Siemens Lifebook E4010",
20341 -+ /* Fujitsu-Siemens Lifebook E4010 */
20342 - .matches = {
20343 - DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
20344 - DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E4010"),
20345 - },
20346 - },
20347 - {
20348 -- .ident = "Fujitsu-Siemens Amilo Pro 2010",
20349 -+ /* Fujitsu-Siemens Amilo Pro 2010 */
20350 - .matches = {
20351 - DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
20352 - DMI_MATCH(DMI_PRODUCT_NAME, "AMILO Pro V2010"),
20353 - },
20354 - },
20355 - {
20356 -- .ident = "Fujitsu-Siemens Amilo Pro 2030",
20357 -+ /* Fujitsu-Siemens Amilo Pro 2030 */
20358 - .matches = {
20359 - DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
20360 - DMI_MATCH(DMI_PRODUCT_NAME, "AMILO PRO V2030"),
20361 -@@ -253,7 +258,7 @@ static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = {
20362 - * No data is coming from the touchscreen unless KBC
20363 - * is in legacy mode.
20364 - */
20365 -- .ident = "Panasonic CF-29",
20366 -+ /* Panasonic CF-29 */
20367 - .matches = {
20368 - DMI_MATCH(DMI_SYS_VENDOR, "Matsushita"),
20369 - DMI_MATCH(DMI_PRODUCT_NAME, "CF-29"),
20370 -@@ -261,10 +266,10 @@ static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = {
20371 - },
20372 - {
20373 - /*
20374 -- * Errors on MUX ports are reported without raising AUXDATA
20375 -+ * HP Pavilion DV4017EA -
20376 -+ * errors on MUX ports are reported without raising AUXDATA
20377 - * causing "spurious NAK" messages.
20378 - */
20379 -- .ident = "HP Pavilion DV4017EA",
20380 - .matches = {
20381 - DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
20382 - DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EA032EA#ABF)"),
20383 -@@ -272,9 +277,9 @@ static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = {
20384 - },
20385 - {
20386 - /*
20387 -- * Like DV4017EA does not raise AUXERR for errors on MUX ports.
20388 -+ * HP Pavilion ZT1000 -
20389 -+ * like DV4017EA does not raise AUXERR for errors on MUX ports.
20390 - */
20391 -- .ident = "HP Pavilion ZT1000",
20392 - .matches = {
20393 - DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
20394 - DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion Notebook PC"),
20395 -@@ -283,44 +288,41 @@ static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = {
20396 - },
20397 - {
20398 - /*
20399 -- * Like DV4017EA does not raise AUXERR for errors on MUX ports.
20400 -+ * HP Pavilion DV4270ca -
20401 -+ * like DV4017EA does not raise AUXERR for errors on MUX ports.
20402 - */
20403 -- .ident = "HP Pavilion DV4270ca",
20404 - .matches = {
20405 - DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
20406 - DMI_MATCH(DMI_PRODUCT_NAME, "Pavilion dv4000 (EH476UA#ABL)"),
20407 - },
20408 - },
20409 - {
20410 -- .ident = "Toshiba P10",
20411 - .matches = {
20412 - DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
20413 - DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P10"),
20414 - },
20415 - },
20416 - {
20417 -- .ident = "Toshiba Equium A110",
20418 - .matches = {
20419 - DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
20420 - DMI_MATCH(DMI_PRODUCT_NAME, "EQUIUM A110"),
20421 - },
20422 - },
20423 - {
20424 -- .ident = "Alienware Sentia",
20425 - .matches = {
20426 - DMI_MATCH(DMI_SYS_VENDOR, "ALIENWARE"),
20427 - DMI_MATCH(DMI_PRODUCT_NAME, "Sentia"),
20428 - },
20429 - },
20430 - {
20431 -- .ident = "Sharp Actius MM20",
20432 -+ /* Sharp Actius MM20 */
20433 - .matches = {
20434 - DMI_MATCH(DMI_SYS_VENDOR, "SHARP"),
20435 - DMI_MATCH(DMI_PRODUCT_NAME, "PC-MM20 Series"),
20436 - },
20437 - },
20438 - {
20439 -- .ident = "Sony Vaio FS-115b",
20440 -+ /* Sony Vaio FS-115b */
20441 - .matches = {
20442 - DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
20443 - DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FS115B"),
20444 -@@ -328,73 +330,72 @@ static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = {
20445 - },
20446 - {
20447 - /*
20448 -- * Reset and GET ID commands issued via KBD port are
20449 -+ * Sony Vaio FZ-240E -
20450 -+ * reset and GET ID commands issued via KBD port are
20451 - * sometimes being delivered to AUX3.
20452 - */
20453 -- .ident = "Sony Vaio FZ-240E",
20454 - .matches = {
20455 - DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
20456 - DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FZ240E"),
20457 - },
20458 - },
20459 - {
20460 -- .ident = "Amoi M636/A737",
20461 -+ /* Amoi M636/A737 */
20462 - .matches = {
20463 - DMI_MATCH(DMI_SYS_VENDOR, "Amoi Electronics CO.,LTD."),
20464 - DMI_MATCH(DMI_PRODUCT_NAME, "M636/A737 platform"),
20465 - },
20466 - },
20467 - {
20468 -- .ident = "Lenovo 3000 n100",
20469 -+ /* Lenovo 3000 n100 */
20470 - .matches = {
20471 - DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
20472 - DMI_MATCH(DMI_PRODUCT_NAME, "076804U"),
20473 - },
20474 - },
20475 - {
20476 -- .ident = "Acer Aspire 1360",
20477 - .matches = {
20478 - DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
20479 - DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 1360"),
20480 - },
20481 - },
20482 - {
20483 -- .ident = "Gericom Bellagio",
20484 -+ /* Gericom Bellagio */
20485 - .matches = {
20486 - DMI_MATCH(DMI_SYS_VENDOR, "Gericom"),
20487 - DMI_MATCH(DMI_PRODUCT_NAME, "N34AS6"),
20488 - },
20489 - },
20490 - {
20491 -- .ident = "IBM 2656",
20492 -+ /* IBM 2656 */
20493 - .matches = {
20494 - DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
20495 - DMI_MATCH(DMI_PRODUCT_NAME, "2656"),
20496 - },
20497 - },
20498 - {
20499 -- .ident = "Dell XPS M1530",
20500 -+ /* Dell XPS M1530 */
20501 - .matches = {
20502 - DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
20503 - DMI_MATCH(DMI_PRODUCT_NAME, "XPS M1530"),
20504 - },
20505 - },
20506 - {
20507 -- .ident = "Compal HEL80I",
20508 -+ /* Compal HEL80I */
20509 - .matches = {
20510 - DMI_MATCH(DMI_SYS_VENDOR, "COMPAL"),
20511 - DMI_MATCH(DMI_PRODUCT_NAME, "HEL80I"),
20512 - },
20513 - },
20514 - {
20515 -- .ident = "Dell Vostro 1510",
20516 -+ /* Dell Vostro 1510 */
20517 - .matches = {
20518 - DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
20519 - DMI_MATCH(DMI_PRODUCT_NAME, "Vostro1510"),
20520 - },
20521 - },
20522 - {
20523 -- .ident = "Acer Aspire 5536",
20524 -+ /* Acer Aspire 5536 */
20525 - .matches = {
20526 - DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
20527 - DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5536"),
20528 -@@ -404,65 +405,65 @@ static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = {
20529 - { }
20530 - };
20531 -
20532 --static struct dmi_system_id __initdata i8042_dmi_reset_table[] = {
20533 -+static const struct dmi_system_id __initconst i8042_dmi_reset_table[] = {
20534 - {
20535 -- .ident = "MSI Wind U-100",
20536 -+ /* MSI Wind U-100 */
20537 - .matches = {
20538 - DMI_MATCH(DMI_BOARD_NAME, "U-100"),
20539 - DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"),
20540 - },
20541 - },
20542 - {
20543 -- .ident = "LG Electronics X110",
20544 -+ /* LG Electronics X110 */
20545 - .matches = {
20546 - DMI_MATCH(DMI_BOARD_NAME, "X110"),
20547 - DMI_MATCH(DMI_BOARD_VENDOR, "LG Electronics Inc."),
20548 - },
20549 - },
20550 - {
20551 -- .ident = "Acer Aspire One 150",
20552 -+ /* Acer Aspire One 150 */
20553 - .matches = {
20554 - DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
20555 - DMI_MATCH(DMI_PRODUCT_NAME, "AOA150"),
20556 - },
20557 - },
20558 - {
20559 -- .ident = "Advent 4211",
20560 -+ /* Advent 4211 */
20561 - .matches = {
20562 - DMI_MATCH(DMI_SYS_VENDOR, "DIXONSXP"),
20563 - DMI_MATCH(DMI_PRODUCT_NAME, "Advent 4211"),
20564 - },
20565 - },
20566 - {
20567 -- .ident = "Medion Akoya Mini E1210",
20568 -+ /* Medion Akoya Mini E1210 */
20569 - .matches = {
20570 - DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
20571 - DMI_MATCH(DMI_PRODUCT_NAME, "E1210"),
20572 - },
20573 - },
20574 - {
20575 -- .ident = "Mivvy M310",
20576 -+ /* Mivvy M310 */
20577 - .matches = {
20578 - DMI_MATCH(DMI_SYS_VENDOR, "VIOOO"),
20579 - DMI_MATCH(DMI_PRODUCT_NAME, "N10"),
20580 - },
20581 - },
20582 - {
20583 -- .ident = "Dell Vostro 1320",
20584 -+ /* Dell Vostro 1320 */
20585 - .matches = {
20586 - DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
20587 - DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1320"),
20588 - },
20589 - },
20590 - {
20591 -- .ident = "Dell Vostro 1520",
20592 -+ /* Dell Vostro 1520 */
20593 - .matches = {
20594 - DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
20595 - DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1520"),
20596 - },
20597 - },
20598 - {
20599 -- .ident = "Dell Vostro 1720",
20600 -+ /* Dell Vostro 1720 */
20601 - .matches = {
20602 - DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
20603 - DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 1720"),
20604 -@@ -472,16 +473,16 @@ static struct dmi_system_id __initdata i8042_dmi_reset_table[] = {
20605 - };
20606 -
20607 - #ifdef CONFIG_PNP
20608 --static struct dmi_system_id __initdata i8042_dmi_nopnp_table[] = {
20609 -+static const struct dmi_system_id __initconst i8042_dmi_nopnp_table[] = {
20610 - {
20611 -- .ident = "Intel MBO Desktop D845PESV",
20612 -+ /* Intel MBO Desktop D845PESV */
20613 - .matches = {
20614 - DMI_MATCH(DMI_BOARD_NAME, "D845PESV"),
20615 - DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"),
20616 - },
20617 - },
20618 - {
20619 -- .ident = "MSI Wind U-100",
20620 -+ /* MSI Wind U-100 */
20621 - .matches = {
20622 - DMI_MATCH(DMI_BOARD_NAME, "U-100"),
20623 - DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"),
20624 -@@ -490,27 +491,23 @@ static struct dmi_system_id __initdata i8042_dmi_nopnp_table[] = {
20625 - { }
20626 - };
20627 -
20628 --static struct dmi_system_id __initdata i8042_dmi_laptop_table[] = {
20629 -+static const struct dmi_system_id __initconst i8042_dmi_laptop_table[] = {
20630 - {
20631 -- .ident = "Portable",
20632 - .matches = {
20633 - DMI_MATCH(DMI_CHASSIS_TYPE, "8"), /* Portable */
20634 - },
20635 - },
20636 - {
20637 -- .ident = "Laptop",
20638 - .matches = {
20639 - DMI_MATCH(DMI_CHASSIS_TYPE, "9"), /* Laptop */
20640 - },
20641 - },
20642 - {
20643 -- .ident = "Notebook",
20644 - .matches = {
20645 - DMI_MATCH(DMI_CHASSIS_TYPE, "10"), /* Notebook */
20646 - },
20647 - },
20648 - {
20649 -- .ident = "Sub-Notebook",
20650 - .matches = {
20651 - DMI_MATCH(DMI_CHASSIS_TYPE, "14"), /* Sub-Notebook */
20652 - },
20653 -@@ -525,58 +522,65 @@ static struct dmi_system_id __initdata i8042_dmi_laptop_table[] = {
20654 - * Originally, this was just confined to older laptops, but a few Acer laptops
20655 - * have turned up in 2007 that also need this again.
20656 - */
20657 --static struct dmi_system_id __initdata i8042_dmi_dritek_table[] = {
20658 -+static const struct dmi_system_id __initconst i8042_dmi_dritek_table[] = {
20659 -+ {
20660 -+ /* Acer Aspire 5610 */
20661 -+ .matches = {
20662 -+ DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
20663 -+ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5610"),
20664 -+ },
20665 -+ },
20666 - {
20667 -- .ident = "Acer Aspire 5630",
20668 -+ /* Acer Aspire 5630 */
20669 - .matches = {
20670 - DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
20671 - DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5630"),
20672 - },
20673 - },
20674 - {
20675 -- .ident = "Acer Aspire 5650",
20676 -+ /* Acer Aspire 5650 */
20677 - .matches = {
20678 - DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
20679 - DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5650"),
20680 - },
20681 - },
20682 - {
20683 -- .ident = "Acer Aspire 5680",
20684 -+ /* Acer Aspire 5680 */
20685 - .matches = {
20686 - DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
20687 - DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5680"),
20688 - },
20689 - },
20690 - {
20691 -- .ident = "Acer Aspire 5720",
20692 -+ /* Acer Aspire 5720 */
20693 - .matches = {
20694 - DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
20695 - DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5720"),
20696 - },
20697 - },
20698 - {
20699 -- .ident = "Acer Aspire 9110",
20700 -+ /* Acer Aspire 9110 */
20701 - .matches = {
20702 - DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
20703 - DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 9110"),
20704 - },
20705 - },
20706 - {
20707 -- .ident = "Acer TravelMate 660",
20708 -+ /* Acer TravelMate 660 */
20709 - .matches = {
20710 - DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
20711 - DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 660"),
20712 - },
20713 - },
20714 - {
20715 -- .ident = "Acer TravelMate 2490",
20716 -+ /* Acer TravelMate 2490 */
20717 - .matches = {
20718 - DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
20719 - DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 2490"),
20720 - },
20721 - },
20722 - {
20723 -- .ident = "Acer TravelMate 4280",
20724 -+ /* Acer TravelMate 4280 */
20725 - .matches = {
20726 - DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
20727 - DMI_MATCH(DMI_PRODUCT_NAME, "TravelMate 4280"),
20728 -diff --git a/drivers/md/md.c b/drivers/md/md.c
20729 -index c6a6685..08f7471 100644
20730 ---- a/drivers/md/md.c
20731 -+++ b/drivers/md/md.c
20732 -@@ -4173,7 +4173,7 @@ static int do_md_run(mddev_t * mddev)
20733 - mddev->barriers_work = 1;
20734 - mddev->ok_start_degraded = start_dirty_degraded;
20735 -
20736 -- if (start_readonly)
20737 -+ if (start_readonly && mddev->ro == 0)
20738 - mddev->ro = 2; /* read-only, but switch on first write */
20739 -
20740 - err = mddev->pers->run(mddev);
20741 -diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c
20742 -index 8f88a58..6b03dbf 100644
20743 ---- a/drivers/media/dvb/siano/smsusb.c
20744 -+++ b/drivers/media/dvb/siano/smsusb.c
20745 -@@ -533,8 +533,18 @@ struct usb_device_id smsusb_id_table[] = {
20746 - .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
20747 - { USB_DEVICE(0x2040, 0xb910),
20748 - .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
20749 -+ { USB_DEVICE(0x2040, 0xb980),
20750 -+ .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
20751 -+ { USB_DEVICE(0x2040, 0xb990),
20752 -+ .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
20753 - { USB_DEVICE(0x2040, 0xc000),
20754 - .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
20755 -+ { USB_DEVICE(0x2040, 0xc010),
20756 -+ .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
20757 -+ { USB_DEVICE(0x2040, 0xc080),
20758 -+ .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
20759 -+ { USB_DEVICE(0x2040, 0xc090),
20760 -+ .driver_info = SMS1XXX_BOARD_HAUPPAUGE_WINDHAM },
20761 - { } /* Terminating entry */
20762 - };
20763 -
20764 -diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
20765 -index 0901322..6781a07 100644
20766 ---- a/drivers/media/video/saa7134/saa7134-cards.c
20767 -+++ b/drivers/media/video/saa7134/saa7134-cards.c
20768 -@@ -5279,6 +5279,30 @@ struct saa7134_board saa7134_boards[] = {
20769 - .amux = TV,
20770 - },
20771 - },
20772 -+ [SAA7134_BOARD_ASUS_EUROPA_HYBRID] = {
20773 -+ .name = "Asus Europa Hybrid OEM",
20774 -+ .audio_clock = 0x00187de7,
20775 -+ .tuner_type = TUNER_PHILIPS_TD1316,
20776 -+ .radio_type = UNSET,
20777 -+ .tuner_addr = 0x61,
20778 -+ .radio_addr = ADDR_UNSET,
20779 -+ .tda9887_conf = TDA9887_PRESENT | TDA9887_PORT1_ACTIVE,
20780 -+ .mpeg = SAA7134_MPEG_DVB,
20781 -+ .inputs = { {
20782 -+ .name = name_tv,
20783 -+ .vmux = 3,
20784 -+ .amux = TV,
20785 -+ .tv = 1,
20786 -+ }, {
20787 -+ .name = name_comp1,
20788 -+ .vmux = 4,
20789 -+ .amux = LINE2,
20790 -+ }, {
20791 -+ .name = name_svideo,
20792 -+ .vmux = 8,
20793 -+ .amux = LINE2,
20794 -+ } },
20795 -+ },
20796 -
20797 - };
20798 -
20799 -@@ -6418,6 +6442,12 @@ struct pci_device_id saa7134_pci_tbl[] = {
20800 - .subdevice = 0x2004,
20801 - .driver_data = SAA7134_BOARD_ZOLID_HYBRID_PCI,
20802 - }, {
20803 -+ .vendor = PCI_VENDOR_ID_PHILIPS,
20804 -+ .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
20805 -+ .subvendor = 0x1043,
20806 -+ .subdevice = 0x4847,
20807 -+ .driver_data = SAA7134_BOARD_ASUS_EUROPA_HYBRID,
20808 -+ }, {
20809 - /* --- boards without eeprom + subsystem ID --- */
20810 - .vendor = PCI_VENDOR_ID_PHILIPS,
20811 - .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
20812 -@@ -7079,6 +7109,7 @@ int saa7134_board_init2(struct saa7134_dev *dev)
20813 - /* break intentionally omitted */
20814 - case SAA7134_BOARD_VIDEOMATE_DVBT_300:
20815 - case SAA7134_BOARD_ASUS_EUROPA2_HYBRID:
20816 -+ case SAA7134_BOARD_ASUS_EUROPA_HYBRID:
20817 - {
20818 -
20819 - /* The Philips EUROPA based hybrid boards have the tuner
20820 -diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
20821 -index a26e997..b8a805c 100644
20822 ---- a/drivers/media/video/saa7134/saa7134-dvb.c
20823 -+++ b/drivers/media/video/saa7134/saa7134-dvb.c
20824 -@@ -1116,6 +1116,7 @@ static int dvb_init(struct saa7134_dev *dev)
20825 - break;
20826 - case SAA7134_BOARD_PHILIPS_EUROPA:
20827 - case SAA7134_BOARD_VIDEOMATE_DVBT_300:
20828 -+ case SAA7134_BOARD_ASUS_EUROPA_HYBRID:
20829 - fe0->dvb.frontend = dvb_attach(tda10046_attach,
20830 - &philips_europa_config,
20831 - &dev->i2c_adap);
20832 -diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
20833 -index f8697d4..94e1a3b 100644
20834 ---- a/drivers/media/video/saa7134/saa7134.h
20835 -+++ b/drivers/media/video/saa7134/saa7134.h
20836 -@@ -297,6 +297,7 @@ struct saa7134_format {
20837 - #define SAA7134_BOARD_BEHOLD_X7 171
20838 - #define SAA7134_BOARD_ROVERMEDIA_LINK_PRO_FM 172
20839 - #define SAA7134_BOARD_ZOLID_HYBRID_PCI 173
20840 -+#define SAA7134_BOARD_ASUS_EUROPA_HYBRID 174
20841 -
20842 - #define SAA7134_MAXBOARDS 32
20843 - #define SAA7134_INPUT_MAX 8
20844 -diff --git a/drivers/media/video/uvc/uvc_ctrl.c b/drivers/media/video/uvc/uvc_ctrl.c
20845 -index 1b89735..4a293b4 100644
20846 ---- a/drivers/media/video/uvc/uvc_ctrl.c
20847 -+++ b/drivers/media/video/uvc/uvc_ctrl.c
20848 -@@ -1405,7 +1405,7 @@ uvc_ctrl_prune_entity(struct uvc_device *dev, struct uvc_entity *entity)
20849 - size = entity->processing.bControlSize;
20850 -
20851 - for (i = 0; i < ARRAY_SIZE(blacklist); ++i) {
20852 -- if (!usb_match_id(dev->intf, &blacklist[i].id))
20853 -+ if (!usb_match_one_id(dev->intf, &blacklist[i].id))
20854 - continue;
20855 -
20856 - if (blacklist[i].index >= 8 * size ||
20857 -diff --git a/drivers/mtd/ubi/upd.c b/drivers/mtd/ubi/upd.c
20858 -index c1d7b88..425bf5a 100644
20859 ---- a/drivers/mtd/ubi/upd.c
20860 -+++ b/drivers/mtd/ubi/upd.c
20861 -@@ -155,6 +155,7 @@ int ubi_start_update(struct ubi_device *ubi, struct ubi_volume *vol,
20862 - if (err)
20863 - return err;
20864 - vol->updating = 0;
20865 -+ return 0;
20866 - }
20867 -
20868 - vol->upd_buf = vmalloc(ubi->leb_size);
20869 -diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c
20870 -index 1afc61e..4004402 100644
20871 ---- a/drivers/mtd/ubi/vtbl.c
20872 -+++ b/drivers/mtd/ubi/vtbl.c
20873 -@@ -566,6 +566,7 @@ static int init_volumes(struct ubi_device *ubi, const struct ubi_scan_info *si,
20874 - vol->reserved_pebs = be32_to_cpu(vtbl[i].reserved_pebs);
20875 - vol->alignment = be32_to_cpu(vtbl[i].alignment);
20876 - vol->data_pad = be32_to_cpu(vtbl[i].data_pad);
20877 -+ vol->upd_marker = vtbl[i].upd_marker;
20878 - vol->vol_type = vtbl[i].vol_type == UBI_VID_DYNAMIC ?
20879 - UBI_DYNAMIC_VOLUME : UBI_STATIC_VOLUME;
20880 - vol->name_len = be16_to_cpu(vtbl[i].name_len);
20881 -diff --git a/drivers/net/atl1c/atl1c.h b/drivers/net/atl1c/atl1c.h
20882 -index 2a1120a..790e55b 100644
20883 ---- a/drivers/net/atl1c/atl1c.h
20884 -+++ b/drivers/net/atl1c/atl1c.h
20885 -@@ -534,6 +534,9 @@ struct atl1c_adapter {
20886 - #define __AT_TESTING 0x0001
20887 - #define __AT_RESETTING 0x0002
20888 - #define __AT_DOWN 0x0003
20889 -+ u8 work_event;
20890 -+#define ATL1C_WORK_EVENT_RESET 0x01
20891 -+#define ATL1C_WORK_EVENT_LINK_CHANGE 0x02
20892 - u32 msg_enable;
20893 -
20894 - bool have_msi;
20895 -@@ -545,8 +548,7 @@ struct atl1c_adapter {
20896 - spinlock_t tx_lock;
20897 - atomic_t irq_sem;
20898 -
20899 -- struct work_struct reset_task;
20900 -- struct work_struct link_chg_task;
20901 -+ struct work_struct common_task;
20902 - struct timer_list watchdog_timer;
20903 - struct timer_list phy_config_timer;
20904 -
20905 -diff --git a/drivers/net/atl1c/atl1c_main.c b/drivers/net/atl1c/atl1c_main.c
20906 -index 1372e9a..be00ee9 100644
20907 ---- a/drivers/net/atl1c/atl1c_main.c
20908 -+++ b/drivers/net/atl1c/atl1c_main.c
20909 -@@ -198,27 +198,12 @@ static void atl1c_phy_config(unsigned long data)
20910 -
20911 - void atl1c_reinit_locked(struct atl1c_adapter *adapter)
20912 - {
20913 --
20914 - WARN_ON(in_interrupt());
20915 - atl1c_down(adapter);
20916 - atl1c_up(adapter);
20917 - clear_bit(__AT_RESETTING, &adapter->flags);
20918 - }
20919 -
20920 --static void atl1c_reset_task(struct work_struct *work)
20921 --{
20922 -- struct atl1c_adapter *adapter;
20923 -- struct net_device *netdev;
20924 --
20925 -- adapter = container_of(work, struct atl1c_adapter, reset_task);
20926 -- netdev = adapter->netdev;
20927 --
20928 -- netif_device_detach(netdev);
20929 -- atl1c_down(adapter);
20930 -- atl1c_up(adapter);
20931 -- netif_device_attach(netdev);
20932 --}
20933 --
20934 - static void atl1c_check_link_status(struct atl1c_adapter *adapter)
20935 - {
20936 - struct atl1c_hw *hw = &adapter->hw;
20937 -@@ -275,18 +260,6 @@ static void atl1c_check_link_status(struct atl1c_adapter *adapter)
20938 - }
20939 - }
20940 -
20941 --/*
20942 -- * atl1c_link_chg_task - deal with link change event Out of interrupt context
20943 -- * @netdev: network interface device structure
20944 -- */
20945 --static void atl1c_link_chg_task(struct work_struct *work)
20946 --{
20947 -- struct atl1c_adapter *adapter;
20948 --
20949 -- adapter = container_of(work, struct atl1c_adapter, link_chg_task);
20950 -- atl1c_check_link_status(adapter);
20951 --}
20952 --
20953 - static void atl1c_link_chg_event(struct atl1c_adapter *adapter)
20954 - {
20955 - struct net_device *netdev = adapter->netdev;
20956 -@@ -311,20 +284,40 @@ static void atl1c_link_chg_event(struct atl1c_adapter *adapter)
20957 - adapter->link_speed = SPEED_0;
20958 - }
20959 - }
20960 -- schedule_work(&adapter->link_chg_task);
20961 -+
20962 -+ adapter->work_event |= ATL1C_WORK_EVENT_LINK_CHANGE;
20963 -+ schedule_work(&adapter->common_task);
20964 - }
20965 -
20966 --static void atl1c_del_timer(struct atl1c_adapter *adapter)
20967 -+static void atl1c_common_task(struct work_struct *work)
20968 - {
20969 -- del_timer_sync(&adapter->phy_config_timer);
20970 -+ struct atl1c_adapter *adapter;
20971 -+ struct net_device *netdev;
20972 -+
20973 -+ adapter = container_of(work, struct atl1c_adapter, common_task);
20974 -+ netdev = adapter->netdev;
20975 -+
20976 -+ if (adapter->work_event & ATL1C_WORK_EVENT_RESET) {
20977 -+ netif_device_detach(netdev);
20978 -+ atl1c_down(adapter);
20979 -+ atl1c_up(adapter);
20980 -+ netif_device_attach(netdev);
20981 -+ return;
20982 -+ }
20983 -+
20984 -+ if (adapter->work_event & ATL1C_WORK_EVENT_LINK_CHANGE)
20985 -+ atl1c_check_link_status(adapter);
20986 -+
20987 -+ return;
20988 - }
20989 -
20990 --static void atl1c_cancel_work(struct atl1c_adapter *adapter)
20991 -+
20992 -+static void atl1c_del_timer(struct atl1c_adapter *adapter)
20993 - {
20994 -- cancel_work_sync(&adapter->reset_task);
20995 -- cancel_work_sync(&adapter->link_chg_task);
20996 -+ del_timer_sync(&adapter->phy_config_timer);
20997 - }
20998 -
20999 -+
21000 - /*
21001 - * atl1c_tx_timeout - Respond to a Tx Hang
21002 - * @netdev: network interface device structure
21003 -@@ -334,7 +327,8 @@ static void atl1c_tx_timeout(struct net_device *netdev)
21004 - struct atl1c_adapter *adapter = netdev_priv(netdev);
21005 -
21006 - /* Do the reset outside of interrupt context */
21007 -- schedule_work(&adapter->reset_task);
21008 -+ adapter->work_event |= ATL1C_WORK_EVENT_RESET;
21009 -+ schedule_work(&adapter->common_task);
21010 - }
21011 -
21012 - /*
21013 -@@ -1536,7 +1530,8 @@ static irqreturn_t atl1c_intr(int irq, void *data)
21014 - /* reset MAC */
21015 - hw->intr_mask &= ~ISR_ERROR;
21016 - AT_WRITE_REG(hw, REG_IMR, hw->intr_mask);
21017 -- schedule_work(&adapter->reset_task);
21018 -+ adapter->work_event |= ATL1C_WORK_EVENT_RESET;
21019 -+ schedule_work(&adapter->common_task);
21020 - break;
21021 - }
21022 -
21023 -@@ -2200,8 +2195,7 @@ void atl1c_down(struct atl1c_adapter *adapter)
21024 - struct net_device *netdev = adapter->netdev;
21025 -
21026 - atl1c_del_timer(adapter);
21027 -- atl1c_cancel_work(adapter);
21028 --
21029 -+ adapter->work_event = 0; /* clear all event */
21030 - /* signal that we're down so the interrupt handler does not
21031 - * reschedule our watchdog timer */
21032 - set_bit(__AT_DOWN, &adapter->flags);
21033 -@@ -2601,8 +2595,8 @@ static int __devinit atl1c_probe(struct pci_dev *pdev,
21034 - adapter->hw.mac_addr[4], adapter->hw.mac_addr[5]);
21035 -
21036 - atl1c_hw_set_mac_addr(&adapter->hw);
21037 -- INIT_WORK(&adapter->reset_task, atl1c_reset_task);
21038 -- INIT_WORK(&adapter->link_chg_task, atl1c_link_chg_task);
21039 -+ INIT_WORK(&adapter->common_task, atl1c_common_task);
21040 -+ adapter->work_event = 0;
21041 - err = register_netdev(netdev);
21042 - if (err) {
21043 - dev_err(&pdev->dev, "register netdevice failed\n");
21044 -diff --git a/drivers/net/atl1e/atl1e_main.c b/drivers/net/atl1e/atl1e_main.c
21045 -index 955da73..1b5facf 100644
21046 ---- a/drivers/net/atl1e/atl1e_main.c
21047 -+++ b/drivers/net/atl1e/atl1e_main.c
21048 -@@ -1666,41 +1666,6 @@ static int atl1e_tso_csum(struct atl1e_adapter *adapter,
21049 - }
21050 - return 0;
21051 - }
21052 --
21053 -- if (offload_type & SKB_GSO_TCPV6) {
21054 -- real_len = (((unsigned char *)ipv6_hdr(skb) - skb->data)
21055 -- + ntohs(ipv6_hdr(skb)->payload_len));
21056 -- if (real_len < skb->len)
21057 -- pskb_trim(skb, real_len);
21058 --
21059 -- /* check payload == 0 byte ? */
21060 -- hdr_len = (skb_transport_offset(skb) + tcp_hdrlen(skb));
21061 -- if (unlikely(skb->len == hdr_len)) {
21062 -- /* only xsum need */
21063 -- dev_warn(&pdev->dev,
21064 -- "IPV6 tso with zero data??\n");
21065 -- goto check_sum;
21066 -- } else {
21067 -- tcp_hdr(skb)->check = ~csum_ipv6_magic(
21068 -- &ipv6_hdr(skb)->saddr,
21069 -- &ipv6_hdr(skb)->daddr,
21070 -- 0, IPPROTO_TCP, 0);
21071 -- tpd->word3 |= 1 << TPD_IP_VERSION_SHIFT;
21072 -- hdr_len >>= 1;
21073 -- tpd->word3 |= (hdr_len & TPD_V6_IPHLLO_MASK) <<
21074 -- TPD_V6_IPHLLO_SHIFT;
21075 -- tpd->word3 |= ((hdr_len >> 3) &
21076 -- TPD_V6_IPHLHI_MASK) <<
21077 -- TPD_V6_IPHLHI_SHIFT;
21078 -- tpd->word3 |= (tcp_hdrlen(skb) >> 2 &
21079 -- TPD_TCPHDRLEN_MASK) <<
21080 -- TPD_TCPHDRLEN_SHIFT;
21081 -- tpd->word3 |= ((skb_shinfo(skb)->gso_size) &
21082 -- TPD_MSS_MASK) << TPD_MSS_SHIFT;
21083 -- tpd->word3 |= 1 << TPD_SEGMENT_EN_SHIFT;
21084 -- }
21085 -- }
21086 -- return 0;
21087 - }
21088 -
21089 - check_sum:
21090 -@@ -2289,7 +2254,6 @@ static int atl1e_init_netdev(struct net_device *netdev, struct pci_dev *pdev)
21091 - NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
21092 - netdev->features |= NETIF_F_LLTX;
21093 - netdev->features |= NETIF_F_TSO;
21094 -- netdev->features |= NETIF_F_TSO6;
21095 -
21096 - return 0;
21097 - }
21098 -diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
21099 -index 3b79a22..a84f1c5 100644
21100 ---- a/drivers/net/benet/be.h
21101 -+++ b/drivers/net/benet/be.h
21102 -@@ -35,20 +35,31 @@
21103 - #define DRV_VER "2.101.205"
21104 - #define DRV_NAME "be2net"
21105 - #define BE_NAME "ServerEngines BladeEngine2 10Gbps NIC"
21106 -+#define BE3_NAME "ServerEngines BladeEngine3 10Gbps NIC"
21107 - #define OC_NAME "Emulex OneConnect 10Gbps NIC"
21108 -+#define OC_NAME1 "Emulex OneConnect 10Gbps NIC (be3)"
21109 - #define DRV_DESC BE_NAME "Driver"
21110 -
21111 - #define BE_VENDOR_ID 0x19a2
21112 - #define BE_DEVICE_ID1 0x211
21113 -+#define BE_DEVICE_ID2 0x221
21114 - #define OC_DEVICE_ID1 0x700
21115 - #define OC_DEVICE_ID2 0x701
21116 -+#define OC_DEVICE_ID3 0x710
21117 -
21118 - static inline char *nic_name(struct pci_dev *pdev)
21119 - {
21120 -- if (pdev->device == OC_DEVICE_ID1 || pdev->device == OC_DEVICE_ID2)
21121 -+ switch (pdev->device) {
21122 -+ case OC_DEVICE_ID1:
21123 -+ case OC_DEVICE_ID2:
21124 - return OC_NAME;
21125 -- else
21126 -+ case OC_DEVICE_ID3:
21127 -+ return OC_NAME1;
21128 -+ case BE_DEVICE_ID2:
21129 -+ return BE3_NAME;
21130 -+ default:
21131 - return BE_NAME;
21132 -+ }
21133 - }
21134 -
21135 - /* Number of bytes of an RX frame that are copied to skb->data */
21136 -diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
21137 -index 876b357..3749bb1 100644
21138 ---- a/drivers/net/benet/be_main.c
21139 -+++ b/drivers/net/benet/be_main.c
21140 -@@ -31,8 +31,10 @@ MODULE_PARM_DESC(rx_frag_size, "Size of a fragment that holds rcvd data.");
21141 -
21142 - static DEFINE_PCI_DEVICE_TABLE(be_dev_ids) = {
21143 - { PCI_DEVICE(BE_VENDOR_ID, BE_DEVICE_ID1) },
21144 -+ { PCI_DEVICE(BE_VENDOR_ID, BE_DEVICE_ID2) },
21145 - { PCI_DEVICE(BE_VENDOR_ID, OC_DEVICE_ID1) },
21146 - { PCI_DEVICE(BE_VENDOR_ID, OC_DEVICE_ID2) },
21147 -+ { PCI_DEVICE(BE_VENDOR_ID, OC_DEVICE_ID3) },
21148 - { 0 }
21149 - };
21150 - MODULE_DEVICE_TABLE(pci, be_dev_ids);
21151 -diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c
21152 -index a2fc70a..35d896b 100644
21153 ---- a/drivers/net/qlge/qlge_main.c
21154 -+++ b/drivers/net/qlge/qlge_main.c
21155 -@@ -3310,10 +3310,8 @@ static int ql_adapter_initialize(struct ql_adapter *qdev)
21156 -
21157 - /* Initialize the port and set the max framesize. */
21158 - status = qdev->nic_ops->port_initialize(qdev);
21159 -- if (status) {
21160 -- QPRINTK(qdev, IFUP, ERR, "Failed to start port.\n");
21161 -- return status;
21162 -- }
21163 -+ if (status)
21164 -+ QPRINTK(qdev, IFUP, ERR, "Failed to start port.\n");
21165 -
21166 - /* Set up the MAC address and frame routing filter. */
21167 - status = ql_cam_route_initialize(qdev);
21168 -@@ -3714,9 +3712,6 @@ static int qlge_set_mac_address(struct net_device *ndev, void *p)
21169 - struct sockaddr *addr = p;
21170 - int status;
21171 -
21172 -- if (netif_running(ndev))
21173 -- return -EBUSY;
21174 --
21175 - if (!is_valid_ether_addr(addr->sa_data))
21176 - return -EADDRNOTAVAIL;
21177 - memcpy(ndev->dev_addr, addr->sa_data, ndev->addr_len);
21178 -@@ -3868,8 +3863,7 @@ static int __devinit ql_init_device(struct pci_dev *pdev,
21179 - struct net_device *ndev, int cards_found)
21180 - {
21181 - struct ql_adapter *qdev = netdev_priv(ndev);
21182 -- int pos, err = 0;
21183 -- u16 val16;
21184 -+ int err = 0;
21185 -
21186 - memset((void *)qdev, 0, sizeof(*qdev));
21187 - err = pci_enable_device(pdev);
21188 -@@ -3881,18 +3875,12 @@ static int __devinit ql_init_device(struct pci_dev *pdev,
21189 - qdev->ndev = ndev;
21190 - qdev->pdev = pdev;
21191 - pci_set_drvdata(pdev, ndev);
21192 -- pos = pci_find_capability(pdev, PCI_CAP_ID_EXP);
21193 -- if (pos <= 0) {
21194 -- dev_err(&pdev->dev, PFX "Cannot find PCI Express capability, "
21195 -- "aborting.\n");
21196 -- return pos;
21197 -- } else {
21198 -- pci_read_config_word(pdev, pos + PCI_EXP_DEVCTL, &val16);
21199 -- val16 &= ~PCI_EXP_DEVCTL_NOSNOOP_EN;
21200 -- val16 |= (PCI_EXP_DEVCTL_CERE |
21201 -- PCI_EXP_DEVCTL_NFERE |
21202 -- PCI_EXP_DEVCTL_FERE | PCI_EXP_DEVCTL_URRE);
21203 -- pci_write_config_word(pdev, pos + PCI_EXP_DEVCTL, val16);
21204 -+
21205 -+ /* Set PCIe read request size */
21206 -+ err = pcie_set_readrq(pdev, 4096);
21207 -+ if (err) {
21208 -+ dev_err(&pdev->dev, "Set readrq failed.\n");
21209 -+ goto err_out;
21210 - }
21211 -
21212 - err = pci_request_regions(pdev, DRV_NAME);
21213 -diff --git a/drivers/net/qlge/qlge_mpi.c b/drivers/net/qlge/qlge_mpi.c
21214 -index aec05f2..32b1e1f 100644
21215 ---- a/drivers/net/qlge/qlge_mpi.c
21216 -+++ b/drivers/net/qlge/qlge_mpi.c
21217 -@@ -446,6 +446,9 @@ static int ql_mpi_handler(struct ql_adapter *qdev, struct mbox_params *mbcp)
21218 - ql_aen_lost(qdev, mbcp);
21219 - break;
21220 -
21221 -+ case AEN_DCBX_CHG:
21222 -+ /* Need to support AEN 8110 */
21223 -+ break;
21224 - default:
21225 - QPRINTK(qdev, DRV, ERR,
21226 - "Unsupported AE %.08x.\n", mbcp->mbox_out[0]);
21227 -diff --git a/drivers/net/sfc/tx.c b/drivers/net/sfc/tx.c
21228 -index 489c4de..d443ad7 100644
21229 ---- a/drivers/net/sfc/tx.c
21230 -+++ b/drivers/net/sfc/tx.c
21231 -@@ -821,8 +821,6 @@ static void efx_enqueue_unwind(struct efx_tx_queue *tx_queue)
21232 - tx_queue->efx->type->txd_ring_mask];
21233 - efx_tsoh_free(tx_queue, buffer);
21234 - EFX_BUG_ON_PARANOID(buffer->skb);
21235 -- buffer->len = 0;
21236 -- buffer->continuation = true;
21237 - if (buffer->unmap_len) {
21238 - unmap_addr = (buffer->dma_addr + buffer->len -
21239 - buffer->unmap_len);
21240 -@@ -836,6 +834,8 @@ static void efx_enqueue_unwind(struct efx_tx_queue *tx_queue)
21241 - PCI_DMA_TODEVICE);
21242 - buffer->unmap_len = 0;
21243 - }
21244 -+ buffer->len = 0;
21245 -+ buffer->continuation = true;
21246 - }
21247 - }
21248 -
21249 -diff --git a/drivers/net/wireless/ath/ar9170/usb.c b/drivers/net/wireless/ath/ar9170/usb.c
21250 -index e974e58..f141a4f 100644
21251 ---- a/drivers/net/wireless/ath/ar9170/usb.c
21252 -+++ b/drivers/net/wireless/ath/ar9170/usb.c
21253 -@@ -68,8 +68,10 @@ static struct usb_device_id ar9170_usb_ids[] = {
21254 - { USB_DEVICE(0x0cf3, 0x1002) },
21255 - /* Cace Airpcap NX */
21256 - { USB_DEVICE(0xcace, 0x0300) },
21257 -- /* D-Link DWA 160A */
21258 -+ /* D-Link DWA 160 A1 */
21259 - { USB_DEVICE(0x07d1, 0x3c10) },
21260 -+ /* D-Link DWA 160 A2 */
21261 -+ { USB_DEVICE(0x07d1, 0x3a09) },
21262 - /* Netgear WNDA3100 */
21263 - { USB_DEVICE(0x0846, 0x9010) },
21264 - /* Netgear WN111 v2 */
21265 -diff --git a/drivers/net/wireless/iwlwifi/iwl-5000.c b/drivers/net/wireless/iwlwifi/iwl-5000.c
21266 -index 94a1225..133df70 100644
21267 ---- a/drivers/net/wireless/iwlwifi/iwl-5000.c
21268 -+++ b/drivers/net/wireless/iwlwifi/iwl-5000.c
21269 -@@ -1666,6 +1666,7 @@ struct iwl_cfg iwl5300_agn_cfg = {
21270 - .valid_rx_ant = ANT_ABC,
21271 - .need_pll_cfg = true,
21272 - .ht_greenfield_support = true,
21273 -+ .use_rts_for_ht = true, /* use rts/cts protection */
21274 - };
21275 -
21276 - struct iwl_cfg iwl5100_bg_cfg = {
21277 -@@ -1717,6 +1718,7 @@ struct iwl_cfg iwl5100_agn_cfg = {
21278 - .valid_rx_ant = ANT_AB,
21279 - .need_pll_cfg = true,
21280 - .ht_greenfield_support = true,
21281 -+ .use_rts_for_ht = true, /* use rts/cts protection */
21282 - };
21283 -
21284 - struct iwl_cfg iwl5350_agn_cfg = {
21285 -@@ -1734,6 +1736,7 @@ struct iwl_cfg iwl5350_agn_cfg = {
21286 - .valid_rx_ant = ANT_ABC,
21287 - .need_pll_cfg = true,
21288 - .ht_greenfield_support = true,
21289 -+ .use_rts_for_ht = true, /* use rts/cts protection */
21290 - };
21291 -
21292 - struct iwl_cfg iwl5150_agn_cfg = {
21293 -@@ -1751,6 +1754,7 @@ struct iwl_cfg iwl5150_agn_cfg = {
21294 - .valid_rx_ant = ANT_AB,
21295 - .need_pll_cfg = true,
21296 - .ht_greenfield_support = true,
21297 -+ .use_rts_for_ht = true, /* use rts/cts protection */
21298 - };
21299 -
21300 - MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX));
21301 -diff --git a/drivers/pci/pcie/aer/aer_inject.c b/drivers/pci/pcie/aer/aer_inject.c
21302 -index 62d15f6..0d91a8a 100644
21303 ---- a/drivers/pci/pcie/aer/aer_inject.c
21304 -+++ b/drivers/pci/pcie/aer/aer_inject.c
21305 -@@ -392,8 +392,14 @@ static int aer_inject(struct aer_error_inj *einj)
21306 - if (ret)
21307 - goto out_put;
21308 -
21309 -- if (find_aer_device(rpdev, &edev))
21310 -+ if (find_aer_device(rpdev, &edev)) {
21311 -+ if (!get_service_data(edev)) {
21312 -+ printk(KERN_WARNING "AER service is not initialized\n");
21313 -+ ret = -EINVAL;
21314 -+ goto out_put;
21315 -+ }
21316 - aer_irq(-1, edev);
21317 -+ }
21318 - else
21319 - ret = -EINVAL;
21320 - out_put:
21321 -diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
21322 -index cb1a027..dd58c6a 100644
21323 ---- a/drivers/pci/setup-bus.c
21324 -+++ b/drivers/pci/setup-bus.c
21325 -@@ -142,7 +142,6 @@ static void pci_setup_bridge(struct pci_bus *bus)
21326 - struct pci_dev *bridge = bus->self;
21327 - struct pci_bus_region region;
21328 - u32 l, bu, lu, io_upper16;
21329 -- int pref_mem64;
21330 -
21331 - if (pci_is_enabled(bridge))
21332 - return;
21333 -@@ -198,7 +197,6 @@ static void pci_setup_bridge(struct pci_bus *bus)
21334 - pci_write_config_dword(bridge, PCI_PREF_LIMIT_UPPER32, 0);
21335 -
21336 - /* Set up PREF base/limit. */
21337 -- pref_mem64 = 0;
21338 - bu = lu = 0;
21339 - pcibios_resource_to_bus(bridge, &region, bus->resource[2]);
21340 - if (bus->resource[2]->flags & IORESOURCE_PREFETCH) {
21341 -@@ -206,7 +204,6 @@ static void pci_setup_bridge(struct pci_bus *bus)
21342 - l = (region.start >> 16) & 0xfff0;
21343 - l |= region.end & 0xfff00000;
21344 - if (bus->resource[2]->flags & IORESOURCE_MEM_64) {
21345 -- pref_mem64 = 1;
21346 - bu = upper_32_bits(region.start);
21347 - lu = upper_32_bits(region.end);
21348 - width = 16;
21349 -@@ -221,11 +218,9 @@ static void pci_setup_bridge(struct pci_bus *bus)
21350 - }
21351 - pci_write_config_dword(bridge, PCI_PREF_MEMORY_BASE, l);
21352 -
21353 -- if (pref_mem64) {
21354 -- /* Set the upper 32 bits of PREF base & limit. */
21355 -- pci_write_config_dword(bridge, PCI_PREF_BASE_UPPER32, bu);
21356 -- pci_write_config_dword(bridge, PCI_PREF_LIMIT_UPPER32, lu);
21357 -- }
21358 -+ /* Set the upper 32 bits of PREF base & limit. */
21359 -+ pci_write_config_dword(bridge, PCI_PREF_BASE_UPPER32, bu);
21360 -+ pci_write_config_dword(bridge, PCI_PREF_LIMIT_UPPER32, lu);
21361 -
21362 - pci_write_config_word(bridge, PCI_BRIDGE_CONTROL, bus->bridge_ctl);
21363 - }
21364 -diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
21365 -index 2490b74..55f9973 100644
21366 ---- a/drivers/s390/cio/device.c
21367 -+++ b/drivers/s390/cio/device.c
21368 -@@ -1292,7 +1292,7 @@ static int io_subchannel_probe(struct subchannel *sch)
21369 - sch->private = kzalloc(sizeof(struct io_subchannel_private),
21370 - GFP_KERNEL | GFP_DMA);
21371 - if (!sch->private)
21372 -- goto out_err;
21373 -+ goto out_schedule;
21374 - /*
21375 - * First check if a fitting device may be found amongst the
21376 - * disconnected devices or in the orphanage.
21377 -@@ -1317,7 +1317,7 @@ static int io_subchannel_probe(struct subchannel *sch)
21378 - }
21379 - cdev = io_subchannel_create_ccwdev(sch);
21380 - if (IS_ERR(cdev))
21381 -- goto out_err;
21382 -+ goto out_schedule;
21383 - rc = io_subchannel_recog(cdev, sch);
21384 - if (rc) {
21385 - spin_lock_irqsave(sch->lock, flags);
21386 -@@ -1325,9 +1325,7 @@ static int io_subchannel_probe(struct subchannel *sch)
21387 - spin_unlock_irqrestore(sch->lock, flags);
21388 - }
21389 - return 0;
21390 --out_err:
21391 -- kfree(sch->private);
21392 -- sysfs_remove_group(&sch->dev.kobj, &io_subchannel_attr_group);
21393 -+
21394 - out_schedule:
21395 - io_subchannel_schedule_removal(sch);
21396 - return 0;
21397 -@@ -1341,13 +1339,14 @@ io_subchannel_remove (struct subchannel *sch)
21398 -
21399 - cdev = sch_get_cdev(sch);
21400 - if (!cdev)
21401 -- return 0;
21402 -+ goto out_free;
21403 - /* Set ccw device to not operational and drop reference. */
21404 - spin_lock_irqsave(cdev->ccwlock, flags);
21405 - sch_set_cdev(sch, NULL);
21406 - cdev->private->state = DEV_STATE_NOT_OPER;
21407 - spin_unlock_irqrestore(cdev->ccwlock, flags);
21408 - ccw_device_unregister(cdev);
21409 -+out_free:
21410 - kfree(sch->private);
21411 - sysfs_remove_group(&sch->dev.kobj, &io_subchannel_attr_group);
21412 - return 0;
21413 -diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c
21414 -index b9613d7..13b703a 100644
21415 ---- a/drivers/s390/cio/device_fsm.c
21416 -+++ b/drivers/s390/cio/device_fsm.c
21417 -@@ -1080,14 +1080,14 @@ void ccw_device_trigger_reprobe(struct ccw_device *cdev)
21418 - ccw_device_start_id(cdev, 0);
21419 - }
21420 -
21421 --static void
21422 --ccw_device_offline_irq(struct ccw_device *cdev, enum dev_event dev_event)
21423 -+static void ccw_device_disabled_irq(struct ccw_device *cdev,
21424 -+ enum dev_event dev_event)
21425 - {
21426 - struct subchannel *sch;
21427 -
21428 - sch = to_subchannel(cdev->dev.parent);
21429 - /*
21430 -- * An interrupt in state offline means a previous disable was not
21431 -+ * An interrupt in a disabled state means a previous disable was not
21432 - * successful - should not happen, but we try to disable again.
21433 - */
21434 - cio_disable_subchannel(sch);
21435 -@@ -1150,25 +1150,12 @@ ccw_device_nop(struct ccw_device *cdev, enum dev_event dev_event)
21436 - }
21437 -
21438 - /*
21439 -- * Bug operation action.
21440 -- */
21441 --static void
21442 --ccw_device_bug(struct ccw_device *cdev, enum dev_event dev_event)
21443 --{
21444 -- CIO_MSG_EVENT(0, "Internal state [%i][%i] not handled for device "
21445 -- "0.%x.%04x\n", cdev->private->state, dev_event,
21446 -- cdev->private->dev_id.ssid,
21447 -- cdev->private->dev_id.devno);
21448 -- BUG();
21449 --}
21450 --
21451 --/*
21452 - * device statemachine
21453 - */
21454 - fsm_func_t *dev_jumptable[NR_DEV_STATES][NR_DEV_EVENTS] = {
21455 - [DEV_STATE_NOT_OPER] = {
21456 - [DEV_EVENT_NOTOPER] = ccw_device_nop,
21457 -- [DEV_EVENT_INTERRUPT] = ccw_device_bug,
21458 -+ [DEV_EVENT_INTERRUPT] = ccw_device_disabled_irq,
21459 - [DEV_EVENT_TIMEOUT] = ccw_device_nop,
21460 - [DEV_EVENT_VERIFY] = ccw_device_nop,
21461 - },
21462 -@@ -1186,7 +1173,7 @@ fsm_func_t *dev_jumptable[NR_DEV_STATES][NR_DEV_EVENTS] = {
21463 - },
21464 - [DEV_STATE_OFFLINE] = {
21465 - [DEV_EVENT_NOTOPER] = ccw_device_generic_notoper,
21466 -- [DEV_EVENT_INTERRUPT] = ccw_device_offline_irq,
21467 -+ [DEV_EVENT_INTERRUPT] = ccw_device_disabled_irq,
21468 - [DEV_EVENT_TIMEOUT] = ccw_device_nop,
21469 - [DEV_EVENT_VERIFY] = ccw_device_offline_verify,
21470 - },
21471 -@@ -1243,7 +1230,7 @@ fsm_func_t *dev_jumptable[NR_DEV_STATES][NR_DEV_EVENTS] = {
21472 - [DEV_STATE_DISCONNECTED] = {
21473 - [DEV_EVENT_NOTOPER] = ccw_device_nop,
21474 - [DEV_EVENT_INTERRUPT] = ccw_device_start_id,
21475 -- [DEV_EVENT_TIMEOUT] = ccw_device_bug,
21476 -+ [DEV_EVENT_TIMEOUT] = ccw_device_nop,
21477 - [DEV_EVENT_VERIFY] = ccw_device_start_id,
21478 - },
21479 - [DEV_STATE_DISCONNECTED_SENSE_ID] = {
21480 -diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c
21481 -index c84eadd..395c04c 100644
21482 ---- a/drivers/s390/net/netiucv.c
21483 -+++ b/drivers/s390/net/netiucv.c
21484 -@@ -741,13 +741,13 @@ static void conn_action_txdone(fsm_instance *fi, int event, void *arg)
21485 - if (single_flag) {
21486 - if ((skb = skb_dequeue(&conn->commit_queue))) {
21487 - atomic_dec(&skb->users);
21488 -- dev_kfree_skb_any(skb);
21489 - if (privptr) {
21490 - privptr->stats.tx_packets++;
21491 - privptr->stats.tx_bytes +=
21492 - (skb->len - NETIUCV_HDRLEN
21493 -- - NETIUCV_HDRLEN);
21494 -+ - NETIUCV_HDRLEN);
21495 - }
21496 -+ dev_kfree_skb_any(skb);
21497 - }
21498 - }
21499 - conn->tx_buff->data = conn->tx_buff->head;
21500 -diff --git a/drivers/scsi/device_handler/scsi_dh.c b/drivers/scsi/device_handler/scsi_dh.c
21501 -index 3ee1cbc..bfec4fa 100644
21502 ---- a/drivers/scsi/device_handler/scsi_dh.c
21503 -+++ b/drivers/scsi/device_handler/scsi_dh.c
21504 -@@ -304,18 +304,15 @@ static int scsi_dh_notifier(struct notifier_block *nb,
21505 - sdev = to_scsi_device(dev);
21506 -
21507 - if (action == BUS_NOTIFY_ADD_DEVICE) {
21508 -+ err = device_create_file(dev, &scsi_dh_state_attr);
21509 -+ /* don't care about err */
21510 - devinfo = device_handler_match(NULL, sdev);
21511 -- if (!devinfo)
21512 -- goto out;
21513 --
21514 -- err = scsi_dh_handler_attach(sdev, devinfo);
21515 -- if (!err)
21516 -- err = device_create_file(dev, &scsi_dh_state_attr);
21517 -+ if (devinfo)
21518 -+ err = scsi_dh_handler_attach(sdev, devinfo);
21519 - } else if (action == BUS_NOTIFY_DEL_DEVICE) {
21520 - device_remove_file(dev, &scsi_dh_state_attr);
21521 - scsi_dh_handler_detach(sdev, NULL);
21522 - }
21523 --out:
21524 - return err;
21525 - }
21526 -
21527 -diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
21528 -index 704b8e0..70ab5d0 100644
21529 ---- a/drivers/scsi/fcoe/fcoe.c
21530 -+++ b/drivers/scsi/fcoe/fcoe.c
21531 -@@ -137,7 +137,7 @@ static struct scsi_host_template fcoe_shost_template = {
21532 - .change_queue_depth = fc_change_queue_depth,
21533 - .change_queue_type = fc_change_queue_type,
21534 - .this_id = -1,
21535 -- .cmd_per_lun = 32,
21536 -+ .cmd_per_lun = 3,
21537 - .can_queue = FCOE_MAX_OUTSTANDING_COMMANDS,
21538 - .use_clustering = ENABLE_CLUSTERING,
21539 - .sg_tablesize = SG_ALL,
21540 -@@ -160,6 +160,7 @@ static int fcoe_interface_setup(struct fcoe_interface *fcoe,
21541 - {
21542 - struct fcoe_ctlr *fip = &fcoe->ctlr;
21543 - struct netdev_hw_addr *ha;
21544 -+ struct net_device *real_dev;
21545 - u8 flogi_maddr[ETH_ALEN];
21546 -
21547 - fcoe->netdev = netdev;
21548 -@@ -173,10 +174,12 @@ static int fcoe_interface_setup(struct fcoe_interface *fcoe,
21549 -
21550 - /* look for SAN MAC address, if multiple SAN MACs exist, only
21551 - * use the first one for SPMA */
21552 -+ real_dev = (netdev->priv_flags & IFF_802_1Q_VLAN) ?
21553 -+ vlan_dev_real_dev(netdev) : netdev;
21554 - rcu_read_lock();
21555 -- for_each_dev_addr(netdev, ha) {
21556 -+ for_each_dev_addr(real_dev, ha) {
21557 - if ((ha->type == NETDEV_HW_ADDR_T_SAN) &&
21558 -- (is_valid_ether_addr(fip->ctl_src_addr))) {
21559 -+ (is_valid_ether_addr(ha->addr))) {
21560 - memcpy(fip->ctl_src_addr, ha->addr, ETH_ALEN);
21561 - fip->spma = 1;
21562 - break;
21563 -@@ -664,7 +667,7 @@ static int fcoe_ddp_setup(struct fc_lport *lp, u16 xid,
21564 - {
21565 - struct net_device *n = fcoe_netdev(lp);
21566 -
21567 -- if (n->netdev_ops && n->netdev_ops->ndo_fcoe_ddp_setup)
21568 -+ if (n->netdev_ops->ndo_fcoe_ddp_setup)
21569 - return n->netdev_ops->ndo_fcoe_ddp_setup(n, xid, sgl, sgc);
21570 -
21571 - return 0;
21572 -@@ -681,7 +684,7 @@ static int fcoe_ddp_done(struct fc_lport *lp, u16 xid)
21573 - {
21574 - struct net_device *n = fcoe_netdev(lp);
21575 -
21576 -- if (n->netdev_ops && n->netdev_ops->ndo_fcoe_ddp_done)
21577 -+ if (n->netdev_ops->ndo_fcoe_ddp_done)
21578 - return n->netdev_ops->ndo_fcoe_ddp_done(n, xid);
21579 - return 0;
21580 - }
21581 -@@ -1631,7 +1634,7 @@ static int fcoe_destroy(const char *buffer, struct kernel_param *kp)
21582 - {
21583 - struct fcoe_interface *fcoe;
21584 - struct net_device *netdev;
21585 -- int rc;
21586 -+ int rc = 0;
21587 -
21588 - mutex_lock(&fcoe_config_mutex);
21589 - #ifdef CONFIG_FCOE_MODULE
21590 -diff --git a/drivers/scsi/libfc/fc_disc.c b/drivers/scsi/libfc/fc_disc.c
21591 -index c48799e..d4cb3f9 100644
21592 ---- a/drivers/scsi/libfc/fc_disc.c
21593 -+++ b/drivers/scsi/libfc/fc_disc.c
21594 -@@ -371,7 +371,7 @@ static void fc_disc_gpn_ft_req(struct fc_disc *disc)
21595 - disc, lport->e_d_tov))
21596 - return;
21597 - err:
21598 -- fc_disc_error(disc, fp);
21599 -+ fc_disc_error(disc, NULL);
21600 - }
21601 -
21602 - /**
21603 -diff --git a/drivers/scsi/libfc/fc_elsct.c b/drivers/scsi/libfc/fc_elsct.c
21604 -index 5cfa687..9298458 100644
21605 ---- a/drivers/scsi/libfc/fc_elsct.c
21606 -+++ b/drivers/scsi/libfc/fc_elsct.c
21607 -@@ -53,8 +53,10 @@ static struct fc_seq *fc_elsct_send(struct fc_lport *lport,
21608 - did = FC_FID_DIR_SERV;
21609 - }
21610 -
21611 -- if (rc)
21612 -+ if (rc) {
21613 -+ fc_frame_free(fp);
21614 - return NULL;
21615 -+ }
21616 -
21617 - fc_fill_fc_hdr(fp, r_ctl, did, fc_host_port_id(lport->host), fh_type,
21618 - FC_FC_FIRST_SEQ | FC_FC_END_SEQ | FC_FC_SEQ_INIT, 0);
21619 -diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
21620 -index 59a4408..7a14402 100644
21621 ---- a/drivers/scsi/libfc/fc_fcp.c
21622 -+++ b/drivers/scsi/libfc/fc_fcp.c
21623 -@@ -302,10 +302,13 @@ static void fc_fcp_ddp_done(struct fc_fcp_pkt *fsp)
21624 - if (!fsp)
21625 - return;
21626 -
21627 -+ if (fsp->xfer_ddp == FC_XID_UNKNOWN)
21628 -+ return;
21629 -+
21630 - lp = fsp->lp;
21631 -- if (fsp->xfer_ddp && lp->tt.ddp_done) {
21632 -+ if (lp->tt.ddp_done) {
21633 - fsp->xfer_len = lp->tt.ddp_done(lp, fsp->xfer_ddp);
21634 -- fsp->xfer_ddp = 0;
21635 -+ fsp->xfer_ddp = FC_XID_UNKNOWN;
21636 - }
21637 - }
21638 -
21639 -@@ -572,7 +575,8 @@ static int fc_fcp_send_data(struct fc_fcp_pkt *fsp, struct fc_seq *seq,
21640 - tlen -= sg_bytes;
21641 - remaining -= sg_bytes;
21642 -
21643 -- if (tlen)
21644 -+ if ((skb_shinfo(fp_skb(fp))->nr_frags < FC_FRAME_SG_LEN) &&
21645 -+ (tlen))
21646 - continue;
21647 -
21648 - /*
21649 -@@ -1048,7 +1052,6 @@ static int fc_fcp_cmd_send(struct fc_lport *lp, struct fc_fcp_pkt *fsp,
21650 -
21651 - seq = lp->tt.exch_seq_send(lp, fp, resp, fc_fcp_pkt_destroy, fsp, 0);
21652 - if (!seq) {
21653 -- fc_frame_free(fp);
21654 - rc = -1;
21655 - goto unlock;
21656 - }
21657 -@@ -1313,7 +1316,6 @@ static void fc_fcp_rec(struct fc_fcp_pkt *fsp)
21658 - fc_fcp_pkt_hold(fsp); /* hold while REC outstanding */
21659 - return;
21660 - }
21661 -- fc_frame_free(fp);
21662 - retry:
21663 - if (fsp->recov_retry++ < FC_MAX_RECOV_RETRY)
21664 - fc_fcp_timer_set(fsp, FC_SCSI_REC_TOV);
21665 -@@ -1561,10 +1563,9 @@ static void fc_fcp_srr(struct fc_fcp_pkt *fsp, enum fc_rctl r_ctl, u32 offset)
21666 -
21667 - seq = lp->tt.exch_seq_send(lp, fp, fc_fcp_srr_resp, NULL,
21668 - fsp, jiffies_to_msecs(FC_SCSI_REC_TOV));
21669 -- if (!seq) {
21670 -- fc_frame_free(fp);
21671 -+ if (!seq)
21672 - goto retry;
21673 -- }
21674 -+
21675 - fsp->recov_seq = seq;
21676 - fsp->xfer_len = offset;
21677 - fsp->xfer_contig_end = offset;
21678 -@@ -1708,6 +1709,7 @@ int fc_queuecommand(struct scsi_cmnd *sc_cmd, void (*done)(struct scsi_cmnd *))
21679 - fsp->cmd = sc_cmd; /* save the cmd */
21680 - fsp->lp = lp; /* save the softc ptr */
21681 - fsp->rport = rport; /* set the remote port ptr */
21682 -+ fsp->xfer_ddp = FC_XID_UNKNOWN;
21683 - sc_cmd->scsi_done = done;
21684 -
21685 - /*
21686 -@@ -1846,7 +1848,8 @@ static void fc_io_compl(struct fc_fcp_pkt *fsp)
21687 - * scsi status is good but transport level
21688 - * underrun.
21689 - */
21690 -- sc_cmd->result = DID_OK << 16;
21691 -+ sc_cmd->result = (fsp->state & FC_SRB_RCV_STATUS ?
21692 -+ DID_OK : DID_ERROR) << 16;
21693 - } else {
21694 - /*
21695 - * scsi got underrun, this is an error
21696 -@@ -2046,18 +2049,16 @@ EXPORT_SYMBOL(fc_eh_host_reset);
21697 - int fc_slave_alloc(struct scsi_device *sdev)
21698 - {
21699 - struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
21700 -- int queue_depth;
21701 -
21702 - if (!rport || fc_remote_port_chkready(rport))
21703 - return -ENXIO;
21704 -
21705 -- if (sdev->tagged_supported) {
21706 -- if (sdev->host->hostt->cmd_per_lun)
21707 -- queue_depth = sdev->host->hostt->cmd_per_lun;
21708 -- else
21709 -- queue_depth = FC_FCP_DFLT_QUEUE_DEPTH;
21710 -- scsi_activate_tcq(sdev, queue_depth);
21711 -- }
21712 -+ if (sdev->tagged_supported)
21713 -+ scsi_activate_tcq(sdev, FC_FCP_DFLT_QUEUE_DEPTH);
21714 -+ else
21715 -+ scsi_adjust_queue_depth(sdev, scsi_get_tag_type(sdev),
21716 -+ FC_FCP_DFLT_QUEUE_DEPTH);
21717 -+
21718 - return 0;
21719 - }
21720 - EXPORT_SYMBOL(fc_slave_alloc);
21721 -diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
21722 -index bd2f771..536492a 100644
21723 ---- a/drivers/scsi/libfc/fc_lport.c
21724 -+++ b/drivers/scsi/libfc/fc_lport.c
21725 -@@ -329,7 +329,7 @@ static void fc_lport_add_fc4_type(struct fc_lport *lport, enum fc_fh_type type)
21726 - * @sp: current sequence in the RLIR exchange
21727 - * @fp: RLIR request frame
21728 - *
21729 -- * Locking Note: The lport lock is exected to be held before calling
21730 -+ * Locking Note: The lport lock is expected to be held before calling
21731 - * this function.
21732 - */
21733 - static void fc_lport_recv_rlir_req(struct fc_seq *sp, struct fc_frame *fp,
21734 -@@ -348,7 +348,7 @@ static void fc_lport_recv_rlir_req(struct fc_seq *sp, struct fc_frame *fp,
21735 - * @sp: current sequence in the ECHO exchange
21736 - * @fp: ECHO request frame
21737 - *
21738 -- * Locking Note: The lport lock is exected to be held before calling
21739 -+ * Locking Note: The lport lock is expected to be held before calling
21740 - * this function.
21741 - */
21742 - static void fc_lport_recv_echo_req(struct fc_seq *sp, struct fc_frame *in_fp,
21743 -@@ -361,7 +361,7 @@ static void fc_lport_recv_echo_req(struct fc_seq *sp, struct fc_frame *in_fp,
21744 - void *dp;
21745 - u32 f_ctl;
21746 -
21747 -- FC_LPORT_DBG(lport, "Received RLIR request while in state %s\n",
21748 -+ FC_LPORT_DBG(lport, "Received ECHO request while in state %s\n",
21749 - fc_lport_state(lport));
21750 -
21751 - len = fr_len(in_fp) - sizeof(struct fc_frame_header);
21752 -@@ -374,7 +374,7 @@ static void fc_lport_recv_echo_req(struct fc_seq *sp, struct fc_frame *in_fp,
21753 - if (fp) {
21754 - dp = fc_frame_payload_get(fp, len);
21755 - memcpy(dp, pp, len);
21756 -- *((u32 *)dp) = htonl(ELS_LS_ACC << 24);
21757 -+ *((__be32 *)dp) = htonl(ELS_LS_ACC << 24);
21758 - sp = lport->tt.seq_start_next(sp);
21759 - f_ctl = FC_FC_EX_CTX | FC_FC_LAST_SEQ | FC_FC_END_SEQ;
21760 - fc_fill_fc_hdr(fp, FC_RCTL_ELS_REP, ep->did, ep->sid,
21761 -@@ -385,12 +385,12 @@ static void fc_lport_recv_echo_req(struct fc_seq *sp, struct fc_frame *in_fp,
21762 - }
21763 -
21764 - /**
21765 -- * fc_lport_recv_echo_req() - Handle received Request Node ID data request
21766 -- * @lport: Fibre Channel local port recieving the RNID
21767 -- * @sp: current sequence in the RNID exchange
21768 -- * @fp: RNID request frame
21769 -+ * fc_lport_recv_rnid_req() - Handle received Request Node ID data request
21770 -+ * @sp: The sequence in the RNID exchange
21771 -+ * @fp: The RNID request frame
21772 -+ * @lport: The local port recieving the RNID
21773 - *
21774 -- * Locking Note: The lport lock is exected to be held before calling
21775 -+ * Locking Note: The lport lock is expected to be held before calling
21776 - * this function.
21777 - */
21778 - static void fc_lport_recv_rnid_req(struct fc_seq *sp, struct fc_frame *in_fp,
21779 -@@ -667,7 +667,7 @@ static void fc_lport_enter_ready(struct fc_lport *lport)
21780 - * Accept it with the common service parameters indicating our N port.
21781 - * Set up to do a PLOGI if we have the higher-number WWPN.
21782 - *
21783 -- * Locking Note: The lport lock is exected to be held before calling
21784 -+ * Locking Note: The lport lock is expected to be held before calling
21785 - * this function.
21786 - */
21787 - static void fc_lport_recv_flogi_req(struct fc_seq *sp_in,
21788 -@@ -1115,7 +1115,7 @@ static void fc_lport_enter_scr(struct fc_lport *lport)
21789 -
21790 - if (!lport->tt.elsct_send(lport, FC_FID_FCTRL, fp, ELS_SCR,
21791 - fc_lport_scr_resp, lport, lport->e_d_tov))
21792 -- fc_lport_error(lport, fp);
21793 -+ fc_lport_error(lport, NULL);
21794 - }
21795 -
21796 - /**
21797 -@@ -1186,7 +1186,7 @@ static void fc_lport_enter_rpn_id(struct fc_lport *lport)
21798 - if (!lport->tt.elsct_send(lport, FC_FID_DIR_SERV, fp, FC_NS_RPN_ID,
21799 - fc_lport_rpn_id_resp,
21800 - lport, lport->e_d_tov))
21801 -- fc_lport_error(lport, fp);
21802 -+ fc_lport_error(lport, NULL);
21803 - }
21804 -
21805 - static struct fc_rport_operations fc_lport_rport_ops = {
21806 -@@ -1237,10 +1237,13 @@ static void fc_lport_timeout(struct work_struct *work)
21807 -
21808 - switch (lport->state) {
21809 - case LPORT_ST_DISABLED:
21810 -+ WARN_ON(1);
21811 -+ break;
21812 - case LPORT_ST_READY:
21813 -- case LPORT_ST_RESET:
21814 - WARN_ON(1);
21815 - break;
21816 -+ case LPORT_ST_RESET:
21817 -+ break;
21818 - case LPORT_ST_FLOGI:
21819 - fc_lport_enter_flogi(lport);
21820 - break;
21821 -@@ -1337,7 +1340,7 @@ static void fc_lport_enter_logo(struct fc_lport *lport)
21822 -
21823 - if (!lport->tt.elsct_send(lport, FC_FID_FLOGI, fp, ELS_LOGO,
21824 - fc_lport_logo_resp, lport, lport->e_d_tov))
21825 -- fc_lport_error(lport, fp);
21826 -+ fc_lport_error(lport, NULL);
21827 - }
21828 -
21829 - /**
21830 -@@ -1453,7 +1456,7 @@ void fc_lport_enter_flogi(struct fc_lport *lport)
21831 -
21832 - if (!lport->tt.elsct_send(lport, FC_FID_FLOGI, fp, ELS_FLOGI,
21833 - fc_lport_flogi_resp, lport, lport->e_d_tov))
21834 -- fc_lport_error(lport, fp);
21835 -+ fc_lport_error(lport, NULL);
21836 - }
21837 -
21838 - /* Configure a fc_lport */
21839 -diff --git a/drivers/scsi/libfc/fc_rport.c b/drivers/scsi/libfc/fc_rport.c
21840 -index 03ea674..ff558a6 100644
21841 ---- a/drivers/scsi/libfc/fc_rport.c
21842 -+++ b/drivers/scsi/libfc/fc_rport.c
21843 -@@ -86,6 +86,7 @@ static const char *fc_rport_state_names[] = {
21844 - [RPORT_ST_LOGO] = "LOGO",
21845 - [RPORT_ST_ADISC] = "ADISC",
21846 - [RPORT_ST_DELETE] = "Delete",
21847 -+ [RPORT_ST_RESTART] = "Restart",
21848 - };
21849 -
21850 - /**
21851 -@@ -99,8 +100,7 @@ static struct fc_rport_priv *fc_rport_lookup(const struct fc_lport *lport,
21852 - struct fc_rport_priv *rdata;
21853 -
21854 - list_for_each_entry(rdata, &lport->disc.rports, peers)
21855 -- if (rdata->ids.port_id == port_id &&
21856 -- rdata->rp_state != RPORT_ST_DELETE)
21857 -+ if (rdata->ids.port_id == port_id)
21858 - return rdata;
21859 - return NULL;
21860 - }
21861 -@@ -235,6 +235,7 @@ static void fc_rport_work(struct work_struct *work)
21862 - struct fc_rport_operations *rport_ops;
21863 - struct fc_rport_identifiers ids;
21864 - struct fc_rport *rport;
21865 -+ int restart = 0;
21866 -
21867 - mutex_lock(&rdata->rp_mutex);
21868 - event = rdata->event;
21869 -@@ -287,8 +288,20 @@ static void fc_rport_work(struct work_struct *work)
21870 - mutex_unlock(&rdata->rp_mutex);
21871 -
21872 - if (port_id != FC_FID_DIR_SERV) {
21873 -+ /*
21874 -+ * We must drop rp_mutex before taking disc_mutex.
21875 -+ * Re-evaluate state to allow for restart.
21876 -+ * A transition to RESTART state must only happen
21877 -+ * while disc_mutex is held and rdata is on the list.
21878 -+ */
21879 - mutex_lock(&lport->disc.disc_mutex);
21880 -- list_del(&rdata->peers);
21881 -+ mutex_lock(&rdata->rp_mutex);
21882 -+ if (rdata->rp_state == RPORT_ST_RESTART)
21883 -+ restart = 1;
21884 -+ else
21885 -+ list_del(&rdata->peers);
21886 -+ rdata->event = RPORT_EV_NONE;
21887 -+ mutex_unlock(&rdata->rp_mutex);
21888 - mutex_unlock(&lport->disc.disc_mutex);
21889 - }
21890 -
21891 -@@ -312,7 +325,13 @@ static void fc_rport_work(struct work_struct *work)
21892 - mutex_unlock(&rdata->rp_mutex);
21893 - fc_remote_port_delete(rport);
21894 - }
21895 -- kref_put(&rdata->kref, lport->tt.rport_destroy);
21896 -+ if (restart) {
21897 -+ mutex_lock(&rdata->rp_mutex);
21898 -+ FC_RPORT_DBG(rdata, "work restart\n");
21899 -+ fc_rport_enter_plogi(rdata);
21900 -+ mutex_unlock(&rdata->rp_mutex);
21901 -+ } else
21902 -+ kref_put(&rdata->kref, lport->tt.rport_destroy);
21903 - break;
21904 -
21905 - default:
21906 -@@ -342,6 +361,12 @@ int fc_rport_login(struct fc_rport_priv *rdata)
21907 - FC_RPORT_DBG(rdata, "ADISC port\n");
21908 - fc_rport_enter_adisc(rdata);
21909 - break;
21910 -+ case RPORT_ST_RESTART:
21911 -+ break;
21912 -+ case RPORT_ST_DELETE:
21913 -+ FC_RPORT_DBG(rdata, "Restart deleted port\n");
21914 -+ fc_rport_state_enter(rdata, RPORT_ST_RESTART);
21915 -+ break;
21916 - default:
21917 - FC_RPORT_DBG(rdata, "Login to port\n");
21918 - fc_rport_enter_plogi(rdata);
21919 -@@ -397,20 +422,21 @@ int fc_rport_logoff(struct fc_rport_priv *rdata)
21920 -
21921 - if (rdata->rp_state == RPORT_ST_DELETE) {
21922 - FC_RPORT_DBG(rdata, "Port in Delete state, not removing\n");
21923 -- mutex_unlock(&rdata->rp_mutex);
21924 - goto out;
21925 - }
21926 -
21927 -- fc_rport_enter_logo(rdata);
21928 -+ if (rdata->rp_state == RPORT_ST_RESTART)
21929 -+ FC_RPORT_DBG(rdata, "Port in Restart state, deleting\n");
21930 -+ else
21931 -+ fc_rport_enter_logo(rdata);
21932 -
21933 - /*
21934 - * Change the state to Delete so that we discard
21935 - * the response.
21936 - */
21937 - fc_rport_enter_delete(rdata, RPORT_EV_STOP);
21938 -- mutex_unlock(&rdata->rp_mutex);
21939 --
21940 - out:
21941 -+ mutex_unlock(&rdata->rp_mutex);
21942 - return 0;
21943 - }
21944 -
21945 -@@ -466,6 +492,7 @@ static void fc_rport_timeout(struct work_struct *work)
21946 - case RPORT_ST_READY:
21947 - case RPORT_ST_INIT:
21948 - case RPORT_ST_DELETE:
21949 -+ case RPORT_ST_RESTART:
21950 - break;
21951 - }
21952 -
21953 -@@ -499,6 +526,7 @@ static void fc_rport_error(struct fc_rport_priv *rdata, struct fc_frame *fp)
21954 - fc_rport_enter_logo(rdata);
21955 - break;
21956 - case RPORT_ST_DELETE:
21957 -+ case RPORT_ST_RESTART:
21958 - case RPORT_ST_READY:
21959 - case RPORT_ST_INIT:
21960 - break;
21961 -@@ -632,7 +660,7 @@ static void fc_rport_enter_plogi(struct fc_rport_priv *rdata)
21962 -
21963 - if (!lport->tt.elsct_send(lport, rdata->ids.port_id, fp, ELS_PLOGI,
21964 - fc_rport_plogi_resp, rdata, lport->e_d_tov))
21965 -- fc_rport_error_retry(rdata, fp);
21966 -+ fc_rport_error_retry(rdata, NULL);
21967 - else
21968 - kref_get(&rdata->kref);
21969 - }
21970 -@@ -793,7 +821,7 @@ static void fc_rport_enter_prli(struct fc_rport_priv *rdata)
21971 -
21972 - if (!lport->tt.elsct_send(lport, rdata->ids.port_id, fp, ELS_PRLI,
21973 - fc_rport_prli_resp, rdata, lport->e_d_tov))
21974 -- fc_rport_error_retry(rdata, fp);
21975 -+ fc_rport_error_retry(rdata, NULL);
21976 - else
21977 - kref_get(&rdata->kref);
21978 - }
21979 -@@ -889,7 +917,7 @@ static void fc_rport_enter_rtv(struct fc_rport_priv *rdata)
21980 -
21981 - if (!lport->tt.elsct_send(lport, rdata->ids.port_id, fp, ELS_RTV,
21982 - fc_rport_rtv_resp, rdata, lport->e_d_tov))
21983 -- fc_rport_error_retry(rdata, fp);
21984 -+ fc_rport_error_retry(rdata, NULL);
21985 - else
21986 - kref_get(&rdata->kref);
21987 - }
21988 -@@ -919,7 +947,7 @@ static void fc_rport_enter_logo(struct fc_rport_priv *rdata)
21989 -
21990 - if (!lport->tt.elsct_send(lport, rdata->ids.port_id, fp, ELS_LOGO,
21991 - fc_rport_logo_resp, rdata, lport->e_d_tov))
21992 -- fc_rport_error_retry(rdata, fp);
21993 -+ fc_rport_error_retry(rdata, NULL);
21994 - else
21995 - kref_get(&rdata->kref);
21996 - }
21997 -@@ -1006,7 +1034,7 @@ static void fc_rport_enter_adisc(struct fc_rport_priv *rdata)
21998 - }
21999 - if (!lport->tt.elsct_send(lport, rdata->ids.port_id, fp, ELS_ADISC,
22000 - fc_rport_adisc_resp, rdata, lport->e_d_tov))
22001 -- fc_rport_error_retry(rdata, fp);
22002 -+ fc_rport_error_retry(rdata, NULL);
22003 - else
22004 - kref_get(&rdata->kref);
22005 - }
22006 -@@ -1248,6 +1276,7 @@ static void fc_rport_recv_plogi_req(struct fc_lport *lport,
22007 - }
22008 - break;
22009 - case RPORT_ST_PRLI:
22010 -+ case RPORT_ST_RTV:
22011 - case RPORT_ST_READY:
22012 - case RPORT_ST_ADISC:
22013 - FC_RPORT_DBG(rdata, "Received PLOGI in logged-in state %d "
22014 -@@ -1255,11 +1284,14 @@ static void fc_rport_recv_plogi_req(struct fc_lport *lport,
22015 - /* XXX TBD - should reset */
22016 - break;
22017 - case RPORT_ST_DELETE:
22018 -- default:
22019 -- FC_RPORT_DBG(rdata, "Received PLOGI in unexpected state %d\n",
22020 -- rdata->rp_state);
22021 -- fc_frame_free(rx_fp);
22022 -- goto out;
22023 -+ case RPORT_ST_LOGO:
22024 -+ case RPORT_ST_RESTART:
22025 -+ FC_RPORT_DBG(rdata, "Received PLOGI in state %s - send busy\n",
22026 -+ fc_rport_state(rdata));
22027 -+ mutex_unlock(&rdata->rp_mutex);
22028 -+ rjt_data.reason = ELS_RJT_BUSY;
22029 -+ rjt_data.explan = ELS_EXPL_NONE;
22030 -+ goto reject;
22031 - }
22032 -
22033 - /*
22034 -@@ -1402,7 +1434,7 @@ static void fc_rport_recv_prli_req(struct fc_rport_priv *rdata,
22035 - break;
22036 - case FC_TYPE_FCP:
22037 - fcp_parm = ntohl(rspp->spp_params);
22038 -- if (fcp_parm * FCP_SPPF_RETRY)
22039 -+ if (fcp_parm & FCP_SPPF_RETRY)
22040 - rdata->flags |= FC_RP_FLAGS_RETRY;
22041 - rdata->supported_classes = FC_COS_CLASS3;
22042 - if (fcp_parm & FCP_SPPF_INIT_FCN)
22043 -@@ -1510,14 +1542,14 @@ static void fc_rport_recv_logo_req(struct fc_lport *lport,
22044 - FC_RPORT_DBG(rdata, "Received LOGO request while in state %s\n",
22045 - fc_rport_state(rdata));
22046 -
22047 -+ fc_rport_enter_delete(rdata, RPORT_EV_LOGO);
22048 -+
22049 - /*
22050 -- * If the remote port was created due to discovery,
22051 -- * log back in. It may have seen a stale RSCN about us.
22052 -+ * If the remote port was created due to discovery, set state
22053 -+ * to log back in. It may have seen a stale RSCN about us.
22054 - */
22055 -- if (rdata->rp_state != RPORT_ST_DELETE && rdata->disc_id)
22056 -- fc_rport_enter_plogi(rdata);
22057 -- else
22058 -- fc_rport_enter_delete(rdata, RPORT_EV_LOGO);
22059 -+ if (rdata->disc_id)
22060 -+ fc_rport_state_enter(rdata, RPORT_ST_RESTART);
22061 - mutex_unlock(&rdata->rp_mutex);
22062 - } else
22063 - FC_RPORT_ID_DBG(lport, sid,
22064 -diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
22065 -index f913f1e..549bc7d 100644
22066 ---- a/drivers/scsi/lpfc/lpfc_init.c
22067 -+++ b/drivers/scsi/lpfc/lpfc_init.c
22068 -@@ -4384,9 +4384,13 @@ lpfc_sli_pci_mem_setup(struct lpfc_hba *phba)
22069 - pdev = phba->pcidev;
22070 -
22071 - /* Set the device DMA mask size */
22072 -- if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) != 0)
22073 -- if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0)
22074 -+ if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) != 0
22075 -+ || pci_set_consistent_dma_mask(pdev,DMA_BIT_MASK(64)) != 0) {
22076 -+ if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0
22077 -+ || pci_set_consistent_dma_mask(pdev,DMA_BIT_MASK(32)) != 0) {
22078 - return error;
22079 -+ }
22080 -+ }
22081 -
22082 - /* Get the bus address of Bar0 and Bar2 and the number of bytes
22083 - * required by each mapping.
22084 -@@ -5940,9 +5944,13 @@ lpfc_sli4_pci_mem_setup(struct lpfc_hba *phba)
22085 - pdev = phba->pcidev;
22086 -
22087 - /* Set the device DMA mask size */
22088 -- if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) != 0)
22089 -- if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0)
22090 -+ if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) != 0
22091 -+ || pci_set_consistent_dma_mask(pdev,DMA_BIT_MASK(64)) != 0) {
22092 -+ if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0
22093 -+ || pci_set_consistent_dma_mask(pdev,DMA_BIT_MASK(32)) != 0) {
22094 - return error;
22095 -+ }
22096 -+ }
22097 -
22098 - /* Get the bus address of SLI4 device Bar0, Bar1, and Bar2 and the
22099 - * number of bytes required by each mapping. They are actually
22100 -diff --git a/drivers/scsi/mpt2sas/mpi/mpi2_cnfg.h b/drivers/scsi/mpt2sas/mpi/mpi2_cnfg.h
22101 -index ab47c46..5af66db 100644
22102 ---- a/drivers/scsi/mpt2sas/mpi/mpi2_cnfg.h
22103 -+++ b/drivers/scsi/mpt2sas/mpi/mpi2_cnfg.h
22104 -@@ -348,6 +348,14 @@ typedef struct _MPI2_CONFIG_REPLY
22105 - #define MPI2_MFGPAGE_DEVID_SAS2108_3 (0x0077)
22106 - #define MPI2_MFGPAGE_DEVID_SAS2116_1 (0x0064)
22107 - #define MPI2_MFGPAGE_DEVID_SAS2116_2 (0x0065)
22108 -+#define MPI2_MFGPAGE_DEVID_SAS2208_1 (0x0080)
22109 -+#define MPI2_MFGPAGE_DEVID_SAS2208_2 (0x0081)
22110 -+#define MPI2_MFGPAGE_DEVID_SAS2208_3 (0x0082)
22111 -+#define MPI2_MFGPAGE_DEVID_SAS2208_4 (0x0083)
22112 -+#define MPI2_MFGPAGE_DEVID_SAS2208_5 (0x0084)
22113 -+#define MPI2_MFGPAGE_DEVID_SAS2208_6 (0x0085)
22114 -+#define MPI2_MFGPAGE_DEVID_SAS2208_7 (0x0086)
22115 -+#define MPI2_MFGPAGE_DEVID_SAS2208_8 (0x0087)
22116 -
22117 -
22118 - /* Manufacturing Page 0 */
22119 -diff --git a/drivers/scsi/mpt2sas/mpt2sas_scsih.c b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
22120 -index 86ab32d..1743640 100644
22121 ---- a/drivers/scsi/mpt2sas/mpt2sas_scsih.c
22122 -+++ b/drivers/scsi/mpt2sas/mpt2sas_scsih.c
22123 -@@ -196,10 +196,28 @@ static struct pci_device_id scsih_pci_table[] = {
22124 - PCI_ANY_ID, PCI_ANY_ID },
22125 - { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2108_3,
22126 - PCI_ANY_ID, PCI_ANY_ID },
22127 -+ /* Meteor ~ 2116 */
22128 - { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2116_1,
22129 - PCI_ANY_ID, PCI_ANY_ID },
22130 - { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2116_2,
22131 - PCI_ANY_ID, PCI_ANY_ID },
22132 -+ /* Thunderbolt ~ 2208 */
22133 -+ { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2208_1,
22134 -+ PCI_ANY_ID, PCI_ANY_ID },
22135 -+ { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2208_2,
22136 -+ PCI_ANY_ID, PCI_ANY_ID },
22137 -+ { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2208_3,
22138 -+ PCI_ANY_ID, PCI_ANY_ID },
22139 -+ { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2208_4,
22140 -+ PCI_ANY_ID, PCI_ANY_ID },
22141 -+ { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2208_5,
22142 -+ PCI_ANY_ID, PCI_ANY_ID },
22143 -+ { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2208_6,
22144 -+ PCI_ANY_ID, PCI_ANY_ID },
22145 -+ { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2208_7,
22146 -+ PCI_ANY_ID, PCI_ANY_ID },
22147 -+ { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2208_8,
22148 -+ PCI_ANY_ID, PCI_ANY_ID },
22149 - {0} /* Terminating entry */
22150 - };
22151 - MODULE_DEVICE_TABLE(pci, scsih_pci_table);
22152 -diff --git a/drivers/scsi/scsi_devinfo.c b/drivers/scsi/scsi_devinfo.c
22153 -index 93c2622..802e91c 100644
22154 ---- a/drivers/scsi/scsi_devinfo.c
22155 -+++ b/drivers/scsi/scsi_devinfo.c
22156 -@@ -168,11 +168,10 @@ static struct {
22157 - {"Generic", "USB SD Reader", "1.00", BLIST_FORCELUN | BLIST_INQUIRY_36},
22158 - {"Generic", "USB Storage-SMC", "0180", BLIST_FORCELUN | BLIST_INQUIRY_36},
22159 - {"Generic", "USB Storage-SMC", "0207", BLIST_FORCELUN | BLIST_INQUIRY_36},
22160 -- {"HITACHI", "DF400", "*", BLIST_SPARSELUN},
22161 -- {"HITACHI", "DF500", "*", BLIST_SPARSELUN},
22162 -- {"HITACHI", "DF600", "*", BLIST_SPARSELUN},
22163 -- {"HITACHI", "DISK-SUBSYSTEM", "*", BLIST_ATTACH_PQ3 | BLIST_SPARSELUN | BLIST_LARGELUN},
22164 -- {"HITACHI", "OPEN-E", "*", BLIST_ATTACH_PQ3 | BLIST_SPARSELUN | BLIST_LARGELUN},
22165 -+ {"HITACHI", "DF400", "*", BLIST_REPORTLUN2},
22166 -+ {"HITACHI", "DF500", "*", BLIST_REPORTLUN2},
22167 -+ {"HITACHI", "DISK-SUBSYSTEM", "*", BLIST_REPORTLUN2},
22168 -+ {"HITACHI", "OPEN-", "*", BLIST_REPORTLUN2},
22169 - {"HITACHI", "OP-C-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
22170 - {"HITACHI", "3380-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
22171 - {"HITACHI", "3390-", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
22172 -diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
22173 -index 45be82f..bf52dec 100644
22174 ---- a/drivers/scsi/scsi_transport_fc.c
22175 -+++ b/drivers/scsi/scsi_transport_fc.c
22176 -@@ -2395,6 +2395,7 @@ fc_rport_final_delete(struct work_struct *work)
22177 - struct Scsi_Host *shost = rport_to_shost(rport);
22178 - struct fc_internal *i = to_fc_internal(shost->transportt);
22179 - unsigned long flags;
22180 -+ int do_callback = 0;
22181 -
22182 - /*
22183 - * if a scan is pending, flush the SCSI Host work_q so that
22184 -@@ -2433,8 +2434,15 @@ fc_rport_final_delete(struct work_struct *work)
22185 - * Avoid this call if we already called it when we preserved the
22186 - * rport for the binding.
22187 - */
22188 -+ spin_lock_irqsave(shost->host_lock, flags);
22189 - if (!(rport->flags & FC_RPORT_DEVLOSS_CALLBK_DONE) &&
22190 -- (i->f->dev_loss_tmo_callbk))
22191 -+ (i->f->dev_loss_tmo_callbk)) {
22192 -+ rport->flags |= FC_RPORT_DEVLOSS_CALLBK_DONE;
22193 -+ do_callback = 1;
22194 -+ }
22195 -+ spin_unlock_irqrestore(shost->host_lock, flags);
22196 -+
22197 -+ if (do_callback)
22198 - i->f->dev_loss_tmo_callbk(rport);
22199 -
22200 - fc_bsg_remove(rport->rqst_q);
22201 -@@ -2981,6 +2989,7 @@ fc_timeout_deleted_rport(struct work_struct *work)
22202 - struct fc_internal *i = to_fc_internal(shost->transportt);
22203 - struct fc_host_attrs *fc_host = shost_to_fc_host(shost);
22204 - unsigned long flags;
22205 -+ int do_callback = 0;
22206 -
22207 - spin_lock_irqsave(shost->host_lock, flags);
22208 -
22209 -@@ -3046,7 +3055,6 @@ fc_timeout_deleted_rport(struct work_struct *work)
22210 - rport->roles = FC_PORT_ROLE_UNKNOWN;
22211 - rport->port_state = FC_PORTSTATE_NOTPRESENT;
22212 - rport->flags &= ~FC_RPORT_FAST_FAIL_TIMEDOUT;
22213 -- rport->flags |= FC_RPORT_DEVLOSS_CALLBK_DONE;
22214 -
22215 - /*
22216 - * Pre-emptively kill I/O rather than waiting for the work queue
22217 -@@ -3056,32 +3064,40 @@ fc_timeout_deleted_rport(struct work_struct *work)
22218 - spin_unlock_irqrestore(shost->host_lock, flags);
22219 - fc_terminate_rport_io(rport);
22220 -
22221 -- BUG_ON(rport->port_state != FC_PORTSTATE_NOTPRESENT);
22222 -+ spin_lock_irqsave(shost->host_lock, flags);
22223 -
22224 -- /* remove the identifiers that aren't used in the consisting binding */
22225 -- switch (fc_host->tgtid_bind_type) {
22226 -- case FC_TGTID_BIND_BY_WWPN:
22227 -- rport->node_name = -1;
22228 -- rport->port_id = -1;
22229 -- break;
22230 -- case FC_TGTID_BIND_BY_WWNN:
22231 -- rport->port_name = -1;
22232 -- rport->port_id = -1;
22233 -- break;
22234 -- case FC_TGTID_BIND_BY_ID:
22235 -- rport->node_name = -1;
22236 -- rport->port_name = -1;
22237 -- break;
22238 -- case FC_TGTID_BIND_NONE: /* to keep compiler happy */
22239 -- break;
22240 -+ if (rport->port_state == FC_PORTSTATE_NOTPRESENT) { /* still missing */
22241 -+
22242 -+ /* remove the identifiers that aren't used in the consisting binding */
22243 -+ switch (fc_host->tgtid_bind_type) {
22244 -+ case FC_TGTID_BIND_BY_WWPN:
22245 -+ rport->node_name = -1;
22246 -+ rport->port_id = -1;
22247 -+ break;
22248 -+ case FC_TGTID_BIND_BY_WWNN:
22249 -+ rport->port_name = -1;
22250 -+ rport->port_id = -1;
22251 -+ break;
22252 -+ case FC_TGTID_BIND_BY_ID:
22253 -+ rport->node_name = -1;
22254 -+ rport->port_name = -1;
22255 -+ break;
22256 -+ case FC_TGTID_BIND_NONE: /* to keep compiler happy */
22257 -+ break;
22258 -+ }
22259 -+
22260 -+ /*
22261 -+ * As this only occurs if the remote port (scsi target)
22262 -+ * went away and didn't come back - we'll remove
22263 -+ * all attached scsi devices.
22264 -+ */
22265 -+ rport->flags |= FC_RPORT_DEVLOSS_CALLBK_DONE;
22266 -+ fc_queue_work(shost, &rport->stgt_delete_work);
22267 -+
22268 -+ do_callback = 1;
22269 - }
22270 -
22271 -- /*
22272 -- * As this only occurs if the remote port (scsi target)
22273 -- * went away and didn't come back - we'll remove
22274 -- * all attached scsi devices.
22275 -- */
22276 -- fc_queue_work(shost, &rport->stgt_delete_work);
22277 -+ spin_unlock_irqrestore(shost->host_lock, flags);
22278 -
22279 - /*
22280 - * Notify the driver that the rport is now dead. The LLDD will
22281 -@@ -3089,7 +3105,7 @@ fc_timeout_deleted_rport(struct work_struct *work)
22282 - *
22283 - * Note: we set the CALLBK_DONE flag above to correspond
22284 - */
22285 -- if (i->f->dev_loss_tmo_callbk)
22286 -+ if (do_callback && i->f->dev_loss_tmo_callbk)
22287 - i->f->dev_loss_tmo_callbk(rport);
22288 - }
22289 -
22290 -diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
22291 -index ad897df..de2f8c4 100644
22292 ---- a/drivers/scsi/scsi_transport_iscsi.c
22293 -+++ b/drivers/scsi/scsi_transport_iscsi.c
22294 -@@ -627,8 +627,10 @@ static void __iscsi_block_session(struct work_struct *work)
22295 - spin_unlock_irqrestore(&session->lock, flags);
22296 - scsi_target_block(&session->dev);
22297 - ISCSI_DBG_TRANS_SESSION(session, "Completed SCSI target blocking\n");
22298 -- queue_delayed_work(iscsi_eh_timer_workq, &session->recovery_work,
22299 -- session->recovery_tmo * HZ);
22300 -+ if (session->recovery_tmo >= 0)
22301 -+ queue_delayed_work(iscsi_eh_timer_workq,
22302 -+ &session->recovery_work,
22303 -+ session->recovery_tmo * HZ);
22304 - }
22305 -
22306 - void iscsi_block_session(struct iscsi_cls_session *session)
22307 -@@ -1348,8 +1350,7 @@ iscsi_set_param(struct iscsi_transport *transport, struct iscsi_uevent *ev)
22308 - switch (ev->u.set_param.param) {
22309 - case ISCSI_PARAM_SESS_RECOVERY_TMO:
22310 - sscanf(data, "%d", &value);
22311 -- if (value != 0)
22312 -- session->recovery_tmo = value;
22313 -+ session->recovery_tmo = value;
22314 - break;
22315 - default:
22316 - err = transport->set_param(conn, ev->u.set_param.param,
22317 -diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c
22318 -index ebcc6d0..13a1b39 100644
22319 ---- a/drivers/usb/serial/ftdi_sio.c
22320 -+++ b/drivers/usb/serial/ftdi_sio.c
22321 -@@ -598,6 +598,20 @@ static struct usb_device_id id_table_combined [] = {
22322 - { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) },
22323 - { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) },
22324 - { USB_DEVICE(BANDB_VID, BANDB_USO9ML2_PID) },
22325 -+ { USB_DEVICE(BANDB_VID, BANDB_USOPTL4_PID) },
22326 -+ { USB_DEVICE(BANDB_VID, BANDB_USPTL4_PID) },
22327 -+ { USB_DEVICE(BANDB_VID, BANDB_USO9ML2DR_2_PID) },
22328 -+ { USB_DEVICE(BANDB_VID, BANDB_USO9ML2DR_PID) },
22329 -+ { USB_DEVICE(BANDB_VID, BANDB_USOPTL4DR2_PID) },
22330 -+ { USB_DEVICE(BANDB_VID, BANDB_USOPTL4DR_PID) },
22331 -+ { USB_DEVICE(BANDB_VID, BANDB_485USB9F_2W_PID) },
22332 -+ { USB_DEVICE(BANDB_VID, BANDB_485USB9F_4W_PID) },
22333 -+ { USB_DEVICE(BANDB_VID, BANDB_232USB9M_PID) },
22334 -+ { USB_DEVICE(BANDB_VID, BANDB_485USBTB_2W_PID) },
22335 -+ { USB_DEVICE(BANDB_VID, BANDB_485USBTB_4W_PID) },
22336 -+ { USB_DEVICE(BANDB_VID, BANDB_TTL5USB9M_PID) },
22337 -+ { USB_DEVICE(BANDB_VID, BANDB_TTL3USB9M_PID) },
22338 -+ { USB_DEVICE(BANDB_VID, BANDB_ZZ_PROG1_USB_PID) },
22339 - { USB_DEVICE(FTDI_VID, EVER_ECO_PRO_CDS) },
22340 - { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_1_PID) },
22341 - { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID) },
22342 -diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h
22343 -index 6f31e0d..4586a24 100644
22344 ---- a/drivers/usb/serial/ftdi_sio.h
22345 -+++ b/drivers/usb/serial/ftdi_sio.h
22346 -@@ -662,6 +662,20 @@
22347 - #define BANDB_USOTL4_PID 0xAC01 /* USOTL4 Isolated RS-485 Converter */
22348 - #define BANDB_USTL4_PID 0xAC02 /* USTL4 RS-485 Converter */
22349 - #define BANDB_USO9ML2_PID 0xAC03 /* USO9ML2 Isolated RS-232 Converter */
22350 -+#define BANDB_USOPTL4_PID 0xAC11
22351 -+#define BANDB_USPTL4_PID 0xAC12
22352 -+#define BANDB_USO9ML2DR_2_PID 0xAC16
22353 -+#define BANDB_USO9ML2DR_PID 0xAC17
22354 -+#define BANDB_USOPTL4DR2_PID 0xAC18 /* USOPTL4R-2 2-port Isolated RS-232 Converter */
22355 -+#define BANDB_USOPTL4DR_PID 0xAC19
22356 -+#define BANDB_485USB9F_2W_PID 0xAC25
22357 -+#define BANDB_485USB9F_4W_PID 0xAC26
22358 -+#define BANDB_232USB9M_PID 0xAC27
22359 -+#define BANDB_485USBTB_2W_PID 0xAC33
22360 -+#define BANDB_485USBTB_4W_PID 0xAC34
22361 -+#define BANDB_TTL5USB9M_PID 0xAC49
22362 -+#define BANDB_TTL3USB9M_PID 0xAC50
22363 -+#define BANDB_ZZ_PROG1_USB_PID 0xBA02
22364 -
22365 - /*
22366 - * RM Michaelides CANview USB (http://www.rmcan.com)
22367 -diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c
22368 -index f11abf5..485fa9c 100644
22369 ---- a/drivers/usb/serial/mos7840.c
22370 -+++ b/drivers/usb/serial/mos7840.c
22371 -@@ -121,8 +121,14 @@
22372 - * moschip_id_table_combined
22373 - */
22374 - #define USB_VENDOR_ID_BANDB 0x0856
22375 --#define BANDB_DEVICE_ID_USOPTL4_4 0xAC44
22376 -+#define BANDB_DEVICE_ID_USO9ML2_2 0xAC22
22377 -+#define BANDB_DEVICE_ID_USO9ML2_4 0xAC24
22378 -+#define BANDB_DEVICE_ID_US9ML2_2 0xAC29
22379 -+#define BANDB_DEVICE_ID_US9ML2_4 0xAC30
22380 -+#define BANDB_DEVICE_ID_USPTL4_2 0xAC31
22381 -+#define BANDB_DEVICE_ID_USPTL4_4 0xAC32
22382 - #define BANDB_DEVICE_ID_USOPTL4_2 0xAC42
22383 -+#define BANDB_DEVICE_ID_USOPTL4_4 0xAC44
22384 -
22385 - /* This driver also supports
22386 - * ATEN UC2324 device using Moschip MCS7840
22387 -@@ -177,8 +183,14 @@
22388 - static struct usb_device_id moschip_port_id_table[] = {
22389 - {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7840)},
22390 - {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)},
22391 -- {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4)},
22392 -+ {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_2)},
22393 -+ {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_4)},
22394 -+ {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_US9ML2_2)},
22395 -+ {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_US9ML2_4)},
22396 -+ {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USPTL4_2)},
22397 -+ {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USPTL4_4)},
22398 - {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2)},
22399 -+ {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4)},
22400 - {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2324)},
22401 - {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2322)},
22402 - {} /* terminating entry */
22403 -@@ -187,8 +199,14 @@ static struct usb_device_id moschip_port_id_table[] = {
22404 - static __devinitdata struct usb_device_id moschip_id_table_combined[] = {
22405 - {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7840)},
22406 - {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)},
22407 -- {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4)},
22408 -+ {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_2)},
22409 -+ {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USO9ML2_4)},
22410 -+ {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_US9ML2_2)},
22411 -+ {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_US9ML2_4)},
22412 -+ {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USPTL4_2)},
22413 -+ {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USPTL4_4)},
22414 - {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2)},
22415 -+ {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4)},
22416 - {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2324)},
22417 - {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2322)},
22418 - {} /* terminating entry */
22419 -diff --git a/drivers/watchdog/iTCO_wdt.c b/drivers/watchdog/iTCO_wdt.c
22420 -index 6a51edd..4bdb7f1 100644
22421 ---- a/drivers/watchdog/iTCO_wdt.c
22422 -+++ b/drivers/watchdog/iTCO_wdt.c
22423 -@@ -1,5 +1,5 @@
22424 - /*
22425 -- * intel TCO Watchdog Driver (Used in i82801 and i63xxESB chipsets)
22426 -+ * intel TCO Watchdog Driver
22427 - *
22428 - * (c) Copyright 2006-2009 Wim Van Sebroeck <wim@××××××.be>.
22429 - *
22430 -@@ -14,47 +14,24 @@
22431 - *
22432 - * The TCO watchdog is implemented in the following I/O controller hubs:
22433 - * (See the intel documentation on http://developer.intel.com.)
22434 -- * 82801AA (ICH) : document number 290655-003, 290677-014,
22435 -- * 82801AB (ICHO) : document number 290655-003, 290677-014,
22436 -- * 82801BA (ICH2) : document number 290687-002, 298242-027,
22437 -- * 82801BAM (ICH2-M) : document number 290687-002, 298242-027,
22438 -- * 82801CA (ICH3-S) : document number 290733-003, 290739-013,
22439 -- * 82801CAM (ICH3-M) : document number 290716-001, 290718-007,
22440 -- * 82801DB (ICH4) : document number 290744-001, 290745-025,
22441 -- * 82801DBM (ICH4-M) : document number 252337-001, 252663-008,
22442 -- * 82801E (C-ICH) : document number 273599-001, 273645-002,
22443 -- * 82801EB (ICH5) : document number 252516-001, 252517-028,
22444 -- * 82801ER (ICH5R) : document number 252516-001, 252517-028,
22445 -- * 6300ESB (6300ESB) : document number 300641-004, 300884-013,
22446 -- * 82801FB (ICH6) : document number 301473-002, 301474-026,
22447 -- * 82801FR (ICH6R) : document number 301473-002, 301474-026,
22448 -- * 82801FBM (ICH6-M) : document number 301473-002, 301474-026,
22449 -- * 82801FW (ICH6W) : document number 301473-001, 301474-026,
22450 -- * 82801FRW (ICH6RW) : document number 301473-001, 301474-026,
22451 -- * 631xESB (631xESB) : document number 313082-001, 313075-006,
22452 -- * 632xESB (632xESB) : document number 313082-001, 313075-006,
22453 -- * 82801GB (ICH7) : document number 307013-003, 307014-024,
22454 -- * 82801GR (ICH7R) : document number 307013-003, 307014-024,
22455 -- * 82801GDH (ICH7DH) : document number 307013-003, 307014-024,
22456 -- * 82801GBM (ICH7-M) : document number 307013-003, 307014-024,
22457 -- * 82801GHM (ICH7-M DH) : document number 307013-003, 307014-024,
22458 -- * 82801GU (ICH7-U) : document number 307013-003, 307014-024,
22459 -- * 82801HB (ICH8) : document number 313056-003, 313057-017,
22460 -- * 82801HR (ICH8R) : document number 313056-003, 313057-017,
22461 -- * 82801HBM (ICH8M) : document number 313056-003, 313057-017,
22462 -- * 82801HH (ICH8DH) : document number 313056-003, 313057-017,
22463 -- * 82801HO (ICH8DO) : document number 313056-003, 313057-017,
22464 -- * 82801HEM (ICH8M-E) : document number 313056-003, 313057-017,
22465 -- * 82801IB (ICH9) : document number 316972-004, 316973-012,
22466 -- * 82801IR (ICH9R) : document number 316972-004, 316973-012,
22467 -- * 82801IH (ICH9DH) : document number 316972-004, 316973-012,
22468 -- * 82801IO (ICH9DO) : document number 316972-004, 316973-012,
22469 -- * 82801IBM (ICH9M) : document number 316972-004, 316973-012,
22470 -- * 82801IEM (ICH9M-E) : document number 316972-004, 316973-012,
22471 -- * 82801JIB (ICH10) : document number 319973-002, 319974-002,
22472 -- * 82801JIR (ICH10R) : document number 319973-002, 319974-002,
22473 -- * 82801JD (ICH10D) : document number 319973-002, 319974-002,
22474 -- * 82801JDO (ICH10DO) : document number 319973-002, 319974-002
22475 -+ * document number 290655-003, 290677-014: 82801AA (ICH), 82801AB (ICHO)
22476 -+ * document number 290687-002, 298242-027: 82801BA (ICH2)
22477 -+ * document number 290733-003, 290739-013: 82801CA (ICH3-S)
22478 -+ * document number 290716-001, 290718-007: 82801CAM (ICH3-M)
22479 -+ * document number 290744-001, 290745-025: 82801DB (ICH4)
22480 -+ * document number 252337-001, 252663-008: 82801DBM (ICH4-M)
22481 -+ * document number 273599-001, 273645-002: 82801E (C-ICH)
22482 -+ * document number 252516-001, 252517-028: 82801EB (ICH5), 82801ER (ICH5R)
22483 -+ * document number 300641-004, 300884-013: 6300ESB
22484 -+ * document number 301473-002, 301474-026: 82801F (ICH6)
22485 -+ * document number 313082-001, 313075-006: 631xESB, 632xESB
22486 -+ * document number 307013-003, 307014-024: 82801G (ICH7)
22487 -+ * document number 313056-003, 313057-017: 82801H (ICH8)
22488 -+ * document number 316972-004, 316973-012: 82801I (ICH9)
22489 -+ * document number 319973-002, 319974-002: 82801J (ICH10)
22490 -+ * document number 322169-001, 322170-003: 5 Series, 3400 Series (PCH)
22491 -+ * document number 320066-003, 320257-008: EP80597 (IICH)
22492 -+ * document number TBD : Cougar Point (CPT)
22493 - */
22494 -
22495 - /*
22496 -@@ -122,6 +99,24 @@ enum iTCO_chipsets {
22497 - TCO_ICH10R, /* ICH10R */
22498 - TCO_ICH10D, /* ICH10D */
22499 - TCO_ICH10DO, /* ICH10DO */
22500 -+ TCO_PCH, /* PCH Desktop Full Featured */
22501 -+ TCO_PCHM, /* PCH Mobile Full Featured */
22502 -+ TCO_P55, /* P55 */
22503 -+ TCO_PM55, /* PM55 */
22504 -+ TCO_H55, /* H55 */
22505 -+ TCO_QM57, /* QM57 */
22506 -+ TCO_H57, /* H57 */
22507 -+ TCO_HM55, /* HM55 */
22508 -+ TCO_Q57, /* Q57 */
22509 -+ TCO_HM57, /* HM57 */
22510 -+ TCO_PCHMSFF, /* PCH Mobile SFF Full Featured */
22511 -+ TCO_QS57, /* QS57 */
22512 -+ TCO_3400, /* 3400 */
22513 -+ TCO_3420, /* 3420 */
22514 -+ TCO_3450, /* 3450 */
22515 -+ TCO_EP80579, /* EP80579 */
22516 -+ TCO_CPTD, /* CPT Desktop */
22517 -+ TCO_CPTM, /* CPT Mobile */
22518 - };
22519 -
22520 - static struct {
22521 -@@ -162,6 +157,24 @@ static struct {
22522 - {"ICH10R", 2},
22523 - {"ICH10D", 2},
22524 - {"ICH10DO", 2},
22525 -+ {"PCH Desktop Full Featured", 2},
22526 -+ {"PCH Mobile Full Featured", 2},
22527 -+ {"P55", 2},
22528 -+ {"PM55", 2},
22529 -+ {"H55", 2},
22530 -+ {"QM57", 2},
22531 -+ {"H57", 2},
22532 -+ {"HM55", 2},
22533 -+ {"Q57", 2},
22534 -+ {"HM57", 2},
22535 -+ {"PCH Mobile SFF Full Featured", 2},
22536 -+ {"QS57", 2},
22537 -+ {"3400", 2},
22538 -+ {"3420", 2},
22539 -+ {"3450", 2},
22540 -+ {"EP80579", 2},
22541 -+ {"CPT Desktop", 2},
22542 -+ {"CPT Mobile", 2},
22543 - {NULL, 0}
22544 - };
22545 -
22546 -@@ -230,6 +243,24 @@ static struct pci_device_id iTCO_wdt_pci_tbl[] = {
22547 - { ITCO_PCI_DEVICE(0x3a16, TCO_ICH10R)},
22548 - { ITCO_PCI_DEVICE(0x3a1a, TCO_ICH10D)},
22549 - { ITCO_PCI_DEVICE(0x3a14, TCO_ICH10DO)},
22550 -+ { ITCO_PCI_DEVICE(0x3b00, TCO_PCH)},
22551 -+ { ITCO_PCI_DEVICE(0x3b01, TCO_PCHM)},
22552 -+ { ITCO_PCI_DEVICE(0x3b02, TCO_P55)},
22553 -+ { ITCO_PCI_DEVICE(0x3b03, TCO_PM55)},
22554 -+ { ITCO_PCI_DEVICE(0x3b06, TCO_H55)},
22555 -+ { ITCO_PCI_DEVICE(0x3b07, TCO_QM57)},
22556 -+ { ITCO_PCI_DEVICE(0x3b08, TCO_H57)},
22557 -+ { ITCO_PCI_DEVICE(0x3b09, TCO_HM55)},
22558 -+ { ITCO_PCI_DEVICE(0x3b0a, TCO_Q57)},
22559 -+ { ITCO_PCI_DEVICE(0x3b0b, TCO_HM57)},
22560 -+ { ITCO_PCI_DEVICE(0x3b0d, TCO_PCHMSFF)},
22561 -+ { ITCO_PCI_DEVICE(0x3b0f, TCO_QS57)},
22562 -+ { ITCO_PCI_DEVICE(0x3b12, TCO_3400)},
22563 -+ { ITCO_PCI_DEVICE(0x3b14, TCO_3420)},
22564 -+ { ITCO_PCI_DEVICE(0x3b16, TCO_3450)},
22565 -+ { ITCO_PCI_DEVICE(0x5031, TCO_EP80579)},
22566 -+ { ITCO_PCI_DEVICE(0x1c42, TCO_CPTD)},
22567 -+ { ITCO_PCI_DEVICE(0x1c43, TCO_CPTM)},
22568 - { 0, }, /* End of list */
22569 - };
22570 - MODULE_DEVICE_TABLE(pci, iTCO_wdt_pci_tbl);
22571 -diff --git a/fs/fcntl.c b/fs/fcntl.c
22572 -index 97e01dc..5ef953e 100644
22573 ---- a/fs/fcntl.c
22574 -+++ b/fs/fcntl.c
22575 -@@ -199,7 +199,9 @@ static int setfl(int fd, struct file * filp, unsigned long arg)
22576 - static void f_modown(struct file *filp, struct pid *pid, enum pid_type type,
22577 - int force)
22578 - {
22579 -- write_lock_irq(&filp->f_owner.lock);
22580 -+ unsigned long flags;
22581 -+
22582 -+ write_lock_irqsave(&filp->f_owner.lock, flags);
22583 - if (force || !filp->f_owner.pid) {
22584 - put_pid(filp->f_owner.pid);
22585 - filp->f_owner.pid = get_pid(pid);
22586 -@@ -211,7 +213,7 @@ static void f_modown(struct file *filp, struct pid *pid, enum pid_type type,
22587 - filp->f_owner.euid = cred->euid;
22588 - }
22589 - }
22590 -- write_unlock_irq(&filp->f_owner.lock);
22591 -+ write_unlock_irqrestore(&filp->f_owner.lock, flags);
22592 - }
22593 -
22594 - int __f_setown(struct file *filp, struct pid *pid, enum pid_type type,
22595 -diff --git a/fs/nfs/super.c b/fs/nfs/super.c
22596 -index 90be551..e71f0fd 100644
22597 ---- a/fs/nfs/super.c
22598 -+++ b/fs/nfs/super.c
22599 -@@ -734,8 +734,6 @@ static struct nfs_parsed_mount_data *nfs_alloc_parsed_mount_data(unsigned int ve
22600 -
22601 - data = kzalloc(sizeof(*data), GFP_KERNEL);
22602 - if (data) {
22603 -- data->rsize = NFS_MAX_FILE_IO_SIZE;
22604 -- data->wsize = NFS_MAX_FILE_IO_SIZE;
22605 - data->acregmin = NFS_DEF_ACREGMIN;
22606 - data->acregmax = NFS_DEF_ACREGMAX;
22607 - data->acdirmin = NFS_DEF_ACDIRMIN;
22608 -diff --git a/fs/nfsd/nfs4acl.c b/fs/nfsd/nfs4acl.c
22609 -index 725d02f..6d9c6aa 100644
22610 ---- a/fs/nfsd/nfs4acl.c
22611 -+++ b/fs/nfsd/nfs4acl.c
22612 -@@ -389,7 +389,7 @@ sort_pacl(struct posix_acl *pacl)
22613 - sort_pacl_range(pacl, 1, i-1);
22614 -
22615 - BUG_ON(pacl->a_entries[i].e_tag != ACL_GROUP_OBJ);
22616 -- j = i++;
22617 -+ j = ++i;
22618 - while (pacl->a_entries[j].e_tag == ACL_GROUP)
22619 - j++;
22620 - sort_pacl_range(pacl, i, j-1);
22621 -diff --git a/fs/partitions/efi.c b/fs/partitions/efi.c
22622 -index 038a602..49cfd5f 100644
22623 ---- a/fs/partitions/efi.c
22624 -+++ b/fs/partitions/efi.c
22625 -@@ -1,7 +1,9 @@
22626 - /************************************************************
22627 - * EFI GUID Partition Table handling
22628 -- * Per Intel EFI Specification v1.02
22629 -- * http://developer.intel.com/technology/efi/efi.htm
22630 -+ *
22631 -+ * http://www.uefi.org/specs/
22632 -+ * http://www.intel.com/technology/efi/
22633 -+ *
22634 - * efi.[ch] by Matt Domsch <Matt_Domsch@××××.com>
22635 - * Copyright 2000,2001,2002,2004 Dell Inc.
22636 - *
22637 -@@ -92,6 +94,7 @@
22638 - *
22639 - ************************************************************/
22640 - #include <linux/crc32.h>
22641 -+#include <linux/math64.h>
22642 - #include "check.h"
22643 - #include "efi.h"
22644 -
22645 -@@ -141,7 +144,8 @@ last_lba(struct block_device *bdev)
22646 - {
22647 - if (!bdev || !bdev->bd_inode)
22648 - return 0;
22649 -- return (bdev->bd_inode->i_size >> 9) - 1ULL;
22650 -+ return div_u64(bdev->bd_inode->i_size,
22651 -+ bdev_logical_block_size(bdev)) - 1ULL;
22652 - }
22653 -
22654 - static inline int
22655 -@@ -188,6 +192,7 @@ static size_t
22656 - read_lba(struct block_device *bdev, u64 lba, u8 * buffer, size_t count)
22657 - {
22658 - size_t totalreadcount = 0;
22659 -+ sector_t n = lba * (bdev_logical_block_size(bdev) / 512);
22660 -
22661 - if (!bdev || !buffer || lba > last_lba(bdev))
22662 - return 0;
22663 -@@ -195,7 +200,7 @@ read_lba(struct block_device *bdev, u64 lba, u8 * buffer, size_t count)
22664 - while (count) {
22665 - int copied = 512;
22666 - Sector sect;
22667 -- unsigned char *data = read_dev_sector(bdev, lba++, &sect);
22668 -+ unsigned char *data = read_dev_sector(bdev, n++, &sect);
22669 - if (!data)
22670 - break;
22671 - if (copied > count)
22672 -@@ -257,15 +262,16 @@ static gpt_header *
22673 - alloc_read_gpt_header(struct block_device *bdev, u64 lba)
22674 - {
22675 - gpt_header *gpt;
22676 -+ unsigned ssz = bdev_logical_block_size(bdev);
22677 -+
22678 - if (!bdev)
22679 - return NULL;
22680 -
22681 -- gpt = kzalloc(sizeof (gpt_header), GFP_KERNEL);
22682 -+ gpt = kzalloc(ssz, GFP_KERNEL);
22683 - if (!gpt)
22684 - return NULL;
22685 -
22686 -- if (read_lba(bdev, lba, (u8 *) gpt,
22687 -- sizeof (gpt_header)) < sizeof (gpt_header)) {
22688 -+ if (read_lba(bdev, lba, (u8 *) gpt, ssz) < ssz) {
22689 - kfree(gpt);
22690 - gpt=NULL;
22691 - return NULL;
22692 -@@ -601,6 +607,7 @@ efi_partition(struct parsed_partitions *state, struct block_device *bdev)
22693 - gpt_header *gpt = NULL;
22694 - gpt_entry *ptes = NULL;
22695 - u32 i;
22696 -+ unsigned ssz = bdev_logical_block_size(bdev) / 512;
22697 -
22698 - if (!find_valid_gpt(bdev, &gpt, &ptes) || !gpt || !ptes) {
22699 - kfree(gpt);
22700 -@@ -611,13 +618,14 @@ efi_partition(struct parsed_partitions *state, struct block_device *bdev)
22701 - pr_debug("GUID Partition Table is valid! Yea!\n");
22702 -
22703 - for (i = 0; i < le32_to_cpu(gpt->num_partition_entries) && i < state->limit-1; i++) {
22704 -+ u64 start = le64_to_cpu(ptes[i].starting_lba);
22705 -+ u64 size = le64_to_cpu(ptes[i].ending_lba) -
22706 -+ le64_to_cpu(ptes[i].starting_lba) + 1ULL;
22707 -+
22708 - if (!is_pte_valid(&ptes[i], last_lba(bdev)))
22709 - continue;
22710 -
22711 -- put_partition(state, i+1, le64_to_cpu(ptes[i].starting_lba),
22712 -- (le64_to_cpu(ptes[i].ending_lba) -
22713 -- le64_to_cpu(ptes[i].starting_lba) +
22714 -- 1ULL));
22715 -+ put_partition(state, i+1, start * ssz, size * ssz);
22716 -
22717 - /* If this is a RAID volume, tell md */
22718 - if (!efi_guidcmp(ptes[i].partition_type_guid,
22719 -diff --git a/fs/partitions/efi.h b/fs/partitions/efi.h
22720 -index 2cc89d0..6998b58 100644
22721 ---- a/fs/partitions/efi.h
22722 -+++ b/fs/partitions/efi.h
22723 -@@ -37,7 +37,6 @@
22724 - #define EFI_PMBR_OSTYPE_EFI 0xEF
22725 - #define EFI_PMBR_OSTYPE_EFI_GPT 0xEE
22726 -
22727 --#define GPT_BLOCK_SIZE 512
22728 - #define GPT_HEADER_SIGNATURE 0x5452415020494645ULL
22729 - #define GPT_HEADER_REVISION_V1 0x00010000
22730 - #define GPT_PRIMARY_PARTITION_TABLE_LBA 1
22731 -@@ -79,7 +78,12 @@ typedef struct _gpt_header {
22732 - __le32 num_partition_entries;
22733 - __le32 sizeof_partition_entry;
22734 - __le32 partition_entry_array_crc32;
22735 -- u8 reserved2[GPT_BLOCK_SIZE - 92];
22736 -+
22737 -+ /* The rest of the logical block is reserved by UEFI and must be zero.
22738 -+ * EFI standard handles this by:
22739 -+ *
22740 -+ * uint8_t reserved2[ BlockSize - 92 ];
22741 -+ */
22742 - } __attribute__ ((packed)) gpt_header;
22743 -
22744 - typedef struct _gpt_entry_attributes {
22745 -diff --git a/fs/super.c b/fs/super.c
22746 -index 19eb70b..aff046b 100644
22747 ---- a/fs/super.c
22748 -+++ b/fs/super.c
22749 -@@ -901,8 +901,9 @@ int get_sb_single(struct file_system_type *fs_type,
22750 - return error;
22751 - }
22752 - s->s_flags |= MS_ACTIVE;
22753 -+ } else {
22754 -+ do_remount_sb(s, flags, data, 0);
22755 - }
22756 -- do_remount_sb(s, flags, data, 0);
22757 - simple_set_mnt(mnt, s);
22758 - return 0;
22759 - }
22760 -diff --git a/include/acpi/platform/aclinux.h b/include/acpi/platform/aclinux.h
22761 -index 9d7febd..0946997 100644
22762 ---- a/include/acpi/platform/aclinux.h
22763 -+++ b/include/acpi/platform/aclinux.h
22764 -@@ -152,7 +152,7 @@ static inline void *acpi_os_acquire_object(acpi_cache_t * cache)
22765 - #include <linux/hardirq.h>
22766 - #define ACPI_PREEMPTION_POINT() \
22767 - do { \
22768 -- if (!in_atomic_preempt_off()) \
22769 -+ if (!in_atomic_preempt_off() && !irqs_disabled()) \
22770 - cond_resched(); \
22771 - } while (0)
22772 -
22773 -diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
22774 -index 83d2fbd..64b1a4c 100644
22775 ---- a/include/linux/clocksource.h
22776 -+++ b/include/linux/clocksource.h
22777 -@@ -151,6 +151,7 @@ extern u64 timecounter_cyc2time(struct timecounter *tc,
22778 - * subtraction of non 64 bit counters
22779 - * @mult: cycle to nanosecond multiplier
22780 - * @shift: cycle to nanosecond divisor (power of two)
22781 -+ * @max_idle_ns: max idle time permitted by the clocksource (nsecs)
22782 - * @flags: flags describing special properties
22783 - * @vread: vsyscall based read
22784 - * @resume: resume function for the clocksource, if necessary
22785 -@@ -168,6 +169,7 @@ struct clocksource {
22786 - cycle_t mask;
22787 - u32 mult;
22788 - u32 shift;
22789 -+ u64 max_idle_ns;
22790 - unsigned long flags;
22791 - cycle_t (*vread)(void);
22792 - void (*resume)(void);
22793 -diff --git a/include/linux/hid.h b/include/linux/hid.h
22794 -index 10f6284..8709365 100644
22795 ---- a/include/linux/hid.h
22796 -+++ b/include/linux/hid.h
22797 -@@ -312,6 +312,7 @@ struct hid_item {
22798 - #define HID_QUIRK_MULTI_INPUT 0x00000040
22799 - #define HID_QUIRK_SKIP_OUTPUT_REPORTS 0x00010000
22800 - #define HID_QUIRK_FULLSPEED_INTERVAL 0x10000000
22801 -+#define HID_QUIRK_NO_INIT_REPORTS 0x20000000
22802 -
22803 - /*
22804 - * This is the global environment of the parser. This information is
22805 -diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
22806 -index 84cf1f3..1b7f2a7 100644
22807 ---- a/include/linux/pci_ids.h
22808 -+++ b/include/linux/pci_ids.h
22809 -@@ -2290,6 +2290,20 @@
22810 - #define PCI_DEVICE_ID_MPC8536 0x0051
22811 - #define PCI_DEVICE_ID_P2020E 0x0070
22812 - #define PCI_DEVICE_ID_P2020 0x0071
22813 -+#define PCI_DEVICE_ID_P2010E 0x0078
22814 -+#define PCI_DEVICE_ID_P2010 0x0079
22815 -+#define PCI_DEVICE_ID_P1020E 0x0100
22816 -+#define PCI_DEVICE_ID_P1020 0x0101
22817 -+#define PCI_DEVICE_ID_P1011E 0x0108
22818 -+#define PCI_DEVICE_ID_P1011 0x0109
22819 -+#define PCI_DEVICE_ID_P1022E 0x0110
22820 -+#define PCI_DEVICE_ID_P1022 0x0111
22821 -+#define PCI_DEVICE_ID_P1013E 0x0118
22822 -+#define PCI_DEVICE_ID_P1013 0x0119
22823 -+#define PCI_DEVICE_ID_P4080E 0x0400
22824 -+#define PCI_DEVICE_ID_P4080 0x0401
22825 -+#define PCI_DEVICE_ID_P4040E 0x0408
22826 -+#define PCI_DEVICE_ID_P4040 0x0409
22827 - #define PCI_DEVICE_ID_MPC8641 0x7010
22828 - #define PCI_DEVICE_ID_MPC8641D 0x7011
22829 - #define PCI_DEVICE_ID_MPC8610 0x7018
22830 -diff --git a/include/linux/time.h b/include/linux/time.h
22831 -index fe04e5e..6e026e4 100644
22832 ---- a/include/linux/time.h
22833 -+++ b/include/linux/time.h
22834 -@@ -148,6 +148,7 @@ extern void monotonic_to_bootbased(struct timespec *ts);
22835 -
22836 - extern struct timespec timespec_trunc(struct timespec t, unsigned gran);
22837 - extern int timekeeping_valid_for_hres(void);
22838 -+extern u64 timekeeping_max_deferment(void);
22839 - extern void update_wall_time(void);
22840 - extern void update_xtime_cache(u64 nsec);
22841 - extern void timekeeping_leap_insert(int leapsecond);
22842 -diff --git a/include/scsi/fc_frame.h b/include/scsi/fc_frame.h
22843 -index c35d238..148126d 100644
22844 ---- a/include/scsi/fc_frame.h
22845 -+++ b/include/scsi/fc_frame.h
22846 -@@ -37,6 +37,9 @@
22847 - #define FC_FRAME_HEADROOM 32 /* headroom for VLAN + FCoE headers */
22848 - #define FC_FRAME_TAILROOM 8 /* trailer space for FCoE */
22849 -
22850 -+/* Max number of skb frags allowed, reserving one for fcoe_crc_eof page */
22851 -+#define FC_FRAME_SG_LEN (MAX_SKB_FRAGS - 1)
22852 -+
22853 - #define fp_skb(fp) (&((fp)->skb))
22854 - #define fr_hdr(fp) ((fp)->skb.data)
22855 - #define fr_len(fp) ((fp)->skb.len)
22856 -diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
22857 -index 65dc9aa..09a124b 100644
22858 ---- a/include/scsi/libfc.h
22859 -+++ b/include/scsi/libfc.h
22860 -@@ -145,6 +145,7 @@ enum fc_rport_state {
22861 - RPORT_ST_LOGO, /* port logout sent */
22862 - RPORT_ST_ADISC, /* Discover Address sent */
22863 - RPORT_ST_DELETE, /* port being deleted */
22864 -+ RPORT_ST_RESTART, /* remote port being deleted and will restart */
22865 - };
22866 -
22867 - /**
22868 -diff --git a/init/calibrate.c b/init/calibrate.c
22869 -index a379c90..6eb48e5 100644
22870 ---- a/init/calibrate.c
22871 -+++ b/init/calibrate.c
22872 -@@ -123,23 +123,26 @@ void __cpuinit calibrate_delay(void)
22873 - {
22874 - unsigned long ticks, loopbit;
22875 - int lps_precision = LPS_PREC;
22876 -+ static bool printed;
22877 -
22878 - if (preset_lpj) {
22879 - loops_per_jiffy = preset_lpj;
22880 -- printk(KERN_INFO
22881 -- "Calibrating delay loop (skipped) preset value.. ");
22882 -- } else if ((smp_processor_id() == 0) && lpj_fine) {
22883 -+ if (!printed)
22884 -+ pr_info("Calibrating delay loop (skipped) "
22885 -+ "preset value.. ");
22886 -+ } else if ((!printed) && lpj_fine) {
22887 - loops_per_jiffy = lpj_fine;
22888 -- printk(KERN_INFO
22889 -- "Calibrating delay loop (skipped), "
22890 -+ pr_info("Calibrating delay loop (skipped), "
22891 - "value calculated using timer frequency.. ");
22892 - } else if ((loops_per_jiffy = calibrate_delay_direct()) != 0) {
22893 -- printk(KERN_INFO
22894 -- "Calibrating delay using timer specific routine.. ");
22895 -+ if (!printed)
22896 -+ pr_info("Calibrating delay using timer "
22897 -+ "specific routine.. ");
22898 - } else {
22899 - loops_per_jiffy = (1<<12);
22900 -
22901 -- printk(KERN_INFO "Calibrating delay loop... ");
22902 -+ if (!printed)
22903 -+ pr_info("Calibrating delay loop... ");
22904 - while ((loops_per_jiffy <<= 1) != 0) {
22905 - /* wait for "start of" clock tick */
22906 - ticks = jiffies;
22907 -@@ -170,7 +173,10 @@ void __cpuinit calibrate_delay(void)
22908 - loops_per_jiffy &= ~loopbit;
22909 - }
22910 - }
22911 -- printk(KERN_CONT "%lu.%02lu BogoMIPS (lpj=%lu)\n",
22912 -+ if (!printed)
22913 -+ pr_cont("%lu.%02lu BogoMIPS (lpj=%lu)\n",
22914 - loops_per_jiffy/(500000/HZ),
22915 - (loops_per_jiffy/(5000/HZ)) % 100, loops_per_jiffy);
22916 -+
22917 -+ printed = true;
22918 - }
22919 -diff --git a/ipc/msg.c b/ipc/msg.c
22920 -index 2ceab7f..779f762 100644
22921 ---- a/ipc/msg.c
22922 -+++ b/ipc/msg.c
22923 -@@ -125,6 +125,7 @@ void msg_init_ns(struct ipc_namespace *ns)
22924 - void msg_exit_ns(struct ipc_namespace *ns)
22925 - {
22926 - free_ipcs(ns, &msg_ids(ns), freeque);
22927 -+ idr_destroy(&ns->ids[IPC_MSG_IDS].ipcs_idr);
22928 - }
22929 - #endif
22930 -
22931 -diff --git a/ipc/sem.c b/ipc/sem.c
22932 -index 87c2b64..2f2a479 100644
22933 ---- a/ipc/sem.c
22934 -+++ b/ipc/sem.c
22935 -@@ -129,6 +129,7 @@ void sem_init_ns(struct ipc_namespace *ns)
22936 - void sem_exit_ns(struct ipc_namespace *ns)
22937 - {
22938 - free_ipcs(ns, &sem_ids(ns), freeary);
22939 -+ idr_destroy(&ns->ids[IPC_SEM_IDS].ipcs_idr);
22940 - }
22941 - #endif
22942 -
22943 -diff --git a/ipc/shm.c b/ipc/shm.c
22944 -index 11bec62..e9b039f 100644
22945 ---- a/ipc/shm.c
22946 -+++ b/ipc/shm.c
22947 -@@ -101,6 +101,7 @@ static void do_shm_rmid(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp)
22948 - void shm_exit_ns(struct ipc_namespace *ns)
22949 - {
22950 - free_ipcs(ns, &shm_ids(ns), do_shm_rmid);
22951 -+ idr_destroy(&ns->ids[IPC_SHM_IDS].ipcs_idr);
22952 - }
22953 - #endif
22954 -
22955 -diff --git a/kernel/cpu.c b/kernel/cpu.c
22956 -index b216886..291ac58 100644
22957 ---- a/kernel/cpu.c
22958 -+++ b/kernel/cpu.c
22959 -@@ -400,10 +400,9 @@ int disable_nonboot_cpus(void)
22960 - if (cpu == first_cpu)
22961 - continue;
22962 - error = _cpu_down(cpu, 1);
22963 -- if (!error) {
22964 -+ if (!error)
22965 - cpumask_set_cpu(cpu, frozen_cpus);
22966 -- printk("CPU%d is down\n", cpu);
22967 -- } else {
22968 -+ else {
22969 - printk(KERN_ERR "Error taking CPU%d down: %d\n",
22970 - cpu, error);
22971 - break;
22972 -diff --git a/kernel/sched.c b/kernel/sched.c
22973 -index bf841d8..60d74cc 100644
22974 ---- a/kernel/sched.c
22975 -+++ b/kernel/sched.c
22976 -@@ -816,6 +816,7 @@ const_debug unsigned int sysctl_sched_nr_migrate = 32;
22977 - * default: 0.25ms
22978 - */
22979 - unsigned int sysctl_sched_shares_ratelimit = 250000;
22980 -+unsigned int normalized_sysctl_sched_shares_ratelimit = 250000;
22981 -
22982 - /*
22983 - * Inject some fuzzyness into changing the per-cpu group shares
22984 -@@ -1812,6 +1813,7 @@ static void cfs_rq_set_shares(struct cfs_rq *cfs_rq, unsigned long shares)
22985 - #endif
22986 -
22987 - static void calc_load_account_active(struct rq *this_rq);
22988 -+static void update_sysctl(void);
22989 -
22990 - #include "sched_stats.h"
22991 - #include "sched_idletask.c"
22992 -@@ -7018,22 +7020,23 @@ cpumask_var_t nohz_cpu_mask;
22993 - *
22994 - * This idea comes from the SD scheduler of Con Kolivas:
22995 - */
22996 --static inline void sched_init_granularity(void)
22997 -+static void update_sysctl(void)
22998 - {
22999 -- unsigned int factor = 1 + ilog2(num_online_cpus());
23000 -- const unsigned long limit = 200000000;
23001 --
23002 -- sysctl_sched_min_granularity *= factor;
23003 -- if (sysctl_sched_min_granularity > limit)
23004 -- sysctl_sched_min_granularity = limit;
23005 --
23006 -- sysctl_sched_latency *= factor;
23007 -- if (sysctl_sched_latency > limit)
23008 -- sysctl_sched_latency = limit;
23009 -+ unsigned int cpus = min(num_online_cpus(), 8U);
23010 -+ unsigned int factor = 1 + ilog2(cpus);
23011 -
23012 -- sysctl_sched_wakeup_granularity *= factor;
23013 -+#define SET_SYSCTL(name) \
23014 -+ (sysctl_##name = (factor) * normalized_sysctl_##name)
23015 -+ SET_SYSCTL(sched_min_granularity);
23016 -+ SET_SYSCTL(sched_latency);
23017 -+ SET_SYSCTL(sched_wakeup_granularity);
23018 -+ SET_SYSCTL(sched_shares_ratelimit);
23019 -+#undef SET_SYSCTL
23020 -+}
23021 -
23022 -- sysctl_sched_shares_ratelimit *= factor;
23023 -+static inline void sched_init_granularity(void)
23024 -+{
23025 -+ update_sysctl();
23026 - }
23027 -
23028 - #ifdef CONFIG_SMP
23029 -@@ -8061,6 +8064,7 @@ static cpumask_var_t cpu_isolated_map;
23030 - /* Setup the mask of cpus configured for isolated domains */
23031 - static int __init isolated_cpu_setup(char *str)
23032 - {
23033 -+ alloc_bootmem_cpumask_var(&cpu_isolated_map);
23034 - cpulist_parse(str, cpu_isolated_map);
23035 - return 1;
23036 - }
23037 -@@ -9591,7 +9595,9 @@ void __init sched_init(void)
23038 - zalloc_cpumask_var(&nohz.cpu_mask, GFP_NOWAIT);
23039 - alloc_cpumask_var(&nohz.ilb_grp_nohz_mask, GFP_NOWAIT);
23040 - #endif
23041 -- zalloc_cpumask_var(&cpu_isolated_map, GFP_NOWAIT);
23042 -+ /* May be allocated at isolcpus cmdline parse time */
23043 -+ if (cpu_isolated_map == NULL)
23044 -+ zalloc_cpumask_var(&cpu_isolated_map, GFP_NOWAIT);
23045 - #endif /* SMP */
23046 -
23047 - perf_event_init();
23048 -diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
23049 -index 199228b..d80812d 100644
23050 ---- a/kernel/sched_fair.c
23051 -+++ b/kernel/sched_fair.c
23052 -@@ -35,12 +35,14 @@
23053 - * run vmstat and monitor the context-switches (cs) field)
23054 - */
23055 - unsigned int sysctl_sched_latency = 5000000ULL;
23056 -+unsigned int normalized_sysctl_sched_latency = 5000000ULL;
23057 -
23058 - /*
23059 - * Minimal preemption granularity for CPU-bound tasks:
23060 - * (default: 1 msec * (1 + ilog(ncpus)), units: nanoseconds)
23061 - */
23062 - unsigned int sysctl_sched_min_granularity = 1000000ULL;
23063 -+unsigned int normalized_sysctl_sched_min_granularity = 1000000ULL;
23064 -
23065 - /*
23066 - * is kept at sysctl_sched_latency / sysctl_sched_min_granularity
23067 -@@ -70,6 +72,7 @@ unsigned int __read_mostly sysctl_sched_compat_yield;
23068 - * have immediate wakeup/sleep latencies.
23069 - */
23070 - unsigned int sysctl_sched_wakeup_granularity = 1000000UL;
23071 -+unsigned int normalized_sysctl_sched_wakeup_granularity = 1000000UL;
23072 -
23073 - const_debug unsigned int sysctl_sched_migration_cost = 500000UL;
23074 -
23075 -@@ -1880,6 +1883,17 @@ move_one_task_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
23076 -
23077 - return 0;
23078 - }
23079 -+
23080 -+static void rq_online_fair(struct rq *rq)
23081 -+{
23082 -+ update_sysctl();
23083 -+}
23084 -+
23085 -+static void rq_offline_fair(struct rq *rq)
23086 -+{
23087 -+ update_sysctl();
23088 -+}
23089 -+
23090 - #endif /* CONFIG_SMP */
23091 -
23092 - /*
23093 -@@ -2027,6 +2041,8 @@ static const struct sched_class fair_sched_class = {
23094 -
23095 - .load_balance = load_balance_fair,
23096 - .move_one_task = move_one_task_fair,
23097 -+ .rq_online = rq_online_fair,
23098 -+ .rq_offline = rq_offline_fair,
23099 - #endif
23100 -
23101 - .set_curr_task = set_curr_task_fair,
23102 -diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
23103 -index 9484be4..0d809ae 100644
23104 ---- a/kernel/time/clockevents.c
23105 -+++ b/kernel/time/clockevents.c
23106 -@@ -20,6 +20,8 @@
23107 - #include <linux/sysdev.h>
23108 - #include <linux/tick.h>
23109 -
23110 -+#include "tick-internal.h"
23111 -+
23112 - /* The registered clock event devices */
23113 - static LIST_HEAD(clockevent_devices);
23114 - static LIST_HEAD(clockevents_released);
23115 -@@ -258,7 +260,8 @@ void clockevents_notify(unsigned long reason, void *arg)
23116 - cpu = *((int *)arg);
23117 - list_for_each_entry_safe(dev, tmp, &clockevent_devices, list) {
23118 - if (cpumask_test_cpu(cpu, dev->cpumask) &&
23119 -- cpumask_weight(dev->cpumask) == 1) {
23120 -+ cpumask_weight(dev->cpumask) == 1 &&
23121 -+ !tick_is_broadcast_device(dev)) {
23122 - BUG_ON(dev->mode != CLOCK_EVT_MODE_UNUSED);
23123 - list_del(&dev->list);
23124 - }
23125 -diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
23126 -index 5e18c6a..5155dc3 100644
23127 ---- a/kernel/time/clocksource.c
23128 -+++ b/kernel/time/clocksource.c
23129 -@@ -416,6 +416,47 @@ void clocksource_touch_watchdog(void)
23130 - #ifdef CONFIG_GENERIC_TIME
23131 -
23132 - /**
23133 -+ * clocksource_max_deferment - Returns max time the clocksource can be deferred
23134 -+ * @cs: Pointer to clocksource
23135 -+ *
23136 -+ */
23137 -+static u64 clocksource_max_deferment(struct clocksource *cs)
23138 -+{
23139 -+ u64 max_nsecs, max_cycles;
23140 -+
23141 -+ /*
23142 -+ * Calculate the maximum number of cycles that we can pass to the
23143 -+ * cyc2ns function without overflowing a 64-bit signed result. The
23144 -+ * maximum number of cycles is equal to ULLONG_MAX/cs->mult which
23145 -+ * is equivalent to the below.
23146 -+ * max_cycles < (2^63)/cs->mult
23147 -+ * max_cycles < 2^(log2((2^63)/cs->mult))
23148 -+ * max_cycles < 2^(log2(2^63) - log2(cs->mult))
23149 -+ * max_cycles < 2^(63 - log2(cs->mult))
23150 -+ * max_cycles < 1 << (63 - log2(cs->mult))
23151 -+ * Please note that we add 1 to the result of the log2 to account for
23152 -+ * any rounding errors, ensure the above inequality is satisfied and
23153 -+ * no overflow will occur.
23154 -+ */
23155 -+ max_cycles = 1ULL << (63 - (ilog2(cs->mult) + 1));
23156 -+
23157 -+ /*
23158 -+ * The actual maximum number of cycles we can defer the clocksource is
23159 -+ * determined by the minimum of max_cycles and cs->mask.
23160 -+ */
23161 -+ max_cycles = min_t(u64, max_cycles, (u64) cs->mask);
23162 -+ max_nsecs = clocksource_cyc2ns(max_cycles, cs->mult, cs->shift);
23163 -+
23164 -+ /*
23165 -+ * To ensure that the clocksource does not wrap whilst we are idle,
23166 -+ * limit the time the clocksource can be deferred by 12.5%. Please
23167 -+ * note a margin of 12.5% is used because this can be computed with
23168 -+ * a shift, versus say 10% which would require division.
23169 -+ */
23170 -+ return max_nsecs - (max_nsecs >> 5);
23171 -+}
23172 -+
23173 -+/**
23174 - * clocksource_select - Select the best clocksource available
23175 - *
23176 - * Private function. Must hold clocksource_mutex when called.
23177 -@@ -511,6 +552,9 @@ static void clocksource_enqueue(struct clocksource *cs)
23178 - */
23179 - int clocksource_register(struct clocksource *cs)
23180 - {
23181 -+ /* calculate max idle time permitted for this clocksource */
23182 -+ cs->max_idle_ns = clocksource_max_deferment(cs);
23183 -+
23184 - mutex_lock(&clocksource_mutex);
23185 - clocksource_enqueue(cs);
23186 - clocksource_select();
23187 -diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
23188 -index 89aed59..44320b1 100644
23189 ---- a/kernel/time/tick-sched.c
23190 -+++ b/kernel/time/tick-sched.c
23191 -@@ -216,6 +216,7 @@ void tick_nohz_stop_sched_tick(int inidle)
23192 - struct tick_sched *ts;
23193 - ktime_t last_update, expires, now;
23194 - struct clock_event_device *dev = __get_cpu_var(tick_cpu_device).evtdev;
23195 -+ u64 time_delta;
23196 - int cpu;
23197 -
23198 - local_irq_save(flags);
23199 -@@ -275,6 +276,17 @@ void tick_nohz_stop_sched_tick(int inidle)
23200 - seq = read_seqbegin(&xtime_lock);
23201 - last_update = last_jiffies_update;
23202 - last_jiffies = jiffies;
23203 -+
23204 -+ /*
23205 -+ * On SMP we really should only care for the CPU which
23206 -+ * has the do_timer duty assigned. All other CPUs can
23207 -+ * sleep as long as they want.
23208 -+ */
23209 -+ if (cpu == tick_do_timer_cpu ||
23210 -+ tick_do_timer_cpu == TICK_DO_TIMER_NONE)
23211 -+ time_delta = timekeeping_max_deferment();
23212 -+ else
23213 -+ time_delta = KTIME_MAX;
23214 - } while (read_seqretry(&xtime_lock, seq));
23215 -
23216 - /* Get the next timer wheel timer */
23217 -@@ -294,11 +306,26 @@ void tick_nohz_stop_sched_tick(int inidle)
23218 - if ((long)delta_jiffies >= 1) {
23219 -
23220 - /*
23221 -- * calculate the expiry time for the next timer wheel
23222 -- * timer
23223 -- */
23224 -- expires = ktime_add_ns(last_update, tick_period.tv64 *
23225 -- delta_jiffies);
23226 -+ * calculate the expiry time for the next timer wheel
23227 -+ * timer. delta_jiffies >= NEXT_TIMER_MAX_DELTA signals
23228 -+ * that there is no timer pending or at least extremely
23229 -+ * far into the future (12 days for HZ=1000). In this
23230 -+ * case we set the expiry to the end of time.
23231 -+ */
23232 -+ if (likely(delta_jiffies < NEXT_TIMER_MAX_DELTA)) {
23233 -+ /*
23234 -+ * Calculate the time delta for the next timer event.
23235 -+ * If the time delta exceeds the maximum time delta
23236 -+ * permitted by the current clocksource then adjust
23237 -+ * the time delta accordingly to ensure the
23238 -+ * clocksource does not wrap.
23239 -+ */
23240 -+ time_delta = min_t(u64, time_delta,
23241 -+ tick_period.tv64 * delta_jiffies);
23242 -+ expires = ktime_add_ns(last_update, time_delta);
23243 -+ } else {
23244 -+ expires.tv64 = KTIME_MAX;
23245 -+ }
23246 -
23247 - /*
23248 - * If this cpu is the one which updates jiffies, then
23249 -@@ -342,22 +369,19 @@ void tick_nohz_stop_sched_tick(int inidle)
23250 -
23251 - ts->idle_sleeps++;
23252 -
23253 -+ /* Mark expires */
23254 -+ ts->idle_expires = expires;
23255 -+
23256 - /*
23257 -- * delta_jiffies >= NEXT_TIMER_MAX_DELTA signals that
23258 -- * there is no timer pending or at least extremly far
23259 -- * into the future (12 days for HZ=1000). In this case
23260 -- * we simply stop the tick timer:
23261 -+ * If the expiration time == KTIME_MAX, then
23262 -+ * in this case we simply stop the tick timer.
23263 - */
23264 -- if (unlikely(delta_jiffies >= NEXT_TIMER_MAX_DELTA)) {
23265 -- ts->idle_expires.tv64 = KTIME_MAX;
23266 -+ if (unlikely(expires.tv64 == KTIME_MAX)) {
23267 - if (ts->nohz_mode == NOHZ_MODE_HIGHRES)
23268 - hrtimer_cancel(&ts->sched_timer);
23269 - goto out;
23270 - }
23271 -
23272 -- /* Mark expiries */
23273 -- ts->idle_expires = expires;
23274 --
23275 - if (ts->nohz_mode == NOHZ_MODE_HIGHRES) {
23276 - hrtimer_start(&ts->sched_timer, expires,
23277 - HRTIMER_MODE_ABS_PINNED);
23278 -diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
23279 -index c3a4e29..66d090e 100644
23280 ---- a/kernel/time/timekeeping.c
23281 -+++ b/kernel/time/timekeeping.c
23282 -@@ -488,6 +488,17 @@ int timekeeping_valid_for_hres(void)
23283 - }
23284 -
23285 - /**
23286 -+ * timekeeping_max_deferment - Returns max time the clocksource can be deferred
23287 -+ *
23288 -+ * Caller must observe xtime_lock via read_seqbegin/read_seqretry to
23289 -+ * ensure that the clocksource does not change!
23290 -+ */
23291 -+u64 timekeeping_max_deferment(void)
23292 -+{
23293 -+ return timekeeper.clock->max_idle_ns;
23294 -+}
23295 -+
23296 -+/**
23297 - * read_persistent_clock - Return time from the persistent clock.
23298 - *
23299 - * Weak dummy function for arches that do not yet support it.
23300 -diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
23301 -index cca675e..fe2d3f8 100644
23302 ---- a/net/mac80211/cfg.c
23303 -+++ b/net/mac80211/cfg.c
23304 -@@ -1306,6 +1306,9 @@ static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev,
23305 - struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
23306 - struct ieee80211_conf *conf = &local->hw.conf;
23307 -
23308 -+ if (sdata->vif.type != NL80211_IFTYPE_STATION)
23309 -+ return -EOPNOTSUPP;
23310 -+
23311 - if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS))
23312 - return -EOPNOTSUPP;
23313 -
23314 -diff --git a/net/netfilter/xt_conntrack.c b/net/netfilter/xt_conntrack.c
23315 -index 6dc4652..ae66305 100644
23316 ---- a/net/netfilter/xt_conntrack.c
23317 -+++ b/net/netfilter/xt_conntrack.c
23318 -@@ -113,7 +113,8 @@ ct_proto_port_check(const struct xt_conntrack_mtinfo2 *info,
23319 - }
23320 -
23321 - static bool
23322 --conntrack_mt(const struct sk_buff *skb, const struct xt_match_param *par)
23323 -+conntrack_mt(const struct sk_buff *skb, const struct xt_match_param *par,
23324 -+ u16 state_mask, u16 status_mask)
23325 - {
23326 - const struct xt_conntrack_mtinfo2 *info = par->matchinfo;
23327 - enum ip_conntrack_info ctinfo;
23328 -@@ -136,7 +137,7 @@ conntrack_mt(const struct sk_buff *skb, const struct xt_match_param *par)
23329 - if (test_bit(IPS_DST_NAT_BIT, &ct->status))
23330 - statebit |= XT_CONNTRACK_STATE_DNAT;
23331 - }
23332 -- if (!!(info->state_mask & statebit) ^
23333 -+ if (!!(state_mask & statebit) ^
23334 - !(info->invert_flags & XT_CONNTRACK_STATE))
23335 - return false;
23336 - }
23337 -@@ -172,7 +173,7 @@ conntrack_mt(const struct sk_buff *skb, const struct xt_match_param *par)
23338 - return false;
23339 -
23340 - if ((info->match_flags & XT_CONNTRACK_STATUS) &&
23341 -- (!!(info->status_mask & ct->status) ^
23342 -+ (!!(status_mask & ct->status) ^
23343 - !(info->invert_flags & XT_CONNTRACK_STATUS)))
23344 - return false;
23345 -
23346 -@@ -192,11 +193,17 @@ conntrack_mt(const struct sk_buff *skb, const struct xt_match_param *par)
23347 - static bool
23348 - conntrack_mt_v1(const struct sk_buff *skb, const struct xt_match_param *par)
23349 - {
23350 -- const struct xt_conntrack_mtinfo2 *const *info = par->matchinfo;
23351 -- struct xt_match_param newpar = *par;
23352 -+ const struct xt_conntrack_mtinfo1 *info = par->matchinfo;
23353 -
23354 -- newpar.matchinfo = *info;
23355 -- return conntrack_mt(skb, &newpar);
23356 -+ return conntrack_mt(skb, par, info->state_mask, info->status_mask);
23357 -+}
23358 -+
23359 -+static bool
23360 -+conntrack_mt_v2(const struct sk_buff *skb, const struct xt_match_param *par)
23361 -+{
23362 -+ const struct xt_conntrack_mtinfo2 *info = par->matchinfo;
23363 -+
23364 -+ return conntrack_mt(skb, par, info->state_mask, info->status_mask);
23365 - }
23366 -
23367 - static bool conntrack_mt_check(const struct xt_mtchk_param *par)
23368 -@@ -209,45 +216,11 @@ static bool conntrack_mt_check(const struct xt_mtchk_param *par)
23369 - return true;
23370 - }
23371 -
23372 --static bool conntrack_mt_check_v1(const struct xt_mtchk_param *par)
23373 --{
23374 -- struct xt_conntrack_mtinfo1 *info = par->matchinfo;
23375 -- struct xt_conntrack_mtinfo2 *up;
23376 -- int ret = conntrack_mt_check(par);
23377 --
23378 -- if (ret < 0)
23379 -- return ret;
23380 --
23381 -- up = kmalloc(sizeof(*up), GFP_KERNEL);
23382 -- if (up == NULL) {
23383 -- nf_ct_l3proto_module_put(par->family);
23384 -- return -ENOMEM;
23385 -- }
23386 --
23387 -- /*
23388 -- * The strategy here is to minimize the overhead of v1 matching,
23389 -- * by prebuilding a v2 struct and putting the pointer into the
23390 -- * v1 dataspace.
23391 -- */
23392 -- memcpy(up, info, offsetof(typeof(*info), state_mask));
23393 -- up->state_mask = info->state_mask;
23394 -- up->status_mask = info->status_mask;
23395 -- *(void **)info = up;
23396 -- return true;
23397 --}
23398 --
23399 - static void conntrack_mt_destroy(const struct xt_mtdtor_param *par)
23400 - {
23401 - nf_ct_l3proto_module_put(par->family);
23402 - }
23403 -
23404 --static void conntrack_mt_destroy_v1(const struct xt_mtdtor_param *par)
23405 --{
23406 -- struct xt_conntrack_mtinfo2 **info = par->matchinfo;
23407 -- kfree(*info);
23408 -- conntrack_mt_destroy(par);
23409 --}
23410 --
23411 - static struct xt_match conntrack_mt_reg[] __read_mostly = {
23412 - {
23413 - .name = "conntrack",
23414 -@@ -255,8 +228,8 @@ static struct xt_match conntrack_mt_reg[] __read_mostly = {
23415 - .family = NFPROTO_UNSPEC,
23416 - .matchsize = sizeof(struct xt_conntrack_mtinfo1),
23417 - .match = conntrack_mt_v1,
23418 -- .checkentry = conntrack_mt_check_v1,
23419 -- .destroy = conntrack_mt_destroy_v1,
23420 -+ .checkentry = conntrack_mt_check,
23421 -+ .destroy = conntrack_mt_destroy,
23422 - .me = THIS_MODULE,
23423 - },
23424 - {
23425 -@@ -264,7 +237,7 @@ static struct xt_match conntrack_mt_reg[] __read_mostly = {
23426 - .revision = 2,
23427 - .family = NFPROTO_UNSPEC,
23428 - .matchsize = sizeof(struct xt_conntrack_mtinfo2),
23429 -- .match = conntrack_mt,
23430 -+ .match = conntrack_mt_v2,
23431 - .checkentry = conntrack_mt_check,
23432 - .destroy = conntrack_mt_destroy,
23433 - .me = THIS_MODULE,
23434 -diff --git a/net/wireless/sme.c b/net/wireless/sme.c
23435 -index 9f0b280..b2930e3 100644
23436 ---- a/net/wireless/sme.c
23437 -+++ b/net/wireless/sme.c
23438 -@@ -655,6 +655,7 @@ void __cfg80211_disconnected(struct net_device *dev, const u8 *ie,
23439 - memset(&wrqu, 0, sizeof(wrqu));
23440 - wrqu.ap_addr.sa_family = ARPHRD_ETHER;
23441 - wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL);
23442 -+ wdev->wext.connect.ssid_len = 0;
23443 - #endif
23444 - }
23445 -
23446 -diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
23447 -index 7e4ee4e..03784da 100644
23448 ---- a/sound/pci/hda/hda_intel.c
23449 -+++ b/sound/pci/hda/hda_intel.c
23450 -@@ -2694,6 +2694,9 @@ static struct pci_device_id azx_ids[] = {
23451 - { PCI_DEVICE(0x10de, 0x0ac1), .driver_data = AZX_DRIVER_NVIDIA },
23452 - { PCI_DEVICE(0x10de, 0x0ac2), .driver_data = AZX_DRIVER_NVIDIA },
23453 - { PCI_DEVICE(0x10de, 0x0ac3), .driver_data = AZX_DRIVER_NVIDIA },
23454 -+ { PCI_DEVICE(0x10de, 0x0be2), .driver_data = AZX_DRIVER_NVIDIA },
23455 -+ { PCI_DEVICE(0x10de, 0x0be3), .driver_data = AZX_DRIVER_NVIDIA },
23456 -+ { PCI_DEVICE(0x10de, 0x0be4), .driver_data = AZX_DRIVER_NVIDIA },
23457 - { PCI_DEVICE(0x10de, 0x0d94), .driver_data = AZX_DRIVER_NVIDIA },
23458 - { PCI_DEVICE(0x10de, 0x0d95), .driver_data = AZX_DRIVER_NVIDIA },
23459 - { PCI_DEVICE(0x10de, 0x0d96), .driver_data = AZX_DRIVER_NVIDIA },
23460 -diff --git a/sound/pci/hda/patch_intelhdmi.c b/sound/pci/hda/patch_intelhdmi.c
23461 -index 01a18ed..7c23016 100644
23462 ---- a/sound/pci/hda/patch_intelhdmi.c
23463 -+++ b/sound/pci/hda/patch_intelhdmi.c
23464 -@@ -684,7 +684,7 @@ static struct hda_codec_preset snd_hda_preset_intelhdmi[] = {
23465 - { .id = 0x80862801, .name = "G45 DEVBLC", .patch = patch_intel_hdmi },
23466 - { .id = 0x80862802, .name = "G45 DEVCTG", .patch = patch_intel_hdmi },
23467 - { .id = 0x80862803, .name = "G45 DEVELK", .patch = patch_intel_hdmi },
23468 -- { .id = 0x80862804, .name = "G45 DEVIBX", .patch = patch_intel_hdmi },
23469 -+ { .id = 0x80862804, .name = "G45 DEVIBX", .patch = patch_intel_hdmi_ibexpeak },
23470 - { .id = 0x80860054, .name = "Q57 DEVIBX", .patch = patch_intel_hdmi_ibexpeak },
23471 - { .id = 0x10951392, .name = "SiI1392 HDMI", .patch = patch_intel_hdmi },
23472 - {} /* terminator */
23473 -diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
23474 -index 075c3a6..c2e9370 100644
23475 ---- a/sound/pci/hda/patch_realtek.c
23476 -+++ b/sound/pci/hda/patch_realtek.c
23477 -@@ -2401,6 +2401,8 @@ static const char *alc_slave_sws[] = {
23478 - "Speaker Playback Switch",
23479 - "Mono Playback Switch",
23480 - "IEC958 Playback Switch",
23481 -+ "Line-Out Playback Switch",
23482 -+ "PCM Playback Switch",
23483 - NULL,
23484 - };
23485 -
23486 -@@ -8839,7 +8841,7 @@ static struct snd_pci_quirk alc882_cfg_tbl[] = {
23487 - SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
23488 - SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
23489 - SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
23490 -- SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG),
23491 -+ SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
23492 - SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
23493 - SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
23494 - SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
23495 -@@ -10152,7 +10154,7 @@ static void alc262_hp_t5735_setup(struct hda_codec *codec)
23496 - struct alc_spec *spec = codec->spec;
23497 -
23498 - spec->autocfg.hp_pins[0] = 0x15;
23499 -- spec->autocfg.speaker_pins[0] = 0x0c; /* HACK: not actually a pin */
23500 -+ spec->autocfg.speaker_pins[0] = 0x14;
23501 - }
23502 -
23503 - static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
23504 -@@ -11586,9 +11588,9 @@ static struct alc_config_preset alc262_presets[] = {
23505 - .num_channel_mode = ARRAY_SIZE(alc262_modes),
23506 - .channel_mode = alc262_modes,
23507 - .input_mux = &alc262_capture_source,
23508 -- .unsol_event = alc_automute_amp_unsol_event,
23509 -+ .unsol_event = alc_sku_unsol_event,
23510 - .setup = alc262_hp_t5735_setup,
23511 -- .init_hook = alc_automute_amp,
23512 -+ .init_hook = alc_inithook,
23513 - },
23514 - [ALC262_HP_RP5700] = {
23515 - .mixers = { alc262_hp_rp5700_mixer },
23516 -diff --git a/sound/pci/ice1712/juli.c b/sound/pci/ice1712/juli.c
23517 -index fd948bf..f5020ad 100644
23518 ---- a/sound/pci/ice1712/juli.c
23519 -+++ b/sound/pci/ice1712/juli.c
23520 -@@ -504,6 +504,31 @@ static int __devinit juli_add_controls(struct snd_ice1712 *ice)
23521 - }
23522 -
23523 - /*
23524 -+ * suspend/resume
23525 -+ * */
23526 -+
23527 -+#ifdef CONFIG_PM
23528 -+static int juli_resume(struct snd_ice1712 *ice)
23529 -+{
23530 -+ struct snd_akm4xxx *ak = ice->akm;
23531 -+ struct juli_spec *spec = ice->spec;
23532 -+ /* akm4358 un-reset, un-mute */
23533 -+ snd_akm4xxx_reset(ak, 0);
23534 -+ /* reinit ak4114 */
23535 -+ snd_ak4114_reinit(spec->ak4114);
23536 -+ return 0;
23537 -+}
23538 -+
23539 -+static int juli_suspend(struct snd_ice1712 *ice)
23540 -+{
23541 -+ struct snd_akm4xxx *ak = ice->akm;
23542 -+ /* akm4358 reset and soft-mute */
23543 -+ snd_akm4xxx_reset(ak, 1);
23544 -+ return 0;
23545 -+}
23546 -+#endif
23547 -+
23548 -+/*
23549 - * initialize the chip
23550 - */
23551 -
23552 -@@ -646,6 +671,13 @@ static int __devinit juli_init(struct snd_ice1712 *ice)
23553 - ice->set_spdif_clock = juli_set_spdif_clock;
23554 -
23555 - ice->spdif.ops.open = juli_spdif_in_open;
23556 -+
23557 -+#ifdef CONFIG_PM
23558 -+ ice->pm_resume = juli_resume;
23559 -+ ice->pm_suspend = juli_suspend;
23560 -+ ice->pm_suspend_enabled = 1;
23561 -+#endif
23562 -+
23563 - return 0;
23564 - }
23565 -
23566 -diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c
23567 -index fe1307b..eedf33c 100644
23568 ---- a/sound/soc/codecs/wm8903.c
23569 -+++ b/sound/soc/codecs/wm8903.c
23570 -@@ -1506,7 +1506,7 @@ static int wm8903_resume(struct platform_device *pdev)
23571 - struct i2c_client *i2c = codec->control_data;
23572 - int i;
23573 - u16 *reg_cache = codec->reg_cache;
23574 -- u16 *tmp_cache = kmemdup(codec->reg_cache, sizeof(wm8903_reg_defaults),
23575 -+ u16 *tmp_cache = kmemdup(reg_cache, sizeof(wm8903_reg_defaults),
23576 - GFP_KERNEL);
23577 -
23578 - /* Bring the codec back up to standby first to minimise pop/clicks */
23579 -@@ -1518,6 +1518,7 @@ static int wm8903_resume(struct platform_device *pdev)
23580 - for (i = 2; i < ARRAY_SIZE(wm8903_reg_defaults); i++)
23581 - if (tmp_cache[i] != reg_cache[i])
23582 - snd_soc_write(codec, i, tmp_cache[i]);
23583 -+ kfree(tmp_cache);
23584 - } else {
23585 - dev_err(&i2c->dev, "Failed to allocate temporary cache\n");
23586 - }
23587 -diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
23588 -index bb4ebd8..251282c 100644
23589 ---- a/virt/kvm/eventfd.c
23590 -+++ b/virt/kvm/eventfd.c
23591 -@@ -168,7 +168,7 @@ irqfd_ptable_queue_proc(struct file *file, wait_queue_head_t *wqh,
23592 - static int
23593 - kvm_irqfd_assign(struct kvm *kvm, int fd, int gsi)
23594 - {
23595 -- struct _irqfd *irqfd;
23596 -+ struct _irqfd *irqfd, *tmp;
23597 - struct file *file = NULL;
23598 - struct eventfd_ctx *eventfd = NULL;
23599 - int ret;
23600 -@@ -205,9 +205,20 @@ kvm_irqfd_assign(struct kvm *kvm, int fd, int gsi)
23601 - init_waitqueue_func_entry(&irqfd->wait, irqfd_wakeup);
23602 - init_poll_funcptr(&irqfd->pt, irqfd_ptable_queue_proc);
23603 -
23604 -+ spin_lock_irq(&kvm->irqfds.lock);
23605 -+
23606 -+ ret = 0;
23607 -+ list_for_each_entry(tmp, &kvm->irqfds.items, list) {
23608 -+ if (irqfd->eventfd != tmp->eventfd)
23609 -+ continue;
23610 -+ /* This fd is used for another irq already. */
23611 -+ ret = -EBUSY;
23612 -+ spin_unlock_irq(&kvm->irqfds.lock);
23613 -+ goto fail;
23614 -+ }
23615 -+
23616 - events = file->f_op->poll(file, &irqfd->pt);
23617 -
23618 -- spin_lock_irq(&kvm->irqfds.lock);
23619 - list_add_tail(&irqfd->list, &kvm->irqfds.items);
23620 - spin_unlock_irq(&kvm->irqfds.lock);
23621 -
23622 -diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
23623 -index 03e5b21..5288885 100644
23624 ---- a/virt/kvm/irq_comm.c
23625 -+++ b/virt/kvm/irq_comm.c
23626 -@@ -209,11 +209,13 @@ int kvm_request_irq_source_id(struct kvm *kvm)
23627 -
23628 - if (irq_source_id >= BITS_PER_LONG) {
23629 - printk(KERN_WARNING "kvm: exhaust allocatable IRQ sources!\n");
23630 -- return -EFAULT;
23631 -+ irq_source_id = -EFAULT;
23632 -+ goto unlock;
23633 - }
23634 -
23635 - ASSERT(irq_source_id != KVM_USERSPACE_IRQ_SOURCE_ID);
23636 - set_bit(irq_source_id, bitmap);
23637 -+unlock:
23638 - mutex_unlock(&kvm->irq_lock);
23639 -
23640 - return irq_source_id;
23641 -@@ -229,11 +231,15 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id)
23642 - if (irq_source_id < 0 ||
23643 - irq_source_id >= BITS_PER_LONG) {
23644 - printk(KERN_ERR "kvm: IRQ source ID out of range!\n");
23645 -- return;
23646 -+ goto unlock;
23647 - }
23648 -+ clear_bit(irq_source_id, &kvm->arch.irq_sources_bitmap);
23649 -+ if (!irqchip_in_kernel(kvm))
23650 -+ goto unlock;
23651 -+
23652 - for (i = 0; i < KVM_IOAPIC_NUM_PINS; i++)
23653 - clear_bit(irq_source_id, &kvm->arch.irq_states[i]);
23654 -- clear_bit(irq_source_id, &kvm->arch.irq_sources_bitmap);
23655 -+unlock:
23656 - mutex_unlock(&kvm->irq_lock);
23657 - }
23658 -
23659
23660 Deleted: genpatches-2.6/trunk/2.6.33/1007_linux-2.6.32.8.patch
23661 ===================================================================
23662 --- genpatches-2.6/trunk/2.6.33/1007_linux-2.6.32.8.patch 2010-02-18 15:55:49 UTC (rev 1673)
23663 +++ genpatches-2.6/trunk/2.6.33/1007_linux-2.6.32.8.patch 2010-02-18 15:58:13 UTC (rev 1674)
23664 @@ -1,4704 +0,0 @@
23665 -diff --git a/Documentation/kvm/api.txt b/Documentation/kvm/api.txt
23666 -index 5a4bc8c..db3a706 100644
23667 ---- a/Documentation/kvm/api.txt
23668 -+++ b/Documentation/kvm/api.txt
23669 -@@ -593,6 +593,42 @@ struct kvm_irqchip {
23670 - } chip;
23671 - };
23672 -
23673 -+4.27 KVM_GET_CLOCK
23674 -+
23675 -+Capability: KVM_CAP_ADJUST_CLOCK
23676 -+Architectures: x86
23677 -+Type: vm ioctl
23678 -+Parameters: struct kvm_clock_data (out)
23679 -+Returns: 0 on success, -1 on error
23680 -+
23681 -+Gets the current timestamp of kvmclock as seen by the current guest. In
23682 -+conjunction with KVM_SET_CLOCK, it is used to ensure monotonicity on scenarios
23683 -+such as migration.
23684 -+
23685 -+struct kvm_clock_data {
23686 -+ __u64 clock; /* kvmclock current value */
23687 -+ __u32 flags;
23688 -+ __u32 pad[9];
23689 -+};
23690 -+
23691 -+4.28 KVM_SET_CLOCK
23692 -+
23693 -+Capability: KVM_CAP_ADJUST_CLOCK
23694 -+Architectures: x86
23695 -+Type: vm ioctl
23696 -+Parameters: struct kvm_clock_data (in)
23697 -+Returns: 0 on success, -1 on error
23698 -+
23699 -+Sets the current timestamp of kvmclock to the valued specific in its parameter.
23700 -+In conjunction with KVM_GET_CLOCK, it is used to ensure monotonicity on scenarios
23701 -+such as migration.
23702 -+
23703 -+struct kvm_clock_data {
23704 -+ __u64 clock; /* kvmclock current value */
23705 -+ __u32 flags;
23706 -+ __u32 pad[9];
23707 -+};
23708 -+
23709 - 5. The kvm_run structure
23710 -
23711 - Application code obtains a pointer to the kvm_run structure by
23712 -diff --git a/arch/blackfin/include/asm/page.h b/arch/blackfin/include/asm/page.h
23713 -index 944a07c..1d04e40 100644
23714 ---- a/arch/blackfin/include/asm/page.h
23715 -+++ b/arch/blackfin/include/asm/page.h
23716 -@@ -10,4 +10,9 @@
23717 - #include <asm-generic/page.h>
23718 - #define MAP_NR(addr) (((unsigned long)(addr)-PAGE_OFFSET) >> PAGE_SHIFT)
23719 -
23720 -+#define VM_DATA_DEFAULT_FLAGS \
23721 -+ (VM_READ | VM_WRITE | \
23722 -+ ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
23723 -+ VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
23724 -+
23725 - #endif
23726 -diff --git a/arch/frv/include/asm/page.h b/arch/frv/include/asm/page.h
23727 -index 25c6a50..8c97068 100644
23728 ---- a/arch/frv/include/asm/page.h
23729 -+++ b/arch/frv/include/asm/page.h
23730 -@@ -63,12 +63,10 @@ extern unsigned long max_pfn;
23731 - #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
23732 -
23733 -
23734 --#ifdef CONFIG_MMU
23735 - #define VM_DATA_DEFAULT_FLAGS \
23736 - (VM_READ | VM_WRITE | \
23737 - ((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
23738 - VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
23739 --#endif
23740 -
23741 - #endif /* __ASSEMBLY__ */
23742 -
23743 -diff --git a/arch/powerpc/include/asm/elf.h b/arch/powerpc/include/asm/elf.h
23744 -index 014a624..5698502 100644
23745 ---- a/arch/powerpc/include/asm/elf.h
23746 -+++ b/arch/powerpc/include/asm/elf.h
23747 -@@ -236,14 +236,10 @@ typedef elf_vrregset_t elf_fpxregset_t;
23748 - #ifdef __powerpc64__
23749 - # define SET_PERSONALITY(ex) \
23750 - do { \
23751 -- unsigned long new_flags = 0; \
23752 - if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
23753 -- new_flags = _TIF_32BIT; \
23754 -- if ((current_thread_info()->flags & _TIF_32BIT) \
23755 -- != new_flags) \
23756 -- set_thread_flag(TIF_ABI_PENDING); \
23757 -+ set_thread_flag(TIF_32BIT); \
23758 - else \
23759 -- clear_thread_flag(TIF_ABI_PENDING); \
23760 -+ clear_thread_flag(TIF_32BIT); \
23761 - if (personality(current->personality) != PER_LINUX32) \
23762 - set_personality(PER_LINUX | \
23763 - (current->personality & (~PER_MASK))); \
23764 -diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
23765 -index c8b3292..aa9d383 100644
23766 ---- a/arch/powerpc/include/asm/thread_info.h
23767 -+++ b/arch/powerpc/include/asm/thread_info.h
23768 -@@ -111,7 +111,6 @@ static inline struct thread_info *current_thread_info(void)
23769 - #define TIF_NOTIFY_RESUME 13 /* callback before returning to user */
23770 - #define TIF_FREEZE 14 /* Freezing for suspend */
23771 - #define TIF_RUNLATCH 15 /* Is the runlatch enabled? */
23772 --#define TIF_ABI_PENDING 16 /* 32/64 bit switch needed */
23773 -
23774 - /* as above, but as bit values */
23775 - #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
23776 -@@ -129,7 +128,6 @@ static inline struct thread_info *current_thread_info(void)
23777 - #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME)
23778 - #define _TIF_FREEZE (1<<TIF_FREEZE)
23779 - #define _TIF_RUNLATCH (1<<TIF_RUNLATCH)
23780 --#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING)
23781 - #define _TIF_SYSCALL_T_OR_A (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP)
23782 -
23783 - #define _TIF_USER_WORK_MASK (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
23784 -diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
23785 -index c930ac3..7b816da 100644
23786 ---- a/arch/powerpc/kernel/process.c
23787 -+++ b/arch/powerpc/kernel/process.c
23788 -@@ -554,18 +554,6 @@ void exit_thread(void)
23789 -
23790 - void flush_thread(void)
23791 - {
23792 --#ifdef CONFIG_PPC64
23793 -- struct thread_info *t = current_thread_info();
23794 --
23795 -- if (test_ti_thread_flag(t, TIF_ABI_PENDING)) {
23796 -- clear_ti_thread_flag(t, TIF_ABI_PENDING);
23797 -- if (test_ti_thread_flag(t, TIF_32BIT))
23798 -- clear_ti_thread_flag(t, TIF_32BIT);
23799 -- else
23800 -- set_ti_thread_flag(t, TIF_32BIT);
23801 -- }
23802 --#endif
23803 --
23804 - discard_lazy_cpu_state();
23805 -
23806 - if (current->thread.dabr) {
23807 -diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
23808 -index 48215d1..e8ef21c 100644
23809 ---- a/arch/s390/kernel/entry.S
23810 -+++ b/arch/s390/kernel/entry.S
23811 -@@ -571,6 +571,7 @@ pgm_svcper:
23812 - mvc __THREAD_per+__PER_access_id(1,%r8),__LC_PER_ACCESS_ID
23813 - oi __TI_flags+3(%r9),_TIF_SINGLE_STEP # set TIF_SINGLE_STEP
23814 - TRACE_IRQS_ON
23815 -+ lm %r2,%r6,SP_R2(%r15) # load svc arguments
23816 - stosm __SF_EMPTY(%r15),0x03 # reenable interrupts
23817 - b BASED(sysc_do_svc)
23818 -
23819 -diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
23820 -index 9aff1d4..f33658f 100644
23821 ---- a/arch/s390/kernel/entry64.S
23822 -+++ b/arch/s390/kernel/entry64.S
23823 -@@ -549,6 +549,7 @@ pgm_svcper:
23824 - mvc __THREAD_per+__PER_access_id(1,%r8),__LC_PER_ACCESS_ID
23825 - oi __TI_flags+7(%r9),_TIF_SINGLE_STEP # set TIF_SINGLE_STEP
23826 - TRACE_IRQS_ON
23827 -+ lmg %r2,%r6,SP_R2(%r15) # load svc arguments
23828 - stosm __SF_EMPTY(%r15),0x03 # reenable interrupts
23829 - j sysc_do_svc
23830 -
23831 -diff --git a/arch/sh/kernel/process_64.c b/arch/sh/kernel/process_64.c
23832 -index 1192398..44aa119 100644
23833 ---- a/arch/sh/kernel/process_64.c
23834 -+++ b/arch/sh/kernel/process_64.c
23835 -@@ -367,7 +367,7 @@ void exit_thread(void)
23836 - void flush_thread(void)
23837 - {
23838 -
23839 -- /* Called by fs/exec.c (flush_old_exec) to remove traces of a
23840 -+ /* Called by fs/exec.c (setup_new_exec) to remove traces of a
23841 - * previously running executable. */
23842 - #ifdef CONFIG_SH_FPU
23843 - if (last_task_used_math == current) {
23844 -diff --git a/arch/sparc/include/asm/elf_64.h b/arch/sparc/include/asm/elf_64.h
23845 -index d42e393..9968085 100644
23846 ---- a/arch/sparc/include/asm/elf_64.h
23847 -+++ b/arch/sparc/include/asm/elf_64.h
23848 -@@ -196,17 +196,10 @@ static inline unsigned int sparc64_elf_hwcap(void)
23849 - #define ELF_PLATFORM (NULL)
23850 -
23851 - #define SET_PERSONALITY(ex) \
23852 --do { unsigned long new_flags = current_thread_info()->flags; \
23853 -- new_flags &= _TIF_32BIT; \
23854 -- if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
23855 -- new_flags |= _TIF_32BIT; \
23856 -+do { if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
23857 -+ set_thread_flag(TIF_32BIT); \
23858 - else \
23859 -- new_flags &= ~_TIF_32BIT; \
23860 -- if ((current_thread_info()->flags & _TIF_32BIT) \
23861 -- != new_flags) \
23862 -- set_thread_flag(TIF_ABI_PENDING); \
23863 -- else \
23864 -- clear_thread_flag(TIF_ABI_PENDING); \
23865 -+ clear_thread_flag(TIF_32BIT); \
23866 - /* flush_thread will update pgd cache */ \
23867 - if (personality(current->personality) != PER_LINUX32) \
23868 - set_personality(PER_LINUX | \
23869 -diff --git a/arch/sparc/include/asm/thread_info_64.h b/arch/sparc/include/asm/thread_info_64.h
23870 -index 1b45a7b..f78ad9a 100644
23871 ---- a/arch/sparc/include/asm/thread_info_64.h
23872 -+++ b/arch/sparc/include/asm/thread_info_64.h
23873 -@@ -227,12 +227,11 @@ register struct thread_info *current_thread_info_reg asm("g6");
23874 - /* flag bit 8 is available */
23875 - #define TIF_SECCOMP 9 /* secure computing */
23876 - #define TIF_SYSCALL_AUDIT 10 /* syscall auditing active */
23877 --/* flag bit 11 is available */
23878 - /* NOTE: Thread flags >= 12 should be ones we have no interest
23879 - * in using in assembly, else we can't use the mask as
23880 - * an immediate value in instructions such as andcc.
23881 - */
23882 --#define TIF_ABI_PENDING 12
23883 -+/* flag bit 12 is available */
23884 - #define TIF_MEMDIE 13
23885 - #define TIF_POLLING_NRFLAG 14
23886 - #define TIF_FREEZE 15 /* is freezing for suspend */
23887 -@@ -246,7 +245,6 @@ register struct thread_info *current_thread_info_reg asm("g6");
23888 - #define _TIF_32BIT (1<<TIF_32BIT)
23889 - #define _TIF_SECCOMP (1<<TIF_SECCOMP)
23890 - #define _TIF_SYSCALL_AUDIT (1<<TIF_SYSCALL_AUDIT)
23891 --#define _TIF_ABI_PENDING (1<<TIF_ABI_PENDING)
23892 - #define _TIF_POLLING_NRFLAG (1<<TIF_POLLING_NRFLAG)
23893 - #define _TIF_FREEZE (1<<TIF_FREEZE)
23894 -
23895 -diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
23896 -index 18d6785..c3f1cce 100644
23897 ---- a/arch/sparc/kernel/process_64.c
23898 -+++ b/arch/sparc/kernel/process_64.c
23899 -@@ -365,14 +365,6 @@ void flush_thread(void)
23900 - struct thread_info *t = current_thread_info();
23901 - struct mm_struct *mm;
23902 -
23903 -- if (test_ti_thread_flag(t, TIF_ABI_PENDING)) {
23904 -- clear_ti_thread_flag(t, TIF_ABI_PENDING);
23905 -- if (test_ti_thread_flag(t, TIF_32BIT))
23906 -- clear_ti_thread_flag(t, TIF_32BIT);
23907 -- else
23908 -- set_ti_thread_flag(t, TIF_32BIT);
23909 -- }
23910 --
23911 - mm = t->task->mm;
23912 - if (mm)
23913 - tsb_context_switch(mm);
23914 -diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
23915 -index 72ace95..4fdb669 100644
23916 ---- a/arch/x86/Kconfig
23917 -+++ b/arch/x86/Kconfig
23918 -@@ -984,12 +984,6 @@ config X86_CPUID
23919 - with major 203 and minors 0 to 31 for /dev/cpu/0/cpuid to
23920 - /dev/cpu/31/cpuid.
23921 -
23922 --config X86_CPU_DEBUG
23923 -- tristate "/sys/kernel/debug/x86/cpu/* - CPU Debug support"
23924 -- ---help---
23925 -- If you select this option, this will provide various x86 CPUs
23926 -- information through debugfs.
23927 --
23928 - choice
23929 - prompt "High Memory Support"
23930 - default HIGHMEM4G if !X86_NUMAQ
23931 -diff --git a/arch/x86/ia32/ia32_aout.c b/arch/x86/ia32/ia32_aout.c
23932 -index 2a4d073..f9f4724 100644
23933 ---- a/arch/x86/ia32/ia32_aout.c
23934 -+++ b/arch/x86/ia32/ia32_aout.c
23935 -@@ -308,14 +308,15 @@ static int load_aout_binary(struct linux_binprm *bprm, struct pt_regs *regs)
23936 - if (retval)
23937 - return retval;
23938 -
23939 -- regs->cs = __USER32_CS;
23940 -- regs->r8 = regs->r9 = regs->r10 = regs->r11 = regs->r12 =
23941 -- regs->r13 = regs->r14 = regs->r15 = 0;
23942 --
23943 - /* OK, This is the point of no return */
23944 - set_personality(PER_LINUX);
23945 - set_thread_flag(TIF_IA32);
23946 -- clear_thread_flag(TIF_ABI_PENDING);
23947 -+
23948 -+ setup_new_exec(bprm);
23949 -+
23950 -+ regs->cs = __USER32_CS;
23951 -+ regs->r8 = regs->r9 = regs->r10 = regs->r11 = regs->r12 =
23952 -+ regs->r13 = regs->r14 = regs->r15 = 0;
23953 -
23954 - current->mm->end_code = ex.a_text +
23955 - (current->mm->start_code = N_TXTADDR(ex));
23956 -diff --git a/arch/x86/include/asm/cpu_debug.h b/arch/x86/include/asm/cpu_debug.h
23957 -deleted file mode 100644
23958 -index d96c1ee..0000000
23959 ---- a/arch/x86/include/asm/cpu_debug.h
23960 -+++ /dev/null
23961 -@@ -1,127 +0,0 @@
23962 --#ifndef _ASM_X86_CPU_DEBUG_H
23963 --#define _ASM_X86_CPU_DEBUG_H
23964 --
23965 --/*
23966 -- * CPU x86 architecture debug
23967 -- *
23968 -- * Copyright(C) 2009 Jaswinder Singh Rajput
23969 -- */
23970 --
23971 --/* Register flags */
23972 --enum cpu_debug_bit {
23973 --/* Model Specific Registers (MSRs) */
23974 -- CPU_MC_BIT, /* Machine Check */
23975 -- CPU_MONITOR_BIT, /* Monitor */
23976 -- CPU_TIME_BIT, /* Time */
23977 -- CPU_PMC_BIT, /* Performance Monitor */
23978 -- CPU_PLATFORM_BIT, /* Platform */
23979 -- CPU_APIC_BIT, /* APIC */
23980 -- CPU_POWERON_BIT, /* Power-on */
23981 -- CPU_CONTROL_BIT, /* Control */
23982 -- CPU_FEATURES_BIT, /* Features control */
23983 -- CPU_LBRANCH_BIT, /* Last Branch */
23984 -- CPU_BIOS_BIT, /* BIOS */
23985 -- CPU_FREQ_BIT, /* Frequency */
23986 -- CPU_MTTR_BIT, /* MTRR */
23987 -- CPU_PERF_BIT, /* Performance */
23988 -- CPU_CACHE_BIT, /* Cache */
23989 -- CPU_SYSENTER_BIT, /* Sysenter */
23990 -- CPU_THERM_BIT, /* Thermal */
23991 -- CPU_MISC_BIT, /* Miscellaneous */
23992 -- CPU_DEBUG_BIT, /* Debug */
23993 -- CPU_PAT_BIT, /* PAT */
23994 -- CPU_VMX_BIT, /* VMX */
23995 -- CPU_CALL_BIT, /* System Call */
23996 -- CPU_BASE_BIT, /* BASE Address */
23997 -- CPU_VER_BIT, /* Version ID */
23998 -- CPU_CONF_BIT, /* Configuration */
23999 -- CPU_SMM_BIT, /* System mgmt mode */
24000 -- CPU_SVM_BIT, /*Secure Virtual Machine*/
24001 -- CPU_OSVM_BIT, /* OS-Visible Workaround*/
24002 --/* Standard Registers */
24003 -- CPU_TSS_BIT, /* Task Stack Segment */
24004 -- CPU_CR_BIT, /* Control Registers */
24005 -- CPU_DT_BIT, /* Descriptor Table */
24006 --/* End of Registers flags */
24007 -- CPU_REG_ALL_BIT, /* Select all Registers */
24008 --};
24009 --
24010 --#define CPU_REG_ALL (~0) /* Select all Registers */
24011 --
24012 --#define CPU_MC (1 << CPU_MC_BIT)
24013 --#define CPU_MONITOR (1 << CPU_MONITOR_BIT)
24014 --#define CPU_TIME (1 << CPU_TIME_BIT)
24015 --#define CPU_PMC (1 << CPU_PMC_BIT)
24016 --#define CPU_PLATFORM (1 << CPU_PLATFORM_BIT)
24017 --#define CPU_APIC (1 << CPU_APIC_BIT)
24018 --#define CPU_POWERON (1 << CPU_POWERON_BIT)
24019 --#define CPU_CONTROL (1 << CPU_CONTROL_BIT)
24020 --#define CPU_FEATURES (1 << CPU_FEATURES_BIT)
24021 --#define CPU_LBRANCH (1 << CPU_LBRANCH_BIT)
24022 --#define CPU_BIOS (1 << CPU_BIOS_BIT)
24023 --#define CPU_FREQ (1 << CPU_FREQ_BIT)
24024 --#define CPU_MTRR (1 << CPU_MTTR_BIT)
24025 --#define CPU_PERF (1 << CPU_PERF_BIT)
24026 --#define CPU_CACHE (1 << CPU_CACHE_BIT)
24027 --#define CPU_SYSENTER (1 << CPU_SYSENTER_BIT)
24028 --#define CPU_THERM (1 << CPU_THERM_BIT)
24029 --#define CPU_MISC (1 << CPU_MISC_BIT)
24030 --#define CPU_DEBUG (1 << CPU_DEBUG_BIT)
24031 --#define CPU_PAT (1 << CPU_PAT_BIT)
24032 --#define CPU_VMX (1 << CPU_VMX_BIT)
24033 --#define CPU_CALL (1 << CPU_CALL_BIT)
24034 --#define CPU_BASE (1 << CPU_BASE_BIT)
24035 --#define CPU_VER (1 << CPU_VER_BIT)
24036 --#define CPU_CONF (1 << CPU_CONF_BIT)
24037 --#define CPU_SMM (1 << CPU_SMM_BIT)
24038 --#define CPU_SVM (1 << CPU_SVM_BIT)
24039 --#define CPU_OSVM (1 << CPU_OSVM_BIT)
24040 --#define CPU_TSS (1 << CPU_TSS_BIT)
24041 --#define CPU_CR (1 << CPU_CR_BIT)
24042 --#define CPU_DT (1 << CPU_DT_BIT)
24043 --
24044 --/* Register file flags */
24045 --enum cpu_file_bit {
24046 -- CPU_INDEX_BIT, /* index */
24047 -- CPU_VALUE_BIT, /* value */
24048 --};
24049 --
24050 --#define CPU_FILE_VALUE (1 << CPU_VALUE_BIT)
24051 --
24052 --#define MAX_CPU_FILES 512
24053 --
24054 --struct cpu_private {
24055 -- unsigned cpu;
24056 -- unsigned type;
24057 -- unsigned reg;
24058 -- unsigned file;
24059 --};
24060 --
24061 --struct cpu_debug_base {
24062 -- char *name; /* Register name */
24063 -- unsigned flag; /* Register flag */
24064 -- unsigned write; /* Register write flag */
24065 --};
24066 --
24067 --/*
24068 -- * Currently it looks similar to cpu_debug_base but once we add more files
24069 -- * cpu_file_base will go in different direction
24070 -- */
24071 --struct cpu_file_base {
24072 -- char *name; /* Register file name */
24073 -- unsigned flag; /* Register file flag */
24074 -- unsigned write; /* Register write flag */
24075 --};
24076 --
24077 --struct cpu_cpuX_base {
24078 -- struct dentry *dentry; /* Register dentry */
24079 -- int init; /* Register index file */
24080 --};
24081 --
24082 --struct cpu_debug_range {
24083 -- unsigned min; /* Register range min */
24084 -- unsigned max; /* Register range max */
24085 -- unsigned flag; /* Supported flags */
24086 --};
24087 --
24088 --#endif /* _ASM_X86_CPU_DEBUG_H */
24089 -diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h
24090 -index 456a304..8ac9d9a 100644
24091 ---- a/arch/x86/include/asm/elf.h
24092 -+++ b/arch/x86/include/asm/elf.h
24093 -@@ -197,14 +197,8 @@ do { \
24094 - set_fs(USER_DS); \
24095 - } while (0)
24096 -
24097 --#define COMPAT_SET_PERSONALITY(ex) \
24098 --do { \
24099 -- if (test_thread_flag(TIF_IA32)) \
24100 -- clear_thread_flag(TIF_ABI_PENDING); \
24101 -- else \
24102 -- set_thread_flag(TIF_ABI_PENDING); \
24103 -- current->personality |= force_personality32; \
24104 --} while (0)
24105 -+void set_personality_ia32(void);
24106 -+#define COMPAT_SET_PERSONALITY(ex) set_personality_ia32()
24107 -
24108 - #define COMPAT_ELF_PLATFORM ("i686")
24109 -
24110 -diff --git a/arch/x86/include/asm/hpet.h b/arch/x86/include/asm/hpet.h
24111 -index 1c22cb0..3251e23 100644
24112 ---- a/arch/x86/include/asm/hpet.h
24113 -+++ b/arch/x86/include/asm/hpet.h
24114 -@@ -66,6 +66,7 @@
24115 - extern unsigned long hpet_address;
24116 - extern unsigned long force_hpet_address;
24117 - extern int hpet_force_user;
24118 -+extern u8 hpet_msi_disable;
24119 - extern int is_hpet_enabled(void);
24120 - extern int hpet_enable(void);
24121 - extern void hpet_disable(void);
24122 -diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
24123 -index d838922..d759a1f 100644
24124 ---- a/arch/x86/include/asm/kvm_host.h
24125 -+++ b/arch/x86/include/asm/kvm_host.h
24126 -@@ -412,6 +412,7 @@ struct kvm_arch{
24127 - unsigned long irq_sources_bitmap;
24128 - unsigned long irq_states[KVM_IOAPIC_NUM_PINS];
24129 - u64 vm_init_tsc;
24130 -+ s64 kvmclock_offset;
24131 - };
24132 -
24133 - struct kvm_vm_stat {
24134 -diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h
24135 -index d27d0a2..19c3ce4 100644
24136 ---- a/arch/x86/include/asm/thread_info.h
24137 -+++ b/arch/x86/include/asm/thread_info.h
24138 -@@ -86,7 +86,6 @@ struct thread_info {
24139 - #define TIF_NOTSC 16 /* TSC is not accessible in userland */
24140 - #define TIF_IA32 17 /* 32bit process */
24141 - #define TIF_FORK 18 /* ret_from_fork */
24142 --#define TIF_ABI_PENDING 19
24143 - #define TIF_MEMDIE 20
24144 - #define TIF_DEBUG 21 /* uses debug registers */
24145 - #define TIF_IO_BITMAP 22 /* uses I/O bitmap */
24146 -@@ -110,7 +109,6 @@ struct thread_info {
24147 - #define _TIF_NOTSC (1 << TIF_NOTSC)
24148 - #define _TIF_IA32 (1 << TIF_IA32)
24149 - #define _TIF_FORK (1 << TIF_FORK)
24150 --#define _TIF_ABI_PENDING (1 << TIF_ABI_PENDING)
24151 - #define _TIF_DEBUG (1 << TIF_DEBUG)
24152 - #define _TIF_IO_BITMAP (1 << TIF_IO_BITMAP)
24153 - #define _TIF_FREEZE (1 << TIF_FREEZE)
24154 -diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
24155 -index 90b9b55..e3f85fe 100644
24156 ---- a/arch/x86/kernel/amd_iommu.c
24157 -+++ b/arch/x86/kernel/amd_iommu.c
24158 -@@ -540,7 +540,7 @@ static void flush_all_devices_for_iommu(struct amd_iommu *iommu)
24159 - static void flush_devices_by_domain(struct protection_domain *domain)
24160 - {
24161 - struct amd_iommu *iommu;
24162 -- int i;
24163 -+ unsigned long i;
24164 -
24165 - for (i = 0; i <= amd_iommu_last_bdf; ++i) {
24166 - if ((domain == NULL && amd_iommu_pd_table[i] == NULL) ||
24167 -diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile
24168 -index 68537e9..ff502cc 100644
24169 ---- a/arch/x86/kernel/cpu/Makefile
24170 -+++ b/arch/x86/kernel/cpu/Makefile
24171 -@@ -18,8 +18,6 @@ obj-y += vmware.o hypervisor.o sched.o
24172 - obj-$(CONFIG_X86_32) += bugs.o cmpxchg.o
24173 - obj-$(CONFIG_X86_64) += bugs_64.o
24174 -
24175 --obj-$(CONFIG_X86_CPU_DEBUG) += cpu_debug.o
24176 --
24177 - obj-$(CONFIG_CPU_SUP_INTEL) += intel.o
24178 - obj-$(CONFIG_CPU_SUP_AMD) += amd.o
24179 - obj-$(CONFIG_CPU_SUP_CYRIX_32) += cyrix.o
24180 -diff --git a/arch/x86/kernel/cpu/cpu_debug.c b/arch/x86/kernel/cpu/cpu_debug.c
24181 -deleted file mode 100644
24182 -index dca325c..0000000
24183 ---- a/arch/x86/kernel/cpu/cpu_debug.c
24184 -+++ /dev/null
24185 -@@ -1,688 +0,0 @@
24186 --/*
24187 -- * CPU x86 architecture debug code
24188 -- *
24189 -- * Copyright(C) 2009 Jaswinder Singh Rajput
24190 -- *
24191 -- * For licencing details see kernel-base/COPYING
24192 -- */
24193 --
24194 --#include <linux/interrupt.h>
24195 --#include <linux/compiler.h>
24196 --#include <linux/seq_file.h>
24197 --#include <linux/debugfs.h>
24198 --#include <linux/kprobes.h>
24199 --#include <linux/uaccess.h>
24200 --#include <linux/kernel.h>
24201 --#include <linux/module.h>
24202 --#include <linux/percpu.h>
24203 --#include <linux/signal.h>
24204 --#include <linux/errno.h>
24205 --#include <linux/sched.h>
24206 --#include <linux/types.h>
24207 --#include <linux/init.h>
24208 --#include <linux/slab.h>
24209 --#include <linux/smp.h>
24210 --
24211 --#include <asm/cpu_debug.h>
24212 --#include <asm/paravirt.h>
24213 --#include <asm/system.h>
24214 --#include <asm/traps.h>
24215 --#include <asm/apic.h>
24216 --#include <asm/desc.h>
24217 --
24218 --static DEFINE_PER_CPU(struct cpu_cpuX_base [CPU_REG_ALL_BIT], cpu_arr);
24219 --static DEFINE_PER_CPU(struct cpu_private * [MAX_CPU_FILES], priv_arr);
24220 --static DEFINE_PER_CPU(int, cpu_priv_count);
24221 --
24222 --static DEFINE_MUTEX(cpu_debug_lock);
24223 --
24224 --static struct dentry *cpu_debugfs_dir;
24225 --
24226 --static struct cpu_debug_base cpu_base[] = {
24227 -- { "mc", CPU_MC, 0 },
24228 -- { "monitor", CPU_MONITOR, 0 },
24229 -- { "time", CPU_TIME, 0 },
24230 -- { "pmc", CPU_PMC, 1 },
24231 -- { "platform", CPU_PLATFORM, 0 },
24232 -- { "apic", CPU_APIC, 0 },
24233 -- { "poweron", CPU_POWERON, 0 },
24234 -- { "control", CPU_CONTROL, 0 },
24235 -- { "features", CPU_FEATURES, 0 },
24236 -- { "lastbranch", CPU_LBRANCH, 0 },
24237 -- { "bios", CPU_BIOS, 0 },
24238 -- { "freq", CPU_FREQ, 0 },
24239 -- { "mtrr", CPU_MTRR, 0 },
24240 -- { "perf", CPU_PERF, 0 },
24241 -- { "cache", CPU_CACHE, 0 },
24242 -- { "sysenter", CPU_SYSENTER, 0 },
24243 -- { "therm", CPU_THERM, 0 },
24244 -- { "misc", CPU_MISC, 0 },
24245 -- { "debug", CPU_DEBUG, 0 },
24246 -- { "pat", CPU_PAT, 0 },
24247 -- { "vmx", CPU_VMX, 0 },
24248 -- { "call", CPU_CALL, 0 },
24249 -- { "base", CPU_BASE, 0 },
24250 -- { "ver", CPU_VER, 0 },
24251 -- { "conf", CPU_CONF, 0 },
24252 -- { "smm", CPU_SMM, 0 },
24253 -- { "svm", CPU_SVM, 0 },
24254 -- { "osvm", CPU_OSVM, 0 },
24255 -- { "tss", CPU_TSS, 0 },
24256 -- { "cr", CPU_CR, 0 },
24257 -- { "dt", CPU_DT, 0 },
24258 -- { "registers", CPU_REG_ALL, 0 },
24259 --};
24260 --
24261 --static struct cpu_file_base cpu_file[] = {
24262 -- { "index", CPU_REG_ALL, 0 },
24263 -- { "value", CPU_REG_ALL, 1 },
24264 --};
24265 --
24266 --/* CPU Registers Range */
24267 --static struct cpu_debug_range cpu_reg_range[] = {
24268 -- { 0x00000000, 0x00000001, CPU_MC, },
24269 -- { 0x00000006, 0x00000007, CPU_MONITOR, },
24270 -- { 0x00000010, 0x00000010, CPU_TIME, },
24271 -- { 0x00000011, 0x00000013, CPU_PMC, },
24272 -- { 0x00000017, 0x00000017, CPU_PLATFORM, },
24273 -- { 0x0000001B, 0x0000001B, CPU_APIC, },
24274 -- { 0x0000002A, 0x0000002B, CPU_POWERON, },
24275 -- { 0x0000002C, 0x0000002C, CPU_FREQ, },
24276 -- { 0x0000003A, 0x0000003A, CPU_CONTROL, },
24277 -- { 0x00000040, 0x00000047, CPU_LBRANCH, },
24278 -- { 0x00000060, 0x00000067, CPU_LBRANCH, },
24279 -- { 0x00000079, 0x00000079, CPU_BIOS, },
24280 -- { 0x00000088, 0x0000008A, CPU_CACHE, },
24281 -- { 0x0000008B, 0x0000008B, CPU_BIOS, },
24282 -- { 0x0000009B, 0x0000009B, CPU_MONITOR, },
24283 -- { 0x000000C1, 0x000000C4, CPU_PMC, },
24284 -- { 0x000000CD, 0x000000CD, CPU_FREQ, },
24285 -- { 0x000000E7, 0x000000E8, CPU_PERF, },
24286 -- { 0x000000FE, 0x000000FE, CPU_MTRR, },
24287 --
24288 -- { 0x00000116, 0x0000011E, CPU_CACHE, },
24289 -- { 0x00000174, 0x00000176, CPU_SYSENTER, },
24290 -- { 0x00000179, 0x0000017B, CPU_MC, },
24291 -- { 0x00000186, 0x00000189, CPU_PMC, },
24292 -- { 0x00000198, 0x00000199, CPU_PERF, },
24293 -- { 0x0000019A, 0x0000019A, CPU_TIME, },
24294 -- { 0x0000019B, 0x0000019D, CPU_THERM, },
24295 -- { 0x000001A0, 0x000001A0, CPU_MISC, },
24296 -- { 0x000001C9, 0x000001C9, CPU_LBRANCH, },
24297 -- { 0x000001D7, 0x000001D8, CPU_LBRANCH, },
24298 -- { 0x000001D9, 0x000001D9, CPU_DEBUG, },
24299 -- { 0x000001DA, 0x000001E0, CPU_LBRANCH, },
24300 --
24301 -- { 0x00000200, 0x0000020F, CPU_MTRR, },
24302 -- { 0x00000250, 0x00000250, CPU_MTRR, },
24303 -- { 0x00000258, 0x00000259, CPU_MTRR, },
24304 -- { 0x00000268, 0x0000026F, CPU_MTRR, },
24305 -- { 0x00000277, 0x00000277, CPU_PAT, },
24306 -- { 0x000002FF, 0x000002FF, CPU_MTRR, },
24307 --
24308 -- { 0x00000300, 0x00000311, CPU_PMC, },
24309 -- { 0x00000345, 0x00000345, CPU_PMC, },
24310 -- { 0x00000360, 0x00000371, CPU_PMC, },
24311 -- { 0x0000038D, 0x00000390, CPU_PMC, },
24312 -- { 0x000003A0, 0x000003BE, CPU_PMC, },
24313 -- { 0x000003C0, 0x000003CD, CPU_PMC, },
24314 -- { 0x000003E0, 0x000003E1, CPU_PMC, },
24315 -- { 0x000003F0, 0x000003F2, CPU_PMC, },
24316 --
24317 -- { 0x00000400, 0x00000417, CPU_MC, },
24318 -- { 0x00000480, 0x0000048B, CPU_VMX, },
24319 --
24320 -- { 0x00000600, 0x00000600, CPU_DEBUG, },
24321 -- { 0x00000680, 0x0000068F, CPU_LBRANCH, },
24322 -- { 0x000006C0, 0x000006CF, CPU_LBRANCH, },
24323 --
24324 -- { 0x000107CC, 0x000107D3, CPU_PMC, },
24325 --
24326 -- { 0xC0000080, 0xC0000080, CPU_FEATURES, },
24327 -- { 0xC0000081, 0xC0000084, CPU_CALL, },
24328 -- { 0xC0000100, 0xC0000102, CPU_BASE, },
24329 -- { 0xC0000103, 0xC0000103, CPU_TIME, },
24330 --
24331 -- { 0xC0010000, 0xC0010007, CPU_PMC, },
24332 -- { 0xC0010010, 0xC0010010, CPU_CONF, },
24333 -- { 0xC0010015, 0xC0010015, CPU_CONF, },
24334 -- { 0xC0010016, 0xC001001A, CPU_MTRR, },
24335 -- { 0xC001001D, 0xC001001D, CPU_MTRR, },
24336 -- { 0xC001001F, 0xC001001F, CPU_CONF, },
24337 -- { 0xC0010030, 0xC0010035, CPU_BIOS, },
24338 -- { 0xC0010044, 0xC0010048, CPU_MC, },
24339 -- { 0xC0010050, 0xC0010056, CPU_SMM, },
24340 -- { 0xC0010058, 0xC0010058, CPU_CONF, },
24341 -- { 0xC0010060, 0xC0010060, CPU_CACHE, },
24342 -- { 0xC0010061, 0xC0010068, CPU_SMM, },
24343 -- { 0xC0010069, 0xC001006B, CPU_SMM, },
24344 -- { 0xC0010070, 0xC0010071, CPU_SMM, },
24345 -- { 0xC0010111, 0xC0010113, CPU_SMM, },
24346 -- { 0xC0010114, 0xC0010118, CPU_SVM, },
24347 -- { 0xC0010140, 0xC0010141, CPU_OSVM, },
24348 -- { 0xC0011022, 0xC0011023, CPU_CONF, },
24349 --};
24350 --
24351 --static int is_typeflag_valid(unsigned cpu, unsigned flag)
24352 --{
24353 -- int i;
24354 --
24355 -- /* Standard Registers should be always valid */
24356 -- if (flag >= CPU_TSS)
24357 -- return 1;
24358 --
24359 -- for (i = 0; i < ARRAY_SIZE(cpu_reg_range); i++) {
24360 -- if (cpu_reg_range[i].flag == flag)
24361 -- return 1;
24362 -- }
24363 --
24364 -- /* Invalid */
24365 -- return 0;
24366 --}
24367 --
24368 --static unsigned get_cpu_range(unsigned cpu, unsigned *min, unsigned *max,
24369 -- int index, unsigned flag)
24370 --{
24371 -- if (cpu_reg_range[index].flag == flag) {
24372 -- *min = cpu_reg_range[index].min;
24373 -- *max = cpu_reg_range[index].max;
24374 -- } else
24375 -- *max = 0;
24376 --
24377 -- return *max;
24378 --}
24379 --
24380 --/* This function can also be called with seq = NULL for printk */
24381 --static void print_cpu_data(struct seq_file *seq, unsigned type,
24382 -- u32 low, u32 high)
24383 --{
24384 -- struct cpu_private *priv;
24385 -- u64 val = high;
24386 --
24387 -- if (seq) {
24388 -- priv = seq->private;
24389 -- if (priv->file) {
24390 -- val = (val << 32) | low;
24391 -- seq_printf(seq, "0x%llx\n", val);
24392 -- } else
24393 -- seq_printf(seq, " %08x: %08x_%08x\n",
24394 -- type, high, low);
24395 -- } else
24396 -- printk(KERN_INFO " %08x: %08x_%08x\n", type, high, low);
24397 --}
24398 --
24399 --/* This function can also be called with seq = NULL for printk */
24400 --static void print_msr(struct seq_file *seq, unsigned cpu, unsigned flag)
24401 --{
24402 -- unsigned msr, msr_min, msr_max;
24403 -- struct cpu_private *priv;
24404 -- u32 low, high;
24405 -- int i;
24406 --
24407 -- if (seq) {
24408 -- priv = seq->private;
24409 -- if (priv->file) {
24410 -- if (!rdmsr_safe_on_cpu(priv->cpu, priv->reg,
24411 -- &low, &high))
24412 -- print_cpu_data(seq, priv->reg, low, high);
24413 -- return;
24414 -- }
24415 -- }
24416 --
24417 -- for (i = 0; i < ARRAY_SIZE(cpu_reg_range); i++) {
24418 -- if (!get_cpu_range(cpu, &msr_min, &msr_max, i, flag))
24419 -- continue;
24420 --
24421 -- for (msr = msr_min; msr <= msr_max; msr++) {
24422 -- if (rdmsr_safe_on_cpu(cpu, msr, &low, &high))
24423 -- continue;
24424 -- print_cpu_data(seq, msr, low, high);
24425 -- }
24426 -- }
24427 --}
24428 --
24429 --static void print_tss(void *arg)
24430 --{
24431 -- struct pt_regs *regs = task_pt_regs(current);
24432 -- struct seq_file *seq = arg;
24433 -- unsigned int seg;
24434 --
24435 -- seq_printf(seq, " RAX\t: %016lx\n", regs->ax);
24436 -- seq_printf(seq, " RBX\t: %016lx\n", regs->bx);
24437 -- seq_printf(seq, " RCX\t: %016lx\n", regs->cx);
24438 -- seq_printf(seq, " RDX\t: %016lx\n", regs->dx);
24439 --
24440 -- seq_printf(seq, " RSI\t: %016lx\n", regs->si);
24441 -- seq_printf(seq, " RDI\t: %016lx\n", regs->di);
24442 -- seq_printf(seq, " RBP\t: %016lx\n", regs->bp);
24443 -- seq_printf(seq, " ESP\t: %016lx\n", regs->sp);
24444 --
24445 --#ifdef CONFIG_X86_64
24446 -- seq_printf(seq, " R08\t: %016lx\n", regs->r8);
24447 -- seq_printf(seq, " R09\t: %016lx\n", regs->r9);
24448 -- seq_printf(seq, " R10\t: %016lx\n", regs->r10);
24449 -- seq_printf(seq, " R11\t: %016lx\n", regs->r11);
24450 -- seq_printf(seq, " R12\t: %016lx\n", regs->r12);
24451 -- seq_printf(seq, " R13\t: %016lx\n", regs->r13);
24452 -- seq_printf(seq, " R14\t: %016lx\n", regs->r14);
24453 -- seq_printf(seq, " R15\t: %016lx\n", regs->r15);
24454 --#endif
24455 --
24456 -- asm("movl %%cs,%0" : "=r" (seg));
24457 -- seq_printf(seq, " CS\t: %04x\n", seg);
24458 -- asm("movl %%ds,%0" : "=r" (seg));
24459 -- seq_printf(seq, " DS\t: %04x\n", seg);
24460 -- seq_printf(seq, " SS\t: %04lx\n", regs->ss & 0xffff);
24461 -- asm("movl %%es,%0" : "=r" (seg));
24462 -- seq_printf(seq, " ES\t: %04x\n", seg);
24463 -- asm("movl %%fs,%0" : "=r" (seg));
24464 -- seq_printf(seq, " FS\t: %04x\n", seg);
24465 -- asm("movl %%gs,%0" : "=r" (seg));
24466 -- seq_printf(seq, " GS\t: %04x\n", seg);
24467 --
24468 -- seq_printf(seq, " EFLAGS\t: %016lx\n", regs->flags);
24469 --
24470 -- seq_printf(seq, " EIP\t: %016lx\n", regs->ip);
24471 --}
24472 --
24473 --static void print_cr(void *arg)
24474 --{
24475 -- struct seq_file *seq = arg;
24476 --
24477 -- seq_printf(seq, " cr0\t: %016lx\n", read_cr0());
24478 -- seq_printf(seq, " cr2\t: %016lx\n", read_cr2());
24479 -- seq_printf(seq, " cr3\t: %016lx\n", read_cr3());
24480 -- seq_printf(seq, " cr4\t: %016lx\n", read_cr4_safe());
24481 --#ifdef CONFIG_X86_64
24482 -- seq_printf(seq, " cr8\t: %016lx\n", read_cr8());
24483 --#endif
24484 --}
24485 --
24486 --static void print_desc_ptr(char *str, struct seq_file *seq, struct desc_ptr dt)
24487 --{
24488 -- seq_printf(seq, " %s\t: %016llx\n", str, (u64)(dt.address | dt.size));
24489 --}
24490 --
24491 --static void print_dt(void *seq)
24492 --{
24493 -- struct desc_ptr dt;
24494 -- unsigned long ldt;
24495 --
24496 -- /* IDT */
24497 -- store_idt((struct desc_ptr *)&dt);
24498 -- print_desc_ptr("IDT", seq, dt);
24499 --
24500 -- /* GDT */
24501 -- store_gdt((struct desc_ptr *)&dt);
24502 -- print_desc_ptr("GDT", seq, dt);
24503 --
24504 -- /* LDT */
24505 -- store_ldt(ldt);
24506 -- seq_printf(seq, " LDT\t: %016lx\n", ldt);
24507 --
24508 -- /* TR */
24509 -- store_tr(ldt);
24510 -- seq_printf(seq, " TR\t: %016lx\n", ldt);
24511 --}
24512 --
24513 --static void print_dr(void *arg)
24514 --{
24515 -- struct seq_file *seq = arg;
24516 -- unsigned long dr;
24517 -- int i;
24518 --
24519 -- for (i = 0; i < 8; i++) {
24520 -- /* Ignore db4, db5 */
24521 -- if ((i == 4) || (i == 5))
24522 -- continue;
24523 -- get_debugreg(dr, i);
24524 -- seq_printf(seq, " dr%d\t: %016lx\n", i, dr);
24525 -- }
24526 --
24527 -- seq_printf(seq, "\n MSR\t:\n");
24528 --}
24529 --
24530 --static void print_apic(void *arg)
24531 --{
24532 -- struct seq_file *seq = arg;
24533 --
24534 --#ifdef CONFIG_X86_LOCAL_APIC
24535 -- seq_printf(seq, " LAPIC\t:\n");
24536 -- seq_printf(seq, " ID\t\t: %08x\n", apic_read(APIC_ID) >> 24);
24537 -- seq_printf(seq, " LVR\t\t: %08x\n", apic_read(APIC_LVR));
24538 -- seq_printf(seq, " TASKPRI\t: %08x\n", apic_read(APIC_TASKPRI));
24539 -- seq_printf(seq, " ARBPRI\t\t: %08x\n", apic_read(APIC_ARBPRI));
24540 -- seq_printf(seq, " PROCPRI\t: %08x\n", apic_read(APIC_PROCPRI));
24541 -- seq_printf(seq, " LDR\t\t: %08x\n", apic_read(APIC_LDR));
24542 -- seq_printf(seq, " DFR\t\t: %08x\n", apic_read(APIC_DFR));
24543 -- seq_printf(seq, " SPIV\t\t: %08x\n", apic_read(APIC_SPIV));
24544 -- seq_printf(seq, " ISR\t\t: %08x\n", apic_read(APIC_ISR));
24545 -- seq_printf(seq, " ESR\t\t: %08x\n", apic_read(APIC_ESR));
24546 -- seq_printf(seq, " ICR\t\t: %08x\n", apic_read(APIC_ICR));
24547 -- seq_printf(seq, " ICR2\t\t: %08x\n", apic_read(APIC_ICR2));
24548 -- seq_printf(seq, " LVTT\t\t: %08x\n", apic_read(APIC_LVTT));
24549 -- seq_printf(seq, " LVTTHMR\t: %08x\n", apic_read(APIC_LVTTHMR));
24550 -- seq_printf(seq, " LVTPC\t\t: %08x\n", apic_read(APIC_LVTPC));
24551 -- seq_printf(seq, " LVT0\t\t: %08x\n", apic_read(APIC_LVT0));
24552 -- seq_printf(seq, " LVT1\t\t: %08x\n", apic_read(APIC_LVT1));
24553 -- seq_printf(seq, " LVTERR\t\t: %08x\n", apic_read(APIC_LVTERR));
24554 -- seq_printf(seq, " TMICT\t\t: %08x\n", apic_read(APIC_TMICT));
24555 -- seq_printf(seq, " TMCCT\t\t: %08x\n", apic_read(APIC_TMCCT));
24556 -- seq_printf(seq, " TDCR\t\t: %08x\n", apic_read(APIC_TDCR));
24557 -- if (boot_cpu_has(X86_FEATURE_EXTAPIC)) {
24558 -- unsigned int i, v, maxeilvt;
24559 --
24560 -- v = apic_read(APIC_EFEAT);
24561 -- maxeilvt = (v >> 16) & 0xff;
24562 -- seq_printf(seq, " EFEAT\t\t: %08x\n", v);
24563 -- seq_printf(seq, " ECTRL\t\t: %08x\n", apic_read(APIC_ECTRL));
24564 --
24565 -- for (i = 0; i < maxeilvt; i++) {
24566 -- v = apic_read(APIC_EILVTn(i));
24567 -- seq_printf(seq, " EILVT%d\t\t: %08x\n", i, v);
24568 -- }
24569 -- }
24570 --#endif /* CONFIG_X86_LOCAL_APIC */
24571 -- seq_printf(seq, "\n MSR\t:\n");
24572 --}
24573 --
24574 --static int cpu_seq_show(struct seq_file *seq, void *v)
24575 --{
24576 -- struct cpu_private *priv = seq->private;
24577 --
24578 -- if (priv == NULL)
24579 -- return -EINVAL;
24580 --
24581 -- switch (cpu_base[priv->type].flag) {
24582 -- case CPU_TSS:
24583 -- smp_call_function_single(priv->cpu, print_tss, seq, 1);
24584 -- break;
24585 -- case CPU_CR:
24586 -- smp_call_function_single(priv->cpu, print_cr, seq, 1);
24587 -- break;
24588 -- case CPU_DT:
24589 -- smp_call_function_single(priv->cpu, print_dt, seq, 1);
24590 -- break;
24591 -- case CPU_DEBUG:
24592 -- if (priv->file == CPU_INDEX_BIT)
24593 -- smp_call_function_single(priv->cpu, print_dr, seq, 1);
24594 -- print_msr(seq, priv->cpu, cpu_base[priv->type].flag);
24595 -- break;
24596 -- case CPU_APIC:
24597 -- if (priv->file == CPU_INDEX_BIT)
24598 -- smp_call_function_single(priv->cpu, print_apic, seq, 1);
24599 -- print_msr(seq, priv->cpu, cpu_base[priv->type].flag);
24600 -- break;
24601 --
24602 -- default:
24603 -- print_msr(seq, priv->cpu, cpu_base[priv->type].flag);
24604 -- break;
24605 -- }
24606 -- seq_printf(seq, "\n");
24607 --
24608 -- return 0;
24609 --}
24610 --
24611 --static void *cpu_seq_start(struct seq_file *seq, loff_t *pos)
24612 --{
24613 -- if (*pos == 0) /* One time is enough ;-) */
24614 -- return seq;
24615 --
24616 -- return NULL;
24617 --}
24618 --
24619 --static void *cpu_seq_next(struct seq_file *seq, void *v, loff_t *pos)
24620 --{
24621 -- (*pos)++;
24622 --
24623 -- return cpu_seq_start(seq, pos);
24624 --}
24625 --
24626 --static void cpu_seq_stop(struct seq_file *seq, void *v)
24627 --{
24628 --}
24629 --
24630 --static const struct seq_operations cpu_seq_ops = {
24631 -- .start = cpu_seq_start,
24632 -- .next = cpu_seq_next,
24633 -- .stop = cpu_seq_stop,
24634 -- .show = cpu_seq_show,
24635 --};
24636 --
24637 --static int cpu_seq_open(struct inode *inode, struct file *file)
24638 --{
24639 -- struct cpu_private *priv = inode->i_private;
24640 -- struct seq_file *seq;
24641 -- int err;
24642 --
24643 -- err = seq_open(file, &cpu_seq_ops);
24644 -- if (!err) {
24645 -- seq = file->private_data;
24646 -- seq->private = priv;
24647 -- }
24648 --
24649 -- return err;
24650 --}
24651 --
24652 --static int write_msr(struct cpu_private *priv, u64 val)
24653 --{
24654 -- u32 low, high;
24655 --
24656 -- high = (val >> 32) & 0xffffffff;
24657 -- low = val & 0xffffffff;
24658 --
24659 -- if (!wrmsr_safe_on_cpu(priv->cpu, priv->reg, low, high))
24660 -- return 0;
24661 --
24662 -- return -EPERM;
24663 --}
24664 --
24665 --static int write_cpu_register(struct cpu_private *priv, const char *buf)
24666 --{
24667 -- int ret = -EPERM;
24668 -- u64 val;
24669 --
24670 -- ret = strict_strtoull(buf, 0, &val);
24671 -- if (ret < 0)
24672 -- return ret;
24673 --
24674 -- /* Supporting only MSRs */
24675 -- if (priv->type < CPU_TSS_BIT)
24676 -- return write_msr(priv, val);
24677 --
24678 -- return ret;
24679 --}
24680 --
24681 --static ssize_t cpu_write(struct file *file, const char __user *ubuf,
24682 -- size_t count, loff_t *off)
24683 --{
24684 -- struct seq_file *seq = file->private_data;
24685 -- struct cpu_private *priv = seq->private;
24686 -- char buf[19];
24687 --
24688 -- if ((priv == NULL) || (count >= sizeof(buf)))
24689 -- return -EINVAL;
24690 --
24691 -- if (copy_from_user(&buf, ubuf, count))
24692 -- return -EFAULT;
24693 --
24694 -- buf[count] = 0;
24695 --
24696 -- if ((cpu_base[priv->type].write) && (cpu_file[priv->file].write))
24697 -- if (!write_cpu_register(priv, buf))
24698 -- return count;
24699 --
24700 -- return -EACCES;
24701 --}
24702 --
24703 --static const struct file_operations cpu_fops = {
24704 -- .owner = THIS_MODULE,
24705 -- .open = cpu_seq_open,
24706 -- .read = seq_read,
24707 -- .write = cpu_write,
24708 -- .llseek = seq_lseek,
24709 -- .release = seq_release,
24710 --};
24711 --
24712 --static int cpu_create_file(unsigned cpu, unsigned type, unsigned reg,
24713 -- unsigned file, struct dentry *dentry)
24714 --{
24715 -- struct cpu_private *priv = NULL;
24716 --
24717 -- /* Already intialized */
24718 -- if (file == CPU_INDEX_BIT)
24719 -- if (per_cpu(cpu_arr[type].init, cpu))
24720 -- return 0;
24721 --
24722 -- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
24723 -- if (priv == NULL)
24724 -- return -ENOMEM;
24725 --
24726 -- priv->cpu = cpu;
24727 -- priv->type = type;
24728 -- priv->reg = reg;
24729 -- priv->file = file;
24730 -- mutex_lock(&cpu_debug_lock);
24731 -- per_cpu(priv_arr[type], cpu) = priv;
24732 -- per_cpu(cpu_priv_count, cpu)++;
24733 -- mutex_unlock(&cpu_debug_lock);
24734 --
24735 -- if (file)
24736 -- debugfs_create_file(cpu_file[file].name, S_IRUGO,
24737 -- dentry, (void *)priv, &cpu_fops);
24738 -- else {
24739 -- debugfs_create_file(cpu_base[type].name, S_IRUGO,
24740 -- per_cpu(cpu_arr[type].dentry, cpu),
24741 -- (void *)priv, &cpu_fops);
24742 -- mutex_lock(&cpu_debug_lock);
24743 -- per_cpu(cpu_arr[type].init, cpu) = 1;
24744 -- mutex_unlock(&cpu_debug_lock);
24745 -- }
24746 --
24747 -- return 0;
24748 --}
24749 --
24750 --static int cpu_init_regfiles(unsigned cpu, unsigned int type, unsigned reg,
24751 -- struct dentry *dentry)
24752 --{
24753 -- unsigned file;
24754 -- int err = 0;
24755 --
24756 -- for (file = 0; file < ARRAY_SIZE(cpu_file); file++) {
24757 -- err = cpu_create_file(cpu, type, reg, file, dentry);
24758 -- if (err)
24759 -- return err;
24760 -- }
24761 --
24762 -- return err;
24763 --}
24764 --
24765 --static int cpu_init_msr(unsigned cpu, unsigned type, struct dentry *dentry)
24766 --{
24767 -- struct dentry *cpu_dentry = NULL;
24768 -- unsigned reg, reg_min, reg_max;
24769 -- int i, err = 0;
24770 -- char reg_dir[12];
24771 -- u32 low, high;
24772 --
24773 -- for (i = 0; i < ARRAY_SIZE(cpu_reg_range); i++) {
24774 -- if (!get_cpu_range(cpu, &reg_min, &reg_max, i,
24775 -- cpu_base[type].flag))
24776 -- continue;
24777 --
24778 -- for (reg = reg_min; reg <= reg_max; reg++) {
24779 -- if (rdmsr_safe_on_cpu(cpu, reg, &low, &high))
24780 -- continue;
24781 --
24782 -- sprintf(reg_dir, "0x%x", reg);
24783 -- cpu_dentry = debugfs_create_dir(reg_dir, dentry);
24784 -- err = cpu_init_regfiles(cpu, type, reg, cpu_dentry);
24785 -- if (err)
24786 -- return err;
24787 -- }
24788 -- }
24789 --
24790 -- return err;
24791 --}
24792 --
24793 --static int cpu_init_allreg(unsigned cpu, struct dentry *dentry)
24794 --{
24795 -- struct dentry *cpu_dentry = NULL;
24796 -- unsigned type;
24797 -- int err = 0;
24798 --
24799 -- for (type = 0; type < ARRAY_SIZE(cpu_base) - 1; type++) {
24800 -- if (!is_typeflag_valid(cpu, cpu_base[type].flag))
24801 -- continue;
24802 -- cpu_dentry = debugfs_create_dir(cpu_base[type].name, dentry);
24803 -- per_cpu(cpu_arr[type].dentry, cpu) = cpu_dentry;
24804 --
24805 -- if (type < CPU_TSS_BIT)
24806 -- err = cpu_init_msr(cpu, type, cpu_dentry);
24807 -- else
24808 -- err = cpu_create_file(cpu, type, 0, CPU_INDEX_BIT,
24809 -- cpu_dentry);
24810 -- if (err)
24811 -- return err;
24812 -- }
24813 --
24814 -- return err;
24815 --}
24816 --
24817 --static int cpu_init_cpu(void)
24818 --{
24819 -- struct dentry *cpu_dentry = NULL;
24820 -- struct cpuinfo_x86 *cpui;
24821 -- char cpu_dir[12];
24822 -- unsigned cpu;
24823 -- int err = 0;
24824 --
24825 -- for (cpu = 0; cpu < nr_cpu_ids; cpu++) {
24826 -- cpui = &cpu_data(cpu);
24827 -- if (!cpu_has(cpui, X86_FEATURE_MSR))
24828 -- continue;
24829 --
24830 -- sprintf(cpu_dir, "cpu%d", cpu);
24831 -- cpu_dentry = debugfs_create_dir(cpu_dir, cpu_debugfs_dir);
24832 -- err = cpu_init_allreg(cpu, cpu_dentry);
24833 --
24834 -- pr_info("cpu%d(%d) debug files %d\n",
24835 -- cpu, nr_cpu_ids, per_cpu(cpu_priv_count, cpu));
24836 -- if (per_cpu(cpu_priv_count, cpu) > MAX_CPU_FILES) {
24837 -- pr_err("Register files count %d exceeds limit %d\n",
24838 -- per_cpu(cpu_priv_count, cpu), MAX_CPU_FILES);
24839 -- per_cpu(cpu_priv_count, cpu) = MAX_CPU_FILES;
24840 -- err = -ENFILE;
24841 -- }
24842 -- if (err)
24843 -- return err;
24844 -- }
24845 --
24846 -- return err;
24847 --}
24848 --
24849 --static int __init cpu_debug_init(void)
24850 --{
24851 -- cpu_debugfs_dir = debugfs_create_dir("cpu", arch_debugfs_dir);
24852 --
24853 -- return cpu_init_cpu();
24854 --}
24855 --
24856 --static void __exit cpu_debug_exit(void)
24857 --{
24858 -- int i, cpu;
24859 --
24860 -- if (cpu_debugfs_dir)
24861 -- debugfs_remove_recursive(cpu_debugfs_dir);
24862 --
24863 -- for (cpu = 0; cpu < nr_cpu_ids; cpu++)
24864 -- for (i = 0; i < per_cpu(cpu_priv_count, cpu); i++)
24865 -- kfree(per_cpu(priv_arr[i], cpu));
24866 --}
24867 --
24868 --module_init(cpu_debug_init);
24869 --module_exit(cpu_debug_exit);
24870 --
24871 --MODULE_AUTHOR("Jaswinder Singh Rajput");
24872 --MODULE_DESCRIPTION("CPU Debug module");
24873 --MODULE_LICENSE("GPL");
24874 -diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
24875 -index dedc2bd..5877873 100644
24876 ---- a/arch/x86/kernel/hpet.c
24877 -+++ b/arch/x86/kernel/hpet.c
24878 -@@ -33,6 +33,8 @@
24879 - * HPET address is set in acpi/boot.c, when an ACPI entry exists
24880 - */
24881 - unsigned long hpet_address;
24882 -+u8 hpet_msi_disable;
24883 -+
24884 - #ifdef CONFIG_PCI_MSI
24885 - static unsigned long hpet_num_timers;
24886 - #endif
24887 -@@ -584,6 +586,9 @@ static void hpet_msi_capability_lookup(unsigned int start_timer)
24888 - unsigned int num_timers_used = 0;
24889 - int i;
24890 -
24891 -+ if (hpet_msi_disable)
24892 -+ return;
24893 -+
24894 - id = hpet_readl(HPET_ID);
24895 -
24896 - num_timers = ((id & HPET_ID_NUMBER) >> HPET_ID_NUMBER_SHIFT);
24897 -@@ -911,6 +916,9 @@ static __init int hpet_late_init(void)
24898 - hpet_reserve_platform_timers(hpet_readl(HPET_ID));
24899 - hpet_print_config();
24900 -
24901 -+ if (hpet_msi_disable)
24902 -+ return 0;
24903 -+
24904 - for_each_online_cpu(cpu) {
24905 - hpet_cpuhp_notify(NULL, CPU_ONLINE, (void *)(long)cpu);
24906 - }
24907 -diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
24908 -index 5284cd2..f010ab4 100644
24909 ---- a/arch/x86/kernel/process.c
24910 -+++ b/arch/x86/kernel/process.c
24911 -@@ -91,18 +91,6 @@ void flush_thread(void)
24912 - {
24913 - struct task_struct *tsk = current;
24914 -
24915 --#ifdef CONFIG_X86_64
24916 -- if (test_tsk_thread_flag(tsk, TIF_ABI_PENDING)) {
24917 -- clear_tsk_thread_flag(tsk, TIF_ABI_PENDING);
24918 -- if (test_tsk_thread_flag(tsk, TIF_IA32)) {
24919 -- clear_tsk_thread_flag(tsk, TIF_IA32);
24920 -- } else {
24921 -- set_tsk_thread_flag(tsk, TIF_IA32);
24922 -- current_thread_info()->status |= TS_COMPAT;
24923 -- }
24924 -- }
24925 --#endif
24926 --
24927 - clear_tsk_thread_flag(tsk, TIF_DEBUG);
24928 -
24929 - tsk->thread.debugreg0 = 0;
24930 -diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
24931 -index eb62cbc..f9ce04f 100644
24932 ---- a/arch/x86/kernel/process_64.c
24933 -+++ b/arch/x86/kernel/process_64.c
24934 -@@ -540,6 +540,17 @@ sys_clone(unsigned long clone_flags, unsigned long newsp,
24935 - return do_fork(clone_flags, newsp, regs, 0, parent_tid, child_tid);
24936 - }
24937 -
24938 -+void set_personality_ia32(void)
24939 -+{
24940 -+ /* inherit personality from parent */
24941 -+
24942 -+ /* Make sure to be in 32bit mode */
24943 -+ set_thread_flag(TIF_IA32);
24944 -+
24945 -+ /* Prepare the first "return" to user space */
24946 -+ current_thread_info()->status |= TS_COMPAT;
24947 -+}
24948 -+
24949 - unsigned long get_wchan(struct task_struct *p)
24950 - {
24951 - unsigned long stack;
24952 -diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c
24953 -index 6c3b2c6..0040164 100644
24954 ---- a/arch/x86/kernel/quirks.c
24955 -+++ b/arch/x86/kernel/quirks.c
24956 -@@ -491,6 +491,19 @@ void force_hpet_resume(void)
24957 - break;
24958 - }
24959 - }
24960 -+
24961 -+/*
24962 -+ * HPET MSI on some boards (ATI SB700/SB800) has side effect on
24963 -+ * floppy DMA. Disable HPET MSI on such platforms.
24964 -+ */
24965 -+static void force_disable_hpet_msi(struct pci_dev *unused)
24966 -+{
24967 -+ hpet_msi_disable = 1;
24968 -+}
24969 -+
24970 -+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS,
24971 -+ force_disable_hpet_msi);
24972 -+
24973 - #endif
24974 -
24975 - #if defined(CONFIG_PCI) && defined(CONFIG_NUMA)
24976 -diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
24977 -index 6caf260..bff34d6 100644
24978 ---- a/arch/x86/kernel/reboot.c
24979 -+++ b/arch/x86/kernel/reboot.c
24980 -@@ -203,6 +203,15 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
24981 - DMI_MATCH(DMI_BOARD_NAME, "0T656F"),
24982 - },
24983 - },
24984 -+ { /* Handle problems with rebooting on Dell OptiPlex 760 with 0G919G*/
24985 -+ .callback = set_bios_reboot,
24986 -+ .ident = "Dell OptiPlex 760",
24987 -+ .matches = {
24988 -+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
24989 -+ DMI_MATCH(DMI_PRODUCT_NAME, "OptiPlex 760"),
24990 -+ DMI_MATCH(DMI_BOARD_NAME, "0G919G"),
24991 -+ },
24992 -+ },
24993 - { /* Handle problems with rebooting on Dell 2400's */
24994 - .callback = set_bios_reboot,
24995 - .ident = "Dell PowerEdge 2400",
24996 -diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
24997 -index 51aa5b2..8425f7e 100644
24998 ---- a/arch/x86/kernel/setup.c
24999 -+++ b/arch/x86/kernel/setup.c
25000 -@@ -667,19 +667,27 @@ static struct dmi_system_id __initdata bad_bios_dmi_table[] = {
25001 - DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix/MSC"),
25002 - },
25003 - },
25004 -- {
25005 - /*
25006 -- * AMI BIOS with low memory corruption was found on Intel DG45ID board.
25007 -- * It hase different DMI_BIOS_VENDOR = "Intel Corp.", for now we will
25008 -+ * AMI BIOS with low memory corruption was found on Intel DG45ID and
25009 -+ * DG45FC boards.
25010 -+ * It has a different DMI_BIOS_VENDOR = "Intel Corp.", for now we will
25011 - * match only DMI_BOARD_NAME and see if there is more bad products
25012 - * with this vendor.
25013 - */
25014 -+ {
25015 - .callback = dmi_low_memory_corruption,
25016 - .ident = "AMI BIOS",
25017 - .matches = {
25018 - DMI_MATCH(DMI_BOARD_NAME, "DG45ID"),
25019 - },
25020 - },
25021 -+ {
25022 -+ .callback = dmi_low_memory_corruption,
25023 -+ .ident = "AMI BIOS",
25024 -+ .matches = {
25025 -+ DMI_MATCH(DMI_BOARD_NAME, "DG45FC"),
25026 -+ },
25027 -+ },
25028 - #endif
25029 - {}
25030 - };
25031 -diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
25032 -index 6378e07..145741c 100644
25033 ---- a/arch/x86/kvm/x86.c
25034 -+++ b/arch/x86/kvm/x86.c
25035 -@@ -680,7 +680,8 @@ static void kvm_write_guest_time(struct kvm_vcpu *v)
25036 - /* With all the info we got, fill in the values */
25037 -
25038 - vcpu->hv_clock.system_time = ts.tv_nsec +
25039 -- (NSEC_PER_SEC * (u64)ts.tv_sec);
25040 -+ (NSEC_PER_SEC * (u64)ts.tv_sec) + v->kvm->arch.kvmclock_offset;
25041 -+
25042 - /*
25043 - * The interface expects us to write an even number signaling that the
25044 - * update is finished. Since the guest won't see the intermediate
25045 -@@ -1227,6 +1228,7 @@ int kvm_dev_ioctl_check_extension(long ext)
25046 - case KVM_CAP_PIT2:
25047 - case KVM_CAP_PIT_STATE2:
25048 - case KVM_CAP_SET_IDENTITY_MAP_ADDR:
25049 -+ case KVM_CAP_ADJUST_CLOCK:
25050 - r = 1;
25051 - break;
25052 - case KVM_CAP_COALESCED_MMIO:
25053 -@@ -2424,6 +2426,44 @@ long kvm_arch_vm_ioctl(struct file *filp,
25054 - r = 0;
25055 - break;
25056 - }
25057 -+ case KVM_SET_CLOCK: {
25058 -+ struct timespec now;
25059 -+ struct kvm_clock_data user_ns;
25060 -+ u64 now_ns;
25061 -+ s64 delta;
25062 -+
25063 -+ r = -EFAULT;
25064 -+ if (copy_from_user(&user_ns, argp, sizeof(user_ns)))
25065 -+ goto out;
25066 -+
25067 -+ r = -EINVAL;
25068 -+ if (user_ns.flags)
25069 -+ goto out;
25070 -+
25071 -+ r = 0;
25072 -+ ktime_get_ts(&now);
25073 -+ now_ns = timespec_to_ns(&now);
25074 -+ delta = user_ns.clock - now_ns;
25075 -+ kvm->arch.kvmclock_offset = delta;
25076 -+ break;
25077 -+ }
25078 -+ case KVM_GET_CLOCK: {
25079 -+ struct timespec now;
25080 -+ struct kvm_clock_data user_ns;
25081 -+ u64 now_ns;
25082 -+
25083 -+ ktime_get_ts(&now);
25084 -+ now_ns = timespec_to_ns(&now);
25085 -+ user_ns.clock = kvm->arch.kvmclock_offset + now_ns;
25086 -+ user_ns.flags = 0;
25087 -+
25088 -+ r = -EFAULT;
25089 -+ if (copy_to_user(argp, &user_ns, sizeof(user_ns)))
25090 -+ goto out;
25091 -+ r = 0;
25092 -+ break;
25093 -+ }
25094 -+
25095 - default:
25096 - ;
25097 - }
25098 -diff --git a/arch/x86/mm/srat_64.c b/arch/x86/mm/srat_64.c
25099 -index dbb5381..3871c60 100644
25100 ---- a/arch/x86/mm/srat_64.c
25101 -+++ b/arch/x86/mm/srat_64.c
25102 -@@ -229,9 +229,11 @@ update_nodes_add(int node, unsigned long start, unsigned long end)
25103 - printk(KERN_ERR "SRAT: Hotplug zone not continuous. Partly ignored\n");
25104 - }
25105 -
25106 -- if (changed)
25107 -+ if (changed) {
25108 -+ node_set(node, cpu_nodes_parsed);
25109 - printk(KERN_INFO "SRAT: hot plug zone found %Lx - %Lx\n",
25110 - nd->start, nd->end);
25111 -+ }
25112 - }
25113 -
25114 - /* Callback for parsing of the Proximity Domain <-> Memory Area mappings */
25115 -diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
25116 -index cb88b1a..3347f69 100644
25117 ---- a/arch/x86/oprofile/nmi_int.c
25118 -+++ b/arch/x86/oprofile/nmi_int.c
25119 -@@ -222,7 +222,7 @@ static void nmi_cpu_switch(void *dummy)
25120 -
25121 - /* move to next set */
25122 - si += model->num_counters;
25123 -- if ((si > model->num_virt_counters) || (counter_config[si].count == 0))
25124 -+ if ((si >= model->num_virt_counters) || (counter_config[si].count == 0))
25125 - per_cpu(switch_index, cpu) = 0;
25126 - else
25127 - per_cpu(switch_index, cpu) = si;
25128 -@@ -598,6 +598,7 @@ static int __init ppro_init(char **cpu_type)
25129 - case 15: case 23:
25130 - *cpu_type = "i386/core_2";
25131 - break;
25132 -+ case 0x2e:
25133 - case 26:
25134 - spec = &op_arch_perfmon_spec;
25135 - *cpu_type = "i386/core_i7";
25136 -diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
25137 -index 7411915..49f6ede 100644
25138 ---- a/drivers/acpi/bus.c
25139 -+++ b/drivers/acpi/bus.c
25140 -@@ -344,6 +344,167 @@ bool acpi_bus_can_wakeup(acpi_handle handle)
25141 -
25142 - EXPORT_SYMBOL(acpi_bus_can_wakeup);
25143 -
25144 -+static void acpi_print_osc_error(acpi_handle handle,
25145 -+ struct acpi_osc_context *context, char *error)
25146 -+{
25147 -+ struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER};
25148 -+ int i;
25149 -+
25150 -+ if (ACPI_FAILURE(acpi_get_name(handle, ACPI_FULL_PATHNAME, &buffer)))
25151 -+ printk(KERN_DEBUG "%s\n", error);
25152 -+ else {
25153 -+ printk(KERN_DEBUG "%s:%s\n", (char *)buffer.pointer, error);
25154 -+ kfree(buffer.pointer);
25155 -+ }
25156 -+ printk(KERN_DEBUG"_OSC request data:");
25157 -+ for (i = 0; i < context->cap.length; i += sizeof(u32))
25158 -+ printk("%x ", *((u32 *)(context->cap.pointer + i)));
25159 -+ printk("\n");
25160 -+}
25161 -+
25162 -+static u8 hex_val(unsigned char c)
25163 -+{
25164 -+ return isdigit(c) ? c - '0' : toupper(c) - 'A' + 10;
25165 -+}
25166 -+
25167 -+static acpi_status acpi_str_to_uuid(char *str, u8 *uuid)
25168 -+{
25169 -+ int i;
25170 -+ static int opc_map_to_uuid[16] = {6, 4, 2, 0, 11, 9, 16, 14, 19, 21,
25171 -+ 24, 26, 28, 30, 32, 34};
25172 -+
25173 -+ if (strlen(str) != 36)
25174 -+ return AE_BAD_PARAMETER;
25175 -+ for (i = 0; i < 36; i++) {
25176 -+ if (i == 8 || i == 13 || i == 18 || i == 23) {
25177 -+ if (str[i] != '-')
25178 -+ return AE_BAD_PARAMETER;
25179 -+ } else if (!isxdigit(str[i]))
25180 -+ return AE_BAD_PARAMETER;
25181 -+ }
25182 -+ for (i = 0; i < 16; i++) {
25183 -+ uuid[i] = hex_val(str[opc_map_to_uuid[i]]) << 4;
25184 -+ uuid[i] |= hex_val(str[opc_map_to_uuid[i] + 1]);
25185 -+ }
25186 -+ return AE_OK;
25187 -+}
25188 -+
25189 -+acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context)
25190 -+{
25191 -+ acpi_status status;
25192 -+ struct acpi_object_list input;
25193 -+ union acpi_object in_params[4];
25194 -+ union acpi_object *out_obj;
25195 -+ u8 uuid[16];
25196 -+ u32 errors;
25197 -+ struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};
25198 -+
25199 -+ if (!context)
25200 -+ return AE_ERROR;
25201 -+ if (ACPI_FAILURE(acpi_str_to_uuid(context->uuid_str, uuid)))
25202 -+ return AE_ERROR;
25203 -+ context->ret.length = ACPI_ALLOCATE_BUFFER;
25204 -+ context->ret.pointer = NULL;
25205 -+
25206 -+ /* Setting up input parameters */
25207 -+ input.count = 4;
25208 -+ input.pointer = in_params;
25209 -+ in_params[0].type = ACPI_TYPE_BUFFER;
25210 -+ in_params[0].buffer.length = 16;
25211 -+ in_params[0].buffer.pointer = uuid;
25212 -+ in_params[1].type = ACPI_TYPE_INTEGER;
25213 -+ in_params[1].integer.value = context->rev;
25214 -+ in_params[2].type = ACPI_TYPE_INTEGER;
25215 -+ in_params[2].integer.value = context->cap.length/sizeof(u32);
25216 -+ in_params[3].type = ACPI_TYPE_BUFFER;
25217 -+ in_params[3].buffer.length = context->cap.length;
25218 -+ in_params[3].buffer.pointer = context->cap.pointer;
25219 -+
25220 -+ status = acpi_evaluate_object(handle, "_OSC", &input, &output);
25221 -+ if (ACPI_FAILURE(status))
25222 -+ return status;
25223 -+
25224 -+ if (!output.length)
25225 -+ return AE_NULL_OBJECT;
25226 -+
25227 -+ out_obj = output.pointer;
25228 -+ if (out_obj->type != ACPI_TYPE_BUFFER
25229 -+ || out_obj->buffer.length != context->cap.length) {
25230 -+ acpi_print_osc_error(handle, context,
25231 -+ "_OSC evaluation returned wrong type");
25232 -+ status = AE_TYPE;
25233 -+ goto out_kfree;
25234 -+ }
25235 -+ /* Need to ignore the bit0 in result code */
25236 -+ errors = *((u32 *)out_obj->buffer.pointer) & ~(1 << 0);
25237 -+ if (errors) {
25238 -+ if (errors & OSC_REQUEST_ERROR)
25239 -+ acpi_print_osc_error(handle, context,
25240 -+ "_OSC request failed");
25241 -+ if (errors & OSC_INVALID_UUID_ERROR)
25242 -+ acpi_print_osc_error(handle, context,
25243 -+ "_OSC invalid UUID");
25244 -+ if (errors & OSC_INVALID_REVISION_ERROR)
25245 -+ acpi_print_osc_error(handle, context,
25246 -+ "_OSC invalid revision");
25247 -+ if (errors & OSC_CAPABILITIES_MASK_ERROR) {
25248 -+ if (((u32 *)context->cap.pointer)[OSC_QUERY_TYPE]
25249 -+ & OSC_QUERY_ENABLE)
25250 -+ goto out_success;
25251 -+ status = AE_SUPPORT;
25252 -+ goto out_kfree;
25253 -+ }
25254 -+ status = AE_ERROR;
25255 -+ goto out_kfree;
25256 -+ }
25257 -+out_success:
25258 -+ context->ret.length = out_obj->buffer.length;
25259 -+ context->ret.pointer = kmalloc(context->ret.length, GFP_KERNEL);
25260 -+ if (!context->ret.pointer) {
25261 -+ status = AE_NO_MEMORY;
25262 -+ goto out_kfree;
25263 -+ }
25264 -+ memcpy(context->ret.pointer, out_obj->buffer.pointer,
25265 -+ context->ret.length);
25266 -+ status = AE_OK;
25267 -+
25268 -+out_kfree:
25269 -+ kfree(output.pointer);
25270 -+ if (status != AE_OK)
25271 -+ context->ret.pointer = NULL;
25272 -+ return status;
25273 -+}
25274 -+EXPORT_SYMBOL(acpi_run_osc);
25275 -+
25276 -+static u8 sb_uuid_str[] = "0811B06E-4A27-44F9-8D60-3CBBC22E7B48";
25277 -+static void acpi_bus_osc_support(void)
25278 -+{
25279 -+ u32 capbuf[2];
25280 -+ struct acpi_osc_context context = {
25281 -+ .uuid_str = sb_uuid_str,
25282 -+ .rev = 1,
25283 -+ .cap.length = 8,
25284 -+ .cap.pointer = capbuf,
25285 -+ };
25286 -+ acpi_handle handle;
25287 -+
25288 -+ capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE;
25289 -+ capbuf[OSC_SUPPORT_TYPE] = OSC_SB_PR3_SUPPORT; /* _PR3 is in use */
25290 -+#if defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR) ||\
25291 -+ defined(CONFIG_ACPI_PROCESSOR_AGGREGATOR_MODULE)
25292 -+ capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_PAD_SUPPORT;
25293 -+#endif
25294 -+
25295 -+#if defined(CONFIG_ACPI_PROCESSOR) || defined(CONFIG_ACPI_PROCESSOR_MODULE)
25296 -+ capbuf[OSC_SUPPORT_TYPE] |= OSC_SB_PPC_OST_SUPPORT;
25297 -+#endif
25298 -+ if (ACPI_FAILURE(acpi_get_handle(NULL, "\\_SB", &handle)))
25299 -+ return;
25300 -+ if (ACPI_SUCCESS(acpi_run_osc(handle, &context)))
25301 -+ kfree(context.ret.pointer);
25302 -+ /* do we need to check the returned cap? Sounds no */
25303 -+}
25304 -+
25305 - /* --------------------------------------------------------------------------
25306 - Event Management
25307 - -------------------------------------------------------------------------- */
25308 -@@ -734,6 +895,8 @@ static int __init acpi_bus_init(void)
25309 - status = acpi_ec_ecdt_probe();
25310 - /* Ignore result. Not having an ECDT is not fatal. */
25311 -
25312 -+ acpi_bus_osc_support();
25313 -+
25314 - status = acpi_initialize_objects(ACPI_FULL_INITIALIZATION);
25315 - if (ACPI_FAILURE(status)) {
25316 - printk(KERN_ERR PREFIX "Unable to initialize ACPI objects\n");
25317 -diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
25318 -index dc72690..91fed3c 100644
25319 ---- a/drivers/ata/libata-core.c
25320 -+++ b/drivers/ata/libata-core.c
25321 -@@ -3790,21 +3790,45 @@ int sata_link_debounce(struct ata_link *link, const unsigned long *params,
25322 - int sata_link_resume(struct ata_link *link, const unsigned long *params,
25323 - unsigned long deadline)
25324 - {
25325 -+ int tries = ATA_LINK_RESUME_TRIES;
25326 - u32 scontrol, serror;
25327 - int rc;
25328 -
25329 - if ((rc = sata_scr_read(link, SCR_CONTROL, &scontrol)))
25330 - return rc;
25331 -
25332 -- scontrol = (scontrol & 0x0f0) | 0x300;
25333 -+ /*
25334 -+ * Writes to SControl sometimes get ignored under certain
25335 -+ * controllers (ata_piix SIDPR). Make sure DET actually is
25336 -+ * cleared.
25337 -+ */
25338 -+ do {
25339 -+ scontrol = (scontrol & 0x0f0) | 0x300;
25340 -+ if ((rc = sata_scr_write(link, SCR_CONTROL, scontrol)))
25341 -+ return rc;
25342 -+ /*
25343 -+ * Some PHYs react badly if SStatus is pounded
25344 -+ * immediately after resuming. Delay 200ms before
25345 -+ * debouncing.
25346 -+ */
25347 -+ msleep(200);
25348 -
25349 -- if ((rc = sata_scr_write(link, SCR_CONTROL, scontrol)))
25350 -- return rc;
25351 -+ /* is SControl restored correctly? */
25352 -+ if ((rc = sata_scr_read(link, SCR_CONTROL, &scontrol)))
25353 -+ return rc;
25354 -+ } while ((scontrol & 0xf0f) != 0x300 && --tries);
25355 -
25356 -- /* Some PHYs react badly if SStatus is pounded immediately
25357 -- * after resuming. Delay 200ms before debouncing.
25358 -- */
25359 -- msleep(200);
25360 -+ if ((scontrol & 0xf0f) != 0x300) {
25361 -+ ata_link_printk(link, KERN_ERR,
25362 -+ "failed to resume link (SControl %X)\n",
25363 -+ scontrol);
25364 -+ return 0;
25365 -+ }
25366 -+
25367 -+ if (tries < ATA_LINK_RESUME_TRIES)
25368 -+ ata_link_printk(link, KERN_WARNING,
25369 -+ "link resume succeeded after %d retries\n",
25370 -+ ATA_LINK_RESUME_TRIES - tries);
25371 -
25372 - if ((rc = sata_link_debounce(link, params, deadline)))
25373 - return rc;
25374 -diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c
25375 -index bba2ae5..7d8d3c3 100644
25376 ---- a/drivers/ata/libata-eh.c
25377 -+++ b/drivers/ata/libata-eh.c
25378 -@@ -2019,8 +2019,9 @@ static void ata_eh_link_autopsy(struct ata_link *link)
25379 - qc->err_mask &= ~(AC_ERR_DEV | AC_ERR_OTHER);
25380 -
25381 - /* determine whether the command is worth retrying */
25382 -- if (!(qc->err_mask & AC_ERR_INVALID) &&
25383 -- ((qc->flags & ATA_QCFLAG_IO) || qc->err_mask != AC_ERR_DEV))
25384 -+ if (qc->flags & ATA_QCFLAG_IO ||
25385 -+ (!(qc->err_mask & AC_ERR_INVALID) &&
25386 -+ qc->err_mask != AC_ERR_DEV))
25387 - qc->flags |= ATA_QCFLAG_RETRY;
25388 -
25389 - /* accumulate error info */
25390 -diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
25391 -index 2ddf03a..68b5957 100644
25392 ---- a/drivers/block/pktcdvd.c
25393 -+++ b/drivers/block/pktcdvd.c
25394 -@@ -322,7 +322,7 @@ static void pkt_sysfs_dev_remove(struct pktcdvd_device *pd)
25395 - pkt_kobj_remove(pd->kobj_stat);
25396 - pkt_kobj_remove(pd->kobj_wqueue);
25397 - if (class_pktcdvd)
25398 -- device_destroy(class_pktcdvd, pd->pkt_dev);
25399 -+ device_unregister(pd->dev);
25400 - }
25401 -
25402 -
25403 -diff --git a/drivers/char/random.c b/drivers/char/random.c
25404 -index 04b505e..908ac1f 100644
25405 ---- a/drivers/char/random.c
25406 -+++ b/drivers/char/random.c
25407 -@@ -1051,12 +1051,6 @@ random_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
25408 - /* like a named pipe */
25409 - }
25410 -
25411 -- /*
25412 -- * If we gave the user some bytes, update the access time.
25413 -- */
25414 -- if (count)
25415 -- file_accessed(file);
25416 --
25417 - return (count ? count : retval);
25418 - }
25419 -
25420 -@@ -1107,7 +1101,6 @@ static ssize_t random_write(struct file *file, const char __user *buffer,
25421 - size_t count, loff_t *ppos)
25422 - {
25423 - size_t ret;
25424 -- struct inode *inode = file->f_path.dentry->d_inode;
25425 -
25426 - ret = write_pool(&blocking_pool, buffer, count);
25427 - if (ret)
25428 -@@ -1116,8 +1109,6 @@ static ssize_t random_write(struct file *file, const char __user *buffer,
25429 - if (ret)
25430 - return ret;
25431 -
25432 -- inode->i_mtime = current_fs_time(inode->i_sb);
25433 -- mark_inode_dirty(inode);
25434 - return (ssize_t)count;
25435 - }
25436 -
25437 -diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
25438 -index f060246..537c29a 100644
25439 ---- a/drivers/connector/connector.c
25440 -+++ b/drivers/connector/connector.c
25441 -@@ -36,17 +36,6 @@ MODULE_LICENSE("GPL");
25442 - MODULE_AUTHOR("Evgeniy Polyakov <zbr@×××××××.net>");
25443 - MODULE_DESCRIPTION("Generic userspace <-> kernelspace connector.");
25444 -
25445 --static u32 cn_idx = CN_IDX_CONNECTOR;
25446 --static u32 cn_val = CN_VAL_CONNECTOR;
25447 --
25448 --module_param(cn_idx, uint, 0);
25449 --module_param(cn_val, uint, 0);
25450 --MODULE_PARM_DESC(cn_idx, "Connector's main device idx.");
25451 --MODULE_PARM_DESC(cn_val, "Connector's main device val.");
25452 --
25453 --static DEFINE_MUTEX(notify_lock);
25454 --static LIST_HEAD(notify_list);
25455 --
25456 - static struct cn_dev cdev;
25457 -
25458 - static int cn_already_initialized;
25459 -@@ -210,54 +199,6 @@ static void cn_rx_skb(struct sk_buff *__skb)
25460 - }
25461 -
25462 - /*
25463 -- * Notification routing.
25464 -- *
25465 -- * Gets id and checks if there are notification request for it's idx
25466 -- * and val. If there are such requests notify the listeners with the
25467 -- * given notify event.
25468 -- *
25469 -- */
25470 --static void cn_notify(struct cb_id *id, u32 notify_event)
25471 --{
25472 -- struct cn_ctl_entry *ent;
25473 --
25474 -- mutex_lock(&notify_lock);
25475 -- list_for_each_entry(ent, &notify_list, notify_entry) {
25476 -- int i;
25477 -- struct cn_notify_req *req;
25478 -- struct cn_ctl_msg *ctl = ent->msg;
25479 -- int idx_found, val_found;
25480 --
25481 -- idx_found = val_found = 0;
25482 --
25483 -- req = (struct cn_notify_req *)ctl->data;
25484 -- for (i = 0; i < ctl->idx_notify_num; ++i, ++req) {
25485 -- if (id->idx >= req->first &&
25486 -- id->idx < req->first + req->range) {
25487 -- idx_found = 1;
25488 -- break;
25489 -- }
25490 -- }
25491 --
25492 -- for (i = 0; i < ctl->val_notify_num; ++i, ++req) {
25493 -- if (id->val >= req->first &&
25494 -- id->val < req->first + req->range) {
25495 -- val_found = 1;
25496 -- break;
25497 -- }
25498 -- }
25499 --
25500 -- if (idx_found && val_found) {
25501 -- struct cn_msg m = { .ack = notify_event, };
25502 --
25503 -- memcpy(&m.id, id, sizeof(m.id));
25504 -- cn_netlink_send(&m, ctl->group, GFP_KERNEL);
25505 -- }
25506 -- }
25507 -- mutex_unlock(&notify_lock);
25508 --}
25509 --
25510 --/*
25511 - * Callback add routing - adds callback with given ID and name.
25512 - * If there is registered callback with the same ID it will not be added.
25513 - *
25514 -@@ -276,8 +217,6 @@ int cn_add_callback(struct cb_id *id, char *name,
25515 - if (err)
25516 - return err;
25517 -
25518 -- cn_notify(id, 0);
25519 --
25520 - return 0;
25521 - }
25522 - EXPORT_SYMBOL_GPL(cn_add_callback);
25523 -@@ -295,111 +234,9 @@ void cn_del_callback(struct cb_id *id)
25524 - struct cn_dev *dev = &cdev;
25525 -
25526 - cn_queue_del_callback(dev->cbdev, id);
25527 -- cn_notify(id, 1);
25528 - }
25529 - EXPORT_SYMBOL_GPL(cn_del_callback);
25530 -
25531 --/*
25532 -- * Checks two connector's control messages to be the same.
25533 -- * Returns 1 if they are the same or if the first one is corrupted.
25534 -- */
25535 --static int cn_ctl_msg_equals(struct cn_ctl_msg *m1, struct cn_ctl_msg *m2)
25536 --{
25537 -- int i;
25538 -- struct cn_notify_req *req1, *req2;
25539 --
25540 -- if (m1->idx_notify_num != m2->idx_notify_num)
25541 -- return 0;
25542 --
25543 -- if (m1->val_notify_num != m2->val_notify_num)
25544 -- return 0;
25545 --
25546 -- if (m1->len != m2->len)
25547 -- return 0;
25548 --
25549 -- if ((m1->idx_notify_num + m1->val_notify_num) * sizeof(*req1) !=
25550 -- m1->len)
25551 -- return 1;
25552 --
25553 -- req1 = (struct cn_notify_req *)m1->data;
25554 -- req2 = (struct cn_notify_req *)m2->data;
25555 --
25556 -- for (i = 0; i < m1->idx_notify_num; ++i) {
25557 -- if (req1->first != req2->first || req1->range != req2->range)
25558 -- return 0;
25559 -- req1++;
25560 -- req2++;
25561 -- }
25562 --
25563 -- for (i = 0; i < m1->val_notify_num; ++i) {
25564 -- if (req1->first != req2->first || req1->range != req2->range)
25565 -- return 0;
25566 -- req1++;
25567 -- req2++;
25568 -- }
25569 --
25570 -- return 1;
25571 --}
25572 --
25573 --/*
25574 -- * Main connector device's callback.
25575 -- *
25576 -- * Used for notification of a request's processing.
25577 -- */
25578 --static void cn_callback(struct cn_msg *msg, struct netlink_skb_parms *nsp)
25579 --{
25580 -- struct cn_ctl_msg *ctl;
25581 -- struct cn_ctl_entry *ent;
25582 -- u32 size;
25583 --
25584 -- if (msg->len < sizeof(*ctl))
25585 -- return;
25586 --
25587 -- ctl = (struct cn_ctl_msg *)msg->data;
25588 --
25589 -- size = (sizeof(*ctl) + ((ctl->idx_notify_num +
25590 -- ctl->val_notify_num) *
25591 -- sizeof(struct cn_notify_req)));
25592 --
25593 -- if (msg->len != size)
25594 -- return;
25595 --
25596 -- if (ctl->len + sizeof(*ctl) != msg->len)
25597 -- return;
25598 --
25599 -- /*
25600 -- * Remove notification.
25601 -- */
25602 -- if (ctl->group == 0) {
25603 -- struct cn_ctl_entry *n;
25604 --
25605 -- mutex_lock(&notify_lock);
25606 -- list_for_each_entry_safe(ent, n, &notify_list, notify_entry) {
25607 -- if (cn_ctl_msg_equals(ent->msg, ctl)) {
25608 -- list_del(&ent->notify_entry);
25609 -- kfree(ent);
25610 -- }
25611 -- }
25612 -- mutex_unlock(&notify_lock);
25613 --
25614 -- return;
25615 -- }
25616 --
25617 -- size += sizeof(*ent);
25618 --
25619 -- ent = kzalloc(size, GFP_KERNEL);
25620 -- if (!ent)
25621 -- return;
25622 --
25623 -- ent->msg = (struct cn_ctl_msg *)(ent + 1);
25624 --
25625 -- memcpy(ent->msg, ctl, size - sizeof(*ent));
25626 --
25627 -- mutex_lock(&notify_lock);
25628 -- list_add(&ent->notify_entry, &notify_list);
25629 -- mutex_unlock(&notify_lock);
25630 --}
25631 --
25632 - static int cn_proc_show(struct seq_file *m, void *v)
25633 - {
25634 - struct cn_queue_dev *dev = cdev.cbdev;
25635 -@@ -437,11 +274,8 @@ static const struct file_operations cn_file_ops = {
25636 - static int __devinit cn_init(void)
25637 - {
25638 - struct cn_dev *dev = &cdev;
25639 -- int err;
25640 -
25641 - dev->input = cn_rx_skb;
25642 -- dev->id.idx = cn_idx;
25643 -- dev->id.val = cn_val;
25644 -
25645 - dev->nls = netlink_kernel_create(&init_net, NETLINK_CONNECTOR,
25646 - CN_NETLINK_USERS + 0xf,
25647 -@@ -457,14 +291,6 @@ static int __devinit cn_init(void)
25648 -
25649 - cn_already_initialized = 1;
25650 -
25651 -- err = cn_add_callback(&dev->id, "connector", &cn_callback);
25652 -- if (err) {
25653 -- cn_already_initialized = 0;
25654 -- cn_queue_free_dev(dev->cbdev);
25655 -- netlink_kernel_release(dev->nls);
25656 -- return -EINVAL;
25657 -- }
25658 --
25659 - proc_net_fops_create(&init_net, "connector", S_IRUGO, &cn_file_ops);
25660 -
25661 - return 0;
25662 -@@ -478,7 +304,6 @@ static void __devexit cn_fini(void)
25663 -
25664 - proc_net_remove(&init_net, "connector");
25665 -
25666 -- cn_del_callback(&dev->id);
25667 - cn_queue_free_dev(dev->cbdev);
25668 - netlink_kernel_release(dev->nls);
25669 - }
25670 -diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c
25671 -index e4864e8..ed635ae 100644
25672 ---- a/drivers/firewire/core-card.c
25673 -+++ b/drivers/firewire/core-card.c
25674 -@@ -57,6 +57,9 @@ static LIST_HEAD(card_list);
25675 - static LIST_HEAD(descriptor_list);
25676 - static int descriptor_count;
25677 -
25678 -+/* ROM header, bus info block, root dir header, capabilities = 7 quadlets */
25679 -+static size_t config_rom_length = 1 + 4 + 1 + 1;
25680 -+
25681 - #define BIB_CRC(v) ((v) << 0)
25682 - #define BIB_CRC_LENGTH(v) ((v) << 16)
25683 - #define BIB_INFO_LENGTH(v) ((v) << 24)
25684 -@@ -72,7 +75,7 @@ static int descriptor_count;
25685 - #define BIB_CMC ((1) << 30)
25686 - #define BIB_IMC ((1) << 31)
25687 -
25688 --static u32 *generate_config_rom(struct fw_card *card, size_t *config_rom_length)
25689 -+static u32 *generate_config_rom(struct fw_card *card)
25690 - {
25691 - struct fw_descriptor *desc;
25692 - static u32 config_rom[256];
25693 -@@ -131,7 +134,7 @@ static u32 *generate_config_rom(struct fw_card *card, size_t *config_rom_length)
25694 - for (i = 0; i < j; i += length + 1)
25695 - length = fw_compute_block_crc(config_rom + i);
25696 -
25697 -- *config_rom_length = j;
25698 -+ WARN_ON(j != config_rom_length);
25699 -
25700 - return config_rom;
25701 - }
25702 -@@ -140,17 +143,24 @@ static void update_config_roms(void)
25703 - {
25704 - struct fw_card *card;
25705 - u32 *config_rom;
25706 -- size_t length;
25707 -
25708 - list_for_each_entry (card, &card_list, link) {
25709 -- config_rom = generate_config_rom(card, &length);
25710 -- card->driver->set_config_rom(card, config_rom, length);
25711 -+ config_rom = generate_config_rom(card);
25712 -+ card->driver->set_config_rom(card, config_rom,
25713 -+ config_rom_length);
25714 - }
25715 - }
25716 -
25717 -+static size_t required_space(struct fw_descriptor *desc)
25718 -+{
25719 -+ /* descriptor + entry into root dir + optional immediate entry */
25720 -+ return desc->length + 1 + (desc->immediate > 0 ? 1 : 0);
25721 -+}
25722 -+
25723 - int fw_core_add_descriptor(struct fw_descriptor *desc)
25724 - {
25725 - size_t i;
25726 -+ int ret;
25727 -
25728 - /*
25729 - * Check descriptor is valid; the length of all blocks in the
25730 -@@ -166,15 +176,21 @@ int fw_core_add_descriptor(struct fw_descriptor *desc)
25731 -
25732 - mutex_lock(&card_mutex);
25733 -
25734 -- list_add_tail(&desc->link, &descriptor_list);
25735 -- descriptor_count++;
25736 -- if (desc->immediate > 0)
25737 -+ if (config_rom_length + required_space(desc) > 256) {
25738 -+ ret = -EBUSY;
25739 -+ } else {
25740 -+ list_add_tail(&desc->link, &descriptor_list);
25741 -+ config_rom_length += required_space(desc);
25742 - descriptor_count++;
25743 -- update_config_roms();
25744 -+ if (desc->immediate > 0)
25745 -+ descriptor_count++;
25746 -+ update_config_roms();
25747 -+ ret = 0;
25748 -+ }
25749 -
25750 - mutex_unlock(&card_mutex);
25751 -
25752 -- return 0;
25753 -+ return ret;
25754 - }
25755 - EXPORT_SYMBOL(fw_core_add_descriptor);
25756 -
25757 -@@ -183,6 +199,7 @@ void fw_core_remove_descriptor(struct fw_descriptor *desc)
25758 - mutex_lock(&card_mutex);
25759 -
25760 - list_del(&desc->link);
25761 -+ config_rom_length -= required_space(desc);
25762 - descriptor_count--;
25763 - if (desc->immediate > 0)
25764 - descriptor_count--;
25765 -@@ -436,7 +453,6 @@ int fw_card_add(struct fw_card *card,
25766 - u32 max_receive, u32 link_speed, u64 guid)
25767 - {
25768 - u32 *config_rom;
25769 -- size_t length;
25770 - int ret;
25771 -
25772 - card->max_receive = max_receive;
25773 -@@ -445,8 +461,8 @@ int fw_card_add(struct fw_card *card,
25774 -
25775 - mutex_lock(&card_mutex);
25776 -
25777 -- config_rom = generate_config_rom(card, &length);
25778 -- ret = card->driver->enable(card, config_rom, length);
25779 -+ config_rom = generate_config_rom(card);
25780 -+ ret = card->driver->enable(card, config_rom, config_rom_length);
25781 - if (ret == 0)
25782 - list_add_tail(&card->link, &card_list);
25783 -
25784 -diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c
25785 -index 1e504de..720b39b 100644
25786 ---- a/drivers/firewire/ohci.c
25787 -+++ b/drivers/firewire/ohci.c
25788 -@@ -2412,6 +2412,7 @@ static void ohci_pmac_off(struct pci_dev *dev)
25789 -
25790 - #define PCI_VENDOR_ID_AGERE PCI_VENDOR_ID_ATT
25791 - #define PCI_DEVICE_ID_AGERE_FW643 0x5901
25792 -+#define PCI_DEVICE_ID_TI_TSB43AB23 0x8024
25793 -
25794 - static int __devinit pci_probe(struct pci_dev *dev,
25795 - const struct pci_device_id *ent)
25796 -@@ -2477,7 +2478,8 @@ static int __devinit pci_probe(struct pci_dev *dev,
25797 - #if !defined(CONFIG_X86_32)
25798 - /* dual-buffer mode is broken with descriptor addresses above 2G */
25799 - if (dev->vendor == PCI_VENDOR_ID_TI &&
25800 -- dev->device == PCI_DEVICE_ID_TI_TSB43AB22)
25801 -+ (dev->device == PCI_DEVICE_ID_TI_TSB43AB22 ||
25802 -+ dev->device == PCI_DEVICE_ID_TI_TSB43AB23))
25803 - ohci->use_dualbuffer = false;
25804 - #endif
25805 -
25806 -diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
25807 -index e9dbb48..8bf3770 100644
25808 ---- a/drivers/gpu/drm/drm_gem.c
25809 -+++ b/drivers/gpu/drm/drm_gem.c
25810 -@@ -142,19 +142,6 @@ drm_gem_object_alloc(struct drm_device *dev, size_t size)
25811 - if (IS_ERR(obj->filp))
25812 - goto free;
25813 -
25814 -- /* Basically we want to disable the OOM killer and handle ENOMEM
25815 -- * ourselves by sacrificing pages from cached buffers.
25816 -- * XXX shmem_file_[gs]et_gfp_mask()
25817 -- */
25818 -- mapping_set_gfp_mask(obj->filp->f_path.dentry->d_inode->i_mapping,
25819 -- GFP_HIGHUSER |
25820 -- __GFP_COLD |
25821 -- __GFP_FS |
25822 -- __GFP_RECLAIMABLE |
25823 -- __GFP_NORETRY |
25824 -- __GFP_NOWARN |
25825 -- __GFP_NOMEMALLOC);
25826 --
25827 - kref_init(&obj->refcount);
25828 - kref_init(&obj->handlecount);
25829 - obj->size = size;
25830 -diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
25831 -index 26bf055..af655e8 100644
25832 ---- a/drivers/gpu/drm/i915/i915_debugfs.c
25833 -+++ b/drivers/gpu/drm/i915/i915_debugfs.c
25834 -@@ -288,7 +288,7 @@ static int i915_batchbuffer_info(struct seq_file *m, void *data)
25835 - list_for_each_entry(obj_priv, &dev_priv->mm.active_list, list) {
25836 - obj = obj_priv->obj;
25837 - if (obj->read_domains & I915_GEM_DOMAIN_COMMAND) {
25838 -- ret = i915_gem_object_get_pages(obj);
25839 -+ ret = i915_gem_object_get_pages(obj, 0);
25840 - if (ret) {
25841 - DRM_ERROR("Failed to get pages: %d\n", ret);
25842 - spin_unlock(&dev_priv->mm.active_list_lock);
25843 -diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
25844 -index bc2db7d..eaa1893 100644
25845 ---- a/drivers/gpu/drm/i915/i915_dma.c
25846 -+++ b/drivers/gpu/drm/i915/i915_dma.c
25847 -@@ -1252,6 +1252,8 @@ static int i915_load_modeset_init(struct drm_device *dev,
25848 - if (ret)
25849 - goto destroy_ringbuffer;
25850 -
25851 -+ intel_modeset_init(dev);
25852 -+
25853 - ret = drm_irq_install(dev);
25854 - if (ret)
25855 - goto destroy_ringbuffer;
25856 -@@ -1266,8 +1268,6 @@ static int i915_load_modeset_init(struct drm_device *dev,
25857 -
25858 - I915_WRITE(INSTPM, (1 << 5) | (1 << 21));
25859 -
25860 -- intel_modeset_init(dev);
25861 --
25862 - drm_helper_initial_config(dev);
25863 -
25864 - return 0;
25865 -diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
25866 -index 791fded..7277246 100644
25867 ---- a/drivers/gpu/drm/i915/i915_drv.h
25868 -+++ b/drivers/gpu/drm/i915/i915_drv.h
25869 -@@ -822,7 +822,7 @@ int i915_gem_attach_phys_object(struct drm_device *dev,
25870 - void i915_gem_detach_phys_object(struct drm_device *dev,
25871 - struct drm_gem_object *obj);
25872 - void i915_gem_free_all_phys_object(struct drm_device *dev);
25873 --int i915_gem_object_get_pages(struct drm_gem_object *obj);
25874 -+int i915_gem_object_get_pages(struct drm_gem_object *obj, gfp_t gfpmask);
25875 - void i915_gem_object_put_pages(struct drm_gem_object *obj);
25876 - void i915_gem_release(struct drm_device * dev, struct drm_file *file_priv);
25877 -
25878 -diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
25879 -index df2c625..8ad244a 100644
25880 ---- a/drivers/gpu/drm/i915/i915_gem.c
25881 -+++ b/drivers/gpu/drm/i915/i915_gem.c
25882 -@@ -277,7 +277,7 @@ i915_gem_shmem_pread_fast(struct drm_device *dev, struct drm_gem_object *obj,
25883 -
25884 - mutex_lock(&dev->struct_mutex);
25885 -
25886 -- ret = i915_gem_object_get_pages(obj);
25887 -+ ret = i915_gem_object_get_pages(obj, 0);
25888 - if (ret != 0)
25889 - goto fail_unlock;
25890 -
25891 -@@ -321,40 +321,24 @@ fail_unlock:
25892 - return ret;
25893 - }
25894 -
25895 --static inline gfp_t
25896 --i915_gem_object_get_page_gfp_mask (struct drm_gem_object *obj)
25897 --{
25898 -- return mapping_gfp_mask(obj->filp->f_path.dentry->d_inode->i_mapping);
25899 --}
25900 --
25901 --static inline void
25902 --i915_gem_object_set_page_gfp_mask (struct drm_gem_object *obj, gfp_t gfp)
25903 --{
25904 -- mapping_set_gfp_mask(obj->filp->f_path.dentry->d_inode->i_mapping, gfp);
25905 --}
25906 --
25907 - static int
25908 - i915_gem_object_get_pages_or_evict(struct drm_gem_object *obj)
25909 - {
25910 - int ret;
25911 -
25912 -- ret = i915_gem_object_get_pages(obj);
25913 -+ ret = i915_gem_object_get_pages(obj, __GFP_NORETRY | __GFP_NOWARN);
25914 -
25915 - /* If we've insufficient memory to map in the pages, attempt
25916 - * to make some space by throwing out some old buffers.
25917 - */
25918 - if (ret == -ENOMEM) {
25919 - struct drm_device *dev = obj->dev;
25920 -- gfp_t gfp;
25921 -
25922 - ret = i915_gem_evict_something(dev, obj->size);
25923 - if (ret)
25924 - return ret;
25925 -
25926 -- gfp = i915_gem_object_get_page_gfp_mask(obj);
25927 -- i915_gem_object_set_page_gfp_mask(obj, gfp & ~__GFP_NORETRY);
25928 -- ret = i915_gem_object_get_pages(obj);
25929 -- i915_gem_object_set_page_gfp_mask (obj, gfp);
25930 -+ ret = i915_gem_object_get_pages(obj, 0);
25931 - }
25932 -
25933 - return ret;
25934 -@@ -790,7 +774,7 @@ i915_gem_shmem_pwrite_fast(struct drm_device *dev, struct drm_gem_object *obj,
25935 -
25936 - mutex_lock(&dev->struct_mutex);
25937 -
25938 -- ret = i915_gem_object_get_pages(obj);
25939 -+ ret = i915_gem_object_get_pages(obj, 0);
25940 - if (ret != 0)
25941 - goto fail_unlock;
25942 -
25943 -@@ -2219,7 +2203,8 @@ i915_gem_evict_something(struct drm_device *dev, int min_size)
25944 - }
25945 -
25946 - int
25947 --i915_gem_object_get_pages(struct drm_gem_object *obj)
25948 -+i915_gem_object_get_pages(struct drm_gem_object *obj,
25949 -+ gfp_t gfpmask)
25950 - {
25951 - struct drm_i915_gem_object *obj_priv = obj->driver_private;
25952 - int page_count, i;
25953 -@@ -2245,7 +2230,10 @@ i915_gem_object_get_pages(struct drm_gem_object *obj)
25954 - inode = obj->filp->f_path.dentry->d_inode;
25955 - mapping = inode->i_mapping;
25956 - for (i = 0; i < page_count; i++) {
25957 -- page = read_mapping_page(mapping, i, NULL);
25958 -+ page = read_cache_page_gfp(mapping, i,
25959 -+ mapping_gfp_mask (mapping) |
25960 -+ __GFP_COLD |
25961 -+ gfpmask);
25962 - if (IS_ERR(page)) {
25963 - ret = PTR_ERR(page);
25964 - i915_gem_object_put_pages(obj);
25965 -@@ -2568,7 +2556,7 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment)
25966 - drm_i915_private_t *dev_priv = dev->dev_private;
25967 - struct drm_i915_gem_object *obj_priv = obj->driver_private;
25968 - struct drm_mm_node *free_space;
25969 -- bool retry_alloc = false;
25970 -+ gfp_t gfpmask = __GFP_NORETRY | __GFP_NOWARN;
25971 - int ret;
25972 -
25973 - if (obj_priv->madv != I915_MADV_WILLNEED) {
25974 -@@ -2612,15 +2600,7 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment)
25975 - DRM_INFO("Binding object of size %zd at 0x%08x\n",
25976 - obj->size, obj_priv->gtt_offset);
25977 - #endif
25978 -- if (retry_alloc) {
25979 -- i915_gem_object_set_page_gfp_mask (obj,
25980 -- i915_gem_object_get_page_gfp_mask (obj) & ~__GFP_NORETRY);
25981 -- }
25982 -- ret = i915_gem_object_get_pages(obj);
25983 -- if (retry_alloc) {
25984 -- i915_gem_object_set_page_gfp_mask (obj,
25985 -- i915_gem_object_get_page_gfp_mask (obj) | __GFP_NORETRY);
25986 -- }
25987 -+ ret = i915_gem_object_get_pages(obj, gfpmask);
25988 - if (ret) {
25989 - drm_mm_put_block(obj_priv->gtt_space);
25990 - obj_priv->gtt_space = NULL;
25991 -@@ -2630,9 +2610,9 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment)
25992 - ret = i915_gem_evict_something(dev, obj->size);
25993 - if (ret) {
25994 - /* now try to shrink everyone else */
25995 -- if (! retry_alloc) {
25996 -- retry_alloc = true;
25997 -- goto search_free;
25998 -+ if (gfpmask) {
25999 -+ gfpmask = 0;
26000 -+ goto search_free;
26001 - }
26002 -
26003 - return ret;
26004 -@@ -4695,7 +4675,7 @@ void i915_gem_detach_phys_object(struct drm_device *dev,
26005 - if (!obj_priv->phys_obj)
26006 - return;
26007 -
26008 -- ret = i915_gem_object_get_pages(obj);
26009 -+ ret = i915_gem_object_get_pages(obj, 0);
26010 - if (ret)
26011 - goto out;
26012 -
26013 -@@ -4753,7 +4733,7 @@ i915_gem_attach_phys_object(struct drm_device *dev,
26014 - obj_priv->phys_obj = dev_priv->mm.phys_objs[id - 1];
26015 - obj_priv->phys_obj->cur_obj = obj;
26016 -
26017 -- ret = i915_gem_object_get_pages(obj);
26018 -+ ret = i915_gem_object_get_pages(obj, 0);
26019 - if (ret) {
26020 - DRM_ERROR("failed to get page list\n");
26021 - goto out;
26022 -diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
26023 -index 7d1357e..63f28ad 100644
26024 ---- a/drivers/gpu/drm/i915/i915_irq.c
26025 -+++ b/drivers/gpu/drm/i915/i915_irq.c
26026 -@@ -282,6 +282,8 @@ irqreturn_t igdng_irq_handler(struct drm_device *dev)
26027 - dev_priv->mm.irq_gem_seqno = seqno;
26028 - trace_i915_gem_request_complete(dev, seqno);
26029 - DRM_WAKEUP(&dev_priv->irq_queue);
26030 -+ dev_priv->hangcheck_count = 0;
26031 -+ mod_timer(&dev_priv->hangcheck_timer, jiffies + DRM_I915_HANGCHECK_PERIOD);
26032 - }
26033 -
26034 - I915_WRITE(GTIIR, gt_iir);
26035 -@@ -1042,6 +1044,10 @@ void i915_driver_irq_preinstall(struct drm_device * dev)
26036 - (void) I915_READ(IER);
26037 - }
26038 -
26039 -+/*
26040 -+ * Must be called after intel_modeset_init or hotplug interrupts won't be
26041 -+ * enabled correctly.
26042 -+ */
26043 - int i915_driver_irq_postinstall(struct drm_device *dev)
26044 - {
26045 - drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
26046 -@@ -1064,19 +1070,23 @@ int i915_driver_irq_postinstall(struct drm_device *dev)
26047 - if (I915_HAS_HOTPLUG(dev)) {
26048 - u32 hotplug_en = I915_READ(PORT_HOTPLUG_EN);
26049 -
26050 -- /* Leave other bits alone */
26051 -- hotplug_en |= HOTPLUG_EN_MASK;
26052 -+ /* Note HDMI and DP share bits */
26053 -+ if (dev_priv->hotplug_supported_mask & HDMIB_HOTPLUG_INT_STATUS)
26054 -+ hotplug_en |= HDMIB_HOTPLUG_INT_EN;
26055 -+ if (dev_priv->hotplug_supported_mask & HDMIC_HOTPLUG_INT_STATUS)
26056 -+ hotplug_en |= HDMIC_HOTPLUG_INT_EN;
26057 -+ if (dev_priv->hotplug_supported_mask & HDMID_HOTPLUG_INT_STATUS)
26058 -+ hotplug_en |= HDMID_HOTPLUG_INT_EN;
26059 -+ if (dev_priv->hotplug_supported_mask & SDVOC_HOTPLUG_INT_STATUS)
26060 -+ hotplug_en |= SDVOC_HOTPLUG_INT_EN;
26061 -+ if (dev_priv->hotplug_supported_mask & SDVOB_HOTPLUG_INT_STATUS)
26062 -+ hotplug_en |= SDVOB_HOTPLUG_INT_EN;
26063 -+ if (dev_priv->hotplug_supported_mask & CRT_HOTPLUG_INT_STATUS)
26064 -+ hotplug_en |= CRT_HOTPLUG_INT_EN;
26065 -+ /* Ignore TV since it's buggy */
26066 -+
26067 - I915_WRITE(PORT_HOTPLUG_EN, hotplug_en);
26068 -
26069 -- dev_priv->hotplug_supported_mask = CRT_HOTPLUG_INT_STATUS |
26070 -- TV_HOTPLUG_INT_STATUS | SDVOC_HOTPLUG_INT_STATUS |
26071 -- SDVOB_HOTPLUG_INT_STATUS;
26072 -- if (IS_G4X(dev)) {
26073 -- dev_priv->hotplug_supported_mask |=
26074 -- HDMIB_HOTPLUG_INT_STATUS |
26075 -- HDMIC_HOTPLUG_INT_STATUS |
26076 -- HDMID_HOTPLUG_INT_STATUS;
26077 -- }
26078 - /* Enable in IER... */
26079 - enable_mask |= I915_DISPLAY_PORT_INTERRUPT;
26080 - /* and unmask in IMR */
26081 -diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
26082 -index 54e5907..fd537f4 100644
26083 ---- a/drivers/gpu/drm/i915/i915_reg.h
26084 -+++ b/drivers/gpu/drm/i915/i915_reg.h
26085 -@@ -863,14 +863,6 @@
26086 - #define CRT_HOTPLUG_DETECT_VOLTAGE_475MV (1 << 2)
26087 - #define CRT_HOTPLUG_MASK (0x3fc) /* Bits 9-2 */
26088 - #define CRT_FORCE_HOTPLUG_MASK 0xfffffe1f
26089 --#define HOTPLUG_EN_MASK (HDMIB_HOTPLUG_INT_EN | \
26090 -- HDMIC_HOTPLUG_INT_EN | \
26091 -- HDMID_HOTPLUG_INT_EN | \
26092 -- SDVOB_HOTPLUG_INT_EN | \
26093 -- SDVOC_HOTPLUG_INT_EN | \
26094 -- TV_HOTPLUG_INT_EN | \
26095 -- CRT_HOTPLUG_INT_EN)
26096 --
26097 -
26098 - #define PORT_HOTPLUG_STAT 0x61114
26099 - #define HDMIB_HOTPLUG_INT_STATUS (1 << 29)
26100 -diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
26101 -index e505144..6d3730f 100644
26102 ---- a/drivers/gpu/drm/i915/intel_crt.c
26103 -+++ b/drivers/gpu/drm/i915/intel_crt.c
26104 -@@ -576,4 +576,6 @@ void intel_crt_init(struct drm_device *dev)
26105 - drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs);
26106 -
26107 - drm_sysfs_connector_add(connector);
26108 -+
26109 -+ dev_priv->hotplug_supported_mask |= CRT_HOTPLUG_INT_STATUS;
26110 - }
26111 -diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
26112 -index 121b92e..601415d 100644
26113 ---- a/drivers/gpu/drm/i915/intel_display.c
26114 -+++ b/drivers/gpu/drm/i915/intel_display.c
26115 -@@ -4068,29 +4068,43 @@ static void intel_setup_outputs(struct drm_device *dev)
26116 - bool found = false;
26117 -
26118 - if (I915_READ(SDVOB) & SDVO_DETECTED) {
26119 -+ DRM_DEBUG_KMS("probing SDVOB\n");
26120 - found = intel_sdvo_init(dev, SDVOB);
26121 -- if (!found && SUPPORTS_INTEGRATED_HDMI(dev))
26122 -+ if (!found && SUPPORTS_INTEGRATED_HDMI(dev)) {
26123 -+ DRM_DEBUG_KMS("probing HDMI on SDVOB\n");
26124 - intel_hdmi_init(dev, SDVOB);
26125 -+ }
26126 -
26127 -- if (!found && SUPPORTS_INTEGRATED_DP(dev))
26128 -+ if (!found && SUPPORTS_INTEGRATED_DP(dev)) {
26129 -+ DRM_DEBUG_KMS("probing DP_B\n");
26130 - intel_dp_init(dev, DP_B);
26131 -+ }
26132 - }
26133 -
26134 - /* Before G4X SDVOC doesn't have its own detect register */
26135 -
26136 -- if (I915_READ(SDVOB) & SDVO_DETECTED)
26137 -+ if (I915_READ(SDVOB) & SDVO_DETECTED) {
26138 -+ DRM_DEBUG_KMS("probing SDVOC\n");
26139 - found = intel_sdvo_init(dev, SDVOC);
26140 -+ }
26141 -
26142 - if (!found && (I915_READ(SDVOC) & SDVO_DETECTED)) {
26143 -
26144 -- if (SUPPORTS_INTEGRATED_HDMI(dev))
26145 -+ if (SUPPORTS_INTEGRATED_HDMI(dev)) {
26146 -+ DRM_DEBUG_KMS("probing HDMI on SDVOC\n");
26147 - intel_hdmi_init(dev, SDVOC);
26148 -- if (SUPPORTS_INTEGRATED_DP(dev))
26149 -+ }
26150 -+ if (SUPPORTS_INTEGRATED_DP(dev)) {
26151 -+ DRM_DEBUG_KMS("probing DP_C\n");
26152 - intel_dp_init(dev, DP_C);
26153 -+ }
26154 - }
26155 -
26156 -- if (SUPPORTS_INTEGRATED_DP(dev) && (I915_READ(DP_D) & DP_DETECTED))
26157 -+ if (SUPPORTS_INTEGRATED_DP(dev) &&
26158 -+ (I915_READ(DP_D) & DP_DETECTED)) {
26159 -+ DRM_DEBUG_KMS("probing DP_D\n");
26160 - intel_dp_init(dev, DP_D);
26161 -+ }
26162 - } else if (IS_I8XX(dev))
26163 - intel_dvo_init(dev);
26164 -
26165 -diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
26166 -index 92a3d7b..d487771 100644
26167 ---- a/drivers/gpu/drm/i915/intel_dp.c
26168 -+++ b/drivers/gpu/drm/i915/intel_dp.c
26169 -@@ -1290,14 +1290,20 @@ intel_dp_init(struct drm_device *dev, int output_reg)
26170 - break;
26171 - case DP_B:
26172 - case PCH_DP_B:
26173 -+ dev_priv->hotplug_supported_mask |=
26174 -+ HDMIB_HOTPLUG_INT_STATUS;
26175 - name = "DPDDC-B";
26176 - break;
26177 - case DP_C:
26178 - case PCH_DP_C:
26179 -+ dev_priv->hotplug_supported_mask |=
26180 -+ HDMIC_HOTPLUG_INT_STATUS;
26181 - name = "DPDDC-C";
26182 - break;
26183 - case DP_D:
26184 - case PCH_DP_D:
26185 -+ dev_priv->hotplug_supported_mask |=
26186 -+ HDMID_HOTPLUG_INT_STATUS;
26187 - name = "DPDDC-D";
26188 - break;
26189 - }
26190 -diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
26191 -index c33451a..85760bf 100644
26192 ---- a/drivers/gpu/drm/i915/intel_hdmi.c
26193 -+++ b/drivers/gpu/drm/i915/intel_hdmi.c
26194 -@@ -254,21 +254,26 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg)
26195 - if (sdvox_reg == SDVOB) {
26196 - intel_output->clone_mask = (1 << INTEL_HDMIB_CLONE_BIT);
26197 - intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "HDMIB");
26198 -+ dev_priv->hotplug_supported_mask |= HDMIB_HOTPLUG_INT_STATUS;
26199 - } else if (sdvox_reg == SDVOC) {
26200 - intel_output->clone_mask = (1 << INTEL_HDMIC_CLONE_BIT);
26201 - intel_output->ddc_bus = intel_i2c_create(dev, GPIOD, "HDMIC");
26202 -+ dev_priv->hotplug_supported_mask |= HDMIC_HOTPLUG_INT_STATUS;
26203 - } else if (sdvox_reg == HDMIB) {
26204 - intel_output->clone_mask = (1 << INTEL_HDMID_CLONE_BIT);
26205 - intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOE,
26206 - "HDMIB");
26207 -+ dev_priv->hotplug_supported_mask |= HDMIB_HOTPLUG_INT_STATUS;
26208 - } else if (sdvox_reg == HDMIC) {
26209 - intel_output->clone_mask = (1 << INTEL_HDMIE_CLONE_BIT);
26210 - intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOD,
26211 - "HDMIC");
26212 -+ dev_priv->hotplug_supported_mask |= HDMIC_HOTPLUG_INT_STATUS;
26213 - } else if (sdvox_reg == HDMID) {
26214 - intel_output->clone_mask = (1 << INTEL_HDMIF_CLONE_BIT);
26215 - intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOF,
26216 - "HDMID");
26217 -+ dev_priv->hotplug_supported_mask |= HDMID_HOTPLUG_INT_STATUS;
26218 - }
26219 - if (!intel_output->ddc_bus)
26220 - goto err_connector;
26221 -diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
26222 -index 29e21d3..3f5aaf1 100644
26223 ---- a/drivers/gpu/drm/i915/intel_sdvo.c
26224 -+++ b/drivers/gpu/drm/i915/intel_sdvo.c
26225 -@@ -2743,6 +2743,7 @@ static void intel_sdvo_create_enhance_property(struct drm_connector *connector)
26226 -
26227 - bool intel_sdvo_init(struct drm_device *dev, int output_device)
26228 - {
26229 -+ struct drm_i915_private *dev_priv = dev->dev_private;
26230 - struct drm_connector *connector;
26231 - struct intel_output *intel_output;
26232 - struct intel_sdvo_priv *sdvo_priv;
26233 -@@ -2789,10 +2790,12 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device)
26234 - intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "SDVOB DDC BUS");
26235 - sdvo_priv->analog_ddc_bus = intel_i2c_create(dev, GPIOA,
26236 - "SDVOB/VGA DDC BUS");
26237 -+ dev_priv->hotplug_supported_mask |= SDVOB_HOTPLUG_INT_STATUS;
26238 - } else {
26239 - intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "SDVOC DDC BUS");
26240 - sdvo_priv->analog_ddc_bus = intel_i2c_create(dev, GPIOA,
26241 - "SDVOC/VGA DDC BUS");
26242 -+ dev_priv->hotplug_supported_mask |= SDVOC_HOTPLUG_INT_STATUS;
26243 - }
26244 -
26245 - if (intel_output->ddc_bus == NULL)
26246 -diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
26247 -index 5b28b4e..ce026f0 100644
26248 ---- a/drivers/gpu/drm/i915/intel_tv.c
26249 -+++ b/drivers/gpu/drm/i915/intel_tv.c
26250 -@@ -1801,6 +1801,8 @@ intel_tv_init(struct drm_device *dev)
26251 - drm_connector_attach_property(connector,
26252 - dev->mode_config.tv_bottom_margin_property,
26253 - tv_priv->margin[TV_MARGIN_BOTTOM]);
26254 -+
26255 -+ dev_priv->hotplug_supported_mask |= TV_HOTPLUG_INT_STATUS;
26256 - out:
26257 - drm_sysfs_connector_add(connector);
26258 - }
26259 -diff --git a/drivers/infiniband/hw/ipath/ipath_fs.c b/drivers/infiniband/hw/ipath/ipath_fs.c
26260 -index b368406..100da85 100644
26261 ---- a/drivers/infiniband/hw/ipath/ipath_fs.c
26262 -+++ b/drivers/infiniband/hw/ipath/ipath_fs.c
26263 -@@ -346,10 +346,8 @@ static int ipathfs_fill_super(struct super_block *sb, void *data,
26264 - list_for_each_entry_safe(dd, tmp, &ipath_dev_list, ipath_list) {
26265 - spin_unlock_irqrestore(&ipath_devs_lock, flags);
26266 - ret = create_device_files(sb, dd);
26267 -- if (ret) {
26268 -- deactivate_locked_super(sb);
26269 -+ if (ret)
26270 - goto bail;
26271 -- }
26272 - spin_lock_irqsave(&ipath_devs_lock, flags);
26273 - }
26274 -
26275 -diff --git a/drivers/input/misc/winbond-cir.c b/drivers/input/misc/winbond-cir.c
26276 -index 33309fe..c8f5a9a 100644
26277 ---- a/drivers/input/misc/winbond-cir.c
26278 -+++ b/drivers/input/misc/winbond-cir.c
26279 -@@ -768,7 +768,7 @@ wbcir_parse_rc6(struct device *dev, struct wbcir_data *data)
26280 - return;
26281 - }
26282 -
26283 -- dev_info(dev, "IR-RC6 ad 0x%02X cm 0x%02X cu 0x%04X "
26284 -+ dev_dbg(dev, "IR-RC6 ad 0x%02X cm 0x%02X cu 0x%04X "
26285 - "toggle %u mode %u scan 0x%08X\n",
26286 - address,
26287 - command,
26288 -diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
26289 -index 610e914..b6992b7 100644
26290 ---- a/drivers/message/fusion/mptbase.c
26291 -+++ b/drivers/message/fusion/mptbase.c
26292 -@@ -4330,6 +4330,8 @@ initChainBuffers(MPT_ADAPTER *ioc)
26293 -
26294 - if (ioc->bus_type == SPI)
26295 - num_chain *= MPT_SCSI_CAN_QUEUE;
26296 -+ else if (ioc->bus_type == SAS)
26297 -+ num_chain *= MPT_SAS_CAN_QUEUE;
26298 - else
26299 - num_chain *= MPT_FC_CAN_QUEUE;
26300 -
26301 -diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c
26302 -index f237ddb..111ea41 100644
26303 ---- a/drivers/mtd/ubi/cdev.c
26304 -+++ b/drivers/mtd/ubi/cdev.c
26305 -@@ -853,7 +853,6 @@ static long ubi_cdev_ioctl(struct file *file, unsigned int cmd,
26306 - break;
26307 - }
26308 -
26309 -- req.name[req.name_len] = '\0';
26310 - err = verify_mkvol_req(ubi, &req);
26311 - if (err)
26312 - break;
26313 -diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
26314 -index a84f1c5..511b922 100644
26315 ---- a/drivers/net/benet/be.h
26316 -+++ b/drivers/net/benet/be.h
26317 -@@ -272,8 +272,13 @@ struct be_adapter {
26318 - u32 cap;
26319 - u32 rx_fc; /* Rx flow control */
26320 - u32 tx_fc; /* Tx flow control */
26321 -+ u8 generation; /* BladeEngine ASIC generation */
26322 - };
26323 -
26324 -+/* BladeEngine Generation numbers */
26325 -+#define BE_GEN2 2
26326 -+#define BE_GEN3 3
26327 -+
26328 - extern const struct ethtool_ops be_ethtool_ops;
26329 -
26330 - #define drvr_stats(adapter) (&adapter->stats.drvr_stats)
26331 -diff --git a/drivers/net/benet/be_cmds.h b/drivers/net/benet/be_cmds.h
26332 -index e5f9676..ad33d55 100644
26333 ---- a/drivers/net/benet/be_cmds.h
26334 -+++ b/drivers/net/benet/be_cmds.h
26335 -@@ -154,7 +154,8 @@ struct be_cmd_req_hdr {
26336 - u8 domain; /* dword 0 */
26337 - u32 timeout; /* dword 1 */
26338 - u32 request_length; /* dword 2 */
26339 -- u32 rsvd; /* dword 3 */
26340 -+ u8 version; /* dword 3 */
26341 -+ u8 rsvd[3]; /* dword 3 */
26342 - };
26343 -
26344 - #define RESP_HDR_INFO_OPCODE_SHIFT 0 /* bits 0 - 7 */
26345 -diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
26346 -index 3749bb1..ec983cb 100644
26347 ---- a/drivers/net/benet/be_main.c
26348 -+++ b/drivers/net/benet/be_main.c
26349 -@@ -1944,6 +1944,7 @@ static void be_unmap_pci_bars(struct be_adapter *adapter)
26350 - static int be_map_pci_bars(struct be_adapter *adapter)
26351 - {
26352 - u8 __iomem *addr;
26353 -+ int pcicfg_reg;
26354 -
26355 - addr = ioremap_nocache(pci_resource_start(adapter->pdev, 2),
26356 - pci_resource_len(adapter->pdev, 2));
26357 -@@ -1957,8 +1958,13 @@ static int be_map_pci_bars(struct be_adapter *adapter)
26358 - goto pci_map_err;
26359 - adapter->db = addr;
26360 -
26361 -- addr = ioremap_nocache(pci_resource_start(adapter->pdev, 1),
26362 -- pci_resource_len(adapter->pdev, 1));
26363 -+ if (adapter->generation == BE_GEN2)
26364 -+ pcicfg_reg = 1;
26365 -+ else
26366 -+ pcicfg_reg = 0;
26367 -+
26368 -+ addr = ioremap_nocache(pci_resource_start(adapter->pdev, pcicfg_reg),
26369 -+ pci_resource_len(adapter->pdev, pcicfg_reg));
26370 - if (addr == NULL)
26371 - goto pci_map_err;
26372 - adapter->pcicfg = addr;
26373 -@@ -2028,6 +2034,7 @@ static int be_stats_init(struct be_adapter *adapter)
26374 - cmd->va = pci_alloc_consistent(adapter->pdev, cmd->size, &cmd->dma);
26375 - if (cmd->va == NULL)
26376 - return -1;
26377 -+ memset(cmd->va, 0, cmd->size);
26378 - return 0;
26379 - }
26380 -
26381 -@@ -2101,6 +2108,20 @@ static int __devinit be_probe(struct pci_dev *pdev,
26382 - goto rel_reg;
26383 - }
26384 - adapter = netdev_priv(netdev);
26385 -+
26386 -+ switch (pdev->device) {
26387 -+ case BE_DEVICE_ID1:
26388 -+ case OC_DEVICE_ID1:
26389 -+ adapter->generation = BE_GEN2;
26390 -+ break;
26391 -+ case BE_DEVICE_ID2:
26392 -+ case OC_DEVICE_ID2:
26393 -+ adapter->generation = BE_GEN3;
26394 -+ break;
26395 -+ default:
26396 -+ adapter->generation = 0;
26397 -+ }
26398 -+
26399 - adapter->pdev = pdev;
26400 - pci_set_drvdata(pdev, adapter);
26401 - adapter->netdev = netdev;
26402 -diff --git a/drivers/net/e1000/e1000.h b/drivers/net/e1000/e1000.h
26403 -index 42e2b7e..4a2ee85 100644
26404 ---- a/drivers/net/e1000/e1000.h
26405 -+++ b/drivers/net/e1000/e1000.h
26406 -@@ -326,6 +326,8 @@ struct e1000_adapter {
26407 - /* for ioport free */
26408 - int bars;
26409 - int need_ioport;
26410 -+
26411 -+ bool discarding;
26412 - };
26413 -
26414 - enum e1000_state_t {
26415 -diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
26416 -index bcd192c..1a23f16 100644
26417 ---- a/drivers/net/e1000/e1000_main.c
26418 -+++ b/drivers/net/e1000/e1000_main.c
26419 -@@ -1698,18 +1698,6 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
26420 - rctl &= ~E1000_RCTL_SZ_4096;
26421 - rctl |= E1000_RCTL_BSEX;
26422 - switch (adapter->rx_buffer_len) {
26423 -- case E1000_RXBUFFER_256:
26424 -- rctl |= E1000_RCTL_SZ_256;
26425 -- rctl &= ~E1000_RCTL_BSEX;
26426 -- break;
26427 -- case E1000_RXBUFFER_512:
26428 -- rctl |= E1000_RCTL_SZ_512;
26429 -- rctl &= ~E1000_RCTL_BSEX;
26430 -- break;
26431 -- case E1000_RXBUFFER_1024:
26432 -- rctl |= E1000_RCTL_SZ_1024;
26433 -- rctl &= ~E1000_RCTL_BSEX;
26434 -- break;
26435 - case E1000_RXBUFFER_2048:
26436 - default:
26437 - rctl |= E1000_RCTL_SZ_2048;
26438 -@@ -3154,13 +3142,7 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
26439 - * however with the new *_jumbo_rx* routines, jumbo receives will use
26440 - * fragmented skbs */
26441 -
26442 -- if (max_frame <= E1000_RXBUFFER_256)
26443 -- adapter->rx_buffer_len = E1000_RXBUFFER_256;
26444 -- else if (max_frame <= E1000_RXBUFFER_512)
26445 -- adapter->rx_buffer_len = E1000_RXBUFFER_512;
26446 -- else if (max_frame <= E1000_RXBUFFER_1024)
26447 -- adapter->rx_buffer_len = E1000_RXBUFFER_1024;
26448 -- else if (max_frame <= E1000_RXBUFFER_2048)
26449 -+ if (max_frame <= E1000_RXBUFFER_2048)
26450 - adapter->rx_buffer_len = E1000_RXBUFFER_2048;
26451 - else
26452 - #if (PAGE_SIZE >= E1000_RXBUFFER_16384)
26453 -@@ -3827,13 +3809,22 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
26454 -
26455 - length = le16_to_cpu(rx_desc->length);
26456 - /* !EOP means multiple descriptors were used to store a single
26457 -- * packet, also make sure the frame isn't just CRC only */
26458 -- if (unlikely(!(status & E1000_RXD_STAT_EOP) || (length <= 4))) {
26459 -+ * packet, if thats the case we need to toss it. In fact, we
26460 -+ * to toss every packet with the EOP bit clear and the next
26461 -+ * frame that _does_ have the EOP bit set, as it is by
26462 -+ * definition only a frame fragment
26463 -+ */
26464 -+ if (unlikely(!(status & E1000_RXD_STAT_EOP)))
26465 -+ adapter->discarding = true;
26466 -+
26467 -+ if (adapter->discarding) {
26468 - /* All receives must fit into a single buffer */
26469 - E1000_DBG("%s: Receive packet consumed multiple"
26470 - " buffers\n", netdev->name);
26471 - /* recycle */
26472 - buffer_info->skb = skb;
26473 -+ if (status & E1000_RXD_STAT_EOP)
26474 -+ adapter->discarding = false;
26475 - goto next_desc;
26476 - }
26477 -
26478 -diff --git a/drivers/net/e1000e/e1000.h b/drivers/net/e1000e/e1000.h
26479 -index 3e187b0..47db9bd 100644
26480 ---- a/drivers/net/e1000e/e1000.h
26481 -+++ b/drivers/net/e1000e/e1000.h
26482 -@@ -417,6 +417,7 @@ struct e1000_info {
26483 - /* CRC Stripping defines */
26484 - #define FLAG2_CRC_STRIPPING (1 << 0)
26485 - #define FLAG2_HAS_PHY_WAKEUP (1 << 1)
26486 -+#define FLAG2_IS_DISCARDING (1 << 2)
26487 -
26488 - #define E1000_RX_DESC_PS(R, i) \
26489 - (&(((union e1000_rx_desc_packet_split *)((R).desc))[i]))
26490 -diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
26491 -index fad8f9e..2154530 100644
26492 ---- a/drivers/net/e1000e/netdev.c
26493 -+++ b/drivers/net/e1000e/netdev.c
26494 -@@ -482,14 +482,24 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
26495 -
26496 - length = le16_to_cpu(rx_desc->length);
26497 -
26498 -- /* !EOP means multiple descriptors were used to store a single
26499 -- * packet, also make sure the frame isn't just CRC only */
26500 -- if (!(status & E1000_RXD_STAT_EOP) || (length <= 4)) {
26501 -+ /*
26502 -+ * !EOP means multiple descriptors were used to store a single
26503 -+ * packet, if that's the case we need to toss it. In fact, we
26504 -+ * need to toss every packet with the EOP bit clear and the
26505 -+ * next frame that _does_ have the EOP bit set, as it is by
26506 -+ * definition only a frame fragment
26507 -+ */
26508 -+ if (unlikely(!(status & E1000_RXD_STAT_EOP)))
26509 -+ adapter->flags2 |= FLAG2_IS_DISCARDING;
26510 -+
26511 -+ if (adapter->flags2 & FLAG2_IS_DISCARDING) {
26512 - /* All receives must fit into a single buffer */
26513 - e_dbg("%s: Receive packet consumed multiple buffers\n",
26514 - netdev->name);
26515 - /* recycle */
26516 - buffer_info->skb = skb;
26517 -+ if (status & E1000_RXD_STAT_EOP)
26518 -+ adapter->flags2 &= ~FLAG2_IS_DISCARDING;
26519 - goto next_desc;
26520 - }
26521 -
26522 -@@ -747,10 +757,16 @@ static bool e1000_clean_rx_irq_ps(struct e1000_adapter *adapter,
26523 - PCI_DMA_FROMDEVICE);
26524 - buffer_info->dma = 0;
26525 -
26526 -- if (!(staterr & E1000_RXD_STAT_EOP)) {
26527 -+ /* see !EOP comment in other rx routine */
26528 -+ if (!(staterr & E1000_RXD_STAT_EOP))
26529 -+ adapter->flags2 |= FLAG2_IS_DISCARDING;
26530 -+
26531 -+ if (adapter->flags2 & FLAG2_IS_DISCARDING) {
26532 - e_dbg("%s: Packet Split buffers didn't pick up the "
26533 - "full packet\n", netdev->name);
26534 - dev_kfree_skb_irq(skb);
26535 -+ if (staterr & E1000_RXD_STAT_EOP)
26536 -+ adapter->flags2 &= ~FLAG2_IS_DISCARDING;
26537 - goto next_desc;
26538 - }
26539 -
26540 -@@ -1120,6 +1136,7 @@ static void e1000_clean_rx_ring(struct e1000_adapter *adapter)
26541 -
26542 - rx_ring->next_to_clean = 0;
26543 - rx_ring->next_to_use = 0;
26544 -+ adapter->flags2 &= ~FLAG2_IS_DISCARDING;
26545 -
26546 - writel(0, adapter->hw.hw_addr + rx_ring->head);
26547 - writel(0, adapter->hw.hw_addr + rx_ring->tail);
26548 -@@ -2330,18 +2347,6 @@ static void e1000_setup_rctl(struct e1000_adapter *adapter)
26549 - rctl &= ~E1000_RCTL_SZ_4096;
26550 - rctl |= E1000_RCTL_BSEX;
26551 - switch (adapter->rx_buffer_len) {
26552 -- case 256:
26553 -- rctl |= E1000_RCTL_SZ_256;
26554 -- rctl &= ~E1000_RCTL_BSEX;
26555 -- break;
26556 -- case 512:
26557 -- rctl |= E1000_RCTL_SZ_512;
26558 -- rctl &= ~E1000_RCTL_BSEX;
26559 -- break;
26560 -- case 1024:
26561 -- rctl |= E1000_RCTL_SZ_1024;
26562 -- rctl &= ~E1000_RCTL_BSEX;
26563 -- break;
26564 - case 2048:
26565 - default:
26566 - rctl |= E1000_RCTL_SZ_2048;
26567 -@@ -4321,13 +4326,7 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
26568 - * fragmented skbs
26569 - */
26570 -
26571 -- if (max_frame <= 256)
26572 -- adapter->rx_buffer_len = 256;
26573 -- else if (max_frame <= 512)
26574 -- adapter->rx_buffer_len = 512;
26575 -- else if (max_frame <= 1024)
26576 -- adapter->rx_buffer_len = 1024;
26577 -- else if (max_frame <= 2048)
26578 -+ if (max_frame <= 2048)
26579 - adapter->rx_buffer_len = 2048;
26580 - else
26581 - adapter->rx_buffer_len = 4096;
26582 -diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c
26583 -index 6a10d7b..f3600b3 100644
26584 ---- a/drivers/net/sky2.c
26585 -+++ b/drivers/net/sky2.c
26586 -@@ -1806,7 +1806,8 @@ static void sky2_tx_complete(struct sky2_port *sky2, u16 done)
26587 - sky2->tx_cons = idx;
26588 - smp_mb();
26589 -
26590 -- if (tx_avail(sky2) > MAX_SKB_TX_LE + 4)
26591 -+ /* Wake unless it's detached, and called e.g. from sky2_down() */
26592 -+ if (tx_avail(sky2) > MAX_SKB_TX_LE + 4 && netif_device_present(dev))
26593 - netif_wake_queue(dev);
26594 - }
26595 -
26596 -diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
26597 -index a36e2b5..e65ee4d 100644
26598 ---- a/drivers/net/starfire.c
26599 -+++ b/drivers/net/starfire.c
26600 -@@ -1063,7 +1063,7 @@ static int netdev_open(struct net_device *dev)
26601 - if (retval) {
26602 - printk(KERN_ERR "starfire: Failed to load firmware \"%s\"\n",
26603 - FIRMWARE_RX);
26604 -- return retval;
26605 -+ goto out_init;
26606 - }
26607 - if (fw_rx->size % 4) {
26608 - printk(KERN_ERR "starfire: bogus length %zu in \"%s\"\n",
26609 -@@ -1108,6 +1108,9 @@ out_tx:
26610 - release_firmware(fw_tx);
26611 - out_rx:
26612 - release_firmware(fw_rx);
26613 -+out_init:
26614 -+ if (retval)
26615 -+ netdev_close(dev);
26616 - return retval;
26617 - }
26618 -
26619 -diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
26620 -index c7aa05a..0905b38 100644
26621 ---- a/drivers/net/wireless/ath/ath9k/hw.c
26622 -+++ b/drivers/net/wireless/ath/ath9k/hw.c
26623 -@@ -880,12 +880,11 @@ static void ath9k_hw_init_mode_gain_regs(struct ath_hw *ah)
26624 - }
26625 - }
26626 -
26627 --static void ath9k_hw_init_11a_eeprom_fix(struct ath_hw *ah)
26628 -+static void ath9k_hw_init_eeprom_fix(struct ath_hw *ah)
26629 - {
26630 - u32 i, j;
26631 -
26632 -- if ((ah->hw_version.devid == AR9280_DEVID_PCI) &&
26633 -- test_bit(ATH9K_MODE_11A, ah->caps.wireless_modes)) {
26634 -+ if (ah->hw_version.devid == AR9280_DEVID_PCI) {
26635 -
26636 - /* EEPROM Fixup */
26637 - for (i = 0; i < ah->iniModes.ia_rows; i++) {
26638 -@@ -980,7 +979,7 @@ int ath9k_hw_init(struct ath_hw *ah)
26639 -
26640 - ath9k_hw_init_mode_gain_regs(ah);
26641 - ath9k_hw_fill_cap_info(ah);
26642 -- ath9k_hw_init_11a_eeprom_fix(ah);
26643 -+ ath9k_hw_init_eeprom_fix(ah);
26644 -
26645 - r = ath9k_hw_init_macaddr(ah);
26646 - if (r) {
26647 -diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
26648 -index 80df8f3..5864eaa 100644
26649 ---- a/drivers/net/wireless/ath/ath9k/main.c
26650 -+++ b/drivers/net/wireless/ath/ath9k/main.c
26651 -@@ -2285,10 +2285,10 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
26652 - (sc->sc_ah->opmode == NL80211_IFTYPE_MESH_POINT)) {
26653 - ath9k_ps_wakeup(sc);
26654 - ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq);
26655 -- ath_beacon_return(sc, avp);
26656 - ath9k_ps_restore(sc);
26657 - }
26658 -
26659 -+ ath_beacon_return(sc, avp);
26660 - sc->sc_flags &= ~SC_OP_BEACONS;
26661 -
26662 - for (i = 0; i < ARRAY_SIZE(sc->beacon.bslot); i++) {
26663 -diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
26664 -index 81726ee..0eb2591 100644
26665 ---- a/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
26666 -+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rs.c
26667 -@@ -2808,7 +2808,7 @@ static void rs_fill_link_cmd(struct iwl_priv *priv,
26668 - repeat_rate--;
26669 - }
26670 -
26671 -- lq_cmd->agg_params.agg_frame_cnt_limit = LINK_QUAL_AGG_FRAME_LIMIT_MAX;
26672 -+ lq_cmd->agg_params.agg_frame_cnt_limit = LINK_QUAL_AGG_FRAME_LIMIT_DEF;
26673 - lq_cmd->agg_params.agg_dis_start_th = LINK_QUAL_AGG_DISABLE_START_DEF;
26674 - lq_cmd->agg_params.agg_time_limit =
26675 - cpu_to_le16(LINK_QUAL_AGG_TIME_LIMIT_DEF);
26676 -diff --git a/drivers/regulator/wm8350-regulator.c b/drivers/regulator/wm8350-regulator.c
26677 -index 768bd0e..43ed81e 100644
26678 ---- a/drivers/regulator/wm8350-regulator.c
26679 -+++ b/drivers/regulator/wm8350-regulator.c
26680 -@@ -1504,7 +1504,8 @@ int wm8350_register_led(struct wm8350 *wm8350, int lednum, int dcdc, int isink,
26681 - led->isink_init.consumer_supplies = &led->isink_consumer;
26682 - led->isink_init.constraints.min_uA = 0;
26683 - led->isink_init.constraints.max_uA = pdata->max_uA;
26684 -- led->isink_init.constraints.valid_ops_mask = REGULATOR_CHANGE_CURRENT;
26685 -+ led->isink_init.constraints.valid_ops_mask
26686 -+ = REGULATOR_CHANGE_CURRENT | REGULATOR_CHANGE_STATUS;
26687 - led->isink_init.constraints.valid_modes_mask = REGULATOR_MODE_NORMAL;
26688 - ret = wm8350_register_regulator(wm8350, isink, &led->isink_init);
26689 - if (ret != 0) {
26690 -@@ -1517,6 +1518,7 @@ int wm8350_register_led(struct wm8350 *wm8350, int lednum, int dcdc, int isink,
26691 - led->dcdc_init.num_consumer_supplies = 1;
26692 - led->dcdc_init.consumer_supplies = &led->dcdc_consumer;
26693 - led->dcdc_init.constraints.valid_modes_mask = REGULATOR_MODE_NORMAL;
26694 -+ led->dcdc_init.constraints.valid_ops_mask = REGULATOR_CHANGE_STATUS;
26695 - ret = wm8350_register_regulator(wm8350, dcdc, &led->dcdc_init);
26696 - if (ret != 0) {
26697 - platform_device_put(pdev);
26698 -diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
26699 -index aaccc8e..513dec9 100644
26700 ---- a/drivers/s390/block/dasd.c
26701 -+++ b/drivers/s390/block/dasd.c
26702 -@@ -1005,8 +1005,8 @@ static void dasd_handle_killed_request(struct ccw_device *cdev,
26703 - if (device == NULL ||
26704 - device != dasd_device_from_cdev_locked(cdev) ||
26705 - strncmp(device->discipline->ebcname, (char *) &cqr->magic, 4)) {
26706 -- DBF_DEV_EVENT(DBF_DEBUG, device, "invalid device in request: "
26707 -- "bus_id %s", dev_name(&cdev->dev));
26708 -+ DBF_EVENT_DEVID(DBF_DEBUG, cdev, "%s",
26709 -+ "invalid device in request");
26710 - return;
26711 - }
26712 -
26713 -@@ -1078,8 +1078,8 @@ void dasd_int_handler(struct ccw_device *cdev, unsigned long intparm,
26714 - device = (struct dasd_device *) cqr->startdev;
26715 - if (!device ||
26716 - strncmp(device->discipline->ebcname, (char *) &cqr->magic, 4)) {
26717 -- DBF_DEV_EVENT(DBF_DEBUG, device, "invalid device in request: "
26718 -- "bus_id %s", dev_name(&cdev->dev));
26719 -+ DBF_EVENT_DEVID(DBF_DEBUG, cdev, "%s",
26720 -+ "invalid device in request");
26721 - return;
26722 - }
26723 -
26724 -diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
26725 -index 417b97c..80c205b 100644
26726 ---- a/drivers/s390/block/dasd_eckd.c
26727 -+++ b/drivers/s390/block/dasd_eckd.c
26728 -@@ -2980,7 +2980,7 @@ static void dasd_eckd_dump_sense_ccw(struct dasd_device *device,
26729 - len += sprintf(page + len, KERN_ERR PRINTK_HEADER
26730 - " in req: %p CS: 0x%02X DS: 0x%02X CC: 0x%02X RC: %d\n",
26731 - req, scsw_cstat(&irb->scsw), scsw_dstat(&irb->scsw),
26732 -- scsw_cc(&irb->scsw), req->intrc);
26733 -+ scsw_cc(&irb->scsw), req ? req->intrc : 0);
26734 - len += sprintf(page + len, KERN_ERR PRINTK_HEADER
26735 - " device %s: Failing CCW: %p\n",
26736 - dev_name(&device->cdev->dev),
26737 -diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c
26738 -index f756a1b..a5354b8 100644
26739 ---- a/drivers/s390/block/dasd_ioctl.c
26740 -+++ b/drivers/s390/block/dasd_ioctl.c
26741 -@@ -260,7 +260,7 @@ static int dasd_ioctl_information(struct dasd_block *block,
26742 - struct ccw_dev_id dev_id;
26743 -
26744 - base = block->base;
26745 -- if (!base->discipline->fill_info)
26746 -+ if (!base->discipline || !base->discipline->fill_info)
26747 - return -EINVAL;
26748 -
26749 - dasd_info = kzalloc(sizeof(struct dasd_information2_t), GFP_KERNEL);
26750 -@@ -303,10 +303,7 @@ static int dasd_ioctl_information(struct dasd_block *block,
26751 - dasd_info->features |=
26752 - ((base->features & DASD_FEATURE_READONLY) != 0);
26753 -
26754 -- if (base->discipline)
26755 -- memcpy(dasd_info->type, base->discipline->name, 4);
26756 -- else
26757 -- memcpy(dasd_info->type, "none", 4);
26758 -+ memcpy(dasd_info->type, base->discipline->name, 4);
26759 -
26760 - if (block->request_queue->request_fn) {
26761 - struct list_head *l;
26762 -diff --git a/drivers/s390/block/dasd_proc.c b/drivers/s390/block/dasd_proc.c
26763 -index 654daa3..f9d7d38 100644
26764 ---- a/drivers/s390/block/dasd_proc.c
26765 -+++ b/drivers/s390/block/dasd_proc.c
26766 -@@ -71,7 +71,7 @@ dasd_devices_show(struct seq_file *m, void *v)
26767 - /* Print device number. */
26768 - seq_printf(m, "%s", dev_name(&device->cdev->dev));
26769 - /* Print discipline string. */
26770 -- if (device != NULL && device->discipline != NULL)
26771 -+ if (device->discipline != NULL)
26772 - seq_printf(m, "(%s)", device->discipline->name);
26773 - else
26774 - seq_printf(m, "(none)");
26775 -@@ -91,10 +91,7 @@ dasd_devices_show(struct seq_file *m, void *v)
26776 - substr = (device->features & DASD_FEATURE_READONLY) ? "(ro)" : " ";
26777 - seq_printf(m, "%4s: ", substr);
26778 - /* Print device status information. */
26779 -- switch ((device != NULL) ? device->state : -1) {
26780 -- case -1:
26781 -- seq_printf(m, "unknown");
26782 -- break;
26783 -+ switch (device->state) {
26784 - case DASD_STATE_NEW:
26785 - seq_printf(m, "new");
26786 - break;
26787 -diff --git a/drivers/s390/crypto/zcrypt_pcicc.c b/drivers/s390/crypto/zcrypt_pcicc.c
26788 -index f4b0c47..7f1e3ba 100644
26789 ---- a/drivers/s390/crypto/zcrypt_pcicc.c
26790 -+++ b/drivers/s390/crypto/zcrypt_pcicc.c
26791 -@@ -373,6 +373,8 @@ static int convert_type86(struct zcrypt_device *zdev,
26792 - zdev->max_mod_size = PCICC_MAX_MOD_SIZE_OLD;
26793 - return -EAGAIN;
26794 - }
26795 -+ if (service_rc == 8 && service_rs == 72)
26796 -+ return -EINVAL;
26797 - zdev->online = 0;
26798 - return -EAGAIN; /* repeat the request on a different device. */
26799 - }
26800 -diff --git a/drivers/s390/crypto/zcrypt_pcixcc.c b/drivers/s390/crypto/zcrypt_pcixcc.c
26801 -index 5677b40..1f9e923 100644
26802 ---- a/drivers/s390/crypto/zcrypt_pcixcc.c
26803 -+++ b/drivers/s390/crypto/zcrypt_pcixcc.c
26804 -@@ -462,6 +462,8 @@ static int convert_type86_ica(struct zcrypt_device *zdev,
26805 - }
26806 - if (service_rc == 12 && service_rs == 769)
26807 - return -EINVAL;
26808 -+ if (service_rc == 8 && service_rs == 72)
26809 -+ return -EINVAL;
26810 - zdev->online = 0;
26811 - return -EAGAIN; /* repeat the request on a different device. */
26812 - }
26813 -diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
26814 -index 5987da8..bc9a881 100644
26815 ---- a/drivers/scsi/scsi_lib.c
26816 -+++ b/drivers/scsi/scsi_lib.c
26817 -@@ -749,9 +749,9 @@ void scsi_io_completion(struct scsi_cmnd *cmd, unsigned int good_bytes)
26818 - */
26819 - req->next_rq->resid_len = scsi_in(cmd)->resid;
26820 -
26821 -+ scsi_release_buffers(cmd);
26822 - blk_end_request_all(req, 0);
26823 -
26824 -- scsi_release_buffers(cmd);
26825 - scsi_next_command(cmd);
26826 - return;
26827 - }
26828 -diff --git a/drivers/serial/uartlite.c b/drivers/serial/uartlite.c
26829 -index 377f271..ab2ab3c 100644
26830 ---- a/drivers/serial/uartlite.c
26831 -+++ b/drivers/serial/uartlite.c
26832 -@@ -394,7 +394,7 @@ static void ulite_console_write(struct console *co, const char *s,
26833 - spin_unlock_irqrestore(&port->lock, flags);
26834 - }
26835 -
26836 --static int __init ulite_console_setup(struct console *co, char *options)
26837 -+static int __devinit ulite_console_setup(struct console *co, char *options)
26838 - {
26839 - struct uart_port *port;
26840 - int baud = 9600;
26841 -diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
26842 -index e33d362..5b56f53 100644
26843 ---- a/drivers/usb/host/r8a66597-hcd.c
26844 -+++ b/drivers/usb/host/r8a66597-hcd.c
26845 -@@ -216,8 +216,17 @@ static void disable_controller(struct r8a66597 *r8a66597)
26846 - {
26847 - int port;
26848 -
26849 -+ /* disable interrupts */
26850 - r8a66597_write(r8a66597, 0, INTENB0);
26851 -- r8a66597_write(r8a66597, 0, INTSTS0);
26852 -+ r8a66597_write(r8a66597, 0, INTENB1);
26853 -+ r8a66597_write(r8a66597, 0, BRDYENB);
26854 -+ r8a66597_write(r8a66597, 0, BEMPENB);
26855 -+ r8a66597_write(r8a66597, 0, NRDYENB);
26856 -+
26857 -+ /* clear status */
26858 -+ r8a66597_write(r8a66597, 0, BRDYSTS);
26859 -+ r8a66597_write(r8a66597, 0, NRDYSTS);
26860 -+ r8a66597_write(r8a66597, 0, BEMPSTS);
26861 -
26862 - for (port = 0; port < r8a66597->max_root_hub; port++)
26863 - r8a66597_disable_port(r8a66597, port);
26864 -@@ -2470,6 +2479,12 @@ static int __devinit r8a66597_probe(struct platform_device *pdev)
26865 - r8a66597->rh_timer.data = (unsigned long)r8a66597;
26866 - r8a66597->reg = (unsigned long)reg;
26867 -
26868 -+ /* make sure no interrupts are pending */
26869 -+ ret = r8a66597_clock_enable(r8a66597);
26870 -+ if (ret < 0)
26871 -+ goto clean_up3;
26872 -+ disable_controller(r8a66597);
26873 -+
26874 - for (i = 0; i < R8A66597_MAX_NUM_PIPE; i++) {
26875 - INIT_LIST_HEAD(&r8a66597->pipe_queue[i]);
26876 - init_timer(&r8a66597->td_timer[i]);
26877 -diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c
26878 -index 66358fa..b4b6dec 100644
26879 ---- a/drivers/video/imxfb.c
26880 -+++ b/drivers/video/imxfb.c
26881 -@@ -593,7 +593,8 @@ static int imxfb_activate_var(struct fb_var_screeninfo *var, struct fb_info *inf
26882 - */
26883 - static int imxfb_suspend(struct platform_device *dev, pm_message_t state)
26884 - {
26885 -- struct imxfb_info *fbi = platform_get_drvdata(dev);
26886 -+ struct fb_info *info = platform_get_drvdata(dev);
26887 -+ struct imxfb_info *fbi = info->par;
26888 -
26889 - pr_debug("%s\n", __func__);
26890 -
26891 -@@ -603,7 +604,8 @@ static int imxfb_suspend(struct platform_device *dev, pm_message_t state)
26892 -
26893 - static int imxfb_resume(struct platform_device *dev)
26894 - {
26895 -- struct imxfb_info *fbi = platform_get_drvdata(dev);
26896 -+ struct fb_info *info = platform_get_drvdata(dev);
26897 -+ struct imxfb_info *fbi = info->par;
26898 -
26899 - pr_debug("%s\n", __func__);
26900 -
26901 -diff --git a/drivers/video/mx3fb.c b/drivers/video/mx3fb.c
26902 -index 054ef29..772ba3f 100644
26903 ---- a/drivers/video/mx3fb.c
26904 -+++ b/drivers/video/mx3fb.c
26905 -@@ -324,8 +324,11 @@ static void sdc_enable_channel(struct mx3fb_info *mx3_fbi)
26906 - unsigned long flags;
26907 - dma_cookie_t cookie;
26908 -
26909 -- dev_dbg(mx3fb->dev, "mx3fbi %p, desc %p, sg %p\n", mx3_fbi,
26910 -- to_tx_desc(mx3_fbi->txd), to_tx_desc(mx3_fbi->txd)->sg);
26911 -+ if (mx3_fbi->txd)
26912 -+ dev_dbg(mx3fb->dev, "mx3fbi %p, desc %p, sg %p\n", mx3_fbi,
26913 -+ to_tx_desc(mx3_fbi->txd), to_tx_desc(mx3_fbi->txd)->sg);
26914 -+ else
26915 -+ dev_dbg(mx3fb->dev, "mx3fbi %p, txd = NULL\n", mx3_fbi);
26916 -
26917 - /* This enables the channel */
26918 - if (mx3_fbi->cookie < 0) {
26919 -@@ -646,6 +649,7 @@ static int sdc_set_global_alpha(struct mx3fb_data *mx3fb, bool enable, uint8_t a
26920 -
26921 - static void sdc_set_brightness(struct mx3fb_data *mx3fb, uint8_t value)
26922 - {
26923 -+ dev_dbg(mx3fb->dev, "%s: value = %d\n", __func__, value);
26924 - /* This might be board-specific */
26925 - mx3fb_write_reg(mx3fb, 0x03000000UL | value << 16, SDC_PWM_CTRL);
26926 - return;
26927 -@@ -1486,12 +1490,12 @@ static int mx3fb_probe(struct platform_device *pdev)
26928 - goto ersdc0;
26929 - }
26930 -
26931 -+ mx3fb->backlight_level = 255;
26932 -+
26933 - ret = init_fb_chan(mx3fb, to_idmac_chan(chan));
26934 - if (ret < 0)
26935 - goto eisdc0;
26936 -
26937 -- mx3fb->backlight_level = 255;
26938 --
26939 - return 0;
26940 -
26941 - eisdc0:
26942 -diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c
26943 -index 14a8644..69357c0 100644
26944 ---- a/fs/9p/vfs_super.c
26945 -+++ b/fs/9p/vfs_super.c
26946 -@@ -188,7 +188,8 @@ static void v9fs_kill_super(struct super_block *s)
26947 -
26948 - P9_DPRINTK(P9_DEBUG_VFS, " %p\n", s);
26949 -
26950 -- v9fs_dentry_release(s->s_root); /* clunk root */
26951 -+ if (s->s_root)
26952 -+ v9fs_dentry_release(s->s_root); /* clunk root */
26953 -
26954 - kill_anon_super(s);
26955 -
26956 -diff --git a/fs/affs/affs.h b/fs/affs/affs.h
26957 -index e511dc6..0e40caa 100644
26958 ---- a/fs/affs/affs.h
26959 -+++ b/fs/affs/affs.h
26960 -@@ -106,8 +106,8 @@ struct affs_sb_info {
26961 - u32 s_last_bmap;
26962 - struct buffer_head *s_bmap_bh;
26963 - char *s_prefix; /* Prefix for volumes and assigns. */
26964 -- int s_prefix_len; /* Length of prefix. */
26965 - char s_volume[32]; /* Volume prefix for absolute symlinks. */
26966 -+ spinlock_t symlink_lock; /* protects the previous two */
26967 - };
26968 -
26969 - #define SF_INTL 0x0001 /* International filesystem. */
26970 -diff --git a/fs/affs/namei.c b/fs/affs/namei.c
26971 -index 960d336..d70bbba 100644
26972 ---- a/fs/affs/namei.c
26973 -+++ b/fs/affs/namei.c
26974 -@@ -341,10 +341,13 @@ affs_symlink(struct inode *dir, struct dentry *dentry, const char *symname)
26975 - p = (char *)AFFS_HEAD(bh)->table;
26976 - lc = '/';
26977 - if (*symname == '/') {
26978 -+ struct affs_sb_info *sbi = AFFS_SB(sb);
26979 - while (*symname == '/')
26980 - symname++;
26981 -- while (AFFS_SB(sb)->s_volume[i]) /* Cannot overflow */
26982 -- *p++ = AFFS_SB(sb)->s_volume[i++];
26983 -+ spin_lock(&sbi->symlink_lock);
26984 -+ while (sbi->s_volume[i]) /* Cannot overflow */
26985 -+ *p++ = sbi->s_volume[i++];
26986 -+ spin_unlock(&sbi->symlink_lock);
26987 - }
26988 - while (i < maxlen && (c = *symname++)) {
26989 - if (c == '.' && lc == '/' && *symname == '.' && symname[1] == '/') {
26990 -diff --git a/fs/affs/super.c b/fs/affs/super.c
26991 -index 104fdcb..d41e967 100644
26992 ---- a/fs/affs/super.c
26993 -+++ b/fs/affs/super.c
26994 -@@ -203,7 +203,7 @@ parse_options(char *options, uid_t *uid, gid_t *gid, int *mode, int *reserved, s
26995 - switch (token) {
26996 - case Opt_bs:
26997 - if (match_int(&args[0], &n))
26998 -- return -EINVAL;
26999 -+ return 0;
27000 - if (n != 512 && n != 1024 && n != 2048
27001 - && n != 4096) {
27002 - printk ("AFFS: Invalid blocksize (512, 1024, 2048, 4096 allowed)\n");
27003 -@@ -213,7 +213,7 @@ parse_options(char *options, uid_t *uid, gid_t *gid, int *mode, int *reserved, s
27004 - break;
27005 - case Opt_mode:
27006 - if (match_octal(&args[0], &option))
27007 -- return 1;
27008 -+ return 0;
27009 - *mode = option & 0777;
27010 - *mount_opts |= SF_SETMODE;
27011 - break;
27012 -@@ -221,8 +221,6 @@ parse_options(char *options, uid_t *uid, gid_t *gid, int *mode, int *reserved, s
27013 - *mount_opts |= SF_MUFS;
27014 - break;
27015 - case Opt_prefix:
27016 -- /* Free any previous prefix */
27017 -- kfree(*prefix);
27018 - *prefix = match_strdup(&args[0]);
27019 - if (!*prefix)
27020 - return 0;
27021 -@@ -233,21 +231,21 @@ parse_options(char *options, uid_t *uid, gid_t *gid, int *mode, int *reserved, s
27022 - break;
27023 - case Opt_reserved:
27024 - if (match_int(&args[0], reserved))
27025 -- return 1;
27026 -+ return 0;
27027 - break;
27028 - case Opt_root:
27029 - if (match_int(&args[0], root))
27030 -- return 1;
27031 -+ return 0;
27032 - break;
27033 - case Opt_setgid:
27034 - if (match_int(&args[0], &option))
27035 -- return 1;
27036 -+ return 0;
27037 - *gid = option;
27038 - *mount_opts |= SF_SETGID;
27039 - break;
27040 - case Opt_setuid:
27041 - if (match_int(&args[0], &option))
27042 -- return -EINVAL;
27043 -+ return 0;
27044 - *uid = option;
27045 - *mount_opts |= SF_SETUID;
27046 - break;
27047 -@@ -311,11 +309,14 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent)
27048 - return -ENOMEM;
27049 - sb->s_fs_info = sbi;
27050 - mutex_init(&sbi->s_bmlock);
27051 -+ spin_lock_init(&sbi->symlink_lock);
27052 -
27053 - if (!parse_options(data,&uid,&gid,&i,&reserved,&root_block,
27054 - &blocksize,&sbi->s_prefix,
27055 - sbi->s_volume, &mount_flags)) {
27056 - printk(KERN_ERR "AFFS: Error parsing options\n");
27057 -+ kfree(sbi->s_prefix);
27058 -+ kfree(sbi);
27059 - return -EINVAL;
27060 - }
27061 - /* N.B. after this point s_prefix must be released */
27062 -@@ -516,14 +517,18 @@ affs_remount(struct super_block *sb, int *flags, char *data)
27063 - unsigned long mount_flags;
27064 - int res = 0;
27065 - char *new_opts = kstrdup(data, GFP_KERNEL);
27066 -+ char volume[32];
27067 -+ char *prefix = NULL;
27068 -
27069 - pr_debug("AFFS: remount(flags=0x%x,opts=\"%s\")\n",*flags,data);
27070 -
27071 - *flags |= MS_NODIRATIME;
27072 -
27073 -+ memcpy(volume, sbi->s_volume, 32);
27074 - if (!parse_options(data, &uid, &gid, &mode, &reserved, &root_block,
27075 -- &blocksize, &sbi->s_prefix, sbi->s_volume,
27076 -+ &blocksize, &prefix, volume,
27077 - &mount_flags)) {
27078 -+ kfree(prefix);
27079 - kfree(new_opts);
27080 - return -EINVAL;
27081 - }
27082 -@@ -534,6 +539,14 @@ affs_remount(struct super_block *sb, int *flags, char *data)
27083 - sbi->s_mode = mode;
27084 - sbi->s_uid = uid;
27085 - sbi->s_gid = gid;
27086 -+ /* protect against readers */
27087 -+ spin_lock(&sbi->symlink_lock);
27088 -+ if (prefix) {
27089 -+ kfree(sbi->s_prefix);
27090 -+ sbi->s_prefix = prefix;
27091 -+ }
27092 -+ memcpy(sbi->s_volume, volume, 32);
27093 -+ spin_unlock(&sbi->symlink_lock);
27094 -
27095 - if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY)) {
27096 - unlock_kernel();
27097 -diff --git a/fs/affs/symlink.c b/fs/affs/symlink.c
27098 -index 4178253..ee00f08 100644
27099 ---- a/fs/affs/symlink.c
27100 -+++ b/fs/affs/symlink.c
27101 -@@ -20,7 +20,6 @@ static int affs_symlink_readpage(struct file *file, struct page *page)
27102 - int i, j;
27103 - char c;
27104 - char lc;
27105 -- char *pf;
27106 -
27107 - pr_debug("AFFS: follow_link(ino=%lu)\n",inode->i_ino);
27108 -
27109 -@@ -32,11 +31,15 @@ static int affs_symlink_readpage(struct file *file, struct page *page)
27110 - j = 0;
27111 - lf = (struct slink_front *)bh->b_data;
27112 - lc = 0;
27113 -- pf = AFFS_SB(inode->i_sb)->s_prefix ? AFFS_SB(inode->i_sb)->s_prefix : "/";
27114 -
27115 - if (strchr(lf->symname,':')) { /* Handle assign or volume name */
27116 -+ struct affs_sb_info *sbi = AFFS_SB(inode->i_sb);
27117 -+ char *pf;
27118 -+ spin_lock(&sbi->symlink_lock);
27119 -+ pf = sbi->s_prefix ? sbi->s_prefix : "/";
27120 - while (i < 1023 && (c = pf[i]))
27121 - link[i++] = c;
27122 -+ spin_unlock(&sbi->symlink_lock);
27123 - while (i < 1023 && lf->symname[j] != ':')
27124 - link[i++] = lf->symname[j++];
27125 - if (i < 1023)
27126 -diff --git a/fs/bfs/inode.c b/fs/bfs/inode.c
27127 -index 6f60336..8f3d9fd 100644
27128 ---- a/fs/bfs/inode.c
27129 -+++ b/fs/bfs/inode.c
27130 -@@ -353,35 +353,35 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
27131 - struct inode *inode;
27132 - unsigned i, imap_len;
27133 - struct bfs_sb_info *info;
27134 -- long ret = -EINVAL;
27135 -+ int ret = -EINVAL;
27136 - unsigned long i_sblock, i_eblock, i_eoff, s_size;
27137 -
27138 - info = kzalloc(sizeof(*info), GFP_KERNEL);
27139 - if (!info)
27140 - return -ENOMEM;
27141 -+ mutex_init(&info->bfs_lock);
27142 - s->s_fs_info = info;
27143 -
27144 - sb_set_blocksize(s, BFS_BSIZE);
27145 -
27146 -- bh = sb_bread(s, 0);
27147 -- if(!bh)
27148 -+ info->si_sbh = sb_bread(s, 0);
27149 -+ if (!info->si_sbh)
27150 - goto out;
27151 -- bfs_sb = (struct bfs_super_block *)bh->b_data;
27152 -+ bfs_sb = (struct bfs_super_block *)info->si_sbh->b_data;
27153 - if (le32_to_cpu(bfs_sb->s_magic) != BFS_MAGIC) {
27154 - if (!silent)
27155 - printf("No BFS filesystem on %s (magic=%08x)\n",
27156 - s->s_id, le32_to_cpu(bfs_sb->s_magic));
27157 -- goto out;
27158 -+ goto out1;
27159 - }
27160 - if (BFS_UNCLEAN(bfs_sb, s) && !silent)
27161 - printf("%s is unclean, continuing\n", s->s_id);
27162 -
27163 - s->s_magic = BFS_MAGIC;
27164 -- info->si_sbh = bh;
27165 -
27166 - if (le32_to_cpu(bfs_sb->s_start) > le32_to_cpu(bfs_sb->s_end)) {
27167 - printf("Superblock is corrupted\n");
27168 -- goto out;
27169 -+ goto out1;
27170 - }
27171 -
27172 - info->si_lasti = (le32_to_cpu(bfs_sb->s_start) - BFS_BSIZE) /
27173 -@@ -390,7 +390,7 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
27174 - imap_len = (info->si_lasti / 8) + 1;
27175 - info->si_imap = kzalloc(imap_len, GFP_KERNEL);
27176 - if (!info->si_imap)
27177 -- goto out;
27178 -+ goto out1;
27179 - for (i = 0; i < BFS_ROOT_INO; i++)
27180 - set_bit(i, info->si_imap);
27181 -
27182 -@@ -398,15 +398,13 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
27183 - inode = bfs_iget(s, BFS_ROOT_INO);
27184 - if (IS_ERR(inode)) {
27185 - ret = PTR_ERR(inode);
27186 -- kfree(info->si_imap);
27187 -- goto out;
27188 -+ goto out2;
27189 - }
27190 - s->s_root = d_alloc_root(inode);
27191 - if (!s->s_root) {
27192 - iput(inode);
27193 - ret = -ENOMEM;
27194 -- kfree(info->si_imap);
27195 -- goto out;
27196 -+ goto out2;
27197 - }
27198 -
27199 - info->si_blocks = (le32_to_cpu(bfs_sb->s_end) + 1) >> BFS_BSIZE_BITS;
27200 -@@ -419,10 +417,8 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
27201 - bh = sb_bread(s, info->si_blocks - 1);
27202 - if (!bh) {
27203 - printf("Last block not available: %lu\n", info->si_blocks - 1);
27204 -- iput(inode);
27205 - ret = -EIO;
27206 -- kfree(info->si_imap);
27207 -- goto out;
27208 -+ goto out3;
27209 - }
27210 - brelse(bh);
27211 -
27212 -@@ -459,11 +455,8 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
27213 - printf("Inode 0x%08x corrupted\n", i);
27214 -
27215 - brelse(bh);
27216 -- s->s_root = NULL;
27217 -- kfree(info->si_imap);
27218 -- kfree(info);
27219 -- s->s_fs_info = NULL;
27220 -- return -EIO;
27221 -+ ret = -EIO;
27222 -+ goto out3;
27223 - }
27224 -
27225 - if (!di->i_ino) {
27226 -@@ -483,11 +476,17 @@ static int bfs_fill_super(struct super_block *s, void *data, int silent)
27227 - s->s_dirt = 1;
27228 - }
27229 - dump_imap("read_super", s);
27230 -- mutex_init(&info->bfs_lock);
27231 - return 0;
27232 -
27233 -+out3:
27234 -+ dput(s->s_root);
27235 -+ s->s_root = NULL;
27236 -+out2:
27237 -+ kfree(info->si_imap);
27238 -+out1:
27239 -+ brelse(info->si_sbh);
27240 - out:
27241 -- brelse(bh);
27242 -+ mutex_destroy(&info->bfs_lock);
27243 - kfree(info);
27244 - s->s_fs_info = NULL;
27245 - return ret;
27246 -diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c
27247 -index b639dcf..0133b5a 100644
27248 ---- a/fs/binfmt_aout.c
27249 -+++ b/fs/binfmt_aout.c
27250 -@@ -263,6 +263,7 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs)
27251 - #else
27252 - set_personality(PER_LINUX);
27253 - #endif
27254 -+ setup_new_exec(bprm);
27255 -
27256 - current->mm->end_code = ex.a_text +
27257 - (current->mm->start_code = N_TXTADDR(ex));
27258 -diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c
27259 -index b9b3bb5..1ed37ba 100644
27260 ---- a/fs/binfmt_elf.c
27261 -+++ b/fs/binfmt_elf.c
27262 -@@ -662,27 +662,6 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
27263 - if (elf_interpreter[elf_ppnt->p_filesz - 1] != '\0')
27264 - goto out_free_interp;
27265 -
27266 -- /*
27267 -- * The early SET_PERSONALITY here is so that the lookup
27268 -- * for the interpreter happens in the namespace of the
27269 -- * to-be-execed image. SET_PERSONALITY can select an
27270 -- * alternate root.
27271 -- *
27272 -- * However, SET_PERSONALITY is NOT allowed to switch
27273 -- * this task into the new images's memory mapping
27274 -- * policy - that is, TASK_SIZE must still evaluate to
27275 -- * that which is appropriate to the execing application.
27276 -- * This is because exit_mmap() needs to have TASK_SIZE
27277 -- * evaluate to the size of the old image.
27278 -- *
27279 -- * So if (say) a 64-bit application is execing a 32-bit
27280 -- * application it is the architecture's responsibility
27281 -- * to defer changing the value of TASK_SIZE until the
27282 -- * switch really is going to happen - do this in
27283 -- * flush_thread(). - akpm
27284 -- */
27285 -- SET_PERSONALITY(loc->elf_ex);
27286 --
27287 - interpreter = open_exec(elf_interpreter);
27288 - retval = PTR_ERR(interpreter);
27289 - if (IS_ERR(interpreter))
27290 -@@ -730,9 +709,6 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
27291 - /* Verify the interpreter has a valid arch */
27292 - if (!elf_check_arch(&loc->interp_elf_ex))
27293 - goto out_free_dentry;
27294 -- } else {
27295 -- /* Executables without an interpreter also need a personality */
27296 -- SET_PERSONALITY(loc->elf_ex);
27297 - }
27298 -
27299 - /* Flush all traces of the currently running executable */
27300 -@@ -752,7 +728,8 @@ static int load_elf_binary(struct linux_binprm *bprm, struct pt_regs *regs)
27301 -
27302 - if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space)
27303 - current->flags |= PF_RANDOMIZE;
27304 -- arch_pick_mmap_layout(current->mm);
27305 -+
27306 -+ setup_new_exec(bprm);
27307 -
27308 - /* Do this so that we can load the interpreter, if need be. We will
27309 - change some of these later */
27310 -diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
27311 -index 38502c6..e7a0bb4 100644
27312 ---- a/fs/binfmt_elf_fdpic.c
27313 -+++ b/fs/binfmt_elf_fdpic.c
27314 -@@ -171,6 +171,9 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm,
27315 - #ifdef ELF_FDPIC_PLAT_INIT
27316 - unsigned long dynaddr;
27317 - #endif
27318 -+#ifndef CONFIG_MMU
27319 -+ unsigned long stack_prot;
27320 -+#endif
27321 - struct file *interpreter = NULL; /* to shut gcc up */
27322 - char *interpreter_name = NULL;
27323 - int executable_stack;
27324 -@@ -316,6 +319,11 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm,
27325 - * defunct, deceased, etc. after this point we have to exit via
27326 - * error_kill */
27327 - set_personality(PER_LINUX_FDPIC);
27328 -+ if (elf_read_implies_exec(&exec_params.hdr, executable_stack))
27329 -+ current->personality |= READ_IMPLIES_EXEC;
27330 -+
27331 -+ setup_new_exec(bprm);
27332 -+
27333 - set_binfmt(&elf_fdpic_format);
27334 -
27335 - current->mm->start_code = 0;
27336 -@@ -377,9 +385,13 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm,
27337 - if (stack_size < PAGE_SIZE * 2)
27338 - stack_size = PAGE_SIZE * 2;
27339 -
27340 -+ stack_prot = PROT_READ | PROT_WRITE;
27341 -+ if (executable_stack == EXSTACK_ENABLE_X ||
27342 -+ (executable_stack == EXSTACK_DEFAULT && VM_STACK_FLAGS & VM_EXEC))
27343 -+ stack_prot |= PROT_EXEC;
27344 -+
27345 - down_write(&current->mm->mmap_sem);
27346 -- current->mm->start_brk = do_mmap(NULL, 0, stack_size,
27347 -- PROT_READ | PROT_WRITE | PROT_EXEC,
27348 -+ current->mm->start_brk = do_mmap(NULL, 0, stack_size, stack_prot,
27349 - MAP_PRIVATE | MAP_ANONYMOUS | MAP_GROWSDOWN,
27350 - 0);
27351 -
27352 -diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
27353 -index a279665..ca88c46 100644
27354 ---- a/fs/binfmt_flat.c
27355 -+++ b/fs/binfmt_flat.c
27356 -@@ -519,6 +519,7 @@ static int load_flat_file(struct linux_binprm * bprm,
27357 -
27358 - /* OK, This is the point of no return */
27359 - set_personality(PER_LINUX_32BIT);
27360 -+ setup_new_exec(bprm);
27361 - }
27362 -
27363 - /*
27364 -diff --git a/fs/binfmt_som.c b/fs/binfmt_som.c
27365 -index eff74b9..35cf002 100644
27366 ---- a/fs/binfmt_som.c
27367 -+++ b/fs/binfmt_som.c
27368 -@@ -227,6 +227,7 @@ load_som_binary(struct linux_binprm * bprm, struct pt_regs * regs)
27369 - /* OK, This is the point of no return */
27370 - current->flags &= ~PF_FORKNOEXEC;
27371 - current->personality = PER_HPUX;
27372 -+ setup_new_exec(bprm);
27373 -
27374 - /* Set the task size for HP-UX processes such that
27375 - * the gateway page is outside the address space.
27376 -diff --git a/fs/bio-integrity.c b/fs/bio-integrity.c
27377 -index 49a34e7..a16f29e 100644
27378 ---- a/fs/bio-integrity.c
27379 -+++ b/fs/bio-integrity.c
27380 -@@ -61,7 +61,7 @@ static inline unsigned int vecs_to_idx(unsigned int nr)
27381 -
27382 - static inline int use_bip_pool(unsigned int idx)
27383 - {
27384 -- if (idx == BIOVEC_NR_POOLS)
27385 -+ if (idx == BIOVEC_MAX_IDX)
27386 - return 1;
27387 -
27388 - return 0;
27389 -@@ -95,6 +95,7 @@ struct bio_integrity_payload *bio_integrity_alloc_bioset(struct bio *bio,
27390 -
27391 - /* Use mempool if lower order alloc failed or max vecs were requested */
27392 - if (bip == NULL) {
27393 -+ idx = BIOVEC_MAX_IDX; /* so we free the payload properly later */
27394 - bip = mempool_alloc(bs->bio_integrity_pool, gfp_mask);
27395 -
27396 - if (unlikely(bip == NULL)) {
27397 -diff --git a/fs/bio.c b/fs/bio.c
27398 -index 12da5db..e0c9e71 100644
27399 ---- a/fs/bio.c
27400 -+++ b/fs/bio.c
27401 -@@ -542,13 +542,18 @@ static int __bio_add_page(struct request_queue *q, struct bio *bio, struct page
27402 -
27403 - if (page == prev->bv_page &&
27404 - offset == prev->bv_offset + prev->bv_len) {
27405 -+ unsigned int prev_bv_len = prev->bv_len;
27406 - prev->bv_len += len;
27407 -
27408 - if (q->merge_bvec_fn) {
27409 - struct bvec_merge_data bvm = {
27410 -+ /* prev_bvec is already charged in
27411 -+ bi_size, discharge it in order to
27412 -+ simulate merging updated prev_bvec
27413 -+ as new bvec. */
27414 - .bi_bdev = bio->bi_bdev,
27415 - .bi_sector = bio->bi_sector,
27416 -- .bi_size = bio->bi_size,
27417 -+ .bi_size = bio->bi_size - prev_bv_len,
27418 - .bi_rw = bio->bi_rw,
27419 - };
27420 -
27421 -diff --git a/fs/exec.c b/fs/exec.c
27422 -index ba112bd..7fa4efd 100644
27423 ---- a/fs/exec.c
27424 -+++ b/fs/exec.c
27425 -@@ -931,9 +931,7 @@ void set_task_comm(struct task_struct *tsk, char *buf)
27426 -
27427 - int flush_old_exec(struct linux_binprm * bprm)
27428 - {
27429 -- char * name;
27430 -- int i, ch, retval;
27431 -- char tcomm[sizeof(current->comm)];
27432 -+ int retval;
27433 -
27434 - /*
27435 - * Make sure we have a private signal table and that
27436 -@@ -954,6 +952,25 @@ int flush_old_exec(struct linux_binprm * bprm)
27437 -
27438 - bprm->mm = NULL; /* We're using it now */
27439 -
27440 -+ current->flags &= ~PF_RANDOMIZE;
27441 -+ flush_thread();
27442 -+ current->personality &= ~bprm->per_clear;
27443 -+
27444 -+ return 0;
27445 -+
27446 -+out:
27447 -+ return retval;
27448 -+}
27449 -+EXPORT_SYMBOL(flush_old_exec);
27450 -+
27451 -+void setup_new_exec(struct linux_binprm * bprm)
27452 -+{
27453 -+ int i, ch;
27454 -+ char * name;
27455 -+ char tcomm[sizeof(current->comm)];
27456 -+
27457 -+ arch_pick_mmap_layout(current->mm);
27458 -+
27459 - /* This is the point of no return */
27460 - current->sas_ss_sp = current->sas_ss_size = 0;
27461 -
27462 -@@ -975,9 +992,6 @@ int flush_old_exec(struct linux_binprm * bprm)
27463 - tcomm[i] = '\0';
27464 - set_task_comm(current, tcomm);
27465 -
27466 -- current->flags &= ~PF_RANDOMIZE;
27467 -- flush_thread();
27468 --
27469 - /* Set the new mm task size. We have to do that late because it may
27470 - * depend on TIF_32BIT which is only updated in flush_thread() on
27471 - * some architectures like powerpc
27472 -@@ -993,8 +1007,6 @@ int flush_old_exec(struct linux_binprm * bprm)
27473 - set_dumpable(current->mm, suid_dumpable);
27474 - }
27475 -
27476 -- current->personality &= ~bprm->per_clear;
27477 --
27478 - /*
27479 - * Flush performance counters when crossing a
27480 - * security domain:
27481 -@@ -1009,14 +1021,8 @@ int flush_old_exec(struct linux_binprm * bprm)
27482 -
27483 - flush_signal_handlers(current, 0);
27484 - flush_old_files(current->files);
27485 --
27486 -- return 0;
27487 --
27488 --out:
27489 -- return retval;
27490 - }
27491 --
27492 --EXPORT_SYMBOL(flush_old_exec);
27493 -+EXPORT_SYMBOL(setup_new_exec);
27494 -
27495 - /*
27496 - * Prepare credentials and lock ->cred_guard_mutex.
27497 -diff --git a/fs/fuse/file.c b/fs/fuse/file.c
27498 -index c18913a..a9f5e13 100644
27499 ---- a/fs/fuse/file.c
27500 -+++ b/fs/fuse/file.c
27501 -@@ -828,6 +828,9 @@ static ssize_t fuse_fill_write_pages(struct fuse_req *req,
27502 - if (!page)
27503 - break;
27504 -
27505 -+ if (mapping_writably_mapped(mapping))
27506 -+ flush_dcache_page(page);
27507 -+
27508 - pagefault_disable();
27509 - tmp = iov_iter_copy_from_user_atomic(page, ii, offset, bytes);
27510 - pagefault_enable();
27511 -diff --git a/fs/romfs/super.c b/fs/romfs/super.c
27512 -index c117fa8..42d2135 100644
27513 ---- a/fs/romfs/super.c
27514 -+++ b/fs/romfs/super.c
27515 -@@ -544,6 +544,7 @@ error:
27516 - error_rsb_inval:
27517 - ret = -EINVAL;
27518 - error_rsb:
27519 -+ kfree(rsb);
27520 - return ret;
27521 - }
27522 -
27523 -diff --git a/include/linux/acpi.h b/include/linux/acpi.h
27524 -index dfcd920..c010b94 100644
27525 ---- a/include/linux/acpi.h
27526 -+++ b/include/linux/acpi.h
27527 -@@ -253,6 +253,13 @@ void __init acpi_old_suspend_ordering(void);
27528 - void __init acpi_s4_no_nvs(void);
27529 - #endif /* CONFIG_PM_SLEEP */
27530 -
27531 -+struct acpi_osc_context {
27532 -+ char *uuid_str; /* uuid string */
27533 -+ int rev;
27534 -+ struct acpi_buffer cap; /* arg2/arg3 */
27535 -+ struct acpi_buffer ret; /* free by caller if success */
27536 -+};
27537 -+
27538 - #define OSC_QUERY_TYPE 0
27539 - #define OSC_SUPPORT_TYPE 1
27540 - #define OSC_CONTROL_TYPE 2
27541 -@@ -265,6 +272,15 @@ void __init acpi_s4_no_nvs(void);
27542 - #define OSC_INVALID_REVISION_ERROR 8
27543 - #define OSC_CAPABILITIES_MASK_ERROR 16
27544 -
27545 -+acpi_status acpi_run_osc(acpi_handle handle, struct acpi_osc_context *context);
27546 -+
27547 -+/* platform-wide _OSC bits */
27548 -+#define OSC_SB_PAD_SUPPORT 1
27549 -+#define OSC_SB_PPC_OST_SUPPORT 2
27550 -+#define OSC_SB_PR3_SUPPORT 4
27551 -+#define OSC_SB_CPUHP_OST_SUPPORT 8
27552 -+#define OSC_SB_APEI_SUPPORT 16
27553 -+
27554 - /* _OSC DW1 Definition (OS Support Fields) */
27555 - #define OSC_EXT_PCI_CONFIG_SUPPORT 1
27556 - #define OSC_ACTIVE_STATE_PWR_SUPPORT 2
27557 -diff --git a/include/linux/binfmts.h b/include/linux/binfmts.h
27558 -index aece486..340f441 100644
27559 ---- a/include/linux/binfmts.h
27560 -+++ b/include/linux/binfmts.h
27561 -@@ -101,6 +101,7 @@ extern int prepare_binprm(struct linux_binprm *);
27562 - extern int __must_check remove_arg_zero(struct linux_binprm *);
27563 - extern int search_binary_handler(struct linux_binprm *,struct pt_regs *);
27564 - extern int flush_old_exec(struct linux_binprm * bprm);
27565 -+extern void setup_new_exec(struct linux_binprm * bprm);
27566 -
27567 - extern int suid_dumpable;
27568 - #define SUID_DUMP_DISABLE 0 /* No setuid dumping */
27569 -diff --git a/include/linux/connector.h b/include/linux/connector.h
27570 -index 3a14615..ecb61c4 100644
27571 ---- a/include/linux/connector.h
27572 -+++ b/include/linux/connector.h
27573 -@@ -24,9 +24,6 @@
27574 -
27575 - #include <linux/types.h>
27576 -
27577 --#define CN_IDX_CONNECTOR 0xffffffff
27578 --#define CN_VAL_CONNECTOR 0xffffffff
27579 --
27580 - /*
27581 - * Process Events connector unique ids -- used for message routing
27582 - */
27583 -@@ -73,30 +70,6 @@ struct cn_msg {
27584 - __u8 data[0];
27585 - };
27586 -
27587 --/*
27588 -- * Notify structure - requests notification about
27589 -- * registering/unregistering idx/val in range [first, first+range].
27590 -- */
27591 --struct cn_notify_req {
27592 -- __u32 first;
27593 -- __u32 range;
27594 --};
27595 --
27596 --/*
27597 -- * Main notification control message
27598 -- * *_notify_num - number of appropriate cn_notify_req structures after
27599 -- * this struct.
27600 -- * group - notification receiver's idx.
27601 -- * len - total length of the attached data.
27602 -- */
27603 --struct cn_ctl_msg {
27604 -- __u32 idx_notify_num;
27605 -- __u32 val_notify_num;
27606 -- __u32 group;
27607 -- __u32 len;
27608 -- __u8 data[0];
27609 --};
27610 --
27611 - #ifdef __KERNEL__
27612 -
27613 - #include <asm/atomic.h>
27614 -@@ -149,11 +122,6 @@ struct cn_callback_entry {
27615 - u32 seq, group;
27616 - };
27617 -
27618 --struct cn_ctl_entry {
27619 -- struct list_head notify_entry;
27620 -- struct cn_ctl_msg *msg;
27621 --};
27622 --
27623 - struct cn_dev {
27624 - struct cb_id id;
27625 -
27626 -diff --git a/include/linux/inetdevice.h b/include/linux/inetdevice.h
27627 -index ad27c7d..9cd0bcf 100644
27628 ---- a/include/linux/inetdevice.h
27629 -+++ b/include/linux/inetdevice.h
27630 -@@ -83,6 +83,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
27631 - #define IN_DEV_FORWARD(in_dev) IN_DEV_CONF_GET((in_dev), FORWARDING)
27632 - #define IN_DEV_MFORWARD(in_dev) IN_DEV_ANDCONF((in_dev), MC_FORWARDING)
27633 - #define IN_DEV_RPFILTER(in_dev) IN_DEV_MAXCONF((in_dev), RP_FILTER)
27634 -+#define IN_DEV_SRC_VMARK(in_dev) IN_DEV_ORCONF((in_dev), SRC_VMARK)
27635 - #define IN_DEV_SOURCE_ROUTE(in_dev) IN_DEV_ANDCONF((in_dev), \
27636 - ACCEPT_SOURCE_ROUTE)
27637 - #define IN_DEV_BOOTP_RELAY(in_dev) IN_DEV_ANDCONF((in_dev), BOOTP_RELAY)
27638 -diff --git a/include/linux/kvm.h b/include/linux/kvm.h
27639 -index 8908dd6..0eadd71 100644
27640 ---- a/include/linux/kvm.h
27641 -+++ b/include/linux/kvm.h
27642 -@@ -439,6 +439,7 @@ struct kvm_ioeventfd {
27643 - #endif
27644 - #define KVM_CAP_IOEVENTFD 36
27645 - #define KVM_CAP_SET_IDENTITY_MAP_ADDR 37
27646 -+#define KVM_CAP_ADJUST_CLOCK 39
27647 -
27648 - #ifdef KVM_CAP_IRQ_ROUTING
27649 -
27650 -@@ -501,6 +502,12 @@ struct kvm_irqfd {
27651 - __u8 pad[20];
27652 - };
27653 -
27654 -+struct kvm_clock_data {
27655 -+ __u64 clock;
27656 -+ __u32 flags;
27657 -+ __u32 pad[9];
27658 -+};
27659 -+
27660 - /*
27661 - * ioctls for VM fds
27662 - */
27663 -@@ -550,6 +557,8 @@ struct kvm_irqfd {
27664 - #define KVM_CREATE_PIT2 _IOW(KVMIO, 0x77, struct kvm_pit_config)
27665 - #define KVM_SET_BOOT_CPU_ID _IO(KVMIO, 0x78)
27666 - #define KVM_IOEVENTFD _IOW(KVMIO, 0x79, struct kvm_ioeventfd)
27667 -+#define KVM_SET_CLOCK _IOW(KVMIO, 0x7b, struct kvm_clock_data)
27668 -+#define KVM_GET_CLOCK _IOR(KVMIO, 0x7c, struct kvm_clock_data)
27669 -
27670 - /*
27671 - * ioctls for vcpu fds
27672 -diff --git a/include/linux/libata.h b/include/linux/libata.h
27673 -index 8769864..b0f6d97 100644
27674 ---- a/include/linux/libata.h
27675 -+++ b/include/linux/libata.h
27676 -@@ -354,6 +354,9 @@ enum {
27677 - /* max tries if error condition is still set after ->error_handler */
27678 - ATA_EH_MAX_TRIES = 5,
27679 -
27680 -+ /* sometimes resuming a link requires several retries */
27681 -+ ATA_LINK_RESUME_TRIES = 5,
27682 -+
27683 - /* how hard are we gonna try to probe/recover devices */
27684 - ATA_PROBE_MAX_TRIES = 3,
27685 - ATA_EH_DEV_TRIES = 3,
27686 -diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h
27687 -index ed5d750..3c62ed4 100644
27688 ---- a/include/linux/pagemap.h
27689 -+++ b/include/linux/pagemap.h
27690 -@@ -253,6 +253,8 @@ extern struct page * read_cache_page_async(struct address_space *mapping,
27691 - extern struct page * read_cache_page(struct address_space *mapping,
27692 - pgoff_t index, filler_t *filler,
27693 - void *data);
27694 -+extern struct page * read_cache_page_gfp(struct address_space *mapping,
27695 -+ pgoff_t index, gfp_t gfp_mask);
27696 - extern int read_cache_pages(struct address_space *mapping,
27697 - struct list_head *pages, filler_t *filler, void *data);
27698 -
27699 -diff --git a/include/linux/sched.h b/include/linux/sched.h
27700 -index 0f67914..d3dce7d 100644
27701 ---- a/include/linux/sched.h
27702 -+++ b/include/linux/sched.h
27703 -@@ -1354,7 +1354,7 @@ struct task_struct {
27704 - char comm[TASK_COMM_LEN]; /* executable name excluding path
27705 - - access with [gs]et_task_comm (which lock
27706 - it with task_lock())
27707 -- - initialized normally by flush_old_exec */
27708 -+ - initialized normally by setup_new_exec */
27709 - /* file system info */
27710 - int link_count, total_link_count;
27711 - #ifdef CONFIG_SYSVIPC
27712 -diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
27713 -index 1e4743e..0eb6942 100644
27714 ---- a/include/linux/sysctl.h
27715 -+++ b/include/linux/sysctl.h
27716 -@@ -490,6 +490,7 @@ enum
27717 - NET_IPV4_CONF_PROMOTE_SECONDARIES=20,
27718 - NET_IPV4_CONF_ARP_ACCEPT=21,
27719 - NET_IPV4_CONF_ARP_NOTIFY=22,
27720 -+ NET_IPV4_CONF_SRC_VMARK=24,
27721 - __NET_IPV4_CONF_MAX
27722 - };
27723 -
27724 -diff --git a/include/net/netrom.h b/include/net/netrom.h
27725 -index 15696b1..ab170a6 100644
27726 ---- a/include/net/netrom.h
27727 -+++ b/include/net/netrom.h
27728 -@@ -132,6 +132,8 @@ static __inline__ void nr_node_put(struct nr_node *nr_node)
27729 - static __inline__ void nr_neigh_put(struct nr_neigh *nr_neigh)
27730 - {
27731 - if (atomic_dec_and_test(&nr_neigh->refcount)) {
27732 -+ if (nr_neigh->ax25)
27733 -+ ax25_cb_put(nr_neigh->ax25);
27734 - kfree(nr_neigh->digipeat);
27735 - kfree(nr_neigh);
27736 - }
27737 -diff --git a/kernel/cred.c b/kernel/cred.c
27738 -index dd76cfe..1ed8ca1 100644
27739 ---- a/kernel/cred.c
27740 -+++ b/kernel/cred.c
27741 -@@ -224,7 +224,7 @@ struct cred *cred_alloc_blank(void)
27742 - #ifdef CONFIG_KEYS
27743 - new->tgcred = kzalloc(sizeof(*new->tgcred), GFP_KERNEL);
27744 - if (!new->tgcred) {
27745 -- kfree(new);
27746 -+ kmem_cache_free(cred_jar, new);
27747 - return NULL;
27748 - }
27749 - atomic_set(&new->tgcred->usage, 1);
27750 -diff --git a/kernel/sysctl_check.c b/kernel/sysctl_check.c
27751 -index b6e7aae..469193c 100644
27752 ---- a/kernel/sysctl_check.c
27753 -+++ b/kernel/sysctl_check.c
27754 -@@ -220,6 +220,7 @@ static const struct trans_ctl_table trans_net_ipv4_conf_vars_table[] = {
27755 - { NET_IPV4_CONF_PROMOTE_SECONDARIES, "promote_secondaries" },
27756 - { NET_IPV4_CONF_ARP_ACCEPT, "arp_accept" },
27757 - { NET_IPV4_CONF_ARP_NOTIFY, "arp_notify" },
27758 -+ { NET_IPV4_CONF_SRC_VMARK, "src_valid_mark" },
27759 - {}
27760 - };
27761 -
27762 -diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
27763 -index 5155dc3..ecc7adb 100644
27764 ---- a/kernel/time/clocksource.c
27765 -+++ b/kernel/time/clocksource.c
27766 -@@ -413,8 +413,6 @@ void clocksource_touch_watchdog(void)
27767 - clocksource_resume_watchdog();
27768 - }
27769 -
27770 --#ifdef CONFIG_GENERIC_TIME
27771 --
27772 - /**
27773 - * clocksource_max_deferment - Returns max time the clocksource can be deferred
27774 - * @cs: Pointer to clocksource
27775 -@@ -456,6 +454,8 @@ static u64 clocksource_max_deferment(struct clocksource *cs)
27776 - return max_nsecs - (max_nsecs >> 5);
27777 - }
27778 -
27779 -+#ifdef CONFIG_GENERIC_TIME
27780 -+
27781 - /**
27782 - * clocksource_select - Select the best clocksource available
27783 - *
27784 -diff --git a/mm/filemap.c b/mm/filemap.c
27785 -index ef169f3..8e96c90 100644
27786 ---- a/mm/filemap.c
27787 -+++ b/mm/filemap.c
27788 -@@ -1655,14 +1655,15 @@ EXPORT_SYMBOL(generic_file_readonly_mmap);
27789 - static struct page *__read_cache_page(struct address_space *mapping,
27790 - pgoff_t index,
27791 - int (*filler)(void *,struct page*),
27792 -- void *data)
27793 -+ void *data,
27794 -+ gfp_t gfp)
27795 - {
27796 - struct page *page;
27797 - int err;
27798 - repeat:
27799 - page = find_get_page(mapping, index);
27800 - if (!page) {
27801 -- page = page_cache_alloc_cold(mapping);
27802 -+ page = __page_cache_alloc(gfp | __GFP_COLD);
27803 - if (!page)
27804 - return ERR_PTR(-ENOMEM);
27805 - err = add_to_page_cache_lru(page, mapping, index, GFP_KERNEL);
27806 -@@ -1682,31 +1683,18 @@ repeat:
27807 - return page;
27808 - }
27809 -
27810 --/**
27811 -- * read_cache_page_async - read into page cache, fill it if needed
27812 -- * @mapping: the page's address_space
27813 -- * @index: the page index
27814 -- * @filler: function to perform the read
27815 -- * @data: destination for read data
27816 -- *
27817 -- * Same as read_cache_page, but don't wait for page to become unlocked
27818 -- * after submitting it to the filler.
27819 -- *
27820 -- * Read into the page cache. If a page already exists, and PageUptodate() is
27821 -- * not set, try to fill the page but don't wait for it to become unlocked.
27822 -- *
27823 -- * If the page does not get brought uptodate, return -EIO.
27824 -- */
27825 --struct page *read_cache_page_async(struct address_space *mapping,
27826 -+static struct page *do_read_cache_page(struct address_space *mapping,
27827 - pgoff_t index,
27828 - int (*filler)(void *,struct page*),
27829 -- void *data)
27830 -+ void *data,
27831 -+ gfp_t gfp)
27832 -+
27833 - {
27834 - struct page *page;
27835 - int err;
27836 -
27837 - retry:
27838 -- page = __read_cache_page(mapping, index, filler, data);
27839 -+ page = __read_cache_page(mapping, index, filler, data, gfp);
27840 - if (IS_ERR(page))
27841 - return page;
27842 - if (PageUptodate(page))
27843 -@@ -1731,8 +1719,67 @@ out:
27844 - mark_page_accessed(page);
27845 - return page;
27846 - }
27847 -+
27848 -+/**
27849 -+ * read_cache_page_async - read into page cache, fill it if needed
27850 -+ * @mapping: the page's address_space
27851 -+ * @index: the page index
27852 -+ * @filler: function to perform the read
27853 -+ * @data: destination for read data
27854 -+ *
27855 -+ * Same as read_cache_page, but don't wait for page to become unlocked
27856 -+ * after submitting it to the filler.
27857 -+ *
27858 -+ * Read into the page cache. If a page already exists, and PageUptodate() is
27859 -+ * not set, try to fill the page but don't wait for it to become unlocked.
27860 -+ *
27861 -+ * If the page does not get brought uptodate, return -EIO.
27862 -+ */
27863 -+struct page *read_cache_page_async(struct address_space *mapping,
27864 -+ pgoff_t index,
27865 -+ int (*filler)(void *,struct page*),
27866 -+ void *data)
27867 -+{
27868 -+ return do_read_cache_page(mapping, index, filler, data, mapping_gfp_mask(mapping));
27869 -+}
27870 - EXPORT_SYMBOL(read_cache_page_async);
27871 -
27872 -+static struct page *wait_on_page_read(struct page *page)
27873 -+{
27874 -+ if (!IS_ERR(page)) {
27875 -+ wait_on_page_locked(page);
27876 -+ if (!PageUptodate(page)) {
27877 -+ page_cache_release(page);
27878 -+ page = ERR_PTR(-EIO);
27879 -+ }
27880 -+ }
27881 -+ return page;
27882 -+}
27883 -+
27884 -+/**
27885 -+ * read_cache_page_gfp - read into page cache, using specified page allocation flags.
27886 -+ * @mapping: the page's address_space
27887 -+ * @index: the page index
27888 -+ * @gfp: the page allocator flags to use if allocating
27889 -+ *
27890 -+ * This is the same as "read_mapping_page(mapping, index, NULL)", but with
27891 -+ * any new page allocations done using the specified allocation flags. Note
27892 -+ * that the Radix tree operations will still use GFP_KERNEL, so you can't
27893 -+ * expect to do this atomically or anything like that - but you can pass in
27894 -+ * other page requirements.
27895 -+ *
27896 -+ * If the page does not get brought uptodate, return -EIO.
27897 -+ */
27898 -+struct page *read_cache_page_gfp(struct address_space *mapping,
27899 -+ pgoff_t index,
27900 -+ gfp_t gfp)
27901 -+{
27902 -+ filler_t *filler = (filler_t *)mapping->a_ops->readpage;
27903 -+
27904 -+ return wait_on_page_read(do_read_cache_page(mapping, index, filler, NULL, gfp));
27905 -+}
27906 -+EXPORT_SYMBOL(read_cache_page_gfp);
27907 -+
27908 - /**
27909 - * read_cache_page - read into page cache, fill it if needed
27910 - * @mapping: the page's address_space
27911 -@@ -1750,18 +1797,7 @@ struct page *read_cache_page(struct address_space *mapping,
27912 - int (*filler)(void *,struct page*),
27913 - void *data)
27914 - {
27915 -- struct page *page;
27916 --
27917 -- page = read_cache_page_async(mapping, index, filler, data);
27918 -- if (IS_ERR(page))
27919 -- goto out;
27920 -- wait_on_page_locked(page);
27921 -- if (!PageUptodate(page)) {
27922 -- page_cache_release(page);
27923 -- page = ERR_PTR(-EIO);
27924 -- }
27925 -- out:
27926 -- return page;
27927 -+ return wait_on_page_read(read_cache_page_async(mapping, index, filler, data));
27928 - }
27929 - EXPORT_SYMBOL(read_cache_page);
27930 -
27931 -@@ -2217,6 +2253,9 @@ again:
27932 - if (unlikely(status))
27933 - break;
27934 -
27935 -+ if (mapping_writably_mapped(mapping))
27936 -+ flush_dcache_page(page);
27937 -+
27938 - pagefault_disable();
27939 - copied = iov_iter_copy_from_user_atomic(page, i, offset, bytes);
27940 - pagefault_enable();
27941 -diff --git a/mm/page_alloc.c b/mm/page_alloc.c
27942 -index 3a78e2e..36992b6 100644
27943 ---- a/mm/page_alloc.c
27944 -+++ b/mm/page_alloc.c
27945 -@@ -559,8 +559,9 @@ static void free_pcppages_bulk(struct zone *zone, int count,
27946 - page = list_entry(list->prev, struct page, lru);
27947 - /* must delete as __free_one_page list manipulates */
27948 - list_del(&page->lru);
27949 -- __free_one_page(page, zone, 0, migratetype);
27950 -- trace_mm_page_pcpu_drain(page, 0, migratetype);
27951 -+ /* MIGRATE_MOVABLE list may include MIGRATE_RESERVEs */
27952 -+ __free_one_page(page, zone, 0, page_private(page));
27953 -+ trace_mm_page_pcpu_drain(page, 0, page_private(page));
27954 - } while (--count && --batch_free && !list_empty(list));
27955 - }
27956 - spin_unlock(&zone->lock);
27957 -diff --git a/mm/vmalloc.c b/mm/vmalloc.c
27958 -index a3a99d3..c228731 100644
27959 ---- a/mm/vmalloc.c
27960 -+++ b/mm/vmalloc.c
27961 -@@ -509,6 +509,9 @@ static unsigned long lazy_max_pages(void)
27962 -
27963 - static atomic_t vmap_lazy_nr = ATOMIC_INIT(0);
27964 -
27965 -+/* for per-CPU blocks */
27966 -+static void purge_fragmented_blocks_allcpus(void);
27967 -+
27968 - /*
27969 - * Purges all lazily-freed vmap areas.
27970 - *
27971 -@@ -539,6 +542,9 @@ static void __purge_vmap_area_lazy(unsigned long *start, unsigned long *end,
27972 - } else
27973 - spin_lock(&purge_lock);
27974 -
27975 -+ if (sync)
27976 -+ purge_fragmented_blocks_allcpus();
27977 -+
27978 - rcu_read_lock();
27979 - list_for_each_entry_rcu(va, &vmap_area_list, list) {
27980 - if (va->flags & VM_LAZY_FREE) {
27981 -@@ -667,8 +673,6 @@ static bool vmap_initialized __read_mostly = false;
27982 - struct vmap_block_queue {
27983 - spinlock_t lock;
27984 - struct list_head free;
27985 -- struct list_head dirty;
27986 -- unsigned int nr_dirty;
27987 - };
27988 -
27989 - struct vmap_block {
27990 -@@ -678,10 +682,9 @@ struct vmap_block {
27991 - unsigned long free, dirty;
27992 - DECLARE_BITMAP(alloc_map, VMAP_BBMAP_BITS);
27993 - DECLARE_BITMAP(dirty_map, VMAP_BBMAP_BITS);
27994 -- union {
27995 -- struct list_head free_list;
27996 -- struct rcu_head rcu_head;
27997 -- };
27998 -+ struct list_head free_list;
27999 -+ struct rcu_head rcu_head;
28000 -+ struct list_head purge;
28001 - };
28002 -
28003 - /* Queue of free and dirty vmap blocks, for allocation and flushing purposes */
28004 -@@ -757,7 +760,7 @@ static struct vmap_block *new_vmap_block(gfp_t gfp_mask)
28005 - vbq = &get_cpu_var(vmap_block_queue);
28006 - vb->vbq = vbq;
28007 - spin_lock(&vbq->lock);
28008 -- list_add(&vb->free_list, &vbq->free);
28009 -+ list_add_rcu(&vb->free_list, &vbq->free);
28010 - spin_unlock(&vbq->lock);
28011 - put_cpu_var(vmap_cpu_blocks);
28012 -
28013 -@@ -776,8 +779,6 @@ static void free_vmap_block(struct vmap_block *vb)
28014 - struct vmap_block *tmp;
28015 - unsigned long vb_idx;
28016 -
28017 -- BUG_ON(!list_empty(&vb->free_list));
28018 --
28019 - vb_idx = addr_to_vb_idx(vb->va->va_start);
28020 - spin_lock(&vmap_block_tree_lock);
28021 - tmp = radix_tree_delete(&vmap_block_tree, vb_idx);
28022 -@@ -788,12 +789,61 @@ static void free_vmap_block(struct vmap_block *vb)
28023 - call_rcu(&vb->rcu_head, rcu_free_vb);
28024 - }
28025 -
28026 -+static void purge_fragmented_blocks(int cpu)
28027 -+{
28028 -+ LIST_HEAD(purge);
28029 -+ struct vmap_block *vb;
28030 -+ struct vmap_block *n_vb;
28031 -+ struct vmap_block_queue *vbq = &per_cpu(vmap_block_queue, cpu);
28032 -+
28033 -+ rcu_read_lock();
28034 -+ list_for_each_entry_rcu(vb, &vbq->free, free_list) {
28035 -+
28036 -+ if (!(vb->free + vb->dirty == VMAP_BBMAP_BITS && vb->dirty != VMAP_BBMAP_BITS))
28037 -+ continue;
28038 -+
28039 -+ spin_lock(&vb->lock);
28040 -+ if (vb->free + vb->dirty == VMAP_BBMAP_BITS && vb->dirty != VMAP_BBMAP_BITS) {
28041 -+ vb->free = 0; /* prevent further allocs after releasing lock */
28042 -+ vb->dirty = VMAP_BBMAP_BITS; /* prevent purging it again */
28043 -+ bitmap_fill(vb->alloc_map, VMAP_BBMAP_BITS);
28044 -+ bitmap_fill(vb->dirty_map, VMAP_BBMAP_BITS);
28045 -+ spin_lock(&vbq->lock);
28046 -+ list_del_rcu(&vb->free_list);
28047 -+ spin_unlock(&vbq->lock);
28048 -+ spin_unlock(&vb->lock);
28049 -+ list_add_tail(&vb->purge, &purge);
28050 -+ } else
28051 -+ spin_unlock(&vb->lock);
28052 -+ }
28053 -+ rcu_read_unlock();
28054 -+
28055 -+ list_for_each_entry_safe(vb, n_vb, &purge, purge) {
28056 -+ list_del(&vb->purge);
28057 -+ free_vmap_block(vb);
28058 -+ }
28059 -+}
28060 -+
28061 -+static void purge_fragmented_blocks_thiscpu(void)
28062 -+{
28063 -+ purge_fragmented_blocks(smp_processor_id());
28064 -+}
28065 -+
28066 -+static void purge_fragmented_blocks_allcpus(void)
28067 -+{
28068 -+ int cpu;
28069 -+
28070 -+ for_each_possible_cpu(cpu)
28071 -+ purge_fragmented_blocks(cpu);
28072 -+}
28073 -+
28074 - static void *vb_alloc(unsigned long size, gfp_t gfp_mask)
28075 - {
28076 - struct vmap_block_queue *vbq;
28077 - struct vmap_block *vb;
28078 - unsigned long addr = 0;
28079 - unsigned int order;
28080 -+ int purge = 0;
28081 -
28082 - BUG_ON(size & ~PAGE_MASK);
28083 - BUG_ON(size > PAGE_SIZE*VMAP_MAX_ALLOC);
28084 -@@ -806,24 +856,37 @@ again:
28085 - int i;
28086 -
28087 - spin_lock(&vb->lock);
28088 -+ if (vb->free < 1UL << order)
28089 -+ goto next;
28090 - i = bitmap_find_free_region(vb->alloc_map,
28091 - VMAP_BBMAP_BITS, order);
28092 -
28093 -- if (i >= 0) {
28094 -- addr = vb->va->va_start + (i << PAGE_SHIFT);
28095 -- BUG_ON(addr_to_vb_idx(addr) !=
28096 -- addr_to_vb_idx(vb->va->va_start));
28097 -- vb->free -= 1UL << order;
28098 -- if (vb->free == 0) {
28099 -- spin_lock(&vbq->lock);
28100 -- list_del_init(&vb->free_list);
28101 -- spin_unlock(&vbq->lock);
28102 -+ if (i < 0) {
28103 -+ if (vb->free + vb->dirty == VMAP_BBMAP_BITS) {
28104 -+ /* fragmented and no outstanding allocations */
28105 -+ BUG_ON(vb->dirty != VMAP_BBMAP_BITS);
28106 -+ purge = 1;
28107 - }
28108 -- spin_unlock(&vb->lock);
28109 -- break;
28110 -+ goto next;
28111 - }
28112 -+ addr = vb->va->va_start + (i << PAGE_SHIFT);
28113 -+ BUG_ON(addr_to_vb_idx(addr) !=
28114 -+ addr_to_vb_idx(vb->va->va_start));
28115 -+ vb->free -= 1UL << order;
28116 -+ if (vb->free == 0) {
28117 -+ spin_lock(&vbq->lock);
28118 -+ list_del_rcu(&vb->free_list);
28119 -+ spin_unlock(&vbq->lock);
28120 -+ }
28121 -+ spin_unlock(&vb->lock);
28122 -+ break;
28123 -+next:
28124 - spin_unlock(&vb->lock);
28125 - }
28126 -+
28127 -+ if (purge)
28128 -+ purge_fragmented_blocks_thiscpu();
28129 -+
28130 - put_cpu_var(vmap_cpu_blocks);
28131 - rcu_read_unlock();
28132 -
28133 -@@ -860,11 +923,11 @@ static void vb_free(const void *addr, unsigned long size)
28134 - BUG_ON(!vb);
28135 -
28136 - spin_lock(&vb->lock);
28137 -- bitmap_allocate_region(vb->dirty_map, offset >> PAGE_SHIFT, order);
28138 -+ BUG_ON(bitmap_allocate_region(vb->dirty_map, offset >> PAGE_SHIFT, order));
28139 -
28140 - vb->dirty += 1UL << order;
28141 - if (vb->dirty == VMAP_BBMAP_BITS) {
28142 -- BUG_ON(vb->free || !list_empty(&vb->free_list));
28143 -+ BUG_ON(vb->free);
28144 - spin_unlock(&vb->lock);
28145 - free_vmap_block(vb);
28146 - } else
28147 -@@ -1033,8 +1096,6 @@ void __init vmalloc_init(void)
28148 - vbq = &per_cpu(vmap_block_queue, i);
28149 - spin_lock_init(&vbq->lock);
28150 - INIT_LIST_HEAD(&vbq->free);
28151 -- INIT_LIST_HEAD(&vbq->dirty);
28152 -- vbq->nr_dirty = 0;
28153 - }
28154 -
28155 - /* Import existing vmlist entries. */
28156 -diff --git a/net/ax25/ax25_out.c b/net/ax25/ax25_out.c
28157 -index bf706f8..1491260 100644
28158 ---- a/net/ax25/ax25_out.c
28159 -+++ b/net/ax25/ax25_out.c
28160 -@@ -92,6 +92,12 @@ ax25_cb *ax25_send_frame(struct sk_buff *skb, int paclen, ax25_address *src, ax2
28161 - #endif
28162 - }
28163 -
28164 -+ /*
28165 -+ * There is one ref for the state machine; a caller needs
28166 -+ * one more to put it back, just like with the existing one.
28167 -+ */
28168 -+ ax25_cb_hold(ax25);
28169 -+
28170 - ax25_cb_add(ax25);
28171 -
28172 - ax25->state = AX25_STATE_1;
28173 -diff --git a/net/core/sock.c b/net/core/sock.c
28174 -index 7626b6a..6605e75 100644
28175 ---- a/net/core/sock.c
28176 -+++ b/net/core/sock.c
28177 -@@ -1181,6 +1181,10 @@ struct sock *sk_clone(const struct sock *sk, const gfp_t priority)
28178 -
28179 - if (newsk->sk_prot->sockets_allocated)
28180 - percpu_counter_inc(newsk->sk_prot->sockets_allocated);
28181 -+
28182 -+ if (sock_flag(newsk, SOCK_TIMESTAMP) ||
28183 -+ sock_flag(newsk, SOCK_TIMESTAMPING_RX_SOFTWARE))
28184 -+ net_enable_timestamp();
28185 - }
28186 - out:
28187 - return newsk;
28188 -diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
28189 -index 5df2f6a..0030e73 100644
28190 ---- a/net/ipv4/devinet.c
28191 -+++ b/net/ipv4/devinet.c
28192 -@@ -1450,6 +1450,7 @@ static struct devinet_sysctl_table {
28193 - DEVINET_SYSCTL_RW_ENTRY(SEND_REDIRECTS, "send_redirects"),
28194 - DEVINET_SYSCTL_RW_ENTRY(ACCEPT_SOURCE_ROUTE,
28195 - "accept_source_route"),
28196 -+ DEVINET_SYSCTL_RW_ENTRY(SRC_VMARK, "src_valid_mark"),
28197 - DEVINET_SYSCTL_RW_ENTRY(PROXY_ARP, "proxy_arp"),
28198 - DEVINET_SYSCTL_RW_ENTRY(MEDIUM_ID, "medium_id"),
28199 - DEVINET_SYSCTL_RW_ENTRY(BOOTP_RELAY, "bootp_relay"),
28200 -diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
28201 -index aa00398..29391ee 100644
28202 ---- a/net/ipv4/fib_frontend.c
28203 -+++ b/net/ipv4/fib_frontend.c
28204 -@@ -251,6 +251,8 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
28205 - if (in_dev) {
28206 - no_addr = in_dev->ifa_list == NULL;
28207 - rpf = IN_DEV_RPFILTER(in_dev);
28208 -+ if (mark && !IN_DEV_SRC_VMARK(in_dev))
28209 -+ fl.mark = 0;
28210 - }
28211 - rcu_read_unlock();
28212 -
28213 -diff --git a/net/mac80211/driver-trace.h b/net/mac80211/driver-trace.h
28214 -index 37b9051..d87645e 100644
28215 ---- a/net/mac80211/driver-trace.h
28216 -+++ b/net/mac80211/driver-trace.h
28217 -@@ -655,7 +655,7 @@ TRACE_EVENT(drv_ampdu_action,
28218 - __entry->ret = ret;
28219 - __entry->action = action;
28220 - __entry->tid = tid;
28221 -- __entry->ssn = *ssn;
28222 -+ __entry->ssn = ssn ? *ssn : 0;
28223 - ),
28224 -
28225 - TP_printk(
28226 -diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c
28227 -index 4eb1ac9..850ffc0 100644
28228 ---- a/net/netrom/nr_route.c
28229 -+++ b/net/netrom/nr_route.c
28230 -@@ -842,12 +842,13 @@ int nr_route_frame(struct sk_buff *skb, ax25_cb *ax25)
28231 - dptr = skb_push(skb, 1);
28232 - *dptr = AX25_P_NETROM;
28233 -
28234 -- ax25s = ax25_send_frame(skb, 256, (ax25_address *)dev->dev_addr, &nr_neigh->callsign, nr_neigh->digipeat, nr_neigh->dev);
28235 -- if (nr_neigh->ax25 && ax25s) {
28236 -- /* We were already holding this ax25_cb */
28237 -+ ax25s = nr_neigh->ax25;
28238 -+ nr_neigh->ax25 = ax25_send_frame(skb, 256,
28239 -+ (ax25_address *)dev->dev_addr,
28240 -+ &nr_neigh->callsign,
28241 -+ nr_neigh->digipeat, nr_neigh->dev);
28242 -+ if (ax25s)
28243 - ax25_cb_put(ax25s);
28244 -- }
28245 -- nr_neigh->ax25 = ax25s;
28246 -
28247 - dev_put(dev);
28248 - ret = (nr_neigh->ax25 != NULL);
28249 -diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
28250 -index f2d116a..41866eb 100644
28251 ---- a/net/packet/af_packet.c
28252 -+++ b/net/packet/af_packet.c
28253 -@@ -1028,8 +1028,20 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
28254 -
28255 - status = TP_STATUS_SEND_REQUEST;
28256 - err = dev_queue_xmit(skb);
28257 -- if (unlikely(err > 0 && (err = net_xmit_errno(err)) != 0))
28258 -- goto out_xmit;
28259 -+ if (unlikely(err > 0)) {
28260 -+ err = net_xmit_errno(err);
28261 -+ if (err && __packet_get_status(po, ph) ==
28262 -+ TP_STATUS_AVAILABLE) {
28263 -+ /* skb was destructed already */
28264 -+ skb = NULL;
28265 -+ goto out_status;
28266 -+ }
28267 -+ /*
28268 -+ * skb was dropped but not destructed yet;
28269 -+ * let's treat it like congestion or err < 0
28270 -+ */
28271 -+ err = 0;
28272 -+ }
28273 - packet_increment_head(&po->tx_ring);
28274 - len_sum += tp_len;
28275 - } while (likely((ph != NULL) || ((!(msg->msg_flags & MSG_DONTWAIT))
28276 -@@ -1039,9 +1051,6 @@ static int tpacket_snd(struct packet_sock *po, struct msghdr *msg)
28277 - err = len_sum;
28278 - goto out_put;
28279 -
28280 --out_xmit:
28281 -- skb->destructor = sock_wfree;
28282 -- atomic_dec(&po->tx_ring.pending);
28283 - out_status:
28284 - __packet_set_status(po, ph, status);
28285 - kfree_skb(skb);
28286 -diff --git a/net/rose/rose_link.c b/net/rose/rose_link.c
28287 -index bd86a63..5ef5f69 100644
28288 ---- a/net/rose/rose_link.c
28289 -+++ b/net/rose/rose_link.c
28290 -@@ -101,13 +101,17 @@ static void rose_t0timer_expiry(unsigned long param)
28291 - static int rose_send_frame(struct sk_buff *skb, struct rose_neigh *neigh)
28292 - {
28293 - ax25_address *rose_call;
28294 -+ ax25_cb *ax25s;
28295 -
28296 - if (ax25cmp(&rose_callsign, &null_ax25_address) == 0)
28297 - rose_call = (ax25_address *)neigh->dev->dev_addr;
28298 - else
28299 - rose_call = &rose_callsign;
28300 -
28301 -+ ax25s = neigh->ax25;
28302 - neigh->ax25 = ax25_send_frame(skb, 260, rose_call, &neigh->callsign, neigh->digipeat, neigh->dev);
28303 -+ if (ax25s)
28304 -+ ax25_cb_put(ax25s);
28305 -
28306 - return (neigh->ax25 != NULL);
28307 - }
28308 -@@ -120,13 +124,17 @@ static int rose_send_frame(struct sk_buff *skb, struct rose_neigh *neigh)
28309 - static int rose_link_up(struct rose_neigh *neigh)
28310 - {
28311 - ax25_address *rose_call;
28312 -+ ax25_cb *ax25s;
28313 -
28314 - if (ax25cmp(&rose_callsign, &null_ax25_address) == 0)
28315 - rose_call = (ax25_address *)neigh->dev->dev_addr;
28316 - else
28317 - rose_call = &rose_callsign;
28318 -
28319 -+ ax25s = neigh->ax25;
28320 - neigh->ax25 = ax25_find_cb(rose_call, &neigh->callsign, neigh->digipeat, neigh->dev);
28321 -+ if (ax25s)
28322 -+ ax25_cb_put(ax25s);
28323 -
28324 - return (neigh->ax25 != NULL);
28325 - }
28326 -diff --git a/net/rose/rose_route.c b/net/rose/rose_route.c
28327 -index f3e2198..08230fa 100644
28328 ---- a/net/rose/rose_route.c
28329 -+++ b/net/rose/rose_route.c
28330 -@@ -234,6 +234,8 @@ static void rose_remove_neigh(struct rose_neigh *rose_neigh)
28331 -
28332 - if ((s = rose_neigh_list) == rose_neigh) {
28333 - rose_neigh_list = rose_neigh->next;
28334 -+ if (rose_neigh->ax25)
28335 -+ ax25_cb_put(rose_neigh->ax25);
28336 - kfree(rose_neigh->digipeat);
28337 - kfree(rose_neigh);
28338 - return;
28339 -@@ -242,6 +244,8 @@ static void rose_remove_neigh(struct rose_neigh *rose_neigh)
28340 - while (s != NULL && s->next != NULL) {
28341 - if (s->next == rose_neigh) {
28342 - s->next = rose_neigh->next;
28343 -+ if (rose_neigh->ax25)
28344 -+ ax25_cb_put(rose_neigh->ax25);
28345 - kfree(rose_neigh->digipeat);
28346 - kfree(rose_neigh);
28347 - return;
28348 -@@ -810,6 +814,7 @@ void rose_link_failed(ax25_cb *ax25, int reason)
28349 -
28350 - if (rose_neigh != NULL) {
28351 - rose_neigh->ax25 = NULL;
28352 -+ ax25_cb_put(ax25);
28353 -
28354 - rose_del_route_by_neigh(rose_neigh);
28355 - rose_kill_by_neigh(rose_neigh);
28356 -diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
28357 -index bb230d5..36d9e25 100644
28358 ---- a/security/selinux/hooks.c
28359 -+++ b/security/selinux/hooks.c
28360 -@@ -2366,7 +2366,7 @@ static void selinux_bprm_committing_creds(struct linux_binprm *bprm)
28361 - initrlim = init_task.signal->rlim + i;
28362 - rlim->rlim_cur = min(rlim->rlim_max, initrlim->rlim_cur);
28363 - }
28364 -- update_rlimit_cpu(rlim->rlim_cur);
28365 -+ update_rlimit_cpu(current->signal->rlim[RLIMIT_CPU].rlim_cur);
28366 - }
28367 - }
28368 -
28369
28370 Deleted: genpatches-2.6/trunk/2.6.33/2410_rtl8187se-compilation-fix.patch
28371 ===================================================================
28372 --- genpatches-2.6/trunk/2.6.33/2410_rtl8187se-compilation-fix.patch 2010-02-18 15:55:49 UTC (rev 1673)
28373 +++ genpatches-2.6/trunk/2.6.33/2410_rtl8187se-compilation-fix.patch 2010-02-18 15:58:13 UTC (rev 1674)
28374 @@ -1,207 +0,0 @@
28375 -From: George Kadianakis <desnacked@×××××.com>
28376 -Date: Wed, 16 Dec 2009 23:16:00 +0000 (+0200)
28377 -Subject: Staging: fix rtl8187se compilation errors with mac80211
28378 -X-Git-Tag: v2.6.33-rc2~13^2~11
28379 -X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=df574b8ecfb3a84af96229f336a6be88ca4a7055
28380 -
28381 -Staging: fix rtl8187se compilation errors with mac80211
28382 -
28383 -This patch fixes compilation problems that were caused by function
28384 -naming conflicts between the rtl8187se driver and the mac80211 stack.
28385 -
28386 -Signed-off-by: George Kadianakis <desnacked at gmail.com>
28387 -Signed-off-by: Greg Kroah-Hartman <gregkh@××××.de>
28388 ----
28389 -
28390 -diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211.h b/drivers/staging/rtl8187se/ieee80211/ieee80211.h
28391 -index 3222c22..0d490c1 100644
28392 ---- a/drivers/staging/rtl8187se/ieee80211/ieee80211.h
28393 -+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211.h
28394 -@@ -1318,13 +1318,13 @@ extern int ieee80211_encrypt_fragment(
28395 - struct sk_buff *frag,
28396 - int hdr_len);
28397 -
28398 --extern int ieee80211_xmit(struct sk_buff *skb,
28399 -+extern int ieee80211_rtl_xmit(struct sk_buff *skb,
28400 - struct net_device *dev);
28401 - extern void ieee80211_txb_free(struct ieee80211_txb *);
28402 -
28403 -
28404 - /* ieee80211_rx.c */
28405 --extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
28406 -+extern int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
28407 - struct ieee80211_rx_stats *rx_stats);
28408 - extern void ieee80211_rx_mgt(struct ieee80211_device *ieee,
28409 - struct ieee80211_hdr_4addr *header,
28410 -@@ -1376,8 +1376,8 @@ extern void ieee80211_stop_protocol(struct ieee80211_device *ieee);
28411 - extern void ieee80211_softmac_start_protocol(struct ieee80211_device *ieee);
28412 - extern void ieee80211_softmac_stop_protocol(struct ieee80211_device *ieee);
28413 - extern void ieee80211_reset_queue(struct ieee80211_device *ieee);
28414 --extern void ieee80211_wake_queue(struct ieee80211_device *ieee);
28415 --extern void ieee80211_stop_queue(struct ieee80211_device *ieee);
28416 -+extern void ieee80211_rtl_wake_queue(struct ieee80211_device *ieee);
28417 -+extern void ieee80211_rtl_stop_queue(struct ieee80211_device *ieee);
28418 - extern struct sk_buff *ieee80211_get_beacon(struct ieee80211_device *ieee);
28419 - extern void ieee80211_start_send_beacons(struct ieee80211_device *ieee);
28420 - extern void ieee80211_stop_send_beacons(struct ieee80211_device *ieee);
28421 -@@ -1385,7 +1385,7 @@ extern int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct
28422 - extern void notify_wx_assoc_event(struct ieee80211_device *ieee);
28423 - extern void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success);
28424 - extern void SendDisassociation(struct ieee80211_device *ieee,u8* asSta,u8 asRsn);
28425 --extern void ieee80211_start_scan(struct ieee80211_device *ieee);
28426 -+extern void ieee80211_rtl_start_scan(struct ieee80211_device *ieee);
28427 -
28428 - //Add for RF power on power off by lizhaoming 080512
28429 - extern void SendDisassociation(struct ieee80211_device *ieee,
28430 -diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c
28431 -index f882dd8..9128c18 100644
28432 ---- a/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c
28433 -+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_rx.c
28434 -@@ -469,7 +469,7 @@ drop:
28435 - /* All received frames are sent to this function. @skb contains the frame in
28436 - * IEEE 802.11 format, i.e., in the format it was sent over air.
28437 - * This function is called only as a tasklet (software IRQ). */
28438 --int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
28439 -+int ieee80211_rtl_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
28440 - struct ieee80211_rx_stats *rx_stats)
28441 - {
28442 - struct net_device *dev = ieee->dev;
28443 -diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
28444 -index 1fe19c3..c7c645a 100644
28445 ---- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
28446 -+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
28447 -@@ -689,7 +689,7 @@ void ieee80211_stop_scan(struct ieee80211_device *ieee)
28448 - }
28449 -
28450 - /* called with ieee->lock held */
28451 --void ieee80211_start_scan(struct ieee80211_device *ieee)
28452 -+void ieee80211_rtl_start_scan(struct ieee80211_device *ieee)
28453 - {
28454 - if(IS_DOT11D_ENABLE(ieee) )
28455 - {
28456 -@@ -1196,7 +1196,7 @@ void ieee80211_associate_step1(struct ieee80211_device *ieee)
28457 - }
28458 - }
28459 -
28460 --void ieee80211_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen)
28461 -+void ieee80211_rtl_auth_challenge(struct ieee80211_device *ieee, u8 *challenge, int chlen)
28462 - {
28463 - u8 *c;
28464 - struct sk_buff *skb;
28465 -@@ -1898,7 +1898,7 @@ associate_complete:
28466 -
28467 - ieee80211_associate_step2(ieee);
28468 - }else{
28469 -- ieee80211_auth_challenge(ieee, challenge, chlen);
28470 -+ ieee80211_rtl_auth_challenge(ieee, challenge, chlen);
28471 - }
28472 - }else{
28473 - ieee->softmac_stats.rx_auth_rs_err++;
28474 -@@ -2047,7 +2047,7 @@ void ieee80211_reset_queue(struct ieee80211_device *ieee)
28475 -
28476 - }
28477 -
28478 --void ieee80211_wake_queue(struct ieee80211_device *ieee)
28479 -+void ieee80211_rtl_wake_queue(struct ieee80211_device *ieee)
28480 - {
28481 -
28482 - unsigned long flags;
28483 -@@ -2089,7 +2089,7 @@ exit :
28484 - }
28485 -
28486 -
28487 --void ieee80211_stop_queue(struct ieee80211_device *ieee)
28488 -+void ieee80211_rtl_stop_queue(struct ieee80211_device *ieee)
28489 - {
28490 - //unsigned long flags;
28491 - //spin_lock_irqsave(&ieee->lock,flags);
28492 -@@ -2301,7 +2301,7 @@ void ieee80211_start_bss(struct ieee80211_device *ieee)
28493 - //#else
28494 - if (ieee->state == IEEE80211_NOLINK){
28495 - ieee->actscanning = true;
28496 -- ieee80211_start_scan(ieee);
28497 -+ ieee80211_rtl_start_scan(ieee);
28498 - }
28499 - //#endif
28500 - spin_unlock_irqrestore(&ieee->lock, flags);
28501 -@@ -2357,7 +2357,7 @@ void ieee80211_associate_retry_wq(struct work_struct *work)
28502 - if(ieee->state == IEEE80211_NOLINK){
28503 - ieee->beinretry = false;
28504 - ieee->actscanning = true;
28505 -- ieee80211_start_scan(ieee);
28506 -+ ieee80211_rtl_start_scan(ieee);
28507 - }
28508 - //YJ,add,080828, notify os here
28509 - if(ieee->state == IEEE80211_NOLINK)
28510 -diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c
28511 -index dde1f2e..69bd021 100644
28512 ---- a/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c
28513 -+++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_tx.c
28514 -@@ -304,7 +304,7 @@ ieee80211_classify(struct sk_buff *skb, struct ieee80211_network *network)
28515 - }
28516 -
28517 - /* SKBs are added to the ieee->tx_queue. */
28518 --int ieee80211_xmit(struct sk_buff *skb,
28519 -+int ieee80211_rtl_xmit(struct sk_buff *skb,
28520 - struct net_device *dev)
28521 - {
28522 - struct ieee80211_device *ieee = netdev_priv(dev);
28523 -diff --git a/drivers/staging/rtl8187se/r8180_core.c b/drivers/staging/rtl8187se/r8180_core.c
28524 -index 57c62b0..e0f13ef 100644
28525 ---- a/drivers/staging/rtl8187se/r8180_core.c
28526 -+++ b/drivers/staging/rtl8187se/r8180_core.c
28527 -@@ -1811,7 +1811,7 @@ void rtl8180_rx(struct net_device *dev)
28528 - if(priv->rx_skb->len > 4)
28529 - skb_trim(priv->rx_skb,priv->rx_skb->len-4);
28530 - #ifndef RX_DONT_PASS_UL
28531 -- if(!ieee80211_rx(priv->ieee80211,
28532 -+ if(!ieee80211_rtl_rx(priv->ieee80211,
28533 - priv->rx_skb, &stats)){
28534 - #endif // RX_DONT_PASS_UL
28535 -
28536 -@@ -1917,11 +1917,11 @@ rate)
28537 - if (!check_nic_enought_desc(dev, priority)){
28538 - DMESGW("Error: no descriptor left by previous TX (avail %d) ",
28539 - get_curr_tx_free_desc(dev, priority));
28540 -- ieee80211_stop_queue(priv->ieee80211);
28541 -+ ieee80211_rtl_stop_queue(priv->ieee80211);
28542 - }
28543 - rtl8180_tx(dev, skb->data, skb->len, priority, morefrag,0,rate);
28544 - if (!check_nic_enought_desc(dev, priority))
28545 -- ieee80211_stop_queue(priv->ieee80211);
28546 -+ ieee80211_rtl_stop_queue(priv->ieee80211);
28547 -
28548 - spin_unlock_irqrestore(&priv->tx_lock,flags);
28549 - }
28550 -@@ -3680,7 +3680,7 @@ static const struct net_device_ops rtl8180_netdev_ops = {
28551 - .ndo_set_mac_address = r8180_set_mac_adr,
28552 - .ndo_validate_addr = eth_validate_addr,
28553 - .ndo_change_mtu = eth_change_mtu,
28554 -- .ndo_start_xmit = ieee80211_xmit,
28555 -+ .ndo_start_xmit = ieee80211_rtl_xmit,
28556 - };
28557 -
28558 - static int __devinit rtl8180_pci_probe(struct pci_dev *pdev,
28559 -@@ -3900,7 +3900,7 @@ void rtl8180_try_wake_queue(struct net_device *dev, int pri)
28560 - spin_unlock_irqrestore(&priv->tx_lock,flags);
28561 -
28562 - if(enough_desc)
28563 -- ieee80211_wake_queue(priv->ieee80211);
28564 -+ ieee80211_rtl_wake_queue(priv->ieee80211);
28565 - }
28566 -
28567 - void rtl8180_tx_isr(struct net_device *dev, int pri,short error)
28568 -diff --git a/drivers/staging/rtl8187se/r8180_wx.c b/drivers/staging/rtl8187se/r8180_wx.c
28569 -index 536cb6e..124cde3 100644
28570 ---- a/drivers/staging/rtl8187se/r8180_wx.c
28571 -+++ b/drivers/staging/rtl8187se/r8180_wx.c
28572 -@@ -377,7 +377,7 @@ static int r8180_wx_set_scan(struct net_device *dev, struct iw_request_info *a,
28573 - // queue_work(priv->ieee80211->wq, &priv->ieee80211->wx_sync_scan_wq);
28574 - //printk("start scan============================>\n");
28575 - ieee80211_softmac_ips_scan_syncro(priv->ieee80211);
28576 --//ieee80211_start_scan(priv->ieee80211);
28577 -+//ieee80211_rtl_start_scan(priv->ieee80211);
28578 - /* intentionally forget to up sem */
28579 - // up(&priv->ieee80211->wx_sem);
28580 - ret = 0;
28581 -
28582
28583 Deleted: genpatches-2.6/trunk/2.6.33/2500_libata-fix-truncated-LBA48-ret-vals.patch
28584 ===================================================================
28585 --- genpatches-2.6/trunk/2.6.33/2500_libata-fix-truncated-LBA48-ret-vals.patch 2010-02-18 15:55:49 UTC (rev 1673)
28586 +++ genpatches-2.6/trunk/2.6.33/2500_libata-fix-truncated-LBA48-ret-vals.patch 2010-02-18 15:58:13 UTC (rev 1674)
28587 @@ -1,29 +0,0 @@
28588 -From: Douglas Gilbert <dgilbert@××××××××.com>
28589 -Date: Mon, 1 Feb 2010 18:11:38 +0000 (-0500)
28590 -Subject: libata-scsi passthru: fix bug which truncated LBA48 return values
28591 -X-Git-Tag: v2.6.33-rc7~5^2~3
28592 -X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=bc496ed00ab1411d3efaf295b72e0c9eb343e1a3
28593 -
28594 -libata-scsi passthru: fix bug which truncated LBA48 return values
28595 -
28596 -Fix assignment which overwrote SAT ATA PASS-THROUGH command EXTEND
28597 -bit setting (ATA_TFLAG_LBA48)
28598 -
28599 -Signed-off-by: Douglas Gilbert <dgilbert@××××××××.com>
28600 -Signed-off-by: Jeff Garzik <jgarzik@××××××.com>
28601 ----
28602 -
28603 -diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
28604 -index f4ea5a8..d096fbc 100644
28605 ---- a/drivers/ata/libata-scsi.c
28606 -+++ b/drivers/ata/libata-scsi.c
28607 -@@ -2875,7 +2875,7 @@ static unsigned int ata_scsi_pass_thru(struct ata_queued_cmd *qc)
28608 - * write indication (used for PIO/DMA setup), result TF is
28609 - * copied back and we don't whine too much about its failure.
28610 - */
28611 -- tf->flags = ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
28612 -+ tf->flags |= ATA_TFLAG_ISADDR | ATA_TFLAG_DEVICE;
28613 - if (scmd->sc_data_direction == DMA_TO_DEVICE)
28614 - tf->flags |= ATA_TFLAG_WRITE;
28615 -
28616 -