diff options
317 files changed, 2925 insertions, 2082 deletions
diff --git a/Documentation/hwmon/sysfs-interface b/Documentation/hwmon/sysfs-interface index ff45d1f837c8..48ceabedf55d 100644 --- a/Documentation/hwmon/sysfs-interface +++ b/Documentation/hwmon/sysfs-interface | |||
@@ -91,12 +91,11 @@ name The chip name. | |||
91 | I2C devices get this attribute created automatically. | 91 | I2C devices get this attribute created automatically. |
92 | RO | 92 | RO |
93 | 93 | ||
94 | update_rate The rate at which the chip will update readings. | 94 | update_interval The interval at which the chip will update readings. |
95 | Unit: millisecond | 95 | Unit: millisecond |
96 | RW | 96 | RW |
97 | Some devices have a variable update rate. This attribute | 97 | Some devices have a variable update rate or interval. |
98 | can be used to change the update rate to the desired | 98 | This attribute can be used to change it to the desired value. |
99 | frequency. | ||
100 | 99 | ||
101 | 100 | ||
102 | ************ | 101 | ************ |
diff --git a/Documentation/power/regulator/overview.txt b/Documentation/power/regulator/overview.txt index 9363e056188a..8ed17587a74b 100644 --- a/Documentation/power/regulator/overview.txt +++ b/Documentation/power/regulator/overview.txt | |||
@@ -13,7 +13,7 @@ regulators (where voltage output is controllable) and current sinks (where | |||
13 | current limit is controllable). | 13 | current limit is controllable). |
14 | 14 | ||
15 | (C) 2008 Wolfson Microelectronics PLC. | 15 | (C) 2008 Wolfson Microelectronics PLC. |
16 | Author: Liam Girdwood <lg@opensource.wolfsonmicro.com> | 16 | Author: Liam Girdwood <lrg@slimlogic.co.uk> |
17 | 17 | ||
18 | 18 | ||
19 | Nomenclature | 19 | Nomenclature |
diff --git a/Documentation/workqueue.txt b/Documentation/workqueue.txt new file mode 100644 index 000000000000..e4498a2872c3 --- /dev/null +++ b/Documentation/workqueue.txt | |||
@@ -0,0 +1,380 @@ | |||
1 | |||
2 | Concurrency Managed Workqueue (cmwq) | ||
3 | |||
4 | September, 2010 Tejun Heo <tj@kernel.org> | ||
5 | Florian Mickler <florian@mickler.org> | ||
6 | |||
7 | CONTENTS | ||
8 | |||
9 | 1. Introduction | ||
10 | 2. Why cmwq? | ||
11 | 3. The Design | ||
12 | 4. Application Programming Interface (API) | ||
13 | 5. Example Execution Scenarios | ||
14 | 6. Guidelines | ||
15 | |||
16 | |||
17 | 1. Introduction | ||
18 | |||
19 | There are many cases where an asynchronous process execution context | ||
20 | is needed and the workqueue (wq) API is the most commonly used | ||
21 | mechanism for such cases. | ||
22 | |||
23 | When such an asynchronous execution context is needed, a work item | ||
24 | describing which function to execute is put on a queue. An | ||
25 | independent thread serves as the asynchronous execution context. The | ||
26 | queue is called workqueue and the thread is called worker. | ||
27 | |||
28 | While there are work items on the workqueue the worker executes the | ||
29 | functions associated with the work items one after the other. When | ||
30 | there is no work item left on the workqueue the worker becomes idle. | ||
31 | When a new work item gets queued, the worker begins executing again. | ||
32 | |||
33 | |||
34 | 2. Why cmwq? | ||
35 | |||
36 | In the original wq implementation, a multi threaded (MT) wq had one | ||
37 | worker thread per CPU and a single threaded (ST) wq had one worker | ||
38 | thread system-wide. A single MT wq needed to keep around the same | ||
39 | number of workers as the number of CPUs. The kernel grew a lot of MT | ||
40 | wq users over the years and with the number of CPU cores continuously | ||
41 | rising, some systems saturated the default 32k PID space just booting | ||
42 | up. | ||
43 | |||
44 | Although MT wq wasted a lot of resource, the level of concurrency | ||
45 | provided was unsatisfactory. The limitation was common to both ST and | ||
46 | MT wq albeit less severe on MT. Each wq maintained its own separate | ||
47 | worker pool. A MT wq could provide only one execution context per CPU | ||
48 | while a ST wq one for the whole system. Work items had to compete for | ||
49 | those very limited execution contexts leading to various problems | ||
50 | including proneness to deadlocks around the single execution context. | ||
51 | |||
52 | The tension between the provided level of concurrency and resource | ||
53 | usage also forced its users to make unnecessary tradeoffs like libata | ||
54 | choosing to use ST wq for polling PIOs and accepting an unnecessary | ||
55 | limitation that no two polling PIOs can progress at the same time. As | ||
56 | MT wq don't provide much better concurrency, users which require | ||
57 | higher level of concurrency, like async or fscache, had to implement | ||
58 | their own thread pool. | ||
59 | |||
60 | Concurrency Managed Workqueue (cmwq) is a reimplementation of wq with | ||
61 | focus on the following goals. | ||
62 | |||
63 | * Maintain compatibility with the original workqueue API. | ||
64 | |||
65 | * Use per-CPU unified worker pools shared by all wq to provide | ||
66 | flexible level of concurrency on demand without wasting a lot of | ||
67 | resource. | ||
68 | |||
69 | * Automatically regulate worker pool and level of concurrency so that | ||
70 | the API users don't need to worry about such details. | ||
71 | |||
72 | |||
73 | 3. The Design | ||
74 | |||
75 | In order to ease the asynchronous execution of functions a new | ||
76 | abstraction, the work item, is introduced. | ||
77 | |||
78 | A work item is a simple struct that holds a pointer to the function | ||
79 | that is to be executed asynchronously. Whenever a driver or subsystem | ||
80 | wants a function to be executed asynchronously it has to set up a work | ||
81 | item pointing to that function and queue that work item on a | ||
82 | workqueue. | ||
83 | |||
84 | Special purpose threads, called worker threads, execute the functions | ||
85 | off of the queue, one after the other. If no work is queued, the | ||
86 | worker threads become idle. These worker threads are managed in so | ||
87 | called thread-pools. | ||
88 | |||
89 | The cmwq design differentiates between the user-facing workqueues that | ||
90 | subsystems and drivers queue work items on and the backend mechanism | ||
91 | which manages thread-pool and processes the queued work items. | ||
92 | |||
93 | The backend is called gcwq. There is one gcwq for each possible CPU | ||
94 | and one gcwq to serve work items queued on unbound workqueues. | ||
95 | |||
96 | Subsystems and drivers can create and queue work items through special | ||
97 | workqueue API functions as they see fit. They can influence some | ||
98 | aspects of the way the work items are executed by setting flags on the | ||
99 | workqueue they are putting the work item on. These flags include | ||
100 | things like CPU locality, reentrancy, concurrency limits and more. To | ||
101 | get a detailed overview refer to the API description of | ||
102 | alloc_workqueue() below. | ||
103 | |||
104 | When a work item is queued to a workqueue, the target gcwq is | ||
105 | determined according to the queue parameters and workqueue attributes | ||
106 | and appended on the shared worklist of the gcwq. For example, unless | ||
107 | specifically overridden, a work item of a bound workqueue will be | ||
108 | queued on the worklist of exactly that gcwq that is associated to the | ||
109 | CPU the issuer is running on. | ||
110 | |||
111 | For any worker pool implementation, managing the concurrency level | ||
112 | (how many execution contexts are active) is an important issue. cmwq | ||
113 | tries to keep the concurrency at a minimal but sufficient level. | ||
114 | Minimal to save resources and sufficient in that the system is used at | ||
115 | its full capacity. | ||
116 | |||
117 | Each gcwq bound to an actual CPU implements concurrency management by | ||
118 | hooking into the scheduler. The gcwq is notified whenever an active | ||
119 | worker wakes up or sleeps and keeps track of the number of the | ||
120 | currently runnable workers. Generally, work items are not expected to | ||
121 | hog a CPU and consume many cycles. That means maintaining just enough | ||
122 | concurrency to prevent work processing from stalling should be | ||
123 | optimal. As long as there are one or more runnable workers on the | ||
124 | CPU, the gcwq doesn't start execution of a new work, but, when the | ||
125 | last running worker goes to sleep, it immediately schedules a new | ||
126 | worker so that the CPU doesn't sit idle while there are pending work | ||
127 | items. This allows using a minimal number of workers without losing | ||
128 | execution bandwidth. | ||
129 | |||
130 | Keeping idle workers around doesn't cost other than the memory space | ||
131 | for kthreads, so cmwq holds onto idle ones for a while before killing | ||
132 | them. | ||
133 | |||
134 | For an unbound wq, the above concurrency management doesn't apply and | ||
135 | the gcwq for the pseudo unbound CPU tries to start executing all work | ||
136 | items as soon as possible. The responsibility of regulating | ||
137 | concurrency level is on the users. There is also a flag to mark a | ||
138 | bound wq to ignore the concurrency management. Please refer to the | ||
139 | API section for details. | ||
140 | |||
141 | Forward progress guarantee relies on that workers can be created when | ||
142 | more execution contexts are necessary, which in turn is guaranteed | ||
143 | through the use of rescue workers. All work items which might be used | ||
144 | on code paths that handle memory reclaim are required to be queued on | ||
145 | wq's that have a rescue-worker reserved for execution under memory | ||
146 | pressure. Else it is possible that the thread-pool deadlocks waiting | ||
147 | for execution contexts to free up. | ||
148 | |||
149 | |||
150 | 4. Application Programming Interface (API) | ||
151 | |||
152 | alloc_workqueue() allocates a wq. The original create_*workqueue() | ||
153 | functions are deprecated and scheduled for removal. alloc_workqueue() | ||
154 | takes three arguments - @name, @flags and @max_active. @name is the | ||
155 | name of the wq and also used as the name of the rescuer thread if | ||
156 | there is one. | ||
157 | |||
158 | A wq no longer manages execution resources but serves as a domain for | ||
159 | forward progress guarantee, flush and work item attributes. @flags | ||
160 | and @max_active control how work items are assigned execution | ||
161 | resources, scheduled and executed. | ||
162 | |||
163 | @flags: | ||
164 | |||
165 | WQ_NON_REENTRANT | ||
166 | |||
167 | By default, a wq guarantees non-reentrance only on the same | ||
168 | CPU. A work item may not be executed concurrently on the same | ||
169 | CPU by multiple workers but is allowed to be executed | ||
170 | concurrently on multiple CPUs. This flag makes sure | ||
171 | non-reentrance is enforced across all CPUs. Work items queued | ||
172 | to a non-reentrant wq are guaranteed to be executed by at most | ||
173 | one worker system-wide at any given time. | ||
174 | |||
175 | WQ_UNBOUND | ||
176 | |||
177 | Work items queued to an unbound wq are served by a special | ||
178 | gcwq which hosts workers which are not bound to any specific | ||
179 | CPU. This makes the wq behave as a simple execution context | ||
180 | provider without concurrency management. The unbound gcwq | ||
181 | tries to start execution of work items as soon as possible. | ||
182 | Unbound wq sacrifices locality but is useful for the following | ||
183 | cases. | ||
184 | |||
185 | * Wide fluctuation in the concurrency level requirement is | ||
186 | expected and using bound wq may end up creating large number | ||
187 | of mostly unused workers across different CPUs as the issuer | ||
188 | hops through different CPUs. | ||
189 | |||
190 | * Long running CPU intensive workloads which can be better | ||
191 | managed by the system scheduler. | ||
192 | |||
193 | WQ_FREEZEABLE | ||
194 | |||
195 | A freezeable wq participates in the freeze phase of the system | ||
196 | suspend operations. Work items on the wq are drained and no | ||
197 | new work item starts execution until thawed. | ||
198 | |||
199 | WQ_RESCUER | ||
200 | |||
201 | All wq which might be used in the memory reclaim paths _MUST_ | ||
202 | have this flag set. This reserves one worker exclusively for | ||
203 | the execution of this wq under memory pressure. | ||
204 | |||
205 | WQ_HIGHPRI | ||
206 | |||
207 | Work items of a highpri wq are queued at the head of the | ||
208 | worklist of the target gcwq and start execution regardless of | ||
209 | the current concurrency level. In other words, highpri work | ||
210 | items will always start execution as soon as execution | ||
211 | resource is available. | ||
212 | |||
213 | Ordering among highpri work items is preserved - a highpri | ||
214 | work item queued after another highpri work item will start | ||
215 | execution after the earlier highpri work item starts. | ||
216 | |||
217 | Although highpri work items are not held back by other | ||
218 | runnable work items, they still contribute to the concurrency | ||
219 | level. Highpri work items in runnable state will prevent | ||
220 | non-highpri work items from starting execution. | ||
221 | |||
222 | This flag is meaningless for unbound wq. | ||
223 | |||
224 | WQ_CPU_INTENSIVE | ||
225 | |||
226 | Work items of a CPU intensive wq do not contribute to the | ||
227 | concurrency level. In other words, runnable CPU intensive | ||
228 | work items will not prevent other work items from starting | ||
229 | execution. This is useful for bound work items which are | ||
230 | expected to hog CPU cycles so that their execution is | ||
231 | regulated by the system scheduler. | ||
232 | |||
233 | Although CPU intensive work items don't contribute to the | ||
234 | concurrency level, start of their executions is still | ||
235 | regulated by the concurrency management and runnable | ||
236 | non-CPU-intensive work items can delay execution of CPU | ||
237 | intensive work items. | ||
238 | |||
239 | This flag is meaningless for unbound wq. | ||
240 | |||
241 | WQ_HIGHPRI | WQ_CPU_INTENSIVE | ||
242 | |||
243 | This combination makes the wq avoid interaction with | ||
244 | concurrency management completely and behave as a simple | ||
245 | per-CPU execution context provider. Work items queued on a | ||
246 | highpri CPU-intensive wq start execution as soon as resources | ||
247 | are available and don't affect execution of other work items. | ||
248 | |||
249 | @max_active: | ||
250 | |||
251 | @max_active determines the maximum number of execution contexts per | ||
252 | CPU which can be assigned to the work items of a wq. For example, | ||
253 | with @max_active of 16, at most 16 work items of the wq can be | ||
254 | executing at the same time per CPU. | ||
255 | |||
256 | Currently, for a bound wq, the maximum limit for @max_active is 512 | ||
257 | and the default value used when 0 is specified is 256. For an unbound | ||
258 | wq, the limit is higher of 512 and 4 * num_possible_cpus(). These | ||
259 | values are chosen sufficiently high such that they are not the | ||
260 | limiting factor while providing protection in runaway cases. | ||
261 | |||
262 | The number of active work items of a wq is usually regulated by the | ||
263 | users of the wq, more specifically, by how many work items the users | ||
264 | may queue at the same time. Unless there is a specific need for | ||
265 | throttling the number of active work items, specifying '0' is | ||
266 | recommended. | ||
267 | |||
268 | Some users depend on the strict execution ordering of ST wq. The | ||
269 | combination of @max_active of 1 and WQ_UNBOUND is used to achieve this | ||
270 | behavior. Work items on such wq are always queued to the unbound gcwq | ||
271 | and only one work item can be active at any given time thus achieving | ||
272 | the same ordering property as ST wq. | ||
273 | |||
274 | |||
275 | 5. Example Execution Scenarios | ||
276 | |||
277 | The following example execution scenarios try to illustrate how cmwq | ||
278 | behave under different configurations. | ||
279 | |||
280 | Work items w0, w1, w2 are queued to a bound wq q0 on the same CPU. | ||
281 | w0 burns CPU for 5ms then sleeps for 10ms then burns CPU for 5ms | ||
282 | again before finishing. w1 and w2 burn CPU for 5ms then sleep for | ||
283 | 10ms. | ||
284 | |||
285 | Ignoring all other tasks, works and processing overhead, and assuming | ||
286 | simple FIFO scheduling, the following is one highly simplified version | ||
287 | of possible sequences of events with the original wq. | ||
288 | |||
289 | TIME IN MSECS EVENT | ||
290 | 0 w0 starts and burns CPU | ||
291 | 5 w0 sleeps | ||
292 | 15 w0 wakes up and burns CPU | ||
293 | 20 w0 finishes | ||
294 | 20 w1 starts and burns CPU | ||
295 | 25 w1 sleeps | ||
296 | 35 w1 wakes up and finishes | ||
297 | 35 w2 starts and burns CPU | ||
298 | 40 w2 sleeps | ||
299 | 50 w2 wakes up and finishes | ||
300 | |||
301 | And with cmwq with @max_active >= 3, | ||
302 | |||
303 | TIME IN MSECS EVENT | ||
304 | 0 w0 starts and burns CPU | ||
305 | 5 w0 sleeps | ||
306 | 5 w1 starts and burns CPU | ||
307 | 10 w1 sleeps | ||
308 | 10 w2 starts and burns CPU | ||
309 | 15 w2 sleeps | ||
310 | 15 w0 wakes up and burns CPU | ||
311 | 20 w0 finishes | ||
312 | 20 w1 wakes up and finishes | ||
313 | 25 w2 wakes up and finishes | ||
314 | |||
315 | If @max_active == 2, | ||
316 | |||
317 | TIME IN MSECS EVENT | ||
318 | 0 w0 starts and burns CPU | ||
319 | 5 w0 sleeps | ||
320 | 5 w1 starts and burns CPU | ||
321 | 10 w1 sleeps | ||
322 | 15 w0 wakes up and burns CPU | ||
323 | 20 w0 finishes | ||
324 | 20 w1 wakes up and finishes | ||
325 | 20 w2 starts and burns CPU | ||
326 | 25 w2 sleeps | ||
327 | 35 w2 wakes up and finishes | ||
328 | |||
329 | Now, let's assume w1 and w2 are queued to a different wq q1 which has | ||
330 | WQ_HIGHPRI set, | ||
331 | |||
332 | TIME IN MSECS EVENT | ||
333 | 0 w1 and w2 start and burn CPU | ||
334 | 5 w1 sleeps | ||
335 | 10 w2 sleeps | ||
336 | 10 w0 starts and burns CPU | ||
337 | 15 w0 sleeps | ||
338 | 15 w1 wakes up and finishes | ||
339 | 20 w2 wakes up and finishes | ||
340 | 25 w0 wakes up and burns CPU | ||
341 | 30 w0 finishes | ||
342 | |||
343 | If q1 has WQ_CPU_INTENSIVE set, | ||
344 | |||
345 | TIME IN MSECS EVENT | ||
346 | 0 w0 starts and burns CPU | ||
347 | 5 w0 sleeps | ||
348 | 5 w1 and w2 start and burn CPU | ||
349 | 10 w1 sleeps | ||
350 | 15 w2 sleeps | ||
351 | 15 w0 wakes up and burns CPU | ||
352 | 20 w0 finishes | ||
353 | 20 w1 wakes up and finishes | ||
354 | 25 w2 wakes up and finishes | ||
355 | |||
356 | |||
357 | 6. Guidelines | ||
358 | |||
359 | * Do not forget to use WQ_RESCUER if a wq may process work items which | ||
360 | are used during memory reclaim. Each wq with WQ_RESCUER set has one | ||
361 | rescuer thread reserved for it. If there is dependency among | ||
362 | multiple work items used during memory reclaim, they should be | ||
363 | queued to separate wq each with WQ_RESCUER. | ||
364 | |||
365 | * Unless strict ordering is required, there is no need to use ST wq. | ||
366 | |||
367 | * Unless there is a specific need, using 0 for @max_active is | ||
368 | recommended. In most use cases, concurrency level usually stays | ||
369 | well under the default limit. | ||
370 | |||
371 | * A wq serves as a domain for forward progress guarantee (WQ_RESCUER), | ||
372 | flush and work item attributes. Work items which are not involved | ||
373 | in memory reclaim and don't need to be flushed as a part of a group | ||
374 | of work items, and don't require any special attribute, can use one | ||
375 | of the system wq. There is no difference in execution | ||
376 | characteristics between using a dedicated wq and a system wq. | ||
377 | |||
378 | * Unless work items are expected to consume a huge amount of CPU | ||
379 | cycles, using a bound wq is usually beneficial due to the increased | ||
380 | level of locality in wq operations and work item execution. | ||
diff --git a/MAINTAINERS b/MAINTAINERS index e7c528ff1013..df342839b8c1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -1135,7 +1135,7 @@ ATLX ETHERNET DRIVERS | |||
1135 | M: Jay Cliburn <jcliburn@gmail.com> | 1135 | M: Jay Cliburn <jcliburn@gmail.com> |
1136 | M: Chris Snook <chris.snook@gmail.com> | 1136 | M: Chris Snook <chris.snook@gmail.com> |
1137 | M: Jie Yang <jie.yang@atheros.com> | 1137 | M: Jie Yang <jie.yang@atheros.com> |
1138 | L: atl1-devel@lists.sourceforge.net | 1138 | L: netdev@vger.kernel.org |
1139 | W: http://sourceforge.net/projects/atl1 | 1139 | W: http://sourceforge.net/projects/atl1 |
1140 | W: http://atl1.sourceforge.net | 1140 | W: http://atl1.sourceforge.net |
1141 | S: Maintained | 1141 | S: Maintained |
@@ -1220,7 +1220,7 @@ F: drivers/auxdisplay/ | |||
1220 | F: include/linux/cfag12864b.h | 1220 | F: include/linux/cfag12864b.h |
1221 | 1221 | ||
1222 | AVR32 ARCHITECTURE | 1222 | AVR32 ARCHITECTURE |
1223 | M: Haavard Skinnemoen <hskinnemoen@atmel.com> | 1223 | M: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com> |
1224 | W: http://www.atmel.com/products/AVR32/ | 1224 | W: http://www.atmel.com/products/AVR32/ |
1225 | W: http://avr32linux.org/ | 1225 | W: http://avr32linux.org/ |
1226 | W: http://avrfreaks.net/ | 1226 | W: http://avrfreaks.net/ |
@@ -1228,7 +1228,7 @@ S: Supported | |||
1228 | F: arch/avr32/ | 1228 | F: arch/avr32/ |
1229 | 1229 | ||
1230 | AVR32/AT32AP MACHINE SUPPORT | 1230 | AVR32/AT32AP MACHINE SUPPORT |
1231 | M: Haavard Skinnemoen <hskinnemoen@atmel.com> | 1231 | M: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com> |
1232 | S: Supported | 1232 | S: Supported |
1233 | F: arch/avr32/mach-at32ap/ | 1233 | F: arch/avr32/mach-at32ap/ |
1234 | 1234 | ||
@@ -2199,6 +2199,12 @@ W: http://acpi4asus.sf.net | |||
2199 | S: Maintained | 2199 | S: Maintained |
2200 | F: drivers/platform/x86/eeepc-laptop.c | 2200 | F: drivers/platform/x86/eeepc-laptop.c |
2201 | 2201 | ||
2202 | EFIFB FRAMEBUFFER DRIVER | ||
2203 | L: linux-fbdev@vger.kernel.org | ||
2204 | M: Peter Jones <pjones@redhat.com> | ||
2205 | S: Maintained | ||
2206 | F: drivers/video/efifb.c | ||
2207 | |||
2202 | EFS FILESYSTEM | 2208 | EFS FILESYSTEM |
2203 | W: http://aeschi.ch.eu.org/efs/ | 2209 | W: http://aeschi.ch.eu.org/efs/ |
2204 | S: Orphan | 2210 | S: Orphan |
@@ -2657,9 +2663,12 @@ S: Maintained | |||
2657 | F: drivers/media/video/gspca/ | 2663 | F: drivers/media/video/gspca/ |
2658 | 2664 | ||
2659 | HARDWARE MONITORING | 2665 | HARDWARE MONITORING |
2666 | M: Jean Delvare <khali@linux-fr.org> | ||
2667 | M: Guenter Roeck <guenter.roeck@ericsson.com> | ||
2660 | L: lm-sensors@lm-sensors.org | 2668 | L: lm-sensors@lm-sensors.org |
2661 | W: http://www.lm-sensors.org/ | 2669 | W: http://www.lm-sensors.org/ |
2662 | S: Orphan | 2670 | T: quilt kernel.org/pub/linux/kernel/people/jdelvare/linux-2.6/jdelvare-hwmon/ |
2671 | S: Maintained | ||
2663 | F: Documentation/hwmon/ | 2672 | F: Documentation/hwmon/ |
2664 | F: drivers/hwmon/ | 2673 | F: drivers/hwmon/ |
2665 | F: include/linux/hwmon*.h | 2674 | F: include/linux/hwmon*.h |
@@ -3896,10 +3905,8 @@ F: Documentation/serial/moxa-smartio | |||
3896 | F: drivers/char/mxser.* | 3905 | F: drivers/char/mxser.* |
3897 | 3906 | ||
3898 | MSI LAPTOP SUPPORT | 3907 | MSI LAPTOP SUPPORT |
3899 | M: Lennart Poettering <mzxreary@0pointer.de> | 3908 | M: Lee, Chun-Yi <jlee@novell.com> |
3900 | L: platform-driver-x86@vger.kernel.org | 3909 | L: platform-driver-x86@vger.kernel.org |
3901 | W: https://tango.0pointer.de/mailman/listinfo/s270-linux | ||
3902 | W: http://0pointer.de/lennart/tchibo.html | ||
3903 | S: Maintained | 3910 | S: Maintained |
3904 | F: drivers/platform/x86/msi-laptop.c | 3911 | F: drivers/platform/x86/msi-laptop.c |
3905 | 3912 | ||
@@ -3939,7 +3946,7 @@ F: drivers/char/isicom.c | |||
3939 | F: include/linux/isicom.h | 3946 | F: include/linux/isicom.h |
3940 | 3947 | ||
3941 | MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER | 3948 | MUSB MULTIPOINT HIGH SPEED DUAL-ROLE CONTROLLER |
3942 | M: Felipe Balbi <felipe.balbi@nokia.com> | 3949 | M: Felipe Balbi <balbi@ti.com> |
3943 | L: linux-usb@vger.kernel.org | 3950 | L: linux-usb@vger.kernel.org |
3944 | T: git git://gitorious.org/usb/usb.git | 3951 | T: git git://gitorious.org/usb/usb.git |
3945 | S: Maintained | 3952 | S: Maintained |
@@ -4237,7 +4244,7 @@ S: Maintained | |||
4237 | F: drivers/char/hw_random/omap-rng.c | 4244 | F: drivers/char/hw_random/omap-rng.c |
4238 | 4245 | ||
4239 | OMAP USB SUPPORT | 4246 | OMAP USB SUPPORT |
4240 | M: Felipe Balbi <felipe.balbi@nokia.com> | 4247 | M: Felipe Balbi <balbi@ti.com> |
4241 | M: David Brownell <dbrownell@users.sourceforge.net> | 4248 | M: David Brownell <dbrownell@users.sourceforge.net> |
4242 | L: linux-usb@vger.kernel.org | 4249 | L: linux-usb@vger.kernel.org |
4243 | L: linux-omap@vger.kernel.org | 4250 | L: linux-omap@vger.kernel.org |
@@ -1,7 +1,7 @@ | |||
1 | VERSION = 2 | 1 | VERSION = 2 |
2 | PATCHLEVEL = 6 | 2 | PATCHLEVEL = 6 |
3 | SUBLEVEL = 36 | 3 | SUBLEVEL = 36 |
4 | EXTRAVERSION = -rc4 | 4 | EXTRAVERSION = -rc5 |
5 | NAME = Sheep on Meth | 5 | NAME = Sheep on Meth |
6 | 6 | ||
7 | # *DOCUMENTATION* | 7 | # *DOCUMENTATION* |
diff --git a/arch/Kconfig b/arch/Kconfig index 4877a8c8ee16..fe48fc7a3eba 100644 --- a/arch/Kconfig +++ b/arch/Kconfig | |||
@@ -32,8 +32,9 @@ config HAVE_OPROFILE | |||
32 | 32 | ||
33 | config KPROBES | 33 | config KPROBES |
34 | bool "Kprobes" | 34 | bool "Kprobes" |
35 | depends on KALLSYMS && MODULES | 35 | depends on MODULES |
36 | depends on HAVE_KPROBES | 36 | depends on HAVE_KPROBES |
37 | select KALLSYMS | ||
37 | help | 38 | help |
38 | Kprobes allows you to trap at almost any kernel address and | 39 | Kprobes allows you to trap at almost any kernel address and |
39 | execute a callback function. register_kprobe() establishes | 40 | execute a callback function. register_kprobe() establishes |
@@ -45,7 +46,6 @@ config OPTPROBES | |||
45 | def_bool y | 46 | def_bool y |
46 | depends on KPROBES && HAVE_OPTPROBES | 47 | depends on KPROBES && HAVE_OPTPROBES |
47 | depends on !PREEMPT | 48 | depends on !PREEMPT |
48 | select KALLSYMS_ALL | ||
49 | 49 | ||
50 | config HAVE_EFFICIENT_UNALIGNED_ACCESS | 50 | config HAVE_EFFICIENT_UNALIGNED_ACCESS |
51 | bool | 51 | bool |
diff --git a/arch/alpha/include/asm/cacheflush.h b/arch/alpha/include/asm/cacheflush.h index 01d71e1c8a9e..012f1243b1c1 100644 --- a/arch/alpha/include/asm/cacheflush.h +++ b/arch/alpha/include/asm/cacheflush.h | |||
@@ -43,6 +43,8 @@ extern void smp_imb(void); | |||
43 | /* ??? Ought to use this in arch/alpha/kernel/signal.c too. */ | 43 | /* ??? Ought to use this in arch/alpha/kernel/signal.c too. */ |
44 | 44 | ||
45 | #ifndef CONFIG_SMP | 45 | #ifndef CONFIG_SMP |
46 | #include <linux/sched.h> | ||
47 | |||
46 | extern void __load_new_mm_context(struct mm_struct *); | 48 | extern void __load_new_mm_context(struct mm_struct *); |
47 | static inline void | 49 | static inline void |
48 | flush_icache_user_range(struct vm_area_struct *vma, struct page *page, | 50 | flush_icache_user_range(struct vm_area_struct *vma, struct page *page, |
diff --git a/arch/alpha/include/asm/unistd.h b/arch/alpha/include/asm/unistd.h index 804e5311c841..058937bf5a77 100644 --- a/arch/alpha/include/asm/unistd.h +++ b/arch/alpha/include/asm/unistd.h | |||
@@ -449,10 +449,13 @@ | |||
449 | #define __NR_pwritev 491 | 449 | #define __NR_pwritev 491 |
450 | #define __NR_rt_tgsigqueueinfo 492 | 450 | #define __NR_rt_tgsigqueueinfo 492 |
451 | #define __NR_perf_event_open 493 | 451 | #define __NR_perf_event_open 493 |
452 | #define __NR_fanotify_init 494 | ||
453 | #define __NR_fanotify_mark 495 | ||
454 | #define __NR_prlimit64 496 | ||
452 | 455 | ||
453 | #ifdef __KERNEL__ | 456 | #ifdef __KERNEL__ |
454 | 457 | ||
455 | #define NR_SYSCALLS 494 | 458 | #define NR_SYSCALLS 497 |
456 | 459 | ||
457 | #define __ARCH_WANT_IPC_PARSE_VERSION | 460 | #define __ARCH_WANT_IPC_PARSE_VERSION |
458 | #define __ARCH_WANT_OLD_READDIR | 461 | #define __ARCH_WANT_OLD_READDIR |
@@ -463,6 +466,7 @@ | |||
463 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT | 466 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT |
464 | #define __ARCH_WANT_SYS_OLDUMOUNT | 467 | #define __ARCH_WANT_SYS_OLDUMOUNT |
465 | #define __ARCH_WANT_SYS_SIGPENDING | 468 | #define __ARCH_WANT_SYS_SIGPENDING |
469 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND | ||
466 | 470 | ||
467 | /* "Conditional" syscalls. What we want is | 471 | /* "Conditional" syscalls. What we want is |
468 | 472 | ||
diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S index b45d913a51c3..ab1ee0ab082b 100644 --- a/arch/alpha/kernel/entry.S +++ b/arch/alpha/kernel/entry.S | |||
@@ -317,14 +317,14 @@ ret_from_sys_call: | |||
317 | ldq $0, SP_OFF($sp) | 317 | ldq $0, SP_OFF($sp) |
318 | and $0, 8, $0 | 318 | and $0, 8, $0 |
319 | beq $0, restore_all | 319 | beq $0, restore_all |
320 | ret_from_reschedule: | 320 | ret_to_user: |
321 | /* Make sure need_resched and sigpending don't change between | 321 | /* Make sure need_resched and sigpending don't change between |
322 | sampling and the rti. */ | 322 | sampling and the rti. */ |
323 | lda $16, 7 | 323 | lda $16, 7 |
324 | call_pal PAL_swpipl | 324 | call_pal PAL_swpipl |
325 | ldl $5, TI_FLAGS($8) | 325 | ldl $5, TI_FLAGS($8) |
326 | and $5, _TIF_WORK_MASK, $2 | 326 | and $5, _TIF_WORK_MASK, $2 |
327 | bne $5, work_pending | 327 | bne $2, work_pending |
328 | restore_all: | 328 | restore_all: |
329 | RESTORE_ALL | 329 | RESTORE_ALL |
330 | call_pal PAL_rti | 330 | call_pal PAL_rti |
@@ -363,7 +363,7 @@ $ret_success: | |||
363 | * $8: current. | 363 | * $8: current. |
364 | * $19: The old syscall number, or zero if this is not a return | 364 | * $19: The old syscall number, or zero if this is not a return |
365 | * from a syscall that errored and is possibly restartable. | 365 | * from a syscall that errored and is possibly restartable. |
366 | * $20: Error indication. | 366 | * $20: The old a3 value |
367 | */ | 367 | */ |
368 | 368 | ||
369 | .align 4 | 369 | .align 4 |
@@ -392,12 +392,18 @@ $work_resched: | |||
392 | 392 | ||
393 | $work_notifysig: | 393 | $work_notifysig: |
394 | mov $sp, $16 | 394 | mov $sp, $16 |
395 | br $1, do_switch_stack | 395 | bsr $1, do_switch_stack |
396 | mov $sp, $17 | 396 | mov $sp, $17 |
397 | mov $5, $18 | 397 | mov $5, $18 |
398 | mov $19, $9 /* save old syscall number */ | ||
399 | mov $20, $10 /* save old a3 */ | ||
400 | and $5, _TIF_SIGPENDING, $2 | ||
401 | cmovne $2, 0, $9 /* we don't want double syscall restarts */ | ||
398 | jsr $26, do_notify_resume | 402 | jsr $26, do_notify_resume |
403 | mov $9, $19 | ||
404 | mov $10, $20 | ||
399 | bsr $1, undo_switch_stack | 405 | bsr $1, undo_switch_stack |
400 | br restore_all | 406 | br ret_to_user |
401 | .end work_pending | 407 | .end work_pending |
402 | 408 | ||
403 | /* | 409 | /* |
@@ -430,6 +436,7 @@ strace: | |||
430 | beq $1, 1f | 436 | beq $1, 1f |
431 | ldq $27, 0($2) | 437 | ldq $27, 0($2) |
432 | 1: jsr $26, ($27), sys_gettimeofday | 438 | 1: jsr $26, ($27), sys_gettimeofday |
439 | ret_from_straced: | ||
433 | ldgp $gp, 0($26) | 440 | ldgp $gp, 0($26) |
434 | 441 | ||
435 | /* check return.. */ | 442 | /* check return.. */ |
@@ -757,11 +764,15 @@ sys_vfork: | |||
757 | .ent sys_sigreturn | 764 | .ent sys_sigreturn |
758 | sys_sigreturn: | 765 | sys_sigreturn: |
759 | .prologue 0 | 766 | .prologue 0 |
767 | lda $9, ret_from_straced | ||
768 | cmpult $26, $9, $9 | ||
760 | mov $sp, $17 | 769 | mov $sp, $17 |
761 | lda $18, -SWITCH_STACK_SIZE($sp) | 770 | lda $18, -SWITCH_STACK_SIZE($sp) |
762 | lda $sp, -SWITCH_STACK_SIZE($sp) | 771 | lda $sp, -SWITCH_STACK_SIZE($sp) |
763 | jsr $26, do_sigreturn | 772 | jsr $26, do_sigreturn |
764 | br $1, undo_switch_stack | 773 | bne $9, 1f |
774 | jsr $26, syscall_trace | ||
775 | 1: br $1, undo_switch_stack | ||
765 | br ret_from_sys_call | 776 | br ret_from_sys_call |
766 | .end sys_sigreturn | 777 | .end sys_sigreturn |
767 | 778 | ||
@@ -770,47 +781,19 @@ sys_sigreturn: | |||
770 | .ent sys_rt_sigreturn | 781 | .ent sys_rt_sigreturn |
771 | sys_rt_sigreturn: | 782 | sys_rt_sigreturn: |
772 | .prologue 0 | 783 | .prologue 0 |
784 | lda $9, ret_from_straced | ||
785 | cmpult $26, $9, $9 | ||
773 | mov $sp, $17 | 786 | mov $sp, $17 |
774 | lda $18, -SWITCH_STACK_SIZE($sp) | 787 | lda $18, -SWITCH_STACK_SIZE($sp) |
775 | lda $sp, -SWITCH_STACK_SIZE($sp) | 788 | lda $sp, -SWITCH_STACK_SIZE($sp) |
776 | jsr $26, do_rt_sigreturn | 789 | jsr $26, do_rt_sigreturn |
777 | br $1, undo_switch_stack | 790 | bne $9, 1f |
791 | jsr $26, syscall_trace | ||
792 | 1: br $1, undo_switch_stack | ||
778 | br ret_from_sys_call | 793 | br ret_from_sys_call |
779 | .end sys_rt_sigreturn | 794 | .end sys_rt_sigreturn |
780 | 795 | ||
781 | .align 4 | 796 | .align 4 |
782 | .globl sys_sigsuspend | ||
783 | .ent sys_sigsuspend | ||
784 | sys_sigsuspend: | ||
785 | .prologue 0 | ||
786 | mov $sp, $17 | ||
787 | br $1, do_switch_stack | ||
788 | mov $sp, $18 | ||
789 | subq $sp, 16, $sp | ||
790 | stq $26, 0($sp) | ||
791 | jsr $26, do_sigsuspend | ||
792 | ldq $26, 0($sp) | ||
793 | lda $sp, SWITCH_STACK_SIZE+16($sp) | ||
794 | ret | ||
795 | .end sys_sigsuspend | ||
796 | |||
797 | .align 4 | ||
798 | .globl sys_rt_sigsuspend | ||
799 | .ent sys_rt_sigsuspend | ||
800 | sys_rt_sigsuspend: | ||
801 | .prologue 0 | ||
802 | mov $sp, $18 | ||
803 | br $1, do_switch_stack | ||
804 | mov $sp, $19 | ||
805 | subq $sp, 16, $sp | ||
806 | stq $26, 0($sp) | ||
807 | jsr $26, do_rt_sigsuspend | ||
808 | ldq $26, 0($sp) | ||
809 | lda $sp, SWITCH_STACK_SIZE+16($sp) | ||
810 | ret | ||
811 | .end sys_rt_sigsuspend | ||
812 | |||
813 | .align 4 | ||
814 | .globl sys_sethae | 797 | .globl sys_sethae |
815 | .ent sys_sethae | 798 | .ent sys_sethae |
816 | sys_sethae: | 799 | sys_sethae: |
diff --git a/arch/alpha/kernel/err_ev6.c b/arch/alpha/kernel/err_ev6.c index 8ca6345bf131..253cf1a87481 100644 --- a/arch/alpha/kernel/err_ev6.c +++ b/arch/alpha/kernel/err_ev6.c | |||
@@ -90,11 +90,13 @@ static int | |||
90 | ev6_parse_cbox(u64 c_addr, u64 c1_syn, u64 c2_syn, | 90 | ev6_parse_cbox(u64 c_addr, u64 c1_syn, u64 c2_syn, |
91 | u64 c_stat, u64 c_sts, int print) | 91 | u64 c_stat, u64 c_sts, int print) |
92 | { | 92 | { |
93 | char *sourcename[] = { "UNKNOWN", "UNKNOWN", "UNKNOWN", | 93 | static const char * const sourcename[] = { |
94 | "MEMORY", "BCACHE", "DCACHE", | 94 | "UNKNOWN", "UNKNOWN", "UNKNOWN", |
95 | "BCACHE PROBE", "BCACHE PROBE" }; | 95 | "MEMORY", "BCACHE", "DCACHE", |
96 | char *streamname[] = { "D", "I" }; | 96 | "BCACHE PROBE", "BCACHE PROBE" |
97 | char *bitsname[] = { "SINGLE", "DOUBLE" }; | 97 | }; |
98 | static const char * const streamname[] = { "D", "I" }; | ||
99 | static const char * const bitsname[] = { "SINGLE", "DOUBLE" }; | ||
98 | int status = MCHK_DISPOSITION_REPORT; | 100 | int status = MCHK_DISPOSITION_REPORT; |
99 | int source = -1, stream = -1, bits = -1; | 101 | int source = -1, stream = -1, bits = -1; |
100 | 102 | ||
diff --git a/arch/alpha/kernel/err_marvel.c b/arch/alpha/kernel/err_marvel.c index 5c905aaaeccd..648ae88aeb8a 100644 --- a/arch/alpha/kernel/err_marvel.c +++ b/arch/alpha/kernel/err_marvel.c | |||
@@ -589,22 +589,23 @@ marvel_print_pox_spl_cmplt(u64 spl_cmplt) | |||
589 | static void | 589 | static void |
590 | marvel_print_pox_trans_sum(u64 trans_sum) | 590 | marvel_print_pox_trans_sum(u64 trans_sum) |
591 | { | 591 | { |
592 | char *pcix_cmd[] = { "Interrupt Acknowledge", | 592 | static const char * const pcix_cmd[] = { |
593 | "Special Cycle", | 593 | "Interrupt Acknowledge", |
594 | "I/O Read", | 594 | "Special Cycle", |
595 | "I/O Write", | 595 | "I/O Read", |
596 | "Reserved", | 596 | "I/O Write", |
597 | "Reserved / Device ID Message", | 597 | "Reserved", |
598 | "Memory Read", | 598 | "Reserved / Device ID Message", |
599 | "Memory Write", | 599 | "Memory Read", |
600 | "Reserved / Alias to Memory Read Block", | 600 | "Memory Write", |
601 | "Reserved / Alias to Memory Write Block", | 601 | "Reserved / Alias to Memory Read Block", |
602 | "Configuration Read", | 602 | "Reserved / Alias to Memory Write Block", |
603 | "Configuration Write", | 603 | "Configuration Read", |
604 | "Memory Read Multiple / Split Completion", | 604 | "Configuration Write", |
605 | "Dual Address Cycle", | 605 | "Memory Read Multiple / Split Completion", |
606 | "Memory Read Line / Memory Read Block", | 606 | "Dual Address Cycle", |
607 | "Memory Write and Invalidate / Memory Write Block" | 607 | "Memory Read Line / Memory Read Block", |
608 | "Memory Write and Invalidate / Memory Write Block" | ||
608 | }; | 609 | }; |
609 | 610 | ||
610 | #define IO7__POX_TRANSUM__PCI_ADDR__S (0) | 611 | #define IO7__POX_TRANSUM__PCI_ADDR__S (0) |
diff --git a/arch/alpha/kernel/err_titan.c b/arch/alpha/kernel/err_titan.c index f7ed97ce0dfd..c3b3781a03de 100644 --- a/arch/alpha/kernel/err_titan.c +++ b/arch/alpha/kernel/err_titan.c | |||
@@ -75,8 +75,12 @@ titan_parse_p_serror(int which, u64 serror, int print) | |||
75 | int status = MCHK_DISPOSITION_REPORT; | 75 | int status = MCHK_DISPOSITION_REPORT; |
76 | 76 | ||
77 | #ifdef CONFIG_VERBOSE_MCHECK | 77 | #ifdef CONFIG_VERBOSE_MCHECK |
78 | char *serror_src[] = {"GPCI", "APCI", "AGP HP", "AGP LP"}; | 78 | static const char * const serror_src[] = { |
79 | char *serror_cmd[] = {"DMA Read", "DMA RMW", "SGTE Read", "Reserved"}; | 79 | "GPCI", "APCI", "AGP HP", "AGP LP" |
80 | }; | ||
81 | static const char * const serror_cmd[] = { | ||
82 | "DMA Read", "DMA RMW", "SGTE Read", "Reserved" | ||
83 | }; | ||
80 | #endif /* CONFIG_VERBOSE_MCHECK */ | 84 | #endif /* CONFIG_VERBOSE_MCHECK */ |
81 | 85 | ||
82 | #define TITAN__PCHIP_SERROR__LOST_UECC (1UL << 0) | 86 | #define TITAN__PCHIP_SERROR__LOST_UECC (1UL << 0) |
@@ -140,14 +144,15 @@ titan_parse_p_perror(int which, int port, u64 perror, int print) | |||
140 | int status = MCHK_DISPOSITION_REPORT; | 144 | int status = MCHK_DISPOSITION_REPORT; |
141 | 145 | ||
142 | #ifdef CONFIG_VERBOSE_MCHECK | 146 | #ifdef CONFIG_VERBOSE_MCHECK |
143 | char *perror_cmd[] = { "Interrupt Acknowledge", "Special Cycle", | 147 | static const char * const perror_cmd[] = { |
144 | "I/O Read", "I/O Write", | 148 | "Interrupt Acknowledge", "Special Cycle", |
145 | "Reserved", "Reserved", | 149 | "I/O Read", "I/O Write", |
146 | "Memory Read", "Memory Write", | 150 | "Reserved", "Reserved", |
147 | "Reserved", "Reserved", | 151 | "Memory Read", "Memory Write", |
148 | "Configuration Read", "Configuration Write", | 152 | "Reserved", "Reserved", |
149 | "Memory Read Multiple", "Dual Address Cycle", | 153 | "Configuration Read", "Configuration Write", |
150 | "Memory Read Line","Memory Write and Invalidate" | 154 | "Memory Read Multiple", "Dual Address Cycle", |
155 | "Memory Read Line", "Memory Write and Invalidate" | ||
151 | }; | 156 | }; |
152 | #endif /* CONFIG_VERBOSE_MCHECK */ | 157 | #endif /* CONFIG_VERBOSE_MCHECK */ |
153 | 158 | ||
@@ -273,11 +278,11 @@ titan_parse_p_agperror(int which, u64 agperror, int print) | |||
273 | int cmd, len; | 278 | int cmd, len; |
274 | unsigned long addr; | 279 | unsigned long addr; |
275 | 280 | ||
276 | char *agperror_cmd[] = { "Read (low-priority)", "Read (high-priority)", | 281 | static const char * const agperror_cmd[] = { |
277 | "Write (low-priority)", | 282 | "Read (low-priority)", "Read (high-priority)", |
278 | "Write (high-priority)", | 283 | "Write (low-priority)", "Write (high-priority)", |
279 | "Reserved", "Reserved", | 284 | "Reserved", "Reserved", |
280 | "Flush", "Fence" | 285 | "Flush", "Fence" |
281 | }; | 286 | }; |
282 | #endif /* CONFIG_VERBOSE_MCHECK */ | 287 | #endif /* CONFIG_VERBOSE_MCHECK */ |
283 | 288 | ||
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c index 5d1e6d6ce684..547e8b84b2f7 100644 --- a/arch/alpha/kernel/osf_sys.c +++ b/arch/alpha/kernel/osf_sys.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
16 | #include <linux/mm.h> | 16 | #include <linux/mm.h> |
17 | #include <linux/smp.h> | 17 | #include <linux/smp.h> |
18 | #include <linux/smp_lock.h> | ||
19 | #include <linux/stddef.h> | 18 | #include <linux/stddef.h> |
20 | #include <linux/syscalls.h> | 19 | #include <linux/syscalls.h> |
21 | #include <linux/unistd.h> | 20 | #include <linux/unistd.h> |
@@ -69,7 +68,6 @@ SYSCALL_DEFINE4(osf_set_program_attributes, unsigned long, text_start, | |||
69 | { | 68 | { |
70 | struct mm_struct *mm; | 69 | struct mm_struct *mm; |
71 | 70 | ||
72 | lock_kernel(); | ||
73 | mm = current->mm; | 71 | mm = current->mm; |
74 | mm->end_code = bss_start + bss_len; | 72 | mm->end_code = bss_start + bss_len; |
75 | mm->start_brk = bss_start + bss_len; | 73 | mm->start_brk = bss_start + bss_len; |
@@ -78,7 +76,6 @@ SYSCALL_DEFINE4(osf_set_program_attributes, unsigned long, text_start, | |||
78 | printk("set_program_attributes(%lx %lx %lx %lx)\n", | 76 | printk("set_program_attributes(%lx %lx %lx %lx)\n", |
79 | text_start, text_len, bss_start, bss_len); | 77 | text_start, text_len, bss_start, bss_len); |
80 | #endif | 78 | #endif |
81 | unlock_kernel(); | ||
82 | return 0; | 79 | return 0; |
83 | } | 80 | } |
84 | 81 | ||
@@ -517,7 +514,6 @@ SYSCALL_DEFINE2(osf_proplist_syscall, enum pl_code, code, | |||
517 | long error; | 514 | long error; |
518 | int __user *min_buf_size_ptr; | 515 | int __user *min_buf_size_ptr; |
519 | 516 | ||
520 | lock_kernel(); | ||
521 | switch (code) { | 517 | switch (code) { |
522 | case PL_SET: | 518 | case PL_SET: |
523 | if (get_user(error, &args->set.nbytes)) | 519 | if (get_user(error, &args->set.nbytes)) |
@@ -547,7 +543,6 @@ SYSCALL_DEFINE2(osf_proplist_syscall, enum pl_code, code, | |||
547 | error = -EOPNOTSUPP; | 543 | error = -EOPNOTSUPP; |
548 | break; | 544 | break; |
549 | }; | 545 | }; |
550 | unlock_kernel(); | ||
551 | return error; | 546 | return error; |
552 | } | 547 | } |
553 | 548 | ||
@@ -594,7 +589,7 @@ SYSCALL_DEFINE2(osf_sigstack, struct sigstack __user *, uss, | |||
594 | 589 | ||
595 | SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) | 590 | SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) |
596 | { | 591 | { |
597 | char *sysinfo_table[] = { | 592 | const char *sysinfo_table[] = { |
598 | utsname()->sysname, | 593 | utsname()->sysname, |
599 | utsname()->nodename, | 594 | utsname()->nodename, |
600 | utsname()->release, | 595 | utsname()->release, |
@@ -606,7 +601,7 @@ SYSCALL_DEFINE3(osf_sysinfo, int, command, char __user *, buf, long, count) | |||
606 | "dummy", /* secure RPC domain */ | 601 | "dummy", /* secure RPC domain */ |
607 | }; | 602 | }; |
608 | unsigned long offset; | 603 | unsigned long offset; |
609 | char *res; | 604 | const char *res; |
610 | long len, err = -EINVAL; | 605 | long len, err = -EINVAL; |
611 | 606 | ||
612 | offset = command-1; | 607 | offset = command-1; |
diff --git a/arch/alpha/kernel/pci-sysfs.c b/arch/alpha/kernel/pci-sysfs.c index 738fc824e2ea..b899e95f79fd 100644 --- a/arch/alpha/kernel/pci-sysfs.c +++ b/arch/alpha/kernel/pci-sysfs.c | |||
@@ -66,7 +66,7 @@ static int pci_mmap_resource(struct kobject *kobj, | |||
66 | { | 66 | { |
67 | struct pci_dev *pdev = to_pci_dev(container_of(kobj, | 67 | struct pci_dev *pdev = to_pci_dev(container_of(kobj, |
68 | struct device, kobj)); | 68 | struct device, kobj)); |
69 | struct resource *res = (struct resource *)attr->private; | 69 | struct resource *res = attr->private; |
70 | enum pci_mmap_state mmap_type; | 70 | enum pci_mmap_state mmap_type; |
71 | struct pci_bus_region bar; | 71 | struct pci_bus_region bar; |
72 | int i; | 72 | int i; |
diff --git a/arch/alpha/kernel/signal.c b/arch/alpha/kernel/signal.c index 0932dbb1ef8e..0f6b51ae865a 100644 --- a/arch/alpha/kernel/signal.c +++ b/arch/alpha/kernel/signal.c | |||
@@ -144,8 +144,7 @@ SYSCALL_DEFINE5(rt_sigaction, int, sig, const struct sigaction __user *, act, | |||
144 | /* | 144 | /* |
145 | * Atomically swap in the new signal mask, and wait for a signal. | 145 | * Atomically swap in the new signal mask, and wait for a signal. |
146 | */ | 146 | */ |
147 | asmlinkage int | 147 | SYSCALL_DEFINE1(sigsuspend, old_sigset_t, mask) |
148 | do_sigsuspend(old_sigset_t mask, struct pt_regs *regs, struct switch_stack *sw) | ||
149 | { | 148 | { |
150 | mask &= _BLOCKABLE; | 149 | mask &= _BLOCKABLE; |
151 | spin_lock_irq(¤t->sighand->siglock); | 150 | spin_lock_irq(¤t->sighand->siglock); |
@@ -154,41 +153,6 @@ do_sigsuspend(old_sigset_t mask, struct pt_regs *regs, struct switch_stack *sw) | |||
154 | recalc_sigpending(); | 153 | recalc_sigpending(); |
155 | spin_unlock_irq(¤t->sighand->siglock); | 154 | spin_unlock_irq(¤t->sighand->siglock); |
156 | 155 | ||
157 | /* Indicate EINTR on return from any possible signal handler, | ||
158 | which will not come back through here, but via sigreturn. */ | ||
159 | regs->r0 = EINTR; | ||
160 | regs->r19 = 1; | ||
161 | |||
162 | current->state = TASK_INTERRUPTIBLE; | ||
163 | schedule(); | ||
164 | set_thread_flag(TIF_RESTORE_SIGMASK); | ||
165 | return -ERESTARTNOHAND; | ||
166 | } | ||
167 | |||
168 | asmlinkage int | ||
169 | do_rt_sigsuspend(sigset_t __user *uset, size_t sigsetsize, | ||
170 | struct pt_regs *regs, struct switch_stack *sw) | ||
171 | { | ||
172 | sigset_t set; | ||
173 | |||
174 | /* XXX: Don't preclude handling different sized sigset_t's. */ | ||
175 | if (sigsetsize != sizeof(sigset_t)) | ||
176 | return -EINVAL; | ||
177 | if (copy_from_user(&set, uset, sizeof(set))) | ||
178 | return -EFAULT; | ||
179 | |||
180 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
181 | spin_lock_irq(¤t->sighand->siglock); | ||
182 | current->saved_sigmask = current->blocked; | ||
183 | current->blocked = set; | ||
184 | recalc_sigpending(); | ||
185 | spin_unlock_irq(¤t->sighand->siglock); | ||
186 | |||
187 | /* Indicate EINTR on return from any possible signal handler, | ||
188 | which will not come back through here, but via sigreturn. */ | ||
189 | regs->r0 = EINTR; | ||
190 | regs->r19 = 1; | ||
191 | |||
192 | current->state = TASK_INTERRUPTIBLE; | 156 | current->state = TASK_INTERRUPTIBLE; |
193 | schedule(); | 157 | schedule(); |
194 | set_thread_flag(TIF_RESTORE_SIGMASK); | 158 | set_thread_flag(TIF_RESTORE_SIGMASK); |
@@ -239,6 +203,8 @@ restore_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs, | |||
239 | unsigned long usp; | 203 | unsigned long usp; |
240 | long i, err = __get_user(regs->pc, &sc->sc_pc); | 204 | long i, err = __get_user(regs->pc, &sc->sc_pc); |
241 | 205 | ||
206 | current_thread_info()->restart_block.fn = do_no_restart_syscall; | ||
207 | |||
242 | sw->r26 = (unsigned long) ret_from_sys_call; | 208 | sw->r26 = (unsigned long) ret_from_sys_call; |
243 | 209 | ||
244 | err |= __get_user(regs->r0, sc->sc_regs+0); | 210 | err |= __get_user(regs->r0, sc->sc_regs+0); |
@@ -591,7 +557,6 @@ syscall_restart(unsigned long r0, unsigned long r19, | |||
591 | regs->pc -= 4; | 557 | regs->pc -= 4; |
592 | break; | 558 | break; |
593 | case ERESTART_RESTARTBLOCK: | 559 | case ERESTART_RESTARTBLOCK: |
594 | current_thread_info()->restart_block.fn = do_no_restart_syscall; | ||
595 | regs->r0 = EINTR; | 560 | regs->r0 = EINTR; |
596 | break; | 561 | break; |
597 | } | 562 | } |
diff --git a/arch/alpha/kernel/srm_env.c b/arch/alpha/kernel/srm_env.c index 4afc1a1e2e5a..f0df3fbd8402 100644 --- a/arch/alpha/kernel/srm_env.c +++ b/arch/alpha/kernel/srm_env.c | |||
@@ -87,7 +87,7 @@ static int srm_env_proc_show(struct seq_file *m, void *v) | |||
87 | srm_env_t *entry; | 87 | srm_env_t *entry; |
88 | char *page; | 88 | char *page; |
89 | 89 | ||
90 | entry = (srm_env_t *)m->private; | 90 | entry = m->private; |
91 | page = (char *)__get_free_page(GFP_USER); | 91 | page = (char *)__get_free_page(GFP_USER); |
92 | if (!page) | 92 | if (!page) |
93 | return -ENOMEM; | 93 | return -ENOMEM; |
diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S index 09acb786e72b..ce594ef533cc 100644 --- a/arch/alpha/kernel/systbls.S +++ b/arch/alpha/kernel/systbls.S | |||
@@ -512,6 +512,9 @@ sys_call_table: | |||
512 | .quad sys_pwritev | 512 | .quad sys_pwritev |
513 | .quad sys_rt_tgsigqueueinfo | 513 | .quad sys_rt_tgsigqueueinfo |
514 | .quad sys_perf_event_open | 514 | .quad sys_perf_event_open |
515 | .quad sys_fanotify_init | ||
516 | .quad sys_fanotify_mark /* 495 */ | ||
517 | .quad sys_prlimit64 | ||
515 | 518 | ||
516 | .size sys_call_table, . - sys_call_table | 519 | .size sys_call_table, . - sys_call_table |
517 | .type sys_call_table, @object | 520 | .type sys_call_table, @object |
diff --git a/arch/alpha/kernel/time.c b/arch/alpha/kernel/time.c index eacceb26d9c8..396af1799ea4 100644 --- a/arch/alpha/kernel/time.c +++ b/arch/alpha/kernel/time.c | |||
@@ -191,16 +191,16 @@ irqreturn_t timer_interrupt(int irq, void *dev) | |||
191 | 191 | ||
192 | write_sequnlock(&xtime_lock); | 192 | write_sequnlock(&xtime_lock); |
193 | 193 | ||
194 | #ifndef CONFIG_SMP | ||
195 | while (nticks--) | ||
196 | update_process_times(user_mode(get_irq_regs())); | ||
197 | #endif | ||
198 | |||
199 | if (test_perf_event_pending()) { | 194 | if (test_perf_event_pending()) { |
200 | clear_perf_event_pending(); | 195 | clear_perf_event_pending(); |
201 | perf_event_do_pending(); | 196 | perf_event_do_pending(); |
202 | } | 197 | } |
203 | 198 | ||
199 | #ifndef CONFIG_SMP | ||
200 | while (nticks--) | ||
201 | update_process_times(user_mode(get_irq_regs())); | ||
202 | #endif | ||
203 | |||
204 | return IRQ_HANDLED; | 204 | return IRQ_HANDLED; |
205 | } | 205 | } |
206 | 206 | ||
diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c index b14f015008ad..0414e021a91c 100644 --- a/arch/alpha/kernel/traps.c +++ b/arch/alpha/kernel/traps.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <linux/sched.h> | 13 | #include <linux/sched.h> |
14 | #include <linux/tty.h> | 14 | #include <linux/tty.h> |
15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
16 | #include <linux/smp_lock.h> | ||
17 | #include <linux/module.h> | 16 | #include <linux/module.h> |
18 | #include <linux/init.h> | 17 | #include <linux/init.h> |
19 | #include <linux/kallsyms.h> | 18 | #include <linux/kallsyms.h> |
@@ -623,7 +622,6 @@ do_entUna(void * va, unsigned long opcode, unsigned long reg, | |||
623 | return; | 622 | return; |
624 | } | 623 | } |
625 | 624 | ||
626 | lock_kernel(); | ||
627 | printk("Bad unaligned kernel access at %016lx: %p %lx %lu\n", | 625 | printk("Bad unaligned kernel access at %016lx: %p %lx %lu\n", |
628 | pc, va, opcode, reg); | 626 | pc, va, opcode, reg); |
629 | do_exit(SIGSEGV); | 627 | do_exit(SIGSEGV); |
@@ -646,7 +644,6 @@ got_exception: | |||
646 | * Yikes! No one to forward the exception to. | 644 | * Yikes! No one to forward the exception to. |
647 | * Since the registers are in a weird format, dump them ourselves. | 645 | * Since the registers are in a weird format, dump them ourselves. |
648 | */ | 646 | */ |
649 | lock_kernel(); | ||
650 | 647 | ||
651 | printk("%s(%d): unhandled unaligned exception\n", | 648 | printk("%s(%d): unhandled unaligned exception\n", |
652 | current->comm, task_pid_nr(current)); | 649 | current->comm, task_pid_nr(current)); |
diff --git a/arch/arm/common/it8152.c b/arch/arm/common/it8152.c index 7974baacafce..1bec96e85196 100644 --- a/arch/arm/common/it8152.c +++ b/arch/arm/common/it8152.c | |||
@@ -271,6 +271,14 @@ int dma_needs_bounce(struct device *dev, dma_addr_t dma_addr, size_t size) | |||
271 | ((dma_addr + size - PHYS_OFFSET) >= SZ_64M); | 271 | ((dma_addr + size - PHYS_OFFSET) >= SZ_64M); |
272 | } | 272 | } |
273 | 273 | ||
274 | int dma_set_coherent_mask(struct device *dev, u64 mask) | ||
275 | { | ||
276 | if (mask >= PHYS_OFFSET + SZ_64M - 1) | ||
277 | return 0; | ||
278 | |||
279 | return -EIO; | ||
280 | } | ||
281 | |||
274 | int __init it8152_pci_setup(int nr, struct pci_sys_data *sys) | 282 | int __init it8152_pci_setup(int nr, struct pci_sys_data *sys) |
275 | { | 283 | { |
276 | it8152_io.start = IT8152_IO_BASE + 0x12000; | 284 | it8152_io.start = IT8152_IO_BASE + 0x12000; |
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S index f05a35a59694..1b560825e1cf 100644 --- a/arch/arm/kernel/entry-common.S +++ b/arch/arm/kernel/entry-common.S | |||
@@ -418,11 +418,13 @@ ENDPROC(sys_clone_wrapper) | |||
418 | 418 | ||
419 | sys_sigreturn_wrapper: | 419 | sys_sigreturn_wrapper: |
420 | add r0, sp, #S_OFF | 420 | add r0, sp, #S_OFF |
421 | mov why, #0 @ prevent syscall restart handling | ||
421 | b sys_sigreturn | 422 | b sys_sigreturn |
422 | ENDPROC(sys_sigreturn_wrapper) | 423 | ENDPROC(sys_sigreturn_wrapper) |
423 | 424 | ||
424 | sys_rt_sigreturn_wrapper: | 425 | sys_rt_sigreturn_wrapper: |
425 | add r0, sp, #S_OFF | 426 | add r0, sp, #S_OFF |
427 | mov why, #0 @ prevent syscall restart handling | ||
426 | b sys_rt_sigreturn | 428 | b sys_rt_sigreturn |
427 | ENDPROC(sys_rt_sigreturn_wrapper) | 429 | ENDPROC(sys_rt_sigreturn_wrapper) |
428 | 430 | ||
diff --git a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c index 61cd4d64b985..24498a932ba6 100644 --- a/arch/arm/mach-ixp4xx/common-pci.c +++ b/arch/arm/mach-ixp4xx/common-pci.c | |||
@@ -503,6 +503,14 @@ struct pci_bus * __devinit ixp4xx_scan_bus(int nr, struct pci_sys_data *sys) | |||
503 | return pci_scan_bus(sys->busnr, &ixp4xx_ops, sys); | 503 | return pci_scan_bus(sys->busnr, &ixp4xx_ops, sys); |
504 | } | 504 | } |
505 | 505 | ||
506 | int dma_set_coherent_mask(struct device *dev, u64 mask) | ||
507 | { | ||
508 | if (mask >= SZ_64M - 1) | ||
509 | return 0; | ||
510 | |||
511 | return -EIO; | ||
512 | } | ||
513 | |||
506 | EXPORT_SYMBOL(ixp4xx_pci_read); | 514 | EXPORT_SYMBOL(ixp4xx_pci_read); |
507 | EXPORT_SYMBOL(ixp4xx_pci_write); | 515 | EXPORT_SYMBOL(ixp4xx_pci_write); |
508 | 516 | ||
diff --git a/arch/arm/mach-ixp4xx/include/mach/hardware.h b/arch/arm/mach-ixp4xx/include/mach/hardware.h index f91ca6d4fbe8..8138371c406e 100644 --- a/arch/arm/mach-ixp4xx/include/mach/hardware.h +++ b/arch/arm/mach-ixp4xx/include/mach/hardware.h | |||
@@ -26,6 +26,8 @@ | |||
26 | #define PCIBIOS_MAX_MEM 0x4BFFFFFF | 26 | #define PCIBIOS_MAX_MEM 0x4BFFFFFF |
27 | #endif | 27 | #endif |
28 | 28 | ||
29 | #define ARCH_HAS_DMA_SET_COHERENT_MASK | ||
30 | |||
29 | #define pcibios_assign_all_busses() 1 | 31 | #define pcibios_assign_all_busses() 1 |
30 | 32 | ||
31 | /* Register locations and bits */ | 33 | /* Register locations and bits */ |
diff --git a/arch/arm/mach-pxa/include/mach/hardware.h b/arch/arm/mach-pxa/include/mach/hardware.h index 7f64d24cd564..428cc7bda9a4 100644 --- a/arch/arm/mach-pxa/include/mach/hardware.h +++ b/arch/arm/mach-pxa/include/mach/hardware.h | |||
@@ -309,7 +309,7 @@ extern unsigned long get_clock_tick_rate(void); | |||
309 | #define PCIBIOS_MIN_IO 0 | 309 | #define PCIBIOS_MIN_IO 0 |
310 | #define PCIBIOS_MIN_MEM 0 | 310 | #define PCIBIOS_MIN_MEM 0 |
311 | #define pcibios_assign_all_busses() 1 | 311 | #define pcibios_assign_all_busses() 1 |
312 | #define ARCH_HAS_DMA_SET_COHERENT_MASK | ||
312 | #endif | 313 | #endif |
313 | 314 | ||
314 | |||
315 | #endif /* _ASM_ARCH_HARDWARE_H */ | 315 | #endif /* _ASM_ARCH_HARDWARE_H */ |
diff --git a/arch/arm/mach-pxa/include/mach/io.h b/arch/arm/mach-pxa/include/mach/io.h index 262691fb97d8..fdca3be47d9b 100644 --- a/arch/arm/mach-pxa/include/mach/io.h +++ b/arch/arm/mach-pxa/include/mach/io.h | |||
@@ -6,6 +6,8 @@ | |||
6 | #ifndef __ASM_ARM_ARCH_IO_H | 6 | #ifndef __ASM_ARM_ARCH_IO_H |
7 | #define __ASM_ARM_ARCH_IO_H | 7 | #define __ASM_ARM_ARCH_IO_H |
8 | 8 | ||
9 | #include <mach/hardware.h> | ||
10 | |||
9 | #define IO_SPACE_LIMIT 0xffffffff | 11 | #define IO_SPACE_LIMIT 0xffffffff |
10 | 12 | ||
11 | /* | 13 | /* |
diff --git a/arch/arm/mach-s3c64xx/dev-spi.c b/arch/arm/mach-s3c64xx/dev-spi.c index a492b982aa06..405e62128917 100644 --- a/arch/arm/mach-s3c64xx/dev-spi.c +++ b/arch/arm/mach-s3c64xx/dev-spi.c | |||
@@ -18,10 +18,11 @@ | |||
18 | #include <mach/map.h> | 18 | #include <mach/map.h> |
19 | #include <mach/gpio-bank-c.h> | 19 | #include <mach/gpio-bank-c.h> |
20 | #include <mach/spi-clocks.h> | 20 | #include <mach/spi-clocks.h> |
21 | #include <mach/irqs.h> | ||
21 | 22 | ||
22 | #include <plat/s3c64xx-spi.h> | 23 | #include <plat/s3c64xx-spi.h> |
23 | #include <plat/gpio-cfg.h> | 24 | #include <plat/gpio-cfg.h> |
24 | #include <plat/irqs.h> | 25 | #include <plat/devs.h> |
25 | 26 | ||
26 | static char *spi_src_clks[] = { | 27 | static char *spi_src_clks[] = { |
27 | [S3C64XX_SPI_SRCCLK_PCLK] = "pclk", | 28 | [S3C64XX_SPI_SRCCLK_PCLK] = "pclk", |
diff --git a/arch/arm/mach-s3c64xx/mach-real6410.c b/arch/arm/mach-s3c64xx/mach-real6410.c index 5c07d013b23d..e130379ba0e8 100644 --- a/arch/arm/mach-s3c64xx/mach-real6410.c +++ b/arch/arm/mach-s3c64xx/mach-real6410.c | |||
@@ -30,73 +30,73 @@ | |||
30 | #include <plat/devs.h> | 30 | #include <plat/devs.h> |
31 | #include <plat/regs-serial.h> | 31 | #include <plat/regs-serial.h> |
32 | 32 | ||
33 | #define UCON S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK | 33 | #define UCON (S3C2410_UCON_DEFAULT | S3C2410_UCON_UCLK) |
34 | #define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB | 34 | #define ULCON (S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB) |
35 | #define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE | 35 | #define UFCON (S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE) |
36 | 36 | ||
37 | static struct s3c2410_uartcfg real6410_uartcfgs[] __initdata = { | 37 | static struct s3c2410_uartcfg real6410_uartcfgs[] __initdata = { |
38 | [0] = { | 38 | [0] = { |
39 | .hwport = 0, | 39 | .hwport = 0, |
40 | .flags = 0, | 40 | .flags = 0, |
41 | .ucon = UCON, | 41 | .ucon = UCON, |
42 | .ulcon = ULCON, | 42 | .ulcon = ULCON, |
43 | .ufcon = UFCON, | 43 | .ufcon = UFCON, |
44 | }, | 44 | }, |
45 | [1] = { | 45 | [1] = { |
46 | .hwport = 1, | 46 | .hwport = 1, |
47 | .flags = 0, | 47 | .flags = 0, |
48 | .ucon = UCON, | 48 | .ucon = UCON, |
49 | .ulcon = ULCON, | 49 | .ulcon = ULCON, |
50 | .ufcon = UFCON, | 50 | .ufcon = UFCON, |
51 | }, | 51 | }, |
52 | [2] = { | 52 | [2] = { |
53 | .hwport = 2, | 53 | .hwport = 2, |
54 | .flags = 0, | 54 | .flags = 0, |
55 | .ucon = UCON, | 55 | .ucon = UCON, |
56 | .ulcon = ULCON, | 56 | .ulcon = ULCON, |
57 | .ufcon = UFCON, | 57 | .ufcon = UFCON, |
58 | }, | 58 | }, |
59 | [3] = { | 59 | [3] = { |
60 | .hwport = 3, | 60 | .hwport = 3, |
61 | .flags = 0, | 61 | .flags = 0, |
62 | .ucon = UCON, | 62 | .ucon = UCON, |
63 | .ulcon = ULCON, | 63 | .ulcon = ULCON, |
64 | .ufcon = UFCON, | 64 | .ufcon = UFCON, |
65 | }, | 65 | }, |
66 | }; | 66 | }; |
67 | 67 | ||
68 | /* DM9000AEP 10/100 ethernet controller */ | 68 | /* DM9000AEP 10/100 ethernet controller */ |
69 | 69 | ||
70 | static struct resource real6410_dm9k_resource[] = { | 70 | static struct resource real6410_dm9k_resource[] = { |
71 | [0] = { | 71 | [0] = { |
72 | .start = S3C64XX_PA_XM0CSN1, | 72 | .start = S3C64XX_PA_XM0CSN1, |
73 | .end = S3C64XX_PA_XM0CSN1 + 1, | 73 | .end = S3C64XX_PA_XM0CSN1 + 1, |
74 | .flags = IORESOURCE_MEM | 74 | .flags = IORESOURCE_MEM |
75 | }, | 75 | }, |
76 | [1] = { | 76 | [1] = { |
77 | .start = S3C64XX_PA_XM0CSN1 + 4, | 77 | .start = S3C64XX_PA_XM0CSN1 + 4, |
78 | .end = S3C64XX_PA_XM0CSN1 + 5, | 78 | .end = S3C64XX_PA_XM0CSN1 + 5, |
79 | .flags = IORESOURCE_MEM | 79 | .flags = IORESOURCE_MEM |
80 | }, | 80 | }, |
81 | [2] = { | 81 | [2] = { |
82 | .start = S3C_EINT(7), | 82 | .start = S3C_EINT(7), |
83 | .end = S3C_EINT(7), | 83 | .end = S3C_EINT(7), |
84 | .flags = IORESOURCE_IRQ, | 84 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHLEVEL |
85 | } | 85 | } |
86 | }; | 86 | }; |
87 | 87 | ||
88 | static struct dm9000_plat_data real6410_dm9k_pdata = { | 88 | static struct dm9000_plat_data real6410_dm9k_pdata = { |
89 | .flags = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM), | 89 | .flags = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM), |
90 | }; | 90 | }; |
91 | 91 | ||
92 | static struct platform_device real6410_device_eth = { | 92 | static struct platform_device real6410_device_eth = { |
93 | .name = "dm9000", | 93 | .name = "dm9000", |
94 | .id = -1, | 94 | .id = -1, |
95 | .num_resources = ARRAY_SIZE(real6410_dm9k_resource), | 95 | .num_resources = ARRAY_SIZE(real6410_dm9k_resource), |
96 | .resource = real6410_dm9k_resource, | 96 | .resource = real6410_dm9k_resource, |
97 | .dev = { | 97 | .dev = { |
98 | .platform_data = &real6410_dm9k_pdata, | 98 | .platform_data = &real6410_dm9k_pdata, |
99 | }, | 99 | }, |
100 | }; | 100 | }; |
101 | 101 | ||
102 | static struct platform_device *real6410_devices[] __initdata = { | 102 | static struct platform_device *real6410_devices[] __initdata = { |
@@ -129,12 +129,12 @@ static void __init real6410_machine_init(void) | |||
129 | /* set timing for nCS1 suitable for ethernet chip */ | 129 | /* set timing for nCS1 suitable for ethernet chip */ |
130 | 130 | ||
131 | __raw_writel((0 << S3C64XX_SROM_BCX__PMC__SHIFT) | | 131 | __raw_writel((0 << S3C64XX_SROM_BCX__PMC__SHIFT) | |
132 | (6 << S3C64XX_SROM_BCX__TACP__SHIFT) | | 132 | (6 << S3C64XX_SROM_BCX__TACP__SHIFT) | |
133 | (4 << S3C64XX_SROM_BCX__TCAH__SHIFT) | | 133 | (4 << S3C64XX_SROM_BCX__TCAH__SHIFT) | |
134 | (1 << S3C64XX_SROM_BCX__TCOH__SHIFT) | | 134 | (1 << S3C64XX_SROM_BCX__TCOH__SHIFT) | |
135 | (13 << S3C64XX_SROM_BCX__TACC__SHIFT) | | 135 | (13 << S3C64XX_SROM_BCX__TACC__SHIFT) | |
136 | (4 << S3C64XX_SROM_BCX__TCOS__SHIFT) | | 136 | (4 << S3C64XX_SROM_BCX__TCOS__SHIFT) | |
137 | (0 << S3C64XX_SROM_BCX__TACS__SHIFT), S3C64XX_SROM_BC1); | 137 | (0 << S3C64XX_SROM_BCX__TACS__SHIFT), S3C64XX_SROM_BC1); |
138 | 138 | ||
139 | platform_add_devices(real6410_devices, ARRAY_SIZE(real6410_devices)); | 139 | platform_add_devices(real6410_devices, ARRAY_SIZE(real6410_devices)); |
140 | } | 140 | } |
diff --git a/arch/arm/mach-s5pv210/clock.c b/arch/arm/mach-s5pv210/clock.c index af91fefef2c6..cfecd70657cb 100644 --- a/arch/arm/mach-s5pv210/clock.c +++ b/arch/arm/mach-s5pv210/clock.c | |||
@@ -281,6 +281,24 @@ static struct clk init_clocks_disable[] = { | |||
281 | .enable = s5pv210_clk_ip0_ctrl, | 281 | .enable = s5pv210_clk_ip0_ctrl, |
282 | .ctrlbit = (1<<29), | 282 | .ctrlbit = (1<<29), |
283 | }, { | 283 | }, { |
284 | .name = "fimc", | ||
285 | .id = 0, | ||
286 | .parent = &clk_hclk_dsys.clk, | ||
287 | .enable = s5pv210_clk_ip0_ctrl, | ||
288 | .ctrlbit = (1 << 24), | ||
289 | }, { | ||
290 | .name = "fimc", | ||
291 | .id = 1, | ||
292 | .parent = &clk_hclk_dsys.clk, | ||
293 | .enable = s5pv210_clk_ip0_ctrl, | ||
294 | .ctrlbit = (1 << 25), | ||
295 | }, { | ||
296 | .name = "fimc", | ||
297 | .id = 2, | ||
298 | .parent = &clk_hclk_dsys.clk, | ||
299 | .enable = s5pv210_clk_ip0_ctrl, | ||
300 | .ctrlbit = (1 << 26), | ||
301 | }, { | ||
284 | .name = "otg", | 302 | .name = "otg", |
285 | .id = -1, | 303 | .id = -1, |
286 | .parent = &clk_hclk_psys.clk, | 304 | .parent = &clk_hclk_psys.clk, |
@@ -357,7 +375,7 @@ static struct clk init_clocks_disable[] = { | |||
357 | .id = 1, | 375 | .id = 1, |
358 | .parent = &clk_pclk_psys.clk, | 376 | .parent = &clk_pclk_psys.clk, |
359 | .enable = s5pv210_clk_ip3_ctrl, | 377 | .enable = s5pv210_clk_ip3_ctrl, |
360 | .ctrlbit = (1<<8), | 378 | .ctrlbit = (1 << 10), |
361 | }, { | 379 | }, { |
362 | .name = "i2c", | 380 | .name = "i2c", |
363 | .id = 2, | 381 | .id = 2, |
diff --git a/arch/arm/mach-s5pv210/cpu.c b/arch/arm/mach-s5pv210/cpu.c index b9f4d677cf55..77f456c91ad3 100644 --- a/arch/arm/mach-s5pv210/cpu.c +++ b/arch/arm/mach-s5pv210/cpu.c | |||
@@ -47,7 +47,7 @@ static struct map_desc s5pv210_iodesc[] __initdata = { | |||
47 | { | 47 | { |
48 | .virtual = (unsigned long)S5P_VA_SYSTIMER, | 48 | .virtual = (unsigned long)S5P_VA_SYSTIMER, |
49 | .pfn = __phys_to_pfn(S5PV210_PA_SYSTIMER), | 49 | .pfn = __phys_to_pfn(S5PV210_PA_SYSTIMER), |
50 | .length = SZ_1M, | 50 | .length = SZ_4K, |
51 | .type = MT_DEVICE, | 51 | .type = MT_DEVICE, |
52 | }, { | 52 | }, { |
53 | .virtual = (unsigned long)VA_VIC2, | 53 | .virtual = (unsigned long)VA_VIC2, |
diff --git a/arch/arm/plat-s5p/dev-fimc0.c b/arch/arm/plat-s5p/dev-fimc0.c index d3f1a9b5d2b5..608770fc1531 100644 --- a/arch/arm/plat-s5p/dev-fimc0.c +++ b/arch/arm/plat-s5p/dev-fimc0.c | |||
@@ -10,6 +10,7 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/dma-mapping.h> | ||
13 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
14 | #include <linux/interrupt.h> | 15 | #include <linux/interrupt.h> |
15 | #include <linux/ioport.h> | 16 | #include <linux/ioport.h> |
@@ -18,7 +19,7 @@ | |||
18 | static struct resource s5p_fimc0_resource[] = { | 19 | static struct resource s5p_fimc0_resource[] = { |
19 | [0] = { | 20 | [0] = { |
20 | .start = S5P_PA_FIMC0, | 21 | .start = S5P_PA_FIMC0, |
21 | .end = S5P_PA_FIMC0 + SZ_1M - 1, | 22 | .end = S5P_PA_FIMC0 + SZ_4K - 1, |
22 | .flags = IORESOURCE_MEM, | 23 | .flags = IORESOURCE_MEM, |
23 | }, | 24 | }, |
24 | [1] = { | 25 | [1] = { |
@@ -28,9 +29,15 @@ static struct resource s5p_fimc0_resource[] = { | |||
28 | }, | 29 | }, |
29 | }; | 30 | }; |
30 | 31 | ||
32 | static u64 s5p_fimc0_dma_mask = DMA_BIT_MASK(32); | ||
33 | |||
31 | struct platform_device s5p_device_fimc0 = { | 34 | struct platform_device s5p_device_fimc0 = { |
32 | .name = "s5p-fimc", | 35 | .name = "s5p-fimc", |
33 | .id = 0, | 36 | .id = 0, |
34 | .num_resources = ARRAY_SIZE(s5p_fimc0_resource), | 37 | .num_resources = ARRAY_SIZE(s5p_fimc0_resource), |
35 | .resource = s5p_fimc0_resource, | 38 | .resource = s5p_fimc0_resource, |
39 | .dev = { | ||
40 | .dma_mask = &s5p_fimc0_dma_mask, | ||
41 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
42 | }, | ||
36 | }; | 43 | }; |
diff --git a/arch/arm/plat-s5p/dev-fimc1.c b/arch/arm/plat-s5p/dev-fimc1.c index 41bd6986d0ad..76e3a97a87d3 100644 --- a/arch/arm/plat-s5p/dev-fimc1.c +++ b/arch/arm/plat-s5p/dev-fimc1.c | |||
@@ -10,6 +10,7 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/dma-mapping.h> | ||
13 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
14 | #include <linux/interrupt.h> | 15 | #include <linux/interrupt.h> |
15 | #include <linux/ioport.h> | 16 | #include <linux/ioport.h> |
@@ -18,7 +19,7 @@ | |||
18 | static struct resource s5p_fimc1_resource[] = { | 19 | static struct resource s5p_fimc1_resource[] = { |
19 | [0] = { | 20 | [0] = { |
20 | .start = S5P_PA_FIMC1, | 21 | .start = S5P_PA_FIMC1, |
21 | .end = S5P_PA_FIMC1 + SZ_1M - 1, | 22 | .end = S5P_PA_FIMC1 + SZ_4K - 1, |
22 | .flags = IORESOURCE_MEM, | 23 | .flags = IORESOURCE_MEM, |
23 | }, | 24 | }, |
24 | [1] = { | 25 | [1] = { |
@@ -28,9 +29,15 @@ static struct resource s5p_fimc1_resource[] = { | |||
28 | }, | 29 | }, |
29 | }; | 30 | }; |
30 | 31 | ||
32 | static u64 s5p_fimc1_dma_mask = DMA_BIT_MASK(32); | ||
33 | |||
31 | struct platform_device s5p_device_fimc1 = { | 34 | struct platform_device s5p_device_fimc1 = { |
32 | .name = "s5p-fimc", | 35 | .name = "s5p-fimc", |
33 | .id = 1, | 36 | .id = 1, |
34 | .num_resources = ARRAY_SIZE(s5p_fimc1_resource), | 37 | .num_resources = ARRAY_SIZE(s5p_fimc1_resource), |
35 | .resource = s5p_fimc1_resource, | 38 | .resource = s5p_fimc1_resource, |
39 | .dev = { | ||
40 | .dma_mask = &s5p_fimc1_dma_mask, | ||
41 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
42 | }, | ||
36 | }; | 43 | }; |
diff --git a/arch/arm/plat-s5p/dev-fimc2.c b/arch/arm/plat-s5p/dev-fimc2.c index dfddeda6d4a3..24d29816fa2c 100644 --- a/arch/arm/plat-s5p/dev-fimc2.c +++ b/arch/arm/plat-s5p/dev-fimc2.c | |||
@@ -10,6 +10,7 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/dma-mapping.h> | ||
13 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
14 | #include <linux/interrupt.h> | 15 | #include <linux/interrupt.h> |
15 | #include <linux/ioport.h> | 16 | #include <linux/ioport.h> |
@@ -18,7 +19,7 @@ | |||
18 | static struct resource s5p_fimc2_resource[] = { | 19 | static struct resource s5p_fimc2_resource[] = { |
19 | [0] = { | 20 | [0] = { |
20 | .start = S5P_PA_FIMC2, | 21 | .start = S5P_PA_FIMC2, |
21 | .end = S5P_PA_FIMC2 + SZ_1M - 1, | 22 | .end = S5P_PA_FIMC2 + SZ_4K - 1, |
22 | .flags = IORESOURCE_MEM, | 23 | .flags = IORESOURCE_MEM, |
23 | }, | 24 | }, |
24 | [1] = { | 25 | [1] = { |
@@ -28,9 +29,15 @@ static struct resource s5p_fimc2_resource[] = { | |||
28 | }, | 29 | }, |
29 | }; | 30 | }; |
30 | 31 | ||
32 | static u64 s5p_fimc2_dma_mask = DMA_BIT_MASK(32); | ||
33 | |||
31 | struct platform_device s5p_device_fimc2 = { | 34 | struct platform_device s5p_device_fimc2 = { |
32 | .name = "s5p-fimc", | 35 | .name = "s5p-fimc", |
33 | .id = 2, | 36 | .id = 2, |
34 | .num_resources = ARRAY_SIZE(s5p_fimc2_resource), | 37 | .num_resources = ARRAY_SIZE(s5p_fimc2_resource), |
35 | .resource = s5p_fimc2_resource, | 38 | .resource = s5p_fimc2_resource, |
39 | .dev = { | ||
40 | .dma_mask = &s5p_fimc2_dma_mask, | ||
41 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
42 | }, | ||
36 | }; | 43 | }; |
diff --git a/arch/arm/plat-samsung/gpio-config.c b/arch/arm/plat-samsung/gpio-config.c index 57b68a50f45e..e3d41eaed1ff 100644 --- a/arch/arm/plat-samsung/gpio-config.c +++ b/arch/arm/plat-samsung/gpio-config.c | |||
@@ -273,13 +273,13 @@ s5p_gpio_drvstr_t s5p_gpio_get_drvstr(unsigned int pin) | |||
273 | if (!chip) | 273 | if (!chip) |
274 | return -EINVAL; | 274 | return -EINVAL; |
275 | 275 | ||
276 | off = chip->chip.base - pin; | 276 | off = pin - chip->chip.base; |
277 | shift = off * 2; | 277 | shift = off * 2; |
278 | reg = chip->base + 0x0C; | 278 | reg = chip->base + 0x0C; |
279 | 279 | ||
280 | drvstr = __raw_readl(reg); | 280 | drvstr = __raw_readl(reg); |
281 | drvstr = 0xffff & (0x3 << shift); | ||
282 | drvstr = drvstr >> shift; | 281 | drvstr = drvstr >> shift; |
282 | drvstr &= 0x3; | ||
283 | 283 | ||
284 | return (__force s5p_gpio_drvstr_t)drvstr; | 284 | return (__force s5p_gpio_drvstr_t)drvstr; |
285 | } | 285 | } |
@@ -296,11 +296,12 @@ int s5p_gpio_set_drvstr(unsigned int pin, s5p_gpio_drvstr_t drvstr) | |||
296 | if (!chip) | 296 | if (!chip) |
297 | return -EINVAL; | 297 | return -EINVAL; |
298 | 298 | ||
299 | off = chip->chip.base - pin; | 299 | off = pin - chip->chip.base; |
300 | shift = off * 2; | 300 | shift = off * 2; |
301 | reg = chip->base + 0x0C; | 301 | reg = chip->base + 0x0C; |
302 | 302 | ||
303 | tmp = __raw_readl(reg); | 303 | tmp = __raw_readl(reg); |
304 | tmp &= ~(0x3 << shift); | ||
304 | tmp |= drvstr << shift; | 305 | tmp |= drvstr << shift; |
305 | 306 | ||
306 | __raw_writel(tmp, reg); | 307 | __raw_writel(tmp, reg); |
diff --git a/arch/arm/plat-samsung/include/plat/gpio-cfg.h b/arch/arm/plat-samsung/include/plat/gpio-cfg.h index db4112c6f2be..1c6b92947c5d 100644 --- a/arch/arm/plat-samsung/include/plat/gpio-cfg.h +++ b/arch/arm/plat-samsung/include/plat/gpio-cfg.h | |||
@@ -143,12 +143,12 @@ extern s3c_gpio_pull_t s3c_gpio_getpull(unsigned int pin); | |||
143 | /* Define values for the drvstr available for each gpio pin. | 143 | /* Define values for the drvstr available for each gpio pin. |
144 | * | 144 | * |
145 | * These values control the value of the output signal driver strength, | 145 | * These values control the value of the output signal driver strength, |
146 | * configurable on most pins on the S5C series. | 146 | * configurable on most pins on the S5P series. |
147 | */ | 147 | */ |
148 | #define S5P_GPIO_DRVSTR_LV1 ((__force s5p_gpio_drvstr_t)0x00) | 148 | #define S5P_GPIO_DRVSTR_LV1 ((__force s5p_gpio_drvstr_t)0x0) |
149 | #define S5P_GPIO_DRVSTR_LV2 ((__force s5p_gpio_drvstr_t)0x01) | 149 | #define S5P_GPIO_DRVSTR_LV2 ((__force s5p_gpio_drvstr_t)0x2) |
150 | #define S5P_GPIO_DRVSTR_LV3 ((__force s5p_gpio_drvstr_t)0x10) | 150 | #define S5P_GPIO_DRVSTR_LV3 ((__force s5p_gpio_drvstr_t)0x1) |
151 | #define S5P_GPIO_DRVSTR_LV4 ((__force s5p_gpio_drvstr_t)0x11) | 151 | #define S5P_GPIO_DRVSTR_LV4 ((__force s5p_gpio_drvstr_t)0x3) |
152 | 152 | ||
153 | /** | 153 | /** |
154 | * s5c_gpio_get_drvstr() - get the driver streght value of a gpio pin | 154 | * s5c_gpio_get_drvstr() - get the driver streght value of a gpio pin |
diff --git a/arch/frv/kernel/signal.c b/arch/frv/kernel/signal.c index 0974c0ecc594..bab01298b58e 100644 --- a/arch/frv/kernel/signal.c +++ b/arch/frv/kernel/signal.c | |||
@@ -121,6 +121,9 @@ static int restore_sigcontext(struct sigcontext __user *sc, int *_gr8) | |||
121 | struct user_context *user = current->thread.user; | 121 | struct user_context *user = current->thread.user; |
122 | unsigned long tbr, psr; | 122 | unsigned long tbr, psr; |
123 | 123 | ||
124 | /* Always make any pending restarted system calls return -EINTR */ | ||
125 | current_thread_info()->restart_block.fn = do_no_restart_syscall; | ||
126 | |||
124 | tbr = user->i.tbr; | 127 | tbr = user->i.tbr; |
125 | psr = user->i.psr; | 128 | psr = user->i.psr; |
126 | if (copy_from_user(user, &sc->sc_context, sizeof(sc->sc_context))) | 129 | if (copy_from_user(user, &sc->sc_context, sizeof(sc->sc_context))) |
@@ -250,6 +253,8 @@ static int setup_frame(int sig, struct k_sigaction *ka, sigset_t *set) | |||
250 | struct sigframe __user *frame; | 253 | struct sigframe __user *frame; |
251 | int rsig; | 254 | int rsig; |
252 | 255 | ||
256 | set_fs(USER_DS); | ||
257 | |||
253 | frame = get_sigframe(ka, sizeof(*frame)); | 258 | frame = get_sigframe(ka, sizeof(*frame)); |
254 | 259 | ||
255 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) | 260 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) |
@@ -293,22 +298,23 @@ static int setup_frame(int sig, struct k_sigaction *ka, sigset_t *set) | |||
293 | (unsigned long) (frame->retcode + 2)); | 298 | (unsigned long) (frame->retcode + 2)); |
294 | } | 299 | } |
295 | 300 | ||
296 | /* set up registers for signal handler */ | 301 | /* Set up registers for the signal handler */ |
297 | __frame->sp = (unsigned long) frame; | ||
298 | __frame->lr = (unsigned long) &frame->retcode; | ||
299 | __frame->gr8 = sig; | ||
300 | |||
301 | if (current->personality & FDPIC_FUNCPTRS) { | 302 | if (current->personality & FDPIC_FUNCPTRS) { |
302 | struct fdpic_func_descriptor __user *funcptr = | 303 | struct fdpic_func_descriptor __user *funcptr = |
303 | (struct fdpic_func_descriptor __user *) ka->sa.sa_handler; | 304 | (struct fdpic_func_descriptor __user *) ka->sa.sa_handler; |
304 | __get_user(__frame->pc, &funcptr->text); | 305 | struct fdpic_func_descriptor desc; |
305 | __get_user(__frame->gr15, &funcptr->GOT); | 306 | if (copy_from_user(&desc, funcptr, sizeof(desc))) |
307 | goto give_sigsegv; | ||
308 | __frame->pc = desc.text; | ||
309 | __frame->gr15 = desc.GOT; | ||
306 | } else { | 310 | } else { |
307 | __frame->pc = (unsigned long) ka->sa.sa_handler; | 311 | __frame->pc = (unsigned long) ka->sa.sa_handler; |
308 | __frame->gr15 = 0; | 312 | __frame->gr15 = 0; |
309 | } | 313 | } |
310 | 314 | ||
311 | set_fs(USER_DS); | 315 | __frame->sp = (unsigned long) frame; |
316 | __frame->lr = (unsigned long) &frame->retcode; | ||
317 | __frame->gr8 = sig; | ||
312 | 318 | ||
313 | /* the tracer may want to single-step inside the handler */ | 319 | /* the tracer may want to single-step inside the handler */ |
314 | if (test_thread_flag(TIF_SINGLESTEP)) | 320 | if (test_thread_flag(TIF_SINGLESTEP)) |
@@ -323,7 +329,7 @@ static int setup_frame(int sig, struct k_sigaction *ka, sigset_t *set) | |||
323 | return 0; | 329 | return 0; |
324 | 330 | ||
325 | give_sigsegv: | 331 | give_sigsegv: |
326 | force_sig(SIGSEGV, current); | 332 | force_sigsegv(sig, current); |
327 | return -EFAULT; | 333 | return -EFAULT; |
328 | 334 | ||
329 | } /* end setup_frame() */ | 335 | } /* end setup_frame() */ |
@@ -338,6 +344,8 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
338 | struct rt_sigframe __user *frame; | 344 | struct rt_sigframe __user *frame; |
339 | int rsig; | 345 | int rsig; |
340 | 346 | ||
347 | set_fs(USER_DS); | ||
348 | |||
341 | frame = get_sigframe(ka, sizeof(*frame)); | 349 | frame = get_sigframe(ka, sizeof(*frame)); |
342 | 350 | ||
343 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) | 351 | if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) |
@@ -392,22 +400,23 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
392 | } | 400 | } |
393 | 401 | ||
394 | /* Set up registers for signal handler */ | 402 | /* Set up registers for signal handler */ |
395 | __frame->sp = (unsigned long) frame; | ||
396 | __frame->lr = (unsigned long) &frame->retcode; | ||
397 | __frame->gr8 = sig; | ||
398 | __frame->gr9 = (unsigned long) &frame->info; | ||
399 | |||
400 | if (current->personality & FDPIC_FUNCPTRS) { | 403 | if (current->personality & FDPIC_FUNCPTRS) { |
401 | struct fdpic_func_descriptor __user *funcptr = | 404 | struct fdpic_func_descriptor __user *funcptr = |
402 | (struct fdpic_func_descriptor __user *) ka->sa.sa_handler; | 405 | (struct fdpic_func_descriptor __user *) ka->sa.sa_handler; |
403 | __get_user(__frame->pc, &funcptr->text); | 406 | struct fdpic_func_descriptor desc; |
404 | __get_user(__frame->gr15, &funcptr->GOT); | 407 | if (copy_from_user(&desc, funcptr, sizeof(desc))) |
408 | goto give_sigsegv; | ||
409 | __frame->pc = desc.text; | ||
410 | __frame->gr15 = desc.GOT; | ||
405 | } else { | 411 | } else { |
406 | __frame->pc = (unsigned long) ka->sa.sa_handler; | 412 | __frame->pc = (unsigned long) ka->sa.sa_handler; |
407 | __frame->gr15 = 0; | 413 | __frame->gr15 = 0; |
408 | } | 414 | } |
409 | 415 | ||
410 | set_fs(USER_DS); | 416 | __frame->sp = (unsigned long) frame; |
417 | __frame->lr = (unsigned long) &frame->retcode; | ||
418 | __frame->gr8 = sig; | ||
419 | __frame->gr9 = (unsigned long) &frame->info; | ||
411 | 420 | ||
412 | /* the tracer may want to single-step inside the handler */ | 421 | /* the tracer may want to single-step inside the handler */ |
413 | if (test_thread_flag(TIF_SINGLESTEP)) | 422 | if (test_thread_flag(TIF_SINGLESTEP)) |
@@ -422,7 +431,7 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
422 | return 0; | 431 | return 0; |
423 | 432 | ||
424 | give_sigsegv: | 433 | give_sigsegv: |
425 | force_sig(SIGSEGV, current); | 434 | force_sigsegv(sig, current); |
426 | return -EFAULT; | 435 | return -EFAULT; |
427 | 436 | ||
428 | } /* end setup_rt_frame() */ | 437 | } /* end setup_rt_frame() */ |
@@ -437,7 +446,7 @@ static int handle_signal(unsigned long sig, siginfo_t *info, | |||
437 | int ret; | 446 | int ret; |
438 | 447 | ||
439 | /* Are we from a system call? */ | 448 | /* Are we from a system call? */ |
440 | if (in_syscall(__frame)) { | 449 | if (__frame->syscallno != -1) { |
441 | /* If so, check system call restarting.. */ | 450 | /* If so, check system call restarting.. */ |
442 | switch (__frame->gr8) { | 451 | switch (__frame->gr8) { |
443 | case -ERESTART_RESTARTBLOCK: | 452 | case -ERESTART_RESTARTBLOCK: |
@@ -456,6 +465,7 @@ static int handle_signal(unsigned long sig, siginfo_t *info, | |||
456 | __frame->gr8 = __frame->orig_gr8; | 465 | __frame->gr8 = __frame->orig_gr8; |
457 | __frame->pc -= 4; | 466 | __frame->pc -= 4; |
458 | } | 467 | } |
468 | __frame->syscallno = -1; | ||
459 | } | 469 | } |
460 | 470 | ||
461 | /* Set up the stack frame */ | 471 | /* Set up the stack frame */ |
@@ -538,10 +548,11 @@ no_signal: | |||
538 | break; | 548 | break; |
539 | 549 | ||
540 | case -ERESTART_RESTARTBLOCK: | 550 | case -ERESTART_RESTARTBLOCK: |
541 | __frame->gr8 = __NR_restart_syscall; | 551 | __frame->gr7 = __NR_restart_syscall; |
542 | __frame->pc -= 4; | 552 | __frame->pc -= 4; |
543 | break; | 553 | break; |
544 | } | 554 | } |
555 | __frame->syscallno = -1; | ||
545 | } | 556 | } |
546 | 557 | ||
547 | /* if there's no signal to deliver, we just put the saved sigmask | 558 | /* if there's no signal to deliver, we just put the saved sigmask |
diff --git a/arch/ia64/include/asm/compat.h b/arch/ia64/include/asm/compat.h index f90edc85b509..9301a2821615 100644 --- a/arch/ia64/include/asm/compat.h +++ b/arch/ia64/include/asm/compat.h | |||
@@ -199,7 +199,7 @@ ptr_to_compat(void __user *uptr) | |||
199 | } | 199 | } |
200 | 200 | ||
201 | static __inline__ void __user * | 201 | static __inline__ void __user * |
202 | compat_alloc_user_space (long len) | 202 | arch_compat_alloc_user_space (long len) |
203 | { | 203 | { |
204 | struct pt_regs *regs = task_pt_regs(current); | 204 | struct pt_regs *regs = task_pt_regs(current); |
205 | return (void __user *) (((regs->r12 & 0xffffffff) & -16) - len); | 205 | return (void __user *) (((regs->r12 & 0xffffffff) & -16) - len); |
diff --git a/arch/ia64/kernel/fsys.S b/arch/ia64/kernel/fsys.S index 3567d54f8cee..331d42bda77a 100644 --- a/arch/ia64/kernel/fsys.S +++ b/arch/ia64/kernel/fsys.S | |||
@@ -420,22 +420,31 @@ EX(.fail_efault, ld8 r14=[r33]) // r14 <- *set | |||
420 | ;; | 420 | ;; |
421 | 421 | ||
422 | RSM_PSR_I(p0, r18, r19) // mask interrupt delivery | 422 | RSM_PSR_I(p0, r18, r19) // mask interrupt delivery |
423 | mov ar.ccv=0 | ||
424 | andcm r14=r14,r17 // filter out SIGKILL & SIGSTOP | 423 | andcm r14=r14,r17 // filter out SIGKILL & SIGSTOP |
424 | mov r8=EINVAL // default to EINVAL | ||
425 | 425 | ||
426 | #ifdef CONFIG_SMP | 426 | #ifdef CONFIG_SMP |
427 | mov r17=1 | 427 | // __ticket_spin_trylock(r31) |
428 | ld4 r17=[r31] | ||
428 | ;; | 429 | ;; |
429 | cmpxchg4.acq r18=[r31],r17,ar.ccv // try to acquire the lock | 430 | mov.m ar.ccv=r17 |
430 | mov r8=EINVAL // default to EINVAL | 431 | extr.u r9=r17,17,15 |
432 | adds r19=1,r17 | ||
433 | extr.u r18=r17,0,15 | ||
434 | ;; | ||
435 | cmp.eq p6,p7=r9,r18 | ||
431 | ;; | 436 | ;; |
437 | (p6) cmpxchg4.acq r9=[r31],r19,ar.ccv | ||
438 | (p6) dep.z r20=r19,1,15 // next serving ticket for unlock | ||
439 | (p7) br.cond.spnt.many .lock_contention | ||
440 | ;; | ||
441 | cmp4.eq p0,p7=r9,r17 | ||
442 | adds r31=2,r31 | ||
443 | (p7) br.cond.spnt.many .lock_contention | ||
432 | ld8 r3=[r2] // re-read current->blocked now that we hold the lock | 444 | ld8 r3=[r2] // re-read current->blocked now that we hold the lock |
433 | cmp4.ne p6,p0=r18,r0 | ||
434 | (p6) br.cond.spnt.many .lock_contention | ||
435 | ;; | 445 | ;; |
436 | #else | 446 | #else |
437 | ld8 r3=[r2] // re-read current->blocked now that we hold the lock | 447 | ld8 r3=[r2] // re-read current->blocked now that we hold the lock |
438 | mov r8=EINVAL // default to EINVAL | ||
439 | #endif | 448 | #endif |
440 | add r18=IA64_TASK_PENDING_OFFSET+IA64_SIGPENDING_SIGNAL_OFFSET,r16 | 449 | add r18=IA64_TASK_PENDING_OFFSET+IA64_SIGPENDING_SIGNAL_OFFSET,r16 |
441 | add r19=IA64_TASK_SIGNAL_OFFSET,r16 | 450 | add r19=IA64_TASK_SIGNAL_OFFSET,r16 |
@@ -490,7 +499,9 @@ EX(.fail_efault, ld8 r14=[r33]) // r14 <- *set | |||
490 | (p6) br.cond.spnt.few 1b // yes -> retry | 499 | (p6) br.cond.spnt.few 1b // yes -> retry |
491 | 500 | ||
492 | #ifdef CONFIG_SMP | 501 | #ifdef CONFIG_SMP |
493 | st4.rel [r31]=r0 // release the lock | 502 | // __ticket_spin_unlock(r31) |
503 | st2.rel [r31]=r20 | ||
504 | mov r20=0 // i must not leak kernel bits... | ||
494 | #endif | 505 | #endif |
495 | SSM_PSR_I(p0, p9, r31) | 506 | SSM_PSR_I(p0, p9, r31) |
496 | ;; | 507 | ;; |
@@ -512,7 +523,8 @@ EX(.fail_efault, (p15) st8 [r34]=r3) | |||
512 | 523 | ||
513 | .sig_pending: | 524 | .sig_pending: |
514 | #ifdef CONFIG_SMP | 525 | #ifdef CONFIG_SMP |
515 | st4.rel [r31]=r0 // release the lock | 526 | // __ticket_spin_unlock(r31) |
527 | st2.rel [r31]=r20 // release the lock | ||
516 | #endif | 528 | #endif |
517 | SSM_PSR_I(p0, p9, r17) | 529 | SSM_PSR_I(p0, p9, r17) |
518 | ;; | 530 | ;; |
diff --git a/arch/m32r/include/asm/signal.h b/arch/m32r/include/asm/signal.h index 9c1acb2b1a92..b2eeb0de1c8d 100644 --- a/arch/m32r/include/asm/signal.h +++ b/arch/m32r/include/asm/signal.h | |||
@@ -157,7 +157,6 @@ typedef struct sigaltstack { | |||
157 | #undef __HAVE_ARCH_SIG_BITOPS | 157 | #undef __HAVE_ARCH_SIG_BITOPS |
158 | 158 | ||
159 | struct pt_regs; | 159 | struct pt_regs; |
160 | extern int do_signal(struct pt_regs *regs, sigset_t *oldset); | ||
161 | 160 | ||
162 | #define ptrace_signal_deliver(regs, cookie) do { } while (0) | 161 | #define ptrace_signal_deliver(regs, cookie) do { } while (0) |
163 | 162 | ||
diff --git a/arch/m32r/include/asm/unistd.h b/arch/m32r/include/asm/unistd.h index 76125777483c..c70545689da8 100644 --- a/arch/m32r/include/asm/unistd.h +++ b/arch/m32r/include/asm/unistd.h | |||
@@ -351,6 +351,7 @@ | |||
351 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT /*will be unused*/ | 351 | #define __ARCH_WANT_SYS_OLD_GETRLIMIT /*will be unused*/ |
352 | #define __ARCH_WANT_SYS_OLDUMOUNT | 352 | #define __ARCH_WANT_SYS_OLDUMOUNT |
353 | #define __ARCH_WANT_SYS_RT_SIGACTION | 353 | #define __ARCH_WANT_SYS_RT_SIGACTION |
354 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND | ||
354 | 355 | ||
355 | #define __IGNORE_lchown | 356 | #define __IGNORE_lchown |
356 | #define __IGNORE_setuid | 357 | #define __IGNORE_setuid |
diff --git a/arch/m32r/kernel/entry.S b/arch/m32r/kernel/entry.S index 403869833b98..225412bc227e 100644 --- a/arch/m32r/kernel/entry.S +++ b/arch/m32r/kernel/entry.S | |||
@@ -235,10 +235,9 @@ work_resched: | |||
235 | work_notifysig: ; deal with pending signals and | 235 | work_notifysig: ; deal with pending signals and |
236 | ; notify-resume requests | 236 | ; notify-resume requests |
237 | mv r0, sp ; arg1 : struct pt_regs *regs | 237 | mv r0, sp ; arg1 : struct pt_regs *regs |
238 | ldi r1, #0 ; arg2 : sigset_t *oldset | 238 | mv r1, r9 ; arg2 : __u32 thread_info_flags |
239 | mv r2, r9 ; arg3 : __u32 thread_info_flags | ||
240 | bl do_notify_resume | 239 | bl do_notify_resume |
241 | bra restore_all | 240 | bra resume_userspace |
242 | 241 | ||
243 | ; perform syscall exit tracing | 242 | ; perform syscall exit tracing |
244 | ALIGN | 243 | ALIGN |
diff --git a/arch/m32r/kernel/ptrace.c b/arch/m32r/kernel/ptrace.c index e555091eb97c..0021ade4cba8 100644 --- a/arch/m32r/kernel/ptrace.c +++ b/arch/m32r/kernel/ptrace.c | |||
@@ -592,16 +592,17 @@ void user_enable_single_step(struct task_struct *child) | |||
592 | 592 | ||
593 | if (access_process_vm(child, pc&~3, &insn, sizeof(insn), 0) | 593 | if (access_process_vm(child, pc&~3, &insn, sizeof(insn), 0) |
594 | != sizeof(insn)) | 594 | != sizeof(insn)) |
595 | break; | 595 | return -EIO; |
596 | 596 | ||
597 | compute_next_pc(insn, pc, &next_pc, child); | 597 | compute_next_pc(insn, pc, &next_pc, child); |
598 | if (next_pc & 0x80000000) | 598 | if (next_pc & 0x80000000) |
599 | break; | 599 | return -EIO; |
600 | 600 | ||
601 | if (embed_debug_trap(child, next_pc)) | 601 | if (embed_debug_trap(child, next_pc)) |
602 | break; | 602 | return -EIO; |
603 | 603 | ||
604 | invalidate_cache(); | 604 | invalidate_cache(); |
605 | return 0; | ||
605 | } | 606 | } |
606 | 607 | ||
607 | void user_disable_single_step(struct task_struct *child) | 608 | void user_disable_single_step(struct task_struct *child) |
diff --git a/arch/m32r/kernel/signal.c b/arch/m32r/kernel/signal.c index 144b0f124fc7..7bbe38645ed5 100644 --- a/arch/m32r/kernel/signal.c +++ b/arch/m32r/kernel/signal.c | |||
@@ -28,37 +28,6 @@ | |||
28 | 28 | ||
29 | #define DEBUG_SIG 0 | 29 | #define DEBUG_SIG 0 |
30 | 30 | ||
31 | #define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) | ||
32 | |||
33 | int do_signal(struct pt_regs *, sigset_t *); | ||
34 | |||
35 | asmlinkage int | ||
36 | sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize, | ||
37 | unsigned long r2, unsigned long r3, unsigned long r4, | ||
38 | unsigned long r5, unsigned long r6, struct pt_regs *regs) | ||
39 | { | ||
40 | sigset_t newset; | ||
41 | |||
42 | /* XXX: Don't preclude handling different sized sigset_t's. */ | ||
43 | if (sigsetsize != sizeof(sigset_t)) | ||
44 | return -EINVAL; | ||
45 | |||
46 | if (copy_from_user(&newset, unewset, sizeof(newset))) | ||
47 | return -EFAULT; | ||
48 | sigdelsetmask(&newset, sigmask(SIGKILL)|sigmask(SIGSTOP)); | ||
49 | |||
50 | spin_lock_irq(¤t->sighand->siglock); | ||
51 | current->saved_sigmask = current->blocked; | ||
52 | current->blocked = newset; | ||
53 | recalc_sigpending(); | ||
54 | spin_unlock_irq(¤t->sighand->siglock); | ||
55 | |||
56 | current->state = TASK_INTERRUPTIBLE; | ||
57 | schedule(); | ||
58 | set_thread_flag(TIF_RESTORE_SIGMASK); | ||
59 | return -ERESTARTNOHAND; | ||
60 | } | ||
61 | |||
62 | asmlinkage int | 31 | asmlinkage int |
63 | sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, | 32 | sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, |
64 | unsigned long r2, unsigned long r3, unsigned long r4, | 33 | unsigned long r2, unsigned long r3, unsigned long r4, |
@@ -218,7 +187,7 @@ get_sigframe(struct k_sigaction *ka, unsigned long sp, size_t frame_size) | |||
218 | return (void __user *)((sp - frame_size) & -8ul); | 187 | return (void __user *)((sp - frame_size) & -8ul); |
219 | } | 188 | } |
220 | 189 | ||
221 | static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | 190 | static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, |
222 | sigset_t *set, struct pt_regs *regs) | 191 | sigset_t *set, struct pt_regs *regs) |
223 | { | 192 | { |
224 | struct rt_sigframe __user *frame; | 193 | struct rt_sigframe __user *frame; |
@@ -275,22 +244,34 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
275 | current->comm, current->pid, frame, regs->pc); | 244 | current->comm, current->pid, frame, regs->pc); |
276 | #endif | 245 | #endif |
277 | 246 | ||
278 | return; | 247 | return 0; |
279 | 248 | ||
280 | give_sigsegv: | 249 | give_sigsegv: |
281 | force_sigsegv(sig, current); | 250 | force_sigsegv(sig, current); |
251 | return -EFAULT; | ||
252 | } | ||
253 | |||
254 | static int prev_insn(struct pt_regs *regs) | ||
255 | { | ||
256 | u16 inst; | ||
257 | if (get_user(&inst, (u16 __user *)(regs->bpc - 2))) | ||
258 | return -EFAULT; | ||
259 | if ((inst & 0xfff0) == 0x10f0) /* trap ? */ | ||
260 | regs->bpc -= 2; | ||
261 | else | ||
262 | regs->bpc -= 4; | ||
263 | regs->syscall_nr = -1; | ||
264 | return 0; | ||
282 | } | 265 | } |
283 | 266 | ||
284 | /* | 267 | /* |
285 | * OK, we're invoking a handler | 268 | * OK, we're invoking a handler |
286 | */ | 269 | */ |
287 | 270 | ||
288 | static void | 271 | static int |
289 | handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, | 272 | handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, |
290 | sigset_t *oldset, struct pt_regs *regs) | 273 | sigset_t *oldset, struct pt_regs *regs) |
291 | { | 274 | { |
292 | unsigned short inst; | ||
293 | |||
294 | /* Are we from a system call? */ | 275 | /* Are we from a system call? */ |
295 | if (regs->syscall_nr >= 0) { | 276 | if (regs->syscall_nr >= 0) { |
296 | /* If so, check system call restarting.. */ | 277 | /* If so, check system call restarting.. */ |
@@ -308,16 +289,14 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, | |||
308 | /* fallthrough */ | 289 | /* fallthrough */ |
309 | case -ERESTARTNOINTR: | 290 | case -ERESTARTNOINTR: |
310 | regs->r0 = regs->orig_r0; | 291 | regs->r0 = regs->orig_r0; |
311 | inst = *(unsigned short *)(regs->bpc - 2); | 292 | if (prev_insn(regs) < 0) |
312 | if ((inst & 0xfff0) == 0x10f0) /* trap ? */ | 293 | return -EFAULT; |
313 | regs->bpc -= 2; | ||
314 | else | ||
315 | regs->bpc -= 4; | ||
316 | } | 294 | } |
317 | } | 295 | } |
318 | 296 | ||
319 | /* Set up the stack frame */ | 297 | /* Set up the stack frame */ |
320 | setup_rt_frame(sig, ka, info, oldset, regs); | 298 | if (setup_rt_frame(sig, ka, info, oldset, regs)) |
299 | return -EFAULT; | ||
321 | 300 | ||
322 | spin_lock_irq(¤t->sighand->siglock); | 301 | spin_lock_irq(¤t->sighand->siglock); |
323 | sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); | 302 | sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); |
@@ -325,6 +304,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, | |||
325 | sigaddset(¤t->blocked,sig); | 304 | sigaddset(¤t->blocked,sig); |
326 | recalc_sigpending(); | 305 | recalc_sigpending(); |
327 | spin_unlock_irq(¤t->sighand->siglock); | 306 | spin_unlock_irq(¤t->sighand->siglock); |
307 | return 0; | ||
328 | } | 308 | } |
329 | 309 | ||
330 | /* | 310 | /* |
@@ -332,12 +312,12 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, siginfo_t *info, | |||
332 | * want to handle. Thus you cannot kill init even with a SIGKILL even by | 312 | * want to handle. Thus you cannot kill init even with a SIGKILL even by |
333 | * mistake. | 313 | * mistake. |
334 | */ | 314 | */ |
335 | int do_signal(struct pt_regs *regs, sigset_t *oldset) | 315 | static void do_signal(struct pt_regs *regs) |
336 | { | 316 | { |
337 | siginfo_t info; | 317 | siginfo_t info; |
338 | int signr; | 318 | int signr; |
339 | struct k_sigaction ka; | 319 | struct k_sigaction ka; |
340 | unsigned short inst; | 320 | sigset_t *oldset; |
341 | 321 | ||
342 | /* | 322 | /* |
343 | * We want the common case to go fast, which | 323 | * We want the common case to go fast, which |
@@ -346,12 +326,14 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset) | |||
346 | * if so. | 326 | * if so. |
347 | */ | 327 | */ |
348 | if (!user_mode(regs)) | 328 | if (!user_mode(regs)) |
349 | return 1; | 329 | return; |
350 | 330 | ||
351 | if (try_to_freeze()) | 331 | if (try_to_freeze()) |
352 | goto no_signal; | 332 | goto no_signal; |
353 | 333 | ||
354 | if (!oldset) | 334 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) |
335 | oldset = ¤t->saved_sigmask; | ||
336 | else | ||
355 | oldset = ¤t->blocked; | 337 | oldset = ¤t->blocked; |
356 | 338 | ||
357 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 339 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
@@ -363,8 +345,10 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset) | |||
363 | */ | 345 | */ |
364 | 346 | ||
365 | /* Whee! Actually deliver the signal. */ | 347 | /* Whee! Actually deliver the signal. */ |
366 | handle_signal(signr, &ka, &info, oldset, regs); | 348 | if (handle_signal(signr, &ka, &info, oldset, regs) == 0) |
367 | return 1; | 349 | clear_thread_flag(TIF_RESTORE_SIGMASK); |
350 | |||
351 | return; | ||
368 | } | 352 | } |
369 | 353 | ||
370 | no_signal: | 354 | no_signal: |
@@ -375,31 +359,24 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset) | |||
375 | regs->r0 == -ERESTARTSYS || | 359 | regs->r0 == -ERESTARTSYS || |
376 | regs->r0 == -ERESTARTNOINTR) { | 360 | regs->r0 == -ERESTARTNOINTR) { |
377 | regs->r0 = regs->orig_r0; | 361 | regs->r0 = regs->orig_r0; |
378 | inst = *(unsigned short *)(regs->bpc - 2); | 362 | prev_insn(regs); |
379 | if ((inst & 0xfff0) == 0x10f0) /* trap ? */ | 363 | } else if (regs->r0 == -ERESTART_RESTARTBLOCK){ |
380 | regs->bpc -= 2; | ||
381 | else | ||
382 | regs->bpc -= 4; | ||
383 | } | ||
384 | if (regs->r0 == -ERESTART_RESTARTBLOCK){ | ||
385 | regs->r0 = regs->orig_r0; | 364 | regs->r0 = regs->orig_r0; |
386 | regs->r7 = __NR_restart_syscall; | 365 | regs->r7 = __NR_restart_syscall; |
387 | inst = *(unsigned short *)(regs->bpc - 2); | 366 | prev_insn(regs); |
388 | if ((inst & 0xfff0) == 0x10f0) /* trap ? */ | ||
389 | regs->bpc -= 2; | ||
390 | else | ||
391 | regs->bpc -= 4; | ||
392 | } | 367 | } |
393 | } | 368 | } |
394 | return 0; | 369 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) { |
370 | clear_thread_flag(TIF_RESTORE_SIGMASK); | ||
371 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
372 | } | ||
395 | } | 373 | } |
396 | 374 | ||
397 | /* | 375 | /* |
398 | * notification of userspace execution resumption | 376 | * notification of userspace execution resumption |
399 | * - triggered by current->work.notify_resume | 377 | * - triggered by current->work.notify_resume |
400 | */ | 378 | */ |
401 | void do_notify_resume(struct pt_regs *regs, sigset_t *oldset, | 379 | void do_notify_resume(struct pt_regs *regs, __u32 thread_info_flags) |
402 | __u32 thread_info_flags) | ||
403 | { | 380 | { |
404 | /* Pending single-step? */ | 381 | /* Pending single-step? */ |
405 | if (thread_info_flags & _TIF_SINGLESTEP) | 382 | if (thread_info_flags & _TIF_SINGLESTEP) |
@@ -407,7 +384,7 @@ void do_notify_resume(struct pt_regs *regs, sigset_t *oldset, | |||
407 | 384 | ||
408 | /* deal with pending signal delivery */ | 385 | /* deal with pending signal delivery */ |
409 | if (thread_info_flags & _TIF_SIGPENDING) | 386 | if (thread_info_flags & _TIF_SIGPENDING) |
410 | do_signal(regs,oldset); | 387 | do_signal(regs); |
411 | 388 | ||
412 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { | 389 | if (thread_info_flags & _TIF_NOTIFY_RESUME) { |
413 | clear_thread_flag(TIF_NOTIFY_RESUME); | 390 | clear_thread_flag(TIF_NOTIFY_RESUME); |
diff --git a/arch/m68k/include/asm/unistd.h b/arch/m68k/include/asm/unistd.h index 60b15d0aa072..b43b36beafe3 100644 --- a/arch/m68k/include/asm/unistd.h +++ b/arch/m68k/include/asm/unistd.h | |||
@@ -340,10 +340,13 @@ | |||
340 | #define __NR_set_thread_area 334 | 340 | #define __NR_set_thread_area 334 |
341 | #define __NR_atomic_cmpxchg_32 335 | 341 | #define __NR_atomic_cmpxchg_32 335 |
342 | #define __NR_atomic_barrier 336 | 342 | #define __NR_atomic_barrier 336 |
343 | #define __NR_fanotify_init 337 | ||
344 | #define __NR_fanotify_mark 338 | ||
345 | #define __NR_prlimit64 339 | ||
343 | 346 | ||
344 | #ifdef __KERNEL__ | 347 | #ifdef __KERNEL__ |
345 | 348 | ||
346 | #define NR_syscalls 337 | 349 | #define NR_syscalls 340 |
347 | 350 | ||
348 | #define __ARCH_WANT_IPC_PARSE_VERSION | 351 | #define __ARCH_WANT_IPC_PARSE_VERSION |
349 | #define __ARCH_WANT_OLD_READDIR | 352 | #define __ARCH_WANT_OLD_READDIR |
diff --git a/arch/m68k/kernel/entry.S b/arch/m68k/kernel/entry.S index 2391bdff0996..6360c437dcf5 100644 --- a/arch/m68k/kernel/entry.S +++ b/arch/m68k/kernel/entry.S | |||
@@ -765,4 +765,7 @@ sys_call_table: | |||
765 | .long sys_set_thread_area | 765 | .long sys_set_thread_area |
766 | .long sys_atomic_cmpxchg_32 /* 335 */ | 766 | .long sys_atomic_cmpxchg_32 /* 335 */ |
767 | .long sys_atomic_barrier | 767 | .long sys_atomic_barrier |
768 | .long sys_fanotify_init | ||
769 | .long sys_fanotify_mark | ||
770 | .long sys_prlimit64 | ||
768 | 771 | ||
diff --git a/arch/m68knommu/kernel/syscalltable.S b/arch/m68knommu/kernel/syscalltable.S index b30b3eb197a5..79b1ed198c07 100644 --- a/arch/m68knommu/kernel/syscalltable.S +++ b/arch/m68knommu/kernel/syscalltable.S | |||
@@ -355,6 +355,9 @@ ENTRY(sys_call_table) | |||
355 | .long sys_set_thread_area | 355 | .long sys_set_thread_area |
356 | .long sys_atomic_cmpxchg_32 /* 335 */ | 356 | .long sys_atomic_cmpxchg_32 /* 335 */ |
357 | .long sys_atomic_barrier | 357 | .long sys_atomic_barrier |
358 | .long sys_fanotify_init | ||
359 | .long sys_fanotify_mark | ||
360 | .long sys_prlimit64 | ||
358 | 361 | ||
359 | .rept NR_syscalls-(.-sys_call_table)/4 | 362 | .rept NR_syscalls-(.-sys_call_table)/4 |
360 | .long sys_ni_syscall | 363 | .long sys_ni_syscall |
diff --git a/arch/mips/include/asm/compat.h b/arch/mips/include/asm/compat.h index 613f6912dfc1..dbc51065df5b 100644 --- a/arch/mips/include/asm/compat.h +++ b/arch/mips/include/asm/compat.h | |||
@@ -145,7 +145,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr) | |||
145 | return (u32)(unsigned long)uptr; | 145 | return (u32)(unsigned long)uptr; |
146 | } | 146 | } |
147 | 147 | ||
148 | static inline void __user *compat_alloc_user_space(long len) | 148 | static inline void __user *arch_compat_alloc_user_space(long len) |
149 | { | 149 | { |
150 | struct pt_regs *regs = (struct pt_regs *) | 150 | struct pt_regs *regs = (struct pt_regs *) |
151 | ((unsigned long) current_thread_info() + THREAD_SIZE - 32) - 1; | 151 | ((unsigned long) current_thread_info() + THREAD_SIZE - 32) - 1; |
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig index 444b9f918fdf..7c2a2f7f8dc1 100644 --- a/arch/mn10300/Kconfig +++ b/arch/mn10300/Kconfig | |||
@@ -8,7 +8,6 @@ mainmenu "Linux Kernel Configuration" | |||
8 | config MN10300 | 8 | config MN10300 |
9 | def_bool y | 9 | def_bool y |
10 | select HAVE_OPROFILE | 10 | select HAVE_OPROFILE |
11 | select HAVE_ARCH_TRACEHOOK | ||
12 | 11 | ||
13 | config AM33 | 12 | config AM33 |
14 | def_bool y | 13 | def_bool y |
diff --git a/arch/mn10300/include/asm/bitops.h b/arch/mn10300/include/asm/bitops.h index f49ac49e09ad..3f50e9661076 100644 --- a/arch/mn10300/include/asm/bitops.h +++ b/arch/mn10300/include/asm/bitops.h | |||
@@ -229,9 +229,9 @@ int ffs(int x) | |||
229 | #include <asm-generic/bitops/hweight.h> | 229 | #include <asm-generic/bitops/hweight.h> |
230 | 230 | ||
231 | #define ext2_set_bit_atomic(lock, nr, addr) \ | 231 | #define ext2_set_bit_atomic(lock, nr, addr) \ |
232 | test_and_set_bit((nr) ^ 0x18, (addr)) | 232 | test_and_set_bit((nr), (addr)) |
233 | #define ext2_clear_bit_atomic(lock, nr, addr) \ | 233 | #define ext2_clear_bit_atomic(lock, nr, addr) \ |
234 | test_and_clear_bit((nr) ^ 0x18, (addr)) | 234 | test_and_clear_bit((nr), (addr)) |
235 | 235 | ||
236 | #include <asm-generic/bitops/ext2-non-atomic.h> | 236 | #include <asm-generic/bitops/ext2-non-atomic.h> |
237 | #include <asm-generic/bitops/minix-le.h> | 237 | #include <asm-generic/bitops/minix-le.h> |
diff --git a/arch/mn10300/include/asm/signal.h b/arch/mn10300/include/asm/signal.h index 7e891fce2370..1865d72a86ff 100644 --- a/arch/mn10300/include/asm/signal.h +++ b/arch/mn10300/include/asm/signal.h | |||
@@ -78,7 +78,7 @@ typedef unsigned long sigset_t; | |||
78 | 78 | ||
79 | /* These should not be considered constants from userland. */ | 79 | /* These should not be considered constants from userland. */ |
80 | #define SIGRTMIN 32 | 80 | #define SIGRTMIN 32 |
81 | #define SIGRTMAX (_NSIG-1) | 81 | #define SIGRTMAX _NSIG |
82 | 82 | ||
83 | /* | 83 | /* |
84 | * SA_FLAGS values: | 84 | * SA_FLAGS values: |
diff --git a/arch/mn10300/kernel/mn10300-serial.c b/arch/mn10300/kernel/mn10300-serial.c index 9d49073e827a..db509dd80565 100644 --- a/arch/mn10300/kernel/mn10300-serial.c +++ b/arch/mn10300/kernel/mn10300-serial.c | |||
@@ -156,17 +156,17 @@ struct mn10300_serial_port mn10300_serial_port_sif0 = { | |||
156 | ._intr = &SC0ICR, | 156 | ._intr = &SC0ICR, |
157 | ._rxb = &SC0RXB, | 157 | ._rxb = &SC0RXB, |
158 | ._txb = &SC0TXB, | 158 | ._txb = &SC0TXB, |
159 | .rx_name = "ttySM0/Rx", | 159 | .rx_name = "ttySM0:Rx", |
160 | .tx_name = "ttySM0/Tx", | 160 | .tx_name = "ttySM0:Tx", |
161 | #ifdef CONFIG_MN10300_TTYSM0_TIMER8 | 161 | #ifdef CONFIG_MN10300_TTYSM0_TIMER8 |
162 | .tm_name = "ttySM0/Timer8", | 162 | .tm_name = "ttySM0:Timer8", |
163 | ._tmxmd = &TM8MD, | 163 | ._tmxmd = &TM8MD, |
164 | ._tmxbr = &TM8BR, | 164 | ._tmxbr = &TM8BR, |
165 | ._tmicr = &TM8ICR, | 165 | ._tmicr = &TM8ICR, |
166 | .tm_irq = TM8IRQ, | 166 | .tm_irq = TM8IRQ, |
167 | .div_timer = MNSCx_DIV_TIMER_16BIT, | 167 | .div_timer = MNSCx_DIV_TIMER_16BIT, |
168 | #else /* CONFIG_MN10300_TTYSM0_TIMER2 */ | 168 | #else /* CONFIG_MN10300_TTYSM0_TIMER2 */ |
169 | .tm_name = "ttySM0/Timer2", | 169 | .tm_name = "ttySM0:Timer2", |
170 | ._tmxmd = &TM2MD, | 170 | ._tmxmd = &TM2MD, |
171 | ._tmxbr = (volatile u16 *) &TM2BR, | 171 | ._tmxbr = (volatile u16 *) &TM2BR, |
172 | ._tmicr = &TM2ICR, | 172 | ._tmicr = &TM2ICR, |
@@ -209,17 +209,17 @@ struct mn10300_serial_port mn10300_serial_port_sif1 = { | |||
209 | ._intr = &SC1ICR, | 209 | ._intr = &SC1ICR, |
210 | ._rxb = &SC1RXB, | 210 | ._rxb = &SC1RXB, |
211 | ._txb = &SC1TXB, | 211 | ._txb = &SC1TXB, |
212 | .rx_name = "ttySM1/Rx", | 212 | .rx_name = "ttySM1:Rx", |
213 | .tx_name = "ttySM1/Tx", | 213 | .tx_name = "ttySM1:Tx", |
214 | #ifdef CONFIG_MN10300_TTYSM1_TIMER9 | 214 | #ifdef CONFIG_MN10300_TTYSM1_TIMER9 |
215 | .tm_name = "ttySM1/Timer9", | 215 | .tm_name = "ttySM1:Timer9", |
216 | ._tmxmd = &TM9MD, | 216 | ._tmxmd = &TM9MD, |
217 | ._tmxbr = &TM9BR, | 217 | ._tmxbr = &TM9BR, |
218 | ._tmicr = &TM9ICR, | 218 | ._tmicr = &TM9ICR, |
219 | .tm_irq = TM9IRQ, | 219 | .tm_irq = TM9IRQ, |
220 | .div_timer = MNSCx_DIV_TIMER_16BIT, | 220 | .div_timer = MNSCx_DIV_TIMER_16BIT, |
221 | #else /* CONFIG_MN10300_TTYSM1_TIMER3 */ | 221 | #else /* CONFIG_MN10300_TTYSM1_TIMER3 */ |
222 | .tm_name = "ttySM1/Timer3", | 222 | .tm_name = "ttySM1:Timer3", |
223 | ._tmxmd = &TM3MD, | 223 | ._tmxmd = &TM3MD, |
224 | ._tmxbr = (volatile u16 *) &TM3BR, | 224 | ._tmxbr = (volatile u16 *) &TM3BR, |
225 | ._tmicr = &TM3ICR, | 225 | ._tmicr = &TM3ICR, |
@@ -260,9 +260,9 @@ struct mn10300_serial_port mn10300_serial_port_sif2 = { | |||
260 | .uart.lock = | 260 | .uart.lock = |
261 | __SPIN_LOCK_UNLOCKED(mn10300_serial_port_sif2.uart.lock), | 261 | __SPIN_LOCK_UNLOCKED(mn10300_serial_port_sif2.uart.lock), |
262 | .name = "ttySM2", | 262 | .name = "ttySM2", |
263 | .rx_name = "ttySM2/Rx", | 263 | .rx_name = "ttySM2:Rx", |
264 | .tx_name = "ttySM2/Tx", | 264 | .tx_name = "ttySM2:Tx", |
265 | .tm_name = "ttySM2/Timer10", | 265 | .tm_name = "ttySM2:Timer10", |
266 | ._iobase = &SC2CTR, | 266 | ._iobase = &SC2CTR, |
267 | ._control = &SC2CTR, | 267 | ._control = &SC2CTR, |
268 | ._status = &SC2STR, | 268 | ._status = &SC2STR, |
diff --git a/arch/parisc/include/asm/compat.h b/arch/parisc/include/asm/compat.h index 02b77baa5da6..efa0b60c63fe 100644 --- a/arch/parisc/include/asm/compat.h +++ b/arch/parisc/include/asm/compat.h | |||
@@ -147,7 +147,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr) | |||
147 | return (u32)(unsigned long)uptr; | 147 | return (u32)(unsigned long)uptr; |
148 | } | 148 | } |
149 | 149 | ||
150 | static __inline__ void __user *compat_alloc_user_space(long len) | 150 | static __inline__ void __user *arch_compat_alloc_user_space(long len) |
151 | { | 151 | { |
152 | struct pt_regs *regs = ¤t->thread.regs; | 152 | struct pt_regs *regs = ¤t->thread.regs; |
153 | return (void __user *)regs->gr[30]; | 153 | return (void __user *)regs->gr[30]; |
diff --git a/arch/powerpc/include/asm/compat.h b/arch/powerpc/include/asm/compat.h index 396d21a80058..a11d4eac4f97 100644 --- a/arch/powerpc/include/asm/compat.h +++ b/arch/powerpc/include/asm/compat.h | |||
@@ -134,7 +134,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr) | |||
134 | return (u32)(unsigned long)uptr; | 134 | return (u32)(unsigned long)uptr; |
135 | } | 135 | } |
136 | 136 | ||
137 | static inline void __user *compat_alloc_user_space(long len) | 137 | static inline void __user *arch_compat_alloc_user_space(long len) |
138 | { | 138 | { |
139 | struct pt_regs *regs = current->thread.regs; | 139 | struct pt_regs *regs = current->thread.regs; |
140 | unsigned long usp = regs->gpr[1]; | 140 | unsigned long usp = regs->gpr[1]; |
diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c index 7109f5b1baa8..2300426e531a 100644 --- a/arch/powerpc/kernel/signal.c +++ b/arch/powerpc/kernel/signal.c | |||
@@ -138,6 +138,7 @@ static int do_signal_pending(sigset_t *oldset, struct pt_regs *regs) | |||
138 | ti->local_flags &= ~_TLF_RESTORE_SIGMASK; | 138 | ti->local_flags &= ~_TLF_RESTORE_SIGMASK; |
139 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | 139 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); |
140 | } | 140 | } |
141 | regs->trap = 0; | ||
141 | return 0; /* no signals delivered */ | 142 | return 0; /* no signals delivered */ |
142 | } | 143 | } |
143 | 144 | ||
@@ -164,6 +165,7 @@ static int do_signal_pending(sigset_t *oldset, struct pt_regs *regs) | |||
164 | ret = handle_rt_signal64(signr, &ka, &info, oldset, regs); | 165 | ret = handle_rt_signal64(signr, &ka, &info, oldset, regs); |
165 | } | 166 | } |
166 | 167 | ||
168 | regs->trap = 0; | ||
167 | if (ret) { | 169 | if (ret) { |
168 | spin_lock_irq(¤t->sighand->siglock); | 170 | spin_lock_irq(¤t->sighand->siglock); |
169 | sigorsets(¤t->blocked, ¤t->blocked, | 171 | sigorsets(¤t->blocked, ¤t->blocked, |
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c index 266610119f66..b96a3a010c26 100644 --- a/arch/powerpc/kernel/signal_32.c +++ b/arch/powerpc/kernel/signal_32.c | |||
@@ -511,6 +511,7 @@ static long restore_user_regs(struct pt_regs *regs, | |||
511 | if (!sig) | 511 | if (!sig) |
512 | save_r2 = (unsigned int)regs->gpr[2]; | 512 | save_r2 = (unsigned int)regs->gpr[2]; |
513 | err = restore_general_regs(regs, sr); | 513 | err = restore_general_regs(regs, sr); |
514 | regs->trap = 0; | ||
514 | err |= __get_user(msr, &sr->mc_gregs[PT_MSR]); | 515 | err |= __get_user(msr, &sr->mc_gregs[PT_MSR]); |
515 | if (!sig) | 516 | if (!sig) |
516 | regs->gpr[2] = (unsigned long) save_r2; | 517 | regs->gpr[2] = (unsigned long) save_r2; |
@@ -884,7 +885,6 @@ int handle_rt_signal32(unsigned long sig, struct k_sigaction *ka, | |||
884 | regs->nip = (unsigned long) ka->sa.sa_handler; | 885 | regs->nip = (unsigned long) ka->sa.sa_handler; |
885 | /* enter the signal handler in big-endian mode */ | 886 | /* enter the signal handler in big-endian mode */ |
886 | regs->msr &= ~MSR_LE; | 887 | regs->msr &= ~MSR_LE; |
887 | regs->trap = 0; | ||
888 | return 1; | 888 | return 1; |
889 | 889 | ||
890 | badframe: | 890 | badframe: |
@@ -1228,7 +1228,6 @@ int handle_signal32(unsigned long sig, struct k_sigaction *ka, | |||
1228 | regs->nip = (unsigned long) ka->sa.sa_handler; | 1228 | regs->nip = (unsigned long) ka->sa.sa_handler; |
1229 | /* enter the signal handler in big-endian mode */ | 1229 | /* enter the signal handler in big-endian mode */ |
1230 | regs->msr &= ~MSR_LE; | 1230 | regs->msr &= ~MSR_LE; |
1231 | regs->trap = 0; | ||
1232 | 1231 | ||
1233 | return 1; | 1232 | return 1; |
1234 | 1233 | ||
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c index 2fe6fc64b614..27c4a4584f80 100644 --- a/arch/powerpc/kernel/signal_64.c +++ b/arch/powerpc/kernel/signal_64.c | |||
@@ -178,7 +178,7 @@ static long restore_sigcontext(struct pt_regs *regs, sigset_t *set, int sig, | |||
178 | err |= __get_user(regs->xer, &sc->gp_regs[PT_XER]); | 178 | err |= __get_user(regs->xer, &sc->gp_regs[PT_XER]); |
179 | err |= __get_user(regs->ccr, &sc->gp_regs[PT_CCR]); | 179 | err |= __get_user(regs->ccr, &sc->gp_regs[PT_CCR]); |
180 | /* skip SOFTE */ | 180 | /* skip SOFTE */ |
181 | err |= __get_user(regs->trap, &sc->gp_regs[PT_TRAP]); | 181 | regs->trap = 0; |
182 | err |= __get_user(regs->dar, &sc->gp_regs[PT_DAR]); | 182 | err |= __get_user(regs->dar, &sc->gp_regs[PT_DAR]); |
183 | err |= __get_user(regs->dsisr, &sc->gp_regs[PT_DSISR]); | 183 | err |= __get_user(regs->dsisr, &sc->gp_regs[PT_DSISR]); |
184 | err |= __get_user(regs->result, &sc->gp_regs[PT_RESULT]); | 184 | err |= __get_user(regs->result, &sc->gp_regs[PT_RESULT]); |
diff --git a/arch/s390/include/asm/compat.h b/arch/s390/include/asm/compat.h index 104f2007f097..a875c2f542e1 100644 --- a/arch/s390/include/asm/compat.h +++ b/arch/s390/include/asm/compat.h | |||
@@ -181,7 +181,7 @@ static inline int is_compat_task(void) | |||
181 | 181 | ||
182 | #endif | 182 | #endif |
183 | 183 | ||
184 | static inline void __user *compat_alloc_user_space(long len) | 184 | static inline void __user *arch_compat_alloc_user_space(long len) |
185 | { | 185 | { |
186 | unsigned long stack; | 186 | unsigned long stack; |
187 | 187 | ||
diff --git a/arch/sparc/include/asm/compat.h b/arch/sparc/include/asm/compat.h index 5016f76ea98a..6f57325bb883 100644 --- a/arch/sparc/include/asm/compat.h +++ b/arch/sparc/include/asm/compat.h | |||
@@ -167,7 +167,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr) | |||
167 | return (u32)(unsigned long)uptr; | 167 | return (u32)(unsigned long)uptr; |
168 | } | 168 | } |
169 | 169 | ||
170 | static inline void __user *compat_alloc_user_space(long len) | 170 | static inline void __user *arch_compat_alloc_user_space(long len) |
171 | { | 171 | { |
172 | struct pt_regs *regs = current_thread_info()->kregs; | 172 | struct pt_regs *regs = current_thread_info()->kregs; |
173 | unsigned long usp = regs->u_regs[UREG_I6]; | 173 | unsigned long usp = regs->u_regs[UREG_I6]; |
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c index 357ced3c33ff..6318e622cfb0 100644 --- a/arch/sparc/kernel/perf_event.c +++ b/arch/sparc/kernel/perf_event.c | |||
@@ -1038,6 +1038,7 @@ static int __hw_perf_event_init(struct perf_event *event) | |||
1038 | if (atomic_read(&nmi_active) < 0) | 1038 | if (atomic_read(&nmi_active) < 0) |
1039 | return -ENODEV; | 1039 | return -ENODEV; |
1040 | 1040 | ||
1041 | pmap = NULL; | ||
1041 | if (attr->type == PERF_TYPE_HARDWARE) { | 1042 | if (attr->type == PERF_TYPE_HARDWARE) { |
1042 | if (attr->config >= sparc_pmu->max_events) | 1043 | if (attr->config >= sparc_pmu->max_events) |
1043 | return -EINVAL; | 1044 | return -EINVAL; |
@@ -1046,9 +1047,18 @@ static int __hw_perf_event_init(struct perf_event *event) | |||
1046 | pmap = sparc_map_cache_event(attr->config); | 1047 | pmap = sparc_map_cache_event(attr->config); |
1047 | if (IS_ERR(pmap)) | 1048 | if (IS_ERR(pmap)) |
1048 | return PTR_ERR(pmap); | 1049 | return PTR_ERR(pmap); |
1049 | } else | 1050 | } else if (attr->type != PERF_TYPE_RAW) |
1050 | return -EOPNOTSUPP; | 1051 | return -EOPNOTSUPP; |
1051 | 1052 | ||
1053 | if (pmap) { | ||
1054 | hwc->event_base = perf_event_encode(pmap); | ||
1055 | } else { | ||
1056 | /* User gives us "(encoding << 16) | pic_mask" for | ||
1057 | * PERF_TYPE_RAW events. | ||
1058 | */ | ||
1059 | hwc->event_base = attr->config; | ||
1060 | } | ||
1061 | |||
1052 | /* We save the enable bits in the config_base. */ | 1062 | /* We save the enable bits in the config_base. */ |
1053 | hwc->config_base = sparc_pmu->irq_bit; | 1063 | hwc->config_base = sparc_pmu->irq_bit; |
1054 | if (!attr->exclude_user) | 1064 | if (!attr->exclude_user) |
@@ -1058,8 +1068,6 @@ static int __hw_perf_event_init(struct perf_event *event) | |||
1058 | if (!attr->exclude_hv) | 1068 | if (!attr->exclude_hv) |
1059 | hwc->config_base |= sparc_pmu->hv_bit; | 1069 | hwc->config_base |= sparc_pmu->hv_bit; |
1060 | 1070 | ||
1061 | hwc->event_base = perf_event_encode(pmap); | ||
1062 | |||
1063 | n = 0; | 1071 | n = 0; |
1064 | if (event->group_leader != event) { | 1072 | if (event->group_leader != event) { |
1065 | n = collect_events(event->group_leader, | 1073 | n = collect_events(event->group_leader, |
diff --git a/arch/sparc/kernel/signal32.c b/arch/sparc/kernel/signal32.c index ea22cd373c64..75fad425e249 100644 --- a/arch/sparc/kernel/signal32.c +++ b/arch/sparc/kernel/signal32.c | |||
@@ -453,8 +453,66 @@ static int save_fpu_state32(struct pt_regs *regs, __siginfo_fpu_t __user *fpu) | |||
453 | return err; | 453 | return err; |
454 | } | 454 | } |
455 | 455 | ||
456 | static void setup_frame32(struct k_sigaction *ka, struct pt_regs *regs, | 456 | /* The I-cache flush instruction only works in the primary ASI, which |
457 | int signo, sigset_t *oldset) | 457 | * right now is the nucleus, aka. kernel space. |
458 | * | ||
459 | * Therefore we have to kick the instructions out using the kernel | ||
460 | * side linear mapping of the physical address backing the user | ||
461 | * instructions. | ||
462 | */ | ||
463 | static void flush_signal_insns(unsigned long address) | ||
464 | { | ||
465 | unsigned long pstate, paddr; | ||
466 | pte_t *ptep, pte; | ||
467 | pgd_t *pgdp; | ||
468 | pud_t *pudp; | ||
469 | pmd_t *pmdp; | ||
470 | |||
471 | /* Commit all stores of the instructions we are about to flush. */ | ||
472 | wmb(); | ||
473 | |||
474 | /* Disable cross-call reception. In this way even a very wide | ||
475 | * munmap() on another cpu can't tear down the page table | ||
476 | * hierarchy from underneath us, since that can't complete | ||
477 | * until the IPI tlb flush returns. | ||
478 | */ | ||
479 | |||
480 | __asm__ __volatile__("rdpr %%pstate, %0" : "=r" (pstate)); | ||
481 | __asm__ __volatile__("wrpr %0, %1, %%pstate" | ||
482 | : : "r" (pstate), "i" (PSTATE_IE)); | ||
483 | |||
484 | pgdp = pgd_offset(current->mm, address); | ||
485 | if (pgd_none(*pgdp)) | ||
486 | goto out_irqs_on; | ||
487 | pudp = pud_offset(pgdp, address); | ||
488 | if (pud_none(*pudp)) | ||
489 | goto out_irqs_on; | ||
490 | pmdp = pmd_offset(pudp, address); | ||
491 | if (pmd_none(*pmdp)) | ||
492 | goto out_irqs_on; | ||
493 | |||
494 | ptep = pte_offset_map(pmdp, address); | ||
495 | pte = *ptep; | ||
496 | if (!pte_present(pte)) | ||
497 | goto out_unmap; | ||
498 | |||
499 | paddr = (unsigned long) page_address(pte_page(pte)); | ||
500 | |||
501 | __asm__ __volatile__("flush %0 + %1" | ||
502 | : /* no outputs */ | ||
503 | : "r" (paddr), | ||
504 | "r" (address & (PAGE_SIZE - 1)) | ||
505 | : "memory"); | ||
506 | |||
507 | out_unmap: | ||
508 | pte_unmap(ptep); | ||
509 | out_irqs_on: | ||
510 | __asm__ __volatile__("wrpr %0, 0x0, %%pstate" : : "r" (pstate)); | ||
511 | |||
512 | } | ||
513 | |||
514 | static int setup_frame32(struct k_sigaction *ka, struct pt_regs *regs, | ||
515 | int signo, sigset_t *oldset) | ||
458 | { | 516 | { |
459 | struct signal_frame32 __user *sf; | 517 | struct signal_frame32 __user *sf; |
460 | int sigframe_size; | 518 | int sigframe_size; |
@@ -547,13 +605,7 @@ static void setup_frame32(struct k_sigaction *ka, struct pt_regs *regs, | |||
547 | if (ka->ka_restorer) { | 605 | if (ka->ka_restorer) { |
548 | regs->u_regs[UREG_I7] = (unsigned long)ka->ka_restorer; | 606 | regs->u_regs[UREG_I7] = (unsigned long)ka->ka_restorer; |
549 | } else { | 607 | } else { |
550 | /* Flush instruction space. */ | ||
551 | unsigned long address = ((unsigned long)&(sf->insns[0])); | 608 | unsigned long address = ((unsigned long)&(sf->insns[0])); |
552 | pgd_t *pgdp = pgd_offset(current->mm, address); | ||
553 | pud_t *pudp = pud_offset(pgdp, address); | ||
554 | pmd_t *pmdp = pmd_offset(pudp, address); | ||
555 | pte_t *ptep; | ||
556 | pte_t pte; | ||
557 | 609 | ||
558 | regs->u_regs[UREG_I7] = (unsigned long) (&(sf->insns[0]) - 2); | 610 | regs->u_regs[UREG_I7] = (unsigned long) (&(sf->insns[0]) - 2); |
559 | 611 | ||
@@ -562,34 +614,22 @@ static void setup_frame32(struct k_sigaction *ka, struct pt_regs *regs, | |||
562 | if (err) | 614 | if (err) |
563 | goto sigsegv; | 615 | goto sigsegv; |
564 | 616 | ||
565 | preempt_disable(); | 617 | flush_signal_insns(address); |
566 | ptep = pte_offset_map(pmdp, address); | ||
567 | pte = *ptep; | ||
568 | if (pte_present(pte)) { | ||
569 | unsigned long page = (unsigned long) | ||
570 | page_address(pte_page(pte)); | ||
571 | |||
572 | wmb(); | ||
573 | __asm__ __volatile__("flush %0 + %1" | ||
574 | : /* no outputs */ | ||
575 | : "r" (page), | ||
576 | "r" (address & (PAGE_SIZE - 1)) | ||
577 | : "memory"); | ||
578 | } | ||
579 | pte_unmap(ptep); | ||
580 | preempt_enable(); | ||
581 | } | 618 | } |
582 | return; | 619 | return 0; |
583 | 620 | ||
584 | sigill: | 621 | sigill: |
585 | do_exit(SIGILL); | 622 | do_exit(SIGILL); |
623 | return -EINVAL; | ||
624 | |||
586 | sigsegv: | 625 | sigsegv: |
587 | force_sigsegv(signo, current); | 626 | force_sigsegv(signo, current); |
627 | return -EFAULT; | ||
588 | } | 628 | } |
589 | 629 | ||
590 | static void setup_rt_frame32(struct k_sigaction *ka, struct pt_regs *regs, | 630 | static int setup_rt_frame32(struct k_sigaction *ka, struct pt_regs *regs, |
591 | unsigned long signr, sigset_t *oldset, | 631 | unsigned long signr, sigset_t *oldset, |
592 | siginfo_t *info) | 632 | siginfo_t *info) |
593 | { | 633 | { |
594 | struct rt_signal_frame32 __user *sf; | 634 | struct rt_signal_frame32 __user *sf; |
595 | int sigframe_size; | 635 | int sigframe_size; |
@@ -687,12 +727,7 @@ static void setup_rt_frame32(struct k_sigaction *ka, struct pt_regs *regs, | |||
687 | if (ka->ka_restorer) | 727 | if (ka->ka_restorer) |
688 | regs->u_regs[UREG_I7] = (unsigned long)ka->ka_restorer; | 728 | regs->u_regs[UREG_I7] = (unsigned long)ka->ka_restorer; |
689 | else { | 729 | else { |
690 | /* Flush instruction space. */ | ||
691 | unsigned long address = ((unsigned long)&(sf->insns[0])); | 730 | unsigned long address = ((unsigned long)&(sf->insns[0])); |
692 | pgd_t *pgdp = pgd_offset(current->mm, address); | ||
693 | pud_t *pudp = pud_offset(pgdp, address); | ||
694 | pmd_t *pmdp = pmd_offset(pudp, address); | ||
695 | pte_t *ptep; | ||
696 | 731 | ||
697 | regs->u_regs[UREG_I7] = (unsigned long) (&(sf->insns[0]) - 2); | 732 | regs->u_regs[UREG_I7] = (unsigned long) (&(sf->insns[0]) - 2); |
698 | 733 | ||
@@ -704,38 +739,32 @@ static void setup_rt_frame32(struct k_sigaction *ka, struct pt_regs *regs, | |||
704 | if (err) | 739 | if (err) |
705 | goto sigsegv; | 740 | goto sigsegv; |
706 | 741 | ||
707 | preempt_disable(); | 742 | flush_signal_insns(address); |
708 | ptep = pte_offset_map(pmdp, address); | ||
709 | if (pte_present(*ptep)) { | ||
710 | unsigned long page = (unsigned long) | ||
711 | page_address(pte_page(*ptep)); | ||
712 | |||
713 | wmb(); | ||
714 | __asm__ __volatile__("flush %0 + %1" | ||
715 | : /* no outputs */ | ||
716 | : "r" (page), | ||
717 | "r" (address & (PAGE_SIZE - 1)) | ||
718 | : "memory"); | ||
719 | } | ||
720 | pte_unmap(ptep); | ||
721 | preempt_enable(); | ||
722 | } | 743 | } |
723 | return; | 744 | return 0; |
724 | 745 | ||
725 | sigill: | 746 | sigill: |
726 | do_exit(SIGILL); | 747 | do_exit(SIGILL); |
748 | return -EINVAL; | ||
749 | |||
727 | sigsegv: | 750 | sigsegv: |
728 | force_sigsegv(signr, current); | 751 | force_sigsegv(signr, current); |
752 | return -EFAULT; | ||
729 | } | 753 | } |
730 | 754 | ||
731 | static inline void handle_signal32(unsigned long signr, struct k_sigaction *ka, | 755 | static inline int handle_signal32(unsigned long signr, struct k_sigaction *ka, |
732 | siginfo_t *info, | 756 | siginfo_t *info, |
733 | sigset_t *oldset, struct pt_regs *regs) | 757 | sigset_t *oldset, struct pt_regs *regs) |
734 | { | 758 | { |
759 | int err; | ||
760 | |||
735 | if (ka->sa.sa_flags & SA_SIGINFO) | 761 | if (ka->sa.sa_flags & SA_SIGINFO) |
736 | setup_rt_frame32(ka, regs, signr, oldset, info); | 762 | err = setup_rt_frame32(ka, regs, signr, oldset, info); |
737 | else | 763 | else |
738 | setup_frame32(ka, regs, signr, oldset); | 764 | err = setup_frame32(ka, regs, signr, oldset); |
765 | |||
766 | if (err) | ||
767 | return err; | ||
739 | 768 | ||
740 | spin_lock_irq(¤t->sighand->siglock); | 769 | spin_lock_irq(¤t->sighand->siglock); |
741 | sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); | 770 | sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); |
@@ -743,6 +772,10 @@ static inline void handle_signal32(unsigned long signr, struct k_sigaction *ka, | |||
743 | sigaddset(¤t->blocked,signr); | 772 | sigaddset(¤t->blocked,signr); |
744 | recalc_sigpending(); | 773 | recalc_sigpending(); |
745 | spin_unlock_irq(¤t->sighand->siglock); | 774 | spin_unlock_irq(¤t->sighand->siglock); |
775 | |||
776 | tracehook_signal_handler(signr, info, ka, regs, 0); | ||
777 | |||
778 | return 0; | ||
746 | } | 779 | } |
747 | 780 | ||
748 | static inline void syscall_restart32(unsigned long orig_i0, struct pt_regs *regs, | 781 | static inline void syscall_restart32(unsigned long orig_i0, struct pt_regs *regs, |
@@ -789,16 +822,14 @@ void do_signal32(sigset_t *oldset, struct pt_regs * regs, | |||
789 | if (signr > 0) { | 822 | if (signr > 0) { |
790 | if (restart_syscall) | 823 | if (restart_syscall) |
791 | syscall_restart32(orig_i0, regs, &ka.sa); | 824 | syscall_restart32(orig_i0, regs, &ka.sa); |
792 | handle_signal32(signr, &ka, &info, oldset, regs); | 825 | if (handle_signal32(signr, &ka, &info, oldset, regs) == 0) { |
793 | 826 | /* A signal was successfully delivered; the saved | |
794 | /* A signal was successfully delivered; the saved | 827 | * sigmask will have been stored in the signal frame, |
795 | * sigmask will have been stored in the signal frame, | 828 | * and will be restored by sigreturn, so we can simply |
796 | * and will be restored by sigreturn, so we can simply | 829 | * clear the TS_RESTORE_SIGMASK flag. |
797 | * clear the TS_RESTORE_SIGMASK flag. | 830 | */ |
798 | */ | 831 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; |
799 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | 832 | } |
800 | |||
801 | tracehook_signal_handler(signr, &info, &ka, regs, 0); | ||
802 | return; | 833 | return; |
803 | } | 834 | } |
804 | if (restart_syscall && | 835 | if (restart_syscall && |
@@ -809,12 +840,14 @@ void do_signal32(sigset_t *oldset, struct pt_regs * regs, | |||
809 | regs->u_regs[UREG_I0] = orig_i0; | 840 | regs->u_regs[UREG_I0] = orig_i0; |
810 | regs->tpc -= 4; | 841 | regs->tpc -= 4; |
811 | regs->tnpc -= 4; | 842 | regs->tnpc -= 4; |
843 | pt_regs_clear_syscall(regs); | ||
812 | } | 844 | } |
813 | if (restart_syscall && | 845 | if (restart_syscall && |
814 | regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) { | 846 | regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) { |
815 | regs->u_regs[UREG_G1] = __NR_restart_syscall; | 847 | regs->u_regs[UREG_G1] = __NR_restart_syscall; |
816 | regs->tpc -= 4; | 848 | regs->tpc -= 4; |
817 | regs->tnpc -= 4; | 849 | regs->tnpc -= 4; |
850 | pt_regs_clear_syscall(regs); | ||
818 | } | 851 | } |
819 | 852 | ||
820 | /* If there's no signal to deliver, we just put the saved sigmask | 853 | /* If there's no signal to deliver, we just put the saved sigmask |
diff --git a/arch/sparc/kernel/signal_32.c b/arch/sparc/kernel/signal_32.c index 9882df92ba0a..5e5c5fd03783 100644 --- a/arch/sparc/kernel/signal_32.c +++ b/arch/sparc/kernel/signal_32.c | |||
@@ -315,8 +315,8 @@ save_fpu_state(struct pt_regs *regs, __siginfo_fpu_t __user *fpu) | |||
315 | return err; | 315 | return err; |
316 | } | 316 | } |
317 | 317 | ||
318 | static void setup_frame(struct k_sigaction *ka, struct pt_regs *regs, | 318 | static int setup_frame(struct k_sigaction *ka, struct pt_regs *regs, |
319 | int signo, sigset_t *oldset) | 319 | int signo, sigset_t *oldset) |
320 | { | 320 | { |
321 | struct signal_frame __user *sf; | 321 | struct signal_frame __user *sf; |
322 | int sigframe_size, err; | 322 | int sigframe_size, err; |
@@ -384,16 +384,19 @@ static void setup_frame(struct k_sigaction *ka, struct pt_regs *regs, | |||
384 | /* Flush instruction space. */ | 384 | /* Flush instruction space. */ |
385 | flush_sig_insns(current->mm, (unsigned long) &(sf->insns[0])); | 385 | flush_sig_insns(current->mm, (unsigned long) &(sf->insns[0])); |
386 | } | 386 | } |
387 | return; | 387 | return 0; |
388 | 388 | ||
389 | sigill_and_return: | 389 | sigill_and_return: |
390 | do_exit(SIGILL); | 390 | do_exit(SIGILL); |
391 | return -EINVAL; | ||
392 | |||
391 | sigsegv: | 393 | sigsegv: |
392 | force_sigsegv(signo, current); | 394 | force_sigsegv(signo, current); |
395 | return -EFAULT; | ||
393 | } | 396 | } |
394 | 397 | ||
395 | static void setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs, | 398 | static int setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs, |
396 | int signo, sigset_t *oldset, siginfo_t *info) | 399 | int signo, sigset_t *oldset, siginfo_t *info) |
397 | { | 400 | { |
398 | struct rt_signal_frame __user *sf; | 401 | struct rt_signal_frame __user *sf; |
399 | int sigframe_size; | 402 | int sigframe_size; |
@@ -466,22 +469,30 @@ static void setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs, | |||
466 | /* Flush instruction space. */ | 469 | /* Flush instruction space. */ |
467 | flush_sig_insns(current->mm, (unsigned long) &(sf->insns[0])); | 470 | flush_sig_insns(current->mm, (unsigned long) &(sf->insns[0])); |
468 | } | 471 | } |
469 | return; | 472 | return 0; |
470 | 473 | ||
471 | sigill: | 474 | sigill: |
472 | do_exit(SIGILL); | 475 | do_exit(SIGILL); |
476 | return -EINVAL; | ||
477 | |||
473 | sigsegv: | 478 | sigsegv: |
474 | force_sigsegv(signo, current); | 479 | force_sigsegv(signo, current); |
480 | return -EFAULT; | ||
475 | } | 481 | } |
476 | 482 | ||
477 | static inline void | 483 | static inline int |
478 | handle_signal(unsigned long signr, struct k_sigaction *ka, | 484 | handle_signal(unsigned long signr, struct k_sigaction *ka, |
479 | siginfo_t *info, sigset_t *oldset, struct pt_regs *regs) | 485 | siginfo_t *info, sigset_t *oldset, struct pt_regs *regs) |
480 | { | 486 | { |
487 | int err; | ||
488 | |||
481 | if (ka->sa.sa_flags & SA_SIGINFO) | 489 | if (ka->sa.sa_flags & SA_SIGINFO) |
482 | setup_rt_frame(ka, regs, signr, oldset, info); | 490 | err = setup_rt_frame(ka, regs, signr, oldset, info); |
483 | else | 491 | else |
484 | setup_frame(ka, regs, signr, oldset); | 492 | err = setup_frame(ka, regs, signr, oldset); |
493 | |||
494 | if (err) | ||
495 | return err; | ||
485 | 496 | ||
486 | spin_lock_irq(¤t->sighand->siglock); | 497 | spin_lock_irq(¤t->sighand->siglock); |
487 | sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); | 498 | sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); |
@@ -489,6 +500,10 @@ handle_signal(unsigned long signr, struct k_sigaction *ka, | |||
489 | sigaddset(¤t->blocked, signr); | 500 | sigaddset(¤t->blocked, signr); |
490 | recalc_sigpending(); | 501 | recalc_sigpending(); |
491 | spin_unlock_irq(¤t->sighand->siglock); | 502 | spin_unlock_irq(¤t->sighand->siglock); |
503 | |||
504 | tracehook_signal_handler(signr, info, ka, regs, 0); | ||
505 | |||
506 | return 0; | ||
492 | } | 507 | } |
493 | 508 | ||
494 | static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs, | 509 | static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs, |
@@ -546,17 +561,15 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0) | |||
546 | if (signr > 0) { | 561 | if (signr > 0) { |
547 | if (restart_syscall) | 562 | if (restart_syscall) |
548 | syscall_restart(orig_i0, regs, &ka.sa); | 563 | syscall_restart(orig_i0, regs, &ka.sa); |
549 | handle_signal(signr, &ka, &info, oldset, regs); | 564 | if (handle_signal(signr, &ka, &info, oldset, regs) == 0) { |
550 | 565 | /* a signal was successfully delivered; the saved | |
551 | /* a signal was successfully delivered; the saved | 566 | * sigmask will have been stored in the signal frame, |
552 | * sigmask will have been stored in the signal frame, | 567 | * and will be restored by sigreturn, so we can simply |
553 | * and will be restored by sigreturn, so we can simply | 568 | * clear the TIF_RESTORE_SIGMASK flag. |
554 | * clear the TIF_RESTORE_SIGMASK flag. | 569 | */ |
555 | */ | 570 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) |
556 | if (test_thread_flag(TIF_RESTORE_SIGMASK)) | 571 | clear_thread_flag(TIF_RESTORE_SIGMASK); |
557 | clear_thread_flag(TIF_RESTORE_SIGMASK); | 572 | } |
558 | |||
559 | tracehook_signal_handler(signr, &info, &ka, regs, 0); | ||
560 | return; | 573 | return; |
561 | } | 574 | } |
562 | if (restart_syscall && | 575 | if (restart_syscall && |
@@ -567,12 +580,14 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0) | |||
567 | regs->u_regs[UREG_I0] = orig_i0; | 580 | regs->u_regs[UREG_I0] = orig_i0; |
568 | regs->pc -= 4; | 581 | regs->pc -= 4; |
569 | regs->npc -= 4; | 582 | regs->npc -= 4; |
583 | pt_regs_clear_syscall(regs); | ||
570 | } | 584 | } |
571 | if (restart_syscall && | 585 | if (restart_syscall && |
572 | regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) { | 586 | regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) { |
573 | regs->u_regs[UREG_G1] = __NR_restart_syscall; | 587 | regs->u_regs[UREG_G1] = __NR_restart_syscall; |
574 | regs->pc -= 4; | 588 | regs->pc -= 4; |
575 | regs->npc -= 4; | 589 | regs->npc -= 4; |
590 | pt_regs_clear_syscall(regs); | ||
576 | } | 591 | } |
577 | 592 | ||
578 | /* if there's no signal to deliver, we just put the saved sigmask | 593 | /* if there's no signal to deliver, we just put the saved sigmask |
diff --git a/arch/sparc/kernel/signal_64.c b/arch/sparc/kernel/signal_64.c index 9fa48c30037e..006fe4515886 100644 --- a/arch/sparc/kernel/signal_64.c +++ b/arch/sparc/kernel/signal_64.c | |||
@@ -409,7 +409,7 @@ static inline void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs * | |||
409 | return (void __user *) sp; | 409 | return (void __user *) sp; |
410 | } | 410 | } |
411 | 411 | ||
412 | static inline void | 412 | static inline int |
413 | setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs, | 413 | setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs, |
414 | int signo, sigset_t *oldset, siginfo_t *info) | 414 | int signo, sigset_t *oldset, siginfo_t *info) |
415 | { | 415 | { |
@@ -483,26 +483,37 @@ setup_rt_frame(struct k_sigaction *ka, struct pt_regs *regs, | |||
483 | } | 483 | } |
484 | /* 4. return to kernel instructions */ | 484 | /* 4. return to kernel instructions */ |
485 | regs->u_regs[UREG_I7] = (unsigned long)ka->ka_restorer; | 485 | regs->u_regs[UREG_I7] = (unsigned long)ka->ka_restorer; |
486 | return; | 486 | return 0; |
487 | 487 | ||
488 | sigill: | 488 | sigill: |
489 | do_exit(SIGILL); | 489 | do_exit(SIGILL); |
490 | return -EINVAL; | ||
491 | |||
490 | sigsegv: | 492 | sigsegv: |
491 | force_sigsegv(signo, current); | 493 | force_sigsegv(signo, current); |
494 | return -EFAULT; | ||
492 | } | 495 | } |
493 | 496 | ||
494 | static inline void handle_signal(unsigned long signr, struct k_sigaction *ka, | 497 | static inline int handle_signal(unsigned long signr, struct k_sigaction *ka, |
495 | siginfo_t *info, | 498 | siginfo_t *info, |
496 | sigset_t *oldset, struct pt_regs *regs) | 499 | sigset_t *oldset, struct pt_regs *regs) |
497 | { | 500 | { |
498 | setup_rt_frame(ka, regs, signr, oldset, | 501 | int err; |
499 | (ka->sa.sa_flags & SA_SIGINFO) ? info : NULL); | 502 | |
503 | err = setup_rt_frame(ka, regs, signr, oldset, | ||
504 | (ka->sa.sa_flags & SA_SIGINFO) ? info : NULL); | ||
505 | if (err) | ||
506 | return err; | ||
500 | spin_lock_irq(¤t->sighand->siglock); | 507 | spin_lock_irq(¤t->sighand->siglock); |
501 | sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); | 508 | sigorsets(¤t->blocked,¤t->blocked,&ka->sa.sa_mask); |
502 | if (!(ka->sa.sa_flags & SA_NOMASK)) | 509 | if (!(ka->sa.sa_flags & SA_NOMASK)) |
503 | sigaddset(¤t->blocked,signr); | 510 | sigaddset(¤t->blocked,signr); |
504 | recalc_sigpending(); | 511 | recalc_sigpending(); |
505 | spin_unlock_irq(¤t->sighand->siglock); | 512 | spin_unlock_irq(¤t->sighand->siglock); |
513 | |||
514 | tracehook_signal_handler(signr, info, ka, regs, 0); | ||
515 | |||
516 | return 0; | ||
506 | } | 517 | } |
507 | 518 | ||
508 | static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs, | 519 | static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs, |
@@ -571,16 +582,14 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0) | |||
571 | if (signr > 0) { | 582 | if (signr > 0) { |
572 | if (restart_syscall) | 583 | if (restart_syscall) |
573 | syscall_restart(orig_i0, regs, &ka.sa); | 584 | syscall_restart(orig_i0, regs, &ka.sa); |
574 | handle_signal(signr, &ka, &info, oldset, regs); | 585 | if (handle_signal(signr, &ka, &info, oldset, regs) == 0) { |
575 | 586 | /* A signal was successfully delivered; the saved | |
576 | /* A signal was successfully delivered; the saved | 587 | * sigmask will have been stored in the signal frame, |
577 | * sigmask will have been stored in the signal frame, | 588 | * and will be restored by sigreturn, so we can simply |
578 | * and will be restored by sigreturn, so we can simply | 589 | * clear the TS_RESTORE_SIGMASK flag. |
579 | * clear the TS_RESTORE_SIGMASK flag. | 590 | */ |
580 | */ | 591 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; |
581 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | 592 | } |
582 | |||
583 | tracehook_signal_handler(signr, &info, &ka, regs, 0); | ||
584 | return; | 593 | return; |
585 | } | 594 | } |
586 | if (restart_syscall && | 595 | if (restart_syscall && |
@@ -591,12 +600,14 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0) | |||
591 | regs->u_regs[UREG_I0] = orig_i0; | 600 | regs->u_regs[UREG_I0] = orig_i0; |
592 | regs->tpc -= 4; | 601 | regs->tpc -= 4; |
593 | regs->tnpc -= 4; | 602 | regs->tnpc -= 4; |
603 | pt_regs_clear_syscall(regs); | ||
594 | } | 604 | } |
595 | if (restart_syscall && | 605 | if (restart_syscall && |
596 | regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) { | 606 | regs->u_regs[UREG_I0] == ERESTART_RESTARTBLOCK) { |
597 | regs->u_regs[UREG_G1] = __NR_restart_syscall; | 607 | regs->u_regs[UREG_G1] = __NR_restart_syscall; |
598 | regs->tpc -= 4; | 608 | regs->tpc -= 4; |
599 | regs->tnpc -= 4; | 609 | regs->tnpc -= 4; |
610 | pt_regs_clear_syscall(regs); | ||
600 | } | 611 | } |
601 | 612 | ||
602 | /* If there's no signal to deliver, we just put the saved sigmask | 613 | /* If there's no signal to deliver, we just put the saved sigmask |
diff --git a/arch/tile/include/asm/compat.h b/arch/tile/include/asm/compat.h index 070ad0a5ef1c..8b60ec8b2d19 100644 --- a/arch/tile/include/asm/compat.h +++ b/arch/tile/include/asm/compat.h | |||
@@ -195,7 +195,7 @@ static inline unsigned long ptr_to_compat_reg(void __user *uptr) | |||
195 | return (long)(int)(long __force)uptr; | 195 | return (long)(int)(long __force)uptr; |
196 | } | 196 | } |
197 | 197 | ||
198 | static inline void __user *compat_alloc_user_space(long len) | 198 | static inline void __user *arch_compat_alloc_user_space(long len) |
199 | { | 199 | { |
200 | struct pt_regs *regs = task_pt_regs(current); | 200 | struct pt_regs *regs = task_pt_regs(current); |
201 | return (void __user *)regs->sp - len; | 201 | return (void __user *)regs->sp - len; |
diff --git a/arch/um/kernel/exec.c b/arch/um/kernel/exec.c index cd145eda3579..49b5e1eb3262 100644 --- a/arch/um/kernel/exec.c +++ b/arch/um/kernel/exec.c | |||
@@ -62,7 +62,7 @@ static long execve1(const char *file, | |||
62 | return error; | 62 | return error; |
63 | } | 63 | } |
64 | 64 | ||
65 | long um_execve(const char *file, char __user *__user *argv, char __user *__user *env) | 65 | long um_execve(const char *file, const char __user *const __user *argv, const char __user *const __user *env) |
66 | { | 66 | { |
67 | long err; | 67 | long err; |
68 | 68 | ||
@@ -72,8 +72,8 @@ long um_execve(const char *file, char __user *__user *argv, char __user *__user | |||
72 | return err; | 72 | return err; |
73 | } | 73 | } |
74 | 74 | ||
75 | long sys_execve(const char __user *file, char __user *__user *argv, | 75 | long sys_execve(const char __user *file, const char __user *const __user *argv, |
76 | char __user *__user *env) | 76 | const char __user *const __user *env) |
77 | { | 77 | { |
78 | long error; | 78 | long error; |
79 | char *filename; | 79 | char *filename; |
diff --git a/arch/um/kernel/internal.h b/arch/um/kernel/internal.h index 1303a105fe91..5bf97db24a04 100644 --- a/arch/um/kernel/internal.h +++ b/arch/um/kernel/internal.h | |||
@@ -1 +1 @@ | |||
extern long um_execve(const char *file, char __user *__user *argv, char __user *__user *env); | extern long um_execve(const char *file, const char __user *const __user *argv, const char __user *const __user *env); | ||
diff --git a/arch/um/kernel/syscall.c b/arch/um/kernel/syscall.c index 5ddb246626db..f958cb876ee3 100644 --- a/arch/um/kernel/syscall.c +++ b/arch/um/kernel/syscall.c | |||
@@ -60,8 +60,8 @@ int kernel_execve(const char *filename, | |||
60 | 60 | ||
61 | fs = get_fs(); | 61 | fs = get_fs(); |
62 | set_fs(KERNEL_DS); | 62 | set_fs(KERNEL_DS); |
63 | ret = um_execve(filename, (char __user *__user *)argv, | 63 | ret = um_execve(filename, (const char __user *const __user *)argv, |
64 | (char __user *__user *) envp); | 64 | (const char __user *const __user *) envp); |
65 | set_fs(fs); | 65 | set_fs(fs); |
66 | 66 | ||
67 | return ret; | 67 | return ret; |
diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 8aa1b59b9074..e8c8881351b3 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile | |||
@@ -74,7 +74,7 @@ endif | |||
74 | 74 | ||
75 | ifdef CONFIG_CC_STACKPROTECTOR | 75 | ifdef CONFIG_CC_STACKPROTECTOR |
76 | cc_has_sp := $(srctree)/scripts/gcc-x86_$(BITS)-has-stack-protector.sh | 76 | cc_has_sp := $(srctree)/scripts/gcc-x86_$(BITS)-has-stack-protector.sh |
77 | ifeq ($(shell $(CONFIG_SHELL) $(cc_has_sp) $(CC) $(biarch)),y) | 77 | ifeq ($(shell $(CONFIG_SHELL) $(cc_has_sp) $(CC) $(KBUILD_CPPFLAGS) $(biarch)),y) |
78 | stackp-y := -fstack-protector | 78 | stackp-y := -fstack-protector |
79 | KBUILD_CFLAGS += $(stackp-y) | 79 | KBUILD_CFLAGS += $(stackp-y) |
80 | else | 80 | else |
diff --git a/arch/x86/ia32/ia32entry.S b/arch/x86/ia32/ia32entry.S index b86feabed69b..518bb99c3394 100644 --- a/arch/x86/ia32/ia32entry.S +++ b/arch/x86/ia32/ia32entry.S | |||
@@ -50,7 +50,12 @@ | |||
50 | /* | 50 | /* |
51 | * Reload arg registers from stack in case ptrace changed them. | 51 | * Reload arg registers from stack in case ptrace changed them. |
52 | * We don't reload %eax because syscall_trace_enter() returned | 52 | * We don't reload %eax because syscall_trace_enter() returned |
53 | * the value it wants us to use in the table lookup. | 53 | * the %rax value we should see. Instead, we just truncate that |
54 | * value to 32 bits again as we did on entry from user mode. | ||
55 | * If it's a new value set by user_regset during entry tracing, | ||
56 | * this matches the normal truncation of the user-mode value. | ||
57 | * If it's -1 to make us punt the syscall, then (u32)-1 is still | ||
58 | * an appropriately invalid value. | ||
54 | */ | 59 | */ |
55 | .macro LOAD_ARGS32 offset, _r9=0 | 60 | .macro LOAD_ARGS32 offset, _r9=0 |
56 | .if \_r9 | 61 | .if \_r9 |
@@ -60,6 +65,7 @@ | |||
60 | movl \offset+48(%rsp),%edx | 65 | movl \offset+48(%rsp),%edx |
61 | movl \offset+56(%rsp),%esi | 66 | movl \offset+56(%rsp),%esi |
62 | movl \offset+64(%rsp),%edi | 67 | movl \offset+64(%rsp),%edi |
68 | movl %eax,%eax /* zero extension */ | ||
63 | .endm | 69 | .endm |
64 | 70 | ||
65 | .macro CFI_STARTPROC32 simple | 71 | .macro CFI_STARTPROC32 simple |
@@ -153,7 +159,7 @@ ENTRY(ia32_sysenter_target) | |||
153 | testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10) | 159 | testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10) |
154 | CFI_REMEMBER_STATE | 160 | CFI_REMEMBER_STATE |
155 | jnz sysenter_tracesys | 161 | jnz sysenter_tracesys |
156 | cmpl $(IA32_NR_syscalls-1),%eax | 162 | cmpq $(IA32_NR_syscalls-1),%rax |
157 | ja ia32_badsys | 163 | ja ia32_badsys |
158 | sysenter_do_call: | 164 | sysenter_do_call: |
159 | IA32_ARG_FIXUP | 165 | IA32_ARG_FIXUP |
@@ -195,7 +201,7 @@ sysexit_from_sys_call: | |||
195 | movl $AUDIT_ARCH_I386,%edi /* 1st arg: audit arch */ | 201 | movl $AUDIT_ARCH_I386,%edi /* 1st arg: audit arch */ |
196 | call audit_syscall_entry | 202 | call audit_syscall_entry |
197 | movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall number */ | 203 | movl RAX-ARGOFFSET(%rsp),%eax /* reload syscall number */ |
198 | cmpl $(IA32_NR_syscalls-1),%eax | 204 | cmpq $(IA32_NR_syscalls-1),%rax |
199 | ja ia32_badsys | 205 | ja ia32_badsys |
200 | movl %ebx,%edi /* reload 1st syscall arg */ | 206 | movl %ebx,%edi /* reload 1st syscall arg */ |
201 | movl RCX-ARGOFFSET(%rsp),%esi /* reload 2nd syscall arg */ | 207 | movl RCX-ARGOFFSET(%rsp),%esi /* reload 2nd syscall arg */ |
@@ -248,7 +254,7 @@ sysenter_tracesys: | |||
248 | call syscall_trace_enter | 254 | call syscall_trace_enter |
249 | LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */ | 255 | LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */ |
250 | RESTORE_REST | 256 | RESTORE_REST |
251 | cmpl $(IA32_NR_syscalls-1),%eax | 257 | cmpq $(IA32_NR_syscalls-1),%rax |
252 | ja int_ret_from_sys_call /* sysenter_tracesys has set RAX(%rsp) */ | 258 | ja int_ret_from_sys_call /* sysenter_tracesys has set RAX(%rsp) */ |
253 | jmp sysenter_do_call | 259 | jmp sysenter_do_call |
254 | CFI_ENDPROC | 260 | CFI_ENDPROC |
@@ -314,7 +320,7 @@ ENTRY(ia32_cstar_target) | |||
314 | testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10) | 320 | testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10) |
315 | CFI_REMEMBER_STATE | 321 | CFI_REMEMBER_STATE |
316 | jnz cstar_tracesys | 322 | jnz cstar_tracesys |
317 | cmpl $IA32_NR_syscalls-1,%eax | 323 | cmpq $IA32_NR_syscalls-1,%rax |
318 | ja ia32_badsys | 324 | ja ia32_badsys |
319 | cstar_do_call: | 325 | cstar_do_call: |
320 | IA32_ARG_FIXUP 1 | 326 | IA32_ARG_FIXUP 1 |
@@ -367,7 +373,7 @@ cstar_tracesys: | |||
367 | LOAD_ARGS32 ARGOFFSET, 1 /* reload args from stack in case ptrace changed it */ | 373 | LOAD_ARGS32 ARGOFFSET, 1 /* reload args from stack in case ptrace changed it */ |
368 | RESTORE_REST | 374 | RESTORE_REST |
369 | xchgl %ebp,%r9d | 375 | xchgl %ebp,%r9d |
370 | cmpl $(IA32_NR_syscalls-1),%eax | 376 | cmpq $(IA32_NR_syscalls-1),%rax |
371 | ja int_ret_from_sys_call /* cstar_tracesys has set RAX(%rsp) */ | 377 | ja int_ret_from_sys_call /* cstar_tracesys has set RAX(%rsp) */ |
372 | jmp cstar_do_call | 378 | jmp cstar_do_call |
373 | END(ia32_cstar_target) | 379 | END(ia32_cstar_target) |
@@ -425,7 +431,7 @@ ENTRY(ia32_syscall) | |||
425 | orl $TS_COMPAT,TI_status(%r10) | 431 | orl $TS_COMPAT,TI_status(%r10) |
426 | testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10) | 432 | testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10) |
427 | jnz ia32_tracesys | 433 | jnz ia32_tracesys |
428 | cmpl $(IA32_NR_syscalls-1),%eax | 434 | cmpq $(IA32_NR_syscalls-1),%rax |
429 | ja ia32_badsys | 435 | ja ia32_badsys |
430 | ia32_do_call: | 436 | ia32_do_call: |
431 | IA32_ARG_FIXUP | 437 | IA32_ARG_FIXUP |
@@ -444,7 +450,7 @@ ia32_tracesys: | |||
444 | call syscall_trace_enter | 450 | call syscall_trace_enter |
445 | LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */ | 451 | LOAD_ARGS32 ARGOFFSET /* reload args from stack in case ptrace changed it */ |
446 | RESTORE_REST | 452 | RESTORE_REST |
447 | cmpl $(IA32_NR_syscalls-1),%eax | 453 | cmpq $(IA32_NR_syscalls-1),%rax |
448 | ja int_ret_from_sys_call /* ia32_tracesys has set RAX(%rsp) */ | 454 | ja int_ret_from_sys_call /* ia32_tracesys has set RAX(%rsp) */ |
449 | jmp ia32_do_call | 455 | jmp ia32_do_call |
450 | END(ia32_syscall) | 456 | END(ia32_syscall) |
diff --git a/arch/x86/include/asm/compat.h b/arch/x86/include/asm/compat.h index 306160e58b48..1d9cd27c2920 100644 --- a/arch/x86/include/asm/compat.h +++ b/arch/x86/include/asm/compat.h | |||
@@ -205,7 +205,7 @@ static inline compat_uptr_t ptr_to_compat(void __user *uptr) | |||
205 | return (u32)(unsigned long)uptr; | 205 | return (u32)(unsigned long)uptr; |
206 | } | 206 | } |
207 | 207 | ||
208 | static inline void __user *compat_alloc_user_space(long len) | 208 | static inline void __user *arch_compat_alloc_user_space(long len) |
209 | { | 209 | { |
210 | struct pt_regs *regs = task_pt_regs(current); | 210 | struct pt_regs *regs = task_pt_regs(current); |
211 | return (void __user *)regs->sp - len; | 211 | return (void __user *)regs->sp - len; |
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h index 781a50b29a49..c6fbb7b430d1 100644 --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h | |||
@@ -296,6 +296,7 @@ extern const char * const x86_power_flags[32]; | |||
296 | 296 | ||
297 | #endif /* CONFIG_X86_64 */ | 297 | #endif /* CONFIG_X86_64 */ |
298 | 298 | ||
299 | #if __GNUC__ >= 4 | ||
299 | /* | 300 | /* |
300 | * Static testing of CPU features. Used the same as boot_cpu_has(). | 301 | * Static testing of CPU features. Used the same as boot_cpu_has(). |
301 | * These are only valid after alternatives have run, but will statically | 302 | * These are only valid after alternatives have run, but will statically |
@@ -304,7 +305,7 @@ extern const char * const x86_power_flags[32]; | |||
304 | */ | 305 | */ |
305 | static __always_inline __pure bool __static_cpu_has(u16 bit) | 306 | static __always_inline __pure bool __static_cpu_has(u16 bit) |
306 | { | 307 | { |
307 | #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) | 308 | #if __GNUC__ > 4 || __GNUC_MINOR__ >= 5 |
308 | asm goto("1: jmp %l[t_no]\n" | 309 | asm goto("1: jmp %l[t_no]\n" |
309 | "2:\n" | 310 | "2:\n" |
310 | ".section .altinstructions,\"a\"\n" | 311 | ".section .altinstructions,\"a\"\n" |
@@ -345,7 +346,6 @@ static __always_inline __pure bool __static_cpu_has(u16 bit) | |||
345 | #endif | 346 | #endif |
346 | } | 347 | } |
347 | 348 | ||
348 | #if __GNUC__ >= 4 | ||
349 | #define static_cpu_has(bit) \ | 349 | #define static_cpu_has(bit) \ |
350 | ( \ | 350 | ( \ |
351 | __builtin_constant_p(boot_cpu_has(bit)) ? \ | 351 | __builtin_constant_p(boot_cpu_has(bit)) ? \ |
diff --git a/arch/x86/include/asm/hpet.h b/arch/x86/include/asm/hpet.h index 004e6e25e913..1d5c08a1bdfd 100644 --- a/arch/x86/include/asm/hpet.h +++ b/arch/x86/include/asm/hpet.h | |||
@@ -68,7 +68,6 @@ extern unsigned long force_hpet_address; | |||
68 | extern u8 hpet_blockid; | 68 | extern u8 hpet_blockid; |
69 | extern int hpet_force_user; | 69 | extern int hpet_force_user; |
70 | extern u8 hpet_msi_disable; | 70 | extern u8 hpet_msi_disable; |
71 | extern u8 hpet_readback_cmp; | ||
72 | extern int is_hpet_enabled(void); | 71 | extern int is_hpet_enabled(void); |
73 | extern int hpet_enable(void); | 72 | extern int hpet_enable(void); |
74 | extern void hpet_disable(void); | 73 | extern void hpet_disable(void); |
diff --git a/arch/x86/include/asm/hw_breakpoint.h b/arch/x86/include/asm/hw_breakpoint.h index 528a11e8d3e3..824ca07860d0 100644 --- a/arch/x86/include/asm/hw_breakpoint.h +++ b/arch/x86/include/asm/hw_breakpoint.h | |||
@@ -20,7 +20,7 @@ struct arch_hw_breakpoint { | |||
20 | #include <linux/list.h> | 20 | #include <linux/list.h> |
21 | 21 | ||
22 | /* Available HW breakpoint length encodings */ | 22 | /* Available HW breakpoint length encodings */ |
23 | #define X86_BREAKPOINT_LEN_X 0x00 | 23 | #define X86_BREAKPOINT_LEN_X 0x40 |
24 | #define X86_BREAKPOINT_LEN_1 0x40 | 24 | #define X86_BREAKPOINT_LEN_1 0x40 |
25 | #define X86_BREAKPOINT_LEN_2 0x44 | 25 | #define X86_BREAKPOINT_LEN_2 0x44 |
26 | #define X86_BREAKPOINT_LEN_4 0x4c | 26 | #define X86_BREAKPOINT_LEN_4 0x4c |
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c index 7b598b84c902..f744f54cb248 100644 --- a/arch/x86/kernel/apic/x2apic_uv_x.c +++ b/arch/x86/kernel/apic/x2apic_uv_x.c | |||
@@ -698,9 +698,11 @@ void __init uv_system_init(void) | |||
698 | for (j = 0; j < 64; j++) { | 698 | for (j = 0; j < 64; j++) { |
699 | if (!test_bit(j, &present)) | 699 | if (!test_bit(j, &present)) |
700 | continue; | 700 | continue; |
701 | uv_blade_info[blade].pnode = (i * 64 + j); | 701 | pnode = (i * 64 + j); |
702 | uv_blade_info[blade].pnode = pnode; | ||
702 | uv_blade_info[blade].nr_possible_cpus = 0; | 703 | uv_blade_info[blade].nr_possible_cpus = 0; |
703 | uv_blade_info[blade].nr_online_cpus = 0; | 704 | uv_blade_info[blade].nr_online_cpus = 0; |
705 | max_pnode = max(pnode, max_pnode); | ||
704 | blade++; | 706 | blade++; |
705 | } | 707 | } |
706 | } | 708 | } |
@@ -738,7 +740,6 @@ void __init uv_system_init(void) | |||
738 | uv_cpu_hub_info(cpu)->scir.offset = uv_scir_offset(apicid); | 740 | uv_cpu_hub_info(cpu)->scir.offset = uv_scir_offset(apicid); |
739 | uv_node_to_blade[nid] = blade; | 741 | uv_node_to_blade[nid] = blade; |
740 | uv_cpu_to_blade[cpu] = blade; | 742 | uv_cpu_to_blade[cpu] = blade; |
741 | max_pnode = max(pnode, max_pnode); | ||
742 | } | 743 | } |
743 | 744 | ||
744 | /* Add blade/pnode info for nodes without cpus */ | 745 | /* Add blade/pnode info for nodes without cpus */ |
@@ -750,7 +751,6 @@ void __init uv_system_init(void) | |||
750 | pnode = (paddr >> m_val) & pnode_mask; | 751 | pnode = (paddr >> m_val) & pnode_mask; |
751 | blade = boot_pnode_to_blade(pnode); | 752 | blade = boot_pnode_to_blade(pnode); |
752 | uv_node_to_blade[nid] = blade; | 753 | uv_node_to_blade[nid] = blade; |
753 | max_pnode = max(pnode, max_pnode); | ||
754 | } | 754 | } |
755 | 755 | ||
756 | map_gru_high(max_pnode); | 756 | map_gru_high(max_pnode); |
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c index e5cc7e82e60d..ebdb85cf2686 100644 --- a/arch/x86/kernel/early-quirks.c +++ b/arch/x86/kernel/early-quirks.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <asm/apic.h> | 18 | #include <asm/apic.h> |
19 | #include <asm/iommu.h> | 19 | #include <asm/iommu.h> |
20 | #include <asm/gart.h> | 20 | #include <asm/gart.h> |
21 | #include <asm/hpet.h> | ||
22 | 21 | ||
23 | static void __init fix_hypertransport_config(int num, int slot, int func) | 22 | static void __init fix_hypertransport_config(int num, int slot, int func) |
24 | { | 23 | { |
@@ -192,21 +191,6 @@ static void __init ati_bugs_contd(int num, int slot, int func) | |||
192 | } | 191 | } |
193 | #endif | 192 | #endif |
194 | 193 | ||
195 | /* | ||
196 | * Force the read back of the CMP register in hpet_next_event() | ||
197 | * to work around the problem that the CMP register write seems to be | ||
198 | * delayed. See hpet_next_event() for details. | ||
199 | * | ||
200 | * We do this on all SMBUS incarnations for now until we have more | ||
201 | * information about the affected chipsets. | ||
202 | */ | ||
203 | static void __init ati_hpet_bugs(int num, int slot, int func) | ||
204 | { | ||
205 | #ifdef CONFIG_HPET_TIMER | ||
206 | hpet_readback_cmp = 1; | ||
207 | #endif | ||
208 | } | ||
209 | |||
210 | #define QFLAG_APPLY_ONCE 0x1 | 194 | #define QFLAG_APPLY_ONCE 0x1 |
211 | #define QFLAG_APPLIED 0x2 | 195 | #define QFLAG_APPLIED 0x2 |
212 | #define QFLAG_DONE (QFLAG_APPLY_ONCE|QFLAG_APPLIED) | 196 | #define QFLAG_DONE (QFLAG_APPLY_ONCE|QFLAG_APPLIED) |
@@ -236,8 +220,6 @@ static struct chipset early_qrk[] __initdata = { | |||
236 | PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs }, | 220 | PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs }, |
237 | { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS, | 221 | { PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_SBX00_SMBUS, |
238 | PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs_contd }, | 222 | PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_bugs_contd }, |
239 | { PCI_VENDOR_ID_ATI, PCI_ANY_ID, | ||
240 | PCI_CLASS_SERIAL_SMBUS, PCI_ANY_ID, 0, ati_hpet_bugs }, | ||
241 | {} | 223 | {} |
242 | }; | 224 | }; |
243 | 225 | ||
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index 351f9c0fea1f..410fdb3f1939 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c | |||
@@ -35,7 +35,6 @@ | |||
35 | unsigned long hpet_address; | 35 | unsigned long hpet_address; |
36 | u8 hpet_blockid; /* OS timer block num */ | 36 | u8 hpet_blockid; /* OS timer block num */ |
37 | u8 hpet_msi_disable; | 37 | u8 hpet_msi_disable; |
38 | u8 hpet_readback_cmp; | ||
39 | 38 | ||
40 | #ifdef CONFIG_PCI_MSI | 39 | #ifdef CONFIG_PCI_MSI |
41 | static unsigned long hpet_num_timers; | 40 | static unsigned long hpet_num_timers; |
@@ -395,23 +394,27 @@ static int hpet_next_event(unsigned long delta, | |||
395 | * at that point and we would wait for the next hpet interrupt | 394 | * at that point and we would wait for the next hpet interrupt |
396 | * forever. We found out that reading the CMP register back | 395 | * forever. We found out that reading the CMP register back |
397 | * forces the transfer so we can rely on the comparison with | 396 | * forces the transfer so we can rely on the comparison with |
398 | * the counter register below. | 397 | * the counter register below. If the read back from the |
398 | * compare register does not match the value we programmed | ||
399 | * then we might have a real hardware problem. We can not do | ||
400 | * much about it here, but at least alert the user/admin with | ||
401 | * a prominent warning. | ||
399 | * | 402 | * |
400 | * That works fine on those ATI chipsets, but on newer Intel | 403 | * An erratum on some chipsets (ICH9,..), results in |
401 | * chipsets (ICH9...) this triggers due to an erratum: Reading | 404 | * comparator read immediately following a write returning old |
402 | * the comparator immediately following a write is returning | 405 | * value. Workaround for this is to read this value second |
403 | * the old value. | 406 | * time, when first read returns old value. |
404 | * | 407 | * |
405 | * We restrict the read back to the affected ATI chipsets (set | 408 | * In fact the write to the comparator register is delayed up |
406 | * by quirks) and also run it with hpet=verbose for debugging | 409 | * to two HPET cycles so the workaround we tried to restrict |
407 | * purposes. | 410 | * the readback to those known to be borked ATI chipsets |
411 | * failed miserably. So we give up on optimizations forever | ||
412 | * and penalize all HPET incarnations unconditionally. | ||
408 | */ | 413 | */ |
409 | if (hpet_readback_cmp || hpet_verbose) { | 414 | if (unlikely((u32)hpet_readl(HPET_Tn_CMP(timer)) != cnt)) { |
410 | u32 cmp = hpet_readl(HPET_Tn_CMP(timer)); | 415 | if (hpet_readl(HPET_Tn_CMP(timer)) != cnt) |
411 | |||
412 | if (cmp != cnt) | ||
413 | printk_once(KERN_WARNING | 416 | printk_once(KERN_WARNING |
414 | "hpet: compare register read back failed.\n"); | 417 | "hpet: compare register read back failed.\n"); |
415 | } | 418 | } |
416 | 419 | ||
417 | return (s32)(hpet_readl(HPET_COUNTER) - cnt) >= 0 ? -ETIME : 0; | 420 | return (s32)(hpet_readl(HPET_COUNTER) - cnt) >= 0 ? -ETIME : 0; |
diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel/hw_breakpoint.c index a474ec37c32f..ff15c9dcc25d 100644 --- a/arch/x86/kernel/hw_breakpoint.c +++ b/arch/x86/kernel/hw_breakpoint.c | |||
@@ -206,11 +206,27 @@ int arch_check_bp_in_kernelspace(struct perf_event *bp) | |||
206 | int arch_bp_generic_fields(int x86_len, int x86_type, | 206 | int arch_bp_generic_fields(int x86_len, int x86_type, |
207 | int *gen_len, int *gen_type) | 207 | int *gen_len, int *gen_type) |
208 | { | 208 | { |
209 | /* Len */ | 209 | /* Type */ |
210 | switch (x86_len) { | 210 | switch (x86_type) { |
211 | case X86_BREAKPOINT_LEN_X: | 211 | case X86_BREAKPOINT_EXECUTE: |
212 | if (x86_len != X86_BREAKPOINT_LEN_X) | ||
213 | return -EINVAL; | ||
214 | |||
215 | *gen_type = HW_BREAKPOINT_X; | ||
212 | *gen_len = sizeof(long); | 216 | *gen_len = sizeof(long); |
217 | return 0; | ||
218 | case X86_BREAKPOINT_WRITE: | ||
219 | *gen_type = HW_BREAKPOINT_W; | ||
213 | break; | 220 | break; |
221 | case X86_BREAKPOINT_RW: | ||
222 | *gen_type = HW_BREAKPOINT_W | HW_BREAKPOINT_R; | ||
223 | break; | ||
224 | default: | ||
225 | return -EINVAL; | ||
226 | } | ||
227 | |||
228 | /* Len */ | ||
229 | switch (x86_len) { | ||
214 | case X86_BREAKPOINT_LEN_1: | 230 | case X86_BREAKPOINT_LEN_1: |
215 | *gen_len = HW_BREAKPOINT_LEN_1; | 231 | *gen_len = HW_BREAKPOINT_LEN_1; |
216 | break; | 232 | break; |
@@ -229,21 +245,6 @@ int arch_bp_generic_fields(int x86_len, int x86_type, | |||
229 | return -EINVAL; | 245 | return -EINVAL; |
230 | } | 246 | } |
231 | 247 | ||
232 | /* Type */ | ||
233 | switch (x86_type) { | ||
234 | case X86_BREAKPOINT_EXECUTE: | ||
235 | *gen_type = HW_BREAKPOINT_X; | ||
236 | break; | ||
237 | case X86_BREAKPOINT_WRITE: | ||
238 | *gen_type = HW_BREAKPOINT_W; | ||
239 | break; | ||
240 | case X86_BREAKPOINT_RW: | ||
241 | *gen_type = HW_BREAKPOINT_W | HW_BREAKPOINT_R; | ||
242 | break; | ||
243 | default: | ||
244 | return -EINVAL; | ||
245 | } | ||
246 | |||
247 | return 0; | 248 | return 0; |
248 | } | 249 | } |
249 | 250 | ||
@@ -316,9 +317,6 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp) | |||
316 | ret = -EINVAL; | 317 | ret = -EINVAL; |
317 | 318 | ||
318 | switch (info->len) { | 319 | switch (info->len) { |
319 | case X86_BREAKPOINT_LEN_X: | ||
320 | align = sizeof(long) -1; | ||
321 | break; | ||
322 | case X86_BREAKPOINT_LEN_1: | 320 | case X86_BREAKPOINT_LEN_1: |
323 | align = 0; | 321 | align = 0; |
324 | break; | 322 | break; |
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c index 9257510b4836..9d5f55848455 100644 --- a/arch/x86/lguest/boot.c +++ b/arch/x86/lguest/boot.c | |||
@@ -324,9 +324,8 @@ static void lguest_load_gdt(const struct desc_ptr *desc) | |||
324 | } | 324 | } |
325 | 325 | ||
326 | /* | 326 | /* |
327 | * For a single GDT entry which changes, we do the lazy thing: alter our GDT, | 327 | * For a single GDT entry which changes, we simply change our copy and |
328 | * then tell the Host to reload the entire thing. This operation is so rare | 328 | * then tell the host about it. |
329 | * that this naive implementation is reasonable. | ||
330 | */ | 329 | */ |
331 | static void lguest_write_gdt_entry(struct desc_struct *dt, int entrynum, | 330 | static void lguest_write_gdt_entry(struct desc_struct *dt, int entrynum, |
332 | const void *desc, int type) | 331 | const void *desc, int type) |
@@ -338,9 +337,13 @@ static void lguest_write_gdt_entry(struct desc_struct *dt, int entrynum, | |||
338 | } | 337 | } |
339 | 338 | ||
340 | /* | 339 | /* |
341 | * OK, I lied. There are three "thread local storage" GDT entries which change | 340 | * There are three "thread local storage" GDT entries which change |
342 | * on every context switch (these three entries are how glibc implements | 341 | * on every context switch (these three entries are how glibc implements |
343 | * __thread variables). So we have a hypercall specifically for this case. | 342 | * __thread variables). As an optimization, we have a hypercall |
343 | * specifically for this case. | ||
344 | * | ||
345 | * Wouldn't it be nicer to have a general LOAD_GDT_ENTRIES hypercall | ||
346 | * which took a range of entries? | ||
344 | */ | 347 | */ |
345 | static void lguest_load_tls(struct thread_struct *t, unsigned int cpu) | 348 | static void lguest_load_tls(struct thread_struct *t, unsigned int cpu) |
346 | { | 349 | { |
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c index cfe4faabb0f6..009b819f48d0 100644 --- a/arch/x86/oprofile/nmi_int.c +++ b/arch/x86/oprofile/nmi_int.c | |||
@@ -671,7 +671,9 @@ static int __init ppro_init(char **cpu_type) | |||
671 | case 14: | 671 | case 14: |
672 | *cpu_type = "i386/core"; | 672 | *cpu_type = "i386/core"; |
673 | break; | 673 | break; |
674 | case 15: case 23: | 674 | case 0x0f: |
675 | case 0x16: | ||
676 | case 0x17: | ||
675 | *cpu_type = "i386/core_2"; | 677 | *cpu_type = "i386/core_2"; |
676 | break; | 678 | break; |
677 | case 0x1a: | 679 | case 0x1a: |
diff --git a/block/blk-map.c b/block/blk-map.c index c65d7593f7f1..ade0a08c9099 100644 --- a/block/blk-map.c +++ b/block/blk-map.c | |||
@@ -307,7 +307,7 @@ int blk_rq_map_kern(struct request_queue *q, struct request *rq, void *kbuf, | |||
307 | return PTR_ERR(bio); | 307 | return PTR_ERR(bio); |
308 | 308 | ||
309 | if (rq_data_dir(rq) == WRITE) | 309 | if (rq_data_dir(rq) == WRITE) |
310 | bio->bi_rw |= (1 << REQ_WRITE); | 310 | bio->bi_rw |= REQ_WRITE; |
311 | 311 | ||
312 | if (do_copy) | 312 | if (do_copy) |
313 | rq->cmd_flags |= REQ_COPY_USER; | 313 | rq->cmd_flags |= REQ_COPY_USER; |
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index f65c6f01c475..9eba291eb6fd 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -1019,10 +1019,20 @@ cfq_find_alloc_cfqg(struct cfq_data *cfqd, struct cgroup *cgroup, int create) | |||
1019 | */ | 1019 | */ |
1020 | atomic_set(&cfqg->ref, 1); | 1020 | atomic_set(&cfqg->ref, 1); |
1021 | 1021 | ||
1022 | /* Add group onto cgroup list */ | 1022 | /* |
1023 | sscanf(dev_name(bdi->dev), "%u:%u", &major, &minor); | 1023 | * Add group onto cgroup list. It might happen that bdi->dev is |
1024 | cfq_blkiocg_add_blkio_group(blkcg, &cfqg->blkg, (void *)cfqd, | 1024 | * not initiliazed yet. Initialize this new group without major |
1025 | * and minor info and this info will be filled in once a new thread | ||
1026 | * comes for IO. See code above. | ||
1027 | */ | ||
1028 | if (bdi->dev) { | ||
1029 | sscanf(dev_name(bdi->dev), "%u:%u", &major, &minor); | ||
1030 | cfq_blkiocg_add_blkio_group(blkcg, &cfqg->blkg, (void *)cfqd, | ||
1025 | MKDEV(major, minor)); | 1031 | MKDEV(major, minor)); |
1032 | } else | ||
1033 | cfq_blkiocg_add_blkio_group(blkcg, &cfqg->blkg, (void *)cfqd, | ||
1034 | 0); | ||
1035 | |||
1026 | cfqg->weight = blkcg_get_weight(blkcg, cfqg->blkg.dev); | 1036 | cfqg->weight = blkcg_get_weight(blkcg, cfqg->blkg.dev); |
1027 | 1037 | ||
1028 | /* Add group on cfqd list */ | 1038 | /* Add group on cfqd list */ |
diff --git a/drivers/Makefile b/drivers/Makefile index ae473445ad6d..a2aea53a75ed 100644 --- a/drivers/Makefile +++ b/drivers/Makefile | |||
@@ -50,7 +50,7 @@ obj-$(CONFIG_SPI) += spi/ | |||
50 | obj-y += net/ | 50 | obj-y += net/ |
51 | obj-$(CONFIG_ATM) += atm/ | 51 | obj-$(CONFIG_ATM) += atm/ |
52 | obj-$(CONFIG_FUSION) += message/ | 52 | obj-$(CONFIG_FUSION) += message/ |
53 | obj-$(CONFIG_FIREWIRE) += firewire/ | 53 | obj-y += firewire/ |
54 | obj-y += ieee1394/ | 54 | obj-y += ieee1394/ |
55 | obj-$(CONFIG_UIO) += uio/ | 55 | obj-$(CONFIG_UIO) += uio/ |
56 | obj-y += cdrom/ | 56 | obj-y += cdrom/ |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 6124c2fd2d33..5e4fadcdece9 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -4792,7 +4792,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
4792 | clean4: | 4792 | clean4: |
4793 | kfree(h->cmd_pool_bits); | 4793 | kfree(h->cmd_pool_bits); |
4794 | /* Free up sg elements */ | 4794 | /* Free up sg elements */ |
4795 | for (k = 0; k < h->nr_cmds; k++) | 4795 | for (k-- ; k >= 0; k--) |
4796 | kfree(h->scatter_list[k]); | 4796 | kfree(h->scatter_list[k]); |
4797 | kfree(h->scatter_list); | 4797 | kfree(h->scatter_list); |
4798 | cciss_free_sg_chain_blocks(h->cmd_sg_list, h->nr_cmds); | 4798 | cciss_free_sg_chain_blocks(h->cmd_sg_list, h->nr_cmds); |
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index eab58db5f91c..cd18493c9527 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c | |||
@@ -806,6 +806,8 @@ static const struct intel_driver_description { | |||
806 | "G45/G43", NULL, &intel_i965_driver }, | 806 | "G45/G43", NULL, &intel_i965_driver }, |
807 | { PCI_DEVICE_ID_INTEL_B43_HB, PCI_DEVICE_ID_INTEL_B43_IG, | 807 | { PCI_DEVICE_ID_INTEL_B43_HB, PCI_DEVICE_ID_INTEL_B43_IG, |
808 | "B43", NULL, &intel_i965_driver }, | 808 | "B43", NULL, &intel_i965_driver }, |
809 | { PCI_DEVICE_ID_INTEL_B43_1_HB, PCI_DEVICE_ID_INTEL_B43_1_IG, | ||
810 | "B43", NULL, &intel_i965_driver }, | ||
809 | { PCI_DEVICE_ID_INTEL_G41_HB, PCI_DEVICE_ID_INTEL_G41_IG, | 811 | { PCI_DEVICE_ID_INTEL_G41_HB, PCI_DEVICE_ID_INTEL_G41_IG, |
810 | "G41", NULL, &intel_i965_driver }, | 812 | "G41", NULL, &intel_i965_driver }, |
811 | { PCI_DEVICE_ID_INTEL_IRONLAKE_D_HB, PCI_DEVICE_ID_INTEL_IRONLAKE_D_IG, | 813 | { PCI_DEVICE_ID_INTEL_IRONLAKE_D_HB, PCI_DEVICE_ID_INTEL_IRONLAKE_D_IG, |
diff --git a/drivers/char/agp/intel-agp.h b/drivers/char/agp/intel-agp.h index ee189c74d345..d09b1ab7e8ab 100644 --- a/drivers/char/agp/intel-agp.h +++ b/drivers/char/agp/intel-agp.h | |||
@@ -186,6 +186,8 @@ | |||
186 | #define PCI_DEVICE_ID_INTEL_Q33_IG 0x29D2 | 186 | #define PCI_DEVICE_ID_INTEL_Q33_IG 0x29D2 |
187 | #define PCI_DEVICE_ID_INTEL_B43_HB 0x2E40 | 187 | #define PCI_DEVICE_ID_INTEL_B43_HB 0x2E40 |
188 | #define PCI_DEVICE_ID_INTEL_B43_IG 0x2E42 | 188 | #define PCI_DEVICE_ID_INTEL_B43_IG 0x2E42 |
189 | #define PCI_DEVICE_ID_INTEL_B43_1_HB 0x2E90 | ||
190 | #define PCI_DEVICE_ID_INTEL_B43_1_IG 0x2E92 | ||
189 | #define PCI_DEVICE_ID_INTEL_GM45_HB 0x2A40 | 191 | #define PCI_DEVICE_ID_INTEL_GM45_HB 0x2A40 |
190 | #define PCI_DEVICE_ID_INTEL_GM45_IG 0x2A42 | 192 | #define PCI_DEVICE_ID_INTEL_GM45_IG 0x2A42 |
191 | #define PCI_DEVICE_ID_INTEL_EAGLELAKE_HB 0x2E00 | 193 | #define PCI_DEVICE_ID_INTEL_EAGLELAKE_HB 0x2E00 |
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c index 3822b4f49c84..7bd7c45b53ef 100644 --- a/drivers/char/ipmi/ipmi_si_intf.c +++ b/drivers/char/ipmi/ipmi_si_intf.c | |||
@@ -305,6 +305,9 @@ static int num_force_kipmid; | |||
305 | #ifdef CONFIG_PCI | 305 | #ifdef CONFIG_PCI |
306 | static int pci_registered; | 306 | static int pci_registered; |
307 | #endif | 307 | #endif |
308 | #ifdef CONFIG_ACPI | ||
309 | static int pnp_registered; | ||
310 | #endif | ||
308 | #ifdef CONFIG_PPC_OF | 311 | #ifdef CONFIG_PPC_OF |
309 | static int of_registered; | 312 | static int of_registered; |
310 | #endif | 313 | #endif |
@@ -2126,7 +2129,7 @@ static int __devinit ipmi_pnp_probe(struct pnp_dev *dev, | |||
2126 | { | 2129 | { |
2127 | struct acpi_device *acpi_dev; | 2130 | struct acpi_device *acpi_dev; |
2128 | struct smi_info *info; | 2131 | struct smi_info *info; |
2129 | struct resource *res; | 2132 | struct resource *res, *res_second; |
2130 | acpi_handle handle; | 2133 | acpi_handle handle; |
2131 | acpi_status status; | 2134 | acpi_status status; |
2132 | unsigned long long tmp; | 2135 | unsigned long long tmp; |
@@ -2182,13 +2185,13 @@ static int __devinit ipmi_pnp_probe(struct pnp_dev *dev, | |||
2182 | info->io.addr_data = res->start; | 2185 | info->io.addr_data = res->start; |
2183 | 2186 | ||
2184 | info->io.regspacing = DEFAULT_REGSPACING; | 2187 | info->io.regspacing = DEFAULT_REGSPACING; |
2185 | res = pnp_get_resource(dev, | 2188 | res_second = pnp_get_resource(dev, |
2186 | (info->io.addr_type == IPMI_IO_ADDR_SPACE) ? | 2189 | (info->io.addr_type == IPMI_IO_ADDR_SPACE) ? |
2187 | IORESOURCE_IO : IORESOURCE_MEM, | 2190 | IORESOURCE_IO : IORESOURCE_MEM, |
2188 | 1); | 2191 | 1); |
2189 | if (res) { | 2192 | if (res_second) { |
2190 | if (res->start > info->io.addr_data) | 2193 | if (res_second->start > info->io.addr_data) |
2191 | info->io.regspacing = res->start - info->io.addr_data; | 2194 | info->io.regspacing = res_second->start - info->io.addr_data; |
2192 | } | 2195 | } |
2193 | info->io.regsize = DEFAULT_REGSPACING; | 2196 | info->io.regsize = DEFAULT_REGSPACING; |
2194 | info->io.regshift = 0; | 2197 | info->io.regshift = 0; |
@@ -3359,6 +3362,7 @@ static __devinit int init_ipmi_si(void) | |||
3359 | 3362 | ||
3360 | #ifdef CONFIG_ACPI | 3363 | #ifdef CONFIG_ACPI |
3361 | pnp_register_driver(&ipmi_pnp_driver); | 3364 | pnp_register_driver(&ipmi_pnp_driver); |
3365 | pnp_registered = 1; | ||
3362 | #endif | 3366 | #endif |
3363 | 3367 | ||
3364 | #ifdef CONFIG_DMI | 3368 | #ifdef CONFIG_DMI |
@@ -3526,7 +3530,8 @@ static __exit void cleanup_ipmi_si(void) | |||
3526 | pci_unregister_driver(&ipmi_pci_driver); | 3530 | pci_unregister_driver(&ipmi_pci_driver); |
3527 | #endif | 3531 | #endif |
3528 | #ifdef CONFIG_ACPI | 3532 | #ifdef CONFIG_ACPI |
3529 | pnp_unregister_driver(&ipmi_pnp_driver); | 3533 | if (pnp_registered) |
3534 | pnp_unregister_driver(&ipmi_pnp_driver); | ||
3530 | #endif | 3535 | #endif |
3531 | 3536 | ||
3532 | #ifdef CONFIG_PPC_OF | 3537 | #ifdef CONFIG_PPC_OF |
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index a398ecdbd758..1f528fad3516 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
@@ -788,10 +788,11 @@ static const struct file_operations zero_fops = { | |||
788 | /* | 788 | /* |
789 | * capabilities for /dev/zero | 789 | * capabilities for /dev/zero |
790 | * - permits private mappings, "copies" are taken of the source of zeros | 790 | * - permits private mappings, "copies" are taken of the source of zeros |
791 | * - no writeback happens | ||
791 | */ | 792 | */ |
792 | static struct backing_dev_info zero_bdi = { | 793 | static struct backing_dev_info zero_bdi = { |
793 | .name = "char/mem", | 794 | .name = "char/mem", |
794 | .capabilities = BDI_CAP_MAP_COPY, | 795 | .capabilities = BDI_CAP_MAP_COPY | BDI_CAP_NO_ACCT_AND_WRITEBACK, |
795 | }; | 796 | }; |
796 | 797 | ||
797 | static const struct file_operations full_fops = { | 798 | static const struct file_operations full_fops = { |
diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c index 942a9826bd23..c810481a5bc2 100644 --- a/drivers/char/virtio_console.c +++ b/drivers/char/virtio_console.c | |||
@@ -596,6 +596,10 @@ static ssize_t port_fops_write(struct file *filp, const char __user *ubuf, | |||
596 | ssize_t ret; | 596 | ssize_t ret; |
597 | bool nonblock; | 597 | bool nonblock; |
598 | 598 | ||
599 | /* Userspace could be out to fool us */ | ||
600 | if (!count) | ||
601 | return 0; | ||
602 | |||
599 | port = filp->private_data; | 603 | port = filp->private_data; |
600 | 604 | ||
601 | nonblock = filp->f_flags & O_NONBLOCK; | 605 | nonblock = filp->f_flags & O_NONBLOCK; |
@@ -642,7 +646,7 @@ static unsigned int port_fops_poll(struct file *filp, poll_table *wait) | |||
642 | poll_wait(filp, &port->waitqueue, wait); | 646 | poll_wait(filp, &port->waitqueue, wait); |
643 | 647 | ||
644 | ret = 0; | 648 | ret = 0; |
645 | if (port->inbuf) | 649 | if (!will_read_block(port)) |
646 | ret |= POLLIN | POLLRDNORM; | 650 | ret |= POLLIN | POLLRDNORM; |
647 | if (!will_write_block(port)) | 651 | if (!will_write_block(port)) |
648 | ret |= POLLOUT; | 652 | ret |= POLLOUT; |
diff --git a/drivers/dca/dca-core.c b/drivers/dca/dca-core.c index 8661c84a105d..b98c67664ae7 100644 --- a/drivers/dca/dca-core.c +++ b/drivers/dca/dca-core.c | |||
@@ -39,6 +39,10 @@ static DEFINE_SPINLOCK(dca_lock); | |||
39 | 39 | ||
40 | static LIST_HEAD(dca_domains); | 40 | static LIST_HEAD(dca_domains); |
41 | 41 | ||
42 | static BLOCKING_NOTIFIER_HEAD(dca_provider_chain); | ||
43 | |||
44 | static int dca_providers_blocked; | ||
45 | |||
42 | static struct pci_bus *dca_pci_rc_from_dev(struct device *dev) | 46 | static struct pci_bus *dca_pci_rc_from_dev(struct device *dev) |
43 | { | 47 | { |
44 | struct pci_dev *pdev = to_pci_dev(dev); | 48 | struct pci_dev *pdev = to_pci_dev(dev); |
@@ -70,6 +74,60 @@ static void dca_free_domain(struct dca_domain *domain) | |||
70 | kfree(domain); | 74 | kfree(domain); |
71 | } | 75 | } |
72 | 76 | ||
77 | static int dca_provider_ioat_ver_3_0(struct device *dev) | ||
78 | { | ||
79 | struct pci_dev *pdev = to_pci_dev(dev); | ||
80 | |||
81 | return ((pdev->vendor == PCI_VENDOR_ID_INTEL) && | ||
82 | ((pdev->device == PCI_DEVICE_ID_INTEL_IOAT_TBG0) || | ||
83 | (pdev->device == PCI_DEVICE_ID_INTEL_IOAT_TBG1) || | ||
84 | (pdev->device == PCI_DEVICE_ID_INTEL_IOAT_TBG2) || | ||
85 | (pdev->device == PCI_DEVICE_ID_INTEL_IOAT_TBG3) || | ||
86 | (pdev->device == PCI_DEVICE_ID_INTEL_IOAT_TBG4) || | ||
87 | (pdev->device == PCI_DEVICE_ID_INTEL_IOAT_TBG5) || | ||
88 | (pdev->device == PCI_DEVICE_ID_INTEL_IOAT_TBG6) || | ||
89 | (pdev->device == PCI_DEVICE_ID_INTEL_IOAT_TBG7))); | ||
90 | } | ||
91 | |||
92 | static void unregister_dca_providers(void) | ||
93 | { | ||
94 | struct dca_provider *dca, *_dca; | ||
95 | struct list_head unregistered_providers; | ||
96 | struct dca_domain *domain; | ||
97 | unsigned long flags; | ||
98 | |||
99 | blocking_notifier_call_chain(&dca_provider_chain, | ||
100 | DCA_PROVIDER_REMOVE, NULL); | ||
101 | |||
102 | INIT_LIST_HEAD(&unregistered_providers); | ||
103 | |||
104 | spin_lock_irqsave(&dca_lock, flags); | ||
105 | |||
106 | if (list_empty(&dca_domains)) { | ||
107 | spin_unlock_irqrestore(&dca_lock, flags); | ||
108 | return; | ||
109 | } | ||
110 | |||
111 | /* at this point only one domain in the list is expected */ | ||
112 | domain = list_first_entry(&dca_domains, struct dca_domain, node); | ||
113 | if (!domain) | ||
114 | return; | ||
115 | |||
116 | list_for_each_entry_safe(dca, _dca, &domain->dca_providers, node) { | ||
117 | list_del(&dca->node); | ||
118 | list_add(&dca->node, &unregistered_providers); | ||
119 | } | ||
120 | |||
121 | dca_free_domain(domain); | ||
122 | |||
123 | spin_unlock_irqrestore(&dca_lock, flags); | ||
124 | |||
125 | list_for_each_entry_safe(dca, _dca, &unregistered_providers, node) { | ||
126 | dca_sysfs_remove_provider(dca); | ||
127 | list_del(&dca->node); | ||
128 | } | ||
129 | } | ||
130 | |||
73 | static struct dca_domain *dca_find_domain(struct pci_bus *rc) | 131 | static struct dca_domain *dca_find_domain(struct pci_bus *rc) |
74 | { | 132 | { |
75 | struct dca_domain *domain; | 133 | struct dca_domain *domain; |
@@ -90,9 +148,13 @@ static struct dca_domain *dca_get_domain(struct device *dev) | |||
90 | domain = dca_find_domain(rc); | 148 | domain = dca_find_domain(rc); |
91 | 149 | ||
92 | if (!domain) { | 150 | if (!domain) { |
93 | domain = dca_allocate_domain(rc); | 151 | if (dca_provider_ioat_ver_3_0(dev) && !list_empty(&dca_domains)) { |
94 | if (domain) | 152 | dca_providers_blocked = 1; |
95 | list_add(&domain->node, &dca_domains); | 153 | } else { |
154 | domain = dca_allocate_domain(rc); | ||
155 | if (domain) | ||
156 | list_add(&domain->node, &dca_domains); | ||
157 | } | ||
96 | } | 158 | } |
97 | 159 | ||
98 | return domain; | 160 | return domain; |
@@ -293,8 +355,6 @@ void free_dca_provider(struct dca_provider *dca) | |||
293 | } | 355 | } |
294 | EXPORT_SYMBOL_GPL(free_dca_provider); | 356 | EXPORT_SYMBOL_GPL(free_dca_provider); |
295 | 357 | ||
296 | static BLOCKING_NOTIFIER_HEAD(dca_provider_chain); | ||
297 | |||
298 | /** | 358 | /** |
299 | * register_dca_provider - register a dca provider | 359 | * register_dca_provider - register a dca provider |
300 | * @dca - struct created by alloc_dca_provider() | 360 | * @dca - struct created by alloc_dca_provider() |
@@ -306,6 +366,13 @@ int register_dca_provider(struct dca_provider *dca, struct device *dev) | |||
306 | unsigned long flags; | 366 | unsigned long flags; |
307 | struct dca_domain *domain; | 367 | struct dca_domain *domain; |
308 | 368 | ||
369 | spin_lock_irqsave(&dca_lock, flags); | ||
370 | if (dca_providers_blocked) { | ||
371 | spin_unlock_irqrestore(&dca_lock, flags); | ||
372 | return -ENODEV; | ||
373 | } | ||
374 | spin_unlock_irqrestore(&dca_lock, flags); | ||
375 | |||
309 | err = dca_sysfs_add_provider(dca, dev); | 376 | err = dca_sysfs_add_provider(dca, dev); |
310 | if (err) | 377 | if (err) |
311 | return err; | 378 | return err; |
@@ -313,7 +380,13 @@ int register_dca_provider(struct dca_provider *dca, struct device *dev) | |||
313 | spin_lock_irqsave(&dca_lock, flags); | 380 | spin_lock_irqsave(&dca_lock, flags); |
314 | domain = dca_get_domain(dev); | 381 | domain = dca_get_domain(dev); |
315 | if (!domain) { | 382 | if (!domain) { |
316 | spin_unlock_irqrestore(&dca_lock, flags); | 383 | if (dca_providers_blocked) { |
384 | spin_unlock_irqrestore(&dca_lock, flags); | ||
385 | dca_sysfs_remove_provider(dca); | ||
386 | unregister_dca_providers(); | ||
387 | } else { | ||
388 | spin_unlock_irqrestore(&dca_lock, flags); | ||
389 | } | ||
317 | return -ENODEV; | 390 | return -ENODEV; |
318 | } | 391 | } |
319 | list_add(&dca->node, &domain->dca_providers); | 392 | list_add(&dca->node, &domain->dca_providers); |
diff --git a/drivers/firewire/ohci.c b/drivers/firewire/ohci.c index be29b0bb2471..1b05896648bc 100644 --- a/drivers/firewire/ohci.c +++ b/drivers/firewire/ohci.c | |||
@@ -263,6 +263,7 @@ static const struct { | |||
263 | {PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB38X_FW, QUIRK_NO_MSI}, | 263 | {PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB38X_FW, QUIRK_NO_MSI}, |
264 | {PCI_VENDOR_ID_NEC, PCI_ANY_ID, QUIRK_CYCLE_TIMER}, | 264 | {PCI_VENDOR_ID_NEC, PCI_ANY_ID, QUIRK_CYCLE_TIMER}, |
265 | {PCI_VENDOR_ID_VIA, PCI_ANY_ID, QUIRK_CYCLE_TIMER}, | 265 | {PCI_VENDOR_ID_VIA, PCI_ANY_ID, QUIRK_CYCLE_TIMER}, |
266 | {PCI_VENDOR_ID_RICOH, PCI_ANY_ID, QUIRK_CYCLE_TIMER}, | ||
266 | {PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_UNI_N_FW, QUIRK_BE_HEADERS}, | 267 | {PCI_VENDOR_ID_APPLE, PCI_DEVICE_ID_APPLE_UNI_N_FW, QUIRK_BE_HEADERS}, |
267 | }; | 268 | }; |
268 | 269 | ||
diff --git a/drivers/gpu/drm/drm_buffer.c b/drivers/gpu/drm/drm_buffer.c index 55d03ed05000..529a0dbe9fc6 100644 --- a/drivers/gpu/drm/drm_buffer.c +++ b/drivers/gpu/drm/drm_buffer.c | |||
@@ -98,8 +98,8 @@ EXPORT_SYMBOL(drm_buffer_alloc); | |||
98 | * user_data: A pointer the data that is copied to the buffer. | 98 | * user_data: A pointer the data that is copied to the buffer. |
99 | * size: The Number of bytes to copy. | 99 | * size: The Number of bytes to copy. |
100 | */ | 100 | */ |
101 | extern int drm_buffer_copy_from_user(struct drm_buffer *buf, | 101 | int drm_buffer_copy_from_user(struct drm_buffer *buf, |
102 | void __user *user_data, int size) | 102 | void __user *user_data, int size) |
103 | { | 103 | { |
104 | int nr_pages = size / PAGE_SIZE + 1; | 104 | int nr_pages = size / PAGE_SIZE + 1; |
105 | int idx; | 105 | int idx; |
@@ -163,7 +163,7 @@ void *drm_buffer_read_object(struct drm_buffer *buf, | |||
163 | { | 163 | { |
164 | int idx = drm_buffer_index(buf); | 164 | int idx = drm_buffer_index(buf); |
165 | int page = drm_buffer_page(buf); | 165 | int page = drm_buffer_page(buf); |
166 | void *obj = 0; | 166 | void *obj = NULL; |
167 | 167 | ||
168 | if (idx + objsize <= PAGE_SIZE) { | 168 | if (idx + objsize <= PAGE_SIZE) { |
169 | obj = &buf->data[page][idx]; | 169 | obj = &buf->data[page][idx]; |
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index d2ab01e90a96..dcbeb98f195a 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c | |||
@@ -103,8 +103,8 @@ int drm_helper_probe_single_connector_modes(struct drm_connector *connector, | |||
103 | if (connector->funcs->force) | 103 | if (connector->funcs->force) |
104 | connector->funcs->force(connector); | 104 | connector->funcs->force(connector); |
105 | } else { | 105 | } else { |
106 | connector->status = connector->funcs->detect(connector); | 106 | connector->status = connector->funcs->detect(connector, true); |
107 | drm_helper_hpd_irq_event(dev); | 107 | drm_kms_helper_poll_enable(dev); |
108 | } | 108 | } |
109 | 109 | ||
110 | if (connector->status == connector_status_disconnected) { | 110 | if (connector->status == connector_status_disconnected) { |
@@ -637,13 +637,13 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
637 | mode_changed = true; | 637 | mode_changed = true; |
638 | 638 | ||
639 | if (mode_changed) { | 639 | if (mode_changed) { |
640 | old_fb = set->crtc->fb; | ||
641 | set->crtc->fb = set->fb; | ||
642 | set->crtc->enabled = (set->mode != NULL); | 640 | set->crtc->enabled = (set->mode != NULL); |
643 | if (set->mode != NULL) { | 641 | if (set->mode != NULL) { |
644 | DRM_DEBUG_KMS("attempting to set mode from" | 642 | DRM_DEBUG_KMS("attempting to set mode from" |
645 | " userspace\n"); | 643 | " userspace\n"); |
646 | drm_mode_debug_printmodeline(set->mode); | 644 | drm_mode_debug_printmodeline(set->mode); |
645 | old_fb = set->crtc->fb; | ||
646 | set->crtc->fb = set->fb; | ||
647 | if (!drm_crtc_helper_set_mode(set->crtc, set->mode, | 647 | if (!drm_crtc_helper_set_mode(set->crtc, set->mode, |
648 | set->x, set->y, | 648 | set->x, set->y, |
649 | old_fb)) { | 649 | old_fb)) { |
@@ -866,7 +866,7 @@ static void output_poll_execute(struct work_struct *work) | |||
866 | !(connector->polled & DRM_CONNECTOR_POLL_HPD)) | 866 | !(connector->polled & DRM_CONNECTOR_POLL_HPD)) |
867 | continue; | 867 | continue; |
868 | 868 | ||
869 | status = connector->funcs->detect(connector); | 869 | status = connector->funcs->detect(connector, false); |
870 | if (old_status != status) | 870 | if (old_status != status) |
871 | changed = true; | 871 | changed = true; |
872 | } | 872 | } |
diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c index e20f78b542a7..f5bd9e590c80 100644 --- a/drivers/gpu/drm/drm_pci.c +++ b/drivers/gpu/drm/drm_pci.c | |||
@@ -164,6 +164,8 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent, | |||
164 | dev->hose = pdev->sysdata; | 164 | dev->hose = pdev->sysdata; |
165 | #endif | 165 | #endif |
166 | 166 | ||
167 | mutex_lock(&drm_global_mutex); | ||
168 | |||
167 | if ((ret = drm_fill_in_dev(dev, ent, driver))) { | 169 | if ((ret = drm_fill_in_dev(dev, ent, driver))) { |
168 | printk(KERN_ERR "DRM: Fill_in_dev failed.\n"); | 170 | printk(KERN_ERR "DRM: Fill_in_dev failed.\n"); |
169 | goto err_g2; | 171 | goto err_g2; |
@@ -199,6 +201,7 @@ int drm_get_pci_dev(struct pci_dev *pdev, const struct pci_device_id *ent, | |||
199 | driver->name, driver->major, driver->minor, driver->patchlevel, | 201 | driver->name, driver->major, driver->minor, driver->patchlevel, |
200 | driver->date, pci_name(pdev), dev->primary->index); | 202 | driver->date, pci_name(pdev), dev->primary->index); |
201 | 203 | ||
204 | mutex_unlock(&drm_global_mutex); | ||
202 | return 0; | 205 | return 0; |
203 | 206 | ||
204 | err_g4: | 207 | err_g4: |
@@ -210,6 +213,7 @@ err_g2: | |||
210 | pci_disable_device(pdev); | 213 | pci_disable_device(pdev); |
211 | err_g1: | 214 | err_g1: |
212 | kfree(dev); | 215 | kfree(dev); |
216 | mutex_unlock(&drm_global_mutex); | ||
213 | return ret; | 217 | return ret; |
214 | } | 218 | } |
215 | EXPORT_SYMBOL(drm_get_pci_dev); | 219 | EXPORT_SYMBOL(drm_get_pci_dev); |
diff --git a/drivers/gpu/drm/drm_platform.c b/drivers/gpu/drm/drm_platform.c index 460e9a3afa8d..92d1d0fb7b75 100644 --- a/drivers/gpu/drm/drm_platform.c +++ b/drivers/gpu/drm/drm_platform.c | |||
@@ -53,6 +53,8 @@ int drm_get_platform_dev(struct platform_device *platdev, | |||
53 | dev->platformdev = platdev; | 53 | dev->platformdev = platdev; |
54 | dev->dev = &platdev->dev; | 54 | dev->dev = &platdev->dev; |
55 | 55 | ||
56 | mutex_lock(&drm_global_mutex); | ||
57 | |||
56 | ret = drm_fill_in_dev(dev, NULL, driver); | 58 | ret = drm_fill_in_dev(dev, NULL, driver); |
57 | 59 | ||
58 | if (ret) { | 60 | if (ret) { |
@@ -87,6 +89,8 @@ int drm_get_platform_dev(struct platform_device *platdev, | |||
87 | 89 | ||
88 | list_add_tail(&dev->driver_item, &driver->device_list); | 90 | list_add_tail(&dev->driver_item, &driver->device_list); |
89 | 91 | ||
92 | mutex_unlock(&drm_global_mutex); | ||
93 | |||
90 | DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", | 94 | DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", |
91 | driver->name, driver->major, driver->minor, driver->patchlevel, | 95 | driver->name, driver->major, driver->minor, driver->patchlevel, |
92 | driver->date, dev->primary->index); | 96 | driver->date, dev->primary->index); |
@@ -100,6 +104,7 @@ err_g2: | |||
100 | drm_put_minor(&dev->control); | 104 | drm_put_minor(&dev->control); |
101 | err_g1: | 105 | err_g1: |
102 | kfree(dev); | 106 | kfree(dev); |
107 | mutex_unlock(&drm_global_mutex); | ||
103 | return ret; | 108 | return ret; |
104 | } | 109 | } |
105 | EXPORT_SYMBOL(drm_get_platform_dev); | 110 | EXPORT_SYMBOL(drm_get_platform_dev); |
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c index 86118a742231..85da4c40694c 100644 --- a/drivers/gpu/drm/drm_sysfs.c +++ b/drivers/gpu/drm/drm_sysfs.c | |||
@@ -159,7 +159,7 @@ static ssize_t status_show(struct device *device, | |||
159 | struct drm_connector *connector = to_drm_connector(device); | 159 | struct drm_connector *connector = to_drm_connector(device); |
160 | enum drm_connector_status status; | 160 | enum drm_connector_status status; |
161 | 161 | ||
162 | status = connector->funcs->detect(connector); | 162 | status = connector->funcs->detect(connector, true); |
163 | return snprintf(buf, PAGE_SIZE, "%s\n", | 163 | return snprintf(buf, PAGE_SIZE, "%s\n", |
164 | drm_get_connector_status_name(status)); | 164 | drm_get_connector_status_name(status)); |
165 | } | 165 | } |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 216deb579785..6dbe14cc4f74 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -170,6 +170,7 @@ static const struct pci_device_id pciidlist[] = { /* aka */ | |||
170 | INTEL_VGA_DEVICE(0x2e22, &intel_g45_info), /* G45_G */ | 170 | INTEL_VGA_DEVICE(0x2e22, &intel_g45_info), /* G45_G */ |
171 | INTEL_VGA_DEVICE(0x2e32, &intel_g45_info), /* G41_G */ | 171 | INTEL_VGA_DEVICE(0x2e32, &intel_g45_info), /* G41_G */ |
172 | INTEL_VGA_DEVICE(0x2e42, &intel_g45_info), /* B43_G */ | 172 | INTEL_VGA_DEVICE(0x2e42, &intel_g45_info), /* B43_G */ |
173 | INTEL_VGA_DEVICE(0x2e92, &intel_g45_info), /* B43_G.1 */ | ||
173 | INTEL_VGA_DEVICE(0xa001, &intel_pineview_info), | 174 | INTEL_VGA_DEVICE(0xa001, &intel_pineview_info), |
174 | INTEL_VGA_DEVICE(0xa011, &intel_pineview_info), | 175 | INTEL_VGA_DEVICE(0xa011, &intel_pineview_info), |
175 | INTEL_VGA_DEVICE(0x0042, &intel_ironlake_d_info), | 176 | INTEL_VGA_DEVICE(0x0042, &intel_ironlake_d_info), |
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 16fca1d1799a..cf4ffbee1c00 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -2351,14 +2351,21 @@ i915_gem_object_get_fence_reg(struct drm_gem_object *obj) | |||
2351 | 2351 | ||
2352 | reg->obj = obj; | 2352 | reg->obj = obj; |
2353 | 2353 | ||
2354 | if (IS_GEN6(dev)) | 2354 | switch (INTEL_INFO(dev)->gen) { |
2355 | case 6: | ||
2355 | sandybridge_write_fence_reg(reg); | 2356 | sandybridge_write_fence_reg(reg); |
2356 | else if (IS_I965G(dev)) | 2357 | break; |
2358 | case 5: | ||
2359 | case 4: | ||
2357 | i965_write_fence_reg(reg); | 2360 | i965_write_fence_reg(reg); |
2358 | else if (IS_I9XX(dev)) | 2361 | break; |
2362 | case 3: | ||
2359 | i915_write_fence_reg(reg); | 2363 | i915_write_fence_reg(reg); |
2360 | else | 2364 | break; |
2365 | case 2: | ||
2361 | i830_write_fence_reg(reg); | 2366 | i830_write_fence_reg(reg); |
2367 | break; | ||
2368 | } | ||
2362 | 2369 | ||
2363 | trace_i915_gem_object_get_fence(obj, obj_priv->fence_reg, | 2370 | trace_i915_gem_object_get_fence(obj, obj_priv->fence_reg, |
2364 | obj_priv->tiling_mode); | 2371 | obj_priv->tiling_mode); |
@@ -2381,22 +2388,26 @@ i915_gem_clear_fence_reg(struct drm_gem_object *obj) | |||
2381 | struct drm_i915_gem_object *obj_priv = to_intel_bo(obj); | 2388 | struct drm_i915_gem_object *obj_priv = to_intel_bo(obj); |
2382 | struct drm_i915_fence_reg *reg = | 2389 | struct drm_i915_fence_reg *reg = |
2383 | &dev_priv->fence_regs[obj_priv->fence_reg]; | 2390 | &dev_priv->fence_regs[obj_priv->fence_reg]; |
2391 | uint32_t fence_reg; | ||
2384 | 2392 | ||
2385 | if (IS_GEN6(dev)) { | 2393 | switch (INTEL_INFO(dev)->gen) { |
2394 | case 6: | ||
2386 | I915_WRITE64(FENCE_REG_SANDYBRIDGE_0 + | 2395 | I915_WRITE64(FENCE_REG_SANDYBRIDGE_0 + |
2387 | (obj_priv->fence_reg * 8), 0); | 2396 | (obj_priv->fence_reg * 8), 0); |
2388 | } else if (IS_I965G(dev)) { | 2397 | break; |
2398 | case 5: | ||
2399 | case 4: | ||
2389 | I915_WRITE64(FENCE_REG_965_0 + (obj_priv->fence_reg * 8), 0); | 2400 | I915_WRITE64(FENCE_REG_965_0 + (obj_priv->fence_reg * 8), 0); |
2390 | } else { | 2401 | break; |
2391 | uint32_t fence_reg; | 2402 | case 3: |
2392 | 2403 | if (obj_priv->fence_reg > 8) | |
2393 | if (obj_priv->fence_reg < 8) | 2404 | fence_reg = FENCE_REG_945_8 + (obj_priv->fence_reg - 8) * 4; |
2394 | fence_reg = FENCE_REG_830_0 + obj_priv->fence_reg * 4; | ||
2395 | else | 2405 | else |
2396 | fence_reg = FENCE_REG_945_8 + (obj_priv->fence_reg - | 2406 | case 2: |
2397 | 8) * 4; | 2407 | fence_reg = FENCE_REG_830_0 + obj_priv->fence_reg * 4; |
2398 | 2408 | ||
2399 | I915_WRITE(fence_reg, 0); | 2409 | I915_WRITE(fence_reg, 0); |
2410 | break; | ||
2400 | } | 2411 | } |
2401 | 2412 | ||
2402 | reg->obj = NULL; | 2413 | reg->obj = NULL; |
diff --git a/drivers/gpu/drm/i915/i915_gem_evict.c b/drivers/gpu/drm/i915/i915_gem_evict.c index 72cae3cccad8..e85246ef691c 100644 --- a/drivers/gpu/drm/i915/i915_gem_evict.c +++ b/drivers/gpu/drm/i915/i915_gem_evict.c | |||
@@ -79,6 +79,7 @@ mark_free(struct drm_i915_gem_object *obj_priv, | |||
79 | struct list_head *unwind) | 79 | struct list_head *unwind) |
80 | { | 80 | { |
81 | list_add(&obj_priv->evict_list, unwind); | 81 | list_add(&obj_priv->evict_list, unwind); |
82 | drm_gem_object_reference(&obj_priv->base); | ||
82 | return drm_mm_scan_add_block(obj_priv->gtt_space); | 83 | return drm_mm_scan_add_block(obj_priv->gtt_space); |
83 | } | 84 | } |
84 | 85 | ||
@@ -165,6 +166,7 @@ i915_gem_evict_something(struct drm_device *dev, int min_size, unsigned alignmen | |||
165 | list_for_each_entry(obj_priv, &unwind_list, evict_list) { | 166 | list_for_each_entry(obj_priv, &unwind_list, evict_list) { |
166 | ret = drm_mm_scan_remove_block(obj_priv->gtt_space); | 167 | ret = drm_mm_scan_remove_block(obj_priv->gtt_space); |
167 | BUG_ON(ret); | 168 | BUG_ON(ret); |
169 | drm_gem_object_unreference(&obj_priv->base); | ||
168 | } | 170 | } |
169 | 171 | ||
170 | /* We expect the caller to unpin, evict all and try again, or give up. | 172 | /* We expect the caller to unpin, evict all and try again, or give up. |
@@ -181,18 +183,21 @@ found: | |||
181 | * scanning, therefore store to be evicted objects on a | 183 | * scanning, therefore store to be evicted objects on a |
182 | * temporary list. */ | 184 | * temporary list. */ |
183 | list_move(&obj_priv->evict_list, &eviction_list); | 185 | list_move(&obj_priv->evict_list, &eviction_list); |
184 | } | 186 | } else |
187 | drm_gem_object_unreference(&obj_priv->base); | ||
185 | } | 188 | } |
186 | 189 | ||
187 | /* Unbinding will emit any required flushes */ | 190 | /* Unbinding will emit any required flushes */ |
188 | list_for_each_entry_safe(obj_priv, tmp_obj_priv, | 191 | list_for_each_entry_safe(obj_priv, tmp_obj_priv, |
189 | &eviction_list, evict_list) { | 192 | &eviction_list, evict_list) { |
190 | #if WATCH_LRU | 193 | #if WATCH_LRU |
191 | DRM_INFO("%s: evicting %p\n", __func__, obj); | 194 | DRM_INFO("%s: evicting %p\n", __func__, &obj_priv->base); |
192 | #endif | 195 | #endif |
193 | ret = i915_gem_object_unbind(&obj_priv->base); | 196 | ret = i915_gem_object_unbind(&obj_priv->base); |
194 | if (ret) | 197 | if (ret) |
195 | return ret; | 198 | return ret; |
199 | |||
200 | drm_gem_object_unreference(&obj_priv->base); | ||
196 | } | 201 | } |
197 | 202 | ||
198 | /* The just created free hole should be on the top of the free stack | 203 | /* The just created free hole should be on the top of the free stack |
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c index 2c6b98f2440e..31f08581e93a 100644 --- a/drivers/gpu/drm/i915/i915_suspend.c +++ b/drivers/gpu/drm/i915/i915_suspend.c | |||
@@ -789,16 +789,25 @@ int i915_save_state(struct drm_device *dev) | |||
789 | dev_priv->saveSWF2[i] = I915_READ(SWF30 + (i << 2)); | 789 | dev_priv->saveSWF2[i] = I915_READ(SWF30 + (i << 2)); |
790 | 790 | ||
791 | /* Fences */ | 791 | /* Fences */ |
792 | if (IS_I965G(dev)) { | 792 | switch (INTEL_INFO(dev)->gen) { |
793 | case 6: | ||
794 | for (i = 0; i < 16; i++) | ||
795 | dev_priv->saveFENCE[i] = I915_READ64(FENCE_REG_SANDYBRIDGE_0 + (i * 8)); | ||
796 | break; | ||
797 | case 5: | ||
798 | case 4: | ||
793 | for (i = 0; i < 16; i++) | 799 | for (i = 0; i < 16; i++) |
794 | dev_priv->saveFENCE[i] = I915_READ64(FENCE_REG_965_0 + (i * 8)); | 800 | dev_priv->saveFENCE[i] = I915_READ64(FENCE_REG_965_0 + (i * 8)); |
795 | } else { | 801 | break; |
796 | for (i = 0; i < 8; i++) | 802 | case 3: |
797 | dev_priv->saveFENCE[i] = I915_READ(FENCE_REG_830_0 + (i * 4)); | ||
798 | |||
799 | if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev)) | 803 | if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev)) |
800 | for (i = 0; i < 8; i++) | 804 | for (i = 0; i < 8; i++) |
801 | dev_priv->saveFENCE[i+8] = I915_READ(FENCE_REG_945_8 + (i * 4)); | 805 | dev_priv->saveFENCE[i+8] = I915_READ(FENCE_REG_945_8 + (i * 4)); |
806 | case 2: | ||
807 | for (i = 0; i < 8; i++) | ||
808 | dev_priv->saveFENCE[i] = I915_READ(FENCE_REG_830_0 + (i * 4)); | ||
809 | break; | ||
810 | |||
802 | } | 811 | } |
803 | 812 | ||
804 | return 0; | 813 | return 0; |
@@ -815,15 +824,24 @@ int i915_restore_state(struct drm_device *dev) | |||
815 | I915_WRITE(HWS_PGA, dev_priv->saveHWS); | 824 | I915_WRITE(HWS_PGA, dev_priv->saveHWS); |
816 | 825 | ||
817 | /* Fences */ | 826 | /* Fences */ |
818 | if (IS_I965G(dev)) { | 827 | switch (INTEL_INFO(dev)->gen) { |
828 | case 6: | ||
829 | for (i = 0; i < 16; i++) | ||
830 | I915_WRITE64(FENCE_REG_SANDYBRIDGE_0 + (i * 8), dev_priv->saveFENCE[i]); | ||
831 | break; | ||
832 | case 5: | ||
833 | case 4: | ||
819 | for (i = 0; i < 16; i++) | 834 | for (i = 0; i < 16; i++) |
820 | I915_WRITE64(FENCE_REG_965_0 + (i * 8), dev_priv->saveFENCE[i]); | 835 | I915_WRITE64(FENCE_REG_965_0 + (i * 8), dev_priv->saveFENCE[i]); |
821 | } else { | 836 | break; |
822 | for (i = 0; i < 8; i++) | 837 | case 3: |
823 | I915_WRITE(FENCE_REG_830_0 + (i * 4), dev_priv->saveFENCE[i]); | 838 | case 2: |
824 | if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev)) | 839 | if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev)) |
825 | for (i = 0; i < 8; i++) | 840 | for (i = 0; i < 8; i++) |
826 | I915_WRITE(FENCE_REG_945_8 + (i * 4), dev_priv->saveFENCE[i+8]); | 841 | I915_WRITE(FENCE_REG_945_8 + (i * 4), dev_priv->saveFENCE[i+8]); |
842 | for (i = 0; i < 8; i++) | ||
843 | I915_WRITE(FENCE_REG_830_0 + (i * 4), dev_priv->saveFENCE[i]); | ||
844 | break; | ||
827 | } | 845 | } |
828 | 846 | ||
829 | i915_restore_display(dev); | 847 | i915_restore_display(dev); |
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index 4b7735196cd5..197d4f32585a 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -188,7 +188,7 @@ static bool intel_ironlake_crt_detect_hotplug(struct drm_connector *connector) | |||
188 | 188 | ||
189 | if (wait_for((I915_READ(PCH_ADPA) & ADPA_CRT_HOTPLUG_FORCE_TRIGGER) == 0, | 189 | if (wait_for((I915_READ(PCH_ADPA) & ADPA_CRT_HOTPLUG_FORCE_TRIGGER) == 0, |
190 | 1000, 1)) | 190 | 1000, 1)) |
191 | DRM_ERROR("timed out waiting for FORCE_TRIGGER"); | 191 | DRM_DEBUG_KMS("timed out waiting for FORCE_TRIGGER"); |
192 | 192 | ||
193 | if (turn_off_dac) { | 193 | if (turn_off_dac) { |
194 | I915_WRITE(PCH_ADPA, temp); | 194 | I915_WRITE(PCH_ADPA, temp); |
@@ -245,7 +245,7 @@ static bool intel_crt_detect_hotplug(struct drm_connector *connector) | |||
245 | if (wait_for((I915_READ(PORT_HOTPLUG_EN) & | 245 | if (wait_for((I915_READ(PORT_HOTPLUG_EN) & |
246 | CRT_HOTPLUG_FORCE_DETECT) == 0, | 246 | CRT_HOTPLUG_FORCE_DETECT) == 0, |
247 | 1000, 1)) | 247 | 1000, 1)) |
248 | DRM_ERROR("timed out waiting for FORCE_DETECT to go off"); | 248 | DRM_DEBUG_KMS("timed out waiting for FORCE_DETECT to go off"); |
249 | } | 249 | } |
250 | 250 | ||
251 | stat = I915_READ(PORT_HOTPLUG_STAT); | 251 | stat = I915_READ(PORT_HOTPLUG_STAT); |
@@ -400,7 +400,8 @@ intel_crt_load_detect(struct drm_crtc *crtc, struct intel_encoder *intel_encoder | |||
400 | return status; | 400 | return status; |
401 | } | 401 | } |
402 | 402 | ||
403 | static enum drm_connector_status intel_crt_detect(struct drm_connector *connector) | 403 | static enum drm_connector_status |
404 | intel_crt_detect(struct drm_connector *connector, bool force) | ||
404 | { | 405 | { |
405 | struct drm_device *dev = connector->dev; | 406 | struct drm_device *dev = connector->dev; |
406 | struct drm_encoder *encoder = intel_attached_encoder(connector); | 407 | struct drm_encoder *encoder = intel_attached_encoder(connector); |
@@ -419,6 +420,9 @@ static enum drm_connector_status intel_crt_detect(struct drm_connector *connecto | |||
419 | if (intel_crt_detect_ddc(encoder)) | 420 | if (intel_crt_detect_ddc(encoder)) |
420 | return connector_status_connected; | 421 | return connector_status_connected; |
421 | 422 | ||
423 | if (!force) | ||
424 | return connector->status; | ||
425 | |||
422 | /* for pre-945g platforms use load detect */ | 426 | /* for pre-945g platforms use load detect */ |
423 | if (encoder->crtc && encoder->crtc->enabled) { | 427 | if (encoder->crtc && encoder->crtc->enabled) { |
424 | status = intel_crt_load_detect(encoder->crtc, intel_encoder); | 428 | status = intel_crt_load_detect(encoder->crtc, intel_encoder); |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 19daead5b525..b5bf51a4502d 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -2463,11 +2463,19 @@ static bool intel_crtc_mode_fixup(struct drm_crtc *crtc, | |||
2463 | struct drm_display_mode *adjusted_mode) | 2463 | struct drm_display_mode *adjusted_mode) |
2464 | { | 2464 | { |
2465 | struct drm_device *dev = crtc->dev; | 2465 | struct drm_device *dev = crtc->dev; |
2466 | |||
2466 | if (HAS_PCH_SPLIT(dev)) { | 2467 | if (HAS_PCH_SPLIT(dev)) { |
2467 | /* FDI link clock is fixed at 2.7G */ | 2468 | /* FDI link clock is fixed at 2.7G */ |
2468 | if (mode->clock * 3 > IRONLAKE_FDI_FREQ * 4) | 2469 | if (mode->clock * 3 > IRONLAKE_FDI_FREQ * 4) |
2469 | return false; | 2470 | return false; |
2470 | } | 2471 | } |
2472 | |||
2473 | /* XXX some encoders set the crtcinfo, others don't. | ||
2474 | * Obviously we need some form of conflict resolution here... | ||
2475 | */ | ||
2476 | if (adjusted_mode->crtc_htotal == 0) | ||
2477 | drm_mode_set_crtcinfo(adjusted_mode, 0); | ||
2478 | |||
2471 | return true; | 2479 | return true; |
2472 | } | 2480 | } |
2473 | 2481 | ||
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 51d142939a26..1a51ee07de3e 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -1386,7 +1386,7 @@ ironlake_dp_detect(struct drm_connector *connector) | |||
1386 | * \return false if DP port is disconnected. | 1386 | * \return false if DP port is disconnected. |
1387 | */ | 1387 | */ |
1388 | static enum drm_connector_status | 1388 | static enum drm_connector_status |
1389 | intel_dp_detect(struct drm_connector *connector) | 1389 | intel_dp_detect(struct drm_connector *connector, bool force) |
1390 | { | 1390 | { |
1391 | struct drm_encoder *encoder = intel_attached_encoder(connector); | 1391 | struct drm_encoder *encoder = intel_attached_encoder(connector); |
1392 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); | 1392 | struct intel_dp *intel_dp = enc_to_intel_dp(encoder); |
diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c index a399f4b2c1c5..7c9ec1472d46 100644 --- a/drivers/gpu/drm/i915/intel_dvo.c +++ b/drivers/gpu/drm/i915/intel_dvo.c | |||
@@ -221,7 +221,8 @@ static void intel_dvo_mode_set(struct drm_encoder *encoder, | |||
221 | * | 221 | * |
222 | * Unimplemented. | 222 | * Unimplemented. |
223 | */ | 223 | */ |
224 | static enum drm_connector_status intel_dvo_detect(struct drm_connector *connector) | 224 | static enum drm_connector_status |
225 | intel_dvo_detect(struct drm_connector *connector, bool force) | ||
225 | { | 226 | { |
226 | struct drm_encoder *encoder = intel_attached_encoder(connector); | 227 | struct drm_encoder *encoder = intel_attached_encoder(connector); |
227 | struct intel_dvo *intel_dvo = enc_to_intel_dvo(encoder); | 228 | struct intel_dvo *intel_dvo = enc_to_intel_dvo(encoder); |
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index ccd4c97e6524..926934a482ec 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c | |||
@@ -139,7 +139,7 @@ static bool intel_hdmi_mode_fixup(struct drm_encoder *encoder, | |||
139 | } | 139 | } |
140 | 140 | ||
141 | static enum drm_connector_status | 141 | static enum drm_connector_status |
142 | intel_hdmi_detect(struct drm_connector *connector) | 142 | intel_hdmi_detect(struct drm_connector *connector, bool force) |
143 | { | 143 | { |
144 | struct drm_encoder *encoder = intel_attached_encoder(connector); | 144 | struct drm_encoder *encoder = intel_attached_encoder(connector); |
145 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder); | 145 | struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder); |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 4fbb0165b26f..6ec39a86ed06 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -445,7 +445,8 @@ static void intel_lvds_mode_set(struct drm_encoder *encoder, | |||
445 | * connected and closed means disconnected. We also send hotplug events as | 445 | * connected and closed means disconnected. We also send hotplug events as |
446 | * needed, using lid status notification from the input layer. | 446 | * needed, using lid status notification from the input layer. |
447 | */ | 447 | */ |
448 | static enum drm_connector_status intel_lvds_detect(struct drm_connector *connector) | 448 | static enum drm_connector_status |
449 | intel_lvds_detect(struct drm_connector *connector, bool force) | ||
449 | { | 450 | { |
450 | struct drm_device *dev = connector->dev; | 451 | struct drm_device *dev = connector->dev; |
451 | enum drm_connector_status status = connector_status_connected; | 452 | enum drm_connector_status status = connector_status_connected; |
@@ -540,7 +541,9 @@ static int intel_lid_notify(struct notifier_block *nb, unsigned long val, | |||
540 | * the LID nofication event. | 541 | * the LID nofication event. |
541 | */ | 542 | */ |
542 | if (connector) | 543 | if (connector) |
543 | connector->status = connector->funcs->detect(connector); | 544 | connector->status = connector->funcs->detect(connector, |
545 | false); | ||
546 | |||
544 | /* Don't force modeset on machines where it causes a GPU lockup */ | 547 | /* Don't force modeset on machines where it causes a GPU lockup */ |
545 | if (dmi_check_system(intel_no_modeset_on_lid)) | 548 | if (dmi_check_system(intel_no_modeset_on_lid)) |
546 | return NOTIFY_OK; | 549 | return NOTIFY_OK; |
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index e3b7a7ee39cb..e8e902d614ed 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -1417,7 +1417,7 @@ intel_analog_is_connected(struct drm_device *dev) | |||
1417 | if (!analog_connector) | 1417 | if (!analog_connector) |
1418 | return false; | 1418 | return false; |
1419 | 1419 | ||
1420 | if (analog_connector->funcs->detect(analog_connector) == | 1420 | if (analog_connector->funcs->detect(analog_connector, false) == |
1421 | connector_status_disconnected) | 1421 | connector_status_disconnected) |
1422 | return false; | 1422 | return false; |
1423 | 1423 | ||
@@ -1486,7 +1486,8 @@ intel_sdvo_hdmi_sink_detect(struct drm_connector *connector) | |||
1486 | return status; | 1486 | return status; |
1487 | } | 1487 | } |
1488 | 1488 | ||
1489 | static enum drm_connector_status intel_sdvo_detect(struct drm_connector *connector) | 1489 | static enum drm_connector_status |
1490 | intel_sdvo_detect(struct drm_connector *connector, bool force) | ||
1490 | { | 1491 | { |
1491 | uint16_t response; | 1492 | uint16_t response; |
1492 | struct drm_encoder *encoder = intel_attached_encoder(connector); | 1493 | struct drm_encoder *encoder = intel_attached_encoder(connector); |
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c index c671f60ce80b..4a117e318a73 100644 --- a/drivers/gpu/drm/i915/intel_tv.c +++ b/drivers/gpu/drm/i915/intel_tv.c | |||
@@ -1341,7 +1341,7 @@ static void intel_tv_find_better_format(struct drm_connector *connector) | |||
1341 | * we have a pipe programmed in order to probe the TV. | 1341 | * we have a pipe programmed in order to probe the TV. |
1342 | */ | 1342 | */ |
1343 | static enum drm_connector_status | 1343 | static enum drm_connector_status |
1344 | intel_tv_detect(struct drm_connector *connector) | 1344 | intel_tv_detect(struct drm_connector *connector, bool force) |
1345 | { | 1345 | { |
1346 | struct drm_display_mode mode; | 1346 | struct drm_display_mode mode; |
1347 | struct drm_encoder *encoder = intel_attached_encoder(connector); | 1347 | struct drm_encoder *encoder = intel_attached_encoder(connector); |
@@ -1353,7 +1353,7 @@ intel_tv_detect(struct drm_connector *connector) | |||
1353 | 1353 | ||
1354 | if (encoder->crtc && encoder->crtc->enabled) { | 1354 | if (encoder->crtc && encoder->crtc->enabled) { |
1355 | type = intel_tv_detect_type(intel_tv); | 1355 | type = intel_tv_detect_type(intel_tv); |
1356 | } else { | 1356 | } else if (force) { |
1357 | struct drm_crtc *crtc; | 1357 | struct drm_crtc *crtc; |
1358 | int dpms_mode; | 1358 | int dpms_mode; |
1359 | 1359 | ||
@@ -1364,10 +1364,9 @@ intel_tv_detect(struct drm_connector *connector) | |||
1364 | intel_release_load_detect_pipe(&intel_tv->base, connector, | 1364 | intel_release_load_detect_pipe(&intel_tv->base, connector, |
1365 | dpms_mode); | 1365 | dpms_mode); |
1366 | } else | 1366 | } else |
1367 | type = -1; | 1367 | return connector_status_unknown; |
1368 | } | 1368 | } else |
1369 | 1369 | return connector->status; | |
1370 | intel_tv->type = type; | ||
1371 | 1370 | ||
1372 | if (type < 0) | 1371 | if (type < 0) |
1373 | return connector_status_disconnected; | 1372 | return connector_status_disconnected; |
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c index a1473fff06ac..fc737037f751 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c | |||
@@ -168,7 +168,7 @@ nouveau_connector_set_encoder(struct drm_connector *connector, | |||
168 | } | 168 | } |
169 | 169 | ||
170 | static enum drm_connector_status | 170 | static enum drm_connector_status |
171 | nouveau_connector_detect(struct drm_connector *connector) | 171 | nouveau_connector_detect(struct drm_connector *connector, bool force) |
172 | { | 172 | { |
173 | struct drm_device *dev = connector->dev; | 173 | struct drm_device *dev = connector->dev; |
174 | struct nouveau_connector *nv_connector = nouveau_connector(connector); | 174 | struct nouveau_connector *nv_connector = nouveau_connector(connector); |
@@ -246,7 +246,7 @@ detect_analog: | |||
246 | } | 246 | } |
247 | 247 | ||
248 | static enum drm_connector_status | 248 | static enum drm_connector_status |
249 | nouveau_connector_detect_lvds(struct drm_connector *connector) | 249 | nouveau_connector_detect_lvds(struct drm_connector *connector, bool force) |
250 | { | 250 | { |
251 | struct drm_device *dev = connector->dev; | 251 | struct drm_device *dev = connector->dev; |
252 | struct drm_nouveau_private *dev_priv = dev->dev_private; | 252 | struct drm_nouveau_private *dev_priv = dev->dev_private; |
@@ -267,7 +267,7 @@ nouveau_connector_detect_lvds(struct drm_connector *connector) | |||
267 | 267 | ||
268 | /* Try retrieving EDID via DDC */ | 268 | /* Try retrieving EDID via DDC */ |
269 | if (!dev_priv->vbios.fp_no_ddc) { | 269 | if (!dev_priv->vbios.fp_no_ddc) { |
270 | status = nouveau_connector_detect(connector); | 270 | status = nouveau_connector_detect(connector, force); |
271 | if (status == connector_status_connected) | 271 | if (status == connector_status_connected) |
272 | goto out; | 272 | goto out; |
273 | } | 273 | } |
@@ -558,8 +558,10 @@ nouveau_connector_get_modes(struct drm_connector *connector) | |||
558 | if (nv_encoder->dcb->type == OUTPUT_LVDS && | 558 | if (nv_encoder->dcb->type == OUTPUT_LVDS && |
559 | (nv_encoder->dcb->lvdsconf.use_straps_for_mode || | 559 | (nv_encoder->dcb->lvdsconf.use_straps_for_mode || |
560 | dev_priv->vbios.fp_no_ddc) && nouveau_bios_fp_mode(dev, NULL)) { | 560 | dev_priv->vbios.fp_no_ddc) && nouveau_bios_fp_mode(dev, NULL)) { |
561 | nv_connector->native_mode = drm_mode_create(dev); | 561 | struct drm_display_mode mode; |
562 | nouveau_bios_fp_mode(dev, nv_connector->native_mode); | 562 | |
563 | nouveau_bios_fp_mode(dev, &mode); | ||
564 | nv_connector->native_mode = drm_mode_duplicate(dev, &mode); | ||
563 | } | 565 | } |
564 | 566 | ||
565 | /* Find the native mode if this is a digital panel, if we didn't | 567 | /* Find the native mode if this is a digital panel, if we didn't |
diff --git a/drivers/gpu/drm/radeon/atombios.h b/drivers/gpu/drm/radeon/atombios.h index 1bc72c3190a9..fe359a239df3 100644 --- a/drivers/gpu/drm/radeon/atombios.h +++ b/drivers/gpu/drm/radeon/atombios.h | |||
@@ -4999,7 +4999,7 @@ typedef struct _SW_I2C_IO_DATA_PARAMETERS | |||
4999 | #define SW_I2C_CNTL_WRITE1BIT 6 | 4999 | #define SW_I2C_CNTL_WRITE1BIT 6 |
5000 | 5000 | ||
5001 | //==============================VESA definition Portion=============================== | 5001 | //==============================VESA definition Portion=============================== |
5002 | #define VESA_OEM_PRODUCT_REV '01.00' | 5002 | #define VESA_OEM_PRODUCT_REV "01.00" |
5003 | #define VESA_MODE_ATTRIBUTE_MODE_SUPPORT 0xBB //refer to VBE spec p.32, no TTY support | 5003 | #define VESA_MODE_ATTRIBUTE_MODE_SUPPORT 0xBB //refer to VBE spec p.32, no TTY support |
5004 | #define VESA_MODE_WIN_ATTRIBUTE 7 | 5004 | #define VESA_MODE_WIN_ATTRIBUTE 7 |
5005 | #define VESA_WIN_SIZE 64 | 5005 | #define VESA_WIN_SIZE 64 |
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c index 464a81a1990f..cd0290f946cf 100644 --- a/drivers/gpu/drm/radeon/atombios_crtc.c +++ b/drivers/gpu/drm/radeon/atombios_crtc.c | |||
@@ -539,14 +539,15 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc, | |||
539 | pll->algo = PLL_ALGO_LEGACY; | 539 | pll->algo = PLL_ALGO_LEGACY; |
540 | pll->flags |= RADEON_PLL_PREFER_CLOSEST_LOWER; | 540 | pll->flags |= RADEON_PLL_PREFER_CLOSEST_LOWER; |
541 | } | 541 | } |
542 | /* There is some evidence (often anecdotal) that RV515 LVDS | 542 | /* There is some evidence (often anecdotal) that RV515/RV620 LVDS |
543 | * (on some boards at least) prefers the legacy algo. I'm not | 543 | * (on some boards at least) prefers the legacy algo. I'm not |
544 | * sure whether this should handled generically or on a | 544 | * sure whether this should handled generically or on a |
545 | * case-by-case quirk basis. Both algos should work fine in the | 545 | * case-by-case quirk basis. Both algos should work fine in the |
546 | * majority of cases. | 546 | * majority of cases. |
547 | */ | 547 | */ |
548 | if ((radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT)) && | 548 | if ((radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT)) && |
549 | (rdev->family == CHIP_RV515)) { | 549 | ((rdev->family == CHIP_RV515) || |
550 | (rdev->family == CHIP_RV620))) { | ||
550 | /* allow the user to overrride just in case */ | 551 | /* allow the user to overrride just in case */ |
551 | if (radeon_new_pll == 1) | 552 | if (radeon_new_pll == 1) |
552 | pll->algo = PLL_ALGO_NEW; | 553 | pll->algo = PLL_ALGO_NEW; |
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c index b8b7f010b25f..79082d4398ae 100644 --- a/drivers/gpu/drm/radeon/evergreen.c +++ b/drivers/gpu/drm/radeon/evergreen.c | |||
@@ -1160,14 +1160,25 @@ static void evergreen_gpu_init(struct radeon_device *rdev) | |||
1160 | EVERGREEN_MAX_BACKENDS_MASK)); | 1160 | EVERGREEN_MAX_BACKENDS_MASK)); |
1161 | break; | 1161 | break; |
1162 | } | 1162 | } |
1163 | } else | 1163 | } else { |
1164 | gb_backend_map = | 1164 | switch (rdev->family) { |
1165 | evergreen_get_tile_pipe_to_backend_map(rdev, | 1165 | case CHIP_CYPRESS: |
1166 | rdev->config.evergreen.max_tile_pipes, | 1166 | case CHIP_HEMLOCK: |
1167 | rdev->config.evergreen.max_backends, | 1167 | gb_backend_map = 0x66442200; |
1168 | ((EVERGREEN_MAX_BACKENDS_MASK << | 1168 | break; |
1169 | rdev->config.evergreen.max_backends) & | 1169 | case CHIP_JUNIPER: |
1170 | EVERGREEN_MAX_BACKENDS_MASK)); | 1170 | gb_backend_map = 0x00006420; |
1171 | break; | ||
1172 | default: | ||
1173 | gb_backend_map = | ||
1174 | evergreen_get_tile_pipe_to_backend_map(rdev, | ||
1175 | rdev->config.evergreen.max_tile_pipes, | ||
1176 | rdev->config.evergreen.max_backends, | ||
1177 | ((EVERGREEN_MAX_BACKENDS_MASK << | ||
1178 | rdev->config.evergreen.max_backends) & | ||
1179 | EVERGREEN_MAX_BACKENDS_MASK)); | ||
1180 | } | ||
1181 | } | ||
1171 | 1182 | ||
1172 | rdev->config.evergreen.tile_config = gb_addr_config; | 1183 | rdev->config.evergreen.tile_config = gb_addr_config; |
1173 | WREG32(GB_BACKEND_MAP, gb_backend_map); | 1184 | WREG32(GB_BACKEND_MAP, gb_backend_map); |
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c index e817a0bb5eb4..e151f16a8f86 100644 --- a/drivers/gpu/drm/radeon/r100.c +++ b/drivers/gpu/drm/radeon/r100.c | |||
@@ -2020,18 +2020,7 @@ bool r100_gpu_cp_is_lockup(struct radeon_device *rdev, struct r100_gpu_lockup *l | |||
2020 | return false; | 2020 | return false; |
2021 | } | 2021 | } |
2022 | elapsed = jiffies_to_msecs(cjiffies - lockup->last_jiffies); | 2022 | elapsed = jiffies_to_msecs(cjiffies - lockup->last_jiffies); |
2023 | if (elapsed >= 3000) { | 2023 | if (elapsed >= 10000) { |
2024 | /* very likely the improbable case where current | ||
2025 | * rptr is equal to last recorded, a while ago, rptr | ||
2026 | * this is more likely a false positive update tracking | ||
2027 | * information which should force us to be recall at | ||
2028 | * latter point | ||
2029 | */ | ||
2030 | lockup->last_cp_rptr = cp->rptr; | ||
2031 | lockup->last_jiffies = jiffies; | ||
2032 | return false; | ||
2033 | } | ||
2034 | if (elapsed >= 1000) { | ||
2035 | dev_err(rdev->dev, "GPU lockup CP stall for more than %lumsec\n", elapsed); | 2024 | dev_err(rdev->dev, "GPU lockup CP stall for more than %lumsec\n", elapsed); |
2036 | return true; | 2025 | return true; |
2037 | } | 2026 | } |
@@ -3308,13 +3297,14 @@ int r100_cs_track_check(struct radeon_device *rdev, struct r100_cs_track *track) | |||
3308 | unsigned long size; | 3297 | unsigned long size; |
3309 | unsigned prim_walk; | 3298 | unsigned prim_walk; |
3310 | unsigned nverts; | 3299 | unsigned nverts; |
3300 | unsigned num_cb = track->num_cb; | ||
3311 | 3301 | ||
3312 | for (i = 0; i < track->num_cb; i++) { | 3302 | if (!track->zb_cb_clear && !track->color_channel_mask && |
3303 | !track->blend_read_enable) | ||
3304 | num_cb = 0; | ||
3305 | |||
3306 | for (i = 0; i < num_cb; i++) { | ||
3313 | if (track->cb[i].robj == NULL) { | 3307 | if (track->cb[i].robj == NULL) { |
3314 | if (!(track->zb_cb_clear || track->color_channel_mask || | ||
3315 | track->blend_read_enable)) { | ||
3316 | continue; | ||
3317 | } | ||
3318 | DRM_ERROR("[drm] No buffer for color buffer %d !\n", i); | 3308 | DRM_ERROR("[drm] No buffer for color buffer %d !\n", i); |
3319 | return -EINVAL; | 3309 | return -EINVAL; |
3320 | } | 3310 | } |
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c index afc18d87fdca..ddc3adea1dda 100644 --- a/drivers/gpu/drm/radeon/r600.c +++ b/drivers/gpu/drm/radeon/r600.c | |||
@@ -2729,7 +2729,7 @@ int r600_ib_test(struct radeon_device *rdev) | |||
2729 | if (i < rdev->usec_timeout) { | 2729 | if (i < rdev->usec_timeout) { |
2730 | DRM_INFO("ib test succeeded in %u usecs\n", i); | 2730 | DRM_INFO("ib test succeeded in %u usecs\n", i); |
2731 | } else { | 2731 | } else { |
2732 | DRM_ERROR("radeon: ib test failed (sracth(0x%04X)=0x%08X)\n", | 2732 | DRM_ERROR("radeon: ib test failed (scratch(0x%04X)=0x%08X)\n", |
2733 | scratch, tmp); | 2733 | scratch, tmp); |
2734 | r = -EINVAL; | 2734 | r = -EINVAL; |
2735 | } | 2735 | } |
diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c b/drivers/gpu/drm/radeon/r600_blit_kms.c index d13622ae74e9..9ceb2a1ce799 100644 --- a/drivers/gpu/drm/radeon/r600_blit_kms.c +++ b/drivers/gpu/drm/radeon/r600_blit_kms.c | |||
@@ -1,3 +1,28 @@ | |||
1 | /* | ||
2 | * Copyright 2009 Advanced Micro Devices, Inc. | ||
3 | * Copyright 2009 Red Hat Inc. | ||
4 | * | ||
5 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
6 | * copy of this software and associated documentation files (the "Software"), | ||
7 | * to deal in the Software without restriction, including without limitation | ||
8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
9 | * and/or sell copies of the Software, and to permit persons to whom the | ||
10 | * Software is furnished to do so, subject to the following conditions: | ||
11 | * | ||
12 | * The above copyright notice and this permission notice (including the next | ||
13 | * paragraph) shall be included in all copies or substantial portions of the | ||
14 | * Software. | ||
15 | * | ||
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
19 | * THE COPYRIGHT HOLDER(S) AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
22 | * DEALINGS IN THE SOFTWARE. | ||
23 | * | ||
24 | */ | ||
25 | |||
1 | #include "drmP.h" | 26 | #include "drmP.h" |
2 | #include "drm.h" | 27 | #include "drm.h" |
3 | #include "radeon_drm.h" | 28 | #include "radeon_drm.h" |
diff --git a/drivers/gpu/drm/radeon/r600_blit_shaders.h b/drivers/gpu/drm/radeon/r600_blit_shaders.h index fdc3b378cbb0..f437d36dd98c 100644 --- a/drivers/gpu/drm/radeon/r600_blit_shaders.h +++ b/drivers/gpu/drm/radeon/r600_blit_shaders.h | |||
@@ -1,3 +1,27 @@ | |||
1 | /* | ||
2 | * Copyright 2009 Advanced Micro Devices, Inc. | ||
3 | * Copyright 2009 Red Hat Inc. | ||
4 | * | ||
5 | * Permission is hereby granted, free of charge, to any person obtaining a | ||
6 | * copy of this software and associated documentation files (the "Software"), | ||
7 | * to deal in the Software without restriction, including without limitation | ||
8 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
9 | * and/or sell copies of the Software, and to permit persons to whom the | ||
10 | * Software is furnished to do so, subject to the following conditions: | ||
11 | * | ||
12 | * The above copyright notice and this permission notice (including the next | ||
13 | * paragraph) shall be included in all copies or substantial portions of the | ||
14 | * Software. | ||
15 | * | ||
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||
19 | * THE COPYRIGHT HOLDER(S) AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR | ||
20 | * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, | ||
21 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
22 | * DEALINGS IN THE SOFTWARE. | ||
23 | * | ||
24 | */ | ||
1 | 25 | ||
2 | #ifndef R600_BLIT_SHADERS_H | 26 | #ifndef R600_BLIT_SHADERS_H |
3 | #define R600_BLIT_SHADERS_H | 27 | #define R600_BLIT_SHADERS_H |
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c index d8864949e387..250a3a918193 100644 --- a/drivers/gpu/drm/radeon/r600_cs.c +++ b/drivers/gpu/drm/radeon/r600_cs.c | |||
@@ -1170,9 +1170,8 @@ static inline int r600_check_texture_resource(struct radeon_cs_parser *p, u32 i | |||
1170 | /* using get ib will give us the offset into the mipmap bo */ | 1170 | /* using get ib will give us the offset into the mipmap bo */ |
1171 | word0 = radeon_get_ib_value(p, idx + 3) << 8; | 1171 | word0 = radeon_get_ib_value(p, idx + 3) << 8; |
1172 | if ((mipmap_size + word0) > radeon_bo_size(mipmap)) { | 1172 | if ((mipmap_size + word0) > radeon_bo_size(mipmap)) { |
1173 | dev_warn(p->dev, "mipmap bo too small (%d %d %d %d %d %d -> %d have %ld)\n", | 1173 | /*dev_warn(p->dev, "mipmap bo too small (%d %d %d %d %d %d -> %d have %ld)\n", |
1174 | w0, h0, bpe, blevel, nlevels, word0, mipmap_size, radeon_bo_size(texture)); | 1174 | w0, h0, bpe, blevel, nlevels, word0, mipmap_size, radeon_bo_size(texture));*/ |
1175 | return -EINVAL; | ||
1176 | } | 1175 | } |
1177 | return 0; | 1176 | return 0; |
1178 | } | 1177 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index bd74e428bd14..a04b7a6ad95f 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c | |||
@@ -1485,6 +1485,11 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
1485 | /* PowerMac8,1 ? */ | 1485 | /* PowerMac8,1 ? */ |
1486 | /* imac g5 isight */ | 1486 | /* imac g5 isight */ |
1487 | rdev->mode_info.connector_table = CT_IMAC_G5_ISIGHT; | 1487 | rdev->mode_info.connector_table = CT_IMAC_G5_ISIGHT; |
1488 | } else if ((rdev->pdev->device == 0x4a48) && | ||
1489 | (rdev->pdev->subsystem_vendor == 0x1002) && | ||
1490 | (rdev->pdev->subsystem_device == 0x4a48)) { | ||
1491 | /* Mac X800 */ | ||
1492 | rdev->mode_info.connector_table = CT_MAC_X800; | ||
1488 | } else | 1493 | } else |
1489 | #endif /* CONFIG_PPC_PMAC */ | 1494 | #endif /* CONFIG_PPC_PMAC */ |
1490 | #ifdef CONFIG_PPC64 | 1495 | #ifdef CONFIG_PPC64 |
@@ -1961,6 +1966,48 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
1961 | CONNECTOR_OBJECT_ID_VGA, | 1966 | CONNECTOR_OBJECT_ID_VGA, |
1962 | &hpd); | 1967 | &hpd); |
1963 | break; | 1968 | break; |
1969 | case CT_MAC_X800: | ||
1970 | DRM_INFO("Connector Table: %d (mac x800)\n", | ||
1971 | rdev->mode_info.connector_table); | ||
1972 | /* DVI - primary dac, internal tmds */ | ||
1973 | ddc_i2c = combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0); | ||
1974 | hpd.hpd = RADEON_HPD_1; /* ??? */ | ||
1975 | radeon_add_legacy_encoder(dev, | ||
1976 | radeon_get_encoder_enum(dev, | ||
1977 | ATOM_DEVICE_DFP1_SUPPORT, | ||
1978 | 0), | ||
1979 | ATOM_DEVICE_DFP1_SUPPORT); | ||
1980 | radeon_add_legacy_encoder(dev, | ||
1981 | radeon_get_encoder_enum(dev, | ||
1982 | ATOM_DEVICE_CRT1_SUPPORT, | ||
1983 | 1), | ||
1984 | ATOM_DEVICE_CRT1_SUPPORT); | ||
1985 | radeon_add_legacy_connector(dev, 0, | ||
1986 | ATOM_DEVICE_DFP1_SUPPORT | | ||
1987 | ATOM_DEVICE_CRT1_SUPPORT, | ||
1988 | DRM_MODE_CONNECTOR_DVII, &ddc_i2c, | ||
1989 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I, | ||
1990 | &hpd); | ||
1991 | /* DVI - tv dac, dvo */ | ||
1992 | ddc_i2c = combios_setup_i2c_bus(rdev, DDC_MONID, 0, 0); | ||
1993 | hpd.hpd = RADEON_HPD_2; /* ??? */ | ||
1994 | radeon_add_legacy_encoder(dev, | ||
1995 | radeon_get_encoder_enum(dev, | ||
1996 | ATOM_DEVICE_DFP2_SUPPORT, | ||
1997 | 0), | ||
1998 | ATOM_DEVICE_DFP2_SUPPORT); | ||
1999 | radeon_add_legacy_encoder(dev, | ||
2000 | radeon_get_encoder_enum(dev, | ||
2001 | ATOM_DEVICE_CRT2_SUPPORT, | ||
2002 | 2), | ||
2003 | ATOM_DEVICE_CRT2_SUPPORT); | ||
2004 | radeon_add_legacy_connector(dev, 1, | ||
2005 | ATOM_DEVICE_DFP2_SUPPORT | | ||
2006 | ATOM_DEVICE_CRT2_SUPPORT, | ||
2007 | DRM_MODE_CONNECTOR_DVII, &ddc_i2c, | ||
2008 | CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I, | ||
2009 | &hpd); | ||
2010 | break; | ||
1964 | default: | 2011 | default: |
1965 | DRM_INFO("Connector table: %d (invalid)\n", | 2012 | DRM_INFO("Connector table: %d (invalid)\n", |
1966 | rdev->mode_info.connector_table); | 2013 | rdev->mode_info.connector_table); |
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c index a9dd7847d96e..ecc1a8fafbfd 100644 --- a/drivers/gpu/drm/radeon/radeon_connectors.c +++ b/drivers/gpu/drm/radeon/radeon_connectors.c | |||
@@ -481,7 +481,8 @@ static int radeon_lvds_mode_valid(struct drm_connector *connector, | |||
481 | return MODE_OK; | 481 | return MODE_OK; |
482 | } | 482 | } |
483 | 483 | ||
484 | static enum drm_connector_status radeon_lvds_detect(struct drm_connector *connector) | 484 | static enum drm_connector_status |
485 | radeon_lvds_detect(struct drm_connector *connector, bool force) | ||
485 | { | 486 | { |
486 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | 487 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
487 | struct drm_encoder *encoder = radeon_best_single_encoder(connector); | 488 | struct drm_encoder *encoder = radeon_best_single_encoder(connector); |
@@ -594,7 +595,8 @@ static int radeon_vga_mode_valid(struct drm_connector *connector, | |||
594 | return MODE_OK; | 595 | return MODE_OK; |
595 | } | 596 | } |
596 | 597 | ||
597 | static enum drm_connector_status radeon_vga_detect(struct drm_connector *connector) | 598 | static enum drm_connector_status |
599 | radeon_vga_detect(struct drm_connector *connector, bool force) | ||
598 | { | 600 | { |
599 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | 601 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
600 | struct drm_encoder *encoder; | 602 | struct drm_encoder *encoder; |
@@ -691,7 +693,8 @@ static int radeon_tv_mode_valid(struct drm_connector *connector, | |||
691 | return MODE_OK; | 693 | return MODE_OK; |
692 | } | 694 | } |
693 | 695 | ||
694 | static enum drm_connector_status radeon_tv_detect(struct drm_connector *connector) | 696 | static enum drm_connector_status |
697 | radeon_tv_detect(struct drm_connector *connector, bool force) | ||
695 | { | 698 | { |
696 | struct drm_encoder *encoder; | 699 | struct drm_encoder *encoder; |
697 | struct drm_encoder_helper_funcs *encoder_funcs; | 700 | struct drm_encoder_helper_funcs *encoder_funcs; |
@@ -748,7 +751,8 @@ static int radeon_dvi_get_modes(struct drm_connector *connector) | |||
748 | * we have to check if this analog encoder is shared with anyone else (TV) | 751 | * we have to check if this analog encoder is shared with anyone else (TV) |
749 | * if its shared we have to set the other connector to disconnected. | 752 | * if its shared we have to set the other connector to disconnected. |
750 | */ | 753 | */ |
751 | static enum drm_connector_status radeon_dvi_detect(struct drm_connector *connector) | 754 | static enum drm_connector_status |
755 | radeon_dvi_detect(struct drm_connector *connector, bool force) | ||
752 | { | 756 | { |
753 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | 757 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
754 | struct drm_encoder *encoder = NULL; | 758 | struct drm_encoder *encoder = NULL; |
@@ -972,7 +976,8 @@ static int radeon_dp_get_modes(struct drm_connector *connector) | |||
972 | return ret; | 976 | return ret; |
973 | } | 977 | } |
974 | 978 | ||
975 | static enum drm_connector_status radeon_dp_detect(struct drm_connector *connector) | 979 | static enum drm_connector_status |
980 | radeon_dp_detect(struct drm_connector *connector, bool force) | ||
976 | { | 981 | { |
977 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); | 982 | struct radeon_connector *radeon_connector = to_radeon_connector(connector); |
978 | enum drm_connector_status ret = connector_status_disconnected; | 983 | enum drm_connector_status ret = connector_status_disconnected; |
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c index 6dd434ad2429..127a395f70fb 100644 --- a/drivers/gpu/drm/radeon/radeon_display.c +++ b/drivers/gpu/drm/radeon/radeon_display.c | |||
@@ -1140,17 +1140,18 @@ bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc, | |||
1140 | radeon_crtc->rmx_type = radeon_encoder->rmx_type; | 1140 | radeon_crtc->rmx_type = radeon_encoder->rmx_type; |
1141 | else | 1141 | else |
1142 | radeon_crtc->rmx_type = RMX_OFF; | 1142 | radeon_crtc->rmx_type = RMX_OFF; |
1143 | src_v = crtc->mode.vdisplay; | ||
1144 | dst_v = radeon_crtc->native_mode.vdisplay; | ||
1145 | src_h = crtc->mode.hdisplay; | ||
1146 | dst_h = radeon_crtc->native_mode.vdisplay; | ||
1147 | /* copy native mode */ | 1143 | /* copy native mode */ |
1148 | memcpy(&radeon_crtc->native_mode, | 1144 | memcpy(&radeon_crtc->native_mode, |
1149 | &radeon_encoder->native_mode, | 1145 | &radeon_encoder->native_mode, |
1150 | sizeof(struct drm_display_mode)); | 1146 | sizeof(struct drm_display_mode)); |
1147 | src_v = crtc->mode.vdisplay; | ||
1148 | dst_v = radeon_crtc->native_mode.vdisplay; | ||
1149 | src_h = crtc->mode.hdisplay; | ||
1150 | dst_h = radeon_crtc->native_mode.hdisplay; | ||
1151 | 1151 | ||
1152 | /* fix up for overscan on hdmi */ | 1152 | /* fix up for overscan on hdmi */ |
1153 | if (ASIC_IS_AVIVO(rdev) && | 1153 | if (ASIC_IS_AVIVO(rdev) && |
1154 | (!(mode->flags & DRM_MODE_FLAG_INTERLACE)) && | ||
1154 | ((radeon_encoder->underscan_type == UNDERSCAN_ON) || | 1155 | ((radeon_encoder->underscan_type == UNDERSCAN_ON) || |
1155 | ((radeon_encoder->underscan_type == UNDERSCAN_AUTO) && | 1156 | ((radeon_encoder->underscan_type == UNDERSCAN_AUTO) && |
1156 | drm_detect_hdmi_monitor(radeon_connector->edid) && | 1157 | drm_detect_hdmi_monitor(radeon_connector->edid) && |
diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index 5eee3c41d124..8fbbe1c6ebbd 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c | |||
@@ -203,6 +203,10 @@ int radeon_info_ioctl(struct drm_device *dev, void *data, struct drm_file *filp) | |||
203 | */ | 203 | */ |
204 | int radeon_driver_firstopen_kms(struct drm_device *dev) | 204 | int radeon_driver_firstopen_kms(struct drm_device *dev) |
205 | { | 205 | { |
206 | struct radeon_device *rdev = dev->dev_private; | ||
207 | |||
208 | if (rdev->powered_down) | ||
209 | return -EINVAL; | ||
206 | return 0; | 210 | return 0; |
207 | } | 211 | } |
208 | 212 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index efbe975312dc..17a6602b5885 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h | |||
@@ -204,7 +204,7 @@ struct radeon_i2c_chan { | |||
204 | 204 | ||
205 | /* mostly for macs, but really any system without connector tables */ | 205 | /* mostly for macs, but really any system without connector tables */ |
206 | enum radeon_connector_table { | 206 | enum radeon_connector_table { |
207 | CT_NONE, | 207 | CT_NONE = 0, |
208 | CT_GENERIC, | 208 | CT_GENERIC, |
209 | CT_IBOOK, | 209 | CT_IBOOK, |
210 | CT_POWERBOOK_EXTERNAL, | 210 | CT_POWERBOOK_EXTERNAL, |
@@ -215,6 +215,7 @@ enum radeon_connector_table { | |||
215 | CT_IMAC_G5_ISIGHT, | 215 | CT_IMAC_G5_ISIGHT, |
216 | CT_EMAC, | 216 | CT_EMAC, |
217 | CT_RN50_POWER, | 217 | CT_RN50_POWER, |
218 | CT_MAC_X800, | ||
218 | }; | 219 | }; |
219 | 220 | ||
220 | enum radeon_dvo_chip { | 221 | enum radeon_dvo_chip { |
diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c index 7cffb3e04232..3451a82adba7 100644 --- a/drivers/gpu/drm/ttm/ttm_bo_util.c +++ b/drivers/gpu/drm/ttm/ttm_bo_util.c | |||
@@ -351,6 +351,7 @@ static int ttm_buffer_object_transfer(struct ttm_buffer_object *bo, | |||
351 | INIT_LIST_HEAD(&fbo->lru); | 351 | INIT_LIST_HEAD(&fbo->lru); |
352 | INIT_LIST_HEAD(&fbo->swap); | 352 | INIT_LIST_HEAD(&fbo->swap); |
353 | fbo->vm_node = NULL; | 353 | fbo->vm_node = NULL; |
354 | atomic_set(&fbo->cpu_writers, 0); | ||
354 | 355 | ||
355 | fbo->sync_obj = driver->sync_obj_ref(bo->sync_obj); | 356 | fbo->sync_obj = driver->sync_obj_ref(bo->sync_obj); |
356 | kref_init(&fbo->list_kref); | 357 | kref_init(&fbo->list_kref); |
diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c index ca904799f018..b1e02fffd3cc 100644 --- a/drivers/gpu/drm/ttm/ttm_page_alloc.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c | |||
@@ -69,7 +69,7 @@ struct ttm_page_pool { | |||
69 | spinlock_t lock; | 69 | spinlock_t lock; |
70 | bool fill_lock; | 70 | bool fill_lock; |
71 | struct list_head list; | 71 | struct list_head list; |
72 | int gfp_flags; | 72 | gfp_t gfp_flags; |
73 | unsigned npages; | 73 | unsigned npages; |
74 | char *name; | 74 | char *name; |
75 | unsigned long nfrees; | 75 | unsigned long nfrees; |
@@ -475,7 +475,7 @@ static void ttm_handle_caching_state_failure(struct list_head *pages, | |||
475 | * This function is reentrant if caller updates count depending on number of | 475 | * This function is reentrant if caller updates count depending on number of |
476 | * pages returned in pages array. | 476 | * pages returned in pages array. |
477 | */ | 477 | */ |
478 | static int ttm_alloc_new_pages(struct list_head *pages, int gfp_flags, | 478 | static int ttm_alloc_new_pages(struct list_head *pages, gfp_t gfp_flags, |
479 | int ttm_flags, enum ttm_caching_state cstate, unsigned count) | 479 | int ttm_flags, enum ttm_caching_state cstate, unsigned count) |
480 | { | 480 | { |
481 | struct page **caching_array; | 481 | struct page **caching_array; |
@@ -666,7 +666,7 @@ int ttm_get_pages(struct list_head *pages, int flags, | |||
666 | { | 666 | { |
667 | struct ttm_page_pool *pool = ttm_get_pool(flags, cstate); | 667 | struct ttm_page_pool *pool = ttm_get_pool(flags, cstate); |
668 | struct page *p = NULL; | 668 | struct page *p = NULL; |
669 | int gfp_flags = GFP_USER; | 669 | gfp_t gfp_flags = GFP_USER; |
670 | int r; | 670 | int r; |
671 | 671 | ||
672 | /* set zero flag for page allocation if required */ | 672 | /* set zero flag for page allocation if required */ |
@@ -818,7 +818,7 @@ int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages) | |||
818 | return 0; | 818 | return 0; |
819 | } | 819 | } |
820 | 820 | ||
821 | void ttm_page_alloc_fini() | 821 | void ttm_page_alloc_fini(void) |
822 | { | 822 | { |
823 | int i; | 823 | int i; |
824 | 824 | ||
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c index 2ff5cf78235f..7083b1a24df3 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ldu.c | |||
@@ -335,7 +335,8 @@ static void vmw_ldu_connector_restore(struct drm_connector *connector) | |||
335 | } | 335 | } |
336 | 336 | ||
337 | static enum drm_connector_status | 337 | static enum drm_connector_status |
338 | vmw_ldu_connector_detect(struct drm_connector *connector) | 338 | vmw_ldu_connector_detect(struct drm_connector *connector, |
339 | bool force) | ||
339 | { | 340 | { |
340 | if (vmw_connector_to_ldu(connector)->pref_active) | 341 | if (vmw_connector_to_ldu(connector)->pref_active) |
341 | return connector_status_connected; | 342 | return connector_status_connected; |
@@ -516,7 +517,7 @@ static int vmw_ldu_init(struct vmw_private *dev_priv, unsigned unit) | |||
516 | 517 | ||
517 | drm_connector_init(dev, connector, &vmw_legacy_connector_funcs, | 518 | drm_connector_init(dev, connector, &vmw_legacy_connector_funcs, |
518 | DRM_MODE_CONNECTOR_LVDS); | 519 | DRM_MODE_CONNECTOR_LVDS); |
519 | connector->status = vmw_ldu_connector_detect(connector); | 520 | connector->status = vmw_ldu_connector_detect(connector, true); |
520 | 521 | ||
521 | drm_encoder_init(dev, encoder, &vmw_legacy_encoder_funcs, | 522 | drm_encoder_init(dev, encoder, &vmw_legacy_encoder_funcs, |
522 | DRM_MODE_ENCODER_LVDS); | 523 | DRM_MODE_ENCODER_LVDS); |
@@ -610,7 +611,7 @@ int vmw_kms_ldu_update_layout(struct vmw_private *dev_priv, unsigned num, | |||
610 | ldu->pref_height = 600; | 611 | ldu->pref_height = 600; |
611 | ldu->pref_active = false; | 612 | ldu->pref_active = false; |
612 | } | 613 | } |
613 | con->status = vmw_ldu_connector_detect(con); | 614 | con->status = vmw_ldu_connector_detect(con, true); |
614 | } | 615 | } |
615 | 616 | ||
616 | mutex_unlock(&dev->mode_config.mutex); | 617 | mutex_unlock(&dev->mode_config.mutex); |
diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c index b87569e96b16..f366f968155a 100644 --- a/drivers/gpu/vga/vgaarb.c +++ b/drivers/gpu/vga/vgaarb.c | |||
@@ -598,7 +598,7 @@ static inline void vga_update_device_decodes(struct vga_device *vgadev, | |||
598 | pr_debug("vgaarb: decoding count now is: %d\n", vga_decode_count); | 598 | pr_debug("vgaarb: decoding count now is: %d\n", vga_decode_count); |
599 | } | 599 | } |
600 | 600 | ||
601 | void __vga_set_legacy_decoding(struct pci_dev *pdev, unsigned int decodes, bool userspace) | 601 | static void __vga_set_legacy_decoding(struct pci_dev *pdev, unsigned int decodes, bool userspace) |
602 | { | 602 | { |
603 | struct vga_device *vgadev; | 603 | struct vga_device *vgadev; |
604 | unsigned long flags; | 604 | unsigned long flags; |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 0c52899be964..3f7292486024 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1285,8 +1285,11 @@ static const struct hid_device_id hid_blacklist[] = { | |||
1285 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, | 1285 | { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) }, |
1286 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, | 1286 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) }, |
1287 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, | 1287 | { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) }, |
1288 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_T91MT) }, | ||
1289 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO) }, | ||
1288 | { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) }, | 1290 | { HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) }, |
1289 | { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) }, | 1291 | { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) }, |
1292 | { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) }, | ||
1290 | { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH) }, | 1293 | { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH) }, |
1291 | { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) }, | 1294 | { HID_USB_DEVICE(USB_VENDOR_ID_CANDO, USB_DEVICE_ID_CANDO_MULTI_TOUCH_11_6) }, |
1292 | { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) }, | 1295 | { HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) }, |
@@ -1578,7 +1581,6 @@ static const struct hid_device_id hid_ignore_list[] = { | |||
1578 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24) }, | 1581 | { HID_USB_DEVICE(USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24) }, |
1579 | { HID_USB_DEVICE(USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1) }, | 1582 | { HID_USB_DEVICE(USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1) }, |
1580 | { HID_USB_DEVICE(USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232) }, | 1583 | { HID_USB_DEVICE(USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232) }, |
1581 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_T91MT)}, | ||
1582 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_LCM)}, | 1584 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_LCM)}, |
1583 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_LCM2)}, | 1585 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUSTEK, USB_DEVICE_ID_ASUSTEK_LCM2)}, |
1584 | { HID_USB_DEVICE(USB_VENDOR_ID_AVERMEDIA, USB_DEVICE_ID_AVER_FM_MR800) }, | 1586 | { HID_USB_DEVICE(USB_VENDOR_ID_AVERMEDIA, USB_DEVICE_ID_AVER_FM_MR800) }, |
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 85c6d13c9ffa..765a4f53eb5c 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h | |||
@@ -105,6 +105,7 @@ | |||
105 | 105 | ||
106 | #define USB_VENDOR_ID_ASUS 0x0486 | 106 | #define USB_VENDOR_ID_ASUS 0x0486 |
107 | #define USB_DEVICE_ID_ASUS_T91MT 0x0185 | 107 | #define USB_DEVICE_ID_ASUS_T91MT 0x0185 |
108 | #define USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO 0x0186 | ||
108 | 109 | ||
109 | #define USB_VENDOR_ID_ASUSTEK 0x0b05 | 110 | #define USB_VENDOR_ID_ASUSTEK 0x0b05 |
110 | #define USB_DEVICE_ID_ASUSTEK_LCM 0x1726 | 111 | #define USB_DEVICE_ID_ASUSTEK_LCM 0x1726 |
@@ -128,6 +129,7 @@ | |||
128 | 129 | ||
129 | #define USB_VENDOR_ID_BTC 0x046e | 130 | #define USB_VENDOR_ID_BTC 0x046e |
130 | #define USB_DEVICE_ID_BTC_EMPREX_REMOTE 0x5578 | 131 | #define USB_DEVICE_ID_BTC_EMPREX_REMOTE 0x5578 |
132 | #define USB_DEVICE_ID_BTC_EMPREX_REMOTE_2 0x5577 | ||
131 | 133 | ||
132 | #define USB_VENDOR_ID_CANDO 0x2087 | 134 | #define USB_VENDOR_ID_CANDO 0x2087 |
133 | #define USB_DEVICE_ID_CANDO_MULTI_TOUCH 0x0a01 | 135 | #define USB_DEVICE_ID_CANDO_MULTI_TOUCH 0x0a01 |
@@ -149,6 +151,7 @@ | |||
149 | 151 | ||
150 | #define USB_VENDOR_ID_CHICONY 0x04f2 | 152 | #define USB_VENDOR_ID_CHICONY 0x04f2 |
151 | #define USB_DEVICE_ID_CHICONY_TACTICAL_PAD 0x0418 | 153 | #define USB_DEVICE_ID_CHICONY_TACTICAL_PAD 0x0418 |
154 | #define USB_DEVICE_ID_CHICONY_MULTI_TOUCH 0xb19d | ||
152 | 155 | ||
153 | #define USB_VENDOR_ID_CIDC 0x1677 | 156 | #define USB_VENDOR_ID_CIDC 0x1677 |
154 | 157 | ||
@@ -507,6 +510,7 @@ | |||
507 | #define USB_VENDOR_ID_UCLOGIC 0x5543 | 510 | #define USB_VENDOR_ID_UCLOGIC 0x5543 |
508 | #define USB_DEVICE_ID_UCLOGIC_TABLET_PF1209 0x0042 | 511 | #define USB_DEVICE_ID_UCLOGIC_TABLET_PF1209 0x0042 |
509 | #define USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U 0x0003 | 512 | #define USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U 0x0003 |
513 | #define USB_DEVICE_ID_UCLOGIC_TABLET_KNA5 0x6001 | ||
510 | 514 | ||
511 | #define USB_VENDOR_ID_VERNIER 0x08f7 | 515 | #define USB_VENDOR_ID_VERNIER 0x08f7 |
512 | #define USB_DEVICE_ID_VERNIER_LABPRO 0x0001 | 516 | #define USB_DEVICE_ID_VERNIER_LABPRO 0x0001 |
diff --git a/drivers/hid/hid-mosart.c b/drivers/hid/hid-mosart.c index e91437c18906..ac5421d568f1 100644 --- a/drivers/hid/hid-mosart.c +++ b/drivers/hid/hid-mosart.c | |||
@@ -239,6 +239,7 @@ static void mosart_remove(struct hid_device *hdev) | |||
239 | 239 | ||
240 | static const struct hid_device_id mosart_devices[] = { | 240 | static const struct hid_device_id mosart_devices[] = { |
241 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_T91MT) }, | 241 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_T91MT) }, |
242 | { HID_USB_DEVICE(USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUSTEK_MULTITOUCH_YFO) }, | ||
242 | { } | 243 | { } |
243 | }; | 244 | }; |
244 | MODULE_DEVICE_TABLE(hid, mosart_devices); | 245 | MODULE_DEVICE_TABLE(hid, mosart_devices); |
diff --git a/drivers/hid/hid-topseed.c b/drivers/hid/hid-topseed.c index 5771f851f856..956ed9ac19d4 100644 --- a/drivers/hid/hid-topseed.c +++ b/drivers/hid/hid-topseed.c | |||
@@ -64,6 +64,7 @@ static int ts_input_mapping(struct hid_device *hdev, struct hid_input *hi, | |||
64 | static const struct hid_device_id ts_devices[] = { | 64 | static const struct hid_device_id ts_devices[] = { |
65 | { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, | 65 | { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) }, |
66 | { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) }, | 66 | { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) }, |
67 | { HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) }, | ||
67 | { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) }, | 68 | { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED2, USB_DEVICE_ID_TOPSEED2_RF_COMBO) }, |
68 | { } | 69 | { } |
69 | }; | 70 | }; |
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index b729c0286679..599041a7f670 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c | |||
@@ -828,6 +828,7 @@ static int usbhid_output_raw_report(struct hid_device *hid, __u8 *buf, size_t co | |||
828 | } | 828 | } |
829 | } else { | 829 | } else { |
830 | int skipped_report_id = 0; | 830 | int skipped_report_id = 0; |
831 | int report_id = buf[0]; | ||
831 | if (buf[0] == 0x0) { | 832 | if (buf[0] == 0x0) { |
832 | /* Don't send the Report ID */ | 833 | /* Don't send the Report ID */ |
833 | buf++; | 834 | buf++; |
@@ -837,7 +838,7 @@ static int usbhid_output_raw_report(struct hid_device *hid, __u8 *buf, size_t co | |||
837 | ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), | 838 | ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), |
838 | HID_REQ_SET_REPORT, | 839 | HID_REQ_SET_REPORT, |
839 | USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, | 840 | USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, |
840 | ((report_type + 1) << 8) | *buf, | 841 | ((report_type + 1) << 8) | report_id, |
841 | interface->desc.bInterfaceNumber, buf, count, | 842 | interface->desc.bInterfaceNumber, buf, count, |
842 | USB_CTRL_SET_TIMEOUT); | 843 | USB_CTRL_SET_TIMEOUT); |
843 | /* count also the report id, if this was a numbered report. */ | 844 | /* count also the report id, if this was a numbered report. */ |
@@ -1445,6 +1446,11 @@ static const struct hid_device_id hid_usb_table[] = { | |||
1445 | { } | 1446 | { } |
1446 | }; | 1447 | }; |
1447 | 1448 | ||
1449 | struct usb_interface *usbhid_find_interface(int minor) | ||
1450 | { | ||
1451 | return usb_find_interface(&hid_driver, minor); | ||
1452 | } | ||
1453 | |||
1448 | static struct hid_driver hid_usb_driver = { | 1454 | static struct hid_driver hid_usb_driver = { |
1449 | .name = "generic-usb", | 1455 | .name = "generic-usb", |
1450 | .id_table = hid_usb_table, | 1456 | .id_table = hid_usb_table, |
diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c index 2643d3147621..70da3181c8a0 100644 --- a/drivers/hid/usbhid/hid-quirks.c +++ b/drivers/hid/usbhid/hid-quirks.c | |||
@@ -33,6 +33,7 @@ static const struct hid_blacklist { | |||
33 | { USB_VENDOR_ID_AASHIMA, USB_DEVICE_ID_AASHIMA_PREDATOR, HID_QUIRK_BADPAD }, | 33 | { USB_VENDOR_ID_AASHIMA, USB_DEVICE_ID_AASHIMA_PREDATOR, HID_QUIRK_BADPAD }, |
34 | { USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD }, | 34 | { USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD }, |
35 | { USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD }, | 35 | { USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD }, |
36 | { USB_VENDOR_ID_DWAV, USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER, HID_QUIRK_MULTI_INPUT | HID_QUIRK_NOGET }, | ||
36 | { USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH, HID_QUIRK_MULTI_INPUT }, | 37 | { USB_VENDOR_ID_DWAV, USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH, HID_QUIRK_MULTI_INPUT }, |
37 | { USB_VENDOR_ID_MOJO, USB_DEVICE_ID_RETRO_ADAPTER, HID_QUIRK_MULTI_INPUT }, | 38 | { USB_VENDOR_ID_MOJO, USB_DEVICE_ID_RETRO_ADAPTER, HID_QUIRK_MULTI_INPUT }, |
38 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, | 39 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, |
@@ -69,6 +70,7 @@ static const struct hid_blacklist { | |||
69 | { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD, HID_QUIRK_NOGET }, | 70 | { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD, HID_QUIRK_NOGET }, |
70 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209, HID_QUIRK_MULTI_INPUT }, | 71 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209, HID_QUIRK_MULTI_INPUT }, |
71 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U, HID_QUIRK_MULTI_INPUT }, | 72 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U, HID_QUIRK_MULTI_INPUT }, |
73 | { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_KNA5, HID_QUIRK_MULTI_INPUT }, | ||
72 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS }, | 74 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_DUAL_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT | HID_QUIRK_SKIP_OUTPUT_REPORTS }, |
73 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_QUAD_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, | 75 | { USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_QUAD_USB_JOYPAD, HID_QUIRK_NOGET | HID_QUIRK_MULTI_INPUT }, |
74 | 76 | ||
@@ -77,6 +79,8 @@ static const struct hid_blacklist { | |||
77 | 79 | ||
78 | { USB_VENDOR_ID_PI_ENGINEERING, USB_DEVICE_ID_PI_ENGINEERING_VEC_USB_FOOTPEDAL, HID_QUIRK_HIDINPUT_FORCE }, | 80 | { USB_VENDOR_ID_PI_ENGINEERING, USB_DEVICE_ID_PI_ENGINEERING_VEC_USB_FOOTPEDAL, HID_QUIRK_HIDINPUT_FORCE }, |
79 | 81 | ||
82 | { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_MULTI_TOUCH, HID_QUIRK_MULTI_INPUT }, | ||
83 | |||
80 | { 0, 0 } | 84 | { 0, 0 } |
81 | }; | 85 | }; |
82 | 86 | ||
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index 0a29c51114aa..681e620eb95b 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c | |||
@@ -270,7 +270,7 @@ static int hiddev_open(struct inode *inode, struct file *file) | |||
270 | struct hiddev *hiddev; | 270 | struct hiddev *hiddev; |
271 | int res; | 271 | int res; |
272 | 272 | ||
273 | intf = usb_find_interface(&hiddev_driver, iminor(inode)); | 273 | intf = usbhid_find_interface(iminor(inode)); |
274 | if (!intf) | 274 | if (!intf) |
275 | return -ENODEV; | 275 | return -ENODEV; |
276 | hid = usb_get_intfdata(intf); | 276 | hid = usb_get_intfdata(intf); |
diff --git a/drivers/hid/usbhid/usbhid.h b/drivers/hid/usbhid/usbhid.h index 693fd3e720df..89d2e847dcc6 100644 --- a/drivers/hid/usbhid/usbhid.h +++ b/drivers/hid/usbhid/usbhid.h | |||
@@ -42,6 +42,7 @@ void usbhid_submit_report | |||
42 | (struct hid_device *hid, struct hid_report *report, unsigned char dir); | 42 | (struct hid_device *hid, struct hid_report *report, unsigned char dir); |
43 | int usbhid_get_power(struct hid_device *hid); | 43 | int usbhid_get_power(struct hid_device *hid); |
44 | void usbhid_put_power(struct hid_device *hid); | 44 | void usbhid_put_power(struct hid_device *hid); |
45 | struct usb_interface *usbhid_find_interface(int minor); | ||
45 | 46 | ||
46 | /* iofl flags */ | 47 | /* iofl flags */ |
47 | #define HID_CTRL_RUNNING 1 | 48 | #define HID_CTRL_RUNNING 1 |
diff --git a/drivers/hwmon/adm1031.c b/drivers/hwmon/adm1031.c index 15c1a9616af3..0683e6be662c 100644 --- a/drivers/hwmon/adm1031.c +++ b/drivers/hwmon/adm1031.c | |||
@@ -79,7 +79,7 @@ struct adm1031_data { | |||
79 | int chip_type; | 79 | int chip_type; |
80 | char valid; /* !=0 if following fields are valid */ | 80 | char valid; /* !=0 if following fields are valid */ |
81 | unsigned long last_updated; /* In jiffies */ | 81 | unsigned long last_updated; /* In jiffies */ |
82 | unsigned int update_rate; /* In milliseconds */ | 82 | unsigned int update_interval; /* In milliseconds */ |
83 | /* The chan_select_table contains the possible configurations for | 83 | /* The chan_select_table contains the possible configurations for |
84 | * auto fan control. | 84 | * auto fan control. |
85 | */ | 85 | */ |
@@ -743,23 +743,23 @@ static SENSOR_DEVICE_ATTR(temp3_crit_alarm, S_IRUGO, show_alarm, NULL, 12); | |||
743 | static SENSOR_DEVICE_ATTR(temp3_fault, S_IRUGO, show_alarm, NULL, 13); | 743 | static SENSOR_DEVICE_ATTR(temp3_fault, S_IRUGO, show_alarm, NULL, 13); |
744 | static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, 14); | 744 | static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, show_alarm, NULL, 14); |
745 | 745 | ||
746 | /* Update Rate */ | 746 | /* Update Interval */ |
747 | static const unsigned int update_rates[] = { | 747 | static const unsigned int update_intervals[] = { |
748 | 16000, 8000, 4000, 2000, 1000, 500, 250, 125, | 748 | 16000, 8000, 4000, 2000, 1000, 500, 250, 125, |
749 | }; | 749 | }; |
750 | 750 | ||
751 | static ssize_t show_update_rate(struct device *dev, | 751 | static ssize_t show_update_interval(struct device *dev, |
752 | struct device_attribute *attr, char *buf) | 752 | struct device_attribute *attr, char *buf) |
753 | { | 753 | { |
754 | struct i2c_client *client = to_i2c_client(dev); | 754 | struct i2c_client *client = to_i2c_client(dev); |
755 | struct adm1031_data *data = i2c_get_clientdata(client); | 755 | struct adm1031_data *data = i2c_get_clientdata(client); |
756 | 756 | ||
757 | return sprintf(buf, "%u\n", data->update_rate); | 757 | return sprintf(buf, "%u\n", data->update_interval); |
758 | } | 758 | } |
759 | 759 | ||
760 | static ssize_t set_update_rate(struct device *dev, | 760 | static ssize_t set_update_interval(struct device *dev, |
761 | struct device_attribute *attr, | 761 | struct device_attribute *attr, |
762 | const char *buf, size_t count) | 762 | const char *buf, size_t count) |
763 | { | 763 | { |
764 | struct i2c_client *client = to_i2c_client(dev); | 764 | struct i2c_client *client = to_i2c_client(dev); |
765 | struct adm1031_data *data = i2c_get_clientdata(client); | 765 | struct adm1031_data *data = i2c_get_clientdata(client); |
@@ -771,12 +771,15 @@ static ssize_t set_update_rate(struct device *dev, | |||
771 | if (err) | 771 | if (err) |
772 | return err; | 772 | return err; |
773 | 773 | ||
774 | /* find the nearest update rate from the table */ | 774 | /* |
775 | for (i = 0; i < ARRAY_SIZE(update_rates) - 1; i++) { | 775 | * Find the nearest update interval from the table. |
776 | if (val >= update_rates[i]) | 776 | * Use it to determine the matching update rate. |
777 | */ | ||
778 | for (i = 0; i < ARRAY_SIZE(update_intervals) - 1; i++) { | ||
779 | if (val >= update_intervals[i]) | ||
777 | break; | 780 | break; |
778 | } | 781 | } |
779 | /* if not found, we point to the last entry (lowest update rate) */ | 782 | /* if not found, we point to the last entry (lowest update interval) */ |
780 | 783 | ||
781 | /* set the new update rate while preserving other settings */ | 784 | /* set the new update rate while preserving other settings */ |
782 | reg = adm1031_read_value(client, ADM1031_REG_FAN_FILTER); | 785 | reg = adm1031_read_value(client, ADM1031_REG_FAN_FILTER); |
@@ -785,14 +788,14 @@ static ssize_t set_update_rate(struct device *dev, | |||
785 | adm1031_write_value(client, ADM1031_REG_FAN_FILTER, reg); | 788 | adm1031_write_value(client, ADM1031_REG_FAN_FILTER, reg); |
786 | 789 | ||
787 | mutex_lock(&data->update_lock); | 790 | mutex_lock(&data->update_lock); |
788 | data->update_rate = update_rates[i]; | 791 | data->update_interval = update_intervals[i]; |
789 | mutex_unlock(&data->update_lock); | 792 | mutex_unlock(&data->update_lock); |
790 | 793 | ||
791 | return count; | 794 | return count; |
792 | } | 795 | } |
793 | 796 | ||
794 | static DEVICE_ATTR(update_rate, S_IRUGO | S_IWUSR, show_update_rate, | 797 | static DEVICE_ATTR(update_interval, S_IRUGO | S_IWUSR, show_update_interval, |
795 | set_update_rate); | 798 | set_update_interval); |
796 | 799 | ||
797 | static struct attribute *adm1031_attributes[] = { | 800 | static struct attribute *adm1031_attributes[] = { |
798 | &sensor_dev_attr_fan1_input.dev_attr.attr, | 801 | &sensor_dev_attr_fan1_input.dev_attr.attr, |
@@ -830,7 +833,7 @@ static struct attribute *adm1031_attributes[] = { | |||
830 | 833 | ||
831 | &sensor_dev_attr_auto_fan1_min_pwm.dev_attr.attr, | 834 | &sensor_dev_attr_auto_fan1_min_pwm.dev_attr.attr, |
832 | 835 | ||
833 | &dev_attr_update_rate.attr, | 836 | &dev_attr_update_interval.attr, |
834 | &dev_attr_alarms.attr, | 837 | &dev_attr_alarms.attr, |
835 | 838 | ||
836 | NULL | 839 | NULL |
@@ -981,7 +984,8 @@ static void adm1031_init_client(struct i2c_client *client) | |||
981 | mask = ADM1031_UPDATE_RATE_MASK; | 984 | mask = ADM1031_UPDATE_RATE_MASK; |
982 | read_val = adm1031_read_value(client, ADM1031_REG_FAN_FILTER); | 985 | read_val = adm1031_read_value(client, ADM1031_REG_FAN_FILTER); |
983 | i = (read_val & mask) >> ADM1031_UPDATE_RATE_SHIFT; | 986 | i = (read_val & mask) >> ADM1031_UPDATE_RATE_SHIFT; |
984 | data->update_rate = update_rates[i]; | 987 | /* Save it as update interval */ |
988 | data->update_interval = update_intervals[i]; | ||
985 | } | 989 | } |
986 | 990 | ||
987 | static struct adm1031_data *adm1031_update_device(struct device *dev) | 991 | static struct adm1031_data *adm1031_update_device(struct device *dev) |
@@ -993,7 +997,8 @@ static struct adm1031_data *adm1031_update_device(struct device *dev) | |||
993 | 997 | ||
994 | mutex_lock(&data->update_lock); | 998 | mutex_lock(&data->update_lock); |
995 | 999 | ||
996 | next_update = data->last_updated + msecs_to_jiffies(data->update_rate); | 1000 | next_update = data->last_updated |
1001 | + msecs_to_jiffies(data->update_interval); | ||
997 | if (time_after(jiffies, next_update) || !data->valid) { | 1002 | if (time_after(jiffies, next_update) || !data->valid) { |
998 | 1003 | ||
999 | dev_dbg(&client->dev, "Starting adm1031 update\n"); | 1004 | dev_dbg(&client->dev, "Starting adm1031 update\n"); |
diff --git a/drivers/hwmon/emc1403.c b/drivers/hwmon/emc1403.c index 5b58b20dead1..8dee3f38fdfb 100644 --- a/drivers/hwmon/emc1403.c +++ b/drivers/hwmon/emc1403.c | |||
@@ -308,7 +308,6 @@ static int emc1403_probe(struct i2c_client *client, | |||
308 | res = sysfs_create_group(&client->dev.kobj, &m_thermal_gr); | 308 | res = sysfs_create_group(&client->dev.kobj, &m_thermal_gr); |
309 | if (res) { | 309 | if (res) { |
310 | dev_warn(&client->dev, "create group failed\n"); | 310 | dev_warn(&client->dev, "create group failed\n"); |
311 | hwmon_device_unregister(data->hwmon_dev); | ||
312 | goto thermal_error1; | 311 | goto thermal_error1; |
313 | } | 312 | } |
314 | data->hwmon_dev = hwmon_device_register(&client->dev); | 313 | data->hwmon_dev = hwmon_device_register(&client->dev); |
diff --git a/drivers/hwmon/f75375s.c b/drivers/hwmon/f75375s.c index 0f58ecc5334d..9638d58f99fd 100644 --- a/drivers/hwmon/f75375s.c +++ b/drivers/hwmon/f75375s.c | |||
@@ -79,7 +79,7 @@ enum chips { f75373, f75375 }; | |||
79 | #define F75375_REG_PWM2_DROP_DUTY 0x6C | 79 | #define F75375_REG_PWM2_DROP_DUTY 0x6C |
80 | 80 | ||
81 | #define FAN_CTRL_LINEAR(nr) (4 + nr) | 81 | #define FAN_CTRL_LINEAR(nr) (4 + nr) |
82 | #define FAN_CTRL_MODE(nr) (5 + ((nr) * 2)) | 82 | #define FAN_CTRL_MODE(nr) (4 + ((nr) * 2)) |
83 | 83 | ||
84 | /* | 84 | /* |
85 | * Data structures and manipulation thereof | 85 | * Data structures and manipulation thereof |
@@ -298,7 +298,7 @@ static int set_pwm_enable_direct(struct i2c_client *client, int nr, int val) | |||
298 | return -EINVAL; | 298 | return -EINVAL; |
299 | 299 | ||
300 | fanmode = f75375_read8(client, F75375_REG_FAN_TIMER); | 300 | fanmode = f75375_read8(client, F75375_REG_FAN_TIMER); |
301 | fanmode = ~(3 << FAN_CTRL_MODE(nr)); | 301 | fanmode &= ~(3 << FAN_CTRL_MODE(nr)); |
302 | 302 | ||
303 | switch (val) { | 303 | switch (val) { |
304 | case 0: /* Full speed */ | 304 | case 0: /* Full speed */ |
@@ -350,7 +350,7 @@ static ssize_t set_pwm_mode(struct device *dev, struct device_attribute *attr, | |||
350 | 350 | ||
351 | mutex_lock(&data->update_lock); | 351 | mutex_lock(&data->update_lock); |
352 | conf = f75375_read8(client, F75375_REG_CONFIG1); | 352 | conf = f75375_read8(client, F75375_REG_CONFIG1); |
353 | conf = ~(1 << FAN_CTRL_LINEAR(nr)); | 353 | conf &= ~(1 << FAN_CTRL_LINEAR(nr)); |
354 | 354 | ||
355 | if (val == 0) | 355 | if (val == 0) |
356 | conf |= (1 << FAN_CTRL_LINEAR(nr)) ; | 356 | conf |= (1 << FAN_CTRL_LINEAR(nr)) ; |
diff --git a/drivers/hwmon/lis3lv02d_i2c.c b/drivers/hwmon/lis3lv02d_i2c.c index dc1f5402c1d7..8e5933b72d19 100644 --- a/drivers/hwmon/lis3lv02d_i2c.c +++ b/drivers/hwmon/lis3lv02d_i2c.c | |||
@@ -121,7 +121,7 @@ static int lis3lv02d_i2c_suspend(struct i2c_client *client, pm_message_t mesg) | |||
121 | { | 121 | { |
122 | struct lis3lv02d *lis3 = i2c_get_clientdata(client); | 122 | struct lis3lv02d *lis3 = i2c_get_clientdata(client); |
123 | 123 | ||
124 | if (!lis3->pdata->wakeup_flags) | 124 | if (!lis3->pdata || !lis3->pdata->wakeup_flags) |
125 | lis3lv02d_poweroff(lis3); | 125 | lis3lv02d_poweroff(lis3); |
126 | return 0; | 126 | return 0; |
127 | } | 127 | } |
@@ -130,7 +130,7 @@ static int lis3lv02d_i2c_resume(struct i2c_client *client) | |||
130 | { | 130 | { |
131 | struct lis3lv02d *lis3 = i2c_get_clientdata(client); | 131 | struct lis3lv02d *lis3 = i2c_get_clientdata(client); |
132 | 132 | ||
133 | if (!lis3->pdata->wakeup_flags) | 133 | if (!lis3->pdata || !lis3->pdata->wakeup_flags) |
134 | lis3lv02d_poweron(lis3); | 134 | lis3lv02d_poweron(lis3); |
135 | return 0; | 135 | return 0; |
136 | } | 136 | } |
diff --git a/drivers/hwmon/lis3lv02d_spi.c b/drivers/hwmon/lis3lv02d_spi.c index 82b16808a274..b9be5e3a22b3 100644 --- a/drivers/hwmon/lis3lv02d_spi.c +++ b/drivers/hwmon/lis3lv02d_spi.c | |||
@@ -92,7 +92,7 @@ static int lis3lv02d_spi_suspend(struct spi_device *spi, pm_message_t mesg) | |||
92 | { | 92 | { |
93 | struct lis3lv02d *lis3 = spi_get_drvdata(spi); | 93 | struct lis3lv02d *lis3 = spi_get_drvdata(spi); |
94 | 94 | ||
95 | if (!lis3->pdata->wakeup_flags) | 95 | if (!lis3->pdata || !lis3->pdata->wakeup_flags) |
96 | lis3lv02d_poweroff(&lis3_dev); | 96 | lis3lv02d_poweroff(&lis3_dev); |
97 | 97 | ||
98 | return 0; | 98 | return 0; |
@@ -102,7 +102,7 @@ static int lis3lv02d_spi_resume(struct spi_device *spi) | |||
102 | { | 102 | { |
103 | struct lis3lv02d *lis3 = spi_get_drvdata(spi); | 103 | struct lis3lv02d *lis3 = spi_get_drvdata(spi); |
104 | 104 | ||
105 | if (!lis3->pdata->wakeup_flags) | 105 | if (!lis3->pdata || !lis3->pdata->wakeup_flags) |
106 | lis3lv02d_poweron(lis3); | 106 | lis3lv02d_poweron(lis3); |
107 | 107 | ||
108 | return 0; | 108 | return 0; |
diff --git a/drivers/hwmon/lm95241.c b/drivers/hwmon/lm95241.c index 94741d42112d..464340f25496 100644 --- a/drivers/hwmon/lm95241.c +++ b/drivers/hwmon/lm95241.c | |||
@@ -91,7 +91,7 @@ static struct lm95241_data *lm95241_update_device(struct device *dev); | |||
91 | struct lm95241_data { | 91 | struct lm95241_data { |
92 | struct device *hwmon_dev; | 92 | struct device *hwmon_dev; |
93 | struct mutex update_lock; | 93 | struct mutex update_lock; |
94 | unsigned long last_updated, rate; /* in jiffies */ | 94 | unsigned long last_updated, interval; /* in jiffies */ |
95 | char valid; /* zero until following fields are valid */ | 95 | char valid; /* zero until following fields are valid */ |
96 | /* registers values */ | 96 | /* registers values */ |
97 | u8 local_h, local_l; /* local */ | 97 | u8 local_h, local_l; /* local */ |
@@ -114,23 +114,23 @@ show_temp(local); | |||
114 | show_temp(remote1); | 114 | show_temp(remote1); |
115 | show_temp(remote2); | 115 | show_temp(remote2); |
116 | 116 | ||
117 | static ssize_t show_rate(struct device *dev, struct device_attribute *attr, | 117 | static ssize_t show_interval(struct device *dev, struct device_attribute *attr, |
118 | char *buf) | 118 | char *buf) |
119 | { | 119 | { |
120 | struct lm95241_data *data = lm95241_update_device(dev); | 120 | struct lm95241_data *data = lm95241_update_device(dev); |
121 | 121 | ||
122 | snprintf(buf, PAGE_SIZE - 1, "%lu\n", 1000 * data->rate / HZ); | 122 | snprintf(buf, PAGE_SIZE - 1, "%lu\n", 1000 * data->interval / HZ); |
123 | return strlen(buf); | 123 | return strlen(buf); |
124 | } | 124 | } |
125 | 125 | ||
126 | static ssize_t set_rate(struct device *dev, struct device_attribute *attr, | 126 | static ssize_t set_interval(struct device *dev, struct device_attribute *attr, |
127 | const char *buf, size_t count) | 127 | const char *buf, size_t count) |
128 | { | 128 | { |
129 | struct i2c_client *client = to_i2c_client(dev); | 129 | struct i2c_client *client = to_i2c_client(dev); |
130 | struct lm95241_data *data = i2c_get_clientdata(client); | 130 | struct lm95241_data *data = i2c_get_clientdata(client); |
131 | 131 | ||
132 | strict_strtol(buf, 10, &data->rate); | 132 | strict_strtol(buf, 10, &data->interval); |
133 | data->rate = data->rate * HZ / 1000; | 133 | data->interval = data->interval * HZ / 1000; |
134 | 134 | ||
135 | return count; | 135 | return count; |
136 | } | 136 | } |
@@ -286,7 +286,8 @@ static DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_min1, set_min1); | |||
286 | static DEVICE_ATTR(temp3_min, S_IWUSR | S_IRUGO, show_min2, set_min2); | 286 | static DEVICE_ATTR(temp3_min, S_IWUSR | S_IRUGO, show_min2, set_min2); |
287 | static DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, show_max1, set_max1); | 287 | static DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, show_max1, set_max1); |
288 | static DEVICE_ATTR(temp3_max, S_IWUSR | S_IRUGO, show_max2, set_max2); | 288 | static DEVICE_ATTR(temp3_max, S_IWUSR | S_IRUGO, show_max2, set_max2); |
289 | static DEVICE_ATTR(rate, S_IWUSR | S_IRUGO, show_rate, set_rate); | 289 | static DEVICE_ATTR(update_interval, S_IWUSR | S_IRUGO, show_interval, |
290 | set_interval); | ||
290 | 291 | ||
291 | static struct attribute *lm95241_attributes[] = { | 292 | static struct attribute *lm95241_attributes[] = { |
292 | &dev_attr_temp1_input.attr, | 293 | &dev_attr_temp1_input.attr, |
@@ -298,7 +299,7 @@ static struct attribute *lm95241_attributes[] = { | |||
298 | &dev_attr_temp3_min.attr, | 299 | &dev_attr_temp3_min.attr, |
299 | &dev_attr_temp2_max.attr, | 300 | &dev_attr_temp2_max.attr, |
300 | &dev_attr_temp3_max.attr, | 301 | &dev_attr_temp3_max.attr, |
301 | &dev_attr_rate.attr, | 302 | &dev_attr_update_interval.attr, |
302 | NULL | 303 | NULL |
303 | }; | 304 | }; |
304 | 305 | ||
@@ -376,7 +377,7 @@ static void lm95241_init_client(struct i2c_client *client) | |||
376 | { | 377 | { |
377 | struct lm95241_data *data = i2c_get_clientdata(client); | 378 | struct lm95241_data *data = i2c_get_clientdata(client); |
378 | 379 | ||
379 | data->rate = HZ; /* 1 sec default */ | 380 | data->interval = HZ; /* 1 sec default */ |
380 | data->valid = 0; | 381 | data->valid = 0; |
381 | data->config = CFG_CR0076; | 382 | data->config = CFG_CR0076; |
382 | data->model = 0; | 383 | data->model = 0; |
@@ -410,7 +411,7 @@ static struct lm95241_data *lm95241_update_device(struct device *dev) | |||
410 | 411 | ||
411 | mutex_lock(&data->update_lock); | 412 | mutex_lock(&data->update_lock); |
412 | 413 | ||
413 | if (time_after(jiffies, data->last_updated + data->rate) || | 414 | if (time_after(jiffies, data->last_updated + data->interval) || |
414 | !data->valid) { | 415 | !data->valid) { |
415 | dev_dbg(&client->dev, "Updating lm95241 data.\n"); | 416 | dev_dbg(&client->dev, "Updating lm95241 data.\n"); |
416 | data->local_h = | 417 | data->local_h = |
diff --git a/drivers/hwmon/w83627ehf.c b/drivers/hwmon/w83627ehf.c index e96e69dd36fb..072c58008a63 100644 --- a/drivers/hwmon/w83627ehf.c +++ b/drivers/hwmon/w83627ehf.c | |||
@@ -127,6 +127,7 @@ superio_enter(int ioreg) | |||
127 | static inline void | 127 | static inline void |
128 | superio_exit(int ioreg) | 128 | superio_exit(int ioreg) |
129 | { | 129 | { |
130 | outb(0xaa, ioreg); | ||
130 | outb(0x02, ioreg); | 131 | outb(0x02, ioreg); |
131 | outb(0x02, ioreg + 1); | 132 | outb(0x02, ioreg + 1); |
132 | } | 133 | } |
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 7674efb55378..b33c78586bfc 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c | |||
@@ -680,6 +680,8 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) | |||
680 | 680 | ||
681 | if (r == 0) | 681 | if (r == 0) |
682 | r = num; | 682 | r = num; |
683 | |||
684 | omap_i2c_wait_for_bb(dev); | ||
683 | out: | 685 | out: |
684 | omap_i2c_idle(dev); | 686 | omap_i2c_idle(dev); |
685 | return r; | 687 | return r; |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 4c3d1bfec0c5..068cef0a987a 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -1448,19 +1448,13 @@ int ide_host_register(struct ide_host *host, const struct ide_port_info *d, | |||
1448 | if (hwif == NULL) | 1448 | if (hwif == NULL) |
1449 | continue; | 1449 | continue; |
1450 | 1450 | ||
1451 | if (hwif->present) | ||
1452 | hwif_register_devices(hwif); | ||
1453 | } | ||
1454 | |||
1455 | ide_host_for_each_port(i, hwif, host) { | ||
1456 | if (hwif == NULL) | ||
1457 | continue; | ||
1458 | |||
1459 | ide_sysfs_register_port(hwif); | 1451 | ide_sysfs_register_port(hwif); |
1460 | ide_proc_register_port(hwif); | 1452 | ide_proc_register_port(hwif); |
1461 | 1453 | ||
1462 | if (hwif->present) | 1454 | if (hwif->present) { |
1463 | ide_proc_port_register_devices(hwif); | 1455 | ide_proc_port_register_devices(hwif); |
1456 | hwif_register_devices(hwif); | ||
1457 | } | ||
1464 | } | 1458 | } |
1465 | 1459 | ||
1466 | return j ? 0 : -1; | 1460 | return j ? 0 : -1; |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 43cf9cc9c1df..f20d13e717d5 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -1643,7 +1643,9 @@ static void super_1_sync(mddev_t *mddev, mdk_rdev_t *rdev) | |||
1643 | bmask = queue_logical_block_size(rdev->bdev->bd_disk->queue)-1; | 1643 | bmask = queue_logical_block_size(rdev->bdev->bd_disk->queue)-1; |
1644 | if (rdev->sb_size & bmask) | 1644 | if (rdev->sb_size & bmask) |
1645 | rdev->sb_size = (rdev->sb_size | bmask) + 1; | 1645 | rdev->sb_size = (rdev->sb_size | bmask) + 1; |
1646 | } | 1646 | } else |
1647 | max_dev = le32_to_cpu(sb->max_dev); | ||
1648 | |||
1647 | for (i=0; i<max_dev;i++) | 1649 | for (i=0; i<max_dev;i++) |
1648 | sb->dev_roles[i] = cpu_to_le16(0xfffe); | 1650 | sb->dev_roles[i] = cpu_to_le16(0xfffe); |
1649 | 1651 | ||
@@ -7069,7 +7071,7 @@ void md_check_recovery(mddev_t *mddev) | |||
7069 | if (mddev->ro && !test_bit(MD_RECOVERY_NEEDED, &mddev->recovery)) | 7071 | if (mddev->ro && !test_bit(MD_RECOVERY_NEEDED, &mddev->recovery)) |
7070 | return; | 7072 | return; |
7071 | if ( ! ( | 7073 | if ( ! ( |
7072 | (mddev->flags && !mddev->external) || | 7074 | (mddev->flags & ~ (1<<MD_CHANGE_PENDING)) || |
7073 | test_bit(MD_RECOVERY_NEEDED, &mddev->recovery) || | 7075 | test_bit(MD_RECOVERY_NEEDED, &mddev->recovery) || |
7074 | test_bit(MD_RECOVERY_DONE, &mddev->recovery) || | 7076 | test_bit(MD_RECOVERY_DONE, &mddev->recovery) || |
7075 | (mddev->external == 0 && mddev->safemode == 1) || | 7077 | (mddev->external == 0 && mddev->safemode == 1) || |
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 0b591b658243..b74331260744 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig | |||
@@ -368,7 +368,7 @@ config VMWARE_BALLOON | |||
368 | If unsure, say N. | 368 | If unsure, say N. |
369 | 369 | ||
370 | To compile this driver as a module, choose M here: the | 370 | To compile this driver as a module, choose M here: the |
371 | module will be called vmware_balloon. | 371 | module will be called vmw_balloon. |
372 | 372 | ||
373 | config ARM_CHARLCD | 373 | config ARM_CHARLCD |
374 | bool "ARM Ltd. Character LCD Driver" | 374 | bool "ARM Ltd. Character LCD Driver" |
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index 255a80dc9d73..42eab95cde2a 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile | |||
@@ -33,5 +33,5 @@ obj-$(CONFIG_IWMC3200TOP) += iwmc3200top/ | |||
33 | obj-$(CONFIG_HMC6352) += hmc6352.o | 33 | obj-$(CONFIG_HMC6352) += hmc6352.o |
34 | obj-y += eeprom/ | 34 | obj-y += eeprom/ |
35 | obj-y += cb710/ | 35 | obj-y += cb710/ |
36 | obj-$(CONFIG_VMWARE_BALLOON) += vmware_balloon.o | 36 | obj-$(CONFIG_VMWARE_BALLOON) += vmw_balloon.o |
37 | obj-$(CONFIG_ARM_CHARLCD) += arm-charlcd.o | 37 | obj-$(CONFIG_ARM_CHARLCD) += arm-charlcd.o |
diff --git a/drivers/misc/vmware_balloon.c b/drivers/misc/vmw_balloon.c index 2a1e804a71aa..2a1e804a71aa 100644 --- a/drivers/misc/vmware_balloon.c +++ b/drivers/misc/vmw_balloon.c | |||
diff --git a/drivers/mtd/nand/bf5xx_nand.c b/drivers/mtd/nand/bf5xx_nand.c index a382e3dd0a5d..6fbeefa3a766 100644 --- a/drivers/mtd/nand/bf5xx_nand.c +++ b/drivers/mtd/nand/bf5xx_nand.c | |||
@@ -682,7 +682,6 @@ static int __devinit bf5xx_nand_add_partition(struct bf5xx_nand_info *info) | |||
682 | static int __devexit bf5xx_nand_remove(struct platform_device *pdev) | 682 | static int __devexit bf5xx_nand_remove(struct platform_device *pdev) |
683 | { | 683 | { |
684 | struct bf5xx_nand_info *info = to_nand_info(pdev); | 684 | struct bf5xx_nand_info *info = to_nand_info(pdev); |
685 | struct mtd_info *mtd = NULL; | ||
686 | 685 | ||
687 | platform_set_drvdata(pdev, NULL); | 686 | platform_set_drvdata(pdev, NULL); |
688 | 687 | ||
@@ -690,11 +689,7 @@ static int __devexit bf5xx_nand_remove(struct platform_device *pdev) | |||
690 | * and their partitions, then go through freeing the | 689 | * and their partitions, then go through freeing the |
691 | * resources used | 690 | * resources used |
692 | */ | 691 | */ |
693 | mtd = &info->mtd; | 692 | nand_release(&info->mtd); |
694 | if (mtd) { | ||
695 | nand_release(mtd); | ||
696 | kfree(mtd); | ||
697 | } | ||
698 | 693 | ||
699 | peripheral_free_list(bfin_nfc_pin_req); | 694 | peripheral_free_list(bfin_nfc_pin_req); |
700 | bf5xx_nand_dma_remove(info); | 695 | bf5xx_nand_dma_remove(info); |
@@ -710,7 +705,7 @@ static int bf5xx_nand_scan(struct mtd_info *mtd) | |||
710 | struct nand_chip *chip = mtd->priv; | 705 | struct nand_chip *chip = mtd->priv; |
711 | int ret; | 706 | int ret; |
712 | 707 | ||
713 | ret = nand_scan_ident(mtd, 1); | 708 | ret = nand_scan_ident(mtd, 1, NULL); |
714 | if (ret) | 709 | if (ret) |
715 | return ret; | 710 | return ret; |
716 | 711 | ||
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c index fcf8ceb277d4..b2828e84d243 100644 --- a/drivers/mtd/nand/mxc_nand.c +++ b/drivers/mtd/nand/mxc_nand.c | |||
@@ -67,7 +67,9 @@ | |||
67 | #define NFC_V1_V2_CONFIG1_BIG (1 << 5) | 67 | #define NFC_V1_V2_CONFIG1_BIG (1 << 5) |
68 | #define NFC_V1_V2_CONFIG1_RST (1 << 6) | 68 | #define NFC_V1_V2_CONFIG1_RST (1 << 6) |
69 | #define NFC_V1_V2_CONFIG1_CE (1 << 7) | 69 | #define NFC_V1_V2_CONFIG1_CE (1 << 7) |
70 | #define NFC_V1_V2_CONFIG1_ONE_CYCLE (1 << 8) | 70 | #define NFC_V2_CONFIG1_ONE_CYCLE (1 << 8) |
71 | #define NFC_V2_CONFIG1_PPB(x) (((x) & 0x3) << 9) | ||
72 | #define NFC_V2_CONFIG1_FP_INT (1 << 11) | ||
71 | 73 | ||
72 | #define NFC_V1_V2_CONFIG2_INT (1 << 15) | 74 | #define NFC_V1_V2_CONFIG2_INT (1 << 15) |
73 | 75 | ||
@@ -402,16 +404,16 @@ static void send_read_id_v1_v2(struct mxc_nand_host *host) | |||
402 | /* Wait for operation to complete */ | 404 | /* Wait for operation to complete */ |
403 | wait_op_done(host, true); | 405 | wait_op_done(host, true); |
404 | 406 | ||
407 | memcpy(host->data_buf, host->main_area0, 16); | ||
408 | |||
405 | if (this->options & NAND_BUSWIDTH_16) { | 409 | if (this->options & NAND_BUSWIDTH_16) { |
406 | void __iomem *main_buf = host->main_area0; | ||
407 | /* compress the ID info */ | 410 | /* compress the ID info */ |
408 | writeb(readb(main_buf + 2), main_buf + 1); | 411 | host->data_buf[1] = host->data_buf[2]; |
409 | writeb(readb(main_buf + 4), main_buf + 2); | 412 | host->data_buf[2] = host->data_buf[4]; |
410 | writeb(readb(main_buf + 6), main_buf + 3); | 413 | host->data_buf[3] = host->data_buf[6]; |
411 | writeb(readb(main_buf + 8), main_buf + 4); | 414 | host->data_buf[4] = host->data_buf[8]; |
412 | writeb(readb(main_buf + 10), main_buf + 5); | 415 | host->data_buf[5] = host->data_buf[10]; |
413 | } | 416 | } |
414 | memcpy(host->data_buf, host->main_area0, 16); | ||
415 | } | 417 | } |
416 | 418 | ||
417 | static uint16_t get_dev_status_v3(struct mxc_nand_host *host) | 419 | static uint16_t get_dev_status_v3(struct mxc_nand_host *host) |
@@ -729,27 +731,30 @@ static void preset_v1_v2(struct mtd_info *mtd) | |||
729 | { | 731 | { |
730 | struct nand_chip *nand_chip = mtd->priv; | 732 | struct nand_chip *nand_chip = mtd->priv; |
731 | struct mxc_nand_host *host = nand_chip->priv; | 733 | struct mxc_nand_host *host = nand_chip->priv; |
732 | uint16_t tmp; | 734 | uint16_t config1 = 0; |
733 | 735 | ||
734 | /* enable interrupt, disable spare enable */ | 736 | if (nand_chip->ecc.mode == NAND_ECC_HW) |
735 | tmp = readw(NFC_V1_V2_CONFIG1); | 737 | config1 |= NFC_V1_V2_CONFIG1_ECC_EN; |
736 | tmp &= ~NFC_V1_V2_CONFIG1_INT_MSK; | 738 | |
737 | tmp &= ~NFC_V1_V2_CONFIG1_SP_EN; | 739 | if (nfc_is_v21()) |
738 | if (nand_chip->ecc.mode == NAND_ECC_HW) { | 740 | config1 |= NFC_V2_CONFIG1_FP_INT; |
739 | tmp |= NFC_V1_V2_CONFIG1_ECC_EN; | 741 | |
740 | } else { | 742 | if (!cpu_is_mx21()) |
741 | tmp &= ~NFC_V1_V2_CONFIG1_ECC_EN; | 743 | config1 |= NFC_V1_V2_CONFIG1_INT_MSK; |
742 | } | ||
743 | 744 | ||
744 | if (nfc_is_v21() && mtd->writesize) { | 745 | if (nfc_is_v21() && mtd->writesize) { |
746 | uint16_t pages_per_block = mtd->erasesize / mtd->writesize; | ||
747 | |||
745 | host->eccsize = get_eccsize(mtd); | 748 | host->eccsize = get_eccsize(mtd); |
746 | if (host->eccsize == 4) | 749 | if (host->eccsize == 4) |
747 | tmp |= NFC_V2_CONFIG1_ECC_MODE_4; | 750 | config1 |= NFC_V2_CONFIG1_ECC_MODE_4; |
751 | |||
752 | config1 |= NFC_V2_CONFIG1_PPB(ffs(pages_per_block) - 6); | ||
748 | } else { | 753 | } else { |
749 | host->eccsize = 1; | 754 | host->eccsize = 1; |
750 | } | 755 | } |
751 | 756 | ||
752 | writew(tmp, NFC_V1_V2_CONFIG1); | 757 | writew(config1, NFC_V1_V2_CONFIG1); |
753 | /* preset operation */ | 758 | /* preset operation */ |
754 | 759 | ||
755 | /* Unlock the internal RAM Buffer */ | 760 | /* Unlock the internal RAM Buffer */ |
diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c index 4d89f3780207..4d01cda68844 100644 --- a/drivers/mtd/nand/pxa3xx_nand.c +++ b/drivers/mtd/nand/pxa3xx_nand.c | |||
@@ -1320,6 +1320,7 @@ static int pxa3xx_nand_probe(struct platform_device *pdev) | |||
1320 | goto fail_free_irq; | 1320 | goto fail_free_irq; |
1321 | } | 1321 | } |
1322 | 1322 | ||
1323 | #ifdef CONFIG_MTD_PARTITIONS | ||
1323 | if (mtd_has_cmdlinepart()) { | 1324 | if (mtd_has_cmdlinepart()) { |
1324 | static const char *probes[] = { "cmdlinepart", NULL }; | 1325 | static const char *probes[] = { "cmdlinepart", NULL }; |
1325 | struct mtd_partition *parts; | 1326 | struct mtd_partition *parts; |
@@ -1332,6 +1333,9 @@ static int pxa3xx_nand_probe(struct platform_device *pdev) | |||
1332 | } | 1333 | } |
1333 | 1334 | ||
1334 | return add_mtd_partitions(mtd, pdata->parts, pdata->nr_parts); | 1335 | return add_mtd_partitions(mtd, pdata->parts, pdata->nr_parts); |
1336 | #else | ||
1337 | return 0; | ||
1338 | #endif | ||
1335 | 1339 | ||
1336 | fail_free_irq: | 1340 | fail_free_irq: |
1337 | free_irq(irq, info); | 1341 | free_irq(irq, info); |
@@ -1364,7 +1368,9 @@ static int pxa3xx_nand_remove(struct platform_device *pdev) | |||
1364 | platform_set_drvdata(pdev, NULL); | 1368 | platform_set_drvdata(pdev, NULL); |
1365 | 1369 | ||
1366 | del_mtd_device(mtd); | 1370 | del_mtd_device(mtd); |
1371 | #ifdef CONFIG_MTD_PARTITIONS | ||
1367 | del_mtd_partitions(mtd); | 1372 | del_mtd_partitions(mtd); |
1373 | #endif | ||
1368 | irq = platform_get_irq(pdev, 0); | 1374 | irq = platform_get_irq(pdev, 0); |
1369 | if (irq >= 0) | 1375 | if (irq >= 0) |
1370 | free_irq(irq, info); | 1376 | free_irq(irq, info); |
diff --git a/drivers/mtd/onenand/samsung.c b/drivers/mtd/onenand/samsung.c index cb443af3d45f..a460f1b748c2 100644 --- a/drivers/mtd/onenand/samsung.c +++ b/drivers/mtd/onenand/samsung.c | |||
@@ -554,14 +554,13 @@ static int s5pc110_dma_ops(void *dst, void *src, size_t count, int direction) | |||
554 | 554 | ||
555 | do { | 555 | do { |
556 | status = readl(base + S5PC110_DMA_TRANS_STATUS); | 556 | status = readl(base + S5PC110_DMA_TRANS_STATUS); |
557 | if (status & S5PC110_DMA_TRANS_STATUS_TE) { | ||
558 | writel(S5PC110_DMA_TRANS_CMD_TEC, | ||
559 | base + S5PC110_DMA_TRANS_CMD); | ||
560 | return -EIO; | ||
561 | } | ||
557 | } while (!(status & S5PC110_DMA_TRANS_STATUS_TD)); | 562 | } while (!(status & S5PC110_DMA_TRANS_STATUS_TD)); |
558 | 563 | ||
559 | if (status & S5PC110_DMA_TRANS_STATUS_TE) { | ||
560 | writel(S5PC110_DMA_TRANS_CMD_TEC, base + S5PC110_DMA_TRANS_CMD); | ||
561 | writel(S5PC110_DMA_TRANS_CMD_TDC, base + S5PC110_DMA_TRANS_CMD); | ||
562 | return -EIO; | ||
563 | } | ||
564 | |||
565 | writel(S5PC110_DMA_TRANS_CMD_TDC, base + S5PC110_DMA_TRANS_CMD); | 564 | writel(S5PC110_DMA_TRANS_CMD_TDC, base + S5PC110_DMA_TRANS_CMD); |
566 | 565 | ||
567 | return 0; | 566 | return 0; |
@@ -571,13 +570,12 @@ static int s5pc110_read_bufferram(struct mtd_info *mtd, int area, | |||
571 | unsigned char *buffer, int offset, size_t count) | 570 | unsigned char *buffer, int offset, size_t count) |
572 | { | 571 | { |
573 | struct onenand_chip *this = mtd->priv; | 572 | struct onenand_chip *this = mtd->priv; |
574 | void __iomem *bufferram; | ||
575 | void __iomem *p; | 573 | void __iomem *p; |
576 | void *buf = (void *) buffer; | 574 | void *buf = (void *) buffer; |
577 | dma_addr_t dma_src, dma_dst; | 575 | dma_addr_t dma_src, dma_dst; |
578 | int err; | 576 | int err; |
579 | 577 | ||
580 | p = bufferram = this->base + area; | 578 | p = this->base + area; |
581 | if (ONENAND_CURRENT_BUFFERRAM(this)) { | 579 | if (ONENAND_CURRENT_BUFFERRAM(this)) { |
582 | if (area == ONENAND_DATARAM) | 580 | if (area == ONENAND_DATARAM) |
583 | p += this->writesize; | 581 | p += this->writesize; |
@@ -621,7 +619,7 @@ static int s5pc110_read_bufferram(struct mtd_info *mtd, int area, | |||
621 | normal: | 619 | normal: |
622 | if (count != mtd->writesize) { | 620 | if (count != mtd->writesize) { |
623 | /* Copy the bufferram to memory to prevent unaligned access */ | 621 | /* Copy the bufferram to memory to prevent unaligned access */ |
624 | memcpy(this->page_buf, bufferram, mtd->writesize); | 622 | memcpy(this->page_buf, p, mtd->writesize); |
625 | p = this->page_buf + offset; | 623 | p = this->page_buf + offset; |
626 | } | 624 | } |
627 | 625 | ||
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index 85671adae455..fa42103b2874 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c | |||
@@ -635,6 +635,9 @@ struct vortex_private { | |||
635 | must_free_region:1, /* Flag: if zero, Cardbus owns the I/O region */ | 635 | must_free_region:1, /* Flag: if zero, Cardbus owns the I/O region */ |
636 | large_frames:1, /* accept large frames */ | 636 | large_frames:1, /* accept large frames */ |
637 | handling_irq:1; /* private in_irq indicator */ | 637 | handling_irq:1; /* private in_irq indicator */ |
638 | /* {get|set}_wol operations are already serialized by rtnl. | ||
639 | * no additional locking is required for the enable_wol and acpi_set_WOL() | ||
640 | */ | ||
638 | int drv_flags; | 641 | int drv_flags; |
639 | u16 status_enable; | 642 | u16 status_enable; |
640 | u16 intr_enable; | 643 | u16 intr_enable; |
@@ -2939,13 +2942,11 @@ static void vortex_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | |||
2939 | { | 2942 | { |
2940 | struct vortex_private *vp = netdev_priv(dev); | 2943 | struct vortex_private *vp = netdev_priv(dev); |
2941 | 2944 | ||
2942 | spin_lock_irq(&vp->lock); | ||
2943 | wol->supported = WAKE_MAGIC; | 2945 | wol->supported = WAKE_MAGIC; |
2944 | 2946 | ||
2945 | wol->wolopts = 0; | 2947 | wol->wolopts = 0; |
2946 | if (vp->enable_wol) | 2948 | if (vp->enable_wol) |
2947 | wol->wolopts |= WAKE_MAGIC; | 2949 | wol->wolopts |= WAKE_MAGIC; |
2948 | spin_unlock_irq(&vp->lock); | ||
2949 | } | 2950 | } |
2950 | 2951 | ||
2951 | static int vortex_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | 2952 | static int vortex_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) |
@@ -2954,13 +2955,11 @@ static int vortex_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol) | |||
2954 | if (wol->wolopts & ~WAKE_MAGIC) | 2955 | if (wol->wolopts & ~WAKE_MAGIC) |
2955 | return -EINVAL; | 2956 | return -EINVAL; |
2956 | 2957 | ||
2957 | spin_lock_irq(&vp->lock); | ||
2958 | if (wol->wolopts & WAKE_MAGIC) | 2958 | if (wol->wolopts & WAKE_MAGIC) |
2959 | vp->enable_wol = 1; | 2959 | vp->enable_wol = 1; |
2960 | else | 2960 | else |
2961 | vp->enable_wol = 0; | 2961 | vp->enable_wol = 0; |
2962 | acpi_set_WOL(dev); | 2962 | acpi_set_WOL(dev); |
2963 | spin_unlock_irq(&vp->lock); | ||
2964 | 2963 | ||
2965 | return 0; | 2964 | return 0; |
2966 | } | 2965 | } |
diff --git a/drivers/net/bonding/bond_3ad.c b/drivers/net/bonding/bond_3ad.c index 822f586d72af..0ddf4c66afe2 100644 --- a/drivers/net/bonding/bond_3ad.c +++ b/drivers/net/bonding/bond_3ad.c | |||
@@ -2466,6 +2466,9 @@ int bond_3ad_lacpdu_recv(struct sk_buff *skb, struct net_device *dev, struct pac | |||
2466 | if (!(dev->flags & IFF_MASTER)) | 2466 | if (!(dev->flags & IFF_MASTER)) |
2467 | goto out; | 2467 | goto out; |
2468 | 2468 | ||
2469 | if (!pskb_may_pull(skb, sizeof(struct lacpdu))) | ||
2470 | goto out; | ||
2471 | |||
2469 | read_lock(&bond->lock); | 2472 | read_lock(&bond->lock); |
2470 | slave = bond_get_slave_by_dev((struct bonding *)netdev_priv(dev), | 2473 | slave = bond_get_slave_by_dev((struct bonding *)netdev_priv(dev), |
2471 | orig_dev); | 2474 | orig_dev); |
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index c746b331771d..26bb118c4533 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c | |||
@@ -362,6 +362,9 @@ static int rlb_arp_recv(struct sk_buff *skb, struct net_device *bond_dev, struct | |||
362 | goto out; | 362 | goto out; |
363 | } | 363 | } |
364 | 364 | ||
365 | if (!pskb_may_pull(skb, arp_hdr_len(bond_dev))) | ||
366 | goto out; | ||
367 | |||
365 | if (skb->len < sizeof(struct arp_pkt)) { | 368 | if (skb->len < sizeof(struct arp_pkt)) { |
366 | pr_debug("Packet is too small to be an ARP\n"); | 369 | pr_debug("Packet is too small to be an ARP\n"); |
367 | goto out; | 370 | goto out; |
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c index ad19585d960b..f208712c0b90 100644 --- a/drivers/net/cxgb3/cxgb3_main.c +++ b/drivers/net/cxgb3/cxgb3_main.c | |||
@@ -2296,6 +2296,8 @@ static int cxgb_extension_ioctl(struct net_device *dev, void __user *useraddr) | |||
2296 | case CHELSIO_GET_QSET_NUM:{ | 2296 | case CHELSIO_GET_QSET_NUM:{ |
2297 | struct ch_reg edata; | 2297 | struct ch_reg edata; |
2298 | 2298 | ||
2299 | memset(&edata, 0, sizeof(struct ch_reg)); | ||
2300 | |||
2299 | edata.cmd = CHELSIO_GET_QSET_NUM; | 2301 | edata.cmd = CHELSIO_GET_QSET_NUM; |
2300 | edata.val = pi->nqsets; | 2302 | edata.val = pi->nqsets; |
2301 | if (copy_to_user(useraddr, &edata, sizeof(edata))) | 2303 | if (copy_to_user(useraddr, &edata, sizeof(edata))) |
diff --git a/drivers/net/eql.c b/drivers/net/eql.c index dda2c7944da9..0cb1cf9cf4b0 100644 --- a/drivers/net/eql.c +++ b/drivers/net/eql.c | |||
@@ -555,6 +555,8 @@ static int eql_g_master_cfg(struct net_device *dev, master_config_t __user *mcp) | |||
555 | equalizer_t *eql; | 555 | equalizer_t *eql; |
556 | master_config_t mc; | 556 | master_config_t mc; |
557 | 557 | ||
558 | memset(&mc, 0, sizeof(master_config_t)); | ||
559 | |||
558 | if (eql_is_master(dev)) { | 560 | if (eql_is_master(dev)) { |
559 | eql = netdev_priv(dev); | 561 | eql = netdev_priv(dev); |
560 | mc.max_slaves = eql->max_slaves; | 562 | mc.max_slaves = eql->max_slaves; |
diff --git a/drivers/net/ll_temac_main.c b/drivers/net/ll_temac_main.c index bdf2149e5296..87f0a93b165c 100644 --- a/drivers/net/ll_temac_main.c +++ b/drivers/net/ll_temac_main.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/of_device.h> | 38 | #include <linux/of_device.h> |
39 | #include <linux/of_mdio.h> | 39 | #include <linux/of_mdio.h> |
40 | #include <linux/of_platform.h> | 40 | #include <linux/of_platform.h> |
41 | #include <linux/of_address.h> | ||
41 | #include <linux/skbuff.h> | 42 | #include <linux/skbuff.h> |
42 | #include <linux/spinlock.h> | 43 | #include <linux/spinlock.h> |
43 | #include <linux/tcp.h> /* needed for sizeof(tcphdr) */ | 44 | #include <linux/tcp.h> /* needed for sizeof(tcphdr) */ |
diff --git a/drivers/net/ll_temac_mdio.c b/drivers/net/ll_temac_mdio.c index 5ae28c975b38..8cf9d4f56bb2 100644 --- a/drivers/net/ll_temac_mdio.c +++ b/drivers/net/ll_temac_mdio.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/phy.h> | 10 | #include <linux/phy.h> |
11 | #include <linux/of.h> | 11 | #include <linux/of.h> |
12 | #include <linux/of_device.h> | 12 | #include <linux/of_device.h> |
13 | #include <linux/of_address.h> | ||
13 | #include <linux/slab.h> | 14 | #include <linux/slab.h> |
14 | #include <linux/of_mdio.h> | 15 | #include <linux/of_mdio.h> |
15 | 16 | ||
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index 49279b0ee526..f9b509a6b09a 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c | |||
@@ -508,7 +508,8 @@ static int pcnet_confcheck(struct pcmcia_device *p_dev, | |||
508 | unsigned int vcc, | 508 | unsigned int vcc, |
509 | void *priv_data) | 509 | void *priv_data) |
510 | { | 510 | { |
511 | int *has_shmem = priv_data; | 511 | int *priv = priv_data; |
512 | int try = (*priv & 0x1); | ||
512 | int i; | 513 | int i; |
513 | cistpl_io_t *io = &cfg->io; | 514 | cistpl_io_t *io = &cfg->io; |
514 | 515 | ||
@@ -525,77 +526,103 @@ static int pcnet_confcheck(struct pcmcia_device *p_dev, | |||
525 | i = p_dev->resource[1]->end = 0; | 526 | i = p_dev->resource[1]->end = 0; |
526 | } | 527 | } |
527 | 528 | ||
528 | *has_shmem = ((cfg->mem.nwin == 1) && | 529 | *priv &= ((cfg->mem.nwin == 1) && |
529 | (cfg->mem.win[0].len >= 0x4000)); | 530 | (cfg->mem.win[0].len >= 0x4000)) ? 0x10 : ~0x10; |
531 | |||
530 | p_dev->resource[0]->start = io->win[i].base; | 532 | p_dev->resource[0]->start = io->win[i].base; |
531 | p_dev->resource[0]->end = io->win[i].len; | 533 | p_dev->resource[0]->end = io->win[i].len; |
532 | p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; | 534 | if (!try) |
535 | p_dev->io_lines = io->flags & CISTPL_IO_LINES_MASK; | ||
536 | else | ||
537 | p_dev->io_lines = 16; | ||
533 | if (p_dev->resource[0]->end + p_dev->resource[1]->end >= 32) | 538 | if (p_dev->resource[0]->end + p_dev->resource[1]->end >= 32) |
534 | return try_io_port(p_dev); | 539 | return try_io_port(p_dev); |
535 | 540 | ||
536 | return 0; | 541 | return -EINVAL; |
542 | } | ||
543 | |||
544 | static hw_info_t *pcnet_try_config(struct pcmcia_device *link, | ||
545 | int *has_shmem, int try) | ||
546 | { | ||
547 | struct net_device *dev = link->priv; | ||
548 | hw_info_t *local_hw_info; | ||
549 | pcnet_dev_t *info = PRIV(dev); | ||
550 | int priv = try; | ||
551 | int ret; | ||
552 | |||
553 | ret = pcmcia_loop_config(link, pcnet_confcheck, &priv); | ||
554 | if (ret) { | ||
555 | dev_warn(&link->dev, "no useable port range found\n"); | ||
556 | return NULL; | ||
557 | } | ||
558 | *has_shmem = (priv & 0x10); | ||
559 | |||
560 | if (!link->irq) | ||
561 | return NULL; | ||
562 | |||
563 | if (resource_size(link->resource[1]) == 8) { | ||
564 | link->conf.Attributes |= CONF_ENABLE_SPKR; | ||
565 | link->conf.Status = CCSR_AUDIO_ENA; | ||
566 | } | ||
567 | if ((link->manf_id == MANFID_IBM) && | ||
568 | (link->card_id == PRODID_IBM_HOME_AND_AWAY)) | ||
569 | link->conf.ConfigIndex |= 0x10; | ||
570 | |||
571 | ret = pcmcia_request_configuration(link, &link->conf); | ||
572 | if (ret) | ||
573 | return NULL; | ||
574 | |||
575 | dev->irq = link->irq; | ||
576 | dev->base_addr = link->resource[0]->start; | ||
577 | |||
578 | if (info->flags & HAS_MISC_REG) { | ||
579 | if ((if_port == 1) || (if_port == 2)) | ||
580 | dev->if_port = if_port; | ||
581 | else | ||
582 | dev_notice(&link->dev, "invalid if_port requested\n"); | ||
583 | } else | ||
584 | dev->if_port = 0; | ||
585 | |||
586 | if ((link->conf.ConfigBase == 0x03c0) && | ||
587 | (link->manf_id == 0x149) && (link->card_id == 0xc1ab)) { | ||
588 | dev_info(&link->dev, | ||
589 | "this is an AX88190 card - use axnet_cs instead.\n"); | ||
590 | return NULL; | ||
591 | } | ||
592 | |||
593 | local_hw_info = get_hwinfo(link); | ||
594 | if (!local_hw_info) | ||
595 | local_hw_info = get_prom(link); | ||
596 | if (!local_hw_info) | ||
597 | local_hw_info = get_dl10019(link); | ||
598 | if (!local_hw_info) | ||
599 | local_hw_info = get_ax88190(link); | ||
600 | if (!local_hw_info) | ||
601 | local_hw_info = get_hwired(link); | ||
602 | |||
603 | return local_hw_info; | ||
537 | } | 604 | } |
538 | 605 | ||
539 | static int pcnet_config(struct pcmcia_device *link) | 606 | static int pcnet_config(struct pcmcia_device *link) |
540 | { | 607 | { |
541 | struct net_device *dev = link->priv; | 608 | struct net_device *dev = link->priv; |
542 | pcnet_dev_t *info = PRIV(dev); | 609 | pcnet_dev_t *info = PRIV(dev); |
543 | int ret, start_pg, stop_pg, cm_offset; | 610 | int start_pg, stop_pg, cm_offset; |
544 | int has_shmem = 0; | 611 | int has_shmem = 0; |
545 | hw_info_t *local_hw_info; | 612 | hw_info_t *local_hw_info; |
546 | 613 | ||
547 | dev_dbg(&link->dev, "pcnet_config\n"); | 614 | dev_dbg(&link->dev, "pcnet_config\n"); |
548 | 615 | ||
549 | ret = pcmcia_loop_config(link, pcnet_confcheck, &has_shmem); | 616 | local_hw_info = pcnet_try_config(link, &has_shmem, 0); |
550 | if (ret) | 617 | if (!local_hw_info) { |
551 | goto failed; | 618 | /* check whether forcing io_lines to 16 helps... */ |
552 | 619 | pcmcia_disable_device(link); | |
553 | if (!link->irq) | 620 | local_hw_info = pcnet_try_config(link, &has_shmem, 1); |
554 | goto failed; | 621 | if (local_hw_info == NULL) { |
555 | 622 | dev_notice(&link->dev, "unable to read hardware net" | |
556 | if (resource_size(link->resource[1]) == 8) { | 623 | " address for io base %#3lx\n", dev->base_addr); |
557 | link->conf.Attributes |= CONF_ENABLE_SPKR; | 624 | goto failed; |
558 | link->conf.Status = CCSR_AUDIO_ENA; | 625 | } |
559 | } | ||
560 | if ((link->manf_id == MANFID_IBM) && | ||
561 | (link->card_id == PRODID_IBM_HOME_AND_AWAY)) | ||
562 | link->conf.ConfigIndex |= 0x10; | ||
563 | |||
564 | ret = pcmcia_request_configuration(link, &link->conf); | ||
565 | if (ret) | ||
566 | goto failed; | ||
567 | dev->irq = link->irq; | ||
568 | dev->base_addr = link->resource[0]->start; | ||
569 | if (info->flags & HAS_MISC_REG) { | ||
570 | if ((if_port == 1) || (if_port == 2)) | ||
571 | dev->if_port = if_port; | ||
572 | else | ||
573 | printk(KERN_NOTICE "pcnet_cs: invalid if_port requested\n"); | ||
574 | } else { | ||
575 | dev->if_port = 0; | ||
576 | } | ||
577 | |||
578 | if ((link->conf.ConfigBase == 0x03c0) && | ||
579 | (link->manf_id == 0x149) && (link->card_id == 0xc1ab)) { | ||
580 | printk(KERN_INFO "pcnet_cs: this is an AX88190 card!\n"); | ||
581 | printk(KERN_INFO "pcnet_cs: use axnet_cs instead.\n"); | ||
582 | goto failed; | ||
583 | } | ||
584 | |||
585 | local_hw_info = get_hwinfo(link); | ||
586 | if (local_hw_info == NULL) | ||
587 | local_hw_info = get_prom(link); | ||
588 | if (local_hw_info == NULL) | ||
589 | local_hw_info = get_dl10019(link); | ||
590 | if (local_hw_info == NULL) | ||
591 | local_hw_info = get_ax88190(link); | ||
592 | if (local_hw_info == NULL) | ||
593 | local_hw_info = get_hwired(link); | ||
594 | |||
595 | if (local_hw_info == NULL) { | ||
596 | printk(KERN_NOTICE "pcnet_cs: unable to read hardware net" | ||
597 | " address for io base %#3lx\n", dev->base_addr); | ||
598 | goto failed; | ||
599 | } | 626 | } |
600 | 627 | ||
601 | info->flags = local_hw_info->flags; | 628 | info->flags = local_hw_info->flags; |
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 6a6b8199a0d6..6c58da2b882c 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c | |||
@@ -308,7 +308,7 @@ static int mdio_bus_suspend(struct device *dev) | |||
308 | * may call phy routines that try to grab the same lock, and that may | 308 | * may call phy routines that try to grab the same lock, and that may |
309 | * lead to a deadlock. | 309 | * lead to a deadlock. |
310 | */ | 310 | */ |
311 | if (phydev->attached_dev) | 311 | if (phydev->attached_dev && phydev->adjust_link) |
312 | phy_stop_machine(phydev); | 312 | phy_stop_machine(phydev); |
313 | 313 | ||
314 | if (!mdio_bus_phy_may_suspend(phydev)) | 314 | if (!mdio_bus_phy_may_suspend(phydev)) |
@@ -331,7 +331,7 @@ static int mdio_bus_resume(struct device *dev) | |||
331 | return ret; | 331 | return ret; |
332 | 332 | ||
333 | no_resume: | 333 | no_resume: |
334 | if (phydev->attached_dev) | 334 | if (phydev->attached_dev && phydev->adjust_link) |
335 | phy_start_machine(phydev, NULL); | 335 | phy_start_machine(phydev, NULL); |
336 | 336 | ||
337 | return 0; | 337 | return 0; |
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index 6695a51e09e9..736b91703b3e 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
@@ -1314,8 +1314,13 @@ static int ppp_mp_explode(struct ppp *ppp, struct sk_buff *skb) | |||
1314 | hdrlen = (ppp->flags & SC_MP_XSHORTSEQ)? MPHDRLEN_SSN: MPHDRLEN; | 1314 | hdrlen = (ppp->flags & SC_MP_XSHORTSEQ)? MPHDRLEN_SSN: MPHDRLEN; |
1315 | i = 0; | 1315 | i = 0; |
1316 | list_for_each_entry(pch, &ppp->channels, clist) { | 1316 | list_for_each_entry(pch, &ppp->channels, clist) { |
1317 | navail += pch->avail = (pch->chan != NULL); | 1317 | if (pch->chan) { |
1318 | pch->speed = pch->chan->speed; | 1318 | pch->avail = 1; |
1319 | navail++; | ||
1320 | pch->speed = pch->chan->speed; | ||
1321 | } else { | ||
1322 | pch->avail = 0; | ||
1323 | } | ||
1319 | if (pch->avail) { | 1324 | if (pch->avail) { |
1320 | if (skb_queue_empty(&pch->file.xq) || | 1325 | if (skb_queue_empty(&pch->file.xq) || |
1321 | !pch->had_frag) { | 1326 | !pch->had_frag) { |
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 078bbf4e6f19..a0da4a17b025 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -2934,7 +2934,7 @@ static const struct rtl_cfg_info { | |||
2934 | .hw_start = rtl_hw_start_8168, | 2934 | .hw_start = rtl_hw_start_8168, |
2935 | .region = 2, | 2935 | .region = 2, |
2936 | .align = 8, | 2936 | .align = 8, |
2937 | .intr_event = SYSErr | LinkChg | RxOverflow | | 2937 | .intr_event = SYSErr | RxFIFOOver | LinkChg | RxOverflow | |
2938 | TxErr | TxOK | RxOK | RxErr, | 2938 | TxErr | TxOK | RxOK | RxErr, |
2939 | .napi_event = TxErr | TxOK | RxOK | RxOverflow, | 2939 | .napi_event = TxErr | TxOK | RxOK | RxOverflow, |
2940 | .features = RTL_FEATURE_GMII | RTL_FEATURE_MSI, | 2940 | .features = RTL_FEATURE_GMII | RTL_FEATURE_MSI, |
@@ -4625,8 +4625,7 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance) | |||
4625 | } | 4625 | } |
4626 | 4626 | ||
4627 | /* Work around for rx fifo overflow */ | 4627 | /* Work around for rx fifo overflow */ |
4628 | if (unlikely(status & RxFIFOOver) && | 4628 | if (unlikely(status & RxFIFOOver)) { |
4629 | (tp->mac_version == RTL_GIGA_MAC_VER_11)) { | ||
4630 | netif_stop_queue(dev); | 4629 | netif_stop_queue(dev); |
4631 | rtl8169_tx_timeout(dev); | 4630 | rtl8169_tx_timeout(dev); |
4632 | break; | 4631 | break; |
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c index 6efca66b8766..1cd752f9a6e1 100644 --- a/drivers/net/usb/hso.c +++ b/drivers/net/usb/hso.c | |||
@@ -1652,6 +1652,8 @@ static int hso_get_count(struct hso_serial *serial, | |||
1652 | struct uart_icount cnow; | 1652 | struct uart_icount cnow; |
1653 | struct hso_tiocmget *tiocmget = serial->tiocmget; | 1653 | struct hso_tiocmget *tiocmget = serial->tiocmget; |
1654 | 1654 | ||
1655 | memset(&icount, 0, sizeof(struct serial_icounter_struct)); | ||
1656 | |||
1655 | if (!tiocmget) | 1657 | if (!tiocmget) |
1656 | return -ENOENT; | 1658 | return -ENOENT; |
1657 | spin_lock_irq(&serial->serial_lock); | 1659 | spin_lock_irq(&serial->serial_lock); |
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index c3ceebb5be84..5ac2aa783f58 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -71,6 +71,49 @@ | |||
71 | #define DMA_32BIT_PFN IOVA_PFN(DMA_BIT_MASK(32)) | 71 | #define DMA_32BIT_PFN IOVA_PFN(DMA_BIT_MASK(32)) |
72 | #define DMA_64BIT_PFN IOVA_PFN(DMA_BIT_MASK(64)) | 72 | #define DMA_64BIT_PFN IOVA_PFN(DMA_BIT_MASK(64)) |
73 | 73 | ||
74 | /* page table handling */ | ||
75 | #define LEVEL_STRIDE (9) | ||
76 | #define LEVEL_MASK (((u64)1 << LEVEL_STRIDE) - 1) | ||
77 | |||
78 | static inline int agaw_to_level(int agaw) | ||
79 | { | ||
80 | return agaw + 2; | ||
81 | } | ||
82 | |||
83 | static inline int agaw_to_width(int agaw) | ||
84 | { | ||
85 | return 30 + agaw * LEVEL_STRIDE; | ||
86 | } | ||
87 | |||
88 | static inline int width_to_agaw(int width) | ||
89 | { | ||
90 | return (width - 30) / LEVEL_STRIDE; | ||
91 | } | ||
92 | |||
93 | static inline unsigned int level_to_offset_bits(int level) | ||
94 | { | ||
95 | return (level - 1) * LEVEL_STRIDE; | ||
96 | } | ||
97 | |||
98 | static inline int pfn_level_offset(unsigned long pfn, int level) | ||
99 | { | ||
100 | return (pfn >> level_to_offset_bits(level)) & LEVEL_MASK; | ||
101 | } | ||
102 | |||
103 | static inline unsigned long level_mask(int level) | ||
104 | { | ||
105 | return -1UL << level_to_offset_bits(level); | ||
106 | } | ||
107 | |||
108 | static inline unsigned long level_size(int level) | ||
109 | { | ||
110 | return 1UL << level_to_offset_bits(level); | ||
111 | } | ||
112 | |||
113 | static inline unsigned long align_to_level(unsigned long pfn, int level) | ||
114 | { | ||
115 | return (pfn + level_size(level) - 1) & level_mask(level); | ||
116 | } | ||
74 | 117 | ||
75 | /* VT-d pages must always be _smaller_ than MM pages. Otherwise things | 118 | /* VT-d pages must always be _smaller_ than MM pages. Otherwise things |
76 | are never going to work. */ | 119 | are never going to work. */ |
@@ -434,8 +477,6 @@ void free_iova_mem(struct iova *iova) | |||
434 | } | 477 | } |
435 | 478 | ||
436 | 479 | ||
437 | static inline int width_to_agaw(int width); | ||
438 | |||
439 | static int __iommu_calculate_agaw(struct intel_iommu *iommu, int max_gaw) | 480 | static int __iommu_calculate_agaw(struct intel_iommu *iommu, int max_gaw) |
440 | { | 481 | { |
441 | unsigned long sagaw; | 482 | unsigned long sagaw; |
@@ -646,51 +687,6 @@ out: | |||
646 | spin_unlock_irqrestore(&iommu->lock, flags); | 687 | spin_unlock_irqrestore(&iommu->lock, flags); |
647 | } | 688 | } |
648 | 689 | ||
649 | /* page table handling */ | ||
650 | #define LEVEL_STRIDE (9) | ||
651 | #define LEVEL_MASK (((u64)1 << LEVEL_STRIDE) - 1) | ||
652 | |||
653 | static inline int agaw_to_level(int agaw) | ||
654 | { | ||
655 | return agaw + 2; | ||
656 | } | ||
657 | |||
658 | static inline int agaw_to_width(int agaw) | ||
659 | { | ||
660 | return 30 + agaw * LEVEL_STRIDE; | ||
661 | |||
662 | } | ||
663 | |||
664 | static inline int width_to_agaw(int width) | ||
665 | { | ||
666 | return (width - 30) / LEVEL_STRIDE; | ||
667 | } | ||
668 | |||
669 | static inline unsigned int level_to_offset_bits(int level) | ||
670 | { | ||
671 | return (level - 1) * LEVEL_STRIDE; | ||
672 | } | ||
673 | |||
674 | static inline int pfn_level_offset(unsigned long pfn, int level) | ||
675 | { | ||
676 | return (pfn >> level_to_offset_bits(level)) & LEVEL_MASK; | ||
677 | } | ||
678 | |||
679 | static inline unsigned long level_mask(int level) | ||
680 | { | ||
681 | return -1UL << level_to_offset_bits(level); | ||
682 | } | ||
683 | |||
684 | static inline unsigned long level_size(int level) | ||
685 | { | ||
686 | return 1UL << level_to_offset_bits(level); | ||
687 | } | ||
688 | |||
689 | static inline unsigned long align_to_level(unsigned long pfn, int level) | ||
690 | { | ||
691 | return (pfn + level_size(level) - 1) & level_mask(level); | ||
692 | } | ||
693 | |||
694 | static struct dma_pte *pfn_to_dma_pte(struct dmar_domain *domain, | 690 | static struct dma_pte *pfn_to_dma_pte(struct dmar_domain *domain, |
695 | unsigned long pfn) | 691 | unsigned long pfn) |
696 | { | 692 | { |
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 54aa1c238cb3..a5c176598d95 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c | |||
@@ -163,7 +163,7 @@ static int pcmcia_access_config(struct pcmcia_device *p_dev, | |||
163 | c = p_dev->function_config; | 163 | c = p_dev->function_config; |
164 | 164 | ||
165 | if (!(c->state & CONFIG_LOCKED)) { | 165 | if (!(c->state & CONFIG_LOCKED)) { |
166 | dev_dbg(&s->dev, "Configuration isnt't locked\n"); | 166 | dev_dbg(&p_dev->dev, "Configuration isnt't locked\n"); |
167 | mutex_unlock(&s->ops_mutex); | 167 | mutex_unlock(&s->ops_mutex); |
168 | return -EACCES; | 168 | return -EACCES; |
169 | } | 169 | } |
@@ -220,7 +220,7 @@ int pcmcia_map_mem_page(struct pcmcia_device *p_dev, window_handle_t wh, | |||
220 | s->win[w].card_start = offset; | 220 | s->win[w].card_start = offset; |
221 | ret = s->ops->set_mem_map(s, &s->win[w]); | 221 | ret = s->ops->set_mem_map(s, &s->win[w]); |
222 | if (ret) | 222 | if (ret) |
223 | dev_warn(&s->dev, "failed to set_mem_map\n"); | 223 | dev_warn(&p_dev->dev, "failed to set_mem_map\n"); |
224 | mutex_unlock(&s->ops_mutex); | 224 | mutex_unlock(&s->ops_mutex); |
225 | return ret; | 225 | return ret; |
226 | } /* pcmcia_map_mem_page */ | 226 | } /* pcmcia_map_mem_page */ |
@@ -244,18 +244,18 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev, | |||
244 | c = p_dev->function_config; | 244 | c = p_dev->function_config; |
245 | 245 | ||
246 | if (!(s->state & SOCKET_PRESENT)) { | 246 | if (!(s->state & SOCKET_PRESENT)) { |
247 | dev_dbg(&s->dev, "No card present\n"); | 247 | dev_dbg(&p_dev->dev, "No card present\n"); |
248 | ret = -ENODEV; | 248 | ret = -ENODEV; |
249 | goto unlock; | 249 | goto unlock; |
250 | } | 250 | } |
251 | if (!(c->state & CONFIG_LOCKED)) { | 251 | if (!(c->state & CONFIG_LOCKED)) { |
252 | dev_dbg(&s->dev, "Configuration isnt't locked\n"); | 252 | dev_dbg(&p_dev->dev, "Configuration isnt't locked\n"); |
253 | ret = -EACCES; | 253 | ret = -EACCES; |
254 | goto unlock; | 254 | goto unlock; |
255 | } | 255 | } |
256 | 256 | ||
257 | if (mod->Attributes & (CONF_IRQ_CHANGE_VALID | CONF_VCC_CHANGE_VALID)) { | 257 | if (mod->Attributes & (CONF_IRQ_CHANGE_VALID | CONF_VCC_CHANGE_VALID)) { |
258 | dev_dbg(&s->dev, | 258 | dev_dbg(&p_dev->dev, |
259 | "changing Vcc or IRQ is not allowed at this time\n"); | 259 | "changing Vcc or IRQ is not allowed at this time\n"); |
260 | ret = -EINVAL; | 260 | ret = -EINVAL; |
261 | goto unlock; | 261 | goto unlock; |
@@ -265,20 +265,22 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev, | |||
265 | if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) && | 265 | if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) && |
266 | (mod->Attributes & CONF_VPP2_CHANGE_VALID)) { | 266 | (mod->Attributes & CONF_VPP2_CHANGE_VALID)) { |
267 | if (mod->Vpp1 != mod->Vpp2) { | 267 | if (mod->Vpp1 != mod->Vpp2) { |
268 | dev_dbg(&s->dev, "Vpp1 and Vpp2 must be the same\n"); | 268 | dev_dbg(&p_dev->dev, |
269 | "Vpp1 and Vpp2 must be the same\n"); | ||
269 | ret = -EINVAL; | 270 | ret = -EINVAL; |
270 | goto unlock; | 271 | goto unlock; |
271 | } | 272 | } |
272 | s->socket.Vpp = mod->Vpp1; | 273 | s->socket.Vpp = mod->Vpp1; |
273 | if (s->ops->set_socket(s, &s->socket)) { | 274 | if (s->ops->set_socket(s, &s->socket)) { |
274 | dev_printk(KERN_WARNING, &s->dev, | 275 | dev_printk(KERN_WARNING, &p_dev->dev, |
275 | "Unable to set VPP\n"); | 276 | "Unable to set VPP\n"); |
276 | ret = -EIO; | 277 | ret = -EIO; |
277 | goto unlock; | 278 | goto unlock; |
278 | } | 279 | } |
279 | } else if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) || | 280 | } else if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) || |
280 | (mod->Attributes & CONF_VPP2_CHANGE_VALID)) { | 281 | (mod->Attributes & CONF_VPP2_CHANGE_VALID)) { |
281 | dev_dbg(&s->dev, "changing Vcc is not allowed at this time\n"); | 282 | dev_dbg(&p_dev->dev, |
283 | "changing Vcc is not allowed at this time\n"); | ||
282 | ret = -EINVAL; | 284 | ret = -EINVAL; |
283 | goto unlock; | 285 | goto unlock; |
284 | } | 286 | } |
@@ -401,7 +403,7 @@ int pcmcia_release_window(struct pcmcia_device *p_dev, struct resource *res) | |||
401 | win = &s->win[w]; | 403 | win = &s->win[w]; |
402 | 404 | ||
403 | if (!(p_dev->_win & CLIENT_WIN_REQ(w))) { | 405 | if (!(p_dev->_win & CLIENT_WIN_REQ(w))) { |
404 | dev_dbg(&s->dev, "not releasing unknown window\n"); | 406 | dev_dbg(&p_dev->dev, "not releasing unknown window\n"); |
405 | mutex_unlock(&s->ops_mutex); | 407 | mutex_unlock(&s->ops_mutex); |
406 | return -EINVAL; | 408 | return -EINVAL; |
407 | } | 409 | } |
@@ -439,7 +441,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, | |||
439 | return -ENODEV; | 441 | return -ENODEV; |
440 | 442 | ||
441 | if (req->IntType & INT_CARDBUS) { | 443 | if (req->IntType & INT_CARDBUS) { |
442 | dev_dbg(&s->dev, "IntType may not be INT_CARDBUS\n"); | 444 | dev_dbg(&p_dev->dev, "IntType may not be INT_CARDBUS\n"); |
443 | return -EINVAL; | 445 | return -EINVAL; |
444 | } | 446 | } |
445 | 447 | ||
@@ -447,7 +449,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, | |||
447 | c = p_dev->function_config; | 449 | c = p_dev->function_config; |
448 | if (c->state & CONFIG_LOCKED) { | 450 | if (c->state & CONFIG_LOCKED) { |
449 | mutex_unlock(&s->ops_mutex); | 451 | mutex_unlock(&s->ops_mutex); |
450 | dev_dbg(&s->dev, "Configuration is locked\n"); | 452 | dev_dbg(&p_dev->dev, "Configuration is locked\n"); |
451 | return -EACCES; | 453 | return -EACCES; |
452 | } | 454 | } |
453 | 455 | ||
@@ -455,7 +457,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, | |||
455 | s->socket.Vpp = req->Vpp; | 457 | s->socket.Vpp = req->Vpp; |
456 | if (s->ops->set_socket(s, &s->socket)) { | 458 | if (s->ops->set_socket(s, &s->socket)) { |
457 | mutex_unlock(&s->ops_mutex); | 459 | mutex_unlock(&s->ops_mutex); |
458 | dev_printk(KERN_WARNING, &s->dev, | 460 | dev_printk(KERN_WARNING, &p_dev->dev, |
459 | "Unable to set socket state\n"); | 461 | "Unable to set socket state\n"); |
460 | return -EINVAL; | 462 | return -EINVAL; |
461 | } | 463 | } |
@@ -569,19 +571,20 @@ int pcmcia_request_io(struct pcmcia_device *p_dev) | |||
569 | int ret = -EINVAL; | 571 | int ret = -EINVAL; |
570 | 572 | ||
571 | mutex_lock(&s->ops_mutex); | 573 | mutex_lock(&s->ops_mutex); |
572 | dev_dbg(&s->dev, "pcmcia_request_io: %pR , %pR", &c->io[0], &c->io[1]); | 574 | dev_dbg(&p_dev->dev, "pcmcia_request_io: %pR , %pR", |
575 | &c->io[0], &c->io[1]); | ||
573 | 576 | ||
574 | if (!(s->state & SOCKET_PRESENT)) { | 577 | if (!(s->state & SOCKET_PRESENT)) { |
575 | dev_dbg(&s->dev, "pcmcia_request_io: No card present\n"); | 578 | dev_dbg(&p_dev->dev, "pcmcia_request_io: No card present\n"); |
576 | goto out; | 579 | goto out; |
577 | } | 580 | } |
578 | 581 | ||
579 | if (c->state & CONFIG_LOCKED) { | 582 | if (c->state & CONFIG_LOCKED) { |
580 | dev_dbg(&s->dev, "Configuration is locked\n"); | 583 | dev_dbg(&p_dev->dev, "Configuration is locked\n"); |
581 | goto out; | 584 | goto out; |
582 | } | 585 | } |
583 | if (c->state & CONFIG_IO_REQ) { | 586 | if (c->state & CONFIG_IO_REQ) { |
584 | dev_dbg(&s->dev, "IO already configured\n"); | 587 | dev_dbg(&p_dev->dev, "IO already configured\n"); |
585 | goto out; | 588 | goto out; |
586 | } | 589 | } |
587 | 590 | ||
@@ -601,7 +604,7 @@ int pcmcia_request_io(struct pcmcia_device *p_dev) | |||
601 | c->state |= CONFIG_IO_REQ; | 604 | c->state |= CONFIG_IO_REQ; |
602 | p_dev->_io = 1; | 605 | p_dev->_io = 1; |
603 | 606 | ||
604 | dev_dbg(&s->dev, "pcmcia_request_io succeeded: %pR , %pR", | 607 | dev_dbg(&p_dev->dev, "pcmcia_request_io succeeded: %pR , %pR", |
605 | &c->io[0], &c->io[1]); | 608 | &c->io[0], &c->io[1]); |
606 | out: | 609 | out: |
607 | mutex_unlock(&s->ops_mutex); | 610 | mutex_unlock(&s->ops_mutex); |
@@ -800,7 +803,7 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha | |||
800 | int w; | 803 | int w; |
801 | 804 | ||
802 | if (!(s->state & SOCKET_PRESENT)) { | 805 | if (!(s->state & SOCKET_PRESENT)) { |
803 | dev_dbg(&s->dev, "No card present\n"); | 806 | dev_dbg(&p_dev->dev, "No card present\n"); |
804 | return -ENODEV; | 807 | return -ENODEV; |
805 | } | 808 | } |
806 | 809 | ||
@@ -809,12 +812,12 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha | |||
809 | req->Size = s->map_size; | 812 | req->Size = s->map_size; |
810 | align = (s->features & SS_CAP_MEM_ALIGN) ? req->Size : s->map_size; | 813 | align = (s->features & SS_CAP_MEM_ALIGN) ? req->Size : s->map_size; |
811 | if (req->Size & (s->map_size-1)) { | 814 | if (req->Size & (s->map_size-1)) { |
812 | dev_dbg(&s->dev, "invalid map size\n"); | 815 | dev_dbg(&p_dev->dev, "invalid map size\n"); |
813 | return -EINVAL; | 816 | return -EINVAL; |
814 | } | 817 | } |
815 | if ((req->Base && (s->features & SS_CAP_STATIC_MAP)) || | 818 | if ((req->Base && (s->features & SS_CAP_STATIC_MAP)) || |
816 | (req->Base & (align-1))) { | 819 | (req->Base & (align-1))) { |
817 | dev_dbg(&s->dev, "invalid base address\n"); | 820 | dev_dbg(&p_dev->dev, "invalid base address\n"); |
818 | return -EINVAL; | 821 | return -EINVAL; |
819 | } | 822 | } |
820 | if (req->Base) | 823 | if (req->Base) |
@@ -826,7 +829,7 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha | |||
826 | if (!(s->state & SOCKET_WIN_REQ(w))) | 829 | if (!(s->state & SOCKET_WIN_REQ(w))) |
827 | break; | 830 | break; |
828 | if (w == MAX_WIN) { | 831 | if (w == MAX_WIN) { |
829 | dev_dbg(&s->dev, "all windows are used already\n"); | 832 | dev_dbg(&p_dev->dev, "all windows are used already\n"); |
830 | mutex_unlock(&s->ops_mutex); | 833 | mutex_unlock(&s->ops_mutex); |
831 | return -EINVAL; | 834 | return -EINVAL; |
832 | } | 835 | } |
@@ -837,7 +840,7 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha | |||
837 | win->res = pcmcia_find_mem_region(req->Base, req->Size, align, | 840 | win->res = pcmcia_find_mem_region(req->Base, req->Size, align, |
838 | 0, s); | 841 | 0, s); |
839 | if (!win->res) { | 842 | if (!win->res) { |
840 | dev_dbg(&s->dev, "allocating mem region failed\n"); | 843 | dev_dbg(&p_dev->dev, "allocating mem region failed\n"); |
841 | mutex_unlock(&s->ops_mutex); | 844 | mutex_unlock(&s->ops_mutex); |
842 | return -EINVAL; | 845 | return -EINVAL; |
843 | } | 846 | } |
@@ -851,7 +854,7 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha | |||
851 | win->card_start = 0; | 854 | win->card_start = 0; |
852 | 855 | ||
853 | if (s->ops->set_mem_map(s, win) != 0) { | 856 | if (s->ops->set_mem_map(s, win) != 0) { |
854 | dev_dbg(&s->dev, "failed to set memory mapping\n"); | 857 | dev_dbg(&p_dev->dev, "failed to set memory mapping\n"); |
855 | mutex_unlock(&s->ops_mutex); | 858 | mutex_unlock(&s->ops_mutex); |
856 | return -EIO; | 859 | return -EIO; |
857 | } | 860 | } |
@@ -874,7 +877,7 @@ int pcmcia_request_window(struct pcmcia_device *p_dev, win_req_t *req, window_ha | |||
874 | if (win->res) | 877 | if (win->res) |
875 | request_resource(&iomem_resource, res); | 878 | request_resource(&iomem_resource, res); |
876 | 879 | ||
877 | dev_dbg(&s->dev, "request_window results in %pR\n", res); | 880 | dev_dbg(&p_dev->dev, "request_window results in %pR\n", res); |
878 | 881 | ||
879 | mutex_unlock(&s->ops_mutex); | 882 | mutex_unlock(&s->ops_mutex); |
880 | *wh = res; | 883 | *wh = res; |
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index e35ed128bdef..2d61186ad5a2 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c | |||
@@ -3093,7 +3093,8 @@ static const struct tpacpi_quirk tpacpi_hotkey_qtable[] __initconst = { | |||
3093 | TPACPI_Q_IBM('1', 'D', TPACPI_HK_Q_INIMASK), /* X22, X23, X24 */ | 3093 | TPACPI_Q_IBM('1', 'D', TPACPI_HK_Q_INIMASK), /* X22, X23, X24 */ |
3094 | }; | 3094 | }; |
3095 | 3095 | ||
3096 | typedef u16 tpacpi_keymap_t[TPACPI_HOTKEY_MAP_LEN]; | 3096 | typedef u16 tpacpi_keymap_entry_t; |
3097 | typedef tpacpi_keymap_entry_t tpacpi_keymap_t[TPACPI_HOTKEY_MAP_LEN]; | ||
3097 | 3098 | ||
3098 | static int __init hotkey_init(struct ibm_init_struct *iibm) | 3099 | static int __init hotkey_init(struct ibm_init_struct *iibm) |
3099 | { | 3100 | { |
@@ -3230,7 +3231,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
3230 | }; | 3231 | }; |
3231 | 3232 | ||
3232 | #define TPACPI_HOTKEY_MAP_SIZE sizeof(tpacpi_keymap_t) | 3233 | #define TPACPI_HOTKEY_MAP_SIZE sizeof(tpacpi_keymap_t) |
3233 | #define TPACPI_HOTKEY_MAP_TYPESIZE sizeof(tpacpi_keymap_t[0]) | 3234 | #define TPACPI_HOTKEY_MAP_TYPESIZE sizeof(tpacpi_keymap_entry_t) |
3234 | 3235 | ||
3235 | int res, i; | 3236 | int res, i; |
3236 | int status; | 3237 | int status; |
diff --git a/drivers/power/apm_power.c b/drivers/power/apm_power.c index 936bae560fa1..dc628cb2e762 100644 --- a/drivers/power/apm_power.c +++ b/drivers/power/apm_power.c | |||
@@ -233,6 +233,7 @@ static int calculate_capacity(enum apm_source source) | |||
233 | empty_design_prop = POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN; | 233 | empty_design_prop = POWER_SUPPLY_PROP_ENERGY_EMPTY_DESIGN; |
234 | now_prop = POWER_SUPPLY_PROP_ENERGY_NOW; | 234 | now_prop = POWER_SUPPLY_PROP_ENERGY_NOW; |
235 | avg_prop = POWER_SUPPLY_PROP_ENERGY_AVG; | 235 | avg_prop = POWER_SUPPLY_PROP_ENERGY_AVG; |
236 | break; | ||
236 | case SOURCE_VOLTAGE: | 237 | case SOURCE_VOLTAGE: |
237 | full_prop = POWER_SUPPLY_PROP_VOLTAGE_MAX; | 238 | full_prop = POWER_SUPPLY_PROP_VOLTAGE_MAX; |
238 | empty_prop = POWER_SUPPLY_PROP_VOLTAGE_MIN; | 239 | empty_prop = POWER_SUPPLY_PROP_VOLTAGE_MIN; |
diff --git a/drivers/power/intel_mid_battery.c b/drivers/power/intel_mid_battery.c index c61ffec2ff10..2a10cd361181 100644 --- a/drivers/power/intel_mid_battery.c +++ b/drivers/power/intel_mid_battery.c | |||
@@ -185,8 +185,8 @@ static int pmic_scu_ipc_battery_property_get(struct battery_property *prop) | |||
185 | { | 185 | { |
186 | u32 data[3]; | 186 | u32 data[3]; |
187 | u8 *p = (u8 *)&data[1]; | 187 | u8 *p = (u8 *)&data[1]; |
188 | int err = intel_scu_ipc_command(IPC_CMD_BATTERY_PROPERTY, | 188 | int err = intel_scu_ipc_command(IPCMSG_BATTERY, |
189 | IPCMSG_BATTERY, NULL, 0, data, 3); | 189 | IPC_CMD_BATTERY_PROPERTY, NULL, 0, data, 3); |
190 | 190 | ||
191 | prop->capacity = data[0]; | 191 | prop->capacity = data[0]; |
192 | prop->crnt = *p++; | 192 | prop->crnt = *p++; |
@@ -207,7 +207,7 @@ static int pmic_scu_ipc_battery_property_get(struct battery_property *prop) | |||
207 | 207 | ||
208 | static int pmic_scu_ipc_set_charger(int charger) | 208 | static int pmic_scu_ipc_set_charger(int charger) |
209 | { | 209 | { |
210 | return intel_scu_ipc_simple_command(charger, IPCMSG_BATTERY); | 210 | return intel_scu_ipc_simple_command(IPCMSG_BATTERY, charger); |
211 | } | 211 | } |
212 | 212 | ||
213 | /** | 213 | /** |
diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c index 7d149a8d8d9b..2ce2eb71d0f5 100644 --- a/drivers/regulator/88pm8607.c +++ b/drivers/regulator/88pm8607.c | |||
@@ -215,7 +215,7 @@ static int pm8607_list_voltage(struct regulator_dev *rdev, unsigned index) | |||
215 | struct pm8607_regulator_info *info = rdev_get_drvdata(rdev); | 215 | struct pm8607_regulator_info *info = rdev_get_drvdata(rdev); |
216 | int ret = -EINVAL; | 216 | int ret = -EINVAL; |
217 | 217 | ||
218 | if (info->vol_table && (index < (2 << info->vol_nbits))) { | 218 | if (info->vol_table && (index < (1 << info->vol_nbits))) { |
219 | ret = info->vol_table[index]; | 219 | ret = info->vol_table[index]; |
220 | if (info->slope_double) | 220 | if (info->slope_double) |
221 | ret <<= 1; | 221 | ret <<= 1; |
@@ -233,7 +233,7 @@ static int choose_voltage(struct regulator_dev *rdev, int min_uV, int max_uV) | |||
233 | max_uV = max_uV >> 1; | 233 | max_uV = max_uV >> 1; |
234 | } | 234 | } |
235 | if (info->vol_table) { | 235 | if (info->vol_table) { |
236 | for (i = 0; i < (2 << info->vol_nbits); i++) { | 236 | for (i = 0; i < (1 << info->vol_nbits); i++) { |
237 | if (!info->vol_table[i]) | 237 | if (!info->vol_table[i]) |
238 | break; | 238 | break; |
239 | if ((min_uV <= info->vol_table[i]) | 239 | if ((min_uV <= info->vol_table[i]) |
diff --git a/drivers/regulator/ab3100.c b/drivers/regulator/ab3100.c index 11790990277a..b349266a43de 100644 --- a/drivers/regulator/ab3100.c +++ b/drivers/regulator/ab3100.c | |||
@@ -634,12 +634,9 @@ static int __devinit ab3100_regulators_probe(struct platform_device *pdev) | |||
634 | "%s: failed to register regulator %s err %d\n", | 634 | "%s: failed to register regulator %s err %d\n", |
635 | __func__, ab3100_regulator_desc[i].name, | 635 | __func__, ab3100_regulator_desc[i].name, |
636 | err); | 636 | err); |
637 | i--; | ||
638 | /* remove the already registered regulators */ | 637 | /* remove the already registered regulators */ |
639 | while (i > 0) { | 638 | while (--i >= 0) |
640 | regulator_unregister(ab3100_regulators[i].rdev); | 639 | regulator_unregister(ab3100_regulators[i].rdev); |
641 | i--; | ||
642 | } | ||
643 | return err; | 640 | return err; |
644 | } | 641 | } |
645 | 642 | ||
diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c index dc3f1a491675..28c7ae67cec9 100644 --- a/drivers/regulator/ab8500.c +++ b/drivers/regulator/ab8500.c | |||
@@ -157,7 +157,7 @@ static int ab8500_list_voltage(struct regulator_dev *rdev, unsigned selector) | |||
157 | if (info->fixed_uV) | 157 | if (info->fixed_uV) |
158 | return info->fixed_uV; | 158 | return info->fixed_uV; |
159 | 159 | ||
160 | if (selector > info->voltages_len) | 160 | if (selector >= info->voltages_len) |
161 | return -EINVAL; | 161 | return -EINVAL; |
162 | 162 | ||
163 | return info->supported_voltages[selector]; | 163 | return info->supported_voltages[selector]; |
@@ -344,13 +344,14 @@ static inline struct ab8500_regulator_info *find_regulator_info(int id) | |||
344 | static __devinit int ab8500_regulator_probe(struct platform_device *pdev) | 344 | static __devinit int ab8500_regulator_probe(struct platform_device *pdev) |
345 | { | 345 | { |
346 | struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent); | 346 | struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent); |
347 | struct ab8500_platform_data *pdata = dev_get_platdata(ab8500->dev); | 347 | struct ab8500_platform_data *pdata; |
348 | int i, err; | 348 | int i, err; |
349 | 349 | ||
350 | if (!ab8500) { | 350 | if (!ab8500) { |
351 | dev_err(&pdev->dev, "null mfd parent\n"); | 351 | dev_err(&pdev->dev, "null mfd parent\n"); |
352 | return -EINVAL; | 352 | return -EINVAL; |
353 | } | 353 | } |
354 | pdata = dev_get_platdata(ab8500->dev); | ||
354 | 355 | ||
355 | /* register all regulators */ | 356 | /* register all regulators */ |
356 | for (i = 0; i < ARRAY_SIZE(ab8500_regulator_info); i++) { | 357 | for (i = 0; i < ARRAY_SIZE(ab8500_regulator_info); i++) { |
@@ -368,11 +369,9 @@ static __devinit int ab8500_regulator_probe(struct platform_device *pdev) | |||
368 | dev_err(&pdev->dev, "failed to register regulator %s\n", | 369 | dev_err(&pdev->dev, "failed to register regulator %s\n", |
369 | info->desc.name); | 370 | info->desc.name); |
370 | /* when we fail, un-register all earlier regulators */ | 371 | /* when we fail, un-register all earlier regulators */ |
371 | i--; | 372 | while (--i >= 0) { |
372 | while (i > 0) { | ||
373 | info = &ab8500_regulator_info[i]; | 373 | info = &ab8500_regulator_info[i]; |
374 | regulator_unregister(info->regulator); | 374 | regulator_unregister(info->regulator); |
375 | i--; | ||
376 | } | 375 | } |
377 | return err; | 376 | return err; |
378 | } | 377 | } |
diff --git a/drivers/regulator/ad5398.c b/drivers/regulator/ad5398.c index d59d2f2314af..df1fb53c09d2 100644 --- a/drivers/regulator/ad5398.c +++ b/drivers/regulator/ad5398.c | |||
@@ -25,7 +25,7 @@ struct ad5398_chip_info { | |||
25 | unsigned int current_level; | 25 | unsigned int current_level; |
26 | unsigned int current_mask; | 26 | unsigned int current_mask; |
27 | unsigned int current_offset; | 27 | unsigned int current_offset; |
28 | struct regulator_dev rdev; | 28 | struct regulator_dev *rdev; |
29 | }; | 29 | }; |
30 | 30 | ||
31 | static int ad5398_calc_current(struct ad5398_chip_info *chip, | 31 | static int ad5398_calc_current(struct ad5398_chip_info *chip, |
@@ -211,7 +211,6 @@ MODULE_DEVICE_TABLE(i2c, ad5398_id); | |||
211 | static int __devinit ad5398_probe(struct i2c_client *client, | 211 | static int __devinit ad5398_probe(struct i2c_client *client, |
212 | const struct i2c_device_id *id) | 212 | const struct i2c_device_id *id) |
213 | { | 213 | { |
214 | struct regulator_dev *rdev; | ||
215 | struct regulator_init_data *init_data = client->dev.platform_data; | 214 | struct regulator_init_data *init_data = client->dev.platform_data; |
216 | struct ad5398_chip_info *chip; | 215 | struct ad5398_chip_info *chip; |
217 | const struct ad5398_current_data_format *df = | 216 | const struct ad5398_current_data_format *df = |
@@ -233,9 +232,10 @@ static int __devinit ad5398_probe(struct i2c_client *client, | |||
233 | chip->current_offset = df->current_offset; | 232 | chip->current_offset = df->current_offset; |
234 | chip->current_mask = (chip->current_level - 1) << chip->current_offset; | 233 | chip->current_mask = (chip->current_level - 1) << chip->current_offset; |
235 | 234 | ||
236 | rdev = regulator_register(&ad5398_reg, &client->dev, init_data, chip); | 235 | chip->rdev = regulator_register(&ad5398_reg, &client->dev, |
237 | if (IS_ERR(rdev)) { | 236 | init_data, chip); |
238 | ret = PTR_ERR(rdev); | 237 | if (IS_ERR(chip->rdev)) { |
238 | ret = PTR_ERR(chip->rdev); | ||
239 | dev_err(&client->dev, "failed to register %s %s\n", | 239 | dev_err(&client->dev, "failed to register %s %s\n", |
240 | id->name, ad5398_reg.name); | 240 | id->name, ad5398_reg.name); |
241 | goto err; | 241 | goto err; |
@@ -254,7 +254,7 @@ static int __devexit ad5398_remove(struct i2c_client *client) | |||
254 | { | 254 | { |
255 | struct ad5398_chip_info *chip = i2c_get_clientdata(client); | 255 | struct ad5398_chip_info *chip = i2c_get_clientdata(client); |
256 | 256 | ||
257 | regulator_unregister(&chip->rdev); | 257 | regulator_unregister(chip->rdev); |
258 | kfree(chip); | 258 | kfree(chip); |
259 | i2c_set_clientdata(client, NULL); | 259 | i2c_set_clientdata(client, NULL); |
260 | 260 | ||
diff --git a/drivers/regulator/isl6271a-regulator.c b/drivers/regulator/isl6271a-regulator.c index e49d2bd393f2..d61ecb885a8c 100644 --- a/drivers/regulator/isl6271a-regulator.c +++ b/drivers/regulator/isl6271a-regulator.c | |||
@@ -165,7 +165,7 @@ static int __devinit isl6271a_probe(struct i2c_client *i2c, | |||
165 | mutex_init(&pmic->mtx); | 165 | mutex_init(&pmic->mtx); |
166 | 166 | ||
167 | for (i = 0; i < 3; i++) { | 167 | for (i = 0; i < 3; i++) { |
168 | pmic->rdev[i] = regulator_register(&isl_rd[0], &i2c->dev, | 168 | pmic->rdev[i] = regulator_register(&isl_rd[i], &i2c->dev, |
169 | init_data, pmic); | 169 | init_data, pmic); |
170 | if (IS_ERR(pmic->rdev[i])) { | 170 | if (IS_ERR(pmic->rdev[i])) { |
171 | dev_err(&i2c->dev, "failed to register %s\n", id->name); | 171 | dev_err(&i2c->dev, "failed to register %s\n", id->name); |
diff --git a/drivers/regulator/max1586.c b/drivers/regulator/max1586.c index 8867c2710a6d..559cfa271a44 100644 --- a/drivers/regulator/max1586.c +++ b/drivers/regulator/max1586.c | |||
@@ -121,14 +121,14 @@ static int max1586_v6_set(struct regulator_dev *rdev, int min_uV, int max_uV) | |||
121 | if (max_uV < MAX1586_V6_MIN_UV || max_uV > MAX1586_V6_MAX_UV) | 121 | if (max_uV < MAX1586_V6_MIN_UV || max_uV > MAX1586_V6_MAX_UV) |
122 | return -EINVAL; | 122 | return -EINVAL; |
123 | 123 | ||
124 | if (min_uV >= 3000000) | ||
125 | selector = 3; | ||
126 | if (min_uV < 3000000) | ||
127 | selector = 2; | ||
128 | if (min_uV < 2500000) | ||
129 | selector = 1; | ||
130 | if (min_uV < 1800000) | 124 | if (min_uV < 1800000) |
131 | selector = 0; | 125 | selector = 0; |
126 | else if (min_uV < 2500000) | ||
127 | selector = 1; | ||
128 | else if (min_uV < 3000000) | ||
129 | selector = 2; | ||
130 | else if (min_uV >= 3000000) | ||
131 | selector = 3; | ||
132 | 132 | ||
133 | if (max1586_v6_calc_voltage(selector) > max_uV) | 133 | if (max1586_v6_calc_voltage(selector) > max_uV) |
134 | return -EINVAL; | 134 | return -EINVAL; |
diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c index ab67298799f9..a1baf1fbe004 100644 --- a/drivers/regulator/max8998.c +++ b/drivers/regulator/max8998.c | |||
@@ -549,7 +549,7 @@ static __devinit int max8998_pmic_probe(struct platform_device *pdev) | |||
549 | if (!max8998) | 549 | if (!max8998) |
550 | return -ENOMEM; | 550 | return -ENOMEM; |
551 | 551 | ||
552 | size = sizeof(struct regulator_dev *) * (pdata->num_regulators + 1); | 552 | size = sizeof(struct regulator_dev *) * pdata->num_regulators; |
553 | max8998->rdev = kzalloc(size, GFP_KERNEL); | 553 | max8998->rdev = kzalloc(size, GFP_KERNEL); |
554 | if (!max8998->rdev) { | 554 | if (!max8998->rdev) { |
555 | kfree(max8998); | 555 | kfree(max8998); |
@@ -557,7 +557,9 @@ static __devinit int max8998_pmic_probe(struct platform_device *pdev) | |||
557 | } | 557 | } |
558 | 558 | ||
559 | rdev = max8998->rdev; | 559 | rdev = max8998->rdev; |
560 | max8998->dev = &pdev->dev; | ||
560 | max8998->iodev = iodev; | 561 | max8998->iodev = iodev; |
562 | max8998->num_regulators = pdata->num_regulators; | ||
561 | platform_set_drvdata(pdev, max8998); | 563 | platform_set_drvdata(pdev, max8998); |
562 | 564 | ||
563 | for (i = 0; i < pdata->num_regulators; i++) { | 565 | for (i = 0; i < pdata->num_regulators; i++) { |
@@ -583,7 +585,7 @@ static __devinit int max8998_pmic_probe(struct platform_device *pdev) | |||
583 | 585 | ||
584 | return 0; | 586 | return 0; |
585 | err: | 587 | err: |
586 | for (i = 0; i <= max8998->num_regulators; i++) | 588 | for (i = 0; i < max8998->num_regulators; i++) |
587 | if (rdev[i]) | 589 | if (rdev[i]) |
588 | regulator_unregister(rdev[i]); | 590 | regulator_unregister(rdev[i]); |
589 | 591 | ||
@@ -599,7 +601,7 @@ static int __devexit max8998_pmic_remove(struct platform_device *pdev) | |||
599 | struct regulator_dev **rdev = max8998->rdev; | 601 | struct regulator_dev **rdev = max8998->rdev; |
600 | int i; | 602 | int i; |
601 | 603 | ||
602 | for (i = 0; i <= max8998->num_regulators; i++) | 604 | for (i = 0; i < max8998->num_regulators; i++) |
603 | if (rdev[i]) | 605 | if (rdev[i]) |
604 | regulator_unregister(rdev[i]); | 606 | regulator_unregister(rdev[i]); |
605 | 607 | ||
diff --git a/drivers/regulator/tps6507x-regulator.c b/drivers/regulator/tps6507x-regulator.c index c239f42aa4a3..020f5878d7ff 100644 --- a/drivers/regulator/tps6507x-regulator.c +++ b/drivers/regulator/tps6507x-regulator.c | |||
@@ -626,12 +626,6 @@ fail: | |||
626 | return error; | 626 | return error; |
627 | } | 627 | } |
628 | 628 | ||
629 | /** | ||
630 | * tps6507x_remove - TPS6507x driver i2c remove handler | ||
631 | * @client: i2c driver client device structure | ||
632 | * | ||
633 | * Unregister TPS driver as an i2c client device driver | ||
634 | */ | ||
635 | static int __devexit tps6507x_pmic_remove(struct platform_device *pdev) | 629 | static int __devexit tps6507x_pmic_remove(struct platform_device *pdev) |
636 | { | 630 | { |
637 | struct tps6507x_dev *tps6507x_dev = platform_get_drvdata(pdev); | 631 | struct tps6507x_dev *tps6507x_dev = platform_get_drvdata(pdev); |
diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c index 8cff1413a147..51237fbb1bbb 100644 --- a/drivers/regulator/tps6586x-regulator.c +++ b/drivers/regulator/tps6586x-regulator.c | |||
@@ -133,7 +133,7 @@ static int tps6586x_ldo_get_voltage(struct regulator_dev *rdev) | |||
133 | mask = ((1 << ri->volt_nbits) - 1) << ri->volt_shift; | 133 | mask = ((1 << ri->volt_nbits) - 1) << ri->volt_shift; |
134 | val = (val & mask) >> ri->volt_shift; | 134 | val = (val & mask) >> ri->volt_shift; |
135 | 135 | ||
136 | if (val > ri->desc.n_voltages) | 136 | if (val >= ri->desc.n_voltages) |
137 | BUG(); | 137 | BUG(); |
138 | 138 | ||
139 | return ri->voltages[val] * 1000; | 139 | return ri->voltages[val] * 1000; |
@@ -150,7 +150,7 @@ static int tps6586x_dvm_set_voltage(struct regulator_dev *rdev, | |||
150 | if (ret) | 150 | if (ret) |
151 | return ret; | 151 | return ret; |
152 | 152 | ||
153 | return tps6586x_set_bits(parent, ri->go_reg, ri->go_bit); | 153 | return tps6586x_set_bits(parent, ri->go_reg, 1 << ri->go_bit); |
154 | } | 154 | } |
155 | 155 | ||
156 | static int tps6586x_regulator_enable(struct regulator_dev *rdev) | 156 | static int tps6586x_regulator_enable(struct regulator_dev *rdev) |
diff --git a/drivers/regulator/wm831x-ldo.c b/drivers/regulator/wm831x-ldo.c index e686cdb61b97..9edf8f692341 100644 --- a/drivers/regulator/wm831x-ldo.c +++ b/drivers/regulator/wm831x-ldo.c | |||
@@ -215,8 +215,7 @@ static int wm831x_gp_ldo_set_mode(struct regulator_dev *rdev, | |||
215 | 215 | ||
216 | case REGULATOR_MODE_IDLE: | 216 | case REGULATOR_MODE_IDLE: |
217 | ret = wm831x_set_bits(wm831x, ctrl_reg, | 217 | ret = wm831x_set_bits(wm831x, ctrl_reg, |
218 | WM831X_LDO1_LP_MODE, | 218 | WM831X_LDO1_LP_MODE, 0); |
219 | WM831X_LDO1_LP_MODE); | ||
220 | if (ret < 0) | 219 | if (ret < 0) |
221 | return ret; | 220 | return ret; |
222 | 221 | ||
@@ -225,10 +224,12 @@ static int wm831x_gp_ldo_set_mode(struct regulator_dev *rdev, | |||
225 | WM831X_LDO1_ON_MODE); | 224 | WM831X_LDO1_ON_MODE); |
226 | if (ret < 0) | 225 | if (ret < 0) |
227 | return ret; | 226 | return ret; |
227 | break; | ||
228 | 228 | ||
229 | case REGULATOR_MODE_STANDBY: | 229 | case REGULATOR_MODE_STANDBY: |
230 | ret = wm831x_set_bits(wm831x, ctrl_reg, | 230 | ret = wm831x_set_bits(wm831x, ctrl_reg, |
231 | WM831X_LDO1_LP_MODE, 0); | 231 | WM831X_LDO1_LP_MODE, |
232 | WM831X_LDO1_LP_MODE); | ||
232 | if (ret < 0) | 233 | if (ret < 0) |
233 | return ret; | 234 | return ret; |
234 | 235 | ||
diff --git a/drivers/regulator/wm8350-regulator.c b/drivers/regulator/wm8350-regulator.c index 0e6ed7db9364..fe4b8a8a9dfd 100644 --- a/drivers/regulator/wm8350-regulator.c +++ b/drivers/regulator/wm8350-regulator.c | |||
@@ -1129,7 +1129,7 @@ static unsigned int wm8350_dcdc_get_mode(struct regulator_dev *rdev) | |||
1129 | mode = REGULATOR_MODE_NORMAL; | 1129 | mode = REGULATOR_MODE_NORMAL; |
1130 | } else if (!active && !sleep) | 1130 | } else if (!active && !sleep) |
1131 | mode = REGULATOR_MODE_IDLE; | 1131 | mode = REGULATOR_MODE_IDLE; |
1132 | else if (!sleep) | 1132 | else if (sleep) |
1133 | mode = REGULATOR_MODE_STANDBY; | 1133 | mode = REGULATOR_MODE_STANDBY; |
1134 | 1134 | ||
1135 | return mode; | 1135 | return mode; |
diff --git a/drivers/rtc/rtc-ab3100.c b/drivers/rtc/rtc-ab3100.c index d26780ea254b..261a07e0fb24 100644 --- a/drivers/rtc/rtc-ab3100.c +++ b/drivers/rtc/rtc-ab3100.c | |||
@@ -235,6 +235,7 @@ static int __init ab3100_rtc_probe(struct platform_device *pdev) | |||
235 | err = PTR_ERR(rtc); | 235 | err = PTR_ERR(rtc); |
236 | return err; | 236 | return err; |
237 | } | 237 | } |
238 | platform_set_drvdata(pdev, rtc); | ||
238 | 239 | ||
239 | return 0; | 240 | return 0; |
240 | } | 241 | } |
@@ -244,6 +245,7 @@ static int __exit ab3100_rtc_remove(struct platform_device *pdev) | |||
244 | struct rtc_device *rtc = platform_get_drvdata(pdev); | 245 | struct rtc_device *rtc = platform_get_drvdata(pdev); |
245 | 246 | ||
246 | rtc_device_unregister(rtc); | 247 | rtc_device_unregister(rtc); |
248 | platform_set_drvdata(pdev, NULL); | ||
247 | return 0; | 249 | return 0; |
248 | } | 250 | } |
249 | 251 | ||
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index a0d3ec89d412..f57a87f4ae96 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
@@ -310,11 +310,6 @@ static int s3c_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
310 | 310 | ||
311 | s3c_rtc_setaie(alrm->enabled); | 311 | s3c_rtc_setaie(alrm->enabled); |
312 | 312 | ||
313 | if (alrm->enabled) | ||
314 | enable_irq_wake(s3c_rtc_alarmno); | ||
315 | else | ||
316 | disable_irq_wake(s3c_rtc_alarmno); | ||
317 | |||
318 | return 0; | 313 | return 0; |
319 | } | 314 | } |
320 | 315 | ||
@@ -587,6 +582,10 @@ static int s3c_rtc_suspend(struct platform_device *pdev, pm_message_t state) | |||
587 | ticnt_en_save &= S3C64XX_RTCCON_TICEN; | 582 | ticnt_en_save &= S3C64XX_RTCCON_TICEN; |
588 | } | 583 | } |
589 | s3c_rtc_enable(pdev, 0); | 584 | s3c_rtc_enable(pdev, 0); |
585 | |||
586 | if (device_may_wakeup(&pdev->dev)) | ||
587 | enable_irq_wake(s3c_rtc_alarmno); | ||
588 | |||
590 | return 0; | 589 | return 0; |
591 | } | 590 | } |
592 | 591 | ||
@@ -600,6 +599,10 @@ static int s3c_rtc_resume(struct platform_device *pdev) | |||
600 | tmp = readb(s3c_rtc_base + S3C2410_RTCCON); | 599 | tmp = readb(s3c_rtc_base + S3C2410_RTCCON); |
601 | writeb(tmp | ticnt_en_save, s3c_rtc_base + S3C2410_RTCCON); | 600 | writeb(tmp | ticnt_en_save, s3c_rtc_base + S3C2410_RTCCON); |
602 | } | 601 | } |
602 | |||
603 | if (device_may_wakeup(&pdev->dev)) | ||
604 | disable_irq_wake(s3c_rtc_alarmno); | ||
605 | |||
603 | return 0; | 606 | return 0; |
604 | } | 607 | } |
605 | #else | 608 | #else |
diff --git a/drivers/serial/amba-pl010.c b/drivers/serial/amba-pl010.c index 50441ffe8e38..2904aa044126 100644 --- a/drivers/serial/amba-pl010.c +++ b/drivers/serial/amba-pl010.c | |||
@@ -472,14 +472,9 @@ pl010_set_termios(struct uart_port *port, struct ktermios *termios, | |||
472 | spin_unlock_irqrestore(&uap->port.lock, flags); | 472 | spin_unlock_irqrestore(&uap->port.lock, flags); |
473 | } | 473 | } |
474 | 474 | ||
475 | static void pl010_set_ldisc(struct uart_port *port) | 475 | static void pl010_set_ldisc(struct uart_port *port, int new) |
476 | { | 476 | { |
477 | int line = port->line; | 477 | if (new == N_PPS) { |
478 | |||
479 | if (line >= port->state->port.tty->driver->num) | ||
480 | return; | ||
481 | |||
482 | if (port->state->port.tty->ldisc->ops->num == N_PPS) { | ||
483 | port->flags |= UPF_HARDPPS_CD; | 478 | port->flags |= UPF_HARDPPS_CD; |
484 | pl010_enable_ms(port); | 479 | pl010_enable_ms(port); |
485 | } else | 480 | } else |
diff --git a/drivers/serial/mfd.c b/drivers/serial/mfd.c index bc9af503907f..324c385a653d 100644 --- a/drivers/serial/mfd.c +++ b/drivers/serial/mfd.c | |||
@@ -1423,7 +1423,6 @@ static void hsu_global_init(void) | |||
1423 | } | 1423 | } |
1424 | 1424 | ||
1425 | phsu = hsu; | 1425 | phsu = hsu; |
1426 | |||
1427 | hsu_debugfs_init(hsu); | 1426 | hsu_debugfs_init(hsu); |
1428 | return; | 1427 | return; |
1429 | 1428 | ||
@@ -1435,18 +1434,20 @@ err_free_region: | |||
1435 | 1434 | ||
1436 | static void serial_hsu_remove(struct pci_dev *pdev) | 1435 | static void serial_hsu_remove(struct pci_dev *pdev) |
1437 | { | 1436 | { |
1438 | struct hsu_port *hsu; | 1437 | void *priv = pci_get_drvdata(pdev); |
1439 | int i; | 1438 | struct uart_hsu_port *up; |
1440 | 1439 | ||
1441 | hsu = pci_get_drvdata(pdev); | 1440 | if (!priv) |
1442 | if (!hsu) | ||
1443 | return; | 1441 | return; |
1444 | 1442 | ||
1445 | for (i = 0; i < 3; i++) | 1443 | /* For port 0/1/2, priv is the address of uart_hsu_port */ |
1446 | uart_remove_one_port(&serial_hsu_reg, &hsu->port[i].port); | 1444 | if (pdev->device != 0x081E) { |
1445 | up = priv; | ||
1446 | uart_remove_one_port(&serial_hsu_reg, &up->port); | ||
1447 | } | ||
1447 | 1448 | ||
1448 | pci_set_drvdata(pdev, NULL); | 1449 | pci_set_drvdata(pdev, NULL); |
1449 | free_irq(hsu->irq, hsu); | 1450 | free_irq(pdev->irq, priv); |
1450 | pci_disable_device(pdev); | 1451 | pci_disable_device(pdev); |
1451 | } | 1452 | } |
1452 | 1453 | ||
diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.c index 8dedb266f143..c4399e23565a 100644 --- a/drivers/serial/mpc52xx_uart.c +++ b/drivers/serial/mpc52xx_uart.c | |||
@@ -500,6 +500,7 @@ static int __init mpc512x_psc_fifoc_init(void) | |||
500 | psc_fifoc = of_iomap(np, 0); | 500 | psc_fifoc = of_iomap(np, 0); |
501 | if (!psc_fifoc) { | 501 | if (!psc_fifoc) { |
502 | pr_err("%s: Can't map FIFOC\n", __func__); | 502 | pr_err("%s: Can't map FIFOC\n", __func__); |
503 | of_node_put(np); | ||
503 | return -ENODEV; | 504 | return -ENODEV; |
504 | } | 505 | } |
505 | 506 | ||
diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index 141c69554bd4..7d475b2a79e8 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c | |||
@@ -335,8 +335,6 @@ static int serial_probe(struct pcmcia_device *link) | |||
335 | info->p_dev = link; | 335 | info->p_dev = link; |
336 | link->priv = info; | 336 | link->priv = info; |
337 | 337 | ||
338 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; | ||
339 | link->resource[0]->end = 8; | ||
340 | link->conf.Attributes = CONF_ENABLE_IRQ; | 338 | link->conf.Attributes = CONF_ENABLE_IRQ; |
341 | if (do_sound) { | 339 | if (do_sound) { |
342 | link->conf.Attributes |= CONF_ENABLE_SPKR; | 340 | link->conf.Attributes |= CONF_ENABLE_SPKR; |
@@ -411,6 +409,27 @@ static int setup_serial(struct pcmcia_device *handle, struct serial_info * info, | |||
411 | 409 | ||
412 | /*====================================================================*/ | 410 | /*====================================================================*/ |
413 | 411 | ||
412 | static int pfc_config(struct pcmcia_device *p_dev) | ||
413 | { | ||
414 | unsigned int port = 0; | ||
415 | struct serial_info *info = p_dev->priv; | ||
416 | |||
417 | if ((p_dev->resource[1]->end != 0) && | ||
418 | (resource_size(p_dev->resource[1]) == 8)) { | ||
419 | port = p_dev->resource[1]->start; | ||
420 | info->slave = 1; | ||
421 | } else if ((info->manfid == MANFID_OSITECH) && | ||
422 | (resource_size(p_dev->resource[0]) == 0x40)) { | ||
423 | port = p_dev->resource[0]->start + 0x28; | ||
424 | info->slave = 1; | ||
425 | } | ||
426 | if (info->slave) | ||
427 | return setup_serial(p_dev, info, port, p_dev->irq); | ||
428 | |||
429 | dev_warn(&p_dev->dev, "no usable port range found, giving up\n"); | ||
430 | return -ENODEV; | ||
431 | } | ||
432 | |||
414 | static int simple_config_check(struct pcmcia_device *p_dev, | 433 | static int simple_config_check(struct pcmcia_device *p_dev, |
415 | cistpl_cftable_entry_t *cf, | 434 | cistpl_cftable_entry_t *cf, |
416 | cistpl_cftable_entry_t *dflt, | 435 | cistpl_cftable_entry_t *dflt, |
@@ -461,23 +480,8 @@ static int simple_config(struct pcmcia_device *link) | |||
461 | struct serial_info *info = link->priv; | 480 | struct serial_info *info = link->priv; |
462 | int i = -ENODEV, try; | 481 | int i = -ENODEV, try; |
463 | 482 | ||
464 | /* If the card is already configured, look up the port and irq */ | 483 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; |
465 | if (link->function_config) { | 484 | link->resource[0]->end = 8; |
466 | unsigned int port = 0; | ||
467 | if ((link->resource[1]->end != 0) && | ||
468 | (resource_size(link->resource[1]) == 8)) { | ||
469 | port = link->resource[1]->end; | ||
470 | info->slave = 1; | ||
471 | } else if ((info->manfid == MANFID_OSITECH) && | ||
472 | (resource_size(link->resource[0]) == 0x40)) { | ||
473 | port = link->resource[0]->start + 0x28; | ||
474 | info->slave = 1; | ||
475 | } | ||
476 | if (info->slave) { | ||
477 | return setup_serial(link, info, port, | ||
478 | link->irq); | ||
479 | } | ||
480 | } | ||
481 | 485 | ||
482 | /* First pass: look for a config entry that looks normal. | 486 | /* First pass: look for a config entry that looks normal. |
483 | * Two tries: without IO aliases, then with aliases */ | 487 | * Two tries: without IO aliases, then with aliases */ |
@@ -491,8 +495,7 @@ static int simple_config(struct pcmcia_device *link) | |||
491 | if (!pcmcia_loop_config(link, simple_config_check_notpicky, NULL)) | 495 | if (!pcmcia_loop_config(link, simple_config_check_notpicky, NULL)) |
492 | goto found_port; | 496 | goto found_port; |
493 | 497 | ||
494 | printk(KERN_NOTICE | 498 | dev_warn(&link->dev, "no usable port range found, giving up\n"); |
495 | "serial_cs: no usable port range found, giving up\n"); | ||
496 | return -1; | 499 | return -1; |
497 | 500 | ||
498 | found_port: | 501 | found_port: |
@@ -558,6 +561,7 @@ static int multi_config(struct pcmcia_device *link) | |||
558 | int i, base2 = 0; | 561 | int i, base2 = 0; |
559 | 562 | ||
560 | /* First, look for a generic full-sized window */ | 563 | /* First, look for a generic full-sized window */ |
564 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; | ||
561 | link->resource[0]->end = info->multi * 8; | 565 | link->resource[0]->end = info->multi * 8; |
562 | if (pcmcia_loop_config(link, multi_config_check, &base2)) { | 566 | if (pcmcia_loop_config(link, multi_config_check, &base2)) { |
563 | /* If that didn't work, look for two windows */ | 567 | /* If that didn't work, look for two windows */ |
@@ -565,15 +569,14 @@ static int multi_config(struct pcmcia_device *link) | |||
565 | info->multi = 2; | 569 | info->multi = 2; |
566 | if (pcmcia_loop_config(link, multi_config_check_notpicky, | 570 | if (pcmcia_loop_config(link, multi_config_check_notpicky, |
567 | &base2)) { | 571 | &base2)) { |
568 | printk(KERN_NOTICE "serial_cs: no usable port range" | 572 | dev_warn(&link->dev, "no usable port range " |
569 | "found, giving up\n"); | 573 | "found, giving up\n"); |
570 | return -ENODEV; | 574 | return -ENODEV; |
571 | } | 575 | } |
572 | } | 576 | } |
573 | 577 | ||
574 | if (!link->irq) | 578 | if (!link->irq) |
575 | dev_warn(&link->dev, | 579 | dev_warn(&link->dev, "no usable IRQ found, continuing...\n"); |
576 | "serial_cs: no usable IRQ found, continuing...\n"); | ||
577 | 580 | ||
578 | /* | 581 | /* |
579 | * Apply any configuration quirks. | 582 | * Apply any configuration quirks. |
@@ -675,6 +678,7 @@ static int serial_config(struct pcmcia_device * link) | |||
675 | multifunction cards that ask for appropriate IO port ranges */ | 678 | multifunction cards that ask for appropriate IO port ranges */ |
676 | if ((info->multi == 0) && | 679 | if ((info->multi == 0) && |
677 | (link->has_func_id) && | 680 | (link->has_func_id) && |
681 | (link->socket->pcmcia_pfc == 0) && | ||
678 | ((link->func_id == CISTPL_FUNCID_MULTI) || | 682 | ((link->func_id == CISTPL_FUNCID_MULTI) || |
679 | (link->func_id == CISTPL_FUNCID_SERIAL))) | 683 | (link->func_id == CISTPL_FUNCID_SERIAL))) |
680 | pcmcia_loop_config(link, serial_check_for_multi, info); | 684 | pcmcia_loop_config(link, serial_check_for_multi, info); |
@@ -685,7 +689,13 @@ static int serial_config(struct pcmcia_device * link) | |||
685 | if (info->quirk && info->quirk->multi != -1) | 689 | if (info->quirk && info->quirk->multi != -1) |
686 | info->multi = info->quirk->multi; | 690 | info->multi = info->quirk->multi; |
687 | 691 | ||
688 | if (info->multi > 1) | 692 | dev_info(&link->dev, |
693 | "trying to set up [0x%04x:0x%04x] (pfc: %d, multi: %d, quirk: %p)\n", | ||
694 | link->manf_id, link->card_id, | ||
695 | link->socket->pcmcia_pfc, info->multi, info->quirk); | ||
696 | if (link->socket->pcmcia_pfc) | ||
697 | i = pfc_config(link); | ||
698 | else if (info->multi > 1) | ||
689 | i = multi_config(link); | 699 | i = multi_config(link); |
690 | else | 700 | else |
691 | i = simple_config(link); | 701 | i = simple_config(link); |
@@ -704,7 +714,7 @@ static int serial_config(struct pcmcia_device * link) | |||
704 | return 0; | 714 | return 0; |
705 | 715 | ||
706 | failed: | 716 | failed: |
707 | dev_warn(&link->dev, "serial_cs: failed to initialize\n"); | 717 | dev_warn(&link->dev, "failed to initialize\n"); |
708 | serial_remove(link); | 718 | serial_remove(link); |
709 | return -ENODEV; | 719 | return -ENODEV; |
710 | } | 720 | } |
diff --git a/drivers/spi/amba-pl022.c b/drivers/spi/amba-pl022.c index acd35d1ebd12..4c37c4e28647 100644 --- a/drivers/spi/amba-pl022.c +++ b/drivers/spi/amba-pl022.c | |||
@@ -503,8 +503,9 @@ static void giveback(struct pl022 *pl022) | |||
503 | msg->state = NULL; | 503 | msg->state = NULL; |
504 | if (msg->complete) | 504 | if (msg->complete) |
505 | msg->complete(msg->context); | 505 | msg->complete(msg->context); |
506 | /* This message is completed, so let's turn off the clock! */ | 506 | /* This message is completed, so let's turn off the clocks! */ |
507 | clk_disable(pl022->clk); | 507 | clk_disable(pl022->clk); |
508 | amba_pclk_disable(pl022->adev); | ||
508 | } | 509 | } |
509 | 510 | ||
510 | /** | 511 | /** |
@@ -1139,9 +1140,10 @@ static void pump_messages(struct work_struct *work) | |||
1139 | /* Setup the SPI using the per chip configuration */ | 1140 | /* Setup the SPI using the per chip configuration */ |
1140 | pl022->cur_chip = spi_get_ctldata(pl022->cur_msg->spi); | 1141 | pl022->cur_chip = spi_get_ctldata(pl022->cur_msg->spi); |
1141 | /* | 1142 | /* |
1142 | * We enable the clock here, then the clock will be disabled when | 1143 | * We enable the clocks here, then the clocks will be disabled when |
1143 | * giveback() is called in each method (poll/interrupt/DMA) | 1144 | * giveback() is called in each method (poll/interrupt/DMA) |
1144 | */ | 1145 | */ |
1146 | amba_pclk_enable(pl022->adev); | ||
1145 | clk_enable(pl022->clk); | 1147 | clk_enable(pl022->clk); |
1146 | restore_state(pl022); | 1148 | restore_state(pl022); |
1147 | flush(pl022); | 1149 | flush(pl022); |
@@ -1786,11 +1788,9 @@ pl022_probe(struct amba_device *adev, struct amba_id *id) | |||
1786 | } | 1788 | } |
1787 | 1789 | ||
1788 | /* Disable SSP */ | 1790 | /* Disable SSP */ |
1789 | clk_enable(pl022->clk); | ||
1790 | writew((readw(SSP_CR1(pl022->virtbase)) & (~SSP_CR1_MASK_SSE)), | 1791 | writew((readw(SSP_CR1(pl022->virtbase)) & (~SSP_CR1_MASK_SSE)), |
1791 | SSP_CR1(pl022->virtbase)); | 1792 | SSP_CR1(pl022->virtbase)); |
1792 | load_ssp_default_config(pl022); | 1793 | load_ssp_default_config(pl022); |
1793 | clk_disable(pl022->clk); | ||
1794 | 1794 | ||
1795 | status = request_irq(adev->irq[0], pl022_interrupt_handler, 0, "pl022", | 1795 | status = request_irq(adev->irq[0], pl022_interrupt_handler, 0, "pl022", |
1796 | pl022); | 1796 | pl022); |
@@ -1818,6 +1818,8 @@ pl022_probe(struct amba_device *adev, struct amba_id *id) | |||
1818 | goto err_spi_register; | 1818 | goto err_spi_register; |
1819 | } | 1819 | } |
1820 | dev_dbg(dev, "probe succeded\n"); | 1820 | dev_dbg(dev, "probe succeded\n"); |
1821 | /* Disable the silicon block pclk and clock it when needed */ | ||
1822 | amba_pclk_disable(adev); | ||
1821 | return 0; | 1823 | return 0; |
1822 | 1824 | ||
1823 | err_spi_register: | 1825 | err_spi_register: |
@@ -1879,9 +1881,9 @@ static int pl022_suspend(struct amba_device *adev, pm_message_t state) | |||
1879 | return status; | 1881 | return status; |
1880 | } | 1882 | } |
1881 | 1883 | ||
1882 | clk_enable(pl022->clk); | 1884 | amba_pclk_enable(adev); |
1883 | load_ssp_default_config(pl022); | 1885 | load_ssp_default_config(pl022); |
1884 | clk_disable(pl022->clk); | 1886 | amba_pclk_disable(adev); |
1885 | dev_dbg(&adev->dev, "suspended\n"); | 1887 | dev_dbg(&adev->dev, "suspended\n"); |
1886 | return 0; | 1888 | return 0; |
1887 | } | 1889 | } |
@@ -1981,7 +1983,7 @@ static int __init pl022_init(void) | |||
1981 | return amba_driver_register(&pl022_driver); | 1983 | return amba_driver_register(&pl022_driver); |
1982 | } | 1984 | } |
1983 | 1985 | ||
1984 | module_init(pl022_init); | 1986 | subsys_initcall(pl022_init); |
1985 | 1987 | ||
1986 | static void __exit pl022_exit(void) | 1988 | static void __exit pl022_exit(void) |
1987 | { | 1989 | { |
diff --git a/drivers/spi/dw_spi.c b/drivers/spi/dw_spi.c index d256cb00604c..56247853c298 100644 --- a/drivers/spi/dw_spi.c +++ b/drivers/spi/dw_spi.c | |||
@@ -181,10 +181,6 @@ static void flush(struct dw_spi *dws) | |||
181 | wait_till_not_busy(dws); | 181 | wait_till_not_busy(dws); |
182 | } | 182 | } |
183 | 183 | ||
184 | static void null_cs_control(u32 command) | ||
185 | { | ||
186 | } | ||
187 | |||
188 | static int null_writer(struct dw_spi *dws) | 184 | static int null_writer(struct dw_spi *dws) |
189 | { | 185 | { |
190 | u8 n_bytes = dws->n_bytes; | 186 | u8 n_bytes = dws->n_bytes; |
@@ -322,7 +318,7 @@ static void giveback(struct dw_spi *dws) | |||
322 | struct spi_transfer, | 318 | struct spi_transfer, |
323 | transfer_list); | 319 | transfer_list); |
324 | 320 | ||
325 | if (!last_transfer->cs_change) | 321 | if (!last_transfer->cs_change && dws->cs_control) |
326 | dws->cs_control(MRST_SPI_DEASSERT); | 322 | dws->cs_control(MRST_SPI_DEASSERT); |
327 | 323 | ||
328 | msg->state = NULL; | 324 | msg->state = NULL; |
@@ -396,6 +392,11 @@ static irqreturn_t interrupt_transfer(struct dw_spi *dws) | |||
396 | static irqreturn_t dw_spi_irq(int irq, void *dev_id) | 392 | static irqreturn_t dw_spi_irq(int irq, void *dev_id) |
397 | { | 393 | { |
398 | struct dw_spi *dws = dev_id; | 394 | struct dw_spi *dws = dev_id; |
395 | u16 irq_status, irq_mask = 0x3f; | ||
396 | |||
397 | irq_status = dw_readw(dws, isr) & irq_mask; | ||
398 | if (!irq_status) | ||
399 | return IRQ_NONE; | ||
399 | 400 | ||
400 | if (!dws->cur_msg) { | 401 | if (!dws->cur_msg) { |
401 | spi_mask_intr(dws, SPI_INT_TXEI); | 402 | spi_mask_intr(dws, SPI_INT_TXEI); |
@@ -544,13 +545,13 @@ static void pump_transfers(unsigned long data) | |||
544 | */ | 545 | */ |
545 | if (dws->cs_control) { | 546 | if (dws->cs_control) { |
546 | if (dws->rx && dws->tx) | 547 | if (dws->rx && dws->tx) |
547 | chip->tmode = 0x00; | 548 | chip->tmode = SPI_TMOD_TR; |
548 | else if (dws->rx) | 549 | else if (dws->rx) |
549 | chip->tmode = 0x02; | 550 | chip->tmode = SPI_TMOD_RO; |
550 | else | 551 | else |
551 | chip->tmode = 0x01; | 552 | chip->tmode = SPI_TMOD_TO; |
552 | 553 | ||
553 | cr0 &= ~(0x3 << SPI_MODE_OFFSET); | 554 | cr0 &= ~SPI_TMOD_MASK; |
554 | cr0 |= (chip->tmode << SPI_TMOD_OFFSET); | 555 | cr0 |= (chip->tmode << SPI_TMOD_OFFSET); |
555 | } | 556 | } |
556 | 557 | ||
@@ -699,9 +700,6 @@ static int dw_spi_setup(struct spi_device *spi) | |||
699 | chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL); | 700 | chip = kzalloc(sizeof(struct chip_data), GFP_KERNEL); |
700 | if (!chip) | 701 | if (!chip) |
701 | return -ENOMEM; | 702 | return -ENOMEM; |
702 | |||
703 | chip->cs_control = null_cs_control; | ||
704 | chip->enable_dma = 0; | ||
705 | } | 703 | } |
706 | 704 | ||
707 | /* | 705 | /* |
@@ -883,7 +881,7 @@ int __devinit dw_spi_add_host(struct dw_spi *dws) | |||
883 | dws->dma_inited = 0; | 881 | dws->dma_inited = 0; |
884 | dws->dma_addr = (dma_addr_t)(dws->paddr + 0x60); | 882 | dws->dma_addr = (dma_addr_t)(dws->paddr + 0x60); |
885 | 883 | ||
886 | ret = request_irq(dws->irq, dw_spi_irq, 0, | 884 | ret = request_irq(dws->irq, dw_spi_irq, IRQF_SHARED, |
887 | "dw_spi", dws); | 885 | "dw_spi", dws); |
888 | if (ret < 0) { | 886 | if (ret < 0) { |
889 | dev_err(&master->dev, "can not get IRQ\n"); | 887 | dev_err(&master->dev, "can not get IRQ\n"); |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index a9e5c79ae52a..0bcf4c1601a2 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -554,11 +554,9 @@ done: | |||
554 | EXPORT_SYMBOL_GPL(spi_register_master); | 554 | EXPORT_SYMBOL_GPL(spi_register_master); |
555 | 555 | ||
556 | 556 | ||
557 | static int __unregister(struct device *dev, void *master_dev) | 557 | static int __unregister(struct device *dev, void *null) |
558 | { | 558 | { |
559 | /* note: before about 2.6.14-rc1 this would corrupt memory: */ | 559 | spi_unregister_device(to_spi_device(dev)); |
560 | if (dev != master_dev) | ||
561 | spi_unregister_device(to_spi_device(dev)); | ||
562 | return 0; | 560 | return 0; |
563 | } | 561 | } |
564 | 562 | ||
@@ -576,8 +574,7 @@ void spi_unregister_master(struct spi_master *master) | |||
576 | { | 574 | { |
577 | int dummy; | 575 | int dummy; |
578 | 576 | ||
579 | dummy = device_for_each_child(master->dev.parent, &master->dev, | 577 | dummy = device_for_each_child(&master->dev, NULL, __unregister); |
580 | __unregister); | ||
581 | device_unregister(&master->dev); | 578 | device_unregister(&master->dev); |
582 | } | 579 | } |
583 | EXPORT_SYMBOL_GPL(spi_unregister_master); | 580 | EXPORT_SYMBOL_GPL(spi_unregister_master); |
diff --git a/drivers/spi/spi_s3c64xx.c b/drivers/spi/spi_s3c64xx.c index 97365815a729..c3038da2648a 100644 --- a/drivers/spi/spi_s3c64xx.c +++ b/drivers/spi/spi_s3c64xx.c | |||
@@ -200,6 +200,9 @@ static void flush_fifo(struct s3c64xx_spi_driver_data *sdd) | |||
200 | val = readl(regs + S3C64XX_SPI_STATUS); | 200 | val = readl(regs + S3C64XX_SPI_STATUS); |
201 | } while (TX_FIFO_LVL(val, sci) && loops--); | 201 | } while (TX_FIFO_LVL(val, sci) && loops--); |
202 | 202 | ||
203 | if (loops == 0) | ||
204 | dev_warn(&sdd->pdev->dev, "Timed out flushing TX FIFO\n"); | ||
205 | |||
203 | /* Flush RxFIFO*/ | 206 | /* Flush RxFIFO*/ |
204 | loops = msecs_to_loops(1); | 207 | loops = msecs_to_loops(1); |
205 | do { | 208 | do { |
@@ -210,6 +213,9 @@ static void flush_fifo(struct s3c64xx_spi_driver_data *sdd) | |||
210 | break; | 213 | break; |
211 | } while (loops--); | 214 | } while (loops--); |
212 | 215 | ||
216 | if (loops == 0) | ||
217 | dev_warn(&sdd->pdev->dev, "Timed out flushing RX FIFO\n"); | ||
218 | |||
213 | val = readl(regs + S3C64XX_SPI_CH_CFG); | 219 | val = readl(regs + S3C64XX_SPI_CH_CFG); |
214 | val &= ~S3C64XX_SPI_CH_SW_RST; | 220 | val &= ~S3C64XX_SPI_CH_SW_RST; |
215 | writel(val, regs + S3C64XX_SPI_CH_CFG); | 221 | writel(val, regs + S3C64XX_SPI_CH_CFG); |
@@ -320,16 +326,17 @@ static int wait_for_xfer(struct s3c64xx_spi_driver_data *sdd, | |||
320 | 326 | ||
321 | /* millisecs to xfer 'len' bytes @ 'cur_speed' */ | 327 | /* millisecs to xfer 'len' bytes @ 'cur_speed' */ |
322 | ms = xfer->len * 8 * 1000 / sdd->cur_speed; | 328 | ms = xfer->len * 8 * 1000 / sdd->cur_speed; |
323 | ms += 5; /* some tolerance */ | 329 | ms += 10; /* some tolerance */ |
324 | 330 | ||
325 | if (dma_mode) { | 331 | if (dma_mode) { |
326 | val = msecs_to_jiffies(ms) + 10; | 332 | val = msecs_to_jiffies(ms) + 10; |
327 | val = wait_for_completion_timeout(&sdd->xfer_completion, val); | 333 | val = wait_for_completion_timeout(&sdd->xfer_completion, val); |
328 | } else { | 334 | } else { |
335 | u32 status; | ||
329 | val = msecs_to_loops(ms); | 336 | val = msecs_to_loops(ms); |
330 | do { | 337 | do { |
331 | val = readl(regs + S3C64XX_SPI_STATUS); | 338 | status = readl(regs + S3C64XX_SPI_STATUS); |
332 | } while (RX_FIFO_LVL(val, sci) < xfer->len && --val); | 339 | } while (RX_FIFO_LVL(status, sci) < xfer->len && --val); |
333 | } | 340 | } |
334 | 341 | ||
335 | if (!val) | 342 | if (!val) |
@@ -447,8 +454,8 @@ static void s3c64xx_spi_config(struct s3c64xx_spi_driver_data *sdd) | |||
447 | writel(val, regs + S3C64XX_SPI_CLK_CFG); | 454 | writel(val, regs + S3C64XX_SPI_CLK_CFG); |
448 | } | 455 | } |
449 | 456 | ||
450 | void s3c64xx_spi_dma_rxcb(struct s3c2410_dma_chan *chan, void *buf_id, | 457 | static void s3c64xx_spi_dma_rxcb(struct s3c2410_dma_chan *chan, void *buf_id, |
451 | int size, enum s3c2410_dma_buffresult res) | 458 | int size, enum s3c2410_dma_buffresult res) |
452 | { | 459 | { |
453 | struct s3c64xx_spi_driver_data *sdd = buf_id; | 460 | struct s3c64xx_spi_driver_data *sdd = buf_id; |
454 | unsigned long flags; | 461 | unsigned long flags; |
@@ -467,8 +474,8 @@ void s3c64xx_spi_dma_rxcb(struct s3c2410_dma_chan *chan, void *buf_id, | |||
467 | spin_unlock_irqrestore(&sdd->lock, flags); | 474 | spin_unlock_irqrestore(&sdd->lock, flags); |
468 | } | 475 | } |
469 | 476 | ||
470 | void s3c64xx_spi_dma_txcb(struct s3c2410_dma_chan *chan, void *buf_id, | 477 | static void s3c64xx_spi_dma_txcb(struct s3c2410_dma_chan *chan, void *buf_id, |
471 | int size, enum s3c2410_dma_buffresult res) | 478 | int size, enum s3c2410_dma_buffresult res) |
472 | { | 479 | { |
473 | struct s3c64xx_spi_driver_data *sdd = buf_id; | 480 | struct s3c64xx_spi_driver_data *sdd = buf_id; |
474 | unsigned long flags; | 481 | unsigned long flags; |
@@ -508,8 +515,9 @@ static int s3c64xx_spi_map_mssg(struct s3c64xx_spi_driver_data *sdd, | |||
508 | list_for_each_entry(xfer, &msg->transfers, transfer_list) { | 515 | list_for_each_entry(xfer, &msg->transfers, transfer_list) { |
509 | 516 | ||
510 | if (xfer->tx_buf != NULL) { | 517 | if (xfer->tx_buf != NULL) { |
511 | xfer->tx_dma = dma_map_single(dev, xfer->tx_buf, | 518 | xfer->tx_dma = dma_map_single(dev, |
512 | xfer->len, DMA_TO_DEVICE); | 519 | (void *)xfer->tx_buf, xfer->len, |
520 | DMA_TO_DEVICE); | ||
513 | if (dma_mapping_error(dev, xfer->tx_dma)) { | 521 | if (dma_mapping_error(dev, xfer->tx_dma)) { |
514 | dev_err(dev, "dma_map_single Tx failed\n"); | 522 | dev_err(dev, "dma_map_single Tx failed\n"); |
515 | xfer->tx_dma = XFER_DMAADDR_INVALID; | 523 | xfer->tx_dma = XFER_DMAADDR_INVALID; |
@@ -919,6 +927,13 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev) | |||
919 | return -ENODEV; | 927 | return -ENODEV; |
920 | } | 928 | } |
921 | 929 | ||
930 | sci = pdev->dev.platform_data; | ||
931 | if (!sci->src_clk_name) { | ||
932 | dev_err(&pdev->dev, | ||
933 | "Board init must call s3c64xx_spi_set_info()\n"); | ||
934 | return -EINVAL; | ||
935 | } | ||
936 | |||
922 | /* Check for availability of necessary resource */ | 937 | /* Check for availability of necessary resource */ |
923 | 938 | ||
924 | dmatx_res = platform_get_resource(pdev, IORESOURCE_DMA, 0); | 939 | dmatx_res = platform_get_resource(pdev, IORESOURCE_DMA, 0); |
@@ -946,8 +961,6 @@ static int __init s3c64xx_spi_probe(struct platform_device *pdev) | |||
946 | return -ENOMEM; | 961 | return -ENOMEM; |
947 | } | 962 | } |
948 | 963 | ||
949 | sci = pdev->dev.platform_data; | ||
950 | |||
951 | platform_set_drvdata(pdev, master); | 964 | platform_set_drvdata(pdev, master); |
952 | 965 | ||
953 | sdd = spi_master_get_devdata(master); | 966 | sdd = spi_master_get_devdata(master); |
@@ -1170,7 +1183,7 @@ static int __init s3c64xx_spi_init(void) | |||
1170 | { | 1183 | { |
1171 | return platform_driver_probe(&s3c64xx_spi_driver, s3c64xx_spi_probe); | 1184 | return platform_driver_probe(&s3c64xx_spi_driver, s3c64xx_spi_probe); |
1172 | } | 1185 | } |
1173 | module_init(s3c64xx_spi_init); | 1186 | subsys_initcall(s3c64xx_spi_init); |
1174 | 1187 | ||
1175 | static void __exit s3c64xx_spi_exit(void) | 1188 | static void __exit s3c64xx_spi_exit(void) |
1176 | { | 1189 | { |
diff --git a/drivers/staging/batman-adv/hard-interface.c b/drivers/staging/batman-adv/hard-interface.c index baa8b05b9e8d..6e973a79aa25 100644 --- a/drivers/staging/batman-adv/hard-interface.c +++ b/drivers/staging/batman-adv/hard-interface.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include "hash.h" | 30 | #include "hash.h" |
31 | 31 | ||
32 | #include <linux/if_arp.h> | 32 | #include <linux/if_arp.h> |
33 | #include <linux/netfilter_bridge.h> | ||
34 | 33 | ||
35 | #define MIN(x, y) ((x) < (y) ? (x) : (y)) | 34 | #define MIN(x, y) ((x) < (y) ? (x) : (y)) |
36 | 35 | ||
@@ -431,11 +430,6 @@ out: | |||
431 | return NOTIFY_DONE; | 430 | return NOTIFY_DONE; |
432 | } | 431 | } |
433 | 432 | ||
434 | static int batman_skb_recv_finish(struct sk_buff *skb) | ||
435 | { | ||
436 | return NF_ACCEPT; | ||
437 | } | ||
438 | |||
439 | /* receive a packet with the batman ethertype coming on a hard | 433 | /* receive a packet with the batman ethertype coming on a hard |
440 | * interface */ | 434 | * interface */ |
441 | int batman_skb_recv(struct sk_buff *skb, struct net_device *dev, | 435 | int batman_skb_recv(struct sk_buff *skb, struct net_device *dev, |
@@ -456,13 +450,6 @@ int batman_skb_recv(struct sk_buff *skb, struct net_device *dev, | |||
456 | if (atomic_read(&module_state) != MODULE_ACTIVE) | 450 | if (atomic_read(&module_state) != MODULE_ACTIVE) |
457 | goto err_free; | 451 | goto err_free; |
458 | 452 | ||
459 | /* if netfilter/ebtables wants to block incoming batman | ||
460 | * packets then give them a chance to do so here */ | ||
461 | ret = NF_HOOK(PF_BRIDGE, NF_BR_LOCAL_IN, skb, dev, NULL, | ||
462 | batman_skb_recv_finish); | ||
463 | if (ret != 1) | ||
464 | goto err_out; | ||
465 | |||
466 | /* packet should hold at least type and version */ | 453 | /* packet should hold at least type and version */ |
467 | if (unlikely(skb_headlen(skb) < 2)) | 454 | if (unlikely(skb_headlen(skb) < 2)) |
468 | goto err_free; | 455 | goto err_free; |
diff --git a/drivers/staging/batman-adv/send.c b/drivers/staging/batman-adv/send.c index 055edee7b4e4..da3c82e47bbd 100644 --- a/drivers/staging/batman-adv/send.c +++ b/drivers/staging/batman-adv/send.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include "vis.h" | 29 | #include "vis.h" |
30 | #include "aggregation.h" | 30 | #include "aggregation.h" |
31 | 31 | ||
32 | #include <linux/netfilter_bridge.h> | ||
33 | 32 | ||
34 | static void send_outstanding_bcast_packet(struct work_struct *work); | 33 | static void send_outstanding_bcast_packet(struct work_struct *work); |
35 | 34 | ||
@@ -92,12 +91,9 @@ int send_skb_packet(struct sk_buff *skb, | |||
92 | 91 | ||
93 | /* dev_queue_xmit() returns a negative result on error. However on | 92 | /* dev_queue_xmit() returns a negative result on error. However on |
94 | * congestion and traffic shaping, it drops and returns NET_XMIT_DROP | 93 | * congestion and traffic shaping, it drops and returns NET_XMIT_DROP |
95 | * (which is > 0). This will not be treated as an error. | 94 | * (which is > 0). This will not be treated as an error. */ |
96 | * Also, if netfilter/ebtables wants to block outgoing batman | ||
97 | * packets then giving them a chance to do so here */ | ||
98 | 95 | ||
99 | return NF_HOOK(PF_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev, | 96 | return dev_queue_xmit(skb); |
100 | dev_queue_xmit); | ||
101 | send_skb_err: | 97 | send_skb_err: |
102 | kfree_skb(skb); | 98 | kfree_skb(skb); |
103 | return NET_XMIT_DROP; | 99 | return NET_XMIT_DROP; |
diff --git a/drivers/staging/ti-st/st.h b/drivers/staging/ti-st/st.h index 9952579425b9..1b3060eb2921 100644 --- a/drivers/staging/ti-st/st.h +++ b/drivers/staging/ti-st/st.h | |||
@@ -80,5 +80,4 @@ struct st_proto_s { | |||
80 | extern long st_register(struct st_proto_s *); | 80 | extern long st_register(struct st_proto_s *); |
81 | extern long st_unregister(enum proto_type); | 81 | extern long st_unregister(enum proto_type); |
82 | 82 | ||
83 | extern struct platform_device *st_get_plat_device(void); | ||
84 | #endif /* ST_H */ | 83 | #endif /* ST_H */ |
diff --git a/drivers/staging/ti-st/st_core.c b/drivers/staging/ti-st/st_core.c index 063c9b1db1ab..b85d8bfdf600 100644 --- a/drivers/staging/ti-st/st_core.c +++ b/drivers/staging/ti-st/st_core.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #include "st_ll.h" | 38 | #include "st_ll.h" |
39 | #include "st.h" | 39 | #include "st.h" |
40 | 40 | ||
41 | #define VERBOSE | ||
42 | /* strings to be used for rfkill entries and by | 41 | /* strings to be used for rfkill entries and by |
43 | * ST Core to be used for sysfs debug entry | 42 | * ST Core to be used for sysfs debug entry |
44 | */ | 43 | */ |
@@ -581,7 +580,7 @@ long st_register(struct st_proto_s *new_proto) | |||
581 | long err = 0; | 580 | long err = 0; |
582 | unsigned long flags = 0; | 581 | unsigned long flags = 0; |
583 | 582 | ||
584 | st_kim_ref(&st_gdata); | 583 | st_kim_ref(&st_gdata, 0); |
585 | pr_info("%s(%d) ", __func__, new_proto->type); | 584 | pr_info("%s(%d) ", __func__, new_proto->type); |
586 | if (st_gdata == NULL || new_proto == NULL || new_proto->recv == NULL | 585 | if (st_gdata == NULL || new_proto == NULL || new_proto->recv == NULL |
587 | || new_proto->reg_complete_cb == NULL) { | 586 | || new_proto->reg_complete_cb == NULL) { |
@@ -713,7 +712,7 @@ long st_unregister(enum proto_type type) | |||
713 | 712 | ||
714 | pr_debug("%s: %d ", __func__, type); | 713 | pr_debug("%s: %d ", __func__, type); |
715 | 714 | ||
716 | st_kim_ref(&st_gdata); | 715 | st_kim_ref(&st_gdata, 0); |
717 | if (type < ST_BT || type >= ST_MAX) { | 716 | if (type < ST_BT || type >= ST_MAX) { |
718 | pr_err(" protocol %d not supported", type); | 717 | pr_err(" protocol %d not supported", type); |
719 | return -EPROTONOSUPPORT; | 718 | return -EPROTONOSUPPORT; |
@@ -767,7 +766,7 @@ long st_write(struct sk_buff *skb) | |||
767 | #endif | 766 | #endif |
768 | long len; | 767 | long len; |
769 | 768 | ||
770 | st_kim_ref(&st_gdata); | 769 | st_kim_ref(&st_gdata, 0); |
771 | if (unlikely(skb == NULL || st_gdata == NULL | 770 | if (unlikely(skb == NULL || st_gdata == NULL |
772 | || st_gdata->tty == NULL)) { | 771 | || st_gdata->tty == NULL)) { |
773 | pr_err("data/tty unavailable to perform write"); | 772 | pr_err("data/tty unavailable to perform write"); |
@@ -818,7 +817,7 @@ static int st_tty_open(struct tty_struct *tty) | |||
818 | struct st_data_s *st_gdata; | 817 | struct st_data_s *st_gdata; |
819 | pr_info("%s ", __func__); | 818 | pr_info("%s ", __func__); |
820 | 819 | ||
821 | st_kim_ref(&st_gdata); | 820 | st_kim_ref(&st_gdata, 0); |
822 | st_gdata->tty = tty; | 821 | st_gdata->tty = tty; |
823 | tty->disc_data = st_gdata; | 822 | tty->disc_data = st_gdata; |
824 | 823 | ||
diff --git a/drivers/staging/ti-st/st_core.h b/drivers/staging/ti-st/st_core.h index e0c32d149f5f..8601320a679e 100644 --- a/drivers/staging/ti-st/st_core.h +++ b/drivers/staging/ti-st/st_core.h | |||
@@ -117,7 +117,7 @@ int st_core_init(struct st_data_s **); | |||
117 | void st_core_exit(struct st_data_s *); | 117 | void st_core_exit(struct st_data_s *); |
118 | 118 | ||
119 | /* ask for reference from KIM */ | 119 | /* ask for reference from KIM */ |
120 | void st_kim_ref(struct st_data_s **); | 120 | void st_kim_ref(struct st_data_s **, int); |
121 | 121 | ||
122 | #define GPS_STUB_TEST | 122 | #define GPS_STUB_TEST |
123 | #ifdef GPS_STUB_TEST | 123 | #ifdef GPS_STUB_TEST |
diff --git a/drivers/staging/ti-st/st_kim.c b/drivers/staging/ti-st/st_kim.c index b4a6c7fdc4e6..9e99463f76e8 100644 --- a/drivers/staging/ti-st/st_kim.c +++ b/drivers/staging/ti-st/st_kim.c | |||
@@ -72,11 +72,26 @@ const unsigned char *protocol_names[] = { | |||
72 | PROTO_ENTRY(ST_GPS, "GPS"), | 72 | PROTO_ENTRY(ST_GPS, "GPS"), |
73 | }; | 73 | }; |
74 | 74 | ||
75 | #define MAX_ST_DEVICES 3 /* Imagine 1 on each UART for now */ | ||
76 | struct platform_device *st_kim_devices[MAX_ST_DEVICES]; | ||
75 | 77 | ||
76 | /**********************************************************************/ | 78 | /**********************************************************************/ |
77 | /* internal functions */ | 79 | /* internal functions */ |
78 | 80 | ||
79 | /** | 81 | /** |
82 | * st_get_plat_device - | ||
83 | * function which returns the reference to the platform device | ||
84 | * requested by id. As of now only 1 such device exists (id=0) | ||
85 | * the context requesting for reference can get the id to be | ||
86 | * requested by a. The protocol driver which is registering or | ||
87 | * b. the tty device which is opened. | ||
88 | */ | ||
89 | static struct platform_device *st_get_plat_device(int id) | ||
90 | { | ||
91 | return st_kim_devices[id]; | ||
92 | } | ||
93 | |||
94 | /** | ||
80 | * validate_firmware_response - | 95 | * validate_firmware_response - |
81 | * function to return whether the firmware response was proper | 96 | * function to return whether the firmware response was proper |
82 | * in case of error don't complete so that waiting for proper | 97 | * in case of error don't complete so that waiting for proper |
@@ -353,7 +368,7 @@ void st_kim_chip_toggle(enum proto_type type, enum kim_gpio_state state) | |||
353 | struct kim_data_s *kim_gdata; | 368 | struct kim_data_s *kim_gdata; |
354 | pr_info(" %s ", __func__); | 369 | pr_info(" %s ", __func__); |
355 | 370 | ||
356 | kim_pdev = st_get_plat_device(); | 371 | kim_pdev = st_get_plat_device(0); |
357 | kim_gdata = dev_get_drvdata(&kim_pdev->dev); | 372 | kim_gdata = dev_get_drvdata(&kim_pdev->dev); |
358 | 373 | ||
359 | if (kim_gdata->gpios[type] == -1) { | 374 | if (kim_gdata->gpios[type] == -1) { |
@@ -574,12 +589,12 @@ static int kim_toggle_radio(void *data, bool blocked) | |||
574 | * This would enable multiple such platform devices to exist | 589 | * This would enable multiple such platform devices to exist |
575 | * on a given platform | 590 | * on a given platform |
576 | */ | 591 | */ |
577 | void st_kim_ref(struct st_data_s **core_data) | 592 | void st_kim_ref(struct st_data_s **core_data, int id) |
578 | { | 593 | { |
579 | struct platform_device *pdev; | 594 | struct platform_device *pdev; |
580 | struct kim_data_s *kim_gdata; | 595 | struct kim_data_s *kim_gdata; |
581 | /* get kim_gdata reference from platform device */ | 596 | /* get kim_gdata reference from platform device */ |
582 | pdev = st_get_plat_device(); | 597 | pdev = st_get_plat_device(id); |
583 | kim_gdata = dev_get_drvdata(&pdev->dev); | 598 | kim_gdata = dev_get_drvdata(&pdev->dev); |
584 | *core_data = kim_gdata->core_data; | 599 | *core_data = kim_gdata->core_data; |
585 | } | 600 | } |
@@ -623,6 +638,7 @@ static int kim_probe(struct platform_device *pdev) | |||
623 | long *gpios = pdev->dev.platform_data; | 638 | long *gpios = pdev->dev.platform_data; |
624 | struct kim_data_s *kim_gdata; | 639 | struct kim_data_s *kim_gdata; |
625 | 640 | ||
641 | st_kim_devices[pdev->id] = pdev; | ||
626 | kim_gdata = kzalloc(sizeof(struct kim_data_s), GFP_ATOMIC); | 642 | kim_gdata = kzalloc(sizeof(struct kim_data_s), GFP_ATOMIC); |
627 | if (!kim_gdata) { | 643 | if (!kim_gdata) { |
628 | pr_err("no mem to allocate"); | 644 | pr_err("no mem to allocate"); |
diff --git a/drivers/staging/vt6655/wpactl.c b/drivers/staging/vt6655/wpactl.c index 0142338bcafe..4bdb8362de82 100644 --- a/drivers/staging/vt6655/wpactl.c +++ b/drivers/staging/vt6655/wpactl.c | |||
@@ -766,9 +766,14 @@ static int wpa_set_associate(PSDevice pDevice, | |||
766 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_ie_len = %d\n", param->u.wpa_associate.wpa_ie_len); | 766 | DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_ie_len = %d\n", param->u.wpa_associate.wpa_ie_len); |
767 | 767 | ||
768 | 768 | ||
769 | if (param->u.wpa_associate.wpa_ie && | 769 | if (param->u.wpa_associate.wpa_ie_len) { |
770 | copy_from_user(&abyWPAIE[0], param->u.wpa_associate.wpa_ie, param->u.wpa_associate.wpa_ie_len)) | 770 | if (!param->u.wpa_associate.wpa_ie) |
771 | return -EINVAL; | 771 | return -EINVAL; |
772 | if (param->u.wpa_associate.wpa_ie_len > sizeof(abyWPAIE)) | ||
773 | return -EINVAL; | ||
774 | if (copy_from_user(&abyWPAIE[0], param->u.wpa_associate.wpa_ie, param->u.wpa_associate.wpa_ie_len)) | ||
775 | return -EFAULT; | ||
776 | } | ||
772 | 777 | ||
773 | if (param->u.wpa_associate.mode == 1) | 778 | if (param->u.wpa_associate.mode == 1) |
774 | pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA; | 779 | pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA; |
diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig index 7e594449600e..9eed5b52d9de 100644 --- a/drivers/usb/core/Kconfig +++ b/drivers/usb/core/Kconfig | |||
@@ -91,12 +91,12 @@ config USB_DYNAMIC_MINORS | |||
91 | If you are unsure about this, say N here. | 91 | If you are unsure about this, say N here. |
92 | 92 | ||
93 | config USB_SUSPEND | 93 | config USB_SUSPEND |
94 | bool "USB runtime power management (suspend/resume and wakeup)" | 94 | bool "USB runtime power management (autosuspend) and wakeup" |
95 | depends on USB && PM_RUNTIME | 95 | depends on USB && PM_RUNTIME |
96 | help | 96 | help |
97 | If you say Y here, you can use driver calls or the sysfs | 97 | If you say Y here, you can use driver calls or the sysfs |
98 | "power/level" file to suspend or resume individual USB | 98 | "power/control" file to enable or disable autosuspend for |
99 | peripherals and to enable or disable autosuspend (see | 99 | individual USB peripherals (see |
100 | Documentation/usb/power-management.txt for more details). | 100 | Documentation/usb/power-management.txt for more details). |
101 | 101 | ||
102 | Also, USB "remote wakeup" signaling is supported, whereby some | 102 | Also, USB "remote wakeup" signaling is supported, whereby some |
diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c index f06f5dbc8cdc..1e6ccef2cf0c 100644 --- a/drivers/usb/core/file.c +++ b/drivers/usb/core/file.c | |||
@@ -159,9 +159,9 @@ void usb_major_cleanup(void) | |||
159 | int usb_register_dev(struct usb_interface *intf, | 159 | int usb_register_dev(struct usb_interface *intf, |
160 | struct usb_class_driver *class_driver) | 160 | struct usb_class_driver *class_driver) |
161 | { | 161 | { |
162 | int retval = -EINVAL; | 162 | int retval; |
163 | int minor_base = class_driver->minor_base; | 163 | int minor_base = class_driver->minor_base; |
164 | int minor = 0; | 164 | int minor; |
165 | char name[20]; | 165 | char name[20]; |
166 | char *temp; | 166 | char *temp; |
167 | 167 | ||
@@ -173,12 +173,17 @@ int usb_register_dev(struct usb_interface *intf, | |||
173 | */ | 173 | */ |
174 | minor_base = 0; | 174 | minor_base = 0; |
175 | #endif | 175 | #endif |
176 | intf->minor = -1; | ||
177 | |||
178 | dbg ("looking for a minor, starting at %d", minor_base); | ||
179 | 176 | ||
180 | if (class_driver->fops == NULL) | 177 | if (class_driver->fops == NULL) |
181 | goto exit; | 178 | return -EINVAL; |
179 | if (intf->minor >= 0) | ||
180 | return -EADDRINUSE; | ||
181 | |||
182 | retval = init_usb_class(); | ||
183 | if (retval) | ||
184 | return retval; | ||
185 | |||
186 | dev_dbg(&intf->dev, "looking for a minor, starting at %d", minor_base); | ||
182 | 187 | ||
183 | down_write(&minor_rwsem); | 188 | down_write(&minor_rwsem); |
184 | for (minor = minor_base; minor < MAX_USB_MINORS; ++minor) { | 189 | for (minor = minor_base; minor < MAX_USB_MINORS; ++minor) { |
@@ -186,20 +191,12 @@ int usb_register_dev(struct usb_interface *intf, | |||
186 | continue; | 191 | continue; |
187 | 192 | ||
188 | usb_minors[minor] = class_driver->fops; | 193 | usb_minors[minor] = class_driver->fops; |
189 | 194 | intf->minor = minor; | |
190 | retval = 0; | ||
191 | break; | 195 | break; |
192 | } | 196 | } |
193 | up_write(&minor_rwsem); | 197 | up_write(&minor_rwsem); |
194 | 198 | if (intf->minor < 0) | |
195 | if (retval) | 199 | return -EXFULL; |
196 | goto exit; | ||
197 | |||
198 | retval = init_usb_class(); | ||
199 | if (retval) | ||
200 | goto exit; | ||
201 | |||
202 | intf->minor = minor; | ||
203 | 200 | ||
204 | /* create a usb class device for this usb interface */ | 201 | /* create a usb class device for this usb interface */ |
205 | snprintf(name, sizeof(name), class_driver->name, minor - minor_base); | 202 | snprintf(name, sizeof(name), class_driver->name, minor - minor_base); |
@@ -213,11 +210,11 @@ int usb_register_dev(struct usb_interface *intf, | |||
213 | "%s", temp); | 210 | "%s", temp); |
214 | if (IS_ERR(intf->usb_dev)) { | 211 | if (IS_ERR(intf->usb_dev)) { |
215 | down_write(&minor_rwsem); | 212 | down_write(&minor_rwsem); |
216 | usb_minors[intf->minor] = NULL; | 213 | usb_minors[minor] = NULL; |
214 | intf->minor = -1; | ||
217 | up_write(&minor_rwsem); | 215 | up_write(&minor_rwsem); |
218 | retval = PTR_ERR(intf->usb_dev); | 216 | retval = PTR_ERR(intf->usb_dev); |
219 | } | 217 | } |
220 | exit: | ||
221 | return retval; | 218 | return retval; |
222 | } | 219 | } |
223 | EXPORT_SYMBOL_GPL(usb_register_dev); | 220 | EXPORT_SYMBOL_GPL(usb_register_dev); |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 844683e50383..9f0ce7de0e36 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -1802,6 +1802,7 @@ free_interfaces: | |||
1802 | intf->dev.groups = usb_interface_groups; | 1802 | intf->dev.groups = usb_interface_groups; |
1803 | intf->dev.dma_mask = dev->dev.dma_mask; | 1803 | intf->dev.dma_mask = dev->dev.dma_mask; |
1804 | INIT_WORK(&intf->reset_ws, __usb_queue_reset_device); | 1804 | INIT_WORK(&intf->reset_ws, __usb_queue_reset_device); |
1805 | intf->minor = -1; | ||
1805 | device_initialize(&intf->dev); | 1806 | device_initialize(&intf->dev); |
1806 | dev_set_name(&intf->dev, "%d-%s:%d.%d", | 1807 | dev_set_name(&intf->dev, "%d-%s:%d.%d", |
1807 | dev->bus->busnum, dev->devpath, | 1808 | dev->bus->busnum, dev->devpath, |
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index 58b72d741d93..a1e8d273103f 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
@@ -119,6 +119,11 @@ static int ehci_pci_setup(struct usb_hcd *hcd) | |||
119 | ehci->broken_periodic = 1; | 119 | ehci->broken_periodic = 1; |
120 | ehci_info(ehci, "using broken periodic workaround\n"); | 120 | ehci_info(ehci, "using broken periodic workaround\n"); |
121 | } | 121 | } |
122 | if (pdev->device == 0x0806 || pdev->device == 0x0811 | ||
123 | || pdev->device == 0x0829) { | ||
124 | ehci_info(ehci, "disable lpm for langwell/penwell\n"); | ||
125 | ehci->has_lpm = 0; | ||
126 | } | ||
122 | break; | 127 | break; |
123 | case PCI_VENDOR_ID_TDI: | 128 | case PCI_VENDOR_ID_TDI: |
124 | if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { | 129 | if (pdev->device == PCI_DEVICE_ID_TDI_EHCI) { |
diff --git a/drivers/usb/musb/cppi_dma.c b/drivers/usb/musb/cppi_dma.c index 59dc3d351b60..5ab5bb89bae3 100644 --- a/drivers/usb/musb/cppi_dma.c +++ b/drivers/usb/musb/cppi_dma.c | |||
@@ -322,6 +322,7 @@ cppi_channel_allocate(struct dma_controller *c, | |||
322 | index, transmit ? 'T' : 'R', cppi_ch); | 322 | index, transmit ? 'T' : 'R', cppi_ch); |
323 | cppi_ch->hw_ep = ep; | 323 | cppi_ch->hw_ep = ep; |
324 | cppi_ch->channel.status = MUSB_DMA_STATUS_FREE; | 324 | cppi_ch->channel.status = MUSB_DMA_STATUS_FREE; |
325 | cppi_ch->channel.max_len = 0x7fffffff; | ||
325 | 326 | ||
326 | DBG(4, "Allocate CPPI%d %cX\n", index, transmit ? 'T' : 'R'); | 327 | DBG(4, "Allocate CPPI%d %cX\n", index, transmit ? 'T' : 'R'); |
327 | return &cppi_ch->channel; | 328 | return &cppi_ch->channel; |
diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c index c79a5e30d437..9e8639d4e862 100644 --- a/drivers/usb/musb/musb_debugfs.c +++ b/drivers/usb/musb/musb_debugfs.c | |||
@@ -195,15 +195,14 @@ static const struct file_operations musb_regdump_fops = { | |||
195 | 195 | ||
196 | static int musb_test_mode_open(struct inode *inode, struct file *file) | 196 | static int musb_test_mode_open(struct inode *inode, struct file *file) |
197 | { | 197 | { |
198 | file->private_data = inode->i_private; | ||
199 | |||
200 | return single_open(file, musb_test_mode_show, inode->i_private); | 198 | return single_open(file, musb_test_mode_show, inode->i_private); |
201 | } | 199 | } |
202 | 200 | ||
203 | static ssize_t musb_test_mode_write(struct file *file, | 201 | static ssize_t musb_test_mode_write(struct file *file, |
204 | const char __user *ubuf, size_t count, loff_t *ppos) | 202 | const char __user *ubuf, size_t count, loff_t *ppos) |
205 | { | 203 | { |
206 | struct musb *musb = file->private_data; | 204 | struct seq_file *s = file->private_data; |
205 | struct musb *musb = s->private; | ||
207 | u8 test = 0; | 206 | u8 test = 0; |
208 | char buf[18]; | 207 | char buf[18]; |
209 | 208 | ||
diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 6fca870e957e..d065e23f123e 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c | |||
@@ -300,6 +300,11 @@ static void txstate(struct musb *musb, struct musb_request *req) | |||
300 | #ifndef CONFIG_MUSB_PIO_ONLY | 300 | #ifndef CONFIG_MUSB_PIO_ONLY |
301 | if (is_dma_capable() && musb_ep->dma) { | 301 | if (is_dma_capable() && musb_ep->dma) { |
302 | struct dma_controller *c = musb->dma_controller; | 302 | struct dma_controller *c = musb->dma_controller; |
303 | size_t request_size; | ||
304 | |||
305 | /* setup DMA, then program endpoint CSR */ | ||
306 | request_size = min_t(size_t, request->length - request->actual, | ||
307 | musb_ep->dma->max_len); | ||
303 | 308 | ||
304 | use_dma = (request->dma != DMA_ADDR_INVALID); | 309 | use_dma = (request->dma != DMA_ADDR_INVALID); |
305 | 310 | ||
@@ -307,11 +312,6 @@ static void txstate(struct musb *musb, struct musb_request *req) | |||
307 | 312 | ||
308 | #ifdef CONFIG_USB_INVENTRA_DMA | 313 | #ifdef CONFIG_USB_INVENTRA_DMA |
309 | { | 314 | { |
310 | size_t request_size; | ||
311 | |||
312 | /* setup DMA, then program endpoint CSR */ | ||
313 | request_size = min_t(size_t, request->length, | ||
314 | musb_ep->dma->max_len); | ||
315 | if (request_size < musb_ep->packet_sz) | 315 | if (request_size < musb_ep->packet_sz) |
316 | musb_ep->dma->desired_mode = 0; | 316 | musb_ep->dma->desired_mode = 0; |
317 | else | 317 | else |
@@ -373,8 +373,8 @@ static void txstate(struct musb *musb, struct musb_request *req) | |||
373 | use_dma = use_dma && c->channel_program( | 373 | use_dma = use_dma && c->channel_program( |
374 | musb_ep->dma, musb_ep->packet_sz, | 374 | musb_ep->dma, musb_ep->packet_sz, |
375 | 0, | 375 | 0, |
376 | request->dma, | 376 | request->dma + request->actual, |
377 | request->length); | 377 | request_size); |
378 | if (!use_dma) { | 378 | if (!use_dma) { |
379 | c->channel_release(musb_ep->dma); | 379 | c->channel_release(musb_ep->dma); |
380 | musb_ep->dma = NULL; | 380 | musb_ep->dma = NULL; |
@@ -386,8 +386,8 @@ static void txstate(struct musb *musb, struct musb_request *req) | |||
386 | use_dma = use_dma && c->channel_program( | 386 | use_dma = use_dma && c->channel_program( |
387 | musb_ep->dma, musb_ep->packet_sz, | 387 | musb_ep->dma, musb_ep->packet_sz, |
388 | request->zero, | 388 | request->zero, |
389 | request->dma, | 389 | request->dma + request->actual, |
390 | request->length); | 390 | request_size); |
391 | #endif | 391 | #endif |
392 | } | 392 | } |
393 | #endif | 393 | #endif |
@@ -501,26 +501,14 @@ void musb_g_tx(struct musb *musb, u8 epnum) | |||
501 | request->zero = 0; | 501 | request->zero = 0; |
502 | } | 502 | } |
503 | 503 | ||
504 | /* ... or if not, then complete it. */ | 504 | if (request->actual == request->length) { |
505 | musb_g_giveback(musb_ep, request, 0); | 505 | musb_g_giveback(musb_ep, request, 0); |
506 | 506 | request = musb_ep->desc ? next_request(musb_ep) : NULL; | |
507 | /* | 507 | if (!request) { |
508 | * Kickstart next transfer if appropriate; | 508 | DBG(4, "%s idle now\n", |
509 | * the packet that just completed might not | 509 | musb_ep->end_point.name); |
510 | * be transmitted for hours or days. | 510 | return; |
511 | * REVISIT for double buffering... | 511 | } |
512 | * FIXME revisit for stalls too... | ||
513 | */ | ||
514 | musb_ep_select(mbase, epnum); | ||
515 | csr = musb_readw(epio, MUSB_TXCSR); | ||
516 | if (csr & MUSB_TXCSR_FIFONOTEMPTY) | ||
517 | return; | ||
518 | |||
519 | request = musb_ep->desc ? next_request(musb_ep) : NULL; | ||
520 | if (!request) { | ||
521 | DBG(4, "%s idle now\n", | ||
522 | musb_ep->end_point.name); | ||
523 | return; | ||
524 | } | 512 | } |
525 | } | 513 | } |
526 | 514 | ||
@@ -568,11 +556,19 @@ static void rxstate(struct musb *musb, struct musb_request *req) | |||
568 | { | 556 | { |
569 | const u8 epnum = req->epnum; | 557 | const u8 epnum = req->epnum; |
570 | struct usb_request *request = &req->request; | 558 | struct usb_request *request = &req->request; |
571 | struct musb_ep *musb_ep = &musb->endpoints[epnum].ep_out; | 559 | struct musb_ep *musb_ep; |
572 | void __iomem *epio = musb->endpoints[epnum].regs; | 560 | void __iomem *epio = musb->endpoints[epnum].regs; |
573 | unsigned fifo_count = 0; | 561 | unsigned fifo_count = 0; |
574 | u16 len = musb_ep->packet_sz; | 562 | u16 len; |
575 | u16 csr = musb_readw(epio, MUSB_RXCSR); | 563 | u16 csr = musb_readw(epio, MUSB_RXCSR); |
564 | struct musb_hw_ep *hw_ep = &musb->endpoints[epnum]; | ||
565 | |||
566 | if (hw_ep->is_shared_fifo) | ||
567 | musb_ep = &hw_ep->ep_in; | ||
568 | else | ||
569 | musb_ep = &hw_ep->ep_out; | ||
570 | |||
571 | len = musb_ep->packet_sz; | ||
576 | 572 | ||
577 | /* We shouldn't get here while DMA is active, but we do... */ | 573 | /* We shouldn't get here while DMA is active, but we do... */ |
578 | if (dma_channel_status(musb_ep->dma) == MUSB_DMA_STATUS_BUSY) { | 574 | if (dma_channel_status(musb_ep->dma) == MUSB_DMA_STATUS_BUSY) { |
@@ -647,8 +643,8 @@ static void rxstate(struct musb *musb, struct musb_request *req) | |||
647 | */ | 643 | */ |
648 | 644 | ||
649 | csr |= MUSB_RXCSR_DMAENAB; | 645 | csr |= MUSB_RXCSR_DMAENAB; |
650 | #ifdef USE_MODE1 | ||
651 | csr |= MUSB_RXCSR_AUTOCLEAR; | 646 | csr |= MUSB_RXCSR_AUTOCLEAR; |
647 | #ifdef USE_MODE1 | ||
652 | /* csr |= MUSB_RXCSR_DMAMODE; */ | 648 | /* csr |= MUSB_RXCSR_DMAMODE; */ |
653 | 649 | ||
654 | /* this special sequence (enabling and then | 650 | /* this special sequence (enabling and then |
@@ -663,10 +659,11 @@ static void rxstate(struct musb *musb, struct musb_request *req) | |||
663 | if (request->actual < request->length) { | 659 | if (request->actual < request->length) { |
664 | int transfer_size = 0; | 660 | int transfer_size = 0; |
665 | #ifdef USE_MODE1 | 661 | #ifdef USE_MODE1 |
666 | transfer_size = min(request->length, | 662 | transfer_size = min(request->length - request->actual, |
667 | channel->max_len); | 663 | channel->max_len); |
668 | #else | 664 | #else |
669 | transfer_size = len; | 665 | transfer_size = min(request->length - request->actual, |
666 | (unsigned)len); | ||
670 | #endif | 667 | #endif |
671 | if (transfer_size <= musb_ep->packet_sz) | 668 | if (transfer_size <= musb_ep->packet_sz) |
672 | musb_ep->dma->desired_mode = 0; | 669 | musb_ep->dma->desired_mode = 0; |
@@ -740,9 +737,15 @@ void musb_g_rx(struct musb *musb, u8 epnum) | |||
740 | u16 csr; | 737 | u16 csr; |
741 | struct usb_request *request; | 738 | struct usb_request *request; |
742 | void __iomem *mbase = musb->mregs; | 739 | void __iomem *mbase = musb->mregs; |
743 | struct musb_ep *musb_ep = &musb->endpoints[epnum].ep_out; | 740 | struct musb_ep *musb_ep; |
744 | void __iomem *epio = musb->endpoints[epnum].regs; | 741 | void __iomem *epio = musb->endpoints[epnum].regs; |
745 | struct dma_channel *dma; | 742 | struct dma_channel *dma; |
743 | struct musb_hw_ep *hw_ep = &musb->endpoints[epnum]; | ||
744 | |||
745 | if (hw_ep->is_shared_fifo) | ||
746 | musb_ep = &hw_ep->ep_in; | ||
747 | else | ||
748 | musb_ep = &hw_ep->ep_out; | ||
746 | 749 | ||
747 | musb_ep_select(mbase, epnum); | 750 | musb_ep_select(mbase, epnum); |
748 | 751 | ||
@@ -1081,7 +1084,7 @@ struct free_record { | |||
1081 | /* | 1084 | /* |
1082 | * Context: controller locked, IRQs blocked. | 1085 | * Context: controller locked, IRQs blocked. |
1083 | */ | 1086 | */ |
1084 | static void musb_ep_restart(struct musb *musb, struct musb_request *req) | 1087 | void musb_ep_restart(struct musb *musb, struct musb_request *req) |
1085 | { | 1088 | { |
1086 | DBG(3, "<== %s request %p len %u on hw_ep%d\n", | 1089 | DBG(3, "<== %s request %p len %u on hw_ep%d\n", |
1087 | req->tx ? "TX/IN" : "RX/OUT", | 1090 | req->tx ? "TX/IN" : "RX/OUT", |
diff --git a/drivers/usb/musb/musb_gadget.h b/drivers/usb/musb/musb_gadget.h index c8b140325d82..572b1da7f2dc 100644 --- a/drivers/usb/musb/musb_gadget.h +++ b/drivers/usb/musb/musb_gadget.h | |||
@@ -105,4 +105,6 @@ extern void musb_gadget_cleanup(struct musb *); | |||
105 | 105 | ||
106 | extern void musb_g_giveback(struct musb_ep *, struct usb_request *, int); | 106 | extern void musb_g_giveback(struct musb_ep *, struct usb_request *, int); |
107 | 107 | ||
108 | extern void musb_ep_restart(struct musb *, struct musb_request *); | ||
109 | |||
108 | #endif /* __MUSB_GADGET_H */ | 110 | #endif /* __MUSB_GADGET_H */ |
diff --git a/drivers/usb/musb/musb_gadget_ep0.c b/drivers/usb/musb/musb_gadget_ep0.c index 59bef8f3a358..6dd03f4c5f49 100644 --- a/drivers/usb/musb/musb_gadget_ep0.c +++ b/drivers/usb/musb/musb_gadget_ep0.c | |||
@@ -261,6 +261,7 @@ __acquires(musb->lock) | |||
261 | ctrlrequest->wIndex & 0x0f; | 261 | ctrlrequest->wIndex & 0x0f; |
262 | struct musb_ep *musb_ep; | 262 | struct musb_ep *musb_ep; |
263 | struct musb_hw_ep *ep; | 263 | struct musb_hw_ep *ep; |
264 | struct musb_request *request; | ||
264 | void __iomem *regs; | 265 | void __iomem *regs; |
265 | int is_in; | 266 | int is_in; |
266 | u16 csr; | 267 | u16 csr; |
@@ -302,6 +303,14 @@ __acquires(musb->lock) | |||
302 | musb_writew(regs, MUSB_RXCSR, csr); | 303 | musb_writew(regs, MUSB_RXCSR, csr); |
303 | } | 304 | } |
304 | 305 | ||
306 | /* Maybe start the first request in the queue */ | ||
307 | request = to_musb_request( | ||
308 | next_request(musb_ep)); | ||
309 | if (!musb_ep->busy && request) { | ||
310 | DBG(3, "restarting the request\n"); | ||
311 | musb_ep_restart(musb, request); | ||
312 | } | ||
313 | |||
305 | /* select ep0 again */ | 314 | /* select ep0 again */ |
306 | musb_ep_select(mbase, 0); | 315 | musb_ep_select(mbase, 0); |
307 | } break; | 316 | } break; |
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index 877d20b1dff9..9e65c47cc98b 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c | |||
@@ -660,6 +660,12 @@ static bool musb_tx_dma_program(struct dma_controller *dma, | |||
660 | 660 | ||
661 | qh->segsize = length; | 661 | qh->segsize = length; |
662 | 662 | ||
663 | /* | ||
664 | * Ensure the data reaches to main memory before starting | ||
665 | * DMA transfer | ||
666 | */ | ||
667 | wmb(); | ||
668 | |||
663 | if (!dma->channel_program(channel, pkt_size, mode, | 669 | if (!dma->channel_program(channel, pkt_size, mode, |
664 | urb->transfer_dma + offset, length)) { | 670 | urb->transfer_dma + offset, length)) { |
665 | dma->channel_release(channel); | 671 | dma->channel_release(channel); |
diff --git a/drivers/usb/otg/twl4030-usb.c b/drivers/usb/otg/twl4030-usb.c index 05aaac1c3861..0bc97698af15 100644 --- a/drivers/usb/otg/twl4030-usb.c +++ b/drivers/usb/otg/twl4030-usb.c | |||
@@ -347,11 +347,20 @@ static void twl4030_i2c_access(struct twl4030_usb *twl, int on) | |||
347 | } | 347 | } |
348 | } | 348 | } |
349 | 349 | ||
350 | static void twl4030_phy_power(struct twl4030_usb *twl, int on) | 350 | static void __twl4030_phy_power(struct twl4030_usb *twl, int on) |
351 | { | 351 | { |
352 | u8 pwr; | 352 | u8 pwr = twl4030_usb_read(twl, PHY_PWR_CTRL); |
353 | |||
354 | if (on) | ||
355 | pwr &= ~PHY_PWR_PHYPWD; | ||
356 | else | ||
357 | pwr |= PHY_PWR_PHYPWD; | ||
353 | 358 | ||
354 | pwr = twl4030_usb_read(twl, PHY_PWR_CTRL); | 359 | WARN_ON(twl4030_usb_write_verify(twl, PHY_PWR_CTRL, pwr) < 0); |
360 | } | ||
361 | |||
362 | static void twl4030_phy_power(struct twl4030_usb *twl, int on) | ||
363 | { | ||
355 | if (on) { | 364 | if (on) { |
356 | regulator_enable(twl->usb3v1); | 365 | regulator_enable(twl->usb3v1); |
357 | regulator_enable(twl->usb1v8); | 366 | regulator_enable(twl->usb1v8); |
@@ -365,15 +374,13 @@ static void twl4030_phy_power(struct twl4030_usb *twl, int on) | |||
365 | twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, | 374 | twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, |
366 | VUSB_DEDICATED2); | 375 | VUSB_DEDICATED2); |
367 | regulator_enable(twl->usb1v5); | 376 | regulator_enable(twl->usb1v5); |
368 | pwr &= ~PHY_PWR_PHYPWD; | 377 | __twl4030_phy_power(twl, 1); |
369 | WARN_ON(twl4030_usb_write_verify(twl, PHY_PWR_CTRL, pwr) < 0); | ||
370 | twl4030_usb_write(twl, PHY_CLK_CTRL, | 378 | twl4030_usb_write(twl, PHY_CLK_CTRL, |
371 | twl4030_usb_read(twl, PHY_CLK_CTRL) | | 379 | twl4030_usb_read(twl, PHY_CLK_CTRL) | |
372 | (PHY_CLK_CTRL_CLOCKGATING_EN | | 380 | (PHY_CLK_CTRL_CLOCKGATING_EN | |
373 | PHY_CLK_CTRL_CLK32K_EN)); | 381 | PHY_CLK_CTRL_CLK32K_EN)); |
374 | } else { | 382 | } else { |
375 | pwr |= PHY_PWR_PHYPWD; | 383 | __twl4030_phy_power(twl, 0); |
376 | WARN_ON(twl4030_usb_write_verify(twl, PHY_PWR_CTRL, pwr) < 0); | ||
377 | regulator_disable(twl->usb1v5); | 384 | regulator_disable(twl->usb1v5); |
378 | regulator_disable(twl->usb1v8); | 385 | regulator_disable(twl->usb1v8); |
379 | regulator_disable(twl->usb3v1); | 386 | regulator_disable(twl->usb3v1); |
@@ -387,19 +394,25 @@ static void twl4030_phy_suspend(struct twl4030_usb *twl, int controller_off) | |||
387 | 394 | ||
388 | twl4030_phy_power(twl, 0); | 395 | twl4030_phy_power(twl, 0); |
389 | twl->asleep = 1; | 396 | twl->asleep = 1; |
397 | dev_dbg(twl->dev, "%s\n", __func__); | ||
390 | } | 398 | } |
391 | 399 | ||
392 | static void twl4030_phy_resume(struct twl4030_usb *twl) | 400 | static void __twl4030_phy_resume(struct twl4030_usb *twl) |
393 | { | 401 | { |
394 | if (!twl->asleep) | ||
395 | return; | ||
396 | |||
397 | twl4030_phy_power(twl, 1); | 402 | twl4030_phy_power(twl, 1); |
398 | twl4030_i2c_access(twl, 1); | 403 | twl4030_i2c_access(twl, 1); |
399 | twl4030_usb_set_mode(twl, twl->usb_mode); | 404 | twl4030_usb_set_mode(twl, twl->usb_mode); |
400 | if (twl->usb_mode == T2_USB_MODE_ULPI) | 405 | if (twl->usb_mode == T2_USB_MODE_ULPI) |
401 | twl4030_i2c_access(twl, 0); | 406 | twl4030_i2c_access(twl, 0); |
407 | } | ||
408 | |||
409 | static void twl4030_phy_resume(struct twl4030_usb *twl) | ||
410 | { | ||
411 | if (!twl->asleep) | ||
412 | return; | ||
413 | __twl4030_phy_resume(twl); | ||
402 | twl->asleep = 0; | 414 | twl->asleep = 0; |
415 | dev_dbg(twl->dev, "%s\n", __func__); | ||
403 | } | 416 | } |
404 | 417 | ||
405 | static int twl4030_usb_ldo_init(struct twl4030_usb *twl) | 418 | static int twl4030_usb_ldo_init(struct twl4030_usb *twl) |
@@ -408,8 +421,8 @@ static int twl4030_usb_ldo_init(struct twl4030_usb *twl) | |||
408 | twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0xC0, PROTECT_KEY); | 421 | twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0xC0, PROTECT_KEY); |
409 | twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0x0C, PROTECT_KEY); | 422 | twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0x0C, PROTECT_KEY); |
410 | 423 | ||
411 | /* put VUSB3V1 LDO in active state */ | 424 | /* Keep VUSB3V1 LDO in sleep state until VBUS/ID change detected*/ |
412 | twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB_DEDICATED2); | 425 | /*twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0, VUSB_DEDICATED2);*/ |
413 | 426 | ||
414 | /* input to VUSB3V1 LDO is from VBAT, not VBUS */ | 427 | /* input to VUSB3V1 LDO is from VBAT, not VBUS */ |
415 | twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x14, VUSB_DEDICATED1); | 428 | twl_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER, 0x14, VUSB_DEDICATED1); |
@@ -502,6 +515,26 @@ static irqreturn_t twl4030_usb_irq(int irq, void *_twl) | |||
502 | return IRQ_HANDLED; | 515 | return IRQ_HANDLED; |
503 | } | 516 | } |
504 | 517 | ||
518 | static void twl4030_usb_phy_init(struct twl4030_usb *twl) | ||
519 | { | ||
520 | int status; | ||
521 | |||
522 | status = twl4030_usb_linkstat(twl); | ||
523 | if (status >= 0) { | ||
524 | if (status == USB_EVENT_NONE) { | ||
525 | __twl4030_phy_power(twl, 0); | ||
526 | twl->asleep = 1; | ||
527 | } else { | ||
528 | __twl4030_phy_resume(twl); | ||
529 | twl->asleep = 0; | ||
530 | } | ||
531 | |||
532 | blocking_notifier_call_chain(&twl->otg.notifier, status, | ||
533 | twl->otg.gadget); | ||
534 | } | ||
535 | sysfs_notify(&twl->dev->kobj, NULL, "vbus"); | ||
536 | } | ||
537 | |||
505 | static int twl4030_set_suspend(struct otg_transceiver *x, int suspend) | 538 | static int twl4030_set_suspend(struct otg_transceiver *x, int suspend) |
506 | { | 539 | { |
507 | struct twl4030_usb *twl = xceiv_to_twl(x); | 540 | struct twl4030_usb *twl = xceiv_to_twl(x); |
@@ -550,7 +583,6 @@ static int __devinit twl4030_usb_probe(struct platform_device *pdev) | |||
550 | struct twl4030_usb_data *pdata = pdev->dev.platform_data; | 583 | struct twl4030_usb_data *pdata = pdev->dev.platform_data; |
551 | struct twl4030_usb *twl; | 584 | struct twl4030_usb *twl; |
552 | int status, err; | 585 | int status, err; |
553 | u8 pwr; | ||
554 | 586 | ||
555 | if (!pdata) { | 587 | if (!pdata) { |
556 | dev_dbg(&pdev->dev, "platform_data not available\n"); | 588 | dev_dbg(&pdev->dev, "platform_data not available\n"); |
@@ -569,10 +601,7 @@ static int __devinit twl4030_usb_probe(struct platform_device *pdev) | |||
569 | twl->otg.set_peripheral = twl4030_set_peripheral; | 601 | twl->otg.set_peripheral = twl4030_set_peripheral; |
570 | twl->otg.set_suspend = twl4030_set_suspend; | 602 | twl->otg.set_suspend = twl4030_set_suspend; |
571 | twl->usb_mode = pdata->usb_mode; | 603 | twl->usb_mode = pdata->usb_mode; |
572 | 604 | twl->asleep = 1; | |
573 | pwr = twl4030_usb_read(twl, PHY_PWR_CTRL); | ||
574 | |||
575 | twl->asleep = (pwr & PHY_PWR_PHYPWD); | ||
576 | 605 | ||
577 | /* init spinlock for workqueue */ | 606 | /* init spinlock for workqueue */ |
578 | spin_lock_init(&twl->lock); | 607 | spin_lock_init(&twl->lock); |
@@ -610,15 +639,10 @@ static int __devinit twl4030_usb_probe(struct platform_device *pdev) | |||
610 | return status; | 639 | return status; |
611 | } | 640 | } |
612 | 641 | ||
613 | /* The IRQ handler just handles changes from the previous states | 642 | /* Power down phy or make it work according to |
614 | * of the ID and VBUS pins ... in probe() we must initialize that | 643 | * current link state. |
615 | * previous state. The easy way: fake an IRQ. | ||
616 | * | ||
617 | * REVISIT: a real IRQ might have happened already, if PREEMPT is | ||
618 | * enabled. Else the IRQ may not yet be configured or enabled, | ||
619 | * because of scheduling delays. | ||
620 | */ | 644 | */ |
621 | twl4030_usb_irq(twl->irq, twl); | 645 | twl4030_usb_phy_init(twl); |
622 | 646 | ||
623 | dev_info(&pdev->dev, "Initialized TWL4030 USB module\n"); | 647 | dev_info(&pdev->dev, "Initialized TWL4030 USB module\n"); |
624 | return 0; | 648 | return 0; |
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index 30922a7e3347..aa665817a272 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c | |||
@@ -2024,6 +2024,9 @@ static int mos7720_ioctl(struct tty_struct *tty, struct file *file, | |||
2024 | 2024 | ||
2025 | case TIOCGICOUNT: | 2025 | case TIOCGICOUNT: |
2026 | cnow = mos7720_port->icount; | 2026 | cnow = mos7720_port->icount; |
2027 | |||
2028 | memset(&icount, 0, sizeof(struct serial_icounter_struct)); | ||
2029 | |||
2027 | icount.cts = cnow.cts; | 2030 | icount.cts = cnow.cts; |
2028 | icount.dsr = cnow.dsr; | 2031 | icount.dsr = cnow.dsr; |
2029 | icount.rng = cnow.rng; | 2032 | icount.rng = cnow.rng; |
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 1c9b6e9b2386..1a42bc213799 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -2285,6 +2285,9 @@ static int mos7840_ioctl(struct tty_struct *tty, struct file *file, | |||
2285 | case TIOCGICOUNT: | 2285 | case TIOCGICOUNT: |
2286 | cnow = mos7840_port->icount; | 2286 | cnow = mos7840_port->icount; |
2287 | smp_rmb(); | 2287 | smp_rmb(); |
2288 | |||
2289 | memset(&icount, 0, sizeof(struct serial_icounter_struct)); | ||
2290 | |||
2288 | icount.cts = cnow.cts; | 2291 | icount.cts = cnow.cts; |
2289 | icount.dsr = cnow.dsr; | 2292 | icount.dsr = cnow.dsr; |
2290 | icount.rng = cnow.rng; | 2293 | icount.rng = cnow.rng; |
diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c index 84f842331dfa..7ccc967831f0 100644 --- a/drivers/video/console/fbcon.c +++ b/drivers/video/console/fbcon.c | |||
@@ -3508,7 +3508,7 @@ static void fbcon_exit(void) | |||
3508 | softback_buf = 0UL; | 3508 | softback_buf = 0UL; |
3509 | 3509 | ||
3510 | for (i = 0; i < FB_MAX; i++) { | 3510 | for (i = 0; i < FB_MAX; i++) { |
3511 | int pending; | 3511 | int pending = 0; |
3512 | 3512 | ||
3513 | mapped = 0; | 3513 | mapped = 0; |
3514 | info = registered_fb[i]; | 3514 | info = registered_fb[i]; |
@@ -3516,7 +3516,8 @@ static void fbcon_exit(void) | |||
3516 | if (info == NULL) | 3516 | if (info == NULL) |
3517 | continue; | 3517 | continue; |
3518 | 3518 | ||
3519 | pending = cancel_work_sync(&info->queue); | 3519 | if (info->queue.func) |
3520 | pending = cancel_work_sync(&info->queue); | ||
3520 | DPRINTK("fbcon: %s pending work\n", (pending ? "canceled" : | 3521 | DPRINTK("fbcon: %s pending work\n", (pending ? "canceled" : |
3521 | "no")); | 3522 | "no")); |
3522 | 3523 | ||
diff --git a/drivers/video/efifb.c b/drivers/video/efifb.c index 815f84b07933..70477c2e4b61 100644 --- a/drivers/video/efifb.c +++ b/drivers/video/efifb.c | |||
@@ -13,7 +13,7 @@ | |||
13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
14 | #include <linux/screen_info.h> | 14 | #include <linux/screen_info.h> |
15 | #include <linux/dmi.h> | 15 | #include <linux/dmi.h> |
16 | 16 | #include <linux/pci.h> | |
17 | #include <video/vga.h> | 17 | #include <video/vga.h> |
18 | 18 | ||
19 | static struct fb_var_screeninfo efifb_defined __devinitdata = { | 19 | static struct fb_var_screeninfo efifb_defined __devinitdata = { |
@@ -39,17 +39,31 @@ enum { | |||
39 | M_I20, /* 20-Inch iMac */ | 39 | M_I20, /* 20-Inch iMac */ |
40 | M_I20_SR, /* 20-Inch iMac (Santa Rosa) */ | 40 | M_I20_SR, /* 20-Inch iMac (Santa Rosa) */ |
41 | M_I24, /* 24-Inch iMac */ | 41 | M_I24, /* 24-Inch iMac */ |
42 | M_I24_8_1, /* 24-Inch iMac, 8,1th gen */ | ||
43 | M_I24_10_1, /* 24-Inch iMac, 10,1th gen */ | ||
44 | M_I27_11_1, /* 27-Inch iMac, 11,1th gen */ | ||
42 | M_MINI, /* Mac Mini */ | 45 | M_MINI, /* Mac Mini */ |
46 | M_MINI_3_1, /* Mac Mini, 3,1th gen */ | ||
47 | M_MINI_4_1, /* Mac Mini, 4,1th gen */ | ||
43 | M_MB, /* MacBook */ | 48 | M_MB, /* MacBook */ |
44 | M_MB_2, /* MacBook, 2nd rev. */ | 49 | M_MB_2, /* MacBook, 2nd rev. */ |
45 | M_MB_3, /* MacBook, 3rd rev. */ | 50 | M_MB_3, /* MacBook, 3rd rev. */ |
51 | M_MB_5_1, /* MacBook, 5th rev. */ | ||
52 | M_MB_6_1, /* MacBook, 6th rev. */ | ||
53 | M_MB_7_1, /* MacBook, 7th rev. */ | ||
46 | M_MB_SR, /* MacBook, 2nd gen, (Santa Rosa) */ | 54 | M_MB_SR, /* MacBook, 2nd gen, (Santa Rosa) */ |
47 | M_MBA, /* MacBook Air */ | 55 | M_MBA, /* MacBook Air */ |
48 | M_MBP, /* MacBook Pro */ | 56 | M_MBP, /* MacBook Pro */ |
49 | M_MBP_2, /* MacBook Pro 2nd gen */ | 57 | M_MBP_2, /* MacBook Pro 2nd gen */ |
58 | M_MBP_2_2, /* MacBook Pro 2,2nd gen */ | ||
50 | M_MBP_SR, /* MacBook Pro (Santa Rosa) */ | 59 | M_MBP_SR, /* MacBook Pro (Santa Rosa) */ |
51 | M_MBP_4, /* MacBook Pro, 4th gen */ | 60 | M_MBP_4, /* MacBook Pro, 4th gen */ |
52 | M_MBP_5_1, /* MacBook Pro, 5,1th gen */ | 61 | M_MBP_5_1, /* MacBook Pro, 5,1th gen */ |
62 | M_MBP_5_2, /* MacBook Pro, 5,2th gen */ | ||
63 | M_MBP_5_3, /* MacBook Pro, 5,3rd gen */ | ||
64 | M_MBP_6_1, /* MacBook Pro, 6,1th gen */ | ||
65 | M_MBP_6_2, /* MacBook Pro, 6,2th gen */ | ||
66 | M_MBP_7_1, /* MacBook Pro, 7,1th gen */ | ||
53 | M_UNKNOWN /* placeholder */ | 67 | M_UNKNOWN /* placeholder */ |
54 | }; | 68 | }; |
55 | 69 | ||
@@ -64,14 +78,28 @@ static struct efifb_dmi_info { | |||
64 | [M_I20] = { "i20", 0x80010000, 1728 * 4, 1680, 1050 }, /* guess */ | 78 | [M_I20] = { "i20", 0x80010000, 1728 * 4, 1680, 1050 }, /* guess */ |
65 | [M_I20_SR] = { "imac7", 0x40010000, 1728 * 4, 1680, 1050 }, | 79 | [M_I20_SR] = { "imac7", 0x40010000, 1728 * 4, 1680, 1050 }, |
66 | [M_I24] = { "i24", 0x80010000, 2048 * 4, 1920, 1200 }, /* guess */ | 80 | [M_I24] = { "i24", 0x80010000, 2048 * 4, 1920, 1200 }, /* guess */ |
81 | [M_I24_8_1] = { "imac8", 0xc0060000, 2048 * 4, 1920, 1200 }, | ||
82 | [M_I24_10_1] = { "imac10", 0xc0010000, 2048 * 4, 1920, 1080 }, | ||
83 | [M_I27_11_1] = { "imac11", 0xc0010000, 2560 * 4, 2560, 1440 }, | ||
67 | [M_MINI]= { "mini", 0x80000000, 2048 * 4, 1024, 768 }, | 84 | [M_MINI]= { "mini", 0x80000000, 2048 * 4, 1024, 768 }, |
85 | [M_MINI_3_1] = { "mini31", 0x40010000, 1024 * 4, 1024, 768 }, | ||
86 | [M_MINI_4_1] = { "mini41", 0xc0010000, 2048 * 4, 1920, 1200 }, | ||
68 | [M_MB] = { "macbook", 0x80000000, 2048 * 4, 1280, 800 }, | 87 | [M_MB] = { "macbook", 0x80000000, 2048 * 4, 1280, 800 }, |
88 | [M_MB_5_1] = { "macbook51", 0x80010000, 2048 * 4, 1280, 800 }, | ||
89 | [M_MB_6_1] = { "macbook61", 0x80010000, 2048 * 4, 1280, 800 }, | ||
90 | [M_MB_7_1] = { "macbook71", 0x80010000, 2048 * 4, 1280, 800 }, | ||
69 | [M_MBA] = { "mba", 0x80000000, 2048 * 4, 1280, 800 }, | 91 | [M_MBA] = { "mba", 0x80000000, 2048 * 4, 1280, 800 }, |
70 | [M_MBP] = { "mbp", 0x80010000, 1472 * 4, 1440, 900 }, | 92 | [M_MBP] = { "mbp", 0x80010000, 1472 * 4, 1440, 900 }, |
71 | [M_MBP_2] = { "mbp2", 0, 0, 0, 0 }, /* placeholder */ | 93 | [M_MBP_2] = { "mbp2", 0, 0, 0, 0 }, /* placeholder */ |
94 | [M_MBP_2_2] = { "mbp22", 0x80010000, 1472 * 4, 1440, 900 }, | ||
72 | [M_MBP_SR] = { "mbp3", 0x80030000, 2048 * 4, 1440, 900 }, | 95 | [M_MBP_SR] = { "mbp3", 0x80030000, 2048 * 4, 1440, 900 }, |
73 | [M_MBP_4] = { "mbp4", 0xc0060000, 2048 * 4, 1920, 1200 }, | 96 | [M_MBP_4] = { "mbp4", 0xc0060000, 2048 * 4, 1920, 1200 }, |
74 | [M_MBP_5_1] = { "mbp51", 0xc0010000, 2048 * 4, 1440, 900 }, | 97 | [M_MBP_5_1] = { "mbp51", 0xc0010000, 2048 * 4, 1440, 900 }, |
98 | [M_MBP_5_2] = { "mbp52", 0xc0010000, 2048 * 4, 1920, 1200 }, | ||
99 | [M_MBP_5_3] = { "mbp53", 0xd0010000, 2048 * 4, 1440, 900 }, | ||
100 | [M_MBP_6_1] = { "mbp61", 0x90030000, 2048 * 4, 1920, 1200 }, | ||
101 | [M_MBP_6_2] = { "mbp62", 0x90030000, 2048 * 4, 1680, 1050 }, | ||
102 | [M_MBP_7_1] = { "mbp71", 0xc0010000, 2048 * 4, 1280, 800 }, | ||
75 | [M_UNKNOWN] = { NULL, 0, 0, 0, 0 } | 103 | [M_UNKNOWN] = { NULL, 0, 0, 0, 0 } |
76 | }; | 104 | }; |
77 | 105 | ||
@@ -92,7 +120,12 @@ static const struct dmi_system_id dmi_system_table[] __initconst = { | |||
92 | EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "iMac6,1", M_I24), | 120 | EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "iMac6,1", M_I24), |
93 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "iMac6,1", M_I24), | 121 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "iMac6,1", M_I24), |
94 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "iMac7,1", M_I20_SR), | 122 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "iMac7,1", M_I20_SR), |
123 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "iMac8,1", M_I24_8_1), | ||
124 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "iMac10,1", M_I24_10_1), | ||
125 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "iMac11,1", M_I27_11_1), | ||
95 | EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "Macmini1,1", M_MINI), | 126 | EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "Macmini1,1", M_MINI), |
127 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "Macmini3,1", M_MINI_3_1), | ||
128 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "Macmini4,1", M_MINI_4_1), | ||
96 | EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBook1,1", M_MB), | 129 | EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBook1,1", M_MB), |
97 | /* At least one of these two will be right; maybe both? */ | 130 | /* At least one of these two will be right; maybe both? */ |
98 | EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBook2,1", M_MB), | 131 | EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBook2,1", M_MB), |
@@ -101,14 +134,23 @@ static const struct dmi_system_id dmi_system_table[] __initconst = { | |||
101 | EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBook3,1", M_MB), | 134 | EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBook3,1", M_MB), |
102 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBook3,1", M_MB), | 135 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBook3,1", M_MB), |
103 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBook4,1", M_MB), | 136 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBook4,1", M_MB), |
137 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBook5,1", M_MB_5_1), | ||
138 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBook6,1", M_MB_6_1), | ||
139 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBook7,1", M_MB_7_1), | ||
104 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookAir1,1", M_MBA), | 140 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookAir1,1", M_MBA), |
105 | EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBookPro1,1", M_MBP), | 141 | EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBookPro1,1", M_MBP), |
106 | EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBookPro2,1", M_MBP_2), | 142 | EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBookPro2,1", M_MBP_2), |
143 | EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBookPro2,2", M_MBP_2_2), | ||
107 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro2,1", M_MBP_2), | 144 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro2,1", M_MBP_2), |
108 | EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBookPro3,1", M_MBP_SR), | 145 | EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBookPro3,1", M_MBP_SR), |
109 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro3,1", M_MBP_SR), | 146 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro3,1", M_MBP_SR), |
110 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro4,1", M_MBP_4), | 147 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro4,1", M_MBP_4), |
111 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro5,1", M_MBP_5_1), | 148 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro5,1", M_MBP_5_1), |
149 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro5,2", M_MBP_5_2), | ||
150 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro5,3", M_MBP_5_3), | ||
151 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro6,1", M_MBP_6_1), | ||
152 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro6,2", M_MBP_6_2), | ||
153 | EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro7,1", M_MBP_7_1), | ||
112 | {}, | 154 | {}, |
113 | }; | 155 | }; |
114 | 156 | ||
@@ -116,7 +158,7 @@ static int set_system(const struct dmi_system_id *id) | |||
116 | { | 158 | { |
117 | struct efifb_dmi_info *info = id->driver_data; | 159 | struct efifb_dmi_info *info = id->driver_data; |
118 | if (info->base == 0) | 160 | if (info->base == 0) |
119 | return -ENODEV; | 161 | return 0; |
120 | 162 | ||
121 | printk(KERN_INFO "efifb: dmi detected %s - framebuffer at %p " | 163 | printk(KERN_INFO "efifb: dmi detected %s - framebuffer at %p " |
122 | "(%dx%d, stride %d)\n", id->ident, | 164 | "(%dx%d, stride %d)\n", id->ident, |
@@ -124,18 +166,55 @@ static int set_system(const struct dmi_system_id *id) | |||
124 | info->stride); | 166 | info->stride); |
125 | 167 | ||
126 | /* Trust the bootloader over the DMI tables */ | 168 | /* Trust the bootloader over the DMI tables */ |
127 | if (screen_info.lfb_base == 0) | 169 | if (screen_info.lfb_base == 0) { |
170 | #if defined(CONFIG_PCI) | ||
171 | struct pci_dev *dev = NULL; | ||
172 | int found_bar = 0; | ||
173 | #endif | ||
128 | screen_info.lfb_base = info->base; | 174 | screen_info.lfb_base = info->base; |
129 | if (screen_info.lfb_linelength == 0) | ||
130 | screen_info.lfb_linelength = info->stride; | ||
131 | if (screen_info.lfb_width == 0) | ||
132 | screen_info.lfb_width = info->width; | ||
133 | if (screen_info.lfb_height == 0) | ||
134 | screen_info.lfb_height = info->height; | ||
135 | if (screen_info.orig_video_isVGA == 0) | ||
136 | screen_info.orig_video_isVGA = VIDEO_TYPE_EFI; | ||
137 | 175 | ||
138 | return 0; | 176 | #if defined(CONFIG_PCI) |
177 | /* make sure that the address in the table is actually on a | ||
178 | * VGA device's PCI BAR */ | ||
179 | |||
180 | for_each_pci_dev(dev) { | ||
181 | int i; | ||
182 | if ((dev->class >> 8) != PCI_CLASS_DISPLAY_VGA) | ||
183 | continue; | ||
184 | for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { | ||
185 | resource_size_t start, end; | ||
186 | |||
187 | start = pci_resource_start(dev, i); | ||
188 | if (start == 0) | ||
189 | break; | ||
190 | end = pci_resource_end(dev, i); | ||
191 | if (screen_info.lfb_base >= start && | ||
192 | screen_info.lfb_base < end) { | ||
193 | found_bar = 1; | ||
194 | } | ||
195 | } | ||
196 | } | ||
197 | if (!found_bar) | ||
198 | screen_info.lfb_base = 0; | ||
199 | #endif | ||
200 | } | ||
201 | if (screen_info.lfb_base) { | ||
202 | if (screen_info.lfb_linelength == 0) | ||
203 | screen_info.lfb_linelength = info->stride; | ||
204 | if (screen_info.lfb_width == 0) | ||
205 | screen_info.lfb_width = info->width; | ||
206 | if (screen_info.lfb_height == 0) | ||
207 | screen_info.lfb_height = info->height; | ||
208 | if (screen_info.orig_video_isVGA == 0) | ||
209 | screen_info.orig_video_isVGA = VIDEO_TYPE_EFI; | ||
210 | } else { | ||
211 | screen_info.lfb_linelength = 0; | ||
212 | screen_info.lfb_width = 0; | ||
213 | screen_info.lfb_height = 0; | ||
214 | screen_info.orig_video_isVGA = 0; | ||
215 | return 0; | ||
216 | } | ||
217 | return 1; | ||
139 | } | 218 | } |
140 | 219 | ||
141 | static int efifb_setcolreg(unsigned regno, unsigned red, unsigned green, | 220 | static int efifb_setcolreg(unsigned regno, unsigned red, unsigned green, |
diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c index 559bf1727a2b..b52f8e4ef1fd 100644 --- a/drivers/video/sis/sis_main.c +++ b/drivers/video/sis/sis_main.c | |||
@@ -1701,6 +1701,9 @@ static int sisfb_ioctl(struct fb_info *info, unsigned int cmd, | |||
1701 | break; | 1701 | break; |
1702 | 1702 | ||
1703 | case FBIOGET_VBLANK: | 1703 | case FBIOGET_VBLANK: |
1704 | |||
1705 | memset(&sisvbblank, 0, sizeof(struct fb_vblank)); | ||
1706 | |||
1704 | sisvbblank.count = 0; | 1707 | sisvbblank.count = 0; |
1705 | sisvbblank.flags = sisfb_setupvbblankflags(ivideo, &sisvbblank.vcount, &sisvbblank.hcount); | 1708 | sisvbblank.flags = sisfb_setupvbblankflags(ivideo, &sisvbblank.vcount, &sisvbblank.hcount); |
1706 | 1709 | ||
diff --git a/drivers/video/via/ioctl.c b/drivers/video/via/ioctl.c index da03c074e32a..4d553d0b8d7a 100644 --- a/drivers/video/via/ioctl.c +++ b/drivers/video/via/ioctl.c | |||
@@ -25,6 +25,8 @@ int viafb_ioctl_get_viafb_info(u_long arg) | |||
25 | { | 25 | { |
26 | struct viafb_ioctl_info viainfo; | 26 | struct viafb_ioctl_info viainfo; |
27 | 27 | ||
28 | memset(&viainfo, 0, sizeof(struct viafb_ioctl_info)); | ||
29 | |||
28 | viainfo.viafb_id = VIAID; | 30 | viainfo.viafb_id = VIAID; |
29 | viainfo.vendor_id = PCI_VIA_VENDOR_ID; | 31 | viainfo.vendor_id = PCI_VIA_VENDOR_ID; |
30 | 32 | ||
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index b036677df8c4..24efd8ea41bb 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig | |||
@@ -213,11 +213,11 @@ config OMAP_WATCHDOG | |||
213 | here to enable the OMAP1610/OMAP1710/OMAP2420/OMAP3430/OMAP4430 watchdog timer. | 213 | here to enable the OMAP1610/OMAP1710/OMAP2420/OMAP3430/OMAP4430 watchdog timer. |
214 | 214 | ||
215 | config PNX4008_WATCHDOG | 215 | config PNX4008_WATCHDOG |
216 | tristate "PNX4008 Watchdog" | 216 | tristate "PNX4008 and LPC32XX Watchdog" |
217 | depends on ARCH_PNX4008 | 217 | depends on ARCH_PNX4008 || ARCH_LPC32XX |
218 | help | 218 | help |
219 | Say Y here if to include support for the watchdog timer | 219 | Say Y here if to include support for the watchdog timer |
220 | in the PNX4008 processor. | 220 | in the PNX4008 or LPC32XX processor. |
221 | This driver can be built as a module by choosing M. The module | 221 | This driver can be built as a module by choosing M. The module |
222 | will be called pnx4008_wdt. | 222 | will be called pnx4008_wdt. |
223 | 223 | ||
diff --git a/drivers/watchdog/sb_wdog.c b/drivers/watchdog/sb_wdog.c index 88c83aa57303..f31493e65b38 100644 --- a/drivers/watchdog/sb_wdog.c +++ b/drivers/watchdog/sb_wdog.c | |||
@@ -305,7 +305,7 @@ static int __init sbwdog_init(void) | |||
305 | if (ret) { | 305 | if (ret) { |
306 | printk(KERN_ERR "%s: failed to request irq 1 - %d\n", | 306 | printk(KERN_ERR "%s: failed to request irq 1 - %d\n", |
307 | ident.identity, ret); | 307 | ident.identity, ret); |
308 | return ret; | 308 | goto out; |
309 | } | 309 | } |
310 | 310 | ||
311 | ret = misc_register(&sbwdog_miscdev); | 311 | ret = misc_register(&sbwdog_miscdev); |
@@ -313,14 +313,20 @@ static int __init sbwdog_init(void) | |||
313 | printk(KERN_INFO "%s: timeout is %ld.%ld secs\n", | 313 | printk(KERN_INFO "%s: timeout is %ld.%ld secs\n", |
314 | ident.identity, | 314 | ident.identity, |
315 | timeout / 1000000, (timeout / 100000) % 10); | 315 | timeout / 1000000, (timeout / 100000) % 10); |
316 | } else | 316 | return 0; |
317 | free_irq(1, (void *)user_dog); | 317 | } |
318 | free_irq(1, (void *)user_dog); | ||
319 | out: | ||
320 | unregister_reboot_notifier(&sbwdog_notifier); | ||
321 | |||
318 | return ret; | 322 | return ret; |
319 | } | 323 | } |
320 | 324 | ||
321 | static void __exit sbwdog_exit(void) | 325 | static void __exit sbwdog_exit(void) |
322 | { | 326 | { |
323 | misc_deregister(&sbwdog_miscdev); | 327 | misc_deregister(&sbwdog_miscdev); |
328 | free_irq(1, (void *)user_dog); | ||
329 | unregister_reboot_notifier(&sbwdog_notifier); | ||
324 | } | 330 | } |
325 | 331 | ||
326 | module_init(sbwdog_init); | 332 | module_init(sbwdog_init); |
diff --git a/drivers/watchdog/ts72xx_wdt.c b/drivers/watchdog/ts72xx_wdt.c index 458c499c1223..18cdeb4c4258 100644 --- a/drivers/watchdog/ts72xx_wdt.c +++ b/drivers/watchdog/ts72xx_wdt.c | |||
@@ -449,6 +449,9 @@ static __devinit int ts72xx_wdt_probe(struct platform_device *pdev) | |||
449 | wdt->pdev = pdev; | 449 | wdt->pdev = pdev; |
450 | mutex_init(&wdt->lock); | 450 | mutex_init(&wdt->lock); |
451 | 451 | ||
452 | /* make sure that the watchdog is disabled */ | ||
453 | ts72xx_wdt_stop(wdt); | ||
454 | |||
452 | error = misc_register(&ts72xx_wdt_miscdev); | 455 | error = misc_register(&ts72xx_wdt_miscdev); |
453 | if (error) { | 456 | if (error) { |
454 | dev_err(&pdev->dev, "failed to register miscdev\n"); | 457 | dev_err(&pdev->dev, "failed to register miscdev\n"); |
diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c index 16c8a2a98c1b..899f168fd19c 100644 --- a/fs/9p/vfs_dir.c +++ b/fs/9p/vfs_dir.c | |||
@@ -292,9 +292,11 @@ int v9fs_dir_release(struct inode *inode, struct file *filp) | |||
292 | 292 | ||
293 | fid = filp->private_data; | 293 | fid = filp->private_data; |
294 | P9_DPRINTK(P9_DEBUG_VFS, | 294 | P9_DPRINTK(P9_DEBUG_VFS, |
295 | "inode: %p filp: %p fid: %d\n", inode, filp, fid->fid); | 295 | "v9fs_dir_release: inode: %p filp: %p fid: %d\n", |
296 | inode, filp, fid ? fid->fid : -1); | ||
296 | filemap_write_and_wait(inode->i_mapping); | 297 | filemap_write_and_wait(inode->i_mapping); |
297 | p9_client_clunk(fid); | 298 | if (fid) |
299 | p9_client_clunk(fid); | ||
298 | return 0; | 300 | return 0; |
299 | } | 301 | } |
300 | 302 | ||
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index c7c23eab9440..9e670d527646 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c | |||
@@ -730,7 +730,10 @@ v9fs_vfs_create_dotl(struct inode *dir, struct dentry *dentry, int mode, | |||
730 | P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", err); | 730 | P9_DPRINTK(P9_DEBUG_VFS, "inode creation failed %d\n", err); |
731 | goto error; | 731 | goto error; |
732 | } | 732 | } |
733 | dentry->d_op = &v9fs_cached_dentry_operations; | 733 | if (v9ses->cache) |
734 | dentry->d_op = &v9fs_cached_dentry_operations; | ||
735 | else | ||
736 | dentry->d_op = &v9fs_dentry_operations; | ||
734 | d_instantiate(dentry, inode); | 737 | d_instantiate(dentry, inode); |
735 | err = v9fs_fid_add(dentry, fid); | 738 | err = v9fs_fid_add(dentry, fid); |
736 | if (err < 0) | 739 | if (err < 0) |
@@ -1128,6 +1131,7 @@ v9fs_vfs_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
1128 | v9fs_stat2inode(st, dentry->d_inode, dentry->d_inode->i_sb); | 1131 | v9fs_stat2inode(st, dentry->d_inode, dentry->d_inode->i_sb); |
1129 | generic_fillattr(dentry->d_inode, stat); | 1132 | generic_fillattr(dentry->d_inode, stat); |
1130 | 1133 | ||
1134 | p9stat_free(st); | ||
1131 | kfree(st); | 1135 | kfree(st); |
1132 | return 0; | 1136 | return 0; |
1133 | } | 1137 | } |
@@ -1489,6 +1493,7 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen) | |||
1489 | 1493 | ||
1490 | retval = strnlen(buffer, buflen); | 1494 | retval = strnlen(buffer, buflen); |
1491 | done: | 1495 | done: |
1496 | p9stat_free(st); | ||
1492 | kfree(st); | 1497 | kfree(st); |
1493 | return retval; | 1498 | return retval; |
1494 | } | 1499 | } |
@@ -1942,7 +1947,7 @@ static const struct inode_operations v9fs_dir_inode_operations_dotu = { | |||
1942 | .unlink = v9fs_vfs_unlink, | 1947 | .unlink = v9fs_vfs_unlink, |
1943 | .mkdir = v9fs_vfs_mkdir, | 1948 | .mkdir = v9fs_vfs_mkdir, |
1944 | .rmdir = v9fs_vfs_rmdir, | 1949 | .rmdir = v9fs_vfs_rmdir, |
1945 | .mknod = v9fs_vfs_mknod_dotl, | 1950 | .mknod = v9fs_vfs_mknod, |
1946 | .rename = v9fs_vfs_rename, | 1951 | .rename = v9fs_vfs_rename, |
1947 | .getattr = v9fs_vfs_getattr, | 1952 | .getattr = v9fs_vfs_getattr, |
1948 | .setattr = v9fs_vfs_setattr, | 1953 | .setattr = v9fs_vfs_setattr, |
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index f9311077de68..1d12ba0ed3db 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c | |||
@@ -122,6 +122,10 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags, | |||
122 | fid = v9fs_session_init(v9ses, dev_name, data); | 122 | fid = v9fs_session_init(v9ses, dev_name, data); |
123 | if (IS_ERR(fid)) { | 123 | if (IS_ERR(fid)) { |
124 | retval = PTR_ERR(fid); | 124 | retval = PTR_ERR(fid); |
125 | /* | ||
126 | * we need to call session_close to tear down some | ||
127 | * of the data structure setup by session_init | ||
128 | */ | ||
125 | goto close_session; | 129 | goto close_session; |
126 | } | 130 | } |
127 | 131 | ||
@@ -144,7 +148,6 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags, | |||
144 | retval = -ENOMEM; | 148 | retval = -ENOMEM; |
145 | goto release_sb; | 149 | goto release_sb; |
146 | } | 150 | } |
147 | |||
148 | sb->s_root = root; | 151 | sb->s_root = root; |
149 | 152 | ||
150 | if (v9fs_proto_dotl(v9ses)) { | 153 | if (v9fs_proto_dotl(v9ses)) { |
@@ -152,7 +155,7 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags, | |||
152 | st = p9_client_getattr_dotl(fid, P9_STATS_BASIC); | 155 | st = p9_client_getattr_dotl(fid, P9_STATS_BASIC); |
153 | if (IS_ERR(st)) { | 156 | if (IS_ERR(st)) { |
154 | retval = PTR_ERR(st); | 157 | retval = PTR_ERR(st); |
155 | goto clunk_fid; | 158 | goto release_sb; |
156 | } | 159 | } |
157 | 160 | ||
158 | v9fs_stat2inode_dotl(st, root->d_inode); | 161 | v9fs_stat2inode_dotl(st, root->d_inode); |
@@ -162,7 +165,7 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags, | |||
162 | st = p9_client_stat(fid); | 165 | st = p9_client_stat(fid); |
163 | if (IS_ERR(st)) { | 166 | if (IS_ERR(st)) { |
164 | retval = PTR_ERR(st); | 167 | retval = PTR_ERR(st); |
165 | goto clunk_fid; | 168 | goto release_sb; |
166 | } | 169 | } |
167 | 170 | ||
168 | root->d_inode->i_ino = v9fs_qid2ino(&st->qid); | 171 | root->d_inode->i_ino = v9fs_qid2ino(&st->qid); |
@@ -174,19 +177,24 @@ static int v9fs_get_sb(struct file_system_type *fs_type, int flags, | |||
174 | 177 | ||
175 | v9fs_fid_add(root, fid); | 178 | v9fs_fid_add(root, fid); |
176 | 179 | ||
177 | P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n"); | 180 | P9_DPRINTK(P9_DEBUG_VFS, " simple set mount, return 0\n"); |
178 | simple_set_mnt(mnt, sb); | 181 | simple_set_mnt(mnt, sb); |
179 | return 0; | 182 | return 0; |
180 | 183 | ||
181 | clunk_fid: | 184 | clunk_fid: |
182 | p9_client_clunk(fid); | 185 | p9_client_clunk(fid); |
183 | |||
184 | close_session: | 186 | close_session: |
185 | v9fs_session_close(v9ses); | 187 | v9fs_session_close(v9ses); |
186 | kfree(v9ses); | 188 | kfree(v9ses); |
187 | return retval; | 189 | return retval; |
188 | |||
189 | release_sb: | 190 | release_sb: |
191 | /* | ||
192 | * we will do the session_close and root dentry release | ||
193 | * in the below call. But we need to clunk fid, because we haven't | ||
194 | * attached the fid to dentry so it won't get clunked | ||
195 | * automatically. | ||
196 | */ | ||
197 | p9_client_clunk(fid); | ||
190 | deactivate_locked_super(sb); | 198 | deactivate_locked_super(sb); |
191 | return retval; | 199 | return retval; |
192 | } | 200 | } |
@@ -712,8 +712,16 @@ static ssize_t aio_run_iocb(struct kiocb *iocb) | |||
712 | */ | 712 | */ |
713 | ret = retry(iocb); | 713 | ret = retry(iocb); |
714 | 714 | ||
715 | if (ret != -EIOCBRETRY && ret != -EIOCBQUEUED) | 715 | if (ret != -EIOCBRETRY && ret != -EIOCBQUEUED) { |
716 | /* | ||
717 | * There's no easy way to restart the syscall since other AIO's | ||
718 | * may be already running. Just fail this IO with EINTR. | ||
719 | */ | ||
720 | if (unlikely(ret == -ERESTARTSYS || ret == -ERESTARTNOINTR || | ||
721 | ret == -ERESTARTNOHAND || ret == -ERESTART_RESTARTBLOCK)) | ||
722 | ret = -EINTR; | ||
716 | aio_complete(iocb, ret, 0); | 723 | aio_complete(iocb, ret, 0); |
724 | } | ||
717 | out: | 725 | out: |
718 | spin_lock_irq(&ctx->ctx_lock); | 726 | spin_lock_irq(&ctx->ctx_lock); |
719 | 727 | ||
@@ -1659,6 +1667,9 @@ long do_io_submit(aio_context_t ctx_id, long nr, | |||
1659 | if (unlikely(nr < 0)) | 1667 | if (unlikely(nr < 0)) |
1660 | return -EINVAL; | 1668 | return -EINVAL; |
1661 | 1669 | ||
1670 | if (unlikely(nr > LONG_MAX/sizeof(*iocbpp))) | ||
1671 | nr = LONG_MAX/sizeof(*iocbpp); | ||
1672 | |||
1662 | if (unlikely(!access_ok(VERIFY_READ, iocbpp, (nr*sizeof(*iocbpp))))) | 1673 | if (unlikely(!access_ok(VERIFY_READ, iocbpp, (nr*sizeof(*iocbpp))))) |
1663 | return -EFAULT; | 1674 | return -EFAULT; |
1664 | 1675 | ||
diff --git a/fs/ceph/Kconfig b/fs/ceph/Kconfig index bc87b9c1d27e..0fcd2640c23f 100644 --- a/fs/ceph/Kconfig +++ b/fs/ceph/Kconfig | |||
@@ -3,6 +3,7 @@ config CEPH_FS | |||
3 | depends on INET && EXPERIMENTAL | 3 | depends on INET && EXPERIMENTAL |
4 | select LIBCRC32C | 4 | select LIBCRC32C |
5 | select CRYPTO_AES | 5 | select CRYPTO_AES |
6 | select CRYPTO | ||
6 | help | 7 | help |
7 | Choose Y or M here to include support for mounting the | 8 | Choose Y or M here to include support for mounting the |
8 | experimental Ceph distributed file system. Ceph is an extremely | 9 | experimental Ceph distributed file system. Ceph is an extremely |
diff --git a/fs/ceph/addr.c b/fs/ceph/addr.c index 4cfce1ee31fa..efbc604001c8 100644 --- a/fs/ceph/addr.c +++ b/fs/ceph/addr.c | |||
@@ -411,8 +411,8 @@ static int writepage_nounlock(struct page *page, struct writeback_control *wbc) | |||
411 | if (i_size < page_off + len) | 411 | if (i_size < page_off + len) |
412 | len = i_size - page_off; | 412 | len = i_size - page_off; |
413 | 413 | ||
414 | dout("writepage %p page %p index %lu on %llu~%u\n", | 414 | dout("writepage %p page %p index %lu on %llu~%u snapc %p\n", |
415 | inode, page, page->index, page_off, len); | 415 | inode, page, page->index, page_off, len, snapc); |
416 | 416 | ||
417 | writeback_stat = atomic_long_inc_return(&client->writeback_count); | 417 | writeback_stat = atomic_long_inc_return(&client->writeback_count); |
418 | if (writeback_stat > | 418 | if (writeback_stat > |
@@ -766,7 +766,8 @@ get_more_pages: | |||
766 | /* ok */ | 766 | /* ok */ |
767 | if (locked_pages == 0) { | 767 | if (locked_pages == 0) { |
768 | /* prepare async write request */ | 768 | /* prepare async write request */ |
769 | offset = page->index << PAGE_CACHE_SHIFT; | 769 | offset = (unsigned long long)page->index |
770 | << PAGE_CACHE_SHIFT; | ||
770 | len = wsize; | 771 | len = wsize; |
771 | req = ceph_osdc_new_request(&client->osdc, | 772 | req = ceph_osdc_new_request(&client->osdc, |
772 | &ci->i_layout, | 773 | &ci->i_layout, |
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c index a2069b6680ae..73c153092f72 100644 --- a/fs/ceph/caps.c +++ b/fs/ceph/caps.c | |||
@@ -814,7 +814,7 @@ int __ceph_caps_used(struct ceph_inode_info *ci) | |||
814 | used |= CEPH_CAP_PIN; | 814 | used |= CEPH_CAP_PIN; |
815 | if (ci->i_rd_ref) | 815 | if (ci->i_rd_ref) |
816 | used |= CEPH_CAP_FILE_RD; | 816 | used |= CEPH_CAP_FILE_RD; |
817 | if (ci->i_rdcache_ref || ci->i_rdcache_gen) | 817 | if (ci->i_rdcache_ref || ci->vfs_inode.i_data.nrpages) |
818 | used |= CEPH_CAP_FILE_CACHE; | 818 | used |= CEPH_CAP_FILE_CACHE; |
819 | if (ci->i_wr_ref) | 819 | if (ci->i_wr_ref) |
820 | used |= CEPH_CAP_FILE_WR; | 820 | used |= CEPH_CAP_FILE_WR; |
@@ -1195,10 +1195,14 @@ static int __send_cap(struct ceph_mds_client *mdsc, struct ceph_cap *cap, | |||
1195 | * asynchronously back to the MDS once sync writes complete and dirty | 1195 | * asynchronously back to the MDS once sync writes complete and dirty |
1196 | * data is written out. | 1196 | * data is written out. |
1197 | * | 1197 | * |
1198 | * Unless @again is true, skip cap_snaps that were already sent to | ||
1199 | * the MDS (i.e., during this session). | ||
1200 | * | ||
1198 | * Called under i_lock. Takes s_mutex as needed. | 1201 | * Called under i_lock. Takes s_mutex as needed. |
1199 | */ | 1202 | */ |
1200 | void __ceph_flush_snaps(struct ceph_inode_info *ci, | 1203 | void __ceph_flush_snaps(struct ceph_inode_info *ci, |
1201 | struct ceph_mds_session **psession) | 1204 | struct ceph_mds_session **psession, |
1205 | int again) | ||
1202 | __releases(ci->vfs_inode->i_lock) | 1206 | __releases(ci->vfs_inode->i_lock) |
1203 | __acquires(ci->vfs_inode->i_lock) | 1207 | __acquires(ci->vfs_inode->i_lock) |
1204 | { | 1208 | { |
@@ -1227,7 +1231,7 @@ retry: | |||
1227 | * pages to be written out. | 1231 | * pages to be written out. |
1228 | */ | 1232 | */ |
1229 | if (capsnap->dirty_pages || capsnap->writing) | 1233 | if (capsnap->dirty_pages || capsnap->writing) |
1230 | continue; | 1234 | break; |
1231 | 1235 | ||
1232 | /* | 1236 | /* |
1233 | * if cap writeback already occurred, we should have dropped | 1237 | * if cap writeback already occurred, we should have dropped |
@@ -1240,6 +1244,13 @@ retry: | |||
1240 | dout("no auth cap (migrating?), doing nothing\n"); | 1244 | dout("no auth cap (migrating?), doing nothing\n"); |
1241 | goto out; | 1245 | goto out; |
1242 | } | 1246 | } |
1247 | |||
1248 | /* only flush each capsnap once */ | ||
1249 | if (!again && !list_empty(&capsnap->flushing_item)) { | ||
1250 | dout("already flushed %p, skipping\n", capsnap); | ||
1251 | continue; | ||
1252 | } | ||
1253 | |||
1243 | mds = ci->i_auth_cap->session->s_mds; | 1254 | mds = ci->i_auth_cap->session->s_mds; |
1244 | mseq = ci->i_auth_cap->mseq; | 1255 | mseq = ci->i_auth_cap->mseq; |
1245 | 1256 | ||
@@ -1276,8 +1287,8 @@ retry: | |||
1276 | &session->s_cap_snaps_flushing); | 1287 | &session->s_cap_snaps_flushing); |
1277 | spin_unlock(&inode->i_lock); | 1288 | spin_unlock(&inode->i_lock); |
1278 | 1289 | ||
1279 | dout("flush_snaps %p cap_snap %p follows %lld size %llu\n", | 1290 | dout("flush_snaps %p cap_snap %p follows %lld tid %llu\n", |
1280 | inode, capsnap, next_follows, capsnap->size); | 1291 | inode, capsnap, capsnap->follows, capsnap->flush_tid); |
1281 | send_cap_msg(session, ceph_vino(inode).ino, 0, | 1292 | send_cap_msg(session, ceph_vino(inode).ino, 0, |
1282 | CEPH_CAP_OP_FLUSHSNAP, capsnap->issued, 0, | 1293 | CEPH_CAP_OP_FLUSHSNAP, capsnap->issued, 0, |
1283 | capsnap->dirty, 0, capsnap->flush_tid, 0, mseq, | 1294 | capsnap->dirty, 0, capsnap->flush_tid, 0, mseq, |
@@ -1314,7 +1325,7 @@ static void ceph_flush_snaps(struct ceph_inode_info *ci) | |||
1314 | struct inode *inode = &ci->vfs_inode; | 1325 | struct inode *inode = &ci->vfs_inode; |
1315 | 1326 | ||
1316 | spin_lock(&inode->i_lock); | 1327 | spin_lock(&inode->i_lock); |
1317 | __ceph_flush_snaps(ci, NULL); | 1328 | __ceph_flush_snaps(ci, NULL, 0); |
1318 | spin_unlock(&inode->i_lock); | 1329 | spin_unlock(&inode->i_lock); |
1319 | } | 1330 | } |
1320 | 1331 | ||
@@ -1477,7 +1488,7 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags, | |||
1477 | 1488 | ||
1478 | /* flush snaps first time around only */ | 1489 | /* flush snaps first time around only */ |
1479 | if (!list_empty(&ci->i_cap_snaps)) | 1490 | if (!list_empty(&ci->i_cap_snaps)) |
1480 | __ceph_flush_snaps(ci, &session); | 1491 | __ceph_flush_snaps(ci, &session, 0); |
1481 | goto retry_locked; | 1492 | goto retry_locked; |
1482 | retry: | 1493 | retry: |
1483 | spin_lock(&inode->i_lock); | 1494 | spin_lock(&inode->i_lock); |
@@ -1894,7 +1905,7 @@ static void kick_flushing_capsnaps(struct ceph_mds_client *mdsc, | |||
1894 | if (cap && cap->session == session) { | 1905 | if (cap && cap->session == session) { |
1895 | dout("kick_flushing_caps %p cap %p capsnap %p\n", inode, | 1906 | dout("kick_flushing_caps %p cap %p capsnap %p\n", inode, |
1896 | cap, capsnap); | 1907 | cap, capsnap); |
1897 | __ceph_flush_snaps(ci, &session); | 1908 | __ceph_flush_snaps(ci, &session, 1); |
1898 | } else { | 1909 | } else { |
1899 | pr_err("%p auth cap %p not mds%d ???\n", inode, | 1910 | pr_err("%p auth cap %p not mds%d ???\n", inode, |
1900 | cap, session->s_mds); | 1911 | cap, session->s_mds); |
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index 6e4f43ff23ec..a1986eb52045 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
@@ -1021,11 +1021,15 @@ out_touch: | |||
1021 | static void ceph_dentry_release(struct dentry *dentry) | 1021 | static void ceph_dentry_release(struct dentry *dentry) |
1022 | { | 1022 | { |
1023 | struct ceph_dentry_info *di = ceph_dentry(dentry); | 1023 | struct ceph_dentry_info *di = ceph_dentry(dentry); |
1024 | struct inode *parent_inode = dentry->d_parent->d_inode; | 1024 | struct inode *parent_inode = NULL; |
1025 | u64 snapid = ceph_snap(parent_inode); | 1025 | u64 snapid = CEPH_NOSNAP; |
1026 | 1026 | ||
1027 | if (!IS_ROOT(dentry)) { | ||
1028 | parent_inode = dentry->d_parent->d_inode; | ||
1029 | if (parent_inode) | ||
1030 | snapid = ceph_snap(parent_inode); | ||
1031 | } | ||
1027 | dout("dentry_release %p parent %p\n", dentry, parent_inode); | 1032 | dout("dentry_release %p parent %p\n", dentry, parent_inode); |
1028 | |||
1029 | if (parent_inode && snapid != CEPH_SNAPDIR) { | 1033 | if (parent_inode && snapid != CEPH_SNAPDIR) { |
1030 | struct ceph_inode_info *ci = ceph_inode(parent_inode); | 1034 | struct ceph_inode_info *ci = ceph_inode(parent_inode); |
1031 | 1035 | ||
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index e7cca414da03..62377ec37edf 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c | |||
@@ -845,7 +845,7 @@ static void ceph_set_dentry_offset(struct dentry *dn) | |||
845 | * the caller) if we fail. | 845 | * the caller) if we fail. |
846 | */ | 846 | */ |
847 | static struct dentry *splice_dentry(struct dentry *dn, struct inode *in, | 847 | static struct dentry *splice_dentry(struct dentry *dn, struct inode *in, |
848 | bool *prehash) | 848 | bool *prehash, bool set_offset) |
849 | { | 849 | { |
850 | struct dentry *realdn; | 850 | struct dentry *realdn; |
851 | 851 | ||
@@ -877,7 +877,8 @@ static struct dentry *splice_dentry(struct dentry *dn, struct inode *in, | |||
877 | } | 877 | } |
878 | if ((!prehash || *prehash) && d_unhashed(dn)) | 878 | if ((!prehash || *prehash) && d_unhashed(dn)) |
879 | d_rehash(dn); | 879 | d_rehash(dn); |
880 | ceph_set_dentry_offset(dn); | 880 | if (set_offset) |
881 | ceph_set_dentry_offset(dn); | ||
881 | out: | 882 | out: |
882 | return dn; | 883 | return dn; |
883 | } | 884 | } |
@@ -1062,7 +1063,7 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, | |||
1062 | d_delete(dn); | 1063 | d_delete(dn); |
1063 | goto done; | 1064 | goto done; |
1064 | } | 1065 | } |
1065 | dn = splice_dentry(dn, in, &have_lease); | 1066 | dn = splice_dentry(dn, in, &have_lease, true); |
1066 | if (IS_ERR(dn)) { | 1067 | if (IS_ERR(dn)) { |
1067 | err = PTR_ERR(dn); | 1068 | err = PTR_ERR(dn); |
1068 | goto done; | 1069 | goto done; |
@@ -1105,7 +1106,7 @@ int ceph_fill_trace(struct super_block *sb, struct ceph_mds_request *req, | |||
1105 | goto done; | 1106 | goto done; |
1106 | } | 1107 | } |
1107 | dout(" linking snapped dir %p to dn %p\n", in, dn); | 1108 | dout(" linking snapped dir %p to dn %p\n", in, dn); |
1108 | dn = splice_dentry(dn, in, NULL); | 1109 | dn = splice_dentry(dn, in, NULL, true); |
1109 | if (IS_ERR(dn)) { | 1110 | if (IS_ERR(dn)) { |
1110 | err = PTR_ERR(dn); | 1111 | err = PTR_ERR(dn); |
1111 | goto done; | 1112 | goto done; |
@@ -1237,7 +1238,7 @@ retry_lookup: | |||
1237 | err = PTR_ERR(in); | 1238 | err = PTR_ERR(in); |
1238 | goto out; | 1239 | goto out; |
1239 | } | 1240 | } |
1240 | dn = splice_dentry(dn, in, NULL); | 1241 | dn = splice_dentry(dn, in, NULL, false); |
1241 | if (IS_ERR(dn)) | 1242 | if (IS_ERR(dn)) |
1242 | dn = NULL; | 1243 | dn = NULL; |
1243 | } | 1244 | } |
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index f091b1351786..fad95f8f2608 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c | |||
@@ -2374,6 +2374,8 @@ static int encode_caps_cb(struct inode *inode, struct ceph_cap *cap, | |||
2374 | num_fcntl_locks, | 2374 | num_fcntl_locks, |
2375 | num_flock_locks); | 2375 | num_flock_locks); |
2376 | unlock_kernel(); | 2376 | unlock_kernel(); |
2377 | } else { | ||
2378 | err = ceph_pagelist_append(pagelist, &rec, reclen); | ||
2377 | } | 2379 | } |
2378 | 2380 | ||
2379 | out_free: | 2381 | out_free: |
diff --git a/fs/ceph/pagelist.c b/fs/ceph/pagelist.c index b6859f47d364..46a368b6dce5 100644 --- a/fs/ceph/pagelist.c +++ b/fs/ceph/pagelist.c | |||
@@ -5,10 +5,18 @@ | |||
5 | 5 | ||
6 | #include "pagelist.h" | 6 | #include "pagelist.h" |
7 | 7 | ||
8 | static void ceph_pagelist_unmap_tail(struct ceph_pagelist *pl) | ||
9 | { | ||
10 | struct page *page = list_entry(pl->head.prev, struct page, | ||
11 | lru); | ||
12 | kunmap(page); | ||
13 | } | ||
14 | |||
8 | int ceph_pagelist_release(struct ceph_pagelist *pl) | 15 | int ceph_pagelist_release(struct ceph_pagelist *pl) |
9 | { | 16 | { |
10 | if (pl->mapped_tail) | 17 | if (pl->mapped_tail) |
11 | kunmap(pl->mapped_tail); | 18 | ceph_pagelist_unmap_tail(pl); |
19 | |||
12 | while (!list_empty(&pl->head)) { | 20 | while (!list_empty(&pl->head)) { |
13 | struct page *page = list_first_entry(&pl->head, struct page, | 21 | struct page *page = list_first_entry(&pl->head, struct page, |
14 | lru); | 22 | lru); |
@@ -26,7 +34,7 @@ static int ceph_pagelist_addpage(struct ceph_pagelist *pl) | |||
26 | pl->room += PAGE_SIZE; | 34 | pl->room += PAGE_SIZE; |
27 | list_add_tail(&page->lru, &pl->head); | 35 | list_add_tail(&page->lru, &pl->head); |
28 | if (pl->mapped_tail) | 36 | if (pl->mapped_tail) |
29 | kunmap(pl->mapped_tail); | 37 | ceph_pagelist_unmap_tail(pl); |
30 | pl->mapped_tail = kmap(page); | 38 | pl->mapped_tail = kmap(page); |
31 | return 0; | 39 | return 0; |
32 | } | 40 | } |
diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c index 4868b9dcac5a..190b6c4a6f2b 100644 --- a/fs/ceph/snap.c +++ b/fs/ceph/snap.c | |||
@@ -119,6 +119,7 @@ static struct ceph_snap_realm *ceph_create_snap_realm( | |||
119 | INIT_LIST_HEAD(&realm->children); | 119 | INIT_LIST_HEAD(&realm->children); |
120 | INIT_LIST_HEAD(&realm->child_item); | 120 | INIT_LIST_HEAD(&realm->child_item); |
121 | INIT_LIST_HEAD(&realm->empty_item); | 121 | INIT_LIST_HEAD(&realm->empty_item); |
122 | INIT_LIST_HEAD(&realm->dirty_item); | ||
122 | INIT_LIST_HEAD(&realm->inodes_with_caps); | 123 | INIT_LIST_HEAD(&realm->inodes_with_caps); |
123 | spin_lock_init(&realm->inodes_with_caps_lock); | 124 | spin_lock_init(&realm->inodes_with_caps_lock); |
124 | __insert_snap_realm(&mdsc->snap_realms, realm); | 125 | __insert_snap_realm(&mdsc->snap_realms, realm); |
@@ -467,7 +468,7 @@ void ceph_queue_cap_snap(struct ceph_inode_info *ci) | |||
467 | INIT_LIST_HEAD(&capsnap->ci_item); | 468 | INIT_LIST_HEAD(&capsnap->ci_item); |
468 | INIT_LIST_HEAD(&capsnap->flushing_item); | 469 | INIT_LIST_HEAD(&capsnap->flushing_item); |
469 | 470 | ||
470 | capsnap->follows = snapc->seq - 1; | 471 | capsnap->follows = snapc->seq; |
471 | capsnap->issued = __ceph_caps_issued(ci, NULL); | 472 | capsnap->issued = __ceph_caps_issued(ci, NULL); |
472 | capsnap->dirty = dirty; | 473 | capsnap->dirty = dirty; |
473 | 474 | ||
@@ -604,6 +605,7 @@ int ceph_update_snap_trace(struct ceph_mds_client *mdsc, | |||
604 | struct ceph_snap_realm *realm; | 605 | struct ceph_snap_realm *realm; |
605 | int invalidate = 0; | 606 | int invalidate = 0; |
606 | int err = -ENOMEM; | 607 | int err = -ENOMEM; |
608 | LIST_HEAD(dirty_realms); | ||
607 | 609 | ||
608 | dout("update_snap_trace deletion=%d\n", deletion); | 610 | dout("update_snap_trace deletion=%d\n", deletion); |
609 | more: | 611 | more: |
@@ -626,24 +628,6 @@ more: | |||
626 | } | 628 | } |
627 | } | 629 | } |
628 | 630 | ||
629 | if (le64_to_cpu(ri->seq) > realm->seq) { | ||
630 | dout("update_snap_trace updating %llx %p %lld -> %lld\n", | ||
631 | realm->ino, realm, realm->seq, le64_to_cpu(ri->seq)); | ||
632 | /* | ||
633 | * if the realm seq has changed, queue a cap_snap for every | ||
634 | * inode with open caps. we do this _before_ we update | ||
635 | * the realm info so that we prepare for writeback under the | ||
636 | * _previous_ snap context. | ||
637 | * | ||
638 | * ...unless it's a snap deletion! | ||
639 | */ | ||
640 | if (!deletion) | ||
641 | queue_realm_cap_snaps(realm); | ||
642 | } else { | ||
643 | dout("update_snap_trace %llx %p seq %lld unchanged\n", | ||
644 | realm->ino, realm, realm->seq); | ||
645 | } | ||
646 | |||
647 | /* ensure the parent is correct */ | 631 | /* ensure the parent is correct */ |
648 | err = adjust_snap_realm_parent(mdsc, realm, le64_to_cpu(ri->parent)); | 632 | err = adjust_snap_realm_parent(mdsc, realm, le64_to_cpu(ri->parent)); |
649 | if (err < 0) | 633 | if (err < 0) |
@@ -651,6 +635,8 @@ more: | |||
651 | invalidate += err; | 635 | invalidate += err; |
652 | 636 | ||
653 | if (le64_to_cpu(ri->seq) > realm->seq) { | 637 | if (le64_to_cpu(ri->seq) > realm->seq) { |
638 | dout("update_snap_trace updating %llx %p %lld -> %lld\n", | ||
639 | realm->ino, realm, realm->seq, le64_to_cpu(ri->seq)); | ||
654 | /* update realm parameters, snap lists */ | 640 | /* update realm parameters, snap lists */ |
655 | realm->seq = le64_to_cpu(ri->seq); | 641 | realm->seq = le64_to_cpu(ri->seq); |
656 | realm->created = le64_to_cpu(ri->created); | 642 | realm->created = le64_to_cpu(ri->created); |
@@ -668,9 +654,17 @@ more: | |||
668 | if (err < 0) | 654 | if (err < 0) |
669 | goto fail; | 655 | goto fail; |
670 | 656 | ||
657 | /* queue realm for cap_snap creation */ | ||
658 | list_add(&realm->dirty_item, &dirty_realms); | ||
659 | |||
671 | invalidate = 1; | 660 | invalidate = 1; |
672 | } else if (!realm->cached_context) { | 661 | } else if (!realm->cached_context) { |
662 | dout("update_snap_trace %llx %p seq %lld new\n", | ||
663 | realm->ino, realm, realm->seq); | ||
673 | invalidate = 1; | 664 | invalidate = 1; |
665 | } else { | ||
666 | dout("update_snap_trace %llx %p seq %lld unchanged\n", | ||
667 | realm->ino, realm, realm->seq); | ||
674 | } | 668 | } |
675 | 669 | ||
676 | dout("done with %llx %p, invalidated=%d, %p %p\n", realm->ino, | 670 | dout("done with %llx %p, invalidated=%d, %p %p\n", realm->ino, |
@@ -683,6 +677,14 @@ more: | |||
683 | if (invalidate) | 677 | if (invalidate) |
684 | rebuild_snap_realms(realm); | 678 | rebuild_snap_realms(realm); |
685 | 679 | ||
680 | /* | ||
681 | * queue cap snaps _after_ we've built the new snap contexts, | ||
682 | * so that i_head_snapc can be set appropriately. | ||
683 | */ | ||
684 | list_for_each_entry(realm, &dirty_realms, dirty_item) { | ||
685 | queue_realm_cap_snaps(realm); | ||
686 | } | ||
687 | |||
686 | __cleanup_empty_realms(mdsc); | 688 | __cleanup_empty_realms(mdsc); |
687 | return 0; | 689 | return 0; |
688 | 690 | ||
@@ -715,7 +717,7 @@ static void flush_snaps(struct ceph_mds_client *mdsc) | |||
715 | igrab(inode); | 717 | igrab(inode); |
716 | spin_unlock(&mdsc->snap_flush_lock); | 718 | spin_unlock(&mdsc->snap_flush_lock); |
717 | spin_lock(&inode->i_lock); | 719 | spin_lock(&inode->i_lock); |
718 | __ceph_flush_snaps(ci, &session); | 720 | __ceph_flush_snaps(ci, &session, 0); |
719 | spin_unlock(&inode->i_lock); | 721 | spin_unlock(&inode->i_lock); |
720 | iput(inode); | 722 | iput(inode); |
721 | spin_lock(&mdsc->snap_flush_lock); | 723 | spin_lock(&mdsc->snap_flush_lock); |
@@ -816,6 +818,7 @@ void ceph_handle_snap(struct ceph_mds_client *mdsc, | |||
816 | }; | 818 | }; |
817 | struct inode *inode = ceph_find_inode(sb, vino); | 819 | struct inode *inode = ceph_find_inode(sb, vino); |
818 | struct ceph_inode_info *ci; | 820 | struct ceph_inode_info *ci; |
821 | struct ceph_snap_realm *oldrealm; | ||
819 | 822 | ||
820 | if (!inode) | 823 | if (!inode) |
821 | continue; | 824 | continue; |
@@ -841,18 +844,19 @@ void ceph_handle_snap(struct ceph_mds_client *mdsc, | |||
841 | dout(" will move %p to split realm %llx %p\n", | 844 | dout(" will move %p to split realm %llx %p\n", |
842 | inode, realm->ino, realm); | 845 | inode, realm->ino, realm); |
843 | /* | 846 | /* |
844 | * Remove the inode from the realm's inode | 847 | * Move the inode to the new realm |
845 | * list, but don't add it to the new realm | ||
846 | * yet. We don't want the cap_snap to be | ||
847 | * queued (again) by ceph_update_snap_trace() | ||
848 | * below. Queue it _now_, under the old context. | ||
849 | */ | 848 | */ |
850 | spin_lock(&realm->inodes_with_caps_lock); | 849 | spin_lock(&realm->inodes_with_caps_lock); |
851 | list_del_init(&ci->i_snap_realm_item); | 850 | list_del_init(&ci->i_snap_realm_item); |
851 | list_add(&ci->i_snap_realm_item, | ||
852 | &realm->inodes_with_caps); | ||
853 | oldrealm = ci->i_snap_realm; | ||
854 | ci->i_snap_realm = realm; | ||
852 | spin_unlock(&realm->inodes_with_caps_lock); | 855 | spin_unlock(&realm->inodes_with_caps_lock); |
853 | spin_unlock(&inode->i_lock); | 856 | spin_unlock(&inode->i_lock); |
854 | 857 | ||
855 | ceph_queue_cap_snap(ci); | 858 | ceph_get_snap_realm(mdsc, realm); |
859 | ceph_put_snap_realm(mdsc, oldrealm); | ||
856 | 860 | ||
857 | iput(inode); | 861 | iput(inode); |
858 | continue; | 862 | continue; |
@@ -880,43 +884,9 @@ skip_inode: | |||
880 | ceph_update_snap_trace(mdsc, p, e, | 884 | ceph_update_snap_trace(mdsc, p, e, |
881 | op == CEPH_SNAP_OP_DESTROY); | 885 | op == CEPH_SNAP_OP_DESTROY); |
882 | 886 | ||
883 | if (op == CEPH_SNAP_OP_SPLIT) { | 887 | if (op == CEPH_SNAP_OP_SPLIT) |
884 | /* | ||
885 | * ok, _now_ add the inodes into the new realm. | ||
886 | */ | ||
887 | for (i = 0; i < num_split_inos; i++) { | ||
888 | struct ceph_vino vino = { | ||
889 | .ino = le64_to_cpu(split_inos[i]), | ||
890 | .snap = CEPH_NOSNAP, | ||
891 | }; | ||
892 | struct inode *inode = ceph_find_inode(sb, vino); | ||
893 | struct ceph_inode_info *ci; | ||
894 | |||
895 | if (!inode) | ||
896 | continue; | ||
897 | ci = ceph_inode(inode); | ||
898 | spin_lock(&inode->i_lock); | ||
899 | if (list_empty(&ci->i_snap_realm_item)) { | ||
900 | struct ceph_snap_realm *oldrealm = | ||
901 | ci->i_snap_realm; | ||
902 | |||
903 | dout(" moving %p to split realm %llx %p\n", | ||
904 | inode, realm->ino, realm); | ||
905 | spin_lock(&realm->inodes_with_caps_lock); | ||
906 | list_add(&ci->i_snap_realm_item, | ||
907 | &realm->inodes_with_caps); | ||
908 | ci->i_snap_realm = realm; | ||
909 | spin_unlock(&realm->inodes_with_caps_lock); | ||
910 | ceph_get_snap_realm(mdsc, realm); | ||
911 | ceph_put_snap_realm(mdsc, oldrealm); | ||
912 | } | ||
913 | spin_unlock(&inode->i_lock); | ||
914 | iput(inode); | ||
915 | } | ||
916 | |||
917 | /* we took a reference when we created the realm, above */ | 888 | /* we took a reference when we created the realm, above */ |
918 | ceph_put_snap_realm(mdsc, realm); | 889 | ceph_put_snap_realm(mdsc, realm); |
919 | } | ||
920 | 890 | ||
921 | __cleanup_empty_realms(mdsc); | 891 | __cleanup_empty_realms(mdsc); |
922 | 892 | ||
diff --git a/fs/ceph/super.h b/fs/ceph/super.h index c33897ae5725..b87638e84c4b 100644 --- a/fs/ceph/super.h +++ b/fs/ceph/super.h | |||
@@ -690,6 +690,8 @@ struct ceph_snap_realm { | |||
690 | 690 | ||
691 | struct list_head empty_item; /* if i have ref==0 */ | 691 | struct list_head empty_item; /* if i have ref==0 */ |
692 | 692 | ||
693 | struct list_head dirty_item; /* if realm needs new context */ | ||
694 | |||
693 | /* the current set of snaps for this realm */ | 695 | /* the current set of snaps for this realm */ |
694 | struct ceph_snap_context *cached_context; | 696 | struct ceph_snap_context *cached_context; |
695 | 697 | ||
@@ -826,7 +828,8 @@ extern void ceph_put_cap_refs(struct ceph_inode_info *ci, int had); | |||
826 | extern void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr, | 828 | extern void ceph_put_wrbuffer_cap_refs(struct ceph_inode_info *ci, int nr, |
827 | struct ceph_snap_context *snapc); | 829 | struct ceph_snap_context *snapc); |
828 | extern void __ceph_flush_snaps(struct ceph_inode_info *ci, | 830 | extern void __ceph_flush_snaps(struct ceph_inode_info *ci, |
829 | struct ceph_mds_session **psession); | 831 | struct ceph_mds_session **psession, |
832 | int again); | ||
830 | extern void ceph_check_caps(struct ceph_inode_info *ci, int flags, | 833 | extern void ceph_check_caps(struct ceph_inode_info *ci, int flags, |
831 | struct ceph_mds_session *session); | 834 | struct ceph_mds_session *session); |
832 | extern void ceph_check_delayed_caps(struct ceph_mds_client *mdsc); | 835 | extern void ceph_check_delayed_caps(struct ceph_mds_client *mdsc); |
diff --git a/fs/char_dev.c b/fs/char_dev.c index f80a4f25123c..143d393881cb 100644 --- a/fs/char_dev.c +++ b/fs/char_dev.c | |||
@@ -40,7 +40,9 @@ struct backing_dev_info directly_mappable_cdev_bdi = { | |||
40 | #endif | 40 | #endif |
41 | /* permit direct mmap, for read, write or exec */ | 41 | /* permit direct mmap, for read, write or exec */ |
42 | BDI_CAP_MAP_DIRECT | | 42 | BDI_CAP_MAP_DIRECT | |
43 | BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP), | 43 | BDI_CAP_READ_MAP | BDI_CAP_WRITE_MAP | BDI_CAP_EXEC_MAP | |
44 | /* no writeback happens */ | ||
45 | BDI_CAP_NO_ACCT_AND_WRITEBACK), | ||
44 | }; | 46 | }; |
45 | 47 | ||
46 | static struct kobj_map *cdev_map; | 48 | static struct kobj_map *cdev_map; |
diff --git a/fs/cifs/Kconfig b/fs/cifs/Kconfig index 0da1debd499d..917b7d449bb2 100644 --- a/fs/cifs/Kconfig +++ b/fs/cifs/Kconfig | |||
@@ -2,8 +2,6 @@ config CIFS | |||
2 | tristate "CIFS support (advanced network filesystem, SMBFS successor)" | 2 | tristate "CIFS support (advanced network filesystem, SMBFS successor)" |
3 | depends on INET | 3 | depends on INET |
4 | select NLS | 4 | select NLS |
5 | select CRYPTO_MD5 | ||
6 | select CRYPTO_ARC4 | ||
7 | help | 5 | help |
8 | This is the client VFS module for the Common Internet File System | 6 | This is the client VFS module for the Common Internet File System |
9 | (CIFS) protocol which is the successor to the Server Message Block | 7 | (CIFS) protocol which is the successor to the Server Message Block |
diff --git a/fs/cifs/asn1.c b/fs/cifs/asn1.c index 21f0fbd86989..cfd1ce34e0bc 100644 --- a/fs/cifs/asn1.c +++ b/fs/cifs/asn1.c | |||
@@ -597,13 +597,13 @@ decode_negTokenInit(unsigned char *security_blob, int length, | |||
597 | if (compare_oid(oid, oidlen, MSKRB5_OID, | 597 | if (compare_oid(oid, oidlen, MSKRB5_OID, |
598 | MSKRB5_OID_LEN)) | 598 | MSKRB5_OID_LEN)) |
599 | server->sec_mskerberos = true; | 599 | server->sec_mskerberos = true; |
600 | if (compare_oid(oid, oidlen, KRB5U2U_OID, | 600 | else if (compare_oid(oid, oidlen, KRB5U2U_OID, |
601 | KRB5U2U_OID_LEN)) | 601 | KRB5U2U_OID_LEN)) |
602 | server->sec_kerberosu2u = true; | 602 | server->sec_kerberosu2u = true; |
603 | if (compare_oid(oid, oidlen, KRB5_OID, | 603 | else if (compare_oid(oid, oidlen, KRB5_OID, |
604 | KRB5_OID_LEN)) | 604 | KRB5_OID_LEN)) |
605 | server->sec_kerberos = true; | 605 | server->sec_kerberos = true; |
606 | if (compare_oid(oid, oidlen, NTLMSSP_OID, | 606 | else if (compare_oid(oid, oidlen, NTLMSSP_OID, |
607 | NTLMSSP_OID_LEN)) | 607 | NTLMSSP_OID_LEN)) |
608 | server->sec_ntlmssp = true; | 608 | server->sec_ntlmssp = true; |
609 | 609 | ||
diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index 709f2296bdb4..35042d8f7338 100644 --- a/fs/cifs/cifsencrypt.c +++ b/fs/cifs/cifsencrypt.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include "md5.h" | 27 | #include "md5.h" |
28 | #include "cifs_unicode.h" | 28 | #include "cifs_unicode.h" |
29 | #include "cifsproto.h" | 29 | #include "cifsproto.h" |
30 | #include "ntlmssp.h" | ||
31 | #include <linux/ctype.h> | 30 | #include <linux/ctype.h> |
32 | #include <linux/random.h> | 31 | #include <linux/random.h> |
33 | 32 | ||
@@ -43,43 +42,21 @@ extern void SMBencrypt(unsigned char *passwd, const unsigned char *c8, | |||
43 | unsigned char *p24); | 42 | unsigned char *p24); |
44 | 43 | ||
45 | static int cifs_calculate_signature(const struct smb_hdr *cifs_pdu, | 44 | static int cifs_calculate_signature(const struct smb_hdr *cifs_pdu, |
46 | struct TCP_Server_Info *server, char *signature) | 45 | const struct mac_key *key, char *signature) |
47 | { | 46 | { |
48 | int rc; | 47 | struct MD5Context context; |
49 | 48 | ||
50 | if (cifs_pdu == NULL || server == NULL || signature == NULL) | 49 | if ((cifs_pdu == NULL) || (signature == NULL) || (key == NULL)) |
51 | return -EINVAL; | 50 | return -EINVAL; |
52 | 51 | ||
53 | if (!server->ntlmssp.sdescmd5) { | 52 | cifs_MD5_init(&context); |
54 | cERROR(1, | 53 | cifs_MD5_update(&context, (char *)&key->data, key->len); |
55 | "cifs_calculate_signature: can't generate signature\n"); | 54 | cifs_MD5_update(&context, cifs_pdu->Protocol, cifs_pdu->smb_buf_length); |
56 | return -1; | ||
57 | } | ||
58 | |||
59 | rc = crypto_shash_init(&server->ntlmssp.sdescmd5->shash); | ||
60 | if (rc) { | ||
61 | cERROR(1, "cifs_calculate_signature: oould not init md5\n"); | ||
62 | return rc; | ||
63 | } | ||
64 | |||
65 | if (server->secType == RawNTLMSSP) | ||
66 | crypto_shash_update(&server->ntlmssp.sdescmd5->shash, | ||
67 | server->session_key.data.ntlmv2.key, | ||
68 | CIFS_NTLMV2_SESSKEY_SIZE); | ||
69 | else | ||
70 | crypto_shash_update(&server->ntlmssp.sdescmd5->shash, | ||
71 | (char *)&server->session_key.data, | ||
72 | server->session_key.len); | ||
73 | |||
74 | crypto_shash_update(&server->ntlmssp.sdescmd5->shash, | ||
75 | cifs_pdu->Protocol, cifs_pdu->smb_buf_length); | ||
76 | 55 | ||
77 | rc = crypto_shash_final(&server->ntlmssp.sdescmd5->shash, signature); | 56 | cifs_MD5_final(signature, &context); |
78 | 57 | return 0; | |
79 | return rc; | ||
80 | } | 58 | } |
81 | 59 | ||
82 | |||
83 | int cifs_sign_smb(struct smb_hdr *cifs_pdu, struct TCP_Server_Info *server, | 60 | int cifs_sign_smb(struct smb_hdr *cifs_pdu, struct TCP_Server_Info *server, |
84 | __u32 *pexpected_response_sequence_number) | 61 | __u32 *pexpected_response_sequence_number) |
85 | { | 62 | { |
@@ -101,7 +78,8 @@ int cifs_sign_smb(struct smb_hdr *cifs_pdu, struct TCP_Server_Info *server, | |||
101 | server->sequence_number++; | 78 | server->sequence_number++; |
102 | spin_unlock(&GlobalMid_Lock); | 79 | spin_unlock(&GlobalMid_Lock); |
103 | 80 | ||
104 | rc = cifs_calculate_signature(cifs_pdu, server, smb_signature); | 81 | rc = cifs_calculate_signature(cifs_pdu, &server->mac_signing_key, |
82 | smb_signature); | ||
105 | if (rc) | 83 | if (rc) |
106 | memset(cifs_pdu->Signature.SecuritySignature, 0, 8); | 84 | memset(cifs_pdu->Signature.SecuritySignature, 0, 8); |
107 | else | 85 | else |
@@ -111,39 +89,21 @@ int cifs_sign_smb(struct smb_hdr *cifs_pdu, struct TCP_Server_Info *server, | |||
111 | } | 89 | } |
112 | 90 | ||
113 | static int cifs_calc_signature2(const struct kvec *iov, int n_vec, | 91 | static int cifs_calc_signature2(const struct kvec *iov, int n_vec, |
114 | struct TCP_Server_Info *server, char *signature) | 92 | const struct mac_key *key, char *signature) |
115 | { | 93 | { |
94 | struct MD5Context context; | ||
116 | int i; | 95 | int i; |
117 | int rc; | ||
118 | 96 | ||
119 | if (iov == NULL || server == NULL || signature == NULL) | 97 | if ((iov == NULL) || (signature == NULL) || (key == NULL)) |
120 | return -EINVAL; | 98 | return -EINVAL; |
121 | 99 | ||
122 | if (!server->ntlmssp.sdescmd5) { | 100 | cifs_MD5_init(&context); |
123 | cERROR(1, "cifs_calc_signature2: can't generate signature\n"); | 101 | cifs_MD5_update(&context, (char *)&key->data, key->len); |
124 | return -1; | ||
125 | } | ||
126 | |||
127 | rc = crypto_shash_init(&server->ntlmssp.sdescmd5->shash); | ||
128 | if (rc) { | ||
129 | cERROR(1, "cifs_calc_signature2: oould not init md5\n"); | ||
130 | return rc; | ||
131 | } | ||
132 | |||
133 | if (server->secType == RawNTLMSSP) | ||
134 | crypto_shash_update(&server->ntlmssp.sdescmd5->shash, | ||
135 | server->session_key.data.ntlmv2.key, | ||
136 | CIFS_NTLMV2_SESSKEY_SIZE); | ||
137 | else | ||
138 | crypto_shash_update(&server->ntlmssp.sdescmd5->shash, | ||
139 | (char *)&server->session_key.data, | ||
140 | server->session_key.len); | ||
141 | |||
142 | for (i = 0; i < n_vec; i++) { | 102 | for (i = 0; i < n_vec; i++) { |
143 | if (iov[i].iov_len == 0) | 103 | if (iov[i].iov_len == 0) |
144 | continue; | 104 | continue; |
145 | if (iov[i].iov_base == NULL) { | 105 | if (iov[i].iov_base == NULL) { |
146 | cERROR(1, "cifs_calc_signature2: null iovec entry"); | 106 | cERROR(1, "null iovec entry"); |
147 | return -EIO; | 107 | return -EIO; |
148 | } | 108 | } |
149 | /* The first entry includes a length field (which does not get | 109 | /* The first entry includes a length field (which does not get |
@@ -151,18 +111,18 @@ static int cifs_calc_signature2(const struct kvec *iov, int n_vec, | |||
151 | if (i == 0) { | 111 | if (i == 0) { |
152 | if (iov[0].iov_len <= 8) /* cmd field at offset 9 */ | 112 | if (iov[0].iov_len <= 8) /* cmd field at offset 9 */ |
153 | break; /* nothing to sign or corrupt header */ | 113 | break; /* nothing to sign or corrupt header */ |
154 | crypto_shash_update(&server->ntlmssp.sdescmd5->shash, | 114 | cifs_MD5_update(&context, iov[0].iov_base+4, |
155 | iov[i].iov_base + 4, iov[i].iov_len - 4); | 115 | iov[0].iov_len-4); |
156 | } else | 116 | } else |
157 | crypto_shash_update(&server->ntlmssp.sdescmd5->shash, | 117 | cifs_MD5_update(&context, iov[i].iov_base, iov[i].iov_len); |
158 | iov[i].iov_base, iov[i].iov_len); | ||
159 | } | 118 | } |
160 | 119 | ||
161 | rc = crypto_shash_final(&server->ntlmssp.sdescmd5->shash, signature); | 120 | cifs_MD5_final(signature, &context); |
162 | 121 | ||
163 | return rc; | 122 | return 0; |
164 | } | 123 | } |
165 | 124 | ||
125 | |||
166 | int cifs_sign_smb2(struct kvec *iov, int n_vec, struct TCP_Server_Info *server, | 126 | int cifs_sign_smb2(struct kvec *iov, int n_vec, struct TCP_Server_Info *server, |
167 | __u32 *pexpected_response_sequence_number) | 127 | __u32 *pexpected_response_sequence_number) |
168 | { | 128 | { |
@@ -185,7 +145,8 @@ int cifs_sign_smb2(struct kvec *iov, int n_vec, struct TCP_Server_Info *server, | |||
185 | server->sequence_number++; | 145 | server->sequence_number++; |
186 | spin_unlock(&GlobalMid_Lock); | 146 | spin_unlock(&GlobalMid_Lock); |
187 | 147 | ||
188 | rc = cifs_calc_signature2(iov, n_vec, server, smb_signature); | 148 | rc = cifs_calc_signature2(iov, n_vec, &server->mac_signing_key, |
149 | smb_signature); | ||
189 | if (rc) | 150 | if (rc) |
190 | memset(cifs_pdu->Signature.SecuritySignature, 0, 8); | 151 | memset(cifs_pdu->Signature.SecuritySignature, 0, 8); |
191 | else | 152 | else |
@@ -195,14 +156,14 @@ int cifs_sign_smb2(struct kvec *iov, int n_vec, struct TCP_Server_Info *server, | |||
195 | } | 156 | } |
196 | 157 | ||
197 | int cifs_verify_signature(struct smb_hdr *cifs_pdu, | 158 | int cifs_verify_signature(struct smb_hdr *cifs_pdu, |
198 | struct TCP_Server_Info *server, | 159 | const struct mac_key *mac_key, |
199 | __u32 expected_sequence_number) | 160 | __u32 expected_sequence_number) |
200 | { | 161 | { |
201 | int rc; | 162 | unsigned int rc; |
202 | char server_response_sig[8]; | 163 | char server_response_sig[8]; |
203 | char what_we_think_sig_should_be[20]; | 164 | char what_we_think_sig_should_be[20]; |
204 | 165 | ||
205 | if (cifs_pdu == NULL || server == NULL) | 166 | if ((cifs_pdu == NULL) || (mac_key == NULL)) |
206 | return -EINVAL; | 167 | return -EINVAL; |
207 | 168 | ||
208 | if (cifs_pdu->Command == SMB_COM_NEGOTIATE) | 169 | if (cifs_pdu->Command == SMB_COM_NEGOTIATE) |
@@ -231,7 +192,7 @@ int cifs_verify_signature(struct smb_hdr *cifs_pdu, | |||
231 | cpu_to_le32(expected_sequence_number); | 192 | cpu_to_le32(expected_sequence_number); |
232 | cifs_pdu->Signature.Sequence.Reserved = 0; | 193 | cifs_pdu->Signature.Sequence.Reserved = 0; |
233 | 194 | ||
234 | rc = cifs_calculate_signature(cifs_pdu, server, | 195 | rc = cifs_calculate_signature(cifs_pdu, mac_key, |
235 | what_we_think_sig_should_be); | 196 | what_we_think_sig_should_be); |
236 | 197 | ||
237 | if (rc) | 198 | if (rc) |
@@ -248,7 +209,7 @@ int cifs_verify_signature(struct smb_hdr *cifs_pdu, | |||
248 | } | 209 | } |
249 | 210 | ||
250 | /* We fill in key by putting in 40 byte array which was allocated by caller */ | 211 | /* We fill in key by putting in 40 byte array which was allocated by caller */ |
251 | int cifs_calculate_session_key(struct session_key *key, const char *rn, | 212 | int cifs_calculate_mac_key(struct mac_key *key, const char *rn, |
252 | const char *password) | 213 | const char *password) |
253 | { | 214 | { |
254 | char temp_key[16]; | 215 | char temp_key[16]; |
@@ -306,52 +267,38 @@ static int calc_ntlmv2_hash(struct cifsSesInfo *ses, | |||
306 | { | 267 | { |
307 | int rc = 0; | 268 | int rc = 0; |
308 | int len; | 269 | int len; |
309 | char nt_hash[CIFS_NTHASH_SIZE]; | 270 | char nt_hash[16]; |
271 | struct HMACMD5Context *pctxt; | ||
310 | wchar_t *user; | 272 | wchar_t *user; |
311 | wchar_t *domain; | 273 | wchar_t *domain; |
312 | wchar_t *server; | ||
313 | 274 | ||
314 | if (!ses->server->ntlmssp.sdeschmacmd5) { | 275 | pctxt = kmalloc(sizeof(struct HMACMD5Context), GFP_KERNEL); |
315 | cERROR(1, "calc_ntlmv2_hash: can't generate ntlmv2 hash\n"); | 276 | |
316 | return -1; | 277 | if (pctxt == NULL) |
317 | } | 278 | return -ENOMEM; |
318 | 279 | ||
319 | /* calculate md4 hash of password */ | 280 | /* calculate md4 hash of password */ |
320 | E_md4hash(ses->password, nt_hash); | 281 | E_md4hash(ses->password, nt_hash); |
321 | 282 | ||
322 | crypto_shash_setkey(ses->server->ntlmssp.hmacmd5, nt_hash, | 283 | /* convert Domainname to unicode and uppercase */ |
323 | CIFS_NTHASH_SIZE); | 284 | hmac_md5_init_limK_to_64(nt_hash, 16, pctxt); |
324 | |||
325 | rc = crypto_shash_init(&ses->server->ntlmssp.sdeschmacmd5->shash); | ||
326 | if (rc) { | ||
327 | cERROR(1, "calc_ntlmv2_hash: could not init hmacmd5\n"); | ||
328 | return rc; | ||
329 | } | ||
330 | 285 | ||
331 | /* convert ses->userName to unicode and uppercase */ | 286 | /* convert ses->userName to unicode and uppercase */ |
332 | len = strlen(ses->userName); | 287 | len = strlen(ses->userName); |
333 | user = kmalloc(2 + (len * 2), GFP_KERNEL); | 288 | user = kmalloc(2 + (len * 2), GFP_KERNEL); |
334 | if (user == NULL) { | 289 | if (user == NULL) |
335 | cERROR(1, "calc_ntlmv2_hash: user mem alloc failure\n"); | ||
336 | rc = -ENOMEM; | ||
337 | goto calc_exit_2; | 290 | goto calc_exit_2; |
338 | } | ||
339 | len = cifs_strtoUCS((__le16 *)user, ses->userName, len, nls_cp); | 291 | len = cifs_strtoUCS((__le16 *)user, ses->userName, len, nls_cp); |
340 | UniStrupr(user); | 292 | UniStrupr(user); |
341 | 293 | hmac_md5_update((char *)user, 2*len, pctxt); | |
342 | crypto_shash_update(&ses->server->ntlmssp.sdeschmacmd5->shash, | ||
343 | (char *)user, 2 * len); | ||
344 | 294 | ||
345 | /* convert ses->domainName to unicode and uppercase */ | 295 | /* convert ses->domainName to unicode and uppercase */ |
346 | if (ses->domainName) { | 296 | if (ses->domainName) { |
347 | len = strlen(ses->domainName); | 297 | len = strlen(ses->domainName); |
348 | 298 | ||
349 | domain = kmalloc(2 + (len * 2), GFP_KERNEL); | 299 | domain = kmalloc(2 + (len * 2), GFP_KERNEL); |
350 | if (domain == NULL) { | 300 | if (domain == NULL) |
351 | cERROR(1, "calc_ntlmv2_hash: domain mem alloc failure"); | ||
352 | rc = -ENOMEM; | ||
353 | goto calc_exit_1; | 301 | goto calc_exit_1; |
354 | } | ||
355 | len = cifs_strtoUCS((__le16 *)domain, ses->domainName, len, | 302 | len = cifs_strtoUCS((__le16 *)domain, ses->domainName, len, |
356 | nls_cp); | 303 | nls_cp); |
357 | /* the following line was removed since it didn't work well | 304 | /* the following line was removed since it didn't work well |
@@ -359,292 +306,65 @@ static int calc_ntlmv2_hash(struct cifsSesInfo *ses, | |||
359 | Maybe converting the domain name earlier makes sense */ | 306 | Maybe converting the domain name earlier makes sense */ |
360 | /* UniStrupr(domain); */ | 307 | /* UniStrupr(domain); */ |
361 | 308 | ||
362 | crypto_shash_update(&ses->server->ntlmssp.sdeschmacmd5->shash, | 309 | hmac_md5_update((char *)domain, 2*len, pctxt); |
363 | (char *)domain, 2 * len); | ||
364 | 310 | ||
365 | kfree(domain); | 311 | kfree(domain); |
366 | } else if (ses->serverName) { | ||
367 | len = strlen(ses->serverName); | ||
368 | |||
369 | server = kmalloc(2 + (len * 2), GFP_KERNEL); | ||
370 | if (server == NULL) { | ||
371 | cERROR(1, "calc_ntlmv2_hash: server mem alloc failure"); | ||
372 | rc = -ENOMEM; | ||
373 | goto calc_exit_1; | ||
374 | } | ||
375 | len = cifs_strtoUCS((__le16 *)server, ses->serverName, len, | ||
376 | nls_cp); | ||
377 | /* the following line was removed since it didn't work well | ||
378 | with lower cased domain name that passed as an option. | ||
379 | Maybe converting the domain name earlier makes sense */ | ||
380 | /* UniStrupr(domain); */ | ||
381 | |||
382 | crypto_shash_update(&ses->server->ntlmssp.sdeschmacmd5->shash, | ||
383 | (char *)server, 2 * len); | ||
384 | |||
385 | kfree(server); | ||
386 | } | 312 | } |
387 | |||
388 | rc = crypto_shash_final(&ses->server->ntlmssp.sdeschmacmd5->shash, | ||
389 | ses->server->ntlmv2_hash); | ||
390 | |||
391 | calc_exit_1: | 313 | calc_exit_1: |
392 | kfree(user); | 314 | kfree(user); |
393 | calc_exit_2: | 315 | calc_exit_2: |
394 | /* BB FIXME what about bytes 24 through 40 of the signing key? | 316 | /* BB FIXME what about bytes 24 through 40 of the signing key? |
395 | compare with the NTLM example */ | 317 | compare with the NTLM example */ |
318 | hmac_md5_final(ses->server->ntlmv2_hash, pctxt); | ||
396 | 319 | ||
320 | kfree(pctxt); | ||
397 | return rc; | 321 | return rc; |
398 | } | 322 | } |
399 | 323 | ||
400 | static int | 324 | void setup_ntlmv2_rsp(struct cifsSesInfo *ses, char *resp_buf, |
401 | find_domain_name(struct cifsSesInfo *ses) | ||
402 | { | ||
403 | int rc = 0; | ||
404 | unsigned int attrsize; | ||
405 | unsigned int type; | ||
406 | unsigned char *blobptr; | ||
407 | struct ntlmssp2_name *attrptr; | ||
408 | |||
409 | if (ses->server->tiblob) { | ||
410 | blobptr = ses->server->tiblob; | ||
411 | attrptr = (struct ntlmssp2_name *) blobptr; | ||
412 | |||
413 | while ((type = attrptr->type) != 0) { | ||
414 | blobptr += 2; /* advance attr type */ | ||
415 | attrsize = attrptr->length; | ||
416 | blobptr += 2; /* advance attr size */ | ||
417 | if (type == NTLMSSP_AV_NB_DOMAIN_NAME) { | ||
418 | if (!ses->domainName) { | ||
419 | ses->domainName = | ||
420 | kmalloc(attrptr->length + 1, | ||
421 | GFP_KERNEL); | ||
422 | if (!ses->domainName) | ||
423 | return -ENOMEM; | ||
424 | cifs_from_ucs2(ses->domainName, | ||
425 | (__le16 *)blobptr, | ||
426 | attrptr->length, | ||
427 | attrptr->length, | ||
428 | load_nls_default(), false); | ||
429 | } | ||
430 | } | ||
431 | blobptr += attrsize; /* advance attr value */ | ||
432 | attrptr = (struct ntlmssp2_name *) blobptr; | ||
433 | } | ||
434 | } else { | ||
435 | ses->server->tilen = 2 * sizeof(struct ntlmssp2_name); | ||
436 | ses->server->tiblob = kmalloc(ses->server->tilen, GFP_KERNEL); | ||
437 | if (!ses->server->tiblob) { | ||
438 | ses->server->tilen = 0; | ||
439 | cERROR(1, "Challenge target info allocation failure"); | ||
440 | return -ENOMEM; | ||
441 | } | ||
442 | memset(ses->server->tiblob, 0x0, ses->server->tilen); | ||
443 | attrptr = (struct ntlmssp2_name *) ses->server->tiblob; | ||
444 | attrptr->type = cpu_to_le16(NTLMSSP_DOMAIN_TYPE); | ||
445 | } | ||
446 | |||
447 | return rc; | ||
448 | } | ||
449 | |||
450 | static int | ||
451 | CalcNTLMv2_response(const struct TCP_Server_Info *server, | ||
452 | char *v2_session_response) | ||
453 | { | ||
454 | int rc; | ||
455 | |||
456 | if (!server->ntlmssp.sdeschmacmd5) { | ||
457 | cERROR(1, "calc_ntlmv2_hash: can't generate ntlmv2 hash\n"); | ||
458 | return -1; | ||
459 | } | ||
460 | |||
461 | crypto_shash_setkey(server->ntlmssp.hmacmd5, server->ntlmv2_hash, | ||
462 | CIFS_HMAC_MD5_HASH_SIZE); | ||
463 | |||
464 | rc = crypto_shash_init(&server->ntlmssp.sdeschmacmd5->shash); | ||
465 | if (rc) { | ||
466 | cERROR(1, "CalcNTLMv2_response: could not init hmacmd5"); | ||
467 | return rc; | ||
468 | } | ||
469 | |||
470 | memcpy(v2_session_response + CIFS_SERVER_CHALLENGE_SIZE, | ||
471 | server->cryptKey, CIFS_SERVER_CHALLENGE_SIZE); | ||
472 | crypto_shash_update(&server->ntlmssp.sdeschmacmd5->shash, | ||
473 | v2_session_response + CIFS_SERVER_CHALLENGE_SIZE, | ||
474 | sizeof(struct ntlmv2_resp) - CIFS_SERVER_CHALLENGE_SIZE); | ||
475 | |||
476 | if (server->tilen) | ||
477 | crypto_shash_update(&server->ntlmssp.sdeschmacmd5->shash, | ||
478 | server->tiblob, server->tilen); | ||
479 | |||
480 | rc = crypto_shash_final(&server->ntlmssp.sdeschmacmd5->shash, | ||
481 | v2_session_response); | ||
482 | |||
483 | return rc; | ||
484 | } | ||
485 | |||
486 | int | ||
487 | setup_ntlmv2_rsp(struct cifsSesInfo *ses, char *resp_buf, | ||
488 | const struct nls_table *nls_cp) | 325 | const struct nls_table *nls_cp) |
489 | { | 326 | { |
490 | int rc = 0; | 327 | int rc; |
491 | struct ntlmv2_resp *buf = (struct ntlmv2_resp *)resp_buf; | 328 | struct ntlmv2_resp *buf = (struct ntlmv2_resp *)resp_buf; |
329 | struct HMACMD5Context context; | ||
492 | 330 | ||
493 | buf->blob_signature = cpu_to_le32(0x00000101); | 331 | buf->blob_signature = cpu_to_le32(0x00000101); |
494 | buf->reserved = 0; | 332 | buf->reserved = 0; |
495 | buf->time = cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME)); | 333 | buf->time = cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME)); |
496 | get_random_bytes(&buf->client_chal, sizeof(buf->client_chal)); | 334 | get_random_bytes(&buf->client_chal, sizeof(buf->client_chal)); |
497 | buf->reserved2 = 0; | 335 | buf->reserved2 = 0; |
498 | 336 | buf->names[0].type = cpu_to_le16(NTLMSSP_DOMAIN_TYPE); | |
499 | if (!ses->domainName) { | 337 | buf->names[0].length = 0; |
500 | rc = find_domain_name(ses); | 338 | buf->names[1].type = 0; |
501 | if (rc) { | 339 | buf->names[1].length = 0; |
502 | cERROR(1, "could not get domain/server name rc %d", rc); | ||
503 | return rc; | ||
504 | } | ||
505 | } | ||
506 | 340 | ||
507 | /* calculate buf->ntlmv2_hash */ | 341 | /* calculate buf->ntlmv2_hash */ |
508 | rc = calc_ntlmv2_hash(ses, nls_cp); | 342 | rc = calc_ntlmv2_hash(ses, nls_cp); |
509 | if (rc) { | 343 | if (rc) |
510 | cERROR(1, "could not get v2 hash rc %d", rc); | ||
511 | return rc; | ||
512 | } | ||
513 | rc = CalcNTLMv2_response(ses->server, resp_buf); | ||
514 | if (rc) { | ||
515 | cERROR(1, "could not get v2 hash rc %d", rc); | 344 | cERROR(1, "could not get v2 hash rc %d", rc); |
516 | return rc; | 345 | CalcNTLMv2_response(ses, resp_buf); |
517 | } | ||
518 | |||
519 | if (!ses->server->ntlmssp.sdeschmacmd5) { | ||
520 | cERROR(1, "calc_ntlmv2_hash: can't generate ntlmv2 hash\n"); | ||
521 | return -1; | ||
522 | } | ||
523 | |||
524 | crypto_shash_setkey(ses->server->ntlmssp.hmacmd5, | ||
525 | ses->server->ntlmv2_hash, CIFS_HMAC_MD5_HASH_SIZE); | ||
526 | 346 | ||
527 | rc = crypto_shash_init(&ses->server->ntlmssp.sdeschmacmd5->shash); | 347 | /* now calculate the MAC key for NTLMv2 */ |
528 | if (rc) { | 348 | hmac_md5_init_limK_to_64(ses->server->ntlmv2_hash, 16, &context); |
529 | cERROR(1, "setup_ntlmv2_rsp: could not init hmacmd5\n"); | 349 | hmac_md5_update(resp_buf, 16, &context); |
530 | return rc; | 350 | hmac_md5_final(ses->server->mac_signing_key.data.ntlmv2.key, &context); |
531 | } | ||
532 | 351 | ||
533 | crypto_shash_update(&ses->server->ntlmssp.sdeschmacmd5->shash, | 352 | memcpy(&ses->server->mac_signing_key.data.ntlmv2.resp, resp_buf, |
534 | resp_buf, CIFS_HMAC_MD5_HASH_SIZE); | 353 | sizeof(struct ntlmv2_resp)); |
535 | 354 | ses->server->mac_signing_key.len = 16 + sizeof(struct ntlmv2_resp); | |
536 | rc = crypto_shash_final(&ses->server->ntlmssp.sdeschmacmd5->shash, | ||
537 | ses->server->session_key.data.ntlmv2.key); | ||
538 | |||
539 | memcpy(&ses->server->session_key.data.ntlmv2.resp, resp_buf, | ||
540 | sizeof(struct ntlmv2_resp)); | ||
541 | ses->server->session_key.len = 16 + sizeof(struct ntlmv2_resp); | ||
542 | |||
543 | return rc; | ||
544 | } | 355 | } |
545 | 356 | ||
546 | int | 357 | void CalcNTLMv2_response(const struct cifsSesInfo *ses, |
547 | calc_seckey(struct TCP_Server_Info *server) | 358 | char *v2_session_response) |
548 | { | ||
549 | int rc; | ||
550 | unsigned char sec_key[CIFS_NTLMV2_SESSKEY_SIZE]; | ||
551 | struct crypto_blkcipher *tfm_arc4; | ||
552 | struct scatterlist sgin, sgout; | ||
553 | struct blkcipher_desc desc; | ||
554 | |||
555 | get_random_bytes(sec_key, CIFS_NTLMV2_SESSKEY_SIZE); | ||
556 | |||
557 | tfm_arc4 = crypto_alloc_blkcipher("ecb(arc4)", | ||
558 | 0, CRYPTO_ALG_ASYNC); | ||
559 | if (!tfm_arc4 || IS_ERR(tfm_arc4)) { | ||
560 | cERROR(1, "could not allocate " "master crypto API arc4\n"); | ||
561 | return 1; | ||
562 | } | ||
563 | |||
564 | desc.tfm = tfm_arc4; | ||
565 | |||
566 | crypto_blkcipher_setkey(tfm_arc4, | ||
567 | server->session_key.data.ntlmv2.key, CIFS_CPHTXT_SIZE); | ||
568 | sg_init_one(&sgin, sec_key, CIFS_CPHTXT_SIZE); | ||
569 | sg_init_one(&sgout, server->ntlmssp.ciphertext, CIFS_CPHTXT_SIZE); | ||
570 | rc = crypto_blkcipher_encrypt(&desc, &sgout, &sgin, CIFS_CPHTXT_SIZE); | ||
571 | |||
572 | if (!rc) | ||
573 | memcpy(server->session_key.data.ntlmv2.key, | ||
574 | sec_key, CIFS_NTLMV2_SESSKEY_SIZE); | ||
575 | |||
576 | crypto_free_blkcipher(tfm_arc4); | ||
577 | |||
578 | return 0; | ||
579 | } | ||
580 | |||
581 | void | ||
582 | cifs_crypto_shash_release(struct TCP_Server_Info *server) | ||
583 | { | ||
584 | if (server->ntlmssp.md5) | ||
585 | crypto_free_shash(server->ntlmssp.md5); | ||
586 | |||
587 | if (server->ntlmssp.hmacmd5) | ||
588 | crypto_free_shash(server->ntlmssp.hmacmd5); | ||
589 | |||
590 | kfree(server->ntlmssp.sdeschmacmd5); | ||
591 | |||
592 | kfree(server->ntlmssp.sdescmd5); | ||
593 | } | ||
594 | |||
595 | int | ||
596 | cifs_crypto_shash_allocate(struct TCP_Server_Info *server) | ||
597 | { | 359 | { |
598 | int rc; | 360 | struct HMACMD5Context context; |
599 | unsigned int size; | 361 | /* rest of v2 struct already generated */ |
600 | 362 | memcpy(v2_session_response + 8, ses->server->cryptKey, 8); | |
601 | server->ntlmssp.hmacmd5 = crypto_alloc_shash("hmac(md5)", 0, 0); | 363 | hmac_md5_init_limK_to_64(ses->server->ntlmv2_hash, 16, &context); |
602 | if (!server->ntlmssp.hmacmd5 || | ||
603 | IS_ERR(server->ntlmssp.hmacmd5)) { | ||
604 | cERROR(1, "could not allocate crypto hmacmd5\n"); | ||
605 | return 1; | ||
606 | } | ||
607 | |||
608 | server->ntlmssp.md5 = crypto_alloc_shash("md5", 0, 0); | ||
609 | if (!server->ntlmssp.md5 || IS_ERR(server->ntlmssp.md5)) { | ||
610 | cERROR(1, "could not allocate crypto md5\n"); | ||
611 | rc = 1; | ||
612 | goto cifs_crypto_shash_allocate_ret1; | ||
613 | } | ||
614 | |||
615 | size = sizeof(struct shash_desc) + | ||
616 | crypto_shash_descsize(server->ntlmssp.hmacmd5); | ||
617 | server->ntlmssp.sdeschmacmd5 = kmalloc(size, GFP_KERNEL); | ||
618 | if (!server->ntlmssp.sdeschmacmd5) { | ||
619 | cERROR(1, "cifs_crypto_shash_allocate: can't alloc hmacmd5\n"); | ||
620 | rc = -ENOMEM; | ||
621 | goto cifs_crypto_shash_allocate_ret2; | ||
622 | } | ||
623 | server->ntlmssp.sdeschmacmd5->shash.tfm = server->ntlmssp.hmacmd5; | ||
624 | server->ntlmssp.sdeschmacmd5->shash.flags = 0x0; | ||
625 | 364 | ||
365 | hmac_md5_update(v2_session_response+8, | ||
366 | sizeof(struct ntlmv2_resp) - 8, &context); | ||
626 | 367 | ||
627 | size = sizeof(struct shash_desc) + | 368 | hmac_md5_final(v2_session_response, &context); |
628 | crypto_shash_descsize(server->ntlmssp.md5); | 369 | /* cifs_dump_mem("v2_sess_rsp: ", v2_session_response, 32); */ |
629 | server->ntlmssp.sdescmd5 = kmalloc(size, GFP_KERNEL); | ||
630 | if (!server->ntlmssp.sdescmd5) { | ||
631 | cERROR(1, "cifs_crypto_shash_allocate: can't alloc md5\n"); | ||
632 | rc = -ENOMEM; | ||
633 | goto cifs_crypto_shash_allocate_ret3; | ||
634 | } | ||
635 | server->ntlmssp.sdescmd5->shash.tfm = server->ntlmssp.md5; | ||
636 | server->ntlmssp.sdescmd5->shash.flags = 0x0; | ||
637 | |||
638 | return 0; | ||
639 | |||
640 | cifs_crypto_shash_allocate_ret3: | ||
641 | kfree(server->ntlmssp.sdeschmacmd5); | ||
642 | |||
643 | cifs_crypto_shash_allocate_ret2: | ||
644 | crypto_free_shash(server->ntlmssp.md5); | ||
645 | |||
646 | cifs_crypto_shash_allocate_ret1: | ||
647 | crypto_free_shash(server->ntlmssp.hmacmd5); | ||
648 | |||
649 | return rc; | ||
650 | } | 370 | } |
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index c9d0cfc086eb..0cdfb8c32ac6 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -25,9 +25,6 @@ | |||
25 | #include <linux/workqueue.h> | 25 | #include <linux/workqueue.h> |
26 | #include "cifs_fs_sb.h" | 26 | #include "cifs_fs_sb.h" |
27 | #include "cifsacl.h" | 27 | #include "cifsacl.h" |
28 | #include <crypto/internal/hash.h> | ||
29 | #include <linux/scatterlist.h> | ||
30 | |||
31 | /* | 28 | /* |
32 | * The sizes of various internal tables and strings | 29 | * The sizes of various internal tables and strings |
33 | */ | 30 | */ |
@@ -100,7 +97,7 @@ enum protocolEnum { | |||
100 | /* Netbios frames protocol not supported at this time */ | 97 | /* Netbios frames protocol not supported at this time */ |
101 | }; | 98 | }; |
102 | 99 | ||
103 | struct session_key { | 100 | struct mac_key { |
104 | unsigned int len; | 101 | unsigned int len; |
105 | union { | 102 | union { |
106 | char ntlm[CIFS_SESS_KEY_SIZE + 16]; | 103 | char ntlm[CIFS_SESS_KEY_SIZE + 16]; |
@@ -123,21 +120,6 @@ struct cifs_cred { | |||
123 | struct cifs_ace *aces; | 120 | struct cifs_ace *aces; |
124 | }; | 121 | }; |
125 | 122 | ||
126 | struct sdesc { | ||
127 | struct shash_desc shash; | ||
128 | char ctx[]; | ||
129 | }; | ||
130 | |||
131 | struct ntlmssp_auth { | ||
132 | __u32 client_flags; | ||
133 | __u32 server_flags; | ||
134 | unsigned char ciphertext[CIFS_CPHTXT_SIZE]; | ||
135 | struct crypto_shash *hmacmd5; | ||
136 | struct crypto_shash *md5; | ||
137 | struct sdesc *sdeschmacmd5; | ||
138 | struct sdesc *sdescmd5; | ||
139 | }; | ||
140 | |||
141 | /* | 123 | /* |
142 | ***************************************************************** | 124 | ***************************************************************** |
143 | * Except the CIFS PDUs themselves all the | 125 | * Except the CIFS PDUs themselves all the |
@@ -200,14 +182,11 @@ struct TCP_Server_Info { | |||
200 | /* 16th byte of RFC1001 workstation name is always null */ | 182 | /* 16th byte of RFC1001 workstation name is always null */ |
201 | char workstation_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL]; | 183 | char workstation_RFC1001_name[RFC1001_NAME_LEN_WITH_NULL]; |
202 | __u32 sequence_number; /* needed for CIFS PDU signature */ | 184 | __u32 sequence_number; /* needed for CIFS PDU signature */ |
203 | struct session_key session_key; | 185 | struct mac_key mac_signing_key; |
204 | char ntlmv2_hash[16]; | 186 | char ntlmv2_hash[16]; |
205 | unsigned long lstrp; /* when we got last response from this server */ | 187 | unsigned long lstrp; /* when we got last response from this server */ |
206 | u16 dialect; /* dialect index that server chose */ | 188 | u16 dialect; /* dialect index that server chose */ |
207 | /* extended security flavors that server supports */ | 189 | /* extended security flavors that server supports */ |
208 | unsigned int tilen; /* length of the target info blob */ | ||
209 | unsigned char *tiblob; /* target info blob in challenge response */ | ||
210 | struct ntlmssp_auth ntlmssp; /* various keys, ciphers, flags */ | ||
211 | bool sec_kerberos; /* supports plain Kerberos */ | 190 | bool sec_kerberos; /* supports plain Kerberos */ |
212 | bool sec_mskerberos; /* supports legacy MS Kerberos */ | 191 | bool sec_mskerberos; /* supports legacy MS Kerberos */ |
213 | bool sec_kerberosu2u; /* supports U2U Kerberos */ | 192 | bool sec_kerberosu2u; /* supports U2U Kerberos */ |
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h index 320e0fd0ba7b..14d036d8db11 100644 --- a/fs/cifs/cifspdu.h +++ b/fs/cifs/cifspdu.h | |||
@@ -134,12 +134,6 @@ | |||
134 | * Size of the session key (crypto key encrypted with the password | 134 | * Size of the session key (crypto key encrypted with the password |
135 | */ | 135 | */ |
136 | #define CIFS_SESS_KEY_SIZE (24) | 136 | #define CIFS_SESS_KEY_SIZE (24) |
137 | #define CIFS_CLIENT_CHALLENGE_SIZE (8) | ||
138 | #define CIFS_SERVER_CHALLENGE_SIZE (8) | ||
139 | #define CIFS_HMAC_MD5_HASH_SIZE (16) | ||
140 | #define CIFS_CPHTXT_SIZE (16) | ||
141 | #define CIFS_NTLMV2_SESSKEY_SIZE (16) | ||
142 | #define CIFS_NTHASH_SIZE (16) | ||
143 | 137 | ||
144 | /* | 138 | /* |
145 | * Maximum user name length | 139 | * Maximum user name length |
@@ -669,6 +663,7 @@ struct ntlmv2_resp { | |||
669 | __le64 time; | 663 | __le64 time; |
670 | __u64 client_chal; /* random */ | 664 | __u64 client_chal; /* random */ |
671 | __u32 reserved2; | 665 | __u32 reserved2; |
666 | struct ntlmssp2_name names[2]; | ||
672 | /* array of name entries could follow ending in minimum 4 byte struct */ | 667 | /* array of name entries could follow ending in minimum 4 byte struct */ |
673 | } __attribute__((packed)); | 668 | } __attribute__((packed)); |
674 | 669 | ||
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 1378d9133844..1d60c655e3e0 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -87,8 +87,9 @@ extern unsigned int smbCalcSize_LE(struct smb_hdr *ptr); | |||
87 | extern int decode_negTokenInit(unsigned char *security_blob, int length, | 87 | extern int decode_negTokenInit(unsigned char *security_blob, int length, |
88 | struct TCP_Server_Info *server); | 88 | struct TCP_Server_Info *server); |
89 | extern int cifs_convert_address(struct sockaddr *dst, const char *src, int len); | 89 | extern int cifs_convert_address(struct sockaddr *dst, const char *src, int len); |
90 | extern int cifs_set_port(struct sockaddr *addr, const unsigned short int port); | ||
90 | extern int cifs_fill_sockaddr(struct sockaddr *dst, const char *src, int len, | 91 | extern int cifs_fill_sockaddr(struct sockaddr *dst, const char *src, int len, |
91 | unsigned short int port); | 92 | const unsigned short int port); |
92 | extern int map_smb_to_linux_error(struct smb_hdr *smb, int logErr); | 93 | extern int map_smb_to_linux_error(struct smb_hdr *smb, int logErr); |
93 | extern void header_assemble(struct smb_hdr *, char /* command */ , | 94 | extern void header_assemble(struct smb_hdr *, char /* command */ , |
94 | const struct cifsTconInfo *, int /* length of | 95 | const struct cifsTconInfo *, int /* length of |
@@ -361,15 +362,13 @@ extern int cifs_sign_smb(struct smb_hdr *, struct TCP_Server_Info *, __u32 *); | |||
361 | extern int cifs_sign_smb2(struct kvec *iov, int n_vec, struct TCP_Server_Info *, | 362 | extern int cifs_sign_smb2(struct kvec *iov, int n_vec, struct TCP_Server_Info *, |
362 | __u32 *); | 363 | __u32 *); |
363 | extern int cifs_verify_signature(struct smb_hdr *, | 364 | extern int cifs_verify_signature(struct smb_hdr *, |
364 | struct TCP_Server_Info *server, | 365 | const struct mac_key *mac_key, |
365 | __u32 expected_sequence_number); | 366 | __u32 expected_sequence_number); |
366 | extern int cifs_calculate_session_key(struct session_key *key, const char *rn, | 367 | extern int cifs_calculate_mac_key(struct mac_key *key, const char *rn, |
367 | const char *pass); | 368 | const char *pass); |
368 | extern int setup_ntlmv2_rsp(struct cifsSesInfo *, char *, | 369 | extern void CalcNTLMv2_response(const struct cifsSesInfo *, char *); |
370 | extern void setup_ntlmv2_rsp(struct cifsSesInfo *, char *, | ||
369 | const struct nls_table *); | 371 | const struct nls_table *); |
370 | extern int cifs_crypto_shash_allocate(struct TCP_Server_Info *); | ||
371 | extern void cifs_crypto_shash_release(struct TCP_Server_Info *); | ||
372 | extern int calc_seckey(struct TCP_Server_Info *); | ||
373 | #ifdef CONFIG_CIFS_WEAK_PW_HASH | 372 | #ifdef CONFIG_CIFS_WEAK_PW_HASH |
374 | extern void calc_lanman_hash(const char *password, const char *cryptkey, | 373 | extern void calc_lanman_hash(const char *password, const char *cryptkey, |
375 | bool encrypt, char *lnm_session_key); | 374 | bool encrypt, char *lnm_session_key); |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 4bda920d1f75..c65c3419dd37 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -604,14 +604,11 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) | |||
604 | else | 604 | else |
605 | rc = -EINVAL; | 605 | rc = -EINVAL; |
606 | 606 | ||
607 | if (server->secType == Kerberos) { | 607 | if (server->sec_kerberos || server->sec_mskerberos) |
608 | if (!server->sec_kerberos && | 608 | server->secType = Kerberos; |
609 | !server->sec_mskerberos) | 609 | else if (server->sec_ntlmssp) |
610 | rc = -EOPNOTSUPP; | 610 | server->secType = RawNTLMSSP; |
611 | } else if (server->secType == RawNTLMSSP) { | 611 | else |
612 | if (!server->sec_ntlmssp) | ||
613 | rc = -EOPNOTSUPP; | ||
614 | } else | ||
615 | rc = -EOPNOTSUPP; | 612 | rc = -EOPNOTSUPP; |
616 | } | 613 | } |
617 | } else | 614 | } else |
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index ec0ea4a43bdb..88c84a38bccb 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -400,7 +400,9 @@ incomplete_rcv: | |||
400 | cFYI(1, "call to reconnect done"); | 400 | cFYI(1, "call to reconnect done"); |
401 | csocket = server->ssocket; | 401 | csocket = server->ssocket; |
402 | continue; | 402 | continue; |
403 | } else if ((length == -ERESTARTSYS) || (length == -EAGAIN)) { | 403 | } else if (length == -ERESTARTSYS || |
404 | length == -EAGAIN || | ||
405 | length == -EINTR) { | ||
404 | msleep(1); /* minimum sleep to prevent looping | 406 | msleep(1); /* minimum sleep to prevent looping |
405 | allowing socket to clear and app threads to set | 407 | allowing socket to clear and app threads to set |
406 | tcpStatus CifsNeedReconnect if server hung */ | 408 | tcpStatus CifsNeedReconnect if server hung */ |
@@ -414,18 +416,6 @@ incomplete_rcv: | |||
414 | } else | 416 | } else |
415 | continue; | 417 | continue; |
416 | } else if (length <= 0) { | 418 | } else if (length <= 0) { |
417 | if (server->tcpStatus == CifsNew) { | ||
418 | cFYI(1, "tcp session abend after SMBnegprot"); | ||
419 | /* some servers kill the TCP session rather than | ||
420 | returning an SMB negprot error, in which | ||
421 | case reconnecting here is not going to help, | ||
422 | and so simply return error to mount */ | ||
423 | break; | ||
424 | } | ||
425 | if (!try_to_freeze() && (length == -EINTR)) { | ||
426 | cFYI(1, "cifsd thread killed"); | ||
427 | break; | ||
428 | } | ||
429 | cFYI(1, "Reconnect after unexpected peek error %d", | 419 | cFYI(1, "Reconnect after unexpected peek error %d", |
430 | length); | 420 | length); |
431 | cifs_reconnect(server); | 421 | cifs_reconnect(server); |
@@ -466,27 +456,19 @@ incomplete_rcv: | |||
466 | an error on SMB negprot response */ | 456 | an error on SMB negprot response */ |
467 | cFYI(1, "Negative RFC1002 Session Response Error 0x%x)", | 457 | cFYI(1, "Negative RFC1002 Session Response Error 0x%x)", |
468 | pdu_length); | 458 | pdu_length); |
469 | if (server->tcpStatus == CifsNew) { | 459 | /* give server a second to clean up */ |
470 | /* if nack on negprot (rather than | 460 | msleep(1000); |
471 | ret of smb negprot error) reconnecting | 461 | /* always try 445 first on reconnect since we get NACK |
472 | not going to help, ret error to mount */ | 462 | * on some if we ever connected to port 139 (the NACK |
473 | break; | 463 | * is since we do not begin with RFC1001 session |
474 | } else { | 464 | * initialize frame) |
475 | /* give server a second to | 465 | */ |
476 | clean up before reconnect attempt */ | 466 | cifs_set_port((struct sockaddr *) |
477 | msleep(1000); | 467 | &server->addr.sockAddr, CIFS_PORT); |
478 | /* always try 445 first on reconnect | 468 | cifs_reconnect(server); |
479 | since we get NACK on some if we ever | 469 | csocket = server->ssocket; |
480 | connected to port 139 (the NACK is | 470 | wake_up(&server->response_q); |
481 | since we do not begin with RFC1001 | 471 | continue; |
482 | session initialize frame) */ | ||
483 | server->addr.sockAddr.sin_port = | ||
484 | htons(CIFS_PORT); | ||
485 | cifs_reconnect(server); | ||
486 | csocket = server->ssocket; | ||
487 | wake_up(&server->response_q); | ||
488 | continue; | ||
489 | } | ||
490 | } else if (temp != (char) 0) { | 472 | } else if (temp != (char) 0) { |
491 | cERROR(1, "Unknown RFC 1002 frame"); | 473 | cERROR(1, "Unknown RFC 1002 frame"); |
492 | cifs_dump_mem(" Received Data: ", (char *)smb_buffer, | 474 | cifs_dump_mem(" Received Data: ", (char *)smb_buffer, |
@@ -522,8 +504,7 @@ incomplete_rcv: | |||
522 | total_read += length) { | 504 | total_read += length) { |
523 | length = kernel_recvmsg(csocket, &smb_msg, &iov, 1, | 505 | length = kernel_recvmsg(csocket, &smb_msg, &iov, 1, |
524 | pdu_length - total_read, 0); | 506 | pdu_length - total_read, 0); |
525 | if ((server->tcpStatus == CifsExiting) || | 507 | if (server->tcpStatus == CifsExiting) { |
526 | (length == -EINTR)) { | ||
527 | /* then will exit */ | 508 | /* then will exit */ |
528 | reconnect = 2; | 509 | reconnect = 2; |
529 | break; | 510 | break; |
@@ -534,8 +515,9 @@ incomplete_rcv: | |||
534 | /* Now we will reread sock */ | 515 | /* Now we will reread sock */ |
535 | reconnect = 1; | 516 | reconnect = 1; |
536 | break; | 517 | break; |
537 | } else if ((length == -ERESTARTSYS) || | 518 | } else if (length == -ERESTARTSYS || |
538 | (length == -EAGAIN)) { | 519 | length == -EAGAIN || |
520 | length == -EINTR) { | ||
539 | msleep(1); /* minimum sleep to prevent looping, | 521 | msleep(1); /* minimum sleep to prevent looping, |
540 | allowing socket to clear and app | 522 | allowing socket to clear and app |
541 | threads to set tcpStatus | 523 | threads to set tcpStatus |
@@ -1708,7 +1690,6 @@ cifs_put_smb_ses(struct cifsSesInfo *ses) | |||
1708 | CIFSSMBLogoff(xid, ses); | 1690 | CIFSSMBLogoff(xid, ses); |
1709 | _FreeXid(xid); | 1691 | _FreeXid(xid); |
1710 | } | 1692 | } |
1711 | cifs_crypto_shash_release(server); | ||
1712 | sesInfoFree(ses); | 1693 | sesInfoFree(ses); |
1713 | cifs_put_tcp_session(server); | 1694 | cifs_put_tcp_session(server); |
1714 | } | 1695 | } |
@@ -1725,9 +1706,6 @@ cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb_vol *volume_info) | |||
1725 | if (ses) { | 1706 | if (ses) { |
1726 | cFYI(1, "Existing smb sess found (status=%d)", ses->status); | 1707 | cFYI(1, "Existing smb sess found (status=%d)", ses->status); |
1727 | 1708 | ||
1728 | /* existing SMB ses has a server reference already */ | ||
1729 | cifs_put_tcp_session(server); | ||
1730 | |||
1731 | mutex_lock(&ses->session_mutex); | 1709 | mutex_lock(&ses->session_mutex); |
1732 | rc = cifs_negotiate_protocol(xid, ses); | 1710 | rc = cifs_negotiate_protocol(xid, ses); |
1733 | if (rc) { | 1711 | if (rc) { |
@@ -1750,6 +1728,9 @@ cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb_vol *volume_info) | |||
1750 | } | 1728 | } |
1751 | } | 1729 | } |
1752 | mutex_unlock(&ses->session_mutex); | 1730 | mutex_unlock(&ses->session_mutex); |
1731 | |||
1732 | /* existing SMB ses has a server reference already */ | ||
1733 | cifs_put_tcp_session(server); | ||
1753 | FreeXid(xid); | 1734 | FreeXid(xid); |
1754 | return ses; | 1735 | return ses; |
1755 | } | 1736 | } |
@@ -1788,23 +1769,13 @@ cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb_vol *volume_info) | |||
1788 | ses->linux_uid = volume_info->linux_uid; | 1769 | ses->linux_uid = volume_info->linux_uid; |
1789 | ses->overrideSecFlg = volume_info->secFlg; | 1770 | ses->overrideSecFlg = volume_info->secFlg; |
1790 | 1771 | ||
1791 | rc = cifs_crypto_shash_allocate(server); | ||
1792 | if (rc) { | ||
1793 | cERROR(1, "could not setup hash structures rc %d", rc); | ||
1794 | goto get_ses_fail; | ||
1795 | } | ||
1796 | server->tilen = 0; | ||
1797 | server->tiblob = NULL; | ||
1798 | |||
1799 | mutex_lock(&ses->session_mutex); | 1772 | mutex_lock(&ses->session_mutex); |
1800 | rc = cifs_negotiate_protocol(xid, ses); | 1773 | rc = cifs_negotiate_protocol(xid, ses); |
1801 | if (!rc) | 1774 | if (!rc) |
1802 | rc = cifs_setup_session(xid, ses, volume_info->local_nls); | 1775 | rc = cifs_setup_session(xid, ses, volume_info->local_nls); |
1803 | mutex_unlock(&ses->session_mutex); | 1776 | mutex_unlock(&ses->session_mutex); |
1804 | if (rc) { | 1777 | if (rc) |
1805 | cifs_crypto_shash_release(ses->server); | ||
1806 | goto get_ses_fail; | 1778 | goto get_ses_fail; |
1807 | } | ||
1808 | 1779 | ||
1809 | /* success, put it on the list */ | 1780 | /* success, put it on the list */ |
1810 | write_lock(&cifs_tcp_ses_lock); | 1781 | write_lock(&cifs_tcp_ses_lock); |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 86a164f08a74..93f77d438d3c 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -1462,29 +1462,18 @@ int cifs_rename(struct inode *source_dir, struct dentry *source_dentry, | |||
1462 | { | 1462 | { |
1463 | char *fromName = NULL; | 1463 | char *fromName = NULL; |
1464 | char *toName = NULL; | 1464 | char *toName = NULL; |
1465 | struct cifs_sb_info *cifs_sb_source; | 1465 | struct cifs_sb_info *cifs_sb; |
1466 | struct cifs_sb_info *cifs_sb_target; | ||
1467 | struct cifsTconInfo *tcon; | 1466 | struct cifsTconInfo *tcon; |
1468 | FILE_UNIX_BASIC_INFO *info_buf_source = NULL; | 1467 | FILE_UNIX_BASIC_INFO *info_buf_source = NULL; |
1469 | FILE_UNIX_BASIC_INFO *info_buf_target; | 1468 | FILE_UNIX_BASIC_INFO *info_buf_target; |
1470 | int xid, rc, tmprc; | 1469 | int xid, rc, tmprc; |
1471 | 1470 | ||
1472 | cifs_sb_target = CIFS_SB(target_dir->i_sb); | 1471 | cifs_sb = CIFS_SB(source_dir->i_sb); |
1473 | cifs_sb_source = CIFS_SB(source_dir->i_sb); | 1472 | tcon = cifs_sb->tcon; |
1474 | tcon = cifs_sb_source->tcon; | ||
1475 | 1473 | ||
1476 | xid = GetXid(); | 1474 | xid = GetXid(); |
1477 | 1475 | ||
1478 | /* | 1476 | /* |
1479 | * BB: this might be allowed if same server, but different share. | ||
1480 | * Consider adding support for this | ||
1481 | */ | ||
1482 | if (tcon != cifs_sb_target->tcon) { | ||
1483 | rc = -EXDEV; | ||
1484 | goto cifs_rename_exit; | ||
1485 | } | ||
1486 | |||
1487 | /* | ||
1488 | * we already have the rename sem so we do not need to | 1477 | * we already have the rename sem so we do not need to |
1489 | * grab it again here to protect the path integrity | 1478 | * grab it again here to protect the path integrity |
1490 | */ | 1479 | */ |
@@ -1519,17 +1508,16 @@ int cifs_rename(struct inode *source_dir, struct dentry *source_dentry, | |||
1519 | info_buf_target = info_buf_source + 1; | 1508 | info_buf_target = info_buf_source + 1; |
1520 | tmprc = CIFSSMBUnixQPathInfo(xid, tcon, fromName, | 1509 | tmprc = CIFSSMBUnixQPathInfo(xid, tcon, fromName, |
1521 | info_buf_source, | 1510 | info_buf_source, |
1522 | cifs_sb_source->local_nls, | 1511 | cifs_sb->local_nls, |
1523 | cifs_sb_source->mnt_cifs_flags & | 1512 | cifs_sb->mnt_cifs_flags & |
1524 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 1513 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
1525 | if (tmprc != 0) | 1514 | if (tmprc != 0) |
1526 | goto unlink_target; | 1515 | goto unlink_target; |
1527 | 1516 | ||
1528 | tmprc = CIFSSMBUnixQPathInfo(xid, tcon, | 1517 | tmprc = CIFSSMBUnixQPathInfo(xid, tcon, toName, |
1529 | toName, info_buf_target, | 1518 | info_buf_target, |
1530 | cifs_sb_target->local_nls, | 1519 | cifs_sb->local_nls, |
1531 | /* remap based on source sb */ | 1520 | cifs_sb->mnt_cifs_flags & |
1532 | cifs_sb_source->mnt_cifs_flags & | ||
1533 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 1521 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
1534 | 1522 | ||
1535 | if (tmprc == 0 && (info_buf_source->UniqueId == | 1523 | if (tmprc == 0 && (info_buf_source->UniqueId == |
diff --git a/fs/cifs/netmisc.c b/fs/cifs/netmisc.c index f97851119e6c..9aad47a2d62f 100644 --- a/fs/cifs/netmisc.c +++ b/fs/cifs/netmisc.c | |||
@@ -206,26 +206,30 @@ cifs_convert_address(struct sockaddr *dst, const char *src, int len) | |||
206 | } | 206 | } |
207 | 207 | ||
208 | int | 208 | int |
209 | cifs_fill_sockaddr(struct sockaddr *dst, const char *src, int len, | 209 | cifs_set_port(struct sockaddr *addr, const unsigned short int port) |
210 | const unsigned short int port) | ||
211 | { | 210 | { |
212 | if (!cifs_convert_address(dst, src, len)) | 211 | switch (addr->sa_family) { |
213 | return 0; | ||
214 | |||
215 | switch (dst->sa_family) { | ||
216 | case AF_INET: | 212 | case AF_INET: |
217 | ((struct sockaddr_in *)dst)->sin_port = htons(port); | 213 | ((struct sockaddr_in *)addr)->sin_port = htons(port); |
218 | break; | 214 | break; |
219 | case AF_INET6: | 215 | case AF_INET6: |
220 | ((struct sockaddr_in6 *)dst)->sin6_port = htons(port); | 216 | ((struct sockaddr_in6 *)addr)->sin6_port = htons(port); |
221 | break; | 217 | break; |
222 | default: | 218 | default: |
223 | return 0; | 219 | return 0; |
224 | } | 220 | } |
225 | |||
226 | return 1; | 221 | return 1; |
227 | } | 222 | } |
228 | 223 | ||
224 | int | ||
225 | cifs_fill_sockaddr(struct sockaddr *dst, const char *src, int len, | ||
226 | const unsigned short int port) | ||
227 | { | ||
228 | if (!cifs_convert_address(dst, src, len)) | ||
229 | return 0; | ||
230 | return cifs_set_port(dst, port); | ||
231 | } | ||
232 | |||
229 | /***************************************************************************** | 233 | /***************************************************************************** |
230 | convert a NT status code to a dos class/code | 234 | convert a NT status code to a dos class/code |
231 | *****************************************************************************/ | 235 | *****************************************************************************/ |
diff --git a/fs/cifs/ntlmssp.h b/fs/cifs/ntlmssp.h index 1db0f0746a5b..49c9a4e75319 100644 --- a/fs/cifs/ntlmssp.h +++ b/fs/cifs/ntlmssp.h | |||
@@ -61,19 +61,6 @@ | |||
61 | #define NTLMSSP_NEGOTIATE_KEY_XCH 0x40000000 | 61 | #define NTLMSSP_NEGOTIATE_KEY_XCH 0x40000000 |
62 | #define NTLMSSP_NEGOTIATE_56 0x80000000 | 62 | #define NTLMSSP_NEGOTIATE_56 0x80000000 |
63 | 63 | ||
64 | /* Define AV Pair Field IDs */ | ||
65 | #define NTLMSSP_AV_EOL 0 | ||
66 | #define NTLMSSP_AV_NB_COMPUTER_NAME 1 | ||
67 | #define NTLMSSP_AV_NB_DOMAIN_NAME 2 | ||
68 | #define NTLMSSP_AV_DNS_COMPUTER_NAME 3 | ||
69 | #define NTLMSSP_AV_DNS_DOMAIN_NAME 4 | ||
70 | #define NTLMSSP_AV_DNS_TREE_NAME 5 | ||
71 | #define NTLMSSP_AV_FLAGS 6 | ||
72 | #define NTLMSSP_AV_TIMESTAMP 7 | ||
73 | #define NTLMSSP_AV_RESTRICTION 8 | ||
74 | #define NTLMSSP_AV_TARGET_NAME 9 | ||
75 | #define NTLMSSP_AV_CHANNEL_BINDINGS 10 | ||
76 | |||
77 | /* Although typedefs are not commonly used for structure definitions */ | 64 | /* Although typedefs are not commonly used for structure definitions */ |
78 | /* in the Linux kernel, in this particular case they are useful */ | 65 | /* in the Linux kernel, in this particular case they are useful */ |
79 | /* to more closely match the standards document for NTLMSSP from */ | 66 | /* to more closely match the standards document for NTLMSSP from */ |
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index 795095f4eac6..0a57cb7db5dd 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c | |||
@@ -383,9 +383,6 @@ static int decode_ascii_ssetup(char **pbcc_area, int bleft, | |||
383 | static int decode_ntlmssp_challenge(char *bcc_ptr, int blob_len, | 383 | static int decode_ntlmssp_challenge(char *bcc_ptr, int blob_len, |
384 | struct cifsSesInfo *ses) | 384 | struct cifsSesInfo *ses) |
385 | { | 385 | { |
386 | unsigned int tioffset; /* challeng message target info area */ | ||
387 | unsigned int tilen; /* challeng message target info area length */ | ||
388 | |||
389 | CHALLENGE_MESSAGE *pblob = (CHALLENGE_MESSAGE *)bcc_ptr; | 386 | CHALLENGE_MESSAGE *pblob = (CHALLENGE_MESSAGE *)bcc_ptr; |
390 | 387 | ||
391 | if (blob_len < sizeof(CHALLENGE_MESSAGE)) { | 388 | if (blob_len < sizeof(CHALLENGE_MESSAGE)) { |
@@ -408,20 +405,6 @@ static int decode_ntlmssp_challenge(char *bcc_ptr, int blob_len, | |||
408 | /* BB spec says that if AvId field of MsvAvTimestamp is populated then | 405 | /* BB spec says that if AvId field of MsvAvTimestamp is populated then |
409 | we must set the MIC field of the AUTHENTICATE_MESSAGE */ | 406 | we must set the MIC field of the AUTHENTICATE_MESSAGE */ |
410 | 407 | ||
411 | ses->server->ntlmssp.server_flags = le32_to_cpu(pblob->NegotiateFlags); | ||
412 | |||
413 | tioffset = cpu_to_le16(pblob->TargetInfoArray.BufferOffset); | ||
414 | tilen = cpu_to_le16(pblob->TargetInfoArray.Length); | ||
415 | ses->server->tilen = tilen; | ||
416 | if (tilen) { | ||
417 | ses->server->tiblob = kmalloc(tilen, GFP_KERNEL); | ||
418 | if (!ses->server->tiblob) { | ||
419 | cERROR(1, "Challenge target info allocation failure"); | ||
420 | return -ENOMEM; | ||
421 | } | ||
422 | memcpy(ses->server->tiblob, bcc_ptr + tioffset, tilen); | ||
423 | } | ||
424 | |||
425 | return 0; | 408 | return 0; |
426 | } | 409 | } |
427 | 410 | ||
@@ -442,13 +425,12 @@ static void build_ntlmssp_negotiate_blob(unsigned char *pbuffer, | |||
442 | /* BB is NTLMV2 session security format easier to use here? */ | 425 | /* BB is NTLMV2 session security format easier to use here? */ |
443 | flags = NTLMSSP_NEGOTIATE_56 | NTLMSSP_REQUEST_TARGET | | 426 | flags = NTLMSSP_NEGOTIATE_56 | NTLMSSP_REQUEST_TARGET | |
444 | NTLMSSP_NEGOTIATE_128 | NTLMSSP_NEGOTIATE_UNICODE | | 427 | NTLMSSP_NEGOTIATE_128 | NTLMSSP_NEGOTIATE_UNICODE | |
445 | NTLMSSP_NEGOTIATE_NTLM; | 428 | NTLMSSP_NEGOTIATE_NT_ONLY | NTLMSSP_NEGOTIATE_NTLM; |
446 | if (ses->server->secMode & | 429 | if (ses->server->secMode & |
447 | (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) { | 430 | (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) |
448 | flags |= NTLMSSP_NEGOTIATE_SIGN | | 431 | flags |= NTLMSSP_NEGOTIATE_SIGN; |
449 | NTLMSSP_NEGOTIATE_KEY_XCH | | 432 | if (ses->server->secMode & SECMODE_SIGN_REQUIRED) |
450 | NTLMSSP_NEGOTIATE_EXTENDED_SEC; | 433 | flags |= NTLMSSP_NEGOTIATE_ALWAYS_SIGN; |
451 | } | ||
452 | 434 | ||
453 | sec_blob->NegotiateFlags |= cpu_to_le32(flags); | 435 | sec_blob->NegotiateFlags |= cpu_to_le32(flags); |
454 | 436 | ||
@@ -469,12 +451,10 @@ static int build_ntlmssp_auth_blob(unsigned char *pbuffer, | |||
469 | struct cifsSesInfo *ses, | 451 | struct cifsSesInfo *ses, |
470 | const struct nls_table *nls_cp, bool first) | 452 | const struct nls_table *nls_cp, bool first) |
471 | { | 453 | { |
472 | int rc; | ||
473 | unsigned int size; | ||
474 | AUTHENTICATE_MESSAGE *sec_blob = (AUTHENTICATE_MESSAGE *)pbuffer; | 454 | AUTHENTICATE_MESSAGE *sec_blob = (AUTHENTICATE_MESSAGE *)pbuffer; |
475 | __u32 flags; | 455 | __u32 flags; |
476 | unsigned char *tmp; | 456 | unsigned char *tmp; |
477 | struct ntlmv2_resp ntlmv2_response = {}; | 457 | char ntlm_session_key[CIFS_SESS_KEY_SIZE]; |
478 | 458 | ||
479 | memcpy(sec_blob->Signature, NTLMSSP_SIGNATURE, 8); | 459 | memcpy(sec_blob->Signature, NTLMSSP_SIGNATURE, 8); |
480 | sec_blob->MessageType = NtLmAuthenticate; | 460 | sec_blob->MessageType = NtLmAuthenticate; |
@@ -497,25 +477,19 @@ static int build_ntlmssp_auth_blob(unsigned char *pbuffer, | |||
497 | sec_blob->LmChallengeResponse.Length = 0; | 477 | sec_blob->LmChallengeResponse.Length = 0; |
498 | sec_blob->LmChallengeResponse.MaximumLength = 0; | 478 | sec_blob->LmChallengeResponse.MaximumLength = 0; |
499 | 479 | ||
500 | sec_blob->NtChallengeResponse.BufferOffset = cpu_to_le32(tmp - pbuffer); | 480 | /* calculate session key, BB what about adding similar ntlmv2 path? */ |
501 | rc = setup_ntlmv2_rsp(ses, (char *)&ntlmv2_response, nls_cp); | 481 | SMBNTencrypt(ses->password, ses->server->cryptKey, ntlm_session_key); |
502 | if (rc) { | 482 | if (first) |
503 | cERROR(1, "error rc: %d during ntlmssp ntlmv2 setup", rc); | 483 | cifs_calculate_mac_key(&ses->server->mac_signing_key, |
504 | goto setup_ntlmv2_ret; | 484 | ntlm_session_key, ses->password); |
505 | } | ||
506 | size = sizeof(struct ntlmv2_resp); | ||
507 | memcpy(tmp, (char *)&ntlmv2_response, size); | ||
508 | tmp += size; | ||
509 | if (ses->server->tilen > 0) { | ||
510 | memcpy(tmp, ses->server->tiblob, ses->server->tilen); | ||
511 | tmp += ses->server->tilen; | ||
512 | } else | ||
513 | ses->server->tilen = 0; | ||
514 | 485 | ||
515 | sec_blob->NtChallengeResponse.Length = cpu_to_le16(size + | 486 | memcpy(tmp, ntlm_session_key, CIFS_SESS_KEY_SIZE); |
516 | ses->server->tilen); | 487 | sec_blob->NtChallengeResponse.BufferOffset = cpu_to_le32(tmp - pbuffer); |
488 | sec_blob->NtChallengeResponse.Length = cpu_to_le16(CIFS_SESS_KEY_SIZE); | ||
517 | sec_blob->NtChallengeResponse.MaximumLength = | 489 | sec_blob->NtChallengeResponse.MaximumLength = |
518 | cpu_to_le16(size + ses->server->tilen); | 490 | cpu_to_le16(CIFS_SESS_KEY_SIZE); |
491 | |||
492 | tmp += CIFS_SESS_KEY_SIZE; | ||
519 | 493 | ||
520 | if (ses->domainName == NULL) { | 494 | if (ses->domainName == NULL) { |
521 | sec_blob->DomainName.BufferOffset = cpu_to_le32(tmp - pbuffer); | 495 | sec_blob->DomainName.BufferOffset = cpu_to_le32(tmp - pbuffer); |
@@ -527,6 +501,7 @@ static int build_ntlmssp_auth_blob(unsigned char *pbuffer, | |||
527 | len = cifs_strtoUCS((__le16 *)tmp, ses->domainName, | 501 | len = cifs_strtoUCS((__le16 *)tmp, ses->domainName, |
528 | MAX_USERNAME_SIZE, nls_cp); | 502 | MAX_USERNAME_SIZE, nls_cp); |
529 | len *= 2; /* unicode is 2 bytes each */ | 503 | len *= 2; /* unicode is 2 bytes each */ |
504 | len += 2; /* trailing null */ | ||
530 | sec_blob->DomainName.BufferOffset = cpu_to_le32(tmp - pbuffer); | 505 | sec_blob->DomainName.BufferOffset = cpu_to_le32(tmp - pbuffer); |
531 | sec_blob->DomainName.Length = cpu_to_le16(len); | 506 | sec_blob->DomainName.Length = cpu_to_le16(len); |
532 | sec_blob->DomainName.MaximumLength = cpu_to_le16(len); | 507 | sec_blob->DomainName.MaximumLength = cpu_to_le16(len); |
@@ -543,6 +518,7 @@ static int build_ntlmssp_auth_blob(unsigned char *pbuffer, | |||
543 | len = cifs_strtoUCS((__le16 *)tmp, ses->userName, | 518 | len = cifs_strtoUCS((__le16 *)tmp, ses->userName, |
544 | MAX_USERNAME_SIZE, nls_cp); | 519 | MAX_USERNAME_SIZE, nls_cp); |
545 | len *= 2; /* unicode is 2 bytes each */ | 520 | len *= 2; /* unicode is 2 bytes each */ |
521 | len += 2; /* trailing null */ | ||
546 | sec_blob->UserName.BufferOffset = cpu_to_le32(tmp - pbuffer); | 522 | sec_blob->UserName.BufferOffset = cpu_to_le32(tmp - pbuffer); |
547 | sec_blob->UserName.Length = cpu_to_le16(len); | 523 | sec_blob->UserName.Length = cpu_to_le16(len); |
548 | sec_blob->UserName.MaximumLength = cpu_to_le16(len); | 524 | sec_blob->UserName.MaximumLength = cpu_to_le16(len); |
@@ -554,26 +530,9 @@ static int build_ntlmssp_auth_blob(unsigned char *pbuffer, | |||
554 | sec_blob->WorkstationName.MaximumLength = 0; | 530 | sec_blob->WorkstationName.MaximumLength = 0; |
555 | tmp += 2; | 531 | tmp += 2; |
556 | 532 | ||
557 | if ((ses->server->ntlmssp.server_flags & NTLMSSP_NEGOTIATE_KEY_XCH) && | 533 | sec_blob->SessionKey.BufferOffset = cpu_to_le32(tmp - pbuffer); |
558 | !calc_seckey(ses->server)) { | 534 | sec_blob->SessionKey.Length = 0; |
559 | memcpy(tmp, ses->server->ntlmssp.ciphertext, CIFS_CPHTXT_SIZE); | 535 | sec_blob->SessionKey.MaximumLength = 0; |
560 | sec_blob->SessionKey.BufferOffset = cpu_to_le32(tmp - pbuffer); | ||
561 | sec_blob->SessionKey.Length = cpu_to_le16(CIFS_CPHTXT_SIZE); | ||
562 | sec_blob->SessionKey.MaximumLength = | ||
563 | cpu_to_le16(CIFS_CPHTXT_SIZE); | ||
564 | tmp += CIFS_CPHTXT_SIZE; | ||
565 | } else { | ||
566 | sec_blob->SessionKey.BufferOffset = cpu_to_le32(tmp - pbuffer); | ||
567 | sec_blob->SessionKey.Length = 0; | ||
568 | sec_blob->SessionKey.MaximumLength = 0; | ||
569 | } | ||
570 | |||
571 | ses->server->sequence_number = 0; | ||
572 | |||
573 | setup_ntlmv2_ret: | ||
574 | if (ses->server->tilen > 0) | ||
575 | kfree(ses->server->tiblob); | ||
576 | |||
577 | return tmp - pbuffer; | 536 | return tmp - pbuffer; |
578 | } | 537 | } |
579 | 538 | ||
@@ -587,14 +546,15 @@ static void setup_ntlmssp_neg_req(SESSION_SETUP_ANDX *pSMB, | |||
587 | return; | 546 | return; |
588 | } | 547 | } |
589 | 548 | ||
590 | static int setup_ntlmssp_auth_req(char *ntlmsspblob, | 549 | static int setup_ntlmssp_auth_req(SESSION_SETUP_ANDX *pSMB, |
591 | struct cifsSesInfo *ses, | 550 | struct cifsSesInfo *ses, |
592 | const struct nls_table *nls, bool first_time) | 551 | const struct nls_table *nls, bool first_time) |
593 | { | 552 | { |
594 | int bloblen; | 553 | int bloblen; |
595 | 554 | ||
596 | bloblen = build_ntlmssp_auth_blob(ntlmsspblob, ses, nls, | 555 | bloblen = build_ntlmssp_auth_blob(&pSMB->req.SecurityBlob[0], ses, nls, |
597 | first_time); | 556 | first_time); |
557 | pSMB->req.SecurityBlobLength = cpu_to_le16(bloblen); | ||
598 | 558 | ||
599 | return bloblen; | 559 | return bloblen; |
600 | } | 560 | } |
@@ -730,7 +690,7 @@ ssetup_ntlmssp_authenticate: | |||
730 | 690 | ||
731 | if (first_time) /* should this be moved into common code | 691 | if (first_time) /* should this be moved into common code |
732 | with similar ntlmv2 path? */ | 692 | with similar ntlmv2 path? */ |
733 | cifs_calculate_session_key(&ses->server->session_key, | 693 | cifs_calculate_mac_key(&ses->server->mac_signing_key, |
734 | ntlm_session_key, ses->password); | 694 | ntlm_session_key, ses->password); |
735 | /* copy session key */ | 695 | /* copy session key */ |
736 | 696 | ||
@@ -769,21 +729,12 @@ ssetup_ntlmssp_authenticate: | |||
769 | cpu_to_le16(sizeof(struct ntlmv2_resp)); | 729 | cpu_to_le16(sizeof(struct ntlmv2_resp)); |
770 | 730 | ||
771 | /* calculate session key */ | 731 | /* calculate session key */ |
772 | rc = setup_ntlmv2_rsp(ses, v2_sess_key, nls_cp); | 732 | setup_ntlmv2_rsp(ses, v2_sess_key, nls_cp); |
773 | if (rc) { | ||
774 | kfree(v2_sess_key); | ||
775 | goto ssetup_exit; | ||
776 | } | ||
777 | /* FIXME: calculate MAC key */ | 733 | /* FIXME: calculate MAC key */ |
778 | memcpy(bcc_ptr, (char *)v2_sess_key, | 734 | memcpy(bcc_ptr, (char *)v2_sess_key, |
779 | sizeof(struct ntlmv2_resp)); | 735 | sizeof(struct ntlmv2_resp)); |
780 | bcc_ptr += sizeof(struct ntlmv2_resp); | 736 | bcc_ptr += sizeof(struct ntlmv2_resp); |
781 | kfree(v2_sess_key); | 737 | kfree(v2_sess_key); |
782 | if (ses->server->tilen > 0) { | ||
783 | memcpy(bcc_ptr, ses->server->tiblob, | ||
784 | ses->server->tilen); | ||
785 | bcc_ptr += ses->server->tilen; | ||
786 | } | ||
787 | if (ses->capabilities & CAP_UNICODE) { | 738 | if (ses->capabilities & CAP_UNICODE) { |
788 | if (iov[0].iov_len % 2) { | 739 | if (iov[0].iov_len % 2) { |
789 | *bcc_ptr = 0; | 740 | *bcc_ptr = 0; |
@@ -814,15 +765,15 @@ ssetup_ntlmssp_authenticate: | |||
814 | } | 765 | } |
815 | /* bail out if key is too long */ | 766 | /* bail out if key is too long */ |
816 | if (msg->sesskey_len > | 767 | if (msg->sesskey_len > |
817 | sizeof(ses->server->session_key.data.krb5)) { | 768 | sizeof(ses->server->mac_signing_key.data.krb5)) { |
818 | cERROR(1, "Kerberos signing key too long (%u bytes)", | 769 | cERROR(1, "Kerberos signing key too long (%u bytes)", |
819 | msg->sesskey_len); | 770 | msg->sesskey_len); |
820 | rc = -EOVERFLOW; | 771 | rc = -EOVERFLOW; |
821 | goto ssetup_exit; | 772 | goto ssetup_exit; |
822 | } | 773 | } |
823 | if (first_time) { | 774 | if (first_time) { |
824 | ses->server->session_key.len = msg->sesskey_len; | 775 | ses->server->mac_signing_key.len = msg->sesskey_len; |
825 | memcpy(ses->server->session_key.data.krb5, | 776 | memcpy(ses->server->mac_signing_key.data.krb5, |
826 | msg->data, msg->sesskey_len); | 777 | msg->data, msg->sesskey_len); |
827 | } | 778 | } |
828 | pSMB->req.hdr.Flags2 |= SMBFLG2_EXT_SEC; | 779 | pSMB->req.hdr.Flags2 |= SMBFLG2_EXT_SEC; |
@@ -864,28 +815,12 @@ ssetup_ntlmssp_authenticate: | |||
864 | if (phase == NtLmNegotiate) { | 815 | if (phase == NtLmNegotiate) { |
865 | setup_ntlmssp_neg_req(pSMB, ses); | 816 | setup_ntlmssp_neg_req(pSMB, ses); |
866 | iov[1].iov_len = sizeof(NEGOTIATE_MESSAGE); | 817 | iov[1].iov_len = sizeof(NEGOTIATE_MESSAGE); |
867 | iov[1].iov_base = &pSMB->req.SecurityBlob[0]; | ||
868 | } else if (phase == NtLmAuthenticate) { | 818 | } else if (phase == NtLmAuthenticate) { |
869 | int blob_len; | 819 | int blob_len; |
870 | char *ntlmsspblob; | 820 | blob_len = setup_ntlmssp_auth_req(pSMB, ses, |
871 | 821 | nls_cp, | |
872 | ntlmsspblob = kmalloc(5 * | 822 | first_time); |
873 | sizeof(struct _AUTHENTICATE_MESSAGE), | ||
874 | GFP_KERNEL); | ||
875 | if (!ntlmsspblob) { | ||
876 | cERROR(1, "Can't allocate NTLMSSP"); | ||
877 | rc = -ENOMEM; | ||
878 | goto ssetup_exit; | ||
879 | } | ||
880 | |||
881 | blob_len = setup_ntlmssp_auth_req(ntlmsspblob, | ||
882 | ses, | ||
883 | nls_cp, | ||
884 | first_time); | ||
885 | iov[1].iov_len = blob_len; | 823 | iov[1].iov_len = blob_len; |
886 | iov[1].iov_base = ntlmsspblob; | ||
887 | pSMB->req.SecurityBlobLength = | ||
888 | cpu_to_le16(blob_len); | ||
889 | /* Make sure that we tell the server that we | 824 | /* Make sure that we tell the server that we |
890 | are using the uid that it just gave us back | 825 | are using the uid that it just gave us back |
891 | on the response (challenge) */ | 826 | on the response (challenge) */ |
@@ -895,6 +830,7 @@ ssetup_ntlmssp_authenticate: | |||
895 | rc = -ENOSYS; | 830 | rc = -ENOSYS; |
896 | goto ssetup_exit; | 831 | goto ssetup_exit; |
897 | } | 832 | } |
833 | iov[1].iov_base = &pSMB->req.SecurityBlob[0]; | ||
898 | /* unicode strings must be word aligned */ | 834 | /* unicode strings must be word aligned */ |
899 | if ((iov[0].iov_len + iov[1].iov_len) % 2) { | 835 | if ((iov[0].iov_len + iov[1].iov_len) % 2) { |
900 | *bcc_ptr = 0; | 836 | *bcc_ptr = 0; |
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c index e0588cdf4cc5..82f78c4d6978 100644 --- a/fs/cifs/transport.c +++ b/fs/cifs/transport.c | |||
@@ -543,7 +543,7 @@ SendReceive2(const unsigned int xid, struct cifsSesInfo *ses, | |||
543 | (ses->server->secMode & (SECMODE_SIGN_REQUIRED | | 543 | (ses->server->secMode & (SECMODE_SIGN_REQUIRED | |
544 | SECMODE_SIGN_ENABLED))) { | 544 | SECMODE_SIGN_ENABLED))) { |
545 | rc = cifs_verify_signature(midQ->resp_buf, | 545 | rc = cifs_verify_signature(midQ->resp_buf, |
546 | ses->server, | 546 | &ses->server->mac_signing_key, |
547 | midQ->sequence_number+1); | 547 | midQ->sequence_number+1); |
548 | if (rc) { | 548 | if (rc) { |
549 | cERROR(1, "Unexpected SMB signature"); | 549 | cERROR(1, "Unexpected SMB signature"); |
@@ -731,7 +731,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses, | |||
731 | (ses->server->secMode & (SECMODE_SIGN_REQUIRED | | 731 | (ses->server->secMode & (SECMODE_SIGN_REQUIRED | |
732 | SECMODE_SIGN_ENABLED))) { | 732 | SECMODE_SIGN_ENABLED))) { |
733 | rc = cifs_verify_signature(out_buf, | 733 | rc = cifs_verify_signature(out_buf, |
734 | ses->server, | 734 | &ses->server->mac_signing_key, |
735 | midQ->sequence_number+1); | 735 | midQ->sequence_number+1); |
736 | if (rc) { | 736 | if (rc) { |
737 | cERROR(1, "Unexpected SMB signature"); | 737 | cERROR(1, "Unexpected SMB signature"); |
@@ -981,7 +981,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifsTconInfo *tcon, | |||
981 | (ses->server->secMode & (SECMODE_SIGN_REQUIRED | | 981 | (ses->server->secMode & (SECMODE_SIGN_REQUIRED | |
982 | SECMODE_SIGN_ENABLED))) { | 982 | SECMODE_SIGN_ENABLED))) { |
983 | rc = cifs_verify_signature(out_buf, | 983 | rc = cifs_verify_signature(out_buf, |
984 | ses->server, | 984 | &ses->server->mac_signing_key, |
985 | midQ->sequence_number+1); | 985 | midQ->sequence_number+1); |
986 | if (rc) { | 986 | if (rc) { |
987 | cERROR(1, "Unexpected SMB signature"); | 987 | cERROR(1, "Unexpected SMB signature"); |
diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c index de89645777c7..116af7546cf0 100644 --- a/fs/coda/psdev.c +++ b/fs/coda/psdev.c | |||
@@ -184,8 +184,8 @@ static ssize_t coda_psdev_write(struct file *file, const char __user *buf, | |||
184 | } | 184 | } |
185 | 185 | ||
186 | /* adjust outsize. is this useful ?? */ | 186 | /* adjust outsize. is this useful ?? */ |
187 | req->uc_outSize = nbytes; | 187 | req->uc_outSize = nbytes; |
188 | req->uc_flags |= REQ_WRITE; | 188 | req->uc_flags |= CODA_REQ_WRITE; |
189 | count = nbytes; | 189 | count = nbytes; |
190 | 190 | ||
191 | /* Convert filedescriptor into a file handle */ | 191 | /* Convert filedescriptor into a file handle */ |
diff --git a/fs/compat.c b/fs/compat.c index 718c7062aec1..0644a154672b 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -1153,7 +1153,7 @@ static ssize_t compat_do_readv_writev(int type, struct file *file, | |||
1153 | { | 1153 | { |
1154 | compat_ssize_t tot_len; | 1154 | compat_ssize_t tot_len; |
1155 | struct iovec iovstack[UIO_FASTIOV]; | 1155 | struct iovec iovstack[UIO_FASTIOV]; |
1156 | struct iovec *iov; | 1156 | struct iovec *iov = iovstack; |
1157 | ssize_t ret; | 1157 | ssize_t ret; |
1158 | io_fn_t fn; | 1158 | io_fn_t fn; |
1159 | iov_fn_t fnv; | 1159 | iov_fn_t fnv; |
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 81e086d8aa57..5581122bd2c0 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
@@ -52,8 +52,6 @@ struct wb_writeback_work { | |||
52 | #define CREATE_TRACE_POINTS | 52 | #define CREATE_TRACE_POINTS |
53 | #include <trace/events/writeback.h> | 53 | #include <trace/events/writeback.h> |
54 | 54 | ||
55 | #define inode_to_bdi(inode) ((inode)->i_mapping->backing_dev_info) | ||
56 | |||
57 | /* | 55 | /* |
58 | * We don't actually have pdflush, but this one is exported though /proc... | 56 | * We don't actually have pdflush, but this one is exported though /proc... |
59 | */ | 57 | */ |
@@ -71,6 +69,27 @@ int writeback_in_progress(struct backing_dev_info *bdi) | |||
71 | return test_bit(BDI_writeback_running, &bdi->state); | 69 | return test_bit(BDI_writeback_running, &bdi->state); |
72 | } | 70 | } |
73 | 71 | ||
72 | static inline struct backing_dev_info *inode_to_bdi(struct inode *inode) | ||
73 | { | ||
74 | struct super_block *sb = inode->i_sb; | ||
75 | struct backing_dev_info *bdi = inode->i_mapping->backing_dev_info; | ||
76 | |||
77 | /* | ||
78 | * For inodes on standard filesystems, we use superblock's bdi. For | ||
79 | * inodes on virtual filesystems, we want to use inode mapping's bdi | ||
80 | * because they can possibly point to something useful (think about | ||
81 | * block_dev filesystem). | ||
82 | */ | ||
83 | if (sb->s_bdi && sb->s_bdi != &noop_backing_dev_info) { | ||
84 | /* Some device inodes could play dirty tricks. Catch them... */ | ||
85 | WARN(bdi != sb->s_bdi && bdi_cap_writeback_dirty(bdi), | ||
86 | "Dirtiable inode bdi %s != sb bdi %s\n", | ||
87 | bdi->name, sb->s_bdi->name); | ||
88 | return sb->s_bdi; | ||
89 | } | ||
90 | return bdi; | ||
91 | } | ||
92 | |||
74 | static void bdi_queue_work(struct backing_dev_info *bdi, | 93 | static void bdi_queue_work(struct backing_dev_info *bdi, |
75 | struct wb_writeback_work *work) | 94 | struct wb_writeback_work *work) |
76 | { | 95 | { |
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index cde1248a6225..ac750bd31a6f 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c | |||
@@ -932,7 +932,7 @@ int gfs2_logd(void *data) | |||
932 | 932 | ||
933 | do { | 933 | do { |
934 | prepare_to_wait(&sdp->sd_logd_waitq, &wait, | 934 | prepare_to_wait(&sdp->sd_logd_waitq, &wait, |
935 | TASK_UNINTERRUPTIBLE); | 935 | TASK_INTERRUPTIBLE); |
936 | if (!gfs2_ail_flush_reqd(sdp) && | 936 | if (!gfs2_ail_flush_reqd(sdp) && |
937 | !gfs2_jrnl_flush_reqd(sdp) && | 937 | !gfs2_jrnl_flush_reqd(sdp) && |
938 | !kthread_should_stop()) | 938 | !kthread_should_stop()) |
diff --git a/fs/nfs/Kconfig b/fs/nfs/Kconfig index 6c2aad49d731..f7e13db613cb 100644 --- a/fs/nfs/Kconfig +++ b/fs/nfs/Kconfig | |||
@@ -63,6 +63,7 @@ config NFS_V3_ACL | |||
63 | config NFS_V4 | 63 | config NFS_V4 |
64 | bool "NFS client support for NFS version 4" | 64 | bool "NFS client support for NFS version 4" |
65 | depends on NFS_FS | 65 | depends on NFS_FS |
66 | select SUNRPC_GSS | ||
66 | help | 67 | help |
67 | This option enables support for version 4 of the NFS protocol | 68 | This option enables support for version 4 of the NFS protocol |
68 | (RFC 3530) in the kernel's NFS client. | 69 | (RFC 3530) in the kernel's NFS client. |
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 4e7df2adb212..e7340729af89 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -275,7 +275,7 @@ static int nfs_sockaddr_match_ipaddr6(const struct sockaddr *sa1, | |||
275 | sin1->sin6_scope_id != sin2->sin6_scope_id) | 275 | sin1->sin6_scope_id != sin2->sin6_scope_id) |
276 | return 0; | 276 | return 0; |
277 | 277 | ||
278 | return ipv6_addr_equal(&sin1->sin6_addr, &sin1->sin6_addr); | 278 | return ipv6_addr_equal(&sin1->sin6_addr, &sin2->sin6_addr); |
279 | } | 279 | } |
280 | #else /* !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) */ | 280 | #else /* !defined(CONFIG_IPV6) && !defined(CONFIG_IPV6_MODULE) */ |
281 | static int nfs_sockaddr_match_ipaddr6(const struct sockaddr *sa1, | 281 | static int nfs_sockaddr_match_ipaddr6(const struct sockaddr *sa1, |
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index eb51bd6201da..05bf3c0dc751 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
@@ -723,10 +723,6 @@ static int do_vfs_lock(struct file *file, struct file_lock *fl) | |||
723 | default: | 723 | default: |
724 | BUG(); | 724 | BUG(); |
725 | } | 725 | } |
726 | if (res < 0) | ||
727 | dprintk(KERN_WARNING "%s: VFS is out of sync with lock manager" | ||
728 | " - error %d!\n", | ||
729 | __func__, res); | ||
730 | return res; | 726 | return res; |
731 | } | 727 | } |
732 | 728 | ||
diff --git a/fs/nfs/super.c b/fs/nfs/super.c index ec3966e4706b..f4cbf0c306c6 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c | |||
@@ -431,7 +431,15 @@ static int nfs_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
431 | goto out_err; | 431 | goto out_err; |
432 | 432 | ||
433 | error = server->nfs_client->rpc_ops->statfs(server, fh, &res); | 433 | error = server->nfs_client->rpc_ops->statfs(server, fh, &res); |
434 | if (unlikely(error == -ESTALE)) { | ||
435 | struct dentry *pd_dentry; | ||
434 | 436 | ||
437 | pd_dentry = dget_parent(dentry); | ||
438 | if (pd_dentry != NULL) { | ||
439 | nfs_zap_caches(pd_dentry->d_inode); | ||
440 | dput(pd_dentry); | ||
441 | } | ||
442 | } | ||
435 | nfs_free_fattr(res.fattr); | 443 | nfs_free_fattr(res.fattr); |
436 | if (error < 0) | 444 | if (error < 0) |
437 | goto out_err; | 445 | goto out_err; |
diff --git a/fs/nfsd/Kconfig b/fs/nfsd/Kconfig index 95932f523aef..4264377552e2 100644 --- a/fs/nfsd/Kconfig +++ b/fs/nfsd/Kconfig | |||
@@ -69,6 +69,7 @@ config NFSD_V4 | |||
69 | depends on NFSD && PROC_FS && EXPERIMENTAL | 69 | depends on NFSD && PROC_FS && EXPERIMENTAL |
70 | select NFSD_V3 | 70 | select NFSD_V3 |
71 | select FS_POSIX_ACL | 71 | select FS_POSIX_ACL |
72 | select SUNRPC_GSS | ||
72 | help | 73 | help |
73 | This option enables support in your system's NFS server for | 74 | This option enables support in your system's NFS server for |
74 | version 4 of the NFS protocol (RFC 3530). | 75 | version 4 of the NFS protocol (RFC 3530). |
diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c index a76e0aa5cd3f..391915093fe1 100644 --- a/fs/ocfs2/acl.c +++ b/fs/ocfs2/acl.c | |||
@@ -209,7 +209,10 @@ static int ocfs2_acl_set_mode(struct inode *inode, struct buffer_head *di_bh, | |||
209 | } | 209 | } |
210 | 210 | ||
211 | inode->i_mode = new_mode; | 211 | inode->i_mode = new_mode; |
212 | inode->i_ctime = CURRENT_TIME; | ||
212 | di->i_mode = cpu_to_le16(inode->i_mode); | 213 | di->i_mode = cpu_to_le16(inode->i_mode); |
214 | di->i_ctime = cpu_to_le64(inode->i_ctime.tv_sec); | ||
215 | di->i_ctime_nsec = cpu_to_le32(inode->i_ctime.tv_nsec); | ||
213 | 216 | ||
214 | ocfs2_journal_dirty(handle, di_bh); | 217 | ocfs2_journal_dirty(handle, di_bh); |
215 | 218 | ||
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c index 1361997cf205..cbe2f057cc28 100644 --- a/fs/ocfs2/cluster/tcp.c +++ b/fs/ocfs2/cluster/tcp.c | |||
@@ -977,7 +977,7 @@ static int o2net_tx_can_proceed(struct o2net_node *nn, | |||
977 | int o2net_send_message_vec(u32 msg_type, u32 key, struct kvec *caller_vec, | 977 | int o2net_send_message_vec(u32 msg_type, u32 key, struct kvec *caller_vec, |
978 | size_t caller_veclen, u8 target_node, int *status) | 978 | size_t caller_veclen, u8 target_node, int *status) |
979 | { | 979 | { |
980 | int ret; | 980 | int ret = 0; |
981 | struct o2net_msg *msg = NULL; | 981 | struct o2net_msg *msg = NULL; |
982 | size_t veclen, caller_bytes = 0; | 982 | size_t veclen, caller_bytes = 0; |
983 | struct kvec *vec = NULL; | 983 | struct kvec *vec = NULL; |
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index f04ebcfffc4a..c49f6de0e7ab 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c | |||
@@ -3931,6 +3931,15 @@ static int ocfs2_dx_dir_rebalance(struct ocfs2_super *osb, struct inode *dir, | |||
3931 | goto out_commit; | 3931 | goto out_commit; |
3932 | } | 3932 | } |
3933 | 3933 | ||
3934 | cpos = split_hash; | ||
3935 | ret = ocfs2_dx_dir_new_cluster(dir, &et, cpos, handle, | ||
3936 | data_ac, meta_ac, new_dx_leaves, | ||
3937 | num_dx_leaves); | ||
3938 | if (ret) { | ||
3939 | mlog_errno(ret); | ||
3940 | goto out_commit; | ||
3941 | } | ||
3942 | |||
3934 | for (i = 0; i < num_dx_leaves; i++) { | 3943 | for (i = 0; i < num_dx_leaves; i++) { |
3935 | ret = ocfs2_journal_access_dl(handle, INODE_CACHE(dir), | 3944 | ret = ocfs2_journal_access_dl(handle, INODE_CACHE(dir), |
3936 | orig_dx_leaves[i], | 3945 | orig_dx_leaves[i], |
@@ -3939,15 +3948,14 @@ static int ocfs2_dx_dir_rebalance(struct ocfs2_super *osb, struct inode *dir, | |||
3939 | mlog_errno(ret); | 3948 | mlog_errno(ret); |
3940 | goto out_commit; | 3949 | goto out_commit; |
3941 | } | 3950 | } |
3942 | } | ||
3943 | 3951 | ||
3944 | cpos = split_hash; | 3952 | ret = ocfs2_journal_access_dl(handle, INODE_CACHE(dir), |
3945 | ret = ocfs2_dx_dir_new_cluster(dir, &et, cpos, handle, | 3953 | new_dx_leaves[i], |
3946 | data_ac, meta_ac, new_dx_leaves, | 3954 | OCFS2_JOURNAL_ACCESS_WRITE); |
3947 | num_dx_leaves); | 3955 | if (ret) { |
3948 | if (ret) { | 3956 | mlog_errno(ret); |
3949 | mlog_errno(ret); | 3957 | goto out_commit; |
3950 | goto out_commit; | 3958 | } |
3951 | } | 3959 | } |
3952 | 3960 | ||
3953 | ocfs2_dx_dir_transfer_leaf(dir, split_hash, handle, tmp_dx_leaf, | 3961 | ocfs2_dx_dir_transfer_leaf(dir, split_hash, handle, tmp_dx_leaf, |
diff --git a/fs/ocfs2/dlm/dlmcommon.h b/fs/ocfs2/dlm/dlmcommon.h index 4b6ae2c13b47..765298908f1d 100644 --- a/fs/ocfs2/dlm/dlmcommon.h +++ b/fs/ocfs2/dlm/dlmcommon.h | |||
@@ -1030,6 +1030,7 @@ int dlm_drop_lockres_ref(struct dlm_ctxt *dlm, | |||
1030 | struct dlm_lock_resource *res); | 1030 | struct dlm_lock_resource *res); |
1031 | void dlm_clean_master_list(struct dlm_ctxt *dlm, | 1031 | void dlm_clean_master_list(struct dlm_ctxt *dlm, |
1032 | u8 dead_node); | 1032 | u8 dead_node); |
1033 | void dlm_force_free_mles(struct dlm_ctxt *dlm); | ||
1033 | int dlm_lock_basts_flushed(struct dlm_ctxt *dlm, struct dlm_lock *lock); | 1034 | int dlm_lock_basts_flushed(struct dlm_ctxt *dlm, struct dlm_lock *lock); |
1034 | int __dlm_lockres_has_locks(struct dlm_lock_resource *res); | 1035 | int __dlm_lockres_has_locks(struct dlm_lock_resource *res); |
1035 | int __dlm_lockres_unused(struct dlm_lock_resource *res); | 1036 | int __dlm_lockres_unused(struct dlm_lock_resource *res); |
diff --git a/fs/ocfs2/dlm/dlmdebug.c b/fs/ocfs2/dlm/dlmdebug.c index 5efdd37dfe48..901ca52bf86b 100644 --- a/fs/ocfs2/dlm/dlmdebug.c +++ b/fs/ocfs2/dlm/dlmdebug.c | |||
@@ -636,8 +636,14 @@ static void *lockres_seq_start(struct seq_file *m, loff_t *pos) | |||
636 | spin_lock(&dlm->track_lock); | 636 | spin_lock(&dlm->track_lock); |
637 | if (oldres) | 637 | if (oldres) |
638 | track_list = &oldres->tracking; | 638 | track_list = &oldres->tracking; |
639 | else | 639 | else { |
640 | track_list = &dlm->tracking_list; | 640 | track_list = &dlm->tracking_list; |
641 | if (list_empty(track_list)) { | ||
642 | dl = NULL; | ||
643 | spin_unlock(&dlm->track_lock); | ||
644 | goto bail; | ||
645 | } | ||
646 | } | ||
641 | 647 | ||
642 | list_for_each_entry(res, track_list, tracking) { | 648 | list_for_each_entry(res, track_list, tracking) { |
643 | if (&res->tracking == &dlm->tracking_list) | 649 | if (&res->tracking == &dlm->tracking_list) |
@@ -660,6 +666,7 @@ static void *lockres_seq_start(struct seq_file *m, loff_t *pos) | |||
660 | } else | 666 | } else |
661 | dl = NULL; | 667 | dl = NULL; |
662 | 668 | ||
669 | bail: | ||
663 | /* passed to seq_show */ | 670 | /* passed to seq_show */ |
664 | return dl; | 671 | return dl; |
665 | } | 672 | } |
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c index 153abb5abef0..11a5c87fd7f7 100644 --- a/fs/ocfs2/dlm/dlmdomain.c +++ b/fs/ocfs2/dlm/dlmdomain.c | |||
@@ -693,6 +693,7 @@ void dlm_unregister_domain(struct dlm_ctxt *dlm) | |||
693 | 693 | ||
694 | dlm_mark_domain_leaving(dlm); | 694 | dlm_mark_domain_leaving(dlm); |
695 | dlm_leave_domain(dlm); | 695 | dlm_leave_domain(dlm); |
696 | dlm_force_free_mles(dlm); | ||
696 | dlm_complete_dlm_shutdown(dlm); | 697 | dlm_complete_dlm_shutdown(dlm); |
697 | } | 698 | } |
698 | dlm_put(dlm); | 699 | dlm_put(dlm); |
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c index ffb4c68dafa4..f564b0e5f80d 100644 --- a/fs/ocfs2/dlm/dlmmaster.c +++ b/fs/ocfs2/dlm/dlmmaster.c | |||
@@ -3433,3 +3433,43 @@ void dlm_lockres_release_ast(struct dlm_ctxt *dlm, | |||
3433 | wake_up(&res->wq); | 3433 | wake_up(&res->wq); |
3434 | wake_up(&dlm->migration_wq); | 3434 | wake_up(&dlm->migration_wq); |
3435 | } | 3435 | } |
3436 | |||
3437 | void dlm_force_free_mles(struct dlm_ctxt *dlm) | ||
3438 | { | ||
3439 | int i; | ||
3440 | struct hlist_head *bucket; | ||
3441 | struct dlm_master_list_entry *mle; | ||
3442 | struct hlist_node *tmp, *list; | ||
3443 | |||
3444 | /* | ||
3445 | * We notified all other nodes that we are exiting the domain and | ||
3446 | * marked the dlm state to DLM_CTXT_LEAVING. If any mles are still | ||
3447 | * around we force free them and wake any processes that are waiting | ||
3448 | * on the mles | ||
3449 | */ | ||
3450 | spin_lock(&dlm->spinlock); | ||
3451 | spin_lock(&dlm->master_lock); | ||
3452 | |||
3453 | BUG_ON(dlm->dlm_state != DLM_CTXT_LEAVING); | ||
3454 | BUG_ON((find_next_bit(dlm->domain_map, O2NM_MAX_NODES, 0) < O2NM_MAX_NODES)); | ||
3455 | |||
3456 | for (i = 0; i < DLM_HASH_BUCKETS; i++) { | ||
3457 | bucket = dlm_master_hash(dlm, i); | ||
3458 | hlist_for_each_safe(list, tmp, bucket) { | ||
3459 | mle = hlist_entry(list, struct dlm_master_list_entry, | ||
3460 | master_hash_node); | ||
3461 | if (mle->type != DLM_MLE_BLOCK) { | ||
3462 | mlog(ML_ERROR, "bad mle: %p\n", mle); | ||
3463 | dlm_print_one_mle(mle); | ||
3464 | } | ||
3465 | atomic_set(&mle->woken, 1); | ||
3466 | wake_up(&mle->wq); | ||
3467 | |||
3468 | __dlm_unlink_mle(dlm, mle); | ||
3469 | __dlm_mle_detach_hb_events(dlm, mle); | ||
3470 | __dlm_put_mle(mle); | ||
3471 | } | ||
3472 | } | ||
3473 | spin_unlock(&dlm->master_lock); | ||
3474 | spin_unlock(&dlm->spinlock); | ||
3475 | } | ||
diff --git a/fs/ocfs2/dlmglue.h b/fs/ocfs2/dlmglue.h index d1ce48e1b3d6..1d596d8c4a4a 100644 --- a/fs/ocfs2/dlmglue.h +++ b/fs/ocfs2/dlmglue.h | |||
@@ -84,6 +84,7 @@ enum { | |||
84 | OI_LS_PARENT, | 84 | OI_LS_PARENT, |
85 | OI_LS_RENAME1, | 85 | OI_LS_RENAME1, |
86 | OI_LS_RENAME2, | 86 | OI_LS_RENAME2, |
87 | OI_LS_REFLINK_TARGET, | ||
87 | }; | 88 | }; |
88 | 89 | ||
89 | int ocfs2_dlm_init(struct ocfs2_super *osb); | 90 | int ocfs2_dlm_init(struct ocfs2_super *osb); |
diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h index 33f1c9a8258d..fa31d05e41b7 100644 --- a/fs/ocfs2/ocfs2_fs.h +++ b/fs/ocfs2/ocfs2_fs.h | |||
@@ -235,18 +235,31 @@ | |||
235 | #define OCFS2_HAS_REFCOUNT_FL (0x0010) | 235 | #define OCFS2_HAS_REFCOUNT_FL (0x0010) |
236 | 236 | ||
237 | /* Inode attributes, keep in sync with EXT2 */ | 237 | /* Inode attributes, keep in sync with EXT2 */ |
238 | #define OCFS2_SECRM_FL (0x00000001) /* Secure deletion */ | 238 | #define OCFS2_SECRM_FL FS_SECRM_FL /* Secure deletion */ |
239 | #define OCFS2_UNRM_FL (0x00000002) /* Undelete */ | 239 | #define OCFS2_UNRM_FL FS_UNRM_FL /* Undelete */ |
240 | #define OCFS2_COMPR_FL (0x00000004) /* Compress file */ | 240 | #define OCFS2_COMPR_FL FS_COMPR_FL /* Compress file */ |
241 | #define OCFS2_SYNC_FL (0x00000008) /* Synchronous updates */ | 241 | #define OCFS2_SYNC_FL FS_SYNC_FL /* Synchronous updates */ |
242 | #define OCFS2_IMMUTABLE_FL (0x00000010) /* Immutable file */ | 242 | #define OCFS2_IMMUTABLE_FL FS_IMMUTABLE_FL /* Immutable file */ |
243 | #define OCFS2_APPEND_FL (0x00000020) /* writes to file may only append */ | 243 | #define OCFS2_APPEND_FL FS_APPEND_FL /* writes to file may only append */ |
244 | #define OCFS2_NODUMP_FL (0x00000040) /* do not dump file */ | 244 | #define OCFS2_NODUMP_FL FS_NODUMP_FL /* do not dump file */ |
245 | #define OCFS2_NOATIME_FL (0x00000080) /* do not update atime */ | 245 | #define OCFS2_NOATIME_FL FS_NOATIME_FL /* do not update atime */ |
246 | #define OCFS2_DIRSYNC_FL (0x00010000) /* dirsync behaviour (directories only) */ | 246 | /* Reserved for compression usage... */ |
247 | 247 | #define OCFS2_DIRTY_FL FS_DIRTY_FL | |
248 | #define OCFS2_FL_VISIBLE (0x000100FF) /* User visible flags */ | 248 | #define OCFS2_COMPRBLK_FL FS_COMPRBLK_FL /* One or more compressed clusters */ |
249 | #define OCFS2_FL_MODIFIABLE (0x000100FF) /* User modifiable flags */ | 249 | #define OCFS2_NOCOMP_FL FS_NOCOMP_FL /* Don't compress */ |
250 | #define OCFS2_ECOMPR_FL FS_ECOMPR_FL /* Compression error */ | ||
251 | /* End compression flags --- maybe not all used */ | ||
252 | #define OCFS2_BTREE_FL FS_BTREE_FL /* btree format dir */ | ||
253 | #define OCFS2_INDEX_FL FS_INDEX_FL /* hash-indexed directory */ | ||
254 | #define OCFS2_IMAGIC_FL FS_IMAGIC_FL /* AFS directory */ | ||
255 | #define OCFS2_JOURNAL_DATA_FL FS_JOURNAL_DATA_FL /* Reserved for ext3 */ | ||
256 | #define OCFS2_NOTAIL_FL FS_NOTAIL_FL /* file tail should not be merged */ | ||
257 | #define OCFS2_DIRSYNC_FL FS_DIRSYNC_FL /* dirsync behaviour (directories only) */ | ||
258 | #define OCFS2_TOPDIR_FL FS_TOPDIR_FL /* Top of directory hierarchies*/ | ||
259 | #define OCFS2_RESERVED_FL FS_RESERVED_FL /* reserved for ext2 lib */ | ||
260 | |||
261 | #define OCFS2_FL_VISIBLE FS_FL_USER_VISIBLE /* User visible flags */ | ||
262 | #define OCFS2_FL_MODIFIABLE FS_FL_USER_MODIFIABLE /* User modifiable flags */ | ||
250 | 263 | ||
251 | /* | 264 | /* |
252 | * Extent record flags (e_node.leaf.flags) | 265 | * Extent record flags (e_node.leaf.flags) |
diff --git a/fs/ocfs2/ocfs2_ioctl.h b/fs/ocfs2/ocfs2_ioctl.h index 2d3420af1a83..5d241505690b 100644 --- a/fs/ocfs2/ocfs2_ioctl.h +++ b/fs/ocfs2/ocfs2_ioctl.h | |||
@@ -23,10 +23,10 @@ | |||
23 | /* | 23 | /* |
24 | * ioctl commands | 24 | * ioctl commands |
25 | */ | 25 | */ |
26 | #define OCFS2_IOC_GETFLAGS _IOR('f', 1, long) | 26 | #define OCFS2_IOC_GETFLAGS FS_IOC_GETFLAGS |
27 | #define OCFS2_IOC_SETFLAGS _IOW('f', 2, long) | 27 | #define OCFS2_IOC_SETFLAGS FS_IOC_SETFLAGS |
28 | #define OCFS2_IOC32_GETFLAGS _IOR('f', 1, int) | 28 | #define OCFS2_IOC32_GETFLAGS FS_IOC32_GETFLAGS |
29 | #define OCFS2_IOC32_SETFLAGS _IOW('f', 2, int) | 29 | #define OCFS2_IOC32_SETFLAGS FS_IOC32_SETFLAGS |
30 | 30 | ||
31 | /* | 31 | /* |
32 | * Space reservation / allocation / free ioctls and argument structure | 32 | * Space reservation / allocation / free ioctls and argument structure |
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index 0afeda83120f..efdd75607406 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c | |||
@@ -4201,8 +4201,9 @@ static int __ocfs2_reflink(struct dentry *old_dentry, | |||
4201 | goto out; | 4201 | goto out; |
4202 | } | 4202 | } |
4203 | 4203 | ||
4204 | mutex_lock(&new_inode->i_mutex); | 4204 | mutex_lock_nested(&new_inode->i_mutex, I_MUTEX_CHILD); |
4205 | ret = ocfs2_inode_lock(new_inode, &new_bh, 1); | 4205 | ret = ocfs2_inode_lock_nested(new_inode, &new_bh, 1, |
4206 | OI_LS_REFLINK_TARGET); | ||
4206 | if (ret) { | 4207 | if (ret) { |
4207 | mlog_errno(ret); | 4208 | mlog_errno(ret); |
4208 | goto out_unlock; | 4209 | goto out_unlock; |
diff --git a/fs/ocfs2/reservations.c b/fs/ocfs2/reservations.c index d8b6e4259b80..3e78db361bc7 100644 --- a/fs/ocfs2/reservations.c +++ b/fs/ocfs2/reservations.c | |||
@@ -732,25 +732,23 @@ int ocfs2_resmap_resv_bits(struct ocfs2_reservation_map *resmap, | |||
732 | struct ocfs2_alloc_reservation *resv, | 732 | struct ocfs2_alloc_reservation *resv, |
733 | int *cstart, int *clen) | 733 | int *cstart, int *clen) |
734 | { | 734 | { |
735 | unsigned int wanted = *clen; | ||
736 | |||
737 | if (resv == NULL || ocfs2_resmap_disabled(resmap)) | 735 | if (resv == NULL || ocfs2_resmap_disabled(resmap)) |
738 | return -ENOSPC; | 736 | return -ENOSPC; |
739 | 737 | ||
740 | spin_lock(&resv_lock); | 738 | spin_lock(&resv_lock); |
741 | 739 | ||
742 | /* | ||
743 | * We don't want to over-allocate for temporary | ||
744 | * windows. Otherwise, we run the risk of fragmenting the | ||
745 | * allocation space. | ||
746 | */ | ||
747 | wanted = ocfs2_resv_window_bits(resmap, resv); | ||
748 | if ((resv->r_flags & OCFS2_RESV_FLAG_TMP) || wanted < *clen) | ||
749 | wanted = *clen; | ||
750 | |||
751 | if (ocfs2_resv_empty(resv)) { | 740 | if (ocfs2_resv_empty(resv)) { |
752 | mlog(0, "empty reservation, find new window\n"); | 741 | /* |
742 | * We don't want to over-allocate for temporary | ||
743 | * windows. Otherwise, we run the risk of fragmenting the | ||
744 | * allocation space. | ||
745 | */ | ||
746 | unsigned int wanted = ocfs2_resv_window_bits(resmap, resv); | ||
753 | 747 | ||
748 | if ((resv->r_flags & OCFS2_RESV_FLAG_TMP) || wanted < *clen) | ||
749 | wanted = *clen; | ||
750 | |||
751 | mlog(0, "empty reservation, find new window\n"); | ||
754 | /* | 752 | /* |
755 | * Try to get a window here. If it works, we must fall | 753 | * Try to get a window here. If it works, we must fall |
756 | * through and test the bitmap . This avoids some | 754 | * through and test the bitmap . This avoids some |
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c index 8a286f54dca1..849c2f0e0a0e 100644 --- a/fs/ocfs2/suballoc.c +++ b/fs/ocfs2/suballoc.c | |||
@@ -357,7 +357,7 @@ out: | |||
357 | static void ocfs2_bg_discontig_add_extent(struct ocfs2_super *osb, | 357 | static void ocfs2_bg_discontig_add_extent(struct ocfs2_super *osb, |
358 | struct ocfs2_group_desc *bg, | 358 | struct ocfs2_group_desc *bg, |
359 | struct ocfs2_chain_list *cl, | 359 | struct ocfs2_chain_list *cl, |
360 | u64 p_blkno, u32 clusters) | 360 | u64 p_blkno, unsigned int clusters) |
361 | { | 361 | { |
362 | struct ocfs2_extent_list *el = &bg->bg_list; | 362 | struct ocfs2_extent_list *el = &bg->bg_list; |
363 | struct ocfs2_extent_rec *rec; | 363 | struct ocfs2_extent_rec *rec; |
@@ -369,7 +369,7 @@ static void ocfs2_bg_discontig_add_extent(struct ocfs2_super *osb, | |||
369 | rec->e_blkno = cpu_to_le64(p_blkno); | 369 | rec->e_blkno = cpu_to_le64(p_blkno); |
370 | rec->e_cpos = cpu_to_le32(le16_to_cpu(bg->bg_bits) / | 370 | rec->e_cpos = cpu_to_le32(le16_to_cpu(bg->bg_bits) / |
371 | le16_to_cpu(cl->cl_bpc)); | 371 | le16_to_cpu(cl->cl_bpc)); |
372 | rec->e_leaf_clusters = cpu_to_le32(clusters); | 372 | rec->e_leaf_clusters = cpu_to_le16(clusters); |
373 | le16_add_cpu(&bg->bg_bits, clusters * le16_to_cpu(cl->cl_bpc)); | 373 | le16_add_cpu(&bg->bg_bits, clusters * le16_to_cpu(cl->cl_bpc)); |
374 | le16_add_cpu(&bg->bg_free_bits_count, | 374 | le16_add_cpu(&bg->bg_free_bits_count, |
375 | clusters * le16_to_cpu(cl->cl_bpc)); | 375 | clusters * le16_to_cpu(cl->cl_bpc)); |
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index d03469f61801..06fa5e77c40e 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c | |||
@@ -1286,13 +1286,11 @@ int ocfs2_xattr_get_nolock(struct inode *inode, | |||
1286 | xis.inode_bh = xbs.inode_bh = di_bh; | 1286 | xis.inode_bh = xbs.inode_bh = di_bh; |
1287 | di = (struct ocfs2_dinode *)di_bh->b_data; | 1287 | di = (struct ocfs2_dinode *)di_bh->b_data; |
1288 | 1288 | ||
1289 | down_read(&oi->ip_xattr_sem); | ||
1290 | ret = ocfs2_xattr_ibody_get(inode, name_index, name, buffer, | 1289 | ret = ocfs2_xattr_ibody_get(inode, name_index, name, buffer, |
1291 | buffer_size, &xis); | 1290 | buffer_size, &xis); |
1292 | if (ret == -ENODATA && di->i_xattr_loc) | 1291 | if (ret == -ENODATA && di->i_xattr_loc) |
1293 | ret = ocfs2_xattr_block_get(inode, name_index, name, buffer, | 1292 | ret = ocfs2_xattr_block_get(inode, name_index, name, buffer, |
1294 | buffer_size, &xbs); | 1293 | buffer_size, &xbs); |
1295 | up_read(&oi->ip_xattr_sem); | ||
1296 | 1294 | ||
1297 | return ret; | 1295 | return ret; |
1298 | } | 1296 | } |
@@ -1316,8 +1314,10 @@ static int ocfs2_xattr_get(struct inode *inode, | |||
1316 | mlog_errno(ret); | 1314 | mlog_errno(ret); |
1317 | return ret; | 1315 | return ret; |
1318 | } | 1316 | } |
1317 | down_read(&OCFS2_I(inode)->ip_xattr_sem); | ||
1319 | ret = ocfs2_xattr_get_nolock(inode, di_bh, name_index, | 1318 | ret = ocfs2_xattr_get_nolock(inode, di_bh, name_index, |
1320 | name, buffer, buffer_size); | 1319 | name, buffer, buffer_size); |
1320 | up_read(&OCFS2_I(inode)->ip_xattr_sem); | ||
1321 | 1321 | ||
1322 | ocfs2_inode_unlock(inode, 0); | 1322 | ocfs2_inode_unlock(inode, 0); |
1323 | 1323 | ||
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 271afc48b9a5..1dbca4e8cc16 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -363,13 +363,13 @@ static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, | |||
363 | mss->referenced += PAGE_SIZE; | 363 | mss->referenced += PAGE_SIZE; |
364 | mapcount = page_mapcount(page); | 364 | mapcount = page_mapcount(page); |
365 | if (mapcount >= 2) { | 365 | if (mapcount >= 2) { |
366 | if (pte_dirty(ptent)) | 366 | if (pte_dirty(ptent) || PageDirty(page)) |
367 | mss->shared_dirty += PAGE_SIZE; | 367 | mss->shared_dirty += PAGE_SIZE; |
368 | else | 368 | else |
369 | mss->shared_clean += PAGE_SIZE; | 369 | mss->shared_clean += PAGE_SIZE; |
370 | mss->pss += (PAGE_SIZE << PSS_SHIFT) / mapcount; | 370 | mss->pss += (PAGE_SIZE << PSS_SHIFT) / mapcount; |
371 | } else { | 371 | } else { |
372 | if (pte_dirty(ptent)) | 372 | if (pte_dirty(ptent) || PageDirty(page)) |
373 | mss->private_dirty += PAGE_SIZE; | 373 | mss->private_dirty += PAGE_SIZE; |
374 | else | 374 | else |
375 | mss->private_clean += PAGE_SIZE; | 375 | mss->private_clean += PAGE_SIZE; |
diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c index 91c817ff02c3..2367fb3f70bc 100644 --- a/fs/proc/vmcore.c +++ b/fs/proc/vmcore.c | |||
@@ -163,7 +163,7 @@ static ssize_t read_vmcore(struct file *file, char __user *buffer, | |||
163 | 163 | ||
164 | static const struct file_operations proc_vmcore_operations = { | 164 | static const struct file_operations proc_vmcore_operations = { |
165 | .read = read_vmcore, | 165 | .read = read_vmcore, |
166 | .llseek = generic_file_llseek, | 166 | .llseek = default_llseek, |
167 | }; | 167 | }; |
168 | 168 | ||
169 | static struct vmcore* __init get_new_element(void) | 169 | static struct vmcore* __init get_new_element(void) |
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index c9f3cc5949a8..3e5a51af757c 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
@@ -386,7 +386,15 @@ struct drm_connector_funcs { | |||
386 | void (*dpms)(struct drm_connector *connector, int mode); | 386 | void (*dpms)(struct drm_connector *connector, int mode); |
387 | void (*save)(struct drm_connector *connector); | 387 | void (*save)(struct drm_connector *connector); |
388 | void (*restore)(struct drm_connector *connector); | 388 | void (*restore)(struct drm_connector *connector); |
389 | enum drm_connector_status (*detect)(struct drm_connector *connector); | 389 | |
390 | /* Check to see if anything is attached to the connector. | ||
391 | * @force is set to false whilst polling, true when checking the | ||
392 | * connector due to user request. @force can be used by the driver | ||
393 | * to avoid expensive, destructive operations during automated | ||
394 | * probing. | ||
395 | */ | ||
396 | enum drm_connector_status (*detect)(struct drm_connector *connector, | ||
397 | bool force); | ||
390 | int (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height); | 398 | int (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height); |
391 | int (*set_property)(struct drm_connector *connector, struct drm_property *property, | 399 | int (*set_property)(struct drm_connector *connector, struct drm_property *property, |
392 | uint64_t val); | 400 | uint64_t val); |
diff --git a/include/linux/compat.h b/include/linux/compat.h index 9ddc8780e8db..5778b559d59c 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h | |||
@@ -360,5 +360,8 @@ extern ssize_t compat_rw_copy_check_uvector(int type, | |||
360 | const struct compat_iovec __user *uvector, unsigned long nr_segs, | 360 | const struct compat_iovec __user *uvector, unsigned long nr_segs, |
361 | unsigned long fast_segs, struct iovec *fast_pointer, | 361 | unsigned long fast_segs, struct iovec *fast_pointer, |
362 | struct iovec **ret_pointer); | 362 | struct iovec **ret_pointer); |
363 | |||
364 | extern void __user *compat_alloc_user_space(unsigned long len); | ||
365 | |||
363 | #endif /* CONFIG_COMPAT */ | 366 | #endif /* CONFIG_COMPAT */ |
364 | #endif /* _LINUX_COMPAT_H */ | 367 | #endif /* _LINUX_COMPAT_H */ |
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index ce29b8151198..ba8319ae5fcc 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h | |||
@@ -102,6 +102,9 @@ static inline u64 dma_get_mask(struct device *dev) | |||
102 | return DMA_BIT_MASK(32); | 102 | return DMA_BIT_MASK(32); |
103 | } | 103 | } |
104 | 104 | ||
105 | #ifdef ARCH_HAS_DMA_SET_COHERENT_MASK | ||
106 | int dma_set_coherent_mask(struct device *dev, u64 mask); | ||
107 | #else | ||
105 | static inline int dma_set_coherent_mask(struct device *dev, u64 mask) | 108 | static inline int dma_set_coherent_mask(struct device *dev, u64 mask) |
106 | { | 109 | { |
107 | if (!dma_supported(dev, mask)) | 110 | if (!dma_supported(dev, mask)) |
@@ -109,6 +112,7 @@ static inline int dma_set_coherent_mask(struct device *dev, u64 mask) | |||
109 | dev->coherent_dma_mask = mask; | 112 | dev->coherent_dma_mask = mask; |
110 | return 0; | 113 | return 0; |
111 | } | 114 | } |
115 | #endif | ||
112 | 116 | ||
113 | extern u64 dma_get_required_mask(struct device *dev); | 117 | extern u64 dma_get_required_mask(struct device *dev); |
114 | 118 | ||
diff --git a/include/linux/fs.h b/include/linux/fs.h index 76041b614758..63d069bd80b7 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -1093,6 +1093,10 @@ struct file_lock { | |||
1093 | 1093 | ||
1094 | #include <linux/fcntl.h> | 1094 | #include <linux/fcntl.h> |
1095 | 1095 | ||
1096 | /* temporary stubs for BKL removal */ | ||
1097 | #define lock_flocks() lock_kernel() | ||
1098 | #define unlock_flocks() unlock_kernel() | ||
1099 | |||
1096 | extern void send_sigio(struct fown_struct *fown, int fd, int band); | 1100 | extern void send_sigio(struct fown_struct *fown, int fd, int band); |
1097 | 1101 | ||
1098 | #ifdef CONFIG_FILE_LOCKING | 1102 | #ifdef CONFIG_FILE_LOCKING |
diff --git a/include/linux/gpio.h b/include/linux/gpio.h index 03f616b78cfa..e41f7dd1ae67 100644 --- a/include/linux/gpio.h +++ b/include/linux/gpio.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/errno.h> | 13 | #include <linux/errno.h> |
14 | 14 | ||
15 | struct device; | 15 | struct device; |
16 | struct gpio_chip; | ||
16 | 17 | ||
17 | /* | 18 | /* |
18 | * Some platforms don't support the GPIO programming interface. | 19 | * Some platforms don't support the GPIO programming interface. |
diff --git a/include/linux/netpoll.h b/include/linux/netpoll.h index 791d5109f34c..50d8009be86c 100644 --- a/include/linux/netpoll.h +++ b/include/linux/netpoll.h | |||
@@ -63,20 +63,20 @@ static inline bool netpoll_rx(struct sk_buff *skb) | |||
63 | unsigned long flags; | 63 | unsigned long flags; |
64 | bool ret = false; | 64 | bool ret = false; |
65 | 65 | ||
66 | rcu_read_lock_bh(); | 66 | local_irq_save(flags); |
67 | npinfo = rcu_dereference_bh(skb->dev->npinfo); | 67 | npinfo = rcu_dereference_bh(skb->dev->npinfo); |
68 | 68 | ||
69 | if (!npinfo || (list_empty(&npinfo->rx_np) && !npinfo->rx_flags)) | 69 | if (!npinfo || (list_empty(&npinfo->rx_np) && !npinfo->rx_flags)) |
70 | goto out; | 70 | goto out; |
71 | 71 | ||
72 | spin_lock_irqsave(&npinfo->rx_lock, flags); | 72 | spin_lock(&npinfo->rx_lock); |
73 | /* check rx_flags again with the lock held */ | 73 | /* check rx_flags again with the lock held */ |
74 | if (npinfo->rx_flags && __netpoll_rx(skb)) | 74 | if (npinfo->rx_flags && __netpoll_rx(skb)) |
75 | ret = true; | 75 | ret = true; |
76 | spin_unlock_irqrestore(&npinfo->rx_lock, flags); | 76 | spin_unlock(&npinfo->rx_lock); |
77 | 77 | ||
78 | out: | 78 | out: |
79 | rcu_read_unlock_bh(); | 79 | local_irq_restore(flags); |
80 | return ret; | 80 | return ret; |
81 | } | 81 | } |
82 | 82 | ||
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index d50ba858cfe0..d1a9193960f1 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h | |||
@@ -274,8 +274,14 @@ static inline int dquot_alloc_space(struct inode *inode, qsize_t nr) | |||
274 | int ret; | 274 | int ret; |
275 | 275 | ||
276 | ret = dquot_alloc_space_nodirty(inode, nr); | 276 | ret = dquot_alloc_space_nodirty(inode, nr); |
277 | if (!ret) | 277 | if (!ret) { |
278 | mark_inode_dirty_sync(inode); | 278 | /* |
279 | * Mark inode fully dirty. Since we are allocating blocks, inode | ||
280 | * would become fully dirty soon anyway and it reportedly | ||
281 | * reduces inode_lock contention. | ||
282 | */ | ||
283 | mark_inode_dirty(inode); | ||
284 | } | ||
279 | return ret; | 285 | return ret; |
280 | } | 286 | } |
281 | 287 | ||
diff --git a/include/linux/spi/dw_spi.h b/include/linux/spi/dw_spi.h index cc813f95a2f2..c91302f3a257 100644 --- a/include/linux/spi/dw_spi.h +++ b/include/linux/spi/dw_spi.h | |||
@@ -14,7 +14,9 @@ | |||
14 | #define SPI_MODE_OFFSET 6 | 14 | #define SPI_MODE_OFFSET 6 |
15 | #define SPI_SCPH_OFFSET 6 | 15 | #define SPI_SCPH_OFFSET 6 |
16 | #define SPI_SCOL_OFFSET 7 | 16 | #define SPI_SCOL_OFFSET 7 |
17 | |||
17 | #define SPI_TMOD_OFFSET 8 | 18 | #define SPI_TMOD_OFFSET 8 |
19 | #define SPI_TMOD_MASK (0x3 << SPI_TMOD_OFFSET) | ||
18 | #define SPI_TMOD_TR 0x0 /* xmit & recv */ | 20 | #define SPI_TMOD_TR 0x0 /* xmit & recv */ |
19 | #define SPI_TMOD_TO 0x1 /* xmit only */ | 21 | #define SPI_TMOD_TO 0x1 /* xmit only */ |
20 | #define SPI_TMOD_RO 0x2 /* recv only */ | 22 | #define SPI_TMOD_RO 0x2 /* recv only */ |
diff --git a/include/linux/sunrpc/clnt.h b/include/linux/sunrpc/clnt.h index 569dc722a600..85f38a63f098 100644 --- a/include/linux/sunrpc/clnt.h +++ b/include/linux/sunrpc/clnt.h | |||
@@ -30,7 +30,7 @@ struct rpc_inode; | |||
30 | * The high-level client handle | 30 | * The high-level client handle |
31 | */ | 31 | */ |
32 | struct rpc_clnt { | 32 | struct rpc_clnt { |
33 | struct kref cl_kref; /* Number of references */ | 33 | atomic_t cl_count; /* Number of references */ |
34 | struct list_head cl_clients; /* Global list of clients */ | 34 | struct list_head cl_clients; /* Global list of clients */ |
35 | struct list_head cl_tasks; /* List of tasks */ | 35 | struct list_head cl_tasks; /* List of tasks */ |
36 | spinlock_t cl_lock; /* spinlock */ | 36 | spinlock_t cl_lock; /* spinlock */ |
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index f11100f96482..25e02c941bac 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h | |||
@@ -235,6 +235,10 @@ static inline unsigned int work_static(struct work_struct *work) { return 0; } | |||
235 | #define work_clear_pending(work) \ | 235 | #define work_clear_pending(work) \ |
236 | clear_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(work)) | 236 | clear_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(work)) |
237 | 237 | ||
238 | /* | ||
239 | * Workqueue flags and constants. For details, please refer to | ||
240 | * Documentation/workqueue.txt. | ||
241 | */ | ||
238 | enum { | 242 | enum { |
239 | WQ_NON_REENTRANT = 1 << 0, /* guarantee non-reentrance */ | 243 | WQ_NON_REENTRANT = 1 << 0, /* guarantee non-reentrance */ |
240 | WQ_UNBOUND = 1 << 1, /* not bound to any cpu */ | 244 | WQ_UNBOUND = 1 << 1, /* not bound to any cpu */ |
diff --git a/include/net/tcp.h b/include/net/tcp.h index eaa9582779d0..3e4b33e36602 100644 --- a/include/net/tcp.h +++ b/include/net/tcp.h | |||
@@ -475,8 +475,22 @@ extern unsigned int tcp_current_mss(struct sock *sk); | |||
475 | /* Bound MSS / TSO packet size with the half of the window */ | 475 | /* Bound MSS / TSO packet size with the half of the window */ |
476 | static inline int tcp_bound_to_half_wnd(struct tcp_sock *tp, int pktsize) | 476 | static inline int tcp_bound_to_half_wnd(struct tcp_sock *tp, int pktsize) |
477 | { | 477 | { |
478 | if (tp->max_window && pktsize > (tp->max_window >> 1)) | 478 | int cutoff; |
479 | return max(tp->max_window >> 1, 68U - tp->tcp_header_len); | 479 | |
480 | /* When peer uses tiny windows, there is no use in packetizing | ||
481 | * to sub-MSS pieces for the sake of SWS or making sure there | ||
482 | * are enough packets in the pipe for fast recovery. | ||
483 | * | ||
484 | * On the other hand, for extremely large MSS devices, handling | ||
485 | * smaller than MSS windows in this way does make sense. | ||
486 | */ | ||
487 | if (tp->max_window >= 512) | ||
488 | cutoff = (tp->max_window >> 1); | ||
489 | else | ||
490 | cutoff = tp->max_window; | ||
491 | |||
492 | if (cutoff && pktsize > cutoff) | ||
493 | return max_t(int, cutoff, 68U - tp->tcp_header_len); | ||
480 | else | 494 | else |
481 | return pktsize; | 495 | return pktsize; |
482 | } | 496 | } |
diff --git a/kernel/compat.c b/kernel/compat.c index e167efce8423..c9e2ec0b34a8 100644 --- a/kernel/compat.c +++ b/kernel/compat.c | |||
@@ -1126,3 +1126,24 @@ compat_sys_sysinfo(struct compat_sysinfo __user *info) | |||
1126 | 1126 | ||
1127 | return 0; | 1127 | return 0; |
1128 | } | 1128 | } |
1129 | |||
1130 | /* | ||
1131 | * Allocate user-space memory for the duration of a single system call, | ||
1132 | * in order to marshall parameters inside a compat thunk. | ||
1133 | */ | ||
1134 | void __user *compat_alloc_user_space(unsigned long len) | ||
1135 | { | ||
1136 | void __user *ptr; | ||
1137 | |||
1138 | /* If len would occupy more than half of the entire compat space... */ | ||
1139 | if (unlikely(len > (((compat_uptr_t)~0) >> 1))) | ||
1140 | return NULL; | ||
1141 | |||
1142 | ptr = arch_compat_alloc_user_space(len); | ||
1143 | |||
1144 | if (unlikely(!access_ok(VERIFY_WRITE, ptr, len))) | ||
1145 | return NULL; | ||
1146 | |||
1147 | return ptr; | ||
1148 | } | ||
1149 | EXPORT_SYMBOL_GPL(compat_alloc_user_space); | ||
diff --git a/kernel/fork.c b/kernel/fork.c index b7e9d60a675d..c445f8cc408d 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -356,10 +356,10 @@ static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm) | |||
356 | if (IS_ERR(pol)) | 356 | if (IS_ERR(pol)) |
357 | goto fail_nomem_policy; | 357 | goto fail_nomem_policy; |
358 | vma_set_policy(tmp, pol); | 358 | vma_set_policy(tmp, pol); |
359 | tmp->vm_mm = mm; | ||
359 | if (anon_vma_fork(tmp, mpnt)) | 360 | if (anon_vma_fork(tmp, mpnt)) |
360 | goto fail_nomem_anon_vma_fork; | 361 | goto fail_nomem_anon_vma_fork; |
361 | tmp->vm_flags &= ~VM_LOCKED; | 362 | tmp->vm_flags &= ~VM_LOCKED; |
362 | tmp->vm_mm = mm; | ||
363 | tmp->vm_next = tmp->vm_prev = NULL; | 363 | tmp->vm_next = tmp->vm_prev = NULL; |
364 | file = tmp->vm_file; | 364 | file = tmp->vm_file; |
365 | if (file) { | 365 | if (file) { |
diff --git a/kernel/hw_breakpoint.c b/kernel/hw_breakpoint.c index d71a987fd2bf..c7c2aed9e2dc 100644 --- a/kernel/hw_breakpoint.c +++ b/kernel/hw_breakpoint.c | |||
@@ -433,7 +433,8 @@ register_user_hw_breakpoint(struct perf_event_attr *attr, | |||
433 | perf_overflow_handler_t triggered, | 433 | perf_overflow_handler_t triggered, |
434 | struct task_struct *tsk) | 434 | struct task_struct *tsk) |
435 | { | 435 | { |
436 | return perf_event_create_kernel_counter(attr, -1, tsk->pid, triggered); | 436 | return perf_event_create_kernel_counter(attr, -1, task_pid_vnr(tsk), |
437 | triggered); | ||
437 | } | 438 | } |
438 | EXPORT_SYMBOL_GPL(register_user_hw_breakpoint); | 439 | EXPORT_SYMBOL_GPL(register_user_hw_breakpoint); |
439 | 440 | ||
diff --git a/kernel/sched.c b/kernel/sched.c index ed09d4f2a69c..dc85ceb90832 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -3513,9 +3513,9 @@ void task_times(struct task_struct *p, cputime_t *ut, cputime_t *st) | |||
3513 | rtime = nsecs_to_cputime(p->se.sum_exec_runtime); | 3513 | rtime = nsecs_to_cputime(p->se.sum_exec_runtime); |
3514 | 3514 | ||
3515 | if (total) { | 3515 | if (total) { |
3516 | u64 temp; | 3516 | u64 temp = rtime; |
3517 | 3517 | ||
3518 | temp = (u64)(rtime * utime); | 3518 | temp *= utime; |
3519 | do_div(temp, total); | 3519 | do_div(temp, total); |
3520 | utime = (cputime_t)temp; | 3520 | utime = (cputime_t)temp; |
3521 | } else | 3521 | } else |
@@ -3546,9 +3546,9 @@ void thread_group_times(struct task_struct *p, cputime_t *ut, cputime_t *st) | |||
3546 | rtime = nsecs_to_cputime(cputime.sum_exec_runtime); | 3546 | rtime = nsecs_to_cputime(cputime.sum_exec_runtime); |
3547 | 3547 | ||
3548 | if (total) { | 3548 | if (total) { |
3549 | u64 temp; | 3549 | u64 temp = rtime; |
3550 | 3550 | ||
3551 | temp = (u64)(rtime * cputime.utime); | 3551 | temp *= cputime.utime; |
3552 | do_div(temp, total); | 3552 | do_div(temp, total); |
3553 | utime = (cputime_t)temp; | 3553 | utime = (cputime_t)temp; |
3554 | } else | 3554 | } else |
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c index 9b5b4f86b742..db3f674ca49d 100644 --- a/kernel/sched_fair.c +++ b/kernel/sched_fair.c | |||
@@ -54,13 +54,13 @@ enum sched_tunable_scaling sysctl_sched_tunable_scaling | |||
54 | * Minimal preemption granularity for CPU-bound tasks: | 54 | * Minimal preemption granularity for CPU-bound tasks: |
55 | * (default: 2 msec * (1 + ilog(ncpus)), units: nanoseconds) | 55 | * (default: 2 msec * (1 + ilog(ncpus)), units: nanoseconds) |
56 | */ | 56 | */ |
57 | unsigned int sysctl_sched_min_granularity = 2000000ULL; | 57 | unsigned int sysctl_sched_min_granularity = 750000ULL; |
58 | unsigned int normalized_sysctl_sched_min_granularity = 2000000ULL; | 58 | unsigned int normalized_sysctl_sched_min_granularity = 750000ULL; |
59 | 59 | ||
60 | /* | 60 | /* |
61 | * is kept at sysctl_sched_latency / sysctl_sched_min_granularity | 61 | * is kept at sysctl_sched_latency / sysctl_sched_min_granularity |
62 | */ | 62 | */ |
63 | static unsigned int sched_nr_latency = 3; | 63 | static unsigned int sched_nr_latency = 8; |
64 | 64 | ||
65 | /* | 65 | /* |
66 | * After fork, child runs first. If set to 0 (default) then | 66 | * After fork, child runs first. If set to 0 (default) then |
@@ -3630,7 +3630,7 @@ static inline int nohz_kick_needed(struct rq *rq, int cpu) | |||
3630 | if (time_before(now, nohz.next_balance)) | 3630 | if (time_before(now, nohz.next_balance)) |
3631 | return 0; | 3631 | return 0; |
3632 | 3632 | ||
3633 | if (!rq->nr_running) | 3633 | if (rq->idle_at_tick) |
3634 | return 0; | 3634 | return 0; |
3635 | 3635 | ||
3636 | first_pick_cpu = atomic_read(&nohz.first_pick_cpu); | 3636 | first_pick_cpu = atomic_read(&nohz.first_pick_cpu); |
diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 727f24e563ae..f77afd939229 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c | |||
@@ -1,19 +1,26 @@ | |||
1 | /* | 1 | /* |
2 | * linux/kernel/workqueue.c | 2 | * kernel/workqueue.c - generic async execution with shared worker pool |
3 | * | 3 | * |
4 | * Generic mechanism for defining kernel helper threads for running | 4 | * Copyright (C) 2002 Ingo Molnar |
5 | * arbitrary tasks in process context. | ||
6 | * | 5 | * |
7 | * Started by Ingo Molnar, Copyright (C) 2002 | 6 | * Derived from the taskqueue/keventd code by: |
7 | * David Woodhouse <dwmw2@infradead.org> | ||
8 | * Andrew Morton | ||
9 | * Kai Petzke <wpp@marie.physik.tu-berlin.de> | ||
10 | * Theodore Ts'o <tytso@mit.edu> | ||
8 | * | 11 | * |
9 | * Derived from the taskqueue/keventd code by: | 12 | * Made to use alloc_percpu by Christoph Lameter. |
10 | * | 13 | * |
11 | * David Woodhouse <dwmw2@infradead.org> | 14 | * Copyright (C) 2010 SUSE Linux Products GmbH |
12 | * Andrew Morton | 15 | * Copyright (C) 2010 Tejun Heo <tj@kernel.org> |
13 | * Kai Petzke <wpp@marie.physik.tu-berlin.de> | ||
14 | * Theodore Ts'o <tytso@mit.edu> | ||
15 | * | 16 | * |
16 | * Made to use alloc_percpu by Christoph Lameter. | 17 | * This is the generic async execution mechanism. Work items as are |
18 | * executed in process context. The worker pool is shared and | ||
19 | * automatically managed. There is one worker pool for each CPU and | ||
20 | * one extra for works which are better served by workers which are | ||
21 | * not bound to any specific CPU. | ||
22 | * | ||
23 | * Please read Documentation/workqueue.txt for details. | ||
17 | */ | 24 | */ |
18 | 25 | ||
19 | #include <linux/module.h> | 26 | #include <linux/module.h> |
diff --git a/mm/backing-dev.c b/mm/backing-dev.c index c2bf86f470ed..65d420499a61 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c | |||
@@ -30,6 +30,7 @@ EXPORT_SYMBOL_GPL(default_backing_dev_info); | |||
30 | 30 | ||
31 | struct backing_dev_info noop_backing_dev_info = { | 31 | struct backing_dev_info noop_backing_dev_info = { |
32 | .name = "noop", | 32 | .name = "noop", |
33 | .capabilities = BDI_CAP_NO_ACCT_AND_WRITEBACK, | ||
33 | }; | 34 | }; |
34 | EXPORT_SYMBOL_GPL(noop_backing_dev_info); | 35 | EXPORT_SYMBOL_GPL(noop_backing_dev_info); |
35 | 36 | ||
@@ -243,6 +244,7 @@ static int __init default_bdi_init(void) | |||
243 | err = bdi_init(&default_backing_dev_info); | 244 | err = bdi_init(&default_backing_dev_info); |
244 | if (!err) | 245 | if (!err) |
245 | bdi_register(&default_backing_dev_info, NULL, "default"); | 246 | bdi_register(&default_backing_dev_info, NULL, "default"); |
247 | err = bdi_init(&noop_backing_dev_info); | ||
246 | 248 | ||
247 | return err; | 249 | return err; |
248 | } | 250 | } |
diff --git a/mm/fremap.c b/mm/fremap.c index 46f5dacf90a2..7b7f852848de 100644 --- a/mm/fremap.c +++ b/mm/fremap.c | |||
@@ -125,7 +125,6 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size, | |||
125 | { | 125 | { |
126 | struct mm_struct *mm = current->mm; | 126 | struct mm_struct *mm = current->mm; |
127 | struct address_space *mapping; | 127 | struct address_space *mapping; |
128 | unsigned long end = start + size; | ||
129 | struct vm_area_struct *vma; | 128 | struct vm_area_struct *vma; |
130 | int err = -EINVAL; | 129 | int err = -EINVAL; |
131 | int has_write_lock = 0; | 130 | int has_write_lock = 0; |
@@ -168,7 +167,7 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size, | |||
168 | if (!(vma->vm_flags & VM_CAN_NONLINEAR)) | 167 | if (!(vma->vm_flags & VM_CAN_NONLINEAR)) |
169 | goto out; | 168 | goto out; |
170 | 169 | ||
171 | if (end <= start || start < vma->vm_start || end > vma->vm_end) | 170 | if (start < vma->vm_start || start + size > vma->vm_end) |
172 | goto out; | 171 | goto out; |
173 | 172 | ||
174 | /* Must set VM_NONLINEAR before any pages are populated. */ | 173 | /* Must set VM_NONLINEAR before any pages are populated. */ |
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index cc5be788a39f..c03273807182 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -2324,11 +2324,8 @@ retry_avoidcopy: | |||
2324 | * and just make the page writable */ | 2324 | * and just make the page writable */ |
2325 | avoidcopy = (page_mapcount(old_page) == 1); | 2325 | avoidcopy = (page_mapcount(old_page) == 1); |
2326 | if (avoidcopy) { | 2326 | if (avoidcopy) { |
2327 | if (!trylock_page(old_page)) { | 2327 | if (PageAnon(old_page)) |
2328 | if (PageAnon(old_page)) | 2328 | page_move_anon_rmap(old_page, vma, address); |
2329 | page_move_anon_rmap(old_page, vma, address); | ||
2330 | } else | ||
2331 | unlock_page(old_page); | ||
2332 | set_huge_ptep_writable(vma, address, ptep); | 2329 | set_huge_ptep_writable(vma, address, ptep); |
2333 | return 0; | 2330 | return 0; |
2334 | } | 2331 | } |
@@ -2404,7 +2401,7 @@ retry_avoidcopy: | |||
2404 | set_huge_pte_at(mm, address, ptep, | 2401 | set_huge_pte_at(mm, address, ptep, |
2405 | make_huge_pte(vma, new_page, 1)); | 2402 | make_huge_pte(vma, new_page, 1)); |
2406 | page_remove_rmap(old_page); | 2403 | page_remove_rmap(old_page); |
2407 | hugepage_add_anon_rmap(new_page, vma, address); | 2404 | hugepage_add_new_anon_rmap(new_page, vma, address); |
2408 | /* Make the old page be freed below */ | 2405 | /* Make the old page be freed below */ |
2409 | new_page = old_page; | 2406 | new_page = old_page; |
2410 | mmu_notifier_invalidate_range_end(mm, | 2407 | mmu_notifier_invalidate_range_end(mm, |
@@ -2631,10 +2628,16 @@ int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, | |||
2631 | vma, address); | 2628 | vma, address); |
2632 | } | 2629 | } |
2633 | 2630 | ||
2634 | if (!pagecache_page) { | 2631 | /* |
2635 | page = pte_page(entry); | 2632 | * hugetlb_cow() requires page locks of pte_page(entry) and |
2633 | * pagecache_page, so here we need take the former one | ||
2634 | * when page != pagecache_page or !pagecache_page. | ||
2635 | * Note that locking order is always pagecache_page -> page, | ||
2636 | * so no worry about deadlock. | ||
2637 | */ | ||
2638 | page = pte_page(entry); | ||
2639 | if (page != pagecache_page) | ||
2636 | lock_page(page); | 2640 | lock_page(page); |
2637 | } | ||
2638 | 2641 | ||
2639 | spin_lock(&mm->page_table_lock); | 2642 | spin_lock(&mm->page_table_lock); |
2640 | /* Check for a racing update before calling hugetlb_cow */ | 2643 | /* Check for a racing update before calling hugetlb_cow */ |
@@ -2661,9 +2664,8 @@ out_page_table_lock: | |||
2661 | if (pagecache_page) { | 2664 | if (pagecache_page) { |
2662 | unlock_page(pagecache_page); | 2665 | unlock_page(pagecache_page); |
2663 | put_page(pagecache_page); | 2666 | put_page(pagecache_page); |
2664 | } else { | ||
2665 | unlock_page(page); | ||
2666 | } | 2667 | } |
2668 | unlock_page(page); | ||
2667 | 2669 | ||
2668 | out_mutex: | 2670 | out_mutex: |
2669 | mutex_unlock(&hugetlb_instantiation_mutex); | 2671 | mutex_unlock(&hugetlb_instantiation_mutex); |
diff --git a/mm/memory.c b/mm/memory.c index 71b161b73bb5..0e18b4d649ec 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -2680,10 +2680,12 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
2680 | delayacct_clear_flag(DELAYACCT_PF_SWAPIN); | 2680 | delayacct_clear_flag(DELAYACCT_PF_SWAPIN); |
2681 | 2681 | ||
2682 | /* | 2682 | /* |
2683 | * Make sure try_to_free_swap didn't release the swapcache | 2683 | * Make sure try_to_free_swap or reuse_swap_page or swapoff did not |
2684 | * from under us. The page pin isn't enough to prevent that. | 2684 | * release the swapcache from under us. The page pin, and pte_same |
2685 | * test below, are not enough to exclude that. Even if it is still | ||
2686 | * swapcache, we need to check that the page's swap has not changed. | ||
2685 | */ | 2687 | */ |
2686 | if (unlikely(!PageSwapCache(page))) | 2688 | if (unlikely(!PageSwapCache(page) || page_private(page) != entry.val)) |
2687 | goto out_page; | 2689 | goto out_page; |
2688 | 2690 | ||
2689 | if (ksm_might_need_to_copy(page, vma, address)) { | 2691 | if (ksm_might_need_to_copy(page, vma, address)) { |
@@ -2009,6 +2009,7 @@ static int __split_vma(struct mm_struct * mm, struct vm_area_struct * vma, | |||
2009 | removed_exe_file_vma(mm); | 2009 | removed_exe_file_vma(mm); |
2010 | fput(new->vm_file); | 2010 | fput(new->vm_file); |
2011 | } | 2011 | } |
2012 | unlink_anon_vmas(new); | ||
2012 | out_free_mpol: | 2013 | out_free_mpol: |
2013 | mpol_put(pol); | 2014 | mpol_put(pol); |
2014 | out_free_vma: | 2015 | out_free_vma: |
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index fc81cb22869e..4029583a1024 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c | |||
@@ -121,8 +121,8 @@ struct task_struct *find_lock_task_mm(struct task_struct *p) | |||
121 | } | 121 | } |
122 | 122 | ||
123 | /* return true if the task is not adequate as candidate victim task. */ | 123 | /* return true if the task is not adequate as candidate victim task. */ |
124 | static bool oom_unkillable_task(struct task_struct *p, struct mem_cgroup *mem, | 124 | static bool oom_unkillable_task(struct task_struct *p, |
125 | const nodemask_t *nodemask) | 125 | const struct mem_cgroup *mem, const nodemask_t *nodemask) |
126 | { | 126 | { |
127 | if (is_global_init(p)) | 127 | if (is_global_init(p)) |
128 | return true; | 128 | return true; |
@@ -208,8 +208,13 @@ unsigned int oom_badness(struct task_struct *p, struct mem_cgroup *mem, | |||
208 | */ | 208 | */ |
209 | points += p->signal->oom_score_adj; | 209 | points += p->signal->oom_score_adj; |
210 | 210 | ||
211 | if (points < 0) | 211 | /* |
212 | return 0; | 212 | * Never return 0 for an eligible task that may be killed since it's |
213 | * possible that no single user task uses more than 0.1% of memory and | ||
214 | * no single admin tasks uses more than 3.0%. | ||
215 | */ | ||
216 | if (points <= 0) | ||
217 | return 1; | ||
213 | return (points < 1000) ? points : 1000; | 218 | return (points < 1000) ? points : 1000; |
214 | } | 219 | } |
215 | 220 | ||
@@ -339,26 +344,24 @@ static struct task_struct *select_bad_process(unsigned int *ppoints, | |||
339 | /** | 344 | /** |
340 | * dump_tasks - dump current memory state of all system tasks | 345 | * dump_tasks - dump current memory state of all system tasks |
341 | * @mem: current's memory controller, if constrained | 346 | * @mem: current's memory controller, if constrained |
347 | * @nodemask: nodemask passed to page allocator for mempolicy ooms | ||
342 | * | 348 | * |
343 | * Dumps the current memory state of all system tasks, excluding kernel threads. | 349 | * Dumps the current memory state of all eligible tasks. Tasks not in the same |
350 | * memcg, not in the same cpuset, or bound to a disjoint set of mempolicy nodes | ||
351 | * are not shown. | ||
344 | * State information includes task's pid, uid, tgid, vm size, rss, cpu, oom_adj | 352 | * State information includes task's pid, uid, tgid, vm size, rss, cpu, oom_adj |
345 | * value, oom_score_adj value, and name. | 353 | * value, oom_score_adj value, and name. |
346 | * | 354 | * |
347 | * If the actual is non-NULL, only tasks that are a member of the mem_cgroup are | ||
348 | * shown. | ||
349 | * | ||
350 | * Call with tasklist_lock read-locked. | 355 | * Call with tasklist_lock read-locked. |
351 | */ | 356 | */ |
352 | static void dump_tasks(const struct mem_cgroup *mem) | 357 | static void dump_tasks(const struct mem_cgroup *mem, const nodemask_t *nodemask) |
353 | { | 358 | { |
354 | struct task_struct *p; | 359 | struct task_struct *p; |
355 | struct task_struct *task; | 360 | struct task_struct *task; |
356 | 361 | ||
357 | pr_info("[ pid ] uid tgid total_vm rss cpu oom_adj oom_score_adj name\n"); | 362 | pr_info("[ pid ] uid tgid total_vm rss cpu oom_adj oom_score_adj name\n"); |
358 | for_each_process(p) { | 363 | for_each_process(p) { |
359 | if (p->flags & PF_KTHREAD) | 364 | if (oom_unkillable_task(p, mem, nodemask)) |
360 | continue; | ||
361 | if (mem && !task_in_mem_cgroup(p, mem)) | ||
362 | continue; | 365 | continue; |
363 | 366 | ||
364 | task = find_lock_task_mm(p); | 367 | task = find_lock_task_mm(p); |
@@ -381,7 +384,7 @@ static void dump_tasks(const struct mem_cgroup *mem) | |||
381 | } | 384 | } |
382 | 385 | ||
383 | static void dump_header(struct task_struct *p, gfp_t gfp_mask, int order, | 386 | static void dump_header(struct task_struct *p, gfp_t gfp_mask, int order, |
384 | struct mem_cgroup *mem) | 387 | struct mem_cgroup *mem, const nodemask_t *nodemask) |
385 | { | 388 | { |
386 | task_lock(current); | 389 | task_lock(current); |
387 | pr_warning("%s invoked oom-killer: gfp_mask=0x%x, order=%d, " | 390 | pr_warning("%s invoked oom-killer: gfp_mask=0x%x, order=%d, " |
@@ -394,7 +397,7 @@ static void dump_header(struct task_struct *p, gfp_t gfp_mask, int order, | |||
394 | mem_cgroup_print_oom_info(mem, p); | 397 | mem_cgroup_print_oom_info(mem, p); |
395 | show_mem(); | 398 | show_mem(); |
396 | if (sysctl_oom_dump_tasks) | 399 | if (sysctl_oom_dump_tasks) |
397 | dump_tasks(mem); | 400 | dump_tasks(mem, nodemask); |
398 | } | 401 | } |
399 | 402 | ||
400 | #define K(x) ((x) << (PAGE_SHIFT-10)) | 403 | #define K(x) ((x) << (PAGE_SHIFT-10)) |
@@ -436,7 +439,7 @@ static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order, | |||
436 | unsigned int victim_points = 0; | 439 | unsigned int victim_points = 0; |
437 | 440 | ||
438 | if (printk_ratelimit()) | 441 | if (printk_ratelimit()) |
439 | dump_header(p, gfp_mask, order, mem); | 442 | dump_header(p, gfp_mask, order, mem, nodemask); |
440 | 443 | ||
441 | /* | 444 | /* |
442 | * If the task is already exiting, don't alarm the sysadmin or kill | 445 | * If the task is already exiting, don't alarm the sysadmin or kill |
@@ -482,7 +485,7 @@ static int oom_kill_process(struct task_struct *p, gfp_t gfp_mask, int order, | |||
482 | * Determines whether the kernel must panic because of the panic_on_oom sysctl. | 485 | * Determines whether the kernel must panic because of the panic_on_oom sysctl. |
483 | */ | 486 | */ |
484 | static void check_panic_on_oom(enum oom_constraint constraint, gfp_t gfp_mask, | 487 | static void check_panic_on_oom(enum oom_constraint constraint, gfp_t gfp_mask, |
485 | int order) | 488 | int order, const nodemask_t *nodemask) |
486 | { | 489 | { |
487 | if (likely(!sysctl_panic_on_oom)) | 490 | if (likely(!sysctl_panic_on_oom)) |
488 | return; | 491 | return; |
@@ -496,7 +499,7 @@ static void check_panic_on_oom(enum oom_constraint constraint, gfp_t gfp_mask, | |||
496 | return; | 499 | return; |
497 | } | 500 | } |
498 | read_lock(&tasklist_lock); | 501 | read_lock(&tasklist_lock); |
499 | dump_header(NULL, gfp_mask, order, NULL); | 502 | dump_header(NULL, gfp_mask, order, NULL, nodemask); |
500 | read_unlock(&tasklist_lock); | 503 | read_unlock(&tasklist_lock); |
501 | panic("Out of memory: %s panic_on_oom is enabled\n", | 504 | panic("Out of memory: %s panic_on_oom is enabled\n", |
502 | sysctl_panic_on_oom == 2 ? "compulsory" : "system-wide"); | 505 | sysctl_panic_on_oom == 2 ? "compulsory" : "system-wide"); |
@@ -509,7 +512,7 @@ void mem_cgroup_out_of_memory(struct mem_cgroup *mem, gfp_t gfp_mask) | |||
509 | unsigned int points = 0; | 512 | unsigned int points = 0; |
510 | struct task_struct *p; | 513 | struct task_struct *p; |
511 | 514 | ||
512 | check_panic_on_oom(CONSTRAINT_MEMCG, gfp_mask, 0); | 515 | check_panic_on_oom(CONSTRAINT_MEMCG, gfp_mask, 0, NULL); |
513 | limit = mem_cgroup_get_limit(mem) >> PAGE_SHIFT; | 516 | limit = mem_cgroup_get_limit(mem) >> PAGE_SHIFT; |
514 | read_lock(&tasklist_lock); | 517 | read_lock(&tasklist_lock); |
515 | retry: | 518 | retry: |
@@ -641,6 +644,7 @@ static void clear_system_oom(void) | |||
641 | void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, | 644 | void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, |
642 | int order, nodemask_t *nodemask) | 645 | int order, nodemask_t *nodemask) |
643 | { | 646 | { |
647 | const nodemask_t *mpol_mask; | ||
644 | struct task_struct *p; | 648 | struct task_struct *p; |
645 | unsigned long totalpages; | 649 | unsigned long totalpages; |
646 | unsigned long freed = 0; | 650 | unsigned long freed = 0; |
@@ -670,7 +674,8 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, | |||
670 | */ | 674 | */ |
671 | constraint = constrained_alloc(zonelist, gfp_mask, nodemask, | 675 | constraint = constrained_alloc(zonelist, gfp_mask, nodemask, |
672 | &totalpages); | 676 | &totalpages); |
673 | check_panic_on_oom(constraint, gfp_mask, order); | 677 | mpol_mask = (constraint == CONSTRAINT_MEMORY_POLICY) ? nodemask : NULL; |
678 | check_panic_on_oom(constraint, gfp_mask, order, mpol_mask); | ||
674 | 679 | ||
675 | read_lock(&tasklist_lock); | 680 | read_lock(&tasklist_lock); |
676 | if (sysctl_oom_kill_allocating_task && | 681 | if (sysctl_oom_kill_allocating_task && |
@@ -688,15 +693,13 @@ void out_of_memory(struct zonelist *zonelist, gfp_t gfp_mask, | |||
688 | } | 693 | } |
689 | 694 | ||
690 | retry: | 695 | retry: |
691 | p = select_bad_process(&points, totalpages, NULL, | 696 | p = select_bad_process(&points, totalpages, NULL, mpol_mask); |
692 | constraint == CONSTRAINT_MEMORY_POLICY ? nodemask : | ||
693 | NULL); | ||
694 | if (PTR_ERR(p) == -1UL) | 697 | if (PTR_ERR(p) == -1UL) |
695 | goto out; | 698 | goto out; |
696 | 699 | ||
697 | /* Found nothing?!?! Either we hang forever, or we panic. */ | 700 | /* Found nothing?!?! Either we hang forever, or we panic. */ |
698 | if (!p) { | 701 | if (!p) { |
699 | dump_header(NULL, gfp_mask, order, NULL); | 702 | dump_header(NULL, gfp_mask, order, NULL, mpol_mask); |
700 | read_unlock(&tasklist_lock); | 703 | read_unlock(&tasklist_lock); |
701 | panic("Out of memory and no killable processes...\n"); | 704 | panic("Out of memory and no killable processes...\n"); |
702 | } | 705 | } |
diff --git a/mm/percpu.c b/mm/percpu.c index 58c572b18b07..c76ef3891e0d 100644 --- a/mm/percpu.c +++ b/mm/percpu.c | |||
@@ -1401,9 +1401,9 @@ int __init pcpu_setup_first_chunk(const struct pcpu_alloc_info *ai, | |||
1401 | 1401 | ||
1402 | if (pcpu_first_unit_cpu == NR_CPUS) | 1402 | if (pcpu_first_unit_cpu == NR_CPUS) |
1403 | pcpu_first_unit_cpu = cpu; | 1403 | pcpu_first_unit_cpu = cpu; |
1404 | pcpu_last_unit_cpu = cpu; | ||
1404 | } | 1405 | } |
1405 | } | 1406 | } |
1406 | pcpu_last_unit_cpu = cpu; | ||
1407 | pcpu_nr_units = unit; | 1407 | pcpu_nr_units = unit; |
1408 | 1408 | ||
1409 | for_each_possible_cpu(cpu) | 1409 | for_each_possible_cpu(cpu) |
@@ -1564,13 +1564,14 @@ static void __hugepage_set_anon_rmap(struct page *page, | |||
1564 | struct vm_area_struct *vma, unsigned long address, int exclusive) | 1564 | struct vm_area_struct *vma, unsigned long address, int exclusive) |
1565 | { | 1565 | { |
1566 | struct anon_vma *anon_vma = vma->anon_vma; | 1566 | struct anon_vma *anon_vma = vma->anon_vma; |
1567 | |||
1567 | BUG_ON(!anon_vma); | 1568 | BUG_ON(!anon_vma); |
1568 | if (!exclusive) { | 1569 | |
1569 | struct anon_vma_chain *avc; | 1570 | if (PageAnon(page)) |
1570 | avc = list_entry(vma->anon_vma_chain.prev, | 1571 | return; |
1571 | struct anon_vma_chain, same_vma); | 1572 | if (!exclusive) |
1572 | anon_vma = avc->anon_vma; | 1573 | anon_vma = anon_vma->root; |
1573 | } | 1574 | |
1574 | anon_vma = (void *) anon_vma + PAGE_MAPPING_ANON; | 1575 | anon_vma = (void *) anon_vma + PAGE_MAPPING_ANON; |
1575 | page->mapping = (struct address_space *) anon_vma; | 1576 | page->mapping = (struct address_space *) anon_vma; |
1576 | page->index = linear_page_index(vma, address); | 1577 | page->index = linear_page_index(vma, address); |
@@ -1581,6 +1582,8 @@ void hugepage_add_anon_rmap(struct page *page, | |||
1581 | { | 1582 | { |
1582 | struct anon_vma *anon_vma = vma->anon_vma; | 1583 | struct anon_vma *anon_vma = vma->anon_vma; |
1583 | int first; | 1584 | int first; |
1585 | |||
1586 | BUG_ON(!PageLocked(page)); | ||
1584 | BUG_ON(!anon_vma); | 1587 | BUG_ON(!anon_vma); |
1585 | BUG_ON(address < vma->vm_start || address >= vma->vm_end); | 1588 | BUG_ON(address < vma->vm_start || address >= vma->vm_end); |
1586 | first = atomic_inc_and_test(&page->_mapcount); | 1589 | first = atomic_inc_and_test(&page->_mapcount); |
diff --git a/mm/vmscan.c b/mm/vmscan.c index c391c320dbaf..c5dfabf25f11 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -1804,12 +1804,11 @@ static void shrink_zone(int priority, struct zone *zone, | |||
1804 | * If a zone is deemed to be full of pinned pages then just give it a light | 1804 | * If a zone is deemed to be full of pinned pages then just give it a light |
1805 | * scan then give up on it. | 1805 | * scan then give up on it. |
1806 | */ | 1806 | */ |
1807 | static bool shrink_zones(int priority, struct zonelist *zonelist, | 1807 | static void shrink_zones(int priority, struct zonelist *zonelist, |
1808 | struct scan_control *sc) | 1808 | struct scan_control *sc) |
1809 | { | 1809 | { |
1810 | struct zoneref *z; | 1810 | struct zoneref *z; |
1811 | struct zone *zone; | 1811 | struct zone *zone; |
1812 | bool all_unreclaimable = true; | ||
1813 | 1812 | ||
1814 | for_each_zone_zonelist_nodemask(zone, z, zonelist, | 1813 | for_each_zone_zonelist_nodemask(zone, z, zonelist, |
1815 | gfp_zone(sc->gfp_mask), sc->nodemask) { | 1814 | gfp_zone(sc->gfp_mask), sc->nodemask) { |
@@ -1827,8 +1826,38 @@ static bool shrink_zones(int priority, struct zonelist *zonelist, | |||
1827 | } | 1826 | } |
1828 | 1827 | ||
1829 | shrink_zone(priority, zone, sc); | 1828 | shrink_zone(priority, zone, sc); |
1830 | all_unreclaimable = false; | ||
1831 | } | 1829 | } |
1830 | } | ||
1831 | |||
1832 | static bool zone_reclaimable(struct zone *zone) | ||
1833 | { | ||
1834 | return zone->pages_scanned < zone_reclaimable_pages(zone) * 6; | ||
1835 | } | ||
1836 | |||
1837 | /* | ||
1838 | * As hibernation is going on, kswapd is freezed so that it can't mark | ||
1839 | * the zone into all_unreclaimable. It can't handle OOM during hibernation. | ||
1840 | * So let's check zone's unreclaimable in direct reclaim as well as kswapd. | ||
1841 | */ | ||
1842 | static bool all_unreclaimable(struct zonelist *zonelist, | ||
1843 | struct scan_control *sc) | ||
1844 | { | ||
1845 | struct zoneref *z; | ||
1846 | struct zone *zone; | ||
1847 | bool all_unreclaimable = true; | ||
1848 | |||
1849 | for_each_zone_zonelist_nodemask(zone, z, zonelist, | ||
1850 | gfp_zone(sc->gfp_mask), sc->nodemask) { | ||
1851 | if (!populated_zone(zone)) | ||
1852 | continue; | ||
1853 | if (!cpuset_zone_allowed_hardwall(zone, GFP_KERNEL)) | ||
1854 | continue; | ||
1855 | if (zone_reclaimable(zone)) { | ||
1856 | all_unreclaimable = false; | ||
1857 | break; | ||
1858 | } | ||
1859 | } | ||
1860 | |||
1832 | return all_unreclaimable; | 1861 | return all_unreclaimable; |
1833 | } | 1862 | } |
1834 | 1863 | ||
@@ -1852,7 +1881,6 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist, | |||
1852 | struct scan_control *sc) | 1881 | struct scan_control *sc) |
1853 | { | 1882 | { |
1854 | int priority; | 1883 | int priority; |
1855 | bool all_unreclaimable; | ||
1856 | unsigned long total_scanned = 0; | 1884 | unsigned long total_scanned = 0; |
1857 | struct reclaim_state *reclaim_state = current->reclaim_state; | 1885 | struct reclaim_state *reclaim_state = current->reclaim_state; |
1858 | struct zoneref *z; | 1886 | struct zoneref *z; |
@@ -1869,7 +1897,7 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist, | |||
1869 | sc->nr_scanned = 0; | 1897 | sc->nr_scanned = 0; |
1870 | if (!priority) | 1898 | if (!priority) |
1871 | disable_swap_token(); | 1899 | disable_swap_token(); |
1872 | all_unreclaimable = shrink_zones(priority, zonelist, sc); | 1900 | shrink_zones(priority, zonelist, sc); |
1873 | /* | 1901 | /* |
1874 | * Don't shrink slabs when reclaiming memory from | 1902 | * Don't shrink slabs when reclaiming memory from |
1875 | * over limit cgroups | 1903 | * over limit cgroups |
@@ -1931,7 +1959,7 @@ out: | |||
1931 | return sc->nr_reclaimed; | 1959 | return sc->nr_reclaimed; |
1932 | 1960 | ||
1933 | /* top priority shrink_zones still had more to do? don't OOM, then */ | 1961 | /* top priority shrink_zones still had more to do? don't OOM, then */ |
1934 | if (scanning_global_lru(sc) && !all_unreclaimable) | 1962 | if (scanning_global_lru(sc) && !all_unreclaimable(zonelist, sc)) |
1935 | return 1; | 1963 | return 1; |
1936 | 1964 | ||
1937 | return 0; | 1965 | return 0; |
@@ -2197,8 +2225,7 @@ loop_again: | |||
2197 | total_scanned += sc.nr_scanned; | 2225 | total_scanned += sc.nr_scanned; |
2198 | if (zone->all_unreclaimable) | 2226 | if (zone->all_unreclaimable) |
2199 | continue; | 2227 | continue; |
2200 | if (nr_slab == 0 && | 2228 | if (nr_slab == 0 && !zone_reclaimable(zone)) |
2201 | zone->pages_scanned >= (zone_reclaimable_pages(zone) * 6)) | ||
2202 | zone->all_unreclaimable = 1; | 2229 | zone->all_unreclaimable = 1; |
2203 | /* | 2230 | /* |
2204 | * If we've done a decent amount of scanning and | 2231 | * If we've done a decent amount of scanning and |
diff --git a/net/9p/client.c b/net/9p/client.c index dc6f2f26d023..9eb72505308f 100644 --- a/net/9p/client.c +++ b/net/9p/client.c | |||
@@ -331,8 +331,10 @@ static void p9_tag_cleanup(struct p9_client *c) | |||
331 | } | 331 | } |
332 | } | 332 | } |
333 | 333 | ||
334 | if (c->tagpool) | 334 | if (c->tagpool) { |
335 | p9_idpool_put(0, c->tagpool); /* free reserved tag 0 */ | ||
335 | p9_idpool_destroy(c->tagpool); | 336 | p9_idpool_destroy(c->tagpool); |
337 | } | ||
336 | 338 | ||
337 | /* free requests associated with tags */ | 339 | /* free requests associated with tags */ |
338 | for (row = 0; row < (c->max_tag/P9_ROW_MAXTAG); row++) { | 340 | for (row = 0; row < (c->max_tag/P9_ROW_MAXTAG); row++) { |
@@ -944,6 +946,7 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames, | |||
944 | int16_t nwqids, count; | 946 | int16_t nwqids, count; |
945 | 947 | ||
946 | err = 0; | 948 | err = 0; |
949 | wqids = NULL; | ||
947 | clnt = oldfid->clnt; | 950 | clnt = oldfid->clnt; |
948 | if (clone) { | 951 | if (clone) { |
949 | fid = p9_fid_create(clnt); | 952 | fid = p9_fid_create(clnt); |
@@ -994,9 +997,11 @@ struct p9_fid *p9_client_walk(struct p9_fid *oldfid, int nwname, char **wnames, | |||
994 | else | 997 | else |
995 | fid->qid = oldfid->qid; | 998 | fid->qid = oldfid->qid; |
996 | 999 | ||
1000 | kfree(wqids); | ||
997 | return fid; | 1001 | return fid; |
998 | 1002 | ||
999 | clunk_fid: | 1003 | clunk_fid: |
1004 | kfree(wqids); | ||
1000 | p9_client_clunk(fid); | 1005 | p9_client_clunk(fid); |
1001 | fid = NULL; | 1006 | fid = NULL; |
1002 | 1007 | ||
diff --git a/net/Kconfig b/net/Kconfig index e330594d3709..e926884c1675 100644 --- a/net/Kconfig +++ b/net/Kconfig | |||
@@ -217,7 +217,7 @@ source "net/dns_resolver/Kconfig" | |||
217 | 217 | ||
218 | config RPS | 218 | config RPS |
219 | boolean | 219 | boolean |
220 | depends on SMP && SYSFS | 220 | depends on SMP && SYSFS && USE_GENERIC_SMP_HELPERS |
221 | default y | 221 | default y |
222 | 222 | ||
223 | menu "Network testing" | 223 | menu "Network testing" |
diff --git a/net/core/dev.c b/net/core/dev.c index b9b22a3c4c8f..660dd41aaaa6 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -4845,7 +4845,7 @@ static void rollback_registered_many(struct list_head *head) | |||
4845 | dev = list_first_entry(head, struct net_device, unreg_list); | 4845 | dev = list_first_entry(head, struct net_device, unreg_list); |
4846 | call_netdevice_notifiers(NETDEV_UNREGISTER_BATCH, dev); | 4846 | call_netdevice_notifiers(NETDEV_UNREGISTER_BATCH, dev); |
4847 | 4847 | ||
4848 | synchronize_net(); | 4848 | rcu_barrier(); |
4849 | 4849 | ||
4850 | list_for_each_entry(dev, head, unreg_list) | 4850 | list_for_each_entry(dev, head, unreg_list) |
4851 | dev_put(dev); | 4851 | dev_put(dev); |
diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index a1ad0e7180d2..1fdcacd36ce7 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c | |||
@@ -834,7 +834,7 @@ static void igmp_heard_query(struct in_device *in_dev, struct sk_buff *skb, | |||
834 | int mark = 0; | 834 | int mark = 0; |
835 | 835 | ||
836 | 836 | ||
837 | if (len == 8) { | 837 | if (len == 8 || IGMP_V2_SEEN(in_dev)) { |
838 | if (ih->code == 0) { | 838 | if (ih->code == 0) { |
839 | /* Alas, old v1 router presents here. */ | 839 | /* Alas, old v1 router presents here. */ |
840 | 840 | ||
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index 6c40a8c46e79..64b70ad162e3 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c | |||
@@ -1129,6 +1129,9 @@ static int do_ip_getsockopt(struct sock *sk, int level, int optname, | |||
1129 | case IP_HDRINCL: | 1129 | case IP_HDRINCL: |
1130 | val = inet->hdrincl; | 1130 | val = inet->hdrincl; |
1131 | break; | 1131 | break; |
1132 | case IP_NODEFRAG: | ||
1133 | val = inet->nodefrag; | ||
1134 | break; | ||
1132 | case IP_MTU_DISCOVER: | 1135 | case IP_MTU_DISCOVER: |
1133 | val = inet->pmtudisc; | 1136 | val = inet->pmtudisc; |
1134 | break; | 1137 | break; |
diff --git a/net/llc/af_llc.c b/net/llc/af_llc.c index 023ba820236f..582612998211 100644 --- a/net/llc/af_llc.c +++ b/net/llc/af_llc.c | |||
@@ -1024,7 +1024,8 @@ static int llc_ui_setsockopt(struct socket *sock, int level, int optname, | |||
1024 | { | 1024 | { |
1025 | struct sock *sk = sock->sk; | 1025 | struct sock *sk = sock->sk; |
1026 | struct llc_sock *llc = llc_sk(sk); | 1026 | struct llc_sock *llc = llc_sk(sk); |
1027 | int rc = -EINVAL, opt; | 1027 | unsigned int opt; |
1028 | int rc = -EINVAL; | ||
1028 | 1029 | ||
1029 | lock_sock(sk); | 1030 | lock_sock(sk); |
1030 | if (unlikely(level != SOL_LLC || optlen != sizeof(int))) | 1031 | if (unlikely(level != SOL_LLC || optlen != sizeof(int))) |
diff --git a/net/llc/llc_station.c b/net/llc/llc_station.c index e4dae0244d76..cf4aea3ba30f 100644 --- a/net/llc/llc_station.c +++ b/net/llc/llc_station.c | |||
@@ -689,7 +689,7 @@ static void llc_station_rcv(struct sk_buff *skb) | |||
689 | 689 | ||
690 | int __init llc_station_init(void) | 690 | int __init llc_station_init(void) |
691 | { | 691 | { |
692 | u16 rc = -ENOBUFS; | 692 | int rc = -ENOBUFS; |
693 | struct sk_buff *skb; | 693 | struct sk_buff *skb; |
694 | struct llc_station_state_ev *ev; | 694 | struct llc_station_state_ev *ev; |
695 | 695 | ||
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c index 340662789529..6318e1136b83 100644 --- a/net/sched/sch_atm.c +++ b/net/sched/sch_atm.c | |||
@@ -255,10 +255,6 @@ static int atm_tc_change(struct Qdisc *sch, u32 classid, u32 parent, | |||
255 | error = -EINVAL; | 255 | error = -EINVAL; |
256 | goto err_out; | 256 | goto err_out; |
257 | } | 257 | } |
258 | if (!list_empty(&flow->list)) { | ||
259 | error = -EEXIST; | ||
260 | goto err_out; | ||
261 | } | ||
262 | } else { | 258 | } else { |
263 | int i; | 259 | int i; |
264 | unsigned long cl; | 260 | unsigned long cl; |
diff --git a/net/sctp/output.c b/net/sctp/output.c index a646681f5acd..bcc4590ccaf2 100644 --- a/net/sctp/output.c +++ b/net/sctp/output.c | |||
@@ -92,7 +92,6 @@ struct sctp_packet *sctp_packet_config(struct sctp_packet *packet, | |||
92 | SCTP_DEBUG_PRINTK("%s: packet:%p vtag:0x%x\n", __func__, | 92 | SCTP_DEBUG_PRINTK("%s: packet:%p vtag:0x%x\n", __func__, |
93 | packet, vtag); | 93 | packet, vtag); |
94 | 94 | ||
95 | sctp_packet_reset(packet); | ||
96 | packet->vtag = vtag; | 95 | packet->vtag = vtag; |
97 | 96 | ||
98 | if (ecn_capable && sctp_packet_empty(packet)) { | 97 | if (ecn_capable && sctp_packet_empty(packet)) { |
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c index 36cb66022a27..e9eaaf7d43c1 100644 --- a/net/sunrpc/auth.c +++ b/net/sunrpc/auth.c | |||
@@ -38,7 +38,7 @@ static const struct rpc_authops *auth_flavors[RPC_AUTH_MAXFLAVOR] = { | |||
38 | static LIST_HEAD(cred_unused); | 38 | static LIST_HEAD(cred_unused); |
39 | static unsigned long number_cred_unused; | 39 | static unsigned long number_cred_unused; |
40 | 40 | ||
41 | #define MAX_HASHTABLE_BITS (10) | 41 | #define MAX_HASHTABLE_BITS (14) |
42 | static int param_set_hashtbl_sz(const char *val, const struct kernel_param *kp) | 42 | static int param_set_hashtbl_sz(const char *val, const struct kernel_param *kp) |
43 | { | 43 | { |
44 | unsigned long num; | 44 | unsigned long num; |
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index dcfc66bab2bb..12c485982814 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -745,17 +745,18 @@ gss_pipe_release(struct inode *inode) | |||
745 | struct rpc_inode *rpci = RPC_I(inode); | 745 | struct rpc_inode *rpci = RPC_I(inode); |
746 | struct gss_upcall_msg *gss_msg; | 746 | struct gss_upcall_msg *gss_msg; |
747 | 747 | ||
748 | restart: | ||
748 | spin_lock(&inode->i_lock); | 749 | spin_lock(&inode->i_lock); |
749 | while (!list_empty(&rpci->in_downcall)) { | 750 | list_for_each_entry(gss_msg, &rpci->in_downcall, list) { |
750 | 751 | ||
751 | gss_msg = list_entry(rpci->in_downcall.next, | 752 | if (!list_empty(&gss_msg->msg.list)) |
752 | struct gss_upcall_msg, list); | 753 | continue; |
753 | gss_msg->msg.errno = -EPIPE; | 754 | gss_msg->msg.errno = -EPIPE; |
754 | atomic_inc(&gss_msg->count); | 755 | atomic_inc(&gss_msg->count); |
755 | __gss_unhash_msg(gss_msg); | 756 | __gss_unhash_msg(gss_msg); |
756 | spin_unlock(&inode->i_lock); | 757 | spin_unlock(&inode->i_lock); |
757 | gss_release_msg(gss_msg); | 758 | gss_release_msg(gss_msg); |
758 | spin_lock(&inode->i_lock); | 759 | goto restart; |
759 | } | 760 | } |
760 | spin_unlock(&inode->i_lock); | 761 | spin_unlock(&inode->i_lock); |
761 | 762 | ||
diff --git a/net/sunrpc/auth_gss/gss_krb5_mech.c b/net/sunrpc/auth_gss/gss_krb5_mech.c index 032644610524..778e5dfc5144 100644 --- a/net/sunrpc/auth_gss/gss_krb5_mech.c +++ b/net/sunrpc/auth_gss/gss_krb5_mech.c | |||
@@ -237,6 +237,7 @@ get_key(const void *p, const void *end, | |||
237 | if (!supported_gss_krb5_enctype(alg)) { | 237 | if (!supported_gss_krb5_enctype(alg)) { |
238 | printk(KERN_WARNING "gss_kerberos_mech: unsupported " | 238 | printk(KERN_WARNING "gss_kerberos_mech: unsupported " |
239 | "encryption key algorithm %d\n", alg); | 239 | "encryption key algorithm %d\n", alg); |
240 | p = ERR_PTR(-EINVAL); | ||
240 | goto out_err; | 241 | goto out_err; |
241 | } | 242 | } |
242 | p = simple_get_netobj(p, end, &key); | 243 | p = simple_get_netobj(p, end, &key); |
@@ -282,15 +283,19 @@ gss_import_v1_context(const void *p, const void *end, struct krb5_ctx *ctx) | |||
282 | ctx->enctype = ENCTYPE_DES_CBC_RAW; | 283 | ctx->enctype = ENCTYPE_DES_CBC_RAW; |
283 | 284 | ||
284 | ctx->gk5e = get_gss_krb5_enctype(ctx->enctype); | 285 | ctx->gk5e = get_gss_krb5_enctype(ctx->enctype); |
285 | if (ctx->gk5e == NULL) | 286 | if (ctx->gk5e == NULL) { |
287 | p = ERR_PTR(-EINVAL); | ||
286 | goto out_err; | 288 | goto out_err; |
289 | } | ||
287 | 290 | ||
288 | /* The downcall format was designed before we completely understood | 291 | /* The downcall format was designed before we completely understood |
289 | * the uses of the context fields; so it includes some stuff we | 292 | * the uses of the context fields; so it includes some stuff we |
290 | * just give some minimal sanity-checking, and some we ignore | 293 | * just give some minimal sanity-checking, and some we ignore |
291 | * completely (like the next twenty bytes): */ | 294 | * completely (like the next twenty bytes): */ |
292 | if (unlikely(p + 20 > end || p + 20 < p)) | 295 | if (unlikely(p + 20 > end || p + 20 < p)) { |
296 | p = ERR_PTR(-EFAULT); | ||
293 | goto out_err; | 297 | goto out_err; |
298 | } | ||
294 | p += 20; | 299 | p += 20; |
295 | p = simple_get_bytes(p, end, &tmp, sizeof(tmp)); | 300 | p = simple_get_bytes(p, end, &tmp, sizeof(tmp)); |
296 | if (IS_ERR(p)) | 301 | if (IS_ERR(p)) |
@@ -619,6 +624,7 @@ gss_import_v2_context(const void *p, const void *end, struct krb5_ctx *ctx, | |||
619 | if (ctx->seq_send64 != ctx->seq_send) { | 624 | if (ctx->seq_send64 != ctx->seq_send) { |
620 | dprintk("%s: seq_send64 %lx, seq_send %x overflow?\n", __func__, | 625 | dprintk("%s: seq_send64 %lx, seq_send %x overflow?\n", __func__, |
621 | (long unsigned)ctx->seq_send64, ctx->seq_send); | 626 | (long unsigned)ctx->seq_send64, ctx->seq_send); |
627 | p = ERR_PTR(-EINVAL); | ||
622 | goto out_err; | 628 | goto out_err; |
623 | } | 629 | } |
624 | p = simple_get_bytes(p, end, &ctx->enctype, sizeof(ctx->enctype)); | 630 | p = simple_get_bytes(p, end, &ctx->enctype, sizeof(ctx->enctype)); |
diff --git a/net/sunrpc/auth_gss/gss_spkm3_mech.c b/net/sunrpc/auth_gss/gss_spkm3_mech.c index dc3f1f5ed865..adade3d313f2 100644 --- a/net/sunrpc/auth_gss/gss_spkm3_mech.c +++ b/net/sunrpc/auth_gss/gss_spkm3_mech.c | |||
@@ -100,6 +100,7 @@ gss_import_sec_context_spkm3(const void *p, size_t len, | |||
100 | if (version != 1) { | 100 | if (version != 1) { |
101 | dprintk("RPC: unknown spkm3 token format: " | 101 | dprintk("RPC: unknown spkm3 token format: " |
102 | "obsolete nfs-utils?\n"); | 102 | "obsolete nfs-utils?\n"); |
103 | p = ERR_PTR(-EINVAL); | ||
103 | goto out_err_free_ctx; | 104 | goto out_err_free_ctx; |
104 | } | 105 | } |
105 | 106 | ||
@@ -135,8 +136,10 @@ gss_import_sec_context_spkm3(const void *p, size_t len, | |||
135 | if (IS_ERR(p)) | 136 | if (IS_ERR(p)) |
136 | goto out_err_free_intg_alg; | 137 | goto out_err_free_intg_alg; |
137 | 138 | ||
138 | if (p != end) | 139 | if (p != end) { |
140 | p = ERR_PTR(-EFAULT); | ||
139 | goto out_err_free_intg_key; | 141 | goto out_err_free_intg_key; |
142 | } | ||
140 | 143 | ||
141 | ctx_id->internal_ctx_id = ctx; | 144 | ctx_id->internal_ctx_id = ctx; |
142 | 145 | ||
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 2388d83b68ff..fa5549079d79 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -226,7 +226,7 @@ static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, stru | |||
226 | goto out_no_principal; | 226 | goto out_no_principal; |
227 | } | 227 | } |
228 | 228 | ||
229 | kref_init(&clnt->cl_kref); | 229 | atomic_set(&clnt->cl_count, 1); |
230 | 230 | ||
231 | err = rpc_setup_pipedir(clnt, program->pipe_dir_name); | 231 | err = rpc_setup_pipedir(clnt, program->pipe_dir_name); |
232 | if (err < 0) | 232 | if (err < 0) |
@@ -390,14 +390,14 @@ rpc_clone_client(struct rpc_clnt *clnt) | |||
390 | if (new->cl_principal == NULL) | 390 | if (new->cl_principal == NULL) |
391 | goto out_no_principal; | 391 | goto out_no_principal; |
392 | } | 392 | } |
393 | kref_init(&new->cl_kref); | 393 | atomic_set(&new->cl_count, 1); |
394 | err = rpc_setup_pipedir(new, clnt->cl_program->pipe_dir_name); | 394 | err = rpc_setup_pipedir(new, clnt->cl_program->pipe_dir_name); |
395 | if (err != 0) | 395 | if (err != 0) |
396 | goto out_no_path; | 396 | goto out_no_path; |
397 | if (new->cl_auth) | 397 | if (new->cl_auth) |
398 | atomic_inc(&new->cl_auth->au_count); | 398 | atomic_inc(&new->cl_auth->au_count); |
399 | xprt_get(clnt->cl_xprt); | 399 | xprt_get(clnt->cl_xprt); |
400 | kref_get(&clnt->cl_kref); | 400 | atomic_inc(&clnt->cl_count); |
401 | rpc_register_client(new); | 401 | rpc_register_client(new); |
402 | rpciod_up(); | 402 | rpciod_up(); |
403 | return new; | 403 | return new; |
@@ -465,10 +465,8 @@ EXPORT_SYMBOL_GPL(rpc_shutdown_client); | |||
465 | * Free an RPC client | 465 | * Free an RPC client |
466 | */ | 466 | */ |
467 | static void | 467 | static void |
468 | rpc_free_client(struct kref *kref) | 468 | rpc_free_client(struct rpc_clnt *clnt) |
469 | { | 469 | { |
470 | struct rpc_clnt *clnt = container_of(kref, struct rpc_clnt, cl_kref); | ||
471 | |||
472 | dprintk("RPC: destroying %s client for %s\n", | 470 | dprintk("RPC: destroying %s client for %s\n", |
473 | clnt->cl_protname, clnt->cl_server); | 471 | clnt->cl_protname, clnt->cl_server); |
474 | if (!IS_ERR(clnt->cl_path.dentry)) { | 472 | if (!IS_ERR(clnt->cl_path.dentry)) { |
@@ -495,12 +493,10 @@ out_free: | |||
495 | * Free an RPC client | 493 | * Free an RPC client |
496 | */ | 494 | */ |
497 | static void | 495 | static void |
498 | rpc_free_auth(struct kref *kref) | 496 | rpc_free_auth(struct rpc_clnt *clnt) |
499 | { | 497 | { |
500 | struct rpc_clnt *clnt = container_of(kref, struct rpc_clnt, cl_kref); | ||
501 | |||
502 | if (clnt->cl_auth == NULL) { | 498 | if (clnt->cl_auth == NULL) { |
503 | rpc_free_client(kref); | 499 | rpc_free_client(clnt); |
504 | return; | 500 | return; |
505 | } | 501 | } |
506 | 502 | ||
@@ -509,10 +505,11 @@ rpc_free_auth(struct kref *kref) | |||
509 | * release remaining GSS contexts. This mechanism ensures | 505 | * release remaining GSS contexts. This mechanism ensures |
510 | * that it can do so safely. | 506 | * that it can do so safely. |
511 | */ | 507 | */ |
512 | kref_init(kref); | 508 | atomic_inc(&clnt->cl_count); |
513 | rpcauth_release(clnt->cl_auth); | 509 | rpcauth_release(clnt->cl_auth); |
514 | clnt->cl_auth = NULL; | 510 | clnt->cl_auth = NULL; |
515 | kref_put(kref, rpc_free_client); | 511 | if (atomic_dec_and_test(&clnt->cl_count)) |
512 | rpc_free_client(clnt); | ||
516 | } | 513 | } |
517 | 514 | ||
518 | /* | 515 | /* |
@@ -525,7 +522,8 @@ rpc_release_client(struct rpc_clnt *clnt) | |||
525 | 522 | ||
526 | if (list_empty(&clnt->cl_tasks)) | 523 | if (list_empty(&clnt->cl_tasks)) |
527 | wake_up(&destroy_wait); | 524 | wake_up(&destroy_wait); |
528 | kref_put(&clnt->cl_kref, rpc_free_auth); | 525 | if (atomic_dec_and_test(&clnt->cl_count)) |
526 | rpc_free_auth(clnt); | ||
529 | } | 527 | } |
530 | 528 | ||
531 | /** | 529 | /** |
@@ -588,7 +586,7 @@ void rpc_task_set_client(struct rpc_task *task, struct rpc_clnt *clnt) | |||
588 | if (clnt != NULL) { | 586 | if (clnt != NULL) { |
589 | rpc_task_release_client(task); | 587 | rpc_task_release_client(task); |
590 | task->tk_client = clnt; | 588 | task->tk_client = clnt; |
591 | kref_get(&clnt->cl_kref); | 589 | atomic_inc(&clnt->cl_count); |
592 | if (clnt->cl_softrtry) | 590 | if (clnt->cl_softrtry) |
593 | task->tk_flags |= RPC_TASK_SOFT; | 591 | task->tk_flags |= RPC_TASK_SOFT; |
594 | /* Add to the client's list of all tasks */ | 592 | /* Add to the client's list of all tasks */ |
@@ -931,7 +929,7 @@ call_reserveresult(struct rpc_task *task) | |||
931 | task->tk_status = 0; | 929 | task->tk_status = 0; |
932 | if (status >= 0) { | 930 | if (status >= 0) { |
933 | if (task->tk_rqstp) { | 931 | if (task->tk_rqstp) { |
934 | task->tk_action = call_allocate; | 932 | task->tk_action = call_refresh; |
935 | return; | 933 | return; |
936 | } | 934 | } |
937 | 935 | ||
@@ -966,13 +964,54 @@ call_reserveresult(struct rpc_task *task) | |||
966 | } | 964 | } |
967 | 965 | ||
968 | /* | 966 | /* |
969 | * 2. Allocate the buffer. For details, see sched.c:rpc_malloc. | 967 | * 2. Bind and/or refresh the credentials |
968 | */ | ||
969 | static void | ||
970 | call_refresh(struct rpc_task *task) | ||
971 | { | ||
972 | dprint_status(task); | ||
973 | |||
974 | task->tk_action = call_refreshresult; | ||
975 | task->tk_status = 0; | ||
976 | task->tk_client->cl_stats->rpcauthrefresh++; | ||
977 | rpcauth_refreshcred(task); | ||
978 | } | ||
979 | |||
980 | /* | ||
981 | * 2a. Process the results of a credential refresh | ||
982 | */ | ||
983 | static void | ||
984 | call_refreshresult(struct rpc_task *task) | ||
985 | { | ||
986 | int status = task->tk_status; | ||
987 | |||
988 | dprint_status(task); | ||
989 | |||
990 | task->tk_status = 0; | ||
991 | task->tk_action = call_allocate; | ||
992 | if (status >= 0 && rpcauth_uptodatecred(task)) | ||
993 | return; | ||
994 | switch (status) { | ||
995 | case -EACCES: | ||
996 | rpc_exit(task, -EACCES); | ||
997 | return; | ||
998 | case -ENOMEM: | ||
999 | rpc_exit(task, -ENOMEM); | ||
1000 | return; | ||
1001 | case -ETIMEDOUT: | ||
1002 | rpc_delay(task, 3*HZ); | ||
1003 | } | ||
1004 | task->tk_action = call_refresh; | ||
1005 | } | ||
1006 | |||
1007 | /* | ||
1008 | * 2b. Allocate the buffer. For details, see sched.c:rpc_malloc. | ||
970 | * (Note: buffer memory is freed in xprt_release). | 1009 | * (Note: buffer memory is freed in xprt_release). |
971 | */ | 1010 | */ |
972 | static void | 1011 | static void |
973 | call_allocate(struct rpc_task *task) | 1012 | call_allocate(struct rpc_task *task) |
974 | { | 1013 | { |
975 | unsigned int slack = task->tk_client->cl_auth->au_cslack; | 1014 | unsigned int slack = task->tk_rqstp->rq_cred->cr_auth->au_cslack; |
976 | struct rpc_rqst *req = task->tk_rqstp; | 1015 | struct rpc_rqst *req = task->tk_rqstp; |
977 | struct rpc_xprt *xprt = task->tk_xprt; | 1016 | struct rpc_xprt *xprt = task->tk_xprt; |
978 | struct rpc_procinfo *proc = task->tk_msg.rpc_proc; | 1017 | struct rpc_procinfo *proc = task->tk_msg.rpc_proc; |
@@ -980,7 +1019,7 @@ call_allocate(struct rpc_task *task) | |||
980 | dprint_status(task); | 1019 | dprint_status(task); |
981 | 1020 | ||
982 | task->tk_status = 0; | 1021 | task->tk_status = 0; |
983 | task->tk_action = call_refresh; | 1022 | task->tk_action = call_bind; |
984 | 1023 | ||
985 | if (req->rq_buffer) | 1024 | if (req->rq_buffer) |
986 | return; | 1025 | return; |
@@ -1017,47 +1056,6 @@ call_allocate(struct rpc_task *task) | |||
1017 | rpc_exit(task, -ERESTARTSYS); | 1056 | rpc_exit(task, -ERESTARTSYS); |
1018 | } | 1057 | } |
1019 | 1058 | ||
1020 | /* | ||
1021 | * 2a. Bind and/or refresh the credentials | ||
1022 | */ | ||
1023 | static void | ||
1024 | call_refresh(struct rpc_task *task) | ||
1025 | { | ||
1026 | dprint_status(task); | ||
1027 | |||
1028 | task->tk_action = call_refreshresult; | ||
1029 | task->tk_status = 0; | ||
1030 | task->tk_client->cl_stats->rpcauthrefresh++; | ||
1031 | rpcauth_refreshcred(task); | ||
1032 | } | ||
1033 | |||
1034 | /* | ||
1035 | * 2b. Process the results of a credential refresh | ||
1036 | */ | ||
1037 | static void | ||
1038 | call_refreshresult(struct rpc_task *task) | ||
1039 | { | ||
1040 | int status = task->tk_status; | ||
1041 | |||
1042 | dprint_status(task); | ||
1043 | |||
1044 | task->tk_status = 0; | ||
1045 | task->tk_action = call_bind; | ||
1046 | if (status >= 0 && rpcauth_uptodatecred(task)) | ||
1047 | return; | ||
1048 | switch (status) { | ||
1049 | case -EACCES: | ||
1050 | rpc_exit(task, -EACCES); | ||
1051 | return; | ||
1052 | case -ENOMEM: | ||
1053 | rpc_exit(task, -ENOMEM); | ||
1054 | return; | ||
1055 | case -ETIMEDOUT: | ||
1056 | rpc_delay(task, 3*HZ); | ||
1057 | } | ||
1058 | task->tk_action = call_refresh; | ||
1059 | } | ||
1060 | |||
1061 | static inline int | 1059 | static inline int |
1062 | rpc_task_need_encode(struct rpc_task *task) | 1060 | rpc_task_need_encode(struct rpc_task *task) |
1063 | { | 1061 | { |
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c index 95ccbcf45d3e..8c8eef2b8f26 100644 --- a/net/sunrpc/rpc_pipe.c +++ b/net/sunrpc/rpc_pipe.c | |||
@@ -48,7 +48,7 @@ static void rpc_purge_list(struct rpc_inode *rpci, struct list_head *head, | |||
48 | return; | 48 | return; |
49 | do { | 49 | do { |
50 | msg = list_entry(head->next, struct rpc_pipe_msg, list); | 50 | msg = list_entry(head->next, struct rpc_pipe_msg, list); |
51 | list_del(&msg->list); | 51 | list_del_init(&msg->list); |
52 | msg->errno = err; | 52 | msg->errno = err; |
53 | destroy_msg(msg); | 53 | destroy_msg(msg); |
54 | } while (!list_empty(head)); | 54 | } while (!list_empty(head)); |
@@ -208,7 +208,7 @@ rpc_pipe_release(struct inode *inode, struct file *filp) | |||
208 | if (msg != NULL) { | 208 | if (msg != NULL) { |
209 | spin_lock(&inode->i_lock); | 209 | spin_lock(&inode->i_lock); |
210 | msg->errno = -EAGAIN; | 210 | msg->errno = -EAGAIN; |
211 | list_del(&msg->list); | 211 | list_del_init(&msg->list); |
212 | spin_unlock(&inode->i_lock); | 212 | spin_unlock(&inode->i_lock); |
213 | rpci->ops->destroy_msg(msg); | 213 | rpci->ops->destroy_msg(msg); |
214 | } | 214 | } |
@@ -268,7 +268,7 @@ rpc_pipe_read(struct file *filp, char __user *buf, size_t len, loff_t *offset) | |||
268 | if (res < 0 || msg->len == msg->copied) { | 268 | if (res < 0 || msg->len == msg->copied) { |
269 | filp->private_data = NULL; | 269 | filp->private_data = NULL; |
270 | spin_lock(&inode->i_lock); | 270 | spin_lock(&inode->i_lock); |
271 | list_del(&msg->list); | 271 | list_del_init(&msg->list); |
272 | spin_unlock(&inode->i_lock); | 272 | spin_unlock(&inode->i_lock); |
273 | rpci->ops->destroy_msg(msg); | 273 | rpci->ops->destroy_msg(msg); |
274 | } | 274 | } |
@@ -371,21 +371,23 @@ rpc_show_info(struct seq_file *m, void *v) | |||
371 | static int | 371 | static int |
372 | rpc_info_open(struct inode *inode, struct file *file) | 372 | rpc_info_open(struct inode *inode, struct file *file) |
373 | { | 373 | { |
374 | struct rpc_clnt *clnt; | 374 | struct rpc_clnt *clnt = NULL; |
375 | int ret = single_open(file, rpc_show_info, NULL); | 375 | int ret = single_open(file, rpc_show_info, NULL); |
376 | 376 | ||
377 | if (!ret) { | 377 | if (!ret) { |
378 | struct seq_file *m = file->private_data; | 378 | struct seq_file *m = file->private_data; |
379 | mutex_lock(&inode->i_mutex); | 379 | |
380 | clnt = RPC_I(inode)->private; | 380 | spin_lock(&file->f_path.dentry->d_lock); |
381 | if (clnt) { | 381 | if (!d_unhashed(file->f_path.dentry)) |
382 | kref_get(&clnt->cl_kref); | 382 | clnt = RPC_I(inode)->private; |
383 | if (clnt != NULL && atomic_inc_not_zero(&clnt->cl_count)) { | ||
384 | spin_unlock(&file->f_path.dentry->d_lock); | ||
383 | m->private = clnt; | 385 | m->private = clnt; |
384 | } else { | 386 | } else { |
387 | spin_unlock(&file->f_path.dentry->d_lock); | ||
385 | single_release(inode, file); | 388 | single_release(inode, file); |
386 | ret = -EINVAL; | 389 | ret = -EINVAL; |
387 | } | 390 | } |
388 | mutex_unlock(&inode->i_mutex); | ||
389 | } | 391 | } |
390 | return ret; | 392 | return ret; |
391 | } | 393 | } |
diff --git a/net/xfrm/xfrm_output.c b/net/xfrm/xfrm_output.c index a3cca0a94346..64f2ae1fdc15 100644 --- a/net/xfrm/xfrm_output.c +++ b/net/xfrm/xfrm_output.c | |||
@@ -101,7 +101,7 @@ resume: | |||
101 | err = -EHOSTUNREACH; | 101 | err = -EHOSTUNREACH; |
102 | goto error_nolock; | 102 | goto error_nolock; |
103 | } | 103 | } |
104 | skb_dst_set_noref(skb, dst); | 104 | skb_dst_set(skb, dst_clone(dst)); |
105 | x = dst->xfrm; | 105 | x = dst->xfrm; |
106 | } while (x && !(x->outer_mode->flags & XFRM_MODE_FLAG_TUNNEL)); | 106 | } while (x && !(x->outer_mode->flags & XFRM_MODE_FLAG_TUNNEL)); |
107 | 107 | ||
diff --git a/sound/core/pcm.c b/sound/core/pcm.c index 204af48c5cc1..ac242a377aea 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c | |||
@@ -372,14 +372,17 @@ static void snd_pcm_substream_proc_hw_params_read(struct snd_info_entry *entry, | |||
372 | struct snd_info_buffer *buffer) | 372 | struct snd_info_buffer *buffer) |
373 | { | 373 | { |
374 | struct snd_pcm_substream *substream = entry->private_data; | 374 | struct snd_pcm_substream *substream = entry->private_data; |
375 | struct snd_pcm_runtime *runtime = substream->runtime; | 375 | struct snd_pcm_runtime *runtime; |
376 | |||
377 | mutex_lock(&substream->pcm->open_mutex); | ||
378 | runtime = substream->runtime; | ||
376 | if (!runtime) { | 379 | if (!runtime) { |
377 | snd_iprintf(buffer, "closed\n"); | 380 | snd_iprintf(buffer, "closed\n"); |
378 | return; | 381 | goto unlock; |
379 | } | 382 | } |
380 | if (runtime->status->state == SNDRV_PCM_STATE_OPEN) { | 383 | if (runtime->status->state == SNDRV_PCM_STATE_OPEN) { |
381 | snd_iprintf(buffer, "no setup\n"); | 384 | snd_iprintf(buffer, "no setup\n"); |
382 | return; | 385 | goto unlock; |
383 | } | 386 | } |
384 | snd_iprintf(buffer, "access: %s\n", snd_pcm_access_name(runtime->access)); | 387 | snd_iprintf(buffer, "access: %s\n", snd_pcm_access_name(runtime->access)); |
385 | snd_iprintf(buffer, "format: %s\n", snd_pcm_format_name(runtime->format)); | 388 | snd_iprintf(buffer, "format: %s\n", snd_pcm_format_name(runtime->format)); |
@@ -398,20 +401,25 @@ static void snd_pcm_substream_proc_hw_params_read(struct snd_info_entry *entry, | |||
398 | snd_iprintf(buffer, "OSS period frames: %lu\n", (unsigned long)runtime->oss.period_frames); | 401 | snd_iprintf(buffer, "OSS period frames: %lu\n", (unsigned long)runtime->oss.period_frames); |
399 | } | 402 | } |
400 | #endif | 403 | #endif |
404 | unlock: | ||
405 | mutex_unlock(&substream->pcm->open_mutex); | ||
401 | } | 406 | } |
402 | 407 | ||
403 | static void snd_pcm_substream_proc_sw_params_read(struct snd_info_entry *entry, | 408 | static void snd_pcm_substream_proc_sw_params_read(struct snd_info_entry *entry, |
404 | struct snd_info_buffer *buffer) | 409 | struct snd_info_buffer *buffer) |
405 | { | 410 | { |
406 | struct snd_pcm_substream *substream = entry->private_data; | 411 | struct snd_pcm_substream *substream = entry->private_data; |
407 | struct snd_pcm_runtime *runtime = substream->runtime; | 412 | struct snd_pcm_runtime *runtime; |
413 | |||
414 | mutex_lock(&substream->pcm->open_mutex); | ||
415 | runtime = substream->runtime; | ||
408 | if (!runtime) { | 416 | if (!runtime) { |
409 | snd_iprintf(buffer, "closed\n"); | 417 | snd_iprintf(buffer, "closed\n"); |
410 | return; | 418 | goto unlock; |
411 | } | 419 | } |
412 | if (runtime->status->state == SNDRV_PCM_STATE_OPEN) { | 420 | if (runtime->status->state == SNDRV_PCM_STATE_OPEN) { |
413 | snd_iprintf(buffer, "no setup\n"); | 421 | snd_iprintf(buffer, "no setup\n"); |
414 | return; | 422 | goto unlock; |
415 | } | 423 | } |
416 | snd_iprintf(buffer, "tstamp_mode: %s\n", snd_pcm_tstamp_mode_name(runtime->tstamp_mode)); | 424 | snd_iprintf(buffer, "tstamp_mode: %s\n", snd_pcm_tstamp_mode_name(runtime->tstamp_mode)); |
417 | snd_iprintf(buffer, "period_step: %u\n", runtime->period_step); | 425 | snd_iprintf(buffer, "period_step: %u\n", runtime->period_step); |
@@ -421,24 +429,29 @@ static void snd_pcm_substream_proc_sw_params_read(struct snd_info_entry *entry, | |||
421 | snd_iprintf(buffer, "silence_threshold: %lu\n", runtime->silence_threshold); | 429 | snd_iprintf(buffer, "silence_threshold: %lu\n", runtime->silence_threshold); |
422 | snd_iprintf(buffer, "silence_size: %lu\n", runtime->silence_size); | 430 | snd_iprintf(buffer, "silence_size: %lu\n", runtime->silence_size); |
423 | snd_iprintf(buffer, "boundary: %lu\n", runtime->boundary); | 431 | snd_iprintf(buffer, "boundary: %lu\n", runtime->boundary); |
432 | unlock: | ||
433 | mutex_unlock(&substream->pcm->open_mutex); | ||
424 | } | 434 | } |
425 | 435 | ||
426 | static void snd_pcm_substream_proc_status_read(struct snd_info_entry *entry, | 436 | static void snd_pcm_substream_proc_status_read(struct snd_info_entry *entry, |
427 | struct snd_info_buffer *buffer) | 437 | struct snd_info_buffer *buffer) |
428 | { | 438 | { |
429 | struct snd_pcm_substream *substream = entry->private_data; | 439 | struct snd_pcm_substream *substream = entry->private_data; |
430 | struct snd_pcm_runtime *runtime = substream->runtime; | 440 | struct snd_pcm_runtime *runtime; |
431 | struct snd_pcm_status status; | 441 | struct snd_pcm_status status; |
432 | int err; | 442 | int err; |
443 | |||
444 | mutex_lock(&substream->pcm->open_mutex); | ||
445 | runtime = substream->runtime; | ||
433 | if (!runtime) { | 446 | if (!runtime) { |
434 | snd_iprintf(buffer, "closed\n"); | 447 | snd_iprintf(buffer, "closed\n"); |
435 | return; | 448 | goto unlock; |
436 | } | 449 | } |
437 | memset(&status, 0, sizeof(status)); | 450 | memset(&status, 0, sizeof(status)); |
438 | err = snd_pcm_status(substream, &status); | 451 | err = snd_pcm_status(substream, &status); |
439 | if (err < 0) { | 452 | if (err < 0) { |
440 | snd_iprintf(buffer, "error %d\n", err); | 453 | snd_iprintf(buffer, "error %d\n", err); |
441 | return; | 454 | goto unlock; |
442 | } | 455 | } |
443 | snd_iprintf(buffer, "state: %s\n", snd_pcm_state_name(status.state)); | 456 | snd_iprintf(buffer, "state: %s\n", snd_pcm_state_name(status.state)); |
444 | snd_iprintf(buffer, "owner_pid : %d\n", pid_vnr(substream->pid)); | 457 | snd_iprintf(buffer, "owner_pid : %d\n", pid_vnr(substream->pid)); |
@@ -452,6 +465,8 @@ static void snd_pcm_substream_proc_status_read(struct snd_info_entry *entry, | |||
452 | snd_iprintf(buffer, "-----\n"); | 465 | snd_iprintf(buffer, "-----\n"); |
453 | snd_iprintf(buffer, "hw_ptr : %ld\n", runtime->status->hw_ptr); | 466 | snd_iprintf(buffer, "hw_ptr : %ld\n", runtime->status->hw_ptr); |
454 | snd_iprintf(buffer, "appl_ptr : %ld\n", runtime->control->appl_ptr); | 467 | snd_iprintf(buffer, "appl_ptr : %ld\n", runtime->control->appl_ptr); |
468 | unlock: | ||
469 | mutex_unlock(&substream->pcm->open_mutex); | ||
455 | } | 470 | } |
456 | 471 | ||
457 | #ifdef CONFIG_SND_PCM_XRUN_DEBUG | 472 | #ifdef CONFIG_SND_PCM_XRUN_DEBUG |
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 134fc6c2e08d..d4eb2ef80784 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c | |||
@@ -1992,6 +1992,8 @@ void snd_pcm_release_substream(struct snd_pcm_substream *substream) | |||
1992 | substream->ops->close(substream); | 1992 | substream->ops->close(substream); |
1993 | substream->hw_opened = 0; | 1993 | substream->hw_opened = 0; |
1994 | } | 1994 | } |
1995 | if (pm_qos_request_active(&substream->latency_pm_qos_req)) | ||
1996 | pm_qos_remove_request(&substream->latency_pm_qos_req); | ||
1995 | if (substream->pcm_release) { | 1997 | if (substream->pcm_release) { |
1996 | substream->pcm_release(substream); | 1998 | substream->pcm_release(substream); |
1997 | substream->pcm_release = NULL; | 1999 | substream->pcm_release = NULL; |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 1053fff4bd0a..34940a079051 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -126,6 +126,7 @@ MODULE_SUPPORTED_DEVICE("{{Intel, ICH6}," | |||
126 | "{Intel, ICH10}," | 126 | "{Intel, ICH10}," |
127 | "{Intel, PCH}," | 127 | "{Intel, PCH}," |
128 | "{Intel, CPT}," | 128 | "{Intel, CPT}," |
129 | "{Intel, PBG}," | ||
129 | "{Intel, SCH}," | 130 | "{Intel, SCH}," |
130 | "{ATI, SB450}," | 131 | "{ATI, SB450}," |
131 | "{ATI, SB600}," | 132 | "{ATI, SB600}," |
@@ -2749,6 +2750,8 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { | |||
2749 | { PCI_DEVICE(0x8086, 0x3b57), .driver_data = AZX_DRIVER_ICH }, | 2750 | { PCI_DEVICE(0x8086, 0x3b57), .driver_data = AZX_DRIVER_ICH }, |
2750 | /* CPT */ | 2751 | /* CPT */ |
2751 | { PCI_DEVICE(0x8086, 0x1c20), .driver_data = AZX_DRIVER_PCH }, | 2752 | { PCI_DEVICE(0x8086, 0x1c20), .driver_data = AZX_DRIVER_PCH }, |
2753 | /* PBG */ | ||
2754 | { PCI_DEVICE(0x8086, 0x1d20), .driver_data = AZX_DRIVER_PCH }, | ||
2752 | /* SCH */ | 2755 | /* SCH */ |
2753 | { PCI_DEVICE(0x8086, 0x811b), .driver_data = AZX_DRIVER_SCH }, | 2756 | { PCI_DEVICE(0x8086, 0x811b), .driver_data = AZX_DRIVER_SCH }, |
2754 | /* ATI SB 450/600 */ | 2757 | /* ATI SB 450/600 */ |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 71f9d6475b09..972e7c453b3d 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -3092,6 +3092,7 @@ static struct snd_pci_quirk cxt5066_cfg_tbl[] = { | |||
3092 | SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTO), | 3092 | SND_PCI_QUIRK(0x1028, 0x0402, "Dell Vostro", CXT5066_DELL_VOSTO), |
3093 | SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD), | 3093 | SND_PCI_QUIRK(0x1028, 0x0408, "Dell Inspiron One 19T", CXT5066_IDEAPAD), |
3094 | SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP), | 3094 | SND_PCI_QUIRK(0x103c, 0x360b, "HP G60", CXT5066_HP_LAPTOP), |
3095 | SND_PCI_QUIRK(0x1179, 0xff1e, "Toshiba Satellite C650D", CXT5066_IDEAPAD), | ||
3095 | SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5), | 3096 | SND_PCI_QUIRK(0x1179, 0xff50, "Toshiba Satellite P500-PSPGSC-01800T", CXT5066_OLPC_XO_1_5), |
3096 | SND_PCI_QUIRK(0x1179, 0xffe0, "Toshiba Satellite Pro T130-15F", CXT5066_OLPC_XO_1_5), | 3097 | SND_PCI_QUIRK(0x1179, 0xffe0, "Toshiba Satellite Pro T130-15F", CXT5066_OLPC_XO_1_5), |
3097 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400s", CXT5066_THINKPAD), | 3098 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400s", CXT5066_THINKPAD), |
diff --git a/sound/pci/hda/patch_nvhdmi.c b/sound/pci/hda/patch_nvhdmi.c index 69b950d527c3..baa108b9d6aa 100644 --- a/sound/pci/hda/patch_nvhdmi.c +++ b/sound/pci/hda/patch_nvhdmi.c | |||
@@ -84,7 +84,7 @@ static struct hda_verb nvhdmi_basic_init_7x[] = { | |||
84 | #else | 84 | #else |
85 | /* support all rates and formats */ | 85 | /* support all rates and formats */ |
86 | #define SUPPORTED_RATES \ | 86 | #define SUPPORTED_RATES \ |
87 | (SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |\ | 87 | (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |\ |
88 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 |\ | 88 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 |\ |
89 | SNDRV_PCM_RATE_192000) | 89 | SNDRV_PCM_RATE_192000) |
90 | #define SUPPORTED_MAXBPS 24 | 90 | #define SUPPORTED_MAXBPS 24 |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index bcbf9160ed81..a1312a6c8af2 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -14453,6 +14453,7 @@ static void alc269_auto_init(struct hda_codec *codec) | |||
14453 | 14453 | ||
14454 | enum { | 14454 | enum { |
14455 | ALC269_FIXUP_SONY_VAIO, | 14455 | ALC269_FIXUP_SONY_VAIO, |
14456 | ALC269_FIXUP_DELL_M101Z, | ||
14456 | }; | 14457 | }; |
14457 | 14458 | ||
14458 | static const struct hda_verb alc269_sony_vaio_fixup_verbs[] = { | 14459 | static const struct hda_verb alc269_sony_vaio_fixup_verbs[] = { |
@@ -14464,11 +14465,20 @@ static const struct alc_fixup alc269_fixups[] = { | |||
14464 | [ALC269_FIXUP_SONY_VAIO] = { | 14465 | [ALC269_FIXUP_SONY_VAIO] = { |
14465 | .verbs = alc269_sony_vaio_fixup_verbs | 14466 | .verbs = alc269_sony_vaio_fixup_verbs |
14466 | }, | 14467 | }, |
14468 | [ALC269_FIXUP_DELL_M101Z] = { | ||
14469 | .verbs = (const struct hda_verb[]) { | ||
14470 | /* Enables internal speaker */ | ||
14471 | {0x20, AC_VERB_SET_COEF_INDEX, 13}, | ||
14472 | {0x20, AC_VERB_SET_PROC_COEF, 0x4040}, | ||
14473 | {} | ||
14474 | } | ||
14475 | }, | ||
14467 | }; | 14476 | }; |
14468 | 14477 | ||
14469 | static struct snd_pci_quirk alc269_fixup_tbl[] = { | 14478 | static struct snd_pci_quirk alc269_fixup_tbl[] = { |
14470 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), | 14479 | SND_PCI_QUIRK(0x104d, 0x9071, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
14471 | SND_PCI_QUIRK(0x104d, 0x9077, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), | 14480 | SND_PCI_QUIRK(0x104d, 0x9077, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
14481 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), | ||
14472 | {} | 14482 | {} |
14473 | }; | 14483 | }; |
14474 | 14484 | ||
diff --git a/sound/ppc/snd_ps3.c b/sound/ppc/snd_ps3.c index 2f12da4da561..581a670e8261 100644 --- a/sound/ppc/snd_ps3.c +++ b/sound/ppc/snd_ps3.c | |||
@@ -579,7 +579,7 @@ static int snd_ps3_delay_to_bytes(struct snd_pcm_substream *substream, | |||
579 | rate * delay_ms / 1000) | 579 | rate * delay_ms / 1000) |
580 | * substream->runtime->channels; | 580 | * substream->runtime->channels; |
581 | 581 | ||
582 | pr_debug(KERN_ERR "%s: time=%d rate=%d bytes=%ld, frames=%d, ret=%d\n", | 582 | pr_debug("%s: time=%d rate=%d bytes=%ld, frames=%d, ret=%d\n", |
583 | __func__, | 583 | __func__, |
584 | delay_ms, | 584 | delay_ms, |
585 | rate, | 585 | rate, |
diff --git a/sound/soc/s3c24xx/s3c-dma.c b/sound/soc/s3c24xx/s3c-dma.c index 1b61c23ff300..f1b1bc4bacfb 100644 --- a/sound/soc/s3c24xx/s3c-dma.c +++ b/sound/soc/s3c24xx/s3c-dma.c | |||
@@ -94,8 +94,7 @@ static void s3c_dma_enqueue(struct snd_pcm_substream *substream) | |||
94 | 94 | ||
95 | if ((pos + len) > prtd->dma_end) { | 95 | if ((pos + len) > prtd->dma_end) { |
96 | len = prtd->dma_end - pos; | 96 | len = prtd->dma_end - pos; |
97 | pr_debug(KERN_DEBUG "%s: corrected dma len %ld\n", | 97 | pr_debug("%s: corrected dma len %ld\n", __func__, len); |
98 | __func__, len); | ||
99 | } | 98 | } |
100 | 99 | ||
101 | ret = s3c2410_dma_enqueue(prtd->params->channel, | 100 | ret = s3c2410_dma_enqueue(prtd->params->channel, |
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c index 66cf65b510b1..c1f1e3c62984 100644 --- a/virt/kvm/eventfd.c +++ b/virt/kvm/eventfd.c | |||
@@ -218,7 +218,6 @@ kvm_irqfd_assign(struct kvm *kvm, int fd, int gsi) | |||
218 | events = file->f_op->poll(file, &irqfd->pt); | 218 | events = file->f_op->poll(file, &irqfd->pt); |
219 | 219 | ||
220 | list_add_tail(&irqfd->list, &kvm->irqfds.items); | 220 | list_add_tail(&irqfd->list, &kvm->irqfds.items); |
221 | spin_unlock_irq(&kvm->irqfds.lock); | ||
222 | 221 | ||
223 | /* | 222 | /* |
224 | * Check if there was an event already pending on the eventfd | 223 | * Check if there was an event already pending on the eventfd |
@@ -227,6 +226,8 @@ kvm_irqfd_assign(struct kvm *kvm, int fd, int gsi) | |||
227 | if (events & POLLIN) | 226 | if (events & POLLIN) |
228 | schedule_work(&irqfd->inject); | 227 | schedule_work(&irqfd->inject); |
229 | 228 | ||
229 | spin_unlock_irq(&kvm->irqfds.lock); | ||
230 | |||
230 | /* | 231 | /* |
231 | * do not drop the file until the irqfd is fully initialized, otherwise | 232 | * do not drop the file until the irqfd is fully initialized, otherwise |
232 | * we might race against the POLLHUP | 233 | * we might race against the POLLHUP |
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index d4853a54771a..5186e728c53e 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -1970,10 +1970,12 @@ static int kvm_cpu_hotplug(struct notifier_block *notifier, unsigned long val, | |||
1970 | 1970 | ||
1971 | asmlinkage void kvm_handle_fault_on_reboot(void) | 1971 | asmlinkage void kvm_handle_fault_on_reboot(void) |
1972 | { | 1972 | { |
1973 | if (kvm_rebooting) | 1973 | if (kvm_rebooting) { |
1974 | /* spin while reset goes on */ | 1974 | /* spin while reset goes on */ |
1975 | local_irq_enable(); | ||
1975 | while (true) | 1976 | while (true) |
1976 | ; | 1977 | ; |
1978 | } | ||
1977 | /* Fault while not rebooting. We want the trace. */ | 1979 | /* Fault while not rebooting. We want the trace. */ |
1978 | BUG(); | 1980 | BUG(); |
1979 | } | 1981 | } |