History

Merge branch 'akpm' (patches from Andrew Morton)

Merge second patch-bomb from Andrew Morton: - a few hotfixes - drivers/dma updates - MAINTAINERS updates - Quite a lot of lib/ updates - checkpatch updates - binfmt updates - autofs4 - drivers/rtc/ - various small tweaks to less used filesystems - ipc/ updates - kernel/watchdog.c changes * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (135 commits) mm: softdirty: enable write notifications on VMAs after VM_SOFTDIRTY cleared kernel/param: consolidate __{start,stop}___param[] in <linux/moduleparam.h> ia64: remove duplicate declarations of __per_cpu_start[] and __per_cpu_end[] frv: remove unused declarations of __start___ex_table and __stop___ex_table kvm: ensure hard lockup detection is disabled by default kernel/watchdog.c: control hard lockup detection default staging: rtl8192u: use %*pEn to escape buffer staging: rtl8192e: use %*pEn to escape buffer staging: wlan-ng: use %*pEhp to print SN lib80211: remove unused print_ssid() wireless: hostap: proc: print properly escaped SSID wireless: ipw2x00: print SSID via %*pE wireless: libertas: print esaped string via %*pE lib/vsprintf: add %*pE[achnops] format specifier lib / string_helpers: introduce string_escape_mem() lib / string_helpers: refactoring the test suite lib / string_helpers: move documentation to c-file include/linux: remove strict_strto* definitions arch/x86/mm/numa.c: fix boot failure when all nodes are hotpluggable fs: check bh blocknr earlier when searching lru ...

Linus Torvalds committed 12 years ago

Commit dfe2c6d2 parents a45d572 64e4550150 files · +5589 −1657Browse files

Unified · Split

150 files
  1. Documentation/binfmt_misc.txt +29 −21
  2. Documentation/devicetree/bindings/i2c/ti,bq32k.txt +18 −0
  3. Documentation/devicetree/bindings/i2c/trivial-devices.txt +0 −1
  4. Documentation/devicetree/bindings/rtc/dallas,ds1339.txt +18 −0
  5. Documentation/devicetree/bindings/rtc/s3c-rtc.txt +3 −0
  6. Documentation/filesystems/autofs4.txt +520 −0
  7. Documentation/printk-formats.txt +32 −0
  8. Documentation/sysctl/kernel.txt +2 −0
  9. MAINTAINERS +18 −14
  10. arch/arm/boot/dts/exynos3250.dtsi +1 −1
  11. arch/arm/mach-pxa/lpd270.c +6 −6
  12. arch/frv/mm/extable.c +0 −2
  13. arch/ia64/include/asm/sections.h +1 −1
  14. arch/x86/kernel/cpu/common.c +3 −1
  15. arch/x86/kernel/crash.c +6 −4
  16. arch/x86/kernel/kexec-bzimage64.c +8 −7
  17. arch/x86/kernel/kvm.c +8 −0
  18. arch/x86/mm/ioremap.c +16 −4
  19. arch/x86/mm/numa.c +45 −44
  20. arch/x86/purgatory/Makefile +2 −1
  21. drivers/base/dma-coherent.c +129 −22
  22. drivers/base/dma-contiguous.c +66 −0
  23. drivers/clk/Kconfig +9 −0
  24. drivers/clk/Makefile +1 −0
  25. drivers/clk/clk-rk808.c +170 −0
  26. drivers/infiniband/ulp/srpt/ib_srpt.c +1 −1
  27. drivers/input/touchscreen/edt-ft5x06.c +1 −1
  28. drivers/memstick/host/r592.c +2 −0
  29. drivers/misc/altera-stapl/altera.c +2 −2
  30. drivers/net/wireless/hostap/hostap_proc.c +1 −4
  31. drivers/net/wireless/ipw2x00/ipw2100.c +7 −15
  32. drivers/net/wireless/ipw2x00/ipw2200.c +87 −183
  33. drivers/net/wireless/ipw2x00/libipw_rx.c +26 −39
  34. drivers/net/wireless/ipw2x00/libipw_wx.c +6 −10
  35. drivers/net/wireless/libertas/cfg.c +2 −6
  36. drivers/net/wireless/libertas/mesh.c +3 −4
  37. drivers/platform/x86/thinkpad_acpi.c +2 −2
  38. drivers/pnp/interface.c +12 −12
  39. drivers/rtc/Kconfig +31 −0
  40. drivers/rtc/Makefile +2 −0
  41. drivers/rtc/rtc-bq32k.c +62 −0
  42. drivers/rtc/rtc-cmos.c +4 −1
  43. drivers/rtc/rtc-ds1307.c +63 −4
  44. drivers/rtc/rtc-isl12022.c +1 −1
  45. drivers/rtc/rtc-max77686.c +31 −109
  46. drivers/rtc/rtc-max77802.c +502 −0
  47. drivers/rtc/rtc-mpc5121.c +1 −1
  48. drivers/rtc/rtc-pcf8563.c +2 −2
  49. drivers/rtc/rtc-pcf8583.c +15 −3
  50. drivers/rtc/rtc-rk808.c +414 −0
  51. drivers/rtc/rtc-rs5c372.c +5 −6
  52. drivers/rtc/rtc-s3c.c +531 −320
  53. drivers/s390/cio/chp.c +2 −2
  54. drivers/scsi/ips.c +1 −1
  55. drivers/scsi/scsi_debug.c +1 −1
  56. drivers/staging/rtl8188eu/os_dep/rtw_android.c +1 −1
  57. drivers/staging/rtl8192e/rtllib.h +1 −13
  58. drivers/staging/rtl8192u/ieee80211/ieee80211.h +1 −13
  59. drivers/staging/wlan-ng/prism2sta.c +2 −26
  60. drivers/thermal/thermal_core.c +4 −4
  61. drivers/video/fbdev/pvr2fb.c +1 −1
  62. drivers/video/fbdev/s3c2410fb.c +4 −4
  63. drivers/video/fbdev/sis/sis_main.c +33 −33
  64. drivers/video/fbdev/sm501fb.c +2 −2
  65. fs/affs/amigaffs.c +0 −2
  66. fs/affs/file.c +24 −15
  67. fs/affs/inode.c +0 −3
  68. fs/affs/super.c +1 −5
  69. fs/autofs4/autofs_i.h +5 −1
  70. fs/autofs4/dev-ioctl.c +1 −1
  71. fs/autofs4/expire.c +127 −83
  72. fs/autofs4/root.c +45 −17
  73. fs/befs/btree.c +29 −24
  74. fs/binfmt_misc.c +19 −4
  75. fs/buffer.c +2 −2
  76. fs/cifs/cifs_dfs_ref.c +3 −3
  77. fs/cifs/connect.c +2 −2
  78. fs/coredump.c +8 −0
  79. fs/fat/misc.c +0 −2
  80. fs/hfs/hfs_fs.h +0 −2
  81. fs/isofs/inode.c +1 −1
  82. fs/ncpfs/dir.c +0 −3
  83. fs/nilfs2/file.c +3 −5
  84. fs/nilfs2/inode.c +7 −6
  85. fs/nilfs2/ioctl.c +3 −5
  86. fs/nilfs2/nilfs.h +11 −3
  87. fs/nilfs2/segment.c +5 −2
  88. fs/nilfs2/super.c +6 −0
  89. fs/nilfs2/the_nilfs.h +22 −0
  90. fs/ocfs2/cluster/heartbeat.c +1 −1
  91. fs/ocfs2/cluster/masklog.c +3 −3
  92. fs/omfs/inode.c +7 −3
  93. fs/omfs/omfs_fs.h +1 −0
  94. fs/proc/task_mmu.c +14 −5
  95. fs/reiserfs/journal.c +5 −3
  96. fs/ufs/balloc.c +0 −3
  97. include/asm-generic/pgtable.h +14 −0
  98. include/linux/cma.h +3 −0
  99. include/linux/compiler-gcc5.h +66 −0
  100. include/linux/kernel.h +0 −4
  101. include/linux/kexec.h +1 −0
  102. include/linux/list.h +1 −0
  103. include/linux/mm.h +6 −0
  104. include/linux/moduleparam.h +2 −0
  105. include/linux/nmi.h +13 −0
  106. include/linux/prio_heap.h +0 −58
  107. include/linux/rbtree_augmented.h +10 −0
  108. include/linux/signal.h +13 −16
  109. include/linux/string.h +1 −1
  110. include/linux/string_helpers.h +31 −34
  111. include/net/lib80211.h +0 −5
  112. init/Kconfig +1 −0
  113. init/initramfs.c +17 −17
  114. init/main.c +0 −2
  115. ipc/compat.c +46 −46
  116. ipc/ipc_sysctl.c +1 −2
  117. ipc/shm.c +0 −7
  118. ipc/util.c +4 −16
  119. kernel/debug/kdb/kdb_bp.c +3 −3
  120. kernel/kallsyms.c +2 −9
  121. kernel/kexec.c +9 −23
  122. kernel/params.c +3 −4
  123. kernel/printk/printk.c +7 −7
  124. kernel/resource.c +36 −0
  125. kernel/watchdog.c +48 −2
  126. lib/Kconfig.debug +1 −1
  127. lib/Makefile +2 −2
  128. lib/dynamic_debug.c +2 −15
  129. lib/prio_heap.c +0 −70
  130. lib/string.c +11 −17
  131. lib/string_helpers.c +312 −0
  132. lib/test-string_helpers.c +262 −15
  133. lib/textsearch.c +1 −3
  134. lib/vsprintf.c +71 −0
  135. mm/cma.c +54 −12
  136. mm/memory.c +2 −1
  137. mm/mmap.c +28 −17
  138. mm/mprotect.c +5 −15
  139. mm/slab.c +1 −1
  140. net/batman-adv/gateway_common.c +4 −4
  141. net/netfilter/ipvs/ip_vs_ftp.c +3 −3
  142. net/netfilter/nf_conntrack_ftp.c +2 −2
  143. net/netfilter/nf_conntrack_sip.c +11 −11
  144. net/netfilter/nf_log.c +1 −1
  145. net/netfilter/nf_nat_sip.c +1 −1
  146. net/wireless/lib80211.c +0 −32
  147. scripts/checkpatch.pl +97 −10
  148. scripts/headers_install.sh +2 −2
  149. scripts/sortextable.h +1 −1
  150. scripts/spelling.txt +1042 −0
Documentation/binfmt_misc.txt+29−21
@@ -15,39 +15,50 @@ First you must mount binfmt_misc: · 14 unmodified lines
1515 mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc
1616
1717 To actually register a new binary type, you have to set up a string looking like
18−:name:type:offset:magic:mask:interpreter:flags (where you can choose the ':' upon
19−your needs) and echo it to /proc/sys/fs/binfmt_misc/register.
18+:name:type:offset:magic:mask:interpreter:flags (where you can choose the ':'
19+upon your needs) and echo it to /proc/sys/fs/binfmt_misc/register.
20+
2021 Here is what the fields mean:
2122 - 'name' is an identifier string. A new /proc file will be created with this
22− name below /proc/sys/fs/binfmt_misc
23+ name below /proc/sys/fs/binfmt_misc; cannot contain slashes '/' for obvious
24+ reasons.
2325 - 'type' is the type of recognition. Give 'M' for magic and 'E' for extension.
2426 - 'offset' is the offset of the magic/mask in the file, counted in bytes. This
25− defaults to 0 if you omit it (i.e. you write ':name:type::magic...')
27+ defaults to 0 if you omit it (i.e. you write ':name:type::magic...'). Ignored
28+ when using filename extension matching.
2629 - 'magic' is the byte sequence binfmt_misc is matching for. The magic string
27− may contain hex-encoded characters like \x0a or \xA4. In a shell environment
28− you will have to write \\x0a to prevent the shell from eating your \.
30+ may contain hex-encoded characters like \x0a or \xA4. Note that you must
31+ escape any NUL bytes; parsing halts at the first one. In a shell environment
32+ you might have to write \\x0a to prevent the shell from eating your \.
2933 If you chose filename extension matching, this is the extension to be
3034 recognised (without the '.', the \x0a specials are not allowed). Extension
31− matching is case sensitive!
35+ matching is case sensitive, and slashes '/' are not allowed!
3236 - 'mask' is an (optional, defaults to all 0xff) mask. You can mask out some
3337 bits from matching by supplying a string like magic and as long as magic.
34− The mask is anded with the byte sequence of the file.
38+ The mask is anded with the byte sequence of the file. Note that you must
39+ escape any NUL bytes; parsing halts at the first one. Ignored when using
40+ filename extension matching.
3541 - 'interpreter' is the program that should be invoked with the binary as first
3642 argument (specify the full path)
3743 - 'flags' is an optional field that controls several aspects of the invocation
38− of the interpreter. It is a string of capital letters, each controls a certain
39− aspect. The following flags are supported -
40− 'P' - preserve-argv[0]. Legacy behavior of binfmt_misc is to overwrite the
41− original argv[0] with the full path to the binary. When this flag is
42− included, binfmt_misc will add an argument to the argument vector for
43− this purpose, thus preserving the original argv[0].
44+ of the interpreter. It is a string of capital letters, each controls a
45+ certain aspect. The following flags are supported -
46+ 'P' - preserve-argv[0]. Legacy behavior of binfmt_misc is to overwrite
47+ the original argv[0] with the full path to the binary. When this
48+ flag is included, binfmt_misc will add an argument to the argument
49+ vector for this purpose, thus preserving the original argv[0].
50+ e.g. If your interp is set to /bin/foo and you run `blah` (which is
51+ in /usr/local/bin), then the kernel will execute /bin/foo with
52+ argv[] set to ["/bin/foo", "/usr/local/bin/blah", "blah"]. The
53+ interp has to be aware of this so it can execute /usr/local/bin/blah
54+ with argv[] set to ["blah"].
4455 'O' - open-binary. Legacy behavior of binfmt_misc is to pass the full path
4556 of the binary to the interpreter as an argument. When this flag is
4657 included, binfmt_misc will open the file for reading and pass its
4758 descriptor as an argument, instead of the full path, thus allowing
48− the interpreter to execute non-readable binaries. This feature should
49− be used with care - the interpreter has to be trusted not to emit
50− the contents of the non-readable binary.
59+ the interpreter to execute non-readable binaries. This feature
60+ should be used with care - the interpreter has to be trusted not to
61+ emit the contents of the non-readable binary.
5162 'C' - credentials. Currently, the behavior of binfmt_misc is to calculate
5263 the credentials and security token of the new process according to
5364 the interpreter. When this flag is included, these attributes are
@@ -58,7 +69,7 @@ Here is what the fields mean: · 4 unmodified lines
5869
5970
6071 There are some restrictions:
61− - the whole register string may not exceed 255 characters
72+ - the whole register string may not exceed 1920 characters
6273 - the magic must reside in the first 128 bytes of the file, i.e.
6374 offset+size(magic) has to be less than 128
6475 - the interpreter string may not exceed 127 characters
@@ -110,7 +121,4 @@ passes it the full filename (or the file descriptor) to use. Using $PATH can · 45 unmodified lines
110121 cause unexpected behaviour and can be a security hazard.
111122
112123
113−There is a web page about binfmt_misc at
114−http://www.tat.physik.uni-tuebingen.de
115−
116124 Richard Günther <rguenth@tat.physik.uni-tuebingen.de>
Documentation/devicetree/bindings/i2c/ti,bq32k.txt+18−0
@@ -0,0 +1,18 @@
1+* TI BQ32000 I2C Serial Real-Time Clock
2+
3+Required properties:
4+- compatible: Should contain "ti,bq32000".
5+- reg: I2C address for chip
6+
7+Optional properties:
8+- trickle-resistor-ohms : Selected resistor for trickle charger
9+ Values usable are 1120 and 20180
10+ Should be given if trickle charger should be enabled
11+- trickle-diode-disable : Do not use internal trickle charger diode
12+ Should be given if internal trickle charger diode should be disabled
13+Example:
14+ bq32000: rtc@68 {
15+ compatible = "ti,bq32000";
16+ trickle-resistor-ohms = <1120>;
17+ reg = <0x68>;
18+ };
Documentation/devicetree/bindings/i2c/trivial-devices.txt+0−1
@@ -35,7 +35,6 @@ catalyst,24c32 i2c serial eeprom · 34 unmodified lines
3535 cirrus,cs42l51 Cirrus Logic CS42L51 audio codec
3636 dallas,ds1307 64 x 8, Serial, I2C Real-Time Clock
3737 dallas,ds1338 I2C RTC with 56-Byte NV RAM
38−dallas,ds1339 I2C Serial Real-Time Clock
3938 dallas,ds1340 I2C RTC with Trickle Charger
4039 dallas,ds1374 I2C, 32-Bit Binary Counter Watchdog RTC with Trickle Charger and Reset Input/Output
4140 dallas,ds1631 High-Precision Digital Thermometer
Documentation/devicetree/bindings/rtc/dallas,ds1339.txt+18−0
@@ -0,0 +1,18 @@
1+* Dallas DS1339 I2C Serial Real-Time Clock
2+
3+Required properties:
4+- compatible: Should contain "dallas,ds1339".
5+- reg: I2C address for chip
6+
7+Optional properties:
8+- trickle-resistor-ohms : Selected resistor for trickle charger
9+ Values usable for ds1339 are 250, 2000, 4000
10+ Should be given if trickle charger should be enabled
11+- trickle-diode-disable : Do not use internal trickle charger diode
12+ Should be given if internal trickle charger diode should be disabled
13+Example:
14+ ds1339: rtc@68 {
15+ compatible = "dallas,ds1339";
16+ trickle-resistor-ohms = <250>;
17+ reg = <0x68>;
18+ };
Documentation/devicetree/bindings/rtc/s3c-rtc.txt+3−0
@@ -3,7 +3,10 @@ · 2 unmodified lines
33 Required properties:
44 - compatible: should be one of the following.
55 * "samsung,s3c2410-rtc" - for controllers compatible with s3c2410 rtc.
6+ * "samsung,s3c2416-rtc" - for controllers compatible with s3c2416 rtc.
7+ * "samsung,s3c2443-rtc" - for controllers compatible with s3c2443 rtc.
68 * "samsung,s3c6410-rtc" - for controllers compatible with s3c6410 rtc.
9+ * "samsung,exynos3250-rtc" - for controllers compatible with exynos3250 rtc.
710 - reg: physical base address of the controller and length of memory mapped
811 region.
912 - interrupts: Two interrupt numbers to the cpu should be specified. First
Documentation/filesystems/autofs4.txt+520−0
@@ -0,0 +1,520 @@
1+<head>
2+<style> p { max-width:50em} ol, ul {max-width: 40em}</style>
3+</head>
4+
5+autofs - how it works
6+=====================
7+
8+Purpose
9+-------
10+
11+The goal of autofs is to provide on-demand mounting and race free
12+automatic unmounting of various other filesystems. This provides two
13+key advantages:
14+
15+1. There is no need to delay boot until all filesystems that
16+ might be needed are mounted. Processes that try to access those
17+ slow filesystems might be delayed but other processes can
18+ continue freely. This is particularly important for
19+ network filesystems (e.g. NFS) or filesystems stored on
20+ media with a media-changing robot.
21+
22+2. The names and locations of filesystems can be stored in
23+ a remote database and can change at any time. The content
24+ in that data base at the time of access will be used to provide
25+ a target for the access. The interpretation of names in the
26+ filesystem can even be programmatic rather than database-backed,
27+ allowing wildcards for example, and can vary based on the user who
28+ first accessed a name.
29+
30+Context
31+-------
32+
33+The "autofs4" filesystem module is only one part of an autofs system.
34+There also needs to be a user-space program which looks up names
35+and mounts filesystems. This will often be the "automount" program,
36+though other tools including "systemd" can make use of "autofs4".
37+This document describes only the kernel module and the interactions
38+required with any user-space program. Subsequent text refers to this
39+as the "automount daemon" or simply "the daemon".
40+
41+"autofs4" is a Linux kernel module with provides the "autofs"
42+filesystem type. Several "autofs" filesystems can be mounted and they
43+can each be managed separately, or all managed by the same daemon.
44+
45+Content
46+-------
47+
48+An autofs filesystem can contain 3 sorts of objects: directories,
49+symbolic links and mount traps. Mount traps are directories with
50+extra properties as described in the next section.
51+
52+Objects can only be created by the automount daemon: symlinks are
53+created with a regular `symlink` system call, while directories and
54+mount traps are created with `mkdir`. The determination of whether a
55+directory should be a mount trap or not is quite _ad hoc_, largely for
56+historical reasons, and is determined in part by the
57+*direct*/*indirect*/*offset* mount options, and the *maxproto* mount option.
58+
59+If neither the *direct* or *offset* mount options are given (so the
60+mount is considered to be *indirect*), then the root directory is
61+always a regular directory, otherwise it is a mount trap when it is
62+empty and a regular directory when not empty. Note that *direct* and
63+*offset* are treated identically so a concise summary is that the root
64+directory is a mount trap only if the filesystem is mounted *direct*
65+and the root is empty.
66+
67+Directories created in the root directory are mount traps only if the
68+filesystem is mounted *indirect* and they are empty.
69+
70+Directories further down the tree depend on the *maxproto* mount
71+option and particularly whether it is less than five or not.
72+When *maxproto* is five, no directories further down the
73+tree are ever mount traps, they are always regular directories. When
74+the *maxproto* is four (or three), these directories are mount traps
75+precisely when they are empty.
76+
77+So: non-empty (i.e. non-leaf) directories are never mount traps. Empty
78+directories are sometimes mount traps, and sometimes not depending on
79+where in the tree they are (root, top level, or lower), the *maxproto*,
80+and whether the mount was *indirect* or not.
81+
82+Mount Traps
83+---------------
84+
85+A core element of the implementation of autofs is the Mount Traps
86+which are provided by the Linux VFS. Any directory provided by a
87+filesystem can be designated as a trap. This involves two separate
88+features that work together to allow autofs to do its job.
89+
90+**DCACHE_NEED_AUTOMOUNT**
91+
92+If a dentry has the DCACHE_NEED_AUTOMOUNT flag set (which gets set if
93+the inode has S_AUTOMOUNT set, or can be set directly) then it is
94+(potentially) a mount trap. Any access to this directory beyond a
95+"`stat`" will (normally) cause the `d_op->d_automount()` dentry operation
96+to be called. The task of this method is to find the filesystem that
97+should be mounted on the directory and to return it. The VFS is
98+responsible for actually mounting the root of this filesystem on the
99+directory.
100+
101+autofs doesn't find the filesystem itself but sends a message to the
102+automount daemon asking it to find and mount the filesystem. The
103+autofs `d_automount` method then waits for the daemon to report that
104+everything is ready. It will then return "`NULL`" indicating that the
105+mount has already happened. The VFS doesn't try to mount anything but
106+follows down the mount that is already there.
107+
108+This functionality is sufficient for some users of mount traps such
109+as NFS which creates traps so that mountpoints on the server can be
110+reflected on the client. However it is not sufficient for autofs. As
111+mounting onto a directory is considered to be "beyond a `stat`", the
112+automount daemon would not be able to mount a filesystem on the 'trap'
113+directory without some way to avoid getting caught in the trap. For
114+that purpose there is another flag.
115+
116+**DCACHE_MANAGE_TRANSIT**
117+
118+If a dentry has DCACHE_MANAGE_TRANSIT set then two very different but
119+related behaviors are invoked, both using the `d_op->d_manage()`
120+dentry operation.
121+
122+Firstly, before checking to see if any filesystem is mounted on the
123+directory, d_manage() will be called with the `rcu_walk` parameter set
124+to `false`. It may return one of three things:
125+
126+- A return value of zero indicates that there is nothing special
127+ about this dentry and normal checks for mounts and automounts
128+ should proceed.
129+
130+ autofs normally returns zero, but first waits for any
131+ expiry (automatic unmounting of the mounted filesystem) to
132+ complete. This avoids races.
133+
134+- A return value of `-EISDIR` tells the VFS to ignore any mounts
135+ on the directory and to not consider calling `->d_automount()`.
136+ This effectively disables the **DCACHE_NEED_AUTOMOUNT** flag
137+ causing the directory not be a mount trap after all.
138+
139+ autofs returns this if it detects that the process performing the
140+ lookup is the automount daemon and that the mount has been
141+ requested but has not yet completed. How it determines this is
142+ discussed later. This allows the automount daemon not to get
143+ caught in the mount trap.
144+
145+ There is a subtlety here. It is possible that a second autofs
146+ filesystem can be mounted below the first and for both of them to
147+ be managed by the same daemon. For the daemon to be able to mount
148+ something on the second it must be able to "walk" down past the
149+ first. This means that d_manage cannot *always* return -EISDIR for
150+ the automount daemon. It must only return it when a mount has
151+ been requested, but has not yet completed.
152+
153+ `d_manage` also returns `-EISDIR` if the dentry shouldn't be a
154+ mount trap, either because it is a symbolic link or because it is
155+ not empty.
156+
157+- Any other negative value is treated as an error and returned
158+ to the caller.
159+
160+ autofs can return
161+
162+ - -ENOENT if the automount daemon failed to mount anything,
163+ - -ENOMEM if it ran out of memory,
164+ - -EINTR if a signal arrived while waiting for expiry to
165+ complete
166+ - or any other error sent down by the automount daemon.
167+
168+
169+The second use case only occurs during an "RCU-walk" and so `rcu_walk`
170+will be set.
171+
172+An RCU-walk is a fast and lightweight process for walking down a
173+filename path (i.e. it is like running on tip-toes). RCU-walk cannot
174+cope with all situations so when it finds a difficulty it falls back
175+to "REF-walk", which is slower but more robust.
176+
177+RCU-walk will never call `->d_automount`; the filesystems must already
178+be mounted or RCU-walk cannot handle the path.
179+To determine if a mount-trap is safe for RCU-walk mode it calls
180+`->d_manage()` with `rcu_walk` set to `true`.
181+
182+In this case `d_manage()` must avoid blocking and should avoid taking
183+spinlocks if at all possible. Its sole purpose is to determine if it
184+would be safe to follow down into any mounted directory and the only
185+reason that it might not be is if an expiry of the mount is
186+underway.
187+
188+In the `rcu_walk` case, `d_manage()` cannot return -EISDIR to tell the
189+VFS that this is a directory that doesn't require d_automount. If
190+`rcu_walk` sees a dentry with DCACHE_NEED_AUTOMOUNT set but nothing
191+mounted, it *will* fall back to REF-walk. `d_manage()` cannot make the
192+VFS remain in RCU-walk mode, but can only tell it to get out of
193+RCU-walk mode by returning `-ECHILD`.
194+
195+So `d_manage()`, when called with `rcu_walk` set, should either return
196+-ECHILD if there is any reason to believe it is unsafe to end the
197+mounted filesystem, and otherwise should return 0.
198+
199+autofs will return `-ECHILD` if an expiry of the filesystem has been
200+initiated or is being considered, otherwise it returns 0.
201+
202+
203+Mountpoint expiry
204+-----------------
205+
206+The VFS has a mechansim for automatically expiring unused mounts,
207+much as it can expire any unused dentry information from the dcache.
208+This is guided by the MNT_SHRINKABLE flag. This only applies to
209+mounts that were created by `d_automount()` returning a filesystem to be
210+mounted. As autofs doesn't return such a filesystem but leaves the
211+mounting to the automount daemon, it must involve the automount daemon
212+in unmounting as well. This also means that autofs has more control
213+of expiry.
214+
215+The VFS also supports "expiry" of mounts using the MNT_EXPIRE flag to
216+the `umount` system call. Unmounting with MNT_EXPIRE will fail unless
217+a previous attempt had been made, and the filesystem has been inactive
218+and untouched since that previous attempt. autofs4 does not depend on
219+this but has its own internal tracking of whether filesystems were
220+recently used. This allows individual names in the autofs directory
221+to expire separately.
222+
223+With version 4 of the protocol, the automount daemon can try to
224+unmount any filesystems mounted on the autofs filesystem or remove any
225+symbolic links or empty directories any time it likes. If the unmount
226+or removal is successful the filesystem will be returned to the state
227+it was before the mount or creation, so that any access of the name
228+will trigger normal auto-mount processing. In particlar, `rmdir` and
229+`unlink` do not leave negative entries in the dcache as a normal
230+filesystem would, so an attempt to access a recently-removed object is
231+passed to autofs for handling.
232+
233+With version 5, this is not safe except for unmounting from top-level
234+directories. As lower-level directories are never mount traps, other
235+processes will see an empty directory as soon as the filesystem is
236+unmounted. So it is generally safest to use the autofs expiry
237+protocol described below.
238+
239+Normally the daemon only wants to remove entries which haven't been
240+used for a while. For this purpose autofs maintains a "`last_used`"
241+time stamp on each directory or symlink. For symlinks it genuinely
242+does record the last time the symlink was "used" or followed to find
243+out where it points to. For directories the field is a slight
244+misnomer. It actually records the last time that autofs checked if
245+the directory or one of its descendents was busy and found that it
246+was. This is just as useful and doesn't require updating the field so
247+often.
248+
249+The daemon is able to ask autofs if anything is due to be expired,
250+using an `ioctl` as discussed later. For a *direct* mount, autofs
251+considers if the entire mount-tree can be unmounted or not. For an
252+*indirect* mount, autofs considers each of the names in the top level
253+directory to determine if any of those can be unmounted and cleaned
254+up.
255+
256+There is an option with indirect mounts to consider each of the leaves
257+that has been mounted on instead of considering the top-level names.
258+This is intended for compatability with version 4 of autofs and should
259+be considered as deprecated.
260+
261+When autofs considers a directory it checks the `last_used` time and
262+compares it with the "timeout" value set when the filesystem was
263+mounted, though this check is ignored in some cases. It also checks if
264+the directory or anything below it is in use. For symbolic links,
265+only the `last_used` time is ever considered.
266+
267+If both appear to support expiring the directory or symlink, an action
268+is taken.
269+
270+There are two ways to ask autofs to consider expiry. The first is to
271+use the **AUTOFS_IOC_EXPIRE** ioctl. This only works for indirect
272+mounts. If it finds something in the root directory to expire it will
273+return the name of that thing. Once a name has been returned the
274+automount daemon needs to unmount any filesystems mounted below the
275+name normally. As described above, this is unsafe for non-toplevel
276+mounts in a version-5 autofs. For this reason the current `automountd`
277+does not use this ioctl.
278+
279+The second mechanism uses either the **AUTOFS_DEV_IOCTL_EXPIRE_CMD** or
280+the **AUTOFS_IOC_EXPIRE_MULTI** ioctl. This will work for both direct and
281+indirect mounts. If it selects an object to expire, it will notify
282+the daemon using the notification mechanism described below. This
283+will block until the daemon acknowledges the expiry notification.
284+This implies that the "`EXPIRE`" ioctl must be sent from a different
285+thread than the one which handles notification.
286+
287+While the ioctl is blocking, the entry is marked as "expiring" and
288+`d_manage` will block until the daemon affirms that the unmount has
289+completed (together with removing any directories that might have been
290+necessary), or has been aborted.
291+
292+Communicating with autofs: detecting the daemon
293+-----------------------------------------------
294+
295+There are several forms of communication between the automount daemon
296+and the filesystem. As we have already seen, the daemon can create and
297+remove directories and symlinks using normal filesystem operations.
298+autofs knows whether a process requesting some operation is the daemon
299+or not based on its process-group id number (see getpgid(1)).
300+
301+When an autofs filesystem it mounted the pgid of the mounting
302+processes is recorded unless the "pgrp=" option is given, in which
303+case that number is recorded instead. Any request arriving from a
304+process in that process group is considered to come from the daemon.
305+If the daemon ever has to be stopped and restarted a new pgid can be
306+provided through an ioctl as will be described below.
307+
308+Communicating with autofs: the event pipe
309+-----------------------------------------
310+
311+When an autofs filesystem is mounted, the 'write' end of a pipe must
312+be passed using the 'fd=' mount option. autofs will write
313+notification messages to this pipe for the daemon to respond to.
314+For version 5, the format of the message is:
315+
316+ struct autofs_v5_packet {
317+ int proto_version; /* Protocol version */
318+ int type; /* Type of packet */
319+ autofs_wqt_t wait_queue_token;
320+ __u32 dev;
321+ __u64 ino;
322+ __u32 uid;
323+ __u32 gid;
324+ __u32 pid;
325+ __u32 tgid;
326+ __u32 len;
327+ char name[NAME_MAX+1];
328+ };
329+
330+where the type is one of
331+
332+ autofs_ptype_missing_indirect
333+ autofs_ptype_expire_indirect
334+ autofs_ptype_missing_direct
335+ autofs_ptype_expire_direct
336+
337+so messages can indicate that a name is missing (something tried to
338+access it but it isn't there) or that it has been selected for expiry.
339+
340+The pipe will be set to "packet mode" (equivalent to passing
341+`O_DIRECT`) to _pipe2(2)_ so that a read from the pipe will return at
342+most one packet, and any unread portion of a packet will be discarded.
343+
344+The `wait_queue_token` is a unique number which can identify a
345+particular request to be acknowledged. When a message is sent over
346+the pipe the affected dentry is marked as either "active" or
347+"expiring" and other accesses to it block until the message is
348+acknowledged using one of the ioctls below and the relevant
349+`wait_queue_token`.
350+
351+Communicating with autofs: root directory ioctls
352+------------------------------------------------
353+
354+The root directory of an autofs filesystem will respond to a number of
355+ioctls. The process issuing the ioctl must have the CAP_SYS_ADMIN
356+capability, or must be the automount daemon.
357+
358+The available ioctl commands are:
359+
360+- **AUTOFS_IOC_READY**: a notification has been handled. The argument
361+ to the ioctl command is the "wait_queue_token" number
362+ corresponding to the notification being acknowledged.
363+- **AUTOFS_IOC_FAIL**: similar to above, but indicates failure with
364+ the error code `ENOENT`.
365+- **AUTOFS_IOC_CATATONIC**: Causes the autofs to enter "catatonic"
366+ mode meaning that it stops sending notifications to the daemon.
367+ This mode is also entered if a write to the pipe fails.
368+- **AUTOFS_IOC_PROTOVER**: This returns the protocol version in use.
369+- **AUTOFS_IOC_PROTOSUBVER**: Returns the protocol sub-version which
370+ is really a version number for the implementation. It is
371+ currently 2.
372+- **AUTOFS_IOC_SETTIMEOUT**: This passes a pointer to an unsigned
373+ long. The value is used to set the timeout for expiry, and
374+ the current timeout value is stored back through the pointer.
375+- **AUTOFS_IOC_ASKUMOUNT**: Returns, in the pointed-to `int`, 1 if
376+ the filesystem could be unmounted. This is only a hint as
377+ the situation could change at any instant. This call can be
378+ use to avoid a more expensive full unmount attempt.
379+- **AUTOFS_IOC_EXPIRE**: as described above, this asks if there is
380+ anything suitable to expire. A pointer to a packet:
381+
382+ struct autofs_packet_expire_multi {
383+ int proto_version; /* Protocol version */
384+ int type; /* Type of packet */
385+ autofs_wqt_t wait_queue_token;
386+ int len;
387+ char name[NAME_MAX+1];
388+ };
389+
390+ is required. This is filled in with the name of something
391+ that can be unmounted or removed. If nothing can be expired,
392+ `errno` is set to `EAGAIN`. Even though a `wait_queue_token`
393+ is present in the structure, no "wait queue" is established
394+ and no acknowledgment is needed.
395+- **AUTOFS_IOC_EXPIRE_MULTI**: This is similar to
396+ **AUTOFS_IOC_EXPIRE** except that it causes notification to be
397+ sent to the daemon, and it blocks until the daemon acknowledges.
398+ The argument is an integer which can contain two different flags.
399+
400+ **AUTOFS_EXP_IMMEDIATE** causes `last_used` time to be ignored
401+ and objects are expired if the are not in use.
402+
403+ **AUTOFS_EXP_LEAVES** will select a leaf rather than a top-level
404+ name to expire. This is only safe when *maxproto* is 4.
405+
406+Communicating with autofs: char-device ioctls
407+---------------------------------------------
408+
409+It is not always possible to open the root of an autofs filesystem,
410+particularly a *direct* mounted filesystem. If the automount daemon
411+is restarted there is no way for it to regain control of existing
412+mounts using any of the above communication channels. To address this
413+need there is a "miscellaneous" character device (major 10, minor 235)
414+which can be used to communicate directly with the autofs filesystem.
415+It requires CAP_SYS_ADMIN for access.
416+
417+The `ioctl`s that can be used on this device are described in a separate
418+document `autofs4-mount-control.txt`, and are summarized briefly here.
419+Each ioctl is passed a pointer to an `autofs_dev_ioctl` structure:
420+
421+ struct autofs_dev_ioctl {
422+ __u32 ver_major;
423+ __u32 ver_minor;
424+ __u32 size; /* total size of data passed in
425+ * including this struct */
426+ __s32 ioctlfd; /* automount command fd */
427+
428+ __u32 arg1; /* Command parameters */
429+ __u32 arg2;
430+
431+ char path[0];
432+ };
433+
434+For the **OPEN_MOUNT** and **IS_MOUNTPOINT** commands, the target
435+filesystem is identified by the `path`. All other commands identify
436+the filesystem by the `ioctlfd` which is a file descriptor open on the
437+root, and which can be returned by **OPEN_MOUNT**.
438+
439+The `ver_major` and `ver_minor` are in/out parameters which check that
440+the requested version is supported, and report the maximum version
441+that the kernel module can support.
442+
443+Commands are:
444+
445+- **AUTOFS_DEV_IOCTL_VERSION_CMD**: does nothing, except validate and
446+ set version numbers.
447+- **AUTOFS_DEV_IOCTL_OPENMOUNT_CMD**: return an open file descriptor
448+ on the root of an autofs filesystem. The filesystem is identified
449+ by name and device number, which is stored in `arg1`. Device
450+ numbers for existing filesystems can be found in
451+ `/proc/self/mountinfo`.
452+- **AUTOFS_DEV_IOCTL_CLOSEMOUNT_CMD**: same as `close(ioctlfd)`.
453+- **AUTOFS_DEV_IOCTL_SETPIPEFD_CMD**: if the filesystem is in
454+ catatonic mode, this can provide the write end of a new pipe
455+ in `arg1` to re-establish communication with a daemon. The
456+ process group of the calling process is used to identify the
457+ daemon.
458+- **AUTOFS_DEV_IOCTL_REQUESTER_CMD**: `path` should be a
459+ name within the filesystem that has been auto-mounted on.
460+ arg1 is the dev number of the underlying autofs. On successful
461+ return, `arg1` and `arg2` will be the UID and GID of the process
462+ which triggered that mount.
463+
464+- **AUTOFS_DEV_IOCTL_ISMOUNTPOINT_CMD**: Check if path is a
465+ mountpoint of a particular type - see separate documentation for
466+ details.
467+
468+- **AUTOFS_DEV_IOCTL_PROTOVER_CMD**:
469+- **AUTOFS_DEV_IOCTL_PROTOSUBVER_CMD**:
470+- **AUTOFS_DEV_IOCTL_READY_CMD**:
471+- **AUTOFS_DEV_IOCTL_FAIL_CMD**:
472+- **AUTOFS_DEV_IOCTL_CATATONIC_CMD**:
473+- **AUTOFS_DEV_IOCTL_TIMEOUT_CMD**:
474+- **AUTOFS_DEV_IOCTL_EXPIRE_CMD**:
475+- **AUTOFS_DEV_IOCTL_ASKUMOUNT_CMD**: These all have the same
476+ function as the similarly named **AUTOFS_IOC** ioctls, except
477+ that **FAIL** can be given an explicit error number in `arg1`
478+ instead of assuming `ENOENT`, and this **EXPIRE** command
479+ corresponds to **AUTOFS_IOC_EXPIRE_MULTI**.
480+
481+Catatonic mode
482+--------------
483+
484+As mentioned, an autofs mount can enter "catatonic" mode. This
485+happens if a write to the notification pipe fails, or if it is
486+explicitly requested by an `ioctl`.
487+
488+When entering catatonic mode, the pipe is closed and any pending
489+notifications are acknowledged with the error `ENOENT`.
490+
491+Once in catatonic mode attempts to access non-existing names will
492+result in `ENOENT` while attempts to access existing directories will
493+be treated in the same way as if they came from the daemon, so mount
494+traps will not fire.
495+
496+When the filesystem is mounted a _uid_ and _gid_ can be given which
497+set the ownership of directories and symbolic links. When the
498+filesystem is in catatonic mode, any process with a matching UID can
499+create directories or symlinks in the root directory, but not in other
500+directories.
501+
502+Catatonic mode can only be left via the
503+**AUTOFS_DEV_IOCTL_OPENMOUNT_CMD** ioctl on the `/dev/autofs`.
504+
505+autofs, name spaces, and shared mounts
506+--------------------------------------
507+
508+With bind mounts and name spaces it is possible for an autofs
509+filesystem to appear at multiple places in one or more filesystem
510+name spaces. For this to work sensibly, the autofs filesystem should
511+always be mounted "shared". e.g.
512+
513+> `mount --make-shared /autofs/mount/point`
514+
515+The automount daemon is only able to mange a single mount location for
516+an autofs filesystem and if mounts on that are not 'shared', other
517+locations will not behave as expected. In particular access to those
518+other locations will likely result in the `ELOOP` error
519+
520+> Too many levels of symbolic links
Documentation/printk-formats.txt+32−0
@@ -70,6 +70,38 @@ DMA addresses types dma_addr_t: · 69 unmodified lines
7070 For printing a dma_addr_t type which can vary based on build options,
7171 regardless of the width of the CPU data path. Passed by reference.
7272
73+Raw buffer as an escaped string:
74+
75+ %*pE[achnops]
76+
77+ For printing raw buffer as an escaped string. For the following buffer
78+
79+ 1b 62 20 5c 43 07 22 90 0d 5d
80+
81+ few examples show how the conversion would be done (the result string
82+ without surrounding quotes):
83+
84+ %*pE "\eb \C\a"\220\r]"
85+ %*pEhp "\x1bb \C\x07"\x90\x0d]"
86+ %*pEa "\e\142\040\\\103\a\042\220\r\135"
87+
88+ The conversion rules are applied according to an optional combination
89+ of flags (see string_escape_mem() kernel documentation for the
90+ details):
91+ a - ESCAPE_ANY
92+ c - ESCAPE_SPECIAL
93+ h - ESCAPE_HEX
94+ n - ESCAPE_NULL
95+ o - ESCAPE_OCTAL
96+ p - ESCAPE_NP
97+ s - ESCAPE_SPACE
98+ By default ESCAPE_ANY_NP is used.
99+
100+ ESCAPE_ANY_NP is the sane choice for many cases, in particularly for
101+ printing SSIDs.
102+
103+ If field width is omitted the 1 byte only will be escaped.
104+
73105 Raw buffer as a hex string:
74106 %*ph 00 01 02 ... 3f
75107 %*phC 00:01:02: ... :3f
Documentation/sysctl/kernel.txt+2−0
@@ -190,6 +190,8 @@ core_pattern is used to specify a core dumpfile pattern name. · 189 unmodified lines
190190 %% output one '%'
191191 %p pid
192192 %P global pid (init PID namespace)
193+ %i tid
194+ %I global tid (init PID namespace)
193195 %u uid
194196 %g gid
195197 %d dump mode, matches PR_SET_DUMPABLE and
MAINTAINERS+18−14
@@ -1338,8 +1338,7 @@ ARM/SAMSUNG MOBILE MACHINE SUPPORT · 1337 unmodified lines
13381338 M: Kyungmin Park <kyungmin.park@samsung.com>
13391339 L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
13401340 S: Maintained
1341−F: arch/arm/mach-s5pv210/mach-aquila.c
1342−F: arch/arm/mach-s5pv210/mach-goni.c
1341+F: arch/arm/mach-s5pv210/
13431342
13441343 ARM/SAMSUNG S5P SERIES 2D GRAPHICS ACCELERATION (G2D) SUPPORT
13451344 M: Kyungmin Park <kyungmin.park@samsung.com>
@@ -1550,6 +1549,7 @@ T: git git://git.xilinx.com/linux-xlnx.git · 204 unmodified lines
15501549 S: Supported
15511550 F: arch/arm/mach-zynq/
15521551 F: drivers/cpuidle/cpuidle-zynq.c
1552+F: drivers/block/xsysace.c
15531553 N: zynq
15541554 N: xilinx
15551555 F: drivers/clocksource/cadence_ttc_timer.c
@@ -1738,6 +1738,12 @@ M: Nicolas Ferre <nicolas.ferre@atmel.com> · 182 unmodified lines
17381738 S: Supported
17391739 F: drivers/net/ethernet/cadence/
17401740
1741+ATMEL NAND DRIVER
1742+M: Josh Wu <josh.wu@atmel.com>
1743+L: linux-mtd@lists.infradead.org
1744+S: Supported
1745+F: drivers/mtd/nand/atmel_nand*
1746+
17411747 ATMEL SPI DRIVER
17421748 M: Nicolas Ferre <nicolas.ferre@atmel.com>
17431749 S: Supported
@@ -3048,7 +3054,7 @@ M: Sumit Semwal <sumit.semwal@linaro.org> · 1304 unmodified lines
30483054 S: Maintained
30493055 L: linux-media@vger.kernel.org
30503056 L: dri-devel@lists.freedesktop.org
3051−L: linaro-mm-sig@lists.linaro.org
3057+L: linaro-mm-sig@lists.linaro.org (moderated for non-subscribers)
30523058 F: drivers/dma-buf/
30533059 F: include/linux/dma-buf*
30543060 F: include/linux/reservation.h
@@ -4297,9 +4303,8 @@ S: Maintained · 1242 unmodified lines
42974303 F: drivers/media/dvb-frontends/hd29l2*
42984304
42994305 HEWLETT-PACKARD SMART2 RAID DRIVER
4300−M: Chirag Kantharia <chirag.kantharia@hp.com>
43014306 L: iss_storagedev@hp.com
4302−S: Maintained
4307+S: Orphan
43034308 F: Documentation/blockdev/cpqarray.txt
43044309 F: drivers/block/cpqarray.*
43054310
@@ -5300,6 +5305,13 @@ F: include/linux/lockd/ · 994 unmodified lines
53005305 F: include/linux/sunrpc/
53015306 F: include/uapi/linux/sunrpc/
53025307
5308+KERNEL SELFTEST FRAMEWORK
5309+M: Shuah Khan <shuahkh@osg.samsung.com>
5310+L: linux-api@vger.kernel.org
5311+T: git git://git.kernel.org/pub/scm/shuah/linux-kselftest
5312+S: Maintained
5313+F: tools/testing/selftests
5314+
53035315 KERNEL VIRTUAL MACHINE (KVM)
53045316 M: Gleb Natapov <gleb@kernel.org>
53055317 M: Paolo Bonzini <pbonzini@redhat.com>
@@ -5746,11 +5758,8 @@ T: git git://github.com/linux-test-project/ltp.git · 440 unmodified lines
57465758 S: Maintained
57475759
57485760 M32R ARCHITECTURE
5749−M: Hirokazu Takata <takata@linux-m32r.org>
5750−L: linux-m32r@ml.linux-m32r.org (moderated for non-subscribers)
5751−L: linux-m32r-ja@ml.linux-m32r.org (in Japanese)
57525761 W: http://www.linux-m32r.org/
5753−S: Maintained
5762+S: Orphan
57545763 F: arch/m32r/
57555764
57565765 M68K ARCHITECTURE
@@ -7974,7 +7983,6 @@ S: Supported · 2217 unmodified lines
79747983 F: drivers/mfd/sec*.c
79757984 F: drivers/regulator/s2m*.c
79767985 F: drivers/regulator/s5m*.c
7977−F: drivers/rtc/rtc-sec.c
79787986 F: include/linux/mfd/samsung/
79797987
79807988 SAMSUNG S5P/EXYNOS4 SOC SERIES CAMERA SUBSYSTEM DRIVERS
@@ -10315,10 +10323,6 @@ M: John Linn <John.Linn@xilinx.com> · 2334 unmodified lines
1031510323 S: Maintained
1031610324 F: drivers/net/ethernet/xilinx/xilinx_axienet*
1031710325
10318−XILINX SYSTEMACE DRIVER
10319−S: Orphan
10320−F: drivers/block/xsysace.c
10321−
1032210326 XILINX UARTLITE SERIAL DRIVER
1032310327 M: Peter Korsgaard <jacmet@sunsite.dk>
1032410328 L: linux-serial@vger.kernel.org
arch/arm/boot/dts/exynos3250.dtsi+1−1
@@ -164,7 +164,7 @@ · 163 unmodified lines
164164 };
165165
166166 rtc: rtc@10070000 {
167− compatible = "samsung,s3c6410-rtc";
167+ compatible = "samsung,exynos3250-rtc";
168168 reg = <0x10070000 0x100>;
169169 interrupts = <0 73 0>, <0 74 0>;
170170 status = "disabled";
arch/arm/mach-pxa/lpd270.c+6−6
@@ -416,17 +416,17 @@ static struct pxafb_mach_info *lpd270_lcd_to_use; · 415 unmodified lines
416416
417417 static int __init lpd270_set_lcd(char *str)
418418 {
419− if (!strnicmp(str, "lq057q3dc02", 11)) {
419+ if (!strncasecmp(str, "lq057q3dc02", 11)) {
420420 lpd270_lcd_to_use = &sharp_lq057q3dc02;
421− } else if (!strnicmp(str, "lq121s1dg31", 11)) {
421+ } else if (!strncasecmp(str, "lq121s1dg31", 11)) {
422422 lpd270_lcd_to_use = &sharp_lq121s1dg31;
423− } else if (!strnicmp(str, "lq036q1da01", 11)) {
423+ } else if (!strncasecmp(str, "lq036q1da01", 11)) {
424424 lpd270_lcd_to_use = &sharp_lq036q1da01;
425− } else if (!strnicmp(str, "lq64d343", 8)) {
425+ } else if (!strncasecmp(str, "lq64d343", 8)) {
426426 lpd270_lcd_to_use = &sharp_lq64d343;
427− } else if (!strnicmp(str, "lq10d368", 8)) {
427+ } else if (!strncasecmp(str, "lq10d368", 8)) {
428428 lpd270_lcd_to_use = &sharp_lq10d368;
429− } else if (!strnicmp(str, "lq035q7db02-20", 14)) {
429+ } else if (!strncasecmp(str, "lq035q7db02-20", 14)) {
430430 lpd270_lcd_to_use = &sharp_lq035q7db02_20;
431431 } else {
432432 printk(KERN_INFO "lpd270: unknown lcd panel [%s]\n", str);
arch/frv/mm/extable.c+0−2
@@ -6,8 +6,6 @@ · 5 unmodified lines
66 #include <linux/spinlock.h>
77 #include <asm/uaccess.h>
88
9−extern const struct exception_table_entry __attribute__((aligned(8))) __start___ex_table[];
10−extern const struct exception_table_entry __attribute__((aligned(8))) __stop___ex_table[];
119 extern const void __memset_end, __memset_user_error_lr, __memset_user_error_handler;
1210 extern const void __memcpy_end, __memcpy_user_error_lr, __memcpy_user_error_handler;
1311 extern spinlock_t modlist_lock;
arch/ia64/include/asm/sections.h+1−1
@@ -10,7 +10,7 @@ · 9 unmodified lines
1010 #include <linux/uaccess.h>
1111 #include <asm-generic/sections.h>
1212
13−extern char __per_cpu_start[], __per_cpu_end[], __phys_per_cpu_start[];
13+extern char __phys_per_cpu_start[];
1414 #ifdef CONFIG_SMP
1515 extern char __cpu0_per_cpu[];
1616 #endif
arch/x86/kernel/cpu/common.c+3−1
@@ -964,6 +964,7 @@ static void vgetcpu_set_mode(void) · 963 unmodified lines
964964 vgetcpu_mode = VGETCPU_LSL;
965965 }
966966
967+#ifdef CONFIG_IA32_EMULATION
967968 /* May not be __init: called during resume */
968969 static void syscall32_cpu_init(void)
969970 {
@@ -975,7 +976,8 @@ static void syscall32_cpu_init(void) · 5 unmodified lines
975976
976977 wrmsrl(MSR_CSTAR, ia32_cstar_target);
977978 }
978−#endif
979+#endif /* CONFIG_IA32_EMULATION */
980+#endif /* CONFIG_X86_64 */
979981
980982 #ifdef CONFIG_X86_32
981983 void enable_sep_cpu(void)
arch/x86/kernel/crash.c+6−4
@@ -237,7 +237,7 @@ static void fill_up_crash_elf_data(struct crash_elf_data *ced, · 236 unmodified lines
237237 ced->max_nr_ranges++;
238238
239239 /* If crashk_low_res is not 0, another range split possible */
240− if (crashk_low_res.end != 0)
240+ if (crashk_low_res.end)
241241 ced->max_nr_ranges++;
242242 }
243243
@@ -335,9 +335,11 @@ static int elf_header_exclude_ranges(struct crash_elf_data *ced, · 91 unmodified lines
335335 if (ret)
336336 return ret;
337337
338− ret = exclude_mem_range(cmem, crashk_low_res.start, crashk_low_res.end);
339− if (ret)
340− return ret;
338+ if (crashk_low_res.end) {
339+ ret = exclude_mem_range(cmem, crashk_low_res.start, crashk_low_res.end);
340+ if (ret)
341+ return ret;
342+ }
341343
342344 /* Exclude GART region */
343345 if (ced->gart_end) {
arch/x86/kernel/kexec-bzimage64.c+8−7
@@ -26,6 +26,7 @@ · 25 unmodified lines
2626 #include <asm/setup.h>
2727 #include <asm/crash.h>
2828 #include <asm/efi.h>
29+#include <asm/kexec-bzimage64.h>
2930
3031 #define MAX_ELFCOREHDR_STR_LEN 30 /* elfcorehdr=0x<64bit-value> */
3132
@@ -267,7 +268,7 @@ setup_boot_parameters(struct kimage *image, struct boot_params *params, · 235 unmodified lines
267268 return ret;
268269 }
269270
270−int bzImage64_probe(const char *buf, unsigned long len)
271+static int bzImage64_probe(const char *buf, unsigned long len)
271272 {
272273 int ret = -ENOEXEC;
273274 struct setup_header *header;
@@ -325,10 +326,10 @@ int bzImage64_probe(const char *buf, unsigned long len) · 51 unmodified lines
325326 return ret;
326327 }
327328
328−void *bzImage64_load(struct kimage *image, char *kernel,
329− unsigned long kernel_len, char *initrd,
330− unsigned long initrd_len, char *cmdline,
331− unsigned long cmdline_len)
329+static void *bzImage64_load(struct kimage *image, char *kernel,
330+ unsigned long kernel_len, char *initrd,
331+ unsigned long initrd_len, char *cmdline,
332+ unsigned long cmdline_len)
332333 {
333334
334335 struct setup_header *header;
@@ -514,7 +515,7 @@ out_free_params: · 179 unmodified lines
514515 }
515516
516517 /* This cleanup function is called after various segments have been loaded */
517−int bzImage64_cleanup(void *loader_data)
518+static int bzImage64_cleanup(void *loader_data)
518519 {
519520 struct bzimage64_data *ldata = loader_data;
520521
@@ -528,7 +529,7 @@ int bzImage64_cleanup(void *loader_data) · 7 unmodified lines
528529 }
529530
530531 #ifdef CONFIG_KEXEC_BZIMAGE_VERIFY_SIG
531−int bzImage64_verify_sig(const char *kernel, unsigned long kernel_len)
532+static int bzImage64_verify_sig(const char *kernel, unsigned long kernel_len)
532533 {
533534 bool trusted;
534535 int ret;
arch/x86/kernel/kvm.c+8−0
@@ -35,6 +35,7 @@ · 34 unmodified lines
3535 #include <linux/slab.h>
3636 #include <linux/kprobes.h>
3737 #include <linux/debugfs.h>
38+#include <linux/nmi.h>
3839 #include <asm/timer.h>
3940 #include <asm/cpu.h>
4041 #include <asm/traps.h>
@@ -499,6 +500,13 @@ void __init kvm_guest_init(void) · 458 unmodified lines
499500 #else
500501 kvm_guest_cpu_init();
501502 #endif
503+
504+ /*
505+ * Hard lockup detection is enabled by default. Disable it, as guests
506+ * can get false positives too easily, for example if the host is
507+ * overcommitted.
508+ */
509+ watchdog_enable_hardlockup_detector(false);
502510 }
503511
504512 static noinline uint32_t __kvm_cpuid_base(void)
arch/x86/mm/ioremap.c+16−4
@@ -86,6 +86,7 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr, · 85 unmodified lines
8686 pgprot_t prot;
8787 int retval;
8888 void __iomem *ret_addr;
89+ int ram_region;
8990
9091 /* Don't allow wraparound or zero size */
9192 last_addr = phys_addr + size - 1;
@@ -108,12 +109,23 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr, · 16 unmodified lines
108109 /*
109110 * Don't allow anybody to remap normal RAM that we're using..
110111 */
111− pfn = phys_addr >> PAGE_SHIFT;
112− last_pfn = last_addr >> PAGE_SHIFT;
113− if (walk_system_ram_range(pfn, last_pfn - pfn + 1, NULL,
114− __ioremap_check_ram) == 1)
112+ /* First check if whole region can be identified as RAM or not */
113+ ram_region = region_is_ram(phys_addr, size);
114+ if (ram_region > 0) {
115+ WARN_ONCE(1, "ioremap on RAM at 0x%lx - 0x%lx\n",
116+ (unsigned long int)phys_addr,
117+ (unsigned long int)last_addr);
115118 return NULL;
119+ }
116120
121+ /* If could not be identified(-1), check page by page */
122+ if (ram_region < 0) {
123+ pfn = phys_addr >> PAGE_SHIFT;
124+ last_pfn = last_addr >> PAGE_SHIFT;
125+ if (walk_system_ram_range(pfn, last_pfn - pfn + 1, NULL,
126+ __ioremap_check_ram) == 1)
127+ return NULL;
128+ }
117129 /*
118130 * Mappings have to be page-aligned
119131 */
arch/x86/mm/numa.c+45−44
@@ -463,6 +463,42 @@ static bool __init numa_meminfo_cover_memory(const struct numa_meminfo *mi) · 462 unmodified lines
463463 return true;
464464 }
465465
466+static void __init numa_clear_kernel_node_hotplug(void)
467+{
468+ int i, nid;
469+ nodemask_t numa_kernel_nodes = NODE_MASK_NONE;
470+ unsigned long start, end;
471+ struct memblock_region *r;
472+
473+ /*
474+ * At this time, all memory regions reserved by memblock are
475+ * used by the kernel. Set the nid in memblock.reserved will
476+ * mark out all the nodes the kernel resides in.
477+ */
478+ for (i = 0; i < numa_meminfo.nr_blks; i++) {
479+ struct numa_memblk *mb = &numa_meminfo.blk[i];
480+
481+ memblock_set_node(mb->start, mb->end - mb->start,
482+ &memblock.reserved, mb->nid);
483+ }
484+
485+ /* Mark all kernel nodes. */
486+ for_each_memblock(reserved, r)
487+ node_set(r->nid, numa_kernel_nodes);
488+
489+ /* Clear MEMBLOCK_HOTPLUG flag for memory in kernel nodes. */
490+ for (i = 0; i < numa_meminfo.nr_blks; i++) {
491+ nid = numa_meminfo.blk[i].nid;
492+ if (!node_isset(nid, numa_kernel_nodes))
493+ continue;
494+
495+ start = numa_meminfo.blk[i].start;
496+ end = numa_meminfo.blk[i].end;
497+
498+ memblock_clear_hotplug(start, end - start);
499+ }
500+}
501+
466502 static int __init numa_register_memblks(struct numa_meminfo *mi)
467503 {
468504 unsigned long uninitialized_var(pfn_align);
@@ -480,6 +516,15 @@ static int __init numa_register_memblks(struct numa_meminfo *mi) · 11 unmodified lines
480516 &memblock.memory, mb->nid);
481517 }
482518
519+ /*
520+ * At very early time, the kernel have to use some memory such as
521+ * loading the kernel image. We cannot prevent this anyway. So any
522+ * node the kernel resides in should be un-hotpluggable.
523+ *
524+ * And when we come here, alloc node data won't fail.
525+ */
526+ numa_clear_kernel_node_hotplug();
527+
483528 /*
484529 * If sections array is gonna be used for pfn -> nid mapping, check
485530 * whether its granularity is fine enough.
@@ -548,41 +593,6 @@ static void __init numa_init_array(void) · 62 unmodified lines
548593 }
549594 }
550595
551−static void __init numa_clear_kernel_node_hotplug(void)
552−{
553− int i, nid;
554− nodemask_t numa_kernel_nodes = NODE_MASK_NONE;
555− unsigned long start, end;
556− struct memblock_region *r;
557−
558− /*
559− * At this time, all memory regions reserved by memblock are
560− * used by the kernel. Set the nid in memblock.reserved will
561− * mark out all the nodes the kernel resides in.
562− */
563− for (i = 0; i < numa_meminfo.nr_blks; i++) {
564− struct numa_memblk *mb = &numa_meminfo.blk[i];
565− memblock_set_node(mb->start, mb->end - mb->start,
566− &memblock.reserved, mb->nid);
567− }
568−
569− /* Mark all kernel nodes. */
570− for_each_memblock(reserved, r)
571− node_set(r->nid, numa_kernel_nodes);
572−
573− /* Clear MEMBLOCK_HOTPLUG flag for memory in kernel nodes. */
574− for (i = 0; i < numa_meminfo.nr_blks; i++) {
575− nid = numa_meminfo.blk[i].nid;
576− if (!node_isset(nid, numa_kernel_nodes))
577− continue;
578−
579− start = numa_meminfo.blk[i].start;
580− end = numa_meminfo.blk[i].end;
581−
582− memblock_clear_hotplug(start, end - start);
583− }
584−}
585−
586596 static int __init numa_init(int (*init_func)(void))
587597 {
588598 int i;
@@ -637,15 +647,6 @@ static int __init numa_init(int (*init_func)(void)) · 48 unmodified lines
637647 }
638648 numa_init_array();
639649
640− /*
641− * At very early time, the kernel have to use some memory such as
642− * loading the kernel image. We cannot prevent this anyway. So any
643− * node the kernel resides in should be un-hotpluggable.
644− *
645− * And when we come here, numa_init() won't fail.
646− */
647− numa_clear_kernel_node_hotplug();
648−
649650 return 0;
650651 }
651652
arch/x86/purgatory/Makefile+2−1
@@ -18,8 +18,9 @@ $(obj)/purgatory.ro: $(PURGATORY_OBJS) FORCE · 17 unmodified lines
1818
1919 targets += kexec-purgatory.c
2020
21+CMD_BIN2C = $(objtree)/scripts/basic/bin2c
2122 quiet_cmd_bin2c = BIN2C $@
22− cmd_bin2c = cat $(obj)/purgatory.ro | $(objtree)/scripts/basic/bin2c kexec_purgatory > $(obj)/kexec-purgatory.c
23+ cmd_bin2c = $(CMD_BIN2C) kexec_purgatory < $< > $@
2324
2425 $(obj)/kexec-purgatory.c: $(obj)/purgatory.ro FORCE
2526 $(call if_changed,bin2c)
drivers/base/dma-coherent.c+129−22
@@ -14,11 +14,14 @@ struct dma_coherent_mem { · 13 unmodified lines
1414 int size;
1515 int flags;
1616 unsigned long *bitmap;
17+ spinlock_t spinlock;
1718 };
1819
19−int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr,
20− dma_addr_t device_addr, size_t size, int flags)
20+static int dma_init_coherent_memory(phys_addr_t phys_addr, dma_addr_t device_addr,
21+ size_t size, int flags,
22+ struct dma_coherent_mem **mem)
2123 {
24+ struct dma_coherent_mem *dma_mem = NULL;
2225 void __iomem *mem_base = NULL;
2326 int pages = size >> PAGE_SHIFT;
2427 int bitmap_size = BITS_TO_LONGS(pages) * sizeof(long);
@@ -27,40 +30,77 @@ int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr, · 2 unmodified lines
2730 goto out;
2831 if (!size)
2932 goto out;
30− if (dev->dma_mem)
31− goto out;
32−
33− /* FIXME: this routine just ignores DMA_MEMORY_INCLUDES_CHILDREN */
3433
3534 mem_base = ioremap(phys_addr, size);
3635 if (!mem_base)
3736 goto out;
3837
39− dev->dma_mem = kzalloc(sizeof(struct dma_coherent_mem), GFP_KERNEL);
40− if (!dev->dma_mem)
38+ dma_mem = kzalloc(sizeof(struct dma_coherent_mem), GFP_KERNEL);
39+ if (!dma_mem)
4140 goto out;
42− dev->dma_mem->bitmap = kzalloc(bitmap_size, GFP_KERNEL);
43− if (!dev->dma_mem->bitmap)
44− goto free1_out;
41+ dma_mem->bitmap = kzalloc(bitmap_size, GFP_KERNEL);
42+ if (!dma_mem->bitmap)
43+ goto out;
44+
45+ dma_mem->virt_base = mem_base;
46+ dma_mem->device_base = device_addr;
47+ dma_mem->pfn_base = PFN_DOWN(phys_addr);
48+ dma_mem->size = pages;
49+ dma_mem->flags = flags;
50+ spin_lock_init(&dma_mem->spinlock);
4551
46− dev->dma_mem->virt_base = mem_base;
47− dev->dma_mem->device_base = device_addr;
48− dev->dma_mem->pfn_base = PFN_DOWN(phys_addr);
49− dev->dma_mem->size = pages;
50− dev->dma_mem->flags = flags;
52+ *mem = dma_mem;
5153
5254 if (flags & DMA_MEMORY_MAP)
5355 return DMA_MEMORY_MAP;
5456
5557 return DMA_MEMORY_IO;
5658
57− free1_out:
58− kfree(dev->dma_mem);
59− out:
59+out:
60+ kfree(dma_mem);
6061 if (mem_base)
6162 iounmap(mem_base);
6263 return 0;
6364 }
65+
66+static void dma_release_coherent_memory(struct dma_coherent_mem *mem)
67+{
68+ if (!mem)
69+ return;
70+ iounmap(mem->virt_base);
71+ kfree(mem->bitmap);
72+ kfree(mem);
73+}
74+
75+static int dma_assign_coherent_memory(struct device *dev,
76+ struct dma_coherent_mem *mem)
77+{
78+ if (dev->dma_mem)
79+ return -EBUSY;
80+
81+ dev->dma_mem = mem;
82+ /* FIXME: this routine just ignores DMA_MEMORY_INCLUDES_CHILDREN */
83+
84+ return 0;
85+}
86+
87+int dma_declare_coherent_memory(struct device *dev, phys_addr_t phys_addr,
88+ dma_addr_t device_addr, size_t size, int flags)
89+{
90+ struct dma_coherent_mem *mem;
91+ int ret;
92+
93+ ret = dma_init_coherent_memory(phys_addr, device_addr, size, flags,
94+ &mem);
95+ if (ret == 0)
96+ return 0;
97+
98+ if (dma_assign_coherent_memory(dev, mem) == 0)
99+ return ret;
100+
101+ dma_release_coherent_memory(mem);
102+ return 0;
103+}
64104 EXPORT_SYMBOL(dma_declare_coherent_memory);
65105
66106 void dma_release_declared_memory(struct device *dev)
@@ -69,10 +109,8 @@ void dma_release_declared_memory(struct device *dev) · 2 unmodified lines
69109
70110 if (!mem)
71111 return;
112+ dma_release_coherent_memory(mem);
72113 dev->dma_mem = NULL;
73− iounmap(mem->virt_base);
74− kfree(mem->bitmap);
75− kfree(mem);
76114 }
77115 EXPORT_SYMBOL(dma_release_declared_memory);
78116
@@ -80,6 +118,7 @@ void *dma_mark_declared_memory_occupied(struct device *dev, · 1 unmodified line
80118 dma_addr_t device_addr, size_t size)
81119 {
82120 struct dma_coherent_mem *mem = dev->dma_mem;
121+ unsigned long flags;
83122 int pos, err;
84123
85124 size += device_addr & ~PAGE_MASK;
@@ -87,8 +126,11 @@ void *dma_mark_declared_memory_occupied(struct device *dev, · 1 unmodified line
87126 if (!mem)
88127 return ERR_PTR(-EINVAL);
89128
129+ spin_lock_irqsave(&mem->spinlock, flags);
90130 pos = (device_addr - mem->device_base) >> PAGE_SHIFT;
91131 err = bitmap_allocate_region(mem->bitmap, pos, get_order(size));
132+ spin_unlock_irqrestore(&mem->spinlock, flags);
133+
92134 if (err != 0)
93135 return ERR_PTR(err);
94136 return mem->virt_base + (pos << PAGE_SHIFT);
@@ -115,6 +157,7 @@ int dma_alloc_from_coherent(struct device *dev, ssize_t size, · 20 unmodified lines
115157 {
116158 struct dma_coherent_mem *mem;
117159 int order = get_order(size);
160+ unsigned long flags;
118161 int pageno;
119162
120163 if (!dev)
@@ -124,6 +167,7 @@ int dma_alloc_from_coherent(struct device *dev, ssize_t size, · 3 unmodified lines
124167 return 0;
125168
126169 *ret = NULL;
170+ spin_lock_irqsave(&mem->spinlock, flags);
127171
128172 if (unlikely(size > (mem->size << PAGE_SHIFT)))
129173 goto err;
@@ -138,10 +182,12 @@ int dma_alloc_from_coherent(struct device *dev, ssize_t size, · 8 unmodified lines
138182 *dma_handle = mem->device_base + (pageno << PAGE_SHIFT);
139183 *ret = mem->virt_base + (pageno << PAGE_SHIFT);
140184 memset(*ret, 0, size);
185+ spin_unlock_irqrestore(&mem->spinlock, flags);
141186
142187 return 1;
143188
144189 err:
190+ spin_unlock_irqrestore(&mem->spinlock, flags);
145191 /*
146192 * In the case where the allocation can not be satisfied from the
147193 * per-device area, try to fall back to generic memory if the
@@ -171,8 +217,11 @@ int dma_release_from_coherent(struct device *dev, int order, void *vaddr) · 23 unmodified lines
171217 if (mem && vaddr >= mem->virt_base && vaddr <
172218 (mem->virt_base + (mem->size << PAGE_SHIFT))) {
173219 int page = (vaddr - mem->virt_base) >> PAGE_SHIFT;
220+ unsigned long flags;
174221
222+ spin_lock_irqsave(&mem->spinlock, flags);
175223 bitmap_release_region(mem->bitmap, page, order);
224+ spin_unlock_irqrestore(&mem->spinlock, flags);
176225 return 1;
177226 }
178227 return 0;
@@ -218,3 +267,61 @@ int dma_mmap_from_coherent(struct device *dev, struct vm_area_struct *vma, · 39 unmodified lines
218267 return 0;
219268 }
220269 EXPORT_SYMBOL(dma_mmap_from_coherent);
270+
271+/*
272+ * Support for reserved memory regions defined in device tree
273+ */
274+#ifdef CONFIG_OF_RESERVED_MEM
275+#include <linux/of.h>
276+#include <linux/of_fdt.h>
277+#include <linux/of_reserved_mem.h>
278+
279+static int rmem_dma_device_init(struct reserved_mem *rmem, struct device *dev)
280+{
281+ struct dma_coherent_mem *mem = rmem->priv;
282+
283+ if (!mem &&
284+ dma_init_coherent_memory(rmem->base, rmem->base, rmem->size,
285+ DMA_MEMORY_MAP | DMA_MEMORY_EXCLUSIVE,
286+ &mem) != DMA_MEMORY_MAP) {
287+ pr_err("Reserved memory: failed to init DMA memory pool at %pa, size %ld MiB\n",
288+ &rmem->base, (unsigned long)rmem->size / SZ_1M);
289+ return -ENODEV;
290+ }
291+ rmem->priv = mem;
292+ dma_assign_coherent_memory(dev, mem);
293+ return 0;
294+}
295+
296+static void rmem_dma_device_release(struct reserved_mem *rmem,
297+ struct device *dev)
298+{
299+ dev->dma_mem = NULL;
300+}
301+
302+static const struct reserved_mem_ops rmem_dma_ops = {
303+ .device_init = rmem_dma_device_init,
304+ .device_release = rmem_dma_device_release,
305+};
306+
307+static int __init rmem_dma_setup(struct reserved_mem *rmem)
308+{
309+ unsigned long node = rmem->fdt_node;
310+
311+ if (of_get_flat_dt_prop(node, "reusable", NULL))
312+ return -EINVAL;
313+
314+#ifdef CONFIG_ARM
315+ if (!of_get_flat_dt_prop(node, "no-map", NULL)) {
316+ pr_err("Reserved memory: regions without no-map are not yet supported\n");
317+ return -EINVAL;
318+ }
319+#endif
320+
321+ rmem->ops = &rmem_dma_ops;
322+ pr_info("Reserved memory: created DMA memory pool at %pa, size %ld MiB\n",
323+ &rmem->base, (unsigned long)rmem->size / SZ_1M);
324+ return 0;
325+}
326+RESERVEDMEM_OF_DECLARE(dma, "shared-dma-pool", rmem_dma_setup);
327+#endif
drivers/base/dma-contiguous.c+66−0
@@ -211,3 +211,69 @@ bool dma_release_from_contiguous(struct device *dev, struct page *pages, · 210 unmodified lines
211211 {
212212 return cma_release(dev_get_cma_area(dev), pages, count);
213213 }
214+
215+/*
216+ * Support for reserved memory regions defined in device tree
217+ */
218+#ifdef CONFIG_OF_RESERVED_MEM
219+#include <linux/of.h>
220+#include <linux/of_fdt.h>
221+#include <linux/of_reserved_mem.h>
222+
223+#undef pr_fmt
224+#define pr_fmt(fmt) fmt
225+
226+static void rmem_cma_device_init(struct reserved_mem *rmem, struct device *dev)
227+{
228+ dev_set_cma_area(dev, rmem->priv);
229+}
230+
231+static void rmem_cma_device_release(struct reserved_mem *rmem,
232+ struct device *dev)
233+{
234+ dev_set_cma_area(dev, NULL);
235+}
236+
237+static const struct reserved_mem_ops rmem_cma_ops = {
238+ .device_init = rmem_cma_device_init,
239+ .device_release = rmem_cma_device_release,
240+};
241+
242+static int __init rmem_cma_setup(struct reserved_mem *rmem)
243+{
244+ phys_addr_t align = PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order);
245+ phys_addr_t mask = align - 1;
246+ unsigned long node = rmem->fdt_node;
247+ struct cma *cma;
248+ int err;
249+
250+ if (!of_get_flat_dt_prop(node, "reusable", NULL) ||
251+ of_get_flat_dt_prop(node, "no-map", NULL))
252+ return -EINVAL;
253+
254+ if ((rmem->base & mask) || (rmem->size & mask)) {
255+ pr_err("Reserved memory: incorrect alignment of CMA region\n");
256+ return -EINVAL;
257+ }
258+
259+ err = cma_init_reserved_mem(rmem->base, rmem->size, 0, &cma);
260+ if (err) {
261+ pr_err("Reserved memory: unable to setup CMA region\n");
262+ return err;
263+ }
264+ /* Architecture specific contiguous memory fixup. */
265+ dma_contiguous_early_fixup(rmem->base, rmem->size);
266+
267+ if (of_get_flat_dt_prop(node, "linux,cma-default", NULL))
268+ dma_contiguous_set_default(cma);
269+
270+ rmem->ops = &rmem_cma_ops;
271+ rmem->priv = cma;
272+
273+ pr_info("Reserved memory: created CMA memory pool at %pa, size %ld MiB\n",
274+ &rmem->base, (unsigned long)rmem->size / SZ_1M);
275+
276+ return 0;
277+}
278+RESERVEDMEM_OF_DECLARE(cma, "shared-dma-pool", rmem_cma_setup);
279+#endif
drivers/clk/Kconfig+9−0
@@ -38,6 +38,15 @@ config COMMON_CLK_MAX77686 · 37 unmodified lines
3838 ---help---
3939 This driver supports Maxim 77686 crystal oscillator clock.
4040
41+config COMMON_CLK_RK808
42+ tristate "Clock driver for RK808"
43+ depends on MFD_RK808
44+ ---help---
45+ This driver supports RK808 crystal oscillator clock. These
46+ multi-function devices have two fixed-rate oscillators,
47+ clocked at 32KHz each. Clkout1 is always on, Clkout2 can off
48+ by control register.
49+
4150 config COMMON_CLK_SI5351
4251 tristate "Clock driver for SiLabs 5351A/B/C"
4352 depends on I2C
drivers/clk/Makefile+1−0
@@ -28,6 +28,7 @@ obj-$(CONFIG_ARCH_NOMADIK) += clk-nomadik.o · 27 unmodified lines
2828 obj-$(CONFIG_ARCH_NSPIRE) += clk-nspire.o
2929 obj-$(CONFIG_COMMON_CLK_PALMAS) += clk-palmas.o
3030 obj-$(CONFIG_CLK_PPC_CORENET) += clk-ppc-corenet.o
31+obj-$(CONFIG_COMMON_CLK_RK808) += clk-rk808.o
3132 obj-$(CONFIG_COMMON_CLK_S2MPS11) += clk-s2mps11.o
3233 obj-$(CONFIG_COMMON_CLK_SI5351) += clk-si5351.o
3334 obj-$(CONFIG_COMMON_CLK_SI570) += clk-si570.o
drivers/clk/clk-rk808.c+170−0
@@ -0,0 +1,170 @@
1+/*
2+ * Clkout driver for Rockchip RK808
3+ *
4+ * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd
5+ *
6+ * Author:Chris Zhong <zyw@rock-chips.com>
7+ *
8+ * This program is free software; you can redistribute it and/or modify it
9+ * under the terms and conditions of the GNU General Public License,
10+ * version 2, as published by the Free Software Foundation.
11+ *
12+ * This program is distributed in the hope it will be useful, but WITHOUT
13+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15+ * more details.
16+ */
17+
18+#include <linux/clk.h>
19+#include <linux/clk-provider.h>
20+#include <linux/module.h>
21+#include <linux/slab.h>
22+#include <linux/platform_device.h>
23+#include <linux/mfd/rk808.h>
24+#include <linux/i2c.h>
25+
26+#define RK808_NR_OUTPUT 2
27+
28+struct rk808_clkout {
29+ struct rk808 *rk808;
30+ struct clk_onecell_data clk_data;
31+ struct clk_hw clkout1_hw;
32+ struct clk_hw clkout2_hw;
33+};
34+
35+static unsigned long rk808_clkout_recalc_rate(struct clk_hw *hw,
36+ unsigned long parent_rate)
37+{
38+ return 32768;
39+}
40+
41+static int rk808_clkout2_enable(struct clk_hw *hw, bool enable)
42+{
43+ struct rk808_clkout *rk808_clkout = container_of(hw,
44+ struct rk808_clkout,
45+ clkout2_hw);
46+ struct rk808 *rk808 = rk808_clkout->rk808;
47+
48+ return regmap_update_bits(rk808->regmap, RK808_CLK32OUT_REG,
49+ CLK32KOUT2_EN, enable ? CLK32KOUT2_EN : 0);
50+}
51+
52+static int rk808_clkout2_prepare(struct clk_hw *hw)
53+{
54+ return rk808_clkout2_enable(hw, true);
55+}
56+
57+static void rk808_clkout2_unprepare(struct clk_hw *hw)
58+{
59+ rk808_clkout2_enable(hw, false);
60+}
61+
62+static int rk808_clkout2_is_prepared(struct clk_hw *hw)
63+{
64+ struct rk808_clkout *rk808_clkout = container_of(hw,
65+ struct rk808_clkout,
66+ clkout2_hw);
67+ struct rk808 *rk808 = rk808_clkout->rk808;
68+ uint32_t val;
69+
70+ int ret = regmap_read(rk808->regmap, RK808_CLK32OUT_REG, &val);
71+
72+ if (ret < 0)
73+ return ret;
74+
75+ return (val & CLK32KOUT2_EN) ? 1 : 0;
76+}
77+
78+static const struct clk_ops rk808_clkout1_ops = {
79+ .recalc_rate = rk808_clkout_recalc_rate,
80+};
81+
82+static const struct clk_ops rk808_clkout2_ops = {
83+ .prepare = rk808_clkout2_prepare,
84+ .unprepare = rk808_clkout2_unprepare,
85+ .is_prepared = rk808_clkout2_is_prepared,
86+ .recalc_rate = rk808_clkout_recalc_rate,
87+};
88+
89+static int rk808_clkout_probe(struct platform_device *pdev)
90+{
91+ struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent);
92+ struct i2c_client *client = rk808->i2c;
93+ struct device_node *node = client->dev.of_node;
94+ struct clk_init_data init = {};
95+ struct clk **clk_table;
96+ struct rk808_clkout *rk808_clkout;
97+
98+ rk808_clkout = devm_kzalloc(&client->dev,
99+ sizeof(*rk808_clkout), GFP_KERNEL);
100+ if (!rk808_clkout)
101+ return -ENOMEM;
102+
103+ rk808_clkout->rk808 = rk808;
104+
105+ clk_table = devm_kcalloc(&client->dev, RK808_NR_OUTPUT,
106+ sizeof(struct clk *), GFP_KERNEL);
107+ if (!clk_table)
108+ return -ENOMEM;
109+
110+ init.flags = CLK_IS_ROOT;
111+ init.parent_names = NULL;
112+ init.num_parents = 0;
113+ init.name = "rk808-clkout1";
114+ init.ops = &rk808_clkout1_ops;
115+ rk808_clkout->clkout1_hw.init = &init;
116+
117+ /* optional override of the clockname */
118+ of_property_read_string_index(node, "clock-output-names",
119+ 0, &init.name);
120+
121+ clk_table[0] = devm_clk_register(&client->dev,
122+ &rk808_clkout->clkout1_hw);
123+ if (IS_ERR(clk_table[0]))
124+ return PTR_ERR(clk_table[0]);
125+
126+ init.name = "rk808-clkout2";
127+ init.ops = &rk808_clkout2_ops;
128+ rk808_clkout->clkout2_hw.init = &init;
129+
130+ /* optional override of the clockname */
131+ of_property_read_string_index(node, "clock-output-names",
132+ 1, &init.name);
133+
134+ clk_table[1] = devm_clk_register(&client->dev,
135+ &rk808_clkout->clkout2_hw);
136+ if (IS_ERR(clk_table[1]))
137+ return PTR_ERR(clk_table[1]);
138+
139+ rk808_clkout->clk_data.clks = clk_table;
140+ rk808_clkout->clk_data.clk_num = RK808_NR_OUTPUT;
141+
142+ return of_clk_add_provider(node, of_clk_src_onecell_get,
143+ &rk808_clkout->clk_data);
144+}
145+
146+static int rk808_clkout_remove(struct platform_device *pdev)
147+{
148+ struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent);
149+ struct i2c_client *client = rk808->i2c;
150+ struct device_node *node = client->dev.of_node;
151+
152+ of_clk_del_provider(node);
153+
154+ return 0;
155+}
156+
157+static struct platform_driver rk808_clkout_driver = {
158+ .probe = rk808_clkout_probe,
159+ .remove = rk808_clkout_remove,
160+ .driver = {
161+ .name = "rk808-clkout",
162+ },
163+};
164+
165+module_platform_driver(rk808_clkout_driver);
166+
167+MODULE_DESCRIPTION("Clkout driver for the rk808 series PMICs");
168+MODULE_AUTHOR("Chris Zhong <zyw@rock-chips.com>");
169+MODULE_LICENSE("GPL");
170+MODULE_ALIAS("platform:rk808-clkout");
drivers/infiniband/ulp/srpt/ib_srpt.c+1−1
@@ -3574,7 +3574,7 @@ static int srpt_parse_i_port_id(u8 i_port_id[16], const char *name) · 3573 unmodified lines
35743574 int ret, rc;
35753575
35763576 p = name;
3577− if (strnicmp(p, "0x", 2) == 0)
3577+ if (strncasecmp(p, "0x", 2) == 0)
35783578 p += 2;
35793579 ret = -EINVAL;
35803580 len = strlen(p);
drivers/input/touchscreen/edt-ft5x06.c+1−1
@@ -812,7 +812,7 @@ static int edt_ft5x06_ts_identify(struct i2c_client *client, · 811 unmodified lines
812812 /* if we find something consistent, stay with that assumption
813813 * at least M09 won't send 3 bytes here
814814 */
815− if (!(strnicmp(rdbuf + 1, "EP0", 3))) {
815+ if (!(strncasecmp(rdbuf + 1, "EP0", 3))) {
816816 tsdata->version = M06;
817817
818818 /* remove last '$' end marker */
drivers/memstick/host/r592.c+2−0
@@ -188,6 +188,7 @@ static void r592_host_reset(struct r592_device *dev) · 187 unmodified lines
188188 r592_set_mode(dev, dev->parallel_mode);
189189 }
190190
191+#ifdef CONFIG_PM_SLEEP
191192 /* Disable all hardware interrupts */
192193 static void r592_clear_interrupts(struct r592_device *dev)
193194 {
@@ -195,6 +196,7 @@ static void r592_clear_interrupts(struct r592_device *dev) · 1 unmodified line
195196 r592_clear_reg_mask(dev, R592_REG_MSC, IRQ_ALL_ACK_MASK);
196197 r592_clear_reg_mask(dev, R592_REG_MSC, IRQ_ALL_EN_MASK);
197198 }
199+#endif
198200
199201 /* Tests if there is an CRC error */
200202 static int r592_test_io_error(struct r592_device *dev)
drivers/misc/altera-stapl/altera.c+2−2
@@ -454,7 +454,7 @@ exit_done: · 453 unmodified lines
454454
455455 name = &p[str_table + name_id];
456456
457− if (strnicmp(aconf->action, name, strlen(name)) == 0) {
457+ if (strncasecmp(aconf->action, name, strlen(name)) == 0) {
458458 action_found = 1;
459459 current_proc =
460460 get_unaligned_be32(&p[action_table +
@@ -2176,7 +2176,7 @@ static int altera_get_note(u8 *p, s32 program_size, · 1715 unmodified lines
21762176 key_ptr = &p[note_strings +
21772177 get_unaligned_be32(
21782178 &p[note_table + (8 * i)])];
2179− if ((strnicmp(key, key_ptr, strlen(key_ptr)) == 0) &&
2179+ if ((strncasecmp(key, key_ptr, strlen(key_ptr)) == 0) &&
21802180 (key != NULL)) {
21812181 status = 0;
21822182
drivers/net/wireless/hostap/hostap_proc.c+1−4
@@ -168,7 +168,6 @@ static int prism2_bss_list_proc_show(struct seq_file *m, void *v) · 167 unmodified lines
168168 local_info_t *local = m->private;
169169 struct list_head *ptr = v;
170170 struct hostap_bss_info *bss;
171− int i;
172171
173172 if (ptr == &local->bss_list) {
174173 seq_printf(m, "#BSSID\tlast_update\tcount\tcapab_info\tSSID(txt)\t"
@@ -181,9 +180,7 @@ static int prism2_bss_list_proc_show(struct seq_file *m, void *v) · 6 unmodified lines
181180 bss->bssid, bss->last_update,
182181 bss->count, bss->capab_info);
183182
184− for (i = 0; i < bss->ssid_len; i++)
185− seq_putc(m,bss->ssid[i] >= 32 && bss->ssid[i] < 127 ?
186− bss->ssid[i] : '_');
183+ seq_printf(m, "%*pE", (int)bss->ssid_len, bss->ssid);
187184
188185 seq_putc(m, '\t');
189186 seq_printf(m, "%*phN", (int)bss->ssid_len, bss->ssid);
drivers/net/wireless/ipw2x00/ipw2100.c+7−15
@@ -2005,7 +2005,6 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status) · 2004 unmodified lines
20052005 u32 chan;
20062006 char *txratename;
20072007 u8 bssid[ETH_ALEN];
2008− DECLARE_SSID_BUF(ssid);
20092008
20102009 /*
20112010 * TBD: BSSID is usually 00:00:00:00:00:00 here and not
@@ -2067,8 +2066,8 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status) · 55 unmodified lines
20672066 break;
20682067 }
20692068
2070− IPW_DEBUG_INFO("%s: Associated with '%s' at %s, channel %d (BSSID=%pM)\n",
2071− priv->net_dev->name, print_ssid(ssid, essid, essid_len),
2069+ IPW_DEBUG_INFO("%s: Associated with '%*pE' at %s, channel %d (BSSID=%pM)\n",
2070+ priv->net_dev->name, essid_len, essid,
20722071 txratename, chan, bssid);
20732072
20742073 /* now we copy read ssid into dev */
@@ -2095,9 +2094,8 @@ static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid, · 20 unmodified lines
20952094 .host_command_length = ssid_len
20962095 };
20972096 int err;
2098− DECLARE_SSID_BUF(ssid);
20992097
2100− IPW_DEBUG_HC("SSID: '%s'\n", print_ssid(ssid, essid, ssid_len));
2098+ IPW_DEBUG_HC("SSID: '%*pE'\n", ssid_len, essid);
21012099
21022100 if (ssid_len)
21032101 memcpy(cmd.host_command_parameters, essid, ssid_len);
@@ -2138,11 +2136,8 @@ static int ipw2100_set_essid(struct ipw2100_priv *priv, char *essid, · 34 unmodified lines
21382136
21392137 static void isr_indicate_association_lost(struct ipw2100_priv *priv, u32 status)
21402138 {
2141− DECLARE_SSID_BUF(ssid);
2142−
21432139 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE | IPW_DL_ASSOC,
2144− "disassociated: '%s' %pM\n",
2145− print_ssid(ssid, priv->essid, priv->essid_len),
2140+ "disassociated: '%*pE' %pM\n", priv->essid_len, priv->essid,
21462141 priv->bssid);
21472142
21482143 priv->status &= ~(STATUS_ASSOCIATED | STATUS_ASSOCIATING);
@@ -6975,7 +6970,6 @@ static int ipw2100_wx_set_essid(struct net_device *dev, · 4826 unmodified lines
69756970 char *essid = ""; /* ANY */
69766971 int length = 0;
69776972 int err = 0;
6978− DECLARE_SSID_BUF(ssid);
69796973
69806974 mutex_lock(&priv->action_mutex);
69816975 if (!(priv->status & STATUS_INITIALIZED)) {
@@ -7005,8 +6999,7 @@ static int ipw2100_wx_set_essid(struct net_device *dev, · 23 unmodified lines
70056999 goto done;
70067000 }
70077001
7008− IPW_DEBUG_WX("Setting ESSID: '%s' (%d)\n",
7009− print_ssid(ssid, essid, length), length);
7002+ IPW_DEBUG_WX("Setting ESSID: '%*pE' (%d)\n", length, essid, length);
70107003
70117004 priv->essid_len = length;
70127005 memcpy(priv->essid, essid, priv->essid_len);
@@ -7027,13 +7020,12 @@ static int ipw2100_wx_get_essid(struct net_device *dev, · 14 unmodified lines
70277020 */
70287021
70297022 struct ipw2100_priv *priv = libipw_priv(dev);
7030− DECLARE_SSID_BUF(ssid);
70317023
70327024 /* If we are associated, trying to associate, or have a statically
70337025 * configured ESSID then return that; otherwise return ANY */
70347026 if (priv->config & CFG_STATIC_ESSID || priv->status & STATUS_ASSOCIATED) {
7035− IPW_DEBUG_WX("Getting essid: '%s'\n",
7036− print_ssid(ssid, priv->essid, priv->essid_len));
7027+ IPW_DEBUG_WX("Getting essid: '%*pE'\n",
7028+ priv->essid_len, priv->essid);
70377029 memcpy(extra, priv->essid, priv->essid_len);
70387030 wrqu->essid.length = priv->essid_len;
70397031 wrqu->essid.flags = 1; /* active */
drivers/net/wireless/ipw2x00/ipw2200.c+87−183
@@ -4496,7 +4496,6 @@ static void handle_scan_event(struct ipw_priv *priv) · 4495 unmodified lines
44964496 static void ipw_rx_notification(struct ipw_priv *priv,
44974497 struct ipw_rx_notification *notif)
44984498 {
4499− DECLARE_SSID_BUF(ssid);
45004499 u16 size = le16_to_cpu(notif->size);
45014500
45024501 IPW_DEBUG_NOTIF("type = %i (%d bytes)\n", notif->subtype, size);
@@ -4509,9 +4508,8 @@ static void ipw_rx_notification(struct ipw_priv *priv, · 6 unmodified lines
45094508 case CMAS_ASSOCIATED:{
45104509 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE |
45114510 IPW_DL_ASSOC,
4512− "associated: '%s' %pM\n",
4513− print_ssid(ssid, priv->essid,
4514− priv->essid_len),
4511+ "associated: '%*pE' %pM\n",
4512+ priv->essid_len, priv->essid,
45154513 priv->bssid);
45164514
45174515 switch (priv->ieee->iw_mode) {
@@ -4585,14 +4583,9 @@ static void ipw_rx_notification(struct ipw_priv *priv, · 67 unmodified lines
45854583 IPW_DEBUG(IPW_DL_NOTIF |
45864584 IPW_DL_STATE |
45874585 IPW_DL_ASSOC,
4588− "deauthenticated: '%s' "
4589− "%pM"
4590− ": (0x%04X) - %s\n",
4591− print_ssid(ssid,
4592− priv->
4593− essid,
4594− priv->
4595− essid_len),
4586+ "deauthenticated: '%*pE' %pM: (0x%04X) - %s\n",
4587+ priv->essid_len,
4588+ priv->essid,
45964589 priv->bssid,
45974590 le16_to_cpu(auth->status),
45984591 ipw_get_status_code
@@ -4610,9 +4603,8 @@ static void ipw_rx_notification(struct ipw_priv *priv, · 11 unmodified lines
46104603
46114604 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE |
46124605 IPW_DL_ASSOC,
4613− "authenticated: '%s' %pM\n",
4614− print_ssid(ssid, priv->essid,
4615− priv->essid_len),
4606+ "authenticated: '%*pE' %pM\n",
4607+ priv->essid_len, priv->essid,
46164608 priv->bssid);
46174609 break;
46184610 }
@@ -4638,9 +4630,8 @@ static void ipw_rx_notification(struct ipw_priv *priv, · 19 unmodified lines
46384630
46394631 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE |
46404632 IPW_DL_ASSOC,
4641− "disassociated: '%s' %pM\n",
4642− print_ssid(ssid, priv->essid,
4643− priv->essid_len),
4633+ "disassociated: '%*pE' %pM\n",
4634+ priv->essid_len, priv->essid,
46444635 priv->bssid);
46454636
46464637 priv->status &=
@@ -4676,9 +4667,8 @@ static void ipw_rx_notification(struct ipw_priv *priv, · 29 unmodified lines
46764667 switch (auth->state) {
46774668 case CMAS_AUTHENTICATED:
46784669 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE,
4679− "authenticated: '%s' %pM\n",
4680− print_ssid(ssid, priv->essid,
4681− priv->essid_len),
4670+ "authenticated: '%*pE' %pM\n",
4671+ priv->essid_len, priv->essid,
46824672 priv->bssid);
46834673 priv->status |= STATUS_AUTH;
46844674 break;
@@ -4695,9 +4685,8 @@ static void ipw_rx_notification(struct ipw_priv *priv, · 10 unmodified lines
46954685 }
46964686 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE |
46974687 IPW_DL_ASSOC,
4698− "deauthenticated: '%s' %pM\n",
4699− print_ssid(ssid, priv->essid,
4700− priv->essid_len),
4688+ "deauthenticated: '%*pE' %pM\n",
4689+ priv->essid_len, priv->essid,
47014690 priv->bssid);
47024691
47034692 priv->status &= ~(STATUS_ASSOCIATING |
@@ -5516,16 +5505,13 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv, · 812 unmodified lines
55165505 int roaming)
55175506 {
55185507 struct ipw_supported_rates rates;
5519− DECLARE_SSID_BUF(ssid);
55205508
55215509 /* Verify that this network's capability is compatible with the
55225510 * current mode (AdHoc or Infrastructure) */
55235511 if ((priv->ieee->iw_mode == IW_MODE_ADHOC &&
55245512 !(network->capability & WLAN_CAPABILITY_IBSS))) {
5525− IPW_DEBUG_MERGE("Network '%s (%pM)' excluded due to "
5526− "capability mismatch.\n",
5527− print_ssid(ssid, network->ssid,
5528− network->ssid_len),
5513+ IPW_DEBUG_MERGE("Network '%*pE (%pM)' excluded due to capability mismatch.\n",
5514+ network->ssid_len, network->ssid,
55295515 network->bssid);
55305516 return 0;
55315517 }
@@ -5536,10 +5522,8 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv, · 4 unmodified lines
55365522 if ((network->ssid_len != match->network->ssid_len) ||
55375523 memcmp(network->ssid, match->network->ssid,
55385524 network->ssid_len)) {
5539− IPW_DEBUG_MERGE("Network '%s (%pM)' excluded "
5540− "because of non-network ESSID.\n",
5541− print_ssid(ssid, network->ssid,
5542− network->ssid_len),
5525+ IPW_DEBUG_MERGE("Network '%*pE (%pM)' excluded because of non-network ESSID.\n",
5526+ network->ssid_len, network->ssid,
55435527 network->bssid);
55445528 return 0;
55455529 }
@@ -5550,17 +5534,10 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv, · 4 unmodified lines
55505534 ((network->ssid_len != priv->essid_len) ||
55515535 memcmp(network->ssid, priv->essid,
55525536 min(network->ssid_len, priv->essid_len)))) {
5553− char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
5554−
5555− strlcpy(escaped,
5556− print_ssid(ssid, network->ssid,
5557− network->ssid_len),
5558− sizeof(escaped));
5559− IPW_DEBUG_MERGE("Network '%s (%pM)' excluded "
5560− "because of ESSID mismatch: '%s'.\n",
5561− escaped, network->bssid,
5562− print_ssid(ssid, priv->essid,
5563− priv->essid_len));
5537+ IPW_DEBUG_MERGE("Network '%*pE (%pM)' excluded because of ESSID mismatch: '%*pE'.\n",
5538+ network->ssid_len, network->ssid,
5539+ network->bssid, priv->essid_len,
5540+ priv->essid);
55645541 return 0;
55655542 }
55665543 }
@@ -5569,26 +5546,20 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv, · 2 unmodified lines
55695546 * testing everything else. */
55705547
55715548 if (network->time_stamp[0] < match->network->time_stamp[0]) {
5572− IPW_DEBUG_MERGE("Network '%s excluded because newer than "
5573− "current network.\n",
5574− print_ssid(ssid, match->network->ssid,
5575− match->network->ssid_len));
5549+ IPW_DEBUG_MERGE("Network '%*pE excluded because newer than current network.\n",
5550+ match->network->ssid_len, match->network->ssid);
55765551 return 0;
55775552 } else if (network->time_stamp[1] < match->network->time_stamp[1]) {
5578− IPW_DEBUG_MERGE("Network '%s excluded because newer than "
5579− "current network.\n",
5580− print_ssid(ssid, match->network->ssid,
5581− match->network->ssid_len));
5553+ IPW_DEBUG_MERGE("Network '%*pE excluded because newer than current network.\n",
5554+ match->network->ssid_len, match->network->ssid);
55825555 return 0;
55835556 }
55845557
55855558 /* Now go through and see if the requested network is valid... */
55865559 if (priv->ieee->scan_age != 0 &&
55875560 time_after(jiffies, network->last_scanned + priv->ieee->scan_age)) {
5588− IPW_DEBUG_MERGE("Network '%s (%pM)' excluded "
5589− "because of age: %ums.\n",
5590− print_ssid(ssid, network->ssid,
5591− network->ssid_len),
5561+ IPW_DEBUG_MERGE("Network '%*pE (%pM)' excluded because of age: %ums.\n",
5562+ network->ssid_len, network->ssid,
55925563 network->bssid,
55935564 jiffies_to_msecs(jiffies -
55945565 network->last_scanned));
@@ -5597,10 +5568,8 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv, · 2 unmodified lines
55975568
55985569 if ((priv->config & CFG_STATIC_CHANNEL) &&
55995570 (network->channel != priv->channel)) {
5600− IPW_DEBUG_MERGE("Network '%s (%pM)' excluded "
5601− "because of channel mismatch: %d != %d.\n",
5602− print_ssid(ssid, network->ssid,
5603− network->ssid_len),
5571+ IPW_DEBUG_MERGE("Network '%*pE (%pM)' excluded because of channel mismatch: %d != %d.\n",
5572+ network->ssid_len, network->ssid,
56045573 network->bssid,
56055574 network->channel, priv->channel);
56065575 return 0;
@@ -5609,10 +5578,8 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv, · 2 unmodified lines
56095578 /* Verify privacy compatibility */
56105579 if (((priv->capability & CAP_PRIVACY_ON) ? 1 : 0) !=
56115580 ((network->capability & WLAN_CAPABILITY_PRIVACY) ? 1 : 0)) {
5612− IPW_DEBUG_MERGE("Network '%s (%pM)' excluded "
5613− "because of privacy mismatch: %s != %s.\n",
5614− print_ssid(ssid, network->ssid,
5615− network->ssid_len),
5581+ IPW_DEBUG_MERGE("Network '%*pE (%pM)' excluded because of privacy mismatch: %s != %s.\n",
5582+ network->ssid_len, network->ssid,
56165583 network->bssid,
56175584 priv->
56185585 capability & CAP_PRIVACY_ON ? "on" : "off",
@@ -5623,22 +5590,16 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv, · 4 unmodified lines
56235590 }
56245591
56255592 if (ether_addr_equal(network->bssid, priv->bssid)) {
5626− IPW_DEBUG_MERGE("Network '%s (%pM)' excluded "
5627− "because of the same BSSID match: %pM"
5628− ".\n", print_ssid(ssid, network->ssid,
5629− network->ssid_len),
5630− network->bssid,
5631− priv->bssid);
5593+ IPW_DEBUG_MERGE("Network '%*pE (%pM)' excluded because of the same BSSID match: %pM.\n",
5594+ network->ssid_len, network->ssid,
5595+ network->bssid, priv->bssid);
56325596 return 0;
56335597 }
56345598
56355599 /* Filter out any incompatible freq / mode combinations */
56365600 if (!libipw_is_valid_mode(priv->ieee, network->mode)) {
5637− IPW_DEBUG_MERGE("Network '%s (%pM)' excluded "
5638− "because of invalid frequency/mode "
5639− "combination.\n",
5640− print_ssid(ssid, network->ssid,
5641− network->ssid_len),
5601+ IPW_DEBUG_MERGE("Network '%*pE (%pM)' excluded because of invalid frequency/mode combination.\n",
5602+ network->ssid_len, network->ssid,
56425603 network->bssid);
56435604 return 0;
56445605 }
@@ -5646,20 +5607,15 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv, · 1 unmodified line
56465607 /* Ensure that the rates supported by the driver are compatible with
56475608 * this AP, including verification of basic rates (mandatory) */
56485609 if (!ipw_compatible_rates(priv, network, &rates)) {
5649− IPW_DEBUG_MERGE("Network '%s (%pM)' excluded "
5650− "because configured rate mask excludes "
5651− "AP mandatory rate.\n",
5652− print_ssid(ssid, network->ssid,
5653− network->ssid_len),
5610+ IPW_DEBUG_MERGE("Network '%*pE (%pM)' excluded because configured rate mask excludes AP mandatory rate.\n",
5611+ network->ssid_len, network->ssid,
56545612 network->bssid);
56555613 return 0;
56565614 }
56575615
56585616 if (rates.num_rates == 0) {
5659− IPW_DEBUG_MERGE("Network '%s (%pM)' excluded "
5660− "because of no compatible rates.\n",
5661− print_ssid(ssid, network->ssid,
5662− network->ssid_len),
5617+ IPW_DEBUG_MERGE("Network '%*pE (%pM)' excluded because of no compatible rates.\n",
5618+ network->ssid_len, network->ssid,
56635619 network->bssid);
56645620 return 0;
56655621 }
@@ -5671,16 +5627,14 @@ static int ipw_find_adhoc_network(struct ipw_priv *priv, · 5 unmodified lines
56715627 /* Set up 'new' AP to this network */
56725628 ipw_copy_rates(&match->rates, &rates);
56735629 match->network = network;
5674− IPW_DEBUG_MERGE("Network '%s (%pM)' is a viable match.\n",
5675− print_ssid(ssid, network->ssid, network->ssid_len),
5676− network->bssid);
5630+ IPW_DEBUG_MERGE("Network '%*pE (%pM)' is a viable match.\n",
5631+ network->ssid_len, network->ssid, network->bssid);
56775632
56785633 return 1;
56795634 }
56805635
56815636 static void ipw_merge_adhoc_network(struct work_struct *work)
56825637 {
5683− DECLARE_SSID_BUF(ssid);
56845638 struct ipw_priv *priv =
56855639 container_of(work, struct ipw_priv, merge_networks);
56865640 struct libipw_network *network = NULL;
@@ -5710,9 +5664,8 @@ static void ipw_merge_adhoc_network(struct work_struct *work) · 23 unmodified lines
57105664
57115665 mutex_lock(&priv->mutex);
57125666 if ((priv->ieee->iw_mode == IW_MODE_ADHOC)) {
5713− IPW_DEBUG_MERGE("remove network %s\n",
5714− print_ssid(ssid, priv->essid,
5715− priv->essid_len));
5667+ IPW_DEBUG_MERGE("remove network %*pE\n",
5668+ priv->essid_len, priv->essid);
57165669 ipw_remove_current_network(priv);
57175670 }
57185671
@@ -5728,7 +5681,6 @@ static int ipw_best_network(struct ipw_priv *priv, · 9 unmodified lines
57285681 struct libipw_network *network, int roaming)
57295682 {
57305683 struct ipw_supported_rates rates;
5731− DECLARE_SSID_BUF(ssid);
57325684
57335685 /* Verify that this network's capability is compatible with the
57345686 * current mode (AdHoc or Infrastructure) */
@@ -5736,10 +5688,8 @@ static int ipw_best_network(struct ipw_priv *priv, · 1 unmodified line
57365688 !(network->capability & WLAN_CAPABILITY_ESS)) ||
57375689 (priv->ieee->iw_mode == IW_MODE_ADHOC &&
57385690 !(network->capability & WLAN_CAPABILITY_IBSS))) {
5739− IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded due to "
5740− "capability mismatch.\n",
5741− print_ssid(ssid, network->ssid,
5742− network->ssid_len),
5691+ IPW_DEBUG_ASSOC("Network '%*pE (%pM)' excluded due to capability mismatch.\n",
5692+ network->ssid_len, network->ssid,
57435693 network->bssid);
57445694 return 0;
57455695 }
@@ -5750,10 +5700,8 @@ static int ipw_best_network(struct ipw_priv *priv, · 4 unmodified lines
57505700 if ((network->ssid_len != match->network->ssid_len) ||
57515701 memcmp(network->ssid, match->network->ssid,
57525702 network->ssid_len)) {
5753− IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
5754− "because of non-network ESSID.\n",
5755− print_ssid(ssid, network->ssid,
5756− network->ssid_len),
5703+ IPW_DEBUG_ASSOC("Network '%*pE (%pM)' excluded because of non-network ESSID.\n",
5704+ network->ssid_len, network->ssid,
57575705 network->bssid);
57585706 return 0;
57595707 }
@@ -5764,16 +5712,10 @@ static int ipw_best_network(struct ipw_priv *priv, · 4 unmodified lines
57645712 ((network->ssid_len != priv->essid_len) ||
57655713 memcmp(network->ssid, priv->essid,
57665714 min(network->ssid_len, priv->essid_len)))) {
5767− char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
5768− strlcpy(escaped,
5769− print_ssid(ssid, network->ssid,
5770− network->ssid_len),
5771− sizeof(escaped));
5772− IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
5773− "because of ESSID mismatch: '%s'.\n",
5774− escaped, network->bssid,
5775− print_ssid(ssid, priv->essid,
5776− priv->essid_len));
5715+ IPW_DEBUG_ASSOC("Network '%*pE (%pM)' excluded because of ESSID mismatch: '%*pE'.\n",
5716+ network->ssid_len, network->ssid,
5717+ network->bssid, priv->essid_len,
5718+ priv->essid);
57775719 return 0;
57785720 }
57795721 }
@@ -5781,16 +5723,10 @@ static int ipw_best_network(struct ipw_priv *priv, · 1 unmodified line
57815723 /* If the old network rate is better than this one, don't bother
57825724 * testing everything else. */
57835725 if (match->network && match->network->stats.rssi > network->stats.rssi) {
5784− char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
5785− strlcpy(escaped,
5786− print_ssid(ssid, network->ssid, network->ssid_len),
5787− sizeof(escaped));
5788− IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded because "
5789− "'%s (%pM)' has a stronger signal.\n",
5790− escaped, network->bssid,
5791− print_ssid(ssid, match->network->ssid,
5792− match->network->ssid_len),
5793− match->network->bssid);
5726+ IPW_DEBUG_ASSOC("Network '%*pE (%pM)' excluded because '%*pE (%pM)' has a stronger signal.\n",
5727+ network->ssid_len, network->ssid,
5728+ network->bssid, match->network->ssid_len,
5729+ match->network->ssid, match->network->bssid);
57945730 return 0;
57955731 }
57965732
@@ -5798,11 +5734,8 @@ static int ipw_best_network(struct ipw_priv *priv, · 1 unmodified line
57985734 * last 3 seconds, do not try and associate again... */
57995735 if (network->last_associate &&
58005736 time_after(network->last_associate + (HZ * 3UL), jiffies)) {
5801− IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
5802− "because of storming (%ums since last "
5803− "assoc attempt).\n",
5804− print_ssid(ssid, network->ssid,
5805− network->ssid_len),
5737+ IPW_DEBUG_ASSOC("Network '%*pE (%pM)' excluded because of storming (%ums since last assoc attempt).\n",
5738+ network->ssid_len, network->ssid,
58065739 network->bssid,
58075740 jiffies_to_msecs(jiffies -
58085741 network->last_associate));
@@ -5812,10 +5745,8 @@ static int ipw_best_network(struct ipw_priv *priv, · 3 unmodified lines
58125745 /* Now go through and see if the requested network is valid... */
58135746 if (priv->ieee->scan_age != 0 &&
58145747 time_after(jiffies, network->last_scanned + priv->ieee->scan_age)) {
5815− IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
5816− "because of age: %ums.\n",
5817− print_ssid(ssid, network->ssid,
5818− network->ssid_len),
5748+ IPW_DEBUG_ASSOC("Network '%*pE (%pM)' excluded because of age: %ums.\n",
5749+ network->ssid_len, network->ssid,
58195750 network->bssid,
58205751 jiffies_to_msecs(jiffies -
58215752 network->last_scanned));
@@ -5824,10 +5755,8 @@ static int ipw_best_network(struct ipw_priv *priv, · 2 unmodified lines
58245755
58255756 if ((priv->config & CFG_STATIC_CHANNEL) &&
58265757 (network->channel != priv->channel)) {
5827− IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
5828− "because of channel mismatch: %d != %d.\n",
5829− print_ssid(ssid, network->ssid,
5830− network->ssid_len),
5758+ IPW_DEBUG_ASSOC("Network '%*pE (%pM)' excluded because of channel mismatch: %d != %d.\n",
5759+ network->ssid_len, network->ssid,
58315760 network->bssid,
58325761 network->channel, priv->channel);
58335762 return 0;
@@ -5836,10 +5765,8 @@ static int ipw_best_network(struct ipw_priv *priv, · 2 unmodified lines
58365765 /* Verify privacy compatibility */
58375766 if (((priv->capability & CAP_PRIVACY_ON) ? 1 : 0) !=
58385767 ((network->capability & WLAN_CAPABILITY_PRIVACY) ? 1 : 0)) {
5839− IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
5840− "because of privacy mismatch: %s != %s.\n",
5841− print_ssid(ssid, network->ssid,
5842− network->ssid_len),
5768+ IPW_DEBUG_ASSOC("Network '%*pE (%pM)' excluded because of privacy mismatch: %s != %s.\n",
5769+ network->ssid_len, network->ssid,
58435770 network->bssid,
58445771 priv->capability & CAP_PRIVACY_ON ? "on" :
58455772 "off",
@@ -5850,31 +5777,24 @@ static int ipw_best_network(struct ipw_priv *priv, · 4 unmodified lines
58505777
58515778 if ((priv->config & CFG_STATIC_BSSID) &&
58525779 !ether_addr_equal(network->bssid, priv->bssid)) {
5853− IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
5854− "because of BSSID mismatch: %pM.\n",
5855− print_ssid(ssid, network->ssid,
5856− network->ssid_len),
5780+ IPW_DEBUG_ASSOC("Network '%*pE (%pM)' excluded because of BSSID mismatch: %pM.\n",
5781+ network->ssid_len, network->ssid,
58575782 network->bssid, priv->bssid);
58585783 return 0;
58595784 }
58605785
58615786 /* Filter out any incompatible freq / mode combinations */
58625787 if (!libipw_is_valid_mode(priv->ieee, network->mode)) {
5863− IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
5864− "because of invalid frequency/mode "
5865− "combination.\n",
5866− print_ssid(ssid, network->ssid,
5867− network->ssid_len),
5788+ IPW_DEBUG_ASSOC("Network '%*pE (%pM)' excluded because of invalid frequency/mode combination.\n",
5789+ network->ssid_len, network->ssid,
58685790 network->bssid);
58695791 return 0;
58705792 }
58715793
58725794 /* Filter out invalid channel in current GEO */
58735795 if (!libipw_is_valid_channel(priv->ieee, network->channel)) {
5874− IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
5875− "because of invalid channel in current GEO\n",
5876− print_ssid(ssid, network->ssid,
5877− network->ssid_len),
5796+ IPW_DEBUG_ASSOC("Network '%*pE (%pM)' excluded because of invalid channel in current GEO\n",
5797+ network->ssid_len, network->ssid,
58785798 network->bssid);
58795799 return 0;
58805800 }
@@ -5882,20 +5802,15 @@ static int ipw_best_network(struct ipw_priv *priv, · 1 unmodified line
58825802 /* Ensure that the rates supported by the driver are compatible with
58835803 * this AP, including verification of basic rates (mandatory) */
58845804 if (!ipw_compatible_rates(priv, network, &rates)) {
5885− IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
5886− "because configured rate mask excludes "
5887− "AP mandatory rate.\n",
5888− print_ssid(ssid, network->ssid,
5889− network->ssid_len),
5805+ IPW_DEBUG_ASSOC("Network '%*pE (%pM)' excluded because configured rate mask excludes AP mandatory rate.\n",
5806+ network->ssid_len, network->ssid,
58905807 network->bssid);
58915808 return 0;
58925809 }
58935810
58945811 if (rates.num_rates == 0) {
5895− IPW_DEBUG_ASSOC("Network '%s (%pM)' excluded "
5896− "because of no compatible rates.\n",
5897− print_ssid(ssid, network->ssid,
5898− network->ssid_len),
5812+ IPW_DEBUG_ASSOC("Network '%*pE (%pM)' excluded because of no compatible rates.\n",
5813+ network->ssid_len, network->ssid,
58995814 network->bssid);
59005815 return 0;
59015816 }
@@ -5908,9 +5823,8 @@ static int ipw_best_network(struct ipw_priv *priv, · 6 unmodified lines
59085823 ipw_copy_rates(&match->rates, &rates);
59095824 match->network = network;
59105825
5911− IPW_DEBUG_ASSOC("Network '%s (%pM)' is a viable match.\n",
5912− print_ssid(ssid, network->ssid, network->ssid_len),
5913− network->bssid);
5826+ IPW_DEBUG_ASSOC("Network '%*pE (%pM)' is a viable match.\n",
5827+ network->ssid_len, network->ssid, network->bssid);
59145828
59155829 return 1;
59165830 }
@@ -6152,7 +6066,6 @@ static void ipw_bg_adhoc_check(struct work_struct *work) · 235 unmodified lines
61526066
61536067 static void ipw_debug_config(struct ipw_priv *priv)
61546068 {
6155− DECLARE_SSID_BUF(ssid);
61566069 IPW_DEBUG_INFO("Scan completed, no valid APs matched "
61576070 "[CFG 0x%08X]\n", priv->config);
61586071 if (priv->config & CFG_STATIC_CHANNEL)
@@ -6160,8 +6073,8 @@ static void ipw_debug_config(struct ipw_priv *priv) · 1 unmodified line
61606073 else
61616074 IPW_DEBUG_INFO("Channel unlocked.\n");
61626075 if (priv->config & CFG_STATIC_ESSID)
6163− IPW_DEBUG_INFO("ESSID locked to '%s'\n",
6164− print_ssid(ssid, priv->essid, priv->essid_len));
6076+ IPW_DEBUG_INFO("ESSID locked to '%*pE'\n",
6077+ priv->essid_len, priv->essid);
61656078 else
61666079 IPW_DEBUG_INFO("ESSID unlocked.\n");
61676080 if (priv->config & CFG_STATIC_BSSID)
@@ -7385,7 +7298,6 @@ static int ipw_associate_network(struct ipw_priv *priv, · 1217 unmodified lines
73857298 struct ipw_supported_rates *rates, int roaming)
73867299 {
73877300 int err;
7388− DECLARE_SSID_BUF(ssid);
73897301
73907302 if (priv->config & CFG_FIXED_RATE)
73917303 ipw_set_fixed_rate(priv, network->mode);
@@ -7451,10 +7363,9 @@ static int ipw_associate_network(struct ipw_priv *priv, · 59 unmodified lines
74517363 priv->assoc_request.capability &=
74527364 ~cpu_to_le16(WLAN_CAPABILITY_SHORT_SLOT_TIME);
74537365
7454− IPW_DEBUG_ASSOC("%ssociation attempt: '%s', channel %d, "
7455− "802.11%c [%d], %s[:%s], enc=%s%s%s%c%c\n",
7366+ IPW_DEBUG_ASSOC("%ssociation attempt: '%*pE', channel %d, 802.11%c [%d], %s[:%s], enc=%s%s%s%c%c\n",
74567367 roaming ? "Rea" : "A",
7457− print_ssid(ssid, priv->essid, priv->essid_len),
7368+ priv->essid_len, priv->essid,
74587369 network->channel,
74597370 ipw_modes[priv->assoc_request.ieee_mode],
74607371 rates->num_rates,
@@ -7553,9 +7464,8 @@ static int ipw_associate_network(struct ipw_priv *priv, · 92 unmodified lines
75537464 return err;
75547465 }
75557466
7556− IPW_DEBUG(IPW_DL_STATE, "associating: '%s' %pM\n",
7557− print_ssid(ssid, priv->essid, priv->essid_len),
7558− priv->bssid);
7467+ IPW_DEBUG(IPW_DL_STATE, "associating: '%*pE' %pM\n",
7468+ priv->essid_len, priv->essid, priv->bssid);
75597469
75607470 return 0;
75617471 }
@@ -7645,7 +7555,6 @@ static int ipw_associate(void *data) · 83 unmodified lines
76457555 struct ipw_supported_rates *rates;
76467556 struct list_head *element;
76477557 unsigned long flags;
7648− DECLARE_SSID_BUF(ssid);
76497558
76507559 if (priv->ieee->iw_mode == IW_MODE_MONITOR) {
76517560 IPW_DEBUG_ASSOC("Not attempting association (monitor mode)\n");
@@ -7704,10 +7613,8 @@ static int ipw_associate(void *data) · 52 unmodified lines
77047613 /* If there are no more slots, expire the oldest */
77057614 list_del(&oldest->list);
77067615 target = oldest;
7707− IPW_DEBUG_ASSOC("Expired '%s' (%pM) from "
7708− "network list.\n",
7709− print_ssid(ssid, target->ssid,
7710− target->ssid_len),
7616+ IPW_DEBUG_ASSOC("Expired '%*pE' (%pM) from network list.\n",
7617+ target->ssid_len, target->ssid,
77117618 target->bssid);
77127619 list_add_tail(&target->list,
77137620 &priv->ieee->network_free_list);
@@ -9093,7 +9000,6 @@ static int ipw_wx_set_essid(struct net_device *dev, · 1379 unmodified lines
90939000 {
90949001 struct ipw_priv *priv = libipw_priv(dev);
90959002 int length;
9096− DECLARE_SSID_BUF(ssid);
90979003
90989004 mutex_lock(&priv->mutex);
90999005
@@ -9118,8 +9024,7 @@ static int ipw_wx_set_essid(struct net_device *dev, · 18 unmodified lines
91189024 return 0;
91199025 }
91209026
9121− IPW_DEBUG_WX("Setting ESSID: '%s' (%d)\n",
9122− print_ssid(ssid, extra, length), length);
9027+ IPW_DEBUG_WX("Setting ESSID: '%*pE' (%d)\n", length, extra, length);
91239028
91249029 priv->essid_len = length;
91259030 memcpy(priv->essid, extra, priv->essid_len);
@@ -9138,15 +9043,14 @@ static int ipw_wx_get_essid(struct net_device *dev, · 12 unmodified lines
91389043 union iwreq_data *wrqu, char *extra)
91399044 {
91409045 struct ipw_priv *priv = libipw_priv(dev);
9141− DECLARE_SSID_BUF(ssid);
91429046
91439047 /* If we are associated, trying to associate, or have a statically
91449048 * configured ESSID then return that; otherwise return ANY */
91459049 mutex_lock(&priv->mutex);
91469050 if (priv->config & CFG_STATIC_ESSID ||
91479051 priv->status & (STATUS_ASSOCIATED | STATUS_ASSOCIATING)) {
9148− IPW_DEBUG_WX("Getting essid: '%s'\n",
9149− print_ssid(ssid, priv->essid, priv->essid_len));
9052+ IPW_DEBUG_WX("Getting essid: '%*pE'\n",
9053+ priv->essid_len, priv->essid);
91509054 memcpy(extra, priv->essid, priv->essid_len);
91519055 wrqu->essid.length = priv->essid_len;
91529056 wrqu->essid.flags = 1; /* active */
drivers/net/wireless/ipw2x00/libipw_rx.c+26−39
@@ -1120,7 +1120,6 @@ static int libipw_parse_info_param(struct libipw_info_element · 1119 unmodified lines
11201120 *info_element, u16 length,
11211121 struct libipw_network *network)
11221122 {
1123− DECLARE_SSID_BUF(ssid);
11241123 u8 i;
11251124 #ifdef CONFIG_LIBIPW_DEBUG
11261125 char rates_str[64];
@@ -1151,10 +1150,9 @@ static int libipw_parse_info_param(struct libipw_info_element · 24 unmodified lines
11511150 memset(network->ssid + network->ssid_len, 0,
11521151 IW_ESSID_MAX_SIZE - network->ssid_len);
11531152
1154− LIBIPW_DEBUG_MGMT("WLAN_EID_SSID: '%s' len=%d.\n",
1155− print_ssid(ssid, network->ssid,
1156− network->ssid_len),
1157− network->ssid_len);
1153+ LIBIPW_DEBUG_MGMT("WLAN_EID_SSID: '%*pE' len=%d.\n",
1154+ network->ssid_len, network->ssid,
1155+ network->ssid_len);
11581156 break;
11591157
11601158 case WLAN_EID_SUPP_RATES:
@@ -1399,8 +1397,6 @@ static int libipw_network_init(struct libipw_device *ieee, struct libipw_probe_r · 238 unmodified lines
13991397 struct libipw_network *network,
14001398 struct libipw_rx_stats *stats)
14011399 {
1402− DECLARE_SSID_BUF(ssid);
1403−
14041400 network->qos_data.active = 0;
14051401 network->qos_data.supported = 0;
14061402 network->qos_data.param_count = 0;
@@ -1447,11 +1443,9 @@ static int libipw_network_init(struct libipw_device *ieee, struct libipw_probe_r · 40 unmodified lines
14471443 }
14481444
14491445 if (network->mode == 0) {
1450− LIBIPW_DEBUG_SCAN("Filtered out '%s (%pM)' "
1451− "network.\n",
1452− print_ssid(ssid, network->ssid,
1453− network->ssid_len),
1454− network->bssid);
1446+ LIBIPW_DEBUG_SCAN("Filtered out '%*pE (%pM)' network.\n",
1447+ network->ssid_len, network->ssid,
1448+ network->bssid);
14551449 return 1;
14561450 }
14571451
@@ -1563,11 +1557,9 @@ static void libipw_process_probe_response(struct libipw_device · 105 unmodified lines
15631557 struct libipw_info_element *info_element = beacon->info_element;
15641558 #endif
15651559 unsigned long flags;
1566− DECLARE_SSID_BUF(ssid);
15671560
1568− LIBIPW_DEBUG_SCAN("'%s' (%pM"
1569− "): %c%c%c%c %c%c%c%c-%c%c%c%c %c%c%c%c\n",
1570− print_ssid(ssid, info_element->data, info_element->len),
1561+ LIBIPW_DEBUG_SCAN("'%*pE' (%pM): %c%c%c%c %c%c%c%c-%c%c%c%c %c%c%c%c\n",
1562+ info_element->len, info_element->data,
15711563 beacon->header.addr3,
15721564 (beacon->capability & cpu_to_le16(1 << 0xf)) ? '1' : '0',
15731565 (beacon->capability & cpu_to_le16(1 << 0xe)) ? '1' : '0',
@@ -1587,12 +1579,11 @@ static void libipw_process_probe_response(struct libipw_device · 13 unmodified lines
15871579 (beacon->capability & cpu_to_le16(1 << 0x0)) ? '1' : '0');
15881580
15891581 if (libipw_network_init(ieee, beacon, &network, stats)) {
1590− LIBIPW_DEBUG_SCAN("Dropped '%s' (%pM) via %s.\n",
1591− print_ssid(ssid, info_element->data,
1592− info_element->len),
1593− beacon->header.addr3,
1594− is_beacon(beacon->header.frame_ctl) ?
1595− "BEACON" : "PROBE RESPONSE");
1582+ LIBIPW_DEBUG_SCAN("Dropped '%*pE' (%pM) via %s.\n",
1583+ info_element->len, info_element->data,
1584+ beacon->header.addr3,
1585+ is_beacon(beacon->header.frame_ctl) ?
1586+ "BEACON" : "PROBE RESPONSE");
15961587 return;
15971588 }
15981589
@@ -1624,11 +1615,9 @@ static void libipw_process_probe_response(struct libipw_device · 25 unmodified lines
16241615 /* If there are no more slots, expire the oldest */
16251616 list_del(&oldest->list);
16261617 target = oldest;
1627− LIBIPW_DEBUG_SCAN("Expired '%s' (%pM) from "
1628− "network list.\n",
1629− print_ssid(ssid, target->ssid,
1630− target->ssid_len),
1631− target->bssid);
1618+ LIBIPW_DEBUG_SCAN("Expired '%*pE' (%pM) from network list.\n",
1619+ target->ssid_len, target->ssid,
1620+ target->bssid);
16321621 libipw_network_reset(target);
16331622 } else {
16341623 /* Otherwise just pull from the free list */
@@ -1638,23 +1627,21 @@ static void libipw_process_probe_response(struct libipw_device · 3 unmodified lines
16381627 }
16391628
16401629 #ifdef CONFIG_LIBIPW_DEBUG
1641− LIBIPW_DEBUG_SCAN("Adding '%s' (%pM) via %s.\n",
1642− print_ssid(ssid, network.ssid,
1643− network.ssid_len),
1644− network.bssid,
1645− is_beacon(beacon->header.frame_ctl) ?
1646− "BEACON" : "PROBE RESPONSE");
1630+ LIBIPW_DEBUG_SCAN("Adding '%*pE' (%pM) via %s.\n",
1631+ network.ssid_len, network.ssid,
1632+ network.bssid,
1633+ is_beacon(beacon->header.frame_ctl) ?
1634+ "BEACON" : "PROBE RESPONSE");
16471635 #endif
16481636 memcpy(target, &network, sizeof(*target));
16491637 network.ibss_dfs = NULL;
16501638 list_add_tail(&target->list, &ieee->network_list);
16511639 } else {
1652− LIBIPW_DEBUG_SCAN("Updating '%s' (%pM) via %s.\n",
1653− print_ssid(ssid, target->ssid,
1654− target->ssid_len),
1655− target->bssid,
1656− is_beacon(beacon->header.frame_ctl) ?
1657− "BEACON" : "PROBE RESPONSE");
1640+ LIBIPW_DEBUG_SCAN("Updating '%*pE' (%pM) via %s.\n",
1641+ target->ssid_len, target->ssid,
1642+ target->bssid,
1643+ is_beacon(beacon->header.frame_ctl) ?
1644+ "BEACON" : "PROBE RESPONSE");
16581645 update_network(target, &network);
16591646 network.ibss_dfs = NULL;
16601647 }
drivers/net/wireless/ipw2x00/libipw_wx.c+6−10
@@ -272,7 +272,6 @@ int libipw_wx_get_scan(struct libipw_device *ieee, · 271 unmodified lines
272272 char *ev = extra;
273273 char *stop = ev + wrqu->data.length;
274274 int i = 0;
275− DECLARE_SSID_BUF(ssid);
276275
277276 LIBIPW_DEBUG_WX("Getting scan\n");
278277
@@ -290,12 +289,10 @@ int libipw_wx_get_scan(struct libipw_device *ieee, · 11 unmodified lines
290289 ev = libipw_translate_scan(ieee, ev, stop, network,
291290 info);
292291 else {
293− LIBIPW_DEBUG_SCAN("Not showing network '%s ("
294− "%pM)' due to age (%ums).\n",
295− print_ssid(ssid, network->ssid,
296− network->ssid_len),
297− network->bssid,
298− elapsed_jiffies_msecs(
292+ LIBIPW_DEBUG_SCAN("Not showing network '%*pE (%pM)' due to age (%ums).\n",
293+ network->ssid_len, network->ssid,
294+ network->bssid,
295+ elapsed_jiffies_msecs(
299296 network->last_scanned));
300297 }
301298 }
@@ -322,7 +319,6 @@ int libipw_wx_set_encode(struct libipw_device *ieee, · 20 unmodified lines
322319 int i, key, key_provided, len;
323320 struct lib80211_crypt_data **crypt;
324321 int host_crypto = ieee->host_encrypt || ieee->host_decrypt;
325− DECLARE_SSID_BUF(ssid);
326322
327323 LIBIPW_DEBUG_WX("SET_ENCODE\n");
328324
@@ -417,8 +413,8 @@ int libipw_wx_set_encode(struct libipw_device *ieee, · 88 unmodified lines
417413 if (len > erq->length)
418414 memset(sec.keys[key] + erq->length, 0,
419415 len - erq->length);
420− LIBIPW_DEBUG_WX("Setting key %d to '%s' (%d:%d bytes)\n",
421− key, print_ssid(ssid, sec.keys[key], len),
416+ LIBIPW_DEBUG_WX("Setting key %d to '%*pE' (%d:%d bytes)\n",
417+ key, len, sec.keys[key],
422418 erq->length, len);
423419 sec.key_sizes[key] = len;
424420 if (*crypt)
drivers/net/wireless/libertas/cfg.c+2−6
@@ -590,7 +590,6 @@ static int lbs_ret_scan(struct lbs_private *priv, unsigned long dummy, · 589 unmodified lines
590590 int chan_no = -1;
591591 const u8 *ssid = NULL;
592592 u8 ssid_len = 0;
593− DECLARE_SSID_BUF(ssid_buf);
594593
595594 int len = get_unaligned_le16(pos);
596595 pos += 2;
@@ -644,10 +643,8 @@ static int lbs_ret_scan(struct lbs_private *priv, unsigned long dummy, · 47 unmodified lines
644643 struct ieee80211_channel *channel =
645644 ieee80211_get_channel(wiphy, freq);
646645
647− lbs_deb_scan("scan: %pM, capa %04x, chan %2d, %s, "
648− "%d dBm\n",
649− bssid, capa, chan_no,
650− print_ssid(ssid_buf, ssid, ssid_len),
646+ lbs_deb_scan("scan: %pM, capa %04x, chan %2d, %*pE, %d dBm\n",
647+ bssid, capa, chan_no, ssid_len, ssid,
651648 LBS_SCAN_RSSI_TO_MBM(rssi)/100);
652649
653650 if (channel &&
@@ -1984,7 +1981,6 @@ static int lbs_join_ibss(struct wiphy *wiphy, struct net_device *dev, · 1330 unmodified lines
19841981 struct lbs_private *priv = wiphy_priv(wiphy);
19851982 int ret = 0;
19861983 struct cfg80211_bss *bss;
1987− DECLARE_SSID_BUF(ssid_buf);
19881984
19891985 if (dev == priv->mesh_dev)
19901986 return -EOPNOTSUPP;
drivers/net/wireless/libertas/mesh.c+3−4
@@ -93,7 +93,6 @@ static int lbs_mesh_config(struct lbs_private *priv, uint16_t action, · 92 unmodified lines
9393 {
9494 struct cmd_ds_mesh_config cmd;
9595 struct mrvl_meshie *ie;
96− DECLARE_SSID_BUF(ssid);
9796
9897 memset(&cmd, 0, sizeof(cmd));
9998 cmd.channel = cpu_to_le16(chan);
@@ -122,9 +121,9 @@ static int lbs_mesh_config(struct lbs_private *priv, uint16_t action, · 22 unmodified lines
122121 default:
123122 return -1;
124123 }
125− lbs_deb_cmd("mesh config action %d type %x channel %d SSID %s\n",
126− action, priv->mesh_tlv, chan,
127− print_ssid(ssid, priv->mesh_ssid, priv->mesh_ssid_len));
124+ lbs_deb_cmd("mesh config action %d type %x channel %d SSID %*pE\n",
125+ action, priv->mesh_tlv, chan, priv->mesh_ssid_len,
126+ priv->mesh_ssid);
128127
129128 return __lbs_mesh_config_send(priv, &cmd, action, priv->mesh_tlv);
130129 }
drivers/platform/x86/thinkpad_acpi.c+2−2
@@ -8878,13 +8878,13 @@ static int __must_check __init get_thinkpad_model_data( · 8877 unmodified lines
88788878 }
88798879
88808880 s = dmi_get_system_info(DMI_PRODUCT_VERSION);
8881− if (s && !(strnicmp(s, "ThinkPad", 8) && strnicmp(s, "Lenovo", 6))) {
8881+ if (s && !(strncasecmp(s, "ThinkPad", 8) && strncasecmp(s, "Lenovo", 6))) {
88828882 tp->model_str = kstrdup(s, GFP_KERNEL);
88838883 if (!tp->model_str)
88848884 return -ENOMEM;
88858885 } else {
88868886 s = dmi_get_system_info(DMI_BIOS_VENDOR);
8887− if (s && !(strnicmp(s, "Lenovo", 6))) {
8887+ if (s && !(strncasecmp(s, "Lenovo", 6))) {
88888888 tp->model_str = kstrdup(s, GFP_KERNEL);
88898889 if (!tp->model_str)
88908890 return -ENOMEM;
drivers/pnp/interface.c+12−12
@@ -346,41 +346,41 @@ static ssize_t resources_store(struct device *dmdev, · 345 unmodified lines
346346 }
347347
348348 buf = skip_spaces(buf);
349− if (!strnicmp(buf, "disable", 7)) {
349+ if (!strncasecmp(buf, "disable", 7)) {
350350 retval = pnp_disable_dev(dev);
351351 goto done;
352352 }
353− if (!strnicmp(buf, "activate", 8)) {
353+ if (!strncasecmp(buf, "activate", 8)) {
354354 retval = pnp_activate_dev(dev);
355355 goto done;
356356 }
357− if (!strnicmp(buf, "fill", 4)) {
357+ if (!strncasecmp(buf, "fill", 4)) {
358358 if (dev->active)
359359 goto done;
360360 retval = pnp_auto_config_dev(dev);
361361 goto done;
362362 }
363− if (!strnicmp(buf, "auto", 4)) {
363+ if (!strncasecmp(buf, "auto", 4)) {
364364 if (dev->active)
365365 goto done;
366366 pnp_init_resources(dev);
367367 retval = pnp_auto_config_dev(dev);
368368 goto done;
369369 }
370− if (!strnicmp(buf, "clear", 5)) {
370+ if (!strncasecmp(buf, "clear", 5)) {
371371 if (dev->active)
372372 goto done;
373373 pnp_init_resources(dev);
374374 goto done;
375375 }
376− if (!strnicmp(buf, "get", 3)) {
376+ if (!strncasecmp(buf, "get", 3)) {
377377 mutex_lock(&pnp_res_mutex);
378378 if (pnp_can_read(dev))
379379 dev->protocol->get(dev);
380380 mutex_unlock(&pnp_res_mutex);
381381 goto done;
382382 }
383− if (!strnicmp(buf, "set", 3)) {
383+ if (!strncasecmp(buf, "set", 3)) {
384384 resource_size_t start;
385385 resource_size_t end;
386386 unsigned long flags;
@@ -392,31 +392,31 @@ static ssize_t resources_store(struct device *dmdev, · 5 unmodified lines
392392 mutex_lock(&pnp_res_mutex);
393393 while (1) {
394394 buf = skip_spaces(buf);
395− if (!strnicmp(buf, "io", 2)) {
395+ if (!strncasecmp(buf, "io", 2)) {
396396 buf = pnp_get_resource_value(buf + 2,
397397 IORESOURCE_IO,
398398 &start, &end,
399399 &flags);
400400 pnp_add_io_resource(dev, start, end, flags);
401− } else if (!strnicmp(buf, "mem", 3)) {
401+ } else if (!strncasecmp(buf, "mem", 3)) {
402402 buf = pnp_get_resource_value(buf + 3,
403403 IORESOURCE_MEM,
404404 &start, &end,
405405 &flags);
406406 pnp_add_mem_resource(dev, start, end, flags);
407− } else if (!strnicmp(buf, "irq", 3)) {
407+ } else if (!strncasecmp(buf, "irq", 3)) {
408408 buf = pnp_get_resource_value(buf + 3,
409409 IORESOURCE_IRQ,
410410 &start, NULL,
411411 &flags);
412412 pnp_add_irq_resource(dev, start, flags);
413− } else if (!strnicmp(buf, "dma", 3)) {
413+ } else if (!strncasecmp(buf, "dma", 3)) {
414414 buf = pnp_get_resource_value(buf + 3,
415415 IORESOURCE_DMA,
416416 &start, NULL,
417417 &flags);
418418 pnp_add_dma_resource(dev, start, flags);
419− } else if (!strnicmp(buf, "bus", 3)) {
419+ } else if (!strncasecmp(buf, "bus", 3)) {
420420 buf = pnp_get_resource_value(buf + 3,
421421 IORESOURCE_BUS,
422422 &start, &end,
drivers/rtc/Kconfig+31−0
@@ -288,6 +288,26 @@ config RTC_DRV_MAX77686 · 287 unmodified lines
288288 This driver can also be built as a module. If so, the module
289289 will be called rtc-max77686.
290290
291+config RTC_DRV_RK808
292+ tristate "Rockchip RK808 RTC"
293+ depends on MFD_RK808
294+ help
295+ If you say yes here you will get support for the
296+ RTC of RK808 PMIC.
297+
298+ This driver can also be built as a module. If so, the module
299+ will be called rk808-rtc.
300+
301+config RTC_DRV_MAX77802
302+ tristate "Maxim 77802 RTC"
303+ depends on MFD_MAX77686
304+ help
305+ If you say yes here you will get support for the
306+ RTC of Maxim MAX77802 PMIC.
307+
308+ This driver can also be built as a module. If so, the module
309+ will be called rtc-max77802.
310+
291311 config RTC_DRV_RS5C372
292312 tristate "Ricoh R2025S/D, RS5C372A/B, RV5C386, RV5C387A"
293313 help
@@ -732,6 +752,7 @@ config RTC_DRV_DS1216 · 438 unmodified lines
732752
733753 config RTC_DRV_DS1286
734754 tristate "Dallas DS1286"
755+ depends on HAS_IOMEM
735756 help
736757 If you say yes here you get support for the Dallas DS1286 RTC chips.
737758
@@ -743,6 +764,7 @@ config RTC_DRV_DS1302 · 5 unmodified lines
743764
744765 config RTC_DRV_DS1511
745766 tristate "Dallas DS1511"
767+ depends on HAS_IOMEM
746768 help
747769 If you say yes here you get support for the
748770 Dallas DS1511 timekeeping/watchdog chip.
@@ -752,6 +774,7 @@ config RTC_DRV_DS1511 · 3 unmodified lines
752774
753775 config RTC_DRV_DS1553
754776 tristate "Maxim/Dallas DS1553"
777+ depends on HAS_IOMEM
755778 help
756779 If you say yes here you get support for the
757780 Maxim/Dallas DS1553 timekeeping chip.
@@ -761,6 +784,7 @@ config RTC_DRV_DS1553 · 3 unmodified lines
761784
762785 config RTC_DRV_DS1742
763786 tristate "Maxim/Dallas DS1742/1743"
787+ depends on HAS_IOMEM
764788 help
765789 If you say yes here you get support for the
766790 Maxim/Dallas DS1742/1743 timekeeping chip.
@@ -816,6 +840,7 @@ config RTC_DRV_EFI · 49 unmodified lines
816840
817841 config RTC_DRV_STK17TA8
818842 tristate "Simtek STK17TA8"
843+ depends on HAS_IOMEM
819844 help
820845 If you say yes here you get support for the
821846 Simtek STK17TA8 timekeeping chip.
@@ -834,6 +859,7 @@ config RTC_DRV_M48T86 · 12 unmodified lines
834859
835860 config RTC_DRV_M48T35
836861 tristate "ST M48T35"
862+ depends on HAS_IOMEM
837863 help
838864 If you say Y here you will get support for the
839865 ST M48T35 RTC chip.
@@ -843,6 +869,7 @@ config RTC_DRV_M48T35 · 3 unmodified lines
843869
844870 config RTC_DRV_M48T59
845871 tristate "ST M48T59/M48T08/M48T02"
872+ depends on HAS_IOMEM
846873 help
847874 If you say Y here you will get support for the
848875 ST M48T59 RTC chip and compatible ST M48T08 and M48T02.
@@ -855,6 +882,7 @@ config RTC_DRV_M48T59 · 6 unmodified lines
855882
856883 config RTC_DRV_MSM6242
857884 tristate "Oki MSM6242"
885+ depends on HAS_IOMEM
858886 help
859887 If you say yes here you get support for the Oki MSM6242
860888 timekeeping chip. It is used in some Amiga models (e.g. A2000).
@@ -864,6 +892,7 @@ config RTC_DRV_MSM6242 · 3 unmodified lines
864892
865893 config RTC_DRV_BQ4802
866894 tristate "TI BQ4802"
895+ depends on HAS_IOMEM
867896 help
868897 If you say Y here you will get support for the TI
869898 BQ4802 RTC chip.
@@ -873,6 +902,7 @@ config RTC_DRV_BQ4802 · 3 unmodified lines
873902
874903 config RTC_DRV_RP5C01
875904 tristate "Ricoh RP5C01"
905+ depends on HAS_IOMEM
876906 help
877907 If you say yes here you get support for the Ricoh RP5C01
878908 timekeeping chip. It is used in some Amiga models (e.g. A3000
@@ -1374,6 +1404,7 @@ config RTC_DRV_MOXART · 495 unmodified lines
13741404
13751405 config RTC_DRV_XGENE
13761406 tristate "APM X-Gene RTC"
1407+ depends on HAS_IOMEM
13771408 help
13781409 If you say yes here you get support for the APM X-Gene SoC real time
13791410 clock.
drivers/rtc/Makefile+2−0
@@ -85,6 +85,7 @@ obj-$(CONFIG_RTC_DRV_MAX8998) += rtc-max8998.o · 84 unmodified lines
8585 obj-$(CONFIG_RTC_DRV_MAX8997) += rtc-max8997.o
8686 obj-$(CONFIG_RTC_DRV_MAX6902) += rtc-max6902.o
8787 obj-$(CONFIG_RTC_DRV_MAX77686) += rtc-max77686.o
88+obj-$(CONFIG_RTC_DRV_MAX77802) += rtc-max77802.o
8889 obj-$(CONFIG_RTC_DRV_MC13XXX) += rtc-mc13xxx.o
8990 obj-$(CONFIG_RTC_DRV_MCP795) += rtc-mcp795.o
9091 obj-$(CONFIG_RTC_DRV_MSM6242) += rtc-msm6242.o
@@ -109,6 +110,7 @@ obj-$(CONFIG_RTC_DRV_PUV3) += rtc-puv3.o · 18 unmodified lines
109110 obj-$(CONFIG_RTC_DRV_PXA) += rtc-pxa.o
110111 obj-$(CONFIG_RTC_DRV_R9701) += rtc-r9701.o
111112 obj-$(CONFIG_RTC_DRV_RC5T583) += rtc-rc5t583.o
113+obj-$(CONFIG_RTC_DRV_RK808) += rtc-rk808.o
112114 obj-$(CONFIG_RTC_DRV_RP5C01) += rtc-rp5c01.o
113115 obj-$(CONFIG_RTC_DRV_RS5C313) += rtc-rs5c313.o
114116 obj-$(CONFIG_RTC_DRV_RS5C348) += rtc-rs5c348.o
drivers/rtc/rtc-bq32k.c+62−0
@@ -2,10 +2,14 @@ · 1 unmodified line
22 * Driver for TI BQ32000 RTC.
33 *
44 * Copyright (C) 2009 Semihalf.
5+ * Copyright (C) 2014 Pavel Machek <pavel@denx.de>
56 *
67 * This program is free software; you can redistribute it and/or modify
78 * it under the terms of the GNU General Public License version 2 as
89 * published by the Free Software Foundation.
10+ *
11+ * You can get hardware description at
12+ * http://www.ti.com/lit/ds/symlink/bq32000.pdf
913 */
1014
1115 #include <linux/module.h>
@@ -27,6 +31,10 @@ · 15 unmodified lines
2731 #define BQ32K_CENT 0x40 /* Century flag */
2832 #define BQ32K_CENT_EN 0x80 /* Century flag enable bit */
2933
34+#define BQ32K_CALIBRATION 0x07 /* CAL_CFG1, calibration and control */
35+#define BQ32K_TCH2 0x08 /* Trickle charge enable */
36+#define BQ32K_CFG2 0x09 /* Trickle charger control */
37+
3038 struct bq32k_regs {
3139 uint8_t seconds;
3240 uint8_t minutes;
@@ -122,6 +130,57 @@ static const struct rtc_class_ops bq32k_rtc_ops = { · 89 unmodified lines
122130 .set_time = bq32k_rtc_set_time,
123131 };
124132
133+static int trickle_charger_of_init(struct device *dev, struct device_node *node)
134+{
135+ unsigned char reg;
136+ int error;
137+ u32 ohms = 0;
138+
139+ if (of_property_read_u32(node, "trickle-resistor-ohms" , &ohms))
140+ return 0;
141+
142+ switch (ohms) {
143+ case 180+940:
144+ /*
145+ * TCHE[3:0] == 0x05, TCH2 == 1, TCFE == 0 (charging
146+ * over diode and 940ohm resistor)
147+ */
148+
149+ if (of_property_read_bool(node, "trickle-diode-disable")) {
150+ dev_err(dev, "diode and resistor mismatch\n");
151+ return -EINVAL;
152+ }
153+ reg = 0x05;
154+ break;
155+
156+ case 180+20000:
157+ /* diode disabled */
158+
159+ if (!of_property_read_bool(node, "trickle-diode-disable")) {
160+ dev_err(dev, "bq32k: diode and resistor mismatch\n");
161+ return -EINVAL;
162+ }
163+ reg = 0x25;
164+ break;
165+
166+ default:
167+ dev_err(dev, "invalid resistor value (%d)\n", ohms);
168+ return -EINVAL;
169+ }
170+
171+ error = bq32k_write(dev, &reg, BQ32K_CFG2, 1);
172+ if (error)
173+ return error;
174+
175+ reg = 0x20;
176+ error = bq32k_write(dev, &reg, BQ32K_TCH2, 1);
177+ if (error)
178+ return error;
179+
180+ dev_info(dev, "Enabled trickle RTC battery charge.\n");
181+ return 0;
182+}
183+
125184 static int bq32k_probe(struct i2c_client *client,
126185 const struct i2c_device_id *id)
127186 {
@@ -153,6 +212,9 @@ static int bq32k_probe(struct i2c_client *client, · 25 unmodified lines
153212 if (error)
154213 return error;
155214
215+ if (client && client->dev.of_node)
216+ trickle_charger_of_init(dev, client->dev.of_node);
217+
156218 rtc = devm_rtc_device_register(&client->dev, bq32k_driver.driver.name,
157219 &bq32k_rtc_ops, THIS_MODULE);
158220 if (IS_ERR(rtc))
drivers/rtc/rtc-cmos.c+4−1
@@ -856,7 +856,7 @@ static void __exit cmos_do_remove(struct device *dev) · 855 unmodified lines
856856 cmos->dev = NULL;
857857 }
858858
859−#ifdef CONFIG_PM_SLEEP
859+#ifdef CONFIG_PM
860860
861861 static int cmos_suspend(struct device *dev)
862862 {
@@ -907,6 +907,8 @@ static inline int cmos_poweroff(struct device *dev) · 44 unmodified lines
907907 return cmos_suspend(dev);
908908 }
909909
910+#ifdef CONFIG_PM_SLEEP
911+
910912 static int cmos_resume(struct device *dev)
911913 {
912914 struct cmos_rtc *cmos = dev_get_drvdata(dev);
@@ -954,6 +956,7 @@ static int cmos_resume(struct device *dev) · 41 unmodified lines
954956 return 0;
955957 }
956958
959+#endif
957960 #else
958961
959962 static inline int cmos_poweroff(struct device *dev)
drivers/rtc/rtc-ds1307.c+63−4
@@ -126,9 +126,14 @@ struct chip_desc { · 125 unmodified lines
126126 u16 nvram_offset;
127127 u16 nvram_size;
128128 u16 trickle_charger_reg;
129+ u8 trickle_charger_setup;
130+ u8 (*do_trickle_setup)(struct i2c_client *, uint32_t, bool);
129131 };
130132
131−static const struct chip_desc chips[last_ds_type] = {
133+static u8 do_trickle_setup_ds1339(struct i2c_client *,
134+ uint32_t ohms, bool diode);
135+
136+static struct chip_desc chips[last_ds_type] = {
132137 [ds_1307] = {
133138 .nvram_offset = 8,
134139 .nvram_size = 56,
@@ -143,6 +148,7 @@ static const struct chip_desc chips[last_ds_type] = { · 8 unmodified lines
143148 [ds_1339] = {
144149 .alarm = 1,
145150 .trickle_charger_reg = 0x10,
151+ .do_trickle_setup = &do_trickle_setup_ds1339,
146152 },
147153 [ds_1340] = {
148154 .trickle_charger_reg = 0x08,
@@ -833,15 +839,58 @@ ds1307_nvram_write(struct file *filp, struct kobject *kobj, · 684 unmodified lines
833839 return count;
834840 }
835841
842+
836843 /*----------------------------------------------------------------------*/
837844
845+static u8 do_trickle_setup_ds1339(struct i2c_client *client,
846+ uint32_t ohms, bool diode)
847+{
848+ u8 setup = (diode) ? DS1307_TRICKLE_CHARGER_DIODE :
849+ DS1307_TRICKLE_CHARGER_NO_DIODE;
850+
851+ switch (ohms) {
852+ case 250:
853+ setup |= DS1307_TRICKLE_CHARGER_250_OHM;
854+ break;
855+ case 2000:
856+ setup |= DS1307_TRICKLE_CHARGER_2K_OHM;
857+ break;
858+ case 4000:
859+ setup |= DS1307_TRICKLE_CHARGER_4K_OHM;
860+ break;
861+ default:
862+ dev_warn(&client->dev,
863+ "Unsupported ohm value %u in dt\n", ohms);
864+ return 0;
865+ }
866+ return setup;
867+}
868+
869+static void ds1307_trickle_of_init(struct i2c_client *client,
870+ struct chip_desc *chip)
871+{
872+ uint32_t ohms = 0;
873+ bool diode = true;
874+
875+ if (!chip->do_trickle_setup)
876+ goto out;
877+ if (of_property_read_u32(client->dev.of_node, "trickle-resistor-ohms" , &ohms))
878+ goto out;
879+ if (of_property_read_bool(client->dev.of_node, "trickle-diode-disable"))
880+ diode = false;
881+ chip->trickle_charger_setup = chip->do_trickle_setup(client,
882+ ohms, diode);
883+out:
884+ return;
885+}
886+
838887 static int ds1307_probe(struct i2c_client *client,
839888 const struct i2c_device_id *id)
840889 {
841890 struct ds1307 *ds1307;
842891 int err = -ENODEV;
843892 int tmp;
844− const struct chip_desc *chip = &chips[id->driver_data];
893+ struct chip_desc *chip = &chips[id->driver_data];
845894 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
846895 bool want_irq = false;
847896 unsigned char *buf;
@@ -866,9 +915,19 @@ static int ds1307_probe(struct i2c_client *client, · 18 unmodified lines
866915 ds1307->client = client;
867916 ds1307->type = id->driver_data;
868917
869− if (pdata && pdata->trickle_charger_setup && chip->trickle_charger_reg)
918+ if (!pdata && client->dev.of_node)
919+ ds1307_trickle_of_init(client, chip);
920+ else if (pdata && pdata->trickle_charger_setup)
921+ chip->trickle_charger_setup = pdata->trickle_charger_setup;
922+
923+ if (chip->trickle_charger_setup && chip->trickle_charger_reg) {
924+ dev_dbg(&client->dev, "writing trickle charger info 0x%x to 0x%x\n",
925+ DS13XX_TRICKLE_CHARGER_MAGIC | chip->trickle_charger_setup,
926+ chip->trickle_charger_reg);
870927 i2c_smbus_write_byte_data(client, chip->trickle_charger_reg,
871− DS13XX_TRICKLE_CHARGER_MAGIC | pdata->trickle_charger_setup);
928+ DS13XX_TRICKLE_CHARGER_MAGIC |
929+ chip->trickle_charger_setup);
930+ }
872931
873932 buf = ds1307->regs;
874933 if (i2c_check_functionality(adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) {
drivers/rtc/rtc-isl12022.c+1−1
@@ -274,7 +274,7 @@ static int isl12022_probe(struct i2c_client *client, · 273 unmodified lines
274274 }
275275
276276 #ifdef CONFIG_OF
277−static struct of_device_id isl12022_dt_match[] = {
277+static const struct of_device_id isl12022_dt_match[] = {
278278 { .compatible = "isl,isl12022" },
279279 { },
280280 };
drivers/rtc/rtc-max77686.c+31−109
@@ -32,15 +32,6 @@ · 31 unmodified lines
3232 #define RTC_UDR_MASK (1 << RTC_UDR_SHIFT)
3333 #define RTC_RBUDR_SHIFT 4
3434 #define RTC_RBUDR_MASK (1 << RTC_RBUDR_SHIFT)
35−/* WTSR and SMPL Register */
36−#define WTSRT_SHIFT 0
37−#define SMPLT_SHIFT 2
38−#define WTSR_EN_SHIFT 6
39−#define SMPL_EN_SHIFT 7
40−#define WTSRT_MASK (3 << WTSRT_SHIFT)
41−#define SMPLT_MASK (3 << SMPLT_SHIFT)
42−#define WTSR_EN_MASK (1 << WTSR_EN_SHIFT)
43−#define SMPL_EN_MASK (1 << SMPL_EN_SHIFT)
4435 /* RTC Hour register */
4536 #define HOUR_PM_SHIFT 6
4637 #define HOUR_PM_MASK (1 << HOUR_PM_SHIFT)
@@ -49,7 +40,6 @@ · 2 unmodified lines
4940 #define ALARM_ENABLE_MASK (1 << ALARM_ENABLE_SHIFT)
5041
5142 #define MAX77686_RTC_UPDATE_DELAY 16
52−#undef MAX77686_RTC_WTSR_SMPL
5343
5444 enum {
5545 RTC_SEC = 0,
@@ -80,16 +70,6 @@ enum MAX77686_RTC_OP { · 24 unmodified lines
8070 MAX77686_RTC_READ,
8171 };
8272
83−static inline int max77686_rtc_calculate_wday(u8 shifted)
84−{
85− int counter = -1;
86− while (shifted) {
87− shifted >>= 1;
88− counter++;
89− }
90− return counter;
91−}
92−
9373 static void max77686_rtc_data_to_tm(u8 *data, struct rtc_time *tm,
9474 int rtc_24hr_mode)
9575 {
@@ -103,7 +83,8 @@ static void max77686_rtc_data_to_tm(u8 *data, struct rtc_time *tm, · 7 unmodified lines
10383 tm->tm_hour += 12;
10484 }
10585
106− tm->tm_wday = max77686_rtc_calculate_wday(data[RTC_WEEKDAY] & 0x7f);
86+ /* Only a single bit is set in data[], so fls() would be equivalent */
87+ tm->tm_wday = ffs(data[RTC_WEEKDAY] & 0x7f) - 1;
10788 tm->tm_mday = data[RTC_DATE] & 0x1f;
10889 tm->tm_mon = (data[RTC_MONTH] & 0x0f) - 1;
10990 tm->tm_year = (data[RTC_YEAR] & 0x7f) + 100;
@@ -412,64 +393,6 @@ static const struct rtc_class_ops max77686_rtc_ops = { · 302 unmodified lines
412393 .alarm_irq_enable = max77686_rtc_alarm_irq_enable,
413394 };
414395
415−#ifdef MAX77686_RTC_WTSR_SMPL
416−static void max77686_rtc_enable_wtsr(struct max77686_rtc_info *info, bool enable)
417−{
418− int ret;
419− unsigned int val, mask;
420−
421− if (enable)
422− val = (1 << WTSR_EN_SHIFT) | (3 << WTSRT_SHIFT);
423− else
424− val = 0;
425−
426− mask = WTSR_EN_MASK | WTSRT_MASK;
427−
428− dev_info(info->dev, "%s: %s WTSR\n", __func__,
429− enable ? "enable" : "disable");
430−
431− ret = regmap_update_bits(info->max77686->rtc_regmap,
432− MAX77686_WTSR_SMPL_CNTL, mask, val);
433− if (ret < 0) {
434− dev_err(info->dev, "%s: fail to update WTSR reg(%d)\n",
435− __func__, ret);
436− return;
437− }
438−
439− max77686_rtc_update(info, MAX77686_RTC_WRITE);
440−}
441−
442−static void max77686_rtc_enable_smpl(struct max77686_rtc_info *info, bool enable)
443−{
444− int ret;
445− unsigned int val, mask;
446−
447− if (enable)
448− val = (1 << SMPL_EN_SHIFT) | (0 << SMPLT_SHIFT);
449− else
450− val = 0;
451−
452− mask = SMPL_EN_MASK | SMPLT_MASK;
453−
454− dev_info(info->dev, "%s: %s SMPL\n", __func__,
455− enable ? "enable" : "disable");
456−
457− ret = regmap_update_bits(info->max77686->rtc_regmap,
458− MAX77686_WTSR_SMPL_CNTL, mask, val);
459− if (ret < 0) {
460− dev_err(info->dev, "%s: fail to update SMPL reg(%d)\n",
461− __func__, ret);
462− return;
463− }
464−
465− max77686_rtc_update(info, MAX77686_RTC_WRITE);
466−
467− val = 0;
468− regmap_read(info->max77686->rtc_regmap, MAX77686_WTSR_SMPL_CNTL, &val);
469− dev_info(info->dev, "%s: WTSR_SMPL(0x%02x)\n", __func__, val);
470−}
471−#endif /* MAX77686_RTC_WTSR_SMPL */
472−
473396 static int max77686_rtc_init_reg(struct max77686_rtc_info *info)
474397 {
475398 u8 data[2];
@@ -519,19 +442,12 @@ static int max77686_rtc_probe(struct platform_device *pdev) · 43 unmodified lines
519442 goto err_rtc;
520443 }
521444
522−#ifdef MAX77686_RTC_WTSR_SMPL
523− max77686_rtc_enable_wtsr(info, true);
524− max77686_rtc_enable_smpl(info, true);
525−#endif
526−
527445 device_init_wakeup(&pdev->dev, 1);
528446
529447 info->rtc_dev = devm_rtc_device_register(&pdev->dev, "max77686-rtc",
530448 &max77686_rtc_ops, THIS_MODULE);
531449
532450 if (IS_ERR(info->rtc_dev)) {
533− dev_info(&pdev->dev, "%s: fail\n", __func__);
534−
535451 ret = PTR_ERR(info->rtc_dev);
536452 dev_err(&pdev->dev, "Failed to register RTC device: %d\n", ret);
537453 if (ret == 0)
@@ -539,6 +455,12 @@ static int max77686_rtc_probe(struct platform_device *pdev) · 1 unmodified line
539455 goto err_rtc;
540456 }
541457
458+ if (!max77686->rtc_irq_data) {
459+ ret = -EINVAL;
460+ dev_err(&pdev->dev, "%s: no RTC regmap IRQ chip\n", __func__);
461+ goto err_rtc;
462+ }
463+
542464 info->virq = regmap_irq_get_virq(max77686->rtc_irq_data,
543465 MAX77686_RTCIRQ_RTCA1);
544466 if (!info->virq) {
@@ -556,33 +478,33 @@ err_rtc: · 11 unmodified lines
556478 return ret;
557479 }
558480
559−static void max77686_rtc_shutdown(struct platform_device *pdev)
481+#ifdef CONFIG_PM_SLEEP
482+static int max77686_rtc_suspend(struct device *dev)
560483 {
561−#ifdef MAX77686_RTC_WTSR_SMPL
562− struct max77686_rtc_info *info = platform_get_drvdata(pdev);
563− int i;
564− u8 val = 0;
565−
566− for (i = 0; i < 3; i++) {
567− max77686_rtc_enable_wtsr(info, false);
568− regmap_read(info->max77686->rtc_regmap, MAX77686_WTSR_SMPL_CNTL, &val);
569− dev_info(info->dev, "%s: WTSR_SMPL reg(0x%02x)\n", __func__,
570− val);
571− if (val & WTSR_EN_MASK) {
572− dev_emerg(info->dev, "%s: fail to disable WTSR\n",
573− __func__);
574− } else {
575− dev_info(info->dev, "%s: success to disable WTSR\n",
576− __func__);
577− break;
578− }
484+ if (device_may_wakeup(dev)) {
485+ struct max77686_rtc_info *info = dev_get_drvdata(dev);
486+
487+ return enable_irq_wake(info->virq);
579488 }
580489
581− /* Disable SMPL when power off */
582− max77686_rtc_enable_smpl(info, false);
583−#endif /* MAX77686_RTC_WTSR_SMPL */
490+ return 0;
584491 }
585492
493+static int max77686_rtc_resume(struct device *dev)
494+{
495+ if (device_may_wakeup(dev)) {
496+ struct max77686_rtc_info *info = dev_get_drvdata(dev);
497+
498+ return disable_irq_wake(info->virq);
499+ }
500+
501+ return 0;
502+}
503+#endif
504+
505+static SIMPLE_DEV_PM_OPS(max77686_rtc_pm_ops,
506+ max77686_rtc_suspend, max77686_rtc_resume);
507+
586508 static const struct platform_device_id rtc_id[] = {
587509 { "max77686-rtc", 0 },
588510 {},
@@ -592,9 +514,9 @@ static struct platform_driver max77686_rtc_driver = { · 3 unmodified lines
592514 .driver = {
593515 .name = "max77686-rtc",
594516 .owner = THIS_MODULE,
517+ .pm = &max77686_rtc_pm_ops,
595518 },
596519 .probe = max77686_rtc_probe,
597− .shutdown = max77686_rtc_shutdown,
598520 .id_table = rtc_id,
599521 };
600522
drivers/rtc/rtc-max77802.c+502−0
@@ -0,0 +1,502 @@
1+/*
2+ * RTC driver for Maxim MAX77802
3+ *
4+ * Copyright (C) 2013 Google, Inc
5+ *
6+ * Copyright (C) 2012 Samsung Electronics Co.Ltd
7+ *
8+ * based on rtc-max8997.c
9+ *
10+ * This program is free software; you can redistribute it and/or modify it
11+ * under the terms of the GNU General Public License as published by the
12+ * Free Software Foundation; either version 2 of the License, or (at your
13+ * option) any later version.
14+ *
15+ */
16+
17+#include <linux/slab.h>
18+#include <linux/rtc.h>
19+#include <linux/delay.h>
20+#include <linux/mutex.h>
21+#include <linux/module.h>
22+#include <linux/platform_device.h>
23+#include <linux/mfd/max77686-private.h>
24+#include <linux/irqdomain.h>
25+#include <linux/regmap.h>
26+
27+/* RTC Control Register */
28+#define BCD_EN_SHIFT 0
29+#define BCD_EN_MASK (1 << BCD_EN_SHIFT)
30+#define MODEL24_SHIFT 1
31+#define MODEL24_MASK (1 << MODEL24_SHIFT)
32+/* RTC Update Register1 */
33+#define RTC_UDR_SHIFT 0
34+#define RTC_UDR_MASK (1 << RTC_UDR_SHIFT)
35+#define RTC_RBUDR_SHIFT 4
36+#define RTC_RBUDR_MASK (1 << RTC_RBUDR_SHIFT)
37+/* RTC Hour register */
38+#define HOUR_PM_SHIFT 6
39+#define HOUR_PM_MASK (1 << HOUR_PM_SHIFT)
40+/* RTC Alarm Enable */
41+#define ALARM_ENABLE_SHIFT 7
42+#define ALARM_ENABLE_MASK (1 << ALARM_ENABLE_SHIFT)
43+
44+/* For the RTCAE1 register, we write this value to enable the alarm */
45+#define ALARM_ENABLE_VALUE 0x77
46+
47+#define MAX77802_RTC_UPDATE_DELAY_US 200
48+
49+enum {
50+ RTC_SEC = 0,
51+ RTC_MIN,
52+ RTC_HOUR,
53+ RTC_WEEKDAY,
54+ RTC_MONTH,
55+ RTC_YEAR,
56+ RTC_DATE,
57+ RTC_NR_TIME
58+};
59+
60+struct max77802_rtc_info {
61+ struct device *dev;
62+ struct max77686_dev *max77802;
63+ struct i2c_client *rtc;
64+ struct rtc_device *rtc_dev;
65+ struct mutex lock;
66+
67+ struct regmap *regmap;
68+
69+ int virq;
70+ int rtc_24hr_mode;
71+};
72+
73+enum MAX77802_RTC_OP {
74+ MAX77802_RTC_WRITE,
75+ MAX77802_RTC_READ,
76+};
77+
78+static void max77802_rtc_data_to_tm(u8 *data, struct rtc_time *tm,
79+ int rtc_24hr_mode)
80+{
81+ tm->tm_sec = data[RTC_SEC] & 0xff;
82+ tm->tm_min = data[RTC_MIN] & 0xff;
83+ if (rtc_24hr_mode)
84+ tm->tm_hour = data[RTC_HOUR] & 0x1f;
85+ else {
86+ tm->tm_hour = data[RTC_HOUR] & 0x0f;
87+ if (data[RTC_HOUR] & HOUR_PM_MASK)
88+ tm->tm_hour += 12;
89+ }
90+
91+ /* Only a single bit is set in data[], so fls() would be equivalent */
92+ tm->tm_wday = ffs(data[RTC_WEEKDAY] & 0xff) - 1;
93+ tm->tm_mday = data[RTC_DATE] & 0x1f;
94+ tm->tm_mon = (data[RTC_MONTH] & 0x0f) - 1;
95+
96+ tm->tm_year = data[RTC_YEAR] & 0xff;
97+ tm->tm_yday = 0;
98+ tm->tm_isdst = 0;
99+}
100+
101+static int max77802_rtc_tm_to_data(struct rtc_time *tm, u8 *data)
102+{
103+ data[RTC_SEC] = tm->tm_sec;
104+ data[RTC_MIN] = tm->tm_min;
105+ data[RTC_HOUR] = tm->tm_hour;
106+ data[RTC_WEEKDAY] = 1 << tm->tm_wday;
107+ data[RTC_DATE] = tm->tm_mday;
108+ data[RTC_MONTH] = tm->tm_mon + 1;
109+ data[RTC_YEAR] = tm->tm_year;
110+
111+ return 0;
112+}
113+
114+static int max77802_rtc_update(struct max77802_rtc_info *info,
115+ enum MAX77802_RTC_OP op)
116+{
117+ int ret;
118+ unsigned int data;
119+
120+ if (op == MAX77802_RTC_WRITE)
121+ data = 1 << RTC_UDR_SHIFT;
122+ else
123+ data = 1 << RTC_RBUDR_SHIFT;
124+
125+ ret = regmap_update_bits(info->max77802->regmap,
126+ MAX77802_RTC_UPDATE0, data, data);
127+ if (ret < 0)
128+ dev_err(info->dev, "%s: fail to write update reg(ret=%d, data=0x%x)\n",
129+ __func__, ret, data);
130+ else {
131+ /* Minimum delay required before RTC update. */
132+ usleep_range(MAX77802_RTC_UPDATE_DELAY_US,
133+ MAX77802_RTC_UPDATE_DELAY_US * 2);
134+ }
135+
136+ return ret;
137+}
138+
139+static int max77802_rtc_read_time(struct device *dev, struct rtc_time *tm)
140+{
141+ struct max77802_rtc_info *info = dev_get_drvdata(dev);
142+ u8 data[RTC_NR_TIME];
143+ int ret;
144+
145+ mutex_lock(&info->lock);
146+
147+ ret = max77802_rtc_update(info, MAX77802_RTC_READ);
148+ if (ret < 0)
149+ goto out;
150+
151+ ret = regmap_bulk_read(info->max77802->regmap,
152+ MAX77802_RTC_SEC, data, RTC_NR_TIME);
153+ if (ret < 0) {
154+ dev_err(info->dev, "%s: fail to read time reg(%d)\n", __func__,
155+ ret);
156+ goto out;
157+ }
158+
159+ max77802_rtc_data_to_tm(data, tm, info->rtc_24hr_mode);
160+
161+ ret = rtc_valid_tm(tm);
162+
163+out:
164+ mutex_unlock(&info->lock);
165+ return ret;
166+}
167+
168+static int max77802_rtc_set_time(struct device *dev, struct rtc_time *tm)
169+{
170+ struct max77802_rtc_info *info = dev_get_drvdata(dev);
171+ u8 data[RTC_NR_TIME];
172+ int ret;
173+
174+ ret = max77802_rtc_tm_to_data(tm, data);
175+ if (ret < 0)
176+ return ret;
177+
178+ mutex_lock(&info->lock);
179+
180+ ret = regmap_bulk_write(info->max77802->regmap,
181+ MAX77802_RTC_SEC, data, RTC_NR_TIME);
182+ if (ret < 0) {
183+ dev_err(info->dev, "%s: fail to write time reg(%d)\n", __func__,
184+ ret);
185+ goto out;
186+ }
187+
188+ ret = max77802_rtc_update(info, MAX77802_RTC_WRITE);
189+
190+out:
191+ mutex_unlock(&info->lock);
192+ return ret;
193+}
194+
195+static int max77802_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
196+{
197+ struct max77802_rtc_info *info = dev_get_drvdata(dev);
198+ u8 data[RTC_NR_TIME];
199+ unsigned int val;
200+ int ret;
201+
202+ mutex_lock(&info->lock);
203+
204+ ret = max77802_rtc_update(info, MAX77802_RTC_READ);
205+ if (ret < 0)
206+ goto out;
207+
208+ ret = regmap_bulk_read(info->max77802->regmap,
209+ MAX77802_ALARM1_SEC, data, RTC_NR_TIME);
210+ if (ret < 0) {
211+ dev_err(info->dev, "%s:%d fail to read alarm reg(%d)\n",
212+ __func__, __LINE__, ret);
213+ goto out;
214+ }
215+
216+ max77802_rtc_data_to_tm(data, &alrm->time, info->rtc_24hr_mode);
217+
218+ alrm->enabled = 0;
219+ ret = regmap_read(info->max77802->regmap,
220+ MAX77802_RTC_AE1, &val);
221+ if (ret < 0) {
222+ dev_err(info->dev, "%s:%d fail to read alarm enable(%d)\n",
223+ __func__, __LINE__, ret);
224+ goto out;
225+ }
226+ if (val)
227+ alrm->enabled = 1;
228+
229+ alrm->pending = 0;
230+ ret = regmap_read(info->max77802->regmap, MAX77802_REG_STATUS2, &val);
231+ if (ret < 0) {
232+ dev_err(info->dev, "%s:%d fail to read status2 reg(%d)\n",
233+ __func__, __LINE__, ret);
234+ goto out;
235+ }
236+
237+ if (val & (1 << 2)) /* RTCA1 */
238+ alrm->pending = 1;
239+
240+out:
241+ mutex_unlock(&info->lock);
242+ return 0;
243+}
244+
245+static int max77802_rtc_stop_alarm(struct max77802_rtc_info *info)
246+{
247+ int ret;
248+
249+ if (!mutex_is_locked(&info->lock))
250+ dev_warn(info->dev, "%s: should have mutex locked\n", __func__);
251+
252+ ret = max77802_rtc_update(info, MAX77802_RTC_READ);
253+ if (ret < 0)
254+ goto out;
255+
256+ ret = regmap_write(info->max77802->regmap,
257+ MAX77802_RTC_AE1, 0);
258+ if (ret < 0) {
259+ dev_err(info->dev, "%s: fail to write alarm reg(%d)\n",
260+ __func__, ret);
261+ goto out;
262+ }
263+
264+ ret = max77802_rtc_update(info, MAX77802_RTC_WRITE);
265+out:
266+ return ret;
267+}
268+
269+static int max77802_rtc_start_alarm(struct max77802_rtc_info *info)
270+{
271+ int ret;
272+
273+ if (!mutex_is_locked(&info->lock))
274+ dev_warn(info->dev, "%s: should have mutex locked\n",
275+ __func__);
276+
277+ ret = max77802_rtc_update(info, MAX77802_RTC_READ);
278+ if (ret < 0)
279+ goto out;
280+
281+ ret = regmap_write(info->max77802->regmap,
282+ MAX77802_RTC_AE1,
283+ ALARM_ENABLE_VALUE);
284+
285+ if (ret < 0) {
286+ dev_err(info->dev, "%s: fail to read alarm reg(%d)\n",
287+ __func__, ret);
288+ goto out;
289+ }
290+
291+ ret = max77802_rtc_update(info, MAX77802_RTC_WRITE);
292+out:
293+ return ret;
294+}
295+
296+static int max77802_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
297+{
298+ struct max77802_rtc_info *info = dev_get_drvdata(dev);
299+ u8 data[RTC_NR_TIME];
300+ int ret;
301+
302+ ret = max77802_rtc_tm_to_data(&alrm->time, data);
303+ if (ret < 0)
304+ return ret;
305+
306+ mutex_lock(&info->lock);
307+
308+ ret = max77802_rtc_stop_alarm(info);
309+ if (ret < 0)
310+ goto out;
311+
312+ ret = regmap_bulk_write(info->max77802->regmap,
313+ MAX77802_ALARM1_SEC, data, RTC_NR_TIME);
314+
315+ if (ret < 0) {
316+ dev_err(info->dev, "%s: fail to write alarm reg(%d)\n",
317+ __func__, ret);
318+ goto out;
319+ }
320+
321+ ret = max77802_rtc_update(info, MAX77802_RTC_WRITE);
322+ if (ret < 0)
323+ goto out;
324+
325+ if (alrm->enabled)
326+ ret = max77802_rtc_start_alarm(info);
327+out:
328+ mutex_unlock(&info->lock);
329+ return ret;
330+}
331+
332+static int max77802_rtc_alarm_irq_enable(struct device *dev,
333+ unsigned int enabled)
334+{
335+ struct max77802_rtc_info *info = dev_get_drvdata(dev);
336+ int ret;
337+
338+ mutex_lock(&info->lock);
339+ if (enabled)
340+ ret = max77802_rtc_start_alarm(info);
341+ else
342+ ret = max77802_rtc_stop_alarm(info);
343+ mutex_unlock(&info->lock);
344+
345+ return ret;
346+}
347+
348+static irqreturn_t max77802_rtc_alarm_irq(int irq, void *data)
349+{
350+ struct max77802_rtc_info *info = data;
351+
352+ dev_dbg(info->dev, "%s:irq(%d)\n", __func__, irq);
353+
354+ rtc_update_irq(info->rtc_dev, 1, RTC_IRQF | RTC_AF);
355+
356+ return IRQ_HANDLED;
357+}
358+
359+static const struct rtc_class_ops max77802_rtc_ops = {
360+ .read_time = max77802_rtc_read_time,
361+ .set_time = max77802_rtc_set_time,
362+ .read_alarm = max77802_rtc_read_alarm,
363+ .set_alarm = max77802_rtc_set_alarm,
364+ .alarm_irq_enable = max77802_rtc_alarm_irq_enable,
365+};
366+
367+static int max77802_rtc_init_reg(struct max77802_rtc_info *info)
368+{
369+ u8 data[2];
370+ int ret;
371+
372+ max77802_rtc_update(info, MAX77802_RTC_READ);
373+
374+ /* Set RTC control register : Binary mode, 24hour mdoe */
375+ data[0] = (1 << BCD_EN_SHIFT) | (1 << MODEL24_SHIFT);
376+ data[1] = (0 << BCD_EN_SHIFT) | (1 << MODEL24_SHIFT);
377+
378+ info->rtc_24hr_mode = 1;
379+
380+ ret = regmap_bulk_write(info->max77802->regmap,
381+ MAX77802_RTC_CONTROLM, data, ARRAY_SIZE(data));
382+ if (ret < 0) {
383+ dev_err(info->dev, "%s: fail to write controlm reg(%d)\n",
384+ __func__, ret);
385+ return ret;
386+ }
387+
388+ ret = max77802_rtc_update(info, MAX77802_RTC_WRITE);
389+ return ret;
390+}
391+
392+static int max77802_rtc_probe(struct platform_device *pdev)
393+{
394+ struct max77686_dev *max77802 = dev_get_drvdata(pdev->dev.parent);
395+ struct max77802_rtc_info *info;
396+ int ret;
397+
398+ dev_dbg(&pdev->dev, "%s\n", __func__);
399+
400+ info = devm_kzalloc(&pdev->dev, sizeof(struct max77802_rtc_info),
401+ GFP_KERNEL);
402+ if (!info)
403+ return -ENOMEM;
404+
405+ mutex_init(&info->lock);
406+ info->dev = &pdev->dev;
407+ info->max77802 = max77802;
408+ info->rtc = max77802->i2c;
409+
410+ platform_set_drvdata(pdev, info);
411+
412+ ret = max77802_rtc_init_reg(info);
413+
414+ if (ret < 0) {
415+ dev_err(&pdev->dev, "Failed to initialize RTC reg:%d\n", ret);
416+ return ret;
417+ }
418+
419+ device_init_wakeup(&pdev->dev, 1);
420+
421+ info->rtc_dev = devm_rtc_device_register(&pdev->dev, "max77802-rtc",
422+ &max77802_rtc_ops, THIS_MODULE);
423+
424+ if (IS_ERR(info->rtc_dev)) {
425+ ret = PTR_ERR(info->rtc_dev);
426+ dev_err(&pdev->dev, "Failed to register RTC device: %d\n", ret);
427+ if (ret == 0)
428+ ret = -EINVAL;
429+ return ret;
430+ }
431+
432+ if (!max77802->rtc_irq_data) {
433+ dev_err(&pdev->dev, "No RTC regmap IRQ chip\n");
434+ return -EINVAL;
435+ }
436+
437+ info->virq = regmap_irq_get_virq(max77802->rtc_irq_data,
438+ MAX77686_RTCIRQ_RTCA1);
439+
440+ if (info->virq <= 0) {
441+ dev_err(&pdev->dev, "Failed to get virtual IRQ %d\n",
442+ MAX77686_RTCIRQ_RTCA1);
443+ return -EINVAL;
444+ }
445+
446+ ret = devm_request_threaded_irq(&pdev->dev, info->virq, NULL,
447+ max77802_rtc_alarm_irq, 0, "rtc-alarm1",
448+ info);
449+ if (ret < 0)
450+ dev_err(&pdev->dev, "Failed to request alarm IRQ: %d: %d\n",
451+ info->virq, ret);
452+
453+ return ret;
454+}
455+
456+#ifdef CONFIG_PM_SLEEP
457+static int max77802_rtc_suspend(struct device *dev)
458+{
459+ if (device_may_wakeup(dev)) {
460+ struct max77802_rtc_info *info = dev_get_drvdata(dev);
461+
462+ return enable_irq_wake(info->virq);
463+ }
464+
465+ return 0;
466+}
467+
468+static int max77802_rtc_resume(struct device *dev)
469+{
470+ if (device_may_wakeup(dev)) {
471+ struct max77802_rtc_info *info = dev_get_drvdata(dev);
472+
473+ return disable_irq_wake(info->virq);
474+ }
475+
476+ return 0;
477+}
478+#endif
479+
480+static SIMPLE_DEV_PM_OPS(max77802_rtc_pm_ops,
481+ max77802_rtc_suspend, max77802_rtc_resume);
482+
483+static const struct platform_device_id rtc_id[] = {
484+ { "max77802-rtc", 0 },
485+ {},
486+};
487+
488+static struct platform_driver max77802_rtc_driver = {
489+ .driver = {
490+ .name = "max77802-rtc",
491+ .owner = THIS_MODULE,
492+ .pm = &max77802_rtc_pm_ops,
493+ },
494+ .probe = max77802_rtc_probe,
495+ .id_table = rtc_id,
496+};
497+
498+module_platform_driver(max77802_rtc_driver);
499+
500+MODULE_DESCRIPTION("Maxim MAX77802 RTC driver");
501+MODULE_AUTHOR("Simon Glass <sjg@chromium.org>");
502+MODULE_LICENSE("GPL");
drivers/rtc/rtc-mpc5121.c+1−1
@@ -401,7 +401,7 @@ static int mpc5121_rtc_remove(struct platform_device *op) · 400 unmodified lines
401401 }
402402
403403 #ifdef CONFIG_OF
404−static struct of_device_id mpc5121_rtc_match[] = {
404+static const struct of_device_id mpc5121_rtc_match[] = {
405405 { .compatible = "fsl,mpc5121-rtc", },
406406 { .compatible = "fsl,mpc5200-rtc", },
407407 {},
drivers/rtc/rtc-pcf8563.c+2−2
@@ -167,8 +167,8 @@ static irqreturn_t pcf8563_irq(int irq, void *dev_id) · 166 unmodified lines
167167 char pending;
168168
169169 err = pcf8563_get_alarm_mode(pcf8563->client, NULL, &pending);
170− if (err < 0)
171− return err;
170+ if (err)
171+ return IRQ_NONE;
172172
173173 if (pending) {
174174 rtc_update_irq(pcf8563->rtc, 1, RTC_IRQF | RTC_AF);
drivers/rtc/rtc-pcf8583.c+15−3
@@ -176,7 +176,11 @@ static int pcf8583_rtc_read_time(struct device *dev, struct rtc_time *tm) · 175 unmodified lines
176176 {
177177 struct i2c_client *client = to_i2c_client(dev);
178178 unsigned char ctrl, year[2];
179− struct rtc_mem mem = { CMOS_YEAR, sizeof(year), year };
179+ struct rtc_mem mem = {
180+ .loc = CMOS_YEAR,
181+ .nr = sizeof(year),
182+ .data = year
183+ };
180184 int real_year, year_offset, err;
181185
182186 /*
@@ -222,8 +226,16 @@ static int pcf8583_rtc_set_time(struct device *dev, struct rtc_time *tm) · 39 unmodified lines
222226 {
223227 struct i2c_client *client = to_i2c_client(dev);
224228 unsigned char year[2], chk;
225− struct rtc_mem cmos_year = { CMOS_YEAR, sizeof(year), year };
226− struct rtc_mem cmos_check = { CMOS_CHECKSUM, 1, &chk };
229+ struct rtc_mem cmos_year = {
230+ .loc = CMOS_YEAR,
231+ .nr = sizeof(year),
232+ .data = year
233+ };
234+ struct rtc_mem cmos_check = {
235+ .loc = CMOS_CHECKSUM,
236+ .nr = 1,
237+ .data = &chk
238+ };
227239 unsigned int proper_year = tm->tm_year + 1900;
228240 int ret;
229241
drivers/rtc/rtc-rk808.c+414−0
@@ -0,0 +1,414 @@
1+/*
2+ * RTC driver for Rockchip RK808
3+ *
4+ * Copyright (c) 2014, Fuzhou Rockchip Electronics Co., Ltd
5+ *
6+ * Author: Chris Zhong <zyw@rock-chips.com>
7+ * Author: Zhang Qing <zhangqing@rock-chips.com>
8+ *
9+ * This program is free software; you can redistribute it and/or modify it
10+ * under the terms and conditions of the GNU General Public License,
11+ * version 2, as published by the Free Software Foundation.
12+ *
13+ * This program is distributed in the hope it will be useful, but WITHOUT
14+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
16+ * more details.
17+ */
18+
19+#include <linux/module.h>
20+#include <linux/kernel.h>
21+#include <linux/rtc.h>
22+#include <linux/bcd.h>
23+#include <linux/mfd/rk808.h>
24+#include <linux/platform_device.h>
25+#include <linux/i2c.h>
26+
27+/* RTC_CTRL_REG bitfields */
28+#define BIT_RTC_CTRL_REG_STOP_RTC_M BIT(0)
29+
30+/* RK808 has a shadowed register for saving a "frozen" RTC time.
31+ * When user setting "GET_TIME" to 1, the time will save in this shadowed
32+ * register. If set "READSEL" to 1, user read rtc time register, actually
33+ * get the time of that moment. If we need the real time, clr this bit.
34+ */
35+#define BIT_RTC_CTRL_REG_RTC_GET_TIME BIT(6)
36+#define BIT_RTC_CTRL_REG_RTC_READSEL_M BIT(7)
37+#define BIT_RTC_INTERRUPTS_REG_IT_ALARM_M BIT(3)
38+#define RTC_STATUS_MASK 0xFE
39+
40+#define SECONDS_REG_MSK 0x7F
41+#define MINUTES_REG_MAK 0x7F
42+#define HOURS_REG_MSK 0x3F
43+#define DAYS_REG_MSK 0x3F
44+#define MONTHS_REG_MSK 0x1F
45+#define YEARS_REG_MSK 0xFF
46+#define WEEKS_REG_MSK 0x7
47+
48+/* REG_SECONDS_REG through REG_YEARS_REG is how many registers? */
49+
50+#define NUM_TIME_REGS (RK808_WEEKS_REG - RK808_SECONDS_REG + 1)
51+#define NUM_ALARM_REGS (RK808_ALARM_YEARS_REG - RK808_ALARM_SECONDS_REG + 1)
52+
53+struct rk808_rtc {
54+ struct rk808 *rk808;
55+ struct rtc_device *rtc;
56+ int irq;
57+};
58+
59+/* Read current time and date in RTC */
60+static int rk808_rtc_readtime(struct device *dev, struct rtc_time *tm)
61+{
62+ struct rk808_rtc *rk808_rtc = dev_get_drvdata(dev);
63+ struct rk808 *rk808 = rk808_rtc->rk808;
64+ u8 rtc_data[NUM_TIME_REGS];
65+ int ret;
66+
67+ /* Force an update of the shadowed registers right now */
68+ ret = regmap_update_bits(rk808->regmap, RK808_RTC_CTRL_REG,
69+ BIT_RTC_CTRL_REG_RTC_GET_TIME,
70+ 0);
71+ if (ret) {
72+ dev_err(dev, "Failed to update bits rtc_ctrl: %d\n", ret);
73+ return ret;
74+ }
75+
76+ ret = regmap_update_bits(rk808->regmap, RK808_RTC_CTRL_REG,
77+ BIT_RTC_CTRL_REG_RTC_GET_TIME,
78+ BIT_RTC_CTRL_REG_RTC_GET_TIME);
79+ if (ret) {
80+ dev_err(dev, "Failed to update bits rtc_ctrl: %d\n", ret);
81+ return ret;
82+ }
83+
84+ ret = regmap_bulk_read(rk808->regmap, RK808_SECONDS_REG,
85+ rtc_data, NUM_TIME_REGS);
86+ if (ret) {
87+ dev_err(dev, "Failed to bulk read rtc_data: %d\n", ret);
88+ return ret;
89+ }
90+
91+ tm->tm_sec = bcd2bin(rtc_data[0] & SECONDS_REG_MSK);
92+ tm->tm_min = bcd2bin(rtc_data[1] & MINUTES_REG_MAK);
93+ tm->tm_hour = bcd2bin(rtc_data[2] & HOURS_REG_MSK);
94+ tm->tm_mday = bcd2bin(rtc_data[3] & DAYS_REG_MSK);
95+ tm->tm_mon = (bcd2bin(rtc_data[4] & MONTHS_REG_MSK)) - 1;
96+ tm->tm_year = (bcd2bin(rtc_data[5] & YEARS_REG_MSK)) + 100;
97+ tm->tm_wday = bcd2bin(rtc_data[6] & WEEKS_REG_MSK);
98+ dev_dbg(dev, "RTC date/time %4d-%02d-%02d(%d) %02d:%02d:%02d\n",
99+ 1900 + tm->tm_year, tm->tm_mon + 1, tm->tm_mday,
100+ tm->tm_wday, tm->tm_hour , tm->tm_min, tm->tm_sec);
101+
102+ return ret;
103+}
104+
105+/* Set current time and date in RTC */
106+static int rk808_rtc_set_time(struct device *dev, struct rtc_time *tm)
107+{
108+ struct rk808_rtc *rk808_rtc = dev_get_drvdata(dev);
109+ struct rk808 *rk808 = rk808_rtc->rk808;
110+ u8 rtc_data[NUM_TIME_REGS];
111+ int ret;
112+
113+ rtc_data[0] = bin2bcd(tm->tm_sec);
114+ rtc_data[1] = bin2bcd(tm->tm_min);
115+ rtc_data[2] = bin2bcd(tm->tm_hour);
116+ rtc_data[3] = bin2bcd(tm->tm_mday);
117+ rtc_data[4] = bin2bcd(tm->tm_mon + 1);
118+ rtc_data[5] = bin2bcd(tm->tm_year - 100);
119+ rtc_data[6] = bin2bcd(tm->tm_wday);
120+ dev_dbg(dev, "set RTC date/time %4d-%02d-%02d(%d) %02d:%02d:%02d\n",
121+ 1900 + tm->tm_year, tm->tm_mon + 1, tm->tm_mday,
122+ tm->tm_wday, tm->tm_hour , tm->tm_min, tm->tm_sec);
123+
124+ /* Stop RTC while updating the RTC registers */
125+ ret = regmap_update_bits(rk808->regmap, RK808_RTC_CTRL_REG,
126+ BIT_RTC_CTRL_REG_STOP_RTC_M,
127+ BIT_RTC_CTRL_REG_STOP_RTC_M);
128+ if (ret) {
129+ dev_err(dev, "Failed to update RTC control: %d\n", ret);
130+ return ret;
131+ }
132+
133+ ret = regmap_bulk_write(rk808->regmap, RK808_SECONDS_REG,
134+ rtc_data, NUM_TIME_REGS);
135+ if (ret) {
136+ dev_err(dev, "Failed to bull write rtc_data: %d\n", ret);
137+ return ret;
138+ }
139+ /* Start RTC again */
140+ ret = regmap_update_bits(rk808->regmap, RK808_RTC_CTRL_REG,
141+ BIT_RTC_CTRL_REG_STOP_RTC_M, 0);
142+ if (ret) {
143+ dev_err(dev, "Failed to update RTC control: %d\n", ret);
144+ return ret;
145+ }
146+ return 0;
147+}
148+
149+/* Read alarm time and date in RTC */
150+static int rk808_rtc_readalarm(struct device *dev, struct rtc_wkalrm *alrm)
151+{
152+ struct rk808_rtc *rk808_rtc = dev_get_drvdata(dev);
153+ struct rk808 *rk808 = rk808_rtc->rk808;
154+ u8 alrm_data[NUM_ALARM_REGS];
155+ uint32_t int_reg;
156+ int ret;
157+
158+ ret = regmap_bulk_read(rk808->regmap, RK808_ALARM_SECONDS_REG,
159+ alrm_data, NUM_ALARM_REGS);
160+
161+ alrm->time.tm_sec = bcd2bin(alrm_data[0] & SECONDS_REG_MSK);
162+ alrm->time.tm_min = bcd2bin(alrm_data[1] & MINUTES_REG_MAK);
163+ alrm->time.tm_hour = bcd2bin(alrm_data[2] & HOURS_REG_MSK);
164+ alrm->time.tm_mday = bcd2bin(alrm_data[3] & DAYS_REG_MSK);
165+ alrm->time.tm_mon = (bcd2bin(alrm_data[4] & MONTHS_REG_MSK)) - 1;
166+ alrm->time.tm_year = (bcd2bin(alrm_data[5] & YEARS_REG_MSK)) + 100;
167+
168+ ret = regmap_read(rk808->regmap, RK808_RTC_INT_REG, &int_reg);
169+ if (ret) {
170+ dev_err(dev, "Failed to read RTC INT REG: %d\n", ret);
171+ return ret;
172+ }
173+
174+ dev_dbg(dev, "alrm read RTC date/time %4d-%02d-%02d(%d) %02d:%02d:%02d\n",
175+ 1900 + alrm->time.tm_year, alrm->time.tm_mon + 1,
176+ alrm->time.tm_mday, alrm->time.tm_wday, alrm->time.tm_hour,
177+ alrm->time.tm_min, alrm->time.tm_sec);
178+
179+ alrm->enabled = (int_reg & BIT_RTC_INTERRUPTS_REG_IT_ALARM_M) ? 1 : 0;
180+
181+ return 0;
182+}
183+
184+static int rk808_rtc_stop_alarm(struct rk808_rtc *rk808_rtc)
185+{
186+ struct rk808 *rk808 = rk808_rtc->rk808;
187+ int ret;
188+
189+ ret = regmap_update_bits(rk808->regmap, RK808_RTC_INT_REG,
190+ BIT_RTC_INTERRUPTS_REG_IT_ALARM_M, 0);
191+
192+ return ret;
193+}
194+
195+static int rk808_rtc_start_alarm(struct rk808_rtc *rk808_rtc)
196+{
197+ struct rk808 *rk808 = rk808_rtc->rk808;
198+ int ret;
199+
200+ ret = regmap_update_bits(rk808->regmap, RK808_RTC_INT_REG,
201+ BIT_RTC_INTERRUPTS_REG_IT_ALARM_M,
202+ BIT_RTC_INTERRUPTS_REG_IT_ALARM_M);
203+
204+ return ret;
205+}
206+
207+static int rk808_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
208+{
209+ struct rk808_rtc *rk808_rtc = dev_get_drvdata(dev);
210+ struct rk808 *rk808 = rk808_rtc->rk808;
211+ u8 alrm_data[NUM_ALARM_REGS];
212+ int ret;
213+
214+ ret = rk808_rtc_stop_alarm(rk808_rtc);
215+ if (ret) {
216+ dev_err(dev, "Failed to stop alarm: %d\n", ret);
217+ return ret;
218+ }
219+ dev_dbg(dev, "alrm set RTC date/time %4d-%02d-%02d(%d) %02d:%02d:%02d\n",
220+ 1900 + alrm->time.tm_year, alrm->time.tm_mon + 1,
221+ alrm->time.tm_mday, alrm->time.tm_wday, alrm->time.tm_hour,
222+ alrm->time.tm_min, alrm->time.tm_sec);
223+
224+ alrm_data[0] = bin2bcd(alrm->time.tm_sec);
225+ alrm_data[1] = bin2bcd(alrm->time.tm_min);
226+ alrm_data[2] = bin2bcd(alrm->time.tm_hour);
227+ alrm_data[3] = bin2bcd(alrm->time.tm_mday);
228+ alrm_data[4] = bin2bcd(alrm->time.tm_mon + 1);
229+ alrm_data[5] = bin2bcd(alrm->time.tm_year - 100);
230+
231+ ret = regmap_bulk_write(rk808->regmap, RK808_ALARM_SECONDS_REG,
232+ alrm_data, NUM_ALARM_REGS);
233+ if (ret) {
234+ dev_err(dev, "Failed to bulk write: %d\n", ret);
235+ return ret;
236+ }
237+ if (alrm->enabled) {
238+ ret = rk808_rtc_start_alarm(rk808_rtc);
239+ if (ret) {
240+ dev_err(dev, "Failed to start alarm: %d\n", ret);
241+ return ret;
242+ }
243+ }
244+ return 0;
245+}
246+
247+static int rk808_rtc_alarm_irq_enable(struct device *dev,
248+ unsigned int enabled)
249+{
250+ struct rk808_rtc *rk808_rtc = dev_get_drvdata(dev);
251+
252+ if (enabled)
253+ return rk808_rtc_start_alarm(rk808_rtc);
254+
255+ return rk808_rtc_stop_alarm(rk808_rtc);
256+}
257+
258+/*
259+ * We will just handle setting the frequency and make use the framework for
260+ * reading the periodic interupts.
261+ *
262+ * @freq: Current periodic IRQ freq:
263+ * bit 0: every second
264+ * bit 1: every minute
265+ * bit 2: every hour
266+ * bit 3: every day
267+ */
268+static irqreturn_t rk808_alarm_irq(int irq, void *data)
269+{
270+ struct rk808_rtc *rk808_rtc = data;
271+ struct rk808 *rk808 = rk808_rtc->rk808;
272+ struct i2c_client *client = rk808->i2c;
273+ int ret;
274+
275+ ret = regmap_write(rk808->regmap, RK808_RTC_STATUS_REG,
276+ RTC_STATUS_MASK);
277+ if (ret) {
278+ dev_err(&client->dev,
279+ "%s:Failed to update RTC status: %d\n", __func__, ret);
280+ return ret;
281+ }
282+
283+ rtc_update_irq(rk808_rtc->rtc, 1, RTC_IRQF | RTC_AF);
284+ dev_dbg(&client->dev,
285+ "%s:irq=%d\n", __func__, irq);
286+ return IRQ_HANDLED;
287+}
288+
289+static const struct rtc_class_ops rk808_rtc_ops = {
290+ .read_time = rk808_rtc_readtime,
291+ .set_time = rk808_rtc_set_time,
292+ .read_alarm = rk808_rtc_readalarm,
293+ .set_alarm = rk808_rtc_setalarm,
294+ .alarm_irq_enable = rk808_rtc_alarm_irq_enable,
295+};
296+
297+#ifdef CONFIG_PM_SLEEP
298+/* Turn off the alarm if it should not be a wake source. */
299+static int rk808_rtc_suspend(struct device *dev)
300+{
301+ struct platform_device *pdev = to_platform_device(dev);
302+ struct rk808_rtc *rk808_rtc = dev_get_drvdata(&pdev->dev);
303+
304+ if (device_may_wakeup(dev))
305+ enable_irq_wake(rk808_rtc->irq);
306+
307+ return 0;
308+}
309+
310+/* Enable the alarm if it should be enabled (in case it was disabled to
311+ * prevent use as a wake source).
312+ */
313+static int rk808_rtc_resume(struct device *dev)
314+{
315+ struct platform_device *pdev = to_platform_device(dev);
316+ struct rk808_rtc *rk808_rtc = dev_get_drvdata(&pdev->dev);
317+
318+ if (device_may_wakeup(dev))
319+ disable_irq_wake(rk808_rtc->irq);
320+
321+ return 0;
322+}
323+#endif
324+
325+static SIMPLE_DEV_PM_OPS(rk808_rtc_pm_ops,
326+ rk808_rtc_suspend, rk808_rtc_resume);
327+
328+static int rk808_rtc_probe(struct platform_device *pdev)
329+{
330+ struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent);
331+ struct rk808_rtc *rk808_rtc;
332+ struct rtc_time tm;
333+ int ret;
334+
335+ rk808_rtc = devm_kzalloc(&pdev->dev, sizeof(*rk808_rtc), GFP_KERNEL);
336+ if (rk808_rtc == NULL)
337+ return -ENOMEM;
338+
339+ platform_set_drvdata(pdev, rk808_rtc);
340+ rk808_rtc->rk808 = rk808;
341+
342+ /* start rtc running by default, and use shadowed timer. */
343+ ret = regmap_update_bits(rk808->regmap, RK808_RTC_CTRL_REG,
344+ BIT_RTC_CTRL_REG_STOP_RTC_M |
345+ BIT_RTC_CTRL_REG_RTC_READSEL_M,
346+ BIT_RTC_CTRL_REG_RTC_READSEL_M);
347+ if (ret) {
348+ dev_err(&pdev->dev,
349+ "Failed to update RTC control: %d\n", ret);
350+ return ret;
351+ }
352+
353+ ret = regmap_write(rk808->regmap, RK808_RTC_STATUS_REG,
354+ RTC_STATUS_MASK);
355+ if (ret) {
356+ dev_err(&pdev->dev,
357+ "Failed to write RTC status: %d\n", ret);
358+ return ret;
359+ }
360+
361+ /* set init time */
362+ ret = rk808_rtc_readtime(&pdev->dev, &tm);
363+ if (ret) {
364+ dev_err(&pdev->dev, "Failed to read RTC time\n");
365+ return ret;
366+ }
367+ ret = rtc_valid_tm(&tm);
368+ if (ret)
369+ dev_warn(&pdev->dev, "invalid date/time\n");
370+
371+ device_init_wakeup(&pdev->dev, 1);
372+
373+ rk808_rtc->rtc = devm_rtc_device_register(&pdev->dev, "rk808-rtc",
374+ &rk808_rtc_ops, THIS_MODULE);
375+ if (IS_ERR(rk808_rtc->rtc)) {
376+ ret = PTR_ERR(rk808_rtc->rtc);
377+ return ret;
378+ }
379+
380+ rk808_rtc->irq = platform_get_irq(pdev, 0);
381+ if (rk808_rtc->irq < 0) {
382+ if (rk808_rtc->irq != -EPROBE_DEFER)
383+ dev_err(&pdev->dev, "Wake up is not possible as irq = %d\n",
384+ rk808_rtc->irq);
385+ return rk808_rtc->irq;
386+ }
387+
388+ /* request alarm irq of rk808 */
389+ ret = devm_request_threaded_irq(&pdev->dev, rk808_rtc->irq, NULL,
390+ rk808_alarm_irq, 0,
391+ "RTC alarm", rk808_rtc);
392+ if (ret) {
393+ dev_err(&pdev->dev, "Failed to request alarm IRQ %d: %d\n",
394+ rk808_rtc->irq, ret);
395+ }
396+
397+ return ret;
398+}
399+
400+static struct platform_driver rk808_rtc_driver = {
401+ .probe = rk808_rtc_probe,
402+ .driver = {
403+ .name = "rk808-rtc",
404+ .pm = &rk808_rtc_pm_ops,
405+ },
406+};
407+
408+module_platform_driver(rk808_rtc_driver);
409+
410+MODULE_DESCRIPTION("RTC driver for the rk808 series PMICs");
411+MODULE_AUTHOR("Chris Zhong <zyw@rock-chips.com>");
412+MODULE_AUTHOR("Zhang Qing <zhangqing@rock-chips.com>");
413+MODULE_LICENSE("GPL");
414+MODULE_ALIAS("platform:rk808-rtc");
drivers/rtc/rtc-rs5c372.c+5−6
@@ -142,12 +142,11 @@ static int rs5c_get_regs(struct rs5c372 *rs5c) · 141 unmodified lines
142142 }
143143
144144 dev_dbg(&client->dev,
145− "%02x %02x %02x (%02x) %02x %02x %02x (%02x), "
146− "%02x %02x %02x, %02x %02x %02x; %02x %02x\n",
147− rs5c->regs[0], rs5c->regs[1], rs5c->regs[2], rs5c->regs[3],
148− rs5c->regs[4], rs5c->regs[5], rs5c->regs[6], rs5c->regs[7],
149− rs5c->regs[8], rs5c->regs[9], rs5c->regs[10], rs5c->regs[11],
150− rs5c->regs[12], rs5c->regs[13], rs5c->regs[14], rs5c->regs[15]);
145+ "%3ph (%02x) %3ph (%02x), %3ph, %3ph; %02x %02x\n",
146+ rs5c->regs + 0, rs5c->regs[3],
147+ rs5c->regs + 4, rs5c->regs[7],
148+ rs5c->regs + 8, rs5c->regs + 11,
149+ rs5c->regs[14], rs5c->regs[15]);
151150
152151 return 0;
153152 }
drivers/rtc/rtc-s3c.c+531−320
@@ -32,155 +32,150 @@ · 31 unmodified lines
3232 #include <asm/irq.h>
3333 #include "rtc-s3c.h"
3434
35−enum s3c_cpu_type {
36− TYPE_S3C2410,
37− TYPE_S3C2416,
38− TYPE_S3C2443,
39− TYPE_S3C64XX,
40−};
35+struct s3c_rtc {
36+ struct device *dev;
37+ struct rtc_device *rtc;
4138
42−struct s3c_rtc_drv_data {
43− int cpu_type;
44−};
39+ void __iomem *base;
40+ struct clk *rtc_clk;
41+ struct clk *rtc_src_clk;
42+ bool enabled;
43+
44+ struct s3c_rtc_data *data;
4545
46−/* I have yet to find an S3C implementation with more than one
47− * of these rtc blocks in */
46+ int irq_alarm;
47+ int irq_tick;
4848
49−static struct clk *rtc_clk;
50−static void __iomem *s3c_rtc_base;
51−static int s3c_rtc_alarmno;
52−static int s3c_rtc_tickno;
53−static enum s3c_cpu_type s3c_rtc_cpu_type;
49+ spinlock_t pie_lock;
50+ spinlock_t alarm_clk_lock;
5451
55−static DEFINE_SPINLOCK(s3c_rtc_pie_lock);
52+ int ticnt_save, ticnt_en_save;
53+ bool wake_en;
54+};
55+
56+struct s3c_rtc_data {
57+ int max_user_freq;
58+ bool needs_src_clk;
59+
60+ void (*irq_handler) (struct s3c_rtc *info, int mask);
61+ void (*set_freq) (struct s3c_rtc *info, int freq);
62+ void (*enable_tick) (struct s3c_rtc *info, struct seq_file *seq);
63+ void (*select_tick_clk) (struct s3c_rtc *info);
64+ void (*save_tick_cnt) (struct s3c_rtc *info);
65+ void (*restore_tick_cnt) (struct s3c_rtc *info);
66+ void (*enable) (struct s3c_rtc *info);
67+ void (*disable) (struct s3c_rtc *info);
68+};
5669
57−static void s3c_rtc_alarm_clk_enable(bool enable)
70+static void s3c_rtc_alarm_clk_enable(struct s3c_rtc *info, bool enable)
5871 {
59− static DEFINE_SPINLOCK(s3c_rtc_alarm_clk_lock);
60− static bool alarm_clk_enabled;
6172 unsigned long irq_flags;
6273
63− spin_lock_irqsave(&s3c_rtc_alarm_clk_lock, irq_flags);
74+ spin_lock_irqsave(&info->alarm_clk_lock, irq_flags);
6475 if (enable) {
65− if (!alarm_clk_enabled) {
66− clk_enable(rtc_clk);
67− alarm_clk_enabled = true;
76+ if (!info->enabled) {
77+ clk_enable(info->rtc_clk);
78+ if (info->data->needs_src_clk)
79+ clk_enable(info->rtc_src_clk);
80+ info->enabled = true;
6881 }
6982 } else {
70− if (alarm_clk_enabled) {
71− clk_disable(rtc_clk);
72− alarm_clk_enabled = false;
83+ if (info->enabled) {
84+ if (info->data->needs_src_clk)
85+ clk_disable(info->rtc_src_clk);
86+ clk_disable(info->rtc_clk);
87+ info->enabled = false;
7388 }
7489 }
75− spin_unlock_irqrestore(&s3c_rtc_alarm_clk_lock, irq_flags);
90+ spin_unlock_irqrestore(&info->alarm_clk_lock, irq_flags);
7691 }
7792
7893 /* IRQ Handlers */
79−
80−static irqreturn_t s3c_rtc_alarmirq(int irq, void *id)
94+static irqreturn_t s3c_rtc_tickirq(int irq, void *id)
8195 {
82− struct rtc_device *rdev = id;
83−
84− clk_enable(rtc_clk);
85− rtc_update_irq(rdev, 1, RTC_AF | RTC_IRQF);
86−
87− if (s3c_rtc_cpu_type == TYPE_S3C64XX)
88− writeb(S3C2410_INTP_ALM, s3c_rtc_base + S3C2410_INTP);
89−
90− clk_disable(rtc_clk);
96+ struct s3c_rtc *info = (struct s3c_rtc *)id;
9197
92− s3c_rtc_alarm_clk_enable(false);
98+ if (info->data->irq_handler)
99+ info->data->irq_handler(info, S3C2410_INTP_TIC);
93100
94101 return IRQ_HANDLED;
95102 }
96103
97−static irqreturn_t s3c_rtc_tickirq(int irq, void *id)
104+static irqreturn_t s3c_rtc_alarmirq(int irq, void *id)
98105 {
99− struct rtc_device *rdev = id;
106+ struct s3c_rtc *info = (struct s3c_rtc *)id;
100107
101− clk_enable(rtc_clk);
102− rtc_update_irq(rdev, 1, RTC_PF | RTC_IRQF);
108+ if (info->data->irq_handler)
109+ info->data->irq_handler(info, S3C2410_INTP_ALM);
103110
104− if (s3c_rtc_cpu_type == TYPE_S3C64XX)
105− writeb(S3C2410_INTP_TIC, s3c_rtc_base + S3C2410_INTP);
106−
107− clk_disable(rtc_clk);
108111 return IRQ_HANDLED;
109112 }
110113
111114 /* Update control registers */
112115 static int s3c_rtc_setaie(struct device *dev, unsigned int enabled)
113116 {
117+ struct s3c_rtc *info = dev_get_drvdata(dev);
114118 unsigned int tmp;
115119
116− dev_dbg(dev, "%s: aie=%d\n", __func__, enabled);
120+ dev_dbg(info->dev, "%s: aie=%d\n", __func__, enabled);
117121
118− clk_enable(rtc_clk);
119− tmp = readb(s3c_rtc_base + S3C2410_RTCALM) & ~S3C2410_RTCALM_ALMEN;
122+ clk_enable(info->rtc_clk);
123+ if (info->data->needs_src_clk)
124+ clk_enable(info->rtc_src_clk);
125+ tmp = readb(info->base + S3C2410_RTCALM) & ~S3C2410_RTCALM_ALMEN;
120126
121127 if (enabled)
122128 tmp |= S3C2410_RTCALM_ALMEN;
123129
124− writeb(tmp, s3c_rtc_base + S3C2410_RTCALM);
125− clk_disable(rtc_clk);
130+ writeb(tmp, info->base + S3C2410_RTCALM);
131+ if (info->data->needs_src_clk)
132+ clk_disable(info->rtc_src_clk);
133+ clk_disable(info->rtc_clk);
126134
127− s3c_rtc_alarm_clk_enable(enabled);
135+ s3c_rtc_alarm_clk_enable(info, enabled);
128136
129137 return 0;
130138 }
131139
132−static int s3c_rtc_setfreq(struct device *dev, int freq)
140+/* Set RTC frequency */
141+static int s3c_rtc_setfreq(struct s3c_rtc *info, int freq)
133142 {
134− struct platform_device *pdev = to_platform_device(dev);
135− struct rtc_device *rtc_dev = platform_get_drvdata(pdev);
136− unsigned int tmp = 0;
137− int val;
138−
139143 if (!is_power_of_2(freq))
140144 return -EINVAL;
141145
142− clk_enable(rtc_clk);
143− spin_lock_irq(&s3c_rtc_pie_lock);
146+ clk_enable(info->rtc_clk);
147+ if (info->data->needs_src_clk)
148+ clk_enable(info->rtc_src_clk);
149+ spin_lock_irq(&info->pie_lock);
144150
145− if (s3c_rtc_cpu_type != TYPE_S3C64XX) {
146− tmp = readb(s3c_rtc_base + S3C2410_TICNT);
147− tmp &= S3C2410_TICNT_ENABLE;
148− }
151+ if (info->data->set_freq)
152+ info->data->set_freq(info, freq);
149153
150− val = (rtc_dev->max_user_freq / freq) - 1;
151−
152− if (s3c_rtc_cpu_type == TYPE_S3C2416 || s3c_rtc_cpu_type == TYPE_S3C2443) {
153− tmp |= S3C2443_TICNT_PART(val);
154− writel(S3C2443_TICNT1_PART(val), s3c_rtc_base + S3C2443_TICNT1);
155−
156− if (s3c_rtc_cpu_type == TYPE_S3C2416)
157− writel(S3C2416_TICNT2_PART(val), s3c_rtc_base + S3C2416_TICNT2);
158− } else {
159− tmp |= val;
160− }
161−
162− writel(tmp, s3c_rtc_base + S3C2410_TICNT);
163− spin_unlock_irq(&s3c_rtc_pie_lock);
164− clk_disable(rtc_clk);
154+ spin_unlock_irq(&info->pie_lock);
155+ if (info->data->needs_src_clk)
156+ clk_disable(info->rtc_src_clk);
157+ clk_disable(info->rtc_clk);
165158
166159 return 0;
167160 }
168161
169162 /* Time read/write */
170−
171163 static int s3c_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm)
172164 {
165+ struct s3c_rtc *info = dev_get_drvdata(dev);
173166 unsigned int have_retried = 0;
174− void __iomem *base = s3c_rtc_base;
175167
176− clk_enable(rtc_clk);
168+ clk_enable(info->rtc_clk);
169+ if (info->data->needs_src_clk)
170+ clk_enable(info->rtc_src_clk);
171+
177172 retry_get_time:
178− rtc_tm->tm_min = readb(base + S3C2410_RTCMIN);
179− rtc_tm->tm_hour = readb(base + S3C2410_RTCHOUR);
180− rtc_tm->tm_mday = readb(base + S3C2410_RTCDATE);
181− rtc_tm->tm_mon = readb(base + S3C2410_RTCMON);
182− rtc_tm->tm_year = readb(base + S3C2410_RTCYEAR);
183− rtc_tm->tm_sec = readb(base + S3C2410_RTCSEC);
173+ rtc_tm->tm_min = readb(info->base + S3C2410_RTCMIN);
174+ rtc_tm->tm_hour = readb(info->base + S3C2410_RTCHOUR);
175+ rtc_tm->tm_mday = readb(info->base + S3C2410_RTCDATE);
176+ rtc_tm->tm_mon = readb(info->base + S3C2410_RTCMON);
177+ rtc_tm->tm_year = readb(info->base + S3C2410_RTCYEAR);
178+ rtc_tm->tm_sec = readb(info->base + S3C2410_RTCSEC);
184179
185180 /* the only way to work out whether the system was mid-update
186181 * when we read it is to check the second counter, and if it
@@ -207,13 +202,16 @@ static int s3c_rtc_gettime(struct device *dev, struct rtc_time *rtc_tm) · 20 unmodified lines
207202
208203 rtc_tm->tm_mon -= 1;
209204
210− clk_disable(rtc_clk);
205+ if (info->data->needs_src_clk)
206+ clk_disable(info->rtc_src_clk);
207+ clk_disable(info->rtc_clk);
208+
211209 return rtc_valid_tm(rtc_tm);
212210 }
213211
214212 static int s3c_rtc_settime(struct device *dev, struct rtc_time *tm)
215213 {
216− void __iomem *base = s3c_rtc_base;
214+ struct s3c_rtc *info = dev_get_drvdata(dev);
217215 int year = tm->tm_year - 100;
218216
219217 dev_dbg(dev, "set time %04d.%02d.%02d %02d:%02d:%02d\n",
@@ -227,33 +225,42 @@ static int s3c_rtc_settime(struct device *dev, struct rtc_time *tm) · 7 unmodified lines
227225 return -EINVAL;
228226 }
229227
230− clk_enable(rtc_clk);
231− writeb(bin2bcd(tm->tm_sec), base + S3C2410_RTCSEC);
232− writeb(bin2bcd(tm->tm_min), base + S3C2410_RTCMIN);
233− writeb(bin2bcd(tm->tm_hour), base + S3C2410_RTCHOUR);
234− writeb(bin2bcd(tm->tm_mday), base + S3C2410_RTCDATE);
235− writeb(bin2bcd(tm->tm_mon + 1), base + S3C2410_RTCMON);
236− writeb(bin2bcd(year), base + S3C2410_RTCYEAR);
237− clk_disable(rtc_clk);
228+ clk_enable(info->rtc_clk);
229+ if (info->data->needs_src_clk)
230+ clk_enable(info->rtc_src_clk);
231+
232+ writeb(bin2bcd(tm->tm_sec), info->base + S3C2410_RTCSEC);
233+ writeb(bin2bcd(tm->tm_min), info->base + S3C2410_RTCMIN);
234+ writeb(bin2bcd(tm->tm_hour), info->base + S3C2410_RTCHOUR);
235+ writeb(bin2bcd(tm->tm_mday), info->base + S3C2410_RTCDATE);
236+ writeb(bin2bcd(tm->tm_mon + 1), info->base + S3C2410_RTCMON);
237+ writeb(bin2bcd(year), info->base + S3C2410_RTCYEAR);
238+
239+ if (info->data->needs_src_clk)
240+ clk_disable(info->rtc_src_clk);
241+ clk_disable(info->rtc_clk);
238242
239243 return 0;
240244 }
241245
242246 static int s3c_rtc_getalarm(struct device *dev, struct rtc_wkalrm *alrm)
243247 {
248+ struct s3c_rtc *info = dev_get_drvdata(dev);
244249 struct rtc_time *alm_tm = &alrm->time;
245− void __iomem *base = s3c_rtc_base;
246250 unsigned int alm_en;
247251
248− clk_enable(rtc_clk);
249− alm_tm->tm_sec = readb(base + S3C2410_ALMSEC);
250− alm_tm->tm_min = readb(base + S3C2410_ALMMIN);
251− alm_tm->tm_hour = readb(base + S3C2410_ALMHOUR);
252− alm_tm->tm_mon = readb(base + S3C2410_ALMMON);
253− alm_tm->tm_mday = readb(base + S3C2410_ALMDATE);
254− alm_tm->tm_year = readb(base + S3C2410_ALMYEAR);
252+ clk_enable(info->rtc_clk);
253+ if (info->data->needs_src_clk)
254+ clk_enable(info->rtc_src_clk);
255255
256− alm_en = readb(base + S3C2410_RTCALM);
256+ alm_tm->tm_sec = readb(info->base + S3C2410_ALMSEC);
257+ alm_tm->tm_min = readb(info->base + S3C2410_ALMMIN);
258+ alm_tm->tm_hour = readb(info->base + S3C2410_ALMHOUR);
259+ alm_tm->tm_mon = readb(info->base + S3C2410_ALMMON);
260+ alm_tm->tm_mday = readb(info->base + S3C2410_ALMDATE);
261+ alm_tm->tm_year = readb(info->base + S3C2410_ALMYEAR);
262+
263+ alm_en = readb(info->base + S3C2410_RTCALM);
257264
258265 alrm->enabled = (alm_en & S3C2410_RTCALM_ALMEN) ? 1 : 0;
259266
@@ -297,65 +304,74 @@ static int s3c_rtc_getalarm(struct device *dev, struct rtc_wkalrm *alrm) · 37 unmodified lines
297304 else
298305 alm_tm->tm_year = -1;
299306
300− clk_disable(rtc_clk);
307+ if (info->data->needs_src_clk)
308+ clk_disable(info->rtc_src_clk);
309+ clk_disable(info->rtc_clk);
310+
301311 return 0;
302312 }
303313
304314 static int s3c_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm)
305315 {
316+ struct s3c_rtc *info = dev_get_drvdata(dev);
306317 struct rtc_time *tm = &alrm->time;
307− void __iomem *base = s3c_rtc_base;
308318 unsigned int alrm_en;
309319
310− clk_enable(rtc_clk);
320+ clk_enable(info->rtc_clk);
321+ if (info->data->needs_src_clk)
322+ clk_enable(info->rtc_src_clk);
323+
311324 dev_dbg(dev, "s3c_rtc_setalarm: %d, %04d.%02d.%02d %02d:%02d:%02d\n",
312325 alrm->enabled,
313326 1900 + tm->tm_year, tm->tm_mon + 1, tm->tm_mday,
314327 tm->tm_hour, tm->tm_min, tm->tm_sec);
315328
316− alrm_en = readb(base + S3C2410_RTCALM) & S3C2410_RTCALM_ALMEN;
317− writeb(0x00, base + S3C2410_RTCALM);
329+ alrm_en = readb(info->base + S3C2410_RTCALM) & S3C2410_RTCALM_ALMEN;
330+ writeb(0x00, info->base + S3C2410_RTCALM);
318331
319332 if (tm->tm_sec < 60 && tm->tm_sec >= 0) {
320333 alrm_en |= S3C2410_RTCALM_SECEN;
321− writeb(bin2bcd(tm->tm_sec), base + S3C2410_ALMSEC);
334+ writeb(bin2bcd(tm->tm_sec), info->base + S3C2410_ALMSEC);
322335 }
323336
324337 if (tm->tm_min < 60 && tm->tm_min >= 0) {
325338 alrm_en |= S3C2410_RTCALM_MINEN;
326− writeb(bin2bcd(tm->tm_min), base + S3C2410_ALMMIN);
339+ writeb(bin2bcd(tm->tm_min), info->base + S3C2410_ALMMIN);
327340 }
328341
329342 if (tm->tm_hour < 24 && tm->tm_hour >= 0) {
330343 alrm_en |= S3C2410_RTCALM_HOUREN;
331− writeb(bin2bcd(tm->tm_hour), base + S3C2410_ALMHOUR);
344+ writeb(bin2bcd(tm->tm_hour), info->base + S3C2410_ALMHOUR);
332345 }
333346
334347 dev_dbg(dev, "setting S3C2410_RTCALM to %08x\n", alrm_en);
335348
336− writeb(alrm_en, base + S3C2410_RTCALM);
349+ writeb(alrm_en, info->base + S3C2410_RTCALM);
337350
338351 s3c_rtc_setaie(dev, alrm->enabled);
339352
340− clk_disable(rtc_clk);
353+ if (info->data->needs_src_clk)
354+ clk_disable(info->rtc_src_clk);
355+ clk_disable(info->rtc_clk);
356+
341357 return 0;
342358 }
343359
344360 static int s3c_rtc_proc(struct device *dev, struct seq_file *seq)
345361 {
346− unsigned int ticnt;
362+ struct s3c_rtc *info = dev_get_drvdata(dev);
347363
348− clk_enable(rtc_clk);
349− if (s3c_rtc_cpu_type == TYPE_S3C64XX) {
350− ticnt = readw(s3c_rtc_base + S3C2410_RTCCON);
351− ticnt &= S3C64XX_RTCCON_TICEN;
352− } else {
353− ticnt = readb(s3c_rtc_base + S3C2410_TICNT);
354− ticnt &= S3C2410_TICNT_ENABLE;
355− }
364+ clk_enable(info->rtc_clk);
365+ if (info->data->needs_src_clk)
366+ clk_enable(info->rtc_src_clk);
367+
368+ if (info->data->enable_tick)
369+ info->data->enable_tick(info, seq);
370+
371+ if (info->data->needs_src_clk)
372+ clk_disable(info->rtc_src_clk);
373+ clk_disable(info->rtc_clk);
356374
357− seq_printf(seq, "periodic_IRQ\t: %s\n", ticnt ? "yes" : "no");
358− clk_disable(rtc_clk);
359375 return 0;
360376 }
361377
@@ -368,152 +384,199 @@ static const struct rtc_class_ops s3c_rtcops = { · 6 unmodified lines
368384 .alarm_irq_enable = s3c_rtc_setaie,
369385 };
370386
371−static void s3c_rtc_enable(struct platform_device *pdev, int en)
387+static void s3c24xx_rtc_enable(struct s3c_rtc *info)
372388 {
373− void __iomem *base = s3c_rtc_base;
374− unsigned int tmp;
389+ unsigned int con, tmp;
375390
376− if (s3c_rtc_base == NULL)
377− return;
378−
379− clk_enable(rtc_clk);
380− if (!en) {
381− tmp = readw(base + S3C2410_RTCCON);
382− if (s3c_rtc_cpu_type == TYPE_S3C64XX)
383− tmp &= ~S3C64XX_RTCCON_TICEN;
384− tmp &= ~S3C2410_RTCCON_RTCEN;
385− writew(tmp, base + S3C2410_RTCCON);
386−
387− if (s3c_rtc_cpu_type != TYPE_S3C64XX) {
388− tmp = readb(base + S3C2410_TICNT);
389− tmp &= ~S3C2410_TICNT_ENABLE;
390− writeb(tmp, base + S3C2410_TICNT);
391− }
392− } else {
393− /* re-enable the device, and check it is ok */
391+ clk_enable(info->rtc_clk);
392+ if (info->data->needs_src_clk)
393+ clk_enable(info->rtc_src_clk);
394394
395− if ((readw(base+S3C2410_RTCCON) & S3C2410_RTCCON_RTCEN) == 0) {
396− dev_info(&pdev->dev, "rtc disabled, re-enabling\n");
395+ con = readw(info->base + S3C2410_RTCCON);
396+ /* re-enable the device, and check it is ok */
397+ if ((con & S3C2410_RTCCON_RTCEN) == 0) {
398+ dev_info(info->dev, "rtc disabled, re-enabling\n");
397399
398− tmp = readw(base + S3C2410_RTCCON);
399− writew(tmp | S3C2410_RTCCON_RTCEN,
400− base + S3C2410_RTCCON);
401− }
400+ tmp = readw(info->base + S3C2410_RTCCON);
401+ writew(tmp | S3C2410_RTCCON_RTCEN,
402+ info->base + S3C2410_RTCCON);
403+ }
402404
403− if ((readw(base + S3C2410_RTCCON) & S3C2410_RTCCON_CNTSEL)) {
404− dev_info(&pdev->dev, "removing RTCCON_CNTSEL\n");
405+ if (con & S3C2410_RTCCON_CNTSEL) {
406+ dev_info(info->dev, "removing RTCCON_CNTSEL\n");
405407
406− tmp = readw(base + S3C2410_RTCCON);
407− writew(tmp & ~S3C2410_RTCCON_CNTSEL,
408− base + S3C2410_RTCCON);
409− }
408+ tmp = readw(info->base + S3C2410_RTCCON);
409+ writew(tmp & ~S3C2410_RTCCON_CNTSEL,
410+ info->base + S3C2410_RTCCON);
411+ }
410412
411− if ((readw(base + S3C2410_RTCCON) & S3C2410_RTCCON_CLKRST)) {
412− dev_info(&pdev->dev, "removing RTCCON_CLKRST\n");
413+ if (con & S3C2410_RTCCON_CLKRST) {
414+ dev_info(info->dev, "removing RTCCON_CLKRST\n");
413415
414− tmp = readw(base + S3C2410_RTCCON);
415− writew(tmp & ~S3C2410_RTCCON_CLKRST,
416− base + S3C2410_RTCCON);
417− }
416+ tmp = readw(info->base + S3C2410_RTCCON);
417+ writew(tmp & ~S3C2410_RTCCON_CLKRST,
418+ info->base + S3C2410_RTCCON);
418419 }
419− clk_disable(rtc_clk);
420+
421+ if (info->data->needs_src_clk)
422+ clk_disable(info->rtc_src_clk);
423+ clk_disable(info->rtc_clk);
420424 }
421425
422−static int s3c_rtc_remove(struct platform_device *dev)
426+static void s3c24xx_rtc_disable(struct s3c_rtc *info)
423427 {
424− s3c_rtc_setaie(&dev->dev, 0);
428+ unsigned int con;
429+
430+ clk_enable(info->rtc_clk);
431+ if (info->data->needs_src_clk)
432+ clk_enable(info->rtc_src_clk);
433+
434+ con = readw(info->base + S3C2410_RTCCON);
435+ con &= ~S3C2410_RTCCON_RTCEN;
436+ writew(con, info->base + S3C2410_RTCCON);
425437
426− clk_unprepare(rtc_clk);
427− rtc_clk = NULL;
438+ con = readb(info->base + S3C2410_TICNT);
439+ con &= ~S3C2410_TICNT_ENABLE;
440+ writeb(con, info->base + S3C2410_TICNT);
441+
442+ if (info->data->needs_src_clk)
443+ clk_disable(info->rtc_src_clk);
444+ clk_disable(info->rtc_clk);
445+}
446+
447+static void s3c6410_rtc_disable(struct s3c_rtc *info)
448+{
449+ unsigned int con;
450+
451+ clk_enable(info->rtc_clk);
452+ if (info->data->needs_src_clk)
453+ clk_enable(info->rtc_src_clk);
454+
455+ con = readw(info->base + S3C2410_RTCCON);
456+ con &= ~S3C64XX_RTCCON_TICEN;
457+ con &= ~S3C2410_RTCCON_RTCEN;
458+ writew(con, info->base + S3C2410_RTCCON);
459+
460+ if (info->data->needs_src_clk)
461+ clk_disable(info->rtc_src_clk);
462+ clk_disable(info->rtc_clk);
463+}
464+
465+static int s3c_rtc_remove(struct platform_device *pdev)
466+{
467+ struct s3c_rtc *info = platform_get_drvdata(pdev);
468+
469+ s3c_rtc_setaie(info->dev, 0);
470+
471+ clk_unprepare(info->rtc_clk);
472+ info->rtc_clk = NULL;
428473
429474 return 0;
430475 }
431476
432477 static const struct of_device_id s3c_rtc_dt_match[];
433478
434−static inline int s3c_rtc_get_driver_data(struct platform_device *pdev)
479+static struct s3c_rtc_data *s3c_rtc_get_data(struct platform_device *pdev)
435480 {
436−#ifdef CONFIG_OF
437− struct s3c_rtc_drv_data *data;
438− if (pdev->dev.of_node) {
439− const struct of_device_id *match;
440− match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node);
441− data = (struct s3c_rtc_drv_data *) match->data;
442− return data->cpu_type;
443− }
444−#endif
445− return platform_get_device_id(pdev)->driver_data;
481+ const struct of_device_id *match;
482+
483+ match = of_match_node(s3c_rtc_dt_match, pdev->dev.of_node);
484+ return (struct s3c_rtc_data *)match->data;
446485 }
447486
448487 static int s3c_rtc_probe(struct platform_device *pdev)
449488 {
450− struct rtc_device *rtc;
489+ struct s3c_rtc *info = NULL;
451490 struct rtc_time rtc_tm;
452491 struct resource *res;
453492 int ret;
454− int tmp;
455493
456− dev_dbg(&pdev->dev, "%s: probe=%p\n", __func__, pdev);
494+ info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
495+ if (!info)
496+ return -ENOMEM;
457497
458498 /* find the IRQs */
459−
460− s3c_rtc_tickno = platform_get_irq(pdev, 1);
461− if (s3c_rtc_tickno < 0) {
499+ info->irq_tick = platform_get_irq(pdev, 1);
500+ if (info->irq_tick < 0) {
462501 dev_err(&pdev->dev, "no irq for rtc tick\n");
463− return s3c_rtc_tickno;
502+ return info->irq_tick;
503+ }
504+
505+ info->dev = &pdev->dev;
506+ info->data = s3c_rtc_get_data(pdev);
507+ if (!info->data) {
508+ dev_err(&pdev->dev, "failed getting s3c_rtc_data\n");
509+ return -EINVAL;
464510 }
511+ spin_lock_init(&info->pie_lock);
512+ spin_lock_init(&info->alarm_clk_lock);
513+
514+ platform_set_drvdata(pdev, info);
465515
466− s3c_rtc_alarmno = platform_get_irq(pdev, 0);
467− if (s3c_rtc_alarmno < 0) {
516+ info->irq_alarm = platform_get_irq(pdev, 0);
517+ if (info->irq_alarm < 0) {
468518 dev_err(&pdev->dev, "no irq for alarm\n");
469− return s3c_rtc_alarmno;
519+ return info->irq_alarm;
470520 }
471521
472522 dev_dbg(&pdev->dev, "s3c2410_rtc: tick irq %d, alarm irq %d\n",
473− s3c_rtc_tickno, s3c_rtc_alarmno);
523+ info->irq_tick, info->irq_alarm);
474524
475525 /* get the memory region */
476−
477526 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
478− s3c_rtc_base = devm_ioremap_resource(&pdev->dev, res);
479− if (IS_ERR(s3c_rtc_base))
480− return PTR_ERR(s3c_rtc_base);
481−
482− rtc_clk = devm_clk_get(&pdev->dev, "rtc");
483− if (IS_ERR(rtc_clk)) {
484− dev_err(&pdev->dev, "failed to find rtc clock source\n");
485− ret = PTR_ERR(rtc_clk);
486− rtc_clk = NULL;
487− return ret;
527+ info->base = devm_ioremap_resource(&pdev->dev, res);
528+ if (IS_ERR(info->base))
529+ return PTR_ERR(info->base);
530+
531+ info->rtc_clk = devm_clk_get(&pdev->dev, "rtc");
532+ if (IS_ERR(info->rtc_clk)) {
533+ dev_err(&pdev->dev, "failed to find rtc clock\n");
534+ return PTR_ERR(info->rtc_clk);
488535 }
536+ clk_prepare_enable(info->rtc_clk);
489537
490− clk_prepare_enable(rtc_clk);
538+ info->rtc_src_clk = devm_clk_get(&pdev->dev, "rtc_src");
539+ if (IS_ERR(info->rtc_src_clk)) {
540+ dev_err(&pdev->dev, "failed to find rtc source clock\n");
541+ return PTR_ERR(info->rtc_src_clk);
542+ }
543+ clk_prepare_enable(info->rtc_src_clk);
491544
492− /* check to see if everything is setup correctly */
493545
494− s3c_rtc_enable(pdev, 1);
546+ /* check to see if everything is setup correctly */
547+ if (info->data->enable)
548+ info->data->enable(info);
495549
496550 dev_dbg(&pdev->dev, "s3c2410_rtc: RTCCON=%02x\n",
497− readw(s3c_rtc_base + S3C2410_RTCCON));
551+ readw(info->base + S3C2410_RTCCON));
498552
499553 device_init_wakeup(&pdev->dev, 1);
500554
501555 /* register RTC and exit */
502−
503− rtc = devm_rtc_device_register(&pdev->dev, "s3c", &s3c_rtcops,
556+ info->rtc = devm_rtc_device_register(&pdev->dev, "s3c", &s3c_rtcops,
504557 THIS_MODULE);
505−
506− if (IS_ERR(rtc)) {
558+ if (IS_ERR(info->rtc)) {
507559 dev_err(&pdev->dev, "cannot attach rtc\n");
508− ret = PTR_ERR(rtc);
560+ ret = PTR_ERR(info->rtc);
509561 goto err_nortc;
510562 }
511563
512− s3c_rtc_cpu_type = s3c_rtc_get_driver_data(pdev);
564+ ret = devm_request_irq(&pdev->dev, info->irq_alarm, s3c_rtc_alarmirq,
565+ 0, "s3c2410-rtc alarm", info);
566+ if (ret) {
567+ dev_err(&pdev->dev, "IRQ%d error %d\n", info->irq_alarm, ret);
568+ goto err_nortc;
569+ }
513570
514− /* Check RTC Time */
571+ ret = devm_request_irq(&pdev->dev, info->irq_tick, s3c_rtc_tickirq,
572+ 0, "s3c2410-rtc tick", info);
573+ if (ret) {
574+ dev_err(&pdev->dev, "IRQ%d error %d\n", info->irq_tick, ret);
575+ goto err_nortc;
576+ }
515577
516− s3c_rtc_gettime(NULL, &rtc_tm);
578+ /* Check RTC Time */
579+ s3c_rtc_gettime(&pdev->dev, &rtc_tm);
517580
518581 if (rtc_valid_tm(&rtc_tm)) {
519582 rtc_tm.tm_year = 100;
@@ -523,163 +586,312 @@ static int s3c_rtc_probe(struct platform_device *pdev) · 3 unmodified lines
523586 rtc_tm.tm_min = 0;
524587 rtc_tm.tm_sec = 0;
525588
526− s3c_rtc_settime(NULL, &rtc_tm);
589+ s3c_rtc_settime(&pdev->dev, &rtc_tm);
527590
528591 dev_warn(&pdev->dev, "warning: invalid RTC value so initializing it\n");
529592 }
530593
531− if (s3c_rtc_cpu_type != TYPE_S3C2410)
532− rtc->max_user_freq = 32768;
533− else
534− rtc->max_user_freq = 128;
535−
536− if (s3c_rtc_cpu_type == TYPE_S3C2416 || s3c_rtc_cpu_type == TYPE_S3C2443) {
537− tmp = readw(s3c_rtc_base + S3C2410_RTCCON);
538− tmp |= S3C2443_RTCCON_TICSEL;
539− writew(tmp, s3c_rtc_base + S3C2410_RTCCON);
540− }
594+ if (info->data->select_tick_clk)
595+ info->data->select_tick_clk(info);
541596
542− platform_set_drvdata(pdev, rtc);
597+ s3c_rtc_setfreq(info, 1);
543598
544− s3c_rtc_setfreq(&pdev->dev, 1);
545−
546− ret = devm_request_irq(&pdev->dev, s3c_rtc_alarmno, s3c_rtc_alarmirq,
547− 0, "s3c2410-rtc alarm", rtc);
548− if (ret) {
549− dev_err(&pdev->dev, "IRQ%d error %d\n", s3c_rtc_alarmno, ret);
550− goto err_nortc;
551− }
552−
553− ret = devm_request_irq(&pdev->dev, s3c_rtc_tickno, s3c_rtc_tickirq,
554− 0, "s3c2410-rtc tick", rtc);
555− if (ret) {
556− dev_err(&pdev->dev, "IRQ%d error %d\n", s3c_rtc_tickno, ret);
557− goto err_nortc;
558− }
559−
560− clk_disable(rtc_clk);
599+ if (info->data->needs_src_clk)
600+ clk_disable(info->rtc_src_clk);
601+ clk_disable(info->rtc_clk);
561602
562603 return 0;
563604
564605 err_nortc:
565− s3c_rtc_enable(pdev, 0);
566− clk_disable_unprepare(rtc_clk);
606+ if (info->data->disable)
607+ info->data->disable(info);
608+ clk_disable_unprepare(info->rtc_clk);
567609
568610 return ret;
569611 }
570612
571613 #ifdef CONFIG_PM_SLEEP
572−/* RTC Power management control */
573−
574−static int ticnt_save, ticnt_en_save;
575−static bool wake_en;
576614
577615 static int s3c_rtc_suspend(struct device *dev)
578616 {
579− struct platform_device *pdev = to_platform_device(dev);
617+ struct s3c_rtc *info = dev_get_drvdata(dev);
618+
619+ clk_enable(info->rtc_clk);
620+ if (info->data->needs_src_clk)
621+ clk_enable(info->rtc_src_clk);
580622
581− clk_enable(rtc_clk);
582623 /* save TICNT for anyone using periodic interrupts */
583− if (s3c_rtc_cpu_type == TYPE_S3C64XX) {
584− ticnt_en_save = readw(s3c_rtc_base + S3C2410_RTCCON);
585− ticnt_en_save &= S3C64XX_RTCCON_TICEN;
586− ticnt_save = readl(s3c_rtc_base + S3C2410_TICNT);
587− } else {
588− ticnt_save = readb(s3c_rtc_base + S3C2410_TICNT);
589− }
590− s3c_rtc_enable(pdev, 0);
624+ if (info->data->save_tick_cnt)
625+ info->data->save_tick_cnt(info);
626+
627+ if (info->data->disable)
628+ info->data->disable(info);
591629
592− if (device_may_wakeup(dev) && !wake_en) {
593− if (enable_irq_wake(s3c_rtc_alarmno) == 0)
594− wake_en = true;
630+ if (device_may_wakeup(dev) && !info->wake_en) {
631+ if (enable_irq_wake(info->irq_alarm) == 0)
632+ info->wake_en = true;
595633 else
596634 dev_err(dev, "enable_irq_wake failed\n");
597635 }
598− clk_disable(rtc_clk);
636+
637+ if (info->data->needs_src_clk)
638+ clk_disable(info->rtc_src_clk);
639+ clk_disable(info->rtc_clk);
599640
600641 return 0;
601642 }
602643
603644 static int s3c_rtc_resume(struct device *dev)
604645 {
605− struct platform_device *pdev = to_platform_device(dev);
606− unsigned int tmp;
646+ struct s3c_rtc *info = dev_get_drvdata(dev);
607647
608− clk_enable(rtc_clk);
609− s3c_rtc_enable(pdev, 1);
610− if (s3c_rtc_cpu_type == TYPE_S3C64XX) {
611− writel(ticnt_save, s3c_rtc_base + S3C2410_TICNT);
612− if (ticnt_en_save) {
613− tmp = readw(s3c_rtc_base + S3C2410_RTCCON);
614− writew(tmp | ticnt_en_save,
615− s3c_rtc_base + S3C2410_RTCCON);
616− }
617− } else {
618− writeb(ticnt_save, s3c_rtc_base + S3C2410_TICNT);
619− }
648+ clk_enable(info->rtc_clk);
649+ if (info->data->needs_src_clk)
650+ clk_enable(info->rtc_src_clk);
620651
621− if (device_may_wakeup(dev) && wake_en) {
622− disable_irq_wake(s3c_rtc_alarmno);
623− wake_en = false;
652+ if (info->data->enable)
653+ info->data->enable(info);
654+
655+ if (info->data->restore_tick_cnt)
656+ info->data->restore_tick_cnt(info);
657+
658+ if (device_may_wakeup(dev) && info->wake_en) {
659+ disable_irq_wake(info->irq_alarm);
660+ info->wake_en = false;
624661 }
625− clk_disable(rtc_clk);
662+
663+ if (info->data->needs_src_clk)
664+ clk_disable(info->rtc_src_clk);
665+ clk_disable(info->rtc_clk);
626666
627667 return 0;
628668 }
629669 #endif
630−
631670 static SIMPLE_DEV_PM_OPS(s3c_rtc_pm_ops, s3c_rtc_suspend, s3c_rtc_resume);
632671
633−#ifdef CONFIG_OF
634−static struct s3c_rtc_drv_data s3c_rtc_drv_data_array[] = {
635− [TYPE_S3C2410] = { TYPE_S3C2410 },
636− [TYPE_S3C2416] = { TYPE_S3C2416 },
637− [TYPE_S3C2443] = { TYPE_S3C2443 },
638− [TYPE_S3C64XX] = { TYPE_S3C64XX },
672+static void s3c24xx_rtc_irq(struct s3c_rtc *info, int mask)
673+{
674+ clk_enable(info->rtc_clk);
675+ if (info->data->needs_src_clk)
676+ clk_enable(info->rtc_src_clk);
677+ rtc_update_irq(info->rtc, 1, RTC_AF | RTC_IRQF);
678+ if (info->data->needs_src_clk)
679+ clk_disable(info->rtc_src_clk);
680+ clk_disable(info->rtc_clk);
681+
682+ s3c_rtc_alarm_clk_enable(info, false);
683+}
684+
685+static void s3c6410_rtc_irq(struct s3c_rtc *info, int mask)
686+{
687+ clk_enable(info->rtc_clk);
688+ if (info->data->needs_src_clk)
689+ clk_enable(info->rtc_src_clk);
690+ rtc_update_irq(info->rtc, 1, RTC_AF | RTC_IRQF);
691+ writeb(mask, info->base + S3C2410_INTP);
692+ if (info->data->needs_src_clk)
693+ clk_disable(info->rtc_src_clk);
694+ clk_disable(info->rtc_clk);
695+
696+ s3c_rtc_alarm_clk_enable(info, false);
697+}
698+
699+static void s3c2410_rtc_setfreq(struct s3c_rtc *info, int freq)
700+{
701+ unsigned int tmp = 0;
702+ int val;
703+
704+ tmp = readb(info->base + S3C2410_TICNT);
705+ tmp &= S3C2410_TICNT_ENABLE;
706+
707+ val = (info->rtc->max_user_freq / freq) - 1;
708+ tmp |= val;
709+
710+ writel(tmp, info->base + S3C2410_TICNT);
711+}
712+
713+static void s3c2416_rtc_setfreq(struct s3c_rtc *info, int freq)
714+{
715+ unsigned int tmp = 0;
716+ int val;
717+
718+ tmp = readb(info->base + S3C2410_TICNT);
719+ tmp &= S3C2410_TICNT_ENABLE;
720+
721+ val = (info->rtc->max_user_freq / freq) - 1;
722+
723+ tmp |= S3C2443_TICNT_PART(val);
724+ writel(S3C2443_TICNT1_PART(val), info->base + S3C2443_TICNT1);
725+
726+ writel(S3C2416_TICNT2_PART(val), info->base + S3C2416_TICNT2);
727+
728+ writel(tmp, info->base + S3C2410_TICNT);
729+}
730+
731+static void s3c2443_rtc_setfreq(struct s3c_rtc *info, int freq)
732+{
733+ unsigned int tmp = 0;
734+ int val;
735+
736+ tmp = readb(info->base + S3C2410_TICNT);
737+ tmp &= S3C2410_TICNT_ENABLE;
738+
739+ val = (info->rtc->max_user_freq / freq) - 1;
740+
741+ tmp |= S3C2443_TICNT_PART(val);
742+ writel(S3C2443_TICNT1_PART(val), info->base + S3C2443_TICNT1);
743+
744+ writel(tmp, info->base + S3C2410_TICNT);
745+}
746+
747+static void s3c6410_rtc_setfreq(struct s3c_rtc *info, int freq)
748+{
749+ int val;
750+
751+ val = (info->rtc->max_user_freq / freq) - 1;
752+ writel(val, info->base + S3C2410_TICNT);
753+}
754+
755+static void s3c24xx_rtc_enable_tick(struct s3c_rtc *info, struct seq_file *seq)
756+{
757+ unsigned int ticnt;
758+
759+ ticnt = readb(info->base + S3C2410_TICNT);
760+ ticnt &= S3C2410_TICNT_ENABLE;
761+
762+ seq_printf(seq, "periodic_IRQ\t: %s\n", ticnt ? "yes" : "no");
763+}
764+
765+static void s3c2416_rtc_select_tick_clk(struct s3c_rtc *info)
766+{
767+ unsigned int con;
768+
769+ con = readw(info->base + S3C2410_RTCCON);
770+ con |= S3C2443_RTCCON_TICSEL;
771+ writew(con, info->base + S3C2410_RTCCON);
772+}
773+
774+static void s3c6410_rtc_enable_tick(struct s3c_rtc *info, struct seq_file *seq)
775+{
776+ unsigned int ticnt;
777+
778+ ticnt = readw(info->base + S3C2410_RTCCON);
779+ ticnt &= S3C64XX_RTCCON_TICEN;
780+
781+ seq_printf(seq, "periodic_IRQ\t: %s\n", ticnt ? "yes" : "no");
782+}
783+
784+static void s3c24xx_rtc_save_tick_cnt(struct s3c_rtc *info)
785+{
786+ info->ticnt_save = readb(info->base + S3C2410_TICNT);
787+}
788+
789+static void s3c24xx_rtc_restore_tick_cnt(struct s3c_rtc *info)
790+{
791+ writeb(info->ticnt_save, info->base + S3C2410_TICNT);
792+}
793+
794+static void s3c6410_rtc_save_tick_cnt(struct s3c_rtc *info)
795+{
796+ info->ticnt_en_save = readw(info->base + S3C2410_RTCCON);
797+ info->ticnt_en_save &= S3C64XX_RTCCON_TICEN;
798+ info->ticnt_save = readl(info->base + S3C2410_TICNT);
799+}
800+
801+static void s3c6410_rtc_restore_tick_cnt(struct s3c_rtc *info)
802+{
803+ unsigned int con;
804+
805+ writel(info->ticnt_save, info->base + S3C2410_TICNT);
806+ if (info->ticnt_en_save) {
807+ con = readw(info->base + S3C2410_RTCCON);
808+ writew(con | info->ticnt_en_save,
809+ info->base + S3C2410_RTCCON);
810+ }
811+}
812+
813+static struct s3c_rtc_data const s3c2410_rtc_data = {
814+ .max_user_freq = 128,
815+ .irq_handler = s3c24xx_rtc_irq,
816+ .set_freq = s3c2410_rtc_setfreq,
817+ .enable_tick = s3c24xx_rtc_enable_tick,
818+ .save_tick_cnt = s3c24xx_rtc_save_tick_cnt,
819+ .restore_tick_cnt = s3c24xx_rtc_restore_tick_cnt,
820+ .enable = s3c24xx_rtc_enable,
821+ .disable = s3c24xx_rtc_disable,
822+};
823+
824+static struct s3c_rtc_data const s3c2416_rtc_data = {
825+ .max_user_freq = 32768,
826+ .irq_handler = s3c24xx_rtc_irq,
827+ .set_freq = s3c2416_rtc_setfreq,
828+ .enable_tick = s3c24xx_rtc_enable_tick,
829+ .select_tick_clk = s3c2416_rtc_select_tick_clk,
830+ .save_tick_cnt = s3c24xx_rtc_save_tick_cnt,
831+ .restore_tick_cnt = s3c24xx_rtc_restore_tick_cnt,
832+ .enable = s3c24xx_rtc_enable,
833+ .disable = s3c24xx_rtc_disable,
834+};
835+
836+static struct s3c_rtc_data const s3c2443_rtc_data = {
837+ .max_user_freq = 32768,
838+ .irq_handler = s3c24xx_rtc_irq,
839+ .set_freq = s3c2443_rtc_setfreq,
840+ .enable_tick = s3c24xx_rtc_enable_tick,
841+ .select_tick_clk = s3c2416_rtc_select_tick_clk,
842+ .save_tick_cnt = s3c24xx_rtc_save_tick_cnt,
843+ .restore_tick_cnt = s3c24xx_rtc_restore_tick_cnt,
844+ .enable = s3c24xx_rtc_enable,
845+ .disable = s3c24xx_rtc_disable,
846+};
847+
848+static struct s3c_rtc_data const s3c6410_rtc_data = {
849+ .max_user_freq = 32768,
850+ .irq_handler = s3c6410_rtc_irq,
851+ .set_freq = s3c6410_rtc_setfreq,
852+ .enable_tick = s3c6410_rtc_enable_tick,
853+ .save_tick_cnt = s3c6410_rtc_save_tick_cnt,
854+ .restore_tick_cnt = s3c6410_rtc_restore_tick_cnt,
855+ .enable = s3c24xx_rtc_enable,
856+ .disable = s3c6410_rtc_disable,
857+};
858+
859+static struct s3c_rtc_data const exynos3250_rtc_data = {
860+ .max_user_freq = 32768,
861+ .needs_src_clk = true,
862+ .irq_handler = s3c6410_rtc_irq,
863+ .set_freq = s3c6410_rtc_setfreq,
864+ .enable_tick = s3c6410_rtc_enable_tick,
865+ .save_tick_cnt = s3c6410_rtc_save_tick_cnt,
866+ .restore_tick_cnt = s3c6410_rtc_restore_tick_cnt,
867+ .enable = s3c24xx_rtc_enable,
868+ .disable = s3c6410_rtc_disable,
639869 };
640870
641871 static const struct of_device_id s3c_rtc_dt_match[] = {
642872 {
643873 .compatible = "samsung,s3c2410-rtc",
644− .data = &s3c_rtc_drv_data_array[TYPE_S3C2410],
874+ .data = (void *)&s3c2410_rtc_data,
645875 }, {
646876 .compatible = "samsung,s3c2416-rtc",
647− .data = &s3c_rtc_drv_data_array[TYPE_S3C2416],
877+ .data = (void *)&s3c2416_rtc_data,
648878 }, {
649879 .compatible = "samsung,s3c2443-rtc",
650− .data = &s3c_rtc_drv_data_array[TYPE_S3C2443],
880+ .data = (void *)&s3c2443_rtc_data,
651881 }, {
652882 .compatible = "samsung,s3c6410-rtc",
653− .data = &s3c_rtc_drv_data_array[TYPE_S3C64XX],
654− },
655− {},
656−};
657−MODULE_DEVICE_TABLE(of, s3c_rtc_dt_match);
658−#endif
659−
660−static struct platform_device_id s3c_rtc_driver_ids[] = {
661− {
662− .name = "s3c2410-rtc",
663− .driver_data = TYPE_S3C2410,
664− }, {
665− .name = "s3c2416-rtc",
666− .driver_data = TYPE_S3C2416,
667− }, {
668− .name = "s3c2443-rtc",
669− .driver_data = TYPE_S3C2443,
883+ .data = (void *)&s3c6410_rtc_data,
670884 }, {
671− .name = "s3c64xx-rtc",
672− .driver_data = TYPE_S3C64XX,
885+ .compatible = "samsung,exynos3250-rtc",
886+ .data = (void *)&exynos3250_rtc_data,
673887 },
674− { }
888+ { /* sentinel */ },
675889 };
676−
677−MODULE_DEVICE_TABLE(platform, s3c_rtc_driver_ids);
890+MODULE_DEVICE_TABLE(of, s3c_rtc_dt_match);
678891
679892 static struct platform_driver s3c_rtc_driver = {
680893 .probe = s3c_rtc_probe,
681894 .remove = s3c_rtc_remove,
682− .id_table = s3c_rtc_driver_ids,
683895 .driver = {
684896 .name = "s3c-rtc",
685897 .owner = THIS_MODULE,
@@ -687,7 +899,6 @@ static struct platform_driver s3c_rtc_driver = { · 1 unmodified line
687899 .of_match_table = of_match_ptr(s3c_rtc_dt_match),
688900 },
689901 };
690−
691902 module_platform_driver(s3c_rtc_driver);
692903
693904 MODULE_DESCRIPTION("Samsung S3C RTC Driver");
drivers/s390/cio/chp.c+2−2
@@ -257,11 +257,11 @@ static ssize_t chp_status_write(struct device *dev, · 256 unmodified lines
257257 if (!num_args)
258258 return count;
259259
260− if (!strnicmp(cmd, "on", 2) || !strcmp(cmd, "1")) {
260+ if (!strncasecmp(cmd, "on", 2) || !strcmp(cmd, "1")) {
261261 mutex_lock(&cp->lock);
262262 error = s390_vary_chpid(cp->chpid, 1);
263263 mutex_unlock(&cp->lock);
264− } else if (!strnicmp(cmd, "off", 3) || !strcmp(cmd, "0")) {
264+ } else if (!strncasecmp(cmd, "off", 3) || !strcmp(cmd, "0")) {
265265 mutex_lock(&cp->lock);
266266 error = s390_vary_chpid(cp->chpid, 0);
267267 mutex_unlock(&cp->lock);
drivers/scsi/ips.c+1−1
@@ -528,7 +528,7 @@ ips_setup(char *ips_str) · 527 unmodified lines
528528 * Update the variables
529529 */
530530 for (i = 0; i < ARRAY_SIZE(options); i++) {
531− if (strnicmp
531+ if (strncasecmp
532532 (key, options[i].option_name,
533533 strlen(options[i].option_name)) == 0) {
534534 if (value)
drivers/scsi/scsi_debug.c+1−1
@@ -3371,7 +3371,7 @@ static ssize_t opts_store(struct device_driver *ddp, const char *buf, · 3370 unmodified lines
33713371 char work[20];
33723372
33733373 if (1 == sscanf(buf, "%10s", work)) {
3374− if (0 == strnicmp(work,"0x", 2)) {
3374+ if (0 == strncasecmp(work,"0x", 2)) {
33753375 if (1 == sscanf(&work[2], "%x", &opts))
33763376 goto opts_done;
33773377 } else {
drivers/staging/rtl8188eu/os_dep/rtw_android.c+1−1
@@ -79,7 +79,7 @@ int rtw_android_cmdstr_to_num(char *cmdstr) · 78 unmodified lines
7979 {
8080 int cmd_num;
8181 for (cmd_num = 0; cmd_num < ANDROID_WIFI_CMD_MAX; cmd_num++)
82− if (0 == strnicmp(cmdstr , android_wifi_cmd_str[cmd_num],
82+ if (0 == strncasecmp(cmdstr , android_wifi_cmd_str[cmd_num],
8383 strlen(android_wifi_cmd_str[cmd_num])))
8484 break;
8585 return cmd_num;
drivers/staging/rtl8192e/rtllib.h+1−13
@@ -2957,25 +2957,13 @@ extern inline int rtllib_get_scans(struct rtllib_device *ieee) · 2956 unmodified lines
29572957 static inline const char *escape_essid(const char *essid, u8 essid_len)
29582958 {
29592959 static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
2960− const char *s = essid;
2961− char *d = escaped;
29622960
29632961 if (rtllib_is_empty_essid(essid, essid_len)) {
29642962 memcpy(escaped, "<hidden>", sizeof("<hidden>"));
29652963 return escaped;
29662964 }
29672965
2968− essid_len = min(essid_len, (u8)IW_ESSID_MAX_SIZE);
2969− while (essid_len--) {
2970− if (*s == '\0') {
2971− *d++ = '\\';
2972− *d++ = '0';
2973− s++;
2974− } else {
2975− *d++ = *s++;
2976− }
2977− }
2978− *d = '\0';
2966+ snprintf(escaped, sizeof(escaped), "%*pEn", essid_len, essid);
29792967 return escaped;
29802968 }
29812969
drivers/staging/rtl8192u/ieee80211/ieee80211.h+1−13
@@ -2593,25 +2593,13 @@ static inline int ieee80211_get_scans(struct ieee80211_device *ieee) · 2592 unmodified lines
25932593
25942594 static inline const char *escape_essid(const char *essid, u8 essid_len) {
25952595 static char escaped[IW_ESSID_MAX_SIZE * 2 + 1];
2596− const char *s = essid;
2597− char *d = escaped;
25982596
25992597 if (ieee80211_is_empty_essid(essid, essid_len)) {
26002598 memcpy(escaped, "<hidden>", sizeof("<hidden>"));
26012599 return escaped;
26022600 }
26032601
2604− essid_len = min(essid_len, (u8)IW_ESSID_MAX_SIZE);
2605− while (essid_len--) {
2606− if (*s == '\0') {
2607− *d++ = '\\';
2608− *d++ = '0';
2609− s++;
2610− } else {
2611− *d++ = *s++;
2612− }
2613− }
2614− *d = '\0';
2602+ snprintf(escaped, sizeof(escaped), "%*pEn", essid_len, essid);
26152603 return escaped;
26162604 }
26172605
drivers/staging/wlan-ng/prism2sta.c+2−26
@@ -60,7 +60,6 @@ · 59 unmodified lines
6060 #include <linux/netdevice.h>
6161 #include <linux/workqueue.h>
6262 #include <linux/byteorder/generic.h>
63−#include <linux/ctype.h>
6463
6564 #include <linux/io.h>
6665 #include <linux/delay.h>
@@ -81,27 +80,6 @@ · 14 unmodified lines
8180 #include "hfa384x.h"
8281 #include "prism2mgmt.h"
8382
84−/* Create a string of printable chars from something that might not be */
85−/* It's recommended that the str be 4*len + 1 bytes long */
86−#define wlan_mkprintstr(buf, buflen, str, strlen) \
87−{ \
88− int i = 0; \
89− int j = 0; \
90− memset(str, 0, (strlen)); \
91− for (i = 0; i < (buflen); i++) { \
92− if (isprint((buf)[i])) { \
93− (str)[j] = (buf)[i]; \
94− j++; \
95− } else { \
96− (str)[j] = '\\'; \
97− (str)[j+1] = 'x'; \
98− (str)[j+2] = hex_asc_hi((buf)[i]); \
99− (str)[j+3] = hex_asc_lo((buf)[i]); \
100− j += 4; \
101− } \
102− } \
103−}
104−
10583 static char *dev_info = "prism2_usb";
10684 static wlandevice_t *create_wlan(void);
10785
@@ -607,7 +585,6 @@ static int prism2sta_getcardinfo(wlandevice_t *wlandev) · 499 unmodified lines
607585 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
608586 u16 temp;
609587 u8 snum[HFA384x_RID_NICSERIALNUMBER_LEN];
610− char pstr[(HFA384x_RID_NICSERIALNUMBER_LEN * 4) + 1];
611588
612589 /* Collect version and compatibility info */
613590 /* Some are critical, some are not */
@@ -862,9 +839,8 @@ static int prism2sta_getcardinfo(wlandevice_t *wlandev) · 248 unmodified lines
862839 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_NICSERIALNUMBER,
863840 snum, HFA384x_RID_NICSERIALNUMBER_LEN);
864841 if (!result) {
865− wlan_mkprintstr(snum, HFA384x_RID_NICSERIALNUMBER_LEN,
866− pstr, sizeof(pstr));
867− netdev_info(wlandev->netdev, "Prism2 card SN: %s\n", pstr);
842+ netdev_info(wlandev->netdev, "Prism2 card SN: %*pEhp\n",
843+ HFA384x_RID_NICSERIALNUMBER_LEN, snum);
868844 } else {
869845 netdev_err(wlandev->netdev, "Failed to retrieve Prism2 Card SN\n");
870846 goto failed;
drivers/thermal/thermal_core.c+4−4
@@ -66,7 +66,7 @@ static struct thermal_governor *__find_governor(const char *name) · 65 unmodified lines
6666 return def_governor;
6767
6868 list_for_each_entry(pos, &thermal_governor_list, governor_list)
69− if (!strnicmp(name, pos->name, THERMAL_NAME_LENGTH))
69+ if (!strncasecmp(name, pos->name, THERMAL_NAME_LENGTH))
7070 return pos;
7171
7272 return NULL;
@@ -104,7 +104,7 @@ int thermal_register_governor(struct thermal_governor *governor) · 31 unmodified lines
104104
105105 name = pos->tzp->governor_name;
106106
107− if (!strnicmp(name, governor->name, THERMAL_NAME_LENGTH))
107+ if (!strncasecmp(name, governor->name, THERMAL_NAME_LENGTH))
108108 pos->governor = governor;
109109 }
110110
@@ -129,7 +129,7 @@ void thermal_unregister_governor(struct thermal_governor *governor) · 18 unmodified lines
129129 mutex_lock(&thermal_list_lock);
130130
131131 list_for_each_entry(pos, &thermal_tz_list, node) {
132− if (!strnicmp(pos->governor->name, governor->name,
132+ if (!strncasecmp(pos->governor->name, governor->name,
133133 THERMAL_NAME_LENGTH))
134134 pos->governor = NULL;
135135 }
@@ -1665,7 +1665,7 @@ struct thermal_zone_device *thermal_zone_get_zone_by_name(const char *name) · 1529 unmodified lines
16651665
16661666 mutex_lock(&thermal_list_lock);
16671667 list_for_each_entry(pos, &thermal_tz_list, node)
1668− if (!strnicmp(name, pos->type, THERMAL_NAME_LENGTH)) {
1668+ if (!strncasecmp(name, pos->type, THERMAL_NAME_LENGTH)) {
16691669 found++;
16701670 ref = pos;
16711671 }
drivers/video/fbdev/pvr2fb.c+1−1
@@ -1001,7 +1001,7 @@ static int pvr2_get_param(const struct pvr2_params *p, const char *s, int val, · 1000 unmodified lines
10011001
10021002 for (i = 0 ; i < size ; i++ ) {
10031003 if (s != NULL) {
1004− if (!strnicmp(p[i].name, s, strlen(s)))
1004+ if (!strncasecmp(p[i].name, s, strlen(s)))
10051005 return p[i].val;
10061006 } else {
10071007 if (p[i].val == val)
drivers/video/fbdev/s3c2410fb.c+4−4
@@ -601,12 +601,12 @@ static int s3c2410fb_debug_store(struct device *dev, · 600 unmodified lines
601601 if (len < 1)
602602 return -EINVAL;
603603
604− if (strnicmp(buf, "on", 2) == 0 ||
605− strnicmp(buf, "1", 1) == 0) {
604+ if (strncasecmp(buf, "on", 2) == 0 ||
605+ strncasecmp(buf, "1", 1) == 0) {
606606 debug = 1;
607607 dev_dbg(dev, "s3c2410fb: Debug On");
608− } else if (strnicmp(buf, "off", 3) == 0 ||
609− strnicmp(buf, "0", 1) == 0) {
608+ } else if (strncasecmp(buf, "off", 3) == 0 ||
609+ strncasecmp(buf, "0", 1) == 0) {
610610 debug = 0;
611611 dev_dbg(dev, "s3c2410fb: Debug Off");
612612 } else {
drivers/video/fbdev/sis/sis_main.c+33−33
@@ -162,7 +162,7 @@ static void sisfb_search_mode(char *name, bool quiet) · 161 unmodified lines
162162 return;
163163 }
164164
165− if(!strnicmp(name, sisbios_mode[MODE_INDEX_NONE].name, strlen(name))) {
165+ if(!strncasecmp(name, sisbios_mode[MODE_INDEX_NONE].name, strlen(name))) {
166166 if(!quiet)
167167 printk(KERN_ERR "sisfb: Mode 'none' not supported anymore. Using default.\n");
168168
@@ -201,7 +201,7 @@ static void sisfb_search_mode(char *name, bool quiet) · 32 unmodified lines
201201
202202 i = 0; j = 0;
203203 while(sisbios_mode[i].mode_no[0] != 0) {
204− if(!strnicmp(nameptr, sisbios_mode[i++].name, strlen(nameptr))) {
204+ if(!strncasecmp(nameptr, sisbios_mode[i++].name, strlen(nameptr))) {
205205 if(sisfb_fstn) {
206206 if(sisbios_mode[i-1].mode_no[1] == 0x50 ||
207207 sisbios_mode[i-1].mode_no[1] == 0x56 ||
@@ -262,7 +262,7 @@ sisfb_search_crt2type(const char *name) · 54 unmodified lines
262262 if(name == NULL) return;
263263
264264 while(sis_crt2type[i].type_no != -1) {
265− if(!strnicmp(name, sis_crt2type[i].name, strlen(sis_crt2type[i].name))) {
265+ if(!strncasecmp(name, sis_crt2type[i].name, strlen(sis_crt2type[i].name))) {
266266 sisfb_crt2type = sis_crt2type[i].type_no;
267267 sisfb_tvplug = sis_crt2type[i].tvplug_no;
268268 sisfb_crt2flags = sis_crt2type[i].flags;
@@ -289,7 +289,7 @@ sisfb_search_tvstd(const char *name) · 20 unmodified lines
289289 return;
290290
291291 while(sis_tvtype[i].type_no != -1) {
292− if(!strnicmp(name, sis_tvtype[i].name, strlen(sis_tvtype[i].name))) {
292+ if(!strncasecmp(name, sis_tvtype[i].name, strlen(sis_tvtype[i].name))) {
293293 sisfb_tvstd = sis_tvtype[i].type_no;
294294 break;
295295 }
@@ -308,12 +308,12 @@ sisfb_search_specialtiming(const char *name) · 12 unmodified lines
308308 if(name == NULL)
309309 return;
310310
311− if(!strnicmp(name, "none", 4)) {
311+ if(!strncasecmp(name, "none", 4)) {
312312 sisfb_specialtiming = CUT_FORCENONE;
313313 printk(KERN_DEBUG "sisfb: Special timing disabled\n");
314314 } else {
315315 while(mycustomttable[i].chipID != 0) {
316− if(!strnicmp(name,mycustomttable[i].optionName,
316+ if(!strncasecmp(name,mycustomttable[i].optionName,
317317 strlen(mycustomttable[i].optionName))) {
318318 sisfb_specialtiming = mycustomttable[i].SpecialID;
319319 found = true;
@@ -3952,68 +3952,68 @@ static int __init sisfb_setup(char *options) · 3632 unmodified lines
39523952
39533953 if(!(*this_opt)) continue;
39543954
3955− if(!strnicmp(this_opt, "off", 3)) {
3955+ if(!strncasecmp(this_opt, "off", 3)) {
39563956 sisfb_off = 1;
3957− } else if(!strnicmp(this_opt, "forcecrt2type:", 14)) {
3957+ } else if(!strncasecmp(this_opt, "forcecrt2type:", 14)) {
39583958 /* Need to check crt2 type first for fstn/dstn */
39593959 sisfb_search_crt2type(this_opt + 14);
3960− } else if(!strnicmp(this_opt, "tvmode:",7)) {
3960+ } else if(!strncasecmp(this_opt, "tvmode:",7)) {
39613961 sisfb_search_tvstd(this_opt + 7);
3962− } else if(!strnicmp(this_opt, "tvstandard:",11)) {
3962+ } else if(!strncasecmp(this_opt, "tvstandard:",11)) {
39633963 sisfb_search_tvstd(this_opt + 11);
3964− } else if(!strnicmp(this_opt, "mode:", 5)) {
3964+ } else if(!strncasecmp(this_opt, "mode:", 5)) {
39653965 sisfb_search_mode(this_opt + 5, false);
3966− } else if(!strnicmp(this_opt, "vesa:", 5)) {
3966+ } else if(!strncasecmp(this_opt, "vesa:", 5)) {
39673967 sisfb_search_vesamode(simple_strtoul(this_opt + 5, NULL, 0), false);
3968− } else if(!strnicmp(this_opt, "rate:", 5)) {
3968+ } else if(!strncasecmp(this_opt, "rate:", 5)) {
39693969 sisfb_parm_rate = simple_strtoul(this_opt + 5, NULL, 0);
3970− } else if(!strnicmp(this_opt, "forcecrt1:", 10)) {
3970+ } else if(!strncasecmp(this_opt, "forcecrt1:", 10)) {
39713971 sisfb_forcecrt1 = (int)simple_strtoul(this_opt + 10, NULL, 0);
3972− } else if(!strnicmp(this_opt, "mem:",4)) {
3972+ } else if(!strncasecmp(this_opt, "mem:",4)) {
39733973 sisfb_parm_mem = simple_strtoul(this_opt + 4, NULL, 0);
3974− } else if(!strnicmp(this_opt, "pdc:", 4)) {
3974+ } else if(!strncasecmp(this_opt, "pdc:", 4)) {
39753975 sisfb_pdc = simple_strtoul(this_opt + 4, NULL, 0);
3976− } else if(!strnicmp(this_opt, "pdc1:", 5)) {
3976+ } else if(!strncasecmp(this_opt, "pdc1:", 5)) {
39773977 sisfb_pdca = simple_strtoul(this_opt + 5, NULL, 0);
3978− } else if(!strnicmp(this_opt, "noaccel", 7)) {
3978+ } else if(!strncasecmp(this_opt, "noaccel", 7)) {
39793979 sisfb_accel = 0;
3980− } else if(!strnicmp(this_opt, "accel", 5)) {
3980+ } else if(!strncasecmp(this_opt, "accel", 5)) {
39813981 sisfb_accel = -1;
3982− } else if(!strnicmp(this_opt, "noypan", 6)) {
3982+ } else if(!strncasecmp(this_opt, "noypan", 6)) {
39833983 sisfb_ypan = 0;
3984− } else if(!strnicmp(this_opt, "ypan", 4)) {
3984+ } else if(!strncasecmp(this_opt, "ypan", 4)) {
39853985 sisfb_ypan = -1;
3986− } else if(!strnicmp(this_opt, "nomax", 5)) {
3986+ } else if(!strncasecmp(this_opt, "nomax", 5)) {
39873987 sisfb_max = 0;
3988− } else if(!strnicmp(this_opt, "max", 3)) {
3988+ } else if(!strncasecmp(this_opt, "max", 3)) {
39893989 sisfb_max = -1;
3990− } else if(!strnicmp(this_opt, "userom:", 7)) {
3990+ } else if(!strncasecmp(this_opt, "userom:", 7)) {
39913991 sisfb_userom = (int)simple_strtoul(this_opt + 7, NULL, 0);
3992− } else if(!strnicmp(this_opt, "useoem:", 7)) {
3992+ } else if(!strncasecmp(this_opt, "useoem:", 7)) {
39933993 sisfb_useoem = (int)simple_strtoul(this_opt + 7, NULL, 0);
3994− } else if(!strnicmp(this_opt, "nocrt2rate", 10)) {
3994+ } else if(!strncasecmp(this_opt, "nocrt2rate", 10)) {
39953995 sisfb_nocrt2rate = 1;
3996− } else if(!strnicmp(this_opt, "scalelcd:", 9)) {
3996+ } else if(!strncasecmp(this_opt, "scalelcd:", 9)) {
39973997 unsigned long temp = 2;
39983998 temp = simple_strtoul(this_opt + 9, NULL, 0);
39993999 if((temp == 0) || (temp == 1)) {
40004000 sisfb_scalelcd = temp ^ 1;
40014001 }
4002− } else if(!strnicmp(this_opt, "tvxposoffset:", 13)) {
4002+ } else if(!strncasecmp(this_opt, "tvxposoffset:", 13)) {
40034003 int temp = 0;
40044004 temp = (int)simple_strtol(this_opt + 13, NULL, 0);
40054005 if((temp >= -32) && (temp <= 32)) {
40064006 sisfb_tvxposoffset = temp;
40074007 }
4008− } else if(!strnicmp(this_opt, "tvyposoffset:", 13)) {
4008+ } else if(!strncasecmp(this_opt, "tvyposoffset:", 13)) {
40094009 int temp = 0;
40104010 temp = (int)simple_strtol(this_opt + 13, NULL, 0);
40114011 if((temp >= -32) && (temp <= 32)) {
40124012 sisfb_tvyposoffset = temp;
40134013 }
4014− } else if(!strnicmp(this_opt, "specialtiming:", 14)) {
4014+ } else if(!strncasecmp(this_opt, "specialtiming:", 14)) {
40154015 sisfb_search_specialtiming(this_opt + 14);
4016− } else if(!strnicmp(this_opt, "lvdshl:", 7)) {
4016+ } else if(!strncasecmp(this_opt, "lvdshl:", 7)) {
40174017 int temp = 4;
40184018 temp = simple_strtoul(this_opt + 7, NULL, 0);
40194019 if((temp >= 0) && (temp <= 3)) {
@@ -4022,9 +4022,9 @@ static int __init sisfb_setup(char *options) · 2 unmodified lines
40224022 } else if(this_opt[0] >= '0' && this_opt[0] <= '9') {
40234023 sisfb_search_mode(this_opt, true);
40244024 #if !defined(__i386__) && !defined(__x86_64__)
4025− } else if(!strnicmp(this_opt, "resetcard", 9)) {
4025+ } else if(!strncasecmp(this_opt, "resetcard", 9)) {
40264026 sisfb_resetcard = 1;
4027− } else if(!strnicmp(this_opt, "videoram:", 9)) {
4027+ } else if(!strncasecmp(this_opt, "videoram:", 9)) {
40284028 sisfb_videoram = simple_strtoul(this_opt + 9, NULL, 0);
40294029 #endif
40304030 } else {
drivers/video/fbdev/sm501fb.c+2−2
@@ -1187,9 +1187,9 @@ static ssize_t sm501fb_crtsrc_store(struct device *dev, · 1186 unmodified lines
11871187 if (len < 1)
11881188 return -EINVAL;
11891189
1190− if (strnicmp(buf, "crt", 3) == 0)
1190+ if (strncasecmp(buf, "crt", 3) == 0)
11911191 head = HEAD_CRT;
1192− else if (strnicmp(buf, "panel", 5) == 0)
1192+ else if (strncasecmp(buf, "panel", 5) == 0)
11931193 head = HEAD_PANEL;
11941194 else
11951195 return -EINVAL;
fs/affs/amigaffs.c+0−2
@@ -10,8 +10,6 @@ · 9 unmodified lines
1010
1111 #include "affs.h"
1212
13−extern struct timezone sys_tz;
14−
1513 static char ErrorBuffer[256];
1614
1715 /*
fs/affs/file.c+24−15
@@ -584,11 +584,14 @@ affs_extent_file_ofs(struct inode *inode, u32 newsize) · 583 unmodified lines
584584 bh->b_state &= ~(1UL << BH_New);
585585 mark_buffer_dirty_inode(bh, inode);
586586 if (prev_bh) {
587− u32 tmp = be32_to_cpu(AFFS_DATA_HEAD(prev_bh)->next);
588− if (tmp)
589− affs_warning(sb, "extent_file_ofs", "next block already set for %d (%d)", bidx, tmp);
587+ u32 tmp_next = be32_to_cpu(AFFS_DATA_HEAD(prev_bh)->next);
588+
589+ if (tmp_next)
590+ affs_warning(sb, "extent_file_ofs",
591+ "next block already set for %d (%d)",
592+ bidx, tmp_next);
590593 AFFS_DATA_HEAD(prev_bh)->next = cpu_to_be32(bh->b_blocknr);
591− affs_adjust_checksum(prev_bh, bh->b_blocknr - tmp);
594+ affs_adjust_checksum(prev_bh, bh->b_blocknr - tmp_next);
592595 mark_buffer_dirty_inode(prev_bh, inode);
593596 affs_brelse(prev_bh);
594597 }
@@ -727,11 +730,14 @@ static int affs_write_end_ofs(struct file *file, struct address_space *mapping, · 132 unmodified lines
727730 AFFS_DATA_HEAD(bh)->next = 0;
728731 bh->b_state &= ~(1UL << BH_New);
729732 if (prev_bh) {
730− u32 tmp = be32_to_cpu(AFFS_DATA_HEAD(prev_bh)->next);
731− if (tmp)
732− affs_warning(sb, "commit_write_ofs", "next block already set for %d (%d)", bidx, tmp);
733+ u32 tmp_next = be32_to_cpu(AFFS_DATA_HEAD(prev_bh)->next);
734+
735+ if (tmp_next)
736+ affs_warning(sb, "commit_write_ofs",
737+ "next block already set for %d (%d)",
738+ bidx, tmp_next);
733739 AFFS_DATA_HEAD(prev_bh)->next = cpu_to_be32(bh->b_blocknr);
734− affs_adjust_checksum(prev_bh, bh->b_blocknr - tmp);
740+ affs_adjust_checksum(prev_bh, bh->b_blocknr - tmp_next);
735741 mark_buffer_dirty_inode(prev_bh, inode);
736742 }
737743 }
@@ -758,11 +764,14 @@ static int affs_write_end_ofs(struct file *file, struct address_space *mapping, · 20 unmodified lines
758764 AFFS_DATA_HEAD(bh)->next = 0;
759765 bh->b_state &= ~(1UL << BH_New);
760766 if (prev_bh) {
761− u32 tmp = be32_to_cpu(AFFS_DATA_HEAD(prev_bh)->next);
762− if (tmp)
763− affs_warning(sb, "commit_write_ofs", "next block already set for %d (%d)", bidx, tmp);
767+ u32 tmp_next = be32_to_cpu(AFFS_DATA_HEAD(prev_bh)->next);
768+
769+ if (tmp_next)
770+ affs_warning(sb, "commit_write_ofs",
771+ "next block already set for %d (%d)",
772+ bidx, tmp_next);
764773 AFFS_DATA_HEAD(prev_bh)->next = cpu_to_be32(bh->b_blocknr);
765− affs_adjust_checksum(prev_bh, bh->b_blocknr - tmp);
774+ affs_adjust_checksum(prev_bh, bh->b_blocknr - tmp_next);
766775 mark_buffer_dirty_inode(prev_bh, inode);
767776 }
768777 } else if (be32_to_cpu(AFFS_DATA_HEAD(bh)->size) < tmp)
@@ -842,12 +851,12 @@ affs_truncate(struct inode *inode) · 73 unmodified lines
842851 struct address_space *mapping = inode->i_mapping;
843852 struct page *page;
844853 void *fsdata;
845− loff_t size = inode->i_size;
854+ loff_t isize = inode->i_size;
846855 int res;
847856
848− res = mapping->a_ops->write_begin(NULL, mapping, size, 0, 0, &page, &fsdata);
857+ res = mapping->a_ops->write_begin(NULL, mapping, isize, 0, 0, &page, &fsdata);
849858 if (!res)
850− res = mapping->a_ops->write_end(NULL, mapping, size, 0, 0, page, fsdata);
859+ res = mapping->a_ops->write_end(NULL, mapping, isize, 0, 0, page, fsdata);
851860 else
852861 inode->i_size = AFFS_I(inode)->mmu_private;
853862 mark_inode_dirty(inode);
fs/affs/inode.c+0−3
@@ -14,13 +14,11 @@ · 13 unmodified lines
1414 #include "affs.h"
1515
1616 extern const struct inode_operations affs_symlink_inode_operations;
17−extern struct timezone sys_tz;
1817
1918 struct inode *affs_iget(struct super_block *sb, unsigned long ino)
2019 {
2120 struct affs_sb_info *sbi = AFFS_SB(sb);
2221 struct buffer_head *bh;
23− struct affs_head *head;
2422 struct affs_tail *tail;
2523 struct inode *inode;
2624 u32 block;
@@ -49,7 +47,6 @@ struct inode *affs_iget(struct super_block *sb, unsigned long ino) · 22 unmodified lines
4947 goto bad_inode;
5048 }
5149
52− head = AFFS_HEAD(bh);
5350 tail = AFFS_TAIL(sb, bh);
5451 prot = be32_to_cpu(tail->protect);
5552
fs/affs/super.c+1−5
@@ -20,8 +20,6 @@ · 19 unmodified lines
2020 #include <linux/writeback.h>
2121 #include "affs.h"
2222
23−extern struct timezone sys_tz;
24−
2523 static int affs_statfs(struct dentry *dentry, struct kstatfs *buf);
2624 static int affs_remount (struct super_block *sb, int *flags, char *data);
2725
@@ -308,7 +306,6 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) · 280 unmodified lines
308306 u32 chksum;
309307 int num_bm;
310308 int i, j;
311− s32 key;
312309 kuid_t uid;
313310 kgid_t gid;
314311 int reserved;
@@ -367,7 +364,7 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) · 52 unmodified lines
367364 i = j = blocksize;
368365 size = size / (blocksize / 512);
369366 }
370− for (blocksize = i, key = 0; blocksize <= j; blocksize <<= 1, size >>= 1) {
367+ for (blocksize = i; blocksize <= j; blocksize <<= 1, size >>= 1) {
371368 sbi->s_root_block = root_block;
372369 if (root_block < 0)
373370 sbi->s_root_block = (reserved + size - 1) / 2;
@@ -399,7 +396,6 @@ static int affs_fill_super(struct super_block *sb, void *data, int silent) · 25 unmodified lines
399396 be32_to_cpu(AFFS_ROOT_TAIL(sb, root_bh)->stype) == ST_ROOT) {
400397 sbi->s_hashsize = blocksize / 4 - 56;
401398 sbi->s_root_block += num_bm;
402− key = 1;
403399 goto got_root;
404400 }
405401 affs_brelse(root_bh);
fs/autofs4/autofs_i.h+5−1
@@ -79,6 +79,10 @@ struct autofs_info { · 78 unmodified lines
7979 };
8080
8181 #define AUTOFS_INF_EXPIRING (1<<0) /* dentry is in the process of expiring */
82+#define AUTOFS_INF_NO_RCU (1<<1) /* the dentry is being considered
83+ * for expiry, so RCU_walk is
84+ * not permitted
85+ */
8286 #define AUTOFS_INF_PENDING (1<<2) /* dentry pending mount */
8387
8488 struct autofs_wait_queue {
@@ -148,7 +152,7 @@ void autofs4_free_ino(struct autofs_info *); · 63 unmodified lines
148152
149153 /* Expiration */
150154 int is_autofs4_dentry(struct dentry *);
151−int autofs4_expire_wait(struct dentry *dentry);
155+int autofs4_expire_wait(struct dentry *dentry, int rcu_walk);
152156 int autofs4_expire_run(struct super_block *, struct vfsmount *,
153157 struct autofs_sb_info *,
154158 struct autofs_packet_expire __user *);
fs/autofs4/dev-ioctl.c+1−1
@@ -450,7 +450,7 @@ static int autofs_dev_ioctl_requester(struct file *fp, · 449 unmodified lines
450450 ino = autofs4_dentry_ino(path.dentry);
451451 if (ino) {
452452 err = 0;
453− autofs4_expire_wait(path.dentry);
453+ autofs4_expire_wait(path.dentry, 0);
454454 spin_lock(&sbi->fs_lock);
455455 param->requester.uid = from_kuid_munged(current_user_ns(), ino->uid);
456456 param->requester.gid = from_kgid_munged(current_user_ns(), ino->gid);
fs/autofs4/expire.c+127−83
@@ -30,12 +30,6 @@ static inline int autofs4_can_expire(struct dentry *dentry, · 29 unmodified lines
3030 /* Too young to die */
3131 if (!timeout || time_after(ino->last_used + timeout, now))
3232 return 0;
33−
34− /* update last_used here :-
35− - obviously makes sense if it is in use now
36− - less obviously, prevents rapid-fire expire
37− attempts if expire fails the first time */
38− ino->last_used = now;
3933 }
4034 return 1;
4135 }
@@ -327,10 +321,19 @@ struct dentry *autofs4_expire_direct(struct super_block *sb, · 285 unmodified lines
327321 if (ino->flags & AUTOFS_INF_PENDING)
328322 goto out;
329323 if (!autofs4_direct_busy(mnt, root, timeout, do_now)) {
330− ino->flags |= AUTOFS_INF_EXPIRING;
331− init_completion(&ino->expire_complete);
324+ ino->flags |= AUTOFS_INF_NO_RCU;
332325 spin_unlock(&sbi->fs_lock);
333− return root;
326+ synchronize_rcu();
327+ spin_lock(&sbi->fs_lock);
328+ if (!autofs4_direct_busy(mnt, root, timeout, do_now)) {
329+ ino->flags |= AUTOFS_INF_EXPIRING;
330+ smp_mb();
331+ ino->flags &= ~AUTOFS_INF_NO_RCU;
332+ init_completion(&ino->expire_complete);
333+ spin_unlock(&sbi->fs_lock);
334+ return root;
335+ }
336+ ino->flags &= ~AUTOFS_INF_NO_RCU;
334337 }
335338 out:
336339 spin_unlock(&sbi->fs_lock);
@@ -339,6 +342,89 @@ out: · 2 unmodified lines
339342 return NULL;
340343 }
341344
345+/* Check if 'dentry' should expire, or return a nearby
346+ * dentry that is suitable.
347+ * If returned dentry is different from arg dentry,
348+ * then a dget() reference was taken, else not.
349+ */
350+static struct dentry *should_expire(struct dentry *dentry,
351+ struct vfsmount *mnt,
352+ unsigned long timeout,
353+ int how)
354+{
355+ int do_now = how & AUTOFS_EXP_IMMEDIATE;
356+ int exp_leaves = how & AUTOFS_EXP_LEAVES;
357+ struct autofs_info *ino = autofs4_dentry_ino(dentry);
358+ unsigned int ino_count;
359+
360+ /* No point expiring a pending mount */
361+ if (ino->flags & AUTOFS_INF_PENDING)
362+ return NULL;
363+
364+ /*
365+ * Case 1: (i) indirect mount or top level pseudo direct mount
366+ * (autofs-4.1).
367+ * (ii) indirect mount with offset mount, check the "/"
368+ * offset (autofs-5.0+).
369+ */
370+ if (d_mountpoint(dentry)) {
371+ DPRINTK("checking mountpoint %p %.*s",
372+ dentry, (int)dentry->d_name.len, dentry->d_name.name);
373+
374+ /* Can we umount this guy */
375+ if (autofs4_mount_busy(mnt, dentry))
376+ return NULL;
377+
378+ /* Can we expire this guy */
379+ if (autofs4_can_expire(dentry, timeout, do_now))
380+ return dentry;
381+ return NULL;
382+ }
383+
384+ if (dentry->d_inode && S_ISLNK(dentry->d_inode->i_mode)) {
385+ DPRINTK("checking symlink %p %.*s",
386+ dentry, (int)dentry->d_name.len, dentry->d_name.name);
387+ /*
388+ * A symlink can't be "busy" in the usual sense so
389+ * just check last used for expire timeout.
390+ */
391+ if (autofs4_can_expire(dentry, timeout, do_now))
392+ return dentry;
393+ return NULL;
394+ }
395+
396+ if (simple_empty(dentry))
397+ return NULL;
398+
399+ /* Case 2: tree mount, expire iff entire tree is not busy */
400+ if (!exp_leaves) {
401+ /* Path walk currently on this dentry? */
402+ ino_count = atomic_read(&ino->count) + 1;
403+ if (d_count(dentry) > ino_count)
404+ return NULL;
405+
406+ if (!autofs4_tree_busy(mnt, dentry, timeout, do_now))
407+ return dentry;
408+ /*
409+ * Case 3: pseudo direct mount, expire individual leaves
410+ * (autofs-4.1).
411+ */
412+ } else {
413+ /* Path walk currently on this dentry? */
414+ struct dentry *expired;
415+ ino_count = atomic_read(&ino->count) + 1;
416+ if (d_count(dentry) > ino_count)
417+ return NULL;
418+
419+ expired = autofs4_check_leaves(mnt, dentry, timeout, do_now);
420+ if (expired) {
421+ if (expired == dentry)
422+ dput(dentry);
423+ return expired;
424+ }
425+ }
426+ return NULL;
427+}
342428 /*
343429 * Find an eligible tree to time-out
344430 * A tree is eligible if :-
@@ -353,11 +439,8 @@ struct dentry *autofs4_expire_indirect(struct super_block *sb, · 8 unmodified lines
353439 unsigned long timeout;
354440 struct dentry *root = sb->s_root;
355441 struct dentry *dentry;
356− struct dentry *expired = NULL;
357− int do_now = how & AUTOFS_EXP_IMMEDIATE;
358− int exp_leaves = how & AUTOFS_EXP_LEAVES;
442+ struct dentry *expired;
359443 struct autofs_info *ino;
360− unsigned int ino_count;
361444
362445 if (!root)
363446 return NULL;
@@ -369,77 +452,28 @@ struct dentry *autofs4_expire_indirect(struct super_block *sb, · 5 unmodified lines
369452 while ((dentry = get_next_positive_subdir(dentry, root))) {
370453 spin_lock(&sbi->fs_lock);
371454 ino = autofs4_dentry_ino(dentry);
372− /* No point expiring a pending mount */
373− if (ino->flags & AUTOFS_INF_PENDING)
374− goto next;
375−
376− /*
377− * Case 1: (i) indirect mount or top level pseudo direct mount
378− * (autofs-4.1).
379− * (ii) indirect mount with offset mount, check the "/"
380− * offset (autofs-5.0+).
381− */
382− if (d_mountpoint(dentry)) {
383− DPRINTK("checking mountpoint %p %.*s",
384− dentry, (int)dentry->d_name.len, dentry->d_name.name);
385−
386− /* Can we umount this guy */
387− if (autofs4_mount_busy(mnt, dentry))
388− goto next;
389−
390− /* Can we expire this guy */
391− if (autofs4_can_expire(dentry, timeout, do_now)) {
392− expired = dentry;
393− goto found;
394− }
395− goto next;
455+ if (ino->flags & AUTOFS_INF_NO_RCU)
456+ expired = NULL;
457+ else
458+ expired = should_expire(dentry, mnt, timeout, how);
459+ if (!expired) {
460+ spin_unlock(&sbi->fs_lock);
461+ continue;
396462 }
397−
398− if (dentry->d_inode && S_ISLNK(dentry->d_inode->i_mode)) {
399− DPRINTK("checking symlink %p %.*s",
400− dentry, (int)dentry->d_name.len, dentry->d_name.name);
401− /*
402− * A symlink can't be "busy" in the usual sense so
403− * just check last used for expire timeout.
404− */
405− if (autofs4_can_expire(dentry, timeout, do_now)) {
406− expired = dentry;
407− goto found;
408− }
409− goto next;
410− }
411−
412− if (simple_empty(dentry))
413− goto next;
414−
415− /* Case 2: tree mount, expire iff entire tree is not busy */
416− if (!exp_leaves) {
417− /* Path walk currently on this dentry? */
418− ino_count = atomic_read(&ino->count) + 1;
419− if (d_count(dentry) > ino_count)
420− goto next;
421−
422− if (!autofs4_tree_busy(mnt, dentry, timeout, do_now)) {
423− expired = dentry;
424− goto found;
425− }
426− /*
427− * Case 3: pseudo direct mount, expire individual leaves
428− * (autofs-4.1).
429− */
430− } else {
431− /* Path walk currently on this dentry? */
432− ino_count = atomic_read(&ino->count) + 1;
433− if (d_count(dentry) > ino_count)
434− goto next;
435−
436− expired = autofs4_check_leaves(mnt, dentry, timeout, do_now);
437− if (expired) {
463+ ino = autofs4_dentry_ino(expired);
464+ ino->flags |= AUTOFS_INF_NO_RCU;
465+ spin_unlock(&sbi->fs_lock);
466+ synchronize_rcu();
467+ spin_lock(&sbi->fs_lock);
468+ if (should_expire(expired, mnt, timeout, how)) {
469+ if (expired != dentry)
438470 dput(dentry);
439− goto found;
440− }
471+ goto found;
441472 }
442−next:
473+
474+ ino->flags &= ~AUTOFS_INF_NO_RCU;
475+ if (expired != dentry)
476+ dput(expired);
443477 spin_unlock(&sbi->fs_lock);
444478 }
445479 return NULL;
@@ -447,8 +481,9 @@ next: · 1 unmodified line
447481 found:
448482 DPRINTK("returning %p %.*s",
449483 expired, (int)expired->d_name.len, expired->d_name.name);
450− ino = autofs4_dentry_ino(expired);
451484 ino->flags |= AUTOFS_INF_EXPIRING;
485+ smp_mb();
486+ ino->flags &= ~AUTOFS_INF_NO_RCU;
452487 init_completion(&ino->expire_complete);
453488 spin_unlock(&sbi->fs_lock);
454489 spin_lock(&sbi->lookup_lock);
@@ -461,13 +496,18 @@ found: · 6 unmodified lines
461496 return expired;
462497 }
463498
464−int autofs4_expire_wait(struct dentry *dentry)
499+int autofs4_expire_wait(struct dentry *dentry, int rcu_walk)
465500 {
466501 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
467502 struct autofs_info *ino = autofs4_dentry_ino(dentry);
468503 int status;
469504
470505 /* Block on any pending expire */
506+ if (!(ino->flags & (AUTOFS_INF_EXPIRING | AUTOFS_INF_NO_RCU)))
507+ return 0;
508+ if (rcu_walk)
509+ return -ECHILD;
510+
471511 spin_lock(&sbi->fs_lock);
472512 if (ino->flags & AUTOFS_INF_EXPIRING) {
473513 spin_unlock(&sbi->fs_lock);
@@ -519,6 +559,8 @@ int autofs4_expire_run(struct super_block *sb, · 45 unmodified lines
519559
520560 spin_lock(&sbi->fs_lock);
521561 ino = autofs4_dentry_ino(dentry);
562+ /* avoid rapid-fire expire attempts if expiry fails */
563+ ino->last_used = now;
522564 ino->flags &= ~AUTOFS_INF_EXPIRING;
523565 complete_all(&ino->expire_complete);
524566 spin_unlock(&sbi->fs_lock);
@@ -545,6 +587,8 @@ int autofs4_do_expire_multi(struct super_block *sb, struct vfsmount *mnt, · 20 unmodified lines
545587 ret = autofs4_wait(sbi, dentry, NFY_EXPIRE);
546588
547589 spin_lock(&sbi->fs_lock);
590+ /* avoid rapid-fire expire attempts if expiry fails */
591+ ino->last_used = now;
548592 ino->flags &= ~AUTOFS_INF_EXPIRING;
549593 complete_all(&ino->expire_complete);
550594 spin_unlock(&sbi->fs_lock);
fs/autofs4/root.c+45−17
@@ -210,7 +210,8 @@ next: · 209 unmodified lines
210210 return NULL;
211211 }
212212
213−static struct dentry *autofs4_lookup_expiring(struct dentry *dentry)
213+static struct dentry *autofs4_lookup_expiring(struct dentry *dentry,
214+ bool rcu_walk)
214215 {
215216 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
216217 struct dentry *parent = dentry->d_parent;
@@ -229,6 +230,11 @@ static struct dentry *autofs4_lookup_expiring(struct dentry *dentry) · 12 unmodified lines
229230 struct dentry *expiring;
230231 struct qstr *qstr;
231232
233+ if (rcu_walk) {
234+ spin_unlock(&sbi->lookup_lock);
235+ return ERR_PTR(-ECHILD);
236+ }
237+
232238 ino = list_entry(p, struct autofs_info, expiring);
233239 expiring = ino->dentry;
234240
@@ -264,13 +270,15 @@ next: · 29 unmodified lines
264270 return NULL;
265271 }
266272
267−static int autofs4_mount_wait(struct dentry *dentry)
273+static int autofs4_mount_wait(struct dentry *dentry, bool rcu_walk)
268274 {
269275 struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
270276 struct autofs_info *ino = autofs4_dentry_ino(dentry);
271277 int status = 0;
272278
273279 if (ino->flags & AUTOFS_INF_PENDING) {
280+ if (rcu_walk)
281+ return -ECHILD;
274282 DPRINTK("waiting for mount name=%.*s",
275283 dentry->d_name.len, dentry->d_name.name);
276284 status = autofs4_wait(sbi, dentry, NFY_MOUNT);
@@ -280,20 +288,22 @@ static int autofs4_mount_wait(struct dentry *dentry) · 3 unmodified lines
280288 return status;
281289 }
282290
283−static int do_expire_wait(struct dentry *dentry)
291+static int do_expire_wait(struct dentry *dentry, bool rcu_walk)
284292 {
285293 struct dentry *expiring;
286294
287− expiring = autofs4_lookup_expiring(dentry);
295+ expiring = autofs4_lookup_expiring(dentry, rcu_walk);
296+ if (IS_ERR(expiring))
297+ return PTR_ERR(expiring);
288298 if (!expiring)
289− return autofs4_expire_wait(dentry);
299+ return autofs4_expire_wait(dentry, rcu_walk);
290300 else {
291301 /*
292302 * If we are racing with expire the request might not
293303 * be quite complete, but the directory has been removed
294304 * so it must have been successful, just wait for it.
295305 */
296− autofs4_expire_wait(expiring);
306+ autofs4_expire_wait(expiring, 0);
297307 autofs4_del_expiring(expiring);
298308 dput(expiring);
299309 }
@@ -345,7 +355,7 @@ static struct vfsmount *autofs4_d_automount(struct path *path) · 45 unmodified lines
345355 * and the directory was removed, so just go ahead and try
346356 * the mount.
347357 */
348− status = do_expire_wait(dentry);
358+ status = do_expire_wait(dentry, 0);
349359 if (status && status != -EAGAIN)
350360 return NULL;
351361
@@ -353,7 +363,7 @@ static struct vfsmount *autofs4_d_automount(struct path *path) · 1 unmodified line
353363 spin_lock(&sbi->fs_lock);
354364 if (ino->flags & AUTOFS_INF_PENDING) {
355365 spin_unlock(&sbi->fs_lock);
356− status = autofs4_mount_wait(dentry);
366+ status = autofs4_mount_wait(dentry, 0);
357367 if (status)
358368 return ERR_PTR(status);
359369 goto done;
@@ -394,7 +404,7 @@ static struct vfsmount *autofs4_d_automount(struct path *path) · 34 unmodified lines
394404 }
395405 ino->flags |= AUTOFS_INF_PENDING;
396406 spin_unlock(&sbi->fs_lock);
397− status = autofs4_mount_wait(dentry);
407+ status = autofs4_mount_wait(dentry, 0);
398408 spin_lock(&sbi->fs_lock);
399409 ino->flags &= ~AUTOFS_INF_PENDING;
400410 if (status) {
@@ -423,28 +433,46 @@ static int autofs4_d_manage(struct dentry *dentry, bool rcu_walk) · 22 unmodified lines
423433
424434 /* The daemon never waits. */
425435 if (autofs4_oz_mode(sbi)) {
426− if (rcu_walk)
427− return 0;
428436 if (!d_mountpoint(dentry))
429437 return -EISDIR;
430438 return 0;
431439 }
432440
433− /* We need to sleep, so we need pathwalk to be in ref-mode */
434− if (rcu_walk)
435− return -ECHILD;
436−
437441 /* Wait for pending expires */
438− do_expire_wait(dentry);
442+ if (do_expire_wait(dentry, rcu_walk) == -ECHILD)
443+ return -ECHILD;
439444
440445 /*
441446 * This dentry may be under construction so wait on mount
442447 * completion.
443448 */
444− status = autofs4_mount_wait(dentry);
449+ status = autofs4_mount_wait(dentry, rcu_walk);
445450 if (status)
446451 return status;
447452
453+ if (rcu_walk) {
454+ /* We don't need fs_lock in rcu_walk mode,
455+ * just testing 'AUTOFS_INFO_NO_RCU' is enough.
456+ * simple_empty() takes a spinlock, so leave it
457+ * to last.
458+ * We only return -EISDIR when certain this isn't
459+ * a mount-trap.
460+ */
461+ struct inode *inode;
462+ if (ino->flags & (AUTOFS_INF_EXPIRING | AUTOFS_INF_NO_RCU))
463+ return 0;
464+ if (d_mountpoint(dentry))
465+ return 0;
466+ inode = ACCESS_ONCE(dentry->d_inode);
467+ if (inode && S_ISLNK(inode->i_mode))
468+ return -EISDIR;
469+ if (list_empty(&dentry->d_subdirs))
470+ return 0;
471+ if (!simple_empty(dentry))
472+ return -EISDIR;
473+ return 0;
474+ }
475+
448476 spin_lock(&sbi->fs_lock);
449477 /*
450478 * If the dentry has been selected for expire while we slept
fs/befs/btree.c+29−24
@@ -78,11 +78,11 @@ · 77 unmodified lines
7878 /*
7979 * In memory structure of each btree node
8080 */
81−typedef struct {
81+struct befs_btree_node {
8282 befs_host_btree_nodehead head; /* head of node converted to cpu byteorder */
8383 struct buffer_head *bh;
8484 befs_btree_nodehead *od_node; /* on disk node */
85−} befs_btree_node;
85+};
8686
8787 /* local constants */
8888 static const befs_off_t befs_bt_inval = 0xffffffffffffffffULL;
@@ -90,27 +90,30 @@ static const befs_off_t befs_bt_inval = 0xffffffffffffffffULL; · 1 unmodified line
9090 /* local functions */
9191 static int befs_btree_seekleaf(struct super_block *sb, befs_data_stream * ds,
9292 befs_btree_super * bt_super,
93− befs_btree_node * this_node,
93+ struct befs_btree_node *this_node,
9494 befs_off_t * node_off);
9595
9696 static int befs_bt_read_super(struct super_block *sb, befs_data_stream * ds,
9797 befs_btree_super * sup);
9898
9999 static int befs_bt_read_node(struct super_block *sb, befs_data_stream * ds,
100− befs_btree_node * node, befs_off_t node_off);
100+ struct befs_btree_node *node,
101+ befs_off_t node_off);
101102
102−static int befs_leafnode(befs_btree_node * node);
103+static int befs_leafnode(struct befs_btree_node *node);
103104
104−static fs16 *befs_bt_keylen_index(befs_btree_node * node);
105+static fs16 *befs_bt_keylen_index(struct befs_btree_node *node);
105106
106−static fs64 *befs_bt_valarray(befs_btree_node * node);
107+static fs64 *befs_bt_valarray(struct befs_btree_node *node);
107108
108−static char *befs_bt_keydata(befs_btree_node * node);
109+static char *befs_bt_keydata(struct befs_btree_node *node);
109110
110−static int befs_find_key(struct super_block *sb, befs_btree_node * node,
111+static int befs_find_key(struct super_block *sb,
112+ struct befs_btree_node *node,
111113 const char *findkey, befs_off_t * value);
112114
113−static char *befs_bt_get_key(struct super_block *sb, befs_btree_node * node,
115+static char *befs_bt_get_key(struct super_block *sb,
116+ struct befs_btree_node *node,
114117 int index, u16 * keylen);
115118
116119 static int befs_compare_strings(const void *key1, int keylen1,
@@ -191,7 +194,7 @@ befs_bt_read_super(struct super_block *sb, befs_data_stream * ds, · 74 unmodified lines
191194
192195 static int
193196 befs_bt_read_node(struct super_block *sb, befs_data_stream * ds,
194− befs_btree_node * node, befs_off_t node_off)
197+ struct befs_btree_node *node, befs_off_t node_off)
195198 {
196199 uint off = 0;
197200
@@ -247,7 +250,7 @@ int · 49 unmodified lines
247250 befs_btree_find(struct super_block *sb, befs_data_stream * ds,
248251 const char *key, befs_off_t * value)
249252 {
250− befs_btree_node *this_node = NULL;
253+ struct befs_btree_node *this_node = NULL;
251254 befs_btree_super bt_super;
252255 befs_off_t node_off;
253256 int res;
@@ -260,11 +263,11 @@ befs_btree_find(struct super_block *sb, befs_data_stream * ds, · 6 unmodified lines
260263 goto error;
261264 }
262265
263− this_node = kmalloc(sizeof (befs_btree_node),
266+ this_node = kmalloc(sizeof(struct befs_btree_node),
264267 GFP_NOFS);
265268 if (!this_node) {
266269 befs_error(sb, "befs_btree_find() failed to allocate %zu "
267− "bytes of memory", sizeof (befs_btree_node));
270+ "bytes of memory", sizeof(struct befs_btree_node));
268271 goto error;
269272 }
270273
@@ -333,7 +336,7 @@ befs_btree_find(struct super_block *sb, befs_data_stream * ds, · 62 unmodified lines
333336 * Use binary search instead of a linear.
334337 */
335338 static int
336−befs_find_key(struct super_block *sb, befs_btree_node * node,
339+befs_find_key(struct super_block *sb, struct befs_btree_node *node,
337340 const char *findkey, befs_off_t * value)
338341 {
339342 int first, last, mid;
@@ -417,7 +420,7 @@ befs_btree_read(struct super_block *sb, befs_data_stream * ds, · 77 unmodified lines
417420 loff_t key_no, size_t bufsize, char *keybuf, size_t * keysize,
418421 befs_off_t * value)
419422 {
420− befs_btree_node *this_node;
423+ struct befs_btree_node *this_node;
421424 befs_btree_super bt_super;
422425 befs_off_t node_off = 0;
423426 int cur_key;
@@ -436,9 +439,10 @@ befs_btree_read(struct super_block *sb, befs_data_stream * ds, · 12 unmodified lines
436439 goto error;
437440 }
438441
439− if ((this_node = kmalloc(sizeof (befs_btree_node), GFP_NOFS)) == NULL) {
442+ this_node = kmalloc(sizeof(struct befs_btree_node), GFP_NOFS);
443+ if (this_node == NULL) {
440444 befs_error(sb, "befs_btree_read() failed to allocate %zu "
441− "bytes of memory", sizeof (befs_btree_node));
445+ "bytes of memory", sizeof(struct befs_btree_node));
442446 goto error;
443447 }
444448
@@ -545,7 +549,8 @@ befs_btree_read(struct super_block *sb, befs_data_stream * ds, · 100 unmodified lines
545549 */
546550 static int
547551 befs_btree_seekleaf(struct super_block *sb, befs_data_stream * ds,
548− befs_btree_super * bt_super, befs_btree_node * this_node,
552+ befs_btree_super *bt_super,
553+ struct befs_btree_node *this_node,
549554 befs_off_t * node_off)
550555 {
551556
@@ -600,7 +605,7 @@ befs_btree_seekleaf(struct super_block *sb, befs_data_stream * ds, · 48 unmodified lines
600605 * Return 1 if leaf, 0 if interior
601606 */
602607 static int
603−befs_leafnode(befs_btree_node * node)
608+befs_leafnode(struct befs_btree_node *node)
604609 {
605610 /* all interior nodes (and only interior nodes) have an overflow node */
606611 if (node->head.overflow == befs_bt_inval)
@@ -623,7 +628,7 @@ befs_leafnode(befs_btree_node * node) · 16 unmodified lines
623628 * Except that rounding up to 8 works, and rounding up to 4 doesn't.
624629 */
625630 static fs16 *
626−befs_bt_keylen_index(befs_btree_node * node)
631+befs_bt_keylen_index(struct befs_btree_node *node)
627632 {
628633 const int keylen_align = 8;
629634 unsigned long int off =
@@ -644,7 +649,7 @@ befs_bt_keylen_index(befs_btree_node * node) · 14 unmodified lines
644649 * of the node pointed to by the node header
645650 */
646651 static fs64 *
647−befs_bt_valarray(befs_btree_node * node)
652+befs_bt_valarray(struct befs_btree_node *node)
648653 {
649654 void *keylen_index_start = (void *) befs_bt_keylen_index(node);
650655 size_t keylen_index_size = node->head.all_key_count * sizeof (fs16);
@@ -660,7 +665,7 @@ befs_bt_valarray(befs_btree_node * node) · 9 unmodified lines
660665 * of the node pointed to by the node header
661666 */
662667 static char *
663−befs_bt_keydata(befs_btree_node * node)
668+befs_bt_keydata(struct befs_btree_node *node)
664669 {
665670 return (char *) ((void *) node->od_node + sizeof (befs_btree_nodehead));
666671 }
@@ -676,7 +681,7 @@ befs_bt_keydata(befs_btree_node * node) · 9 unmodified lines
676681 * Returns NULL on failure (bad input) and sets *@keylen = 0
677682 */
678683 static char *
679−befs_bt_get_key(struct super_block *sb, befs_btree_node * node,
684+befs_bt_get_key(struct super_block *sb, struct befs_btree_node *node,
680685 int index, u16 * keylen)
681686 {
682687 int prev_key_end;
fs/binfmt_misc.c+19−4
@@ -62,7 +62,22 @@ static struct file_system_type bm_fs_type; · 61 unmodified lines
6262 static struct vfsmount *bm_mnt;
6363 static int entry_count;
6464
65−/*
65+/*
66+ * Max length of the register string. Determined by:
67+ * - 7 delimiters
68+ * - name: ~50 bytes
69+ * - type: 1 byte
70+ * - offset: 3 bytes (has to be smaller than BINPRM_BUF_SIZE)
71+ * - magic: 128 bytes (512 in escaped form)
72+ * - mask: 128 bytes (512 in escaped form)
73+ * - interp: ~50 bytes
74+ * - flags: 5 bytes
75+ * Round that up a bit, and then back off to hold the internal data
76+ * (like struct Node).
77+ */
78+#define MAX_REGISTER_LENGTH 1920
79+
80+/*
6681 * Check if we support the binfmt
6782 * if we do, return the node, else NULL
6883 * locking is done in load_misc_binary
@@ -279,7 +294,7 @@ static Node *create_entry(const char __user *buffer, size_t count) · 210 unmodified lines
279294
280295 /* some sanity checks */
281296 err = -EINVAL;
282− if ((count < 11) || (count > 256))
297+ if ((count < 11) || (count > MAX_REGISTER_LENGTH))
283298 goto out;
284299
285300 err = -ENOMEM;
@@ -396,12 +411,12 @@ static int parse_command(const char __user *buffer, size_t count) · 110 unmodified lines
396411 {
397412 char s[4];
398413
399− if (!count)
400− return 0;
401414 if (count > 3)
402415 return -EINVAL;
403416 if (copy_from_user(s, buffer, count))
404417 return -EFAULT;
418+ if (!count)
419+ return 0;
405420 if (s[count-1] == '\n')
406421 count--;
407422 if (count == 1 && s[0] == '0')
fs/buffer.c+2−2
@@ -1331,8 +1331,8 @@ lookup_bh_lru(struct block_device *bdev, sector_t block, unsigned size) · 1330 unmodified lines
13311331 for (i = 0; i < BH_LRU_SIZE; i++) {
13321332 struct buffer_head *bh = __this_cpu_read(bh_lrus.bhs[i]);
13331333
1334− if (bh && bh->b_bdev == bdev &&
1335− bh->b_blocknr == block && bh->b_size == size) {
1334+ if (bh && bh->b_blocknr == block && bh->b_bdev == bdev &&
1335+ bh->b_size == size) {
13361336 if (i) {
13371337 while (i) {
13381338 __this_cpu_write(bh_lrus.bhs[i],
fs/cifs/cifs_dfs_ref.c+3−3
@@ -195,15 +195,15 @@ char *cifs_compose_mount_options(const char *sb_mountdata, · 194 unmodified lines
195195 else
196196 noff = tkn_e - (sb_mountdata + off) + 1;
197197
198− if (strnicmp(sb_mountdata + off, "unc=", 4) == 0) {
198+ if (strncasecmp(sb_mountdata + off, "unc=", 4) == 0) {
199199 off += noff;
200200 continue;
201201 }
202− if (strnicmp(sb_mountdata + off, "ip=", 3) == 0) {
202+ if (strncasecmp(sb_mountdata + off, "ip=", 3) == 0) {
203203 off += noff;
204204 continue;
205205 }
206− if (strnicmp(sb_mountdata + off, "prefixpath=", 11) == 0) {
206+ if (strncasecmp(sb_mountdata + off, "prefixpath=", 11) == 0) {
207207 off += noff;
208208 continue;
209209 }
fs/cifs/connect.c+2−2
@@ -1718,7 +1718,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, · 1717 unmodified lines
17181718 goto cifs_parse_mount_err;
17191719 }
17201720
1721− if (strnicmp(string, "default", 7) != 0) {
1721+ if (strncasecmp(string, "default", 7) != 0) {
17221722 vol->iocharset = kstrdup(string,
17231723 GFP_KERNEL);
17241724 if (!vol->iocharset) {
@@ -1790,7 +1790,7 @@ cifs_parse_mount_options(const char *mountdata, const char *devname, · 65 unmodified lines
17901790 if (string == NULL)
17911791 goto out_nomem;
17921792
1793− if (strnicmp(string, "1", 1) == 0) {
1793+ if (strncasecmp(string, "1", 1) == 0) {
17941794 /* This is the default */
17951795 break;
17961796 }
fs/coredump.c+8−0
@@ -199,6 +199,14 @@ static int format_corename(struct core_name *cn, struct coredump_params *cprm) · 198 unmodified lines
199199 err = cn_printf(cn, "%d",
200200 task_tgid_nr(current));
201201 break;
202+ case 'i':
203+ err = cn_printf(cn, "%d",
204+ task_pid_vnr(current));
205+ break;
206+ case 'I':
207+ err = cn_printf(cn, "%d",
208+ task_pid_nr(current));
209+ break;
202210 /* uid */
203211 case 'u':
204212 err = cn_printf(cn, "%d", cred->uid);
fs/fat/misc.c+0−2
@@ -164,8 +164,6 @@ int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster) · 163 unmodified lines
164164 return 0;
165165 }
166166
167−extern struct timezone sys_tz;
168−
169167 /*
170168 * The epoch of FAT timestamp is 1980.
171169 * : bits : value
fs/hfs/hfs_fs.h+0−2
@@ -242,8 +242,6 @@ extern int hfs_mac2asc(struct super_block *, char *, const struct hfs_name *); · 241 unmodified lines
242242 /* super.c */
243243 extern void hfs_mark_mdb_dirty(struct super_block *sb);
244244
245−extern struct timezone sys_tz;
246−
247245 /*
248246 * There are two time systems. Both are based on seconds since
249247 * a particular time/date.
fs/isofs/inode.c+1−1
@@ -247,7 +247,7 @@ static int isofs_dentry_cmp_common( · 246 unmodified lines
247247 }
248248 if (alen == blen) {
249249 if (ci) {
250− if (strnicmp(name->name, str, alen) == 0)
250+ if (strncasecmp(name->name, str, alen) == 0)
251251 return 0;
252252 } else {
253253 if (strncmp(name->name, str, alen) == 0)
fs/ncpfs/dir.c+0−3
@@ -1178,9 +1178,6 @@ static int day_n[] = · 1177 unmodified lines
11781178 {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 0, 0, 0, 0};
11791179 /* Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec */
11801180
1181−
1182−extern struct timezone sys_tz;
1183−
11841181 static int utc2local(int time)
11851182 {
11861183 return time - sys_tz.tz_minuteswest * 60;
fs/nilfs2/file.c+3−5
@@ -56,11 +56,9 @@ int nilfs_sync_file(struct file *file, loff_t start, loff_t end, int datasync) · 55 unmodified lines
5656 mutex_unlock(&inode->i_mutex);
5757
5858 nilfs = inode->i_sb->s_fs_info;
59− if (!err && nilfs_test_opt(nilfs, BARRIER)) {
60− err = blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL);
61− if (err != -EIO)
62− err = 0;
63− }
59+ if (!err)
60+ err = nilfs_flush_device(nilfs);
61+
6462 return err;
6563 }
6664
fs/nilfs2/inode.c+7−6
@@ -126,7 +126,7 @@ int nilfs_get_block(struct inode *inode, sector_t blkoff, · 125 unmodified lines
126126 nilfs_transaction_abort(inode->i_sb);
127127 goto out;
128128 }
129− nilfs_mark_inode_dirty(inode);
129+ nilfs_mark_inode_dirty_sync(inode);
130130 nilfs_transaction_commit(inode->i_sb); /* never fails */
131131 /* Error handling should be detailed */
132132 set_buffer_new(bh_result);
@@ -672,7 +672,7 @@ void nilfs_write_inode_common(struct inode *inode, · 539 unmodified lines
672672 for substitutions of appended fields */
673673 }
674674
675−void nilfs_update_inode(struct inode *inode, struct buffer_head *ibh)
675+void nilfs_update_inode(struct inode *inode, struct buffer_head *ibh, int flags)
676676 {
677677 ino_t ino = inode->i_ino;
678678 struct nilfs_inode_info *ii = NILFS_I(inode);
@@ -683,7 +683,8 @@ void nilfs_update_inode(struct inode *inode, struct buffer_head *ibh) · 4 unmodified lines
683683
684684 if (test_and_clear_bit(NILFS_I_NEW, &ii->i_state))
685685 memset(raw_inode, 0, NILFS_MDT(ifile)->mi_entry_size);
686− set_bit(NILFS_I_INODE_DIRTY, &ii->i_state);
686+ if (flags & I_DIRTY_DATASYNC)
687+ set_bit(NILFS_I_INODE_SYNC, &ii->i_state);
687688
688689 nilfs_write_inode_common(inode, raw_inode, 0);
689690 /* XXX: call with has_bmap = 0 is a workaround to avoid
@@ -939,7 +940,7 @@ int nilfs_set_file_dirty(struct inode *inode, unsigned nr_dirty) · 249 unmodified lines
939940 return 0;
940941 }
941942
942−int nilfs_mark_inode_dirty(struct inode *inode)
943+int __nilfs_mark_inode_dirty(struct inode *inode, int flags)
943944 {
944945 struct buffer_head *ibh;
945946 int err;
@@ -950,7 +951,7 @@ int nilfs_mark_inode_dirty(struct inode *inode) · 4 unmodified lines
950951 "failed to reget inode block.\n");
951952 return err;
952953 }
953− nilfs_update_inode(inode, ibh);
954+ nilfs_update_inode(inode, ibh, flags);
954955 mark_buffer_dirty(ibh);
955956 nilfs_mdt_mark_dirty(NILFS_I(inode)->i_root->ifile);
956957 brelse(ibh);
@@ -983,7 +984,7 @@ void nilfs_dirty_inode(struct inode *inode, int flags) · 26 unmodified lines
983984 return;
984985 }
985986 nilfs_transaction_begin(inode->i_sb, &ti, 0);
986− nilfs_mark_inode_dirty(inode);
987+ __nilfs_mark_inode_dirty(inode, flags);
987988 nilfs_transaction_commit(inode->i_sb); /* never fails */
988989 }
989990
fs/nilfs2/ioctl.c+3−5
@@ -1022,11 +1022,9 @@ static int nilfs_ioctl_sync(struct inode *inode, struct file *filp, · 1021 unmodified lines
10221022 return ret;
10231023
10241024 nilfs = inode->i_sb->s_fs_info;
1025− if (nilfs_test_opt(nilfs, BARRIER)) {
1026− ret = blkdev_issue_flush(inode->i_sb->s_bdev, GFP_KERNEL, NULL);
1027− if (ret == -EIO)
1028− return ret;
1029− }
1025+ ret = nilfs_flush_device(nilfs);
1026+ if (ret < 0)
1027+ return ret;
10301028
10311029 if (argp != NULL) {
10321030 down_read(&nilfs->ns_segctor_sem);
fs/nilfs2/nilfs.h+11−3
@@ -104,7 +104,7 @@ enum { · 103 unmodified lines
104104 constructor */
105105 NILFS_I_COLLECTED, /* All dirty blocks are collected */
106106 NILFS_I_UPDATED, /* The file has been written back */
107− NILFS_I_INODE_DIRTY, /* write_inode is requested */
107+ NILFS_I_INODE_SYNC, /* dsync is not allowed for inode */
108108 NILFS_I_BMAP, /* has bmap and btnode_cache */
109109 NILFS_I_GCINODE, /* inode for GC, on memory only */
110110 };
@@ -273,7 +273,7 @@ struct inode *nilfs_iget(struct super_block *sb, struct nilfs_root *root, · 162 unmodified lines
273273 unsigned long ino);
274274 extern struct inode *nilfs_iget_for_gc(struct super_block *sb,
275275 unsigned long ino, __u64 cno);
276−extern void nilfs_update_inode(struct inode *, struct buffer_head *);
276+extern void nilfs_update_inode(struct inode *, struct buffer_head *, int);
277277 extern void nilfs_truncate(struct inode *);
278278 extern void nilfs_evict_inode(struct inode *);
279279 extern int nilfs_setattr(struct dentry *, struct iattr *);
@@ -282,10 +282,18 @@ int nilfs_permission(struct inode *inode, int mask); · 2 unmodified lines
282282 int nilfs_load_inode_block(struct inode *inode, struct buffer_head **pbh);
283283 extern int nilfs_inode_dirty(struct inode *);
284284 int nilfs_set_file_dirty(struct inode *inode, unsigned nr_dirty);
285−extern int nilfs_mark_inode_dirty(struct inode *);
285+extern int __nilfs_mark_inode_dirty(struct inode *, int);
286286 extern void nilfs_dirty_inode(struct inode *, int flags);
287287 int nilfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
288288 __u64 start, __u64 len);
289+static inline int nilfs_mark_inode_dirty(struct inode *inode)
290+{
291+ return __nilfs_mark_inode_dirty(inode, I_DIRTY);
292+}
293+static inline int nilfs_mark_inode_dirty_sync(struct inode *inode)
294+{
295+ return __nilfs_mark_inode_dirty(inode, I_DIRTY_SYNC);
296+}
289297
290298 /* super.c */
291299 extern struct inode *nilfs_alloc_inode(struct super_block *);
fs/nilfs2/segment.c+5−2
@@ -930,7 +930,7 @@ static void nilfs_drop_collected_inodes(struct list_head *head) · 929 unmodified lines
930930 if (!test_and_clear_bit(NILFS_I_COLLECTED, &ii->i_state))
931931 continue;
932932
933− clear_bit(NILFS_I_INODE_DIRTY, &ii->i_state);
933+ clear_bit(NILFS_I_INODE_SYNC, &ii->i_state);
934934 set_bit(NILFS_I_UPDATED, &ii->i_state);
935935 }
936936 }
@@ -1833,6 +1833,7 @@ static void nilfs_segctor_complete_write(struct nilfs_sc_info *sci) · 896 unmodified lines
18331833 nilfs_set_next_segment(nilfs, segbuf);
18341834
18351835 if (update_sr) {
1836+ nilfs->ns_flushed_device = 0;
18361837 nilfs_set_last_segment(nilfs, segbuf->sb_pseg_start,
18371838 segbuf->sb_sum.seg_seq, nilfs->ns_cno++);
18381839
@@ -2194,7 +2195,7 @@ int nilfs_construct_dsync_segment(struct super_block *sb, struct inode *inode, · 355 unmodified lines
21942195 nilfs_transaction_lock(sb, &ti, 0);
21952196
21962197 ii = NILFS_I(inode);
2197− if (test_bit(NILFS_I_INODE_DIRTY, &ii->i_state) ||
2198+ if (test_bit(NILFS_I_INODE_SYNC, &ii->i_state) ||
21982199 nilfs_test_opt(nilfs, STRICT_ORDER) ||
21992200 test_bit(NILFS_SC_UNCLOSED, &sci->sc_flags) ||
22002201 nilfs_discontinued(nilfs)) {
@@ -2216,6 +2217,8 @@ int nilfs_construct_dsync_segment(struct super_block *sb, struct inode *inode, · 15 unmodified lines
22162217 sci->sc_dsync_end = end;
22172218
22182219 err = nilfs_segctor_do_construct(sci, SC_LSEG_DSYNC);
2220+ if (!err)
2221+ nilfs->ns_flushed_device = 0;
22192222
22202223 nilfs_transaction_unlock(sb);
22212224 return err;
fs/nilfs2/super.c+6−0
@@ -310,6 +310,9 @@ int nilfs_commit_super(struct super_block *sb, int flag) · 309 unmodified lines
310310 nilfs->ns_sbsize));
311311 }
312312 clear_nilfs_sb_dirty(nilfs);
313+ nilfs->ns_flushed_device = 1;
314+ /* make sure store to ns_flushed_device cannot be reordered */
315+ smp_wmb();
313316 return nilfs_sync_super(sb, flag);
314317 }
315318
@@ -514,6 +517,9 @@ static int nilfs_sync_fs(struct super_block *sb, int wait) · 198 unmodified lines
514517 }
515518 up_write(&nilfs->ns_sem);
516519
520+ if (!err)
521+ err = nilfs_flush_device(nilfs);
522+
517523 return err;
518524 }
519525
fs/nilfs2/the_nilfs.h+22−0
@@ -46,6 +46,7 @@ enum { · 45 unmodified lines
4646 /**
4747 * struct the_nilfs - struct to supervise multiple nilfs mount points
4848 * @ns_flags: flags
49+ * @ns_flushed_device: flag indicating if all volatile data was flushed
4950 * @ns_bdev: block device
5051 * @ns_sem: semaphore for shared states
5152 * @ns_snapshot_mount_mutex: mutex to protect snapshot mounts
@@ -103,6 +104,7 @@ enum { · 51 unmodified lines
103104 */
104105 struct the_nilfs {
105106 unsigned long ns_flags;
107+ int ns_flushed_device;
106108
107109 struct block_device *ns_bdev;
108110 struct rw_semaphore ns_sem;
@@ -371,4 +373,24 @@ static inline int nilfs_segment_is_active(struct the_nilfs *nilfs, __u64 n) · 262 unmodified lines
371373 return n == nilfs->ns_segnum || n == nilfs->ns_nextnum;
372374 }
373375
376+static inline int nilfs_flush_device(struct the_nilfs *nilfs)
377+{
378+ int err;
379+
380+ if (!nilfs_test_opt(nilfs, BARRIER) || nilfs->ns_flushed_device)
381+ return 0;
382+
383+ nilfs->ns_flushed_device = 1;
384+ /*
385+ * the store to ns_flushed_device must not be reordered after
386+ * blkdev_issue_flush().
387+ */
388+ smp_wmb();
389+
390+ err = blkdev_issue_flush(nilfs->ns_bdev, GFP_KERNEL, NULL);
391+ if (err != -EIO)
392+ err = 0;
393+ return err;
394+}
395+
374396 #endif /* _THE_NILFS_H */
fs/ocfs2/cluster/heartbeat.c+1−1
@@ -2244,7 +2244,7 @@ ssize_t o2hb_heartbeat_group_mode_store(struct o2hb_heartbeat_group *group, · 2243 unmodified lines
22442244 return -EINVAL;
22452245
22462246 for (i = 0; i < O2HB_HEARTBEAT_NUM_MODES; ++i) {
2247− if (strnicmp(page, o2hb_heartbeat_mode_desc[i], len))
2247+ if (strncasecmp(page, o2hb_heartbeat_mode_desc[i], len))
22482248 continue;
22492249
22502250 ret = o2hb_global_heartbeat_mode_set(i);
fs/ocfs2/cluster/masklog.c+3−3
@@ -49,13 +49,13 @@ static ssize_t mlog_mask_show(u64 mask, char *buf) · 48 unmodified lines
4949
5050 static ssize_t mlog_mask_store(u64 mask, const char *buf, size_t count)
5151 {
52− if (!strnicmp(buf, "allow", 5)) {
52+ if (!strncasecmp(buf, "allow", 5)) {
5353 __mlog_set_u64(mask, mlog_and_bits);
5454 __mlog_clear_u64(mask, mlog_not_bits);
55− } else if (!strnicmp(buf, "deny", 4)) {
55+ } else if (!strncasecmp(buf, "deny", 4)) {
5656 __mlog_set_u64(mask, mlog_not_bits);
5757 __mlog_clear_u64(mask, mlog_and_bits);
58− } else if (!strnicmp(buf, "off", 3)) {
58+ } else if (!strncasecmp(buf, "off", 3)) {
5959 __mlog_clear_u64(mask, mlog_not_bits);
6060 __mlog_clear_u64(mask, mlog_and_bits);
6161 } else
fs/omfs/inode.c+7−3
@@ -306,9 +306,7 @@ static const struct super_operations omfs_sops = { · 305 unmodified lines
306306 */
307307 static int omfs_get_imap(struct super_block *sb)
308308 {
309− int bitmap_size;
310− int array_size;
311− int count;
309+ unsigned int bitmap_size, count, array_size;
312310 struct omfs_sb_info *sbi = OMFS_SB(sb);
313311 struct buffer_head *bh;
314312 unsigned long **ptr;
@@ -473,6 +471,12 @@ static int omfs_fill_super(struct super_block *sb, void *data, int silent) · 158 unmodified lines
473471 sbi->s_sys_blocksize = be32_to_cpu(omfs_sb->s_sys_blocksize);
474472 mutex_init(&sbi->s_bitmap_lock);
475473
474+ if (sbi->s_num_blocks > OMFS_MAX_BLOCKS) {
475+ printk(KERN_ERR "omfs: sysblock number (%llx) is out of range\n",
476+ (unsigned long long)sbi->s_num_blocks);
477+ goto out_brelse_bh;
478+ }
479+
476480 if (sbi->s_sys_blocksize > PAGE_SIZE) {
477481 printk(KERN_ERR "omfs: sysblock size (%d) is out of range\n",
478482 sbi->s_sys_blocksize);
fs/omfs/omfs_fs.h+1−0
@@ -18,6 +18,7 @@ · 17 unmodified lines
1818 #define OMFS_XOR_COUNT 19
1919 #define OMFS_MAX_BLOCK_SIZE 8192
2020 #define OMFS_MAX_CLUSTER_SIZE 8
21+#define OMFS_MAX_BLOCKS (1ul << 31)
2122
2223 struct omfs_super_block {
2324 char s_fill1[256];
fs/proc/task_mmu.c+14−5
@@ -827,8 +827,21 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf, · 826 unmodified lines
827827 .private = &cp,
828828 };
829829 down_read(&mm->mmap_sem);
830− if (type == CLEAR_REFS_SOFT_DIRTY)
830+ if (type == CLEAR_REFS_SOFT_DIRTY) {
831+ for (vma = mm->mmap; vma; vma = vma->vm_next) {
832+ if (!(vma->vm_flags & VM_SOFTDIRTY))
833+ continue;
834+ up_read(&mm->mmap_sem);
835+ down_write(&mm->mmap_sem);
836+ for (vma = mm->mmap; vma; vma = vma->vm_next) {
837+ vma->vm_flags &= ~VM_SOFTDIRTY;
838+ vma_set_page_prot(vma);
839+ }
840+ downgrade_write(&mm->mmap_sem);
841+ break;
842+ }
831843 mmu_notifier_invalidate_range_start(mm, 0, -1);
844+ }
832845 for (vma = mm->mmap; vma; vma = vma->vm_next) {
833846 cp.vma = vma;
834847 if (is_vm_hugetlb_page(vma))
@@ -848,10 +861,6 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf, · 13 unmodified lines
848861 continue;
849862 if (type == CLEAR_REFS_MAPPED && !vma->vm_file)
850863 continue;
851− if (type == CLEAR_REFS_SOFT_DIRTY) {
852− if (vma->vm_flags & VM_SOFTDIRTY)
853− vma->vm_flags &= ~VM_SOFTDIRTY;
854− }
855864 walk_page_range(vma->vm_start, vma->vm_end,
856865 &clear_refs_walk);
857866 }
fs/reiserfs/journal.c+5−3
@@ -699,11 +699,13 @@ static int add_to_chunk(struct buffer_chunk *chunk, struct buffer_head *bh, · 698 unmodified lines
699699 chunk->bh[chunk->nr++] = bh;
700700 if (chunk->nr >= CHUNK_SIZE) {
701701 ret = 1;
702− if (lock)
702+ if (lock) {
703703 spin_unlock(lock);
704− fn(chunk);
705− if (lock)
704+ fn(chunk);
706705 spin_lock(lock);
706+ } else {
707+ fn(chunk);
708+ }
707709 }
708710 return ret;
709711 }
fs/ufs/balloc.c+0−3
@@ -784,7 +784,6 @@ static u64 ufs_bitmap_search(struct super_block *sb, · 783 unmodified lines
784784 0x0, 0x2, 0x6, 0xe, 0x1e, 0x3e, 0x7e, 0xfe, 0x1fe
785785 };
786786 struct ufs_sb_private_info *uspi = UFS_SB(sb)->s_uspi;
787− struct ufs_cylinder_group *ucg;
788787 unsigned start, length, loc;
789788 unsigned pos, want, blockmap, mask, end;
790789 u64 result;
@@ -792,8 +791,6 @@ static u64 ufs_bitmap_search(struct super_block *sb, · 1 unmodified line
792791 UFSD("ENTER, cg %u, goal %llu, count %u\n", ucpi->c_cgx,
793792 (unsigned long long)goal, count);
794793
795− ucg = ubh_get_ucg(UCPI_UBH(ucpi));
796−
797794 if (goal)
798795 start = ufs_dtogd(uspi, goal) >> 3;
799796 else
include/asm-generic/pgtable.h+14−0
@@ -253,6 +253,20 @@ static inline int pmd_same(pmd_t pmd_a, pmd_t pmd_b) · 252 unmodified lines
253253 #define pgprot_device pgprot_noncached
254254 #endif
255255
256+#ifndef pgprot_modify
257+#define pgprot_modify pgprot_modify
258+static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)
259+{
260+ if (pgprot_val(oldprot) == pgprot_val(pgprot_noncached(oldprot)))
261+ newprot = pgprot_noncached(newprot);
262+ if (pgprot_val(oldprot) == pgprot_val(pgprot_writecombine(oldprot)))
263+ newprot = pgprot_writecombine(newprot);
264+ if (pgprot_val(oldprot) == pgprot_val(pgprot_device(oldprot)))
265+ newprot = pgprot_device(newprot);
266+ return newprot;
267+}
268+#endif
269+
256270 /*
257271 * When walking page tables, get the address of the next boundary,
258272 * or the end address of the range if that comes earlier. Although no
include/linux/cma.h+3−0
@@ -22,6 +22,9 @@ extern int __init cma_declare_contiguous(phys_addr_t size, · 21 unmodified lines
2222 phys_addr_t base, phys_addr_t limit,
2323 phys_addr_t alignment, unsigned int order_per_bit,
2424 bool fixed, struct cma **res_cma);
25+extern int cma_init_reserved_mem(phys_addr_t size,
26+ phys_addr_t base, int order_per_bit,
27+ struct cma **res_cma);
2528 extern struct page *cma_alloc(struct cma *cma, int count, unsigned int align);
2629 extern bool cma_release(struct cma *cma, struct page *pages, int count);
2730 #endif
include/linux/compiler-gcc5.h+66−0
@@ -0,0 +1,66 @@
1+#ifndef __LINUX_COMPILER_H
2+#error "Please don't include <linux/compiler-gcc5.h> directly, include <linux/compiler.h> instead."
3+#endif
4+
5+#define __used __attribute__((__used__))
6+#define __must_check __attribute__((warn_unused_result))
7+#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
8+
9+/* Mark functions as cold. gcc will assume any path leading to a call
10+ to them will be unlikely. This means a lot of manual unlikely()s
11+ are unnecessary now for any paths leading to the usual suspects
12+ like BUG(), printk(), panic() etc. [but let's keep them for now for
13+ older compilers]
14+
15+ Early snapshots of gcc 4.3 don't support this and we can't detect this
16+ in the preprocessor, but we can live with this because they're unreleased.
17+ Maketime probing would be overkill here.
18+
19+ gcc also has a __attribute__((__hot__)) to move hot functions into
20+ a special section, but I don't see any sense in this right now in
21+ the kernel context */
22+#define __cold __attribute__((__cold__))
23+
24+#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
25+
26+#ifndef __CHECKER__
27+# define __compiletime_warning(message) __attribute__((warning(message)))
28+# define __compiletime_error(message) __attribute__((error(message)))
29+#endif /* __CHECKER__ */
30+
31+/*
32+ * Mark a position in code as unreachable. This can be used to
33+ * suppress control flow warnings after asm blocks that transfer
34+ * control elsewhere.
35+ *
36+ * Early snapshots of gcc 4.5 don't support this and we can't detect
37+ * this in the preprocessor, but we can live with this because they're
38+ * unreleased. Really, we need to have autoconf for the kernel.
39+ */
40+#define unreachable() __builtin_unreachable()
41+
42+/* Mark a function definition as prohibited from being cloned. */
43+#define __noclone __attribute__((__noclone__))
44+
45+/*
46+ * Tell the optimizer that something else uses this function or variable.
47+ */
48+#define __visible __attribute__((externally_visible))
49+
50+/*
51+ * GCC 'asm goto' miscompiles certain code sequences:
52+ *
53+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670
54+ *
55+ * Work it around via a compiler barrier quirk suggested by Jakub Jelinek.
56+ * Fixed in GCC 4.8.2 and later versions.
57+ *
58+ * (asm goto is automatically volatile - the naming reflects this.)
59+ */
60+#define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0)
61+
62+#ifdef CONFIG_ARCH_USE_BUILTIN_BSWAP
63+#define __HAVE_BUILTIN_BSWAP32__
64+#define __HAVE_BUILTIN_BSWAP64__
65+#define __HAVE_BUILTIN_BSWAP16__
66+#endif /* CONFIG_ARCH_USE_BUILTIN_BSWAP */
include/linux/kernel.h+0−4
@@ -376,10 +376,6 @@ extern unsigned long simple_strtoul(const char *,char **,unsigned int); · 375 unmodified lines
376376 extern long simple_strtol(const char *,char **,unsigned int);
377377 extern unsigned long long simple_strtoull(const char *,char **,unsigned int);
378378 extern long long simple_strtoll(const char *,char **,unsigned int);
379−#define strict_strtoul kstrtoul
380−#define strict_strtol kstrtol
381−#define strict_strtoull kstrtoull
382−#define strict_strtoll kstrtoll
383379
384380 extern int num_to_str(char *buf, int size, unsigned long long num);
385381
include/linux/kexec.h+1−0
@@ -178,6 +178,7 @@ struct kexec_buf { · 177 unmodified lines
178178 struct kimage *image;
179179 char *buffer;
180180 unsigned long bufsz;
181+ unsigned long mem;
181182 unsigned long memsz;
182183 unsigned long buf_align;
183184 unsigned long buf_min;
include/linux/list.h+1−0
@@ -5,6 +5,7 @@ · 4 unmodified lines
55 #include <linux/stddef.h>
66 #include <linux/poison.h>
77 #include <linux/const.h>
8+#include <linux/kernel.h>
89
910 /*
1011 * Simple doubly linked list implementation.
include/linux/mm.h+6−0
@@ -347,6 +347,7 @@ static inline int put_page_unless_one(struct page *page) · 346 unmodified lines
347347 }
348348
349349 extern int page_is_ram(unsigned long pfn);
350+extern int region_is_ram(resource_size_t phys_addr, unsigned long size);
350351
351352 /* Support for virtually mapped pages */
352353 struct page *vmalloc_to_page(const void *addr);
@@ -1973,11 +1974,16 @@ static inline struct vm_area_struct *find_exact_vma(struct mm_struct *mm, · 1620 unmodified lines
19731974
19741975 #ifdef CONFIG_MMU
19751976 pgprot_t vm_get_page_prot(unsigned long vm_flags);
1977+void vma_set_page_prot(struct vm_area_struct *vma);
19761978 #else
19771979 static inline pgprot_t vm_get_page_prot(unsigned long vm_flags)
19781980 {
19791981 return __pgprot(0);
19801982 }
1983+static inline void vma_set_page_prot(struct vm_area_struct *vma)
1984+{
1985+ vma->vm_page_prot = vm_get_page_prot(vma->vm_flags);
1986+}
19811987 #endif
19821988
19831989 #ifdef CONFIG_NUMA_BALANCING
include/linux/moduleparam.h+2−0
@@ -78,6 +78,8 @@ struct kernel_param { · 77 unmodified lines
7878 };
7979 };
8080
81+extern const struct kernel_param __start___param[], __stop___param[];
82+
8183 /* Special one for strings we want to copy into */
8284 struct kparam_string {
8385 unsigned int maxlen;
include/linux/nmi.h+13−0
@@ -24,6 +24,19 @@ static inline void touch_nmi_watchdog(void) · 23 unmodified lines
2424 }
2525 #endif
2626
27+#if defined(CONFIG_HARDLOCKUP_DETECTOR)
28+extern void watchdog_enable_hardlockup_detector(bool val);
29+extern bool watchdog_hardlockup_detector_is_enabled(void);
30+#else
31+static inline void watchdog_enable_hardlockup_detector(bool val)
32+{
33+}
34+static inline bool watchdog_hardlockup_detector_is_enabled(void)
35+{
36+ return true;
37+}
38+#endif
39+
2740 /*
2841 * Create trigger_all_cpu_backtrace() out of the arch-provided
2942 * base function. Return whether such support was available,
include/linux/prio_heap.h+0−58
@@ -1,58 +0,0 @@
1−#ifndef _LINUX_PRIO_HEAP_H
2−#define _LINUX_PRIO_HEAP_H
3−
4−/*
5− * Simple insertion-only static-sized priority heap containing
6− * pointers, based on CLR, chapter 7
7− */
8−
9−#include <linux/gfp.h>
10−
11−/**
12− * struct ptr_heap - simple static-sized priority heap
13− * @ptrs - pointer to data area
14− * @max - max number of elements that can be stored in @ptrs
15− * @size - current number of valid elements in @ptrs (in the range 0..@size-1
16− * @gt: comparison operator, which should implement "greater than"
17− */
18−struct ptr_heap {
19− void **ptrs;
20− int max;
21− int size;
22− int (*gt)(void *, void *);
23−};
24−
25−/**
26− * heap_init - initialize an empty heap with a given memory size
27− * @heap: the heap structure to be initialized
28− * @size: amount of memory to use in bytes
29− * @gfp_mask: mask to pass to kmalloc()
30− * @gt: comparison operator, which should implement "greater than"
31− */
32−extern int heap_init(struct ptr_heap *heap, size_t size, gfp_t gfp_mask,
33− int (*gt)(void *, void *));
34−
35−/**
36− * heap_free - release a heap's storage
37− * @heap: the heap structure whose data should be released
38− */
39−void heap_free(struct ptr_heap *heap);
40−
41−/**
42− * heap_insert - insert a value into the heap and return any overflowed value
43− * @heap: the heap to be operated on
44− * @p: the pointer to be inserted
45− *
46− * Attempts to insert the given value into the priority heap. If the
47− * heap is full prior to the insertion, then the resulting heap will
48− * consist of the smallest @max elements of the original heap and the
49− * new element; the greatest element will be removed from the heap and
50− * returned. Note that the returned element will be the new element
51− * (i.e. no change to the heap) if the new element is greater than all
52− * elements currently in the heap.
53− */
54−extern void *heap_insert(struct ptr_heap *heap, void *p);
55−
56−
57−
58−#endif /* _LINUX_PRIO_HEAP_H */
include/linux/rbtree_augmented.h+10−0
@@ -43,6 +43,16 @@ struct rb_augment_callbacks { · 42 unmodified lines
4343
4444 extern void __rb_insert_augmented(struct rb_node *node, struct rb_root *root,
4545 void (*augment_rotate)(struct rb_node *old, struct rb_node *new));
46+/*
47+ * Fixup the rbtree and update the augmented information when rebalancing.
48+ *
49+ * On insertion, the user must update the augmented information on the path
50+ * leading to the inserted node, then call rb_link_node() as usual and
51+ * rb_augment_inserted() instead of the usual rb_insert_color() call.
52+ * If rb_augment_inserted() rebalances the rbtree, it will callback into
53+ * a user provided function to update the augmented information on the
54+ * affected subtrees.
55+ */
4656 static inline void
4757 rb_insert_augmented(struct rb_node *node, struct rb_root *root,
4858 const struct rb_augment_callbacks *augment)
include/linux/signal.h+13−16
@@ -2,6 +2,7 @@ · 1 unmodified line
22 #define _LINUX_SIGNAL_H
33
44 #include <linux/list.h>
5+#include <linux/bug.h>
56 #include <uapi/linux/signal.h>
67
78 struct task_struct;
@@ -67,7 +68,6 @@ static inline int sigismember(sigset_t *set, int _sig) · 59 unmodified lines
6768
6869 static inline int sigisemptyset(sigset_t *set)
6970 {
70− extern void _NSIG_WORDS_is_unsupported_size(void);
7171 switch (_NSIG_WORDS) {
7272 case 4:
7373 return (set->sig[3] | set->sig[2] |
@@ -77,7 +77,7 @@ static inline int sigisemptyset(sigset_t *set) · 3 unmodified lines
7777 case 1:
7878 return set->sig[0] == 0;
7979 default:
80− _NSIG_WORDS_is_unsupported_size();
80+ BUILD_BUG();
8181 return 0;
8282 }
8383 }
@@ -90,24 +90,23 @@ static inline int sigisemptyset(sigset_t *set) · 6 unmodified lines
9090 #define _SIG_SET_BINOP(name, op) \
9191 static inline void name(sigset_t *r, const sigset_t *a, const sigset_t *b) \
9292 { \
93− extern void _NSIG_WORDS_is_unsupported_size(void); \
9493 unsigned long a0, a1, a2, a3, b0, b1, b2, b3; \
9594 \
9695 switch (_NSIG_WORDS) { \
97− case 4: \
96+ case 4: \
9897 a3 = a->sig[3]; a2 = a->sig[2]; \
9998 b3 = b->sig[3]; b2 = b->sig[2]; \
10099 r->sig[3] = op(a3, b3); \
101100 r->sig[2] = op(a2, b2); \
102− case 2: \
101+ case 2: \
103102 a1 = a->sig[1]; b1 = b->sig[1]; \
104103 r->sig[1] = op(a1, b1); \
105− case 1: \
104+ case 1: \
106105 a0 = a->sig[0]; b0 = b->sig[0]; \
107106 r->sig[0] = op(a0, b0); \
108107 break; \
109− default: \
110− _NSIG_WORDS_is_unsupported_size(); \
108+ default: \
109+ BUILD_BUG(); \
111110 } \
112111 }
113112
@@ -128,16 +127,14 @@ _SIG_SET_BINOP(sigandnsets, _sig_andn) · 14 unmodified lines
128127 #define _SIG_SET_OP(name, op) \
129128 static inline void name(sigset_t *set) \
130129 { \
131− extern void _NSIG_WORDS_is_unsupported_size(void); \
132− \
133130 switch (_NSIG_WORDS) { \
134− case 4: set->sig[3] = op(set->sig[3]); \
135− set->sig[2] = op(set->sig[2]); \
136− case 2: set->sig[1] = op(set->sig[1]); \
137− case 1: set->sig[0] = op(set->sig[0]); \
131+ case 4: set->sig[3] = op(set->sig[3]); \
132+ set->sig[2] = op(set->sig[2]); \
133+ case 2: set->sig[1] = op(set->sig[1]); \
134+ case 1: set->sig[0] = op(set->sig[0]); \
138135 break; \
139− default: \
140− _NSIG_WORDS_is_unsupported_size(); \
136+ default: \
137+ BUILD_BUG(); \
141138 } \
142139 }
143140
include/linux/string.h+1−1
@@ -41,7 +41,7 @@ extern int strcmp(const char *,const char *); · 40 unmodified lines
4141 extern int strncmp(const char *,const char *,__kernel_size_t);
4242 #endif
4343 #ifndef __HAVE_ARCH_STRNICMP
44−extern int strnicmp(const char *, const char *, __kernel_size_t);
44+#define strnicmp strncasecmp
4545 #endif
4646 #ifndef __HAVE_ARCH_STRCASECMP
4747 extern int strcasecmp(const char *s1, const char *s2);
include/linux/string_helpers.h+31−34
@@ -20,40 +20,6 @@ int string_get_size(u64 size, enum string_size_units units, · 19 unmodified lines
2020 #define UNESCAPE_ANY \
2121 (UNESCAPE_SPACE | UNESCAPE_OCTAL | UNESCAPE_HEX | UNESCAPE_SPECIAL)
2222
23−/**
24− * string_unescape - unquote characters in the given string
25− * @src: source buffer (escaped)
26− * @dst: destination buffer (unescaped)
27− * @size: size of the destination buffer (0 to unlimit)
28− * @flags: combination of the flags (bitwise OR):
29− * %UNESCAPE_SPACE:
30− * '\f' - form feed
31− * '\n' - new line
32− * '\r' - carriage return
33− * '\t' - horizontal tab
34− * '\v' - vertical tab
35− * %UNESCAPE_OCTAL:
36− * '\NNN' - byte with octal value NNN (1 to 3 digits)
37− * %UNESCAPE_HEX:
38− * '\xHH' - byte with hexadecimal value HH (1 to 2 digits)
39− * %UNESCAPE_SPECIAL:
40− * '\"' - double quote
41− * '\\' - backslash
42− * '\a' - alert (BEL)
43− * '\e' - escape
44− * %UNESCAPE_ANY:
45− * all previous together
46− *
47− * Returns amount of characters processed to the destination buffer excluding
48− * trailing '\0'.
49− *
50− * Because the size of the output will be the same as or less than the size of
51− * the input, the transformation may be performed in place.
52− *
53− * Caller must provide valid source and destination pointers. Be aware that
54− * destination buffer will always be NULL-terminated. Source string must be
55− * NULL-terminated as well.
56− */
5723 int string_unescape(char *src, char *dst, size_t size, unsigned int flags);
5824
5925 static inline int string_unescape_inplace(char *buf, unsigned int flags)
@@ -71,4 +37,35 @@ static inline int string_unescape_any_inplace(char *buf) · 11 unmodified lines
7137 return string_unescape_any(buf, buf, 0);
7238 }
7339
40+#define ESCAPE_SPACE 0x01
41+#define ESCAPE_SPECIAL 0x02
42+#define ESCAPE_NULL 0x04
43+#define ESCAPE_OCTAL 0x08
44+#define ESCAPE_ANY \
45+ (ESCAPE_SPACE | ESCAPE_OCTAL | ESCAPE_SPECIAL | ESCAPE_NULL)
46+#define ESCAPE_NP 0x10
47+#define ESCAPE_ANY_NP (ESCAPE_ANY | ESCAPE_NP)
48+#define ESCAPE_HEX 0x20
49+
50+int string_escape_mem(const char *src, size_t isz, char **dst, size_t osz,
51+ unsigned int flags, const char *esc);
52+
53+static inline int string_escape_mem_any_np(const char *src, size_t isz,
54+ char **dst, size_t osz, const char *esc)
55+{
56+ return string_escape_mem(src, isz, dst, osz, ESCAPE_ANY_NP, esc);
57+}
58+
59+static inline int string_escape_str(const char *src, char **dst, size_t sz,
60+ unsigned int flags, const char *esc)
61+{
62+ return string_escape_mem(src, strlen(src), dst, sz, flags, esc);
63+}
64+
65+static inline int string_escape_str_any_np(const char *src, char **dst,
66+ size_t sz, const char *esc)
67+{
68+ return string_escape_str(src, dst, sz, ESCAPE_ANY_NP, esc);
69+}
70+
7471 #endif
include/net/lib80211.h+0−5
@@ -32,11 +32,6 @@ · 31 unmodified lines
3232 #include <linux/timer.h>
3333 #include <linux/seq_file.h>
3434
35−/* print_ssid() is intended to be used in debug (and possibly error)
36− * messages. It should never be used for passing ssid to user space. */
37−const char *print_ssid(char *buf, const char *ssid, u8 ssid_len);
38−#define DECLARE_SSID_BUF(var) char var[IEEE80211_MAX_SSID_LEN * 4 + 1] __maybe_unused
39−
4035 #define NUM_WEP_KEYS 4
4136
4237 enum {
init/Kconfig+1−0
@@ -838,6 +838,7 @@ config LOG_BUF_SHIFT · 837 unmodified lines
838838
839839 config LOG_CPU_MAX_BUF_SHIFT
840840 int "CPU kernel log buffer size contribution (13 => 8 KB, 17 => 128KB)"
841+ depends on SMP
841842 range 0 21
842843 default 12 if !BASE_SMALL
843844 default 0 if BASE_SMALL
init/initramfs.c+17−17
@@ -197,14 +197,14 @@ static __initdata enum state { · 196 unmodified lines
197197 } state, next_state;
198198
199199 static __initdata char *victim;
200−static unsigned long count __initdata;
200+static unsigned long byte_count __initdata;
201201 static __initdata loff_t this_header, next_header;
202202
203203 static inline void __init eat(unsigned n)
204204 {
205205 victim += n;
206206 this_header += n;
207− count -= n;
207+ byte_count -= n;
208208 }
209209
210210 static __initdata char *vcollected;
@@ -214,7 +214,7 @@ static __initdata char *collect; · 3 unmodified lines
214214
215215 static void __init read_into(char *buf, unsigned size, enum state next)
216216 {
217− if (count >= size) {
217+ if (byte_count >= size) {
218218 collected = victim;
219219 eat(size);
220220 state = next;
@@ -237,8 +237,8 @@ static int __init do_start(void) · 16 unmodified lines
237237 static int __init do_collect(void)
238238 {
239239 unsigned long n = remains;
240− if (count < n)
241− n = count;
240+ if (byte_count < n)
241+ n = byte_count;
242242 memcpy(collect, victim, n);
243243 eat(n);
244244 collect += n;
@@ -280,8 +280,8 @@ static int __init do_header(void) · 35 unmodified lines
280280
281281 static int __init do_skip(void)
282282 {
283− if (this_header + count < next_header) {
284− eat(count);
283+ if (this_header + byte_count < next_header) {
284+ eat(byte_count);
285285 return 1;
286286 } else {
287287 eat(next_header - this_header);
@@ -292,9 +292,9 @@ static int __init do_skip(void) · 4 unmodified lines
292292
293293 static int __init do_reset(void)
294294 {
295− while(count && *victim == '\0')
295+ while (byte_count && *victim == '\0')
296296 eat(1);
297− if (count && (this_header & 3))
297+ if (byte_count && (this_header & 3))
298298 error("broken padding");
299299 return 1;
300300 }
@@ -309,11 +309,11 @@ static int __init maybe_link(void) · 8 unmodified lines
309309 return 0;
310310 }
311311
312−static void __init clean_path(char *path, umode_t mode)
312+static void __init clean_path(char *path, umode_t fmode)
313313 {
314314 struct stat st;
315315
316− if (!sys_newlstat(path, &st) && (st.st_mode^mode) & S_IFMT) {
316+ if (!sys_newlstat(path, &st) && (st.st_mode ^ fmode) & S_IFMT) {
317317 if (S_ISDIR(st.st_mode))
318318 sys_rmdir(path);
319319 else
@@ -368,7 +368,7 @@ static int __init do_name(void) · 48 unmodified lines
368368
369369 static int __init do_copy(void)
370370 {
371− if (count >= body_len) {
371+ if (byte_count >= body_len) {
372372 if (xwrite(wfd, victim, body_len) != body_len)
373373 error("write error");
374374 sys_close(wfd);
@@ -378,10 +378,10 @@ static int __init do_copy(void) · 3 unmodified lines
378378 state = SkipIt;
379379 return 0;
380380 } else {
381− if (xwrite(wfd, victim, count) != count)
381+ if (xwrite(wfd, victim, byte_count) != byte_count)
382382 error("write error");
383− body_len -= count;
384− eat(count);
383+ body_len -= byte_count;
384+ eat(byte_count);
385385 return 1;
386386 }
387387 }
@@ -411,12 +411,12 @@ static __initdata int (*actions[])(void) = { · 23 unmodified lines
411411
412412 static long __init write_buffer(char *buf, unsigned long len)
413413 {
414− count = len;
414+ byte_count = len;
415415 victim = buf;
416416
417417 while (!actions[state]())
418418 ;
419− return len - count;
419+ return len - byte_count;
420420 }
421421
422422 static long __init flush_buffer(void *bufv, unsigned long len)
init/main.c+0−2
@@ -501,7 +501,6 @@ asmlinkage __visible void __init start_kernel(void) · 500 unmodified lines
501501 {
502502 char *command_line;
503503 char *after_dashes;
504− extern const struct kernel_param __start___param[], __stop___param[];
505504
506505 /*
507506 * Need to run as early as possible, to initialize the
@@ -844,7 +843,6 @@ static char *initcall_level_names[] __initdata = { · 336 unmodified lines
844843
845844 static void __init do_initcall_level(int level)
846845 {
847− extern const struct kernel_param __start___param[], __stop___param[];
848846 initcall_t *fn;
849847
850848 strcpy(initcall_command_line, saved_command_line);
ipc/compat.c+46−46
@@ -171,32 +171,32 @@ static inline int __put_compat_ipc64_perm(struct ipc64_perm *p64, · 170 unmodified lines
171171 }
172172
173173 static inline int __put_compat_ipc_perm(struct ipc64_perm *p,
174− struct compat_ipc_perm __user *up)
174+ struct compat_ipc_perm __user *uip)
175175 {
176176 int err;
177177 __compat_uid_t u;
178178 __compat_gid_t g;
179179
180− err = __put_user(p->key, &up->key);
180+ err = __put_user(p->key, &uip->key);
181181 SET_UID(u, p->uid);
182− err |= __put_user(u, &up->uid);
182+ err |= __put_user(u, &uip->uid);
183183 SET_GID(g, p->gid);
184− err |= __put_user(g, &up->gid);
184+ err |= __put_user(g, &uip->gid);
185185 SET_UID(u, p->cuid);
186− err |= __put_user(u, &up->cuid);
186+ err |= __put_user(u, &uip->cuid);
187187 SET_GID(g, p->cgid);
188− err |= __put_user(g, &up->cgid);
189− err |= __put_user(p->mode, &up->mode);
190− err |= __put_user(p->seq, &up->seq);
188+ err |= __put_user(g, &uip->cgid);
189+ err |= __put_user(p->mode, &uip->mode);
190+ err |= __put_user(p->seq, &uip->seq);
191191 return err;
192192 }
193193
194−static inline int get_compat_semid64_ds(struct semid64_ds *s64,
194+static inline int get_compat_semid64_ds(struct semid64_ds *sem64,
195195 struct compat_semid64_ds __user *up64)
196196 {
197197 if (!access_ok(VERIFY_READ, up64, sizeof(*up64)))
198198 return -EFAULT;
199− return __get_compat_ipc64_perm(&s64->sem_perm, &up64->sem_perm);
199+ return __get_compat_ipc64_perm(&sem64->sem_perm, &up64->sem_perm);
200200 }
201201
202202 static inline int get_compat_semid_ds(struct semid64_ds *s,
@@ -207,17 +207,17 @@ static inline int get_compat_semid_ds(struct semid64_ds *s, · 4 unmodified lines
207207 return __get_compat_ipc_perm(&s->sem_perm, &up->sem_perm);
208208 }
209209
210−static inline int put_compat_semid64_ds(struct semid64_ds *s64,
210+static inline int put_compat_semid64_ds(struct semid64_ds *sem64,
211211 struct compat_semid64_ds __user *up64)
212212 {
213213 int err;
214214
215215 if (!access_ok(VERIFY_WRITE, up64, sizeof(*up64)))
216216 return -EFAULT;
217− err = __put_compat_ipc64_perm(&s64->sem_perm, &up64->sem_perm);
218− err |= __put_user(s64->sem_otime, &up64->sem_otime);
219− err |= __put_user(s64->sem_ctime, &up64->sem_ctime);
220− err |= __put_user(s64->sem_nsems, &up64->sem_nsems);
217+ err = __put_compat_ipc64_perm(&sem64->sem_perm, &up64->sem_perm);
218+ err |= __put_user(sem64->sem_otime, &up64->sem_otime);
219+ err |= __put_user(sem64->sem_ctime, &up64->sem_ctime);
220+ err |= __put_user(sem64->sem_nsems, &up64->sem_nsems);
221221 return err;
222222 }
223223
@@ -239,11 +239,11 @@ static long do_compat_semctl(int first, int second, int third, u32 pad) · 15 unmodified lines
239239 {
240240 unsigned long fourth;
241241 int err, err2;
242− struct semid64_ds s64;
242+ struct semid64_ds sem64;
243243 struct semid64_ds __user *up64;
244244 int version = compat_ipc_parse_version(&third);
245245
246− memset(&s64, 0, sizeof(s64));
246+ memset(&sem64, 0, sizeof(sem64));
247247
248248 if ((third & (~IPC_64)) == SETVAL)
249249 #ifdef __BIG_ENDIAN
@@ -269,29 +269,29 @@ static long do_compat_semctl(int first, int second, int third, u32 pad) · 19 unmodified lines
269269
270270 case IPC_STAT:
271271 case SEM_STAT:
272− up64 = compat_alloc_user_space(sizeof(s64));
272+ up64 = compat_alloc_user_space(sizeof(sem64));
273273 fourth = (unsigned long)up64;
274274 err = sys_semctl(first, second, third, fourth);
275275 if (err < 0)
276276 break;
277− if (copy_from_user(&s64, up64, sizeof(s64)))
277+ if (copy_from_user(&sem64, up64, sizeof(sem64)))
278278 err2 = -EFAULT;
279279 else if (version == IPC_64)
280− err2 = put_compat_semid64_ds(&s64, compat_ptr(pad));
280+ err2 = put_compat_semid64_ds(&sem64, compat_ptr(pad));
281281 else
282− err2 = put_compat_semid_ds(&s64, compat_ptr(pad));
282+ err2 = put_compat_semid_ds(&sem64, compat_ptr(pad));
283283 if (err2)
284284 err = -EFAULT;
285285 break;
286286
287287 case IPC_SET:
288288 if (version == IPC_64)
289− err = get_compat_semid64_ds(&s64, compat_ptr(pad));
289+ err = get_compat_semid64_ds(&sem64, compat_ptr(pad));
290290 else
291− err = get_compat_semid_ds(&s64, compat_ptr(pad));
291+ err = get_compat_semid_ds(&sem64, compat_ptr(pad));
292292
293− up64 = compat_alloc_user_space(sizeof(s64));
294− if (copy_to_user(up64, &s64, sizeof(s64)))
293+ up64 = compat_alloc_user_space(sizeof(sem64));
294+ if (copy_to_user(up64, &sem64, sizeof(sem64)))
295295 err = -EFAULT;
296296 if (err)
297297 break;
@@ -561,12 +561,12 @@ COMPAT_SYSCALL_DEFINE3(shmat, int, shmid, compat_uptr_t, shmaddr, int, shmflg) · 263 unmodified lines
561561 return (long)ret;
562562 }
563563
564−static inline int get_compat_shmid64_ds(struct shmid64_ds *s64,
564+static inline int get_compat_shmid64_ds(struct shmid64_ds *sem64,
565565 struct compat_shmid64_ds __user *up64)
566566 {
567567 if (!access_ok(VERIFY_READ, up64, sizeof(*up64)))
568568 return -EFAULT;
569− return __get_compat_ipc64_perm(&s64->shm_perm, &up64->shm_perm);
569+ return __get_compat_ipc64_perm(&sem64->shm_perm, &up64->shm_perm);
570570 }
571571
572572 static inline int get_compat_shmid_ds(struct shmid64_ds *s,
@@ -577,21 +577,21 @@ static inline int get_compat_shmid_ds(struct shmid64_ds *s, · 4 unmodified lines
577577 return __get_compat_ipc_perm(&s->shm_perm, &up->shm_perm);
578578 }
579579
580−static inline int put_compat_shmid64_ds(struct shmid64_ds *s64,
580+static inline int put_compat_shmid64_ds(struct shmid64_ds *sem64,
581581 struct compat_shmid64_ds __user *up64)
582582 {
583583 int err;
584584
585585 if (!access_ok(VERIFY_WRITE, up64, sizeof(*up64)))
586586 return -EFAULT;
587− err = __put_compat_ipc64_perm(&s64->shm_perm, &up64->shm_perm);
588− err |= __put_user(s64->shm_atime, &up64->shm_atime);
589− err |= __put_user(s64->shm_dtime, &up64->shm_dtime);
590− err |= __put_user(s64->shm_ctime, &up64->shm_ctime);
591− err |= __put_user(s64->shm_segsz, &up64->shm_segsz);
592− err |= __put_user(s64->shm_nattch, &up64->shm_nattch);
593− err |= __put_user(s64->shm_cpid, &up64->shm_cpid);
594− err |= __put_user(s64->shm_lpid, &up64->shm_lpid);
587+ err = __put_compat_ipc64_perm(&sem64->shm_perm, &up64->shm_perm);
588+ err |= __put_user(sem64->shm_atime, &up64->shm_atime);
589+ err |= __put_user(sem64->shm_dtime, &up64->shm_dtime);
590+ err |= __put_user(sem64->shm_ctime, &up64->shm_ctime);
591+ err |= __put_user(sem64->shm_segsz, &up64->shm_segsz);
592+ err |= __put_user(sem64->shm_nattch, &up64->shm_nattch);
593+ err |= __put_user(sem64->shm_cpid, &up64->shm_cpid);
594+ err |= __put_user(sem64->shm_lpid, &up64->shm_lpid);
595595 return err;
596596 }
597597
@@ -668,12 +668,12 @@ static inline int put_compat_shm_info(struct shm_info __user *ip, · 70 unmodified lines
668668 COMPAT_SYSCALL_DEFINE3(shmctl, int, first, int, second, void __user *, uptr)
669669 {
670670 void __user *p;
671− struct shmid64_ds s64;
671+ struct shmid64_ds sem64;
672672 struct shminfo64 smi;
673673 int err, err2;
674674 int version = compat_ipc_parse_version(&second);
675675
676− memset(&s64, 0, sizeof(s64));
676+ memset(&sem64, 0, sizeof(sem64));
677677
678678 switch (second & (~IPC_64)) {
679679 case IPC_RMID:
@@ -700,14 +700,14 @@ COMPAT_SYSCALL_DEFINE3(shmctl, int, first, int, second, void __user *, uptr) · 20 unmodified lines
700700
701701 case IPC_SET:
702702 if (version == IPC_64)
703− err = get_compat_shmid64_ds(&s64, uptr);
703+ err = get_compat_shmid64_ds(&sem64, uptr);
704704 else
705− err = get_compat_shmid_ds(&s64, uptr);
705+ err = get_compat_shmid_ds(&sem64, uptr);
706706
707707 if (err)
708708 break;
709− p = compat_alloc_user_space(sizeof(s64));
710− if (copy_to_user(p, &s64, sizeof(s64)))
709+ p = compat_alloc_user_space(sizeof(sem64));
710+ if (copy_to_user(p, &sem64, sizeof(sem64)))
711711 err = -EFAULT;
712712 else
713713 err = sys_shmctl(first, second, p);
@@ -715,16 +715,16 @@ COMPAT_SYSCALL_DEFINE3(shmctl, int, first, int, second, void __user *, uptr) · 1 unmodified line
715715
716716 case IPC_STAT:
717717 case SHM_STAT:
718− p = compat_alloc_user_space(sizeof(s64));
718+ p = compat_alloc_user_space(sizeof(sem64));
719719 err = sys_shmctl(first, second, p);
720720 if (err < 0)
721721 break;
722− if (copy_from_user(&s64, p, sizeof(s64)))
722+ if (copy_from_user(&sem64, p, sizeof(sem64)))
723723 err2 = -EFAULT;
724724 else if (version == IPC_64)
725− err2 = put_compat_shmid64_ds(&s64, uptr);
725+ err2 = put_compat_shmid64_ds(&sem64, uptr);
726726 else
727− err2 = put_compat_shmid_ds(&s64, uptr);
727+ err2 = put_compat_shmid_ds(&sem64, uptr);
728728 if (err2)
729729 err = -EFAULT;
730730 break;
ipc/ipc_sysctl.c+1−2
@@ -123,7 +123,6 @@ static int proc_ipcauto_dointvec_minmax(struct ctl_table *table, int write, · 122 unmodified lines
123123 void __user *buffer, size_t *lenp, loff_t *ppos)
124124 {
125125 struct ctl_table ipc_table;
126− size_t lenp_bef = *lenp;
127126 int oldval;
128127 int rc;
129128
@@ -133,7 +132,7 @@ static int proc_ipcauto_dointvec_minmax(struct ctl_table *table, int write, · 3 unmodified lines
133132
134133 rc = proc_dointvec_minmax(&ipc_table, write, buffer, lenp, ppos);
135134
136− if (write && !rc && lenp_bef == *lenp) {
135+ if (write && !rc) {
137136 int newval = *((int *)(ipc_table.data));
138137 /*
139138 * The file "auto_msgmni" has correctly been set.
ipc/shm.c+0−7
@@ -1172,13 +1172,6 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr, · 1171 unmodified lines
11721172
11731173 if (find_vma_intersection(current->mm, addr, addr + size))
11741174 goto invalid;
1175− /*
1176− * If shm segment goes below stack, make sure there is some
1177− * space left for the stack to grow (at least 4 pages).
1178− */
1179− if (addr < current->mm->start_stack &&
1180− addr > current->mm->start_stack - size - PAGE_SIZE * 5)
1181− goto invalid;
11821175 }
11831176
11841177 addr = do_mmap_pgoff(file, addr, size, prot, flags, 0, &populate);
ipc/util.c+4−16
@@ -892,28 +892,16 @@ static const struct seq_operations sysvipc_proc_seqops = { · 891 unmodified lines
892892
893893 static int sysvipc_proc_open(struct inode *inode, struct file *file)
894894 {
895− int ret;
896− struct seq_file *seq;
897895 struct ipc_proc_iter *iter;
898896
899− ret = -ENOMEM;
900− iter = kmalloc(sizeof(*iter), GFP_KERNEL);
897+ iter = __seq_open_private(file, &sysvipc_proc_seqops, sizeof(*iter));
901898 if (!iter)
902− goto out;
903−
904− ret = seq_open(file, &sysvipc_proc_seqops);
905− if (ret) {
906− kfree(iter);
907− goto out;
908− }
909−
910− seq = file->private_data;
911− seq->private = iter;
899+ return -ENOMEM;
912900
913901 iter->iface = PDE_DATA(inode);
914902 iter->ns = get_ipc_ns(current->nsproxy->ipc_ns);
915−out:
916− return ret;
903+
904+ return 0;
917905 }
918906
919907 static int sysvipc_proc_release(struct inode *inode, struct file *file)
kernel/debug/kdb/kdb_bp.c+3−3
@@ -52,11 +52,11 @@ static int kdb_parsebp(int argc, const char **argv, int *nextargp, kdb_bp_t *bp) · 51 unmodified lines
5252
5353 bp->bph_length = 1;
5454 if ((argc + 1) != nextarg) {
55− if (strnicmp(argv[nextarg], "datar", sizeof("datar")) == 0)
55+ if (strncasecmp(argv[nextarg], "datar", sizeof("datar")) == 0)
5656 bp->bp_type = BP_ACCESS_WATCHPOINT;
57− else if (strnicmp(argv[nextarg], "dataw", sizeof("dataw")) == 0)
57+ else if (strncasecmp(argv[nextarg], "dataw", sizeof("dataw")) == 0)
5858 bp->bp_type = BP_WRITE_WATCHPOINT;
59− else if (strnicmp(argv[nextarg], "inst", sizeof("inst")) == 0)
59+ else if (strncasecmp(argv[nextarg], "inst", sizeof("inst")) == 0)
6060 bp->bp_type = BP_HARDWARE_BREAKPOINT;
6161 else
6262 return KDB_ARGCOUNT;
kernel/kallsyms.c+2−9
@@ -565,19 +565,12 @@ static int kallsyms_open(struct inode *inode, struct file *file) · 564 unmodified lines
565565 * using get_symbol_offset for every symbol.
566566 */
567567 struct kallsym_iter *iter;
568− int ret;
569−
570− iter = kmalloc(sizeof(*iter), GFP_KERNEL);
568+ iter = __seq_open_private(file, &kallsyms_op, sizeof(*iter));
571569 if (!iter)
572570 return -ENOMEM;
573571 reset_iter(iter, 0);
574572
575− ret = seq_open(file, &kallsyms_op);
576− if (ret == 0)
577− ((struct seq_file *)file->private_data)->private = iter;
578− else
579− kfree(iter);
580− return ret;
573+ return 0;
581574 }
582575
583576 #ifdef CONFIG_KGDB_KDB
kernel/kexec.c+9−23
@@ -1759,7 +1759,6 @@ static __initdata char *suffix_tbl[] = { · 1758 unmodified lines
17591759 */
17601760 static int __init parse_crashkernel_suffix(char *cmdline,
17611761 unsigned long long *crash_size,
1762− unsigned long long *crash_base,
17631762 const char *suffix)
17641763 {
17651764 char *cur = cmdline;
@@ -1848,7 +1847,7 @@ static int __init __parse_crashkernel(char *cmdline, · 82 unmodified lines
18481847
18491848 if (suffix)
18501849 return parse_crashkernel_suffix(ck_cmdline, crash_size,
1851− crash_base, suffix);
1850+ suffix);
18521851 /*
18531852 * if the commandline contains a ':', then that's the extended
18541853 * syntax -- if not, it must be the classic syntax
@@ -2016,22 +2015,6 @@ static int __init crash_save_vmcoreinfo_init(void) · 161 unmodified lines
20162015 subsys_initcall(crash_save_vmcoreinfo_init);
20172016
20182017 #ifdef CONFIG_KEXEC_FILE
2019−static int __kexec_add_segment(struct kimage *image, char *buf,
2020− unsigned long bufsz, unsigned long mem,
2021− unsigned long memsz)
2022−{
2023− struct kexec_segment *ksegment;
2024−
2025− ksegment = &image->segment[image->nr_segments];
2026− ksegment->kbuf = buf;
2027− ksegment->bufsz = bufsz;
2028− ksegment->mem = mem;
2029− ksegment->memsz = memsz;
2030− image->nr_segments++;
2031−
2032− return 0;
2033−}
2034−
20352018 static int locate_mem_hole_top_down(unsigned long start, unsigned long end,
20362019 struct kexec_buf *kbuf)
20372020 {
@@ -2064,8 +2047,7 @@ static int locate_mem_hole_top_down(unsigned long start, unsigned long end, · 26 unmodified lines
20642047 } while (1);
20652048
20662049 /* If we are here, we found a suitable memory range */
2067− __kexec_add_segment(image, kbuf->buffer, kbuf->bufsz, temp_start,
2068− kbuf->memsz);
2050+ kbuf->mem = temp_start;
20692051
20702052 /* Success, stop navigating through remaining System RAM ranges */
20712053 return 1;
@@ -2099,8 +2081,7 @@ static int locate_mem_hole_bottom_up(unsigned long start, unsigned long end, · 27 unmodified lines
20992081 } while (1);
21002082
21012083 /* If we are here, we found a suitable memory range */
2102− __kexec_add_segment(image, kbuf->buffer, kbuf->bufsz, temp_start,
2103− kbuf->memsz);
2084+ kbuf->mem = temp_start;
21042085
21052086 /* Success, stop navigating through remaining System RAM ranges */
21062087 return 1;
@@ -2187,7 +2168,12 @@ int kexec_add_buffer(struct kimage *image, char *buffer, unsigned long bufsz, · 80 unmodified lines
21872168 }
21882169
21892170 /* Found a suitable memory range */
2190− ksegment = &image->segment[image->nr_segments - 1];
2171+ ksegment = &image->segment[image->nr_segments];
2172+ ksegment->kbuf = kbuf->buffer;
2173+ ksegment->bufsz = kbuf->bufsz;
2174+ ksegment->mem = kbuf->mem;
2175+ ksegment->memsz = kbuf->memsz;
2176+ image->nr_segments++;
21912177 *load_addr = ksegment->mem;
21922178 return 0;
21932179 }
kernel/params.c+3−4
@@ -19,6 +19,7 @@ · 18 unmodified lines
1919 #include <linux/string.h>
2020 #include <linux/errno.h>
2121 #include <linux/module.h>
22+#include <linux/moduleparam.h>
2223 #include <linux/device.h>
2324 #include <linux/err.h>
2425 #include <linux/slab.h>
@@ -513,8 +514,6 @@ EXPORT_SYMBOL(param_ops_string); · 488 unmodified lines
513514 #define to_module_attr(n) container_of(n, struct module_attribute, attr)
514515 #define to_module_kobject(n) container_of(n, struct module_kobject, kobj)
515516
516−extern struct kernel_param __start___param[], __stop___param[];
517−
518517 struct param_attribute
519518 {
520519 struct module_attribute mattr;
@@ -774,7 +773,7 @@ static struct module_kobject * __init locate_module_kobject(const char *name) · 253 unmodified lines
774773 }
775774
776775 static void __init kernel_add_sysfs_param(const char *name,
777− struct kernel_param *kparam,
776+ const struct kernel_param *kparam,
778777 unsigned int name_skip)
779778 {
780779 struct module_kobject *mk;
@@ -809,7 +808,7 @@ static void __init kernel_add_sysfs_param(const char *name, · 28 unmodified lines
809808 */
810809 static void __init param_sysfs_builtin(void)
811810 {
812− struct kernel_param *kp;
811+ const struct kernel_param *kp;
813812 unsigned int name_len;
814813 char modname[MODULE_NAME_LEN];
815814
kernel/printk/printk.c+7−7
@@ -267,7 +267,6 @@ static u32 clear_idx; · 266 unmodified lines
267267 #define LOG_ALIGN __alignof__(struct printk_log)
268268 #endif
269269 #define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT)
270−#define __LOG_CPU_MAX_BUF_LEN (1 << CONFIG_LOG_CPU_MAX_BUF_SHIFT)
271270 static char __log_buf[__LOG_BUF_LEN] __aligned(LOG_ALIGN);
272271 static char *log_buf = __log_buf;
273272 static u32 log_buf_len = __LOG_BUF_LEN;
@@ -852,6 +851,9 @@ static int __init log_buf_len_setup(char *str) · 578 unmodified lines
852851 }
853852 early_param("log_buf_len", log_buf_len_setup);
854853
854+#ifdef CONFIG_SMP
855+#define __LOG_CPU_MAX_BUF_LEN (1 << CONFIG_LOG_CPU_MAX_BUF_SHIFT)
856+
855857 static void __init log_buf_add_cpu(void)
856858 {
857859 unsigned int cpu_extra;
@@ -878,6 +880,9 @@ static void __init log_buf_add_cpu(void) · 20 unmodified lines
878880
879881 log_buf_len_update(cpu_extra + __LOG_BUF_LEN);
880882 }
883+#else /* !CONFIG_SMP */
884+static inline void log_buf_add_cpu(void) {}
885+#endif /* CONFIG_SMP */
881886
882887 void __init setup_log_buf(int early)
883888 {
@@ -1674,12 +1679,7 @@ asmlinkage int vprintk_emit(int facility, int level, · 790 unmodified lines
16741679 * The printf needs to come first; we need the syslog
16751680 * prefix which might be passed-in as a parameter.
16761681 */
1677− if (in_sched)
1678− text_len = scnprintf(text, sizeof(textbuf),
1679− KERN_WARNING "[sched_delayed] ");
1680−
1681− text_len += vscnprintf(text + text_len,
1682− sizeof(textbuf) - text_len, fmt, args);
1682+ text_len = vscnprintf(text, sizeof(textbuf), fmt, args);
16831683
16841684 /* mark and strip a trailing newline */
16851685 if (text_len && text[text_len-1] == '\n') {
kernel/resource.c+36−0
@@ -491,6 +491,42 @@ int __weak page_is_ram(unsigned long pfn) · 490 unmodified lines
491491 }
492492 EXPORT_SYMBOL_GPL(page_is_ram);
493493
494+/*
495+ * Search for a resouce entry that fully contains the specified region.
496+ * If found, return 1 if it is RAM, 0 if not.
497+ * If not found, or region is not fully contained, return -1
498+ *
499+ * Used by the ioremap functions to ensure the user is not remapping RAM and is
500+ * a vast speed up over walking through the resource table page by page.
501+ */
502+int region_is_ram(resource_size_t start, unsigned long size)
503+{
504+ struct resource *p;
505+ resource_size_t end = start + size - 1;
506+ int flags = IORESOURCE_MEM | IORESOURCE_BUSY;
507+ const char *name = "System RAM";
508+ int ret = -1;
509+
510+ read_lock(&resource_lock);
511+ for (p = iomem_resource.child; p ; p = p->sibling) {
512+ if (end < p->start)
513+ continue;
514+
515+ if (p->start <= start && end <= p->end) {
516+ /* resource fully contains region */
517+ if ((p->flags != flags) || strcmp(p->name, name))
518+ ret = 0;
519+ else
520+ ret = 1;
521+ break;
522+ }
523+ if (p->end < start)
524+ break; /* not found */
525+ }
526+ read_unlock(&resource_lock);
527+ return ret;
528+}
529+
494530 void __weak arch_remove_reservations(struct resource *avail)
495531 {
496532 }
kernel/watchdog.c+48−2
@@ -59,6 +59,25 @@ static unsigned long soft_lockup_nmi_warn; · 58 unmodified lines
5959 static int hardlockup_panic =
6060 CONFIG_BOOTPARAM_HARDLOCKUP_PANIC_VALUE;
6161
62+static bool hardlockup_detector_enabled = true;
63+/*
64+ * We may not want to enable hard lockup detection by default in all cases,
65+ * for example when running the kernel as a guest on a hypervisor. In these
66+ * cases this function can be called to disable hard lockup detection. This
67+ * function should only be executed once by the boot processor before the
68+ * kernel command line parameters are parsed, because otherwise it is not
69+ * possible to override this in hardlockup_panic_setup().
70+ */
71+void watchdog_enable_hardlockup_detector(bool val)
72+{
73+ hardlockup_detector_enabled = val;
74+}
75+
76+bool watchdog_hardlockup_detector_is_enabled(void)
77+{
78+ return hardlockup_detector_enabled;
79+}
80+
6281 static int __init hardlockup_panic_setup(char *str)
6382 {
6483 if (!strncmp(str, "panic", 5))
@@ -67,6 +86,14 @@ static int __init hardlockup_panic_setup(char *str) · 2 unmodified lines
6786 hardlockup_panic = 0;
6887 else if (!strncmp(str, "0", 1))
6988 watchdog_user_enabled = 0;
89+ else if (!strncmp(str, "1", 1) || !strncmp(str, "2", 1)) {
90+ /*
91+ * Setting 'nmi_watchdog=1' or 'nmi_watchdog=2' (legacy option)
92+ * has the same effect.
93+ */
94+ watchdog_user_enabled = 1;
95+ watchdog_enable_hardlockup_detector(true);
96+ }
7097 return 1;
7198 }
7299 __setup("nmi_watchdog=", hardlockup_panic_setup);
@@ -465,6 +492,15 @@ static int watchdog_nmi_enable(unsigned int cpu) · 392 unmodified lines
465492 struct perf_event_attr *wd_attr;
466493 struct perf_event *event = per_cpu(watchdog_ev, cpu);
467494
495+ /*
496+ * Some kernels need to default hard lockup detection to
497+ * 'disabled', for example a guest on a hypervisor.
498+ */
499+ if (!watchdog_hardlockup_detector_is_enabled()) {
500+ event = ERR_PTR(-ENOENT);
501+ goto handle_err;
502+ }
503+
468504 /* is it already setup and enabled? */
469505 if (event && event->state > PERF_EVENT_STATE_OFF)
470506 goto out;
@@ -479,6 +515,7 @@ static int watchdog_nmi_enable(unsigned int cpu) · 8 unmodified lines
479515 /* Try to register using hardware perf events */
480516 event = perf_event_create_kernel_counter(wd_attr, cpu, NULL, watchdog_overflow_callback, NULL);
481517
518+handle_err:
482519 /* save cpu0 error for future comparision */
483520 if (cpu == 0 && IS_ERR(event))
484521 cpu0_err = PTR_ERR(event);
@@ -624,11 +661,13 @@ int proc_dowatchdog(struct ctl_table *table, int write, · 139 unmodified lines
624661 void __user *buffer, size_t *lenp, loff_t *ppos)
625662 {
626663 int err, old_thresh, old_enabled;
664+ bool old_hardlockup;
627665 static DEFINE_MUTEX(watchdog_proc_mutex);
628666
629667 mutex_lock(&watchdog_proc_mutex);
630668 old_thresh = ACCESS_ONCE(watchdog_thresh);
631669 old_enabled = ACCESS_ONCE(watchdog_user_enabled);
670+ old_hardlockup = watchdog_hardlockup_detector_is_enabled();
632671
633672 err = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
634673 if (err || !write)
@@ -640,15 +679,22 @@ int proc_dowatchdog(struct ctl_table *table, int write, · 5 unmodified lines
640679 * disabled. The 'watchdog_running' variable check in
641680 * watchdog_*_all_cpus() function takes care of this.
642681 */
643− if (watchdog_user_enabled && watchdog_thresh)
682+ if (watchdog_user_enabled && watchdog_thresh) {
683+ /*
684+ * Prevent a change in watchdog_thresh accidentally overriding
685+ * the enablement of the hardlockup detector.
686+ */
687+ if (watchdog_user_enabled != old_enabled)
688+ watchdog_enable_hardlockup_detector(true);
644689 err = watchdog_enable_all_cpus(old_thresh != watchdog_thresh);
645− else
690+ } else
646691 watchdog_disable_all_cpus();
647692
648693 /* Restore old values on failure */
649694 if (err) {
650695 watchdog_thresh = old_thresh;
651696 watchdog_user_enabled = old_enabled;
697+ watchdog_enable_hardlockup_detector(old_hardlockup);
652698 }
653699 out:
654700 mutex_unlock(&watchdog_proc_mutex);
lib/Kconfig.debug+1−1
@@ -1648,7 +1648,7 @@ config DMA_API_DEBUG · 1647 unmodified lines
16481648
16491649 If unsure, say N.
16501650
1651−config TEST_MODULE
1651+config TEST_LKM
16521652 tristate "Test module loading with 'hello world' module"
16531653 default n
16541654 depends on m
lib/Makefile+2−2
@@ -11,7 +11,7 @@ lib-y := ctype.o string.o vsprintf.o cmdline.o \ · 10 unmodified lines
1111 rbtree.o radix-tree.o dump_stack.o timerqueue.o\
1212 idr.o int_sqrt.o extable.o \
1313 sha1.o md5.o irq_regs.o reciprocal_div.o argv_split.o \
14− proportions.o flex_proportions.o prio_heap.o ratelimit.o show_mem.o \
14+ proportions.o flex_proportions.o ratelimit.o show_mem.o \
1515 is_single_threaded.o plist.o decompress.o kobject_uevent.o \
1616 earlycpio.o
1717
@@ -31,7 +31,7 @@ obj-y += string_helpers.o · 13 unmodified lines
3131 obj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o
3232 obj-y += kstrtox.o
3333 obj-$(CONFIG_TEST_KSTRTOX) += test-kstrtox.o
34−obj-$(CONFIG_TEST_MODULE) += test_module.o
34+obj-$(CONFIG_TEST_LKM) += test_module.o
3535 obj-$(CONFIG_TEST_USER_COPY) += test_user_copy.o
3636 obj-$(CONFIG_TEST_BPF) += test_bpf.o
3737 obj-$(CONFIG_TEST_FIRMWARE) += test_firmware.o
lib/dynamic_debug.c+2−15
@@ -819,22 +819,9 @@ static const struct seq_operations ddebug_proc_seqops = { · 818 unmodified lines
819819 */
820820 static int ddebug_proc_open(struct inode *inode, struct file *file)
821821 {
822− struct ddebug_iter *iter;
823− int err;
824−
825822 vpr_info("called\n");
826−
827− iter = kzalloc(sizeof(*iter), GFP_KERNEL);
828− if (iter == NULL)
829− return -ENOMEM;
830−
831− err = seq_open(file, &ddebug_proc_seqops);
832− if (err) {
833− kfree(iter);
834− return err;
835− }
836− ((struct seq_file *)file->private_data)->private = iter;
837− return 0;
823+ return seq_open_private(file, &ddebug_proc_seqops,
824+ sizeof(struct ddebug_iter));
838825 }
839826
840827 static const struct file_operations ddebug_proc_fops = {
lib/prio_heap.c+0−70
@@ -1,70 +0,0 @@
1−/*
2− * Simple insertion-only static-sized priority heap containing
3− * pointers, based on CLR, chapter 7
4− */
5−
6−#include <linux/slab.h>
7−#include <linux/prio_heap.h>
8−
9−int heap_init(struct ptr_heap *heap, size_t size, gfp_t gfp_mask,
10− int (*gt)(void *, void *))
11−{
12− heap->ptrs = kmalloc(size, gfp_mask);
13− if (!heap->ptrs)
14− return -ENOMEM;
15− heap->size = 0;
16− heap->max = size / sizeof(void *);
17− heap->gt = gt;
18− return 0;
19−}
20−
21−void heap_free(struct ptr_heap *heap)
22−{
23− kfree(heap->ptrs);
24−}
25−
26−void *heap_insert(struct ptr_heap *heap, void *p)
27−{
28− void *res;
29− void **ptrs = heap->ptrs;
30− int pos;
31−
32− if (heap->size < heap->max) {
33− /* Heap insertion */
34− pos = heap->size++;
35− while (pos > 0 && heap->gt(p, ptrs[(pos-1)/2])) {
36− ptrs[pos] = ptrs[(pos-1)/2];
37− pos = (pos-1)/2;
38− }
39− ptrs[pos] = p;
40− return NULL;
41− }
42−
43− /* The heap is full, so something will have to be dropped */
44−
45− /* If the new pointer is greater than the current max, drop it */
46− if (heap->gt(p, ptrs[0]))
47− return p;
48−
49− /* Replace the current max and heapify */
50− res = ptrs[0];
51− ptrs[0] = p;
52− pos = 0;
53−
54− while (1) {
55− int left = 2 * pos + 1;
56− int right = 2 * pos + 2;
57− int largest = pos;
58− if (left < heap->size && heap->gt(ptrs[left], p))
59− largest = left;
60− if (right < heap->size && heap->gt(ptrs[right], ptrs[largest]))
61− largest = right;
62− if (largest == pos)
63− break;
64− /* Push p down the heap one level and bump one up */
65− ptrs[pos] = ptrs[largest];
66− ptrs[largest] = p;
67− pos = largest;
68− }
69− return res;
70−}
lib/string.c+11−17
@@ -27,14 +27,14 @@ · 26 unmodified lines
2727 #include <linux/bug.h>
2828 #include <linux/errno.h>
2929
30−#ifndef __HAVE_ARCH_STRNICMP
30+#ifndef __HAVE_ARCH_STRNCASECMP
3131 /**
32− * strnicmp - Case insensitive, length-limited string comparison
32+ * strncasecmp - Case insensitive, length-limited string comparison
3333 * @s1: One string
3434 * @s2: The other string
3535 * @len: the maximum number of characters to compare
3636 */
37−int strnicmp(const char *s1, const char *s2, size_t len)
37+int strncasecmp(const char *s1, const char *s2, size_t len)
3838 {
3939 /* Yes, Virginia, it had better be unsigned */
4040 unsigned char c1, c2;
@@ -56,6 +56,14 @@ int strnicmp(const char *s1, const char *s2, size_t len) · 15 unmodified lines
5656 } while (--len);
5757 return (int)c1 - (int)c2;
5858 }
59+EXPORT_SYMBOL(strncasecmp);
60+#endif
61+#ifndef __HAVE_ARCH_STRNICMP
62+#undef strnicmp
63+int strnicmp(const char *s1, const char *s2, size_t len)
64+{
65+ return strncasecmp(s1, s2, len);
66+}
5967 EXPORT_SYMBOL(strnicmp);
6068 #endif
6169
@@ -73,20 +81,6 @@ int strcasecmp(const char *s1, const char *s2) · 11 unmodified lines
7381 EXPORT_SYMBOL(strcasecmp);
7482 #endif
7583
76−#ifndef __HAVE_ARCH_STRNCASECMP
77−int strncasecmp(const char *s1, const char *s2, size_t n)
78−{
79− int c1, c2;
80−
81− do {
82− c1 = tolower(*s1++);
83− c2 = tolower(*s2++);
84− } while ((--n > 0) && c1 == c2 && c1 != 0);
85− return c1 - c2;
86−}
87−EXPORT_SYMBOL(strncasecmp);
88−#endif
89−
9084 #ifndef __HAVE_ARCH_STRCPY
9185 /**
9286 * strcpy - Copy a %NUL terminated string
lib/string_helpers.c+312−0
@@ -8,6 +8,8 @@ · 7 unmodified lines
88 #include <linux/math64.h>
99 #include <linux/export.h>
1010 #include <linux/ctype.h>
11+#include <linux/errno.h>
12+#include <linux/string.h>
1113 #include <linux/string_helpers.h>
1214
1315 /**
@@ -168,6 +170,44 @@ static bool unescape_special(char **src, char **dst) · 154 unmodified lines
168170 return true;
169171 }
170172
173+/**
174+ * string_unescape - unquote characters in the given string
175+ * @src: source buffer (escaped)
176+ * @dst: destination buffer (unescaped)
177+ * @size: size of the destination buffer (0 to unlimit)
178+ * @flags: combination of the flags (bitwise OR):
179+ * %UNESCAPE_SPACE:
180+ * '\f' - form feed
181+ * '\n' - new line
182+ * '\r' - carriage return
183+ * '\t' - horizontal tab
184+ * '\v' - vertical tab
185+ * %UNESCAPE_OCTAL:
186+ * '\NNN' - byte with octal value NNN (1 to 3 digits)
187+ * %UNESCAPE_HEX:
188+ * '\xHH' - byte with hexadecimal value HH (1 to 2 digits)
189+ * %UNESCAPE_SPECIAL:
190+ * '\"' - double quote
191+ * '\\' - backslash
192+ * '\a' - alert (BEL)
193+ * '\e' - escape
194+ * %UNESCAPE_ANY:
195+ * all previous together
196+ *
197+ * Description:
198+ * The function unquotes characters in the given string.
199+ *
200+ * Because the size of the output will be the same as or less than the size of
201+ * the input, the transformation may be performed in place.
202+ *
203+ * Caller must provide valid source and destination pointers. Be aware that
204+ * destination buffer will always be NULL-terminated. Source string must be
205+ * NULL-terminated as well.
206+ *
207+ * Return:
208+ * The amount of the characters processed to the destination buffer excluding
209+ * trailing '\0' is returned.
210+ */
171211 int string_unescape(char *src, char *dst, size_t size, unsigned int flags)
172212 {
173213 char *out = dst;
@@ -202,3 +242,275 @@ int string_unescape(char *src, char *dst, size_t size, unsigned int flags) · 28 unmodified lines
202242 return out - dst;
203243 }
204244 EXPORT_SYMBOL(string_unescape);
245+
246+static int escape_passthrough(unsigned char c, char **dst, size_t *osz)
247+{
248+ char *out = *dst;
249+
250+ if (*osz < 1)
251+ return -ENOMEM;
252+
253+ *out++ = c;
254+
255+ *dst = out;
256+ *osz -= 1;
257+
258+ return 1;
259+}
260+
261+static int escape_space(unsigned char c, char **dst, size_t *osz)
262+{
263+ char *out = *dst;
264+ unsigned char to;
265+
266+ if (*osz < 2)
267+ return -ENOMEM;
268+
269+ switch (c) {
270+ case '\n':
271+ to = 'n';
272+ break;
273+ case '\r':
274+ to = 'r';
275+ break;
276+ case '\t':
277+ to = 't';
278+ break;
279+ case '\v':
280+ to = 'v';
281+ break;
282+ case '\f':
283+ to = 'f';
284+ break;
285+ default:
286+ return 0;
287+ }
288+
289+ *out++ = '\\';
290+ *out++ = to;
291+
292+ *dst = out;
293+ *osz -= 2;
294+
295+ return 1;
296+}
297+
298+static int escape_special(unsigned char c, char **dst, size_t *osz)
299+{
300+ char *out = *dst;
301+ unsigned char to;
302+
303+ if (*osz < 2)
304+ return -ENOMEM;
305+
306+ switch (c) {
307+ case '\\':
308+ to = '\\';
309+ break;
310+ case '\a':
311+ to = 'a';
312+ break;
313+ case '\e':
314+ to = 'e';
315+ break;
316+ default:
317+ return 0;
318+ }
319+
320+ *out++ = '\\';
321+ *out++ = to;
322+
323+ *dst = out;
324+ *osz -= 2;
325+
326+ return 1;
327+}
328+
329+static int escape_null(unsigned char c, char **dst, size_t *osz)
330+{
331+ char *out = *dst;
332+
333+ if (*osz < 2)
334+ return -ENOMEM;
335+
336+ if (c)
337+ return 0;
338+
339+ *out++ = '\\';
340+ *out++ = '0';
341+
342+ *dst = out;
343+ *osz -= 2;
344+
345+ return 1;
346+}
347+
348+static int escape_octal(unsigned char c, char **dst, size_t *osz)
349+{
350+ char *out = *dst;
351+
352+ if (*osz < 4)
353+ return -ENOMEM;
354+
355+ *out++ = '\\';
356+ *out++ = ((c >> 6) & 0x07) + '0';
357+ *out++ = ((c >> 3) & 0x07) + '0';
358+ *out++ = ((c >> 0) & 0x07) + '0';
359+
360+ *dst = out;
361+ *osz -= 4;
362+
363+ return 1;
364+}
365+
366+static int escape_hex(unsigned char c, char **dst, size_t *osz)
367+{
368+ char *out = *dst;
369+
370+ if (*osz < 4)
371+ return -ENOMEM;
372+
373+ *out++ = '\\';
374+ *out++ = 'x';
375+ *out++ = hex_asc_hi(c);
376+ *out++ = hex_asc_lo(c);
377+
378+ *dst = out;
379+ *osz -= 4;
380+
381+ return 1;
382+}
383+
384+/**
385+ * string_escape_mem - quote characters in the given memory buffer
386+ * @src: source buffer (unescaped)
387+ * @isz: source buffer size
388+ * @dst: destination buffer (escaped)
389+ * @osz: destination buffer size
390+ * @flags: combination of the flags (bitwise OR):
391+ * %ESCAPE_SPACE:
392+ * '\f' - form feed
393+ * '\n' - new line
394+ * '\r' - carriage return
395+ * '\t' - horizontal tab
396+ * '\v' - vertical tab
397+ * %ESCAPE_SPECIAL:
398+ * '\\' - backslash
399+ * '\a' - alert (BEL)
400+ * '\e' - escape
401+ * %ESCAPE_NULL:
402+ * '\0' - null
403+ * %ESCAPE_OCTAL:
404+ * '\NNN' - byte with octal value NNN (3 digits)
405+ * %ESCAPE_ANY:
406+ * all previous together
407+ * %ESCAPE_NP:
408+ * escape only non-printable characters (checked by isprint)
409+ * %ESCAPE_ANY_NP:
410+ * all previous together
411+ * %ESCAPE_HEX:
412+ * '\xHH' - byte with hexadecimal value HH (2 digits)
413+ * @esc: NULL-terminated string of characters any of which, if found in
414+ * the source, has to be escaped
415+ *
416+ * Description:
417+ * The process of escaping byte buffer includes several parts. They are applied
418+ * in the following sequence.
419+ * 1. The character is matched to the printable class, if asked, and in
420+ * case of match it passes through to the output.
421+ * 2. The character is not matched to the one from @esc string and thus
422+ * must go as is to the output.
423+ * 3. The character is checked if it falls into the class given by @flags.
424+ * %ESCAPE_OCTAL and %ESCAPE_HEX are going last since they cover any
425+ * character. Note that they actually can't go together, otherwise
426+ * %ESCAPE_HEX will be ignored.
427+ *
428+ * Caller must provide valid source and destination pointers. Be aware that
429+ * destination buffer will not be NULL-terminated, thus caller have to append
430+ * it if needs.
431+ *
432+ * Return:
433+ * The amount of the characters processed to the destination buffer, or
434+ * %-ENOMEM if the size of buffer is not enough to put an escaped character is
435+ * returned.
436+ *
437+ * Even in the case of error @dst pointer will be updated to point to the byte
438+ * after the last processed character.
439+ */
440+int string_escape_mem(const char *src, size_t isz, char **dst, size_t osz,
441+ unsigned int flags, const char *esc)
442+{
443+ char *out = *dst, *p = out;
444+ bool is_dict = esc && *esc;
445+ int ret = 0;
446+
447+ while (isz--) {
448+ unsigned char c = *src++;
449+
450+ /*
451+ * Apply rules in the following sequence:
452+ * - the character is printable, when @flags has
453+ * %ESCAPE_NP bit set
454+ * - the @esc string is supplied and does not contain a
455+ * character under question
456+ * - the character doesn't fall into a class of symbols
457+ * defined by given @flags
458+ * In these cases we just pass through a character to the
459+ * output buffer.
460+ */
461+ if ((flags & ESCAPE_NP && isprint(c)) ||
462+ (is_dict && !strchr(esc, c))) {
463+ /* do nothing */
464+ } else {
465+ if (flags & ESCAPE_SPACE) {
466+ ret = escape_space(c, &p, &osz);
467+ if (ret < 0)
468+ break;
469+ if (ret > 0)
470+ continue;
471+ }
472+
473+ if (flags & ESCAPE_SPECIAL) {
474+ ret = escape_special(c, &p, &osz);
475+ if (ret < 0)
476+ break;
477+ if (ret > 0)
478+ continue;
479+ }
480+
481+ if (flags & ESCAPE_NULL) {
482+ ret = escape_null(c, &p, &osz);
483+ if (ret < 0)
484+ break;
485+ if (ret > 0)
486+ continue;
487+ }
488+
489+ /* ESCAPE_OCTAL and ESCAPE_HEX always go last */
490+ if (flags & ESCAPE_OCTAL) {
491+ ret = escape_octal(c, &p, &osz);
492+ if (ret < 0)
493+ break;
494+ continue;
495+ }
496+ if (flags & ESCAPE_HEX) {
497+ ret = escape_hex(c, &p, &osz);
498+ if (ret < 0)
499+ break;
500+ continue;
501+ }
502+ }
503+
504+ ret = escape_passthrough(c, &p, &osz);
505+ if (ret < 0)
506+ break;
507+ }
508+
509+ *dst = p;
510+
511+ if (ret < 0)
512+ return ret;
513+
514+ return p - out;
515+}
516+EXPORT_SYMBOL(string_escape_mem);
lib/test-string_helpers.c+262−15
@@ -5,11 +5,32 @@ · 4 unmodified lines
55
66 #include <linux/init.h>
77 #include <linux/kernel.h>
8+#include <linux/slab.h>
89 #include <linux/module.h>
910 #include <linux/random.h>
1011 #include <linux/string.h>
1112 #include <linux/string_helpers.h>
1213
14+static __init bool test_string_check_buf(const char *name, unsigned int flags,
15+ char *in, size_t p,
16+ char *out_real, size_t q_real,
17+ char *out_test, size_t q_test)
18+{
19+ if (q_real == q_test && !memcmp(out_test, out_real, q_test))
20+ return true;
21+
22+ pr_warn("Test '%s' failed: flags = %u\n", name, flags);
23+
24+ print_hex_dump(KERN_WARNING, "Input: ", DUMP_PREFIX_NONE, 16, 1,
25+ in, p, true);
26+ print_hex_dump(KERN_WARNING, "Expected: ", DUMP_PREFIX_NONE, 16, 1,
27+ out_test, q_test, true);
28+ print_hex_dump(KERN_WARNING, "Got: ", DUMP_PREFIX_NONE, 16, 1,
29+ out_real, q_real, true);
30+
31+ return false;
32+}
33+
1334 struct test_string {
1435 const char *in;
1536 const char *out;
@@ -39,12 +60,17 @@ static const struct test_string strings[] __initconst = { · 23 unmodified lines
3960 },
4061 };
4162
42−static void __init test_string_unescape(unsigned int flags, bool inplace)
63+static void __init test_string_unescape(const char *name, unsigned int flags,
64+ bool inplace)
4365 {
44− char in[256];
45− char out_test[256];
46− char out_real[256];
47− int i, p = 0, q_test = 0, q_real = sizeof(out_real);
66+ int q_real = 256;
67+ char *in = kmalloc(q_real, GFP_KERNEL);
68+ char *out_test = kmalloc(q_real, GFP_KERNEL);
69+ char *out_real = kmalloc(q_real, GFP_KERNEL);
70+ int i, p = 0, q_test = 0;
71+
72+ if (!in || !out_test || !out_real)
73+ goto out;
4874
4975 for (i = 0; i < ARRAY_SIZE(strings); i++) {
5076 const char *s = strings[i].in;
@@ -77,15 +103,225 @@ static void __init test_string_unescape(unsigned int flags, bool inplace) · 26 unmodified lines
77103 q_real = string_unescape(in, out_real, q_real, flags);
78104 }
79105
80− if (q_real != q_test || memcmp(out_test, out_real, q_test)) {
81− pr_warn("Test failed: flags = %u\n", flags);
82− print_hex_dump(KERN_WARNING, "Input: ",
83− DUMP_PREFIX_NONE, 16, 1, in, p - 1, true);
84− print_hex_dump(KERN_WARNING, "Expected: ",
85− DUMP_PREFIX_NONE, 16, 1, out_test, q_test, true);
86− print_hex_dump(KERN_WARNING, "Got: ",
87− DUMP_PREFIX_NONE, 16, 1, out_real, q_real, true);
106+ test_string_check_buf(name, flags, in, p - 1, out_real, q_real,
107+ out_test, q_test);
108+out:
109+ kfree(out_real);
110+ kfree(out_test);
111+ kfree(in);
112+}
113+
114+struct test_string_1 {
115+ const char *out;
116+ unsigned int flags;
117+};
118+
119+#define TEST_STRING_2_MAX_S1 32
120+struct test_string_2 {
121+ const char *in;
122+ struct test_string_1 s1[TEST_STRING_2_MAX_S1];
123+};
124+
125+#define TEST_STRING_2_DICT_0 NULL
126+static const struct test_string_2 escape0[] __initconst = {{
127+ .in = "\f\\ \n\r\t\v",
128+ .s1 = {{
129+ .out = "\\f\\ \\n\\r\\t\\v",
130+ .flags = ESCAPE_SPACE,
131+ },{
132+ .out = "\\f\\134\\040\\n\\r\\t\\v",
133+ .flags = ESCAPE_SPACE | ESCAPE_OCTAL,
134+ },{
135+ .out = "\\f\\x5c\\x20\\n\\r\\t\\v",
136+ .flags = ESCAPE_SPACE | ESCAPE_HEX,
137+ },{
138+ /* terminator */
139+ }},
140+},{
141+ .in = "\\h\\\"\a\e\\",
142+ .s1 = {{
143+ .out = "\\\\h\\\\\"\\a\\e\\\\",
144+ .flags = ESCAPE_SPECIAL,
145+ },{
146+ .out = "\\\\\\150\\\\\\042\\a\\e\\\\",
147+ .flags = ESCAPE_SPECIAL | ESCAPE_OCTAL,
148+ },{
149+ .out = "\\\\\\x68\\\\\\x22\\a\\e\\\\",
150+ .flags = ESCAPE_SPECIAL | ESCAPE_HEX,
151+ },{
152+ /* terminator */
153+ }},
154+},{
155+ .in = "\eb \\C\007\"\x90\r]",
156+ .s1 = {{
157+ .out = "\eb \\C\007\"\x90\\r]",
158+ .flags = ESCAPE_SPACE,
159+ },{
160+ .out = "\\eb \\\\C\\a\"\x90\r]",
161+ .flags = ESCAPE_SPECIAL,
162+ },{
163+ .out = "\\eb \\\\C\\a\"\x90\\r]",
164+ .flags = ESCAPE_SPACE | ESCAPE_SPECIAL,
165+ },{
166+ .out = "\\033\\142\\040\\134\\103\\007\\042\\220\\015\\135",
167+ .flags = ESCAPE_OCTAL,
168+ },{
169+ .out = "\\033\\142\\040\\134\\103\\007\\042\\220\\r\\135",
170+ .flags = ESCAPE_SPACE | ESCAPE_OCTAL,
171+ },{
172+ .out = "\\e\\142\\040\\\\\\103\\a\\042\\220\\015\\135",
173+ .flags = ESCAPE_SPECIAL | ESCAPE_OCTAL,
174+ },{
175+ .out = "\\e\\142\\040\\\\\\103\\a\\042\\220\\r\\135",
176+ .flags = ESCAPE_SPACE | ESCAPE_SPECIAL | ESCAPE_OCTAL,
177+ },{
178+ .out = "\eb \\C\007\"\x90\r]",
179+ .flags = ESCAPE_NP,
180+ },{
181+ .out = "\eb \\C\007\"\x90\\r]",
182+ .flags = ESCAPE_SPACE | ESCAPE_NP,
183+ },{
184+ .out = "\\eb \\C\\a\"\x90\r]",
185+ .flags = ESCAPE_SPECIAL | ESCAPE_NP,
186+ },{
187+ .out = "\\eb \\C\\a\"\x90\\r]",
188+ .flags = ESCAPE_SPACE | ESCAPE_SPECIAL | ESCAPE_NP,
189+ },{
190+ .out = "\\033b \\C\\007\"\\220\\015]",
191+ .flags = ESCAPE_OCTAL | ESCAPE_NP,
192+ },{
193+ .out = "\\033b \\C\\007\"\\220\\r]",
194+ .flags = ESCAPE_SPACE | ESCAPE_OCTAL | ESCAPE_NP,
195+ },{
196+ .out = "\\eb \\C\\a\"\\220\\r]",
197+ .flags = ESCAPE_SPECIAL | ESCAPE_SPACE | ESCAPE_OCTAL |
198+ ESCAPE_NP,
199+ },{
200+ .out = "\\x1bb \\C\\x07\"\\x90\\x0d]",
201+ .flags = ESCAPE_NP | ESCAPE_HEX,
202+ },{
203+ /* terminator */
204+ }},
205+},{
206+ /* terminator */
207+}};
208+
209+#define TEST_STRING_2_DICT_1 "b\\ \t\r"
210+static const struct test_string_2 escape1[] __initconst = {{
211+ .in = "\f\\ \n\r\t\v",
212+ .s1 = {{
213+ .out = "\f\\134\\040\n\\015\\011\v",
214+ .flags = ESCAPE_OCTAL,
215+ },{
216+ .out = "\f\\x5c\\x20\n\\x0d\\x09\v",
217+ .flags = ESCAPE_HEX,
218+ },{
219+ /* terminator */
220+ }},
221+},{
222+ .in = "\\h\\\"\a\e\\",
223+ .s1 = {{
224+ .out = "\\134h\\134\"\a\e\\134",
225+ .flags = ESCAPE_OCTAL,
226+ },{
227+ /* terminator */
228+ }},
229+},{
230+ .in = "\eb \\C\007\"\x90\r]",
231+ .s1 = {{
232+ .out = "\e\\142\\040\\134C\007\"\x90\\015]",
233+ .flags = ESCAPE_OCTAL,
234+ },{
235+ /* terminator */
236+ }},
237+},{
238+ /* terminator */
239+}};
240+
241+static __init const char *test_string_find_match(const struct test_string_2 *s2,
242+ unsigned int flags)
243+{
244+ const struct test_string_1 *s1 = s2->s1;
245+ unsigned int i;
246+
247+ if (!flags)
248+ return s2->in;
249+
250+ /* Test cases are NULL-aware */
251+ flags &= ~ESCAPE_NULL;
252+
253+ /* ESCAPE_OCTAL has a higher priority */
254+ if (flags & ESCAPE_OCTAL)
255+ flags &= ~ESCAPE_HEX;
256+
257+ for (i = 0; i < TEST_STRING_2_MAX_S1 && s1->out; i++, s1++)
258+ if (s1->flags == flags)
259+ return s1->out;
260+ return NULL;
261+}
262+
263+static __init void test_string_escape(const char *name,
264+ const struct test_string_2 *s2,
265+ unsigned int flags, const char *esc)
266+{
267+ int q_real = 512;
268+ char *out_test = kmalloc(q_real, GFP_KERNEL);
269+ char *out_real = kmalloc(q_real, GFP_KERNEL);
270+ char *in = kmalloc(256, GFP_KERNEL);
271+ char *buf = out_real;
272+ int p = 0, q_test = 0;
273+
274+ if (!out_test || !out_real || !in)
275+ goto out;
276+
277+ for (; s2->in; s2++) {
278+ const char *out;
279+ int len;
280+
281+ /* NULL injection */
282+ if (flags & ESCAPE_NULL) {
283+ in[p++] = '\0';
284+ out_test[q_test++] = '\\';
285+ out_test[q_test++] = '0';
286+ }
287+
288+ /* Don't try strings that have no output */
289+ out = test_string_find_match(s2, flags);
290+ if (!out)
291+ continue;
292+
293+ /* Copy string to in buffer */
294+ len = strlen(s2->in);
295+ memcpy(&in[p], s2->in, len);
296+ p += len;
297+
298+ /* Copy expected result for given flags */
299+ len = strlen(out);
300+ memcpy(&out_test[q_test], out, len);
301+ q_test += len;
88302 }
303+
304+ q_real = string_escape_mem(in, p, &buf, q_real, flags, esc);
305+
306+ test_string_check_buf(name, flags, in, p, out_real, q_real, out_test,
307+ q_test);
308+out:
309+ kfree(in);
310+ kfree(out_real);
311+ kfree(out_test);
312+}
313+
314+static __init void test_string_escape_nomem(void)
315+{
316+ char *in = "\eb \\C\007\"\x90\r]";
317+ char out[64], *buf = out;
318+ int rc = -ENOMEM, ret;
319+
320+ ret = string_escape_str_any_np(in, &buf, strlen(in), NULL);
321+ if (ret == rc)
322+ return;
323+
324+ pr_err("Test 'escape nomem' failed: got %d instead of %d\n", ret, rc);
89325 }
90326
91327 static int __init test_string_helpers_init(void)
@@ -94,8 +330,19 @@ static int __init test_string_helpers_init(void) · 2 unmodified lines
94330
95331 pr_info("Running tests...\n");
96332 for (i = 0; i < UNESCAPE_ANY + 1; i++)
97− test_string_unescape(i, false);
98− test_string_unescape(get_random_int() % (UNESCAPE_ANY + 1), true);
333+ test_string_unescape("unescape", i, false);
334+ test_string_unescape("unescape inplace",
335+ get_random_int() % (UNESCAPE_ANY + 1), true);
336+
337+ /* Without dictionary */
338+ for (i = 0; i < (ESCAPE_ANY_NP | ESCAPE_HEX) + 1; i++)
339+ test_string_escape("escape 0", escape0, i, TEST_STRING_2_DICT_0);
340+
341+ /* With dictionary */
342+ for (i = 0; i < (ESCAPE_ANY_NP | ESCAPE_HEX) + 1; i++)
343+ test_string_escape("escape 1", escape1, i, TEST_STRING_2_DICT_1);
344+
345+ test_string_escape_nomem();
99346
100347 return -EINVAL;
101348 }
lib/textsearch.c+1−3
@@ -249,9 +249,7 @@ EXPORT_SYMBOL(textsearch_find_continuous); · 248 unmodified lines
249249 * @flags: search flags
250250 *
251251 * Looks up the search algorithm module and creates a new textsearch
252− * configuration for the specified pattern. Upon completion all
253− * necessary refcnts are held and the configuration must be put back
254− * using textsearch_put() after usage.
252+ * configuration for the specified pattern.
255253 *
256254 * Note: The format of the pattern may not be compatible between
257255 * the various search algorithms.
lib/vsprintf.c+71−0
@@ -33,6 +33,7 @@ · 32 unmodified lines
3333 #include <asm/page.h> /* for PAGE_SIZE */
3434 #include <asm/sections.h> /* for dereference_function_descriptor() */
3535
36+#include <linux/string_helpers.h>
3637 #include "kstrtox.h"
3738
3839 /**
@@ -1100,6 +1101,62 @@ char *ip4_addr_string_sa(char *buf, char *end, const struct sockaddr_in *sa, · 1061 unmodified lines
11001101 return string(buf, end, ip4_addr, spec);
11011102 }
11021103
1104+static noinline_for_stack
1105+char *escaped_string(char *buf, char *end, u8 *addr, struct printf_spec spec,
1106+ const char *fmt)
1107+{
1108+ bool found = true;
1109+ int count = 1;
1110+ unsigned int flags = 0;
1111+ int len;
1112+
1113+ if (spec.field_width == 0)
1114+ return buf; /* nothing to print */
1115+
1116+ if (ZERO_OR_NULL_PTR(addr))
1117+ return string(buf, end, NULL, spec); /* NULL pointer */
1118+
1119+
1120+ do {
1121+ switch (fmt[count++]) {
1122+ case 'a':
1123+ flags |= ESCAPE_ANY;
1124+ break;
1125+ case 'c':
1126+ flags |= ESCAPE_SPECIAL;
1127+ break;
1128+ case 'h':
1129+ flags |= ESCAPE_HEX;
1130+ break;
1131+ case 'n':
1132+ flags |= ESCAPE_NULL;
1133+ break;
1134+ case 'o':
1135+ flags |= ESCAPE_OCTAL;
1136+ break;
1137+ case 'p':
1138+ flags |= ESCAPE_NP;
1139+ break;
1140+ case 's':
1141+ flags |= ESCAPE_SPACE;
1142+ break;
1143+ default:
1144+ found = false;
1145+ break;
1146+ }
1147+ } while (found);
1148+
1149+ if (!flags)
1150+ flags = ESCAPE_ANY_NP;
1151+
1152+ len = spec.field_width < 0 ? 1 : spec.field_width;
1153+
1154+ /* Ignore the error. We print as many characters as we can */
1155+ string_escape_mem(addr, len, &buf, end - buf, flags, NULL);
1156+
1157+ return buf;
1158+}
1159+
11031160 static noinline_for_stack
11041161 char *uuid_string(char *buf, char *end, const u8 *addr,
11051162 struct printf_spec spec, const char *fmt)
@@ -1221,6 +1278,17 @@ int kptr_restrict __read_mostly; · 115 unmodified lines
12211278 * - '[Ii][4S][hnbl]' IPv4 addresses in host, network, big or little endian order
12221279 * - 'I[6S]c' for IPv6 addresses printed as specified by
12231280 * http://tools.ietf.org/html/rfc5952
1281+ * - 'E[achnops]' For an escaped buffer, where rules are defined by combination
1282+ * of the following flags (see string_escape_mem() for the
1283+ * details):
1284+ * a - ESCAPE_ANY
1285+ * c - ESCAPE_SPECIAL
1286+ * h - ESCAPE_HEX
1287+ * n - ESCAPE_NULL
1288+ * o - ESCAPE_OCTAL
1289+ * p - ESCAPE_NP
1290+ * s - ESCAPE_SPACE
1291+ * By default ESCAPE_ANY_NP is used.
12241292 * - 'U' For a 16 byte UUID/GUID, it prints the UUID/GUID in the form
12251293 * "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
12261294 * Options for %pU are:
@@ -1321,6 +1389,8 @@ char *pointer(const char *fmt, char *buf, char *end, void *ptr, · 94 unmodified lines
13211389 }}
13221390 }
13231391 break;
1392+ case 'E':
1393+ return escaped_string(buf, end, ptr, spec, fmt);
13241394 case 'U':
13251395 return uuid_string(buf, end, ptr, spec, fmt);
13261396 case 'V':
@@ -1633,6 +1703,7 @@ qualifier: · 306 unmodified lines
16331703 * %piS depending on sa_family of 'struct sockaddr *' print IPv4/IPv6 address
16341704 * %pU[bBlL] print a UUID/GUID in big or little endian using lower or upper
16351705 * case.
1706+ * %*pE[achnops] print an escaped buffer
16361707 * %*ph[CDN] a variable-length hex string with a separator (supports up to 64
16371708 * bytes of the input)
16381709 * %n is ignored
mm/cma.c+54−12
@@ -58,7 +58,9 @@ unsigned long cma_get_size(struct cma *cma) · 57 unmodified lines
5858
5959 static unsigned long cma_bitmap_aligned_mask(struct cma *cma, int align_order)
6060 {
61− return (1UL << (align_order >> cma->order_per_bit)) - 1;
61+ if (align_order <= cma->order_per_bit)
62+ return 0;
63+ return (1UL << (align_order - cma->order_per_bit)) - 1;
6264 }
6365
6466 static unsigned long cma_bitmap_maxno(struct cma *cma)
@@ -140,6 +142,54 @@ static int __init cma_init_reserved_areas(void) · 75 unmodified lines
140142 }
141143 core_initcall(cma_init_reserved_areas);
142144
145+/**
146+ * cma_init_reserved_mem() - create custom contiguous area from reserved memory
147+ * @base: Base address of the reserved area
148+ * @size: Size of the reserved area (in bytes),
149+ * @order_per_bit: Order of pages represented by one bit on bitmap.
150+ * @res_cma: Pointer to store the created cma region.
151+ *
152+ * This function creates custom contiguous area from already reserved memory.
153+ */
154+int __init cma_init_reserved_mem(phys_addr_t base, phys_addr_t size,
155+ int order_per_bit, struct cma **res_cma)
156+{
157+ struct cma *cma;
158+ phys_addr_t alignment;
159+
160+ /* Sanity checks */
161+ if (cma_area_count == ARRAY_SIZE(cma_areas)) {
162+ pr_err("Not enough slots for CMA reserved regions!\n");
163+ return -ENOSPC;
164+ }
165+
166+ if (!size || !memblock_is_region_reserved(base, size))
167+ return -EINVAL;
168+
169+ /* ensure minimal alignment requied by mm core */
170+ alignment = PAGE_SIZE << max(MAX_ORDER - 1, pageblock_order);
171+
172+ /* alignment should be aligned with order_per_bit */
173+ if (!IS_ALIGNED(alignment >> PAGE_SHIFT, 1 << order_per_bit))
174+ return -EINVAL;
175+
176+ if (ALIGN(base, alignment) != base || ALIGN(size, alignment) != size)
177+ return -EINVAL;
178+
179+ /*
180+ * Each reserved area must be initialised later, when more kernel
181+ * subsystems (like slab allocator) are available.
182+ */
183+ cma = &cma_areas[cma_area_count];
184+ cma->base_pfn = PFN_DOWN(base);
185+ cma->count = size >> PAGE_SHIFT;
186+ cma->order_per_bit = order_per_bit;
187+ *res_cma = cma;
188+ cma_area_count++;
189+
190+ return 0;
191+}
192+
143193 /**
144194 * cma_declare_contiguous() - reserve custom contiguous area
145195 * @base: Base address of the reserved area optional, use 0 for any
@@ -163,7 +213,6 @@ int __init cma_declare_contiguous(phys_addr_t base, · 17 unmodified lines
163213 phys_addr_t alignment, unsigned int order_per_bit,
164214 bool fixed, struct cma **res_cma)
165215 {
166− struct cma *cma;
167216 phys_addr_t memblock_end = memblock_end_of_DRAM();
168217 phys_addr_t highmem_start = __pa(high_memory);
169218 int ret = 0;
@@ -235,16 +284,9 @@ int __init cma_declare_contiguous(phys_addr_t base, · 65 unmodified lines
235284 }
236285 }
237286
238− /*
239− * Each reserved area must be initialised later, when more kernel
240− * subsystems (like slab allocator) are available.
241− */
242− cma = &cma_areas[cma_area_count];
243− cma->base_pfn = PFN_DOWN(base);
244− cma->count = size >> PAGE_SHIFT;
245− cma->order_per_bit = order_per_bit;
246− *res_cma = cma;
247− cma_area_count++;
287+ ret = cma_init_reserved_mem(base, size, order_per_bit, res_cma);
288+ if (ret)
289+ goto err;
248290
249291 pr_info("Reserved %ld MiB at %08lx\n", (unsigned long)size / SZ_1M,
250292 (unsigned long)base);
mm/memory.c+2−1
@@ -2053,7 +2053,8 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, · 2052 unmodified lines
20532053 old_page = vm_normal_page(vma, address, orig_pte);
20542054 if (!old_page) {
20552055 /*
2056− * VM_MIXEDMAP !pfn_valid() case
2056+ * VM_MIXEDMAP !pfn_valid() case, or VM_SOFTDIRTY clear on a
2057+ * VM_PFNMAP VMA.
20572058 *
20582059 * We should not cow pages in a shared writeable mapping.
20592060 * Just mark the pages writable as we can't do any dirty
mm/mmap.c+28−17
@@ -89,6 +89,25 @@ pgprot_t vm_get_page_prot(unsigned long vm_flags) · 88 unmodified lines
8989 }
9090 EXPORT_SYMBOL(vm_get_page_prot);
9191
92+static pgprot_t vm_pgprot_modify(pgprot_t oldprot, unsigned long vm_flags)
93+{
94+ return pgprot_modify(oldprot, vm_get_page_prot(vm_flags));
95+}
96+
97+/* Update vma->vm_page_prot to reflect vma->vm_flags. */
98+void vma_set_page_prot(struct vm_area_struct *vma)
99+{
100+ unsigned long vm_flags = vma->vm_flags;
101+
102+ vma->vm_page_prot = vm_pgprot_modify(vma->vm_page_prot, vm_flags);
103+ if (vma_wants_writenotify(vma)) {
104+ vm_flags &= ~VM_SHARED;
105+ vma->vm_page_prot = vm_pgprot_modify(vma->vm_page_prot,
106+ vm_flags);
107+ }
108+}
109+
110+
92111 int sysctl_overcommit_memory __read_mostly = OVERCOMMIT_GUESS; /* heuristic overcommit */
93112 int sysctl_overcommit_ratio __read_mostly = 50; /* default is 50% */
94113 unsigned long sysctl_overcommit_kbytes __read_mostly;
@@ -1475,11 +1494,16 @@ int vma_wants_writenotify(struct vm_area_struct *vma) · 1380 unmodified lines
14751494 if (vma->vm_ops && vma->vm_ops->page_mkwrite)
14761495 return 1;
14771496
1478− /* The open routine did something to the protections already? */
1497+ /* The open routine did something to the protections that pgprot_modify
1498+ * won't preserve? */
14791499 if (pgprot_val(vma->vm_page_prot) !=
1480− pgprot_val(vm_get_page_prot(vm_flags)))
1500+ pgprot_val(vm_pgprot_modify(vma->vm_page_prot, vm_flags)))
14811501 return 0;
14821502
1503+ /* Do we need to track softdirty? */
1504+ if (IS_ENABLED(CONFIG_MEM_SOFT_DIRTY) && !(vm_flags & VM_SOFTDIRTY))
1505+ return 1;
1506+
14831507 /* Specialty mapping? */
14841508 if (vm_flags & VM_PFNMAP)
14851509 return 0;
@@ -1615,21 +1639,6 @@ munmap_back: · 129 unmodified lines
16151639 goto free_vma;
16161640 }
16171641
1618− if (vma_wants_writenotify(vma)) {
1619− pgprot_t pprot = vma->vm_page_prot;
1620−
1621− /* Can vma->vm_page_prot have changed??
1622− *
1623− * Answer: Yes, drivers may have changed it in their
1624− * f_op->mmap method.
1625− *
1626− * Ensures that vmas marked as uncached stay that way.
1627− */
1628− vma->vm_page_prot = vm_get_page_prot(vm_flags & ~VM_SHARED);
1629− if (pgprot_val(pprot) == pgprot_val(pgprot_noncached(pprot)))
1630− vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
1631− }
1632−
16331642 vma_link(mm, vma, prev, rb_link, rb_parent);
16341643 /* Once vma denies write, undo our temporary denial count */
16351644 if (file) {
@@ -1663,6 +1672,8 @@ out: · 27 unmodified lines
16631672 */
16641673 vma->vm_flags |= VM_SOFTDIRTY;
16651674
1675+ vma_set_page_prot(vma);
1676+
16661677 return addr;
16671678
16681679 unmap_and_free_vma:
mm/mprotect.c+5−15
@@ -29,13 +29,6 @@ · 28 unmodified lines
2929 #include <asm/cacheflush.h>
3030 #include <asm/tlbflush.h>
3131
32−#ifndef pgprot_modify
33−static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)
34−{
35− return newprot;
36−}
37−#endif
38−
3932 /*
4033 * For a prot_numa update we only hold mmap_sem for read so there is a
4134 * potential race with faulting where a pmd was temporarily none. This
@@ -93,7 +86,9 @@ static unsigned long change_pte_range(struct vm_area_struct *vma, pmd_t *pmd, · 51 unmodified lines
9386 * Avoid taking write faults for pages we
9487 * know to be dirty.
9588 */
96− if (dirty_accountable && pte_dirty(ptent))
89+ if (dirty_accountable && pte_dirty(ptent) &&
90+ (pte_soft_dirty(ptent) ||
91+ !(vma->vm_flags & VM_SOFTDIRTY)))
9792 ptent = pte_mkwrite(ptent);
9893 ptep_modify_prot_commit(mm, addr, pte, ptent);
9994 updated = true;
@@ -320,13 +315,8 @@ success: · 220 unmodified lines
320315 * held in write mode.
321316 */
322317 vma->vm_flags = newflags;
323− vma->vm_page_prot = pgprot_modify(vma->vm_page_prot,
324− vm_get_page_prot(newflags));
325−
326− if (vma_wants_writenotify(vma)) {
327− vma->vm_page_prot = vm_get_page_prot(newflags & ~VM_SHARED);
328− dirty_accountable = 1;
329− }
318+ dirty_accountable = vma_wants_writenotify(vma);
319+ vma_set_page_prot(vma);
330320
331321 change_protection(vma, start, end, vma->vm_page_prot,
332322 dirty_accountable, 0);
mm/slab.c+1−1
@@ -1992,7 +1992,7 @@ static struct array_cache __percpu *alloc_kmem_cache_cpus( · 1991 unmodified lines
19921992 struct array_cache __percpu *cpu_cache;
19931993
19941994 size = sizeof(void *) * entries + sizeof(struct array_cache);
1995− cpu_cache = __alloc_percpu(size, 0);
1995+ cpu_cache = __alloc_percpu(size, sizeof(void *));
19961996
19971997 if (!cpu_cache)
19981998 return NULL;
net/batman-adv/gateway_common.c+4−4
@@ -44,10 +44,10 @@ static bool batadv_parse_gw_bandwidth(struct net_device *net_dev, char *buff, · 43 unmodified lines
4444 if (strlen(buff) > 4) {
4545 tmp_ptr = buff + strlen(buff) - 4;
4646
47− if (strnicmp(tmp_ptr, "mbit", 4) == 0)
47+ if (strncasecmp(tmp_ptr, "mbit", 4) == 0)
4848 bw_unit_type = BATADV_BW_UNIT_MBIT;
4949
50− if ((strnicmp(tmp_ptr, "kbit", 4) == 0) ||
50+ if ((strncasecmp(tmp_ptr, "kbit", 4) == 0) ||
5151 (bw_unit_type == BATADV_BW_UNIT_MBIT))
5252 *tmp_ptr = '\0';
5353 }
@@ -77,10 +77,10 @@ static bool batadv_parse_gw_bandwidth(struct net_device *net_dev, char *buff, · 23 unmodified lines
7777 if (strlen(slash_ptr + 1) > 4) {
7878 tmp_ptr = slash_ptr + 1 - 4 + strlen(slash_ptr + 1);
7979
80− if (strnicmp(tmp_ptr, "mbit", 4) == 0)
80+ if (strncasecmp(tmp_ptr, "mbit", 4) == 0)
8181 bw_unit_type = BATADV_BW_UNIT_MBIT;
8282
83− if ((strnicmp(tmp_ptr, "kbit", 4) == 0) ||
83+ if ((strncasecmp(tmp_ptr, "kbit", 4) == 0) ||
8484 (bw_unit_type == BATADV_BW_UNIT_MBIT))
8585 *tmp_ptr = '\0';
8686 }
net/netfilter/ipvs/ip_vs_ftp.c+3−3
@@ -96,13 +96,13 @@ static int ip_vs_ftp_get_addrport(char *data, char *data_limit, · 95 unmodified lines
9696
9797 if (data_limit - data < plen) {
9898 /* check if there is partial match */
99− if (strnicmp(data, pattern, data_limit - data) == 0)
99+ if (strncasecmp(data, pattern, data_limit - data) == 0)
100100 return -1;
101101 else
102102 return 0;
103103 }
104104
105− if (strnicmp(data, pattern, plen) != 0) {
105+ if (strncasecmp(data, pattern, plen) != 0) {
106106 return 0;
107107 }
108108 s = data + plen;
@@ -354,7 +354,7 @@ static int ip_vs_ftp_in(struct ip_vs_app *app, struct ip_vs_conn *cp, · 245 unmodified lines
354354 data_limit = skb_tail_pointer(skb);
355355
356356 while (data <= data_limit - 6) {
357− if (strnicmp(data, "PASV\r\n", 6) == 0) {
357+ if (strncasecmp(data, "PASV\r\n", 6) == 0) {
358358 /* Passive mode on */
359359 IP_VS_DBG(7, "got PASV at %td of %td\n",
360360 data - data_start,
net/netfilter/nf_conntrack_ftp.c+2−2
@@ -304,12 +304,12 @@ static int find_pattern(const char *data, size_t dlen, · 303 unmodified lines
304304
305305 if (dlen <= plen) {
306306 /* Short packet: try for partial? */
307− if (strnicmp(data, pattern, dlen) == 0)
307+ if (strncasecmp(data, pattern, dlen) == 0)
308308 return -1;
309309 else return 0;
310310 }
311311
312− if (strnicmp(data, pattern, plen) != 0) {
312+ if (strncasecmp(data, pattern, plen) != 0) {
313313 #if 0
314314 size_t i;
315315
net/netfilter/nf_conntrack_sip.c+11−11
@@ -247,7 +247,7 @@ int ct_sip_parse_request(const struct nf_conn *ct, · 246 unmodified lines
247247 for (; dptr < limit - strlen("sip:"); dptr++) {
248248 if (*dptr == '\r' || *dptr == '\n')
249249 return -1;
250− if (strnicmp(dptr, "sip:", strlen("sip:")) == 0) {
250+ if (strncasecmp(dptr, "sip:", strlen("sip:")) == 0) {
251251 dptr += strlen("sip:");
252252 break;
253253 }
@@ -350,7 +350,7 @@ static const char *ct_sip_header_search(const char *dptr, const char *limit, · 96 unmodified lines
350350 continue;
351351 }
352352
353− if (strnicmp(dptr, needle, len) == 0)
353+ if (strncasecmp(dptr, needle, len) == 0)
354354 return dptr;
355355 }
356356 return NULL;
@@ -383,10 +383,10 @@ int ct_sip_get_header(const struct nf_conn *ct, const char *dptr, · 26 unmodified lines
383383 /* Find header. Compact headers must be followed by a
384384 * non-alphabetic character to avoid mismatches. */
385385 if (limit - dptr >= hdr->len &&
386− strnicmp(dptr, hdr->name, hdr->len) == 0)
386+ strncasecmp(dptr, hdr->name, hdr->len) == 0)
387387 dptr += hdr->len;
388388 else if (hdr->cname && limit - dptr >= hdr->clen + 1 &&
389− strnicmp(dptr, hdr->cname, hdr->clen) == 0 &&
389+ strncasecmp(dptr, hdr->cname, hdr->clen) == 0 &&
390390 !isalpha(*(dptr + hdr->clen)))
391391 dptr += hdr->clen;
392392 else
@@ -620,9 +620,9 @@ static int ct_sip_parse_transport(struct nf_conn *ct, const char *dptr, · 227 unmodified lines
620620
621621 if (ct_sip_parse_param(ct, dptr, dataoff, datalen, "transport=",
622622 &matchoff, &matchlen)) {
623− if (!strnicmp(dptr + matchoff, "TCP", strlen("TCP")))
623+ if (!strncasecmp(dptr + matchoff, "TCP", strlen("TCP")))
624624 *proto = IPPROTO_TCP;
625− else if (!strnicmp(dptr + matchoff, "UDP", strlen("UDP")))
625+ else if (!strncasecmp(dptr + matchoff, "UDP", strlen("UDP")))
626626 *proto = IPPROTO_UDP;
627627 else
628628 return 0;
@@ -743,10 +743,10 @@ int ct_sip_get_sdp_header(const struct nf_conn *ct, const char *dptr, · 114 unmodified lines
743743
744744 if (term != SDP_HDR_UNSPEC &&
745745 limit - dptr >= thdr->len &&
746− strnicmp(dptr, thdr->name, thdr->len) == 0)
746+ strncasecmp(dptr, thdr->name, thdr->len) == 0)
747747 break;
748748 else if (limit - dptr >= hdr->len &&
749− strnicmp(dptr, hdr->name, hdr->len) == 0)
749+ strncasecmp(dptr, hdr->name, hdr->len) == 0)
750750 dptr += hdr->len;
751751 else
752752 continue;
@@ -1394,7 +1394,7 @@ static int process_sip_response(struct sk_buff *skb, unsigned int protoff, · 641 unmodified lines
13941394 if (handler->response == NULL)
13951395 continue;
13961396 if (*datalen < matchend + handler->len ||
1397− strnicmp(*dptr + matchend, handler->method, handler->len))
1397+ strncasecmp(*dptr + matchend, handler->method, handler->len))
13981398 continue;
13991399 return handler->response(skb, protoff, dataoff, dptr, datalen,
14001400 cseq, code);
@@ -1435,7 +1435,7 @@ static int process_sip_request(struct sk_buff *skb, unsigned int protoff, · 34 unmodified lines
14351435 if (handler->request == NULL)
14361436 continue;
14371437 if (*datalen < handler->len ||
1438− strnicmp(*dptr, handler->method, handler->len))
1438+ strncasecmp(*dptr, handler->method, handler->len))
14391439 continue;
14401440
14411441 if (ct_sip_get_header(ct, *dptr, 0, *datalen, SIP_HDR_CSEQ,
@@ -1462,7 +1462,7 @@ static int process_sip_msg(struct sk_buff *skb, struct nf_conn *ct, · 20 unmodified lines
14621462 const struct nf_nat_sip_hooks *hooks;
14631463 int ret;
14641464
1465− if (strnicmp(*dptr, "SIP/2.0 ", strlen("SIP/2.0 ")) != 0)
1465+ if (strncasecmp(*dptr, "SIP/2.0 ", strlen("SIP/2.0 ")) != 0)
14661466 ret = process_sip_request(skb, protoff, dataoff, dptr, datalen);
14671467 else
14681468 ret = process_sip_response(skb, protoff, dataoff, dptr, datalen);
net/netfilter/nf_log.c+1−1
@@ -30,7 +30,7 @@ static struct nf_logger *__find_logger(int pf, const char *str_logger) · 29 unmodified lines
3030
3131 log = rcu_dereference_protected(loggers[pf][i],
3232 lockdep_is_held(&nf_log_mutex));
33− if (!strnicmp(str_logger, log->name, strlen(log->name)))
33+ if (!strncasecmp(str_logger, log->name, strlen(log->name)))
3434 return log;
3535 }
3636
net/netfilter/nf_nat_sip.c+1−1
@@ -155,7 +155,7 @@ static unsigned int nf_nat_sip(struct sk_buff *skb, unsigned int protoff, · 154 unmodified lines
155155 int request, in_header;
156156
157157 /* Basic rules: requests and responses. */
158− if (strnicmp(*dptr, "SIP/2.0", strlen("SIP/2.0")) != 0) {
158+ if (strncasecmp(*dptr, "SIP/2.0", strlen("SIP/2.0")) != 0) {
159159 if (ct_sip_parse_request(ct, *dptr, *datalen,
160160 &matchoff, &matchlen,
161161 &addr, &port) > 0 &&
net/wireless/lib80211.c+0−32
@@ -46,38 +46,6 @@ static void lib80211_crypt_deinit_entries(struct lib80211_crypt_info *info, · 45 unmodified lines
4646 static void lib80211_crypt_quiescing(struct lib80211_crypt_info *info);
4747 static void lib80211_crypt_deinit_handler(unsigned long data);
4848
49−const char *print_ssid(char *buf, const char *ssid, u8 ssid_len)
50−{
51− const char *s = ssid;
52− char *d = buf;
53−
54− ssid_len = min_t(u8, ssid_len, IEEE80211_MAX_SSID_LEN);
55− while (ssid_len--) {
56− if (isprint(*s)) {
57− *d++ = *s++;
58− continue;
59− }
60−
61− *d++ = '\\';
62− if (*s == '\0')
63− *d++ = '0';
64− else if (*s == '\n')
65− *d++ = 'n';
66− else if (*s == '\r')
67− *d++ = 'r';
68− else if (*s == '\t')
69− *d++ = 't';
70− else if (*s == '\\')
71− *d++ = '\\';
72− else
73− d += snprintf(d, 3, "%03o", *s);
74− s++;
75− }
76− *d = '\0';
77− return buf;
78−}
79−EXPORT_SYMBOL(print_ssid);
80−
8149 int lib80211_crypt_info_init(struct lib80211_crypt_info *info, char *name,
8250 spinlock_t *lock)
8351 {
scripts/checkpatch.pl+97−10
@@ -9,7 +9,8 @@ use strict; · 8 unmodified lines
99 use POSIX;
1010
1111 my $P = $0;
12−$P =~ s@.*/@@g;
12+$P =~ s@(.*)/@@g;
13+my $D = $1;
1314
1415 my $V = '0.32';
1516
@@ -43,6 +44,8 @@ my $configuration_file = ".checkpatch.conf"; · 27 unmodified lines
4344 my $max_line_length = 80;
4445 my $ignore_perl_version = 0;
4546 my $minimum_perl_version = 5.10.0;
47+my $min_conf_desc_length = 4;
48+my $spelling_file = "$D/spelling.txt";
4649
4750 sub help {
4851 my ($exitcode) = @_;
@@ -63,6 +66,7 @@ Options: · 14 unmodified lines
6366 --types TYPE(,TYPE2...) show only these comma separated message types
6467 --ignore TYPE(,TYPE2...) ignore various comma separated message types
6568 --max-line-length=n set the maximum line length, if exceeded, warn
69+ --min-conf-desc-length=n set the min description length, if shorter, warn
6670 --show-types show the message "types" in the output
6771 --root=PATH PATH to the kernel tree root
6872 --no-summary suppress the per-file summary
@@ -131,6 +135,7 @@ GetOptions( · 62 unmodified lines
131135 'types=s' => \@use,
132136 'show-types!' => \$show_types,
133137 'max-line-length=i' => \$max_line_length,
138+ 'min-conf-desc-length=i' => \$min_conf_desc_length,
134139 'root=s' => \$root,
135140 'summary!' => \$summary,
136141 'mailback!' => \$mailback,
@@ -425,10 +430,35 @@ foreach my $entry (@mode_permission_funcs) { · 288 unmodified lines
425430
426431 our $allowed_asm_includes = qr{(?x:
427432 irq|
428− memory
433+ memory|
434+ time|
435+ reboot
429436 )};
430437 # memory.h: ARM has a custom one
431438
439+# Load common spelling mistakes and build regular expression list.
440+my $misspellings;
441+my @spelling_list;
442+my %spelling_fix;
443+open(my $spelling, '<', $spelling_file)
444+ or die "$P: Can't open $spelling_file for reading: $!\n";
445+while (<$spelling>) {
446+ my $line = $_;
447+
448+ $line =~ s/\s*\n?$//g;
449+ $line =~ s/^\s*//g;
450+
451+ next if ($line =~ m/^\s*#/);
452+ next if ($line =~ m/^\s*$/);
453+
454+ my ($suspect, $fix) = split(/\|\|/, $line);
455+
456+ push(@spelling_list, $suspect);
457+ $spelling_fix{$suspect} = $fix;
458+}
459+close($spelling);
460+$misspellings = join("|", @spelling_list);
461+
432462 sub build_types {
433463 my $mods = "(?x: \n" . join("|\n ", @modifierList) . "\n)";
434464 my $all = "(?x: \n" . join("|\n ", @typeList) . "\n)";
@@ -2215,6 +2245,23 @@ sub process { · 1780 unmodified lines
22152245 "8-bit UTF-8 used in possible commit log\n" . $herecurr);
22162246 }
22172247
2248+# Check for various typo / spelling mistakes
2249+ if ($in_commit_log || $line =~ /^\+/) {
2250+ while ($rawline =~ /(?:^|[^a-z@])($misspellings)(?:$|[^a-z@])/gi) {
2251+ my $typo = $1;
2252+ my $typo_fix = $spelling_fix{lc($typo)};
2253+ $typo_fix = ucfirst($typo_fix) if ($typo =~ /^[A-Z]/);
2254+ $typo_fix = uc($typo_fix) if ($typo =~ /^[A-Z]+$/);
2255+ my $msg_type = \&WARN;
2256+ $msg_type = \&CHK if ($file);
2257+ if (&{$msg_type}("TYPO_SPELLING",
2258+ "'$typo' may be misspelled - perhaps '$typo_fix'?\n" . $herecurr) &&
2259+ $fix) {
2260+ $fixed[$fixlinenr] =~ s/(^|[^A-Za-z@])($typo)($|[^A-Za-z@])/$1$typo_fix$3/;
2261+ }
2262+ }
2263+ }
2264+
22182265 # ignore non-hunk lines and lines being removed
22192266 next if (!$hunk_line || $line =~ /^-/);
22202267
@@ -2283,8 +2330,10 @@ sub process { · 62 unmodified lines
22832330 }
22842331 $length++;
22852332 }
2286− WARN("CONFIG_DESCRIPTION",
2287− "please write a paragraph that describes the config symbol fully\n" . $herecurr) if ($is_start && $is_end && $length < 4);
2333+ if ($is_start && $is_end && $length < $min_conf_desc_length) {
2334+ WARN("CONFIG_DESCRIPTION",
2335+ "please write a paragraph that describes the config symbol fully\n" . $herecurr);
2336+ }
22882337 #print "is_start<$is_start> is_end<$is_end> length<$length>\n";
22892338 }
22902339
@@ -2341,7 +2390,7 @@ sub process { · 50 unmodified lines
23412390 }
23422391
23432392 # check we are in a valid source file if not then ignore this hunk
2344− next if ($realfile !~ /\.(h|c|s|S|pl|sh)$/);
2393+ next if ($realfile !~ /\.(h|c|s|S|pl|sh|dtsi|dts)$/);
23452394
23462395 #line length limit
23472396 if ($line =~ /^\+/ && $prevrawline !~ /\/\*\*/ &&
@@ -2402,7 +2451,7 @@ sub process { · 54 unmodified lines
24022451 }
24032452
24042453 # check we are in a valid source file C or perl if not then ignore this hunk
2405− next if ($realfile !~ /\.(h|c|pl)$/);
2454+ next if ($realfile !~ /\.(h|c|pl|dtsi|dts)$/);
24062455
24072456 # at the beginning of a line any tabs must come first and anything
24082457 # more than 8 must use tabs.
@@ -2424,7 +2473,7 @@ sub process { · 15 unmodified lines
24242473 "please, no space before tabs\n" . $herevet) &&
24252474 $fix) {
24262475 while ($fixed[$fixlinenr] =~
2427− s/(^\+.*) {8,8}+\t/$1\t\t/) {}
2476+ s/(^\+.*) {8,8}\t/$1\t\t/) {}
24282477 while ($fixed[$fixlinenr] =~
24292478 s/(^\+.*) +\t/$1\t/) {}
24302479 }
@@ -2592,10 +2641,14 @@ sub process { · 161 unmodified lines
25922641 next if ($realfile !~ /\.(h|c)$/);
25932642
25942643 # check indentation of any line with a bare else
2644+# (but not if it is a multiple line "if (foo) return bar; else return baz;")
25952645 # if the previous line is a break or return and is indented 1 tab more...
25962646 if ($sline =~ /^\+([\t]+)(?:}[ \t]*)?else(?:[ \t]*{)?\s*$/) {
25972647 my $tabs = length($1) + 1;
2598− if ($prevline =~ /^\+\t{$tabs,$tabs}(?:break|return)\b/) {
2648+ if ($prevline =~ /^\+\t{$tabs,$tabs}break\b/ ||
2649+ ($prevline =~ /^\+\t{$tabs,$tabs}return\b/ &&
2650+ defined $lines[$linenr] &&
2651+ $lines[$linenr] !~ /^[ \+]\t{$tabs,$tabs}return/)) {
25992652 WARN("UNNECESSARY_ELSE",
26002653 "else is not generally useful after a break or return\n" . $hereprev);
26012654 }
@@ -3752,7 +3805,6 @@ sub process { · 1150 unmodified lines
37523805 if (ERROR("SPACING",
37533806 "space prohibited before that close parenthesis ')'\n" . $herecurr) &&
37543807 $fix) {
3755− print("fixlinenr: <$fixlinenr> fixed[fixlinenr]: <$fixed[$fixlinenr]>\n");
37563808 $fixed[$fixlinenr] =~
37573809 s/\s+\)/\)/;
37583810 }
@@ -4060,12 +4112,17 @@ sub process { · 301 unmodified lines
40604112 my $cnt = $realcnt;
40614113 my ($off, $dstat, $dcond, $rest);
40624114 my $ctx = '';
4115+ my $has_flow_statement = 0;
4116+ my $has_arg_concat = 0;
40634117 ($dstat, $dcond, $ln, $cnt, $off) =
40644118 ctx_statement_block($linenr, $realcnt, 0);
40654119 $ctx = $dstat;
40664120 #print "dstat<$dstat> dcond<$dcond> cnt<$cnt> off<$off>\n";
40674121 #print "LINE<$lines[$ln-1]> len<" . length($lines[$ln-1]) . "\n";
40684122
4123+ $has_flow_statement = 1 if ($ctx =~ /\b(goto|return)\b/);
4124+ $has_arg_concat = 1 if ($ctx =~ /\#\#/);
4125+
40694126 $dstat =~ s/^.\s*\#\s*define\s+$Ident(?:\([^\)]*\))?\s*//;
40704127 $dstat =~ s/$;//g;
40714128 $dstat =~ s/\\\n.//g;
@@ -4126,10 +4183,23 @@ sub process { · 54 unmodified lines
41264183 "Macros with multiple statements should be enclosed in a do - while loop\n" . "$herectx");
41274184 } else {
41284185 ERROR("COMPLEX_MACRO",
4129− "Macros with complex values should be enclosed in parenthesis\n" . "$herectx");
4186+ "Macros with complex values should be enclosed in parentheses\n" . "$herectx");
41304187 }
41314188 }
41324189
4190+# check for macros with flow control, but without ## concatenation
4191+# ## concatenation is commonly a macro that defines a function so ignore those
4192+ if ($has_flow_statement && !$has_arg_concat) {
4193+ my $herectx = $here . "\n";
4194+ my $cnt = statement_rawlines($ctx);
4195+
4196+ for (my $n = 0; $n < $cnt; $n++) {
4197+ $herectx .= raw_line($linenr, $n) . "\n";
4198+ }
4199+ WARN("MACRO_WITH_FLOW_CONTROL",
4200+ "Macros with flow control statements should be avoided\n" . "$herectx");
4201+ }
4202+
41334203 # check for line continuations outside of #defines, preprocessor #, and asm
41344204
41354205 } else {
@@ -4338,6 +4408,12 @@ sub process { · 202 unmodified lines
43384408 "Use of volatile is usually wrong: see Documentation/volatile-considered-harmful.txt\n" . $herecurr);
43394409 }
43404410
4411+# concatenated string without spaces between elements
4412+ if ($line =~ /"X+"[A-Z_]+/ || $line =~ /[A-Z_]+"X+"/) {
4413+ CHK("CONCATENATED_STRING",
4414+ "Concatenated strings should use spaces between elements\n" . $herecurr);
4415+ }
4416+
43414417 # warn about #if 0
43424418 if ($line =~ /^.\s*\#\s*if\s+0\b/) {
43434419 CHK("REDUNDANT_CODE",
@@ -4371,6 +4447,17 @@ sub process { · 27 unmodified lines
43714447 }
43724448 }
43734449
4450+# check for logging functions with KERN_<LEVEL>
4451+ if ($line !~ /printk\s*\(/ &&
4452+ $line =~ /\b$logFunctions\s*\(.*\b(KERN_[A-Z]+)\b/) {
4453+ my $level = $1;
4454+ if (WARN("UNNECESSARY_KERN_LEVEL",
4455+ "Possible unnecessary $level\n" . $herecurr) &&
4456+ $fix) {
4457+ $fixed[$fixlinenr] =~ s/\s*$level\s*//;
4458+ }
4459+ }
4460+
43744461 # check for bad placement of section $InitAttribute (e.g.: __initdata)
43754462 if ($line =~ /(\b$InitAttribute\b)/) {
43764463 my $attr = $1;
scripts/headers_install.sh+2−2
@@ -1,8 +1,8 @@
11 #!/bin/sh
22
3−if [ $# -lt 1 ]
3+if [ $# -lt 2 ]
44 then
5− echo "Usage: headers_install.sh OUTDIR SRCDIR [FILES...]
5+ echo "Usage: headers_install.sh OUTDIR SRCDIR [FILES...]"
66 echo
77 echo "Prepares kernel header files for use by user space, by removing"
88 echo "all compiler.h definitions and #includes, removing any"
scripts/sortextable.h+1−1
@@ -103,7 +103,7 @@ do_func(Elf_Ehdr *ehdr, char const *const fname, table_sort_t custom_sort) · 102 unmodified lines
103103 Elf_Sym *sort_needed_sym;
104104 Elf_Shdr *sort_needed_sec;
105105 Elf_Rel *relocs = NULL;
106− int relocs_size;
106+ int relocs_size = 0;
107107 uint32_t *sort_done_location;
108108 const char *secstrtab;
109109 const char *strtab;
scripts/spelling.txt+1042−0
@@ -0,0 +1,1042 @@
1+# Originally from Debian's Lintian tool. Various false positives have been
2+# removed, and various additions have been made as they've been discovered
3+# in the kernel source.
4+#
5+# License: GPLv2
6+#
7+# The format of each line is:
8+# mistake||correction
9+#
10+abandonning||abandoning
11+abigious||ambiguous
12+abitrate||arbitrate
13+abov||above
14+abreviated||abbreviated
15+absense||absence
16+absolut||absolute
17+absoulte||absolute
18+acccess||access
19+acceleratoin||acceleration
20+accelleration||acceleration
21+accesing||accessing
22+accesnt||accent
23+accessable||accessible
24+accesss||access
25+accidentaly||accidentally
26+accidentually||accidentally
27+accoding||according
28+accomodate||accommodate
29+accomodates||accommodates
30+accordign||according
31+accoring||according
32+accout||account
33+accquire||acquire
34+accquired||acquired
35+acessable||accessible
36+acess||access
37+achitecture||architecture
38+acient||ancient
39+acitions||actions
40+acitve||active
41+acknowldegement||acknowldegement
42+acknowledgement||acknowledgment
43+ackowledge||acknowledge
44+ackowledged||acknowledged
45+acording||according
46+activete||activate
47+acumulating||accumulating
48+adapater||adapter
49+addional||additional
50+additionaly||additionally
51+addres||address
52+addreses||addresses
53+addresss||address
54+aditional||additional
55+aditionally||additionally
56+aditionaly||additionally
57+adminstrative||administrative
58+adress||address
59+adresses||addresses
60+adviced||advised
61+afecting||affecting
62+agaist||against
63+albumns||albums
64+alegorical||allegorical
65+algorith||algorithm
66+algorithmical||algorithmically
67+algoritm||algorithm
68+algoritms||algorithms
69+algorrithm||algorithm
70+algorritm||algorithm
71+allign||align
72+allocatrd||allocated
73+allocte||allocate
74+allpication||application
75+alocate||allocate
76+alogirhtms||algorithms
77+alogrithm||algorithm
78+alot||a lot
79+alow||allow
80+alows||allows
81+altough||although
82+alue||value
83+ambigious||ambiguous
84+amoung||among
85+amout||amount
86+analysator||analyzer
87+ang||and
88+anniversery||anniversary
89+annoucement||announcement
90+anomolies||anomalies
91+anomoly||anomaly
92+anway||anyway
93+aplication||application
94+appearence||appearance
95+applicaion||application
96+appliction||application
97+applictions||applications
98+appplications||applications
99+appropiate||appropriate
100+appropriatly||appropriately
101+approriate||appropriate
102+approriately||appropriately
103+aquainted||acquainted
104+aquired||acquired
105+arbitary||arbitrary
106+architechture||architecture
107+arguement||argument
108+arguements||arguments
109+aritmetic||arithmetic
110+arne't||aren't
111+arraival||arrival
112+artifical||artificial
113+artillary||artillery
114+assiged||assigned
115+assigment||assignment
116+assigments||assignments
117+assistent||assistant
118+assocation||association
119+associcated||associated
120+assotiated||associated
121+assum||assume
122+assumtpion||assumption
123+asuming||assuming
124+asycronous||asynchronous
125+asynchnous||asynchronous
126+atomatically||automatically
127+atomicly||atomically
128+attachement||attachment
129+attched||attached
130+attemps||attempts
131+attruibutes||attributes
132+authentification||authentication
133+automaticaly||automatically
134+automaticly||automatically
135+automatize||automate
136+automatized||automated
137+automatizes||automates
138+autonymous||autonomous
139+auxilliary||auxiliary
140+avaiable||available
141+avaible||available
142+availabe||available
143+availabled||available
144+availablity||availability
145+availale||available
146+availavility||availability
147+availble||available
148+availiable||available
149+avalable||available
150+avaliable||available
151+aysnc||async
152+backgroud||background
153+backword||backward
154+backwords||backwards
155+bahavior||behavior
156+bakup||backup
157+baloon||balloon
158+baloons||balloons
159+bandwith||bandwidth
160+batery||battery
161+beacuse||because
162+becasue||because
163+becomming||becoming
164+becuase||because
165+beeing||being
166+befor||before
167+begining||beginning
168+beter||better
169+betweeen||between
170+bianries||binaries
171+bitmast||bitmask
172+boardcast||broadcast
173+borad||board
174+boundry||boundary
175+brievely||briefly
176+broadcat||broadcast
177+cacluated||calculated
178+caculation||calculation
179+calender||calendar
180+calle||called
181+calucate||calculate
182+calulate||calculate
183+cancelation||cancellation
184+capabilites||capabilities
185+capabitilies||capabilities
186+capatibilities||capabilities
187+carefuly||carefully
188+cariage||carriage
189+catagory||category
190+challange||challenge
191+challanges||challenges
192+chanell||channel
193+changable||changeable
194+channle||channel
195+channnel||channel
196+charachter||character
197+charachters||characters
198+charactor||character
199+charater||character
200+charaters||characters
201+charcter||character
202+checksuming||checksumming
203+childern||children
204+childs||children
205+chiled||child
206+chked||checked
207+chnage||change
208+chnages||changes
209+chnnel||channel
210+choosen||chosen
211+chouse||chose
212+circumvernt||circumvent
213+claread||cleared
214+clared||cleared
215+closeing||closing
216+clustred||clustered
217+collapsable||collapsible
218+colorfull||colorful
219+comand||command
220+comit||commit
221+commerical||commercial
222+comming||coming
223+comminucation||communication
224+commited||committed
225+commiting||committing
226+committ||commit
227+commoditiy||commodity
228+compability||compatibility
229+compaibility||compatibility
230+compatability||compatibility
231+compatable||compatible
232+compatibiliy||compatibility
233+compatibilty||compatibility
234+compilant||compliant
235+compleatly||completely
236+completly||completely
237+complient||compliant
238+componnents||components
239+compres||compress
240+compresion||compression
241+comression||compression
242+comunication||communication
243+conbination||combination
244+conditionaly||conditionally
245+conected||connected
246+configuratoin||configuration
247+configuraton||configuration
248+configuretion||configuration
249+conider||consider
250+conjuction||conjunction
251+connectinos||connections
252+connnection||connection
253+connnections||connections
254+consistancy||consistency
255+consistant||consistent
256+containes||contains
257+containts||contains
258+contaisn||contains
259+contant||contact
260+contence||contents
261+continous||continuous
262+continously||continuously
263+continueing||continuing
264+contraints||constraints
265+controled||controlled
266+controler||controller
267+controll||control
268+contruction||construction
269+contry||country
270+convertion||conversion
271+convertor||converter
272+convienient||convenient
273+convinient||convenient
274+corected||corrected
275+correponding||corresponding
276+correponds||corresponds
277+correspoding||corresponding
278+cotrol||control
279+couter||counter
280+coutner||counter
281+cryptocraphic||cryptographic
282+cunter||counter
283+curently||currently
284+dafault||default
285+deafult||default
286+deamon||daemon
287+decompres||decompress
288+decription||description
289+defailt||default
290+defferred||deferred
291+definate||definite
292+definately||definitely
293+defintion||definition
294+defualt||default
295+defult||default
296+deivce||device
297+delared||declared
298+delare||declare
299+delares||declares
300+delaring||declaring
301+delemiter||delimiter
302+dependancies||dependencies
303+dependancy||dependency
304+dependant||dependent
305+depreacted||deprecated
306+depreacte||deprecate
307+desactivate||deactivate
308+desciptors||descriptors
309+descrition||description
310+descritptor||descriptor
311+desctiptor||descriptor
312+desriptor||descriptor
313+desriptors||descriptors
314+destory||destroy
315+destoryed||destroyed
316+destorys||destroys
317+destroied||destroyed
318+detabase||database
319+develope||develop
320+developement||development
321+developped||developed
322+developpement||development
323+developper||developer
324+developpment||development
325+deveolpment||development
326+devided||divided
327+deviece||device
328+diable||disable
329+dictionnary||dictionary
330+diferent||different
331+differrence||difference
332+difinition||definition
333+diplay||display
334+direectly||directly
335+disapear||disappear
336+disapeared||disappeared
337+disappared||disappeared
338+disconnet||disconnect
339+discontinous||discontinuous
340+dispertion||dispersion
341+dissapears||disappears
342+distiction||distinction
343+docuentation||documentation
344+documantation||documentation
345+documentaion||documentation
346+documment||document
347+dorp||drop
348+dosen||doesn
349+downlad||download
350+downlads||downloads
351+druing||during
352+dynmaic||dynamic
353+easilly||easily
354+ecspecially||especially
355+edditable||editable
356+editting||editing
357+efficently||efficiently
358+ehther||ether
359+eigth||eight
360+eletronic||electronic
361+enabledi||enabled
362+enchanced||enhanced
363+encorporating||incorporating
364+encrupted||encrypted
365+encrypiton||encryption
366+endianess||endianness
367+enhaced||enhanced
368+enlightnment||enlightenment
369+enocded||encoded
370+enterily||entirely
371+enviroiment||environment
372+enviroment||environment
373+environement||environment
374+environent||environment
375+eqivalent||equivalent
376+equiped||equipped
377+equivelant||equivalent
378+equivilant||equivalent
379+eror||error
380+estbalishment||establishment
381+etsablishment||establishment
382+etsbalishment||establishment
383+excecutable||executable
384+exceded||exceeded
385+excellant||excellent
386+existance||existence
387+existant||existent
388+exixt||exist
389+exlcude||exclude
390+exlcusive||exclusive
391+exmaple||example
392+expecially||especially
393+explicite||explicit
394+explicitely||explicitly
395+explict||explicit
396+explictly||explicitly
397+expresion||expression
398+exprimental||experimental
399+extened||extended
400+extensability||extensibility
401+extention||extension
402+extracter||extractor
403+faild||failed
404+faill||fail
405+failue||failure
406+failuer||failure
407+faireness||fairness
408+faliure||failure
409+familar||familiar
410+fatser||faster
411+feauture||feature
412+feautures||features
413+fetaure||feature
414+fetaures||features
415+fileystem||filesystem
416+finanize||finalize
417+findn||find
418+finilizes||finalizes
419+finsih||finish
420+flusing||flushing
421+folloing||following
422+followign||following
423+follwing||following
424+forseeable||foreseeable
425+forse||force
426+fortan||fortran
427+forwardig||forwarding
428+framwork||framework
429+frequncy||frequency
430+frome||from
431+fucntion||function
432+fuction||function
433+fuctions||functions
434+funcion||function
435+functionallity||functionality
436+functionaly||functionally
437+functionnality||functionality
438+functonality||functionality
439+funtion||function
440+funtions||functions
441+furthur||further
442+futhermore||furthermore
443+futrue||future
444+gaurenteed||guaranteed
445+generiously||generously
446+genric||generic
447+globel||global
448+grabing||grabbing
449+grahical||graphical
450+grahpical||graphical
451+grapic||graphic
452+guage||gauge
453+guarentee||guarantee
454+halfs||halves
455+hander||handler
456+handfull||handful
457+hanled||handled
458+harware||hardware
459+heirarchically||hierarchically
460+helpfull||helpful
461+hierachy||hierarchy
462+hierarchie||hierarchy
463+howver||however
464+hsould||should
465+hypter||hyper
466+identidier||identifier
467+imblance||imbalance
468+immeadiately||immediately
469+immedaite||immediate
470+immediatelly||immediately
471+immediatly||immediately
472+immidiate||immediate
473+impelentation||implementation
474+impementated||implemented
475+implemantation||implementation
476+implemenation||implementation
477+implementaiton||implementation
478+implementated||implemented
479+implemention||implementation
480+implemetation||implementation
481+implemntation||implementation
482+implentation||implementation
483+implmentation||implementation
484+implmenting||implementing
485+incomming||incoming
486+incompatabilities||incompatibilities
487+incompatable||incompatible
488+inconsistant||inconsistent
489+increas||increase
490+incrment||increment
491+indendation||indentation
492+indended||intended
493+independant||independent
494+independantly||independently
495+independed||independent
496+indiate||indicate
497+inexpect||inexpected
498+infomation||information
499+informatiom||information
500+informations||information
501+informtion||information
502+infromation||information
503+ingore||ignore
504+inital||initial
505+initalised||initialized
506+initalise||initialize
507+initalize||initialize
508+initation||initiation
509+initators||initiators
510+initializiation||initialization
511+initialzed||initialized
512+initilization||initialization
513+initilize||initialize
514+inofficial||unofficial
515+instal||install
516+inteface||interface
517+integreated||integrated
518+integrety||integrity
519+integrey||integrity
520+intendet||intended
521+intented||intended
522+interanl||internal
523+interchangable||interchangeable
524+interferring||interfering
525+interger||integer
526+intermittant||intermittent
527+internel||internal
528+interoprability||interoperability
529+interrface||interface
530+interrrupt||interrupt
531+interrup||interrupt
532+interrups||interrupts
533+interruptted||interrupted
534+interupted||interrupted
535+interupt||interrupt
536+intial||initial
537+intialized||initialized
538+intialize||initialize
539+intregral||integral
540+intrrupt||interrupt
541+intuative||intuitive
542+invaid||invalid
543+invalde||invald
544+invalide||invalid
545+invididual||individual
546+invokation||invocation
547+invokations||invocations
548+irrelevent||irrelevant
549+isssue||issue
550+itslef||itself
551+jave||java
552+jeffies||jiffies
553+juse||just
554+jus||just
555+kown||known
556+langage||language
557+langauage||language
558+langauge||language
559+langugage||language
560+lauch||launch
561+leightweight||lightweight
562+lengh||length
563+lenght||length
564+lenth||length
565+lesstiff||lesstif
566+libaries||libraries
567+libary||library
568+librairies||libraries
569+libraris||libraries
570+licenceing||licencing
571+loggging||logging
572+loggin||login
573+logile||logfile
574+loosing||losing
575+losted||lost
576+machinary||machinery
577+maintainance||maintenance
578+maintainence||maintenance
579+maintan||maintain
580+makeing||making
581+malplaced||misplaced
582+malplace||misplace
583+managable||manageable
584+managment||management
585+mangement||management
586+manoeuvering||maneuvering
587+mappping||mapping
588+mathimatical||mathematical
589+mathimatic||mathematic
590+mathimatics||mathematics
591+maxium||maximum
592+mechamism||mechanism
593+meetign||meeting
594+ment||meant
595+mergable||mergeable
596+mesage||message
597+messags||messages
598+messgaes||messages
599+messsage||message
600+messsages||messages
601+microprocesspr||microprocessor
602+milliseonds||milliseconds
603+minumum||minimum
604+miscelleneous||miscellaneous
605+misformed||malformed
606+mispelled||misspelled
607+mispelt||misspelt
608+miximum||maximum
609+mmnemonic||mnemonic
610+mnay||many
611+modeled||modelled
612+modulues||modules
613+monochorome||monochrome
614+monochromo||monochrome
615+monocrome||monochrome
616+mopdule||module
617+mroe||more
618+mulitplied||multiplied
619+multidimensionnal||multidimensional
620+multple||multiple
621+mumber||number
622+muticast||multicast
623+mutiple||multiple
624+mutli||multi
625+nams||names
626+navagating||navigating
627+nead||need
628+neccecary||necessary
629+neccesary||necessary
630+neccessary||necessary
631+necesary||necessary
632+negaive||negative
633+negoitation||negotiation
634+negotation||negotiation
635+nerver||never
636+nescessary||necessary
637+nessessary||necessary
638+noticable||noticeable
639+notications||notifications
640+notifed||notified
641+numebr||number
642+numner||number
643+obtaion||obtain
644+occassionally||occasionally
645+occationally||occasionally
646+occurance||occurrence
647+occurances||occurrences
648+occured||occurred
649+occurence||occurrence
650+occure||occurred
651+occuring||occurring
652+offet||offset
653+omitt||omit
654+ommiting||omitting
655+ommitted||omitted
656+onself||oneself
657+ony||only
658+operatione||operation
659+opertaions||operations
660+optionnal||optional
661+optmizations||optimizations
662+orientatied||orientated
663+orientied||oriented
664+otherise||otherwise
665+ouput||output
666+overaall||overall
667+overhread||overhead
668+overlaping||overlapping
669+overriden||overridden
670+overun||overrun
671+pacakge||package
672+pachage||package
673+packacge||package
674+packege||package
675+packge||package
676+packtes||packets
677+pakage||package
678+pallette||palette
679+paln||plan
680+paramameters||parameters
681+paramater||parameter
682+parametes||parameters
683+parametised||parametrised
684+paramter||parameter
685+paramters||parameters
686+particuarly||particularly
687+particularily||particularly
688+pased||passed
689+passin||passing
690+pathes||paths
691+pecularities||peculiarities
692+peformance||performance
693+peice||piece
694+pendantic||pedantic
695+peprocessor||preprocessor
696+perfoming||performing
697+permissons||permissions
698+peroid||period
699+persistance||persistence
700+persistant||persistent
701+platfrom||platform
702+plattform||platform
703+pleaes||please
704+ploting||plotting
705+plugable||pluggable
706+poinnter||pointer
707+poiter||pointer
708+posible||possible
709+positon||position
710+possibilites||possibilities
711+powerfull||powerful
712+preceeded||preceded
713+preceeding||preceding
714+preceed||precede
715+precendence||precedence
716+precission||precision
717+prefered||preferred
718+prefferably||preferably
719+premption||preemption
720+prepaired||prepared
721+pressre||pressure
722+primative||primitive
723+princliple||principle
724+priorty||priority
725+privilaged||privileged
726+privilage||privilege
727+priviledge||privilege
728+priviledges||privileges
729+probaly||probably
730+procceed||proceed
731+proccesors||processors
732+procesed||processed
733+proces||process
734+processessing||processing
735+processess||processes
736+processpr||processor
737+processsed||processed
738+processsing||processing
739+procteted||protected
740+prodecure||procedure
741+progams||programs
742+progess||progress
743+programers||programmers
744+programm||program
745+programms||programs
746+progresss||progress
747+promps||prompts
748+pronnounced||pronounced
749+prononciation||pronunciation
750+pronouce||pronounce
751+pronunce||pronounce
752+propery||property
753+propigate||propagate
754+propigation||propagation
755+propogate||propagate
756+prosess||process
757+protable||portable
758+protcol||protocol
759+protecion||protection
760+protocoll||protocol
761+psudo||pseudo
762+psuedo||pseudo
763+psychadelic||psychedelic
764+pwoer||power
765+quering||querying
766+raoming||roaming
767+reasearcher||researcher
768+reasearchers||researchers
769+reasearch||research
770+recepient||recipient
771+receving||receiving
772+recieved||received
773+recieve||receive
774+reciever||receiver
775+recieves||receives
776+recogniced||recognised
777+recognizeable||recognizable
778+recommanded||recommended
779+recyle||recycle
780+redircet||redirect
781+redirectrion||redirection
782+refcounf||refcount
783+refence||reference
784+refered||referred
785+referenace||reference
786+refering||referring
787+refernces||references
788+refernnce||reference
789+refrence||reference
790+registerd||registered
791+registeresd||registered
792+registes||registers
793+registraration||registration
794+regster||register
795+regualar||regular
796+reguator||regulator
797+regulamentations||regulations
798+reigstration||registration
799+releated||related
800+relevent||relevant
801+remoote||remote
802+remore||remote
803+removeable||removable
804+repectively||respectively
805+replacable||replaceable
806+replacments||replacements
807+replys||replies
808+reponse||response
809+representaion||representation
810+reqeust||request
811+requiere||require
812+requirment||requirement
813+requred||required
814+requried||required
815+requst||request
816+reseting||resetting
817+resizeable||resizable
818+resouces||resources
819+resoures||resources
820+ressizes||resizes
821+ressource||resource
822+ressources||resources
823+retransmited||retransmitted
824+retreived||retrieved
825+retreive||retrieve
826+retrive||retrieve
827+retuned||returned
828+reuest||request
829+reuqest||request
830+reutnred||returned
831+rmeoved||removed
832+rmeove||remove
833+rmeoves||removes
834+rountine||routine
835+routins||routines
836+rquest||request
837+runing||running
838+runned||ran
839+runnning||running
840+runtine||runtime
841+sacrifying||sacrificing
842+safly||safely
843+safty||safety
844+savable||saveable
845+scaned||scanned
846+scaning||scanning
847+scarch||search
848+seach||search
849+searchs||searches
850+secquence||sequence
851+secund||second
852+segement||segment
853+senarios||scenarios
854+sentivite||sensitive
855+separatly||separately
856+sepcify||specify
857+sepc||spec
858+seperated||separated
859+seperately||separately
860+seperate||separate
861+seperatly||separately
862+seperator||separator
863+sepperate||separate
864+sequece||sequence
865+sequencial||sequential
866+serveral||several
867+setts||sets
868+settting||setting
869+shotdown||shutdown
870+shoud||should
871+shoule||should
872+shrinked||shrunk
873+siginificantly||significantly
874+signabl||signal
875+similary||similarly
876+similiar||similar
877+simlar||similar
878+simliar||similar
879+simpified||simplified
880+singaled||signaled
881+singal||signal
882+singed||signed
883+sleeped||slept
884+softwares||software
885+speach||speech
886+specfic||specific
887+speciefied||specified
888+specifc||specific
889+specifed||specified
890+specificatin||specification
891+specificaton||specification
892+specifing||specifying
893+specifiying||specifying
894+speficied||specified
895+speicify||specify
896+speling||spelling
897+spinlcok||spinlock
898+spinock||spinlock
899+splitted||split
900+spreaded||spread
901+sructure||structure
902+stablilization||stabilization
903+staically||statically
904+staion||station
905+standardss||standards
906+standartization||standardization
907+standart||standard
908+staticly||statically
909+stoped||stopped
910+stoppped||stopped
911+straming||streaming
912+struc||struct
913+structres||structures
914+stuct||struct
915+sturcture||structure
916+subdirectoires||subdirectories
917+suble||subtle
918+succesfully||successfully
919+succesful||successful
920+successfull||successful
921+sucessfully||successfully
922+sucess||success
923+superflous||superfluous
924+superseeded||superseded
925+suplied||supplied
926+suported||supported
927+suport||support
928+suppored||supported
929+supportin||supporting
930+suppoted||supported
931+suppported||supported
932+suppport||support
933+supress||suppress
934+surpresses||suppresses
935+susbsystem||subsystem
936+suspicously||suspiciously
937+swaping||swapping
938+switchs||switches
939+symetric||symmetric
940+synax||syntax
941+synchonized||synchronized
942+syncronize||synchronize
943+syncronizing||synchronizing
944+syncronus||synchronous
945+syste||system
946+sytem||system
947+sythesis||synthesis
948+taht||that
949+targetted||targeted
950+targetting||targeting
951+teh||the
952+temorary||temporary
953+temproarily||temporarily
954+thier||their
955+threds||threads
956+threshhold||threshold
957+throught||through
958+thses||these
959+tiggered||triggered
960+tipically||typically
961+tmis||this
962+torerable||tolerable
963+tramsmitted||transmitted
964+tramsmit||transmit
965+tranfer||transfer
966+transciever||transceiver
967+transferd||transferrd
968+transfered||transferred
969+transfering||transferring
970+transision||transition
971+transmittd||transmitted
972+transormed||transformed
973+trasmission||transmission
974+treshold||threshold
975+trigerring||triggering
976+trun||turn
977+ture||true
978+tyep||type
979+udpate||update
980+uesd||used
981+unconditionaly||unconditionally
982+underun||underrun
983+unecessary||unnecessary
984+unexecpted||unexpected
985+unexpectd||unexpected
986+unexpeted||unexpected
987+unfortunatelly||unfortunately
988+unifiy||unify
989+unknonw||unknown
990+unknow||unknown
991+unkown||unknown
992+unneedingly||unnecessarily
993+unresgister||unregister
994+unsinged||unsigned
995+unstabel||unstable
996+unsuccessfull||unsuccessful
997+unsuported||unsupported
998+untill||until
999+unuseful||useless
1000+upate||update
1001+usefule||useful
1002+usefull||useful
1003+usege||usage
1004+usera||users
1005+usualy||usually
1006+utilites||utilities
1007+utillities||utilities
1008+utilties||utilities
1009+utiltity||utility
1010+utitity||utility
1011+utitlty||utility
1012+vaid||valid
1013+vaild||valid
1014+valide||valid
1015+variantions||variations
1016+varient||variant
1017+vaule||value
1018+verbse||verbose
1019+verisons||versions
1020+verison||version
1021+verson||version
1022+vicefersa||vice-versa
1023+virtal||virtual
1024+virtaul||virtual
1025+virtiual||virtual
1026+visiters||visitors
1027+vitual||virtual
1028+wating||waiting
1029+whataver||whatever
1030+whenver||whenever
1031+wheter||whether
1032+whe||when
1033+wierd||weird
1034+wiil||will
1035+wirte||write
1036+withing||within
1037+wnat||want
1038+workarould||workaround
1039+writeing||writing
1040+writting||writing
1041+zombe||zombie
1042+zomebie||zombie

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t