aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/filesystems/Locking212
-rw-r--r--Documentation/kernel-parameters.txt2
-rw-r--r--MAINTAINERS17
-rw-r--r--Makefile2
-rw-r--r--arch/arm/include/asm/hardware/it8152.h1
-rw-r--r--arch/arm/include/asm/highmem.h3
-rw-r--r--arch/arm/include/asm/sizes.h6
-rw-r--r--arch/arm/include/asm/system.h1
-rw-r--r--arch/arm/kernel/entry-common.S6
-rw-r--r--arch/arm/kernel/smp.c1
-rw-r--r--arch/arm/mach-pxa/Kconfig1
-rw-r--r--arch/arm/mach-pxa/sleep.S4
-rw-r--r--arch/arm/mm/cache-feroceon-l2.c37
-rw-r--r--arch/arm/mm/cache-xsc3l2.c57
-rw-r--r--arch/arm/mm/dma-mapping.c7
-rw-r--r--arch/arm/mm/flush.c7
-rw-r--r--arch/arm/mm/highmem.c87
-rw-r--r--arch/mn10300/kernel/irq.c2
-rw-r--r--arch/x86/kvm/i8259.c2
-rw-r--r--arch/x86/kvm/mmu.c3
-rw-r--r--arch/x86/oprofile/op_model_amd.c24
-rw-r--r--drivers/atm/atmtcp.c5
-rw-r--r--drivers/dma/mv_xor.c2
-rw-r--r--drivers/gpu/drm/i915/dvo_ch7017.c2
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c23
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h10
-rw-r--r--drivers/gpu/drm/i915/intel_bios.c2
-rw-r--r--drivers/gpu/drm/i915/intel_display.c21
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c3
-rw-r--r--drivers/hwmon/s3c-hwmon.c2
-rw-r--r--drivers/isdn/gigaset/capi.c1
-rw-r--r--drivers/media/video/cx25840/cx25840-core.c19
-rw-r--r--drivers/media/video/cx88/cx88-alsa.c99
-rw-r--r--drivers/media/video/cx88/cx88-cards.c7
-rw-r--r--drivers/media/video/cx88/cx88-video.c27
-rw-r--r--drivers/media/video/cx88/cx88.h6
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c2
-rw-r--r--drivers/media/video/wm8775.c104
-rw-r--r--drivers/net/atlx/atl1.c10
-rw-r--r--drivers/net/cnic.c10
-rw-r--r--drivers/net/ehea/ehea_ethtool.c7
-rw-r--r--drivers/net/ppp_generic.c9
-rw-r--r--drivers/net/skfp/skfddi.c2
-rw-r--r--drivers/net/starfire.c2
-rw-r--r--drivers/net/tg3.c2
-rw-r--r--drivers/platform/x86/intel_ips.c36
-rw-r--r--drivers/platform/x86/intel_ips.h21
-rw-r--r--drivers/spi/coldfire_qspi.c2
-rw-r--r--drivers/spi/omap2_mcspi.c39
-rw-r--r--drivers/staging/zram/zram_drv.c6
-rw-r--r--drivers/usb/atm/ueagle-atm.c22
-rw-r--r--include/linux/dmaengine.h13
-rw-r--r--include/media/wm8775.h3
-rw-r--r--init/do_mounts.c2
-rw-r--r--kernel/user.c1
-rw-r--r--kernel/watchdog.c3
-rw-r--r--mm/memcontrol.c19
-rw-r--r--net/bridge/br_multicast.c28
-rw-r--r--net/bridge/br_stp_bpdu.c2
-rw-r--r--net/can/bcm.c4
-rw-r--r--net/ipv4/route.c8
-rw-r--r--scripts/kconfig/menu.c14
-rw-r--r--security/integrity/ima/ima_policy.c2
-rw-r--r--sound/oss/soundcard.c4
-rw-r--r--sound/pci/hda/hda_intel.c1
-rw-r--r--sound/soc/codecs/max98088.c10
-rw-r--r--sound/soc/codecs/wm8523.c9
-rw-r--r--sound/soc/codecs/wm8741.c10
-rw-r--r--sound/soc/codecs/wm8753.c226
-rw-r--r--sound/soc/codecs/wm8904.c37
-rw-r--r--sound/soc/codecs/wm8940.c1
-rw-r--r--sound/soc/codecs/wm8955.c31
-rw-r--r--sound/soc/codecs/wm8960.c1
-rw-r--r--sound/soc/codecs/wm8962.c45
-rw-r--r--sound/soc/codecs/wm8971.c1
-rw-r--r--sound/soc/codecs/wm9081.c1
-rw-r--r--sound/soc/codecs/wm9090.c18
-rw-r--r--tools/perf/util/hist.c2
78 files changed, 726 insertions, 755 deletions
diff --git a/Documentation/filesystems/Locking b/Documentation/filesystems/Locking
index b6426f15b4ae..33fa3e5d38fd 100644
--- a/Documentation/filesystems/Locking
+++ b/Documentation/filesystems/Locking
@@ -18,7 +18,6 @@ prototypes:
18 char *(*d_dname)((struct dentry *dentry, char *buffer, int buflen); 18 char *(*d_dname)((struct dentry *dentry, char *buffer, int buflen);
19 19
20locking rules: 20locking rules:
21 none have BKL
22 dcache_lock rename_lock ->d_lock may block 21 dcache_lock rename_lock ->d_lock may block
23d_revalidate: no no no yes 22d_revalidate: no no no yes
24d_hash no no no yes 23d_hash no no no yes
@@ -42,18 +41,23 @@ ata *);
42 int (*rename) (struct inode *, struct dentry *, 41 int (*rename) (struct inode *, struct dentry *,
43 struct inode *, struct dentry *); 42 struct inode *, struct dentry *);
44 int (*readlink) (struct dentry *, char __user *,int); 43 int (*readlink) (struct dentry *, char __user *,int);
45 int (*follow_link) (struct dentry *, struct nameidata *); 44 void * (*follow_link) (struct dentry *, struct nameidata *);
45 void (*put_link) (struct dentry *, struct nameidata *, void *);
46 void (*truncate) (struct inode *); 46 void (*truncate) (struct inode *);
47 int (*permission) (struct inode *, int, struct nameidata *); 47 int (*permission) (struct inode *, int, struct nameidata *);
48 int (*check_acl)(struct inode *, int);
48 int (*setattr) (struct dentry *, struct iattr *); 49 int (*setattr) (struct dentry *, struct iattr *);
49 int (*getattr) (struct vfsmount *, struct dentry *, struct kstat *); 50 int (*getattr) (struct vfsmount *, struct dentry *, struct kstat *);
50 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int); 51 int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
51 ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t); 52 ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
52 ssize_t (*listxattr) (struct dentry *, char *, size_t); 53 ssize_t (*listxattr) (struct dentry *, char *, size_t);
53 int (*removexattr) (struct dentry *, const char *); 54 int (*removexattr) (struct dentry *, const char *);
55 void (*truncate_range)(struct inode *, loff_t, loff_t);
56 long (*fallocate)(struct inode *inode, int mode, loff_t offset, loff_t len);
57 int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, u64 len);
54 58
55locking rules: 59locking rules:
56 all may block, none have BKL 60 all may block
57 i_mutex(inode) 61 i_mutex(inode)
58lookup: yes 62lookup: yes
59create: yes 63create: yes
@@ -66,19 +70,24 @@ rmdir: yes (both) (see below)
66rename: yes (all) (see below) 70rename: yes (all) (see below)
67readlink: no 71readlink: no
68follow_link: no 72follow_link: no
73put_link: no
69truncate: yes (see below) 74truncate: yes (see below)
70setattr: yes 75setattr: yes
71permission: no 76permission: no
77check_acl: no
72getattr: no 78getattr: no
73setxattr: yes 79setxattr: yes
74getxattr: no 80getxattr: no
75listxattr: no 81listxattr: no
76removexattr: yes 82removexattr: yes
83truncate_range: yes
84fallocate: no
85fiemap: no
77 Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on 86 Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on
78victim. 87victim.
79 cross-directory ->rename() has (per-superblock) ->s_vfs_rename_sem. 88 cross-directory ->rename() has (per-superblock) ->s_vfs_rename_sem.
80 ->truncate() is never called directly - it's a callback, not a 89 ->truncate() is never called directly - it's a callback, not a
81method. It's called by vmtruncate() - library function normally used by 90method. It's called by vmtruncate() - deprecated library function used by
82->setattr(). Locking information above applies to that call (i.e. is 91->setattr(). Locking information above applies to that call (i.e. is
83inherited from ->setattr() - vmtruncate() is used when ATTR_SIZE had been 92inherited from ->setattr() - vmtruncate() is used when ATTR_SIZE had been
84passed). 93passed).
@@ -91,7 +100,7 @@ prototypes:
91 struct inode *(*alloc_inode)(struct super_block *sb); 100 struct inode *(*alloc_inode)(struct super_block *sb);
92 void (*destroy_inode)(struct inode *); 101 void (*destroy_inode)(struct inode *);
93 void (*dirty_inode) (struct inode *); 102 void (*dirty_inode) (struct inode *);
94 int (*write_inode) (struct inode *, int); 103 int (*write_inode) (struct inode *, struct writeback_control *wbc);
95 int (*drop_inode) (struct inode *); 104 int (*drop_inode) (struct inode *);
96 void (*evict_inode) (struct inode *); 105 void (*evict_inode) (struct inode *);
97 void (*put_super) (struct super_block *); 106 void (*put_super) (struct super_block *);
@@ -105,10 +114,10 @@ prototypes:
105 int (*show_options)(struct seq_file *, struct vfsmount *); 114 int (*show_options)(struct seq_file *, struct vfsmount *);
106 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); 115 ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
107 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); 116 ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
117 int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t);
108 118
109locking rules: 119locking rules:
110 All may block [not true, see below] 120 All may block [not true, see below]
111 None have BKL
112 s_umount 121 s_umount
113alloc_inode: 122alloc_inode:
114destroy_inode: 123destroy_inode:
@@ -127,6 +136,7 @@ umount_begin: no
127show_options: no (namespace_sem) 136show_options: no (namespace_sem)
128quota_read: no (see below) 137quota_read: no (see below)
129quota_write: no (see below) 138quota_write: no (see below)
139bdev_try_to_free_page: no (see below)
130 140
131->statfs() has s_umount (shared) when called by ustat(2) (native or 141->statfs() has s_umount (shared) when called by ustat(2) (native or
132compat), but that's an accident of bad API; s_umount is used to pin 142compat), but that's an accident of bad API; s_umount is used to pin
@@ -139,19 +149,25 @@ be the only ones operating on the quota file by the quota code (via
139dqio_sem) (unless an admin really wants to screw up something and 149dqio_sem) (unless an admin really wants to screw up something and
140writes to quota files with quotas on). For other details about locking 150writes to quota files with quotas on). For other details about locking
141see also dquot_operations section. 151see also dquot_operations section.
152->bdev_try_to_free_page is called from the ->releasepage handler of
153the block device inode. See there for more details.
142 154
143--------------------------- file_system_type --------------------------- 155--------------------------- file_system_type ---------------------------
144prototypes: 156prototypes:
145 int (*get_sb) (struct file_system_type *, int, 157 int (*get_sb) (struct file_system_type *, int,
146 const char *, void *, struct vfsmount *); 158 const char *, void *, struct vfsmount *);
159 struct dentry *(*mount) (struct file_system_type *, int,
160 const char *, void *);
147 void (*kill_sb) (struct super_block *); 161 void (*kill_sb) (struct super_block *);
148locking rules: 162locking rules:
149 may block BKL 163 may block
150get_sb yes no 164get_sb yes
151kill_sb yes no 165mount yes
166kill_sb yes
152 167
153->get_sb() returns error or 0 with locked superblock attached to the vfsmount 168->get_sb() returns error or 0 with locked superblock attached to the vfsmount
154(exclusive on ->s_umount). 169(exclusive on ->s_umount).
170->mount() returns ERR_PTR or the root dentry.
155->kill_sb() takes a write-locked superblock, does all shutdown work on it, 171->kill_sb() takes a write-locked superblock, does all shutdown work on it,
156unlocks and drops the reference. 172unlocks and drops the reference.
157 173
@@ -176,27 +192,35 @@ prototypes:
176 void (*freepage)(struct page *); 192 void (*freepage)(struct page *);
177 int (*direct_IO)(int, struct kiocb *, const struct iovec *iov, 193 int (*direct_IO)(int, struct kiocb *, const struct iovec *iov,
178 loff_t offset, unsigned long nr_segs); 194 loff_t offset, unsigned long nr_segs);
179 int (*launder_page) (struct page *); 195 int (*get_xip_mem)(struct address_space *, pgoff_t, int, void **,
196 unsigned long *);
197 int (*migratepage)(struct address_space *, struct page *, struct page *);
198 int (*launder_page)(struct page *);
199 int (*is_partially_uptodate)(struct page *, read_descriptor_t *, unsigned long);
200 int (*error_remove_page)(struct address_space *, struct page *);
180 201
181locking rules: 202locking rules:
182 All except set_page_dirty and freepage may block 203 All except set_page_dirty and freepage may block
183 204
184 BKL PageLocked(page) i_mutex 205 PageLocked(page) i_mutex
185writepage: no yes, unlocks (see below) 206writepage: yes, unlocks (see below)
186readpage: no yes, unlocks 207readpage: yes, unlocks
187sync_page: no maybe 208sync_page: maybe
188writepages: no 209writepages:
189set_page_dirty no no 210set_page_dirty no
190readpages: no 211readpages:
191write_begin: no locks the page yes 212write_begin: locks the page yes
192write_end: no yes, unlocks yes 213write_end: yes, unlocks yes
193perform_write: no n/a yes 214bmap:
194bmap: no 215invalidatepage: yes
195invalidatepage: no yes 216releasepage: yes
196releasepage: no yes 217freepage: yes
197freepage: no yes 218direct_IO:
198direct_IO: no 219get_xip_mem: maybe
199launder_page: no yes 220migratepage: yes (both)
221launder_page: yes
222is_partially_uptodate: yes
223error_remove_page: yes
200 224
201 ->write_begin(), ->write_end(), ->sync_page() and ->readpage() 225 ->write_begin(), ->write_end(), ->sync_page() and ->readpage()
202may be called from the request handler (/dev/loop). 226may be called from the request handler (/dev/loop).
@@ -276,9 +300,8 @@ under spinlock (it cannot block) and is sometimes called with the page
276not locked. 300not locked.
277 301
278 ->bmap() is currently used by legacy ioctl() (FIBMAP) provided by some 302 ->bmap() is currently used by legacy ioctl() (FIBMAP) provided by some
279filesystems and by the swapper. The latter will eventually go away. All 303filesystems and by the swapper. The latter will eventually go away. Please,
280instances do not actually need the BKL. Please, keep it that way and don't 304keep it that way and don't breed new callers.
281breed new callers.
282 305
283 ->invalidatepage() is called when the filesystem must attempt to drop 306 ->invalidatepage() is called when the filesystem must attempt to drop
284some or all of the buffers from the page when it is being truncated. It 307some or all of the buffers from the page when it is being truncated. It
@@ -299,47 +322,37 @@ cleaned, or an error value if not. Note that in order to prevent the page
299getting mapped back in and redirtied, it needs to be kept locked 322getting mapped back in and redirtied, it needs to be kept locked
300across the entire operation. 323across the entire operation.
301 324
302 Note: currently almost all instances of address_space methods are
303using BKL for internal serialization and that's one of the worst sources
304of contention. Normally they are calling library functions (in fs/buffer.c)
305and pass foo_get_block() as a callback (on local block-based filesystems,
306indeed). BKL is not needed for library stuff and is usually taken by
307foo_get_block(). It's an overkill, since block bitmaps can be protected by
308internal fs locking and real critical areas are much smaller than the areas
309filesystems protect now.
310
311----------------------- file_lock_operations ------------------------------ 325----------------------- file_lock_operations ------------------------------
312prototypes: 326prototypes:
313 void (*fl_insert)(struct file_lock *); /* lock insertion callback */
314 void (*fl_remove)(struct file_lock *); /* lock removal callback */
315 void (*fl_copy_lock)(struct file_lock *, struct file_lock *); 327 void (*fl_copy_lock)(struct file_lock *, struct file_lock *);
316 void (*fl_release_private)(struct file_lock *); 328 void (*fl_release_private)(struct file_lock *);
317 329
318 330
319locking rules: 331locking rules:
320 BKL may block 332 file_lock_lock may block
321fl_insert: yes no 333fl_copy_lock: yes no
322fl_remove: yes no 334fl_release_private: maybe no
323fl_copy_lock: yes no
324fl_release_private: yes yes
325 335
326----------------------- lock_manager_operations --------------------------- 336----------------------- lock_manager_operations ---------------------------
327prototypes: 337prototypes:
328 int (*fl_compare_owner)(struct file_lock *, struct file_lock *); 338 int (*fl_compare_owner)(struct file_lock *, struct file_lock *);
329 void (*fl_notify)(struct file_lock *); /* unblock callback */ 339 void (*fl_notify)(struct file_lock *); /* unblock callback */
340 int (*fl_grant)(struct file_lock *, struct file_lock *, int);
330 void (*fl_release_private)(struct file_lock *); 341 void (*fl_release_private)(struct file_lock *);
331 void (*fl_break)(struct file_lock *); /* break_lease callback */ 342 void (*fl_break)(struct file_lock *); /* break_lease callback */
343 int (*fl_mylease)(struct file_lock *, struct file_lock *);
344 int (*fl_change)(struct file_lock **, int);
332 345
333locking rules: 346locking rules:
334 BKL may block 347 file_lock_lock may block
335fl_compare_owner: yes no 348fl_compare_owner: yes no
336fl_notify: yes no 349fl_notify: yes no
337fl_release_private: yes yes 350fl_grant: no no
338fl_break: yes no 351fl_release_private: maybe no
339 352fl_break: yes no
340 Currently only NFSD and NLM provide instances of this class. None of the 353fl_mylease: yes no
341them block. If you have out-of-tree instances - please, show up. Locking 354fl_change yes no
342in that area will change. 355
343--------------------------- buffer_head ----------------------------------- 356--------------------------- buffer_head -----------------------------------
344prototypes: 357prototypes:
345 void (*b_end_io)(struct buffer_head *bh, int uptodate); 358 void (*b_end_io)(struct buffer_head *bh, int uptodate);
@@ -364,17 +377,17 @@ prototypes:
364 void (*swap_slot_free_notify) (struct block_device *, unsigned long); 377 void (*swap_slot_free_notify) (struct block_device *, unsigned long);
365 378
366locking rules: 379locking rules:
367 BKL bd_mutex 380 bd_mutex
368open: no yes 381open: yes
369release: no yes 382release: yes
370ioctl: no no 383ioctl: no
371compat_ioctl: no no 384compat_ioctl: no
372direct_access: no no 385direct_access: no
373media_changed: no no 386media_changed: no
374unlock_native_capacity: no no 387unlock_native_capacity: no
375revalidate_disk: no no 388revalidate_disk: no
376getgeo: no no 389getgeo: no
377swap_slot_free_notify: no no (see below) 390swap_slot_free_notify: no (see below)
378 391
379media_changed, unlock_native_capacity and revalidate_disk are called only from 392media_changed, unlock_native_capacity and revalidate_disk are called only from
380check_disk_change(). 393check_disk_change().
@@ -413,34 +426,21 @@ prototypes:
413 unsigned long (*get_unmapped_area)(struct file *, unsigned long, 426 unsigned long (*get_unmapped_area)(struct file *, unsigned long,
414 unsigned long, unsigned long, unsigned long); 427 unsigned long, unsigned long, unsigned long);
415 int (*check_flags)(int); 428 int (*check_flags)(int);
429 int (*flock) (struct file *, int, struct file_lock *);
430 ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *,
431 size_t, unsigned int);
432 ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *,
433 size_t, unsigned int);
434 int (*setlease)(struct file *, long, struct file_lock **);
416}; 435};
417 436
418locking rules: 437locking rules:
419 All may block. 438 All may block except for ->setlease.
420 BKL 439 No VFS locks held on entry except for ->fsync and ->setlease.
421llseek: no (see below) 440
422read: no 441->fsync() has i_mutex on inode.
423aio_read: no 442
424write: no 443->setlease has the file_list_lock held and must not sleep.
425aio_write: no
426readdir: no
427poll: no
428unlocked_ioctl: no
429compat_ioctl: no
430mmap: no
431open: no
432flush: no
433release: no
434fsync: no (see below)
435aio_fsync: no
436fasync: no
437lock: yes
438readv: no
439writev: no
440sendfile: no
441sendpage: no
442get_unmapped_area: no
443check_flags: no
444 444
445->llseek() locking has moved from llseek to the individual llseek 445->llseek() locking has moved from llseek to the individual llseek
446implementations. If your fs is not using generic_file_llseek, you 446implementations. If your fs is not using generic_file_llseek, you
@@ -450,17 +450,10 @@ mutex or just to use i_size_read() instead.
450Note: this does not protect the file->f_pos against concurrent modifications 450Note: this does not protect the file->f_pos against concurrent modifications
451since this is something the userspace has to take care about. 451since this is something the userspace has to take care about.
452 452
453Note: ext2_release() was *the* source of contention on fs-intensive 453->fasync() is responsible for maintaining the FASYNC bit in filp->f_flags.
454loads and dropping BKL on ->release() helps to get rid of that (we still 454Most instances call fasync_helper(), which does that maintenance, so it's
455grab BKL for cases when we close a file that had been opened r/w, but that 455not normally something one needs to worry about. Return values > 0 will be
456can and should be done using the internal locking with smaller critical areas). 456mapped to zero in the VFS layer.
457Current worst offender is ext2_get_block()...
458
459->fasync() is called without BKL protection, and is responsible for
460maintaining the FASYNC bit in filp->f_flags. Most instances call
461fasync_helper(), which does that maintenance, so it's not normally
462something one needs to worry about. Return values > 0 will be mapped to
463zero in the VFS layer.
464 457
465->readdir() and ->ioctl() on directories must be changed. Ideally we would 458->readdir() and ->ioctl() on directories must be changed. Ideally we would
466move ->readdir() to inode_operations and use a separate method for directory 459move ->readdir() to inode_operations and use a separate method for directory
@@ -471,8 +464,6 @@ components. And there are other reasons why the current interface is a mess...
471->read on directories probably must go away - we should just enforce -EISDIR 464->read on directories probably must go away - we should just enforce -EISDIR
472in sys_read() and friends. 465in sys_read() and friends.
473 466
474->fsync() has i_mutex on inode.
475
476--------------------------- dquot_operations ------------------------------- 467--------------------------- dquot_operations -------------------------------
477prototypes: 468prototypes:
478 int (*write_dquot) (struct dquot *); 469 int (*write_dquot) (struct dquot *);
@@ -507,12 +498,12 @@ prototypes:
507 int (*access)(struct vm_area_struct *, unsigned long, void*, int, int); 498 int (*access)(struct vm_area_struct *, unsigned long, void*, int, int);
508 499
509locking rules: 500locking rules:
510 BKL mmap_sem PageLocked(page) 501 mmap_sem PageLocked(page)
511open: no yes 502open: yes
512close: no yes 503close: yes
513fault: no yes can return with page locked 504fault: yes can return with page locked
514page_mkwrite: no yes can return with page locked 505page_mkwrite: yes can return with page locked
515access: no yes 506access: yes
516 507
517 ->fault() is called when a previously not present pte is about 508 ->fault() is called when a previously not present pte is about
518to be faulted in. The filesystem must find and return the page associated 509to be faulted in. The filesystem must find and return the page associated
@@ -539,6 +530,3 @@ VM_IO | VM_PFNMAP VMAs.
539 530
540(if you break something or notice that it is broken and do not fix it yourself 531(if you break something or notice that it is broken and do not fix it yourself
541- at least put it here) 532- at least put it here)
542
543ipc/shm.c::shm_delete() - may need BKL.
544->read() and ->write() in many drivers are (probably) missing BKL.
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 316c723a950c..992cda68fa63 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1751,7 +1751,7 @@ and is between 256 and 4096 characters. It is defined in the file
1751 1751
1752 nousb [USB] Disable the USB subsystem 1752 nousb [USB] Disable the USB subsystem
1753 1753
1754 nowatchdog [KNL] Disable the lockup detector. 1754 nowatchdog [KNL] Disable the lockup detector (NMI watchdog).
1755 1755
1756 nowb [ARM] 1756 nowb [ARM]
1757 1757
diff --git a/MAINTAINERS b/MAINTAINERS
index 92e5b67105f0..b1dda78a1e75 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -792,11 +792,14 @@ S: Maintained
792 792
793ARM/NOMADIK ARCHITECTURE 793ARM/NOMADIK ARCHITECTURE
794M: Alessandro Rubini <rubini@unipv.it> 794M: Alessandro Rubini <rubini@unipv.it>
795M: Linus Walleij <linus.walleij@stericsson.com>
795M: STEricsson <STEricsson_nomadik_linux@list.st.com> 796M: STEricsson <STEricsson_nomadik_linux@list.st.com>
796L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 797L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
797S: Maintained 798S: Maintained
798F: arch/arm/mach-nomadik/ 799F: arch/arm/mach-nomadik/
799F: arch/arm/plat-nomadik/ 800F: arch/arm/plat-nomadik/
801F: drivers/i2c/busses/i2c-nomadik.c
802T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson.git
800 803
801ARM/OPENMOKO NEO FREERUNNER (GTA02) MACHINE SUPPORT 804ARM/OPENMOKO NEO FREERUNNER (GTA02) MACHINE SUPPORT
802M: Nelson Castillo <arhuaco@freaks-unidos.net> 805M: Nelson Castillo <arhuaco@freaks-unidos.net>
@@ -998,12 +1001,24 @@ F: drivers/i2c/busses/i2c-stu300.c
998F: drivers/rtc/rtc-coh901331.c 1001F: drivers/rtc/rtc-coh901331.c
999F: drivers/watchdog/coh901327_wdt.c 1002F: drivers/watchdog/coh901327_wdt.c
1000F: drivers/dma/coh901318* 1003F: drivers/dma/coh901318*
1004F: drivers/mfd/ab3100*
1005F: drivers/rtc/rtc-ab3100.c
1006F: drivers/rtc/rtc-coh901331.c
1007T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson.git
1001 1008
1002ARM/U8500 ARM ARCHITECTURE 1009ARM/Ux500 ARM ARCHITECTURE
1003M: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com> 1010M: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
1011M: Linus Walleij <linus.walleij@stericsson.com>
1004L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers) 1012L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
1005S: Maintained 1013S: Maintained
1006F: arch/arm/mach-ux500/ 1014F: arch/arm/mach-ux500/
1015F: drivers/dma/ste_dma40*
1016F: drivers/mfd/ab3550*
1017F: drivers/mfd/abx500*
1018F: drivers/mfd/ab8500*
1019F: drivers/mfd/stmpe*
1020F: drivers/rtc/rtc-ab8500.c
1021T: git git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-stericsson.git
1007 1022
1008ARM/VFP SUPPORT 1023ARM/VFP SUPPORT
1009M: Russell King <linux@arm.linux.org.uk> 1024M: Russell King <linux@arm.linux.org.uk>
diff --git a/Makefile b/Makefile
index e7c41f1344e5..74b25559f831 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
1VERSION = 2 1VERSION = 2
2PATCHLEVEL = 6 2PATCHLEVEL = 6
3SUBLEVEL = 37 3SUBLEVEL = 37
4EXTRAVERSION = -rc8 4EXTRAVERSION =
5NAME = Flesh-Eating Bats with Fangs 5NAME = Flesh-Eating Bats with Fangs
6 6
7# *DOCUMENTATION* 7# *DOCUMENTATION*
diff --git a/arch/arm/include/asm/hardware/it8152.h b/arch/arm/include/asm/hardware/it8152.h
index 21fa272301f8..b2f95c72287c 100644
--- a/arch/arm/include/asm/hardware/it8152.h
+++ b/arch/arm/include/asm/hardware/it8152.h
@@ -76,6 +76,7 @@ extern unsigned long it8152_base_address;
76 IT8152_PD_IRQ(0) Audio controller (ACR) 76 IT8152_PD_IRQ(0) Audio controller (ACR)
77 */ 77 */
78#define IT8152_IRQ(x) (IRQ_BOARD_START + (x)) 78#define IT8152_IRQ(x) (IRQ_BOARD_START + (x))
79#define IT8152_LAST_IRQ (IRQ_BOARD_START + 40)
79 80
80/* IRQ-sources in 3 groups - local devices, LPC (serial), and external PCI */ 81/* IRQ-sources in 3 groups - local devices, LPC (serial), and external PCI */
81#define IT8152_LD_IRQ_COUNT 9 82#define IT8152_LD_IRQ_COUNT 9
diff --git a/arch/arm/include/asm/highmem.h b/arch/arm/include/asm/highmem.h
index 1fc684e70ab6..7080e2c8fa62 100644
--- a/arch/arm/include/asm/highmem.h
+++ b/arch/arm/include/asm/highmem.h
@@ -25,9 +25,6 @@ extern void *kmap_high(struct page *page);
25extern void *kmap_high_get(struct page *page); 25extern void *kmap_high_get(struct page *page);
26extern void kunmap_high(struct page *page); 26extern void kunmap_high(struct page *page);
27 27
28extern void *kmap_high_l1_vipt(struct page *page, pte_t *saved_pte);
29extern void kunmap_high_l1_vipt(struct page *page, pte_t saved_pte);
30
31/* 28/*
32 * The following functions are already defined by <linux/highmem.h> 29 * The following functions are already defined by <linux/highmem.h>
33 * when CONFIG_HIGHMEM is not set. 30 * when CONFIG_HIGHMEM is not set.
diff --git a/arch/arm/include/asm/sizes.h b/arch/arm/include/asm/sizes.h
index 4fc1565e4f93..316bb2b2be3d 100644
--- a/arch/arm/include/asm/sizes.h
+++ b/arch/arm/include/asm/sizes.h
@@ -13,9 +13,6 @@
13 * along with this program; if not, write to the Free Software 13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 */ 15 */
16/* DO NOT EDIT!! - this file automatically generated
17 * from .s file by awk -f s2h.awk
18 */
19/* Size definitions 16/* Size definitions
20 * Copyright (C) ARM Limited 1998. All rights reserved. 17 * Copyright (C) ARM Limited 1998. All rights reserved.
21 */ 18 */
@@ -25,6 +22,9 @@
25 22
26/* handy sizes */ 23/* handy sizes */
27#define SZ_16 0x00000010 24#define SZ_16 0x00000010
25#define SZ_32 0x00000020
26#define SZ_64 0x00000040
27#define SZ_128 0x00000080
28#define SZ_256 0x00000100 28#define SZ_256 0x00000100
29#define SZ_512 0x00000200 29#define SZ_512 0x00000200
30 30
diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index 1120f18a6b17..80025948b8ad 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -150,6 +150,7 @@ extern unsigned int user_debug;
150#define rmb() dmb() 150#define rmb() dmb()
151#define wmb() mb() 151#define wmb() mb()
152#else 152#else
153#include <asm/memory.h>
153#define mb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0) 154#define mb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)
154#define rmb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0) 155#define rmb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)
155#define wmb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0) 156#define wmb() do { if (arch_is_coherent()) dmb(); else barrier(); } while (0)
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 8bfa98757cd2..80bf8cd88d7c 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -29,6 +29,9 @@ ret_fast_syscall:
29 ldr r1, [tsk, #TI_FLAGS] 29 ldr r1, [tsk, #TI_FLAGS]
30 tst r1, #_TIF_WORK_MASK 30 tst r1, #_TIF_WORK_MASK
31 bne fast_work_pending 31 bne fast_work_pending
32#if defined(CONFIG_IRQSOFF_TRACER)
33 asm_trace_hardirqs_on
34#endif
32 35
33 /* perform architecture specific actions before user return */ 36 /* perform architecture specific actions before user return */
34 arch_ret_to_user r1, lr 37 arch_ret_to_user r1, lr
@@ -65,6 +68,9 @@ ret_slow_syscall:
65 tst r1, #_TIF_WORK_MASK 68 tst r1, #_TIF_WORK_MASK
66 bne work_pending 69 bne work_pending
67no_work_pending: 70no_work_pending:
71#if defined(CONFIG_IRQSOFF_TRACER)
72 asm_trace_hardirqs_on
73#endif
68 /* perform architecture specific actions before user return */ 74 /* perform architecture specific actions before user return */
69 arch_ret_to_user r1, lr 75 arch_ret_to_user r1, lr
70 76
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 8c1959590252..9066473c0ebc 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -310,7 +310,6 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
310 * All kernel threads share the same mm context; grab a 310 * All kernel threads share the same mm context; grab a
311 * reference and switch to it. 311 * reference and switch to it.
312 */ 312 */
313 atomic_inc(&mm->mm_users);
314 atomic_inc(&mm->mm_count); 313 atomic_inc(&mm->mm_count);
315 current->active_mm = mm; 314 current->active_mm = mm;
316 cpumask_set_cpu(cpu, mm_cpumask(mm)); 315 cpumask_set_cpu(cpu, mm_cpumask(mm));
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index dd235ecc9d6c..c93e73d54dd1 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -540,6 +540,7 @@ config MACH_ICONTROL
540config ARCH_PXA_ESERIES 540config ARCH_PXA_ESERIES
541 bool "PXA based Toshiba e-series PDAs" 541 bool "PXA based Toshiba e-series PDAs"
542 select PXA25x 542 select PXA25x
543 select FB_W100
543 544
544config MACH_E330 545config MACH_E330
545 bool "Toshiba e330" 546 bool "Toshiba e330"
diff --git a/arch/arm/mach-pxa/sleep.S b/arch/arm/mach-pxa/sleep.S
index 52c30b01a671..ae008110db4e 100644
--- a/arch/arm/mach-pxa/sleep.S
+++ b/arch/arm/mach-pxa/sleep.S
@@ -353,8 +353,8 @@ resume_turn_on_mmu:
353 353
354 @ Let us ensure we jump to resume_after_mmu only when the mcr above 354 @ Let us ensure we jump to resume_after_mmu only when the mcr above
355 @ actually took effect. They call it the "cpwait" operation. 355 @ actually took effect. They call it the "cpwait" operation.
356 mrc p15, 0, r1, c2, c0, 0 @ queue a dependency on CP15 356 mrc p15, 0, r0, c2, c0, 0 @ queue a dependency on CP15
357 sub pc, r2, r1, lsr #32 @ jump to virtual addr 357 sub pc, r2, r0, lsr #32 @ jump to virtual addr
358 nop 358 nop
359 nop 359 nop
360 nop 360 nop
diff --git a/arch/arm/mm/cache-feroceon-l2.c b/arch/arm/mm/cache-feroceon-l2.c
index 6e77c042d8e9..e0b0e7a4ec68 100644
--- a/arch/arm/mm/cache-feroceon-l2.c
+++ b/arch/arm/mm/cache-feroceon-l2.c
@@ -13,13 +13,9 @@
13 */ 13 */
14 14
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/highmem.h>
16#include <asm/cacheflush.h> 17#include <asm/cacheflush.h>
17#include <asm/kmap_types.h>
18#include <asm/fixmap.h>
19#include <asm/pgtable.h>
20#include <asm/tlbflush.h>
21#include <plat/cache-feroceon-l2.h> 18#include <plat/cache-feroceon-l2.h>
22#include "mm.h"
23 19
24/* 20/*
25 * Low-level cache maintenance operations. 21 * Low-level cache maintenance operations.
@@ -39,27 +35,30 @@
39 * between which we don't want to be preempted. 35 * between which we don't want to be preempted.
40 */ 36 */
41 37
42static inline unsigned long l2_start_va(unsigned long paddr) 38static inline unsigned long l2_get_va(unsigned long paddr)
43{ 39{
44#ifdef CONFIG_HIGHMEM 40#ifdef CONFIG_HIGHMEM
45 /* 41 /*
46 * Let's do our own fixmap stuff in a minimal way here.
47 * Because range ops can't be done on physical addresses, 42 * Because range ops can't be done on physical addresses,
48 * we simply install a virtual mapping for it only for the 43 * we simply install a virtual mapping for it only for the
49 * TLB lookup to occur, hence no need to flush the untouched 44 * TLB lookup to occur, hence no need to flush the untouched
50 * memory mapping. This is protected with the disabling of 45 * memory mapping afterwards (note: a cache flush may happen
51 * interrupts by the caller. 46 * in some circumstances depending on the path taken in kunmap_atomic).
52 */ 47 */
53 unsigned long idx = KM_L2_CACHE + KM_TYPE_NR * smp_processor_id(); 48 void *vaddr = kmap_atomic_pfn(paddr >> PAGE_SHIFT);
54 unsigned long vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); 49 return (unsigned long)vaddr + (paddr & ~PAGE_MASK);
55 set_pte_ext(TOP_PTE(vaddr), pfn_pte(paddr >> PAGE_SHIFT, PAGE_KERNEL), 0);
56 local_flush_tlb_kernel_page(vaddr);
57 return vaddr + (paddr & ~PAGE_MASK);
58#else 50#else
59 return __phys_to_virt(paddr); 51 return __phys_to_virt(paddr);
60#endif 52#endif
61} 53}
62 54
55static inline void l2_put_va(unsigned long vaddr)
56{
57#ifdef CONFIG_HIGHMEM
58 kunmap_atomic((void *)vaddr);
59#endif
60}
61
63static inline void l2_clean_pa(unsigned long addr) 62static inline void l2_clean_pa(unsigned long addr)
64{ 63{
65 __asm__("mcr p15, 1, %0, c15, c9, 3" : : "r" (addr)); 64 __asm__("mcr p15, 1, %0, c15, c9, 3" : : "r" (addr));
@@ -76,13 +75,14 @@ static inline void l2_clean_pa_range(unsigned long start, unsigned long end)
76 */ 75 */
77 BUG_ON((start ^ end) >> PAGE_SHIFT); 76 BUG_ON((start ^ end) >> PAGE_SHIFT);
78 77
79 raw_local_irq_save(flags); 78 va_start = l2_get_va(start);
80 va_start = l2_start_va(start);
81 va_end = va_start + (end - start); 79 va_end = va_start + (end - start);
80 raw_local_irq_save(flags);
82 __asm__("mcr p15, 1, %0, c15, c9, 4\n\t" 81 __asm__("mcr p15, 1, %0, c15, c9, 4\n\t"
83 "mcr p15, 1, %1, c15, c9, 5" 82 "mcr p15, 1, %1, c15, c9, 5"
84 : : "r" (va_start), "r" (va_end)); 83 : : "r" (va_start), "r" (va_end));
85 raw_local_irq_restore(flags); 84 raw_local_irq_restore(flags);
85 l2_put_va(va_start);
86} 86}
87 87
88static inline void l2_clean_inv_pa(unsigned long addr) 88static inline void l2_clean_inv_pa(unsigned long addr)
@@ -106,13 +106,14 @@ static inline void l2_inv_pa_range(unsigned long start, unsigned long end)
106 */ 106 */
107 BUG_ON((start ^ end) >> PAGE_SHIFT); 107 BUG_ON((start ^ end) >> PAGE_SHIFT);
108 108
109 raw_local_irq_save(flags); 109 va_start = l2_get_va(start);
110 va_start = l2_start_va(start);
111 va_end = va_start + (end - start); 110 va_end = va_start + (end - start);
111 raw_local_irq_save(flags);
112 __asm__("mcr p15, 1, %0, c15, c11, 4\n\t" 112 __asm__("mcr p15, 1, %0, c15, c11, 4\n\t"
113 "mcr p15, 1, %1, c15, c11, 5" 113 "mcr p15, 1, %1, c15, c11, 5"
114 : : "r" (va_start), "r" (va_end)); 114 : : "r" (va_start), "r" (va_end));
115 raw_local_irq_restore(flags); 115 raw_local_irq_restore(flags);
116 l2_put_va(va_start);
116} 117}
117 118
118static inline void l2_inv_all(void) 119static inline void l2_inv_all(void)
diff --git a/arch/arm/mm/cache-xsc3l2.c b/arch/arm/mm/cache-xsc3l2.c
index c3154928bccd..5a32020471e3 100644
--- a/arch/arm/mm/cache-xsc3l2.c
+++ b/arch/arm/mm/cache-xsc3l2.c
@@ -17,14 +17,10 @@
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 18 */
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/highmem.h>
20#include <asm/system.h> 21#include <asm/system.h>
21#include <asm/cputype.h> 22#include <asm/cputype.h>
22#include <asm/cacheflush.h> 23#include <asm/cacheflush.h>
23#include <asm/kmap_types.h>
24#include <asm/fixmap.h>
25#include <asm/pgtable.h>
26#include <asm/tlbflush.h>
27#include "mm.h"
28 24
29#define CR_L2 (1 << 26) 25#define CR_L2 (1 << 26)
30 26
@@ -71,16 +67,15 @@ static inline void xsc3_l2_inv_all(void)
71 dsb(); 67 dsb();
72} 68}
73 69
70static inline void l2_unmap_va(unsigned long va)
71{
74#ifdef CONFIG_HIGHMEM 72#ifdef CONFIG_HIGHMEM
75#define l2_map_save_flags(x) raw_local_save_flags(x) 73 if (va != -1)
76#define l2_map_restore_flags(x) raw_local_irq_restore(x) 74 kunmap_atomic((void *)va);
77#else
78#define l2_map_save_flags(x) ((x) = 0)
79#define l2_map_restore_flags(x) ((void)(x))
80#endif 75#endif
76}
81 77
82static inline unsigned long l2_map_va(unsigned long pa, unsigned long prev_va, 78static inline unsigned long l2_map_va(unsigned long pa, unsigned long prev_va)
83 unsigned long flags)
84{ 79{
85#ifdef CONFIG_HIGHMEM 80#ifdef CONFIG_HIGHMEM
86 unsigned long va = prev_va & PAGE_MASK; 81 unsigned long va = prev_va & PAGE_MASK;
@@ -89,17 +84,10 @@ static inline unsigned long l2_map_va(unsigned long pa, unsigned long prev_va,
89 /* 84 /*
90 * Switching to a new page. Because cache ops are 85 * Switching to a new page. Because cache ops are
91 * using virtual addresses only, we must put a mapping 86 * using virtual addresses only, we must put a mapping
92 * in place for it. We also enable interrupts for a 87 * in place for it.
93 * short while and disable them again to protect this
94 * mapping.
95 */ 88 */
96 unsigned long idx; 89 l2_unmap_va(prev_va);
97 raw_local_irq_restore(flags); 90 va = (unsigned long)kmap_atomic_pfn(pa >> PAGE_SHIFT);
98 idx = KM_L2_CACHE + KM_TYPE_NR * smp_processor_id();
99 va = __fix_to_virt(FIX_KMAP_BEGIN + idx);
100 raw_local_irq_restore(flags | PSR_I_BIT);
101 set_pte_ext(TOP_PTE(va), pfn_pte(pa >> PAGE_SHIFT, PAGE_KERNEL), 0);
102 local_flush_tlb_kernel_page(va);
103 } 91 }
104 return va + (pa_offset >> (32 - PAGE_SHIFT)); 92 return va + (pa_offset >> (32 - PAGE_SHIFT));
105#else 93#else
@@ -109,7 +97,7 @@ static inline unsigned long l2_map_va(unsigned long pa, unsigned long prev_va,
109 97
110static void xsc3_l2_inv_range(unsigned long start, unsigned long end) 98static void xsc3_l2_inv_range(unsigned long start, unsigned long end)
111{ 99{
112 unsigned long vaddr, flags; 100 unsigned long vaddr;
113 101
114 if (start == 0 && end == -1ul) { 102 if (start == 0 && end == -1ul) {
115 xsc3_l2_inv_all(); 103 xsc3_l2_inv_all();
@@ -117,13 +105,12 @@ static void xsc3_l2_inv_range(unsigned long start, unsigned long end)
117 } 105 }
118 106
119 vaddr = -1; /* to force the first mapping */ 107 vaddr = -1; /* to force the first mapping */
120 l2_map_save_flags(flags);
121 108
122 /* 109 /*
123 * Clean and invalidate partial first cache line. 110 * Clean and invalidate partial first cache line.
124 */ 111 */
125 if (start & (CACHE_LINE_SIZE - 1)) { 112 if (start & (CACHE_LINE_SIZE - 1)) {
126 vaddr = l2_map_va(start & ~(CACHE_LINE_SIZE - 1), vaddr, flags); 113 vaddr = l2_map_va(start & ~(CACHE_LINE_SIZE - 1), vaddr);
127 xsc3_l2_clean_mva(vaddr); 114 xsc3_l2_clean_mva(vaddr);
128 xsc3_l2_inv_mva(vaddr); 115 xsc3_l2_inv_mva(vaddr);
129 start = (start | (CACHE_LINE_SIZE - 1)) + 1; 116 start = (start | (CACHE_LINE_SIZE - 1)) + 1;
@@ -133,7 +120,7 @@ static void xsc3_l2_inv_range(unsigned long start, unsigned long end)
133 * Invalidate all full cache lines between 'start' and 'end'. 120 * Invalidate all full cache lines between 'start' and 'end'.
134 */ 121 */
135 while (start < (end & ~(CACHE_LINE_SIZE - 1))) { 122 while (start < (end & ~(CACHE_LINE_SIZE - 1))) {
136 vaddr = l2_map_va(start, vaddr, flags); 123 vaddr = l2_map_va(start, vaddr);
137 xsc3_l2_inv_mva(vaddr); 124 xsc3_l2_inv_mva(vaddr);
138 start += CACHE_LINE_SIZE; 125 start += CACHE_LINE_SIZE;
139 } 126 }
@@ -142,31 +129,30 @@ static void xsc3_l2_inv_range(unsigned long start, unsigned long end)
142 * Clean and invalidate partial last cache line. 129 * Clean and invalidate partial last cache line.
143 */ 130 */
144 if (start < end) { 131 if (start < end) {
145 vaddr = l2_map_va(start, vaddr, flags); 132 vaddr = l2_map_va(start, vaddr);
146 xsc3_l2_clean_mva(vaddr); 133 xsc3_l2_clean_mva(vaddr);
147 xsc3_l2_inv_mva(vaddr); 134 xsc3_l2_inv_mva(vaddr);
148 } 135 }
149 136
150 l2_map_restore_flags(flags); 137 l2_unmap_va(vaddr);
151 138
152 dsb(); 139 dsb();
153} 140}
154 141
155static void xsc3_l2_clean_range(unsigned long start, unsigned long end) 142static void xsc3_l2_clean_range(unsigned long start, unsigned long end)
156{ 143{
157 unsigned long vaddr, flags; 144 unsigned long vaddr;
158 145
159 vaddr = -1; /* to force the first mapping */ 146 vaddr = -1; /* to force the first mapping */
160 l2_map_save_flags(flags);
161 147
162 start &= ~(CACHE_LINE_SIZE - 1); 148 start &= ~(CACHE_LINE_SIZE - 1);
163 while (start < end) { 149 while (start < end) {
164 vaddr = l2_map_va(start, vaddr, flags); 150 vaddr = l2_map_va(start, vaddr);
165 xsc3_l2_clean_mva(vaddr); 151 xsc3_l2_clean_mva(vaddr);
166 start += CACHE_LINE_SIZE; 152 start += CACHE_LINE_SIZE;
167 } 153 }
168 154
169 l2_map_restore_flags(flags); 155 l2_unmap_va(vaddr);
170 156
171 dsb(); 157 dsb();
172} 158}
@@ -193,7 +179,7 @@ static inline void xsc3_l2_flush_all(void)
193 179
194static void xsc3_l2_flush_range(unsigned long start, unsigned long end) 180static void xsc3_l2_flush_range(unsigned long start, unsigned long end)
195{ 181{
196 unsigned long vaddr, flags; 182 unsigned long vaddr;
197 183
198 if (start == 0 && end == -1ul) { 184 if (start == 0 && end == -1ul) {
199 xsc3_l2_flush_all(); 185 xsc3_l2_flush_all();
@@ -201,17 +187,16 @@ static void xsc3_l2_flush_range(unsigned long start, unsigned long end)
201 } 187 }
202 188
203 vaddr = -1; /* to force the first mapping */ 189 vaddr = -1; /* to force the first mapping */
204 l2_map_save_flags(flags);
205 190
206 start &= ~(CACHE_LINE_SIZE - 1); 191 start &= ~(CACHE_LINE_SIZE - 1);
207 while (start < end) { 192 while (start < end) {
208 vaddr = l2_map_va(start, vaddr, flags); 193 vaddr = l2_map_va(start, vaddr);
209 xsc3_l2_clean_mva(vaddr); 194 xsc3_l2_clean_mva(vaddr);
210 xsc3_l2_inv_mva(vaddr); 195 xsc3_l2_inv_mva(vaddr);
211 start += CACHE_LINE_SIZE; 196 start += CACHE_LINE_SIZE;
212 } 197 }
213 198
214 l2_map_restore_flags(flags); 199 l2_unmap_va(vaddr);
215 200
216 dsb(); 201 dsb();
217} 202}
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index ac6a36142fcd..809f1bf9fa29 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -17,6 +17,7 @@
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/device.h> 18#include <linux/device.h>
19#include <linux/dma-mapping.h> 19#include <linux/dma-mapping.h>
20#include <linux/highmem.h>
20 21
21#include <asm/memory.h> 22#include <asm/memory.h>
22#include <asm/highmem.h> 23#include <asm/highmem.h>
@@ -480,10 +481,10 @@ static void dma_cache_maint_page(struct page *page, unsigned long offset,
480 op(vaddr, len, dir); 481 op(vaddr, len, dir);
481 kunmap_high(page); 482 kunmap_high(page);
482 } else if (cache_is_vipt()) { 483 } else if (cache_is_vipt()) {
483 pte_t saved_pte; 484 /* unmapped pages might still be cached */
484 vaddr = kmap_high_l1_vipt(page, &saved_pte); 485 vaddr = kmap_atomic(page);
485 op(vaddr + offset, len, dir); 486 op(vaddr + offset, len, dir);
486 kunmap_high_l1_vipt(page, saved_pte); 487 kunmap_atomic(vaddr);
487 } 488 }
488 } else { 489 } else {
489 vaddr = page_address(page) + offset; 490 vaddr = page_address(page) + offset;
diff --git a/arch/arm/mm/flush.c b/arch/arm/mm/flush.c
index 391ffae75098..c29f2839f1d2 100644
--- a/arch/arm/mm/flush.c
+++ b/arch/arm/mm/flush.c
@@ -10,6 +10,7 @@
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/mm.h> 11#include <linux/mm.h>
12#include <linux/pagemap.h> 12#include <linux/pagemap.h>
13#include <linux/highmem.h>
13 14
14#include <asm/cacheflush.h> 15#include <asm/cacheflush.h>
15#include <asm/cachetype.h> 16#include <asm/cachetype.h>
@@ -180,10 +181,10 @@ void __flush_dcache_page(struct address_space *mapping, struct page *page)
180 __cpuc_flush_dcache_area(addr, PAGE_SIZE); 181 __cpuc_flush_dcache_area(addr, PAGE_SIZE);
181 kunmap_high(page); 182 kunmap_high(page);
182 } else if (cache_is_vipt()) { 183 } else if (cache_is_vipt()) {
183 pte_t saved_pte; 184 /* unmapped pages might still be cached */
184 addr = kmap_high_l1_vipt(page, &saved_pte); 185 addr = kmap_atomic(page);
185 __cpuc_flush_dcache_area(addr, PAGE_SIZE); 186 __cpuc_flush_dcache_area(addr, PAGE_SIZE);
186 kunmap_high_l1_vipt(page, saved_pte); 187 kunmap_atomic(addr);
187 } 188 }
188 } 189 }
189 190
diff --git a/arch/arm/mm/highmem.c b/arch/arm/mm/highmem.c
index c435fd9e1da9..807c0573abbe 100644
--- a/arch/arm/mm/highmem.c
+++ b/arch/arm/mm/highmem.c
@@ -140,90 +140,3 @@ struct page *kmap_atomic_to_page(const void *ptr)
140 pte = TOP_PTE(vaddr); 140 pte = TOP_PTE(vaddr);
141 return pte_page(*pte); 141 return pte_page(*pte);
142} 142}
143
144#ifdef CONFIG_CPU_CACHE_VIPT
145
146#include <linux/percpu.h>
147
148/*
149 * The VIVT cache of a highmem page is always flushed before the page
150 * is unmapped. Hence unmapped highmem pages need no cache maintenance
151 * in that case.
152 *
153 * However unmapped pages may still be cached with a VIPT cache, and
154 * it is not possible to perform cache maintenance on them using physical
155 * addresses unfortunately. So we have no choice but to set up a temporary
156 * virtual mapping for that purpose.
157 *
158 * Yet this VIPT cache maintenance may be triggered from DMA support
159 * functions which are possibly called from interrupt context. As we don't
160 * want to keep interrupt disabled all the time when such maintenance is
161 * taking place, we therefore allow for some reentrancy by preserving and
162 * restoring the previous fixmap entry before the interrupted context is
163 * resumed. If the reentrancy depth is 0 then there is no need to restore
164 * the previous fixmap, and leaving the current one in place allow it to
165 * be reused the next time without a TLB flush (common with DMA).
166 */
167
168static DEFINE_PER_CPU(int, kmap_high_l1_vipt_depth);
169
170void *kmap_high_l1_vipt(struct page *page, pte_t *saved_pte)
171{
172 unsigned int idx, cpu;
173 int *depth;
174 unsigned long vaddr, flags;
175 pte_t pte, *ptep;
176
177 if (!in_interrupt())
178 preempt_disable();
179
180 cpu = smp_processor_id();
181 depth = &per_cpu(kmap_high_l1_vipt_depth, cpu);
182
183 idx = KM_L1_CACHE + KM_TYPE_NR * cpu;
184 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
185 ptep = TOP_PTE(vaddr);
186 pte = mk_pte(page, kmap_prot);
187
188 raw_local_irq_save(flags);
189 (*depth)++;
190 if (pte_val(*ptep) == pte_val(pte)) {
191 *saved_pte = pte;
192 } else {
193 *saved_pte = *ptep;
194 set_pte_ext(ptep, pte, 0);
195 local_flush_tlb_kernel_page(vaddr);
196 }
197 raw_local_irq_restore(flags);
198
199 return (void *)vaddr;
200}
201
202void kunmap_high_l1_vipt(struct page *page, pte_t saved_pte)
203{
204 unsigned int idx, cpu = smp_processor_id();
205 int *depth = &per_cpu(kmap_high_l1_vipt_depth, cpu);
206 unsigned long vaddr, flags;
207 pte_t pte, *ptep;
208
209 idx = KM_L1_CACHE + KM_TYPE_NR * cpu;
210 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
211 ptep = TOP_PTE(vaddr);
212 pte = mk_pte(page, kmap_prot);
213
214 BUG_ON(pte_val(*ptep) != pte_val(pte));
215 BUG_ON(*depth <= 0);
216
217 raw_local_irq_save(flags);
218 (*depth)--;
219 if (*depth != 0 && pte_val(pte) != pte_val(saved_pte)) {
220 set_pte_ext(ptep, saved_pte, 0);
221 local_flush_tlb_kernel_page(vaddr);
222 }
223 raw_local_irq_restore(flags);
224
225 if (!in_interrupt())
226 preempt_enable();
227}
228
229#endif /* CONFIG_CPU_CACHE_VIPT */
diff --git a/arch/mn10300/kernel/irq.c b/arch/mn10300/kernel/irq.c
index c2e44597c22b..ac11754ecec5 100644
--- a/arch/mn10300/kernel/irq.c
+++ b/arch/mn10300/kernel/irq.c
@@ -459,7 +459,7 @@ void migrate_irqs(void)
459 tmp = CROSS_GxICR(irq, new); 459 tmp = CROSS_GxICR(irq, new);
460 460
461 x &= GxICR_LEVEL | GxICR_ENABLE; 461 x &= GxICR_LEVEL | GxICR_ENABLE;
462 if (GxICR(irq) & GxICR_REQUEST) { 462 if (GxICR(irq) & GxICR_REQUEST)
463 x |= GxICR_REQUEST | GxICR_DETECT; 463 x |= GxICR_REQUEST | GxICR_DETECT;
464 CROSS_GxICR(irq, new) = x; 464 CROSS_GxICR(irq, new) = x;
465 tmp = CROSS_GxICR(irq, new); 465 tmp = CROSS_GxICR(irq, new);
diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
index f628234fbeca..3cece05e4ac4 100644
--- a/arch/x86/kvm/i8259.c
+++ b/arch/x86/kvm/i8259.c
@@ -575,6 +575,8 @@ struct kvm_pic *kvm_create_pic(struct kvm *kvm)
575 s->pics[1].elcr_mask = 0xde; 575 s->pics[1].elcr_mask = 0xde;
576 s->pics[0].pics_state = s; 576 s->pics[0].pics_state = s;
577 s->pics[1].pics_state = s; 577 s->pics[1].pics_state = s;
578 s->pics[0].isr_ack = 0xff;
579 s->pics[1].isr_ack = 0xff;
578 580
579 /* 581 /*
580 * Initialize PIO device 582 * Initialize PIO device
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index fb8b376bf28c..fbb04aee8301 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -2394,7 +2394,8 @@ static int mmu_alloc_direct_roots(struct kvm_vcpu *vcpu)
2394 ASSERT(!VALID_PAGE(root)); 2394 ASSERT(!VALID_PAGE(root));
2395 spin_lock(&vcpu->kvm->mmu_lock); 2395 spin_lock(&vcpu->kvm->mmu_lock);
2396 kvm_mmu_free_some_pages(vcpu); 2396 kvm_mmu_free_some_pages(vcpu);
2397 sp = kvm_mmu_get_page(vcpu, i << 30, i << 30, 2397 sp = kvm_mmu_get_page(vcpu, i << (30 - PAGE_SHIFT),
2398 i << 30,
2398 PT32_ROOT_LEVEL, 1, ACC_ALL, 2399 PT32_ROOT_LEVEL, 1, ACC_ALL,
2399 NULL); 2400 NULL);
2400 root = __pa(sp->spt); 2401 root = __pa(sp->spt);
diff --git a/arch/x86/oprofile/op_model_amd.c b/arch/x86/oprofile/op_model_amd.c
index f2984d43a6b3..51104b33fd51 100644
--- a/arch/x86/oprofile/op_model_amd.c
+++ b/arch/x86/oprofile/op_model_amd.c
@@ -637,21 +637,29 @@ static int __init_ibs_nmi(void)
637 return 0; 637 return 0;
638} 638}
639 639
640/* initialize the APIC for the IBS interrupts if available */ 640/*
641 * check and reserve APIC extended interrupt LVT offset for IBS if
642 * available
643 *
644 * init_ibs() preforms implicitly cpu-local operations, so pin this
645 * thread to its current CPU
646 */
647
641static void init_ibs(void) 648static void init_ibs(void)
642{ 649{
643 ibs_caps = get_ibs_caps(); 650 preempt_disable();
644 651
652 ibs_caps = get_ibs_caps();
645 if (!ibs_caps) 653 if (!ibs_caps)
646 return; 654 goto out;
647 655
648 if (__init_ibs_nmi()) { 656 if (__init_ibs_nmi() < 0)
649 ibs_caps = 0; 657 ibs_caps = 0;
650 return; 658 else
651 } 659 printk(KERN_INFO "oprofile: AMD IBS detected (0x%08x)\n", ibs_caps);
652 660
653 printk(KERN_INFO "oprofile: AMD IBS detected (0x%08x)\n", 661out:
654 (unsigned)ibs_caps); 662 preempt_enable();
655} 663}
656 664
657static int (*create_arch_files)(struct super_block *sb, struct dentry *root); 665static int (*create_arch_files)(struct super_block *sb, struct dentry *root);
diff --git a/drivers/atm/atmtcp.c b/drivers/atm/atmtcp.c
index 2b464b631f22..0b0625054a87 100644
--- a/drivers/atm/atmtcp.c
+++ b/drivers/atm/atmtcp.c
@@ -392,7 +392,10 @@ static int atmtcp_attach(struct atm_vcc *vcc,int itf)
392 atm_dev_put(dev); 392 atm_dev_put(dev);
393 return -EMEDIUMTYPE; 393 return -EMEDIUMTYPE;
394 } 394 }
395 if (PRIV(dev)->vcc) return -EBUSY; 395 if (PRIV(dev)->vcc) {
396 atm_dev_put(dev);
397 return -EBUSY;
398 }
396 } 399 }
397 else { 400 else {
398 int error; 401 int error;
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index 411d5bf50fc4..a25f5f61e0e0 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -449,7 +449,7 @@ mv_xor_slot_cleanup(struct mv_xor_chan *mv_chan)
449static void mv_xor_tasklet(unsigned long data) 449static void mv_xor_tasklet(unsigned long data)
450{ 450{
451 struct mv_xor_chan *chan = (struct mv_xor_chan *) data; 451 struct mv_xor_chan *chan = (struct mv_xor_chan *) data;
452 __mv_xor_slot_cleanup(chan); 452 mv_xor_slot_cleanup(chan);
453} 453}
454 454
455static struct mv_xor_desc_slot * 455static struct mv_xor_desc_slot *
diff --git a/drivers/gpu/drm/i915/dvo_ch7017.c b/drivers/gpu/drm/i915/dvo_ch7017.c
index af70337567ce..d3e8c540f778 100644
--- a/drivers/gpu/drm/i915/dvo_ch7017.c
+++ b/drivers/gpu/drm/i915/dvo_ch7017.c
@@ -242,7 +242,7 @@ fail:
242 242
243static enum drm_connector_status ch7017_detect(struct intel_dvo_device *dvo) 243static enum drm_connector_status ch7017_detect(struct intel_dvo_device *dvo)
244{ 244{
245 return connector_status_unknown; 245 return connector_status_connected;
246} 246}
247 247
248static enum drm_mode_status ch7017_mode_valid(struct intel_dvo_device *dvo, 248static enum drm_mode_status ch7017_mode_valid(struct intel_dvo_device *dvo,
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index e6800819bca8..cb900dc83d95 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -34,6 +34,7 @@
34#include "i915_drm.h" 34#include "i915_drm.h"
35#include "i915_drv.h" 35#include "i915_drv.h"
36#include "i915_trace.h" 36#include "i915_trace.h"
37#include "../../../platform/x86/intel_ips.h"
37#include <linux/pci.h> 38#include <linux/pci.h>
38#include <linux/vgaarb.h> 39#include <linux/vgaarb.h>
39#include <linux/acpi.h> 40#include <linux/acpi.h>
@@ -1871,6 +1872,26 @@ out_unlock:
1871EXPORT_SYMBOL_GPL(i915_gpu_turbo_disable); 1872EXPORT_SYMBOL_GPL(i915_gpu_turbo_disable);
1872 1873
1873/** 1874/**
1875 * Tells the intel_ips driver that the i915 driver is now loaded, if
1876 * IPS got loaded first.
1877 *
1878 * This awkward dance is so that neither module has to depend on the
1879 * other in order for IPS to do the appropriate communication of
1880 * GPU turbo limits to i915.
1881 */
1882static void
1883ips_ping_for_i915_load(void)
1884{
1885 void (*link)(void);
1886
1887 link = symbol_get(ips_link_to_i915_driver);
1888 if (link) {
1889 link();
1890 symbol_put(ips_link_to_i915_driver);
1891 }
1892}
1893
1894/**
1874 * i915_driver_load - setup chip and create an initial config 1895 * i915_driver_load - setup chip and create an initial config
1875 * @dev: DRM device 1896 * @dev: DRM device
1876 * @flags: startup flags 1897 * @flags: startup flags
@@ -2075,6 +2096,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
2075 dev_priv->mchdev_lock = &mchdev_lock; 2096 dev_priv->mchdev_lock = &mchdev_lock;
2076 spin_unlock(&mchdev_lock); 2097 spin_unlock(&mchdev_lock);
2077 2098
2099 ips_ping_for_i915_load();
2100
2078 return 0; 2101 return 0;
2079 2102
2080out_workqueue_free: 2103out_workqueue_free:
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 878fc766a12c..cb8f43429279 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -2471,6 +2471,9 @@
2471# define MARIUNIT_CLOCK_GATE_DISABLE (1 << 18) 2471# define MARIUNIT_CLOCK_GATE_DISABLE (1 << 18)
2472# define SVSMUNIT_CLOCK_GATE_DISABLE (1 << 1) 2472# define SVSMUNIT_CLOCK_GATE_DISABLE (1 << 1)
2473 2473
2474#define PCH_3DCGDIS1 0x46024
2475# define VFMUNIT_CLOCK_GATE_DISABLE (1 << 11)
2476
2474#define FDI_PLL_FREQ_CTL 0x46030 2477#define FDI_PLL_FREQ_CTL 0x46030
2475#define FDI_PLL_FREQ_CHANGE_REQUEST (1<<24) 2478#define FDI_PLL_FREQ_CHANGE_REQUEST (1<<24)
2476#define FDI_PLL_FREQ_LOCK_LIMIT_MASK 0xfff00 2479#define FDI_PLL_FREQ_LOCK_LIMIT_MASK 0xfff00
@@ -2588,6 +2591,13 @@
2588#define ILK_DISPLAY_CHICKEN2 0x42004 2591#define ILK_DISPLAY_CHICKEN2 0x42004
2589#define ILK_DPARB_GATE (1<<22) 2592#define ILK_DPARB_GATE (1<<22)
2590#define ILK_VSDPFD_FULL (1<<21) 2593#define ILK_VSDPFD_FULL (1<<21)
2594#define ILK_DISPLAY_CHICKEN_FUSES 0x42014
2595#define ILK_INTERNAL_GRAPHICS_DISABLE (1<<31)
2596#define ILK_INTERNAL_DISPLAY_DISABLE (1<<30)
2597#define ILK_DISPLAY_DEBUG_DISABLE (1<<29)
2598#define ILK_HDCP_DISABLE (1<<25)
2599#define ILK_eDP_A_DISABLE (1<<24)
2600#define ILK_DESKTOP (1<<23)
2591#define ILK_DSPCLK_GATE 0x42020 2601#define ILK_DSPCLK_GATE 0x42020
2592#define ILK_DPARB_CLK_GATE (1<<5) 2602#define ILK_DPARB_CLK_GATE (1<<5)
2593/* According to spec this bit 7/8/9 of 0x42020 should be set to enable FBC */ 2603/* According to spec this bit 7/8/9 of 0x42020 should be set to enable FBC */
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index 2b2078695d2a..b0b1200ed650 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -270,7 +270,7 @@ parse_general_features(struct drm_i915_private *dev_priv,
270 general->ssc_freq ? 66 : 48; 270 general->ssc_freq ? 66 : 48;
271 else if (IS_GEN5(dev) || IS_GEN6(dev)) 271 else if (IS_GEN5(dev) || IS_GEN6(dev))
272 dev_priv->lvds_ssc_freq = 272 dev_priv->lvds_ssc_freq =
273 general->ssc_freq ? 120 : 100; 273 general->ssc_freq ? 100 : 120;
274 else 274 else
275 dev_priv->lvds_ssc_freq = 275 dev_priv->lvds_ssc_freq =
276 general->ssc_freq ? 100 : 96; 276 general->ssc_freq ? 100 : 96;
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index d9b7092439ef..fca523288aca 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -5379,6 +5379,23 @@ static int intel_encoder_clones(struct drm_device *dev, int type_mask)
5379 return index_mask; 5379 return index_mask;
5380} 5380}
5381 5381
5382static bool has_edp_a(struct drm_device *dev)
5383{
5384 struct drm_i915_private *dev_priv = dev->dev_private;
5385
5386 if (!IS_MOBILE(dev))
5387 return false;
5388
5389 if ((I915_READ(DP_A) & DP_DETECTED) == 0)
5390 return false;
5391
5392 if (IS_GEN5(dev) &&
5393 (I915_READ(ILK_DISPLAY_CHICKEN_FUSES) & ILK_eDP_A_DISABLE))
5394 return false;
5395
5396 return true;
5397}
5398
5382static void intel_setup_outputs(struct drm_device *dev) 5399static void intel_setup_outputs(struct drm_device *dev)
5383{ 5400{
5384 struct drm_i915_private *dev_priv = dev->dev_private; 5401 struct drm_i915_private *dev_priv = dev->dev_private;
@@ -5396,7 +5413,7 @@ static void intel_setup_outputs(struct drm_device *dev)
5396 if (HAS_PCH_SPLIT(dev)) { 5413 if (HAS_PCH_SPLIT(dev)) {
5397 dpd_is_edp = intel_dpd_is_edp(dev); 5414 dpd_is_edp = intel_dpd_is_edp(dev);
5398 5415
5399 if (IS_MOBILE(dev) && (I915_READ(DP_A) & DP_DETECTED)) 5416 if (has_edp_a(dev))
5400 intel_dp_init(dev, DP_A); 5417 intel_dp_init(dev, DP_A);
5401 5418
5402 if (dpd_is_edp && (I915_READ(PCH_DP_D) & DP_DETECTED)) 5419 if (dpd_is_edp && (I915_READ(PCH_DP_D) & DP_DETECTED))
@@ -5825,6 +5842,8 @@ void intel_init_clock_gating(struct drm_device *dev)
5825 I915_WRITE(PCH_3DCGDIS0, 5842 I915_WRITE(PCH_3DCGDIS0,
5826 MARIUNIT_CLOCK_GATE_DISABLE | 5843 MARIUNIT_CLOCK_GATE_DISABLE |
5827 SVSMUNIT_CLOCK_GATE_DISABLE); 5844 SVSMUNIT_CLOCK_GATE_DISABLE);
5845 I915_WRITE(PCH_3DCGDIS1,
5846 VFMUNIT_CLOCK_GATE_DISABLE);
5828 } 5847 }
5829 5848
5830 I915_WRITE(PCH_DSPCLK_GATE_D, dspclk_gate); 5849 I915_WRITE(PCH_DSPCLK_GATE_D, dspclk_gate);
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 27e63abf2a73..6bc42fa2a6ec 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -2040,13 +2040,14 @@ intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, int device)
2040 SDVO_COLORIMETRY_RGB256); 2040 SDVO_COLORIMETRY_RGB256);
2041 connector->connector_type = DRM_MODE_CONNECTOR_HDMIA; 2041 connector->connector_type = DRM_MODE_CONNECTOR_HDMIA;
2042 2042
2043 intel_sdvo_add_hdmi_properties(intel_sdvo_connector);
2044 intel_sdvo->is_hdmi = true; 2043 intel_sdvo->is_hdmi = true;
2045 } 2044 }
2046 intel_sdvo->base.clone_mask = ((1 << INTEL_SDVO_NON_TV_CLONE_BIT) | 2045 intel_sdvo->base.clone_mask = ((1 << INTEL_SDVO_NON_TV_CLONE_BIT) |
2047 (1 << INTEL_ANALOG_CLONE_BIT)); 2046 (1 << INTEL_ANALOG_CLONE_BIT));
2048 2047
2049 intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo); 2048 intel_sdvo_connector_init(intel_sdvo_connector, intel_sdvo);
2049 if (intel_sdvo->is_hdmi)
2050 intel_sdvo_add_hdmi_properties(intel_sdvo_connector);
2050 2051
2051 return true; 2052 return true;
2052} 2053}
diff --git a/drivers/hwmon/s3c-hwmon.c b/drivers/hwmon/s3c-hwmon.c
index 05248f2d7581..92b42db43bcf 100644
--- a/drivers/hwmon/s3c-hwmon.c
+++ b/drivers/hwmon/s3c-hwmon.c
@@ -234,7 +234,6 @@ static int s3c_hwmon_create_attr(struct device *dev,
234 attr->index = channel; 234 attr->index = channel;
235 attr->dev_attr.attr.name = attrs->in_name; 235 attr->dev_attr.attr.name = attrs->in_name;
236 attr->dev_attr.attr.mode = S_IRUGO; 236 attr->dev_attr.attr.mode = S_IRUGO;
237 attr->dev_attr.attr.owner = THIS_MODULE;
238 attr->dev_attr.show = s3c_hwmon_ch_show; 237 attr->dev_attr.show = s3c_hwmon_ch_show;
239 238
240 ret = device_create_file(dev, &attr->dev_attr); 239 ret = device_create_file(dev, &attr->dev_attr);
@@ -252,7 +251,6 @@ static int s3c_hwmon_create_attr(struct device *dev,
252 attr->index = channel; 251 attr->index = channel;
253 attr->dev_attr.attr.name = attrs->label_name; 252 attr->dev_attr.attr.name = attrs->label_name;
254 attr->dev_attr.attr.mode = S_IRUGO; 253 attr->dev_attr.attr.mode = S_IRUGO;
255 attr->dev_attr.attr.owner = THIS_MODULE;
256 attr->dev_attr.show = s3c_hwmon_label_show; 254 attr->dev_attr.show = s3c_hwmon_label_show;
257 255
258 ret = device_create_file(dev, &attr->dev_attr); 256 ret = device_create_file(dev, &attr->dev_attr);
diff --git a/drivers/isdn/gigaset/capi.c b/drivers/isdn/gigaset/capi.c
index bcc174e4f3b1..658e75f18d05 100644
--- a/drivers/isdn/gigaset/capi.c
+++ b/drivers/isdn/gigaset/capi.c
@@ -1900,6 +1900,7 @@ static void do_disconnect_req(struct gigaset_capi_ctr *iif,
1900 if (b3skb == NULL) { 1900 if (b3skb == NULL) {
1901 dev_err(cs->dev, "%s: out of memory\n", __func__); 1901 dev_err(cs->dev, "%s: out of memory\n", __func__);
1902 send_conf(iif, ap, skb, CAPI_MSGOSRESOURCEERR); 1902 send_conf(iif, ap, skb, CAPI_MSGOSRESOURCEERR);
1903 kfree(b3cmsg);
1903 return; 1904 return;
1904 } 1905 }
1905 capi_cmsg2message(b3cmsg, 1906 capi_cmsg2message(b3cmsg,
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
index dfb198d0415b..f16461844c5c 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -1989,8 +1989,23 @@ static int cx25840_probe(struct i2c_client *client,
1989 v4l2_ctrl_new_std(&state->hdl, &cx25840_ctrl_ops, 1989 v4l2_ctrl_new_std(&state->hdl, &cx25840_ctrl_ops,
1990 V4L2_CID_HUE, -128, 127, 1, 0); 1990 V4L2_CID_HUE, -128, 127, 1, 0);
1991 if (!is_cx2583x(state)) { 1991 if (!is_cx2583x(state)) {
1992 default_volume = 228 - cx25840_read(client, 0x8d4); 1992 default_volume = cx25840_read(client, 0x8d4);
1993 default_volume = ((default_volume / 2) + 23) << 9; 1993 /*
1994 * Enforce the legacy PVR-350/MSP3400 to PVR-150/CX25843 volume
1995 * scale mapping limits to avoid -ERANGE errors when
1996 * initializing the volume control
1997 */
1998 if (default_volume > 228) {
1999 /* Bottom out at -96 dB, v4l2 vol range 0x2e00-0x2fff */
2000 default_volume = 228;
2001 cx25840_write(client, 0x8d4, 228);
2002 }
2003 else if (default_volume < 20) {
2004 /* Top out at + 8 dB, v4l2 vol range 0xfe00-0xffff */
2005 default_volume = 20;
2006 cx25840_write(client, 0x8d4, 20);
2007 }
2008 default_volume = (((228 - default_volume) >> 1) + 23) << 9;
1994 2009
1995 state->volume = v4l2_ctrl_new_std(&state->hdl, 2010 state->volume = v4l2_ctrl_new_std(&state->hdl,
1996 &cx25840_audio_ctrl_ops, V4L2_CID_AUDIO_VOLUME, 2011 &cx25840_audio_ctrl_ops, V4L2_CID_AUDIO_VOLUME,
diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c
index 4aaa47c0eabf..54b7fcd469a8 100644
--- a/drivers/media/video/cx88/cx88-alsa.c
+++ b/drivers/media/video/cx88/cx88-alsa.c
@@ -40,7 +40,6 @@
40#include <sound/control.h> 40#include <sound/control.h>
41#include <sound/initval.h> 41#include <sound/initval.h>
42#include <sound/tlv.h> 42#include <sound/tlv.h>
43#include <media/wm8775.h>
44 43
45#include "cx88.h" 44#include "cx88.h"
46#include "cx88-reg.h" 45#include "cx88-reg.h"
@@ -587,47 +586,26 @@ static int snd_cx88_volume_put(struct snd_kcontrol *kcontrol,
587 int left, right, v, b; 586 int left, right, v, b;
588 int changed = 0; 587 int changed = 0;
589 u32 old; 588 u32 old;
590 struct v4l2_control client_ctl;
591
592 /* Pass volume & balance onto any WM8775 */
593 if (value->value.integer.value[0] >= value->value.integer.value[1]) {
594 v = value->value.integer.value[0] << 10;
595 b = value->value.integer.value[0] ?
596 (0x8000 * value->value.integer.value[1]) / value->value.integer.value[0] :
597 0x8000;
598 } else {
599 v = value->value.integer.value[1] << 10;
600 b = value->value.integer.value[1] ?
601 0xffff - (0x8000 * value->value.integer.value[0]) / value->value.integer.value[1] :
602 0x8000;
603 }
604 client_ctl.value = v;
605 client_ctl.id = V4L2_CID_AUDIO_VOLUME;
606 call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl);
607
608 client_ctl.value = b;
609 client_ctl.id = V4L2_CID_AUDIO_BALANCE;
610 call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl);
611 589
612 left = value->value.integer.value[0] & 0x3f; 590 left = value->value.integer.value[0] & 0x3f;
613 right = value->value.integer.value[1] & 0x3f; 591 right = value->value.integer.value[1] & 0x3f;
614 b = right - left; 592 b = right - left;
615 if (b < 0) { 593 if (b < 0) {
616 v = 0x3f - left; 594 v = 0x3f - left;
617 b = (-b) | 0x40; 595 b = (-b) | 0x40;
618 } else { 596 } else {
619 v = 0x3f - right; 597 v = 0x3f - right;
620 } 598 }
621 /* Do we really know this will always be called with IRQs on? */ 599 /* Do we really know this will always be called with IRQs on? */
622 spin_lock_irq(&chip->reg_lock); 600 spin_lock_irq(&chip->reg_lock);
623 old = cx_read(AUD_VOL_CTL); 601 old = cx_read(AUD_VOL_CTL);
624 if (v != (old & 0x3f)) { 602 if (v != (old & 0x3f)) {
625 cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, (old & ~0x3f) | v); 603 cx_write(AUD_VOL_CTL, (old & ~0x3f) | v);
626 changed = 1; 604 changed = 1;
627 } 605 }
628 if ((cx_read(AUD_BAL_CTL) & 0x7f) != b) { 606 if (cx_read(AUD_BAL_CTL) != b) {
629 cx_write(AUD_BAL_CTL, b); 607 cx_write(AUD_BAL_CTL, b);
630 changed = 1; 608 changed = 1;
631 } 609 }
632 spin_unlock_irq(&chip->reg_lock); 610 spin_unlock_irq(&chip->reg_lock);
633 611
@@ -640,7 +618,7 @@ static const struct snd_kcontrol_new snd_cx88_volume = {
640 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 618 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
641 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | 619 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
642 SNDRV_CTL_ELEM_ACCESS_TLV_READ, 620 SNDRV_CTL_ELEM_ACCESS_TLV_READ,
643 .name = "Analog-TV Volume", 621 .name = "Playback Volume",
644 .info = snd_cx88_volume_info, 622 .info = snd_cx88_volume_info,
645 .get = snd_cx88_volume_get, 623 .get = snd_cx88_volume_get,
646 .put = snd_cx88_volume_put, 624 .put = snd_cx88_volume_put,
@@ -671,14 +649,7 @@ static int snd_cx88_switch_put(struct snd_kcontrol *kcontrol,
671 vol = cx_read(AUD_VOL_CTL); 649 vol = cx_read(AUD_VOL_CTL);
672 if (value->value.integer.value[0] != !(vol & bit)) { 650 if (value->value.integer.value[0] != !(vol & bit)) {
673 vol ^= bit; 651 vol ^= bit;
674 cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, vol); 652 cx_write(AUD_VOL_CTL, vol);
675 /* Pass mute onto any WM8775 */
676 if ((1<<6) == bit) {
677 struct v4l2_control client_ctl;
678 client_ctl.value = 0 != (vol & bit);
679 client_ctl.id = V4L2_CID_AUDIO_MUTE;
680 call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl);
681 }
682 ret = 1; 653 ret = 1;
683 } 654 }
684 spin_unlock_irq(&chip->reg_lock); 655 spin_unlock_irq(&chip->reg_lock);
@@ -687,7 +658,7 @@ static int snd_cx88_switch_put(struct snd_kcontrol *kcontrol,
687 658
688static const struct snd_kcontrol_new snd_cx88_dac_switch = { 659static const struct snd_kcontrol_new snd_cx88_dac_switch = {
689 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 660 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
690 .name = "Audio-Out Switch", 661 .name = "Playback Switch",
691 .info = snd_ctl_boolean_mono_info, 662 .info = snd_ctl_boolean_mono_info,
692 .get = snd_cx88_switch_get, 663 .get = snd_cx88_switch_get,
693 .put = snd_cx88_switch_put, 664 .put = snd_cx88_switch_put,
@@ -696,49 +667,13 @@ static const struct snd_kcontrol_new snd_cx88_dac_switch = {
696 667
697static const struct snd_kcontrol_new snd_cx88_source_switch = { 668static const struct snd_kcontrol_new snd_cx88_source_switch = {
698 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 669 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
699 .name = "Analog-TV Switch", 670 .name = "Capture Switch",
700 .info = snd_ctl_boolean_mono_info, 671 .info = snd_ctl_boolean_mono_info,
701 .get = snd_cx88_switch_get, 672 .get = snd_cx88_switch_get,
702 .put = snd_cx88_switch_put, 673 .put = snd_cx88_switch_put,
703 .private_value = (1<<6), 674 .private_value = (1<<6),
704}; 675};
705 676
706static int snd_cx88_alc_get(struct snd_kcontrol *kcontrol,
707 struct snd_ctl_elem_value *value)
708{
709 snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol);
710 struct cx88_core *core = chip->core;
711 struct v4l2_control client_ctl;
712
713 client_ctl.id = V4L2_CID_AUDIO_LOUDNESS;
714 call_hw(core, WM8775_GID, core, g_ctrl, &client_ctl);
715 value->value.integer.value[0] = client_ctl.value ? 1 : 0;
716
717 return 0;
718}
719
720static int snd_cx88_alc_put(struct snd_kcontrol *kcontrol,
721 struct snd_ctl_elem_value *value)
722{
723 snd_cx88_card_t *chip = snd_kcontrol_chip(kcontrol);
724 struct cx88_core *core = chip->core;
725 struct v4l2_control client_ctl;
726
727 client_ctl.value = 0 != value->value.integer.value[0];
728 client_ctl.id = V4L2_CID_AUDIO_LOUDNESS;
729 call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl);
730
731 return 0;
732}
733
734static struct snd_kcontrol_new snd_cx88_alc_switch = {
735 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
736 .name = "Line-In ALC Switch",
737 .info = snd_ctl_boolean_mono_info,
738 .get = snd_cx88_alc_get,
739 .put = snd_cx88_alc_put,
740};
741
742/**************************************************************************** 677/****************************************************************************
743 Basic Flow for Sound Devices 678 Basic Flow for Sound Devices
744 ****************************************************************************/ 679 ****************************************************************************/
@@ -860,7 +795,6 @@ static int __devinit cx88_audio_initdev(struct pci_dev *pci,
860{ 795{
861 struct snd_card *card; 796 struct snd_card *card;
862 snd_cx88_card_t *chip; 797 snd_cx88_card_t *chip;
863 struct v4l2_subdev *sd;
864 int err; 798 int err;
865 799
866 if (devno >= SNDRV_CARDS) 800 if (devno >= SNDRV_CARDS)
@@ -896,15 +830,6 @@ static int __devinit cx88_audio_initdev(struct pci_dev *pci,
896 if (err < 0) 830 if (err < 0)
897 goto error; 831 goto error;
898 832
899 /* If there's a wm8775 then add a Line-In ALC switch */
900 list_for_each_entry(sd, &chip->core->v4l2_dev.subdevs, list) {
901 if (WM8775_GID == sd->grp_id) {
902 snd_ctl_add(card, snd_ctl_new1(&snd_cx88_alc_switch,
903 chip));
904 break;
905 }
906 }
907
908 strcpy (card->driver, "CX88x"); 833 strcpy (card->driver, "CX88x");
909 sprintf(card->shortname, "Conexant CX%x", pci->device); 834 sprintf(card->shortname, "Conexant CX%x", pci->device);
910 sprintf(card->longname, "%s at %#llx", 835 sprintf(card->longname, "%s at %#llx",
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
index 9b9e169cce90..0ccc2afd7266 100644
--- a/drivers/media/video/cx88/cx88-cards.c
+++ b/drivers/media/video/cx88/cx88-cards.c
@@ -1007,15 +1007,22 @@ static const struct cx88_board cx88_boards[] = {
1007 .radio_type = UNSET, 1007 .radio_type = UNSET,
1008 .tuner_addr = ADDR_UNSET, 1008 .tuner_addr = ADDR_UNSET,
1009 .radio_addr = ADDR_UNSET, 1009 .radio_addr = ADDR_UNSET,
1010 .audio_chip = V4L2_IDENT_WM8775,
1010 .input = {{ 1011 .input = {{
1011 .type = CX88_VMUX_DVB, 1012 .type = CX88_VMUX_DVB,
1012 .vmux = 0, 1013 .vmux = 0,
1014 /* 2: Line-In */
1015 .audioroute = 2,
1013 },{ 1016 },{
1014 .type = CX88_VMUX_COMPOSITE1, 1017 .type = CX88_VMUX_COMPOSITE1,
1015 .vmux = 1, 1018 .vmux = 1,
1019 /* 2: Line-In */
1020 .audioroute = 2,
1016 },{ 1021 },{
1017 .type = CX88_VMUX_SVIDEO, 1022 .type = CX88_VMUX_SVIDEO,
1018 .vmux = 2, 1023 .vmux = 2,
1024 /* 2: Line-In */
1025 .audioroute = 2,
1019 }}, 1026 }},
1020 .mpeg = CX88_MPEG_DVB, 1027 .mpeg = CX88_MPEG_DVB,
1021 }, 1028 },
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index 62cea9549404..d9249e5a04c9 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -40,7 +40,6 @@
40#include "cx88.h" 40#include "cx88.h"
41#include <media/v4l2-common.h> 41#include <media/v4l2-common.h>
42#include <media/v4l2-ioctl.h> 42#include <media/v4l2-ioctl.h>
43#include <media/wm8775.h>
44 43
45MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards"); 44MODULE_DESCRIPTION("v4l2 driver module for cx2388x based TV cards");
46MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); 45MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
@@ -977,7 +976,6 @@ int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl)
977 const struct cx88_ctrl *c = NULL; 976 const struct cx88_ctrl *c = NULL;
978 u32 value,mask; 977 u32 value,mask;
979 int i; 978 int i;
980 struct v4l2_control client_ctl;
981 979
982 for (i = 0; i < CX8800_CTLS; i++) { 980 for (i = 0; i < CX8800_CTLS; i++) {
983 if (cx8800_ctls[i].v.id == ctl->id) { 981 if (cx8800_ctls[i].v.id == ctl->id) {
@@ -991,27 +989,6 @@ int cx88_set_control(struct cx88_core *core, struct v4l2_control *ctl)
991 ctl->value = c->v.minimum; 989 ctl->value = c->v.minimum;
992 if (ctl->value > c->v.maximum) 990 if (ctl->value > c->v.maximum)
993 ctl->value = c->v.maximum; 991 ctl->value = c->v.maximum;
994
995 /* Pass changes onto any WM8775 */
996 client_ctl.id = ctl->id;
997 switch (ctl->id) {
998 case V4L2_CID_AUDIO_MUTE:
999 client_ctl.value = ctl->value;
1000 break;
1001 case V4L2_CID_AUDIO_VOLUME:
1002 client_ctl.value = (ctl->value) ?
1003 (0x90 + ctl->value) << 8 : 0;
1004 break;
1005 case V4L2_CID_AUDIO_BALANCE:
1006 client_ctl.value = ctl->value << 9;
1007 break;
1008 default:
1009 client_ctl.id = 0;
1010 break;
1011 }
1012 if (client_ctl.id)
1013 call_hw(core, WM8775_GID, core, s_ctrl, &client_ctl);
1014
1015 mask=c->mask; 992 mask=c->mask;
1016 switch (ctl->id) { 993 switch (ctl->id) {
1017 case V4L2_CID_AUDIO_BALANCE: 994 case V4L2_CID_AUDIO_BALANCE:
@@ -1558,9 +1535,7 @@ static int radio_queryctrl (struct file *file, void *priv,
1558 if (c->id < V4L2_CID_BASE || 1535 if (c->id < V4L2_CID_BASE ||
1559 c->id >= V4L2_CID_LASTP1) 1536 c->id >= V4L2_CID_LASTP1)
1560 return -EINVAL; 1537 return -EINVAL;
1561 if (c->id == V4L2_CID_AUDIO_MUTE || 1538 if (c->id == V4L2_CID_AUDIO_MUTE) {
1562 c->id == V4L2_CID_AUDIO_VOLUME ||
1563 c->id == V4L2_CID_AUDIO_BALANCE) {
1564 for (i = 0; i < CX8800_CTLS; i++) { 1539 for (i = 0; i < CX8800_CTLS; i++) {
1565 if (cx8800_ctls[i].v.id == c->id) 1540 if (cx8800_ctls[i].v.id == c->id)
1566 break; 1541 break;
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index e8c732e7ae4f..c9981e77416a 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -398,19 +398,17 @@ static inline struct cx88_core *to_core(struct v4l2_device *v4l2_dev)
398 return container_of(v4l2_dev, struct cx88_core, v4l2_dev); 398 return container_of(v4l2_dev, struct cx88_core, v4l2_dev);
399} 399}
400 400
401#define call_hw(core, grpid, o, f, args...) \ 401#define call_all(core, o, f, args...) \
402 do { \ 402 do { \
403 if (!core->i2c_rc) { \ 403 if (!core->i2c_rc) { \
404 if (core->gate_ctrl) \ 404 if (core->gate_ctrl) \
405 core->gate_ctrl(core, 1); \ 405 core->gate_ctrl(core, 1); \
406 v4l2_device_call_all(&core->v4l2_dev, grpid, o, f, ##args); \ 406 v4l2_device_call_all(&core->v4l2_dev, 0, o, f, ##args); \
407 if (core->gate_ctrl) \ 407 if (core->gate_ctrl) \
408 core->gate_ctrl(core, 0); \ 408 core->gate_ctrl(core, 0); \
409 } \ 409 } \
410 } while (0) 410 } while (0)
411 411
412#define call_all(core, o, f, args...) call_hw(core, 0, o, f, ##args)
413
414struct cx8800_dev; 412struct cx8800_dev;
415struct cx8802_dev; 413struct cx8802_dev;
416 414
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 908e3bc88303..2c3007280032 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -2377,7 +2377,7 @@ static const struct v4l2_file_operations radio_fops = {
2377 .owner = THIS_MODULE, 2377 .owner = THIS_MODULE,
2378 .open = em28xx_v4l2_open, 2378 .open = em28xx_v4l2_open,
2379 .release = em28xx_v4l2_close, 2379 .release = em28xx_v4l2_close,
2380 .ioctl = video_ioctl2, 2380 .unlocked_ioctl = video_ioctl2,
2381}; 2381};
2382 2382
2383static const struct v4l2_ioctl_ops radio_ioctl_ops = { 2383static const struct v4l2_ioctl_ops radio_ioctl_ops = {
diff --git a/drivers/media/video/wm8775.c b/drivers/media/video/wm8775.c
index 135525649086..fe8ef6419f83 100644
--- a/drivers/media/video/wm8775.c
+++ b/drivers/media/video/wm8775.c
@@ -35,7 +35,6 @@
35#include <media/v4l2-device.h> 35#include <media/v4l2-device.h>
36#include <media/v4l2-chip-ident.h> 36#include <media/v4l2-chip-ident.h>
37#include <media/v4l2-ctrls.h> 37#include <media/v4l2-ctrls.h>
38#include <media/wm8775.h>
39 38
40MODULE_DESCRIPTION("wm8775 driver"); 39MODULE_DESCRIPTION("wm8775 driver");
41MODULE_AUTHOR("Ulf Eklund, Hans Verkuil"); 40MODULE_AUTHOR("Ulf Eklund, Hans Verkuil");
@@ -51,16 +50,10 @@ enum {
51 TOT_REGS 50 TOT_REGS
52}; 51};
53 52
54#define ALC_HOLD 0x85 /* R17: use zero cross detection, ALC hold time 42.6 ms */
55#define ALC_EN 0x100 /* R17: ALC enable */
56
57struct wm8775_state { 53struct wm8775_state {
58 struct v4l2_subdev sd; 54 struct v4l2_subdev sd;
59 struct v4l2_ctrl_handler hdl; 55 struct v4l2_ctrl_handler hdl;
60 struct v4l2_ctrl *mute; 56 struct v4l2_ctrl *mute;
61 struct v4l2_ctrl *vol;
62 struct v4l2_ctrl *bal;
63 struct v4l2_ctrl *loud;
64 u8 input; /* Last selected input (0-0xf) */ 57 u8 input; /* Last selected input (0-0xf) */
65}; 58};
66 59
@@ -92,30 +85,6 @@ static int wm8775_write(struct v4l2_subdev *sd, int reg, u16 val)
92 return -1; 85 return -1;
93} 86}
94 87
95static void wm8775_set_audio(struct v4l2_subdev *sd, int quietly)
96{
97 struct wm8775_state *state = to_state(sd);
98 u8 vol_l, vol_r;
99 int muted = 0 != state->mute->val;
100 u16 volume = (u16)state->vol->val;
101 u16 balance = (u16)state->bal->val;
102
103 /* normalize ( 65535 to 0 -> 255 to 0 (+24dB to -103dB) ) */
104 vol_l = (min(65536 - balance, 32768) * volume) >> 23;
105 vol_r = (min(balance, (u16)32768) * volume) >> 23;
106
107 /* Mute */
108 if (muted || quietly)
109 wm8775_write(sd, R21, 0x0c0 | state->input);
110
111 wm8775_write(sd, R14, vol_l | 0x100); /* 0x100= Left channel ADC zero cross enable */
112 wm8775_write(sd, R15, vol_r | 0x100); /* 0x100= Right channel ADC zero cross enable */
113
114 /* Un-mute */
115 if (!muted)
116 wm8775_write(sd, R21, state->input);
117}
118
119static int wm8775_s_routing(struct v4l2_subdev *sd, 88static int wm8775_s_routing(struct v4l2_subdev *sd,
120 u32 input, u32 output, u32 config) 89 u32 input, u32 output, u32 config)
121{ 90{
@@ -133,26 +102,25 @@ static int wm8775_s_routing(struct v4l2_subdev *sd,
133 state->input = input; 102 state->input = input;
134 if (!v4l2_ctrl_g_ctrl(state->mute)) 103 if (!v4l2_ctrl_g_ctrl(state->mute))
135 return 0; 104 return 0;
136 if (!v4l2_ctrl_g_ctrl(state->vol)) 105 wm8775_write(sd, R21, 0x0c0);
137 return 0; 106 wm8775_write(sd, R14, 0x1d4);
138 if (!v4l2_ctrl_g_ctrl(state->bal)) 107 wm8775_write(sd, R15, 0x1d4);
139 return 0; 108 wm8775_write(sd, R21, 0x100 + state->input);
140 wm8775_set_audio(sd, 1);
141 return 0; 109 return 0;
142} 110}
143 111
144static int wm8775_s_ctrl(struct v4l2_ctrl *ctrl) 112static int wm8775_s_ctrl(struct v4l2_ctrl *ctrl)
145{ 113{
146 struct v4l2_subdev *sd = to_sd(ctrl); 114 struct v4l2_subdev *sd = to_sd(ctrl);
115 struct wm8775_state *state = to_state(sd);
147 116
148 switch (ctrl->id) { 117 switch (ctrl->id) {
149 case V4L2_CID_AUDIO_MUTE: 118 case V4L2_CID_AUDIO_MUTE:
150 case V4L2_CID_AUDIO_VOLUME: 119 wm8775_write(sd, R21, 0x0c0);
151 case V4L2_CID_AUDIO_BALANCE: 120 wm8775_write(sd, R14, 0x1d4);
152 wm8775_set_audio(sd, 0); 121 wm8775_write(sd, R15, 0x1d4);
153 return 0; 122 if (!ctrl->val)
154 case V4L2_CID_AUDIO_LOUDNESS: 123 wm8775_write(sd, R21, 0x100 + state->input);
155 wm8775_write(sd, R17, (ctrl->val ? ALC_EN : 0) | ALC_HOLD);
156 return 0; 124 return 0;
157 } 125 }
158 return -EINVAL; 126 return -EINVAL;
@@ -176,7 +144,16 @@ static int wm8775_log_status(struct v4l2_subdev *sd)
176 144
177static int wm8775_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *freq) 145static int wm8775_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *freq)
178{ 146{
179 wm8775_set_audio(sd, 0); 147 struct wm8775_state *state = to_state(sd);
148
149 /* If I remove this, then it can happen that I have no
150 sound the first time I tune from static to a valid channel.
151 It's difficult to reproduce and is almost certainly related
152 to the zero cross detect circuit. */
153 wm8775_write(sd, R21, 0x0c0);
154 wm8775_write(sd, R14, 0x1d4);
155 wm8775_write(sd, R15, 0x1d4);
156 wm8775_write(sd, R21, 0x100 + state->input);
180 return 0; 157 return 0;
181} 158}
182 159
@@ -226,7 +203,6 @@ static int wm8775_probe(struct i2c_client *client,
226{ 203{
227 struct wm8775_state *state; 204 struct wm8775_state *state;
228 struct v4l2_subdev *sd; 205 struct v4l2_subdev *sd;
229 int err;
230 206
231 /* Check if the adapter supports the needed features */ 207 /* Check if the adapter supports the needed features */
232 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 208 if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
@@ -240,21 +216,15 @@ static int wm8775_probe(struct i2c_client *client,
240 return -ENOMEM; 216 return -ENOMEM;
241 sd = &state->sd; 217 sd = &state->sd;
242 v4l2_i2c_subdev_init(sd, client, &wm8775_ops); 218 v4l2_i2c_subdev_init(sd, client, &wm8775_ops);
243 sd->grp_id = WM8775_GID; /* subdev group id */
244 state->input = 2; 219 state->input = 2;
245 220
246 v4l2_ctrl_handler_init(&state->hdl, 4); 221 v4l2_ctrl_handler_init(&state->hdl, 1);
247 state->mute = v4l2_ctrl_new_std(&state->hdl, &wm8775_ctrl_ops, 222 state->mute = v4l2_ctrl_new_std(&state->hdl, &wm8775_ctrl_ops,
248 V4L2_CID_AUDIO_MUTE, 0, 1, 1, 0); 223 V4L2_CID_AUDIO_MUTE, 0, 1, 1, 0);
249 state->vol = v4l2_ctrl_new_std(&state->hdl, &wm8775_ctrl_ops,
250 V4L2_CID_AUDIO_VOLUME, 0, 65535, (65535+99)/100, 0xCF00); /* 0dB*/
251 state->bal = v4l2_ctrl_new_std(&state->hdl, &wm8775_ctrl_ops,
252 V4L2_CID_AUDIO_BALANCE, 0, 65535, (65535+99)/100, 32768);
253 state->loud = v4l2_ctrl_new_std(&state->hdl, &wm8775_ctrl_ops,
254 V4L2_CID_AUDIO_LOUDNESS, 0, 1, 1, 1);
255 sd->ctrl_handler = &state->hdl; 224 sd->ctrl_handler = &state->hdl;
256 err = state->hdl.error; 225 if (state->hdl.error) {
257 if (err) { 226 int err = state->hdl.error;
227
258 v4l2_ctrl_handler_free(&state->hdl); 228 v4l2_ctrl_handler_free(&state->hdl);
259 kfree(state); 229 kfree(state);
260 return err; 230 return err;
@@ -266,25 +236,29 @@ static int wm8775_probe(struct i2c_client *client,
266 wm8775_write(sd, R23, 0x000); 236 wm8775_write(sd, R23, 0x000);
267 /* Disable zero cross detect timeout */ 237 /* Disable zero cross detect timeout */
268 wm8775_write(sd, R7, 0x000); 238 wm8775_write(sd, R7, 0x000);
269 /* HPF enable, I2S mode, 24-bit */ 239 /* Left justified, 24-bit mode */
270 wm8775_write(sd, R11, 0x022); 240 wm8775_write(sd, R11, 0x021);
271 /* Master mode, clock ratio 256fs */ 241 /* Master mode, clock ratio 256fs */
272 wm8775_write(sd, R12, 0x102); 242 wm8775_write(sd, R12, 0x102);
273 /* Powered up */ 243 /* Powered up */
274 wm8775_write(sd, R13, 0x000); 244 wm8775_write(sd, R13, 0x000);
275 /* ALC stereo, ALC target level -5dB FS, ALC max gain +8dB */ 245 /* ADC gain +2.5dB, enable zero cross */
276 wm8775_write(sd, R16, 0x1bb); 246 wm8775_write(sd, R14, 0x1d4);
277 /* Set ALC mode and hold time */ 247 /* ADC gain +2.5dB, enable zero cross */
278 wm8775_write(sd, R17, (state->loud->val ? ALC_EN : 0) | ALC_HOLD); 248 wm8775_write(sd, R15, 0x1d4);
249 /* ALC Stereo, ALC target level -1dB FS max gain +8dB */
250 wm8775_write(sd, R16, 0x1bf);
251 /* Enable gain control, use zero cross detection,
252 ALC hold time 42.6 ms */
253 wm8775_write(sd, R17, 0x185);
279 /* ALC gain ramp up delay 34 s, ALC gain ramp down delay 33 ms */ 254 /* ALC gain ramp up delay 34 s, ALC gain ramp down delay 33 ms */
280 wm8775_write(sd, R18, 0x0a2); 255 wm8775_write(sd, R18, 0x0a2);
281 /* Enable noise gate, threshold -72dBfs */ 256 /* Enable noise gate, threshold -72dBfs */
282 wm8775_write(sd, R19, 0x005); 257 wm8775_write(sd, R19, 0x005);
283 /* Transient window 4ms, ALC min gain -5dB */ 258 /* Transient window 4ms, lower PGA gain limit -1dB */
284 wm8775_write(sd, R20, 0x0fb); 259 wm8775_write(sd, R20, 0x07a);
285 260 /* LRBOTH = 1, use input 2. */
286 wm8775_set_audio(sd, 1); /* set volume/mute/mux */ 261 wm8775_write(sd, R21, 0x102);
287
288 return 0; 262 return 0;
289} 263}
290 264
diff --git a/drivers/net/atlx/atl1.c b/drivers/net/atlx/atl1.c
index 53363108994e..3acf5123a6ef 100644
--- a/drivers/net/atlx/atl1.c
+++ b/drivers/net/atlx/atl1.c
@@ -3504,6 +3504,8 @@ static int atl1_set_ringparam(struct net_device *netdev,
3504 struct atl1_rfd_ring rfd_old, rfd_new; 3504 struct atl1_rfd_ring rfd_old, rfd_new;
3505 struct atl1_rrd_ring rrd_old, rrd_new; 3505 struct atl1_rrd_ring rrd_old, rrd_new;
3506 struct atl1_ring_header rhdr_old, rhdr_new; 3506 struct atl1_ring_header rhdr_old, rhdr_new;
3507 struct atl1_smb smb;
3508 struct atl1_cmb cmb;
3507 int err; 3509 int err;
3508 3510
3509 tpd_old = adapter->tpd_ring; 3511 tpd_old = adapter->tpd_ring;
@@ -3544,11 +3546,19 @@ static int atl1_set_ringparam(struct net_device *netdev,
3544 adapter->rrd_ring = rrd_old; 3546 adapter->rrd_ring = rrd_old;
3545 adapter->tpd_ring = tpd_old; 3547 adapter->tpd_ring = tpd_old;
3546 adapter->ring_header = rhdr_old; 3548 adapter->ring_header = rhdr_old;
3549 /*
3550 * Save SMB and CMB, since atl1_free_ring_resources
3551 * will clear them.
3552 */
3553 smb = adapter->smb;
3554 cmb = adapter->cmb;
3547 atl1_free_ring_resources(adapter); 3555 atl1_free_ring_resources(adapter);
3548 adapter->rfd_ring = rfd_new; 3556 adapter->rfd_ring = rfd_new;
3549 adapter->rrd_ring = rrd_new; 3557 adapter->rrd_ring = rrd_new;
3550 adapter->tpd_ring = tpd_new; 3558 adapter->tpd_ring = tpd_new;
3551 adapter->ring_header = rhdr_new; 3559 adapter->ring_header = rhdr_new;
3560 adapter->smb = smb;
3561 adapter->cmb = cmb;
3552 3562
3553 err = atl1_up(adapter); 3563 err = atl1_up(adapter);
3554 if (err) 3564 if (err)
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index 92bac19ad60a..6dff32196c92 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -940,7 +940,7 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages)
940 &udev->l2_ring_map, 940 &udev->l2_ring_map,
941 GFP_KERNEL | __GFP_COMP); 941 GFP_KERNEL | __GFP_COMP);
942 if (!udev->l2_ring) 942 if (!udev->l2_ring)
943 return -ENOMEM; 943 goto err_udev;
944 944
945 udev->l2_buf_size = (cp->l2_rx_ring_size + 1) * cp->l2_single_buf_size; 945 udev->l2_buf_size = (cp->l2_rx_ring_size + 1) * cp->l2_single_buf_size;
946 udev->l2_buf_size = PAGE_ALIGN(udev->l2_buf_size); 946 udev->l2_buf_size = PAGE_ALIGN(udev->l2_buf_size);
@@ -948,7 +948,7 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages)
948 &udev->l2_buf_map, 948 &udev->l2_buf_map,
949 GFP_KERNEL | __GFP_COMP); 949 GFP_KERNEL | __GFP_COMP);
950 if (!udev->l2_buf) 950 if (!udev->l2_buf)
951 return -ENOMEM; 951 goto err_dma;
952 952
953 write_lock(&cnic_dev_lock); 953 write_lock(&cnic_dev_lock);
954 list_add(&udev->list, &cnic_udev_list); 954 list_add(&udev->list, &cnic_udev_list);
@@ -959,6 +959,12 @@ static int cnic_alloc_uio_rings(struct cnic_dev *dev, int pages)
959 cp->udev = udev; 959 cp->udev = udev;
960 960
961 return 0; 961 return 0;
962 err_dma:
963 dma_free_coherent(&udev->pdev->dev, udev->l2_ring_size,
964 udev->l2_ring, udev->l2_ring_map);
965 err_udev:
966 kfree(udev);
967 return -ENOMEM;
962} 968}
963 969
964static int cnic_init_uio(struct cnic_dev *dev) 970static int cnic_init_uio(struct cnic_dev *dev)
diff --git a/drivers/net/ehea/ehea_ethtool.c b/drivers/net/ehea/ehea_ethtool.c
index 1f37ee6b2a26..d6cf502906cf 100644
--- a/drivers/net/ehea/ehea_ethtool.c
+++ b/drivers/net/ehea/ehea_ethtool.c
@@ -263,6 +263,13 @@ static void ehea_get_ethtool_stats(struct net_device *dev,
263 263
264static int ehea_set_flags(struct net_device *dev, u32 data) 264static int ehea_set_flags(struct net_device *dev, u32 data)
265{ 265{
266 /* Avoid changing the VLAN flags */
267 if ((data & (ETH_FLAG_RXVLAN | ETH_FLAG_TXVLAN)) !=
268 (ethtool_op_get_flags(dev) & (ETH_FLAG_RXVLAN |
269 ETH_FLAG_TXVLAN))){
270 return -EINVAL;
271 }
272
266 return ethtool_op_set_flags(dev, data, ETH_FLAG_LRO 273 return ethtool_op_set_flags(dev, data, ETH_FLAG_LRO
267 | ETH_FLAG_TXVLAN 274 | ETH_FLAG_TXVLAN
268 | ETH_FLAG_RXVLAN); 275 | ETH_FLAG_RXVLAN);
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index 39659976a1ac..89294b43c4a9 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -1285,6 +1285,11 @@ ppp_push(struct ppp *ppp)
1285} 1285}
1286 1286
1287#ifdef CONFIG_PPP_MULTILINK 1287#ifdef CONFIG_PPP_MULTILINK
1288static bool mp_protocol_compress __read_mostly = true;
1289module_param(mp_protocol_compress, bool, S_IRUGO | S_IWUSR);
1290MODULE_PARM_DESC(mp_protocol_compress,
1291 "compress protocol id in multilink fragments");
1292
1288/* 1293/*
1289 * Divide a packet to be transmitted into fragments and 1294 * Divide a packet to be transmitted into fragments and
1290 * send them out the individual links. 1295 * send them out the individual links.
@@ -1347,10 +1352,10 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb)
1347 if (nfree == 0 || nfree < navail / 2) 1352 if (nfree == 0 || nfree < navail / 2)
1348 return 0; /* can't take now, leave it in xmit_pending */ 1353 return 0; /* can't take now, leave it in xmit_pending */
1349 1354
1350 /* Do protocol field compression (XXX this should be optional) */ 1355 /* Do protocol field compression */
1351 p = skb->data; 1356 p = skb->data;
1352 len = skb->len; 1357 len = skb->len;
1353 if (*p == 0) { 1358 if (*p == 0 && mp_protocol_compress) {
1354 ++p; 1359 ++p;
1355 --len; 1360 --len;
1356 } 1361 }
diff --git a/drivers/net/skfp/skfddi.c b/drivers/net/skfp/skfddi.c
index 0a66fed52e8e..16c62659cdd9 100644
--- a/drivers/net/skfp/skfddi.c
+++ b/drivers/net/skfp/skfddi.c
@@ -412,7 +412,7 @@ static int skfp_driver_init(struct net_device *dev)
412 bp->SharedMemAddr = pci_alloc_consistent(&bp->pdev, 412 bp->SharedMemAddr = pci_alloc_consistent(&bp->pdev,
413 bp->SharedMemSize, 413 bp->SharedMemSize,
414 &bp->SharedMemDMA); 414 &bp->SharedMemDMA);
415 if (!bp->SharedMemSize) { 415 if (!bp->SharedMemAddr) {
416 printk("could not allocate mem for "); 416 printk("could not allocate mem for ");
417 printk("hardware module: %ld byte\n", 417 printk("hardware module: %ld byte\n",
418 bp->SharedMemSize); 418 bp->SharedMemSize);
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index 4adf12422787..a4f2bd52e546 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -148,7 +148,7 @@ static int full_duplex[MAX_UNITS] = {0, };
148 * This SUCKS. 148 * This SUCKS.
149 * We need a much better method to determine if dma_addr_t is 64-bit. 149 * We need a much better method to determine if dma_addr_t is 64-bit.
150 */ 150 */
151#if (defined(__i386__) && defined(CONFIG_HIGHMEM64G)) || defined(__x86_64__) || defined (__ia64__) || defined(__alpha__) || defined(__mips64__) || (defined(__mips__) && defined(CONFIG_HIGHMEM) && defined(CONFIG_64BIT_PHYS_ADDR)) || (defined(__powerpc64__) || defined(CONFIG_PHYS_64BIT)) 151#if (defined(__i386__) && defined(CONFIG_HIGHMEM64G)) || defined(__x86_64__) || defined (__ia64__) || defined(__alpha__) || (defined(CONFIG_MIPS) && ((defined(CONFIG_HIGHMEM) && defined(CONFIG_64BIT_PHYS_ADDR)) || defined(CONFIG_64BIT))) || (defined(__powerpc64__) || defined(CONFIG_PHYS_64BIT))
152/* 64-bit dma_addr_t */ 152/* 64-bit dma_addr_t */
153#define ADDR_64BITS /* This chip uses 64 bit addresses. */ 153#define ADDR_64BITS /* This chip uses 64 bit addresses. */
154#define netdrv_addr_t __le64 154#define netdrv_addr_t __le64
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 30ccbb6d097a..6f97b7bbcbf1 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -12658,7 +12658,7 @@ static void __devinit tg3_read_vpd(struct tg3 *tp)
12658 cnt = pci_read_vpd(tp->pdev, pos, 12658 cnt = pci_read_vpd(tp->pdev, pos,
12659 TG3_NVM_VPD_LEN - pos, 12659 TG3_NVM_VPD_LEN - pos,
12660 &vpd_data[pos]); 12660 &vpd_data[pos]);
12661 if (cnt == -ETIMEDOUT || -EINTR) 12661 if (cnt == -ETIMEDOUT || cnt == -EINTR)
12662 cnt = 0; 12662 cnt = 0;
12663 else if (cnt < 0) 12663 else if (cnt < 0)
12664 goto out_not_found; 12664 goto out_not_found;
diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
index c44a5e8b8b82..f0b3ad13c273 100644
--- a/drivers/platform/x86/intel_ips.c
+++ b/drivers/platform/x86/intel_ips.c
@@ -75,6 +75,7 @@
75#include <drm/i915_drm.h> 75#include <drm/i915_drm.h>
76#include <asm/msr.h> 76#include <asm/msr.h>
77#include <asm/processor.h> 77#include <asm/processor.h>
78#include "intel_ips.h"
78 79
79#define PCI_DEVICE_ID_INTEL_THERMAL_SENSOR 0x3b32 80#define PCI_DEVICE_ID_INTEL_THERMAL_SENSOR 0x3b32
80 81
@@ -245,6 +246,7 @@
245#define thm_writel(off, val) writel((val), ips->regmap + (off)) 246#define thm_writel(off, val) writel((val), ips->regmap + (off))
246 247
247static const int IPS_ADJUST_PERIOD = 5000; /* ms */ 248static const int IPS_ADJUST_PERIOD = 5000; /* ms */
249static bool late_i915_load = false;
248 250
249/* For initial average collection */ 251/* For initial average collection */
250static const int IPS_SAMPLE_PERIOD = 200; /* ms */ 252static const int IPS_SAMPLE_PERIOD = 200; /* ms */
@@ -339,6 +341,9 @@ struct ips_driver {
339 u64 orig_turbo_ratios; 341 u64 orig_turbo_ratios;
340}; 342};
341 343
344static bool
345ips_gpu_turbo_enabled(struct ips_driver *ips);
346
342/** 347/**
343 * ips_cpu_busy - is CPU busy? 348 * ips_cpu_busy - is CPU busy?
344 * @ips: IPS driver struct 349 * @ips: IPS driver struct
@@ -517,7 +522,7 @@ static void ips_disable_cpu_turbo(struct ips_driver *ips)
517 */ 522 */
518static bool ips_gpu_busy(struct ips_driver *ips) 523static bool ips_gpu_busy(struct ips_driver *ips)
519{ 524{
520 if (!ips->gpu_turbo_enabled) 525 if (!ips_gpu_turbo_enabled(ips))
521 return false; 526 return false;
522 527
523 return ips->gpu_busy(); 528 return ips->gpu_busy();
@@ -532,7 +537,7 @@ static bool ips_gpu_busy(struct ips_driver *ips)
532 */ 537 */
533static void ips_gpu_raise(struct ips_driver *ips) 538static void ips_gpu_raise(struct ips_driver *ips)
534{ 539{
535 if (!ips->gpu_turbo_enabled) 540 if (!ips_gpu_turbo_enabled(ips))
536 return; 541 return;
537 542
538 if (!ips->gpu_raise()) 543 if (!ips->gpu_raise())
@@ -549,7 +554,7 @@ static void ips_gpu_raise(struct ips_driver *ips)
549 */ 554 */
550static void ips_gpu_lower(struct ips_driver *ips) 555static void ips_gpu_lower(struct ips_driver *ips)
551{ 556{
552 if (!ips->gpu_turbo_enabled) 557 if (!ips_gpu_turbo_enabled(ips))
553 return; 558 return;
554 559
555 if (!ips->gpu_lower()) 560 if (!ips->gpu_lower())
@@ -1454,6 +1459,31 @@ out_err:
1454 return false; 1459 return false;
1455} 1460}
1456 1461
1462static bool
1463ips_gpu_turbo_enabled(struct ips_driver *ips)
1464{
1465 if (!ips->gpu_busy && late_i915_load) {
1466 if (ips_get_i915_syms(ips)) {
1467 dev_info(&ips->dev->dev,
1468 "i915 driver attached, reenabling gpu turbo\n");
1469 ips->gpu_turbo_enabled = !(thm_readl(THM_HTS) & HTS_GTD_DIS);
1470 }
1471 }
1472
1473 return ips->gpu_turbo_enabled;
1474}
1475
1476void
1477ips_link_to_i915_driver()
1478{
1479 /* We can't cleanly get at the various ips_driver structs from
1480 * this caller (the i915 driver), so just set a flag saying
1481 * that it's time to try getting the symbols again.
1482 */
1483 late_i915_load = true;
1484}
1485EXPORT_SYMBOL_GPL(ips_link_to_i915_driver);
1486
1457static DEFINE_PCI_DEVICE_TABLE(ips_id_table) = { 1487static DEFINE_PCI_DEVICE_TABLE(ips_id_table) = {
1458 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 1488 { PCI_DEVICE(PCI_VENDOR_ID_INTEL,
1459 PCI_DEVICE_ID_INTEL_THERMAL_SENSOR), }, 1489 PCI_DEVICE_ID_INTEL_THERMAL_SENSOR), },
diff --git a/drivers/platform/x86/intel_ips.h b/drivers/platform/x86/intel_ips.h
new file mode 100644
index 000000000000..73299beff5b3
--- /dev/null
+++ b/drivers/platform/x86/intel_ips.h
@@ -0,0 +1,21 @@
1/*
2 * Copyright (c) 2010 Intel Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
16 *
17 * The full GNU General Public License is included in this distribution in
18 * the file called "COPYING".
19 */
20
21void ips_link_to_i915_driver(void);
diff --git a/drivers/spi/coldfire_qspi.c b/drivers/spi/coldfire_qspi.c
index 052b3c7fa6a0..8856bcca9d29 100644
--- a/drivers/spi/coldfire_qspi.c
+++ b/drivers/spi/coldfire_qspi.c
@@ -317,7 +317,7 @@ static void mcfqspi_work(struct work_struct *work)
317 msg = container_of(mcfqspi->msgq.next, struct spi_message, 317 msg = container_of(mcfqspi->msgq.next, struct spi_message,
318 queue); 318 queue);
319 319
320 list_del_init(&mcfqspi->msgq); 320 list_del_init(&msg->queue);
321 spin_unlock_irqrestore(&mcfqspi->lock, flags); 321 spin_unlock_irqrestore(&mcfqspi->lock, flags);
322 322
323 spi = msg->spi; 323 spi = msg->spi;
diff --git a/drivers/spi/omap2_mcspi.c b/drivers/spi/omap2_mcspi.c
index 2a651e61bfbf..951a160fc27f 100644
--- a/drivers/spi/omap2_mcspi.c
+++ b/drivers/spi/omap2_mcspi.c
@@ -1305,10 +1305,49 @@ static int __exit omap2_mcspi_remove(struct platform_device *pdev)
1305/* work with hotplug and coldplug */ 1305/* work with hotplug and coldplug */
1306MODULE_ALIAS("platform:omap2_mcspi"); 1306MODULE_ALIAS("platform:omap2_mcspi");
1307 1307
1308#ifdef CONFIG_SUSPEND
1309/*
1310 * When SPI wake up from off-mode, CS is in activate state. If it was in
1311 * unactive state when driver was suspend, then force it to unactive state at
1312 * wake up.
1313 */
1314static int omap2_mcspi_resume(struct device *dev)
1315{
1316 struct spi_master *master = dev_get_drvdata(dev);
1317 struct omap2_mcspi *mcspi = spi_master_get_devdata(master);
1318 struct omap2_mcspi_cs *cs;
1319
1320 omap2_mcspi_enable_clocks(mcspi);
1321 list_for_each_entry(cs, &omap2_mcspi_ctx[master->bus_num - 1].cs,
1322 node) {
1323 if ((cs->chconf0 & OMAP2_MCSPI_CHCONF_FORCE) == 0) {
1324
1325 /*
1326 * We need to toggle CS state for OMAP take this
1327 * change in account.
1328 */
1329 MOD_REG_BIT(cs->chconf0, OMAP2_MCSPI_CHCONF_FORCE, 1);
1330 __raw_writel(cs->chconf0, cs->base + OMAP2_MCSPI_CHCONF0);
1331 MOD_REG_BIT(cs->chconf0, OMAP2_MCSPI_CHCONF_FORCE, 0);
1332 __raw_writel(cs->chconf0, cs->base + OMAP2_MCSPI_CHCONF0);
1333 }
1334 }
1335 omap2_mcspi_disable_clocks(mcspi);
1336 return 0;
1337}
1338#else
1339#define omap2_mcspi_resume NULL
1340#endif
1341
1342static const struct dev_pm_ops omap2_mcspi_pm_ops = {
1343 .resume = omap2_mcspi_resume,
1344};
1345
1308static struct platform_driver omap2_mcspi_driver = { 1346static struct platform_driver omap2_mcspi_driver = {
1309 .driver = { 1347 .driver = {
1310 .name = "omap2_mcspi", 1348 .name = "omap2_mcspi",
1311 .owner = THIS_MODULE, 1349 .owner = THIS_MODULE,
1350 .pm = &omap2_mcspi_pm_ops
1312 }, 1351 },
1313 .remove = __exit_p(omap2_mcspi_remove), 1352 .remove = __exit_p(omap2_mcspi_remove),
1314}; 1353};
diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
index 8c3c057aa847..d0e9e0207539 100644
--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@ -435,12 +435,6 @@ static int zram_make_request(struct request_queue *queue, struct bio *bio)
435 int ret = 0; 435 int ret = 0;
436 struct zram *zram = queue->queuedata; 436 struct zram *zram = queue->queuedata;
437 437
438 if (unlikely(!zram->init_done)) {
439 set_bit(BIO_UPTODATE, &bio->bi_flags);
440 bio_endio(bio, 0);
441 return 0;
442 }
443
444 if (!valid_io_request(zram, bio)) { 438 if (!valid_io_request(zram, bio)) {
445 zram_stat64_inc(zram, &zram->stats.invalid_io); 439 zram_stat64_inc(zram, &zram->stats.invalid_io);
446 bio_io_error(bio); 440 bio_io_error(bio);
diff --git a/drivers/usb/atm/ueagle-atm.c b/drivers/usb/atm/ueagle-atm.c
index 44447f54942f..99ac70e32556 100644
--- a/drivers/usb/atm/ueagle-atm.c
+++ b/drivers/usb/atm/ueagle-atm.c
@@ -2206,8 +2206,11 @@ static int uea_boot(struct uea_softc *sc)
2206 goto err1; 2206 goto err1;
2207 } 2207 }
2208 2208
2209 sc->kthread = kthread_run(uea_kthread, sc, "ueagle-atm"); 2209 /* Create worker thread, but don't start it here. Start it after
2210 if (sc->kthread == ERR_PTR(-ENOMEM)) { 2210 * all usbatm generic initialization is done.
2211 */
2212 sc->kthread = kthread_create(uea_kthread, sc, "ueagle-atm");
2213 if (IS_ERR(sc->kthread)) {
2211 uea_err(INS_TO_USBDEV(sc), "failed to create thread\n"); 2214 uea_err(INS_TO_USBDEV(sc), "failed to create thread\n");
2212 goto err2; 2215 goto err2;
2213 } 2216 }
@@ -2624,6 +2627,7 @@ static struct usbatm_driver uea_usbatm_driver = {
2624static int uea_probe(struct usb_interface *intf, const struct usb_device_id *id) 2627static int uea_probe(struct usb_interface *intf, const struct usb_device_id *id)
2625{ 2628{
2626 struct usb_device *usb = interface_to_usbdev(intf); 2629 struct usb_device *usb = interface_to_usbdev(intf);
2630 int ret;
2627 2631
2628 uea_enters(usb); 2632 uea_enters(usb);
2629 uea_info(usb, "ADSL device founded vid (%#X) pid (%#X) Rev (%#X): %s\n", 2633 uea_info(usb, "ADSL device founded vid (%#X) pid (%#X) Rev (%#X): %s\n",
@@ -2637,7 +2641,19 @@ static int uea_probe(struct usb_interface *intf, const struct usb_device_id *id)
2637 if (UEA_IS_PREFIRM(id)) 2641 if (UEA_IS_PREFIRM(id))
2638 return uea_load_firmware(usb, UEA_CHIP_VERSION(id)); 2642 return uea_load_firmware(usb, UEA_CHIP_VERSION(id));
2639 2643
2640 return usbatm_usb_probe(intf, id, &uea_usbatm_driver); 2644 ret = usbatm_usb_probe(intf, id, &uea_usbatm_driver);
2645 if (ret == 0) {
2646 struct usbatm_data *usbatm = usb_get_intfdata(intf);
2647 struct uea_softc *sc = usbatm->driver_data;
2648
2649 /* Ensure carrier is initialized to off as early as possible */
2650 UPDATE_ATM_SIGNAL(ATM_PHY_SIG_LOST);
2651
2652 /* Only start the worker thread when all init is done */
2653 wake_up_process(sc->kthread);
2654 }
2655
2656 return ret;
2641} 2657}
2642 2658
2643static void uea_disconnect(struct usb_interface *intf) 2659static void uea_disconnect(struct usb_interface *intf)
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 9d8688b92d8b..8cd00ad98d37 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -824,6 +824,8 @@ enum dma_status dma_sync_wait(struct dma_chan *chan, dma_cookie_t cookie);
824#ifdef CONFIG_DMA_ENGINE 824#ifdef CONFIG_DMA_ENGINE
825enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx); 825enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx);
826void dma_issue_pending_all(void); 826void dma_issue_pending_all(void);
827struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, dma_filter_fn fn, void *fn_param);
828void dma_release_channel(struct dma_chan *chan);
827#else 829#else
828static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx) 830static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descriptor *tx)
829{ 831{
@@ -831,7 +833,14 @@ static inline enum dma_status dma_wait_for_async_tx(struct dma_async_tx_descript
831} 833}
832static inline void dma_issue_pending_all(void) 834static inline void dma_issue_pending_all(void)
833{ 835{
834 do { } while (0); 836}
837static inline struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask,
838 dma_filter_fn fn, void *fn_param)
839{
840 return NULL;
841}
842static inline void dma_release_channel(struct dma_chan *chan)
843{
835} 844}
836#endif 845#endif
837 846
@@ -842,8 +851,6 @@ void dma_async_device_unregister(struct dma_device *device);
842void dma_run_dependencies(struct dma_async_tx_descriptor *tx); 851void dma_run_dependencies(struct dma_async_tx_descriptor *tx);
843struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type); 852struct dma_chan *dma_find_channel(enum dma_transaction_type tx_type);
844#define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y) 853#define dma_request_channel(mask, x, y) __dma_request_channel(&(mask), x, y)
845struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, dma_filter_fn fn, void *fn_param);
846void dma_release_channel(struct dma_chan *chan);
847 854
848/* --- Helper iov-locking functions --- */ 855/* --- Helper iov-locking functions --- */
849 856
diff --git a/include/media/wm8775.h b/include/media/wm8775.h
index a1c4d417dfa2..60739c5a23ae 100644
--- a/include/media/wm8775.h
+++ b/include/media/wm8775.h
@@ -32,7 +32,4 @@
32#define WM8775_AIN3 4 32#define WM8775_AIN3 4
33#define WM8775_AIN4 8 33#define WM8775_AIN4 8
34 34
35/* subdev group ID */
36#define WM8775_GID (1 << 0)
37
38#endif 35#endif
diff --git a/init/do_mounts.c b/init/do_mounts.c
index 830aaec9c7d5..2b54bef33b55 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -93,7 +93,7 @@ no_match:
93 * 93 *
94 * Returns the matching dev_t on success or 0 on failure. 94 * Returns the matching dev_t on success or 0 on failure.
95 */ 95 */
96static dev_t __init devt_from_partuuid(char *uuid_str) 96static dev_t devt_from_partuuid(char *uuid_str)
97{ 97{
98 dev_t res = 0; 98 dev_t res = 0;
99 struct device *dev = NULL; 99 struct device *dev = NULL;
diff --git a/kernel/user.c b/kernel/user.c
index 2c7d8d5914b1..5c598ca781df 100644
--- a/kernel/user.c
+++ b/kernel/user.c
@@ -158,6 +158,7 @@ struct user_struct *alloc_uid(struct user_namespace *ns, uid_t uid)
158 spin_lock_irq(&uidhash_lock); 158 spin_lock_irq(&uidhash_lock);
159 up = uid_hash_find(uid, hashent); 159 up = uid_hash_find(uid, hashent);
160 if (up) { 160 if (up) {
161 put_user_ns(ns);
161 key_put(new->uid_keyring); 162 key_put(new->uid_keyring);
162 key_put(new->session_keyring); 163 key_put(new->session_keyring);
163 kmem_cache_free(uid_cachep, new); 164 kmem_cache_free(uid_cachep, new);
diff --git a/kernel/watchdog.c b/kernel/watchdog.c
index eb17e143b5da..aaa8dae08236 100644
--- a/kernel/watchdog.c
+++ b/kernel/watchdog.c
@@ -366,7 +366,8 @@ static int watchdog_nmi_enable(int cpu)
366 goto out_save; 366 goto out_save;
367 } 367 }
368 368
369 printk(KERN_ERR "NMI watchdog failed to create perf event on cpu%i: %p\n", cpu, event); 369 printk(KERN_ERR "NMI watchdog disabled for cpu%i: unable to create perf event: %ld\n",
370 cpu, PTR_ERR(event));
370 return PTR_ERR(event); 371 return PTR_ERR(event);
371 372
372 /* success path */ 373 /* success path */
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 7a22b4129211..00bb8a64d028 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1925,19 +1925,18 @@ again:
1925 1925
1926 rcu_read_lock(); 1926 rcu_read_lock();
1927 p = rcu_dereference(mm->owner); 1927 p = rcu_dereference(mm->owner);
1928 VM_BUG_ON(!p);
1929 /* 1928 /*
1930 * because we don't have task_lock(), "p" can exit while 1929 * Because we don't have task_lock(), "p" can exit.
1931 * we're here. In that case, "mem" can point to root 1930 * In that case, "mem" can point to root or p can be NULL with
1932 * cgroup but never be NULL. (and task_struct itself is freed 1931 * race with swapoff. Then, we have small risk of mis-accouning.
1933 * by RCU, cgroup itself is RCU safe.) Then, we have small 1932 * But such kind of mis-account by race always happens because
1934 * risk here to get wrong cgroup. But such kind of mis-account 1933 * we don't have cgroup_mutex(). It's overkill and we allo that
1935 * by race always happens because we don't have cgroup_mutex(). 1934 * small race, here.
1936 * It's overkill and we allow that small race, here. 1935 * (*) swapoff at el will charge against mm-struct not against
1936 * task-struct. So, mm->owner can be NULL.
1937 */ 1937 */
1938 mem = mem_cgroup_from_task(p); 1938 mem = mem_cgroup_from_task(p);
1939 VM_BUG_ON(!mem); 1939 if (!mem || mem_cgroup_is_root(mem)) {
1940 if (mem_cgroup_is_root(mem)) {
1941 rcu_read_unlock(); 1940 rcu_read_unlock();
1942 goto done; 1941 goto done;
1943 } 1942 }
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index f19e347f56f6..543b3262d002 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -1430,7 +1430,7 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br,
1430 struct net_bridge_port *port, 1430 struct net_bridge_port *port,
1431 struct sk_buff *skb) 1431 struct sk_buff *skb)
1432{ 1432{
1433 struct sk_buff *skb2 = skb; 1433 struct sk_buff *skb2;
1434 struct ipv6hdr *ip6h; 1434 struct ipv6hdr *ip6h;
1435 struct icmp6hdr *icmp6h; 1435 struct icmp6hdr *icmp6h;
1436 u8 nexthdr; 1436 u8 nexthdr;
@@ -1469,15 +1469,15 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br,
1469 if (!skb2) 1469 if (!skb2)
1470 return -ENOMEM; 1470 return -ENOMEM;
1471 1471
1472 err = -EINVAL;
1473 if (!pskb_may_pull(skb2, offset + sizeof(struct icmp6hdr)))
1474 goto out;
1475
1472 len -= offset - skb_network_offset(skb2); 1476 len -= offset - skb_network_offset(skb2);
1473 1477
1474 __skb_pull(skb2, offset); 1478 __skb_pull(skb2, offset);
1475 skb_reset_transport_header(skb2); 1479 skb_reset_transport_header(skb2);
1476 1480
1477 err = -EINVAL;
1478 if (!pskb_may_pull(skb2, sizeof(*icmp6h)))
1479 goto out;
1480
1481 icmp6h = icmp6_hdr(skb2); 1481 icmp6h = icmp6_hdr(skb2);
1482 1482
1483 switch (icmp6h->icmp6_type) { 1483 switch (icmp6h->icmp6_type) {
@@ -1516,7 +1516,12 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br,
1516 switch (icmp6h->icmp6_type) { 1516 switch (icmp6h->icmp6_type) {
1517 case ICMPV6_MGM_REPORT: 1517 case ICMPV6_MGM_REPORT:
1518 { 1518 {
1519 struct mld_msg *mld = (struct mld_msg *)icmp6h; 1519 struct mld_msg *mld;
1520 if (!pskb_may_pull(skb2, sizeof(*mld))) {
1521 err = -EINVAL;
1522 goto out;
1523 }
1524 mld = (struct mld_msg *)skb_transport_header(skb2);
1520 BR_INPUT_SKB_CB(skb2)->mrouters_only = 1; 1525 BR_INPUT_SKB_CB(skb2)->mrouters_only = 1;
1521 err = br_ip6_multicast_add_group(br, port, &mld->mld_mca); 1526 err = br_ip6_multicast_add_group(br, port, &mld->mld_mca);
1522 break; 1527 break;
@@ -1529,15 +1534,18 @@ static int br_multicast_ipv6_rcv(struct net_bridge *br,
1529 break; 1534 break;
1530 case ICMPV6_MGM_REDUCTION: 1535 case ICMPV6_MGM_REDUCTION:
1531 { 1536 {
1532 struct mld_msg *mld = (struct mld_msg *)icmp6h; 1537 struct mld_msg *mld;
1538 if (!pskb_may_pull(skb2, sizeof(*mld))) {
1539 err = -EINVAL;
1540 goto out;
1541 }
1542 mld = (struct mld_msg *)skb_transport_header(skb2);
1533 br_ip6_multicast_leave_group(br, port, &mld->mld_mca); 1543 br_ip6_multicast_leave_group(br, port, &mld->mld_mca);
1534 } 1544 }
1535 } 1545 }
1536 1546
1537out: 1547out:
1538 __skb_push(skb2, offset); 1548 kfree_skb(skb2);
1539 if (skb2 != skb)
1540 kfree_skb(skb2);
1541 return err; 1549 return err;
1542} 1550}
1543#endif 1551#endif
diff --git a/net/bridge/br_stp_bpdu.c b/net/bridge/br_stp_bpdu.c
index 35cf27087b56..e3d7aefa9181 100644
--- a/net/bridge/br_stp_bpdu.c
+++ b/net/bridge/br_stp_bpdu.c
@@ -50,6 +50,8 @@ static void br_send_bpdu(struct net_bridge_port *p,
50 50
51 llc_mac_hdr_init(skb, p->dev->dev_addr, p->br->group_addr); 51 llc_mac_hdr_init(skb, p->dev->dev_addr, p->br->group_addr);
52 52
53 skb_reset_mac_header(skb);
54
53 NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev, 55 NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev,
54 dev_queue_xmit); 56 dev_queue_xmit);
55} 57}
diff --git a/net/can/bcm.c b/net/can/bcm.c
index 6faa8256e10c..9d5e8accfab1 100644
--- a/net/can/bcm.c
+++ b/net/can/bcm.c
@@ -125,7 +125,7 @@ struct bcm_sock {
125 struct list_head tx_ops; 125 struct list_head tx_ops;
126 unsigned long dropped_usr_msgs; 126 unsigned long dropped_usr_msgs;
127 struct proc_dir_entry *bcm_proc_read; 127 struct proc_dir_entry *bcm_proc_read;
128 char procname [20]; /* pointer printed in ASCII with \0 */ 128 char procname [32]; /* inode number in decimal with \0 */
129}; 129};
130 130
131static inline struct bcm_sock *bcm_sk(const struct sock *sk) 131static inline struct bcm_sock *bcm_sk(const struct sock *sk)
@@ -1521,7 +1521,7 @@ static int bcm_connect(struct socket *sock, struct sockaddr *uaddr, int len,
1521 1521
1522 if (proc_dir) { 1522 if (proc_dir) {
1523 /* unique socket address as filename */ 1523 /* unique socket address as filename */
1524 sprintf(bo->procname, "%p", sock); 1524 sprintf(bo->procname, "%lu", sock_i_ino(sk));
1525 bo->bcm_proc_read = proc_create_data(bo->procname, 0644, 1525 bo->bcm_proc_read = proc_create_data(bo->procname, 0644,
1526 proc_dir, 1526 proc_dir,
1527 &bcm_proc_fops, sk); 1527 &bcm_proc_fops, sk);
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index df948b0f1ac9..93bfd95584f4 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2649,8 +2649,12 @@ static int ip_route_output_slow(struct net *net, struct rtable **rp,
2649 } 2649 }
2650 2650
2651 if (res.type == RTN_LOCAL) { 2651 if (res.type == RTN_LOCAL) {
2652 if (!fl.fl4_src) 2652 if (!fl.fl4_src) {
2653 fl.fl4_src = fl.fl4_dst; 2653 if (res.fi->fib_prefsrc)
2654 fl.fl4_src = res.fi->fib_prefsrc;
2655 else
2656 fl.fl4_src = fl.fl4_dst;
2657 }
2654 dev_out = net->loopback_dev; 2658 dev_out = net->loopback_dev;
2655 fl.oif = dev_out->ifindex; 2659 fl.oif = dev_out->ifindex;
2656 res.fi = NULL; 2660 res.fi = NULL;
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index b9d9aa18e6d6..5f77dcb8977e 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -140,6 +140,20 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *e
140 } 140 }
141 if (current_entry->prompt && current_entry != &rootmenu) 141 if (current_entry->prompt && current_entry != &rootmenu)
142 prop_warn(prop, "prompt redefined"); 142 prop_warn(prop, "prompt redefined");
143
144 /* Apply all upper menus' visibilities to actual prompts. */
145 if(type == P_PROMPT) {
146 struct menu *menu = current_entry;
147
148 while ((menu = menu->parent) != NULL) {
149 if (!menu->visibility)
150 continue;
151 prop->visible.expr
152 = expr_alloc_and(prop->visible.expr,
153 menu->visibility);
154 }
155 }
156
143 current_entry->prompt = prop; 157 current_entry->prompt = prop;
144 } 158 }
145 prop->text = prompt; 159 prop->text = prompt;
diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c
index aef8c0a923ab..d661afbe474c 100644
--- a/security/integrity/ima/ima_policy.c
+++ b/security/integrity/ima/ima_policy.c
@@ -253,6 +253,8 @@ static int ima_lsm_rule_init(struct ima_measure_rule_entry *entry,
253 result = security_filter_rule_init(entry->lsm[lsm_rule].type, 253 result = security_filter_rule_init(entry->lsm[lsm_rule].type,
254 Audit_equal, args, 254 Audit_equal, args,
255 &entry->lsm[lsm_rule].rule); 255 &entry->lsm[lsm_rule].rule);
256 if (!entry->lsm[lsm_rule].rule)
257 return -EINVAL;
256 return result; 258 return result;
257} 259}
258 260
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c
index 46c0d03dbecc..fcb14a099822 100644
--- a/sound/oss/soundcard.c
+++ b/sound/oss/soundcard.c
@@ -87,7 +87,7 @@ int *load_mixer_volumes(char *name, int *levels, int present)
87 int i, n; 87 int i, n;
88 88
89 for (i = 0; i < num_mixer_volumes; i++) { 89 for (i = 0; i < num_mixer_volumes; i++) {
90 if (strcmp(name, mixer_vols[i].name) == 0) { 90 if (strncmp(name, mixer_vols[i].name, 32) == 0) {
91 if (present) 91 if (present)
92 mixer_vols[i].num = i; 92 mixer_vols[i].num = i;
93 return mixer_vols[i].levels; 93 return mixer_vols[i].levels;
@@ -99,7 +99,7 @@ int *load_mixer_volumes(char *name, int *levels, int present)
99 } 99 }
100 n = num_mixer_volumes++; 100 n = num_mixer_volumes++;
101 101
102 strcpy(mixer_vols[n].name, name); 102 strncpy(mixer_vols[n].name, name, 32);
103 103
104 if (present) 104 if (present)
105 mixer_vols[n].num = n; 105 mixer_vols[n].num = n;
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index b030c8eba21f..a1c4008af891 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -2300,6 +2300,7 @@ static struct snd_pci_quirk position_fix_list[] __devinitdata = {
2300 SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB), 2300 SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB),
2301 SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB), 2301 SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB),
2302 SND_PCI_QUIRK(0x1028, 0x01f6, "Dell Latitude 131L", POS_FIX_LPIB), 2302 SND_PCI_QUIRK(0x1028, 0x01f6, "Dell Latitude 131L", POS_FIX_LPIB),
2303 SND_PCI_QUIRK(0x1028, 0x0470, "Dell Inspiron 1120", POS_FIX_LPIB),
2303 SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB), 2304 SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB),
2304 SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), 2305 SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB),
2305 SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), 2306 SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB),
diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c
index d63e28773eb1..6447dbb2f123 100644
--- a/sound/soc/codecs/max98088.c
+++ b/sound/soc/codecs/max98088.c
@@ -40,7 +40,6 @@ struct max98088_cdata {
40}; 40};
41 41
42struct max98088_priv { 42struct max98088_priv {
43 u8 reg_cache[M98088_REG_CNT];
44 enum max98088_type devtype; 43 enum max98088_type devtype;
45 void *control_data; 44 void *control_data;
46 struct max98088_pdata *pdata; 45 struct max98088_pdata *pdata;
@@ -1588,7 +1587,7 @@ static int max98088_dai2_set_fmt(struct snd_soc_dai *codec_dai,
1588 1587
1589static void max98088_sync_cache(struct snd_soc_codec *codec) 1588static void max98088_sync_cache(struct snd_soc_codec *codec)
1590{ 1589{
1591 struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec); 1590 u16 *reg_cache = codec->reg_cache;
1592 int i; 1591 int i;
1593 1592
1594 if (!codec->cache_sync) 1593 if (!codec->cache_sync)
@@ -1599,14 +1598,14 @@ static void max98088_sync_cache(struct snd_soc_codec *codec)
1599 /* write back cached values if they're writeable and 1598 /* write back cached values if they're writeable and
1600 * different from the hardware default. 1599 * different from the hardware default.
1601 */ 1600 */
1602 for (i = 1; i < ARRAY_SIZE(max98088->reg_cache); i++) { 1601 for (i = 1; i < codec->driver->reg_cache_size; i++) {
1603 if (!max98088_access[i].writable) 1602 if (!max98088_access[i].writable)
1604 continue; 1603 continue;
1605 1604
1606 if (max98088->reg_cache[i] == max98088_reg[i]) 1605 if (reg_cache[i] == max98088_reg[i])
1607 continue; 1606 continue;
1608 1607
1609 snd_soc_write(codec, i, max98088->reg_cache[i]); 1608 snd_soc_write(codec, i, reg_cache[i]);
1610 } 1609 }
1611 1610
1612 codec->cache_sync = 0; 1611 codec->cache_sync = 0;
@@ -1951,7 +1950,6 @@ static int max98088_probe(struct snd_soc_codec *codec)
1951 int ret = 0; 1950 int ret = 0;
1952 1951
1953 codec->cache_sync = 1; 1952 codec->cache_sync = 1;
1954 memcpy(codec->reg_cache, max98088_reg, sizeof(max98088_reg));
1955 1953
1956 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_I2C); 1954 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_I2C);
1957 if (ret != 0) { 1955 if (ret != 0) {
diff --git a/sound/soc/codecs/wm8523.c b/sound/soc/codecs/wm8523.c
index 9a433a5396cb..deca79ea2b4b 100644
--- a/sound/soc/codecs/wm8523.c
+++ b/sound/soc/codecs/wm8523.c
@@ -41,7 +41,6 @@ static const char *wm8523_supply_names[WM8523_NUM_SUPPLIES] = {
41/* codec private data */ 41/* codec private data */
42struct wm8523_priv { 42struct wm8523_priv {
43 enum snd_soc_control_type control_type; 43 enum snd_soc_control_type control_type;
44 u16 reg_cache[WM8523_REGISTER_COUNT];
45 struct regulator_bulk_data supplies[WM8523_NUM_SUPPLIES]; 44 struct regulator_bulk_data supplies[WM8523_NUM_SUPPLIES];
46 unsigned int sysclk; 45 unsigned int sysclk;
47 unsigned int rate_constraint_list[WM8523_NUM_RATES]; 46 unsigned int rate_constraint_list[WM8523_NUM_RATES];
@@ -314,6 +313,7 @@ static int wm8523_set_bias_level(struct snd_soc_codec *codec,
314 enum snd_soc_bias_level level) 313 enum snd_soc_bias_level level)
315{ 314{
316 struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec); 315 struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec);
316 u16 *reg_cache = codec->reg_cache;
317 int ret, i; 317 int ret, i;
318 318
319 switch (level) { 319 switch (level) {
@@ -344,7 +344,7 @@ static int wm8523_set_bias_level(struct snd_soc_codec *codec,
344 /* Sync back default/cached values */ 344 /* Sync back default/cached values */
345 for (i = WM8523_AIF_CTRL1; 345 for (i = WM8523_AIF_CTRL1;
346 i < WM8523_MAX_REGISTER; i++) 346 i < WM8523_MAX_REGISTER; i++)
347 snd_soc_write(codec, i, wm8523->reg_cache[i]); 347 snd_soc_write(codec, i, reg_cache[i]);
348 348
349 349
350 msleep(100); 350 msleep(100);
@@ -414,6 +414,7 @@ static int wm8523_resume(struct snd_soc_codec *codec)
414static int wm8523_probe(struct snd_soc_codec *codec) 414static int wm8523_probe(struct snd_soc_codec *codec)
415{ 415{
416 struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec); 416 struct wm8523_priv *wm8523 = snd_soc_codec_get_drvdata(codec);
417 u16 *reg_cache = codec->reg_cache;
417 int ret, i; 418 int ret, i;
418 419
419 codec->hw_write = (hw_write_t)i2c_master_send; 420 codec->hw_write = (hw_write_t)i2c_master_send;
@@ -470,8 +471,8 @@ static int wm8523_probe(struct snd_soc_codec *codec)
470 } 471 }
471 472
472 /* Change some default settings - latch VU and enable ZC */ 473 /* Change some default settings - latch VU and enable ZC */
473 wm8523->reg_cache[WM8523_DAC_GAINR] |= WM8523_DACR_VU; 474 reg_cache[WM8523_DAC_GAINR] |= WM8523_DACR_VU;
474 wm8523->reg_cache[WM8523_DAC_CTRL3] |= WM8523_ZC; 475 reg_cache[WM8523_DAC_CTRL3] |= WM8523_ZC;
475 476
476 wm8523_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 477 wm8523_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
477 478
diff --git a/sound/soc/codecs/wm8741.c b/sound/soc/codecs/wm8741.c
index 90e31e9aa6f7..aea60ef8aba7 100644
--- a/sound/soc/codecs/wm8741.c
+++ b/sound/soc/codecs/wm8741.c
@@ -41,7 +41,6 @@ static const char *wm8741_supply_names[WM8741_NUM_SUPPLIES] = {
41/* codec private data */ 41/* codec private data */
42struct wm8741_priv { 42struct wm8741_priv {
43 enum snd_soc_control_type control_type; 43 enum snd_soc_control_type control_type;
44 u16 reg_cache[WM8741_REGISTER_COUNT];
45 struct regulator_bulk_data supplies[WM8741_NUM_SUPPLIES]; 44 struct regulator_bulk_data supplies[WM8741_NUM_SUPPLIES];
46 unsigned int sysclk; 45 unsigned int sysclk;
47 struct snd_pcm_hw_constraint_list *sysclk_constraints; 46 struct snd_pcm_hw_constraint_list *sysclk_constraints;
@@ -422,6 +421,7 @@ static int wm8741_resume(struct snd_soc_codec *codec)
422static int wm8741_probe(struct snd_soc_codec *codec) 421static int wm8741_probe(struct snd_soc_codec *codec)
423{ 422{
424 struct wm8741_priv *wm8741 = snd_soc_codec_get_drvdata(codec); 423 struct wm8741_priv *wm8741 = snd_soc_codec_get_drvdata(codec);
424 u16 *reg_cache = codec->reg_cache;
425 int ret = 0; 425 int ret = 0;
426 426
427 ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8741->control_type); 427 ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8741->control_type);
@@ -437,10 +437,10 @@ static int wm8741_probe(struct snd_soc_codec *codec)
437 } 437 }
438 438
439 /* Change some default settings - latch VU */ 439 /* Change some default settings - latch VU */
440 wm8741->reg_cache[WM8741_DACLLSB_ATTENUATION] |= WM8741_UPDATELL; 440 reg_cache[WM8741_DACLLSB_ATTENUATION] |= WM8741_UPDATELL;
441 wm8741->reg_cache[WM8741_DACLMSB_ATTENUATION] |= WM8741_UPDATELM; 441 reg_cache[WM8741_DACLMSB_ATTENUATION] |= WM8741_UPDATELM;
442 wm8741->reg_cache[WM8741_DACRLSB_ATTENUATION] |= WM8741_UPDATERL; 442 reg_cache[WM8741_DACRLSB_ATTENUATION] |= WM8741_UPDATERL;
443 wm8741->reg_cache[WM8741_DACRLSB_ATTENUATION] |= WM8741_UPDATERM; 443 reg_cache[WM8741_DACRLSB_ATTENUATION] |= WM8741_UPDATERM;
444 444
445 snd_soc_add_controls(codec, wm8741_snd_controls, 445 snd_soc_add_controls(codec, wm8741_snd_controls,
446 ARRAY_SIZE(wm8741_snd_controls)); 446 ARRAY_SIZE(wm8741_snd_controls));
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c
index 8f679a13f2bc..87caae59e939 100644
--- a/sound/soc/codecs/wm8753.c
+++ b/sound/soc/codecs/wm8753.c
@@ -65,22 +65,22 @@ static void wm8753_set_dai_mode(struct snd_soc_codec *codec,
65 * are using 2 wire for device control, so we cache them instead. 65 * are using 2 wire for device control, so we cache them instead.
66 */ 66 */
67static const u16 wm8753_reg[] = { 67static const u16 wm8753_reg[] = {
68 0x0008, 0x0000, 0x000a, 0x000a, 68 0x0000, 0x0008, 0x0000, 0x000a,
69 0x0033, 0x0000, 0x0007, 0x00ff, 69 0x000a, 0x0033, 0x0000, 0x0007,
70 0x00ff, 0x000f, 0x000f, 0x007b, 70 0x00ff, 0x00ff, 0x000f, 0x000f,
71 0x0000, 0x0032, 0x0000, 0x00c3, 71 0x007b, 0x0000, 0x0032, 0x0000,
72 0x00c3, 0x00c0, 0x0000, 0x0000, 72 0x00c3, 0x00c3, 0x00c0, 0x0000,
73 0x0000, 0x0000, 0x0000, 0x0000, 73 0x0000, 0x0000, 0x0000, 0x0000,
74 0x0000, 0x0000, 0x0000, 0x0000, 74 0x0000, 0x0000, 0x0000, 0x0000,
75 0x0000, 0x0000, 0x0000, 0x0055,
76 0x0005, 0x0050, 0x0055, 0x0050,
77 0x0055, 0x0050, 0x0055, 0x0079,
78 0x0079, 0x0079, 0x0079, 0x0079,
79 0x0000, 0x0000, 0x0000, 0x0000, 75 0x0000, 0x0000, 0x0000, 0x0000,
80 0x0097, 0x0097, 0x0000, 0x0004, 76 0x0055, 0x0005, 0x0050, 0x0055,
81 0x0000, 0x0083, 0x0024, 0x01ba, 77 0x0050, 0x0055, 0x0050, 0x0055,
82 0x0000, 0x0083, 0x0024, 0x01ba, 78 0x0079, 0x0079, 0x0079, 0x0079,
83 0x0000, 0x0000, 0x0000 79 0x0079, 0x0000, 0x0000, 0x0000,
80 0x0000, 0x0097, 0x0097, 0x0000,
81 0x0004, 0x0000, 0x0083, 0x0024,
82 0x01ba, 0x0000, 0x0083, 0x0024,
83 0x01ba, 0x0000, 0x0000, 0x0000
84}; 84};
85 85
86/* codec private data */ 86/* codec private data */
@@ -88,57 +88,10 @@ struct wm8753_priv {
88 enum snd_soc_control_type control_type; 88 enum snd_soc_control_type control_type;
89 unsigned int sysclk; 89 unsigned int sysclk;
90 unsigned int pcmclk; 90 unsigned int pcmclk;
91 u16 reg_cache[ARRAY_SIZE(wm8753_reg)];
92 int dai_func; 91 int dai_func;
93}; 92};
94 93
95/* 94#define wm8753_reset(c) snd_soc_write(c, WM8753_RESET, 0)
96 * read wm8753 register cache
97 */
98static inline unsigned int wm8753_read_reg_cache(struct snd_soc_codec *codec,
99 unsigned int reg)
100{
101 u16 *cache = codec->reg_cache;
102 if (reg < 1 || reg >= (ARRAY_SIZE(wm8753_reg) + 1))
103 return -1;
104 return cache[reg - 1];
105}
106
107/*
108 * write wm8753 register cache
109 */
110static inline void wm8753_write_reg_cache(struct snd_soc_codec *codec,
111 unsigned int reg, unsigned int value)
112{
113 u16 *cache = codec->reg_cache;
114 if (reg < 1 || reg >= (ARRAY_SIZE(wm8753_reg) + 1))
115 return;
116 cache[reg - 1] = value;
117}
118
119/*
120 * write to the WM8753 register space
121 */
122static int wm8753_write(struct snd_soc_codec *codec, unsigned int reg,
123 unsigned int value)
124{
125 u8 data[2];
126
127 /* data is
128 * D15..D9 WM8753 register offset
129 * D8...D0 register data
130 */
131 data[0] = (reg << 1) | ((value >> 8) & 0x0001);
132 data[1] = value & 0x00ff;
133
134 wm8753_write_reg_cache(codec, reg, value);
135 if (codec->hw_write(codec->control_data, data, 2) == 2)
136 return 0;
137 else
138 return -EIO;
139}
140
141#define wm8753_reset(c) wm8753_write(c, WM8753_RESET, 0)
142 95
143/* 96/*
144 * WM8753 Controls 97 * WM8753 Controls
@@ -218,7 +171,7 @@ static int wm8753_get_dai(struct snd_kcontrol *kcontrol,
218 struct snd_ctl_elem_value *ucontrol) 171 struct snd_ctl_elem_value *ucontrol)
219{ 172{
220 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 173 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
221 int mode = wm8753_read_reg_cache(codec, WM8753_IOCTL); 174 int mode = snd_soc_read(codec, WM8753_IOCTL);
222 175
223 ucontrol->value.integer.value[0] = (mode & 0xc) >> 2; 176 ucontrol->value.integer.value[0] = (mode & 0xc) >> 2;
224 return 0; 177 return 0;
@@ -228,7 +181,7 @@ static int wm8753_set_dai(struct snd_kcontrol *kcontrol,
228 struct snd_ctl_elem_value *ucontrol) 181 struct snd_ctl_elem_value *ucontrol)
229{ 182{
230 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 183 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
231 int mode = wm8753_read_reg_cache(codec, WM8753_IOCTL); 184 int mode = snd_soc_read(codec, WM8753_IOCTL);
232 struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); 185 struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec);
233 186
234 if (((mode & 0xc) >> 2) == ucontrol->value.integer.value[0]) 187 if (((mode & 0xc) >> 2) == ucontrol->value.integer.value[0])
@@ -738,17 +691,17 @@ static int wm8753_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
738 if (pll_id == WM8753_PLL1) { 691 if (pll_id == WM8753_PLL1) {
739 offset = 0; 692 offset = 0;
740 enable = 0x10; 693 enable = 0x10;
741 reg = wm8753_read_reg_cache(codec, WM8753_CLOCK) & 0xffef; 694 reg = snd_soc_read(codec, WM8753_CLOCK) & 0xffef;
742 } else { 695 } else {
743 offset = 4; 696 offset = 4;
744 enable = 0x8; 697 enable = 0x8;
745 reg = wm8753_read_reg_cache(codec, WM8753_CLOCK) & 0xfff7; 698 reg = snd_soc_read(codec, WM8753_CLOCK) & 0xfff7;
746 } 699 }
747 700
748 if (!freq_in || !freq_out) { 701 if (!freq_in || !freq_out) {
749 /* disable PLL */ 702 /* disable PLL */
750 wm8753_write(codec, WM8753_PLL1CTL1 + offset, 0x0026); 703 snd_soc_write(codec, WM8753_PLL1CTL1 + offset, 0x0026);
751 wm8753_write(codec, WM8753_CLOCK, reg); 704 snd_soc_write(codec, WM8753_CLOCK, reg);
752 return 0; 705 return 0;
753 } else { 706 } else {
754 u16 value = 0; 707 u16 value = 0;
@@ -759,20 +712,20 @@ static int wm8753_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
759 /* set up N and K PLL divisor ratios */ 712 /* set up N and K PLL divisor ratios */
760 /* bits 8:5 = PLL_N, bits 3:0 = PLL_K[21:18] */ 713 /* bits 8:5 = PLL_N, bits 3:0 = PLL_K[21:18] */
761 value = (pll_div.n << 5) + ((pll_div.k & 0x3c0000) >> 18); 714 value = (pll_div.n << 5) + ((pll_div.k & 0x3c0000) >> 18);
762 wm8753_write(codec, WM8753_PLL1CTL2 + offset, value); 715 snd_soc_write(codec, WM8753_PLL1CTL2 + offset, value);
763 716
764 /* bits 8:0 = PLL_K[17:9] */ 717 /* bits 8:0 = PLL_K[17:9] */
765 value = (pll_div.k & 0x03fe00) >> 9; 718 value = (pll_div.k & 0x03fe00) >> 9;
766 wm8753_write(codec, WM8753_PLL1CTL3 + offset, value); 719 snd_soc_write(codec, WM8753_PLL1CTL3 + offset, value);
767 720
768 /* bits 8:0 = PLL_K[8:0] */ 721 /* bits 8:0 = PLL_K[8:0] */
769 value = pll_div.k & 0x0001ff; 722 value = pll_div.k & 0x0001ff;
770 wm8753_write(codec, WM8753_PLL1CTL4 + offset, value); 723 snd_soc_write(codec, WM8753_PLL1CTL4 + offset, value);
771 724
772 /* set PLL as input and enable */ 725 /* set PLL as input and enable */
773 wm8753_write(codec, WM8753_PLL1CTL1 + offset, 0x0027 | 726 snd_soc_write(codec, WM8753_PLL1CTL1 + offset, 0x0027 |
774 (pll_div.div2 << 3)); 727 (pll_div.div2 << 3));
775 wm8753_write(codec, WM8753_CLOCK, reg | enable); 728 snd_soc_write(codec, WM8753_CLOCK, reg | enable);
776 } 729 }
777 return 0; 730 return 0;
778} 731}
@@ -879,7 +832,7 @@ static int wm8753_vdac_adc_set_dai_fmt(struct snd_soc_dai *codec_dai,
879 unsigned int fmt) 832 unsigned int fmt)
880{ 833{
881 struct snd_soc_codec *codec = codec_dai->codec; 834 struct snd_soc_codec *codec = codec_dai->codec;
882 u16 voice = wm8753_read_reg_cache(codec, WM8753_PCM) & 0x01ec; 835 u16 voice = snd_soc_read(codec, WM8753_PCM) & 0x01ec;
883 836
884 /* interface format */ 837 /* interface format */
885 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { 838 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
@@ -901,7 +854,7 @@ static int wm8753_vdac_adc_set_dai_fmt(struct snd_soc_dai *codec_dai,
901 return -EINVAL; 854 return -EINVAL;
902 } 855 }
903 856
904 wm8753_write(codec, WM8753_PCM, voice); 857 snd_soc_write(codec, WM8753_PCM, voice);
905 return 0; 858 return 0;
906} 859}
907 860
@@ -922,8 +875,8 @@ static int wm8753_pcm_hw_params(struct snd_pcm_substream *substream,
922 struct snd_soc_pcm_runtime *rtd = substream->private_data; 875 struct snd_soc_pcm_runtime *rtd = substream->private_data;
923 struct snd_soc_codec *codec = rtd->codec; 876 struct snd_soc_codec *codec = rtd->codec;
924 struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); 877 struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec);
925 u16 voice = wm8753_read_reg_cache(codec, WM8753_PCM) & 0x01f3; 878 u16 voice = snd_soc_read(codec, WM8753_PCM) & 0x01f3;
926 u16 srate = wm8753_read_reg_cache(codec, WM8753_SRATE1) & 0x017f; 879 u16 srate = snd_soc_read(codec, WM8753_SRATE1) & 0x017f;
927 880
928 /* bit size */ 881 /* bit size */
929 switch (params_format(params)) { 882 switch (params_format(params)) {
@@ -943,9 +896,9 @@ static int wm8753_pcm_hw_params(struct snd_pcm_substream *substream,
943 /* sample rate */ 896 /* sample rate */
944 if (params_rate(params) * 384 == wm8753->pcmclk) 897 if (params_rate(params) * 384 == wm8753->pcmclk)
945 srate |= 0x80; 898 srate |= 0x80;
946 wm8753_write(codec, WM8753_SRATE1, srate); 899 snd_soc_write(codec, WM8753_SRATE1, srate);
947 900
948 wm8753_write(codec, WM8753_PCM, voice); 901 snd_soc_write(codec, WM8753_PCM, voice);
949 return 0; 902 return 0;
950} 903}
951 904
@@ -958,8 +911,8 @@ static int wm8753_pcm_set_dai_fmt(struct snd_soc_dai *codec_dai,
958 struct snd_soc_codec *codec = codec_dai->codec; 911 struct snd_soc_codec *codec = codec_dai->codec;
959 u16 voice, ioctl; 912 u16 voice, ioctl;
960 913
961 voice = wm8753_read_reg_cache(codec, WM8753_PCM) & 0x011f; 914 voice = snd_soc_read(codec, WM8753_PCM) & 0x011f;
962 ioctl = wm8753_read_reg_cache(codec, WM8753_IOCTL) & 0x015d; 915 ioctl = snd_soc_read(codec, WM8753_IOCTL) & 0x015d;
963 916
964 /* set master/slave audio interface */ 917 /* set master/slave audio interface */
965 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { 918 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
@@ -1013,8 +966,8 @@ static int wm8753_pcm_set_dai_fmt(struct snd_soc_dai *codec_dai,
1013 return -EINVAL; 966 return -EINVAL;
1014 } 967 }
1015 968
1016 wm8753_write(codec, WM8753_PCM, voice); 969 snd_soc_write(codec, WM8753_PCM, voice);
1017 wm8753_write(codec, WM8753_IOCTL, ioctl); 970 snd_soc_write(codec, WM8753_IOCTL, ioctl);
1018 return 0; 971 return 0;
1019} 972}
1020 973
@@ -1026,16 +979,16 @@ static int wm8753_set_dai_clkdiv(struct snd_soc_dai *codec_dai,
1026 979
1027 switch (div_id) { 980 switch (div_id) {
1028 case WM8753_PCMDIV: 981 case WM8753_PCMDIV:
1029 reg = wm8753_read_reg_cache(codec, WM8753_CLOCK) & 0x003f; 982 reg = snd_soc_read(codec, WM8753_CLOCK) & 0x003f;
1030 wm8753_write(codec, WM8753_CLOCK, reg | div); 983 snd_soc_write(codec, WM8753_CLOCK, reg | div);
1031 break; 984 break;
1032 case WM8753_BCLKDIV: 985 case WM8753_BCLKDIV:
1033 reg = wm8753_read_reg_cache(codec, WM8753_SRATE2) & 0x01c7; 986 reg = snd_soc_read(codec, WM8753_SRATE2) & 0x01c7;
1034 wm8753_write(codec, WM8753_SRATE2, reg | div); 987 snd_soc_write(codec, WM8753_SRATE2, reg | div);
1035 break; 988 break;
1036 case WM8753_VXCLKDIV: 989 case WM8753_VXCLKDIV:
1037 reg = wm8753_read_reg_cache(codec, WM8753_SRATE2) & 0x003f; 990 reg = snd_soc_read(codec, WM8753_SRATE2) & 0x003f;
1038 wm8753_write(codec, WM8753_SRATE2, reg | div); 991 snd_soc_write(codec, WM8753_SRATE2, reg | div);
1039 break; 992 break;
1040 default: 993 default:
1041 return -EINVAL; 994 return -EINVAL;
@@ -1050,7 +1003,7 @@ static int wm8753_hdac_set_dai_fmt(struct snd_soc_dai *codec_dai,
1050 unsigned int fmt) 1003 unsigned int fmt)
1051{ 1004{
1052 struct snd_soc_codec *codec = codec_dai->codec; 1005 struct snd_soc_codec *codec = codec_dai->codec;
1053 u16 hifi = wm8753_read_reg_cache(codec, WM8753_HIFI) & 0x01e0; 1006 u16 hifi = snd_soc_read(codec, WM8753_HIFI) & 0x01e0;
1054 1007
1055 /* interface format */ 1008 /* interface format */
1056 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { 1009 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
@@ -1072,7 +1025,7 @@ static int wm8753_hdac_set_dai_fmt(struct snd_soc_dai *codec_dai,
1072 return -EINVAL; 1025 return -EINVAL;
1073 } 1026 }
1074 1027
1075 wm8753_write(codec, WM8753_HIFI, hifi); 1028 snd_soc_write(codec, WM8753_HIFI, hifi);
1076 return 0; 1029 return 0;
1077} 1030}
1078 1031
@@ -1085,8 +1038,8 @@ static int wm8753_i2s_set_dai_fmt(struct snd_soc_dai *codec_dai,
1085 struct snd_soc_codec *codec = codec_dai->codec; 1038 struct snd_soc_codec *codec = codec_dai->codec;
1086 u16 ioctl, hifi; 1039 u16 ioctl, hifi;
1087 1040
1088 hifi = wm8753_read_reg_cache(codec, WM8753_HIFI) & 0x011f; 1041 hifi = snd_soc_read(codec, WM8753_HIFI) & 0x011f;
1089 ioctl = wm8753_read_reg_cache(codec, WM8753_IOCTL) & 0x00ae; 1042 ioctl = snd_soc_read(codec, WM8753_IOCTL) & 0x00ae;
1090 1043
1091 /* set master/slave audio interface */ 1044 /* set master/slave audio interface */
1092 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { 1045 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
@@ -1140,8 +1093,8 @@ static int wm8753_i2s_set_dai_fmt(struct snd_soc_dai *codec_dai,
1140 return -EINVAL; 1093 return -EINVAL;
1141 } 1094 }
1142 1095
1143 wm8753_write(codec, WM8753_HIFI, hifi); 1096 snd_soc_write(codec, WM8753_HIFI, hifi);
1144 wm8753_write(codec, WM8753_IOCTL, ioctl); 1097 snd_soc_write(codec, WM8753_IOCTL, ioctl);
1145 return 0; 1098 return 0;
1146} 1099}
1147 1100
@@ -1162,8 +1115,8 @@ static int wm8753_i2s_hw_params(struct snd_pcm_substream *substream,
1162 struct snd_soc_pcm_runtime *rtd = substream->private_data; 1115 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1163 struct snd_soc_codec *codec = rtd->codec; 1116 struct snd_soc_codec *codec = rtd->codec;
1164 struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); 1117 struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec);
1165 u16 srate = wm8753_read_reg_cache(codec, WM8753_SRATE1) & 0x01c0; 1118 u16 srate = snd_soc_read(codec, WM8753_SRATE1) & 0x01c0;
1166 u16 hifi = wm8753_read_reg_cache(codec, WM8753_HIFI) & 0x01f3; 1119 u16 hifi = snd_soc_read(codec, WM8753_HIFI) & 0x01f3;
1167 int coeff; 1120 int coeff;
1168 1121
1169 /* is digital filter coefficient valid ? */ 1122 /* is digital filter coefficient valid ? */
@@ -1172,7 +1125,7 @@ static int wm8753_i2s_hw_params(struct snd_pcm_substream *substream,
1172 printk(KERN_ERR "wm8753 invalid MCLK or rate\n"); 1125 printk(KERN_ERR "wm8753 invalid MCLK or rate\n");
1173 return coeff; 1126 return coeff;
1174 } 1127 }
1175 wm8753_write(codec, WM8753_SRATE1, srate | (coeff_div[coeff].sr << 1) | 1128 snd_soc_write(codec, WM8753_SRATE1, srate | (coeff_div[coeff].sr << 1) |
1176 coeff_div[coeff].usb); 1129 coeff_div[coeff].usb);
1177 1130
1178 /* bit size */ 1131 /* bit size */
@@ -1190,7 +1143,7 @@ static int wm8753_i2s_hw_params(struct snd_pcm_substream *substream,
1190 break; 1143 break;
1191 } 1144 }
1192 1145
1193 wm8753_write(codec, WM8753_HIFI, hifi); 1146 snd_soc_write(codec, WM8753_HIFI, hifi);
1194 return 0; 1147 return 0;
1195} 1148}
1196 1149
@@ -1201,8 +1154,8 @@ static int wm8753_mode1v_set_dai_fmt(struct snd_soc_dai *codec_dai,
1201 u16 clock; 1154 u16 clock;
1202 1155
1203 /* set clk source as pcmclk */ 1156 /* set clk source as pcmclk */
1204 clock = wm8753_read_reg_cache(codec, WM8753_CLOCK) & 0xfffb; 1157 clock = snd_soc_read(codec, WM8753_CLOCK) & 0xfffb;
1205 wm8753_write(codec, WM8753_CLOCK, clock); 1158 snd_soc_write(codec, WM8753_CLOCK, clock);
1206 1159
1207 if (wm8753_vdac_adc_set_dai_fmt(codec_dai, fmt) < 0) 1160 if (wm8753_vdac_adc_set_dai_fmt(codec_dai, fmt) < 0)
1208 return -EINVAL; 1161 return -EINVAL;
@@ -1224,8 +1177,8 @@ static int wm8753_mode2_set_dai_fmt(struct snd_soc_dai *codec_dai,
1224 u16 clock; 1177 u16 clock;
1225 1178
1226 /* set clk source as pcmclk */ 1179 /* set clk source as pcmclk */
1227 clock = wm8753_read_reg_cache(codec, WM8753_CLOCK) & 0xfffb; 1180 clock = snd_soc_read(codec, WM8753_CLOCK) & 0xfffb;
1228 wm8753_write(codec, WM8753_CLOCK, clock); 1181 snd_soc_write(codec, WM8753_CLOCK, clock);
1229 1182
1230 if (wm8753_vdac_adc_set_dai_fmt(codec_dai, fmt) < 0) 1183 if (wm8753_vdac_adc_set_dai_fmt(codec_dai, fmt) < 0)
1231 return -EINVAL; 1184 return -EINVAL;
@@ -1239,8 +1192,8 @@ static int wm8753_mode3_4_set_dai_fmt(struct snd_soc_dai *codec_dai,
1239 u16 clock; 1192 u16 clock;
1240 1193
1241 /* set clk source as mclk */ 1194 /* set clk source as mclk */
1242 clock = wm8753_read_reg_cache(codec, WM8753_CLOCK) & 0xfffb; 1195 clock = snd_soc_read(codec, WM8753_CLOCK) & 0xfffb;
1243 wm8753_write(codec, WM8753_CLOCK, clock | 0x4); 1196 snd_soc_write(codec, WM8753_CLOCK, clock | 0x4);
1244 1197
1245 if (wm8753_hdac_set_dai_fmt(codec_dai, fmt) < 0) 1198 if (wm8753_hdac_set_dai_fmt(codec_dai, fmt) < 0)
1246 return -EINVAL; 1199 return -EINVAL;
@@ -1252,19 +1205,19 @@ static int wm8753_mode3_4_set_dai_fmt(struct snd_soc_dai *codec_dai,
1252static int wm8753_mute(struct snd_soc_dai *dai, int mute) 1205static int wm8753_mute(struct snd_soc_dai *dai, int mute)
1253{ 1206{
1254 struct snd_soc_codec *codec = dai->codec; 1207 struct snd_soc_codec *codec = dai->codec;
1255 u16 mute_reg = wm8753_read_reg_cache(codec, WM8753_DAC) & 0xfff7; 1208 u16 mute_reg = snd_soc_read(codec, WM8753_DAC) & 0xfff7;
1256 struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); 1209 struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec);
1257 1210
1258 /* the digital mute covers the HiFi and Voice DAC's on the WM8753. 1211 /* the digital mute covers the HiFi and Voice DAC's on the WM8753.
1259 * make sure we check if they are not both active when we mute */ 1212 * make sure we check if they are not both active when we mute */
1260 if (mute && wm8753->dai_func == 1) { 1213 if (mute && wm8753->dai_func == 1) {
1261 if (!codec->active) 1214 if (!codec->active)
1262 wm8753_write(codec, WM8753_DAC, mute_reg | 0x8); 1215 snd_soc_write(codec, WM8753_DAC, mute_reg | 0x8);
1263 } else { 1216 } else {
1264 if (mute) 1217 if (mute)
1265 wm8753_write(codec, WM8753_DAC, mute_reg | 0x8); 1218 snd_soc_write(codec, WM8753_DAC, mute_reg | 0x8);
1266 else 1219 else
1267 wm8753_write(codec, WM8753_DAC, mute_reg); 1220 snd_soc_write(codec, WM8753_DAC, mute_reg);
1268 } 1221 }
1269 1222
1270 return 0; 1223 return 0;
@@ -1273,23 +1226,23 @@ static int wm8753_mute(struct snd_soc_dai *dai, int mute)
1273static int wm8753_set_bias_level(struct snd_soc_codec *codec, 1226static int wm8753_set_bias_level(struct snd_soc_codec *codec,
1274 enum snd_soc_bias_level level) 1227 enum snd_soc_bias_level level)
1275{ 1228{
1276 u16 pwr_reg = wm8753_read_reg_cache(codec, WM8753_PWR1) & 0xfe3e; 1229 u16 pwr_reg = snd_soc_read(codec, WM8753_PWR1) & 0xfe3e;
1277 1230
1278 switch (level) { 1231 switch (level) {
1279 case SND_SOC_BIAS_ON: 1232 case SND_SOC_BIAS_ON:
1280 /* set vmid to 50k and unmute dac */ 1233 /* set vmid to 50k and unmute dac */
1281 wm8753_write(codec, WM8753_PWR1, pwr_reg | 0x00c0); 1234 snd_soc_write(codec, WM8753_PWR1, pwr_reg | 0x00c0);
1282 break; 1235 break;
1283 case SND_SOC_BIAS_PREPARE: 1236 case SND_SOC_BIAS_PREPARE:
1284 /* set vmid to 5k for quick power up */ 1237 /* set vmid to 5k for quick power up */
1285 wm8753_write(codec, WM8753_PWR1, pwr_reg | 0x01c1); 1238 snd_soc_write(codec, WM8753_PWR1, pwr_reg | 0x01c1);
1286 break; 1239 break;
1287 case SND_SOC_BIAS_STANDBY: 1240 case SND_SOC_BIAS_STANDBY:
1288 /* mute dac and set vmid to 500k, enable VREF */ 1241 /* mute dac and set vmid to 500k, enable VREF */
1289 wm8753_write(codec, WM8753_PWR1, pwr_reg | 0x0141); 1242 snd_soc_write(codec, WM8753_PWR1, pwr_reg | 0x0141);
1290 break; 1243 break;
1291 case SND_SOC_BIAS_OFF: 1244 case SND_SOC_BIAS_OFF:
1292 wm8753_write(codec, WM8753_PWR1, 0x0001); 1245 snd_soc_write(codec, WM8753_PWR1, 0x0001);
1293 break; 1246 break;
1294 } 1247 }
1295 codec->bias_level = level; 1248 codec->bias_level = level;
@@ -1477,7 +1430,7 @@ static void wm8753_set_dai_mode(struct snd_soc_codec *codec,
1477 else 1430 else
1478 dai->driver = &wm8753_all_dai[(wm8753->dai_func << 1) + 1]; 1431 dai->driver = &wm8753_all_dai[(wm8753->dai_func << 1) + 1];
1479 } 1432 }
1480 wm8753_write(codec, WM8753_IOCTL, wm8753->dai_func); 1433 snd_soc_write(codec, WM8753_IOCTL, wm8753->dai_func);
1481} 1434}
1482 1435
1483static void wm8753_work(struct work_struct *work) 1436static void wm8753_work(struct work_struct *work)
@@ -1495,22 +1448,19 @@ static int wm8753_suspend(struct snd_soc_codec *codec, pm_message_t state)
1495 1448
1496static int wm8753_resume(struct snd_soc_codec *codec) 1449static int wm8753_resume(struct snd_soc_codec *codec)
1497{ 1450{
1451 u16 *reg_cache = codec->reg_cache;
1498 int i; 1452 int i;
1499 u8 data[2];
1500 u16 *cache = codec->reg_cache;
1501 1453
1502 /* Sync reg_cache with the hardware */ 1454 /* Sync reg_cache with the hardware */
1503 for (i = 0; i < ARRAY_SIZE(wm8753_reg); i++) { 1455 for (i = 1; i < ARRAY_SIZE(wm8753_reg); i++) {
1504 if (i + 1 == WM8753_RESET) 1456 if (i == WM8753_RESET)
1505 continue; 1457 continue;
1506 1458
1507 /* No point in writing hardware default values back */ 1459 /* No point in writing hardware default values back */
1508 if (cache[i] == wm8753_reg[i]) 1460 if (reg_cache[i] == wm8753_reg[i])
1509 continue; 1461 continue;
1510 1462
1511 data[0] = ((i + 1) << 1) | ((cache[i] >> 8) & 0x0001); 1463 snd_soc_write(codec, i, reg_cache[i]);
1512 data[1] = cache[i] & 0x00ff;
1513 codec->hw_write(codec->control_data, data, 2);
1514 } 1464 }
1515 1465
1516 wm8753_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 1466 wm8753_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
@@ -1548,7 +1498,7 @@ static int run_delayed_work(struct delayed_work *dwork)
1548static int wm8753_probe(struct snd_soc_codec *codec) 1498static int wm8753_probe(struct snd_soc_codec *codec)
1549{ 1499{
1550 struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec); 1500 struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec);
1551 int ret = 0, reg; 1501 int ret;
1552 1502
1553 INIT_DELAYED_WORK(&codec->delayed_work, wm8753_work); 1503 INIT_DELAYED_WORK(&codec->delayed_work, wm8753_work);
1554 1504
@@ -1573,26 +1523,16 @@ static int wm8753_probe(struct snd_soc_codec *codec)
1573 msecs_to_jiffies(caps_charge)); 1523 msecs_to_jiffies(caps_charge));
1574 1524
1575 /* set the update bits */ 1525 /* set the update bits */
1576 reg = wm8753_read_reg_cache(codec, WM8753_LDAC); 1526 snd_soc_update_bits(codec, WM8753_LDAC, 0x0100, 0x0100);
1577 wm8753_write(codec, WM8753_LDAC, reg | 0x0100); 1527 snd_soc_update_bits(codec, WM8753_RDAC, 0x0100, 0x0100);
1578 reg = wm8753_read_reg_cache(codec, WM8753_RDAC); 1528 snd_soc_update_bits(codec, WM8753_LDAC, 0x0100, 0x0100);
1579 wm8753_write(codec, WM8753_RDAC, reg | 0x0100); 1529 snd_soc_update_bits(codec, WM8753_RDAC, 0x0100, 0x0100);
1580 reg = wm8753_read_reg_cache(codec, WM8753_LADC); 1530 snd_soc_update_bits(codec, WM8753_LOUT1V, 0x0100, 0x0100);
1581 wm8753_write(codec, WM8753_LADC, reg | 0x0100); 1531 snd_soc_update_bits(codec, WM8753_ROUT1V, 0x0100, 0x0100);
1582 reg = wm8753_read_reg_cache(codec, WM8753_RADC); 1532 snd_soc_update_bits(codec, WM8753_LOUT2V, 0x0100, 0x0100);
1583 wm8753_write(codec, WM8753_RADC, reg | 0x0100); 1533 snd_soc_update_bits(codec, WM8753_ROUT2V, 0x0100, 0x0100);
1584 reg = wm8753_read_reg_cache(codec, WM8753_LOUT1V); 1534 snd_soc_update_bits(codec, WM8753_LINVOL, 0x0100, 0x0100);
1585 wm8753_write(codec, WM8753_LOUT1V, reg | 0x0100); 1535 snd_soc_update_bits(codec, WM8753_RINVOL, 0x0100, 0x0100);
1586 reg = wm8753_read_reg_cache(codec, WM8753_ROUT1V);
1587 wm8753_write(codec, WM8753_ROUT1V, reg | 0x0100);
1588 reg = wm8753_read_reg_cache(codec, WM8753_LOUT2V);
1589 wm8753_write(codec, WM8753_LOUT2V, reg | 0x0100);
1590 reg = wm8753_read_reg_cache(codec, WM8753_ROUT2V);
1591 wm8753_write(codec, WM8753_ROUT2V, reg | 0x0100);
1592 reg = wm8753_read_reg_cache(codec, WM8753_LINVOL);
1593 wm8753_write(codec, WM8753_LINVOL, reg | 0x0100);
1594 reg = wm8753_read_reg_cache(codec, WM8753_RINVOL);
1595 wm8753_write(codec, WM8753_RINVOL, reg | 0x0100);
1596 1536
1597 snd_soc_add_controls(codec, wm8753_snd_controls, 1537 snd_soc_add_controls(codec, wm8753_snd_controls,
1598 ARRAY_SIZE(wm8753_snd_controls)); 1538 ARRAY_SIZE(wm8753_snd_controls));
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c
index 9001cc48ba13..1ec12eff0620 100644
--- a/sound/soc/codecs/wm8904.c
+++ b/sound/soc/codecs/wm8904.c
@@ -50,8 +50,6 @@ static const char *wm8904_supply_names[WM8904_NUM_SUPPLIES] = {
50/* codec private data */ 50/* codec private data */
51struct wm8904_priv { 51struct wm8904_priv {
52 52
53 u16 reg_cache[WM8904_MAX_REGISTER + 1];
54
55 enum wm8904_type devtype; 53 enum wm8904_type devtype;
56 void *control_data; 54 void *control_data;
57 55
@@ -2094,7 +2092,7 @@ static int wm8904_digital_mute(struct snd_soc_dai *codec_dai, int mute)
2094 2092
2095static void wm8904_sync_cache(struct snd_soc_codec *codec) 2093static void wm8904_sync_cache(struct snd_soc_codec *codec)
2096{ 2094{
2097 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); 2095 u16 *reg_cache = codec->reg_cache;
2098 int i; 2096 int i;
2099 2097
2100 if (!codec->cache_sync) 2098 if (!codec->cache_sync)
@@ -2105,14 +2103,14 @@ static void wm8904_sync_cache(struct snd_soc_codec *codec)
2105 /* Sync back cached values if they're different from the 2103 /* Sync back cached values if they're different from the
2106 * hardware default. 2104 * hardware default.
2107 */ 2105 */
2108 for (i = 1; i < ARRAY_SIZE(wm8904->reg_cache); i++) { 2106 for (i = 1; i < codec->driver->reg_cache_size; i++) {
2109 if (!wm8904_access[i].writable) 2107 if (!wm8904_access[i].writable)
2110 continue; 2108 continue;
2111 2109
2112 if (wm8904->reg_cache[i] == wm8904_reg[i]) 2110 if (reg_cache[i] == wm8904_reg[i])
2113 continue; 2111 continue;
2114 2112
2115 snd_soc_write(codec, i, wm8904->reg_cache[i]); 2113 snd_soc_write(codec, i, reg_cache[i]);
2116 } 2114 }
2117 2115
2118 codec->cache_sync = 0; 2116 codec->cache_sync = 0;
@@ -2371,6 +2369,7 @@ static int wm8904_probe(struct snd_soc_codec *codec)
2371{ 2369{
2372 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); 2370 struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
2373 struct wm8904_pdata *pdata = wm8904->pdata; 2371 struct wm8904_pdata *pdata = wm8904->pdata;
2372 u16 *reg_cache = codec->reg_cache;
2374 int ret, i; 2373 int ret, i;
2375 2374
2376 codec->cache_sync = 1; 2375 codec->cache_sync = 1;
@@ -2437,19 +2436,19 @@ static int wm8904_probe(struct snd_soc_codec *codec)
2437 } 2436 }
2438 2437
2439 /* Change some default settings - latch VU and enable ZC */ 2438 /* Change some default settings - latch VU and enable ZC */
2440 wm8904->reg_cache[WM8904_ADC_DIGITAL_VOLUME_LEFT] |= WM8904_ADC_VU; 2439 reg_cache[WM8904_ADC_DIGITAL_VOLUME_LEFT] |= WM8904_ADC_VU;
2441 wm8904->reg_cache[WM8904_ADC_DIGITAL_VOLUME_RIGHT] |= WM8904_ADC_VU; 2440 reg_cache[WM8904_ADC_DIGITAL_VOLUME_RIGHT] |= WM8904_ADC_VU;
2442 wm8904->reg_cache[WM8904_DAC_DIGITAL_VOLUME_LEFT] |= WM8904_DAC_VU; 2441 reg_cache[WM8904_DAC_DIGITAL_VOLUME_LEFT] |= WM8904_DAC_VU;
2443 wm8904->reg_cache[WM8904_DAC_DIGITAL_VOLUME_RIGHT] |= WM8904_DAC_VU; 2442 reg_cache[WM8904_DAC_DIGITAL_VOLUME_RIGHT] |= WM8904_DAC_VU;
2444 wm8904->reg_cache[WM8904_ANALOGUE_OUT1_LEFT] |= WM8904_HPOUT_VU | 2443 reg_cache[WM8904_ANALOGUE_OUT1_LEFT] |= WM8904_HPOUT_VU |
2445 WM8904_HPOUTLZC; 2444 WM8904_HPOUTLZC;
2446 wm8904->reg_cache[WM8904_ANALOGUE_OUT1_RIGHT] |= WM8904_HPOUT_VU | 2445 reg_cache[WM8904_ANALOGUE_OUT1_RIGHT] |= WM8904_HPOUT_VU |
2447 WM8904_HPOUTRZC; 2446 WM8904_HPOUTRZC;
2448 wm8904->reg_cache[WM8904_ANALOGUE_OUT2_LEFT] |= WM8904_LINEOUT_VU | 2447 reg_cache[WM8904_ANALOGUE_OUT2_LEFT] |= WM8904_LINEOUT_VU |
2449 WM8904_LINEOUTLZC; 2448 WM8904_LINEOUTLZC;
2450 wm8904->reg_cache[WM8904_ANALOGUE_OUT2_RIGHT] |= WM8904_LINEOUT_VU | 2449 reg_cache[WM8904_ANALOGUE_OUT2_RIGHT] |= WM8904_LINEOUT_VU |
2451 WM8904_LINEOUTRZC; 2450 WM8904_LINEOUTRZC;
2452 wm8904->reg_cache[WM8904_CLOCK_RATES_0] &= ~WM8904_SR_MODE; 2451 reg_cache[WM8904_CLOCK_RATES_0] &= ~WM8904_SR_MODE;
2453 2452
2454 /* Apply configuration from the platform data. */ 2453 /* Apply configuration from the platform data. */
2455 if (wm8904->pdata) { 2454 if (wm8904->pdata) {
@@ -2457,23 +2456,23 @@ static int wm8904_probe(struct snd_soc_codec *codec)
2457 if (!pdata->gpio_cfg[i]) 2456 if (!pdata->gpio_cfg[i])
2458 continue; 2457 continue;
2459 2458
2460 wm8904->reg_cache[WM8904_GPIO_CONTROL_1 + i] 2459 reg_cache[WM8904_GPIO_CONTROL_1 + i]
2461 = pdata->gpio_cfg[i] & 0xffff; 2460 = pdata->gpio_cfg[i] & 0xffff;
2462 } 2461 }
2463 2462
2464 /* Zero is the default value for these anyway */ 2463 /* Zero is the default value for these anyway */
2465 for (i = 0; i < WM8904_MIC_REGS; i++) 2464 for (i = 0; i < WM8904_MIC_REGS; i++)
2466 wm8904->reg_cache[WM8904_MIC_BIAS_CONTROL_0 + i] 2465 reg_cache[WM8904_MIC_BIAS_CONTROL_0 + i]
2467 = pdata->mic_cfg[i]; 2466 = pdata->mic_cfg[i];
2468 } 2467 }
2469 2468
2470 /* Set Class W by default - this will be managed by the Class 2469 /* Set Class W by default - this will be managed by the Class
2471 * G widget at runtime where bypass paths are available. 2470 * G widget at runtime where bypass paths are available.
2472 */ 2471 */
2473 wm8904->reg_cache[WM8904_CLASS_W_0] |= WM8904_CP_DYN_PWR; 2472 reg_cache[WM8904_CLASS_W_0] |= WM8904_CP_DYN_PWR;
2474 2473
2475 /* Use normal bias source */ 2474 /* Use normal bias source */
2476 wm8904->reg_cache[WM8904_BIAS_CONTROL_0] &= ~WM8904_POBCTRL; 2475 reg_cache[WM8904_BIAS_CONTROL_0] &= ~WM8904_POBCTRL;
2477 2476
2478 wm8904_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 2477 wm8904_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
2479 2478
diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c
index 2cb16f895c46..23086e2c976a 100644
--- a/sound/soc/codecs/wm8940.c
+++ b/sound/soc/codecs/wm8940.c
@@ -768,6 +768,7 @@ static __devinit int wm8940_i2c_probe(struct i2c_client *i2c,
768 768
769 i2c_set_clientdata(i2c, wm8940); 769 i2c_set_clientdata(i2c, wm8940);
770 wm8940->control_data = i2c; 770 wm8940->control_data = i2c;
771 wm8940->control_type = SND_SOC_I2C;
771 772
772 ret = snd_soc_register_codec(&i2c->dev, 773 ret = snd_soc_register_codec(&i2c->dev,
773 &soc_codec_dev_wm8940, &wm8940_dai, 1); 774 &soc_codec_dev_wm8940, &wm8940_dai, 1);
diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c
index 9cbab8e1de01..2ac35b0be86a 100644
--- a/sound/soc/codecs/wm8955.c
+++ b/sound/soc/codecs/wm8955.c
@@ -42,8 +42,6 @@ static const char *wm8955_supply_names[WM8955_NUM_SUPPLIES] = {
42struct wm8955_priv { 42struct wm8955_priv {
43 enum snd_soc_control_type control_type; 43 enum snd_soc_control_type control_type;
44 44
45 u16 reg_cache[WM8955_MAX_REGISTER + 1];
46
47 unsigned int mclk_rate; 45 unsigned int mclk_rate;
48 46
49 int deemph; 47 int deemph;
@@ -768,6 +766,7 @@ static int wm8955_set_bias_level(struct snd_soc_codec *codec,
768 enum snd_soc_bias_level level) 766 enum snd_soc_bias_level level)
769{ 767{
770 struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); 768 struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec);
769 u16 *reg_cache = codec->reg_cache;
771 int ret, i; 770 int ret, i;
772 771
773 switch (level) { 772 switch (level) {
@@ -800,14 +799,14 @@ static int wm8955_set_bias_level(struct snd_soc_codec *codec,
800 /* Sync back cached values if they're 799 /* Sync back cached values if they're
801 * different from the hardware default. 800 * different from the hardware default.
802 */ 801 */
803 for (i = 0; i < ARRAY_SIZE(wm8955->reg_cache); i++) { 802 for (i = 0; i < codec->driver->reg_cache_size; i++) {
804 if (i == WM8955_RESET) 803 if (i == WM8955_RESET)
805 continue; 804 continue;
806 805
807 if (wm8955->reg_cache[i] == wm8955_reg[i]) 806 if (reg_cache[i] == wm8955_reg[i])
808 continue; 807 continue;
809 808
810 snd_soc_write(codec, i, wm8955->reg_cache[i]); 809 snd_soc_write(codec, i, reg_cache[i]);
811 } 810 }
812 811
813 /* Enable VREF and VMID */ 812 /* Enable VREF and VMID */
@@ -902,6 +901,7 @@ static int wm8955_probe(struct snd_soc_codec *codec)
902{ 901{
903 struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec); 902 struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec);
904 struct wm8955_pdata *pdata = dev_get_platdata(codec->dev); 903 struct wm8955_pdata *pdata = dev_get_platdata(codec->dev);
904 u16 *reg_cache = codec->reg_cache;
905 int ret, i; 905 int ret, i;
906 906
907 ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8955->control_type); 907 ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8955->control_type);
@@ -934,25 +934,25 @@ static int wm8955_probe(struct snd_soc_codec *codec)
934 } 934 }
935 935
936 /* Change some default settings - latch VU and enable ZC */ 936 /* Change some default settings - latch VU and enable ZC */
937 wm8955->reg_cache[WM8955_LEFT_DAC_VOLUME] |= WM8955_LDVU; 937 reg_cache[WM8955_LEFT_DAC_VOLUME] |= WM8955_LDVU;
938 wm8955->reg_cache[WM8955_RIGHT_DAC_VOLUME] |= WM8955_RDVU; 938 reg_cache[WM8955_RIGHT_DAC_VOLUME] |= WM8955_RDVU;
939 wm8955->reg_cache[WM8955_LOUT1_VOLUME] |= WM8955_LO1VU | WM8955_LO1ZC; 939 reg_cache[WM8955_LOUT1_VOLUME] |= WM8955_LO1VU | WM8955_LO1ZC;
940 wm8955->reg_cache[WM8955_ROUT1_VOLUME] |= WM8955_RO1VU | WM8955_RO1ZC; 940 reg_cache[WM8955_ROUT1_VOLUME] |= WM8955_RO1VU | WM8955_RO1ZC;
941 wm8955->reg_cache[WM8955_LOUT2_VOLUME] |= WM8955_LO2VU | WM8955_LO2ZC; 941 reg_cache[WM8955_LOUT2_VOLUME] |= WM8955_LO2VU | WM8955_LO2ZC;
942 wm8955->reg_cache[WM8955_ROUT2_VOLUME] |= WM8955_RO2VU | WM8955_RO2ZC; 942 reg_cache[WM8955_ROUT2_VOLUME] |= WM8955_RO2VU | WM8955_RO2ZC;
943 wm8955->reg_cache[WM8955_MONOOUT_VOLUME] |= WM8955_MOZC; 943 reg_cache[WM8955_MONOOUT_VOLUME] |= WM8955_MOZC;
944 944
945 /* Also enable adaptive bass boost by default */ 945 /* Also enable adaptive bass boost by default */
946 wm8955->reg_cache[WM8955_BASS_CONTROL] |= WM8955_BB; 946 reg_cache[WM8955_BASS_CONTROL] |= WM8955_BB;
947 947
948 /* Set platform data values */ 948 /* Set platform data values */
949 if (pdata) { 949 if (pdata) {
950 if (pdata->out2_speaker) 950 if (pdata->out2_speaker)
951 wm8955->reg_cache[WM8955_ADDITIONAL_CONTROL_2] 951 reg_cache[WM8955_ADDITIONAL_CONTROL_2]
952 |= WM8955_ROUT2INV; 952 |= WM8955_ROUT2INV;
953 953
954 if (pdata->monoin_diff) 954 if (pdata->monoin_diff)
955 wm8955->reg_cache[WM8955_MONO_OUT_MIX_1] 955 reg_cache[WM8955_MONO_OUT_MIX_1]
956 |= WM8955_DMEN; 956 |= WM8955_DMEN;
957 } 957 }
958 958
@@ -1003,6 +1003,7 @@ static __devinit int wm8955_i2c_probe(struct i2c_client *i2c,
1003 return -ENOMEM; 1003 return -ENOMEM;
1004 1004
1005 i2c_set_clientdata(i2c, wm8955); 1005 i2c_set_clientdata(i2c, wm8955);
1006 wm8955->control_type = SND_SOC_I2C;
1006 1007
1007 ret = snd_soc_register_codec(&i2c->dev, 1008 ret = snd_soc_register_codec(&i2c->dev,
1008 &soc_codec_dev_wm8955, &wm8955_dai, 1); 1009 &soc_codec_dev_wm8955, &wm8955_dai, 1);
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index 21986c42272f..ff6ff2f529d2 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -1013,6 +1013,7 @@ static __devinit int wm8960_i2c_probe(struct i2c_client *i2c,
1013 return -ENOMEM; 1013 return -ENOMEM;
1014 1014
1015 i2c_set_clientdata(i2c, wm8960); 1015 i2c_set_clientdata(i2c, wm8960);
1016 wm8960->control_type = SND_SOC_I2C;
1016 wm8960->control_data = i2c; 1017 wm8960->control_data = i2c;
1017 1018
1018 ret = snd_soc_register_codec(&i2c->dev, 1019 ret = snd_soc_register_codec(&i2c->dev,
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index 1304ca91a11c..7c421cc837bd 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -52,8 +52,6 @@ static const char *wm8962_supply_names[WM8962_NUM_SUPPLIES] = {
52struct wm8962_priv { 52struct wm8962_priv {
53 struct snd_soc_codec *codec; 53 struct snd_soc_codec *codec;
54 54
55 u16 reg_cache[WM8962_MAX_REGISTER + 1];
56
57 int sysclk; 55 int sysclk;
58 int sysclk_rate; 56 int sysclk_rate;
59 57
@@ -1991,8 +1989,7 @@ static int wm8962_put_hp_sw(struct snd_kcontrol *kcontrol,
1991 struct snd_ctl_elem_value *ucontrol) 1989 struct snd_ctl_elem_value *ucontrol)
1992{ 1990{
1993 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 1991 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
1994 struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); 1992 u16 *reg_cache = codec->reg_cache;
1995 u16 *reg_cache = wm8962->reg_cache;
1996 int ret; 1993 int ret;
1997 1994
1998 /* Apply the update (if any) */ 1995 /* Apply the update (if any) */
@@ -2020,8 +2017,7 @@ static int wm8962_put_spk_sw(struct snd_kcontrol *kcontrol,
2020 struct snd_ctl_elem_value *ucontrol) 2017 struct snd_ctl_elem_value *ucontrol)
2021{ 2018{
2022 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 2019 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
2023 struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); 2020 u16 *reg_cache = codec->reg_cache;
2024 u16 *reg_cache = wm8962->reg_cache;
2025 int ret; 2021 int ret;
2026 2022
2027 /* Apply the update (if any) */ 2023 /* Apply the update (if any) */
@@ -2329,8 +2325,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w,
2329 struct snd_kcontrol *kcontrol, int event) 2325 struct snd_kcontrol *kcontrol, int event)
2330{ 2326{
2331 struct snd_soc_codec *codec = w->codec; 2327 struct snd_soc_codec *codec = w->codec;
2332 struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); 2328 u16 *reg_cache = codec->reg_cache;
2333 u16 *reg_cache = wm8962->reg_cache;
2334 int reg; 2329 int reg;
2335 2330
2336 switch (w->shift) { 2331 switch (w->shift) {
@@ -2719,7 +2714,7 @@ static int wm8962_add_widgets(struct snd_soc_codec *codec)
2719 2714
2720static void wm8962_sync_cache(struct snd_soc_codec *codec) 2715static void wm8962_sync_cache(struct snd_soc_codec *codec)
2721{ 2716{
2722 struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); 2717 u16 *reg_cache = codec->reg_cache;
2723 int i; 2718 int i;
2724 2719
2725 if (!codec->cache_sync) 2720 if (!codec->cache_sync)
@@ -2732,13 +2727,13 @@ static void wm8962_sync_cache(struct snd_soc_codec *codec)
2732 /* Sync back cached values if they're different from the 2727 /* Sync back cached values if they're different from the
2733 * hardware default. 2728 * hardware default.
2734 */ 2729 */
2735 for (i = 1; i < ARRAY_SIZE(wm8962->reg_cache); i++) { 2730 for (i = 1; i < codec->driver->reg_cache_size; i++) {
2736 if (i == WM8962_SOFTWARE_RESET) 2731 if (i == WM8962_SOFTWARE_RESET)
2737 continue; 2732 continue;
2738 if (wm8962->reg_cache[i] == wm8962_reg[i]) 2733 if (reg_cache[i] == wm8962_reg[i])
2739 continue; 2734 continue;
2740 2735
2741 snd_soc_write(codec, i, wm8962->reg_cache[i]); 2736 snd_soc_write(codec, i, reg_cache[i]);
2742 } 2737 }
2743 2738
2744 codec->cache_sync = 0; 2739 codec->cache_sync = 0;
@@ -3406,12 +3401,11 @@ EXPORT_SYMBOL_GPL(wm8962_mic_detect);
3406#ifdef CONFIG_PM 3401#ifdef CONFIG_PM
3407static int wm8962_resume(struct snd_soc_codec *codec) 3402static int wm8962_resume(struct snd_soc_codec *codec)
3408{ 3403{
3409 struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec);
3410 u16 *reg_cache = codec->reg_cache; 3404 u16 *reg_cache = codec->reg_cache;
3411 int i; 3405 int i;
3412 3406
3413 /* Restore the registers */ 3407 /* Restore the registers */
3414 for (i = 1; i < ARRAY_SIZE(wm8962->reg_cache); i++) { 3408 for (i = 1; i < codec->driver->reg_cache_size; i++) {
3415 switch (i) { 3409 switch (i) {
3416 case WM8962_SOFTWARE_RESET: 3410 case WM8962_SOFTWARE_RESET:
3417 continue; 3411 continue;
@@ -3705,6 +3699,7 @@ static int wm8962_probe(struct snd_soc_codec *codec)
3705 struct wm8962_pdata *pdata = dev_get_platdata(codec->dev); 3699 struct wm8962_pdata *pdata = dev_get_platdata(codec->dev);
3706 struct i2c_client *i2c = container_of(codec->dev, struct i2c_client, 3700 struct i2c_client *i2c = container_of(codec->dev, struct i2c_client,
3707 dev); 3701 dev);
3702 u16 *reg_cache = codec->reg_cache;
3708 int i, trigger, irq_pol; 3703 int i, trigger, irq_pol;
3709 3704
3710 wm8962->codec = codec; 3705 wm8962->codec = codec;
@@ -3804,7 +3799,7 @@ static int wm8962_probe(struct snd_soc_codec *codec)
3804 3799
3805 /* Put the speakers into mono mode? */ 3800 /* Put the speakers into mono mode? */
3806 if (pdata->spk_mono) 3801 if (pdata->spk_mono)
3807 wm8962->reg_cache[WM8962_CLASS_D_CONTROL_2] 3802 reg_cache[WM8962_CLASS_D_CONTROL_2]
3808 |= WM8962_SPK_MONO; 3803 |= WM8962_SPK_MONO;
3809 3804
3810 /* Micbias setup, detection enable and detection 3805 /* Micbias setup, detection enable and detection
@@ -3819,16 +3814,16 @@ static int wm8962_probe(struct snd_soc_codec *codec)
3819 } 3814 }
3820 3815
3821 /* Latch volume update bits */ 3816 /* Latch volume update bits */
3822 wm8962->reg_cache[WM8962_LEFT_INPUT_VOLUME] |= WM8962_IN_VU; 3817 reg_cache[WM8962_LEFT_INPUT_VOLUME] |= WM8962_IN_VU;
3823 wm8962->reg_cache[WM8962_RIGHT_INPUT_VOLUME] |= WM8962_IN_VU; 3818 reg_cache[WM8962_RIGHT_INPUT_VOLUME] |= WM8962_IN_VU;
3824 wm8962->reg_cache[WM8962_LEFT_ADC_VOLUME] |= WM8962_ADC_VU; 3819 reg_cache[WM8962_LEFT_ADC_VOLUME] |= WM8962_ADC_VU;
3825 wm8962->reg_cache[WM8962_RIGHT_ADC_VOLUME] |= WM8962_ADC_VU; 3820 reg_cache[WM8962_RIGHT_ADC_VOLUME] |= WM8962_ADC_VU;
3826 wm8962->reg_cache[WM8962_LEFT_DAC_VOLUME] |= WM8962_DAC_VU; 3821 reg_cache[WM8962_LEFT_DAC_VOLUME] |= WM8962_DAC_VU;
3827 wm8962->reg_cache[WM8962_RIGHT_DAC_VOLUME] |= WM8962_DAC_VU; 3822 reg_cache[WM8962_RIGHT_DAC_VOLUME] |= WM8962_DAC_VU;
3828 wm8962->reg_cache[WM8962_SPKOUTL_VOLUME] |= WM8962_SPKOUT_VU; 3823 reg_cache[WM8962_SPKOUTL_VOLUME] |= WM8962_SPKOUT_VU;
3829 wm8962->reg_cache[WM8962_SPKOUTR_VOLUME] |= WM8962_SPKOUT_VU; 3824 reg_cache[WM8962_SPKOUTR_VOLUME] |= WM8962_SPKOUT_VU;
3830 wm8962->reg_cache[WM8962_HPOUTL_VOLUME] |= WM8962_HPOUT_VU; 3825 reg_cache[WM8962_HPOUTL_VOLUME] |= WM8962_HPOUT_VU;
3831 wm8962->reg_cache[WM8962_HPOUTR_VOLUME] |= WM8962_HPOUT_VU; 3826 reg_cache[WM8962_HPOUTR_VOLUME] |= WM8962_HPOUT_VU;
3832 3827
3833 wm8962_add_widgets(codec); 3828 wm8962_add_widgets(codec);
3834 3829
diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c
index 63f6dbf5d070..9f18db6e167c 100644
--- a/sound/soc/codecs/wm8971.c
+++ b/sound/soc/codecs/wm8971.c
@@ -718,6 +718,7 @@ static __devinit int wm8971_i2c_probe(struct i2c_client *i2c,
718 if (wm8971 == NULL) 718 if (wm8971 == NULL)
719 return -ENOMEM; 719 return -ENOMEM;
720 720
721 wm8971->control_type = SND_SOC_I2C;
721 i2c_set_clientdata(i2c, wm8971); 722 i2c_set_clientdata(i2c, wm8971);
722 723
723 ret = snd_soc_register_codec(&i2c->dev, 724 ret = snd_soc_register_codec(&i2c->dev,
diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c
index ecc7c37180c7..a486670966bd 100644
--- a/sound/soc/codecs/wm9081.c
+++ b/sound/soc/codecs/wm9081.c
@@ -1335,6 +1335,7 @@ static __devinit int wm9081_i2c_probe(struct i2c_client *i2c,
1335 return -ENOMEM; 1335 return -ENOMEM;
1336 1336
1337 i2c_set_clientdata(i2c, wm9081); 1337 i2c_set_clientdata(i2c, wm9081);
1338 wm9081->control_type = SND_SOC_I2C;
1338 wm9081->control_data = i2c; 1339 wm9081->control_data = i2c;
1339 1340
1340 ret = snd_soc_register_codec(&i2c->dev, 1341 ret = snd_soc_register_codec(&i2c->dev,
diff --git a/sound/soc/codecs/wm9090.c b/sound/soc/codecs/wm9090.c
index 99c046ba46bb..6e5f64f627cb 100644
--- a/sound/soc/codecs/wm9090.c
+++ b/sound/soc/codecs/wm9090.c
@@ -141,7 +141,6 @@ static const u16 wm9090_reg_defaults[] = {
141/* This struct is used to save the context */ 141/* This struct is used to save the context */
142struct wm9090_priv { 142struct wm9090_priv {
143 struct mutex mutex; 143 struct mutex mutex;
144 u16 reg_cache[WM9090_MAX_REGISTER + 1];
145 struct wm9090_platform_data pdata; 144 struct wm9090_platform_data pdata;
146 void *control_data; 145 void *control_data;
147}; 146};
@@ -552,6 +551,7 @@ static int wm9090_set_bias_level(struct snd_soc_codec *codec,
552static int wm9090_probe(struct snd_soc_codec *codec) 551static int wm9090_probe(struct snd_soc_codec *codec)
553{ 552{
554 struct wm9090_priv *wm9090 = snd_soc_codec_get_drvdata(codec); 553 struct wm9090_priv *wm9090 = snd_soc_codec_get_drvdata(codec);
554 u16 *reg_cache = codec->reg_cache;
555 int ret; 555 int ret;
556 556
557 codec->control_data = wm9090->control_data; 557 codec->control_data = wm9090->control_data;
@@ -576,22 +576,22 @@ static int wm9090_probe(struct snd_soc_codec *codec)
576 /* Configure some defaults; they will be written out when we 576 /* Configure some defaults; they will be written out when we
577 * bring the bias up. 577 * bring the bias up.
578 */ 578 */
579 wm9090->reg_cache[WM9090_IN1_LINE_INPUT_A_VOLUME] |= WM9090_IN1_VU 579 reg_cache[WM9090_IN1_LINE_INPUT_A_VOLUME] |= WM9090_IN1_VU
580 | WM9090_IN1A_ZC; 580 | WM9090_IN1A_ZC;
581 wm9090->reg_cache[WM9090_IN1_LINE_INPUT_B_VOLUME] |= WM9090_IN1_VU 581 reg_cache[WM9090_IN1_LINE_INPUT_B_VOLUME] |= WM9090_IN1_VU
582 | WM9090_IN1B_ZC; 582 | WM9090_IN1B_ZC;
583 wm9090->reg_cache[WM9090_IN2_LINE_INPUT_A_VOLUME] |= WM9090_IN2_VU 583 reg_cache[WM9090_IN2_LINE_INPUT_A_VOLUME] |= WM9090_IN2_VU
584 | WM9090_IN2A_ZC; 584 | WM9090_IN2A_ZC;
585 wm9090->reg_cache[WM9090_IN2_LINE_INPUT_B_VOLUME] |= WM9090_IN2_VU 585 reg_cache[WM9090_IN2_LINE_INPUT_B_VOLUME] |= WM9090_IN2_VU
586 | WM9090_IN2B_ZC; 586 | WM9090_IN2B_ZC;
587 wm9090->reg_cache[WM9090_SPEAKER_VOLUME_LEFT] |= 587 reg_cache[WM9090_SPEAKER_VOLUME_LEFT] |=
588 WM9090_SPKOUT_VU | WM9090_SPKOUTL_ZC; 588 WM9090_SPKOUT_VU | WM9090_SPKOUTL_ZC;
589 wm9090->reg_cache[WM9090_LEFT_OUTPUT_VOLUME] |= 589 reg_cache[WM9090_LEFT_OUTPUT_VOLUME] |=
590 WM9090_HPOUT1_VU | WM9090_HPOUT1L_ZC; 590 WM9090_HPOUT1_VU | WM9090_HPOUT1L_ZC;
591 wm9090->reg_cache[WM9090_RIGHT_OUTPUT_VOLUME] |= 591 reg_cache[WM9090_RIGHT_OUTPUT_VOLUME] |=
592 WM9090_HPOUT1_VU | WM9090_HPOUT1R_ZC; 592 WM9090_HPOUT1_VU | WM9090_HPOUT1R_ZC;
593 593
594 wm9090->reg_cache[WM9090_CLOCKING_1] |= WM9090_TOCLK_ENA; 594 reg_cache[WM9090_CLOCKING_1] |= WM9090_TOCLK_ENA;
595 595
596 wm9090_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 596 wm9090_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
597 597
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index d5036700a435..c749ba6136a0 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -356,7 +356,7 @@ static size_t ipchain__fprintf_graph_line(FILE *fp, int depth, int depth_mask,
356 356
357static size_t ipchain__fprintf_graph(FILE *fp, struct callchain_list *chain, 357static size_t ipchain__fprintf_graph(FILE *fp, struct callchain_list *chain,
358 int depth, int depth_mask, int period, 358 int depth, int depth_mask, int period,
359 u64 total_samples, int hits, 359 u64 total_samples, u64 hits,
360 int left_margin) 360 int left_margin)
361{ 361{
362 int i; 362 int i;