diff options
author | Andi Kleen <andi@basil.nowhere.org> | 2006-11-28 14:12:29 -0500 |
---|---|---|
committer | Andi Kleen <andi@basil.nowhere.org> | 2006-11-28 14:12:29 -0500 |
commit | a3550a9c543556cf7764be81aeb17c6dab440753 (patch) | |
tree | e8c8bf721cc917c8842c4a007ad4b3f68eb7aa1e | |
parent | 9a14f2964b459c18198ee59ff7212321def82df7 (diff) | |
parent | 2ea5814472c3c910aed5c5b60f1f3b1000e353f1 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
79 files changed, 877 insertions, 370 deletions
diff --git a/Documentation/rtc.txt b/Documentation/rtc.txt index 2a58f985795a..7cf1ec5bcdd3 100644 --- a/Documentation/rtc.txt +++ b/Documentation/rtc.txt | |||
@@ -1,12 +1,49 @@ | |||
1 | 1 | ||
2 | Real Time Clock Driver for Linux | 2 | Real Time Clock (RTC) Drivers for Linux |
3 | ================================ | 3 | ======================================= |
4 | |||
5 | When Linux developers talk about a "Real Time Clock", they usually mean | ||
6 | something that tracks wall clock time and is battery backed so that it | ||
7 | works even with system power off. Such clocks will normally not track | ||
8 | the local time zone or daylight savings time -- unless they dual boot | ||
9 | with MS-Windows -- but will instead be set to Coordinated Universal Time | ||
10 | (UTC, formerly "Greenwich Mean Time"). | ||
11 | |||
12 | The newest non-PC hardware tends to just count seconds, like the time(2) | ||
13 | system call reports, but RTCs also very commonly represent time using | ||
14 | the Gregorian calendar and 24 hour time, as reported by gmtime(3). | ||
15 | |||
16 | Linux has two largely-compatible userspace RTC API families you may | ||
17 | need to know about: | ||
18 | |||
19 | * /dev/rtc ... is the RTC provided by PC compatible systems, | ||
20 | so it's not very portable to non-x86 systems. | ||
21 | |||
22 | * /dev/rtc0, /dev/rtc1 ... are part of a framework that's | ||
23 | supported by a wide variety of RTC chips on all systems. | ||
24 | |||
25 | Programmers need to understand that the PC/AT functionality is not | ||
26 | always available, and some systems can do much more. That is, the | ||
27 | RTCs use the same API to make requests in both RTC frameworks (using | ||
28 | different filenames of course), but the hardware may not offer the | ||
29 | same functionality. For example, not every RTC is hooked up to an | ||
30 | IRQ, so they can't all issue alarms; and where standard PC RTCs can | ||
31 | only issue an alarm up to 24 hours in the future, other hardware may | ||
32 | be able to schedule one any time in the upcoming century. | ||
33 | |||
34 | |||
35 | Old PC/AT-Compatible driver: /dev/rtc | ||
36 | -------------------------------------- | ||
4 | 37 | ||
5 | All PCs (even Alpha machines) have a Real Time Clock built into them. | 38 | All PCs (even Alpha machines) have a Real Time Clock built into them. |
6 | Usually they are built into the chipset of the computer, but some may | 39 | Usually they are built into the chipset of the computer, but some may |
7 | actually have a Motorola MC146818 (or clone) on the board. This is the | 40 | actually have a Motorola MC146818 (or clone) on the board. This is the |
8 | clock that keeps the date and time while your computer is turned off. | 41 | clock that keeps the date and time while your computer is turned off. |
9 | 42 | ||
43 | ACPI has standardized that MC146818 functionality, and extended it in | ||
44 | a few ways (enabling longer alarm periods, and wake-from-hibernate). | ||
45 | That functionality is NOT exposed in the old driver. | ||
46 | |||
10 | However it can also be used to generate signals from a slow 2Hz to a | 47 | However it can also be used to generate signals from a slow 2Hz to a |
11 | relatively fast 8192Hz, in increments of powers of two. These signals | 48 | relatively fast 8192Hz, in increments of powers of two. These signals |
12 | are reported by interrupt number 8. (Oh! So *that* is what IRQ 8 is | 49 | are reported by interrupt number 8. (Oh! So *that* is what IRQ 8 is |
@@ -63,223 +100,331 @@ Rather than write 50 pages describing the ioctl() and so on, it is | |||
63 | perhaps more useful to include a small test program that demonstrates | 100 | perhaps more useful to include a small test program that demonstrates |
64 | how to use them, and demonstrates the features of the driver. This is | 101 | how to use them, and demonstrates the features of the driver. This is |
65 | probably a lot more useful to people interested in writing applications | 102 | probably a lot more useful to people interested in writing applications |
66 | that will be using this driver. | 103 | that will be using this driver. See the code at the end of this document. |
104 | |||
105 | (The original /dev/rtc driver was written by Paul Gortmaker.) | ||
106 | |||
107 | |||
108 | New portable "RTC Class" drivers: /dev/rtcN | ||
109 | -------------------------------------------- | ||
110 | |||
111 | Because Linux supports many non-ACPI and non-PC platforms, some of which | ||
112 | have more than one RTC style clock, it needed a more portable solution | ||
113 | than expecting a single battery-backed MC146818 clone on every system. | ||
114 | Accordingly, a new "RTC Class" framework has been defined. It offers | ||
115 | three different userspace interfaces: | ||
116 | |||
117 | * /dev/rtcN ... much the same as the older /dev/rtc interface | ||
118 | |||
119 | * /sys/class/rtc/rtcN ... sysfs attributes support readonly | ||
120 | access to some RTC attributes. | ||
121 | |||
122 | * /proc/driver/rtc ... the first RTC (rtc0) may expose itself | ||
123 | using a procfs interface. More information is (currently) shown | ||
124 | here than through sysfs. | ||
125 | |||
126 | The RTC Class framework supports a wide variety of RTCs, ranging from those | ||
127 | integrated into embeddable system-on-chip (SOC) processors to discrete chips | ||
128 | using I2C, SPI, or some other bus to communicate with the host CPU. There's | ||
129 | even support for PC-style RTCs ... including the features exposed on newer PCs | ||
130 | through ACPI. | ||
131 | |||
132 | The new framework also removes the "one RTC per system" restriction. For | ||
133 | example, maybe the low-power battery-backed RTC is a discrete I2C chip, but | ||
134 | a high functionality RTC is integrated into the SOC. That system might read | ||
135 | the system clock from the discrete RTC, but use the integrated one for all | ||
136 | other tasks, because of its greater functionality. | ||
137 | |||
138 | The ioctl() calls supported by /dev/rtc are also supported by the RTC class | ||
139 | framework. However, because the chips and systems are not standardized, | ||
140 | some PC/AT functionality might not be provided. And in the same way, some | ||
141 | newer features -- including those enabled by ACPI -- are exposed by the | ||
142 | RTC class framework, but can't be supported by the older driver. | ||
143 | |||
144 | * RTC_RD_TIME, RTC_SET_TIME ... every RTC supports at least reading | ||
145 | time, returning the result as a Gregorian calendar date and 24 hour | ||
146 | wall clock time. To be most useful, this time may also be updated. | ||
147 | |||
148 | * RTC_AIE_ON, RTC_AIE_OFF, RTC_ALM_SET, RTC_ALM_READ ... when the RTC | ||
149 | is connected to an IRQ line, it can often issue an alarm IRQ up to | ||
150 | 24 hours in the future. | ||
151 | |||
152 | * RTC_WKALM_SET, RTC_WKALM_READ ... RTCs that can issue alarms beyond | ||
153 | the next 24 hours use a slightly more powerful API, which supports | ||
154 | setting the longer alarm time and enabling its IRQ using a single | ||
155 | request (using the same model as EFI firmware). | ||
156 | |||
157 | * RTC_UIE_ON, RTC_UIE_OFF ... if the RTC offers IRQs, it probably | ||
158 | also offers update IRQs whenever the "seconds" counter changes. | ||
159 | If needed, the RTC framework can emulate this mechanism. | ||
160 | |||
161 | * RTC_PIE_ON, RTC_PIE_OFF, RTC_IRQP_SET, RTC_IRQP_READ ... another | ||
162 | feature often accessible with an IRQ line is a periodic IRQ, issued | ||
163 | at settable frequencies (usually 2^N Hz). | ||
164 | |||
165 | In many cases, the RTC alarm can be a system wake event, used to force | ||
166 | Linux out of a low power sleep state (or hibernation) back to a fully | ||
167 | operational state. For example, a system could enter a deep power saving | ||
168 | state until it's time to execute some scheduled tasks. | ||
67 | 169 | ||
68 | Paul Gortmaker | ||
69 | 170 | ||
70 | -------------------- 8< ---------------- 8< ----------------------------- | 171 | -------------------- 8< ---------------- 8< ----------------------------- |
71 | 172 | ||
72 | /* | 173 | /* |
73 | * Real Time Clock Driver Test/Example Program | 174 | * Real Time Clock Driver Test/Example Program |
74 | * | 175 | * |
75 | * Compile with: | 176 | * Compile with: |
76 | * gcc -s -Wall -Wstrict-prototypes rtctest.c -o rtctest | 177 | * gcc -s -Wall -Wstrict-prototypes rtctest.c -o rtctest |
77 | * | 178 | * |
78 | * Copyright (C) 1996, Paul Gortmaker. | 179 | * Copyright (C) 1996, Paul Gortmaker. |
79 | * | 180 | * |
80 | * Released under the GNU General Public License, version 2, | 181 | * Released under the GNU General Public License, version 2, |
81 | * included herein by reference. | 182 | * included herein by reference. |
82 | * | 183 | * |
83 | */ | 184 | */ |
84 | 185 | ||
85 | #include <stdio.h> | 186 | #include <stdio.h> |
86 | #include <stdlib.h> | ||
87 | #include <linux/rtc.h> | 187 | #include <linux/rtc.h> |
88 | #include <sys/ioctl.h> | 188 | #include <sys/ioctl.h> |
89 | #include <sys/time.h> | 189 | #include <sys/time.h> |
90 | #include <sys/types.h> | 190 | #include <sys/types.h> |
91 | #include <fcntl.h> | 191 | #include <fcntl.h> |
92 | #include <unistd.h> | 192 | #include <unistd.h> |
193 | #include <stdlib.h> | ||
93 | #include <errno.h> | 194 | #include <errno.h> |
94 | 195 | ||
95 | int main(void) { | ||
96 | |||
97 | int i, fd, retval, irqcount = 0; | ||
98 | unsigned long tmp, data; | ||
99 | struct rtc_time rtc_tm; | ||
100 | 196 | ||
101 | fd = open ("/dev/rtc", O_RDONLY); | 197 | /* |
198 | * This expects the new RTC class driver framework, working with | ||
199 | * clocks that will often not be clones of what the PC-AT had. | ||
200 | * Use the command line to specify another RTC if you need one. | ||
201 | */ | ||
202 | static const char default_rtc[] = "/dev/rtc0"; | ||
203 | |||
204 | |||
205 | int main(int argc, char **argv) | ||
206 | { | ||
207 | int i, fd, retval, irqcount = 0; | ||
208 | unsigned long tmp, data; | ||
209 | struct rtc_time rtc_tm; | ||
210 | const char *rtc = default_rtc; | ||
211 | |||
212 | switch (argc) { | ||
213 | case 2: | ||
214 | rtc = argv[1]; | ||
215 | /* FALLTHROUGH */ | ||
216 | case 1: | ||
217 | break; | ||
218 | default: | ||
219 | fprintf(stderr, "usage: rtctest [rtcdev]\n"); | ||
220 | return 1; | ||
221 | } | ||
102 | 222 | ||
103 | if (fd == -1) { | 223 | fd = open(rtc, O_RDONLY); |
104 | perror("/dev/rtc"); | ||
105 | exit(errno); | ||
106 | } | ||
107 | 224 | ||
108 | fprintf(stderr, "\n\t\t\tRTC Driver Test Example.\n\n"); | 225 | if (fd == -1) { |
226 | perror(rtc); | ||
227 | exit(errno); | ||
228 | } | ||
109 | 229 | ||
110 | /* Turn on update interrupts (one per second) */ | 230 | fprintf(stderr, "\n\t\t\tRTC Driver Test Example.\n\n"); |
111 | retval = ioctl(fd, RTC_UIE_ON, 0); | ||
112 | if (retval == -1) { | ||
113 | perror("ioctl"); | ||
114 | exit(errno); | ||
115 | } | ||
116 | 231 | ||
117 | fprintf(stderr, "Counting 5 update (1/sec) interrupts from reading /dev/rtc:"); | 232 | /* Turn on update interrupts (one per second) */ |
118 | fflush(stderr); | 233 | retval = ioctl(fd, RTC_UIE_ON, 0); |
119 | for (i=1; i<6; i++) { | ||
120 | /* This read will block */ | ||
121 | retval = read(fd, &data, sizeof(unsigned long)); | ||
122 | if (retval == -1) { | 234 | if (retval == -1) { |
123 | perror("read"); | 235 | if (errno == ENOTTY) { |
236 | fprintf(stderr, | ||
237 | "\n...Update IRQs not supported.\n"); | ||
238 | goto test_READ; | ||
239 | } | ||
240 | perror("ioctl"); | ||
124 | exit(errno); | 241 | exit(errno); |
125 | } | 242 | } |
126 | fprintf(stderr, " %d",i); | 243 | |
244 | fprintf(stderr, "Counting 5 update (1/sec) interrupts from reading %s:", | ||
245 | rtc); | ||
127 | fflush(stderr); | 246 | fflush(stderr); |
128 | irqcount++; | 247 | for (i=1; i<6; i++) { |
129 | } | 248 | /* This read will block */ |
249 | retval = read(fd, &data, sizeof(unsigned long)); | ||
250 | if (retval == -1) { | ||
251 | perror("read"); | ||
252 | exit(errno); | ||
253 | } | ||
254 | fprintf(stderr, " %d",i); | ||
255 | fflush(stderr); | ||
256 | irqcount++; | ||
257 | } | ||
130 | 258 | ||
131 | fprintf(stderr, "\nAgain, from using select(2) on /dev/rtc:"); | 259 | fprintf(stderr, "\nAgain, from using select(2) on /dev/rtc:"); |
132 | fflush(stderr); | 260 | fflush(stderr); |
133 | for (i=1; i<6; i++) { | 261 | for (i=1; i<6; i++) { |
134 | struct timeval tv = {5, 0}; /* 5 second timeout on select */ | 262 | struct timeval tv = {5, 0}; /* 5 second timeout on select */ |
135 | fd_set readfds; | 263 | fd_set readfds; |
264 | |||
265 | FD_ZERO(&readfds); | ||
266 | FD_SET(fd, &readfds); | ||
267 | /* The select will wait until an RTC interrupt happens. */ | ||
268 | retval = select(fd+1, &readfds, NULL, NULL, &tv); | ||
269 | if (retval == -1) { | ||
270 | perror("select"); | ||
271 | exit(errno); | ||
272 | } | ||
273 | /* This read won't block unlike the select-less case above. */ | ||
274 | retval = read(fd, &data, sizeof(unsigned long)); | ||
275 | if (retval == -1) { | ||
276 | perror("read"); | ||
277 | exit(errno); | ||
278 | } | ||
279 | fprintf(stderr, " %d",i); | ||
280 | fflush(stderr); | ||
281 | irqcount++; | ||
282 | } | ||
136 | 283 | ||
137 | FD_ZERO(&readfds); | 284 | /* Turn off update interrupts */ |
138 | FD_SET(fd, &readfds); | 285 | retval = ioctl(fd, RTC_UIE_OFF, 0); |
139 | /* The select will wait until an RTC interrupt happens. */ | ||
140 | retval = select(fd+1, &readfds, NULL, NULL, &tv); | ||
141 | if (retval == -1) { | 286 | if (retval == -1) { |
142 | perror("select"); | 287 | perror("ioctl"); |
143 | exit(errno); | 288 | exit(errno); |
144 | } | 289 | } |
145 | /* This read won't block unlike the select-less case above. */ | 290 | |
146 | retval = read(fd, &data, sizeof(unsigned long)); | 291 | test_READ: |
292 | /* Read the RTC time/date */ | ||
293 | retval = ioctl(fd, RTC_RD_TIME, &rtc_tm); | ||
147 | if (retval == -1) { | 294 | if (retval == -1) { |
148 | perror("read"); | 295 | perror("ioctl"); |
149 | exit(errno); | 296 | exit(errno); |
150 | } | 297 | } |
151 | fprintf(stderr, " %d",i); | ||
152 | fflush(stderr); | ||
153 | irqcount++; | ||
154 | } | ||
155 | |||
156 | /* Turn off update interrupts */ | ||
157 | retval = ioctl(fd, RTC_UIE_OFF, 0); | ||
158 | if (retval == -1) { | ||
159 | perror("ioctl"); | ||
160 | exit(errno); | ||
161 | } | ||
162 | |||
163 | /* Read the RTC time/date */ | ||
164 | retval = ioctl(fd, RTC_RD_TIME, &rtc_tm); | ||
165 | if (retval == -1) { | ||
166 | perror("ioctl"); | ||
167 | exit(errno); | ||
168 | } | ||
169 | |||
170 | fprintf(stderr, "\n\nCurrent RTC date/time is %d-%d-%d, %02d:%02d:%02d.\n", | ||
171 | rtc_tm.tm_mday, rtc_tm.tm_mon + 1, rtc_tm.tm_year + 1900, | ||
172 | rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec); | ||
173 | |||
174 | /* Set the alarm to 5 sec in the future, and check for rollover */ | ||
175 | rtc_tm.tm_sec += 5; | ||
176 | if (rtc_tm.tm_sec >= 60) { | ||
177 | rtc_tm.tm_sec %= 60; | ||
178 | rtc_tm.tm_min++; | ||
179 | } | ||
180 | if (rtc_tm.tm_min == 60) { | ||
181 | rtc_tm.tm_min = 0; | ||
182 | rtc_tm.tm_hour++; | ||
183 | } | ||
184 | if (rtc_tm.tm_hour == 24) | ||
185 | rtc_tm.tm_hour = 0; | ||
186 | |||
187 | retval = ioctl(fd, RTC_ALM_SET, &rtc_tm); | ||
188 | if (retval == -1) { | ||
189 | perror("ioctl"); | ||
190 | exit(errno); | ||
191 | } | ||
192 | |||
193 | /* Read the current alarm settings */ | ||
194 | retval = ioctl(fd, RTC_ALM_READ, &rtc_tm); | ||
195 | if (retval == -1) { | ||
196 | perror("ioctl"); | ||
197 | exit(errno); | ||
198 | } | ||
199 | |||
200 | fprintf(stderr, "Alarm time now set to %02d:%02d:%02d.\n", | ||
201 | rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec); | ||
202 | 298 | ||
203 | /* Enable alarm interrupts */ | 299 | fprintf(stderr, "\n\nCurrent RTC date/time is %d-%d-%d, %02d:%02d:%02d.\n", |
204 | retval = ioctl(fd, RTC_AIE_ON, 0); | 300 | rtc_tm.tm_mday, rtc_tm.tm_mon + 1, rtc_tm.tm_year + 1900, |
205 | if (retval == -1) { | 301 | rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec); |
206 | perror("ioctl"); | ||
207 | exit(errno); | ||
208 | } | ||
209 | 302 | ||
210 | fprintf(stderr, "Waiting 5 seconds for alarm..."); | 303 | /* Set the alarm to 5 sec in the future, and check for rollover */ |
211 | fflush(stderr); | 304 | rtc_tm.tm_sec += 5; |
212 | /* This blocks until the alarm ring causes an interrupt */ | 305 | if (rtc_tm.tm_sec >= 60) { |
213 | retval = read(fd, &data, sizeof(unsigned long)); | 306 | rtc_tm.tm_sec %= 60; |
214 | if (retval == -1) { | 307 | rtc_tm.tm_min++; |
215 | perror("read"); | 308 | } |
216 | exit(errno); | 309 | if (rtc_tm.tm_min == 60) { |
217 | } | 310 | rtc_tm.tm_min = 0; |
218 | irqcount++; | 311 | rtc_tm.tm_hour++; |
219 | fprintf(stderr, " okay. Alarm rang.\n"); | 312 | } |
220 | 313 | if (rtc_tm.tm_hour == 24) | |
221 | /* Disable alarm interrupts */ | 314 | rtc_tm.tm_hour = 0; |
222 | retval = ioctl(fd, RTC_AIE_OFF, 0); | ||
223 | if (retval == -1) { | ||
224 | perror("ioctl"); | ||
225 | exit(errno); | ||
226 | } | ||
227 | 315 | ||
228 | /* Read periodic IRQ rate */ | 316 | retval = ioctl(fd, RTC_ALM_SET, &rtc_tm); |
229 | retval = ioctl(fd, RTC_IRQP_READ, &tmp); | 317 | if (retval == -1) { |
230 | if (retval == -1) { | 318 | if (errno == ENOTTY) { |
231 | perror("ioctl"); | 319 | fprintf(stderr, |
232 | exit(errno); | 320 | "\n...Alarm IRQs not supported.\n"); |
233 | } | 321 | goto test_PIE; |
234 | fprintf(stderr, "\nPeriodic IRQ rate was %ldHz.\n", tmp); | 322 | } |
323 | perror("ioctl"); | ||
324 | exit(errno); | ||
325 | } | ||
235 | 326 | ||
236 | fprintf(stderr, "Counting 20 interrupts at:"); | 327 | /* Read the current alarm settings */ |
237 | fflush(stderr); | 328 | retval = ioctl(fd, RTC_ALM_READ, &rtc_tm); |
329 | if (retval == -1) { | ||
330 | perror("ioctl"); | ||
331 | exit(errno); | ||
332 | } | ||
238 | 333 | ||
239 | /* The frequencies 128Hz, 256Hz, ... 8192Hz are only allowed for root. */ | 334 | fprintf(stderr, "Alarm time now set to %02d:%02d:%02d.\n", |
240 | for (tmp=2; tmp<=64; tmp*=2) { | 335 | rtc_tm.tm_hour, rtc_tm.tm_min, rtc_tm.tm_sec); |
241 | 336 | ||
242 | retval = ioctl(fd, RTC_IRQP_SET, tmp); | 337 | /* Enable alarm interrupts */ |
338 | retval = ioctl(fd, RTC_AIE_ON, 0); | ||
243 | if (retval == -1) { | 339 | if (retval == -1) { |
244 | perror("ioctl"); | 340 | perror("ioctl"); |
245 | exit(errno); | 341 | exit(errno); |
246 | } | 342 | } |
247 | 343 | ||
248 | fprintf(stderr, "\n%ldHz:\t", tmp); | 344 | fprintf(stderr, "Waiting 5 seconds for alarm..."); |
249 | fflush(stderr); | 345 | fflush(stderr); |
346 | /* This blocks until the alarm ring causes an interrupt */ | ||
347 | retval = read(fd, &data, sizeof(unsigned long)); | ||
348 | if (retval == -1) { | ||
349 | perror("read"); | ||
350 | exit(errno); | ||
351 | } | ||
352 | irqcount++; | ||
353 | fprintf(stderr, " okay. Alarm rang.\n"); | ||
250 | 354 | ||
251 | /* Enable periodic interrupts */ | 355 | /* Disable alarm interrupts */ |
252 | retval = ioctl(fd, RTC_PIE_ON, 0); | 356 | retval = ioctl(fd, RTC_AIE_OFF, 0); |
253 | if (retval == -1) { | 357 | if (retval == -1) { |
254 | perror("ioctl"); | 358 | perror("ioctl"); |
255 | exit(errno); | 359 | exit(errno); |
256 | } | 360 | } |
257 | 361 | ||
258 | for (i=1; i<21; i++) { | 362 | test_PIE: |
259 | /* This blocks */ | 363 | /* Read periodic IRQ rate */ |
260 | retval = read(fd, &data, sizeof(unsigned long)); | 364 | retval = ioctl(fd, RTC_IRQP_READ, &tmp); |
365 | if (retval == -1) { | ||
366 | /* not all RTCs support periodic IRQs */ | ||
367 | if (errno == ENOTTY) { | ||
368 | fprintf(stderr, "\nNo periodic IRQ support\n"); | ||
369 | return 0; | ||
370 | } | ||
371 | perror("ioctl"); | ||
372 | exit(errno); | ||
373 | } | ||
374 | fprintf(stderr, "\nPeriodic IRQ rate is %ldHz.\n", tmp); | ||
375 | |||
376 | fprintf(stderr, "Counting 20 interrupts at:"); | ||
377 | fflush(stderr); | ||
378 | |||
379 | /* The frequencies 128Hz, 256Hz, ... 8192Hz are only allowed for root. */ | ||
380 | for (tmp=2; tmp<=64; tmp*=2) { | ||
381 | |||
382 | retval = ioctl(fd, RTC_IRQP_SET, tmp); | ||
261 | if (retval == -1) { | 383 | if (retval == -1) { |
262 | perror("read"); | 384 | /* not all RTCs can change their periodic IRQ rate */ |
263 | exit(errno); | 385 | if (errno == ENOTTY) { |
386 | fprintf(stderr, | ||
387 | "\n...Periodic IRQ rate is fixed\n"); | ||
388 | goto done; | ||
389 | } | ||
390 | perror("ioctl"); | ||
391 | exit(errno); | ||
264 | } | 392 | } |
265 | fprintf(stderr, " %d",i); | 393 | |
394 | fprintf(stderr, "\n%ldHz:\t", tmp); | ||
266 | fflush(stderr); | 395 | fflush(stderr); |
267 | irqcount++; | ||
268 | } | ||
269 | 396 | ||
270 | /* Disable periodic interrupts */ | 397 | /* Enable periodic interrupts */ |
271 | retval = ioctl(fd, RTC_PIE_OFF, 0); | 398 | retval = ioctl(fd, RTC_PIE_ON, 0); |
272 | if (retval == -1) { | 399 | if (retval == -1) { |
273 | perror("ioctl"); | 400 | perror("ioctl"); |
274 | exit(errno); | 401 | exit(errno); |
402 | } | ||
403 | |||
404 | for (i=1; i<21; i++) { | ||
405 | /* This blocks */ | ||
406 | retval = read(fd, &data, sizeof(unsigned long)); | ||
407 | if (retval == -1) { | ||
408 | perror("read"); | ||
409 | exit(errno); | ||
410 | } | ||
411 | fprintf(stderr, " %d",i); | ||
412 | fflush(stderr); | ||
413 | irqcount++; | ||
414 | } | ||
415 | |||
416 | /* Disable periodic interrupts */ | ||
417 | retval = ioctl(fd, RTC_PIE_OFF, 0); | ||
418 | if (retval == -1) { | ||
419 | perror("ioctl"); | ||
420 | exit(errno); | ||
421 | } | ||
275 | } | 422 | } |
276 | } | ||
277 | 423 | ||
278 | fprintf(stderr, "\n\n\t\t\t *** Test complete ***\n"); | 424 | done: |
279 | fprintf(stderr, "\nTyping \"cat /proc/interrupts\" will show %d more events on IRQ 8.\n\n", | 425 | fprintf(stderr, "\n\n\t\t\t *** Test complete ***\n"); |
280 | irqcount); | ||
281 | 426 | ||
282 | close(fd); | 427 | close(fd); |
283 | return 0; | ||
284 | 428 | ||
285 | } /* end main */ | 429 | return 0; |
430 | } | ||
diff --git a/MAINTAINERS b/MAINTAINERS index a5508f930ed9..e182992ff799 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -353,6 +353,12 @@ P: Richard Purdie | |||
353 | M: rpurdie@rpsys.net | 353 | M: rpurdie@rpsys.net |
354 | S: Maintained | 354 | S: Maintained |
355 | 355 | ||
356 | ARM/HP JORNADA 7XX MACHINE SUPPORT | ||
357 | P: Kristoffer Ericson | ||
358 | M: kristoffer_e1@hotmail.com | ||
359 | W: www.jlime.com | ||
360 | S: Maintained | ||
361 | |||
356 | ARM/TOSA MACHINE SUPPORT | 362 | ARM/TOSA MACHINE SUPPORT |
357 | P: Dirk Opfer | 363 | P: Dirk Opfer |
358 | M: dirk@opfer-online.de | 364 | M: dirk@opfer-online.de |
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index adb05de40e24..ce00c570459d 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig | |||
@@ -879,6 +879,8 @@ endif | |||
879 | 879 | ||
880 | source "drivers/scsi/Kconfig" | 880 | source "drivers/scsi/Kconfig" |
881 | 881 | ||
882 | source "drivers/ata/Kconfig" | ||
883 | |||
882 | source "drivers/md/Kconfig" | 884 | source "drivers/md/Kconfig" |
883 | 885 | ||
884 | source "drivers/message/fusion/Kconfig" | 886 | source "drivers/message/fusion/Kconfig" |
diff --git a/arch/arm/mach-ebsa110/io.c b/arch/arm/mach-ebsa110/io.c index c648bfb676a1..db38afb2aa88 100644 --- a/arch/arm/mach-ebsa110/io.c +++ b/arch/arm/mach-ebsa110/io.c | |||
@@ -28,7 +28,7 @@ | |||
28 | #include <asm/io.h> | 28 | #include <asm/io.h> |
29 | #include <asm/page.h> | 29 | #include <asm/page.h> |
30 | 30 | ||
31 | static void __iomem *__isamem_convert_addr(void __iomem *addr) | 31 | static void __iomem *__isamem_convert_addr(const volatile void __iomem *addr) |
32 | { | 32 | { |
33 | u32 ret, a = (u32 __force) addr; | 33 | u32 ret, a = (u32 __force) addr; |
34 | 34 | ||
@@ -63,7 +63,7 @@ static void __iomem *__isamem_convert_addr(void __iomem *addr) | |||
63 | /* | 63 | /* |
64 | * read[bwl] and write[bwl] | 64 | * read[bwl] and write[bwl] |
65 | */ | 65 | */ |
66 | u8 __readb(void __iomem *addr) | 66 | u8 __readb(const volatile void __iomem *addr) |
67 | { | 67 | { |
68 | void __iomem *a = __isamem_convert_addr(addr); | 68 | void __iomem *a = __isamem_convert_addr(addr); |
69 | u32 ret; | 69 | u32 ret; |
@@ -75,7 +75,7 @@ u8 __readb(void __iomem *addr) | |||
75 | return ret; | 75 | return ret; |
76 | } | 76 | } |
77 | 77 | ||
78 | u16 __readw(void __iomem *addr) | 78 | u16 __readw(const volatile void __iomem *addr) |
79 | { | 79 | { |
80 | void __iomem *a = __isamem_convert_addr(addr); | 80 | void __iomem *a = __isamem_convert_addr(addr); |
81 | 81 | ||
@@ -85,7 +85,7 @@ u16 __readw(void __iomem *addr) | |||
85 | return __raw_readw(a); | 85 | return __raw_readw(a); |
86 | } | 86 | } |
87 | 87 | ||
88 | u32 __readl(void __iomem *addr) | 88 | u32 __readl(const volatile void __iomem *addr) |
89 | { | 89 | { |
90 | void __iomem *a = __isamem_convert_addr(addr); | 90 | void __iomem *a = __isamem_convert_addr(addr); |
91 | u32 ret; | 91 | u32 ret; |
diff --git a/arch/arm/mm/consistent.c b/arch/arm/mm/consistent.c index 50e6b6bfb2e2..b797217e82be 100644 --- a/arch/arm/mm/consistent.c +++ b/arch/arm/mm/consistent.c | |||
@@ -476,6 +476,9 @@ core_initcall(consistent_init); | |||
476 | 476 | ||
477 | /* | 477 | /* |
478 | * Make an area consistent for devices. | 478 | * Make an area consistent for devices. |
479 | * Note: Drivers should NOT use this function directly, as it will break | ||
480 | * platforms with CONFIG_DMABOUNCE. | ||
481 | * Use the driver DMA support - see dma-mapping.h (dma_sync_*) | ||
479 | */ | 482 | */ |
480 | void consistent_sync(void *vaddr, size_t size, int direction) | 483 | void consistent_sync(void *vaddr, size_t size, int direction) |
481 | { | 484 | { |
diff --git a/arch/mips/mm/c-sb1.c b/arch/mips/mm/c-sb1.c index d0ddb4a768a5..3a8afd47feaa 100644 --- a/arch/mips/mm/c-sb1.c +++ b/arch/mips/mm/c-sb1.c | |||
@@ -19,6 +19,7 @@ | |||
19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 19 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
22 | #include <linux/hardirq.h> | ||
22 | 23 | ||
23 | #include <asm/asm.h> | 24 | #include <asm/asm.h> |
24 | #include <asm/bootinfo.h> | 25 | #include <asm/bootinfo.h> |
@@ -242,6 +243,25 @@ void sb1_flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsign | |||
242 | __attribute__((alias("local_sb1_flush_cache_page"))); | 243 | __attribute__((alias("local_sb1_flush_cache_page"))); |
243 | #endif | 244 | #endif |
244 | 245 | ||
246 | #ifdef CONFIG_SMP | ||
247 | static void sb1_flush_cache_data_page_ipi(void *info) | ||
248 | { | ||
249 | unsigned long start = (unsigned long)info; | ||
250 | |||
251 | __sb1_writeback_inv_dcache_range(start, start + PAGE_SIZE); | ||
252 | } | ||
253 | |||
254 | static void sb1_flush_cache_data_page(unsigned long addr) | ||
255 | { | ||
256 | if (in_atomic()) | ||
257 | __sb1_writeback_inv_dcache_range(addr, addr + PAGE_SIZE); | ||
258 | else | ||
259 | on_each_cpu(sb1_flush_cache_data_page_ipi, (void *) addr, 1, 1); | ||
260 | } | ||
261 | #else | ||
262 | void sb1_flush_cache_data_page(unsigned long) | ||
263 | __attribute__((alias("local_sb1_flush_cache_data_page"))); | ||
264 | #endif | ||
245 | 265 | ||
246 | /* | 266 | /* |
247 | * Invalidate all caches on this CPU | 267 | * Invalidate all caches on this CPU |
@@ -481,7 +501,7 @@ void sb1_cache_init(void) | |||
481 | 501 | ||
482 | flush_cache_sigtramp = sb1_flush_cache_sigtramp; | 502 | flush_cache_sigtramp = sb1_flush_cache_sigtramp; |
483 | local_flush_data_cache_page = (void *) sb1_nop; | 503 | local_flush_data_cache_page = (void *) sb1_nop; |
484 | flush_data_cache_page = (void *) sb1_nop; | 504 | flush_data_cache_page = sb1_flush_cache_data_page; |
485 | 505 | ||
486 | /* Full flush */ | 506 | /* Full flush */ |
487 | __flush_cache_all = sb1___flush_cache_all; | 507 | __flush_cache_all = sb1___flush_cache_all; |
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index a1b5e4b16151..46a24de36fec 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c | |||
@@ -1014,48 +1014,6 @@ void __init time_init(void) | |||
1014 | set_dec(tb_ticks_per_jiffy); | 1014 | set_dec(tb_ticks_per_jiffy); |
1015 | } | 1015 | } |
1016 | 1016 | ||
1017 | #ifdef CONFIG_RTC_CLASS | ||
1018 | static int set_rtc_class_time(struct rtc_time *tm) | ||
1019 | { | ||
1020 | int err; | ||
1021 | struct class_device *class_dev = | ||
1022 | rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE); | ||
1023 | |||
1024 | if (class_dev == NULL) | ||
1025 | return -ENODEV; | ||
1026 | |||
1027 | err = rtc_set_time(class_dev, tm); | ||
1028 | |||
1029 | rtc_class_close(class_dev); | ||
1030 | |||
1031 | return 0; | ||
1032 | } | ||
1033 | |||
1034 | static void get_rtc_class_time(struct rtc_time *tm) | ||
1035 | { | ||
1036 | int err; | ||
1037 | struct class_device *class_dev = | ||
1038 | rtc_class_open(CONFIG_RTC_HCTOSYS_DEVICE); | ||
1039 | |||
1040 | if (class_dev == NULL) | ||
1041 | return; | ||
1042 | |||
1043 | err = rtc_read_time(class_dev, tm); | ||
1044 | |||
1045 | rtc_class_close(class_dev); | ||
1046 | |||
1047 | return; | ||
1048 | } | ||
1049 | |||
1050 | int __init rtc_class_hookup(void) | ||
1051 | { | ||
1052 | ppc_md.get_rtc_time = get_rtc_class_time; | ||
1053 | ppc_md.set_rtc_time = set_rtc_class_time; | ||
1054 | |||
1055 | return 0; | ||
1056 | } | ||
1057 | #endif /* CONFIG_RTC_CLASS */ | ||
1058 | |||
1059 | 1017 | ||
1060 | #define FEBRUARY 2 | 1018 | #define FEBRUARY 2 |
1061 | #define STARTOFTIME 1970 | 1019 | #define STARTOFTIME 1970 |
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c index 54dea9d42dc9..a43ac71ab740 100644 --- a/arch/powerpc/platforms/83xx/mpc832x_mds.c +++ b/arch/powerpc/platforms/83xx/mpc832x_mds.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/root_dev.h> | 24 | #include <linux/root_dev.h> |
25 | #include <linux/initrd.h> | 25 | #include <linux/initrd.h> |
26 | 26 | ||
27 | #include <asm/of_device.h> | ||
27 | #include <asm/system.h> | 28 | #include <asm/system.h> |
28 | #include <asm/atomic.h> | 29 | #include <asm/atomic.h> |
29 | #include <asm/time.h> | 30 | #include <asm/time.h> |
@@ -136,6 +137,24 @@ static void __init mpc832x_sys_setup_arch(void) | |||
136 | #endif | 137 | #endif |
137 | } | 138 | } |
138 | 139 | ||
140 | static int __init mpc832x_declare_of_platform_devices(void) | ||
141 | { | ||
142 | struct device_node *np; | ||
143 | |||
144 | for (np = NULL; (np = of_find_compatible_node(np, "network", | ||
145 | "ucc_geth")) != NULL;) { | ||
146 | int ucc_num; | ||
147 | char bus_id[BUS_ID_SIZE]; | ||
148 | |||
149 | ucc_num = *((uint *) get_property(np, "device-id", NULL)) - 1; | ||
150 | snprintf(bus_id, BUS_ID_SIZE, "ucc_geth.%u", ucc_num); | ||
151 | of_platform_device_create(np, bus_id, NULL); | ||
152 | } | ||
153 | |||
154 | return 0; | ||
155 | } | ||
156 | device_initcall(mpc832x_declare_of_platform_devices); | ||
157 | |||
139 | void __init mpc832x_sys_init_IRQ(void) | 158 | void __init mpc832x_sys_init_IRQ(void) |
140 | { | 159 | { |
141 | 160 | ||
diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.c b/arch/powerpc/platforms/83xx/mpc834x_itx.c index 5446bab08eca..e2bcaaf6b329 100644 --- a/arch/powerpc/platforms/83xx/mpc834x_itx.c +++ b/arch/powerpc/platforms/83xx/mpc834x_itx.c | |||
@@ -108,10 +108,6 @@ static int __init mpc834x_itx_probe(void) | |||
108 | return 1; | 108 | return 1; |
109 | } | 109 | } |
110 | 110 | ||
111 | #ifdef CONFIG_RTC_CLASS | ||
112 | late_initcall(rtc_class_hookup); | ||
113 | #endif | ||
114 | |||
115 | define_machine(mpc834x_itx) { | 111 | define_machine(mpc834x_itx) { |
116 | .name = "MPC834x ITX", | 112 | .name = "MPC834x ITX", |
117 | .probe = mpc834x_itx_probe, | 113 | .probe = mpc834x_itx_probe, |
diff --git a/arch/um/include/os.h b/arch/um/include/os.h index 6516f6dca96d..13a86bd383d3 100644 --- a/arch/um/include/os.h +++ b/arch/um/include/os.h | |||
@@ -233,6 +233,8 @@ extern unsigned long __do_user_copy(void *to, const void *from, int n, | |||
233 | void (*op)(void *to, const void *from, | 233 | void (*op)(void *to, const void *from, |
234 | int n), int *faulted_out); | 234 | int n), int *faulted_out); |
235 | 235 | ||
236 | /* execvp.c */ | ||
237 | extern int execvp_noalloc(char *buf, const char *file, char *const argv[]); | ||
236 | /* helper.c */ | 238 | /* helper.c */ |
237 | extern int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv, | 239 | extern int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv, |
238 | unsigned long *stack_out); | 240 | unsigned long *stack_out); |
diff --git a/arch/um/os-Linux/Makefile b/arch/um/os-Linux/Makefile index b4183929b32c..2f8c79464015 100644 --- a/arch/um/os-Linux/Makefile +++ b/arch/um/os-Linux/Makefile | |||
@@ -3,8 +3,8 @@ | |||
3 | # Licensed under the GPL | 3 | # Licensed under the GPL |
4 | # | 4 | # |
5 | 5 | ||
6 | obj-y = aio.o elf_aux.o file.o helper.o irq.o main.o mem.o process.o sigio.o \ | 6 | obj-y = aio.o elf_aux.o execvp.o file.o helper.o irq.o main.o mem.o process.o \ |
7 | signal.o start_up.o time.o trap.o tty.o uaccess.o umid.o tls.o \ | 7 | sigio.o signal.o start_up.o time.o trap.o tty.o uaccess.o umid.o tls.o \ |
8 | user_syms.o util.o drivers/ sys-$(SUBARCH)/ | 8 | user_syms.o util.o drivers/ sys-$(SUBARCH)/ |
9 | 9 | ||
10 | obj-$(CONFIG_MODE_SKAS) += skas/ | 10 | obj-$(CONFIG_MODE_SKAS) += skas/ |
@@ -15,9 +15,9 @@ user-objs-$(CONFIG_MODE_TT) += tt.o | |||
15 | obj-$(CONFIG_TTY_LOG) += tty_log.o | 15 | obj-$(CONFIG_TTY_LOG) += tty_log.o |
16 | user-objs-$(CONFIG_TTY_LOG) += tty_log.o | 16 | user-objs-$(CONFIG_TTY_LOG) += tty_log.o |
17 | 17 | ||
18 | USER_OBJS := $(user-objs-y) aio.o elf_aux.o file.o helper.o irq.o main.o mem.o \ | 18 | USER_OBJS := $(user-objs-y) aio.o elf_aux.o execvp.o file.o helper.o irq.o \ |
19 | process.o sigio.o signal.o start_up.o time.o trap.o tty.o tls.o \ | 19 | main.o mem.o process.o sigio.o signal.o start_up.o time.o trap.o tty.o \ |
20 | uaccess.o umid.o util.o | 20 | tls.o uaccess.o umid.o util.o |
21 | 21 | ||
22 | CFLAGS_user_syms.o += -DSUBARCH_$(SUBARCH) | 22 | CFLAGS_user_syms.o += -DSUBARCH_$(SUBARCH) |
23 | 23 | ||
diff --git a/arch/um/os-Linux/execvp.c b/arch/um/os-Linux/execvp.c new file mode 100644 index 000000000000..66e583a4031b --- /dev/null +++ b/arch/um/os-Linux/execvp.c | |||
@@ -0,0 +1,149 @@ | |||
1 | /* Copyright (C) 2006 by Paolo Giarrusso - modified from glibc' execvp.c. | ||
2 | Original copyright notice follows: | ||
3 | |||
4 | Copyright (C) 1991,92,1995-99,2002,2004 Free Software Foundation, Inc. | ||
5 | This file is part of the GNU C Library. | ||
6 | |||
7 | The GNU C Library is free software; you can redistribute it and/or | ||
8 | modify it under the terms of the GNU Lesser General Public | ||
9 | License as published by the Free Software Foundation; either | ||
10 | version 2.1 of the License, or (at your option) any later version. | ||
11 | |||
12 | The GNU C Library is distributed in the hope that it will be useful, | ||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | Lesser General Public License for more details. | ||
16 | |||
17 | You should have received a copy of the GNU Lesser General Public | ||
18 | License along with the GNU C Library; if not, write to the Free | ||
19 | Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA | ||
20 | 02111-1307 USA. */ | ||
21 | #include <unistd.h> | ||
22 | |||
23 | #include <stdbool.h> | ||
24 | #include <stdlib.h> | ||
25 | #include <string.h> | ||
26 | #include <errno.h> | ||
27 | #include <limits.h> | ||
28 | |||
29 | #ifndef TEST | ||
30 | #include "um_malloc.h" | ||
31 | #else | ||
32 | #include <stdio.h> | ||
33 | #define um_kmalloc malloc | ||
34 | #endif | ||
35 | #include "os.h" | ||
36 | |||
37 | /* Execute FILE, searching in the `PATH' environment variable if it contains | ||
38 | no slashes, with arguments ARGV and environment from `environ'. */ | ||
39 | int execvp_noalloc(char *buf, const char *file, char *const argv[]) | ||
40 | { | ||
41 | if (*file == '\0') { | ||
42 | return -ENOENT; | ||
43 | } | ||
44 | |||
45 | if (strchr (file, '/') != NULL) { | ||
46 | /* Don't search when it contains a slash. */ | ||
47 | execv(file, argv); | ||
48 | } else { | ||
49 | int got_eacces; | ||
50 | size_t len, pathlen; | ||
51 | char *name, *p; | ||
52 | char *path = getenv("PATH"); | ||
53 | if (path == NULL) | ||
54 | path = ":/bin:/usr/bin"; | ||
55 | |||
56 | len = strlen(file) + 1; | ||
57 | pathlen = strlen(path); | ||
58 | /* Copy the file name at the top. */ | ||
59 | name = memcpy(buf + pathlen + 1, file, len); | ||
60 | /* And add the slash. */ | ||
61 | *--name = '/'; | ||
62 | |||
63 | got_eacces = 0; | ||
64 | p = path; | ||
65 | do { | ||
66 | char *startp; | ||
67 | |||
68 | path = p; | ||
69 | //Let's avoid this GNU extension. | ||
70 | //p = strchrnul (path, ':'); | ||
71 | p = strchr(path, ':'); | ||
72 | if (!p) | ||
73 | p = strchr(path, '\0'); | ||
74 | |||
75 | if (p == path) | ||
76 | /* Two adjacent colons, or a colon at the beginning or the end | ||
77 | of `PATH' means to search the current directory. */ | ||
78 | startp = name + 1; | ||
79 | else | ||
80 | startp = memcpy(name - (p - path), path, p - path); | ||
81 | |||
82 | /* Try to execute this name. If it works, execv will not return. */ | ||
83 | execv(startp, argv); | ||
84 | |||
85 | /* | ||
86 | if (errno == ENOEXEC) { | ||
87 | } | ||
88 | */ | ||
89 | |||
90 | switch (errno) { | ||
91 | case EACCES: | ||
92 | /* Record the we got a `Permission denied' error. If we end | ||
93 | up finding no executable we can use, we want to diagnose | ||
94 | that we did find one but were denied access. */ | ||
95 | got_eacces = 1; | ||
96 | case ENOENT: | ||
97 | case ESTALE: | ||
98 | case ENOTDIR: | ||
99 | /* Those errors indicate the file is missing or not executable | ||
100 | by us, in which case we want to just try the next path | ||
101 | directory. */ | ||
102 | case ENODEV: | ||
103 | case ETIMEDOUT: | ||
104 | /* Some strange filesystems like AFS return even | ||
105 | stranger error numbers. They cannot reasonably mean | ||
106 | anything else so ignore those, too. */ | ||
107 | case ENOEXEC: | ||
108 | /* We won't go searching for the shell | ||
109 | * if it is not executable - the Linux | ||
110 | * kernel already handles this enough, | ||
111 | * for us. */ | ||
112 | break; | ||
113 | |||
114 | default: | ||
115 | /* Some other error means we found an executable file, but | ||
116 | something went wrong executing it; return the error to our | ||
117 | caller. */ | ||
118 | return -errno; | ||
119 | } | ||
120 | } while (*p++ != '\0'); | ||
121 | |||
122 | /* We tried every element and none of them worked. */ | ||
123 | if (got_eacces) | ||
124 | /* At least one failure was due to permissions, so report that | ||
125 | error. */ | ||
126 | return -EACCES; | ||
127 | } | ||
128 | |||
129 | /* Return the error from the last attempt (probably ENOENT). */ | ||
130 | return -errno; | ||
131 | } | ||
132 | #ifdef TEST | ||
133 | int main(int argc, char**argv) | ||
134 | { | ||
135 | char buf[PATH_MAX]; | ||
136 | int ret; | ||
137 | argc--; | ||
138 | if (!argc) { | ||
139 | fprintf(stderr, "Not enough arguments\n"); | ||
140 | return 1; | ||
141 | } | ||
142 | argv++; | ||
143 | if (ret = execvp_noalloc(buf, argv[0], argv)) { | ||
144 | errno = -ret; | ||
145 | perror("execvp_noalloc"); | ||
146 | } | ||
147 | return 0; | ||
148 | } | ||
149 | #endif | ||
diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c index d13299cfa318..c7ad6306e22f 100644 --- a/arch/um/os-Linux/helper.c +++ b/arch/um/os-Linux/helper.c | |||
@@ -8,18 +8,21 @@ | |||
8 | #include <unistd.h> | 8 | #include <unistd.h> |
9 | #include <errno.h> | 9 | #include <errno.h> |
10 | #include <sched.h> | 10 | #include <sched.h> |
11 | #include <limits.h> | ||
11 | #include <sys/signal.h> | 12 | #include <sys/signal.h> |
12 | #include <sys/wait.h> | 13 | #include <sys/wait.h> |
13 | #include "user.h" | 14 | #include "user.h" |
14 | #include "kern_util.h" | 15 | #include "kern_util.h" |
15 | #include "user_util.h" | 16 | #include "user_util.h" |
16 | #include "os.h" | 17 | #include "os.h" |
18 | #include "um_malloc.h" | ||
17 | 19 | ||
18 | struct helper_data { | 20 | struct helper_data { |
19 | void (*pre_exec)(void*); | 21 | void (*pre_exec)(void*); |
20 | void *pre_data; | 22 | void *pre_data; |
21 | char **argv; | 23 | char **argv; |
22 | int fd; | 24 | int fd; |
25 | char *buf; | ||
23 | }; | 26 | }; |
24 | 27 | ||
25 | /* Debugging aid, changed only from gdb */ | 28 | /* Debugging aid, changed only from gdb */ |
@@ -41,9 +44,8 @@ static int helper_child(void *arg) | |||
41 | } | 44 | } |
42 | if (data->pre_exec != NULL) | 45 | if (data->pre_exec != NULL) |
43 | (*data->pre_exec)(data->pre_data); | 46 | (*data->pre_exec)(data->pre_data); |
44 | execvp(argv[0], argv); | 47 | errval = execvp_noalloc(data->buf, argv[0], argv); |
45 | errval = -errno; | 48 | printk("helper_child - execvp of '%s' failed - errno = %d\n", argv[0], -errval); |
46 | printk("helper_child - execve of '%s' failed - errno = %d\n", argv[0], errno); | ||
47 | os_write_file(data->fd, &errval, sizeof(errval)); | 49 | os_write_file(data->fd, &errval, sizeof(errval)); |
48 | kill(os_getpid(), SIGKILL); | 50 | kill(os_getpid(), SIGKILL); |
49 | return 0; | 51 | return 0; |
@@ -84,11 +86,13 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv, | |||
84 | data.pre_data = pre_data; | 86 | data.pre_data = pre_data; |
85 | data.argv = argv; | 87 | data.argv = argv; |
86 | data.fd = fds[1]; | 88 | data.fd = fds[1]; |
89 | data.buf = __cant_sleep() ? um_kmalloc_atomic(PATH_MAX) : | ||
90 | um_kmalloc(PATH_MAX); | ||
87 | pid = clone(helper_child, (void *) sp, CLONE_VM | SIGCHLD, &data); | 91 | pid = clone(helper_child, (void *) sp, CLONE_VM | SIGCHLD, &data); |
88 | if (pid < 0) { | 92 | if (pid < 0) { |
89 | ret = -errno; | 93 | ret = -errno; |
90 | printk("run_helper : clone failed, errno = %d\n", errno); | 94 | printk("run_helper : clone failed, errno = %d\n", errno); |
91 | goto out_close; | 95 | goto out_free2; |
92 | } | 96 | } |
93 | 97 | ||
94 | close(fds[1]); | 98 | close(fds[1]); |
@@ -109,6 +113,8 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv, | |||
109 | CATCH_EINTR(waitpid(pid, NULL, 0)); | 113 | CATCH_EINTR(waitpid(pid, NULL, 0)); |
110 | } | 114 | } |
111 | 115 | ||
116 | out_free2: | ||
117 | kfree(data.buf); | ||
112 | out_close: | 118 | out_close: |
113 | if (fds[1] != -1) | 119 | if (fds[1] != -1) |
114 | close(fds[1]); | 120 | close(fds[1]); |
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index 7ba5e49ab302..6fd174a37149 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
@@ -83,10 +83,8 @@ static int acpi_processor_ppc_notifier(struct notifier_block *nb, | |||
83 | goto out; | 83 | goto out; |
84 | 84 | ||
85 | ppc = (unsigned int)pr->performance_platform_limit; | 85 | ppc = (unsigned int)pr->performance_platform_limit; |
86 | if (!ppc) | ||
87 | goto out; | ||
88 | 86 | ||
89 | if (ppc > pr->performance->state_count) | 87 | if (ppc >= pr->performance->state_count) |
90 | goto out; | 88 | goto out; |
91 | 89 | ||
92 | cpufreq_verify_within_limits(policy, 0, | 90 | cpufreq_verify_within_limits(policy, 0, |
diff --git a/drivers/base/core.c b/drivers/base/core.c index 68ad11af22b4..002fde46d38d 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -591,8 +591,10 @@ void device_del(struct device * dev) | |||
591 | 591 | ||
592 | if (parent) | 592 | if (parent) |
593 | klist_del(&dev->knode_parent); | 593 | klist_del(&dev->knode_parent); |
594 | if (dev->devt_attr) | 594 | if (dev->devt_attr) { |
595 | device_remove_file(dev, dev->devt_attr); | 595 | device_remove_file(dev, dev->devt_attr); |
596 | kfree(dev->devt_attr); | ||
597 | } | ||
596 | if (dev->class) { | 598 | if (dev->class) { |
597 | sysfs_remove_link(&dev->kobj, "subsystem"); | 599 | sysfs_remove_link(&dev->kobj, "subsystem"); |
598 | sysfs_remove_link(&dev->class->subsys.kset.kobj, dev->bus_id); | 600 | sysfs_remove_link(&dev->class->subsys.kset.kobj, dev->bus_id); |
diff --git a/drivers/char/agp/generic.c b/drivers/char/agp/generic.c index c39200161688..5ff457b41efb 100644 --- a/drivers/char/agp/generic.c +++ b/drivers/char/agp/generic.c | |||
@@ -1054,7 +1054,7 @@ void *agp_generic_alloc_page(struct agp_bridge_data *bridge) | |||
1054 | { | 1054 | { |
1055 | struct page * page; | 1055 | struct page * page; |
1056 | 1056 | ||
1057 | page = alloc_page(GFP_KERNEL); | 1057 | page = alloc_page(GFP_KERNEL | GFP_DMA32); |
1058 | if (page == NULL) | 1058 | if (page == NULL) |
1059 | return NULL; | 1059 | return NULL; |
1060 | 1060 | ||
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index d1ede7db5a12..555b3a8ab49c 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c | |||
@@ -169,7 +169,7 @@ static void *i8xx_alloc_pages(void) | |||
169 | { | 169 | { |
170 | struct page * page; | 170 | struct page * page; |
171 | 171 | ||
172 | page = alloc_pages(GFP_KERNEL, 2); | 172 | page = alloc_pages(GFP_KERNEL | GFP_DMA32, 2); |
173 | if (page == NULL) | 173 | if (page == NULL) |
174 | return NULL; | 174 | return NULL; |
175 | 175 | ||
@@ -387,11 +387,7 @@ static void intel_i830_init_gtt_entries(void) | |||
387 | /* We obtain the size of the GTT, which is also stored (for some | 387 | /* We obtain the size of the GTT, which is also stored (for some |
388 | * reason) at the top of stolen memory. Then we add 4KB to that | 388 | * reason) at the top of stolen memory. Then we add 4KB to that |
389 | * for the video BIOS popup, which is also stored in there. */ | 389 | * for the video BIOS popup, which is also stored in there. */ |
390 | 390 | size = agp_bridge->driver->fetch_size() + 4; | |
391 | if (IS_I965) | ||
392 | size = 512 + 4; | ||
393 | else | ||
394 | size = agp_bridge->driver->fetch_size() + 4; | ||
395 | 391 | ||
396 | if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82830_HB || | 392 | if (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82830_HB || |
397 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82845G_HB) { | 393 | agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82845G_HB) { |
@@ -805,6 +801,26 @@ static int intel_i915_create_gatt_table(struct agp_bridge_data *bridge) | |||
805 | 801 | ||
806 | return 0; | 802 | return 0; |
807 | } | 803 | } |
804 | |||
805 | /* | ||
806 | * The i965 supports 36-bit physical addresses, but to keep | ||
807 | * the format of the GTT the same, the bits that don't fit | ||
808 | * in a 32-bit word are shifted down to bits 4..7. | ||
809 | * | ||
810 | * Gcc is smart enough to notice that "(addr >> 28) & 0xf0" | ||
811 | * is always zero on 32-bit architectures, so no need to make | ||
812 | * this conditional. | ||
813 | */ | ||
814 | static unsigned long intel_i965_mask_memory(struct agp_bridge_data *bridge, | ||
815 | unsigned long addr, int type) | ||
816 | { | ||
817 | /* Shift high bits down */ | ||
818 | addr |= (addr >> 28) & 0xf0; | ||
819 | |||
820 | /* Type checking must be done elsewhere */ | ||
821 | return addr | bridge->driver->masks[type].mask; | ||
822 | } | ||
823 | |||
808 | static int intel_i965_fetch_size(void) | 824 | static int intel_i965_fetch_size(void) |
809 | { | 825 | { |
810 | struct aper_size_info_fixed *values; | 826 | struct aper_size_info_fixed *values; |
@@ -832,7 +848,8 @@ static int intel_i965_fetch_size(void) | |||
832 | 848 | ||
833 | agp_bridge->previous_size = agp_bridge->current_size = (void *)(values + offset); | 849 | agp_bridge->previous_size = agp_bridge->current_size = (void *)(values + offset); |
834 | 850 | ||
835 | return values[offset].size; | 851 | /* The i965 GTT is always sized as if it had a 512kB aperture size */ |
852 | return 512; | ||
836 | } | 853 | } |
837 | 854 | ||
838 | /* The intel i965 automatically initializes the agp aperture during POST. | 855 | /* The intel i965 automatically initializes the agp aperture during POST. |
@@ -1584,7 +1601,7 @@ static struct agp_bridge_driver intel_i965_driver = { | |||
1584 | .fetch_size = intel_i965_fetch_size, | 1601 | .fetch_size = intel_i965_fetch_size, |
1585 | .cleanup = intel_i915_cleanup, | 1602 | .cleanup = intel_i915_cleanup, |
1586 | .tlb_flush = intel_i810_tlbflush, | 1603 | .tlb_flush = intel_i810_tlbflush, |
1587 | .mask_memory = intel_i810_mask_memory, | 1604 | .mask_memory = intel_i965_mask_memory, |
1588 | .masks = intel_i810_masks, | 1605 | .masks = intel_i810_masks, |
1589 | .agp_enable = intel_i810_agp_enable, | 1606 | .agp_enable = intel_i810_agp_enable, |
1590 | .cache_flush = global_cache_flush, | 1607 | .cache_flush = global_cache_flush, |
diff --git a/drivers/char/tlclk.c b/drivers/char/tlclk.c index 2444a0e24b31..244d30a03fef 100644 --- a/drivers/char/tlclk.c +++ b/drivers/char/tlclk.c | |||
@@ -792,15 +792,14 @@ static int __init tlclk_init(void) | |||
792 | ret = misc_register(&tlclk_miscdev); | 792 | ret = misc_register(&tlclk_miscdev); |
793 | if (ret < 0) { | 793 | if (ret < 0) { |
794 | printk(KERN_ERR "tlclk: misc_register returns %d.\n", ret); | 794 | printk(KERN_ERR "tlclk: misc_register returns %d.\n", ret); |
795 | ret = -EBUSY; | ||
796 | goto out3; | 795 | goto out3; |
797 | } | 796 | } |
798 | 797 | ||
799 | tlclk_device = platform_device_register_simple("telco_clock", | 798 | tlclk_device = platform_device_register_simple("telco_clock", |
800 | -1, NULL, 0); | 799 | -1, NULL, 0); |
801 | if (!tlclk_device) { | 800 | if (IS_ERR(tlclk_device)) { |
802 | printk(KERN_ERR "tlclk: platform_device_register failed.\n"); | 801 | printk(KERN_ERR "tlclk: platform_device_register failed.\n"); |
803 | ret = -EBUSY; | 802 | ret = PTR_ERR(tlclk_device); |
804 | goto out4; | 803 | goto out4; |
805 | } | 804 | } |
806 | 805 | ||
diff --git a/drivers/cpufreq/Kconfig b/drivers/cpufreq/Kconfig index 2cc71b66231e..491779af8d55 100644 --- a/drivers/cpufreq/Kconfig +++ b/drivers/cpufreq/Kconfig | |||
@@ -107,6 +107,7 @@ config CPU_FREQ_GOV_USERSPACE | |||
107 | 107 | ||
108 | config CPU_FREQ_GOV_ONDEMAND | 108 | config CPU_FREQ_GOV_ONDEMAND |
109 | tristate "'ondemand' cpufreq policy governor" | 109 | tristate "'ondemand' cpufreq policy governor" |
110 | select CPU_FREQ_TABLE | ||
110 | help | 111 | help |
111 | 'ondemand' - This driver adds a dynamic cpufreq policy governor. | 112 | 'ondemand' - This driver adds a dynamic cpufreq policy governor. |
112 | The governor does a periodic polling and | 113 | The governor does a periodic polling and |
diff --git a/drivers/i2c/busses/i2c-ixp4xx.c b/drivers/i2c/busses/i2c-ixp4xx.c index 05fffb9415a2..68fe863f9d54 100644 --- a/drivers/i2c/busses/i2c-ixp4xx.c +++ b/drivers/i2c/busses/i2c-ixp4xx.c | |||
@@ -138,7 +138,7 @@ static int ixp4xx_i2c_probe(struct platform_device *plat_dev) | |||
138 | gpio_line_set(gpio->sda_pin, 0); | 138 | gpio_line_set(gpio->sda_pin, 0); |
139 | 139 | ||
140 | err = i2c_bit_add_bus(&drv_data->adapter); | 140 | err = i2c_bit_add_bus(&drv_data->adapter); |
141 | if (err != 0) | 141 | if (err) { |
142 | printk(KERN_ERR "ERROR: Could not install %s\n", plat_dev->dev.bus_id); | 142 | printk(KERN_ERR "ERROR: Could not install %s\n", plat_dev->dev.bus_id); |
143 | 143 | ||
144 | kfree(drv_data); | 144 | kfree(drv_data); |
diff --git a/drivers/ide/pci/sgiioc4.c b/drivers/ide/pci/sgiioc4.c index 244f7eb7006d..cfad09accf52 100644 --- a/drivers/ide/pci/sgiioc4.c +++ b/drivers/ide/pci/sgiioc4.c | |||
@@ -768,14 +768,7 @@ ioc4_ide_init(void) | |||
768 | return ioc4_register_submodule(&ioc4_ide_submodule); | 768 | return ioc4_register_submodule(&ioc4_ide_submodule); |
769 | } | 769 | } |
770 | 770 | ||
771 | static void __devexit | ||
772 | ioc4_ide_exit(void) | ||
773 | { | ||
774 | ioc4_unregister_submodule(&ioc4_ide_submodule); | ||
775 | } | ||
776 | |||
777 | late_initcall(ioc4_ide_init); /* Call only after IDE init is done */ | 771 | late_initcall(ioc4_ide_init); /* Call only after IDE init is done */ |
778 | module_exit(ioc4_ide_exit); | ||
779 | 772 | ||
780 | MODULE_AUTHOR("Aniket Malatpure/Jeremy Higdon"); | 773 | MODULE_AUTHOR("Aniket Malatpure/Jeremy Higdon"); |
781 | MODULE_DESCRIPTION("IDE PCI driver module for SGI IOC4 Base-IO Card"); | 774 | MODULE_DESCRIPTION("IDE PCI driver module for SGI IOC4 Base-IO Card"); |
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 53304e6991ac..a2ab2eebfc68 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c | |||
@@ -348,7 +348,7 @@ static int dvb_frontend_swzigzag_autotune(struct dvb_frontend *fe, int check_wra | |||
348 | 348 | ||
349 | static void dvb_frontend_swzigzag(struct dvb_frontend *fe) | 349 | static void dvb_frontend_swzigzag(struct dvb_frontend *fe) |
350 | { | 350 | { |
351 | fe_status_t s; | 351 | fe_status_t s = 0; |
352 | struct dvb_frontend_private *fepriv = fe->frontend_priv; | 352 | struct dvb_frontend_private *fepriv = fe->frontend_priv; |
353 | 353 | ||
354 | /* if we've got no parameters, just keep idling */ | 354 | /* if we've got no parameters, just keep idling */ |
diff --git a/drivers/media/dvb/frontends/tda10086.c b/drivers/media/dvb/frontends/tda10086.c index 7456b0b9976b..4c27a2d90a38 100644 --- a/drivers/media/dvb/frontends/tda10086.c +++ b/drivers/media/dvb/frontends/tda10086.c | |||
@@ -441,6 +441,10 @@ static int tda10086_get_frontend(struct dvb_frontend* fe, struct dvb_frontend_pa | |||
441 | 441 | ||
442 | dprintk ("%s\n", __FUNCTION__); | 442 | dprintk ("%s\n", __FUNCTION__); |
443 | 443 | ||
444 | // check for invalid symbol rate | ||
445 | if (fe_params->u.qpsk.symbol_rate < 500000) | ||
446 | return -EINVAL; | ||
447 | |||
444 | // calculate the updated frequency (note: we convert from Hz->kHz) | 448 | // calculate the updated frequency (note: we convert from Hz->kHz) |
445 | tmp64 = tda10086_read_byte(state, 0x52); | 449 | tmp64 = tda10086_read_byte(state, 0x52); |
446 | tmp64 |= (tda10086_read_byte(state, 0x51) << 8); | 450 | tmp64 |= (tda10086_read_byte(state, 0x51) << 8); |
diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c index e58f0391e9d1..56f1c80defc6 100644 --- a/drivers/media/dvb/ttpci/budget.c +++ b/drivers/media/dvb/ttpci/budget.c | |||
@@ -46,6 +46,10 @@ | |||
46 | #include "lnbp21.h" | 46 | #include "lnbp21.h" |
47 | #include "bsru6.h" | 47 | #include "bsru6.h" |
48 | 48 | ||
49 | static int diseqc_method; | ||
50 | module_param(diseqc_method, int, 0444); | ||
51 | MODULE_PARM_DESC(diseqc_method, "Select DiSEqC method for subsystem id 13c2:1003, 0: default, 1: more reliable (for newer revisions only)"); | ||
52 | |||
49 | static void Set22K (struct budget *budget, int state) | 53 | static void Set22K (struct budget *budget, int state) |
50 | { | 54 | { |
51 | struct saa7146_dev *dev=budget->dev; | 55 | struct saa7146_dev *dev=budget->dev; |
@@ -382,6 +386,11 @@ static void frontend_init(struct budget *budget) | |||
382 | if (budget->dvb_frontend) { | 386 | if (budget->dvb_frontend) { |
383 | budget->dvb_frontend->ops.tuner_ops.set_params = alps_bsru6_tuner_set_params; | 387 | budget->dvb_frontend->ops.tuner_ops.set_params = alps_bsru6_tuner_set_params; |
384 | budget->dvb_frontend->tuner_priv = &budget->i2c_adap; | 388 | budget->dvb_frontend->tuner_priv = &budget->i2c_adap; |
389 | if (budget->dev->pci->subsystem_device == 0x1003 && diseqc_method == 0) { | ||
390 | budget->dvb_frontend->ops.diseqc_send_master_cmd = budget_diseqc_send_master_cmd; | ||
391 | budget->dvb_frontend->ops.diseqc_send_burst = budget_diseqc_send_burst; | ||
392 | budget->dvb_frontend->ops.set_tone = budget_set_tone; | ||
393 | } | ||
385 | break; | 394 | break; |
386 | } | 395 | } |
387 | break; | 396 | break; |
diff --git a/drivers/media/video/et61x251/et61x251_core.c b/drivers/media/video/et61x251/et61x251_core.c index f786ab11d2cd..86e353b26b53 100644 --- a/drivers/media/video/et61x251/et61x251_core.c +++ b/drivers/media/video/et61x251/et61x251_core.c | |||
@@ -1182,8 +1182,6 @@ static void et61x251_release_resources(struct et61x251_device* cam) | |||
1182 | video_set_drvdata(cam->v4ldev, NULL); | 1182 | video_set_drvdata(cam->v4ldev, NULL); |
1183 | video_unregister_device(cam->v4ldev); | 1183 | video_unregister_device(cam->v4ldev); |
1184 | 1184 | ||
1185 | usb_put_dev(cam->usbdev); | ||
1186 | |||
1187 | mutex_unlock(&et61x251_sysfs_lock); | 1185 | mutex_unlock(&et61x251_sysfs_lock); |
1188 | 1186 | ||
1189 | kfree(cam->control_buffer); | 1187 | kfree(cam->control_buffer); |
@@ -1275,6 +1273,7 @@ static int et61x251_release(struct inode* inode, struct file* filp) | |||
1275 | 1273 | ||
1276 | if (cam->state & DEV_DISCONNECTED) { | 1274 | if (cam->state & DEV_DISCONNECTED) { |
1277 | et61x251_release_resources(cam); | 1275 | et61x251_release_resources(cam); |
1276 | usb_put_dev(cam->usbdev); | ||
1278 | mutex_unlock(&cam->dev_mutex); | 1277 | mutex_unlock(&cam->dev_mutex); |
1279 | kfree(cam); | 1278 | kfree(cam); |
1280 | return 0; | 1279 | return 0; |
diff --git a/drivers/media/video/saa6588.c b/drivers/media/video/saa6588.c index a81285ca7d5b..7b9859c33018 100644 --- a/drivers/media/video/saa6588.c +++ b/drivers/media/video/saa6588.c | |||
@@ -212,8 +212,10 @@ static void read_from_buf(struct saa6588 *s, struct rds_command *a) | |||
212 | if (rd_blocks > s->block_count) | 212 | if (rd_blocks > s->block_count) |
213 | rd_blocks = s->block_count; | 213 | rd_blocks = s->block_count; |
214 | 214 | ||
215 | if (!rd_blocks) | 215 | if (!rd_blocks) { |
216 | spin_unlock_irqrestore(&s->lock, flags); | ||
216 | return; | 217 | return; |
218 | } | ||
217 | 219 | ||
218 | for (i = 0; i < rd_blocks; i++) { | 220 | for (i = 0; i < rd_blocks; i++) { |
219 | if (block_to_user_buf(s, buf_ptr)) { | 221 | if (block_to_user_buf(s, buf_ptr)) { |
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index c5719f7bd1ac..f28398dd9d93 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c | |||
@@ -1464,8 +1464,6 @@ static int saa711x_attach(struct i2c_adapter *adapter, int address, int kind) | |||
1464 | client->driver = &i2c_driver_saa711x; | 1464 | client->driver = &i2c_driver_saa711x; |
1465 | snprintf(client->name, sizeof(client->name) - 1, "saa7115"); | 1465 | snprintf(client->name, sizeof(client->name) - 1, "saa7115"); |
1466 | 1466 | ||
1467 | v4l_dbg(1, debug, client, "detecting saa7115 client on address 0x%x\n", address << 1); | ||
1468 | |||
1469 | for (i=0;i<0x0f;i++) { | 1467 | for (i=0;i<0x0f;i++) { |
1470 | saa711x_write(client, 0, i); | 1468 | saa711x_write(client, 0, i); |
1471 | name[i] = (saa711x_read(client, 0) &0x0f) +'0'; | 1469 | name[i] = (saa711x_read(client, 0) &0x0f) +'0'; |
@@ -1477,6 +1475,13 @@ static int saa711x_attach(struct i2c_adapter *adapter, int address, int kind) | |||
1477 | saa711x_write(client, 0, 5); | 1475 | saa711x_write(client, 0, 5); |
1478 | chip_id = saa711x_read(client, 0) & 0x0f; | 1476 | chip_id = saa711x_read(client, 0) & 0x0f; |
1479 | 1477 | ||
1478 | /* Check whether this chip is part of the saa711x series */ | ||
1479 | if (memcmp(name, "1f711", 5)) { | ||
1480 | v4l_dbg(1, debug, client, "chip found @ 0x%x (ID %s) does not match a known saa711x chip.\n", | ||
1481 | address << 1, name); | ||
1482 | return 0; | ||
1483 | } | ||
1484 | |||
1480 | snprintf(client->name, sizeof(client->name) - 1, "saa711%d",chip_id); | 1485 | snprintf(client->name, sizeof(client->name) - 1, "saa711%d",chip_id); |
1481 | v4l_info(client, "saa711%d found (%s) @ 0x%x (%s)\n", chip_id, name, address << 1, adapter->name); | 1486 | v4l_info(client, "saa711%d found (%s) @ 0x%x (%s)\n", chip_id, name, address << 1, adapter->name); |
1482 | 1487 | ||
diff --git a/drivers/media/video/sn9c102/sn9c102_core.c b/drivers/media/video/sn9c102/sn9c102_core.c index a4702d3c2aca..42fb60d985b9 100644 --- a/drivers/media/video/sn9c102/sn9c102_core.c +++ b/drivers/media/video/sn9c102/sn9c102_core.c | |||
@@ -1462,8 +1462,6 @@ static void sn9c102_release_resources(struct sn9c102_device* cam) | |||
1462 | video_set_drvdata(cam->v4ldev, NULL); | 1462 | video_set_drvdata(cam->v4ldev, NULL); |
1463 | video_unregister_device(cam->v4ldev); | 1463 | video_unregister_device(cam->v4ldev); |
1464 | 1464 | ||
1465 | usb_put_dev(cam->usbdev); | ||
1466 | |||
1467 | mutex_unlock(&sn9c102_sysfs_lock); | 1465 | mutex_unlock(&sn9c102_sysfs_lock); |
1468 | 1466 | ||
1469 | kfree(cam->control_buffer); | 1467 | kfree(cam->control_buffer); |
@@ -1555,6 +1553,7 @@ static int sn9c102_release(struct inode* inode, struct file* filp) | |||
1555 | 1553 | ||
1556 | if (cam->state & DEV_DISCONNECTED) { | 1554 | if (cam->state & DEV_DISCONNECTED) { |
1557 | sn9c102_release_resources(cam); | 1555 | sn9c102_release_resources(cam); |
1556 | usb_put_dev(cam->usbdev); | ||
1558 | mutex_unlock(&cam->dev_mutex); | 1557 | mutex_unlock(&cam->dev_mutex); |
1559 | kfree(cam); | 1558 | kfree(cam); |
1560 | return 0; | 1559 | return 0; |
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c index 86b3bb9bec2d..92420f007b97 100644 --- a/drivers/net/hamradio/6pack.c +++ b/drivers/net/hamradio/6pack.c | |||
@@ -914,7 +914,7 @@ static void decode_prio_command(struct sixpack *sp, unsigned char cmd) | |||
914 | printk(KERN_DEBUG "6pack: protocol violation\n"); | 914 | printk(KERN_DEBUG "6pack: protocol violation\n"); |
915 | else | 915 | else |
916 | sp->status = 0; | 916 | sp->status = 0; |
917 | cmd &= !SIXP_RX_DCD_MASK; | 917 | cmd &= ~SIXP_RX_DCD_MASK; |
918 | } | 918 | } |
919 | sp->status = cmd & SIXP_PRIO_DATA_MASK; | 919 | sp->status = cmd & SIXP_PRIO_DATA_MASK; |
920 | } else { /* output watchdog char if idle */ | 920 | } else { /* output watchdog char if idle */ |
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 1dbdd6bb587b..c20bb998e0e5 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -6979,8 +6979,10 @@ static int tg3_open(struct net_device *dev) | |||
6979 | tg3_full_lock(tp, 0); | 6979 | tg3_full_lock(tp, 0); |
6980 | 6980 | ||
6981 | err = tg3_set_power_state(tp, PCI_D0); | 6981 | err = tg3_set_power_state(tp, PCI_D0); |
6982 | if (err) | 6982 | if (err) { |
6983 | tg3_full_unlock(tp); | ||
6983 | return err; | 6984 | return err; |
6985 | } | ||
6984 | 6986 | ||
6985 | tg3_disable_ints(tp); | 6987 | tg3_disable_ints(tp); |
6986 | tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE; | 6988 | tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE; |
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index a20d84d707d9..21d83a895b21 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -1272,7 +1272,9 @@ static void pcmcia_bus_remove_socket(struct class_device *class_dev, | |||
1272 | pccard_register_pcmcia(socket, NULL); | 1272 | pccard_register_pcmcia(socket, NULL); |
1273 | 1273 | ||
1274 | /* unregister any unbound devices */ | 1274 | /* unregister any unbound devices */ |
1275 | mutex_lock(&socket->skt_mutex); | ||
1275 | pcmcia_card_remove(socket, NULL); | 1276 | pcmcia_card_remove(socket, NULL); |
1277 | mutex_unlock(&socket->skt_mutex); | ||
1276 | 1278 | ||
1277 | pcmcia_put_socket(socket); | 1279 | pcmcia_put_socket(socket); |
1278 | 1280 | ||
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 579cd667b16f..6f11f6dfdd9d 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c | |||
@@ -145,6 +145,13 @@ int rtc_set_alarm(struct class_device *class_dev, struct rtc_wkalrm *alarm) | |||
145 | } | 145 | } |
146 | EXPORT_SYMBOL_GPL(rtc_set_alarm); | 146 | EXPORT_SYMBOL_GPL(rtc_set_alarm); |
147 | 147 | ||
148 | /** | ||
149 | * rtc_update_irq - report RTC periodic, alarm, and/or update irqs | ||
150 | * @class_dev: the rtc's class device | ||
151 | * @num: how many irqs are being reported (usually one) | ||
152 | * @events: mask of RTC_IRQF with one or more of RTC_PF, RTC_AF, RTC_UF | ||
153 | * Context: in_interrupt(), irqs blocked | ||
154 | */ | ||
148 | void rtc_update_irq(struct class_device *class_dev, | 155 | void rtc_update_irq(struct class_device *class_dev, |
149 | unsigned long num, unsigned long events) | 156 | unsigned long num, unsigned long events) |
150 | { | 157 | { |
@@ -201,12 +208,12 @@ int rtc_irq_register(struct class_device *class_dev, struct rtc_task *task) | |||
201 | if (task == NULL || task->func == NULL) | 208 | if (task == NULL || task->func == NULL) |
202 | return -EINVAL; | 209 | return -EINVAL; |
203 | 210 | ||
204 | spin_lock(&rtc->irq_task_lock); | 211 | spin_lock_irq(&rtc->irq_task_lock); |
205 | if (rtc->irq_task == NULL) { | 212 | if (rtc->irq_task == NULL) { |
206 | rtc->irq_task = task; | 213 | rtc->irq_task = task; |
207 | retval = 0; | 214 | retval = 0; |
208 | } | 215 | } |
209 | spin_unlock(&rtc->irq_task_lock); | 216 | spin_unlock_irq(&rtc->irq_task_lock); |
210 | 217 | ||
211 | return retval; | 218 | return retval; |
212 | } | 219 | } |
@@ -216,10 +223,10 @@ void rtc_irq_unregister(struct class_device *class_dev, struct rtc_task *task) | |||
216 | { | 223 | { |
217 | struct rtc_device *rtc = to_rtc_device(class_dev); | 224 | struct rtc_device *rtc = to_rtc_device(class_dev); |
218 | 225 | ||
219 | spin_lock(&rtc->irq_task_lock); | 226 | spin_lock_irq(&rtc->irq_task_lock); |
220 | if (rtc->irq_task == task) | 227 | if (rtc->irq_task == task) |
221 | rtc->irq_task = NULL; | 228 | rtc->irq_task = NULL; |
222 | spin_unlock(&rtc->irq_task_lock); | 229 | spin_unlock_irq(&rtc->irq_task_lock); |
223 | } | 230 | } |
224 | EXPORT_SYMBOL_GPL(rtc_irq_unregister); | 231 | EXPORT_SYMBOL_GPL(rtc_irq_unregister); |
225 | 232 | ||
@@ -265,3 +272,4 @@ int rtc_irq_set_freq(struct class_device *class_dev, struct rtc_task *task, int | |||
265 | } | 272 | } |
266 | return err; | 273 | return err; |
267 | } | 274 | } |
275 | EXPORT_SYMBOL_GPL(rtc_irq_set_freq); | ||
diff --git a/drivers/rtc/rtc-at91.c b/drivers/rtc/rtc-at91.c index bd61e99540a3..5c8addcaf1fb 100644 --- a/drivers/rtc/rtc-at91.c +++ b/drivers/rtc/rtc-at91.c | |||
@@ -292,7 +292,8 @@ static int __init at91_rtc_probe(struct platform_device *pdev) | |||
292 | AT91_RTC_CALEV); | 292 | AT91_RTC_CALEV); |
293 | 293 | ||
294 | ret = request_irq(AT91_ID_SYS, at91_rtc_interrupt, | 294 | ret = request_irq(AT91_ID_SYS, at91_rtc_interrupt, |
295 | IRQF_SHARED, "at91_rtc", pdev); | 295 | IRQF_DISABLED | IRQF_SHARED, |
296 | "at91_rtc", pdev); | ||
296 | if (ret) { | 297 | if (ret) { |
297 | printk(KERN_ERR "at91_rtc: IRQ %d already in use.\n", | 298 | printk(KERN_ERR "at91_rtc: IRQ %d already in use.\n", |
298 | AT91_ID_SYS); | 299 | AT91_ID_SYS); |
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c index 583789c66cdb..814b9e1873f5 100644 --- a/drivers/rtc/rtc-dev.c +++ b/drivers/rtc/rtc-dev.c | |||
@@ -61,7 +61,9 @@ static void rtc_uie_task(void *data) | |||
61 | int err; | 61 | int err; |
62 | 62 | ||
63 | err = rtc_read_time(&rtc->class_dev, &tm); | 63 | err = rtc_read_time(&rtc->class_dev, &tm); |
64 | spin_lock_irq(&rtc->irq_lock); | 64 | |
65 | local_irq_disable(); | ||
66 | spin_lock(&rtc->irq_lock); | ||
65 | if (rtc->stop_uie_polling || err) { | 67 | if (rtc->stop_uie_polling || err) { |
66 | rtc->uie_task_active = 0; | 68 | rtc->uie_task_active = 0; |
67 | } else if (rtc->oldsecs != tm.tm_sec) { | 69 | } else if (rtc->oldsecs != tm.tm_sec) { |
@@ -74,11 +76,11 @@ static void rtc_uie_task(void *data) | |||
74 | } else if (schedule_work(&rtc->uie_task) == 0) { | 76 | } else if (schedule_work(&rtc->uie_task) == 0) { |
75 | rtc->uie_task_active = 0; | 77 | rtc->uie_task_active = 0; |
76 | } | 78 | } |
77 | spin_unlock_irq(&rtc->irq_lock); | 79 | spin_unlock(&rtc->irq_lock); |
78 | if (num) | 80 | if (num) |
79 | rtc_update_irq(&rtc->class_dev, num, RTC_UF | RTC_IRQF); | 81 | rtc_update_irq(&rtc->class_dev, num, RTC_UF | RTC_IRQF); |
82 | local_irq_enable(); | ||
80 | } | 83 | } |
81 | |||
82 | static void rtc_uie_timer(unsigned long data) | 84 | static void rtc_uie_timer(unsigned long data) |
83 | { | 85 | { |
84 | struct rtc_device *rtc = (struct rtc_device *)data; | 86 | struct rtc_device *rtc = (struct rtc_device *)data; |
@@ -214,7 +216,7 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file, | |||
214 | struct rtc_wkalrm alarm; | 216 | struct rtc_wkalrm alarm; |
215 | void __user *uarg = (void __user *) arg; | 217 | void __user *uarg = (void __user *) arg; |
216 | 218 | ||
217 | /* check that the calles has appropriate permissions | 219 | /* check that the calling task has appropriate permissions |
218 | * for certain ioctls. doing this check here is useful | 220 | * for certain ioctls. doing this check here is useful |
219 | * to avoid duplicate code in each driver. | 221 | * to avoid duplicate code in each driver. |
220 | */ | 222 | */ |
@@ -238,10 +240,10 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file, | |||
238 | 240 | ||
239 | /* avoid conflicting IRQ users */ | 241 | /* avoid conflicting IRQ users */ |
240 | if (cmd == RTC_PIE_ON || cmd == RTC_PIE_OFF || cmd == RTC_IRQP_SET) { | 242 | if (cmd == RTC_PIE_ON || cmd == RTC_PIE_OFF || cmd == RTC_IRQP_SET) { |
241 | spin_lock(&rtc->irq_task_lock); | 243 | spin_lock_irq(&rtc->irq_task_lock); |
242 | if (rtc->irq_task) | 244 | if (rtc->irq_task) |
243 | err = -EBUSY; | 245 | err = -EBUSY; |
244 | spin_unlock(&rtc->irq_task_lock); | 246 | spin_unlock_irq(&rtc->irq_task_lock); |
245 | 247 | ||
246 | if (err < 0) | 248 | if (err < 0) |
247 | return err; | 249 | return err; |
@@ -299,6 +301,17 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file, | |||
299 | 301 | ||
300 | err = rtc_set_time(class_dev, &tm); | 302 | err = rtc_set_time(class_dev, &tm); |
301 | break; | 303 | break; |
304 | |||
305 | case RTC_IRQP_READ: | ||
306 | if (ops->irq_set_freq) | ||
307 | err = put_user(rtc->irq_freq, (unsigned long *) arg); | ||
308 | break; | ||
309 | |||
310 | case RTC_IRQP_SET: | ||
311 | if (ops->irq_set_freq) | ||
312 | err = rtc_irq_set_freq(class_dev, rtc->irq_task, arg); | ||
313 | break; | ||
314 | |||
302 | #if 0 | 315 | #if 0 |
303 | case RTC_EPOCH_SET: | 316 | case RTC_EPOCH_SET: |
304 | #ifndef rtc_epoch | 317 | #ifndef rtc_epoch |
diff --git a/drivers/rtc/rtc-ds1553.c b/drivers/rtc/rtc-ds1553.c index 78552e6e76aa..001eb1123a65 100644 --- a/drivers/rtc/rtc-ds1553.c +++ b/drivers/rtc/rtc-ds1553.c | |||
@@ -340,7 +340,8 @@ static int __init ds1553_rtc_probe(struct platform_device *pdev) | |||
340 | 340 | ||
341 | if (pdata->irq >= 0) { | 341 | if (pdata->irq >= 0) { |
342 | writeb(0, ioaddr + RTC_INTERRUPTS); | 342 | writeb(0, ioaddr + RTC_INTERRUPTS); |
343 | if (request_irq(pdata->irq, ds1553_rtc_interrupt, IRQF_SHARED, | 343 | if (request_irq(pdata->irq, ds1553_rtc_interrupt, |
344 | IRQF_DISABLED | IRQF_SHARED, | ||
344 | pdev->name, pdev) < 0) { | 345 | pdev->name, pdev) < 0) { |
345 | dev_warn(&pdev->dev, "interrupt not available.\n"); | 346 | dev_warn(&pdev->dev, "interrupt not available.\n"); |
346 | pdata->irq = -1; | 347 | pdata->irq = -1; |
diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c index 2a86632580f1..a44fe4efa216 100644 --- a/drivers/rtc/rtc-rs5c372.c +++ b/drivers/rtc/rtc-rs5c372.c | |||
@@ -126,13 +126,13 @@ static int rs5c372_get_trim(struct i2c_client *client, int *osc, int *trim) | |||
126 | return -EIO; | 126 | return -EIO; |
127 | } | 127 | } |
128 | 128 | ||
129 | dev_dbg(&client->dev, "%s: raw trim=%x\n", __FUNCTION__, *trim); | ||
130 | |||
131 | if (osc) | 129 | if (osc) |
132 | *osc = (buf & RS5C372_TRIM_XSL) ? 32000 : 32768; | 130 | *osc = (buf & RS5C372_TRIM_XSL) ? 32000 : 32768; |
133 | 131 | ||
134 | if (trim) | 132 | if (trim) { |
135 | *trim = buf & RS5C372_TRIM_MASK; | 133 | *trim = buf & RS5C372_TRIM_MASK; |
134 | dev_dbg(&client->dev, "%s: raw trim=%x\n", __FUNCTION__, *trim); | ||
135 | } | ||
136 | 136 | ||
137 | return 0; | 137 | return 0; |
138 | } | 138 | } |
diff --git a/drivers/rtc/rtc-test.c b/drivers/rtc/rtc-test.c index bc4bd24508a2..6ef9c62d5032 100644 --- a/drivers/rtc/rtc-test.c +++ b/drivers/rtc/rtc-test.c | |||
@@ -99,6 +99,7 @@ static ssize_t test_irq_store(struct device *dev, | |||
99 | struct rtc_device *rtc = platform_get_drvdata(plat_dev); | 99 | struct rtc_device *rtc = platform_get_drvdata(plat_dev); |
100 | 100 | ||
101 | retval = count; | 101 | retval = count; |
102 | local_irq_disable(); | ||
102 | if (strncmp(buf, "tick", 4) == 0) | 103 | if (strncmp(buf, "tick", 4) == 0) |
103 | rtc_update_irq(&rtc->class_dev, 1, RTC_PF | RTC_IRQF); | 104 | rtc_update_irq(&rtc->class_dev, 1, RTC_PF | RTC_IRQF); |
104 | else if (strncmp(buf, "alarm", 5) == 0) | 105 | else if (strncmp(buf, "alarm", 5) == 0) |
@@ -107,6 +108,7 @@ static ssize_t test_irq_store(struct device *dev, | |||
107 | rtc_update_irq(&rtc->class_dev, 1, RTC_UF | RTC_IRQF); | 108 | rtc_update_irq(&rtc->class_dev, 1, RTC_UF | RTC_IRQF); |
108 | else | 109 | else |
109 | retval = -EINVAL; | 110 | retval = -EINVAL; |
111 | local_irq_enable(); | ||
110 | 112 | ||
111 | return retval; | 113 | return retval; |
112 | } | 114 | } |
diff --git a/drivers/usb/input/ati_remote.c b/drivers/usb/input/ati_remote.c index f659f3028ad2..787b847d38cc 100644 --- a/drivers/usb/input/ati_remote.c +++ b/drivers/usb/input/ati_remote.c | |||
@@ -636,13 +636,11 @@ static void ati_remote_free_buffers(struct ati_remote *ati_remote) | |||
636 | if (ati_remote->out_urb) | 636 | if (ati_remote->out_urb) |
637 | usb_free_urb(ati_remote->out_urb); | 637 | usb_free_urb(ati_remote->out_urb); |
638 | 638 | ||
639 | if (ati_remote->inbuf) | 639 | usb_buffer_free(ati_remote->udev, DATA_BUFSIZE, |
640 | usb_buffer_free(ati_remote->udev, DATA_BUFSIZE, | 640 | ati_remote->inbuf, ati_remote->inbuf_dma); |
641 | ati_remote->inbuf, ati_remote->inbuf_dma); | ||
642 | 641 | ||
643 | if (ati_remote->outbuf) | 642 | usb_buffer_free(ati_remote->udev, DATA_BUFSIZE, |
644 | usb_buffer_free(ati_remote->udev, DATA_BUFSIZE, | 643 | ati_remote->outbuf, ati_remote->outbuf_dma); |
645 | ati_remote->inbuf, ati_remote->outbuf_dma); | ||
646 | } | 644 | } |
647 | 645 | ||
648 | static void ati_remote_input_init(struct ati_remote *ati_remote) | 646 | static void ati_remote_input_init(struct ati_remote *ati_remote) |
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index a736d44989c4..137d76c3f90a 100644 --- a/fs/debugfs/inode.c +++ b/fs/debugfs/inode.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/mount.h> | 21 | #include <linux/mount.h> |
22 | #include <linux/pagemap.h> | 22 | #include <linux/pagemap.h> |
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/kobject.h> | ||
24 | #include <linux/namei.h> | 25 | #include <linux/namei.h> |
25 | #include <linux/debugfs.h> | 26 | #include <linux/debugfs.h> |
26 | 27 | ||
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index cfc8f81e60d0..c71a6c092ad9 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
@@ -138,6 +138,7 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd) | |||
138 | struct fuse_entry_out outarg; | 138 | struct fuse_entry_out outarg; |
139 | struct fuse_conn *fc; | 139 | struct fuse_conn *fc; |
140 | struct fuse_req *req; | 140 | struct fuse_req *req; |
141 | struct fuse_req *forget_req; | ||
141 | struct dentry *parent; | 142 | struct dentry *parent; |
142 | 143 | ||
143 | /* Doesn't hurt to "reset" the validity timeout */ | 144 | /* Doesn't hurt to "reset" the validity timeout */ |
@@ -152,25 +153,33 @@ static int fuse_dentry_revalidate(struct dentry *entry, struct nameidata *nd) | |||
152 | if (IS_ERR(req)) | 153 | if (IS_ERR(req)) |
153 | return 0; | 154 | return 0; |
154 | 155 | ||
156 | forget_req = fuse_get_req(fc); | ||
157 | if (IS_ERR(forget_req)) { | ||
158 | fuse_put_request(fc, req); | ||
159 | return 0; | ||
160 | } | ||
161 | |||
155 | parent = dget_parent(entry); | 162 | parent = dget_parent(entry); |
156 | fuse_lookup_init(req, parent->d_inode, entry, &outarg); | 163 | fuse_lookup_init(req, parent->d_inode, entry, &outarg); |
157 | request_send(fc, req); | 164 | request_send(fc, req); |
158 | dput(parent); | 165 | dput(parent); |
159 | err = req->out.h.error; | 166 | err = req->out.h.error; |
167 | fuse_put_request(fc, req); | ||
160 | /* Zero nodeid is same as -ENOENT */ | 168 | /* Zero nodeid is same as -ENOENT */ |
161 | if (!err && !outarg.nodeid) | 169 | if (!err && !outarg.nodeid) |
162 | err = -ENOENT; | 170 | err = -ENOENT; |
163 | if (!err) { | 171 | if (!err) { |
164 | struct fuse_inode *fi = get_fuse_inode(inode); | 172 | struct fuse_inode *fi = get_fuse_inode(inode); |
165 | if (outarg.nodeid != get_node_id(inode)) { | 173 | if (outarg.nodeid != get_node_id(inode)) { |
166 | fuse_send_forget(fc, req, outarg.nodeid, 1); | 174 | fuse_send_forget(fc, forget_req, |
175 | outarg.nodeid, 1); | ||
167 | return 0; | 176 | return 0; |
168 | } | 177 | } |
169 | spin_lock(&fc->lock); | 178 | spin_lock(&fc->lock); |
170 | fi->nlookup ++; | 179 | fi->nlookup ++; |
171 | spin_unlock(&fc->lock); | 180 | spin_unlock(&fc->lock); |
172 | } | 181 | } |
173 | fuse_put_request(fc, req); | 182 | fuse_put_request(fc, forget_req); |
174 | if (err || (outarg.attr.mode ^ inode->i_mode) & S_IFMT) | 183 | if (err || (outarg.attr.mode ^ inode->i_mode) & S_IFMT) |
175 | return 0; | 184 | return 0; |
176 | 185 | ||
@@ -221,6 +230,7 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry, | |||
221 | struct inode *inode = NULL; | 230 | struct inode *inode = NULL; |
222 | struct fuse_conn *fc = get_fuse_conn(dir); | 231 | struct fuse_conn *fc = get_fuse_conn(dir); |
223 | struct fuse_req *req; | 232 | struct fuse_req *req; |
233 | struct fuse_req *forget_req; | ||
224 | 234 | ||
225 | if (entry->d_name.len > FUSE_NAME_MAX) | 235 | if (entry->d_name.len > FUSE_NAME_MAX) |
226 | return ERR_PTR(-ENAMETOOLONG); | 236 | return ERR_PTR(-ENAMETOOLONG); |
@@ -229,9 +239,16 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry, | |||
229 | if (IS_ERR(req)) | 239 | if (IS_ERR(req)) |
230 | return ERR_PTR(PTR_ERR(req)); | 240 | return ERR_PTR(PTR_ERR(req)); |
231 | 241 | ||
242 | forget_req = fuse_get_req(fc); | ||
243 | if (IS_ERR(forget_req)) { | ||
244 | fuse_put_request(fc, req); | ||
245 | return ERR_PTR(PTR_ERR(forget_req)); | ||
246 | } | ||
247 | |||
232 | fuse_lookup_init(req, dir, entry, &outarg); | 248 | fuse_lookup_init(req, dir, entry, &outarg); |
233 | request_send(fc, req); | 249 | request_send(fc, req); |
234 | err = req->out.h.error; | 250 | err = req->out.h.error; |
251 | fuse_put_request(fc, req); | ||
235 | /* Zero nodeid is same as -ENOENT, but with valid timeout */ | 252 | /* Zero nodeid is same as -ENOENT, but with valid timeout */ |
236 | if (!err && outarg.nodeid && | 253 | if (!err && outarg.nodeid && |
237 | (invalid_nodeid(outarg.nodeid) || !valid_mode(outarg.attr.mode))) | 254 | (invalid_nodeid(outarg.nodeid) || !valid_mode(outarg.attr.mode))) |
@@ -240,11 +257,11 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry, | |||
240 | inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation, | 257 | inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation, |
241 | &outarg.attr); | 258 | &outarg.attr); |
242 | if (!inode) { | 259 | if (!inode) { |
243 | fuse_send_forget(fc, req, outarg.nodeid, 1); | 260 | fuse_send_forget(fc, forget_req, outarg.nodeid, 1); |
244 | return ERR_PTR(-ENOMEM); | 261 | return ERR_PTR(-ENOMEM); |
245 | } | 262 | } |
246 | } | 263 | } |
247 | fuse_put_request(fc, req); | 264 | fuse_put_request(fc, forget_req); |
248 | if (err && err != -ENOENT) | 265 | if (err && err != -ENOENT) |
249 | return ERR_PTR(err); | 266 | return ERR_PTR(err); |
250 | 267 | ||
@@ -388,6 +405,13 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req, | |||
388 | struct fuse_entry_out outarg; | 405 | struct fuse_entry_out outarg; |
389 | struct inode *inode; | 406 | struct inode *inode; |
390 | int err; | 407 | int err; |
408 | struct fuse_req *forget_req; | ||
409 | |||
410 | forget_req = fuse_get_req(fc); | ||
411 | if (IS_ERR(forget_req)) { | ||
412 | fuse_put_request(fc, req); | ||
413 | return PTR_ERR(forget_req); | ||
414 | } | ||
391 | 415 | ||
392 | req->in.h.nodeid = get_node_id(dir); | 416 | req->in.h.nodeid = get_node_id(dir); |
393 | req->out.numargs = 1; | 417 | req->out.numargs = 1; |
@@ -395,24 +419,24 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req, | |||
395 | req->out.args[0].value = &outarg; | 419 | req->out.args[0].value = &outarg; |
396 | request_send(fc, req); | 420 | request_send(fc, req); |
397 | err = req->out.h.error; | 421 | err = req->out.h.error; |
398 | if (err) { | 422 | fuse_put_request(fc, req); |
399 | fuse_put_request(fc, req); | 423 | if (err) |
400 | return err; | 424 | goto out_put_forget_req; |
401 | } | 425 | |
402 | err = -EIO; | 426 | err = -EIO; |
403 | if (invalid_nodeid(outarg.nodeid)) | 427 | if (invalid_nodeid(outarg.nodeid)) |
404 | goto out_put_request; | 428 | goto out_put_forget_req; |
405 | 429 | ||
406 | if ((outarg.attr.mode ^ mode) & S_IFMT) | 430 | if ((outarg.attr.mode ^ mode) & S_IFMT) |
407 | goto out_put_request; | 431 | goto out_put_forget_req; |
408 | 432 | ||
409 | inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation, | 433 | inode = fuse_iget(dir->i_sb, outarg.nodeid, outarg.generation, |
410 | &outarg.attr); | 434 | &outarg.attr); |
411 | if (!inode) { | 435 | if (!inode) { |
412 | fuse_send_forget(fc, req, outarg.nodeid, 1); | 436 | fuse_send_forget(fc, forget_req, outarg.nodeid, 1); |
413 | return -ENOMEM; | 437 | return -ENOMEM; |
414 | } | 438 | } |
415 | fuse_put_request(fc, req); | 439 | fuse_put_request(fc, forget_req); |
416 | 440 | ||
417 | if (S_ISDIR(inode->i_mode)) { | 441 | if (S_ISDIR(inode->i_mode)) { |
418 | struct dentry *alias; | 442 | struct dentry *alias; |
@@ -434,8 +458,8 @@ static int create_new_entry(struct fuse_conn *fc, struct fuse_req *req, | |||
434 | fuse_invalidate_attr(dir); | 458 | fuse_invalidate_attr(dir); |
435 | return 0; | 459 | return 0; |
436 | 460 | ||
437 | out_put_request: | 461 | out_put_forget_req: |
438 | fuse_put_request(fc, req); | 462 | fuse_put_request(fc, forget_req); |
439 | return err; | 463 | return err; |
440 | } | 464 | } |
441 | 465 | ||
diff --git a/fs/proc/base.c b/fs/proc/base.c index 8df27401d292..795319c54f72 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -442,7 +442,8 @@ static int mountstats_open(struct inode *inode, struct file *file) | |||
442 | 442 | ||
443 | if (task) { | 443 | if (task) { |
444 | task_lock(task); | 444 | task_lock(task); |
445 | namespace = task->nsproxy->namespace; | 445 | if (task->nsproxy) |
446 | namespace = task->nsproxy->namespace; | ||
446 | if (namespace) | 447 | if (namespace) |
447 | get_namespace(namespace); | 448 | get_namespace(namespace); |
448 | task_unlock(task); | 449 | task_unlock(task); |
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c index b67ce9354048..ac14318c81ba 100644 --- a/fs/reiserfs/file.c +++ b/fs/reiserfs/file.c | |||
@@ -74,7 +74,8 @@ static int reiserfs_file_release(struct inode *inode, struct file *filp) | |||
74 | igrab(inode); | 74 | igrab(inode); |
75 | reiserfs_warning(inode->i_sb, | 75 | reiserfs_warning(inode->i_sb, |
76 | "pinning inode %lu because the " | 76 | "pinning inode %lu because the " |
77 | "preallocation can't be freed"); | 77 | "preallocation can't be freed", |
78 | inode->i_ino); | ||
78 | goto out; | 79 | goto out; |
79 | } | 80 | } |
80 | } | 81 | } |
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c index 5b050c06795f..498ad50d1f45 100644 --- a/fs/xfs/xfs_bmap.c +++ b/fs/xfs/xfs_bmap.c | |||
@@ -1171,6 +1171,8 @@ xfs_bmap_add_extent_delay_real( | |||
1171 | xfs_bmap_trace_pre_update(fname, "0", ip, idx, XFS_DATA_FORK); | 1171 | xfs_bmap_trace_pre_update(fname, "0", ip, idx, XFS_DATA_FORK); |
1172 | xfs_bmbt_set_blockcount(ep, temp); | 1172 | xfs_bmbt_set_blockcount(ep, temp); |
1173 | r[0] = *new; | 1173 | r[0] = *new; |
1174 | r[1].br_state = PREV.br_state; | ||
1175 | r[1].br_startblock = 0; | ||
1174 | r[1].br_startoff = new_endoff; | 1176 | r[1].br_startoff = new_endoff; |
1175 | temp2 = PREV.br_startoff + PREV.br_blockcount - new_endoff; | 1177 | temp2 = PREV.br_startoff + PREV.br_blockcount - new_endoff; |
1176 | r[1].br_blockcount = temp2; | 1178 | r[1].br_blockcount = temp2; |
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index d72c80dbfbb1..44dfac521285 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -2258,7 +2258,7 @@ xfs_ifree_cluster( | |||
2258 | AIL_LOCK(mp,s); | 2258 | AIL_LOCK(mp,s); |
2259 | iip->ili_flush_lsn = iip->ili_item.li_lsn; | 2259 | iip->ili_flush_lsn = iip->ili_item.li_lsn; |
2260 | AIL_UNLOCK(mp, s); | 2260 | AIL_UNLOCK(mp, s); |
2261 | xfs_iflags_set(ip, XFS_ISTALE); | 2261 | xfs_iflags_set(iip->ili_inode, XFS_ISTALE); |
2262 | pre_flushed++; | 2262 | pre_flushed++; |
2263 | } | 2263 | } |
2264 | lip = lip->li_bio_list; | 2264 | lip = lip->li_bio_list; |
diff --git a/include/asm-arm/arch-ebsa110/io.h b/include/asm-arm/arch-ebsa110/io.h index ae048441c9ed..722c5e086285 100644 --- a/include/asm-arm/arch-ebsa110/io.h +++ b/include/asm-arm/arch-ebsa110/io.h | |||
@@ -27,9 +27,9 @@ void __outw(u16 val, unsigned int port); | |||
27 | u32 __inl(unsigned int port); | 27 | u32 __inl(unsigned int port); |
28 | void __outl(u32 val, unsigned int port); | 28 | void __outl(u32 val, unsigned int port); |
29 | 29 | ||
30 | u8 __readb(void __iomem *addr); | 30 | u8 __readb(const volatile void __iomem *addr); |
31 | u16 __readw(void __iomem *addr); | 31 | u16 __readw(const volatile void __iomem *addr); |
32 | u32 __readl(void __iomem *addr); | 32 | u32 __readl(const volatile void __iomem *addr); |
33 | 33 | ||
34 | void __writeb(u8 val, void __iomem *addr); | 34 | void __writeb(u8 val, void __iomem *addr); |
35 | void __writew(u16 val, void __iomem *addr); | 35 | void __writew(u16 val, void __iomem *addr); |
@@ -64,8 +64,14 @@ void __writel(u32 val, void __iomem *addr); | |||
64 | #define writew(v,b) __writew(v,b) | 64 | #define writew(v,b) __writew(v,b) |
65 | #define writel(v,b) __writel(v,b) | 65 | #define writel(v,b) __writel(v,b) |
66 | 66 | ||
67 | #define __arch_ioremap(cookie,sz,c) ((void __iomem *)(cookie)) | 67 | static inline void __iomem *__arch_ioremap(unsigned long cookie, size_t size, |
68 | #define __arch_iounmap(cookie) do { } while (0) | 68 | unsigned int flags) |
69 | { | ||
70 | return (void __iomem *)cookie; | ||
71 | } | ||
72 | |||
73 | #define __arch_ioremap __arch_ioremap | ||
74 | #define __arch_iounmap(cookie) do { } while (0) | ||
69 | 75 | ||
70 | extern void insb(unsigned int port, void *buf, int sz); | 76 | extern void insb(unsigned int port, void *buf, int sz); |
71 | extern void insw(unsigned int port, void *buf, int sz); | 77 | extern void insw(unsigned int port, void *buf, int sz); |
diff --git a/include/asm-arm/dma-mapping.h b/include/asm-arm/dma-mapping.h index 55eb4dc3253d..666617711c81 100644 --- a/include/asm-arm/dma-mapping.h +++ b/include/asm-arm/dma-mapping.h | |||
@@ -12,6 +12,10 @@ | |||
12 | * uncached, unwrite-buffered mapped memory space for use with DMA | 12 | * uncached, unwrite-buffered mapped memory space for use with DMA |
13 | * devices. This is the "generic" version. The PCI specific version | 13 | * devices. This is the "generic" version. The PCI specific version |
14 | * is in pci.h | 14 | * is in pci.h |
15 | * | ||
16 | * Note: Drivers should NOT use this function directly, as it will break | ||
17 | * platforms with CONFIG_DMABOUNCE. | ||
18 | * Use the driver DMA support - see dma-mapping.h (dma_sync_*) | ||
15 | */ | 19 | */ |
16 | extern void consistent_sync(void *kaddr, size_t size, int rw); | 20 | extern void consistent_sync(void *kaddr, size_t size, int rw); |
17 | 21 | ||
diff --git a/include/asm-mips/mach-au1x00/au1xxx_ide.h b/include/asm-mips/mach-au1x00/au1xxx_ide.h index 301e71300779..e9fa252f8a3f 100644 --- a/include/asm-mips/mach-au1x00/au1xxx_ide.h +++ b/include/asm-mips/mach-au1x00/au1xxx_ide.h | |||
@@ -170,10 +170,8 @@ int __init auide_probe(void); | |||
170 | static int auide_dma_host_on(ide_drive_t *drive); | 170 | static int auide_dma_host_on(ide_drive_t *drive); |
171 | static int auide_dma_lostirq(ide_drive_t *drive); | 171 | static int auide_dma_lostirq(ide_drive_t *drive); |
172 | static int auide_dma_on(ide_drive_t *drive); | 172 | static int auide_dma_on(ide_drive_t *drive); |
173 | static void auide_ddma_tx_callback(int irq, void *param, | 173 | static void auide_ddma_tx_callback(int irq, void *param); |
174 | struct pt_regs *regs); | 174 | static void auide_ddma_rx_callback(int irq, void *param); |
175 | static void auide_ddma_rx_callback(int irq, void *param, | ||
176 | struct pt_regs *regs); | ||
177 | static int auide_dma_off_quietly(ide_drive_t *drive); | 175 | static int auide_dma_off_quietly(ide_drive_t *drive); |
178 | #endif /* end CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */ | 176 | #endif /* end CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA */ |
179 | 177 | ||
diff --git a/include/asm-parisc/semaphore.h b/include/asm-parisc/semaphore.h index c9ee41cd0707..d45827a21f94 100644 --- a/include/asm-parisc/semaphore.h +++ b/include/asm-parisc/semaphore.h | |||
@@ -115,7 +115,8 @@ extern __inline__ int down_interruptible(struct semaphore * sem) | |||
115 | */ | 115 | */ |
116 | extern __inline__ int down_trylock(struct semaphore * sem) | 116 | extern __inline__ int down_trylock(struct semaphore * sem) |
117 | { | 117 | { |
118 | int flags, count; | 118 | unsigned long flags; |
119 | int count; | ||
119 | 120 | ||
120 | spin_lock_irqsave(&sem->sentry, flags); | 121 | spin_lock_irqsave(&sem->sentry, flags); |
121 | count = sem->count - 1; | 122 | count = sem->count - 1; |
@@ -131,7 +132,8 @@ extern __inline__ int down_trylock(struct semaphore * sem) | |||
131 | */ | 132 | */ |
132 | extern __inline__ void up(struct semaphore * sem) | 133 | extern __inline__ void up(struct semaphore * sem) |
133 | { | 134 | { |
134 | int flags; | 135 | unsigned long flags; |
136 | |||
135 | spin_lock_irqsave(&sem->sentry, flags); | 137 | spin_lock_irqsave(&sem->sentry, flags); |
136 | if (sem->count < 0) { | 138 | if (sem->count < 0) { |
137 | __up(sem); | 139 | __up(sem); |
diff --git a/include/asm-powerpc/time.h b/include/asm-powerpc/time.h index a78285010d62..4cff977ad526 100644 --- a/include/asm-powerpc/time.h +++ b/include/asm-powerpc/time.h | |||
@@ -39,10 +39,6 @@ extern void generic_calibrate_decr(void); | |||
39 | extern void wakeup_decrementer(void); | 39 | extern void wakeup_decrementer(void); |
40 | extern void snapshot_timebase(void); | 40 | extern void snapshot_timebase(void); |
41 | 41 | ||
42 | #ifdef CONFIG_RTC_CLASS | ||
43 | extern int __init rtc_class_hookup(void); | ||
44 | #endif | ||
45 | |||
46 | /* Some sane defaults: 125 MHz timebase, 1GHz processor */ | 42 | /* Some sane defaults: 125 MHz timebase, 1GHz processor */ |
47 | extern unsigned long ppc_proc_freq; | 43 | extern unsigned long ppc_proc_freq; |
48 | #define DEFAULT_PROC_FREQ (DEFAULT_TB_FREQ * 8) | 44 | #define DEFAULT_PROC_FREQ (DEFAULT_TB_FREQ * 8) |
diff --git a/include/linux/igmp.h b/include/linux/igmp.h index 03f43e2893a4..21dd56905271 100644 --- a/include/linux/igmp.h +++ b/include/linux/igmp.h | |||
@@ -191,7 +191,7 @@ struct ip_mc_list | |||
191 | #define IGMPV3_MASK(value, nb) ((nb)>=32 ? (value) : ((1<<(nb))-1) & (value)) | 191 | #define IGMPV3_MASK(value, nb) ((nb)>=32 ? (value) : ((1<<(nb))-1) & (value)) |
192 | #define IGMPV3_EXP(thresh, nbmant, nbexp, value) \ | 192 | #define IGMPV3_EXP(thresh, nbmant, nbexp, value) \ |
193 | ((value) < (thresh) ? (value) : \ | 193 | ((value) < (thresh) ? (value) : \ |
194 | ((IGMPV3_MASK(value, nbmant) | (1<<(nbmant+nbexp))) << \ | 194 | ((IGMPV3_MASK(value, nbmant) | (1<<(nbmant))) << \ |
195 | (IGMPV3_MASK((value) >> (nbmant), nbexp) + (nbexp)))) | 195 | (IGMPV3_MASK((value) >> (nbmant), nbexp) + (nbexp)))) |
196 | 196 | ||
197 | #define IGMPV3_QQIC(value) IGMPV3_EXP(0x80, 4, 3, value) | 197 | #define IGMPV3_QQIC(value) IGMPV3_EXP(0x80, 4, 3, value) |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 24b611147adb..b9b5e4ba166a 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -30,8 +30,10 @@ extern const char linux_banner[]; | |||
30 | 30 | ||
31 | #define STACK_MAGIC 0xdeadbeef | 31 | #define STACK_MAGIC 0xdeadbeef |
32 | 32 | ||
33 | #define ALIGN(x,a) __ALIGN_MASK(x,(typeof(x))(a)-1) | ||
34 | #define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) | ||
35 | |||
33 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) | 36 | #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) |
34 | #define ALIGN(x,a) (((x)+(a)-1UL)&~((a)-1UL)) | ||
35 | #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) | 37 | #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) |
36 | #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) | 38 | #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d)) |
37 | #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) | 39 | #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y)) |
diff --git a/include/linux/nsproxy.h b/include/linux/nsproxy.h index f6baecdeecd6..971d1c6dfc4b 100644 --- a/include/linux/nsproxy.h +++ b/include/linux/nsproxy.h | |||
@@ -45,8 +45,10 @@ static inline void exit_task_namespaces(struct task_struct *p) | |||
45 | { | 45 | { |
46 | struct nsproxy *ns = p->nsproxy; | 46 | struct nsproxy *ns = p->nsproxy; |
47 | if (ns) { | 47 | if (ns) { |
48 | put_nsproxy(ns); | 48 | task_lock(p); |
49 | p->nsproxy = NULL; | 49 | p->nsproxy = NULL; |
50 | task_unlock(p); | ||
51 | put_nsproxy(ns); | ||
50 | } | 52 | } |
51 | } | 53 | } |
52 | #endif | 54 | #endif |
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index b800d2d68b32..8451052ca66f 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h | |||
@@ -183,13 +183,27 @@ do { \ | |||
183 | #define read_lock(lock) _read_lock(lock) | 183 | #define read_lock(lock) _read_lock(lock) |
184 | 184 | ||
185 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | 185 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) |
186 | |||
186 | #define spin_lock_irqsave(lock, flags) flags = _spin_lock_irqsave(lock) | 187 | #define spin_lock_irqsave(lock, flags) flags = _spin_lock_irqsave(lock) |
187 | #define read_lock_irqsave(lock, flags) flags = _read_lock_irqsave(lock) | 188 | #define read_lock_irqsave(lock, flags) flags = _read_lock_irqsave(lock) |
188 | #define write_lock_irqsave(lock, flags) flags = _write_lock_irqsave(lock) | 189 | #define write_lock_irqsave(lock, flags) flags = _write_lock_irqsave(lock) |
190 | |||
191 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
192 | #define spin_lock_irqsave_nested(lock, flags, subclass) \ | ||
193 | flags = _spin_lock_irqsave_nested(lock, subclass) | ||
194 | #else | ||
195 | #define spin_lock_irqsave_nested(lock, flags, subclass) \ | ||
196 | flags = _spin_lock_irqsave(lock) | ||
197 | #endif | ||
198 | |||
189 | #else | 199 | #else |
200 | |||
190 | #define spin_lock_irqsave(lock, flags) _spin_lock_irqsave(lock, flags) | 201 | #define spin_lock_irqsave(lock, flags) _spin_lock_irqsave(lock, flags) |
191 | #define read_lock_irqsave(lock, flags) _read_lock_irqsave(lock, flags) | 202 | #define read_lock_irqsave(lock, flags) _read_lock_irqsave(lock, flags) |
192 | #define write_lock_irqsave(lock, flags) _write_lock_irqsave(lock, flags) | 203 | #define write_lock_irqsave(lock, flags) _write_lock_irqsave(lock, flags) |
204 | #define spin_lock_irqsave_nested(lock, flags, subclass) \ | ||
205 | spin_lock_irqsave(lock, flags) | ||
206 | |||
193 | #endif | 207 | #endif |
194 | 208 | ||
195 | #define spin_lock_irq(lock) _spin_lock_irq(lock) | 209 | #define spin_lock_irq(lock) _spin_lock_irq(lock) |
diff --git a/include/linux/spinlock_api_smp.h b/include/linux/spinlock_api_smp.h index 8828b8155e9c..8a2307ce7296 100644 --- a/include/linux/spinlock_api_smp.h +++ b/include/linux/spinlock_api_smp.h | |||
@@ -32,6 +32,8 @@ void __lockfunc _read_lock_irq(rwlock_t *lock) __acquires(lock); | |||
32 | void __lockfunc _write_lock_irq(rwlock_t *lock) __acquires(lock); | 32 | void __lockfunc _write_lock_irq(rwlock_t *lock) __acquires(lock); |
33 | unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock) | 33 | unsigned long __lockfunc _spin_lock_irqsave(spinlock_t *lock) |
34 | __acquires(lock); | 34 | __acquires(lock); |
35 | unsigned long __lockfunc _spin_lock_irqsave_nested(spinlock_t *lock, int subclass) | ||
36 | __acquires(lock); | ||
35 | unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock) | 37 | unsigned long __lockfunc _read_lock_irqsave(rwlock_t *lock) |
36 | __acquires(lock); | 38 | __acquires(lock); |
37 | unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock) | 39 | unsigned long __lockfunc _write_lock_irqsave(rwlock_t *lock) |
diff --git a/include/net/sock.h b/include/net/sock.h index ac286a353032..9cdbae2a53a3 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -883,18 +883,23 @@ static inline int sk_filter(struct sock *sk, struct sk_buff *skb) | |||
883 | } | 883 | } |
884 | 884 | ||
885 | /** | 885 | /** |
886 | * sk_filter_release: Release a socket filter | 886 | * sk_filter_rcu_free: Free a socket filter |
887 | * @rcu: rcu_head that contains the sk_filter info to remove | 887 | * @rcu: rcu_head that contains the sk_filter to free |
888 | * | ||
889 | * Remove a filter from a socket and release its resources. | ||
890 | */ | 888 | */ |
891 | |||
892 | static inline void sk_filter_rcu_free(struct rcu_head *rcu) | 889 | static inline void sk_filter_rcu_free(struct rcu_head *rcu) |
893 | { | 890 | { |
894 | struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu); | 891 | struct sk_filter *fp = container_of(rcu, struct sk_filter, rcu); |
895 | kfree(fp); | 892 | kfree(fp); |
896 | } | 893 | } |
897 | 894 | ||
895 | /** | ||
896 | * sk_filter_release: Release a socket filter | ||
897 | * @sk: socket | ||
898 | * @fp: filter to remove | ||
899 | * | ||
900 | * Remove a filter from a socket and release its resources. | ||
901 | */ | ||
902 | |||
898 | static inline void sk_filter_release(struct sock *sk, struct sk_filter *fp) | 903 | static inline void sk_filter_release(struct sock *sk, struct sk_filter *fp) |
899 | { | 904 | { |
900 | unsigned int size = sk_filter_len(fp); | 905 | unsigned int size = sk_filter_len(fp); |
diff --git a/kernel/fork.c b/kernel/fork.c index 3da978eec791..8cdd3e72ba55 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -1315,9 +1315,8 @@ struct task_struct * __devinit fork_idle(int cpu) | |||
1315 | struct pt_regs regs; | 1315 | struct pt_regs regs; |
1316 | 1316 | ||
1317 | task = copy_process(CLONE_VM, 0, idle_regs(®s), 0, NULL, NULL, 0); | 1317 | task = copy_process(CLONE_VM, 0, idle_regs(®s), 0, NULL, NULL, 0); |
1318 | if (!task) | 1318 | if (!IS_ERR(task)) |
1319 | return ERR_PTR(-ENOMEM); | 1319 | init_idle(task, cpu); |
1320 | init_idle(task, cpu); | ||
1321 | 1320 | ||
1322 | return task; | 1321 | return task; |
1323 | } | 1322 | } |
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c index 42aa6f1a3f0f..a681912bc89a 100644 --- a/kernel/irq/handle.c +++ b/kernel/irq/handle.c | |||
@@ -231,10 +231,10 @@ fastcall unsigned int __do_IRQ(unsigned int irq) | |||
231 | spin_unlock(&desc->lock); | 231 | spin_unlock(&desc->lock); |
232 | 232 | ||
233 | action_ret = handle_IRQ_event(irq, action); | 233 | action_ret = handle_IRQ_event(irq, action); |
234 | |||
235 | spin_lock(&desc->lock); | ||
236 | if (!noirqdebug) | 234 | if (!noirqdebug) |
237 | note_interrupt(irq, desc, action_ret); | 235 | note_interrupt(irq, desc, action_ret); |
236 | |||
237 | spin_lock(&desc->lock); | ||
238 | if (likely(!(desc->status & IRQ_PENDING))) | 238 | if (likely(!(desc->status & IRQ_PENDING))) |
239 | break; | 239 | break; |
240 | desc->status &= ~IRQ_PENDING; | 240 | desc->status &= ~IRQ_PENDING; |
diff --git a/kernel/irq/spurious.c b/kernel/irq/spurious.c index 9c7e2e4c1fe7..543ea2e5ad93 100644 --- a/kernel/irq/spurious.c +++ b/kernel/irq/spurious.c | |||
@@ -147,11 +147,7 @@ void note_interrupt(unsigned int irq, struct irq_desc *desc, | |||
147 | if (unlikely(irqfixup)) { | 147 | if (unlikely(irqfixup)) { |
148 | /* Don't punish working computers */ | 148 | /* Don't punish working computers */ |
149 | if ((irqfixup == 2 && irq == 0) || action_ret == IRQ_NONE) { | 149 | if ((irqfixup == 2 && irq == 0) || action_ret == IRQ_NONE) { |
150 | int ok; | 150 | int ok = misrouted_irq(irq); |
151 | |||
152 | spin_unlock(&desc->lock); | ||
153 | ok = misrouted_irq(irq); | ||
154 | spin_lock(&desc->lock); | ||
155 | if (action_ret == IRQ_NONE) | 151 | if (action_ret == IRQ_NONE) |
156 | desc->irqs_unhandled -= ok; | 152 | desc->irqs_unhandled -= ok; |
157 | } | 153 | } |
diff --git a/kernel/spinlock.c b/kernel/spinlock.c index 476c3741511b..2c6c2bf85514 100644 --- a/kernel/spinlock.c +++ b/kernel/spinlock.c | |||
@@ -293,6 +293,27 @@ void __lockfunc _spin_lock_nested(spinlock_t *lock, int subclass) | |||
293 | } | 293 | } |
294 | 294 | ||
295 | EXPORT_SYMBOL(_spin_lock_nested); | 295 | EXPORT_SYMBOL(_spin_lock_nested); |
296 | unsigned long __lockfunc _spin_lock_irqsave_nested(spinlock_t *lock, int subclass) | ||
297 | { | ||
298 | unsigned long flags; | ||
299 | |||
300 | local_irq_save(flags); | ||
301 | preempt_disable(); | ||
302 | spin_acquire(&lock->dep_map, subclass, 0, _RET_IP_); | ||
303 | /* | ||
304 | * On lockdep we dont want the hand-coded irq-enable of | ||
305 | * _raw_spin_lock_flags() code, because lockdep assumes | ||
306 | * that interrupts are not re-enabled during lock-acquire: | ||
307 | */ | ||
308 | #ifdef CONFIG_PROVE_SPIN_LOCKING | ||
309 | _raw_spin_lock(lock); | ||
310 | #else | ||
311 | _raw_spin_lock_flags(lock, &flags); | ||
312 | #endif | ||
313 | return flags; | ||
314 | } | ||
315 | |||
316 | EXPORT_SYMBOL(_spin_lock_irqsave_nested); | ||
296 | 317 | ||
297 | #endif | 318 | #endif |
298 | 319 | ||
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index bf2f6cff1d6a..aa6fcc7ca66f 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -2612,6 +2612,9 @@ unsigned long __init find_min_pfn_for_node(unsigned long nid) | |||
2612 | { | 2612 | { |
2613 | int i; | 2613 | int i; |
2614 | 2614 | ||
2615 | /* Regions in the early_node_map can be in any order */ | ||
2616 | sort_node_map(); | ||
2617 | |||
2615 | /* Assuming a sorted map, the first range found has the starting pfn */ | 2618 | /* Assuming a sorted map, the first range found has the starting pfn */ |
2616 | for_each_active_range_index_in_nid(i, nid) | 2619 | for_each_active_range_index_in_nid(i, nid) |
2617 | return early_node_map[i].start_pfn; | 2620 | return early_node_map[i].start_pfn; |
@@ -2680,9 +2683,6 @@ void __init free_area_init_nodes(unsigned long *max_zone_pfn) | |||
2680 | max(max_zone_pfn[i], arch_zone_lowest_possible_pfn[i]); | 2683 | max(max_zone_pfn[i], arch_zone_lowest_possible_pfn[i]); |
2681 | } | 2684 | } |
2682 | 2685 | ||
2683 | /* Regions in the early_node_map can be in any order */ | ||
2684 | sort_node_map(); | ||
2685 | |||
2686 | /* Print out the zone ranges */ | 2686 | /* Print out the zone ranges */ |
2687 | printk("Zone PFN ranges:\n"); | 2687 | printk("Zone PFN ranges:\n"); |
2688 | for (i = 0; i < MAX_NR_ZONES; i++) | 2688 | for (i = 0; i < MAX_NR_ZONES; i++) |
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 65f094845719..bb94e6da223c 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -57,6 +57,7 @@ | |||
57 | static void hci_cc_link_ctl(struct hci_dev *hdev, __u16 ocf, struct sk_buff *skb) | 57 | static void hci_cc_link_ctl(struct hci_dev *hdev, __u16 ocf, struct sk_buff *skb) |
58 | { | 58 | { |
59 | __u8 status; | 59 | __u8 status; |
60 | struct hci_conn *pend; | ||
60 | 61 | ||
61 | BT_DBG("%s ocf 0x%x", hdev->name, ocf); | 62 | BT_DBG("%s ocf 0x%x", hdev->name, ocf); |
62 | 63 | ||
@@ -71,6 +72,15 @@ static void hci_cc_link_ctl(struct hci_dev *hdev, __u16 ocf, struct sk_buff *skb | |||
71 | clear_bit(HCI_INQUIRY, &hdev->flags); | 72 | clear_bit(HCI_INQUIRY, &hdev->flags); |
72 | hci_req_complete(hdev, status); | 73 | hci_req_complete(hdev, status); |
73 | } | 74 | } |
75 | |||
76 | hci_dev_lock(hdev); | ||
77 | |||
78 | pend = hci_conn_hash_lookup_state(hdev, ACL_LINK, BT_CONNECT2); | ||
79 | if (pend) | ||
80 | hci_acl_connect(pend); | ||
81 | |||
82 | hci_dev_unlock(hdev); | ||
83 | |||
74 | break; | 84 | break; |
75 | 85 | ||
76 | default: | 86 | default: |
@@ -565,11 +575,20 @@ static void hci_cs_info_param(struct hci_dev *hdev, __u16 ocf, __u8 status) | |||
565 | static inline void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | 575 | static inline void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) |
566 | { | 576 | { |
567 | __u8 status = *((__u8 *) skb->data); | 577 | __u8 status = *((__u8 *) skb->data); |
578 | struct hci_conn *pend; | ||
568 | 579 | ||
569 | BT_DBG("%s status %d", hdev->name, status); | 580 | BT_DBG("%s status %d", hdev->name, status); |
570 | 581 | ||
571 | clear_bit(HCI_INQUIRY, &hdev->flags); | 582 | clear_bit(HCI_INQUIRY, &hdev->flags); |
572 | hci_req_complete(hdev, status); | 583 | hci_req_complete(hdev, status); |
584 | |||
585 | hci_dev_lock(hdev); | ||
586 | |||
587 | pend = hci_conn_hash_lookup_state(hdev, ACL_LINK, BT_CONNECT2); | ||
588 | if (pend) | ||
589 | hci_acl_connect(pend); | ||
590 | |||
591 | hci_dev_unlock(hdev); | ||
573 | } | 592 | } |
574 | 593 | ||
575 | /* Inquiry Result */ | 594 | /* Inquiry Result */ |
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c index f26a9eb49945..711a085eca5b 100644 --- a/net/bluetooth/hci_sock.c +++ b/net/bluetooth/hci_sock.c | |||
@@ -120,10 +120,13 @@ void hci_send_to_sock(struct hci_dev *hdev, struct sk_buff *skb) | |||
120 | if (!hci_test_bit(evt, &flt->event_mask)) | 120 | if (!hci_test_bit(evt, &flt->event_mask)) |
121 | continue; | 121 | continue; |
122 | 122 | ||
123 | if (flt->opcode && ((evt == HCI_EV_CMD_COMPLETE && | 123 | if (flt->opcode && |
124 | flt->opcode != *(__u16 *)(skb->data + 3)) || | 124 | ((evt == HCI_EV_CMD_COMPLETE && |
125 | (evt == HCI_EV_CMD_STATUS && | 125 | flt->opcode != |
126 | flt->opcode != *(__u16 *)(skb->data + 4)))) | 126 | get_unaligned((__u16 *)(skb->data + 3))) || |
127 | (evt == HCI_EV_CMD_STATUS && | ||
128 | flt->opcode != | ||
129 | get_unaligned((__u16 *)(skb->data + 4))))) | ||
127 | continue; | 130 | continue; |
128 | } | 131 | } |
129 | 132 | ||
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c index 954eb74eb370..3eeeb7a86e75 100644 --- a/net/bluetooth/hci_sysfs.c +++ b/net/bluetooth/hci_sysfs.c | |||
@@ -259,7 +259,9 @@ void hci_conn_add_sysfs(struct hci_conn *conn) | |||
259 | 259 | ||
260 | BT_DBG("conn %p", conn); | 260 | BT_DBG("conn %p", conn); |
261 | 261 | ||
262 | conn->dev.parent = &hdev->dev; | 262 | conn->dev.bus = &bt_bus; |
263 | conn->dev.parent = &hdev->dev; | ||
264 | |||
263 | conn->dev.release = bt_release; | 265 | conn->dev.release = bt_release; |
264 | 266 | ||
265 | snprintf(conn->dev.bus_id, BUS_ID_SIZE, | 267 | snprintf(conn->dev.bus_id, BUS_ID_SIZE, |
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index 2b3dcb8f90fa..bbf78e6a7bc3 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
@@ -1353,12 +1353,12 @@ static inline int l2cap_conf_output(struct sock *sk, void **ptr) | |||
1353 | 1353 | ||
1354 | /* Configure output options and let the other side know | 1354 | /* Configure output options and let the other side know |
1355 | * which ones we don't like. */ | 1355 | * which ones we don't like. */ |
1356 | if (pi->conf_mtu < pi->omtu) { | 1356 | if (pi->conf_mtu < pi->omtu) |
1357 | l2cap_add_conf_opt(ptr, L2CAP_CONF_MTU, 2, pi->omtu); | ||
1358 | result = L2CAP_CONF_UNACCEPT; | 1357 | result = L2CAP_CONF_UNACCEPT; |
1359 | } else { | 1358 | else |
1360 | pi->omtu = pi->conf_mtu; | 1359 | pi->omtu = pi->conf_mtu; |
1361 | } | 1360 | |
1361 | l2cap_add_conf_opt(ptr, L2CAP_CONF_MTU, 2, pi->omtu); | ||
1362 | 1362 | ||
1363 | BT_DBG("sk %p result %d", sk, result); | 1363 | BT_DBG("sk %p result %d", sk, result); |
1364 | return result; | 1364 | return result; |
@@ -1533,6 +1533,9 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr | |||
1533 | if (!(sk = l2cap_get_chan_by_scid(&conn->chan_list, dcid))) | 1533 | if (!(sk = l2cap_get_chan_by_scid(&conn->chan_list, dcid))) |
1534 | return -ENOENT; | 1534 | return -ENOENT; |
1535 | 1535 | ||
1536 | if (sk->sk_state == BT_DISCONN) | ||
1537 | goto unlock; | ||
1538 | |||
1536 | l2cap_parse_conf_req(sk, req->data, cmd->len - sizeof(*req)); | 1539 | l2cap_parse_conf_req(sk, req->data, cmd->len - sizeof(*req)); |
1537 | 1540 | ||
1538 | if (flags & 0x0001) { | 1541 | if (flags & 0x0001) { |
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index b8e3a5f1c8a8..1fb5d42f37ae 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c | |||
@@ -765,7 +765,7 @@ static void rfcomm_tty_set_termios(struct tty_struct *tty, struct termios *old) | |||
765 | 765 | ||
766 | BT_DBG("tty %p termios %p", tty, old); | 766 | BT_DBG("tty %p termios %p", tty, old); |
767 | 767 | ||
768 | if (!dev) | 768 | if (!dev || !dev->dlc || !dev->dlc->session) |
769 | return; | 769 | return; |
770 | 770 | ||
771 | /* Handle turning off CRTSCTS */ | 771 | /* Handle turning off CRTSCTS */ |
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index eb0ff7ab05ed..fc4242c0767c 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
@@ -277,7 +277,7 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
277 | __u64 seq; | 277 | __u64 seq; |
278 | 278 | ||
279 | sk = inet6_lookup(&dccp_hashinfo, &hdr->daddr, dh->dccph_dport, | 279 | sk = inet6_lookup(&dccp_hashinfo, &hdr->daddr, dh->dccph_dport, |
280 | &hdr->saddr, dh->dccph_sport, skb->dev->ifindex); | 280 | &hdr->saddr, dh->dccph_sport, inet6_iif(skb)); |
281 | 281 | ||
282 | if (sk == NULL) { | 282 | if (sk == NULL) { |
283 | ICMP6_INC_STATS_BH(__in6_dev_get(skb->dev), ICMP6_MIB_INERRORS); | 283 | ICMP6_INC_STATS_BH(__in6_dev_get(skb->dev), ICMP6_MIB_INERRORS); |
diff --git a/net/dccp/probe.c b/net/dccp/probe.c index 146496fce2e2..fded1493c1dc 100644 --- a/net/dccp/probe.c +++ b/net/dccp/probe.c | |||
@@ -160,6 +160,8 @@ static __init int dccpprobe_init(void) | |||
160 | init_waitqueue_head(&dccpw.wait); | 160 | init_waitqueue_head(&dccpw.wait); |
161 | spin_lock_init(&dccpw.lock); | 161 | spin_lock_init(&dccpw.lock); |
162 | dccpw.fifo = kfifo_alloc(bufsize, GFP_KERNEL, &dccpw.lock); | 162 | dccpw.fifo = kfifo_alloc(bufsize, GFP_KERNEL, &dccpw.lock); |
163 | if (IS_ERR(dccpw.fifo)) | ||
164 | return PTR_ERR(dccpw.fifo); | ||
163 | 165 | ||
164 | if (!proc_net_fops_create(procname, S_IRUSR, &dccpprobe_fops)) | 166 | if (!proc_net_fops_create(procname, S_IRUSR, &dccpprobe_fops)) |
165 | goto err0; | 167 | goto err0; |
diff --git a/net/ipv4/netfilter/ip_conntrack_helper_h323.c b/net/ipv4/netfilter/ip_conntrack_helper_h323.c index 7b7441202bfd..6cb9070cd0bc 100644 --- a/net/ipv4/netfilter/ip_conntrack_helper_h323.c +++ b/net/ipv4/netfilter/ip_conntrack_helper_h323.c | |||
@@ -1417,7 +1417,7 @@ static int process_rcf(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
1417 | DEBUGP | 1417 | DEBUGP |
1418 | ("ip_ct_ras: set RAS connection timeout to %u seconds\n", | 1418 | ("ip_ct_ras: set RAS connection timeout to %u seconds\n", |
1419 | info->timeout); | 1419 | info->timeout); |
1420 | ip_ct_refresh_acct(ct, ctinfo, NULL, info->timeout * HZ); | 1420 | ip_ct_refresh(ct, *pskb, info->timeout * HZ); |
1421 | 1421 | ||
1422 | /* Set expect timeout */ | 1422 | /* Set expect timeout */ |
1423 | read_lock_bh(&ip_conntrack_lock); | 1423 | read_lock_bh(&ip_conntrack_lock); |
@@ -1465,7 +1465,7 @@ static int process_urq(struct sk_buff **pskb, struct ip_conntrack *ct, | |||
1465 | info->sig_port[!dir] = 0; | 1465 | info->sig_port[!dir] = 0; |
1466 | 1466 | ||
1467 | /* Give it 30 seconds for UCF or URJ */ | 1467 | /* Give it 30 seconds for UCF or URJ */ |
1468 | ip_ct_refresh_acct(ct, ctinfo, NULL, 30 * HZ); | 1468 | ip_ct_refresh(ct, *pskb, 30 * HZ); |
1469 | 1469 | ||
1470 | return 0; | 1470 | return 0; |
1471 | } | 1471 | } |
diff --git a/net/ipv4/tcp_probe.c b/net/ipv4/tcp_probe.c index 4be336f17883..f230eeecf092 100644 --- a/net/ipv4/tcp_probe.c +++ b/net/ipv4/tcp_probe.c | |||
@@ -156,6 +156,8 @@ static __init int tcpprobe_init(void) | |||
156 | init_waitqueue_head(&tcpw.wait); | 156 | init_waitqueue_head(&tcpw.wait); |
157 | spin_lock_init(&tcpw.lock); | 157 | spin_lock_init(&tcpw.lock); |
158 | tcpw.fifo = kfifo_alloc(bufsize, GFP_KERNEL, &tcpw.lock); | 158 | tcpw.fifo = kfifo_alloc(bufsize, GFP_KERNEL, &tcpw.lock); |
159 | if (IS_ERR(tcpw.fifo)) | ||
160 | return PTR_ERR(tcpw.fifo); | ||
159 | 161 | ||
160 | if (!proc_net_fops_create(procname, S_IRUSR, &tcpprobe_fops)) | 162 | if (!proc_net_fops_create(procname, S_IRUSR, &tcpprobe_fops)) |
161 | goto err0; | 163 | goto err0; |
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 865d75214a9a..9e1bd374875e 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c | |||
@@ -928,23 +928,32 @@ static int udp_encap_rcv(struct sock * sk, struct sk_buff *skb) | |||
928 | return 1; | 928 | return 1; |
929 | #else | 929 | #else |
930 | struct udp_sock *up = udp_sk(sk); | 930 | struct udp_sock *up = udp_sk(sk); |
931 | struct udphdr *uh = skb->h.uh; | 931 | struct udphdr *uh; |
932 | struct iphdr *iph; | 932 | struct iphdr *iph; |
933 | int iphlen, len; | 933 | int iphlen, len; |
934 | 934 | ||
935 | __u8 *udpdata = (__u8 *)uh + sizeof(struct udphdr); | 935 | __u8 *udpdata; |
936 | __be32 *udpdata32 = (__be32 *)udpdata; | 936 | __be32 *udpdata32; |
937 | __u16 encap_type = up->encap_type; | 937 | __u16 encap_type = up->encap_type; |
938 | 938 | ||
939 | /* if we're overly short, let UDP handle it */ | 939 | /* if we're overly short, let UDP handle it */ |
940 | if (udpdata > skb->tail) | 940 | len = skb->len - sizeof(struct udphdr); |
941 | if (len <= 0) | ||
941 | return 1; | 942 | return 1; |
942 | 943 | ||
943 | /* if this is not encapsulated socket, then just return now */ | 944 | /* if this is not encapsulated socket, then just return now */ |
944 | if (!encap_type) | 945 | if (!encap_type) |
945 | return 1; | 946 | return 1; |
946 | 947 | ||
947 | len = skb->tail - udpdata; | 948 | /* If this is a paged skb, make sure we pull up |
949 | * whatever data we need to look at. */ | ||
950 | if (!pskb_may_pull(skb, sizeof(struct udphdr) + min(len, 8))) | ||
951 | return 1; | ||
952 | |||
953 | /* Now we can get the pointers */ | ||
954 | uh = skb->h.uh; | ||
955 | udpdata = (__u8 *)uh + sizeof(struct udphdr); | ||
956 | udpdata32 = (__be32 *)udpdata; | ||
948 | 957 | ||
949 | switch (encap_type) { | 958 | switch (encap_type) { |
950 | default: | 959 | default: |
diff --git a/net/ipv6/ip6_tunnel.c b/net/ipv6/ip6_tunnel.c index 84d7ebdb9d21..b9f40290d12a 100644 --- a/net/ipv6/ip6_tunnel.c +++ b/net/ipv6/ip6_tunnel.c | |||
@@ -542,6 +542,7 @@ ip6ip6_rcv(struct sk_buff *skb) | |||
542 | skb->dev = t->dev; | 542 | skb->dev = t->dev; |
543 | dst_release(skb->dst); | 543 | dst_release(skb->dst); |
544 | skb->dst = NULL; | 544 | skb->dst = NULL; |
545 | nf_reset(skb); | ||
545 | if (t->parms.flags & IP6_TNL_F_RCV_DSCP_COPY) | 546 | if (t->parms.flags & IP6_TNL_F_RCV_DSCP_COPY) |
546 | ipv6_copy_dscp(ipv6h, skb->nh.ipv6h); | 547 | ipv6_copy_dscp(ipv6h, skb->nh.ipv6h); |
547 | ip6ip6_ecn_decapsulate(ipv6h, skb); | 548 | ip6ip6_ecn_decapsulate(ipv6h, skb); |
@@ -1149,6 +1150,20 @@ fail: | |||
1149 | return err; | 1150 | return err; |
1150 | } | 1151 | } |
1151 | 1152 | ||
1153 | static void __exit ip6ip6_destroy_tunnels(void) | ||
1154 | { | ||
1155 | int h; | ||
1156 | struct ip6_tnl *t; | ||
1157 | |||
1158 | for (h = 0; h < HASH_SIZE; h++) { | ||
1159 | while ((t = tnls_r_l[h]) != NULL) | ||
1160 | unregister_netdevice(t->dev); | ||
1161 | } | ||
1162 | |||
1163 | t = tnls_wc[0]; | ||
1164 | unregister_netdevice(t->dev); | ||
1165 | } | ||
1166 | |||
1152 | /** | 1167 | /** |
1153 | * ip6_tunnel_cleanup - free resources and unregister protocol | 1168 | * ip6_tunnel_cleanup - free resources and unregister protocol |
1154 | **/ | 1169 | **/ |
@@ -1158,7 +1173,9 @@ static void __exit ip6_tunnel_cleanup(void) | |||
1158 | if (xfrm6_tunnel_deregister(&ip6ip6_handler)) | 1173 | if (xfrm6_tunnel_deregister(&ip6ip6_handler)) |
1159 | printk(KERN_INFO "ip6ip6 close: can't deregister tunnel\n"); | 1174 | printk(KERN_INFO "ip6ip6 close: can't deregister tunnel\n"); |
1160 | 1175 | ||
1161 | unregister_netdev(ip6ip6_fb_tnl_dev); | 1176 | rtnl_lock(); |
1177 | ip6ip6_destroy_tunnels(); | ||
1178 | rtnl_unlock(); | ||
1162 | } | 1179 | } |
1163 | 1180 | ||
1164 | module_init(ip6_tunnel_init); | 1181 | module_init(ip6_tunnel_init); |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index c953466b7afd..b39ae99122d5 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -330,6 +330,8 @@ static int inline rt6_check_neigh(struct rt6_info *rt) | |||
330 | read_lock_bh(&neigh->lock); | 330 | read_lock_bh(&neigh->lock); |
331 | if (neigh->nud_state & NUD_VALID) | 331 | if (neigh->nud_state & NUD_VALID) |
332 | m = 2; | 332 | m = 2; |
333 | else if (!(neigh->nud_state & NUD_FAILED)) | ||
334 | m = 1; | ||
333 | read_unlock_bh(&neigh->lock); | 335 | read_unlock_bh(&neigh->lock); |
334 | } | 336 | } |
335 | return m; | 337 | return m; |
@@ -347,9 +349,7 @@ static int rt6_score_route(struct rt6_info *rt, int oif, | |||
347 | m |= IPV6_DECODE_PREF(IPV6_EXTRACT_PREF(rt->rt6i_flags)) << 2; | 349 | m |= IPV6_DECODE_PREF(IPV6_EXTRACT_PREF(rt->rt6i_flags)) << 2; |
348 | #endif | 350 | #endif |
349 | n = rt6_check_neigh(rt); | 351 | n = rt6_check_neigh(rt); |
350 | if (n > 1) | 352 | if (!n && (strict & RT6_LOOKUP_F_REACHABLE)) |
351 | m |= 16; | ||
352 | else if (!n && strict & RT6_LOOKUP_F_REACHABLE) | ||
353 | return -1; | 353 | return -1; |
354 | return m; | 354 | return m; |
355 | } | 355 | } |
@@ -380,10 +380,11 @@ static struct rt6_info *rt6_select(struct rt6_info **head, int oif, | |||
380 | continue; | 380 | continue; |
381 | 381 | ||
382 | if (m > mpri) { | 382 | if (m > mpri) { |
383 | rt6_probe(match); | 383 | if (strict & RT6_LOOKUP_F_REACHABLE) |
384 | rt6_probe(match); | ||
384 | match = rt; | 385 | match = rt; |
385 | mpri = m; | 386 | mpri = m; |
386 | } else { | 387 | } else if (strict & RT6_LOOKUP_F_REACHABLE) { |
387 | rt6_probe(rt); | 388 | rt6_probe(rt); |
388 | } | 389 | } |
389 | } | 390 | } |
@@ -636,7 +637,7 @@ static struct rt6_info *ip6_pol_route_input(struct fib6_table *table, | |||
636 | int strict = 0; | 637 | int strict = 0; |
637 | int attempts = 3; | 638 | int attempts = 3; |
638 | int err; | 639 | int err; |
639 | int reachable = RT6_LOOKUP_F_REACHABLE; | 640 | int reachable = ipv6_devconf.forwarding ? 0 : RT6_LOOKUP_F_REACHABLE; |
640 | 641 | ||
641 | strict |= flags & RT6_LOOKUP_F_IFACE; | 642 | strict |= flags & RT6_LOOKUP_F_IFACE; |
642 | 643 | ||
@@ -733,7 +734,7 @@ static struct rt6_info *ip6_pol_route_output(struct fib6_table *table, | |||
733 | int strict = 0; | 734 | int strict = 0; |
734 | int attempts = 3; | 735 | int attempts = 3; |
735 | int err; | 736 | int err; |
736 | int reachable = RT6_LOOKUP_F_REACHABLE; | 737 | int reachable = ipv6_devconf.forwarding ? 0 : RT6_LOOKUP_F_REACHABLE; |
737 | 738 | ||
738 | strict |= flags & RT6_LOOKUP_F_IFACE; | 739 | strict |= flags & RT6_LOOKUP_F_IFACE; |
739 | 740 | ||
diff --git a/net/ipv6/udp.c b/net/ipv6/udp.c index e0c3934a7e4b..c83f23e51c46 100644 --- a/net/ipv6/udp.c +++ b/net/ipv6/udp.c | |||
@@ -242,14 +242,13 @@ static void udpv6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
242 | { | 242 | { |
243 | struct ipv6_pinfo *np; | 243 | struct ipv6_pinfo *np; |
244 | struct ipv6hdr *hdr = (struct ipv6hdr*)skb->data; | 244 | struct ipv6hdr *hdr = (struct ipv6hdr*)skb->data; |
245 | struct net_device *dev = skb->dev; | ||
246 | struct in6_addr *saddr = &hdr->saddr; | 245 | struct in6_addr *saddr = &hdr->saddr; |
247 | struct in6_addr *daddr = &hdr->daddr; | 246 | struct in6_addr *daddr = &hdr->daddr; |
248 | struct udphdr *uh = (struct udphdr*)(skb->data+offset); | 247 | struct udphdr *uh = (struct udphdr*)(skb->data+offset); |
249 | struct sock *sk; | 248 | struct sock *sk; |
250 | int err; | 249 | int err; |
251 | 250 | ||
252 | sk = udp_v6_lookup(daddr, uh->dest, saddr, uh->source, dev->ifindex); | 251 | sk = udp_v6_lookup(daddr, uh->dest, saddr, uh->source, inet6_iif(skb)); |
253 | 252 | ||
254 | if (sk == NULL) | 253 | if (sk == NULL) |
255 | return; | 254 | return; |
@@ -348,7 +347,7 @@ static void udpv6_mcast_deliver(struct udphdr *uh, | |||
348 | 347 | ||
349 | read_lock(&udp_hash_lock); | 348 | read_lock(&udp_hash_lock); |
350 | sk = sk_head(&udp_hash[ntohs(uh->dest) & (UDP_HTABLE_SIZE - 1)]); | 349 | sk = sk_head(&udp_hash[ntohs(uh->dest) & (UDP_HTABLE_SIZE - 1)]); |
351 | dif = skb->dev->ifindex; | 350 | dif = inet6_iif(skb); |
352 | sk = udp_v6_mcast_next(sk, uh->dest, daddr, uh->source, saddr, dif); | 351 | sk = udp_v6_mcast_next(sk, uh->dest, daddr, uh->source, saddr, dif); |
353 | if (!sk) { | 352 | if (!sk) { |
354 | kfree_skb(skb); | 353 | kfree_skb(skb); |
@@ -429,7 +428,7 @@ static int udpv6_rcv(struct sk_buff **pskb) | |||
429 | * check socket cache ... must talk to Alan about his plans | 428 | * check socket cache ... must talk to Alan about his plans |
430 | * for sock caches... i'll skip this for now. | 429 | * for sock caches... i'll skip this for now. |
431 | */ | 430 | */ |
432 | sk = udp_v6_lookup(saddr, uh->source, daddr, uh->dest, dev->ifindex); | 431 | sk = udp_v6_lookup(saddr, uh->source, daddr, uh->dest, inet6_iif(skb)); |
433 | 432 | ||
434 | if (sk == NULL) { | 433 | if (sk == NULL) { |
435 | if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) | 434 | if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) |
diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c index 5073261b9d0c..fede83763095 100644 --- a/net/irda/irlmp.c +++ b/net/irda/irlmp.c | |||
@@ -1678,7 +1678,8 @@ static int irlmp_slsap_inuse(__u8 slsap_sel) | |||
1678 | * every IrLAP connection and check every LSAP associated with each | 1678 | * every IrLAP connection and check every LSAP associated with each |
1679 | * the connection. | 1679 | * the connection. |
1680 | */ | 1680 | */ |
1681 | spin_lock_irqsave(&irlmp->links->hb_spinlock, flags); | 1681 | spin_lock_irqsave_nested(&irlmp->links->hb_spinlock, flags, |
1682 | SINGLE_DEPTH_NESTING); | ||
1682 | lap = (struct lap_cb *) hashbin_get_first(irlmp->links); | 1683 | lap = (struct lap_cb *) hashbin_get_first(irlmp->links); |
1683 | while (lap != NULL) { | 1684 | while (lap != NULL) { |
1684 | IRDA_ASSERT(lap->magic == LMP_LAP_MAGIC, goto errlap;); | 1685 | IRDA_ASSERT(lap->magic == LMP_LAP_MAGIC, goto errlap;); |
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index b43e7647e125..2ee14f8a1908 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
@@ -495,6 +495,7 @@ static struct xfrm_state *xfrm_user_state_lookup(struct xfrm_usersa_id *p, | |||
495 | goto out; | 495 | goto out; |
496 | } | 496 | } |
497 | 497 | ||
498 | err = -ESRCH; | ||
498 | x = xfrm_state_lookup_byaddr(&p->daddr, saddr, p->proto, | 499 | x = xfrm_state_lookup_byaddr(&p->daddr, saddr, p->proto, |
499 | p->family); | 500 | p->family); |
500 | } | 501 | } |
@@ -1927,6 +1928,9 @@ static int xfrm_send_acquire(struct xfrm_state *x, struct xfrm_tmpl *xt, | |||
1927 | len = RTA_SPACE(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr); | 1928 | len = RTA_SPACE(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr); |
1928 | len += NLMSG_SPACE(sizeof(struct xfrm_user_acquire)); | 1929 | len += NLMSG_SPACE(sizeof(struct xfrm_user_acquire)); |
1929 | len += RTA_SPACE(xfrm_user_sec_ctx_size(xp)); | 1930 | len += RTA_SPACE(xfrm_user_sec_ctx_size(xp)); |
1931 | #ifdef CONFIG_XFRM_SUB_POLICY | ||
1932 | len += RTA_SPACE(sizeof(struct xfrm_userpolicy_type)); | ||
1933 | #endif | ||
1930 | skb = alloc_skb(len, GFP_ATOMIC); | 1934 | skb = alloc_skb(len, GFP_ATOMIC); |
1931 | if (skb == NULL) | 1935 | if (skb == NULL) |
1932 | return -ENOMEM; | 1936 | return -ENOMEM; |
@@ -2034,6 +2038,9 @@ static int xfrm_exp_policy_notify(struct xfrm_policy *xp, int dir, struct km_eve | |||
2034 | len = RTA_SPACE(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr); | 2038 | len = RTA_SPACE(sizeof(struct xfrm_user_tmpl) * xp->xfrm_nr); |
2035 | len += NLMSG_SPACE(sizeof(struct xfrm_user_polexpire)); | 2039 | len += NLMSG_SPACE(sizeof(struct xfrm_user_polexpire)); |
2036 | len += RTA_SPACE(xfrm_user_sec_ctx_size(xp)); | 2040 | len += RTA_SPACE(xfrm_user_sec_ctx_size(xp)); |
2041 | #ifdef CONFIG_XFRM_SUB_POLICY | ||
2042 | len += RTA_SPACE(sizeof(struct xfrm_userpolicy_type)); | ||
2043 | #endif | ||
2037 | skb = alloc_skb(len, GFP_ATOMIC); | 2044 | skb = alloc_skb(len, GFP_ATOMIC); |
2038 | if (skb == NULL) | 2045 | if (skb == NULL) |
2039 | return -ENOMEM; | 2046 | return -ENOMEM; |
@@ -2060,6 +2067,9 @@ static int xfrm_notify_policy(struct xfrm_policy *xp, int dir, struct km_event * | |||
2060 | len += RTA_SPACE(headlen); | 2067 | len += RTA_SPACE(headlen); |
2061 | headlen = sizeof(*id); | 2068 | headlen = sizeof(*id); |
2062 | } | 2069 | } |
2070 | #ifdef CONFIG_XFRM_SUB_POLICY | ||
2071 | len += RTA_SPACE(sizeof(struct xfrm_userpolicy_type)); | ||
2072 | #endif | ||
2063 | len += NLMSG_SPACE(headlen); | 2073 | len += NLMSG_SPACE(headlen); |
2064 | 2074 | ||
2065 | skb = alloc_skb(len, GFP_ATOMIC); | 2075 | skb = alloc_skb(len, GFP_ATOMIC); |
@@ -2106,10 +2116,12 @@ static int xfrm_notify_policy_flush(struct km_event *c) | |||
2106 | struct nlmsghdr *nlh; | 2116 | struct nlmsghdr *nlh; |
2107 | struct sk_buff *skb; | 2117 | struct sk_buff *skb; |
2108 | unsigned char *b; | 2118 | unsigned char *b; |
2119 | int len = 0; | ||
2109 | #ifdef CONFIG_XFRM_SUB_POLICY | 2120 | #ifdef CONFIG_XFRM_SUB_POLICY |
2110 | struct xfrm_userpolicy_type upt; | 2121 | struct xfrm_userpolicy_type upt; |
2122 | len += RTA_SPACE(sizeof(struct xfrm_userpolicy_type)); | ||
2111 | #endif | 2123 | #endif |
2112 | int len = NLMSG_LENGTH(0); | 2124 | len += NLMSG_LENGTH(0); |
2113 | 2125 | ||
2114 | skb = alloc_skb(len, GFP_ATOMIC); | 2126 | skb = alloc_skb(len, GFP_ATOMIC); |
2115 | if (skb == NULL) | 2127 | if (skb == NULL) |
diff --git a/scripts/gen_initramfs_list.sh b/scripts/gen_initramfs_list.sh index 331c079f029b..4c723fd18648 100644 --- a/scripts/gen_initramfs_list.sh +++ b/scripts/gen_initramfs_list.sh | |||
@@ -158,7 +158,7 @@ unknown_option() { | |||
158 | } | 158 | } |
159 | 159 | ||
160 | list_header() { | 160 | list_header() { |
161 | echo "deps_initramfs := \\" | 161 | : |
162 | } | 162 | } |
163 | 163 | ||
164 | header() { | 164 | header() { |
@@ -227,6 +227,7 @@ arg="$1" | |||
227 | case "$arg" in | 227 | case "$arg" in |
228 | "-l") # files included in initramfs - used by kbuild | 228 | "-l") # files included in initramfs - used by kbuild |
229 | dep_list="list_" | 229 | dep_list="list_" |
230 | echo "deps_initramfs := \\" | ||
230 | shift | 231 | shift |
231 | ;; | 232 | ;; |
232 | "-o") # generate gzipped cpio image named $1 | 233 | "-o") # generate gzipped cpio image named $1 |
diff --git a/scripts/kconfig/lxdialog/util.c b/scripts/kconfig/lxdialog/util.c index ebc781b493d7..d54440fc166c 100644 --- a/scripts/kconfig/lxdialog/util.c +++ b/scripts/kconfig/lxdialog/util.c | |||
@@ -221,16 +221,14 @@ static void init_dialog_colors(void) | |||
221 | */ | 221 | */ |
222 | static void color_setup(const char *theme) | 222 | static void color_setup(const char *theme) |
223 | { | 223 | { |
224 | if (set_theme(theme)) { | 224 | int use_color; |
225 | if (has_colors()) { /* Terminal supports color? */ | 225 | |
226 | start_color(); | 226 | use_color = set_theme(theme); |
227 | init_dialog_colors(); | 227 | if (use_color && has_colors()) { |
228 | } | 228 | start_color(); |
229 | } | 229 | init_dialog_colors(); |
230 | else | 230 | } else |
231 | { | ||
232 | set_mono_theme(); | 231 | set_mono_theme(); |
233 | } | ||
234 | } | 232 | } |
235 | 233 | ||
236 | /* | 234 | /* |
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 393f3749f330..338bdea96541 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc | |||
@@ -1259,6 +1259,7 @@ void ConfigSearchWindow::search(void) | |||
1259 | * Construct the complete config widget | 1259 | * Construct the complete config widget |
1260 | */ | 1260 | */ |
1261 | ConfigMainWindow::ConfigMainWindow(void) | 1261 | ConfigMainWindow::ConfigMainWindow(void) |
1262 | : searchWindow(0) | ||
1262 | { | 1263 | { |
1263 | QMenuBar* menu; | 1264 | QMenuBar* menu; |
1264 | bool ok; | 1265 | bool ok; |
diff --git a/usr/Makefile b/usr/Makefile index e338e7bedb29..382702ad663b 100644 --- a/usr/Makefile +++ b/usr/Makefile | |||
@@ -20,7 +20,7 @@ $(obj)/initramfs_data.o: $(obj)/initramfs_data.cpio.gz FORCE | |||
20 | hostprogs-y := gen_init_cpio | 20 | hostprogs-y := gen_init_cpio |
21 | initramfs := $(CONFIG_SHELL) $(srctree)/scripts/gen_initramfs_list.sh | 21 | initramfs := $(CONFIG_SHELL) $(srctree)/scripts/gen_initramfs_list.sh |
22 | ramfs-input := $(if $(filter-out "",$(CONFIG_INITRAMFS_SOURCE)), \ | 22 | ramfs-input := $(if $(filter-out "",$(CONFIG_INITRAMFS_SOURCE)), \ |
23 | $(CONFIG_INITRAMFS_SOURCE),-d) | 23 | $(shell echo $(CONFIG_INITRAMFS_SOURCE)),-d) |
24 | ramfs-args := \ | 24 | ramfs-args := \ |
25 | $(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \ | 25 | $(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \ |
26 | $(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID)) | 26 | $(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID)) |