diff options
798 files changed, 11427 insertions, 9971 deletions
diff --git a/Documentation/DocBook/mac80211.tmpl b/Documentation/DocBook/mac80211.tmpl index e36986663570..f3f37f141dbd 100644 --- a/Documentation/DocBook/mac80211.tmpl +++ b/Documentation/DocBook/mac80211.tmpl | |||
@@ -184,8 +184,6 @@ usage should require reading the full document. | |||
184 | !Finclude/net/mac80211.h ieee80211_ctstoself_get | 184 | !Finclude/net/mac80211.h ieee80211_ctstoself_get |
185 | !Finclude/net/mac80211.h ieee80211_ctstoself_duration | 185 | !Finclude/net/mac80211.h ieee80211_ctstoself_duration |
186 | !Finclude/net/mac80211.h ieee80211_generic_frame_duration | 186 | !Finclude/net/mac80211.h ieee80211_generic_frame_duration |
187 | !Finclude/net/mac80211.h ieee80211_get_hdrlen_from_skb | ||
188 | !Finclude/net/mac80211.h ieee80211_hdrlen | ||
189 | !Finclude/net/mac80211.h ieee80211_wake_queue | 187 | !Finclude/net/mac80211.h ieee80211_wake_queue |
190 | !Finclude/net/mac80211.h ieee80211_stop_queue | 188 | !Finclude/net/mac80211.h ieee80211_stop_queue |
191 | !Finclude/net/mac80211.h ieee80211_wake_queues | 189 | !Finclude/net/mac80211.h ieee80211_wake_queues |
diff --git a/Documentation/driver-model/driver.txt b/Documentation/driver-model/driver.txt index 82132169d47a..60120fb3b961 100644 --- a/Documentation/driver-model/driver.txt +++ b/Documentation/driver-model/driver.txt | |||
@@ -207,8 +207,8 @@ Attributes | |||
207 | ~~~~~~~~~~ | 207 | ~~~~~~~~~~ |
208 | struct driver_attribute { | 208 | struct driver_attribute { |
209 | struct attribute attr; | 209 | struct attribute attr; |
210 | ssize_t (*show)(struct device_driver *, char * buf, size_t count, loff_t off); | 210 | ssize_t (*show)(struct device_driver *driver, char *buf); |
211 | ssize_t (*store)(struct device_driver *, const char * buf, size_t count, loff_t off); | 211 | ssize_t (*store)(struct device_driver *, const char * buf, size_t count); |
212 | }; | 212 | }; |
213 | 213 | ||
214 | Device drivers can export attributes via their sysfs directories. | 214 | Device drivers can export attributes via their sysfs directories. |
diff --git a/Documentation/dvb/get_dvb_firmware b/Documentation/dvb/get_dvb_firmware index a52adfc9a57f..3d1b0ab70c8e 100644 --- a/Documentation/dvb/get_dvb_firmware +++ b/Documentation/dvb/get_dvb_firmware | |||
@@ -25,7 +25,7 @@ use IO::Handle; | |||
25 | "tda10046lifeview", "av7110", "dec2000t", "dec2540t", | 25 | "tda10046lifeview", "av7110", "dec2000t", "dec2540t", |
26 | "dec3000s", "vp7041", "dibusb", "nxt2002", "nxt2004", | 26 | "dec3000s", "vp7041", "dibusb", "nxt2002", "nxt2004", |
27 | "or51211", "or51132_qam", "or51132_vsb", "bluebird", | 27 | "or51211", "or51132_qam", "or51132_vsb", "bluebird", |
28 | "opera1", "cx231xx", "cx18", "cx23885", "pvrusb2" ); | 28 | "opera1", "cx231xx", "cx18", "cx23885", "pvrusb2", "mpc718" ); |
29 | 29 | ||
30 | # Check args | 30 | # Check args |
31 | syntax() if (scalar(@ARGV) != 1); | 31 | syntax() if (scalar(@ARGV) != 1); |
@@ -381,6 +381,57 @@ sub cx18 { | |||
381 | $allfiles; | 381 | $allfiles; |
382 | } | 382 | } |
383 | 383 | ||
384 | sub mpc718 { | ||
385 | my $archive = 'Yuan MPC718 TV Tuner Card 2.13.10.1016.zip'; | ||
386 | my $url = "ftp://ftp.work.acer-euro.com/desktop/aspire_idea510/vista/Drivers/$archive"; | ||
387 | my $fwfile = "dvb-cx18-mpc718-mt352.fw"; | ||
388 | my $tmpdir = tempdir(DIR => "/tmp", CLEANUP => 1); | ||
389 | |||
390 | checkstandard(); | ||
391 | wgetfile($archive, $url); | ||
392 | unzip($archive, $tmpdir); | ||
393 | |||
394 | my $sourcefile = "$tmpdir/Yuan MPC718 TV Tuner Card 2.13.10.1016/mpc718_32bit/yuanrap.sys"; | ||
395 | my $found = 0; | ||
396 | |||
397 | open IN, '<', $sourcefile or die "Couldn't open $sourcefile to extract $fwfile data\n"; | ||
398 | binmode IN; | ||
399 | open OUT, '>', $fwfile; | ||
400 | binmode OUT; | ||
401 | { | ||
402 | # Block scope because we change the line terminator variable $/ | ||
403 | my $prevlen = 0; | ||
404 | my $currlen; | ||
405 | |||
406 | # Buried in the data segment are 3 runs of almost identical | ||
407 | # register-value pairs that end in 0x5d 0x01 which is a "TUNER GO" | ||
408 | # command for the MT352. | ||
409 | # Pull out the middle run (because it's easy) of register-value | ||
410 | # pairs to make the "firmware" file. | ||
411 | |||
412 | local $/ = "\x5d\x01"; # MT352 "TUNER GO" | ||
413 | |||
414 | while (<IN>) { | ||
415 | $currlen = length($_); | ||
416 | if ($prevlen == $currlen && $currlen <= 64) { | ||
417 | chop; chop; # Get rid of "TUNER GO" | ||
418 | s/^\0\0//; # get rid of leading 00 00 if it's there | ||
419 | printf OUT "$_"; | ||
420 | $found = 1; | ||
421 | last; | ||
422 | } | ||
423 | $prevlen = $currlen; | ||
424 | } | ||
425 | } | ||
426 | close OUT; | ||
427 | close IN; | ||
428 | if (!$found) { | ||
429 | unlink $fwfile; | ||
430 | die "Couldn't find valid register-value sequence in $sourcefile for $fwfile\n"; | ||
431 | } | ||
432 | $fwfile; | ||
433 | } | ||
434 | |||
384 | sub cx23885 { | 435 | sub cx23885 { |
385 | my $url = "http://linuxtv.org/downloads/firmware/"; | 436 | my $url = "http://linuxtv.org/downloads/firmware/"; |
386 | 437 | ||
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index f8cd450be9aa..09e031c55887 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -458,3 +458,13 @@ Why: Remove the old legacy 32bit machine check code. This has been | |||
458 | but the old version has been kept around for easier testing. Note this | 458 | but the old version has been kept around for easier testing. Note this |
459 | doesn't impact the old P5 and WinChip machine check handlers. | 459 | doesn't impact the old P5 and WinChip machine check handlers. |
460 | Who: Andi Kleen <andi@firstfloor.org> | 460 | Who: Andi Kleen <andi@firstfloor.org> |
461 | |||
462 | ---------------------------- | ||
463 | |||
464 | What: lock_policy_rwsem_* and unlock_policy_rwsem_* will not be | ||
465 | exported interface anymore. | ||
466 | When: 2.6.33 | ||
467 | Why: cpu_policy_rwsem has a new cleaner definition making it local to | ||
468 | cpufreq core and contained inside cpufreq.c. Other dependent | ||
469 | drivers should not use it in order to safely avoid lockdep issues. | ||
470 | Who: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com> | ||
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index d77fbd8b79ac..dd1a6d4bb747 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -1720,8 +1720,8 @@ and is between 256 and 4096 characters. It is defined in the file | |||
1720 | oprofile.cpu_type= Force an oprofile cpu type | 1720 | oprofile.cpu_type= Force an oprofile cpu type |
1721 | This might be useful if you have an older oprofile | 1721 | This might be useful if you have an older oprofile |
1722 | userland or if you want common events. | 1722 | userland or if you want common events. |
1723 | Format: { archperfmon } | 1723 | Format: { arch_perfmon } |
1724 | archperfmon: [X86] Force use of architectural | 1724 | arch_perfmon: [X86] Force use of architectural |
1725 | perfmon on Intel CPUs instead of the | 1725 | perfmon on Intel CPUs instead of the |
1726 | CPU specific event set. | 1726 | CPU specific event set. |
1727 | 1727 | ||
diff --git a/Documentation/video4linux/CARDLIST.em28xx b/Documentation/video4linux/CARDLIST.em28xx index 873630e7e53e..014d255231fc 100644 --- a/Documentation/video4linux/CARDLIST.em28xx +++ b/Documentation/video4linux/CARDLIST.em28xx | |||
@@ -66,3 +66,4 @@ | |||
66 | 68 -> Terratec AV350 (em2860) [0ccd:0084] | 66 | 68 -> Terratec AV350 (em2860) [0ccd:0084] |
67 | 69 -> KWorld ATSC 315U HDTV TV Box (em2882) [eb1a:a313] | 67 | 69 -> KWorld ATSC 315U HDTV TV Box (em2882) [eb1a:a313] |
68 | 70 -> Evga inDtube (em2882) | 68 | 70 -> Evga inDtube (em2882) |
69 | 71 -> Silvercrest Webcam 1.3mpix (em2820/em2840) | ||
diff --git a/Documentation/x86/00-INDEX b/Documentation/x86/00-INDEX index dbe3377754af..f37b46d34861 100644 --- a/Documentation/x86/00-INDEX +++ b/Documentation/x86/00-INDEX | |||
@@ -2,3 +2,5 @@ | |||
2 | - this file | 2 | - this file |
3 | mtrr.txt | 3 | mtrr.txt |
4 | - how to use x86 Memory Type Range Registers to increase performance | 4 | - how to use x86 Memory Type Range Registers to increase performance |
5 | exception-tables.txt | ||
6 | - why and how Linux kernel uses exception tables on x86 | ||
diff --git a/Documentation/exception.txt b/Documentation/x86/exception-tables.txt index 2d5aded64247..32901aa36f0a 100644 --- a/Documentation/exception.txt +++ b/Documentation/x86/exception-tables.txt | |||
@@ -1,123 +1,123 @@ | |||
1 | Kernel level exception handling in Linux 2.1.8 | 1 | Kernel level exception handling in Linux |
2 | Commentary by Joerg Pommnitz <joerg@raleigh.ibm.com> | 2 | Commentary by Joerg Pommnitz <joerg@raleigh.ibm.com> |
3 | 3 | ||
4 | When a process runs in kernel mode, it often has to access user | 4 | When a process runs in kernel mode, it often has to access user |
5 | mode memory whose address has been passed by an untrusted program. | 5 | mode memory whose address has been passed by an untrusted program. |
6 | To protect itself the kernel has to verify this address. | 6 | To protect itself the kernel has to verify this address. |
7 | 7 | ||
8 | In older versions of Linux this was done with the | 8 | In older versions of Linux this was done with the |
9 | int verify_area(int type, const void * addr, unsigned long size) | 9 | int verify_area(int type, const void * addr, unsigned long size) |
10 | function (which has since been replaced by access_ok()). | 10 | function (which has since been replaced by access_ok()). |
11 | 11 | ||
12 | This function verified that the memory area starting at address | 12 | This function verified that the memory area starting at address |
13 | 'addr' and of size 'size' was accessible for the operation specified | 13 | 'addr' and of size 'size' was accessible for the operation specified |
14 | in type (read or write). To do this, verify_read had to look up the | 14 | in type (read or write). To do this, verify_read had to look up the |
15 | virtual memory area (vma) that contained the address addr. In the | 15 | virtual memory area (vma) that contained the address addr. In the |
16 | normal case (correctly working program), this test was successful. | 16 | normal case (correctly working program), this test was successful. |
17 | It only failed for a few buggy programs. In some kernel profiling | 17 | It only failed for a few buggy programs. In some kernel profiling |
18 | tests, this normally unneeded verification used up a considerable | 18 | tests, this normally unneeded verification used up a considerable |
19 | amount of time. | 19 | amount of time. |
20 | 20 | ||
21 | To overcome this situation, Linus decided to let the virtual memory | 21 | To overcome this situation, Linus decided to let the virtual memory |
22 | hardware present in every Linux-capable CPU handle this test. | 22 | hardware present in every Linux-capable CPU handle this test. |
23 | 23 | ||
24 | How does this work? | 24 | How does this work? |
25 | 25 | ||
26 | Whenever the kernel tries to access an address that is currently not | 26 | Whenever the kernel tries to access an address that is currently not |
27 | accessible, the CPU generates a page fault exception and calls the | 27 | accessible, the CPU generates a page fault exception and calls the |
28 | page fault handler | 28 | page fault handler |
29 | 29 | ||
30 | void do_page_fault(struct pt_regs *regs, unsigned long error_code) | 30 | void do_page_fault(struct pt_regs *regs, unsigned long error_code) |
31 | 31 | ||
32 | in arch/i386/mm/fault.c. The parameters on the stack are set up by | 32 | in arch/x86/mm/fault.c. The parameters on the stack are set up by |
33 | the low level assembly glue in arch/i386/kernel/entry.S. The parameter | 33 | the low level assembly glue in arch/x86/kernel/entry_32.S. The parameter |
34 | regs is a pointer to the saved registers on the stack, error_code | 34 | regs is a pointer to the saved registers on the stack, error_code |
35 | contains a reason code for the exception. | 35 | contains a reason code for the exception. |
36 | 36 | ||
37 | do_page_fault first obtains the unaccessible address from the CPU | 37 | do_page_fault first obtains the unaccessible address from the CPU |
38 | control register CR2. If the address is within the virtual address | 38 | control register CR2. If the address is within the virtual address |
39 | space of the process, the fault probably occurred, because the page | 39 | space of the process, the fault probably occurred, because the page |
40 | was not swapped in, write protected or something similar. However, | 40 | was not swapped in, write protected or something similar. However, |
41 | we are interested in the other case: the address is not valid, there | 41 | we are interested in the other case: the address is not valid, there |
42 | is no vma that contains this address. In this case, the kernel jumps | 42 | is no vma that contains this address. In this case, the kernel jumps |
43 | to the bad_area label. | 43 | to the bad_area label. |
44 | 44 | ||
45 | There it uses the address of the instruction that caused the exception | 45 | There it uses the address of the instruction that caused the exception |
46 | (i.e. regs->eip) to find an address where the execution can continue | 46 | (i.e. regs->eip) to find an address where the execution can continue |
47 | (fixup). If this search is successful, the fault handler modifies the | 47 | (fixup). If this search is successful, the fault handler modifies the |
48 | return address (again regs->eip) and returns. The execution will | 48 | return address (again regs->eip) and returns. The execution will |
49 | continue at the address in fixup. | 49 | continue at the address in fixup. |
50 | 50 | ||
51 | Where does fixup point to? | 51 | Where does fixup point to? |
52 | 52 | ||
53 | Since we jump to the contents of fixup, fixup obviously points | 53 | Since we jump to the contents of fixup, fixup obviously points |
54 | to executable code. This code is hidden inside the user access macros. | 54 | to executable code. This code is hidden inside the user access macros. |
55 | I have picked the get_user macro defined in include/asm/uaccess.h as an | 55 | I have picked the get_user macro defined in arch/x86/include/asm/uaccess.h |
56 | example. The definition is somewhat hard to follow, so let's peek at | 56 | as an example. The definition is somewhat hard to follow, so let's peek at |
57 | the code generated by the preprocessor and the compiler. I selected | 57 | the code generated by the preprocessor and the compiler. I selected |
58 | the get_user call in drivers/char/console.c for a detailed examination. | 58 | the get_user call in drivers/char/sysrq.c for a detailed examination. |
59 | 59 | ||
60 | The original code in console.c line 1405: | 60 | The original code in sysrq.c line 587: |
61 | get_user(c, buf); | 61 | get_user(c, buf); |
62 | 62 | ||
63 | The preprocessor output (edited to become somewhat readable): | 63 | The preprocessor output (edited to become somewhat readable): |
64 | 64 | ||
65 | ( | 65 | ( |
66 | { | 66 | { |
67 | long __gu_err = - 14 , __gu_val = 0; | 67 | long __gu_err = - 14 , __gu_val = 0; |
68 | const __typeof__(*( ( buf ) )) *__gu_addr = ((buf)); | 68 | const __typeof__(*( ( buf ) )) *__gu_addr = ((buf)); |
69 | if (((((0 + current_set[0])->tss.segment) == 0x18 ) || | 69 | if (((((0 + current_set[0])->tss.segment) == 0x18 ) || |
70 | (((sizeof(*(buf))) <= 0xC0000000UL) && | 70 | (((sizeof(*(buf))) <= 0xC0000000UL) && |
71 | ((unsigned long)(__gu_addr ) <= 0xC0000000UL - (sizeof(*(buf))))))) | 71 | ((unsigned long)(__gu_addr ) <= 0xC0000000UL - (sizeof(*(buf))))))) |
72 | do { | 72 | do { |
73 | __gu_err = 0; | 73 | __gu_err = 0; |
74 | switch ((sizeof(*(buf)))) { | 74 | switch ((sizeof(*(buf)))) { |
75 | case 1: | 75 | case 1: |
76 | __asm__ __volatile__( | 76 | __asm__ __volatile__( |
77 | "1: mov" "b" " %2,%" "b" "1\n" | 77 | "1: mov" "b" " %2,%" "b" "1\n" |
78 | "2:\n" | 78 | "2:\n" |
79 | ".section .fixup,\"ax\"\n" | 79 | ".section .fixup,\"ax\"\n" |
80 | "3: movl %3,%0\n" | 80 | "3: movl %3,%0\n" |
81 | " xor" "b" " %" "b" "1,%" "b" "1\n" | 81 | " xor" "b" " %" "b" "1,%" "b" "1\n" |
82 | " jmp 2b\n" | 82 | " jmp 2b\n" |
83 | ".section __ex_table,\"a\"\n" | 83 | ".section __ex_table,\"a\"\n" |
84 | " .align 4\n" | 84 | " .align 4\n" |
85 | " .long 1b,3b\n" | 85 | " .long 1b,3b\n" |
86 | ".text" : "=r"(__gu_err), "=q" (__gu_val): "m"((*(struct __large_struct *) | 86 | ".text" : "=r"(__gu_err), "=q" (__gu_val): "m"((*(struct __large_struct *) |
87 | ( __gu_addr )) ), "i"(- 14 ), "0"( __gu_err )) ; | 87 | ( __gu_addr )) ), "i"(- 14 ), "0"( __gu_err )) ; |
88 | break; | 88 | break; |
89 | case 2: | 89 | case 2: |
90 | __asm__ __volatile__( | 90 | __asm__ __volatile__( |
91 | "1: mov" "w" " %2,%" "w" "1\n" | 91 | "1: mov" "w" " %2,%" "w" "1\n" |
92 | "2:\n" | 92 | "2:\n" |
93 | ".section .fixup,\"ax\"\n" | 93 | ".section .fixup,\"ax\"\n" |
94 | "3: movl %3,%0\n" | 94 | "3: movl %3,%0\n" |
95 | " xor" "w" " %" "w" "1,%" "w" "1\n" | 95 | " xor" "w" " %" "w" "1,%" "w" "1\n" |
96 | " jmp 2b\n" | 96 | " jmp 2b\n" |
97 | ".section __ex_table,\"a\"\n" | 97 | ".section __ex_table,\"a\"\n" |
98 | " .align 4\n" | 98 | " .align 4\n" |
99 | " .long 1b,3b\n" | 99 | " .long 1b,3b\n" |
100 | ".text" : "=r"(__gu_err), "=r" (__gu_val) : "m"((*(struct __large_struct *) | 100 | ".text" : "=r"(__gu_err), "=r" (__gu_val) : "m"((*(struct __large_struct *) |
101 | ( __gu_addr )) ), "i"(- 14 ), "0"( __gu_err )); | 101 | ( __gu_addr )) ), "i"(- 14 ), "0"( __gu_err )); |
102 | break; | 102 | break; |
103 | case 4: | 103 | case 4: |
104 | __asm__ __volatile__( | 104 | __asm__ __volatile__( |
105 | "1: mov" "l" " %2,%" "" "1\n" | 105 | "1: mov" "l" " %2,%" "" "1\n" |
106 | "2:\n" | 106 | "2:\n" |
107 | ".section .fixup,\"ax\"\n" | 107 | ".section .fixup,\"ax\"\n" |
108 | "3: movl %3,%0\n" | 108 | "3: movl %3,%0\n" |
109 | " xor" "l" " %" "" "1,%" "" "1\n" | 109 | " xor" "l" " %" "" "1,%" "" "1\n" |
110 | " jmp 2b\n" | 110 | " jmp 2b\n" |
111 | ".section __ex_table,\"a\"\n" | 111 | ".section __ex_table,\"a\"\n" |
112 | " .align 4\n" " .long 1b,3b\n" | 112 | " .align 4\n" " .long 1b,3b\n" |
113 | ".text" : "=r"(__gu_err), "=r" (__gu_val) : "m"((*(struct __large_struct *) | 113 | ".text" : "=r"(__gu_err), "=r" (__gu_val) : "m"((*(struct __large_struct *) |
114 | ( __gu_addr )) ), "i"(- 14 ), "0"(__gu_err)); | 114 | ( __gu_addr )) ), "i"(- 14 ), "0"(__gu_err)); |
115 | break; | 115 | break; |
116 | default: | 116 | default: |
117 | (__gu_val) = __get_user_bad(); | 117 | (__gu_val) = __get_user_bad(); |
118 | } | 118 | } |
119 | } while (0) ; | 119 | } while (0) ; |
120 | ((c)) = (__typeof__(*((buf))))__gu_val; | 120 | ((c)) = (__typeof__(*((buf))))__gu_val; |
121 | __gu_err; | 121 | __gu_err; |
122 | } | 122 | } |
123 | ); | 123 | ); |
@@ -127,12 +127,12 @@ see what code gcc generates: | |||
127 | 127 | ||
128 | > xorl %edx,%edx | 128 | > xorl %edx,%edx |
129 | > movl current_set,%eax | 129 | > movl current_set,%eax |
130 | > cmpl $24,788(%eax) | 130 | > cmpl $24,788(%eax) |
131 | > je .L1424 | 131 | > je .L1424 |
132 | > cmpl $-1073741825,64(%esp) | 132 | > cmpl $-1073741825,64(%esp) |
133 | > ja .L1423 | 133 | > ja .L1423 |
134 | > .L1424: | 134 | > .L1424: |
135 | > movl %edx,%eax | 135 | > movl %edx,%eax |
136 | > movl 64(%esp),%ebx | 136 | > movl 64(%esp),%ebx |
137 | > #APP | 137 | > #APP |
138 | > 1: movb (%ebx),%dl /* this is the actual user access */ | 138 | > 1: movb (%ebx),%dl /* this is the actual user access */ |
@@ -149,17 +149,17 @@ see what code gcc generates: | |||
149 | > .L1423: | 149 | > .L1423: |
150 | > movzbl %dl,%esi | 150 | > movzbl %dl,%esi |
151 | 151 | ||
152 | The optimizer does a good job and gives us something we can actually | 152 | The optimizer does a good job and gives us something we can actually |
153 | understand. Can we? The actual user access is quite obvious. Thanks | 153 | understand. Can we? The actual user access is quite obvious. Thanks |
154 | to the unified address space we can just access the address in user | 154 | to the unified address space we can just access the address in user |
155 | memory. But what does the .section stuff do????? | 155 | memory. But what does the .section stuff do????? |
156 | 156 | ||
157 | To understand this we have to look at the final kernel: | 157 | To understand this we have to look at the final kernel: |
158 | 158 | ||
159 | > objdump --section-headers vmlinux | 159 | > objdump --section-headers vmlinux |
160 | > | 160 | > |
161 | > vmlinux: file format elf32-i386 | 161 | > vmlinux: file format elf32-i386 |
162 | > | 162 | > |
163 | > Sections: | 163 | > Sections: |
164 | > Idx Name Size VMA LMA File off Algn | 164 | > Idx Name Size VMA LMA File off Algn |
165 | > 0 .text 00098f40 c0100000 c0100000 00001000 2**4 | 165 | > 0 .text 00098f40 c0100000 c0100000 00001000 2**4 |
@@ -198,18 +198,18 @@ final kernel executable: | |||
198 | 198 | ||
199 | The whole user memory access is reduced to 10 x86 machine instructions. | 199 | The whole user memory access is reduced to 10 x86 machine instructions. |
200 | The instructions bracketed in the .section directives are no longer | 200 | The instructions bracketed in the .section directives are no longer |
201 | in the normal execution path. They are located in a different section | 201 | in the normal execution path. They are located in a different section |
202 | of the executable file: | 202 | of the executable file: |
203 | 203 | ||
204 | > objdump --disassemble --section=.fixup vmlinux | 204 | > objdump --disassemble --section=.fixup vmlinux |
205 | > | 205 | > |
206 | > c0199ff5 <.fixup+10b5> movl $0xfffffff2,%eax | 206 | > c0199ff5 <.fixup+10b5> movl $0xfffffff2,%eax |
207 | > c0199ffa <.fixup+10ba> xorb %dl,%dl | 207 | > c0199ffa <.fixup+10ba> xorb %dl,%dl |
208 | > c0199ffc <.fixup+10bc> jmp c017e7a7 <do_con_write+e3> | 208 | > c0199ffc <.fixup+10bc> jmp c017e7a7 <do_con_write+e3> |
209 | 209 | ||
210 | And finally: | 210 | And finally: |
211 | > objdump --full-contents --section=__ex_table vmlinux | 211 | > objdump --full-contents --section=__ex_table vmlinux |
212 | > | 212 | > |
213 | > c01aa7c4 93c017c0 e09f19c0 97c017c0 99c017c0 ................ | 213 | > c01aa7c4 93c017c0 e09f19c0 97c017c0 99c017c0 ................ |
214 | > c01aa7d4 f6c217c0 e99f19c0 a5e717c0 f59f19c0 ................ | 214 | > c01aa7d4 f6c217c0 e99f19c0 a5e717c0 f59f19c0 ................ |
215 | > c01aa7e4 080a18c0 01a019c0 0a0a18c0 04a019c0 ................ | 215 | > c01aa7e4 080a18c0 01a019c0 0a0a18c0 04a019c0 ................ |
@@ -235,8 +235,8 @@ sections in the ELF object file. So the instructions | |||
235 | ended up in the .fixup section of the object file and the addresses | 235 | ended up in the .fixup section of the object file and the addresses |
236 | .long 1b,3b | 236 | .long 1b,3b |
237 | ended up in the __ex_table section of the object file. 1b and 3b | 237 | ended up in the __ex_table section of the object file. 1b and 3b |
238 | are local labels. The local label 1b (1b stands for next label 1 | 238 | are local labels. The local label 1b (1b stands for next label 1 |
239 | backward) is the address of the instruction that might fault, i.e. | 239 | backward) is the address of the instruction that might fault, i.e. |
240 | in our case the address of the label 1 is c017e7a5: | 240 | in our case the address of the label 1 is c017e7a5: |
241 | the original assembly code: > 1: movb (%ebx),%dl | 241 | the original assembly code: > 1: movb (%ebx),%dl |
242 | and linked in vmlinux : > c017e7a5 <do_con_write+e1> movb (%ebx),%dl | 242 | and linked in vmlinux : > c017e7a5 <do_con_write+e1> movb (%ebx),%dl |
@@ -254,7 +254,7 @@ The assembly code | |||
254 | becomes the value pair | 254 | becomes the value pair |
255 | > c01aa7d4 c017c2f6 c0199fe9 c017e7a5 c0199ff5 ................ | 255 | > c01aa7d4 c017c2f6 c0199fe9 c017e7a5 c0199ff5 ................ |
256 | ^this is ^this is | 256 | ^this is ^this is |
257 | 1b 3b | 257 | 1b 3b |
258 | c017e7a5,c0199ff5 in the exception table of the kernel. | 258 | c017e7a5,c0199ff5 in the exception table of the kernel. |
259 | 259 | ||
260 | So, what actually happens if a fault from kernel mode with no suitable | 260 | So, what actually happens if a fault from kernel mode with no suitable |
@@ -266,9 +266,9 @@ vma occurs? | |||
266 | 3.) CPU calls do_page_fault | 266 | 3.) CPU calls do_page_fault |
267 | 4.) do page fault calls search_exception_table (regs->eip == c017e7a5); | 267 | 4.) do page fault calls search_exception_table (regs->eip == c017e7a5); |
268 | 5.) search_exception_table looks up the address c017e7a5 in the | 268 | 5.) search_exception_table looks up the address c017e7a5 in the |
269 | exception table (i.e. the contents of the ELF section __ex_table) | 269 | exception table (i.e. the contents of the ELF section __ex_table) |
270 | and returns the address of the associated fault handle code c0199ff5. | 270 | and returns the address of the associated fault handle code c0199ff5. |
271 | 6.) do_page_fault modifies its own return address to point to the fault | 271 | 6.) do_page_fault modifies its own return address to point to the fault |
272 | handle code and returns. | 272 | handle code and returns. |
273 | 7.) execution continues in the fault handling code. | 273 | 7.) execution continues in the fault handling code. |
274 | 8.) 8a) EAX becomes -EFAULT (== -14) | 274 | 8.) 8a) EAX becomes -EFAULT (== -14) |
diff --git a/MAINTAINERS b/MAINTAINERS index 381190c7949c..18c3f0c41c95 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -3287,11 +3287,11 @@ F: include/linux/ivtv* | |||
3287 | 3287 | ||
3288 | JFS FILESYSTEM | 3288 | JFS FILESYSTEM |
3289 | P: Dave Kleikamp | 3289 | P: Dave Kleikamp |
3290 | M: shaggy@austin.ibm.com | 3290 | M: shaggy@linux.vnet.ibm.com |
3291 | L: jfs-discussion@lists.sourceforge.net | 3291 | L: jfs-discussion@lists.sourceforge.net |
3292 | W: http://jfs.sourceforge.net/ | 3292 | W: http://jfs.sourceforge.net/ |
3293 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/shaggy/jfs-2.6.git | 3293 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/shaggy/jfs-2.6.git |
3294 | S: Supported | 3294 | S: Maintained |
3295 | F: Documentation/filesystems/jfs.txt | 3295 | F: Documentation/filesystems/jfs.txt |
3296 | F: fs/jfs/ | 3296 | F: fs/jfs/ |
3297 | 3297 | ||
@@ -4407,7 +4407,7 @@ W: http://www.nongnu.org/orinoco/ | |||
4407 | S: Maintained | 4407 | S: Maintained |
4408 | F: drivers/net/wireless/orinoco/ | 4408 | F: drivers/net/wireless/orinoco/ |
4409 | 4409 | ||
4410 | OSD LIBRARY | 4410 | OSD LIBRARY and FILESYSTEM |
4411 | P: Boaz Harrosh | 4411 | P: Boaz Harrosh |
4412 | M: bharrosh@panasas.com | 4412 | M: bharrosh@panasas.com |
4413 | P: Benny Halevy | 4413 | P: Benny Halevy |
@@ -4416,6 +4416,9 @@ L: osd-dev@open-osd.org | |||
4416 | W: http://open-osd.org | 4416 | W: http://open-osd.org |
4417 | T: git git://git.open-osd.org/open-osd.git | 4417 | T: git git://git.open-osd.org/open-osd.git |
4418 | S: Maintained | 4418 | S: Maintained |
4419 | F: drivers/scsi/osd/ | ||
4420 | F: drivers/include/scsi/osd_* | ||
4421 | F: fs/exofs/ | ||
4419 | 4422 | ||
4420 | P54 WIRELESS DRIVER | 4423 | P54 WIRELESS DRIVER |
4421 | P: Michael Wu | 4424 | P: Michael Wu |
@@ -5803,17 +5806,17 @@ P: Jiri Kosina | |||
5803 | M: trivial@kernel.org | 5806 | M: trivial@kernel.org |
5804 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial.git | 5807 | T: git git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial.git |
5805 | S: Maintained | 5808 | S: Maintained |
5806 | F: drivers/char/tty_* | ||
5807 | F: drivers/serial/serial_core.c | ||
5808 | F: include/linux/serial_core.h | ||
5809 | F: include/linux/serial.h | ||
5810 | F: include/linux/tty.h | ||
5811 | 5809 | ||
5812 | TTY LAYER | 5810 | TTY LAYER |
5813 | P: Alan Cox | 5811 | P: Alan Cox |
5814 | M: alan@lxorguk.ukuu.org.uk | 5812 | M: alan@lxorguk.ukuu.org.uk |
5815 | S: Maintained | 5813 | S: Maintained |
5816 | T: stgit http://zeniv.linux.org.uk/~alan/ttydev/ | 5814 | T: stgit http://zeniv.linux.org.uk/~alan/ttydev/ |
5815 | F: drivers/char/tty_* | ||
5816 | F: drivers/serial/serial_core.c | ||
5817 | F: include/linux/serial_core.h | ||
5818 | F: include/linux/serial.h | ||
5819 | F: include/linux/tty.h | ||
5817 | 5820 | ||
5818 | TULIP NETWORK DRIVERS | 5821 | TULIP NETWORK DRIVERS |
5819 | P: Grant Grundler | 5822 | P: Grant Grundler |
@@ -5851,7 +5854,7 @@ UBI FILE SYSTEM (UBIFS) | |||
5851 | P: Artem Bityutskiy | 5854 | P: Artem Bityutskiy |
5852 | M: dedekind@infradead.org | 5855 | M: dedekind@infradead.org |
5853 | P: Adrian Hunter | 5856 | P: Adrian Hunter |
5854 | M: ext-adrian.hunter@nokia.com | 5857 | M: adrian.hunter@nokia.com |
5855 | L: linux-mtd@lists.infradead.org | 5858 | L: linux-mtd@lists.infradead.org |
5856 | T: git git://git.infradead.org/ubifs-2.6.git | 5859 | T: git git://git.infradead.org/ubifs-2.6.git |
5857 | W: http://www.linux-mtd.infradead.org/doc/ubifs.html | 5860 | W: http://www.linux-mtd.infradead.org/doc/ubifs.html |
@@ -565,7 +565,7 @@ KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,) | |||
565 | KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,) | 565 | KBUILD_CFLAGS += $(call cc-option,-Wno-pointer-sign,) |
566 | 566 | ||
567 | # disable invalid "can't wrap" optimizations for signed / pointers | 567 | # disable invalid "can't wrap" optimizations for signed / pointers |
568 | KBUILD_CFLAGS += $(call cc-option,-fwrapv) | 568 | KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow) |
569 | 569 | ||
570 | # revert to pre-gcc-4.4 behaviour of .eh_frame | 570 | # revert to pre-gcc-4.4 behaviour of .eh_frame |
571 | KBUILD_CFLAGS += $(call cc-option,-fno-dwarf2-cfi-asm) | 571 | KBUILD_CFLAGS += $(call cc-option,-fno-dwarf2-cfi-asm) |
diff --git a/arch/alpha/include/asm/thread_info.h b/arch/alpha/include/asm/thread_info.h index d069526bd767..60c83abfde70 100644 --- a/arch/alpha/include/asm/thread_info.h +++ b/arch/alpha/include/asm/thread_info.h | |||
@@ -37,6 +37,7 @@ struct thread_info { | |||
37 | .task = &tsk, \ | 37 | .task = &tsk, \ |
38 | .exec_domain = &default_exec_domain, \ | 38 | .exec_domain = &default_exec_domain, \ |
39 | .addr_limit = KERNEL_DS, \ | 39 | .addr_limit = KERNEL_DS, \ |
40 | .preempt_count = INIT_PREEMPT_COUNT, \ | ||
40 | .restart_block = { \ | 41 | .restart_block = { \ |
41 | .fn = do_no_restart_syscall, \ | 42 | .fn = do_no_restart_syscall, \ |
42 | }, \ | 43 | }, \ |
diff --git a/arch/alpha/kernel/ptrace.c b/arch/alpha/kernel/ptrace.c index 1e9ad52c460e..e072041d19f8 100644 --- a/arch/alpha/kernel/ptrace.c +++ b/arch/alpha/kernel/ptrace.c | |||
@@ -8,7 +8,6 @@ | |||
8 | #include <linux/sched.h> | 8 | #include <linux/sched.h> |
9 | #include <linux/mm.h> | 9 | #include <linux/mm.h> |
10 | #include <linux/smp.h> | 10 | #include <linux/smp.h> |
11 | #include <linux/smp_lock.h> | ||
12 | #include <linux/errno.h> | 11 | #include <linux/errno.h> |
13 | #include <linux/ptrace.h> | 12 | #include <linux/ptrace.h> |
14 | #include <linux/user.h> | 13 | #include <linux/user.h> |
diff --git a/arch/arm/configs/kb9202_defconfig b/arch/arm/configs/kb9202_defconfig index 8e74c66f239d..605a8462f172 100644 --- a/arch/arm/configs/kb9202_defconfig +++ b/arch/arm/configs/kb9202_defconfig | |||
@@ -1,109 +1,246 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Linux kernel version: 2.6.13-rc2 | 3 | # Linux kernel version: 2.6.30-rc8 |
4 | # Sun Aug 14 19:26:59 2005 | 4 | # Wed Jun 3 13:52:33 2009 |
5 | # | 5 | # |
6 | CONFIG_ARM=y | 6 | CONFIG_ARM=y |
7 | CONFIG_SYS_SUPPORTS_APM_EMULATION=y | ||
8 | CONFIG_GENERIC_GPIO=y | ||
9 | CONFIG_GENERIC_TIME=y | ||
10 | CONFIG_GENERIC_CLOCKEVENTS=y | ||
7 | CONFIG_MMU=y | 11 | CONFIG_MMU=y |
8 | CONFIG_UID16=y | 12 | # CONFIG_NO_IOPORT is not set |
13 | CONFIG_GENERIC_HARDIRQS=y | ||
14 | CONFIG_STACKTRACE_SUPPORT=y | ||
15 | CONFIG_HAVE_LATENCYTOP_SUPPORT=y | ||
16 | CONFIG_LOCKDEP_SUPPORT=y | ||
17 | CONFIG_TRACE_IRQFLAGS_SUPPORT=y | ||
18 | CONFIG_HARDIRQS_SW_RESEND=y | ||
19 | CONFIG_GENERIC_IRQ_PROBE=y | ||
9 | CONFIG_RWSEM_GENERIC_SPINLOCK=y | 20 | CONFIG_RWSEM_GENERIC_SPINLOCK=y |
21 | # CONFIG_ARCH_HAS_ILOG2_U32 is not set | ||
22 | # CONFIG_ARCH_HAS_ILOG2_U64 is not set | ||
23 | CONFIG_GENERIC_HWEIGHT=y | ||
10 | CONFIG_GENERIC_CALIBRATE_DELAY=y | 24 | CONFIG_GENERIC_CALIBRATE_DELAY=y |
25 | CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y | ||
26 | CONFIG_VECTORS_BASE=0xffff0000 | ||
27 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" | ||
11 | 28 | ||
12 | # | 29 | # |
13 | # Code maturity level options | 30 | # General setup |
14 | # | 31 | # |
15 | # CONFIG_EXPERIMENTAL is not set | 32 | CONFIG_EXPERIMENTAL=y |
16 | CONFIG_CLEAN_COMPILE=y | ||
17 | CONFIG_BROKEN_ON_SMP=y | 33 | CONFIG_BROKEN_ON_SMP=y |
34 | CONFIG_LOCK_KERNEL=y | ||
18 | CONFIG_INIT_ENV_ARG_LIMIT=32 | 35 | CONFIG_INIT_ENV_ARG_LIMIT=32 |
19 | |||
20 | # | ||
21 | # General setup | ||
22 | # | ||
23 | CONFIG_LOCALVERSION="" | 36 | CONFIG_LOCALVERSION="" |
37 | CONFIG_LOCALVERSION_AUTO=y | ||
24 | # CONFIG_SWAP is not set | 38 | # CONFIG_SWAP is not set |
25 | # CONFIG_SYSVIPC is not set | 39 | CONFIG_SYSVIPC=y |
26 | # CONFIG_BSD_PROCESS_ACCT is not set | 40 | CONFIG_SYSVIPC_SYSCTL=y |
41 | CONFIG_POSIX_MQUEUE=y | ||
42 | CONFIG_POSIX_MQUEUE_SYSCTL=y | ||
43 | CONFIG_BSD_PROCESS_ACCT=y | ||
44 | # CONFIG_BSD_PROCESS_ACCT_V3 is not set | ||
45 | # CONFIG_TASKSTATS is not set | ||
46 | CONFIG_AUDIT=y | ||
47 | |||
48 | # | ||
49 | # RCU Subsystem | ||
50 | # | ||
51 | CONFIG_CLASSIC_RCU=y | ||
52 | # CONFIG_TREE_RCU is not set | ||
53 | # CONFIG_PREEMPT_RCU is not set | ||
54 | # CONFIG_TREE_RCU_TRACE is not set | ||
55 | # CONFIG_PREEMPT_RCU_TRACE is not set | ||
56 | CONFIG_IKCONFIG=y | ||
57 | CONFIG_IKCONFIG_PROC=y | ||
58 | CONFIG_LOG_BUF_SHIFT=17 | ||
59 | # CONFIG_GROUP_SCHED is not set | ||
60 | # CONFIG_CGROUPS is not set | ||
61 | # CONFIG_SYSFS_DEPRECATED_V2 is not set | ||
62 | # CONFIG_RELAY is not set | ||
63 | CONFIG_NAMESPACES=y | ||
64 | # CONFIG_UTS_NS is not set | ||
65 | # CONFIG_IPC_NS is not set | ||
66 | # CONFIG_USER_NS is not set | ||
67 | # CONFIG_PID_NS is not set | ||
68 | # CONFIG_NET_NS is not set | ||
69 | CONFIG_BLK_DEV_INITRD=y | ||
70 | CONFIG_INITRAMFS_SOURCE="" | ||
71 | CONFIG_RD_GZIP=y | ||
72 | CONFIG_RD_BZIP2=y | ||
73 | CONFIG_RD_LZMA=y | ||
74 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y | ||
27 | CONFIG_SYSCTL=y | 75 | CONFIG_SYSCTL=y |
28 | # CONFIG_AUDIT is not set | 76 | CONFIG_ANON_INODES=y |
29 | CONFIG_HOTPLUG=y | ||
30 | # CONFIG_KOBJECT_UEVENT is not set | ||
31 | # CONFIG_IKCONFIG is not set | ||
32 | # CONFIG_EMBEDDED is not set | 77 | # CONFIG_EMBEDDED is not set |
78 | CONFIG_UID16=y | ||
79 | CONFIG_SYSCTL_SYSCALL=y | ||
33 | CONFIG_KALLSYMS=y | 80 | CONFIG_KALLSYMS=y |
34 | # CONFIG_KALLSYMS_ALL is not set | 81 | # CONFIG_KALLSYMS_ALL is not set |
35 | # CONFIG_KALLSYMS_EXTRA_PASS is not set | 82 | CONFIG_KALLSYMS_EXTRA_PASS=y |
83 | # CONFIG_STRIP_ASM_SYMS is not set | ||
84 | CONFIG_HOTPLUG=y | ||
36 | CONFIG_PRINTK=y | 85 | CONFIG_PRINTK=y |
37 | CONFIG_BUG=y | 86 | CONFIG_BUG=y |
87 | CONFIG_ELF_CORE=y | ||
38 | CONFIG_BASE_FULL=y | 88 | CONFIG_BASE_FULL=y |
39 | CONFIG_FUTEX=y | 89 | CONFIG_FUTEX=y |
40 | CONFIG_EPOLL=y | 90 | CONFIG_EPOLL=y |
41 | CONFIG_CC_OPTIMIZE_FOR_SIZE=y | 91 | CONFIG_SIGNALFD=y |
92 | CONFIG_TIMERFD=y | ||
93 | CONFIG_EVENTFD=y | ||
42 | CONFIG_SHMEM=y | 94 | CONFIG_SHMEM=y |
43 | CONFIG_CC_ALIGN_FUNCTIONS=0 | 95 | CONFIG_AIO=y |
44 | CONFIG_CC_ALIGN_LABELS=0 | 96 | CONFIG_VM_EVENT_COUNTERS=y |
45 | CONFIG_CC_ALIGN_LOOPS=0 | 97 | CONFIG_SLUB_DEBUG=y |
46 | CONFIG_CC_ALIGN_JUMPS=0 | 98 | CONFIG_COMPAT_BRK=y |
47 | # CONFIG_TINY_SHMEM is not set | 99 | # CONFIG_SLAB is not set |
100 | CONFIG_SLUB=y | ||
101 | # CONFIG_SLOB is not set | ||
102 | # CONFIG_PROFILING is not set | ||
103 | CONFIG_TRACEPOINTS=y | ||
104 | CONFIG_MARKERS=y | ||
105 | CONFIG_HAVE_OPROFILE=y | ||
106 | # CONFIG_KPROBES is not set | ||
107 | CONFIG_HAVE_KPROBES=y | ||
108 | CONFIG_HAVE_KRETPROBES=y | ||
109 | CONFIG_HAVE_CLK=y | ||
110 | # CONFIG_SLOW_WORK is not set | ||
111 | CONFIG_HAVE_GENERIC_DMA_COHERENT=y | ||
112 | CONFIG_SLABINFO=y | ||
113 | CONFIG_RT_MUTEXES=y | ||
48 | CONFIG_BASE_SMALL=0 | 114 | CONFIG_BASE_SMALL=0 |
115 | CONFIG_MODULES=y | ||
116 | # CONFIG_MODULE_FORCE_LOAD is not set | ||
117 | CONFIG_MODULE_UNLOAD=y | ||
118 | # CONFIG_MODULE_FORCE_UNLOAD is not set | ||
119 | CONFIG_MODVERSIONS=y | ||
120 | CONFIG_MODULE_SRCVERSION_ALL=y | ||
121 | CONFIG_BLOCK=y | ||
122 | # CONFIG_LBD is not set | ||
123 | # CONFIG_BLK_DEV_BSG is not set | ||
124 | # CONFIG_BLK_DEV_INTEGRITY is not set | ||
49 | 125 | ||
50 | # | 126 | # |
51 | # Loadable module support | 127 | # IO Schedulers |
52 | # | 128 | # |
53 | CONFIG_MODULES=y | 129 | CONFIG_IOSCHED_NOOP=y |
54 | CONFIG_MODULE_UNLOAD=y | 130 | # CONFIG_IOSCHED_AS is not set |
55 | CONFIG_OBSOLETE_MODPARM=y | 131 | # CONFIG_IOSCHED_DEADLINE is not set |
56 | # CONFIG_MODULE_SRCVERSION_ALL is not set | 132 | CONFIG_IOSCHED_CFQ=y |
57 | CONFIG_KMOD=y | 133 | # CONFIG_DEFAULT_AS is not set |
134 | # CONFIG_DEFAULT_DEADLINE is not set | ||
135 | CONFIG_DEFAULT_CFQ=y | ||
136 | # CONFIG_DEFAULT_NOOP is not set | ||
137 | CONFIG_DEFAULT_IOSCHED="cfq" | ||
138 | # CONFIG_FREEZER is not set | ||
58 | 139 | ||
59 | # | 140 | # |
60 | # System Type | 141 | # System Type |
61 | # | 142 | # |
62 | # CONFIG_ARCH_CLPS7500 is not set | 143 | # CONFIG_ARCH_AAEC2000 is not set |
144 | # CONFIG_ARCH_INTEGRATOR is not set | ||
145 | # CONFIG_ARCH_REALVIEW is not set | ||
146 | # CONFIG_ARCH_VERSATILE is not set | ||
147 | CONFIG_ARCH_AT91=y | ||
63 | # CONFIG_ARCH_CLPS711X is not set | 148 | # CONFIG_ARCH_CLPS711X is not set |
64 | # CONFIG_ARCH_CO285 is not set | ||
65 | # CONFIG_ARCH_EBSA110 is not set | 149 | # CONFIG_ARCH_EBSA110 is not set |
150 | # CONFIG_ARCH_EP93XX is not set | ||
151 | # CONFIG_ARCH_GEMINI is not set | ||
66 | # CONFIG_ARCH_FOOTBRIDGE is not set | 152 | # CONFIG_ARCH_FOOTBRIDGE is not set |
67 | # CONFIG_ARCH_INTEGRATOR is not set | 153 | # CONFIG_ARCH_NETX is not set |
68 | # CONFIG_ARCH_IOP3XX is not set | 154 | # CONFIG_ARCH_H720X is not set |
69 | # CONFIG_ARCH_IXP4XX is not set | 155 | # CONFIG_ARCH_IMX is not set |
156 | # CONFIG_ARCH_IOP13XX is not set | ||
157 | # CONFIG_ARCH_IOP32X is not set | ||
158 | # CONFIG_ARCH_IOP33X is not set | ||
159 | # CONFIG_ARCH_IXP23XX is not set | ||
70 | # CONFIG_ARCH_IXP2000 is not set | 160 | # CONFIG_ARCH_IXP2000 is not set |
161 | # CONFIG_ARCH_IXP4XX is not set | ||
71 | # CONFIG_ARCH_L7200 is not set | 162 | # CONFIG_ARCH_L7200 is not set |
163 | # CONFIG_ARCH_KIRKWOOD is not set | ||
164 | # CONFIG_ARCH_KS8695 is not set | ||
165 | # CONFIG_ARCH_NS9XXX is not set | ||
166 | # CONFIG_ARCH_LOKI is not set | ||
167 | # CONFIG_ARCH_MV78XX0 is not set | ||
168 | # CONFIG_ARCH_MXC is not set | ||
169 | # CONFIG_ARCH_ORION5X is not set | ||
170 | # CONFIG_ARCH_PNX4008 is not set | ||
72 | # CONFIG_ARCH_PXA is not set | 171 | # CONFIG_ARCH_PXA is not set |
172 | # CONFIG_ARCH_MMP is not set | ||
73 | # CONFIG_ARCH_RPC is not set | 173 | # CONFIG_ARCH_RPC is not set |
74 | # CONFIG_ARCH_SA1100 is not set | 174 | # CONFIG_ARCH_SA1100 is not set |
75 | # CONFIG_ARCH_S3C2410 is not set | 175 | # CONFIG_ARCH_S3C2410 is not set |
176 | # CONFIG_ARCH_S3C64XX is not set | ||
76 | # CONFIG_ARCH_SHARK is not set | 177 | # CONFIG_ARCH_SHARK is not set |
77 | # CONFIG_ARCH_LH7A40X is not set | 178 | # CONFIG_ARCH_LH7A40X is not set |
179 | # CONFIG_ARCH_DAVINCI is not set | ||
78 | # CONFIG_ARCH_OMAP is not set | 180 | # CONFIG_ARCH_OMAP is not set |
79 | # CONFIG_ARCH_VERSATILE is not set | 181 | # CONFIG_ARCH_MSM is not set |
80 | # CONFIG_ARCH_IMX is not set | 182 | # CONFIG_ARCH_W90X900 is not set |
81 | # CONFIG_ARCH_H720X is not set | 183 | |
82 | # CONFIG_ARCH_AAEC2000 is not set | 184 | # |
83 | CONFIG_ARCH_AT91=y | 185 | # Atmel AT91 System-on-Chip |
186 | # | ||
84 | CONFIG_ARCH_AT91RM9200=y | 187 | CONFIG_ARCH_AT91RM9200=y |
188 | # CONFIG_ARCH_AT91SAM9260 is not set | ||
189 | # CONFIG_ARCH_AT91SAM9261 is not set | ||
190 | # CONFIG_ARCH_AT91SAM9263 is not set | ||
191 | # CONFIG_ARCH_AT91SAM9RL is not set | ||
192 | # CONFIG_ARCH_AT91SAM9G20 is not set | ||
193 | # CONFIG_ARCH_AT91CAP9 is not set | ||
194 | # CONFIG_ARCH_AT91X40 is not set | ||
195 | CONFIG_AT91_PMC_UNIT=y | ||
85 | 196 | ||
86 | # | 197 | # |
87 | # AT91RM9200 Implementations | 198 | # AT91RM9200 Board Type |
88 | # | 199 | # |
200 | # CONFIG_MACH_ONEARM is not set | ||
89 | # CONFIG_ARCH_AT91RM9200DK is not set | 201 | # CONFIG_ARCH_AT91RM9200DK is not set |
90 | # CONFIG_MACH_AT91RM9200EK is not set | 202 | # CONFIG_MACH_AT91RM9200EK is not set |
91 | # CONFIG_MACH_CSB337 is not set | 203 | # CONFIG_MACH_CSB337 is not set |
92 | # CONFIG_MACH_CSB637 is not set | 204 | # CONFIG_MACH_CSB637 is not set |
93 | # CONFIG_MACH_CARMEVA is not set | 205 | # CONFIG_MACH_CARMEVA is not set |
206 | # CONFIG_MACH_ATEB9200 is not set | ||
94 | CONFIG_MACH_KB9200=y | 207 | CONFIG_MACH_KB9200=y |
208 | # CONFIG_MACH_PICOTUX2XX is not set | ||
209 | # CONFIG_MACH_KAFA is not set | ||
210 | # CONFIG_MACH_ECBAT91 is not set | ||
211 | # CONFIG_MACH_YL9200 is not set | ||
212 | |||
213 | # | ||
214 | # AT91 Board Options | ||
215 | # | ||
216 | |||
217 | # | ||
218 | # AT91 Feature Selections | ||
219 | # | ||
220 | CONFIG_AT91_PROGRAMMABLE_CLOCKS=y | ||
221 | CONFIG_AT91_TIMER_HZ=128 | ||
222 | CONFIG_AT91_EARLY_DBGU=y | ||
223 | # CONFIG_AT91_EARLY_USART0 is not set | ||
224 | # CONFIG_AT91_EARLY_USART1 is not set | ||
225 | # CONFIG_AT91_EARLY_USART2 is not set | ||
226 | # CONFIG_AT91_EARLY_USART3 is not set | ||
227 | # CONFIG_AT91_EARLY_USART4 is not set | ||
228 | # CONFIG_AT91_EARLY_USART5 is not set | ||
95 | 229 | ||
96 | # | 230 | # |
97 | # Processor Type | 231 | # Processor Type |
98 | # | 232 | # |
99 | CONFIG_CPU_32=y | 233 | CONFIG_CPU_32=y |
100 | CONFIG_CPU_ARM920T=y | 234 | CONFIG_CPU_ARM920T=y |
101 | CONFIG_CPU_32v4=y | 235 | CONFIG_CPU_32v4T=y |
102 | CONFIG_CPU_ABRT_EV4T=y | 236 | CONFIG_CPU_ABRT_EV4T=y |
237 | CONFIG_CPU_PABRT_NOIFAR=y | ||
103 | CONFIG_CPU_CACHE_V4WT=y | 238 | CONFIG_CPU_CACHE_V4WT=y |
104 | CONFIG_CPU_CACHE_VIVT=y | 239 | CONFIG_CPU_CACHE_VIVT=y |
105 | CONFIG_CPU_COPY_V4WB=y | 240 | CONFIG_CPU_COPY_V4WB=y |
106 | CONFIG_CPU_TLB_V4WBI=y | 241 | CONFIG_CPU_TLB_V4WBI=y |
242 | CONFIG_CPU_CP15=y | ||
243 | CONFIG_CPU_CP15_MMU=y | ||
107 | 244 | ||
108 | # | 245 | # |
109 | # Processor Features | 246 | # Processor Features |
@@ -112,23 +249,48 @@ CONFIG_ARM_THUMB=y | |||
112 | # CONFIG_CPU_ICACHE_DISABLE is not set | 249 | # CONFIG_CPU_ICACHE_DISABLE is not set |
113 | # CONFIG_CPU_DCACHE_DISABLE is not set | 250 | # CONFIG_CPU_DCACHE_DISABLE is not set |
114 | # CONFIG_CPU_DCACHE_WRITETHROUGH is not set | 251 | # CONFIG_CPU_DCACHE_WRITETHROUGH is not set |
252 | # CONFIG_OUTER_CACHE is not set | ||
115 | 253 | ||
116 | # | 254 | # |
117 | # Bus support | 255 | # Bus support |
118 | # | 256 | # |
119 | CONFIG_ISA_DMA_API=y | 257 | # CONFIG_PCI_SYSCALL is not set |
120 | 258 | # CONFIG_ARCH_SUPPORTS_MSI is not set | |
121 | # | ||
122 | # PCCARD (PCMCIA/CardBus) support | ||
123 | # | ||
124 | # CONFIG_PCCARD is not set | 259 | # CONFIG_PCCARD is not set |
125 | 260 | ||
126 | # | 261 | # |
127 | # Kernel Features | 262 | # Kernel Features |
128 | # | 263 | # |
129 | # CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set | 264 | CONFIG_TICK_ONESHOT=y |
265 | CONFIG_NO_HZ=y | ||
266 | CONFIG_HIGH_RES_TIMERS=y | ||
267 | CONFIG_GENERIC_CLOCKEVENTS_BUILD=y | ||
268 | CONFIG_VMSPLIT_3G=y | ||
269 | # CONFIG_VMSPLIT_2G is not set | ||
270 | # CONFIG_VMSPLIT_1G is not set | ||
271 | CONFIG_PAGE_OFFSET=0xC0000000 | ||
272 | CONFIG_PREEMPT=y | ||
273 | CONFIG_HZ=128 | ||
274 | CONFIG_AEABI=y | ||
275 | CONFIG_OABI_COMPAT=y | ||
276 | # CONFIG_ARCH_HAS_HOLES_MEMORYMODEL is not set | ||
277 | # CONFIG_ARCH_SPARSEMEM_DEFAULT is not set | ||
278 | # CONFIG_ARCH_SELECT_MEMORY_MODEL is not set | ||
279 | # CONFIG_HIGHMEM is not set | ||
280 | CONFIG_SELECT_MEMORY_MODEL=y | ||
281 | CONFIG_FLATMEM_MANUAL=y | ||
282 | # CONFIG_DISCONTIGMEM_MANUAL is not set | ||
283 | # CONFIG_SPARSEMEM_MANUAL is not set | ||
130 | CONFIG_FLATMEM=y | 284 | CONFIG_FLATMEM=y |
131 | CONFIG_FLAT_NODE_MEM_MAP=y | 285 | CONFIG_FLAT_NODE_MEM_MAP=y |
286 | CONFIG_PAGEFLAGS_EXTENDED=y | ||
287 | CONFIG_SPLIT_PTLOCK_CPUS=4096 | ||
288 | # CONFIG_PHYS_ADDR_T_64BIT is not set | ||
289 | CONFIG_ZONE_DMA_FLAG=0 | ||
290 | CONFIG_VIRT_TO_BUS=y | ||
291 | CONFIG_UNEVICTABLE_LRU=y | ||
292 | CONFIG_HAVE_MLOCK=y | ||
293 | CONFIG_HAVE_MLOCKED_PAGE_BIT=y | ||
132 | # CONFIG_LEDS is not set | 294 | # CONFIG_LEDS is not set |
133 | CONFIG_ALIGNMENT_TRAP=y | 295 | CONFIG_ALIGNMENT_TRAP=y |
134 | 296 | ||
@@ -137,8 +299,16 @@ CONFIG_ALIGNMENT_TRAP=y | |||
137 | # | 299 | # |
138 | CONFIG_ZBOOT_ROM_TEXT=0x10000000 | 300 | CONFIG_ZBOOT_ROM_TEXT=0x10000000 |
139 | CONFIG_ZBOOT_ROM_BSS=0x20040000 | 301 | CONFIG_ZBOOT_ROM_BSS=0x20040000 |
140 | CONFIG_ZBOOT_ROM=y | 302 | # CONFIG_ZBOOT_ROM is not set |
141 | CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/ram rw initrd=0x20210000,654933" | 303 | CONFIG_CMDLINE="noinitrd root=/dev/mtdblock0 rootfstype=jffs2 mem=64M" |
304 | # CONFIG_XIP_KERNEL is not set | ||
305 | CONFIG_KEXEC=y | ||
306 | CONFIG_ATAGS_PROC=y | ||
307 | |||
308 | # | ||
309 | # CPU Power Management | ||
310 | # | ||
311 | # CONFIG_CPU_IDLE is not set | ||
142 | 312 | ||
143 | # | 313 | # |
144 | # Floating point emulation | 314 | # Floating point emulation |
@@ -149,74 +319,251 @@ CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/ram rw initrd=0x20210000,654933" | |||
149 | # | 319 | # |
150 | CONFIG_FPE_NWFPE=y | 320 | CONFIG_FPE_NWFPE=y |
151 | # CONFIG_FPE_NWFPE_XP is not set | 321 | # CONFIG_FPE_NWFPE_XP is not set |
322 | # CONFIG_FPE_FASTFPE is not set | ||
152 | 323 | ||
153 | # | 324 | # |
154 | # Userspace binary formats | 325 | # Userspace binary formats |
155 | # | 326 | # |
156 | CONFIG_BINFMT_ELF=y | 327 | CONFIG_BINFMT_ELF=y |
157 | CONFIG_BINFMT_AOUT=y | 328 | # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set |
329 | CONFIG_HAVE_AOUT=y | ||
330 | # CONFIG_BINFMT_AOUT is not set | ||
158 | CONFIG_BINFMT_MISC=y | 331 | CONFIG_BINFMT_MISC=y |
159 | # CONFIG_ARTHUR is not set | ||
160 | 332 | ||
161 | # | 333 | # |
162 | # Power management options | 334 | # Power management options |
163 | # | 335 | # |
164 | # CONFIG_PM is not set | 336 | # CONFIG_PM is not set |
337 | CONFIG_ARCH_SUSPEND_POSSIBLE=y | ||
338 | CONFIG_NET=y | ||
165 | 339 | ||
166 | # | 340 | # |
167 | # Device Drivers | 341 | # Networking options |
168 | # | 342 | # |
343 | CONFIG_PACKET=y | ||
344 | # CONFIG_PACKET_MMAP is not set | ||
345 | CONFIG_UNIX=y | ||
346 | # CONFIG_NET_KEY is not set | ||
347 | CONFIG_INET=y | ||
348 | # CONFIG_IP_MULTICAST is not set | ||
349 | # CONFIG_IP_ADVANCED_ROUTER is not set | ||
350 | CONFIG_IP_FIB_HASH=y | ||
351 | CONFIG_IP_PNP=y | ||
352 | CONFIG_IP_PNP_DHCP=y | ||
353 | CONFIG_IP_PNP_BOOTP=y | ||
354 | # CONFIG_IP_PNP_RARP is not set | ||
355 | # CONFIG_NET_IPIP is not set | ||
356 | # CONFIG_NET_IPGRE is not set | ||
357 | # CONFIG_ARPD is not set | ||
358 | # CONFIG_SYN_COOKIES is not set | ||
359 | # CONFIG_INET_AH is not set | ||
360 | # CONFIG_INET_ESP is not set | ||
361 | # CONFIG_INET_IPCOMP is not set | ||
362 | # CONFIG_INET_XFRM_TUNNEL is not set | ||
363 | # CONFIG_INET_TUNNEL is not set | ||
364 | # CONFIG_INET_XFRM_MODE_TRANSPORT is not set | ||
365 | # CONFIG_INET_XFRM_MODE_TUNNEL is not set | ||
366 | # CONFIG_INET_XFRM_MODE_BEET is not set | ||
367 | # CONFIG_INET_LRO is not set | ||
368 | # CONFIG_INET_DIAG is not set | ||
369 | # CONFIG_TCP_CONG_ADVANCED is not set | ||
370 | CONFIG_TCP_CONG_CUBIC=y | ||
371 | CONFIG_DEFAULT_TCP_CONG="cubic" | ||
372 | # CONFIG_TCP_MD5SIG is not set | ||
373 | # CONFIG_IPV6 is not set | ||
374 | # CONFIG_NETWORK_SECMARK is not set | ||
375 | # CONFIG_NETFILTER is not set | ||
376 | # CONFIG_IP_DCCP is not set | ||
377 | # CONFIG_IP_SCTP is not set | ||
378 | # CONFIG_TIPC is not set | ||
379 | # CONFIG_ATM is not set | ||
380 | # CONFIG_BRIDGE is not set | ||
381 | # CONFIG_NET_DSA is not set | ||
382 | # CONFIG_VLAN_8021Q is not set | ||
383 | # CONFIG_DECNET is not set | ||
384 | # CONFIG_LLC2 is not set | ||
385 | # CONFIG_IPX is not set | ||
386 | # CONFIG_ATALK is not set | ||
387 | # CONFIG_X25 is not set | ||
388 | # CONFIG_LAPB is not set | ||
389 | # CONFIG_ECONET is not set | ||
390 | # CONFIG_WAN_ROUTER is not set | ||
391 | # CONFIG_PHONET is not set | ||
392 | # CONFIG_NET_SCHED is not set | ||
393 | # CONFIG_DCB is not set | ||
169 | 394 | ||
170 | # | 395 | # |
171 | # Generic Driver Options | 396 | # Network testing |
172 | # | 397 | # |
173 | CONFIG_STANDALONE=y | 398 | # CONFIG_NET_PKTGEN is not set |
174 | CONFIG_PREVENT_FIRMWARE_BUILD=y | 399 | # CONFIG_NET_DROP_MONITOR is not set |
175 | # CONFIG_FW_LOADER is not set | 400 | # CONFIG_HAMRADIO is not set |
176 | CONFIG_DEBUG_DRIVER=y | 401 | # CONFIG_CAN is not set |
402 | # CONFIG_IRDA is not set | ||
403 | # CONFIG_BT is not set | ||
404 | # CONFIG_AF_RXRPC is not set | ||
405 | # CONFIG_WIRELESS is not set | ||
406 | # CONFIG_WIMAX is not set | ||
407 | # CONFIG_RFKILL is not set | ||
408 | # CONFIG_NET_9P is not set | ||
177 | 409 | ||
178 | # | 410 | # |
179 | # Memory Technology Devices (MTD) | 411 | # Device Drivers |
180 | # | 412 | # |
181 | # CONFIG_MTD is not set | ||
182 | 413 | ||
183 | # | 414 | # |
184 | # Parallel port support | 415 | # Generic Driver Options |
185 | # | 416 | # |
417 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | ||
418 | CONFIG_STANDALONE=y | ||
419 | CONFIG_PREVENT_FIRMWARE_BUILD=y | ||
420 | CONFIG_FW_LOADER=y | ||
421 | # CONFIG_FIRMWARE_IN_KERNEL is not set | ||
422 | CONFIG_EXTRA_FIRMWARE="" | ||
423 | # CONFIG_DEBUG_DRIVER is not set | ||
424 | # CONFIG_DEBUG_DEVRES is not set | ||
425 | # CONFIG_SYS_HYPERVISOR is not set | ||
426 | # CONFIG_CONNECTOR is not set | ||
427 | CONFIG_MTD=y | ||
428 | # CONFIG_MTD_DEBUG is not set | ||
429 | CONFIG_MTD_CONCAT=y | ||
430 | CONFIG_MTD_PARTITIONS=y | ||
431 | # CONFIG_MTD_TESTS is not set | ||
432 | # CONFIG_MTD_REDBOOT_PARTS is not set | ||
433 | CONFIG_MTD_CMDLINE_PARTS=y | ||
434 | # CONFIG_MTD_AFS_PARTS is not set | ||
435 | # CONFIG_MTD_AR7_PARTS is not set | ||
436 | |||
437 | # | ||
438 | # User Modules And Translation Layers | ||
439 | # | ||
440 | CONFIG_MTD_CHAR=y | ||
441 | CONFIG_MTD_BLKDEVS=y | ||
442 | CONFIG_MTD_BLOCK=y | ||
443 | # CONFIG_FTL is not set | ||
444 | # CONFIG_NFTL is not set | ||
445 | # CONFIG_INFTL is not set | ||
446 | # CONFIG_RFD_FTL is not set | ||
447 | # CONFIG_SSFDC is not set | ||
448 | # CONFIG_MTD_OOPS is not set | ||
449 | |||
450 | # | ||
451 | # RAM/ROM/Flash chip drivers | ||
452 | # | ||
453 | CONFIG_MTD_CFI=y | ||
454 | # CONFIG_MTD_JEDECPROBE is not set | ||
455 | CONFIG_MTD_GEN_PROBE=y | ||
456 | # CONFIG_MTD_CFI_ADV_OPTIONS is not set | ||
457 | CONFIG_MTD_MAP_BANK_WIDTH_1=y | ||
458 | CONFIG_MTD_MAP_BANK_WIDTH_2=y | ||
459 | CONFIG_MTD_MAP_BANK_WIDTH_4=y | ||
460 | # CONFIG_MTD_MAP_BANK_WIDTH_8 is not set | ||
461 | # CONFIG_MTD_MAP_BANK_WIDTH_16 is not set | ||
462 | # CONFIG_MTD_MAP_BANK_WIDTH_32 is not set | ||
463 | CONFIG_MTD_CFI_I1=y | ||
464 | CONFIG_MTD_CFI_I2=y | ||
465 | # CONFIG_MTD_CFI_I4 is not set | ||
466 | # CONFIG_MTD_CFI_I8 is not set | ||
467 | CONFIG_MTD_CFI_INTELEXT=y | ||
468 | # CONFIG_MTD_CFI_AMDSTD is not set | ||
469 | # CONFIG_MTD_CFI_STAA is not set | ||
470 | CONFIG_MTD_CFI_UTIL=y | ||
471 | # CONFIG_MTD_RAM is not set | ||
472 | # CONFIG_MTD_ROM is not set | ||
473 | # CONFIG_MTD_ABSENT is not set | ||
474 | |||
475 | # | ||
476 | # Mapping drivers for chip access | ||
477 | # | ||
478 | CONFIG_MTD_COMPLEX_MAPPINGS=y | ||
479 | CONFIG_MTD_PHYSMAP=y | ||
480 | # CONFIG_MTD_PHYSMAP_COMPAT is not set | ||
481 | # CONFIG_MTD_ARM_INTEGRATOR is not set | ||
482 | # CONFIG_MTD_PLATRAM is not set | ||
483 | |||
484 | # | ||
485 | # Self-contained MTD device drivers | ||
486 | # | ||
487 | # CONFIG_MTD_SLRAM is not set | ||
488 | # CONFIG_MTD_PHRAM is not set | ||
489 | # CONFIG_MTD_MTDRAM is not set | ||
490 | # CONFIG_MTD_BLOCK2MTD is not set | ||
491 | |||
492 | # | ||
493 | # Disk-On-Chip Device Drivers | ||
494 | # | ||
495 | # CONFIG_MTD_DOC2000 is not set | ||
496 | # CONFIG_MTD_DOC2001 is not set | ||
497 | # CONFIG_MTD_DOC2001PLUS is not set | ||
498 | CONFIG_MTD_NAND=y | ||
499 | # CONFIG_MTD_NAND_VERIFY_WRITE is not set | ||
500 | # CONFIG_MTD_NAND_ECC_SMC is not set | ||
501 | # CONFIG_MTD_NAND_MUSEUM_IDS is not set | ||
502 | # CONFIG_MTD_NAND_GPIO is not set | ||
503 | CONFIG_MTD_NAND_IDS=y | ||
504 | # CONFIG_MTD_NAND_DISKONCHIP is not set | ||
505 | CONFIG_MTD_NAND_ATMEL=y | ||
506 | # CONFIG_MTD_NAND_ATMEL_ECC_HW is not set | ||
507 | CONFIG_MTD_NAND_ATMEL_ECC_SOFT=y | ||
508 | # CONFIG_MTD_NAND_ATMEL_ECC_NONE is not set | ||
509 | # CONFIG_MTD_NAND_NANDSIM is not set | ||
510 | # CONFIG_MTD_NAND_PLATFORM is not set | ||
511 | # CONFIG_MTD_ALAUDA is not set | ||
512 | # CONFIG_MTD_ONENAND is not set | ||
513 | |||
514 | # | ||
515 | # LPDDR flash memory drivers | ||
516 | # | ||
517 | # CONFIG_MTD_LPDDR is not set | ||
518 | |||
519 | # | ||
520 | # UBI - Unsorted block images | ||
521 | # | ||
522 | CONFIG_MTD_UBI=y | ||
523 | CONFIG_MTD_UBI_WL_THRESHOLD=4096 | ||
524 | CONFIG_MTD_UBI_BEB_RESERVE=1 | ||
525 | CONFIG_MTD_UBI_GLUEBI=y | ||
526 | |||
527 | # | ||
528 | # UBI debugging options | ||
529 | # | ||
530 | # CONFIG_MTD_UBI_DEBUG is not set | ||
186 | # CONFIG_PARPORT is not set | 531 | # CONFIG_PARPORT is not set |
187 | 532 | CONFIG_BLK_DEV=y | |
188 | # | ||
189 | # Plug and Play support | ||
190 | # | ||
191 | |||
192 | # | ||
193 | # Block devices | ||
194 | # | ||
195 | # CONFIG_BLK_DEV_COW_COMMON is not set | 533 | # CONFIG_BLK_DEV_COW_COMMON is not set |
196 | CONFIG_BLK_DEV_LOOP=y | 534 | CONFIG_BLK_DEV_LOOP=y |
197 | # CONFIG_BLK_DEV_CRYPTOLOOP is not set | 535 | # CONFIG_BLK_DEV_CRYPTOLOOP is not set |
198 | CONFIG_BLK_DEV_NBD=y | 536 | # CONFIG_BLK_DEV_NBD is not set |
199 | # CONFIG_BLK_DEV_UB is not set | 537 | # CONFIG_BLK_DEV_UB is not set |
200 | CONFIG_BLK_DEV_RAM=y | 538 | CONFIG_BLK_DEV_RAM=y |
201 | CONFIG_BLK_DEV_RAM_COUNT=16 | 539 | CONFIG_BLK_DEV_RAM_COUNT=16 |
202 | CONFIG_BLK_DEV_RAM_SIZE=4096 | 540 | CONFIG_BLK_DEV_RAM_SIZE=16384 |
203 | CONFIG_BLK_DEV_INITRD=y | 541 | # CONFIG_BLK_DEV_XIP is not set |
204 | CONFIG_INITRAMFS_SOURCE="" | ||
205 | # CONFIG_CDROM_PKTCDVD is not set | 542 | # CONFIG_CDROM_PKTCDVD is not set |
543 | # CONFIG_ATA_OVER_ETH is not set | ||
544 | CONFIG_MISC_DEVICES=y | ||
545 | CONFIG_ATMEL_TCLIB=y | ||
546 | CONFIG_ATMEL_TCB_CLKSRC=y | ||
547 | CONFIG_ATMEL_TCB_CLKSRC_BLOCK=0 | ||
548 | CONFIG_ATMEL_SSC=y | ||
549 | # CONFIG_ENCLOSURE_SERVICES is not set | ||
550 | # CONFIG_C2PORT is not set | ||
206 | 551 | ||
207 | # | 552 | # |
208 | # IO Schedulers | 553 | # EEPROM support |
209 | # | 554 | # |
210 | CONFIG_IOSCHED_NOOP=y | 555 | # CONFIG_EEPROM_93CX6 is not set |
211 | CONFIG_IOSCHED_AS=y | 556 | CONFIG_HAVE_IDE=y |
212 | CONFIG_IOSCHED_DEADLINE=y | 557 | # CONFIG_IDE is not set |
213 | CONFIG_IOSCHED_CFQ=y | ||
214 | # CONFIG_ATA_OVER_ETH is not set | ||
215 | 558 | ||
216 | # | 559 | # |
217 | # SCSI device support | 560 | # SCSI device support |
218 | # | 561 | # |
562 | # CONFIG_RAID_ATTRS is not set | ||
219 | CONFIG_SCSI=y | 563 | CONFIG_SCSI=y |
564 | CONFIG_SCSI_DMA=y | ||
565 | # CONFIG_SCSI_TGT is not set | ||
566 | # CONFIG_SCSI_NETLINK is not set | ||
220 | CONFIG_SCSI_PROC_FS=y | 567 | CONFIG_SCSI_PROC_FS=y |
221 | 568 | ||
222 | # | 569 | # |
@@ -232,145 +579,87 @@ CONFIG_CHR_DEV_SG=y | |||
232 | # | 579 | # |
233 | # Some SCSI devices (e.g. CD jukebox) support multiple LUNs | 580 | # Some SCSI devices (e.g. CD jukebox) support multiple LUNs |
234 | # | 581 | # |
235 | # CONFIG_SCSI_MULTI_LUN is not set | 582 | CONFIG_SCSI_MULTI_LUN=y |
236 | # CONFIG_SCSI_CONSTANTS is not set | 583 | CONFIG_SCSI_CONSTANTS=y |
237 | # CONFIG_SCSI_LOGGING is not set | 584 | CONFIG_SCSI_LOGGING=y |
585 | # CONFIG_SCSI_SCAN_ASYNC is not set | ||
586 | CONFIG_SCSI_WAIT_SCAN=m | ||
238 | 587 | ||
239 | # | 588 | # |
240 | # SCSI Transport Attributes | 589 | # SCSI Transports |
241 | # | 590 | # |
242 | # CONFIG_SCSI_SPI_ATTRS is not set | 591 | CONFIG_SCSI_SPI_ATTRS=m |
243 | # CONFIG_SCSI_FC_ATTRS is not set | 592 | # CONFIG_SCSI_FC_ATTRS is not set |
244 | # CONFIG_SCSI_ISCSI_ATTRS is not set | 593 | # CONFIG_SCSI_ISCSI_ATTRS is not set |
245 | 594 | # CONFIG_SCSI_SAS_LIBSAS is not set | |
246 | # | 595 | # CONFIG_SCSI_SRP_ATTRS is not set |
247 | # SCSI low-level drivers | 596 | # CONFIG_SCSI_LOWLEVEL is not set |
248 | # | 597 | # CONFIG_SCSI_DH is not set |
249 | # CONFIG_SCSI_SATA is not set | 598 | # CONFIG_SCSI_OSD_INITIATOR is not set |
250 | # CONFIG_SCSI_DEBUG is not set | 599 | # CONFIG_ATA is not set |
251 | |||
252 | # | ||
253 | # Multi-device support (RAID and LVM) | ||
254 | # | ||
255 | # CONFIG_MD is not set | 600 | # CONFIG_MD is not set |
256 | |||
257 | # | ||
258 | # Fusion MPT device support | ||
259 | # | ||
260 | # CONFIG_FUSION is not set | ||
261 | |||
262 | # | ||
263 | # IEEE 1394 (FireWire) support | ||
264 | # | ||
265 | |||
266 | # | ||
267 | # I2O device support | ||
268 | # | ||
269 | |||
270 | # | ||
271 | # Networking support | ||
272 | # | ||
273 | CONFIG_NET=y | ||
274 | |||
275 | # | ||
276 | # Networking options | ||
277 | # | ||
278 | CONFIG_PACKET=y | ||
279 | # CONFIG_PACKET_MMAP is not set | ||
280 | CONFIG_UNIX=y | ||
281 | # CONFIG_NET_KEY is not set | ||
282 | CONFIG_INET=y | ||
283 | CONFIG_IP_MULTICAST=y | ||
284 | # CONFIG_IP_ADVANCED_ROUTER is not set | ||
285 | CONFIG_IP_FIB_HASH=y | ||
286 | CONFIG_IP_PNP=y | ||
287 | CONFIG_IP_PNP_DHCP=y | ||
288 | # CONFIG_IP_PNP_BOOTP is not set | ||
289 | # CONFIG_IP_PNP_RARP is not set | ||
290 | # CONFIG_NET_IPIP is not set | ||
291 | # CONFIG_NET_IPGRE is not set | ||
292 | # CONFIG_IP_MROUTE is not set | ||
293 | # CONFIG_SYN_COOKIES is not set | ||
294 | # CONFIG_INET_AH is not set | ||
295 | # CONFIG_INET_ESP is not set | ||
296 | # CONFIG_INET_IPCOMP is not set | ||
297 | # CONFIG_INET_TUNNEL is not set | ||
298 | # CONFIG_IP_TCPDIAG is not set | ||
299 | # CONFIG_IP_TCPDIAG_IPV6 is not set | ||
300 | # CONFIG_TCP_CONG_ADVANCED is not set | ||
301 | CONFIG_TCP_CONG_BIC=y | ||
302 | # CONFIG_IPV6 is not set | ||
303 | # CONFIG_NETFILTER is not set | ||
304 | # CONFIG_BRIDGE is not set | ||
305 | # CONFIG_VLAN_8021Q is not set | ||
306 | # CONFIG_DECNET is not set | ||
307 | # CONFIG_LLC2 is not set | ||
308 | # CONFIG_IPX is not set | ||
309 | # CONFIG_ATALK is not set | ||
310 | |||
311 | # | ||
312 | # QoS and/or fair queueing | ||
313 | # | ||
314 | # CONFIG_NET_SCHED is not set | ||
315 | # CONFIG_NET_CLS_ROUTE is not set | ||
316 | |||
317 | # | ||
318 | # Network testing | ||
319 | # | ||
320 | # CONFIG_NET_PKTGEN is not set | ||
321 | # CONFIG_NETPOLL is not set | ||
322 | # CONFIG_NET_POLL_CONTROLLER is not set | ||
323 | # CONFIG_HAMRADIO is not set | ||
324 | # CONFIG_IRDA is not set | ||
325 | # CONFIG_BT is not set | ||
326 | CONFIG_NETDEVICES=y | 601 | CONFIG_NETDEVICES=y |
602 | CONFIG_COMPAT_NET_DEV_OPS=y | ||
327 | # CONFIG_DUMMY is not set | 603 | # CONFIG_DUMMY is not set |
328 | # CONFIG_BONDING is not set | 604 | # CONFIG_BONDING is not set |
605 | # CONFIG_MACVLAN is not set | ||
329 | # CONFIG_EQUALIZER is not set | 606 | # CONFIG_EQUALIZER is not set |
330 | # CONFIG_TUN is not set | 607 | # CONFIG_TUN is not set |
331 | 608 | # CONFIG_VETH is not set | |
332 | # | 609 | # CONFIG_PHYLIB is not set |
333 | # Ethernet (10 or 100Mbit) | ||
334 | # | ||
335 | CONFIG_NET_ETHERNET=y | 610 | CONFIG_NET_ETHERNET=y |
336 | CONFIG_MII=y | 611 | CONFIG_MII=y |
337 | CONFIG_ARM_AT91_ETHER=y | 612 | CONFIG_ARM_AT91_ETHER=y |
613 | # CONFIG_AX88796 is not set | ||
338 | # CONFIG_SMC91X is not set | 614 | # CONFIG_SMC91X is not set |
339 | # CONFIG_DM9000 is not set | 615 | # CONFIG_DM9000 is not set |
616 | # CONFIG_ETHOC is not set | ||
617 | # CONFIG_SMC911X is not set | ||
618 | # CONFIG_SMSC911X is not set | ||
619 | # CONFIG_DNET is not set | ||
620 | # CONFIG_IBM_NEW_EMAC_ZMII is not set | ||
621 | # CONFIG_IBM_NEW_EMAC_RGMII is not set | ||
622 | # CONFIG_IBM_NEW_EMAC_TAH is not set | ||
623 | # CONFIG_IBM_NEW_EMAC_EMAC4 is not set | ||
624 | # CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set | ||
625 | # CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set | ||
626 | # CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set | ||
627 | # CONFIG_B44 is not set | ||
628 | # CONFIG_NETDEV_1000 is not set | ||
629 | # CONFIG_NETDEV_10000 is not set | ||
340 | 630 | ||
341 | # | 631 | # |
342 | # Ethernet (1000 Mbit) | 632 | # Wireless LAN |
343 | # | ||
344 | |||
345 | # | ||
346 | # Ethernet (10000 Mbit) | ||
347 | # | ||
348 | |||
349 | # | ||
350 | # Token Ring devices | ||
351 | # | 633 | # |
634 | # CONFIG_WLAN_PRE80211 is not set | ||
635 | # CONFIG_WLAN_80211 is not set | ||
352 | 636 | ||
353 | # | 637 | # |
354 | # Wireless LAN (non-hamradio) | 638 | # Enable WiMAX (Networking options) to see the WiMAX drivers |
355 | # | 639 | # |
356 | # CONFIG_NET_RADIO is not set | ||
357 | 640 | ||
358 | # | 641 | # |
359 | # Wan interfaces | 642 | # USB Network Adapters |
360 | # | 643 | # |
644 | # CONFIG_USB_CATC is not set | ||
645 | # CONFIG_USB_KAWETH is not set | ||
646 | # CONFIG_USB_PEGASUS is not set | ||
647 | # CONFIG_USB_RTL8150 is not set | ||
648 | # CONFIG_USB_USBNET is not set | ||
361 | # CONFIG_WAN is not set | 649 | # CONFIG_WAN is not set |
362 | # CONFIG_PPP is not set | 650 | # CONFIG_PPP is not set |
363 | # CONFIG_SLIP is not set | 651 | # CONFIG_SLIP is not set |
364 | 652 | # CONFIG_NETCONSOLE is not set | |
365 | # | 653 | # CONFIG_NETPOLL is not set |
366 | # ISDN subsystem | 654 | # CONFIG_NET_POLL_CONTROLLER is not set |
367 | # | ||
368 | # CONFIG_ISDN is not set | 655 | # CONFIG_ISDN is not set |
369 | 656 | ||
370 | # | 657 | # |
371 | # Input device support | 658 | # Input device support |
372 | # | 659 | # |
373 | CONFIG_INPUT=y | 660 | CONFIG_INPUT=y |
661 | # CONFIG_INPUT_FF_MEMLESS is not set | ||
662 | # CONFIG_INPUT_POLLDEV is not set | ||
374 | 663 | ||
375 | # | 664 | # |
376 | # Userland interfaces | 665 | # Userland interfaces |
@@ -380,7 +669,6 @@ CONFIG_INPUT_MOUSEDEV=y | |||
380 | CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 | 669 | CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 |
381 | CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 | 670 | CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 |
382 | # CONFIG_INPUT_JOYDEV is not set | 671 | # CONFIG_INPUT_JOYDEV is not set |
383 | # CONFIG_INPUT_TSDEV is not set | ||
384 | # CONFIG_INPUT_EVDEV is not set | 672 | # CONFIG_INPUT_EVDEV is not set |
385 | # CONFIG_INPUT_EVBUG is not set | 673 | # CONFIG_INPUT_EVBUG is not set |
386 | 674 | ||
@@ -390,23 +678,25 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 | |||
390 | # CONFIG_INPUT_KEYBOARD is not set | 678 | # CONFIG_INPUT_KEYBOARD is not set |
391 | # CONFIG_INPUT_MOUSE is not set | 679 | # CONFIG_INPUT_MOUSE is not set |
392 | # CONFIG_INPUT_JOYSTICK is not set | 680 | # CONFIG_INPUT_JOYSTICK is not set |
681 | # CONFIG_INPUT_TABLET is not set | ||
393 | # CONFIG_INPUT_TOUCHSCREEN is not set | 682 | # CONFIG_INPUT_TOUCHSCREEN is not set |
394 | # CONFIG_INPUT_MISC is not set | 683 | # CONFIG_INPUT_MISC is not set |
395 | 684 | ||
396 | # | 685 | # |
397 | # Hardware I/O ports | 686 | # Hardware I/O ports |
398 | # | 687 | # |
399 | CONFIG_SERIO=y | 688 | # CONFIG_SERIO is not set |
400 | # CONFIG_SERIO_SERPORT is not set | ||
401 | # CONFIG_SERIO_RAW is not set | ||
402 | # CONFIG_GAMEPORT is not set | 689 | # CONFIG_GAMEPORT is not set |
403 | 690 | ||
404 | # | 691 | # |
405 | # Character devices | 692 | # Character devices |
406 | # | 693 | # |
407 | CONFIG_VT=y | 694 | CONFIG_VT=y |
695 | CONFIG_CONSOLE_TRANSLATIONS=y | ||
408 | CONFIG_VT_CONSOLE=y | 696 | CONFIG_VT_CONSOLE=y |
409 | CONFIG_HW_CONSOLE=y | 697 | CONFIG_HW_CONSOLE=y |
698 | # CONFIG_VT_HW_CONSOLE_BINDING is not set | ||
699 | CONFIG_DEVKMEM=y | ||
410 | # CONFIG_SERIAL_NONSTANDARD is not set | 700 | # CONFIG_SERIAL_NONSTANDARD is not set |
411 | 701 | ||
412 | # | 702 | # |
@@ -419,215 +709,362 @@ CONFIG_HW_CONSOLE=y | |||
419 | # | 709 | # |
420 | CONFIG_SERIAL_ATMEL=y | 710 | CONFIG_SERIAL_ATMEL=y |
421 | CONFIG_SERIAL_ATMEL_CONSOLE=y | 711 | CONFIG_SERIAL_ATMEL_CONSOLE=y |
712 | CONFIG_SERIAL_ATMEL_PDC=y | ||
713 | # CONFIG_SERIAL_ATMEL_TTYAT is not set | ||
422 | CONFIG_SERIAL_CORE=y | 714 | CONFIG_SERIAL_CORE=y |
423 | CONFIG_SERIAL_CORE_CONSOLE=y | 715 | CONFIG_SERIAL_CORE_CONSOLE=y |
424 | CONFIG_UNIX98_PTYS=y | 716 | CONFIG_UNIX98_PTYS=y |
425 | CONFIG_LEGACY_PTYS=y | 717 | # CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set |
426 | CONFIG_LEGACY_PTY_COUNT=256 | 718 | # CONFIG_LEGACY_PTYS is not set |
719 | # CONFIG_IPMI_HANDLER is not set | ||
720 | # CONFIG_HW_RANDOM is not set | ||
721 | # CONFIG_R3964 is not set | ||
722 | # CONFIG_RAW_DRIVER is not set | ||
723 | # CONFIG_TCG_TPM is not set | ||
724 | # CONFIG_I2C is not set | ||
725 | # CONFIG_SPI is not set | ||
726 | CONFIG_ARCH_REQUIRE_GPIOLIB=y | ||
727 | CONFIG_GPIOLIB=y | ||
728 | # CONFIG_DEBUG_GPIO is not set | ||
729 | # CONFIG_GPIO_SYSFS is not set | ||
427 | 730 | ||
428 | # | 731 | # |
429 | # IPMI | 732 | # Memory mapped GPIO expanders: |
430 | # | 733 | # |
431 | # CONFIG_IPMI_HANDLER is not set | ||
432 | 734 | ||
433 | # | 735 | # |
434 | # Watchdog Cards | 736 | # I2C GPIO expanders: |
435 | # | 737 | # |
436 | # CONFIG_WATCHDOG is not set | ||
437 | # CONFIG_NVRAM is not set | ||
438 | # CONFIG_RTC is not set | ||
439 | # CONFIG_AT91RM9200_RTC is not set | ||
440 | # CONFIG_DTLK is not set | ||
441 | # CONFIG_R3964 is not set | ||
442 | 738 | ||
443 | # | 739 | # |
444 | # Ftape, the floppy tape device driver | 740 | # PCI GPIO expanders: |
445 | # | 741 | # |
446 | # CONFIG_RAW_DRIVER is not set | ||
447 | 742 | ||
448 | # | 743 | # |
449 | # TPM devices | 744 | # SPI GPIO expanders: |
450 | # | 745 | # |
451 | # CONFIG_AT91_SPI is not set | 746 | # CONFIG_W1 is not set |
747 | # CONFIG_POWER_SUPPLY is not set | ||
748 | # CONFIG_HWMON is not set | ||
749 | # CONFIG_THERMAL is not set | ||
750 | # CONFIG_THERMAL_HWMON is not set | ||
751 | CONFIG_WATCHDOG=y | ||
752 | # CONFIG_WATCHDOG_NOWAYOUT is not set | ||
452 | 753 | ||
453 | # | 754 | # |
454 | # I2C support | 755 | # Watchdog Device Drivers |
455 | # | 756 | # |
456 | # CONFIG_I2C is not set | 757 | # CONFIG_SOFT_WATCHDOG is not set |
758 | CONFIG_AT91RM9200_WATCHDOG=y | ||
759 | |||
760 | # | ||
761 | # USB-based Watchdog Cards | ||
762 | # | ||
763 | # CONFIG_USBPCWATCHDOG is not set | ||
764 | CONFIG_SSB_POSSIBLE=y | ||
457 | 765 | ||
458 | # | 766 | # |
459 | # Misc devices | 767 | # Sonics Silicon Backplane |
460 | # | 768 | # |
769 | # CONFIG_SSB is not set | ||
770 | |||
771 | # | ||
772 | # Multifunction device drivers | ||
773 | # | ||
774 | # CONFIG_MFD_CORE is not set | ||
775 | # CONFIG_MFD_SM501 is not set | ||
776 | # CONFIG_MFD_ASIC3 is not set | ||
777 | # CONFIG_HTC_EGPIO is not set | ||
778 | # CONFIG_HTC_PASIC3 is not set | ||
779 | # CONFIG_MFD_TMIO is not set | ||
780 | # CONFIG_MFD_T7L66XB is not set | ||
781 | # CONFIG_MFD_TC6387XB is not set | ||
782 | # CONFIG_MFD_TC6393XB is not set | ||
461 | 783 | ||
462 | # | 784 | # |
463 | # Multimedia devices | 785 | # Multimedia devices |
464 | # | 786 | # |
787 | |||
788 | # | ||
789 | # Multimedia core support | ||
790 | # | ||
465 | # CONFIG_VIDEO_DEV is not set | 791 | # CONFIG_VIDEO_DEV is not set |
792 | # CONFIG_DVB_CORE is not set | ||
793 | # CONFIG_VIDEO_MEDIA is not set | ||
466 | 794 | ||
467 | # | 795 | # |
468 | # Digital Video Broadcasting Devices | 796 | # Multimedia drivers |
469 | # | 797 | # |
470 | # CONFIG_DVB is not set | 798 | # CONFIG_DAB is not set |
471 | 799 | ||
472 | # | 800 | # |
473 | # Graphics support | 801 | # Graphics support |
474 | # | 802 | # |
475 | # CONFIG_FB is not set | 803 | # CONFIG_VGASTATE is not set |
804 | # CONFIG_VIDEO_OUTPUT_CONTROL is not set | ||
805 | CONFIG_FB=y | ||
806 | # CONFIG_FIRMWARE_EDID is not set | ||
807 | # CONFIG_FB_DDC is not set | ||
808 | # CONFIG_FB_BOOT_VESA_SUPPORT is not set | ||
809 | # CONFIG_FB_CFB_FILLRECT is not set | ||
810 | # CONFIG_FB_CFB_COPYAREA is not set | ||
811 | # CONFIG_FB_CFB_IMAGEBLIT is not set | ||
812 | # CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set | ||
813 | # CONFIG_FB_SYS_FILLRECT is not set | ||
814 | # CONFIG_FB_SYS_COPYAREA is not set | ||
815 | # CONFIG_FB_SYS_IMAGEBLIT is not set | ||
816 | # CONFIG_FB_FOREIGN_ENDIAN is not set | ||
817 | # CONFIG_FB_SYS_FOPS is not set | ||
818 | # CONFIG_FB_SVGALIB is not set | ||
819 | # CONFIG_FB_MACMODES is not set | ||
820 | # CONFIG_FB_BACKLIGHT is not set | ||
821 | CONFIG_FB_MODE_HELPERS=y | ||
822 | CONFIG_FB_TILEBLITTING=y | ||
823 | |||
824 | # | ||
825 | # Frame buffer hardware drivers | ||
826 | # | ||
827 | # CONFIG_FB_S1D13XXX is not set | ||
828 | # CONFIG_FB_VIRTUAL is not set | ||
829 | # CONFIG_FB_METRONOME is not set | ||
830 | # CONFIG_FB_MB862XX is not set | ||
831 | # CONFIG_FB_BROADSHEET is not set | ||
832 | CONFIG_BACKLIGHT_LCD_SUPPORT=y | ||
833 | # CONFIG_LCD_CLASS_DEVICE is not set | ||
834 | CONFIG_BACKLIGHT_CLASS_DEVICE=y | ||
835 | # CONFIG_BACKLIGHT_GENERIC is not set | ||
836 | |||
837 | # | ||
838 | # Display device support | ||
839 | # | ||
840 | # CONFIG_DISPLAY_SUPPORT is not set | ||
476 | 841 | ||
477 | # | 842 | # |
478 | # Console display driver support | 843 | # Console display driver support |
479 | # | 844 | # |
480 | # CONFIG_VGA_CONSOLE is not set | 845 | # CONFIG_VGA_CONSOLE is not set |
481 | CONFIG_DUMMY_CONSOLE=y | 846 | CONFIG_DUMMY_CONSOLE=y |
482 | 847 | CONFIG_FRAMEBUFFER_CONSOLE=y | |
483 | # | 848 | # CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set |
484 | # Sound | 849 | # CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set |
485 | # | 850 | CONFIG_FONTS=y |
851 | # CONFIG_FONT_8x8 is not set | ||
852 | # CONFIG_FONT_8x16 is not set | ||
853 | # CONFIG_FONT_6x11 is not set | ||
854 | # CONFIG_FONT_7x14 is not set | ||
855 | # CONFIG_FONT_PEARL_8x8 is not set | ||
856 | # CONFIG_FONT_ACORN_8x8 is not set | ||
857 | CONFIG_FONT_MINI_4x6=y | ||
858 | # CONFIG_FONT_SUN8x16 is not set | ||
859 | # CONFIG_FONT_SUN12x22 is not set | ||
860 | # CONFIG_FONT_10x18 is not set | ||
861 | # CONFIG_LOGO is not set | ||
486 | # CONFIG_SOUND is not set | 862 | # CONFIG_SOUND is not set |
487 | 863 | # CONFIG_HID_SUPPORT is not set | |
488 | # | 864 | CONFIG_USB_SUPPORT=y |
489 | # USB support | ||
490 | # | ||
491 | CONFIG_USB_ARCH_HAS_HCD=y | 865 | CONFIG_USB_ARCH_HAS_HCD=y |
492 | CONFIG_USB_ARCH_HAS_OHCI=y | 866 | CONFIG_USB_ARCH_HAS_OHCI=y |
867 | # CONFIG_USB_ARCH_HAS_EHCI is not set | ||
493 | CONFIG_USB=y | 868 | CONFIG_USB=y |
494 | CONFIG_USB_DEBUG=y | 869 | # CONFIG_USB_DEBUG is not set |
870 | # CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set | ||
495 | 871 | ||
496 | # | 872 | # |
497 | # Miscellaneous USB options | 873 | # Miscellaneous USB options |
498 | # | 874 | # |
499 | CONFIG_USB_DEVICEFS=y | 875 | CONFIG_USB_DEVICEFS=y |
876 | CONFIG_USB_DEVICE_CLASS=y | ||
877 | # CONFIG_USB_DYNAMIC_MINORS is not set | ||
878 | # CONFIG_USB_OTG is not set | ||
879 | # CONFIG_USB_MON is not set | ||
880 | # CONFIG_USB_WUSB is not set | ||
881 | # CONFIG_USB_WUSB_CBAF is not set | ||
500 | 882 | ||
501 | # | 883 | # |
502 | # USB Host Controller Drivers | 884 | # USB Host Controller Drivers |
503 | # | 885 | # |
886 | # CONFIG_USB_C67X00_HCD is not set | ||
887 | # CONFIG_USB_OXU210HP_HCD is not set | ||
504 | # CONFIG_USB_ISP116X_HCD is not set | 888 | # CONFIG_USB_ISP116X_HCD is not set |
889 | # CONFIG_USB_ISP1760_HCD is not set | ||
505 | CONFIG_USB_OHCI_HCD=y | 890 | CONFIG_USB_OHCI_HCD=y |
506 | # CONFIG_USB_OHCI_BIG_ENDIAN is not set | 891 | # CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set |
892 | # CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set | ||
507 | CONFIG_USB_OHCI_LITTLE_ENDIAN=y | 893 | CONFIG_USB_OHCI_LITTLE_ENDIAN=y |
508 | # CONFIG_USB_SL811_HCD is not set | 894 | # CONFIG_USB_SL811_HCD is not set |
895 | # CONFIG_USB_R8A66597_HCD is not set | ||
896 | # CONFIG_USB_HWA_HCD is not set | ||
897 | # CONFIG_USB_MUSB_HDRC is not set | ||
509 | 898 | ||
510 | # | 899 | # |
511 | # USB Device Class drivers | 900 | # USB Device Class drivers |
512 | # | 901 | # |
513 | # CONFIG_USB_BLUETOOTH_TTY is not set | ||
514 | # CONFIG_USB_ACM is not set | 902 | # CONFIG_USB_ACM is not set |
515 | # CONFIG_USB_PRINTER is not set | 903 | # CONFIG_USB_PRINTER is not set |
904 | # CONFIG_USB_WDM is not set | ||
905 | # CONFIG_USB_TMC is not set | ||
516 | 906 | ||
517 | # | 907 | # |
518 | # NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information | 908 | # NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may |
519 | # | 909 | # |
520 | CONFIG_USB_STORAGE=y | ||
521 | CONFIG_USB_STORAGE_DEBUG=y | ||
522 | # CONFIG_USB_STORAGE_FREECOM is not set | ||
523 | # CONFIG_USB_STORAGE_DPCM is not set | ||
524 | |||
525 | # | ||
526 | # USB Input Devices | ||
527 | # | ||
528 | # CONFIG_USB_HID is not set | ||
529 | 910 | ||
530 | # | 911 | # |
531 | # USB HID Boot Protocol drivers | 912 | # also be needed; see USB_STORAGE Help for more info |
532 | # | 913 | # |
533 | # CONFIG_USB_KBD is not set | 914 | CONFIG_USB_STORAGE=y |
534 | # CONFIG_USB_MOUSE is not set | 915 | # CONFIG_USB_STORAGE_DEBUG is not set |
535 | # CONFIG_USB_AIPTEK is not set | 916 | # CONFIG_USB_STORAGE_DATAFAB is not set |
536 | # CONFIG_USB_WACOM is not set | 917 | # CONFIG_USB_STORAGE_FREECOM is not set |
537 | # CONFIG_USB_ACECAD is not set | 918 | # CONFIG_USB_STORAGE_ISD200 is not set |
538 | # CONFIG_USB_KBTAB is not set | 919 | # CONFIG_USB_STORAGE_USBAT is not set |
539 | # CONFIG_USB_POWERMATE is not set | 920 | # CONFIG_USB_STORAGE_SDDR09 is not set |
540 | # CONFIG_USB_MTOUCH is not set | 921 | # CONFIG_USB_STORAGE_SDDR55 is not set |
541 | # CONFIG_USB_ITMTOUCH is not set | 922 | # CONFIG_USB_STORAGE_JUMPSHOT is not set |
542 | # CONFIG_USB_EGALAX is not set | 923 | # CONFIG_USB_STORAGE_ALAUDA is not set |
543 | # CONFIG_USB_XPAD is not set | 924 | # CONFIG_USB_STORAGE_ONETOUCH is not set |
544 | # CONFIG_USB_ATI_REMOTE is not set | 925 | # CONFIG_USB_STORAGE_KARMA is not set |
926 | # CONFIG_USB_STORAGE_CYPRESS_ATACB is not set | ||
927 | CONFIG_USB_LIBUSUAL=y | ||
545 | 928 | ||
546 | # | 929 | # |
547 | # USB Imaging devices | 930 | # USB Imaging devices |
548 | # | 931 | # |
932 | # CONFIG_USB_MDC800 is not set | ||
549 | # CONFIG_USB_MICROTEK is not set | 933 | # CONFIG_USB_MICROTEK is not set |
550 | 934 | ||
551 | # | 935 | # |
552 | # USB Multimedia devices | 936 | # USB port drivers |
553 | # | 937 | # |
554 | # CONFIG_USB_DABUSB is not set | 938 | # CONFIG_USB_SERIAL is not set |
555 | 939 | ||
556 | # | 940 | # |
557 | # Video4Linux support is needed for USB Multimedia device support | 941 | # USB Miscellaneous drivers |
558 | # | 942 | # |
943 | # CONFIG_USB_EMI62 is not set | ||
944 | # CONFIG_USB_EMI26 is not set | ||
945 | # CONFIG_USB_ADUTUX is not set | ||
946 | # CONFIG_USB_SEVSEG is not set | ||
947 | # CONFIG_USB_RIO500 is not set | ||
948 | # CONFIG_USB_LEGOTOWER is not set | ||
949 | # CONFIG_USB_LCD is not set | ||
950 | # CONFIG_USB_BERRY_CHARGE is not set | ||
951 | # CONFIG_USB_LED is not set | ||
952 | # CONFIG_USB_CYPRESS_CY7C63 is not set | ||
953 | # CONFIG_USB_CYTHERM is not set | ||
954 | # CONFIG_USB_IDMOUSE is not set | ||
955 | # CONFIG_USB_FTDI_ELAN is not set | ||
956 | # CONFIG_USB_APPLEDISPLAY is not set | ||
957 | # CONFIG_USB_LD is not set | ||
958 | # CONFIG_USB_TRANCEVIBRATOR is not set | ||
959 | # CONFIG_USB_IOWARRIOR is not set | ||
960 | # CONFIG_USB_TEST is not set | ||
961 | # CONFIG_USB_ISIGHTFW is not set | ||
962 | # CONFIG_USB_VST is not set | ||
963 | # CONFIG_USB_GADGET is not set | ||
559 | 964 | ||
560 | # | 965 | # |
561 | # USB Network Adapters | 966 | # OTG and related infrastructure |
562 | # | 967 | # |
563 | # CONFIG_USB_KAWETH is not set | 968 | # CONFIG_USB_GPIO_VBUS is not set |
564 | # CONFIG_USB_PEGASUS is not set | 969 | # CONFIG_NOP_USB_XCEIV is not set |
565 | # CONFIG_USB_USBNET is not set | 970 | CONFIG_MMC=y |
566 | # CONFIG_USB_MON is not set | 971 | # CONFIG_MMC_DEBUG is not set |
972 | # CONFIG_MMC_UNSAFE_RESUME is not set | ||
567 | 973 | ||
568 | # | 974 | # |
569 | # USB port drivers | 975 | # MMC/SD/SDIO Card Drivers |
570 | # | 976 | # |
977 | CONFIG_MMC_BLOCK=y | ||
978 | CONFIG_MMC_BLOCK_BOUNCE=y | ||
979 | # CONFIG_SDIO_UART is not set | ||
980 | # CONFIG_MMC_TEST is not set | ||
571 | 981 | ||
572 | # | 982 | # |
573 | # USB Serial Converter support | 983 | # MMC/SD/SDIO Host Controller Drivers |
574 | # | 984 | # |
575 | # CONFIG_USB_SERIAL is not set | 985 | # CONFIG_MMC_SDHCI is not set |
986 | CONFIG_MMC_AT91=y | ||
987 | # CONFIG_MEMSTICK is not set | ||
988 | # CONFIG_ACCESSIBILITY is not set | ||
989 | # CONFIG_NEW_LEDS is not set | ||
990 | CONFIG_RTC_LIB=y | ||
991 | CONFIG_RTC_CLASS=y | ||
992 | CONFIG_RTC_HCTOSYS=y | ||
993 | CONFIG_RTC_HCTOSYS_DEVICE="rtc0" | ||
994 | # CONFIG_RTC_DEBUG is not set | ||
576 | 995 | ||
577 | # | 996 | # |
578 | # USB Miscellaneous drivers | 997 | # RTC interfaces |
579 | # | 998 | # |
580 | # CONFIG_USB_EMI62 is not set | 999 | CONFIG_RTC_INTF_SYSFS=y |
581 | # CONFIG_USB_EMI26 is not set | 1000 | CONFIG_RTC_INTF_PROC=y |
582 | # CONFIG_USB_LCD is not set | 1001 | CONFIG_RTC_INTF_DEV=y |
583 | # CONFIG_USB_LED is not set | 1002 | # CONFIG_RTC_INTF_DEV_UIE_EMUL is not set |
584 | # CONFIG_USB_CYTHERM is not set | 1003 | # CONFIG_RTC_DRV_TEST is not set |
585 | # CONFIG_USB_PHIDGETKIT is not set | ||
586 | # CONFIG_USB_PHIDGETSERVO is not set | ||
587 | # CONFIG_USB_IDMOUSE is not set | ||
588 | 1004 | ||
589 | # | 1005 | # |
590 | # USB DSL modem support | 1006 | # SPI RTC drivers |
591 | # | 1007 | # |
592 | 1008 | ||
593 | # | 1009 | # |
594 | # USB Gadget Support | 1010 | # Platform RTC drivers |
595 | # | 1011 | # |
596 | # CONFIG_USB_GADGET is not set | 1012 | # CONFIG_RTC_DRV_CMOS is not set |
1013 | # CONFIG_RTC_DRV_DS1286 is not set | ||
1014 | # CONFIG_RTC_DRV_DS1511 is not set | ||
1015 | # CONFIG_RTC_DRV_DS1553 is not set | ||
1016 | # CONFIG_RTC_DRV_DS1742 is not set | ||
1017 | # CONFIG_RTC_DRV_STK17TA8 is not set | ||
1018 | # CONFIG_RTC_DRV_M48T86 is not set | ||
1019 | # CONFIG_RTC_DRV_M48T35 is not set | ||
1020 | # CONFIG_RTC_DRV_M48T59 is not set | ||
1021 | # CONFIG_RTC_DRV_BQ4802 is not set | ||
1022 | # CONFIG_RTC_DRV_V3020 is not set | ||
597 | 1023 | ||
598 | # | 1024 | # |
599 | # MMC/SD Card support | 1025 | # on-CPU RTC drivers |
600 | # | 1026 | # |
601 | # CONFIG_MMC is not set | 1027 | CONFIG_RTC_DRV_AT91RM9200=y |
1028 | # CONFIG_DMADEVICES is not set | ||
1029 | # CONFIG_AUXDISPLAY is not set | ||
1030 | # CONFIG_REGULATOR is not set | ||
1031 | # CONFIG_UIO is not set | ||
1032 | # CONFIG_STAGING is not set | ||
602 | 1033 | ||
603 | # | 1034 | # |
604 | # File systems | 1035 | # File systems |
605 | # | 1036 | # |
606 | CONFIG_EXT2_FS=y | 1037 | CONFIG_EXT2_FS=y |
607 | CONFIG_EXT2_FS_XATTR=y | 1038 | # CONFIG_EXT2_FS_XATTR is not set |
608 | # CONFIG_EXT2_FS_POSIX_ACL is not set | ||
609 | # CONFIG_EXT2_FS_SECURITY is not set | ||
610 | # CONFIG_EXT2_FS_XIP is not set | 1039 | # CONFIG_EXT2_FS_XIP is not set |
611 | CONFIG_EXT3_FS=y | 1040 | CONFIG_EXT3_FS=y |
1041 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set | ||
612 | CONFIG_EXT3_FS_XATTR=y | 1042 | CONFIG_EXT3_FS_XATTR=y |
613 | # CONFIG_EXT3_FS_POSIX_ACL is not set | 1043 | # CONFIG_EXT3_FS_POSIX_ACL is not set |
614 | # CONFIG_EXT3_FS_SECURITY is not set | 1044 | # CONFIG_EXT3_FS_SECURITY is not set |
1045 | # CONFIG_EXT4_FS is not set | ||
615 | CONFIG_JBD=y | 1046 | CONFIG_JBD=y |
616 | # CONFIG_JBD_DEBUG is not set | 1047 | # CONFIG_JBD_DEBUG is not set |
617 | CONFIG_FS_MBCACHE=y | 1048 | CONFIG_FS_MBCACHE=y |
618 | # CONFIG_REISERFS_FS is not set | 1049 | # CONFIG_REISERFS_FS is not set |
619 | # CONFIG_JFS_FS is not set | 1050 | # CONFIG_JFS_FS is not set |
1051 | # CONFIG_FS_POSIX_ACL is not set | ||
1052 | CONFIG_FILE_LOCKING=y | ||
1053 | # CONFIG_XFS_FS is not set | ||
1054 | # CONFIG_OCFS2_FS is not set | ||
1055 | # CONFIG_BTRFS_FS is not set | ||
1056 | # CONFIG_DNOTIFY is not set | ||
1057 | CONFIG_INOTIFY=y | ||
1058 | CONFIG_INOTIFY_USER=y | ||
1059 | # CONFIG_QUOTA is not set | ||
1060 | # CONFIG_AUTOFS_FS is not set | ||
1061 | # CONFIG_AUTOFS4_FS is not set | ||
1062 | # CONFIG_FUSE_FS is not set | ||
620 | 1063 | ||
621 | # | 1064 | # |
622 | # XFS support | 1065 | # Caches |
623 | # | 1066 | # |
624 | # CONFIG_XFS_FS is not set | 1067 | # CONFIG_FSCACHE is not set |
625 | # CONFIG_MINIX_FS is not set | ||
626 | # CONFIG_ROMFS_FS is not set | ||
627 | # CONFIG_QUOTA is not set | ||
628 | CONFIG_DNOTIFY=y | ||
629 | CONFIG_AUTOFS_FS=y | ||
630 | CONFIG_AUTOFS4_FS=y | ||
631 | 1068 | ||
632 | # | 1069 | # |
633 | # CD-ROM/DVD Filesystems | 1070 | # CD-ROM/DVD Filesystems |
@@ -639,7 +1076,7 @@ CONFIG_AUTOFS4_FS=y | |||
639 | # DOS/FAT/NT Filesystems | 1076 | # DOS/FAT/NT Filesystems |
640 | # | 1077 | # |
641 | CONFIG_FAT_FS=y | 1078 | CONFIG_FAT_FS=y |
642 | CONFIG_MSDOS_FS=y | 1079 | # CONFIG_MSDOS_FS is not set |
643 | CONFIG_VFAT_FS=y | 1080 | CONFIG_VFAT_FS=y |
644 | CONFIG_FAT_DEFAULT_CODEPAGE=437 | 1081 | CONFIG_FAT_DEFAULT_CODEPAGE=437 |
645 | CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" | 1082 | CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" |
@@ -649,53 +1086,70 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" | |||
649 | # Pseudo filesystems | 1086 | # Pseudo filesystems |
650 | # | 1087 | # |
651 | CONFIG_PROC_FS=y | 1088 | CONFIG_PROC_FS=y |
1089 | CONFIG_PROC_SYSCTL=y | ||
1090 | CONFIG_PROC_PAGE_MONITOR=y | ||
652 | CONFIG_SYSFS=y | 1091 | CONFIG_SYSFS=y |
653 | CONFIG_DEVPTS_FS_XATTR=y | ||
654 | # CONFIG_DEVPTS_FS_SECURITY is not set | ||
655 | CONFIG_TMPFS=y | 1092 | CONFIG_TMPFS=y |
656 | # CONFIG_TMPFS_XATTR is not set | 1093 | # CONFIG_TMPFS_POSIX_ACL is not set |
657 | # CONFIG_HUGETLB_PAGE is not set | 1094 | # CONFIG_HUGETLB_PAGE is not set |
658 | CONFIG_RAMFS=y | 1095 | CONFIG_CONFIGFS_FS=y |
659 | 1096 | CONFIG_MISC_FILESYSTEMS=y | |
660 | # | 1097 | # CONFIG_ADFS_FS is not set |
661 | # Miscellaneous filesystems | 1098 | # CONFIG_AFFS_FS is not set |
662 | # | 1099 | # CONFIG_HFS_FS is not set |
663 | # CONFIG_HFSPLUS_FS is not set | 1100 | # CONFIG_HFSPLUS_FS is not set |
1101 | # CONFIG_BEFS_FS is not set | ||
1102 | # CONFIG_BFS_FS is not set | ||
1103 | # CONFIG_EFS_FS is not set | ||
1104 | CONFIG_JFFS2_FS=y | ||
1105 | CONFIG_JFFS2_FS_DEBUG=0 | ||
1106 | CONFIG_JFFS2_FS_WRITEBUFFER=y | ||
1107 | # CONFIG_JFFS2_FS_WBUF_VERIFY is not set | ||
1108 | # CONFIG_JFFS2_SUMMARY is not set | ||
1109 | # CONFIG_JFFS2_FS_XATTR is not set | ||
1110 | # CONFIG_JFFS2_COMPRESSION_OPTIONS is not set | ||
1111 | CONFIG_JFFS2_ZLIB=y | ||
1112 | # CONFIG_JFFS2_LZO is not set | ||
1113 | CONFIG_JFFS2_RTIME=y | ||
1114 | # CONFIG_JFFS2_RUBIN is not set | ||
1115 | # CONFIG_UBIFS_FS is not set | ||
664 | # CONFIG_CRAMFS is not set | 1116 | # CONFIG_CRAMFS is not set |
1117 | # CONFIG_SQUASHFS is not set | ||
665 | # CONFIG_VXFS_FS is not set | 1118 | # CONFIG_VXFS_FS is not set |
1119 | # CONFIG_MINIX_FS is not set | ||
1120 | # CONFIG_OMFS_FS is not set | ||
666 | # CONFIG_HPFS_FS is not set | 1121 | # CONFIG_HPFS_FS is not set |
667 | # CONFIG_QNX4FS_FS is not set | 1122 | # CONFIG_QNX4FS_FS is not set |
1123 | # CONFIG_ROMFS_FS is not set | ||
668 | # CONFIG_SYSV_FS is not set | 1124 | # CONFIG_SYSV_FS is not set |
669 | # CONFIG_UFS_FS is not set | 1125 | # CONFIG_UFS_FS is not set |
670 | 1126 | # CONFIG_NILFS2_FS is not set | |
671 | # | 1127 | CONFIG_NETWORK_FILESYSTEMS=y |
672 | # Network File Systems | ||
673 | # | ||
674 | CONFIG_NFS_FS=y | 1128 | CONFIG_NFS_FS=y |
675 | CONFIG_NFS_V3=y | 1129 | CONFIG_NFS_V3=y |
676 | # CONFIG_NFS_V3_ACL is not set | 1130 | # CONFIG_NFS_V3_ACL is not set |
677 | # CONFIG_NFSD is not set | 1131 | # CONFIG_NFS_V4 is not set |
678 | CONFIG_ROOT_NFS=y | 1132 | CONFIG_ROOT_NFS=y |
1133 | # CONFIG_NFSD is not set | ||
679 | CONFIG_LOCKD=y | 1134 | CONFIG_LOCKD=y |
680 | CONFIG_LOCKD_V4=y | 1135 | CONFIG_LOCKD_V4=y |
681 | CONFIG_NFS_COMMON=y | 1136 | CONFIG_NFS_COMMON=y |
682 | CONFIG_SUNRPC=y | 1137 | CONFIG_SUNRPC=y |
1138 | # CONFIG_RPCSEC_GSS_KRB5 is not set | ||
1139 | # CONFIG_RPCSEC_GSS_SPKM3 is not set | ||
683 | # CONFIG_SMB_FS is not set | 1140 | # CONFIG_SMB_FS is not set |
684 | # CONFIG_CIFS is not set | 1141 | # CONFIG_CIFS is not set |
685 | # CONFIG_NCP_FS is not set | 1142 | # CONFIG_NCP_FS is not set |
686 | # CONFIG_CODA_FS is not set | 1143 | # CONFIG_CODA_FS is not set |
1144 | # CONFIG_AFS_FS is not set | ||
687 | 1145 | ||
688 | # | 1146 | # |
689 | # Partition Types | 1147 | # Partition Types |
690 | # | 1148 | # |
691 | # CONFIG_PARTITION_ADVANCED is not set | 1149 | # CONFIG_PARTITION_ADVANCED is not set |
692 | CONFIG_MSDOS_PARTITION=y | 1150 | CONFIG_MSDOS_PARTITION=y |
693 | |||
694 | # | ||
695 | # Native Language Support | ||
696 | # | ||
697 | CONFIG_NLS=y | 1151 | CONFIG_NLS=y |
698 | CONFIG_NLS_DEFAULT="utf8" | 1152 | CONFIG_NLS_DEFAULT="iso8859-1" |
699 | CONFIG_NLS_CODEPAGE_437=y | 1153 | CONFIG_NLS_CODEPAGE_437=y |
700 | # CONFIG_NLS_CODEPAGE_737 is not set | 1154 | # CONFIG_NLS_CODEPAGE_737 is not set |
701 | # CONFIG_NLS_CODEPAGE_775 is not set | 1155 | # CONFIG_NLS_CODEPAGE_775 is not set |
@@ -719,7 +1173,7 @@ CONFIG_NLS_CODEPAGE_437=y | |||
719 | # CONFIG_NLS_ISO8859_8 is not set | 1173 | # CONFIG_NLS_ISO8859_8 is not set |
720 | # CONFIG_NLS_CODEPAGE_1250 is not set | 1174 | # CONFIG_NLS_CODEPAGE_1250 is not set |
721 | # CONFIG_NLS_CODEPAGE_1251 is not set | 1175 | # CONFIG_NLS_CODEPAGE_1251 is not set |
722 | CONFIG_NLS_ASCII=y | 1176 | # CONFIG_NLS_ASCII is not set |
723 | # CONFIG_NLS_ISO8859_1 is not set | 1177 | # CONFIG_NLS_ISO8859_1 is not set |
724 | # CONFIG_NLS_ISO8859_2 is not set | 1178 | # CONFIG_NLS_ISO8859_2 is not set |
725 | # CONFIG_NLS_ISO8859_3 is not set | 1179 | # CONFIG_NLS_ISO8859_3 is not set |
@@ -733,47 +1187,119 @@ CONFIG_NLS_ASCII=y | |||
733 | # CONFIG_NLS_ISO8859_15 is not set | 1187 | # CONFIG_NLS_ISO8859_15 is not set |
734 | # CONFIG_NLS_KOI8_R is not set | 1188 | # CONFIG_NLS_KOI8_R is not set |
735 | # CONFIG_NLS_KOI8_U is not set | 1189 | # CONFIG_NLS_KOI8_U is not set |
736 | # CONFIG_NLS_UTF8 is not set | 1190 | CONFIG_NLS_UTF8=y |
1191 | # CONFIG_DLM is not set | ||
737 | 1192 | ||
738 | # | 1193 | # |
739 | # Kernel hacking | 1194 | # Kernel hacking |
740 | # | 1195 | # |
741 | # CONFIG_PRINTK_TIME is not set | 1196 | # CONFIG_PRINTK_TIME is not set |
1197 | CONFIG_ENABLE_WARN_DEPRECATED=y | ||
1198 | CONFIG_ENABLE_MUST_CHECK=y | ||
1199 | CONFIG_FRAME_WARN=1024 | ||
1200 | CONFIG_MAGIC_SYSRQ=y | ||
1201 | # CONFIG_UNUSED_SYMBOLS is not set | ||
1202 | CONFIG_DEBUG_FS=y | ||
1203 | # CONFIG_HEADERS_CHECK is not set | ||
742 | CONFIG_DEBUG_KERNEL=y | 1204 | CONFIG_DEBUG_KERNEL=y |
743 | # CONFIG_MAGIC_SYSRQ is not set | 1205 | # CONFIG_DEBUG_SHIRQ is not set |
744 | CONFIG_LOG_BUF_SHIFT=14 | 1206 | CONFIG_DETECT_SOFTLOCKUP=y |
1207 | # CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set | ||
1208 | CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0 | ||
1209 | CONFIG_DETECT_HUNG_TASK=y | ||
1210 | # CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set | ||
1211 | CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0 | ||
1212 | # CONFIG_SCHED_DEBUG is not set | ||
745 | # CONFIG_SCHEDSTATS is not set | 1213 | # CONFIG_SCHEDSTATS is not set |
746 | # CONFIG_DEBUG_SLAB is not set | 1214 | # CONFIG_TIMER_STATS is not set |
1215 | # CONFIG_DEBUG_OBJECTS is not set | ||
1216 | # CONFIG_SLUB_DEBUG_ON is not set | ||
1217 | # CONFIG_SLUB_STATS is not set | ||
1218 | # CONFIG_DEBUG_PREEMPT is not set | ||
1219 | # CONFIG_DEBUG_RT_MUTEXES is not set | ||
1220 | # CONFIG_RT_MUTEX_TESTER is not set | ||
747 | # CONFIG_DEBUG_SPINLOCK is not set | 1221 | # CONFIG_DEBUG_SPINLOCK is not set |
1222 | # CONFIG_DEBUG_MUTEXES is not set | ||
1223 | # CONFIG_DEBUG_LOCK_ALLOC is not set | ||
1224 | # CONFIG_PROVE_LOCKING is not set | ||
1225 | # CONFIG_LOCK_STAT is not set | ||
748 | # CONFIG_DEBUG_SPINLOCK_SLEEP is not set | 1226 | # CONFIG_DEBUG_SPINLOCK_SLEEP is not set |
1227 | # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set | ||
749 | # CONFIG_DEBUG_KOBJECT is not set | 1228 | # CONFIG_DEBUG_KOBJECT is not set |
750 | CONFIG_DEBUG_BUGVERBOSE=y | 1229 | CONFIG_DEBUG_BUGVERBOSE=y |
751 | # CONFIG_DEBUG_INFO is not set | 1230 | # CONFIG_DEBUG_INFO is not set |
752 | # CONFIG_DEBUG_FS is not set | 1231 | # CONFIG_DEBUG_VM is not set |
753 | CONFIG_FRAME_POINTER=y | 1232 | # CONFIG_DEBUG_WRITECOUNT is not set |
754 | CONFIG_DEBUG_USER=y | 1233 | CONFIG_DEBUG_MEMORY_INIT=y |
755 | CONFIG_DEBUG_ERRORS=y | 1234 | # CONFIG_DEBUG_LIST is not set |
756 | CONFIG_DEBUG_LL=y | 1235 | # CONFIG_DEBUG_SG is not set |
757 | # CONFIG_DEBUG_ICEDCC is not set | 1236 | # CONFIG_DEBUG_NOTIFIERS is not set |
1237 | # CONFIG_BOOT_PRINTK_DELAY is not set | ||
1238 | # CONFIG_RCU_TORTURE_TEST is not set | ||
1239 | # CONFIG_RCU_CPU_STALL_DETECTOR is not set | ||
1240 | # CONFIG_BACKTRACE_SELF_TEST is not set | ||
1241 | # CONFIG_DEBUG_BLOCK_EXT_DEVT is not set | ||
1242 | # CONFIG_FAULT_INJECTION is not set | ||
1243 | # CONFIG_LATENCYTOP is not set | ||
1244 | # CONFIG_SYSCTL_SYSCALL_CHECK is not set | ||
1245 | # CONFIG_PAGE_POISONING is not set | ||
1246 | CONFIG_HAVE_FUNCTION_TRACER=y | ||
1247 | CONFIG_TRACING_SUPPORT=y | ||
1248 | |||
1249 | # | ||
1250 | # Tracers | ||
1251 | # | ||
1252 | # CONFIG_FUNCTION_TRACER is not set | ||
1253 | # CONFIG_IRQSOFF_TRACER is not set | ||
1254 | # CONFIG_PREEMPT_TRACER is not set | ||
1255 | # CONFIG_SCHED_TRACER is not set | ||
1256 | # CONFIG_CONTEXT_SWITCH_TRACER is not set | ||
1257 | # CONFIG_EVENT_TRACER is not set | ||
1258 | # CONFIG_BOOT_TRACER is not set | ||
1259 | # CONFIG_TRACE_BRANCH_PROFILING is not set | ||
1260 | # CONFIG_STACK_TRACER is not set | ||
1261 | # CONFIG_KMEMTRACE is not set | ||
1262 | # CONFIG_WORKQUEUE_TRACER is not set | ||
1263 | # CONFIG_BLK_DEV_IO_TRACE is not set | ||
1264 | # CONFIG_DYNAMIC_DEBUG is not set | ||
1265 | # CONFIG_SAMPLES is not set | ||
1266 | CONFIG_HAVE_ARCH_KGDB=y | ||
1267 | # CONFIG_KGDB is not set | ||
1268 | CONFIG_ARM_UNWIND=y | ||
1269 | # CONFIG_DEBUG_USER is not set | ||
1270 | # CONFIG_DEBUG_ERRORS is not set | ||
1271 | # CONFIG_DEBUG_STACK_USAGE is not set | ||
1272 | # CONFIG_DEBUG_LL is not set | ||
758 | 1273 | ||
759 | # | 1274 | # |
760 | # Security options | 1275 | # Security options |
761 | # | 1276 | # |
762 | # CONFIG_KEYS is not set | 1277 | # CONFIG_KEYS is not set |
763 | # CONFIG_SECURITY is not set | 1278 | # CONFIG_SECURITY is not set |
764 | 1279 | # CONFIG_SECURITYFS is not set | |
765 | # | 1280 | # CONFIG_SECURITY_FILE_CAPABILITIES is not set |
766 | # Cryptographic options | ||
767 | # | ||
768 | # CONFIG_CRYPTO is not set | 1281 | # CONFIG_CRYPTO is not set |
769 | 1282 | # CONFIG_BINARY_PRINTF is not set | |
770 | # | ||
771 | # Hardware crypto devices | ||
772 | # | ||
773 | 1283 | ||
774 | # | 1284 | # |
775 | # Library routines | 1285 | # Library routines |
776 | # | 1286 | # |
1287 | CONFIG_BITREVERSE=y | ||
1288 | CONFIG_GENERIC_FIND_LAST_BIT=y | ||
777 | # CONFIG_CRC_CCITT is not set | 1289 | # CONFIG_CRC_CCITT is not set |
1290 | # CONFIG_CRC16 is not set | ||
1291 | # CONFIG_CRC_T10DIF is not set | ||
1292 | # CONFIG_CRC_ITU_T is not set | ||
778 | CONFIG_CRC32=y | 1293 | CONFIG_CRC32=y |
1294 | # CONFIG_CRC7 is not set | ||
779 | # CONFIG_LIBCRC32C is not set | 1295 | # CONFIG_LIBCRC32C is not set |
1296 | CONFIG_AUDIT_GENERIC=y | ||
1297 | CONFIG_ZLIB_INFLATE=y | ||
1298 | CONFIG_ZLIB_DEFLATE=y | ||
1299 | CONFIG_DECOMPRESS_GZIP=y | ||
1300 | CONFIG_DECOMPRESS_BZIP2=y | ||
1301 | CONFIG_DECOMPRESS_LZMA=y | ||
1302 | CONFIG_HAS_IOMEM=y | ||
1303 | CONFIG_HAS_IOPORT=y | ||
1304 | CONFIG_HAS_DMA=y | ||
1305 | CONFIG_NLATTR=y | ||
diff --git a/arch/arm/configs/u300_defconfig b/arch/arm/configs/u300_defconfig index 2d827e121147..4762d9001298 100644 --- a/arch/arm/configs/u300_defconfig +++ b/arch/arm/configs/u300_defconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Linux kernel version: 2.6.30-rc6 | 3 | # Linux kernel version: 2.6.31-rc1 |
4 | # Mon Jun 1 09:18:22 2009 | 4 | # Thu Jul 2 00:16:59 2009 |
5 | # | 5 | # |
6 | CONFIG_ARM=y | 6 | CONFIG_ARM=y |
7 | CONFIG_SYS_SUPPORTS_APM_EMULATION=y | 7 | CONFIG_SYS_SUPPORTS_APM_EMULATION=y |
@@ -9,7 +9,7 @@ CONFIG_GENERIC_GPIO=y | |||
9 | CONFIG_GENERIC_TIME=y | 9 | CONFIG_GENERIC_TIME=y |
10 | CONFIG_GENERIC_CLOCKEVENTS=y | 10 | CONFIG_GENERIC_CLOCKEVENTS=y |
11 | CONFIG_MMU=y | 11 | CONFIG_MMU=y |
12 | # CONFIG_NO_IOPORT is not set | 12 | CONFIG_HAVE_TCM=y |
13 | CONFIG_GENERIC_HARDIRQS=y | 13 | CONFIG_GENERIC_HARDIRQS=y |
14 | CONFIG_STACKTRACE_SUPPORT=y | 14 | CONFIG_STACKTRACE_SUPPORT=y |
15 | CONFIG_HAVE_LATENCYTOP_SUPPORT=y | 15 | CONFIG_HAVE_LATENCYTOP_SUPPORT=y |
@@ -18,13 +18,12 @@ CONFIG_TRACE_IRQFLAGS_SUPPORT=y | |||
18 | CONFIG_HARDIRQS_SW_RESEND=y | 18 | CONFIG_HARDIRQS_SW_RESEND=y |
19 | CONFIG_GENERIC_IRQ_PROBE=y | 19 | CONFIG_GENERIC_IRQ_PROBE=y |
20 | CONFIG_RWSEM_GENERIC_SPINLOCK=y | 20 | CONFIG_RWSEM_GENERIC_SPINLOCK=y |
21 | # CONFIG_ARCH_HAS_ILOG2_U32 is not set | ||
22 | # CONFIG_ARCH_HAS_ILOG2_U64 is not set | ||
23 | CONFIG_GENERIC_HWEIGHT=y | 21 | CONFIG_GENERIC_HWEIGHT=y |
24 | CONFIG_GENERIC_CALIBRATE_DELAY=y | 22 | CONFIG_GENERIC_CALIBRATE_DELAY=y |
25 | CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y | 23 | CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y |
26 | CONFIG_VECTORS_BASE=0xffff0000 | 24 | CONFIG_VECTORS_BASE=0xffff0000 |
27 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" | 25 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" |
26 | CONFIG_CONSTRUCTORS=y | ||
28 | 27 | ||
29 | # | 28 | # |
30 | # General setup | 29 | # General setup |
@@ -68,7 +67,6 @@ CONFIG_SYSCTL_SYSCALL=y | |||
68 | CONFIG_KALLSYMS=y | 67 | CONFIG_KALLSYMS=y |
69 | # CONFIG_KALLSYMS_ALL is not set | 68 | # CONFIG_KALLSYMS_ALL is not set |
70 | # CONFIG_KALLSYMS_EXTRA_PASS is not set | 69 | # CONFIG_KALLSYMS_EXTRA_PASS is not set |
71 | # CONFIG_STRIP_ASM_SYMS is not set | ||
72 | CONFIG_HOTPLUG=y | 70 | CONFIG_HOTPLUG=y |
73 | CONFIG_PRINTK=y | 71 | CONFIG_PRINTK=y |
74 | CONFIG_BUG=y | 72 | CONFIG_BUG=y |
@@ -81,8 +79,13 @@ CONFIG_TIMERFD=y | |||
81 | CONFIG_EVENTFD=y | 79 | CONFIG_EVENTFD=y |
82 | CONFIG_SHMEM=y | 80 | CONFIG_SHMEM=y |
83 | # CONFIG_AIO is not set | 81 | # CONFIG_AIO is not set |
82 | |||
83 | # | ||
84 | # Performance Counters | ||
85 | # | ||
84 | # CONFIG_VM_EVENT_COUNTERS is not set | 86 | # CONFIG_VM_EVENT_COUNTERS is not set |
85 | CONFIG_SLUB_DEBUG=y | 87 | CONFIG_SLUB_DEBUG=y |
88 | # CONFIG_STRIP_ASM_SYMS is not set | ||
86 | CONFIG_COMPAT_BRK=y | 89 | CONFIG_COMPAT_BRK=y |
87 | # CONFIG_SLAB is not set | 90 | # CONFIG_SLAB is not set |
88 | CONFIG_SLUB=y | 91 | CONFIG_SLUB=y |
@@ -94,6 +97,10 @@ CONFIG_HAVE_OPROFILE=y | |||
94 | CONFIG_HAVE_KPROBES=y | 97 | CONFIG_HAVE_KPROBES=y |
95 | CONFIG_HAVE_KRETPROBES=y | 98 | CONFIG_HAVE_KRETPROBES=y |
96 | CONFIG_HAVE_CLK=y | 99 | CONFIG_HAVE_CLK=y |
100 | |||
101 | # | ||
102 | # GCOV-based kernel profiling | ||
103 | # | ||
97 | # CONFIG_SLOW_WORK is not set | 104 | # CONFIG_SLOW_WORK is not set |
98 | CONFIG_HAVE_GENERIC_DMA_COHERENT=y | 105 | CONFIG_HAVE_GENERIC_DMA_COHERENT=y |
99 | CONFIG_SLABINFO=y | 106 | CONFIG_SLABINFO=y |
@@ -106,7 +113,7 @@ CONFIG_MODULE_UNLOAD=y | |||
106 | # CONFIG_MODVERSIONS is not set | 113 | # CONFIG_MODVERSIONS is not set |
107 | # CONFIG_MODULE_SRCVERSION_ALL is not set | 114 | # CONFIG_MODULE_SRCVERSION_ALL is not set |
108 | CONFIG_BLOCK=y | 115 | CONFIG_BLOCK=y |
109 | # CONFIG_LBD is not set | 116 | CONFIG_LBDAF=y |
110 | # CONFIG_BLK_DEV_BSG is not set | 117 | # CONFIG_BLK_DEV_BSG is not set |
111 | # CONFIG_BLK_DEV_INTEGRITY is not set | 118 | # CONFIG_BLK_DEV_INTEGRITY is not set |
112 | 119 | ||
@@ -138,9 +145,9 @@ CONFIG_DEFAULT_IOSCHED="deadline" | |||
138 | # CONFIG_ARCH_EP93XX is not set | 145 | # CONFIG_ARCH_EP93XX is not set |
139 | # CONFIG_ARCH_FOOTBRIDGE is not set | 146 | # CONFIG_ARCH_FOOTBRIDGE is not set |
140 | # CONFIG_ARCH_MXC is not set | 147 | # CONFIG_ARCH_MXC is not set |
148 | # CONFIG_ARCH_STMP3XXX is not set | ||
141 | # CONFIG_ARCH_NETX is not set | 149 | # CONFIG_ARCH_NETX is not set |
142 | # CONFIG_ARCH_H720X is not set | 150 | # CONFIG_ARCH_H720X is not set |
143 | # CONFIG_ARCH_IMX is not set | ||
144 | # CONFIG_ARCH_IOP13XX is not set | 151 | # CONFIG_ARCH_IOP13XX is not set |
145 | # CONFIG_ARCH_IOP32X is not set | 152 | # CONFIG_ARCH_IOP32X is not set |
146 | # CONFIG_ARCH_IOP33X is not set | 153 | # CONFIG_ARCH_IOP33X is not set |
@@ -216,8 +223,8 @@ CONFIG_ARM_THUMB=y | |||
216 | # CONFIG_CPU_DCACHE_DISABLE is not set | 223 | # CONFIG_CPU_DCACHE_DISABLE is not set |
217 | # CONFIG_CPU_DCACHE_WRITETHROUGH is not set | 224 | # CONFIG_CPU_DCACHE_WRITETHROUGH is not set |
218 | # CONFIG_CPU_CACHE_ROUND_ROBIN is not set | 225 | # CONFIG_CPU_CACHE_ROUND_ROBIN is not set |
219 | # CONFIG_OUTER_CACHE is not set | ||
220 | CONFIG_ARM_VIC=y | 226 | CONFIG_ARM_VIC=y |
227 | CONFIG_ARM_VIC_NR=2 | ||
221 | CONFIG_COMMON_CLKDEV=y | 228 | CONFIG_COMMON_CLKDEV=y |
222 | 229 | ||
223 | # | 230 | # |
@@ -243,7 +250,6 @@ CONFIG_PREEMPT=y | |||
243 | CONFIG_HZ=100 | 250 | CONFIG_HZ=100 |
244 | CONFIG_AEABI=y | 251 | CONFIG_AEABI=y |
245 | CONFIG_OABI_COMPAT=y | 252 | CONFIG_OABI_COMPAT=y |
246 | CONFIG_ARCH_FLATMEM_HAS_HOLES=y | ||
247 | # CONFIG_ARCH_SPARSEMEM_DEFAULT is not set | 253 | # CONFIG_ARCH_SPARSEMEM_DEFAULT is not set |
248 | # CONFIG_ARCH_SELECT_MEMORY_MODEL is not set | 254 | # CONFIG_ARCH_SELECT_MEMORY_MODEL is not set |
249 | # CONFIG_HIGHMEM is not set | 255 | # CONFIG_HIGHMEM is not set |
@@ -258,17 +264,18 @@ CONFIG_SPLIT_PTLOCK_CPUS=4096 | |||
258 | # CONFIG_PHYS_ADDR_T_64BIT is not set | 264 | # CONFIG_PHYS_ADDR_T_64BIT is not set |
259 | CONFIG_ZONE_DMA_FLAG=0 | 265 | CONFIG_ZONE_DMA_FLAG=0 |
260 | CONFIG_VIRT_TO_BUS=y | 266 | CONFIG_VIRT_TO_BUS=y |
261 | CONFIG_UNEVICTABLE_LRU=y | ||
262 | CONFIG_HAVE_MLOCK=y | 267 | CONFIG_HAVE_MLOCK=y |
263 | CONFIG_HAVE_MLOCKED_PAGE_BIT=y | 268 | CONFIG_HAVE_MLOCKED_PAGE_BIT=y |
269 | CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 | ||
264 | CONFIG_ALIGNMENT_TRAP=y | 270 | CONFIG_ALIGNMENT_TRAP=y |
271 | # CONFIG_UACCESS_WITH_MEMCPY is not set | ||
265 | 272 | ||
266 | # | 273 | # |
267 | # Boot options | 274 | # Boot options |
268 | # | 275 | # |
269 | CONFIG_ZBOOT_ROM_TEXT=0x0 | 276 | CONFIG_ZBOOT_ROM_TEXT=0x0 |
270 | CONFIG_ZBOOT_ROM_BSS=0x0 | 277 | CONFIG_ZBOOT_ROM_BSS=0x0 |
271 | CONFIG_CMDLINE="root=/dev/mtdblock2 rw rootfstype=yaffs2 console=ttyAMA0,115200n8 ab3100.force=0,0x48 mtdparts=u300nand:128k@0x0(bootrecords)ro,8064k@128k(free)ro,253952k@8192k(platform) lpj=515072" | 278 | CONFIG_CMDLINE="root=/dev/ram0 rw rootfstype=rootfs console=ttyAMA0,115200n8 lpj=515072" |
272 | # CONFIG_XIP_KERNEL is not set | 279 | # CONFIG_XIP_KERNEL is not set |
273 | # CONFIG_KEXEC is not set | 280 | # CONFIG_KEXEC is not set |
274 | 281 | ||
@@ -359,6 +366,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic" | |||
359 | # CONFIG_ECONET is not set | 366 | # CONFIG_ECONET is not set |
360 | # CONFIG_WAN_ROUTER is not set | 367 | # CONFIG_WAN_ROUTER is not set |
361 | # CONFIG_PHONET is not set | 368 | # CONFIG_PHONET is not set |
369 | # CONFIG_IEEE802154 is not set | ||
362 | # CONFIG_NET_SCHED is not set | 370 | # CONFIG_NET_SCHED is not set |
363 | # CONFIG_DCB is not set | 371 | # CONFIG_DCB is not set |
364 | 372 | ||
@@ -497,6 +505,7 @@ CONFIG_MISC_DEVICES=y | |||
497 | # CONFIG_EEPROM_AT24 is not set | 505 | # CONFIG_EEPROM_AT24 is not set |
498 | # CONFIG_EEPROM_AT25 is not set | 506 | # CONFIG_EEPROM_AT25 is not set |
499 | # CONFIG_EEPROM_LEGACY is not set | 507 | # CONFIG_EEPROM_LEGACY is not set |
508 | # CONFIG_EEPROM_MAX6875 is not set | ||
500 | # CONFIG_EEPROM_93CX6 is not set | 509 | # CONFIG_EEPROM_93CX6 is not set |
501 | CONFIG_HAVE_IDE=y | 510 | CONFIG_HAVE_IDE=y |
502 | # CONFIG_IDE is not set | 511 | # CONFIG_IDE is not set |
@@ -538,6 +547,7 @@ CONFIG_INPUT_KEYBOARD=y | |||
538 | # CONFIG_KEYBOARD_XTKBD is not set | 547 | # CONFIG_KEYBOARD_XTKBD is not set |
539 | # CONFIG_KEYBOARD_NEWTON is not set | 548 | # CONFIG_KEYBOARD_NEWTON is not set |
540 | # CONFIG_KEYBOARD_STOWAWAY is not set | 549 | # CONFIG_KEYBOARD_STOWAWAY is not set |
550 | # CONFIG_KEYBOARD_LM8323 is not set | ||
541 | # CONFIG_KEYBOARD_GPIO is not set | 551 | # CONFIG_KEYBOARD_GPIO is not set |
542 | # CONFIG_INPUT_MOUSE is not set | 552 | # CONFIG_INPUT_MOUSE is not set |
543 | # CONFIG_INPUT_JOYSTICK is not set | 553 | # CONFIG_INPUT_JOYSTICK is not set |
@@ -597,9 +607,11 @@ CONFIG_I2C_HELPER_AUTO=y | |||
597 | # | 607 | # |
598 | # I2C system bus drivers (mostly embedded / system-on-chip) | 608 | # I2C system bus drivers (mostly embedded / system-on-chip) |
599 | # | 609 | # |
610 | # CONFIG_I2C_DESIGNWARE is not set | ||
600 | # CONFIG_I2C_GPIO is not set | 611 | # CONFIG_I2C_GPIO is not set |
601 | # CONFIG_I2C_OCORES is not set | 612 | # CONFIG_I2C_OCORES is not set |
602 | # CONFIG_I2C_SIMTEC is not set | 613 | # CONFIG_I2C_SIMTEC is not set |
614 | CONFIG_I2C_STU300=y | ||
603 | 615 | ||
604 | # | 616 | # |
605 | # External I2C/SMBus adapter drivers | 617 | # External I2C/SMBus adapter drivers |
@@ -620,7 +632,6 @@ CONFIG_I2C_HELPER_AUTO=y | |||
620 | # CONFIG_SENSORS_PCF8574 is not set | 632 | # CONFIG_SENSORS_PCF8574 is not set |
621 | # CONFIG_PCF8575 is not set | 633 | # CONFIG_PCF8575 is not set |
622 | # CONFIG_SENSORS_PCA9539 is not set | 634 | # CONFIG_SENSORS_PCA9539 is not set |
623 | # CONFIG_SENSORS_MAX6875 is not set | ||
624 | # CONFIG_SENSORS_TSL2550 is not set | 635 | # CONFIG_SENSORS_TSL2550 is not set |
625 | # CONFIG_I2C_DEBUG_CORE is not set | 636 | # CONFIG_I2C_DEBUG_CORE is not set |
626 | # CONFIG_I2C_DEBUG_ALGO is not set | 637 | # CONFIG_I2C_DEBUG_ALGO is not set |
@@ -635,6 +646,7 @@ CONFIG_SPI_MASTER=y | |||
635 | # | 646 | # |
636 | # CONFIG_SPI_BITBANG is not set | 647 | # CONFIG_SPI_BITBANG is not set |
637 | # CONFIG_SPI_GPIO is not set | 648 | # CONFIG_SPI_GPIO is not set |
649 | CONFIG_SPI_PL022=y | ||
638 | 650 | ||
639 | # | 651 | # |
640 | # SPI Protocol Masters | 652 | # SPI Protocol Masters |
@@ -647,6 +659,7 @@ CONFIG_POWER_SUPPLY=y | |||
647 | # CONFIG_PDA_POWER is not set | 659 | # CONFIG_PDA_POWER is not set |
648 | # CONFIG_BATTERY_DS2760 is not set | 660 | # CONFIG_BATTERY_DS2760 is not set |
649 | # CONFIG_BATTERY_BQ27x00 is not set | 661 | # CONFIG_BATTERY_BQ27x00 is not set |
662 | # CONFIG_BATTERY_MAX17040 is not set | ||
650 | # CONFIG_HWMON is not set | 663 | # CONFIG_HWMON is not set |
651 | # CONFIG_THERMAL is not set | 664 | # CONFIG_THERMAL is not set |
652 | # CONFIG_THERMAL_HWMON is not set | 665 | # CONFIG_THERMAL_HWMON is not set |
@@ -657,6 +670,7 @@ CONFIG_WATCHDOG=y | |||
657 | # Watchdog Device Drivers | 670 | # Watchdog Device Drivers |
658 | # | 671 | # |
659 | # CONFIG_SOFT_WATCHDOG is not set | 672 | # CONFIG_SOFT_WATCHDOG is not set |
673 | CONFIG_COH901327_WATCHDOG=y | ||
660 | CONFIG_SSB_POSSIBLE=y | 674 | CONFIG_SSB_POSSIBLE=y |
661 | 675 | ||
662 | # | 676 | # |
@@ -678,22 +692,9 @@ CONFIG_SSB_POSSIBLE=y | |||
678 | # CONFIG_MFD_WM8400 is not set | 692 | # CONFIG_MFD_WM8400 is not set |
679 | # CONFIG_MFD_WM8350_I2C is not set | 693 | # CONFIG_MFD_WM8350_I2C is not set |
680 | # CONFIG_MFD_PCF50633 is not set | 694 | # CONFIG_MFD_PCF50633 is not set |
681 | 695 | CONFIG_AB3100_CORE=y | |
682 | # | 696 | # CONFIG_EZX_PCAP is not set |
683 | # Multimedia devices | 697 | # CONFIG_MEDIA_SUPPORT is not set |
684 | # | ||
685 | |||
686 | # | ||
687 | # Multimedia core support | ||
688 | # | ||
689 | # CONFIG_VIDEO_DEV is not set | ||
690 | # CONFIG_DVB_CORE is not set | ||
691 | # CONFIG_VIDEO_MEDIA is not set | ||
692 | |||
693 | # | ||
694 | # Multimedia drivers | ||
695 | # | ||
696 | # CONFIG_DAB is not set | ||
697 | 698 | ||
698 | # | 699 | # |
699 | # Graphics support | 700 | # Graphics support |
@@ -760,6 +761,11 @@ CONFIG_SND_JACK=y | |||
760 | # CONFIG_SND_VERBOSE_PROCFS is not set | 761 | # CONFIG_SND_VERBOSE_PROCFS is not set |
761 | # CONFIG_SND_VERBOSE_PRINTK is not set | 762 | # CONFIG_SND_VERBOSE_PRINTK is not set |
762 | # CONFIG_SND_DEBUG is not set | 763 | # CONFIG_SND_DEBUG is not set |
764 | # CONFIG_SND_RAWMIDI_SEQ is not set | ||
765 | # CONFIG_SND_OPL3_LIB_SEQ is not set | ||
766 | # CONFIG_SND_OPL4_LIB_SEQ is not set | ||
767 | # CONFIG_SND_SBAWE_SEQ is not set | ||
768 | # CONFIG_SND_EMU10K1_SEQ is not set | ||
763 | # CONFIG_SND_DRIVERS is not set | 769 | # CONFIG_SND_DRIVERS is not set |
764 | # CONFIG_SND_ARM is not set | 770 | # CONFIG_SND_ARM is not set |
765 | # CONFIG_SND_SPI is not set | 771 | # CONFIG_SND_SPI is not set |
@@ -770,7 +776,7 @@ CONFIG_SND_SOC_I2C_AND_SPI=y | |||
770 | # CONFIG_HID_SUPPORT is not set | 776 | # CONFIG_HID_SUPPORT is not set |
771 | # CONFIG_USB_SUPPORT is not set | 777 | # CONFIG_USB_SUPPORT is not set |
772 | CONFIG_MMC=y | 778 | CONFIG_MMC=y |
773 | # CONFIG_MMC_DEBUG is not set | 779 | CONFIG_MMC_DEBUG=y |
774 | # CONFIG_MMC_UNSAFE_RESUME is not set | 780 | # CONFIG_MMC_UNSAFE_RESUME is not set |
775 | 781 | ||
776 | # | 782 | # |
@@ -797,7 +803,7 @@ CONFIG_LEDS_CLASS=y | |||
797 | # | 803 | # |
798 | # CONFIG_LEDS_PCA9532 is not set | 804 | # CONFIG_LEDS_PCA9532 is not set |
799 | # CONFIG_LEDS_GPIO is not set | 805 | # CONFIG_LEDS_GPIO is not set |
800 | # CONFIG_LEDS_LP5521 is not set | 806 | # CONFIG_LEDS_LP3944 is not set |
801 | # CONFIG_LEDS_PCA955X is not set | 807 | # CONFIG_LEDS_PCA955X is not set |
802 | # CONFIG_LEDS_DAC124S085 is not set | 808 | # CONFIG_LEDS_DAC124S085 is not set |
803 | # CONFIG_LEDS_BD2802 is not set | 809 | # CONFIG_LEDS_BD2802 is not set |
@@ -845,6 +851,7 @@ CONFIG_RTC_INTF_DEV=y | |||
845 | # CONFIG_RTC_DRV_S35390A is not set | 851 | # CONFIG_RTC_DRV_S35390A is not set |
846 | # CONFIG_RTC_DRV_FM3130 is not set | 852 | # CONFIG_RTC_DRV_FM3130 is not set |
847 | # CONFIG_RTC_DRV_RX8581 is not set | 853 | # CONFIG_RTC_DRV_RX8581 is not set |
854 | # CONFIG_RTC_DRV_RX8025 is not set | ||
848 | 855 | ||
849 | # | 856 | # |
850 | # SPI RTC drivers | 857 | # SPI RTC drivers |
@@ -887,7 +894,10 @@ CONFIG_REGULATOR=y | |||
887 | # CONFIG_REGULATOR_DEBUG is not set | 894 | # CONFIG_REGULATOR_DEBUG is not set |
888 | # CONFIG_REGULATOR_FIXED_VOLTAGE is not set | 895 | # CONFIG_REGULATOR_FIXED_VOLTAGE is not set |
889 | # CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set | 896 | # CONFIG_REGULATOR_VIRTUAL_CONSUMER is not set |
897 | # CONFIG_REGULATOR_USERSPACE_CONSUMER is not set | ||
890 | # CONFIG_REGULATOR_BQ24022 is not set | 898 | # CONFIG_REGULATOR_BQ24022 is not set |
899 | # CONFIG_REGULATOR_MAX1586 is not set | ||
900 | # CONFIG_REGULATOR_LP3971 is not set | ||
891 | # CONFIG_UIO is not set | 901 | # CONFIG_UIO is not set |
892 | # CONFIG_STAGING is not set | 902 | # CONFIG_STAGING is not set |
893 | 903 | ||
@@ -900,16 +910,20 @@ CONFIG_REGULATOR=y | |||
900 | # CONFIG_REISERFS_FS is not set | 910 | # CONFIG_REISERFS_FS is not set |
901 | # CONFIG_JFS_FS is not set | 911 | # CONFIG_JFS_FS is not set |
902 | # CONFIG_FS_POSIX_ACL is not set | 912 | # CONFIG_FS_POSIX_ACL is not set |
903 | CONFIG_FILE_LOCKING=y | ||
904 | # CONFIG_XFS_FS is not set | 913 | # CONFIG_XFS_FS is not set |
914 | # CONFIG_GFS2_FS is not set | ||
905 | # CONFIG_OCFS2_FS is not set | 915 | # CONFIG_OCFS2_FS is not set |
906 | # CONFIG_BTRFS_FS is not set | 916 | # CONFIG_BTRFS_FS is not set |
917 | CONFIG_FILE_LOCKING=y | ||
918 | CONFIG_FSNOTIFY=y | ||
907 | # CONFIG_DNOTIFY is not set | 919 | # CONFIG_DNOTIFY is not set |
908 | # CONFIG_INOTIFY is not set | 920 | # CONFIG_INOTIFY is not set |
921 | CONFIG_INOTIFY_USER=y | ||
909 | # CONFIG_QUOTA is not set | 922 | # CONFIG_QUOTA is not set |
910 | # CONFIG_AUTOFS_FS is not set | 923 | # CONFIG_AUTOFS_FS is not set |
911 | # CONFIG_AUTOFS4_FS is not set | 924 | # CONFIG_AUTOFS4_FS is not set |
912 | CONFIG_FUSE_FS=y | 925 | CONFIG_FUSE_FS=y |
926 | # CONFIG_CUSE is not set | ||
913 | 927 | ||
914 | # | 928 | # |
915 | # Caches | 929 | # Caches |
@@ -1033,6 +1047,7 @@ CONFIG_TIMER_STATS=y | |||
1033 | # CONFIG_DEBUG_OBJECTS is not set | 1047 | # CONFIG_DEBUG_OBJECTS is not set |
1034 | # CONFIG_SLUB_DEBUG_ON is not set | 1048 | # CONFIG_SLUB_DEBUG_ON is not set |
1035 | # CONFIG_SLUB_STATS is not set | 1049 | # CONFIG_SLUB_STATS is not set |
1050 | # CONFIG_DEBUG_KMEMLEAK is not set | ||
1036 | # CONFIG_DEBUG_PREEMPT is not set | 1051 | # CONFIG_DEBUG_PREEMPT is not set |
1037 | # CONFIG_DEBUG_RT_MUTEXES is not set | 1052 | # CONFIG_DEBUG_RT_MUTEXES is not set |
1038 | # CONFIG_RT_MUTEX_TESTER is not set | 1053 | # CONFIG_RT_MUTEX_TESTER is not set |
@@ -1063,18 +1078,16 @@ CONFIG_DEBUG_INFO=y | |||
1063 | # CONFIG_PAGE_POISONING is not set | 1078 | # CONFIG_PAGE_POISONING is not set |
1064 | CONFIG_HAVE_FUNCTION_TRACER=y | 1079 | CONFIG_HAVE_FUNCTION_TRACER=y |
1065 | CONFIG_TRACING_SUPPORT=y | 1080 | CONFIG_TRACING_SUPPORT=y |
1066 | 1081 | CONFIG_FTRACE=y | |
1067 | # | ||
1068 | # Tracers | ||
1069 | # | ||
1070 | # CONFIG_FUNCTION_TRACER is not set | 1082 | # CONFIG_FUNCTION_TRACER is not set |
1071 | # CONFIG_IRQSOFF_TRACER is not set | 1083 | # CONFIG_IRQSOFF_TRACER is not set |
1072 | # CONFIG_PREEMPT_TRACER is not set | 1084 | # CONFIG_PREEMPT_TRACER is not set |
1073 | # CONFIG_SCHED_TRACER is not set | 1085 | # CONFIG_SCHED_TRACER is not set |
1074 | # CONFIG_CONTEXT_SWITCH_TRACER is not set | 1086 | # CONFIG_ENABLE_DEFAULT_TRACERS is not set |
1075 | # CONFIG_EVENT_TRACER is not set | ||
1076 | # CONFIG_BOOT_TRACER is not set | 1087 | # CONFIG_BOOT_TRACER is not set |
1077 | # CONFIG_TRACE_BRANCH_PROFILING is not set | 1088 | CONFIG_BRANCH_PROFILE_NONE=y |
1089 | # CONFIG_PROFILE_ANNOTATED_BRANCHES is not set | ||
1090 | # CONFIG_PROFILE_ALL_BRANCHES is not set | ||
1078 | # CONFIG_STACK_TRACER is not set | 1091 | # CONFIG_STACK_TRACER is not set |
1079 | # CONFIG_KMEMTRACE is not set | 1092 | # CONFIG_KMEMTRACE is not set |
1080 | # CONFIG_WORKQUEUE_TRACER is not set | 1093 | # CONFIG_WORKQUEUE_TRACER is not set |
@@ -1109,6 +1122,7 @@ CONFIG_GENERIC_FIND_LAST_BIT=y | |||
1109 | # CONFIG_CRC32 is not set | 1122 | # CONFIG_CRC32 is not set |
1110 | # CONFIG_CRC7 is not set | 1123 | # CONFIG_CRC7 is not set |
1111 | # CONFIG_LIBCRC32C is not set | 1124 | # CONFIG_LIBCRC32C is not set |
1125 | CONFIG_GENERIC_ALLOCATOR=y | ||
1112 | CONFIG_HAS_IOMEM=y | 1126 | CONFIG_HAS_IOMEM=y |
1113 | CONFIG_HAS_IOPORT=y | 1127 | CONFIG_HAS_IOPORT=y |
1114 | CONFIG_HAS_DMA=y | 1128 | CONFIG_HAS_DMA=y |
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h index 1cd2d6416bda..c433c6c73112 100644 --- a/arch/arm/include/asm/pgtable.h +++ b/arch/arm/include/asm/pgtable.h | |||
@@ -285,15 +285,6 @@ extern struct page *empty_zero_page; | |||
285 | #define pte_young(pte) (pte_val(pte) & L_PTE_YOUNG) | 285 | #define pte_young(pte) (pte_val(pte) & L_PTE_YOUNG) |
286 | #define pte_special(pte) (0) | 286 | #define pte_special(pte) (0) |
287 | 287 | ||
288 | /* | ||
289 | * The following only works if pte_present() is not true. | ||
290 | */ | ||
291 | #define pte_file(pte) (pte_val(pte) & L_PTE_FILE) | ||
292 | #define pte_to_pgoff(x) (pte_val(x) >> 2) | ||
293 | #define pgoff_to_pte(x) __pte(((x) << 2) | L_PTE_FILE) | ||
294 | |||
295 | #define PTE_FILE_MAX_BITS 30 | ||
296 | |||
297 | #define PTE_BIT_FUNC(fn,op) \ | 288 | #define PTE_BIT_FUNC(fn,op) \ |
298 | static inline pte_t pte_##fn(pte_t pte) { pte_val(pte) op; return pte; } | 289 | static inline pte_t pte_##fn(pte_t pte) { pte_val(pte) op; return pte; } |
299 | 290 | ||
@@ -384,16 +375,50 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) | |||
384 | 375 | ||
385 | extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; | 376 | extern pgd_t swapper_pg_dir[PTRS_PER_PGD]; |
386 | 377 | ||
387 | /* Encode and decode a swap entry. | 378 | /* |
379 | * Encode and decode a swap entry. Swap entries are stored in the Linux | ||
380 | * page tables as follows: | ||
388 | * | 381 | * |
389 | * We support up to 32GB of swap on 4k machines | 382 | * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 |
383 | * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 | ||
384 | * <--------------- offset --------------------> <--- type --> 0 0 | ||
385 | * | ||
386 | * This gives us up to 127 swap files and 32GB per swap file. Note that | ||
387 | * the offset field is always non-zero. | ||
390 | */ | 388 | */ |
391 | #define __swp_type(x) (((x).val >> 2) & 0x7f) | 389 | #define __SWP_TYPE_SHIFT 2 |
392 | #define __swp_offset(x) ((x).val >> 9) | 390 | #define __SWP_TYPE_BITS 7 |
393 | #define __swp_entry(type,offset) ((swp_entry_t) { ((type) << 2) | ((offset) << 9) }) | 391 | #define __SWP_TYPE_MASK ((1 << __SWP_TYPE_BITS) - 1) |
392 | #define __SWP_OFFSET_SHIFT (__SWP_TYPE_BITS + __SWP_TYPE_SHIFT) | ||
393 | |||
394 | #define __swp_type(x) (((x).val >> __SWP_TYPE_SHIFT) & __SWP_TYPE_MASK) | ||
395 | #define __swp_offset(x) ((x).val >> __SWP_OFFSET_SHIFT) | ||
396 | #define __swp_entry(type,offset) ((swp_entry_t) { ((type) << __SWP_TYPE_SHIFT) | ((offset) << __SWP_OFFSET_SHIFT) }) | ||
397 | |||
394 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) | 398 | #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) |
395 | #define __swp_entry_to_pte(swp) ((pte_t) { (swp).val }) | 399 | #define __swp_entry_to_pte(swp) ((pte_t) { (swp).val }) |
396 | 400 | ||
401 | /* | ||
402 | * It is an error for the kernel to have more swap files than we can | ||
403 | * encode in the PTEs. This ensures that we know when MAX_SWAPFILES | ||
404 | * is increased beyond what we presently support. | ||
405 | */ | ||
406 | #define MAX_SWAPFILES_CHECK() BUILD_BUG_ON(MAX_SWAPFILES_SHIFT > __SWP_TYPE_BITS) | ||
407 | |||
408 | /* | ||
409 | * Encode and decode a file entry. File entries are stored in the Linux | ||
410 | * page tables as follows: | ||
411 | * | ||
412 | * 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 | ||
413 | * 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 | ||
414 | * <------------------------ offset -------------------------> 1 0 | ||
415 | */ | ||
416 | #define pte_file(pte) (pte_val(pte) & L_PTE_FILE) | ||
417 | #define pte_to_pgoff(x) (pte_val(x) >> 2) | ||
418 | #define pgoff_to_pte(x) __pte(((x) << 2) | L_PTE_FILE) | ||
419 | |||
420 | #define PTE_FILE_MAX_BITS 30 | ||
421 | |||
397 | /* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ | 422 | /* Needs to be defined here and not in linux/mm.h, as it is arch dependent */ |
398 | /* FIXME: this is not correct */ | 423 | /* FIXME: this is not correct */ |
399 | #define kern_addr_valid(addr) (1) | 424 | #define kern_addr_valid(addr) (1) |
diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h index 4f8848260ee2..73394e50cbca 100644 --- a/arch/arm/include/asm/thread_info.h +++ b/arch/arm/include/asm/thread_info.h | |||
@@ -73,7 +73,7 @@ struct thread_info { | |||
73 | .task = &tsk, \ | 73 | .task = &tsk, \ |
74 | .exec_domain = &default_exec_domain, \ | 74 | .exec_domain = &default_exec_domain, \ |
75 | .flags = 0, \ | 75 | .flags = 0, \ |
76 | .preempt_count = 1, \ | 76 | .preempt_count = INIT_PREEMPT_COUNT, \ |
77 | .addr_limit = KERNEL_DS, \ | 77 | .addr_limit = KERNEL_DS, \ |
78 | .cpu_domain = domain_val(DOMAIN_USER, DOMAIN_MANAGER) | \ | 78 | .cpu_domain = domain_val(DOMAIN_USER, DOMAIN_MANAGER) | \ |
79 | domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \ | 79 | domain_val(DOMAIN_KERNEL, DOMAIN_MANAGER) | \ |
diff --git a/arch/arm/mach-u300/clock.c b/arch/arm/mach-u300/clock.c index 5cd04d6751b3..111f7ea32b38 100644 --- a/arch/arm/mach-u300/clock.c +++ b/arch/arm/mach-u300/clock.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/timer.h> | 25 | #include <linux/timer.h> |
26 | #include <linux/io.h> | 26 | #include <linux/io.h> |
27 | #include <linux/seq_file.h> | ||
27 | 28 | ||
28 | #include <asm/clkdev.h> | 29 | #include <asm/clkdev.h> |
29 | #include <mach/hardware.h> | 30 | #include <mach/hardware.h> |
@@ -702,6 +703,7 @@ static struct clk amba_clk = { | |||
702 | .rate = 52000000, /* this varies! */ | 703 | .rate = 52000000, /* this varies! */ |
703 | .hw_ctrld = true, | 704 | .hw_ctrld = true, |
704 | .reset = false, | 705 | .reset = false, |
706 | .lock = __SPIN_LOCK_UNLOCKED(amba_clk.lock), | ||
705 | }; | 707 | }; |
706 | 708 | ||
707 | /* | 709 | /* |
@@ -720,6 +722,7 @@ static struct clk cpu_clk = { | |||
720 | .set_rate = clk_set_rate_cpuclk, | 722 | .set_rate = clk_set_rate_cpuclk, |
721 | .get_rate = clk_get_rate_cpuclk, | 723 | .get_rate = clk_get_rate_cpuclk, |
722 | .round_rate = clk_round_rate_cpuclk, | 724 | .round_rate = clk_round_rate_cpuclk, |
725 | .lock = __SPIN_LOCK_UNLOCKED(cpu_clk.lock), | ||
723 | }; | 726 | }; |
724 | 727 | ||
725 | static struct clk nandif_clk = { | 728 | static struct clk nandif_clk = { |
@@ -732,6 +735,7 @@ static struct clk nandif_clk = { | |||
732 | .clk_val = U300_SYSCON_SBCER_NANDIF_CLK_EN, | 735 | .clk_val = U300_SYSCON_SBCER_NANDIF_CLK_EN, |
733 | .enable = syscon_clk_enable, | 736 | .enable = syscon_clk_enable, |
734 | .disable = syscon_clk_disable, | 737 | .disable = syscon_clk_disable, |
738 | .lock = __SPIN_LOCK_UNLOCKED(nandif_clk.lock), | ||
735 | }; | 739 | }; |
736 | 740 | ||
737 | static struct clk semi_clk = { | 741 | static struct clk semi_clk = { |
@@ -744,6 +748,7 @@ static struct clk semi_clk = { | |||
744 | .clk_val = U300_SYSCON_SBCER_SEMI_CLK_EN, | 748 | .clk_val = U300_SYSCON_SBCER_SEMI_CLK_EN, |
745 | .enable = syscon_clk_enable, | 749 | .enable = syscon_clk_enable, |
746 | .disable = syscon_clk_disable, | 750 | .disable = syscon_clk_disable, |
751 | .lock = __SPIN_LOCK_UNLOCKED(semi_clk.lock), | ||
747 | }; | 752 | }; |
748 | 753 | ||
749 | #ifdef CONFIG_MACH_U300_BS335 | 754 | #ifdef CONFIG_MACH_U300_BS335 |
@@ -758,6 +763,7 @@ static struct clk isp_clk = { | |||
758 | .clk_val = U300_SYSCON_SBCER_ISP_CLK_EN, | 763 | .clk_val = U300_SYSCON_SBCER_ISP_CLK_EN, |
759 | .enable = syscon_clk_enable, | 764 | .enable = syscon_clk_enable, |
760 | .disable = syscon_clk_disable, | 765 | .disable = syscon_clk_disable, |
766 | .lock = __SPIN_LOCK_UNLOCKED(isp_clk.lock), | ||
761 | }; | 767 | }; |
762 | 768 | ||
763 | static struct clk cds_clk = { | 769 | static struct clk cds_clk = { |
@@ -771,6 +777,7 @@ static struct clk cds_clk = { | |||
771 | .clk_val = U300_SYSCON_SBCER_CDS_CLK_EN, | 777 | .clk_val = U300_SYSCON_SBCER_CDS_CLK_EN, |
772 | .enable = syscon_clk_enable, | 778 | .enable = syscon_clk_enable, |
773 | .disable = syscon_clk_disable, | 779 | .disable = syscon_clk_disable, |
780 | .lock = __SPIN_LOCK_UNLOCKED(cds_clk.lock), | ||
774 | }; | 781 | }; |
775 | #endif | 782 | #endif |
776 | 783 | ||
@@ -785,6 +792,7 @@ static struct clk dma_clk = { | |||
785 | .clk_val = U300_SYSCON_SBCER_DMAC_CLK_EN, | 792 | .clk_val = U300_SYSCON_SBCER_DMAC_CLK_EN, |
786 | .enable = syscon_clk_enable, | 793 | .enable = syscon_clk_enable, |
787 | .disable = syscon_clk_disable, | 794 | .disable = syscon_clk_disable, |
795 | .lock = __SPIN_LOCK_UNLOCKED(dma_clk.lock), | ||
788 | }; | 796 | }; |
789 | 797 | ||
790 | static struct clk aaif_clk = { | 798 | static struct clk aaif_clk = { |
@@ -798,6 +806,7 @@ static struct clk aaif_clk = { | |||
798 | .clk_val = U300_SYSCON_SBCER_AAIF_CLK_EN, | 806 | .clk_val = U300_SYSCON_SBCER_AAIF_CLK_EN, |
799 | .enable = syscon_clk_enable, | 807 | .enable = syscon_clk_enable, |
800 | .disable = syscon_clk_disable, | 808 | .disable = syscon_clk_disable, |
809 | .lock = __SPIN_LOCK_UNLOCKED(aaif_clk.lock), | ||
801 | }; | 810 | }; |
802 | 811 | ||
803 | static struct clk apex_clk = { | 812 | static struct clk apex_clk = { |
@@ -811,6 +820,7 @@ static struct clk apex_clk = { | |||
811 | .clk_val = U300_SYSCON_SBCER_APEX_CLK_EN, | 820 | .clk_val = U300_SYSCON_SBCER_APEX_CLK_EN, |
812 | .enable = syscon_clk_enable, | 821 | .enable = syscon_clk_enable, |
813 | .disable = syscon_clk_disable, | 822 | .disable = syscon_clk_disable, |
823 | .lock = __SPIN_LOCK_UNLOCKED(apex_clk.lock), | ||
814 | }; | 824 | }; |
815 | 825 | ||
816 | static struct clk video_enc_clk = { | 826 | static struct clk video_enc_clk = { |
@@ -825,6 +835,7 @@ static struct clk video_enc_clk = { | |||
825 | .clk_val = U300_SYSCON_SBCER_VIDEO_ENC_CLK_EN, | 835 | .clk_val = U300_SYSCON_SBCER_VIDEO_ENC_CLK_EN, |
826 | .enable = syscon_clk_enable, | 836 | .enable = syscon_clk_enable, |
827 | .disable = syscon_clk_disable, | 837 | .disable = syscon_clk_disable, |
838 | .lock = __SPIN_LOCK_UNLOCKED(video_enc_clk.lock), | ||
828 | }; | 839 | }; |
829 | 840 | ||
830 | static struct clk xgam_clk = { | 841 | static struct clk xgam_clk = { |
@@ -839,6 +850,7 @@ static struct clk xgam_clk = { | |||
839 | .get_rate = clk_get_rate_xgamclk, | 850 | .get_rate = clk_get_rate_xgamclk, |
840 | .enable = syscon_clk_enable, | 851 | .enable = syscon_clk_enable, |
841 | .disable = syscon_clk_disable, | 852 | .disable = syscon_clk_disable, |
853 | .lock = __SPIN_LOCK_UNLOCKED(xgam_clk.lock), | ||
842 | }; | 854 | }; |
843 | 855 | ||
844 | /* This clock is used to activate the video encoder */ | 856 | /* This clock is used to activate the video encoder */ |
@@ -854,6 +866,7 @@ static struct clk ahb_clk = { | |||
854 | .enable = syscon_clk_enable, | 866 | .enable = syscon_clk_enable, |
855 | .disable = syscon_clk_disable, | 867 | .disable = syscon_clk_disable, |
856 | .get_rate = clk_get_rate_ahb_clk, | 868 | .get_rate = clk_get_rate_ahb_clk, |
869 | .lock = __SPIN_LOCK_UNLOCKED(ahb_clk.lock), | ||
857 | }; | 870 | }; |
858 | 871 | ||
859 | 872 | ||
@@ -871,6 +884,7 @@ static struct clk ahb_subsys_clk = { | |||
871 | .enable = syscon_clk_enable, | 884 | .enable = syscon_clk_enable, |
872 | .disable = syscon_clk_disable, | 885 | .disable = syscon_clk_disable, |
873 | .get_rate = clk_get_rate_ahb_clk, | 886 | .get_rate = clk_get_rate_ahb_clk, |
887 | .lock = __SPIN_LOCK_UNLOCKED(ahb_subsys_clk.lock), | ||
874 | }; | 888 | }; |
875 | 889 | ||
876 | static struct clk intcon_clk = { | 890 | static struct clk intcon_clk = { |
@@ -882,6 +896,8 @@ static struct clk intcon_clk = { | |||
882 | .res_reg = U300_SYSCON_VBASE + U300_SYSCON_RRR, | 896 | .res_reg = U300_SYSCON_VBASE + U300_SYSCON_RRR, |
883 | .res_mask = U300_SYSCON_RRR_INTCON_RESET_EN, | 897 | .res_mask = U300_SYSCON_RRR_INTCON_RESET_EN, |
884 | /* INTCON can be reset but not clock-gated */ | 898 | /* INTCON can be reset but not clock-gated */ |
899 | .lock = __SPIN_LOCK_UNLOCKED(intcon_clk.lock), | ||
900 | |||
885 | }; | 901 | }; |
886 | 902 | ||
887 | static struct clk mspro_clk = { | 903 | static struct clk mspro_clk = { |
@@ -895,6 +911,7 @@ static struct clk mspro_clk = { | |||
895 | .clk_val = U300_SYSCON_SBCER_MSPRO_CLK_EN, | 911 | .clk_val = U300_SYSCON_SBCER_MSPRO_CLK_EN, |
896 | .enable = syscon_clk_enable, | 912 | .enable = syscon_clk_enable, |
897 | .disable = syscon_clk_disable, | 913 | .disable = syscon_clk_disable, |
914 | .lock = __SPIN_LOCK_UNLOCKED(mspro_clk.lock), | ||
898 | }; | 915 | }; |
899 | 916 | ||
900 | static struct clk emif_clk = { | 917 | static struct clk emif_clk = { |
@@ -909,6 +926,7 @@ static struct clk emif_clk = { | |||
909 | .enable = syscon_clk_enable, | 926 | .enable = syscon_clk_enable, |
910 | .disable = syscon_clk_disable, | 927 | .disable = syscon_clk_disable, |
911 | .get_rate = clk_get_rate_emif_clk, | 928 | .get_rate = clk_get_rate_emif_clk, |
929 | .lock = __SPIN_LOCK_UNLOCKED(emif_clk.lock), | ||
912 | }; | 930 | }; |
913 | 931 | ||
914 | 932 | ||
@@ -926,6 +944,7 @@ static struct clk fast_clk = { | |||
926 | .clk_val = U300_SYSCON_SBCER_FAST_BRIDGE_CLK_EN, | 944 | .clk_val = U300_SYSCON_SBCER_FAST_BRIDGE_CLK_EN, |
927 | .enable = syscon_clk_enable, | 945 | .enable = syscon_clk_enable, |
928 | .disable = syscon_clk_disable, | 946 | .disable = syscon_clk_disable, |
947 | .lock = __SPIN_LOCK_UNLOCKED(fast_clk.lock), | ||
929 | }; | 948 | }; |
930 | 949 | ||
931 | static struct clk mmcsd_clk = { | 950 | static struct clk mmcsd_clk = { |
@@ -942,6 +961,7 @@ static struct clk mmcsd_clk = { | |||
942 | .round_rate = clk_round_rate_mclk, | 961 | .round_rate = clk_round_rate_mclk, |
943 | .disable = syscon_clk_disable, | 962 | .disable = syscon_clk_disable, |
944 | .enable = syscon_clk_enable, | 963 | .enable = syscon_clk_enable, |
964 | .lock = __SPIN_LOCK_UNLOCKED(mmcsd_clk.lock), | ||
945 | }; | 965 | }; |
946 | 966 | ||
947 | static struct clk i2s0_clk = { | 967 | static struct clk i2s0_clk = { |
@@ -956,6 +976,7 @@ static struct clk i2s0_clk = { | |||
956 | .enable = syscon_clk_enable, | 976 | .enable = syscon_clk_enable, |
957 | .disable = syscon_clk_disable, | 977 | .disable = syscon_clk_disable, |
958 | .get_rate = clk_get_rate_i2s_i2c_spi, | 978 | .get_rate = clk_get_rate_i2s_i2c_spi, |
979 | .lock = __SPIN_LOCK_UNLOCKED(i2s0_clk.lock), | ||
959 | }; | 980 | }; |
960 | 981 | ||
961 | static struct clk i2s1_clk = { | 982 | static struct clk i2s1_clk = { |
@@ -970,6 +991,7 @@ static struct clk i2s1_clk = { | |||
970 | .enable = syscon_clk_enable, | 991 | .enable = syscon_clk_enable, |
971 | .disable = syscon_clk_disable, | 992 | .disable = syscon_clk_disable, |
972 | .get_rate = clk_get_rate_i2s_i2c_spi, | 993 | .get_rate = clk_get_rate_i2s_i2c_spi, |
994 | .lock = __SPIN_LOCK_UNLOCKED(i2s1_clk.lock), | ||
973 | }; | 995 | }; |
974 | 996 | ||
975 | static struct clk i2c0_clk = { | 997 | static struct clk i2c0_clk = { |
@@ -984,6 +1006,7 @@ static struct clk i2c0_clk = { | |||
984 | .enable = syscon_clk_enable, | 1006 | .enable = syscon_clk_enable, |
985 | .disable = syscon_clk_disable, | 1007 | .disable = syscon_clk_disable, |
986 | .get_rate = clk_get_rate_i2s_i2c_spi, | 1008 | .get_rate = clk_get_rate_i2s_i2c_spi, |
1009 | .lock = __SPIN_LOCK_UNLOCKED(i2c0_clk.lock), | ||
987 | }; | 1010 | }; |
988 | 1011 | ||
989 | static struct clk i2c1_clk = { | 1012 | static struct clk i2c1_clk = { |
@@ -998,6 +1021,7 @@ static struct clk i2c1_clk = { | |||
998 | .enable = syscon_clk_enable, | 1021 | .enable = syscon_clk_enable, |
999 | .disable = syscon_clk_disable, | 1022 | .disable = syscon_clk_disable, |
1000 | .get_rate = clk_get_rate_i2s_i2c_spi, | 1023 | .get_rate = clk_get_rate_i2s_i2c_spi, |
1024 | .lock = __SPIN_LOCK_UNLOCKED(i2c1_clk.lock), | ||
1001 | }; | 1025 | }; |
1002 | 1026 | ||
1003 | static struct clk spi_clk = { | 1027 | static struct clk spi_clk = { |
@@ -1012,6 +1036,7 @@ static struct clk spi_clk = { | |||
1012 | .enable = syscon_clk_enable, | 1036 | .enable = syscon_clk_enable, |
1013 | .disable = syscon_clk_disable, | 1037 | .disable = syscon_clk_disable, |
1014 | .get_rate = clk_get_rate_i2s_i2c_spi, | 1038 | .get_rate = clk_get_rate_i2s_i2c_spi, |
1039 | .lock = __SPIN_LOCK_UNLOCKED(spi_clk.lock), | ||
1015 | }; | 1040 | }; |
1016 | 1041 | ||
1017 | #ifdef CONFIG_MACH_U300_BS335 | 1042 | #ifdef CONFIG_MACH_U300_BS335 |
@@ -1026,6 +1051,7 @@ static struct clk uart1_clk = { | |||
1026 | .clk_val = U300_SYSCON_SBCER_UART1_CLK_EN, | 1051 | .clk_val = U300_SYSCON_SBCER_UART1_CLK_EN, |
1027 | .enable = syscon_clk_enable, | 1052 | .enable = syscon_clk_enable, |
1028 | .disable = syscon_clk_disable, | 1053 | .disable = syscon_clk_disable, |
1054 | .lock = __SPIN_LOCK_UNLOCKED(uart1_clk.lock), | ||
1029 | }; | 1055 | }; |
1030 | #endif | 1056 | #endif |
1031 | 1057 | ||
@@ -1044,6 +1070,7 @@ static struct clk slow_clk = { | |||
1044 | .clk_val = U300_SYSCON_SBCER_SLOW_BRIDGE_CLK_EN, | 1070 | .clk_val = U300_SYSCON_SBCER_SLOW_BRIDGE_CLK_EN, |
1045 | .enable = syscon_clk_enable, | 1071 | .enable = syscon_clk_enable, |
1046 | .disable = syscon_clk_disable, | 1072 | .disable = syscon_clk_disable, |
1073 | .lock = __SPIN_LOCK_UNLOCKED(slow_clk.lock), | ||
1047 | }; | 1074 | }; |
1048 | 1075 | ||
1049 | /* TODO: implement SYSCON clock? */ | 1076 | /* TODO: implement SYSCON clock? */ |
@@ -1055,6 +1082,7 @@ static struct clk wdog_clk = { | |||
1055 | .rate = 32768, | 1082 | .rate = 32768, |
1056 | .reset = false, | 1083 | .reset = false, |
1057 | /* This is always on, cannot be enabled/disabled or reset */ | 1084 | /* This is always on, cannot be enabled/disabled or reset */ |
1085 | .lock = __SPIN_LOCK_UNLOCKED(wdog_clk.lock), | ||
1058 | }; | 1086 | }; |
1059 | 1087 | ||
1060 | /* This one is hardwired to PLL13 */ | 1088 | /* This one is hardwired to PLL13 */ |
@@ -1069,6 +1097,7 @@ static struct clk uart_clk = { | |||
1069 | .clk_val = U300_SYSCON_SBCER_UART_CLK_EN, | 1097 | .clk_val = U300_SYSCON_SBCER_UART_CLK_EN, |
1070 | .enable = syscon_clk_enable, | 1098 | .enable = syscon_clk_enable, |
1071 | .disable = syscon_clk_disable, | 1099 | .disable = syscon_clk_disable, |
1100 | .lock = __SPIN_LOCK_UNLOCKED(uart_clk.lock), | ||
1072 | }; | 1101 | }; |
1073 | 1102 | ||
1074 | static struct clk keypad_clk = { | 1103 | static struct clk keypad_clk = { |
@@ -1082,6 +1111,7 @@ static struct clk keypad_clk = { | |||
1082 | .clk_val = U300_SYSCON_SBCER_KEYPAD_CLK_EN, | 1111 | .clk_val = U300_SYSCON_SBCER_KEYPAD_CLK_EN, |
1083 | .enable = syscon_clk_enable, | 1112 | .enable = syscon_clk_enable, |
1084 | .disable = syscon_clk_disable, | 1113 | .disable = syscon_clk_disable, |
1114 | .lock = __SPIN_LOCK_UNLOCKED(keypad_clk.lock), | ||
1085 | }; | 1115 | }; |
1086 | 1116 | ||
1087 | static struct clk gpio_clk = { | 1117 | static struct clk gpio_clk = { |
@@ -1095,6 +1125,7 @@ static struct clk gpio_clk = { | |||
1095 | .clk_val = U300_SYSCON_SBCER_GPIO_CLK_EN, | 1125 | .clk_val = U300_SYSCON_SBCER_GPIO_CLK_EN, |
1096 | .enable = syscon_clk_enable, | 1126 | .enable = syscon_clk_enable, |
1097 | .disable = syscon_clk_disable, | 1127 | .disable = syscon_clk_disable, |
1128 | .lock = __SPIN_LOCK_UNLOCKED(gpio_clk.lock), | ||
1098 | }; | 1129 | }; |
1099 | 1130 | ||
1100 | static struct clk rtc_clk = { | 1131 | static struct clk rtc_clk = { |
@@ -1106,6 +1137,7 @@ static struct clk rtc_clk = { | |||
1106 | .res_reg = U300_SYSCON_VBASE + U300_SYSCON_RSR, | 1137 | .res_reg = U300_SYSCON_VBASE + U300_SYSCON_RSR, |
1107 | .res_mask = U300_SYSCON_RSR_RTC_RESET_EN, | 1138 | .res_mask = U300_SYSCON_RSR_RTC_RESET_EN, |
1108 | /* This clock is always on, cannot be enabled/disabled */ | 1139 | /* This clock is always on, cannot be enabled/disabled */ |
1140 | .lock = __SPIN_LOCK_UNLOCKED(rtc_clk.lock), | ||
1109 | }; | 1141 | }; |
1110 | 1142 | ||
1111 | static struct clk bustr_clk = { | 1143 | static struct clk bustr_clk = { |
@@ -1119,6 +1151,7 @@ static struct clk bustr_clk = { | |||
1119 | .clk_val = U300_SYSCON_SBCER_BTR_CLK_EN, | 1151 | .clk_val = U300_SYSCON_SBCER_BTR_CLK_EN, |
1120 | .enable = syscon_clk_enable, | 1152 | .enable = syscon_clk_enable, |
1121 | .disable = syscon_clk_disable, | 1153 | .disable = syscon_clk_disable, |
1154 | .lock = __SPIN_LOCK_UNLOCKED(bustr_clk.lock), | ||
1122 | }; | 1155 | }; |
1123 | 1156 | ||
1124 | static struct clk evhist_clk = { | 1157 | static struct clk evhist_clk = { |
@@ -1132,6 +1165,7 @@ static struct clk evhist_clk = { | |||
1132 | .clk_val = U300_SYSCON_SBCER_EH_CLK_EN, | 1165 | .clk_val = U300_SYSCON_SBCER_EH_CLK_EN, |
1133 | .enable = syscon_clk_enable, | 1166 | .enable = syscon_clk_enable, |
1134 | .disable = syscon_clk_disable, | 1167 | .disable = syscon_clk_disable, |
1168 | .lock = __SPIN_LOCK_UNLOCKED(evhist_clk.lock), | ||
1135 | }; | 1169 | }; |
1136 | 1170 | ||
1137 | static struct clk timer_clk = { | 1171 | static struct clk timer_clk = { |
@@ -1145,6 +1179,7 @@ static struct clk timer_clk = { | |||
1145 | .clk_val = U300_SYSCON_SBCER_ACC_TMR_CLK_EN, | 1179 | .clk_val = U300_SYSCON_SBCER_ACC_TMR_CLK_EN, |
1146 | .enable = syscon_clk_enable, | 1180 | .enable = syscon_clk_enable, |
1147 | .disable = syscon_clk_disable, | 1181 | .disable = syscon_clk_disable, |
1182 | .lock = __SPIN_LOCK_UNLOCKED(timer_clk.lock), | ||
1148 | }; | 1183 | }; |
1149 | 1184 | ||
1150 | static struct clk app_timer_clk = { | 1185 | static struct clk app_timer_clk = { |
@@ -1158,6 +1193,7 @@ static struct clk app_timer_clk = { | |||
1158 | .clk_val = U300_SYSCON_SBCER_APP_TMR_CLK_EN, | 1193 | .clk_val = U300_SYSCON_SBCER_APP_TMR_CLK_EN, |
1159 | .enable = syscon_clk_enable, | 1194 | .enable = syscon_clk_enable, |
1160 | .disable = syscon_clk_disable, | 1195 | .disable = syscon_clk_disable, |
1196 | .lock = __SPIN_LOCK_UNLOCKED(app_timer_clk.lock), | ||
1161 | }; | 1197 | }; |
1162 | 1198 | ||
1163 | #ifdef CONFIG_MACH_U300_BS335 | 1199 | #ifdef CONFIG_MACH_U300_BS335 |
@@ -1172,6 +1208,7 @@ static struct clk ppm_clk = { | |||
1172 | .clk_val = U300_SYSCON_SBCER_PPM_CLK_EN, | 1208 | .clk_val = U300_SYSCON_SBCER_PPM_CLK_EN, |
1173 | .enable = syscon_clk_enable, | 1209 | .enable = syscon_clk_enable, |
1174 | .disable = syscon_clk_disable, | 1210 | .disable = syscon_clk_disable, |
1211 | .lock = __SPIN_LOCK_UNLOCKED(ppm_clk.lock), | ||
1175 | }; | 1212 | }; |
1176 | #endif | 1213 | #endif |
1177 | 1214 | ||
@@ -1187,53 +1224,53 @@ static struct clk ppm_clk = { | |||
1187 | */ | 1224 | */ |
1188 | static struct clk_lookup lookups[] = { | 1225 | static struct clk_lookup lookups[] = { |
1189 | /* Connected directly to the AMBA bus */ | 1226 | /* Connected directly to the AMBA bus */ |
1190 | DEF_LOOKUP("amba", &amba_clk), | 1227 | DEF_LOOKUP("amba", &amba_clk), |
1191 | DEF_LOOKUP("cpu", &cpu_clk), | 1228 | DEF_LOOKUP("cpu", &cpu_clk), |
1192 | DEF_LOOKUP("nandif", &nandif_clk), | 1229 | DEF_LOOKUP("fsmc", &nandif_clk), |
1193 | DEF_LOOKUP("semi", &semi_clk), | 1230 | DEF_LOOKUP("semi", &semi_clk), |
1194 | #ifdef CONFIG_MACH_U300_BS335 | 1231 | #ifdef CONFIG_MACH_U300_BS335 |
1195 | DEF_LOOKUP("isp", &isp_clk), | 1232 | DEF_LOOKUP("isp", &isp_clk), |
1196 | DEF_LOOKUP("cds", &cds_clk), | 1233 | DEF_LOOKUP("cds", &cds_clk), |
1197 | #endif | 1234 | #endif |
1198 | DEF_LOOKUP("dma", &dma_clk), | 1235 | DEF_LOOKUP("dma", &dma_clk), |
1199 | DEF_LOOKUP("aaif", &aaif_clk), | 1236 | DEF_LOOKUP("msl", &aaif_clk), |
1200 | DEF_LOOKUP("apex", &apex_clk), | 1237 | DEF_LOOKUP("apex", &apex_clk), |
1201 | DEF_LOOKUP("video_enc", &video_enc_clk), | 1238 | DEF_LOOKUP("video_enc", &video_enc_clk), |
1202 | DEF_LOOKUP("xgam", &xgam_clk), | 1239 | DEF_LOOKUP("xgam", &xgam_clk), |
1203 | DEF_LOOKUP("ahb", &ahb_clk), | 1240 | DEF_LOOKUP("ahb", &ahb_clk), |
1204 | /* AHB bridge clocks */ | 1241 | /* AHB bridge clocks */ |
1205 | DEF_LOOKUP("ahb", &ahb_subsys_clk), | 1242 | DEF_LOOKUP("ahb_subsys", &ahb_subsys_clk), |
1206 | DEF_LOOKUP("intcon", &intcon_clk), | 1243 | DEF_LOOKUP("intcon", &intcon_clk), |
1207 | DEF_LOOKUP("mspro", &mspro_clk), | 1244 | DEF_LOOKUP("mspro", &mspro_clk), |
1208 | DEF_LOOKUP("pl172", &emif_clk), | 1245 | DEF_LOOKUP("pl172", &emif_clk), |
1209 | /* FAST bridge clocks */ | 1246 | /* FAST bridge clocks */ |
1210 | DEF_LOOKUP("fast", &fast_clk), | 1247 | DEF_LOOKUP("fast", &fast_clk), |
1211 | DEF_LOOKUP("mmci", &mmcsd_clk), | 1248 | DEF_LOOKUP("mmci", &mmcsd_clk), |
1212 | /* | 1249 | /* |
1213 | * The .0 and .1 identifiers on these comes from the platform device | 1250 | * The .0 and .1 identifiers on these comes from the platform device |
1214 | * .id field and are assigned when the platform devices are registered. | 1251 | * .id field and are assigned when the platform devices are registered. |
1215 | */ | 1252 | */ |
1216 | DEF_LOOKUP("i2s.0", &i2s0_clk), | 1253 | DEF_LOOKUP("i2s.0", &i2s0_clk), |
1217 | DEF_LOOKUP("i2s.1", &i2s1_clk), | 1254 | DEF_LOOKUP("i2s.1", &i2s1_clk), |
1218 | DEF_LOOKUP("stddci2c.0", &i2c0_clk), | 1255 | DEF_LOOKUP("stu300.0", &i2c0_clk), |
1219 | DEF_LOOKUP("stddci2c.1", &i2c1_clk), | 1256 | DEF_LOOKUP("stu300.1", &i2c1_clk), |
1220 | DEF_LOOKUP("pl022", &spi_clk), | 1257 | DEF_LOOKUP("pl022", &spi_clk), |
1221 | #ifdef CONFIG_MACH_U300_BS335 | 1258 | #ifdef CONFIG_MACH_U300_BS335 |
1222 | DEF_LOOKUP("uart1", &uart1_clk), | 1259 | DEF_LOOKUP("uart1", &uart1_clk), |
1223 | #endif | 1260 | #endif |
1224 | /* SLOW bridge clocks */ | 1261 | /* SLOW bridge clocks */ |
1225 | DEF_LOOKUP("slow", &slow_clk), | 1262 | DEF_LOOKUP("slow", &slow_clk), |
1226 | DEF_LOOKUP("wdog", &wdog_clk), | 1263 | DEF_LOOKUP("coh901327_wdog", &wdog_clk), |
1227 | DEF_LOOKUP("uart0", &uart_clk), | 1264 | DEF_LOOKUP("uart0", &uart_clk), |
1228 | DEF_LOOKUP("apptimer", &app_timer_clk), | 1265 | DEF_LOOKUP("apptimer", &app_timer_clk), |
1229 | DEF_LOOKUP("keypad", &keypad_clk), | 1266 | DEF_LOOKUP("coh901461-keypad", &keypad_clk), |
1230 | DEF_LOOKUP("u300-gpio", &gpio_clk), | 1267 | DEF_LOOKUP("u300-gpio", &gpio_clk), |
1231 | DEF_LOOKUP("rtc0", &rtc_clk), | 1268 | DEF_LOOKUP("rtc-coh901331", &rtc_clk), |
1232 | DEF_LOOKUP("bustr", &bustr_clk), | 1269 | DEF_LOOKUP("bustr", &bustr_clk), |
1233 | DEF_LOOKUP("evhist", &evhist_clk), | 1270 | DEF_LOOKUP("evhist", &evhist_clk), |
1234 | DEF_LOOKUP("timer", &timer_clk), | 1271 | DEF_LOOKUP("timer", &timer_clk), |
1235 | #ifdef CONFIG_MACH_U300_BS335 | 1272 | #ifdef CONFIG_MACH_U300_BS335 |
1236 | DEF_LOOKUP("ppm", &ppm_clk), | 1273 | DEF_LOOKUP("ppm", &ppm_clk), |
1237 | #endif | 1274 | #endif |
1238 | }; | 1275 | }; |
1239 | 1276 | ||
@@ -1427,16 +1464,20 @@ static const struct file_operations u300_clocks_operations = { | |||
1427 | .release = single_release, | 1464 | .release = single_release, |
1428 | }; | 1465 | }; |
1429 | 1466 | ||
1430 | static void init_clk_read_procfs(void) | 1467 | static int __init init_clk_read_debugfs(void) |
1431 | { | 1468 | { |
1432 | /* Expose a simple debugfs interface to view all clocks */ | 1469 | /* Expose a simple debugfs interface to view all clocks */ |
1433 | (void) debugfs_create_file("u300_clocks", S_IFREG | S_IRUGO, | 1470 | (void) debugfs_create_file("u300_clocks", S_IFREG | S_IRUGO, |
1434 | NULL, NULL, &u300_clocks_operations); | 1471 | NULL, NULL, |
1435 | } | 1472 | &u300_clocks_operations); |
1436 | #else | 1473 | return 0; |
1437 | static inline void init_clk_read_procfs(void) | ||
1438 | { | ||
1439 | } | 1474 | } |
1475 | /* | ||
1476 | * This needs to come in after the core_initcall() for the | ||
1477 | * overall clocks, because debugfs is not available until | ||
1478 | * the subsystems come up. | ||
1479 | */ | ||
1480 | module_init(init_clk_read_debugfs); | ||
1440 | #endif | 1481 | #endif |
1441 | 1482 | ||
1442 | static int __init u300_clock_init(void) | 1483 | static int __init u300_clock_init(void) |
@@ -1462,8 +1503,6 @@ static int __init u300_clock_init(void) | |||
1462 | 1503 | ||
1463 | clk_register(); | 1504 | clk_register(); |
1464 | 1505 | ||
1465 | init_clk_read_procfs(); | ||
1466 | |||
1467 | /* | 1506 | /* |
1468 | * Some of these may be on when we boot the system so make sure they | 1507 | * Some of these may be on when we boot the system so make sure they |
1469 | * are turned OFF. | 1508 | * are turned OFF. |
diff --git a/arch/arm/mm/proc-syms.c b/arch/arm/mm/proc-syms.c index 195e48edd8c2..ac5c80062b70 100644 --- a/arch/arm/mm/proc-syms.c +++ b/arch/arm/mm/proc-syms.c | |||
@@ -27,6 +27,7 @@ EXPORT_SYMBOL(__cpuc_flush_kern_all); | |||
27 | EXPORT_SYMBOL(__cpuc_flush_user_all); | 27 | EXPORT_SYMBOL(__cpuc_flush_user_all); |
28 | EXPORT_SYMBOL(__cpuc_flush_user_range); | 28 | EXPORT_SYMBOL(__cpuc_flush_user_range); |
29 | EXPORT_SYMBOL(__cpuc_coherent_kern_range); | 29 | EXPORT_SYMBOL(__cpuc_coherent_kern_range); |
30 | EXPORT_SYMBOL(__cpuc_flush_dcache_page); | ||
30 | EXPORT_SYMBOL(dmac_inv_range); /* because of flush_ioremap_region() */ | 31 | EXPORT_SYMBOL(dmac_inv_range); /* because of flush_ioremap_region() */ |
31 | #else | 32 | #else |
32 | EXPORT_SYMBOL(cpu_cache); | 33 | EXPORT_SYMBOL(cpu_cache); |
diff --git a/arch/avr32/include/asm/thread_info.h b/arch/avr32/include/asm/thread_info.h index 4442f8d2d423..fc42de5ca209 100644 --- a/arch/avr32/include/asm/thread_info.h +++ b/arch/avr32/include/asm/thread_info.h | |||
@@ -40,7 +40,7 @@ struct thread_info { | |||
40 | .exec_domain = &default_exec_domain, \ | 40 | .exec_domain = &default_exec_domain, \ |
41 | .flags = 0, \ | 41 | .flags = 0, \ |
42 | .cpu = 0, \ | 42 | .cpu = 0, \ |
43 | .preempt_count = 1, \ | 43 | .preempt_count = INIT_PREEMPT_COUNT, \ |
44 | .restart_block = { \ | 44 | .restart_block = { \ |
45 | .fn = do_no_restart_syscall \ | 45 | .fn = do_no_restart_syscall \ |
46 | } \ | 46 | } \ |
diff --git a/arch/avr32/kernel/traps.c b/arch/avr32/kernel/traps.c index 6e3d491184ea..b91b2044af9c 100644 --- a/arch/avr32/kernel/traps.c +++ b/arch/avr32/kernel/traps.c | |||
@@ -32,22 +32,25 @@ void NORET_TYPE die(const char *str, struct pt_regs *regs, long err) | |||
32 | spin_lock_irq(&die_lock); | 32 | spin_lock_irq(&die_lock); |
33 | bust_spinlocks(1); | 33 | bust_spinlocks(1); |
34 | 34 | ||
35 | printk(KERN_ALERT "Oops: %s, sig: %ld [#%d]\n" KERN_EMERG, | 35 | printk(KERN_ALERT "Oops: %s, sig: %ld [#%d]\n", |
36 | str, err, ++die_counter); | 36 | str, err, ++die_counter); |
37 | |||
38 | printk(KERN_EMERG); | ||
39 | |||
37 | #ifdef CONFIG_PREEMPT | 40 | #ifdef CONFIG_PREEMPT |
38 | printk("PREEMPT "); | 41 | printk(KERN_CONT "PREEMPT "); |
39 | #endif | 42 | #endif |
40 | #ifdef CONFIG_FRAME_POINTER | 43 | #ifdef CONFIG_FRAME_POINTER |
41 | printk("FRAME_POINTER "); | 44 | printk(KERN_CONT "FRAME_POINTER "); |
42 | #endif | 45 | #endif |
43 | if (current_cpu_data.features & AVR32_FEATURE_OCD) { | 46 | if (current_cpu_data.features & AVR32_FEATURE_OCD) { |
44 | unsigned long did = ocd_read(DID); | 47 | unsigned long did = ocd_read(DID); |
45 | printk("chip: 0x%03lx:0x%04lx rev %lu\n", | 48 | printk(KERN_CONT "chip: 0x%03lx:0x%04lx rev %lu\n", |
46 | (did >> 1) & 0x7ff, | 49 | (did >> 1) & 0x7ff, |
47 | (did >> 12) & 0x7fff, | 50 | (did >> 12) & 0x7fff, |
48 | (did >> 28) & 0xf); | 51 | (did >> 28) & 0xf); |
49 | } else { | 52 | } else { |
50 | printk("cpu: arch %u r%u / core %u r%u\n", | 53 | printk(KERN_CONT "cpu: arch %u r%u / core %u r%u\n", |
51 | current_cpu_data.arch_type, | 54 | current_cpu_data.arch_type, |
52 | current_cpu_data.arch_revision, | 55 | current_cpu_data.arch_revision, |
53 | current_cpu_data.cpu_type, | 56 | current_cpu_data.cpu_type, |
diff --git a/arch/blackfin/include/asm/thread_info.h b/arch/blackfin/include/asm/thread_info.h index 2920087516f2..2bbfdd950afc 100644 --- a/arch/blackfin/include/asm/thread_info.h +++ b/arch/blackfin/include/asm/thread_info.h | |||
@@ -77,7 +77,7 @@ struct thread_info { | |||
77 | .exec_domain = &default_exec_domain, \ | 77 | .exec_domain = &default_exec_domain, \ |
78 | .flags = 0, \ | 78 | .flags = 0, \ |
79 | .cpu = 0, \ | 79 | .cpu = 0, \ |
80 | .preempt_count = 1, \ | 80 | .preempt_count = INIT_PREEMPT_COUNT, \ |
81 | .restart_block = { \ | 81 | .restart_block = { \ |
82 | .fn = do_no_restart_syscall, \ | 82 | .fn = do_no_restart_syscall, \ |
83 | }, \ | 83 | }, \ |
diff --git a/arch/blackfin/kernel/ptrace.c b/arch/blackfin/kernel/ptrace.c index d76618db50df..6a387eec6b65 100644 --- a/arch/blackfin/kernel/ptrace.c +++ b/arch/blackfin/kernel/ptrace.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/sched.h> | 31 | #include <linux/sched.h> |
32 | #include <linux/mm.h> | 32 | #include <linux/mm.h> |
33 | #include <linux/smp.h> | 33 | #include <linux/smp.h> |
34 | #include <linux/smp_lock.h> | ||
35 | #include <linux/errno.h> | 34 | #include <linux/errno.h> |
36 | #include <linux/ptrace.h> | 35 | #include <linux/ptrace.h> |
37 | #include <linux/user.h> | 36 | #include <linux/user.h> |
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c index 298f023bcc09..6136c33e919f 100644 --- a/arch/blackfin/kernel/setup.c +++ b/arch/blackfin/kernel/setup.c | |||
@@ -408,13 +408,14 @@ static void __init print_memory_map(char *who) | |||
408 | bfin_memmap.map[i].addr + bfin_memmap.map[i].size); | 408 | bfin_memmap.map[i].addr + bfin_memmap.map[i].size); |
409 | switch (bfin_memmap.map[i].type) { | 409 | switch (bfin_memmap.map[i].type) { |
410 | case BFIN_MEMMAP_RAM: | 410 | case BFIN_MEMMAP_RAM: |
411 | printk("(usable)\n"); | 411 | printk(KERN_CONT "(usable)\n"); |
412 | break; | 412 | break; |
413 | case BFIN_MEMMAP_RESERVED: | 413 | case BFIN_MEMMAP_RESERVED: |
414 | printk("(reserved)\n"); | 414 | printk(KERN_CONT "(reserved)\n"); |
415 | break; | 415 | break; |
416 | default: printk("type %lu\n", bfin_memmap.map[i].type); | 416 | default: |
417 | break; | 417 | printk(KERN_CONT "type %lu\n", bfin_memmap.map[i].type); |
418 | break; | ||
418 | } | 419 | } |
419 | } | 420 | } |
420 | } | 421 | } |
@@ -614,19 +615,19 @@ static __init void memory_setup(void) | |||
614 | printk(KERN_INFO "Kernel Managed Memory: %ldMB\n", _ramend >> 20); | 615 | printk(KERN_INFO "Kernel Managed Memory: %ldMB\n", _ramend >> 20); |
615 | 616 | ||
616 | printk(KERN_INFO "Memory map:\n" | 617 | printk(KERN_INFO "Memory map:\n" |
617 | KERN_INFO " fixedcode = 0x%p-0x%p\n" | 618 | " fixedcode = 0x%p-0x%p\n" |
618 | KERN_INFO " text = 0x%p-0x%p\n" | 619 | " text = 0x%p-0x%p\n" |
619 | KERN_INFO " rodata = 0x%p-0x%p\n" | 620 | " rodata = 0x%p-0x%p\n" |
620 | KERN_INFO " bss = 0x%p-0x%p\n" | 621 | " bss = 0x%p-0x%p\n" |
621 | KERN_INFO " data = 0x%p-0x%p\n" | 622 | " data = 0x%p-0x%p\n" |
622 | KERN_INFO " stack = 0x%p-0x%p\n" | 623 | " stack = 0x%p-0x%p\n" |
623 | KERN_INFO " init = 0x%p-0x%p\n" | 624 | " init = 0x%p-0x%p\n" |
624 | KERN_INFO " available = 0x%p-0x%p\n" | 625 | " available = 0x%p-0x%p\n" |
625 | #ifdef CONFIG_MTD_UCLINUX | 626 | #ifdef CONFIG_MTD_UCLINUX |
626 | KERN_INFO " rootfs = 0x%p-0x%p\n" | 627 | " rootfs = 0x%p-0x%p\n" |
627 | #endif | 628 | #endif |
628 | #if DMA_UNCACHED_REGION > 0 | 629 | #if DMA_UNCACHED_REGION > 0 |
629 | KERN_INFO " DMA Zone = 0x%p-0x%p\n" | 630 | " DMA Zone = 0x%p-0x%p\n" |
630 | #endif | 631 | #endif |
631 | , (void *)FIXED_CODE_START, (void *)FIXED_CODE_END, | 632 | , (void *)FIXED_CODE_START, (void *)FIXED_CODE_END, |
632 | _stext, _etext, | 633 | _stext, _etext, |
@@ -859,13 +860,13 @@ void __init setup_arch(char **cmdline_p) | |||
859 | #endif | 860 | #endif |
860 | printk(KERN_INFO "Hardware Trace "); | 861 | printk(KERN_INFO "Hardware Trace "); |
861 | if (bfin_read_TBUFCTL() & 0x1) | 862 | if (bfin_read_TBUFCTL() & 0x1) |
862 | printk("Active "); | 863 | printk(KERN_CONT "Active "); |
863 | else | 864 | else |
864 | printk("Off "); | 865 | printk(KERN_CONT "Off "); |
865 | if (bfin_read_TBUFCTL() & 0x2) | 866 | if (bfin_read_TBUFCTL() & 0x2) |
866 | printk("and Enabled\n"); | 867 | printk(KERN_CONT "and Enabled\n"); |
867 | else | 868 | else |
868 | printk("and Disabled\n"); | 869 | printk(KERN_CONT "and Disabled\n"); |
869 | 870 | ||
870 | #if defined(CONFIG_CHR_DEV_FLASH) || defined(CONFIG_BLK_DEV_FLASH) | 871 | #if defined(CONFIG_CHR_DEV_FLASH) || defined(CONFIG_BLK_DEV_FLASH) |
871 | /* we need to initialize the Flashrom device here since we might | 872 | /* we need to initialize the Flashrom device here since we might |
diff --git a/arch/blackfin/kernel/sys_bfin.c b/arch/blackfin/kernel/sys_bfin.c index a8f1329c15a4..3da60fb13ce4 100644 --- a/arch/blackfin/kernel/sys_bfin.c +++ b/arch/blackfin/kernel/sys_bfin.c | |||
@@ -29,7 +29,6 @@ | |||
29 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 29 | * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include <linux/smp_lock.h> | ||
33 | #include <linux/spinlock.h> | 32 | #include <linux/spinlock.h> |
34 | #include <linux/sem.h> | 33 | #include <linux/sem.h> |
35 | #include <linux/msg.h> | 34 | #include <linux/msg.h> |
diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c index 8eeb457ce5d5..8a1caf2bb5b9 100644 --- a/arch/blackfin/kernel/traps.c +++ b/arch/blackfin/kernel/traps.c | |||
@@ -212,7 +212,7 @@ asmlinkage void double_fault_c(struct pt_regs *fp) | |||
212 | console_verbose(); | 212 | console_verbose(); |
213 | oops_in_progress = 1; | 213 | oops_in_progress = 1; |
214 | #ifdef CONFIG_DEBUG_VERBOSE | 214 | #ifdef CONFIG_DEBUG_VERBOSE |
215 | printk(KERN_EMERG "\n" KERN_EMERG "Double Fault\n"); | 215 | printk(KERN_EMERG "Double Fault\n"); |
216 | #ifdef CONFIG_DEBUG_DOUBLEFAULT_PRINT | 216 | #ifdef CONFIG_DEBUG_DOUBLEFAULT_PRINT |
217 | if (((long)fp->seqstat & SEQSTAT_EXCAUSE) == VEC_UNCOV) { | 217 | if (((long)fp->seqstat & SEQSTAT_EXCAUSE) == VEC_UNCOV) { |
218 | unsigned int cpu = smp_processor_id(); | 218 | unsigned int cpu = smp_processor_id(); |
@@ -583,15 +583,14 @@ asmlinkage void trap_c(struct pt_regs *fp) | |||
583 | #ifndef CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE | 583 | #ifndef CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE |
584 | if (trapnr == VEC_CPLB_I_M || trapnr == VEC_CPLB_M) | 584 | if (trapnr == VEC_CPLB_I_M || trapnr == VEC_CPLB_M) |
585 | verbose_printk(KERN_NOTICE "No trace since you do not have " | 585 | verbose_printk(KERN_NOTICE "No trace since you do not have " |
586 | "CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE enabled\n" | 586 | "CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE enabled\n\n"); |
587 | KERN_NOTICE "\n"); | ||
588 | else | 587 | else |
589 | #endif | 588 | #endif |
590 | dump_bfin_trace_buffer(); | 589 | dump_bfin_trace_buffer(); |
591 | 590 | ||
592 | if (oops_in_progress) { | 591 | if (oops_in_progress) { |
593 | /* Dump the current kernel stack */ | 592 | /* Dump the current kernel stack */ |
594 | verbose_printk(KERN_NOTICE "\n" KERN_NOTICE "Kernel Stack\n"); | 593 | verbose_printk(KERN_NOTICE "Kernel Stack\n"); |
595 | show_stack(current, NULL); | 594 | show_stack(current, NULL); |
596 | print_modules(); | 595 | print_modules(); |
597 | #ifndef CONFIG_ACCESS_CHECK | 596 | #ifndef CONFIG_ACCESS_CHECK |
@@ -906,7 +905,7 @@ void show_stack(struct task_struct *task, unsigned long *stack) | |||
906 | 905 | ||
907 | ret_addr = 0; | 906 | ret_addr = 0; |
908 | if (!j && i % 8 == 0) | 907 | if (!j && i % 8 == 0) |
909 | printk("\n" KERN_NOTICE "%p:",addr); | 908 | printk(KERN_NOTICE "%p:",addr); |
910 | 909 | ||
911 | /* if it is an odd address, or zero, just skip it */ | 910 | /* if it is an odd address, or zero, just skip it */ |
912 | if (*addr & 0x1 || !*addr) | 911 | if (*addr & 0x1 || !*addr) |
@@ -996,9 +995,9 @@ void dump_bfin_process(struct pt_regs *fp) | |||
996 | 995 | ||
997 | printk(KERN_NOTICE "CPU = %d\n", current_thread_info()->cpu); | 996 | printk(KERN_NOTICE "CPU = %d\n", current_thread_info()->cpu); |
998 | if (!((unsigned long)current->mm & 0x3) && (unsigned long)current->mm >= FIXED_CODE_START) | 997 | if (!((unsigned long)current->mm & 0x3) && (unsigned long)current->mm >= FIXED_CODE_START) |
999 | verbose_printk(KERN_NOTICE "TEXT = 0x%p-0x%p DATA = 0x%p-0x%p\n" | 998 | verbose_printk(KERN_NOTICE |
1000 | KERN_NOTICE " BSS = 0x%p-0x%p USER-STACK = 0x%p\n" | 999 | "TEXT = 0x%p-0x%p DATA = 0x%p-0x%p\n" |
1001 | KERN_NOTICE "\n", | 1000 | " BSS = 0x%p-0x%p USER-STACK = 0x%p\n\n", |
1002 | (void *)current->mm->start_code, | 1001 | (void *)current->mm->start_code, |
1003 | (void *)current->mm->end_code, | 1002 | (void *)current->mm->end_code, |
1004 | (void *)current->mm->start_data, | 1003 | (void *)current->mm->start_data, |
@@ -1009,8 +1008,8 @@ void dump_bfin_process(struct pt_regs *fp) | |||
1009 | else | 1008 | else |
1010 | verbose_printk(KERN_NOTICE "invalid mm\n"); | 1009 | verbose_printk(KERN_NOTICE "invalid mm\n"); |
1011 | } else | 1010 | } else |
1012 | verbose_printk(KERN_NOTICE "\n" KERN_NOTICE | 1011 | verbose_printk(KERN_NOTICE |
1013 | "No Valid process in current context\n"); | 1012 | "No Valid process in current context\n"); |
1014 | #endif | 1013 | #endif |
1015 | } | 1014 | } |
1016 | 1015 | ||
@@ -1028,7 +1027,7 @@ void dump_bfin_mem(struct pt_regs *fp) | |||
1028 | addr < (unsigned short *)((unsigned long)erraddr & ~0xF) + 0x10; | 1027 | addr < (unsigned short *)((unsigned long)erraddr & ~0xF) + 0x10; |
1029 | addr++) { | 1028 | addr++) { |
1030 | if (!((unsigned long)addr & 0xF)) | 1029 | if (!((unsigned long)addr & 0xF)) |
1031 | verbose_printk("\n" KERN_NOTICE "0x%p: ", addr); | 1030 | verbose_printk(KERN_NOTICE "0x%p: ", addr); |
1032 | 1031 | ||
1033 | if (!get_instruction(&val, addr)) { | 1032 | if (!get_instruction(&val, addr)) { |
1034 | val = 0; | 1033 | val = 0; |
@@ -1056,9 +1055,9 @@ void dump_bfin_mem(struct pt_regs *fp) | |||
1056 | oops_in_progress)){ | 1055 | oops_in_progress)){ |
1057 | verbose_printk(KERN_NOTICE "Looks like this was a deferred error - sorry\n"); | 1056 | verbose_printk(KERN_NOTICE "Looks like this was a deferred error - sorry\n"); |
1058 | #ifndef CONFIG_DEBUG_HWERR | 1057 | #ifndef CONFIG_DEBUG_HWERR |
1059 | verbose_printk(KERN_NOTICE "The remaining message may be meaningless\n" | 1058 | verbose_printk(KERN_NOTICE |
1060 | KERN_NOTICE "You should enable CONFIG_DEBUG_HWERR to get a" | 1059 | "The remaining message may be meaningless\n" |
1061 | " better idea where it came from\n"); | 1060 | "You should enable CONFIG_DEBUG_HWERR to get a better idea where it came from\n"); |
1062 | #else | 1061 | #else |
1063 | /* If we are handling only one peripheral interrupt | 1062 | /* If we are handling only one peripheral interrupt |
1064 | * and current mm and pid are valid, and the last error | 1063 | * and current mm and pid are valid, and the last error |
@@ -1114,9 +1113,10 @@ void show_regs(struct pt_regs *fp) | |||
1114 | 1113 | ||
1115 | verbose_printk(KERN_NOTICE "%s", linux_banner); | 1114 | verbose_printk(KERN_NOTICE "%s", linux_banner); |
1116 | 1115 | ||
1117 | verbose_printk(KERN_NOTICE "\n" KERN_NOTICE "SEQUENCER STATUS:\t\t%s\n", print_tainted()); | 1116 | verbose_printk(KERN_NOTICE "\nSEQUENCER STATUS:\t\t%s\n", |
1117 | print_tainted()); | ||
1118 | verbose_printk(KERN_NOTICE " SEQSTAT: %08lx IPEND: %04lx SYSCFG: %04lx\n", | 1118 | verbose_printk(KERN_NOTICE " SEQSTAT: %08lx IPEND: %04lx SYSCFG: %04lx\n", |
1119 | (long)fp->seqstat, fp->ipend, fp->syscfg); | 1119 | (long)fp->seqstat, fp->ipend, fp->syscfg); |
1120 | if ((fp->seqstat & SEQSTAT_EXCAUSE) == VEC_HWERR) { | 1120 | if ((fp->seqstat & SEQSTAT_EXCAUSE) == VEC_HWERR) { |
1121 | verbose_printk(KERN_NOTICE " HWERRCAUSE: 0x%lx\n", | 1121 | verbose_printk(KERN_NOTICE " HWERRCAUSE: 0x%lx\n", |
1122 | (fp->seqstat & SEQSTAT_HWERRCAUSE) >> 14); | 1122 | (fp->seqstat & SEQSTAT_HWERRCAUSE) >> 14); |
@@ -1184,7 +1184,7 @@ unlock: | |||
1184 | verbose_printk(KERN_NOTICE "ICPLB_FAULT_ADDR: %s\n", buf); | 1184 | verbose_printk(KERN_NOTICE "ICPLB_FAULT_ADDR: %s\n", buf); |
1185 | } | 1185 | } |
1186 | 1186 | ||
1187 | verbose_printk(KERN_NOTICE "\n" KERN_NOTICE "PROCESSOR STATE:\n"); | 1187 | verbose_printk(KERN_NOTICE "PROCESSOR STATE:\n"); |
1188 | verbose_printk(KERN_NOTICE " R0 : %08lx R1 : %08lx R2 : %08lx R3 : %08lx\n", | 1188 | verbose_printk(KERN_NOTICE " R0 : %08lx R1 : %08lx R2 : %08lx R3 : %08lx\n", |
1189 | fp->r0, fp->r1, fp->r2, fp->r3); | 1189 | fp->r0, fp->r1, fp->r2, fp->r3); |
1190 | verbose_printk(KERN_NOTICE " R4 : %08lx R5 : %08lx R6 : %08lx R7 : %08lx\n", | 1190 | verbose_printk(KERN_NOTICE " R4 : %08lx R5 : %08lx R6 : %08lx R7 : %08lx\n", |
diff --git a/arch/cris/include/asm/thread_info.h b/arch/cris/include/asm/thread_info.h index bc5b2935ca53..c3aade36c330 100644 --- a/arch/cris/include/asm/thread_info.h +++ b/arch/cris/include/asm/thread_info.h | |||
@@ -50,8 +50,6 @@ struct thread_info { | |||
50 | 50 | ||
51 | /* | 51 | /* |
52 | * macros/functions for gaining access to the thread information structure | 52 | * macros/functions for gaining access to the thread information structure |
53 | * | ||
54 | * preempt_count needs to be 1 initially, until the scheduler is functional. | ||
55 | */ | 53 | */ |
56 | #ifndef __ASSEMBLY__ | 54 | #ifndef __ASSEMBLY__ |
57 | #define INIT_THREAD_INFO(tsk) \ | 55 | #define INIT_THREAD_INFO(tsk) \ |
@@ -60,7 +58,7 @@ struct thread_info { | |||
60 | .exec_domain = &default_exec_domain, \ | 58 | .exec_domain = &default_exec_domain, \ |
61 | .flags = 0, \ | 59 | .flags = 0, \ |
62 | .cpu = 0, \ | 60 | .cpu = 0, \ |
63 | .preempt_count = 1, \ | 61 | .preempt_count = INIT_PREEMPT_COUNT, \ |
64 | .addr_limit = KERNEL_DS, \ | 62 | .addr_limit = KERNEL_DS, \ |
65 | .restart_block = { \ | 63 | .restart_block = { \ |
66 | .fn = do_no_restart_syscall, \ | 64 | .fn = do_no_restart_syscall, \ |
diff --git a/arch/cris/kernel/sys_cris.c b/arch/cris/kernel/sys_cris.c index a79fbd87021b..2ad962c7e88e 100644 --- a/arch/cris/kernel/sys_cris.c +++ b/arch/cris/kernel/sys_cris.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/mm.h> | 15 | #include <linux/mm.h> |
16 | #include <linux/fs.h> | 16 | #include <linux/fs.h> |
17 | #include <linux/smp.h> | 17 | #include <linux/smp.h> |
18 | #include <linux/smp_lock.h> | ||
19 | #include <linux/sem.h> | 18 | #include <linux/sem.h> |
20 | #include <linux/msg.h> | 19 | #include <linux/msg.h> |
21 | #include <linux/shm.h> | 20 | #include <linux/shm.h> |
diff --git a/arch/frv/include/asm/thread_info.h b/arch/frv/include/asm/thread_info.h index e8a5ed7be021..e608e056bb53 100644 --- a/arch/frv/include/asm/thread_info.h +++ b/arch/frv/include/asm/thread_info.h | |||
@@ -56,8 +56,6 @@ struct thread_info { | |||
56 | 56 | ||
57 | /* | 57 | /* |
58 | * macros/functions for gaining access to the thread information structure | 58 | * macros/functions for gaining access to the thread information structure |
59 | * | ||
60 | * preempt_count needs to be 1 initially, until the scheduler is functional. | ||
61 | */ | 59 | */ |
62 | #ifndef __ASSEMBLY__ | 60 | #ifndef __ASSEMBLY__ |
63 | 61 | ||
@@ -67,7 +65,7 @@ struct thread_info { | |||
67 | .exec_domain = &default_exec_domain, \ | 65 | .exec_domain = &default_exec_domain, \ |
68 | .flags = 0, \ | 66 | .flags = 0, \ |
69 | .cpu = 0, \ | 67 | .cpu = 0, \ |
70 | .preempt_count = 1, \ | 68 | .preempt_count = INIT_PREEMPT_COUNT, \ |
71 | .addr_limit = KERNEL_DS, \ | 69 | .addr_limit = KERNEL_DS, \ |
72 | .restart_block = { \ | 70 | .restart_block = { \ |
73 | .fn = do_no_restart_syscall, \ | 71 | .fn = do_no_restart_syscall, \ |
diff --git a/arch/h8300/include/asm/thread_info.h b/arch/h8300/include/asm/thread_info.h index 700014d2155f..8bbc8b0ee45d 100644 --- a/arch/h8300/include/asm/thread_info.h +++ b/arch/h8300/include/asm/thread_info.h | |||
@@ -36,7 +36,7 @@ struct thread_info { | |||
36 | .exec_domain = &default_exec_domain, \ | 36 | .exec_domain = &default_exec_domain, \ |
37 | .flags = 0, \ | 37 | .flags = 0, \ |
38 | .cpu = 0, \ | 38 | .cpu = 0, \ |
39 | .preempt_count = 1, \ | 39 | .preempt_count = INIT_PREEMPT_COUNT, \ |
40 | .restart_block = { \ | 40 | .restart_block = { \ |
41 | .fn = do_no_restart_syscall, \ | 41 | .fn = do_no_restart_syscall, \ |
42 | }, \ | 42 | }, \ |
diff --git a/arch/ia64/include/asm/thread_info.h b/arch/ia64/include/asm/thread_info.h index ae6922626bf4..8ce2e388e37c 100644 --- a/arch/ia64/include/asm/thread_info.h +++ b/arch/ia64/include/asm/thread_info.h | |||
@@ -48,7 +48,7 @@ struct thread_info { | |||
48 | .flags = 0, \ | 48 | .flags = 0, \ |
49 | .cpu = 0, \ | 49 | .cpu = 0, \ |
50 | .addr_limit = KERNEL_DS, \ | 50 | .addr_limit = KERNEL_DS, \ |
51 | .preempt_count = 0, \ | 51 | .preempt_count = INIT_PREEMPT_COUNT, \ |
52 | .restart_block = { \ | 52 | .restart_block = { \ |
53 | .fn = do_no_restart_syscall, \ | 53 | .fn = do_no_restart_syscall, \ |
54 | }, \ | 54 | }, \ |
diff --git a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c index 92c9689b7d97..9daa87fdb018 100644 --- a/arch/ia64/kernel/ptrace.c +++ b/arch/ia64/kernel/ptrace.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/mm.h> | 15 | #include <linux/mm.h> |
16 | #include <linux/errno.h> | 16 | #include <linux/errno.h> |
17 | #include <linux/ptrace.h> | 17 | #include <linux/ptrace.h> |
18 | #include <linux/smp_lock.h> | ||
19 | #include <linux/user.h> | 18 | #include <linux/user.h> |
20 | #include <linux/security.h> | 19 | #include <linux/security.h> |
21 | #include <linux/audit.h> | 20 | #include <linux/audit.h> |
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c index 729298f4b234..7de76dd352fe 100644 --- a/arch/ia64/pci/pci.c +++ b/arch/ia64/pci/pci.c | |||
@@ -537,7 +537,7 @@ pcibios_align_resource (void *data, struct resource *res, | |||
537 | /* | 537 | /* |
538 | * PCI BIOS setup, always defaults to SAL interface | 538 | * PCI BIOS setup, always defaults to SAL interface |
539 | */ | 539 | */ |
540 | char * __devinit | 540 | char * __init |
541 | pcibios_setup (char *str) | 541 | pcibios_setup (char *str) |
542 | { | 542 | { |
543 | return str; | 543 | return str; |
diff --git a/arch/m32r/include/asm/thread_info.h b/arch/m32r/include/asm/thread_info.h index 8589d462df27..07bb5bd00e2a 100644 --- a/arch/m32r/include/asm/thread_info.h +++ b/arch/m32r/include/asm/thread_info.h | |||
@@ -57,8 +57,6 @@ struct thread_info { | |||
57 | 57 | ||
58 | /* | 58 | /* |
59 | * macros/functions for gaining access to the thread information structure | 59 | * macros/functions for gaining access to the thread information structure |
60 | * | ||
61 | * preempt_count needs to be 1 initially, until the scheduler is functional. | ||
62 | */ | 60 | */ |
63 | #ifndef __ASSEMBLY__ | 61 | #ifndef __ASSEMBLY__ |
64 | 62 | ||
@@ -68,7 +66,7 @@ struct thread_info { | |||
68 | .exec_domain = &default_exec_domain, \ | 66 | .exec_domain = &default_exec_domain, \ |
69 | .flags = 0, \ | 67 | .flags = 0, \ |
70 | .cpu = 0, \ | 68 | .cpu = 0, \ |
71 | .preempt_count = 1, \ | 69 | .preempt_count = INIT_PREEMPT_COUNT, \ |
72 | .addr_limit = KERNEL_DS, \ | 70 | .addr_limit = KERNEL_DS, \ |
73 | .restart_block = { \ | 71 | .restart_block = { \ |
74 | .fn = do_no_restart_syscall, \ | 72 | .fn = do_no_restart_syscall, \ |
diff --git a/arch/m32r/kernel/ptrace.c b/arch/m32r/kernel/ptrace.c index bf0abe9e1f73..98b8feb12ed8 100644 --- a/arch/m32r/kernel/ptrace.c +++ b/arch/m32r/kernel/ptrace.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/mm.h> | 19 | #include <linux/mm.h> |
20 | #include <linux/err.h> | 20 | #include <linux/err.h> |
21 | #include <linux/smp.h> | 21 | #include <linux/smp.h> |
22 | #include <linux/smp_lock.h> | ||
23 | #include <linux/errno.h> | 22 | #include <linux/errno.h> |
24 | #include <linux/ptrace.h> | 23 | #include <linux/ptrace.h> |
25 | #include <linux/user.h> | 24 | #include <linux/user.h> |
diff --git a/arch/m68k/include/asm/thread_info_mm.h b/arch/m68k/include/asm/thread_info_mm.h index af0fda46e94b..6ea5c33b3c56 100644 --- a/arch/m68k/include/asm/thread_info_mm.h +++ b/arch/m68k/include/asm/thread_info_mm.h | |||
@@ -19,6 +19,7 @@ struct thread_info { | |||
19 | { \ | 19 | { \ |
20 | .task = &tsk, \ | 20 | .task = &tsk, \ |
21 | .exec_domain = &default_exec_domain, \ | 21 | .exec_domain = &default_exec_domain, \ |
22 | .preempt_count = INIT_PREEMPT_COUNT, \ | ||
22 | .restart_block = { \ | 23 | .restart_block = { \ |
23 | .fn = do_no_restart_syscall, \ | 24 | .fn = do_no_restart_syscall, \ |
24 | }, \ | 25 | }, \ |
diff --git a/arch/m68k/include/asm/thread_info_no.h b/arch/m68k/include/asm/thread_info_no.h index 82529f424ea3..c2bde5e24b0b 100644 --- a/arch/m68k/include/asm/thread_info_no.h +++ b/arch/m68k/include/asm/thread_info_no.h | |||
@@ -49,6 +49,7 @@ struct thread_info { | |||
49 | .exec_domain = &default_exec_domain, \ | 49 | .exec_domain = &default_exec_domain, \ |
50 | .flags = 0, \ | 50 | .flags = 0, \ |
51 | .cpu = 0, \ | 51 | .cpu = 0, \ |
52 | .preempt_count = INIT_PREEMPT_COUNT, \ | ||
52 | .restart_block = { \ | 53 | .restart_block = { \ |
53 | .fn = do_no_restart_syscall, \ | 54 | .fn = do_no_restart_syscall, \ |
54 | }, \ | 55 | }, \ |
diff --git a/arch/m68knommu/kernel/process.c b/arch/m68knommu/kernel/process.c index 1e96c6eb6312..8f8f4abab2ff 100644 --- a/arch/m68knommu/kernel/process.c +++ b/arch/m68knommu/kernel/process.c | |||
@@ -290,7 +290,7 @@ void dump(struct pt_regs *fp) | |||
290 | unsigned char *tp; | 290 | unsigned char *tp; |
291 | int i; | 291 | int i; |
292 | 292 | ||
293 | printk(KERN_EMERG "\n" KERN_EMERG "CURRENT PROCESS:\n" KERN_EMERG "\n"); | 293 | printk(KERN_EMERG "\nCURRENT PROCESS:\n\n"); |
294 | printk(KERN_EMERG "COMM=%s PID=%d\n", current->comm, current->pid); | 294 | printk(KERN_EMERG "COMM=%s PID=%d\n", current->comm, current->pid); |
295 | 295 | ||
296 | if (current->mm) { | 296 | if (current->mm) { |
@@ -301,8 +301,7 @@ void dump(struct pt_regs *fp) | |||
301 | (int) current->mm->end_data, | 301 | (int) current->mm->end_data, |
302 | (int) current->mm->end_data, | 302 | (int) current->mm->end_data, |
303 | (int) current->mm->brk); | 303 | (int) current->mm->brk); |
304 | printk(KERN_EMERG "USER-STACK=%08x KERNEL-STACK=%08x\n" | 304 | printk(KERN_EMERG "USER-STACK=%08x KERNEL-STACK=%08x\n\n", |
305 | KERN_EMERG "\n", | ||
306 | (int) current->mm->start_stack, | 305 | (int) current->mm->start_stack, |
307 | (int)(((unsigned long) current) + THREAD_SIZE)); | 306 | (int)(((unsigned long) current) + THREAD_SIZE)); |
308 | } | 307 | } |
@@ -313,35 +312,35 @@ void dump(struct pt_regs *fp) | |||
313 | fp->d0, fp->d1, fp->d2, fp->d3); | 312 | fp->d0, fp->d1, fp->d2, fp->d3); |
314 | printk(KERN_EMERG "d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n", | 313 | printk(KERN_EMERG "d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n", |
315 | fp->d4, fp->d5, fp->a0, fp->a1); | 314 | fp->d4, fp->d5, fp->a0, fp->a1); |
316 | printk(KERN_EMERG "\n" KERN_EMERG "USP: %08x TRAPFRAME: %08x\n", | 315 | printk(KERN_EMERG "\nUSP: %08x TRAPFRAME: %08x\n", |
317 | (unsigned int) rdusp(), (unsigned int) fp); | 316 | (unsigned int) rdusp(), (unsigned int) fp); |
318 | 317 | ||
319 | printk(KERN_EMERG "\n" KERN_EMERG "CODE:"); | 318 | printk(KERN_EMERG "\nCODE:"); |
320 | tp = ((unsigned char *) fp->pc) - 0x20; | 319 | tp = ((unsigned char *) fp->pc) - 0x20; |
321 | for (sp = (unsigned long *) tp, i = 0; (i < 0x40); i += 4) { | 320 | for (sp = (unsigned long *) tp, i = 0; (i < 0x40); i += 4) { |
322 | if ((i % 0x10) == 0) | 321 | if ((i % 0x10) == 0) |
323 | printk("\n" KERN_EMERG "%08x: ", (int) (tp + i)); | 322 | printk(KERN_EMERG "%08x: ", (int) (tp + i)); |
324 | printk("%08x ", (int) *sp++); | 323 | printk("%08x ", (int) *sp++); |
325 | } | 324 | } |
326 | printk("\n" KERN_EMERG "\n"); | 325 | printk(KERN_EMERG "\n"); |
327 | 326 | ||
328 | printk(KERN_EMERG "KERNEL STACK:"); | 327 | printk(KERN_EMERG "KERNEL STACK:"); |
329 | tp = ((unsigned char *) fp) - 0x40; | 328 | tp = ((unsigned char *) fp) - 0x40; |
330 | for (sp = (unsigned long *) tp, i = 0; (i < 0xc0); i += 4) { | 329 | for (sp = (unsigned long *) tp, i = 0; (i < 0xc0); i += 4) { |
331 | if ((i % 0x10) == 0) | 330 | if ((i % 0x10) == 0) |
332 | printk("\n" KERN_EMERG "%08x: ", (int) (tp + i)); | 331 | printk(KERN_EMERG "%08x: ", (int) (tp + i)); |
333 | printk("%08x ", (int) *sp++); | 332 | printk("%08x ", (int) *sp++); |
334 | } | 333 | } |
335 | printk("\n" KERN_EMERG "\n"); | 334 | printk(KERN_EMERG "\n"); |
336 | 335 | ||
337 | printk(KERN_EMERG "USER STACK:"); | 336 | printk(KERN_EMERG "USER STACK:"); |
338 | tp = (unsigned char *) (rdusp() - 0x10); | 337 | tp = (unsigned char *) (rdusp() - 0x10); |
339 | for (sp = (unsigned long *) tp, i = 0; (i < 0x80); i += 4) { | 338 | for (sp = (unsigned long *) tp, i = 0; (i < 0x80); i += 4) { |
340 | if ((i % 0x10) == 0) | 339 | if ((i % 0x10) == 0) |
341 | printk("\n" KERN_EMERG "%08x: ", (int) (tp + i)); | 340 | printk(KERN_EMERG "%08x: ", (int) (tp + i)); |
342 | printk("%08x ", (int) *sp++); | 341 | printk("%08x ", (int) *sp++); |
343 | } | 342 | } |
344 | printk("\n" KERN_EMERG "\n"); | 343 | printk(KERN_EMERG "\n"); |
345 | } | 344 | } |
346 | 345 | ||
347 | /* | 346 | /* |
diff --git a/arch/m68knommu/kernel/traps.c b/arch/m68knommu/kernel/traps.c index 51d325343ab5..3739c8f657d7 100644 --- a/arch/m68knommu/kernel/traps.c +++ b/arch/m68knommu/kernel/traps.c | |||
@@ -111,7 +111,7 @@ static void print_this_address(unsigned long addr, int i) | |||
111 | if (i % 5) | 111 | if (i % 5) |
112 | printk(KERN_CONT " [%08lx] ", addr); | 112 | printk(KERN_CONT " [%08lx] ", addr); |
113 | else | 113 | else |
114 | printk(KERN_CONT "\n" KERN_EMERG " [%08lx] ", addr); | 114 | printk(KERN_EMERG " [%08lx] ", addr); |
115 | i++; | 115 | i++; |
116 | #endif | 116 | #endif |
117 | } | 117 | } |
@@ -137,8 +137,8 @@ static void __show_stack(struct task_struct *task, unsigned long *stack) | |||
137 | if (stack + 1 + i > endstack) | 137 | if (stack + 1 + i > endstack) |
138 | break; | 138 | break; |
139 | if (i % 8 == 0) | 139 | if (i % 8 == 0) |
140 | printk("\n" KERN_EMERG " "); | 140 | printk(KERN_EMERG " "); |
141 | printk(" %08lx", *(stack + i)); | 141 | printk(KERN_CONT " %08lx", *(stack + i)); |
142 | } | 142 | } |
143 | printk("\n"); | 143 | printk("\n"); |
144 | i = 0; | 144 | i = 0; |
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig index b50b845fdd50..2db722d80d4d 100644 --- a/arch/microblaze/Kconfig +++ b/arch/microblaze/Kconfig | |||
@@ -53,6 +53,9 @@ config GENERIC_HARDIRQS_NO__DO_IRQ | |||
53 | config GENERIC_GPIO | 53 | config GENERIC_GPIO |
54 | def_bool y | 54 | def_bool y |
55 | 55 | ||
56 | config GENERIC_CSUM | ||
57 | def_bool y | ||
58 | |||
56 | config PCI | 59 | config PCI |
57 | def_bool n | 60 | def_bool n |
58 | 61 | ||
diff --git a/arch/microblaze/include/asm/atomic.h b/arch/microblaze/include/asm/atomic.h index 0de612ad7cb2..6d2e1d418be7 100644 --- a/arch/microblaze/include/asm/atomic.h +++ b/arch/microblaze/include/asm/atomic.h | |||
@@ -1,95 +1,7 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2006 Atmark Techno, Inc. | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_MICROBLAZE_ATOMIC_H | 1 | #ifndef _ASM_MICROBLAZE_ATOMIC_H |
10 | #define _ASM_MICROBLAZE_ATOMIC_H | 2 | #define _ASM_MICROBLAZE_ATOMIC_H |
11 | 3 | ||
12 | #include <linux/types.h> | 4 | #include <asm-generic/atomic.h> |
13 | #include <linux/compiler.h> /* likely */ | ||
14 | #include <asm/system.h> /* local_irq_XXX and friends */ | ||
15 | |||
16 | #define ATOMIC_INIT(i) { (i) } | ||
17 | #define atomic_read(v) ((v)->counter) | ||
18 | #define atomic_set(v, i) (((v)->counter) = (i)) | ||
19 | |||
20 | #define atomic_inc(v) (atomic_add_return(1, (v))) | ||
21 | #define atomic_dec(v) (atomic_sub_return(1, (v))) | ||
22 | |||
23 | #define atomic_add(i, v) (atomic_add_return(i, (v))) | ||
24 | #define atomic_sub(i, v) (atomic_sub_return(i, (v))) | ||
25 | |||
26 | #define atomic_inc_return(v) (atomic_add_return(1, (v))) | ||
27 | #define atomic_dec_return(v) (atomic_sub_return(1, (v))) | ||
28 | |||
29 | #define atomic_inc_and_test(v) (atomic_add_return(1, (v)) == 0) | ||
30 | #define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0) | ||
31 | |||
32 | #define atomic_inc_not_zero(v) (atomic_add_unless((v), 1, 0)) | ||
33 | |||
34 | #define atomic_sub_and_test(i, v) (atomic_sub_return((i), (v)) == 0) | ||
35 | |||
36 | static inline int atomic_cmpxchg(atomic_t *v, int old, int new) | ||
37 | { | ||
38 | int ret; | ||
39 | unsigned long flags; | ||
40 | |||
41 | local_irq_save(flags); | ||
42 | ret = v->counter; | ||
43 | if (likely(ret == old)) | ||
44 | v->counter = new; | ||
45 | local_irq_restore(flags); | ||
46 | |||
47 | return ret; | ||
48 | } | ||
49 | |||
50 | static inline int atomic_add_unless(atomic_t *v, int a, int u) | ||
51 | { | ||
52 | int c, old; | ||
53 | |||
54 | c = atomic_read(v); | ||
55 | while (c != u && (old = atomic_cmpxchg((v), c, c + a)) != c) | ||
56 | c = old; | ||
57 | return c != u; | ||
58 | } | ||
59 | |||
60 | static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr) | ||
61 | { | ||
62 | unsigned long flags; | ||
63 | |||
64 | local_irq_save(flags); | ||
65 | *addr &= ~mask; | ||
66 | local_irq_restore(flags); | ||
67 | } | ||
68 | |||
69 | /** | ||
70 | * atomic_add_return - add and return | ||
71 | * @i: integer value to add | ||
72 | * @v: pointer of type atomic_t | ||
73 | * | ||
74 | * Atomically adds @i to @v and returns @i + @v | ||
75 | */ | ||
76 | static inline int atomic_add_return(int i, atomic_t *v) | ||
77 | { | ||
78 | unsigned long flags; | ||
79 | int val; | ||
80 | |||
81 | local_irq_save(flags); | ||
82 | val = v->counter; | ||
83 | v->counter = val += i; | ||
84 | local_irq_restore(flags); | ||
85 | |||
86 | return val; | ||
87 | } | ||
88 | |||
89 | static inline int atomic_sub_return(int i, atomic_t *v) | ||
90 | { | ||
91 | return atomic_add_return(-i, v); | ||
92 | } | ||
93 | 5 | ||
94 | /* | 6 | /* |
95 | * Atomically test *v and decrement if it is greater than 0. | 7 | * Atomically test *v and decrement if it is greater than 0. |
@@ -109,15 +21,4 @@ static inline int atomic_dec_if_positive(atomic_t *v) | |||
109 | return res; | 21 | return res; |
110 | } | 22 | } |
111 | 23 | ||
112 | #define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0) | ||
113 | #define atomic_xchg(v, new) (xchg(&((v)->counter), new)) | ||
114 | |||
115 | /* Atomic operations are already serializing */ | ||
116 | #define smp_mb__before_atomic_dec() barrier() | ||
117 | #define smp_mb__after_atomic_dec() barrier() | ||
118 | #define smp_mb__before_atomic_inc() barrier() | ||
119 | #define smp_mb__after_atomic_inc() barrier() | ||
120 | |||
121 | #include <asm-generic/atomic-long.h> | ||
122 | |||
123 | #endif /* _ASM_MICROBLAZE_ATOMIC_H */ | 24 | #endif /* _ASM_MICROBLAZE_ATOMIC_H */ |
diff --git a/arch/microblaze/include/asm/bitops.h b/arch/microblaze/include/asm/bitops.h index d6df1fd4e1e8..a72468f15c8b 100644 --- a/arch/microblaze/include/asm/bitops.h +++ b/arch/microblaze/include/asm/bitops.h | |||
@@ -1,27 +1 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2006 Atmark Techno, Inc. | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_MICROBLAZE_BITOPS_H | ||
10 | #define _ASM_MICROBLAZE_BITOPS_H | ||
11 | |||
12 | /* | ||
13 | * Copyright 1992, Linus Torvalds. | ||
14 | */ | ||
15 | |||
16 | #include <asm/byteorder.h> /* swab32 */ | ||
17 | #include <asm/system.h> /* save_flags */ | ||
18 | |||
19 | /* | ||
20 | * clear_bit() doesn't provide any barrier for the compiler. | ||
21 | */ | ||
22 | #define smp_mb__before_clear_bit() barrier() | ||
23 | #define smp_mb__after_clear_bit() barrier() | ||
24 | #include <asm-generic/bitops.h> | #include <asm-generic/bitops.h> | |
25 | #include <asm-generic/bitops/__fls.h> | ||
26 | |||
27 | #endif /* _ASM_MICROBLAZE_BITOPS_H */ | ||
diff --git a/arch/microblaze/include/asm/bug.h b/arch/microblaze/include/asm/bug.h index 8eb2cdde11d7..b12fd89e42e9 100644 --- a/arch/microblaze/include/asm/bug.h +++ b/arch/microblaze/include/asm/bug.h | |||
@@ -1,15 +1 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2006 Atmark Techno, Inc. | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_MICROBLAZE_BUG_H | ||
10 | #define _ASM_MICROBLAZE_BUG_H | ||
11 | |||
12 | #include <linux/kernel.h> | ||
13 | #include <asm-generic/bug.h> | #include <asm-generic/bug.h> | |
14 | |||
15 | #endif /* _ASM_MICROBLAZE_BUG_H */ | ||
diff --git a/arch/microblaze/include/asm/bugs.h b/arch/microblaze/include/asm/bugs.h index f2c6593653fb..61791e1ad9f5 100644 --- a/arch/microblaze/include/asm/bugs.h +++ b/arch/microblaze/include/asm/bugs.h | |||
@@ -1,17 +1 @@ | |||
1 | /* | #include <asm-generic/bugs.h> | |
2 | * Copyright (C) 2006 Atmark Techno, Inc. | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_MICROBLAZE_BUGS_H | ||
10 | #define _ASM_MICROBLAZE_BUGS_H | ||
11 | |||
12 | static inline void check_bugs(void) | ||
13 | { | ||
14 | /* nothing to do */ | ||
15 | } | ||
16 | |||
17 | #endif /* _ASM_MICROBLAZE_BUGS_H */ | ||
diff --git a/arch/microblaze/include/asm/checksum.h b/arch/microblaze/include/asm/checksum.h index 97ea46b5cf80..128bf03b54b7 100644 --- a/arch/microblaze/include/asm/checksum.h +++ b/arch/microblaze/include/asm/checksum.h | |||
@@ -10,12 +10,11 @@ | |||
10 | #ifndef _ASM_MICROBLAZE_CHECKSUM_H | 10 | #ifndef _ASM_MICROBLAZE_CHECKSUM_H |
11 | #define _ASM_MICROBLAZE_CHECKSUM_H | 11 | #define _ASM_MICROBLAZE_CHECKSUM_H |
12 | 12 | ||
13 | #include <linux/in6.h> | ||
14 | |||
15 | /* | 13 | /* |
16 | * computes the checksum of the TCP/UDP pseudo-header | 14 | * computes the checksum of the TCP/UDP pseudo-header |
17 | * returns a 16-bit checksum, already complemented | 15 | * returns a 16-bit checksum, already complemented |
18 | */ | 16 | */ |
17 | #define csum_tcpudp_nofold csum_tcpudp_nofold | ||
19 | static inline __wsum | 18 | static inline __wsum |
20 | csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, | 19 | csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, |
21 | unsigned short proto, __wsum sum) | 20 | unsigned short proto, __wsum sum) |
@@ -30,71 +29,6 @@ csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len, | |||
30 | return sum; | 29 | return sum; |
31 | } | 30 | } |
32 | 31 | ||
33 | /* | 32 | #include <asm-generic/checksum.h> |
34 | * computes the checksum of a memory block at buff, length len, | ||
35 | * and adds in "sum" (32-bit) | ||
36 | * | ||
37 | * returns a 32-bit number suitable for feeding into itself | ||
38 | * or csum_tcpudp_magic | ||
39 | * | ||
40 | * this function must be called with even lengths, except | ||
41 | * for the last fragment, which may be odd | ||
42 | * | ||
43 | * it's best to have buff aligned on a 32-bit boundary | ||
44 | */ | ||
45 | extern __wsum csum_partial(const void *buff, int len, __wsum sum); | ||
46 | |||
47 | /* | ||
48 | * the same as csum_partial, but copies from src while it | ||
49 | * checksums | ||
50 | * | ||
51 | * here even more important to align src and dst on a 32-bit (or even | ||
52 | * better 64-bit) boundary | ||
53 | */ | ||
54 | extern __wsum csum_partial_copy(const void *src, void *dst, int len, | ||
55 | __wsum sum); | ||
56 | |||
57 | /* | ||
58 | * the same as csum_partial_copy, but copies from user space. | ||
59 | * | ||
60 | * here even more important to align src and dst on a 32-bit (or even | ||
61 | * better 64-bit) boundary | ||
62 | */ | ||
63 | extern __wsum csum_partial_copy_from_user(const void __user *src, void *dst, | ||
64 | int len, __wsum sum, int *csum_err); | ||
65 | |||
66 | #define csum_partial_copy_nocheck(src, dst, len, sum) \ | ||
67 | csum_partial_copy((src), (dst), (len), (sum)) | ||
68 | |||
69 | /* | ||
70 | * This is a version of ip_compute_csum() optimized for IP headers, | ||
71 | * which always checksum on 4 octet boundaries. | ||
72 | * | ||
73 | */ | ||
74 | extern __sum16 ip_fast_csum(const void *iph, unsigned int ihl); | ||
75 | |||
76 | /* | ||
77 | * Fold a partial checksum | ||
78 | */ | ||
79 | static inline __sum16 csum_fold(__wsum csum) | ||
80 | { | ||
81 | u32 sum = (__force u32)csum; | ||
82 | sum = (sum & 0xffff) + (sum >> 16); | ||
83 | sum = (sum & 0xffff) + (sum >> 16); | ||
84 | return (__force __sum16)~sum; | ||
85 | } | ||
86 | |||
87 | static inline __sum16 | ||
88 | csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len, | ||
89 | unsigned short proto, __wsum sum) | ||
90 | { | ||
91 | return csum_fold(csum_tcpudp_nofold(saddr, daddr, len, proto, sum)); | ||
92 | } | ||
93 | |||
94 | /* | ||
95 | * this routine is used for miscellaneous IP-like checksums, mainly | ||
96 | * in icmp.c | ||
97 | */ | ||
98 | extern __sum16 ip_compute_csum(const void *buff, int len); | ||
99 | 33 | ||
100 | #endif /* _ASM_MICROBLAZE_CHECKSUM_H */ | 34 | #endif /* _ASM_MICROBLAZE_CHECKSUM_H */ |
diff --git a/arch/microblaze/include/asm/fb.h b/arch/microblaze/include/asm/fb.h new file mode 100644 index 000000000000..3a4988e8df45 --- /dev/null +++ b/arch/microblaze/include/asm/fb.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/fb.h> | |||
diff --git a/arch/microblaze/include/asm/hardirq.h b/arch/microblaze/include/asm/hardirq.h index 0f2d6b013e11..41e1e1aa36ac 100644 --- a/arch/microblaze/include/asm/hardirq.h +++ b/arch/microblaze/include/asm/hardirq.h | |||
@@ -9,21 +9,11 @@ | |||
9 | #ifndef _ASM_MICROBLAZE_HARDIRQ_H | 9 | #ifndef _ASM_MICROBLAZE_HARDIRQ_H |
10 | #define _ASM_MICROBLAZE_HARDIRQ_H | 10 | #define _ASM_MICROBLAZE_HARDIRQ_H |
11 | 11 | ||
12 | #include <linux/cache.h> | ||
13 | #include <linux/irq.h> | ||
14 | #include <asm/irq.h> | ||
15 | #include <asm/current.h> | ||
16 | #include <linux/ptrace.h> | ||
17 | |||
18 | /* should be defined in each interrupt controller driver */ | 12 | /* should be defined in each interrupt controller driver */ |
19 | extern unsigned int get_irq(struct pt_regs *regs); | 13 | extern unsigned int get_irq(struct pt_regs *regs); |
20 | 14 | ||
21 | typedef struct { | 15 | #define ack_bad_irq ack_bad_irq |
22 | unsigned int __softirq_pending; | ||
23 | } ____cacheline_aligned irq_cpustat_t; | ||
24 | |||
25 | void ack_bad_irq(unsigned int irq); | 16 | void ack_bad_irq(unsigned int irq); |
26 | 17 | #include <asm-generic/hardirq.h> | |
27 | #include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */ | ||
28 | 18 | ||
29 | #endif /* _ASM_MICROBLAZE_HARDIRQ_H */ | 19 | #endif /* _ASM_MICROBLAZE_HARDIRQ_H */ |
diff --git a/arch/microblaze/include/asm/ioctls.h b/arch/microblaze/include/asm/ioctls.h index 03582b249204..ec34c760665e 100644 --- a/arch/microblaze/include/asm/ioctls.h +++ b/arch/microblaze/include/asm/ioctls.h | |||
@@ -1,91 +1 @@ | |||
1 | /* | #include <asm-generic/ioctls.h> | |
2 | * Copyright (C) 2006 Atmark Techno, Inc. | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_MICROBLAZE_IOCTLS_H | ||
10 | #define _ASM_MICROBLAZE_IOCTLS_H | ||
11 | |||
12 | #include <linux/ioctl.h> | ||
13 | |||
14 | /* 0x54 is just a magic number to make these relatively unique ('T') */ | ||
15 | |||
16 | #define TCGETS 0x5401 | ||
17 | #define TCSETS 0x5402 | ||
18 | #define TCSETSW 0x5403 | ||
19 | #define TCSETSF 0x5404 | ||
20 | #define TCGETA 0x5405 | ||
21 | #define TCSETA 0x5406 | ||
22 | #define TCSETAW 0x5407 | ||
23 | #define TCSETAF 0x5408 | ||
24 | #define TCSBRK 0x5409 | ||
25 | #define TCXONC 0x540A | ||
26 | #define TCFLSH 0x540B | ||
27 | #define TIOCEXCL 0x540C | ||
28 | #define TIOCNXCL 0x540D | ||
29 | #define TIOCSCTTY 0x540E | ||
30 | #define TIOCGPGRP 0x540F | ||
31 | #define TIOCSPGRP 0x5410 | ||
32 | #define TIOCOUTQ 0x5411 | ||
33 | #define TIOCSTI 0x5412 | ||
34 | #define TIOCGWINSZ 0x5413 | ||
35 | #define TIOCSWINSZ 0x5414 | ||
36 | #define TIOCMGET 0x5415 | ||
37 | #define TIOCMBIS 0x5416 | ||
38 | #define TIOCMBIC 0x5417 | ||
39 | #define TIOCMSET 0x5418 | ||
40 | #define TIOCGSOFTCAR 0x5419 | ||
41 | #define TIOCSSOFTCAR 0x541A | ||
42 | #define FIONREAD 0x541B | ||
43 | #define TIOCINQ FIONREAD | ||
44 | #define TIOCLINUX 0x541C | ||
45 | #define TIOCCONS 0x541D | ||
46 | #define TIOCGSERIAL 0x541E | ||
47 | #define TIOCSSERIAL 0x541F | ||
48 | #define TIOCPKT 0x5420 | ||
49 | #define FIONBIO 0x5421 | ||
50 | #define TIOCNOTTY 0x5422 | ||
51 | #define TIOCSETD 0x5423 | ||
52 | #define TIOCGETD 0x5424 | ||
53 | #define TCSBRKP 0x5425 /* Needed for POSIX tcsendbreak() */ | ||
54 | #define TIOCTTYGSTRUCT 0x5426 /* For debugging only */ | ||
55 | #define TIOCSBRK 0x5427 /* BSD compatibility */ | ||
56 | #define TIOCCBRK 0x5428 /* BSD compatibility */ | ||
57 | #define TIOCGSID 0x5429 /* Return the session ID of FD */ | ||
58 | /* Get Pty Number (of pty-mux device) */ | ||
59 | #define TIOCGPTN _IOR('T', 0x30, unsigned int) | ||
60 | #define TIOCSPTLCK _IOW('T', 0x31, int) /* Lock/unlock Pty */ | ||
61 | |||
62 | #define FIONCLEX 0x5450 /* these numbers need to be adjusted. */ | ||
63 | #define FIOCLEX 0x5451 | ||
64 | #define FIOASYNC 0x5452 | ||
65 | #define TIOCSERCONFIG 0x5453 | ||
66 | #define TIOCSERGWILD 0x5454 | ||
67 | #define TIOCSERSWILD 0x5455 | ||
68 | #define TIOCGLCKTRMIOS 0x5456 | ||
69 | #define TIOCSLCKTRMIOS 0x5457 | ||
70 | #define TIOCSERGSTRUCT 0x5458 /* For debugging only */ | ||
71 | #define TIOCSERGETLSR 0x5459 /* Get line status register */ | ||
72 | #define TIOCSERGETMULTI 0x545A /* Get multiport config */ | ||
73 | #define TIOCSERSETMULTI 0x545B /* Set multiport config */ | ||
74 | |||
75 | #define TIOCMIWAIT 0x545C /* wait for a change on serial input line(s) */ | ||
76 | #define TIOCGICOUNT 0x545D /* read serial port inline interrupt counts */ | ||
77 | |||
78 | #define FIOQSIZE 0x545E | ||
79 | |||
80 | /* Used for packet mode */ | ||
81 | #define TIOCPKT_DATA 0 | ||
82 | #define TIOCPKT_FLUSHREAD 1 | ||
83 | #define TIOCPKT_FLUSHWRITE 2 | ||
84 | #define TIOCPKT_STOP 4 | ||
85 | #define TIOCPKT_START 8 | ||
86 | #define TIOCPKT_NOSTOP 16 | ||
87 | #define TIOCPKT_DOSTOP 32 | ||
88 | |||
89 | #define TIOCSER_TEMT 0x01 /* Transmitter physically empty */ | ||
90 | |||
91 | #endif /* _ASM_MICROBLAZE_IOCTLS_H */ | ||
diff --git a/arch/microblaze/include/asm/ipcbuf.h b/arch/microblaze/include/asm/ipcbuf.h index b056fa420654..84c7e51cb6d0 100644 --- a/arch/microblaze/include/asm/ipcbuf.h +++ b/arch/microblaze/include/asm/ipcbuf.h | |||
@@ -1,36 +1 @@ | |||
1 | /* | #include <asm-generic/ipcbuf.h> | |
2 | * Copyright (C) 2006 Atmark Techno, Inc. | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_MICROBLAZE_IPCBUF_H | ||
10 | #define _ASM_MICROBLAZE_IPCBUF_H | ||
11 | |||
12 | /* | ||
13 | * The user_ipc_perm structure for microblaze architecture. | ||
14 | * Note extra padding because this structure is passed back and forth | ||
15 | * between kernel and user space. | ||
16 | * | ||
17 | * Pad space is left for: | ||
18 | * - 32-bit mode_t and seq | ||
19 | * - 2 miscellaneous 32-bit values | ||
20 | */ | ||
21 | |||
22 | struct ipc64_perm { | ||
23 | __kernel_key_t key; | ||
24 | __kernel_uid32_t uid; | ||
25 | __kernel_gid32_t gid; | ||
26 | __kernel_uid32_t cuid; | ||
27 | __kernel_gid32_t cgid; | ||
28 | __kernel_mode_t mode; | ||
29 | unsigned short __pad1; | ||
30 | unsigned short seq; | ||
31 | unsigned short __pad2; | ||
32 | unsigned long __unused1; | ||
33 | unsigned long __unused2; | ||
34 | }; | ||
35 | |||
36 | #endif /* _ASM_MICROBLAZE_IPCBUF_H */ | ||
diff --git a/arch/microblaze/include/asm/irq.h b/arch/microblaze/include/asm/irq.h index db515deaa720..90f050535ebe 100644 --- a/arch/microblaze/include/asm/irq.h +++ b/arch/microblaze/include/asm/irq.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #define _ASM_MICROBLAZE_IRQ_H | 10 | #define _ASM_MICROBLAZE_IRQ_H |
11 | 11 | ||
12 | #define NR_IRQS 32 | 12 | #define NR_IRQS 32 |
13 | #include <asm-generic/irq.h> | ||
13 | 14 | ||
14 | #include <linux/interrupt.h> | 15 | #include <linux/interrupt.h> |
15 | 16 | ||
@@ -17,11 +18,6 @@ extern unsigned int nr_irq; | |||
17 | 18 | ||
18 | #define NO_IRQ (-1) | 19 | #define NO_IRQ (-1) |
19 | 20 | ||
20 | static inline int irq_canonicalize(int irq) | ||
21 | { | ||
22 | return irq; | ||
23 | } | ||
24 | |||
25 | struct pt_regs; | 21 | struct pt_regs; |
26 | extern void do_IRQ(struct pt_regs *regs); | 22 | extern void do_IRQ(struct pt_regs *regs); |
27 | 23 | ||
diff --git a/arch/microblaze/include/asm/mman.h b/arch/microblaze/include/asm/mman.h index 4914b1329445..8eebf89f5ab1 100644 --- a/arch/microblaze/include/asm/mman.h +++ b/arch/microblaze/include/asm/mman.h | |||
@@ -1,25 +1 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2006 Atmark Techno, Inc. | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_MICROBLAZE_MMAN_H | ||
10 | #define _ASM_MICROBLAZE_MMAN_H | ||
11 | |||
12 | #include <asm-generic/mman.h> | #include <asm-generic/mman.h> | |
13 | |||
14 | #define MAP_GROWSDOWN 0x0100 /* stack-like segment */ | ||
15 | #define MAP_DENYWRITE 0x0800 /* ETXTBSY */ | ||
16 | #define MAP_EXECUTABLE 0x1000 /* mark it as an executable */ | ||
17 | #define MAP_LOCKED 0x2000 /* pages are locked */ | ||
18 | #define MAP_NORESERVE 0x4000 /* don't check for reservations */ | ||
19 | #define MAP_POPULATE 0x8000 /* populate (prefault) pagetables */ | ||
20 | #define MAP_NONBLOCK 0x10000 /* do not block on IO */ | ||
21 | |||
22 | #define MCL_CURRENT 1 /* lock all current mappings */ | ||
23 | #define MCL_FUTURE 2 /* lock all future mappings */ | ||
24 | |||
25 | #endif /* _ASM_MICROBLAZE_MMAN_H */ | ||
diff --git a/arch/microblaze/include/asm/mmu.h b/arch/microblaze/include/asm/mmu.h index 66cad6a99d77..8d6a654ceffb 100644 --- a/arch/microblaze/include/asm/mmu.h +++ b/arch/microblaze/include/asm/mmu.h | |||
@@ -12,12 +12,7 @@ | |||
12 | #define _ASM_MICROBLAZE_MMU_H | 12 | #define _ASM_MICROBLAZE_MMU_H |
13 | 13 | ||
14 | # ifndef CONFIG_MMU | 14 | # ifndef CONFIG_MMU |
15 | # ifndef __ASSEMBLY__ | 15 | # include <asm-generic/mmu.h> |
16 | typedef struct { | ||
17 | struct vm_list_struct *vmlist; | ||
18 | unsigned long end_brk; | ||
19 | } mm_context_t; | ||
20 | # endif /* __ASSEMBLY__ */ | ||
21 | # else /* CONFIG_MMU */ | 16 | # else /* CONFIG_MMU */ |
22 | # ifdef __KERNEL__ | 17 | # ifdef __KERNEL__ |
23 | # ifndef __ASSEMBLY__ | 18 | # ifndef __ASSEMBLY__ |
diff --git a/arch/microblaze/include/asm/mmu_context.h b/arch/microblaze/include/asm/mmu_context.h index 385fed16bbfb..24eab1674d3e 100644 --- a/arch/microblaze/include/asm/mmu_context.h +++ b/arch/microblaze/include/asm/mmu_context.h | |||
@@ -1,5 +1,5 @@ | |||
1 | #ifdef CONFIG_MMU | 1 | #ifdef CONFIG_MMU |
2 | # include "mmu_context_mm.h" | 2 | # include "mmu_context_mm.h" |
3 | #else | 3 | #else |
4 | # include "mmu_context_no.h" | 4 | # include <asm-generic/mmu_context.h> |
5 | #endif | 5 | #endif |
diff --git a/arch/microblaze/include/asm/mmu_context_no.h b/arch/microblaze/include/asm/mmu_context_no.h deleted file mode 100644 index ba5567190154..000000000000 --- a/arch/microblaze/include/asm/mmu_context_no.h +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2008-2009 Michal Simek <monstr@monstr.eu> | ||
3 | * Copyright (C) 2008-2009 PetaLogix | ||
4 | * Copyright (C) 2006 Atmark Techno, Inc. | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | |||
11 | #ifndef _ASM_MICROBLAZE_MMU_CONTEXT_H | ||
12 | #define _ASM_MICROBLAZE_MMU_CONTEXT_H | ||
13 | |||
14 | # define init_new_context(tsk, mm) ({ 0; }) | ||
15 | |||
16 | # define enter_lazy_tlb(mm, tsk) do {} while (0) | ||
17 | # define change_mm_context(old, ctx, _pml4) do {} while (0) | ||
18 | # define destroy_context(mm) do {} while (0) | ||
19 | # define deactivate_mm(tsk, mm) do {} while (0) | ||
20 | # define switch_mm(prev, next, tsk) do {} while (0) | ||
21 | # define activate_mm(prev, next) do {} while (0) | ||
22 | |||
23 | #endif /* _ASM_MICROBLAZE_MMU_CONTEXT_H */ | ||
diff --git a/arch/microblaze/include/asm/module.h b/arch/microblaze/include/asm/module.h index 914565a90315..7be1347fce42 100644 --- a/arch/microblaze/include/asm/module.h +++ b/arch/microblaze/include/asm/module.h | |||
@@ -9,6 +9,8 @@ | |||
9 | #ifndef _ASM_MICROBLAZE_MODULE_H | 9 | #ifndef _ASM_MICROBLAZE_MODULE_H |
10 | #define _ASM_MICROBLAZE_MODULE_H | 10 | #define _ASM_MICROBLAZE_MODULE_H |
11 | 11 | ||
12 | #include <asm-generic/module.h> | ||
13 | |||
12 | /* Microblaze Relocations */ | 14 | /* Microblaze Relocations */ |
13 | #define R_MICROBLAZE_NONE 0 | 15 | #define R_MICROBLAZE_NONE 0 |
14 | #define R_MICROBLAZE_32 1 | 16 | #define R_MICROBLAZE_32 1 |
@@ -24,14 +26,6 @@ | |||
24 | /* Keep this the last entry. */ | 26 | /* Keep this the last entry. */ |
25 | #define R_MICROBLAZE_NUM 11 | 27 | #define R_MICROBLAZE_NUM 11 |
26 | 28 | ||
27 | struct mod_arch_specific { | ||
28 | int foo; | ||
29 | }; | ||
30 | |||
31 | #define Elf_Shdr Elf32_Shdr | ||
32 | #define Elf_Sym Elf32_Sym | ||
33 | #define Elf_Ehdr Elf32_Ehdr | ||
34 | |||
35 | typedef struct { volatile int counter; } module_t; | 29 | typedef struct { volatile int counter; } module_t; |
36 | 30 | ||
37 | #endif /* _ASM_MICROBLAZE_MODULE_H */ | 31 | #endif /* _ASM_MICROBLAZE_MODULE_H */ |
diff --git a/arch/microblaze/include/asm/msgbuf.h b/arch/microblaze/include/asm/msgbuf.h index 09dd97097211..809134c644a6 100644 --- a/arch/microblaze/include/asm/msgbuf.h +++ b/arch/microblaze/include/asm/msgbuf.h | |||
@@ -1,31 +1 @@ | |||
1 | #ifndef _ASM_MICROBLAZE_MSGBUF_H | #include <asm-generic/msgbuf.h> | |
2 | #define _ASM_MICROBLAZE_MSGBUF_H | ||
3 | |||
4 | /* | ||
5 | * The msqid64_ds structure for microblaze architecture. | ||
6 | * Note extra padding because this structure is passed back and forth | ||
7 | * between kernel and user space. | ||
8 | * | ||
9 | * Pad space is left for: | ||
10 | * - 64-bit time_t to solve y2038 problem | ||
11 | * - 2 miscellaneous 32-bit values | ||
12 | */ | ||
13 | |||
14 | struct msqid64_ds { | ||
15 | struct ipc64_perm msg_perm; | ||
16 | __kernel_time_t msg_stime; /* last msgsnd time */ | ||
17 | unsigned long __unused1; | ||
18 | __kernel_time_t msg_rtime; /* last msgrcv time */ | ||
19 | unsigned long __unused2; | ||
20 | __kernel_time_t msg_ctime; /* last change time */ | ||
21 | unsigned long __unused3; | ||
22 | unsigned long msg_cbytes; /* current number of bytes on queue */ | ||
23 | unsigned long msg_qnum; /* number of messages in queue */ | ||
24 | unsigned long msg_qbytes; /* max number of bytes on queue */ | ||
25 | __kernel_pid_t msg_lspid; /* pid of last msgsnd */ | ||
26 | __kernel_pid_t msg_lrpid; /* last receive pid */ | ||
27 | unsigned long __unused4; | ||
28 | unsigned long __unused5; | ||
29 | }; | ||
30 | |||
31 | #endif /* _ASM_MICROBLAZE_MSGBUF_H */ | ||
diff --git a/arch/microblaze/include/asm/param.h b/arch/microblaze/include/asm/param.h index 8c538a49616d..965d45427975 100644 --- a/arch/microblaze/include/asm/param.h +++ b/arch/microblaze/include/asm/param.h | |||
@@ -1,30 +1 @@ | |||
1 | /* | #include <asm-generic/param.h> | |
2 | * Copyright (C) 2006 Atmark Techno, Inc. | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_MICROBLAZE_PARAM_H | ||
10 | #define _ASM_MICROBLAZE_PARAM_H | ||
11 | |||
12 | #ifdef __KERNEL__ | ||
13 | #define HZ CONFIG_HZ /* internal kernel timer frequency */ | ||
14 | #define USER_HZ 100 /* for user interfaces in "ticks" */ | ||
15 | #define CLOCKS_PER_SEC (USER_HZ) /* frequency at which times() counts */ | ||
16 | #endif /* __KERNEL__ */ | ||
17 | |||
18 | #ifndef HZ | ||
19 | #define HZ 100 | ||
20 | #endif | ||
21 | |||
22 | #define EXEC_PAGESIZE 4096 | ||
23 | |||
24 | #ifndef NOGROUP | ||
25 | #define NOGROUP (-1) | ||
26 | #endif | ||
27 | |||
28 | #define MAXHOSTNAMELEN 64 /* max length of hostname */ | ||
29 | |||
30 | #endif /* _ASM_MICROBLAZE_PARAM_H */ | ||
diff --git a/arch/microblaze/include/asm/parport.h b/arch/microblaze/include/asm/parport.h new file mode 100644 index 000000000000..cf252af64590 --- /dev/null +++ b/arch/microblaze/include/asm/parport.h | |||
@@ -0,0 +1 @@ | |||
#include <asm-generic/parport.h> | |||
diff --git a/arch/microblaze/include/asm/pci.h b/arch/microblaze/include/asm/pci.h index ca03794cf3f0..9f0df5faf2c8 100644 --- a/arch/microblaze/include/asm/pci.h +++ b/arch/microblaze/include/asm/pci.h | |||
@@ -1 +1 @@ | |||
#include <linux/io.h> | #include <asm-generic/pci.h> | ||
diff --git a/arch/microblaze/include/asm/posix_types.h b/arch/microblaze/include/asm/posix_types.h index 8c758b231f37..0e15039673e3 100644 --- a/arch/microblaze/include/asm/posix_types.h +++ b/arch/microblaze/include/asm/posix_types.h | |||
@@ -1,73 +1,9 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2006 Atmark Techno, Inc. | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_MICROBLAZE_POSIX_TYPES_H | 1 | #ifndef _ASM_MICROBLAZE_POSIX_TYPES_H |
10 | #define _ASM_MICROBLAZE_POSIX_TYPES_H | 2 | #define _ASM_MICROBLAZE_POSIX_TYPES_H |
11 | 3 | ||
12 | /* | ||
13 | * This file is generally used by user-level software, so you need to | ||
14 | * be a little careful about namespace pollution etc. Also, we cannot | ||
15 | * assume GCC is being used. | ||
16 | */ | ||
17 | |||
18 | typedef unsigned long __kernel_ino_t; | ||
19 | typedef unsigned short __kernel_mode_t; | 4 | typedef unsigned short __kernel_mode_t; |
20 | typedef unsigned int __kernel_nlink_t; | 5 | #define __kernel_mode_t __kernel_mode_t |
21 | typedef long __kernel_off_t; | ||
22 | typedef int __kernel_pid_t; | ||
23 | typedef unsigned int __kernel_ipc_pid_t; | ||
24 | typedef unsigned int __kernel_uid_t; | ||
25 | typedef unsigned int __kernel_gid_t; | ||
26 | typedef unsigned long __kernel_size_t; | ||
27 | typedef long __kernel_ssize_t; | ||
28 | typedef int __kernel_ptrdiff_t; | ||
29 | typedef long __kernel_time_t; | ||
30 | typedef long __kernel_suseconds_t; | ||
31 | typedef long __kernel_clock_t; | ||
32 | typedef int __kernel_timer_t; | ||
33 | typedef int __kernel_clockid_t; | ||
34 | typedef int __kernel_daddr_t; | ||
35 | typedef char *__kernel_caddr_t; | ||
36 | typedef unsigned short __kernel_uid16_t; | ||
37 | typedef unsigned short __kernel_gid16_t; | ||
38 | typedef unsigned int __kernel_uid32_t; | ||
39 | typedef unsigned int __kernel_gid32_t; | ||
40 | |||
41 | typedef unsigned int __kernel_old_uid_t; | ||
42 | typedef unsigned int __kernel_old_gid_t; | ||
43 | typedef unsigned int __kernel_old_dev_t; | ||
44 | |||
45 | #ifdef __GNUC__ | ||
46 | typedef long long __kernel_loff_t; | ||
47 | #endif | ||
48 | |||
49 | typedef struct { | ||
50 | #if defined(__KERNEL__) || defined(__USE_ALL) | ||
51 | int val[2]; | ||
52 | #else /* !defined(__KERNEL__) && !defined(__USE_ALL) */ | ||
53 | int __val[2]; | ||
54 | #endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */ | ||
55 | } __kernel_fsid_t; | ||
56 | |||
57 | #if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) | ||
58 | |||
59 | #undef __FD_SET | ||
60 | #define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d)) | ||
61 | |||
62 | #undef __FD_CLR | ||
63 | #define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) | ||
64 | |||
65 | #undef __FD_ISSET | ||
66 | #define __FD_ISSET(d, set) (!!((set)->fds_bits[__FDELT(d)] & __FDMASK(d))) | ||
67 | |||
68 | #undef __FD_ZERO | ||
69 | #define __FD_ZERO(fdsetp) (memset(fdsetp, 0, sizeof(*(fd_set *)fdsetp))) | ||
70 | 6 | ||
71 | #endif /* defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2) */ | 7 | #include <asm-generic/posix_types.h> |
72 | 8 | ||
73 | #endif /* _ASM_MICROBLAZE_POSIX_TYPES_H */ | 9 | #endif /* _ASM_MICROBLAZE_POSIX_TYPES_H */ |
diff --git a/arch/microblaze/include/asm/scatterlist.h b/arch/microblaze/include/asm/scatterlist.h index 08ff1d049b42..35d786fe93ae 100644 --- a/arch/microblaze/include/asm/scatterlist.h +++ b/arch/microblaze/include/asm/scatterlist.h | |||
@@ -1,28 +1 @@ | |||
1 | /* | #include <asm-generic/scatterlist.h> | |
2 | * Copyright (C) 2008 Michal Simek <monstr@monstr.eu> | ||
3 | * Copyright (C) 2006 Atmark Techno, Inc. | ||
4 | * | ||
5 | * This file is subject to the terms and conditions of the GNU General Public | ||
6 | * License. See the file "COPYING" in the main directory of this archive | ||
7 | * for more details. | ||
8 | */ | ||
9 | |||
10 | #ifndef _ASM_MICROBLAZE_SCATTERLIST_H | ||
11 | #define _ASM_MICROBLAZE_SCATTERLIST_H | ||
12 | |||
13 | struct scatterlist { | ||
14 | #ifdef CONFIG_DEBUG_SG | ||
15 | unsigned long sg_magic; | ||
16 | #endif | ||
17 | unsigned long page_link; | ||
18 | dma_addr_t dma_address; | ||
19 | unsigned int offset; | ||
20 | unsigned int length; | ||
21 | }; | ||
22 | |||
23 | #define sg_dma_address(sg) ((sg)->dma_address) | ||
24 | #define sg_dma_len(sg) ((sg)->length) | ||
25 | |||
26 | #define ISA_DMA_THRESHOLD (~0UL) | ||
27 | |||
28 | #endif /* _ASM_MICROBLAZE_SCATTERLIST_H */ | ||
diff --git a/arch/microblaze/include/asm/sembuf.h b/arch/microblaze/include/asm/sembuf.h index b804ed71a57e..7673b83cfef7 100644 --- a/arch/microblaze/include/asm/sembuf.h +++ b/arch/microblaze/include/asm/sembuf.h | |||
@@ -1,34 +1 @@ | |||
1 | /* | #include <asm-generic/sembuf.h> | |
2 | * Copyright (C) 2006 Atmark Techno, Inc. | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_MICROBLAZE_SEMBUF_H | ||
10 | #define _ASM_MICROBLAZE_SEMBUF_H | ||
11 | |||
12 | /* | ||
13 | * The semid64_ds structure for microblaze architecture. | ||
14 | * Note extra padding because this structure is passed back and forth | ||
15 | * between kernel and user space. | ||
16 | * | ||
17 | * Pad space is left for: | ||
18 | * - 64-bit time_t to solve y2038 problem | ||
19 | * - 2 miscellaneous 32-bit values | ||
20 | */ | ||
21 | |||
22 | struct semid64_ds { | ||
23 | struct ipc64_perm sem_perm; /* permissions .. see ipc.h */ | ||
24 | __kernel_time_t sem_otime; /* last semop time */ | ||
25 | unsigned long __unused1; | ||
26 | __kernel_time_t sem_ctime; /* last change time */ | ||
27 | unsigned long __unused2; | ||
28 | unsigned long sem_nsems; /* no. of semaphores in array */ | ||
29 | unsigned long __unused3; | ||
30 | unsigned long __unused4; | ||
31 | }; | ||
32 | |||
33 | |||
34 | #endif /* _ASM_MICROBLAZE_SEMBUF_H */ | ||
diff --git a/arch/microblaze/include/asm/serial.h b/arch/microblaze/include/asm/serial.h index 39bfc8ce6af5..a0cb0caff152 100644 --- a/arch/microblaze/include/asm/serial.h +++ b/arch/microblaze/include/asm/serial.h | |||
@@ -1,14 +1 @@ | |||
1 | /* | #include <asm-generic/serial.h> | |
2 | * Copyright (C) 2009 Michal Simek <monstr@monstr.eu> | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_MICROBLAZE_SERIAL_H | ||
10 | #define _ASM_MICROBLAZE_SERIAL_H | ||
11 | |||
12 | # define BASE_BAUD (1843200 / 16) | ||
13 | |||
14 | #endif /* _ASM_MICROBLAZE_SERIAL_H */ | ||
diff --git a/arch/microblaze/include/asm/shmbuf.h b/arch/microblaze/include/asm/shmbuf.h index f829c5843618..83c05fc2de38 100644 --- a/arch/microblaze/include/asm/shmbuf.h +++ b/arch/microblaze/include/asm/shmbuf.h | |||
@@ -1,42 +1 @@ | |||
1 | #ifndef _ASM_MICROBLAZE_SHMBUF_H | #include <asm-generic/shmbuf.h> | |
2 | #define _ASM_MICROBLAZE_SHMBUF_H | ||
3 | |||
4 | /* | ||
5 | * The shmid64_ds structure for microblaze architecture. | ||
6 | * Note extra padding because this structure is passed back and forth | ||
7 | * between kernel and user space. | ||
8 | * | ||
9 | * Pad space is left for: | ||
10 | * - 64-bit time_t to solve y2038 problem | ||
11 | * - 2 miscellaneous 32-bit values | ||
12 | */ | ||
13 | |||
14 | struct shmid64_ds { | ||
15 | struct ipc64_perm shm_perm; /* operation perms */ | ||
16 | size_t shm_segsz; /* size of segment (bytes) */ | ||
17 | __kernel_time_t shm_atime; /* last attach time */ | ||
18 | unsigned long __unused1; | ||
19 | __kernel_time_t shm_dtime; /* last detach time */ | ||
20 | unsigned long __unused2; | ||
21 | __kernel_time_t shm_ctime; /* last change time */ | ||
22 | unsigned long __unused3; | ||
23 | __kernel_pid_t shm_cpid; /* pid of creator */ | ||
24 | __kernel_pid_t shm_lpid; /* pid of last operator */ | ||
25 | unsigned long shm_nattch; /* no. of current attaches */ | ||
26 | unsigned long __unused4; | ||
27 | unsigned long __unused5; | ||
28 | }; | ||
29 | |||
30 | struct shminfo64 { | ||
31 | unsigned long shmmax; | ||
32 | unsigned long shmmin; | ||
33 | unsigned long shmmni; | ||
34 | unsigned long shmseg; | ||
35 | unsigned long shmall; | ||
36 | unsigned long __unused1; | ||
37 | unsigned long __unused2; | ||
38 | unsigned long __unused3; | ||
39 | unsigned long __unused4; | ||
40 | }; | ||
41 | |||
42 | #endif /* _ASM_MICROBLAZE_SHMBUF_H */ | ||
diff --git a/arch/microblaze/include/asm/shmparam.h b/arch/microblaze/include/asm/shmparam.h index 9f5fc2b3b6a3..93f30deb95d0 100644 --- a/arch/microblaze/include/asm/shmparam.h +++ b/arch/microblaze/include/asm/shmparam.h | |||
@@ -1,6 +1 @@ | |||
1 | #ifndef _ASM_MICROBLAZE_SHMPARAM_H | #include <asm-generic/shmparam.h> | |
2 | #define _ASM_MICROBLAZE_SHMPARAM_H | ||
3 | |||
4 | #define SHMLBA PAGE_SIZE /* attach addr a multiple of this */ | ||
5 | |||
6 | #endif /* _ASM_MICROBLAZE_SHMPARAM_H */ | ||
diff --git a/arch/microblaze/include/asm/siginfo.h b/arch/microblaze/include/asm/siginfo.h index f162911a8f50..0815d29d82e5 100644 --- a/arch/microblaze/include/asm/siginfo.h +++ b/arch/microblaze/include/asm/siginfo.h | |||
@@ -1,15 +1 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2006 Atmark Techno, Inc. | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_MICROBLAZE_SIGINFO_H | ||
10 | #define _ASM_MICROBLAZE_SIGINFO_H | ||
11 | |||
12 | #include <linux/types.h> | ||
13 | #include <asm-generic/siginfo.h> | #include <asm-generic/siginfo.h> | |
14 | |||
15 | #endif /* _ASM_MICROBLAZE_SIGINFO_H */ | ||
diff --git a/arch/microblaze/include/asm/signal.h b/arch/microblaze/include/asm/signal.h index 46bc2267d949..7b1573ce19de 100644 --- a/arch/microblaze/include/asm/signal.h +++ b/arch/microblaze/include/asm/signal.h | |||
@@ -1,165 +1 @@ | |||
1 | /* | #include <asm-generic/signal.h> | |
2 | * Copyright (C) 2006 Atmark Techno, Inc. | ||
3 | * Yasushi SHOJI <yashi@atmark-techno.com> | ||
4 | * Tetsuya OHKAWA <tetsuya@atmark-techno.com> | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | |||
11 | #ifndef _ASM_MICROBLAZE_SIGNAL_H | ||
12 | #define _ASM_MICROBLAZE_SIGNAL_H | ||
13 | |||
14 | #define SIGHUP 1 | ||
15 | #define SIGINT 2 | ||
16 | #define SIGQUIT 3 | ||
17 | #define SIGILL 4 | ||
18 | #define SIGTRAP 5 | ||
19 | #define SIGABRT 6 | ||
20 | #define SIGIOT 6 | ||
21 | #define SIGBUS 7 | ||
22 | #define SIGFPE 8 | ||
23 | #define SIGKILL 9 | ||
24 | #define SIGUSR1 10 | ||
25 | #define SIGSEGV 11 | ||
26 | #define SIGUSR2 12 | ||
27 | #define SIGPIPE 13 | ||
28 | #define SIGALRM 14 | ||
29 | #define SIGTERM 15 | ||
30 | #define SIGSTKFLT 16 | ||
31 | #define SIGCHLD 17 | ||
32 | #define SIGCONT 18 | ||
33 | #define SIGSTOP 19 | ||
34 | #define SIGTSTP 20 | ||
35 | #define SIGTTIN 21 | ||
36 | #define SIGTTOU 22 | ||
37 | #define SIGURG 23 | ||
38 | #define SIGXCPU 24 | ||
39 | #define SIGXFSZ 25 | ||
40 | #define SIGVTALRM 26 | ||
41 | #define SIGPROF 27 | ||
42 | #define SIGWINCH 28 | ||
43 | #define SIGIO 29 | ||
44 | #define SIGPOLL SIGIO | ||
45 | /* | ||
46 | #define SIGLOST 29 | ||
47 | */ | ||
48 | #define SIGPWR 30 | ||
49 | #define SIGSYS 31 | ||
50 | #define SIGUNUSED 31 | ||
51 | |||
52 | /* These should not be considered constants from userland. */ | ||
53 | #define SIGRTMIN 32 | ||
54 | #define SIGRTMAX _NSIG | ||
55 | |||
56 | /* | ||
57 | * SA_FLAGS values: | ||
58 | * | ||
59 | * SA_ONSTACK indicates that a registered stack_t will be used. | ||
60 | * SA_RESTART flag to get restarting signals (which were the default long ago) | ||
61 | * SA_NOCLDSTOP flag to turn off SIGCHLD when children stop. | ||
62 | * SA_RESETHAND clears the handler when the signal is delivered. | ||
63 | * SA_NOCLDWAIT flag on SIGCHLD to inhibit zombies. | ||
64 | * SA_NODEFER prevents the current signal from being masked in the handler. | ||
65 | * | ||
66 | * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single | ||
67 | * Unix names RESETHAND and NODEFER respectively. | ||
68 | */ | ||
69 | #define SA_NOCLDSTOP 0x00000001 | ||
70 | #define SA_NOCLDWAIT 0x00000002 | ||
71 | #define SA_SIGINFO 0x00000004 | ||
72 | #define SA_ONSTACK 0x08000000 | ||
73 | #define SA_RESTART 0x10000000 | ||
74 | #define SA_NODEFER 0x40000000 | ||
75 | #define SA_RESETHAND 0x80000000 | ||
76 | |||
77 | #define SA_NOMASK SA_NODEFER | ||
78 | #define SA_ONESHOT SA_RESETHAND | ||
79 | |||
80 | #define SA_RESTORER 0x04000000 | ||
81 | |||
82 | /* | ||
83 | * sigaltstack controls | ||
84 | */ | ||
85 | #define SS_ONSTACK 1 | ||
86 | #define SS_DISABLE 2 | ||
87 | |||
88 | #define MINSIGSTKSZ 2048 | ||
89 | #define SIGSTKSZ 8192 | ||
90 | |||
91 | # ifndef __ASSEMBLY__ | ||
92 | # include <linux/types.h> | ||
93 | # include <asm-generic/signal-defs.h> | ||
94 | |||
95 | /* Avoid too many header ordering problems. */ | ||
96 | struct siginfo; | ||
97 | |||
98 | # ifdef __KERNEL__ | ||
99 | /* | ||
100 | * Most things should be clean enough to redefine this at will, if care | ||
101 | * is taken to make libc match. | ||
102 | */ | ||
103 | # define _NSIG 64 | ||
104 | # define _NSIG_BPW 32 | ||
105 | # define _NSIG_WORDS (_NSIG / _NSIG_BPW) | ||
106 | |||
107 | typedef unsigned long old_sigset_t; /* at least 32 bits */ | ||
108 | |||
109 | typedef struct { | ||
110 | unsigned long sig[_NSIG_WORDS]; | ||
111 | } sigset_t; | ||
112 | |||
113 | struct old_sigaction { | ||
114 | __sighandler_t sa_handler; | ||
115 | old_sigset_t sa_mask; | ||
116 | unsigned long sa_flags; | ||
117 | void (*sa_restorer)(void); | ||
118 | }; | ||
119 | |||
120 | struct sigaction { | ||
121 | __sighandler_t sa_handler; | ||
122 | unsigned long sa_flags; | ||
123 | void (*sa_restorer)(void); | ||
124 | sigset_t sa_mask; /* mask last for extensibility */ | ||
125 | }; | ||
126 | |||
127 | struct k_sigaction { | ||
128 | struct sigaction sa; | ||
129 | }; | ||
130 | |||
131 | # include <asm/sigcontext.h> | ||
132 | # undef __HAVE_ARCH_SIG_BITOPS | ||
133 | |||
134 | # define ptrace_signal_deliver(regs, cookie) do { } while (0) | ||
135 | |||
136 | # else /* !__KERNEL__ */ | ||
137 | |||
138 | /* Here we must cater to libcs that poke about in kernel headers. */ | ||
139 | |||
140 | # define NSIG 32 | ||
141 | typedef unsigned long sigset_t; | ||
142 | |||
143 | struct sigaction { | ||
144 | union { | ||
145 | __sighandler_t _sa_handler; | ||
146 | void (*_sa_sigaction)(int, struct siginfo *, void *); | ||
147 | } _u; | ||
148 | sigset_t sa_mask; | ||
149 | unsigned long sa_flags; | ||
150 | void (*sa_restorer)(void); | ||
151 | }; | ||
152 | |||
153 | # define sa_handler _u._sa_handler | ||
154 | # define sa_sigaction _u._sa_sigaction | ||
155 | |||
156 | # endif /* __KERNEL__ */ | ||
157 | |||
158 | typedef struct sigaltstack { | ||
159 | void *ss_sp; | ||
160 | int ss_flags; | ||
161 | size_t ss_size; | ||
162 | } stack_t; | ||
163 | |||
164 | # endif /* __ASSEMBLY__ */ | ||
165 | #endif /* _ASM_MICROBLAZE_SIGNAL_H */ | ||
diff --git a/arch/microblaze/include/asm/socket.h b/arch/microblaze/include/asm/socket.h index 825936860314..6b71384b9d8b 100644 --- a/arch/microblaze/include/asm/socket.h +++ b/arch/microblaze/include/asm/socket.h | |||
@@ -1,69 +1 @@ | |||
1 | /* | #include <asm-generic/socket.h> | |
2 | * Copyright (C) 2006 Atmark Techno, Inc. | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_MICROBLAZE_SOCKET_H | ||
10 | #define _ASM_MICROBLAZE_SOCKET_H | ||
11 | |||
12 | #include <asm/sockios.h> | ||
13 | |||
14 | /* For setsockoptions(2) */ | ||
15 | #define SOL_SOCKET 1 | ||
16 | |||
17 | #define SO_DEBUG 1 | ||
18 | #define SO_REUSEADDR 2 | ||
19 | #define SO_TYPE 3 | ||
20 | #define SO_ERROR 4 | ||
21 | #define SO_DONTROUTE 5 | ||
22 | #define SO_BROADCAST 6 | ||
23 | #define SO_SNDBUF 7 | ||
24 | #define SO_RCVBUF 8 | ||
25 | #define SO_SNDBUFFORCE 32 | ||
26 | #define SO_RCVBUFFORCE 33 | ||
27 | #define SO_KEEPALIVE 9 | ||
28 | #define SO_OOBINLINE 10 | ||
29 | #define SO_NO_CHECK 11 | ||
30 | #define SO_PRIORITY 12 | ||
31 | #define SO_LINGER 13 | ||
32 | #define SO_BSDCOMPAT 14 | ||
33 | /* To add :#define SO_REUSEPORT 15 */ | ||
34 | #define SO_PASSCRED 16 | ||
35 | #define SO_PEERCRED 17 | ||
36 | #define SO_RCVLOWAT 18 | ||
37 | #define SO_SNDLOWAT 19 | ||
38 | #define SO_RCVTIMEO 20 | ||
39 | #define SO_SNDTIMEO 21 | ||
40 | |||
41 | /* Security levels - as per NRL IPv6 - don't actually do anything */ | ||
42 | #define SO_SECURITY_AUTHENTICATION 22 | ||
43 | #define SO_SECURITY_ENCRYPTION_TRANSPORT 23 | ||
44 | #define SO_SECURITY_ENCRYPTION_NETWORK 24 | ||
45 | |||
46 | #define SO_BINDTODEVICE 25 | ||
47 | |||
48 | /* Socket filtering */ | ||
49 | #define SO_ATTACH_FILTER 26 | ||
50 | #define SO_DETACH_FILTER 27 | ||
51 | |||
52 | #define SO_PEERNAME 28 | ||
53 | #define SO_TIMESTAMP 29 | ||
54 | #define SCM_TIMESTAMP SO_TIMESTAMP | ||
55 | |||
56 | #define SO_ACCEPTCONN 30 | ||
57 | |||
58 | #define SO_PEERSEC 31 | ||
59 | #define SO_PASSSEC 34 | ||
60 | |||
61 | #define SO_TIMESTAMPNS 35 | ||
62 | #define SCM_TIMESTAMPNS SO_TIMESTAMPNS | ||
63 | |||
64 | #define SO_MARK 36 | ||
65 | |||
66 | #define SO_TIMESTAMPING 37 | ||
67 | #define SCM_TIMESTAMPING SO_TIMESTAMPING | ||
68 | |||
69 | #endif /* _ASM_MICROBLAZE_SOCKET_H */ | ||
diff --git a/arch/microblaze/include/asm/sockios.h b/arch/microblaze/include/asm/sockios.h index 9fff57a701e1..def6d4746ee7 100644 --- a/arch/microblaze/include/asm/sockios.h +++ b/arch/microblaze/include/asm/sockios.h | |||
@@ -1,23 +1 @@ | |||
1 | /* | #include <asm-generic/sockios.h> | |
2 | * Copyright (C) 2006 Atmark Techno, Inc. | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_MICROBLAZE_SOCKIOS_H | ||
10 | #define _ASM_MICROBLAZE_SOCKIOS_H | ||
11 | |||
12 | #include <linux/ioctl.h> | ||
13 | |||
14 | /* Socket-level I/O control calls. */ | ||
15 | #define FIOSETOWN 0x8901 | ||
16 | #define SIOCSPGRP 0x8902 | ||
17 | #define FIOGETOWN 0x8903 | ||
18 | #define SIOCGPGRP 0x8904 | ||
19 | #define SIOCATMARK 0x8905 | ||
20 | #define SIOCGSTAMP 0x8906 /* Get stamp (timeval) */ | ||
21 | #define SIOCGSTAMPNS 0x8907 /* Get stamp (timespec) */ | ||
22 | |||
23 | #endif /* _ASM_MICROBLAZE_SOCKIOS_H */ | ||
diff --git a/arch/microblaze/include/asm/stat.h b/arch/microblaze/include/asm/stat.h index a15f77520bfd..3dc90fa92c70 100644 --- a/arch/microblaze/include/asm/stat.h +++ b/arch/microblaze/include/asm/stat.h | |||
@@ -1,68 +1 @@ | |||
1 | /* | #include <asm-generic/stat.h> | |
2 | * Microblaze stat structure | ||
3 | * | ||
4 | * Copyright (C) 2001,02,03 NEC Electronics Corporation | ||
5 | * Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org> | ||
6 | * | ||
7 | * This file is subject to the terms and conditions of the GNU General | ||
8 | * Public License. See the file COPYING in the main directory of this | ||
9 | * archive for more details. | ||
10 | * | ||
11 | * Written by Miles Bader <miles@gnu.org> | ||
12 | */ | ||
13 | |||
14 | #ifndef _ASM_MICROBLAZE_STAT_H | ||
15 | #define _ASM_MICROBLAZE_STAT_H | ||
16 | |||
17 | #include <linux/posix_types.h> | ||
18 | |||
19 | #define STAT_HAVE_NSEC 1 | ||
20 | |||
21 | struct stat { | ||
22 | unsigned long st_dev; | ||
23 | unsigned long st_ino; | ||
24 | unsigned int st_mode; | ||
25 | unsigned int st_nlink; | ||
26 | unsigned int st_uid; | ||
27 | unsigned int st_gid; | ||
28 | unsigned long st_rdev; | ||
29 | unsigned long __pad1; | ||
30 | long st_size; | ||
31 | int st_blksize; | ||
32 | int __pad2; | ||
33 | long st_blocks; | ||
34 | int st_atime; | ||
35 | unsigned int st_atime_nsec; | ||
36 | int st_mtime; | ||
37 | unsigned int st_mtime_nsec; | ||
38 | int st_ctime; | ||
39 | unsigned int st_ctime_nsec; | ||
40 | unsigned long __unused4; | ||
41 | unsigned long __unused5; | ||
42 | }; | ||
43 | |||
44 | struct stat64 { | ||
45 | unsigned long long st_dev; /* Device. */ | ||
46 | unsigned long long st_ino; /* File serial number. */ | ||
47 | unsigned int st_mode; /* File mode. */ | ||
48 | unsigned int st_nlink; /* Link count. */ | ||
49 | unsigned int st_uid; /* User ID of the file's owner. */ | ||
50 | unsigned int st_gid; /* Group ID of the file's group. */ | ||
51 | unsigned long long st_rdev; /* Device number, if device. */ | ||
52 | unsigned long long __pad1; | ||
53 | long long st_size; /* Size of file, in bytes. */ | ||
54 | int st_blksize; /* Optimal block size for I/O. */ | ||
55 | int __pad2; | ||
56 | long long st_blocks; /* Number 512-byte blocks allocated. */ | ||
57 | int st_atime; /* Time of last access. */ | ||
58 | unsigned int st_atime_nsec; | ||
59 | int st_mtime; /* Time of last modification. */ | ||
60 | unsigned int st_mtime_nsec; | ||
61 | int st_ctime; /* Time of last status change. */ | ||
62 | unsigned int st_ctime_nsec; | ||
63 | unsigned int __unused4; | ||
64 | unsigned int __unused5; | ||
65 | }; | ||
66 | |||
67 | #endif /* _ASM_MICROBLAZE_STAT_H */ | ||
68 | |||
diff --git a/arch/microblaze/include/asm/swab.h b/arch/microblaze/include/asm/swab.h index b375d7b65ad7..7847e563ab66 100644 --- a/arch/microblaze/include/asm/swab.h +++ b/arch/microblaze/include/asm/swab.h | |||
@@ -1,8 +1 @@ | |||
1 | #ifndef _ASM_MICROBLAZE_SWAB_H | #include <asm-generic/swab.h> | |
2 | #define _ASM_MICROBLAZE_SWAB_H | ||
3 | |||
4 | #if defined(__GNUC__) && !defined(__STRICT_ANSI__) || defined(__KERNEL__) | ||
5 | #define __SWAB_64_THRU_32__ | ||
6 | #endif | ||
7 | |||
8 | #endif /* _ASM_MICROBLAZE_SWAB_H */ | ||
diff --git a/arch/microblaze/include/asm/syscalls.h b/arch/microblaze/include/asm/syscalls.h index ddea9eb31f8d..720761cc741f 100644 --- a/arch/microblaze/include/asm/syscalls.h +++ b/arch/microblaze/include/asm/syscalls.h | |||
@@ -1,48 +1,8 @@ | |||
1 | #ifndef __ASM_MICROBLAZE_SYSCALLS_H | 1 | #ifndef __ASM_MICROBLAZE_SYSCALLS_H |
2 | #define __ASM_MICROBLAZE_SYSCALLS_H | ||
3 | #ifdef __KERNEL__ | ||
4 | 2 | ||
5 | #include <linux/compiler.h> | 3 | asmlinkage long sys_clone(int flags, unsigned long stack, struct pt_regs *regs); |
6 | #include <linux/linkage.h> | 4 | #define sys_clone sys_clone |
7 | #include <linux/types.h> | ||
8 | #include <linux/signal.h> | ||
9 | 5 | ||
10 | /* FIXME will be removed */ | 6 | #include <asm-generic/syscalls.h> |
11 | asmlinkage int sys_ipc(uint call, int first, int second, | ||
12 | int third, void *ptr, long fifth); | ||
13 | 7 | ||
14 | struct pt_regs; | ||
15 | asmlinkage int sys_vfork(struct pt_regs *regs); | ||
16 | asmlinkage int sys_clone(int flags, unsigned long stack, struct pt_regs *regs); | ||
17 | asmlinkage int sys_execve(char __user *filenamei, char __user *__user *argv, | ||
18 | char __user *__user *envp, struct pt_regs *regs); | ||
19 | |||
20 | asmlinkage unsigned long sys_mmap2(unsigned long addr, size_t len, | ||
21 | unsigned long prot, unsigned long flags, | ||
22 | unsigned long fd, unsigned long pgoff); | ||
23 | |||
24 | asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len, | ||
25 | unsigned long prot, unsigned long flags, | ||
26 | unsigned long fd, off_t offset); | ||
27 | |||
28 | /* from signal.c */ | ||
29 | asmlinkage int sys_sigsuspend(old_sigset_t mask, struct pt_regs *regs); | ||
30 | |||
31 | asmlinkage int sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize, | ||
32 | struct pt_regs *regs); | ||
33 | |||
34 | asmlinkage int sys_sigaction(int sig, const struct old_sigaction *act, | ||
35 | struct old_sigaction *oact); | ||
36 | |||
37 | asmlinkage long sys_rt_sigaction(int sig, const struct sigaction __user *act, | ||
38 | struct sigaction __user *oact, size_t sigsetsize); | ||
39 | |||
40 | asmlinkage int sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, | ||
41 | struct pt_regs *regs); | ||
42 | |||
43 | asmlinkage int sys_sigreturn(struct pt_regs *regs); | ||
44 | |||
45 | asmlinkage int sys_rt_sigreturn(struct pt_regs *regs); | ||
46 | |||
47 | #endif /* __KERNEL__ */ | ||
48 | #endif /* __ASM_MICROBLAZE_SYSCALLS_H */ | 8 | #endif /* __ASM_MICROBLAZE_SYSCALLS_H */ |
diff --git a/arch/microblaze/include/asm/system.h b/arch/microblaze/include/asm/system.h index c4e308850b5d..b1ed61590660 100644 --- a/arch/microblaze/include/asm/system.h +++ b/arch/microblaze/include/asm/system.h | |||
@@ -13,6 +13,9 @@ | |||
13 | #include <asm/setup.h> | 13 | #include <asm/setup.h> |
14 | #include <asm/irqflags.h> | 14 | #include <asm/irqflags.h> |
15 | 15 | ||
16 | #include <asm-generic/cmpxchg.h> | ||
17 | #include <asm-generic/cmpxchg-local.h> | ||
18 | |||
16 | struct task_struct; | 19 | struct task_struct; |
17 | struct thread_info; | 20 | struct thread_info; |
18 | 21 | ||
diff --git a/arch/microblaze/include/asm/termbits.h b/arch/microblaze/include/asm/termbits.h index a1b64bc4724a..3935b106de79 100644 --- a/arch/microblaze/include/asm/termbits.h +++ b/arch/microblaze/include/asm/termbits.h | |||
@@ -1,203 +1 @@ | |||
1 | /* | #include <asm-generic/termbits.h> | |
2 | * Copyright (C) 2006 Atmark Techno, Inc. | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_MICROBLAZE_TERMBITS_H | ||
10 | #define _ASM_MICROBLAZE_TERMBITS_H | ||
11 | |||
12 | #include <linux/posix_types.h> | ||
13 | |||
14 | typedef unsigned char cc_t; | ||
15 | typedef unsigned int speed_t; | ||
16 | typedef unsigned int tcflag_t; | ||
17 | |||
18 | #define NCCS 19 | ||
19 | struct termios { | ||
20 | tcflag_t c_iflag; /* input mode flags */ | ||
21 | tcflag_t c_oflag; /* output mode flags */ | ||
22 | tcflag_t c_cflag; /* control mode flags */ | ||
23 | tcflag_t c_lflag; /* local mode flags */ | ||
24 | cc_t c_line; /* line discipline */ | ||
25 | cc_t c_cc[NCCS]; /* control characters */ | ||
26 | }; | ||
27 | |||
28 | struct ktermios { | ||
29 | tcflag_t c_iflag; /* input mode flags */ | ||
30 | tcflag_t c_oflag; /* output mode flags */ | ||
31 | tcflag_t c_cflag; /* control mode flags */ | ||
32 | tcflag_t c_lflag; /* local mode flags */ | ||
33 | cc_t c_line; /* line discipline */ | ||
34 | cc_t c_cc[NCCS]; /* control characters */ | ||
35 | speed_t c_ispeed; /* input speed */ | ||
36 | speed_t c_ospeed; /* output speed */ | ||
37 | }; | ||
38 | |||
39 | /* c_cc characters */ | ||
40 | |||
41 | #define VINTR 0 | ||
42 | #define VQUIT 1 | ||
43 | #define VERASE 2 | ||
44 | #define VKILL 3 | ||
45 | #define VEOF 4 | ||
46 | #define VTIME 5 | ||
47 | #define VMIN 6 | ||
48 | #define VSWTC 7 | ||
49 | #define VSTART 8 | ||
50 | #define VSTOP 9 | ||
51 | #define VSUSP 10 | ||
52 | #define VEOL 11 | ||
53 | #define VREPRINT 12 | ||
54 | #define VDISCARD 13 | ||
55 | #define VWERASE 14 | ||
56 | #define VLNEXT 15 | ||
57 | #define VEOL2 16 | ||
58 | |||
59 | /* c_iflag bits */ | ||
60 | |||
61 | #define IGNBRK 0000001 | ||
62 | #define BRKINT 0000002 | ||
63 | #define IGNPAR 0000004 | ||
64 | #define PARMRK 0000010 | ||
65 | #define INPCK 0000020 | ||
66 | #define ISTRIP 0000040 | ||
67 | #define INLCR 0000100 | ||
68 | #define IGNCR 0000200 | ||
69 | #define ICRNL 0000400 | ||
70 | #define IUCLC 0001000 | ||
71 | #define IXON 0002000 | ||
72 | #define IXANY 0004000 | ||
73 | #define IXOFF 0010000 | ||
74 | #define IMAXBEL 0020000 | ||
75 | #define IUTF8 0040000 | ||
76 | |||
77 | /* c_oflag bits */ | ||
78 | |||
79 | #define OPOST 0000001 | ||
80 | #define OLCUC 0000002 | ||
81 | #define ONLCR 0000004 | ||
82 | #define OCRNL 0000010 | ||
83 | #define ONOCR 0000020 | ||
84 | #define ONLRET 0000040 | ||
85 | #define OFILL 0000100 | ||
86 | #define OFDEL 0000200 | ||
87 | #define NLDLY 0000400 | ||
88 | #define NL0 0000000 | ||
89 | #define NL1 0000400 | ||
90 | #define CRDLY 0003000 | ||
91 | #define CR0 0000000 | ||
92 | #define CR1 0001000 | ||
93 | #define CR2 0002000 | ||
94 | #define CR3 0003000 | ||
95 | #define TABDLY 0014000 | ||
96 | #define TAB0 0000000 | ||
97 | #define TAB1 0004000 | ||
98 | #define TAB2 0010000 | ||
99 | #define TAB3 0014000 | ||
100 | #define XTABS 0014000 | ||
101 | #define BSDLY 0020000 | ||
102 | #define BS0 0000000 | ||
103 | #define BS1 0020000 | ||
104 | #define VTDLY 0040000 | ||
105 | #define VT0 0000000 | ||
106 | #define VT1 0040000 | ||
107 | #define FFDLY 0100000 | ||
108 | #define FF0 0000000 | ||
109 | #define FF1 0100000 | ||
110 | |||
111 | /* c_cflag bit meaning */ | ||
112 | |||
113 | #define CBAUD 0010017 | ||
114 | #define B0 0000000 /* hang up */ | ||
115 | #define B50 0000001 | ||
116 | #define B75 0000002 | ||
117 | #define B110 0000003 | ||
118 | #define B134 0000004 | ||
119 | #define B150 0000005 | ||
120 | #define B200 0000006 | ||
121 | #define B300 0000007 | ||
122 | #define B600 0000010 | ||
123 | #define B1200 0000011 | ||
124 | #define B1800 0000012 | ||
125 | #define B2400 0000013 | ||
126 | #define B4800 0000014 | ||
127 | #define B9600 0000015 | ||
128 | #define B19200 0000016 | ||
129 | #define B38400 0000017 | ||
130 | #define EXTA B19200 | ||
131 | #define EXTB B38400 | ||
132 | #define CSIZE 0000060 | ||
133 | #define CS5 0000000 | ||
134 | #define CS6 0000020 | ||
135 | #define CS7 0000040 | ||
136 | #define CS8 0000060 | ||
137 | #define CSTOPB 0000100 | ||
138 | #define CREAD 0000200 | ||
139 | #define PARENB 0000400 | ||
140 | #define PARODD 0001000 | ||
141 | #define HUPCL 0002000 | ||
142 | #define CLOCAL 0004000 | ||
143 | #define CBAUDEX 0010000 | ||
144 | #define B57600 0010001 | ||
145 | #define B115200 0010002 | ||
146 | #define B230400 0010003 | ||
147 | #define B460800 0010004 | ||
148 | #define B500000 0010005 | ||
149 | #define B576000 0010006 | ||
150 | #define B921600 0010007 | ||
151 | #define BOTHER 0010000 | ||
152 | #define B1000000 0010010 | ||
153 | #define B1152000 0010011 | ||
154 | #define B1500000 0010012 | ||
155 | #define B2000000 0010013 | ||
156 | #define B2500000 0010014 | ||
157 | #define B3000000 0010015 | ||
158 | #define B3500000 0010016 | ||
159 | #define B4000000 0010017 | ||
160 | #define CIBAUD 002003600000 /* input baud rate (not used) */ | ||
161 | #define CMSPAR 010000000000 /* mark or space (stick) parity */ | ||
162 | #define CRTSCTS 020000000000 /* flow control */ | ||
163 | |||
164 | #define IBSHIFT 16 /* Shift from CBAUD to CIBAUD */ | ||
165 | |||
166 | /* c_lflag bits */ | ||
167 | |||
168 | #define ISIG 0000001 | ||
169 | #define ICANON 0000002 | ||
170 | #define XCASE 0000004 | ||
171 | #define ECHO 0000010 | ||
172 | #define ECHOE 0000020 | ||
173 | #define ECHOK 0000040 | ||
174 | #define ECHONL 0000100 | ||
175 | #define NOFLSH 0000200 | ||
176 | #define TOSTOP 0000400 | ||
177 | #define ECHOCTL 0001000 | ||
178 | #define ECHOPRT 0002000 | ||
179 | #define ECHOKE 0004000 | ||
180 | #define FLUSHO 0010000 | ||
181 | #define PENDIN 0040000 | ||
182 | #define IEXTEN 0100000 | ||
183 | |||
184 | /* tcflow() and TCXONC use these */ | ||
185 | |||
186 | #define TCOOFF 0 | ||
187 | #define TCOON 1 | ||
188 | #define TCIOFF 2 | ||
189 | #define TCION 3 | ||
190 | |||
191 | /* tcflush() and TCFLSH use these */ | ||
192 | |||
193 | #define TCIFLUSH 0 | ||
194 | #define TCOFLUSH 1 | ||
195 | #define TCIOFLUSH 2 | ||
196 | |||
197 | /* tcsetattr uses these */ | ||
198 | |||
199 | #define TCSANOW 0 | ||
200 | #define TCSADRAIN 1 | ||
201 | #define TCSAFLUSH 2 | ||
202 | |||
203 | #endif /* _ASM_MICROBLAZE_TERMBITS_H */ | ||
diff --git a/arch/microblaze/include/asm/termios.h b/arch/microblaze/include/asm/termios.h index 47a46d1fbe26..280d78a9d966 100644 --- a/arch/microblaze/include/asm/termios.h +++ b/arch/microblaze/include/asm/termios.h | |||
@@ -1,88 +1 @@ | |||
1 | /* | #include <asm-generic/termios.h> | |
2 | * Copyright (C) 2006 Atmark Techno, Inc. | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_MICROBLAZE_TERMIOS_H | ||
10 | #define _ASM_MICROBLAZE_TERMIOS_H | ||
11 | |||
12 | #include <linux/string.h> | ||
13 | #include <asm/termbits.h> | ||
14 | #include <asm/ioctls.h> | ||
15 | |||
16 | struct winsize { | ||
17 | unsigned short ws_row; | ||
18 | unsigned short ws_col; | ||
19 | unsigned short ws_xpixel; | ||
20 | unsigned short ws_ypixel; | ||
21 | }; | ||
22 | |||
23 | #define NCC 8 | ||
24 | struct termio { | ||
25 | unsigned short c_iflag; /* input mode flags */ | ||
26 | unsigned short c_oflag; /* output mode flags */ | ||
27 | unsigned short c_cflag; /* control mode flags */ | ||
28 | unsigned short c_lflag; /* local mode flags */ | ||
29 | unsigned char c_line; /* line discipline */ | ||
30 | unsigned char c_cc[NCC]; /* control characters */ | ||
31 | }; | ||
32 | |||
33 | #ifdef __KERNEL__ | ||
34 | /* intr=^C quit=^| erase=del kill=^U | ||
35 | eof=^D vtime=\0 vmin=\1 sxtc=\0 | ||
36 | start=^Q stop=^S susp=^Z eol=\0 | ||
37 | reprint=^R discard=^U werase=^W lnext=^V | ||
38 | eol2=\0 | ||
39 | */ | ||
40 | #define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0" | ||
41 | #endif | ||
42 | |||
43 | /* Modem lines */ | ||
44 | |||
45 | #define TIOCM_LE 0x001 | ||
46 | #define TIOCM_DTR 0x002 | ||
47 | #define TIOCM_RTS 0x004 | ||
48 | #define TIOCM_ST 0x008 | ||
49 | #define TIOCM_SR 0x010 | ||
50 | #define TIOCM_CTS 0x020 | ||
51 | #define TIOCM_CAR 0x040 | ||
52 | #define TIOCM_RNG 0x080 | ||
53 | #define TIOCM_DSR 0x100 | ||
54 | #define TIOCM_CD TIOCM_CAR | ||
55 | #define TIOCM_RI TIOCM_RNG | ||
56 | #define TIOCM_OUT1 0x2000 | ||
57 | #define TIOCM_OUT2 0x4000 | ||
58 | #define TIOCM_LOOP 0x8000 | ||
59 | |||
60 | /* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */ | ||
61 | |||
62 | /* Line disciplines */ | ||
63 | |||
64 | #define N_TTY 0 | ||
65 | #define N_SLIP 1 | ||
66 | #define N_MOUSE 2 | ||
67 | #define N_PPP 3 | ||
68 | #define N_STRIP 4 | ||
69 | #define N_AX25 5 | ||
70 | #define N_X25 6 /* X.25 async */ | ||
71 | #define N_6PACK 7 | ||
72 | #define N_MASC 8 /* Reserved for Mobitex module <kaz@cafe.net> */ | ||
73 | #define N_R3964 9 /* Reserved for Simatic R3964 module */ | ||
74 | #define N_PROFIBUS_FDL 10 /* Reserved for Profibus <Dave@mvhi.com> */ | ||
75 | #define N_IRDA 11 /* Linux IR - http://irda.sourceforge.net/ */ | ||
76 | #define N_SMSBLOCK 12 /* SMS block mode - for talking to GSM data cards | ||
77 | about SMS messages */ | ||
78 | #define N_HDLC 13 /* synchronous HDLC */ | ||
79 | #define N_SYNC_PPP 14 | ||
80 | #define N_HCI 15 /* Bluetooth HCI UART */ | ||
81 | |||
82 | #ifdef __KERNEL__ | ||
83 | |||
84 | #include <asm-generic/termios-base.h> | ||
85 | |||
86 | #endif /* __KERNEL__ */ | ||
87 | |||
88 | #endif /* _ASM_MICROBLAZE_TERMIOS_H */ | ||
diff --git a/arch/microblaze/include/asm/thread_info.h b/arch/microblaze/include/asm/thread_info.h index 7fac44498445..6e92885d381a 100644 --- a/arch/microblaze/include/asm/thread_info.h +++ b/arch/microblaze/include/asm/thread_info.h | |||
@@ -75,8 +75,6 @@ struct thread_info { | |||
75 | 75 | ||
76 | /* | 76 | /* |
77 | * macros/functions for gaining access to the thread information structure | 77 | * macros/functions for gaining access to the thread information structure |
78 | * | ||
79 | * preempt_count needs to be 1 initially, until the scheduler is functional. | ||
80 | */ | 78 | */ |
81 | #define INIT_THREAD_INFO(tsk) \ | 79 | #define INIT_THREAD_INFO(tsk) \ |
82 | { \ | 80 | { \ |
@@ -84,7 +82,7 @@ struct thread_info { | |||
84 | .exec_domain = &default_exec_domain, \ | 82 | .exec_domain = &default_exec_domain, \ |
85 | .flags = 0, \ | 83 | .flags = 0, \ |
86 | .cpu = 0, \ | 84 | .cpu = 0, \ |
87 | .preempt_count = 1, \ | 85 | .preempt_count = INIT_PREEMPT_COUNT, \ |
88 | .addr_limit = KERNEL_DS, \ | 86 | .addr_limit = KERNEL_DS, \ |
89 | .restart_block = { \ | 87 | .restart_block = { \ |
90 | .fn = do_no_restart_syscall, \ | 88 | .fn = do_no_restart_syscall, \ |
diff --git a/arch/microblaze/include/asm/timex.h b/arch/microblaze/include/asm/timex.h index 678525dc6d0b..befcf3de5532 100644 --- a/arch/microblaze/include/asm/timex.h +++ b/arch/microblaze/include/asm/timex.h | |||
@@ -9,10 +9,8 @@ | |||
9 | #ifndef _ASM_MICROBLAZE_TIMEX_H | 9 | #ifndef _ASM_MICROBLAZE_TIMEX_H |
10 | #define _ASM_MICROBLAZE_TIMEX_H | 10 | #define _ASM_MICROBLAZE_TIMEX_H |
11 | 11 | ||
12 | #define CLOCK_TICK_RATE 1000 /* Timer input freq. */ | 12 | #include <asm-generic/timex.h> |
13 | |||
14 | typedef unsigned long cycles_t; | ||
15 | 13 | ||
16 | #define get_cycles() (0) | 14 | #define CLOCK_TICK_RATE 1000 /* Timer input freq. */ |
17 | 15 | ||
18 | #endif /* _ASM_TIMEX_H */ | 16 | #endif /* _ASM_TIMEX_H */ |
diff --git a/arch/microblaze/include/asm/types.h b/arch/microblaze/include/asm/types.h index bebc018318f5..b9e79bc580dd 100644 --- a/arch/microblaze/include/asm/types.h +++ b/arch/microblaze/include/asm/types.h | |||
@@ -1,38 +1 @@ | |||
1 | /* | #include <asm-generic/types.h> | |
2 | * Copyright (C) Atmark Techno, Inc. | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_MICROBLAZE_TYPES_H | ||
10 | #define _ASM_MICROBLAZE_TYPES_H | ||
11 | |||
12 | /* | ||
13 | * This file is never included by application software unless | ||
14 | * explicitly requested (e.g., via linux/types.h) in which case the | ||
15 | * application is Linux specific so (user-) name space pollution is | ||
16 | * not a major issue. However, for interoperability, libraries still | ||
17 | * need to be careful to avoid a name clashes. | ||
18 | */ | ||
19 | |||
20 | #include <asm-generic/int-ll64.h> | ||
21 | |||
22 | # ifndef __ASSEMBLY__ | ||
23 | |||
24 | typedef unsigned short umode_t; | ||
25 | |||
26 | /* | ||
27 | * These aren't exported outside the kernel to avoid name space clashes | ||
28 | */ | ||
29 | # ifdef __KERNEL__ | ||
30 | # define BITS_PER_LONG 32 | ||
31 | |||
32 | /* Dma addresses are 32-bits wide. */ | ||
33 | |||
34 | typedef u32 dma_addr_t; | ||
35 | |||
36 | # endif/* __KERNEL__ */ | ||
37 | # endif /* __ASSEMBLY__ */ | ||
38 | #endif /* _ASM_MICROBLAZE_TYPES_H */ | ||
diff --git a/arch/microblaze/include/asm/ucontext.h b/arch/microblaze/include/asm/ucontext.h index 11f6bb3ae3a4..9bc07b9f30fb 100644 --- a/arch/microblaze/include/asm/ucontext.h +++ b/arch/microblaze/include/asm/ucontext.h | |||
@@ -1,22 +1 @@ | |||
1 | /* | #include <asm-generic/ucontext.h> | |
2 | * Copyright (C) 2006 Atmark Techno, Inc. | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | */ | ||
8 | |||
9 | #ifndef _ASM_MICROBLAZE_UCONTEXT_H | ||
10 | #define _ASM_MICROBLAZE_UCONTEXT_H | ||
11 | |||
12 | #include <asm/sigcontext.h> | ||
13 | |||
14 | struct ucontext { | ||
15 | unsigned long uc_flags; | ||
16 | struct ucontext *uc_link; | ||
17 | stack_t uc_stack; | ||
18 | struct sigcontext uc_mcontext; | ||
19 | sigset_t uc_sigmask; /* mask last for extensibility */ | ||
20 | }; | ||
21 | |||
22 | #endif /* _ASM_MICROBLAZE_UCONTEXT_H */ | ||
diff --git a/arch/microblaze/include/asm/unistd.h b/arch/microblaze/include/asm/unistd.h index b5e2f5fa5c53..0b852327c0e7 100644 --- a/arch/microblaze/include/asm/unistd.h +++ b/arch/microblaze/include/asm/unistd.h | |||
@@ -380,8 +380,10 @@ | |||
380 | #define __NR_accept04 362 /* new */ | 380 | #define __NR_accept04 362 /* new */ |
381 | #define __NR_preadv 363 /* new */ | 381 | #define __NR_preadv 363 /* new */ |
382 | #define __NR_pwritev 364 /* new */ | 382 | #define __NR_pwritev 364 /* new */ |
383 | #define __NR_rt_tgsigqueueinfo 365 /* new */ | ||
384 | #define __NR_perf_counter_open 366 /* new */ | ||
383 | 385 | ||
384 | #define __NR_syscalls 365 | 386 | #define __NR_syscalls 367 |
385 | 387 | ||
386 | #ifdef __KERNEL__ | 388 | #ifdef __KERNEL__ |
387 | #ifndef __ASSEMBLY__ | 389 | #ifndef __ASSEMBLY__ |
@@ -408,7 +410,7 @@ | |||
408 | #define __ARCH_WANT_SYS_SIGPENDING | 410 | #define __ARCH_WANT_SYS_SIGPENDING |
409 | #define __ARCH_WANT_SYS_SIGPROCMASK | 411 | #define __ARCH_WANT_SYS_SIGPROCMASK |
410 | #define __ARCH_WANT_SYS_RT_SIGACTION | 412 | #define __ARCH_WANT_SYS_RT_SIGACTION |
411 | /* #define __ARCH_WANT_SYS_RT_SIGSUSPEND */ | 413 | #define __ARCH_WANT_SYS_RT_SIGSUSPEND |
412 | 414 | ||
413 | /* | 415 | /* |
414 | * "Conditional" syscalls | 416 | * "Conditional" syscalls |
diff --git a/arch/microblaze/include/asm/vga.h b/arch/microblaze/include/asm/vga.h index 8b137891791f..89d82fd8fcf1 100644 --- a/arch/microblaze/include/asm/vga.h +++ b/arch/microblaze/include/asm/vga.h | |||
@@ -1 +1 @@ | |||
#include <asm-generic/vga.h> | |||
diff --git a/arch/microblaze/kernel/entry-nommu.S b/arch/microblaze/kernel/entry-nommu.S index 1fce6b803f54..9083d85376a4 100644 --- a/arch/microblaze/kernel/entry-nommu.S +++ b/arch/microblaze/kernel/entry-nommu.S | |||
@@ -551,30 +551,22 @@ no_work_pending: | |||
551 | rtid r14, 0 | 551 | rtid r14, 0 |
552 | nop | 552 | nop |
553 | 553 | ||
554 | sys_vfork_wrapper: | 554 | sys_vfork: |
555 | brid sys_vfork | 555 | brid microblaze_vfork |
556 | addk r5, r1, r0 | 556 | addk r5, r1, r0 |
557 | 557 | ||
558 | sys_clone_wrapper: | 558 | sys_clone: |
559 | brid sys_clone | 559 | brid microblaze_clone |
560 | addk r7, r1, r0 | 560 | addk r7, r1, r0 |
561 | 561 | ||
562 | sys_execve_wrapper: | 562 | sys_execve: |
563 | brid sys_execve | 563 | brid microblaze_execve |
564 | addk r8, r1, r0 | 564 | addk r8, r1, r0 |
565 | 565 | ||
566 | sys_sigreturn_wrapper: | ||
567 | brid sys_sigreturn | ||
568 | addk r5, r1, r0 | ||
569 | |||
570 | sys_rt_sigreturn_wrapper: | 566 | sys_rt_sigreturn_wrapper: |
571 | brid sys_rt_sigreturn | 567 | brid sys_rt_sigreturn |
572 | addk r5, r1, r0 | 568 | addk r5, r1, r0 |
573 | 569 | ||
574 | sys_sigsuspend_wrapper: | ||
575 | brid sys_rt_sigsuspend | ||
576 | addk r6, r1, r0 | ||
577 | |||
578 | sys_rt_sigsuspend_wrapper: | 570 | sys_rt_sigsuspend_wrapper: |
579 | brid sys_rt_sigsuspend | 571 | brid sys_rt_sigsuspend |
580 | addk r7, r1, r0 | 572 | addk r7, r1, r0 |
diff --git a/arch/microblaze/kernel/entry.S b/arch/microblaze/kernel/entry.S index 91a0e7b185dd..c7353e79f4a2 100644 --- a/arch/microblaze/kernel/entry.S +++ b/arch/microblaze/kernel/entry.S | |||
@@ -429,12 +429,11 @@ C_ENTRY(ret_from_fork): | |||
429 | brid ret_from_trap; /* Do normal trap return */ | 429 | brid ret_from_trap; /* Do normal trap return */ |
430 | nop; | 430 | nop; |
431 | 431 | ||
432 | C_ENTRY(sys_vfork_wrapper): | 432 | C_ENTRY(sys_vfork): |
433 | brid microblaze_vfork /* Do real work (tail-call) */ | ||
433 | la r5, r1, PTO | 434 | la r5, r1, PTO |
434 | brid sys_vfork /* Do real work (tail-call) */ | ||
435 | nop | ||
436 | 435 | ||
437 | C_ENTRY(sys_clone_wrapper): | 436 | C_ENTRY(sys_clone): |
438 | bnei r6, 1f; /* See if child SP arg (arg 1) is 0. */ | 437 | bnei r6, 1f; /* See if child SP arg (arg 1) is 0. */ |
439 | lwi r6, r1, PTO+PT_R1; /* If so, use paret's stack ptr */ | 438 | lwi r6, r1, PTO+PT_R1; /* If so, use paret's stack ptr */ |
440 | 1: la r7, r1, PTO; /* Arg 2: parent context */ | 439 | 1: la r7, r1, PTO; /* Arg 2: parent context */ |
@@ -444,20 +443,9 @@ C_ENTRY(sys_clone_wrapper): | |||
444 | brid do_fork /* Do real work (tail-call) */ | 443 | brid do_fork /* Do real work (tail-call) */ |
445 | nop; | 444 | nop; |
446 | 445 | ||
447 | C_ENTRY(sys_execve_wrapper): | 446 | C_ENTRY(sys_execve): |
448 | la r8, r1, PTO; /* add user context as 4th arg */ | 447 | la r8, r1, PTO; /* add user context as 4th arg */ |
449 | brid sys_execve; /* Do real work (tail-call).*/ | 448 | brid microblaze_execve; /* Do real work (tail-call).*/ |
450 | nop; | ||
451 | |||
452 | C_ENTRY(sys_sigsuspend_wrapper): | ||
453 | swi r3, r1, PTO+PT_R3; /* restore saved r3, r4 registers */ | ||
454 | swi r4, r1, PTO+PT_R4; | ||
455 | la r6, r1, PTO; /* add user context as 2nd arg */ | ||
456 | bralid r15, sys_sigsuspend; /* Do real work.*/ | ||
457 | nop; | ||
458 | lwi r3, r1, PTO+PT_R3; /* restore saved r3, r4 registers */ | ||
459 | lwi r4, r1, PTO+PT_R4; | ||
460 | bri ret_from_trap /* fall through will not work here due to align */ | ||
461 | nop; | 449 | nop; |
462 | 450 | ||
463 | C_ENTRY(sys_rt_sigsuspend_wrapper): | 451 | C_ENTRY(sys_rt_sigsuspend_wrapper): |
@@ -471,18 +459,6 @@ C_ENTRY(sys_rt_sigsuspend_wrapper): | |||
471 | bri ret_from_trap /* fall through will not work here due to align */ | 459 | bri ret_from_trap /* fall through will not work here due to align */ |
472 | nop; | 460 | nop; |
473 | 461 | ||
474 | |||
475 | C_ENTRY(sys_sigreturn_wrapper): | ||
476 | swi r3, r1, PTO+PT_R3; /* restore saved r3, r4 registers */ | ||
477 | swi r4, r1, PTO+PT_R4; | ||
478 | la r5, r1, PTO; /* add user context as 1st arg */ | ||
479 | brlid r15, sys_sigreturn; /* Do real work.*/ | ||
480 | nop; | ||
481 | lwi r3, r1, PTO+PT_R3; /* restore saved r3, r4 registers */ | ||
482 | lwi r4, r1, PTO+PT_R4; | ||
483 | bri ret_from_trap /* fall through will not work here due to align */ | ||
484 | nop; | ||
485 | |||
486 | C_ENTRY(sys_rt_sigreturn_wrapper): | 462 | C_ENTRY(sys_rt_sigreturn_wrapper): |
487 | swi r3, r1, PTO+PT_R3; /* restore saved r3, r4 registers */ | 463 | swi r3, r1, PTO+PT_R3; /* restore saved r3, r4 registers */ |
488 | swi r4, r1, PTO+PT_R4; | 464 | swi r4, r1, PTO+PT_R4; |
diff --git a/arch/microblaze/kernel/ptrace.c b/arch/microblaze/kernel/ptrace.c index b86aa623e36d..53ff39af6a5c 100644 --- a/arch/microblaze/kernel/ptrace.c +++ b/arch/microblaze/kernel/ptrace.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
28 | #include <linux/mm.h> | 28 | #include <linux/mm.h> |
29 | #include <linux/sched.h> | 29 | #include <linux/sched.h> |
30 | #include <linux/smp_lock.h> | ||
31 | #include <linux/ptrace.h> | 30 | #include <linux/ptrace.h> |
32 | #include <linux/signal.h> | 31 | #include <linux/signal.h> |
33 | 32 | ||
diff --git a/arch/microblaze/kernel/signal.c b/arch/microblaze/kernel/signal.c index 4c0e6521b114..1c80e4fc40ce 100644 --- a/arch/microblaze/kernel/signal.c +++ b/arch/microblaze/kernel/signal.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/sched.h> | 21 | #include <linux/sched.h> |
22 | #include <linux/mm.h> | 22 | #include <linux/mm.h> |
23 | #include <linux/smp.h> | 23 | #include <linux/smp.h> |
24 | #include <linux/smp_lock.h> | ||
25 | #include <linux/kernel.h> | 24 | #include <linux/kernel.h> |
26 | #include <linux/signal.h> | 25 | #include <linux/signal.h> |
27 | #include <linux/errno.h> | 26 | #include <linux/errno.h> |
@@ -45,91 +44,8 @@ | |||
45 | 44 | ||
46 | asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset, int in_sycall); | 45 | asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset, int in_sycall); |
47 | 46 | ||
48 | /* | ||
49 | * Atomically swap in the new signal mask, and wait for a signal. | ||
50 | */ | ||
51 | asmlinkage int | ||
52 | sys_sigsuspend(old_sigset_t mask, struct pt_regs *regs) | ||
53 | { | ||
54 | sigset_t saveset; | ||
55 | |||
56 | mask &= _BLOCKABLE; | ||
57 | spin_lock_irq(¤t->sighand->siglock); | ||
58 | saveset = current->blocked; | ||
59 | siginitset(¤t->blocked, mask); | ||
60 | recalc_sigpending(); | ||
61 | spin_unlock_irq(¤t->sighand->siglock); | ||
62 | |||
63 | regs->r3 = -EINTR; | ||
64 | while (1) { | ||
65 | current->state = TASK_INTERRUPTIBLE; | ||
66 | schedule(); | ||
67 | if (do_signal(regs, &saveset, 1)) | ||
68 | return -EINTR; | ||
69 | } | ||
70 | } | ||
71 | |||
72 | asmlinkage int | ||
73 | sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize, | ||
74 | struct pt_regs *regs) | ||
75 | { | ||
76 | sigset_t saveset, newset; | ||
77 | |||
78 | /* XXX: Don't preclude handling different sized sigset_t's. */ | ||
79 | if (sigsetsize != sizeof(sigset_t)) | ||
80 | return -EINVAL; | ||
81 | |||
82 | if (copy_from_user(&newset, unewset, sizeof(newset))) | ||
83 | return -EFAULT; | ||
84 | sigdelsetmask(&newset, ~_BLOCKABLE); | ||
85 | spin_lock_irq(¤t->sighand->siglock); | ||
86 | saveset = current->blocked; | ||
87 | current->blocked = newset; | ||
88 | recalc_sigpending(); | ||
89 | spin_unlock_irq(¤t->sighand->siglock); | ||
90 | |||
91 | regs->r3 = -EINTR; | ||
92 | while (1) { | ||
93 | current->state = TASK_INTERRUPTIBLE; | ||
94 | schedule(); | ||
95 | if (do_signal(regs, &saveset, 1)) | ||
96 | return -EINTR; | ||
97 | } | ||
98 | } | ||
99 | |||
100 | asmlinkage int | ||
101 | sys_sigaction(int sig, const struct old_sigaction *act, | ||
102 | struct old_sigaction *oact) | ||
103 | { | ||
104 | struct k_sigaction new_ka, old_ka; | ||
105 | int ret; | ||
106 | |||
107 | if (act) { | ||
108 | old_sigset_t mask; | ||
109 | if (!access_ok(VERIFY_READ, act, sizeof(*act)) || | ||
110 | __get_user(new_ka.sa.sa_handler, &act->sa_handler) || | ||
111 | __get_user(new_ka.sa.sa_restorer, &act->sa_restorer)) | ||
112 | return -EFAULT; | ||
113 | __get_user(new_ka.sa.sa_flags, &act->sa_flags); | ||
114 | __get_user(mask, &act->sa_mask); | ||
115 | siginitset(&new_ka.sa.sa_mask, mask); | ||
116 | } | ||
117 | 47 | ||
118 | ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL); | 48 | asmlinkage long |
119 | |||
120 | if (!ret && oact) { | ||
121 | if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) || | ||
122 | __put_user(old_ka.sa.sa_handler, &oact->sa_handler) || | ||
123 | __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer)) | ||
124 | return -EFAULT; | ||
125 | __put_user(old_ka.sa.sa_flags, &oact->sa_flags); | ||
126 | __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask); | ||
127 | } | ||
128 | |||
129 | return ret; | ||
130 | } | ||
131 | |||
132 | asmlinkage int | ||
133 | sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, | 49 | sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, |
134 | struct pt_regs *regs) | 50 | struct pt_regs *regs) |
135 | { | 51 | { |
@@ -139,7 +55,6 @@ sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, | |||
139 | /* | 55 | /* |
140 | * Do a signal return; undo the signal stack. | 56 | * Do a signal return; undo the signal stack. |
141 | */ | 57 | */ |
142 | |||
143 | struct sigframe { | 58 | struct sigframe { |
144 | struct sigcontext sc; | 59 | struct sigcontext sc; |
145 | unsigned long extramask[_NSIG_WORDS-1]; | 60 | unsigned long extramask[_NSIG_WORDS-1]; |
@@ -176,40 +91,7 @@ static int restore_sigcontext(struct pt_regs *regs, | |||
176 | return err; | 91 | return err; |
177 | } | 92 | } |
178 | 93 | ||
179 | asmlinkage int sys_sigreturn(struct pt_regs *regs) | 94 | asmlinkage long sys_rt_sigreturn(struct pt_regs *regs) |
180 | { | ||
181 | struct sigframe *frame = | ||
182 | (struct sigframe *)(regs->r1 + STATE_SAVE_ARG_SPACE); | ||
183 | |||
184 | sigset_t set; | ||
185 | int rval; | ||
186 | |||
187 | if (!access_ok(VERIFY_READ, frame, sizeof(*frame))) | ||
188 | goto badframe; | ||
189 | |||
190 | if (__get_user(set.sig[0], &frame->sc.oldmask) | ||
191 | || (_NSIG_WORDS > 1 | ||
192 | && __copy_from_user(&set.sig[1], &frame->extramask, | ||
193 | sizeof(frame->extramask)))) | ||
194 | goto badframe; | ||
195 | |||
196 | sigdelsetmask(&set, ~_BLOCKABLE); | ||
197 | |||
198 | spin_lock_irq(¤t->sighand->siglock); | ||
199 | current->blocked = set; | ||
200 | recalc_sigpending(); | ||
201 | spin_unlock_irq(¤t->sighand->siglock); | ||
202 | |||
203 | if (restore_sigcontext(regs, &frame->sc, &rval)) | ||
204 | goto badframe; | ||
205 | return rval; | ||
206 | |||
207 | badframe: | ||
208 | force_sig(SIGSEGV, current); | ||
209 | return 0; | ||
210 | } | ||
211 | |||
212 | asmlinkage int sys_rt_sigreturn(struct pt_regs *regs) | ||
213 | { | 95 | { |
214 | struct rt_sigframe __user *frame = | 96 | struct rt_sigframe __user *frame = |
215 | (struct rt_sigframe __user *)(regs->r1 + STATE_SAVE_ARG_SPACE); | 97 | (struct rt_sigframe __user *)(regs->r1 + STATE_SAVE_ARG_SPACE); |
@@ -324,21 +206,17 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, | |||
324 | /* Set up to return from userspace. If provided, use a stub | 206 | /* Set up to return from userspace. If provided, use a stub |
325 | already in userspace. */ | 207 | already in userspace. */ |
326 | /* minus 8 is offset to cater for "rtsd r15,8" */ | 208 | /* minus 8 is offset to cater for "rtsd r15,8" */ |
327 | if (ka->sa.sa_flags & SA_RESTORER) { | 209 | /* addi r12, r0, __NR_sigreturn */ |
328 | regs->r15 = ((unsigned long)ka->sa.sa_restorer)-8; | 210 | err |= __put_user(0x31800000 | __NR_rt_sigreturn , |
329 | } else { | 211 | frame->tramp + 0); |
330 | /* addi r12, r0, __NR_sigreturn */ | 212 | /* brki r14, 0x8 */ |
331 | err |= __put_user(0x31800000 | __NR_rt_sigreturn , | 213 | err |= __put_user(0xb9cc0008, frame->tramp + 1); |
332 | frame->tramp + 0); | 214 | |
333 | /* brki r14, 0x8 */ | 215 | /* Return from sighandler will jump to the tramp. |
334 | err |= __put_user(0xb9cc0008, frame->tramp + 1); | 216 | Negative 8 offset because return is rtsd r15, 8 */ |
335 | 217 | regs->r15 = ((unsigned long)frame->tramp)-8; | |
336 | /* Return from sighandler will jump to the tramp. | 218 | |
337 | Negative 8 offset because return is rtsd r15, 8 */ | 219 | __invalidate_cache_sigtramp((unsigned long)frame->tramp); |
338 | regs->r15 = ((unsigned long)frame->tramp)-8; | ||
339 | |||
340 | __invalidate_cache_sigtramp((unsigned long)frame->tramp); | ||
341 | } | ||
342 | 220 | ||
343 | if (err) | 221 | if (err) |
344 | goto give_sigsegv; | 222 | goto give_sigsegv; |
@@ -405,7 +283,7 @@ do_restart: | |||
405 | * OK, we're invoking a handler | 283 | * OK, we're invoking a handler |
406 | */ | 284 | */ |
407 | 285 | ||
408 | static void | 286 | static int |
409 | handle_signal(unsigned long sig, struct k_sigaction *ka, | 287 | handle_signal(unsigned long sig, struct k_sigaction *ka, |
410 | siginfo_t *info, sigset_t *oldset, struct pt_regs *regs) | 288 | siginfo_t *info, sigset_t *oldset, struct pt_regs *regs) |
411 | { | 289 | { |
@@ -426,6 +304,7 @@ handle_signal(unsigned long sig, struct k_sigaction *ka, | |||
426 | recalc_sigpending(); | 304 | recalc_sigpending(); |
427 | spin_unlock_irq(¤t->sighand->siglock); | 305 | spin_unlock_irq(¤t->sighand->siglock); |
428 | } | 306 | } |
307 | return 1; | ||
429 | } | 308 | } |
430 | 309 | ||
431 | /* | 310 | /* |
@@ -456,7 +335,9 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset, int in_syscall) | |||
456 | if (kernel_mode(regs)) | 335 | if (kernel_mode(regs)) |
457 | return 1; | 336 | return 1; |
458 | 337 | ||
459 | if (!oldset) | 338 | if (current_thread_info()->status & TS_RESTORE_SIGMASK) |
339 | oldset = ¤t->saved_sigmask; | ||
340 | else | ||
460 | oldset = ¤t->blocked; | 341 | oldset = ¤t->blocked; |
461 | 342 | ||
462 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); | 343 | signr = get_signal_to_deliver(&info, &ka, regs, NULL); |
@@ -464,13 +345,31 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset, int in_syscall) | |||
464 | /* Whee! Actually deliver the signal. */ | 345 | /* Whee! Actually deliver the signal. */ |
465 | if (in_syscall) | 346 | if (in_syscall) |
466 | handle_restart(regs, &ka, 1); | 347 | handle_restart(regs, &ka, 1); |
467 | handle_signal(signr, &ka, &info, oldset, regs); | 348 | if (handle_signal(signr, &ka, &info, oldset, regs)) { |
349 | /* | ||
350 | * A signal was successfully delivered; the saved | ||
351 | * sigmask will have been stored in the signal frame, | ||
352 | * and will be restored by sigreturn, so we can simply | ||
353 | * clear the TS_RESTORE_SIGMASK flag. | ||
354 | */ | ||
355 | current_thread_info()->status &= | ||
356 | ~TS_RESTORE_SIGMASK; | ||
357 | } | ||
468 | return 1; | 358 | return 1; |
469 | } | 359 | } |
470 | 360 | ||
471 | if (in_syscall) | 361 | if (in_syscall) |
472 | handle_restart(regs, NULL, 0); | 362 | handle_restart(regs, NULL, 0); |
473 | 363 | ||
364 | /* | ||
365 | * If there's no signal to deliver, we just put the saved sigmask | ||
366 | * back. | ||
367 | */ | ||
368 | if (current_thread_info()->status & TS_RESTORE_SIGMASK) { | ||
369 | current_thread_info()->status &= ~TS_RESTORE_SIGMASK; | ||
370 | sigprocmask(SIG_SETMASK, ¤t->saved_sigmask, NULL); | ||
371 | } | ||
372 | |||
474 | /* Did we come from a system call? */ | 373 | /* Did we come from a system call? */ |
475 | return 0; | 374 | return 0; |
476 | } | 375 | } |
diff --git a/arch/microblaze/kernel/sys_microblaze.c b/arch/microblaze/kernel/sys_microblaze.c index 31905ff590b7..e000bce09b2b 100644 --- a/arch/microblaze/kernel/sys_microblaze.c +++ b/arch/microblaze/kernel/sys_microblaze.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
16 | #include <linux/mm.h> | 16 | #include <linux/mm.h> |
17 | #include <linux/smp.h> | 17 | #include <linux/smp.h> |
18 | #include <linux/smp_lock.h> | ||
19 | #include <linux/syscalls.h> | 18 | #include <linux/syscalls.h> |
20 | #include <linux/sem.h> | 19 | #include <linux/sem.h> |
21 | #include <linux/msg.h> | 20 | #include <linux/msg.h> |
@@ -39,7 +38,7 @@ | |||
39 | * | 38 | * |
40 | * This is really horribly ugly. This will be remove with new toolchain. | 39 | * This is really horribly ugly. This will be remove with new toolchain. |
41 | */ | 40 | */ |
42 | asmlinkage int | 41 | asmlinkage long |
43 | sys_ipc(uint call, int first, int second, int third, void *ptr, long fifth) | 42 | sys_ipc(uint call, int first, int second, int third, void *ptr, long fifth) |
44 | { | 43 | { |
45 | int version, ret; | 44 | int version, ret; |
@@ -134,20 +133,20 @@ sys_ipc(uint call, int first, int second, int third, void *ptr, long fifth) | |||
134 | return ret; | 133 | return ret; |
135 | } | 134 | } |
136 | 135 | ||
137 | asmlinkage int sys_vfork(struct pt_regs *regs) | 136 | asmlinkage long microblaze_vfork(struct pt_regs *regs) |
138 | { | 137 | { |
139 | return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->r1, | 138 | return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->r1, |
140 | regs, 0, NULL, NULL); | 139 | regs, 0, NULL, NULL); |
141 | } | 140 | } |
142 | 141 | ||
143 | asmlinkage int sys_clone(int flags, unsigned long stack, struct pt_regs *regs) | 142 | asmlinkage long microblaze_clone(int flags, unsigned long stack, struct pt_regs *regs) |
144 | { | 143 | { |
145 | if (!stack) | 144 | if (!stack) |
146 | stack = regs->r1; | 145 | stack = regs->r1; |
147 | return do_fork(flags, stack, regs, 0, NULL, NULL); | 146 | return do_fork(flags, stack, regs, 0, NULL, NULL); |
148 | } | 147 | } |
149 | 148 | ||
150 | asmlinkage int sys_execve(char __user *filenamei, char __user *__user *argv, | 149 | asmlinkage long microblaze_execve(char __user *filenamei, char __user *__user *argv, |
151 | char __user *__user *envp, struct pt_regs *regs) | 150 | char __user *__user *envp, struct pt_regs *regs) |
152 | { | 151 | { |
153 | int error; | 152 | int error; |
@@ -163,8 +162,8 @@ out: | |||
163 | return error; | 162 | return error; |
164 | } | 163 | } |
165 | 164 | ||
166 | asmlinkage unsigned long | 165 | asmlinkage long |
167 | sys_mmap2(unsigned long addr, size_t len, | 166 | sys_mmap2(unsigned long addr, unsigned long len, |
168 | unsigned long prot, unsigned long flags, | 167 | unsigned long prot, unsigned long flags, |
169 | unsigned long fd, unsigned long pgoff) | 168 | unsigned long fd, unsigned long pgoff) |
170 | { | 169 | { |
@@ -189,18 +188,18 @@ out: | |||
189 | return ret; | 188 | return ret; |
190 | } | 189 | } |
191 | 190 | ||
192 | asmlinkage unsigned long sys_mmap(unsigned long addr, size_t len, | 191 | asmlinkage long sys_mmap(unsigned long addr, unsigned long len, |
193 | unsigned long prot, unsigned long flags, | 192 | unsigned long prot, unsigned long flags, |
194 | unsigned long fd, off_t offset) | 193 | unsigned long fd, off_t pgoff) |
195 | { | 194 | { |
196 | int err = -EINVAL; | 195 | int err = -EINVAL; |
197 | 196 | ||
198 | if (offset & ~PAGE_MASK) { | 197 | if (pgoff & ~PAGE_MASK) { |
199 | printk(KERN_INFO "no pagemask in mmap\r\n"); | 198 | printk(KERN_INFO "no pagemask in mmap\r\n"); |
200 | goto out; | 199 | goto out; |
201 | } | 200 | } |
202 | 201 | ||
203 | err = sys_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT); | 202 | err = sys_mmap2(addr, len, prot, flags, fd, pgoff >> PAGE_SHIFT); |
204 | out: | 203 | out: |
205 | return err; | 204 | return err; |
206 | } | 205 | } |
diff --git a/arch/microblaze/kernel/syscall_table.S b/arch/microblaze/kernel/syscall_table.S index 376d1789f7c0..31b32a6c5f4e 100644 --- a/arch/microblaze/kernel/syscall_table.S +++ b/arch/microblaze/kernel/syscall_table.S | |||
@@ -15,7 +15,7 @@ ENTRY(sys_call_table) | |||
15 | .long sys_creat | 15 | .long sys_creat |
16 | .long sys_link | 16 | .long sys_link |
17 | .long sys_unlink /* 10 */ | 17 | .long sys_unlink /* 10 */ |
18 | .long sys_execve_wrapper | 18 | .long sys_execve |
19 | .long sys_chdir | 19 | .long sys_chdir |
20 | .long sys_time | 20 | .long sys_time |
21 | .long sys_mknod | 21 | .long sys_mknod |
@@ -71,12 +71,12 @@ ENTRY(sys_call_table) | |||
71 | .long sys_getppid | 71 | .long sys_getppid |
72 | .long sys_getpgrp /* 65 */ | 72 | .long sys_getpgrp /* 65 */ |
73 | .long sys_setsid | 73 | .long sys_setsid |
74 | .long sys_sigaction | 74 | .long sys_ni_syscall /* sys_sigaction */ |
75 | .long sys_sgetmask | 75 | .long sys_sgetmask |
76 | .long sys_ssetmask | 76 | .long sys_ssetmask |
77 | .long sys_setreuid /* 70 */ | 77 | .long sys_setreuid /* 70 */ |
78 | .long sys_setregid | 78 | .long sys_setregid |
79 | .long sys_sigsuspend_wrapper | 79 | .long sys_ni_syscall /* sys_sigsuspend_wrapper */ |
80 | .long sys_sigpending | 80 | .long sys_sigpending |
81 | .long sys_sethostname | 81 | .long sys_sethostname |
82 | .long sys_setrlimit /* 75 */ | 82 | .long sys_setrlimit /* 75 */ |
@@ -123,8 +123,8 @@ ENTRY(sys_call_table) | |||
123 | .long sys_sysinfo | 123 | .long sys_sysinfo |
124 | .long sys_ipc | 124 | .long sys_ipc |
125 | .long sys_fsync | 125 | .long sys_fsync |
126 | .long sys_sigreturn_wrapper | 126 | .long sys_ni_syscall /* sys_sigreturn_wrapper */ |
127 | .long sys_clone_wrapper /* 120 */ | 127 | .long sys_clone /* 120 */ |
128 | .long sys_setdomainname | 128 | .long sys_setdomainname |
129 | .long sys_newuname | 129 | .long sys_newuname |
130 | .long sys_ni_syscall /* modify_ldt */ | 130 | .long sys_ni_syscall /* modify_ldt */ |
@@ -194,7 +194,7 @@ ENTRY(sys_call_table) | |||
194 | .long sys_sendfile | 194 | .long sys_sendfile |
195 | .long sys_ni_syscall /* reserved for streams1 */ | 195 | .long sys_ni_syscall /* reserved for streams1 */ |
196 | .long sys_ni_syscall /* reserved for streams2 */ | 196 | .long sys_ni_syscall /* reserved for streams2 */ |
197 | .long sys_vfork_wrapper /* 190 */ | 197 | .long sys_vfork /* 190 */ |
198 | .long sys_getrlimit | 198 | .long sys_getrlimit |
199 | .long sys_mmap2 /* mmap2 */ | 199 | .long sys_mmap2 /* mmap2 */ |
200 | .long sys_truncate64 | 200 | .long sys_truncate64 |
@@ -369,3 +369,5 @@ ENTRY(sys_call_table) | |||
369 | .long sys_ni_syscall | 369 | .long sys_ni_syscall |
370 | .long sys_ni_syscall | 370 | .long sys_ni_syscall |
371 | .long sys_ni_syscall | 371 | .long sys_ni_syscall |
372 | .long sys_rt_tgsigqueueinfo /* 365 */ | ||
373 | .long sys_perf_counter_open | ||
diff --git a/arch/microblaze/lib/Makefile b/arch/microblaze/lib/Makefile index 71c8cb6c9e43..b579db068c06 100644 --- a/arch/microblaze/lib/Makefile +++ b/arch/microblaze/lib/Makefile | |||
@@ -2,7 +2,7 @@ | |||
2 | # Makefile | 2 | # Makefile |
3 | # | 3 | # |
4 | 4 | ||
5 | lib-y := memset.o checksum.o | 5 | lib-y := memset.o |
6 | 6 | ||
7 | ifeq ($(CONFIG_OPT_LIB_ASM),y) | 7 | ifeq ($(CONFIG_OPT_LIB_ASM),y) |
8 | lib-y += fastcopy.o | 8 | lib-y += fastcopy.o |
diff --git a/arch/microblaze/lib/checksum.c b/arch/microblaze/lib/checksum.c deleted file mode 100644 index f08e74591418..000000000000 --- a/arch/microblaze/lib/checksum.c +++ /dev/null | |||
@@ -1,172 +0,0 @@ | |||
1 | /* | ||
2 | * | ||
3 | * INET An implementation of the TCP/IP protocol suite for the LINUX | ||
4 | * operating system. INET is implemented using the BSD Socket | ||
5 | * interface as the means of communication with the user level. | ||
6 | * | ||
7 | * IP/TCP/UDP checksumming routines | ||
8 | * | ||
9 | * Authors: Jorge Cwik, <jorge@laser.satlink.net> | ||
10 | * Arnt Gulbrandsen, <agulbra@nvg.unit.no> | ||
11 | * Tom May, <ftom@netcom.com> | ||
12 | * Andreas Schwab, <schwab@issan.informatik.uni-dortmund.de> | ||
13 | * Lots of code moved from tcp.c and ip.c; see those files | ||
14 | * for more names. | ||
15 | * | ||
16 | * 03/02/96 Jes Sorensen, Andreas Schwab, Roman Hodek: | ||
17 | * Fixed some nasty bugs, causing some horrible crashes. | ||
18 | * A: At some points, the sum (%0) was used as | ||
19 | * length-counter instead of the length counter | ||
20 | * (%1). Thanks to Roman Hodek for pointing this out. | ||
21 | * B: GCC seems to mess up if one uses too many | ||
22 | * data-registers to hold input values and one tries to | ||
23 | * specify d0 and d1 as scratch registers. Letting gcc | ||
24 | * choose these registers itself solves the problem. | ||
25 | * | ||
26 | * This program is free software; you can redistribute it and/or | ||
27 | * modify it under the terms of the GNU General Public License | ||
28 | * as published by the Free Software Foundation; either version | ||
29 | * 2 of the License, or (at your option) any later version. | ||
30 | */ | ||
31 | |||
32 | /* Revised by Kenneth Albanowski for m68knommu. Basic problem: unaligned access | ||
33 | kills, so most of the assembly has to go. */ | ||
34 | |||
35 | #include <linux/module.h> | ||
36 | #include <net/checksum.h> | ||
37 | |||
38 | #include <asm/byteorder.h> | ||
39 | |||
40 | static inline unsigned short from32to16(unsigned long x) | ||
41 | { | ||
42 | /* add up 16-bit and 16-bit for 16+c bit */ | ||
43 | x = (x & 0xffff) + (x >> 16); | ||
44 | /* add up carry.. */ | ||
45 | x = (x & 0xffff) + (x >> 16); | ||
46 | return x; | ||
47 | } | ||
48 | |||
49 | static unsigned int do_csum(const unsigned char *buff, int len) | ||
50 | { | ||
51 | int odd, count; | ||
52 | unsigned long result = 0; | ||
53 | |||
54 | if (len <= 0) | ||
55 | goto out; | ||
56 | odd = 1 & (unsigned long) buff; | ||
57 | if (odd) { | ||
58 | result = *buff; | ||
59 | len--; | ||
60 | buff++; | ||
61 | } | ||
62 | count = len >> 1; /* nr of 16-bit words.. */ | ||
63 | if (count) { | ||
64 | if (2 & (unsigned long) buff) { | ||
65 | result += *(unsigned short *) buff; | ||
66 | count--; | ||
67 | len -= 2; | ||
68 | buff += 2; | ||
69 | } | ||
70 | count >>= 1; /* nr of 32-bit words.. */ | ||
71 | if (count) { | ||
72 | unsigned long carry = 0; | ||
73 | do { | ||
74 | unsigned long w = *(unsigned long *) buff; | ||
75 | count--; | ||
76 | buff += 4; | ||
77 | result += carry; | ||
78 | result += w; | ||
79 | carry = (w > result); | ||
80 | } while (count); | ||
81 | result += carry; | ||
82 | result = (result & 0xffff) + (result >> 16); | ||
83 | } | ||
84 | if (len & 2) { | ||
85 | result += *(unsigned short *) buff; | ||
86 | buff += 2; | ||
87 | } | ||
88 | } | ||
89 | if (len & 1) | ||
90 | result += (*buff << 8); | ||
91 | result = from32to16(result); | ||
92 | if (odd) | ||
93 | result = ((result >> 8) & 0xff) | ((result & 0xff) << 8); | ||
94 | out: | ||
95 | return result; | ||
96 | } | ||
97 | |||
98 | /* | ||
99 | * This is a version of ip_compute_csum() optimized for IP headers, | ||
100 | * which always checksum on 4 octet boundaries. | ||
101 | */ | ||
102 | __sum16 ip_fast_csum(const void *iph, unsigned int ihl) | ||
103 | { | ||
104 | return (__force __sum16)~do_csum(iph, ihl*4); | ||
105 | } | ||
106 | EXPORT_SYMBOL(ip_fast_csum); | ||
107 | |||
108 | /* | ||
109 | * computes the checksum of a memory block at buff, length len, | ||
110 | * and adds in "sum" (32-bit) | ||
111 | * | ||
112 | * returns a 32-bit number suitable for feeding into itself | ||
113 | * or csum_tcpudp_magic | ||
114 | * | ||
115 | * this function must be called with even lengths, except | ||
116 | * for the last fragment, which may be odd | ||
117 | * | ||
118 | * it's best to have buff aligned on a 32-bit boundary | ||
119 | */ | ||
120 | __wsum csum_partial(const void *buff, int len, __wsum wsum) | ||
121 | { | ||
122 | unsigned int sum = (__force unsigned int)wsum; | ||
123 | unsigned int result = do_csum(buff, len); | ||
124 | |||
125 | /* add in old sum, and carry.. */ | ||
126 | result += sum; | ||
127 | if (sum > result) | ||
128 | result += 1; | ||
129 | return (__force __wsum)result; | ||
130 | } | ||
131 | EXPORT_SYMBOL(csum_partial); | ||
132 | |||
133 | /* | ||
134 | * this routine is used for miscellaneous IP-like checksums, mainly | ||
135 | * in icmp.c | ||
136 | */ | ||
137 | __sum16 ip_compute_csum(const void *buff, int len) | ||
138 | { | ||
139 | return (__force __sum16)~do_csum(buff, len); | ||
140 | } | ||
141 | EXPORT_SYMBOL(ip_compute_csum); | ||
142 | |||
143 | /* | ||
144 | * copy from fs while checksumming, otherwise like csum_partial | ||
145 | */ | ||
146 | __wsum | ||
147 | csum_partial_copy_from_user(const void __user *src, void *dst, int len, | ||
148 | __wsum sum, int *csum_err) | ||
149 | { | ||
150 | int missing; | ||
151 | |||
152 | missing = __copy_from_user(dst, src, len); | ||
153 | if (missing) { | ||
154 | memset(dst + len - missing, 0, missing); | ||
155 | *csum_err = -EFAULT; | ||
156 | } else | ||
157 | *csum_err = 0; | ||
158 | |||
159 | return csum_partial(dst, len, sum); | ||
160 | } | ||
161 | EXPORT_SYMBOL(csum_partial_copy_from_user); | ||
162 | |||
163 | /* | ||
164 | * copy from ds while checksumming, otherwise like csum_partial | ||
165 | */ | ||
166 | __wsum | ||
167 | csum_partial_copy(const void *src, void *dst, int len, __wsum sum) | ||
168 | { | ||
169 | memcpy(dst, src, len); | ||
170 | return csum_partial(dst, len, sum); | ||
171 | } | ||
172 | EXPORT_SYMBOL(csum_partial_copy); | ||
diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c index b5a701cd71e0..8d92c4efe9a4 100644 --- a/arch/microblaze/mm/init.c +++ b/arch/microblaze/mm/init.c | |||
@@ -80,15 +80,15 @@ void __init setup_memory(void) | |||
80 | memory_size = memory_end - memory_start; | 80 | memory_size = memory_end - memory_start; |
81 | PAGE_OFFSET = memory_start; | 81 | PAGE_OFFSET = memory_start; |
82 | printk(KERN_INFO "%s: Main mem: 0x%x-0x%x, " | 82 | printk(KERN_INFO "%s: Main mem: 0x%x-0x%x, " |
83 | "size 0x%08x\n", __func__, memory_start, | 83 | "size 0x%08x\n", __func__, (u32) memory_start, |
84 | memory_end, memory_size); | 84 | (u32) memory_end, (u32) memory_size); |
85 | break; | 85 | break; |
86 | } | 86 | } |
87 | } | 87 | } |
88 | 88 | ||
89 | if (!memory_start || !memory_end) { | 89 | if (!memory_start || !memory_end) { |
90 | panic("%s: Missing memory setting 0x%08x-0x%08x\n", | 90 | panic("%s: Missing memory setting 0x%08x-0x%08x\n", |
91 | __func__, memory_start, memory_end); | 91 | __func__, (u32) memory_start, (u32) memory_end); |
92 | } | 92 | } |
93 | 93 | ||
94 | /* reservation of region where is the kernel */ | 94 | /* reservation of region where is the kernel */ |
diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h index 143a48136a4b..f9df720d2e40 100644 --- a/arch/mips/include/asm/thread_info.h +++ b/arch/mips/include/asm/thread_info.h | |||
@@ -39,8 +39,6 @@ struct thread_info { | |||
39 | 39 | ||
40 | /* | 40 | /* |
41 | * macros/functions for gaining access to the thread information structure | 41 | * macros/functions for gaining access to the thread information structure |
42 | * | ||
43 | * preempt_count needs to be 1 initially, until the scheduler is functional. | ||
44 | */ | 42 | */ |
45 | #define INIT_THREAD_INFO(tsk) \ | 43 | #define INIT_THREAD_INFO(tsk) \ |
46 | { \ | 44 | { \ |
@@ -48,7 +46,7 @@ struct thread_info { | |||
48 | .exec_domain = &default_exec_domain, \ | 46 | .exec_domain = &default_exec_domain, \ |
49 | .flags = _TIF_FIXADE, \ | 47 | .flags = _TIF_FIXADE, \ |
50 | .cpu = 0, \ | 48 | .cpu = 0, \ |
51 | .preempt_count = 1, \ | 49 | .preempt_count = INIT_PREEMPT_COUNT, \ |
52 | .addr_limit = KERNEL_DS, \ | 50 | .addr_limit = KERNEL_DS, \ |
53 | .restart_block = { \ | 51 | .restart_block = { \ |
54 | .fn = do_no_restart_syscall, \ | 52 | .fn = do_no_restart_syscall, \ |
diff --git a/arch/mips/kernel/ptrace32.c b/arch/mips/kernel/ptrace32.c index c4f9ac17474a..32644b4a0714 100644 --- a/arch/mips/kernel/ptrace32.c +++ b/arch/mips/kernel/ptrace32.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/errno.h> | 22 | #include <linux/errno.h> |
23 | #include <linux/ptrace.h> | 23 | #include <linux/ptrace.h> |
24 | #include <linux/smp.h> | 24 | #include <linux/smp.h> |
25 | #include <linux/smp_lock.h> | ||
26 | #include <linux/user.h> | 25 | #include <linux/user.h> |
27 | #include <linux/security.h> | 26 | #include <linux/security.h> |
28 | 27 | ||
diff --git a/arch/mips/mm/hugetlbpage.c b/arch/mips/mm/hugetlbpage.c index 471c09aa1614..8c2834f5919d 100644 --- a/arch/mips/mm/hugetlbpage.c +++ b/arch/mips/mm/hugetlbpage.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/mm.h> | 16 | #include <linux/mm.h> |
17 | #include <linux/hugetlb.h> | 17 | #include <linux/hugetlb.h> |
18 | #include <linux/pagemap.h> | 18 | #include <linux/pagemap.h> |
19 | #include <linux/smp_lock.h> | ||
20 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
21 | #include <linux/err.h> | 20 | #include <linux/err.h> |
22 | #include <linux/sysctl.h> | 21 | #include <linux/sysctl.h> |
diff --git a/arch/mn10300/include/asm/pci.h b/arch/mn10300/include/asm/pci.h index e58b9a46e1b1..35d2ed6396f6 100644 --- a/arch/mn10300/include/asm/pci.h +++ b/arch/mn10300/include/asm/pci.h | |||
@@ -70,10 +70,6 @@ struct pci_dev; | |||
70 | */ | 70 | */ |
71 | #define PCI_DMA_BUS_IS_PHYS (1) | 71 | #define PCI_DMA_BUS_IS_PHYS (1) |
72 | 72 | ||
73 | |||
74 | /* This is always fine. */ | ||
75 | #define pci_dac_dma_supported(pci_dev, mask) (0) | ||
76 | |||
77 | /* Return the index of the PCI controller for device. */ | 73 | /* Return the index of the PCI controller for device. */ |
78 | static inline int pci_controller_num(struct pci_dev *dev) | 74 | static inline int pci_controller_num(struct pci_dev *dev) |
79 | { | 75 | { |
diff --git a/arch/mn10300/include/asm/thread_info.h b/arch/mn10300/include/asm/thread_info.h index 78a3881f3c12..58d64f8b2cc3 100644 --- a/arch/mn10300/include/asm/thread_info.h +++ b/arch/mn10300/include/asm/thread_info.h | |||
@@ -65,8 +65,6 @@ struct thread_info { | |||
65 | 65 | ||
66 | /* | 66 | /* |
67 | * macros/functions for gaining access to the thread information structure | 67 | * macros/functions for gaining access to the thread information structure |
68 | * | ||
69 | * preempt_count needs to be 1 initially, until the scheduler is functional. | ||
70 | */ | 68 | */ |
71 | #ifndef __ASSEMBLY__ | 69 | #ifndef __ASSEMBLY__ |
72 | 70 | ||
@@ -76,7 +74,7 @@ struct thread_info { | |||
76 | .exec_domain = &default_exec_domain, \ | 74 | .exec_domain = &default_exec_domain, \ |
77 | .flags = 0, \ | 75 | .flags = 0, \ |
78 | .cpu = 0, \ | 76 | .cpu = 0, \ |
79 | .preempt_count = 1, \ | 77 | .preempt_count = INIT_PREEMPT_COUNT, \ |
80 | .addr_limit = KERNEL_DS, \ | 78 | .addr_limit = KERNEL_DS, \ |
81 | .restart_block = { \ | 79 | .restart_block = { \ |
82 | .fn = do_no_restart_syscall, \ | 80 | .fn = do_no_restart_syscall, \ |
diff --git a/arch/mn10300/kernel/ptrace.c b/arch/mn10300/kernel/ptrace.c index e143339ad28e..cf847dabc1bd 100644 --- a/arch/mn10300/kernel/ptrace.c +++ b/arch/mn10300/kernel/ptrace.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <linux/sched.h> | 13 | #include <linux/sched.h> |
14 | #include <linux/mm.h> | 14 | #include <linux/mm.h> |
15 | #include <linux/smp.h> | 15 | #include <linux/smp.h> |
16 | #include <linux/smp_lock.h> | ||
17 | #include <linux/errno.h> | 16 | #include <linux/errno.h> |
18 | #include <linux/ptrace.h> | 17 | #include <linux/ptrace.h> |
19 | #include <linux/user.h> | 18 | #include <linux/user.h> |
diff --git a/arch/mn10300/kernel/signal.c b/arch/mn10300/kernel/signal.c index 9f7572a0f578..feb2f2e810db 100644 --- a/arch/mn10300/kernel/signal.c +++ b/arch/mn10300/kernel/signal.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
13 | #include <linux/mm.h> | 13 | #include <linux/mm.h> |
14 | #include <linux/smp.h> | 14 | #include <linux/smp.h> |
15 | #include <linux/smp_lock.h> | ||
16 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
17 | #include <linux/signal.h> | 16 | #include <linux/signal.h> |
18 | #include <linux/errno.h> | 17 | #include <linux/errno.h> |
diff --git a/arch/mn10300/kernel/sys_mn10300.c b/arch/mn10300/kernel/sys_mn10300.c index bca5a84dc72c..3e52a1054327 100644 --- a/arch/mn10300/kernel/sys_mn10300.c +++ b/arch/mn10300/kernel/sys_mn10300.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <linux/syscalls.h> | 13 | #include <linux/syscalls.h> |
14 | #include <linux/mm.h> | 14 | #include <linux/mm.h> |
15 | #include <linux/smp.h> | 15 | #include <linux/smp.h> |
16 | #include <linux/smp_lock.h> | ||
17 | #include <linux/sem.h> | 16 | #include <linux/sem.h> |
18 | #include <linux/msg.h> | 17 | #include <linux/msg.h> |
19 | #include <linux/shm.h> | 18 | #include <linux/shm.h> |
@@ -21,7 +20,6 @@ | |||
21 | #include <linux/mman.h> | 20 | #include <linux/mman.h> |
22 | #include <linux/file.h> | 21 | #include <linux/file.h> |
23 | #include <linux/utsname.h> | 22 | #include <linux/utsname.h> |
24 | #include <linux/syscalls.h> | ||
25 | #include <linux/tty.h> | 23 | #include <linux/tty.h> |
26 | 24 | ||
27 | #include <asm/uaccess.h> | 25 | #include <asm/uaccess.h> |
diff --git a/arch/mn10300/kernel/traps.c b/arch/mn10300/kernel/traps.c index 681ad8c9e4fb..91365adba4f5 100644 --- a/arch/mn10300/kernel/traps.c +++ b/arch/mn10300/kernel/traps.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/timer.h> | 17 | #include <linux/timer.h> |
18 | #include <linux/mm.h> | 18 | #include <linux/mm.h> |
19 | #include <linux/smp.h> | 19 | #include <linux/smp.h> |
20 | #include <linux/smp_lock.h> | ||
21 | #include <linux/init.h> | 20 | #include <linux/init.h> |
22 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
23 | #include <linux/spinlock.h> | 22 | #include <linux/spinlock.h> |
@@ -136,8 +135,7 @@ void show_trace(unsigned long *sp) | |||
136 | unsigned long *stack, addr, module_start, module_end; | 135 | unsigned long *stack, addr, module_start, module_end; |
137 | int i; | 136 | int i; |
138 | 137 | ||
139 | printk(KERN_EMERG "\n" | 138 | printk(KERN_EMERG "\nCall Trace:"); |
140 | KERN_EMERG "Call Trace:"); | ||
141 | 139 | ||
142 | stack = sp; | 140 | stack = sp; |
143 | i = 0; | 141 | i = 0; |
@@ -153,7 +151,7 @@ void show_trace(unsigned long *sp) | |||
153 | printk("\n"); | 151 | printk("\n"); |
154 | #else | 152 | #else |
155 | if ((i % 6) == 0) | 153 | if ((i % 6) == 0) |
156 | printk("\n" KERN_EMERG " "); | 154 | printk(KERN_EMERG " "); |
157 | printk("[<%08lx>] ", addr); | 155 | printk("[<%08lx>] ", addr); |
158 | i++; | 156 | i++; |
159 | #endif | 157 | #endif |
@@ -180,7 +178,7 @@ void show_stack(struct task_struct *task, unsigned long *sp) | |||
180 | if (((long) stack & (THREAD_SIZE - 1)) == 0) | 178 | if (((long) stack & (THREAD_SIZE - 1)) == 0) |
181 | break; | 179 | break; |
182 | if ((i % 8) == 0) | 180 | if ((i % 8) == 0) |
183 | printk("\n" KERN_EMERG " "); | 181 | printk(KERN_EMERG " "); |
184 | printk("%08lx ", *stack++); | 182 | printk("%08lx ", *stack++); |
185 | } | 183 | } |
186 | 184 | ||
@@ -264,8 +262,7 @@ void show_registers(struct pt_regs *regs) | |||
264 | show_stack(current, (unsigned long *) sp); | 262 | show_stack(current, (unsigned long *) sp); |
265 | 263 | ||
266 | #if 0 | 264 | #if 0 |
267 | printk(KERN_EMERG "\n" | 265 | printk(KERN_EMERG "\nCode: "); |
268 | KERN_EMERG "Code: "); | ||
269 | if (regs->pc < PAGE_OFFSET) | 266 | if (regs->pc < PAGE_OFFSET) |
270 | goto bad; | 267 | goto bad; |
271 | 268 | ||
@@ -311,16 +308,14 @@ void die(const char *str, struct pt_regs *regs, enum exception_code code) | |||
311 | { | 308 | { |
312 | console_verbose(); | 309 | console_verbose(); |
313 | spin_lock_irq(&die_lock); | 310 | spin_lock_irq(&die_lock); |
314 | printk(KERN_EMERG "\n" | 311 | printk(KERN_EMERG "\n%s: %04x\n", |
315 | KERN_EMERG "%s: %04x\n", | ||
316 | str, code & 0xffff); | 312 | str, code & 0xffff); |
317 | show_registers(regs); | 313 | show_registers(regs); |
318 | 314 | ||
319 | if (regs->pc >= 0x02000000 && regs->pc < 0x04000000 && | 315 | if (regs->pc >= 0x02000000 && regs->pc < 0x04000000 && |
320 | (regs->epsw & (EPSW_IM | EPSW_IE)) != (EPSW_IM | EPSW_IE)) { | 316 | (regs->epsw & (EPSW_IM | EPSW_IE)) != (EPSW_IM | EPSW_IE)) { |
321 | printk(KERN_EMERG "Exception in usermode interrupt handler\n"); | 317 | printk(KERN_EMERG "Exception in usermode interrupt handler\n"); |
322 | printk(KERN_EMERG "\n" | 318 | printk(KERN_EMERG "\nPlease connect to kernel debugger !!\n"); |
323 | KERN_EMERG " Please connect to kernel debugger !!\n"); | ||
324 | asm volatile ("0: bra 0b"); | 319 | asm volatile ("0: bra 0b"); |
325 | } | 320 | } |
326 | 321 | ||
@@ -429,9 +424,8 @@ asmlinkage void io_bus_error(u32 bcberr, u32 bcbear, struct pt_regs *regs) | |||
429 | { | 424 | { |
430 | console_verbose(); | 425 | console_verbose(); |
431 | 426 | ||
432 | printk(KERN_EMERG "\n" | 427 | printk(KERN_EMERG "Asynchronous I/O Bus Error\n"); |
433 | KERN_EMERG "Asynchronous I/O Bus Error\n" | 428 | printk(KERN_EMERG "==========================\n"); |
434 | KERN_EMERG "==========================\n"); | ||
435 | 429 | ||
436 | if (bcberr & BCBERR_BEME) | 430 | if (bcberr & BCBERR_BEME) |
437 | printk(KERN_EMERG "- Multiple recorded errors\n"); | 431 | printk(KERN_EMERG "- Multiple recorded errors\n"); |
diff --git a/arch/mn10300/mm/fault.c b/arch/mn10300/mm/fault.c index a62e1e138bc1..53bb17d0f068 100644 --- a/arch/mn10300/mm/fault.c +++ b/arch/mn10300/mm/fault.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/mman.h> | 20 | #include <linux/mman.h> |
21 | #include <linux/mm.h> | 21 | #include <linux/mm.h> |
22 | #include <linux/smp.h> | 22 | #include <linux/smp.h> |
23 | #include <linux/smp_lock.h> | ||
24 | #include <linux/interrupt.h> | 23 | #include <linux/interrupt.h> |
25 | #include <linux/init.h> | 24 | #include <linux/init.h> |
26 | #include <linux/vt_kern.h> /* For unblank_screen() */ | 25 | #include <linux/vt_kern.h> /* For unblank_screen() */ |
diff --git a/arch/mn10300/mm/misalignment.c b/arch/mn10300/mm/misalignment.c index 94c4a4358065..30016251f658 100644 --- a/arch/mn10300/mm/misalignment.c +++ b/arch/mn10300/mm/misalignment.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/timer.h> | 17 | #include <linux/timer.h> |
18 | #include <linux/mm.h> | 18 | #include <linux/mm.h> |
19 | #include <linux/smp.h> | 19 | #include <linux/smp.h> |
20 | #include <linux/smp_lock.h> | ||
21 | #include <linux/init.h> | 20 | #include <linux/init.h> |
22 | #include <linux/delay.h> | 21 | #include <linux/delay.h> |
23 | #include <linux/spinlock.h> | 22 | #include <linux/spinlock.h> |
diff --git a/arch/parisc/include/asm/thread_info.h b/arch/parisc/include/asm/thread_info.h index 0407959da489..4ce0edfbe969 100644 --- a/arch/parisc/include/asm/thread_info.h +++ b/arch/parisc/include/asm/thread_info.h | |||
@@ -23,7 +23,7 @@ struct thread_info { | |||
23 | .flags = 0, \ | 23 | .flags = 0, \ |
24 | .cpu = 0, \ | 24 | .cpu = 0, \ |
25 | .addr_limit = KERNEL_DS, \ | 25 | .addr_limit = KERNEL_DS, \ |
26 | .preempt_count = 1, \ | 26 | .preempt_count = INIT_PREEMPT_COUNT, \ |
27 | .restart_block = { \ | 27 | .restart_block = { \ |
28 | .fn = do_no_restart_syscall \ | 28 | .fn = do_no_restart_syscall \ |
29 | } \ | 29 | } \ |
diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c index 61c07078c072..1f3aa8db0203 100644 --- a/arch/parisc/kernel/process.c +++ b/arch/parisc/kernel/process.c | |||
@@ -156,7 +156,7 @@ void machine_power_off(void) | |||
156 | * software. The user has to press the button himself. */ | 156 | * software. The user has to press the button himself. */ |
157 | 157 | ||
158 | printk(KERN_EMERG "System shut down completed.\n" | 158 | printk(KERN_EMERG "System shut down completed.\n" |
159 | KERN_EMERG "Please power this system off now."); | 159 | "Please power this system off now."); |
160 | } | 160 | } |
161 | 161 | ||
162 | void (*pm_power_off)(void) = machine_power_off; | 162 | void (*pm_power_off)(void) = machine_power_off; |
diff --git a/arch/parisc/kernel/traps.c b/arch/parisc/kernel/traps.c index c32f5d6d778e..528f0ff9b273 100644 --- a/arch/parisc/kernel/traps.c +++ b/arch/parisc/kernel/traps.c | |||
@@ -250,15 +250,14 @@ void die_if_kernel(char *str, struct pt_regs *regs, long err) | |||
250 | oops_enter(); | 250 | oops_enter(); |
251 | 251 | ||
252 | /* Amuse the user in a SPARC fashion */ | 252 | /* Amuse the user in a SPARC fashion */ |
253 | if (err) printk( | 253 | if (err) printk(KERN_CRIT |
254 | KERN_CRIT " _______________________________ \n" | 254 | " _______________________________ \n" |
255 | KERN_CRIT " < Your System ate a SPARC! Gah! >\n" | 255 | " < Your System ate a SPARC! Gah! >\n" |
256 | KERN_CRIT " ------------------------------- \n" | 256 | " ------------------------------- \n" |
257 | KERN_CRIT " \\ ^__^\n" | 257 | " \\ ^__^\n" |
258 | KERN_CRIT " \\ (xx)\\_______\n" | 258 | " (__)\\ )\\/\\\n" |
259 | KERN_CRIT " (__)\\ )\\/\\\n" | 259 | " U ||----w |\n" |
260 | KERN_CRIT " U ||----w |\n" | 260 | " || ||\n"); |
261 | KERN_CRIT " || ||\n"); | ||
262 | 261 | ||
263 | /* unlock the pdc lock if necessary */ | 262 | /* unlock the pdc lock if necessary */ |
264 | pdc_emergency_unlock(); | 263 | pdc_emergency_unlock(); |
@@ -797,7 +796,8 @@ void notrace handle_interruption(int code, struct pt_regs *regs) | |||
797 | else | 796 | else |
798 | printk(KERN_DEBUG "User Fault (long pointer) (fault %d) ", | 797 | printk(KERN_DEBUG "User Fault (long pointer) (fault %d) ", |
799 | code); | 798 | code); |
800 | printk("pid=%d command='%s'\n", task_pid_nr(current), current->comm); | 799 | printk(KERN_CONT "pid=%d command='%s'\n", |
800 | task_pid_nr(current), current->comm); | ||
801 | show_regs(regs); | 801 | show_regs(regs); |
802 | #endif | 802 | #endif |
803 | si.si_signo = SIGSEGV; | 803 | si.si_signo = SIGSEGV; |
diff --git a/arch/powerpc/boot/dts/warp.dts b/arch/powerpc/boot/dts/warp.dts index 01bfb56bbe80..31605ee4afb6 100644 --- a/arch/powerpc/boot/dts/warp.dts +++ b/arch/powerpc/boot/dts/warp.dts | |||
@@ -261,10 +261,11 @@ | |||
261 | compatible = "gpio-leds"; | 261 | compatible = "gpio-leds"; |
262 | green { | 262 | green { |
263 | gpios = <&GPIO1 0 0>; | 263 | gpios = <&GPIO1 0 0>; |
264 | default-state = "on"; | 264 | default-state = "keep"; |
265 | }; | 265 | }; |
266 | red { | 266 | red { |
267 | gpios = <&GPIO1 1 0>; | 267 | gpios = <&GPIO1 1 0>; |
268 | default-state = "keep"; | ||
268 | }; | 269 | }; |
269 | }; | 270 | }; |
270 | 271 | ||
diff --git a/arch/powerpc/configs/44x/warp_defconfig b/arch/powerpc/configs/44x/warp_defconfig index 3b77f092abe1..787635f23d8f 100644 --- a/arch/powerpc/configs/44x/warp_defconfig +++ b/arch/powerpc/configs/44x/warp_defconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Linux kernel version: 2.6.29-rc2 | 3 | # Linux kernel version: 2.6.30 |
4 | # Fri Jan 23 07:57:16 2009 | 4 | # Tue Jun 9 23:35:36 2009 |
5 | # | 5 | # |
6 | # CONFIG_PPC64 is not set | 6 | # CONFIG_PPC64 is not set |
7 | 7 | ||
@@ -41,6 +41,7 @@ CONFIG_ARCH_HAS_ILOG2_U32=y | |||
41 | CONFIG_GENERIC_HWEIGHT=y | 41 | CONFIG_GENERIC_HWEIGHT=y |
42 | CONFIG_GENERIC_CALIBRATE_DELAY=y | 42 | CONFIG_GENERIC_CALIBRATE_DELAY=y |
43 | CONFIG_GENERIC_FIND_NEXT_BIT=y | 43 | CONFIG_GENERIC_FIND_NEXT_BIT=y |
44 | CONFIG_GENERIC_GPIO=y | ||
44 | # CONFIG_ARCH_NO_VIRT_TO_BUS is not set | 45 | # CONFIG_ARCH_NO_VIRT_TO_BUS is not set |
45 | CONFIG_PPC=y | 46 | CONFIG_PPC=y |
46 | CONFIG_EARLY_PRINTK=y | 47 | CONFIG_EARLY_PRINTK=y |
@@ -53,10 +54,12 @@ CONFIG_PPC_UDBG_16550=y | |||
53 | # CONFIG_GENERIC_TBSYNC is not set | 54 | # CONFIG_GENERIC_TBSYNC is not set |
54 | CONFIG_AUDIT_ARCH=y | 55 | CONFIG_AUDIT_ARCH=y |
55 | CONFIG_GENERIC_BUG=y | 56 | CONFIG_GENERIC_BUG=y |
57 | CONFIG_DTC=y | ||
56 | # CONFIG_DEFAULT_UIMAGE is not set | 58 | # CONFIG_DEFAULT_UIMAGE is not set |
57 | CONFIG_PPC_DCR_NATIVE=y | 59 | CONFIG_PPC_DCR_NATIVE=y |
58 | # CONFIG_PPC_DCR_MMIO is not set | 60 | # CONFIG_PPC_DCR_MMIO is not set |
59 | CONFIG_PPC_DCR=y | 61 | CONFIG_PPC_DCR=y |
62 | CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y | ||
60 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" | 63 | CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" |
61 | 64 | ||
62 | # | 65 | # |
@@ -74,7 +77,17 @@ CONFIG_SYSVIPC_SYSCTL=y | |||
74 | # CONFIG_BSD_PROCESS_ACCT is not set | 77 | # CONFIG_BSD_PROCESS_ACCT is not set |
75 | # CONFIG_TASKSTATS is not set | 78 | # CONFIG_TASKSTATS is not set |
76 | # CONFIG_AUDIT is not set | 79 | # CONFIG_AUDIT is not set |
77 | # CONFIG_IKCONFIG is not set | 80 | |
81 | # | ||
82 | # RCU Subsystem | ||
83 | # | ||
84 | CONFIG_CLASSIC_RCU=y | ||
85 | # CONFIG_TREE_RCU is not set | ||
86 | # CONFIG_PREEMPT_RCU is not set | ||
87 | # CONFIG_TREE_RCU_TRACE is not set | ||
88 | # CONFIG_PREEMPT_RCU_TRACE is not set | ||
89 | CONFIG_IKCONFIG=y | ||
90 | CONFIG_IKCONFIG_PROC=y | ||
78 | CONFIG_LOG_BUF_SHIFT=14 | 91 | CONFIG_LOG_BUF_SHIFT=14 |
79 | CONFIG_GROUP_SCHED=y | 92 | CONFIG_GROUP_SCHED=y |
80 | CONFIG_FAIR_GROUP_SCHED=y | 93 | CONFIG_FAIR_GROUP_SCHED=y |
@@ -82,27 +95,29 @@ CONFIG_FAIR_GROUP_SCHED=y | |||
82 | CONFIG_USER_SCHED=y | 95 | CONFIG_USER_SCHED=y |
83 | # CONFIG_CGROUP_SCHED is not set | 96 | # CONFIG_CGROUP_SCHED is not set |
84 | # CONFIG_CGROUPS is not set | 97 | # CONFIG_CGROUPS is not set |
85 | CONFIG_SYSFS_DEPRECATED=y | 98 | # CONFIG_SYSFS_DEPRECATED_V2 is not set |
86 | CONFIG_SYSFS_DEPRECATED_V2=y | ||
87 | # CONFIG_RELAY is not set | 99 | # CONFIG_RELAY is not set |
88 | # CONFIG_NAMESPACES is not set | 100 | # CONFIG_NAMESPACES is not set |
89 | CONFIG_BLK_DEV_INITRD=y | 101 | CONFIG_BLK_DEV_INITRD=y |
90 | CONFIG_INITRAMFS_SOURCE="" | 102 | CONFIG_INITRAMFS_SOURCE="" |
103 | CONFIG_RD_GZIP=y | ||
104 | # CONFIG_RD_BZIP2 is not set | ||
105 | # CONFIG_RD_LZMA is not set | ||
91 | # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set | 106 | # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set |
92 | CONFIG_SYSCTL=y | 107 | CONFIG_SYSCTL=y |
108 | CONFIG_ANON_INODES=y | ||
93 | CONFIG_EMBEDDED=y | 109 | CONFIG_EMBEDDED=y |
94 | CONFIG_SYSCTL_SYSCALL=y | 110 | CONFIG_SYSCTL_SYSCALL=y |
95 | CONFIG_KALLSYMS=y | 111 | CONFIG_KALLSYMS=y |
96 | # CONFIG_KALLSYMS_ALL is not set | 112 | # CONFIG_KALLSYMS_ALL is not set |
97 | # CONFIG_KALLSYMS_EXTRA_PASS is not set | 113 | # CONFIG_KALLSYMS_EXTRA_PASS is not set |
98 | # CONFIG_HOTPLUG is not set | 114 | # CONFIG_STRIP_ASM_SYMS is not set |
115 | CONFIG_HOTPLUG=y | ||
99 | CONFIG_PRINTK=y | 116 | CONFIG_PRINTK=y |
100 | CONFIG_BUG=y | 117 | CONFIG_BUG=y |
101 | CONFIG_ELF_CORE=y | 118 | CONFIG_ELF_CORE=y |
102 | CONFIG_COMPAT_BRK=y | ||
103 | CONFIG_BASE_FULL=y | 119 | CONFIG_BASE_FULL=y |
104 | CONFIG_FUTEX=y | 120 | CONFIG_FUTEX=y |
105 | CONFIG_ANON_INODES=y | ||
106 | CONFIG_EPOLL=y | 121 | CONFIG_EPOLL=y |
107 | CONFIG_SIGNALFD=y | 122 | CONFIG_SIGNALFD=y |
108 | CONFIG_TIMERFD=y | 123 | CONFIG_TIMERFD=y |
@@ -110,10 +125,13 @@ CONFIG_EVENTFD=y | |||
110 | CONFIG_SHMEM=y | 125 | CONFIG_SHMEM=y |
111 | CONFIG_AIO=y | 126 | CONFIG_AIO=y |
112 | CONFIG_VM_EVENT_COUNTERS=y | 127 | CONFIG_VM_EVENT_COUNTERS=y |
113 | CONFIG_SLAB=y | 128 | CONFIG_SLUB_DEBUG=y |
114 | # CONFIG_SLUB is not set | 129 | CONFIG_COMPAT_BRK=y |
130 | # CONFIG_SLAB is not set | ||
131 | CONFIG_SLUB=y | ||
115 | # CONFIG_SLOB is not set | 132 | # CONFIG_SLOB is not set |
116 | # CONFIG_PROFILING is not set | 133 | # CONFIG_PROFILING is not set |
134 | # CONFIG_MARKERS is not set | ||
117 | CONFIG_HAVE_OPROFILE=y | 135 | CONFIG_HAVE_OPROFILE=y |
118 | # CONFIG_KPROBES is not set | 136 | # CONFIG_KPROBES is not set |
119 | CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y | 137 | CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y |
@@ -121,6 +139,7 @@ CONFIG_HAVE_IOREMAP_PROT=y | |||
121 | CONFIG_HAVE_KPROBES=y | 139 | CONFIG_HAVE_KPROBES=y |
122 | CONFIG_HAVE_KRETPROBES=y | 140 | CONFIG_HAVE_KRETPROBES=y |
123 | CONFIG_HAVE_ARCH_TRACEHOOK=y | 141 | CONFIG_HAVE_ARCH_TRACEHOOK=y |
142 | # CONFIG_SLOW_WORK is not set | ||
124 | # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set | 143 | # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set |
125 | CONFIG_SLABINFO=y | 144 | CONFIG_SLABINFO=y |
126 | CONFIG_RT_MUTEXES=y | 145 | CONFIG_RT_MUTEXES=y |
@@ -133,7 +152,6 @@ CONFIG_MODULE_UNLOAD=y | |||
133 | # CONFIG_MODULE_SRCVERSION_ALL is not set | 152 | # CONFIG_MODULE_SRCVERSION_ALL is not set |
134 | CONFIG_BLOCK=y | 153 | CONFIG_BLOCK=y |
135 | # CONFIG_LBD is not set | 154 | # CONFIG_LBD is not set |
136 | # CONFIG_BLK_DEV_IO_TRACE is not set | ||
137 | # CONFIG_BLK_DEV_BSG is not set | 155 | # CONFIG_BLK_DEV_BSG is not set |
138 | # CONFIG_BLK_DEV_INTEGRITY is not set | 156 | # CONFIG_BLK_DEV_INTEGRITY is not set |
139 | 157 | ||
@@ -149,11 +167,6 @@ CONFIG_DEFAULT_AS=y | |||
149 | # CONFIG_DEFAULT_CFQ is not set | 167 | # CONFIG_DEFAULT_CFQ is not set |
150 | # CONFIG_DEFAULT_NOOP is not set | 168 | # CONFIG_DEFAULT_NOOP is not set |
151 | CONFIG_DEFAULT_IOSCHED="anticipatory" | 169 | CONFIG_DEFAULT_IOSCHED="anticipatory" |
152 | CONFIG_CLASSIC_RCU=y | ||
153 | # CONFIG_TREE_RCU is not set | ||
154 | # CONFIG_PREEMPT_RCU is not set | ||
155 | # CONFIG_TREE_RCU_TRACE is not set | ||
156 | # CONFIG_PREEMPT_RCU_TRACE is not set | ||
157 | # CONFIG_FREEZER is not set | 170 | # CONFIG_FREEZER is not set |
158 | 171 | ||
159 | # | 172 | # |
@@ -173,10 +186,11 @@ CONFIG_WARP=y | |||
173 | # CONFIG_ARCHES is not set | 186 | # CONFIG_ARCHES is not set |
174 | # CONFIG_CANYONLANDS is not set | 187 | # CONFIG_CANYONLANDS is not set |
175 | # CONFIG_GLACIER is not set | 188 | # CONFIG_GLACIER is not set |
189 | # CONFIG_REDWOOD is not set | ||
176 | # CONFIG_YOSEMITE is not set | 190 | # CONFIG_YOSEMITE is not set |
177 | # CONFIG_XILINX_VIRTEX440_GENERIC_BOARD is not set | 191 | # CONFIG_XILINX_VIRTEX440_GENERIC_BOARD is not set |
178 | # CONFIG_PPC44x_SIMPLE is not set | 192 | # CONFIG_PPC44x_SIMPLE is not set |
179 | # CONFIG_PPC4xx_GPIO is not set | 193 | CONFIG_PPC4xx_GPIO=y |
180 | CONFIG_440EP=y | 194 | CONFIG_440EP=y |
181 | CONFIG_IBM440EP_ERR42=y | 195 | CONFIG_IBM440EP_ERR42=y |
182 | # CONFIG_IPIC is not set | 196 | # CONFIG_IPIC is not set |
@@ -235,9 +249,13 @@ CONFIG_ZONE_DMA_FLAG=1 | |||
235 | CONFIG_BOUNCE=y | 249 | CONFIG_BOUNCE=y |
236 | CONFIG_VIRT_TO_BUS=y | 250 | CONFIG_VIRT_TO_BUS=y |
237 | CONFIG_UNEVICTABLE_LRU=y | 251 | CONFIG_UNEVICTABLE_LRU=y |
252 | CONFIG_HAVE_MLOCK=y | ||
253 | CONFIG_HAVE_MLOCKED_PAGE_BIT=y | ||
254 | CONFIG_STDBINUTILS=y | ||
238 | CONFIG_PPC_4K_PAGES=y | 255 | CONFIG_PPC_4K_PAGES=y |
239 | # CONFIG_PPC_16K_PAGES is not set | 256 | # CONFIG_PPC_16K_PAGES is not set |
240 | # CONFIG_PPC_64K_PAGES is not set | 257 | # CONFIG_PPC_64K_PAGES is not set |
258 | # CONFIG_PPC_256K_PAGES is not set | ||
241 | CONFIG_FORCE_MAX_ZONEORDER=11 | 259 | CONFIG_FORCE_MAX_ZONEORDER=11 |
242 | CONFIG_PROC_DEVICETREE=y | 260 | CONFIG_PROC_DEVICETREE=y |
243 | CONFIG_CMDLINE_BOOL=y | 261 | CONFIG_CMDLINE_BOOL=y |
@@ -256,6 +274,7 @@ CONFIG_PPC_PCI_CHOICE=y | |||
256 | # CONFIG_PCI_DOMAINS is not set | 274 | # CONFIG_PCI_DOMAINS is not set |
257 | # CONFIG_PCI_SYSCALL is not set | 275 | # CONFIG_PCI_SYSCALL is not set |
258 | # CONFIG_ARCH_SUPPORTS_MSI is not set | 276 | # CONFIG_ARCH_SUPPORTS_MSI is not set |
277 | # CONFIG_PCCARD is not set | ||
259 | # CONFIG_HAS_RAPIDIO is not set | 278 | # CONFIG_HAS_RAPIDIO is not set |
260 | 279 | ||
261 | # | 280 | # |
@@ -271,14 +290,12 @@ CONFIG_PAGE_OFFSET=0xc0000000 | |||
271 | CONFIG_KERNEL_START=0xc0000000 | 290 | CONFIG_KERNEL_START=0xc0000000 |
272 | CONFIG_PHYSICAL_START=0x00000000 | 291 | CONFIG_PHYSICAL_START=0x00000000 |
273 | CONFIG_TASK_SIZE=0xc0000000 | 292 | CONFIG_TASK_SIZE=0xc0000000 |
274 | CONFIG_CONSISTENT_START=0xff100000 | ||
275 | CONFIG_CONSISTENT_SIZE=0x00200000 | 293 | CONFIG_CONSISTENT_SIZE=0x00200000 |
276 | CONFIG_NET=y | 294 | CONFIG_NET=y |
277 | 295 | ||
278 | # | 296 | # |
279 | # Networking options | 297 | # Networking options |
280 | # | 298 | # |
281 | CONFIG_COMPAT_NET_DEV_OPS=y | ||
282 | CONFIG_PACKET=y | 299 | CONFIG_PACKET=y |
283 | # CONFIG_PACKET_MMAP is not set | 300 | # CONFIG_PACKET_MMAP is not set |
284 | CONFIG_UNIX=y | 301 | CONFIG_UNIX=y |
@@ -353,6 +370,7 @@ CONFIG_VLAN_8021Q=y | |||
353 | # CONFIG_LAPB is not set | 370 | # CONFIG_LAPB is not set |
354 | # CONFIG_ECONET is not set | 371 | # CONFIG_ECONET is not set |
355 | # CONFIG_WAN_ROUTER is not set | 372 | # CONFIG_WAN_ROUTER is not set |
373 | # CONFIG_PHONET is not set | ||
356 | # CONFIG_NET_SCHED is not set | 374 | # CONFIG_NET_SCHED is not set |
357 | # CONFIG_DCB is not set | 375 | # CONFIG_DCB is not set |
358 | 376 | ||
@@ -365,7 +383,6 @@ CONFIG_VLAN_8021Q=y | |||
365 | # CONFIG_IRDA is not set | 383 | # CONFIG_IRDA is not set |
366 | # CONFIG_BT is not set | 384 | # CONFIG_BT is not set |
367 | # CONFIG_AF_RXRPC is not set | 385 | # CONFIG_AF_RXRPC is not set |
368 | # CONFIG_PHONET is not set | ||
369 | # CONFIG_WIRELESS is not set | 386 | # CONFIG_WIRELESS is not set |
370 | # CONFIG_WIMAX is not set | 387 | # CONFIG_WIMAX is not set |
371 | # CONFIG_RFKILL is not set | 388 | # CONFIG_RFKILL is not set |
@@ -378,8 +395,12 @@ CONFIG_VLAN_8021Q=y | |||
378 | # | 395 | # |
379 | # Generic Driver Options | 396 | # Generic Driver Options |
380 | # | 397 | # |
398 | CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" | ||
381 | # CONFIG_STANDALONE is not set | 399 | # CONFIG_STANDALONE is not set |
382 | CONFIG_PREVENT_FIRMWARE_BUILD=y | 400 | CONFIG_PREVENT_FIRMWARE_BUILD=y |
401 | CONFIG_FW_LOADER=y | ||
402 | # CONFIG_FIRMWARE_IN_KERNEL is not set | ||
403 | CONFIG_EXTRA_FIRMWARE="" | ||
383 | # CONFIG_DEBUG_DRIVER is not set | 404 | # CONFIG_DEBUG_DRIVER is not set |
384 | # CONFIG_DEBUG_DEVRES is not set | 405 | # CONFIG_DEBUG_DEVRES is not set |
385 | # CONFIG_SYS_HYPERVISOR is not set | 406 | # CONFIG_SYS_HYPERVISOR is not set |
@@ -471,13 +492,21 @@ CONFIG_MTD_NAND_NDFC=y | |||
471 | # LPDDR flash memory drivers | 492 | # LPDDR flash memory drivers |
472 | # | 493 | # |
473 | # CONFIG_MTD_LPDDR is not set | 494 | # CONFIG_MTD_LPDDR is not set |
474 | # CONFIG_MTD_QINFO_PROBE is not set | ||
475 | 495 | ||
476 | # | 496 | # |
477 | # UBI - Unsorted block images | 497 | # UBI - Unsorted block images |
478 | # | 498 | # |
479 | # CONFIG_MTD_UBI is not set | 499 | CONFIG_MTD_UBI=y |
500 | CONFIG_MTD_UBI_WL_THRESHOLD=4096 | ||
501 | CONFIG_MTD_UBI_BEB_RESERVE=1 | ||
502 | # CONFIG_MTD_UBI_GLUEBI is not set | ||
503 | |||
504 | # | ||
505 | # UBI debugging options | ||
506 | # | ||
507 | # CONFIG_MTD_UBI_DEBUG is not set | ||
480 | CONFIG_OF_DEVICE=y | 508 | CONFIG_OF_DEVICE=y |
509 | CONFIG_OF_GPIO=y | ||
481 | CONFIG_OF_I2C=y | 510 | CONFIG_OF_I2C=y |
482 | # CONFIG_PARPORT is not set | 511 | # CONFIG_PARPORT is not set |
483 | CONFIG_BLK_DEV=y | 512 | CONFIG_BLK_DEV=y |
@@ -495,10 +524,17 @@ CONFIG_BLK_DEV_RAM_SIZE=4096 | |||
495 | # CONFIG_XILINX_SYSACE is not set | 524 | # CONFIG_XILINX_SYSACE is not set |
496 | # CONFIG_BLK_DEV_HD is not set | 525 | # CONFIG_BLK_DEV_HD is not set |
497 | CONFIG_MISC_DEVICES=y | 526 | CONFIG_MISC_DEVICES=y |
498 | # CONFIG_EEPROM_93CX6 is not set | ||
499 | # CONFIG_ICS932S401 is not set | 527 | # CONFIG_ICS932S401 is not set |
500 | # CONFIG_ENCLOSURE_SERVICES is not set | 528 | # CONFIG_ENCLOSURE_SERVICES is not set |
529 | # CONFIG_ISL29003 is not set | ||
501 | # CONFIG_C2PORT is not set | 530 | # CONFIG_C2PORT is not set |
531 | |||
532 | # | ||
533 | # EEPROM support | ||
534 | # | ||
535 | CONFIG_EEPROM_AT24=y | ||
536 | # CONFIG_EEPROM_LEGACY is not set | ||
537 | # CONFIG_EEPROM_93CX6 is not set | ||
502 | CONFIG_HAVE_IDE=y | 538 | CONFIG_HAVE_IDE=y |
503 | # CONFIG_IDE is not set | 539 | # CONFIG_IDE is not set |
504 | 540 | ||
@@ -529,7 +565,7 @@ CONFIG_BLK_DEV_SD=y | |||
529 | # CONFIG_SCSI_CONSTANTS is not set | 565 | # CONFIG_SCSI_CONSTANTS is not set |
530 | # CONFIG_SCSI_LOGGING is not set | 566 | # CONFIG_SCSI_LOGGING is not set |
531 | # CONFIG_SCSI_SCAN_ASYNC is not set | 567 | # CONFIG_SCSI_SCAN_ASYNC is not set |
532 | CONFIG_SCSI_WAIT_SCAN=m | 568 | # CONFIG_SCSI_WAIT_SCAN is not set |
533 | 569 | ||
534 | # | 570 | # |
535 | # SCSI Transports | 571 | # SCSI Transports |
@@ -541,10 +577,12 @@ CONFIG_SCSI_SPI_ATTRS=y | |||
541 | # CONFIG_SCSI_SRP_ATTRS is not set | 577 | # CONFIG_SCSI_SRP_ATTRS is not set |
542 | # CONFIG_SCSI_LOWLEVEL is not set | 578 | # CONFIG_SCSI_LOWLEVEL is not set |
543 | # CONFIG_SCSI_DH is not set | 579 | # CONFIG_SCSI_DH is not set |
580 | # CONFIG_SCSI_OSD_INITIATOR is not set | ||
544 | # CONFIG_ATA is not set | 581 | # CONFIG_ATA is not set |
545 | # CONFIG_MD is not set | 582 | # CONFIG_MD is not set |
546 | # CONFIG_MACINTOSH_DRIVERS is not set | 583 | # CONFIG_MACINTOSH_DRIVERS is not set |
547 | CONFIG_NETDEVICES=y | 584 | CONFIG_NETDEVICES=y |
585 | CONFIG_COMPAT_NET_DEV_OPS=y | ||
548 | # CONFIG_DUMMY is not set | 586 | # CONFIG_DUMMY is not set |
549 | # CONFIG_BONDING is not set | 587 | # CONFIG_BONDING is not set |
550 | # CONFIG_MACVLAN is not set | 588 | # CONFIG_MACVLAN is not set |
@@ -554,6 +592,8 @@ CONFIG_NETDEVICES=y | |||
554 | # CONFIG_PHYLIB is not set | 592 | # CONFIG_PHYLIB is not set |
555 | CONFIG_NET_ETHERNET=y | 593 | CONFIG_NET_ETHERNET=y |
556 | CONFIG_MII=y | 594 | CONFIG_MII=y |
595 | # CONFIG_ETHOC is not set | ||
596 | # CONFIG_DNET is not set | ||
557 | CONFIG_IBM_NEW_EMAC=y | 597 | CONFIG_IBM_NEW_EMAC=y |
558 | CONFIG_IBM_NEW_EMAC_RXB=128 | 598 | CONFIG_IBM_NEW_EMAC_RXB=128 |
559 | CONFIG_IBM_NEW_EMAC_TXB=64 | 599 | CONFIG_IBM_NEW_EMAC_TXB=64 |
@@ -577,7 +617,6 @@ CONFIG_IBM_NEW_EMAC_ZMII=y | |||
577 | # | 617 | # |
578 | # CONFIG_WLAN_PRE80211 is not set | 618 | # CONFIG_WLAN_PRE80211 is not set |
579 | # CONFIG_WLAN_80211 is not set | 619 | # CONFIG_WLAN_80211 is not set |
580 | # CONFIG_IWLWIFI_LEDS is not set | ||
581 | 620 | ||
582 | # | 621 | # |
583 | # Enable WiMAX (Networking options) to see the WiMAX drivers | 622 | # Enable WiMAX (Networking options) to see the WiMAX drivers |
@@ -646,6 +685,7 @@ CONFIG_LEGACY_PTY_COUNT=256 | |||
646 | # CONFIG_HVC_UDBG is not set | 685 | # CONFIG_HVC_UDBG is not set |
647 | # CONFIG_IPMI_HANDLER is not set | 686 | # CONFIG_IPMI_HANDLER is not set |
648 | CONFIG_HW_RANDOM=y | 687 | CONFIG_HW_RANDOM=y |
688 | # CONFIG_HW_RANDOM_TIMERIOMEM is not set | ||
649 | # CONFIG_NVRAM is not set | 689 | # CONFIG_NVRAM is not set |
650 | # CONFIG_GEN_RTC is not set | 690 | # CONFIG_GEN_RTC is not set |
651 | # CONFIG_R3964 is not set | 691 | # CONFIG_R3964 is not set |
@@ -663,6 +703,7 @@ CONFIG_I2C_HELPER_AUTO=y | |||
663 | # | 703 | # |
664 | # I2C system bus drivers (mostly embedded / system-on-chip) | 704 | # I2C system bus drivers (mostly embedded / system-on-chip) |
665 | # | 705 | # |
706 | # CONFIG_I2C_GPIO is not set | ||
666 | CONFIG_I2C_IBM_IIC=y | 707 | CONFIG_I2C_IBM_IIC=y |
667 | # CONFIG_I2C_MPC is not set | 708 | # CONFIG_I2C_MPC is not set |
668 | # CONFIG_I2C_OCORES is not set | 709 | # CONFIG_I2C_OCORES is not set |
@@ -685,12 +726,9 @@ CONFIG_I2C_IBM_IIC=y | |||
685 | # Miscellaneous I2C Chip support | 726 | # Miscellaneous I2C Chip support |
686 | # | 727 | # |
687 | # CONFIG_DS1682 is not set | 728 | # CONFIG_DS1682 is not set |
688 | CONFIG_EEPROM_AT24=y | ||
689 | CONFIG_EEPROM_LEGACY=y | ||
690 | # CONFIG_SENSORS_PCF8574 is not set | 729 | # CONFIG_SENSORS_PCF8574 is not set |
691 | # CONFIG_PCF8575 is not set | 730 | # CONFIG_PCF8575 is not set |
692 | # CONFIG_SENSORS_PCA9539 is not set | 731 | # CONFIG_SENSORS_PCA9539 is not set |
693 | # CONFIG_SENSORS_PCF8591 is not set | ||
694 | # CONFIG_SENSORS_MAX6875 is not set | 732 | # CONFIG_SENSORS_MAX6875 is not set |
695 | # CONFIG_SENSORS_TSL2550 is not set | 733 | # CONFIG_SENSORS_TSL2550 is not set |
696 | # CONFIG_I2C_DEBUG_CORE is not set | 734 | # CONFIG_I2C_DEBUG_CORE is not set |
@@ -699,7 +737,30 @@ CONFIG_EEPROM_LEGACY=y | |||
699 | # CONFIG_I2C_DEBUG_CHIP is not set | 737 | # CONFIG_I2C_DEBUG_CHIP is not set |
700 | # CONFIG_SPI is not set | 738 | # CONFIG_SPI is not set |
701 | CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y | 739 | CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y |
702 | # CONFIG_GPIOLIB is not set | 740 | CONFIG_ARCH_REQUIRE_GPIOLIB=y |
741 | CONFIG_GPIOLIB=y | ||
742 | # CONFIG_DEBUG_GPIO is not set | ||
743 | CONFIG_GPIO_SYSFS=y | ||
744 | |||
745 | # | ||
746 | # Memory mapped GPIO expanders: | ||
747 | # | ||
748 | # CONFIG_GPIO_XILINX is not set | ||
749 | |||
750 | # | ||
751 | # I2C GPIO expanders: | ||
752 | # | ||
753 | # CONFIG_GPIO_MAX732X is not set | ||
754 | # CONFIG_GPIO_PCA953X is not set | ||
755 | # CONFIG_GPIO_PCF857X is not set | ||
756 | |||
757 | # | ||
758 | # PCI GPIO expanders: | ||
759 | # | ||
760 | |||
761 | # | ||
762 | # SPI GPIO expanders: | ||
763 | # | ||
703 | # CONFIG_W1 is not set | 764 | # CONFIG_W1 is not set |
704 | # CONFIG_POWER_SUPPLY is not set | 765 | # CONFIG_POWER_SUPPLY is not set |
705 | CONFIG_HWMON=y | 766 | CONFIG_HWMON=y |
@@ -721,6 +782,7 @@ CONFIG_SENSORS_AD7414=y | |||
721 | # CONFIG_SENSORS_F71805F is not set | 782 | # CONFIG_SENSORS_F71805F is not set |
722 | # CONFIG_SENSORS_F71882FG is not set | 783 | # CONFIG_SENSORS_F71882FG is not set |
723 | # CONFIG_SENSORS_F75375S is not set | 784 | # CONFIG_SENSORS_F75375S is not set |
785 | # CONFIG_SENSORS_G760A is not set | ||
724 | # CONFIG_SENSORS_GL518SM is not set | 786 | # CONFIG_SENSORS_GL518SM is not set |
725 | # CONFIG_SENSORS_GL520SM is not set | 787 | # CONFIG_SENSORS_GL520SM is not set |
726 | # CONFIG_SENSORS_IT87 is not set | 788 | # CONFIG_SENSORS_IT87 is not set |
@@ -735,11 +797,15 @@ CONFIG_SENSORS_AD7414=y | |||
735 | # CONFIG_SENSORS_LM90 is not set | 797 | # CONFIG_SENSORS_LM90 is not set |
736 | # CONFIG_SENSORS_LM92 is not set | 798 | # CONFIG_SENSORS_LM92 is not set |
737 | # CONFIG_SENSORS_LM93 is not set | 799 | # CONFIG_SENSORS_LM93 is not set |
800 | # CONFIG_SENSORS_LTC4215 is not set | ||
738 | # CONFIG_SENSORS_LTC4245 is not set | 801 | # CONFIG_SENSORS_LTC4245 is not set |
802 | # CONFIG_SENSORS_LM95241 is not set | ||
739 | # CONFIG_SENSORS_MAX1619 is not set | 803 | # CONFIG_SENSORS_MAX1619 is not set |
740 | # CONFIG_SENSORS_MAX6650 is not set | 804 | # CONFIG_SENSORS_MAX6650 is not set |
741 | # CONFIG_SENSORS_PC87360 is not set | 805 | # CONFIG_SENSORS_PC87360 is not set |
742 | # CONFIG_SENSORS_PC87427 is not set | 806 | # CONFIG_SENSORS_PC87427 is not set |
807 | # CONFIG_SENSORS_PCF8591 is not set | ||
808 | # CONFIG_SENSORS_SHT15 is not set | ||
743 | # CONFIG_SENSORS_DME1737 is not set | 809 | # CONFIG_SENSORS_DME1737 is not set |
744 | # CONFIG_SENSORS_SMSC47M1 is not set | 810 | # CONFIG_SENSORS_SMSC47M1 is not set |
745 | # CONFIG_SENSORS_SMSC47M192 is not set | 811 | # CONFIG_SENSORS_SMSC47M192 is not set |
@@ -785,6 +851,7 @@ CONFIG_SSB_POSSIBLE=y | |||
785 | # CONFIG_MFD_CORE is not set | 851 | # CONFIG_MFD_CORE is not set |
786 | # CONFIG_MFD_SM501 is not set | 852 | # CONFIG_MFD_SM501 is not set |
787 | # CONFIG_HTC_PASIC3 is not set | 853 | # CONFIG_HTC_PASIC3 is not set |
854 | # CONFIG_TPS65010 is not set | ||
788 | # CONFIG_TWL4030_CORE is not set | 855 | # CONFIG_TWL4030_CORE is not set |
789 | # CONFIG_MFD_TMIO is not set | 856 | # CONFIG_MFD_TMIO is not set |
790 | # CONFIG_PMIC_DA903X is not set | 857 | # CONFIG_PMIC_DA903X is not set |
@@ -870,11 +937,11 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y | |||
870 | # CONFIG_USB_TMC is not set | 937 | # CONFIG_USB_TMC is not set |
871 | 938 | ||
872 | # | 939 | # |
873 | # NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed; | 940 | # NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may |
874 | # | 941 | # |
875 | 942 | ||
876 | # | 943 | # |
877 | # see USB_STORAGE Help for more information | 944 | # also be needed; see USB_STORAGE Help for more info |
878 | # | 945 | # |
879 | CONFIG_USB_STORAGE=y | 946 | CONFIG_USB_STORAGE=y |
880 | # CONFIG_USB_STORAGE_DEBUG is not set | 947 | # CONFIG_USB_STORAGE_DEBUG is not set |
@@ -915,7 +982,6 @@ CONFIG_USB_STORAGE=y | |||
915 | # CONFIG_USB_LED is not set | 982 | # CONFIG_USB_LED is not set |
916 | # CONFIG_USB_CYPRESS_CY7C63 is not set | 983 | # CONFIG_USB_CYPRESS_CY7C63 is not set |
917 | # CONFIG_USB_CYTHERM is not set | 984 | # CONFIG_USB_CYTHERM is not set |
918 | # CONFIG_USB_PHIDGET is not set | ||
919 | # CONFIG_USB_IDMOUSE is not set | 985 | # CONFIG_USB_IDMOUSE is not set |
920 | # CONFIG_USB_FTDI_ELAN is not set | 986 | # CONFIG_USB_FTDI_ELAN is not set |
921 | # CONFIG_USB_APPLEDISPLAY is not set | 987 | # CONFIG_USB_APPLEDISPLAY is not set |
@@ -929,6 +995,8 @@ CONFIG_USB_STORAGE=y | |||
929 | # | 995 | # |
930 | # OTG and related infrastructure | 996 | # OTG and related infrastructure |
931 | # | 997 | # |
998 | # CONFIG_USB_GPIO_VBUS is not set | ||
999 | # CONFIG_NOP_USB_XCEIV is not set | ||
932 | CONFIG_MMC=y | 1000 | CONFIG_MMC=y |
933 | # CONFIG_MMC_DEBUG is not set | 1001 | # CONFIG_MMC_DEBUG is not set |
934 | # CONFIG_MMC_UNSAFE_RESUME is not set | 1002 | # CONFIG_MMC_UNSAFE_RESUME is not set |
@@ -946,6 +1014,7 @@ CONFIG_MMC_BLOCK_BOUNCE=y | |||
946 | # | 1014 | # |
947 | # CONFIG_MMC_SDHCI is not set | 1015 | # CONFIG_MMC_SDHCI is not set |
948 | # CONFIG_MMC_WBSD is not set | 1016 | # CONFIG_MMC_WBSD is not set |
1017 | CONFIG_MMC_PIKASD=y | ||
949 | # CONFIG_MEMSTICK is not set | 1018 | # CONFIG_MEMSTICK is not set |
950 | CONFIG_NEW_LEDS=y | 1019 | CONFIG_NEW_LEDS=y |
951 | CONFIG_LEDS_CLASS=y | 1020 | CONFIG_LEDS_CLASS=y |
@@ -953,16 +1022,31 @@ CONFIG_LEDS_CLASS=y | |||
953 | # | 1022 | # |
954 | # LED drivers | 1023 | # LED drivers |
955 | # | 1024 | # |
1025 | CONFIG_LEDS_GPIO=y | ||
1026 | # CONFIG_LEDS_GPIO_PLATFORM is not set | ||
1027 | CONFIG_LEDS_GPIO_OF=y | ||
1028 | # CONFIG_LEDS_LP5521 is not set | ||
956 | # CONFIG_LEDS_PCA955X is not set | 1029 | # CONFIG_LEDS_PCA955X is not set |
1030 | # CONFIG_LEDS_BD2802 is not set | ||
957 | 1031 | ||
958 | # | 1032 | # |
959 | # LED Triggers | 1033 | # LED Triggers |
960 | # | 1034 | # |
961 | # CONFIG_LEDS_TRIGGERS is not set | 1035 | CONFIG_LEDS_TRIGGERS=y |
1036 | # CONFIG_LEDS_TRIGGER_TIMER is not set | ||
1037 | # CONFIG_LEDS_TRIGGER_HEARTBEAT is not set | ||
1038 | # CONFIG_LEDS_TRIGGER_BACKLIGHT is not set | ||
1039 | # CONFIG_LEDS_TRIGGER_GPIO is not set | ||
1040 | CONFIG_LEDS_TRIGGER_DEFAULT_ON=y | ||
1041 | |||
1042 | # | ||
1043 | # iptables trigger is under Netfilter config (LED target) | ||
1044 | # | ||
962 | # CONFIG_ACCESSIBILITY is not set | 1045 | # CONFIG_ACCESSIBILITY is not set |
963 | # CONFIG_EDAC is not set | 1046 | # CONFIG_EDAC is not set |
964 | # CONFIG_RTC_CLASS is not set | 1047 | # CONFIG_RTC_CLASS is not set |
965 | # CONFIG_DMADEVICES is not set | 1048 | # CONFIG_DMADEVICES is not set |
1049 | # CONFIG_AUXDISPLAY is not set | ||
966 | # CONFIG_UIO is not set | 1050 | # CONFIG_UIO is not set |
967 | # CONFIG_STAGING is not set | 1051 | # CONFIG_STAGING is not set |
968 | 1052 | ||
@@ -973,6 +1057,7 @@ CONFIG_EXT2_FS=y | |||
973 | # CONFIG_EXT2_FS_XATTR is not set | 1057 | # CONFIG_EXT2_FS_XATTR is not set |
974 | # CONFIG_EXT2_FS_XIP is not set | 1058 | # CONFIG_EXT2_FS_XIP is not set |
975 | CONFIG_EXT3_FS=y | 1059 | CONFIG_EXT3_FS=y |
1060 | # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set | ||
976 | # CONFIG_EXT3_FS_XATTR is not set | 1061 | # CONFIG_EXT3_FS_XATTR is not set |
977 | # CONFIG_EXT4_FS is not set | 1062 | # CONFIG_EXT4_FS is not set |
978 | CONFIG_JBD=y | 1063 | CONFIG_JBD=y |
@@ -993,6 +1078,11 @@ CONFIG_INOTIFY_USER=y | |||
993 | # CONFIG_FUSE_FS is not set | 1078 | # CONFIG_FUSE_FS is not set |
994 | 1079 | ||
995 | # | 1080 | # |
1081 | # Caches | ||
1082 | # | ||
1083 | # CONFIG_FSCACHE is not set | ||
1084 | |||
1085 | # | ||
996 | # CD-ROM/DVD Filesystems | 1086 | # CD-ROM/DVD Filesystems |
997 | # | 1087 | # |
998 | # CONFIG_ISO9660_FS is not set | 1088 | # CONFIG_ISO9660_FS is not set |
@@ -1039,6 +1129,12 @@ CONFIG_JFFS2_ZLIB=y | |||
1039 | # CONFIG_JFFS2_LZO is not set | 1129 | # CONFIG_JFFS2_LZO is not set |
1040 | CONFIG_JFFS2_RTIME=y | 1130 | CONFIG_JFFS2_RTIME=y |
1041 | # CONFIG_JFFS2_RUBIN is not set | 1131 | # CONFIG_JFFS2_RUBIN is not set |
1132 | CONFIG_UBIFS_FS=y | ||
1133 | # CONFIG_UBIFS_FS_XATTR is not set | ||
1134 | # CONFIG_UBIFS_FS_ADVANCED_COMPR is not set | ||
1135 | CONFIG_UBIFS_FS_LZO=y | ||
1136 | CONFIG_UBIFS_FS_ZLIB=y | ||
1137 | # CONFIG_UBIFS_FS_DEBUG is not set | ||
1042 | CONFIG_CRAMFS=y | 1138 | CONFIG_CRAMFS=y |
1043 | # CONFIG_SQUASHFS is not set | 1139 | # CONFIG_SQUASHFS is not set |
1044 | # CONFIG_VXFS_FS is not set | 1140 | # CONFIG_VXFS_FS is not set |
@@ -1049,6 +1145,7 @@ CONFIG_CRAMFS=y | |||
1049 | # CONFIG_ROMFS_FS is not set | 1145 | # CONFIG_ROMFS_FS is not set |
1050 | # CONFIG_SYSV_FS is not set | 1146 | # CONFIG_SYSV_FS is not set |
1051 | # CONFIG_UFS_FS is not set | 1147 | # CONFIG_UFS_FS is not set |
1148 | # CONFIG_NILFS2_FS is not set | ||
1052 | CONFIG_NETWORK_FILESYSTEMS=y | 1149 | CONFIG_NETWORK_FILESYSTEMS=y |
1053 | CONFIG_NFS_FS=y | 1150 | CONFIG_NFS_FS=y |
1054 | CONFIG_NFS_V3=y | 1151 | CONFIG_NFS_V3=y |
@@ -1060,7 +1157,6 @@ CONFIG_LOCKD=y | |||
1060 | CONFIG_LOCKD_V4=y | 1157 | CONFIG_LOCKD_V4=y |
1061 | CONFIG_NFS_COMMON=y | 1158 | CONFIG_NFS_COMMON=y |
1062 | CONFIG_SUNRPC=y | 1159 | CONFIG_SUNRPC=y |
1063 | # CONFIG_SUNRPC_REGISTER_V4 is not set | ||
1064 | # CONFIG_RPCSEC_GSS_KRB5 is not set | 1160 | # CONFIG_RPCSEC_GSS_KRB5 is not set |
1065 | # CONFIG_RPCSEC_GSS_SPKM3 is not set | 1161 | # CONFIG_RPCSEC_GSS_SPKM3 is not set |
1066 | # CONFIG_SMB_FS is not set | 1162 | # CONFIG_SMB_FS is not set |
@@ -1115,6 +1211,7 @@ CONFIG_NLS_ISO8859_15=y | |||
1115 | # CONFIG_NLS_KOI8_U is not set | 1211 | # CONFIG_NLS_KOI8_U is not set |
1116 | CONFIG_NLS_UTF8=y | 1212 | CONFIG_NLS_UTF8=y |
1117 | # CONFIG_DLM is not set | 1213 | # CONFIG_DLM is not set |
1214 | # CONFIG_BINARY_PRINTF is not set | ||
1118 | 1215 | ||
1119 | # | 1216 | # |
1120 | # Library routines | 1217 | # Library routines |
@@ -1122,7 +1219,7 @@ CONFIG_NLS_UTF8=y | |||
1122 | CONFIG_BITREVERSE=y | 1219 | CONFIG_BITREVERSE=y |
1123 | CONFIG_GENERIC_FIND_LAST_BIT=y | 1220 | CONFIG_GENERIC_FIND_LAST_BIT=y |
1124 | CONFIG_CRC_CCITT=y | 1221 | CONFIG_CRC_CCITT=y |
1125 | # CONFIG_CRC16 is not set | 1222 | CONFIG_CRC16=y |
1126 | CONFIG_CRC_T10DIF=y | 1223 | CONFIG_CRC_T10DIF=y |
1127 | # CONFIG_CRC_ITU_T is not set | 1224 | # CONFIG_CRC_ITU_T is not set |
1128 | CONFIG_CRC32=y | 1225 | CONFIG_CRC32=y |
@@ -1130,16 +1227,19 @@ CONFIG_CRC32=y | |||
1130 | # CONFIG_LIBCRC32C is not set | 1227 | # CONFIG_LIBCRC32C is not set |
1131 | CONFIG_ZLIB_INFLATE=y | 1228 | CONFIG_ZLIB_INFLATE=y |
1132 | CONFIG_ZLIB_DEFLATE=y | 1229 | CONFIG_ZLIB_DEFLATE=y |
1133 | CONFIG_PLIST=y | 1230 | CONFIG_LZO_COMPRESS=y |
1231 | CONFIG_LZO_DECOMPRESS=y | ||
1232 | CONFIG_DECOMPRESS_GZIP=y | ||
1134 | CONFIG_HAS_IOMEM=y | 1233 | CONFIG_HAS_IOMEM=y |
1135 | CONFIG_HAS_IOPORT=y | 1234 | CONFIG_HAS_IOPORT=y |
1136 | CONFIG_HAS_DMA=y | 1235 | CONFIG_HAS_DMA=y |
1137 | CONFIG_HAVE_LMB=y | 1236 | CONFIG_HAVE_LMB=y |
1237 | CONFIG_NLATTR=y | ||
1138 | 1238 | ||
1139 | # | 1239 | # |
1140 | # Kernel hacking | 1240 | # Kernel hacking |
1141 | # | 1241 | # |
1142 | # CONFIG_PRINTK_TIME is not set | 1242 | CONFIG_PRINTK_TIME=y |
1143 | CONFIG_ENABLE_WARN_DEPRECATED=y | 1243 | CONFIG_ENABLE_WARN_DEPRECATED=y |
1144 | CONFIG_ENABLE_MUST_CHECK=y | 1244 | CONFIG_ENABLE_MUST_CHECK=y |
1145 | CONFIG_FRAME_WARN=1024 | 1245 | CONFIG_FRAME_WARN=1024 |
@@ -1152,11 +1252,15 @@ CONFIG_DEBUG_KERNEL=y | |||
1152 | CONFIG_DETECT_SOFTLOCKUP=y | 1252 | CONFIG_DETECT_SOFTLOCKUP=y |
1153 | # CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set | 1253 | # CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set |
1154 | CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0 | 1254 | CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0 |
1255 | CONFIG_DETECT_HUNG_TASK=y | ||
1256 | # CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set | ||
1257 | CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0 | ||
1155 | # CONFIG_SCHED_DEBUG is not set | 1258 | # CONFIG_SCHED_DEBUG is not set |
1156 | # CONFIG_SCHEDSTATS is not set | 1259 | # CONFIG_SCHEDSTATS is not set |
1157 | # CONFIG_TIMER_STATS is not set | 1260 | # CONFIG_TIMER_STATS is not set |
1158 | # CONFIG_DEBUG_OBJECTS is not set | 1261 | # CONFIG_DEBUG_OBJECTS is not set |
1159 | # CONFIG_DEBUG_SLAB is not set | 1262 | # CONFIG_SLUB_DEBUG_ON is not set |
1263 | # CONFIG_SLUB_STATS is not set | ||
1160 | # CONFIG_DEBUG_RT_MUTEXES is not set | 1264 | # CONFIG_DEBUG_RT_MUTEXES is not set |
1161 | # CONFIG_RT_MUTEX_TESTER is not set | 1265 | # CONFIG_RT_MUTEX_TESTER is not set |
1162 | # CONFIG_DEBUG_SPINLOCK is not set | 1266 | # CONFIG_DEBUG_SPINLOCK is not set |
@@ -1180,9 +1284,12 @@ CONFIG_DEBUG_INFO=y | |||
1180 | # CONFIG_FAULT_INJECTION is not set | 1284 | # CONFIG_FAULT_INJECTION is not set |
1181 | # CONFIG_LATENCYTOP is not set | 1285 | # CONFIG_LATENCYTOP is not set |
1182 | CONFIG_SYSCTL_SYSCALL_CHECK=y | 1286 | CONFIG_SYSCTL_SYSCALL_CHECK=y |
1287 | # CONFIG_DEBUG_PAGEALLOC is not set | ||
1183 | CONFIG_HAVE_FUNCTION_TRACER=y | 1288 | CONFIG_HAVE_FUNCTION_TRACER=y |
1289 | CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y | ||
1184 | CONFIG_HAVE_DYNAMIC_FTRACE=y | 1290 | CONFIG_HAVE_DYNAMIC_FTRACE=y |
1185 | CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y | 1291 | CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y |
1292 | CONFIG_TRACING_SUPPORT=y | ||
1186 | 1293 | ||
1187 | # | 1294 | # |
1188 | # Tracers | 1295 | # Tracers |
@@ -1190,24 +1297,27 @@ CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y | |||
1190 | # CONFIG_FUNCTION_TRACER is not set | 1297 | # CONFIG_FUNCTION_TRACER is not set |
1191 | # CONFIG_SCHED_TRACER is not set | 1298 | # CONFIG_SCHED_TRACER is not set |
1192 | # CONFIG_CONTEXT_SWITCH_TRACER is not set | 1299 | # CONFIG_CONTEXT_SWITCH_TRACER is not set |
1300 | # CONFIG_EVENT_TRACER is not set | ||
1193 | # CONFIG_BOOT_TRACER is not set | 1301 | # CONFIG_BOOT_TRACER is not set |
1194 | # CONFIG_TRACE_BRANCH_PROFILING is not set | 1302 | # CONFIG_TRACE_BRANCH_PROFILING is not set |
1195 | # CONFIG_STACK_TRACER is not set | 1303 | # CONFIG_STACK_TRACER is not set |
1196 | # CONFIG_DYNAMIC_PRINTK_DEBUG is not set | 1304 | # CONFIG_KMEMTRACE is not set |
1305 | # CONFIG_WORKQUEUE_TRACER is not set | ||
1306 | # CONFIG_BLK_DEV_IO_TRACE is not set | ||
1307 | # CONFIG_DYNAMIC_DEBUG is not set | ||
1197 | # CONFIG_SAMPLES is not set | 1308 | # CONFIG_SAMPLES is not set |
1198 | CONFIG_HAVE_ARCH_KGDB=y | 1309 | CONFIG_HAVE_ARCH_KGDB=y |
1199 | # CONFIG_KGDB is not set | 1310 | # CONFIG_KGDB is not set |
1200 | CONFIG_PRINT_STACK_DEPTH=64 | 1311 | CONFIG_PRINT_STACK_DEPTH=64 |
1201 | # CONFIG_DEBUG_STACKOVERFLOW is not set | 1312 | # CONFIG_DEBUG_STACKOVERFLOW is not set |
1202 | # CONFIG_DEBUG_STACK_USAGE is not set | 1313 | # CONFIG_DEBUG_STACK_USAGE is not set |
1203 | # CONFIG_DEBUG_PAGEALLOC is not set | ||
1204 | # CONFIG_CODE_PATCHING_SELFTEST is not set | 1314 | # CONFIG_CODE_PATCHING_SELFTEST is not set |
1205 | # CONFIG_FTR_FIXUP_SELFTEST is not set | 1315 | # CONFIG_FTR_FIXUP_SELFTEST is not set |
1206 | # CONFIG_MSI_BITMAP_SELFTEST is not set | 1316 | # CONFIG_MSI_BITMAP_SELFTEST is not set |
1207 | # CONFIG_XMON is not set | 1317 | # CONFIG_XMON is not set |
1208 | CONFIG_IRQSTACKS=y | 1318 | CONFIG_IRQSTACKS=y |
1209 | # CONFIG_VIRQ_DEBUG is not set | 1319 | # CONFIG_VIRQ_DEBUG is not set |
1210 | CONFIG_BDI_SWITCH=y | 1320 | # CONFIG_BDI_SWITCH is not set |
1211 | # CONFIG_PPC_EARLY_DEBUG is not set | 1321 | # CONFIG_PPC_EARLY_DEBUG is not set |
1212 | 1322 | ||
1213 | # | 1323 | # |
@@ -1223,6 +1333,8 @@ CONFIG_CRYPTO=y | |||
1223 | # Crypto core or helper | 1333 | # Crypto core or helper |
1224 | # | 1334 | # |
1225 | # CONFIG_CRYPTO_FIPS is not set | 1335 | # CONFIG_CRYPTO_FIPS is not set |
1336 | CONFIG_CRYPTO_ALGAPI=y | ||
1337 | CONFIG_CRYPTO_ALGAPI2=y | ||
1226 | # CONFIG_CRYPTO_MANAGER is not set | 1338 | # CONFIG_CRYPTO_MANAGER is not set |
1227 | # CONFIG_CRYPTO_MANAGER2 is not set | 1339 | # CONFIG_CRYPTO_MANAGER2 is not set |
1228 | # CONFIG_CRYPTO_GF128MUL is not set | 1340 | # CONFIG_CRYPTO_GF128MUL is not set |
@@ -1294,13 +1406,15 @@ CONFIG_CRYPTO=y | |||
1294 | # | 1406 | # |
1295 | # Compression | 1407 | # Compression |
1296 | # | 1408 | # |
1297 | # CONFIG_CRYPTO_DEFLATE is not set | 1409 | CONFIG_CRYPTO_DEFLATE=y |
1298 | # CONFIG_CRYPTO_LZO is not set | 1410 | # CONFIG_CRYPTO_ZLIB is not set |
1411 | CONFIG_CRYPTO_LZO=y | ||
1299 | 1412 | ||
1300 | # | 1413 | # |
1301 | # Random Number Generation | 1414 | # Random Number Generation |
1302 | # | 1415 | # |
1303 | # CONFIG_CRYPTO_ANSI_CPRNG is not set | 1416 | # CONFIG_CRYPTO_ANSI_CPRNG is not set |
1304 | CONFIG_CRYPTO_HW=y | 1417 | CONFIG_CRYPTO_HW=y |
1418 | # CONFIG_CRYPTO_DEV_PPC4XX is not set | ||
1305 | # CONFIG_PPC_CLOCK is not set | 1419 | # CONFIG_PPC_CLOCK is not set |
1306 | # CONFIG_VIRTUALIZATION is not set | 1420 | # CONFIG_VIRTUALIZATION is not set |
diff --git a/arch/powerpc/include/asm/delay.h b/arch/powerpc/include/asm/delay.h index 1e2eb41fa057..52e4d54da2a9 100644 --- a/arch/powerpc/include/asm/delay.h +++ b/arch/powerpc/include/asm/delay.h | |||
@@ -63,6 +63,8 @@ extern void udelay(unsigned long usecs); | |||
63 | udelay(delay); \ | 63 | udelay(delay); \ |
64 | else \ | 64 | else \ |
65 | cpu_relax(); \ | 65 | cpu_relax(); \ |
66 | if (!__ret) \ | ||
67 | __ret = (condition); \ | ||
66 | __ret; \ | 68 | __ret; \ |
67 | }) | 69 | }) |
68 | 70 | ||
diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h index 9aba5a38a7c4..c8b329255678 100644 --- a/arch/powerpc/include/asm/thread_info.h +++ b/arch/powerpc/include/asm/thread_info.h | |||
@@ -46,15 +46,13 @@ struct thread_info { | |||
46 | 46 | ||
47 | /* | 47 | /* |
48 | * macros/functions for gaining access to the thread information structure | 48 | * macros/functions for gaining access to the thread information structure |
49 | * | ||
50 | * preempt_count needs to be 1 initially, until the scheduler is functional. | ||
51 | */ | 49 | */ |
52 | #define INIT_THREAD_INFO(tsk) \ | 50 | #define INIT_THREAD_INFO(tsk) \ |
53 | { \ | 51 | { \ |
54 | .task = &tsk, \ | 52 | .task = &tsk, \ |
55 | .exec_domain = &default_exec_domain, \ | 53 | .exec_domain = &default_exec_domain, \ |
56 | .cpu = 0, \ | 54 | .cpu = 0, \ |
57 | .preempt_count = 1, \ | 55 | .preempt_count = INIT_PREEMPT_COUNT, \ |
58 | .restart_block = { \ | 56 | .restart_block = { \ |
59 | .fn = do_no_restart_syscall, \ | 57 | .fn = do_no_restart_syscall, \ |
60 | }, \ | 58 | }, \ |
diff --git a/arch/powerpc/kernel/mpc7450-pmu.c b/arch/powerpc/kernel/mpc7450-pmu.c index 75ff47fed7bf..c244133c67a6 100644 --- a/arch/powerpc/kernel/mpc7450-pmu.c +++ b/arch/powerpc/kernel/mpc7450-pmu.c | |||
@@ -10,7 +10,6 @@ | |||
10 | */ | 10 | */ |
11 | #include <linux/string.h> | 11 | #include <linux/string.h> |
12 | #include <linux/perf_counter.h> | 12 | #include <linux/perf_counter.h> |
13 | #include <linux/string.h> | ||
14 | #include <asm/reg.h> | 13 | #include <asm/reg.h> |
15 | #include <asm/cputable.h> | 14 | #include <asm/cputable.h> |
16 | 15 | ||
diff --git a/arch/powerpc/kernel/power7-pmu.c b/arch/powerpc/kernel/power7-pmu.c index 5d755ef7ac8f..5a9f5cbd40a4 100644 --- a/arch/powerpc/kernel/power7-pmu.c +++ b/arch/powerpc/kernel/power7-pmu.c | |||
@@ -358,6 +358,7 @@ static struct power_pmu power7_pmu = { | |||
358 | .get_constraint = power7_get_constraint, | 358 | .get_constraint = power7_get_constraint, |
359 | .get_alternatives = power7_get_alternatives, | 359 | .get_alternatives = power7_get_alternatives, |
360 | .disable_pmc = power7_disable_pmc, | 360 | .disable_pmc = power7_disable_pmc, |
361 | .flags = PPMU_ALT_SIPR, | ||
361 | .n_generic = ARRAY_SIZE(power7_generic_events), | 362 | .n_generic = ARRAY_SIZE(power7_generic_events), |
362 | .generic_events = power7_generic_events, | 363 | .generic_events = power7_generic_events, |
363 | .cache_events = &power7_cache_events, | 364 | .cache_events = &power7_cache_events, |
diff --git a/arch/powerpc/kernel/ppc970-pmu.c b/arch/powerpc/kernel/ppc970-pmu.c index 6637c87fe70e..833097ac45dc 100644 --- a/arch/powerpc/kernel/ppc970-pmu.c +++ b/arch/powerpc/kernel/ppc970-pmu.c | |||
@@ -10,7 +10,6 @@ | |||
10 | */ | 10 | */ |
11 | #include <linux/string.h> | 11 | #include <linux/string.h> |
12 | #include <linux/perf_counter.h> | 12 | #include <linux/perf_counter.h> |
13 | #include <linux/string.h> | ||
14 | #include <asm/reg.h> | 13 | #include <asm/reg.h> |
15 | #include <asm/cputable.h> | 14 | #include <asm/cputable.h> |
16 | 15 | ||
diff --git a/arch/powerpc/kernel/ptrace32.c b/arch/powerpc/kernel/ptrace32.c index 297632cba047..8a6daf4129f6 100644 --- a/arch/powerpc/kernel/ptrace32.c +++ b/arch/powerpc/kernel/ptrace32.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/sched.h> | 21 | #include <linux/sched.h> |
22 | #include <linux/mm.h> | 22 | #include <linux/mm.h> |
23 | #include <linux/smp.h> | 23 | #include <linux/smp.h> |
24 | #include <linux/smp_lock.h> | ||
25 | #include <linux/errno.h> | 24 | #include <linux/errno.h> |
26 | #include <linux/ptrace.h> | 25 | #include <linux/ptrace.h> |
27 | #include <linux/regset.h> | 26 | #include <linux/regset.h> |
diff --git a/arch/powerpc/mm/gup.c b/arch/powerpc/mm/gup.c index bc400c78c97f..bc122a120bf0 100644 --- a/arch/powerpc/mm/gup.c +++ b/arch/powerpc/mm/gup.c | |||
@@ -159,7 +159,7 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write, | |||
159 | int psize; | 159 | int psize; |
160 | #endif | 160 | #endif |
161 | 161 | ||
162 | pr_debug("%s(%lx,%x,%s)\n", __func__, start, nr_pages, write ? "write" : "read"); | 162 | pr_devel("%s(%lx,%x,%s)\n", __func__, start, nr_pages, write ? "write" : "read"); |
163 | 163 | ||
164 | start &= PAGE_MASK; | 164 | start &= PAGE_MASK; |
165 | addr = start; | 165 | addr = start; |
@@ -170,7 +170,7 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write, | |||
170 | start, len))) | 170 | start, len))) |
171 | goto slow_irqon; | 171 | goto slow_irqon; |
172 | 172 | ||
173 | pr_debug(" aligned: %lx .. %lx\n", start, end); | 173 | pr_devel(" aligned: %lx .. %lx\n", start, end); |
174 | 174 | ||
175 | #ifdef CONFIG_HUGETLB_PAGE | 175 | #ifdef CONFIG_HUGETLB_PAGE |
176 | /* We bail out on slice boundary crossing when hugetlb is | 176 | /* We bail out on slice boundary crossing when hugetlb is |
@@ -234,7 +234,7 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write, | |||
234 | do { | 234 | do { |
235 | VM_BUG_ON(shift != mmu_psize_defs[get_slice_psize(mm, a)].shift); | 235 | VM_BUG_ON(shift != mmu_psize_defs[get_slice_psize(mm, a)].shift); |
236 | ptep = huge_pte_offset(mm, a); | 236 | ptep = huge_pte_offset(mm, a); |
237 | pr_debug(" %016lx: huge ptep %p\n", a, ptep); | 237 | pr_devel(" %016lx: huge ptep %p\n", a, ptep); |
238 | if (!ptep || !gup_huge_pte(ptep, hstate, &a, end, write, pages, | 238 | if (!ptep || !gup_huge_pte(ptep, hstate, &a, end, write, pages, |
239 | &nr)) | 239 | &nr)) |
240 | goto slow; | 240 | goto slow; |
@@ -249,7 +249,7 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write, | |||
249 | #ifdef CONFIG_PPC64 | 249 | #ifdef CONFIG_PPC64 |
250 | VM_BUG_ON(shift != mmu_psize_defs[get_slice_psize(mm, addr)].shift); | 250 | VM_BUG_ON(shift != mmu_psize_defs[get_slice_psize(mm, addr)].shift); |
251 | #endif | 251 | #endif |
252 | pr_debug(" %016lx: normal pgd %p\n", addr, | 252 | pr_devel(" %016lx: normal pgd %p\n", addr, |
253 | (void *)pgd_val(pgd)); | 253 | (void *)pgd_val(pgd)); |
254 | next = pgd_addr_end(addr, end); | 254 | next = pgd_addr_end(addr, end); |
255 | if (pgd_none(pgd)) | 255 | if (pgd_none(pgd)) |
@@ -269,7 +269,7 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write, | |||
269 | slow: | 269 | slow: |
270 | local_irq_enable(); | 270 | local_irq_enable(); |
271 | slow_irqon: | 271 | slow_irqon: |
272 | pr_debug(" slow path ! nr = %d\n", nr); | 272 | pr_devel(" slow path ! nr = %d\n", nr); |
273 | 273 | ||
274 | /* Try to get the remaining pages with get_user_pages */ | 274 | /* Try to get the remaining pages with get_user_pages */ |
275 | start += nr << PAGE_SHIFT; | 275 | start += nr << PAGE_SHIFT; |
diff --git a/arch/powerpc/mm/mmu_context_nohash.c b/arch/powerpc/mm/mmu_context_nohash.c index 8343986809c0..92a197117d5b 100644 --- a/arch/powerpc/mm/mmu_context_nohash.c +++ b/arch/powerpc/mm/mmu_context_nohash.c | |||
@@ -89,7 +89,7 @@ static unsigned int steal_context_smp(unsigned int id) | |||
89 | id = first_context; | 89 | id = first_context; |
90 | continue; | 90 | continue; |
91 | } | 91 | } |
92 | pr_debug("[%d] steal context %d from mm @%p\n", | 92 | pr_devel("[%d] steal context %d from mm @%p\n", |
93 | smp_processor_id(), id, mm); | 93 | smp_processor_id(), id, mm); |
94 | 94 | ||
95 | /* Mark this mm has having no context anymore */ | 95 | /* Mark this mm has having no context anymore */ |
@@ -126,7 +126,7 @@ static unsigned int steal_context_up(unsigned int id) | |||
126 | /* Pick up the victim mm */ | 126 | /* Pick up the victim mm */ |
127 | mm = context_mm[id]; | 127 | mm = context_mm[id]; |
128 | 128 | ||
129 | pr_debug("[%d] steal context %d from mm @%p\n", cpu, id, mm); | 129 | pr_devel("[%d] steal context %d from mm @%p\n", cpu, id, mm); |
130 | 130 | ||
131 | /* Flush the TLB for that context */ | 131 | /* Flush the TLB for that context */ |
132 | local_flush_tlb_mm(mm); | 132 | local_flush_tlb_mm(mm); |
@@ -180,7 +180,7 @@ void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next) | |||
180 | spin_lock(&context_lock); | 180 | spin_lock(&context_lock); |
181 | 181 | ||
182 | #ifndef DEBUG_STEAL_ONLY | 182 | #ifndef DEBUG_STEAL_ONLY |
183 | pr_debug("[%d] activating context for mm @%p, active=%d, id=%d\n", | 183 | pr_devel("[%d] activating context for mm @%p, active=%d, id=%d\n", |
184 | cpu, next, next->context.active, next->context.id); | 184 | cpu, next, next->context.active, next->context.id); |
185 | #endif | 185 | #endif |
186 | 186 | ||
@@ -189,7 +189,7 @@ void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next) | |||
189 | next->context.active++; | 189 | next->context.active++; |
190 | if (prev) { | 190 | if (prev) { |
191 | #ifndef DEBUG_STEAL_ONLY | 191 | #ifndef DEBUG_STEAL_ONLY |
192 | pr_debug(" old context %p active was: %d\n", | 192 | pr_devel(" old context %p active was: %d\n", |
193 | prev, prev->context.active); | 193 | prev, prev->context.active); |
194 | #endif | 194 | #endif |
195 | WARN_ON(prev->context.active < 1); | 195 | WARN_ON(prev->context.active < 1); |
@@ -236,7 +236,7 @@ void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next) | |||
236 | next->context.id = id; | 236 | next->context.id = id; |
237 | 237 | ||
238 | #ifndef DEBUG_STEAL_ONLY | 238 | #ifndef DEBUG_STEAL_ONLY |
239 | pr_debug("[%d] picked up new id %d, nrf is now %d\n", | 239 | pr_devel("[%d] picked up new id %d, nrf is now %d\n", |
240 | cpu, id, nr_free_contexts); | 240 | cpu, id, nr_free_contexts); |
241 | #endif | 241 | #endif |
242 | 242 | ||
@@ -247,7 +247,7 @@ void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next) | |||
247 | * local TLB for it and unmark it before we use it | 247 | * local TLB for it and unmark it before we use it |
248 | */ | 248 | */ |
249 | if (test_bit(id, stale_map[cpu])) { | 249 | if (test_bit(id, stale_map[cpu])) { |
250 | pr_debug("[%d] flushing stale context %d for mm @%p !\n", | 250 | pr_devel("[%d] flushing stale context %d for mm @%p !\n", |
251 | cpu, id, next); | 251 | cpu, id, next); |
252 | local_flush_tlb_mm(next); | 252 | local_flush_tlb_mm(next); |
253 | 253 | ||
@@ -314,13 +314,13 @@ static int __cpuinit mmu_context_cpu_notify(struct notifier_block *self, | |||
314 | switch (action) { | 314 | switch (action) { |
315 | case CPU_ONLINE: | 315 | case CPU_ONLINE: |
316 | case CPU_ONLINE_FROZEN: | 316 | case CPU_ONLINE_FROZEN: |
317 | pr_debug("MMU: Allocating stale context map for CPU %d\n", cpu); | 317 | pr_devel("MMU: Allocating stale context map for CPU %d\n", cpu); |
318 | stale_map[cpu] = kzalloc(CTX_MAP_SIZE, GFP_KERNEL); | 318 | stale_map[cpu] = kzalloc(CTX_MAP_SIZE, GFP_KERNEL); |
319 | break; | 319 | break; |
320 | #ifdef CONFIG_HOTPLUG_CPU | 320 | #ifdef CONFIG_HOTPLUG_CPU |
321 | case CPU_DEAD: | 321 | case CPU_DEAD: |
322 | case CPU_DEAD_FROZEN: | 322 | case CPU_DEAD_FROZEN: |
323 | pr_debug("MMU: Freeing stale context map for CPU %d\n", cpu); | 323 | pr_devel("MMU: Freeing stale context map for CPU %d\n", cpu); |
324 | kfree(stale_map[cpu]); | 324 | kfree(stale_map[cpu]); |
325 | stale_map[cpu] = NULL; | 325 | stale_map[cpu] = NULL; |
326 | break; | 326 | break; |
diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c index ae1d67cc090c..627767d6169b 100644 --- a/arch/powerpc/mm/pgtable.c +++ b/arch/powerpc/mm/pgtable.c | |||
@@ -129,12 +129,12 @@ static pte_t do_dcache_icache_coherency(pte_t pte) | |||
129 | page = pfn_to_page(pfn); | 129 | page = pfn_to_page(pfn); |
130 | 130 | ||
131 | if (!PageReserved(page) && !test_bit(PG_arch_1, &page->flags)) { | 131 | if (!PageReserved(page) && !test_bit(PG_arch_1, &page->flags)) { |
132 | pr_debug("do_dcache_icache_coherency... flushing\n"); | 132 | pr_devel("do_dcache_icache_coherency... flushing\n"); |
133 | flush_dcache_icache_page(page); | 133 | flush_dcache_icache_page(page); |
134 | set_bit(PG_arch_1, &page->flags); | 134 | set_bit(PG_arch_1, &page->flags); |
135 | } | 135 | } |
136 | else | 136 | else |
137 | pr_debug("do_dcache_icache_coherency... already clean\n"); | 137 | pr_devel("do_dcache_icache_coherency... already clean\n"); |
138 | return __pte(pte_val(pte) | _PAGE_HWEXEC); | 138 | return __pte(pte_val(pte) | _PAGE_HWEXEC); |
139 | } | 139 | } |
140 | 140 | ||
diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c index 3b52c80e5e33..5b7038f248b6 100644 --- a/arch/powerpc/mm/slb.c +++ b/arch/powerpc/mm/slb.c | |||
@@ -14,8 +14,6 @@ | |||
14 | * 2 of the License, or (at your option) any later version. | 14 | * 2 of the License, or (at your option) any later version. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #undef DEBUG | ||
18 | |||
19 | #include <asm/pgtable.h> | 17 | #include <asm/pgtable.h> |
20 | #include <asm/mmu.h> | 18 | #include <asm/mmu.h> |
21 | #include <asm/mmu_context.h> | 19 | #include <asm/mmu_context.h> |
@@ -27,11 +25,6 @@ | |||
27 | #include <linux/compiler.h> | 25 | #include <linux/compiler.h> |
28 | #include <asm/udbg.h> | 26 | #include <asm/udbg.h> |
29 | 27 | ||
30 | #ifdef DEBUG | ||
31 | #define DBG(fmt...) printk(fmt) | ||
32 | #else | ||
33 | #define DBG pr_debug | ||
34 | #endif | ||
35 | 28 | ||
36 | extern void slb_allocate_realmode(unsigned long ea); | 29 | extern void slb_allocate_realmode(unsigned long ea); |
37 | extern void slb_allocate_user(unsigned long ea); | 30 | extern void slb_allocate_user(unsigned long ea); |
@@ -285,13 +278,13 @@ void slb_initialize(void) | |||
285 | patch_slb_encoding(slb_compare_rr_to_size, | 278 | patch_slb_encoding(slb_compare_rr_to_size, |
286 | mmu_slb_size); | 279 | mmu_slb_size); |
287 | 280 | ||
288 | DBG("SLB: linear LLP = %04lx\n", linear_llp); | 281 | pr_devel("SLB: linear LLP = %04lx\n", linear_llp); |
289 | DBG("SLB: io LLP = %04lx\n", io_llp); | 282 | pr_devel("SLB: io LLP = %04lx\n", io_llp); |
290 | 283 | ||
291 | #ifdef CONFIG_SPARSEMEM_VMEMMAP | 284 | #ifdef CONFIG_SPARSEMEM_VMEMMAP |
292 | patch_slb_encoding(slb_miss_kernel_load_vmemmap, | 285 | patch_slb_encoding(slb_miss_kernel_load_vmemmap, |
293 | SLB_VSID_KERNEL | vmemmap_llp); | 286 | SLB_VSID_KERNEL | vmemmap_llp); |
294 | DBG("SLB: vmemmap LLP = %04lx\n", vmemmap_llp); | 287 | pr_devel("SLB: vmemmap LLP = %04lx\n", vmemmap_llp); |
295 | #endif | 288 | #endif |
296 | } | 289 | } |
297 | 290 | ||
diff --git a/arch/powerpc/mm/tlb_hash64.c b/arch/powerpc/mm/tlb_hash64.c index 1be1b5e59796..937eb90677d9 100644 --- a/arch/powerpc/mm/tlb_hash64.c +++ b/arch/powerpc/mm/tlb_hash64.c | |||
@@ -72,7 +72,7 @@ void hpte_need_flush(struct mm_struct *mm, unsigned long addr, | |||
72 | */ | 72 | */ |
73 | if (huge) { | 73 | if (huge) { |
74 | #ifdef CONFIG_HUGETLB_PAGE | 74 | #ifdef CONFIG_HUGETLB_PAGE |
75 | psize = get_slice_psize(mm, addr);; | 75 | psize = get_slice_psize(mm, addr); |
76 | #else | 76 | #else |
77 | BUG(); | 77 | BUG(); |
78 | psize = pte_pagesize_index(mm, addr, pte); /* shutup gcc */ | 78 | psize = pte_pagesize_index(mm, addr, pte); /* shutup gcc */ |
diff --git a/arch/powerpc/oprofile/cell/vma_map.c b/arch/powerpc/oprofile/cell/vma_map.c index 258fa4411e9e..c591339daf58 100644 --- a/arch/powerpc/oprofile/cell/vma_map.c +++ b/arch/powerpc/oprofile/cell/vma_map.c | |||
@@ -185,7 +185,7 @@ struct vma_to_fileoffset_map *create_vma_map(const struct spu *aSpu, | |||
185 | goto fail; | 185 | goto fail; |
186 | 186 | ||
187 | if (shdr_str.sh_type != SHT_STRTAB) | 187 | if (shdr_str.sh_type != SHT_STRTAB) |
188 | goto fail;; | 188 | goto fail; |
189 | 189 | ||
190 | for (j = 0; j < shdr.sh_size / sizeof (sym); j++) { | 190 | for (j = 0; j < shdr.sh_size / sizeof (sym); j++) { |
191 | if (copy_from_user(&sym, spu_elf_start + | 191 | if (copy_from_user(&sym, spu_elf_start + |
diff --git a/arch/powerpc/platforms/44x/warp.c b/arch/powerpc/platforms/44x/warp.c index 0362c88f47d7..e5c1b096c3e1 100644 --- a/arch/powerpc/platforms/44x/warp.c +++ b/arch/powerpc/platforms/44x/warp.c | |||
@@ -64,8 +64,6 @@ define_machine(warp) { | |||
64 | }; | 64 | }; |
65 | 65 | ||
66 | 66 | ||
67 | static u32 post_info; | ||
68 | |||
69 | static int __init warp_post_info(void) | 67 | static int __init warp_post_info(void) |
70 | { | 68 | { |
71 | struct device_node *np; | 69 | struct device_node *np; |
@@ -87,10 +85,9 @@ static int __init warp_post_info(void) | |||
87 | 85 | ||
88 | iounmap(fpga); | 86 | iounmap(fpga); |
89 | 87 | ||
90 | if (post1 || post2) { | 88 | if (post1 || post2) |
91 | printk(KERN_INFO "Warp POST %08x %08x\n", post1, post2); | 89 | printk(KERN_INFO "Warp POST %08x %08x\n", post1, post2); |
92 | post_info = 1; | 90 | else |
93 | } else | ||
94 | printk(KERN_INFO "Warp POST OK\n"); | 91 | printk(KERN_INFO "Warp POST OK\n"); |
95 | 92 | ||
96 | return 0; | 93 | return 0; |
@@ -166,6 +163,9 @@ static irqreturn_t temp_isr(int irq, void *context) | |||
166 | value ^= 1; | 163 | value ^= 1; |
167 | mdelay(500); | 164 | mdelay(500); |
168 | } | 165 | } |
166 | |||
167 | /* Not reached */ | ||
168 | return IRQ_HANDLED; | ||
169 | } | 169 | } |
170 | 170 | ||
171 | static int pika_setup_leds(void) | 171 | static int pika_setup_leds(void) |
@@ -179,15 +179,10 @@ static int pika_setup_leds(void) | |||
179 | } | 179 | } |
180 | 180 | ||
181 | for_each_child_of_node(np, child) | 181 | for_each_child_of_node(np, child) |
182 | if (strcmp(child->name, "green") == 0) { | 182 | if (strcmp(child->name, "green") == 0) |
183 | green_led = of_get_gpio(child, 0); | 183 | green_led = of_get_gpio(child, 0); |
184 | /* Turn back on the green LED */ | 184 | else if (strcmp(child->name, "red") == 0) |
185 | gpio_set_value(green_led, 1); | ||
186 | } else if (strcmp(child->name, "red") == 0) { | ||
187 | red_led = of_get_gpio(child, 0); | 185 | red_led = of_get_gpio(child, 0); |
188 | /* Set based on post */ | ||
189 | gpio_set_value(red_led, post_info); | ||
190 | } | ||
191 | 186 | ||
192 | of_node_put(np); | 187 | of_node_put(np); |
193 | 188 | ||
diff --git a/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c b/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c index ddf0bdc0fc8b..7ee979f323d1 100644 --- a/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c +++ b/arch/powerpc/platforms/82xx/pq2ads-pci-pic.c | |||
@@ -147,7 +147,7 @@ int __init pq2ads_pci_init_irq(void) | |||
147 | goto out; | 147 | goto out; |
148 | } | 148 | } |
149 | 149 | ||
150 | priv = alloc_bootmem(sizeof(struct pq2ads_pci_pic)); | 150 | priv = kzalloc(sizeof(*priv), GFP_KERNEL); |
151 | if (!priv) { | 151 | if (!priv) { |
152 | of_node_put(np); | 152 | of_node_put(np); |
153 | ret = -ENOMEM; | 153 | ret = -ENOMEM; |
diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platforms/cell/axon_msi.c index c71498dbf211..aca5741ddc67 100644 --- a/arch/powerpc/platforms/cell/axon_msi.c +++ b/arch/powerpc/platforms/cell/axon_msi.c | |||
@@ -85,7 +85,7 @@ static inline void axon_msi_debug_setup(struct device_node *dn, | |||
85 | 85 | ||
86 | static void msic_dcr_write(struct axon_msic *msic, unsigned int dcr_n, u32 val) | 86 | static void msic_dcr_write(struct axon_msic *msic, unsigned int dcr_n, u32 val) |
87 | { | 87 | { |
88 | pr_debug("axon_msi: dcr_write(0x%x, 0x%x)\n", val, dcr_n); | 88 | pr_devel("axon_msi: dcr_write(0x%x, 0x%x)\n", val, dcr_n); |
89 | 89 | ||
90 | dcr_write(msic->dcr_host, dcr_n, val); | 90 | dcr_write(msic->dcr_host, dcr_n, val); |
91 | } | 91 | } |
@@ -98,7 +98,7 @@ static void axon_msi_cascade(unsigned int irq, struct irq_desc *desc) | |||
98 | int retry = 0; | 98 | int retry = 0; |
99 | 99 | ||
100 | write_offset = dcr_read(msic->dcr_host, MSIC_WRITE_OFFSET_REG); | 100 | write_offset = dcr_read(msic->dcr_host, MSIC_WRITE_OFFSET_REG); |
101 | pr_debug("axon_msi: original write_offset 0x%x\n", write_offset); | 101 | pr_devel("axon_msi: original write_offset 0x%x\n", write_offset); |
102 | 102 | ||
103 | /* write_offset doesn't wrap properly, so we have to mask it */ | 103 | /* write_offset doesn't wrap properly, so we have to mask it */ |
104 | write_offset &= MSIC_FIFO_SIZE_MASK; | 104 | write_offset &= MSIC_FIFO_SIZE_MASK; |
@@ -108,7 +108,7 @@ static void axon_msi_cascade(unsigned int irq, struct irq_desc *desc) | |||
108 | msi = le32_to_cpu(msic->fifo_virt[idx]); | 108 | msi = le32_to_cpu(msic->fifo_virt[idx]); |
109 | msi &= 0xFFFF; | 109 | msi &= 0xFFFF; |
110 | 110 | ||
111 | pr_debug("axon_msi: woff %x roff %x msi %x\n", | 111 | pr_devel("axon_msi: woff %x roff %x msi %x\n", |
112 | write_offset, msic->read_offset, msi); | 112 | write_offset, msic->read_offset, msi); |
113 | 113 | ||
114 | if (msi < NR_IRQS && irq_map[msi].host == msic->irq_host) { | 114 | if (msi < NR_IRQS && irq_map[msi].host == msic->irq_host) { |
@@ -123,12 +123,12 @@ static void axon_msi_cascade(unsigned int irq, struct irq_desc *desc) | |||
123 | */ | 123 | */ |
124 | udelay(1); | 124 | udelay(1); |
125 | retry++; | 125 | retry++; |
126 | pr_debug("axon_msi: invalid irq 0x%x!\n", msi); | 126 | pr_devel("axon_msi: invalid irq 0x%x!\n", msi); |
127 | continue; | 127 | continue; |
128 | } | 128 | } |
129 | 129 | ||
130 | if (retry) { | 130 | if (retry) { |
131 | pr_debug("axon_msi: late irq 0x%x, retry %d\n", | 131 | pr_devel("axon_msi: late irq 0x%x, retry %d\n", |
132 | msi, retry); | 132 | msi, retry); |
133 | retry = 0; | 133 | retry = 0; |
134 | } | 134 | } |
@@ -332,7 +332,7 @@ static int axon_msi_shutdown(struct of_device *device) | |||
332 | struct axon_msic *msic = dev_get_drvdata(&device->dev); | 332 | struct axon_msic *msic = dev_get_drvdata(&device->dev); |
333 | u32 tmp; | 333 | u32 tmp; |
334 | 334 | ||
335 | pr_debug("axon_msi: disabling %s\n", | 335 | pr_devel("axon_msi: disabling %s\n", |
336 | msic->irq_host->of_node->full_name); | 336 | msic->irq_host->of_node->full_name); |
337 | tmp = dcr_read(msic->dcr_host, MSIC_CTRL_REG); | 337 | tmp = dcr_read(msic->dcr_host, MSIC_CTRL_REG); |
338 | tmp &= ~MSIC_CTRL_ENABLE & ~MSIC_CTRL_IRQ_ENABLE; | 338 | tmp &= ~MSIC_CTRL_ENABLE & ~MSIC_CTRL_IRQ_ENABLE; |
@@ -349,7 +349,7 @@ static int axon_msi_probe(struct of_device *device, | |||
349 | unsigned int virq; | 349 | unsigned int virq; |
350 | int dcr_base, dcr_len; | 350 | int dcr_base, dcr_len; |
351 | 351 | ||
352 | pr_debug("axon_msi: setting up dn %s\n", dn->full_name); | 352 | pr_devel("axon_msi: setting up dn %s\n", dn->full_name); |
353 | 353 | ||
354 | msic = kzalloc(sizeof(struct axon_msic), GFP_KERNEL); | 354 | msic = kzalloc(sizeof(struct axon_msic), GFP_KERNEL); |
355 | if (!msic) { | 355 | if (!msic) { |
@@ -403,7 +403,7 @@ static int axon_msi_probe(struct of_device *device, | |||
403 | 403 | ||
404 | set_irq_data(virq, msic); | 404 | set_irq_data(virq, msic); |
405 | set_irq_chained_handler(virq, axon_msi_cascade); | 405 | set_irq_chained_handler(virq, axon_msi_cascade); |
406 | pr_debug("axon_msi: irq 0x%x setup for axon_msi\n", virq); | 406 | pr_devel("axon_msi: irq 0x%x setup for axon_msi\n", virq); |
407 | 407 | ||
408 | /* Enable the MSIC hardware */ | 408 | /* Enable the MSIC hardware */ |
409 | msic_dcr_write(msic, MSIC_BASE_ADDR_HI_REG, msic->fifo_phys >> 32); | 409 | msic_dcr_write(msic, MSIC_BASE_ADDR_HI_REG, msic->fifo_phys >> 32); |
@@ -484,13 +484,13 @@ void axon_msi_debug_setup(struct device_node *dn, struct axon_msic *msic) | |||
484 | 484 | ||
485 | addr = of_translate_address(dn, of_get_property(dn, "reg", NULL)); | 485 | addr = of_translate_address(dn, of_get_property(dn, "reg", NULL)); |
486 | if (addr == OF_BAD_ADDR) { | 486 | if (addr == OF_BAD_ADDR) { |
487 | pr_debug("axon_msi: couldn't translate reg property\n"); | 487 | pr_devel("axon_msi: couldn't translate reg property\n"); |
488 | return; | 488 | return; |
489 | } | 489 | } |
490 | 490 | ||
491 | msic->trigger = ioremap(addr, 0x4); | 491 | msic->trigger = ioremap(addr, 0x4); |
492 | if (!msic->trigger) { | 492 | if (!msic->trigger) { |
493 | pr_debug("axon_msi: ioremap failed\n"); | 493 | pr_devel("axon_msi: ioremap failed\n"); |
494 | return; | 494 | return; |
495 | } | 495 | } |
496 | 496 | ||
@@ -498,7 +498,7 @@ void axon_msi_debug_setup(struct device_node *dn, struct axon_msic *msic) | |||
498 | 498 | ||
499 | if (!debugfs_create_file(name, 0600, powerpc_debugfs_root, | 499 | if (!debugfs_create_file(name, 0600, powerpc_debugfs_root, |
500 | msic, &fops_msic)) { | 500 | msic, &fops_msic)) { |
501 | pr_debug("axon_msi: debugfs_create_file failed!\n"); | 501 | pr_devel("axon_msi: debugfs_create_file failed!\n"); |
502 | return; | 502 | return; |
503 | } | 503 | } |
504 | } | 504 | } |
diff --git a/arch/powerpc/platforms/powermac/cpufreq_64.c b/arch/powerpc/platforms/powermac/cpufreq_64.c index 22ecfbe7183d..708c75133377 100644 --- a/arch/powerpc/platforms/powermac/cpufreq_64.c +++ b/arch/powerpc/platforms/powermac/cpufreq_64.c | |||
@@ -251,7 +251,7 @@ static void g5_pfunc_switch_volt(int speed_mode) | |||
251 | static struct pmf_function *pfunc_cpu_setfreq_high; | 251 | static struct pmf_function *pfunc_cpu_setfreq_high; |
252 | static struct pmf_function *pfunc_cpu_setfreq_low; | 252 | static struct pmf_function *pfunc_cpu_setfreq_low; |
253 | static struct pmf_function *pfunc_cpu_getfreq; | 253 | static struct pmf_function *pfunc_cpu_getfreq; |
254 | static struct pmf_function *pfunc_slewing_done;; | 254 | static struct pmf_function *pfunc_slewing_done; |
255 | 255 | ||
256 | static int g5_pfunc_switch_freq(int speed_mode) | 256 | static int g5_pfunc_switch_freq(int speed_mode) |
257 | { | 257 | { |
diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c index dce736349107..d212006a5b3c 100644 --- a/arch/powerpc/platforms/powermac/pic.c +++ b/arch/powerpc/platforms/powermac/pic.c | |||
@@ -609,7 +609,7 @@ static int pmacpic_find_viaint(void) | |||
609 | np = of_find_node_by_name(NULL, "via-pmu"); | 609 | np = of_find_node_by_name(NULL, "via-pmu"); |
610 | if (np == NULL) | 610 | if (np == NULL) |
611 | goto not_found; | 611 | goto not_found; |
612 | viaint = irq_of_parse_and_map(np, 0);; | 612 | viaint = irq_of_parse_and_map(np, 0); |
613 | 613 | ||
614 | not_found: | 614 | not_found: |
615 | #endif /* CONFIG_ADB_PMU */ | 615 | #endif /* CONFIG_ADB_PMU */ |
diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c index 9fead0faf38b..3f763c5284ac 100644 --- a/arch/powerpc/platforms/ps3/system-bus.c +++ b/arch/powerpc/platforms/ps3/system-bus.c | |||
@@ -284,7 +284,6 @@ static int ps3_sb_free_mmio_region(struct ps3_mmio_region *r) | |||
284 | int result; | 284 | int result; |
285 | 285 | ||
286 | dump_mmio_region(r); | 286 | dump_mmio_region(r); |
287 | ; | ||
288 | result = lv1_unmap_device_mmio_region(r->dev->bus_id, r->dev->dev_id, | 287 | result = lv1_unmap_device_mmio_region(r->dev->bus_id, r->dev->dev_id, |
289 | r->lpar_addr); | 288 | r->lpar_addr); |
290 | 289 | ||
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c index e3139fa5e556..903eb9eec687 100644 --- a/arch/powerpc/platforms/pseries/lpar.c +++ b/arch/powerpc/platforms/pseries/lpar.c | |||
@@ -286,7 +286,7 @@ static long pSeries_lpar_hpte_insert(unsigned long hpte_group, | |||
286 | unsigned long hpte_v, hpte_r; | 286 | unsigned long hpte_v, hpte_r; |
287 | 287 | ||
288 | if (!(vflags & HPTE_V_BOLTED)) | 288 | if (!(vflags & HPTE_V_BOLTED)) |
289 | pr_debug("hpte_insert(group=%lx, va=%016lx, pa=%016lx, " | 289 | pr_devel("hpte_insert(group=%lx, va=%016lx, pa=%016lx, " |
290 | "rflags=%lx, vflags=%lx, psize=%d)\n", | 290 | "rflags=%lx, vflags=%lx, psize=%d)\n", |
291 | hpte_group, va, pa, rflags, vflags, psize); | 291 | hpte_group, va, pa, rflags, vflags, psize); |
292 | 292 | ||
@@ -294,7 +294,7 @@ static long pSeries_lpar_hpte_insert(unsigned long hpte_group, | |||
294 | hpte_r = hpte_encode_r(pa, psize) | rflags; | 294 | hpte_r = hpte_encode_r(pa, psize) | rflags; |
295 | 295 | ||
296 | if (!(vflags & HPTE_V_BOLTED)) | 296 | if (!(vflags & HPTE_V_BOLTED)) |
297 | pr_debug(" hpte_v=%016lx, hpte_r=%016lx\n", hpte_v, hpte_r); | 297 | pr_devel(" hpte_v=%016lx, hpte_r=%016lx\n", hpte_v, hpte_r); |
298 | 298 | ||
299 | /* Now fill in the actual HPTE */ | 299 | /* Now fill in the actual HPTE */ |
300 | /* Set CEC cookie to 0 */ | 300 | /* Set CEC cookie to 0 */ |
@@ -311,7 +311,7 @@ static long pSeries_lpar_hpte_insert(unsigned long hpte_group, | |||
311 | lpar_rc = plpar_pte_enter(flags, hpte_group, hpte_v, hpte_r, &slot); | 311 | lpar_rc = plpar_pte_enter(flags, hpte_group, hpte_v, hpte_r, &slot); |
312 | if (unlikely(lpar_rc == H_PTEG_FULL)) { | 312 | if (unlikely(lpar_rc == H_PTEG_FULL)) { |
313 | if (!(vflags & HPTE_V_BOLTED)) | 313 | if (!(vflags & HPTE_V_BOLTED)) |
314 | pr_debug(" full\n"); | 314 | pr_devel(" full\n"); |
315 | return -1; | 315 | return -1; |
316 | } | 316 | } |
317 | 317 | ||
@@ -322,11 +322,11 @@ static long pSeries_lpar_hpte_insert(unsigned long hpte_group, | |||
322 | */ | 322 | */ |
323 | if (unlikely(lpar_rc != H_SUCCESS)) { | 323 | if (unlikely(lpar_rc != H_SUCCESS)) { |
324 | if (!(vflags & HPTE_V_BOLTED)) | 324 | if (!(vflags & HPTE_V_BOLTED)) |
325 | pr_debug(" lpar err %lu\n", lpar_rc); | 325 | pr_devel(" lpar err %lu\n", lpar_rc); |
326 | return -2; | 326 | return -2; |
327 | } | 327 | } |
328 | if (!(vflags & HPTE_V_BOLTED)) | 328 | if (!(vflags & HPTE_V_BOLTED)) |
329 | pr_debug(" -> slot: %lu\n", slot & 7); | 329 | pr_devel(" -> slot: %lu\n", slot & 7); |
330 | 330 | ||
331 | /* Because of iSeries, we have to pass down the secondary | 331 | /* Because of iSeries, we have to pass down the secondary |
332 | * bucket bit here as well | 332 | * bucket bit here as well |
@@ -418,17 +418,17 @@ static long pSeries_lpar_hpte_updatepp(unsigned long slot, | |||
418 | 418 | ||
419 | want_v = hpte_encode_avpn(va, psize, ssize); | 419 | want_v = hpte_encode_avpn(va, psize, ssize); |
420 | 420 | ||
421 | pr_debug(" update: avpnv=%016lx, hash=%016lx, f=%lx, psize: %d ...", | 421 | pr_devel(" update: avpnv=%016lx, hash=%016lx, f=%lx, psize: %d ...", |
422 | want_v, slot, flags, psize); | 422 | want_v, slot, flags, psize); |
423 | 423 | ||
424 | lpar_rc = plpar_pte_protect(flags, slot, want_v); | 424 | lpar_rc = plpar_pte_protect(flags, slot, want_v); |
425 | 425 | ||
426 | if (lpar_rc == H_NOT_FOUND) { | 426 | if (lpar_rc == H_NOT_FOUND) { |
427 | pr_debug("not found !\n"); | 427 | pr_devel("not found !\n"); |
428 | return -1; | 428 | return -1; |
429 | } | 429 | } |
430 | 430 | ||
431 | pr_debug("ok\n"); | 431 | pr_devel("ok\n"); |
432 | 432 | ||
433 | BUG_ON(lpar_rc != H_SUCCESS); | 433 | BUG_ON(lpar_rc != H_SUCCESS); |
434 | 434 | ||
@@ -503,7 +503,7 @@ static void pSeries_lpar_hpte_invalidate(unsigned long slot, unsigned long va, | |||
503 | unsigned long lpar_rc; | 503 | unsigned long lpar_rc; |
504 | unsigned long dummy1, dummy2; | 504 | unsigned long dummy1, dummy2; |
505 | 505 | ||
506 | pr_debug(" inval : slot=%lx, va=%016lx, psize: %d, local: %d\n", | 506 | pr_devel(" inval : slot=%lx, va=%016lx, psize: %d, local: %d\n", |
507 | slot, va, psize, local); | 507 | slot, va, psize, local); |
508 | 508 | ||
509 | want_v = hpte_encode_avpn(va, psize, ssize); | 509 | want_v = hpte_encode_avpn(va, psize, ssize); |
diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c index be3581a8c294..419f8a637ffe 100644 --- a/arch/powerpc/platforms/pseries/xics.c +++ b/arch/powerpc/platforms/pseries/xics.c | |||
@@ -190,10 +190,10 @@ static void xics_unmask_irq(unsigned int virq) | |||
190 | int call_status; | 190 | int call_status; |
191 | int server; | 191 | int server; |
192 | 192 | ||
193 | pr_debug("xics: unmask virq %d\n", virq); | 193 | pr_devel("xics: unmask virq %d\n", virq); |
194 | 194 | ||
195 | irq = (unsigned int)irq_map[virq].hwirq; | 195 | irq = (unsigned int)irq_map[virq].hwirq; |
196 | pr_debug(" -> map to hwirq 0x%x\n", irq); | 196 | pr_devel(" -> map to hwirq 0x%x\n", irq); |
197 | if (irq == XICS_IPI || irq == XICS_IRQ_SPURIOUS) | 197 | if (irq == XICS_IPI || irq == XICS_IRQ_SPURIOUS) |
198 | return; | 198 | return; |
199 | 199 | ||
@@ -252,7 +252,7 @@ static void xics_mask_irq(unsigned int virq) | |||
252 | { | 252 | { |
253 | unsigned int irq; | 253 | unsigned int irq; |
254 | 254 | ||
255 | pr_debug("xics: mask virq %d\n", virq); | 255 | pr_devel("xics: mask virq %d\n", virq); |
256 | 256 | ||
257 | irq = (unsigned int)irq_map[virq].hwirq; | 257 | irq = (unsigned int)irq_map[virq].hwirq; |
258 | if (irq == XICS_IPI || irq == XICS_IRQ_SPURIOUS) | 258 | if (irq == XICS_IPI || irq == XICS_IRQ_SPURIOUS) |
@@ -414,7 +414,7 @@ static int xics_host_match(struct irq_host *h, struct device_node *node) | |||
414 | static int xics_host_map(struct irq_host *h, unsigned int virq, | 414 | static int xics_host_map(struct irq_host *h, unsigned int virq, |
415 | irq_hw_number_t hw) | 415 | irq_hw_number_t hw) |
416 | { | 416 | { |
417 | pr_debug("xics: map virq %d, hwirq 0x%lx\n", virq, hw); | 417 | pr_devel("xics: map virq %d, hwirq 0x%lx\n", virq, hw); |
418 | 418 | ||
419 | /* Insert the interrupt mapping into the radix tree for fast lookup */ | 419 | /* Insert the interrupt mapping into the radix tree for fast lookup */ |
420 | irq_radix_revmap_insert(xics_host, virq, hw); | 420 | irq_radix_revmap_insert(xics_host, virq, hw); |
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c index 39db9d1155d2..cbb3bed75d3c 100644 --- a/arch/powerpc/sysdev/fsl_rio.c +++ b/arch/powerpc/sysdev/fsl_rio.c | |||
@@ -965,7 +965,7 @@ static inline void fsl_rio_info(struct device *dev, u32 ccsr) | |||
965 | break; | 965 | break; |
966 | default: | 966 | default: |
967 | str = "Unknown"; | 967 | str = "Unknown"; |
968 | break;; | 968 | break; |
969 | } | 969 | } |
970 | dev_info(dev, "Hardware port width: %s\n", str); | 970 | dev_info(dev, "Hardware port width: %s\n", str); |
971 | 971 | ||
diff --git a/arch/powerpc/sysdev/ipic.c b/arch/powerpc/sysdev/ipic.c index a86d3ce01ead..69e2630c9062 100644 --- a/arch/powerpc/sysdev/ipic.c +++ b/arch/powerpc/sysdev/ipic.c | |||
@@ -728,12 +728,10 @@ struct ipic * __init ipic_init(struct device_node *node, unsigned int flags) | |||
728 | if (ret) | 728 | if (ret) |
729 | return NULL; | 729 | return NULL; |
730 | 730 | ||
731 | ipic = alloc_bootmem(sizeof(struct ipic)); | 731 | ipic = kzalloc(sizeof(*ipic), GFP_KERNEL); |
732 | if (ipic == NULL) | 732 | if (ipic == NULL) |
733 | return NULL; | 733 | return NULL; |
734 | 734 | ||
735 | memset(ipic, 0, sizeof(struct ipic)); | ||
736 | |||
737 | ipic->irqhost = irq_alloc_host(node, IRQ_HOST_MAP_LINEAR, | 735 | ipic->irqhost = irq_alloc_host(node, IRQ_HOST_MAP_LINEAR, |
738 | NR_IPIC_INTS, | 736 | NR_IPIC_INTS, |
739 | &ipic_host_ops, 0); | 737 | &ipic_host_ops, 0); |
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c index d46de1f0f3ee..3981ae4cb58e 100644 --- a/arch/powerpc/sysdev/mpic.c +++ b/arch/powerpc/sysdev/mpic.c | |||
@@ -508,9 +508,8 @@ static void __init mpic_scan_ht_pics(struct mpic *mpic) | |||
508 | printk(KERN_INFO "mpic: Setting up HT PICs workarounds for U3/U4\n"); | 508 | printk(KERN_INFO "mpic: Setting up HT PICs workarounds for U3/U4\n"); |
509 | 509 | ||
510 | /* Allocate fixups array */ | 510 | /* Allocate fixups array */ |
511 | mpic->fixups = alloc_bootmem(128 * sizeof(struct mpic_irq_fixup)); | 511 | mpic->fixups = kzalloc(128 * sizeof(*mpic->fixups), GFP_KERNEL); |
512 | BUG_ON(mpic->fixups == NULL); | 512 | BUG_ON(mpic->fixups == NULL); |
513 | memset(mpic->fixups, 0, 128 * sizeof(struct mpic_irq_fixup)); | ||
514 | 513 | ||
515 | /* Init spinlock */ | 514 | /* Init spinlock */ |
516 | spin_lock_init(&mpic->fixup_lock); | 515 | spin_lock_init(&mpic->fixup_lock); |
@@ -1109,9 +1108,8 @@ struct mpic * __init mpic_alloc(struct device_node *node, | |||
1109 | psize /= 4; | 1108 | psize /= 4; |
1110 | bits = intvec_top + 1; | 1109 | bits = intvec_top + 1; |
1111 | mapsize = BITS_TO_LONGS(bits) * sizeof(unsigned long); | 1110 | mapsize = BITS_TO_LONGS(bits) * sizeof(unsigned long); |
1112 | mpic->protected = alloc_bootmem(mapsize); | 1111 | mpic->protected = kzalloc(mapsize, GFP_KERNEL); |
1113 | BUG_ON(mpic->protected == NULL); | 1112 | BUG_ON(mpic->protected == NULL); |
1114 | memset(mpic->protected, 0, mapsize); | ||
1115 | for (i = 0; i < psize; i++) { | 1113 | for (i = 0; i < psize; i++) { |
1116 | if (psrc[i] > intvec_top) | 1114 | if (psrc[i] > intvec_top) |
1117 | continue; | 1115 | continue; |
@@ -1353,7 +1351,8 @@ void __init mpic_init(struct mpic *mpic) | |||
1353 | 1351 | ||
1354 | #ifdef CONFIG_PM | 1352 | #ifdef CONFIG_PM |
1355 | /* allocate memory to save mpic state */ | 1353 | /* allocate memory to save mpic state */ |
1356 | mpic->save_data = alloc_bootmem(mpic->num_sources * sizeof(struct mpic_irq_save)); | 1354 | mpic->save_data = kmalloc(mpic->num_sources * sizeof(*mpic->save_data), |
1355 | GFP_KERNEL); | ||
1357 | BUG_ON(mpic->save_data == NULL); | 1356 | BUG_ON(mpic->save_data == NULL); |
1358 | #endif | 1357 | #endif |
1359 | } | 1358 | } |
diff --git a/arch/powerpc/sysdev/ppc4xx_pci.c b/arch/powerpc/sysdev/ppc4xx_pci.c index daefc93ddffe..6ff9d71b4c0d 100644 --- a/arch/powerpc/sysdev/ppc4xx_pci.c +++ b/arch/powerpc/sysdev/ppc4xx_pci.c | |||
@@ -1531,7 +1531,7 @@ static void __init ppc4xx_configure_pciex_PIMs(struct ppc4xx_pciex_port *port, | |||
1531 | */ | 1531 | */ |
1532 | 1532 | ||
1533 | /* Calculate window size */ | 1533 | /* Calculate window size */ |
1534 | sa = (0xffffffffffffffffull << ilog2(ep_size));; | 1534 | sa = (0xffffffffffffffffull << ilog2(ep_size)); |
1535 | 1535 | ||
1536 | /* Setup BAR0 */ | 1536 | /* Setup BAR0 */ |
1537 | out_le32(mbase + PECFG_BAR0HMPA, RES_TO_U32_HIGH(sa)); | 1537 | out_le32(mbase + PECFG_BAR0HMPA, RES_TO_U32_HIGH(sa)); |
@@ -1550,7 +1550,7 @@ static void __init ppc4xx_configure_pciex_PIMs(struct ppc4xx_pciex_port *port, | |||
1550 | out_le32(mbase + PCI_BASE_ADDRESS_1, RES_TO_U32_HIGH(ep_addr)); | 1550 | out_le32(mbase + PCI_BASE_ADDRESS_1, RES_TO_U32_HIGH(ep_addr)); |
1551 | } else { | 1551 | } else { |
1552 | /* Calculate window size */ | 1552 | /* Calculate window size */ |
1553 | sa = (0xffffffffffffffffull << ilog2(size));; | 1553 | sa = (0xffffffffffffffffull << ilog2(size)); |
1554 | if (res->flags & IORESOURCE_PREFETCH) | 1554 | if (res->flags & IORESOURCE_PREFETCH) |
1555 | sa |= 0x8; | 1555 | sa |= 0x8; |
1556 | 1556 | ||
diff --git a/arch/powerpc/sysdev/qe_lib/qe_ic.c b/arch/powerpc/sysdev/qe_lib/qe_ic.c index 63cdf9887f36..074905c3ee5a 100644 --- a/arch/powerpc/sysdev/qe_lib/qe_ic.c +++ b/arch/powerpc/sysdev/qe_lib/qe_ic.c | |||
@@ -333,12 +333,10 @@ void __init qe_ic_init(struct device_node *node, unsigned int flags, | |||
333 | if (ret) | 333 | if (ret) |
334 | return; | 334 | return; |
335 | 335 | ||
336 | qe_ic = alloc_bootmem(sizeof(struct qe_ic)); | 336 | qe_ic = kzalloc(sizeof(*qe_ic), GFP_KERNEL); |
337 | if (qe_ic == NULL) | 337 | if (qe_ic == NULL) |
338 | return; | 338 | return; |
339 | 339 | ||
340 | memset(qe_ic, 0, sizeof(struct qe_ic)); | ||
341 | |||
342 | qe_ic->irqhost = irq_alloc_host(node, IRQ_HOST_MAP_LINEAR, | 340 | qe_ic->irqhost = irq_alloc_host(node, IRQ_HOST_MAP_LINEAR, |
343 | NR_QE_IC_INTS, &qe_ic_host_ops, 0); | 341 | NR_QE_IC_INTS, &qe_ic_host_ops, 0); |
344 | if (qe_ic->irqhost == NULL) | 342 | if (qe_ic->irqhost == NULL) |
diff --git a/arch/powerpc/sysdev/uic.c b/arch/powerpc/sysdev/uic.c index d35405c59434..466ce9ace127 100644 --- a/arch/powerpc/sysdev/uic.c +++ b/arch/powerpc/sysdev/uic.c | |||
@@ -258,11 +258,10 @@ static struct uic * __init uic_init_one(struct device_node *node) | |||
258 | 258 | ||
259 | BUG_ON(! of_device_is_compatible(node, "ibm,uic")); | 259 | BUG_ON(! of_device_is_compatible(node, "ibm,uic")); |
260 | 260 | ||
261 | uic = alloc_bootmem(sizeof(*uic)); | 261 | uic = kzalloc(sizeof(*uic), GFP_KERNEL); |
262 | if (! uic) | 262 | if (! uic) |
263 | return NULL; /* FIXME: panic? */ | 263 | return NULL; /* FIXME: panic? */ |
264 | 264 | ||
265 | memset(uic, 0, sizeof(*uic)); | ||
266 | spin_lock_init(&uic->lock); | 265 | spin_lock_init(&uic->lock); |
267 | indexp = of_get_property(node, "cell-index", &len); | 266 | indexp = of_get_property(node, "cell-index", &len); |
268 | if (!indexp || (len != sizeof(u32))) { | 267 | if (!indexp || (len != sizeof(u32))) { |
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index e577839f3073..2ae5d72f47ed 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig | |||
@@ -95,6 +95,11 @@ config S390 | |||
95 | select HAVE_ARCH_TRACEHOOK | 95 | select HAVE_ARCH_TRACEHOOK |
96 | select INIT_ALL_POSSIBLE | 96 | select INIT_ALL_POSSIBLE |
97 | select HAVE_PERF_COUNTERS | 97 | select HAVE_PERF_COUNTERS |
98 | select GENERIC_ATOMIC64 if !64BIT | ||
99 | |||
100 | config SCHED_OMIT_FRAME_POINTER | ||
101 | bool | ||
102 | default y | ||
98 | 103 | ||
99 | source "init/Kconfig" | 104 | source "init/Kconfig" |
100 | 105 | ||
@@ -116,6 +121,9 @@ config 32BIT | |||
116 | bool | 121 | bool |
117 | default y if !64BIT | 122 | default y if !64BIT |
118 | 123 | ||
124 | config KTIME_SCALAR | ||
125 | def_bool 32BIT | ||
126 | |||
119 | config SMP | 127 | config SMP |
120 | bool "Symmetric multi-processing support" | 128 | bool "Symmetric multi-processing support" |
121 | ---help--- | 129 | ---help--- |
diff --git a/arch/s390/include/asm/atomic.h b/arch/s390/include/asm/atomic.h index fca9dffcc669..c7d0abfb0f00 100644 --- a/arch/s390/include/asm/atomic.h +++ b/arch/s390/include/asm/atomic.h | |||
@@ -268,7 +268,12 @@ static __inline__ int atomic64_add_unless(atomic64_t *v, | |||
268 | #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) | 268 | #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0) |
269 | 269 | ||
270 | #undef __CSG_LOOP | 270 | #undef __CSG_LOOP |
271 | #endif | 271 | |
272 | #else /* __s390x__ */ | ||
273 | |||
274 | #include <asm-generic/atomic64.h> | ||
275 | |||
276 | #endif /* __s390x__ */ | ||
272 | 277 | ||
273 | #define smp_mb__before_atomic_dec() smp_mb() | 278 | #define smp_mb__before_atomic_dec() smp_mb() |
274 | #define smp_mb__after_atomic_dec() smp_mb() | 279 | #define smp_mb__after_atomic_dec() smp_mb() |
diff --git a/arch/s390/include/asm/perf_counter.h b/arch/s390/include/asm/perf_counter.h index a7205a3828cb..7015188c2cc2 100644 --- a/arch/s390/include/asm/perf_counter.h +++ b/arch/s390/include/asm/perf_counter.h | |||
@@ -6,3 +6,5 @@ | |||
6 | 6 | ||
7 | static inline void set_perf_counter_pending(void) {} | 7 | static inline void set_perf_counter_pending(void) {} |
8 | static inline void clear_perf_counter_pending(void) {} | 8 | static inline void clear_perf_counter_pending(void) {} |
9 | |||
10 | #define PERF_COUNTER_INDEX_OFFSET 0 | ||
diff --git a/arch/s390/include/asm/thread_info.h b/arch/s390/include/asm/thread_info.h index 925bcc649035..ba1cab9fc1f9 100644 --- a/arch/s390/include/asm/thread_info.h +++ b/arch/s390/include/asm/thread_info.h | |||
@@ -61,7 +61,7 @@ struct thread_info { | |||
61 | .exec_domain = &default_exec_domain, \ | 61 | .exec_domain = &default_exec_domain, \ |
62 | .flags = 0, \ | 62 | .flags = 0, \ |
63 | .cpu = 0, \ | 63 | .cpu = 0, \ |
64 | .preempt_count = 1, \ | 64 | .preempt_count = INIT_PREEMPT_COUNT, \ |
65 | .restart_block = { \ | 65 | .restart_block = { \ |
66 | .fn = do_no_restart_syscall, \ | 66 | .fn = do_no_restart_syscall, \ |
67 | }, \ | 67 | }, \ |
diff --git a/arch/s390/kernel/dis.c b/arch/s390/kernel/dis.c index d2f270c995d9..db943a7ec513 100644 --- a/arch/s390/kernel/dis.c +++ b/arch/s390/kernel/dis.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/timer.h> | 15 | #include <linux/timer.h> |
16 | #include <linux/mm.h> | 16 | #include <linux/mm.h> |
17 | #include <linux/smp.h> | 17 | #include <linux/smp.h> |
18 | #include <linux/smp_lock.h> | ||
19 | #include <linux/init.h> | 18 | #include <linux/init.h> |
20 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
21 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
diff --git a/arch/s390/kernel/ipl.c b/arch/s390/kernel/ipl.c index b8bf4b140065..371a2d88f4ac 100644 --- a/arch/s390/kernel/ipl.c +++ b/arch/s390/kernel/ipl.c | |||
@@ -70,6 +70,7 @@ struct shutdown_action { | |||
70 | char *name; | 70 | char *name; |
71 | void (*fn) (struct shutdown_trigger *trigger); | 71 | void (*fn) (struct shutdown_trigger *trigger); |
72 | int (*init) (void); | 72 | int (*init) (void); |
73 | int init_rc; | ||
73 | }; | 74 | }; |
74 | 75 | ||
75 | static char *ipl_type_str(enum ipl_type type) | 76 | static char *ipl_type_str(enum ipl_type type) |
@@ -1486,11 +1487,13 @@ static int set_trigger(const char *buf, struct shutdown_trigger *trigger, | |||
1486 | int i; | 1487 | int i; |
1487 | 1488 | ||
1488 | for (i = 0; i < SHUTDOWN_ACTIONS_COUNT; i++) { | 1489 | for (i = 0; i < SHUTDOWN_ACTIONS_COUNT; i++) { |
1489 | if (!shutdown_actions_list[i]) | ||
1490 | continue; | ||
1491 | if (sysfs_streq(buf, shutdown_actions_list[i]->name)) { | 1490 | if (sysfs_streq(buf, shutdown_actions_list[i]->name)) { |
1492 | trigger->action = shutdown_actions_list[i]; | 1491 | if (shutdown_actions_list[i]->init_rc) { |
1493 | return len; | 1492 | return shutdown_actions_list[i]->init_rc; |
1493 | } else { | ||
1494 | trigger->action = shutdown_actions_list[i]; | ||
1495 | return len; | ||
1496 | } | ||
1494 | } | 1497 | } |
1495 | } | 1498 | } |
1496 | return -EINVAL; | 1499 | return -EINVAL; |
@@ -1640,8 +1643,8 @@ static void __init shutdown_actions_init(void) | |||
1640 | for (i = 0; i < SHUTDOWN_ACTIONS_COUNT; i++) { | 1643 | for (i = 0; i < SHUTDOWN_ACTIONS_COUNT; i++) { |
1641 | if (!shutdown_actions_list[i]->init) | 1644 | if (!shutdown_actions_list[i]->init) |
1642 | continue; | 1645 | continue; |
1643 | if (shutdown_actions_list[i]->init()) | 1646 | shutdown_actions_list[i]->init_rc = |
1644 | shutdown_actions_list[i] = NULL; | 1647 | shutdown_actions_list[i]->init(); |
1645 | } | 1648 | } |
1646 | } | 1649 | } |
1647 | 1650 | ||
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c index 490b39934d65..43acd73105b7 100644 --- a/arch/s390/kernel/ptrace.c +++ b/arch/s390/kernel/ptrace.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/sched.h> | 26 | #include <linux/sched.h> |
27 | #include <linux/mm.h> | 27 | #include <linux/mm.h> |
28 | #include <linux/smp.h> | 28 | #include <linux/smp.h> |
29 | #include <linux/smp_lock.h> | ||
30 | #include <linux/errno.h> | 29 | #include <linux/errno.h> |
31 | #include <linux/ptrace.h> | 30 | #include <linux/ptrace.h> |
32 | #include <linux/user.h> | 31 | #include <linux/user.h> |
diff --git a/arch/s390/lib/Makefile b/arch/s390/lib/Makefile index ab6735df2d21..97975ec7a274 100644 --- a/arch/s390/lib/Makefile +++ b/arch/s390/lib/Makefile | |||
@@ -3,6 +3,6 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | lib-y += delay.o string.o uaccess_std.o uaccess_pt.o | 5 | lib-y += delay.o string.o uaccess_std.o uaccess_pt.o |
6 | obj-$(CONFIG_32BIT) += div64.o qrnnd.o | 6 | obj-$(CONFIG_32BIT) += div64.o qrnnd.o ucmpdi2.o |
7 | lib-$(CONFIG_64BIT) += uaccess_mvcos.o | 7 | lib-$(CONFIG_64BIT) += uaccess_mvcos.o |
8 | lib-$(CONFIG_SMP) += spinlock.o | 8 | lib-$(CONFIG_SMP) += spinlock.o |
diff --git a/arch/s390/lib/delay.c b/arch/s390/lib/delay.c index 3f5f680726ed..97c1eca83cc2 100644 --- a/arch/s390/lib/delay.c +++ b/arch/s390/lib/delay.c | |||
@@ -36,9 +36,11 @@ static void __udelay_disabled(unsigned long usecs) | |||
36 | cr0 = (cr0_saved & 0xffff00e0) | 0x00000800; | 36 | cr0 = (cr0_saved & 0xffff00e0) | 0x00000800; |
37 | __ctl_load(cr0 , 0, 0); | 37 | __ctl_load(cr0 , 0, 0); |
38 | mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_EXT; | 38 | mask = psw_kernel_bits | PSW_MASK_WAIT | PSW_MASK_EXT; |
39 | lockdep_off(); | ||
39 | trace_hardirqs_on(); | 40 | trace_hardirqs_on(); |
40 | __load_psw_mask(mask); | 41 | __load_psw_mask(mask); |
41 | local_irq_disable(); | 42 | local_irq_disable(); |
43 | lockdep_on(); | ||
42 | __ctl_load(cr0_saved, 0, 0); | 44 | __ctl_load(cr0_saved, 0, 0); |
43 | local_tick_enable(clock_saved); | 45 | local_tick_enable(clock_saved); |
44 | set_clock_comparator(S390_lowcore.clock_comparator); | 46 | set_clock_comparator(S390_lowcore.clock_comparator); |
diff --git a/arch/s390/lib/ucmpdi2.c b/arch/s390/lib/ucmpdi2.c new file mode 100644 index 000000000000..3e05ff532582 --- /dev/null +++ b/arch/s390/lib/ucmpdi2.c | |||
@@ -0,0 +1,26 @@ | |||
1 | #include <linux/module.h> | ||
2 | |||
3 | union ull_union { | ||
4 | unsigned long long ull; | ||
5 | struct { | ||
6 | unsigned int high; | ||
7 | unsigned int low; | ||
8 | } ui; | ||
9 | }; | ||
10 | |||
11 | int __ucmpdi2(unsigned long long a, unsigned long long b) | ||
12 | { | ||
13 | union ull_union au = {.ull = a}; | ||
14 | union ull_union bu = {.ull = b}; | ||
15 | |||
16 | if (au.ui.high < bu.ui.high) | ||
17 | return 0; | ||
18 | else if (au.ui.high > bu.ui.high) | ||
19 | return 2; | ||
20 | if (au.ui.low < bu.ui.low) | ||
21 | return 0; | ||
22 | else if (au.ui.low > bu.ui.low) | ||
23 | return 2; | ||
24 | return 1; | ||
25 | } | ||
26 | EXPORT_SYMBOL(__ucmpdi2); | ||
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c index 74eb26bf1970..e5e119fe03b2 100644 --- a/arch/s390/mm/fault.c +++ b/arch/s390/mm/fault.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/compat.h> | 22 | #include <linux/compat.h> |
23 | #include <linux/smp.h> | 23 | #include <linux/smp.h> |
24 | #include <linux/kdebug.h> | 24 | #include <linux/kdebug.h> |
25 | #include <linux/smp_lock.h> | ||
26 | #include <linux/init.h> | 25 | #include <linux/init.h> |
27 | #include <linux/console.h> | 26 | #include <linux/console.h> |
28 | #include <linux/module.h> | 27 | #include <linux/module.h> |
diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c index c050a8d76dfd..8fed45a2fb85 100644 --- a/arch/sh/boards/mach-se/7724/setup.c +++ b/arch/sh/boards/mach-se/7724/setup.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/smc91x.h> | 19 | #include <linux/smc91x.h> |
20 | #include <linux/gpio.h> | 20 | #include <linux/gpio.h> |
21 | #include <linux/input.h> | 21 | #include <linux/input.h> |
22 | #include <linux/usb/r8a66597.h> | ||
22 | #include <video/sh_mobile_lcdc.h> | 23 | #include <video/sh_mobile_lcdc.h> |
23 | #include <media/sh_mobile_ceu.h> | 24 | #include <media/sh_mobile_ceu.h> |
24 | #include <asm/io.h> | 25 | #include <asm/io.h> |
@@ -302,6 +303,34 @@ static struct platform_device sh_eth_device = { | |||
302 | .resource = sh_eth_resources, | 303 | .resource = sh_eth_resources, |
303 | }; | 304 | }; |
304 | 305 | ||
306 | static struct r8a66597_platdata sh7724_usb0_host_data = { | ||
307 | }; | ||
308 | |||
309 | static struct resource sh7724_usb0_host_resources[] = { | ||
310 | [0] = { | ||
311 | .start = 0xa4d80000, | ||
312 | .end = 0xa4d800ff, | ||
313 | .flags = IORESOURCE_MEM, | ||
314 | }, | ||
315 | [1] = { | ||
316 | .start = 65, | ||
317 | .end = 65, | ||
318 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW, | ||
319 | }, | ||
320 | }; | ||
321 | |||
322 | static struct platform_device sh7724_usb0_host_device = { | ||
323 | .name = "r8a66597_hcd", | ||
324 | .id = 0, | ||
325 | .dev = { | ||
326 | .dma_mask = NULL, /* not use dma */ | ||
327 | .coherent_dma_mask = 0xffffffff, | ||
328 | .platform_data = &sh7724_usb0_host_data, | ||
329 | }, | ||
330 | .num_resources = ARRAY_SIZE(sh7724_usb0_host_resources), | ||
331 | .resource = sh7724_usb0_host_resources, | ||
332 | }; | ||
333 | |||
305 | static struct platform_device *ms7724se_devices[] __initdata = { | 334 | static struct platform_device *ms7724se_devices[] __initdata = { |
306 | &heartbeat_device, | 335 | &heartbeat_device, |
307 | &smc91x_eth_device, | 336 | &smc91x_eth_device, |
@@ -311,6 +340,7 @@ static struct platform_device *ms7724se_devices[] __initdata = { | |||
311 | &ceu1_device, | 340 | &ceu1_device, |
312 | &keysc_device, | 341 | &keysc_device, |
313 | &sh_eth_device, | 342 | &sh_eth_device, |
343 | &sh7724_usb0_host_device, | ||
314 | }; | 344 | }; |
315 | 345 | ||
316 | #define EEPROM_OP 0xBA206000 | 346 | #define EEPROM_OP 0xBA206000 |
@@ -364,6 +394,7 @@ static void __init sh_eth_init(void) | |||
364 | #define SW4140 0xBA201000 | 394 | #define SW4140 0xBA201000 |
365 | #define FPGA_OUT 0xBA200400 | 395 | #define FPGA_OUT 0xBA200400 |
366 | #define PORT_HIZA 0xA4050158 | 396 | #define PORT_HIZA 0xA4050158 |
397 | #define PORT_MSELCRB 0xA4050182 | ||
367 | 398 | ||
368 | #define SW41_A 0x0100 | 399 | #define SW41_A 0x0100 |
369 | #define SW41_B 0x0200 | 400 | #define SW41_B 0x0200 |
@@ -373,6 +404,7 @@ static void __init sh_eth_init(void) | |||
373 | #define SW41_F 0x2000 | 404 | #define SW41_F 0x2000 |
374 | #define SW41_G 0x4000 | 405 | #define SW41_G 0x4000 |
375 | #define SW41_H 0x8000 | 406 | #define SW41_H 0x8000 |
407 | |||
376 | static int __init devices_setup(void) | 408 | static int __init devices_setup(void) |
377 | { | 409 | { |
378 | u16 sw = ctrl_inw(SW4140); /* select camera, monitor */ | 410 | u16 sw = ctrl_inw(SW4140); /* select camera, monitor */ |
@@ -385,6 +417,12 @@ static int __init devices_setup(void) | |||
385 | (1 << 14)), /* RMII */ | 417 | (1 << 14)), /* RMII */ |
386 | FPGA_OUT); | 418 | FPGA_OUT); |
387 | 419 | ||
420 | /* turn on USB clocks, use external clock */ | ||
421 | ctrl_outw((ctrl_inw(PORT_MSELCRB) & ~0xc000) | 0x8000, PORT_MSELCRB); | ||
422 | |||
423 | /* enable USB0 port */ | ||
424 | ctrl_outw(0x0600, 0xa40501d4); | ||
425 | |||
388 | /* enable IRQ 0,1,2 */ | 426 | /* enable IRQ 0,1,2 */ |
389 | gpio_request(GPIO_FN_INTC_IRQ0, NULL); | 427 | gpio_request(GPIO_FN_INTC_IRQ0, NULL); |
390 | gpio_request(GPIO_FN_INTC_IRQ1, NULL); | 428 | gpio_request(GPIO_FN_INTC_IRQ1, NULL); |
diff --git a/arch/sh/include/asm/perf_counter.h b/arch/sh/include/asm/perf_counter.h index 61c2b40c802c..d8e6bb9c0ccc 100644 --- a/arch/sh/include/asm/perf_counter.h +++ b/arch/sh/include/asm/perf_counter.h | |||
@@ -4,4 +4,6 @@ | |||
4 | /* SH only supports software counters through this interface. */ | 4 | /* SH only supports software counters through this interface. */ |
5 | static inline void set_perf_counter_pending(void) {} | 5 | static inline void set_perf_counter_pending(void) {} |
6 | 6 | ||
7 | #define PERF_COUNTER_INDEX_OFFSET 0 | ||
8 | |||
7 | #endif /* __ASM_SH_PERF_COUNTER_H */ | 9 | #endif /* __ASM_SH_PERF_COUNTER_H */ |
diff --git a/arch/sh/include/asm/thread_info.h b/arch/sh/include/asm/thread_info.h index f09ac4806294..d570ac2e5cb9 100644 --- a/arch/sh/include/asm/thread_info.h +++ b/arch/sh/include/asm/thread_info.h | |||
@@ -51,7 +51,7 @@ struct thread_info { | |||
51 | .exec_domain = &default_exec_domain, \ | 51 | .exec_domain = &default_exec_domain, \ |
52 | .flags = 0, \ | 52 | .flags = 0, \ |
53 | .cpu = 0, \ | 53 | .cpu = 0, \ |
54 | .preempt_count = 1, \ | 54 | .preempt_count = INIT_PREEMPT_COUNT, \ |
55 | .addr_limit = KERNEL_DS, \ | 55 | .addr_limit = KERNEL_DS, \ |
56 | .restart_block = { \ | 56 | .restart_block = { \ |
57 | .fn = do_no_restart_syscall, \ | 57 | .fn = do_no_restart_syscall, \ |
diff --git a/arch/sh/mm/tlb-sh3.c b/arch/sh/mm/tlb-sh3.c index 7fbfd5a11ffa..17cb7c3adf22 100644 --- a/arch/sh/mm/tlb-sh3.c +++ b/arch/sh/mm/tlb-sh3.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/mman.h> | 18 | #include <linux/mman.h> |
19 | #include <linux/mm.h> | 19 | #include <linux/mm.h> |
20 | #include <linux/smp.h> | 20 | #include <linux/smp.h> |
21 | #include <linux/smp_lock.h> | ||
22 | #include <linux/interrupt.h> | 21 | #include <linux/interrupt.h> |
23 | 22 | ||
24 | #include <asm/system.h> | 23 | #include <asm/system.h> |
diff --git a/arch/sparc/include/asm/thread_info_32.h b/arch/sparc/include/asm/thread_info_32.h index 0f7b0e5fb1c7..844d73a0340c 100644 --- a/arch/sparc/include/asm/thread_info_32.h +++ b/arch/sparc/include/asm/thread_info_32.h | |||
@@ -54,8 +54,6 @@ struct thread_info { | |||
54 | 54 | ||
55 | /* | 55 | /* |
56 | * macros/functions for gaining access to the thread information structure | 56 | * macros/functions for gaining access to the thread information structure |
57 | * | ||
58 | * preempt_count needs to be 1 initially, until the scheduler is functional. | ||
59 | */ | 57 | */ |
60 | #define INIT_THREAD_INFO(tsk) \ | 58 | #define INIT_THREAD_INFO(tsk) \ |
61 | { \ | 59 | { \ |
@@ -64,7 +62,7 @@ struct thread_info { | |||
64 | .exec_domain = &default_exec_domain, \ | 62 | .exec_domain = &default_exec_domain, \ |
65 | .flags = 0, \ | 63 | .flags = 0, \ |
66 | .cpu = 0, \ | 64 | .cpu = 0, \ |
67 | .preempt_count = 1, \ | 65 | .preempt_count = INIT_PREEMPT_COUNT, \ |
68 | .restart_block = { \ | 66 | .restart_block = { \ |
69 | .fn = do_no_restart_syscall, \ | 67 | .fn = do_no_restart_syscall, \ |
70 | }, \ | 68 | }, \ |
diff --git a/arch/sparc/include/asm/thread_info_64.h b/arch/sparc/include/asm/thread_info_64.h index 65865726b283..1b45a7bbe407 100644 --- a/arch/sparc/include/asm/thread_info_64.h +++ b/arch/sparc/include/asm/thread_info_64.h | |||
@@ -125,8 +125,6 @@ struct thread_info { | |||
125 | 125 | ||
126 | /* | 126 | /* |
127 | * macros/functions for gaining access to the thread information structure | 127 | * macros/functions for gaining access to the thread information structure |
128 | * | ||
129 | * preempt_count needs to be 1 initially, until the scheduler is functional. | ||
130 | */ | 128 | */ |
131 | #ifndef __ASSEMBLY__ | 129 | #ifndef __ASSEMBLY__ |
132 | 130 | ||
@@ -135,7 +133,7 @@ struct thread_info { | |||
135 | .task = &tsk, \ | 133 | .task = &tsk, \ |
136 | .flags = ((unsigned long)ASI_P) << TI_FLAG_CURRENT_DS_SHIFT, \ | 134 | .flags = ((unsigned long)ASI_P) << TI_FLAG_CURRENT_DS_SHIFT, \ |
137 | .exec_domain = &default_exec_domain, \ | 135 | .exec_domain = &default_exec_domain, \ |
138 | .preempt_count = 1, \ | 136 | .preempt_count = INIT_PREEMPT_COUNT, \ |
139 | .restart_block = { \ | 137 | .restart_block = { \ |
140 | .fn = do_no_restart_syscall, \ | 138 | .fn = do_no_restart_syscall, \ |
141 | }, \ | 139 | }, \ |
diff --git a/arch/sparc/kernel/ptrace_32.c b/arch/sparc/kernel/ptrace_32.c index 8ce6285a06d5..7e3dfd9bb97e 100644 --- a/arch/sparc/kernel/ptrace_32.c +++ b/arch/sparc/kernel/ptrace_32.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/ptrace.h> | 16 | #include <linux/ptrace.h> |
17 | #include <linux/user.h> | 17 | #include <linux/user.h> |
18 | #include <linux/smp.h> | 18 | #include <linux/smp.h> |
19 | #include <linux/smp_lock.h> | ||
20 | #include <linux/security.h> | 19 | #include <linux/security.h> |
21 | #include <linux/signal.h> | 20 | #include <linux/signal.h> |
22 | #include <linux/regset.h> | 21 | #include <linux/regset.h> |
diff --git a/arch/sparc/kernel/ptrace_64.c b/arch/sparc/kernel/ptrace_64.c index a941c610e7ce..4ae91dc2feb9 100644 --- a/arch/sparc/kernel/ptrace_64.c +++ b/arch/sparc/kernel/ptrace_64.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/ptrace.h> | 17 | #include <linux/ptrace.h> |
18 | #include <linux/user.h> | 18 | #include <linux/user.h> |
19 | #include <linux/smp.h> | 19 | #include <linux/smp.h> |
20 | #include <linux/smp_lock.h> | ||
21 | #include <linux/security.h> | 20 | #include <linux/security.h> |
22 | #include <linux/seccomp.h> | 21 | #include <linux/seccomp.h> |
23 | #include <linux/audit.h> | 22 | #include <linux/audit.h> |
diff --git a/arch/sparc/kernel/time_64.c b/arch/sparc/kernel/time_64.c index 5c12e79b4bdf..da1218e8ee87 100644 --- a/arch/sparc/kernel/time_64.c +++ b/arch/sparc/kernel/time_64.c | |||
@@ -11,7 +11,6 @@ | |||
11 | #include <linux/errno.h> | 11 | #include <linux/errno.h> |
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/sched.h> | 13 | #include <linux/sched.h> |
14 | #include <linux/smp_lock.h> | ||
15 | #include <linux/kernel.h> | 14 | #include <linux/kernel.h> |
16 | #include <linux/param.h> | 15 | #include <linux/param.h> |
17 | #include <linux/string.h> | 16 | #include <linux/string.h> |
diff --git a/arch/sparc/kernel/traps_32.c b/arch/sparc/kernel/traps_32.c index 358283341b47..c0490c7bbde0 100644 --- a/arch/sparc/kernel/traps_32.c +++ b/arch/sparc/kernel/traps_32.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/signal.h> | 14 | #include <linux/signal.h> |
15 | #include <linux/smp.h> | 15 | #include <linux/smp.h> |
16 | #include <linux/smp_lock.h> | ||
17 | #include <linux/kdebug.h> | 16 | #include <linux/kdebug.h> |
18 | 17 | ||
19 | #include <asm/delay.h> | 18 | #include <asm/delay.h> |
diff --git a/arch/sparc/kernel/vio.c b/arch/sparc/kernel/vio.c index 753d128ed158..c28c71449a6c 100644 --- a/arch/sparc/kernel/vio.c +++ b/arch/sparc/kernel/vio.c | |||
@@ -224,7 +224,12 @@ static struct vio_dev *vio_create_one(struct mdesc_handle *hp, u64 mp, | |||
224 | if (!strcmp(type, "domain-services-port")) | 224 | if (!strcmp(type, "domain-services-port")) |
225 | bus_id_name = "ds"; | 225 | bus_id_name = "ds"; |
226 | 226 | ||
227 | if (strlen(bus_id_name) >= BUS_ID_SIZE - 4) { | 227 | /* |
228 | * 20 char is the old driver-core name size limit, which is no more. | ||
229 | * This check can probably be removed after review and possible | ||
230 | * adaption of the vio users name length handling. | ||
231 | */ | ||
232 | if (strlen(bus_id_name) >= 20 - 4) { | ||
228 | printk(KERN_ERR "VIO: bus_id_name [%s] is too long.\n", | 233 | printk(KERN_ERR "VIO: bus_id_name [%s] is too long.\n", |
229 | bus_id_name); | 234 | bus_id_name); |
230 | return NULL; | 235 | return NULL; |
diff --git a/arch/um/include/asm/thread_info.h b/arch/um/include/asm/thread_info.h index 62274ab9471f..fd911f855367 100644 --- a/arch/um/include/asm/thread_info.h +++ b/arch/um/include/asm/thread_info.h | |||
@@ -32,7 +32,7 @@ struct thread_info { | |||
32 | .exec_domain = &default_exec_domain, \ | 32 | .exec_domain = &default_exec_domain, \ |
33 | .flags = 0, \ | 33 | .flags = 0, \ |
34 | .cpu = 0, \ | 34 | .cpu = 0, \ |
35 | .preempt_count = 1, \ | 35 | .preempt_count = INIT_PREEMPT_COUNT, \ |
36 | .addr_limit = KERNEL_DS, \ | 36 | .addr_limit = KERNEL_DS, \ |
37 | .restart_block = { \ | 37 | .restart_block = { \ |
38 | .fn = do_no_restart_syscall, \ | 38 | .fn = do_no_restart_syscall, \ |
diff --git a/arch/um/kernel/sysrq.c b/arch/um/kernel/sysrq.c index 56d43d0a3960..0960de54495a 100644 --- a/arch/um/kernel/sysrq.c +++ b/arch/um/kernel/sysrq.c | |||
@@ -70,8 +70,8 @@ void show_stack(struct task_struct *task, unsigned long *esp) | |||
70 | if (kstack_end(stack)) | 70 | if (kstack_end(stack)) |
71 | break; | 71 | break; |
72 | if (i && ((i % 8) == 0)) | 72 | if (i && ((i % 8) == 0)) |
73 | printk("\n" KERN_INFO " "); | 73 | printk(KERN_INFO " "); |
74 | printk("%08lx ", *stack++); | 74 | printk(KERN_CONT "%08lx ", *stack++); |
75 | } | 75 | } |
76 | 76 | ||
77 | show_trace(task, esp); | 77 | show_trace(task, esp); |
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index c07f72205909..738bdc6b0f8b 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig | |||
@@ -1913,6 +1913,18 @@ config DMAR_DEFAULT_ON | |||
1913 | recommended you say N here while the DMAR code remains | 1913 | recommended you say N here while the DMAR code remains |
1914 | experimental. | 1914 | experimental. |
1915 | 1915 | ||
1916 | config DMAR_BROKEN_GFX_WA | ||
1917 | def_bool n | ||
1918 | prompt "Workaround broken graphics drivers (going away soon)" | ||
1919 | depends on DMAR | ||
1920 | ---help--- | ||
1921 | Current Graphics drivers tend to use physical address | ||
1922 | for DMA and avoid using DMA APIs. Setting this config | ||
1923 | option permits the IOMMU driver to set a unity map for | ||
1924 | all the OS-visible memory. Hence the driver can continue | ||
1925 | to use physical addresses for DMA, at least until this | ||
1926 | option is removed in the 2.6.32 kernel. | ||
1927 | |||
1916 | config DMAR_FLOPPY_WA | 1928 | config DMAR_FLOPPY_WA |
1917 | def_bool y | 1929 | def_bool y |
1918 | depends on DMAR | 1930 | depends on DMAR |
diff --git a/arch/x86/boot/video-bios.c b/arch/x86/boot/video-bios.c index d660be492363..49e0c18833e0 100644 --- a/arch/x86/boot/video-bios.c +++ b/arch/x86/boot/video-bios.c | |||
@@ -37,14 +37,13 @@ static int set_bios_mode(u8 mode) | |||
37 | ireg.al = mode; /* AH=0x00 Set Video Mode */ | 37 | ireg.al = mode; /* AH=0x00 Set Video Mode */ |
38 | intcall(0x10, &ireg, NULL); | 38 | intcall(0x10, &ireg, NULL); |
39 | 39 | ||
40 | |||
41 | ireg.ah = 0x0f; /* Get Current Video Mode */ | 40 | ireg.ah = 0x0f; /* Get Current Video Mode */ |
42 | intcall(0x10, &ireg, &oreg); | 41 | intcall(0x10, &ireg, &oreg); |
43 | 42 | ||
44 | do_restore = 1; /* Assume video contents were lost */ | 43 | do_restore = 1; /* Assume video contents were lost */ |
45 | 44 | ||
46 | /* Not all BIOSes are clean with the top bit */ | 45 | /* Not all BIOSes are clean with the top bit */ |
47 | new_mode = ireg.al & 0x7f; | 46 | new_mode = oreg.al & 0x7f; |
48 | 47 | ||
49 | if (new_mode == mode) | 48 | if (new_mode == mode) |
50 | return 0; /* Mode change OK */ | 49 | return 0; /* Mode change OK */ |
diff --git a/arch/x86/boot/video-vesa.c b/arch/x86/boot/video-vesa.c index c700147d6ffb..275dd177f198 100644 --- a/arch/x86/boot/video-vesa.c +++ b/arch/x86/boot/video-vesa.c | |||
@@ -45,7 +45,7 @@ static int vesa_probe(void) | |||
45 | ireg.di = (size_t)&vginfo; | 45 | ireg.di = (size_t)&vginfo; |
46 | intcall(0x10, &ireg, &oreg); | 46 | intcall(0x10, &ireg, &oreg); |
47 | 47 | ||
48 | if (ireg.ax != 0x004f || | 48 | if (oreg.ax != 0x004f || |
49 | vginfo.signature != VESA_MAGIC || | 49 | vginfo.signature != VESA_MAGIC || |
50 | vginfo.version < 0x0102) | 50 | vginfo.version < 0x0102) |
51 | return 0; /* Not present */ | 51 | return 0; /* Not present */ |
@@ -70,7 +70,7 @@ static int vesa_probe(void) | |||
70 | ireg.di = (size_t)&vminfo; | 70 | ireg.di = (size_t)&vminfo; |
71 | intcall(0x10, &ireg, &oreg); | 71 | intcall(0x10, &ireg, &oreg); |
72 | 72 | ||
73 | if (ireg.ax != 0x004f) | 73 | if (oreg.ax != 0x004f) |
74 | continue; | 74 | continue; |
75 | 75 | ||
76 | if ((vminfo.mode_attr & 0x15) == 0x05) { | 76 | if ((vminfo.mode_attr & 0x15) == 0x05) { |
diff --git a/arch/x86/include/asm/atomic_32.h b/arch/x86/include/asm/atomic_32.h index 2503d4e64c2a..dc5a667ff791 100644 --- a/arch/x86/include/asm/atomic_32.h +++ b/arch/x86/include/asm/atomic_32.h | |||
@@ -19,7 +19,10 @@ | |||
19 | * | 19 | * |
20 | * Atomically reads the value of @v. | 20 | * Atomically reads the value of @v. |
21 | */ | 21 | */ |
22 | #define atomic_read(v) ((v)->counter) | 22 | static inline int atomic_read(const atomic_t *v) |
23 | { | ||
24 | return v->counter; | ||
25 | } | ||
23 | 26 | ||
24 | /** | 27 | /** |
25 | * atomic_set - set atomic variable | 28 | * atomic_set - set atomic variable |
@@ -28,7 +31,10 @@ | |||
28 | * | 31 | * |
29 | * Atomically sets the value of @v to @i. | 32 | * Atomically sets the value of @v to @i. |
30 | */ | 33 | */ |
31 | #define atomic_set(v, i) (((v)->counter) = (i)) | 34 | static inline void atomic_set(atomic_t *v, int i) |
35 | { | ||
36 | v->counter = i; | ||
37 | } | ||
32 | 38 | ||
33 | /** | 39 | /** |
34 | * atomic_add - add integer to atomic variable | 40 | * atomic_add - add integer to atomic variable |
@@ -200,8 +206,15 @@ static inline int atomic_sub_return(int i, atomic_t *v) | |||
200 | return atomic_add_return(-i, v); | 206 | return atomic_add_return(-i, v); |
201 | } | 207 | } |
202 | 208 | ||
203 | #define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), (old), (new))) | 209 | static inline int atomic_cmpxchg(atomic_t *v, int old, int new) |
204 | #define atomic_xchg(v, new) (xchg(&((v)->counter), (new))) | 210 | { |
211 | return cmpxchg(&v->counter, old, new); | ||
212 | } | ||
213 | |||
214 | static inline int atomic_xchg(atomic_t *v, int new) | ||
215 | { | ||
216 | return xchg(&v->counter, new); | ||
217 | } | ||
205 | 218 | ||
206 | /** | 219 | /** |
207 | * atomic_add_unless - add unless the number is already a given value | 220 | * atomic_add_unless - add unless the number is already a given value |
@@ -250,45 +263,12 @@ static inline int atomic_add_unless(atomic_t *v, int a, int u) | |||
250 | /* An 64bit atomic type */ | 263 | /* An 64bit atomic type */ |
251 | 264 | ||
252 | typedef struct { | 265 | typedef struct { |
253 | unsigned long long counter; | 266 | u64 __aligned(8) counter; |
254 | } atomic64_t; | 267 | } atomic64_t; |
255 | 268 | ||
256 | #define ATOMIC64_INIT(val) { (val) } | 269 | #define ATOMIC64_INIT(val) { (val) } |
257 | 270 | ||
258 | /** | 271 | extern u64 atomic64_cmpxchg(atomic64_t *ptr, u64 old_val, u64 new_val); |
259 | * atomic64_read - read atomic64 variable | ||
260 | * @ptr: pointer of type atomic64_t | ||
261 | * | ||
262 | * Atomically reads the value of @v. | ||
263 | * Doesn't imply a read memory barrier. | ||
264 | */ | ||
265 | #define __atomic64_read(ptr) ((ptr)->counter) | ||
266 | |||
267 | static inline unsigned long long | ||
268 | cmpxchg8b(unsigned long long *ptr, unsigned long long old, unsigned long long new) | ||
269 | { | ||
270 | asm volatile( | ||
271 | |||
272 | LOCK_PREFIX "cmpxchg8b (%[ptr])\n" | ||
273 | |||
274 | : "=A" (old) | ||
275 | |||
276 | : [ptr] "D" (ptr), | ||
277 | "A" (old), | ||
278 | "b" (ll_low(new)), | ||
279 | "c" (ll_high(new)) | ||
280 | |||
281 | : "memory"); | ||
282 | |||
283 | return old; | ||
284 | } | ||
285 | |||
286 | static inline unsigned long long | ||
287 | atomic64_cmpxchg(atomic64_t *ptr, unsigned long long old_val, | ||
288 | unsigned long long new_val) | ||
289 | { | ||
290 | return cmpxchg8b(&ptr->counter, old_val, new_val); | ||
291 | } | ||
292 | 272 | ||
293 | /** | 273 | /** |
294 | * atomic64_xchg - xchg atomic64 variable | 274 | * atomic64_xchg - xchg atomic64 variable |
@@ -298,18 +278,7 @@ atomic64_cmpxchg(atomic64_t *ptr, unsigned long long old_val, | |||
298 | * Atomically xchgs the value of @ptr to @new_val and returns | 278 | * Atomically xchgs the value of @ptr to @new_val and returns |
299 | * the old value. | 279 | * the old value. |
300 | */ | 280 | */ |
301 | 281 | extern u64 atomic64_xchg(atomic64_t *ptr, u64 new_val); | |
302 | static inline unsigned long long | ||
303 | atomic64_xchg(atomic64_t *ptr, unsigned long long new_val) | ||
304 | { | ||
305 | unsigned long long old_val; | ||
306 | |||
307 | do { | ||
308 | old_val = atomic_read(ptr); | ||
309 | } while (atomic64_cmpxchg(ptr, old_val, new_val) != old_val); | ||
310 | |||
311 | return old_val; | ||
312 | } | ||
313 | 282 | ||
314 | /** | 283 | /** |
315 | * atomic64_set - set atomic64 variable | 284 | * atomic64_set - set atomic64 variable |
@@ -318,10 +287,7 @@ atomic64_xchg(atomic64_t *ptr, unsigned long long new_val) | |||
318 | * | 287 | * |
319 | * Atomically sets the value of @ptr to @new_val. | 288 | * Atomically sets the value of @ptr to @new_val. |
320 | */ | 289 | */ |
321 | static inline void atomic64_set(atomic64_t *ptr, unsigned long long new_val) | 290 | extern void atomic64_set(atomic64_t *ptr, u64 new_val); |
322 | { | ||
323 | atomic64_xchg(ptr, new_val); | ||
324 | } | ||
325 | 291 | ||
326 | /** | 292 | /** |
327 | * atomic64_read - read atomic64 variable | 293 | * atomic64_read - read atomic64 variable |
@@ -329,17 +295,30 @@ static inline void atomic64_set(atomic64_t *ptr, unsigned long long new_val) | |||
329 | * | 295 | * |
330 | * Atomically reads the value of @ptr and returns it. | 296 | * Atomically reads the value of @ptr and returns it. |
331 | */ | 297 | */ |
332 | static inline unsigned long long atomic64_read(atomic64_t *ptr) | 298 | static inline u64 atomic64_read(atomic64_t *ptr) |
333 | { | 299 | { |
334 | unsigned long long curr_val; | 300 | u64 res; |
335 | 301 | ||
336 | do { | 302 | /* |
337 | curr_val = __atomic64_read(ptr); | 303 | * Note, we inline this atomic64_t primitive because |
338 | } while (atomic64_cmpxchg(ptr, curr_val, curr_val) != curr_val); | 304 | * it only clobbers EAX/EDX and leaves the others |
339 | 305 | * untouched. We also (somewhat subtly) rely on the | |
340 | return curr_val; | 306 | * fact that cmpxchg8b returns the current 64-bit value |
307 | * of the memory location we are touching: | ||
308 | */ | ||
309 | asm volatile( | ||
310 | "mov %%ebx, %%eax\n\t" | ||
311 | "mov %%ecx, %%edx\n\t" | ||
312 | LOCK_PREFIX "cmpxchg8b %1\n" | ||
313 | : "=&A" (res) | ||
314 | : "m" (*ptr) | ||
315 | ); | ||
316 | |||
317 | return res; | ||
341 | } | 318 | } |
342 | 319 | ||
320 | extern u64 atomic64_read(atomic64_t *ptr); | ||
321 | |||
343 | /** | 322 | /** |
344 | * atomic64_add_return - add and return | 323 | * atomic64_add_return - add and return |
345 | * @delta: integer value to add | 324 | * @delta: integer value to add |
@@ -347,34 +326,14 @@ static inline unsigned long long atomic64_read(atomic64_t *ptr) | |||
347 | * | 326 | * |
348 | * Atomically adds @delta to @ptr and returns @delta + *@ptr | 327 | * Atomically adds @delta to @ptr and returns @delta + *@ptr |
349 | */ | 328 | */ |
350 | static inline unsigned long long | 329 | extern u64 atomic64_add_return(u64 delta, atomic64_t *ptr); |
351 | atomic64_add_return(unsigned long long delta, atomic64_t *ptr) | ||
352 | { | ||
353 | unsigned long long old_val, new_val; | ||
354 | |||
355 | do { | ||
356 | old_val = atomic_read(ptr); | ||
357 | new_val = old_val + delta; | ||
358 | |||
359 | } while (atomic64_cmpxchg(ptr, old_val, new_val) != old_val); | ||
360 | |||
361 | return new_val; | ||
362 | } | ||
363 | |||
364 | static inline long atomic64_sub_return(unsigned long long delta, atomic64_t *ptr) | ||
365 | { | ||
366 | return atomic64_add_return(-delta, ptr); | ||
367 | } | ||
368 | 330 | ||
369 | static inline long atomic64_inc_return(atomic64_t *ptr) | 331 | /* |
370 | { | 332 | * Other variants with different arithmetic operators: |
371 | return atomic64_add_return(1, ptr); | 333 | */ |
372 | } | 334 | extern u64 atomic64_sub_return(u64 delta, atomic64_t *ptr); |
373 | 335 | extern u64 atomic64_inc_return(atomic64_t *ptr); | |
374 | static inline long atomic64_dec_return(atomic64_t *ptr) | 336 | extern u64 atomic64_dec_return(atomic64_t *ptr); |
375 | { | ||
376 | return atomic64_sub_return(1, ptr); | ||
377 | } | ||
378 | 337 | ||
379 | /** | 338 | /** |
380 | * atomic64_add - add integer to atomic64 variable | 339 | * atomic64_add - add integer to atomic64 variable |
@@ -383,10 +342,7 @@ static inline long atomic64_dec_return(atomic64_t *ptr) | |||
383 | * | 342 | * |
384 | * Atomically adds @delta to @ptr. | 343 | * Atomically adds @delta to @ptr. |
385 | */ | 344 | */ |
386 | static inline void atomic64_add(unsigned long long delta, atomic64_t *ptr) | 345 | extern void atomic64_add(u64 delta, atomic64_t *ptr); |
387 | { | ||
388 | atomic64_add_return(delta, ptr); | ||
389 | } | ||
390 | 346 | ||
391 | /** | 347 | /** |
392 | * atomic64_sub - subtract the atomic64 variable | 348 | * atomic64_sub - subtract the atomic64 variable |
@@ -395,10 +351,7 @@ static inline void atomic64_add(unsigned long long delta, atomic64_t *ptr) | |||
395 | * | 351 | * |
396 | * Atomically subtracts @delta from @ptr. | 352 | * Atomically subtracts @delta from @ptr. |
397 | */ | 353 | */ |
398 | static inline void atomic64_sub(unsigned long long delta, atomic64_t *ptr) | 354 | extern void atomic64_sub(u64 delta, atomic64_t *ptr); |
399 | { | ||
400 | atomic64_add(-delta, ptr); | ||
401 | } | ||
402 | 355 | ||
403 | /** | 356 | /** |
404 | * atomic64_sub_and_test - subtract value from variable and test result | 357 | * atomic64_sub_and_test - subtract value from variable and test result |
@@ -409,13 +362,7 @@ static inline void atomic64_sub(unsigned long long delta, atomic64_t *ptr) | |||
409 | * true if the result is zero, or false for all | 362 | * true if the result is zero, or false for all |
410 | * other cases. | 363 | * other cases. |
411 | */ | 364 | */ |
412 | static inline int | 365 | extern int atomic64_sub_and_test(u64 delta, atomic64_t *ptr); |
413 | atomic64_sub_and_test(unsigned long long delta, atomic64_t *ptr) | ||
414 | { | ||
415 | unsigned long long old_val = atomic64_sub_return(delta, ptr); | ||
416 | |||
417 | return old_val == 0; | ||
418 | } | ||
419 | 366 | ||
420 | /** | 367 | /** |
421 | * atomic64_inc - increment atomic64 variable | 368 | * atomic64_inc - increment atomic64 variable |
@@ -423,10 +370,7 @@ atomic64_sub_and_test(unsigned long long delta, atomic64_t *ptr) | |||
423 | * | 370 | * |
424 | * Atomically increments @ptr by 1. | 371 | * Atomically increments @ptr by 1. |
425 | */ | 372 | */ |
426 | static inline void atomic64_inc(atomic64_t *ptr) | 373 | extern void atomic64_inc(atomic64_t *ptr); |
427 | { | ||
428 | atomic64_add(1, ptr); | ||
429 | } | ||
430 | 374 | ||
431 | /** | 375 | /** |
432 | * atomic64_dec - decrement atomic64 variable | 376 | * atomic64_dec - decrement atomic64 variable |
@@ -434,10 +378,7 @@ static inline void atomic64_inc(atomic64_t *ptr) | |||
434 | * | 378 | * |
435 | * Atomically decrements @ptr by 1. | 379 | * Atomically decrements @ptr by 1. |
436 | */ | 380 | */ |
437 | static inline void atomic64_dec(atomic64_t *ptr) | 381 | extern void atomic64_dec(atomic64_t *ptr); |
438 | { | ||
439 | atomic64_sub(1, ptr); | ||
440 | } | ||
441 | 382 | ||
442 | /** | 383 | /** |
443 | * atomic64_dec_and_test - decrement and test | 384 | * atomic64_dec_and_test - decrement and test |
@@ -447,10 +388,7 @@ static inline void atomic64_dec(atomic64_t *ptr) | |||
447 | * returns true if the result is 0, or false for all other | 388 | * returns true if the result is 0, or false for all other |
448 | * cases. | 389 | * cases. |
449 | */ | 390 | */ |
450 | static inline int atomic64_dec_and_test(atomic64_t *ptr) | 391 | extern int atomic64_dec_and_test(atomic64_t *ptr); |
451 | { | ||
452 | return atomic64_sub_and_test(1, ptr); | ||
453 | } | ||
454 | 392 | ||
455 | /** | 393 | /** |
456 | * atomic64_inc_and_test - increment and test | 394 | * atomic64_inc_and_test - increment and test |
@@ -460,10 +398,7 @@ static inline int atomic64_dec_and_test(atomic64_t *ptr) | |||
460 | * and returns true if the result is zero, or false for all | 398 | * and returns true if the result is zero, or false for all |
461 | * other cases. | 399 | * other cases. |
462 | */ | 400 | */ |
463 | static inline int atomic64_inc_and_test(atomic64_t *ptr) | 401 | extern int atomic64_inc_and_test(atomic64_t *ptr); |
464 | { | ||
465 | return atomic64_sub_and_test(-1, ptr); | ||
466 | } | ||
467 | 402 | ||
468 | /** | 403 | /** |
469 | * atomic64_add_negative - add and test if negative | 404 | * atomic64_add_negative - add and test if negative |
@@ -474,13 +409,7 @@ static inline int atomic64_inc_and_test(atomic64_t *ptr) | |||
474 | * if the result is negative, or false when | 409 | * if the result is negative, or false when |
475 | * result is greater than or equal to zero. | 410 | * result is greater than or equal to zero. |
476 | */ | 411 | */ |
477 | static inline int | 412 | extern int atomic64_add_negative(u64 delta, atomic64_t *ptr); |
478 | atomic64_add_negative(unsigned long long delta, atomic64_t *ptr) | ||
479 | { | ||
480 | long long old_val = atomic64_add_return(delta, ptr); | ||
481 | |||
482 | return old_val < 0; | ||
483 | } | ||
484 | 413 | ||
485 | #include <asm-generic/atomic-long.h> | 414 | #include <asm-generic/atomic-long.h> |
486 | #endif /* _ASM_X86_ATOMIC_32_H */ | 415 | #endif /* _ASM_X86_ATOMIC_32_H */ |
diff --git a/arch/x86/include/asm/atomic_64.h b/arch/x86/include/asm/atomic_64.h index 0d6360220007..d605dc268e79 100644 --- a/arch/x86/include/asm/atomic_64.h +++ b/arch/x86/include/asm/atomic_64.h | |||
@@ -18,7 +18,10 @@ | |||
18 | * | 18 | * |
19 | * Atomically reads the value of @v. | 19 | * Atomically reads the value of @v. |
20 | */ | 20 | */ |
21 | #define atomic_read(v) ((v)->counter) | 21 | static inline int atomic_read(const atomic_t *v) |
22 | { | ||
23 | return v->counter; | ||
24 | } | ||
22 | 25 | ||
23 | /** | 26 | /** |
24 | * atomic_set - set atomic variable | 27 | * atomic_set - set atomic variable |
@@ -27,7 +30,10 @@ | |||
27 | * | 30 | * |
28 | * Atomically sets the value of @v to @i. | 31 | * Atomically sets the value of @v to @i. |
29 | */ | 32 | */ |
30 | #define atomic_set(v, i) (((v)->counter) = (i)) | 33 | static inline void atomic_set(atomic_t *v, int i) |
34 | { | ||
35 | v->counter = i; | ||
36 | } | ||
31 | 37 | ||
32 | /** | 38 | /** |
33 | * atomic_add - add integer to atomic variable | 39 | * atomic_add - add integer to atomic variable |
@@ -192,7 +198,10 @@ static inline int atomic_sub_return(int i, atomic_t *v) | |||
192 | * Atomically reads the value of @v. | 198 | * Atomically reads the value of @v. |
193 | * Doesn't imply a read memory barrier. | 199 | * Doesn't imply a read memory barrier. |
194 | */ | 200 | */ |
195 | #define atomic64_read(v) ((v)->counter) | 201 | static inline long atomic64_read(const atomic64_t *v) |
202 | { | ||
203 | return v->counter; | ||
204 | } | ||
196 | 205 | ||
197 | /** | 206 | /** |
198 | * atomic64_set - set atomic64 variable | 207 | * atomic64_set - set atomic64 variable |
@@ -201,7 +210,10 @@ static inline int atomic_sub_return(int i, atomic_t *v) | |||
201 | * | 210 | * |
202 | * Atomically sets the value of @v to @i. | 211 | * Atomically sets the value of @v to @i. |
203 | */ | 212 | */ |
204 | #define atomic64_set(v, i) (((v)->counter) = (i)) | 213 | static inline void atomic64_set(atomic64_t *v, long i) |
214 | { | ||
215 | v->counter = i; | ||
216 | } | ||
205 | 217 | ||
206 | /** | 218 | /** |
207 | * atomic64_add - add integer to atomic64 variable | 219 | * atomic64_add - add integer to atomic64 variable |
@@ -355,11 +367,25 @@ static inline long atomic64_sub_return(long i, atomic64_t *v) | |||
355 | #define atomic64_inc_return(v) (atomic64_add_return(1, (v))) | 367 | #define atomic64_inc_return(v) (atomic64_add_return(1, (v))) |
356 | #define atomic64_dec_return(v) (atomic64_sub_return(1, (v))) | 368 | #define atomic64_dec_return(v) (atomic64_sub_return(1, (v))) |
357 | 369 | ||
358 | #define atomic64_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), (old), (new))) | 370 | static inline long atomic64_cmpxchg(atomic64_t *v, long old, long new) |
359 | #define atomic64_xchg(v, new) (xchg(&((v)->counter), new)) | 371 | { |
372 | return cmpxchg(&v->counter, old, new); | ||
373 | } | ||
374 | |||
375 | static inline long atomic64_xchg(atomic64_t *v, long new) | ||
376 | { | ||
377 | return xchg(&v->counter, new); | ||
378 | } | ||
360 | 379 | ||
361 | #define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), (old), (new))) | 380 | static inline long atomic_cmpxchg(atomic_t *v, int old, int new) |
362 | #define atomic_xchg(v, new) (xchg(&((v)->counter), (new))) | 381 | { |
382 | return cmpxchg(&v->counter, old, new); | ||
383 | } | ||
384 | |||
385 | static inline long atomic_xchg(atomic_t *v, int new) | ||
386 | { | ||
387 | return xchg(&v->counter, new); | ||
388 | } | ||
363 | 389 | ||
364 | /** | 390 | /** |
365 | * atomic_add_unless - add unless the number is a given value | 391 | * atomic_add_unless - add unless the number is a given value |
diff --git a/arch/x86/include/asm/fixmap.h b/arch/x86/include/asm/fixmap.h index 2d81af3974a0..7b2d71df39a6 100644 --- a/arch/x86/include/asm/fixmap.h +++ b/arch/x86/include/asm/fixmap.h | |||
@@ -111,12 +111,9 @@ enum fixed_addresses { | |||
111 | #ifdef CONFIG_PARAVIRT | 111 | #ifdef CONFIG_PARAVIRT |
112 | FIX_PARAVIRT_BOOTMAP, | 112 | FIX_PARAVIRT_BOOTMAP, |
113 | #endif | 113 | #endif |
114 | FIX_TEXT_POKE0, /* reserve 2 pages for text_poke() */ | 114 | FIX_TEXT_POKE1, /* reserve 2 pages for text_poke() */ |
115 | FIX_TEXT_POKE1, | 115 | FIX_TEXT_POKE0, /* first page is last, because allocation is backward */ |
116 | __end_of_permanent_fixed_addresses, | 116 | __end_of_permanent_fixed_addresses, |
117 | #ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT | ||
118 | FIX_OHCI1394_BASE, | ||
119 | #endif | ||
120 | /* | 117 | /* |
121 | * 256 temporary boot-time mappings, used by early_ioremap(), | 118 | * 256 temporary boot-time mappings, used by early_ioremap(), |
122 | * before ioremap() is functional. | 119 | * before ioremap() is functional. |
@@ -129,6 +126,9 @@ enum fixed_addresses { | |||
129 | FIX_BTMAP_END = __end_of_permanent_fixed_addresses + 256 - | 126 | FIX_BTMAP_END = __end_of_permanent_fixed_addresses + 256 - |
130 | (__end_of_permanent_fixed_addresses & 255), | 127 | (__end_of_permanent_fixed_addresses & 255), |
131 | FIX_BTMAP_BEGIN = FIX_BTMAP_END + NR_FIX_BTMAPS*FIX_BTMAPS_SLOTS - 1, | 128 | FIX_BTMAP_BEGIN = FIX_BTMAP_END + NR_FIX_BTMAPS*FIX_BTMAPS_SLOTS - 1, |
129 | #ifdef CONFIG_PROVIDE_OHCI1394_DMA_INIT | ||
130 | FIX_OHCI1394_BASE, | ||
131 | #endif | ||
132 | #ifdef CONFIG_X86_32 | 132 | #ifdef CONFIG_X86_32 |
133 | FIX_WP_TEST, | 133 | FIX_WP_TEST, |
134 | #endif | 134 | #endif |
diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index 1692fb5050e3..6be7fc254b59 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h | |||
@@ -246,10 +246,6 @@ | |||
246 | #define MSR_IA32_MISC_ENABLE_TURBO_DISABLE (1ULL << 38) | 246 | #define MSR_IA32_MISC_ENABLE_TURBO_DISABLE (1ULL << 38) |
247 | #define MSR_IA32_MISC_ENABLE_IP_PREF_DISABLE (1ULL << 39) | 247 | #define MSR_IA32_MISC_ENABLE_IP_PREF_DISABLE (1ULL << 39) |
248 | 248 | ||
249 | /* Intel Model 6 */ | ||
250 | #define MSR_P6_EVNTSEL0 0x00000186 | ||
251 | #define MSR_P6_EVNTSEL1 0x00000187 | ||
252 | |||
253 | /* P4/Xeon+ specific */ | 249 | /* P4/Xeon+ specific */ |
254 | #define MSR_IA32_MCG_EAX 0x00000180 | 250 | #define MSR_IA32_MCG_EAX 0x00000180 |
255 | #define MSR_IA32_MCG_EBX 0x00000181 | 251 | #define MSR_IA32_MCG_EBX 0x00000181 |
diff --git a/arch/x86/include/asm/nmi.h b/arch/x86/include/asm/nmi.h index c97264409934..c86e5ed4af51 100644 --- a/arch/x86/include/asm/nmi.h +++ b/arch/x86/include/asm/nmi.h | |||
@@ -72,7 +72,6 @@ void lapic_watchdog_stop(void); | |||
72 | int lapic_watchdog_init(unsigned nmi_hz); | 72 | int lapic_watchdog_init(unsigned nmi_hz); |
73 | int lapic_wd_event(unsigned nmi_hz); | 73 | int lapic_wd_event(unsigned nmi_hz); |
74 | unsigned lapic_adjust_nmi_hz(unsigned hz); | 74 | unsigned lapic_adjust_nmi_hz(unsigned hz); |
75 | int lapic_watchdog_ok(void); | ||
76 | void disable_lapic_nmi_watchdog(void); | 75 | void disable_lapic_nmi_watchdog(void); |
77 | void enable_lapic_nmi_watchdog(void); | 76 | void enable_lapic_nmi_watchdog(void); |
78 | void stop_nmi(void); | 77 | void stop_nmi(void); |
diff --git a/arch/x86/include/asm/spinlock.h b/arch/x86/include/asm/spinlock.h index b7e5db876399..4e77853321db 100644 --- a/arch/x86/include/asm/spinlock.h +++ b/arch/x86/include/asm/spinlock.h | |||
@@ -302,4 +302,8 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw) | |||
302 | #define _raw_read_relax(lock) cpu_relax() | 302 | #define _raw_read_relax(lock) cpu_relax() |
303 | #define _raw_write_relax(lock) cpu_relax() | 303 | #define _raw_write_relax(lock) cpu_relax() |
304 | 304 | ||
305 | /* The {read|write|spin}_lock() on x86 are full memory barriers. */ | ||
306 | static inline void smp_mb__after_lock(void) { } | ||
307 | #define ARCH_HAS_SMP_MB_AFTER_LOCK | ||
308 | |||
305 | #endif /* _ASM_X86_SPINLOCK_H */ | 309 | #endif /* _ASM_X86_SPINLOCK_H */ |
diff --git a/arch/x86/include/asm/stacktrace.h b/arch/x86/include/asm/stacktrace.h index f517944b2b17..cf86a5e73815 100644 --- a/arch/x86/include/asm/stacktrace.h +++ b/arch/x86/include/asm/stacktrace.h | |||
@@ -3,6 +3,8 @@ | |||
3 | 3 | ||
4 | extern int kstack_depth_to_print; | 4 | extern int kstack_depth_to_print; |
5 | 5 | ||
6 | int x86_is_stack_id(int id, char *name); | ||
7 | |||
6 | /* Generic stack tracer with callbacks */ | 8 | /* Generic stack tracer with callbacks */ |
7 | 9 | ||
8 | struct stacktrace_ops { | 10 | struct stacktrace_ops { |
diff --git a/arch/x86/include/asm/thread_info.h b/arch/x86/include/asm/thread_info.h index b0783520988b..fad7d40b75f8 100644 --- a/arch/x86/include/asm/thread_info.h +++ b/arch/x86/include/asm/thread_info.h | |||
@@ -49,7 +49,7 @@ struct thread_info { | |||
49 | .exec_domain = &default_exec_domain, \ | 49 | .exec_domain = &default_exec_domain, \ |
50 | .flags = 0, \ | 50 | .flags = 0, \ |
51 | .cpu = 0, \ | 51 | .cpu = 0, \ |
52 | .preempt_count = 1, \ | 52 | .preempt_count = INIT_PREEMPT_COUNT, \ |
53 | .addr_limit = KERNEL_DS, \ | 53 | .addr_limit = KERNEL_DS, \ |
54 | .restart_block = { \ | 54 | .restart_block = { \ |
55 | .fn = do_no_restart_syscall, \ | 55 | .fn = do_no_restart_syscall, \ |
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index 6c327b852e23..430d5b24af7b 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile | |||
@@ -26,6 +26,8 @@ CFLAGS_tsc.o := $(nostackp) | |||
26 | CFLAGS_paravirt.o := $(nostackp) | 26 | CFLAGS_paravirt.o := $(nostackp) |
27 | GCOV_PROFILE_vsyscall_64.o := n | 27 | GCOV_PROFILE_vsyscall_64.o := n |
28 | GCOV_PROFILE_hpet.o := n | 28 | GCOV_PROFILE_hpet.o := n |
29 | GCOV_PROFILE_tsc.o := n | ||
30 | GCOV_PROFILE_paravirt.o := n | ||
29 | 31 | ||
30 | obj-y := process_$(BITS).o signal.o entry_$(BITS).o | 32 | obj-y := process_$(BITS).o signal.o entry_$(BITS).o |
31 | obj-y += traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o | 33 | obj-y += traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o |
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c index 9372f0406ad4..6c99f5037801 100644 --- a/arch/x86/kernel/amd_iommu.c +++ b/arch/x86/kernel/amd_iommu.c | |||
@@ -1192,7 +1192,7 @@ out: | |||
1192 | return 0; | 1192 | return 0; |
1193 | } | 1193 | } |
1194 | 1194 | ||
1195 | struct notifier_block device_nb = { | 1195 | static struct notifier_block device_nb = { |
1196 | .notifier_call = device_change_notifier, | 1196 | .notifier_call = device_change_notifier, |
1197 | }; | 1197 | }; |
1198 | 1198 | ||
@@ -1763,7 +1763,7 @@ static void *alloc_coherent(struct device *dev, size_t size, | |||
1763 | flag |= __GFP_ZERO; | 1763 | flag |= __GFP_ZERO; |
1764 | virt_addr = (void *)__get_free_pages(flag, get_order(size)); | 1764 | virt_addr = (void *)__get_free_pages(flag, get_order(size)); |
1765 | if (!virt_addr) | 1765 | if (!virt_addr) |
1766 | return 0; | 1766 | return NULL; |
1767 | 1767 | ||
1768 | paddr = virt_to_phys(virt_addr); | 1768 | paddr = virt_to_phys(virt_addr); |
1769 | 1769 | ||
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c index 10b2accd12ea..c1b17e97252e 100644 --- a/arch/x86/kernel/amd_iommu_init.c +++ b/arch/x86/kernel/amd_iommu_init.c | |||
@@ -472,6 +472,8 @@ static u8 * __init alloc_event_buffer(struct amd_iommu *iommu) | |||
472 | if (iommu->evt_buf == NULL) | 472 | if (iommu->evt_buf == NULL) |
473 | return NULL; | 473 | return NULL; |
474 | 474 | ||
475 | iommu->evt_buf_size = EVT_BUFFER_SIZE; | ||
476 | |||
475 | return iommu->evt_buf; | 477 | return iommu->evt_buf; |
476 | } | 478 | } |
477 | 479 | ||
@@ -691,6 +693,7 @@ static void __init init_iommu_from_acpi(struct amd_iommu *iommu, | |||
691 | 693 | ||
692 | devid = e->devid; | 694 | devid = e->devid; |
693 | devid_to = e->ext >> 8; | 695 | devid_to = e->ext >> 8; |
696 | set_dev_entry_from_acpi(iommu, devid , e->flags, 0); | ||
694 | set_dev_entry_from_acpi(iommu, devid_to, e->flags, 0); | 697 | set_dev_entry_from_acpi(iommu, devid_to, e->flags, 0); |
695 | amd_iommu_alias_table[devid] = devid_to; | 698 | amd_iommu_alias_table[devid] = devid_to; |
696 | break; | 699 | break; |
@@ -749,11 +752,13 @@ static void __init init_iommu_from_acpi(struct amd_iommu *iommu, | |||
749 | 752 | ||
750 | devid = e->devid; | 753 | devid = e->devid; |
751 | for (dev_i = devid_start; dev_i <= devid; ++dev_i) { | 754 | for (dev_i = devid_start; dev_i <= devid; ++dev_i) { |
752 | if (alias) | 755 | if (alias) { |
753 | amd_iommu_alias_table[dev_i] = devid_to; | 756 | amd_iommu_alias_table[dev_i] = devid_to; |
754 | set_dev_entry_from_acpi(iommu, | 757 | set_dev_entry_from_acpi(iommu, |
755 | amd_iommu_alias_table[dev_i], | 758 | devid_to, flags, ext_flags); |
756 | flags, ext_flags); | 759 | } |
760 | set_dev_entry_from_acpi(iommu, dev_i, | ||
761 | flags, ext_flags); | ||
757 | } | 762 | } |
758 | break; | 763 | break; |
759 | default: | 764 | default: |
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 8c7c042ecad1..0a1c2830ec66 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c | |||
@@ -140,7 +140,6 @@ int x2apic_mode; | |||
140 | #ifdef CONFIG_X86_X2APIC | 140 | #ifdef CONFIG_X86_X2APIC |
141 | /* x2apic enabled before OS handover */ | 141 | /* x2apic enabled before OS handover */ |
142 | static int x2apic_preenabled; | 142 | static int x2apic_preenabled; |
143 | static int disable_x2apic; | ||
144 | static __init int setup_nox2apic(char *str) | 143 | static __init int setup_nox2apic(char *str) |
145 | { | 144 | { |
146 | if (x2apic_enabled()) { | 145 | if (x2apic_enabled()) { |
@@ -149,7 +148,6 @@ static __init int setup_nox2apic(char *str) | |||
149 | return 0; | 148 | return 0; |
150 | } | 149 | } |
151 | 150 | ||
152 | disable_x2apic = 1; | ||
153 | setup_clear_cpu_cap(X86_FEATURE_X2APIC); | 151 | setup_clear_cpu_cap(X86_FEATURE_X2APIC); |
154 | return 0; | 152 | return 0; |
155 | } | 153 | } |
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c index 4d0216fcb36c..90b5e6efa938 100644 --- a/arch/x86/kernel/apic/io_apic.c +++ b/arch/x86/kernel/apic/io_apic.c | |||
@@ -1716,25 +1716,19 @@ __apicdebuginit(void) print_IO_APIC(void) | |||
1716 | return; | 1716 | return; |
1717 | } | 1717 | } |
1718 | 1718 | ||
1719 | __apicdebuginit(void) print_APIC_bitfield(int base) | 1719 | __apicdebuginit(void) print_APIC_field(int base) |
1720 | { | 1720 | { |
1721 | unsigned int v; | 1721 | int i; |
1722 | int i, j; | ||
1723 | 1722 | ||
1724 | if (apic_verbosity == APIC_QUIET) | 1723 | if (apic_verbosity == APIC_QUIET) |
1725 | return; | 1724 | return; |
1726 | 1725 | ||
1727 | printk(KERN_DEBUG "0123456789abcdef0123456789abcdef\n" KERN_DEBUG); | 1726 | printk(KERN_DEBUG); |
1728 | for (i = 0; i < 8; i++) { | 1727 | |
1729 | v = apic_read(base + i*0x10); | 1728 | for (i = 0; i < 8; i++) |
1730 | for (j = 0; j < 32; j++) { | 1729 | printk(KERN_CONT "%08x", apic_read(base + i*0x10)); |
1731 | if (v & (1<<j)) | 1730 | |
1732 | printk("1"); | 1731 | printk(KERN_CONT "\n"); |
1733 | else | ||
1734 | printk("0"); | ||
1735 | } | ||
1736 | printk("\n"); | ||
1737 | } | ||
1738 | } | 1732 | } |
1739 | 1733 | ||
1740 | __apicdebuginit(void) print_local_APIC(void *dummy) | 1734 | __apicdebuginit(void) print_local_APIC(void *dummy) |
@@ -1745,7 +1739,7 @@ __apicdebuginit(void) print_local_APIC(void *dummy) | |||
1745 | if (apic_verbosity == APIC_QUIET) | 1739 | if (apic_verbosity == APIC_QUIET) |
1746 | return; | 1740 | return; |
1747 | 1741 | ||
1748 | printk("\n" KERN_DEBUG "printing local APIC contents on CPU#%d/%d:\n", | 1742 | printk(KERN_DEBUG "printing local APIC contents on CPU#%d/%d:\n", |
1749 | smp_processor_id(), hard_smp_processor_id()); | 1743 | smp_processor_id(), hard_smp_processor_id()); |
1750 | v = apic_read(APIC_ID); | 1744 | v = apic_read(APIC_ID); |
1751 | printk(KERN_INFO "... APIC ID: %08x (%01x)\n", v, read_apic_id()); | 1745 | printk(KERN_INFO "... APIC ID: %08x (%01x)\n", v, read_apic_id()); |
@@ -1786,11 +1780,11 @@ __apicdebuginit(void) print_local_APIC(void *dummy) | |||
1786 | printk(KERN_DEBUG "... APIC SPIV: %08x\n", v); | 1780 | printk(KERN_DEBUG "... APIC SPIV: %08x\n", v); |
1787 | 1781 | ||
1788 | printk(KERN_DEBUG "... APIC ISR field:\n"); | 1782 | printk(KERN_DEBUG "... APIC ISR field:\n"); |
1789 | print_APIC_bitfield(APIC_ISR); | 1783 | print_APIC_field(APIC_ISR); |
1790 | printk(KERN_DEBUG "... APIC TMR field:\n"); | 1784 | printk(KERN_DEBUG "... APIC TMR field:\n"); |
1791 | print_APIC_bitfield(APIC_TMR); | 1785 | print_APIC_field(APIC_TMR); |
1792 | printk(KERN_DEBUG "... APIC IRR field:\n"); | 1786 | printk(KERN_DEBUG "... APIC IRR field:\n"); |
1793 | print_APIC_bitfield(APIC_IRR); | 1787 | print_APIC_field(APIC_IRR); |
1794 | 1788 | ||
1795 | if (APIC_INTEGRATED(ver)) { /* !82489DX */ | 1789 | if (APIC_INTEGRATED(ver)) { /* !82489DX */ |
1796 | if (maxlvt > 3) /* Due to the Pentium erratum 3AP. */ | 1790 | if (maxlvt > 3) /* Due to the Pentium erratum 3AP. */ |
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c index 81cbe64ed6b4..2a50ef891000 100644 --- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c +++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c | |||
@@ -299,7 +299,7 @@ static int transition_pstate(struct powernow_k8_data *data, u32 pstate) | |||
299 | static int transition_fid_vid(struct powernow_k8_data *data, | 299 | static int transition_fid_vid(struct powernow_k8_data *data, |
300 | u32 reqfid, u32 reqvid) | 300 | u32 reqfid, u32 reqvid) |
301 | { | 301 | { |
302 | if (core_voltage_pre_transition(data, reqvid)) | 302 | if (core_voltage_pre_transition(data, reqvid, reqfid)) |
303 | return 1; | 303 | return 1; |
304 | 304 | ||
305 | if (core_frequency_transition(data, reqfid)) | 305 | if (core_frequency_transition(data, reqfid)) |
@@ -327,17 +327,20 @@ static int transition_fid_vid(struct powernow_k8_data *data, | |||
327 | 327 | ||
328 | /* Phase 1 - core voltage transition ... setup voltage */ | 328 | /* Phase 1 - core voltage transition ... setup voltage */ |
329 | static int core_voltage_pre_transition(struct powernow_k8_data *data, | 329 | static int core_voltage_pre_transition(struct powernow_k8_data *data, |
330 | u32 reqvid) | 330 | u32 reqvid, u32 reqfid) |
331 | { | 331 | { |
332 | u32 rvosteps = data->rvo; | 332 | u32 rvosteps = data->rvo; |
333 | u32 savefid = data->currfid; | 333 | u32 savefid = data->currfid; |
334 | u32 maxvid, lo; | 334 | u32 maxvid, lo, rvomult = 1; |
335 | 335 | ||
336 | dprintk("ph1 (cpu%d): start, currfid 0x%x, currvid 0x%x, " | 336 | dprintk("ph1 (cpu%d): start, currfid 0x%x, currvid 0x%x, " |
337 | "reqvid 0x%x, rvo 0x%x\n", | 337 | "reqvid 0x%x, rvo 0x%x\n", |
338 | smp_processor_id(), | 338 | smp_processor_id(), |
339 | data->currfid, data->currvid, reqvid, data->rvo); | 339 | data->currfid, data->currvid, reqvid, data->rvo); |
340 | 340 | ||
341 | if ((savefid < LO_FID_TABLE_TOP) && (reqfid < LO_FID_TABLE_TOP)) | ||
342 | rvomult = 2; | ||
343 | rvosteps *= rvomult; | ||
341 | rdmsr(MSR_FIDVID_STATUS, lo, maxvid); | 344 | rdmsr(MSR_FIDVID_STATUS, lo, maxvid); |
342 | maxvid = 0x1f & (maxvid >> 16); | 345 | maxvid = 0x1f & (maxvid >> 16); |
343 | dprintk("ph1 maxvid=0x%x\n", maxvid); | 346 | dprintk("ph1 maxvid=0x%x\n", maxvid); |
@@ -351,7 +354,8 @@ static int core_voltage_pre_transition(struct powernow_k8_data *data, | |||
351 | return 1; | 354 | return 1; |
352 | } | 355 | } |
353 | 356 | ||
354 | while ((rvosteps > 0) && ((data->rvo + data->currvid) > reqvid)) { | 357 | while ((rvosteps > 0) && |
358 | ((rvomult * data->rvo + data->currvid) > reqvid)) { | ||
355 | if (data->currvid == maxvid) { | 359 | if (data->currvid == maxvid) { |
356 | rvosteps = 0; | 360 | rvosteps = 0; |
357 | } else { | 361 | } else { |
@@ -384,13 +388,6 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid) | |||
384 | u32 vcoreqfid, vcocurrfid, vcofiddiff; | 388 | u32 vcoreqfid, vcocurrfid, vcofiddiff; |
385 | u32 fid_interval, savevid = data->currvid; | 389 | u32 fid_interval, savevid = data->currvid; |
386 | 390 | ||
387 | if ((reqfid < HI_FID_TABLE_BOTTOM) && | ||
388 | (data->currfid < HI_FID_TABLE_BOTTOM)) { | ||
389 | printk(KERN_ERR PFX "ph2: illegal lo-lo transition " | ||
390 | "0x%x 0x%x\n", reqfid, data->currfid); | ||
391 | return 1; | ||
392 | } | ||
393 | |||
394 | if (data->currfid == reqfid) { | 391 | if (data->currfid == reqfid) { |
395 | printk(KERN_ERR PFX "ph2 null fid transition 0x%x\n", | 392 | printk(KERN_ERR PFX "ph2 null fid transition 0x%x\n", |
396 | data->currfid); | 393 | data->currfid); |
@@ -407,6 +404,9 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid) | |||
407 | vcofiddiff = vcocurrfid > vcoreqfid ? vcocurrfid - vcoreqfid | 404 | vcofiddiff = vcocurrfid > vcoreqfid ? vcocurrfid - vcoreqfid |
408 | : vcoreqfid - vcocurrfid; | 405 | : vcoreqfid - vcocurrfid; |
409 | 406 | ||
407 | if ((reqfid <= LO_FID_TABLE_TOP) && (data->currfid <= LO_FID_TABLE_TOP)) | ||
408 | vcofiddiff = 0; | ||
409 | |||
410 | while (vcofiddiff > 2) { | 410 | while (vcofiddiff > 2) { |
411 | (data->currfid & 1) ? (fid_interval = 1) : (fid_interval = 2); | 411 | (data->currfid & 1) ? (fid_interval = 1) : (fid_interval = 2); |
412 | 412 | ||
@@ -1081,14 +1081,6 @@ static int transition_frequency_fidvid(struct powernow_k8_data *data, | |||
1081 | return 0; | 1081 | return 0; |
1082 | } | 1082 | } |
1083 | 1083 | ||
1084 | if ((fid < HI_FID_TABLE_BOTTOM) && | ||
1085 | (data->currfid < HI_FID_TABLE_BOTTOM)) { | ||
1086 | printk(KERN_ERR PFX | ||
1087 | "ignoring illegal change in lo freq table-%x to 0x%x\n", | ||
1088 | data->currfid, fid); | ||
1089 | return 1; | ||
1090 | } | ||
1091 | |||
1092 | dprintk("cpu %d, changing to fid 0x%x, vid 0x%x\n", | 1084 | dprintk("cpu %d, changing to fid 0x%x, vid 0x%x\n", |
1093 | smp_processor_id(), fid, vid); | 1085 | smp_processor_id(), fid, vid); |
1094 | freqs.old = find_khz_freq_from_fid(data->currfid); | 1086 | freqs.old = find_khz_freq_from_fid(data->currfid); |
@@ -1267,7 +1259,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol) | |||
1267 | { | 1259 | { |
1268 | static const char ACPI_PSS_BIOS_BUG_MSG[] = | 1260 | static const char ACPI_PSS_BIOS_BUG_MSG[] = |
1269 | KERN_ERR FW_BUG PFX "No compatible ACPI _PSS objects found.\n" | 1261 | KERN_ERR FW_BUG PFX "No compatible ACPI _PSS objects found.\n" |
1270 | KERN_ERR FW_BUG PFX "Try again with latest BIOS.\n"; | 1262 | FW_BUG PFX "Try again with latest BIOS.\n"; |
1271 | struct powernow_k8_data *data; | 1263 | struct powernow_k8_data *data; |
1272 | struct init_on_cpu init_on_cpu; | 1264 | struct init_on_cpu init_on_cpu; |
1273 | int rc; | 1265 | int rc; |
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.h b/arch/x86/kernel/cpu/cpufreq/powernow-k8.h index c9c1190b5e1f..02ce824073cb 100644 --- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.h +++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.h | |||
@@ -215,7 +215,8 @@ struct pst_s { | |||
215 | 215 | ||
216 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "powernow-k8", msg) | 216 | #define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "powernow-k8", msg) |
217 | 217 | ||
218 | static int core_voltage_pre_transition(struct powernow_k8_data *data, u32 reqvid); | 218 | static int core_voltage_pre_transition(struct powernow_k8_data *data, |
219 | u32 reqvid, u32 regfid); | ||
219 | static int core_voltage_post_transition(struct powernow_k8_data *data, u32 reqvid); | 220 | static int core_voltage_post_transition(struct powernow_k8_data *data, u32 reqvid); |
220 | static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid); | 221 | static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid); |
221 | 222 | ||
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c index af425b83202b..484c1e5f658e 100644 --- a/arch/x86/kernel/cpu/mcheck/mce.c +++ b/arch/x86/kernel/cpu/mcheck/mce.c | |||
@@ -194,14 +194,14 @@ static void print_mce(struct mce *m) | |||
194 | m->cs, m->ip); | 194 | m->cs, m->ip); |
195 | if (m->cs == __KERNEL_CS) | 195 | if (m->cs == __KERNEL_CS) |
196 | print_symbol("{%s}", m->ip); | 196 | print_symbol("{%s}", m->ip); |
197 | printk("\n"); | 197 | printk(KERN_CONT "\n"); |
198 | } | 198 | } |
199 | printk(KERN_EMERG "TSC %llx ", m->tsc); | 199 | printk(KERN_EMERG "TSC %llx ", m->tsc); |
200 | if (m->addr) | 200 | if (m->addr) |
201 | printk("ADDR %llx ", m->addr); | 201 | printk(KERN_CONT "ADDR %llx ", m->addr); |
202 | if (m->misc) | 202 | if (m->misc) |
203 | printk("MISC %llx ", m->misc); | 203 | printk(KERN_CONT "MISC %llx ", m->misc); |
204 | printk("\n"); | 204 | printk(KERN_CONT "\n"); |
205 | printk(KERN_EMERG "PROCESSOR %u:%x TIME %llu SOCKET %u APIC %x\n", | 205 | printk(KERN_EMERG "PROCESSOR %u:%x TIME %llu SOCKET %u APIC %x\n", |
206 | m->cpuvendor, m->cpuid, m->time, m->socketid, | 206 | m->cpuvendor, m->cpuid, m->time, m->socketid, |
207 | m->apicid); | 207 | m->apicid); |
@@ -209,13 +209,13 @@ static void print_mce(struct mce *m) | |||
209 | 209 | ||
210 | static void print_mce_head(void) | 210 | static void print_mce_head(void) |
211 | { | 211 | { |
212 | printk(KERN_EMERG "\n" KERN_EMERG "HARDWARE ERROR\n"); | 212 | printk(KERN_EMERG "\nHARDWARE ERROR\n"); |
213 | } | 213 | } |
214 | 214 | ||
215 | static void print_mce_tail(void) | 215 | static void print_mce_tail(void) |
216 | { | 216 | { |
217 | printk(KERN_EMERG "This is not a software problem!\n" | 217 | printk(KERN_EMERG "This is not a software problem!\n" |
218 | KERN_EMERG "Run through mcelog --ascii to decode and contact your hardware vendor\n"); | 218 | "Run through mcelog --ascii to decode and contact your hardware vendor\n"); |
219 | } | 219 | } |
220 | 220 | ||
221 | #define PANIC_TIMEOUT 5 /* 5 seconds */ | 221 | #define PANIC_TIMEOUT 5 /* 5 seconds */ |
diff --git a/arch/x86/kernel/cpu/perf_counter.c b/arch/x86/kernel/cpu/perf_counter.c index d4cf4ce19aac..36c3dc7b8991 100644 --- a/arch/x86/kernel/cpu/perf_counter.c +++ b/arch/x86/kernel/cpu/perf_counter.c | |||
@@ -1561,6 +1561,7 @@ void callchain_store(struct perf_callchain_entry *entry, u64 ip) | |||
1561 | 1561 | ||
1562 | static DEFINE_PER_CPU(struct perf_callchain_entry, irq_entry); | 1562 | static DEFINE_PER_CPU(struct perf_callchain_entry, irq_entry); |
1563 | static DEFINE_PER_CPU(struct perf_callchain_entry, nmi_entry); | 1563 | static DEFINE_PER_CPU(struct perf_callchain_entry, nmi_entry); |
1564 | static DEFINE_PER_CPU(int, in_nmi_frame); | ||
1564 | 1565 | ||
1565 | 1566 | ||
1566 | static void | 1567 | static void |
@@ -1576,7 +1577,9 @@ static void backtrace_warning(void *data, char *msg) | |||
1576 | 1577 | ||
1577 | static int backtrace_stack(void *data, char *name) | 1578 | static int backtrace_stack(void *data, char *name) |
1578 | { | 1579 | { |
1579 | /* Process all stacks: */ | 1580 | per_cpu(in_nmi_frame, smp_processor_id()) = |
1581 | x86_is_stack_id(NMI_STACK, name); | ||
1582 | |||
1580 | return 0; | 1583 | return 0; |
1581 | } | 1584 | } |
1582 | 1585 | ||
@@ -1584,6 +1587,9 @@ static void backtrace_address(void *data, unsigned long addr, int reliable) | |||
1584 | { | 1587 | { |
1585 | struct perf_callchain_entry *entry = data; | 1588 | struct perf_callchain_entry *entry = data; |
1586 | 1589 | ||
1590 | if (per_cpu(in_nmi_frame, smp_processor_id())) | ||
1591 | return; | ||
1592 | |||
1587 | if (reliable) | 1593 | if (reliable) |
1588 | callchain_store(entry, addr); | 1594 | callchain_store(entry, addr); |
1589 | } | 1595 | } |
diff --git a/arch/x86/kernel/cpu/perfctr-watchdog.c b/arch/x86/kernel/cpu/perfctr-watchdog.c index 5c481f6205bf..e60ed740d2b3 100644 --- a/arch/x86/kernel/cpu/perfctr-watchdog.c +++ b/arch/x86/kernel/cpu/perfctr-watchdog.c | |||
@@ -803,8 +803,3 @@ int __kprobes lapic_wd_event(unsigned nmi_hz) | |||
803 | wd_ops->rearm(wd, nmi_hz); | 803 | wd_ops->rearm(wd, nmi_hz); |
804 | return 1; | 804 | return 1; |
805 | } | 805 | } |
806 | |||
807 | int lapic_watchdog_ok(void) | ||
808 | { | ||
809 | return wd_ops != NULL; | ||
810 | } | ||
diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c index d593cd1f58dc..bca5fba91c9e 100644 --- a/arch/x86/kernel/dumpstack_32.c +++ b/arch/x86/kernel/dumpstack_32.c | |||
@@ -19,6 +19,12 @@ | |||
19 | 19 | ||
20 | #include "dumpstack.h" | 20 | #include "dumpstack.h" |
21 | 21 | ||
22 | /* Just a stub for now */ | ||
23 | int x86_is_stack_id(int id, char *name) | ||
24 | { | ||
25 | return 0; | ||
26 | } | ||
27 | |||
22 | void dump_trace(struct task_struct *task, struct pt_regs *regs, | 28 | void dump_trace(struct task_struct *task, struct pt_regs *regs, |
23 | unsigned long *stack, unsigned long bp, | 29 | unsigned long *stack, unsigned long bp, |
24 | const struct stacktrace_ops *ops, void *data) | 30 | const struct stacktrace_ops *ops, void *data) |
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c index d35db5993fd6..54b0a3276766 100644 --- a/arch/x86/kernel/dumpstack_64.c +++ b/arch/x86/kernel/dumpstack_64.c | |||
@@ -19,10 +19,8 @@ | |||
19 | 19 | ||
20 | #include "dumpstack.h" | 20 | #include "dumpstack.h" |
21 | 21 | ||
22 | static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack, | 22 | |
23 | unsigned *usedp, char **idp) | 23 | static char x86_stack_ids[][8] = { |
24 | { | ||
25 | static char ids[][8] = { | ||
26 | [DEBUG_STACK - 1] = "#DB", | 24 | [DEBUG_STACK - 1] = "#DB", |
27 | [NMI_STACK - 1] = "NMI", | 25 | [NMI_STACK - 1] = "NMI", |
28 | [DOUBLEFAULT_STACK - 1] = "#DF", | 26 | [DOUBLEFAULT_STACK - 1] = "#DF", |
@@ -33,6 +31,15 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack, | |||
33 | N_EXCEPTION_STACKS + DEBUG_STKSZ / EXCEPTION_STKSZ - 2] = "#DB[?]" | 31 | N_EXCEPTION_STACKS + DEBUG_STKSZ / EXCEPTION_STKSZ - 2] = "#DB[?]" |
34 | #endif | 32 | #endif |
35 | }; | 33 | }; |
34 | |||
35 | int x86_is_stack_id(int id, char *name) | ||
36 | { | ||
37 | return x86_stack_ids[id - 1] == name; | ||
38 | } | ||
39 | |||
40 | static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack, | ||
41 | unsigned *usedp, char **idp) | ||
42 | { | ||
36 | unsigned k; | 43 | unsigned k; |
37 | 44 | ||
38 | /* | 45 | /* |
@@ -61,7 +68,7 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack, | |||
61 | if (*usedp & (1U << k)) | 68 | if (*usedp & (1U << k)) |
62 | break; | 69 | break; |
63 | *usedp |= 1U << k; | 70 | *usedp |= 1U << k; |
64 | *idp = ids[k]; | 71 | *idp = x86_stack_ids[k]; |
65 | return (unsigned long *)end; | 72 | return (unsigned long *)end; |
66 | } | 73 | } |
67 | /* | 74 | /* |
@@ -81,12 +88,13 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack, | |||
81 | do { | 88 | do { |
82 | ++j; | 89 | ++j; |
83 | end -= EXCEPTION_STKSZ; | 90 | end -= EXCEPTION_STKSZ; |
84 | ids[j][4] = '1' + (j - N_EXCEPTION_STACKS); | 91 | x86_stack_ids[j][4] = '1' + |
92 | (j - N_EXCEPTION_STACKS); | ||
85 | } while (stack < end - EXCEPTION_STKSZ); | 93 | } while (stack < end - EXCEPTION_STKSZ); |
86 | if (*usedp & (1U << j)) | 94 | if (*usedp & (1U << j)) |
87 | break; | 95 | break; |
88 | *usedp |= 1U << j; | 96 | *usedp |= 1U << j; |
89 | *idp = ids[j]; | 97 | *idp = x86_stack_ids[j]; |
90 | return (unsigned long *)end; | 98 | return (unsigned long *)end; |
91 | } | 99 | } |
92 | #endif | 100 | #endif |
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c index c4ca89d9aaf4..5cb5725b2bae 100644 --- a/arch/x86/kernel/e820.c +++ b/arch/x86/kernel/e820.c | |||
@@ -627,10 +627,9 @@ __init void e820_setup_gap(void) | |||
627 | #ifdef CONFIG_X86_64 | 627 | #ifdef CONFIG_X86_64 |
628 | if (!found) { | 628 | if (!found) { |
629 | gapstart = (max_pfn << PAGE_SHIFT) + 1024*1024; | 629 | gapstart = (max_pfn << PAGE_SHIFT) + 1024*1024; |
630 | printk(KERN_ERR "PCI: Warning: Cannot find a gap in the 32bit " | 630 | printk(KERN_ERR |
631 | "address range\n" | 631 | "PCI: Warning: Cannot find a gap in the 32bit address range\n" |
632 | KERN_ERR "PCI: Unassigned devices with 32bit resource " | 632 | "PCI: Unassigned devices with 32bit resource registers may break!\n"); |
633 | "registers may break!\n"); | ||
634 | } | 633 | } |
635 | #endif | 634 | #endif |
636 | 635 | ||
diff --git a/arch/x86/kernel/kvm.c b/arch/x86/kernel/kvm.c index a78ecad0c900..c664d515f613 100644 --- a/arch/x86/kernel/kvm.c +++ b/arch/x86/kernel/kvm.c | |||
@@ -200,7 +200,7 @@ static void kvm_leave_lazy_mmu(void) | |||
200 | state->mode = paravirt_get_lazy_mode(); | 200 | state->mode = paravirt_get_lazy_mode(); |
201 | } | 201 | } |
202 | 202 | ||
203 | static void paravirt_ops_setup(void) | 203 | static void __init paravirt_ops_setup(void) |
204 | { | 204 | { |
205 | pv_info.name = "KVM"; | 205 | pv_info.name = "KVM"; |
206 | pv_info.paravirt_enabled = 1; | 206 | pv_info.paravirt_enabled = 1; |
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c index cfd9f9063896..d2e56b8f48e7 100644 --- a/arch/x86/kernel/pci-gart_64.c +++ b/arch/x86/kernel/pci-gart_64.c | |||
@@ -675,7 +675,7 @@ static __init int init_k8_gatt(struct agp_kern_info *info) | |||
675 | nommu: | 675 | nommu: |
676 | /* Should not happen anymore */ | 676 | /* Should not happen anymore */ |
677 | printk(KERN_WARNING "PCI-DMA: More than 4GB of RAM and no IOMMU\n" | 677 | printk(KERN_WARNING "PCI-DMA: More than 4GB of RAM and no IOMMU\n" |
678 | KERN_WARNING "falling back to iommu=soft.\n"); | 678 | "falling back to iommu=soft.\n"); |
679 | return -1; | 679 | return -1; |
680 | } | 680 | } |
681 | 681 | ||
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile index f9d35632666b..07c31899c9c2 100644 --- a/arch/x86/lib/Makefile +++ b/arch/x86/lib/Makefile | |||
@@ -10,6 +10,7 @@ lib-y += usercopy_$(BITS).o getuser.o putuser.o | |||
10 | lib-y += memcpy_$(BITS).o | 10 | lib-y += memcpy_$(BITS).o |
11 | 11 | ||
12 | ifeq ($(CONFIG_X86_32),y) | 12 | ifeq ($(CONFIG_X86_32),y) |
13 | obj-y += atomic64_32.o | ||
13 | lib-y += checksum_32.o | 14 | lib-y += checksum_32.o |
14 | lib-y += strstr_32.o | 15 | lib-y += strstr_32.o |
15 | lib-y += semaphore_32.o string_32.o | 16 | lib-y += semaphore_32.o string_32.o |
diff --git a/arch/x86/lib/atomic64_32.c b/arch/x86/lib/atomic64_32.c new file mode 100644 index 000000000000..824fa0be55a3 --- /dev/null +++ b/arch/x86/lib/atomic64_32.c | |||
@@ -0,0 +1,230 @@ | |||
1 | #include <linux/compiler.h> | ||
2 | #include <linux/module.h> | ||
3 | #include <linux/types.h> | ||
4 | |||
5 | #include <asm/processor.h> | ||
6 | #include <asm/cmpxchg.h> | ||
7 | #include <asm/atomic.h> | ||
8 | |||
9 | static noinline u64 cmpxchg8b(u64 *ptr, u64 old, u64 new) | ||
10 | { | ||
11 | u32 low = new; | ||
12 | u32 high = new >> 32; | ||
13 | |||
14 | asm volatile( | ||
15 | LOCK_PREFIX "cmpxchg8b %1\n" | ||
16 | : "+A" (old), "+m" (*ptr) | ||
17 | : "b" (low), "c" (high) | ||
18 | ); | ||
19 | return old; | ||
20 | } | ||
21 | |||
22 | u64 atomic64_cmpxchg(atomic64_t *ptr, u64 old_val, u64 new_val) | ||
23 | { | ||
24 | return cmpxchg8b(&ptr->counter, old_val, new_val); | ||
25 | } | ||
26 | EXPORT_SYMBOL(atomic64_cmpxchg); | ||
27 | |||
28 | /** | ||
29 | * atomic64_xchg - xchg atomic64 variable | ||
30 | * @ptr: pointer to type atomic64_t | ||
31 | * @new_val: value to assign | ||
32 | * | ||
33 | * Atomically xchgs the value of @ptr to @new_val and returns | ||
34 | * the old value. | ||
35 | */ | ||
36 | u64 atomic64_xchg(atomic64_t *ptr, u64 new_val) | ||
37 | { | ||
38 | /* | ||
39 | * Try first with a (possibly incorrect) assumption about | ||
40 | * what we have there. We'll do two loops most likely, | ||
41 | * but we'll get an ownership MESI transaction straight away | ||
42 | * instead of a read transaction followed by a | ||
43 | * flush-for-ownership transaction: | ||
44 | */ | ||
45 | u64 old_val, real_val = 0; | ||
46 | |||
47 | do { | ||
48 | old_val = real_val; | ||
49 | |||
50 | real_val = atomic64_cmpxchg(ptr, old_val, new_val); | ||
51 | |||
52 | } while (real_val != old_val); | ||
53 | |||
54 | return old_val; | ||
55 | } | ||
56 | EXPORT_SYMBOL(atomic64_xchg); | ||
57 | |||
58 | /** | ||
59 | * atomic64_set - set atomic64 variable | ||
60 | * @ptr: pointer to type atomic64_t | ||
61 | * @new_val: value to assign | ||
62 | * | ||
63 | * Atomically sets the value of @ptr to @new_val. | ||
64 | */ | ||
65 | void atomic64_set(atomic64_t *ptr, u64 new_val) | ||
66 | { | ||
67 | atomic64_xchg(ptr, new_val); | ||
68 | } | ||
69 | EXPORT_SYMBOL(atomic64_set); | ||
70 | |||
71 | /** | ||
72 | EXPORT_SYMBOL(atomic64_read); | ||
73 | * atomic64_add_return - add and return | ||
74 | * @delta: integer value to add | ||
75 | * @ptr: pointer to type atomic64_t | ||
76 | * | ||
77 | * Atomically adds @delta to @ptr and returns @delta + *@ptr | ||
78 | */ | ||
79 | noinline u64 atomic64_add_return(u64 delta, atomic64_t *ptr) | ||
80 | { | ||
81 | /* | ||
82 | * Try first with a (possibly incorrect) assumption about | ||
83 | * what we have there. We'll do two loops most likely, | ||
84 | * but we'll get an ownership MESI transaction straight away | ||
85 | * instead of a read transaction followed by a | ||
86 | * flush-for-ownership transaction: | ||
87 | */ | ||
88 | u64 old_val, new_val, real_val = 0; | ||
89 | |||
90 | do { | ||
91 | old_val = real_val; | ||
92 | new_val = old_val + delta; | ||
93 | |||
94 | real_val = atomic64_cmpxchg(ptr, old_val, new_val); | ||
95 | |||
96 | } while (real_val != old_val); | ||
97 | |||
98 | return new_val; | ||
99 | } | ||
100 | EXPORT_SYMBOL(atomic64_add_return); | ||
101 | |||
102 | u64 atomic64_sub_return(u64 delta, atomic64_t *ptr) | ||
103 | { | ||
104 | return atomic64_add_return(-delta, ptr); | ||
105 | } | ||
106 | EXPORT_SYMBOL(atomic64_sub_return); | ||
107 | |||
108 | u64 atomic64_inc_return(atomic64_t *ptr) | ||
109 | { | ||
110 | return atomic64_add_return(1, ptr); | ||
111 | } | ||
112 | EXPORT_SYMBOL(atomic64_inc_return); | ||
113 | |||
114 | u64 atomic64_dec_return(atomic64_t *ptr) | ||
115 | { | ||
116 | return atomic64_sub_return(1, ptr); | ||
117 | } | ||
118 | EXPORT_SYMBOL(atomic64_dec_return); | ||
119 | |||
120 | /** | ||
121 | * atomic64_add - add integer to atomic64 variable | ||
122 | * @delta: integer value to add | ||
123 | * @ptr: pointer to type atomic64_t | ||
124 | * | ||
125 | * Atomically adds @delta to @ptr. | ||
126 | */ | ||
127 | void atomic64_add(u64 delta, atomic64_t *ptr) | ||
128 | { | ||
129 | atomic64_add_return(delta, ptr); | ||
130 | } | ||
131 | EXPORT_SYMBOL(atomic64_add); | ||
132 | |||
133 | /** | ||
134 | * atomic64_sub - subtract the atomic64 variable | ||
135 | * @delta: integer value to subtract | ||
136 | * @ptr: pointer to type atomic64_t | ||
137 | * | ||
138 | * Atomically subtracts @delta from @ptr. | ||
139 | */ | ||
140 | void atomic64_sub(u64 delta, atomic64_t *ptr) | ||
141 | { | ||
142 | atomic64_add(-delta, ptr); | ||
143 | } | ||
144 | EXPORT_SYMBOL(atomic64_sub); | ||
145 | |||
146 | /** | ||
147 | * atomic64_sub_and_test - subtract value from variable and test result | ||
148 | * @delta: integer value to subtract | ||
149 | * @ptr: pointer to type atomic64_t | ||
150 | * | ||
151 | * Atomically subtracts @delta from @ptr and returns | ||
152 | * true if the result is zero, or false for all | ||
153 | * other cases. | ||
154 | */ | ||
155 | int atomic64_sub_and_test(u64 delta, atomic64_t *ptr) | ||
156 | { | ||
157 | u64 new_val = atomic64_sub_return(delta, ptr); | ||
158 | |||
159 | return new_val == 0; | ||
160 | } | ||
161 | EXPORT_SYMBOL(atomic64_sub_and_test); | ||
162 | |||
163 | /** | ||
164 | * atomic64_inc - increment atomic64 variable | ||
165 | * @ptr: pointer to type atomic64_t | ||
166 | * | ||
167 | * Atomically increments @ptr by 1. | ||
168 | */ | ||
169 | void atomic64_inc(atomic64_t *ptr) | ||
170 | { | ||
171 | atomic64_add(1, ptr); | ||
172 | } | ||
173 | EXPORT_SYMBOL(atomic64_inc); | ||
174 | |||
175 | /** | ||
176 | * atomic64_dec - decrement atomic64 variable | ||
177 | * @ptr: pointer to type atomic64_t | ||
178 | * | ||
179 | * Atomically decrements @ptr by 1. | ||
180 | */ | ||
181 | void atomic64_dec(atomic64_t *ptr) | ||
182 | { | ||
183 | atomic64_sub(1, ptr); | ||
184 | } | ||
185 | EXPORT_SYMBOL(atomic64_dec); | ||
186 | |||
187 | /** | ||
188 | * atomic64_dec_and_test - decrement and test | ||
189 | * @ptr: pointer to type atomic64_t | ||
190 | * | ||
191 | * Atomically decrements @ptr by 1 and | ||
192 | * returns true if the result is 0, or false for all other | ||
193 | * cases. | ||
194 | */ | ||
195 | int atomic64_dec_and_test(atomic64_t *ptr) | ||
196 | { | ||
197 | return atomic64_sub_and_test(1, ptr); | ||
198 | } | ||
199 | EXPORT_SYMBOL(atomic64_dec_and_test); | ||
200 | |||
201 | /** | ||
202 | * atomic64_inc_and_test - increment and test | ||
203 | * @ptr: pointer to type atomic64_t | ||
204 | * | ||
205 | * Atomically increments @ptr by 1 | ||
206 | * and returns true if the result is zero, or false for all | ||
207 | * other cases. | ||
208 | */ | ||
209 | int atomic64_inc_and_test(atomic64_t *ptr) | ||
210 | { | ||
211 | return atomic64_sub_and_test(-1, ptr); | ||
212 | } | ||
213 | EXPORT_SYMBOL(atomic64_inc_and_test); | ||
214 | |||
215 | /** | ||
216 | * atomic64_add_negative - add and test if negative | ||
217 | * @delta: integer value to add | ||
218 | * @ptr: pointer to type atomic64_t | ||
219 | * | ||
220 | * Atomically adds @delta to @ptr and returns true | ||
221 | * if the result is negative, or false when | ||
222 | * result is greater than or equal to zero. | ||
223 | */ | ||
224 | int atomic64_add_negative(u64 delta, atomic64_t *ptr) | ||
225 | { | ||
226 | s64 new_val = atomic64_add_return(delta, ptr); | ||
227 | |||
228 | return new_val < 0; | ||
229 | } | ||
230 | EXPORT_SYMBOL(atomic64_add_negative); | ||
diff --git a/arch/x86/lib/clear_page_64.S b/arch/x86/lib/clear_page_64.S index 9a10a78bb4a4..ebeafcce04a9 100644 --- a/arch/x86/lib/clear_page_64.S +++ b/arch/x86/lib/clear_page_64.S | |||
@@ -5,15 +5,14 @@ | |||
5 | * Zero a page. | 5 | * Zero a page. |
6 | * rdi page | 6 | * rdi page |
7 | */ | 7 | */ |
8 | ALIGN | 8 | ENTRY(clear_page_c) |
9 | clear_page_c: | ||
10 | CFI_STARTPROC | 9 | CFI_STARTPROC |
11 | movl $4096/8,%ecx | 10 | movl $4096/8,%ecx |
12 | xorl %eax,%eax | 11 | xorl %eax,%eax |
13 | rep stosq | 12 | rep stosq |
14 | ret | 13 | ret |
15 | CFI_ENDPROC | 14 | CFI_ENDPROC |
16 | ENDPROC(clear_page) | 15 | ENDPROC(clear_page_c) |
17 | 16 | ||
18 | ENTRY(clear_page) | 17 | ENTRY(clear_page) |
19 | CFI_STARTPROC | 18 | CFI_STARTPROC |
diff --git a/arch/x86/lib/copy_user_64.S b/arch/x86/lib/copy_user_64.S index f118c110af32..6ba0f7bb85ea 100644 --- a/arch/x86/lib/copy_user_64.S +++ b/arch/x86/lib/copy_user_64.S | |||
@@ -75,6 +75,7 @@ ENTRY(copy_to_user) | |||
75 | jae bad_to_user | 75 | jae bad_to_user |
76 | ALTERNATIVE_JUMP X86_FEATURE_REP_GOOD,copy_user_generic_unrolled,copy_user_generic_string | 76 | ALTERNATIVE_JUMP X86_FEATURE_REP_GOOD,copy_user_generic_unrolled,copy_user_generic_string |
77 | CFI_ENDPROC | 77 | CFI_ENDPROC |
78 | ENDPROC(copy_to_user) | ||
78 | 79 | ||
79 | /* Standard copy_from_user with segment limit checking */ | 80 | /* Standard copy_from_user with segment limit checking */ |
80 | ENTRY(copy_from_user) | 81 | ENTRY(copy_from_user) |
diff --git a/arch/x86/lib/usercopy_32.c b/arch/x86/lib/usercopy_32.c index 7c8ca91bb9ec..1f118d462acc 100644 --- a/arch/x86/lib/usercopy_32.c +++ b/arch/x86/lib/usercopy_32.c | |||
@@ -751,7 +751,7 @@ survive: | |||
751 | 751 | ||
752 | if (retval == -ENOMEM && is_global_init(current)) { | 752 | if (retval == -ENOMEM && is_global_init(current)) { |
753 | up_read(¤t->mm->mmap_sem); | 753 | up_read(¤t->mm->mmap_sem); |
754 | congestion_wait(WRITE, HZ/50); | 754 | congestion_wait(BLK_RW_ASYNC, HZ/50); |
755 | goto survive; | 755 | goto survive; |
756 | } | 756 | } |
757 | 757 | ||
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index 78a5fff857be..85307cc6e45f 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c | |||
@@ -426,10 +426,11 @@ static noinline int vmalloc_fault(unsigned long address) | |||
426 | } | 426 | } |
427 | 427 | ||
428 | static const char errata93_warning[] = | 428 | static const char errata93_warning[] = |
429 | KERN_ERR "******* Your BIOS seems to not contain a fix for K8 errata #93\n" | 429 | KERN_ERR |
430 | KERN_ERR "******* Working around it, but it may cause SEGVs or burn power.\n" | 430 | "******* Your BIOS seems to not contain a fix for K8 errata #93\n" |
431 | KERN_ERR "******* Please consider a BIOS update.\n" | 431 | "******* Working around it, but it may cause SEGVs or burn power.\n" |
432 | KERN_ERR "******* Disabling USB legacy in the BIOS may also help.\n"; | 432 | "******* Please consider a BIOS update.\n" |
433 | "******* Disabling USB legacy in the BIOS may also help.\n"; | ||
433 | 434 | ||
434 | /* | 435 | /* |
435 | * No vm86 mode in 64-bit mode: | 436 | * No vm86 mode in 64-bit mode: |
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c index 47ce9a2ce5e7..0607119cef94 100644 --- a/arch/x86/mm/init.c +++ b/arch/x86/mm/init.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <asm/system.h> | 12 | #include <asm/system.h> |
13 | #include <asm/tlbflush.h> | 13 | #include <asm/tlbflush.h> |
14 | #include <asm/tlb.h> | 14 | #include <asm/tlb.h> |
15 | #include <asm/proto.h> | ||
15 | 16 | ||
16 | DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); | 17 | DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); |
17 | 18 | ||
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c index b177652251a4..6176fe8f29e0 100644 --- a/arch/x86/mm/init_64.c +++ b/arch/x86/mm/init_64.c | |||
@@ -598,8 +598,15 @@ void __init paging_init(void) | |||
598 | 598 | ||
599 | sparse_memory_present_with_active_regions(MAX_NUMNODES); | 599 | sparse_memory_present_with_active_regions(MAX_NUMNODES); |
600 | sparse_init(); | 600 | sparse_init(); |
601 | /* clear the default setting with node 0 */ | 601 | |
602 | nodes_clear(node_states[N_NORMAL_MEMORY]); | 602 | /* |
603 | * clear the default setting with node 0 | ||
604 | * note: don't use nodes_clear here, that is really clearing when | ||
605 | * numa support is not compiled in, and later node_set_state | ||
606 | * will not set it back. | ||
607 | */ | ||
608 | node_clear_state(0, N_NORMAL_MEMORY); | ||
609 | |||
603 | free_area_init_nodes(max_zone_pfns); | 610 | free_area_init_nodes(max_zone_pfns); |
604 | } | 611 | } |
605 | 612 | ||
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c index b07dd8d0b321..89b9a5cd63da 100644 --- a/arch/x86/oprofile/nmi_int.c +++ b/arch/x86/oprofile/nmi_int.c | |||
@@ -390,7 +390,7 @@ static int __init p4_init(char **cpu_type) | |||
390 | static int force_arch_perfmon; | 390 | static int force_arch_perfmon; |
391 | static int force_cpu_type(const char *str, struct kernel_param *kp) | 391 | static int force_cpu_type(const char *str, struct kernel_param *kp) |
392 | { | 392 | { |
393 | if (!strcmp(str, "archperfmon")) { | 393 | if (!strcmp(str, "arch_perfmon")) { |
394 | force_arch_perfmon = 1; | 394 | force_arch_perfmon = 1; |
395 | printk(KERN_INFO "oprofile: forcing architectural perfmon\n"); | 395 | printk(KERN_INFO "oprofile: forcing architectural perfmon\n"); |
396 | } | 396 | } |
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c index b26626dc517c..1014eb4bfc37 100644 --- a/arch/x86/pci/acpi.c +++ b/arch/x86/pci/acpi.c | |||
@@ -68,6 +68,10 @@ setup_resource(struct acpi_resource *acpi_res, void *data) | |||
68 | unsigned long flags; | 68 | unsigned long flags; |
69 | struct resource *root; | 69 | struct resource *root; |
70 | int max_root_bus_resources = PCI_BUS_NUM_RESOURCES; | 70 | int max_root_bus_resources = PCI_BUS_NUM_RESOURCES; |
71 | u64 start, end; | ||
72 | |||
73 | if (bus_has_transparent_bridge(info->bus)) | ||
74 | max_root_bus_resources -= 3; | ||
71 | 75 | ||
72 | status = resource_to_addr(acpi_res, &addr); | 76 | status = resource_to_addr(acpi_res, &addr); |
73 | if (!ACPI_SUCCESS(status)) | 77 | if (!ACPI_SUCCESS(status)) |
@@ -84,25 +88,24 @@ setup_resource(struct acpi_resource *acpi_res, void *data) | |||
84 | } else | 88 | } else |
85 | return AE_OK; | 89 | return AE_OK; |
86 | 90 | ||
87 | res = &info->res[info->res_num]; | 91 | start = addr.minimum + addr.translation_offset; |
88 | res->name = info->name; | 92 | end = start + addr.address_length - 1; |
89 | res->flags = flags; | ||
90 | res->start = addr.minimum + addr.translation_offset; | ||
91 | res->end = res->start + addr.address_length - 1; | ||
92 | res->child = NULL; | ||
93 | |||
94 | if (bus_has_transparent_bridge(info->bus)) | ||
95 | max_root_bus_resources -= 3; | ||
96 | if (info->res_num >= max_root_bus_resources) { | 93 | if (info->res_num >= max_root_bus_resources) { |
97 | printk(KERN_WARNING "PCI: Failed to allocate 0x%lx-0x%lx " | 94 | printk(KERN_WARNING "PCI: Failed to allocate 0x%lx-0x%lx " |
98 | "from %s for %s due to _CRS returning more than " | 95 | "from %s for %s due to _CRS returning more than " |
99 | "%d resource descriptors\n", (unsigned long) res->start, | 96 | "%d resource descriptors\n", (unsigned long) start, |
100 | (unsigned long) res->end, root->name, info->name, | 97 | (unsigned long) end, root->name, info->name, |
101 | max_root_bus_resources); | 98 | max_root_bus_resources); |
102 | info->res_num++; | ||
103 | return AE_OK; | 99 | return AE_OK; |
104 | } | 100 | } |
105 | 101 | ||
102 | res = &info->res[info->res_num]; | ||
103 | res->name = info->name; | ||
104 | res->flags = flags; | ||
105 | res->start = start; | ||
106 | res->end = end; | ||
107 | res->child = NULL; | ||
108 | |||
106 | if (insert_resource(root, res)) { | 109 | if (insert_resource(root, res)) { |
107 | printk(KERN_ERR "PCI: Failed to allocate 0x%lx-0x%lx " | 110 | printk(KERN_ERR "PCI: Failed to allocate 0x%lx-0x%lx " |
108 | "from %s for %s\n", (unsigned long) res->start, | 111 | "from %s for %s\n", (unsigned long) res->start, |
@@ -115,23 +118,6 @@ setup_resource(struct acpi_resource *acpi_res, void *data) | |||
115 | } | 118 | } |
116 | 119 | ||
117 | static void | 120 | static void |
118 | adjust_transparent_bridge_resources(struct pci_bus *bus) | ||
119 | { | ||
120 | struct pci_dev *dev; | ||
121 | |||
122 | list_for_each_entry(dev, &bus->devices, bus_list) { | ||
123 | int i; | ||
124 | u16 class = dev->class >> 8; | ||
125 | |||
126 | if (class == PCI_CLASS_BRIDGE_PCI && dev->transparent) { | ||
127 | for(i = 3; i < PCI_BUS_NUM_RESOURCES; i++) | ||
128 | dev->subordinate->resource[i] = | ||
129 | dev->bus->resource[i - 3]; | ||
130 | } | ||
131 | } | ||
132 | } | ||
133 | |||
134 | static void | ||
135 | get_current_resources(struct acpi_device *device, int busnum, | 121 | get_current_resources(struct acpi_device *device, int busnum, |
136 | int domain, struct pci_bus *bus) | 122 | int domain, struct pci_bus *bus) |
137 | { | 123 | { |
@@ -158,8 +144,6 @@ get_current_resources(struct acpi_device *device, int busnum, | |||
158 | info.res_num = 0; | 144 | info.res_num = 0; |
159 | acpi_walk_resources(device->handle, METHOD_NAME__CRS, setup_resource, | 145 | acpi_walk_resources(device->handle, METHOD_NAME__CRS, setup_resource, |
160 | &info); | 146 | &info); |
161 | if (info.res_num) | ||
162 | adjust_transparent_bridge_resources(bus); | ||
163 | 147 | ||
164 | return; | 148 | return; |
165 | 149 | ||
@@ -222,8 +206,15 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do | |||
222 | */ | 206 | */ |
223 | memcpy(bus->sysdata, sd, sizeof(*sd)); | 207 | memcpy(bus->sysdata, sd, sizeof(*sd)); |
224 | kfree(sd); | 208 | kfree(sd); |
225 | } else | 209 | } else { |
226 | bus = pci_scan_bus_parented(NULL, busnum, &pci_root_ops, sd); | 210 | bus = pci_create_bus(NULL, busnum, &pci_root_ops, sd); |
211 | if (bus) { | ||
212 | if (pci_probe & PCI_USE__CRS) | ||
213 | get_current_resources(device, busnum, domain, | ||
214 | bus); | ||
215 | bus->subordinate = pci_scan_child_bus(bus); | ||
216 | } | ||
217 | } | ||
227 | 218 | ||
228 | if (!bus) | 219 | if (!bus) |
229 | kfree(sd); | 220 | kfree(sd); |
@@ -238,8 +229,6 @@ struct pci_bus * __devinit pci_acpi_scan_root(struct acpi_device *device, int do | |||
238 | #endif | 229 | #endif |
239 | } | 230 | } |
240 | 231 | ||
241 | if (bus && (pci_probe & PCI_USE__CRS)) | ||
242 | get_current_resources(device, busnum, domain, bus); | ||
243 | return bus; | 232 | return bus; |
244 | } | 233 | } |
245 | 234 | ||
diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c index f893d6a6e803..3ffa10df20b9 100644 --- a/arch/x86/pci/amd_bus.c +++ b/arch/x86/pci/amd_bus.c | |||
@@ -100,8 +100,9 @@ void x86_pci_root_bus_res_quirks(struct pci_bus *b) | |||
100 | int j; | 100 | int j; |
101 | struct pci_root_info *info; | 101 | struct pci_root_info *info; |
102 | 102 | ||
103 | /* don't go for it if _CRS is used */ | 103 | /* don't go for it if _CRS is used already */ |
104 | if (pci_probe & PCI_USE__CRS) | 104 | if (b->resource[0] != &ioport_resource || |
105 | b->resource[1] != &iomem_resource) | ||
105 | return; | 106 | return; |
106 | 107 | ||
107 | /* if only one root bus, don't need to anything */ | 108 | /* if only one root bus, don't need to anything */ |
@@ -116,6 +117,9 @@ void x86_pci_root_bus_res_quirks(struct pci_bus *b) | |||
116 | if (i == pci_root_num) | 117 | if (i == pci_root_num) |
117 | return; | 118 | return; |
118 | 119 | ||
120 | printk(KERN_DEBUG "PCI: peer root bus %02x res updated from pci conf\n", | ||
121 | b->number); | ||
122 | |||
119 | info = &pci_root_info[i]; | 123 | info = &pci_root_info[i]; |
120 | for (j = 0; j < info->res_num; j++) { | 124 | for (j = 0; j < info->res_num; j++) { |
121 | struct resource *res; | 125 | struct resource *res; |
diff --git a/arch/x86/power/Makefile b/arch/x86/power/Makefile index de2abbd07544..a6a198c33623 100644 --- a/arch/x86/power/Makefile +++ b/arch/x86/power/Makefile | |||
@@ -1,7 +1,7 @@ | |||
1 | # __restore_processor_state() restores %gs after S3 resume and so should not | 1 | # __restore_processor_state() restores %gs after S3 resume and so should not |
2 | # itself be stack-protected | 2 | # itself be stack-protected |
3 | nostackp := $(call cc-option, -fno-stack-protector) | 3 | nostackp := $(call cc-option, -fno-stack-protector) |
4 | CFLAGS_cpu_$(BITS).o := $(nostackp) | 4 | CFLAGS_cpu.o := $(nostackp) |
5 | 5 | ||
6 | obj-$(CONFIG_PM_SLEEP) += cpu.o | 6 | obj-$(CONFIG_PM_SLEEP) += cpu.o |
7 | obj-$(CONFIG_HIBERNATION) += hibernate_$(BITS).o hibernate_asm_$(BITS).o | 7 | obj-$(CONFIG_HIBERNATION) += hibernate_$(BITS).o hibernate_asm_$(BITS).o |
diff --git a/arch/xtensa/include/asm/thread_info.h b/arch/xtensa/include/asm/thread_info.h index 0f4fe1faf9ba..13165641cc51 100644 --- a/arch/xtensa/include/asm/thread_info.h +++ b/arch/xtensa/include/asm/thread_info.h | |||
@@ -80,8 +80,6 @@ struct thread_info { | |||
80 | 80 | ||
81 | /* | 81 | /* |
82 | * macros/functions for gaining access to the thread information structure | 82 | * macros/functions for gaining access to the thread information structure |
83 | * | ||
84 | * preempt_count needs to be 1 initially, until the scheduler is functional. | ||
85 | */ | 83 | */ |
86 | 84 | ||
87 | #ifndef __ASSEMBLY__ | 85 | #ifndef __ASSEMBLY__ |
@@ -92,7 +90,7 @@ struct thread_info { | |||
92 | .exec_domain = &default_exec_domain, \ | 90 | .exec_domain = &default_exec_domain, \ |
93 | .flags = 0, \ | 91 | .flags = 0, \ |
94 | .cpu = 0, \ | 92 | .cpu = 0, \ |
95 | .preempt_count = 1, \ | 93 | .preempt_count = INIT_PREEMPT_COUNT, \ |
96 | .addr_limit = KERNEL_DS, \ | 94 | .addr_limit = KERNEL_DS, \ |
97 | .restart_block = { \ | 95 | .restart_block = { \ |
98 | .fn = do_no_restart_syscall, \ | 96 | .fn = do_no_restart_syscall, \ |
diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c index ba9ab9349782..e64efac3b9db 100644 --- a/arch/xtensa/kernel/traps.c +++ b/arch/xtensa/kernel/traps.c | |||
@@ -354,10 +354,10 @@ void show_regs(struct pt_regs * regs) | |||
354 | 354 | ||
355 | for (i = 0; i < 16; i++) { | 355 | for (i = 0; i < 16; i++) { |
356 | if ((i % 8) == 0) | 356 | if ((i % 8) == 0) |
357 | printk ("\n" KERN_INFO "a%02d: ", i); | 357 | printk(KERN_INFO "a%02d:", i); |
358 | printk("%08lx ", regs->areg[i]); | 358 | printk(KERN_CONT " %08lx", regs->areg[i]); |
359 | } | 359 | } |
360 | printk("\n"); | 360 | printk(KERN_CONT "\n"); |
361 | 361 | ||
362 | printk("pc: %08lx, ps: %08lx, depc: %08lx, excvaddr: %08lx\n", | 362 | printk("pc: %08lx, ps: %08lx, depc: %08lx, excvaddr: %08lx\n", |
363 | regs->pc, regs->ps, regs->depc, regs->excvaddr); | 363 | regs->pc, regs->ps, regs->depc, regs->excvaddr); |
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c index 87276eb83f7f..fd7080ed7935 100644 --- a/block/cfq-iosched.c +++ b/block/cfq-iosched.c | |||
@@ -2311,7 +2311,7 @@ cfq_set_request(struct request_queue *q, struct request *rq, gfp_t gfp_mask) | |||
2311 | goto queue_fail; | 2311 | goto queue_fail; |
2312 | 2312 | ||
2313 | cfqq = cic_to_cfqq(cic, is_sync); | 2313 | cfqq = cic_to_cfqq(cic, is_sync); |
2314 | if (!cfqq) { | 2314 | if (!cfqq || cfqq == &cfqd->oom_cfqq) { |
2315 | cfqq = cfq_get_queue(cfqd, is_sync, cic->ioc, gfp_mask); | 2315 | cfqq = cfq_get_queue(cfqd, is_sync, cic->ioc, gfp_mask); |
2316 | cic_set_cfqq(cic, cfqq, is_sync); | 2316 | cic_set_cfqq(cic, cfqq, is_sync); |
2317 | } | 2317 | } |
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index f0e0ce0a607d..e5b10017a50b 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c | |||
@@ -680,3 +680,4 @@ int __init blk_scsi_ioctl_init(void) | |||
680 | blk_set_cmd_filter_defaults(&blk_default_cmd_filter); | 680 | blk_set_cmd_filter_defaults(&blk_default_cmd_filter); |
681 | return 0; | 681 | return 0; |
682 | } | 682 | } |
683 | fs_initcall(blk_scsi_ioctl_init); | ||
diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c index 3d763fdf99b7..246650673010 100644 --- a/drivers/amba/bus.c +++ b/drivers/amba/bus.c | |||
@@ -207,6 +207,16 @@ int amba_device_register(struct amba_device *dev, struct resource *parent) | |||
207 | void __iomem *tmp; | 207 | void __iomem *tmp; |
208 | int i, ret; | 208 | int i, ret; |
209 | 209 | ||
210 | device_initialize(&dev->dev); | ||
211 | |||
212 | /* | ||
213 | * Copy from device_add | ||
214 | */ | ||
215 | if (dev->dev.init_name) { | ||
216 | dev_set_name(&dev->dev, "%s", dev->dev.init_name); | ||
217 | dev->dev.init_name = NULL; | ||
218 | } | ||
219 | |||
210 | dev->dev.release = amba_device_release; | 220 | dev->dev.release = amba_device_release; |
211 | dev->dev.bus = &amba_bustype; | 221 | dev->dev.bus = &amba_bustype; |
212 | dev->dev.dma_mask = &dev->dma_mask; | 222 | dev->dev.dma_mask = &dev->dma_mask; |
@@ -240,7 +250,7 @@ int amba_device_register(struct amba_device *dev, struct resource *parent) | |||
240 | goto err_release; | 250 | goto err_release; |
241 | } | 251 | } |
242 | 252 | ||
243 | ret = device_register(&dev->dev); | 253 | ret = device_add(&dev->dev); |
244 | if (ret) | 254 | if (ret) |
245 | goto err_release; | 255 | goto err_release; |
246 | 256 | ||
diff --git a/drivers/base/devres.c b/drivers/base/devres.c index e8beb8e5b626..05dd307e8f02 100644 --- a/drivers/base/devres.c +++ b/drivers/base/devres.c | |||
@@ -428,6 +428,9 @@ int devres_release_all(struct device *dev) | |||
428 | { | 428 | { |
429 | unsigned long flags; | 429 | unsigned long flags; |
430 | 430 | ||
431 | /* Looks like an uninitialized device structure */ | ||
432 | if (WARN_ON(dev->devres_head.next == NULL)) | ||
433 | return -ENODEV; | ||
431 | spin_lock_irqsave(&dev->devres_lock, flags); | 434 | spin_lock_irqsave(&dev->devres_lock, flags); |
432 | return release_nodes(dev, dev->devres_head.next, &dev->devres_head, | 435 | return release_nodes(dev, dev->devres_head.next, &dev->devres_head, |
433 | flags); | 436 | flags); |
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index ddeb819c8f87..f285f441fab9 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -217,8 +217,10 @@ firmware_data_read(struct kobject *kobj, struct bin_attribute *bin_attr, | |||
217 | ret_count = -ENODEV; | 217 | ret_count = -ENODEV; |
218 | goto out; | 218 | goto out; |
219 | } | 219 | } |
220 | if (offset > fw->size) | 220 | if (offset > fw->size) { |
221 | return 0; | 221 | ret_count = 0; |
222 | goto out; | ||
223 | } | ||
222 | if (count > fw->size - offset) | 224 | if (count > fw->size - offset) |
223 | count = fw->size - offset; | 225 | count = fw->size - offset; |
224 | 226 | ||
@@ -357,7 +359,7 @@ static void fw_dev_release(struct device *dev) | |||
357 | kfree(fw_priv->pages); | 359 | kfree(fw_priv->pages); |
358 | kfree(fw_priv->fw_id); | 360 | kfree(fw_priv->fw_id); |
359 | kfree(fw_priv); | 361 | kfree(fw_priv); |
360 | put_device(dev); | 362 | kfree(dev); |
361 | 363 | ||
362 | module_put(THIS_MODULE); | 364 | module_put(THIS_MODULE); |
363 | } | 365 | } |
@@ -408,13 +410,11 @@ static int fw_register_device(struct device **dev_p, const char *fw_name, | |||
408 | if (retval) { | 410 | if (retval) { |
409 | dev_err(device, "%s: device_register failed\n", __func__); | 411 | dev_err(device, "%s: device_register failed\n", __func__); |
410 | put_device(f_dev); | 412 | put_device(f_dev); |
411 | goto error_kfree_fw_id; | 413 | return retval; |
412 | } | 414 | } |
413 | *dev_p = f_dev; | 415 | *dev_p = f_dev; |
414 | return 0; | 416 | return 0; |
415 | 417 | ||
416 | error_kfree_fw_id: | ||
417 | kfree(fw_priv->fw_id); | ||
418 | error_kfree: | 418 | error_kfree: |
419 | kfree(f_dev); | 419 | kfree(f_dev); |
420 | kfree(fw_priv); | 420 | kfree(fw_priv); |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index fae725458981..58a3e572f2c9 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -762,6 +762,7 @@ static int dpm_prepare(pm_message_t state) | |||
762 | dev->power.status = DPM_ON; | 762 | dev->power.status = DPM_ON; |
763 | if (error == -EAGAIN) { | 763 | if (error == -EAGAIN) { |
764 | put_device(dev); | 764 | put_device(dev); |
765 | error = 0; | ||
765 | continue; | 766 | continue; |
766 | } | 767 | } |
767 | printk(KERN_ERR "PM: Failed to prepare device %s " | 768 | printk(KERN_ERR "PM: Failed to prepare device %s " |
diff --git a/drivers/block/DAC960.c b/drivers/block/DAC960.c index 668dc234b8e2..1e6b7c14f697 100644 --- a/drivers/block/DAC960.c +++ b/drivers/block/DAC960.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/ioport.h> | 36 | #include <linux/ioport.h> |
37 | #include <linux/mm.h> | 37 | #include <linux/mm.h> |
38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | #include <linux/smp_lock.h> | ||
39 | #include <linux/proc_fs.h> | 40 | #include <linux/proc_fs.h> |
40 | #include <linux/reboot.h> | 41 | #include <linux/reboot.h> |
41 | #include <linux/spinlock.h> | 42 | #include <linux/spinlock.h> |
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index bb72ada9f074..1d886e079c58 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig | |||
@@ -298,6 +298,22 @@ config BLK_DEV_NBD | |||
298 | 298 | ||
299 | If unsure, say N. | 299 | If unsure, say N. |
300 | 300 | ||
301 | config BLK_DEV_OSD | ||
302 | tristate "OSD object-as-blkdev support" | ||
303 | depends on SCSI_OSD_ULD | ||
304 | ---help--- | ||
305 | Saying Y or M here will allow the exporting of a single SCSI | ||
306 | OSD (object-based storage) object as a Linux block device. | ||
307 | |||
308 | For example, if you create a 2G object on an OSD device, | ||
309 | you can then use this module to present that 2G object as | ||
310 | a Linux block device. | ||
311 | |||
312 | To compile this driver as a module, choose M here: the | ||
313 | module will be called osdblk. | ||
314 | |||
315 | If unsure, say N. | ||
316 | |||
301 | config BLK_DEV_SX8 | 317 | config BLK_DEV_SX8 |
302 | tristate "Promise SATA SX8 support" | 318 | tristate "Promise SATA SX8 support" |
303 | depends on PCI | 319 | depends on PCI |
diff --git a/drivers/block/Makefile b/drivers/block/Makefile index 7755a5e2a85e..cdaa3f8fddf0 100644 --- a/drivers/block/Makefile +++ b/drivers/block/Makefile | |||
@@ -23,6 +23,7 @@ obj-$(CONFIG_XILINX_SYSACE) += xsysace.o | |||
23 | obj-$(CONFIG_CDROM_PKTCDVD) += pktcdvd.o | 23 | obj-$(CONFIG_CDROM_PKTCDVD) += pktcdvd.o |
24 | obj-$(CONFIG_MG_DISK) += mg_disk.o | 24 | obj-$(CONFIG_MG_DISK) += mg_disk.o |
25 | obj-$(CONFIG_SUNVDC) += sunvdc.o | 25 | obj-$(CONFIG_SUNVDC) += sunvdc.o |
26 | obj-$(CONFIG_BLK_DEV_OSD) += osdblk.o | ||
26 | 27 | ||
27 | obj-$(CONFIG_BLK_DEV_UMEM) += umem.o | 28 | obj-$(CONFIG_BLK_DEV_UMEM) += umem.o |
28 | obj-$(CONFIG_BLK_DEV_NBD) += nbd.o | 29 | obj-$(CONFIG_BLK_DEV_NBD) += nbd.o |
diff --git a/drivers/block/amiflop.c b/drivers/block/amiflop.c index 9c6e5b0fe894..2f07b7c99a95 100644 --- a/drivers/block/amiflop.c +++ b/drivers/block/amiflop.c | |||
@@ -1645,7 +1645,7 @@ static int __init fd_probe_drives(void) | |||
1645 | { | 1645 | { |
1646 | int drive,drives,nomem; | 1646 | int drive,drives,nomem; |
1647 | 1647 | ||
1648 | printk(KERN_INFO "FD: probing units\n" KERN_INFO "found "); | 1648 | printk(KERN_INFO "FD: probing units\nfound "); |
1649 | drives=0; | 1649 | drives=0; |
1650 | nomem=0; | 1650 | nomem=0; |
1651 | for(drive=0;drive<FD_MAX_UNITS;drive++) { | 1651 | for(drive=0;drive<FD_MAX_UNITS;drive++) { |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index 65a0655e7fc8..a52cc7fe45ea 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/smp_lock.h> | ||
29 | #include <linux/delay.h> | 30 | #include <linux/delay.h> |
30 | #include <linux/major.h> | 31 | #include <linux/major.h> |
31 | #include <linux/fs.h> | 32 | #include <linux/fs.h> |
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index 801f4ab83302..5757188cd1fb 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -61,7 +61,6 @@ | |||
61 | #include <linux/blkdev.h> | 61 | #include <linux/blkdev.h> |
62 | #include <linux/blkpg.h> | 62 | #include <linux/blkpg.h> |
63 | #include <linux/init.h> | 63 | #include <linux/init.h> |
64 | #include <linux/smp_lock.h> | ||
65 | #include <linux/swap.h> | 64 | #include <linux/swap.h> |
66 | #include <linux/slab.h> | 65 | #include <linux/slab.h> |
67 | #include <linux/loop.h> | 66 | #include <linux/loop.h> |
diff --git a/drivers/block/osdblk.c b/drivers/block/osdblk.c new file mode 100644 index 000000000000..13c1aee6aa3f --- /dev/null +++ b/drivers/block/osdblk.c | |||
@@ -0,0 +1,701 @@ | |||
1 | |||
2 | /* | ||
3 | osdblk.c -- Export a single SCSI OSD object as a Linux block device | ||
4 | |||
5 | |||
6 | Copyright 2009 Red Hat, Inc. | ||
7 | |||
8 | This program is free software; you can redistribute it and/or modify | ||
9 | it under the terms of the GNU General Public License as published by | ||
10 | the Free Software Foundation. | ||
11 | |||
12 | This program 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 | ||
15 | GNU General Public License for more details. | ||
16 | |||
17 | You should have received a copy of the GNU General Public License | ||
18 | along with this program; see the file COPYING. If not, write to | ||
19 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | |||
21 | |||
22 | Instructions for use | ||
23 | -------------------- | ||
24 | |||
25 | 1) Map a Linux block device to an existing OSD object. | ||
26 | |||
27 | In this example, we will use partition id 1234, object id 5678, | ||
28 | OSD device /dev/osd1. | ||
29 | |||
30 | $ echo "1234 5678 /dev/osd1" > /sys/class/osdblk/add | ||
31 | |||
32 | |||
33 | 2) List all active blkdev<->object mappings. | ||
34 | |||
35 | In this example, we have performed step #1 twice, creating two blkdevs, | ||
36 | mapped to two separate OSD objects. | ||
37 | |||
38 | $ cat /sys/class/osdblk/list | ||
39 | 0 174 1234 5678 /dev/osd1 | ||
40 | 1 179 1994 897123 /dev/osd0 | ||
41 | |||
42 | The columns, in order, are: | ||
43 | - blkdev unique id | ||
44 | - blkdev assigned major | ||
45 | - OSD object partition id | ||
46 | - OSD object id | ||
47 | - OSD device | ||
48 | |||
49 | |||
50 | 3) Remove an active blkdev<->object mapping. | ||
51 | |||
52 | In this example, we remove the mapping with blkdev unique id 1. | ||
53 | |||
54 | $ echo 1 > /sys/class/osdblk/remove | ||
55 | |||
56 | |||
57 | NOTE: The actual creation and deletion of OSD objects is outside the scope | ||
58 | of this driver. | ||
59 | |||
60 | */ | ||
61 | |||
62 | #include <linux/kernel.h> | ||
63 | #include <linux/device.h> | ||
64 | #include <linux/module.h> | ||
65 | #include <linux/fs.h> | ||
66 | #include <scsi/osd_initiator.h> | ||
67 | #include <scsi/osd_attributes.h> | ||
68 | #include <scsi/osd_sec.h> | ||
69 | #include <scsi/scsi_device.h> | ||
70 | |||
71 | #define DRV_NAME "osdblk" | ||
72 | #define PFX DRV_NAME ": " | ||
73 | |||
74 | /* #define _OSDBLK_DEBUG */ | ||
75 | #ifdef _OSDBLK_DEBUG | ||
76 | #define OSDBLK_DEBUG(fmt, a...) \ | ||
77 | printk(KERN_NOTICE "osdblk @%s:%d: " fmt, __func__, __LINE__, ##a) | ||
78 | #else | ||
79 | #define OSDBLK_DEBUG(fmt, a...) \ | ||
80 | do { if (0) printk(fmt, ##a); } while (0) | ||
81 | #endif | ||
82 | |||
83 | MODULE_AUTHOR("Jeff Garzik <jeff@garzik.org>"); | ||
84 | MODULE_DESCRIPTION("block device inside an OSD object osdblk.ko"); | ||
85 | MODULE_LICENSE("GPL"); | ||
86 | |||
87 | struct osdblk_device; | ||
88 | |||
89 | enum { | ||
90 | OSDBLK_MINORS_PER_MAJOR = 256, /* max minors per blkdev */ | ||
91 | OSDBLK_MAX_REQ = 32, /* max parallel requests */ | ||
92 | OSDBLK_OP_TIMEOUT = 4 * 60, /* sync OSD req timeout */ | ||
93 | }; | ||
94 | |||
95 | struct osdblk_request { | ||
96 | struct request *rq; /* blk layer request */ | ||
97 | struct bio *bio; /* cloned bio */ | ||
98 | struct osdblk_device *osdev; /* associated blkdev */ | ||
99 | }; | ||
100 | |||
101 | struct osdblk_device { | ||
102 | int id; /* blkdev unique id */ | ||
103 | |||
104 | int major; /* blkdev assigned major */ | ||
105 | struct gendisk *disk; /* blkdev's gendisk and rq */ | ||
106 | struct request_queue *q; | ||
107 | |||
108 | struct osd_dev *osd; /* associated OSD */ | ||
109 | |||
110 | char name[32]; /* blkdev name, e.g. osdblk34 */ | ||
111 | |||
112 | spinlock_t lock; /* queue lock */ | ||
113 | |||
114 | struct osd_obj_id obj; /* OSD partition, obj id */ | ||
115 | uint8_t obj_cred[OSD_CAP_LEN]; /* OSD cred */ | ||
116 | |||
117 | struct osdblk_request req[OSDBLK_MAX_REQ]; /* request table */ | ||
118 | |||
119 | struct list_head node; | ||
120 | |||
121 | char osd_path[0]; /* OSD device path */ | ||
122 | }; | ||
123 | |||
124 | static struct class *class_osdblk; /* /sys/class/osdblk */ | ||
125 | static DEFINE_MUTEX(ctl_mutex); /* Serialize open/close/setup/teardown */ | ||
126 | static LIST_HEAD(osdblkdev_list); | ||
127 | |||
128 | static struct block_device_operations osdblk_bd_ops = { | ||
129 | .owner = THIS_MODULE, | ||
130 | }; | ||
131 | |||
132 | static const struct osd_attr g_attr_logical_length = ATTR_DEF( | ||
133 | OSD_APAGE_OBJECT_INFORMATION, OSD_ATTR_OI_LOGICAL_LENGTH, 8); | ||
134 | |||
135 | static void osdblk_make_credential(u8 cred_a[OSD_CAP_LEN], | ||
136 | const struct osd_obj_id *obj) | ||
137 | { | ||
138 | osd_sec_init_nosec_doall_caps(cred_a, obj, false, true); | ||
139 | } | ||
140 | |||
141 | /* copied from exofs; move to libosd? */ | ||
142 | /* | ||
143 | * Perform a synchronous OSD operation. copied from exofs; move to libosd? | ||
144 | */ | ||
145 | static int osd_sync_op(struct osd_request *or, int timeout, uint8_t *credential) | ||
146 | { | ||
147 | int ret; | ||
148 | |||
149 | or->timeout = timeout; | ||
150 | ret = osd_finalize_request(or, 0, credential, NULL); | ||
151 | if (ret) | ||
152 | return ret; | ||
153 | |||
154 | ret = osd_execute_request(or); | ||
155 | |||
156 | /* osd_req_decode_sense(or, ret); */ | ||
157 | return ret; | ||
158 | } | ||
159 | |||
160 | /* | ||
161 | * Perform an asynchronous OSD operation. copied from exofs; move to libosd? | ||
162 | */ | ||
163 | static int osd_async_op(struct osd_request *or, osd_req_done_fn *async_done, | ||
164 | void *caller_context, u8 *cred) | ||
165 | { | ||
166 | int ret; | ||
167 | |||
168 | ret = osd_finalize_request(or, 0, cred, NULL); | ||
169 | if (ret) | ||
170 | return ret; | ||
171 | |||
172 | ret = osd_execute_request_async(or, async_done, caller_context); | ||
173 | |||
174 | return ret; | ||
175 | } | ||
176 | |||
177 | /* copied from exofs; move to libosd? */ | ||
178 | static int extract_attr_from_req(struct osd_request *or, struct osd_attr *attr) | ||
179 | { | ||
180 | struct osd_attr cur_attr = {.attr_page = 0}; /* start with zeros */ | ||
181 | void *iter = NULL; | ||
182 | int nelem; | ||
183 | |||
184 | do { | ||
185 | nelem = 1; | ||
186 | osd_req_decode_get_attr_list(or, &cur_attr, &nelem, &iter); | ||
187 | if ((cur_attr.attr_page == attr->attr_page) && | ||
188 | (cur_attr.attr_id == attr->attr_id)) { | ||
189 | attr->len = cur_attr.len; | ||
190 | attr->val_ptr = cur_attr.val_ptr; | ||
191 | return 0; | ||
192 | } | ||
193 | } while (iter); | ||
194 | |||
195 | return -EIO; | ||
196 | } | ||
197 | |||
198 | static int osdblk_get_obj_size(struct osdblk_device *osdev, u64 *size_out) | ||
199 | { | ||
200 | struct osd_request *or; | ||
201 | struct osd_attr attr; | ||
202 | int ret; | ||
203 | |||
204 | /* start request */ | ||
205 | or = osd_start_request(osdev->osd, GFP_KERNEL); | ||
206 | if (!or) | ||
207 | return -ENOMEM; | ||
208 | |||
209 | /* create a get-attributes(length) request */ | ||
210 | osd_req_get_attributes(or, &osdev->obj); | ||
211 | |||
212 | osd_req_add_get_attr_list(or, &g_attr_logical_length, 1); | ||
213 | |||
214 | /* execute op synchronously */ | ||
215 | ret = osd_sync_op(or, OSDBLK_OP_TIMEOUT, osdev->obj_cred); | ||
216 | if (ret) | ||
217 | goto out; | ||
218 | |||
219 | /* extract length from returned attribute info */ | ||
220 | attr = g_attr_logical_length; | ||
221 | ret = extract_attr_from_req(or, &attr); | ||
222 | if (ret) | ||
223 | goto out; | ||
224 | |||
225 | *size_out = get_unaligned_be64(attr.val_ptr); | ||
226 | |||
227 | out: | ||
228 | osd_end_request(or); | ||
229 | return ret; | ||
230 | |||
231 | } | ||
232 | |||
233 | static void osdblk_osd_complete(struct osd_request *or, void *private) | ||
234 | { | ||
235 | struct osdblk_request *orq = private; | ||
236 | struct osd_sense_info osi; | ||
237 | int ret = osd_req_decode_sense(or, &osi); | ||
238 | |||
239 | if (ret) { | ||
240 | ret = -EIO; | ||
241 | OSDBLK_DEBUG("osdblk_osd_complete with err=%d\n", ret); | ||
242 | } | ||
243 | |||
244 | /* complete OSD request */ | ||
245 | osd_end_request(or); | ||
246 | |||
247 | /* complete request passed to osdblk by block layer */ | ||
248 | __blk_end_request_all(orq->rq, ret); | ||
249 | } | ||
250 | |||
251 | static void bio_chain_put(struct bio *chain) | ||
252 | { | ||
253 | struct bio *tmp; | ||
254 | |||
255 | while (chain) { | ||
256 | tmp = chain; | ||
257 | chain = chain->bi_next; | ||
258 | |||
259 | bio_put(tmp); | ||
260 | } | ||
261 | } | ||
262 | |||
263 | static struct bio *bio_chain_clone(struct bio *old_chain, gfp_t gfpmask) | ||
264 | { | ||
265 | struct bio *tmp, *new_chain = NULL, *tail = NULL; | ||
266 | |||
267 | while (old_chain) { | ||
268 | tmp = bio_kmalloc(gfpmask, old_chain->bi_max_vecs); | ||
269 | if (!tmp) | ||
270 | goto err_out; | ||
271 | |||
272 | __bio_clone(tmp, old_chain); | ||
273 | tmp->bi_bdev = NULL; | ||
274 | gfpmask &= ~__GFP_WAIT; | ||
275 | tmp->bi_next = NULL; | ||
276 | |||
277 | if (!new_chain) | ||
278 | new_chain = tail = tmp; | ||
279 | else { | ||
280 | tail->bi_next = tmp; | ||
281 | tail = tmp; | ||
282 | } | ||
283 | |||
284 | old_chain = old_chain->bi_next; | ||
285 | } | ||
286 | |||
287 | return new_chain; | ||
288 | |||
289 | err_out: | ||
290 | OSDBLK_DEBUG("bio_chain_clone with err\n"); | ||
291 | bio_chain_put(new_chain); | ||
292 | return NULL; | ||
293 | } | ||
294 | |||
295 | static void osdblk_rq_fn(struct request_queue *q) | ||
296 | { | ||
297 | struct osdblk_device *osdev = q->queuedata; | ||
298 | |||
299 | while (1) { | ||
300 | struct request *rq; | ||
301 | struct osdblk_request *orq; | ||
302 | struct osd_request *or; | ||
303 | struct bio *bio; | ||
304 | bool do_write, do_flush; | ||
305 | |||
306 | /* peek at request from block layer */ | ||
307 | rq = blk_fetch_request(q); | ||
308 | if (!rq) | ||
309 | break; | ||
310 | |||
311 | /* filter out block requests we don't understand */ | ||
312 | if (!blk_fs_request(rq) && !blk_barrier_rq(rq)) { | ||
313 | blk_end_request_all(rq, 0); | ||
314 | continue; | ||
315 | } | ||
316 | |||
317 | /* deduce our operation (read, write, flush) */ | ||
318 | /* I wish the block layer simplified cmd_type/cmd_flags/cmd[] | ||
319 | * into a clearly defined set of RPC commands: | ||
320 | * read, write, flush, scsi command, power mgmt req, | ||
321 | * driver-specific, etc. | ||
322 | */ | ||
323 | |||
324 | do_flush = (rq->special == (void *) 0xdeadbeefUL); | ||
325 | do_write = (rq_data_dir(rq) == WRITE); | ||
326 | |||
327 | if (!do_flush) { /* osd_flush does not use a bio */ | ||
328 | /* a bio clone to be passed down to OSD request */ | ||
329 | bio = bio_chain_clone(rq->bio, GFP_ATOMIC); | ||
330 | if (!bio) | ||
331 | break; | ||
332 | } else | ||
333 | bio = NULL; | ||
334 | |||
335 | /* alloc internal OSD request, for OSD command execution */ | ||
336 | or = osd_start_request(osdev->osd, GFP_ATOMIC); | ||
337 | if (!or) { | ||
338 | bio_chain_put(bio); | ||
339 | OSDBLK_DEBUG("osd_start_request with err\n"); | ||
340 | break; | ||
341 | } | ||
342 | |||
343 | orq = &osdev->req[rq->tag]; | ||
344 | orq->rq = rq; | ||
345 | orq->bio = bio; | ||
346 | orq->osdev = osdev; | ||
347 | |||
348 | /* init OSD command: flush, write or read */ | ||
349 | if (do_flush) | ||
350 | osd_req_flush_object(or, &osdev->obj, | ||
351 | OSD_CDB_FLUSH_ALL, 0, 0); | ||
352 | else if (do_write) | ||
353 | osd_req_write(or, &osdev->obj, blk_rq_pos(rq) * 512ULL, | ||
354 | bio, blk_rq_bytes(rq)); | ||
355 | else | ||
356 | osd_req_read(or, &osdev->obj, blk_rq_pos(rq) * 512ULL, | ||
357 | bio, blk_rq_bytes(rq)); | ||
358 | |||
359 | OSDBLK_DEBUG("%s 0x%x bytes at 0x%llx\n", | ||
360 | do_flush ? "flush" : do_write ? | ||
361 | "write" : "read", blk_rq_bytes(rq), | ||
362 | blk_rq_pos(rq) * 512ULL); | ||
363 | |||
364 | /* begin OSD command execution */ | ||
365 | if (osd_async_op(or, osdblk_osd_complete, orq, | ||
366 | osdev->obj_cred)) { | ||
367 | osd_end_request(or); | ||
368 | blk_requeue_request(q, rq); | ||
369 | bio_chain_put(bio); | ||
370 | OSDBLK_DEBUG("osd_execute_request_async with err\n"); | ||
371 | break; | ||
372 | } | ||
373 | |||
374 | /* remove the special 'flush' marker, now that the command | ||
375 | * is executing | ||
376 | */ | ||
377 | rq->special = NULL; | ||
378 | } | ||
379 | } | ||
380 | |||
381 | static void osdblk_prepare_flush(struct request_queue *q, struct request *rq) | ||
382 | { | ||
383 | /* add driver-specific marker, to indicate that this request | ||
384 | * is a flush command | ||
385 | */ | ||
386 | rq->special = (void *) 0xdeadbeefUL; | ||
387 | } | ||
388 | |||
389 | static void osdblk_free_disk(struct osdblk_device *osdev) | ||
390 | { | ||
391 | struct gendisk *disk = osdev->disk; | ||
392 | |||
393 | if (!disk) | ||
394 | return; | ||
395 | |||
396 | if (disk->flags & GENHD_FL_UP) | ||
397 | del_gendisk(disk); | ||
398 | if (disk->queue) | ||
399 | blk_cleanup_queue(disk->queue); | ||
400 | put_disk(disk); | ||
401 | } | ||
402 | |||
403 | static int osdblk_init_disk(struct osdblk_device *osdev) | ||
404 | { | ||
405 | struct gendisk *disk; | ||
406 | struct request_queue *q; | ||
407 | int rc; | ||
408 | u64 obj_size = 0; | ||
409 | |||
410 | /* contact OSD, request size info about the object being mapped */ | ||
411 | rc = osdblk_get_obj_size(osdev, &obj_size); | ||
412 | if (rc) | ||
413 | return rc; | ||
414 | |||
415 | /* create gendisk info */ | ||
416 | disk = alloc_disk(OSDBLK_MINORS_PER_MAJOR); | ||
417 | if (!disk) | ||
418 | return -ENOMEM; | ||
419 | |||
420 | sprintf(disk->disk_name, DRV_NAME "%d", osdev->id); | ||
421 | disk->major = osdev->major; | ||
422 | disk->first_minor = 0; | ||
423 | disk->fops = &osdblk_bd_ops; | ||
424 | disk->private_data = osdev; | ||
425 | |||
426 | /* init rq */ | ||
427 | q = blk_init_queue(osdblk_rq_fn, &osdev->lock); | ||
428 | if (!q) { | ||
429 | put_disk(disk); | ||
430 | return -ENOMEM; | ||
431 | } | ||
432 | |||
433 | /* switch queue to TCQ mode; allocate tag map */ | ||
434 | rc = blk_queue_init_tags(q, OSDBLK_MAX_REQ, NULL); | ||
435 | if (rc) { | ||
436 | blk_cleanup_queue(q); | ||
437 | put_disk(disk); | ||
438 | return rc; | ||
439 | } | ||
440 | |||
441 | /* Set our limits to the lower device limits, because osdblk cannot | ||
442 | * sleep when allocating a lower-request and therefore cannot be | ||
443 | * bouncing. | ||
444 | */ | ||
445 | blk_queue_stack_limits(q, osd_request_queue(osdev->osd)); | ||
446 | |||
447 | blk_queue_prep_rq(q, blk_queue_start_tag); | ||
448 | blk_queue_ordered(q, QUEUE_ORDERED_DRAIN_FLUSH, osdblk_prepare_flush); | ||
449 | |||
450 | disk->queue = q; | ||
451 | |||
452 | q->queuedata = osdev; | ||
453 | |||
454 | osdev->disk = disk; | ||
455 | osdev->q = q; | ||
456 | |||
457 | /* finally, announce the disk to the world */ | ||
458 | set_capacity(disk, obj_size / 512ULL); | ||
459 | add_disk(disk); | ||
460 | |||
461 | printk(KERN_INFO "%s: Added of size 0x%llx\n", | ||
462 | disk->disk_name, (unsigned long long)obj_size); | ||
463 | |||
464 | return 0; | ||
465 | } | ||
466 | |||
467 | /******************************************************************** | ||
468 | * /sys/class/osdblk/ | ||
469 | * add map OSD object to blkdev | ||
470 | * remove unmap OSD object | ||
471 | * list show mappings | ||
472 | *******************************************************************/ | ||
473 | |||
474 | static void class_osdblk_release(struct class *cls) | ||
475 | { | ||
476 | kfree(cls); | ||
477 | } | ||
478 | |||
479 | static ssize_t class_osdblk_list(struct class *c, char *data) | ||
480 | { | ||
481 | int n = 0; | ||
482 | struct list_head *tmp; | ||
483 | |||
484 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); | ||
485 | |||
486 | list_for_each(tmp, &osdblkdev_list) { | ||
487 | struct osdblk_device *osdev; | ||
488 | |||
489 | osdev = list_entry(tmp, struct osdblk_device, node); | ||
490 | |||
491 | n += sprintf(data+n, "%d %d %llu %llu %s\n", | ||
492 | osdev->id, | ||
493 | osdev->major, | ||
494 | osdev->obj.partition, | ||
495 | osdev->obj.id, | ||
496 | osdev->osd_path); | ||
497 | } | ||
498 | |||
499 | mutex_unlock(&ctl_mutex); | ||
500 | return n; | ||
501 | } | ||
502 | |||
503 | static ssize_t class_osdblk_add(struct class *c, const char *buf, size_t count) | ||
504 | { | ||
505 | struct osdblk_device *osdev; | ||
506 | ssize_t rc; | ||
507 | int irc, new_id = 0; | ||
508 | struct list_head *tmp; | ||
509 | |||
510 | if (!try_module_get(THIS_MODULE)) | ||
511 | return -ENODEV; | ||
512 | |||
513 | /* new osdblk_device object */ | ||
514 | osdev = kzalloc(sizeof(*osdev) + strlen(buf) + 1, GFP_KERNEL); | ||
515 | if (!osdev) { | ||
516 | rc = -ENOMEM; | ||
517 | goto err_out_mod; | ||
518 | } | ||
519 | |||
520 | /* static osdblk_device initialization */ | ||
521 | spin_lock_init(&osdev->lock); | ||
522 | INIT_LIST_HEAD(&osdev->node); | ||
523 | |||
524 | /* generate unique id: find highest unique id, add one */ | ||
525 | |||
526 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); | ||
527 | |||
528 | list_for_each(tmp, &osdblkdev_list) { | ||
529 | struct osdblk_device *osdev; | ||
530 | |||
531 | osdev = list_entry(tmp, struct osdblk_device, node); | ||
532 | if (osdev->id > new_id) | ||
533 | new_id = osdev->id + 1; | ||
534 | } | ||
535 | |||
536 | osdev->id = new_id; | ||
537 | |||
538 | /* add to global list */ | ||
539 | list_add_tail(&osdev->node, &osdblkdev_list); | ||
540 | |||
541 | mutex_unlock(&ctl_mutex); | ||
542 | |||
543 | /* parse add command */ | ||
544 | if (sscanf(buf, "%llu %llu %s", &osdev->obj.partition, &osdev->obj.id, | ||
545 | osdev->osd_path) != 3) { | ||
546 | rc = -EINVAL; | ||
547 | goto err_out_slot; | ||
548 | } | ||
549 | |||
550 | /* initialize rest of new object */ | ||
551 | sprintf(osdev->name, DRV_NAME "%d", osdev->id); | ||
552 | |||
553 | /* contact requested OSD */ | ||
554 | osdev->osd = osduld_path_lookup(osdev->osd_path); | ||
555 | if (IS_ERR(osdev->osd)) { | ||
556 | rc = PTR_ERR(osdev->osd); | ||
557 | goto err_out_slot; | ||
558 | } | ||
559 | |||
560 | /* build OSD credential */ | ||
561 | osdblk_make_credential(osdev->obj_cred, &osdev->obj); | ||
562 | |||
563 | /* register our block device */ | ||
564 | irc = register_blkdev(0, osdev->name); | ||
565 | if (irc < 0) { | ||
566 | rc = irc; | ||
567 | goto err_out_osd; | ||
568 | } | ||
569 | |||
570 | osdev->major = irc; | ||
571 | |||
572 | /* set up and announce blkdev mapping */ | ||
573 | rc = osdblk_init_disk(osdev); | ||
574 | if (rc) | ||
575 | goto err_out_blkdev; | ||
576 | |||
577 | return count; | ||
578 | |||
579 | err_out_blkdev: | ||
580 | unregister_blkdev(osdev->major, osdev->name); | ||
581 | err_out_osd: | ||
582 | osduld_put_device(osdev->osd); | ||
583 | err_out_slot: | ||
584 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); | ||
585 | list_del_init(&osdev->node); | ||
586 | mutex_unlock(&ctl_mutex); | ||
587 | |||
588 | kfree(osdev); | ||
589 | err_out_mod: | ||
590 | OSDBLK_DEBUG("Error adding device %s\n", buf); | ||
591 | module_put(THIS_MODULE); | ||
592 | return rc; | ||
593 | } | ||
594 | |||
595 | static ssize_t class_osdblk_remove(struct class *c, const char *buf, | ||
596 | size_t count) | ||
597 | { | ||
598 | struct osdblk_device *osdev = NULL; | ||
599 | int target_id, rc; | ||
600 | unsigned long ul; | ||
601 | struct list_head *tmp; | ||
602 | |||
603 | rc = strict_strtoul(buf, 10, &ul); | ||
604 | if (rc) | ||
605 | return rc; | ||
606 | |||
607 | /* convert to int; abort if we lost anything in the conversion */ | ||
608 | target_id = (int) ul; | ||
609 | if (target_id != ul) | ||
610 | return -EINVAL; | ||
611 | |||
612 | /* remove object from list immediately */ | ||
613 | mutex_lock_nested(&ctl_mutex, SINGLE_DEPTH_NESTING); | ||
614 | |||
615 | list_for_each(tmp, &osdblkdev_list) { | ||
616 | osdev = list_entry(tmp, struct osdblk_device, node); | ||
617 | if (osdev->id == target_id) { | ||
618 | list_del_init(&osdev->node); | ||
619 | break; | ||
620 | } | ||
621 | osdev = NULL; | ||
622 | } | ||
623 | |||
624 | mutex_unlock(&ctl_mutex); | ||
625 | |||
626 | if (!osdev) | ||
627 | return -ENOENT; | ||
628 | |||
629 | /* clean up and free blkdev and associated OSD connection */ | ||
630 | osdblk_free_disk(osdev); | ||
631 | unregister_blkdev(osdev->major, osdev->name); | ||
632 | osduld_put_device(osdev->osd); | ||
633 | kfree(osdev); | ||
634 | |||
635 | /* release module ref */ | ||
636 | module_put(THIS_MODULE); | ||
637 | |||
638 | return count; | ||
639 | } | ||
640 | |||
641 | static struct class_attribute class_osdblk_attrs[] = { | ||
642 | __ATTR(add, 0200, NULL, class_osdblk_add), | ||
643 | __ATTR(remove, 0200, NULL, class_osdblk_remove), | ||
644 | __ATTR(list, 0444, class_osdblk_list, NULL), | ||
645 | __ATTR_NULL | ||
646 | }; | ||
647 | |||
648 | static int osdblk_sysfs_init(void) | ||
649 | { | ||
650 | int ret = 0; | ||
651 | |||
652 | /* | ||
653 | * create control files in sysfs | ||
654 | * /sys/class/osdblk/... | ||
655 | */ | ||
656 | class_osdblk = kzalloc(sizeof(*class_osdblk), GFP_KERNEL); | ||
657 | if (!class_osdblk) | ||
658 | return -ENOMEM; | ||
659 | |||
660 | class_osdblk->name = DRV_NAME; | ||
661 | class_osdblk->owner = THIS_MODULE; | ||
662 | class_osdblk->class_release = class_osdblk_release; | ||
663 | class_osdblk->class_attrs = class_osdblk_attrs; | ||
664 | |||
665 | ret = class_register(class_osdblk); | ||
666 | if (ret) { | ||
667 | kfree(class_osdblk); | ||
668 | class_osdblk = NULL; | ||
669 | printk(PFX "failed to create class osdblk\n"); | ||
670 | return ret; | ||
671 | } | ||
672 | |||
673 | return 0; | ||
674 | } | ||
675 | |||
676 | static void osdblk_sysfs_cleanup(void) | ||
677 | { | ||
678 | if (class_osdblk) | ||
679 | class_destroy(class_osdblk); | ||
680 | class_osdblk = NULL; | ||
681 | } | ||
682 | |||
683 | static int __init osdblk_init(void) | ||
684 | { | ||
685 | int rc; | ||
686 | |||
687 | rc = osdblk_sysfs_init(); | ||
688 | if (rc) | ||
689 | return rc; | ||
690 | |||
691 | return 0; | ||
692 | } | ||
693 | |||
694 | static void __exit osdblk_exit(void) | ||
695 | { | ||
696 | osdblk_sysfs_cleanup(); | ||
697 | } | ||
698 | |||
699 | module_init(osdblk_init); | ||
700 | module_exit(osdblk_exit); | ||
701 | |||
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 83650e00632d..99a506f619b7 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -1372,8 +1372,10 @@ try_next_bio: | |||
1372 | wakeup = (pd->write_congestion_on > 0 | 1372 | wakeup = (pd->write_congestion_on > 0 |
1373 | && pd->bio_queue_size <= pd->write_congestion_off); | 1373 | && pd->bio_queue_size <= pd->write_congestion_off); |
1374 | spin_unlock(&pd->lock); | 1374 | spin_unlock(&pd->lock); |
1375 | if (wakeup) | 1375 | if (wakeup) { |
1376 | clear_bdi_congested(&pd->disk->queue->backing_dev_info, WRITE); | 1376 | clear_bdi_congested(&pd->disk->queue->backing_dev_info, |
1377 | BLK_RW_ASYNC); | ||
1378 | } | ||
1377 | 1379 | ||
1378 | pkt->sleep_time = max(PACKET_WAIT_TIME, 1); | 1380 | pkt->sleep_time = max(PACKET_WAIT_TIME, 1); |
1379 | pkt_set_state(pkt, PACKET_WAITING_STATE); | 1381 | pkt_set_state(pkt, PACKET_WAITING_STATE); |
@@ -2592,10 +2594,10 @@ static int pkt_make_request(struct request_queue *q, struct bio *bio) | |||
2592 | spin_lock(&pd->lock); | 2594 | spin_lock(&pd->lock); |
2593 | if (pd->write_congestion_on > 0 | 2595 | if (pd->write_congestion_on > 0 |
2594 | && pd->bio_queue_size >= pd->write_congestion_on) { | 2596 | && pd->bio_queue_size >= pd->write_congestion_on) { |
2595 | set_bdi_congested(&q->backing_dev_info, WRITE); | 2597 | set_bdi_congested(&q->backing_dev_info, BLK_RW_ASYNC); |
2596 | do { | 2598 | do { |
2597 | spin_unlock(&pd->lock); | 2599 | spin_unlock(&pd->lock); |
2598 | congestion_wait(WRITE, HZ); | 2600 | congestion_wait(BLK_RW_ASYNC, HZ); |
2599 | spin_lock(&pd->lock); | 2601 | spin_lock(&pd->lock); |
2600 | } while(pd->bio_queue_size > pd->write_congestion_off); | 2602 | } while(pd->bio_queue_size > pd->write_congestion_off); |
2601 | } | 2603 | } |
diff --git a/drivers/block/xsysace.c b/drivers/block/xsysace.c index f08491a3a813..b20abe102a2b 100644 --- a/drivers/block/xsysace.c +++ b/drivers/block/xsysace.c | |||
@@ -390,9 +390,10 @@ static inline void ace_dump_mem(void *base, int len) | |||
390 | 390 | ||
391 | static void ace_dump_regs(struct ace_device *ace) | 391 | static void ace_dump_regs(struct ace_device *ace) |
392 | { | 392 | { |
393 | dev_info(ace->dev, " ctrl: %.8x seccnt/cmd: %.4x ver:%.4x\n" | 393 | dev_info(ace->dev, |
394 | KERN_INFO " status:%.8x mpu_lba:%.8x busmode:%4x\n" | 394 | " ctrl: %.8x seccnt/cmd: %.4x ver:%.4x\n" |
395 | KERN_INFO " error: %.8x cfg_lba:%.8x fatstat:%.4x\n", | 395 | " status:%.8x mpu_lba:%.8x busmode:%4x\n" |
396 | " error: %.8x cfg_lba:%.8x fatstat:%.4x\n", | ||
396 | ace_in32(ace, ACE_CTRL), | 397 | ace_in32(ace, ACE_CTRL), |
397 | ace_in(ace, ACE_SECCNTCMD), | 398 | ace_in(ace, ACE_SECCNTCMD), |
398 | ace_in(ace, ACE_VERSION), | 399 | ace_in(ace, ACE_VERSION), |
diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c index 1df9dda2e377..d5cde6d86f89 100644 --- a/drivers/bluetooth/hci_vhci.c +++ b/drivers/bluetooth/hci_vhci.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
30 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
31 | #include <linux/smp_lock.h> | ||
32 | #include <linux/types.h> | 31 | #include <linux/types.h> |
33 | #include <linux/errno.h> | 32 | #include <linux/errno.h> |
34 | #include <linux/sched.h> | 33 | #include <linux/sched.h> |
diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c index 72429b6b2fa8..6c32fbf07164 100644 --- a/drivers/char/amiserial.c +++ b/drivers/char/amiserial.c | |||
@@ -81,6 +81,7 @@ static char *serial_version = "4.30"; | |||
81 | #include <linux/mm.h> | 81 | #include <linux/mm.h> |
82 | #include <linux/seq_file.h> | 82 | #include <linux/seq_file.h> |
83 | #include <linux/slab.h> | 83 | #include <linux/slab.h> |
84 | #include <linux/smp_lock.h> | ||
84 | #include <linux/init.h> | 85 | #include <linux/init.h> |
85 | #include <linux/bitops.h> | 86 | #include <linux/bitops.h> |
86 | 87 | ||
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index f3366d3f06cf..2dafc2da0648 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c | |||
@@ -633,6 +633,7 @@ | |||
633 | #include <linux/tty.h> | 633 | #include <linux/tty.h> |
634 | #include <linux/tty_flip.h> | 634 | #include <linux/tty_flip.h> |
635 | #include <linux/serial.h> | 635 | #include <linux/serial.h> |
636 | #include <linux/smp_lock.h> | ||
636 | #include <linux/major.h> | 637 | #include <linux/major.h> |
637 | #include <linux/string.h> | 638 | #include <linux/string.h> |
638 | #include <linux/fcntl.h> | 639 | #include <linux/fcntl.h> |
diff --git a/drivers/char/epca.c b/drivers/char/epca.c index abef1f7d84fe..ff647ca1c489 100644 --- a/drivers/char/epca.c +++ b/drivers/char/epca.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/tty.h> | 36 | #include <linux/tty.h> |
37 | #include <linux/tty_flip.h> | 37 | #include <linux/tty_flip.h> |
38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | #include <linux/smp_lock.h> | ||
39 | #include <linux/ioport.h> | 40 | #include <linux/ioport.h> |
40 | #include <linux/interrupt.h> | 41 | #include <linux/interrupt.h> |
41 | #include <linux/uaccess.h> | 42 | #include <linux/uaccess.h> |
diff --git a/drivers/char/hw_random/intel-rng.c b/drivers/char/hw_random/intel-rng.c index 5dcbe603eca2..91b53eb1c053 100644 --- a/drivers/char/hw_random/intel-rng.c +++ b/drivers/char/hw_random/intel-rng.c | |||
@@ -305,10 +305,11 @@ static int __init intel_init_hw_struct(struct intel_rng_hw *intel_rng_hw, | |||
305 | (BIOS_CNTL_LOCK_ENABLE_MASK|BIOS_CNTL_WRITE_ENABLE_MASK)) | 305 | (BIOS_CNTL_LOCK_ENABLE_MASK|BIOS_CNTL_WRITE_ENABLE_MASK)) |
306 | == BIOS_CNTL_LOCK_ENABLE_MASK) { | 306 | == BIOS_CNTL_LOCK_ENABLE_MASK) { |
307 | static __initdata /*const*/ char warning[] = | 307 | static __initdata /*const*/ char warning[] = |
308 | KERN_WARNING PFX "Firmware space is locked read-only. If you can't or\n" | 308 | KERN_WARNING |
309 | KERN_WARNING PFX "don't want to disable this in firmware setup, and if\n" | 309 | PFX "Firmware space is locked read-only. If you can't or\n" |
310 | KERN_WARNING PFX "you are certain that your system has a functional\n" | 310 | PFX "don't want to disable this in firmware setup, and if\n" |
311 | KERN_WARNING PFX "RNG, try using the 'no_fwh_detect' option.\n"; | 311 | PFX "you are certain that your system has a functional\n" |
312 | PFX "RNG, try using the 'no_fwh_detect' option.\n"; | ||
312 | 313 | ||
313 | if (no_fwh_detect) | 314 | if (no_fwh_detect) |
314 | return -ENODEV; | 315 | return -ENODEV; |
diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c index 4159292e35cf..4f1f4cd670da 100644 --- a/drivers/char/isicom.c +++ b/drivers/char/isicom.c | |||
@@ -122,6 +122,7 @@ | |||
122 | #include <linux/fs.h> | 122 | #include <linux/fs.h> |
123 | #include <linux/sched.h> | 123 | #include <linux/sched.h> |
124 | #include <linux/serial.h> | 124 | #include <linux/serial.h> |
125 | #include <linux/smp_lock.h> | ||
125 | #include <linux/mm.h> | 126 | #include <linux/mm.h> |
126 | #include <linux/interrupt.h> | 127 | #include <linux/interrupt.h> |
127 | #include <linux/timer.h> | 128 | #include <linux/timer.h> |
@@ -1478,10 +1479,10 @@ static int __devinit load_firmware(struct pci_dev *pdev, | |||
1478 | status = inw(base + 0x4); | 1479 | status = inw(base + 0x4); |
1479 | if (status != 0) { | 1480 | if (status != 0) { |
1480 | dev_warn(&pdev->dev, "Card%d rejected load header:\n" | 1481 | dev_warn(&pdev->dev, "Card%d rejected load header:\n" |
1481 | KERN_WARNING "Address:0x%x\n" | 1482 | "Address:0x%x\n" |
1482 | KERN_WARNING "Count:0x%x\n" | 1483 | "Count:0x%x\n" |
1483 | KERN_WARNING "Status:0x%x\n", | 1484 | "Status:0x%x\n", |
1484 | index + 1, frame->addr, frame->count, status); | 1485 | index + 1, frame->addr, frame->count, status); |
1485 | goto errrelfw; | 1486 | goto errrelfw; |
1486 | } | 1487 | } |
1487 | outsw(base, frame->data, word_count); | 1488 | outsw(base, frame->data, word_count); |
@@ -1526,10 +1527,10 @@ static int __devinit load_firmware(struct pci_dev *pdev, | |||
1526 | status = inw(base + 0x4); | 1527 | status = inw(base + 0x4); |
1527 | if (status != 0) { | 1528 | if (status != 0) { |
1528 | dev_warn(&pdev->dev, "Card%d rejected verify header:\n" | 1529 | dev_warn(&pdev->dev, "Card%d rejected verify header:\n" |
1529 | KERN_WARNING "Address:0x%x\n" | 1530 | "Address:0x%x\n" |
1530 | KERN_WARNING "Count:0x%x\n" | 1531 | "Count:0x%x\n" |
1531 | KERN_WARNING "Status: 0x%x\n", | 1532 | "Status: 0x%x\n", |
1532 | index + 1, frame->addr, frame->count, status); | 1533 | index + 1, frame->addr, frame->count, status); |
1533 | goto errrelfw; | 1534 | goto errrelfw; |
1534 | } | 1535 | } |
1535 | 1536 | ||
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index 0c999f5bb3db..ab2f3349c5c4 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/slab.h> | 22 | #include <linux/slab.h> |
23 | #include <linux/smp_lock.h> | ||
23 | #include <linux/interrupt.h> | 24 | #include <linux/interrupt.h> |
24 | #include <linux/tty.h> | 25 | #include <linux/tty.h> |
25 | #include <linux/tty_flip.h> | 26 | #include <linux/tty_flip.h> |
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c index 65b6ff2442c6..dd0083bbb64a 100644 --- a/drivers/char/moxa.c +++ b/drivers/char/moxa.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/tty.h> | 34 | #include <linux/tty.h> |
35 | #include <linux/tty_flip.h> | 35 | #include <linux/tty_flip.h> |
36 | #include <linux/major.h> | 36 | #include <linux/major.h> |
37 | #include <linux/smp_lock.h> | ||
37 | #include <linux/string.h> | 38 | #include <linux/string.h> |
38 | #include <linux/fcntl.h> | 39 | #include <linux/fcntl.h> |
39 | #include <linux/ptrace.h> | 40 | #include <linux/ptrace.h> |
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index 52d953eb30c3..dbf8d52f31d0 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/errno.h> | 23 | #include <linux/errno.h> |
24 | #include <linux/signal.h> | 24 | #include <linux/signal.h> |
25 | #include <linux/sched.h> | 25 | #include <linux/sched.h> |
26 | #include <linux/smp_lock.h> | ||
26 | #include <linux/timer.h> | 27 | #include <linux/timer.h> |
27 | #include <linux/interrupt.h> | 28 | #include <linux/interrupt.h> |
28 | #include <linux/tty.h> | 29 | #include <linux/tty.h> |
diff --git a/drivers/char/n_hdlc.c b/drivers/char/n_hdlc.c index 1c43c8cdee25..c68118efad84 100644 --- a/drivers/char/n_hdlc.c +++ b/drivers/char/n_hdlc.c | |||
@@ -97,6 +97,7 @@ | |||
97 | #include <linux/slab.h> | 97 | #include <linux/slab.h> |
98 | #include <linux/tty.h> | 98 | #include <linux/tty.h> |
99 | #include <linux/errno.h> | 99 | #include <linux/errno.h> |
100 | #include <linux/smp_lock.h> | ||
100 | #include <linux/string.h> /* used in new tty drivers */ | 101 | #include <linux/string.h> /* used in new tty drivers */ |
101 | #include <linux/signal.h> /* used in new tty drivers */ | 102 | #include <linux/signal.h> /* used in new tty drivers */ |
102 | #include <linux/if.h> | 103 | #include <linux/if.h> |
diff --git a/drivers/char/n_r3964.c b/drivers/char/n_r3964.c index 2e99158ebb8a..6934025a1ac1 100644 --- a/drivers/char/n_r3964.c +++ b/drivers/char/n_r3964.c | |||
@@ -58,6 +58,7 @@ | |||
58 | #include <linux/ioport.h> | 58 | #include <linux/ioport.h> |
59 | #include <linux/in.h> | 59 | #include <linux/in.h> |
60 | #include <linux/slab.h> | 60 | #include <linux/slab.h> |
61 | #include <linux/smp_lock.h> | ||
61 | #include <linux/tty.h> | 62 | #include <linux/tty.h> |
62 | #include <linux/errno.h> | 63 | #include <linux/errno.h> |
63 | #include <linux/string.h> /* used in new tty drivers */ | 64 | #include <linux/string.h> /* used in new tty drivers */ |
diff --git a/drivers/char/pty.c b/drivers/char/pty.c index daebe1ba43d4..6e6942c45f5b 100644 --- a/drivers/char/pty.c +++ b/drivers/char/pty.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/major.h> | 22 | #include <linux/major.h> |
23 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/smp_lock.h> | ||
25 | #include <linux/sysctl.h> | 26 | #include <linux/sysctl.h> |
26 | #include <linux/device.h> | 27 | #include <linux/device.h> |
27 | #include <linux/uaccess.h> | 28 | #include <linux/uaccess.h> |
@@ -75,114 +76,88 @@ static void pty_close(struct tty_struct *tty, struct file *filp) | |||
75 | */ | 76 | */ |
76 | static void pty_unthrottle(struct tty_struct *tty) | 77 | static void pty_unthrottle(struct tty_struct *tty) |
77 | { | 78 | { |
78 | struct tty_struct *o_tty = tty->link; | 79 | tty_wakeup(tty->link); |
79 | |||
80 | if (!o_tty) | ||
81 | return; | ||
82 | |||
83 | tty_wakeup(o_tty); | ||
84 | set_bit(TTY_THROTTLED, &tty->flags); | 80 | set_bit(TTY_THROTTLED, &tty->flags); |
85 | } | 81 | } |
86 | 82 | ||
87 | /* | 83 | /** |
88 | * WSH 05/24/97: modified to | 84 | * pty_space - report space left for writing |
89 | * (1) use space in tty->flip instead of a shared temp buffer | 85 | * @to: tty we are writing into |
90 | * The flip buffers aren't being used for a pty, so there's lots | ||
91 | * of space available. The buffer is protected by a per-pty | ||
92 | * semaphore that should almost never come under contention. | ||
93 | * (2) avoid redundant copying for cases where count >> receive_room | ||
94 | * N.B. Calls from user space may now return an error code instead of | ||
95 | * a count. | ||
96 | * | 86 | * |
97 | * FIXME: Our pty_write method is called with our ldisc lock held but | 87 | * The tty buffers allow 64K but we sneak a peak and clip at 8K this |
98 | * not our partners. We can't just wait on the other one blindly without | 88 | * allows a lot of overspill room for echo and other fun messes to |
99 | * risking deadlocks. At some point when everything has settled down we need | 89 | * be handled properly |
100 | * to look into making pty_write at least able to sleep over an ldisc change. | 90 | */ |
91 | |||
92 | static int pty_space(struct tty_struct *to) | ||
93 | { | ||
94 | int n = 8192 - to->buf.memory_used; | ||
95 | if (n < 0) | ||
96 | return 0; | ||
97 | return n; | ||
98 | } | ||
99 | |||
100 | /** | ||
101 | * pty_write - write to a pty | ||
102 | * @tty: the tty we write from | ||
103 | * @buf: kernel buffer of data | ||
104 | * @count: bytes to write | ||
101 | * | 105 | * |
102 | * The return on no ldisc is a bit counter intuitive but the logic works | 106 | * Our "hardware" write method. Data is coming from the ldisc which |
103 | * like this. During an ldisc change the other end will flush its buffers. We | 107 | * may be in a non sleeping state. We simply throw this at the other |
104 | * thus return the full length which is identical to the case where we had | 108 | * end of the link as if we were an IRQ handler receiving stuff for |
105 | * proper locking and happened to queue the bytes just before the flush during | 109 | * the other side of the pty/tty pair. |
106 | * the ldisc change. | ||
107 | */ | 110 | */ |
111 | |||
108 | static int pty_write(struct tty_struct *tty, const unsigned char *buf, | 112 | static int pty_write(struct tty_struct *tty, const unsigned char *buf, |
109 | int count) | 113 | int count) |
110 | { | 114 | { |
111 | struct tty_struct *to = tty->link; | 115 | struct tty_struct *to = tty->link; |
112 | struct tty_ldisc *ld; | 116 | int c; |
113 | int c = count; | ||
114 | 117 | ||
115 | if (!to || tty->stopped) | 118 | if (tty->stopped) |
116 | return 0; | 119 | return 0; |
117 | ld = tty_ldisc_ref(to); | 120 | |
118 | 121 | /* This isn't locked but our 8K is quite sloppy so no | |
119 | if (ld) { | 122 | big deal */ |
120 | c = to->receive_room; | 123 | |
121 | if (c > count) | 124 | c = pty_space(to); |
122 | c = count; | 125 | if (c > count) |
123 | ld->ops->receive_buf(to, buf, NULL, c); | 126 | c = count; |
124 | tty_ldisc_deref(ld); | 127 | if (c > 0) { |
128 | /* Stuff the data into the input queue of the other end */ | ||
129 | c = tty_insert_flip_string(to, buf, c); | ||
130 | /* And shovel */ | ||
131 | tty_flip_buffer_push(to); | ||
132 | tty_wakeup(tty); | ||
125 | } | 133 | } |
126 | return c; | 134 | return c; |
127 | } | 135 | } |
128 | 136 | ||
137 | /** | ||
138 | * pty_write_room - write space | ||
139 | * @tty: tty we are writing from | ||
140 | * | ||
141 | * Report how many bytes the ldisc can send into the queue for | ||
142 | * the other device. | ||
143 | */ | ||
144 | |||
129 | static int pty_write_room(struct tty_struct *tty) | 145 | static int pty_write_room(struct tty_struct *tty) |
130 | { | 146 | { |
131 | struct tty_struct *to = tty->link; | 147 | return pty_space(tty->link); |
132 | |||
133 | if (!to || tty->stopped) | ||
134 | return 0; | ||
135 | |||
136 | return to->receive_room; | ||
137 | } | 148 | } |
138 | 149 | ||
139 | /* | 150 | /** |
140 | * WSH 05/24/97: Modified for asymmetric MASTER/SLAVE behavior | 151 | * pty_chars_in_buffer - characters currently in our tx queue |
141 | * The chars_in_buffer() value is used by the ldisc select() function | 152 | * @tty: our tty |
142 | * to hold off writing when chars_in_buffer > WAKEUP_CHARS (== 256). | ||
143 | * The pty driver chars_in_buffer() Master/Slave must behave differently: | ||
144 | * | ||
145 | * The Master side needs to allow typed-ahead commands to accumulate | ||
146 | * while being canonicalized, so we report "our buffer" as empty until | ||
147 | * some threshold is reached, and then report the count. (Any count > | ||
148 | * WAKEUP_CHARS is regarded by select() as "full".) To avoid deadlock | ||
149 | * the count returned must be 0 if no canonical data is available to be | ||
150 | * read. (The N_TTY ldisc.chars_in_buffer now knows this.) | ||
151 | * | 153 | * |
152 | * The Slave side passes all characters in raw mode to the Master side's | 154 | * Report how much we have in the transmit queue. As everything is |
153 | * buffer where they can be read immediately, so in this case we can | 155 | * instantly at the other end this is easy to implement. |
154 | * return the true count in the buffer. | ||
155 | */ | 156 | */ |
157 | |||
156 | static int pty_chars_in_buffer(struct tty_struct *tty) | 158 | static int pty_chars_in_buffer(struct tty_struct *tty) |
157 | { | 159 | { |
158 | struct tty_struct *to = tty->link; | 160 | return 0; |
159 | struct tty_ldisc *ld; | ||
160 | int count = 0; | ||
161 | |||
162 | /* We should get the line discipline lock for "tty->link" */ | ||
163 | if (!to) | ||
164 | return 0; | ||
165 | /* We cannot take a sleeping reference here without deadlocking with | ||
166 | an ldisc change - but it doesn't really matter */ | ||
167 | ld = tty_ldisc_ref(to); | ||
168 | if (ld == NULL) | ||
169 | return 0; | ||
170 | |||
171 | /* The ldisc must report 0 if no characters available to be read */ | ||
172 | if (ld->ops->chars_in_buffer) | ||
173 | count = ld->ops->chars_in_buffer(to); | ||
174 | |||
175 | tty_ldisc_deref(ld); | ||
176 | |||
177 | if (tty->driver->subtype == PTY_TYPE_SLAVE) | ||
178 | return count; | ||
179 | |||
180 | /* Master side driver ... if the other side's read buffer is less than | ||
181 | * half full, return 0 to allow writers to proceed; otherwise return | ||
182 | * the count. This leaves a comfortable margin to avoid overflow, | ||
183 | * and still allows half a buffer's worth of typed-ahead commands. | ||
184 | */ | ||
185 | return (count < N_TTY_BUF_SIZE/2) ? 0 : count; | ||
186 | } | 161 | } |
187 | 162 | ||
188 | /* Set the lock flag on a pty */ | 163 | /* Set the lock flag on a pty */ |
@@ -202,20 +177,10 @@ static void pty_flush_buffer(struct tty_struct *tty) | |||
202 | { | 177 | { |
203 | struct tty_struct *to = tty->link; | 178 | struct tty_struct *to = tty->link; |
204 | unsigned long flags; | 179 | unsigned long flags; |
205 | struct tty_ldisc *ld; | ||
206 | 180 | ||
207 | if (!to) | 181 | if (!to) |
208 | return; | 182 | return; |
209 | ld = tty_ldisc_ref(to); | 183 | /* tty_buffer_flush(to); FIXME */ |
210 | |||
211 | /* The other end is changing discipline */ | ||
212 | if (!ld) | ||
213 | return; | ||
214 | |||
215 | if (ld->ops->flush_buffer) | ||
216 | to->ldisc->ops->flush_buffer(to); | ||
217 | tty_ldisc_deref(ld); | ||
218 | |||
219 | if (to->packet) { | 184 | if (to->packet) { |
220 | spin_lock_irqsave(&tty->ctrl_lock, flags); | 185 | spin_lock_irqsave(&tty->ctrl_lock, flags); |
221 | tty->ctrl_status |= TIOCPKT_FLUSHWRITE; | 186 | tty->ctrl_status |= TIOCPKT_FLUSHWRITE; |
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c index ce81da5b2da9..d58c2eb07f07 100644 --- a/drivers/char/rio/rio_linux.c +++ b/drivers/char/rio/rio_linux.c | |||
@@ -44,6 +44,7 @@ | |||
44 | #include <linux/delay.h> | 44 | #include <linux/delay.h> |
45 | #include <linux/pci.h> | 45 | #include <linux/pci.h> |
46 | #include <linux/slab.h> | 46 | #include <linux/slab.h> |
47 | #include <linux/smp_lock.h> | ||
47 | #include <linux/miscdevice.h> | 48 | #include <linux/miscdevice.h> |
48 | #include <linux/init.h> | 49 | #include <linux/init.h> |
49 | 50 | ||
diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c index 217660451237..171711acf5cd 100644 --- a/drivers/char/riscom8.c +++ b/drivers/char/riscom8.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/init.h> | 47 | #include <linux/init.h> |
48 | #include <linux/delay.h> | 48 | #include <linux/delay.h> |
49 | #include <linux/tty_flip.h> | 49 | #include <linux/tty_flip.h> |
50 | #include <linux/smp_lock.h> | ||
50 | #include <linux/spinlock.h> | 51 | #include <linux/spinlock.h> |
51 | #include <linux/device.h> | 52 | #include <linux/device.h> |
52 | 53 | ||
diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c index 63d5b628477a..0e29a23ec4c5 100644 --- a/drivers/char/rocket.c +++ b/drivers/char/rocket.c | |||
@@ -73,6 +73,7 @@ | |||
73 | #include <linux/tty_driver.h> | 73 | #include <linux/tty_driver.h> |
74 | #include <linux/tty_flip.h> | 74 | #include <linux/tty_flip.h> |
75 | #include <linux/serial.h> | 75 | #include <linux/serial.h> |
76 | #include <linux/smp_lock.h> | ||
76 | #include <linux/string.h> | 77 | #include <linux/string.h> |
77 | #include <linux/fcntl.h> | 78 | #include <linux/fcntl.h> |
78 | #include <linux/ptrace.h> | 79 | #include <linux/ptrace.h> |
diff --git a/drivers/char/serial167.c b/drivers/char/serial167.c index f1f24f0ee26f..51e7a46787be 100644 --- a/drivers/char/serial167.c +++ b/drivers/char/serial167.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <linux/interrupt.h> | 52 | #include <linux/interrupt.h> |
53 | #include <linux/serial.h> | 53 | #include <linux/serial.h> |
54 | #include <linux/serialP.h> | 54 | #include <linux/serialP.h> |
55 | #include <linux/smp_lock.h> | ||
55 | #include <linux/string.h> | 56 | #include <linux/string.h> |
56 | #include <linux/fcntl.h> | 57 | #include <linux/fcntl.h> |
57 | #include <linux/ptrace.h> | 58 | #include <linux/ptrace.h> |
diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c index e72be4190a44..bfe4cdb2febb 100644 --- a/drivers/char/specialix.c +++ b/drivers/char/specialix.c | |||
@@ -87,6 +87,7 @@ | |||
87 | #include <linux/tty_flip.h> | 87 | #include <linux/tty_flip.h> |
88 | #include <linux/mm.h> | 88 | #include <linux/mm.h> |
89 | #include <linux/serial.h> | 89 | #include <linux/serial.h> |
90 | #include <linux/smp_lock.h> | ||
90 | #include <linux/fcntl.h> | 91 | #include <linux/fcntl.h> |
91 | #include <linux/major.h> | 92 | #include <linux/major.h> |
92 | #include <linux/delay.h> | 93 | #include <linux/delay.h> |
diff --git a/drivers/char/sx.c b/drivers/char/sx.c index 518f2a25d91e..a81ec4fcf6ff 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c | |||
@@ -216,6 +216,7 @@ | |||
216 | #include <linux/eisa.h> | 216 | #include <linux/eisa.h> |
217 | #include <linux/pci.h> | 217 | #include <linux/pci.h> |
218 | #include <linux/slab.h> | 218 | #include <linux/slab.h> |
219 | #include <linux/smp_lock.h> | ||
219 | #include <linux/init.h> | 220 | #include <linux/init.h> |
220 | #include <linux/miscdevice.h> | 221 | #include <linux/miscdevice.h> |
221 | #include <linux/bitops.h> | 222 | #include <linux/bitops.h> |
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index afded3a2379c..813552f14884 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c | |||
@@ -81,6 +81,7 @@ | |||
81 | #include <linux/mm.h> | 81 | #include <linux/mm.h> |
82 | #include <linux/seq_file.h> | 82 | #include <linux/seq_file.h> |
83 | #include <linux/slab.h> | 83 | #include <linux/slab.h> |
84 | #include <linux/smp_lock.h> | ||
84 | #include <linux/delay.h> | 85 | #include <linux/delay.h> |
85 | #include <linux/netdevice.h> | 86 | #include <linux/netdevice.h> |
86 | #include <linux/vmalloc.h> | 87 | #include <linux/vmalloc.h> |
diff --git a/drivers/char/synclink_gt.c b/drivers/char/synclink_gt.c index a2e67e6df3a1..91f20a92fddf 100644 --- a/drivers/char/synclink_gt.c +++ b/drivers/char/synclink_gt.c | |||
@@ -62,6 +62,7 @@ | |||
62 | #include <linux/mm.h> | 62 | #include <linux/mm.h> |
63 | #include <linux/seq_file.h> | 63 | #include <linux/seq_file.h> |
64 | #include <linux/slab.h> | 64 | #include <linux/slab.h> |
65 | #include <linux/smp_lock.h> | ||
65 | #include <linux/netdevice.h> | 66 | #include <linux/netdevice.h> |
66 | #include <linux/vmalloc.h> | 67 | #include <linux/vmalloc.h> |
67 | #include <linux/init.h> | 68 | #include <linux/init.h> |
diff --git a/drivers/char/synclinkmp.c b/drivers/char/synclinkmp.c index 6f727e3c53ad..8d4a2a8a0a70 100644 --- a/drivers/char/synclinkmp.c +++ b/drivers/char/synclinkmp.c | |||
@@ -52,6 +52,7 @@ | |||
52 | #include <linux/mm.h> | 52 | #include <linux/mm.h> |
53 | #include <linux/seq_file.h> | 53 | #include <linux/seq_file.h> |
54 | #include <linux/slab.h> | 54 | #include <linux/slab.h> |
55 | #include <linux/smp_lock.h> | ||
55 | #include <linux/netdevice.h> | 56 | #include <linux/netdevice.h> |
56 | #include <linux/vmalloc.h> | 57 | #include <linux/vmalloc.h> |
57 | #include <linux/init.h> | 58 | #include <linux/init.h> |
diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c index ccdd828adcef..b0603b2e5684 100644 --- a/drivers/char/tpm/tpm.c +++ b/drivers/char/tpm/tpm.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/poll.h> | 26 | #include <linux/poll.h> |
27 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
28 | #include <linux/spinlock.h> | 28 | #include <linux/spinlock.h> |
29 | #include <linux/smp_lock.h> | ||
30 | 29 | ||
31 | #include "tpm.h" | 30 | #include "tpm.h" |
32 | 31 | ||
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c index b24f6c6a1ea3..ad6ba4ed2808 100644 --- a/drivers/char/tty_ioctl.c +++ b/drivers/char/tty_ioctl.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
22 | #include <linux/bitops.h> | 22 | #include <linux/bitops.h> |
23 | #include <linux/mutex.h> | 23 | #include <linux/mutex.h> |
24 | #include <linux/smp_lock.h> | ||
25 | 24 | ||
26 | #include <asm/io.h> | 25 | #include <asm/io.h> |
27 | #include <asm/uaccess.h> | 26 | #include <asm/uaccess.h> |
diff --git a/drivers/char/tty_ldisc.c b/drivers/char/tty_ldisc.c index 913aa8d3f1c5..0ef0dc97ba20 100644 --- a/drivers/char/tty_ldisc.c +++ b/drivers/char/tty_ldisc.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/proc_fs.h> | 21 | #include <linux/proc_fs.h> |
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/smp_lock.h> | ||
25 | #include <linux/device.h> | 24 | #include <linux/device.h> |
26 | #include <linux/wait.h> | 25 | #include <linux/wait.h> |
27 | #include <linux/bitops.h> | 26 | #include <linux/bitops.h> |
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index d9113b4c76e3..7947bd1b4cf7 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c | |||
@@ -89,6 +89,7 @@ | |||
89 | #include <linux/mutex.h> | 89 | #include <linux/mutex.h> |
90 | #include <linux/vt_kern.h> | 90 | #include <linux/vt_kern.h> |
91 | #include <linux/selection.h> | 91 | #include <linux/selection.h> |
92 | #include <linux/smp_lock.h> | ||
92 | #include <linux/tiocl.h> | 93 | #include <linux/tiocl.h> |
93 | #include <linux/kbd_kern.h> | 94 | #include <linux/kbd_kern.h> |
94 | #include <linux/consolemap.h> | 95 | #include <linux/consolemap.h> |
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c index 7539bed0f7e0..95189f288f8c 100644 --- a/drivers/char/vt_ioctl.c +++ b/drivers/char/vt_ioctl.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/console.h> | 25 | #include <linux/console.h> |
26 | #include <linux/consolemap.h> | 26 | #include <linux/consolemap.h> |
27 | #include <linux/signal.h> | 27 | #include <linux/signal.h> |
28 | #include <linux/smp_lock.h> | ||
28 | #include <linux/timex.h> | 29 | #include <linux/timex.h> |
29 | 30 | ||
30 | #include <asm/io.h> | 31 | #include <asm/io.h> |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 6e2ec0b18948..b90eda8b3440 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -761,6 +761,10 @@ static struct kobj_type ktype_cpufreq = { | |||
761 | * cpufreq_add_dev - add a CPU device | 761 | * cpufreq_add_dev - add a CPU device |
762 | * | 762 | * |
763 | * Adds the cpufreq interface for a CPU device. | 763 | * Adds the cpufreq interface for a CPU device. |
764 | * | ||
765 | * The Oracle says: try running cpufreq registration/unregistration concurrently | ||
766 | * with with cpu hotplugging and all hell will break loose. Tried to clean this | ||
767 | * mess up, but more thorough testing is needed. - Mathieu | ||
764 | */ | 768 | */ |
765 | static int cpufreq_add_dev(struct sys_device *sys_dev) | 769 | static int cpufreq_add_dev(struct sys_device *sys_dev) |
766 | { | 770 | { |
@@ -772,9 +776,6 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) | |||
772 | struct sys_device *cpu_sys_dev; | 776 | struct sys_device *cpu_sys_dev; |
773 | unsigned long flags; | 777 | unsigned long flags; |
774 | unsigned int j; | 778 | unsigned int j; |
775 | #ifdef CONFIG_SMP | ||
776 | struct cpufreq_policy *managed_policy; | ||
777 | #endif | ||
778 | 779 | ||
779 | if (cpu_is_offline(cpu)) | 780 | if (cpu_is_offline(cpu)) |
780 | return 0; | 781 | return 0; |
@@ -804,15 +805,12 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) | |||
804 | goto nomem_out; | 805 | goto nomem_out; |
805 | } | 806 | } |
806 | if (!alloc_cpumask_var(&policy->cpus, GFP_KERNEL)) { | 807 | if (!alloc_cpumask_var(&policy->cpus, GFP_KERNEL)) { |
807 | kfree(policy); | ||
808 | ret = -ENOMEM; | 808 | ret = -ENOMEM; |
809 | goto nomem_out; | 809 | goto err_free_policy; |
810 | } | 810 | } |
811 | if (!zalloc_cpumask_var(&policy->related_cpus, GFP_KERNEL)) { | 811 | if (!zalloc_cpumask_var(&policy->related_cpus, GFP_KERNEL)) { |
812 | free_cpumask_var(policy->cpus); | ||
813 | kfree(policy); | ||
814 | ret = -ENOMEM; | 812 | ret = -ENOMEM; |
815 | goto nomem_out; | 813 | goto err_free_cpumask; |
816 | } | 814 | } |
817 | 815 | ||
818 | policy->cpu = cpu; | 816 | policy->cpu = cpu; |
@@ -820,7 +818,8 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) | |||
820 | 818 | ||
821 | /* Initially set CPU itself as the policy_cpu */ | 819 | /* Initially set CPU itself as the policy_cpu */ |
822 | per_cpu(policy_cpu, cpu) = cpu; | 820 | per_cpu(policy_cpu, cpu) = cpu; |
823 | lock_policy_rwsem_write(cpu); | 821 | ret = (lock_policy_rwsem_write(cpu) < 0); |
822 | WARN_ON(ret); | ||
824 | 823 | ||
825 | init_completion(&policy->kobj_unregister); | 824 | init_completion(&policy->kobj_unregister); |
826 | INIT_WORK(&policy->update, handle_update); | 825 | INIT_WORK(&policy->update, handle_update); |
@@ -833,7 +832,7 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) | |||
833 | ret = cpufreq_driver->init(policy); | 832 | ret = cpufreq_driver->init(policy); |
834 | if (ret) { | 833 | if (ret) { |
835 | dprintk("initialization failed\n"); | 834 | dprintk("initialization failed\n"); |
836 | goto err_out; | 835 | goto err_unlock_policy; |
837 | } | 836 | } |
838 | policy->user_policy.min = policy->min; | 837 | policy->user_policy.min = policy->min; |
839 | policy->user_policy.max = policy->max; | 838 | policy->user_policy.max = policy->max; |
@@ -852,21 +851,29 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) | |||
852 | #endif | 851 | #endif |
853 | 852 | ||
854 | for_each_cpu(j, policy->cpus) { | 853 | for_each_cpu(j, policy->cpus) { |
854 | struct cpufreq_policy *managed_policy; | ||
855 | |||
855 | if (cpu == j) | 856 | if (cpu == j) |
856 | continue; | 857 | continue; |
857 | 858 | ||
858 | /* Check for existing affected CPUs. | 859 | /* Check for existing affected CPUs. |
859 | * They may not be aware of it due to CPU Hotplug. | 860 | * They may not be aware of it due to CPU Hotplug. |
860 | */ | 861 | */ |
861 | managed_policy = cpufreq_cpu_get(j); /* FIXME: Where is this released? What about error paths? */ | 862 | managed_policy = cpufreq_cpu_get(j); |
862 | if (unlikely(managed_policy)) { | 863 | if (unlikely(managed_policy)) { |
863 | 864 | ||
864 | /* Set proper policy_cpu */ | 865 | /* Set proper policy_cpu */ |
865 | unlock_policy_rwsem_write(cpu); | 866 | unlock_policy_rwsem_write(cpu); |
866 | per_cpu(policy_cpu, cpu) = managed_policy->cpu; | 867 | per_cpu(policy_cpu, cpu) = managed_policy->cpu; |
867 | 868 | ||
868 | if (lock_policy_rwsem_write(cpu) < 0) | 869 | if (lock_policy_rwsem_write(cpu) < 0) { |
869 | goto err_out_driver_exit; | 870 | /* Should not go through policy unlock path */ |
871 | if (cpufreq_driver->exit) | ||
872 | cpufreq_driver->exit(policy); | ||
873 | ret = -EBUSY; | ||
874 | cpufreq_cpu_put(managed_policy); | ||
875 | goto err_free_cpumask; | ||
876 | } | ||
870 | 877 | ||
871 | spin_lock_irqsave(&cpufreq_driver_lock, flags); | 878 | spin_lock_irqsave(&cpufreq_driver_lock, flags); |
872 | cpumask_copy(managed_policy->cpus, policy->cpus); | 879 | cpumask_copy(managed_policy->cpus, policy->cpus); |
@@ -877,12 +884,14 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) | |||
877 | ret = sysfs_create_link(&sys_dev->kobj, | 884 | ret = sysfs_create_link(&sys_dev->kobj, |
878 | &managed_policy->kobj, | 885 | &managed_policy->kobj, |
879 | "cpufreq"); | 886 | "cpufreq"); |
880 | if (ret) | 887 | if (!ret) |
881 | goto err_out_driver_exit; | 888 | cpufreq_cpu_put(managed_policy); |
882 | 889 | /* | |
883 | cpufreq_debug_enable_ratelimit(); | 890 | * Success. We only needed to be added to the mask. |
884 | ret = 0; | 891 | * Call driver->exit() because only the cpu parent of |
885 | goto err_out_driver_exit; /* call driver->exit() */ | 892 | * the kobj needed to call init(). |
893 | */ | ||
894 | goto out_driver_exit; /* call driver->exit() */ | ||
886 | } | 895 | } |
887 | } | 896 | } |
888 | #endif | 897 | #endif |
@@ -892,25 +901,25 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) | |||
892 | ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq, &sys_dev->kobj, | 901 | ret = kobject_init_and_add(&policy->kobj, &ktype_cpufreq, &sys_dev->kobj, |
893 | "cpufreq"); | 902 | "cpufreq"); |
894 | if (ret) | 903 | if (ret) |
895 | goto err_out_driver_exit; | 904 | goto out_driver_exit; |
896 | 905 | ||
897 | /* set up files for this cpu device */ | 906 | /* set up files for this cpu device */ |
898 | drv_attr = cpufreq_driver->attr; | 907 | drv_attr = cpufreq_driver->attr; |
899 | while ((drv_attr) && (*drv_attr)) { | 908 | while ((drv_attr) && (*drv_attr)) { |
900 | ret = sysfs_create_file(&policy->kobj, &((*drv_attr)->attr)); | 909 | ret = sysfs_create_file(&policy->kobj, &((*drv_attr)->attr)); |
901 | if (ret) | 910 | if (ret) |
902 | goto err_out_driver_exit; | 911 | goto err_out_kobj_put; |
903 | drv_attr++; | 912 | drv_attr++; |
904 | } | 913 | } |
905 | if (cpufreq_driver->get) { | 914 | if (cpufreq_driver->get) { |
906 | ret = sysfs_create_file(&policy->kobj, &cpuinfo_cur_freq.attr); | 915 | ret = sysfs_create_file(&policy->kobj, &cpuinfo_cur_freq.attr); |
907 | if (ret) | 916 | if (ret) |
908 | goto err_out_driver_exit; | 917 | goto err_out_kobj_put; |
909 | } | 918 | } |
910 | if (cpufreq_driver->target) { | 919 | if (cpufreq_driver->target) { |
911 | ret = sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr); | 920 | ret = sysfs_create_file(&policy->kobj, &scaling_cur_freq.attr); |
912 | if (ret) | 921 | if (ret) |
913 | goto err_out_driver_exit; | 922 | goto err_out_kobj_put; |
914 | } | 923 | } |
915 | 924 | ||
916 | spin_lock_irqsave(&cpufreq_driver_lock, flags); | 925 | spin_lock_irqsave(&cpufreq_driver_lock, flags); |
@@ -922,18 +931,22 @@ static int cpufreq_add_dev(struct sys_device *sys_dev) | |||
922 | 931 | ||
923 | /* symlink affected CPUs */ | 932 | /* symlink affected CPUs */ |
924 | for_each_cpu(j, policy->cpus) { | 933 | for_each_cpu(j, policy->cpus) { |
934 | struct cpufreq_policy *managed_policy; | ||
935 | |||
925 | if (j == cpu) | 936 | if (j == cpu) |
926 | continue; | 937 | continue; |
927 | if (!cpu_online(j)) | 938 | if (!cpu_online(j)) |
928 | continue; | 939 | continue; |
929 | 940 | ||
930 | dprintk("CPU %u already managed, adding link\n", j); | 941 | dprintk("CPU %u already managed, adding link\n", j); |
931 | cpufreq_cpu_get(cpu); | 942 | managed_policy = cpufreq_cpu_get(cpu); |
932 | cpu_sys_dev = get_cpu_sysdev(j); | 943 | cpu_sys_dev = get_cpu_sysdev(j); |
933 | ret = sysfs_create_link(&cpu_sys_dev->kobj, &policy->kobj, | 944 | ret = sysfs_create_link(&cpu_sys_dev->kobj, &policy->kobj, |
934 | "cpufreq"); | 945 | "cpufreq"); |
935 | if (ret) | 946 | if (ret) { |
947 | cpufreq_cpu_put(managed_policy); | ||
936 | goto err_out_unregister; | 948 | goto err_out_unregister; |
949 | } | ||
937 | } | 950 | } |
938 | 951 | ||
939 | policy->governor = NULL; /* to assure that the starting sequence is | 952 | policy->governor = NULL; /* to assure that the starting sequence is |
@@ -965,17 +978,20 @@ err_out_unregister: | |||
965 | per_cpu(cpufreq_cpu_data, j) = NULL; | 978 | per_cpu(cpufreq_cpu_data, j) = NULL; |
966 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); | 979 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); |
967 | 980 | ||
981 | err_out_kobj_put: | ||
968 | kobject_put(&policy->kobj); | 982 | kobject_put(&policy->kobj); |
969 | wait_for_completion(&policy->kobj_unregister); | 983 | wait_for_completion(&policy->kobj_unregister); |
970 | 984 | ||
971 | err_out_driver_exit: | 985 | out_driver_exit: |
972 | if (cpufreq_driver->exit) | 986 | if (cpufreq_driver->exit) |
973 | cpufreq_driver->exit(policy); | 987 | cpufreq_driver->exit(policy); |
974 | 988 | ||
975 | err_out: | 989 | err_unlock_policy: |
976 | unlock_policy_rwsem_write(cpu); | 990 | unlock_policy_rwsem_write(cpu); |
991 | err_free_cpumask: | ||
992 | free_cpumask_var(policy->cpus); | ||
993 | err_free_policy: | ||
977 | kfree(policy); | 994 | kfree(policy); |
978 | |||
979 | nomem_out: | 995 | nomem_out: |
980 | module_put(cpufreq_driver->owner); | 996 | module_put(cpufreq_driver->owner); |
981 | module_out: | 997 | module_out: |
@@ -1070,8 +1086,6 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev) | |||
1070 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); | 1086 | spin_unlock_irqrestore(&cpufreq_driver_lock, flags); |
1071 | #endif | 1087 | #endif |
1072 | 1088 | ||
1073 | unlock_policy_rwsem_write(cpu); | ||
1074 | |||
1075 | if (cpufreq_driver->target) | 1089 | if (cpufreq_driver->target) |
1076 | __cpufreq_governor(data, CPUFREQ_GOV_STOP); | 1090 | __cpufreq_governor(data, CPUFREQ_GOV_STOP); |
1077 | 1091 | ||
@@ -1088,6 +1102,8 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev) | |||
1088 | if (cpufreq_driver->exit) | 1102 | if (cpufreq_driver->exit) |
1089 | cpufreq_driver->exit(data); | 1103 | cpufreq_driver->exit(data); |
1090 | 1104 | ||
1105 | unlock_policy_rwsem_write(cpu); | ||
1106 | |||
1091 | free_cpumask_var(data->related_cpus); | 1107 | free_cpumask_var(data->related_cpus); |
1092 | free_cpumask_var(data->cpus); | 1108 | free_cpumask_var(data->cpus); |
1093 | kfree(data); | 1109 | kfree(data); |
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c index 7fc58af748b4..57490502b21c 100644 --- a/drivers/cpufreq/cpufreq_conservative.c +++ b/drivers/cpufreq/cpufreq_conservative.c | |||
@@ -63,22 +63,20 @@ struct cpu_dbs_info_s { | |||
63 | unsigned int down_skip; | 63 | unsigned int down_skip; |
64 | unsigned int requested_freq; | 64 | unsigned int requested_freq; |
65 | int cpu; | 65 | int cpu; |
66 | unsigned int enable:1; | 66 | /* |
67 | * percpu mutex that serializes governor limit change with | ||
68 | * do_dbs_timer invocation. We do not want do_dbs_timer to run | ||
69 | * when user is changing the governor or limits. | ||
70 | */ | ||
71 | struct mutex timer_mutex; | ||
67 | }; | 72 | }; |
68 | static DEFINE_PER_CPU(struct cpu_dbs_info_s, cpu_dbs_info); | 73 | static DEFINE_PER_CPU(struct cpu_dbs_info_s, cpu_dbs_info); |
69 | 74 | ||
70 | static unsigned int dbs_enable; /* number of CPUs using this policy */ | 75 | static unsigned int dbs_enable; /* number of CPUs using this policy */ |
71 | 76 | ||
72 | /* | 77 | /* |
73 | * DEADLOCK ALERT! There is a ordering requirement between cpu_hotplug | 78 | * dbs_mutex protects data in dbs_tuners_ins from concurrent changes on |
74 | * lock and dbs_mutex. cpu_hotplug lock should always be held before | 79 | * different CPUs. It protects dbs_enable in governor start/stop. |
75 | * dbs_mutex. If any function that can potentially take cpu_hotplug lock | ||
76 | * (like __cpufreq_driver_target()) is being called with dbs_mutex taken, then | ||
77 | * cpu_hotplug lock should be taken before that. Note that cpu_hotplug lock | ||
78 | * is recursive for the same process. -Venki | ||
79 | * DEADLOCK ALERT! (2) : do_dbs_timer() must not take the dbs_mutex, because it | ||
80 | * would deadlock with cancel_delayed_work_sync(), which is needed for proper | ||
81 | * raceless workqueue teardown. | ||
82 | */ | 80 | */ |
83 | static DEFINE_MUTEX(dbs_mutex); | 81 | static DEFINE_MUTEX(dbs_mutex); |
84 | 82 | ||
@@ -143,9 +141,6 @@ dbs_cpufreq_notifier(struct notifier_block *nb, unsigned long val, | |||
143 | 141 | ||
144 | struct cpufreq_policy *policy; | 142 | struct cpufreq_policy *policy; |
145 | 143 | ||
146 | if (!this_dbs_info->enable) | ||
147 | return 0; | ||
148 | |||
149 | policy = this_dbs_info->cur_policy; | 144 | policy = this_dbs_info->cur_policy; |
150 | 145 | ||
151 | /* | 146 | /* |
@@ -488,18 +483,12 @@ static void do_dbs_timer(struct work_struct *work) | |||
488 | 483 | ||
489 | delay -= jiffies % delay; | 484 | delay -= jiffies % delay; |
490 | 485 | ||
491 | if (lock_policy_rwsem_write(cpu) < 0) | 486 | mutex_lock(&dbs_info->timer_mutex); |
492 | return; | ||
493 | |||
494 | if (!dbs_info->enable) { | ||
495 | unlock_policy_rwsem_write(cpu); | ||
496 | return; | ||
497 | } | ||
498 | 487 | ||
499 | dbs_check_cpu(dbs_info); | 488 | dbs_check_cpu(dbs_info); |
500 | 489 | ||
501 | queue_delayed_work_on(cpu, kconservative_wq, &dbs_info->work, delay); | 490 | queue_delayed_work_on(cpu, kconservative_wq, &dbs_info->work, delay); |
502 | unlock_policy_rwsem_write(cpu); | 491 | mutex_unlock(&dbs_info->timer_mutex); |
503 | } | 492 | } |
504 | 493 | ||
505 | static inline void dbs_timer_init(struct cpu_dbs_info_s *dbs_info) | 494 | static inline void dbs_timer_init(struct cpu_dbs_info_s *dbs_info) |
@@ -508,7 +497,6 @@ static inline void dbs_timer_init(struct cpu_dbs_info_s *dbs_info) | |||
508 | int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate); | 497 | int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate); |
509 | delay -= jiffies % delay; | 498 | delay -= jiffies % delay; |
510 | 499 | ||
511 | dbs_info->enable = 1; | ||
512 | INIT_DELAYED_WORK_DEFERRABLE(&dbs_info->work, do_dbs_timer); | 500 | INIT_DELAYED_WORK_DEFERRABLE(&dbs_info->work, do_dbs_timer); |
513 | queue_delayed_work_on(dbs_info->cpu, kconservative_wq, &dbs_info->work, | 501 | queue_delayed_work_on(dbs_info->cpu, kconservative_wq, &dbs_info->work, |
514 | delay); | 502 | delay); |
@@ -516,7 +504,6 @@ static inline void dbs_timer_init(struct cpu_dbs_info_s *dbs_info) | |||
516 | 504 | ||
517 | static inline void dbs_timer_exit(struct cpu_dbs_info_s *dbs_info) | 505 | static inline void dbs_timer_exit(struct cpu_dbs_info_s *dbs_info) |
518 | { | 506 | { |
519 | dbs_info->enable = 0; | ||
520 | cancel_delayed_work_sync(&dbs_info->work); | 507 | cancel_delayed_work_sync(&dbs_info->work); |
521 | } | 508 | } |
522 | 509 | ||
@@ -535,9 +522,6 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
535 | if ((!cpu_online(cpu)) || (!policy->cur)) | 522 | if ((!cpu_online(cpu)) || (!policy->cur)) |
536 | return -EINVAL; | 523 | return -EINVAL; |
537 | 524 | ||
538 | if (this_dbs_info->enable) /* Already enabled */ | ||
539 | break; | ||
540 | |||
541 | mutex_lock(&dbs_mutex); | 525 | mutex_lock(&dbs_mutex); |
542 | 526 | ||
543 | rc = sysfs_create_group(&policy->kobj, &dbs_attr_group); | 527 | rc = sysfs_create_group(&policy->kobj, &dbs_attr_group); |
@@ -561,6 +545,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
561 | this_dbs_info->down_skip = 0; | 545 | this_dbs_info->down_skip = 0; |
562 | this_dbs_info->requested_freq = policy->cur; | 546 | this_dbs_info->requested_freq = policy->cur; |
563 | 547 | ||
548 | mutex_init(&this_dbs_info->timer_mutex); | ||
564 | dbs_enable++; | 549 | dbs_enable++; |
565 | /* | 550 | /* |
566 | * Start the timerschedule work, when this governor | 551 | * Start the timerschedule work, when this governor |
@@ -590,17 +575,19 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
590 | &dbs_cpufreq_notifier_block, | 575 | &dbs_cpufreq_notifier_block, |
591 | CPUFREQ_TRANSITION_NOTIFIER); | 576 | CPUFREQ_TRANSITION_NOTIFIER); |
592 | } | 577 | } |
593 | dbs_timer_init(this_dbs_info); | ||
594 | |||
595 | mutex_unlock(&dbs_mutex); | 578 | mutex_unlock(&dbs_mutex); |
596 | 579 | ||
580 | dbs_timer_init(this_dbs_info); | ||
581 | |||
597 | break; | 582 | break; |
598 | 583 | ||
599 | case CPUFREQ_GOV_STOP: | 584 | case CPUFREQ_GOV_STOP: |
600 | mutex_lock(&dbs_mutex); | ||
601 | dbs_timer_exit(this_dbs_info); | 585 | dbs_timer_exit(this_dbs_info); |
586 | |||
587 | mutex_lock(&dbs_mutex); | ||
602 | sysfs_remove_group(&policy->kobj, &dbs_attr_group); | 588 | sysfs_remove_group(&policy->kobj, &dbs_attr_group); |
603 | dbs_enable--; | 589 | dbs_enable--; |
590 | mutex_destroy(&this_dbs_info->timer_mutex); | ||
604 | 591 | ||
605 | /* | 592 | /* |
606 | * Stop the timerschedule work, when this governor | 593 | * Stop the timerschedule work, when this governor |
@@ -616,7 +603,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
616 | break; | 603 | break; |
617 | 604 | ||
618 | case CPUFREQ_GOV_LIMITS: | 605 | case CPUFREQ_GOV_LIMITS: |
619 | mutex_lock(&dbs_mutex); | 606 | mutex_lock(&this_dbs_info->timer_mutex); |
620 | if (policy->max < this_dbs_info->cur_policy->cur) | 607 | if (policy->max < this_dbs_info->cur_policy->cur) |
621 | __cpufreq_driver_target( | 608 | __cpufreq_driver_target( |
622 | this_dbs_info->cur_policy, | 609 | this_dbs_info->cur_policy, |
@@ -625,7 +612,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
625 | __cpufreq_driver_target( | 612 | __cpufreq_driver_target( |
626 | this_dbs_info->cur_policy, | 613 | this_dbs_info->cur_policy, |
627 | policy->min, CPUFREQ_RELATION_L); | 614 | policy->min, CPUFREQ_RELATION_L); |
628 | mutex_unlock(&dbs_mutex); | 615 | mutex_unlock(&this_dbs_info->timer_mutex); |
629 | 616 | ||
630 | break; | 617 | break; |
631 | } | 618 | } |
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c index 1911d1729353..d6ba14276bb1 100644 --- a/drivers/cpufreq/cpufreq_ondemand.c +++ b/drivers/cpufreq/cpufreq_ondemand.c | |||
@@ -70,23 +70,21 @@ struct cpu_dbs_info_s { | |||
70 | unsigned int freq_lo_jiffies; | 70 | unsigned int freq_lo_jiffies; |
71 | unsigned int freq_hi_jiffies; | 71 | unsigned int freq_hi_jiffies; |
72 | int cpu; | 72 | int cpu; |
73 | unsigned int enable:1, | 73 | unsigned int sample_type:1; |
74 | sample_type:1; | 74 | /* |
75 | * percpu mutex that serializes governor limit change with | ||
76 | * do_dbs_timer invocation. We do not want do_dbs_timer to run | ||
77 | * when user is changing the governor or limits. | ||
78 | */ | ||
79 | struct mutex timer_mutex; | ||
75 | }; | 80 | }; |
76 | static DEFINE_PER_CPU(struct cpu_dbs_info_s, cpu_dbs_info); | 81 | static DEFINE_PER_CPU(struct cpu_dbs_info_s, cpu_dbs_info); |
77 | 82 | ||
78 | static unsigned int dbs_enable; /* number of CPUs using this policy */ | 83 | static unsigned int dbs_enable; /* number of CPUs using this policy */ |
79 | 84 | ||
80 | /* | 85 | /* |
81 | * DEADLOCK ALERT! There is a ordering requirement between cpu_hotplug | 86 | * dbs_mutex protects data in dbs_tuners_ins from concurrent changes on |
82 | * lock and dbs_mutex. cpu_hotplug lock should always be held before | 87 | * different CPUs. It protects dbs_enable in governor start/stop. |
83 | * dbs_mutex. If any function that can potentially take cpu_hotplug lock | ||
84 | * (like __cpufreq_driver_target()) is being called with dbs_mutex taken, then | ||
85 | * cpu_hotplug lock should be taken before that. Note that cpu_hotplug lock | ||
86 | * is recursive for the same process. -Venki | ||
87 | * DEADLOCK ALERT! (2) : do_dbs_timer() must not take the dbs_mutex, because it | ||
88 | * would deadlock with cancel_delayed_work_sync(), which is needed for proper | ||
89 | * raceless workqueue teardown. | ||
90 | */ | 88 | */ |
91 | static DEFINE_MUTEX(dbs_mutex); | 89 | static DEFINE_MUTEX(dbs_mutex); |
92 | 90 | ||
@@ -192,13 +190,18 @@ static unsigned int powersave_bias_target(struct cpufreq_policy *policy, | |||
192 | return freq_hi; | 190 | return freq_hi; |
193 | } | 191 | } |
194 | 192 | ||
193 | static void ondemand_powersave_bias_init_cpu(int cpu) | ||
194 | { | ||
195 | struct cpu_dbs_info_s *dbs_info = &per_cpu(cpu_dbs_info, cpu); | ||
196 | dbs_info->freq_table = cpufreq_frequency_get_table(cpu); | ||
197 | dbs_info->freq_lo = 0; | ||
198 | } | ||
199 | |||
195 | static void ondemand_powersave_bias_init(void) | 200 | static void ondemand_powersave_bias_init(void) |
196 | { | 201 | { |
197 | int i; | 202 | int i; |
198 | for_each_online_cpu(i) { | 203 | for_each_online_cpu(i) { |
199 | struct cpu_dbs_info_s *dbs_info = &per_cpu(cpu_dbs_info, i); | 204 | ondemand_powersave_bias_init_cpu(i); |
200 | dbs_info->freq_table = cpufreq_frequency_get_table(i); | ||
201 | dbs_info->freq_lo = 0; | ||
202 | } | 205 | } |
203 | } | 206 | } |
204 | 207 | ||
@@ -240,12 +243,10 @@ static ssize_t store_sampling_rate(struct cpufreq_policy *unused, | |||
240 | unsigned int input; | 243 | unsigned int input; |
241 | int ret; | 244 | int ret; |
242 | ret = sscanf(buf, "%u", &input); | 245 | ret = sscanf(buf, "%u", &input); |
246 | if (ret != 1) | ||
247 | return -EINVAL; | ||
243 | 248 | ||
244 | mutex_lock(&dbs_mutex); | 249 | mutex_lock(&dbs_mutex); |
245 | if (ret != 1) { | ||
246 | mutex_unlock(&dbs_mutex); | ||
247 | return -EINVAL; | ||
248 | } | ||
249 | dbs_tuners_ins.sampling_rate = max(input, min_sampling_rate); | 250 | dbs_tuners_ins.sampling_rate = max(input, min_sampling_rate); |
250 | mutex_unlock(&dbs_mutex); | 251 | mutex_unlock(&dbs_mutex); |
251 | 252 | ||
@@ -259,13 +260,12 @@ static ssize_t store_up_threshold(struct cpufreq_policy *unused, | |||
259 | int ret; | 260 | int ret; |
260 | ret = sscanf(buf, "%u", &input); | 261 | ret = sscanf(buf, "%u", &input); |
261 | 262 | ||
262 | mutex_lock(&dbs_mutex); | ||
263 | if (ret != 1 || input > MAX_FREQUENCY_UP_THRESHOLD || | 263 | if (ret != 1 || input > MAX_FREQUENCY_UP_THRESHOLD || |
264 | input < MIN_FREQUENCY_UP_THRESHOLD) { | 264 | input < MIN_FREQUENCY_UP_THRESHOLD) { |
265 | mutex_unlock(&dbs_mutex); | ||
266 | return -EINVAL; | 265 | return -EINVAL; |
267 | } | 266 | } |
268 | 267 | ||
268 | mutex_lock(&dbs_mutex); | ||
269 | dbs_tuners_ins.up_threshold = input; | 269 | dbs_tuners_ins.up_threshold = input; |
270 | mutex_unlock(&dbs_mutex); | 270 | mutex_unlock(&dbs_mutex); |
271 | 271 | ||
@@ -363,9 +363,6 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) | |||
363 | struct cpufreq_policy *policy; | 363 | struct cpufreq_policy *policy; |
364 | unsigned int j; | 364 | unsigned int j; |
365 | 365 | ||
366 | if (!this_dbs_info->enable) | ||
367 | return; | ||
368 | |||
369 | this_dbs_info->freq_lo = 0; | 366 | this_dbs_info->freq_lo = 0; |
370 | policy = this_dbs_info->cur_policy; | 367 | policy = this_dbs_info->cur_policy; |
371 | 368 | ||
@@ -493,14 +490,7 @@ static void do_dbs_timer(struct work_struct *work) | |||
493 | int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate); | 490 | int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate); |
494 | 491 | ||
495 | delay -= jiffies % delay; | 492 | delay -= jiffies % delay; |
496 | 493 | mutex_lock(&dbs_info->timer_mutex); | |
497 | if (lock_policy_rwsem_write(cpu) < 0) | ||
498 | return; | ||
499 | |||
500 | if (!dbs_info->enable) { | ||
501 | unlock_policy_rwsem_write(cpu); | ||
502 | return; | ||
503 | } | ||
504 | 494 | ||
505 | /* Common NORMAL_SAMPLE setup */ | 495 | /* Common NORMAL_SAMPLE setup */ |
506 | dbs_info->sample_type = DBS_NORMAL_SAMPLE; | 496 | dbs_info->sample_type = DBS_NORMAL_SAMPLE; |
@@ -517,7 +507,7 @@ static void do_dbs_timer(struct work_struct *work) | |||
517 | dbs_info->freq_lo, CPUFREQ_RELATION_H); | 507 | dbs_info->freq_lo, CPUFREQ_RELATION_H); |
518 | } | 508 | } |
519 | queue_delayed_work_on(cpu, kondemand_wq, &dbs_info->work, delay); | 509 | queue_delayed_work_on(cpu, kondemand_wq, &dbs_info->work, delay); |
520 | unlock_policy_rwsem_write(cpu); | 510 | mutex_unlock(&dbs_info->timer_mutex); |
521 | } | 511 | } |
522 | 512 | ||
523 | static inline void dbs_timer_init(struct cpu_dbs_info_s *dbs_info) | 513 | static inline void dbs_timer_init(struct cpu_dbs_info_s *dbs_info) |
@@ -526,8 +516,6 @@ static inline void dbs_timer_init(struct cpu_dbs_info_s *dbs_info) | |||
526 | int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate); | 516 | int delay = usecs_to_jiffies(dbs_tuners_ins.sampling_rate); |
527 | delay -= jiffies % delay; | 517 | delay -= jiffies % delay; |
528 | 518 | ||
529 | dbs_info->enable = 1; | ||
530 | ondemand_powersave_bias_init(); | ||
531 | dbs_info->sample_type = DBS_NORMAL_SAMPLE; | 519 | dbs_info->sample_type = DBS_NORMAL_SAMPLE; |
532 | INIT_DELAYED_WORK_DEFERRABLE(&dbs_info->work, do_dbs_timer); | 520 | INIT_DELAYED_WORK_DEFERRABLE(&dbs_info->work, do_dbs_timer); |
533 | queue_delayed_work_on(dbs_info->cpu, kondemand_wq, &dbs_info->work, | 521 | queue_delayed_work_on(dbs_info->cpu, kondemand_wq, &dbs_info->work, |
@@ -536,7 +524,6 @@ static inline void dbs_timer_init(struct cpu_dbs_info_s *dbs_info) | |||
536 | 524 | ||
537 | static inline void dbs_timer_exit(struct cpu_dbs_info_s *dbs_info) | 525 | static inline void dbs_timer_exit(struct cpu_dbs_info_s *dbs_info) |
538 | { | 526 | { |
539 | dbs_info->enable = 0; | ||
540 | cancel_delayed_work_sync(&dbs_info->work); | 527 | cancel_delayed_work_sync(&dbs_info->work); |
541 | } | 528 | } |
542 | 529 | ||
@@ -555,19 +542,15 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
555 | if ((!cpu_online(cpu)) || (!policy->cur)) | 542 | if ((!cpu_online(cpu)) || (!policy->cur)) |
556 | return -EINVAL; | 543 | return -EINVAL; |
557 | 544 | ||
558 | if (this_dbs_info->enable) /* Already enabled */ | ||
559 | break; | ||
560 | |||
561 | mutex_lock(&dbs_mutex); | 545 | mutex_lock(&dbs_mutex); |
562 | dbs_enable++; | ||
563 | 546 | ||
564 | rc = sysfs_create_group(&policy->kobj, &dbs_attr_group); | 547 | rc = sysfs_create_group(&policy->kobj, &dbs_attr_group); |
565 | if (rc) { | 548 | if (rc) { |
566 | dbs_enable--; | ||
567 | mutex_unlock(&dbs_mutex); | 549 | mutex_unlock(&dbs_mutex); |
568 | return rc; | 550 | return rc; |
569 | } | 551 | } |
570 | 552 | ||
553 | dbs_enable++; | ||
571 | for_each_cpu(j, policy->cpus) { | 554 | for_each_cpu(j, policy->cpus) { |
572 | struct cpu_dbs_info_s *j_dbs_info; | 555 | struct cpu_dbs_info_s *j_dbs_info; |
573 | j_dbs_info = &per_cpu(cpu_dbs_info, j); | 556 | j_dbs_info = &per_cpu(cpu_dbs_info, j); |
@@ -581,6 +564,8 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
581 | } | 564 | } |
582 | } | 565 | } |
583 | this_dbs_info->cpu = cpu; | 566 | this_dbs_info->cpu = cpu; |
567 | ondemand_powersave_bias_init_cpu(cpu); | ||
568 | mutex_init(&this_dbs_info->timer_mutex); | ||
584 | /* | 569 | /* |
585 | * Start the timerschedule work, when this governor | 570 | * Start the timerschedule work, when this governor |
586 | * is used for first time | 571 | * is used for first time |
@@ -598,29 +583,31 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy, | |||
598 | max(min_sampling_rate, | 583 | max(min_sampling_rate, |
599 | latency * LATENCY_MULTIPLIER); | 584 | latency * LATENCY_MULTIPLIER); |
600 | } | 585 | } |
601 | dbs_timer_init(this_dbs_info); | ||
602 | |||
603 | mutex_unlock(&dbs_mutex); | 586 | mutex_unlock(&dbs_mutex); |
587 | |||
588 | dbs_timer_init(this_dbs_info); | ||
604 | break; | 589 | break; |
605 | 590 | ||
606 | case CPUFREQ_GOV_STOP: | 591 | case CPUFREQ_GOV_STOP: |
607 | mutex_lock(&dbs_mutex); | ||
608 | dbs_timer_exit(this_dbs_info); | 592 | dbs_timer_exit(this_dbs_info); |
593 | |||
594 | mutex_lock(&dbs_mutex); | ||
609 | sysfs_remove_group(&policy->kobj, &dbs_attr_group); | 595 | sysfs_remove_group(&policy->kobj, &dbs_attr_group); |
596 | mutex_destroy(&this_dbs_info->timer_mutex); | ||
610 | dbs_enable--; | 597 | dbs_enable--; |
611 | mutex_unlock(&dbs_mutex); | 598 | mutex_unlock(&dbs_mutex); |
612 | 599 | ||
613 | break; | 600 | break; |
614 | 601 | ||
615 | case CPUFREQ_GOV_LIMITS: | 602 | case CPUFREQ_GOV_LIMITS: |
616 | mutex_lock(&dbs_mutex); | 603 | mutex_lock(&this_dbs_info->timer_mutex); |
617 | if (policy->max < this_dbs_info->cur_policy->cur) | 604 | if (policy->max < this_dbs_info->cur_policy->cur) |
618 | __cpufreq_driver_target(this_dbs_info->cur_policy, | 605 | __cpufreq_driver_target(this_dbs_info->cur_policy, |
619 | policy->max, CPUFREQ_RELATION_H); | 606 | policy->max, CPUFREQ_RELATION_H); |
620 | else if (policy->min > this_dbs_info->cur_policy->cur) | 607 | else if (policy->min > this_dbs_info->cur_policy->cur) |
621 | __cpufreq_driver_target(this_dbs_info->cur_policy, | 608 | __cpufreq_driver_target(this_dbs_info->cur_policy, |
622 | policy->min, CPUFREQ_RELATION_L); | 609 | policy->min, CPUFREQ_RELATION_L); |
623 | mutex_unlock(&dbs_mutex); | 610 | mutex_unlock(&this_dbs_info->timer_mutex); |
624 | break; | 611 | break; |
625 | } | 612 | } |
626 | return 0; | 613 | return 0; |
diff --git a/drivers/firewire/core-card.c b/drivers/firewire/core-card.c index 543fccac81bb..f74edae5cb4c 100644 --- a/drivers/firewire/core-card.c +++ b/drivers/firewire/core-card.c | |||
@@ -196,8 +196,8 @@ static void allocate_broadcast_channel(struct fw_card *card, int generation) | |||
196 | { | 196 | { |
197 | int channel, bandwidth = 0; | 197 | int channel, bandwidth = 0; |
198 | 198 | ||
199 | fw_iso_resource_manage(card, generation, 1ULL << 31, | 199 | fw_iso_resource_manage(card, generation, 1ULL << 31, &channel, |
200 | &channel, &bandwidth, true); | 200 | &bandwidth, true, card->bm_transaction_data); |
201 | if (channel == 31) { | 201 | if (channel == 31) { |
202 | card->broadcast_channel_allocated = true; | 202 | card->broadcast_channel_allocated = true; |
203 | device_for_each_child(card->device, (void *)(long)generation, | 203 | device_for_each_child(card->device, (void *)(long)generation, |
@@ -230,7 +230,6 @@ static void fw_card_bm_work(struct work_struct *work) | |||
230 | bool do_reset = false; | 230 | bool do_reset = false; |
231 | bool root_device_is_running; | 231 | bool root_device_is_running; |
232 | bool root_device_is_cmc; | 232 | bool root_device_is_cmc; |
233 | __be32 lock_data[2]; | ||
234 | 233 | ||
235 | spin_lock_irqsave(&card->lock, flags); | 234 | spin_lock_irqsave(&card->lock, flags); |
236 | 235 | ||
@@ -273,22 +272,23 @@ static void fw_card_bm_work(struct work_struct *work) | |||
273 | goto pick_me; | 272 | goto pick_me; |
274 | } | 273 | } |
275 | 274 | ||
276 | lock_data[0] = cpu_to_be32(0x3f); | 275 | card->bm_transaction_data[0] = cpu_to_be32(0x3f); |
277 | lock_data[1] = cpu_to_be32(local_id); | 276 | card->bm_transaction_data[1] = cpu_to_be32(local_id); |
278 | 277 | ||
279 | spin_unlock_irqrestore(&card->lock, flags); | 278 | spin_unlock_irqrestore(&card->lock, flags); |
280 | 279 | ||
281 | rcode = fw_run_transaction(card, TCODE_LOCK_COMPARE_SWAP, | 280 | rcode = fw_run_transaction(card, TCODE_LOCK_COMPARE_SWAP, |
282 | irm_id, generation, SCODE_100, | 281 | irm_id, generation, SCODE_100, |
283 | CSR_REGISTER_BASE + CSR_BUS_MANAGER_ID, | 282 | CSR_REGISTER_BASE + CSR_BUS_MANAGER_ID, |
284 | lock_data, sizeof(lock_data)); | 283 | card->bm_transaction_data, |
284 | sizeof(card->bm_transaction_data)); | ||
285 | 285 | ||
286 | if (rcode == RCODE_GENERATION) | 286 | if (rcode == RCODE_GENERATION) |
287 | /* Another bus reset, BM work has been rescheduled. */ | 287 | /* Another bus reset, BM work has been rescheduled. */ |
288 | goto out; | 288 | goto out; |
289 | 289 | ||
290 | if (rcode == RCODE_COMPLETE && | 290 | if (rcode == RCODE_COMPLETE && |
291 | lock_data[0] != cpu_to_be32(0x3f)) { | 291 | card->bm_transaction_data[0] != cpu_to_be32(0x3f)) { |
292 | 292 | ||
293 | /* Somebody else is BM. Only act as IRM. */ | 293 | /* Somebody else is BM. Only act as IRM. */ |
294 | if (local_id == irm_id) | 294 | if (local_id == irm_id) |
diff --git a/drivers/firewire/core-cdev.c b/drivers/firewire/core-cdev.c index d1d30c615b0f..ced186d7e9a9 100644 --- a/drivers/firewire/core-cdev.c +++ b/drivers/firewire/core-cdev.c | |||
@@ -125,6 +125,7 @@ struct iso_resource { | |||
125 | int generation; | 125 | int generation; |
126 | u64 channels; | 126 | u64 channels; |
127 | s32 bandwidth; | 127 | s32 bandwidth; |
128 | __be32 transaction_data[2]; | ||
128 | struct iso_resource_event *e_alloc, *e_dealloc; | 129 | struct iso_resource_event *e_alloc, *e_dealloc; |
129 | }; | 130 | }; |
130 | 131 | ||
@@ -1049,7 +1050,8 @@ static void iso_resource_work(struct work_struct *work) | |||
1049 | r->channels, &channel, &bandwidth, | 1050 | r->channels, &channel, &bandwidth, |
1050 | todo == ISO_RES_ALLOC || | 1051 | todo == ISO_RES_ALLOC || |
1051 | todo == ISO_RES_REALLOC || | 1052 | todo == ISO_RES_REALLOC || |
1052 | todo == ISO_RES_ALLOC_ONCE); | 1053 | todo == ISO_RES_ALLOC_ONCE, |
1054 | r->transaction_data); | ||
1053 | /* | 1055 | /* |
1054 | * Is this generation outdated already? As long as this resource sticks | 1056 | * Is this generation outdated already? As long as this resource sticks |
1055 | * in the idr, it will be scheduled again for a newer generation or at | 1057 | * in the idr, it will be scheduled again for a newer generation or at |
diff --git a/drivers/firewire/core-iso.c b/drivers/firewire/core-iso.c index 166f19c6d38d..110e731f5574 100644 --- a/drivers/firewire/core-iso.c +++ b/drivers/firewire/core-iso.c | |||
@@ -177,9 +177,8 @@ EXPORT_SYMBOL(fw_iso_context_stop); | |||
177 | */ | 177 | */ |
178 | 178 | ||
179 | static int manage_bandwidth(struct fw_card *card, int irm_id, int generation, | 179 | static int manage_bandwidth(struct fw_card *card, int irm_id, int generation, |
180 | int bandwidth, bool allocate) | 180 | int bandwidth, bool allocate, __be32 data[2]) |
181 | { | 181 | { |
182 | __be32 data[2]; | ||
183 | int try, new, old = allocate ? BANDWIDTH_AVAILABLE_INITIAL : 0; | 182 | int try, new, old = allocate ? BANDWIDTH_AVAILABLE_INITIAL : 0; |
184 | 183 | ||
185 | /* | 184 | /* |
@@ -215,9 +214,9 @@ static int manage_bandwidth(struct fw_card *card, int irm_id, int generation, | |||
215 | } | 214 | } |
216 | 215 | ||
217 | static int manage_channel(struct fw_card *card, int irm_id, int generation, | 216 | static int manage_channel(struct fw_card *card, int irm_id, int generation, |
218 | u32 channels_mask, u64 offset, bool allocate) | 217 | u32 channels_mask, u64 offset, bool allocate, __be32 data[2]) |
219 | { | 218 | { |
220 | __be32 data[2], c, all, old; | 219 | __be32 c, all, old; |
221 | int i, retry = 5; | 220 | int i, retry = 5; |
222 | 221 | ||
223 | old = all = allocate ? cpu_to_be32(~0) : 0; | 222 | old = all = allocate ? cpu_to_be32(~0) : 0; |
@@ -260,7 +259,7 @@ static int manage_channel(struct fw_card *card, int irm_id, int generation, | |||
260 | } | 259 | } |
261 | 260 | ||
262 | static void deallocate_channel(struct fw_card *card, int irm_id, | 261 | static void deallocate_channel(struct fw_card *card, int irm_id, |
263 | int generation, int channel) | 262 | int generation, int channel, __be32 buffer[2]) |
264 | { | 263 | { |
265 | u32 mask; | 264 | u32 mask; |
266 | u64 offset; | 265 | u64 offset; |
@@ -269,7 +268,7 @@ static void deallocate_channel(struct fw_card *card, int irm_id, | |||
269 | offset = channel < 32 ? CSR_REGISTER_BASE + CSR_CHANNELS_AVAILABLE_HI : | 268 | offset = channel < 32 ? CSR_REGISTER_BASE + CSR_CHANNELS_AVAILABLE_HI : |
270 | CSR_REGISTER_BASE + CSR_CHANNELS_AVAILABLE_LO; | 269 | CSR_REGISTER_BASE + CSR_CHANNELS_AVAILABLE_LO; |
271 | 270 | ||
272 | manage_channel(card, irm_id, generation, mask, offset, false); | 271 | manage_channel(card, irm_id, generation, mask, offset, false, buffer); |
273 | } | 272 | } |
274 | 273 | ||
275 | /** | 274 | /** |
@@ -298,7 +297,7 @@ static void deallocate_channel(struct fw_card *card, int irm_id, | |||
298 | */ | 297 | */ |
299 | void fw_iso_resource_manage(struct fw_card *card, int generation, | 298 | void fw_iso_resource_manage(struct fw_card *card, int generation, |
300 | u64 channels_mask, int *channel, int *bandwidth, | 299 | u64 channels_mask, int *channel, int *bandwidth, |
301 | bool allocate) | 300 | bool allocate, __be32 buffer[2]) |
302 | { | 301 | { |
303 | u32 channels_hi = channels_mask; /* channels 31...0 */ | 302 | u32 channels_hi = channels_mask; /* channels 31...0 */ |
304 | u32 channels_lo = channels_mask >> 32; /* channels 63...32 */ | 303 | u32 channels_lo = channels_mask >> 32; /* channels 63...32 */ |
@@ -310,10 +309,12 @@ void fw_iso_resource_manage(struct fw_card *card, int generation, | |||
310 | 309 | ||
311 | if (channels_hi) | 310 | if (channels_hi) |
312 | c = manage_channel(card, irm_id, generation, channels_hi, | 311 | c = manage_channel(card, irm_id, generation, channels_hi, |
313 | CSR_REGISTER_BASE + CSR_CHANNELS_AVAILABLE_HI, allocate); | 312 | CSR_REGISTER_BASE + CSR_CHANNELS_AVAILABLE_HI, |
313 | allocate, buffer); | ||
314 | if (channels_lo && c < 0) { | 314 | if (channels_lo && c < 0) { |
315 | c = manage_channel(card, irm_id, generation, channels_lo, | 315 | c = manage_channel(card, irm_id, generation, channels_lo, |
316 | CSR_REGISTER_BASE + CSR_CHANNELS_AVAILABLE_LO, allocate); | 316 | CSR_REGISTER_BASE + CSR_CHANNELS_AVAILABLE_LO, |
317 | allocate, buffer); | ||
317 | if (c >= 0) | 318 | if (c >= 0) |
318 | c += 32; | 319 | c += 32; |
319 | } | 320 | } |
@@ -325,12 +326,13 @@ void fw_iso_resource_manage(struct fw_card *card, int generation, | |||
325 | if (*bandwidth == 0) | 326 | if (*bandwidth == 0) |
326 | return; | 327 | return; |
327 | 328 | ||
328 | ret = manage_bandwidth(card, irm_id, generation, *bandwidth, allocate); | 329 | ret = manage_bandwidth(card, irm_id, generation, *bandwidth, |
330 | allocate, buffer); | ||
329 | if (ret < 0) | 331 | if (ret < 0) |
330 | *bandwidth = 0; | 332 | *bandwidth = 0; |
331 | 333 | ||
332 | if (allocate && ret < 0 && c >= 0) { | 334 | if (allocate && ret < 0 && c >= 0) { |
333 | deallocate_channel(card, irm_id, generation, c); | 335 | deallocate_channel(card, irm_id, generation, c, buffer); |
334 | *channel = ret; | 336 | *channel = ret; |
335 | } | 337 | } |
336 | } | 338 | } |
diff --git a/drivers/firewire/core.h b/drivers/firewire/core.h index c3cfc647e5e3..6052816be353 100644 --- a/drivers/firewire/core.h +++ b/drivers/firewire/core.h | |||
@@ -120,7 +120,8 @@ void fw_node_event(struct fw_card *card, struct fw_node *node, int event); | |||
120 | 120 | ||
121 | int fw_iso_buffer_map(struct fw_iso_buffer *buffer, struct vm_area_struct *vma); | 121 | int fw_iso_buffer_map(struct fw_iso_buffer *buffer, struct vm_area_struct *vma); |
122 | void fw_iso_resource_manage(struct fw_card *card, int generation, | 122 | void fw_iso_resource_manage(struct fw_card *card, int generation, |
123 | u64 channels_mask, int *channel, int *bandwidth, bool allocate); | 123 | u64 channels_mask, int *channel, int *bandwidth, |
124 | bool allocate, __be32 buffer[2]); | ||
124 | 125 | ||
125 | 126 | ||
126 | /* -topology */ | 127 | /* -topology */ |
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c index 24c45635376a..8d51568ee143 100644 --- a/drivers/firewire/sbp2.c +++ b/drivers/firewire/sbp2.c | |||
@@ -201,6 +201,12 @@ static struct fw_device *target_device(struct sbp2_target *tgt) | |||
201 | #define SBP2_CYCLE_LIMIT (0xc8 << 12) /* 200 125us cycles */ | 201 | #define SBP2_CYCLE_LIMIT (0xc8 << 12) /* 200 125us cycles */ |
202 | 202 | ||
203 | /* | 203 | /* |
204 | * There is no transport protocol limit to the CDB length, but we implement | ||
205 | * a fixed length only. 16 bytes is enough for disks larger than 2 TB. | ||
206 | */ | ||
207 | #define SBP2_MAX_CDB_SIZE 16 | ||
208 | |||
209 | /* | ||
204 | * The default maximum s/g segment size of a FireWire controller is | 210 | * The default maximum s/g segment size of a FireWire controller is |
205 | * usually 0x10000, but SBP-2 only allows 0xffff. Since buffers have to | 211 | * usually 0x10000, but SBP-2 only allows 0xffff. Since buffers have to |
206 | * be quadlet-aligned, we set the length limit to 0xffff & ~3. | 212 | * be quadlet-aligned, we set the length limit to 0xffff & ~3. |
@@ -312,7 +318,7 @@ struct sbp2_command_orb { | |||
312 | struct sbp2_pointer next; | 318 | struct sbp2_pointer next; |
313 | struct sbp2_pointer data_descriptor; | 319 | struct sbp2_pointer data_descriptor; |
314 | __be32 misc; | 320 | __be32 misc; |
315 | u8 command_block[12]; | 321 | u8 command_block[SBP2_MAX_CDB_SIZE]; |
316 | } request; | 322 | } request; |
317 | struct scsi_cmnd *cmd; | 323 | struct scsi_cmnd *cmd; |
318 | scsi_done_fn_t done; | 324 | scsi_done_fn_t done; |
@@ -1146,6 +1152,8 @@ static int sbp2_probe(struct device *dev) | |||
1146 | if (fw_device_enable_phys_dma(device) < 0) | 1152 | if (fw_device_enable_phys_dma(device) < 0) |
1147 | goto fail_shost_put; | 1153 | goto fail_shost_put; |
1148 | 1154 | ||
1155 | shost->max_cmd_len = SBP2_MAX_CDB_SIZE; | ||
1156 | |||
1149 | if (scsi_add_host(shost, &unit->device) < 0) | 1157 | if (scsi_add_host(shost, &unit->device) < 0) |
1150 | goto fail_shost_put; | 1158 | goto fail_shost_put; |
1151 | 1159 | ||
diff --git a/drivers/gpio/vr41xx_giu.c b/drivers/gpio/vr41xx_giu.c index b70e06133e78..b16c9a8c03f5 100644 --- a/drivers/gpio/vr41xx_giu.c +++ b/drivers/gpio/vr41xx_giu.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/kernel.h> | 29 | #include <linux/kernel.h> |
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/platform_device.h> | 31 | #include <linux/platform_device.h> |
32 | #include <linux/smp_lock.h> | ||
33 | #include <linux/spinlock.h> | 32 | #include <linux/spinlock.h> |
34 | #include <linux/types.h> | 33 | #include <linux/types.h> |
35 | 34 | ||
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index a6f73f1e99d9..3da9cfa31848 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c | |||
@@ -1090,6 +1090,8 @@ int drm_helper_resume_force_mode(struct drm_device *dev) | |||
1090 | if (ret == false) | 1090 | if (ret == false) |
1091 | DRM_ERROR("failed to set mode on crtc %p\n", crtc); | 1091 | DRM_ERROR("failed to set mode on crtc %p\n", crtc); |
1092 | } | 1092 | } |
1093 | /* disable the unused connectors while restoring the modesetting */ | ||
1094 | drm_helper_disable_unused_functions(dev); | ||
1093 | return 0; | 1095 | return 0; |
1094 | } | 1096 | } |
1095 | EXPORT_SYMBOL(drm_helper_resume_force_mode); | 1097 | EXPORT_SYMBOL(drm_helper_resume_force_mode); |
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c index f112c769d533..8c4783180bf6 100644 --- a/drivers/gpu/drm/i915/i915_dma.c +++ b/drivers/gpu/drm/i915/i915_dma.c | |||
@@ -846,7 +846,7 @@ static int i915_set_status_page(struct drm_device *dev, void *data, | |||
846 | return 0; | 846 | return 0; |
847 | } | 847 | } |
848 | 848 | ||
849 | printk(KERN_DEBUG "set status page addr 0x%08x\n", (u32)hws->addr); | 849 | DRM_DEBUG("set status page addr 0x%08x\n", (u32)hws->addr); |
850 | 850 | ||
851 | dev_priv->status_gfx_addr = hws->addr & (0x1ffff<<12); | 851 | dev_priv->status_gfx_addr = hws->addr & (0x1ffff<<12); |
852 | 852 | ||
@@ -885,8 +885,8 @@ static int i915_set_status_page(struct drm_device *dev, void *data, | |||
885 | * some RAM for the framebuffer at early boot. This code figures out | 885 | * some RAM for the framebuffer at early boot. This code figures out |
886 | * how much was set aside so we can use it for our own purposes. | 886 | * how much was set aside so we can use it for our own purposes. |
887 | */ | 887 | */ |
888 | static int i915_probe_agp(struct drm_device *dev, unsigned long *aperture_size, | 888 | static int i915_probe_agp(struct drm_device *dev, uint32_t *aperture_size, |
889 | unsigned long *preallocated_size) | 889 | uint32_t *preallocated_size) |
890 | { | 890 | { |
891 | struct pci_dev *bridge_dev; | 891 | struct pci_dev *bridge_dev; |
892 | u16 tmp = 0; | 892 | u16 tmp = 0; |
@@ -984,10 +984,11 @@ static int i915_probe_agp(struct drm_device *dev, unsigned long *aperture_size, | |||
984 | return 0; | 984 | return 0; |
985 | } | 985 | } |
986 | 986 | ||
987 | static int i915_load_modeset_init(struct drm_device *dev) | 987 | static int i915_load_modeset_init(struct drm_device *dev, |
988 | unsigned long prealloc_size, | ||
989 | unsigned long agp_size) | ||
988 | { | 990 | { |
989 | struct drm_i915_private *dev_priv = dev->dev_private; | 991 | struct drm_i915_private *dev_priv = dev->dev_private; |
990 | unsigned long agp_size, prealloc_size; | ||
991 | int fb_bar = IS_I9XX(dev) ? 2 : 0; | 992 | int fb_bar = IS_I9XX(dev) ? 2 : 0; |
992 | int ret = 0; | 993 | int ret = 0; |
993 | 994 | ||
@@ -1002,10 +1003,6 @@ static int i915_load_modeset_init(struct drm_device *dev) | |||
1002 | if (IS_I965G(dev) || IS_G33(dev)) | 1003 | if (IS_I965G(dev) || IS_G33(dev)) |
1003 | dev_priv->cursor_needs_physical = false; | 1004 | dev_priv->cursor_needs_physical = false; |
1004 | 1005 | ||
1005 | ret = i915_probe_agp(dev, &agp_size, &prealloc_size); | ||
1006 | if (ret) | ||
1007 | goto out; | ||
1008 | |||
1009 | /* Basic memrange allocator for stolen space (aka vram) */ | 1006 | /* Basic memrange allocator for stolen space (aka vram) */ |
1010 | drm_mm_init(&dev_priv->vram, 0, prealloc_size); | 1007 | drm_mm_init(&dev_priv->vram, 0, prealloc_size); |
1011 | 1008 | ||
@@ -1082,6 +1079,44 @@ void i915_master_destroy(struct drm_device *dev, struct drm_master *master) | |||
1082 | master->driver_priv = NULL; | 1079 | master->driver_priv = NULL; |
1083 | } | 1080 | } |
1084 | 1081 | ||
1082 | static void i915_get_mem_freq(struct drm_device *dev) | ||
1083 | { | ||
1084 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
1085 | u32 tmp; | ||
1086 | |||
1087 | if (!IS_IGD(dev)) | ||
1088 | return; | ||
1089 | |||
1090 | tmp = I915_READ(CLKCFG); | ||
1091 | |||
1092 | switch (tmp & CLKCFG_FSB_MASK) { | ||
1093 | case CLKCFG_FSB_533: | ||
1094 | dev_priv->fsb_freq = 533; /* 133*4 */ | ||
1095 | break; | ||
1096 | case CLKCFG_FSB_800: | ||
1097 | dev_priv->fsb_freq = 800; /* 200*4 */ | ||
1098 | break; | ||
1099 | case CLKCFG_FSB_667: | ||
1100 | dev_priv->fsb_freq = 667; /* 167*4 */ | ||
1101 | break; | ||
1102 | case CLKCFG_FSB_400: | ||
1103 | dev_priv->fsb_freq = 400; /* 100*4 */ | ||
1104 | break; | ||
1105 | } | ||
1106 | |||
1107 | switch (tmp & CLKCFG_MEM_MASK) { | ||
1108 | case CLKCFG_MEM_533: | ||
1109 | dev_priv->mem_freq = 533; | ||
1110 | break; | ||
1111 | case CLKCFG_MEM_667: | ||
1112 | dev_priv->mem_freq = 667; | ||
1113 | break; | ||
1114 | case CLKCFG_MEM_800: | ||
1115 | dev_priv->mem_freq = 800; | ||
1116 | break; | ||
1117 | } | ||
1118 | } | ||
1119 | |||
1085 | /** | 1120 | /** |
1086 | * i915_driver_load - setup chip and create an initial config | 1121 | * i915_driver_load - setup chip and create an initial config |
1087 | * @dev: DRM device | 1122 | * @dev: DRM device |
@@ -1098,6 +1133,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1098 | struct drm_i915_private *dev_priv = dev->dev_private; | 1133 | struct drm_i915_private *dev_priv = dev->dev_private; |
1099 | resource_size_t base, size; | 1134 | resource_size_t base, size; |
1100 | int ret = 0, mmio_bar = IS_I9XX(dev) ? 0 : 1; | 1135 | int ret = 0, mmio_bar = IS_I9XX(dev) ? 0 : 1; |
1136 | uint32_t agp_size, prealloc_size; | ||
1101 | 1137 | ||
1102 | /* i915 has 4 more counters */ | 1138 | /* i915 has 4 more counters */ |
1103 | dev->counters += 4; | 1139 | dev->counters += 4; |
@@ -1146,9 +1182,22 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1146 | "performance may suffer.\n"); | 1182 | "performance may suffer.\n"); |
1147 | } | 1183 | } |
1148 | 1184 | ||
1185 | ret = i915_probe_agp(dev, &agp_size, &prealloc_size); | ||
1186 | if (ret) | ||
1187 | goto out_iomapfree; | ||
1188 | |||
1149 | /* enable GEM by default */ | 1189 | /* enable GEM by default */ |
1150 | dev_priv->has_gem = 1; | 1190 | dev_priv->has_gem = 1; |
1151 | 1191 | ||
1192 | if (prealloc_size > agp_size * 3 / 4) { | ||
1193 | DRM_ERROR("Detected broken video BIOS with %d/%dkB of video " | ||
1194 | "memory stolen.\n", | ||
1195 | prealloc_size / 1024, agp_size / 1024); | ||
1196 | DRM_ERROR("Disabling GEM. (try reducing stolen memory or " | ||
1197 | "updating the BIOS to fix).\n"); | ||
1198 | dev_priv->has_gem = 0; | ||
1199 | } | ||
1200 | |||
1152 | dev->driver->get_vblank_counter = i915_get_vblank_counter; | 1201 | dev->driver->get_vblank_counter = i915_get_vblank_counter; |
1153 | dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */ | 1202 | dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */ |
1154 | if (IS_G4X(dev) || IS_IGDNG(dev)) { | 1203 | if (IS_G4X(dev) || IS_IGDNG(dev)) { |
@@ -1165,6 +1214,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1165 | goto out_iomapfree; | 1214 | goto out_iomapfree; |
1166 | } | 1215 | } |
1167 | 1216 | ||
1217 | i915_get_mem_freq(dev); | ||
1218 | |||
1168 | /* On the 945G/GM, the chipset reports the MSI capability on the | 1219 | /* On the 945G/GM, the chipset reports the MSI capability on the |
1169 | * integrated graphics even though the support isn't actually there | 1220 | * integrated graphics even though the support isn't actually there |
1170 | * according to the published specs. It doesn't appear to function | 1221 | * according to the published specs. It doesn't appear to function |
@@ -1180,6 +1231,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1180 | pci_enable_msi(dev->pdev); | 1231 | pci_enable_msi(dev->pdev); |
1181 | 1232 | ||
1182 | spin_lock_init(&dev_priv->user_irq_lock); | 1233 | spin_lock_init(&dev_priv->user_irq_lock); |
1234 | spin_lock_init(&dev_priv->error_lock); | ||
1183 | dev_priv->user_irq_refcount = 0; | 1235 | dev_priv->user_irq_refcount = 0; |
1184 | 1236 | ||
1185 | ret = drm_vblank_init(dev, I915_NUM_PIPE); | 1237 | ret = drm_vblank_init(dev, I915_NUM_PIPE); |
@@ -1190,7 +1242,7 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
1190 | } | 1242 | } |
1191 | 1243 | ||
1192 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { | 1244 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { |
1193 | ret = i915_load_modeset_init(dev); | 1245 | ret = i915_load_modeset_init(dev, prealloc_size, agp_size); |
1194 | if (ret < 0) { | 1246 | if (ret < 0) { |
1195 | DRM_ERROR("failed to init modeset\n"); | 1247 | DRM_ERROR("failed to init modeset\n"); |
1196 | goto out_rmmap; | 1248 | goto out_rmmap; |
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index e3cb4025e323..fc4b68aa2d05 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c | |||
@@ -35,6 +35,7 @@ | |||
35 | 35 | ||
36 | #include "drm_pciids.h" | 36 | #include "drm_pciids.h" |
37 | #include <linux/console.h> | 37 | #include <linux/console.h> |
38 | #include "drm_crtc_helper.h" | ||
38 | 39 | ||
39 | static unsigned int i915_modeset = -1; | 40 | static unsigned int i915_modeset = -1; |
40 | module_param_named(modeset, i915_modeset, int, 0400); | 41 | module_param_named(modeset, i915_modeset, int, 0400); |
@@ -57,8 +58,8 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state) | |||
57 | struct drm_i915_private *dev_priv = dev->dev_private; | 58 | struct drm_i915_private *dev_priv = dev->dev_private; |
58 | 59 | ||
59 | if (!dev || !dev_priv) { | 60 | if (!dev || !dev_priv) { |
60 | printk(KERN_ERR "dev: %p, dev_priv: %p\n", dev, dev_priv); | 61 | DRM_ERROR("dev: %p, dev_priv: %p\n", dev, dev_priv); |
61 | printk(KERN_ERR "DRM not initialized, aborting suspend.\n"); | 62 | DRM_ERROR("DRM not initialized, aborting suspend.\n"); |
62 | return -ENODEV; | 63 | return -ENODEV; |
63 | } | 64 | } |
64 | 65 | ||
@@ -115,6 +116,10 @@ static int i915_resume(struct drm_device *dev) | |||
115 | 116 | ||
116 | drm_irq_install(dev); | 117 | drm_irq_install(dev); |
117 | } | 118 | } |
119 | if (drm_core_check_feature(dev, DRIVER_MODESET)) { | ||
120 | /* Resume the modeset for every activated CRTC */ | ||
121 | drm_helper_resume_force_mode(dev); | ||
122 | } | ||
118 | 123 | ||
119 | return ret; | 124 | return ret; |
120 | } | 125 | } |
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index bb4c2d387b6c..d08752875885 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -133,6 +133,22 @@ struct sdvo_device_mapping { | |||
133 | u8 initialized; | 133 | u8 initialized; |
134 | }; | 134 | }; |
135 | 135 | ||
136 | struct drm_i915_error_state { | ||
137 | u32 eir; | ||
138 | u32 pgtbl_er; | ||
139 | u32 pipeastat; | ||
140 | u32 pipebstat; | ||
141 | u32 ipeir; | ||
142 | u32 ipehr; | ||
143 | u32 instdone; | ||
144 | u32 acthd; | ||
145 | u32 instpm; | ||
146 | u32 instps; | ||
147 | u32 instdone1; | ||
148 | u32 seqno; | ||
149 | struct timeval time; | ||
150 | }; | ||
151 | |||
136 | typedef struct drm_i915_private { | 152 | typedef struct drm_i915_private { |
137 | struct drm_device *dev; | 153 | struct drm_device *dev; |
138 | 154 | ||
@@ -209,6 +225,11 @@ typedef struct drm_i915_private { | |||
209 | int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */ | 225 | int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */ |
210 | int num_fence_regs; /* 8 on pre-965, 16 otherwise */ | 226 | int num_fence_regs; /* 8 on pre-965, 16 otherwise */ |
211 | 227 | ||
228 | unsigned int fsb_freq, mem_freq; | ||
229 | |||
230 | spinlock_t error_lock; | ||
231 | struct drm_i915_error_state *first_error; | ||
232 | |||
212 | /* Register state */ | 233 | /* Register state */ |
213 | u8 saveLBB; | 234 | u8 saveLBB; |
214 | u32 saveDSPACNTR; | 235 | u32 saveDSPACNTR; |
@@ -468,9 +489,6 @@ struct drm_i915_gem_object { | |||
468 | */ | 489 | */ |
469 | int fence_reg; | 490 | int fence_reg; |
470 | 491 | ||
471 | /** Boolean whether this object has a valid gtt offset. */ | ||
472 | int gtt_bound; | ||
473 | |||
474 | /** How many users have pinned this object in GTT space */ | 492 | /** How many users have pinned this object in GTT space */ |
475 | int pin_count; | 493 | int pin_count; |
476 | 494 | ||
@@ -655,6 +673,7 @@ void i915_gem_free_object(struct drm_gem_object *obj); | |||
655 | int i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment); | 673 | int i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment); |
656 | void i915_gem_object_unpin(struct drm_gem_object *obj); | 674 | void i915_gem_object_unpin(struct drm_gem_object *obj); |
657 | int i915_gem_object_unbind(struct drm_gem_object *obj); | 675 | int i915_gem_object_unbind(struct drm_gem_object *obj); |
676 | void i915_gem_release_mmap(struct drm_gem_object *obj); | ||
658 | void i915_gem_lastclose(struct drm_device *dev); | 677 | void i915_gem_lastclose(struct drm_device *dev); |
659 | uint32_t i915_get_gem_seqno(struct drm_device *dev); | 678 | uint32_t i915_get_gem_seqno(struct drm_device *dev); |
660 | int i915_gem_object_get_fence_reg(struct drm_gem_object *obj); | 679 | int i915_gem_object_get_fence_reg(struct drm_gem_object *obj); |
@@ -870,6 +889,8 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller); | |||
870 | #define SUPPORTS_INTEGRATED_HDMI(dev) (IS_G4X(dev) || IS_IGDNG(dev)) | 889 | #define SUPPORTS_INTEGRATED_HDMI(dev) (IS_G4X(dev) || IS_IGDNG(dev)) |
871 | #define SUPPORTS_INTEGRATED_DP(dev) (IS_G4X(dev) || IS_IGDNG(dev)) | 890 | #define SUPPORTS_INTEGRATED_DP(dev) (IS_G4X(dev) || IS_IGDNG(dev)) |
872 | #define I915_HAS_HOTPLUG(dev) (IS_I945G(dev) || IS_I945GM(dev) || IS_I965G(dev)) | 891 | #define I915_HAS_HOTPLUG(dev) (IS_I945G(dev) || IS_I945GM(dev) || IS_I965G(dev)) |
892 | /* dsparb controlled by hw only */ | ||
893 | #define DSPARB_HWCONTROL(dev) (IS_G4X(dev) || IS_IGDNG(dev)) | ||
873 | 894 | ||
874 | #define PRIMARY_RINGBUFFER_SIZE (128*1024) | 895 | #define PRIMARY_RINGBUFFER_SIZE (128*1024) |
875 | 896 | ||
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 876b65cb7629..5bf420378b6d 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c | |||
@@ -1252,6 +1252,31 @@ out_free_list: | |||
1252 | return ret; | 1252 | return ret; |
1253 | } | 1253 | } |
1254 | 1254 | ||
1255 | /** | ||
1256 | * i915_gem_release_mmap - remove physical page mappings | ||
1257 | * @obj: obj in question | ||
1258 | * | ||
1259 | * Preserve the reservation of the mmaping with the DRM core code, but | ||
1260 | * relinquish ownership of the pages back to the system. | ||
1261 | * | ||
1262 | * It is vital that we remove the page mapping if we have mapped a tiled | ||
1263 | * object through the GTT and then lose the fence register due to | ||
1264 | * resource pressure. Similarly if the object has been moved out of the | ||
1265 | * aperture, than pages mapped into userspace must be revoked. Removing the | ||
1266 | * mapping will then trigger a page fault on the next user access, allowing | ||
1267 | * fixup by i915_gem_fault(). | ||
1268 | */ | ||
1269 | void | ||
1270 | i915_gem_release_mmap(struct drm_gem_object *obj) | ||
1271 | { | ||
1272 | struct drm_device *dev = obj->dev; | ||
1273 | struct drm_i915_gem_object *obj_priv = obj->driver_private; | ||
1274 | |||
1275 | if (dev->dev_mapping) | ||
1276 | unmap_mapping_range(dev->dev_mapping, | ||
1277 | obj_priv->mmap_offset, obj->size, 1); | ||
1278 | } | ||
1279 | |||
1255 | static void | 1280 | static void |
1256 | i915_gem_free_mmap_offset(struct drm_gem_object *obj) | 1281 | i915_gem_free_mmap_offset(struct drm_gem_object *obj) |
1257 | { | 1282 | { |
@@ -1861,7 +1886,6 @@ i915_gem_object_unbind(struct drm_gem_object *obj) | |||
1861 | { | 1886 | { |
1862 | struct drm_device *dev = obj->dev; | 1887 | struct drm_device *dev = obj->dev; |
1863 | struct drm_i915_gem_object *obj_priv = obj->driver_private; | 1888 | struct drm_i915_gem_object *obj_priv = obj->driver_private; |
1864 | loff_t offset; | ||
1865 | int ret = 0; | 1889 | int ret = 0; |
1866 | 1890 | ||
1867 | #if WATCH_BUF | 1891 | #if WATCH_BUF |
@@ -1898,9 +1922,7 @@ i915_gem_object_unbind(struct drm_gem_object *obj) | |||
1898 | BUG_ON(obj_priv->active); | 1922 | BUG_ON(obj_priv->active); |
1899 | 1923 | ||
1900 | /* blow away mappings if mapped through GTT */ | 1924 | /* blow away mappings if mapped through GTT */ |
1901 | offset = ((loff_t) obj->map_list.hash.key) << PAGE_SHIFT; | 1925 | i915_gem_release_mmap(obj); |
1902 | if (dev->dev_mapping) | ||
1903 | unmap_mapping_range(dev->dev_mapping, offset, obj->size, 1); | ||
1904 | 1926 | ||
1905 | if (obj_priv->fence_reg != I915_FENCE_REG_NONE) | 1927 | if (obj_priv->fence_reg != I915_FENCE_REG_NONE) |
1906 | i915_gem_clear_fence_reg(obj); | 1928 | i915_gem_clear_fence_reg(obj); |
@@ -2222,7 +2244,6 @@ try_again: | |||
2222 | /* None available, try to steal one or wait for a user to finish */ | 2244 | /* None available, try to steal one or wait for a user to finish */ |
2223 | if (i == dev_priv->num_fence_regs) { | 2245 | if (i == dev_priv->num_fence_regs) { |
2224 | uint32_t seqno = dev_priv->mm.next_gem_seqno; | 2246 | uint32_t seqno = dev_priv->mm.next_gem_seqno; |
2225 | loff_t offset; | ||
2226 | 2247 | ||
2227 | if (avail == 0) | 2248 | if (avail == 0) |
2228 | return -ENOSPC; | 2249 | return -ENOSPC; |
@@ -2274,10 +2295,7 @@ try_again: | |||
2274 | * Zap this virtual mapping so we can set up a fence again | 2295 | * Zap this virtual mapping so we can set up a fence again |
2275 | * for this object next time we need it. | 2296 | * for this object next time we need it. |
2276 | */ | 2297 | */ |
2277 | offset = ((loff_t) reg->obj->map_list.hash.key) << PAGE_SHIFT; | 2298 | i915_gem_release_mmap(reg->obj); |
2278 | if (dev->dev_mapping) | ||
2279 | unmap_mapping_range(dev->dev_mapping, offset, | ||
2280 | reg->obj->size, 1); | ||
2281 | old_obj_priv->fence_reg = I915_FENCE_REG_NONE; | 2299 | old_obj_priv->fence_reg = I915_FENCE_REG_NONE; |
2282 | } | 2300 | } |
2283 | 2301 | ||
diff --git a/drivers/gpu/drm/i915/i915_gem_debugfs.c b/drivers/gpu/drm/i915/i915_gem_debugfs.c index 28146e405e87..9a44bfcb8139 100644 --- a/drivers/gpu/drm/i915/i915_gem_debugfs.c +++ b/drivers/gpu/drm/i915/i915_gem_debugfs.c | |||
@@ -75,11 +75,10 @@ static int i915_gem_object_list_info(struct seq_file *m, void *data) | |||
75 | case ACTIVE_LIST: | 75 | case ACTIVE_LIST: |
76 | seq_printf(m, "Active:\n"); | 76 | seq_printf(m, "Active:\n"); |
77 | lock = &dev_priv->mm.active_list_lock; | 77 | lock = &dev_priv->mm.active_list_lock; |
78 | spin_lock(lock); | ||
79 | head = &dev_priv->mm.active_list; | 78 | head = &dev_priv->mm.active_list; |
80 | break; | 79 | break; |
81 | case INACTIVE_LIST: | 80 | case INACTIVE_LIST: |
82 | seq_printf(m, "Inctive:\n"); | 81 | seq_printf(m, "Inactive:\n"); |
83 | head = &dev_priv->mm.inactive_list; | 82 | head = &dev_priv->mm.inactive_list; |
84 | break; | 83 | break; |
85 | case FLUSHING_LIST: | 84 | case FLUSHING_LIST: |
@@ -91,6 +90,8 @@ static int i915_gem_object_list_info(struct seq_file *m, void *data) | |||
91 | return 0; | 90 | return 0; |
92 | } | 91 | } |
93 | 92 | ||
93 | if (lock) | ||
94 | spin_lock(lock); | ||
94 | list_for_each_entry(obj_priv, head, list) | 95 | list_for_each_entry(obj_priv, head, list) |
95 | { | 96 | { |
96 | struct drm_gem_object *obj = obj_priv->obj; | 97 | struct drm_gem_object *obj = obj_priv->obj; |
@@ -104,7 +105,10 @@ static int i915_gem_object_list_info(struct seq_file *m, void *data) | |||
104 | if (obj->name) | 105 | if (obj->name) |
105 | seq_printf(m, " (name: %d)", obj->name); | 106 | seq_printf(m, " (name: %d)", obj->name); |
106 | if (obj_priv->fence_reg != I915_FENCE_REG_NONE) | 107 | if (obj_priv->fence_reg != I915_FENCE_REG_NONE) |
107 | seq_printf(m, " (fence: %d)\n", obj_priv->fence_reg); | 108 | seq_printf(m, " (fence: %d)", obj_priv->fence_reg); |
109 | if (obj_priv->gtt_space != NULL) | ||
110 | seq_printf(m, " (gtt_offset: %08x)", obj_priv->gtt_offset); | ||
111 | |||
108 | seq_printf(m, "\n"); | 112 | seq_printf(m, "\n"); |
109 | } | 113 | } |
110 | 114 | ||
@@ -323,6 +327,39 @@ static int i915_ringbuffer_info(struct seq_file *m, void *data) | |||
323 | return 0; | 327 | return 0; |
324 | } | 328 | } |
325 | 329 | ||
330 | static int i915_error_state(struct seq_file *m, void *unused) | ||
331 | { | ||
332 | struct drm_info_node *node = (struct drm_info_node *) m->private; | ||
333 | struct drm_device *dev = node->minor->dev; | ||
334 | drm_i915_private_t *dev_priv = dev->dev_private; | ||
335 | struct drm_i915_error_state *error; | ||
336 | unsigned long flags; | ||
337 | |||
338 | spin_lock_irqsave(&dev_priv->error_lock, flags); | ||
339 | if (!dev_priv->first_error) { | ||
340 | seq_printf(m, "no error state collected\n"); | ||
341 | goto out; | ||
342 | } | ||
343 | |||
344 | error = dev_priv->first_error; | ||
345 | |||
346 | seq_printf(m, "EIR: 0x%08x\n", error->eir); | ||
347 | seq_printf(m, " PGTBL_ER: 0x%08x\n", error->pgtbl_er); | ||
348 | seq_printf(m, " INSTPM: 0x%08x\n", error->instpm); | ||
349 | seq_printf(m, " IPEIR: 0x%08x\n", error->ipeir); | ||
350 | seq_printf(m, " IPEHR: 0x%08x\n", error->ipehr); | ||
351 | seq_printf(m, " INSTDONE: 0x%08x\n", error->instdone); | ||
352 | seq_printf(m, " ACTHD: 0x%08x\n", error->acthd); | ||
353 | if (IS_I965G(dev)) { | ||
354 | seq_printf(m, " INSTPS: 0x%08x\n", error->instps); | ||
355 | seq_printf(m, " INSTDONE1: 0x%08x\n", error->instdone1); | ||
356 | } | ||
357 | |||
358 | out: | ||
359 | spin_unlock_irqrestore(&dev_priv->error_lock, flags); | ||
360 | |||
361 | return 0; | ||
362 | } | ||
326 | 363 | ||
327 | static struct drm_info_list i915_gem_debugfs_list[] = { | 364 | static struct drm_info_list i915_gem_debugfs_list[] = { |
328 | {"i915_gem_active", i915_gem_object_list_info, 0, (void *) ACTIVE_LIST}, | 365 | {"i915_gem_active", i915_gem_object_list_info, 0, (void *) ACTIVE_LIST}, |
@@ -336,6 +373,7 @@ static struct drm_info_list i915_gem_debugfs_list[] = { | |||
336 | {"i915_ringbuffer_data", i915_ringbuffer_data, 0}, | 373 | {"i915_ringbuffer_data", i915_ringbuffer_data, 0}, |
337 | {"i915_ringbuffer_info", i915_ringbuffer_info, 0}, | 374 | {"i915_ringbuffer_info", i915_ringbuffer_info, 0}, |
338 | {"i915_batchbuffers", i915_batchbuffer_info, 0}, | 375 | {"i915_batchbuffers", i915_batchbuffer_info, 0}, |
376 | {"i915_error_state", i915_error_state, 0}, | ||
339 | }; | 377 | }; |
340 | #define I915_GEM_DEBUGFS_ENTRIES ARRAY_SIZE(i915_gem_debugfs_list) | 378 | #define I915_GEM_DEBUGFS_ENTRIES ARRAY_SIZE(i915_gem_debugfs_list) |
341 | 379 | ||
diff --git a/drivers/gpu/drm/i915/i915_gem_tiling.c b/drivers/gpu/drm/i915/i915_gem_tiling.c index daeae62e1c28..a2d527b22ec4 100644 --- a/drivers/gpu/drm/i915/i915_gem_tiling.c +++ b/drivers/gpu/drm/i915/i915_gem_tiling.c | |||
@@ -521,6 +521,12 @@ i915_gem_set_tiling(struct drm_device *dev, void *data, | |||
521 | goto err; | 521 | goto err; |
522 | } | 522 | } |
523 | 523 | ||
524 | /* If we've changed tiling, GTT-mappings of the object | ||
525 | * need to re-fault to ensure that the correct fence register | ||
526 | * setup is in place. | ||
527 | */ | ||
528 | i915_gem_release_mmap(obj); | ||
529 | |||
524 | obj_priv->tiling_mode = args->tiling_mode; | 530 | obj_priv->tiling_mode = args->tiling_mode; |
525 | obj_priv->stride = args->stride; | 531 | obj_priv->stride = args->stride; |
526 | } | 532 | } |
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c index 228546f6eaa4..7ba23a69a0c0 100644 --- a/drivers/gpu/drm/i915/i915_irq.c +++ b/drivers/gpu/drm/i915/i915_irq.c | |||
@@ -26,6 +26,7 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <linux/sysrq.h> | ||
29 | #include "drmP.h" | 30 | #include "drmP.h" |
30 | #include "drm.h" | 31 | #include "drm.h" |
31 | #include "i915_drm.h" | 32 | #include "i915_drm.h" |
@@ -41,9 +42,10 @@ | |||
41 | * we leave them always unmasked in IMR and then control enabling them through | 42 | * we leave them always unmasked in IMR and then control enabling them through |
42 | * PIPESTAT alone. | 43 | * PIPESTAT alone. |
43 | */ | 44 | */ |
44 | #define I915_INTERRUPT_ENABLE_FIX (I915_ASLE_INTERRUPT | \ | 45 | #define I915_INTERRUPT_ENABLE_FIX (I915_ASLE_INTERRUPT | \ |
45 | I915_DISPLAY_PIPE_A_EVENT_INTERRUPT | \ | 46 | I915_DISPLAY_PIPE_A_EVENT_INTERRUPT | \ |
46 | I915_DISPLAY_PIPE_B_EVENT_INTERRUPT) | 47 | I915_DISPLAY_PIPE_B_EVENT_INTERRUPT | \ |
48 | I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT) | ||
47 | 49 | ||
48 | /** Interrupts that we mask and unmask at runtime. */ | 50 | /** Interrupts that we mask and unmask at runtime. */ |
49 | #define I915_INTERRUPT_ENABLE_VAR (I915_USER_INTERRUPT) | 51 | #define I915_INTERRUPT_ENABLE_VAR (I915_USER_INTERRUPT) |
@@ -288,6 +290,47 @@ irqreturn_t igdng_irq_handler(struct drm_device *dev) | |||
288 | return ret; | 290 | return ret; |
289 | } | 291 | } |
290 | 292 | ||
293 | static void i915_capture_error_state(struct drm_device *dev) | ||
294 | { | ||
295 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
296 | struct drm_i915_error_state *error; | ||
297 | unsigned long flags; | ||
298 | |||
299 | spin_lock_irqsave(&dev_priv->error_lock, flags); | ||
300 | if (dev_priv->first_error) | ||
301 | goto out; | ||
302 | |||
303 | error = kmalloc(sizeof(*error), GFP_ATOMIC); | ||
304 | if (!error) { | ||
305 | DRM_DEBUG("out ot memory, not capturing error state\n"); | ||
306 | goto out; | ||
307 | } | ||
308 | |||
309 | error->eir = I915_READ(EIR); | ||
310 | error->pgtbl_er = I915_READ(PGTBL_ER); | ||
311 | error->pipeastat = I915_READ(PIPEASTAT); | ||
312 | error->pipebstat = I915_READ(PIPEBSTAT); | ||
313 | error->instpm = I915_READ(INSTPM); | ||
314 | if (!IS_I965G(dev)) { | ||
315 | error->ipeir = I915_READ(IPEIR); | ||
316 | error->ipehr = I915_READ(IPEHR); | ||
317 | error->instdone = I915_READ(INSTDONE); | ||
318 | error->acthd = I915_READ(ACTHD); | ||
319 | } else { | ||
320 | error->ipeir = I915_READ(IPEIR_I965); | ||
321 | error->ipehr = I915_READ(IPEHR_I965); | ||
322 | error->instdone = I915_READ(INSTDONE_I965); | ||
323 | error->instps = I915_READ(INSTPS); | ||
324 | error->instdone1 = I915_READ(INSTDONE1); | ||
325 | error->acthd = I915_READ(ACTHD_I965); | ||
326 | } | ||
327 | |||
328 | dev_priv->first_error = error; | ||
329 | |||
330 | out: | ||
331 | spin_unlock_irqrestore(&dev_priv->error_lock, flags); | ||
332 | } | ||
333 | |||
291 | irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) | 334 | irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) |
292 | { | 335 | { |
293 | struct drm_device *dev = (struct drm_device *) arg; | 336 | struct drm_device *dev = (struct drm_device *) arg; |
@@ -333,11 +376,15 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) | |||
333 | * Clear the PIPE(A|B)STAT regs before the IIR | 376 | * Clear the PIPE(A|B)STAT regs before the IIR |
334 | */ | 377 | */ |
335 | if (pipea_stats & 0x8000ffff) { | 378 | if (pipea_stats & 0x8000ffff) { |
379 | if (pipea_stats & PIPE_FIFO_UNDERRUN_STATUS) | ||
380 | DRM_DEBUG("pipe a underrun\n"); | ||
336 | I915_WRITE(PIPEASTAT, pipea_stats); | 381 | I915_WRITE(PIPEASTAT, pipea_stats); |
337 | irq_received = 1; | 382 | irq_received = 1; |
338 | } | 383 | } |
339 | 384 | ||
340 | if (pipeb_stats & 0x8000ffff) { | 385 | if (pipeb_stats & 0x8000ffff) { |
386 | if (pipeb_stats & PIPE_FIFO_UNDERRUN_STATUS) | ||
387 | DRM_DEBUG("pipe b underrun\n"); | ||
341 | I915_WRITE(PIPEBSTAT, pipeb_stats); | 388 | I915_WRITE(PIPEBSTAT, pipeb_stats); |
342 | irq_received = 1; | 389 | irq_received = 1; |
343 | } | 390 | } |
@@ -362,6 +409,80 @@ irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS) | |||
362 | I915_READ(PORT_HOTPLUG_STAT); | 409 | I915_READ(PORT_HOTPLUG_STAT); |
363 | } | 410 | } |
364 | 411 | ||
412 | if (iir & I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT) { | ||
413 | u32 eir = I915_READ(EIR); | ||
414 | |||
415 | i915_capture_error_state(dev); | ||
416 | |||
417 | printk(KERN_ERR "render error detected, EIR: 0x%08x\n", | ||
418 | eir); | ||
419 | if (eir & I915_ERROR_PAGE_TABLE) { | ||
420 | u32 pgtbl_err = I915_READ(PGTBL_ER); | ||
421 | printk(KERN_ERR "page table error\n"); | ||
422 | printk(KERN_ERR " PGTBL_ER: 0x%08x\n", | ||
423 | pgtbl_err); | ||
424 | I915_WRITE(PGTBL_ER, pgtbl_err); | ||
425 | (void)I915_READ(PGTBL_ER); | ||
426 | } | ||
427 | if (eir & I915_ERROR_MEMORY_REFRESH) { | ||
428 | printk(KERN_ERR "memory refresh error\n"); | ||
429 | printk(KERN_ERR "PIPEASTAT: 0x%08x\n", | ||
430 | pipea_stats); | ||
431 | printk(KERN_ERR "PIPEBSTAT: 0x%08x\n", | ||
432 | pipeb_stats); | ||
433 | /* pipestat has already been acked */ | ||
434 | } | ||
435 | if (eir & I915_ERROR_INSTRUCTION) { | ||
436 | printk(KERN_ERR "instruction error\n"); | ||
437 | printk(KERN_ERR " INSTPM: 0x%08x\n", | ||
438 | I915_READ(INSTPM)); | ||
439 | if (!IS_I965G(dev)) { | ||
440 | u32 ipeir = I915_READ(IPEIR); | ||
441 | |||
442 | printk(KERN_ERR " IPEIR: 0x%08x\n", | ||
443 | I915_READ(IPEIR)); | ||
444 | printk(KERN_ERR " IPEHR: 0x%08x\n", | ||
445 | I915_READ(IPEHR)); | ||
446 | printk(KERN_ERR " INSTDONE: 0x%08x\n", | ||
447 | I915_READ(INSTDONE)); | ||
448 | printk(KERN_ERR " ACTHD: 0x%08x\n", | ||
449 | I915_READ(ACTHD)); | ||
450 | I915_WRITE(IPEIR, ipeir); | ||
451 | (void)I915_READ(IPEIR); | ||
452 | } else { | ||
453 | u32 ipeir = I915_READ(IPEIR_I965); | ||
454 | |||
455 | printk(KERN_ERR " IPEIR: 0x%08x\n", | ||
456 | I915_READ(IPEIR_I965)); | ||
457 | printk(KERN_ERR " IPEHR: 0x%08x\n", | ||
458 | I915_READ(IPEHR_I965)); | ||
459 | printk(KERN_ERR " INSTDONE: 0x%08x\n", | ||
460 | I915_READ(INSTDONE_I965)); | ||
461 | printk(KERN_ERR " INSTPS: 0x%08x\n", | ||
462 | I915_READ(INSTPS)); | ||
463 | printk(KERN_ERR " INSTDONE1: 0x%08x\n", | ||
464 | I915_READ(INSTDONE1)); | ||
465 | printk(KERN_ERR " ACTHD: 0x%08x\n", | ||
466 | I915_READ(ACTHD_I965)); | ||
467 | I915_WRITE(IPEIR_I965, ipeir); | ||
468 | (void)I915_READ(IPEIR_I965); | ||
469 | } | ||
470 | } | ||
471 | |||
472 | I915_WRITE(EIR, eir); | ||
473 | (void)I915_READ(EIR); | ||
474 | eir = I915_READ(EIR); | ||
475 | if (eir) { | ||
476 | /* | ||
477 | * some errors might have become stuck, | ||
478 | * mask them. | ||
479 | */ | ||
480 | DRM_ERROR("EIR stuck: 0x%08x, masking\n", eir); | ||
481 | I915_WRITE(EMR, I915_READ(EMR) | eir); | ||
482 | I915_WRITE(IIR, I915_RENDER_COMMAND_PARSER_ERROR_INTERRUPT); | ||
483 | } | ||
484 | } | ||
485 | |||
365 | I915_WRITE(IIR, iir); | 486 | I915_WRITE(IIR, iir); |
366 | new_iir = I915_READ(IIR); /* Flush posted writes */ | 487 | new_iir = I915_READ(IIR); /* Flush posted writes */ |
367 | 488 | ||
@@ -732,6 +853,7 @@ int i915_driver_irq_postinstall(struct drm_device *dev) | |||
732 | { | 853 | { |
733 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; | 854 | drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; |
734 | u32 enable_mask = I915_INTERRUPT_ENABLE_FIX | I915_INTERRUPT_ENABLE_VAR; | 855 | u32 enable_mask = I915_INTERRUPT_ENABLE_FIX | I915_INTERRUPT_ENABLE_VAR; |
856 | u32 error_mask; | ||
735 | 857 | ||
736 | DRM_INIT_WAITQUEUE(&dev_priv->irq_queue); | 858 | DRM_INIT_WAITQUEUE(&dev_priv->irq_queue); |
737 | 859 | ||
@@ -768,6 +890,21 @@ int i915_driver_irq_postinstall(struct drm_device *dev) | |||
768 | i915_enable_irq(dev_priv, I915_DISPLAY_PORT_INTERRUPT); | 890 | i915_enable_irq(dev_priv, I915_DISPLAY_PORT_INTERRUPT); |
769 | } | 891 | } |
770 | 892 | ||
893 | /* | ||
894 | * Enable some error detection, note the instruction error mask | ||
895 | * bit is reserved, so we leave it masked. | ||
896 | */ | ||
897 | if (IS_G4X(dev)) { | ||
898 | error_mask = ~(GM45_ERROR_PAGE_TABLE | | ||
899 | GM45_ERROR_MEM_PRIV | | ||
900 | GM45_ERROR_CP_PRIV | | ||
901 | I915_ERROR_MEMORY_REFRESH); | ||
902 | } else { | ||
903 | error_mask = ~(I915_ERROR_PAGE_TABLE | | ||
904 | I915_ERROR_MEMORY_REFRESH); | ||
905 | } | ||
906 | I915_WRITE(EMR, error_mask); | ||
907 | |||
771 | /* Disable pipe interrupt enables, clear pending pipe status */ | 908 | /* Disable pipe interrupt enables, clear pending pipe status */ |
772 | I915_WRITE(PIPEASTAT, I915_READ(PIPEASTAT) & 0x8000ffff); | 909 | I915_WRITE(PIPEASTAT, I915_READ(PIPEASTAT) & 0x8000ffff); |
773 | I915_WRITE(PIPEBSTAT, I915_READ(PIPEBSTAT) & 0x8000ffff); | 910 | I915_WRITE(PIPEBSTAT, I915_READ(PIPEBSTAT) & 0x8000ffff); |
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index 88bf7521405f..6c0858484094 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -206,6 +206,7 @@ | |||
206 | /* | 206 | /* |
207 | * Instruction and interrupt control regs | 207 | * Instruction and interrupt control regs |
208 | */ | 208 | */ |
209 | #define PGTBL_ER 0x02024 | ||
209 | #define PRB0_TAIL 0x02030 | 210 | #define PRB0_TAIL 0x02030 |
210 | #define PRB0_HEAD 0x02034 | 211 | #define PRB0_HEAD 0x02034 |
211 | #define PRB0_START 0x02038 | 212 | #define PRB0_START 0x02038 |
@@ -226,11 +227,18 @@ | |||
226 | #define PRB1_HEAD 0x02044 /* 915+ only */ | 227 | #define PRB1_HEAD 0x02044 /* 915+ only */ |
227 | #define PRB1_START 0x02048 /* 915+ only */ | 228 | #define PRB1_START 0x02048 /* 915+ only */ |
228 | #define PRB1_CTL 0x0204c /* 915+ only */ | 229 | #define PRB1_CTL 0x0204c /* 915+ only */ |
230 | #define IPEIR_I965 0x02064 | ||
231 | #define IPEHR_I965 0x02068 | ||
232 | #define INSTDONE_I965 0x0206c | ||
233 | #define INSTPS 0x02070 /* 965+ only */ | ||
234 | #define INSTDONE1 0x0207c /* 965+ only */ | ||
229 | #define ACTHD_I965 0x02074 | 235 | #define ACTHD_I965 0x02074 |
230 | #define HWS_PGA 0x02080 | 236 | #define HWS_PGA 0x02080 |
231 | #define HWS_ADDRESS_MASK 0xfffff000 | 237 | #define HWS_ADDRESS_MASK 0xfffff000 |
232 | #define HWS_START_ADDRESS_SHIFT 4 | 238 | #define HWS_START_ADDRESS_SHIFT 4 |
233 | #define IPEIR 0x02088 | 239 | #define IPEIR 0x02088 |
240 | #define IPEHR 0x0208c | ||
241 | #define INSTDONE 0x02090 | ||
234 | #define NOPID 0x02094 | 242 | #define NOPID 0x02094 |
235 | #define HWSTAM 0x02098 | 243 | #define HWSTAM 0x02098 |
236 | #define SCPD0 0x0209c /* 915+ only */ | 244 | #define SCPD0 0x0209c /* 915+ only */ |
@@ -258,10 +266,22 @@ | |||
258 | #define EIR 0x020b0 | 266 | #define EIR 0x020b0 |
259 | #define EMR 0x020b4 | 267 | #define EMR 0x020b4 |
260 | #define ESR 0x020b8 | 268 | #define ESR 0x020b8 |
269 | #define GM45_ERROR_PAGE_TABLE (1<<5) | ||
270 | #define GM45_ERROR_MEM_PRIV (1<<4) | ||
271 | #define I915_ERROR_PAGE_TABLE (1<<4) | ||
272 | #define GM45_ERROR_CP_PRIV (1<<3) | ||
273 | #define I915_ERROR_MEMORY_REFRESH (1<<1) | ||
274 | #define I915_ERROR_INSTRUCTION (1<<0) | ||
261 | #define INSTPM 0x020c0 | 275 | #define INSTPM 0x020c0 |
262 | #define ACTHD 0x020c8 | 276 | #define ACTHD 0x020c8 |
263 | #define FW_BLC 0x020d8 | 277 | #define FW_BLC 0x020d8 |
278 | #define FW_BLC2 0x020dc | ||
264 | #define FW_BLC_SELF 0x020e0 /* 915+ only */ | 279 | #define FW_BLC_SELF 0x020e0 /* 915+ only */ |
280 | #define FW_BLC_SELF_EN (1<<15) | ||
281 | #define MM_BURST_LENGTH 0x00700000 | ||
282 | #define MM_FIFO_WATERMARK 0x0001F000 | ||
283 | #define LM_BURST_LENGTH 0x00000700 | ||
284 | #define LM_FIFO_WATERMARK 0x0000001F | ||
265 | #define MI_ARB_STATE 0x020e4 /* 915+ only */ | 285 | #define MI_ARB_STATE 0x020e4 /* 915+ only */ |
266 | #define CACHE_MODE_0 0x02120 /* 915+ only */ | 286 | #define CACHE_MODE_0 0x02120 /* 915+ only */ |
267 | #define CM0_MASK_SHIFT 16 | 287 | #define CM0_MASK_SHIFT 16 |
@@ -571,17 +591,21 @@ | |||
571 | 591 | ||
572 | /* Clocking configuration register */ | 592 | /* Clocking configuration register */ |
573 | #define CLKCFG 0x10c00 | 593 | #define CLKCFG 0x10c00 |
574 | #define CLKCFG_FSB_400 (0 << 0) /* hrawclk 100 */ | 594 | #define CLKCFG_FSB_400 (5 << 0) /* hrawclk 100 */ |
575 | #define CLKCFG_FSB_533 (1 << 0) /* hrawclk 133 */ | 595 | #define CLKCFG_FSB_533 (1 << 0) /* hrawclk 133 */ |
576 | #define CLKCFG_FSB_667 (3 << 0) /* hrawclk 166 */ | 596 | #define CLKCFG_FSB_667 (3 << 0) /* hrawclk 166 */ |
577 | #define CLKCFG_FSB_800 (2 << 0) /* hrawclk 200 */ | 597 | #define CLKCFG_FSB_800 (2 << 0) /* hrawclk 200 */ |
578 | #define CLKCFG_FSB_1067 (6 << 0) /* hrawclk 266 */ | 598 | #define CLKCFG_FSB_1067 (6 << 0) /* hrawclk 266 */ |
579 | #define CLKCFG_FSB_1333 (7 << 0) /* hrawclk 333 */ | 599 | #define CLKCFG_FSB_1333 (7 << 0) /* hrawclk 333 */ |
580 | /* this is a guess, could be 5 as well */ | 600 | /* Note, below two are guess */ |
581 | #define CLKCFG_FSB_1600 (4 << 0) /* hrawclk 400 */ | 601 | #define CLKCFG_FSB_1600 (4 << 0) /* hrawclk 400 */ |
582 | #define CLKCFG_FSB_1600_ALT (5 << 0) /* hrawclk 400 */ | 602 | #define CLKCFG_FSB_1600_ALT (0 << 0) /* hrawclk 400 */ |
583 | #define CLKCFG_FSB_MASK (7 << 0) | 603 | #define CLKCFG_FSB_MASK (7 << 0) |
584 | 604 | #define CLKCFG_MEM_533 (1 << 4) | |
605 | #define CLKCFG_MEM_667 (2 << 4) | ||
606 | #define CLKCFG_MEM_800 (3 << 4) | ||
607 | #define CLKCFG_MEM_MASK (7 << 4) | ||
608 | |||
585 | /** GM965 GM45 render standby register */ | 609 | /** GM965 GM45 render standby register */ |
586 | #define MCHBAR_RENDER_STANDBY 0x111B8 | 610 | #define MCHBAR_RENDER_STANDBY 0x111B8 |
587 | 611 | ||
@@ -1581,6 +1605,34 @@ | |||
1581 | #define DSPARB_CSTART_SHIFT 7 | 1605 | #define DSPARB_CSTART_SHIFT 7 |
1582 | #define DSPARB_BSTART_MASK (0x7f) | 1606 | #define DSPARB_BSTART_MASK (0x7f) |
1583 | #define DSPARB_BSTART_SHIFT 0 | 1607 | #define DSPARB_BSTART_SHIFT 0 |
1608 | #define DSPARB_BEND_SHIFT 9 /* on 855 */ | ||
1609 | #define DSPARB_AEND_SHIFT 0 | ||
1610 | |||
1611 | #define DSPFW1 0x70034 | ||
1612 | #define DSPFW2 0x70038 | ||
1613 | #define DSPFW3 0x7003c | ||
1614 | #define IGD_SELF_REFRESH_EN (1<<30) | ||
1615 | |||
1616 | /* FIFO watermark sizes etc */ | ||
1617 | #define I915_FIFO_LINE_SIZE 64 | ||
1618 | #define I830_FIFO_LINE_SIZE 32 | ||
1619 | #define I945_FIFO_SIZE 127 /* 945 & 965 */ | ||
1620 | #define I915_FIFO_SIZE 95 | ||
1621 | #define I855GM_FIFO_SIZE 255 | ||
1622 | #define I830_FIFO_SIZE 95 | ||
1623 | #define I915_MAX_WM 0x3f | ||
1624 | |||
1625 | #define IGD_DISPLAY_FIFO 512 /* in 64byte unit */ | ||
1626 | #define IGD_FIFO_LINE_SIZE 64 | ||
1627 | #define IGD_MAX_WM 0x1ff | ||
1628 | #define IGD_DFT_WM 0x3f | ||
1629 | #define IGD_DFT_HPLLOFF_WM 0 | ||
1630 | #define IGD_GUARD_WM 10 | ||
1631 | #define IGD_CURSOR_FIFO 64 | ||
1632 | #define IGD_CURSOR_MAX_WM 0x3f | ||
1633 | #define IGD_CURSOR_DFT_WM 0 | ||
1634 | #define IGD_CURSOR_GUARD_WM 5 | ||
1635 | |||
1584 | /* | 1636 | /* |
1585 | * The two pipe frame counter registers are not synchronized, so | 1637 | * The two pipe frame counter registers are not synchronized, so |
1586 | * reading a stable value is somewhat tricky. The following code | 1638 | * reading a stable value is somewhat tricky. The following code |
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c index 8d8e083d14ab..9e1d16e5c3ea 100644 --- a/drivers/gpu/drm/i915/i915_suspend.c +++ b/drivers/gpu/drm/i915/i915_suspend.c | |||
@@ -222,23 +222,12 @@ static void i915_restore_vga(struct drm_device *dev) | |||
222 | I915_WRITE8(VGA_DACMASK, dev_priv->saveDACMASK); | 222 | I915_WRITE8(VGA_DACMASK, dev_priv->saveDACMASK); |
223 | } | 223 | } |
224 | 224 | ||
225 | int i915_save_state(struct drm_device *dev) | 225 | static void i915_save_modeset_reg(struct drm_device *dev) |
226 | { | 226 | { |
227 | struct drm_i915_private *dev_priv = dev->dev_private; | 227 | struct drm_i915_private *dev_priv = dev->dev_private; |
228 | int i; | ||
229 | |||
230 | pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB); | ||
231 | |||
232 | /* Render Standby */ | ||
233 | if (IS_I965G(dev) && IS_MOBILE(dev)) | ||
234 | dev_priv->saveRENDERSTANDBY = I915_READ(MCHBAR_RENDER_STANDBY); | ||
235 | |||
236 | /* Hardware status page */ | ||
237 | dev_priv->saveHWS = I915_READ(HWS_PGA); | ||
238 | |||
239 | /* Display arbitration control */ | ||
240 | dev_priv->saveDSPARB = I915_READ(DSPARB); | ||
241 | 228 | ||
229 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | ||
230 | return; | ||
242 | /* Pipe & plane A info */ | 231 | /* Pipe & plane A info */ |
243 | dev_priv->savePIPEACONF = I915_READ(PIPEACONF); | 232 | dev_priv->savePIPEACONF = I915_READ(PIPEACONF); |
244 | dev_priv->savePIPEASRC = I915_READ(PIPEASRC); | 233 | dev_priv->savePIPEASRC = I915_READ(PIPEASRC); |
@@ -294,7 +283,122 @@ int i915_save_state(struct drm_device *dev) | |||
294 | } | 283 | } |
295 | i915_save_palette(dev, PIPE_B); | 284 | i915_save_palette(dev, PIPE_B); |
296 | dev_priv->savePIPEBSTAT = I915_READ(PIPEBSTAT); | 285 | dev_priv->savePIPEBSTAT = I915_READ(PIPEBSTAT); |
286 | return; | ||
287 | } | ||
288 | static void i915_restore_modeset_reg(struct drm_device *dev) | ||
289 | { | ||
290 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
291 | |||
292 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | ||
293 | return; | ||
294 | |||
295 | /* Pipe & plane A info */ | ||
296 | /* Prime the clock */ | ||
297 | if (dev_priv->saveDPLL_A & DPLL_VCO_ENABLE) { | ||
298 | I915_WRITE(DPLL_A, dev_priv->saveDPLL_A & | ||
299 | ~DPLL_VCO_ENABLE); | ||
300 | DRM_UDELAY(150); | ||
301 | } | ||
302 | I915_WRITE(FPA0, dev_priv->saveFPA0); | ||
303 | I915_WRITE(FPA1, dev_priv->saveFPA1); | ||
304 | /* Actually enable it */ | ||
305 | I915_WRITE(DPLL_A, dev_priv->saveDPLL_A); | ||
306 | DRM_UDELAY(150); | ||
307 | if (IS_I965G(dev)) | ||
308 | I915_WRITE(DPLL_A_MD, dev_priv->saveDPLL_A_MD); | ||
309 | DRM_UDELAY(150); | ||
310 | |||
311 | /* Restore mode */ | ||
312 | I915_WRITE(HTOTAL_A, dev_priv->saveHTOTAL_A); | ||
313 | I915_WRITE(HBLANK_A, dev_priv->saveHBLANK_A); | ||
314 | I915_WRITE(HSYNC_A, dev_priv->saveHSYNC_A); | ||
315 | I915_WRITE(VTOTAL_A, dev_priv->saveVTOTAL_A); | ||
316 | I915_WRITE(VBLANK_A, dev_priv->saveVBLANK_A); | ||
317 | I915_WRITE(VSYNC_A, dev_priv->saveVSYNC_A); | ||
318 | I915_WRITE(BCLRPAT_A, dev_priv->saveBCLRPAT_A); | ||
319 | |||
320 | /* Restore plane info */ | ||
321 | I915_WRITE(DSPASIZE, dev_priv->saveDSPASIZE); | ||
322 | I915_WRITE(DSPAPOS, dev_priv->saveDSPAPOS); | ||
323 | I915_WRITE(PIPEASRC, dev_priv->savePIPEASRC); | ||
324 | I915_WRITE(DSPAADDR, dev_priv->saveDSPAADDR); | ||
325 | I915_WRITE(DSPASTRIDE, dev_priv->saveDSPASTRIDE); | ||
326 | if (IS_I965G(dev)) { | ||
327 | I915_WRITE(DSPASURF, dev_priv->saveDSPASURF); | ||
328 | I915_WRITE(DSPATILEOFF, dev_priv->saveDSPATILEOFF); | ||
329 | } | ||
330 | |||
331 | I915_WRITE(PIPEACONF, dev_priv->savePIPEACONF); | ||
332 | |||
333 | i915_restore_palette(dev, PIPE_A); | ||
334 | /* Enable the plane */ | ||
335 | I915_WRITE(DSPACNTR, dev_priv->saveDSPACNTR); | ||
336 | I915_WRITE(DSPAADDR, I915_READ(DSPAADDR)); | ||
337 | |||
338 | /* Pipe & plane B info */ | ||
339 | if (dev_priv->saveDPLL_B & DPLL_VCO_ENABLE) { | ||
340 | I915_WRITE(DPLL_B, dev_priv->saveDPLL_B & | ||
341 | ~DPLL_VCO_ENABLE); | ||
342 | DRM_UDELAY(150); | ||
343 | } | ||
344 | I915_WRITE(FPB0, dev_priv->saveFPB0); | ||
345 | I915_WRITE(FPB1, dev_priv->saveFPB1); | ||
346 | /* Actually enable it */ | ||
347 | I915_WRITE(DPLL_B, dev_priv->saveDPLL_B); | ||
348 | DRM_UDELAY(150); | ||
349 | if (IS_I965G(dev)) | ||
350 | I915_WRITE(DPLL_B_MD, dev_priv->saveDPLL_B_MD); | ||
351 | DRM_UDELAY(150); | ||
352 | |||
353 | /* Restore mode */ | ||
354 | I915_WRITE(HTOTAL_B, dev_priv->saveHTOTAL_B); | ||
355 | I915_WRITE(HBLANK_B, dev_priv->saveHBLANK_B); | ||
356 | I915_WRITE(HSYNC_B, dev_priv->saveHSYNC_B); | ||
357 | I915_WRITE(VTOTAL_B, dev_priv->saveVTOTAL_B); | ||
358 | I915_WRITE(VBLANK_B, dev_priv->saveVBLANK_B); | ||
359 | I915_WRITE(VSYNC_B, dev_priv->saveVSYNC_B); | ||
360 | I915_WRITE(BCLRPAT_B, dev_priv->saveBCLRPAT_B); | ||
361 | |||
362 | /* Restore plane info */ | ||
363 | I915_WRITE(DSPBSIZE, dev_priv->saveDSPBSIZE); | ||
364 | I915_WRITE(DSPBPOS, dev_priv->saveDSPBPOS); | ||
365 | I915_WRITE(PIPEBSRC, dev_priv->savePIPEBSRC); | ||
366 | I915_WRITE(DSPBADDR, dev_priv->saveDSPBADDR); | ||
367 | I915_WRITE(DSPBSTRIDE, dev_priv->saveDSPBSTRIDE); | ||
368 | if (IS_I965G(dev)) { | ||
369 | I915_WRITE(DSPBSURF, dev_priv->saveDSPBSURF); | ||
370 | I915_WRITE(DSPBTILEOFF, dev_priv->saveDSPBTILEOFF); | ||
371 | } | ||
372 | |||
373 | I915_WRITE(PIPEBCONF, dev_priv->savePIPEBCONF); | ||
374 | |||
375 | i915_restore_palette(dev, PIPE_B); | ||
376 | /* Enable the plane */ | ||
377 | I915_WRITE(DSPBCNTR, dev_priv->saveDSPBCNTR); | ||
378 | I915_WRITE(DSPBADDR, I915_READ(DSPBADDR)); | ||
297 | 379 | ||
380 | return; | ||
381 | } | ||
382 | int i915_save_state(struct drm_device *dev) | ||
383 | { | ||
384 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
385 | int i; | ||
386 | |||
387 | pci_read_config_byte(dev->pdev, LBB, &dev_priv->saveLBB); | ||
388 | |||
389 | /* Render Standby */ | ||
390 | if (IS_I965G(dev) && IS_MOBILE(dev)) | ||
391 | dev_priv->saveRENDERSTANDBY = I915_READ(MCHBAR_RENDER_STANDBY); | ||
392 | |||
393 | /* Hardware status page */ | ||
394 | dev_priv->saveHWS = I915_READ(HWS_PGA); | ||
395 | |||
396 | /* Display arbitration control */ | ||
397 | dev_priv->saveDSPARB = I915_READ(DSPARB); | ||
398 | |||
399 | /* This is only meaningful in non-KMS mode */ | ||
400 | /* Don't save them in KMS mode */ | ||
401 | i915_save_modeset_reg(dev); | ||
298 | /* Cursor state */ | 402 | /* Cursor state */ |
299 | dev_priv->saveCURACNTR = I915_READ(CURACNTR); | 403 | dev_priv->saveCURACNTR = I915_READ(CURACNTR); |
300 | dev_priv->saveCURAPOS = I915_READ(CURAPOS); | 404 | dev_priv->saveCURAPOS = I915_READ(CURAPOS); |
@@ -430,92 +534,9 @@ int i915_restore_state(struct drm_device *dev) | |||
430 | I915_WRITE(PIPEA_DP_LINK_N, dev_priv->savePIPEA_DP_LINK_N); | 534 | I915_WRITE(PIPEA_DP_LINK_N, dev_priv->savePIPEA_DP_LINK_N); |
431 | I915_WRITE(PIPEB_DP_LINK_N, dev_priv->savePIPEB_DP_LINK_N); | 535 | I915_WRITE(PIPEB_DP_LINK_N, dev_priv->savePIPEB_DP_LINK_N); |
432 | } | 536 | } |
433 | 537 | /* This is only meaningful in non-KMS mode */ | |
434 | /* Pipe & plane A info */ | 538 | /* Don't restore them in KMS mode */ |
435 | /* Prime the clock */ | 539 | i915_restore_modeset_reg(dev); |
436 | if (dev_priv->saveDPLL_A & DPLL_VCO_ENABLE) { | ||
437 | I915_WRITE(DPLL_A, dev_priv->saveDPLL_A & | ||
438 | ~DPLL_VCO_ENABLE); | ||
439 | DRM_UDELAY(150); | ||
440 | } | ||
441 | I915_WRITE(FPA0, dev_priv->saveFPA0); | ||
442 | I915_WRITE(FPA1, dev_priv->saveFPA1); | ||
443 | /* Actually enable it */ | ||
444 | I915_WRITE(DPLL_A, dev_priv->saveDPLL_A); | ||
445 | DRM_UDELAY(150); | ||
446 | if (IS_I965G(dev)) | ||
447 | I915_WRITE(DPLL_A_MD, dev_priv->saveDPLL_A_MD); | ||
448 | DRM_UDELAY(150); | ||
449 | |||
450 | /* Restore mode */ | ||
451 | I915_WRITE(HTOTAL_A, dev_priv->saveHTOTAL_A); | ||
452 | I915_WRITE(HBLANK_A, dev_priv->saveHBLANK_A); | ||
453 | I915_WRITE(HSYNC_A, dev_priv->saveHSYNC_A); | ||
454 | I915_WRITE(VTOTAL_A, dev_priv->saveVTOTAL_A); | ||
455 | I915_WRITE(VBLANK_A, dev_priv->saveVBLANK_A); | ||
456 | I915_WRITE(VSYNC_A, dev_priv->saveVSYNC_A); | ||
457 | I915_WRITE(BCLRPAT_A, dev_priv->saveBCLRPAT_A); | ||
458 | |||
459 | /* Restore plane info */ | ||
460 | I915_WRITE(DSPASIZE, dev_priv->saveDSPASIZE); | ||
461 | I915_WRITE(DSPAPOS, dev_priv->saveDSPAPOS); | ||
462 | I915_WRITE(PIPEASRC, dev_priv->savePIPEASRC); | ||
463 | I915_WRITE(DSPAADDR, dev_priv->saveDSPAADDR); | ||
464 | I915_WRITE(DSPASTRIDE, dev_priv->saveDSPASTRIDE); | ||
465 | if (IS_I965G(dev)) { | ||
466 | I915_WRITE(DSPASURF, dev_priv->saveDSPASURF); | ||
467 | I915_WRITE(DSPATILEOFF, dev_priv->saveDSPATILEOFF); | ||
468 | } | ||
469 | |||
470 | I915_WRITE(PIPEACONF, dev_priv->savePIPEACONF); | ||
471 | |||
472 | i915_restore_palette(dev, PIPE_A); | ||
473 | /* Enable the plane */ | ||
474 | I915_WRITE(DSPACNTR, dev_priv->saveDSPACNTR); | ||
475 | I915_WRITE(DSPAADDR, I915_READ(DSPAADDR)); | ||
476 | |||
477 | /* Pipe & plane B info */ | ||
478 | if (dev_priv->saveDPLL_B & DPLL_VCO_ENABLE) { | ||
479 | I915_WRITE(DPLL_B, dev_priv->saveDPLL_B & | ||
480 | ~DPLL_VCO_ENABLE); | ||
481 | DRM_UDELAY(150); | ||
482 | } | ||
483 | I915_WRITE(FPB0, dev_priv->saveFPB0); | ||
484 | I915_WRITE(FPB1, dev_priv->saveFPB1); | ||
485 | /* Actually enable it */ | ||
486 | I915_WRITE(DPLL_B, dev_priv->saveDPLL_B); | ||
487 | DRM_UDELAY(150); | ||
488 | if (IS_I965G(dev)) | ||
489 | I915_WRITE(DPLL_B_MD, dev_priv->saveDPLL_B_MD); | ||
490 | DRM_UDELAY(150); | ||
491 | |||
492 | /* Restore mode */ | ||
493 | I915_WRITE(HTOTAL_B, dev_priv->saveHTOTAL_B); | ||
494 | I915_WRITE(HBLANK_B, dev_priv->saveHBLANK_B); | ||
495 | I915_WRITE(HSYNC_B, dev_priv->saveHSYNC_B); | ||
496 | I915_WRITE(VTOTAL_B, dev_priv->saveVTOTAL_B); | ||
497 | I915_WRITE(VBLANK_B, dev_priv->saveVBLANK_B); | ||
498 | I915_WRITE(VSYNC_B, dev_priv->saveVSYNC_B); | ||
499 | I915_WRITE(BCLRPAT_B, dev_priv->saveBCLRPAT_B); | ||
500 | |||
501 | /* Restore plane info */ | ||
502 | I915_WRITE(DSPBSIZE, dev_priv->saveDSPBSIZE); | ||
503 | I915_WRITE(DSPBPOS, dev_priv->saveDSPBPOS); | ||
504 | I915_WRITE(PIPEBSRC, dev_priv->savePIPEBSRC); | ||
505 | I915_WRITE(DSPBADDR, dev_priv->saveDSPBADDR); | ||
506 | I915_WRITE(DSPBSTRIDE, dev_priv->saveDSPBSTRIDE); | ||
507 | if (IS_I965G(dev)) { | ||
508 | I915_WRITE(DSPBSURF, dev_priv->saveDSPBSURF); | ||
509 | I915_WRITE(DSPBTILEOFF, dev_priv->saveDSPBTILEOFF); | ||
510 | } | ||
511 | |||
512 | I915_WRITE(PIPEBCONF, dev_priv->savePIPEBCONF); | ||
513 | |||
514 | i915_restore_palette(dev, PIPE_B); | ||
515 | /* Enable the plane */ | ||
516 | I915_WRITE(DSPBCNTR, dev_priv->saveDSPBCNTR); | ||
517 | I915_WRITE(DSPBADDR, I915_READ(DSPBADDR)); | ||
518 | |||
519 | /* Cursor state */ | 540 | /* Cursor state */ |
520 | I915_WRITE(CURAPOS, dev_priv->saveCURAPOS); | 541 | I915_WRITE(CURAPOS, dev_priv->saveCURAPOS); |
521 | I915_WRITE(CURACNTR, dev_priv->saveCURACNTR); | 542 | I915_WRITE(CURACNTR, dev_priv->saveCURACNTR); |
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c index 716409a57244..7cc447191028 100644 --- a/drivers/gpu/drm/i915/intel_bios.c +++ b/drivers/gpu/drm/i915/intel_bios.c | |||
@@ -97,6 +97,7 @@ static void | |||
97 | parse_lfp_panel_data(struct drm_i915_private *dev_priv, | 97 | parse_lfp_panel_data(struct drm_i915_private *dev_priv, |
98 | struct bdb_header *bdb) | 98 | struct bdb_header *bdb) |
99 | { | 99 | { |
100 | struct drm_device *dev = dev_priv->dev; | ||
100 | struct bdb_lvds_options *lvds_options; | 101 | struct bdb_lvds_options *lvds_options; |
101 | struct bdb_lvds_lfp_data *lvds_lfp_data; | 102 | struct bdb_lvds_lfp_data *lvds_lfp_data; |
102 | struct bdb_lvds_lfp_data_ptrs *lvds_lfp_data_ptrs; | 103 | struct bdb_lvds_lfp_data_ptrs *lvds_lfp_data_ptrs; |
@@ -132,7 +133,14 @@ parse_lfp_panel_data(struct drm_i915_private *dev_priv, | |||
132 | entry = (struct bdb_lvds_lfp_data_entry *) | 133 | entry = (struct bdb_lvds_lfp_data_entry *) |
133 | ((uint8_t *)lvds_lfp_data->data + (lfp_data_size * | 134 | ((uint8_t *)lvds_lfp_data->data + (lfp_data_size * |
134 | lvds_options->panel_type)); | 135 | lvds_options->panel_type)); |
135 | dvo_timing = &entry->dvo_timing; | 136 | |
137 | /* On IGDNG mobile, LVDS data block removes panel fitting registers. | ||
138 | So dec 2 dword from dvo_timing offset */ | ||
139 | if (IS_IGDNG(dev)) | ||
140 | dvo_timing = (struct lvds_dvo_timing *) | ||
141 | ((u8 *)&entry->dvo_timing - 8); | ||
142 | else | ||
143 | dvo_timing = &entry->dvo_timing; | ||
136 | 144 | ||
137 | panel_fixed_mode = kzalloc(sizeof(*panel_fixed_mode), GFP_KERNEL); | 145 | panel_fixed_mode = kzalloc(sizeof(*panel_fixed_mode), GFP_KERNEL); |
138 | 146 | ||
@@ -195,10 +203,12 @@ parse_general_features(struct drm_i915_private *dev_priv, | |||
195 | dev_priv->lvds_use_ssc = general->enable_ssc; | 203 | dev_priv->lvds_use_ssc = general->enable_ssc; |
196 | 204 | ||
197 | if (dev_priv->lvds_use_ssc) { | 205 | if (dev_priv->lvds_use_ssc) { |
198 | if (IS_I855(dev_priv->dev)) | 206 | if (IS_I85X(dev_priv->dev)) |
199 | dev_priv->lvds_ssc_freq = general->ssc_freq ? 66 : 48; | 207 | dev_priv->lvds_ssc_freq = |
200 | else | 208 | general->ssc_freq ? 66 : 48; |
201 | dev_priv->lvds_ssc_freq = general->ssc_freq ? 100 : 96; | 209 | else |
210 | dev_priv->lvds_ssc_freq = | ||
211 | general->ssc_freq ? 100 : 96; | ||
202 | } | 212 | } |
203 | } | 213 | } |
204 | } | 214 | } |
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index 6de97fc66029..d6a1a6e5539a 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -46,7 +46,7 @@ static void intel_crt_dpms(struct drm_encoder *encoder, int mode) | |||
46 | 46 | ||
47 | temp = I915_READ(reg); | 47 | temp = I915_READ(reg); |
48 | temp &= ~(ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE); | 48 | temp &= ~(ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE); |
49 | temp |= ADPA_DAC_ENABLE; | 49 | temp &= ~ADPA_DAC_ENABLE; |
50 | 50 | ||
51 | switch(mode) { | 51 | switch(mode) { |
52 | case DRM_MODE_DPMS_ON: | 52 | case DRM_MODE_DPMS_ON: |
@@ -428,8 +428,34 @@ static void intel_crt_destroy(struct drm_connector *connector) | |||
428 | 428 | ||
429 | static int intel_crt_get_modes(struct drm_connector *connector) | 429 | static int intel_crt_get_modes(struct drm_connector *connector) |
430 | { | 430 | { |
431 | int ret; | ||
431 | struct intel_output *intel_output = to_intel_output(connector); | 432 | struct intel_output *intel_output = to_intel_output(connector); |
432 | return intel_ddc_get_modes(intel_output); | 433 | struct i2c_adapter *ddcbus; |
434 | struct drm_device *dev = connector->dev; | ||
435 | |||
436 | |||
437 | ret = intel_ddc_get_modes(intel_output); | ||
438 | if (ret || !IS_G4X(dev)) | ||
439 | goto end; | ||
440 | |||
441 | ddcbus = intel_output->ddc_bus; | ||
442 | /* Try to probe digital port for output in DVI-I -> VGA mode. */ | ||
443 | intel_output->ddc_bus = | ||
444 | intel_i2c_create(connector->dev, GPIOD, "CRTDDC_D"); | ||
445 | |||
446 | if (!intel_output->ddc_bus) { | ||
447 | intel_output->ddc_bus = ddcbus; | ||
448 | dev_printk(KERN_ERR, &connector->dev->pdev->dev, | ||
449 | "DDC bus registration failed for CRTDDC_D.\n"); | ||
450 | goto end; | ||
451 | } | ||
452 | /* Try to get modes by GPIOD port */ | ||
453 | ret = intel_ddc_get_modes(intel_output); | ||
454 | intel_i2c_destroy(ddcbus); | ||
455 | |||
456 | end: | ||
457 | return ret; | ||
458 | |||
433 | } | 459 | } |
434 | 460 | ||
435 | static int intel_crt_set_property(struct drm_connector *connector, | 461 | static int intel_crt_set_property(struct drm_connector *connector, |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 73e7b9cecac8..508838ee31e0 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -25,6 +25,7 @@ | |||
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <linux/i2c.h> | 27 | #include <linux/i2c.h> |
28 | #include <linux/kernel.h> | ||
28 | #include "drmP.h" | 29 | #include "drmP.h" |
29 | #include "intel_drv.h" | 30 | #include "intel_drv.h" |
30 | #include "i915_drm.h" | 31 | #include "i915_drm.h" |
@@ -34,6 +35,7 @@ | |||
34 | #include "drm_crtc_helper.h" | 35 | #include "drm_crtc_helper.h" |
35 | 36 | ||
36 | bool intel_pipe_has_type (struct drm_crtc *crtc, int type); | 37 | bool intel_pipe_has_type (struct drm_crtc *crtc, int type); |
38 | static void intel_update_watermarks(struct drm_device *dev); | ||
37 | 39 | ||
38 | typedef struct { | 40 | typedef struct { |
39 | /* given values */ | 41 | /* given values */ |
@@ -814,24 +816,21 @@ intel_find_pll_g4x_dp(const intel_limit_t *limit, struct drm_crtc *crtc, | |||
814 | { | 816 | { |
815 | intel_clock_t clock; | 817 | intel_clock_t clock; |
816 | if (target < 200000) { | 818 | if (target < 200000) { |
817 | clock.dot = 161670; | ||
818 | clock.p = 20; | ||
819 | clock.p1 = 2; | 819 | clock.p1 = 2; |
820 | clock.p2 = 10; | 820 | clock.p2 = 10; |
821 | clock.n = 0x01; | 821 | clock.n = 2; |
822 | clock.m = 97; | 822 | clock.m1 = 23; |
823 | clock.m1 = 0x10; | 823 | clock.m2 = 8; |
824 | clock.m2 = 0x05; | ||
825 | } else { | 824 | } else { |
826 | clock.dot = 270000; | ||
827 | clock.p = 10; | ||
828 | clock.p1 = 1; | 825 | clock.p1 = 1; |
829 | clock.p2 = 10; | 826 | clock.p2 = 10; |
830 | clock.n = 0x02; | 827 | clock.n = 1; |
831 | clock.m = 108; | 828 | clock.m1 = 14; |
832 | clock.m1 = 0x12; | 829 | clock.m2 = 2; |
833 | clock.m2 = 0x06; | ||
834 | } | 830 | } |
831 | clock.m = 5 * (clock.m1 + 2) + (clock.m2 + 2); | ||
832 | clock.p = (clock.p1 * clock.p2); | ||
833 | clock.dot = 96000 * clock.m / (clock.n + 2) / clock.p; | ||
835 | memcpy(best_clock, &clock, sizeof(intel_clock_t)); | 834 | memcpy(best_clock, &clock, sizeof(intel_clock_t)); |
836 | return true; | 835 | return true; |
837 | } | 836 | } |
@@ -1005,7 +1004,7 @@ static void igdng_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
1005 | struct drm_i915_private *dev_priv = dev->dev_private; | 1004 | struct drm_i915_private *dev_priv = dev->dev_private; |
1006 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 1005 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
1007 | int pipe = intel_crtc->pipe; | 1006 | int pipe = intel_crtc->pipe; |
1008 | int plane = intel_crtc->pipe; | 1007 | int plane = intel_crtc->plane; |
1009 | int pch_dpll_reg = (pipe == 0) ? PCH_DPLL_A : PCH_DPLL_B; | 1008 | int pch_dpll_reg = (pipe == 0) ? PCH_DPLL_A : PCH_DPLL_B; |
1010 | int pipeconf_reg = (pipe == 0) ? PIPEACONF : PIPEBCONF; | 1009 | int pipeconf_reg = (pipe == 0) ? PIPEACONF : PIPEBCONF; |
1011 | int dspcntr_reg = (plane == 0) ? DSPACNTR : DSPBCNTR; | 1010 | int dspcntr_reg = (plane == 0) ? DSPACNTR : DSPBCNTR; |
@@ -1335,8 +1334,10 @@ static void i9xx_crtc_dpms(struct drm_crtc *crtc, int mode) | |||
1335 | 1334 | ||
1336 | /* Give the overlay scaler a chance to enable if it's on this pipe */ | 1335 | /* Give the overlay scaler a chance to enable if it's on this pipe */ |
1337 | //intel_crtc_dpms_video(crtc, true); TODO | 1336 | //intel_crtc_dpms_video(crtc, true); TODO |
1337 | intel_update_watermarks(dev); | ||
1338 | break; | 1338 | break; |
1339 | case DRM_MODE_DPMS_OFF: | 1339 | case DRM_MODE_DPMS_OFF: |
1340 | intel_update_watermarks(dev); | ||
1340 | /* Give the overlay scaler a chance to disable if it's on this pipe */ | 1341 | /* Give the overlay scaler a chance to disable if it's on this pipe */ |
1341 | //intel_crtc_dpms_video(crtc, FALSE); TODO | 1342 | //intel_crtc_dpms_video(crtc, FALSE); TODO |
1342 | 1343 | ||
@@ -1515,7 +1516,6 @@ static int intel_get_core_clock_speed(struct drm_device *dev) | |||
1515 | return 0; /* Silence gcc warning */ | 1516 | return 0; /* Silence gcc warning */ |
1516 | } | 1517 | } |
1517 | 1518 | ||
1518 | |||
1519 | /** | 1519 | /** |
1520 | * Return the pipe currently connected to the panel fitter, | 1520 | * Return the pipe currently connected to the panel fitter, |
1521 | * or -1 if the panel fitter is not present or not in use | 1521 | * or -1 if the panel fitter is not present or not in use |
@@ -1574,7 +1574,7 @@ igdng_compute_m_n(int bytes_per_pixel, int nlanes, | |||
1574 | 1574 | ||
1575 | temp = (u64) DATA_N * pixel_clock; | 1575 | temp = (u64) DATA_N * pixel_clock; |
1576 | temp = div_u64(temp, link_clock); | 1576 | temp = div_u64(temp, link_clock); |
1577 | m_n->gmch_m = (temp * bytes_per_pixel) / nlanes; | 1577 | m_n->gmch_m = div_u64(temp * bytes_per_pixel, nlanes); |
1578 | m_n->gmch_n = DATA_N; | 1578 | m_n->gmch_n = DATA_N; |
1579 | fdi_reduce_ratio(&m_n->gmch_m, &m_n->gmch_n); | 1579 | fdi_reduce_ratio(&m_n->gmch_m, &m_n->gmch_n); |
1580 | 1580 | ||
@@ -1585,6 +1585,420 @@ igdng_compute_m_n(int bytes_per_pixel, int nlanes, | |||
1585 | } | 1585 | } |
1586 | 1586 | ||
1587 | 1587 | ||
1588 | struct intel_watermark_params { | ||
1589 | unsigned long fifo_size; | ||
1590 | unsigned long max_wm; | ||
1591 | unsigned long default_wm; | ||
1592 | unsigned long guard_size; | ||
1593 | unsigned long cacheline_size; | ||
1594 | }; | ||
1595 | |||
1596 | /* IGD has different values for various configs */ | ||
1597 | static struct intel_watermark_params igd_display_wm = { | ||
1598 | IGD_DISPLAY_FIFO, | ||
1599 | IGD_MAX_WM, | ||
1600 | IGD_DFT_WM, | ||
1601 | IGD_GUARD_WM, | ||
1602 | IGD_FIFO_LINE_SIZE | ||
1603 | }; | ||
1604 | static struct intel_watermark_params igd_display_hplloff_wm = { | ||
1605 | IGD_DISPLAY_FIFO, | ||
1606 | IGD_MAX_WM, | ||
1607 | IGD_DFT_HPLLOFF_WM, | ||
1608 | IGD_GUARD_WM, | ||
1609 | IGD_FIFO_LINE_SIZE | ||
1610 | }; | ||
1611 | static struct intel_watermark_params igd_cursor_wm = { | ||
1612 | IGD_CURSOR_FIFO, | ||
1613 | IGD_CURSOR_MAX_WM, | ||
1614 | IGD_CURSOR_DFT_WM, | ||
1615 | IGD_CURSOR_GUARD_WM, | ||
1616 | IGD_FIFO_LINE_SIZE, | ||
1617 | }; | ||
1618 | static struct intel_watermark_params igd_cursor_hplloff_wm = { | ||
1619 | IGD_CURSOR_FIFO, | ||
1620 | IGD_CURSOR_MAX_WM, | ||
1621 | IGD_CURSOR_DFT_WM, | ||
1622 | IGD_CURSOR_GUARD_WM, | ||
1623 | IGD_FIFO_LINE_SIZE | ||
1624 | }; | ||
1625 | static struct intel_watermark_params i945_wm_info = { | ||
1626 | I915_FIFO_LINE_SIZE, | ||
1627 | I915_MAX_WM, | ||
1628 | 1, | ||
1629 | 0, | ||
1630 | IGD_FIFO_LINE_SIZE | ||
1631 | }; | ||
1632 | static struct intel_watermark_params i915_wm_info = { | ||
1633 | I945_FIFO_SIZE, | ||
1634 | I915_MAX_WM, | ||
1635 | 1, | ||
1636 | 0, | ||
1637 | I915_FIFO_LINE_SIZE | ||
1638 | }; | ||
1639 | static struct intel_watermark_params i855_wm_info = { | ||
1640 | I855GM_FIFO_SIZE, | ||
1641 | I915_MAX_WM, | ||
1642 | 1, | ||
1643 | 0, | ||
1644 | I830_FIFO_LINE_SIZE | ||
1645 | }; | ||
1646 | static struct intel_watermark_params i830_wm_info = { | ||
1647 | I830_FIFO_SIZE, | ||
1648 | I915_MAX_WM, | ||
1649 | 1, | ||
1650 | 0, | ||
1651 | I830_FIFO_LINE_SIZE | ||
1652 | }; | ||
1653 | |||
1654 | static unsigned long intel_calculate_wm(unsigned long clock_in_khz, | ||
1655 | struct intel_watermark_params *wm, | ||
1656 | int pixel_size, | ||
1657 | unsigned long latency_ns) | ||
1658 | { | ||
1659 | unsigned long bytes_required, wm_size; | ||
1660 | |||
1661 | bytes_required = (clock_in_khz * pixel_size * latency_ns) / 1000000; | ||
1662 | bytes_required /= wm->cacheline_size; | ||
1663 | wm_size = wm->fifo_size - bytes_required - wm->guard_size; | ||
1664 | |||
1665 | if (wm_size > wm->max_wm) | ||
1666 | wm_size = wm->max_wm; | ||
1667 | if (wm_size == 0) | ||
1668 | wm_size = wm->default_wm; | ||
1669 | return wm_size; | ||
1670 | } | ||
1671 | |||
1672 | struct cxsr_latency { | ||
1673 | int is_desktop; | ||
1674 | unsigned long fsb_freq; | ||
1675 | unsigned long mem_freq; | ||
1676 | unsigned long display_sr; | ||
1677 | unsigned long display_hpll_disable; | ||
1678 | unsigned long cursor_sr; | ||
1679 | unsigned long cursor_hpll_disable; | ||
1680 | }; | ||
1681 | |||
1682 | static struct cxsr_latency cxsr_latency_table[] = { | ||
1683 | {1, 800, 400, 3382, 33382, 3983, 33983}, /* DDR2-400 SC */ | ||
1684 | {1, 800, 667, 3354, 33354, 3807, 33807}, /* DDR2-667 SC */ | ||
1685 | {1, 800, 800, 3347, 33347, 3763, 33763}, /* DDR2-800 SC */ | ||
1686 | |||
1687 | {1, 667, 400, 3400, 33400, 4021, 34021}, /* DDR2-400 SC */ | ||
1688 | {1, 667, 667, 3372, 33372, 3845, 33845}, /* DDR2-667 SC */ | ||
1689 | {1, 667, 800, 3386, 33386, 3822, 33822}, /* DDR2-800 SC */ | ||
1690 | |||
1691 | {1, 400, 400, 3472, 33472, 4173, 34173}, /* DDR2-400 SC */ | ||
1692 | {1, 400, 667, 3443, 33443, 3996, 33996}, /* DDR2-667 SC */ | ||
1693 | {1, 400, 800, 3430, 33430, 3946, 33946}, /* DDR2-800 SC */ | ||
1694 | |||
1695 | {0, 800, 400, 3438, 33438, 4065, 34065}, /* DDR2-400 SC */ | ||
1696 | {0, 800, 667, 3410, 33410, 3889, 33889}, /* DDR2-667 SC */ | ||
1697 | {0, 800, 800, 3403, 33403, 3845, 33845}, /* DDR2-800 SC */ | ||
1698 | |||
1699 | {0, 667, 400, 3456, 33456, 4103, 34106}, /* DDR2-400 SC */ | ||
1700 | {0, 667, 667, 3428, 33428, 3927, 33927}, /* DDR2-667 SC */ | ||
1701 | {0, 667, 800, 3443, 33443, 3905, 33905}, /* DDR2-800 SC */ | ||
1702 | |||
1703 | {0, 400, 400, 3528, 33528, 4255, 34255}, /* DDR2-400 SC */ | ||
1704 | {0, 400, 667, 3500, 33500, 4079, 34079}, /* DDR2-667 SC */ | ||
1705 | {0, 400, 800, 3487, 33487, 4029, 34029}, /* DDR2-800 SC */ | ||
1706 | }; | ||
1707 | |||
1708 | static struct cxsr_latency *intel_get_cxsr_latency(int is_desktop, int fsb, | ||
1709 | int mem) | ||
1710 | { | ||
1711 | int i; | ||
1712 | struct cxsr_latency *latency; | ||
1713 | |||
1714 | if (fsb == 0 || mem == 0) | ||
1715 | return NULL; | ||
1716 | |||
1717 | for (i = 0; i < ARRAY_SIZE(cxsr_latency_table); i++) { | ||
1718 | latency = &cxsr_latency_table[i]; | ||
1719 | if (is_desktop == latency->is_desktop && | ||
1720 | fsb == latency->fsb_freq && mem == latency->mem_freq) | ||
1721 | break; | ||
1722 | } | ||
1723 | if (i >= ARRAY_SIZE(cxsr_latency_table)) { | ||
1724 | DRM_DEBUG("Unknown FSB/MEM found, disable CxSR\n"); | ||
1725 | return NULL; | ||
1726 | } | ||
1727 | return latency; | ||
1728 | } | ||
1729 | |||
1730 | static void igd_disable_cxsr(struct drm_device *dev) | ||
1731 | { | ||
1732 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
1733 | u32 reg; | ||
1734 | |||
1735 | /* deactivate cxsr */ | ||
1736 | reg = I915_READ(DSPFW3); | ||
1737 | reg &= ~(IGD_SELF_REFRESH_EN); | ||
1738 | I915_WRITE(DSPFW3, reg); | ||
1739 | DRM_INFO("Big FIFO is disabled\n"); | ||
1740 | } | ||
1741 | |||
1742 | static void igd_enable_cxsr(struct drm_device *dev, unsigned long clock, | ||
1743 | int pixel_size) | ||
1744 | { | ||
1745 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
1746 | u32 reg; | ||
1747 | unsigned long wm; | ||
1748 | struct cxsr_latency *latency; | ||
1749 | |||
1750 | latency = intel_get_cxsr_latency(IS_IGDG(dev), dev_priv->fsb_freq, | ||
1751 | dev_priv->mem_freq); | ||
1752 | if (!latency) { | ||
1753 | DRM_DEBUG("Unknown FSB/MEM found, disable CxSR\n"); | ||
1754 | igd_disable_cxsr(dev); | ||
1755 | return; | ||
1756 | } | ||
1757 | |||
1758 | /* Display SR */ | ||
1759 | wm = intel_calculate_wm(clock, &igd_display_wm, pixel_size, | ||
1760 | latency->display_sr); | ||
1761 | reg = I915_READ(DSPFW1); | ||
1762 | reg &= 0x7fffff; | ||
1763 | reg |= wm << 23; | ||
1764 | I915_WRITE(DSPFW1, reg); | ||
1765 | DRM_DEBUG("DSPFW1 register is %x\n", reg); | ||
1766 | |||
1767 | /* cursor SR */ | ||
1768 | wm = intel_calculate_wm(clock, &igd_cursor_wm, pixel_size, | ||
1769 | latency->cursor_sr); | ||
1770 | reg = I915_READ(DSPFW3); | ||
1771 | reg &= ~(0x3f << 24); | ||
1772 | reg |= (wm & 0x3f) << 24; | ||
1773 | I915_WRITE(DSPFW3, reg); | ||
1774 | |||
1775 | /* Display HPLL off SR */ | ||
1776 | wm = intel_calculate_wm(clock, &igd_display_hplloff_wm, | ||
1777 | latency->display_hpll_disable, I915_FIFO_LINE_SIZE); | ||
1778 | reg = I915_READ(DSPFW3); | ||
1779 | reg &= 0xfffffe00; | ||
1780 | reg |= wm & 0x1ff; | ||
1781 | I915_WRITE(DSPFW3, reg); | ||
1782 | |||
1783 | /* cursor HPLL off SR */ | ||
1784 | wm = intel_calculate_wm(clock, &igd_cursor_hplloff_wm, pixel_size, | ||
1785 | latency->cursor_hpll_disable); | ||
1786 | reg = I915_READ(DSPFW3); | ||
1787 | reg &= ~(0x3f << 16); | ||
1788 | reg |= (wm & 0x3f) << 16; | ||
1789 | I915_WRITE(DSPFW3, reg); | ||
1790 | DRM_DEBUG("DSPFW3 register is %x\n", reg); | ||
1791 | |||
1792 | /* activate cxsr */ | ||
1793 | reg = I915_READ(DSPFW3); | ||
1794 | reg |= IGD_SELF_REFRESH_EN; | ||
1795 | I915_WRITE(DSPFW3, reg); | ||
1796 | |||
1797 | DRM_INFO("Big FIFO is enabled\n"); | ||
1798 | |||
1799 | return; | ||
1800 | } | ||
1801 | |||
1802 | const static int latency_ns = 5000; /* default for non-igd platforms */ | ||
1803 | |||
1804 | |||
1805 | static void i965_update_wm(struct drm_device *dev) | ||
1806 | { | ||
1807 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
1808 | |||
1809 | DRM_DEBUG("Setting FIFO watermarks - A: 8, B: 8, C: 8, SR 8\n"); | ||
1810 | |||
1811 | /* 965 has limitations... */ | ||
1812 | I915_WRITE(DSPFW1, (8 << 16) | (8 << 8) | (8 << 0)); | ||
1813 | I915_WRITE(DSPFW2, (8 << 8) | (8 << 0)); | ||
1814 | } | ||
1815 | |||
1816 | static void i9xx_update_wm(struct drm_device *dev, int planea_clock, | ||
1817 | int planeb_clock, int sr_hdisplay, int pixel_size) | ||
1818 | { | ||
1819 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
1820 | uint32_t fwater_lo = I915_READ(FW_BLC) & MM_FIFO_WATERMARK; | ||
1821 | uint32_t fwater_hi = I915_READ(FW_BLC2) & LM_FIFO_WATERMARK; | ||
1822 | int bsize, asize, cwm, bwm = 1, awm = 1, srwm = 1; | ||
1823 | uint32_t dsparb = I915_READ(DSPARB); | ||
1824 | int planea_entries, planeb_entries; | ||
1825 | struct intel_watermark_params *wm_params; | ||
1826 | unsigned long line_time_us; | ||
1827 | int sr_clock, sr_entries = 0; | ||
1828 | |||
1829 | if (IS_I965GM(dev) || IS_I945GM(dev)) | ||
1830 | wm_params = &i945_wm_info; | ||
1831 | else if (IS_I9XX(dev)) | ||
1832 | wm_params = &i915_wm_info; | ||
1833 | else | ||
1834 | wm_params = &i855_wm_info; | ||
1835 | |||
1836 | planea_entries = intel_calculate_wm(planea_clock, wm_params, | ||
1837 | pixel_size, latency_ns); | ||
1838 | planeb_entries = intel_calculate_wm(planeb_clock, wm_params, | ||
1839 | pixel_size, latency_ns); | ||
1840 | |||
1841 | DRM_DEBUG("FIFO entries - A: %d, B: %d\n", planea_entries, | ||
1842 | planeb_entries); | ||
1843 | |||
1844 | if (IS_I9XX(dev)) { | ||
1845 | asize = dsparb & 0x7f; | ||
1846 | bsize = (dsparb >> DSPARB_CSTART_SHIFT) & 0x7f; | ||
1847 | } else { | ||
1848 | asize = dsparb & 0x1ff; | ||
1849 | bsize = (dsparb >> DSPARB_BEND_SHIFT) & 0x1ff; | ||
1850 | } | ||
1851 | DRM_DEBUG("FIFO size - A: %d, B: %d\n", asize, bsize); | ||
1852 | |||
1853 | /* Two extra entries for padding */ | ||
1854 | awm = asize - (planea_entries + 2); | ||
1855 | bwm = bsize - (planeb_entries + 2); | ||
1856 | |||
1857 | /* Sanity check against potentially bad FIFO allocations */ | ||
1858 | if (awm <= 0) { | ||
1859 | /* pipe is on but has too few FIFO entries */ | ||
1860 | if (planea_entries != 0) | ||
1861 | DRM_DEBUG("plane A needs more FIFO entries\n"); | ||
1862 | awm = 1; | ||
1863 | } | ||
1864 | if (bwm <= 0) { | ||
1865 | if (planeb_entries != 0) | ||
1866 | DRM_DEBUG("plane B needs more FIFO entries\n"); | ||
1867 | bwm = 1; | ||
1868 | } | ||
1869 | |||
1870 | /* | ||
1871 | * Overlay gets an aggressive default since video jitter is bad. | ||
1872 | */ | ||
1873 | cwm = 2; | ||
1874 | |||
1875 | /* Calc sr entries for one pipe configs */ | ||
1876 | if (!planea_clock || !planeb_clock) { | ||
1877 | sr_clock = planea_clock ? planea_clock : planeb_clock; | ||
1878 | line_time_us = (sr_hdisplay * 1000) / sr_clock; | ||
1879 | sr_entries = (((latency_ns / line_time_us) + 1) * pixel_size * | ||
1880 | sr_hdisplay) / 1000; | ||
1881 | sr_entries = roundup(sr_entries / wm_params->cacheline_size, 1); | ||
1882 | if (sr_entries < wm_params->fifo_size) | ||
1883 | srwm = wm_params->fifo_size - sr_entries; | ||
1884 | } | ||
1885 | |||
1886 | DRM_DEBUG("Setting FIFO watermarks - A: %d, B: %d, C: %d, SR %d\n", | ||
1887 | awm, bwm, cwm, srwm); | ||
1888 | |||
1889 | fwater_lo = fwater_lo | ((bwm & 0x3f) << 16) | (awm & 0x3f); | ||
1890 | fwater_hi = fwater_hi | (cwm & 0x1f); | ||
1891 | |||
1892 | I915_WRITE(FW_BLC, fwater_lo); | ||
1893 | I915_WRITE(FW_BLC2, fwater_hi); | ||
1894 | if (IS_I9XX(dev)) | ||
1895 | I915_WRITE(FW_BLC_SELF, FW_BLC_SELF_EN | (srwm & 0x3f)); | ||
1896 | } | ||
1897 | |||
1898 | static void i830_update_wm(struct drm_device *dev, int planea_clock, | ||
1899 | int pixel_size) | ||
1900 | { | ||
1901 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
1902 | uint32_t dsparb = I915_READ(DSPARB); | ||
1903 | uint32_t fwater_lo = I915_READ(FW_BLC) & MM_FIFO_WATERMARK; | ||
1904 | unsigned int asize, awm; | ||
1905 | int planea_entries; | ||
1906 | |||
1907 | planea_entries = intel_calculate_wm(planea_clock, &i830_wm_info, | ||
1908 | pixel_size, latency_ns); | ||
1909 | |||
1910 | asize = dsparb & 0x7f; | ||
1911 | |||
1912 | awm = asize - planea_entries; | ||
1913 | |||
1914 | fwater_lo = fwater_lo | awm; | ||
1915 | |||
1916 | I915_WRITE(FW_BLC, fwater_lo); | ||
1917 | } | ||
1918 | |||
1919 | /** | ||
1920 | * intel_update_watermarks - update FIFO watermark values based on current modes | ||
1921 | * | ||
1922 | * Calculate watermark values for the various WM regs based on current mode | ||
1923 | * and plane configuration. | ||
1924 | * | ||
1925 | * There are several cases to deal with here: | ||
1926 | * - normal (i.e. non-self-refresh) | ||
1927 | * - self-refresh (SR) mode | ||
1928 | * - lines are large relative to FIFO size (buffer can hold up to 2) | ||
1929 | * - lines are small relative to FIFO size (buffer can hold more than 2 | ||
1930 | * lines), so need to account for TLB latency | ||
1931 | * | ||
1932 | * The normal calculation is: | ||
1933 | * watermark = dotclock * bytes per pixel * latency | ||
1934 | * where latency is platform & configuration dependent (we assume pessimal | ||
1935 | * values here). | ||
1936 | * | ||
1937 | * The SR calculation is: | ||
1938 | * watermark = (trunc(latency/line time)+1) * surface width * | ||
1939 | * bytes per pixel | ||
1940 | * where | ||
1941 | * line time = htotal / dotclock | ||
1942 | * and latency is assumed to be high, as above. | ||
1943 | * | ||
1944 | * The final value programmed to the register should always be rounded up, | ||
1945 | * and include an extra 2 entries to account for clock crossings. | ||
1946 | * | ||
1947 | * We don't use the sprite, so we can ignore that. And on Crestline we have | ||
1948 | * to set the non-SR watermarks to 8. | ||
1949 | */ | ||
1950 | static void intel_update_watermarks(struct drm_device *dev) | ||
1951 | { | ||
1952 | struct drm_crtc *crtc; | ||
1953 | struct intel_crtc *intel_crtc; | ||
1954 | int sr_hdisplay = 0; | ||
1955 | unsigned long planea_clock = 0, planeb_clock = 0, sr_clock = 0; | ||
1956 | int enabled = 0, pixel_size = 0; | ||
1957 | |||
1958 | if (DSPARB_HWCONTROL(dev)) | ||
1959 | return; | ||
1960 | |||
1961 | /* Get the clock config from both planes */ | ||
1962 | list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { | ||
1963 | intel_crtc = to_intel_crtc(crtc); | ||
1964 | if (crtc->enabled) { | ||
1965 | enabled++; | ||
1966 | if (intel_crtc->plane == 0) { | ||
1967 | DRM_DEBUG("plane A (pipe %d) clock: %d\n", | ||
1968 | intel_crtc->pipe, crtc->mode.clock); | ||
1969 | planea_clock = crtc->mode.clock; | ||
1970 | } else { | ||
1971 | DRM_DEBUG("plane B (pipe %d) clock: %d\n", | ||
1972 | intel_crtc->pipe, crtc->mode.clock); | ||
1973 | planeb_clock = crtc->mode.clock; | ||
1974 | } | ||
1975 | sr_hdisplay = crtc->mode.hdisplay; | ||
1976 | sr_clock = crtc->mode.clock; | ||
1977 | if (crtc->fb) | ||
1978 | pixel_size = crtc->fb->bits_per_pixel / 8; | ||
1979 | else | ||
1980 | pixel_size = 4; /* by default */ | ||
1981 | } | ||
1982 | } | ||
1983 | |||
1984 | if (enabled <= 0) | ||
1985 | return; | ||
1986 | |||
1987 | /* Single pipe configs can enable self refresh */ | ||
1988 | if (enabled == 1 && IS_IGD(dev)) | ||
1989 | igd_enable_cxsr(dev, sr_clock, pixel_size); | ||
1990 | else if (IS_IGD(dev)) | ||
1991 | igd_disable_cxsr(dev); | ||
1992 | |||
1993 | if (IS_I965G(dev)) | ||
1994 | i965_update_wm(dev); | ||
1995 | else if (IS_I9XX(dev) || IS_MOBILE(dev)) | ||
1996 | i9xx_update_wm(dev, planea_clock, planeb_clock, sr_hdisplay, | ||
1997 | pixel_size); | ||
1998 | else | ||
1999 | i830_update_wm(dev, planea_clock, pixel_size); | ||
2000 | } | ||
2001 | |||
1588 | static int intel_crtc_mode_set(struct drm_crtc *crtc, | 2002 | static int intel_crtc_mode_set(struct drm_crtc *crtc, |
1589 | struct drm_display_mode *mode, | 2003 | struct drm_display_mode *mode, |
1590 | struct drm_display_mode *adjusted_mode, | 2004 | struct drm_display_mode *adjusted_mode, |
@@ -1951,6 +2365,9 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, | |||
1951 | 2365 | ||
1952 | /* Flush the plane changes */ | 2366 | /* Flush the plane changes */ |
1953 | ret = intel_pipe_set_base(crtc, x, y, old_fb); | 2367 | ret = intel_pipe_set_base(crtc, x, y, old_fb); |
2368 | |||
2369 | intel_update_watermarks(dev); | ||
2370 | |||
1954 | drm_vblank_post_modeset(dev, pipe); | 2371 | drm_vblank_post_modeset(dev, pipe); |
1955 | 2372 | ||
1956 | return ret; | 2373 | return ret; |
@@ -2439,6 +2856,7 @@ static void intel_crtc_init(struct drm_device *dev, int pipe) | |||
2439 | 2856 | ||
2440 | drm_mode_crtc_set_gamma_size(&intel_crtc->base, 256); | 2857 | drm_mode_crtc_set_gamma_size(&intel_crtc->base, 256); |
2441 | intel_crtc->pipe = pipe; | 2858 | intel_crtc->pipe = pipe; |
2859 | intel_crtc->plane = pipe; | ||
2442 | for (i = 0; i < 256; i++) { | 2860 | for (i = 0; i < 256; i++) { |
2443 | intel_crtc->lut_r[i] = i; | 2861 | intel_crtc->lut_r[i] = i; |
2444 | intel_crtc->lut_g[i] = i; | 2862 | intel_crtc->lut_g[i] = i; |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 8f8d37d5663a..6770ae88370d 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -246,7 +246,7 @@ intel_dp_aux_ch(struct intel_output *intel_output, | |||
246 | } | 246 | } |
247 | 247 | ||
248 | if ((status & DP_AUX_CH_CTL_DONE) == 0) { | 248 | if ((status & DP_AUX_CH_CTL_DONE) == 0) { |
249 | printk(KERN_ERR "dp_aux_ch not done status 0x%08x\n", status); | 249 | DRM_ERROR("dp_aux_ch not done status 0x%08x\n", status); |
250 | return -EBUSY; | 250 | return -EBUSY; |
251 | } | 251 | } |
252 | 252 | ||
@@ -254,11 +254,14 @@ intel_dp_aux_ch(struct intel_output *intel_output, | |||
254 | * Timeouts occur when the sink is not connected | 254 | * Timeouts occur when the sink is not connected |
255 | */ | 255 | */ |
256 | if (status & DP_AUX_CH_CTL_RECEIVE_ERROR) { | 256 | if (status & DP_AUX_CH_CTL_RECEIVE_ERROR) { |
257 | printk(KERN_ERR "dp_aux_ch receive error status 0x%08x\n", status); | 257 | DRM_ERROR("dp_aux_ch receive error status 0x%08x\n", status); |
258 | return -EIO; | 258 | return -EIO; |
259 | } | 259 | } |
260 | |||
261 | /* Timeouts occur when the device isn't connected, so they're | ||
262 | * "normal" -- don't fill the kernel log with these */ | ||
260 | if (status & DP_AUX_CH_CTL_TIME_OUT_ERROR) { | 263 | if (status & DP_AUX_CH_CTL_TIME_OUT_ERROR) { |
261 | printk(KERN_ERR "dp_aux_ch timeout status 0x%08x\n", status); | 264 | DRM_DEBUG("dp_aux_ch timeout status 0x%08x\n", status); |
262 | return -ETIMEDOUT; | 265 | return -ETIMEDOUT; |
263 | } | 266 | } |
264 | 267 | ||
@@ -411,7 +414,7 @@ intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode, | |||
411 | dp_priv->link_bw = bws[clock]; | 414 | dp_priv->link_bw = bws[clock]; |
412 | dp_priv->lane_count = lane_count; | 415 | dp_priv->lane_count = lane_count; |
413 | adjusted_mode->clock = intel_dp_link_clock(dp_priv->link_bw); | 416 | adjusted_mode->clock = intel_dp_link_clock(dp_priv->link_bw); |
414 | printk(KERN_ERR "link bw %02x lane count %d clock %d\n", | 417 | DRM_DEBUG("Display port link bw %02x lane count %d clock %d\n", |
415 | dp_priv->link_bw, dp_priv->lane_count, | 418 | dp_priv->link_bw, dp_priv->lane_count, |
416 | adjusted_mode->clock); | 419 | adjusted_mode->clock); |
417 | return true; | 420 | return true; |
diff --git a/drivers/gpu/drm/i915/intel_dp_i2c.c b/drivers/gpu/drm/i915/intel_dp_i2c.c index 4e60f14b1a6d..a63b6f57d2d4 100644 --- a/drivers/gpu/drm/i915/intel_dp_i2c.c +++ b/drivers/gpu/drm/i915/intel_dp_i2c.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/sched.h> | 29 | #include <linux/sched.h> |
30 | #include <linux/i2c.h> | 30 | #include <linux/i2c.h> |
31 | #include "intel_dp.h" | 31 | #include "intel_dp.h" |
32 | #include "drmP.h" | ||
32 | 33 | ||
33 | /* Run a single AUX_CH I2C transaction, writing/reading data as necessary */ | 34 | /* Run a single AUX_CH I2C transaction, writing/reading data as necessary */ |
34 | 35 | ||
@@ -84,7 +85,7 @@ i2c_algo_dp_aux_transaction(struct i2c_adapter *adapter, int mode, | |||
84 | msg, msg_bytes, | 85 | msg, msg_bytes, |
85 | reply, reply_bytes); | 86 | reply, reply_bytes); |
86 | if (ret < 0) { | 87 | if (ret < 0) { |
87 | printk(KERN_ERR "aux_ch failed %d\n", ret); | 88 | DRM_DEBUG("aux_ch failed %d\n", ret); |
88 | return ret; | 89 | return ret; |
89 | } | 90 | } |
90 | switch (reply[0] & AUX_I2C_REPLY_MASK) { | 91 | switch (reply[0] & AUX_I2C_REPLY_MASK) { |
@@ -94,14 +95,14 @@ i2c_algo_dp_aux_transaction(struct i2c_adapter *adapter, int mode, | |||
94 | } | 95 | } |
95 | return reply_bytes - 1; | 96 | return reply_bytes - 1; |
96 | case AUX_I2C_REPLY_NACK: | 97 | case AUX_I2C_REPLY_NACK: |
97 | printk(KERN_ERR "aux_ch nack\n"); | 98 | DRM_DEBUG("aux_ch nack\n"); |
98 | return -EREMOTEIO; | 99 | return -EREMOTEIO; |
99 | case AUX_I2C_REPLY_DEFER: | 100 | case AUX_I2C_REPLY_DEFER: |
100 | printk(KERN_ERR "aux_ch defer\n"); | 101 | DRM_DEBUG("aux_ch defer\n"); |
101 | udelay(100); | 102 | udelay(100); |
102 | break; | 103 | break; |
103 | default: | 104 | default: |
104 | printk(KERN_ERR "aux_ch invalid reply 0x%02x\n", reply[0]); | 105 | DRM_ERROR("aux_ch invalid reply 0x%02x\n", reply[0]); |
105 | return -EREMOTEIO; | 106 | return -EREMOTEIO; |
106 | } | 107 | } |
107 | } | 108 | } |
@@ -223,7 +224,7 @@ i2c_algo_dp_aux_xfer(struct i2c_adapter *adapter, | |||
223 | if (ret >= 0) | 224 | if (ret >= 0) |
224 | ret = num; | 225 | ret = num; |
225 | i2c_algo_dp_aux_stop(adapter, reading); | 226 | i2c_algo_dp_aux_stop(adapter, reading); |
226 | printk(KERN_ERR "dp_aux_xfer return %d\n", ret); | 227 | DRM_DEBUG("dp_aux_xfer return %d\n", ret); |
227 | return ret; | 228 | return ret; |
228 | } | 229 | } |
229 | 230 | ||
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c index 1af7d68e3807..1d30802e773e 100644 --- a/drivers/gpu/drm/i915/intel_fb.c +++ b/drivers/gpu/drm/i915/intel_fb.c | |||
@@ -453,7 +453,7 @@ static int intelfb_create(struct drm_device *dev, uint32_t fb_width, | |||
453 | size = ALIGN(size, PAGE_SIZE); | 453 | size = ALIGN(size, PAGE_SIZE); |
454 | fbo = drm_gem_object_alloc(dev, size); | 454 | fbo = drm_gem_object_alloc(dev, size); |
455 | if (!fbo) { | 455 | if (!fbo) { |
456 | printk(KERN_ERR "failed to allocate framebuffer\n"); | 456 | DRM_ERROR("failed to allocate framebuffer\n"); |
457 | ret = -ENOMEM; | 457 | ret = -ENOMEM; |
458 | goto out; | 458 | goto out; |
459 | } | 459 | } |
@@ -610,8 +610,8 @@ static int intelfb_create(struct drm_device *dev, uint32_t fb_width, | |||
610 | par->dev = dev; | 610 | par->dev = dev; |
611 | 611 | ||
612 | /* To allow resizeing without swapping buffers */ | 612 | /* To allow resizeing without swapping buffers */ |
613 | printk("allocated %dx%d fb: 0x%08x, bo %p\n", intel_fb->base.width, | 613 | DRM_DEBUG("allocated %dx%d fb: 0x%08x, bo %p\n", intel_fb->base.width, |
614 | intel_fb->base.height, obj_priv->gtt_offset, fbo); | 614 | intel_fb->base.height, obj_priv->gtt_offset, fbo); |
615 | 615 | ||
616 | mutex_unlock(&dev->struct_mutex); | 616 | mutex_unlock(&dev->struct_mutex); |
617 | return 0; | 617 | return 0; |
@@ -698,13 +698,13 @@ static int intelfb_multi_fb_probe_crtc(struct drm_device *dev, struct drm_crtc * | |||
698 | } else | 698 | } else |
699 | intelfb_set_par(info); | 699 | intelfb_set_par(info); |
700 | 700 | ||
701 | printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, | 701 | DRM_INFO("fb%d: %s frame buffer device\n", info->node, |
702 | info->fix.id); | 702 | info->fix.id); |
703 | 703 | ||
704 | /* Switch back to kernel console on panic */ | 704 | /* Switch back to kernel console on panic */ |
705 | kernelfb_mode = *modeset; | 705 | kernelfb_mode = *modeset; |
706 | atomic_notifier_chain_register(&panic_notifier_list, &paniced); | 706 | atomic_notifier_chain_register(&panic_notifier_list, &paniced); |
707 | printk(KERN_INFO "registered panic notifier\n"); | 707 | DRM_DEBUG("registered panic notifier\n"); |
708 | 708 | ||
709 | return 0; | 709 | return 0; |
710 | } | 710 | } |
@@ -852,13 +852,13 @@ static int intelfb_single_fb_probe(struct drm_device *dev) | |||
852 | } else | 852 | } else |
853 | intelfb_set_par(info); | 853 | intelfb_set_par(info); |
854 | 854 | ||
855 | printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, | 855 | DRM_INFO("fb%d: %s frame buffer device\n", info->node, |
856 | info->fix.id); | 856 | info->fix.id); |
857 | 857 | ||
858 | /* Switch back to kernel console on panic */ | 858 | /* Switch back to kernel console on panic */ |
859 | kernelfb_mode = *modeset; | 859 | kernelfb_mode = *modeset; |
860 | atomic_notifier_chain_register(&panic_notifier_list, &paniced); | 860 | atomic_notifier_chain_register(&panic_notifier_list, &paniced); |
861 | printk(KERN_INFO "registered panic notifier\n"); | 861 | DRM_DEBUG("registered panic notifier\n"); |
862 | 862 | ||
863 | return 0; | 863 | return 0; |
864 | } | 864 | } |
@@ -872,8 +872,8 @@ void intelfb_restore(void) | |||
872 | { | 872 | { |
873 | int ret; | 873 | int ret; |
874 | if ((ret = drm_crtc_helper_set_config(&kernelfb_mode)) != 0) { | 874 | if ((ret = drm_crtc_helper_set_config(&kernelfb_mode)) != 0) { |
875 | printk(KERN_ERR "Failed to restore crtc configuration: %d\n", | 875 | DRM_ERROR("Failed to restore crtc configuration: %d\n", |
876 | ret); | 876 | ret); |
877 | } | 877 | } |
878 | } | 878 | } |
879 | 879 | ||
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 9564ca44a977..9ab38efffecf 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include "intel_drv.h" | 36 | #include "intel_drv.h" |
37 | #include "i915_drm.h" | 37 | #include "i915_drm.h" |
38 | #include "i915_drv.h" | 38 | #include "i915_drv.h" |
39 | #include <linux/acpi.h> | ||
39 | 40 | ||
40 | #define I915_LVDS "i915_lvds" | 41 | #define I915_LVDS "i915_lvds" |
41 | 42 | ||
@@ -252,14 +253,14 @@ static bool intel_lvds_mode_fixup(struct drm_encoder *encoder, | |||
252 | 253 | ||
253 | /* Should never happen!! */ | 254 | /* Should never happen!! */ |
254 | if (!IS_I965G(dev) && intel_crtc->pipe == 0) { | 255 | if (!IS_I965G(dev) && intel_crtc->pipe == 0) { |
255 | printk(KERN_ERR "Can't support LVDS on pipe A\n"); | 256 | DRM_ERROR("Can't support LVDS on pipe A\n"); |
256 | return false; | 257 | return false; |
257 | } | 258 | } |
258 | 259 | ||
259 | /* Should never happen!! */ | 260 | /* Should never happen!! */ |
260 | list_for_each_entry(tmp_encoder, &dev->mode_config.encoder_list, head) { | 261 | list_for_each_entry(tmp_encoder, &dev->mode_config.encoder_list, head) { |
261 | if (tmp_encoder != encoder && tmp_encoder->crtc == encoder->crtc) { | 262 | if (tmp_encoder != encoder && tmp_encoder->crtc == encoder->crtc) { |
262 | printk(KERN_ERR "Can't enable LVDS and another " | 263 | DRM_ERROR("Can't enable LVDS and another " |
263 | "encoder on the same pipe\n"); | 264 | "encoder on the same pipe\n"); |
264 | return false; | 265 | return false; |
265 | } | 266 | } |
@@ -788,6 +789,65 @@ static const struct dmi_system_id intel_no_lvds[] = { | |||
788 | { } /* terminating entry */ | 789 | { } /* terminating entry */ |
789 | }; | 790 | }; |
790 | 791 | ||
792 | #ifdef CONFIG_ACPI | ||
793 | /* | ||
794 | * check_lid_device -- check whether @handle is an ACPI LID device. | ||
795 | * @handle: ACPI device handle | ||
796 | * @level : depth in the ACPI namespace tree | ||
797 | * @context: the number of LID device when we find the device | ||
798 | * @rv: a return value to fill if desired (Not use) | ||
799 | */ | ||
800 | static acpi_status | ||
801 | check_lid_device(acpi_handle handle, u32 level, void *context, | ||
802 | void **return_value) | ||
803 | { | ||
804 | struct acpi_device *acpi_dev; | ||
805 | int *lid_present = context; | ||
806 | |||
807 | acpi_dev = NULL; | ||
808 | /* Get the acpi device for device handle */ | ||
809 | if (acpi_bus_get_device(handle, &acpi_dev) || !acpi_dev) { | ||
810 | /* If there is no ACPI device for handle, return */ | ||
811 | return AE_OK; | ||
812 | } | ||
813 | |||
814 | if (!strncmp(acpi_device_hid(acpi_dev), "PNP0C0D", 7)) | ||
815 | *lid_present = 1; | ||
816 | |||
817 | return AE_OK; | ||
818 | } | ||
819 | |||
820 | /** | ||
821 | * check whether there exists the ACPI LID device by enumerating the ACPI | ||
822 | * device tree. | ||
823 | */ | ||
824 | static int intel_lid_present(void) | ||
825 | { | ||
826 | int lid_present = 0; | ||
827 | |||
828 | if (acpi_disabled) { | ||
829 | /* If ACPI is disabled, there is no ACPI device tree to | ||
830 | * check, so assume the LID device would have been present. | ||
831 | */ | ||
832 | return 1; | ||
833 | } | ||
834 | |||
835 | acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, | ||
836 | ACPI_UINT32_MAX, | ||
837 | check_lid_device, &lid_present, NULL); | ||
838 | |||
839 | return lid_present; | ||
840 | } | ||
841 | #else | ||
842 | static int intel_lid_present(void) | ||
843 | { | ||
844 | /* In the absence of ACPI built in, assume that the LID device would | ||
845 | * have been present. | ||
846 | */ | ||
847 | return 1; | ||
848 | } | ||
849 | #endif | ||
850 | |||
791 | /** | 851 | /** |
792 | * intel_lvds_init - setup LVDS connectors on this device | 852 | * intel_lvds_init - setup LVDS connectors on this device |
793 | * @dev: drm device | 853 | * @dev: drm device |
@@ -811,6 +871,16 @@ void intel_lvds_init(struct drm_device *dev) | |||
811 | if (dmi_check_system(intel_no_lvds)) | 871 | if (dmi_check_system(intel_no_lvds)) |
812 | return; | 872 | return; |
813 | 873 | ||
874 | /* Assume that any device without an ACPI LID device also doesn't | ||
875 | * have an integrated LVDS. We would be better off parsing the BIOS | ||
876 | * to get a reliable indicator, but that code isn't written yet. | ||
877 | * | ||
878 | * In the case of all-in-one desktops using LVDS that we've seen, | ||
879 | * they're using SDVO LVDS. | ||
880 | */ | ||
881 | if (!intel_lid_present()) | ||
882 | return; | ||
883 | |||
814 | if (IS_IGDNG(dev)) { | 884 | if (IS_IGDNG(dev)) { |
815 | if ((I915_READ(PCH_LVDS) & LVDS_DETECTED) == 0) | 885 | if ((I915_READ(PCH_LVDS) & LVDS_DETECTED) == 0) |
816 | return; | 886 | return; |
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index f03473779feb..4f0c30948bc4 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -68,12 +68,23 @@ struct intel_sdvo_priv { | |||
68 | * This is set if we treat the device as HDMI, instead of DVI. | 68 | * This is set if we treat the device as HDMI, instead of DVI. |
69 | */ | 69 | */ |
70 | bool is_hdmi; | 70 | bool is_hdmi; |
71 | |||
71 | /** | 72 | /** |
72 | * This is set if we detect output of sdvo device as LVDS. | 73 | * This is set if we detect output of sdvo device as LVDS. |
73 | */ | 74 | */ |
74 | bool is_lvds; | 75 | bool is_lvds; |
75 | 76 | ||
76 | /** | 77 | /** |
78 | * This is sdvo flags for input timing. | ||
79 | */ | ||
80 | uint8_t sdvo_flags; | ||
81 | |||
82 | /** | ||
83 | * This is sdvo fixed pannel mode pointer | ||
84 | */ | ||
85 | struct drm_display_mode *sdvo_lvds_fixed_mode; | ||
86 | |||
87 | /** | ||
77 | * Returned SDTV resolutions allowed for the current format, if the | 88 | * Returned SDTV resolutions allowed for the current format, if the |
78 | * device reported it. | 89 | * device reported it. |
79 | */ | 90 | */ |
@@ -592,6 +603,7 @@ intel_sdvo_create_preferred_input_timing(struct intel_output *output, | |||
592 | uint16_t height) | 603 | uint16_t height) |
593 | { | 604 | { |
594 | struct intel_sdvo_preferred_input_timing_args args; | 605 | struct intel_sdvo_preferred_input_timing_args args; |
606 | struct intel_sdvo_priv *sdvo_priv = output->dev_priv; | ||
595 | uint8_t status; | 607 | uint8_t status; |
596 | 608 | ||
597 | memset(&args, 0, sizeof(args)); | 609 | memset(&args, 0, sizeof(args)); |
@@ -599,7 +611,12 @@ intel_sdvo_create_preferred_input_timing(struct intel_output *output, | |||
599 | args.width = width; | 611 | args.width = width; |
600 | args.height = height; | 612 | args.height = height; |
601 | args.interlace = 0; | 613 | args.interlace = 0; |
602 | args.scaled = 0; | 614 | |
615 | if (sdvo_priv->is_lvds && | ||
616 | (sdvo_priv->sdvo_lvds_fixed_mode->hdisplay != width || | ||
617 | sdvo_priv->sdvo_lvds_fixed_mode->vdisplay != height)) | ||
618 | args.scaled = 1; | ||
619 | |||
603 | intel_sdvo_write_cmd(output, SDVO_CMD_CREATE_PREFERRED_INPUT_TIMING, | 620 | intel_sdvo_write_cmd(output, SDVO_CMD_CREATE_PREFERRED_INPUT_TIMING, |
604 | &args, sizeof(args)); | 621 | &args, sizeof(args)); |
605 | status = intel_sdvo_read_response(output, NULL, 0); | 622 | status = intel_sdvo_read_response(output, NULL, 0); |
@@ -944,12 +961,7 @@ static bool intel_sdvo_mode_fixup(struct drm_encoder *encoder, | |||
944 | struct intel_output *output = enc_to_intel_output(encoder); | 961 | struct intel_output *output = enc_to_intel_output(encoder); |
945 | struct intel_sdvo_priv *dev_priv = output->dev_priv; | 962 | struct intel_sdvo_priv *dev_priv = output->dev_priv; |
946 | 963 | ||
947 | if (!dev_priv->is_tv) { | 964 | if (dev_priv->is_tv) { |
948 | /* Make the CRTC code factor in the SDVO pixel multiplier. The | ||
949 | * SDVO device will be told of the multiplier during mode_set. | ||
950 | */ | ||
951 | adjusted_mode->clock *= intel_sdvo_get_pixel_multiplier(mode); | ||
952 | } else { | ||
953 | struct intel_sdvo_dtd output_dtd; | 965 | struct intel_sdvo_dtd output_dtd; |
954 | bool success; | 966 | bool success; |
955 | 967 | ||
@@ -980,6 +992,47 @@ static bool intel_sdvo_mode_fixup(struct drm_encoder *encoder, | |||
980 | intel_sdvo_get_preferred_input_timing(output, | 992 | intel_sdvo_get_preferred_input_timing(output, |
981 | &input_dtd); | 993 | &input_dtd); |
982 | intel_sdvo_get_mode_from_dtd(adjusted_mode, &input_dtd); | 994 | intel_sdvo_get_mode_from_dtd(adjusted_mode, &input_dtd); |
995 | dev_priv->sdvo_flags = input_dtd.part2.sdvo_flags; | ||
996 | |||
997 | drm_mode_set_crtcinfo(adjusted_mode, 0); | ||
998 | |||
999 | mode->clock = adjusted_mode->clock; | ||
1000 | |||
1001 | adjusted_mode->clock *= | ||
1002 | intel_sdvo_get_pixel_multiplier(mode); | ||
1003 | } else { | ||
1004 | return false; | ||
1005 | } | ||
1006 | } else if (dev_priv->is_lvds) { | ||
1007 | struct intel_sdvo_dtd output_dtd; | ||
1008 | bool success; | ||
1009 | |||
1010 | drm_mode_set_crtcinfo(dev_priv->sdvo_lvds_fixed_mode, 0); | ||
1011 | /* Set output timings */ | ||
1012 | intel_sdvo_get_dtd_from_mode(&output_dtd, | ||
1013 | dev_priv->sdvo_lvds_fixed_mode); | ||
1014 | |||
1015 | intel_sdvo_set_target_output(output, | ||
1016 | dev_priv->controlled_output); | ||
1017 | intel_sdvo_set_output_timing(output, &output_dtd); | ||
1018 | |||
1019 | /* Set the input timing to the screen. Assume always input 0. */ | ||
1020 | intel_sdvo_set_target_input(output, true, false); | ||
1021 | |||
1022 | |||
1023 | success = intel_sdvo_create_preferred_input_timing( | ||
1024 | output, | ||
1025 | mode->clock / 10, | ||
1026 | mode->hdisplay, | ||
1027 | mode->vdisplay); | ||
1028 | |||
1029 | if (success) { | ||
1030 | struct intel_sdvo_dtd input_dtd; | ||
1031 | |||
1032 | intel_sdvo_get_preferred_input_timing(output, | ||
1033 | &input_dtd); | ||
1034 | intel_sdvo_get_mode_from_dtd(adjusted_mode, &input_dtd); | ||
1035 | dev_priv->sdvo_flags = input_dtd.part2.sdvo_flags; | ||
983 | 1036 | ||
984 | drm_mode_set_crtcinfo(adjusted_mode, 0); | 1037 | drm_mode_set_crtcinfo(adjusted_mode, 0); |
985 | 1038 | ||
@@ -990,6 +1043,12 @@ static bool intel_sdvo_mode_fixup(struct drm_encoder *encoder, | |||
990 | } else { | 1043 | } else { |
991 | return false; | 1044 | return false; |
992 | } | 1045 | } |
1046 | |||
1047 | } else { | ||
1048 | /* Make the CRTC code factor in the SDVO pixel multiplier. The | ||
1049 | * SDVO device will be told of the multiplier during mode_set. | ||
1050 | */ | ||
1051 | adjusted_mode->clock *= intel_sdvo_get_pixel_multiplier(mode); | ||
993 | } | 1052 | } |
994 | return true; | 1053 | return true; |
995 | } | 1054 | } |
@@ -1033,15 +1092,16 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, | |||
1033 | 1092 | ||
1034 | /* We have tried to get input timing in mode_fixup, and filled into | 1093 | /* We have tried to get input timing in mode_fixup, and filled into |
1035 | adjusted_mode */ | 1094 | adjusted_mode */ |
1036 | if (sdvo_priv->is_tv) | 1095 | if (sdvo_priv->is_tv || sdvo_priv->is_lvds) { |
1037 | intel_sdvo_get_dtd_from_mode(&input_dtd, adjusted_mode); | 1096 | intel_sdvo_get_dtd_from_mode(&input_dtd, adjusted_mode); |
1038 | else | 1097 | input_dtd.part2.sdvo_flags = sdvo_priv->sdvo_flags; |
1098 | } else | ||
1039 | intel_sdvo_get_dtd_from_mode(&input_dtd, mode); | 1099 | intel_sdvo_get_dtd_from_mode(&input_dtd, mode); |
1040 | 1100 | ||
1041 | /* If it's a TV, we already set the output timing in mode_fixup. | 1101 | /* If it's a TV, we already set the output timing in mode_fixup. |
1042 | * Otherwise, the output timing is equal to the input timing. | 1102 | * Otherwise, the output timing is equal to the input timing. |
1043 | */ | 1103 | */ |
1044 | if (!sdvo_priv->is_tv) { | 1104 | if (!sdvo_priv->is_tv && !sdvo_priv->is_lvds) { |
1045 | /* Set the output timing to the screen */ | 1105 | /* Set the output timing to the screen */ |
1046 | intel_sdvo_set_target_output(output, | 1106 | intel_sdvo_set_target_output(output, |
1047 | sdvo_priv->controlled_output); | 1107 | sdvo_priv->controlled_output); |
@@ -1116,6 +1176,8 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder, | |||
1116 | sdvox |= (sdvo_pixel_multiply - 1) << SDVO_PORT_MULTIPLY_SHIFT; | 1176 | sdvox |= (sdvo_pixel_multiply - 1) << SDVO_PORT_MULTIPLY_SHIFT; |
1117 | } | 1177 | } |
1118 | 1178 | ||
1179 | if (sdvo_priv->sdvo_flags & SDVO_NEED_TO_STALL) | ||
1180 | sdvox |= SDVO_STALL_SELECT; | ||
1119 | intel_sdvo_write_sdvox(output, sdvox); | 1181 | intel_sdvo_write_sdvox(output, sdvox); |
1120 | } | 1182 | } |
1121 | 1183 | ||
@@ -1276,6 +1338,17 @@ static int intel_sdvo_mode_valid(struct drm_connector *connector, | |||
1276 | if (sdvo_priv->pixel_clock_max < mode->clock) | 1338 | if (sdvo_priv->pixel_clock_max < mode->clock) |
1277 | return MODE_CLOCK_HIGH; | 1339 | return MODE_CLOCK_HIGH; |
1278 | 1340 | ||
1341 | if (sdvo_priv->is_lvds == true) { | ||
1342 | if (sdvo_priv->sdvo_lvds_fixed_mode == NULL) | ||
1343 | return MODE_PANEL; | ||
1344 | |||
1345 | if (mode->hdisplay > sdvo_priv->sdvo_lvds_fixed_mode->hdisplay) | ||
1346 | return MODE_PANEL; | ||
1347 | |||
1348 | if (mode->vdisplay > sdvo_priv->sdvo_lvds_fixed_mode->vdisplay) | ||
1349 | return MODE_PANEL; | ||
1350 | } | ||
1351 | |||
1279 | return MODE_OK; | 1352 | return MODE_OK; |
1280 | } | 1353 | } |
1281 | 1354 | ||
@@ -1549,6 +1622,8 @@ static void intel_sdvo_get_lvds_modes(struct drm_connector *connector) | |||
1549 | { | 1622 | { |
1550 | struct intel_output *intel_output = to_intel_output(connector); | 1623 | struct intel_output *intel_output = to_intel_output(connector); |
1551 | struct drm_i915_private *dev_priv = connector->dev->dev_private; | 1624 | struct drm_i915_private *dev_priv = connector->dev->dev_private; |
1625 | struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; | ||
1626 | struct drm_display_mode *newmode; | ||
1552 | 1627 | ||
1553 | /* | 1628 | /* |
1554 | * Attempt to get the mode list from DDC. | 1629 | * Attempt to get the mode list from DDC. |
@@ -1557,11 +1632,10 @@ static void intel_sdvo_get_lvds_modes(struct drm_connector *connector) | |||
1557 | */ | 1632 | */ |
1558 | intel_ddc_get_modes(intel_output); | 1633 | intel_ddc_get_modes(intel_output); |
1559 | if (list_empty(&connector->probed_modes) == false) | 1634 | if (list_empty(&connector->probed_modes) == false) |
1560 | return; | 1635 | goto end; |
1561 | 1636 | ||
1562 | /* Fetch modes from VBT */ | 1637 | /* Fetch modes from VBT */ |
1563 | if (dev_priv->sdvo_lvds_vbt_mode != NULL) { | 1638 | if (dev_priv->sdvo_lvds_vbt_mode != NULL) { |
1564 | struct drm_display_mode *newmode; | ||
1565 | newmode = drm_mode_duplicate(connector->dev, | 1639 | newmode = drm_mode_duplicate(connector->dev, |
1566 | dev_priv->sdvo_lvds_vbt_mode); | 1640 | dev_priv->sdvo_lvds_vbt_mode); |
1567 | if (newmode != NULL) { | 1641 | if (newmode != NULL) { |
@@ -1571,6 +1645,16 @@ static void intel_sdvo_get_lvds_modes(struct drm_connector *connector) | |||
1571 | drm_mode_probed_add(connector, newmode); | 1645 | drm_mode_probed_add(connector, newmode); |
1572 | } | 1646 | } |
1573 | } | 1647 | } |
1648 | |||
1649 | end: | ||
1650 | list_for_each_entry(newmode, &connector->probed_modes, head) { | ||
1651 | if (newmode->type & DRM_MODE_TYPE_PREFERRED) { | ||
1652 | sdvo_priv->sdvo_lvds_fixed_mode = | ||
1653 | drm_mode_duplicate(connector->dev, newmode); | ||
1654 | break; | ||
1655 | } | ||
1656 | } | ||
1657 | |||
1574 | } | 1658 | } |
1575 | 1659 | ||
1576 | static int intel_sdvo_get_modes(struct drm_connector *connector) | 1660 | static int intel_sdvo_get_modes(struct drm_connector *connector) |
@@ -1593,14 +1677,20 @@ static int intel_sdvo_get_modes(struct drm_connector *connector) | |||
1593 | static void intel_sdvo_destroy(struct drm_connector *connector) | 1677 | static void intel_sdvo_destroy(struct drm_connector *connector) |
1594 | { | 1678 | { |
1595 | struct intel_output *intel_output = to_intel_output(connector); | 1679 | struct intel_output *intel_output = to_intel_output(connector); |
1680 | struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; | ||
1596 | 1681 | ||
1597 | if (intel_output->i2c_bus) | 1682 | if (intel_output->i2c_bus) |
1598 | intel_i2c_destroy(intel_output->i2c_bus); | 1683 | intel_i2c_destroy(intel_output->i2c_bus); |
1599 | if (intel_output->ddc_bus) | 1684 | if (intel_output->ddc_bus) |
1600 | intel_i2c_destroy(intel_output->ddc_bus); | 1685 | intel_i2c_destroy(intel_output->ddc_bus); |
1601 | 1686 | ||
1687 | if (sdvo_priv->sdvo_lvds_fixed_mode != NULL) | ||
1688 | drm_mode_destroy(connector->dev, | ||
1689 | sdvo_priv->sdvo_lvds_fixed_mode); | ||
1690 | |||
1602 | drm_sysfs_connector_remove(connector); | 1691 | drm_sysfs_connector_remove(connector); |
1603 | drm_connector_cleanup(connector); | 1692 | drm_connector_cleanup(connector); |
1693 | |||
1604 | kfree(intel_output); | 1694 | kfree(intel_output); |
1605 | } | 1695 | } |
1606 | 1696 | ||
diff --git a/drivers/gpu/drm/i915/intel_sdvo_regs.h b/drivers/gpu/drm/i915/intel_sdvo_regs.h index 193938b7d7f9..ba5cdf8ae40b 100644 --- a/drivers/gpu/drm/i915/intel_sdvo_regs.h +++ b/drivers/gpu/drm/i915/intel_sdvo_regs.h | |||
@@ -715,6 +715,7 @@ struct intel_sdvo_enhancements_arg { | |||
715 | #define SDVO_HBUF_TX_ONCE (2 << 6) | 715 | #define SDVO_HBUF_TX_ONCE (2 << 6) |
716 | #define SDVO_HBUF_TX_VSYNC (3 << 6) | 716 | #define SDVO_HBUF_TX_VSYNC (3 << 6) |
717 | #define SDVO_CMD_GET_AUDIO_TX_INFO 0x9c | 717 | #define SDVO_CMD_GET_AUDIO_TX_INFO 0x9c |
718 | #define SDVO_NEED_TO_STALL (1 << 7) | ||
718 | 719 | ||
719 | struct intel_sdvo_encode{ | 720 | struct intel_sdvo_encode{ |
720 | u8 dvi_rev; | 721 | u8 dvi_rev; |
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index 76c4bbe9dccb..3c1fcb7640ab 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/list.h> | 22 | #include <linux/list.h> |
23 | #include <linux/mm.h> | 23 | #include <linux/mm.h> |
24 | #include <linux/mutex.h> | 24 | #include <linux/mutex.h> |
25 | #include <linux/smp_lock.h> | ||
26 | #include <linux/spinlock.h> | 25 | #include <linux/spinlock.h> |
27 | #include <asm/unaligned.h> | 26 | #include <asm/unaligned.h> |
28 | #include <asm/byteorder.h> | 27 | #include <asm/byteorder.h> |
diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c index ad2b3431b725..7d3f15d32fdf 100644 --- a/drivers/hwmon/abituguru3.c +++ b/drivers/hwmon/abituguru3.c | |||
@@ -357,7 +357,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
357 | { "AUX5 Fan", 39, 2, 60, 1, 0 }, | 357 | { "AUX5 Fan", 39, 2, 60, 1, 0 }, |
358 | { NULL, 0, 0, 0, 0, 0 } } | 358 | { NULL, 0, 0, 0, 0, 0 } } |
359 | }, | 359 | }, |
360 | { 0x0014, NULL /* Abit AB9 Pro, need DMI string */, { | 360 | { 0x0014, "AB9", /* + AB9 Pro */ { |
361 | { "CPU Core", 0, 0, 10, 1, 0 }, | 361 | { "CPU Core", 0, 0, 10, 1, 0 }, |
362 | { "DDR", 1, 0, 10, 1, 0 }, | 362 | { "DDR", 1, 0, 10, 1, 0 }, |
363 | { "DDR VTT", 2, 0, 10, 1, 0 }, | 363 | { "DDR VTT", 2, 0, 10, 1, 0 }, |
@@ -455,7 +455,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
455 | { "AUX3 FAN", 37, 2, 60, 1, 0 }, | 455 | { "AUX3 FAN", 37, 2, 60, 1, 0 }, |
456 | { NULL, 0, 0, 0, 0, 0 } } | 456 | { NULL, 0, 0, 0, 0, 0 } } |
457 | }, | 457 | }, |
458 | { 0x0018, NULL /* Unknown, need DMI string */, { | 458 | { 0x0018, "AB9 QuadGT", { |
459 | { "CPU Core", 0, 0, 10, 1, 0 }, | 459 | { "CPU Core", 0, 0, 10, 1, 0 }, |
460 | { "DDR2", 1, 0, 20, 1, 0 }, | 460 | { "DDR2", 1, 0, 20, 1, 0 }, |
461 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, | 461 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, |
@@ -564,7 +564,7 @@ static const struct abituguru3_motherboard_info abituguru3_motherboards[] = { | |||
564 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, | 564 | { "AUX3 Fan", 36, 2, 60, 1, 0 }, |
565 | { NULL, 0, 0, 0, 0, 0 } } | 565 | { NULL, 0, 0, 0, 0, 0 } } |
566 | }, | 566 | }, |
567 | { 0x001C, NULL /* Unknown, need DMI string */, { | 567 | { 0x001C, "IX38 QuadGT", { |
568 | { "CPU Core", 0, 0, 10, 1, 0 }, | 568 | { "CPU Core", 0, 0, 10, 1, 0 }, |
569 | { "DDR2", 1, 0, 20, 1, 0 }, | 569 | { "DDR2", 1, 0, 20, 1, 0 }, |
570 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, | 570 | { "DDR2 VTT", 2, 0, 10, 1, 0 }, |
diff --git a/drivers/hwmon/max6650.c b/drivers/hwmon/max6650.c index 86142a858238..58f66be61b1f 100644 --- a/drivers/hwmon/max6650.c +++ b/drivers/hwmon/max6650.c | |||
@@ -418,6 +418,7 @@ static ssize_t set_div(struct device *dev, struct device_attribute *devattr, | |||
418 | data->count = 3; | 418 | data->count = 3; |
419 | break; | 419 | break; |
420 | default: | 420 | default: |
421 | mutex_unlock(&data->update_lock); | ||
421 | dev_err(&client->dev, | 422 | dev_err(&client->dev, |
422 | "illegal value for fan divider (%d)\n", div); | 423 | "illegal value for fan divider (%d)\n", div); |
423 | return -EINVAL; | 424 | return -EINVAL; |
diff --git a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c index 56cd6004da36..6290a259456e 100644 --- a/drivers/hwmon/sht15.c +++ b/drivers/hwmon/sht15.c | |||
@@ -257,7 +257,7 @@ static inline int sht15_update_single_val(struct sht15_data *data, | |||
257 | (data->flag == SHT15_READING_NOTHING), | 257 | (data->flag == SHT15_READING_NOTHING), |
258 | msecs_to_jiffies(timeout_msecs)); | 258 | msecs_to_jiffies(timeout_msecs)); |
259 | if (ret == 0) {/* timeout occurred */ | 259 | if (ret == 0) {/* timeout occurred */ |
260 | disable_irq_nosync(gpio_to_irq(data->pdata->gpio_data));; | 260 | disable_irq_nosync(gpio_to_irq(data->pdata->gpio_data)); |
261 | sht15_connection_reset(data); | 261 | sht15_connection_reset(data); |
262 | return -ETIME; | 262 | return -ETIME; |
263 | } | 263 | } |
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c index e4476743f203..b1bc6e277d2a 100644 --- a/drivers/i2c/busses/i2c-ibm_iic.c +++ b/drivers/i2c/busses/i2c-ibm_iic.c | |||
@@ -85,10 +85,11 @@ static void dump_iic_regs(const char* header, struct ibm_iic_private* dev) | |||
85 | { | 85 | { |
86 | volatile struct iic_regs __iomem *iic = dev->vaddr; | 86 | volatile struct iic_regs __iomem *iic = dev->vaddr; |
87 | printk(KERN_DEBUG "ibm-iic%d: %s\n", dev->idx, header); | 87 | printk(KERN_DEBUG "ibm-iic%d: %s\n", dev->idx, header); |
88 | printk(KERN_DEBUG " cntl = 0x%02x, mdcntl = 0x%02x\n" | 88 | printk(KERN_DEBUG |
89 | KERN_DEBUG " sts = 0x%02x, extsts = 0x%02x\n" | 89 | " cntl = 0x%02x, mdcntl = 0x%02x\n" |
90 | KERN_DEBUG " clkdiv = 0x%02x, xfrcnt = 0x%02x\n" | 90 | " sts = 0x%02x, extsts = 0x%02x\n" |
91 | KERN_DEBUG " xtcntlss = 0x%02x, directcntl = 0x%02x\n", | 91 | " clkdiv = 0x%02x, xfrcnt = 0x%02x\n" |
92 | " xtcntlss = 0x%02x, directcntl = 0x%02x\n", | ||
92 | in_8(&iic->cntl), in_8(&iic->mdcntl), in_8(&iic->sts), | 93 | in_8(&iic->cntl), in_8(&iic->mdcntl), in_8(&iic->sts), |
93 | in_8(&iic->extsts), in_8(&iic->clkdiv), in_8(&iic->xfrcnt), | 94 | in_8(&iic->extsts), in_8(&iic->clkdiv), in_8(&iic->xfrcnt), |
94 | in_8(&iic->xtcntlss), in_8(&iic->directcntl)); | 95 | in_8(&iic->xtcntlss), in_8(&iic->directcntl)); |
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index d5f3c77beadd..db96138fefcd 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -466,14 +466,10 @@ void do_ide_request(struct request_queue *q) | |||
466 | 466 | ||
467 | if (!ide_lock_port(hwif)) { | 467 | if (!ide_lock_port(hwif)) { |
468 | ide_hwif_t *prev_port; | 468 | ide_hwif_t *prev_port; |
469 | |||
470 | WARN_ON_ONCE(hwif->rq); | ||
469 | repeat: | 471 | repeat: |
470 | prev_port = hwif->host->cur_port; | 472 | prev_port = hwif->host->cur_port; |
471 | |||
472 | if (drive->dev_flags & IDE_DFLAG_BLOCKED) | ||
473 | rq = hwif->rq; | ||
474 | else | ||
475 | WARN_ON_ONCE(hwif->rq); | ||
476 | |||
477 | if (drive->dev_flags & IDE_DFLAG_SLEEPING && | 473 | if (drive->dev_flags & IDE_DFLAG_SLEEPING && |
478 | time_after(drive->sleep, jiffies)) { | 474 | time_after(drive->sleep, jiffies)) { |
479 | ide_unlock_port(hwif); | 475 | ide_unlock_port(hwif); |
@@ -500,29 +496,43 @@ repeat: | |||
500 | hwif->cur_dev = drive; | 496 | hwif->cur_dev = drive; |
501 | drive->dev_flags &= ~(IDE_DFLAG_SLEEPING | IDE_DFLAG_PARKED); | 497 | drive->dev_flags &= ~(IDE_DFLAG_SLEEPING | IDE_DFLAG_PARKED); |
502 | 498 | ||
503 | if (rq == NULL) { | 499 | spin_unlock_irq(&hwif->lock); |
504 | spin_unlock_irq(&hwif->lock); | 500 | spin_lock_irq(q->queue_lock); |
505 | spin_lock_irq(q->queue_lock); | 501 | /* |
506 | /* | 502 | * we know that the queue isn't empty, but this can happen |
507 | * we know that the queue isn't empty, but this can | 503 | * if the q->prep_rq_fn() decides to kill a request |
508 | * happen if ->prep_rq_fn() decides to kill a request | 504 | */ |
509 | */ | 505 | if (!rq) |
510 | rq = blk_fetch_request(drive->queue); | 506 | rq = blk_fetch_request(drive->queue); |
511 | spin_unlock_irq(q->queue_lock); | ||
512 | spin_lock_irq(&hwif->lock); | ||
513 | 507 | ||
514 | if (rq == NULL) { | 508 | spin_unlock_irq(q->queue_lock); |
515 | ide_unlock_port(hwif); | 509 | spin_lock_irq(&hwif->lock); |
516 | goto out; | 510 | |
517 | } | 511 | if (!rq) { |
512 | ide_unlock_port(hwif); | ||
513 | goto out; | ||
518 | } | 514 | } |
519 | 515 | ||
520 | /* | 516 | /* |
521 | * Sanity: don't accept a request that isn't a PM request | 517 | * Sanity: don't accept a request that isn't a PM request |
522 | * if we are currently power managed. | 518 | * if we are currently power managed. This is very important as |
519 | * blk_stop_queue() doesn't prevent the blk_fetch_request() | ||
520 | * above to return us whatever is in the queue. Since we call | ||
521 | * ide_do_request() ourselves, we end up taking requests while | ||
522 | * the queue is blocked... | ||
523 | * | ||
524 | * We let requests forced at head of queue with ide-preempt | ||
525 | * though. I hope that doesn't happen too much, hopefully not | ||
526 | * unless the subdriver triggers such a thing in its own PM | ||
527 | * state machine. | ||
523 | */ | 528 | */ |
524 | BUG_ON((drive->dev_flags & IDE_DFLAG_BLOCKED) && | 529 | if ((drive->dev_flags & IDE_DFLAG_BLOCKED) && |
525 | blk_pm_request(rq) == 0); | 530 | blk_pm_request(rq) == 0 && |
531 | (rq->cmd_flags & REQ_PREEMPT) == 0) { | ||
532 | /* there should be no pending command at this point */ | ||
533 | ide_unlock_port(hwif); | ||
534 | goto plug_device; | ||
535 | } | ||
526 | 536 | ||
527 | hwif->rq = rq; | 537 | hwif->rq = rq; |
528 | 538 | ||
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index 83b734aec923..52b25f8b111d 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -880,6 +880,7 @@ static struct sbp2_lu *sbp2_alloc_device(struct unit_directory *ud) | |||
880 | } | 880 | } |
881 | 881 | ||
882 | shost->hostdata[0] = (unsigned long)lu; | 882 | shost->hostdata[0] = (unsigned long)lu; |
883 | shost->max_cmd_len = SBP2_MAX_CDB_SIZE; | ||
883 | 884 | ||
884 | if (!scsi_add_host(shost, &ud->device)) { | 885 | if (!scsi_add_host(shost, &ud->device)) { |
885 | lu->shost = shost; | 886 | lu->shost = shost; |
diff --git a/drivers/ieee1394/sbp2.h b/drivers/ieee1394/sbp2.h index c5036f1cc5b0..64a3a66a8a39 100644 --- a/drivers/ieee1394/sbp2.h +++ b/drivers/ieee1394/sbp2.h | |||
@@ -25,6 +25,12 @@ | |||
25 | #define SBP2_DEVICE_NAME "sbp2" | 25 | #define SBP2_DEVICE_NAME "sbp2" |
26 | 26 | ||
27 | /* | 27 | /* |
28 | * There is no transport protocol limit to the CDB length, but we implement | ||
29 | * a fixed length only. 16 bytes is enough for disks larger than 2 TB. | ||
30 | */ | ||
31 | #define SBP2_MAX_CDB_SIZE 16 | ||
32 | |||
33 | /* | ||
28 | * SBP-2 specific definitions | 34 | * SBP-2 specific definitions |
29 | */ | 35 | */ |
30 | 36 | ||
@@ -51,7 +57,7 @@ struct sbp2_command_orb { | |||
51 | u32 data_descriptor_hi; | 57 | u32 data_descriptor_hi; |
52 | u32 data_descriptor_lo; | 58 | u32 data_descriptor_lo; |
53 | u32 misc; | 59 | u32 misc; |
54 | u8 cdb[12]; | 60 | u8 cdb[SBP2_MAX_CDB_SIZE]; |
55 | } __attribute__((packed)); | 61 | } __attribute__((packed)); |
56 | 62 | ||
57 | #define SBP2_LOGIN_REQUEST 0x0 | 63 | #define SBP2_LOGIN_REQUEST 0x0 |
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index 9d8f796c6745..a6b989a9dc07 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig | |||
@@ -12,6 +12,42 @@ menuconfig INPUT_KEYBOARD | |||
12 | 12 | ||
13 | if INPUT_KEYBOARD | 13 | if INPUT_KEYBOARD |
14 | 14 | ||
15 | config KEYBOARD_AAED2000 | ||
16 | tristate "AAED-2000 keyboard" | ||
17 | depends on MACH_AAED2000 | ||
18 | select INPUT_POLLDEV | ||
19 | default y | ||
20 | help | ||
21 | Say Y here to enable the keyboard on the Agilent AAED-2000 | ||
22 | development board. | ||
23 | |||
24 | To compile this driver as a module, choose M here: the | ||
25 | module will be called aaed2000_kbd. | ||
26 | |||
27 | config KEYBOARD_AMIGA | ||
28 | tristate "Amiga keyboard" | ||
29 | depends on AMIGA | ||
30 | help | ||
31 | Say Y here if you are running Linux on any AMIGA and have a keyboard | ||
32 | attached. | ||
33 | |||
34 | To compile this driver as a module, choose M here: the | ||
35 | module will be called amikbd. | ||
36 | |||
37 | config ATARI_KBD_CORE | ||
38 | bool | ||
39 | |||
40 | config KEYBOARD_ATARI | ||
41 | tristate "Atari keyboard" | ||
42 | depends on ATARI | ||
43 | select ATARI_KBD_CORE | ||
44 | help | ||
45 | Say Y here if you are running Linux on any Atari and have a keyboard | ||
46 | attached. | ||
47 | |||
48 | To compile this driver as a module, choose M here: the | ||
49 | module will be called atakbd. | ||
50 | |||
15 | config KEYBOARD_ATKBD | 51 | config KEYBOARD_ATKBD |
16 | tristate "AT keyboard" if EMBEDDED || !X86 | 52 | tristate "AT keyboard" if EMBEDDED || !X86 |
17 | default y | 53 | default y |
@@ -68,69 +104,14 @@ config KEYBOARD_ATKBD_RDI_KEYCODES | |||
68 | right-hand column will be interpreted as the key shown in the | 104 | right-hand column will be interpreted as the key shown in the |
69 | left-hand column. | 105 | left-hand column. |
70 | 106 | ||
71 | config KEYBOARD_SUNKBD | 107 | config KEYBOARD_BFIN |
72 | tristate "Sun Type 4 and Type 5 keyboard" | 108 | tristate "Blackfin BF54x keypad support" |
73 | select SERIO | 109 | depends on (BF54x && !BF544) |
74 | help | ||
75 | Say Y here if you want to use a Sun Type 4 or Type 5 keyboard, | ||
76 | connected either to the Sun keyboard connector or to an serial | ||
77 | (RS-232) port via a simple adapter. | ||
78 | |||
79 | To compile this driver as a module, choose M here: the | ||
80 | module will be called sunkbd. | ||
81 | |||
82 | config KEYBOARD_LKKBD | ||
83 | tristate "DECstation/VAXstation LK201/LK401 keyboard" | ||
84 | select SERIO | ||
85 | help | ||
86 | Say Y here if you want to use a LK201 or LK401 style serial | ||
87 | keyboard. This keyboard is also useable on PCs if you attach | ||
88 | it with the inputattach program. The connector pinout is | ||
89 | described within lkkbd.c. | ||
90 | |||
91 | To compile this driver as a module, choose M here: the | ||
92 | module will be called lkkbd. | ||
93 | |||
94 | config KEYBOARD_LOCOMO | ||
95 | tristate "LoCoMo Keyboard Support" | ||
96 | depends on SHARP_LOCOMO && INPUT_KEYBOARD | ||
97 | help | ||
98 | Say Y here if you are running Linux on a Sharp Zaurus Collie or Poodle based PDA | ||
99 | |||
100 | To compile this driver as a module, choose M here: the | ||
101 | module will be called locomokbd. | ||
102 | |||
103 | config KEYBOARD_XTKBD | ||
104 | tristate "XT keyboard" | ||
105 | select SERIO | ||
106 | help | ||
107 | Say Y here if you want to use the old IBM PC/XT keyboard (or | ||
108 | compatible) on your system. This is only possible with a | ||
109 | parallel port keyboard adapter, you cannot connect it to the | ||
110 | keyboard port on a PC that runs Linux. | ||
111 | |||
112 | To compile this driver as a module, choose M here: the | ||
113 | module will be called xtkbd. | ||
114 | |||
115 | config KEYBOARD_NEWTON | ||
116 | tristate "Newton keyboard" | ||
117 | select SERIO | ||
118 | help | ||
119 | Say Y here if you have a Newton keyboard on a serial port. | ||
120 | |||
121 | To compile this driver as a module, choose M here: the | ||
122 | module will be called newtonkbd. | ||
123 | |||
124 | config KEYBOARD_STOWAWAY | ||
125 | tristate "Stowaway keyboard" | ||
126 | select SERIO | ||
127 | help | 110 | help |
128 | Say Y here if you have a Stowaway keyboard on a serial port. | 111 | Say Y here if you want to use the BF54x keypad. |
129 | Stowaway compatible keyboards like Dicota Input-PDA keyboard | ||
130 | are also supported by this driver. | ||
131 | 112 | ||
132 | To compile this driver as a module, choose M here: the | 113 | To compile this driver as a module, choose M here: the |
133 | module will be called stowaway. | 114 | module will be called bf54x-keys. |
134 | 115 | ||
135 | config KEYBOARD_CORGI | 116 | config KEYBOARD_CORGI |
136 | tristate "Corgi keyboard" | 117 | tristate "Corgi keyboard" |
@@ -143,61 +124,50 @@ config KEYBOARD_CORGI | |||
143 | To compile this driver as a module, choose M here: the | 124 | To compile this driver as a module, choose M here: the |
144 | module will be called corgikbd. | 125 | module will be called corgikbd. |
145 | 126 | ||
146 | config KEYBOARD_SPITZ | 127 | config KEYBOARD_LKKBD |
147 | tristate "Spitz keyboard" | 128 | tristate "DECstation/VAXstation LK201/LK401 keyboard" |
148 | depends on PXA_SHARPSL | 129 | select SERIO |
149 | default y | ||
150 | help | 130 | help |
151 | Say Y here to enable the keyboard on the Sharp Zaurus SL-C1000, | 131 | Say Y here if you want to use a LK201 or LK401 style serial |
152 | SL-C3000 and Sl-C3100 series of PDAs. | 132 | keyboard. This keyboard is also useable on PCs if you attach |
133 | it with the inputattach program. The connector pinout is | ||
134 | described within lkkbd.c. | ||
153 | 135 | ||
154 | To compile this driver as a module, choose M here: the | 136 | To compile this driver as a module, choose M here: the |
155 | module will be called spitzkbd. | 137 | module will be called lkkbd. |
156 | 138 | ||
157 | config KEYBOARD_TOSA | 139 | config KEYBOARD_EP93XX |
158 | tristate "Tosa keyboard" | 140 | tristate "EP93xx Matrix Keypad support" |
159 | depends on MACH_TOSA | 141 | depends on ARCH_EP93XX |
160 | default y | ||
161 | help | 142 | help |
162 | Say Y here to enable the keyboard on the Sharp Zaurus SL-6000x (Tosa) | 143 | Say Y here to enable the matrix keypad on the Cirrus EP93XX. |
163 | 144 | ||
164 | To compile this driver as a module, choose M here: the | 145 | To compile this driver as a module, choose M here: the |
165 | module will be called tosakbd. | 146 | module will be called ep93xx_keypad. |
166 | 147 | ||
167 | config KEYBOARD_TOSA_USE_EXT_KEYCODES | 148 | config KEYBOARD_GPIO |
168 | bool "Tosa keyboard: use extended keycodes" | 149 | tristate "GPIO Buttons" |
169 | depends on KEYBOARD_TOSA | 150 | depends on GENERIC_GPIO |
170 | default n | ||
171 | help | 151 | help |
172 | Say Y here to enable the tosa keyboard driver to generate extended | 152 | This driver implements support for buttons connected |
173 | (>= 127) keycodes. Be aware, that they can't be correctly interpreted | 153 | to GPIO pins of various CPUs (and some other chips). |
174 | by either console keyboard driver or by Kdrive keybd driver. | ||
175 | |||
176 | Say Y only if you know, what you are doing! | ||
177 | 154 | ||
178 | config KEYBOARD_AMIGA | 155 | Say Y here if your device has buttons connected |
179 | tristate "Amiga keyboard" | 156 | directly to such GPIO pins. Your board-specific |
180 | depends on AMIGA | 157 | setup logic must also provide a platform device, |
181 | help | 158 | with configuration data saying which GPIOs are used. |
182 | Say Y here if you are running Linux on any AMIGA and have a keyboard | ||
183 | attached. | ||
184 | 159 | ||
185 | To compile this driver as a module, choose M here: the | 160 | To compile this driver as a module, choose M here: the |
186 | module will be called amikbd. | 161 | module will be called gpio_keys. |
187 | 162 | ||
188 | config ATARI_KBD_CORE | 163 | config KEYBOARD_MATRIX |
189 | bool | 164 | tristate "GPIO driven matrix keypad support" |
190 | 165 | depends on GENERIC_GPIO | |
191 | config KEYBOARD_ATARI | ||
192 | tristate "Atari keyboard" | ||
193 | depends on ATARI | ||
194 | select ATARI_KBD_CORE | ||
195 | help | 166 | help |
196 | Say Y here if you are running Linux on any Atari and have a keyboard | 167 | Enable support for GPIO driven matrix keypad. |
197 | attached. | ||
198 | 168 | ||
199 | To compile this driver as a module, choose M here: the | 169 | To compile this driver as a module, choose M here: the |
200 | module will be called atakbd. | 170 | module will be called matrix_keypad. |
201 | 171 | ||
202 | config KEYBOARD_HIL_OLD | 172 | config KEYBOARD_HIL_OLD |
203 | tristate "HP HIL keyboard support (simple driver)" | 173 | tristate "HP HIL keyboard support (simple driver)" |
@@ -261,20 +231,39 @@ config KEYBOARD_LM8323 | |||
261 | To compile this driver as a module, choose M here: the | 231 | To compile this driver as a module, choose M here: the |
262 | module will be called lm8323. | 232 | module will be called lm8323. |
263 | 233 | ||
264 | config KEYBOARD_OMAP | 234 | config KEYBOARD_LOCOMO |
265 | tristate "TI OMAP keypad support" | 235 | tristate "LoCoMo Keyboard Support" |
266 | depends on (ARCH_OMAP1 || ARCH_OMAP2) | 236 | depends on SHARP_LOCOMO |
267 | help | 237 | help |
268 | Say Y here if you want to use the OMAP keypad. | 238 | Say Y here if you are running Linux on a Sharp Zaurus Collie or Poodle based PDA |
269 | 239 | ||
270 | To compile this driver as a module, choose M here: the | 240 | To compile this driver as a module, choose M here: the |
271 | module will be called omap-keypad. | 241 | module will be called locomokbd. |
242 | |||
243 | config KEYBOARD_MAPLE | ||
244 | tristate "Maple bus keyboard" | ||
245 | depends on SH_DREAMCAST && MAPLE | ||
246 | help | ||
247 | Say Y here if you have a Dreamcast console running Linux and have | ||
248 | a keyboard attached to its Maple bus. | ||
249 | |||
250 | To compile this driver as a module, choose M here: the | ||
251 | module will be called maple_keyb. | ||
252 | |||
253 | config KEYBOARD_NEWTON | ||
254 | tristate "Newton keyboard" | ||
255 | select SERIO | ||
256 | help | ||
257 | Say Y here if you have a Newton keyboard on a serial port. | ||
258 | |||
259 | To compile this driver as a module, choose M here: the | ||
260 | module will be called newtonkbd. | ||
272 | 261 | ||
273 | config KEYBOARD_PXA27x | 262 | config KEYBOARD_PXA27x |
274 | tristate "PXA27x/PXA3xx keypad support" | 263 | tristate "PXA27x/PXA3xx keypad support" |
275 | depends on PXA27x || PXA3xx | 264 | depends on PXA27x || PXA3xx |
276 | help | 265 | help |
277 | Enable support for PXA27x/PXA3xx keypad controller | 266 | Enable support for PXA27x/PXA3xx keypad controller. |
278 | 267 | ||
279 | To compile this driver as a module, choose M here: the | 268 | To compile this driver as a module, choose M here: the |
280 | module will be called pxa27x_keypad. | 269 | module will be called pxa27x_keypad. |
@@ -288,51 +277,38 @@ config KEYBOARD_PXA930_ROTARY | |||
288 | To compile this driver as a module, choose M here: the | 277 | To compile this driver as a module, choose M here: the |
289 | module will be called pxa930_rotary. | 278 | module will be called pxa930_rotary. |
290 | 279 | ||
291 | config KEYBOARD_AAED2000 | 280 | config KEYBOARD_SPITZ |
292 | tristate "AAED-2000 keyboard" | 281 | tristate "Spitz keyboard" |
293 | depends on MACH_AAED2000 | 282 | depends on PXA_SHARPSL |
294 | select INPUT_POLLDEV | ||
295 | default y | 283 | default y |
296 | help | 284 | help |
297 | Say Y here to enable the keyboard on the Agilent AAED-2000 | 285 | Say Y here to enable the keyboard on the Sharp Zaurus SL-C1000, |
298 | development board. | 286 | SL-C3000 and Sl-C3100 series of PDAs. |
299 | |||
300 | To compile this driver as a module, choose M here: the | ||
301 | module will be called aaed2000_kbd. | ||
302 | |||
303 | config KEYBOARD_GPIO | ||
304 | tristate "GPIO Buttons" | ||
305 | depends on GENERIC_GPIO | ||
306 | help | ||
307 | This driver implements support for buttons connected | ||
308 | to GPIO pins of various CPUs (and some other chips). | ||
309 | |||
310 | Say Y here if your device has buttons connected | ||
311 | directly to such GPIO pins. Your board-specific | ||
312 | setup logic must also provide a platform device, | ||
313 | with configuration data saying which GPIOs are used. | ||
314 | 287 | ||
315 | To compile this driver as a module, choose M here: the | 288 | To compile this driver as a module, choose M here: the |
316 | module will be called gpio-keys. | 289 | module will be called spitzkbd. |
317 | 290 | ||
318 | config KEYBOARD_MAPLE | 291 | config KEYBOARD_STOWAWAY |
319 | tristate "Maple bus keyboard" | 292 | tristate "Stowaway keyboard" |
320 | depends on SH_DREAMCAST && MAPLE | 293 | select SERIO |
321 | help | 294 | help |
322 | Say Y here if you have a Dreamcast console running Linux and have | 295 | Say Y here if you have a Stowaway keyboard on a serial port. |
323 | a keyboard attached to its Maple bus. | 296 | Stowaway compatible keyboards like Dicota Input-PDA keyboard |
297 | are also supported by this driver. | ||
324 | 298 | ||
325 | To compile this driver as a module, choose M here: the | 299 | To compile this driver as a module, choose M here: the |
326 | module will be called maple_keyb. | 300 | module will be called stowaway. |
327 | 301 | ||
328 | config KEYBOARD_BFIN | 302 | config KEYBOARD_SUNKBD |
329 | tristate "Blackfin BF54x keypad support" | 303 | tristate "Sun Type 4 and Type 5 keyboard" |
330 | depends on (BF54x && !BF544) | 304 | select SERIO |
331 | help | 305 | help |
332 | Say Y here if you want to use the BF54x keypad. | 306 | Say Y here if you want to use a Sun Type 4 or Type 5 keyboard, |
307 | connected either to the Sun keyboard connector or to an serial | ||
308 | (RS-232) port via a simple adapter. | ||
333 | 309 | ||
334 | To compile this driver as a module, choose M here: the | 310 | To compile this driver as a module, choose M here: the |
335 | module will be called bf54x-keys. | 311 | module will be called sunkbd. |
336 | 312 | ||
337 | config KEYBOARD_SH_KEYSC | 313 | config KEYBOARD_SH_KEYSC |
338 | tristate "SuperH KEYSC keypad support" | 314 | tristate "SuperH KEYSC keypad support" |
@@ -344,13 +320,45 @@ config KEYBOARD_SH_KEYSC | |||
344 | To compile this driver as a module, choose M here: the | 320 | To compile this driver as a module, choose M here: the |
345 | module will be called sh_keysc. | 321 | module will be called sh_keysc. |
346 | 322 | ||
347 | config KEYBOARD_EP93XX | 323 | config KEYBOARD_OMAP |
348 | tristate "EP93xx Matrix Keypad support" | 324 | tristate "TI OMAP keypad support" |
349 | depends on ARCH_EP93XX | 325 | depends on (ARCH_OMAP1 || ARCH_OMAP2) |
350 | help | 326 | help |
351 | Say Y here to enable the matrix keypad on the Cirrus EP93XX. | 327 | Say Y here if you want to use the OMAP keypad. |
352 | 328 | ||
353 | To compile this driver as a module, choose M here: the | 329 | To compile this driver as a module, choose M here: the |
354 | module will be called ep93xx_keypad. | 330 | module will be called omap-keypad. |
331 | |||
332 | config KEYBOARD_TOSA | ||
333 | tristate "Tosa keyboard" | ||
334 | depends on MACH_TOSA | ||
335 | default y | ||
336 | help | ||
337 | Say Y here to enable the keyboard on the Sharp Zaurus SL-6000x (Tosa) | ||
338 | |||
339 | To compile this driver as a module, choose M here: the | ||
340 | module will be called tosakbd. | ||
341 | |||
342 | config KEYBOARD_TOSA_USE_EXT_KEYCODES | ||
343 | bool "Tosa keyboard: use extended keycodes" | ||
344 | depends on KEYBOARD_TOSA | ||
345 | help | ||
346 | Say Y here to enable the tosa keyboard driver to generate extended | ||
347 | (>= 127) keycodes. Be aware, that they can't be correctly interpreted | ||
348 | by either console keyboard driver or by Kdrive keybd driver. | ||
349 | |||
350 | Say Y only if you know, what you are doing! | ||
351 | |||
352 | config KEYBOARD_XTKBD | ||
353 | tristate "XT keyboard" | ||
354 | select SERIO | ||
355 | help | ||
356 | Say Y here if you want to use the old IBM PC/XT keyboard (or | ||
357 | compatible) on your system. This is only possible with a | ||
358 | parallel port keyboard adapter, you cannot connect it to the | ||
359 | keyboard port on a PC that runs Linux. | ||
360 | |||
361 | To compile this driver as a module, choose M here: the | ||
362 | module will be called xtkbd. | ||
355 | 363 | ||
356 | endif | 364 | endif |
diff --git a/drivers/input/keyboard/Makefile b/drivers/input/keyboard/Makefile index 156b647a259b..b5b5eae9724f 100644 --- a/drivers/input/keyboard/Makefile +++ b/drivers/input/keyboard/Makefile | |||
@@ -4,29 +4,30 @@ | |||
4 | 4 | ||
5 | # Each configuration option enables a list of files. | 5 | # Each configuration option enables a list of files. |
6 | 6 | ||
7 | obj-$(CONFIG_KEYBOARD_ATKBD) += atkbd.o | 7 | obj-$(CONFIG_KEYBOARD_AAED2000) += aaed2000_kbd.o |
8 | obj-$(CONFIG_KEYBOARD_SUNKBD) += sunkbd.o | ||
9 | obj-$(CONFIG_KEYBOARD_LKKBD) += lkkbd.o | ||
10 | obj-$(CONFIG_KEYBOARD_XTKBD) += xtkbd.o | ||
11 | obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o | 8 | obj-$(CONFIG_KEYBOARD_AMIGA) += amikbd.o |
12 | obj-$(CONFIG_KEYBOARD_ATARI) += atakbd.o | 9 | obj-$(CONFIG_KEYBOARD_ATARI) += atakbd.o |
13 | obj-$(CONFIG_KEYBOARD_LOCOMO) += locomokbd.o | 10 | obj-$(CONFIG_KEYBOARD_ATKBD) += atkbd.o |
14 | obj-$(CONFIG_KEYBOARD_NEWTON) += newtonkbd.o | 11 | obj-$(CONFIG_KEYBOARD_BFIN) += bf54x-keys.o |
15 | obj-$(CONFIG_KEYBOARD_STOWAWAY) += stowaway.o | ||
16 | obj-$(CONFIG_KEYBOARD_CORGI) += corgikbd.o | 12 | obj-$(CONFIG_KEYBOARD_CORGI) += corgikbd.o |
17 | obj-$(CONFIG_KEYBOARD_SPITZ) += spitzkbd.o | 13 | obj-$(CONFIG_KEYBOARD_EP93XX) += ep93xx_keypad.o |
18 | obj-$(CONFIG_KEYBOARD_TOSA) += tosakbd.o | 14 | obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o |
19 | obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o | 15 | obj-$(CONFIG_KEYBOARD_HIL) += hil_kbd.o |
20 | obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o | 16 | obj-$(CONFIG_KEYBOARD_HIL_OLD) += hilkbd.o |
17 | obj-$(CONFIG_KEYBOARD_HP6XX) += jornada680_kbd.o | ||
18 | obj-$(CONFIG_KEYBOARD_HP7XX) += jornada720_kbd.o | ||
19 | obj-$(CONFIG_KEYBOARD_LKKBD) += lkkbd.o | ||
21 | obj-$(CONFIG_KEYBOARD_LM8323) += lm8323.o | 20 | obj-$(CONFIG_KEYBOARD_LM8323) += lm8323.o |
21 | obj-$(CONFIG_KEYBOARD_LOCOMO) += locomokbd.o | ||
22 | obj-$(CONFIG_KEYBOARD_MAPLE) += maple_keyb.o | ||
23 | obj-$(CONFIG_KEYBOARD_MATRIX) += matrix_keypad.o | ||
24 | obj-$(CONFIG_KEYBOARD_NEWTON) += newtonkbd.o | ||
22 | obj-$(CONFIG_KEYBOARD_OMAP) += omap-keypad.o | 25 | obj-$(CONFIG_KEYBOARD_OMAP) += omap-keypad.o |
23 | obj-$(CONFIG_KEYBOARD_PXA27x) += pxa27x_keypad.o | 26 | obj-$(CONFIG_KEYBOARD_PXA27x) += pxa27x_keypad.o |
24 | obj-$(CONFIG_KEYBOARD_PXA930_ROTARY) += pxa930_rotary.o | 27 | obj-$(CONFIG_KEYBOARD_PXA930_ROTARY) += pxa930_rotary.o |
25 | obj-$(CONFIG_KEYBOARD_AAED2000) += aaed2000_kbd.o | ||
26 | obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o | ||
27 | obj-$(CONFIG_KEYBOARD_HP6XX) += jornada680_kbd.o | ||
28 | obj-$(CONFIG_KEYBOARD_HP7XX) += jornada720_kbd.o | ||
29 | obj-$(CONFIG_KEYBOARD_MAPLE) += maple_keyb.o | ||
30 | obj-$(CONFIG_KEYBOARD_BFIN) += bf54x-keys.o | ||
31 | obj-$(CONFIG_KEYBOARD_SH_KEYSC) += sh_keysc.o | 28 | obj-$(CONFIG_KEYBOARD_SH_KEYSC) += sh_keysc.o |
32 | obj-$(CONFIG_KEYBOARD_EP93XX) += ep93xx_keypad.o | 29 | obj-$(CONFIG_KEYBOARD_SPITZ) += spitzkbd.o |
30 | obj-$(CONFIG_KEYBOARD_STOWAWAY) += stowaway.o | ||
31 | obj-$(CONFIG_KEYBOARD_SUNKBD) += sunkbd.o | ||
32 | obj-$(CONFIG_KEYBOARD_TOSA) += tosakbd.o | ||
33 | obj-$(CONFIG_KEYBOARD_XTKBD) += xtkbd.o | ||
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 2157cd7de00c..efed0c9e242e 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c | |||
@@ -29,7 +29,8 @@ | |||
29 | struct gpio_button_data { | 29 | struct gpio_button_data { |
30 | struct gpio_keys_button *button; | 30 | struct gpio_keys_button *button; |
31 | struct input_dev *input; | 31 | struct input_dev *input; |
32 | struct delayed_work work; | 32 | struct timer_list timer; |
33 | struct work_struct work; | ||
33 | }; | 34 | }; |
34 | 35 | ||
35 | struct gpio_keys_drvdata { | 36 | struct gpio_keys_drvdata { |
@@ -40,7 +41,7 @@ struct gpio_keys_drvdata { | |||
40 | static void gpio_keys_report_event(struct work_struct *work) | 41 | static void gpio_keys_report_event(struct work_struct *work) |
41 | { | 42 | { |
42 | struct gpio_button_data *bdata = | 43 | struct gpio_button_data *bdata = |
43 | container_of(work, struct gpio_button_data, work.work); | 44 | container_of(work, struct gpio_button_data, work); |
44 | struct gpio_keys_button *button = bdata->button; | 45 | struct gpio_keys_button *button = bdata->button; |
45 | struct input_dev *input = bdata->input; | 46 | struct input_dev *input = bdata->input; |
46 | unsigned int type = button->type ?: EV_KEY; | 47 | unsigned int type = button->type ?: EV_KEY; |
@@ -50,17 +51,25 @@ static void gpio_keys_report_event(struct work_struct *work) | |||
50 | input_sync(input); | 51 | input_sync(input); |
51 | } | 52 | } |
52 | 53 | ||
54 | static void gpio_keys_timer(unsigned long _data) | ||
55 | { | ||
56 | struct gpio_button_data *data = (struct gpio_button_data *)_data; | ||
57 | |||
58 | schedule_work(&data->work); | ||
59 | } | ||
60 | |||
53 | static irqreturn_t gpio_keys_isr(int irq, void *dev_id) | 61 | static irqreturn_t gpio_keys_isr(int irq, void *dev_id) |
54 | { | 62 | { |
55 | struct gpio_button_data *bdata = dev_id; | 63 | struct gpio_button_data *bdata = dev_id; |
56 | struct gpio_keys_button *button = bdata->button; | 64 | struct gpio_keys_button *button = bdata->button; |
57 | unsigned long delay; | ||
58 | 65 | ||
59 | BUG_ON(irq != gpio_to_irq(button->gpio)); | 66 | BUG_ON(irq != gpio_to_irq(button->gpio)); |
60 | 67 | ||
61 | delay = button->debounce_interval ? | 68 | if (button->debounce_interval) |
62 | msecs_to_jiffies(button->debounce_interval) : 0; | 69 | mod_timer(&bdata->timer, |
63 | schedule_delayed_work(&bdata->work, delay); | 70 | jiffies + msecs_to_jiffies(button->debounce_interval)); |
71 | else | ||
72 | schedule_work(&bdata->work); | ||
64 | 73 | ||
65 | return IRQ_HANDLED; | 74 | return IRQ_HANDLED; |
66 | } | 75 | } |
@@ -107,7 +116,9 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) | |||
107 | 116 | ||
108 | bdata->input = input; | 117 | bdata->input = input; |
109 | bdata->button = button; | 118 | bdata->button = button; |
110 | INIT_DELAYED_WORK(&bdata->work, gpio_keys_report_event); | 119 | setup_timer(&bdata->timer, |
120 | gpio_keys_timer, (unsigned long)bdata); | ||
121 | INIT_WORK(&bdata->work, gpio_keys_report_event); | ||
111 | 122 | ||
112 | error = gpio_request(button->gpio, button->desc ?: "gpio_keys"); | 123 | error = gpio_request(button->gpio, button->desc ?: "gpio_keys"); |
113 | if (error < 0) { | 124 | if (error < 0) { |
@@ -166,7 +177,9 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) | |||
166 | fail2: | 177 | fail2: |
167 | while (--i >= 0) { | 178 | while (--i >= 0) { |
168 | free_irq(gpio_to_irq(pdata->buttons[i].gpio), &ddata->data[i]); | 179 | free_irq(gpio_to_irq(pdata->buttons[i].gpio), &ddata->data[i]); |
169 | cancel_delayed_work_sync(&ddata->data[i].work); | 180 | if (pdata->buttons[i].debounce_interval) |
181 | del_timer_sync(&ddata->data[i].timer); | ||
182 | cancel_work_sync(&ddata->data[i].work); | ||
170 | gpio_free(pdata->buttons[i].gpio); | 183 | gpio_free(pdata->buttons[i].gpio); |
171 | } | 184 | } |
172 | 185 | ||
@@ -190,7 +203,9 @@ static int __devexit gpio_keys_remove(struct platform_device *pdev) | |||
190 | for (i = 0; i < pdata->nbuttons; i++) { | 203 | for (i = 0; i < pdata->nbuttons; i++) { |
191 | int irq = gpio_to_irq(pdata->buttons[i].gpio); | 204 | int irq = gpio_to_irq(pdata->buttons[i].gpio); |
192 | free_irq(irq, &ddata->data[i]); | 205 | free_irq(irq, &ddata->data[i]); |
193 | cancel_delayed_work_sync(&ddata->data[i].work); | 206 | if (pdata->buttons[i].debounce_interval) |
207 | del_timer_sync(&ddata->data[i].timer); | ||
208 | cancel_work_sync(&ddata->data[i].work); | ||
194 | gpio_free(pdata->buttons[i].gpio); | 209 | gpio_free(pdata->buttons[i].gpio); |
195 | } | 210 | } |
196 | 211 | ||
diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c new file mode 100644 index 000000000000..e9b2e7cb05be --- /dev/null +++ b/drivers/input/keyboard/matrix_keypad.c | |||
@@ -0,0 +1,453 @@ | |||
1 | /* | ||
2 | * GPIO driven matrix keyboard driver | ||
3 | * | ||
4 | * Copyright (c) 2008 Marek Vasut <marek.vasut@gmail.com> | ||
5 | * | ||
6 | * Based on corgikbd.c | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | * | ||
12 | */ | ||
13 | |||
14 | #include <linux/types.h> | ||
15 | #include <linux/delay.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/input.h> | ||
19 | #include <linux/irq.h> | ||
20 | #include <linux/interrupt.h> | ||
21 | #include <linux/jiffies.h> | ||
22 | #include <linux/module.h> | ||
23 | #include <linux/gpio.h> | ||
24 | #include <linux/input/matrix_keypad.h> | ||
25 | |||
26 | struct matrix_keypad { | ||
27 | const struct matrix_keypad_platform_data *pdata; | ||
28 | struct input_dev *input_dev; | ||
29 | unsigned short *keycodes; | ||
30 | |||
31 | uint32_t last_key_state[MATRIX_MAX_COLS]; | ||
32 | struct delayed_work work; | ||
33 | bool scan_pending; | ||
34 | bool stopped; | ||
35 | spinlock_t lock; | ||
36 | }; | ||
37 | |||
38 | /* | ||
39 | * NOTE: normally the GPIO has to be put into HiZ when de-activated to cause | ||
40 | * minmal side effect when scanning other columns, here it is configured to | ||
41 | * be input, and it should work on most platforms. | ||
42 | */ | ||
43 | static void __activate_col(const struct matrix_keypad_platform_data *pdata, | ||
44 | int col, bool on) | ||
45 | { | ||
46 | bool level_on = !pdata->active_low; | ||
47 | |||
48 | if (on) { | ||
49 | gpio_direction_output(pdata->col_gpios[col], level_on); | ||
50 | } else { | ||
51 | gpio_set_value_cansleep(pdata->col_gpios[col], !level_on); | ||
52 | gpio_direction_input(pdata->col_gpios[col]); | ||
53 | } | ||
54 | } | ||
55 | |||
56 | static void activate_col(const struct matrix_keypad_platform_data *pdata, | ||
57 | int col, bool on) | ||
58 | { | ||
59 | __activate_col(pdata, col, on); | ||
60 | |||
61 | if (on && pdata->col_scan_delay_us) | ||
62 | udelay(pdata->col_scan_delay_us); | ||
63 | } | ||
64 | |||
65 | static void activate_all_cols(const struct matrix_keypad_platform_data *pdata, | ||
66 | bool on) | ||
67 | { | ||
68 | int col; | ||
69 | |||
70 | for (col = 0; col < pdata->num_col_gpios; col++) | ||
71 | __activate_col(pdata, col, on); | ||
72 | } | ||
73 | |||
74 | static bool row_asserted(const struct matrix_keypad_platform_data *pdata, | ||
75 | int row) | ||
76 | { | ||
77 | return gpio_get_value_cansleep(pdata->row_gpios[row]) ? | ||
78 | !pdata->active_low : pdata->active_low; | ||
79 | } | ||
80 | |||
81 | static void enable_row_irqs(struct matrix_keypad *keypad) | ||
82 | { | ||
83 | const struct matrix_keypad_platform_data *pdata = keypad->pdata; | ||
84 | int i; | ||
85 | |||
86 | for (i = 0; i < pdata->num_row_gpios; i++) | ||
87 | enable_irq(gpio_to_irq(pdata->row_gpios[i])); | ||
88 | } | ||
89 | |||
90 | static void disable_row_irqs(struct matrix_keypad *keypad) | ||
91 | { | ||
92 | const struct matrix_keypad_platform_data *pdata = keypad->pdata; | ||
93 | int i; | ||
94 | |||
95 | for (i = 0; i < pdata->num_row_gpios; i++) | ||
96 | disable_irq_nosync(gpio_to_irq(pdata->row_gpios[i])); | ||
97 | } | ||
98 | |||
99 | /* | ||
100 | * This gets the keys from keyboard and reports it to input subsystem | ||
101 | */ | ||
102 | static void matrix_keypad_scan(struct work_struct *work) | ||
103 | { | ||
104 | struct matrix_keypad *keypad = | ||
105 | container_of(work, struct matrix_keypad, work.work); | ||
106 | struct input_dev *input_dev = keypad->input_dev; | ||
107 | const struct matrix_keypad_platform_data *pdata = keypad->pdata; | ||
108 | uint32_t new_state[MATRIX_MAX_COLS]; | ||
109 | int row, col, code; | ||
110 | |||
111 | /* de-activate all columns for scanning */ | ||
112 | activate_all_cols(pdata, false); | ||
113 | |||
114 | memset(new_state, 0, sizeof(new_state)); | ||
115 | |||
116 | /* assert each column and read the row status out */ | ||
117 | for (col = 0; col < pdata->num_col_gpios; col++) { | ||
118 | |||
119 | activate_col(pdata, col, true); | ||
120 | |||
121 | for (row = 0; row < pdata->num_row_gpios; row++) | ||
122 | new_state[col] |= | ||
123 | row_asserted(pdata, row) ? (1 << row) : 0; | ||
124 | |||
125 | activate_col(pdata, col, false); | ||
126 | } | ||
127 | |||
128 | for (col = 0; col < pdata->num_col_gpios; col++) { | ||
129 | uint32_t bits_changed; | ||
130 | |||
131 | bits_changed = keypad->last_key_state[col] ^ new_state[col]; | ||
132 | if (bits_changed == 0) | ||
133 | continue; | ||
134 | |||
135 | for (row = 0; row < pdata->num_row_gpios; row++) { | ||
136 | if ((bits_changed & (1 << row)) == 0) | ||
137 | continue; | ||
138 | |||
139 | code = (row << 4) + col; | ||
140 | input_event(input_dev, EV_MSC, MSC_SCAN, code); | ||
141 | input_report_key(input_dev, | ||
142 | keypad->keycodes[code], | ||
143 | new_state[col] & (1 << row)); | ||
144 | } | ||
145 | } | ||
146 | input_sync(input_dev); | ||
147 | |||
148 | memcpy(keypad->last_key_state, new_state, sizeof(new_state)); | ||
149 | |||
150 | activate_all_cols(pdata, true); | ||
151 | |||
152 | /* Enable IRQs again */ | ||
153 | spin_lock_irq(&keypad->lock); | ||
154 | keypad->scan_pending = false; | ||
155 | enable_row_irqs(keypad); | ||
156 | spin_unlock_irq(&keypad->lock); | ||
157 | } | ||
158 | |||
159 | static irqreturn_t matrix_keypad_interrupt(int irq, void *id) | ||
160 | { | ||
161 | struct matrix_keypad *keypad = id; | ||
162 | unsigned long flags; | ||
163 | |||
164 | spin_lock_irqsave(&keypad->lock, flags); | ||
165 | |||
166 | /* | ||
167 | * See if another IRQ beaten us to it and scheduled the | ||
168 | * scan already. In that case we should not try to | ||
169 | * disable IRQs again. | ||
170 | */ | ||
171 | if (unlikely(keypad->scan_pending || keypad->stopped)) | ||
172 | goto out; | ||
173 | |||
174 | disable_row_irqs(keypad); | ||
175 | keypad->scan_pending = true; | ||
176 | schedule_delayed_work(&keypad->work, | ||
177 | msecs_to_jiffies(keypad->pdata->debounce_ms)); | ||
178 | |||
179 | out: | ||
180 | spin_unlock_irqrestore(&keypad->lock, flags); | ||
181 | return IRQ_HANDLED; | ||
182 | } | ||
183 | |||
184 | static int matrix_keypad_start(struct input_dev *dev) | ||
185 | { | ||
186 | struct matrix_keypad *keypad = input_get_drvdata(dev); | ||
187 | |||
188 | keypad->stopped = false; | ||
189 | mb(); | ||
190 | |||
191 | /* | ||
192 | * Schedule an immediate key scan to capture current key state; | ||
193 | * columns will be activated and IRQs be enabled after the scan. | ||
194 | */ | ||
195 | schedule_delayed_work(&keypad->work, 0); | ||
196 | |||
197 | return 0; | ||
198 | } | ||
199 | |||
200 | static void matrix_keypad_stop(struct input_dev *dev) | ||
201 | { | ||
202 | struct matrix_keypad *keypad = input_get_drvdata(dev); | ||
203 | |||
204 | keypad->stopped = true; | ||
205 | mb(); | ||
206 | flush_work(&keypad->work.work); | ||
207 | /* | ||
208 | * matrix_keypad_scan() will leave IRQs enabled; | ||
209 | * we should disable them now. | ||
210 | */ | ||
211 | disable_row_irqs(keypad); | ||
212 | } | ||
213 | |||
214 | #ifdef CONFIG_PM | ||
215 | static int matrix_keypad_suspend(struct platform_device *pdev, pm_message_t state) | ||
216 | { | ||
217 | struct matrix_keypad *keypad = platform_get_drvdata(pdev); | ||
218 | const struct matrix_keypad_platform_data *pdata = keypad->pdata; | ||
219 | int i; | ||
220 | |||
221 | matrix_keypad_stop(keypad->input_dev); | ||
222 | |||
223 | if (device_may_wakeup(&pdev->dev)) | ||
224 | for (i = 0; i < pdata->num_row_gpios; i++) | ||
225 | enable_irq_wake(gpio_to_irq(pdata->row_gpios[i])); | ||
226 | |||
227 | return 0; | ||
228 | } | ||
229 | |||
230 | static int matrix_keypad_resume(struct platform_device *pdev) | ||
231 | { | ||
232 | struct matrix_keypad *keypad = platform_get_drvdata(pdev); | ||
233 | const struct matrix_keypad_platform_data *pdata = keypad->pdata; | ||
234 | int i; | ||
235 | |||
236 | if (device_may_wakeup(&pdev->dev)) | ||
237 | for (i = 0; i < pdata->num_row_gpios; i++) | ||
238 | disable_irq_wake(gpio_to_irq(pdata->row_gpios[i])); | ||
239 | |||
240 | matrix_keypad_start(keypad->input_dev); | ||
241 | |||
242 | return 0; | ||
243 | } | ||
244 | #else | ||
245 | #define matrix_keypad_suspend NULL | ||
246 | #define matrix_keypad_resume NULL | ||
247 | #endif | ||
248 | |||
249 | static int __devinit init_matrix_gpio(struct platform_device *pdev, | ||
250 | struct matrix_keypad *keypad) | ||
251 | { | ||
252 | const struct matrix_keypad_platform_data *pdata = keypad->pdata; | ||
253 | int i, err = -EINVAL; | ||
254 | |||
255 | /* initialized strobe lines as outputs, activated */ | ||
256 | for (i = 0; i < pdata->num_col_gpios; i++) { | ||
257 | err = gpio_request(pdata->col_gpios[i], "matrix_kbd_col"); | ||
258 | if (err) { | ||
259 | dev_err(&pdev->dev, | ||
260 | "failed to request GPIO%d for COL%d\n", | ||
261 | pdata->col_gpios[i], i); | ||
262 | goto err_free_cols; | ||
263 | } | ||
264 | |||
265 | gpio_direction_output(pdata->col_gpios[i], !pdata->active_low); | ||
266 | } | ||
267 | |||
268 | for (i = 0; i < pdata->num_row_gpios; i++) { | ||
269 | err = gpio_request(pdata->row_gpios[i], "matrix_kbd_row"); | ||
270 | if (err) { | ||
271 | dev_err(&pdev->dev, | ||
272 | "failed to request GPIO%d for ROW%d\n", | ||
273 | pdata->row_gpios[i], i); | ||
274 | goto err_free_rows; | ||
275 | } | ||
276 | |||
277 | gpio_direction_input(pdata->row_gpios[i]); | ||
278 | } | ||
279 | |||
280 | for (i = 0; i < pdata->num_row_gpios; i++) { | ||
281 | err = request_irq(gpio_to_irq(pdata->row_gpios[i]), | ||
282 | matrix_keypad_interrupt, | ||
283 | IRQF_DISABLED | | ||
284 | IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING, | ||
285 | "matrix-keypad", keypad); | ||
286 | if (err) { | ||
287 | dev_err(&pdev->dev, | ||
288 | "Unable to acquire interrupt for GPIO line %i\n", | ||
289 | pdata->row_gpios[i]); | ||
290 | goto err_free_irqs; | ||
291 | } | ||
292 | } | ||
293 | |||
294 | /* initialized as disabled - enabled by input->open */ | ||
295 | disable_row_irqs(keypad); | ||
296 | return 0; | ||
297 | |||
298 | err_free_irqs: | ||
299 | while (--i >= 0) | ||
300 | free_irq(gpio_to_irq(pdata->row_gpios[i]), keypad); | ||
301 | i = pdata->num_row_gpios; | ||
302 | err_free_rows: | ||
303 | while (--i >= 0) | ||
304 | gpio_free(pdata->row_gpios[i]); | ||
305 | i = pdata->num_col_gpios; | ||
306 | err_free_cols: | ||
307 | while (--i >= 0) | ||
308 | gpio_free(pdata->col_gpios[i]); | ||
309 | |||
310 | return err; | ||
311 | } | ||
312 | |||
313 | static int __devinit matrix_keypad_probe(struct platform_device *pdev) | ||
314 | { | ||
315 | const struct matrix_keypad_platform_data *pdata; | ||
316 | const struct matrix_keymap_data *keymap_data; | ||
317 | struct matrix_keypad *keypad; | ||
318 | struct input_dev *input_dev; | ||
319 | unsigned short *keycodes; | ||
320 | int i; | ||
321 | int err; | ||
322 | |||
323 | pdata = pdev->dev.platform_data; | ||
324 | if (!pdata) { | ||
325 | dev_err(&pdev->dev, "no platform data defined\n"); | ||
326 | return -EINVAL; | ||
327 | } | ||
328 | |||
329 | keymap_data = pdata->keymap_data; | ||
330 | if (!keymap_data) { | ||
331 | dev_err(&pdev->dev, "no keymap data defined\n"); | ||
332 | return -EINVAL; | ||
333 | } | ||
334 | |||
335 | if (!keymap_data->max_keymap_size) { | ||
336 | dev_err(&pdev->dev, "invalid keymap data supplied\n"); | ||
337 | return -EINVAL; | ||
338 | } | ||
339 | |||
340 | keypad = kzalloc(sizeof(struct matrix_keypad), GFP_KERNEL); | ||
341 | keycodes = kzalloc(keymap_data->max_keymap_size * | ||
342 | sizeof(keypad->keycodes), | ||
343 | GFP_KERNEL); | ||
344 | input_dev = input_allocate_device(); | ||
345 | if (!keypad || !keycodes || !input_dev) { | ||
346 | err = -ENOMEM; | ||
347 | goto err_free_mem; | ||
348 | } | ||
349 | |||
350 | keypad->input_dev = input_dev; | ||
351 | keypad->pdata = pdata; | ||
352 | keypad->keycodes = keycodes; | ||
353 | keypad->stopped = true; | ||
354 | INIT_DELAYED_WORK(&keypad->work, matrix_keypad_scan); | ||
355 | spin_lock_init(&keypad->lock); | ||
356 | |||
357 | input_dev->name = pdev->name; | ||
358 | input_dev->id.bustype = BUS_HOST; | ||
359 | input_dev->dev.parent = &pdev->dev; | ||
360 | input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP); | ||
361 | input_dev->open = matrix_keypad_start; | ||
362 | input_dev->close = matrix_keypad_stop; | ||
363 | |||
364 | input_dev->keycode = keycodes; | ||
365 | input_dev->keycodesize = sizeof(*keycodes); | ||
366 | input_dev->keycodemax = keymap_data->max_keymap_size; | ||
367 | |||
368 | for (i = 0; i < keymap_data->keymap_size; i++) { | ||
369 | unsigned int key = keymap_data->keymap[i]; | ||
370 | unsigned int row = KEY_ROW(key); | ||
371 | unsigned int col = KEY_COL(key); | ||
372 | unsigned short code = KEY_VAL(key); | ||
373 | |||
374 | keycodes[(row << 4) + col] = code; | ||
375 | __set_bit(code, input_dev->keybit); | ||
376 | } | ||
377 | __clear_bit(KEY_RESERVED, input_dev->keybit); | ||
378 | |||
379 | input_set_capability(input_dev, EV_MSC, MSC_SCAN); | ||
380 | input_set_drvdata(input_dev, keypad); | ||
381 | |||
382 | err = init_matrix_gpio(pdev, keypad); | ||
383 | if (err) | ||
384 | goto err_free_mem; | ||
385 | |||
386 | err = input_register_device(keypad->input_dev); | ||
387 | if (err) | ||
388 | goto err_free_mem; | ||
389 | |||
390 | device_init_wakeup(&pdev->dev, pdata->wakeup); | ||
391 | platform_set_drvdata(pdev, keypad); | ||
392 | |||
393 | return 0; | ||
394 | |||
395 | err_free_mem: | ||
396 | input_free_device(input_dev); | ||
397 | kfree(keycodes); | ||
398 | kfree(keypad); | ||
399 | return err; | ||
400 | } | ||
401 | |||
402 | static int __devexit matrix_keypad_remove(struct platform_device *pdev) | ||
403 | { | ||
404 | struct matrix_keypad *keypad = platform_get_drvdata(pdev); | ||
405 | const struct matrix_keypad_platform_data *pdata = keypad->pdata; | ||
406 | int i; | ||
407 | |||
408 | device_init_wakeup(&pdev->dev, 0); | ||
409 | |||
410 | for (i = 0; i < pdata->num_row_gpios; i++) { | ||
411 | free_irq(gpio_to_irq(pdata->row_gpios[i]), keypad); | ||
412 | gpio_free(pdata->row_gpios[i]); | ||
413 | } | ||
414 | |||
415 | for (i = 0; i < pdata->num_col_gpios; i++) | ||
416 | gpio_free(pdata->col_gpios[i]); | ||
417 | |||
418 | input_unregister_device(keypad->input_dev); | ||
419 | platform_set_drvdata(pdev, NULL); | ||
420 | kfree(keypad->keycodes); | ||
421 | kfree(keypad); | ||
422 | |||
423 | return 0; | ||
424 | } | ||
425 | |||
426 | static struct platform_driver matrix_keypad_driver = { | ||
427 | .probe = matrix_keypad_probe, | ||
428 | .remove = __devexit_p(matrix_keypad_remove), | ||
429 | .suspend = matrix_keypad_suspend, | ||
430 | .resume = matrix_keypad_resume, | ||
431 | .driver = { | ||
432 | .name = "matrix-keypad", | ||
433 | .owner = THIS_MODULE, | ||
434 | }, | ||
435 | }; | ||
436 | |||
437 | static int __init matrix_keypad_init(void) | ||
438 | { | ||
439 | return platform_driver_register(&matrix_keypad_driver); | ||
440 | } | ||
441 | |||
442 | static void __exit matrix_keypad_exit(void) | ||
443 | { | ||
444 | platform_driver_unregister(&matrix_keypad_driver); | ||
445 | } | ||
446 | |||
447 | module_init(matrix_keypad_init); | ||
448 | module_exit(matrix_keypad_exit); | ||
449 | |||
450 | MODULE_AUTHOR("Marek Vasut <marek.vasut@gmail.com>"); | ||
451 | MODULE_DESCRIPTION("GPIO Driven Matrix Keypad Driver"); | ||
452 | MODULE_LICENSE("GPL v2"); | ||
453 | MODULE_ALIAS("platform:matrix-keypad"); | ||
diff --git a/drivers/input/mouse/gpio_mouse.c b/drivers/input/mouse/gpio_mouse.c index 5e5eb88d8d1e..7b6ce178f1b6 100644 --- a/drivers/input/mouse/gpio_mouse.c +++ b/drivers/input/mouse/gpio_mouse.c | |||
@@ -46,7 +46,7 @@ static void gpio_mouse_scan(struct input_polled_dev *dev) | |||
46 | input_sync(input); | 46 | input_sync(input); |
47 | } | 47 | } |
48 | 48 | ||
49 | static int __init gpio_mouse_probe(struct platform_device *pdev) | 49 | static int __devinit gpio_mouse_probe(struct platform_device *pdev) |
50 | { | 50 | { |
51 | struct gpio_mouse_platform_data *pdata = pdev->dev.platform_data; | 51 | struct gpio_mouse_platform_data *pdata = pdev->dev.platform_data; |
52 | struct input_polled_dev *input_poll; | 52 | struct input_polled_dev *input_poll; |
@@ -170,10 +170,8 @@ static int __devexit gpio_mouse_remove(struct platform_device *pdev) | |||
170 | return 0; | 170 | return 0; |
171 | } | 171 | } |
172 | 172 | ||
173 | /* work with hotplug and coldplug */ | ||
174 | MODULE_ALIAS("platform:gpio_mouse"); | ||
175 | |||
176 | static struct platform_driver gpio_mouse_device_driver = { | 173 | static struct platform_driver gpio_mouse_device_driver = { |
174 | .probe = gpio_mouse_probe, | ||
177 | .remove = __devexit_p(gpio_mouse_remove), | 175 | .remove = __devexit_p(gpio_mouse_remove), |
178 | .driver = { | 176 | .driver = { |
179 | .name = "gpio_mouse", | 177 | .name = "gpio_mouse", |
@@ -183,8 +181,7 @@ static struct platform_driver gpio_mouse_device_driver = { | |||
183 | 181 | ||
184 | static int __init gpio_mouse_init(void) | 182 | static int __init gpio_mouse_init(void) |
185 | { | 183 | { |
186 | return platform_driver_probe(&gpio_mouse_device_driver, | 184 | return platform_driver_register(&gpio_mouse_device_driver); |
187 | gpio_mouse_probe); | ||
188 | } | 185 | } |
189 | module_init(gpio_mouse_init); | 186 | module_init(gpio_mouse_init); |
190 | 187 | ||
@@ -197,3 +194,5 @@ module_exit(gpio_mouse_exit); | |||
197 | MODULE_AUTHOR("Hans-Christian Egtvedt <hcegtvedt@atmel.com>"); | 194 | MODULE_AUTHOR("Hans-Christian Egtvedt <hcegtvedt@atmel.com>"); |
198 | MODULE_DESCRIPTION("GPIO mouse driver"); | 195 | MODULE_DESCRIPTION("GPIO mouse driver"); |
199 | MODULE_LICENSE("GPL"); | 196 | MODULE_LICENSE("GPL"); |
197 | MODULE_ALIAS("platform:gpio_mouse"); /* work with hotplug and coldplug */ | ||
198 | |||
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index fb8a3cd3ffd0..924e8ed7f2cf 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
@@ -392,6 +392,34 @@ static struct dmi_system_id __initdata i8042_dmi_reset_table[] = { | |||
392 | DMI_MATCH(DMI_BOARD_VENDOR, "LG Electronics Inc."), | 392 | DMI_MATCH(DMI_BOARD_VENDOR, "LG Electronics Inc."), |
393 | }, | 393 | }, |
394 | }, | 394 | }, |
395 | { | ||
396 | .ident = "Acer Aspire One 150", | ||
397 | .matches = { | ||
398 | DMI_MATCH(DMI_SYS_VENDOR, "Acer"), | ||
399 | DMI_MATCH(DMI_PRODUCT_NAME, "AOA150"), | ||
400 | }, | ||
401 | }, | ||
402 | { | ||
403 | .ident = "Advent 4211", | ||
404 | .matches = { | ||
405 | DMI_MATCH(DMI_SYS_VENDOR, "DIXONSXP"), | ||
406 | DMI_MATCH(DMI_PRODUCT_NAME, "Advent 4211"), | ||
407 | }, | ||
408 | }, | ||
409 | { | ||
410 | .ident = "Medion Akoya Mini E1210", | ||
411 | .matches = { | ||
412 | DMI_MATCH(DMI_SYS_VENDOR, "MEDION"), | ||
413 | DMI_MATCH(DMI_PRODUCT_NAME, "E1210"), | ||
414 | }, | ||
415 | }, | ||
416 | { | ||
417 | .ident = "Mivvy M310", | ||
418 | .matches = { | ||
419 | DMI_MATCH(DMI_SYS_VENDOR, "VIOOO"), | ||
420 | DMI_MATCH(DMI_PRODUCT_NAME, "N10"), | ||
421 | }, | ||
422 | }, | ||
395 | { } | 423 | { } |
396 | }; | 424 | }; |
397 | 425 | ||
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index f919bf57293c..582245c497eb 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c | |||
@@ -934,10 +934,11 @@ static bool i8042_suspended; | |||
934 | 934 | ||
935 | static int i8042_suspend(struct platform_device *dev, pm_message_t state) | 935 | static int i8042_suspend(struct platform_device *dev, pm_message_t state) |
936 | { | 936 | { |
937 | if (!i8042_suspended && state.event == PM_EVENT_SUSPEND) { | 937 | if (!i8042_suspended && state.event == PM_EVENT_SUSPEND) |
938 | i8042_controller_reset(); | 938 | i8042_controller_reset(); |
939 | i8042_suspended = true; | 939 | |
940 | } | 940 | i8042_suspended = state.event == PM_EVENT_SUSPEND || |
941 | state.event == PM_EVENT_FREEZE; | ||
941 | 942 | ||
942 | return 0; | 943 | return 0; |
943 | } | 944 | } |
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index fb17573f8f2d..d66f4944f2a0 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c | |||
@@ -935,10 +935,11 @@ static int serio_suspend(struct device *dev, pm_message_t state) | |||
935 | { | 935 | { |
936 | struct serio *serio = to_serio_port(dev); | 936 | struct serio *serio = to_serio_port(dev); |
937 | 937 | ||
938 | if (!serio->suspended && state.event == PM_EVENT_SUSPEND) { | 938 | if (!serio->suspended && state.event == PM_EVENT_SUSPEND) |
939 | serio_cleanup(serio); | 939 | serio_cleanup(serio); |
940 | serio->suspended = true; | 940 | |
941 | } | 941 | serio->suspended = state.event == PM_EVENT_SUSPEND || |
942 | state.event == PM_EVENT_FREEZE; | ||
942 | 943 | ||
943 | return 0; | 944 | return 0; |
944 | } | 945 | } |
diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c index 38bf86384aeb..c896d6a21b7e 100644 --- a/drivers/input/tablet/wacom_wac.c +++ b/drivers/input/tablet/wacom_wac.c | |||
@@ -384,6 +384,8 @@ static int wacom_intuos_inout(struct wacom_wac *wacom, void *wcombo) | |||
384 | wacom_report_key(wcombo, BTN_STYLUS2, 0); | 384 | wacom_report_key(wcombo, BTN_STYLUS2, 0); |
385 | wacom_report_key(wcombo, BTN_TOUCH, 0); | 385 | wacom_report_key(wcombo, BTN_TOUCH, 0); |
386 | wacom_report_abs(wcombo, ABS_WHEEL, 0); | 386 | wacom_report_abs(wcombo, ABS_WHEEL, 0); |
387 | if (wacom->features->type >= INTUOS3S) | ||
388 | wacom_report_abs(wcombo, ABS_Z, 0); | ||
387 | } | 389 | } |
388 | wacom_report_key(wcombo, wacom->tool[idx], 0); | 390 | wacom_report_key(wcombo, wacom->tool[idx], 0); |
389 | wacom_report_abs(wcombo, ABS_MISC, 0); /* reset tool id */ | 391 | wacom_report_abs(wcombo, ABS_MISC, 0); /* reset tool id */ |
@@ -836,6 +838,7 @@ static struct wacom_features wacom_features[] = { | |||
836 | { "Wacom DTU710", 8, 34080, 27660, 511, 0, PL }, | 838 | { "Wacom DTU710", 8, 34080, 27660, 511, 0, PL }, |
837 | { "Wacom DTF521", 8, 6282, 4762, 511, 0, PL }, | 839 | { "Wacom DTF521", 8, 6282, 4762, 511, 0, PL }, |
838 | { "Wacom DTF720", 8, 6858, 5506, 511, 0, PL }, | 840 | { "Wacom DTF720", 8, 6858, 5506, 511, 0, PL }, |
841 | { "Wacom DTF720a", 8, 6858, 5506, 511, 0, PL }, | ||
839 | { "Wacom Cintiq Partner",8, 20480, 15360, 511, 0, PTU }, | 842 | { "Wacom Cintiq Partner",8, 20480, 15360, 511, 0, PTU }, |
840 | { "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 31, INTUOS }, | 843 | { "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 31, INTUOS }, |
841 | { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 31, INTUOS }, | 844 | { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 31, INTUOS }, |
@@ -897,8 +900,9 @@ static struct usb_device_id wacom_ids[] = { | |||
897 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x37) }, | 900 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x37) }, |
898 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x38) }, | 901 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x38) }, |
899 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x39) }, | 902 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x39) }, |
900 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC0) }, | ||
901 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC4) }, | 903 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC4) }, |
904 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC0) }, | ||
905 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0xC2) }, | ||
902 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x03) }, | 906 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x03) }, |
903 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x41) }, | 907 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x41) }, |
904 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x42) }, | 908 | { USB_DEVICE(USB_VENDOR_ID_WACOM, 0x42) }, |
diff --git a/drivers/isdn/gigaset/ev-layer.c b/drivers/isdn/gigaset/ev-layer.c index ec5169604a6a..2d91049571a4 100644 --- a/drivers/isdn/gigaset/ev-layer.c +++ b/drivers/isdn/gigaset/ev-layer.c | |||
@@ -294,32 +294,33 @@ struct reply_t gigaset_tab_cid[] = | |||
294 | {RSP_OK, 604,604, -1, 605, 5, {ACT_CMD+AT_MSN}}, | 294 | {RSP_OK, 604,604, -1, 605, 5, {ACT_CMD+AT_MSN}}, |
295 | {RSP_OK, 605,605, -1, 606, 5, {ACT_CMD+AT_ISO}}, | 295 | {RSP_OK, 605,605, -1, 606, 5, {ACT_CMD+AT_ISO}}, |
296 | {RSP_NULL, 605,605, -1, 606, 5, {ACT_CMD+AT_ISO}}, | 296 | {RSP_NULL, 605,605, -1, 606, 5, {ACT_CMD+AT_ISO}}, |
297 | {RSP_OK, 606,606, -1, 607, 5, {0}, "+VLS=17\r"}, /* set "Endgeraetemodus" */ | 297 | {RSP_OK, 606,606, -1, 607, 5, {0}, "+VLS=17\r"}, |
298 | {RSP_OK, 607,607, -1, 608,-1}, | 298 | {RSP_OK, 607,607, -1, 608,-1}, |
299 | //{RSP_ZSAU, 608,608,ZSAU_PROCEEDING, 608, 0, {ACT_ERROR}},//DELETE | ||
300 | {RSP_ZSAU, 608,608,ZSAU_PROCEEDING, 609, 5, {ACT_CMD+AT_DIAL}}, | 299 | {RSP_ZSAU, 608,608,ZSAU_PROCEEDING, 609, 5, {ACT_CMD+AT_DIAL}}, |
301 | {RSP_OK, 609,609, -1, 650, 0, {ACT_DIALING}}, | 300 | {RSP_OK, 609,609, -1, 650, 0, {ACT_DIALING}}, |
302 | 301 | ||
303 | {RSP_ZVLS, 608,608, 17, -1,-1, {ACT_DEBUG}}, | ||
304 | {RSP_ZCTP, 609,609, -1, -1,-1, {ACT_DEBUG}}, | ||
305 | {RSP_ZCPN, 609,609, -1, -1,-1, {ACT_DEBUG}}, | ||
306 | {RSP_ERROR, 601,609, -1, 0, 0, {ACT_ABORTDIAL}}, | 302 | {RSP_ERROR, 601,609, -1, 0, 0, {ACT_ABORTDIAL}}, |
307 | {EV_TIMEOUT, 601,609, -1, 0, 0, {ACT_ABORTDIAL}}, | 303 | {EV_TIMEOUT, 601,609, -1, 0, 0, {ACT_ABORTDIAL}}, |
308 | 304 | ||
309 | /* dialing */ | 305 | /* optional dialing responses */ |
310 | {RSP_ZCTP, 650,650, -1, -1,-1, {ACT_DEBUG}}, | 306 | {EV_BC_OPEN, 650,650, -1, 651,-1}, |
311 | {RSP_ZCPN, 650,650, -1, -1,-1, {ACT_DEBUG}}, | 307 | {RSP_ZVLS, 608,651, 17, -1,-1, {ACT_DEBUG}}, |
312 | {RSP_ZSAU, 650,650,ZSAU_CALL_DELIVERED, -1,-1, {ACT_DEBUG}}, /* some devices don't send this */ | 308 | {RSP_ZCTP, 609,651, -1, -1,-1, {ACT_DEBUG}}, |
313 | 309 | {RSP_ZCPN, 609,651, -1, -1,-1, {ACT_DEBUG}}, | |
314 | /* connection established */ | 310 | {RSP_ZSAU, 650,651,ZSAU_CALL_DELIVERED, -1,-1, {ACT_DEBUG}}, |
315 | {RSP_ZSAU, 650,650,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT}}, //FIXME -> DLE1 | 311 | |
316 | {RSP_ZSAU, 750,750,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT}}, //FIXME -> DLE1 | 312 | /* connect */ |
317 | 313 | {RSP_ZSAU, 650,650,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT}}, | |
318 | {EV_BC_OPEN, 800,800, -1, 800,-1, {ACT_NOTIFY_BC_UP}}, //FIXME new constate + timeout | 314 | {RSP_ZSAU, 651,651,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT, |
315 | ACT_NOTIFY_BC_UP}}, | ||
316 | {RSP_ZSAU, 750,750,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT}}, | ||
317 | {RSP_ZSAU, 751,751,ZSAU_ACTIVE, 800,-1, {ACT_CONNECT, | ||
318 | ACT_NOTIFY_BC_UP}}, | ||
319 | {EV_BC_OPEN, 800,800, -1, 800,-1, {ACT_NOTIFY_BC_UP}}, | ||
319 | 320 | ||
320 | /* remote hangup */ | 321 | /* remote hangup */ |
321 | {RSP_ZSAU, 650,650,ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEREJECT}}, | 322 | {RSP_ZSAU, 650,651,ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEREJECT}}, |
322 | {RSP_ZSAU, 750,750,ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEHUP}}, | 323 | {RSP_ZSAU, 750,751,ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEHUP}}, |
323 | {RSP_ZSAU, 800,800,ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEHUP}}, | 324 | {RSP_ZSAU, 800,800,ZSAU_DISCONNECT_IND, 0, 0, {ACT_REMOTEHUP}}, |
324 | 325 | ||
325 | /* hangup */ | 326 | /* hangup */ |
@@ -358,7 +359,8 @@ struct reply_t gigaset_tab_cid[] = | |||
358 | {RSP_ZSAU, 700,729,ZSAU_ACTIVE, 0, 0, {ACT_ABORTACCEPT}}, | 359 | {RSP_ZSAU, 700,729,ZSAU_ACTIVE, 0, 0, {ACT_ABORTACCEPT}}, |
359 | {RSP_ZSAU, 700,729,ZSAU_DISCONNECT_IND, 0, 0, {ACT_ABORTACCEPT}}, | 360 | {RSP_ZSAU, 700,729,ZSAU_DISCONNECT_IND, 0, 0, {ACT_ABORTACCEPT}}, |
360 | 361 | ||
361 | {EV_TIMEOUT, 750,750, -1, 0, 0, {ACT_CONNTIMEOUT}}, | 362 | {EV_BC_OPEN, 750,750, -1, 751,-1}, |
363 | {EV_TIMEOUT, 750,751, -1, 0, 0, {ACT_CONNTIMEOUT}}, | ||
362 | 364 | ||
363 | /* B channel closed (general case) */ | 365 | /* B channel closed (general case) */ |
364 | {EV_BC_CLOSED, -1, -1, -1, -1,-1, {ACT_NOTIFY_BC_DOWN}}, //FIXME | 366 | {EV_BC_CLOSED, -1, -1, -1, -1,-1, {ACT_NOTIFY_BC_DOWN}}, //FIXME |
@@ -876,12 +878,6 @@ static void bchannel_down(struct bc_state *bcs) | |||
876 | 878 | ||
877 | static void bchannel_up(struct bc_state *bcs) | 879 | static void bchannel_up(struct bc_state *bcs) |
878 | { | 880 | { |
879 | if (!(bcs->chstate & CHS_D_UP)) { | ||
880 | dev_notice(bcs->cs->dev, "%s: D channel not up\n", __func__); | ||
881 | bcs->chstate |= CHS_D_UP; | ||
882 | gigaset_i4l_channel_cmd(bcs, ISDN_STAT_DCONN); | ||
883 | } | ||
884 | |||
885 | if (bcs->chstate & CHS_B_UP) { | 881 | if (bcs->chstate & CHS_B_UP) { |
886 | dev_notice(bcs->cs->dev, "%s: B channel already up\n", | 882 | dev_notice(bcs->cs->dev, "%s: B channel already up\n", |
887 | __func__); | 883 | __func__); |
diff --git a/drivers/isdn/gigaset/isocdata.c b/drivers/isdn/gigaset/isocdata.c index db3a1e4cd489..bed38fcc432b 100644 --- a/drivers/isdn/gigaset/isocdata.c +++ b/drivers/isdn/gigaset/isocdata.c | |||
@@ -174,12 +174,6 @@ int gigaset_isowbuf_getbytes(struct isowbuf_t *iwb, int size) | |||
174 | pr_err("invalid size %d\n", size); | 174 | pr_err("invalid size %d\n", size); |
175 | return -EINVAL; | 175 | return -EINVAL; |
176 | } | 176 | } |
177 | src = iwb->read; | ||
178 | if (unlikely(limit >= BAS_OUTBUFSIZE + BAS_OUTBUFPAD || | ||
179 | (read < src && limit >= src))) { | ||
180 | pr_err("isoc write buffer frame reservation violated\n"); | ||
181 | return -EFAULT; | ||
182 | } | ||
183 | #endif | 177 | #endif |
184 | 178 | ||
185 | if (read < write) { | 179 | if (read < write) { |
diff --git a/drivers/isdn/hisax/hfc_usb.c b/drivers/isdn/hisax/hfc_usb.c index 8df889b0c1a9..9de54202c90c 100644 --- a/drivers/isdn/hisax/hfc_usb.c +++ b/drivers/isdn/hisax/hfc_usb.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <linux/kernel_stat.h> | 37 | #include <linux/kernel_stat.h> |
38 | #include <linux/usb.h> | 38 | #include <linux/usb.h> |
39 | #include <linux/kernel.h> | 39 | #include <linux/kernel.h> |
40 | #include <linux/smp_lock.h> | ||
41 | #include <linux/sched.h> | 40 | #include <linux/sched.h> |
42 | #include <linux/moduleparam.h> | 41 | #include <linux/moduleparam.h> |
43 | #include "hisax.h" | 42 | #include "hisax.h" |
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c index b4d4522e5071..2881a66c1aa9 100644 --- a/drivers/isdn/i4l/isdn_tty.c +++ b/drivers/isdn/i4l/isdn_tty.c | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #include <linux/isdn.h> | 14 | #include <linux/isdn.h> |
15 | #include <linux/delay.h> | 15 | #include <linux/delay.h> |
16 | #include <linux/smp_lock.h> | ||
16 | #include "isdn_common.h" | 17 | #include "isdn_common.h" |
17 | #include "isdn_tty.h" | 18 | #include "isdn_tty.h" |
18 | #ifdef CONFIG_ISDN_AUDIO | 19 | #ifdef CONFIG_ISDN_AUDIO |
diff --git a/drivers/isdn/mISDN/stack.c b/drivers/isdn/mISDN/stack.c index e2f45019ebf0..3e1532a180ff 100644 --- a/drivers/isdn/mISDN/stack.c +++ b/drivers/isdn/mISDN/stack.c | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | #include <linux/mISDNif.h> | 18 | #include <linux/mISDNif.h> |
19 | #include <linux/kthread.h> | 19 | #include <linux/kthread.h> |
20 | #include <linux/smp_lock.h> | ||
20 | #include "core.h" | 21 | #include "core.h" |
21 | 22 | ||
22 | static u_int *debug; | 23 | static u_int *debug; |
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 9933eb861c71..529e2ba505c3 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c | |||
@@ -776,7 +776,7 @@ static void kcryptd_crypt_write_convert(struct dm_crypt_io *io) | |||
776 | * But don't wait if split was due to the io size restriction | 776 | * But don't wait if split was due to the io size restriction |
777 | */ | 777 | */ |
778 | if (unlikely(out_of_pages)) | 778 | if (unlikely(out_of_pages)) |
779 | congestion_wait(WRITE, HZ/100); | 779 | congestion_wait(BLK_RW_ASYNC, HZ/100); |
780 | 780 | ||
781 | /* | 781 | /* |
782 | * With async crypto it is unsafe to share the crypto context | 782 | * With async crypto it is unsafe to share the crypto context |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 0f4a70c43ffc..d4351ff0849f 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -1756,9 +1756,10 @@ static void print_sb_1(struct mdp_superblock_1 *sb) | |||
1756 | __u8 *uuid; | 1756 | __u8 *uuid; |
1757 | 1757 | ||
1758 | uuid = sb->set_uuid; | 1758 | uuid = sb->set_uuid; |
1759 | printk(KERN_INFO "md: SB: (V:%u) (F:0x%08x) Array-ID:<%02x%02x%02x%02x" | 1759 | printk(KERN_INFO |
1760 | ":%02x%02x:%02x%02x:%02x%02x:%02x%02x%02x%02x%02x%02x>\n" | 1760 | "md: SB: (V:%u) (F:0x%08x) Array-ID:<%02x%02x%02x%02x" |
1761 | KERN_INFO "md: Name: \"%s\" CT:%llu\n", | 1761 | ":%02x%02x:%02x%02x:%02x%02x:%02x%02x%02x%02x%02x%02x>\n" |
1762 | "md: Name: \"%s\" CT:%llu\n", | ||
1762 | le32_to_cpu(sb->major_version), | 1763 | le32_to_cpu(sb->major_version), |
1763 | le32_to_cpu(sb->feature_map), | 1764 | le32_to_cpu(sb->feature_map), |
1764 | uuid[0], uuid[1], uuid[2], uuid[3], | 1765 | uuid[0], uuid[1], uuid[2], uuid[3], |
@@ -1770,12 +1771,13 @@ static void print_sb_1(struct mdp_superblock_1 *sb) | |||
1770 | & MD_SUPERBLOCK_1_TIME_SEC_MASK); | 1771 | & MD_SUPERBLOCK_1_TIME_SEC_MASK); |
1771 | 1772 | ||
1772 | uuid = sb->device_uuid; | 1773 | uuid = sb->device_uuid; |
1773 | printk(KERN_INFO "md: L%u SZ%llu RD:%u LO:%u CS:%u DO:%llu DS:%llu SO:%llu" | 1774 | printk(KERN_INFO |
1775 | "md: L%u SZ%llu RD:%u LO:%u CS:%u DO:%llu DS:%llu SO:%llu" | ||
1774 | " RO:%llu\n" | 1776 | " RO:%llu\n" |
1775 | KERN_INFO "md: Dev:%08x UUID: %02x%02x%02x%02x:%02x%02x:%02x%02x:%02x%02x" | 1777 | "md: Dev:%08x UUID: %02x%02x%02x%02x:%02x%02x:%02x%02x:%02x%02x" |
1776 | ":%02x%02x%02x%02x%02x%02x\n" | 1778 | ":%02x%02x%02x%02x%02x%02x\n" |
1777 | KERN_INFO "md: (F:0x%08x) UT:%llu Events:%llu ResyncOffset:%llu CSUM:0x%08x\n" | 1779 | "md: (F:0x%08x) UT:%llu Events:%llu ResyncOffset:%llu CSUM:0x%08x\n" |
1778 | KERN_INFO "md: (MaxDev:%u) \n", | 1780 | "md: (MaxDev:%u) \n", |
1779 | le32_to_cpu(sb->level), | 1781 | le32_to_cpu(sb->level), |
1780 | (unsigned long long)le64_to_cpu(sb->size), | 1782 | (unsigned long long)le64_to_cpu(sb->size), |
1781 | le32_to_cpu(sb->raid_disks), | 1783 | le32_to_cpu(sb->raid_disks), |
diff --git a/drivers/media/common/tuners/tuner-xc2028.c b/drivers/media/common/tuners/tuner-xc2028.c index b6da9c3873fe..aa20ce8cc668 100644 --- a/drivers/media/common/tuners/tuner-xc2028.c +++ b/drivers/media/common/tuners/tuner-xc2028.c | |||
@@ -1096,8 +1096,19 @@ static int xc2028_set_params(struct dvb_frontend *fe, | |||
1096 | } | 1096 | } |
1097 | 1097 | ||
1098 | /* All S-code tables need a 200kHz shift */ | 1098 | /* All S-code tables need a 200kHz shift */ |
1099 | if (priv->ctrl.demod) | 1099 | if (priv->ctrl.demod) { |
1100 | demod = priv->ctrl.demod + 200; | 1100 | demod = priv->ctrl.demod + 200; |
1101 | /* | ||
1102 | * The DTV7 S-code table needs a 700 kHz shift. | ||
1103 | * Thanks to Terry Wu <terrywu2009@gmail.com> for reporting this | ||
1104 | * | ||
1105 | * DTV7 is only used in Australia. Germany or Italy may also | ||
1106 | * use this firmware after initialization, but a tune to a UHF | ||
1107 | * channel should then cause DTV78 to be used. | ||
1108 | */ | ||
1109 | if (type & DTV7) | ||
1110 | demod += 500; | ||
1111 | } | ||
1101 | 1112 | ||
1102 | return generic_set_freq(fe, p->frequency, | 1113 | return generic_set_freq(fe, p->frequency, |
1103 | T_DIGITAL_TV, type, 0, demod); | 1114 | T_DIGITAL_TV, type, 0, demod); |
diff --git a/drivers/media/dvb/bt8xx/dst_ca.c b/drivers/media/dvb/bt8xx/dst_ca.c index 4601b059b2b2..0e246eaad05a 100644 --- a/drivers/media/dvb/bt8xx/dst_ca.c +++ b/drivers/media/dvb/bt8xx/dst_ca.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/smp_lock.h> | ||
24 | #include <linux/string.h> | 25 | #include <linux/string.h> |
25 | #include <linux/dvb/ca.h> | 26 | #include <linux/dvb/ca.h> |
26 | #include "dvbdev.h" | 27 | #include "dvbdev.h" |
diff --git a/drivers/media/dvb/dvb-core/dvbdev.h b/drivers/media/dvb/dvb-core/dvbdev.h index 79927305e84d..487919bea7ae 100644 --- a/drivers/media/dvb/dvb-core/dvbdev.h +++ b/drivers/media/dvb/dvb-core/dvbdev.h | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <linux/poll.h> | 27 | #include <linux/poll.h> |
28 | #include <linux/fs.h> | 28 | #include <linux/fs.h> |
29 | #include <linux/list.h> | 29 | #include <linux/list.h> |
30 | #include <linux/smp_lock.h> | ||
31 | 30 | ||
32 | #define DVB_MAJOR 212 | 31 | #define DVB_MAJOR 212 |
33 | 32 | ||
diff --git a/drivers/media/dvb/ttpci/Kconfig b/drivers/media/dvb/ttpci/Kconfig index 68eb4493f991..d8d4214fd65f 100644 --- a/drivers/media/dvb/ttpci/Kconfig +++ b/drivers/media/dvb/ttpci/Kconfig | |||
@@ -1,5 +1,6 @@ | |||
1 | config TTPCI_EEPROM | 1 | config TTPCI_EEPROM |
2 | tristate | 2 | tristate |
3 | depends on I2C | ||
3 | default n | 4 | default n |
4 | 5 | ||
5 | config DVB_AV7110 | 6 | config DVB_AV7110 |
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c index d1d959ed37b7..8d65c652ba50 100644 --- a/drivers/media/dvb/ttpci/av7110.c +++ b/drivers/media/dvb/ttpci/av7110.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include <linux/fs.h> | 36 | #include <linux/fs.h> |
37 | #include <linux/timer.h> | 37 | #include <linux/timer.h> |
38 | #include <linux/poll.h> | 38 | #include <linux/poll.h> |
39 | #include <linux/smp_lock.h> | ||
40 | 39 | ||
41 | #include <linux/kernel.h> | 40 | #include <linux/kernel.h> |
42 | #include <linux/sched.h> | 41 | #include <linux/sched.h> |
diff --git a/drivers/media/radio/radio-mr800.c b/drivers/media/radio/radio-mr800.c index 837467f93805..575bf9d89419 100644 --- a/drivers/media/radio/radio-mr800.c +++ b/drivers/media/radio/radio-mr800.c | |||
@@ -58,6 +58,7 @@ | |||
58 | #include <linux/module.h> | 58 | #include <linux/module.h> |
59 | #include <linux/init.h> | 59 | #include <linux/init.h> |
60 | #include <linux/slab.h> | 60 | #include <linux/slab.h> |
61 | #include <linux/smp_lock.h> | ||
61 | #include <linux/input.h> | 62 | #include <linux/input.h> |
62 | #include <linux/videodev2.h> | 63 | #include <linux/videodev2.h> |
63 | #include <media/v4l2-device.h> | 64 | #include <media/v4l2-device.h> |
diff --git a/drivers/media/radio/radio-si470x.c b/drivers/media/radio/radio-si470x.c index 640421ceb24a..e85f318b4d2b 100644 --- a/drivers/media/radio/radio-si470x.c +++ b/drivers/media/radio/radio-si470x.c | |||
@@ -127,6 +127,7 @@ | |||
127 | #include <linux/module.h> | 127 | #include <linux/module.h> |
128 | #include <linux/init.h> | 128 | #include <linux/init.h> |
129 | #include <linux/slab.h> | 129 | #include <linux/slab.h> |
130 | #include <linux/smp_lock.h> | ||
130 | #include <linux/input.h> | 131 | #include <linux/input.h> |
131 | #include <linux/usb.h> | 132 | #include <linux/usb.h> |
132 | #include <linux/hid.h> | 133 | #include <linux/hid.h> |
@@ -1200,7 +1201,7 @@ static int si470x_fops_release(struct file *file) | |||
1200 | video_unregister_device(radio->videodev); | 1201 | video_unregister_device(radio->videodev); |
1201 | kfree(radio->buffer); | 1202 | kfree(radio->buffer); |
1202 | kfree(radio); | 1203 | kfree(radio); |
1203 | goto done; | 1204 | goto unlock; |
1204 | } | 1205 | } |
1205 | 1206 | ||
1206 | /* stop rds reception */ | 1207 | /* stop rds reception */ |
@@ -1213,9 +1214,8 @@ static int si470x_fops_release(struct file *file) | |||
1213 | retval = si470x_stop(radio); | 1214 | retval = si470x_stop(radio); |
1214 | usb_autopm_put_interface(radio->intf); | 1215 | usb_autopm_put_interface(radio->intf); |
1215 | } | 1216 | } |
1216 | 1217 | unlock: | |
1217 | mutex_unlock(&radio->disconnect_lock); | 1218 | mutex_unlock(&radio->disconnect_lock); |
1218 | |||
1219 | done: | 1219 | done: |
1220 | return retval; | 1220 | return retval; |
1221 | } | 1221 | } |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 061e147f6f26..84b6fc15519d 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -312,6 +312,14 @@ config VIDEO_OV7670 | |||
312 | OV7670 VGA camera. It currently only works with the M88ALP01 | 312 | OV7670 VGA camera. It currently only works with the M88ALP01 |
313 | controller. | 313 | controller. |
314 | 314 | ||
315 | config VIDEO_MT9V011 | ||
316 | tristate "Micron mt9v011 sensor support" | ||
317 | depends on I2C && VIDEO_V4L2 | ||
318 | ---help--- | ||
319 | This is a Video4Linux2 sensor-level driver for the Micron | ||
320 | mt0v011 1.3 Mpixel camera. It currently only works with the | ||
321 | em28xx driver. | ||
322 | |||
315 | config VIDEO_TCM825X | 323 | config VIDEO_TCM825X |
316 | tristate "TCM825x camera sensor support" | 324 | tristate "TCM825x camera sensor support" |
317 | depends on I2C && VIDEO_V4L2 | 325 | depends on I2C && VIDEO_V4L2 |
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 7fb3add1b387..9f2e3214a482 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile | |||
@@ -69,6 +69,7 @@ obj-$(CONFIG_VIDEO_UPD64083) += upd64083.o | |||
69 | obj-$(CONFIG_VIDEO_OV7670) += ov7670.o | 69 | obj-$(CONFIG_VIDEO_OV7670) += ov7670.o |
70 | obj-$(CONFIG_VIDEO_TCM825X) += tcm825x.o | 70 | obj-$(CONFIG_VIDEO_TCM825X) += tcm825x.o |
71 | obj-$(CONFIG_VIDEO_TVEEPROM) += tveeprom.o | 71 | obj-$(CONFIG_VIDEO_TVEEPROM) += tveeprom.o |
72 | obj-$(CONFIG_VIDEO_MT9V011) += mt9v011.o | ||
72 | 73 | ||
73 | obj-$(CONFIG_SOC_CAMERA_MT9M001) += mt9m001.o | 74 | obj-$(CONFIG_SOC_CAMERA_MT9M001) += mt9m001.o |
74 | obj-$(CONFIG_SOC_CAMERA_MT9M111) += mt9m111.o | 75 | obj-$(CONFIG_SOC_CAMERA_MT9M111) += mt9m111.o |
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 5eb1464af670..d147d29bb0d3 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/fs.h> | 41 | #include <linux/fs.h> |
42 | #include <linux/kernel.h> | 42 | #include <linux/kernel.h> |
43 | #include <linux/sched.h> | 43 | #include <linux/sched.h> |
44 | #include <linux/smp_lock.h> | ||
44 | #include <linux/interrupt.h> | 45 | #include <linux/interrupt.h> |
45 | #include <linux/kdev_t.h> | 46 | #include <linux/kdev_t.h> |
46 | #include "bttvp.h" | 47 | #include "bttvp.h" |
diff --git a/drivers/media/video/cx18/cx18-cards.c b/drivers/media/video/cx18/cx18-cards.c index c92a25036f0e..36f2d76006fd 100644 --- a/drivers/media/video/cx18/cx18-cards.c +++ b/drivers/media/video/cx18/cx18-cards.c | |||
@@ -198,11 +198,14 @@ static const struct cx18_card_pci_info cx18_pci_mpc718[] = { | |||
198 | 198 | ||
199 | static const struct cx18_card cx18_card_mpc718 = { | 199 | static const struct cx18_card cx18_card_mpc718 = { |
200 | .type = CX18_CARD_YUAN_MPC718, | 200 | .type = CX18_CARD_YUAN_MPC718, |
201 | .name = "Yuan MPC718", | 201 | .name = "Yuan MPC718 MiniPCI DVB-T/Analog", |
202 | .comment = "Analog video capture works; some audio line in may not.\n", | 202 | .comment = "Experimenters needed for device to work well.\n" |
203 | "\tTo help, mail the ivtv-devel list (www.ivtvdriver.org).\n", | ||
203 | .v4l2_capabilities = CX18_CAP_ENCODER, | 204 | .v4l2_capabilities = CX18_CAP_ENCODER, |
204 | .hw_audio_ctrl = CX18_HW_418_AV, | 205 | .hw_audio_ctrl = CX18_HW_418_AV, |
205 | .hw_all = CX18_HW_418_AV | CX18_HW_TUNER | CX18_HW_GPIO_RESET_CTRL, | 206 | .hw_muxer = CX18_HW_GPIO_MUX, |
207 | .hw_all = CX18_HW_418_AV | CX18_HW_TUNER | | ||
208 | CX18_HW_GPIO_MUX | CX18_HW_DVB | CX18_HW_GPIO_RESET_CTRL, | ||
206 | .video_inputs = { | 209 | .video_inputs = { |
207 | { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 }, | 210 | { CX18_CARD_INPUT_VID_TUNER, 0, CX18_AV_COMPOSITE2 }, |
208 | { CX18_CARD_INPUT_SVIDEO1, 1, | 211 | { CX18_CARD_INPUT_SVIDEO1, 1, |
@@ -211,27 +214,34 @@ static const struct cx18_card cx18_card_mpc718 = { | |||
211 | { CX18_CARD_INPUT_SVIDEO2, 2, | 214 | { CX18_CARD_INPUT_SVIDEO2, 2, |
212 | CX18_AV_SVIDEO_LUMA7 | CX18_AV_SVIDEO_CHROMA8 }, | 215 | CX18_AV_SVIDEO_LUMA7 | CX18_AV_SVIDEO_CHROMA8 }, |
213 | { CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE6 }, | 216 | { CX18_CARD_INPUT_COMPOSITE2, 2, CX18_AV_COMPOSITE6 }, |
214 | { CX18_CARD_INPUT_COMPOSITE3, 2, CX18_AV_COMPOSITE3 }, | ||
215 | }, | 217 | }, |
216 | .audio_inputs = { | 218 | .audio_inputs = { |
217 | { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 }, | 219 | { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 0 }, |
218 | { CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL1, 0 }, | 220 | { CX18_CARD_INPUT_LINE_IN1, CX18_AV_AUDIO_SERIAL1, 1 }, |
219 | { CX18_CARD_INPUT_LINE_IN2, CX18_AV_AUDIO_SERIAL1, 0 }, | 221 | { CX18_CARD_INPUT_LINE_IN2, CX18_AV_AUDIO_SERIAL2, 1 }, |
220 | }, | 222 | }, |
221 | .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO_SERIAL1, 0 }, | ||
222 | .tuners = { | 223 | .tuners = { |
223 | /* XC3028 tuner */ | 224 | /* XC3028 tuner */ |
224 | { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 }, | 225 | { .std = V4L2_STD_ALL, .tuner = TUNER_XC2028 }, |
225 | }, | 226 | }, |
227 | /* FIXME - the FM radio is just a guess and driver doesn't use SIF */ | ||
228 | .radio_input = { CX18_CARD_INPUT_AUD_TUNER, CX18_AV_AUDIO5, 2 }, | ||
226 | .ddr = { | 229 | .ddr = { |
227 | /* Probably Samsung K4D263238G-VC33 memory */ | 230 | /* Hynix HY5DU283222B DDR RAM */ |
228 | .chip_config = 0x003, | 231 | .chip_config = 0x303, |
229 | .refresh = 0x30c, | 232 | .refresh = 0x3bd, |
230 | .timing1 = 0x23230b73, | 233 | .timing1 = 0x36320966, |
231 | .timing2 = 0x08, | 234 | .timing2 = 0x1f, |
232 | .tune_lane = 0, | 235 | .tune_lane = 0, |
233 | .initial_emrs = 2, | 236 | .initial_emrs = 2, |
234 | }, | 237 | }, |
238 | .gpio_init.initial_value = 0x1, | ||
239 | .gpio_init.direction = 0x3, | ||
240 | /* FIXME - these GPIO's are just guesses */ | ||
241 | .gpio_audio_input = { .mask = 0x3, | ||
242 | .tuner = 0x1, | ||
243 | .linein = 0x3, | ||
244 | .radio = 0x1 }, | ||
235 | .xceive_pin = 0, | 245 | .xceive_pin = 0, |
236 | .pci_list = cx18_pci_mpc718, | 246 | .pci_list = cx18_pci_mpc718, |
237 | .i2c = &cx18_i2c_std, | 247 | .i2c = &cx18_i2c_std, |
diff --git a/drivers/media/video/cx18/cx18-dvb.c b/drivers/media/video/cx18/cx18-dvb.c index 6ea3fe623ef4..51a0c33b25b7 100644 --- a/drivers/media/video/cx18/cx18-dvb.c +++ b/drivers/media/video/cx18/cx18-dvb.c | |||
@@ -30,6 +30,10 @@ | |||
30 | #include "s5h1409.h" | 30 | #include "s5h1409.h" |
31 | #include "mxl5005s.h" | 31 | #include "mxl5005s.h" |
32 | #include "zl10353.h" | 32 | #include "zl10353.h" |
33 | |||
34 | #include <linux/firmware.h> | ||
35 | #include "mt352.h" | ||
36 | #include "mt352_priv.h" | ||
33 | #include "tuner-xc2028.h" | 37 | #include "tuner-xc2028.h" |
34 | 38 | ||
35 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | 39 | DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); |
@@ -38,6 +42,11 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | |||
38 | #define CX18_CLOCK_ENABLE2 0xc71024 | 42 | #define CX18_CLOCK_ENABLE2 0xc71024 |
39 | #define CX18_DMUX_CLK_MASK 0x0080 | 43 | #define CX18_DMUX_CLK_MASK 0x0080 |
40 | 44 | ||
45 | /* | ||
46 | * CX18_CARD_HVR_1600_ESMT | ||
47 | * CX18_CARD_HVR_1600_SAMSUNG | ||
48 | */ | ||
49 | |||
41 | static struct mxl5005s_config hauppauge_hvr1600_tuner = { | 50 | static struct mxl5005s_config hauppauge_hvr1600_tuner = { |
42 | .i2c_address = 0xC6 >> 1, | 51 | .i2c_address = 0xC6 >> 1, |
43 | .if_freq = IF_FREQ_5380000HZ, | 52 | .if_freq = IF_FREQ_5380000HZ, |
@@ -65,6 +74,9 @@ static struct s5h1409_config hauppauge_hvr1600_config = { | |||
65 | .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK | 74 | .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK |
66 | }; | 75 | }; |
67 | 76 | ||
77 | /* | ||
78 | * CX18_CARD_LEADTEK_DVR3100H | ||
79 | */ | ||
68 | /* Information/confirmation of proper config values provided by Terry Wu */ | 80 | /* Information/confirmation of proper config values provided by Terry Wu */ |
69 | static struct zl10353_config leadtek_dvr3100h_demod = { | 81 | static struct zl10353_config leadtek_dvr3100h_demod = { |
70 | .demod_address = 0x1e >> 1, /* Datasheet suggested straps */ | 82 | .demod_address = 0x1e >> 1, /* Datasheet suggested straps */ |
@@ -74,6 +86,121 @@ static struct zl10353_config leadtek_dvr3100h_demod = { | |||
74 | .disable_i2c_gate_ctrl = 1, /* Disable the I2C gate */ | 86 | .disable_i2c_gate_ctrl = 1, /* Disable the I2C gate */ |
75 | }; | 87 | }; |
76 | 88 | ||
89 | /* | ||
90 | * CX18_CARD_YUAN_MPC718 | ||
91 | */ | ||
92 | /* | ||
93 | * Due to | ||
94 | * | ||
95 | * 1. an absence of information on how to prgram the MT352 | ||
96 | * 2. the Linux mt352 module pushing MT352 initialzation off onto us here | ||
97 | * | ||
98 | * We have to use an init sequence that *you* must extract from the Windows | ||
99 | * driver (yuanrap.sys) and which we load as a firmware. | ||
100 | * | ||
101 | * If someone can provide me with a Zarlink MT352 (Intel CE6352?) Design Manual | ||
102 | * with chip programming details, then I can remove this annoyance. | ||
103 | */ | ||
104 | static int yuan_mpc718_mt352_reqfw(struct cx18_stream *stream, | ||
105 | const struct firmware **fw) | ||
106 | { | ||
107 | struct cx18 *cx = stream->cx; | ||
108 | const char *fn = "dvb-cx18-mpc718-mt352.fw"; | ||
109 | int ret; | ||
110 | |||
111 | ret = request_firmware(fw, fn, &cx->pci_dev->dev); | ||
112 | if (ret) | ||
113 | CX18_ERR("Unable to open firmware file %s\n", fn); | ||
114 | else { | ||
115 | size_t sz = (*fw)->size; | ||
116 | if (sz < 2 || sz > 64 || (sz % 2) != 0) { | ||
117 | CX18_ERR("Firmware %s has a bad size: %lu bytes\n", | ||
118 | fn, (unsigned long) sz); | ||
119 | ret = -EILSEQ; | ||
120 | release_firmware(*fw); | ||
121 | *fw = NULL; | ||
122 | } | ||
123 | } | ||
124 | |||
125 | if (ret) { | ||
126 | CX18_ERR("The MPC718 board variant with the MT352 DVB-T" | ||
127 | "demodualtor will not work without it\n"); | ||
128 | CX18_ERR("Run 'linux/Documentation/dvb/get_dvb_firmware " | ||
129 | "mpc718' if you need the firmware\n"); | ||
130 | } | ||
131 | return ret; | ||
132 | } | ||
133 | |||
134 | static int yuan_mpc718_mt352_init(struct dvb_frontend *fe) | ||
135 | { | ||
136 | struct cx18_dvb *dvb = container_of(fe->dvb, | ||
137 | struct cx18_dvb, dvb_adapter); | ||
138 | struct cx18_stream *stream = container_of(dvb, struct cx18_stream, dvb); | ||
139 | const struct firmware *fw = NULL; | ||
140 | int ret; | ||
141 | int i; | ||
142 | u8 buf[3]; | ||
143 | |||
144 | ret = yuan_mpc718_mt352_reqfw(stream, &fw); | ||
145 | if (ret) | ||
146 | return ret; | ||
147 | |||
148 | /* Loop through all the register-value pairs in the firmware file */ | ||
149 | for (i = 0; i < fw->size; i += 2) { | ||
150 | buf[0] = fw->data[i]; | ||
151 | /* Intercept a few registers we want to set ourselves */ | ||
152 | switch (buf[0]) { | ||
153 | case TRL_NOMINAL_RATE_0: | ||
154 | /* Set our custom OFDM bandwidth in the case below */ | ||
155 | break; | ||
156 | case TRL_NOMINAL_RATE_1: | ||
157 | /* 6 MHz: 64/7 * 6/8 / 20.48 * 2^16 = 0x55b6.db6 */ | ||
158 | /* 7 MHz: 64/7 * 7/8 / 20.48 * 2^16 = 0x6400 */ | ||
159 | /* 8 MHz: 64/7 * 8/8 / 20.48 * 2^16 = 0x7249.249 */ | ||
160 | buf[1] = 0x72; | ||
161 | buf[2] = 0x49; | ||
162 | mt352_write(fe, buf, 3); | ||
163 | break; | ||
164 | case INPUT_FREQ_0: | ||
165 | /* Set our custom IF in the case below */ | ||
166 | break; | ||
167 | case INPUT_FREQ_1: | ||
168 | /* 4.56 MHz IF: (20.48 - 4.56)/20.48 * 2^14 = 0x31c0 */ | ||
169 | buf[1] = 0x31; | ||
170 | buf[2] = 0xc0; | ||
171 | mt352_write(fe, buf, 3); | ||
172 | break; | ||
173 | default: | ||
174 | /* Pass through the register-value pair from the fw */ | ||
175 | buf[1] = fw->data[i+1]; | ||
176 | mt352_write(fe, buf, 2); | ||
177 | break; | ||
178 | } | ||
179 | } | ||
180 | |||
181 | buf[0] = (u8) TUNER_GO; | ||
182 | buf[1] = 0x01; /* Go */ | ||
183 | mt352_write(fe, buf, 2); | ||
184 | release_firmware(fw); | ||
185 | return 0; | ||
186 | } | ||
187 | |||
188 | static struct mt352_config yuan_mpc718_mt352_demod = { | ||
189 | .demod_address = 0x1e >> 1, | ||
190 | .adc_clock = 20480, /* 20.480 MHz */ | ||
191 | .if2 = 4560, /* 4.560 MHz */ | ||
192 | .no_tuner = 1, /* XC3028 is not behind the gate */ | ||
193 | .demod_init = yuan_mpc718_mt352_init, | ||
194 | }; | ||
195 | |||
196 | static struct zl10353_config yuan_mpc718_zl10353_demod = { | ||
197 | .demod_address = 0x1e >> 1, /* Datasheet suggested straps */ | ||
198 | .if2 = 45600, /* 4.560 MHz IF from the XC3028 */ | ||
199 | .parallel_ts = 1, /* Not a serial TS */ | ||
200 | .no_tuner = 1, /* XC3028 is not behind the gate */ | ||
201 | .disable_i2c_gate_ctrl = 1, /* Disable the I2C gate */ | ||
202 | }; | ||
203 | |||
77 | static int dvb_register(struct cx18_stream *stream); | 204 | static int dvb_register(struct cx18_stream *stream); |
78 | 205 | ||
79 | /* Kernel DVB framework calls this when the feed needs to start. | 206 | /* Kernel DVB framework calls this when the feed needs to start. |
@@ -113,6 +240,7 @@ static int cx18_dvb_start_feed(struct dvb_demux_feed *feed) | |||
113 | break; | 240 | break; |
114 | 241 | ||
115 | case CX18_CARD_LEADTEK_DVR3100H: | 242 | case CX18_CARD_LEADTEK_DVR3100H: |
243 | case CX18_CARD_YUAN_MPC718: | ||
116 | default: | 244 | default: |
117 | /* Assumption - Parallel transport - Signalling | 245 | /* Assumption - Parallel transport - Signalling |
118 | * undefined or default. | 246 | * undefined or default. |
@@ -326,6 +454,38 @@ static int dvb_register(struct cx18_stream *stream) | |||
326 | fe->ops.tuner_ops.set_config(fe, &ctrl); | 454 | fe->ops.tuner_ops.set_config(fe, &ctrl); |
327 | } | 455 | } |
328 | break; | 456 | break; |
457 | case CX18_CARD_YUAN_MPC718: | ||
458 | /* | ||
459 | * TODO | ||
460 | * Apparently, these cards also could instead have a | ||
461 | * DiBcom demod supported by one of the db7000 drivers | ||
462 | */ | ||
463 | dvb->fe = dvb_attach(mt352_attach, | ||
464 | &yuan_mpc718_mt352_demod, | ||
465 | &cx->i2c_adap[1]); | ||
466 | if (dvb->fe == NULL) | ||
467 | dvb->fe = dvb_attach(zl10353_attach, | ||
468 | &yuan_mpc718_zl10353_demod, | ||
469 | &cx->i2c_adap[1]); | ||
470 | if (dvb->fe != NULL) { | ||
471 | struct dvb_frontend *fe; | ||
472 | struct xc2028_config cfg = { | ||
473 | .i2c_adap = &cx->i2c_adap[1], | ||
474 | .i2c_addr = 0xc2 >> 1, | ||
475 | .ctrl = NULL, | ||
476 | }; | ||
477 | static struct xc2028_ctrl ctrl = { | ||
478 | .fname = XC2028_DEFAULT_FIRMWARE, | ||
479 | .max_len = 64, | ||
480 | .demod = XC3028_FE_ZARLINK456, | ||
481 | .type = XC2028_AUTO, | ||
482 | }; | ||
483 | |||
484 | fe = dvb_attach(xc2028_attach, dvb->fe, &cfg); | ||
485 | if (fe != NULL && fe->ops.tuner_ops.set_config != NULL) | ||
486 | fe->ops.tuner_ops.set_config(fe, &ctrl); | ||
487 | } | ||
488 | break; | ||
329 | default: | 489 | default: |
330 | /* No Digital Tv Support */ | 490 | /* No Digital Tv Support */ |
331 | break; | 491 | break; |
diff --git a/drivers/media/video/cx23885/cx23885-417.c b/drivers/media/video/cx23885/cx23885-417.c index 2943bfd32a94..428f0c45e6b7 100644 --- a/drivers/media/video/cx23885/cx23885-417.c +++ b/drivers/media/video/cx23885/cx23885-417.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
32 | #include <linux/device.h> | 32 | #include <linux/device.h> |
33 | #include <linux/firmware.h> | 33 | #include <linux/firmware.h> |
34 | #include <linux/smp_lock.h> | ||
34 | #include <media/v4l2-common.h> | 35 | #include <media/v4l2-common.h> |
35 | #include <media/v4l2-ioctl.h> | 36 | #include <media/v4l2-ioctl.h> |
36 | #include <media/cx2341x.h> | 37 | #include <media/cx2341x.h> |
diff --git a/drivers/media/video/cx23885/cx23885-dvb.c b/drivers/media/video/cx23885/cx23885-dvb.c index 48a975134ac5..86ac529e62be 100644 --- a/drivers/media/video/cx23885/cx23885-dvb.c +++ b/drivers/media/video/cx23885/cx23885-dvb.c | |||
@@ -463,6 +463,30 @@ static struct xc5000_config mygica_x8506_xc5000_config = { | |||
463 | .if_khz = 5380, | 463 | .if_khz = 5380, |
464 | }; | 464 | }; |
465 | 465 | ||
466 | static int cx23885_dvb_set_frontend(struct dvb_frontend *fe, | ||
467 | struct dvb_frontend_parameters *param) | ||
468 | { | ||
469 | struct cx23885_tsport *port = fe->dvb->priv; | ||
470 | struct cx23885_dev *dev = port->dev; | ||
471 | |||
472 | switch (dev->board) { | ||
473 | case CX23885_BOARD_HAUPPAUGE_HVR1275: | ||
474 | switch (param->u.vsb.modulation) { | ||
475 | case VSB_8: | ||
476 | cx23885_gpio_clear(dev, GPIO_5); | ||
477 | break; | ||
478 | case QAM_64: | ||
479 | case QAM_256: | ||
480 | default: | ||
481 | cx23885_gpio_set(dev, GPIO_5); | ||
482 | break; | ||
483 | } | ||
484 | break; | ||
485 | } | ||
486 | return (port->set_frontend_save) ? | ||
487 | port->set_frontend_save(fe, param) : -ENODEV; | ||
488 | } | ||
489 | |||
466 | static int dvb_register(struct cx23885_tsport *port) | 490 | static int dvb_register(struct cx23885_tsport *port) |
467 | { | 491 | { |
468 | struct cx23885_dev *dev = port->dev; | 492 | struct cx23885_dev *dev = port->dev; |
@@ -502,6 +526,12 @@ static int dvb_register(struct cx23885_tsport *port) | |||
502 | 0x60, &dev->i2c_bus[1].i2c_adap, | 526 | 0x60, &dev->i2c_bus[1].i2c_adap, |
503 | &hauppauge_hvr127x_config); | 527 | &hauppauge_hvr127x_config); |
504 | } | 528 | } |
529 | |||
530 | /* FIXME: temporary hack */ | ||
531 | /* define bridge override to set_frontend */ | ||
532 | port->set_frontend_save = fe0->dvb.frontend->ops.set_frontend; | ||
533 | fe0->dvb.frontend->ops.set_frontend = cx23885_dvb_set_frontend; | ||
534 | |||
505 | break; | 535 | break; |
506 | case CX23885_BOARD_HAUPPAUGE_HVR1255: | 536 | case CX23885_BOARD_HAUPPAUGE_HVR1255: |
507 | i2c_bus = &dev->i2c_bus[0]; | 537 | i2c_bus = &dev->i2c_bus[0]; |
diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c index 70836af3ab48..5d6093336300 100644 --- a/drivers/media/video/cx23885/cx23885-video.c +++ b/drivers/media/video/cx23885/cx23885-video.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/kmod.h> | 26 | #include <linux/kmod.h> |
27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/smp_lock.h> | ||
29 | #include <linux/interrupt.h> | 30 | #include <linux/interrupt.h> |
30 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
31 | #include <linux/kthread.h> | 32 | #include <linux/kthread.h> |
diff --git a/drivers/media/video/cx23885/cx23885.h b/drivers/media/video/cx23885/cx23885.h index 1a2ac518a3f1..214a55e943b7 100644 --- a/drivers/media/video/cx23885/cx23885.h +++ b/drivers/media/video/cx23885/cx23885.h | |||
@@ -288,6 +288,10 @@ struct cx23885_tsport { | |||
288 | /* Allow a single tsport to have multiple frontends */ | 288 | /* Allow a single tsport to have multiple frontends */ |
289 | u32 num_frontends; | 289 | u32 num_frontends; |
290 | void *port_priv; | 290 | void *port_priv; |
291 | |||
292 | /* FIXME: temporary hack */ | ||
293 | int (*set_frontend_save) (struct dvb_frontend *, | ||
294 | struct dvb_frontend_parameters *); | ||
291 | }; | 295 | }; |
292 | 296 | ||
293 | struct cx23885_dev { | 297 | struct cx23885_dev { |
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index 44eacfb0d0d6..356d6896da3f 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/delay.h> | 32 | #include <linux/delay.h> |
33 | #include <linux/device.h> | 33 | #include <linux/device.h> |
34 | #include <linux/firmware.h> | 34 | #include <linux/firmware.h> |
35 | #include <linux/smp_lock.h> | ||
35 | #include <media/v4l2-common.h> | 36 | #include <media/v4l2-common.h> |
36 | #include <media/v4l2-ioctl.h> | 37 | #include <media/v4l2-ioctl.h> |
37 | #include <media/cx2341x.h> | 38 | #include <media/cx2341x.h> |
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index b12770848c00..2bb54c3ef5cd 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/kmod.h> | 31 | #include <linux/kmod.h> |
32 | #include <linux/kernel.h> | 32 | #include <linux/kernel.h> |
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
34 | #include <linux/smp_lock.h> | ||
34 | #include <linux/interrupt.h> | 35 | #include <linux/interrupt.h> |
35 | #include <linux/dma-mapping.h> | 36 | #include <linux/dma-mapping.h> |
36 | #include <linux/delay.h> | 37 | #include <linux/delay.h> |
diff --git a/drivers/media/video/dabusb.c b/drivers/media/video/dabusb.c index ec2f45dde164..0664d111085f 100644 --- a/drivers/media/video/dabusb.c +++ b/drivers/media/video/dabusb.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/list.h> | 32 | #include <linux/list.h> |
33 | #include <linux/vmalloc.h> | 33 | #include <linux/vmalloc.h> |
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | #include <linux/smp_lock.h> | ||
35 | #include <linux/init.h> | 36 | #include <linux/init.h> |
36 | #include <asm/uaccess.h> | 37 | #include <asm/uaccess.h> |
37 | #include <asm/atomic.h> | 38 | #include <asm/atomic.h> |
diff --git a/drivers/media/video/em28xx/Kconfig b/drivers/media/video/em28xx/Kconfig index 16a5af30e9d1..6524b493e033 100644 --- a/drivers/media/video/em28xx/Kconfig +++ b/drivers/media/video/em28xx/Kconfig | |||
@@ -8,6 +8,8 @@ config VIDEO_EM28XX | |||
8 | select VIDEO_SAA711X if VIDEO_HELPER_CHIPS_AUTO | 8 | select VIDEO_SAA711X if VIDEO_HELPER_CHIPS_AUTO |
9 | select VIDEO_TVP5150 if VIDEO_HELPER_CHIPS_AUTO | 9 | select VIDEO_TVP5150 if VIDEO_HELPER_CHIPS_AUTO |
10 | select VIDEO_MSP3400 if VIDEO_HELPER_CHIPS_AUTO | 10 | select VIDEO_MSP3400 if VIDEO_HELPER_CHIPS_AUTO |
11 | select VIDEO_MT9V011 if VIDEO_HELPER_CHIPS_AUTO | ||
12 | |||
11 | ---help--- | 13 | ---help--- |
12 | This is a video4linux driver for Empia 28xx based TV cards. | 14 | This is a video4linux driver for Empia 28xx based TV cards. |
13 | 15 | ||
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index c43fdb9bc888..ebd24a25fb85 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c | |||
@@ -58,6 +58,8 @@ static unsigned int card[] = {[0 ... (EM28XX_MAXBOARDS - 1)] = UNSET }; | |||
58 | module_param_array(card, int, NULL, 0444); | 58 | module_param_array(card, int, NULL, 0444); |
59 | MODULE_PARM_DESC(card, "card type"); | 59 | MODULE_PARM_DESC(card, "card type"); |
60 | 60 | ||
61 | #define MT9V011_VERSION 0x8243 | ||
62 | |||
61 | /* Bitmask marking allocated devices from 0 to EM28XX_MAXBOARDS */ | 63 | /* Bitmask marking allocated devices from 0 to EM28XX_MAXBOARDS */ |
62 | static unsigned long em28xx_devused; | 64 | static unsigned long em28xx_devused; |
63 | 65 | ||
@@ -191,6 +193,13 @@ static struct em28xx_reg_seq terratec_av350_unmute_gpio[] = { | |||
191 | {EM28XX_R08_GPIO, 0xff, 0xff, 10}, | 193 | {EM28XX_R08_GPIO, 0xff, 0xff, 10}, |
192 | { -1, -1, -1, -1}, | 194 | { -1, -1, -1, -1}, |
193 | }; | 195 | }; |
196 | |||
197 | static struct em28xx_reg_seq silvercrest_reg_seq[] = { | ||
198 | {EM28XX_R08_GPIO, 0xff, 0xff, 10}, | ||
199 | {EM28XX_R08_GPIO, 0x01, 0xf7, 10}, | ||
200 | { -1, -1, -1, -1}, | ||
201 | }; | ||
202 | |||
194 | /* | 203 | /* |
195 | * Board definitions | 204 | * Board definitions |
196 | */ | 205 | */ |
@@ -438,6 +447,18 @@ struct em28xx_board em28xx_boards[] = { | |||
438 | .amux = EM28XX_AMUX_VIDEO, | 447 | .amux = EM28XX_AMUX_VIDEO, |
439 | } }, | 448 | } }, |
440 | }, | 449 | }, |
450 | [EM2820_BOARD_SILVERCREST_WEBCAM] = { | ||
451 | .name = "Silvercrest Webcam 1.3mpix", | ||
452 | .tuner_type = TUNER_ABSENT, | ||
453 | .is_27xx = 1, | ||
454 | .decoder = EM28XX_MT9V011, | ||
455 | .input = { { | ||
456 | .type = EM28XX_VMUX_COMPOSITE1, | ||
457 | .vmux = 0, | ||
458 | .amux = EM28XX_AMUX_VIDEO, | ||
459 | .gpio = silvercrest_reg_seq, | ||
460 | } }, | ||
461 | }, | ||
441 | [EM2821_BOARD_SUPERCOMP_USB_2] = { | 462 | [EM2821_BOARD_SUPERCOMP_USB_2] = { |
442 | .name = "Supercomp USB 2.0 TV", | 463 | .name = "Supercomp USB 2.0 TV", |
443 | .valid = EM28XX_BOARD_NOT_VALIDATED, | 464 | .valid = EM28XX_BOARD_NOT_VALIDATED, |
@@ -826,7 +847,7 @@ struct em28xx_board em28xx_boards[] = { | |||
826 | .tuner_gpio = default_tuner_gpio, | 847 | .tuner_gpio = default_tuner_gpio, |
827 | .decoder = EM28XX_TVP5150, | 848 | .decoder = EM28XX_TVP5150, |
828 | .has_dvb = 1, | 849 | .has_dvb = 1, |
829 | .dvb_gpio = default_analog, | 850 | .dvb_gpio = default_digital, |
830 | .input = { { | 851 | .input = { { |
831 | .type = EM28XX_VMUX_TELEVISION, | 852 | .type = EM28XX_VMUX_TELEVISION, |
832 | .vmux = TVP5150_COMPOSITE0, | 853 | .vmux = TVP5150_COMPOSITE0, |
@@ -1639,6 +1660,11 @@ static unsigned short tvp5150_addrs[] = { | |||
1639 | I2C_CLIENT_END | 1660 | I2C_CLIENT_END |
1640 | }; | 1661 | }; |
1641 | 1662 | ||
1663 | static unsigned short mt9v011_addrs[] = { | ||
1664 | 0xba >> 1, | ||
1665 | I2C_CLIENT_END | ||
1666 | }; | ||
1667 | |||
1642 | static unsigned short msp3400_addrs[] = { | 1668 | static unsigned short msp3400_addrs[] = { |
1643 | 0x80 >> 1, | 1669 | 0x80 >> 1, |
1644 | 0x88 >> 1, | 1670 | 0x88 >> 1, |
@@ -1678,6 +1704,46 @@ static inline void em28xx_set_model(struct em28xx *dev) | |||
1678 | EM28XX_I2C_FREQ_100_KHZ; | 1704 | EM28XX_I2C_FREQ_100_KHZ; |
1679 | } | 1705 | } |
1680 | 1706 | ||
1707 | /* HINT method: webcam I2C chips | ||
1708 | * | ||
1709 | * This method work for webcams with Micron sensors | ||
1710 | */ | ||
1711 | static int em28xx_hint_sensor(struct em28xx *dev) | ||
1712 | { | ||
1713 | int rc; | ||
1714 | char *sensor_name; | ||
1715 | unsigned char cmd; | ||
1716 | __be16 version_be; | ||
1717 | u16 version; | ||
1718 | |||
1719 | if (dev->model != EM2820_BOARD_UNKNOWN) | ||
1720 | return 0; | ||
1721 | |||
1722 | dev->i2c_client.addr = 0xba >> 1; | ||
1723 | cmd = 0; | ||
1724 | i2c_master_send(&dev->i2c_client, &cmd, 1); | ||
1725 | rc = i2c_master_recv(&dev->i2c_client, (char *)&version_be, 2); | ||
1726 | if (rc != 2) | ||
1727 | return -EINVAL; | ||
1728 | |||
1729 | version = be16_to_cpu(version_be); | ||
1730 | |||
1731 | switch (version) { | ||
1732 | case MT9V011_VERSION: | ||
1733 | dev->model = EM2820_BOARD_SILVERCREST_WEBCAM; | ||
1734 | sensor_name = "mt9v011"; | ||
1735 | break; | ||
1736 | default: | ||
1737 | printk("Unknown Sensor 0x%04x\n", be16_to_cpu(version)); | ||
1738 | return -EINVAL; | ||
1739 | } | ||
1740 | |||
1741 | em28xx_errdev("Sensor is %s, assuming that webcam is %s\n", | ||
1742 | sensor_name, em28xx_boards[dev->model].name); | ||
1743 | |||
1744 | return 0; | ||
1745 | } | ||
1746 | |||
1681 | /* Since em28xx_pre_card_setup() requires a proper dev->model, | 1747 | /* Since em28xx_pre_card_setup() requires a proper dev->model, |
1682 | * this won't work for boards with generic PCI IDs | 1748 | * this won't work for boards with generic PCI IDs |
1683 | */ | 1749 | */ |
@@ -1706,7 +1772,10 @@ void em28xx_pre_card_setup(struct em28xx *dev) | |||
1706 | em28xx_info("chip ID is em2750\n"); | 1772 | em28xx_info("chip ID is em2750\n"); |
1707 | break; | 1773 | break; |
1708 | case CHIP_ID_EM2820: | 1774 | case CHIP_ID_EM2820: |
1709 | em28xx_info("chip ID is em2820\n"); | 1775 | if (dev->board.is_27xx) |
1776 | em28xx_info("chip is em2710\n"); | ||
1777 | else | ||
1778 | em28xx_info("chip ID is em2820\n"); | ||
1710 | break; | 1779 | break; |
1711 | case CHIP_ID_EM2840: | 1780 | case CHIP_ID_EM2840: |
1712 | em28xx_info("chip ID is em2840\n"); | 1781 | em28xx_info("chip ID is em2840\n"); |
@@ -2158,6 +2227,10 @@ void em28xx_card_setup(struct em28xx *dev) | |||
2158 | before probing the i2c bus. */ | 2227 | before probing the i2c bus. */ |
2159 | em28xx_set_mode(dev, EM28XX_ANALOG_MODE); | 2228 | em28xx_set_mode(dev, EM28XX_ANALOG_MODE); |
2160 | break; | 2229 | break; |
2230 | case EM2820_BOARD_SILVERCREST_WEBCAM: | ||
2231 | /* FIXME: need to document the registers bellow */ | ||
2232 | em28xx_write_reg(dev, 0x0d, 0x42); | ||
2233 | em28xx_write_reg(dev, 0x13, 0x08); | ||
2161 | } | 2234 | } |
2162 | 2235 | ||
2163 | if (dev->board.has_snapshot_button) | 2236 | if (dev->board.has_snapshot_button) |
@@ -2189,6 +2262,10 @@ void em28xx_card_setup(struct em28xx *dev) | |||
2189 | v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 2262 | v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
2190 | "tvp5150", "tvp5150", tvp5150_addrs); | 2263 | "tvp5150", "tvp5150", tvp5150_addrs); |
2191 | 2264 | ||
2265 | if (dev->board.decoder == EM28XX_MT9V011) | ||
2266 | v4l2_i2c_new_probed_subdev(&dev->v4l2_dev, &dev->i2c_adap, | ||
2267 | "mt9v011", "mt9v011", mt9v011_addrs); | ||
2268 | |||
2192 | if (dev->board.adecoder == EM28XX_TVAUDIO) | 2269 | if (dev->board.adecoder == EM28XX_TVAUDIO) |
2193 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 2270 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
2194 | "tvaudio", "tvaudio", dev->board.tvaudio_addr); | 2271 | "tvaudio", "tvaudio", dev->board.tvaudio_addr); |
@@ -2333,6 +2410,8 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
2333 | return errCode; | 2410 | return errCode; |
2334 | } | 2411 | } |
2335 | 2412 | ||
2413 | em28xx_hint_sensor(dev); | ||
2414 | |||
2336 | /* Do board specific init and eeprom reading */ | 2415 | /* Do board specific init and eeprom reading */ |
2337 | em28xx_card_setup(dev); | 2416 | em28xx_card_setup(dev); |
2338 | 2417 | ||
@@ -2573,6 +2652,7 @@ static int em28xx_usb_probe(struct usb_interface *interface, | |||
2573 | retval = em28xx_init_dev(&dev, udev, interface, nr); | 2652 | retval = em28xx_init_dev(&dev, udev, interface, nr); |
2574 | if (retval) { | 2653 | if (retval) { |
2575 | em28xx_devused &= ~(1<<dev->devno); | 2654 | em28xx_devused &= ~(1<<dev->devno); |
2655 | mutex_unlock(&dev->lock); | ||
2576 | kfree(dev); | 2656 | kfree(dev); |
2577 | goto err; | 2657 | goto err; |
2578 | } | 2658 | } |
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index c8d7ce8fbd36..079ab4d563a6 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c | |||
@@ -648,17 +648,28 @@ int em28xx_capture_start(struct em28xx *dev, int start) | |||
648 | int em28xx_set_outfmt(struct em28xx *dev) | 648 | int em28xx_set_outfmt(struct em28xx *dev) |
649 | { | 649 | { |
650 | int ret; | 650 | int ret; |
651 | int vinmode, vinctl, outfmt; | ||
652 | |||
653 | outfmt = dev->format->reg; | ||
654 | |||
655 | if (dev->board.is_27xx) { | ||
656 | vinmode = 0x0d; | ||
657 | vinctl = 0x00; | ||
658 | } else { | ||
659 | vinmode = 0x10; | ||
660 | vinctl = 0x11; | ||
661 | } | ||
651 | 662 | ||
652 | ret = em28xx_write_reg_bits(dev, EM28XX_R27_OUTFMT, | 663 | ret = em28xx_write_reg_bits(dev, EM28XX_R27_OUTFMT, |
653 | dev->format->reg | 0x20, 0x3f); | 664 | outfmt | 0x20, 0xff); |
654 | if (ret < 0) | 665 | if (ret < 0) |
655 | return ret; | 666 | return ret; |
656 | 667 | ||
657 | ret = em28xx_write_reg(dev, EM28XX_R10_VINMODE, 0x10); | 668 | ret = em28xx_write_reg(dev, EM28XX_R10_VINMODE, vinmode); |
658 | if (ret < 0) | 669 | if (ret < 0) |
659 | return ret; | 670 | return ret; |
660 | 671 | ||
661 | return em28xx_write_reg(dev, EM28XX_R11_VINCTRL, 0x11); | 672 | return em28xx_write_reg(dev, EM28XX_R11_VINCTRL, vinctl); |
662 | } | 673 | } |
663 | 674 | ||
664 | static int em28xx_accumulator_set(struct em28xx *dev, u8 xmin, u8 xmax, | 675 | static int em28xx_accumulator_set(struct em28xx *dev, u8 xmin, u8 xmax, |
@@ -695,13 +706,19 @@ static int em28xx_scaler_set(struct em28xx *dev, u16 h, u16 v) | |||
695 | { | 706 | { |
696 | u8 mode; | 707 | u8 mode; |
697 | /* the em2800 scaler only supports scaling down to 50% */ | 708 | /* the em2800 scaler only supports scaling down to 50% */ |
698 | if (dev->board.is_em2800) | 709 | |
710 | if (dev->board.is_27xx) { | ||
711 | /* FIXME: Don't use the scaler yet */ | ||
712 | mode = 0; | ||
713 | } else if (dev->board.is_em2800) { | ||
699 | mode = (v ? 0x20 : 0x00) | (h ? 0x10 : 0x00); | 714 | mode = (v ? 0x20 : 0x00) | (h ? 0x10 : 0x00); |
700 | else { | 715 | } else { |
701 | u8 buf[2]; | 716 | u8 buf[2]; |
717 | |||
702 | buf[0] = h; | 718 | buf[0] = h; |
703 | buf[1] = h >> 8; | 719 | buf[1] = h >> 8; |
704 | em28xx_write_regs(dev, EM28XX_R30_HSCALELOW, (char *)buf, 2); | 720 | em28xx_write_regs(dev, EM28XX_R30_HSCALELOW, (char *)buf, 2); |
721 | |||
705 | buf[0] = v; | 722 | buf[0] = v; |
706 | buf[1] = v >> 8; | 723 | buf[1] = v >> 8; |
707 | em28xx_write_regs(dev, EM28XX_R32_VSCALELOW, (char *)buf, 2); | 724 | em28xx_write_regs(dev, EM28XX_R32_VSCALELOW, (char *)buf, 2); |
@@ -720,8 +737,11 @@ int em28xx_resolution_set(struct em28xx *dev) | |||
720 | height = norm_maxh(dev) >> 1; | 737 | height = norm_maxh(dev) >> 1; |
721 | 738 | ||
722 | em28xx_set_outfmt(dev); | 739 | em28xx_set_outfmt(dev); |
740 | |||
741 | |||
723 | em28xx_accumulator_set(dev, 1, (width - 4) >> 2, 1, (height - 4) >> 2); | 742 | em28xx_accumulator_set(dev, 1, (width - 4) >> 2, 1, (height - 4) >> 2); |
724 | em28xx_capture_area_set(dev, 0, 0, width >> 2, height >> 2); | 743 | em28xx_capture_area_set(dev, 0, 0, width >> 2, height >> 2); |
744 | |||
725 | return em28xx_scaler_set(dev, dev->hscale, dev->vscale); | 745 | return em28xx_scaler_set(dev, dev->hscale, dev->vscale); |
726 | } | 746 | } |
727 | 747 | ||
diff --git a/drivers/media/video/em28xx/em28xx-dvb.c b/drivers/media/video/em28xx/em28xx-dvb.c index e7b47c8da8f3..3da97c32b8fa 100644 --- a/drivers/media/video/em28xx/em28xx-dvb.c +++ b/drivers/media/video/em28xx/em28xx-dvb.c | |||
@@ -243,6 +243,14 @@ static struct s5h1409_config em28xx_s5h1409_with_xc3028 = { | |||
243 | .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK | 243 | .mpeg_timing = S5H1409_MPEGTIMING_CONTINOUS_NONINVERTING_CLOCK |
244 | }; | 244 | }; |
245 | 245 | ||
246 | static struct zl10353_config em28xx_terratec_xs_zl10353_xc3028 = { | ||
247 | .demod_address = (0x1e >> 1), | ||
248 | .no_tuner = 1, | ||
249 | .disable_i2c_gate_ctrl = 1, | ||
250 | .parallel_ts = 1, | ||
251 | .if2 = 45600, | ||
252 | }; | ||
253 | |||
246 | #ifdef EM28XX_DRX397XD_SUPPORT | 254 | #ifdef EM28XX_DRX397XD_SUPPORT |
247 | /* [TODO] djh - not sure yet what the device config needs to contain */ | 255 | /* [TODO] djh - not sure yet what the device config needs to contain */ |
248 | static struct drx397xD_config em28xx_drx397xD_with_xc3028 = { | 256 | static struct drx397xD_config em28xx_drx397xD_with_xc3028 = { |
@@ -433,7 +441,6 @@ static int dvb_init(struct em28xx *dev) | |||
433 | } | 441 | } |
434 | break; | 442 | break; |
435 | case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900: | 443 | case EM2880_BOARD_HAUPPAUGE_WINTV_HVR_900: |
436 | case EM2880_BOARD_TERRATEC_HYBRID_XS: | ||
437 | case EM2880_BOARD_KWORLD_DVB_310U: | 444 | case EM2880_BOARD_KWORLD_DVB_310U: |
438 | case EM2880_BOARD_EMPIRE_DUAL_TV: | 445 | case EM2880_BOARD_EMPIRE_DUAL_TV: |
439 | dvb->frontend = dvb_attach(zl10353_attach, | 446 | dvb->frontend = dvb_attach(zl10353_attach, |
@@ -444,6 +451,25 @@ static int dvb_init(struct em28xx *dev) | |||
444 | goto out_free; | 451 | goto out_free; |
445 | } | 452 | } |
446 | break; | 453 | break; |
454 | case EM2880_BOARD_TERRATEC_HYBRID_XS: | ||
455 | dvb->frontend = dvb_attach(zl10353_attach, | ||
456 | &em28xx_terratec_xs_zl10353_xc3028, | ||
457 | &dev->i2c_adap); | ||
458 | if (dvb->frontend == NULL) { | ||
459 | /* This board could have either a zl10353 or a mt352. | ||
460 | If the chip id isn't for zl10353, try mt352 */ | ||
461 | |||
462 | /* FIXME: make support for mt352 work */ | ||
463 | printk(KERN_ERR "version of this board with mt352 not " | ||
464 | "currently supported\n"); | ||
465 | result = -EINVAL; | ||
466 | goto out_free; | ||
467 | } | ||
468 | if (attach_xc3028(0x61, dev) < 0) { | ||
469 | result = -EINVAL; | ||
470 | goto out_free; | ||
471 | } | ||
472 | break; | ||
447 | case EM2883_BOARD_KWORLD_HYBRID_330U: | 473 | case EM2883_BOARD_KWORLD_HYBRID_330U: |
448 | case EM2882_BOARD_EVGA_INDTUBE: | 474 | case EM2882_BOARD_EVGA_INDTUBE: |
449 | dvb->frontend = dvb_attach(s5h1409_attach, | 475 | dvb->frontend = dvb_attach(s5h1409_attach, |
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c index 2c86fcf089f5..27e33a287dfc 100644 --- a/drivers/media/video/em28xx/em28xx-i2c.c +++ b/drivers/media/video/em28xx/em28xx-i2c.c | |||
@@ -483,7 +483,7 @@ static char *i2c_devs[128] = { | |||
483 | [0xa0 >> 1] = "eeprom", | 483 | [0xa0 >> 1] = "eeprom", |
484 | [0xb0 >> 1] = "tda9874", | 484 | [0xb0 >> 1] = "tda9874", |
485 | [0xb8 >> 1] = "tvp5150a", | 485 | [0xb8 >> 1] = "tvp5150a", |
486 | [0xba >> 1] = "tvp5150a", | 486 | [0xba >> 1] = "webcam sensor or tvp5150a", |
487 | [0xc0 >> 1] = "tuner (analog)", | 487 | [0xc0 >> 1] = "tuner (analog)", |
488 | [0xc2 >> 1] = "tuner (analog)", | 488 | [0xc2 >> 1] = "tuner (analog)", |
489 | [0xc4 >> 1] = "tuner (analog)", | 489 | [0xc4 >> 1] = "tuner (analog)", |
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 8fe1beecfffa..14316c912179 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c | |||
@@ -90,10 +90,35 @@ MODULE_PARM_DESC(video_debug, "enable debug messages [video]"); | |||
90 | /* supported video standards */ | 90 | /* supported video standards */ |
91 | static struct em28xx_fmt format[] = { | 91 | static struct em28xx_fmt format[] = { |
92 | { | 92 | { |
93 | .name = "16bpp YUY2, 4:2:2, packed", | 93 | .name = "16 bpp YUY2, 4:2:2, packed", |
94 | .fourcc = V4L2_PIX_FMT_YUYV, | 94 | .fourcc = V4L2_PIX_FMT_YUYV, |
95 | .depth = 16, | 95 | .depth = 16, |
96 | .reg = EM28XX_OUTFMT_YUV422_Y0UY1V, | 96 | .reg = EM28XX_OUTFMT_YUV422_Y0UY1V, |
97 | }, { | ||
98 | .name = "16 bpp RGB 565, LE", | ||
99 | .fourcc = V4L2_PIX_FMT_RGB565, | ||
100 | .depth = 16, | ||
101 | .reg = EM28XX_OUTFMT_RGB_16_656, | ||
102 | }, { | ||
103 | .name = "8 bpp Bayer BGBG..GRGR", | ||
104 | .fourcc = V4L2_PIX_FMT_SBGGR8, | ||
105 | .depth = 8, | ||
106 | .reg = EM28XX_OUTFMT_RGB_8_BGBG, | ||
107 | }, { | ||
108 | .name = "8 bpp Bayer GRGR..BGBG", | ||
109 | .fourcc = V4L2_PIX_FMT_SGRBG8, | ||
110 | .depth = 8, | ||
111 | .reg = EM28XX_OUTFMT_RGB_8_GRGR, | ||
112 | }, { | ||
113 | .name = "8 bpp Bayer GBGB..RGRG", | ||
114 | .fourcc = V4L2_PIX_FMT_SGBRG8, | ||
115 | .depth = 8, | ||
116 | .reg = EM28XX_OUTFMT_RGB_8_GBGB, | ||
117 | }, { | ||
118 | .name = "12 bpp YUV411", | ||
119 | .fourcc = V4L2_PIX_FMT_YUV411P, | ||
120 | .depth = 12, | ||
121 | .reg = EM28XX_OUTFMT_YUV411, | ||
97 | }, | 122 | }, |
98 | }; | 123 | }; |
99 | 124 | ||
@@ -701,7 +726,11 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, | |||
701 | return -EINVAL; | 726 | return -EINVAL; |
702 | } | 727 | } |
703 | 728 | ||
704 | if (dev->board.is_em2800) { | 729 | if (dev->board.is_27xx) { |
730 | /* FIXME: This is the only supported fmt */ | ||
731 | width = 640; | ||
732 | height = 480; | ||
733 | } else if (dev->board.is_em2800) { | ||
705 | /* the em2800 can only scale down to 50% */ | 734 | /* the em2800 can only scale down to 50% */ |
706 | height = height > (3 * maxh / 4) ? maxh : maxh / 2; | 735 | height = height > (3 * maxh / 4) ? maxh : maxh / 2; |
707 | width = width > (3 * maxw / 4) ? maxw : maxw / 2; | 736 | width = width > (3 * maxw / 4) ? maxw : maxw / 2; |
@@ -733,13 +762,40 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, | |||
733 | return 0; | 762 | return 0; |
734 | } | 763 | } |
735 | 764 | ||
765 | static int em28xx_set_video_format(struct em28xx *dev, unsigned int fourcc, | ||
766 | unsigned width, unsigned height) | ||
767 | { | ||
768 | struct em28xx_fmt *fmt; | ||
769 | |||
770 | /* FIXME: This is the only supported fmt */ | ||
771 | if (dev->board.is_27xx) { | ||
772 | width = 640; | ||
773 | height = 480; | ||
774 | } | ||
775 | |||
776 | fmt = format_by_fourcc(fourcc); | ||
777 | if (!fmt) | ||
778 | return -EINVAL; | ||
779 | |||
780 | dev->format = fmt; | ||
781 | dev->width = width; | ||
782 | dev->height = height; | ||
783 | |||
784 | /* set new image size */ | ||
785 | get_scale(dev, dev->width, dev->height, &dev->hscale, &dev->vscale); | ||
786 | |||
787 | em28xx_set_alternate(dev); | ||
788 | em28xx_resolution_set(dev); | ||
789 | |||
790 | return 0; | ||
791 | } | ||
792 | |||
736 | static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, | 793 | static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, |
737 | struct v4l2_format *f) | 794 | struct v4l2_format *f) |
738 | { | 795 | { |
739 | struct em28xx_fh *fh = priv; | 796 | struct em28xx_fh *fh = priv; |
740 | struct em28xx *dev = fh->dev; | 797 | struct em28xx *dev = fh->dev; |
741 | int rc; | 798 | int rc; |
742 | struct em28xx_fmt *fmt; | ||
743 | 799 | ||
744 | rc = check_dev(dev); | 800 | rc = check_dev(dev); |
745 | if (rc < 0) | 801 | if (rc < 0) |
@@ -749,12 +805,6 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, | |||
749 | 805 | ||
750 | vidioc_try_fmt_vid_cap(file, priv, f); | 806 | vidioc_try_fmt_vid_cap(file, priv, f); |
751 | 807 | ||
752 | fmt = format_by_fourcc(f->fmt.pix.pixelformat); | ||
753 | if (!fmt) { | ||
754 | rc = -EINVAL; | ||
755 | goto out; | ||
756 | } | ||
757 | |||
758 | if (videobuf_queue_is_busy(&fh->vb_vidq)) { | 808 | if (videobuf_queue_is_busy(&fh->vb_vidq)) { |
759 | em28xx_errdev("%s queue busy\n", __func__); | 809 | em28xx_errdev("%s queue busy\n", __func__); |
760 | rc = -EBUSY; | 810 | rc = -EBUSY; |
@@ -767,16 +817,8 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, | |||
767 | goto out; | 817 | goto out; |
768 | } | 818 | } |
769 | 819 | ||
770 | /* set new image size */ | 820 | rc = em28xx_set_video_format(dev, f->fmt.pix.pixelformat, |
771 | dev->width = f->fmt.pix.width; | 821 | f->fmt.pix.width, f->fmt.pix.height); |
772 | dev->height = f->fmt.pix.height; | ||
773 | dev->format = fmt; | ||
774 | get_scale(dev, dev->width, dev->height, &dev->hscale, &dev->vscale); | ||
775 | |||
776 | em28xx_set_alternate(dev); | ||
777 | em28xx_resolution_set(dev); | ||
778 | |||
779 | rc = 0; | ||
780 | 822 | ||
781 | out: | 823 | out: |
782 | mutex_unlock(&dev->lock); | 824 | mutex_unlock(&dev->lock); |
@@ -1616,11 +1658,6 @@ static int em28xx_v4l2_open(struct file *filp) | |||
1616 | filp->private_data = fh; | 1658 | filp->private_data = fh; |
1617 | 1659 | ||
1618 | if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && dev->users == 0) { | 1660 | if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && dev->users == 0) { |
1619 | dev->width = norm_maxw(dev); | ||
1620 | dev->height = norm_maxh(dev); | ||
1621 | dev->hscale = 0; | ||
1622 | dev->vscale = 0; | ||
1623 | |||
1624 | em28xx_set_mode(dev, EM28XX_ANALOG_MODE); | 1661 | em28xx_set_mode(dev, EM28XX_ANALOG_MODE); |
1625 | em28xx_set_alternate(dev); | 1662 | em28xx_set_alternate(dev); |
1626 | em28xx_resolution_set(dev); | 1663 | em28xx_resolution_set(dev); |
@@ -1962,15 +1999,14 @@ int em28xx_register_analog_devices(struct em28xx *dev) | |||
1962 | 1999 | ||
1963 | /* set default norm */ | 2000 | /* set default norm */ |
1964 | dev->norm = em28xx_video_template.current_norm; | 2001 | dev->norm = em28xx_video_template.current_norm; |
1965 | dev->width = norm_maxw(dev); | ||
1966 | dev->height = norm_maxh(dev); | ||
1967 | dev->interlaced = EM28XX_INTERLACED_DEFAULT; | 2002 | dev->interlaced = EM28XX_INTERLACED_DEFAULT; |
1968 | dev->hscale = 0; | ||
1969 | dev->vscale = 0; | ||
1970 | dev->ctl_input = 0; | 2003 | dev->ctl_input = 0; |
1971 | 2004 | ||
1972 | /* Analog specific initialization */ | 2005 | /* Analog specific initialization */ |
1973 | dev->format = &format[0]; | 2006 | dev->format = &format[0]; |
2007 | em28xx_set_video_format(dev, format[0].fourcc, | ||
2008 | norm_maxw(dev), norm_maxh(dev)); | ||
2009 | |||
1974 | video_mux(dev, dev->ctl_input); | 2010 | video_mux(dev, dev->ctl_input); |
1975 | 2011 | ||
1976 | /* Audio defaults */ | 2012 | /* Audio defaults */ |
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index 813ce45c2f99..d90fef463764 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h | |||
@@ -107,6 +107,7 @@ | |||
107 | #define EM2860_BOARD_TERRATEC_AV350 68 | 107 | #define EM2860_BOARD_TERRATEC_AV350 68 |
108 | #define EM2882_BOARD_KWORLD_ATSC_315U 69 | 108 | #define EM2882_BOARD_KWORLD_ATSC_315U 69 |
109 | #define EM2882_BOARD_EVGA_INDTUBE 70 | 109 | #define EM2882_BOARD_EVGA_INDTUBE 70 |
110 | #define EM2820_BOARD_SILVERCREST_WEBCAM 71 | ||
110 | 111 | ||
111 | /* Limits minimum and default number of buffers */ | 112 | /* Limits minimum and default number of buffers */ |
112 | #define EM28XX_MIN_BUF 4 | 113 | #define EM28XX_MIN_BUF 4 |
@@ -360,6 +361,7 @@ enum em28xx_decoder { | |||
360 | EM28XX_NODECODER, | 361 | EM28XX_NODECODER, |
361 | EM28XX_TVP5150, | 362 | EM28XX_TVP5150, |
362 | EM28XX_SAA711X, | 363 | EM28XX_SAA711X, |
364 | EM28XX_MT9V011, | ||
363 | }; | 365 | }; |
364 | 366 | ||
365 | enum em28xx_adecoder { | 367 | enum em28xx_adecoder { |
@@ -388,6 +390,7 @@ struct em28xx_board { | |||
388 | unsigned int max_range_640_480:1; | 390 | unsigned int max_range_640_480:1; |
389 | unsigned int has_dvb:1; | 391 | unsigned int has_dvb:1; |
390 | unsigned int has_snapshot_button:1; | 392 | unsigned int has_snapshot_button:1; |
393 | unsigned int is_27xx:1; | ||
391 | unsigned int valid:1; | 394 | unsigned int valid:1; |
392 | 395 | ||
393 | unsigned char xclk, i2c_speed; | 396 | unsigned char xclk, i2c_speed; |
diff --git a/drivers/media/video/gspca/stv06xx/stv06xx.h b/drivers/media/video/gspca/stv06xx/stv06xx.h index 9df7137fe67e..992ce530f138 100644 --- a/drivers/media/video/gspca/stv06xx/stv06xx.h +++ b/drivers/media/video/gspca/stv06xx/stv06xx.h | |||
@@ -36,10 +36,6 @@ | |||
36 | 36 | ||
37 | #define STV_ISOC_ENDPOINT_ADDR 0x81 | 37 | #define STV_ISOC_ENDPOINT_ADDR 0x81 |
38 | 38 | ||
39 | #ifndef V4L2_PIX_FMT_SGRBG8 | ||
40 | #define V4L2_PIX_FMT_SGRBG8 v4l2_fourcc('G', 'R', 'B', 'G') | ||
41 | #endif | ||
42 | |||
43 | #define STV_REG23 0x0423 | 39 | #define STV_REG23 0x0423 |
44 | 40 | ||
45 | /* Control registers of the STV0600 ASIC */ | 41 | /* Control registers of the STV0600 ASIC */ |
diff --git a/drivers/media/video/mt9v011.c b/drivers/media/video/mt9v011.c new file mode 100644 index 000000000000..1fe8fc9183a7 --- /dev/null +++ b/drivers/media/video/mt9v011.c | |||
@@ -0,0 +1,431 @@ | |||
1 | /* | ||
2 | * mt9v011 -Micron 1/4-Inch VGA Digital Image Sensor | ||
3 | * | ||
4 | * Copyright (c) 2009 Mauro Carvalho Chehab (mchehab@redhat.com) | ||
5 | * This code is placed under the terms of the GNU General Public License v2 | ||
6 | */ | ||
7 | |||
8 | #include <linux/i2c.h> | ||
9 | #include <linux/videodev2.h> | ||
10 | #include <linux/delay.h> | ||
11 | #include <media/v4l2-device.h> | ||
12 | #include "mt9v011.h" | ||
13 | #include <media/v4l2-i2c-drv.h> | ||
14 | #include <media/v4l2-chip-ident.h> | ||
15 | |||
16 | MODULE_DESCRIPTION("Micron mt9v011 sensor driver"); | ||
17 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
18 | MODULE_LICENSE("GPL"); | ||
19 | |||
20 | |||
21 | static int debug; | ||
22 | module_param(debug, int, 0); | ||
23 | MODULE_PARM_DESC(debug, "Debug level (0-2)"); | ||
24 | |||
25 | /* supported controls */ | ||
26 | static struct v4l2_queryctrl mt9v011_qctrl[] = { | ||
27 | { | ||
28 | .id = V4L2_CID_GAIN, | ||
29 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
30 | .name = "Gain", | ||
31 | .minimum = 0, | ||
32 | .maximum = (1 << 10) - 1, | ||
33 | .step = 1, | ||
34 | .default_value = 0x0020, | ||
35 | .flags = 0, | ||
36 | }, { | ||
37 | .id = V4L2_CID_RED_BALANCE, | ||
38 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
39 | .name = "Red Balance", | ||
40 | .minimum = -1 << 9, | ||
41 | .maximum = (1 << 9) - 1, | ||
42 | .step = 1, | ||
43 | .default_value = 0, | ||
44 | .flags = 0, | ||
45 | }, { | ||
46 | .id = V4L2_CID_BLUE_BALANCE, | ||
47 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
48 | .name = "Blue Balance", | ||
49 | .minimum = -1 << 9, | ||
50 | .maximum = (1 << 9) - 1, | ||
51 | .step = 1, | ||
52 | .default_value = 0, | ||
53 | .flags = 0, | ||
54 | }, | ||
55 | }; | ||
56 | |||
57 | struct mt9v011 { | ||
58 | struct v4l2_subdev sd; | ||
59 | unsigned width, height; | ||
60 | |||
61 | u16 global_gain, red_bal, blue_bal; | ||
62 | }; | ||
63 | |||
64 | static inline struct mt9v011 *to_mt9v011(struct v4l2_subdev *sd) | ||
65 | { | ||
66 | return container_of(sd, struct mt9v011, sd); | ||
67 | } | ||
68 | |||
69 | static int mt9v011_read(struct v4l2_subdev *sd, unsigned char addr) | ||
70 | { | ||
71 | struct i2c_client *c = v4l2_get_subdevdata(sd); | ||
72 | __be16 buffer; | ||
73 | int rc, val; | ||
74 | |||
75 | rc = i2c_master_send(c, &addr, 1); | ||
76 | if (rc != 1) | ||
77 | v4l2_dbg(0, debug, sd, | ||
78 | "i2c i/o error: rc == %d (should be 1)\n", rc); | ||
79 | |||
80 | msleep(10); | ||
81 | |||
82 | rc = i2c_master_recv(c, (char *)&buffer, 2); | ||
83 | if (rc != 2) | ||
84 | v4l2_dbg(0, debug, sd, | ||
85 | "i2c i/o error: rc == %d (should be 2)\n", rc); | ||
86 | |||
87 | val = be16_to_cpu(buffer); | ||
88 | |||
89 | v4l2_dbg(2, debug, sd, "mt9v011: read 0x%02x = 0x%04x\n", addr, val); | ||
90 | |||
91 | return val; | ||
92 | } | ||
93 | |||
94 | static void mt9v011_write(struct v4l2_subdev *sd, unsigned char addr, | ||
95 | u16 value) | ||
96 | { | ||
97 | struct i2c_client *c = v4l2_get_subdevdata(sd); | ||
98 | unsigned char buffer[3]; | ||
99 | int rc; | ||
100 | |||
101 | buffer[0] = addr; | ||
102 | buffer[1] = value >> 8; | ||
103 | buffer[2] = value & 0xff; | ||
104 | |||
105 | v4l2_dbg(2, debug, sd, | ||
106 | "mt9v011: writing 0x%02x 0x%04x\n", buffer[0], value); | ||
107 | rc = i2c_master_send(c, buffer, 3); | ||
108 | if (rc != 3) | ||
109 | v4l2_dbg(0, debug, sd, | ||
110 | "i2c i/o error: rc == %d (should be 3)\n", rc); | ||
111 | } | ||
112 | |||
113 | |||
114 | struct i2c_reg_value { | ||
115 | unsigned char reg; | ||
116 | u16 value; | ||
117 | }; | ||
118 | |||
119 | /* | ||
120 | * Values used at the original driver | ||
121 | * Some values are marked as Reserved at the datasheet | ||
122 | */ | ||
123 | static const struct i2c_reg_value mt9v011_init_default[] = { | ||
124 | { R0D_MT9V011_RESET, 0x0001 }, | ||
125 | { R0D_MT9V011_RESET, 0x0000 }, | ||
126 | |||
127 | { R0C_MT9V011_SHUTTER_DELAY, 0x0000 }, | ||
128 | { R09_MT9V011_SHUTTER_WIDTH, 0x1fc }, | ||
129 | |||
130 | { R0A_MT9V011_CLK_SPEED, 0x0000 }, | ||
131 | { R1E_MT9V011_DIGITAL_ZOOM, 0x0000 }, | ||
132 | { R20_MT9V011_READ_MODE, 0x1000 }, | ||
133 | |||
134 | { R07_MT9V011_OUT_CTRL, 0x000a }, /* chip enable */ | ||
135 | }; | ||
136 | |||
137 | static void set_balance(struct v4l2_subdev *sd) | ||
138 | { | ||
139 | struct mt9v011 *core = to_mt9v011(sd); | ||
140 | u16 green1_gain, green2_gain, blue_gain, red_gain; | ||
141 | |||
142 | green1_gain = core->global_gain; | ||
143 | green2_gain = core->global_gain; | ||
144 | |||
145 | blue_gain = core->global_gain + | ||
146 | core->global_gain * core->blue_bal / (1 << 9); | ||
147 | |||
148 | red_gain = core->global_gain + | ||
149 | core->global_gain * core->blue_bal / (1 << 9); | ||
150 | |||
151 | mt9v011_write(sd, R2B_MT9V011_GREEN_1_GAIN, green1_gain); | ||
152 | mt9v011_write(sd, R2E_MT9V011_GREEN_2_GAIN, green1_gain); | ||
153 | mt9v011_write(sd, R2C_MT9V011_BLUE_GAIN, blue_gain); | ||
154 | mt9v011_write(sd, R2D_MT9V011_RED_GAIN, red_gain); | ||
155 | } | ||
156 | |||
157 | static void set_res(struct v4l2_subdev *sd) | ||
158 | { | ||
159 | struct mt9v011 *core = to_mt9v011(sd); | ||
160 | unsigned vstart, hstart; | ||
161 | |||
162 | /* | ||
163 | * The mt9v011 doesn't have scaling. So, in order to select the desired | ||
164 | * resolution, we're cropping at the middle of the sensor. | ||
165 | * hblank and vblank should be adjusted, in order to warrant that | ||
166 | * we'll preserve the line timings for 30 fps, no matter what resolution | ||
167 | * is selected. | ||
168 | * NOTE: datasheet says that width (and height) should be filled with | ||
169 | * width-1. However, this doesn't work, since one pixel per line will | ||
170 | * be missing. | ||
171 | */ | ||
172 | |||
173 | hstart = 14 + (640 - core->width) / 2; | ||
174 | mt9v011_write(sd, R02_MT9V011_COLSTART, hstart); | ||
175 | mt9v011_write(sd, R04_MT9V011_WIDTH, core->width); | ||
176 | mt9v011_write(sd, R05_MT9V011_HBLANK, 771 - core->width); | ||
177 | |||
178 | vstart = 8 + (640 - core->height) / 2; | ||
179 | mt9v011_write(sd, R01_MT9V011_ROWSTART, vstart); | ||
180 | mt9v011_write(sd, R03_MT9V011_HEIGHT, core->height); | ||
181 | mt9v011_write(sd, R06_MT9V011_VBLANK, 508 - core->height); | ||
182 | }; | ||
183 | |||
184 | static int mt9v011_reset(struct v4l2_subdev *sd, u32 val) | ||
185 | { | ||
186 | int i; | ||
187 | |||
188 | for (i = 0; i < ARRAY_SIZE(mt9v011_init_default); i++) | ||
189 | mt9v011_write(sd, mt9v011_init_default[i].reg, | ||
190 | mt9v011_init_default[i].value); | ||
191 | |||
192 | set_balance(sd); | ||
193 | set_res(sd); | ||
194 | |||
195 | return 0; | ||
196 | }; | ||
197 | |||
198 | static int mt9v011_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) | ||
199 | { | ||
200 | struct mt9v011 *core = to_mt9v011(sd); | ||
201 | |||
202 | v4l2_dbg(1, debug, sd, "g_ctrl called\n"); | ||
203 | |||
204 | switch (ctrl->id) { | ||
205 | case V4L2_CID_GAIN: | ||
206 | ctrl->value = core->global_gain; | ||
207 | return 0; | ||
208 | case V4L2_CID_RED_BALANCE: | ||
209 | ctrl->value = core->red_bal; | ||
210 | return 0; | ||
211 | case V4L2_CID_BLUE_BALANCE: | ||
212 | ctrl->value = core->blue_bal; | ||
213 | return 0; | ||
214 | } | ||
215 | return -EINVAL; | ||
216 | } | ||
217 | |||
218 | static int mt9v011_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) | ||
219 | { | ||
220 | struct mt9v011 *core = to_mt9v011(sd); | ||
221 | u8 i, n; | ||
222 | n = ARRAY_SIZE(mt9v011_qctrl); | ||
223 | |||
224 | for (i = 0; i < n; i++) { | ||
225 | if (ctrl->id != mt9v011_qctrl[i].id) | ||
226 | continue; | ||
227 | if (ctrl->value < mt9v011_qctrl[i].minimum || | ||
228 | ctrl->value > mt9v011_qctrl[i].maximum) | ||
229 | return -ERANGE; | ||
230 | v4l2_dbg(1, debug, sd, "s_ctrl: id=%d, value=%d\n", | ||
231 | ctrl->id, ctrl->value); | ||
232 | break; | ||
233 | } | ||
234 | |||
235 | switch (ctrl->id) { | ||
236 | case V4L2_CID_GAIN: | ||
237 | core->global_gain = ctrl->value; | ||
238 | break; | ||
239 | case V4L2_CID_RED_BALANCE: | ||
240 | core->red_bal = ctrl->value; | ||
241 | break; | ||
242 | case V4L2_CID_BLUE_BALANCE: | ||
243 | core->blue_bal = ctrl->value; | ||
244 | break; | ||
245 | default: | ||
246 | return -EINVAL; | ||
247 | } | ||
248 | |||
249 | set_balance(sd); | ||
250 | |||
251 | return 0; | ||
252 | } | ||
253 | |||
254 | static int mt9v011_enum_fmt(struct v4l2_subdev *sd, struct v4l2_fmtdesc *fmt) | ||
255 | { | ||
256 | if (fmt->index > 0) | ||
257 | return -EINVAL; | ||
258 | |||
259 | fmt->flags = 0; | ||
260 | strcpy(fmt->description, "8 bpp Bayer GRGR..BGBG"); | ||
261 | fmt->pixelformat = V4L2_PIX_FMT_SGRBG8; | ||
262 | |||
263 | return 0; | ||
264 | } | ||
265 | |||
266 | static int mt9v011_try_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) | ||
267 | { | ||
268 | struct v4l2_pix_format *pix = &fmt->fmt.pix; | ||
269 | |||
270 | if (pix->pixelformat != V4L2_PIX_FMT_SGRBG8) | ||
271 | return -EINVAL; | ||
272 | |||
273 | v4l_bound_align_image(&pix->width, 48, 639, 1, | ||
274 | &pix->height, 32, 480, 1, 0); | ||
275 | |||
276 | return 0; | ||
277 | } | ||
278 | |||
279 | static int mt9v011_s_fmt(struct v4l2_subdev *sd, struct v4l2_format *fmt) | ||
280 | { | ||
281 | struct v4l2_pix_format *pix = &fmt->fmt.pix; | ||
282 | struct mt9v011 *core = to_mt9v011(sd); | ||
283 | int rc; | ||
284 | |||
285 | rc = mt9v011_try_fmt(sd, fmt); | ||
286 | if (rc < 0) | ||
287 | return -EINVAL; | ||
288 | |||
289 | core->width = pix->width; | ||
290 | core->height = pix->height; | ||
291 | |||
292 | set_res(sd); | ||
293 | |||
294 | return 0; | ||
295 | } | ||
296 | |||
297 | |||
298 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
299 | static int mt9v011_g_register(struct v4l2_subdev *sd, | ||
300 | struct v4l2_dbg_register *reg) | ||
301 | { | ||
302 | struct i2c_client *client = v4l2_get_subdevdata(sd); | ||
303 | |||
304 | if (!v4l2_chip_match_i2c_client(client, ®->match)) | ||
305 | return -EINVAL; | ||
306 | if (!capable(CAP_SYS_ADMIN)) | ||
307 | return -EPERM; | ||
308 | |||
309 | reg->val = mt9v011_read(sd, reg->reg & 0xff); | ||
310 | reg->size = 2; | ||
311 | |||
312 | return 0; | ||
313 | } | ||
314 | |||
315 | static int mt9v011_s_register(struct v4l2_subdev *sd, | ||
316 | struct v4l2_dbg_register *reg) | ||
317 | { | ||
318 | struct i2c_client *client = v4l2_get_subdevdata(sd); | ||
319 | |||
320 | if (!v4l2_chip_match_i2c_client(client, ®->match)) | ||
321 | return -EINVAL; | ||
322 | if (!capable(CAP_SYS_ADMIN)) | ||
323 | return -EPERM; | ||
324 | |||
325 | mt9v011_write(sd, reg->reg & 0xff, reg->val & 0xffff); | ||
326 | |||
327 | return 0; | ||
328 | } | ||
329 | #endif | ||
330 | |||
331 | static int mt9v011_g_chip_ident(struct v4l2_subdev *sd, | ||
332 | struct v4l2_dbg_chip_ident *chip) | ||
333 | { | ||
334 | struct i2c_client *client = v4l2_get_subdevdata(sd); | ||
335 | |||
336 | return v4l2_chip_ident_i2c_client(client, chip, V4L2_IDENT_MT9V011, | ||
337 | MT9V011_VERSION); | ||
338 | } | ||
339 | |||
340 | static const struct v4l2_subdev_core_ops mt9v011_core_ops = { | ||
341 | .g_ctrl = mt9v011_g_ctrl, | ||
342 | .s_ctrl = mt9v011_s_ctrl, | ||
343 | .reset = mt9v011_reset, | ||
344 | .g_chip_ident = mt9v011_g_chip_ident, | ||
345 | #ifdef CONFIG_VIDEO_ADV_DEBUG | ||
346 | .g_register = mt9v011_g_register, | ||
347 | .s_register = mt9v011_s_register, | ||
348 | #endif | ||
349 | }; | ||
350 | |||
351 | static const struct v4l2_subdev_video_ops mt9v011_video_ops = { | ||
352 | .enum_fmt = mt9v011_enum_fmt, | ||
353 | .try_fmt = mt9v011_try_fmt, | ||
354 | .s_fmt = mt9v011_s_fmt, | ||
355 | }; | ||
356 | |||
357 | static const struct v4l2_subdev_ops mt9v011_ops = { | ||
358 | .core = &mt9v011_core_ops, | ||
359 | .video = &mt9v011_video_ops, | ||
360 | }; | ||
361 | |||
362 | |||
363 | /**************************************************************************** | ||
364 | I2C Client & Driver | ||
365 | ****************************************************************************/ | ||
366 | |||
367 | static int mt9v011_probe(struct i2c_client *c, | ||
368 | const struct i2c_device_id *id) | ||
369 | { | ||
370 | u16 version; | ||
371 | struct mt9v011 *core; | ||
372 | struct v4l2_subdev *sd; | ||
373 | |||
374 | /* Check if the adapter supports the needed features */ | ||
375 | if (!i2c_check_functionality(c->adapter, | ||
376 | I2C_FUNC_SMBUS_READ_BYTE | I2C_FUNC_SMBUS_WRITE_BYTE_DATA)) | ||
377 | return -EIO; | ||
378 | |||
379 | core = kzalloc(sizeof(struct mt9v011), GFP_KERNEL); | ||
380 | if (!core) | ||
381 | return -ENOMEM; | ||
382 | |||
383 | sd = &core->sd; | ||
384 | v4l2_i2c_subdev_init(sd, c, &mt9v011_ops); | ||
385 | |||
386 | /* Check if the sensor is really a MT9V011 */ | ||
387 | version = mt9v011_read(sd, R00_MT9V011_CHIP_VERSION); | ||
388 | if (version != MT9V011_VERSION) { | ||
389 | v4l2_info(sd, "*** unknown micron chip detected (0x%04x.\n", | ||
390 | version); | ||
391 | kfree(core); | ||
392 | return -EINVAL; | ||
393 | } | ||
394 | |||
395 | core->global_gain = 0x0024; | ||
396 | core->width = 640; | ||
397 | core->height = 480; | ||
398 | |||
399 | v4l_info(c, "chip found @ 0x%02x (%s)\n", | ||
400 | c->addr << 1, c->adapter->name); | ||
401 | |||
402 | return 0; | ||
403 | } | ||
404 | |||
405 | static int mt9v011_remove(struct i2c_client *c) | ||
406 | { | ||
407 | struct v4l2_subdev *sd = i2c_get_clientdata(c); | ||
408 | |||
409 | v4l2_dbg(1, debug, sd, | ||
410 | "mt9v011.c: removing mt9v011 adapter on address 0x%x\n", | ||
411 | c->addr << 1); | ||
412 | |||
413 | v4l2_device_unregister_subdev(sd); | ||
414 | kfree(to_mt9v011(sd)); | ||
415 | return 0; | ||
416 | } | ||
417 | |||
418 | /* ----------------------------------------------------------------------- */ | ||
419 | |||
420 | static const struct i2c_device_id mt9v011_id[] = { | ||
421 | { "mt9v011", 0 }, | ||
422 | { } | ||
423 | }; | ||
424 | MODULE_DEVICE_TABLE(i2c, mt9v011_id); | ||
425 | |||
426 | static struct v4l2_i2c_driver_data v4l2_i2c_data = { | ||
427 | .name = "mt9v011", | ||
428 | .probe = mt9v011_probe, | ||
429 | .remove = mt9v011_remove, | ||
430 | .id_table = mt9v011_id, | ||
431 | }; | ||
diff --git a/drivers/media/video/mt9v011.h b/drivers/media/video/mt9v011.h new file mode 100644 index 000000000000..9e443ee30558 --- /dev/null +++ b/drivers/media/video/mt9v011.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | * mt9v011 -Micron 1/4-Inch VGA Digital Image Sensor | ||
3 | * | ||
4 | * Copyright (c) 2009 Mauro Carvalho Chehab (mchehab@redhat.com) | ||
5 | * This code is placed under the terms of the GNU General Public License v2 | ||
6 | */ | ||
7 | |||
8 | #ifndef MT9V011_H_ | ||
9 | #define MT9V011_H_ | ||
10 | |||
11 | #define R00_MT9V011_CHIP_VERSION 0x00 | ||
12 | #define R01_MT9V011_ROWSTART 0x01 | ||
13 | #define R02_MT9V011_COLSTART 0x02 | ||
14 | #define R03_MT9V011_HEIGHT 0x03 | ||
15 | #define R04_MT9V011_WIDTH 0x04 | ||
16 | #define R05_MT9V011_HBLANK 0x05 | ||
17 | #define R06_MT9V011_VBLANK 0x06 | ||
18 | #define R07_MT9V011_OUT_CTRL 0x07 | ||
19 | #define R09_MT9V011_SHUTTER_WIDTH 0x09 | ||
20 | #define R0A_MT9V011_CLK_SPEED 0x0a | ||
21 | #define R0B_MT9V011_RESTART 0x0b | ||
22 | #define R0C_MT9V011_SHUTTER_DELAY 0x0c | ||
23 | #define R0D_MT9V011_RESET 0x0d | ||
24 | #define R1E_MT9V011_DIGITAL_ZOOM 0x1e | ||
25 | #define R20_MT9V011_READ_MODE 0x20 | ||
26 | #define R2B_MT9V011_GREEN_1_GAIN 0x2b | ||
27 | #define R2C_MT9V011_BLUE_GAIN 0x2c | ||
28 | #define R2D_MT9V011_RED_GAIN 0x2d | ||
29 | #define R2E_MT9V011_GREEN_2_GAIN 0x2e | ||
30 | #define R35_MT9V011_GLOBAL_GAIN 0x35 | ||
31 | #define RF1_MT9V011_CHIP_ENABLE 0xf1 | ||
32 | |||
33 | #define MT9V011_VERSION 0x8243 | ||
34 | |||
35 | #endif | ||
diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index db25c3034c11..8d17cf613306 100644 --- a/drivers/media/video/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c | |||
@@ -62,6 +62,7 @@ | |||
62 | #include <linux/module.h> | 62 | #include <linux/module.h> |
63 | #include <linux/poll.h> | 63 | #include <linux/poll.h> |
64 | #include <linux/slab.h> | 64 | #include <linux/slab.h> |
65 | #include <linux/smp_lock.h> | ||
65 | #ifdef CONFIG_USB_PWC_INPUT_EVDEV | 66 | #ifdef CONFIG_USB_PWC_INPUT_EVDEV |
66 | #include <linux/usb/input.h> | 67 | #include <linux/usb/input.h> |
67 | #endif | 68 | #endif |
diff --git a/drivers/media/video/pwc/pwc.h b/drivers/media/video/pwc/pwc.h index 0be6f814f539..0b658dee05a4 100644 --- a/drivers/media/video/pwc/pwc.h +++ b/drivers/media/video/pwc/pwc.h | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/usb.h> | 29 | #include <linux/usb.h> |
30 | #include <linux/spinlock.h> | 30 | #include <linux/spinlock.h> |
31 | #include <linux/wait.h> | 31 | #include <linux/wait.h> |
32 | #include <linux/smp_lock.h> | ||
33 | #include <linux/version.h> | 32 | #include <linux/version.h> |
34 | #include <linux/mutex.h> | 33 | #include <linux/mutex.h> |
35 | #include <linux/mm.h> | 34 | #include <linux/mm.h> |
diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c index 6be845ccc7d7..9e3262c0ba37 100644 --- a/drivers/media/video/s2255drv.c +++ b/drivers/media/video/s2255drv.c | |||
@@ -48,6 +48,7 @@ | |||
48 | #include <linux/videodev2.h> | 48 | #include <linux/videodev2.h> |
49 | #include <linux/version.h> | 49 | #include <linux/version.h> |
50 | #include <linux/mm.h> | 50 | #include <linux/mm.h> |
51 | #include <linux/smp_lock.h> | ||
51 | #include <media/videobuf-vmalloc.h> | 52 | #include <media/videobuf-vmalloc.h> |
52 | #include <media/v4l2-common.h> | 53 | #include <media/v4l2-common.h> |
53 | #include <media/v4l2-ioctl.h> | 54 | #include <media/v4l2-ioctl.h> |
diff --git a/drivers/media/video/saa5246a.c b/drivers/media/video/saa5246a.c index 155804b061e9..b624a4c01fdc 100644 --- a/drivers/media/video/saa5246a.c +++ b/drivers/media/video/saa5246a.c | |||
@@ -43,7 +43,6 @@ | |||
43 | #include <linux/mm.h> | 43 | #include <linux/mm.h> |
44 | #include <linux/init.h> | 44 | #include <linux/init.h> |
45 | #include <linux/i2c.h> | 45 | #include <linux/i2c.h> |
46 | #include <linux/smp_lock.h> | ||
47 | #include <linux/mutex.h> | 46 | #include <linux/mutex.h> |
48 | #include <linux/videotext.h> | 47 | #include <linux/videotext.h> |
49 | #include <linux/videodev2.h> | 48 | #include <linux/videodev2.h> |
diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c index 271d6e931b75..12835fb82c95 100644 --- a/drivers/media/video/saa5249.c +++ b/drivers/media/video/saa5249.c | |||
@@ -46,7 +46,6 @@ | |||
46 | #include <linux/mm.h> | 46 | #include <linux/mm.h> |
47 | #include <linux/init.h> | 47 | #include <linux/init.h> |
48 | #include <linux/i2c.h> | 48 | #include <linux/i2c.h> |
49 | #include <linux/smp_lock.h> | ||
50 | #include <linux/mutex.h> | 49 | #include <linux/mutex.h> |
51 | #include <linux/delay.h> | 50 | #include <linux/delay.h> |
52 | #include <linux/videotext.h> | 51 | #include <linux/videotext.h> |
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c index add1757f8930..296788c3bf0e 100644 --- a/drivers/media/video/saa7134/saa7134-empress.c +++ b/drivers/media/video/saa7134/saa7134-empress.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
24 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
25 | #include <linux/smp_lock.h> | ||
25 | #include <linux/delay.h> | 26 | #include <linux/delay.h> |
26 | 27 | ||
27 | #include "saa7134-reg.h" | 28 | #include "saa7134-reg.h" |
diff --git a/drivers/media/video/se401.c b/drivers/media/video/se401.c index c8f05297d0f0..85ffc2cba039 100644 --- a/drivers/media/video/se401.c +++ b/drivers/media/video/se401.c | |||
@@ -31,6 +31,7 @@ static const char version[] = "0.24"; | |||
31 | #include <linux/init.h> | 31 | #include <linux/init.h> |
32 | #include <linux/vmalloc.h> | 32 | #include <linux/vmalloc.h> |
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
34 | #include <linux/smp_lock.h> | ||
34 | #include <linux/pagemap.h> | 35 | #include <linux/pagemap.h> |
35 | #include <linux/usb.h> | 36 | #include <linux/usb.h> |
36 | #include "se401.h" | 37 | #include "se401.h" |
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c index 16f595d4337a..9f5ae8167855 100644 --- a/drivers/media/video/soc_camera.c +++ b/drivers/media/video/soc_camera.c | |||
@@ -237,11 +237,11 @@ static int soc_camera_init_user_formats(struct soc_camera_device *icd) | |||
237 | return -ENOMEM; | 237 | return -ENOMEM; |
238 | 238 | ||
239 | icd->num_user_formats = fmts; | 239 | icd->num_user_formats = fmts; |
240 | fmts = 0; | ||
241 | 240 | ||
242 | dev_dbg(&icd->dev, "Found %d supported formats.\n", fmts); | 241 | dev_dbg(&icd->dev, "Found %d supported formats.\n", fmts); |
243 | 242 | ||
244 | /* Second pass - actually fill data formats */ | 243 | /* Second pass - actually fill data formats */ |
244 | fmts = 0; | ||
245 | for (i = 0; i < icd->num_formats; i++) | 245 | for (i = 0; i < icd->num_formats; i++) |
246 | if (!ici->ops->get_formats) { | 246 | if (!ici->ops->get_formats) { |
247 | icd->user_formats[i].host_fmt = icd->formats + i; | 247 | icd->user_formats[i].host_fmt = icd->formats + i; |
@@ -877,8 +877,11 @@ static int soc_camera_probe(struct device *dev) | |||
877 | (unsigned short)~0; | 877 | (unsigned short)~0; |
878 | 878 | ||
879 | ret = soc_camera_init_user_formats(icd); | 879 | ret = soc_camera_init_user_formats(icd); |
880 | if (ret < 0) | 880 | if (ret < 0) { |
881 | if (icd->ops->remove) | ||
882 | icd->ops->remove(icd); | ||
881 | goto eiufmt; | 883 | goto eiufmt; |
884 | } | ||
882 | 885 | ||
883 | icd->height = DEFAULT_HEIGHT; | 886 | icd->height = DEFAULT_HEIGHT; |
884 | icd->width = DEFAULT_WIDTH; | 887 | icd->width = DEFAULT_WIDTH; |
@@ -902,8 +905,10 @@ static int soc_camera_remove(struct device *dev) | |||
902 | { | 905 | { |
903 | struct soc_camera_device *icd = to_soc_camera_dev(dev); | 906 | struct soc_camera_device *icd = to_soc_camera_dev(dev); |
904 | 907 | ||
908 | mutex_lock(&icd->video_lock); | ||
905 | if (icd->ops->remove) | 909 | if (icd->ops->remove) |
906 | icd->ops->remove(icd); | 910 | icd->ops->remove(icd); |
911 | mutex_unlock(&icd->video_lock); | ||
907 | 912 | ||
908 | soc_camera_free_user_formats(icd); | 913 | soc_camera_free_user_formats(icd); |
909 | 914 | ||
@@ -1145,6 +1150,7 @@ evidallocd: | |||
1145 | } | 1150 | } |
1146 | EXPORT_SYMBOL(soc_camera_video_start); | 1151 | EXPORT_SYMBOL(soc_camera_video_start); |
1147 | 1152 | ||
1153 | /* Called from client .remove() methods with .video_lock held */ | ||
1148 | void soc_camera_video_stop(struct soc_camera_device *icd) | 1154 | void soc_camera_video_stop(struct soc_camera_device *icd) |
1149 | { | 1155 | { |
1150 | struct video_device *vdev = icd->vdev; | 1156 | struct video_device *vdev = icd->vdev; |
@@ -1154,10 +1160,8 @@ void soc_camera_video_stop(struct soc_camera_device *icd) | |||
1154 | if (!icd->dev.parent || !vdev) | 1160 | if (!icd->dev.parent || !vdev) |
1155 | return; | 1161 | return; |
1156 | 1162 | ||
1157 | mutex_lock(&icd->video_lock); | ||
1158 | video_unregister_device(vdev); | 1163 | video_unregister_device(vdev); |
1159 | icd->vdev = NULL; | 1164 | icd->vdev = NULL; |
1160 | mutex_unlock(&icd->video_lock); | ||
1161 | } | 1165 | } |
1162 | EXPORT_SYMBOL(soc_camera_video_stop); | 1166 | EXPORT_SYMBOL(soc_camera_video_stop); |
1163 | 1167 | ||
diff --git a/drivers/media/video/stk-webcam.c b/drivers/media/video/stk-webcam.c index 2e5937047278..4d6785e63455 100644 --- a/drivers/media/video/stk-webcam.c +++ b/drivers/media/video/stk-webcam.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
28 | #include <linux/errno.h> | 28 | #include <linux/errno.h> |
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/smp_lock.h> | ||
30 | 31 | ||
31 | #include <linux/usb.h> | 32 | #include <linux/usb.h> |
32 | #include <linux/mm.h> | 33 | #include <linux/mm.h> |
diff --git a/drivers/media/video/stradis.c b/drivers/media/video/stradis.c index 0eb313082c97..eaada39c76fd 100644 --- a/drivers/media/video/stradis.c +++ b/drivers/media/video/stradis.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
27 | #include <linux/major.h> | 27 | #include <linux/major.h> |
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/smp_lock.h> | ||
29 | #include <linux/mm.h> | 30 | #include <linux/mm.h> |
30 | #include <linux/init.h> | 31 | #include <linux/init.h> |
31 | #include <linux/poll.h> | 32 | #include <linux/poll.h> |
diff --git a/drivers/media/video/stv680.c b/drivers/media/video/stv680.c index 75f286f7a2e9..8b4e7dafce7b 100644 --- a/drivers/media/video/stv680.c +++ b/drivers/media/video/stv680.c | |||
@@ -62,6 +62,7 @@ | |||
62 | #include <linux/init.h> | 62 | #include <linux/init.h> |
63 | #include <linux/vmalloc.h> | 63 | #include <linux/vmalloc.h> |
64 | #include <linux/slab.h> | 64 | #include <linux/slab.h> |
65 | #include <linux/smp_lock.h> | ||
65 | #include <linux/pagemap.h> | 66 | #include <linux/pagemap.h> |
66 | #include <linux/errno.h> | 67 | #include <linux/errno.h> |
67 | #include <linux/videodev.h> | 68 | #include <linux/videodev.h> |
diff --git a/drivers/media/video/usbvideo/vicam.c b/drivers/media/video/usbvideo/vicam.c index 8d73979596f9..45fce39ec9ad 100644 --- a/drivers/media/video/usbvideo/vicam.c +++ b/drivers/media/video/usbvideo/vicam.c | |||
@@ -43,6 +43,7 @@ | |||
43 | #include <linux/vmalloc.h> | 43 | #include <linux/vmalloc.h> |
44 | #include <linux/mm.h> | 44 | #include <linux/mm.h> |
45 | #include <linux/slab.h> | 45 | #include <linux/slab.h> |
46 | #include <linux/smp_lock.h> | ||
46 | #include <linux/mutex.h> | 47 | #include <linux/mutex.h> |
47 | #include <linux/firmware.h> | 48 | #include <linux/firmware.h> |
48 | #include <linux/ihex.h> | 49 | #include <linux/ihex.h> |
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c index 90b58914f984..90d9b5c0e9a7 100644 --- a/drivers/media/video/usbvision/usbvision-video.c +++ b/drivers/media/video/usbvision/usbvision-video.c | |||
@@ -50,6 +50,7 @@ | |||
50 | #include <linux/list.h> | 50 | #include <linux/list.h> |
51 | #include <linux/timer.h> | 51 | #include <linux/timer.h> |
52 | #include <linux/slab.h> | 52 | #include <linux/slab.h> |
53 | #include <linux/smp_lock.h> | ||
53 | #include <linux/mm.h> | 54 | #include <linux/mm.h> |
54 | #include <linux/utsname.h> | 55 | #include <linux/utsname.h> |
55 | #include <linux/highmem.h> | 56 | #include <linux/highmem.h> |
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c index 31eac66411d7..a7f1b69a7dab 100644 --- a/drivers/media/video/v4l2-dev.c +++ b/drivers/media/video/v4l2-dev.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/kmod.h> | 26 | #include <linux/kmod.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/smp_lock.h> | ||
29 | #include <asm/uaccess.h> | 28 | #include <asm/uaccess.h> |
30 | #include <asm/system.h> | 29 | #include <asm/system.h> |
31 | 30 | ||
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index cd7266858462..7705fc6baf00 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c | |||
@@ -343,6 +343,53 @@ static struct bar_std bars[] = { | |||
343 | #define TO_U(r, g, b) \ | 343 | #define TO_U(r, g, b) \ |
344 | (((-9714 * r - 19070 * g + 28784 * b + 32768) >> 16) + 128) | 344 | (((-9714 * r - 19070 * g + 28784 * b + 32768) >> 16) + 128) |
345 | 345 | ||
346 | /* precalculate color bar values to speed up rendering */ | ||
347 | static void precalculate_bars(struct vivi_fh *fh) | ||
348 | { | ||
349 | struct vivi_dev *dev = fh->dev; | ||
350 | unsigned char r, g, b; | ||
351 | int k, is_yuv; | ||
352 | |||
353 | fh->input = dev->input; | ||
354 | |||
355 | for (k = 0; k < 8; k++) { | ||
356 | r = bars[fh->input].bar[k][0]; | ||
357 | g = bars[fh->input].bar[k][1]; | ||
358 | b = bars[fh->input].bar[k][2]; | ||
359 | is_yuv = 0; | ||
360 | |||
361 | switch (fh->fmt->fourcc) { | ||
362 | case V4L2_PIX_FMT_YUYV: | ||
363 | case V4L2_PIX_FMT_UYVY: | ||
364 | is_yuv = 1; | ||
365 | break; | ||
366 | case V4L2_PIX_FMT_RGB565: | ||
367 | case V4L2_PIX_FMT_RGB565X: | ||
368 | r >>= 3; | ||
369 | g >>= 2; | ||
370 | b >>= 3; | ||
371 | break; | ||
372 | case V4L2_PIX_FMT_RGB555: | ||
373 | case V4L2_PIX_FMT_RGB555X: | ||
374 | r >>= 3; | ||
375 | g >>= 3; | ||
376 | b >>= 3; | ||
377 | break; | ||
378 | } | ||
379 | |||
380 | if (is_yuv) { | ||
381 | fh->bars[k][0] = TO_Y(r, g, b); /* Luma */ | ||
382 | fh->bars[k][1] = TO_U(r, g, b); /* Cb */ | ||
383 | fh->bars[k][2] = TO_V(r, g, b); /* Cr */ | ||
384 | } else { | ||
385 | fh->bars[k][0] = r; | ||
386 | fh->bars[k][1] = g; | ||
387 | fh->bars[k][2] = b; | ||
388 | } | ||
389 | } | ||
390 | |||
391 | } | ||
392 | |||
346 | #define TSTAMP_MIN_Y 24 | 393 | #define TSTAMP_MIN_Y 24 |
347 | #define TSTAMP_MAX_Y (TSTAMP_MIN_Y + 15) | 394 | #define TSTAMP_MAX_Y (TSTAMP_MIN_Y + 15) |
348 | #define TSTAMP_INPUT_X 10 | 395 | #define TSTAMP_INPUT_X 10 |
@@ -755,6 +802,8 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, | |||
755 | buf->vb.height = fh->height; | 802 | buf->vb.height = fh->height; |
756 | buf->vb.field = field; | 803 | buf->vb.field = field; |
757 | 804 | ||
805 | precalculate_bars(fh); | ||
806 | |||
758 | if (VIDEOBUF_NEEDS_INIT == buf->vb.state) { | 807 | if (VIDEOBUF_NEEDS_INIT == buf->vb.state) { |
759 | rc = videobuf_iolock(vq, &buf->vb, NULL); | 808 | rc = videobuf_iolock(vq, &buf->vb, NULL); |
760 | if (rc < 0) | 809 | if (rc < 0) |
@@ -893,53 +942,6 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, | |||
893 | return 0; | 942 | return 0; |
894 | } | 943 | } |
895 | 944 | ||
896 | /* precalculate color bar values to speed up rendering */ | ||
897 | static void precalculate_bars(struct vivi_fh *fh) | ||
898 | { | ||
899 | struct vivi_dev *dev = fh->dev; | ||
900 | unsigned char r, g, b; | ||
901 | int k, is_yuv; | ||
902 | |||
903 | fh->input = dev->input; | ||
904 | |||
905 | for (k = 0; k < 8; k++) { | ||
906 | r = bars[fh->input].bar[k][0]; | ||
907 | g = bars[fh->input].bar[k][1]; | ||
908 | b = bars[fh->input].bar[k][2]; | ||
909 | is_yuv = 0; | ||
910 | |||
911 | switch (fh->fmt->fourcc) { | ||
912 | case V4L2_PIX_FMT_YUYV: | ||
913 | case V4L2_PIX_FMT_UYVY: | ||
914 | is_yuv = 1; | ||
915 | break; | ||
916 | case V4L2_PIX_FMT_RGB565: | ||
917 | case V4L2_PIX_FMT_RGB565X: | ||
918 | r >>= 3; | ||
919 | g >>= 2; | ||
920 | b >>= 3; | ||
921 | break; | ||
922 | case V4L2_PIX_FMT_RGB555: | ||
923 | case V4L2_PIX_FMT_RGB555X: | ||
924 | r >>= 3; | ||
925 | g >>= 3; | ||
926 | b >>= 3; | ||
927 | break; | ||
928 | } | ||
929 | |||
930 | if (is_yuv) { | ||
931 | fh->bars[k][0] = TO_Y(r, g, b); /* Luma */ | ||
932 | fh->bars[k][1] = TO_U(r, g, b); /* Cb */ | ||
933 | fh->bars[k][2] = TO_V(r, g, b); /* Cr */ | ||
934 | } else { | ||
935 | fh->bars[k][0] = r; | ||
936 | fh->bars[k][1] = g; | ||
937 | fh->bars[k][2] = b; | ||
938 | } | ||
939 | } | ||
940 | |||
941 | } | ||
942 | |||
943 | /*FIXME: This seems to be generic enough to be at videodev2 */ | 945 | /*FIXME: This seems to be generic enough to be at videodev2 */ |
944 | static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, | 946 | static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, |
945 | struct v4l2_format *f) | 947 | struct v4l2_format *f) |
@@ -965,8 +967,6 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, | |||
965 | fh->vb_vidq.field = f->fmt.pix.field; | 967 | fh->vb_vidq.field = f->fmt.pix.field; |
966 | fh->type = f->type; | 968 | fh->type = f->type; |
967 | 969 | ||
968 | precalculate_bars(fh); | ||
969 | |||
970 | ret = 0; | 970 | ret = 0; |
971 | out: | 971 | out: |
972 | mutex_unlock(&q->vb_lock); | 972 | mutex_unlock(&q->vb_lock); |
@@ -1357,6 +1357,7 @@ static int __init vivi_create_instance(int inst) | |||
1357 | goto unreg_dev; | 1357 | goto unreg_dev; |
1358 | 1358 | ||
1359 | *vfd = vivi_template; | 1359 | *vfd = vivi_template; |
1360 | vfd->debug = debug; | ||
1360 | 1361 | ||
1361 | ret = video_register_device(vfd, VFL_TYPE_GRABBER, video_nr); | 1362 | ret = video_register_device(vfd, VFL_TYPE_GRABBER, video_nr); |
1362 | if (ret < 0) | 1363 | if (ret < 0) |
diff --git a/drivers/media/video/zoran/zoran_driver.c b/drivers/media/video/zoran/zoran_driver.c index 3d7df32a3d87..bcdefb1bcb3d 100644 --- a/drivers/media/video/zoran/zoran_driver.c +++ b/drivers/media/video/zoran/zoran_driver.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <linux/module.h> | 49 | #include <linux/module.h> |
50 | #include <linux/delay.h> | 50 | #include <linux/delay.h> |
51 | #include <linux/slab.h> | 51 | #include <linux/slab.h> |
52 | #include <linux/smp_lock.h> | ||
52 | #include <linux/pci.h> | 53 | #include <linux/pci.h> |
53 | #include <linux/vmalloc.h> | 54 | #include <linux/vmalloc.h> |
54 | #include <linux/wait.h> | 55 | #include <linux/wait.h> |
diff --git a/drivers/mfd/dm355evm_msp.c b/drivers/mfd/dm355evm_msp.c index 7ac12cb0be4a..5b6e58a3ba46 100644 --- a/drivers/mfd/dm355evm_msp.c +++ b/drivers/mfd/dm355evm_msp.c | |||
@@ -32,8 +32,7 @@ | |||
32 | * This driver was tested with firmware revision A4. | 32 | * This driver was tested with firmware revision A4. |
33 | */ | 33 | */ |
34 | 34 | ||
35 | #if defined(CONFIG_KEYBOARD_DM355EVM) \ | 35 | #if defined(CONFIG_INPUT_DM355EVM) || defined(CONFIG_INPUT_DM355EVM_MODULE) |
36 | || defined(CONFIG_KEYBOARD_DM355EVM_MODULE) | ||
37 | #define msp_has_keyboard() true | 36 | #define msp_has_keyboard() true |
38 | #else | 37 | #else |
39 | #define msp_has_keyboard() false | 38 | #define msp_has_keyboard() false |
diff --git a/drivers/misc/sgi-gru/grufile.c b/drivers/misc/sgi-gru/grufile.c index fa2d93a9fb8d..aed609832bc2 100644 --- a/drivers/misc/sgi-gru/grufile.c +++ b/drivers/misc/sgi-gru/grufile.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/mm.h> | 30 | #include <linux/mm.h> |
31 | #include <linux/io.h> | 31 | #include <linux/io.h> |
32 | #include <linux/smp_lock.h> | ||
33 | #include <linux/spinlock.h> | 32 | #include <linux/spinlock.h> |
34 | #include <linux/device.h> | 33 | #include <linux/device.h> |
35 | #include <linux/miscdevice.h> | 34 | #include <linux/miscdevice.h> |
diff --git a/drivers/misc/sgi-gru/grukservices.c b/drivers/misc/sgi-gru/grukservices.c index eedbf9c32760..79689b10f937 100644 --- a/drivers/misc/sgi-gru/grukservices.c +++ b/drivers/misc/sgi-gru/grukservices.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <linux/errno.h> | 24 | #include <linux/errno.h> |
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/mm.h> | 26 | #include <linux/mm.h> |
27 | #include <linux/smp_lock.h> | ||
28 | #include <linux/spinlock.h> | 27 | #include <linux/spinlock.h> |
29 | #include <linux/device.h> | 28 | #include <linux/device.h> |
30 | #include <linux/miscdevice.h> | 29 | #include <linux/miscdevice.h> |
diff --git a/drivers/misc/sgi-xp/xpnet.c b/drivers/misc/sgi-xp/xpnet.c index 8d1c60a3f0df..5d778ec8cdb2 100644 --- a/drivers/misc/sgi-xp/xpnet.c +++ b/drivers/misc/sgi-xp/xpnet.c | |||
@@ -235,7 +235,7 @@ xpnet_receive(short partid, int channel, struct xpnet_message *msg) | |||
235 | skb->ip_summed = CHECKSUM_UNNECESSARY; | 235 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
236 | 236 | ||
237 | dev_dbg(xpnet, "passing skb to network layer\n" | 237 | dev_dbg(xpnet, "passing skb to network layer\n" |
238 | KERN_DEBUG "\tskb->head=0x%p skb->data=0x%p skb->tail=0x%p " | 238 | "\tskb->head=0x%p skb->data=0x%p skb->tail=0x%p " |
239 | "skb->end=0x%p skb->len=%d\n", | 239 | "skb->end=0x%p skb->len=%d\n", |
240 | (void *)skb->head, (void *)skb->data, skb_tail_pointer(skb), | 240 | (void *)skb->head, (void *)skb->data, skb_tail_pointer(skb), |
241 | skb_end_pointer(skb), skb->len); | 241 | skb_end_pointer(skb), skb->len); |
@@ -399,7 +399,7 @@ xpnet_send(struct sk_buff *skb, struct xpnet_pending_msg *queued_msg, | |||
399 | msg->buf_pa = xp_pa((void *)start_addr); | 399 | msg->buf_pa = xp_pa((void *)start_addr); |
400 | 400 | ||
401 | dev_dbg(xpnet, "sending XPC message to %d:%d\n" | 401 | dev_dbg(xpnet, "sending XPC message to %d:%d\n" |
402 | KERN_DEBUG "msg->buf_pa=0x%lx, msg->size=%u, " | 402 | "msg->buf_pa=0x%lx, msg->size=%u, " |
403 | "msg->leadin_ignore=%u, msg->tailout_ignore=%u\n", | 403 | "msg->leadin_ignore=%u, msg->tailout_ignore=%u\n", |
404 | dest_partid, XPC_NET_CHANNEL, msg->buf_pa, msg->size, | 404 | dest_partid, XPC_NET_CHANNEL, msg->buf_pa, msg->size, |
405 | msg->leadin_ignore, msg->tailout_ignore); | 405 | msg->leadin_ignore, msg->tailout_ignore); |
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index 286ed594e5a0..e1f7d0a78b9d 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c | |||
@@ -657,6 +657,11 @@ static int io_init(struct ubi_device *ubi) | |||
657 | if (ubi->mtd->block_isbad && ubi->mtd->block_markbad) | 657 | if (ubi->mtd->block_isbad && ubi->mtd->block_markbad) |
658 | ubi->bad_allowed = 1; | 658 | ubi->bad_allowed = 1; |
659 | 659 | ||
660 | if (ubi->mtd->type == MTD_NORFLASH) { | ||
661 | ubi_assert(ubi->mtd->writesize == 1); | ||
662 | ubi->nor_flash = 1; | ||
663 | } | ||
664 | |||
660 | ubi->min_io_size = ubi->mtd->writesize; | 665 | ubi->min_io_size = ubi->mtd->writesize; |
661 | ubi->hdrs_min_io_size = ubi->mtd->writesize >> ubi->mtd->subpage_sft; | 666 | ubi->hdrs_min_io_size = ubi->mtd->writesize >> ubi->mtd->subpage_sft; |
662 | 667 | ||
@@ -996,6 +1001,7 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, int vid_hdr_offset) | |||
996 | ubi_msg("number of PEBs reserved for bad PEB handling: %d", | 1001 | ubi_msg("number of PEBs reserved for bad PEB handling: %d", |
997 | ubi->beb_rsvd_pebs); | 1002 | ubi->beb_rsvd_pebs); |
998 | ubi_msg("max/mean erase counter: %d/%d", ubi->max_ec, ubi->mean_ec); | 1003 | ubi_msg("max/mean erase counter: %d/%d", ubi->max_ec, ubi->mean_ec); |
1004 | ubi_msg("image sequence number: %d", ubi->image_seq); | ||
999 | 1005 | ||
1000 | /* | 1006 | /* |
1001 | * The below lock makes sure we do not race with 'ubi_thread()' which | 1007 | * The below lock makes sure we do not race with 'ubi_thread()' which |
diff --git a/drivers/mtd/ubi/debug.c b/drivers/mtd/ubi/debug.c index c0ed60e8ade9..54b0186915fb 100644 --- a/drivers/mtd/ubi/debug.c +++ b/drivers/mtd/ubi/debug.c | |||
@@ -44,6 +44,8 @@ void ubi_dbg_dump_ec_hdr(const struct ubi_ec_hdr *ec_hdr) | |||
44 | be32_to_cpu(ec_hdr->vid_hdr_offset)); | 44 | be32_to_cpu(ec_hdr->vid_hdr_offset)); |
45 | printk(KERN_DEBUG "\tdata_offset %d\n", | 45 | printk(KERN_DEBUG "\tdata_offset %d\n", |
46 | be32_to_cpu(ec_hdr->data_offset)); | 46 | be32_to_cpu(ec_hdr->data_offset)); |
47 | printk(KERN_DEBUG "\timage_seq %d\n", | ||
48 | be32_to_cpu(ec_hdr->image_seq)); | ||
47 | printk(KERN_DEBUG "\thdr_crc %#08x\n", | 49 | printk(KERN_DEBUG "\thdr_crc %#08x\n", |
48 | be32_to_cpu(ec_hdr->hdr_crc)); | 50 | be32_to_cpu(ec_hdr->hdr_crc)); |
49 | printk(KERN_DEBUG "erase counter header hexdump:\n"); | 51 | printk(KERN_DEBUG "erase counter header hexdump:\n"); |
diff --git a/drivers/mtd/ubi/debug.h b/drivers/mtd/ubi/debug.h index 13777e5beac9..a4da7a09b949 100644 --- a/drivers/mtd/ubi/debug.h +++ b/drivers/mtd/ubi/debug.h | |||
@@ -93,6 +93,12 @@ void ubi_dbg_dump_mkvol_req(const struct ubi_mkvol_req *req); | |||
93 | #define UBI_IO_DEBUG 0 | 93 | #define UBI_IO_DEBUG 0 |
94 | #endif | 94 | #endif |
95 | 95 | ||
96 | #ifdef CONFIG_MTD_UBI_DEBUG_PARANOID | ||
97 | int ubi_dbg_check_all_ff(struct ubi_device *ubi, int pnum, int offset, int len); | ||
98 | #else | ||
99 | #define ubi_dbg_check_all_ff(ubi, pnum, offset, len) 0 | ||
100 | #endif | ||
101 | |||
96 | #ifdef CONFIG_MTD_UBI_DEBUG_DISABLE_BGT | 102 | #ifdef CONFIG_MTD_UBI_DEBUG_DISABLE_BGT |
97 | #define DBG_DISABLE_BGT 1 | 103 | #define DBG_DISABLE_BGT 1 |
98 | #else | 104 | #else |
@@ -167,6 +173,7 @@ static inline int ubi_dbg_is_erase_failure(void) | |||
167 | #define ubi_dbg_is_bitflip() 0 | 173 | #define ubi_dbg_is_bitflip() 0 |
168 | #define ubi_dbg_is_write_failure() 0 | 174 | #define ubi_dbg_is_write_failure() 0 |
169 | #define ubi_dbg_is_erase_failure() 0 | 175 | #define ubi_dbg_is_erase_failure() 0 |
176 | #define ubi_dbg_check_all_ff(ubi, pnum, offset, len) 0 | ||
170 | 177 | ||
171 | #endif /* !CONFIG_MTD_UBI_DEBUG */ | 178 | #endif /* !CONFIG_MTD_UBI_DEBUG */ |
172 | #endif /* !__UBI_DEBUG_H__ */ | 179 | #endif /* !__UBI_DEBUG_H__ */ |
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c index effaff28bab1..4cb69925d8d9 100644 --- a/drivers/mtd/ubi/io.c +++ b/drivers/mtd/ubi/io.c | |||
@@ -98,17 +98,12 @@ static int paranoid_check_ec_hdr(const struct ubi_device *ubi, int pnum, | |||
98 | static int paranoid_check_peb_vid_hdr(const struct ubi_device *ubi, int pnum); | 98 | static int paranoid_check_peb_vid_hdr(const struct ubi_device *ubi, int pnum); |
99 | static int paranoid_check_vid_hdr(const struct ubi_device *ubi, int pnum, | 99 | static int paranoid_check_vid_hdr(const struct ubi_device *ubi, int pnum, |
100 | const struct ubi_vid_hdr *vid_hdr); | 100 | const struct ubi_vid_hdr *vid_hdr); |
101 | static int paranoid_check_all_ff(struct ubi_device *ubi, int pnum, int offset, | ||
102 | int len); | ||
103 | static int paranoid_check_empty(struct ubi_device *ubi, int pnum); | ||
104 | #else | 101 | #else |
105 | #define paranoid_check_not_bad(ubi, pnum) 0 | 102 | #define paranoid_check_not_bad(ubi, pnum) 0 |
106 | #define paranoid_check_peb_ec_hdr(ubi, pnum) 0 | 103 | #define paranoid_check_peb_ec_hdr(ubi, pnum) 0 |
107 | #define paranoid_check_ec_hdr(ubi, pnum, ec_hdr) 0 | 104 | #define paranoid_check_ec_hdr(ubi, pnum, ec_hdr) 0 |
108 | #define paranoid_check_peb_vid_hdr(ubi, pnum) 0 | 105 | #define paranoid_check_peb_vid_hdr(ubi, pnum) 0 |
109 | #define paranoid_check_vid_hdr(ubi, pnum, vid_hdr) 0 | 106 | #define paranoid_check_vid_hdr(ubi, pnum, vid_hdr) 0 |
110 | #define paranoid_check_all_ff(ubi, pnum, offset, len) 0 | ||
111 | #define paranoid_check_empty(ubi, pnum) 0 | ||
112 | #endif | 107 | #endif |
113 | 108 | ||
114 | /** | 109 | /** |
@@ -244,7 +239,7 @@ int ubi_io_write(struct ubi_device *ubi, const void *buf, int pnum, int offset, | |||
244 | return err > 0 ? -EINVAL : err; | 239 | return err > 0 ? -EINVAL : err; |
245 | 240 | ||
246 | /* The area we are writing to has to contain all 0xFF bytes */ | 241 | /* The area we are writing to has to contain all 0xFF bytes */ |
247 | err = paranoid_check_all_ff(ubi, pnum, offset, len); | 242 | err = ubi_dbg_check_all_ff(ubi, pnum, offset, len); |
248 | if (err) | 243 | if (err) |
249 | return err > 0 ? -EINVAL : err; | 244 | return err > 0 ? -EINVAL : err; |
250 | 245 | ||
@@ -271,8 +266,8 @@ int ubi_io_write(struct ubi_device *ubi, const void *buf, int pnum, int offset, | |||
271 | addr = (loff_t)pnum * ubi->peb_size + offset; | 266 | addr = (loff_t)pnum * ubi->peb_size + offset; |
272 | err = ubi->mtd->write(ubi->mtd, addr, len, &written, buf); | 267 | err = ubi->mtd->write(ubi->mtd, addr, len, &written, buf); |
273 | if (err) { | 268 | if (err) { |
274 | ubi_err("error %d while writing %d bytes to PEB %d:%d, written" | 269 | ubi_err("error %d while writing %d bytes to PEB %d:%d, written " |
275 | " %zd bytes", err, len, pnum, offset, written); | 270 | "%zd bytes", err, len, pnum, offset, written); |
276 | ubi_dbg_dump_stack(); | 271 | ubi_dbg_dump_stack(); |
277 | } else | 272 | } else |
278 | ubi_assert(written == len); | 273 | ubi_assert(written == len); |
@@ -350,7 +345,7 @@ retry: | |||
350 | return -EIO; | 345 | return -EIO; |
351 | } | 346 | } |
352 | 347 | ||
353 | err = paranoid_check_all_ff(ubi, pnum, 0, ubi->peb_size); | 348 | err = ubi_dbg_check_all_ff(ubi, pnum, 0, ubi->peb_size); |
354 | if (err) | 349 | if (err) |
355 | return err > 0 ? -EINVAL : err; | 350 | return err > 0 ? -EINVAL : err; |
356 | 351 | ||
@@ -459,6 +454,54 @@ out: | |||
459 | } | 454 | } |
460 | 455 | ||
461 | /** | 456 | /** |
457 | * nor_erase_prepare - prepare a NOR flash PEB for erasure. | ||
458 | * @ubi: UBI device description object | ||
459 | * @pnum: physical eraseblock number to prepare | ||
460 | * | ||
461 | * NOR flash, or at least some of them, have peculiar embedded PEB erasure | ||
462 | * algorithm: the PEB is first filled with zeroes, then it is erased. And | ||
463 | * filling with zeroes starts from the end of the PEB. This was observed with | ||
464 | * Spansion S29GL512N NOR flash. | ||
465 | * | ||
466 | * This means that in case of a power cut we may end up with intact data at the | ||
467 | * beginning of the PEB, and all zeroes at the end of PEB. In other words, the | ||
468 | * EC and VID headers are OK, but a large chunk of data at the end of PEB is | ||
469 | * zeroed. This makes UBI mistakenly treat this PEB as used and associate it | ||
470 | * with an LEB, which leads to subsequent failures (e.g., UBIFS fails). | ||
471 | * | ||
472 | * This function is called before erasing NOR PEBs and it zeroes out EC and VID | ||
473 | * magic numbers in order to invalidate them and prevent the failures. Returns | ||
474 | * zero in case of success and a negative error code in case of failure. | ||
475 | */ | ||
476 | static int nor_erase_prepare(struct ubi_device *ubi, int pnum) | ||
477 | { | ||
478 | int err; | ||
479 | size_t written; | ||
480 | loff_t addr; | ||
481 | uint32_t data = 0; | ||
482 | |||
483 | addr = (loff_t)pnum * ubi->peb_size; | ||
484 | err = ubi->mtd->write(ubi->mtd, addr, 4, &written, (void *)&data); | ||
485 | if (err) { | ||
486 | ubi_err("error %d while writing 4 bytes to PEB %d:%d, written " | ||
487 | "%zd bytes", err, pnum, 0, written); | ||
488 | ubi_dbg_dump_stack(); | ||
489 | return err; | ||
490 | } | ||
491 | |||
492 | addr += ubi->vid_hdr_aloffset; | ||
493 | err = ubi->mtd->write(ubi->mtd, addr, 4, &written, (void *)&data); | ||
494 | if (err) { | ||
495 | ubi_err("error %d while writing 4 bytes to PEB %d:%d, written " | ||
496 | "%zd bytes", err, pnum, ubi->vid_hdr_aloffset, written); | ||
497 | ubi_dbg_dump_stack(); | ||
498 | return err; | ||
499 | } | ||
500 | |||
501 | return 0; | ||
502 | } | ||
503 | |||
504 | /** | ||
462 | * ubi_io_sync_erase - synchronously erase a physical eraseblock. | 505 | * ubi_io_sync_erase - synchronously erase a physical eraseblock. |
463 | * @ubi: UBI device description object | 506 | * @ubi: UBI device description object |
464 | * @pnum: physical eraseblock number to erase | 507 | * @pnum: physical eraseblock number to erase |
@@ -489,6 +532,12 @@ int ubi_io_sync_erase(struct ubi_device *ubi, int pnum, int torture) | |||
489 | return -EROFS; | 532 | return -EROFS; |
490 | } | 533 | } |
491 | 534 | ||
535 | if (ubi->nor_flash) { | ||
536 | err = nor_erase_prepare(ubi, pnum); | ||
537 | if (err) | ||
538 | return err; | ||
539 | } | ||
540 | |||
492 | if (torture) { | 541 | if (torture) { |
493 | ret = torture_peb(ubi, pnum); | 542 | ret = torture_peb(ubi, pnum); |
494 | if (ret < 0) | 543 | if (ret < 0) |
@@ -672,11 +721,6 @@ int ubi_io_read_ec_hdr(struct ubi_device *ubi, int pnum, | |||
672 | if (read_err != -EBADMSG && | 721 | if (read_err != -EBADMSG && |
673 | check_pattern(ec_hdr, 0xFF, UBI_EC_HDR_SIZE)) { | 722 | check_pattern(ec_hdr, 0xFF, UBI_EC_HDR_SIZE)) { |
674 | /* The physical eraseblock is supposedly empty */ | 723 | /* The physical eraseblock is supposedly empty */ |
675 | err = paranoid_check_all_ff(ubi, pnum, 0, | ||
676 | ubi->peb_size); | ||
677 | if (err) | ||
678 | return err > 0 ? UBI_IO_BAD_EC_HDR : err; | ||
679 | |||
680 | if (verbose) | 724 | if (verbose) |
681 | ubi_warn("no EC header found at PEB %d, " | 725 | ubi_warn("no EC header found at PEB %d, " |
682 | "only 0xFF bytes", pnum); | 726 | "only 0xFF bytes", pnum); |
@@ -752,6 +796,7 @@ int ubi_io_write_ec_hdr(struct ubi_device *ubi, int pnum, | |||
752 | ec_hdr->version = UBI_VERSION; | 796 | ec_hdr->version = UBI_VERSION; |
753 | ec_hdr->vid_hdr_offset = cpu_to_be32(ubi->vid_hdr_offset); | 797 | ec_hdr->vid_hdr_offset = cpu_to_be32(ubi->vid_hdr_offset); |
754 | ec_hdr->data_offset = cpu_to_be32(ubi->leb_start); | 798 | ec_hdr->data_offset = cpu_to_be32(ubi->leb_start); |
799 | ec_hdr->image_seq = cpu_to_be32(ubi->image_seq); | ||
755 | crc = crc32(UBI_CRC32_INIT, ec_hdr, UBI_EC_HDR_SIZE_CRC); | 800 | crc = crc32(UBI_CRC32_INIT, ec_hdr, UBI_EC_HDR_SIZE_CRC); |
756 | ec_hdr->hdr_crc = cpu_to_be32(crc); | 801 | ec_hdr->hdr_crc = cpu_to_be32(crc); |
757 | 802 | ||
@@ -947,15 +992,6 @@ int ubi_io_read_vid_hdr(struct ubi_device *ubi, int pnum, | |||
947 | if (read_err != -EBADMSG && | 992 | if (read_err != -EBADMSG && |
948 | check_pattern(vid_hdr, 0xFF, UBI_VID_HDR_SIZE)) { | 993 | check_pattern(vid_hdr, 0xFF, UBI_VID_HDR_SIZE)) { |
949 | /* The physical eraseblock is supposedly free */ | 994 | /* The physical eraseblock is supposedly free */ |
950 | |||
951 | /* | ||
952 | * The below is just a paranoid check, it has to be | ||
953 | * compiled out if paranoid checks are disabled. | ||
954 | */ | ||
955 | err = paranoid_check_empty(ubi, pnum); | ||
956 | if (err) | ||
957 | return err > 0 ? UBI_IO_BAD_VID_HDR : err; | ||
958 | |||
959 | if (verbose) | 995 | if (verbose) |
960 | ubi_warn("no VID header found at PEB %d, " | 996 | ubi_warn("no VID header found at PEB %d, " |
961 | "only 0xFF bytes", pnum); | 997 | "only 0xFF bytes", pnum); |
@@ -1229,7 +1265,7 @@ exit: | |||
1229 | } | 1265 | } |
1230 | 1266 | ||
1231 | /** | 1267 | /** |
1232 | * paranoid_check_all_ff - check that a region of flash is empty. | 1268 | * ubi_dbg_check_all_ff - check that a region of flash is empty. |
1233 | * @ubi: UBI device description object | 1269 | * @ubi: UBI device description object |
1234 | * @pnum: the physical eraseblock number to check | 1270 | * @pnum: the physical eraseblock number to check |
1235 | * @offset: the starting offset within the physical eraseblock to check | 1271 | * @offset: the starting offset within the physical eraseblock to check |
@@ -1239,8 +1275,7 @@ exit: | |||
1239 | * @offset of the physical eraseblock @pnum, %1 if not, and a negative error | 1275 | * @offset of the physical eraseblock @pnum, %1 if not, and a negative error |
1240 | * code if an error occurred. | 1276 | * code if an error occurred. |
1241 | */ | 1277 | */ |
1242 | static int paranoid_check_all_ff(struct ubi_device *ubi, int pnum, int offset, | 1278 | int ubi_dbg_check_all_ff(struct ubi_device *ubi, int pnum, int offset, int len) |
1243 | int len) | ||
1244 | { | 1279 | { |
1245 | size_t read; | 1280 | size_t read; |
1246 | int err; | 1281 | int err; |
@@ -1276,74 +1311,4 @@ error: | |||
1276 | return err; | 1311 | return err; |
1277 | } | 1312 | } |
1278 | 1313 | ||
1279 | /** | ||
1280 | * paranoid_check_empty - whether a PEB is empty. | ||
1281 | * @ubi: UBI device description object | ||
1282 | * @pnum: the physical eraseblock number to check | ||
1283 | * | ||
1284 | * This function makes sure PEB @pnum is empty, which means it contains only | ||
1285 | * %0xFF data bytes. Returns zero if the PEB is empty, %1 if not, and a | ||
1286 | * negative error code in case of failure. | ||
1287 | * | ||
1288 | * Empty PEBs have the EC header, and do not have the VID header. The caller of | ||
1289 | * this function should have already made sure the PEB does not have the VID | ||
1290 | * header. However, this function re-checks that, because it is possible that | ||
1291 | * the header and data has already been written to the PEB. | ||
1292 | * | ||
1293 | * Let's consider a possible scenario. Suppose there are 2 tasks - A and B. | ||
1294 | * Task A is in 'wear_leveling_worker()'. It is reading VID header of PEB X to | ||
1295 | * find which LEB it corresponds to. PEB X is currently unmapped, and has no | ||
1296 | * VID header. Task B is trying to write to PEB X. | ||
1297 | * | ||
1298 | * Task A: in 'ubi_io_read_vid_hdr()': reads the VID header from PEB X. The | ||
1299 | * read data contain all 0xFF bytes; | ||
1300 | * Task B: writes VID header and some data to PEB X; | ||
1301 | * Task A: assumes PEB X is empty, calls 'paranoid_check_empty()'. And if we | ||
1302 | * do not re-read the VID header, and do not cancel the checking if it | ||
1303 | * is there, we fail. | ||
1304 | */ | ||
1305 | static int paranoid_check_empty(struct ubi_device *ubi, int pnum) | ||
1306 | { | ||
1307 | int err, offs = ubi->vid_hdr_aloffset, len = ubi->vid_hdr_alsize; | ||
1308 | size_t read; | ||
1309 | uint32_t magic; | ||
1310 | const struct ubi_vid_hdr *vid_hdr; | ||
1311 | |||
1312 | mutex_lock(&ubi->dbg_buf_mutex); | ||
1313 | err = ubi->mtd->read(ubi->mtd, offs, len, &read, ubi->dbg_peb_buf); | ||
1314 | if (err && err != -EUCLEAN) { | ||
1315 | ubi_err("error %d while reading %d bytes from PEB %d:%d, " | ||
1316 | "read %zd bytes", err, len, pnum, offs, read); | ||
1317 | goto error; | ||
1318 | } | ||
1319 | |||
1320 | vid_hdr = ubi->dbg_peb_buf; | ||
1321 | magic = be32_to_cpu(vid_hdr->magic); | ||
1322 | if (magic == UBI_VID_HDR_MAGIC) | ||
1323 | /* The PEB contains VID header, so it is not empty */ | ||
1324 | goto out; | ||
1325 | |||
1326 | err = check_pattern(ubi->dbg_peb_buf, 0xFF, len); | ||
1327 | if (err == 0) { | ||
1328 | ubi_err("flash region at PEB %d:%d, length %d does not " | ||
1329 | "contain all 0xFF bytes", pnum, offs, len); | ||
1330 | goto fail; | ||
1331 | } | ||
1332 | |||
1333 | out: | ||
1334 | mutex_unlock(&ubi->dbg_buf_mutex); | ||
1335 | return 0; | ||
1336 | |||
1337 | fail: | ||
1338 | ubi_err("paranoid check failed for PEB %d", pnum); | ||
1339 | ubi_msg("hex dump of the %d-%d region", offs, offs + len); | ||
1340 | print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 1, | ||
1341 | ubi->dbg_peb_buf, len, 1); | ||
1342 | err = 1; | ||
1343 | error: | ||
1344 | ubi_dbg_dump_stack(); | ||
1345 | mutex_unlock(&ubi->dbg_buf_mutex); | ||
1346 | return err; | ||
1347 | } | ||
1348 | |||
1349 | #endif /* CONFIG_MTD_UBI_DEBUG_PARANOID */ | 1314 | #endif /* CONFIG_MTD_UBI_DEBUG_PARANOID */ |
diff --git a/drivers/mtd/ubi/scan.c b/drivers/mtd/ubi/scan.c index c3d653ba5ca0..f60895ee0aeb 100644 --- a/drivers/mtd/ubi/scan.c +++ b/drivers/mtd/ubi/scan.c | |||
@@ -757,6 +757,8 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si, | |||
757 | si->is_empty = 0; | 757 | si->is_empty = 0; |
758 | 758 | ||
759 | if (!ec_corr) { | 759 | if (!ec_corr) { |
760 | int image_seq; | ||
761 | |||
760 | /* Make sure UBI version is OK */ | 762 | /* Make sure UBI version is OK */ |
761 | if (ech->version != UBI_VERSION) { | 763 | if (ech->version != UBI_VERSION) { |
762 | ubi_err("this UBI version is %d, image version is %d", | 764 | ubi_err("this UBI version is %d, image version is %d", |
@@ -778,6 +780,18 @@ static int process_eb(struct ubi_device *ubi, struct ubi_scan_info *si, | |||
778 | ubi_dbg_dump_ec_hdr(ech); | 780 | ubi_dbg_dump_ec_hdr(ech); |
779 | return -EINVAL; | 781 | return -EINVAL; |
780 | } | 782 | } |
783 | |||
784 | image_seq = be32_to_cpu(ech->ec); | ||
785 | if (!si->image_seq_set) { | ||
786 | ubi->image_seq = image_seq; | ||
787 | si->image_seq_set = 1; | ||
788 | } else if (ubi->image_seq != image_seq) { | ||
789 | ubi_err("bad image sequence number %d in PEB %d, " | ||
790 | "expected %d", image_seq, pnum, ubi->image_seq); | ||
791 | ubi_dbg_dump_ec_hdr(ech); | ||
792 | return -EINVAL; | ||
793 | } | ||
794 | |||
781 | } | 795 | } |
782 | 796 | ||
783 | /* OK, we've done with the EC header, let's look at the VID header */ | 797 | /* OK, we've done with the EC header, let's look at the VID header */ |
diff --git a/drivers/mtd/ubi/scan.h b/drivers/mtd/ubi/scan.h index 61df208e2f20..1017cf12def5 100644 --- a/drivers/mtd/ubi/scan.h +++ b/drivers/mtd/ubi/scan.h | |||
@@ -102,6 +102,7 @@ struct ubi_scan_volume { | |||
102 | * @mean_ec: mean erase counter value | 102 | * @mean_ec: mean erase counter value |
103 | * @ec_sum: a temporary variable used when calculating @mean_ec | 103 | * @ec_sum: a temporary variable used when calculating @mean_ec |
104 | * @ec_count: a temporary variable used when calculating @mean_ec | 104 | * @ec_count: a temporary variable used when calculating @mean_ec |
105 | * @image_seq_set: indicates @ubi->image_seq is known | ||
105 | * | 106 | * |
106 | * This data structure contains the result of scanning and may be used by other | 107 | * This data structure contains the result of scanning and may be used by other |
107 | * UBI sub-systems to build final UBI data structures, further error-recovery | 108 | * UBI sub-systems to build final UBI data structures, further error-recovery |
@@ -124,6 +125,7 @@ struct ubi_scan_info { | |||
124 | int mean_ec; | 125 | int mean_ec; |
125 | uint64_t ec_sum; | 126 | uint64_t ec_sum; |
126 | int ec_count; | 127 | int ec_count; |
128 | int image_seq_set; | ||
127 | }; | 129 | }; |
128 | 130 | ||
129 | struct ubi_device; | 131 | struct ubi_device; |
diff --git a/drivers/mtd/ubi/ubi-media.h b/drivers/mtd/ubi/ubi-media.h index 8419fdccc79c..503ea9b27309 100644 --- a/drivers/mtd/ubi/ubi-media.h +++ b/drivers/mtd/ubi/ubi-media.h | |||
@@ -129,6 +129,7 @@ enum { | |||
129 | * @ec: the erase counter | 129 | * @ec: the erase counter |
130 | * @vid_hdr_offset: where the VID header starts | 130 | * @vid_hdr_offset: where the VID header starts |
131 | * @data_offset: where the user data start | 131 | * @data_offset: where the user data start |
132 | * @image_seq: image sequence number | ||
132 | * @padding2: reserved for future, zeroes | 133 | * @padding2: reserved for future, zeroes |
133 | * @hdr_crc: erase counter header CRC checksum | 134 | * @hdr_crc: erase counter header CRC checksum |
134 | * | 135 | * |
@@ -144,6 +145,14 @@ enum { | |||
144 | * volume identifier header and user data, relative to the beginning of the | 145 | * volume identifier header and user data, relative to the beginning of the |
145 | * physical eraseblock. These values have to be the same for all physical | 146 | * physical eraseblock. These values have to be the same for all physical |
146 | * eraseblocks. | 147 | * eraseblocks. |
148 | * | ||
149 | * The @image_seq field is used to validate a UBI image that has been prepared | ||
150 | * for a UBI device. The @image_seq value can be any value, but it must be the | ||
151 | * same on all eraseblocks. UBI will ensure that all new erase counter headers | ||
152 | * also contain this value, and will check the value when scanning at start-up. | ||
153 | * One way to make use of @image_seq is to increase its value by one every time | ||
154 | * an image is flashed over an existing image, then, if the flashing does not | ||
155 | * complete, UBI will detect the error when scanning. | ||
147 | */ | 156 | */ |
148 | struct ubi_ec_hdr { | 157 | struct ubi_ec_hdr { |
149 | __be32 magic; | 158 | __be32 magic; |
@@ -152,7 +161,8 @@ struct ubi_ec_hdr { | |||
152 | __be64 ec; /* Warning: the current limit is 31-bit anyway! */ | 161 | __be64 ec; /* Warning: the current limit is 31-bit anyway! */ |
153 | __be32 vid_hdr_offset; | 162 | __be32 vid_hdr_offset; |
154 | __be32 data_offset; | 163 | __be32 data_offset; |
155 | __u8 padding2[36]; | 164 | __be32 image_seq; |
165 | __u8 padding2[32]; | ||
156 | __be32 hdr_crc; | 166 | __be32 hdr_crc; |
157 | } __attribute__ ((packed)); | 167 | } __attribute__ ((packed)); |
158 | 168 | ||
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h index 28acd133c997..6a5fe9633783 100644 --- a/drivers/mtd/ubi/ubi.h +++ b/drivers/mtd/ubi/ubi.h | |||
@@ -301,6 +301,7 @@ struct ubi_wl_entry; | |||
301 | * @vol->readers, @vol->writers, @vol->exclusive, | 301 | * @vol->readers, @vol->writers, @vol->exclusive, |
302 | * @vol->ref_count, @vol->mapping and @vol->eba_tbl. | 302 | * @vol->ref_count, @vol->mapping and @vol->eba_tbl. |
303 | * @ref_count: count of references on the UBI device | 303 | * @ref_count: count of references on the UBI device |
304 | * @image_seq: image sequence number recorded on EC headers | ||
304 | * | 305 | * |
305 | * @rsvd_pebs: count of reserved physical eraseblocks | 306 | * @rsvd_pebs: count of reserved physical eraseblocks |
306 | * @avail_pebs: count of available physical eraseblocks | 307 | * @avail_pebs: count of available physical eraseblocks |
@@ -372,6 +373,7 @@ struct ubi_wl_entry; | |||
372 | * @vid_hdr_shift: contains @vid_hdr_offset - @vid_hdr_aloffset | 373 | * @vid_hdr_shift: contains @vid_hdr_offset - @vid_hdr_aloffset |
373 | * @bad_allowed: whether the MTD device admits of bad physical eraseblocks or | 374 | * @bad_allowed: whether the MTD device admits of bad physical eraseblocks or |
374 | * not | 375 | * not |
376 | * @nor_flash: non-zero if working on top of NOR flash | ||
375 | * @mtd: MTD device descriptor | 377 | * @mtd: MTD device descriptor |
376 | * | 378 | * |
377 | * @peb_buf1: a buffer of PEB size used for different purposes | 379 | * @peb_buf1: a buffer of PEB size used for different purposes |
@@ -390,6 +392,7 @@ struct ubi_device { | |||
390 | struct ubi_volume *volumes[UBI_MAX_VOLUMES+UBI_INT_VOL_COUNT]; | 392 | struct ubi_volume *volumes[UBI_MAX_VOLUMES+UBI_INT_VOL_COUNT]; |
391 | spinlock_t volumes_lock; | 393 | spinlock_t volumes_lock; |
392 | int ref_count; | 394 | int ref_count; |
395 | int image_seq; | ||
393 | 396 | ||
394 | int rsvd_pebs; | 397 | int rsvd_pebs; |
395 | int avail_pebs; | 398 | int avail_pebs; |
@@ -452,7 +455,8 @@ struct ubi_device { | |||
452 | int vid_hdr_offset; | 455 | int vid_hdr_offset; |
453 | int vid_hdr_aloffset; | 456 | int vid_hdr_aloffset; |
454 | int vid_hdr_shift; | 457 | int vid_hdr_shift; |
455 | int bad_allowed; | 458 | unsigned int bad_allowed:1; |
459 | unsigned int nor_flash:1; | ||
456 | struct mtd_info *mtd; | 460 | struct mtd_info *mtd; |
457 | 461 | ||
458 | void *peb_buf1; | 462 | void *peb_buf1; |
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c index 2b2472300610..600c7229d5cf 100644 --- a/drivers/mtd/ubi/wl.c +++ b/drivers/mtd/ubi/wl.c | |||
@@ -459,6 +459,14 @@ retry: | |||
459 | dbg_wl("PEB %d EC %d", e->pnum, e->ec); | 459 | dbg_wl("PEB %d EC %d", e->pnum, e->ec); |
460 | prot_queue_add(ubi, e); | 460 | prot_queue_add(ubi, e); |
461 | spin_unlock(&ubi->wl_lock); | 461 | spin_unlock(&ubi->wl_lock); |
462 | |||
463 | err = ubi_dbg_check_all_ff(ubi, e->pnum, ubi->vid_hdr_aloffset, | ||
464 | ubi->peb_size - ubi->vid_hdr_aloffset); | ||
465 | if (err) { | ||
466 | ubi_err("new PEB %d does not contain all 0xFF bytes", e->pnum); | ||
467 | return err > 0 ? -EINVAL : err; | ||
468 | } | ||
469 | |||
462 | return e->pnum; | 470 | return e->pnum; |
463 | } | 471 | } |
464 | 472 | ||
diff --git a/drivers/net/a2065.c b/drivers/net/a2065.c index 85a18175730b..08787f5a22a3 100644 --- a/drivers/net/a2065.c +++ b/drivers/net/a2065.c | |||
@@ -569,16 +569,8 @@ static int lance_start_xmit (struct sk_buff *skb, struct net_device *dev) | |||
569 | 569 | ||
570 | #ifdef DEBUG_DRIVER | 570 | #ifdef DEBUG_DRIVER |
571 | /* dump the packet */ | 571 | /* dump the packet */ |
572 | { | 572 | print_hex_dump(KERN_DEBUG, "skb->data: ", DUMP_PREFIX_NONE, |
573 | int i; | 573 | 16, 1, skb->data, 64, true); |
574 | |||
575 | for (i = 0; i < 64; i++) { | ||
576 | if ((i % 16) == 0) | ||
577 | printk("\n" KERN_DEBUG); | ||
578 | printk ("%2.2x ", skb->data [i]); | ||
579 | } | ||
580 | printk("\n"); | ||
581 | } | ||
582 | #endif | 574 | #endif |
583 | entry = lp->tx_new & lp->tx_ring_mod_mask; | 575 | entry = lp->tx_new & lp->tx_ring_mod_mask; |
584 | ib->btx_ring [entry].length = (-skblen) | 0xf000; | 576 | ib->btx_ring [entry].length = (-skblen) | 0xf000; |
diff --git a/drivers/net/arcnet/arcnet.c b/drivers/net/arcnet/arcnet.c index d6d4ab3b430c..7d227cdab9f8 100644 --- a/drivers/net/arcnet/arcnet.c +++ b/drivers/net/arcnet/arcnet.c | |||
@@ -158,15 +158,12 @@ module_exit(arcnet_exit); | |||
158 | void arcnet_dump_skb(struct net_device *dev, | 158 | void arcnet_dump_skb(struct net_device *dev, |
159 | struct sk_buff *skb, char *desc) | 159 | struct sk_buff *skb, char *desc) |
160 | { | 160 | { |
161 | int i; | 161 | char hdr[32]; |
162 | 162 | ||
163 | printk(KERN_DEBUG "%6s: skb dump (%s) follows:", dev->name, desc); | 163 | /* dump the packet */ |
164 | for (i = 0; i < skb->len; i++) { | 164 | snprintf(hdr, sizeof(hdr), "%6s:%s skb->data:", dev->name, desc); |
165 | if (i % 16 == 0) | 165 | print_hex_dump(KERN_DEBUG, hdr, DUMP_PREFIX_OFFSET, |
166 | printk("\n" KERN_DEBUG "[%04X] ", i); | 166 | 16, 1, skb->data, skb->len, true); |
167 | printk("%02X ", ((u_char *) skb->data)[i]); | ||
168 | } | ||
169 | printk("\n"); | ||
170 | } | 167 | } |
171 | 168 | ||
172 | EXPORT_SYMBOL(arcnet_dump_skb); | 169 | EXPORT_SYMBOL(arcnet_dump_skb); |
@@ -184,6 +181,7 @@ static void arcnet_dump_packet(struct net_device *dev, int bufnum, | |||
184 | int i, length; | 181 | int i, length; |
185 | unsigned long flags = 0; | 182 | unsigned long flags = 0; |
186 | static uint8_t buf[512]; | 183 | static uint8_t buf[512]; |
184 | char hdr[32]; | ||
187 | 185 | ||
188 | /* hw.copy_from_card expects IRQ context so take the IRQ lock | 186 | /* hw.copy_from_card expects IRQ context so take the IRQ lock |
189 | to keep it single threaded */ | 187 | to keep it single threaded */ |
@@ -197,14 +195,10 @@ static void arcnet_dump_packet(struct net_device *dev, int bufnum, | |||
197 | /* if the offset[0] byte is nonzero, this is a 256-byte packet */ | 195 | /* if the offset[0] byte is nonzero, this is a 256-byte packet */ |
198 | length = (buf[2] ? 256 : 512); | 196 | length = (buf[2] ? 256 : 512); |
199 | 197 | ||
200 | printk(KERN_DEBUG "%6s: packet dump (%s) follows:", dev->name, desc); | 198 | /* dump the packet */ |
201 | for (i = 0; i < length; i++) { | 199 | snprintf(hdr, sizeof(hdr), "%6s:%s packet dump:", dev->name, desc); |
202 | if (i % 16 == 0) | 200 | print_hex_dump(KERN_DEBUG, hdr, DUMP_PREFIX_OFFSET, |
203 | printk("\n" KERN_DEBUG "[%04X] ", i); | 201 | 16, 1, buf, length, true); |
204 | printk("%02X ", buf[i]); | ||
205 | } | ||
206 | printk("\n"); | ||
207 | |||
208 | } | 202 | } |
209 | 203 | ||
210 | #else | 204 | #else |
diff --git a/drivers/net/benet/be_hw.h b/drivers/net/benet/be_hw.h index b02e805c1db3..29c33c709c6d 100644 --- a/drivers/net/benet/be_hw.h +++ b/drivers/net/benet/be_hw.h | |||
@@ -55,6 +55,10 @@ | |||
55 | #define MEMBAR_CTRL_INT_CTRL_PFUNC_MASK 0x7 /* bits 26 - 28 */ | 55 | #define MEMBAR_CTRL_INT_CTRL_PFUNC_MASK 0x7 /* bits 26 - 28 */ |
56 | #define MEMBAR_CTRL_INT_CTRL_PFUNC_SHIFT 26 | 56 | #define MEMBAR_CTRL_INT_CTRL_PFUNC_SHIFT 26 |
57 | 57 | ||
58 | /********* ISR0 Register offset **********/ | ||
59 | #define CEV_ISR0_OFFSET 0xC18 | ||
60 | #define CEV_ISR_SIZE 4 | ||
61 | |||
58 | /********* Event Q door bell *************/ | 62 | /********* Event Q door bell *************/ |
59 | #define DB_EQ_OFFSET DB_CQ_OFFSET | 63 | #define DB_EQ_OFFSET DB_CQ_OFFSET |
60 | #define DB_EQ_RING_ID_MASK 0x1FF /* bits 0 - 8 */ | 64 | #define DB_EQ_RING_ID_MASK 0x1FF /* bits 0 - 8 */ |
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c index 308eb09ca56b..c43f6a119295 100644 --- a/drivers/net/benet/be_main.c +++ b/drivers/net/benet/be_main.c | |||
@@ -1274,15 +1274,17 @@ static irqreturn_t be_intx(int irq, void *dev) | |||
1274 | { | 1274 | { |
1275 | struct be_adapter *adapter = dev; | 1275 | struct be_adapter *adapter = dev; |
1276 | struct be_ctrl_info *ctrl = &adapter->ctrl; | 1276 | struct be_ctrl_info *ctrl = &adapter->ctrl; |
1277 | int rx, tx; | 1277 | int isr; |
1278 | 1278 | ||
1279 | tx = event_handle(ctrl, &adapter->tx_eq); | 1279 | isr = ioread32(ctrl->csr + CEV_ISR0_OFFSET + |
1280 | rx = event_handle(ctrl, &adapter->rx_eq); | 1280 | ctrl->pci_func * CEV_ISR_SIZE); |
1281 | if (!isr) | ||
1282 | return IRQ_NONE; | ||
1281 | 1283 | ||
1282 | if (rx || tx) | 1284 | event_handle(ctrl, &adapter->tx_eq); |
1283 | return IRQ_HANDLED; | 1285 | event_handle(ctrl, &adapter->rx_eq); |
1284 | else | 1286 | |
1285 | return IRQ_NONE; | 1287 | return IRQ_HANDLED; |
1286 | } | 1288 | } |
1287 | 1289 | ||
1288 | static irqreturn_t be_msix_rx(int irq, void *dev) | 1290 | static irqreturn_t be_msix_rx(int irq, void *dev) |
diff --git a/drivers/net/bmac.c b/drivers/net/bmac.c index 9578a3dfac01..206144f2470f 100644 --- a/drivers/net/bmac.c +++ b/drivers/net/bmac.c | |||
@@ -428,10 +428,11 @@ bmac_init_phy(struct net_device *dev) | |||
428 | printk(KERN_DEBUG "phy registers:"); | 428 | printk(KERN_DEBUG "phy registers:"); |
429 | for (addr = 0; addr < 32; ++addr) { | 429 | for (addr = 0; addr < 32; ++addr) { |
430 | if ((addr & 7) == 0) | 430 | if ((addr & 7) == 0) |
431 | printk("\n" KERN_DEBUG); | 431 | printk(KERN_DEBUG); |
432 | printk(" %.4x", bmac_mif_read(dev, addr)); | 432 | printk(KERN_CONT " %.4x", bmac_mif_read(dev, addr)); |
433 | } | 433 | } |
434 | printk("\n"); | 434 | printk(KERN_CONT "\n"); |
435 | |||
435 | if (bp->is_bmac_plus) { | 436 | if (bp->is_bmac_plus) { |
436 | unsigned int capable, ctrl; | 437 | unsigned int capable, ctrl; |
437 | 438 | ||
diff --git a/drivers/net/bnx2x.h b/drivers/net/bnx2x.h index 8678457849f9..85a737c5c23f 100644 --- a/drivers/net/bnx2x.h +++ b/drivers/net/bnx2x.h | |||
@@ -902,6 +902,8 @@ struct bnx2x { | |||
902 | u16 rx_quick_cons_trip; | 902 | u16 rx_quick_cons_trip; |
903 | u16 rx_ticks_int; | 903 | u16 rx_ticks_int; |
904 | u16 rx_ticks; | 904 | u16 rx_ticks; |
905 | /* Maximal coalescing timeout in us */ | ||
906 | #define BNX2X_MAX_COALESCE_TOUT (0xf0*12) | ||
905 | 907 | ||
906 | u32 lin_cnt; | 908 | u32 lin_cnt; |
907 | 909 | ||
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c index 951714a7f90a..c36a5f33739f 100644 --- a/drivers/net/bnx2x_main.c +++ b/drivers/net/bnx2x_main.c | |||
@@ -484,8 +484,9 @@ static void bnx2x_fw_dump(struct bnx2x *bp) | |||
484 | 484 | ||
485 | mark = REG_RD(bp, MCP_REG_MCPR_SCRATCH + 0xf104); | 485 | mark = REG_RD(bp, MCP_REG_MCPR_SCRATCH + 0xf104); |
486 | mark = ((mark + 0x3) & ~0x3); | 486 | mark = ((mark + 0x3) & ~0x3); |
487 | printk(KERN_ERR PFX "begin fw dump (mark 0x%x)\n" KERN_ERR, mark); | 487 | printk(KERN_ERR PFX "begin fw dump (mark 0x%x)\n", mark); |
488 | 488 | ||
489 | printk(KERN_ERR PFX); | ||
489 | for (offset = mark - 0x08000000; offset <= 0xF900; offset += 0x8*4) { | 490 | for (offset = mark - 0x08000000; offset <= 0xF900; offset += 0x8*4) { |
490 | for (word = 0; word < 8; word++) | 491 | for (word = 0; word < 8; word++) |
491 | data[word] = htonl(REG_RD(bp, MCP_REG_MCPR_SCRATCH + | 492 | data[word] = htonl(REG_RD(bp, MCP_REG_MCPR_SCRATCH + |
@@ -500,7 +501,7 @@ static void bnx2x_fw_dump(struct bnx2x *bp) | |||
500 | data[8] = 0x0; | 501 | data[8] = 0x0; |
501 | printk(KERN_CONT "%s", (char *)data); | 502 | printk(KERN_CONT "%s", (char *)data); |
502 | } | 503 | } |
503 | printk("\n" KERN_ERR PFX "end of fw dump\n"); | 504 | printk(KERN_ERR PFX "end of fw dump\n"); |
504 | } | 505 | } |
505 | 506 | ||
506 | static void bnx2x_panic_dump(struct bnx2x *bp) | 507 | static void bnx2x_panic_dump(struct bnx2x *bp) |
@@ -4434,7 +4435,7 @@ static void bnx2x_update_coalesce(struct bnx2x *bp) | |||
4434 | REG_WR16(bp, BAR_USTRORM_INTMEM + | 4435 | REG_WR16(bp, BAR_USTRORM_INTMEM + |
4435 | USTORM_SB_HC_DISABLE_OFFSET(port, sb_id, | 4436 | USTORM_SB_HC_DISABLE_OFFSET(port, sb_id, |
4436 | U_SB_ETH_RX_CQ_INDEX), | 4437 | U_SB_ETH_RX_CQ_INDEX), |
4437 | bp->rx_ticks ? 0 : 1); | 4438 | (bp->rx_ticks/12) ? 0 : 1); |
4438 | 4439 | ||
4439 | /* HC_INDEX_C_ETH_TX_CQ_CONS */ | 4440 | /* HC_INDEX_C_ETH_TX_CQ_CONS */ |
4440 | REG_WR8(bp, BAR_CSTRORM_INTMEM + | 4441 | REG_WR8(bp, BAR_CSTRORM_INTMEM + |
@@ -4444,7 +4445,7 @@ static void bnx2x_update_coalesce(struct bnx2x *bp) | |||
4444 | REG_WR16(bp, BAR_CSTRORM_INTMEM + | 4445 | REG_WR16(bp, BAR_CSTRORM_INTMEM + |
4445 | CSTORM_SB_HC_DISABLE_OFFSET(port, sb_id, | 4446 | CSTORM_SB_HC_DISABLE_OFFSET(port, sb_id, |
4446 | C_SB_ETH_TX_CQ_INDEX), | 4447 | C_SB_ETH_TX_CQ_INDEX), |
4447 | bp->tx_ticks ? 0 : 1); | 4448 | (bp->tx_ticks/12) ? 0 : 1); |
4448 | } | 4449 | } |
4449 | } | 4450 | } |
4450 | 4451 | ||
@@ -7354,7 +7355,7 @@ static void bnx2x_reset_task(struct work_struct *work) | |||
7354 | #ifdef BNX2X_STOP_ON_ERROR | 7355 | #ifdef BNX2X_STOP_ON_ERROR |
7355 | BNX2X_ERR("reset task called but STOP_ON_ERROR defined" | 7356 | BNX2X_ERR("reset task called but STOP_ON_ERROR defined" |
7356 | " so reset not done to allow debug dump,\n" | 7357 | " so reset not done to allow debug dump,\n" |
7357 | KERN_ERR " you will need to reboot when done\n"); | 7358 | " you will need to reboot when done\n"); |
7358 | return; | 7359 | return; |
7359 | #endif | 7360 | #endif |
7360 | 7361 | ||
@@ -9069,12 +9070,12 @@ static int bnx2x_set_coalesce(struct net_device *dev, | |||
9069 | struct bnx2x *bp = netdev_priv(dev); | 9070 | struct bnx2x *bp = netdev_priv(dev); |
9070 | 9071 | ||
9071 | bp->rx_ticks = (u16) coal->rx_coalesce_usecs; | 9072 | bp->rx_ticks = (u16) coal->rx_coalesce_usecs; |
9072 | if (bp->rx_ticks > 3000) | 9073 | if (bp->rx_ticks > BNX2X_MAX_COALESCE_TOUT) |
9073 | bp->rx_ticks = 3000; | 9074 | bp->rx_ticks = BNX2X_MAX_COALESCE_TOUT; |
9074 | 9075 | ||
9075 | bp->tx_ticks = (u16) coal->tx_coalesce_usecs; | 9076 | bp->tx_ticks = (u16) coal->tx_coalesce_usecs; |
9076 | if (bp->tx_ticks > 0x3000) | 9077 | if (bp->tx_ticks > BNX2X_MAX_COALESCE_TOUT) |
9077 | bp->tx_ticks = 0x3000; | 9078 | bp->tx_ticks = BNX2X_MAX_COALESCE_TOUT; |
9078 | 9079 | ||
9079 | if (netif_running(dev)) | 9080 | if (netif_running(dev)) |
9080 | bnx2x_update_coalesce(bp); | 9081 | bnx2x_update_coalesce(bp); |
diff --git a/drivers/net/cxgb3/cxgb3_main.c b/drivers/net/cxgb3/cxgb3_main.c index 538dda4422dc..fb5df5c6203e 100644 --- a/drivers/net/cxgb3/cxgb3_main.c +++ b/drivers/net/cxgb3/cxgb3_main.c | |||
@@ -642,8 +642,7 @@ static int setup_sge_qsets(struct adapter *adap) | |||
642 | struct port_info *pi = netdev_priv(dev); | 642 | struct port_info *pi = netdev_priv(dev); |
643 | 643 | ||
644 | pi->qs = &adap->sge.qs[pi->first_qset]; | 644 | pi->qs = &adap->sge.qs[pi->first_qset]; |
645 | for (j = pi->first_qset; j < pi->first_qset + pi->nqsets; | 645 | for (j = 0; j < pi->nqsets; ++j, ++qset_idx) { |
646 | ++j, ++qset_idx) { | ||
647 | set_qset_lro(dev, qset_idx, pi->rx_offload & T3_LRO); | 646 | set_qset_lro(dev, qset_idx, pi->rx_offload & T3_LRO); |
648 | err = t3_sge_alloc_qset(adap, qset_idx, 1, | 647 | err = t3_sge_alloc_qset(adap, qset_idx, 1, |
649 | (adap->flags & USING_MSIX) ? qset_idx + 1 : | 648 | (adap->flags & USING_MSIX) ? qset_idx + 1 : |
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c index 2df8fb0af701..12fd446f9895 100644 --- a/drivers/net/davinci_emac.c +++ b/drivers/net/davinci_emac.c | |||
@@ -1820,11 +1820,19 @@ static int emac_dev_setmac_addr(struct net_device *ndev, void *addr) | |||
1820 | struct device *emac_dev = &priv->ndev->dev; | 1820 | struct device *emac_dev = &priv->ndev->dev; |
1821 | struct sockaddr *sa = addr; | 1821 | struct sockaddr *sa = addr; |
1822 | 1822 | ||
1823 | if (!is_valid_ether_addr(sa->sa_data)) | ||
1824 | return -EINVAL; | ||
1825 | |||
1823 | /* Store mac addr in priv and rx channel and set it in EMAC hw */ | 1826 | /* Store mac addr in priv and rx channel and set it in EMAC hw */ |
1824 | memcpy(priv->mac_addr, sa->sa_data, ndev->addr_len); | 1827 | memcpy(priv->mac_addr, sa->sa_data, ndev->addr_len); |
1825 | memcpy(rxch->mac_addr, sa->sa_data, ndev->addr_len); | ||
1826 | memcpy(ndev->dev_addr, sa->sa_data, ndev->addr_len); | 1828 | memcpy(ndev->dev_addr, sa->sa_data, ndev->addr_len); |
1827 | emac_setmac(priv, EMAC_DEF_RX_CH, rxch->mac_addr); | 1829 | |
1830 | /* If the interface is down - rxch is NULL. */ | ||
1831 | /* MAC address is configured only after the interface is enabled. */ | ||
1832 | if (netif_running(ndev)) { | ||
1833 | memcpy(rxch->mac_addr, sa->sa_data, ndev->addr_len); | ||
1834 | emac_setmac(priv, EMAC_DEF_RX_CH, rxch->mac_addr); | ||
1835 | } | ||
1828 | 1836 | ||
1829 | if (netif_msg_drv(priv)) | 1837 | if (netif_msg_drv(priv)) |
1830 | dev_notice(emac_dev, "DaVinci EMAC: emac_dev_setmac_addr %pM\n", | 1838 | dev_notice(emac_dev, "DaVinci EMAC: emac_dev_setmac_addr %pM\n", |
diff --git a/drivers/net/dl2k.c b/drivers/net/dl2k.c index 895d72143ee0..4b6a219fecea 100644 --- a/drivers/net/dl2k.c +++ b/drivers/net/dl2k.c | |||
@@ -268,8 +268,9 @@ rio_probe1 (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
268 | printk(KERN_INFO "tx_coalesce:\t%d packets\n", | 268 | printk(KERN_INFO "tx_coalesce:\t%d packets\n", |
269 | tx_coalesce); | 269 | tx_coalesce); |
270 | if (np->coalesce) | 270 | if (np->coalesce) |
271 | printk(KERN_INFO "rx_coalesce:\t%d packets\n" | 271 | printk(KERN_INFO |
272 | KERN_INFO "rx_timeout: \t%d ns\n", | 272 | "rx_coalesce:\t%d packets\n" |
273 | "rx_timeout: \t%d ns\n", | ||
273 | np->rx_coalesce, np->rx_timeout*640); | 274 | np->rx_coalesce, np->rx_timeout*640); |
274 | if (np->vlan) | 275 | if (np->vlan) |
275 | printk(KERN_INFO "vlan(id):\t%d\n", np->vlan); | 276 | printk(KERN_INFO "vlan(id):\t%d\n", np->vlan); |
@@ -1522,9 +1523,9 @@ mii_get_media (struct net_device *dev) | |||
1522 | printk (KERN_INFO "Operating at 10 Mbps, "); | 1523 | printk (KERN_INFO "Operating at 10 Mbps, "); |
1523 | } | 1524 | } |
1524 | if (bmcr & MII_BMCR_DUPLEX_MODE) { | 1525 | if (bmcr & MII_BMCR_DUPLEX_MODE) { |
1525 | printk ("Full duplex\n"); | 1526 | printk (KERN_CONT "Full duplex\n"); |
1526 | } else { | 1527 | } else { |
1527 | printk ("Half duplex\n"); | 1528 | printk (KERN_CONT "Half duplex\n"); |
1528 | } | 1529 | } |
1529 | } | 1530 | } |
1530 | if (np->tx_flow) | 1531 | if (np->tx_flow) |
@@ -1614,9 +1615,9 @@ mii_set_media (struct net_device *dev) | |||
1614 | } | 1615 | } |
1615 | if (np->full_duplex) { | 1616 | if (np->full_duplex) { |
1616 | bmcr |= MII_BMCR_DUPLEX_MODE; | 1617 | bmcr |= MII_BMCR_DUPLEX_MODE; |
1617 | printk ("Full duplex\n"); | 1618 | printk (KERN_CONT "Full duplex\n"); |
1618 | } else { | 1619 | } else { |
1619 | printk ("Half duplex\n"); | 1620 | printk (KERN_CONT "Half duplex\n"); |
1620 | } | 1621 | } |
1621 | #if 0 | 1622 | #if 0 |
1622 | /* Set 1000BaseT Master/Slave setting */ | 1623 | /* Set 1000BaseT Master/Slave setting */ |
@@ -1669,9 +1670,9 @@ mii_get_media_pcs (struct net_device *dev) | |||
1669 | __u16 bmcr = mii_read (dev, phy_addr, PCS_BMCR); | 1670 | __u16 bmcr = mii_read (dev, phy_addr, PCS_BMCR); |
1670 | printk (KERN_INFO "Operating at 1000 Mbps, "); | 1671 | printk (KERN_INFO "Operating at 1000 Mbps, "); |
1671 | if (bmcr & MII_BMCR_DUPLEX_MODE) { | 1672 | if (bmcr & MII_BMCR_DUPLEX_MODE) { |
1672 | printk ("Full duplex\n"); | 1673 | printk (KERN_CONT "Full duplex\n"); |
1673 | } else { | 1674 | } else { |
1674 | printk ("Half duplex\n"); | 1675 | printk (KERN_CONT "Half duplex\n"); |
1675 | } | 1676 | } |
1676 | } | 1677 | } |
1677 | if (np->tx_flow) | 1678 | if (np->tx_flow) |
diff --git a/drivers/net/e1000e/defines.h b/drivers/net/e1000e/defines.h index 8890c97e1120..c0f185beb8bc 100644 --- a/drivers/net/e1000e/defines.h +++ b/drivers/net/e1000e/defines.h | |||
@@ -238,6 +238,7 @@ | |||
238 | #define E1000_STATUS_SPEED_100 0x00000040 /* Speed 100Mb/s */ | 238 | #define E1000_STATUS_SPEED_100 0x00000040 /* Speed 100Mb/s */ |
239 | #define E1000_STATUS_SPEED_1000 0x00000080 /* Speed 1000Mb/s */ | 239 | #define E1000_STATUS_SPEED_1000 0x00000080 /* Speed 1000Mb/s */ |
240 | #define E1000_STATUS_LAN_INIT_DONE 0x00000200 /* Lan Init Completion by NVM */ | 240 | #define E1000_STATUS_LAN_INIT_DONE 0x00000200 /* Lan Init Completion by NVM */ |
241 | #define E1000_STATUS_PHYRA 0x00000400 /* PHY Reset Asserted */ | ||
241 | #define E1000_STATUS_GIO_MASTER_ENABLE 0x00080000 /* Status of Master requests. */ | 242 | #define E1000_STATUS_GIO_MASTER_ENABLE 0x00080000 /* Status of Master requests. */ |
242 | 243 | ||
243 | /* Constants used to interpret the masked PCI-X bus speed. */ | 244 | /* Constants used to interpret the masked PCI-X bus speed. */ |
@@ -575,6 +576,8 @@ | |||
575 | #define PHY_1000T_STATUS 0x0A /* 1000Base-T Status Reg */ | 576 | #define PHY_1000T_STATUS 0x0A /* 1000Base-T Status Reg */ |
576 | #define PHY_EXT_STATUS 0x0F /* Extended Status Reg */ | 577 | #define PHY_EXT_STATUS 0x0F /* Extended Status Reg */ |
577 | 578 | ||
579 | #define PHY_CONTROL_LB 0x4000 /* PHY Loopback bit */ | ||
580 | |||
578 | /* NVM Control */ | 581 | /* NVM Control */ |
579 | #define E1000_EECD_SK 0x00000001 /* NVM Clock */ | 582 | #define E1000_EECD_SK 0x00000001 /* NVM Clock */ |
580 | #define E1000_EECD_CS 0x00000002 /* NVM Chip Select */ | 583 | #define E1000_EECD_CS 0x00000002 /* NVM Chip Select */ |
diff --git a/drivers/net/e1000e/hw.h b/drivers/net/e1000e/hw.h index 163c1c0cfee7..fd44d9f90769 100644 --- a/drivers/net/e1000e/hw.h +++ b/drivers/net/e1000e/hw.h | |||
@@ -215,6 +215,7 @@ enum e1e_registers { | |||
215 | E1000_SWSM = 0x05B50, /* SW Semaphore */ | 215 | E1000_SWSM = 0x05B50, /* SW Semaphore */ |
216 | E1000_FWSM = 0x05B54, /* FW Semaphore */ | 216 | E1000_FWSM = 0x05B54, /* FW Semaphore */ |
217 | E1000_SWSM2 = 0x05B58, /* Driver-only SW semaphore */ | 217 | E1000_SWSM2 = 0x05B58, /* Driver-only SW semaphore */ |
218 | E1000_CRC_OFFSET = 0x05F50, /* CRC Offset register */ | ||
218 | E1000_HICR = 0x08F00, /* Host Interface Control */ | 219 | E1000_HICR = 0x08F00, /* Host Interface Control */ |
219 | }; | 220 | }; |
220 | 221 | ||
@@ -302,6 +303,9 @@ enum e1e_registers { | |||
302 | #define E1000_KMRNCTRLSTA_REN 0x00200000 | 303 | #define E1000_KMRNCTRLSTA_REN 0x00200000 |
303 | #define E1000_KMRNCTRLSTA_DIAG_OFFSET 0x3 /* Kumeran Diagnostic */ | 304 | #define E1000_KMRNCTRLSTA_DIAG_OFFSET 0x3 /* Kumeran Diagnostic */ |
304 | #define E1000_KMRNCTRLSTA_DIAG_NELPBK 0x1000 /* Nearend Loopback mode */ | 305 | #define E1000_KMRNCTRLSTA_DIAG_NELPBK 0x1000 /* Nearend Loopback mode */ |
306 | #define E1000_KMRNCTRLSTA_K1_CONFIG 0x7 | ||
307 | #define E1000_KMRNCTRLSTA_K1_ENABLE 0x140E | ||
308 | #define E1000_KMRNCTRLSTA_K1_DISABLE 0x1400 | ||
305 | 309 | ||
306 | #define IFE_PHY_EXTENDED_STATUS_CONTROL 0x10 | 310 | #define IFE_PHY_EXTENDED_STATUS_CONTROL 0x10 |
307 | #define IFE_PHY_SPECIAL_CONTROL 0x11 /* 100BaseTx PHY Special Control */ | 311 | #define IFE_PHY_SPECIAL_CONTROL 0x11 /* 100BaseTx PHY Special Control */ |
diff --git a/drivers/net/e1000e/ich8lan.c b/drivers/net/e1000e/ich8lan.c index 9e23f50fb9cd..d56c7473144a 100644 --- a/drivers/net/e1000e/ich8lan.c +++ b/drivers/net/e1000e/ich8lan.c | |||
@@ -338,6 +338,7 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw) | |||
338 | { | 338 | { |
339 | struct e1000_nvm_info *nvm = &hw->nvm; | 339 | struct e1000_nvm_info *nvm = &hw->nvm; |
340 | struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; | 340 | struct e1000_dev_spec_ich8lan *dev_spec = &hw->dev_spec.ich8lan; |
341 | union ich8_hws_flash_status hsfsts; | ||
341 | u32 gfpreg; | 342 | u32 gfpreg; |
342 | u32 sector_base_addr; | 343 | u32 sector_base_addr; |
343 | u32 sector_end_addr; | 344 | u32 sector_end_addr; |
@@ -374,6 +375,20 @@ static s32 e1000_init_nvm_params_ich8lan(struct e1000_hw *hw) | |||
374 | /* Adjust to word count */ | 375 | /* Adjust to word count */ |
375 | nvm->flash_bank_size /= sizeof(u16); | 376 | nvm->flash_bank_size /= sizeof(u16); |
376 | 377 | ||
378 | /* | ||
379 | * Make sure the flash bank size does not overwrite the 4k | ||
380 | * sector ranges. We may have 64k allotted to us but we only care | ||
381 | * about the first 2 4k sectors. Therefore, if we have anything less | ||
382 | * than 64k set in the HSFSTS register, we will reduce the bank size | ||
383 | * down to 4k and let the rest remain unused. If berasesz == 3, then | ||
384 | * we are working in 64k mode. Otherwise we are not. | ||
385 | */ | ||
386 | if (nvm->flash_bank_size > E1000_ICH8_SHADOW_RAM_WORDS) { | ||
387 | hsfsts.regval = er16flash(ICH_FLASH_HSFSTS); | ||
388 | if (hsfsts.hsf_status.berasesz != 3) | ||
389 | nvm->flash_bank_size = E1000_ICH8_SHADOW_RAM_WORDS; | ||
390 | } | ||
391 | |||
377 | nvm->word_size = E1000_ICH8_SHADOW_RAM_WORDS; | 392 | nvm->word_size = E1000_ICH8_SHADOW_RAM_WORDS; |
378 | 393 | ||
379 | /* Clear shadow ram */ | 394 | /* Clear shadow ram */ |
@@ -446,6 +461,95 @@ static s32 e1000_init_mac_params_ich8lan(struct e1000_adapter *adapter) | |||
446 | return 0; | 461 | return 0; |
447 | } | 462 | } |
448 | 463 | ||
464 | /** | ||
465 | * e1000_check_for_copper_link_ich8lan - Check for link (Copper) | ||
466 | * @hw: pointer to the HW structure | ||
467 | * | ||
468 | * Checks to see of the link status of the hardware has changed. If a | ||
469 | * change in link status has been detected, then we read the PHY registers | ||
470 | * to get the current speed/duplex if link exists. | ||
471 | **/ | ||
472 | static s32 e1000_check_for_copper_link_ich8lan(struct e1000_hw *hw) | ||
473 | { | ||
474 | struct e1000_mac_info *mac = &hw->mac; | ||
475 | s32 ret_val; | ||
476 | bool link; | ||
477 | |||
478 | /* | ||
479 | * We only want to go out to the PHY registers to see if Auto-Neg | ||
480 | * has completed and/or if our link status has changed. The | ||
481 | * get_link_status flag is set upon receiving a Link Status | ||
482 | * Change or Rx Sequence Error interrupt. | ||
483 | */ | ||
484 | if (!mac->get_link_status) { | ||
485 | ret_val = 0; | ||
486 | goto out; | ||
487 | } | ||
488 | |||
489 | if (hw->mac.type == e1000_pchlan) { | ||
490 | ret_val = e1000e_write_kmrn_reg(hw, | ||
491 | E1000_KMRNCTRLSTA_K1_CONFIG, | ||
492 | E1000_KMRNCTRLSTA_K1_ENABLE); | ||
493 | if (ret_val) | ||
494 | goto out; | ||
495 | } | ||
496 | |||
497 | /* | ||
498 | * First we want to see if the MII Status Register reports | ||
499 | * link. If so, then we want to get the current speed/duplex | ||
500 | * of the PHY. | ||
501 | */ | ||
502 | ret_val = e1000e_phy_has_link_generic(hw, 1, 0, &link); | ||
503 | if (ret_val) | ||
504 | goto out; | ||
505 | |||
506 | if (!link) | ||
507 | goto out; /* No link detected */ | ||
508 | |||
509 | mac->get_link_status = false; | ||
510 | |||
511 | if (hw->phy.type == e1000_phy_82578) { | ||
512 | ret_val = e1000_link_stall_workaround_hv(hw); | ||
513 | if (ret_val) | ||
514 | goto out; | ||
515 | } | ||
516 | |||
517 | /* | ||
518 | * Check if there was DownShift, must be checked | ||
519 | * immediately after link-up | ||
520 | */ | ||
521 | e1000e_check_downshift(hw); | ||
522 | |||
523 | /* | ||
524 | * If we are forcing speed/duplex, then we simply return since | ||
525 | * we have already determined whether we have link or not. | ||
526 | */ | ||
527 | if (!mac->autoneg) { | ||
528 | ret_val = -E1000_ERR_CONFIG; | ||
529 | goto out; | ||
530 | } | ||
531 | |||
532 | /* | ||
533 | * Auto-Neg is enabled. Auto Speed Detection takes care | ||
534 | * of MAC speed/duplex configuration. So we only need to | ||
535 | * configure Collision Distance in the MAC. | ||
536 | */ | ||
537 | e1000e_config_collision_dist(hw); | ||
538 | |||
539 | /* | ||
540 | * Configure Flow Control now that Auto-Neg has completed. | ||
541 | * First, we need to restore the desired flow control | ||
542 | * settings because we may have had to re-autoneg with a | ||
543 | * different link partner. | ||
544 | */ | ||
545 | ret_val = e1000e_config_fc_after_link_up(hw); | ||
546 | if (ret_val) | ||
547 | hw_dbg(hw, "Error configuring flow control\n"); | ||
548 | |||
549 | out: | ||
550 | return ret_val; | ||
551 | } | ||
552 | |||
449 | static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter) | 553 | static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter) |
450 | { | 554 | { |
451 | struct e1000_hw *hw = &adapter->hw; | 555 | struct e1000_hw *hw = &adapter->hw; |
@@ -694,6 +798,38 @@ static s32 e1000_hv_phy_workarounds_ich8lan(struct e1000_hw *hw) | |||
694 | } | 798 | } |
695 | 799 | ||
696 | /** | 800 | /** |
801 | * e1000_lan_init_done_ich8lan - Check for PHY config completion | ||
802 | * @hw: pointer to the HW structure | ||
803 | * | ||
804 | * Check the appropriate indication the MAC has finished configuring the | ||
805 | * PHY after a software reset. | ||
806 | **/ | ||
807 | static void e1000_lan_init_done_ich8lan(struct e1000_hw *hw) | ||
808 | { | ||
809 | u32 data, loop = E1000_ICH8_LAN_INIT_TIMEOUT; | ||
810 | |||
811 | /* Wait for basic configuration completes before proceeding */ | ||
812 | do { | ||
813 | data = er32(STATUS); | ||
814 | data &= E1000_STATUS_LAN_INIT_DONE; | ||
815 | udelay(100); | ||
816 | } while ((!data) && --loop); | ||
817 | |||
818 | /* | ||
819 | * If basic configuration is incomplete before the above loop | ||
820 | * count reaches 0, loading the configuration from NVM will | ||
821 | * leave the PHY in a bad state possibly resulting in no link. | ||
822 | */ | ||
823 | if (loop == 0) | ||
824 | hw_dbg(hw, "LAN_INIT_DONE not set, increase timeout\n"); | ||
825 | |||
826 | /* Clear the Init Done bit for the next init event */ | ||
827 | data = er32(STATUS); | ||
828 | data &= ~E1000_STATUS_LAN_INIT_DONE; | ||
829 | ew32(STATUS, data); | ||
830 | } | ||
831 | |||
832 | /** | ||
697 | * e1000_phy_hw_reset_ich8lan - Performs a PHY reset | 833 | * e1000_phy_hw_reset_ich8lan - Performs a PHY reset |
698 | * @hw: pointer to the HW structure | 834 | * @hw: pointer to the HW structure |
699 | * | 835 | * |
@@ -707,13 +843,15 @@ static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw) | |||
707 | u32 i; | 843 | u32 i; |
708 | u32 data, cnf_size, cnf_base_addr, sw_cfg_mask; | 844 | u32 data, cnf_size, cnf_base_addr, sw_cfg_mask; |
709 | s32 ret_val; | 845 | s32 ret_val; |
710 | u16 loop = E1000_ICH8_LAN_INIT_TIMEOUT; | ||
711 | u16 word_addr, reg_data, reg_addr, phy_page = 0; | 846 | u16 word_addr, reg_data, reg_addr, phy_page = 0; |
712 | 847 | ||
713 | ret_val = e1000e_phy_hw_reset_generic(hw); | 848 | ret_val = e1000e_phy_hw_reset_generic(hw); |
714 | if (ret_val) | 849 | if (ret_val) |
715 | return ret_val; | 850 | return ret_val; |
716 | 851 | ||
852 | /* Allow time for h/w to get to a quiescent state after reset */ | ||
853 | mdelay(10); | ||
854 | |||
717 | if (hw->mac.type == e1000_pchlan) { | 855 | if (hw->mac.type == e1000_pchlan) { |
718 | ret_val = e1000_hv_phy_workarounds_ich8lan(hw); | 856 | ret_val = e1000_hv_phy_workarounds_ich8lan(hw); |
719 | if (ret_val) | 857 | if (ret_val) |
@@ -741,26 +879,8 @@ static s32 e1000_phy_hw_reset_ich8lan(struct e1000_hw *hw) | |||
741 | if (!(data & sw_cfg_mask)) | 879 | if (!(data & sw_cfg_mask)) |
742 | return 0; | 880 | return 0; |
743 | 881 | ||
744 | /* Wait for basic configuration completes before proceeding*/ | 882 | /* Wait for basic configuration completes before proceeding */ |
745 | do { | 883 | e1000_lan_init_done_ich8lan(hw); |
746 | data = er32(STATUS); | ||
747 | data &= E1000_STATUS_LAN_INIT_DONE; | ||
748 | udelay(100); | ||
749 | } while ((!data) && --loop); | ||
750 | |||
751 | /* | ||
752 | * If basic configuration is incomplete before the above loop | ||
753 | * count reaches 0, loading the configuration from NVM will | ||
754 | * leave the PHY in a bad state possibly resulting in no link. | ||
755 | */ | ||
756 | if (loop == 0) { | ||
757 | hw_dbg(hw, "LAN_INIT_DONE not set, increase timeout\n"); | ||
758 | } | ||
759 | |||
760 | /* Clear the Init Done bit for the next init event */ | ||
761 | data = er32(STATUS); | ||
762 | data &= ~E1000_STATUS_LAN_INIT_DONE; | ||
763 | ew32(STATUS, data); | ||
764 | 884 | ||
765 | /* | 885 | /* |
766 | * Make sure HW does not configure LCD from PHY | 886 | * Make sure HW does not configure LCD from PHY |
@@ -961,12 +1081,14 @@ static s32 e1000_set_d0_lplu_state_ich8lan(struct e1000_hw *hw, bool active) | |||
961 | phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU; | 1081 | phy_ctrl |= E1000_PHY_CTRL_D0A_LPLU; |
962 | ew32(PHY_CTRL, phy_ctrl); | 1082 | ew32(PHY_CTRL, phy_ctrl); |
963 | 1083 | ||
1084 | if (phy->type != e1000_phy_igp_3) | ||
1085 | return 0; | ||
1086 | |||
964 | /* | 1087 | /* |
965 | * Call gig speed drop workaround on LPLU before accessing | 1088 | * Call gig speed drop workaround on LPLU before accessing |
966 | * any PHY registers | 1089 | * any PHY registers |
967 | */ | 1090 | */ |
968 | if ((hw->mac.type == e1000_ich8lan) && | 1091 | if (hw->mac.type == e1000_ich8lan) |
969 | (hw->phy.type == e1000_phy_igp_3)) | ||
970 | e1000e_gig_downshift_workaround_ich8lan(hw); | 1092 | e1000e_gig_downshift_workaround_ich8lan(hw); |
971 | 1093 | ||
972 | /* When LPLU is enabled, we should disable SmartSpeed */ | 1094 | /* When LPLU is enabled, we should disable SmartSpeed */ |
@@ -979,6 +1101,9 @@ static s32 e1000_set_d0_lplu_state_ich8lan(struct e1000_hw *hw, bool active) | |||
979 | phy_ctrl &= ~E1000_PHY_CTRL_D0A_LPLU; | 1101 | phy_ctrl &= ~E1000_PHY_CTRL_D0A_LPLU; |
980 | ew32(PHY_CTRL, phy_ctrl); | 1102 | ew32(PHY_CTRL, phy_ctrl); |
981 | 1103 | ||
1104 | if (phy->type != e1000_phy_igp_3) | ||
1105 | return 0; | ||
1106 | |||
982 | /* | 1107 | /* |
983 | * LPLU and SmartSpeed are mutually exclusive. LPLU is used | 1108 | * LPLU and SmartSpeed are mutually exclusive. LPLU is used |
984 | * during Dx states where the power conservation is most | 1109 | * during Dx states where the power conservation is most |
@@ -1038,6 +1163,10 @@ static s32 e1000_set_d3_lplu_state_ich8lan(struct e1000_hw *hw, bool active) | |||
1038 | if (!active) { | 1163 | if (!active) { |
1039 | phy_ctrl &= ~E1000_PHY_CTRL_NOND0A_LPLU; | 1164 | phy_ctrl &= ~E1000_PHY_CTRL_NOND0A_LPLU; |
1040 | ew32(PHY_CTRL, phy_ctrl); | 1165 | ew32(PHY_CTRL, phy_ctrl); |
1166 | |||
1167 | if (phy->type != e1000_phy_igp_3) | ||
1168 | return 0; | ||
1169 | |||
1041 | /* | 1170 | /* |
1042 | * LPLU and SmartSpeed are mutually exclusive. LPLU is used | 1171 | * LPLU and SmartSpeed are mutually exclusive. LPLU is used |
1043 | * during Dx states where the power conservation is most | 1172 | * during Dx states where the power conservation is most |
@@ -1073,12 +1202,14 @@ static s32 e1000_set_d3_lplu_state_ich8lan(struct e1000_hw *hw, bool active) | |||
1073 | phy_ctrl |= E1000_PHY_CTRL_NOND0A_LPLU; | 1202 | phy_ctrl |= E1000_PHY_CTRL_NOND0A_LPLU; |
1074 | ew32(PHY_CTRL, phy_ctrl); | 1203 | ew32(PHY_CTRL, phy_ctrl); |
1075 | 1204 | ||
1205 | if (phy->type != e1000_phy_igp_3) | ||
1206 | return 0; | ||
1207 | |||
1076 | /* | 1208 | /* |
1077 | * Call gig speed drop workaround on LPLU before accessing | 1209 | * Call gig speed drop workaround on LPLU before accessing |
1078 | * any PHY registers | 1210 | * any PHY registers |
1079 | */ | 1211 | */ |
1080 | if ((hw->mac.type == e1000_ich8lan) && | 1212 | if (hw->mac.type == e1000_ich8lan) |
1081 | (hw->phy.type == e1000_phy_igp_3)) | ||
1082 | e1000e_gig_downshift_workaround_ich8lan(hw); | 1213 | e1000e_gig_downshift_workaround_ich8lan(hw); |
1083 | 1214 | ||
1084 | /* When LPLU is enabled, we should disable SmartSpeed */ | 1215 | /* When LPLU is enabled, we should disable SmartSpeed */ |
@@ -1905,7 +2036,7 @@ static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank) | |||
1905 | break; | 2036 | break; |
1906 | case 1: | 2037 | case 1: |
1907 | sector_size = ICH_FLASH_SEG_SIZE_4K; | 2038 | sector_size = ICH_FLASH_SEG_SIZE_4K; |
1908 | iteration = flash_bank_size / ICH_FLASH_SEG_SIZE_4K; | 2039 | iteration = 1; |
1909 | break; | 2040 | break; |
1910 | case 2: | 2041 | case 2: |
1911 | if (hw->mac.type == e1000_ich9lan) { | 2042 | if (hw->mac.type == e1000_ich9lan) { |
@@ -1917,7 +2048,7 @@ static s32 e1000_erase_flash_bank_ich8lan(struct e1000_hw *hw, u32 bank) | |||
1917 | break; | 2048 | break; |
1918 | case 3: | 2049 | case 3: |
1919 | sector_size = ICH_FLASH_SEG_SIZE_64K; | 2050 | sector_size = ICH_FLASH_SEG_SIZE_64K; |
1920 | iteration = flash_bank_size / ICH_FLASH_SEG_SIZE_64K; | 2051 | iteration = 1; |
1921 | break; | 2052 | break; |
1922 | default: | 2053 | default: |
1923 | return -E1000_ERR_NVM; | 2054 | return -E1000_ERR_NVM; |
@@ -2143,6 +2274,12 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) | |||
2143 | ctrl = er32(CTRL); | 2274 | ctrl = er32(CTRL); |
2144 | 2275 | ||
2145 | if (!e1000_check_reset_block(hw)) { | 2276 | if (!e1000_check_reset_block(hw)) { |
2277 | /* Clear PHY Reset Asserted bit */ | ||
2278 | if (hw->mac.type >= e1000_pchlan) { | ||
2279 | u32 status = er32(STATUS); | ||
2280 | ew32(STATUS, status & ~E1000_STATUS_PHYRA); | ||
2281 | } | ||
2282 | |||
2146 | /* | 2283 | /* |
2147 | * PHY HW reset requires MAC CORE reset at the same | 2284 | * PHY HW reset requires MAC CORE reset at the same |
2148 | * time to make sure the interface between MAC and the | 2285 | * time to make sure the interface between MAC and the |
@@ -2156,23 +2293,34 @@ static s32 e1000_reset_hw_ich8lan(struct e1000_hw *hw) | |||
2156 | ew32(CTRL, (ctrl | E1000_CTRL_RST)); | 2293 | ew32(CTRL, (ctrl | E1000_CTRL_RST)); |
2157 | msleep(20); | 2294 | msleep(20); |
2158 | 2295 | ||
2159 | if (!ret_val) { | 2296 | if (!ret_val) |
2160 | /* release the swflag because it is not reset by | ||
2161 | * hardware reset | ||
2162 | */ | ||
2163 | e1000_release_swflag_ich8lan(hw); | 2297 | e1000_release_swflag_ich8lan(hw); |
2164 | } | ||
2165 | 2298 | ||
2166 | ret_val = e1000e_get_auto_rd_done(hw); | 2299 | if (ctrl & E1000_CTRL_PHY_RST) |
2167 | if (ret_val) { | 2300 | ret_val = hw->phy.ops.get_cfg_done(hw); |
2168 | /* | 2301 | |
2169 | * When auto config read does not complete, do not | 2302 | if (hw->mac.type >= e1000_ich10lan) { |
2170 | * return with an error. This can happen in situations | 2303 | e1000_lan_init_done_ich8lan(hw); |
2171 | * where there is no eeprom and prevents getting link. | 2304 | } else { |
2172 | */ | 2305 | ret_val = e1000e_get_auto_rd_done(hw); |
2173 | hw_dbg(hw, "Auto Read Done did not complete\n"); | 2306 | if (ret_val) { |
2307 | /* | ||
2308 | * When auto config read does not complete, do not | ||
2309 | * return with an error. This can happen in situations | ||
2310 | * where there is no eeprom and prevents getting link. | ||
2311 | */ | ||
2312 | hw_dbg(hw, "Auto Read Done did not complete\n"); | ||
2313 | } | ||
2174 | } | 2314 | } |
2175 | 2315 | ||
2316 | /* | ||
2317 | * For PCH, this write will make sure that any noise | ||
2318 | * will be detected as a CRC error and be dropped rather than show up | ||
2319 | * as a bad packet to the DMA engine. | ||
2320 | */ | ||
2321 | if (hw->mac.type == e1000_pchlan) | ||
2322 | ew32(CRC_OFFSET, 0x65656565); | ||
2323 | |||
2176 | ew32(IMC, 0xffffffff); | 2324 | ew32(IMC, 0xffffffff); |
2177 | icr = er32(ICR); | 2325 | icr = er32(ICR); |
2178 | 2326 | ||
@@ -2222,6 +2370,18 @@ static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw) | |||
2222 | for (i = 0; i < mac->mta_reg_count; i++) | 2370 | for (i = 0; i < mac->mta_reg_count; i++) |
2223 | E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0); | 2371 | E1000_WRITE_REG_ARRAY(hw, E1000_MTA, i, 0); |
2224 | 2372 | ||
2373 | /* | ||
2374 | * The 82578 Rx buffer will stall if wakeup is enabled in host and | ||
2375 | * the ME. Reading the BM_WUC register will clear the host wakeup bit. | ||
2376 | * Reset the phy after disabling host wakeup to reset the Rx buffer. | ||
2377 | */ | ||
2378 | if (hw->phy.type == e1000_phy_82578) { | ||
2379 | hw->phy.ops.read_phy_reg(hw, BM_WUC, &i); | ||
2380 | ret_val = e1000_phy_hw_reset_ich8lan(hw); | ||
2381 | if (ret_val) | ||
2382 | return ret_val; | ||
2383 | } | ||
2384 | |||
2225 | /* Setup link and flow control */ | 2385 | /* Setup link and flow control */ |
2226 | ret_val = e1000_setup_link_ich8lan(hw); | 2386 | ret_val = e1000_setup_link_ich8lan(hw); |
2227 | 2387 | ||
@@ -2254,16 +2414,6 @@ static s32 e1000_init_hw_ich8lan(struct e1000_hw *hw) | |||
2254 | ew32(CTRL_EXT, ctrl_ext); | 2414 | ew32(CTRL_EXT, ctrl_ext); |
2255 | 2415 | ||
2256 | /* | 2416 | /* |
2257 | * The 82578 Rx buffer will stall if wakeup is enabled in host and | ||
2258 | * the ME. Reading the BM_WUC register will clear the host wakeup bit. | ||
2259 | * Reset the phy after disabling host wakeup to reset the Rx buffer. | ||
2260 | */ | ||
2261 | if (hw->phy.type == e1000_phy_82578) { | ||
2262 | e1e_rphy(hw, BM_WUC, &i); | ||
2263 | e1000e_phy_hw_reset_generic(hw); | ||
2264 | } | ||
2265 | |||
2266 | /* | ||
2267 | * Clear all of the statistics registers (clear on read). It is | 2417 | * Clear all of the statistics registers (clear on read). It is |
2268 | * important that we do this after we have tried to establish link | 2418 | * important that we do this after we have tried to establish link |
2269 | * because the symbol error count will increment wildly if there | 2419 | * because the symbol error count will increment wildly if there |
@@ -2485,6 +2635,14 @@ static s32 e1000_get_link_up_info_ich8lan(struct e1000_hw *hw, u16 *speed, | |||
2485 | if (ret_val) | 2635 | if (ret_val) |
2486 | return ret_val; | 2636 | return ret_val; |
2487 | 2637 | ||
2638 | if ((hw->mac.type == e1000_pchlan) && (*speed == SPEED_1000)) { | ||
2639 | ret_val = e1000e_write_kmrn_reg(hw, | ||
2640 | E1000_KMRNCTRLSTA_K1_CONFIG, | ||
2641 | E1000_KMRNCTRLSTA_K1_DISABLE); | ||
2642 | if (ret_val) | ||
2643 | return ret_val; | ||
2644 | } | ||
2645 | |||
2488 | if ((hw->mac.type == e1000_ich8lan) && | 2646 | if ((hw->mac.type == e1000_ich8lan) && |
2489 | (hw->phy.type == e1000_phy_igp_3) && | 2647 | (hw->phy.type == e1000_phy_igp_3) && |
2490 | (*speed == SPEED_1000)) { | 2648 | (*speed == SPEED_1000)) { |
@@ -2850,6 +3008,16 @@ static s32 e1000_get_cfg_done_ich8lan(struct e1000_hw *hw) | |||
2850 | { | 3008 | { |
2851 | u32 bank = 0; | 3009 | u32 bank = 0; |
2852 | 3010 | ||
3011 | if (hw->mac.type >= e1000_pchlan) { | ||
3012 | u32 status = er32(STATUS); | ||
3013 | |||
3014 | if (status & E1000_STATUS_PHYRA) | ||
3015 | ew32(STATUS, status & ~E1000_STATUS_PHYRA); | ||
3016 | else | ||
3017 | hw_dbg(hw, | ||
3018 | "PHY Reset Asserted not set - needs delay\n"); | ||
3019 | } | ||
3020 | |||
2853 | e1000e_get_cfg_done(hw); | 3021 | e1000e_get_cfg_done(hw); |
2854 | 3022 | ||
2855 | /* If EEPROM is not marked present, init the IGP 3 PHY manually */ | 3023 | /* If EEPROM is not marked present, init the IGP 3 PHY manually */ |
@@ -2921,7 +3089,7 @@ static void e1000_clear_hw_cntrs_ich8lan(struct e1000_hw *hw) | |||
2921 | static struct e1000_mac_operations ich8_mac_ops = { | 3089 | static struct e1000_mac_operations ich8_mac_ops = { |
2922 | .id_led_init = e1000e_id_led_init, | 3090 | .id_led_init = e1000e_id_led_init, |
2923 | .check_mng_mode = e1000_check_mng_mode_ich8lan, | 3091 | .check_mng_mode = e1000_check_mng_mode_ich8lan, |
2924 | .check_for_link = e1000e_check_for_copper_link, | 3092 | .check_for_link = e1000_check_for_copper_link_ich8lan, |
2925 | /* cleanup_led dependent on mac type */ | 3093 | /* cleanup_led dependent on mac type */ |
2926 | .clear_hw_cntrs = e1000_clear_hw_cntrs_ich8lan, | 3094 | .clear_hw_cntrs = e1000_clear_hw_cntrs_ich8lan, |
2927 | .get_bus_info = e1000_get_bus_info_ich8lan, | 3095 | .get_bus_info = e1000_get_bus_info_ich8lan, |
diff --git a/drivers/net/e1000e/lib.c b/drivers/net/e1000e/lib.c index be6d9e990374..99ba2b8a2a05 100644 --- a/drivers/net/e1000e/lib.c +++ b/drivers/net/e1000e/lib.c | |||
@@ -378,12 +378,6 @@ s32 e1000e_check_for_copper_link(struct e1000_hw *hw) | |||
378 | 378 | ||
379 | mac->get_link_status = 0; | 379 | mac->get_link_status = 0; |
380 | 380 | ||
381 | if (hw->phy.type == e1000_phy_82578) { | ||
382 | ret_val = e1000_link_stall_workaround_hv(hw); | ||
383 | if (ret_val) | ||
384 | return ret_val; | ||
385 | } | ||
386 | |||
387 | /* | 381 | /* |
388 | * Check if there was DownShift, must be checked | 382 | * Check if there was DownShift, must be checked |
389 | * immediately after link-up | 383 | * immediately after link-up |
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c index e23459cf3d0e..994401fd0664 100644 --- a/drivers/net/e1000e/phy.c +++ b/drivers/net/e1000e/phy.c | |||
@@ -1531,7 +1531,12 @@ s32 e1000e_phy_has_link_generic(struct e1000_hw *hw, u32 iterations, | |||
1531 | */ | 1531 | */ |
1532 | ret_val = e1e_rphy(hw, PHY_STATUS, &phy_status); | 1532 | ret_val = e1e_rphy(hw, PHY_STATUS, &phy_status); |
1533 | if (ret_val) | 1533 | if (ret_val) |
1534 | break; | 1534 | /* |
1535 | * If the first read fails, another entity may have | ||
1536 | * ownership of the resources, wait and try again to | ||
1537 | * see if they have relinquished the resources yet. | ||
1538 | */ | ||
1539 | udelay(usec_interval); | ||
1535 | ret_val = e1e_rphy(hw, PHY_STATUS, &phy_status); | 1540 | ret_val = e1e_rphy(hw, PHY_STATUS, &phy_status); |
1536 | if (ret_val) | 1541 | if (ret_val) |
1537 | break; | 1542 | break; |
@@ -2737,6 +2742,11 @@ s32 e1000_link_stall_workaround_hv(struct e1000_hw *hw) | |||
2737 | if (hw->phy.type != e1000_phy_82578) | 2742 | if (hw->phy.type != e1000_phy_82578) |
2738 | goto out; | 2743 | goto out; |
2739 | 2744 | ||
2745 | /* Do not apply workaround if in PHY loopback bit 14 set */ | ||
2746 | hw->phy.ops.read_phy_reg(hw, PHY_CONTROL, &data); | ||
2747 | if (data & PHY_CONTROL_LB) | ||
2748 | goto out; | ||
2749 | |||
2740 | /* check if link is up and at 1Gbps */ | 2750 | /* check if link is up and at 1Gbps */ |
2741 | ret_val = hw->phy.ops.read_phy_reg(hw, BM_CS_STATUS, &data); | 2751 | ret_val = hw->phy.ops.read_phy_reg(hw, BM_CS_STATUS, &data); |
2742 | if (ret_val) | 2752 | if (ret_val) |
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c index b60e27dfcfa7..88d7ebf31220 100644 --- a/drivers/net/epic100.c +++ b/drivers/net/epic100.c | |||
@@ -338,8 +338,7 @@ static int __devinit epic_init_one (struct pci_dev *pdev, | |||
338 | #ifndef MODULE | 338 | #ifndef MODULE |
339 | static int printed_version; | 339 | static int printed_version; |
340 | if (!printed_version++) | 340 | if (!printed_version++) |
341 | printk (KERN_INFO "%s" KERN_INFO "%s", | 341 | printk(KERN_INFO "%s%s", version, version2); |
342 | version, version2); | ||
343 | #endif | 342 | #endif |
344 | 343 | ||
345 | card_idx++; | 344 | card_idx++; |
@@ -1600,7 +1599,7 @@ static int __init epic_init (void) | |||
1600 | { | 1599 | { |
1601 | /* when a module, this is printed whether or not devices are found in probe */ | 1600 | /* when a module, this is printed whether or not devices are found in probe */ |
1602 | #ifdef MODULE | 1601 | #ifdef MODULE |
1603 | printk (KERN_INFO "%s" KERN_INFO "%s", | 1602 | printk (KERN_INFO "%s%s", |
1604 | version, version2); | 1603 | version, version2); |
1605 | #endif | 1604 | #endif |
1606 | 1605 | ||
diff --git a/drivers/net/fealnx.c b/drivers/net/fealnx.c index 891be28a7d4f..48385c42ab57 100644 --- a/drivers/net/fealnx.c +++ b/drivers/net/fealnx.c | |||
@@ -1209,17 +1209,20 @@ static void fealnx_tx_timeout(struct net_device *dev) | |||
1209 | unsigned long flags; | 1209 | unsigned long flags; |
1210 | int i; | 1210 | int i; |
1211 | 1211 | ||
1212 | printk(KERN_WARNING "%s: Transmit timed out, status %8.8x," | 1212 | printk(KERN_WARNING |
1213 | " resetting...\n", dev->name, ioread32(ioaddr + ISR)); | 1213 | "%s: Transmit timed out, status %8.8x, resetting...\n", |
1214 | dev->name, ioread32(ioaddr + ISR)); | ||
1214 | 1215 | ||
1215 | { | 1216 | { |
1216 | printk(KERN_DEBUG " Rx ring %p: ", np->rx_ring); | 1217 | printk(KERN_DEBUG " Rx ring %p: ", np->rx_ring); |
1217 | for (i = 0; i < RX_RING_SIZE; i++) | 1218 | for (i = 0; i < RX_RING_SIZE; i++) |
1218 | printk(" %8.8x", (unsigned int) np->rx_ring[i].status); | 1219 | printk(KERN_CONT " %8.8x", |
1219 | printk("\n" KERN_DEBUG " Tx ring %p: ", np->tx_ring); | 1220 | (unsigned int) np->rx_ring[i].status); |
1221 | printk(KERN_CONT "\n"); | ||
1222 | printk(KERN_DEBUG " Tx ring %p: ", np->tx_ring); | ||
1220 | for (i = 0; i < TX_RING_SIZE; i++) | 1223 | for (i = 0; i < TX_RING_SIZE; i++) |
1221 | printk(" %4.4x", np->tx_ring[i].status); | 1224 | printk(KERN_CONT " %4.4x", np->tx_ring[i].status); |
1222 | printk("\n"); | 1225 | printk(KERN_CONT "\n"); |
1223 | } | 1226 | } |
1224 | 1227 | ||
1225 | spin_lock_irqsave(&np->lock, flags); | 1228 | spin_lock_irqsave(&np->lock, flags); |
diff --git a/drivers/net/fec.h b/drivers/net/fec.h index 30b7dd671336..cc47f3f057c7 100644 --- a/drivers/net/fec.h +++ b/drivers/net/fec.h | |||
@@ -46,12 +46,12 @@ | |||
46 | 46 | ||
47 | #else | 47 | #else |
48 | 48 | ||
49 | #define FEC_ECNTRL; 0x000 /* Ethernet control reg */ | 49 | #define FEC_ECNTRL 0x000 /* Ethernet control reg */ |
50 | #define FEC_IEVENT; 0x004 /* Interrupt even reg */ | 50 | #define FEC_IEVENT 0x004 /* Interrupt even reg */ |
51 | #define FEC_IMASK; 0x008 /* Interrupt mask reg */ | 51 | #define FEC_IMASK 0x008 /* Interrupt mask reg */ |
52 | #define FEC_IVEC; 0x00c /* Interrupt vec status reg */ | 52 | #define FEC_IVEC 0x00c /* Interrupt vec status reg */ |
53 | #define FEC_R_DES_ACTIVE; 0x010 /* Receive descriptor reg */ | 53 | #define FEC_R_DES_ACTIVE 0x010 /* Receive descriptor reg */ |
54 | #define FEC_X_DES_ACTIVE; 0x01c /* Transmit descriptor reg */ | 54 | #define FEC_X_DES_ACTIVE 0x014 /* Transmit descriptor reg */ |
55 | #define FEC_MII_DATA 0x040 /* MII manage frame reg */ | 55 | #define FEC_MII_DATA 0x040 /* MII manage frame reg */ |
56 | #define FEC_MII_SPEED 0x044 /* MII speed control reg */ | 56 | #define FEC_MII_SPEED 0x044 /* MII speed control reg */ |
57 | #define FEC_R_BOUND 0x08c /* FIFO receive bound reg */ | 57 | #define FEC_R_BOUND 0x08c /* FIFO receive bound reg */ |
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c index 1094d292630f..3b4e0766c7b2 100644 --- a/drivers/net/forcedeth.c +++ b/drivers/net/forcedeth.c | |||
@@ -3514,11 +3514,13 @@ static irqreturn_t nv_nic_irq(int foo, void *data) | |||
3514 | nv_msi_workaround(np); | 3514 | nv_msi_workaround(np); |
3515 | 3515 | ||
3516 | #ifdef CONFIG_FORCEDETH_NAPI | 3516 | #ifdef CONFIG_FORCEDETH_NAPI |
3517 | napi_schedule(&np->napi); | 3517 | if (napi_schedule_prep(&np->napi)) { |
3518 | 3518 | /* | |
3519 | /* Disable furthur irq's | 3519 | * Disable further irq's (msix not enabled with napi) |
3520 | (msix not enabled with napi) */ | 3520 | */ |
3521 | writel(0, base + NvRegIrqMask); | 3521 | writel(0, base + NvRegIrqMask); |
3522 | __napi_schedule(&np->napi); | ||
3523 | } | ||
3522 | 3524 | ||
3523 | #else | 3525 | #else |
3524 | do | 3526 | do |
@@ -3615,12 +3617,13 @@ static irqreturn_t nv_nic_irq_optimized(int foo, void *data) | |||
3615 | nv_msi_workaround(np); | 3617 | nv_msi_workaround(np); |
3616 | 3618 | ||
3617 | #ifdef CONFIG_FORCEDETH_NAPI | 3619 | #ifdef CONFIG_FORCEDETH_NAPI |
3618 | napi_schedule(&np->napi); | 3620 | if (napi_schedule_prep(&np->napi)) { |
3619 | 3621 | /* | |
3620 | /* Disable furthur irq's | 3622 | * Disable further irq's (msix not enabled with napi) |
3621 | (msix not enabled with napi) */ | 3623 | */ |
3622 | writel(0, base + NvRegIrqMask); | 3624 | writel(0, base + NvRegIrqMask); |
3623 | 3625 | __napi_schedule(&np->napi); | |
3626 | } | ||
3624 | #else | 3627 | #else |
3625 | do | 3628 | do |
3626 | { | 3629 | { |
diff --git a/drivers/net/hamachi.c b/drivers/net/hamachi.c index 9d5b62cb30f7..d62378cbc149 100644 --- a/drivers/net/hamachi.c +++ b/drivers/net/hamachi.c | |||
@@ -173,8 +173,8 @@ static int tx_params[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1}; | |||
173 | 173 | ||
174 | static const char version[] __devinitconst = | 174 | static const char version[] __devinitconst = |
175 | KERN_INFO DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE " Written by Donald Becker\n" | 175 | KERN_INFO DRV_NAME ".c:v" DRV_VERSION " " DRV_RELDATE " Written by Donald Becker\n" |
176 | KERN_INFO " Some modifications by Eric kasten <kasten@nscl.msu.edu>\n" | 176 | " Some modifications by Eric kasten <kasten@nscl.msu.edu>\n" |
177 | KERN_INFO " Further modifications by Keith Underwood <keithu@parl.clemson.edu>\n"; | 177 | " Further modifications by Keith Underwood <keithu@parl.clemson.edu>\n"; |
178 | 178 | ||
179 | 179 | ||
180 | /* IP_MF appears to be only defined in <netinet/ip.h>, however, | 180 | /* IP_MF appears to be only defined in <netinet/ip.h>, however, |
@@ -1080,11 +1080,14 @@ static void hamachi_tx_timeout(struct net_device *dev) | |||
1080 | { | 1080 | { |
1081 | printk(KERN_DEBUG " Rx ring %p: ", hmp->rx_ring); | 1081 | printk(KERN_DEBUG " Rx ring %p: ", hmp->rx_ring); |
1082 | for (i = 0; i < RX_RING_SIZE; i++) | 1082 | for (i = 0; i < RX_RING_SIZE; i++) |
1083 | printk(" %8.8x", le32_to_cpu(hmp->rx_ring[i].status_n_length)); | 1083 | printk(KERN_CONT " %8.8x", |
1084 | printk("\n"KERN_DEBUG" Tx ring %p: ", hmp->tx_ring); | 1084 | le32_to_cpu(hmp->rx_ring[i].status_n_length)); |
1085 | printk(KERN_CONT "\n"); | ||
1086 | printk(KERN_DEBUG" Tx ring %p: ", hmp->tx_ring); | ||
1085 | for (i = 0; i < TX_RING_SIZE; i++) | 1087 | for (i = 0; i < TX_RING_SIZE; i++) |
1086 | printk(" %4.4x", le32_to_cpu(hmp->tx_ring[i].status_n_length)); | 1088 | printk(KERN_CONT " %4.4x", |
1087 | printk("\n"); | 1089 | le32_to_cpu(hmp->tx_ring[i].status_n_length)); |
1090 | printk(KERN_CONT "\n"); | ||
1088 | } | 1091 | } |
1089 | 1092 | ||
1090 | /* Reinit the hardware and make sure the Rx and Tx processes | 1093 | /* Reinit the hardware and make sure the Rx and Tx processes |
@@ -1753,13 +1756,13 @@ static int hamachi_close(struct net_device *dev) | |||
1753 | 1756 | ||
1754 | #ifdef __i386__ | 1757 | #ifdef __i386__ |
1755 | if (hamachi_debug > 2) { | 1758 | if (hamachi_debug > 2) { |
1756 | printk("\n"KERN_DEBUG" Tx ring at %8.8x:\n", | 1759 | printk(KERN_DEBUG " Tx ring at %8.8x:\n", |
1757 | (int)hmp->tx_ring_dma); | 1760 | (int)hmp->tx_ring_dma); |
1758 | for (i = 0; i < TX_RING_SIZE; i++) | 1761 | for (i = 0; i < TX_RING_SIZE; i++) |
1759 | printk(" %c #%d desc. %8.8x %8.8x.\n", | 1762 | printk(KERN_DEBUG " %c #%d desc. %8.8x %8.8x.\n", |
1760 | readl(ioaddr + TxCurPtr) == (long)&hmp->tx_ring[i] ? '>' : ' ', | 1763 | readl(ioaddr + TxCurPtr) == (long)&hmp->tx_ring[i] ? '>' : ' ', |
1761 | i, hmp->tx_ring[i].status_n_length, hmp->tx_ring[i].addr); | 1764 | i, hmp->tx_ring[i].status_n_length, hmp->tx_ring[i].addr); |
1762 | printk("\n"KERN_DEBUG " Rx ring %8.8x:\n", | 1765 | printk(KERN_DEBUG " Rx ring %8.8x:\n", |
1763 | (int)hmp->rx_ring_dma); | 1766 | (int)hmp->rx_ring_dma); |
1764 | for (i = 0; i < RX_RING_SIZE; i++) { | 1767 | for (i = 0; i < RX_RING_SIZE; i++) { |
1765 | printk(KERN_DEBUG " %c #%d desc. %4.4x %8.8x\n", | 1768 | printk(KERN_DEBUG " %c #%d desc. %4.4x %8.8x\n", |
@@ -1770,7 +1773,7 @@ static int hamachi_close(struct net_device *dev) | |||
1770 | u16 *addr = (u16 *) | 1773 | u16 *addr = (u16 *) |
1771 | hmp->rx_skbuff[i]->data; | 1774 | hmp->rx_skbuff[i]->data; |
1772 | int j; | 1775 | int j; |
1773 | 1776 | printk(KERN_DEBUG "Addr: "); | |
1774 | for (j = 0; j < 0x50; j++) | 1777 | for (j = 0; j < 0x50; j++) |
1775 | printk(" %4.4x", addr[j]); | 1778 | printk(" %4.4x", addr[j]); |
1776 | printk("\n"); | 1779 | printk("\n"); |
diff --git a/drivers/net/hamradio/baycom_epp.c b/drivers/net/hamradio/baycom_epp.c index 5e4b7afd0683..352703255bba 100644 --- a/drivers/net/hamradio/baycom_epp.c +++ b/drivers/net/hamradio/baycom_epp.c | |||
@@ -68,7 +68,7 @@ static const char paranoia_str[] = KERN_ERR | |||
68 | 68 | ||
69 | static const char bc_drvname[] = "baycom_epp"; | 69 | static const char bc_drvname[] = "baycom_epp"; |
70 | static const char bc_drvinfo[] = KERN_INFO "baycom_epp: (C) 1998-2000 Thomas Sailer, HB9JNX/AE4WA\n" | 70 | static const char bc_drvinfo[] = KERN_INFO "baycom_epp: (C) 1998-2000 Thomas Sailer, HB9JNX/AE4WA\n" |
71 | KERN_INFO "baycom_epp: version 0.7 compiled " __TIME__ " " __DATE__ "\n"; | 71 | "baycom_epp: version 0.7 compiled " __TIME__ " " __DATE__ "\n"; |
72 | 72 | ||
73 | /* --------------------------------------------------------------------- */ | 73 | /* --------------------------------------------------------------------- */ |
74 | 74 | ||
diff --git a/drivers/net/hamradio/baycom_par.c b/drivers/net/hamradio/baycom_par.c index 2e6fc4dc74b1..5f5af9a606f8 100644 --- a/drivers/net/hamradio/baycom_par.c +++ b/drivers/net/hamradio/baycom_par.c | |||
@@ -102,7 +102,7 @@ | |||
102 | 102 | ||
103 | static const char bc_drvname[] = "baycom_par"; | 103 | static const char bc_drvname[] = "baycom_par"; |
104 | static const char bc_drvinfo[] = KERN_INFO "baycom_par: (C) 1996-2000 Thomas Sailer, HB9JNX/AE4WA\n" | 104 | static const char bc_drvinfo[] = KERN_INFO "baycom_par: (C) 1996-2000 Thomas Sailer, HB9JNX/AE4WA\n" |
105 | KERN_INFO "baycom_par: version 0.9 compiled " __TIME__ " " __DATE__ "\n"; | 105 | "baycom_par: version 0.9 compiled " __TIME__ " " __DATE__ "\n"; |
106 | 106 | ||
107 | /* --------------------------------------------------------------------- */ | 107 | /* --------------------------------------------------------------------- */ |
108 | 108 | ||
diff --git a/drivers/net/hamradio/baycom_ser_fdx.c b/drivers/net/hamradio/baycom_ser_fdx.c index b6a816e60c0f..aa4488e871b2 100644 --- a/drivers/net/hamradio/baycom_ser_fdx.c +++ b/drivers/net/hamradio/baycom_ser_fdx.c | |||
@@ -91,7 +91,7 @@ | |||
91 | 91 | ||
92 | static const char bc_drvname[] = "baycom_ser_fdx"; | 92 | static const char bc_drvname[] = "baycom_ser_fdx"; |
93 | static const char bc_drvinfo[] = KERN_INFO "baycom_ser_fdx: (C) 1996-2000 Thomas Sailer, HB9JNX/AE4WA\n" | 93 | static const char bc_drvinfo[] = KERN_INFO "baycom_ser_fdx: (C) 1996-2000 Thomas Sailer, HB9JNX/AE4WA\n" |
94 | KERN_INFO "baycom_ser_fdx: version 0.10 compiled " __TIME__ " " __DATE__ "\n"; | 94 | "baycom_ser_fdx: version 0.10 compiled " __TIME__ " " __DATE__ "\n"; |
95 | 95 | ||
96 | /* --------------------------------------------------------------------- */ | 96 | /* --------------------------------------------------------------------- */ |
97 | 97 | ||
diff --git a/drivers/net/hamradio/baycom_ser_hdx.c b/drivers/net/hamradio/baycom_ser_hdx.c index 3bcc57acbe6d..88c593596020 100644 --- a/drivers/net/hamradio/baycom_ser_hdx.c +++ b/drivers/net/hamradio/baycom_ser_hdx.c | |||
@@ -79,7 +79,7 @@ | |||
79 | 79 | ||
80 | static const char bc_drvname[] = "baycom_ser_hdx"; | 80 | static const char bc_drvname[] = "baycom_ser_hdx"; |
81 | static const char bc_drvinfo[] = KERN_INFO "baycom_ser_hdx: (C) 1996-2000 Thomas Sailer, HB9JNX/AE4WA\n" | 81 | static const char bc_drvinfo[] = KERN_INFO "baycom_ser_hdx: (C) 1996-2000 Thomas Sailer, HB9JNX/AE4WA\n" |
82 | KERN_INFO "baycom_ser_hdx: version 0.10 compiled " __TIME__ " " __DATE__ "\n"; | 82 | "baycom_ser_hdx: version 0.10 compiled " __TIME__ " " __DATE__ "\n"; |
83 | 83 | ||
84 | /* --------------------------------------------------------------------- */ | 84 | /* --------------------------------------------------------------------- */ |
85 | 85 | ||
diff --git a/drivers/net/igb/e1000_82575.c b/drivers/net/igb/e1000_82575.c index efd9be214885..ac28dd5a4fd1 100644 --- a/drivers/net/igb/e1000_82575.c +++ b/drivers/net/igb/e1000_82575.c | |||
@@ -190,6 +190,10 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw) | |||
190 | phy->ops.write_reg = igb_write_phy_reg_igp; | 190 | phy->ops.write_reg = igb_write_phy_reg_igp; |
191 | } | 191 | } |
192 | 192 | ||
193 | /* set lan id */ | ||
194 | hw->bus.func = (rd32(E1000_STATUS) & E1000_STATUS_FUNC_MASK) >> | ||
195 | E1000_STATUS_FUNC_SHIFT; | ||
196 | |||
193 | /* Set phy->phy_addr and phy->id. */ | 197 | /* Set phy->phy_addr and phy->id. */ |
194 | ret_val = igb_get_phy_id_82575(hw); | 198 | ret_val = igb_get_phy_id_82575(hw); |
195 | if (ret_val) | 199 | if (ret_val) |
diff --git a/drivers/net/irda/irtty-sir.c b/drivers/net/irda/irtty-sir.c index d53aa9582137..20f9bc626688 100644 --- a/drivers/net/irda/irtty-sir.c +++ b/drivers/net/irda/irtty-sir.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/tty.h> | 31 | #include <linux/tty.h> |
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
33 | #include <asm/uaccess.h> | 33 | #include <asm/uaccess.h> |
34 | #include <linux/smp_lock.h> | ||
35 | #include <linux/delay.h> | 34 | #include <linux/delay.h> |
36 | #include <linux/mutex.h> | 35 | #include <linux/mutex.h> |
37 | 36 | ||
diff --git a/drivers/net/ixgbe/ixgbe_dcb_nl.c b/drivers/net/ixgbe/ixgbe_dcb_nl.c index d56890f5c9d5..7c5978ad929a 100644 --- a/drivers/net/ixgbe/ixgbe_dcb_nl.c +++ b/drivers/net/ixgbe/ixgbe_dcb_nl.c | |||
@@ -138,6 +138,10 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) | |||
138 | adapter->hw.fc.requested_mode = ixgbe_fc_none; | 138 | adapter->hw.fc.requested_mode = ixgbe_fc_none; |
139 | } | 139 | } |
140 | adapter->flags &= ~IXGBE_FLAG_RSS_ENABLED; | 140 | adapter->flags &= ~IXGBE_FLAG_RSS_ENABLED; |
141 | if (adapter->hw.mac.type == ixgbe_mac_82599EB) { | ||
142 | adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE; | ||
143 | adapter->flags &= ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE; | ||
144 | } | ||
141 | adapter->flags |= IXGBE_FLAG_DCB_ENABLED; | 145 | adapter->flags |= IXGBE_FLAG_DCB_ENABLED; |
142 | ixgbe_init_interrupt_scheme(adapter); | 146 | ixgbe_init_interrupt_scheme(adapter); |
143 | if (netif_running(netdev)) | 147 | if (netif_running(netdev)) |
@@ -154,6 +158,8 @@ static u8 ixgbe_dcbnl_set_state(struct net_device *netdev, u8 state) | |||
154 | adapter->dcb_cfg.pfc_mode_enable = false; | 158 | adapter->dcb_cfg.pfc_mode_enable = false; |
155 | adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED; | 159 | adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED; |
156 | adapter->flags |= IXGBE_FLAG_RSS_ENABLED; | 160 | adapter->flags |= IXGBE_FLAG_RSS_ENABLED; |
161 | if (adapter->hw.mac.type == ixgbe_mac_82599EB) | ||
162 | adapter->flags |= IXGBE_FLAG_FDIR_HASH_CAPABLE; | ||
157 | ixgbe_init_interrupt_scheme(adapter); | 163 | ixgbe_init_interrupt_scheme(adapter); |
158 | if (netif_running(netdev)) | 164 | if (netif_running(netdev)) |
159 | netdev->netdev_ops->ndo_open(netdev); | 165 | netdev->netdev_ops->ndo_open(netdev); |
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c index 0f7b6a3a2e68..2a978008fd6e 100644 --- a/drivers/net/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ixgbe/ixgbe_ethtool.c | |||
@@ -1830,7 +1830,6 @@ static int ixgbe_wol_exclusion(struct ixgbe_adapter *adapter, | |||
1830 | break; | 1830 | break; |
1831 | default: | 1831 | default: |
1832 | wol->supported = 0; | 1832 | wol->supported = 0; |
1833 | retval = 0; | ||
1834 | } | 1833 | } |
1835 | 1834 | ||
1836 | return retval; | 1835 | return retval; |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index 5588ef493a3d..e3442f47f932 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -2697,19 +2697,23 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter) | |||
2697 | 2697 | ||
2698 | /* | 2698 | /* |
2699 | * For hot-pluggable SFP+ devices, a new SFP+ module may have | 2699 | * For hot-pluggable SFP+ devices, a new SFP+ module may have |
2700 | * arrived before interrupts were enabled. We need to kick off | 2700 | * arrived before interrupts were enabled but after probe. Such |
2701 | * the SFP+ module setup first, then try to bring up link. | 2701 | * devices wouldn't have their type identified yet. We need to |
2702 | * kick off the SFP+ module setup first, then try to bring up link. | ||
2702 | * If we're not hot-pluggable SFP+, we just need to configure link | 2703 | * If we're not hot-pluggable SFP+, we just need to configure link |
2703 | * and bring it up. | 2704 | * and bring it up. |
2704 | */ | 2705 | */ |
2705 | err = hw->phy.ops.identify(hw); | 2706 | if (hw->phy.type == ixgbe_phy_unknown) { |
2706 | if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { | 2707 | err = hw->phy.ops.identify(hw); |
2707 | dev_err(&adapter->pdev->dev, "failed to initialize because " | 2708 | if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { |
2708 | "an unsupported SFP+ module type was detected.\n" | 2709 | /* |
2709 | "Reload the driver after installing a supported " | 2710 | * Take the device down and schedule the sfp tasklet |
2710 | "module.\n"); | 2711 | * which will unregister_netdev and log it. |
2711 | ixgbe_down(adapter); | 2712 | */ |
2712 | return err; | 2713 | ixgbe_down(adapter); |
2714 | schedule_work(&adapter->sfp_config_module_task); | ||
2715 | return err; | ||
2716 | } | ||
2713 | } | 2717 | } |
2714 | 2718 | ||
2715 | if (ixgbe_is_sfp(hw)) { | 2719 | if (ixgbe_is_sfp(hw)) { |
@@ -3126,7 +3130,11 @@ static inline bool ixgbe_set_fcoe_queues(struct ixgbe_adapter *adapter) | |||
3126 | #endif | 3130 | #endif |
3127 | if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) { | 3131 | if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) { |
3128 | DPRINTK(PROBE, INFO, "FCOE enabled with RSS \n"); | 3132 | DPRINTK(PROBE, INFO, "FCOE enabled with RSS \n"); |
3129 | ixgbe_set_rss_queues(adapter); | 3133 | if ((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) || |
3134 | (adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) | ||
3135 | ixgbe_set_fdir_queues(adapter); | ||
3136 | else | ||
3137 | ixgbe_set_rss_queues(adapter); | ||
3130 | } | 3138 | } |
3131 | /* adding FCoE rx rings to the end */ | 3139 | /* adding FCoE rx rings to the end */ |
3132 | f->mask = adapter->num_rx_queues; | 3140 | f->mask = adapter->num_rx_queues; |
@@ -3384,7 +3392,12 @@ static inline bool ixgbe_cache_ring_fcoe(struct ixgbe_adapter *adapter) | |||
3384 | } | 3392 | } |
3385 | #endif /* CONFIG_IXGBE_DCB */ | 3393 | #endif /* CONFIG_IXGBE_DCB */ |
3386 | if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) { | 3394 | if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) { |
3387 | ixgbe_cache_ring_rss(adapter); | 3395 | if ((adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) || |
3396 | (adapter->flags & IXGBE_FLAG_FDIR_PERFECT_CAPABLE)) | ||
3397 | ixgbe_cache_ring_fdir(adapter); | ||
3398 | else | ||
3399 | ixgbe_cache_ring_rss(adapter); | ||
3400 | |||
3388 | fcoe_i = f->mask; | 3401 | fcoe_i = f->mask; |
3389 | } | 3402 | } |
3390 | for (i = 0; i < f->indices; i++, fcoe_i++) | 3403 | for (i = 0; i < f->indices; i++, fcoe_i++) |
@@ -3724,7 +3737,7 @@ static void ixgbe_sfp_task(struct work_struct *work) | |||
3724 | if ((hw->phy.type == ixgbe_phy_nl) && | 3737 | if ((hw->phy.type == ixgbe_phy_nl) && |
3725 | (hw->phy.sfp_type == ixgbe_sfp_type_not_present)) { | 3738 | (hw->phy.sfp_type == ixgbe_sfp_type_not_present)) { |
3726 | s32 ret = hw->phy.ops.identify_sfp(hw); | 3739 | s32 ret = hw->phy.ops.identify_sfp(hw); |
3727 | if (ret) | 3740 | if (ret == IXGBE_ERR_SFP_NOT_PRESENT) |
3728 | goto reschedule; | 3741 | goto reschedule; |
3729 | ret = hw->phy.ops.reset(hw); | 3742 | ret = hw->phy.ops.reset(hw); |
3730 | if (ret == IXGBE_ERR_SFP_NOT_SUPPORTED) { | 3743 | if (ret == IXGBE_ERR_SFP_NOT_SUPPORTED) { |
@@ -4534,13 +4547,17 @@ static void ixgbe_sfp_config_module_task(struct work_struct *work) | |||
4534 | u32 err; | 4547 | u32 err; |
4535 | 4548 | ||
4536 | adapter->flags |= IXGBE_FLAG_IN_SFP_MOD_TASK; | 4549 | adapter->flags |= IXGBE_FLAG_IN_SFP_MOD_TASK; |
4550 | |||
4551 | /* Time for electrical oscillations to settle down */ | ||
4552 | msleep(100); | ||
4537 | err = hw->phy.ops.identify_sfp(hw); | 4553 | err = hw->phy.ops.identify_sfp(hw); |
4554 | |||
4538 | if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { | 4555 | if (err == IXGBE_ERR_SFP_NOT_SUPPORTED) { |
4539 | dev_err(&adapter->pdev->dev, "failed to initialize because " | 4556 | dev_err(&adapter->pdev->dev, "failed to initialize because " |
4540 | "an unsupported SFP+ module type was detected.\n" | 4557 | "an unsupported SFP+ module type was detected.\n" |
4541 | "Reload the driver after installing a supported " | 4558 | "Reload the driver after installing a supported " |
4542 | "module.\n"); | 4559 | "module.\n"); |
4543 | ixgbe_down(adapter); | 4560 | unregister_netdev(adapter->netdev); |
4544 | return; | 4561 | return; |
4545 | } | 4562 | } |
4546 | hw->mac.ops.setup_sfp(hw); | 4563 | hw->mac.ops.setup_sfp(hw); |
@@ -5570,12 +5587,6 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev, | |||
5570 | netdev->features |= NETIF_F_FCOE_CRC; | 5587 | netdev->features |= NETIF_F_FCOE_CRC; |
5571 | netdev->features |= NETIF_F_FSO; | 5588 | netdev->features |= NETIF_F_FSO; |
5572 | netdev->fcoe_ddp_xid = IXGBE_FCOE_DDP_MAX - 1; | 5589 | netdev->fcoe_ddp_xid = IXGBE_FCOE_DDP_MAX - 1; |
5573 | DPRINTK(DRV, INFO, "FCoE enabled, " | ||
5574 | "disabling Flow Director\n"); | ||
5575 | adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE; | ||
5576 | adapter->flags &= | ||
5577 | ~IXGBE_FLAG_FDIR_PERFECT_CAPABLE; | ||
5578 | adapter->atr_sample_rate = 0; | ||
5579 | } else { | 5590 | } else { |
5580 | adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED; | 5591 | adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED; |
5581 | } | 5592 | } |
diff --git a/drivers/net/ixgbe/ixgbe_phy.c b/drivers/net/ixgbe/ixgbe_phy.c index 453e966762f0..9ecad17522c3 100644 --- a/drivers/net/ixgbe/ixgbe_phy.c +++ b/drivers/net/ixgbe/ixgbe_phy.c | |||
@@ -60,6 +60,7 @@ s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw) | |||
60 | 60 | ||
61 | if (hw->phy.type == ixgbe_phy_unknown) { | 61 | if (hw->phy.type == ixgbe_phy_unknown) { |
62 | for (phy_addr = 0; phy_addr < IXGBE_MAX_PHY_ADDR; phy_addr++) { | 62 | for (phy_addr = 0; phy_addr < IXGBE_MAX_PHY_ADDR; phy_addr++) { |
63 | hw->phy.mdio.prtad = phy_addr; | ||
63 | if (mdio45_probe(&hw->phy.mdio, phy_addr) == 0) { | 64 | if (mdio45_probe(&hw->phy.mdio, phy_addr) == 0) { |
64 | ixgbe_get_phy_id(hw); | 65 | ixgbe_get_phy_id(hw); |
65 | hw->phy.type = | 66 | hw->phy.type = |
@@ -68,6 +69,8 @@ s32 ixgbe_identify_phy_generic(struct ixgbe_hw *hw) | |||
68 | break; | 69 | break; |
69 | } | 70 | } |
70 | } | 71 | } |
72 | /* clear value if nothing found */ | ||
73 | hw->phy.mdio.prtad = 0; | ||
71 | } else { | 74 | } else { |
72 | status = 0; | 75 | status = 0; |
73 | } | 76 | } |
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c index c9bfe4eea189..78c088331f57 100644 --- a/drivers/net/natsemi.c +++ b/drivers/net/natsemi.c | |||
@@ -130,8 +130,8 @@ static int full_duplex[MAX_UNITS]; | |||
130 | static const char version[] __devinitconst = | 130 | static const char version[] __devinitconst = |
131 | KERN_INFO DRV_NAME " dp8381x driver, version " | 131 | KERN_INFO DRV_NAME " dp8381x driver, version " |
132 | DRV_VERSION ", " DRV_RELDATE "\n" | 132 | DRV_VERSION ", " DRV_RELDATE "\n" |
133 | KERN_INFO " originally by Donald Becker <becker@scyld.com>\n" | 133 | " originally by Donald Becker <becker@scyld.com>\n" |
134 | KERN_INFO " 2.4.x kernel port by Jeff Garzik, Tjeerd Mulder\n"; | 134 | " 2.4.x kernel port by Jeff Garzik, Tjeerd Mulder\n"; |
135 | 135 | ||
136 | MODULE_AUTHOR("Donald Becker <becker@scyld.com>"); | 136 | MODULE_AUTHOR("Donald Becker <becker@scyld.com>"); |
137 | MODULE_DESCRIPTION("National Semiconductor DP8381x series PCI Ethernet driver"); | 137 | MODULE_DESCRIPTION("National Semiconductor DP8381x series PCI Ethernet driver"); |
diff --git a/drivers/net/ne.c b/drivers/net/ne.c index 5c3e242428f1..992dbfffdb05 100644 --- a/drivers/net/ne.c +++ b/drivers/net/ne.c | |||
@@ -321,7 +321,7 @@ static int __init ne_probe1(struct net_device *dev, unsigned long ioaddr) | |||
321 | } | 321 | } |
322 | 322 | ||
323 | if (ei_debug && version_printed++ == 0) | 323 | if (ei_debug && version_printed++ == 0) |
324 | printk(KERN_INFO "%s" KERN_INFO "%s", version1, version2); | 324 | printk(KERN_INFO "%s%s", version1, version2); |
325 | 325 | ||
326 | printk(KERN_INFO "NE*000 ethercard probe at %#3lx:", ioaddr); | 326 | printk(KERN_INFO "NE*000 ethercard probe at %#3lx:", ioaddr); |
327 | 327 | ||
diff --git a/drivers/net/netxen/netxen_nic.h b/drivers/net/netxen/netxen_nic.h index 970cedeb5f37..e1cdba752e09 100644 --- a/drivers/net/netxen/netxen_nic.h +++ b/drivers/net/netxen/netxen_nic.h | |||
@@ -60,7 +60,18 @@ | |||
60 | #define _NETXEN_NIC_LINUX_SUBVERSION 30 | 60 | #define _NETXEN_NIC_LINUX_SUBVERSION 30 |
61 | #define NETXEN_NIC_LINUX_VERSIONID "4.0.30" | 61 | #define NETXEN_NIC_LINUX_VERSIONID "4.0.30" |
62 | 62 | ||
63 | #define NETXEN_VERSION_CODE(a, b, c) (((a) << 16) + ((b) << 8) + (c)) | 63 | #define NETXEN_VERSION_CODE(a, b, c) (((a) << 24) + ((b) << 16) + (c)) |
64 | #define _major(v) (((v) >> 24) & 0xff) | ||
65 | #define _minor(v) (((v) >> 16) & 0xff) | ||
66 | #define _build(v) ((v) & 0xffff) | ||
67 | |||
68 | /* version in image has weird encoding: | ||
69 | * 7:0 - major | ||
70 | * 15:8 - minor | ||
71 | * 31:16 - build (little endian) | ||
72 | */ | ||
73 | #define NETXEN_DECODE_VERSION(v) \ | ||
74 | NETXEN_VERSION_CODE(((v) & 0xff), (((v) >> 8) & 0xff), ((v) >> 16)) | ||
64 | 75 | ||
65 | #define NETXEN_NUM_FLASH_SECTORS (64) | 76 | #define NETXEN_NUM_FLASH_SECTORS (64) |
66 | #define NETXEN_FLASH_SECTOR_SIZE (64 * 1024) | 77 | #define NETXEN_FLASH_SECTOR_SIZE (64 * 1024) |
@@ -614,6 +625,7 @@ struct netxen_new_user_info { | |||
614 | #define NX_P2_MN_ROMIMAGE 0 | 625 | #define NX_P2_MN_ROMIMAGE 0 |
615 | #define NX_P3_CT_ROMIMAGE 1 | 626 | #define NX_P3_CT_ROMIMAGE 1 |
616 | #define NX_P3_MN_ROMIMAGE 2 | 627 | #define NX_P3_MN_ROMIMAGE 2 |
628 | #define NX_FLASH_ROMIMAGE 3 | ||
617 | 629 | ||
618 | #define NETXEN_USER_START_OLD NETXEN_PXE_START /* for backward compatibility */ | 630 | #define NETXEN_USER_START_OLD NETXEN_PXE_START /* for backward compatibility */ |
619 | 631 | ||
@@ -1243,7 +1255,7 @@ struct netxen_adapter { | |||
1243 | u32 resv3; | 1255 | u32 resv3; |
1244 | 1256 | ||
1245 | u8 has_link_events; | 1257 | u8 has_link_events; |
1246 | u8 resv1; | 1258 | u8 fw_type; |
1247 | u16 tx_context_id; | 1259 | u16 tx_context_id; |
1248 | u16 mtu; | 1260 | u16 mtu; |
1249 | u16 is_up; | 1261 | u16 is_up; |
@@ -1387,6 +1399,7 @@ void netxen_free_adapter_offload(struct netxen_adapter *adapter); | |||
1387 | int netxen_initialize_adapter_offload(struct netxen_adapter *adapter); | 1399 | int netxen_initialize_adapter_offload(struct netxen_adapter *adapter); |
1388 | int netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val); | 1400 | int netxen_phantom_init(struct netxen_adapter *adapter, int pegtune_val); |
1389 | int netxen_load_firmware(struct netxen_adapter *adapter); | 1401 | int netxen_load_firmware(struct netxen_adapter *adapter); |
1402 | int netxen_need_fw_reset(struct netxen_adapter *adapter); | ||
1390 | void netxen_request_firmware(struct netxen_adapter *adapter); | 1403 | void netxen_request_firmware(struct netxen_adapter *adapter); |
1391 | void netxen_release_firmware(struct netxen_adapter *adapter); | 1404 | void netxen_release_firmware(struct netxen_adapter *adapter); |
1392 | int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose); | 1405 | int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose); |
diff --git a/drivers/net/netxen/netxen_nic_hdr.h b/drivers/net/netxen/netxen_nic_hdr.h index 3cc047844af3..824103675648 100644 --- a/drivers/net/netxen/netxen_nic_hdr.h +++ b/drivers/net/netxen/netxen_nic_hdr.h | |||
@@ -853,6 +853,7 @@ enum { | |||
853 | #define NX_PEG_TUNE_CAPABILITY (NETXEN_CAM_RAM(0x02c)) | 853 | #define NX_PEG_TUNE_CAPABILITY (NETXEN_CAM_RAM(0x02c)) |
854 | 854 | ||
855 | #define NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL (0x14) | 855 | #define NETXEN_CAM_RAM_DMA_WATCHDOG_CTRL (0x14) |
856 | #define NETXEN_PEG_ALIVE_COUNTER (NETXEN_CAM_RAM(0xb0)) | ||
856 | 857 | ||
857 | #define ISR_MSI_INT_TRIGGER(FUNC) (NETXEN_PCIX_PS_REG(PCIX_MSI_F(FUNC))) | 858 | #define ISR_MSI_INT_TRIGGER(FUNC) (NETXEN_PCIX_PS_REG(PCIX_MSI_F(FUNC))) |
858 | #define ISR_LEGACY_INT_TRIGGERED(VAL) (((VAL) & 0x300) == 0x200) | 859 | #define ISR_LEGACY_INT_TRIGGERED(VAL) (((VAL) & 0x300) == 0x200) |
diff --git a/drivers/net/netxen/netxen_nic_init.c b/drivers/net/netxen/netxen_nic_init.c index 055bb61d6e77..b899bd51fcd8 100644 --- a/drivers/net/netxen/netxen_nic_init.c +++ b/drivers/net/netxen/netxen_nic_init.c | |||
@@ -684,11 +684,84 @@ int netxen_pinit_from_rom(struct netxen_adapter *adapter, int verbose) | |||
684 | } | 684 | } |
685 | 685 | ||
686 | int | 686 | int |
687 | netxen_need_fw_reset(struct netxen_adapter *adapter) | ||
688 | { | ||
689 | u32 count, old_count; | ||
690 | u32 val, version, major, minor, build; | ||
691 | int i, timeout; | ||
692 | u8 fw_type; | ||
693 | |||
694 | /* NX2031 firmware doesn't support heartbit */ | ||
695 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) | ||
696 | return 1; | ||
697 | |||
698 | /* last attempt had failed */ | ||
699 | if (NXRD32(adapter, CRB_CMDPEG_STATE) == PHAN_INITIALIZE_FAILED) | ||
700 | return 1; | ||
701 | |||
702 | old_count = count = NXRD32(adapter, NETXEN_PEG_ALIVE_COUNTER); | ||
703 | |||
704 | for (i = 0; i < 10; i++) { | ||
705 | |||
706 | timeout = msleep_interruptible(200); | ||
707 | if (timeout) { | ||
708 | NXWR32(adapter, CRB_CMDPEG_STATE, | ||
709 | PHAN_INITIALIZE_FAILED); | ||
710 | return -EINTR; | ||
711 | } | ||
712 | |||
713 | count = NXRD32(adapter, NETXEN_PEG_ALIVE_COUNTER); | ||
714 | if (count != old_count) | ||
715 | break; | ||
716 | } | ||
717 | |||
718 | /* firmware is dead */ | ||
719 | if (count == old_count) | ||
720 | return 1; | ||
721 | |||
722 | /* check if we have got newer or different file firmware */ | ||
723 | if (adapter->fw) { | ||
724 | |||
725 | const struct firmware *fw = adapter->fw; | ||
726 | |||
727 | val = cpu_to_le32(*(u32 *)&fw->data[NX_FW_VERSION_OFFSET]); | ||
728 | version = NETXEN_DECODE_VERSION(val); | ||
729 | |||
730 | major = NXRD32(adapter, NETXEN_FW_VERSION_MAJOR); | ||
731 | minor = NXRD32(adapter, NETXEN_FW_VERSION_MINOR); | ||
732 | build = NXRD32(adapter, NETXEN_FW_VERSION_SUB); | ||
733 | |||
734 | if (version > NETXEN_VERSION_CODE(major, minor, build)) | ||
735 | return 1; | ||
736 | |||
737 | if (version == NETXEN_VERSION_CODE(major, minor, build)) { | ||
738 | |||
739 | val = NXRD32(adapter, NETXEN_MIU_MN_CONTROL); | ||
740 | fw_type = (val & 0x4) ? | ||
741 | NX_P3_CT_ROMIMAGE : NX_P3_MN_ROMIMAGE; | ||
742 | |||
743 | if (adapter->fw_type != fw_type) | ||
744 | return 1; | ||
745 | } | ||
746 | } | ||
747 | |||
748 | return 0; | ||
749 | } | ||
750 | |||
751 | static char *fw_name[] = { | ||
752 | "nxromimg.bin", "nx3fwct.bin", "nx3fwmn.bin", "flash", | ||
753 | }; | ||
754 | |||
755 | int | ||
687 | netxen_load_firmware(struct netxen_adapter *adapter) | 756 | netxen_load_firmware(struct netxen_adapter *adapter) |
688 | { | 757 | { |
689 | u64 *ptr64; | 758 | u64 *ptr64; |
690 | u32 i, flashaddr, size; | 759 | u32 i, flashaddr, size; |
691 | const struct firmware *fw = adapter->fw; | 760 | const struct firmware *fw = adapter->fw; |
761 | struct pci_dev *pdev = adapter->pdev; | ||
762 | |||
763 | dev_info(&pdev->dev, "loading firmware from %s\n", | ||
764 | fw_name[adapter->fw_type]); | ||
692 | 765 | ||
693 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) | 766 | if (NX_IS_REVISION_P2(adapter->ahw.revision_id)) |
694 | NXWR32(adapter, NETXEN_ROMUSB_GLB_CAS_RST, 1); | 767 | NXWR32(adapter, NETXEN_ROMUSB_GLB_CAS_RST, 1); |
@@ -756,7 +829,7 @@ static int | |||
756 | netxen_validate_firmware(struct netxen_adapter *adapter, const char *fwname) | 829 | netxen_validate_firmware(struct netxen_adapter *adapter, const char *fwname) |
757 | { | 830 | { |
758 | __le32 val; | 831 | __le32 val; |
759 | u32 major, minor, build, ver, min_ver, bios; | 832 | u32 ver, min_ver, bios; |
760 | struct pci_dev *pdev = adapter->pdev; | 833 | struct pci_dev *pdev = adapter->pdev; |
761 | const struct firmware *fw = adapter->fw; | 834 | const struct firmware *fw = adapter->fw; |
762 | 835 | ||
@@ -768,21 +841,18 @@ netxen_validate_firmware(struct netxen_adapter *adapter, const char *fwname) | |||
768 | return -EINVAL; | 841 | return -EINVAL; |
769 | 842 | ||
770 | val = cpu_to_le32(*(u32 *)&fw->data[NX_FW_VERSION_OFFSET]); | 843 | val = cpu_to_le32(*(u32 *)&fw->data[NX_FW_VERSION_OFFSET]); |
771 | major = (__force u32)val & 0xff; | ||
772 | minor = ((__force u32)val >> 8) & 0xff; | ||
773 | build = (__force u32)val >> 16; | ||
774 | 844 | ||
775 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) | 845 | if (NX_IS_REVISION_P3(adapter->ahw.revision_id)) |
776 | min_ver = NETXEN_VERSION_CODE(4, 0, 216); | 846 | min_ver = NETXEN_VERSION_CODE(4, 0, 216); |
777 | else | 847 | else |
778 | min_ver = NETXEN_VERSION_CODE(3, 4, 216); | 848 | min_ver = NETXEN_VERSION_CODE(3, 4, 216); |
779 | 849 | ||
780 | ver = NETXEN_VERSION_CODE(major, minor, build); | 850 | ver = NETXEN_DECODE_VERSION(val); |
781 | 851 | ||
782 | if ((major > _NETXEN_NIC_LINUX_MAJOR) || (ver < min_ver)) { | 852 | if ((_major(ver) > _NETXEN_NIC_LINUX_MAJOR) || (ver < min_ver)) { |
783 | dev_err(&pdev->dev, | 853 | dev_err(&pdev->dev, |
784 | "%s: firmware version %d.%d.%d unsupported\n", | 854 | "%s: firmware version %d.%d.%d unsupported\n", |
785 | fwname, major, minor, build); | 855 | fwname, _major(ver), _minor(ver), _build(ver)); |
786 | return -EINVAL; | 856 | return -EINVAL; |
787 | } | 857 | } |
788 | 858 | ||
@@ -798,22 +868,21 @@ netxen_validate_firmware(struct netxen_adapter *adapter, const char *fwname) | |||
798 | if (netxen_rom_fast_read(adapter, | 868 | if (netxen_rom_fast_read(adapter, |
799 | NX_FW_VERSION_OFFSET, (int *)&val)) | 869 | NX_FW_VERSION_OFFSET, (int *)&val)) |
800 | return -EIO; | 870 | return -EIO; |
801 | major = (__force u32)val & 0xff; | 871 | val = NETXEN_DECODE_VERSION(val); |
802 | minor = ((__force u32)val >> 8) & 0xff; | 872 | if (val > ver) { |
803 | build = (__force u32)val >> 16; | 873 | dev_info(&pdev->dev, "%s: firmware is older than flash\n", |
804 | if (NETXEN_VERSION_CODE(major, minor, build) > ver) | 874 | fwname); |
805 | return -EINVAL; | 875 | return -EINVAL; |
876 | } | ||
806 | 877 | ||
807 | NXWR32(adapter, NETXEN_CAM_RAM(0x1fc), NETXEN_BDINFO_MAGIC); | 878 | NXWR32(adapter, NETXEN_CAM_RAM(0x1fc), NETXEN_BDINFO_MAGIC); |
808 | return 0; | 879 | return 0; |
809 | } | 880 | } |
810 | 881 | ||
811 | static char *fw_name[] = { "nxromimg.bin", "nx3fwct.bin", "nx3fwmn.bin" }; | ||
812 | |||
813 | void netxen_request_firmware(struct netxen_adapter *adapter) | 882 | void netxen_request_firmware(struct netxen_adapter *adapter) |
814 | { | 883 | { |
815 | u32 capability, flashed_ver; | 884 | u32 capability, flashed_ver; |
816 | int fw_type; | 885 | u8 fw_type; |
817 | struct pci_dev *pdev = adapter->pdev; | 886 | struct pci_dev *pdev = adapter->pdev; |
818 | int rc = 0; | 887 | int rc = 0; |
819 | 888 | ||
@@ -830,6 +899,8 @@ request_mn: | |||
830 | 899 | ||
831 | netxen_rom_fast_read(adapter, | 900 | netxen_rom_fast_read(adapter, |
832 | NX_FW_VERSION_OFFSET, (int *)&flashed_ver); | 901 | NX_FW_VERSION_OFFSET, (int *)&flashed_ver); |
902 | flashed_ver = NETXEN_DECODE_VERSION(flashed_ver); | ||
903 | |||
833 | if (flashed_ver >= NETXEN_VERSION_CODE(4, 0, 220)) { | 904 | if (flashed_ver >= NETXEN_VERSION_CODE(4, 0, 220)) { |
834 | capability = NXRD32(adapter, NX_PEG_TUNE_CAPABILITY); | 905 | capability = NXRD32(adapter, NX_PEG_TUNE_CAPABILITY); |
835 | if (capability & NX_PEG_TUNE_MN_PRESENT) { | 906 | if (capability & NX_PEG_TUNE_MN_PRESENT) { |
@@ -838,6 +909,10 @@ request_mn: | |||
838 | } | 909 | } |
839 | } | 910 | } |
840 | 911 | ||
912 | fw_type = NX_FLASH_ROMIMAGE; | ||
913 | adapter->fw = NULL; | ||
914 | goto done; | ||
915 | |||
841 | request_fw: | 916 | request_fw: |
842 | rc = request_firmware(&adapter->fw, fw_name[fw_type], &pdev->dev); | 917 | rc = request_firmware(&adapter->fw, fw_name[fw_type], &pdev->dev); |
843 | if (rc != 0) { | 918 | if (rc != 0) { |
@@ -846,6 +921,7 @@ request_fw: | |||
846 | goto request_mn; | 921 | goto request_mn; |
847 | } | 922 | } |
848 | 923 | ||
924 | fw_type = NX_FLASH_ROMIMAGE; | ||
849 | adapter->fw = NULL; | 925 | adapter->fw = NULL; |
850 | goto done; | 926 | goto done; |
851 | } | 927 | } |
@@ -859,16 +935,13 @@ request_fw: | |||
859 | goto request_mn; | 935 | goto request_mn; |
860 | } | 936 | } |
861 | 937 | ||
938 | fw_type = NX_FLASH_ROMIMAGE; | ||
862 | adapter->fw = NULL; | 939 | adapter->fw = NULL; |
863 | goto done; | 940 | goto done; |
864 | } | 941 | } |
865 | 942 | ||
866 | done: | 943 | done: |
867 | if (adapter->fw) | 944 | adapter->fw_type = fw_type; |
868 | dev_info(&pdev->dev, "loading firmware from file %s\n", | ||
869 | fw_name[fw_type]); | ||
870 | else | ||
871 | dev_info(&pdev->dev, "loading firmware from flash\n"); | ||
872 | } | 945 | } |
873 | 946 | ||
874 | 947 | ||
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c index 2919a2d12bf4..27539ddf94c4 100644 --- a/drivers/net/netxen/netxen_nic_main.c +++ b/drivers/net/netxen/netxen_nic_main.c | |||
@@ -718,6 +718,10 @@ netxen_start_firmware(struct netxen_adapter *adapter, int request_fw) | |||
718 | if (request_fw) | 718 | if (request_fw) |
719 | netxen_request_firmware(adapter); | 719 | netxen_request_firmware(adapter); |
720 | 720 | ||
721 | err = netxen_need_fw_reset(adapter); | ||
722 | if (err <= 0) | ||
723 | return err; | ||
724 | |||
721 | if (first_boot != 0x55555555) { | 725 | if (first_boot != 0x55555555) { |
722 | NXWR32(adapter, CRB_CMDPEG_STATE, 0); | 726 | NXWR32(adapter, CRB_CMDPEG_STATE, 0); |
723 | netxen_pinit_from_rom(adapter, 0); | 727 | netxen_pinit_from_rom(adapter, 0); |
diff --git a/drivers/net/pci-skeleton.c b/drivers/net/pci-skeleton.c index 8c1f6988f398..89f7b2ad5231 100644 --- a/drivers/net/pci-skeleton.c +++ b/drivers/net/pci-skeleton.c | |||
@@ -105,7 +105,7 @@ IVc. Errata | |||
105 | 105 | ||
106 | static char version[] __devinitdata = | 106 | static char version[] __devinitdata = |
107 | KERN_INFO NETDRV_DRIVER_LOAD_MSG "\n" | 107 | KERN_INFO NETDRV_DRIVER_LOAD_MSG "\n" |
108 | KERN_INFO " Support available from http://foo.com/bar/baz.html\n"; | 108 | " Support available from http://foo.com/bar/baz.html\n"; |
109 | 109 | ||
110 | /* define to 1 to enable PIO instead of MMIO */ | 110 | /* define to 1 to enable PIO instead of MMIO */ |
111 | #undef USE_IO_OPS | 111 | #undef USE_IO_OPS |
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c index f51944b28cfa..06618af1a468 100644 --- a/drivers/net/pcmcia/ibmtr_cs.c +++ b/drivers/net/pcmcia/ibmtr_cs.c | |||
@@ -298,14 +298,11 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) | |||
298 | 298 | ||
299 | strcpy(info->node.dev_name, dev->name); | 299 | strcpy(info->node.dev_name, dev->name); |
300 | 300 | ||
301 | printk(KERN_INFO "%s: port %#3lx, irq %d,", | 301 | printk(KERN_INFO |
302 | dev->name, dev->base_addr, dev->irq); | 302 | "%s: port %#3lx, irq %d, mmio %#5lx, sram %#5lx, hwaddr=%pM\n", |
303 | printk (" mmio %#5lx,", (u_long)ti->mmio); | 303 | dev->name, dev->base_addr, dev->irq, |
304 | printk (" sram %#5lx,", (u_long)ti->sram_base << 12); | 304 | (u_long)ti->mmio, (u_long)(ti->sram_base << 12), |
305 | printk ("\n" KERN_INFO " hwaddr="); | 305 | dev->dev_addr); |
306 | for (i = 0; i < TR_ALEN; i++) | ||
307 | printk("%02X", dev->dev_addr[i]); | ||
308 | printk("\n"); | ||
309 | return 0; | 306 | return 0; |
310 | 307 | ||
311 | cs_failed: | 308 | cs_failed: |
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c index 02ef63ed1f99..36de91baf238 100644 --- a/drivers/net/pcmcia/nmclan_cs.c +++ b/drivers/net/pcmcia/nmclan_cs.c | |||
@@ -1425,15 +1425,12 @@ static void BuildLAF(int *ladrf, int *adr) | |||
1425 | ladrf[byte] |= (1 << (hashcode & 7)); | 1425 | ladrf[byte] |= (1 << (hashcode & 7)); |
1426 | 1426 | ||
1427 | #ifdef PCMCIA_DEBUG | 1427 | #ifdef PCMCIA_DEBUG |
1428 | if (pc_debug > 2) { | 1428 | if (pc_debug > 2) |
1429 | printk(KERN_DEBUG " adr ="); | 1429 | printk(KERN_DEBUG " adr =%pM\n", adr); |
1430 | for (i = 0; i < 6; i++) | 1430 | printk(KERN_DEBUG " hashcode = %d(decimal), ladrf[0:63] =", hashcode); |
1431 | printk(" %02X", adr[i]); | 1431 | for (i = 0; i < 8; i++) |
1432 | printk("\n" KERN_DEBUG " hashcode = %d(decimal), ladrf[0:63]" | 1432 | printk(KERN_CONT " %02X", ladrf[i]); |
1433 | " =", hashcode); | 1433 | printk(KERN_CONT "\n"); |
1434 | for (i = 0; i < 8; i++) | ||
1435 | printk(" %02X", ladrf[i]); | ||
1436 | printk("\n"); | ||
1437 | } | 1434 | } |
1438 | #endif | 1435 | #endif |
1439 | } /* BuildLAF */ | 1436 | } /* BuildLAF */ |
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index 652a36888361..9ef1c1bfa83d 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c | |||
@@ -1727,6 +1727,7 @@ static struct pcmcia_device_id pcnet_ids[] = { | |||
1727 | PCMCIA_DEVICE_PROD_ID12("PRETEC", "Ethernet CompactLAN 10BaseT 3.3V", 0xebf91155, 0x7f5a4f50), | 1727 | PCMCIA_DEVICE_PROD_ID12("PRETEC", "Ethernet CompactLAN 10BaseT 3.3V", 0xebf91155, 0x7f5a4f50), |
1728 | PCMCIA_DEVICE_PROD_ID12("Psion Dacom", "Gold Card Ethernet", 0xf5f025c2, 0x3a30e110), | 1728 | PCMCIA_DEVICE_PROD_ID12("Psion Dacom", "Gold Card Ethernet", 0xf5f025c2, 0x3a30e110), |
1729 | PCMCIA_DEVICE_PROD_ID12("=RELIA==", "Ethernet", 0xcdd0644a, 0x00b2e941), | 1729 | PCMCIA_DEVICE_PROD_ID12("=RELIA==", "Ethernet", 0xcdd0644a, 0x00b2e941), |
1730 | PCMCIA_DEVICE_PROD_ID12("RIOS Systems Co.", "PC CARD3 ETHERNET", 0x7dd33481, 0x10b41826), | ||
1730 | PCMCIA_DEVICE_PROD_ID12("RP", "1625B Ethernet NE2000 Compatible", 0xe3e66e22, 0xb96150df), | 1731 | PCMCIA_DEVICE_PROD_ID12("RP", "1625B Ethernet NE2000 Compatible", 0xe3e66e22, 0xb96150df), |
1731 | PCMCIA_DEVICE_PROD_ID12("RPTI", "EP400 Ethernet NE2000 Compatible", 0xdc6f88fd, 0x4a7e2ae0), | 1732 | PCMCIA_DEVICE_PROD_ID12("RPTI", "EP400 Ethernet NE2000 Compatible", 0xdc6f88fd, 0x4a7e2ae0), |
1732 | PCMCIA_DEVICE_PROD_ID12("RPTI", "EP401 Ethernet NE2000 Compatible", 0xdc6f88fd, 0x4bcbd7fd), | 1733 | PCMCIA_DEVICE_PROD_ID12("RPTI", "EP401 Ethernet NE2000 Compatible", 0xdc6f88fd, 0x4bcbd7fd), |
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c index 1c35e1d637a0..28368157dac4 100644 --- a/drivers/net/pcnet32.c +++ b/drivers/net/pcnet32.c | |||
@@ -485,7 +485,7 @@ static void pcnet32_realloc_tx_ring(struct net_device *dev, | |||
485 | &new_ring_dma_addr); | 485 | &new_ring_dma_addr); |
486 | if (new_tx_ring == NULL) { | 486 | if (new_tx_ring == NULL) { |
487 | if (netif_msg_drv(lp)) | 487 | if (netif_msg_drv(lp)) |
488 | printk("\n" KERN_ERR | 488 | printk(KERN_ERR |
489 | "%s: Consistent memory allocation failed.\n", | 489 | "%s: Consistent memory allocation failed.\n", |
490 | dev->name); | 490 | dev->name); |
491 | return; | 491 | return; |
@@ -496,7 +496,7 @@ static void pcnet32_realloc_tx_ring(struct net_device *dev, | |||
496 | GFP_ATOMIC); | 496 | GFP_ATOMIC); |
497 | if (!new_dma_addr_list) { | 497 | if (!new_dma_addr_list) { |
498 | if (netif_msg_drv(lp)) | 498 | if (netif_msg_drv(lp)) |
499 | printk("\n" KERN_ERR | 499 | printk(KERN_ERR |
500 | "%s: Memory allocation failed.\n", dev->name); | 500 | "%s: Memory allocation failed.\n", dev->name); |
501 | goto free_new_tx_ring; | 501 | goto free_new_tx_ring; |
502 | } | 502 | } |
@@ -505,7 +505,7 @@ static void pcnet32_realloc_tx_ring(struct net_device *dev, | |||
505 | GFP_ATOMIC); | 505 | GFP_ATOMIC); |
506 | if (!new_skb_list) { | 506 | if (!new_skb_list) { |
507 | if (netif_msg_drv(lp)) | 507 | if (netif_msg_drv(lp)) |
508 | printk("\n" KERN_ERR | 508 | printk(KERN_ERR |
509 | "%s: Memory allocation failed.\n", dev->name); | 509 | "%s: Memory allocation failed.\n", dev->name); |
510 | goto free_new_lists; | 510 | goto free_new_lists; |
511 | } | 511 | } |
@@ -563,7 +563,7 @@ static void pcnet32_realloc_rx_ring(struct net_device *dev, | |||
563 | &new_ring_dma_addr); | 563 | &new_ring_dma_addr); |
564 | if (new_rx_ring == NULL) { | 564 | if (new_rx_ring == NULL) { |
565 | if (netif_msg_drv(lp)) | 565 | if (netif_msg_drv(lp)) |
566 | printk("\n" KERN_ERR | 566 | printk(KERN_ERR |
567 | "%s: Consistent memory allocation failed.\n", | 567 | "%s: Consistent memory allocation failed.\n", |
568 | dev->name); | 568 | dev->name); |
569 | return; | 569 | return; |
@@ -574,7 +574,7 @@ static void pcnet32_realloc_rx_ring(struct net_device *dev, | |||
574 | GFP_ATOMIC); | 574 | GFP_ATOMIC); |
575 | if (!new_dma_addr_list) { | 575 | if (!new_dma_addr_list) { |
576 | if (netif_msg_drv(lp)) | 576 | if (netif_msg_drv(lp)) |
577 | printk("\n" KERN_ERR | 577 | printk(KERN_ERR |
578 | "%s: Memory allocation failed.\n", dev->name); | 578 | "%s: Memory allocation failed.\n", dev->name); |
579 | goto free_new_rx_ring; | 579 | goto free_new_rx_ring; |
580 | } | 580 | } |
@@ -583,7 +583,7 @@ static void pcnet32_realloc_rx_ring(struct net_device *dev, | |||
583 | GFP_ATOMIC); | 583 | GFP_ATOMIC); |
584 | if (!new_skb_list) { | 584 | if (!new_skb_list) { |
585 | if (netif_msg_drv(lp)) | 585 | if (netif_msg_drv(lp)) |
586 | printk("\n" KERN_ERR | 586 | printk(KERN_ERR |
587 | "%s: Memory allocation failed.\n", dev->name); | 587 | "%s: Memory allocation failed.\n", dev->name); |
588 | goto free_new_lists; | 588 | goto free_new_lists; |
589 | } | 589 | } |
@@ -1766,38 +1766,38 @@ pcnet32_probe1(unsigned long ioaddr, int shared, struct pci_dev *pdev) | |||
1766 | /* Version 0x2623 and 0x2624 */ | 1766 | /* Version 0x2623 and 0x2624 */ |
1767 | if (((chip_version + 1) & 0xfffe) == 0x2624) { | 1767 | if (((chip_version + 1) & 0xfffe) == 0x2624) { |
1768 | i = a->read_csr(ioaddr, 80) & 0x0C00; /* Check tx_start_pt */ | 1768 | i = a->read_csr(ioaddr, 80) & 0x0C00; /* Check tx_start_pt */ |
1769 | printk("\n" KERN_INFO " tx_start_pt(0x%04x):", i); | 1769 | printk(KERN_INFO " tx_start_pt(0x%04x):", i); |
1770 | switch (i >> 10) { | 1770 | switch (i >> 10) { |
1771 | case 0: | 1771 | case 0: |
1772 | printk(" 20 bytes,"); | 1772 | printk(KERN_CONT " 20 bytes,"); |
1773 | break; | 1773 | break; |
1774 | case 1: | 1774 | case 1: |
1775 | printk(" 64 bytes,"); | 1775 | printk(KERN_CONT " 64 bytes,"); |
1776 | break; | 1776 | break; |
1777 | case 2: | 1777 | case 2: |
1778 | printk(" 128 bytes,"); | 1778 | printk(KERN_CONT " 128 bytes,"); |
1779 | break; | 1779 | break; |
1780 | case 3: | 1780 | case 3: |
1781 | printk("~220 bytes,"); | 1781 | printk(KERN_CONT "~220 bytes,"); |
1782 | break; | 1782 | break; |
1783 | } | 1783 | } |
1784 | i = a->read_bcr(ioaddr, 18); /* Check Burst/Bus control */ | 1784 | i = a->read_bcr(ioaddr, 18); /* Check Burst/Bus control */ |
1785 | printk(" BCR18(%x):", i & 0xffff); | 1785 | printk(KERN_CONT " BCR18(%x):", i & 0xffff); |
1786 | if (i & (1 << 5)) | 1786 | if (i & (1 << 5)) |
1787 | printk("BurstWrEn "); | 1787 | printk(KERN_CONT "BurstWrEn "); |
1788 | if (i & (1 << 6)) | 1788 | if (i & (1 << 6)) |
1789 | printk("BurstRdEn "); | 1789 | printk(KERN_CONT "BurstRdEn "); |
1790 | if (i & (1 << 7)) | 1790 | if (i & (1 << 7)) |
1791 | printk("DWordIO "); | 1791 | printk(KERN_CONT "DWordIO "); |
1792 | if (i & (1 << 11)) | 1792 | if (i & (1 << 11)) |
1793 | printk("NoUFlow "); | 1793 | printk(KERN_CONT "NoUFlow "); |
1794 | i = a->read_bcr(ioaddr, 25); | 1794 | i = a->read_bcr(ioaddr, 25); |
1795 | printk("\n" KERN_INFO " SRAMSIZE=0x%04x,", i << 8); | 1795 | printk(KERN_INFO " SRAMSIZE=0x%04x,", i << 8); |
1796 | i = a->read_bcr(ioaddr, 26); | 1796 | i = a->read_bcr(ioaddr, 26); |
1797 | printk(" SRAM_BND=0x%04x,", i << 8); | 1797 | printk(KERN_CONT " SRAM_BND=0x%04x,", i << 8); |
1798 | i = a->read_bcr(ioaddr, 27); | 1798 | i = a->read_bcr(ioaddr, 27); |
1799 | if (i & (1 << 14)) | 1799 | if (i & (1 << 14)) |
1800 | printk("LowLatRx"); | 1800 | printk(KERN_CONT "LowLatRx"); |
1801 | } | 1801 | } |
1802 | } | 1802 | } |
1803 | 1803 | ||
@@ -1996,7 +1996,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name) | |||
1996 | &lp->tx_ring_dma_addr); | 1996 | &lp->tx_ring_dma_addr); |
1997 | if (lp->tx_ring == NULL) { | 1997 | if (lp->tx_ring == NULL) { |
1998 | if (netif_msg_drv(lp)) | 1998 | if (netif_msg_drv(lp)) |
1999 | printk("\n" KERN_ERR PFX | 1999 | printk(KERN_ERR PFX |
2000 | "%s: Consistent memory allocation failed.\n", | 2000 | "%s: Consistent memory allocation failed.\n", |
2001 | name); | 2001 | name); |
2002 | return -ENOMEM; | 2002 | return -ENOMEM; |
@@ -2008,7 +2008,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name) | |||
2008 | &lp->rx_ring_dma_addr); | 2008 | &lp->rx_ring_dma_addr); |
2009 | if (lp->rx_ring == NULL) { | 2009 | if (lp->rx_ring == NULL) { |
2010 | if (netif_msg_drv(lp)) | 2010 | if (netif_msg_drv(lp)) |
2011 | printk("\n" KERN_ERR PFX | 2011 | printk(KERN_ERR PFX |
2012 | "%s: Consistent memory allocation failed.\n", | 2012 | "%s: Consistent memory allocation failed.\n", |
2013 | name); | 2013 | name); |
2014 | return -ENOMEM; | 2014 | return -ENOMEM; |
@@ -2018,7 +2018,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name) | |||
2018 | GFP_ATOMIC); | 2018 | GFP_ATOMIC); |
2019 | if (!lp->tx_dma_addr) { | 2019 | if (!lp->tx_dma_addr) { |
2020 | if (netif_msg_drv(lp)) | 2020 | if (netif_msg_drv(lp)) |
2021 | printk("\n" KERN_ERR PFX | 2021 | printk(KERN_ERR PFX |
2022 | "%s: Memory allocation failed.\n", name); | 2022 | "%s: Memory allocation failed.\n", name); |
2023 | return -ENOMEM; | 2023 | return -ENOMEM; |
2024 | } | 2024 | } |
@@ -2027,7 +2027,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name) | |||
2027 | GFP_ATOMIC); | 2027 | GFP_ATOMIC); |
2028 | if (!lp->rx_dma_addr) { | 2028 | if (!lp->rx_dma_addr) { |
2029 | if (netif_msg_drv(lp)) | 2029 | if (netif_msg_drv(lp)) |
2030 | printk("\n" KERN_ERR PFX | 2030 | printk(KERN_ERR PFX |
2031 | "%s: Memory allocation failed.\n", name); | 2031 | "%s: Memory allocation failed.\n", name); |
2032 | return -ENOMEM; | 2032 | return -ENOMEM; |
2033 | } | 2033 | } |
@@ -2036,7 +2036,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name) | |||
2036 | GFP_ATOMIC); | 2036 | GFP_ATOMIC); |
2037 | if (!lp->tx_skbuff) { | 2037 | if (!lp->tx_skbuff) { |
2038 | if (netif_msg_drv(lp)) | 2038 | if (netif_msg_drv(lp)) |
2039 | printk("\n" KERN_ERR PFX | 2039 | printk(KERN_ERR PFX |
2040 | "%s: Memory allocation failed.\n", name); | 2040 | "%s: Memory allocation failed.\n", name); |
2041 | return -ENOMEM; | 2041 | return -ENOMEM; |
2042 | } | 2042 | } |
@@ -2045,7 +2045,7 @@ static int pcnet32_alloc_ring(struct net_device *dev, const char *name) | |||
2045 | GFP_ATOMIC); | 2045 | GFP_ATOMIC); |
2046 | if (!lp->rx_skbuff) { | 2046 | if (!lp->rx_skbuff) { |
2047 | if (netif_msg_drv(lp)) | 2047 | if (netif_msg_drv(lp)) |
2048 | printk("\n" KERN_ERR PFX | 2048 | printk(KERN_ERR PFX |
2049 | "%s: Memory allocation failed.\n", name); | 2049 | "%s: Memory allocation failed.\n", name); |
2050 | return -ENOMEM; | 2050 | return -ENOMEM; |
2051 | } | 2051 | } |
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 61755cbd978e..eda94fcd4065 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -928,13 +928,32 @@ static void phy_state_machine(struct work_struct *work) | |||
928 | * Otherwise, it's 0, and we're | 928 | * Otherwise, it's 0, and we're |
929 | * still waiting for AN */ | 929 | * still waiting for AN */ |
930 | if (err > 0) { | 930 | if (err > 0) { |
931 | phydev->state = PHY_RUNNING; | 931 | err = phy_read_status(phydev); |
932 | if (err) | ||
933 | break; | ||
934 | |||
935 | if (phydev->link) { | ||
936 | phydev->state = PHY_RUNNING; | ||
937 | netif_carrier_on(phydev->attached_dev); | ||
938 | } else | ||
939 | phydev->state = PHY_NOLINK; | ||
940 | phydev->adjust_link(phydev->attached_dev); | ||
932 | } else { | 941 | } else { |
933 | phydev->state = PHY_AN; | 942 | phydev->state = PHY_AN; |
934 | phydev->link_timeout = PHY_AN_TIMEOUT; | 943 | phydev->link_timeout = PHY_AN_TIMEOUT; |
935 | } | 944 | } |
936 | } else | 945 | } else { |
937 | phydev->state = PHY_RUNNING; | 946 | err = phy_read_status(phydev); |
947 | if (err) | ||
948 | break; | ||
949 | |||
950 | if (phydev->link) { | ||
951 | phydev->state = PHY_RUNNING; | ||
952 | netif_carrier_on(phydev->attached_dev); | ||
953 | } else | ||
954 | phydev->state = PHY_NOLINK; | ||
955 | phydev->adjust_link(phydev->attached_dev); | ||
956 | } | ||
938 | break; | 957 | break; |
939 | } | 958 | } |
940 | 959 | ||
diff --git a/drivers/net/qlge/qlge.h b/drivers/net/qlge/qlge.h index 156e02e8905d..6ed5317ab1c0 100644 --- a/drivers/net/qlge/qlge.h +++ b/drivers/net/qlge/qlge.h | |||
@@ -1607,6 +1607,8 @@ int ql_mb_get_fw_state(struct ql_adapter *qdev); | |||
1607 | int ql_cam_route_initialize(struct ql_adapter *qdev); | 1607 | int ql_cam_route_initialize(struct ql_adapter *qdev); |
1608 | int ql_read_mpi_reg(struct ql_adapter *qdev, u32 reg, u32 *data); | 1608 | int ql_read_mpi_reg(struct ql_adapter *qdev, u32 reg, u32 *data); |
1609 | int ql_mb_about_fw(struct ql_adapter *qdev); | 1609 | int ql_mb_about_fw(struct ql_adapter *qdev); |
1610 | void ql_link_on(struct ql_adapter *qdev); | ||
1611 | void ql_link_off(struct ql_adapter *qdev); | ||
1610 | 1612 | ||
1611 | #if 1 | 1613 | #if 1 |
1612 | #define QL_ALL_DUMP | 1614 | #define QL_ALL_DUMP |
diff --git a/drivers/net/qlge/qlge_ethtool.c b/drivers/net/qlge/qlge_ethtool.c index 37c99fe79770..eb6a9ee640ed 100644 --- a/drivers/net/qlge/qlge_ethtool.c +++ b/drivers/net/qlge/qlge_ethtool.c | |||
@@ -59,7 +59,7 @@ static int ql_update_ring_coalescing(struct ql_adapter *qdev) | |||
59 | cqicb->pkt_delay = | 59 | cqicb->pkt_delay = |
60 | cpu_to_le16(qdev->tx_max_coalesced_frames); | 60 | cpu_to_le16(qdev->tx_max_coalesced_frames); |
61 | cqicb->flags = FLAGS_LI; | 61 | cqicb->flags = FLAGS_LI; |
62 | status = ql_write_cfg(qdev, cqicb, sizeof(cqicb), | 62 | status = ql_write_cfg(qdev, cqicb, sizeof(*cqicb), |
63 | CFG_LCQ, rx_ring->cq_id); | 63 | CFG_LCQ, rx_ring->cq_id); |
64 | if (status) { | 64 | if (status) { |
65 | QPRINTK(qdev, IFUP, ERR, | 65 | QPRINTK(qdev, IFUP, ERR, |
@@ -82,7 +82,7 @@ static int ql_update_ring_coalescing(struct ql_adapter *qdev) | |||
82 | cqicb->pkt_delay = | 82 | cqicb->pkt_delay = |
83 | cpu_to_le16(qdev->rx_max_coalesced_frames); | 83 | cpu_to_le16(qdev->rx_max_coalesced_frames); |
84 | cqicb->flags = FLAGS_LI; | 84 | cqicb->flags = FLAGS_LI; |
85 | status = ql_write_cfg(qdev, cqicb, sizeof(cqicb), | 85 | status = ql_write_cfg(qdev, cqicb, sizeof(*cqicb), |
86 | CFG_LCQ, rx_ring->cq_id); | 86 | CFG_LCQ, rx_ring->cq_id); |
87 | if (status) { | 87 | if (status) { |
88 | QPRINTK(qdev, IFUP, ERR, | 88 | QPRINTK(qdev, IFUP, ERR, |
diff --git a/drivers/net/qlge/qlge_main.c b/drivers/net/qlge/qlge_main.c index 90d1f76c0e8b..5768af17f168 100644 --- a/drivers/net/qlge/qlge_main.c +++ b/drivers/net/qlge/qlge_main.c | |||
@@ -214,6 +214,10 @@ int ql_write_cfg(struct ql_adapter *qdev, void *ptr, int size, u32 bit, | |||
214 | return -ENOMEM; | 214 | return -ENOMEM; |
215 | } | 215 | } |
216 | 216 | ||
217 | status = ql_sem_spinlock(qdev, SEM_ICB_MASK); | ||
218 | if (status) | ||
219 | return status; | ||
220 | |||
217 | status = ql_wait_cfg(qdev, bit); | 221 | status = ql_wait_cfg(qdev, bit); |
218 | if (status) { | 222 | if (status) { |
219 | QPRINTK(qdev, IFUP, ERR, | 223 | QPRINTK(qdev, IFUP, ERR, |
@@ -221,12 +225,8 @@ int ql_write_cfg(struct ql_adapter *qdev, void *ptr, int size, u32 bit, | |||
221 | goto exit; | 225 | goto exit; |
222 | } | 226 | } |
223 | 227 | ||
224 | status = ql_sem_spinlock(qdev, SEM_ICB_MASK); | ||
225 | if (status) | ||
226 | goto exit; | ||
227 | ql_write32(qdev, ICB_L, (u32) map); | 228 | ql_write32(qdev, ICB_L, (u32) map); |
228 | ql_write32(qdev, ICB_H, (u32) (map >> 32)); | 229 | ql_write32(qdev, ICB_H, (u32) (map >> 32)); |
229 | ql_sem_unlock(qdev, SEM_ICB_MASK); /* does flush too */ | ||
230 | 230 | ||
231 | mask = CFG_Q_MASK | (bit << 16); | 231 | mask = CFG_Q_MASK | (bit << 16); |
232 | value = bit | (q_id << CFG_Q_SHIFT); | 232 | value = bit | (q_id << CFG_Q_SHIFT); |
@@ -237,6 +237,7 @@ int ql_write_cfg(struct ql_adapter *qdev, void *ptr, int size, u32 bit, | |||
237 | */ | 237 | */ |
238 | status = ql_wait_cfg(qdev, bit); | 238 | status = ql_wait_cfg(qdev, bit); |
239 | exit: | 239 | exit: |
240 | ql_sem_unlock(qdev, SEM_ICB_MASK); /* does flush too */ | ||
240 | pci_unmap_single(qdev->pdev, map, size, direction); | 241 | pci_unmap_single(qdev->pdev, map, size, direction); |
241 | return status; | 242 | return status; |
242 | } | 243 | } |
@@ -412,6 +413,57 @@ exit: | |||
412 | return status; | 413 | return status; |
413 | } | 414 | } |
414 | 415 | ||
416 | /* Set or clear MAC address in hardware. We sometimes | ||
417 | * have to clear it to prevent wrong frame routing | ||
418 | * especially in a bonding environment. | ||
419 | */ | ||
420 | static int ql_set_mac_addr(struct ql_adapter *qdev, int set) | ||
421 | { | ||
422 | int status; | ||
423 | char zero_mac_addr[ETH_ALEN]; | ||
424 | char *addr; | ||
425 | |||
426 | if (set) { | ||
427 | addr = &qdev->ndev->dev_addr[0]; | ||
428 | QPRINTK(qdev, IFUP, DEBUG, | ||
429 | "Set Mac addr %02x:%02x:%02x:%02x:%02x:%02x\n", | ||
430 | addr[0], addr[1], addr[2], addr[3], | ||
431 | addr[4], addr[5]); | ||
432 | } else { | ||
433 | memset(zero_mac_addr, 0, ETH_ALEN); | ||
434 | addr = &zero_mac_addr[0]; | ||
435 | QPRINTK(qdev, IFUP, DEBUG, | ||
436 | "Clearing MAC address on %s\n", | ||
437 | qdev->ndev->name); | ||
438 | } | ||
439 | status = ql_sem_spinlock(qdev, SEM_MAC_ADDR_MASK); | ||
440 | if (status) | ||
441 | return status; | ||
442 | status = ql_set_mac_addr_reg(qdev, (u8 *) addr, | ||
443 | MAC_ADDR_TYPE_CAM_MAC, qdev->func * MAX_CQ); | ||
444 | ql_sem_unlock(qdev, SEM_MAC_ADDR_MASK); | ||
445 | if (status) | ||
446 | QPRINTK(qdev, IFUP, ERR, "Failed to init mac " | ||
447 | "address.\n"); | ||
448 | return status; | ||
449 | } | ||
450 | |||
451 | void ql_link_on(struct ql_adapter *qdev) | ||
452 | { | ||
453 | QPRINTK(qdev, LINK, ERR, "%s: Link is up.\n", | ||
454 | qdev->ndev->name); | ||
455 | netif_carrier_on(qdev->ndev); | ||
456 | ql_set_mac_addr(qdev, 1); | ||
457 | } | ||
458 | |||
459 | void ql_link_off(struct ql_adapter *qdev) | ||
460 | { | ||
461 | QPRINTK(qdev, LINK, ERR, "%s: Link is down.\n", | ||
462 | qdev->ndev->name); | ||
463 | netif_carrier_off(qdev->ndev); | ||
464 | ql_set_mac_addr(qdev, 0); | ||
465 | } | ||
466 | |||
415 | /* Get a specific frame routing value from the CAM. | 467 | /* Get a specific frame routing value from the CAM. |
416 | * Used for debug and reg dump. | 468 | * Used for debug and reg dump. |
417 | */ | 469 | */ |
@@ -1628,7 +1680,7 @@ static void ql_process_mac_tx_intr(struct ql_adapter *qdev, | |||
1628 | tx_ring = &qdev->tx_ring[mac_rsp->txq_idx]; | 1680 | tx_ring = &qdev->tx_ring[mac_rsp->txq_idx]; |
1629 | tx_ring_desc = &tx_ring->q[mac_rsp->tid]; | 1681 | tx_ring_desc = &tx_ring->q[mac_rsp->tid]; |
1630 | ql_unmap_send(qdev, tx_ring_desc, tx_ring_desc->map_cnt); | 1682 | ql_unmap_send(qdev, tx_ring_desc, tx_ring_desc->map_cnt); |
1631 | qdev->stats.tx_bytes += tx_ring_desc->map_cnt; | 1683 | qdev->stats.tx_bytes += (tx_ring_desc->skb)->len; |
1632 | qdev->stats.tx_packets++; | 1684 | qdev->stats.tx_packets++; |
1633 | dev_kfree_skb(tx_ring_desc->skb); | 1685 | dev_kfree_skb(tx_ring_desc->skb); |
1634 | tx_ring_desc->skb = NULL; | 1686 | tx_ring_desc->skb = NULL; |
@@ -1660,13 +1712,13 @@ static void ql_process_mac_tx_intr(struct ql_adapter *qdev, | |||
1660 | /* Fire up a handler to reset the MPI processor. */ | 1712 | /* Fire up a handler to reset the MPI processor. */ |
1661 | void ql_queue_fw_error(struct ql_adapter *qdev) | 1713 | void ql_queue_fw_error(struct ql_adapter *qdev) |
1662 | { | 1714 | { |
1663 | netif_carrier_off(qdev->ndev); | 1715 | ql_link_off(qdev); |
1664 | queue_delayed_work(qdev->workqueue, &qdev->mpi_reset_work, 0); | 1716 | queue_delayed_work(qdev->workqueue, &qdev->mpi_reset_work, 0); |
1665 | } | 1717 | } |
1666 | 1718 | ||
1667 | void ql_queue_asic_error(struct ql_adapter *qdev) | 1719 | void ql_queue_asic_error(struct ql_adapter *qdev) |
1668 | { | 1720 | { |
1669 | netif_carrier_off(qdev->ndev); | 1721 | ql_link_off(qdev); |
1670 | ql_disable_interrupts(qdev); | 1722 | ql_disable_interrupts(qdev); |
1671 | /* Clear adapter up bit to signal the recovery | 1723 | /* Clear adapter up bit to signal the recovery |
1672 | * process that it shouldn't kill the reset worker | 1724 | * process that it shouldn't kill the reset worker |
@@ -2104,7 +2156,7 @@ static int qlge_send(struct sk_buff *skb, struct net_device *ndev) | |||
2104 | } | 2156 | } |
2105 | tx_ring_desc = &tx_ring->q[tx_ring->prod_idx]; | 2157 | tx_ring_desc = &tx_ring->q[tx_ring->prod_idx]; |
2106 | mac_iocb_ptr = tx_ring_desc->queue_entry; | 2158 | mac_iocb_ptr = tx_ring_desc->queue_entry; |
2107 | memset((void *)mac_iocb_ptr, 0, sizeof(mac_iocb_ptr)); | 2159 | memset((void *)mac_iocb_ptr, 0, sizeof(*mac_iocb_ptr)); |
2108 | 2160 | ||
2109 | mac_iocb_ptr->opcode = OPCODE_OB_MAC_IOCB; | 2161 | mac_iocb_ptr->opcode = OPCODE_OB_MAC_IOCB; |
2110 | mac_iocb_ptr->tid = tx_ring_desc->index; | 2162 | mac_iocb_ptr->tid = tx_ring_desc->index; |
@@ -2743,7 +2795,7 @@ static int ql_start_tx_ring(struct ql_adapter *qdev, struct tx_ring *tx_ring) | |||
2743 | 2795 | ||
2744 | ql_init_tx_ring(qdev, tx_ring); | 2796 | ql_init_tx_ring(qdev, tx_ring); |
2745 | 2797 | ||
2746 | err = ql_write_cfg(qdev, wqicb, sizeof(wqicb), CFG_LRQ, | 2798 | err = ql_write_cfg(qdev, wqicb, sizeof(*wqicb), CFG_LRQ, |
2747 | (u16) tx_ring->wq_id); | 2799 | (u16) tx_ring->wq_id); |
2748 | if (err) { | 2800 | if (err) { |
2749 | QPRINTK(qdev, IFUP, ERR, "Failed to load tx_ring.\n"); | 2801 | QPRINTK(qdev, IFUP, ERR, "Failed to load tx_ring.\n"); |
@@ -3008,7 +3060,7 @@ static int ql_start_rss(struct ql_adapter *qdev) | |||
3008 | int i; | 3060 | int i; |
3009 | u8 *hash_id = (u8 *) ricb->hash_cq_id; | 3061 | u8 *hash_id = (u8 *) ricb->hash_cq_id; |
3010 | 3062 | ||
3011 | memset((void *)ricb, 0, sizeof(ricb)); | 3063 | memset((void *)ricb, 0, sizeof(*ricb)); |
3012 | 3064 | ||
3013 | ricb->base_cq = qdev->rss_ring_first_cq_id | RSS_L4K; | 3065 | ricb->base_cq = qdev->rss_ring_first_cq_id | RSS_L4K; |
3014 | ricb->flags = | 3066 | ricb->flags = |
@@ -3030,7 +3082,7 @@ static int ql_start_rss(struct ql_adapter *qdev) | |||
3030 | 3082 | ||
3031 | QPRINTK(qdev, IFUP, DEBUG, "Initializing RSS.\n"); | 3083 | QPRINTK(qdev, IFUP, DEBUG, "Initializing RSS.\n"); |
3032 | 3084 | ||
3033 | status = ql_write_cfg(qdev, ricb, sizeof(ricb), CFG_LR, 0); | 3085 | status = ql_write_cfg(qdev, ricb, sizeof(*ricb), CFG_LR, 0); |
3034 | if (status) { | 3086 | if (status) { |
3035 | QPRINTK(qdev, IFUP, ERR, "Failed to load RICB.\n"); | 3087 | QPRINTK(qdev, IFUP, ERR, "Failed to load RICB.\n"); |
3036 | return status; | 3088 | return status; |
@@ -3039,25 +3091,40 @@ static int ql_start_rss(struct ql_adapter *qdev) | |||
3039 | return status; | 3091 | return status; |
3040 | } | 3092 | } |
3041 | 3093 | ||
3042 | /* Initialize the frame-to-queue routing. */ | 3094 | static int ql_clear_routing_entries(struct ql_adapter *qdev) |
3043 | static int ql_route_initialize(struct ql_adapter *qdev) | ||
3044 | { | 3095 | { |
3045 | int status = 0; | 3096 | int i, status = 0; |
3046 | int i; | ||
3047 | 3097 | ||
3048 | status = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK); | 3098 | status = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK); |
3049 | if (status) | 3099 | if (status) |
3050 | return status; | 3100 | return status; |
3051 | |||
3052 | /* Clear all the entries in the routing table. */ | 3101 | /* Clear all the entries in the routing table. */ |
3053 | for (i = 0; i < 16; i++) { | 3102 | for (i = 0; i < 16; i++) { |
3054 | status = ql_set_routing_reg(qdev, i, 0, 0); | 3103 | status = ql_set_routing_reg(qdev, i, 0, 0); |
3055 | if (status) { | 3104 | if (status) { |
3056 | QPRINTK(qdev, IFUP, ERR, | 3105 | QPRINTK(qdev, IFUP, ERR, |
3057 | "Failed to init routing register for CAM packets.\n"); | 3106 | "Failed to init routing register for CAM " |
3058 | goto exit; | 3107 | "packets.\n"); |
3108 | break; | ||
3059 | } | 3109 | } |
3060 | } | 3110 | } |
3111 | ql_sem_unlock(qdev, SEM_RT_IDX_MASK); | ||
3112 | return status; | ||
3113 | } | ||
3114 | |||
3115 | /* Initialize the frame-to-queue routing. */ | ||
3116 | static int ql_route_initialize(struct ql_adapter *qdev) | ||
3117 | { | ||
3118 | int status = 0; | ||
3119 | |||
3120 | status = ql_sem_spinlock(qdev, SEM_RT_IDX_MASK); | ||
3121 | if (status) | ||
3122 | return status; | ||
3123 | |||
3124 | /* Clear all the entries in the routing table. */ | ||
3125 | status = ql_clear_routing_entries(qdev); | ||
3126 | if (status) | ||
3127 | goto exit; | ||
3061 | 3128 | ||
3062 | status = ql_set_routing_reg(qdev, RT_IDX_ALL_ERR_SLOT, RT_IDX_ERR, 1); | 3129 | status = ql_set_routing_reg(qdev, RT_IDX_ALL_ERR_SLOT, RT_IDX_ERR, 1); |
3063 | if (status) { | 3130 | if (status) { |
@@ -3096,14 +3163,15 @@ exit: | |||
3096 | 3163 | ||
3097 | int ql_cam_route_initialize(struct ql_adapter *qdev) | 3164 | int ql_cam_route_initialize(struct ql_adapter *qdev) |
3098 | { | 3165 | { |
3099 | int status; | 3166 | int status, set; |
3100 | 3167 | ||
3101 | status = ql_sem_spinlock(qdev, SEM_MAC_ADDR_MASK); | 3168 | /* If check if the link is up and use to |
3102 | if (status) | 3169 | * determine if we are setting or clearing |
3103 | return status; | 3170 | * the MAC address in the CAM. |
3104 | status = ql_set_mac_addr_reg(qdev, (u8 *) qdev->ndev->perm_addr, | 3171 | */ |
3105 | MAC_ADDR_TYPE_CAM_MAC, qdev->func * MAX_CQ); | 3172 | set = ql_read32(qdev, STS); |
3106 | ql_sem_unlock(qdev, SEM_MAC_ADDR_MASK); | 3173 | set &= qdev->port_link_up; |
3174 | status = ql_set_mac_addr(qdev, set); | ||
3107 | if (status) { | 3175 | if (status) { |
3108 | QPRINTK(qdev, IFUP, ERR, "Failed to init mac address.\n"); | 3176 | QPRINTK(qdev, IFUP, ERR, "Failed to init mac address.\n"); |
3109 | return status; | 3177 | return status; |
@@ -3210,9 +3278,17 @@ static int ql_adapter_reset(struct ql_adapter *qdev) | |||
3210 | { | 3278 | { |
3211 | u32 value; | 3279 | u32 value; |
3212 | int status = 0; | 3280 | int status = 0; |
3213 | unsigned long end_jiffies = jiffies + | 3281 | unsigned long end_jiffies; |
3214 | max((unsigned long)1, usecs_to_jiffies(30)); | ||
3215 | 3282 | ||
3283 | /* Clear all the entries in the routing table. */ | ||
3284 | status = ql_clear_routing_entries(qdev); | ||
3285 | if (status) { | ||
3286 | QPRINTK(qdev, IFUP, ERR, "Failed to clear routing bits.\n"); | ||
3287 | return status; | ||
3288 | } | ||
3289 | |||
3290 | end_jiffies = jiffies + | ||
3291 | max((unsigned long)1, usecs_to_jiffies(30)); | ||
3216 | ql_write32(qdev, RST_FO, (RST_FO_FR << 16) | RST_FO_FR); | 3292 | ql_write32(qdev, RST_FO, (RST_FO_FR << 16) | RST_FO_FR); |
3217 | 3293 | ||
3218 | do { | 3294 | do { |
@@ -3252,7 +3328,7 @@ static int ql_adapter_down(struct ql_adapter *qdev) | |||
3252 | int i, status = 0; | 3328 | int i, status = 0; |
3253 | struct rx_ring *rx_ring; | 3329 | struct rx_ring *rx_ring; |
3254 | 3330 | ||
3255 | netif_carrier_off(qdev->ndev); | 3331 | ql_link_off(qdev); |
3256 | 3332 | ||
3257 | /* Don't kill the reset worker thread if we | 3333 | /* Don't kill the reset worker thread if we |
3258 | * are in the process of recovery. | 3334 | * are in the process of recovery. |
@@ -3319,8 +3395,12 @@ static int ql_adapter_up(struct ql_adapter *qdev) | |||
3319 | } | 3395 | } |
3320 | set_bit(QL_ADAPTER_UP, &qdev->flags); | 3396 | set_bit(QL_ADAPTER_UP, &qdev->flags); |
3321 | ql_alloc_rx_buffers(qdev); | 3397 | ql_alloc_rx_buffers(qdev); |
3322 | if ((ql_read32(qdev, STS) & qdev->port_init)) | 3398 | /* If the port is initialized and the |
3323 | netif_carrier_on(qdev->ndev); | 3399 | * link is up the turn on the carrier. |
3400 | */ | ||
3401 | if ((ql_read32(qdev, STS) & qdev->port_init) && | ||
3402 | (ql_read32(qdev, STS) & qdev->port_link_up)) | ||
3403 | ql_link_on(qdev); | ||
3324 | ql_enable_interrupts(qdev); | 3404 | ql_enable_interrupts(qdev); |
3325 | ql_enable_all_completion_interrupts(qdev); | 3405 | ql_enable_all_completion_interrupts(qdev); |
3326 | netif_tx_start_all_queues(qdev->ndev); | 3406 | netif_tx_start_all_queues(qdev->ndev); |
@@ -3346,11 +3426,6 @@ static int ql_get_adapter_resources(struct ql_adapter *qdev) | |||
3346 | return -ENOMEM; | 3426 | return -ENOMEM; |
3347 | } | 3427 | } |
3348 | status = ql_request_irq(qdev); | 3428 | status = ql_request_irq(qdev); |
3349 | if (status) | ||
3350 | goto err_irq; | ||
3351 | return status; | ||
3352 | err_irq: | ||
3353 | ql_free_mem_resources(qdev); | ||
3354 | return status; | 3429 | return status; |
3355 | } | 3430 | } |
3356 | 3431 | ||
@@ -3414,7 +3489,7 @@ static int ql_configure_rings(struct ql_adapter *qdev) | |||
3414 | 3489 | ||
3415 | for (i = 0; i < qdev->tx_ring_count; i++) { | 3490 | for (i = 0; i < qdev->tx_ring_count; i++) { |
3416 | tx_ring = &qdev->tx_ring[i]; | 3491 | tx_ring = &qdev->tx_ring[i]; |
3417 | memset((void *)tx_ring, 0, sizeof(tx_ring)); | 3492 | memset((void *)tx_ring, 0, sizeof(*tx_ring)); |
3418 | tx_ring->qdev = qdev; | 3493 | tx_ring->qdev = qdev; |
3419 | tx_ring->wq_id = i; | 3494 | tx_ring->wq_id = i; |
3420 | tx_ring->wq_len = qdev->tx_ring_size; | 3495 | tx_ring->wq_len = qdev->tx_ring_size; |
@@ -3430,7 +3505,7 @@ static int ql_configure_rings(struct ql_adapter *qdev) | |||
3430 | 3505 | ||
3431 | for (i = 0; i < qdev->rx_ring_count; i++) { | 3506 | for (i = 0; i < qdev->rx_ring_count; i++) { |
3432 | rx_ring = &qdev->rx_ring[i]; | 3507 | rx_ring = &qdev->rx_ring[i]; |
3433 | memset((void *)rx_ring, 0, sizeof(rx_ring)); | 3508 | memset((void *)rx_ring, 0, sizeof(*rx_ring)); |
3434 | rx_ring->qdev = qdev; | 3509 | rx_ring->qdev = qdev; |
3435 | rx_ring->cq_id = i; | 3510 | rx_ring->cq_id = i; |
3436 | rx_ring->cpu = i % cpu_cnt; /* CPU to run handler on. */ | 3511 | rx_ring->cpu = i % cpu_cnt; /* CPU to run handler on. */ |
@@ -3789,7 +3864,7 @@ static int __devinit ql_init_device(struct pci_dev *pdev, | |||
3789 | int pos, err = 0; | 3864 | int pos, err = 0; |
3790 | u16 val16; | 3865 | u16 val16; |
3791 | 3866 | ||
3792 | memset((void *)qdev, 0, sizeof(qdev)); | 3867 | memset((void *)qdev, 0, sizeof(*qdev)); |
3793 | err = pci_enable_device(pdev); | 3868 | err = pci_enable_device(pdev); |
3794 | if (err) { | 3869 | if (err) { |
3795 | dev_err(&pdev->dev, "PCI device enable failed.\n"); | 3870 | dev_err(&pdev->dev, "PCI device enable failed.\n"); |
@@ -3976,7 +4051,7 @@ static int __devinit qlge_probe(struct pci_dev *pdev, | |||
3976 | pci_disable_device(pdev); | 4051 | pci_disable_device(pdev); |
3977 | return err; | 4052 | return err; |
3978 | } | 4053 | } |
3979 | netif_carrier_off(ndev); | 4054 | ql_link_off(qdev); |
3980 | ql_display_dev_info(ndev); | 4055 | ql_display_dev_info(ndev); |
3981 | cards_found++; | 4056 | cards_found++; |
3982 | return 0; | 4057 | return 0; |
diff --git a/drivers/net/qlge/qlge_mpi.c b/drivers/net/qlge/qlge_mpi.c index 71afbf8b9c50..6685bd97da91 100644 --- a/drivers/net/qlge/qlge_mpi.c +++ b/drivers/net/qlge/qlge_mpi.c | |||
@@ -238,7 +238,7 @@ static void ql_link_up(struct ql_adapter *qdev, struct mbox_params *mbcp) | |||
238 | &qdev->mpi_port_cfg_work, 0); | 238 | &qdev->mpi_port_cfg_work, 0); |
239 | } | 239 | } |
240 | 240 | ||
241 | netif_carrier_on(qdev->ndev); | 241 | ql_link_on(qdev); |
242 | } | 242 | } |
243 | 243 | ||
244 | static void ql_link_down(struct ql_adapter *qdev, struct mbox_params *mbcp) | 244 | static void ql_link_down(struct ql_adapter *qdev, struct mbox_params *mbcp) |
@@ -251,7 +251,7 @@ static void ql_link_down(struct ql_adapter *qdev, struct mbox_params *mbcp) | |||
251 | if (status) | 251 | if (status) |
252 | QPRINTK(qdev, DRV, ERR, "Link down AEN broken!\n"); | 252 | QPRINTK(qdev, DRV, ERR, "Link down AEN broken!\n"); |
253 | 253 | ||
254 | netif_carrier_off(qdev->ndev); | 254 | ql_link_off(qdev); |
255 | } | 255 | } |
256 | 256 | ||
257 | static int ql_sfp_in(struct ql_adapter *qdev, struct mbox_params *mbcp) | 257 | static int ql_sfp_in(struct ql_adapter *qdev, struct mbox_params *mbcp) |
@@ -849,7 +849,7 @@ void ql_mpi_idc_work(struct work_struct *work) | |||
849 | case MB_CMD_PORT_RESET: | 849 | case MB_CMD_PORT_RESET: |
850 | case MB_CMD_SET_PORT_CFG: | 850 | case MB_CMD_SET_PORT_CFG: |
851 | case MB_CMD_STOP_FW: | 851 | case MB_CMD_STOP_FW: |
852 | netif_carrier_off(qdev->ndev); | 852 | ql_link_off(qdev); |
853 | /* Signal the resulting link up AEN | 853 | /* Signal the resulting link up AEN |
854 | * that the frame routing and mac addr | 854 | * that the frame routing and mac addr |
855 | * needs to be set. | 855 | * needs to be set. |
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c index ed63d23a6452..961b5397a531 100644 --- a/drivers/net/r6040.c +++ b/drivers/net/r6040.c | |||
@@ -49,8 +49,8 @@ | |||
49 | #include <asm/processor.h> | 49 | #include <asm/processor.h> |
50 | 50 | ||
51 | #define DRV_NAME "r6040" | 51 | #define DRV_NAME "r6040" |
52 | #define DRV_VERSION "0.23" | 52 | #define DRV_VERSION "0.24" |
53 | #define DRV_RELDATE "05May2009" | 53 | #define DRV_RELDATE "08Jul2009" |
54 | 54 | ||
55 | /* PHY CHIP Address */ | 55 | /* PHY CHIP Address */ |
56 | #define PHY1_ADDR 1 /* For MAC1 */ | 56 | #define PHY1_ADDR 1 /* For MAC1 */ |
@@ -704,8 +704,11 @@ static irqreturn_t r6040_interrupt(int irq, void *dev_id) | |||
704 | /* Read MISR status and clear */ | 704 | /* Read MISR status and clear */ |
705 | status = ioread16(ioaddr + MISR); | 705 | status = ioread16(ioaddr + MISR); |
706 | 706 | ||
707 | if (status == 0x0000 || status == 0xffff) | 707 | if (status == 0x0000 || status == 0xffff) { |
708 | /* Restore RDC MAC interrupt */ | ||
709 | iowrite16(misr, ioaddr + MIER); | ||
708 | return IRQ_NONE; | 710 | return IRQ_NONE; |
711 | } | ||
709 | 712 | ||
710 | /* RX interrupt request */ | 713 | /* RX interrupt request */ |
711 | if (status & RX_INTS) { | 714 | if (status & RX_INTS) { |
diff --git a/drivers/net/smsc911x.c b/drivers/net/smsc911x.c index b60639bd181b..66067f9d91c0 100644 --- a/drivers/net/smsc911x.c +++ b/drivers/net/smsc911x.c | |||
@@ -1938,7 +1938,7 @@ static int __devexit smsc911x_drv_remove(struct platform_device *pdev) | |||
1938 | if (!res) | 1938 | if (!res) |
1939 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 1939 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
1940 | 1940 | ||
1941 | release_mem_region(res->start, res->end - res->start); | 1941 | release_mem_region(res->start, resource_size(res)); |
1942 | 1942 | ||
1943 | iounmap(pdata->ioaddr); | 1943 | iounmap(pdata->ioaddr); |
1944 | 1944 | ||
@@ -1976,7 +1976,7 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev) | |||
1976 | retval = -ENODEV; | 1976 | retval = -ENODEV; |
1977 | goto out_0; | 1977 | goto out_0; |
1978 | } | 1978 | } |
1979 | res_size = res->end - res->start + 1; | 1979 | res_size = resource_size(res); |
1980 | 1980 | ||
1981 | irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 1981 | irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
1982 | if (!irq_res) { | 1982 | if (!irq_res) { |
@@ -2104,7 +2104,7 @@ out_unmap_io_3: | |||
2104 | out_free_netdev_2: | 2104 | out_free_netdev_2: |
2105 | free_netdev(dev); | 2105 | free_netdev(dev); |
2106 | out_release_io_1: | 2106 | out_release_io_1: |
2107 | release_mem_region(res->start, res->end - res->start); | 2107 | release_mem_region(res->start, resource_size(res)); |
2108 | out_0: | 2108 | out_0: |
2109 | return retval; | 2109 | return retval; |
2110 | } | 2110 | } |
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c index 838cce8b8fff..669253c7bd41 100644 --- a/drivers/net/starfire.c +++ b/drivers/net/starfire.c | |||
@@ -180,7 +180,7 @@ static int full_duplex[MAX_UNITS] = {0, }; | |||
180 | /* These identify the driver base version and may not be removed. */ | 180 | /* These identify the driver base version and may not be removed. */ |
181 | static const char version[] __devinitconst = | 181 | static const char version[] __devinitconst = |
182 | KERN_INFO "starfire.c:v1.03 7/26/2000 Written by Donald Becker <becker@scyld.com>\n" | 182 | KERN_INFO "starfire.c:v1.03 7/26/2000 Written by Donald Becker <becker@scyld.com>\n" |
183 | KERN_INFO " (unofficial 2.2/2.4 kernel port, version " DRV_VERSION ", " DRV_RELDATE ")\n"; | 183 | " (unofficial 2.2/2.4 kernel port, version " DRV_VERSION ", " DRV_RELDATE ")\n"; |
184 | 184 | ||
185 | MODULE_AUTHOR("Donald Becker <becker@scyld.com>"); | 185 | MODULE_AUTHOR("Donald Becker <becker@scyld.com>"); |
186 | MODULE_DESCRIPTION("Adaptec Starfire Ethernet driver"); | 186 | MODULE_DESCRIPTION("Adaptec Starfire Ethernet driver"); |
diff --git a/drivers/net/sundance.c b/drivers/net/sundance.c index 545f81b34ad7..d1521c3875b2 100644 --- a/drivers/net/sundance.c +++ b/drivers/net/sundance.c | |||
@@ -1698,13 +1698,13 @@ static int netdev_close(struct net_device *dev) | |||
1698 | 1698 | ||
1699 | #ifdef __i386__ | 1699 | #ifdef __i386__ |
1700 | if (netif_msg_hw(np)) { | 1700 | if (netif_msg_hw(np)) { |
1701 | printk("\n"KERN_DEBUG" Tx ring at %8.8x:\n", | 1701 | printk(KERN_DEBUG " Tx ring at %8.8x:\n", |
1702 | (int)(np->tx_ring_dma)); | 1702 | (int)(np->tx_ring_dma)); |
1703 | for (i = 0; i < TX_RING_SIZE; i++) | 1703 | for (i = 0; i < TX_RING_SIZE; i++) |
1704 | printk(" #%d desc. %4.4x %8.8x %8.8x.\n", | 1704 | printk(KERN_DEBUG " #%d desc. %4.4x %8.8x %8.8x.\n", |
1705 | i, np->tx_ring[i].status, np->tx_ring[i].frag[0].addr, | 1705 | i, np->tx_ring[i].status, np->tx_ring[i].frag[0].addr, |
1706 | np->tx_ring[i].frag[0].length); | 1706 | np->tx_ring[i].frag[0].length); |
1707 | printk("\n"KERN_DEBUG " Rx ring %8.8x:\n", | 1707 | printk(KERN_DEBUG " Rx ring %8.8x:\n", |
1708 | (int)(np->rx_ring_dma)); | 1708 | (int)(np->rx_ring_dma)); |
1709 | for (i = 0; i < /*RX_RING_SIZE*/4 ; i++) { | 1709 | for (i = 0; i < /*RX_RING_SIZE*/4 ; i++) { |
1710 | printk(KERN_DEBUG " #%d desc. %4.4x %4.4x %8.8x\n", | 1710 | printk(KERN_DEBUG " #%d desc. %4.4x %4.4x %8.8x\n", |
diff --git a/drivers/net/tsi108_eth.c b/drivers/net/tsi108_eth.c index 0f78f99f9b20..7030bd5e9848 100644 --- a/drivers/net/tsi108_eth.c +++ b/drivers/net/tsi108_eth.c | |||
@@ -1132,7 +1132,9 @@ static int tsi108_get_mac(struct net_device *dev) | |||
1132 | } | 1132 | } |
1133 | 1133 | ||
1134 | if (!is_valid_ether_addr(dev->dev_addr)) { | 1134 | if (!is_valid_ether_addr(dev->dev_addr)) { |
1135 | printk("KERN_ERR: word1: %08x, word2: %08x\n", word1, word2); | 1135 | printk(KERN_ERR |
1136 | "%s: Invalid MAC address. word1: %08x, word2: %08x\n", | ||
1137 | dev->name, word1, word2); | ||
1136 | return -EINVAL; | 1138 | return -EINVAL; |
1137 | } | 1139 | } |
1138 | 1140 | ||
@@ -1201,8 +1203,8 @@ static void tsi108_set_rx_mode(struct net_device *dev) | |||
1201 | __set_bit(hash, &data->mc_hash[0]); | 1203 | __set_bit(hash, &data->mc_hash[0]); |
1202 | } else { | 1204 | } else { |
1203 | printk(KERN_ERR | 1205 | printk(KERN_ERR |
1204 | "%s: got multicast address of length %d " | 1206 | "%s: got multicast address of length %d instead of 6.\n", |
1205 | "instead of 6.\n", dev->name, | 1207 | dev->name, |
1206 | mc->dmi_addrlen); | 1208 | mc->dmi_addrlen); |
1207 | } | 1209 | } |
1208 | 1210 | ||
diff --git a/drivers/net/tulip/de2104x.c b/drivers/net/tulip/de2104x.c index 81f054dbb88d..ef49744a5085 100644 --- a/drivers/net/tulip/de2104x.c +++ b/drivers/net/tulip/de2104x.c | |||
@@ -944,9 +944,10 @@ static void de_set_media (struct de_private *de) | |||
944 | macmode &= ~FullDuplex; | 944 | macmode &= ~FullDuplex; |
945 | 945 | ||
946 | if (netif_msg_link(de)) { | 946 | if (netif_msg_link(de)) { |
947 | printk(KERN_INFO "%s: set link %s\n" | 947 | printk(KERN_INFO |
948 | KERN_INFO "%s: mode 0x%x, sia 0x%x,0x%x,0x%x,0x%x\n" | 948 | "%s: set link %s\n" |
949 | KERN_INFO "%s: set mode 0x%x, set sia 0x%x,0x%x,0x%x\n", | 949 | "%s: mode 0x%x, sia 0x%x,0x%x,0x%x,0x%x\n" |
950 | "%s: set mode 0x%x, set sia 0x%x,0x%x,0x%x\n", | ||
950 | de->dev->name, media_name[media], | 951 | de->dev->name, media_name[media], |
951 | de->dev->name, dr32(MacMode), dr32(SIAStatus), | 952 | de->dev->name, dr32(MacMode), dr32(SIAStatus), |
952 | dr32(CSR13), dr32(CSR14), dr32(CSR15), | 953 | dr32(CSR13), dr32(CSR14), dr32(CSR15), |
diff --git a/drivers/net/tulip/tulip_core.c b/drivers/net/tulip/tulip_core.c index 2abb5d3becc6..99a63649f4fc 100644 --- a/drivers/net/tulip/tulip_core.c +++ b/drivers/net/tulip/tulip_core.c | |||
@@ -570,16 +570,18 @@ static void tulip_tx_timeout(struct net_device *dev) | |||
570 | (unsigned int)tp->rx_ring[i].buffer2, | 570 | (unsigned int)tp->rx_ring[i].buffer2, |
571 | buf[0], buf[1], buf[2]); | 571 | buf[0], buf[1], buf[2]); |
572 | for (j = 0; buf[j] != 0xee && j < 1600; j++) | 572 | for (j = 0; buf[j] != 0xee && j < 1600; j++) |
573 | if (j < 100) printk(" %2.2x", buf[j]); | 573 | if (j < 100) |
574 | printk(" j=%d.\n", j); | 574 | printk(KERN_CONT " %2.2x", buf[j]); |
575 | printk(KERN_CONT " j=%d.\n", j); | ||
575 | } | 576 | } |
576 | printk(KERN_DEBUG " Rx ring %8.8x: ", (int)tp->rx_ring); | 577 | printk(KERN_DEBUG " Rx ring %8.8x: ", (int)tp->rx_ring); |
577 | for (i = 0; i < RX_RING_SIZE; i++) | 578 | for (i = 0; i < RX_RING_SIZE; i++) |
578 | printk(" %8.8x", (unsigned int)tp->rx_ring[i].status); | 579 | printk(KERN_CONT " %8.8x", |
579 | printk("\n" KERN_DEBUG " Tx ring %8.8x: ", (int)tp->tx_ring); | 580 | (unsigned int)tp->rx_ring[i].status); |
581 | printk(KERN_DEBUG " Tx ring %8.8x: ", (int)tp->tx_ring); | ||
580 | for (i = 0; i < TX_RING_SIZE; i++) | 582 | for (i = 0; i < TX_RING_SIZE; i++) |
581 | printk(" %8.8x", (unsigned int)tp->tx_ring[i].status); | 583 | printk(KERN_CONT " %8.8x", (unsigned int)tp->tx_ring[i].status); |
582 | printk("\n"); | 584 | printk(KERN_CONT "\n"); |
583 | } | 585 | } |
584 | #endif | 586 | #endif |
585 | 587 | ||
diff --git a/drivers/net/tulip/winbond-840.c b/drivers/net/tulip/winbond-840.c index 842b1a2c40d4..0f15773dae52 100644 --- a/drivers/net/tulip/winbond-840.c +++ b/drivers/net/tulip/winbond-840.c | |||
@@ -142,7 +142,7 @@ static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1}; | |||
142 | static const char version[] __initconst = | 142 | static const char version[] __initconst = |
143 | KERN_INFO DRV_NAME ".c:v" DRV_VERSION " (2.4 port) " | 143 | KERN_INFO DRV_NAME ".c:v" DRV_VERSION " (2.4 port) " |
144 | DRV_RELDATE " Donald Becker <becker@scyld.com>\n" | 144 | DRV_RELDATE " Donald Becker <becker@scyld.com>\n" |
145 | KERN_INFO " http://www.scyld.com/network/drivers.html\n"; | 145 | " http://www.scyld.com/network/drivers.html\n"; |
146 | 146 | ||
147 | MODULE_AUTHOR("Donald Becker <becker@scyld.com>"); | 147 | MODULE_AUTHOR("Donald Becker <becker@scyld.com>"); |
148 | MODULE_DESCRIPTION("Winbond W89c840 Ethernet driver"); | 148 | MODULE_DESCRIPTION("Winbond W89c840 Ethernet driver"); |
@@ -939,7 +939,7 @@ static void tx_timeout(struct net_device *dev) | |||
939 | printk(KERN_DEBUG " Rx ring %p: ", np->rx_ring); | 939 | printk(KERN_DEBUG " Rx ring %p: ", np->rx_ring); |
940 | for (i = 0; i < RX_RING_SIZE; i++) | 940 | for (i = 0; i < RX_RING_SIZE; i++) |
941 | printk(" %8.8x", (unsigned int)np->rx_ring[i].status); | 941 | printk(" %8.8x", (unsigned int)np->rx_ring[i].status); |
942 | printk("\n"KERN_DEBUG" Tx ring %p: ", np->tx_ring); | 942 | printk(KERN_DEBUG" Tx ring %p: ", np->tx_ring); |
943 | for (i = 0; i < TX_RING_SIZE; i++) | 943 | for (i = 0; i < TX_RING_SIZE; i++) |
944 | printk(" %8.8x", np->tx_ring[i].status); | 944 | printk(" %8.8x", np->tx_ring[i].status); |
945 | printk("\n"); | 945 | printk("\n"); |
@@ -1520,7 +1520,7 @@ static int netdev_close(struct net_device *dev) | |||
1520 | printk(KERN_DEBUG " #%d desc. %4.4x %4.4x %8.8x.\n", | 1520 | printk(KERN_DEBUG " #%d desc. %4.4x %4.4x %8.8x.\n", |
1521 | i, np->tx_ring[i].length, | 1521 | i, np->tx_ring[i].length, |
1522 | np->tx_ring[i].status, np->tx_ring[i].buffer1); | 1522 | np->tx_ring[i].status, np->tx_ring[i].buffer1); |
1523 | printk("\n"KERN_DEBUG " Rx ring %8.8x:\n", | 1523 | printk(KERN_DEBUG " Rx ring %8.8x:\n", |
1524 | (int)np->rx_ring); | 1524 | (int)np->rx_ring); |
1525 | for (i = 0; i < RX_RING_SIZE; i++) { | 1525 | for (i = 0; i < RX_RING_SIZE; i++) { |
1526 | printk(KERN_DEBUG " #%d desc. %4.4x %4.4x %8.8x\n", | 1526 | printk(KERN_DEBUG " #%d desc. %4.4x %4.4x %8.8x\n", |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 11a0ba47b677..027f7aba26af 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -486,12 +486,14 @@ static unsigned int tun_chr_poll(struct file *file, poll_table * wait) | |||
486 | { | 486 | { |
487 | struct tun_file *tfile = file->private_data; | 487 | struct tun_file *tfile = file->private_data; |
488 | struct tun_struct *tun = __tun_get(tfile); | 488 | struct tun_struct *tun = __tun_get(tfile); |
489 | struct sock *sk = tun->sk; | 489 | struct sock *sk; |
490 | unsigned int mask = 0; | 490 | unsigned int mask = 0; |
491 | 491 | ||
492 | if (!tun) | 492 | if (!tun) |
493 | return POLLERR; | 493 | return POLLERR; |
494 | 494 | ||
495 | sk = tun->sk; | ||
496 | |||
495 | DBG(KERN_INFO "%s: tun_chr_poll\n", tun->dev->name); | 497 | DBG(KERN_INFO "%s: tun_chr_poll\n", tun->dev->name); |
496 | 498 | ||
497 | poll_wait(file, &tun->socket.wait, wait); | 499 | poll_wait(file, &tun->socket.wait, wait); |
@@ -1324,20 +1326,22 @@ static int tun_chr_close(struct inode *inode, struct file *file) | |||
1324 | struct tun_file *tfile = file->private_data; | 1326 | struct tun_file *tfile = file->private_data; |
1325 | struct tun_struct *tun; | 1327 | struct tun_struct *tun; |
1326 | 1328 | ||
1327 | |||
1328 | rtnl_lock(); | ||
1329 | tun = __tun_get(tfile); | 1329 | tun = __tun_get(tfile); |
1330 | if (tun) { | 1330 | if (tun) { |
1331 | DBG(KERN_INFO "%s: tun_chr_close\n", tun->dev->name); | 1331 | struct net_device *dev = tun->dev; |
1332 | |||
1333 | DBG(KERN_INFO "%s: tun_chr_close\n", dev->name); | ||
1332 | 1334 | ||
1333 | __tun_detach(tun); | 1335 | __tun_detach(tun); |
1334 | 1336 | ||
1335 | /* If desireable, unregister the netdevice. */ | 1337 | /* If desireable, unregister the netdevice. */ |
1336 | if (!(tun->flags & TUN_PERSIST)) | 1338 | if (!(tun->flags & TUN_PERSIST)) { |
1337 | unregister_netdevice(tun->dev); | 1339 | rtnl_lock(); |
1338 | 1340 | if (dev->reg_state == NETREG_REGISTERED) | |
1341 | unregister_netdevice(dev); | ||
1342 | rtnl_unlock(); | ||
1343 | } | ||
1339 | } | 1344 | } |
1340 | rtnl_unlock(); | ||
1341 | 1345 | ||
1342 | tun = tfile->tun; | 1346 | tun = tfile->tun; |
1343 | if (tun) | 1347 | if (tun) |
diff --git a/drivers/net/wan/hd64570.c b/drivers/net/wan/hd64570.c index 223238de475c..1ea1ef6c3b96 100644 --- a/drivers/net/wan/hd64570.c +++ b/drivers/net/wan/hd64570.c | |||
@@ -584,8 +584,9 @@ static void sca_dump_rings(struct net_device *dev) | |||
584 | sca_in(DSR_RX(phy_node(port)), card) & DSR_DE ? "" : "in"); | 584 | sca_in(DSR_RX(phy_node(port)), card) & DSR_DE ? "" : "in"); |
585 | for (cnt = 0; cnt < port_to_card(port)->rx_ring_buffers; cnt++) | 585 | for (cnt = 0; cnt < port_to_card(port)->rx_ring_buffers; cnt++) |
586 | printk(" %02X", readb(&(desc_address(port, cnt, 0)->stat))); | 586 | printk(" %02X", readb(&(desc_address(port, cnt, 0)->stat))); |
587 | printk(KERN_CONT "\n"); | ||
587 | 588 | ||
588 | printk("\n" KERN_DEBUG "TX ring: CDA=%u EDA=%u DSR=%02X in=%u " | 589 | printk(KERN_DEBUG "TX ring: CDA=%u EDA=%u DSR=%02X in=%u " |
589 | "last=%u %sactive", | 590 | "last=%u %sactive", |
590 | sca_inw(get_dmac_tx(port) + CDAL, card), | 591 | sca_inw(get_dmac_tx(port) + CDAL, card), |
591 | sca_inw(get_dmac_tx(port) + EDAL, card), | 592 | sca_inw(get_dmac_tx(port) + EDAL, card), |
diff --git a/drivers/net/wan/hd64572.c b/drivers/net/wan/hd64572.c index 497b003d7239..f099c34a3ae2 100644 --- a/drivers/net/wan/hd64572.c +++ b/drivers/net/wan/hd64572.c | |||
@@ -529,8 +529,9 @@ static void sca_dump_rings(struct net_device *dev) | |||
529 | sca_in(DSR_RX(port->chan), card) & DSR_DE ? "" : "in"); | 529 | sca_in(DSR_RX(port->chan), card) & DSR_DE ? "" : "in"); |
530 | for (cnt = 0; cnt < port->card->rx_ring_buffers; cnt++) | 530 | for (cnt = 0; cnt < port->card->rx_ring_buffers; cnt++) |
531 | printk(" %02X", readb(&(desc_address(port, cnt, 0)->stat))); | 531 | printk(" %02X", readb(&(desc_address(port, cnt, 0)->stat))); |
532 | printk(KERN_CONT "\n"); | ||
532 | 533 | ||
533 | printk("\n" KERN_DEBUG "TX ring: CDA=%u EDA=%u DSR=%02X in=%u " | 534 | printk(KERN_DEBUG "TX ring: CDA=%u EDA=%u DSR=%02X in=%u " |
534 | "last=%u %sactive", | 535 | "last=%u %sactive", |
535 | sca_inl(get_dmac_tx(port) + CDAL, card), | 536 | sca_inl(get_dmac_tx(port) + CDAL, card), |
536 | sca_inl(get_dmac_tx(port) + EDAL, card), | 537 | sca_inl(get_dmac_tx(port) + EDAL, card), |
diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c index 3fb9dbc88a1a..d14e95a08d66 100644 --- a/drivers/net/wan/sbni.c +++ b/drivers/net/wan/sbni.c | |||
@@ -326,11 +326,9 @@ sbni_pci_probe( struct net_device *dev ) | |||
326 | } | 326 | } |
327 | 327 | ||
328 | if (pci_irq_line <= 0 || pci_irq_line >= nr_irqs) | 328 | if (pci_irq_line <= 0 || pci_irq_line >= nr_irqs) |
329 | printk( KERN_WARNING " WARNING: The PCI BIOS assigned " | 329 | printk( KERN_WARNING |
330 | "this PCI card to IRQ %d, which is unlikely " | 330 | " WARNING: The PCI BIOS assigned this PCI card to IRQ %d, which is unlikely to work!.\n" |
331 | "to work!.\n" | 331 | " You should use the PCI BIOS setup to assign a valid IRQ line.\n", |
332 | KERN_WARNING " You should use the PCI BIOS " | ||
333 | "setup to assign a valid IRQ line.\n", | ||
334 | pci_irq_line ); | 332 | pci_irq_line ); |
335 | 333 | ||
336 | /* avoiding re-enable dual adapters */ | 334 | /* avoiding re-enable dual adapters */ |
diff --git a/drivers/net/wireless/ath/Kconfig b/drivers/net/wireless/ath/Kconfig index d26e7b485315..eb0337c49546 100644 --- a/drivers/net/wireless/ath/Kconfig +++ b/drivers/net/wireless/ath/Kconfig | |||
@@ -1,5 +1,6 @@ | |||
1 | config ATH_COMMON | 1 | config ATH_COMMON |
2 | tristate "Atheros Wireless Cards" | 2 | tristate "Atheros Wireless Cards" |
3 | depends on WLAN_80211 | ||
3 | depends on ATH5K || ATH9K || AR9170_USB | 4 | depends on ATH5K || ATH9K || AR9170_USB |
4 | 5 | ||
5 | source "drivers/net/wireless/ath/ath5k/Kconfig" | 6 | source "drivers/net/wireless/ath/ath5k/Kconfig" |
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c index b61a071788a5..4ccf48e396df 100644 --- a/drivers/net/wireless/ath/ath9k/xmit.c +++ b/drivers/net/wireless/ath/ath9k/xmit.c | |||
@@ -355,7 +355,14 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, | |||
355 | } | 355 | } |
356 | 356 | ||
357 | if (bf_next == NULL) { | 357 | if (bf_next == NULL) { |
358 | INIT_LIST_HEAD(&bf_head); | 358 | /* |
359 | * Make sure the last desc is reclaimed if it | ||
360 | * not a holding desc. | ||
361 | */ | ||
362 | if (!bf_last->bf_stale) | ||
363 | list_move_tail(&bf->list, &bf_head); | ||
364 | else | ||
365 | INIT_LIST_HEAD(&bf_head); | ||
359 | } else { | 366 | } else { |
360 | ASSERT(!list_empty(bf_q)); | 367 | ASSERT(!list_empty(bf_q)); |
361 | list_move_tail(&bf->list, &bf_head); | 368 | list_move_tail(&bf->list, &bf_head); |
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h index f580c2812d91..40448067e4cc 100644 --- a/drivers/net/wireless/b43/b43.h +++ b/drivers/net/wireless/b43/b43.h | |||
@@ -648,6 +648,7 @@ struct b43_wl { | |||
648 | u8 nr_devs; | 648 | u8 nr_devs; |
649 | 649 | ||
650 | bool radiotap_enabled; | 650 | bool radiotap_enabled; |
651 | bool radio_enabled; | ||
651 | 652 | ||
652 | /* The beacon we are currently using (AP or IBSS mode). | 653 | /* The beacon we are currently using (AP or IBSS mode). |
653 | * This beacon stuff is protected by the irq_lock. */ | 654 | * This beacon stuff is protected by the irq_lock. */ |
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c index 6456afebdba1..e71c8d9cd706 100644 --- a/drivers/net/wireless/b43/main.c +++ b/drivers/net/wireless/b43/main.c | |||
@@ -3497,8 +3497,8 @@ static int b43_op_config(struct ieee80211_hw *hw, u32 changed) | |||
3497 | if (phy->ops->set_rx_antenna) | 3497 | if (phy->ops->set_rx_antenna) |
3498 | phy->ops->set_rx_antenna(dev, antenna); | 3498 | phy->ops->set_rx_antenna(dev, antenna); |
3499 | 3499 | ||
3500 | if (!!conf->radio_enabled != phy->radio_on) { | 3500 | if (wl->radio_enabled != phy->radio_on) { |
3501 | if (conf->radio_enabled) { | 3501 | if (wl->radio_enabled) { |
3502 | b43_software_rfkill(dev, false); | 3502 | b43_software_rfkill(dev, false); |
3503 | b43info(dev->wl, "Radio turned on by software\n"); | 3503 | b43info(dev->wl, "Radio turned on by software\n"); |
3504 | if (!dev->radio_hw_enable) { | 3504 | if (!dev->radio_hw_enable) { |
@@ -4339,6 +4339,7 @@ static int b43_op_start(struct ieee80211_hw *hw) | |||
4339 | wl->beacon0_uploaded = 0; | 4339 | wl->beacon0_uploaded = 0; |
4340 | wl->beacon1_uploaded = 0; | 4340 | wl->beacon1_uploaded = 0; |
4341 | wl->beacon_templates_virgin = 1; | 4341 | wl->beacon_templates_virgin = 1; |
4342 | wl->radio_enabled = 1; | ||
4342 | 4343 | ||
4343 | mutex_lock(&wl->mutex); | 4344 | mutex_lock(&wl->mutex); |
4344 | 4345 | ||
@@ -4378,6 +4379,7 @@ static void b43_op_stop(struct ieee80211_hw *hw) | |||
4378 | if (b43_status(dev) >= B43_STAT_STARTED) | 4379 | if (b43_status(dev) >= B43_STAT_STARTED) |
4379 | b43_wireless_core_stop(dev); | 4380 | b43_wireless_core_stop(dev); |
4380 | b43_wireless_core_exit(dev); | 4381 | b43_wireless_core_exit(dev); |
4382 | wl->radio_enabled = 0; | ||
4381 | mutex_unlock(&wl->mutex); | 4383 | mutex_unlock(&wl->mutex); |
4382 | 4384 | ||
4383 | cancel_work_sync(&(wl->txpower_adjust_work)); | 4385 | cancel_work_sync(&(wl->txpower_adjust_work)); |
@@ -4560,6 +4562,7 @@ static int b43_wireless_core_attach(struct b43_wldev *dev) | |||
4560 | B43_WARN_ON(1); | 4562 | B43_WARN_ON(1); |
4561 | 4563 | ||
4562 | dev->phy.gmode = have_2ghz_phy; | 4564 | dev->phy.gmode = have_2ghz_phy; |
4565 | dev->phy.radio_on = 1; | ||
4563 | tmp = dev->phy.gmode ? B43_TMSLOW_GMODE : 0; | 4566 | tmp = dev->phy.gmode ? B43_TMSLOW_GMODE : 0; |
4564 | b43_wireless_core_reset(dev, tmp); | 4567 | b43_wireless_core_reset(dev, tmp); |
4565 | 4568 | ||
diff --git a/drivers/net/wireless/b43/pcmcia.c b/drivers/net/wireless/b43/pcmcia.c index 3cfc30307a27..6c3a74964ab8 100644 --- a/drivers/net/wireless/b43/pcmcia.c +++ b/drivers/net/wireless/b43/pcmcia.c | |||
@@ -35,6 +35,7 @@ | |||
35 | 35 | ||
36 | static /*const */ struct pcmcia_device_id b43_pcmcia_tbl[] = { | 36 | static /*const */ struct pcmcia_device_id b43_pcmcia_tbl[] = { |
37 | PCMCIA_DEVICE_MANF_CARD(0x2D0, 0x448), | 37 | PCMCIA_DEVICE_MANF_CARD(0x2D0, 0x448), |
38 | PCMCIA_DEVICE_MANF_CARD(0x2D0, 0x476), | ||
38 | PCMCIA_DEVICE_NULL, | 39 | PCMCIA_DEVICE_NULL, |
39 | }; | 40 | }; |
40 | 41 | ||
diff --git a/drivers/net/wireless/b43legacy/b43legacy.h b/drivers/net/wireless/b43legacy/b43legacy.h index 77fda148ac46..038baa8869e2 100644 --- a/drivers/net/wireless/b43legacy/b43legacy.h +++ b/drivers/net/wireless/b43legacy/b43legacy.h | |||
@@ -607,6 +607,7 @@ struct b43legacy_wl { | |||
607 | u8 nr_devs; | 607 | u8 nr_devs; |
608 | 608 | ||
609 | bool radiotap_enabled; | 609 | bool radiotap_enabled; |
610 | bool radio_enabled; | ||
610 | 611 | ||
611 | /* The beacon we are currently using (AP or IBSS mode). | 612 | /* The beacon we are currently using (AP or IBSS mode). |
612 | * This beacon stuff is protected by the irq_lock. */ | 613 | * This beacon stuff is protected by the irq_lock. */ |
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c index e5136fb65ddd..c4973c1942bf 100644 --- a/drivers/net/wireless/b43legacy/main.c +++ b/drivers/net/wireless/b43legacy/main.c | |||
@@ -2689,8 +2689,8 @@ static int b43legacy_op_dev_config(struct ieee80211_hw *hw, | |||
2689 | /* Antennas for RX and management frame TX. */ | 2689 | /* Antennas for RX and management frame TX. */ |
2690 | b43legacy_mgmtframe_txantenna(dev, antenna_tx); | 2690 | b43legacy_mgmtframe_txantenna(dev, antenna_tx); |
2691 | 2691 | ||
2692 | if (!!conf->radio_enabled != phy->radio_on) { | 2692 | if (wl->radio_enabled != phy->radio_on) { |
2693 | if (conf->radio_enabled) { | 2693 | if (wl->radio_enabled) { |
2694 | b43legacy_radio_turn_on(dev); | 2694 | b43legacy_radio_turn_on(dev); |
2695 | b43legacyinfo(dev->wl, "Radio turned on by software\n"); | 2695 | b43legacyinfo(dev->wl, "Radio turned on by software\n"); |
2696 | if (!dev->radio_hw_enable) | 2696 | if (!dev->radio_hw_enable) |
@@ -3441,6 +3441,7 @@ static int b43legacy_op_start(struct ieee80211_hw *hw) | |||
3441 | wl->beacon0_uploaded = 0; | 3441 | wl->beacon0_uploaded = 0; |
3442 | wl->beacon1_uploaded = 0; | 3442 | wl->beacon1_uploaded = 0; |
3443 | wl->beacon_templates_virgin = 1; | 3443 | wl->beacon_templates_virgin = 1; |
3444 | wl->radio_enabled = 1; | ||
3444 | 3445 | ||
3445 | mutex_lock(&wl->mutex); | 3446 | mutex_lock(&wl->mutex); |
3446 | 3447 | ||
@@ -3479,6 +3480,7 @@ static void b43legacy_op_stop(struct ieee80211_hw *hw) | |||
3479 | if (b43legacy_status(dev) >= B43legacy_STAT_STARTED) | 3480 | if (b43legacy_status(dev) >= B43legacy_STAT_STARTED) |
3480 | b43legacy_wireless_core_stop(dev); | 3481 | b43legacy_wireless_core_stop(dev); |
3481 | b43legacy_wireless_core_exit(dev); | 3482 | b43legacy_wireless_core_exit(dev); |
3483 | wl->radio_enabled = 0; | ||
3482 | mutex_unlock(&wl->mutex); | 3484 | mutex_unlock(&wl->mutex); |
3483 | } | 3485 | } |
3484 | 3486 | ||
@@ -3620,6 +3622,7 @@ static int b43legacy_wireless_core_attach(struct b43legacy_wldev *dev) | |||
3620 | have_bphy = 1; | 3622 | have_bphy = 1; |
3621 | 3623 | ||
3622 | dev->phy.gmode = (have_gphy || have_bphy); | 3624 | dev->phy.gmode = (have_gphy || have_bphy); |
3625 | dev->phy.radio_on = 1; | ||
3623 | tmp = dev->phy.gmode ? B43legacy_TMSLOW_GMODE : 0; | 3626 | tmp = dev->phy.gmode ? B43legacy_TMSLOW_GMODE : 0; |
3624 | b43legacy_wireless_core_reset(dev, tmp); | 3627 | b43legacy_wireless_core_reset(dev, tmp); |
3625 | 3628 | ||
diff --git a/drivers/net/wireless/iwmc3200wifi/Kconfig b/drivers/net/wireless/iwmc3200wifi/Kconfig index 1eccb6df46dd..030401d367d3 100644 --- a/drivers/net/wireless/iwmc3200wifi/Kconfig +++ b/drivers/net/wireless/iwmc3200wifi/Kconfig | |||
@@ -4,6 +4,15 @@ config IWM | |||
4 | depends on CFG80211 | 4 | depends on CFG80211 |
5 | select WIRELESS_EXT | 5 | select WIRELESS_EXT |
6 | select FW_LOADER | 6 | select FW_LOADER |
7 | help | ||
8 | The Intel Wireless Multicomm 3200 hardware is a combo | ||
9 | card with GPS, Bluetooth, WiMax and 802.11 radios. It | ||
10 | runs over SDIO and is typically found on Moorestown | ||
11 | based platform. This driver takes care of the 802.11 | ||
12 | part, which is a fullmac one. | ||
13 | |||
14 | If you choose to build it as a module, it'll be called | ||
15 | iwmc3200wifi.ko. | ||
7 | 16 | ||
8 | config IWM_DEBUG | 17 | config IWM_DEBUG |
9 | bool "Enable full debugging output in iwmc3200wifi" | 18 | bool "Enable full debugging output in iwmc3200wifi" |
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index e789c6e9938c..a111bda392e2 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -418,6 +418,7 @@ static bool mac80211_hwsim_tx_frame(struct ieee80211_hw *hw, | |||
418 | continue; | 418 | continue; |
419 | 419 | ||
420 | if (!data2->started || !hwsim_ps_rx_ok(data2, skb) || | 420 | if (!data2->started || !hwsim_ps_rx_ok(data2, skb) || |
421 | !data->channel || !data2->channel || | ||
421 | data->channel->center_freq != data2->channel->center_freq || | 422 | data->channel->center_freq != data2->channel->center_freq || |
422 | !(data->group & data2->group)) | 423 | !(data->group & data2->group)) |
423 | continue; | 424 | continue; |
diff --git a/drivers/net/wireless/p54/p54common.c b/drivers/net/wireless/p54/p54common.c index b618bd14583f..22ca122bd798 100644 --- a/drivers/net/wireless/p54/p54common.c +++ b/drivers/net/wireless/p54/p54common.c | |||
@@ -823,30 +823,30 @@ void p54_free_skb(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
823 | struct p54_tx_info *range; | 823 | struct p54_tx_info *range; |
824 | unsigned long flags; | 824 | unsigned long flags; |
825 | 825 | ||
826 | if (unlikely(!skb || !dev || skb_queue_empty(&priv->tx_queue))) | 826 | if (unlikely(!skb || !dev || !skb_queue_len(&priv->tx_queue))) |
827 | return; | 827 | return; |
828 | 828 | ||
829 | /* There used to be a check here to see if the SKB was on the | 829 | /* |
830 | * TX queue or not. This can never happen because all SKBs we | 830 | * don't try to free an already unlinked skb |
831 | * see here successfully went through p54_assign_address() | ||
832 | * which means the SKB is on the ->tx_queue. | ||
833 | */ | 831 | */ |
832 | if (unlikely((!skb->next) || (!skb->prev))) | ||
833 | return; | ||
834 | 834 | ||
835 | spin_lock_irqsave(&priv->tx_queue.lock, flags); | 835 | spin_lock_irqsave(&priv->tx_queue.lock, flags); |
836 | info = IEEE80211_SKB_CB(skb); | 836 | info = IEEE80211_SKB_CB(skb); |
837 | range = (void *)info->rate_driver_data; | 837 | range = (void *)info->rate_driver_data; |
838 | if (!skb_queue_is_first(&priv->tx_queue, skb)) { | 838 | if (skb->prev != (struct sk_buff *)&priv->tx_queue) { |
839 | struct ieee80211_tx_info *ni; | 839 | struct ieee80211_tx_info *ni; |
840 | struct p54_tx_info *mr; | 840 | struct p54_tx_info *mr; |
841 | 841 | ||
842 | ni = IEEE80211_SKB_CB(skb_queue_prev(&priv->tx_queue, skb)); | 842 | ni = IEEE80211_SKB_CB(skb->prev); |
843 | mr = (struct p54_tx_info *)ni->rate_driver_data; | 843 | mr = (struct p54_tx_info *)ni->rate_driver_data; |
844 | } | 844 | } |
845 | if (!skb_queue_is_last(&priv->tx_queue, skb)) { | 845 | if (skb->next != (struct sk_buff *)&priv->tx_queue) { |
846 | struct ieee80211_tx_info *ni; | 846 | struct ieee80211_tx_info *ni; |
847 | struct p54_tx_info *mr; | 847 | struct p54_tx_info *mr; |
848 | 848 | ||
849 | ni = IEEE80211_SKB_CB(skb_queue_next(&priv->tx_queue, skb)); | 849 | ni = IEEE80211_SKB_CB(skb->next); |
850 | mr = (struct p54_tx_info *)ni->rate_driver_data; | 850 | mr = (struct p54_tx_info *)ni->rate_driver_data; |
851 | } | 851 | } |
852 | __skb_unlink(skb, &priv->tx_queue); | 852 | __skb_unlink(skb, &priv->tx_queue); |
@@ -864,13 +864,15 @@ static struct sk_buff *p54_find_tx_entry(struct ieee80211_hw *dev, | |||
864 | unsigned long flags; | 864 | unsigned long flags; |
865 | 865 | ||
866 | spin_lock_irqsave(&priv->tx_queue.lock, flags); | 866 | spin_lock_irqsave(&priv->tx_queue.lock, flags); |
867 | skb_queue_walk(&priv->tx_queue, entry) { | 867 | entry = priv->tx_queue.next; |
868 | while (entry != (struct sk_buff *)&priv->tx_queue) { | ||
868 | struct p54_hdr *hdr = (struct p54_hdr *) entry->data; | 869 | struct p54_hdr *hdr = (struct p54_hdr *) entry->data; |
869 | 870 | ||
870 | if (hdr->req_id == req_id) { | 871 | if (hdr->req_id == req_id) { |
871 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); | 872 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); |
872 | return entry; | 873 | return entry; |
873 | } | 874 | } |
875 | entry = entry->next; | ||
874 | } | 876 | } |
875 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); | 877 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); |
876 | return NULL; | 878 | return NULL; |
@@ -888,33 +890,36 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb) | |||
888 | int count, idx; | 890 | int count, idx; |
889 | 891 | ||
890 | spin_lock_irqsave(&priv->tx_queue.lock, flags); | 892 | spin_lock_irqsave(&priv->tx_queue.lock, flags); |
891 | skb_queue_walk(&priv->tx_queue, entry) { | 893 | entry = (struct sk_buff *) priv->tx_queue.next; |
894 | while (entry != (struct sk_buff *)&priv->tx_queue) { | ||
892 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(entry); | 895 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(entry); |
893 | struct p54_hdr *entry_hdr; | 896 | struct p54_hdr *entry_hdr; |
894 | struct p54_tx_data *entry_data; | 897 | struct p54_tx_data *entry_data; |
895 | unsigned int pad = 0, frame_len; | 898 | unsigned int pad = 0, frame_len; |
896 | 899 | ||
897 | range = (void *)info->rate_driver_data; | 900 | range = (void *)info->rate_driver_data; |
898 | if (range->start_addr != addr) | 901 | if (range->start_addr != addr) { |
902 | entry = entry->next; | ||
899 | continue; | 903 | continue; |
904 | } | ||
900 | 905 | ||
901 | if (!skb_queue_is_last(&priv->tx_queue, entry)) { | 906 | if (entry->next != (struct sk_buff *)&priv->tx_queue) { |
902 | struct ieee80211_tx_info *ni; | 907 | struct ieee80211_tx_info *ni; |
903 | struct p54_tx_info *mr; | 908 | struct p54_tx_info *mr; |
904 | 909 | ||
905 | ni = IEEE80211_SKB_CB(skb_queue_next(&priv->tx_queue, | 910 | ni = IEEE80211_SKB_CB(entry->next); |
906 | entry)); | ||
907 | mr = (struct p54_tx_info *)ni->rate_driver_data; | 911 | mr = (struct p54_tx_info *)ni->rate_driver_data; |
908 | } | 912 | } |
909 | 913 | ||
910 | __skb_unlink(entry, &priv->tx_queue); | 914 | __skb_unlink(entry, &priv->tx_queue); |
911 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); | ||
912 | 915 | ||
913 | frame_len = entry->len; | 916 | frame_len = entry->len; |
914 | entry_hdr = (struct p54_hdr *) entry->data; | 917 | entry_hdr = (struct p54_hdr *) entry->data; |
915 | entry_data = (struct p54_tx_data *) entry_hdr->data; | 918 | entry_data = (struct p54_tx_data *) entry_hdr->data; |
916 | priv->tx_stats[entry_data->hw_queue].len--; | 919 | if (priv->tx_stats[entry_data->hw_queue].len) |
920 | priv->tx_stats[entry_data->hw_queue].len--; | ||
917 | priv->stats.dot11ACKFailureCount += payload->tries - 1; | 921 | priv->stats.dot11ACKFailureCount += payload->tries - 1; |
922 | spin_unlock_irqrestore(&priv->tx_queue.lock, flags); | ||
918 | 923 | ||
919 | /* | 924 | /* |
920 | * Frames in P54_QUEUE_FWSCAN and P54_QUEUE_BEACON are | 925 | * Frames in P54_QUEUE_FWSCAN and P54_QUEUE_BEACON are |
@@ -1164,21 +1169,23 @@ static int p54_assign_address(struct ieee80211_hw *dev, struct sk_buff *skb, | |||
1164 | } | 1169 | } |
1165 | } | 1170 | } |
1166 | 1171 | ||
1167 | skb_queue_walk(&priv->tx_queue, entry) { | 1172 | entry = priv->tx_queue.next; |
1173 | while (left--) { | ||
1168 | u32 hole_size; | 1174 | u32 hole_size; |
1169 | info = IEEE80211_SKB_CB(entry); | 1175 | info = IEEE80211_SKB_CB(entry); |
1170 | range = (void *)info->rate_driver_data; | 1176 | range = (void *)info->rate_driver_data; |
1171 | hole_size = range->start_addr - last_addr; | 1177 | hole_size = range->start_addr - last_addr; |
1172 | if (!target_skb && hole_size >= len) { | 1178 | if (!target_skb && hole_size >= len) { |
1173 | target_skb = skb_queue_prev(&priv->tx_queue, entry); | 1179 | target_skb = entry->prev; |
1174 | hole_size -= len; | 1180 | hole_size -= len; |
1175 | target_addr = last_addr; | 1181 | target_addr = last_addr; |
1176 | } | 1182 | } |
1177 | largest_hole = max(largest_hole, hole_size); | 1183 | largest_hole = max(largest_hole, hole_size); |
1178 | last_addr = range->end_addr; | 1184 | last_addr = range->end_addr; |
1185 | entry = entry->next; | ||
1179 | } | 1186 | } |
1180 | if (!target_skb && priv->rx_end - last_addr >= len) { | 1187 | if (!target_skb && priv->rx_end - last_addr >= len) { |
1181 | target_skb = skb_peek_tail(&priv->tx_queue); | 1188 | target_skb = priv->tx_queue.prev; |
1182 | largest_hole = max(largest_hole, priv->rx_end - last_addr - len); | 1189 | largest_hole = max(largest_hole, priv->rx_end - last_addr - len); |
1183 | if (!skb_queue_empty(&priv->tx_queue)) { | 1190 | if (!skb_queue_empty(&priv->tx_queue)) { |
1184 | info = IEEE80211_SKB_CB(target_skb); | 1191 | info = IEEE80211_SKB_CB(target_skb); |
@@ -2084,6 +2091,7 @@ out: | |||
2084 | static void p54_stop(struct ieee80211_hw *dev) | 2091 | static void p54_stop(struct ieee80211_hw *dev) |
2085 | { | 2092 | { |
2086 | struct p54_common *priv = dev->priv; | 2093 | struct p54_common *priv = dev->priv; |
2094 | struct sk_buff *skb; | ||
2087 | 2095 | ||
2088 | mutex_lock(&priv->conf_mutex); | 2096 | mutex_lock(&priv->conf_mutex); |
2089 | priv->mode = NL80211_IFTYPE_UNSPECIFIED; | 2097 | priv->mode = NL80211_IFTYPE_UNSPECIFIED; |
@@ -2098,7 +2106,8 @@ static void p54_stop(struct ieee80211_hw *dev) | |||
2098 | p54_tx_cancel(dev, priv->cached_beacon); | 2106 | p54_tx_cancel(dev, priv->cached_beacon); |
2099 | 2107 | ||
2100 | priv->stop(dev); | 2108 | priv->stop(dev); |
2101 | skb_queue_purge(&priv->tx_queue); | 2109 | while ((skb = skb_dequeue(&priv->tx_queue))) |
2110 | kfree_skb(skb); | ||
2102 | priv->cached_beacon = NULL; | 2111 | priv->cached_beacon = NULL; |
2103 | priv->tsf_high32 = priv->tsf_low32 = 0; | 2112 | priv->tsf_high32 = priv->tsf_low32 = 0; |
2104 | mutex_unlock(&priv->conf_mutex); | 2113 | mutex_unlock(&priv->conf_mutex); |
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index b10b0383dfa5..698b11b1cadb 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c | |||
@@ -2427,11 +2427,10 @@ static void untranslate(ray_dev_t *local, struct sk_buff *skb, int len) | |||
2427 | 2427 | ||
2428 | #ifdef PCMCIA_DEBUG | 2428 | #ifdef PCMCIA_DEBUG |
2429 | if (pc_debug > 3) { | 2429 | if (pc_debug > 3) { |
2430 | int i; | 2430 | print_hex_dump(KERN_DEBUG, "skb->data before untranslate: ", |
2431 | printk(KERN_DEBUG "skb->data before untranslate"); | 2431 | DUMP_PREFIX_NONE, 16, 1, |
2432 | for (i = 0; i < 64; i++) | 2432 | skb->data, 64, true); |
2433 | printk("%02x ", skb->data[i]); | 2433 | printk(KERN_DEBUG |
2434 | printk("\n" KERN_DEBUG | ||
2435 | "type = %08x, xsap = %02x%02x%02x, org = %02x02x02x\n", | 2434 | "type = %08x, xsap = %02x%02x%02x, org = %02x02x02x\n", |
2436 | ntohs(type), psnap->dsap, psnap->ssap, psnap->ctrl, | 2435 | ntohs(type), psnap->dsap, psnap->ssap, psnap->ctrl, |
2437 | psnap->org[0], psnap->org[1], psnap->org[2]); | 2436 | psnap->org[0], psnap->org[1], psnap->org[2]); |
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c index 6af706408ac0..c6d300666ad8 100644 --- a/drivers/net/wireless/wavelan_cs.c +++ b/drivers/net/wireless/wavelan_cs.c | |||
@@ -3556,17 +3556,8 @@ wv_82593_config(struct net_device * dev) | |||
3556 | cfblk.rcvstop = TRUE; /* Enable Receive Stop Register */ | 3556 | cfblk.rcvstop = TRUE; /* Enable Receive Stop Register */ |
3557 | 3557 | ||
3558 | #ifdef DEBUG_I82593_SHOW | 3558 | #ifdef DEBUG_I82593_SHOW |
3559 | { | 3559 | print_hex_dump(KERN_DEBUG, "wavelan_cs: config block: ", DUMP_PREFIX_NONE, |
3560 | u_char *c = (u_char *) &cfblk; | 3560 | 16, 1, &cfblk, sizeof(struct i82593_conf_block), false); |
3561 | int i; | ||
3562 | printk(KERN_DEBUG "wavelan_cs: config block:"); | ||
3563 | for(i = 0; i < sizeof(struct i82593_conf_block); i++,c++) | ||
3564 | { | ||
3565 | if((i % 16) == 0) printk("\n" KERN_DEBUG); | ||
3566 | printk("%02x ", *c); | ||
3567 | } | ||
3568 | printk("\n"); | ||
3569 | } | ||
3570 | #endif | 3561 | #endif |
3571 | 3562 | ||
3572 | /* Copy the config block to the i82593 */ | 3563 | /* Copy the config block to the i82593 */ |
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c index 14a19baff214..0e6e44689cc6 100644 --- a/drivers/net/wireless/zd1211rw/zd_usb.c +++ b/drivers/net/wireless/zd1211rw/zd_usb.c | |||
@@ -38,7 +38,6 @@ static struct usb_device_id usb_ids[] = { | |||
38 | /* ZD1211 */ | 38 | /* ZD1211 */ |
39 | { USB_DEVICE(0x0ace, 0x1211), .driver_info = DEVICE_ZD1211 }, | 39 | { USB_DEVICE(0x0ace, 0x1211), .driver_info = DEVICE_ZD1211 }, |
40 | { USB_DEVICE(0x0ace, 0xa211), .driver_info = DEVICE_ZD1211 }, | 40 | { USB_DEVICE(0x0ace, 0xa211), .driver_info = DEVICE_ZD1211 }, |
41 | { USB_DEVICE(0x07b8, 0x6001), .driver_info = DEVICE_ZD1211 }, | ||
42 | { USB_DEVICE(0x126f, 0xa006), .driver_info = DEVICE_ZD1211 }, | 41 | { USB_DEVICE(0x126f, 0xa006), .driver_info = DEVICE_ZD1211 }, |
43 | { USB_DEVICE(0x6891, 0xa727), .driver_info = DEVICE_ZD1211 }, | 42 | { USB_DEVICE(0x6891, 0xa727), .driver_info = DEVICE_ZD1211 }, |
44 | { USB_DEVICE(0x0df6, 0x9071), .driver_info = DEVICE_ZD1211 }, | 43 | { USB_DEVICE(0x0df6, 0x9071), .driver_info = DEVICE_ZD1211 }, |
@@ -61,6 +60,7 @@ static struct usb_device_id usb_ids[] = { | |||
61 | { USB_DEVICE(0x157e, 0x300a), .driver_info = DEVICE_ZD1211 }, | 60 | { USB_DEVICE(0x157e, 0x300a), .driver_info = DEVICE_ZD1211 }, |
62 | { USB_DEVICE(0x0105, 0x145f), .driver_info = DEVICE_ZD1211 }, | 61 | { USB_DEVICE(0x0105, 0x145f), .driver_info = DEVICE_ZD1211 }, |
63 | /* ZD1211B */ | 62 | /* ZD1211B */ |
63 | { USB_DEVICE(0x054c, 0x0257), .driver_info = DEVICE_ZD1211B }, | ||
64 | { USB_DEVICE(0x0ace, 0x1215), .driver_info = DEVICE_ZD1211B }, | 64 | { USB_DEVICE(0x0ace, 0x1215), .driver_info = DEVICE_ZD1211B }, |
65 | { USB_DEVICE(0x0ace, 0xb215), .driver_info = DEVICE_ZD1211B }, | 65 | { USB_DEVICE(0x0ace, 0xb215), .driver_info = DEVICE_ZD1211B }, |
66 | { USB_DEVICE(0x157e, 0x300d), .driver_info = DEVICE_ZD1211B }, | 66 | { USB_DEVICE(0x157e, 0x300d), .driver_info = DEVICE_ZD1211B }, |
@@ -87,6 +87,7 @@ static struct usb_device_id usb_ids[] = { | |||
87 | { USB_DEVICE(0x0471, 0x1237), .driver_info = DEVICE_ZD1211B }, | 87 | { USB_DEVICE(0x0471, 0x1237), .driver_info = DEVICE_ZD1211B }, |
88 | { USB_DEVICE(0x07fa, 0x1196), .driver_info = DEVICE_ZD1211B }, | 88 | { USB_DEVICE(0x07fa, 0x1196), .driver_info = DEVICE_ZD1211B }, |
89 | { USB_DEVICE(0x0df6, 0x0036), .driver_info = DEVICE_ZD1211B }, | 89 | { USB_DEVICE(0x0df6, 0x0036), .driver_info = DEVICE_ZD1211B }, |
90 | { USB_DEVICE(0x07b8, 0x6001), .driver_info = DEVICE_ZD1211B }, | ||
90 | /* "Driverless" devices that need ejecting */ | 91 | /* "Driverless" devices that need ejecting */ |
91 | { USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER }, | 92 | { USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER }, |
92 | { USB_DEVICE(0x0ace, 0x20ff), .driver_info = DEVICE_INSTALLER }, | 93 | { USB_DEVICE(0x0ace, 0x20ff), .driver_info = DEVICE_INSTALLER }, |
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c index 3c7a5053f1da..a07580138e81 100644 --- a/drivers/net/yellowfin.c +++ b/drivers/net/yellowfin.c | |||
@@ -109,7 +109,7 @@ static int gx_fix; | |||
109 | /* These identify the driver base version and may not be removed. */ | 109 | /* These identify the driver base version and may not be removed. */ |
110 | static const char version[] __devinitconst = | 110 | static const char version[] __devinitconst = |
111 | KERN_INFO DRV_NAME ".c:v1.05 1/09/2001 Written by Donald Becker <becker@scyld.com>\n" | 111 | KERN_INFO DRV_NAME ".c:v1.05 1/09/2001 Written by Donald Becker <becker@scyld.com>\n" |
112 | KERN_INFO " (unofficial 2.4.x port, " DRV_VERSION ", " DRV_RELDATE ")\n"; | 112 | " (unofficial 2.4.x port, " DRV_VERSION ", " DRV_RELDATE ")\n"; |
113 | 113 | ||
114 | MODULE_AUTHOR("Donald Becker <becker@scyld.com>"); | 114 | MODULE_AUTHOR("Donald Becker <becker@scyld.com>"); |
115 | MODULE_DESCRIPTION("Packet Engines Yellowfin G-NIC Gigabit Ethernet driver"); | 115 | MODULE_DESCRIPTION("Packet Engines Yellowfin G-NIC Gigabit Ethernet driver"); |
@@ -700,12 +700,15 @@ static void yellowfin_tx_timeout(struct net_device *dev) | |||
700 | int i; | 700 | int i; |
701 | printk(KERN_WARNING " Rx ring %p: ", yp->rx_ring); | 701 | printk(KERN_WARNING " Rx ring %p: ", yp->rx_ring); |
702 | for (i = 0; i < RX_RING_SIZE; i++) | 702 | for (i = 0; i < RX_RING_SIZE; i++) |
703 | printk(" %8.8x", yp->rx_ring[i].result_status); | 703 | printk(KERN_CONT " %8.8x", |
704 | printk("\n"KERN_WARNING" Tx ring %p: ", yp->tx_ring); | 704 | yp->rx_ring[i].result_status); |
705 | printk(KERN_CONT "\n"); | ||
706 | printk(KERN_WARNING" Tx ring %p: ", yp->tx_ring); | ||
705 | for (i = 0; i < TX_RING_SIZE; i++) | 707 | for (i = 0; i < TX_RING_SIZE; i++) |
706 | printk(" %4.4x /%8.8x", yp->tx_status[i].tx_errs, | 708 | printk(KERN_CONT " %4.4x /%8.8x", |
707 | yp->tx_ring[i].result_status); | 709 | yp->tx_status[i].tx_errs, |
708 | printk("\n"); | 710 | yp->tx_ring[i].result_status); |
711 | printk(KERN_CONT "\n"); | ||
709 | } | 712 | } |
710 | 713 | ||
711 | /* If the hardware is found to hang regularly, we will update the code | 714 | /* If the hardware is found to hang regularly, we will update the code |
@@ -1216,20 +1219,20 @@ static int yellowfin_close(struct net_device *dev) | |||
1216 | 1219 | ||
1217 | #if defined(__i386__) | 1220 | #if defined(__i386__) |
1218 | if (yellowfin_debug > 2) { | 1221 | if (yellowfin_debug > 2) { |
1219 | printk("\n"KERN_DEBUG" Tx ring at %8.8llx:\n", | 1222 | printk(KERN_DEBUG" Tx ring at %8.8llx:\n", |
1220 | (unsigned long long)yp->tx_ring_dma); | 1223 | (unsigned long long)yp->tx_ring_dma); |
1221 | for (i = 0; i < TX_RING_SIZE*2; i++) | 1224 | for (i = 0; i < TX_RING_SIZE*2; i++) |
1222 | printk(" %c #%d desc. %8.8x %8.8x %8.8x %8.8x.\n", | 1225 | printk(KERN_DEBUG " %c #%d desc. %8.8x %8.8x %8.8x %8.8x.\n", |
1223 | ioread32(ioaddr + TxPtr) == (long)&yp->tx_ring[i] ? '>' : ' ', | 1226 | ioread32(ioaddr + TxPtr) == (long)&yp->tx_ring[i] ? '>' : ' ', |
1224 | i, yp->tx_ring[i].dbdma_cmd, yp->tx_ring[i].addr, | 1227 | i, yp->tx_ring[i].dbdma_cmd, yp->tx_ring[i].addr, |
1225 | yp->tx_ring[i].branch_addr, yp->tx_ring[i].result_status); | 1228 | yp->tx_ring[i].branch_addr, yp->tx_ring[i].result_status); |
1226 | printk(KERN_DEBUG " Tx status %p:\n", yp->tx_status); | 1229 | printk(KERN_DEBUG " Tx status %p:\n", yp->tx_status); |
1227 | for (i = 0; i < TX_RING_SIZE; i++) | 1230 | for (i = 0; i < TX_RING_SIZE; i++) |
1228 | printk(" #%d status %4.4x %4.4x %4.4x %4.4x.\n", | 1231 | printk(KERN_DEBUG " #%d status %4.4x %4.4x %4.4x %4.4x.\n", |
1229 | i, yp->tx_status[i].tx_cnt, yp->tx_status[i].tx_errs, | 1232 | i, yp->tx_status[i].tx_cnt, yp->tx_status[i].tx_errs, |
1230 | yp->tx_status[i].total_tx_cnt, yp->tx_status[i].paused); | 1233 | yp->tx_status[i].total_tx_cnt, yp->tx_status[i].paused); |
1231 | 1234 | ||
1232 | printk("\n"KERN_DEBUG " Rx ring %8.8llx:\n", | 1235 | printk(KERN_DEBUG " Rx ring %8.8llx:\n", |
1233 | (unsigned long long)yp->rx_ring_dma); | 1236 | (unsigned long long)yp->rx_ring_dma); |
1234 | for (i = 0; i < RX_RING_SIZE; i++) { | 1237 | for (i = 0; i < RX_RING_SIZE; i++) { |
1235 | printk(KERN_DEBUG " %c #%d desc. %8.8x %8.8x %8.8x\n", | 1238 | printk(KERN_DEBUG " %c #%d desc. %8.8x %8.8x %8.8x\n", |
diff --git a/drivers/oprofile/oprofile_stats.c b/drivers/oprofile/oprofile_stats.c index e1f6ce03705e..3c2270a8300c 100644 --- a/drivers/oprofile/oprofile_stats.c +++ b/drivers/oprofile/oprofile_stats.c | |||
@@ -33,6 +33,7 @@ void oprofile_reset_stats(void) | |||
33 | atomic_set(&oprofile_stats.sample_lost_no_mm, 0); | 33 | atomic_set(&oprofile_stats.sample_lost_no_mm, 0); |
34 | atomic_set(&oprofile_stats.sample_lost_no_mapping, 0); | 34 | atomic_set(&oprofile_stats.sample_lost_no_mapping, 0); |
35 | atomic_set(&oprofile_stats.event_lost_overflow, 0); | 35 | atomic_set(&oprofile_stats.event_lost_overflow, 0); |
36 | atomic_set(&oprofile_stats.bt_lost_no_mapping, 0); | ||
36 | } | 37 | } |
37 | 38 | ||
38 | 39 | ||
diff --git a/drivers/parisc/eisa_enumerator.c b/drivers/parisc/eisa_enumerator.c index c709ecc2b7f7..0be1d50645ab 100644 --- a/drivers/parisc/eisa_enumerator.c +++ b/drivers/parisc/eisa_enumerator.c | |||
@@ -101,7 +101,7 @@ static int configure_memory(const unsigned char *buf, | |||
101 | printk("memory %lx-%lx ", (unsigned long)res->start, (unsigned long)res->end); | 101 | printk("memory %lx-%lx ", (unsigned long)res->start, (unsigned long)res->end); |
102 | result = request_resource(mem_parent, res); | 102 | result = request_resource(mem_parent, res); |
103 | if (result < 0) { | 103 | if (result < 0) { |
104 | printk("\n" KERN_ERR "EISA Enumerator: failed to claim EISA Bus address space!\n"); | 104 | printk(KERN_ERR "EISA Enumerator: failed to claim EISA Bus address space!\n"); |
105 | return result; | 105 | return result; |
106 | } | 106 | } |
107 | } | 107 | } |
@@ -191,7 +191,7 @@ static int configure_port(const unsigned char *buf, struct resource *io_parent, | |||
191 | printk("ioports %lx-%lx ", (unsigned long)res->start, (unsigned long)res->end); | 191 | printk("ioports %lx-%lx ", (unsigned long)res->start, (unsigned long)res->end); |
192 | result = request_resource(io_parent, res); | 192 | result = request_resource(io_parent, res); |
193 | if (result < 0) { | 193 | if (result < 0) { |
194 | printk("\n" KERN_ERR "EISA Enumerator: failed to claim EISA Bus address space!\n"); | 194 | printk(KERN_ERR "EISA Enumerator: failed to claim EISA Bus address space!\n"); |
195 | return result; | 195 | return result; |
196 | } | 196 | } |
197 | } | 197 | } |
@@ -224,7 +224,7 @@ static int configure_port_init(const unsigned char *buf) | |||
224 | case HPEE_PORT_INIT_WIDTH_BYTE: | 224 | case HPEE_PORT_INIT_WIDTH_BYTE: |
225 | s=1; | 225 | s=1; |
226 | if (c & HPEE_PORT_INIT_MASK) { | 226 | if (c & HPEE_PORT_INIT_MASK) { |
227 | printk("\n" KERN_WARNING "port_init: unverified mask attribute\n"); | 227 | printk(KERN_WARNING "port_init: unverified mask attribute\n"); |
228 | outb((inb(get_16(buf+len+1) & | 228 | outb((inb(get_16(buf+len+1) & |
229 | get_8(buf+len+3)) | | 229 | get_8(buf+len+3)) | |
230 | get_8(buf+len+4)), get_16(buf+len+1)); | 230 | get_8(buf+len+4)), get_16(buf+len+1)); |
@@ -249,7 +249,7 @@ static int configure_port_init(const unsigned char *buf) | |||
249 | case HPEE_PORT_INIT_WIDTH_DWORD: | 249 | case HPEE_PORT_INIT_WIDTH_DWORD: |
250 | s=4; | 250 | s=4; |
251 | if (c & HPEE_PORT_INIT_MASK) { | 251 | if (c & HPEE_PORT_INIT_MASK) { |
252 | printk("\n" KERN_WARNING "port_init: unverified mask attribute\n"); | 252 | printk(KERN_WARNING "port_init: unverified mask attribute\n"); |
253 | outl((inl(get_16(buf+len+1) & | 253 | outl((inl(get_16(buf+len+1) & |
254 | get_32(buf+len+3)) | | 254 | get_32(buf+len+3)) | |
255 | get_32(buf+len+7)), get_16(buf+len+1)); | 255 | get_32(buf+len+7)), get_16(buf+len+1)); |
@@ -259,7 +259,7 @@ static int configure_port_init(const unsigned char *buf) | |||
259 | 259 | ||
260 | break; | 260 | break; |
261 | default: | 261 | default: |
262 | printk("\n" KERN_ERR "Invalid port init word %02x\n", c); | 262 | printk(KERN_ERR "Invalid port init word %02x\n", c); |
263 | return 0; | 263 | return 0; |
264 | } | 264 | } |
265 | 265 | ||
@@ -297,7 +297,7 @@ static int configure_type_string(const unsigned char *buf) | |||
297 | /* just skip past the type field */ | 297 | /* just skip past the type field */ |
298 | len = get_8(buf); | 298 | len = get_8(buf); |
299 | if (len > 80) { | 299 | if (len > 80) { |
300 | printk("\n" KERN_ERR "eisa_enumerator: type info field too long (%d, max is 80)\n", len); | 300 | printk(KERN_ERR "eisa_enumerator: type info field too long (%d, max is 80)\n", len); |
301 | } | 301 | } |
302 | 302 | ||
303 | return 1+len; | 303 | return 1+len; |
@@ -398,7 +398,7 @@ static int parse_slot_config(int slot, | |||
398 | } | 398 | } |
399 | 399 | ||
400 | if (p0 + function_len < pos) { | 400 | if (p0 + function_len < pos) { |
401 | printk("\n" KERN_ERR "eisa_enumerator: function %d length mis-match " | 401 | printk(KERN_ERR "eisa_enumerator: function %d length mis-match " |
402 | "got %d, expected %d\n", | 402 | "got %d, expected %d\n", |
403 | num_func, pos-p0, function_len); | 403 | num_func, pos-p0, function_len); |
404 | res=-1; | 404 | res=-1; |
diff --git a/drivers/pci/hotplug/cpci_hotplug_core.c b/drivers/pci/hotplug/cpci_hotplug_core.c index a5b9f6ae507b..d703e73fffa7 100644 --- a/drivers/pci/hotplug/cpci_hotplug_core.c +++ b/drivers/pci/hotplug/cpci_hotplug_core.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <linux/pci_hotplug.h> | 32 | #include <linux/pci_hotplug.h> |
33 | #include <linux/init.h> | 33 | #include <linux/init.h> |
34 | #include <linux/interrupt.h> | 34 | #include <linux/interrupt.h> |
35 | #include <linux/smp_lock.h> | ||
36 | #include <asm/atomic.h> | 35 | #include <asm/atomic.h> |
37 | #include <linux/delay.h> | 36 | #include <linux/delay.h> |
38 | #include <linux/kthread.h> | 37 | #include <linux/kthread.h> |
diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c index 2fa47af992a8..0ff689afa757 100644 --- a/drivers/pci/hotplug/cpqphp_ctrl.c +++ b/drivers/pci/hotplug/cpqphp_ctrl.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/interrupt.h> | 34 | #include <linux/interrupt.h> |
35 | #include <linux/delay.h> | 35 | #include <linux/delay.h> |
36 | #include <linux/wait.h> | 36 | #include <linux/wait.h> |
37 | #include <linux/smp_lock.h> | ||
38 | #include <linux/pci.h> | 37 | #include <linux/pci.h> |
39 | #include <linux/pci_hotplug.h> | 38 | #include <linux/pci_hotplug.h> |
40 | #include <linux/kthread.h> | 39 | #include <linux/kthread.h> |
diff --git a/drivers/pci/hotplug/cpqphp_sysfs.c b/drivers/pci/hotplug/cpqphp_sysfs.c index 8450f4a6568a..e6089bdb6e5b 100644 --- a/drivers/pci/hotplug/cpqphp_sysfs.c +++ b/drivers/pci/hotplug/cpqphp_sysfs.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/workqueue.h> | 33 | #include <linux/workqueue.h> |
34 | #include <linux/pci.h> | 34 | #include <linux/pci.h> |
35 | #include <linux/pci_hotplug.h> | 35 | #include <linux/pci_hotplug.h> |
36 | #include <linux/smp_lock.h> | ||
36 | #include <linux/debugfs.h> | 37 | #include <linux/debugfs.h> |
37 | #include "cpqphp.h" | 38 | #include "cpqphp.h" |
38 | 39 | ||
diff --git a/drivers/pci/hotplug/pci_hotplug_core.c b/drivers/pci/hotplug/pci_hotplug_core.c index 844580489d4d..5c5043f239cf 100644 --- a/drivers/pci/hotplug/pci_hotplug_core.c +++ b/drivers/pci/hotplug/pci_hotplug_core.c | |||
@@ -555,6 +555,8 @@ static struct hotplug_slot *get_slot_from_name (const char *name) | |||
555 | * @slot: pointer to the &struct hotplug_slot to register | 555 | * @slot: pointer to the &struct hotplug_slot to register |
556 | * @devnr: device number | 556 | * @devnr: device number |
557 | * @name: name registered with kobject core | 557 | * @name: name registered with kobject core |
558 | * @owner: caller module owner | ||
559 | * @mod_name: caller module name | ||
558 | * | 560 | * |
559 | * Registers a hotplug slot with the pci hotplug subsystem, which will allow | 561 | * Registers a hotplug slot with the pci hotplug subsystem, which will allow |
560 | * userspace interaction to the slot. | 562 | * userspace interaction to the slot. |
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c index ff4034502d24..8aab8edf123e 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <linux/module.h> | 30 | #include <linux/module.h> |
31 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
32 | #include <linux/types.h> | 32 | #include <linux/types.h> |
33 | #include <linux/smp_lock.h> | ||
34 | #include <linux/pci.h> | 33 | #include <linux/pci.h> |
35 | #include <linux/workqueue.h> | 34 | #include <linux/workqueue.h> |
36 | #include "../pci.h" | 35 | #include "../pci.h" |
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 53075424a434..ebc9b8dca881 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -2117,6 +2117,47 @@ static int domain_add_dev_info(struct dmar_domain *domain, | |||
2117 | return 0; | 2117 | return 0; |
2118 | } | 2118 | } |
2119 | 2119 | ||
2120 | static int iommu_should_identity_map(struct pci_dev *pdev, int startup) | ||
2121 | { | ||
2122 | if (iommu_identity_mapping == 2) | ||
2123 | return IS_GFX_DEVICE(pdev); | ||
2124 | |||
2125 | /* | ||
2126 | * We want to start off with all devices in the 1:1 domain, and | ||
2127 | * take them out later if we find they can't access all of memory. | ||
2128 | * | ||
2129 | * However, we can't do this for PCI devices behind bridges, | ||
2130 | * because all PCI devices behind the same bridge will end up | ||
2131 | * with the same source-id on their transactions. | ||
2132 | * | ||
2133 | * Practically speaking, we can't change things around for these | ||
2134 | * devices at run-time, because we can't be sure there'll be no | ||
2135 | * DMA transactions in flight for any of their siblings. | ||
2136 | * | ||
2137 | * So PCI devices (unless they're on the root bus) as well as | ||
2138 | * their parent PCI-PCI or PCIe-PCI bridges must be left _out_ of | ||
2139 | * the 1:1 domain, just in _case_ one of their siblings turns out | ||
2140 | * not to be able to map all of memory. | ||
2141 | */ | ||
2142 | if (!pdev->is_pcie) { | ||
2143 | if (!pci_is_root_bus(pdev->bus)) | ||
2144 | return 0; | ||
2145 | if (pdev->class >> 8 == PCI_CLASS_BRIDGE_PCI) | ||
2146 | return 0; | ||
2147 | } else if (pdev->pcie_type == PCI_EXP_TYPE_PCI_BRIDGE) | ||
2148 | return 0; | ||
2149 | |||
2150 | /* | ||
2151 | * At boot time, we don't yet know if devices will be 64-bit capable. | ||
2152 | * Assume that they will -- if they turn out not to be, then we can | ||
2153 | * take them out of the 1:1 domain later. | ||
2154 | */ | ||
2155 | if (!startup) | ||
2156 | return pdev->dma_mask > DMA_BIT_MASK(32); | ||
2157 | |||
2158 | return 1; | ||
2159 | } | ||
2160 | |||
2120 | static int iommu_prepare_static_identity_mapping(void) | 2161 | static int iommu_prepare_static_identity_mapping(void) |
2121 | { | 2162 | { |
2122 | struct pci_dev *pdev = NULL; | 2163 | struct pci_dev *pdev = NULL; |
@@ -2127,16 +2168,18 @@ static int iommu_prepare_static_identity_mapping(void) | |||
2127 | return -EFAULT; | 2168 | return -EFAULT; |
2128 | 2169 | ||
2129 | for_each_pci_dev(pdev) { | 2170 | for_each_pci_dev(pdev) { |
2130 | printk(KERN_INFO "IOMMU: identity mapping for device %s\n", | 2171 | if (iommu_should_identity_map(pdev, 1)) { |
2131 | pci_name(pdev)); | 2172 | printk(KERN_INFO "IOMMU: identity mapping for device %s\n", |
2173 | pci_name(pdev)); | ||
2132 | 2174 | ||
2133 | ret = domain_context_mapping(si_domain, pdev, | 2175 | ret = domain_context_mapping(si_domain, pdev, |
2134 | CONTEXT_TT_MULTI_LEVEL); | 2176 | CONTEXT_TT_MULTI_LEVEL); |
2135 | if (ret) | 2177 | if (ret) |
2136 | return ret; | 2178 | return ret; |
2137 | ret = domain_add_dev_info(si_domain, pdev); | 2179 | ret = domain_add_dev_info(si_domain, pdev); |
2138 | if (ret) | 2180 | if (ret) |
2139 | return ret; | 2181 | return ret; |
2182 | } | ||
2140 | } | 2183 | } |
2141 | 2184 | ||
2142 | return 0; | 2185 | return 0; |
@@ -2291,6 +2334,10 @@ int __init init_dmars(void) | |||
2291 | * identity mapping if iommu_identity_mapping is set. | 2334 | * identity mapping if iommu_identity_mapping is set. |
2292 | */ | 2335 | */ |
2293 | if (!iommu_pass_through) { | 2336 | if (!iommu_pass_through) { |
2337 | #ifdef CONFIG_DMAR_BROKEN_GFX_WA | ||
2338 | if (!iommu_identity_mapping) | ||
2339 | iommu_identity_mapping = 2; | ||
2340 | #endif | ||
2294 | if (iommu_identity_mapping) | 2341 | if (iommu_identity_mapping) |
2295 | iommu_prepare_static_identity_mapping(); | 2342 | iommu_prepare_static_identity_mapping(); |
2296 | /* | 2343 | /* |
@@ -2368,15 +2415,15 @@ error: | |||
2368 | return ret; | 2415 | return ret; |
2369 | } | 2416 | } |
2370 | 2417 | ||
2418 | /* Returns a number of VTD pages, but aligned to MM page size */ | ||
2371 | static inline unsigned long aligned_nrpages(unsigned long host_addr, | 2419 | static inline unsigned long aligned_nrpages(unsigned long host_addr, |
2372 | size_t size) | 2420 | size_t size) |
2373 | { | 2421 | { |
2374 | host_addr &= ~PAGE_MASK; | 2422 | host_addr &= ~PAGE_MASK; |
2375 | host_addr += size + PAGE_SIZE - 1; | 2423 | return PAGE_ALIGN(host_addr + size) >> VTD_PAGE_SHIFT; |
2376 | |||
2377 | return host_addr >> VTD_PAGE_SHIFT; | ||
2378 | } | 2424 | } |
2379 | 2425 | ||
2426 | /* This takes a number of _MM_ pages, not VTD pages */ | ||
2380 | static struct iova *intel_alloc_iova(struct device *dev, | 2427 | static struct iova *intel_alloc_iova(struct device *dev, |
2381 | struct dmar_domain *domain, | 2428 | struct dmar_domain *domain, |
2382 | unsigned long nrpages, uint64_t dma_mask) | 2429 | unsigned long nrpages, uint64_t dma_mask) |
@@ -2443,16 +2490,24 @@ static int iommu_dummy(struct pci_dev *pdev) | |||
2443 | } | 2490 | } |
2444 | 2491 | ||
2445 | /* Check if the pdev needs to go through non-identity map and unmap process.*/ | 2492 | /* Check if the pdev needs to go through non-identity map and unmap process.*/ |
2446 | static int iommu_no_mapping(struct pci_dev *pdev) | 2493 | static int iommu_no_mapping(struct device *dev) |
2447 | { | 2494 | { |
2495 | struct pci_dev *pdev; | ||
2448 | int found; | 2496 | int found; |
2449 | 2497 | ||
2498 | if (unlikely(dev->bus != &pci_bus_type)) | ||
2499 | return 1; | ||
2500 | |||
2501 | pdev = to_pci_dev(dev); | ||
2502 | if (iommu_dummy(pdev)) | ||
2503 | return 1; | ||
2504 | |||
2450 | if (!iommu_identity_mapping) | 2505 | if (!iommu_identity_mapping) |
2451 | return iommu_dummy(pdev); | 2506 | return 0; |
2452 | 2507 | ||
2453 | found = identity_mapping(pdev); | 2508 | found = identity_mapping(pdev); |
2454 | if (found) { | 2509 | if (found) { |
2455 | if (pdev->dma_mask > DMA_BIT_MASK(32)) | 2510 | if (iommu_should_identity_map(pdev, 0)) |
2456 | return 1; | 2511 | return 1; |
2457 | else { | 2512 | else { |
2458 | /* | 2513 | /* |
@@ -2469,9 +2524,12 @@ static int iommu_no_mapping(struct pci_dev *pdev) | |||
2469 | * In case of a detached 64 bit DMA device from vm, the device | 2524 | * In case of a detached 64 bit DMA device from vm, the device |
2470 | * is put into si_domain for identity mapping. | 2525 | * is put into si_domain for identity mapping. |
2471 | */ | 2526 | */ |
2472 | if (pdev->dma_mask > DMA_BIT_MASK(32)) { | 2527 | if (iommu_should_identity_map(pdev, 0)) { |
2473 | int ret; | 2528 | int ret; |
2474 | ret = domain_add_dev_info(si_domain, pdev); | 2529 | ret = domain_add_dev_info(si_domain, pdev); |
2530 | if (ret) | ||
2531 | return 0; | ||
2532 | ret = domain_context_mapping(si_domain, pdev, CONTEXT_TT_MULTI_LEVEL); | ||
2475 | if (!ret) { | 2533 | if (!ret) { |
2476 | printk(KERN_INFO "64bit %s uses identity mapping\n", | 2534 | printk(KERN_INFO "64bit %s uses identity mapping\n", |
2477 | pci_name(pdev)); | 2535 | pci_name(pdev)); |
@@ -2480,7 +2538,7 @@ static int iommu_no_mapping(struct pci_dev *pdev) | |||
2480 | } | 2538 | } |
2481 | } | 2539 | } |
2482 | 2540 | ||
2483 | return iommu_dummy(pdev); | 2541 | return 0; |
2484 | } | 2542 | } |
2485 | 2543 | ||
2486 | static dma_addr_t __intel_map_single(struct device *hwdev, phys_addr_t paddr, | 2544 | static dma_addr_t __intel_map_single(struct device *hwdev, phys_addr_t paddr, |
@@ -2496,7 +2554,7 @@ static dma_addr_t __intel_map_single(struct device *hwdev, phys_addr_t paddr, | |||
2496 | 2554 | ||
2497 | BUG_ON(dir == DMA_NONE); | 2555 | BUG_ON(dir == DMA_NONE); |
2498 | 2556 | ||
2499 | if (iommu_no_mapping(pdev)) | 2557 | if (iommu_no_mapping(hwdev)) |
2500 | return paddr; | 2558 | return paddr; |
2501 | 2559 | ||
2502 | domain = get_valid_domain_for_dev(pdev); | 2560 | domain = get_valid_domain_for_dev(pdev); |
@@ -2506,7 +2564,8 @@ static dma_addr_t __intel_map_single(struct device *hwdev, phys_addr_t paddr, | |||
2506 | iommu = domain_get_iommu(domain); | 2564 | iommu = domain_get_iommu(domain); |
2507 | size = aligned_nrpages(paddr, size); | 2565 | size = aligned_nrpages(paddr, size); |
2508 | 2566 | ||
2509 | iova = intel_alloc_iova(hwdev, domain, size, pdev->dma_mask); | 2567 | iova = intel_alloc_iova(hwdev, domain, dma_to_mm_pfn(size), |
2568 | pdev->dma_mask); | ||
2510 | if (!iova) | 2569 | if (!iova) |
2511 | goto error; | 2570 | goto error; |
2512 | 2571 | ||
@@ -2635,7 +2694,7 @@ static void intel_unmap_page(struct device *dev, dma_addr_t dev_addr, | |||
2635 | struct iova *iova; | 2694 | struct iova *iova; |
2636 | struct intel_iommu *iommu; | 2695 | struct intel_iommu *iommu; |
2637 | 2696 | ||
2638 | if (iommu_no_mapping(pdev)) | 2697 | if (iommu_no_mapping(dev)) |
2639 | return; | 2698 | return; |
2640 | 2699 | ||
2641 | domain = find_domain(pdev); | 2700 | domain = find_domain(pdev); |
@@ -2726,7 +2785,7 @@ static void intel_unmap_sg(struct device *hwdev, struct scatterlist *sglist, | |||
2726 | struct iova *iova; | 2785 | struct iova *iova; |
2727 | struct intel_iommu *iommu; | 2786 | struct intel_iommu *iommu; |
2728 | 2787 | ||
2729 | if (iommu_no_mapping(pdev)) | 2788 | if (iommu_no_mapping(hwdev)) |
2730 | return; | 2789 | return; |
2731 | 2790 | ||
2732 | domain = find_domain(pdev); | 2791 | domain = find_domain(pdev); |
@@ -2785,7 +2844,7 @@ static int intel_map_sg(struct device *hwdev, struct scatterlist *sglist, int ne | |||
2785 | struct intel_iommu *iommu; | 2844 | struct intel_iommu *iommu; |
2786 | 2845 | ||
2787 | BUG_ON(dir == DMA_NONE); | 2846 | BUG_ON(dir == DMA_NONE); |
2788 | if (iommu_no_mapping(pdev)) | 2847 | if (iommu_no_mapping(hwdev)) |
2789 | return intel_nontranslate_map_sg(hwdev, sglist, nelems, dir); | 2848 | return intel_nontranslate_map_sg(hwdev, sglist, nelems, dir); |
2790 | 2849 | ||
2791 | domain = get_valid_domain_for_dev(pdev); | 2850 | domain = get_valid_domain_for_dev(pdev); |
@@ -2797,7 +2856,8 @@ static int intel_map_sg(struct device *hwdev, struct scatterlist *sglist, int ne | |||
2797 | for_each_sg(sglist, sg, nelems, i) | 2856 | for_each_sg(sglist, sg, nelems, i) |
2798 | size += aligned_nrpages(sg->offset, sg->length); | 2857 | size += aligned_nrpages(sg->offset, sg->length); |
2799 | 2858 | ||
2800 | iova = intel_alloc_iova(hwdev, domain, size, pdev->dma_mask); | 2859 | iova = intel_alloc_iova(hwdev, domain, dma_to_mm_pfn(size), |
2860 | pdev->dma_mask); | ||
2801 | if (!iova) { | 2861 | if (!iova) { |
2802 | sglist->dma_length = 0; | 2862 | sglist->dma_length = 0; |
2803 | return 0; | 2863 | return 0; |
@@ -3540,6 +3600,9 @@ static void intel_iommu_unmap_range(struct iommu_domain *domain, | |||
3540 | { | 3600 | { |
3541 | struct dmar_domain *dmar_domain = domain->priv; | 3601 | struct dmar_domain *dmar_domain = domain->priv; |
3542 | 3602 | ||
3603 | if (!size) | ||
3604 | return; | ||
3605 | |||
3543 | dma_pte_clear_range(dmar_domain, iova >> VTD_PAGE_SHIFT, | 3606 | dma_pte_clear_range(dmar_domain, iova >> VTD_PAGE_SHIFT, |
3544 | (iova + size - 1) >> VTD_PAGE_SHIFT); | 3607 | (iova + size - 1) >> VTD_PAGE_SHIFT); |
3545 | 3608 | ||
diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c index d9f06fbfa0bf..d986afb7032b 100644 --- a/drivers/pci/msi.c +++ b/drivers/pci/msi.c | |||
@@ -127,17 +127,23 @@ static inline __attribute_const__ u32 msi_enabled_mask(u16 control) | |||
127 | * reliably as devices without an INTx disable bit will then generate a | 127 | * reliably as devices without an INTx disable bit will then generate a |
128 | * level IRQ which will never be cleared. | 128 | * level IRQ which will never be cleared. |
129 | */ | 129 | */ |
130 | static void msi_mask_irq(struct msi_desc *desc, u32 mask, u32 flag) | 130 | static u32 __msi_mask_irq(struct msi_desc *desc, u32 mask, u32 flag) |
131 | { | 131 | { |
132 | u32 mask_bits = desc->masked; | 132 | u32 mask_bits = desc->masked; |
133 | 133 | ||
134 | if (!desc->msi_attrib.maskbit) | 134 | if (!desc->msi_attrib.maskbit) |
135 | return; | 135 | return 0; |
136 | 136 | ||
137 | mask_bits &= ~mask; | 137 | mask_bits &= ~mask; |
138 | mask_bits |= flag; | 138 | mask_bits |= flag; |
139 | pci_write_config_dword(desc->dev, desc->mask_pos, mask_bits); | 139 | pci_write_config_dword(desc->dev, desc->mask_pos, mask_bits); |
140 | desc->masked = mask_bits; | 140 | |
141 | return mask_bits; | ||
142 | } | ||
143 | |||
144 | static void msi_mask_irq(struct msi_desc *desc, u32 mask, u32 flag) | ||
145 | { | ||
146 | desc->masked = __msi_mask_irq(desc, mask, flag); | ||
141 | } | 147 | } |
142 | 148 | ||
143 | /* | 149 | /* |
@@ -147,15 +153,21 @@ static void msi_mask_irq(struct msi_desc *desc, u32 mask, u32 flag) | |||
147 | * file. This saves a few milliseconds when initialising devices with lots | 153 | * file. This saves a few milliseconds when initialising devices with lots |
148 | * of MSI-X interrupts. | 154 | * of MSI-X interrupts. |
149 | */ | 155 | */ |
150 | static void msix_mask_irq(struct msi_desc *desc, u32 flag) | 156 | static u32 __msix_mask_irq(struct msi_desc *desc, u32 flag) |
151 | { | 157 | { |
152 | u32 mask_bits = desc->masked; | 158 | u32 mask_bits = desc->masked; |
153 | unsigned offset = desc->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE + | 159 | unsigned offset = desc->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE + |
154 | PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET; | 160 | PCI_MSIX_ENTRY_VECTOR_CTRL; |
155 | mask_bits &= ~1; | 161 | mask_bits &= ~1; |
156 | mask_bits |= flag; | 162 | mask_bits |= flag; |
157 | writel(mask_bits, desc->mask_base + offset); | 163 | writel(mask_bits, desc->mask_base + offset); |
158 | desc->masked = mask_bits; | 164 | |
165 | return mask_bits; | ||
166 | } | ||
167 | |||
168 | static void msix_mask_irq(struct msi_desc *desc, u32 flag) | ||
169 | { | ||
170 | desc->masked = __msix_mask_irq(desc, flag); | ||
159 | } | 171 | } |
160 | 172 | ||
161 | static void msi_set_mask_bit(unsigned irq, u32 flag) | 173 | static void msi_set_mask_bit(unsigned irq, u32 flag) |
@@ -188,9 +200,9 @@ void read_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg) | |||
188 | void __iomem *base = entry->mask_base + | 200 | void __iomem *base = entry->mask_base + |
189 | entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE; | 201 | entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE; |
190 | 202 | ||
191 | msg->address_lo = readl(base + PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET); | 203 | msg->address_lo = readl(base + PCI_MSIX_ENTRY_LOWER_ADDR); |
192 | msg->address_hi = readl(base + PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET); | 204 | msg->address_hi = readl(base + PCI_MSIX_ENTRY_UPPER_ADDR); |
193 | msg->data = readl(base + PCI_MSIX_ENTRY_DATA_OFFSET); | 205 | msg->data = readl(base + PCI_MSIX_ENTRY_DATA); |
194 | } else { | 206 | } else { |
195 | struct pci_dev *dev = entry->dev; | 207 | struct pci_dev *dev = entry->dev; |
196 | int pos = entry->msi_attrib.pos; | 208 | int pos = entry->msi_attrib.pos; |
@@ -225,11 +237,9 @@ void write_msi_msg_desc(struct irq_desc *desc, struct msi_msg *msg) | |||
225 | base = entry->mask_base + | 237 | base = entry->mask_base + |
226 | entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE; | 238 | entry->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE; |
227 | 239 | ||
228 | writel(msg->address_lo, | 240 | writel(msg->address_lo, base + PCI_MSIX_ENTRY_LOWER_ADDR); |
229 | base + PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET); | 241 | writel(msg->address_hi, base + PCI_MSIX_ENTRY_UPPER_ADDR); |
230 | writel(msg->address_hi, | 242 | writel(msg->data, base + PCI_MSIX_ENTRY_DATA); |
231 | base + PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET); | ||
232 | writel(msg->data, base + PCI_MSIX_ENTRY_DATA_OFFSET); | ||
233 | } else { | 243 | } else { |
234 | struct pci_dev *dev = entry->dev; | 244 | struct pci_dev *dev = entry->dev; |
235 | int pos = entry->msi_attrib.pos; | 245 | int pos = entry->msi_attrib.pos; |
@@ -385,6 +395,7 @@ static int msi_capability_init(struct pci_dev *dev, int nvec) | |||
385 | /* Configure MSI capability structure */ | 395 | /* Configure MSI capability structure */ |
386 | ret = arch_setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSI); | 396 | ret = arch_setup_msi_irqs(dev, nvec, PCI_CAP_ID_MSI); |
387 | if (ret) { | 397 | if (ret) { |
398 | msi_mask_irq(entry, mask, ~mask); | ||
388 | msi_free_irqs(dev); | 399 | msi_free_irqs(dev); |
389 | return ret; | 400 | return ret; |
390 | } | 401 | } |
@@ -439,8 +450,14 @@ static int msix_capability_init(struct pci_dev *dev, | |||
439 | 450 | ||
440 | for (i = 0; i < nvec; i++) { | 451 | for (i = 0; i < nvec; i++) { |
441 | entry = alloc_msi_entry(dev); | 452 | entry = alloc_msi_entry(dev); |
442 | if (!entry) | 453 | if (!entry) { |
443 | break; | 454 | if (!i) |
455 | iounmap(base); | ||
456 | else | ||
457 | msi_free_irqs(dev); | ||
458 | /* No enough memory. Don't try again */ | ||
459 | return -ENOMEM; | ||
460 | } | ||
444 | 461 | ||
445 | j = entries[i].entry; | 462 | j = entries[i].entry; |
446 | entry->msi_attrib.is_msix = 1; | 463 | entry->msi_attrib.is_msix = 1; |
@@ -487,7 +504,7 @@ static int msix_capability_init(struct pci_dev *dev, | |||
487 | set_irq_msi(entry->irq, entry); | 504 | set_irq_msi(entry->irq, entry); |
488 | j = entries[i].entry; | 505 | j = entries[i].entry; |
489 | entry->masked = readl(base + j * PCI_MSIX_ENTRY_SIZE + | 506 | entry->masked = readl(base + j * PCI_MSIX_ENTRY_SIZE + |
490 | PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET); | 507 | PCI_MSIX_ENTRY_VECTOR_CTRL); |
491 | msix_mask_irq(entry, 1); | 508 | msix_mask_irq(entry, 1); |
492 | i++; | 509 | i++; |
493 | } | 510 | } |
@@ -611,9 +628,11 @@ void pci_msi_shutdown(struct pci_dev *dev) | |||
611 | pci_intx_for_msi(dev, 1); | 628 | pci_intx_for_msi(dev, 1); |
612 | dev->msi_enabled = 0; | 629 | dev->msi_enabled = 0; |
613 | 630 | ||
631 | /* Return the device with MSI unmasked as initial states */ | ||
614 | pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &ctrl); | 632 | pci_read_config_word(dev, pos + PCI_MSI_FLAGS, &ctrl); |
615 | mask = msi_capable_mask(ctrl); | 633 | mask = msi_capable_mask(ctrl); |
616 | msi_mask_irq(desc, mask, ~mask); | 634 | /* Keep cached state to be restored */ |
635 | __msi_mask_irq(desc, mask, ~mask); | ||
617 | 636 | ||
618 | /* Restore dev->irq to its default pin-assertion irq */ | 637 | /* Restore dev->irq to its default pin-assertion irq */ |
619 | dev->irq = desc->msi_attrib.default_irq; | 638 | dev->irq = desc->msi_attrib.default_irq; |
@@ -653,7 +672,6 @@ static int msi_free_irqs(struct pci_dev* dev) | |||
653 | 672 | ||
654 | list_for_each_entry_safe(entry, tmp, &dev->msi_list, list) { | 673 | list_for_each_entry_safe(entry, tmp, &dev->msi_list, list) { |
655 | if (entry->msi_attrib.is_msix) { | 674 | if (entry->msi_attrib.is_msix) { |
656 | msix_mask_irq(entry, 1); | ||
657 | if (list_is_last(&entry->list, &dev->msi_list)) | 675 | if (list_is_last(&entry->list, &dev->msi_list)) |
658 | iounmap(entry->mask_base); | 676 | iounmap(entry->mask_base); |
659 | } | 677 | } |
@@ -741,9 +759,17 @@ static void msix_free_all_irqs(struct pci_dev *dev) | |||
741 | 759 | ||
742 | void pci_msix_shutdown(struct pci_dev* dev) | 760 | void pci_msix_shutdown(struct pci_dev* dev) |
743 | { | 761 | { |
762 | struct msi_desc *entry; | ||
763 | |||
744 | if (!pci_msi_enable || !dev || !dev->msix_enabled) | 764 | if (!pci_msi_enable || !dev || !dev->msix_enabled) |
745 | return; | 765 | return; |
746 | 766 | ||
767 | /* Return the device with MSI-X masked as initial states */ | ||
768 | list_for_each_entry(entry, &dev->msi_list, list) { | ||
769 | /* Keep cached states to be restored */ | ||
770 | __msix_mask_irq(entry, 1); | ||
771 | } | ||
772 | |||
747 | msix_set_enable(dev, 0); | 773 | msix_set_enable(dev, 0); |
748 | pci_intx_for_msi(dev, 1); | 774 | pci_intx_for_msi(dev, 1); |
749 | dev->msix_enabled = 0; | 775 | dev->msix_enabled = 0; |
diff --git a/drivers/pci/msi.h b/drivers/pci/msi.h index a0662842550b..de27c1cb5a2b 100644 --- a/drivers/pci/msi.h +++ b/drivers/pci/msi.h | |||
@@ -6,11 +6,11 @@ | |||
6 | #ifndef MSI_H | 6 | #ifndef MSI_H |
7 | #define MSI_H | 7 | #define MSI_H |
8 | 8 | ||
9 | #define PCI_MSIX_ENTRY_SIZE 16 | 9 | #define PCI_MSIX_ENTRY_SIZE 16 |
10 | #define PCI_MSIX_ENTRY_LOWER_ADDR_OFFSET 0 | 10 | #define PCI_MSIX_ENTRY_LOWER_ADDR 0 |
11 | #define PCI_MSIX_ENTRY_UPPER_ADDR_OFFSET 4 | 11 | #define PCI_MSIX_ENTRY_UPPER_ADDR 4 |
12 | #define PCI_MSIX_ENTRY_DATA_OFFSET 8 | 12 | #define PCI_MSIX_ENTRY_DATA 8 |
13 | #define PCI_MSIX_ENTRY_VECTOR_CTRL_OFFSET 12 | 13 | #define PCI_MSIX_ENTRY_VECTOR_CTRL 12 |
14 | 14 | ||
15 | #define msi_control_reg(base) (base + PCI_MSI_FLAGS) | 15 | #define msi_control_reg(base) (base + PCI_MSI_FLAGS) |
16 | #define msi_lower_address_reg(base) (base + PCI_MSI_ADDRESS_LO) | 16 | #define msi_lower_address_reg(base) (base + PCI_MSI_ADDRESS_LO) |
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 6c93af5ced18..dbd0f947f497 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -1517,11 +1517,20 @@ void pci_enable_ari(struct pci_dev *dev) | |||
1517 | * | 1517 | * |
1518 | * Perform INTx swizzling for a device behind one level of bridge. This is | 1518 | * Perform INTx swizzling for a device behind one level of bridge. This is |
1519 | * required by section 9.1 of the PCI-to-PCI bridge specification for devices | 1519 | * required by section 9.1 of the PCI-to-PCI bridge specification for devices |
1520 | * behind bridges on add-in cards. | 1520 | * behind bridges on add-in cards. For devices with ARI enabled, the slot |
1521 | * number is always 0 (see the Implementation Note in section 2.2.8.1 of | ||
1522 | * the PCI Express Base Specification, Revision 2.1) | ||
1521 | */ | 1523 | */ |
1522 | u8 pci_swizzle_interrupt_pin(struct pci_dev *dev, u8 pin) | 1524 | u8 pci_swizzle_interrupt_pin(struct pci_dev *dev, u8 pin) |
1523 | { | 1525 | { |
1524 | return (((pin - 1) + PCI_SLOT(dev->devfn)) % 4) + 1; | 1526 | int slot; |
1527 | |||
1528 | if (pci_ari_enabled(dev->bus)) | ||
1529 | slot = 0; | ||
1530 | else | ||
1531 | slot = PCI_SLOT(dev->devfn); | ||
1532 | |||
1533 | return (((pin - 1) + slot) % 4) + 1; | ||
1525 | } | 1534 | } |
1526 | 1535 | ||
1527 | int | 1536 | int |
@@ -2171,7 +2180,7 @@ static int pci_parent_bus_reset(struct pci_dev *dev, int probe) | |||
2171 | u16 ctrl; | 2180 | u16 ctrl; |
2172 | struct pci_dev *pdev; | 2181 | struct pci_dev *pdev; |
2173 | 2182 | ||
2174 | if (dev->subordinate) | 2183 | if (pci_is_root_bus(dev->bus) || dev->subordinate || !dev->bus->self) |
2175 | return -ENOTTY; | 2184 | return -ENOTTY; |
2176 | 2185 | ||
2177 | list_for_each_entry(pdev, &dev->bus->devices, bus_list) | 2186 | list_for_each_entry(pdev, &dev->bus->devices, bus_list) |
diff --git a/drivers/pci/pcie/aer/ecrc.c b/drivers/pci/pcie/aer/ecrc.c index ece97df4df6d..a928d8ab6bda 100644 --- a/drivers/pci/pcie/aer/ecrc.c +++ b/drivers/pci/pcie/aer/ecrc.c | |||
@@ -106,7 +106,7 @@ void pcie_set_ecrc_checking(struct pci_dev *dev) | |||
106 | disable_ecrc_checking(dev); | 106 | disable_ecrc_checking(dev); |
107 | break; | 107 | break; |
108 | case ECRC_POLICY_ON: | 108 | case ECRC_POLICY_ON: |
109 | enable_ecrc_checking(dev);; | 109 | enable_ecrc_checking(dev); |
110 | break; | 110 | break; |
111 | default: | 111 | default: |
112 | return; | 112 | return; |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 56552d74abea..06b965623962 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -1058,6 +1058,11 @@ static void __devinit quirk_no_ata_d3(struct pci_dev *pdev) | |||
1058 | } | 1058 | } |
1059 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, PCI_ANY_ID, quirk_no_ata_d3); | 1059 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, PCI_ANY_ID, quirk_no_ata_d3); |
1060 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_ATI, PCI_ANY_ID, quirk_no_ata_d3); | 1060 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_ATI, PCI_ANY_ID, quirk_no_ata_d3); |
1061 | /* ALi loses some register settings that we cannot then restore */ | ||
1062 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_AL, PCI_ANY_ID, quirk_no_ata_d3); | ||
1063 | /* VIA comes back fine but we need to keep it alive or ACPI GTM failures | ||
1064 | occur when mode detecting */ | ||
1065 | DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_VIA, PCI_ANY_ID, quirk_no_ata_d3); | ||
1061 | 1066 | ||
1062 | /* This was originally an Alpha specific thing, but it really fits here. | 1067 | /* This was originally an Alpha specific thing, but it really fits here. |
1063 | * The i82375 PCI/EISA bridge appears as non-classified. Fix that. | 1068 | * The i82375 PCI/EISA bridge appears as non-classified. Fix that. |
diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c index eddb0748b0ea..8c02b6c53bdb 100644 --- a/drivers/pci/slot.c +++ b/drivers/pci/slot.c | |||
@@ -311,7 +311,7 @@ EXPORT_SYMBOL_GPL(pci_destroy_slot); | |||
311 | #include <linux/pci_hotplug.h> | 311 | #include <linux/pci_hotplug.h> |
312 | /** | 312 | /** |
313 | * pci_hp_create_link - create symbolic link to the hotplug driver module. | 313 | * pci_hp_create_link - create symbolic link to the hotplug driver module. |
314 | * @slot: struct pci_slot | 314 | * @pci_slot: struct pci_slot |
315 | * | 315 | * |
316 | * Helper function for pci_hotplug_core.c to create symbolic link to | 316 | * Helper function for pci_hotplug_core.c to create symbolic link to |
317 | * the hotplug driver module. | 317 | * the hotplug driver module. |
@@ -334,7 +334,7 @@ EXPORT_SYMBOL_GPL(pci_hp_create_module_link); | |||
334 | 334 | ||
335 | /** | 335 | /** |
336 | * pci_hp_remove_link - remove symbolic link to the hotplug driver module. | 336 | * pci_hp_remove_link - remove symbolic link to the hotplug driver module. |
337 | * @slot: struct pci_slot | 337 | * @pci_slot: struct pci_slot |
338 | * | 338 | * |
339 | * Helper function for pci_hotplug_core.c to remove symbolic link to | 339 | * Helper function for pci_hotplug_core.c to remove symbolic link to |
340 | * the hotplug driver module. | 340 | * the hotplug driver module. |
diff --git a/drivers/pci/syscall.c b/drivers/pci/syscall.c index ec22284eed30..e1c1ec540893 100644 --- a/drivers/pci/syscall.c +++ b/drivers/pci/syscall.c | |||
@@ -9,7 +9,6 @@ | |||
9 | 9 | ||
10 | #include <linux/errno.h> | 10 | #include <linux/errno.h> |
11 | #include <linux/pci.h> | 11 | #include <linux/pci.h> |
12 | #include <linux/smp_lock.h> | ||
13 | #include <linux/syscalls.h> | 12 | #include <linux/syscalls.h> |
14 | #include <asm/uaccess.h> | 13 | #include <asm/uaccess.h> |
15 | #include "pci.h" | 14 | #include "pci.h" |
diff --git a/drivers/pcmcia/tcic.c b/drivers/pcmcia/tcic.c index 9ad97ea836e8..8eb04230fec7 100644 --- a/drivers/pcmcia/tcic.c +++ b/drivers/pcmcia/tcic.c | |||
@@ -472,7 +472,8 @@ static int __init init_tcic(void) | |||
472 | init_timer(&poll_timer); | 472 | init_timer(&poll_timer); |
473 | 473 | ||
474 | /* Build interrupt mask */ | 474 | /* Build interrupt mask */ |
475 | printk(", %d sockets\n" KERN_INFO " irq list (", sockets); | 475 | printk(KERN_CONT ", %d sockets\n", sockets); |
476 | printk(KERN_INFO " irq list ("); | ||
476 | if (irq_list_count == 0) | 477 | if (irq_list_count == 0) |
477 | mask = irq_mask; | 478 | mask = irq_mask; |
478 | else | 479 | else |
diff --git a/drivers/platform/x86/hp-wmi.c b/drivers/platform/x86/hp-wmi.c index 4ac2311c00af..ca508564a181 100644 --- a/drivers/platform/x86/hp-wmi.c +++ b/drivers/platform/x86/hp-wmi.c | |||
@@ -171,7 +171,7 @@ static int hp_wmi_tablet_state(void) | |||
171 | static int hp_wmi_set_block(void *data, bool blocked) | 171 | static int hp_wmi_set_block(void *data, bool blocked) |
172 | { | 172 | { |
173 | unsigned long b = (unsigned long) data; | 173 | unsigned long b = (unsigned long) data; |
174 | int query = BIT(b + 8) | ((!!blocked) << b); | 174 | int query = BIT(b + 8) | ((!blocked) << b); |
175 | 175 | ||
176 | return hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 1, query); | 176 | return hp_wmi_perform_query(HPWMI_WIRELESS_QUERY, 1, query); |
177 | } | 177 | } |
diff --git a/drivers/power/wm97xx_battery.c b/drivers/power/wm97xx_battery.c index 8bde92126d34..b787335a8419 100644 --- a/drivers/power/wm97xx_battery.c +++ b/drivers/power/wm97xx_battery.c | |||
@@ -33,14 +33,14 @@ static enum power_supply_property *prop; | |||
33 | 33 | ||
34 | static unsigned long wm97xx_read_bat(struct power_supply *bat_ps) | 34 | static unsigned long wm97xx_read_bat(struct power_supply *bat_ps) |
35 | { | 35 | { |
36 | return wm97xx_read_aux_adc(bat_ps->dev->parent->driver_data, | 36 | return wm97xx_read_aux_adc(dev_get_drvdata(bat_ps->dev->parent), |
37 | pdata->batt_aux) * pdata->batt_mult / | 37 | pdata->batt_aux) * pdata->batt_mult / |
38 | pdata->batt_div; | 38 | pdata->batt_div; |
39 | } | 39 | } |
40 | 40 | ||
41 | static unsigned long wm97xx_read_temp(struct power_supply *bat_ps) | 41 | static unsigned long wm97xx_read_temp(struct power_supply *bat_ps) |
42 | { | 42 | { |
43 | return wm97xx_read_aux_adc(bat_ps->dev->parent->driver_data, | 43 | return wm97xx_read_aux_adc(dev_get_drvdata(bat_ps->dev->parent), |
44 | pdata->temp_aux) * pdata->temp_mult / | 44 | pdata->temp_aux) * pdata->temp_mult / |
45 | pdata->temp_div; | 45 | pdata->temp_div; |
46 | } | 46 | } |
diff --git a/drivers/rtc/rtc-ds1374.c b/drivers/rtc/rtc-ds1374.c index 32b27739ec2a..713f7bf5afb3 100644 --- a/drivers/rtc/rtc-ds1374.c +++ b/drivers/rtc/rtc-ds1374.c | |||
@@ -283,7 +283,7 @@ static void ds1374_work(struct work_struct *work) | |||
283 | 283 | ||
284 | stat = i2c_smbus_read_byte_data(client, DS1374_REG_SR); | 284 | stat = i2c_smbus_read_byte_data(client, DS1374_REG_SR); |
285 | if (stat < 0) | 285 | if (stat < 0) |
286 | return; | 286 | goto unlock; |
287 | 287 | ||
288 | if (stat & DS1374_REG_SR_AF) { | 288 | if (stat & DS1374_REG_SR_AF) { |
289 | stat &= ~DS1374_REG_SR_AF; | 289 | stat &= ~DS1374_REG_SR_AF; |
@@ -302,7 +302,7 @@ static void ds1374_work(struct work_struct *work) | |||
302 | out: | 302 | out: |
303 | if (!ds1374->exiting) | 303 | if (!ds1374->exiting) |
304 | enable_irq(client->irq); | 304 | enable_irq(client->irq); |
305 | 305 | unlock: | |
306 | mutex_unlock(&ds1374->mutex); | 306 | mutex_unlock(&ds1374->mutex); |
307 | } | 307 | } |
308 | 308 | ||
diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index f8b1f04f26b8..c11770f5b368 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c | |||
@@ -1696,8 +1696,7 @@ static void dasd_eckd_handle_unsolicited_interrupt(struct dasd_device *device, | |||
1696 | DBF_DEV_EVENT(DBF_ERR, device, "%s", | 1696 | DBF_DEV_EVENT(DBF_ERR, device, "%s", |
1697 | "unsolicited interrupt received " | 1697 | "unsolicited interrupt received " |
1698 | "(sense available)"); | 1698 | "(sense available)"); |
1699 | device->discipline->dump_sense_dbf(device, NULL, irb, | 1699 | device->discipline->dump_sense_dbf(device, irb, "unsolicited"); |
1700 | "unsolicited"); | ||
1701 | } | 1700 | } |
1702 | 1701 | ||
1703 | dasd_schedule_device_bh(device); | 1702 | dasd_schedule_device_bh(device); |
@@ -2941,42 +2940,20 @@ dasd_eckd_dump_ccw_range(struct ccw1 *from, struct ccw1 *to, char *page) | |||
2941 | } | 2940 | } |
2942 | 2941 | ||
2943 | static void | 2942 | static void |
2944 | dasd_eckd_dump_sense_dbf(struct dasd_device *device, struct dasd_ccw_req *req, | 2943 | dasd_eckd_dump_sense_dbf(struct dasd_device *device, struct irb *irb, |
2945 | struct irb *irb, char *reason) | 2944 | char *reason) |
2946 | { | 2945 | { |
2947 | u64 *sense; | 2946 | u64 *sense; |
2948 | int sl; | ||
2949 | struct tsb *tsb; | ||
2950 | 2947 | ||
2951 | sense = NULL; | 2948 | sense = (u64 *) dasd_get_sense(irb); |
2952 | tsb = NULL; | ||
2953 | if (req && scsw_is_tm(&req->irb.scsw)) { | ||
2954 | if (irb->scsw.tm.tcw) | ||
2955 | tsb = tcw_get_tsb( | ||
2956 | (struct tcw *)(unsigned long)irb->scsw.tm.tcw); | ||
2957 | if (tsb && (irb->scsw.tm.fcxs == 0x01)) { | ||
2958 | switch (tsb->flags & 0x07) { | ||
2959 | case 1: /* tsa_iostat */ | ||
2960 | sense = (u64 *)tsb->tsa.iostat.sense; | ||
2961 | break; | ||
2962 | case 2: /* ts_ddpc */ | ||
2963 | sense = (u64 *)tsb->tsa.ddpc.sense; | ||
2964 | break; | ||
2965 | case 3: /* tsa_intrg */ | ||
2966 | break; | ||
2967 | } | ||
2968 | } | ||
2969 | } else { | ||
2970 | if (irb->esw.esw0.erw.cons) | ||
2971 | sense = (u64 *)irb->ecw; | ||
2972 | } | ||
2973 | if (sense) { | 2949 | if (sense) { |
2974 | for (sl = 0; sl < 4; sl++) { | 2950 | DBF_DEV_EVENT(DBF_EMERG, device, |
2975 | DBF_DEV_EVENT(DBF_EMERG, device, | 2951 | "%s: %s %02x%02x%02x %016llx %016llx %016llx " |
2976 | "%s: %016llx %016llx %016llx %016llx", | 2952 | "%016llx", reason, |
2977 | reason, sense[0], sense[1], sense[2], | 2953 | scsw_is_tm(&irb->scsw) ? "t" : "c", |
2978 | sense[3]); | 2954 | scsw_cc(&irb->scsw), scsw_cstat(&irb->scsw), |
2979 | } | 2955 | scsw_dstat(&irb->scsw), sense[0], sense[1], |
2956 | sense[2], sense[3]); | ||
2980 | } else { | 2957 | } else { |
2981 | DBF_DEV_EVENT(DBF_EMERG, device, "%s", | 2958 | DBF_DEV_EVENT(DBF_EMERG, device, "%s", |
2982 | "SORRY - NO VALID SENSE AVAILABLE\n"); | 2959 | "SORRY - NO VALID SENSE AVAILABLE\n"); |
diff --git a/drivers/s390/block/dasd_erp.c b/drivers/s390/block/dasd_erp.c index d970ce2814be..cb8f9cef7429 100644 --- a/drivers/s390/block/dasd_erp.c +++ b/drivers/s390/block/dasd_erp.c | |||
@@ -172,7 +172,7 @@ dasd_log_sense_dbf(struct dasd_ccw_req *cqr, struct irb *irb) | |||
172 | device = cqr->startdev; | 172 | device = cqr->startdev; |
173 | /* dump sense data to s390 debugfeature*/ | 173 | /* dump sense data to s390 debugfeature*/ |
174 | if (device->discipline && device->discipline->dump_sense_dbf) | 174 | if (device->discipline && device->discipline->dump_sense_dbf) |
175 | device->discipline->dump_sense_dbf(device, cqr, irb, "log"); | 175 | device->discipline->dump_sense_dbf(device, irb, "log"); |
176 | } | 176 | } |
177 | EXPORT_SYMBOL(dasd_log_sense_dbf); | 177 | EXPORT_SYMBOL(dasd_log_sense_dbf); |
178 | 178 | ||
diff --git a/drivers/s390/block/dasd_fba.c b/drivers/s390/block/dasd_fba.c index e21ee735f926..31849ad5e59f 100644 --- a/drivers/s390/block/dasd_fba.c +++ b/drivers/s390/block/dasd_fba.c | |||
@@ -241,7 +241,7 @@ static void dasd_fba_handle_unsolicited_interrupt(struct dasd_device *device, | |||
241 | /* check for unsolicited interrupts */ | 241 | /* check for unsolicited interrupts */ |
242 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", | 242 | DBF_DEV_EVENT(DBF_WARNING, device, "%s", |
243 | "unsolicited interrupt received"); | 243 | "unsolicited interrupt received"); |
244 | device->discipline->dump_sense_dbf(device, NULL, irb, "unsolicited"); | 244 | device->discipline->dump_sense_dbf(device, irb, "unsolicited"); |
245 | dasd_schedule_device_bh(device); | 245 | dasd_schedule_device_bh(device); |
246 | return; | 246 | return; |
247 | }; | 247 | }; |
@@ -444,17 +444,20 @@ dasd_fba_fill_info(struct dasd_device * device, | |||
444 | } | 444 | } |
445 | 445 | ||
446 | static void | 446 | static void |
447 | dasd_fba_dump_sense_dbf(struct dasd_device *device, struct dasd_ccw_req *req, | 447 | dasd_fba_dump_sense_dbf(struct dasd_device *device, struct irb *irb, |
448 | struct irb *irb, char *reason) | 448 | char *reason) |
449 | { | 449 | { |
450 | int sl; | 450 | u64 *sense; |
451 | if (irb->esw.esw0.erw.cons) { | 451 | |
452 | for (sl = 0; sl < 4; sl++) { | 452 | sense = (u64 *) dasd_get_sense(irb); |
453 | DBF_DEV_EVENT(DBF_EMERG, device, | 453 | if (sense) { |
454 | "%s: %08x %08x %08x %08x", | 454 | DBF_DEV_EVENT(DBF_EMERG, device, |
455 | reason, irb->ecw[8 * 0], irb->ecw[8 * 1], | 455 | "%s: %s %02x%02x%02x %016llx %016llx %016llx " |
456 | irb->ecw[8 * 2], irb->ecw[8 * 3]); | 456 | "%016llx", reason, |
457 | } | 457 | scsw_is_tm(&irb->scsw) ? "t" : "c", |
458 | scsw_cc(&irb->scsw), scsw_cstat(&irb->scsw), | ||
459 | scsw_dstat(&irb->scsw), sense[0], sense[1], | ||
460 | sense[2], sense[3]); | ||
458 | } else { | 461 | } else { |
459 | DBF_DEV_EVENT(DBF_EMERG, device, "%s", | 462 | DBF_DEV_EVENT(DBF_EMERG, device, "%s", |
460 | "SORRY - NO VALID SENSE AVAILABLE\n"); | 463 | "SORRY - NO VALID SENSE AVAILABLE\n"); |
diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h index fd63b2f2bda9..b699ca356ac5 100644 --- a/drivers/s390/block/dasd_int.h +++ b/drivers/s390/block/dasd_int.h | |||
@@ -284,8 +284,7 @@ struct dasd_discipline { | |||
284 | dasd_erp_fn_t(*erp_postaction) (struct dasd_ccw_req *); | 284 | dasd_erp_fn_t(*erp_postaction) (struct dasd_ccw_req *); |
285 | void (*dump_sense) (struct dasd_device *, struct dasd_ccw_req *, | 285 | void (*dump_sense) (struct dasd_device *, struct dasd_ccw_req *, |
286 | struct irb *); | 286 | struct irb *); |
287 | void (*dump_sense_dbf) (struct dasd_device *, struct dasd_ccw_req *, | 287 | void (*dump_sense_dbf) (struct dasd_device *, struct irb *, char *); |
288 | struct irb *, char *); | ||
289 | 288 | ||
290 | void (*handle_unsolicited_interrupt) (struct dasd_device *, | 289 | void (*handle_unsolicited_interrupt) (struct dasd_device *, |
291 | struct irb *); | 290 | struct irb *); |
diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c index 4ce3f72ee1c1..df918ef27965 100644 --- a/drivers/s390/block/dasd_ioctl.c +++ b/drivers/s390/block/dasd_ioctl.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/major.h> | 16 | #include <linux/major.h> |
17 | #include <linux/fs.h> | 17 | #include <linux/fs.h> |
18 | #include <linux/blkpg.h> | 18 | #include <linux/blkpg.h> |
19 | #include <linux/smp_lock.h> | ||
19 | 20 | ||
20 | #include <asm/ccwdev.h> | 21 | #include <asm/ccwdev.h> |
21 | #include <asm/cmb.h> | 22 | #include <asm/cmb.h> |
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index 016f9e9d2591..d34617682a62 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c | |||
@@ -964,7 +964,8 @@ static int dcssblk_freeze(struct device *dev) | |||
964 | break; | 964 | break; |
965 | } | 965 | } |
966 | if (rc) | 966 | if (rc) |
967 | pr_err("Suspend failed because device %s is writeable.\n", | 967 | pr_err("Suspending the system failed because DCSS device %s " |
968 | "is writable\n", | ||
968 | dev_info->segment_name); | 969 | dev_info->segment_name); |
969 | return rc; | 970 | return rc; |
970 | } | 971 | } |
@@ -987,8 +988,8 @@ static int dcssblk_restore(struct device *dev) | |||
987 | goto out_panic; | 988 | goto out_panic; |
988 | } | 989 | } |
989 | if (start != entry->start || end != entry->end) { | 990 | if (start != entry->start || end != entry->end) { |
990 | pr_err("Mismatch of start / end address after " | 991 | pr_err("The address range of DCSS %s changed " |
991 | "resuming device %s\n", | 992 | "while the system was suspended\n", |
992 | entry->segment_name); | 993 | entry->segment_name); |
993 | goto out_panic; | 994 | goto out_panic; |
994 | } | 995 | } |
diff --git a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c index 2e9e1ecd6d82..db442cd6621e 100644 --- a/drivers/s390/block/xpram.c +++ b/drivers/s390/block/xpram.c | |||
@@ -443,7 +443,7 @@ fail: | |||
443 | */ | 443 | */ |
444 | static void xpram_resume_error(const char *message) | 444 | static void xpram_resume_error(const char *message) |
445 | { | 445 | { |
446 | pr_err("Resume error: %s\n", message); | 446 | pr_err("Resuming the system failed: %s\n", message); |
447 | panic("xpram resume error\n"); | 447 | panic("xpram resume error\n"); |
448 | } | 448 | } |
449 | 449 | ||
diff --git a/drivers/s390/char/monreader.c b/drivers/s390/char/monreader.c index 7892550d7932..3234e90bd7f9 100644 --- a/drivers/s390/char/monreader.c +++ b/drivers/s390/char/monreader.c | |||
@@ -320,7 +320,7 @@ static int mon_open(struct inode *inode, struct file *filp) | |||
320 | goto out_path; | 320 | goto out_path; |
321 | } | 321 | } |
322 | filp->private_data = monpriv; | 322 | filp->private_data = monpriv; |
323 | dev_set_drvdata(&monreader_device, monpriv); | 323 | dev_set_drvdata(monreader_device, monpriv); |
324 | unlock_kernel(); | 324 | unlock_kernel(); |
325 | return nonseekable_open(inode, filp); | 325 | return nonseekable_open(inode, filp); |
326 | 326 | ||
@@ -463,7 +463,7 @@ static struct miscdevice mon_dev = { | |||
463 | *****************************************************************************/ | 463 | *****************************************************************************/ |
464 | static int monreader_freeze(struct device *dev) | 464 | static int monreader_freeze(struct device *dev) |
465 | { | 465 | { |
466 | struct mon_private *monpriv = dev_get_drvdata(&dev); | 466 | struct mon_private *monpriv = dev_get_drvdata(dev); |
467 | int rc; | 467 | int rc; |
468 | 468 | ||
469 | if (!monpriv) | 469 | if (!monpriv) |
diff --git a/drivers/s390/char/sclp_rw.h b/drivers/s390/char/sclp_rw.h index 85f491ea929c..7a7bfc947d97 100644 --- a/drivers/s390/char/sclp_rw.h +++ b/drivers/s390/char/sclp_rw.h | |||
@@ -92,5 +92,10 @@ void sclp_set_columns(struct sclp_buffer *, unsigned short); | |||
92 | void sclp_set_htab(struct sclp_buffer *, unsigned short); | 92 | void sclp_set_htab(struct sclp_buffer *, unsigned short); |
93 | int sclp_chars_in_buffer(struct sclp_buffer *); | 93 | int sclp_chars_in_buffer(struct sclp_buffer *); |
94 | 94 | ||
95 | #ifdef CONFIG_SCLP_CONSOLE | ||
95 | void sclp_console_pm_event(enum sclp_pm_event sclp_pm_event); | 96 | void sclp_console_pm_event(enum sclp_pm_event sclp_pm_event); |
97 | #else | ||
98 | static inline void sclp_console_pm_event(enum sclp_pm_event sclp_pm_event) { } | ||
99 | #endif | ||
100 | |||
96 | #endif /* __SCLP_RW_H__ */ | 101 | #endif /* __SCLP_RW_H__ */ |
diff --git a/drivers/s390/char/vmwatchdog.c b/drivers/s390/char/vmwatchdog.c index cb7854c10c04..f2bc287b69e4 100644 --- a/drivers/s390/char/vmwatchdog.c +++ b/drivers/s390/char/vmwatchdog.c | |||
@@ -250,14 +250,14 @@ static int vmwdt_resume(void) | |||
250 | static int vmwdt_suspend(void) | 250 | static int vmwdt_suspend(void) |
251 | { | 251 | { |
252 | if (test_and_set_bit(VMWDT_OPEN, &vmwdt_is_open)) { | 252 | if (test_and_set_bit(VMWDT_OPEN, &vmwdt_is_open)) { |
253 | pr_err("The watchdog is in use. " | 253 | pr_err("The system cannot be suspended while the watchdog" |
254 | "This prevents hibernation or suspend.\n"); | 254 | " is in use\n"); |
255 | return NOTIFY_BAD; | 255 | return NOTIFY_BAD; |
256 | } | 256 | } |
257 | if (test_bit(VMWDT_RUNNING, &vmwdt_is_open)) { | 257 | if (test_bit(VMWDT_RUNNING, &vmwdt_is_open)) { |
258 | clear_bit(VMWDT_OPEN, &vmwdt_is_open); | 258 | clear_bit(VMWDT_OPEN, &vmwdt_is_open); |
259 | pr_err("The watchdog is running. " | 259 | pr_err("The system cannot be suspended while the watchdog" |
260 | "This prevents hibernation or suspend.\n"); | 260 | " is running\n"); |
261 | return NOTIFY_BAD; | 261 | return NOTIFY_BAD; |
262 | } | 262 | } |
263 | return NOTIFY_DONE; | 263 | return NOTIFY_DONE; |
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c index 0471f8800483..4240b05aef6d 100644 --- a/drivers/scsi/atari_NCR5380.c +++ b/drivers/scsi/atari_NCR5380.c | |||
@@ -2826,8 +2826,7 @@ int NCR5380_abort(Scsi_Cmnd *cmd) | |||
2826 | */ | 2826 | */ |
2827 | 2827 | ||
2828 | local_irq_restore(flags); | 2828 | local_irq_restore(flags); |
2829 | printk(KERN_INFO "scsi%d: warning : SCSI command probably completed successfully\n" | 2829 | printk(KERN_INFO "scsi%d: warning : SCSI command probably completed successfully before abortion\n", HOSTNO); |
2830 | KERN_INFO " before abortion\n", HOSTNO); | ||
2831 | 2830 | ||
2832 | /* Maybe it is sufficient just to release the ST-DMA lock... (if | 2831 | /* Maybe it is sufficient just to release the ST-DMA lock... (if |
2833 | * possible at all) At least, we should check if the lock could be | 2832 | * possible at all) At least, we should check if the lock could be |
diff --git a/drivers/scsi/mac53c94.c b/drivers/scsi/mac53c94.c index b12ad7c7c673..18735b39b3d3 100644 --- a/drivers/scsi/mac53c94.c +++ b/drivers/scsi/mac53c94.c | |||
@@ -75,8 +75,9 @@ static int mac53c94_queue(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd * | |||
75 | int i; | 75 | int i; |
76 | printk(KERN_DEBUG "mac53c94_queue %p: command is", cmd); | 76 | printk(KERN_DEBUG "mac53c94_queue %p: command is", cmd); |
77 | for (i = 0; i < cmd->cmd_len; ++i) | 77 | for (i = 0; i < cmd->cmd_len; ++i) |
78 | printk(" %.2x", cmd->cmnd[i]); | 78 | printk(KERN_CONT " %.2x", cmd->cmnd[i]); |
79 | printk("\n" KERN_DEBUG "use_sg=%d request_bufflen=%d request_buffer=%p\n", | 79 | printk(KERN_CONT "\n"); |
80 | printk(KERN_DEBUG "use_sg=%d request_bufflen=%d request_buffer=%p\n", | ||
80 | scsi_sg_count(cmd), scsi_bufflen(cmd), scsi_sglist(cmd)); | 81 | scsi_sg_count(cmd), scsi_bufflen(cmd), scsi_sglist(cmd)); |
81 | } | 82 | } |
82 | #endif | 83 | #endif |
diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c index 650bcef08f2a..cd78c501803a 100644 --- a/drivers/scsi/qla2xxx/qla_mid.c +++ b/drivers/scsi/qla2xxx/qla_mid.c | |||
@@ -9,7 +9,6 @@ | |||
9 | 9 | ||
10 | #include <linux/moduleparam.h> | 10 | #include <linux/moduleparam.h> |
11 | #include <linux/vmalloc.h> | 11 | #include <linux/vmalloc.h> |
12 | #include <linux/smp_lock.h> | ||
13 | #include <linux/list.h> | 12 | #include <linux/list.h> |
14 | 13 | ||
15 | #include <scsi/scsi_tcq.h> | 14 | #include <scsi/scsi_tcq.h> |
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index ef142fd47a83..9230402c45af 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -619,7 +619,7 @@ sg_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos) | |||
619 | if (strcmp(current->comm, cmd) && printk_ratelimit()) { | 619 | if (strcmp(current->comm, cmd) && printk_ratelimit()) { |
620 | printk(KERN_WARNING | 620 | printk(KERN_WARNING |
621 | "sg_write: data in/out %d/%d bytes for SCSI command 0x%x--" | 621 | "sg_write: data in/out %d/%d bytes for SCSI command 0x%x--" |
622 | "guessing data in;\n" KERN_WARNING " " | 622 | "guessing data in;\n " |
623 | "program %s not setting count and/or reply_len properly\n", | 623 | "program %s not setting count and/or reply_len properly\n", |
624 | old_hdr.reply_len - (int)SZ_SG_HEADER, | 624 | old_hdr.reply_len - (int)SZ_SG_HEADER, |
625 | input_size, (unsigned int) cmnd[0], | 625 | input_size, (unsigned int) cmnd[0], |
@@ -1656,6 +1656,10 @@ static int sg_start_req(Sg_request *srp, unsigned char *cmd) | |||
1656 | md->nr_entries = req_schp->k_use_sg; | 1656 | md->nr_entries = req_schp->k_use_sg; |
1657 | md->offset = 0; | 1657 | md->offset = 0; |
1658 | md->null_mapped = hp->dxferp ? 0 : 1; | 1658 | md->null_mapped = hp->dxferp ? 0 : 1; |
1659 | if (dxfer_dir == SG_DXFER_TO_FROM_DEV) | ||
1660 | md->from_user = 1; | ||
1661 | else | ||
1662 | md->from_user = 0; | ||
1659 | } | 1663 | } |
1660 | 1664 | ||
1661 | if (iov_count) { | 1665 | if (iov_count) { |
diff --git a/drivers/scsi/sun3_NCR5380.c b/drivers/scsi/sun3_NCR5380.c index bcaba86060ab..75da6e58ce55 100644 --- a/drivers/scsi/sun3_NCR5380.c +++ b/drivers/scsi/sun3_NCR5380.c | |||
@@ -2860,8 +2860,7 @@ static int NCR5380_abort(struct scsi_cmnd *cmd) | |||
2860 | */ | 2860 | */ |
2861 | 2861 | ||
2862 | local_irq_restore(flags); | 2862 | local_irq_restore(flags); |
2863 | printk(KERN_INFO "scsi%d: warning : SCSI command probably completed successfully\n" | 2863 | printk(KERN_INFO "scsi%d: warning : SCSI command probably completed successfully before abortion\n", HOSTNO); |
2864 | KERN_INFO " before abortion\n", HOSTNO); | ||
2865 | 2864 | ||
2866 | return SCSI_ABORT_NOT_RUNNING; | 2865 | return SCSI_ABORT_NOT_RUNNING; |
2867 | } | 2866 | } |
diff --git a/drivers/serial/8250_pci.c b/drivers/serial/8250_pci.c index 6160e03f410c..e7108e75653d 100644 --- a/drivers/serial/8250_pci.c +++ b/drivers/serial/8250_pci.c | |||
@@ -60,11 +60,12 @@ struct serial_private { | |||
60 | 60 | ||
61 | static void moan_device(const char *str, struct pci_dev *dev) | 61 | static void moan_device(const char *str, struct pci_dev *dev) |
62 | { | 62 | { |
63 | printk(KERN_WARNING "%s: %s\n" | 63 | printk(KERN_WARNING |
64 | KERN_WARNING "Please send the output of lspci -vv, this\n" | 64 | "%s: %s\n" |
65 | KERN_WARNING "message (0x%04x,0x%04x,0x%04x,0x%04x), the\n" | 65 | "Please send the output of lspci -vv, this\n" |
66 | KERN_WARNING "manufacturer and name of serial board or\n" | 66 | "message (0x%04x,0x%04x,0x%04x,0x%04x), the\n" |
67 | KERN_WARNING "modem board to rmk+serial@arm.linux.org.uk.\n", | 67 | "manufacturer and name of serial board or\n" |
68 | "modem board to rmk+serial@arm.linux.org.uk.\n", | ||
68 | pci_name(dev), str, dev->vendor, dev->device, | 69 | pci_name(dev), str, dev->vendor, dev->device, |
69 | dev->subsystem_vendor, dev->subsystem_device); | 70 | dev->subsystem_vendor, dev->subsystem_device); |
70 | } | 71 | } |
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c index 66f52674ca0c..8e2feb563347 100644 --- a/drivers/serial/sh-sci.c +++ b/drivers/serial/sh-sci.c | |||
@@ -707,24 +707,25 @@ static irqreturn_t sci_br_interrupt(int irq, void *ptr) | |||
707 | 707 | ||
708 | static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr) | 708 | static irqreturn_t sci_mpxed_interrupt(int irq, void *ptr) |
709 | { | 709 | { |
710 | unsigned short ssr_status, scr_status; | 710 | unsigned short ssr_status, scr_status, err_enabled; |
711 | struct uart_port *port = ptr; | 711 | struct uart_port *port = ptr; |
712 | irqreturn_t ret = IRQ_NONE; | 712 | irqreturn_t ret = IRQ_NONE; |
713 | 713 | ||
714 | ssr_status = sci_in(port, SCxSR); | 714 | ssr_status = sci_in(port, SCxSR); |
715 | scr_status = sci_in(port, SCSCR); | 715 | scr_status = sci_in(port, SCSCR); |
716 | err_enabled = scr_status & (SCI_CTRL_FLAGS_REIE | SCI_CTRL_FLAGS_RIE); | ||
716 | 717 | ||
717 | /* Tx Interrupt */ | 718 | /* Tx Interrupt */ |
718 | if ((ssr_status & 0x0020) && (scr_status & SCI_CTRL_FLAGS_TIE)) | 719 | if ((ssr_status & SCxSR_TDxE(port)) && (scr_status & SCI_CTRL_FLAGS_TIE)) |
719 | ret = sci_tx_interrupt(irq, ptr); | 720 | ret = sci_tx_interrupt(irq, ptr); |
720 | /* Rx Interrupt */ | 721 | /* Rx Interrupt */ |
721 | if ((ssr_status & 0x0002) && (scr_status & SCI_CTRL_FLAGS_RIE)) | 722 | if ((ssr_status & SCxSR_RDxF(port)) && (scr_status & SCI_CTRL_FLAGS_RIE)) |
722 | ret = sci_rx_interrupt(irq, ptr); | 723 | ret = sci_rx_interrupt(irq, ptr); |
723 | /* Error Interrupt */ | 724 | /* Error Interrupt */ |
724 | if ((ssr_status & 0x0080) && (scr_status & SCI_CTRL_FLAGS_REIE)) | 725 | if ((ssr_status & SCxSR_ERRORS(port)) && err_enabled) |
725 | ret = sci_er_interrupt(irq, ptr); | 726 | ret = sci_er_interrupt(irq, ptr); |
726 | /* Break Interrupt */ | 727 | /* Break Interrupt */ |
727 | if ((ssr_status & 0x0010) && (scr_status & SCI_CTRL_FLAGS_REIE)) | 728 | if ((ssr_status & SCxSR_BRK(port)) && err_enabled) |
728 | ret = sci_br_interrupt(irq, ptr); | 729 | ret = sci_br_interrupt(irq, ptr); |
729 | 730 | ||
730 | return ret; | 731 | return ret; |
diff --git a/drivers/ssb/pcmcia.c b/drivers/ssb/pcmcia.c index fbfadbac67e8..100e7a5c5ea1 100644 --- a/drivers/ssb/pcmcia.c +++ b/drivers/ssb/pcmcia.c | |||
@@ -583,7 +583,7 @@ static int ssb_pcmcia_sprom_write_all(struct ssb_bus *bus, const u16 *sprom) | |||
583 | ssb_printk("."); | 583 | ssb_printk("."); |
584 | err = ssb_pcmcia_sprom_write(bus, i, sprom[i]); | 584 | err = ssb_pcmcia_sprom_write(bus, i, sprom[i]); |
585 | if (err) { | 585 | if (err) { |
586 | ssb_printk("\n" KERN_NOTICE PFX | 586 | ssb_printk(KERN_NOTICE PFX |
587 | "Failed to write to SPROM.\n"); | 587 | "Failed to write to SPROM.\n"); |
588 | failed = 1; | 588 | failed = 1; |
589 | break; | 589 | break; |
@@ -591,7 +591,7 @@ static int ssb_pcmcia_sprom_write_all(struct ssb_bus *bus, const u16 *sprom) | |||
591 | } | 591 | } |
592 | err = ssb_pcmcia_sprom_command(bus, SSB_PCMCIA_SPROMCTL_WRITEDIS); | 592 | err = ssb_pcmcia_sprom_command(bus, SSB_PCMCIA_SPROMCTL_WRITEDIS); |
593 | if (err) { | 593 | if (err) { |
594 | ssb_printk("\n" KERN_NOTICE PFX | 594 | ssb_printk(KERN_NOTICE PFX |
595 | "Could not disable SPROM write access.\n"); | 595 | "Could not disable SPROM write access.\n"); |
596 | failed = 1; | 596 | failed = 1; |
597 | } | 597 | } |
@@ -678,7 +678,8 @@ int ssb_pcmcia_get_invariants(struct ssb_bus *bus, | |||
678 | sprom->board_rev = tuple.TupleData[1]; | 678 | sprom->board_rev = tuple.TupleData[1]; |
679 | break; | 679 | break; |
680 | case SSB_PCMCIA_CIS_PA: | 680 | case SSB_PCMCIA_CIS_PA: |
681 | GOTO_ERROR_ON(tuple.TupleDataLen != 9, | 681 | GOTO_ERROR_ON((tuple.TupleDataLen != 9) && |
682 | (tuple.TupleDataLen != 10), | ||
682 | "pa tpl size"); | 683 | "pa tpl size"); |
683 | sprom->pa0b0 = tuple.TupleData[1] | | 684 | sprom->pa0b0 = tuple.TupleData[1] | |
684 | ((u16)tuple.TupleData[2] << 8); | 685 | ((u16)tuple.TupleData[2] << 8); |
@@ -718,7 +719,8 @@ int ssb_pcmcia_get_invariants(struct ssb_bus *bus, | |||
718 | sprom->antenna_gain.ghz5.a3 = tuple.TupleData[1]; | 719 | sprom->antenna_gain.ghz5.a3 = tuple.TupleData[1]; |
719 | break; | 720 | break; |
720 | case SSB_PCMCIA_CIS_BFLAGS: | 721 | case SSB_PCMCIA_CIS_BFLAGS: |
721 | GOTO_ERROR_ON(tuple.TupleDataLen != 3, | 722 | GOTO_ERROR_ON((tuple.TupleDataLen != 3) && |
723 | (tuple.TupleDataLen != 5), | ||
722 | "bfl tpl size"); | 724 | "bfl tpl size"); |
723 | sprom->boardflags_lo = tuple.TupleData[1] | | 725 | sprom->boardflags_lo = tuple.TupleData[1] | |
724 | ((u16)tuple.TupleData[2] << 8); | 726 | ((u16)tuple.TupleData[2] << 8); |
diff --git a/drivers/staging/comedi/drivers/jr3_pci.c b/drivers/staging/comedi/drivers/jr3_pci.c index baf83c6a9412..e3c3adc282e2 100644 --- a/drivers/staging/comedi/drivers/jr3_pci.c +++ b/drivers/staging/comedi/drivers/jr3_pci.c | |||
@@ -45,6 +45,8 @@ Devices: [JR3] PCI force sensor board (jr3_pci) | |||
45 | #include <linux/delay.h> | 45 | #include <linux/delay.h> |
46 | #include <linux/ctype.h> | 46 | #include <linux/ctype.h> |
47 | #include <linux/firmware.h> | 47 | #include <linux/firmware.h> |
48 | #include <linux/jiffies.h> | ||
49 | #include <linux/timer.h> | ||
48 | #include "comedi_pci.h" | 50 | #include "comedi_pci.h" |
49 | #include "jr3_pci.h" | 51 | #include "jr3_pci.h" |
50 | 52 | ||
diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index 92121cf8c45c..5d9bab352c1d 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c | |||
@@ -111,9 +111,13 @@ static const struct s626_board s626_boards[] = { | |||
111 | #define PCI_VENDOR_ID_S626 0x1131 | 111 | #define PCI_VENDOR_ID_S626 0x1131 |
112 | #define PCI_DEVICE_ID_S626 0x7146 | 112 | #define PCI_DEVICE_ID_S626 0x7146 |
113 | 113 | ||
114 | /* | ||
115 | * For devices with vendor:device id == 0x1131:0x7146 you must specify | ||
116 | * also subvendor:subdevice ids, because otherwise it will conflict with | ||
117 | * Philips SAA7146 media/dvb based cards. | ||
118 | */ | ||
114 | static DEFINE_PCI_DEVICE_TABLE(s626_pci_table) = { | 119 | static DEFINE_PCI_DEVICE_TABLE(s626_pci_table) = { |
115 | {PCI_VENDOR_ID_S626, PCI_DEVICE_ID_S626, PCI_ANY_ID, PCI_ANY_ID, 0, 0, | 120 | {PCI_VENDOR_ID_S626, PCI_DEVICE_ID_S626, 0x6000, 0x0272, 0, 0, 0}, |
116 | 0}, | ||
117 | {0} | 121 | {0} |
118 | }; | 122 | }; |
119 | 123 | ||
@@ -499,25 +503,26 @@ static int s626_attach(struct comedi_device *dev, struct comedi_devconfig *it) | |||
499 | resource_size_t resourceStart; | 503 | resource_size_t resourceStart; |
500 | dma_addr_t appdma; | 504 | dma_addr_t appdma; |
501 | struct comedi_subdevice *s; | 505 | struct comedi_subdevice *s; |
502 | struct pci_dev *pdev; | 506 | const struct pci_device_id *ids; |
507 | struct pci_dev *pdev = NULL; | ||
503 | 508 | ||
504 | if (alloc_private(dev, sizeof(struct s626_private)) < 0) | 509 | if (alloc_private(dev, sizeof(struct s626_private)) < 0) |
505 | return -ENOMEM; | 510 | return -ENOMEM; |
506 | 511 | ||
507 | for (pdev = pci_get_device(PCI_VENDOR_ID_S626, PCI_DEVICE_ID_S626, | 512 | for (i = 0; i < (ARRAY_SIZE(s626_pci_table) - 1) && !pdev; i++) { |
508 | NULL); pdev != NULL; | 513 | ids = &s626_pci_table[i]; |
509 | pdev = pci_get_device(PCI_VENDOR_ID_S626, | 514 | do { |
510 | PCI_DEVICE_ID_S626, pdev)) { | 515 | pdev = pci_get_subsys(ids->vendor, ids->device, ids->subvendor, |
511 | if (it->options[0] || it->options[1]) { | 516 | ids->subdevice, pdev); |
512 | if (pdev->bus->number == it->options[0] && | 517 | |
513 | PCI_SLOT(pdev->devfn) == it->options[1]) { | 518 | if ((it->options[0] || it->options[1]) && pdev) { |
514 | /* matches requested bus/slot */ | 519 | /* matches requested bus/slot */ |
520 | if (pdev->bus->number == it->options[0] && | ||
521 | PCI_SLOT(pdev->devfn) == it->options[1]) | ||
522 | break; | ||
523 | } else | ||
515 | break; | 524 | break; |
516 | } | 525 | } while (1); |
517 | } else { | ||
518 | /* no bus/slot specified */ | ||
519 | break; | ||
520 | } | ||
521 | } | 526 | } |
522 | devpriv->pdev = pdev; | 527 | devpriv->pdev = pdev; |
523 | 528 | ||
diff --git a/drivers/staging/go7007/s2250-loader.c b/drivers/staging/go7007/s2250-loader.c index a5e4acab089e..bb22347af60e 100644 --- a/drivers/staging/go7007/s2250-loader.c +++ b/drivers/staging/go7007/s2250-loader.c | |||
@@ -17,6 +17,7 @@ | |||
17 | 17 | ||
18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
20 | #include <linux/smp_lock.h> | ||
20 | #include <linux/usb.h> | 21 | #include <linux/usb.h> |
21 | #include <dvb-usb.h> | 22 | #include <dvb-usb.h> |
22 | 23 | ||
diff --git a/drivers/staging/meilhaus/TODO b/drivers/staging/meilhaus/TODO index 6ec25203089c..d6ce39823de6 100644 --- a/drivers/staging/meilhaus/TODO +++ b/drivers/staging/meilhaus/TODO | |||
@@ -7,4 +7,4 @@ TODO: | |||
7 | - possible comedi merge | 7 | - possible comedi merge |
8 | 8 | ||
9 | Please send cleanup patches to Greg Kroah-Hartman <greg@kroah.com> | 9 | Please send cleanup patches to Greg Kroah-Hartman <greg@kroah.com> |
10 | and CC: David Kiliani <mail@davidkiliani.de> | 10 | and CC: David Kiliani <mail@davidkiliani.de> and Meilhaus Support <support@meilhaus.de> |
diff --git a/drivers/staging/rspiusb/rspiusb.c b/drivers/staging/rspiusb/rspiusb.c index 1cdfe69585ea..2f8155c1968b 100644 --- a/drivers/staging/rspiusb/rspiusb.c +++ b/drivers/staging/rspiusb/rspiusb.c | |||
@@ -444,8 +444,7 @@ static void piusb_write_bulk_callback(struct urb *urb) | |||
444 | __func__, status); | 444 | __func__, status); |
445 | 445 | ||
446 | pdx->pendingWrite = 0; | 446 | pdx->pendingWrite = 0; |
447 | usb_buffer_free(urb->dev, urb->transfer_buffer_length, | 447 | kfree(urb->transfer_buffer); |
448 | urb->transfer_buffer, urb->transfer_dma); | ||
449 | } | 448 | } |
450 | 449 | ||
451 | int piusb_output(struct ioctl_struct *io, unsigned char *uBuf, int len, | 450 | int piusb_output(struct ioctl_struct *io, unsigned char *uBuf, int len, |
@@ -457,9 +456,7 @@ int piusb_output(struct ioctl_struct *io, unsigned char *uBuf, int len, | |||
457 | 456 | ||
458 | urb = usb_alloc_urb(0, GFP_KERNEL); | 457 | urb = usb_alloc_urb(0, GFP_KERNEL); |
459 | if (urb != NULL) { | 458 | if (urb != NULL) { |
460 | kbuf = | 459 | kbuf = kmalloc(len, GFP_KERNEL); |
461 | usb_buffer_alloc(pdx->udev, len, GFP_KERNEL, | ||
462 | &urb->transfer_dma); | ||
463 | if (!kbuf) { | 460 | if (!kbuf) { |
464 | dev_err(&pdx->udev->dev, "buffer_alloc failed\n"); | 461 | dev_err(&pdx->udev->dev, "buffer_alloc failed\n"); |
465 | return -ENOMEM; | 462 | return -ENOMEM; |
@@ -470,7 +467,6 @@ int piusb_output(struct ioctl_struct *io, unsigned char *uBuf, int len, | |||
470 | } | 467 | } |
471 | usb_fill_bulk_urb(urb, pdx->udev, pdx->hEP[io->endpoint], kbuf, | 468 | usb_fill_bulk_urb(urb, pdx->udev, pdx->hEP[io->endpoint], kbuf, |
472 | len, piusb_write_bulk_callback, pdx); | 469 | len, piusb_write_bulk_callback, pdx); |
473 | urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | ||
474 | err = usb_submit_urb(urb, GFP_KERNEL); | 470 | err = usb_submit_urb(urb, GFP_KERNEL); |
475 | if (err) { | 471 | if (err) { |
476 | dev_err(&pdx->udev->dev, | 472 | dev_err(&pdx->udev->dev, |
@@ -641,7 +637,7 @@ static int MapUserBuffer(struct ioctl_struct *io, struct device_extension *pdx) | |||
641 | numPagesRequired = | 637 | numPagesRequired = |
642 | ((uaddr & ~PAGE_MASK) + count + ~PAGE_MASK) >> PAGE_SHIFT; | 638 | ((uaddr & ~PAGE_MASK) + count + ~PAGE_MASK) >> PAGE_SHIFT; |
643 | dbg("Number of pages needed = %d", numPagesRequired); | 639 | dbg("Number of pages needed = %d", numPagesRequired); |
644 | maplist_p = vmalloc(numPagesRequired * sizeof(struct page)); | 640 | maplist_p = vmalloc(numPagesRequired * sizeof(struct page *)); |
645 | if (!maplist_p) { | 641 | if (!maplist_p) { |
646 | dbg("Can't Allocate Memory for maplist_p"); | 642 | dbg("Can't Allocate Memory for maplist_p"); |
647 | return -ENOMEM; | 643 | return -ENOMEM; |
@@ -712,9 +708,7 @@ static int MapUserBuffer(struct ioctl_struct *io, struct device_extension *pdx) | |||
712 | usb_fill_bulk_urb(pdx->PixelUrb[frameInfo][i], | 708 | usb_fill_bulk_urb(pdx->PixelUrb[frameInfo][i], |
713 | pdx->udev, | 709 | pdx->udev, |
714 | epAddr, | 710 | epAddr, |
715 | (dma_addr_t *) sg_dma_address(&pdx-> | 711 | NULL, // non-DMA HC? buy a better hardware |
716 | sgl[frameInfo] | ||
717 | [i]), | ||
718 | sg_dma_len(&pdx->sgl[frameInfo][i]), | 712 | sg_dma_len(&pdx->sgl[frameInfo][i]), |
719 | piusb_readPIXEL_callback, (void *)pdx); | 713 | piusb_readPIXEL_callback, (void *)pdx); |
720 | pdx->PixelUrb[frameInfo][i]->transfer_dma = | 714 | pdx->PixelUrb[frameInfo][i]->transfer_dma = |
diff --git a/drivers/staging/rt2870/rt2870.h b/drivers/staging/rt2870/rt2870.h index 5e5b3f2b7eb1..29e3b53e52a1 100644 --- a/drivers/staging/rt2870/rt2870.h +++ b/drivers/staging/rt2870/rt2870.h | |||
@@ -89,6 +89,7 @@ | |||
89 | {USB_DEVICE(0x0DF6,0x002C)}, /* Sitecom */ \ | 89 | {USB_DEVICE(0x0DF6,0x002C)}, /* Sitecom */ \ |
90 | {USB_DEVICE(0x0DF6,0x002D)}, /* Sitecom */ \ | 90 | {USB_DEVICE(0x0DF6,0x002D)}, /* Sitecom */ \ |
91 | {USB_DEVICE(0x0DF6,0x0039)}, /* Sitecom */ \ | 91 | {USB_DEVICE(0x0DF6,0x0039)}, /* Sitecom */ \ |
92 | {USB_DEVICE(0x0DF6,0x003F)}, /* Sitecom WL-608 */ \ | ||
92 | {USB_DEVICE(0x14B2,0x3C06)}, /* Conceptronic */ \ | 93 | {USB_DEVICE(0x14B2,0x3C06)}, /* Conceptronic */ \ |
93 | {USB_DEVICE(0x14B2,0x3C28)}, /* Conceptronic */ \ | 94 | {USB_DEVICE(0x14B2,0x3C28)}, /* Conceptronic */ \ |
94 | {USB_DEVICE(0x2019,0xED06)}, /* Planex Communications, Inc. */ \ | 95 | {USB_DEVICE(0x2019,0xED06)}, /* Planex Communications, Inc. */ \ |
diff --git a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c index 93af37e2d31a..54b4b718f84a 100644 --- a/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c +++ b/drivers/staging/rtl8187se/ieee80211/ieee80211_softmac_wx.c | |||
@@ -461,19 +461,19 @@ int ieee80211_wx_get_name(struct ieee80211_device *ieee, | |||
461 | struct iw_request_info *info, | 461 | struct iw_request_info *info, |
462 | union iwreq_data *wrqu, char *extra) | 462 | union iwreq_data *wrqu, char *extra) |
463 | { | 463 | { |
464 | strcpy(wrqu->name, "802.11"); | 464 | strlcpy(wrqu->name, "802.11", IFNAMSIZ); |
465 | if(ieee->modulation & IEEE80211_CCK_MODULATION){ | 465 | if(ieee->modulation & IEEE80211_CCK_MODULATION){ |
466 | strcat(wrqu->name, "b"); | 466 | strlcat(wrqu->name, "b", IFNAMSIZ); |
467 | if(ieee->modulation & IEEE80211_OFDM_MODULATION) | 467 | if(ieee->modulation & IEEE80211_OFDM_MODULATION) |
468 | strcat(wrqu->name, "/g"); | 468 | strlcat(wrqu->name, "/g", IFNAMSIZ); |
469 | }else if(ieee->modulation & IEEE80211_OFDM_MODULATION) | 469 | }else if(ieee->modulation & IEEE80211_OFDM_MODULATION) |
470 | strcat(wrqu->name, "g"); | 470 | strlcat(wrqu->name, "g", IFNAMSIZ); |
471 | 471 | ||
472 | if((ieee->state == IEEE80211_LINKED) || | 472 | if((ieee->state == IEEE80211_LINKED) || |
473 | (ieee->state == IEEE80211_LINKED_SCANNING)) | 473 | (ieee->state == IEEE80211_LINKED_SCANNING)) |
474 | strcat(wrqu->name," linked"); | 474 | strlcat(wrqu->name," link", IFNAMSIZ); |
475 | else if(ieee->state != IEEE80211_NOLINK) | 475 | else if(ieee->state != IEEE80211_NOLINK) |
476 | strcat(wrqu->name," link.."); | 476 | strlcat(wrqu->name," .....", IFNAMSIZ); |
477 | 477 | ||
478 | 478 | ||
479 | return 0; | 479 | return 0; |
diff --git a/drivers/staging/rtl8192su/Kconfig b/drivers/staging/rtl8192su/Kconfig index 4b5552c5926e..770f41280f21 100644 --- a/drivers/staging/rtl8192su/Kconfig +++ b/drivers/staging/rtl8192su/Kconfig | |||
@@ -1,6 +1,6 @@ | |||
1 | config RTL8192SU | 1 | config RTL8192SU |
2 | tristate "RealTek RTL8192SU Wireless LAN NIC driver" | 2 | tristate "RealTek RTL8192SU Wireless LAN NIC driver" |
3 | depends on PCI | 3 | depends on PCI |
4 | depends on WIRELESS_EXT && COMPAT_NET_DEV_OPS | 4 | depends on WIRELESS_EXT |
5 | default N | 5 | default N |
6 | ---help--- | 6 | ---help--- |
diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192su/ieee80211/ieee80211_module.c index f408b4583b82..759032db4a34 100644 --- a/drivers/staging/rtl8192su/ieee80211/ieee80211_module.c +++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_module.c | |||
@@ -118,7 +118,6 @@ struct net_device *alloc_ieee80211(int sizeof_priv) | |||
118 | #else | 118 | #else |
119 | ieee = (struct ieee80211_device *)dev->priv; | 119 | ieee = (struct ieee80211_device *)dev->priv; |
120 | #endif | 120 | #endif |
121 | dev->hard_start_xmit = ieee80211_xmit; | ||
122 | 121 | ||
123 | memset(ieee, 0, sizeof(struct ieee80211_device)+sizeof_priv); | 122 | memset(ieee, 0, sizeof(struct ieee80211_device)+sizeof_priv); |
124 | ieee->dev = dev; | 123 | ieee->dev = dev; |
diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac_wx.c b/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac_wx.c index 1f50c46dcb90..191dc3fbbe32 100644 --- a/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac_wx.c +++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac_wx.c | |||
@@ -548,21 +548,21 @@ int ieee80211_wx_get_name(struct ieee80211_device *ieee, | |||
548 | struct iw_request_info *info, | 548 | struct iw_request_info *info, |
549 | union iwreq_data *wrqu, char *extra) | 549 | union iwreq_data *wrqu, char *extra) |
550 | { | 550 | { |
551 | strcpy(wrqu->name, "802.11"); | 551 | strlcpy(wrqu->name, "802.11", IFNAMSIZ); |
552 | if(ieee->modulation & IEEE80211_CCK_MODULATION){ | 552 | if(ieee->modulation & IEEE80211_CCK_MODULATION){ |
553 | strcat(wrqu->name, "b"); | 553 | strlcat(wrqu->name, "b", IFNAMSIZ); |
554 | if(ieee->modulation & IEEE80211_OFDM_MODULATION) | 554 | if(ieee->modulation & IEEE80211_OFDM_MODULATION) |
555 | strcat(wrqu->name, "/g"); | 555 | strlcat(wrqu->name, "/g", IFNAMSIZ); |
556 | }else if(ieee->modulation & IEEE80211_OFDM_MODULATION) | 556 | }else if(ieee->modulation & IEEE80211_OFDM_MODULATION) |
557 | strcat(wrqu->name, "g"); | 557 | strlcat(wrqu->name, "g", IFNAMSIZ); |
558 | if (ieee->mode & (IEEE_N_24G | IEEE_N_5G)) | 558 | if (ieee->mode & (IEEE_N_24G | IEEE_N_5G)) |
559 | strcat(wrqu->name, "/n"); | 559 | strlcat(wrqu->name, "/n", IFNAMSIZ); |
560 | 560 | ||
561 | if((ieee->state == IEEE80211_LINKED) || | 561 | if((ieee->state == IEEE80211_LINKED) || |
562 | (ieee->state == IEEE80211_LINKED_SCANNING)) | 562 | (ieee->state == IEEE80211_LINKED_SCANNING)) |
563 | strcat(wrqu->name," linked"); | 563 | strlcat(wrqu->name, " link", IFNAMSIZ); |
564 | else if(ieee->state != IEEE80211_NOLINK) | 564 | else if(ieee->state != IEEE80211_NOLINK) |
565 | strcat(wrqu->name," link.."); | 565 | strlcat(wrqu->name, " .....", IFNAMSIZ); |
566 | 566 | ||
567 | 567 | ||
568 | return 0; | 568 | return 0; |
diff --git a/drivers/staging/rtl8192su/r8192U_core.c b/drivers/staging/rtl8192su/r8192U_core.c index f1423d714496..4ab250743e81 100644 --- a/drivers/staging/rtl8192su/r8192U_core.c +++ b/drivers/staging/rtl8192su/r8192U_core.c | |||
@@ -12132,6 +12132,19 @@ static void HalUsbSetQueuePipeMapping8192SUsb(struct usb_interface *intf, struct | |||
12132 | } | 12132 | } |
12133 | #endif | 12133 | #endif |
12134 | 12134 | ||
12135 | static const struct net_device_ops rtl8192_netdev_ops = { | ||
12136 | .ndo_open = rtl8192_open, | ||
12137 | .ndo_stop = rtl8192_close, | ||
12138 | .ndo_get_stats = rtl8192_stats, | ||
12139 | .ndo_tx_timeout = tx_timeout, | ||
12140 | .ndo_do_ioctl = rtl8192_ioctl, | ||
12141 | .ndo_set_multicast_list = r8192_set_multicast, | ||
12142 | .ndo_set_mac_address = r8192_set_mac_adr, | ||
12143 | .ndo_validate_addr = eth_validate_addr, | ||
12144 | .ndo_change_mtu = eth_change_mtu, | ||
12145 | .ndo_start_xmit = ieee80211_xmit, | ||
12146 | }; | ||
12147 | |||
12135 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) | 12148 | #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) |
12136 | static int __devinit rtl8192_usb_probe(struct usb_interface *intf, | 12149 | static int __devinit rtl8192_usb_probe(struct usb_interface *intf, |
12137 | const struct usb_device_id *id) | 12150 | const struct usb_device_id *id) |
@@ -12186,15 +12199,7 @@ static void * __devinit rtl8192_usb_probe(struct usb_device *udev, | |||
12186 | priv->ops = &rtl8192u_ops; | 12199 | priv->ops = &rtl8192u_ops; |
12187 | #endif | 12200 | #endif |
12188 | 12201 | ||
12189 | dev->open = rtl8192_open; | 12202 | dev->netdev_ops = &rtl8192_netdev_ops; |
12190 | dev->stop = rtl8192_close; | ||
12191 | //dev->hard_start_xmit = rtl8192_8023_hard_start_xmit; | ||
12192 | dev->tx_timeout = tx_timeout; | ||
12193 | //dev->wireless_handlers = &r8192_wx_handlers_def; | ||
12194 | dev->do_ioctl = rtl8192_ioctl; | ||
12195 | dev->set_multicast_list = r8192_set_multicast; | ||
12196 | dev->set_mac_address = r8192_set_mac_adr; | ||
12197 | dev->get_stats = rtl8192_stats; | ||
12198 | 12203 | ||
12199 | //DMESG("Oops: i'm coming\n"); | 12204 | //DMESG("Oops: i'm coming\n"); |
12200 | #if WIRELESS_EXT >= 12 | 12205 | #if WIRELESS_EXT >= 12 |
diff --git a/drivers/staging/rtl8192su/r8192U_pm.c b/drivers/staging/rtl8192su/r8192U_pm.c index 92c95aa36638..b1531a8d0cde 100644 --- a/drivers/staging/rtl8192su/r8192U_pm.c +++ b/drivers/staging/rtl8192su/r8192U_pm.c | |||
@@ -35,7 +35,9 @@ int rtl8192U_suspend(struct usb_interface *intf, pm_message_t state) | |||
35 | return 0; | 35 | return 0; |
36 | } | 36 | } |
37 | 37 | ||
38 | dev->stop(dev); | 38 | if (dev->netdev_ops->ndo_stop) |
39 | dev->netdev_ops->ndo_stop(dev); | ||
40 | |||
39 | mdelay(10); | 41 | mdelay(10); |
40 | 42 | ||
41 | netif_device_detach(dev); | 43 | netif_device_detach(dev); |
@@ -61,7 +63,9 @@ int rtl8192U_resume (struct usb_interface *intf) | |||
61 | } | 63 | } |
62 | 64 | ||
63 | netif_device_attach(dev); | 65 | netif_device_attach(dev); |
64 | dev->open(dev); | 66 | |
67 | if (dev->netdev_ops->ndo_open) | ||
68 | dev->netdev_ops->ndo_open(dev); | ||
65 | } | 69 | } |
66 | 70 | ||
67 | return 0; | 71 | return 0; |
diff --git a/drivers/staging/serqt_usb2/serqt_usb2.c b/drivers/staging/serqt_usb2/serqt_usb2.c index 90b29b564631..a9bd4106beb7 100644 --- a/drivers/staging/serqt_usb2/serqt_usb2.c +++ b/drivers/staging/serqt_usb2/serqt_usb2.c | |||
@@ -866,7 +866,7 @@ static void qt_release(struct usb_serial *serial) | |||
866 | 866 | ||
867 | } | 867 | } |
868 | 868 | ||
869 | int qt_open(struct tty_struct *tty, | 869 | static int qt_open(struct tty_struct *tty, |
870 | struct usb_serial_port *port, struct file *filp) | 870 | struct usb_serial_port *port, struct file *filp) |
871 | { | 871 | { |
872 | struct usb_serial *serial; | 872 | struct usb_serial *serial; |
@@ -1041,17 +1041,19 @@ static void qt_block_until_empty(struct tty_struct *tty, | |||
1041 | } | 1041 | } |
1042 | } | 1042 | } |
1043 | 1043 | ||
1044 | static void qt_close(struct tty_struct *tty, struct usb_serial_port *port, | 1044 | static void qt_close( struct usb_serial_port *port) |
1045 | struct file *filp) | ||
1046 | { | 1045 | { |
1047 | struct usb_serial *serial = port->serial; | 1046 | struct usb_serial *serial = port->serial; |
1048 | struct quatech_port *qt_port; | 1047 | struct quatech_port *qt_port; |
1049 | struct quatech_port *port0; | 1048 | struct quatech_port *port0; |
1049 | struct tty_struct *tty; | ||
1050 | int status; | 1050 | int status; |
1051 | unsigned int index; | 1051 | unsigned int index; |
1052 | status = 0; | 1052 | status = 0; |
1053 | 1053 | ||
1054 | dbg("%s - port %d\n", __func__, port->number); | 1054 | dbg("%s - port %d\n", __func__, port->number); |
1055 | |||
1056 | tty = tty_port_tty_get(&port->port); | ||
1055 | index = tty->index - serial->minor; | 1057 | index = tty->index - serial->minor; |
1056 | 1058 | ||
1057 | qt_port = qt_get_port_private(port); | 1059 | qt_port = qt_get_port_private(port); |
diff --git a/drivers/staging/stlc45xx/stlc45xx.c b/drivers/staging/stlc45xx/stlc45xx.c index cfdaac9b747e..a137c78fac09 100644 --- a/drivers/staging/stlc45xx/stlc45xx.c +++ b/drivers/staging/stlc45xx/stlc45xx.c | |||
@@ -2235,24 +2235,6 @@ static void stlc45xx_op_remove_interface(struct ieee80211_hw *hw, | |||
2235 | stlc45xx_debug(DEBUG_FUNC, "%s", __func__); | 2235 | stlc45xx_debug(DEBUG_FUNC, "%s", __func__); |
2236 | } | 2236 | } |
2237 | 2237 | ||
2238 | static int stlc45xx_op_config_interface(struct ieee80211_hw *hw, | ||
2239 | struct ieee80211_vif *vif, | ||
2240 | struct ieee80211_if_conf *conf) | ||
2241 | { | ||
2242 | struct stlc45xx *stlc = hw->priv; | ||
2243 | |||
2244 | stlc45xx_debug(DEBUG_FUNC, "%s", __func__); | ||
2245 | |||
2246 | mutex_lock(&stlc->mutex); | ||
2247 | |||
2248 | memcpy(stlc->bssid, conf->bssid, ETH_ALEN); | ||
2249 | stlc45xx_tx_setup(stlc); | ||
2250 | |||
2251 | mutex_unlock(&stlc->mutex); | ||
2252 | |||
2253 | return 0; | ||
2254 | } | ||
2255 | |||
2256 | static int stlc45xx_op_config(struct ieee80211_hw *hw, u32 changed) | 2238 | static int stlc45xx_op_config(struct ieee80211_hw *hw, u32 changed) |
2257 | { | 2239 | { |
2258 | struct stlc45xx *stlc = hw->priv; | 2240 | struct stlc45xx *stlc = hw->priv; |
@@ -2295,6 +2277,14 @@ static void stlc45xx_op_bss_info_changed(struct ieee80211_hw *hw, | |||
2295 | { | 2277 | { |
2296 | struct stlc45xx *stlc = hw->priv; | 2278 | struct stlc45xx *stlc = hw->priv; |
2297 | 2279 | ||
2280 | stlc45xx_debug(DEBUG_FUNC, "%s", __func__); | ||
2281 | mutex_lock(&stlc->mutex); | ||
2282 | |||
2283 | memcpy(stlc->bssid, info->bssid, ETH_ALEN); | ||
2284 | stlc45xx_tx_setup(stlc); | ||
2285 | |||
2286 | mutex_unlock(&stlc->mutex); | ||
2287 | |||
2298 | if (changed & BSS_CHANGED_ASSOC) { | 2288 | if (changed & BSS_CHANGED_ASSOC) { |
2299 | stlc->associated = info->assoc; | 2289 | stlc->associated = info->assoc; |
2300 | if (info->assoc) | 2290 | if (info->assoc) |
@@ -2357,7 +2347,6 @@ static const struct ieee80211_ops stlc45xx_ops = { | |||
2357 | .add_interface = stlc45xx_op_add_interface, | 2347 | .add_interface = stlc45xx_op_add_interface, |
2358 | .remove_interface = stlc45xx_op_remove_interface, | 2348 | .remove_interface = stlc45xx_op_remove_interface, |
2359 | .config = stlc45xx_op_config, | 2349 | .config = stlc45xx_op_config, |
2360 | .config_interface = stlc45xx_op_config_interface, | ||
2361 | .configure_filter = stlc45xx_op_configure_filter, | 2350 | .configure_filter = stlc45xx_op_configure_filter, |
2362 | .tx = stlc45xx_op_tx, | 2351 | .tx = stlc45xx_op_tx, |
2363 | .bss_info_changed = stlc45xx_op_bss_info_changed, | 2352 | .bss_info_changed = stlc45xx_op_bss_info_changed, |
diff --git a/drivers/staging/usbip/usbip_common.c b/drivers/staging/usbip/usbip_common.c index 22f93dd0ba03..251220dc8851 100644 --- a/drivers/staging/usbip/usbip_common.c +++ b/drivers/staging/usbip/usbip_common.c | |||
@@ -18,6 +18,7 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
21 | #include <linux/smp_lock.h> | ||
21 | #include <linux/file.h> | 22 | #include <linux/file.h> |
22 | #include <linux/tcp.h> | 23 | #include <linux/tcp.h> |
23 | #include <linux/in.h> | 24 | #include <linux/in.h> |
diff --git a/drivers/staging/vt6655/device_main.c b/drivers/staging/vt6655/device_main.c index a10ed27acbc2..f43ca416e4a8 100644 --- a/drivers/staging/vt6655/device_main.c +++ b/drivers/staging/vt6655/device_main.c | |||
@@ -344,7 +344,7 @@ static CHIP_INFO chip_info_table[]= { | |||
344 | }; | 344 | }; |
345 | 345 | ||
346 | static struct pci_device_id device_id_table[] __devinitdata = { | 346 | static struct pci_device_id device_id_table[] __devinitdata = { |
347 | { 0x1106, 0x3253, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (int)&chip_info_table[0]}, | 347 | { 0x1106, 0x3253, PCI_ANY_ID, PCI_ANY_ID, 0, 0, (long)&chip_info_table[0]}, |
348 | { 0, } | 348 | { 0, } |
349 | }; | 349 | }; |
350 | #endif | 350 | #endif |
@@ -369,7 +369,7 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd); | |||
369 | 369 | ||
370 | #ifdef CONFIG_PM | 370 | #ifdef CONFIG_PM |
371 | static int device_notify_reboot(struct notifier_block *, unsigned long event, void *ptr); | 371 | static int device_notify_reboot(struct notifier_block *, unsigned long event, void *ptr); |
372 | static int viawget_suspend(struct pci_dev *pcid, u32 state); | 372 | static int viawget_suspend(struct pci_dev *pcid, pm_message_t state); |
373 | static int viawget_resume(struct pci_dev *pcid); | 373 | static int viawget_resume(struct pci_dev *pcid); |
374 | struct notifier_block device_notifier = { | 374 | struct notifier_block device_notifier = { |
375 | notifier_call: device_notify_reboot, | 375 | notifier_call: device_notify_reboot, |
@@ -3941,7 +3941,7 @@ device_notify_reboot(struct notifier_block *nb, unsigned long event, void *p) | |||
3941 | while ((pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL) { | 3941 | while ((pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL) { |
3942 | if(pci_dev_driver(pdev) == &device_driver) { | 3942 | if(pci_dev_driver(pdev) == &device_driver) { |
3943 | if (pci_get_drvdata(pdev)) | 3943 | if (pci_get_drvdata(pdev)) |
3944 | viawget_suspend(pdev, 3); | 3944 | viawget_suspend(pdev, PMSG_HIBERNATE); |
3945 | } | 3945 | } |
3946 | } | 3946 | } |
3947 | } | 3947 | } |
@@ -3949,7 +3949,7 @@ device_notify_reboot(struct notifier_block *nb, unsigned long event, void *p) | |||
3949 | } | 3949 | } |
3950 | 3950 | ||
3951 | static int | 3951 | static int |
3952 | viawget_suspend(struct pci_dev *pcid, u32 state) | 3952 | viawget_suspend(struct pci_dev *pcid, pm_message_t state) |
3953 | { | 3953 | { |
3954 | int power_status; // to silence the compiler | 3954 | int power_status; // to silence the compiler |
3955 | 3955 | ||
@@ -3971,7 +3971,7 @@ viawget_suspend(struct pci_dev *pcid, u32 state) | |||
3971 | memset(pMgmt->abyCurrBSSID, 0, 6); | 3971 | memset(pMgmt->abyCurrBSSID, 0, 6); |
3972 | pMgmt->eCurrState = WMAC_STATE_IDLE; | 3972 | pMgmt->eCurrState = WMAC_STATE_IDLE; |
3973 | pci_disable_device(pcid); | 3973 | pci_disable_device(pcid); |
3974 | power_status = pci_set_power_state(pcid, state); | 3974 | power_status = pci_set_power_state(pcid, pci_choose_state(pcid, state)); |
3975 | spin_unlock_irq(&pDevice->lock); | 3975 | spin_unlock_irq(&pDevice->lock); |
3976 | return 0; | 3976 | return 0; |
3977 | } | 3977 | } |
diff --git a/drivers/telephony/ixj.c b/drivers/telephony/ixj.c index a913efc69669..40de151f2789 100644 --- a/drivers/telephony/ixj.c +++ b/drivers/telephony/ixj.c | |||
@@ -257,6 +257,7 @@ | |||
257 | #include <linux/fs.h> /* everything... */ | 257 | #include <linux/fs.h> /* everything... */ |
258 | #include <linux/errno.h> /* error codes */ | 258 | #include <linux/errno.h> /* error codes */ |
259 | #include <linux/slab.h> | 259 | #include <linux/slab.h> |
260 | #include <linux/smp_lock.h> | ||
260 | #include <linux/mm.h> | 261 | #include <linux/mm.h> |
261 | #include <linux/ioport.h> | 262 | #include <linux/ioport.h> |
262 | #include <linux/interrupt.h> | 263 | #include <linux/interrupt.h> |
diff --git a/drivers/telephony/phonedev.c b/drivers/telephony/phonedev.c index b52cc830c0b4..f3873f650bb4 100644 --- a/drivers/telephony/phonedev.c +++ b/drivers/telephony/phonedev.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/errno.h> | 23 | #include <linux/errno.h> |
24 | #include <linux/phonedev.h> | 24 | #include <linux/phonedev.h> |
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/smp_lock.h> | ||
27 | #include <asm/uaccess.h> | 26 | #include <asm/uaccess.h> |
28 | #include <asm/system.h> | 27 | #include <asm/system.h> |
29 | 28 | ||
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index 3f1045993474..5b15d9d8896b 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -387,6 +387,7 @@ static void acm_rx_tasklet(unsigned long _acm) | |||
387 | struct acm_ru *rcv; | 387 | struct acm_ru *rcv; |
388 | unsigned long flags; | 388 | unsigned long flags; |
389 | unsigned char throttled; | 389 | unsigned char throttled; |
390 | struct usb_host_endpoint *ep; | ||
390 | 391 | ||
391 | dbg("Entering acm_rx_tasklet"); | 392 | dbg("Entering acm_rx_tasklet"); |
392 | 393 | ||
@@ -462,11 +463,20 @@ urbs: | |||
462 | 463 | ||
463 | rcv->buffer = buf; | 464 | rcv->buffer = buf; |
464 | 465 | ||
465 | usb_fill_bulk_urb(rcv->urb, acm->dev, | 466 | ep = (usb_pipein(acm->rx_endpoint) ? acm->dev->ep_in : acm->dev->ep_out) |
466 | acm->rx_endpoint, | 467 | [usb_pipeendpoint(acm->rx_endpoint)]; |
467 | buf->base, | 468 | if (usb_endpoint_xfer_int(&ep->desc)) |
468 | acm->readsize, | 469 | usb_fill_int_urb(rcv->urb, acm->dev, |
469 | acm_read_bulk, rcv); | 470 | acm->rx_endpoint, |
471 | buf->base, | ||
472 | acm->readsize, | ||
473 | acm_read_bulk, rcv, ep->desc.bInterval); | ||
474 | else | ||
475 | usb_fill_bulk_urb(rcv->urb, acm->dev, | ||
476 | acm->rx_endpoint, | ||
477 | buf->base, | ||
478 | acm->readsize, | ||
479 | acm_read_bulk, rcv); | ||
470 | rcv->urb->transfer_dma = buf->dma; | 480 | rcv->urb->transfer_dma = buf->dma; |
471 | rcv->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | 481 | rcv->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
472 | 482 | ||
@@ -1227,9 +1237,14 @@ made_compressed_probe: | |||
1227 | goto alloc_fail7; | 1237 | goto alloc_fail7; |
1228 | } | 1238 | } |
1229 | 1239 | ||
1230 | usb_fill_bulk_urb(snd->urb, usb_dev, | 1240 | if (usb_endpoint_xfer_int(epwrite)) |
1231 | usb_sndbulkpipe(usb_dev, epwrite->bEndpointAddress), | 1241 | usb_fill_int_urb(snd->urb, usb_dev, |
1232 | NULL, acm->writesize, acm_write_bulk, snd); | 1242 | usb_sndbulkpipe(usb_dev, epwrite->bEndpointAddress), |
1243 | NULL, acm->writesize, acm_write_bulk, snd, epwrite->bInterval); | ||
1244 | else | ||
1245 | usb_fill_bulk_urb(snd->urb, usb_dev, | ||
1246 | usb_sndbulkpipe(usb_dev, epwrite->bEndpointAddress), | ||
1247 | NULL, acm->writesize, acm_write_bulk, snd); | ||
1233 | snd->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | 1248 | snd->urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; |
1234 | snd->instance = acm; | 1249 | snd->instance = acm; |
1235 | } | 1250 | } |
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index 0fe434505ac4..ba589d4ca8bc 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c | |||
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/errno.h> | 15 | #include <linux/errno.h> |
16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/smp_lock.h> | ||
19 | #include <linux/mutex.h> | 18 | #include <linux/mutex.h> |
20 | #include <linux/uaccess.h> | 19 | #include <linux/uaccess.h> |
21 | #include <linux/bitops.h> | 20 | #include <linux/bitops.h> |
diff --git a/drivers/usb/class/usbtmc.c b/drivers/usb/class/usbtmc.c index 3703789d0d2a..b09a527f7341 100644 --- a/drivers/usb/class/usbtmc.c +++ b/drivers/usb/class/usbtmc.c | |||
@@ -751,7 +751,7 @@ static int get_capabilities(struct usbtmc_device_data *data) | |||
751 | { | 751 | { |
752 | struct device *dev = &data->usb_dev->dev; | 752 | struct device *dev = &data->usb_dev->dev; |
753 | char *buffer; | 753 | char *buffer; |
754 | int rv; | 754 | int rv = 0; |
755 | 755 | ||
756 | buffer = kmalloc(0x18, GFP_KERNEL); | 756 | buffer = kmalloc(0x18, GFP_KERNEL); |
757 | if (!buffer) | 757 | if (!buffer) |
@@ -763,7 +763,7 @@ static int get_capabilities(struct usbtmc_device_data *data) | |||
763 | 0, 0, buffer, 0x18, USBTMC_TIMEOUT); | 763 | 0, 0, buffer, 0x18, USBTMC_TIMEOUT); |
764 | if (rv < 0) { | 764 | if (rv < 0) { |
765 | dev_err(dev, "usb_control_msg returned %d\n", rv); | 765 | dev_err(dev, "usb_control_msg returned %d\n", rv); |
766 | return rv; | 766 | goto err_out; |
767 | } | 767 | } |
768 | 768 | ||
769 | dev_dbg(dev, "GET_CAPABILITIES returned %x\n", buffer[0]); | 769 | dev_dbg(dev, "GET_CAPABILITIES returned %x\n", buffer[0]); |
@@ -773,7 +773,8 @@ static int get_capabilities(struct usbtmc_device_data *data) | |||
773 | dev_dbg(dev, "USB488 device capabilities are %x\n", buffer[15]); | 773 | dev_dbg(dev, "USB488 device capabilities are %x\n", buffer[15]); |
774 | if (buffer[0] != USBTMC_STATUS_SUCCESS) { | 774 | if (buffer[0] != USBTMC_STATUS_SUCCESS) { |
775 | dev_err(dev, "GET_CAPABILITIES returned %x\n", buffer[0]); | 775 | dev_err(dev, "GET_CAPABILITIES returned %x\n", buffer[0]); |
776 | return -EPERM; | 776 | rv = -EPERM; |
777 | goto err_out; | ||
777 | } | 778 | } |
778 | 779 | ||
779 | data->capabilities.interface_capabilities = buffer[4]; | 780 | data->capabilities.interface_capabilities = buffer[4]; |
@@ -781,8 +782,9 @@ static int get_capabilities(struct usbtmc_device_data *data) | |||
781 | data->capabilities.usb488_interface_capabilities = buffer[14]; | 782 | data->capabilities.usb488_interface_capabilities = buffer[14]; |
782 | data->capabilities.usb488_device_capabilities = buffer[15]; | 783 | data->capabilities.usb488_device_capabilities = buffer[15]; |
783 | 784 | ||
785 | err_out: | ||
784 | kfree(buffer); | 786 | kfree(buffer); |
785 | return 0; | 787 | return rv; |
786 | } | 788 | } |
787 | 789 | ||
788 | #define capability_attribute(name) \ | 790 | #define capability_attribute(name) \ |
diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig index 69280c35b5cb..ad925946f869 100644 --- a/drivers/usb/core/Kconfig +++ b/drivers/usb/core/Kconfig | |||
@@ -28,7 +28,7 @@ comment "Miscellaneous USB options" | |||
28 | depends on USB | 28 | depends on USB |
29 | 29 | ||
30 | config USB_DEVICEFS | 30 | config USB_DEVICEFS |
31 | bool "USB device filesystem (DEPRECATED)" if EMBEDDED | 31 | bool "USB device filesystem (DEPRECATED)" |
32 | depends on USB | 32 | depends on USB |
33 | ---help--- | 33 | ---help--- |
34 | If you say Y here (and to "/proc file system support" in the "File | 34 | If you say Y here (and to "/proc file system support" in the "File |
diff --git a/drivers/usb/core/devices.c b/drivers/usb/core/devices.c index 73c108d117b4..96f11715cd26 100644 --- a/drivers/usb/core/devices.c +++ b/drivers/usb/core/devices.c | |||
@@ -136,17 +136,19 @@ static const struct class_info clas_info[] = | |||
136 | {USB_CLASS_AUDIO, "audio"}, | 136 | {USB_CLASS_AUDIO, "audio"}, |
137 | {USB_CLASS_COMM, "comm."}, | 137 | {USB_CLASS_COMM, "comm."}, |
138 | {USB_CLASS_HID, "HID"}, | 138 | {USB_CLASS_HID, "HID"}, |
139 | {USB_CLASS_HUB, "hub"}, | ||
140 | {USB_CLASS_PHYSICAL, "PID"}, | 139 | {USB_CLASS_PHYSICAL, "PID"}, |
140 | {USB_CLASS_STILL_IMAGE, "still"}, | ||
141 | {USB_CLASS_PRINTER, "print"}, | 141 | {USB_CLASS_PRINTER, "print"}, |
142 | {USB_CLASS_MASS_STORAGE, "stor."}, | 142 | {USB_CLASS_MASS_STORAGE, "stor."}, |
143 | {USB_CLASS_HUB, "hub"}, | ||
143 | {USB_CLASS_CDC_DATA, "data"}, | 144 | {USB_CLASS_CDC_DATA, "data"}, |
144 | {USB_CLASS_APP_SPEC, "app."}, | ||
145 | {USB_CLASS_VENDOR_SPEC, "vend."}, | ||
146 | {USB_CLASS_STILL_IMAGE, "still"}, | ||
147 | {USB_CLASS_CSCID, "scard"}, | 145 | {USB_CLASS_CSCID, "scard"}, |
148 | {USB_CLASS_CONTENT_SEC, "c-sec"}, | 146 | {USB_CLASS_CONTENT_SEC, "c-sec"}, |
149 | {USB_CLASS_VIDEO, "video"}, | 147 | {USB_CLASS_VIDEO, "video"}, |
148 | {USB_CLASS_WIRELESS_CONTROLLER, "wlcon"}, | ||
149 | {USB_CLASS_MISC, "misc"}, | ||
150 | {USB_CLASS_APP_SPEC, "app."}, | ||
151 | {USB_CLASS_VENDOR_SPEC, "vend."}, | ||
150 | {-1, "unk."} /* leave as last */ | 152 | {-1, "unk."} /* leave as last */ |
151 | }; | 153 | }; |
152 | 154 | ||
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 308609039c73..38b8bce782d6 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -325,21 +325,34 @@ static void async_completed(struct urb *urb) | |||
325 | struct async *as = urb->context; | 325 | struct async *as = urb->context; |
326 | struct dev_state *ps = as->ps; | 326 | struct dev_state *ps = as->ps; |
327 | struct siginfo sinfo; | 327 | struct siginfo sinfo; |
328 | struct pid *pid = NULL; | ||
329 | uid_t uid = 0; | ||
330 | uid_t euid = 0; | ||
331 | u32 secid = 0; | ||
332 | int signr; | ||
328 | 333 | ||
329 | spin_lock(&ps->lock); | 334 | spin_lock(&ps->lock); |
330 | list_move_tail(&as->asynclist, &ps->async_completed); | 335 | list_move_tail(&as->asynclist, &ps->async_completed); |
331 | spin_unlock(&ps->lock); | ||
332 | as->status = urb->status; | 336 | as->status = urb->status; |
333 | if (as->signr) { | 337 | signr = as->signr; |
338 | if (signr) { | ||
334 | sinfo.si_signo = as->signr; | 339 | sinfo.si_signo = as->signr; |
335 | sinfo.si_errno = as->status; | 340 | sinfo.si_errno = as->status; |
336 | sinfo.si_code = SI_ASYNCIO; | 341 | sinfo.si_code = SI_ASYNCIO; |
337 | sinfo.si_addr = as->userurb; | 342 | sinfo.si_addr = as->userurb; |
338 | kill_pid_info_as_uid(as->signr, &sinfo, as->pid, as->uid, | 343 | pid = as->pid; |
339 | as->euid, as->secid); | 344 | uid = as->uid; |
345 | euid = as->euid; | ||
346 | secid = as->secid; | ||
340 | } | 347 | } |
341 | snoop(&urb->dev->dev, "urb complete\n"); | 348 | snoop(&urb->dev->dev, "urb complete\n"); |
342 | snoop_urb(urb, as->userurb); | 349 | snoop_urb(urb, as->userurb); |
350 | spin_unlock(&ps->lock); | ||
351 | |||
352 | if (signr) | ||
353 | kill_pid_info_as_uid(sinfo.si_signo, &sinfo, pid, uid, | ||
354 | euid, secid); | ||
355 | |||
343 | wake_up(&ps->wait); | 356 | wake_up(&ps->wait); |
344 | } | 357 | } |
345 | 358 | ||
@@ -982,7 +995,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
982 | USBDEVFS_URB_ZERO_PACKET | | 995 | USBDEVFS_URB_ZERO_PACKET | |
983 | USBDEVFS_URB_NO_INTERRUPT)) | 996 | USBDEVFS_URB_NO_INTERRUPT)) |
984 | return -EINVAL; | 997 | return -EINVAL; |
985 | if (!uurb->buffer) | 998 | if (uurb->buffer_length > 0 && !uurb->buffer) |
986 | return -EINVAL; | 999 | return -EINVAL; |
987 | if (!(uurb->type == USBDEVFS_URB_TYPE_CONTROL && | 1000 | if (!(uurb->type == USBDEVFS_URB_TYPE_CONTROL && |
988 | (uurb->endpoint & ~USB_ENDPOINT_DIR_MASK) == 0)) { | 1001 | (uurb->endpoint & ~USB_ENDPOINT_DIR_MASK) == 0)) { |
@@ -1038,11 +1051,6 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1038 | is_in = 0; | 1051 | is_in = 0; |
1039 | uurb->endpoint &= ~USB_DIR_IN; | 1052 | uurb->endpoint &= ~USB_DIR_IN; |
1040 | } | 1053 | } |
1041 | if (!access_ok(is_in ? VERIFY_WRITE : VERIFY_READ, | ||
1042 | uurb->buffer, uurb->buffer_length)) { | ||
1043 | kfree(dr); | ||
1044 | return -EFAULT; | ||
1045 | } | ||
1046 | snoop(&ps->dev->dev, "control urb: bRequest=%02x " | 1054 | snoop(&ps->dev->dev, "control urb: bRequest=%02x " |
1047 | "bRrequestType=%02x wValue=%04x " | 1055 | "bRrequestType=%02x wValue=%04x " |
1048 | "wIndex=%04x wLength=%04x\n", | 1056 | "wIndex=%04x wLength=%04x\n", |
@@ -1062,9 +1070,6 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1062 | uurb->number_of_packets = 0; | 1070 | uurb->number_of_packets = 0; |
1063 | if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE) | 1071 | if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE) |
1064 | return -EINVAL; | 1072 | return -EINVAL; |
1065 | if (!access_ok(is_in ? VERIFY_WRITE : VERIFY_READ, | ||
1066 | uurb->buffer, uurb->buffer_length)) | ||
1067 | return -EFAULT; | ||
1068 | snoop(&ps->dev->dev, "bulk urb\n"); | 1073 | snoop(&ps->dev->dev, "bulk urb\n"); |
1069 | break; | 1074 | break; |
1070 | 1075 | ||
@@ -1106,28 +1111,35 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1106 | return -EINVAL; | 1111 | return -EINVAL; |
1107 | if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE) | 1112 | if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE) |
1108 | return -EINVAL; | 1113 | return -EINVAL; |
1109 | if (!access_ok(is_in ? VERIFY_WRITE : VERIFY_READ, | ||
1110 | uurb->buffer, uurb->buffer_length)) | ||
1111 | return -EFAULT; | ||
1112 | snoop(&ps->dev->dev, "interrupt urb\n"); | 1114 | snoop(&ps->dev->dev, "interrupt urb\n"); |
1113 | break; | 1115 | break; |
1114 | 1116 | ||
1115 | default: | 1117 | default: |
1116 | return -EINVAL; | 1118 | return -EINVAL; |
1117 | } | 1119 | } |
1118 | as = alloc_async(uurb->number_of_packets); | 1120 | if (uurb->buffer_length > 0 && |
1119 | if (!as) { | 1121 | !access_ok(is_in ? VERIFY_WRITE : VERIFY_READ, |
1122 | uurb->buffer, uurb->buffer_length)) { | ||
1120 | kfree(isopkt); | 1123 | kfree(isopkt); |
1121 | kfree(dr); | 1124 | kfree(dr); |
1122 | return -ENOMEM; | 1125 | return -EFAULT; |
1123 | } | 1126 | } |
1124 | as->urb->transfer_buffer = kmalloc(uurb->buffer_length, GFP_KERNEL); | 1127 | as = alloc_async(uurb->number_of_packets); |
1125 | if (!as->urb->transfer_buffer) { | 1128 | if (!as) { |
1126 | kfree(isopkt); | 1129 | kfree(isopkt); |
1127 | kfree(dr); | 1130 | kfree(dr); |
1128 | free_async(as); | ||
1129 | return -ENOMEM; | 1131 | return -ENOMEM; |
1130 | } | 1132 | } |
1133 | if (uurb->buffer_length > 0) { | ||
1134 | as->urb->transfer_buffer = kmalloc(uurb->buffer_length, | ||
1135 | GFP_KERNEL); | ||
1136 | if (!as->urb->transfer_buffer) { | ||
1137 | kfree(isopkt); | ||
1138 | kfree(dr); | ||
1139 | free_async(as); | ||
1140 | return -ENOMEM; | ||
1141 | } | ||
1142 | } | ||
1131 | as->urb->dev = ps->dev; | 1143 | as->urb->dev = ps->dev; |
1132 | as->urb->pipe = (uurb->type << 30) | | 1144 | as->urb->pipe = (uurb->type << 30) | |
1133 | __create_pipe(ps->dev, uurb->endpoint & 0xf) | | 1145 | __create_pipe(ps->dev, uurb->endpoint & 0xf) | |
@@ -1169,7 +1181,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1169 | kfree(isopkt); | 1181 | kfree(isopkt); |
1170 | as->ps = ps; | 1182 | as->ps = ps; |
1171 | as->userurb = arg; | 1183 | as->userurb = arg; |
1172 | if (uurb->endpoint & USB_DIR_IN) | 1184 | if (is_in && uurb->buffer_length > 0) |
1173 | as->userbuffer = uurb->buffer; | 1185 | as->userbuffer = uurb->buffer; |
1174 | else | 1186 | else |
1175 | as->userbuffer = NULL; | 1187 | as->userbuffer = NULL; |
@@ -1179,9 +1191,9 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, | |||
1179 | as->uid = cred->uid; | 1191 | as->uid = cred->uid; |
1180 | as->euid = cred->euid; | 1192 | as->euid = cred->euid; |
1181 | security_task_getsecid(current, &as->secid); | 1193 | security_task_getsecid(current, &as->secid); |
1182 | if (!is_in) { | 1194 | if (!is_in && uurb->buffer_length > 0) { |
1183 | if (copy_from_user(as->urb->transfer_buffer, uurb->buffer, | 1195 | if (copy_from_user(as->urb->transfer_buffer, uurb->buffer, |
1184 | as->urb->transfer_buffer_length)) { | 1196 | uurb->buffer_length)) { |
1185 | free_async(as); | 1197 | free_async(as); |
1186 | return -EFAULT; | 1198 | return -EFAULT; |
1187 | } | 1199 | } |
@@ -1231,22 +1243,22 @@ static int processcompl(struct async *as, void __user * __user *arg) | |||
1231 | if (as->userbuffer) | 1243 | if (as->userbuffer) |
1232 | if (copy_to_user(as->userbuffer, urb->transfer_buffer, | 1244 | if (copy_to_user(as->userbuffer, urb->transfer_buffer, |
1233 | urb->transfer_buffer_length)) | 1245 | urb->transfer_buffer_length)) |
1234 | return -EFAULT; | 1246 | goto err_out; |
1235 | if (put_user(as->status, &userurb->status)) | 1247 | if (put_user(as->status, &userurb->status)) |
1236 | return -EFAULT; | 1248 | goto err_out; |
1237 | if (put_user(urb->actual_length, &userurb->actual_length)) | 1249 | if (put_user(urb->actual_length, &userurb->actual_length)) |
1238 | return -EFAULT; | 1250 | goto err_out; |
1239 | if (put_user(urb->error_count, &userurb->error_count)) | 1251 | if (put_user(urb->error_count, &userurb->error_count)) |
1240 | return -EFAULT; | 1252 | goto err_out; |
1241 | 1253 | ||
1242 | if (usb_endpoint_xfer_isoc(&urb->ep->desc)) { | 1254 | if (usb_endpoint_xfer_isoc(&urb->ep->desc)) { |
1243 | for (i = 0; i < urb->number_of_packets; i++) { | 1255 | for (i = 0; i < urb->number_of_packets; i++) { |
1244 | if (put_user(urb->iso_frame_desc[i].actual_length, | 1256 | if (put_user(urb->iso_frame_desc[i].actual_length, |
1245 | &userurb->iso_frame_desc[i].actual_length)) | 1257 | &userurb->iso_frame_desc[i].actual_length)) |
1246 | return -EFAULT; | 1258 | goto err_out; |
1247 | if (put_user(urb->iso_frame_desc[i].status, | 1259 | if (put_user(urb->iso_frame_desc[i].status, |
1248 | &userurb->iso_frame_desc[i].status)) | 1260 | &userurb->iso_frame_desc[i].status)) |
1249 | return -EFAULT; | 1261 | goto err_out; |
1250 | } | 1262 | } |
1251 | } | 1263 | } |
1252 | 1264 | ||
@@ -1255,6 +1267,10 @@ static int processcompl(struct async *as, void __user * __user *arg) | |||
1255 | if (put_user(addr, (void __user * __user *)arg)) | 1267 | if (put_user(addr, (void __user * __user *)arg)) |
1256 | return -EFAULT; | 1268 | return -EFAULT; |
1257 | return 0; | 1269 | return 0; |
1270 | |||
1271 | err_out: | ||
1272 | free_async(as); | ||
1273 | return -EFAULT; | ||
1258 | } | 1274 | } |
1259 | 1275 | ||
1260 | static struct async *reap_as(struct dev_state *ps) | 1276 | static struct async *reap_as(struct dev_state *ps) |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index ce3f453f02ef..95ccfa0b9fc5 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -648,7 +648,7 @@ void usb_hcd_poll_rh_status(struct usb_hcd *hcd) | |||
648 | struct urb *urb; | 648 | struct urb *urb; |
649 | int length; | 649 | int length; |
650 | unsigned long flags; | 650 | unsigned long flags; |
651 | char buffer[4]; /* Any root hubs with > 31 ports? */ | 651 | char buffer[6]; /* Any root hubs with > 31 ports? */ |
652 | 652 | ||
653 | if (unlikely(!hcd->rh_registered)) | 653 | if (unlikely(!hcd->rh_registered)) |
654 | return; | 654 | return; |
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h index d397ecfd5b17..ec5c67ea07b7 100644 --- a/drivers/usb/core/hcd.h +++ b/drivers/usb/core/hcd.h | |||
@@ -227,6 +227,10 @@ struct hc_driver { | |||
227 | /* has a port been handed over to a companion? */ | 227 | /* has a port been handed over to a companion? */ |
228 | int (*port_handed_over)(struct usb_hcd *, int); | 228 | int (*port_handed_over)(struct usb_hcd *, int); |
229 | 229 | ||
230 | /* CLEAR_TT_BUFFER completion callback */ | ||
231 | void (*clear_tt_buffer_complete)(struct usb_hcd *, | ||
232 | struct usb_host_endpoint *); | ||
233 | |||
230 | /* xHCI specific functions */ | 234 | /* xHCI specific functions */ |
231 | /* Called by usb_alloc_dev to alloc HC device structures */ | 235 | /* Called by usb_alloc_dev to alloc HC device structures */ |
232 | int (*alloc_dev)(struct usb_hcd *, struct usb_device *); | 236 | int (*alloc_dev)(struct usb_hcd *, struct usb_device *); |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 2af3b4f06054..71f86c60d83c 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -450,10 +450,10 @@ hub_clear_tt_buffer (struct usb_device *hdev, u16 devinfo, u16 tt) | |||
450 | * talking to TTs must queue control transfers (not just bulk and iso), so | 450 | * talking to TTs must queue control transfers (not just bulk and iso), so |
451 | * both can talk to the same hub concurrently. | 451 | * both can talk to the same hub concurrently. |
452 | */ | 452 | */ |
453 | static void hub_tt_kevent (struct work_struct *work) | 453 | static void hub_tt_work(struct work_struct *work) |
454 | { | 454 | { |
455 | struct usb_hub *hub = | 455 | struct usb_hub *hub = |
456 | container_of(work, struct usb_hub, tt.kevent); | 456 | container_of(work, struct usb_hub, tt.clear_work); |
457 | unsigned long flags; | 457 | unsigned long flags; |
458 | int limit = 100; | 458 | int limit = 100; |
459 | 459 | ||
@@ -462,6 +462,7 @@ static void hub_tt_kevent (struct work_struct *work) | |||
462 | struct list_head *next; | 462 | struct list_head *next; |
463 | struct usb_tt_clear *clear; | 463 | struct usb_tt_clear *clear; |
464 | struct usb_device *hdev = hub->hdev; | 464 | struct usb_device *hdev = hub->hdev; |
465 | const struct hc_driver *drv; | ||
465 | int status; | 466 | int status; |
466 | 467 | ||
467 | next = hub->tt.clear_list.next; | 468 | next = hub->tt.clear_list.next; |
@@ -471,21 +472,25 @@ static void hub_tt_kevent (struct work_struct *work) | |||
471 | /* drop lock so HCD can concurrently report other TT errors */ | 472 | /* drop lock so HCD can concurrently report other TT errors */ |
472 | spin_unlock_irqrestore (&hub->tt.lock, flags); | 473 | spin_unlock_irqrestore (&hub->tt.lock, flags); |
473 | status = hub_clear_tt_buffer (hdev, clear->devinfo, clear->tt); | 474 | status = hub_clear_tt_buffer (hdev, clear->devinfo, clear->tt); |
474 | spin_lock_irqsave (&hub->tt.lock, flags); | ||
475 | |||
476 | if (status) | 475 | if (status) |
477 | dev_err (&hdev->dev, | 476 | dev_err (&hdev->dev, |
478 | "clear tt %d (%04x) error %d\n", | 477 | "clear tt %d (%04x) error %d\n", |
479 | clear->tt, clear->devinfo, status); | 478 | clear->tt, clear->devinfo, status); |
479 | |||
480 | /* Tell the HCD, even if the operation failed */ | ||
481 | drv = clear->hcd->driver; | ||
482 | if (drv->clear_tt_buffer_complete) | ||
483 | (drv->clear_tt_buffer_complete)(clear->hcd, clear->ep); | ||
484 | |||
480 | kfree(clear); | 485 | kfree(clear); |
486 | spin_lock_irqsave(&hub->tt.lock, flags); | ||
481 | } | 487 | } |
482 | spin_unlock_irqrestore (&hub->tt.lock, flags); | 488 | spin_unlock_irqrestore (&hub->tt.lock, flags); |
483 | } | 489 | } |
484 | 490 | ||
485 | /** | 491 | /** |
486 | * usb_hub_tt_clear_buffer - clear control/bulk TT state in high speed hub | 492 | * usb_hub_clear_tt_buffer - clear control/bulk TT state in high speed hub |
487 | * @udev: the device whose split transaction failed | 493 | * @urb: an URB associated with the failed or incomplete split transaction |
488 | * @pipe: identifies the endpoint of the failed transaction | ||
489 | * | 494 | * |
490 | * High speed HCDs use this to tell the hub driver that some split control or | 495 | * High speed HCDs use this to tell the hub driver that some split control or |
491 | * bulk transaction failed in a way that requires clearing internal state of | 496 | * bulk transaction failed in a way that requires clearing internal state of |
@@ -495,8 +500,10 @@ static void hub_tt_kevent (struct work_struct *work) | |||
495 | * It may not be possible for that hub to handle additional full (or low) | 500 | * It may not be possible for that hub to handle additional full (or low) |
496 | * speed transactions until that state is fully cleared out. | 501 | * speed transactions until that state is fully cleared out. |
497 | */ | 502 | */ |
498 | void usb_hub_tt_clear_buffer (struct usb_device *udev, int pipe) | 503 | int usb_hub_clear_tt_buffer(struct urb *urb) |
499 | { | 504 | { |
505 | struct usb_device *udev = urb->dev; | ||
506 | int pipe = urb->pipe; | ||
500 | struct usb_tt *tt = udev->tt; | 507 | struct usb_tt *tt = udev->tt; |
501 | unsigned long flags; | 508 | unsigned long flags; |
502 | struct usb_tt_clear *clear; | 509 | struct usb_tt_clear *clear; |
@@ -508,7 +515,7 @@ void usb_hub_tt_clear_buffer (struct usb_device *udev, int pipe) | |||
508 | if ((clear = kmalloc (sizeof *clear, GFP_ATOMIC)) == NULL) { | 515 | if ((clear = kmalloc (sizeof *clear, GFP_ATOMIC)) == NULL) { |
509 | dev_err (&udev->dev, "can't save CLEAR_TT_BUFFER state\n"); | 516 | dev_err (&udev->dev, "can't save CLEAR_TT_BUFFER state\n"); |
510 | /* FIXME recover somehow ... RESET_TT? */ | 517 | /* FIXME recover somehow ... RESET_TT? */ |
511 | return; | 518 | return -ENOMEM; |
512 | } | 519 | } |
513 | 520 | ||
514 | /* info that CLEAR_TT_BUFFER needs */ | 521 | /* info that CLEAR_TT_BUFFER needs */ |
@@ -520,14 +527,19 @@ void usb_hub_tt_clear_buffer (struct usb_device *udev, int pipe) | |||
520 | : (USB_ENDPOINT_XFER_BULK << 11); | 527 | : (USB_ENDPOINT_XFER_BULK << 11); |
521 | if (usb_pipein (pipe)) | 528 | if (usb_pipein (pipe)) |
522 | clear->devinfo |= 1 << 15; | 529 | clear->devinfo |= 1 << 15; |
523 | 530 | ||
531 | /* info for completion callback */ | ||
532 | clear->hcd = bus_to_hcd(udev->bus); | ||
533 | clear->ep = urb->ep; | ||
534 | |||
524 | /* tell keventd to clear state for this TT */ | 535 | /* tell keventd to clear state for this TT */ |
525 | spin_lock_irqsave (&tt->lock, flags); | 536 | spin_lock_irqsave (&tt->lock, flags); |
526 | list_add_tail (&clear->clear_list, &tt->clear_list); | 537 | list_add_tail (&clear->clear_list, &tt->clear_list); |
527 | schedule_work (&tt->kevent); | 538 | schedule_work(&tt->clear_work); |
528 | spin_unlock_irqrestore (&tt->lock, flags); | 539 | spin_unlock_irqrestore (&tt->lock, flags); |
540 | return 0; | ||
529 | } | 541 | } |
530 | EXPORT_SYMBOL_GPL(usb_hub_tt_clear_buffer); | 542 | EXPORT_SYMBOL_GPL(usb_hub_clear_tt_buffer); |
531 | 543 | ||
532 | /* If do_delay is false, return the number of milliseconds the caller | 544 | /* If do_delay is false, return the number of milliseconds the caller |
533 | * needs to delay. | 545 | * needs to delay. |
@@ -818,7 +830,7 @@ static void hub_quiesce(struct usb_hub *hub, enum hub_quiescing_type type) | |||
818 | if (hub->has_indicators) | 830 | if (hub->has_indicators) |
819 | cancel_delayed_work_sync(&hub->leds); | 831 | cancel_delayed_work_sync(&hub->leds); |
820 | if (hub->tt.hub) | 832 | if (hub->tt.hub) |
821 | cancel_work_sync(&hub->tt.kevent); | 833 | cancel_work_sync(&hub->tt.clear_work); |
822 | } | 834 | } |
823 | 835 | ||
824 | /* caller has locked the hub device */ | 836 | /* caller has locked the hub device */ |
@@ -935,7 +947,7 @@ static int hub_configure(struct usb_hub *hub, | |||
935 | 947 | ||
936 | spin_lock_init (&hub->tt.lock); | 948 | spin_lock_init (&hub->tt.lock); |
937 | INIT_LIST_HEAD (&hub->tt.clear_list); | 949 | INIT_LIST_HEAD (&hub->tt.clear_list); |
938 | INIT_WORK (&hub->tt.kevent, hub_tt_kevent); | 950 | INIT_WORK(&hub->tt.clear_work, hub_tt_work); |
939 | switch (hdev->descriptor.bDeviceProtocol) { | 951 | switch (hdev->descriptor.bDeviceProtocol) { |
940 | case 0: | 952 | case 0: |
941 | break; | 953 | break; |
diff --git a/drivers/usb/core/hub.h b/drivers/usb/core/hub.h index 889c0f32a40b..de8081f065ed 100644 --- a/drivers/usb/core/hub.h +++ b/drivers/usb/core/hub.h | |||
@@ -188,16 +188,18 @@ struct usb_tt { | |||
188 | /* for control/bulk error recovery (CLEAR_TT_BUFFER) */ | 188 | /* for control/bulk error recovery (CLEAR_TT_BUFFER) */ |
189 | spinlock_t lock; | 189 | spinlock_t lock; |
190 | struct list_head clear_list; /* of usb_tt_clear */ | 190 | struct list_head clear_list; /* of usb_tt_clear */ |
191 | struct work_struct kevent; | 191 | struct work_struct clear_work; |
192 | }; | 192 | }; |
193 | 193 | ||
194 | struct usb_tt_clear { | 194 | struct usb_tt_clear { |
195 | struct list_head clear_list; | 195 | struct list_head clear_list; |
196 | unsigned tt; | 196 | unsigned tt; |
197 | u16 devinfo; | 197 | u16 devinfo; |
198 | struct usb_hcd *hcd; | ||
199 | struct usb_host_endpoint *ep; | ||
198 | }; | 200 | }; |
199 | 201 | ||
200 | extern void usb_hub_tt_clear_buffer(struct usb_device *dev, int pipe); | 202 | extern int usb_hub_clear_tt_buffer(struct urb *urb); |
201 | extern void usb_ep0_reinit(struct usb_device *); | 203 | extern void usb_ep0_reinit(struct usb_device *); |
202 | 204 | ||
203 | #endif /* __LINUX_HUB_H */ | 205 | #endif /* __LINUX_HUB_H */ |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 2bed83caacb1..9720e699f472 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -806,6 +806,48 @@ static int usb_string_sub(struct usb_device *dev, unsigned int langid, | |||
806 | return rc; | 806 | return rc; |
807 | } | 807 | } |
808 | 808 | ||
809 | static int usb_get_langid(struct usb_device *dev, unsigned char *tbuf) | ||
810 | { | ||
811 | int err; | ||
812 | |||
813 | if (dev->have_langid) | ||
814 | return 0; | ||
815 | |||
816 | if (dev->string_langid < 0) | ||
817 | return -EPIPE; | ||
818 | |||
819 | err = usb_string_sub(dev, 0, 0, tbuf); | ||
820 | |||
821 | /* If the string was reported but is malformed, default to english | ||
822 | * (0x0409) */ | ||
823 | if (err == -ENODATA || (err > 0 && err < 4)) { | ||
824 | dev->string_langid = 0x0409; | ||
825 | dev->have_langid = 1; | ||
826 | dev_err(&dev->dev, | ||
827 | "string descriptor 0 malformed (err = %d), " | ||
828 | "defaulting to 0x%04x\n", | ||
829 | err, dev->string_langid); | ||
830 | return 0; | ||
831 | } | ||
832 | |||
833 | /* In case of all other errors, we assume the device is not able to | ||
834 | * deal with strings at all. Set string_langid to -1 in order to | ||
835 | * prevent any string to be retrieved from the device */ | ||
836 | if (err < 0) { | ||
837 | dev_err(&dev->dev, "string descriptor 0 read error: %d\n", | ||
838 | err); | ||
839 | dev->string_langid = -1; | ||
840 | return -EPIPE; | ||
841 | } | ||
842 | |||
843 | /* always use the first langid listed */ | ||
844 | dev->string_langid = tbuf[2] | (tbuf[3] << 8); | ||
845 | dev->have_langid = 1; | ||
846 | dev_dbg(&dev->dev, "default language 0x%04x\n", | ||
847 | dev->string_langid); | ||
848 | return 0; | ||
849 | } | ||
850 | |||
809 | /** | 851 | /** |
810 | * usb_string - returns UTF-8 version of a string descriptor | 852 | * usb_string - returns UTF-8 version of a string descriptor |
811 | * @dev: the device whose string descriptor is being retrieved | 853 | * @dev: the device whose string descriptor is being retrieved |
@@ -837,24 +879,9 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size) | |||
837 | if (!tbuf) | 879 | if (!tbuf) |
838 | return -ENOMEM; | 880 | return -ENOMEM; |
839 | 881 | ||
840 | /* get langid for strings if it's not yet known */ | 882 | err = usb_get_langid(dev, tbuf); |
841 | if (!dev->have_langid) { | 883 | if (err < 0) |
842 | err = usb_string_sub(dev, 0, 0, tbuf); | 884 | goto errout; |
843 | if (err < 0) { | ||
844 | dev_err(&dev->dev, | ||
845 | "string descriptor 0 read error: %d\n", | ||
846 | err); | ||
847 | } else if (err < 4) { | ||
848 | dev_err(&dev->dev, "string descriptor 0 too short\n"); | ||
849 | } else { | ||
850 | dev->string_langid = tbuf[2] | (tbuf[3] << 8); | ||
851 | /* always use the first langid listed */ | ||
852 | dev_dbg(&dev->dev, "default language 0x%04x\n", | ||
853 | dev->string_langid); | ||
854 | } | ||
855 | |||
856 | dev->have_langid = 1; | ||
857 | } | ||
858 | 885 | ||
859 | err = usb_string_sub(dev, dev->string_langid, index, tbuf); | 886 | err = usb_string_sub(dev, dev->string_langid, index, tbuf); |
860 | if (err < 0) | 887 | if (err < 0) |
diff --git a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig index 5d1ddf485d1e..7f8e83a954ac 100644 --- a/drivers/usb/gadget/Kconfig +++ b/drivers/usb/gadget/Kconfig | |||
@@ -286,6 +286,27 @@ config USB_S3C_HSOTG | |||
286 | default USB_GADGET | 286 | default USB_GADGET |
287 | select USB_GADGET_SELECTED | 287 | select USB_GADGET_SELECTED |
288 | 288 | ||
289 | config USB_GADGET_IMX | ||
290 | boolean "Freescale IMX USB Peripheral Controller" | ||
291 | depends on ARCH_MX1 | ||
292 | help | ||
293 | Freescale's IMX series include an integrated full speed | ||
294 | USB 1.1 device controller. The controller in the IMX series | ||
295 | is register-compatible. | ||
296 | |||
297 | It has Six fixed-function endpoints, as well as endpoint | ||
298 | zero (for control transfers). | ||
299 | |||
300 | Say "y" to link the driver statically, or "m" to build a | ||
301 | dynamically linked module called "imx_udc" and force all | ||
302 | gadget drivers to also be dynamically linked. | ||
303 | |||
304 | config USB_IMX | ||
305 | tristate | ||
306 | depends on USB_GADGET_IMX | ||
307 | default USB_GADGET | ||
308 | select USB_GADGET_SELECTED | ||
309 | |||
289 | config USB_GADGET_S3C2410 | 310 | config USB_GADGET_S3C2410 |
290 | boolean "S3C2410 USB Device Controller" | 311 | boolean "S3C2410 USB Device Controller" |
291 | depends on ARCH_S3C2410 | 312 | depends on ARCH_S3C2410 |
@@ -321,27 +342,6 @@ config USB_GADGET_MUSB_HDRC | |||
321 | This OTG-capable silicon IP is used in dual designs including | 342 | This OTG-capable silicon IP is used in dual designs including |
322 | the TI DaVinci, OMAP 243x, OMAP 343x, TUSB 6010, and ADI Blackfin | 343 | the TI DaVinci, OMAP 243x, OMAP 343x, TUSB 6010, and ADI Blackfin |
323 | 344 | ||
324 | config USB_GADGET_IMX | ||
325 | boolean "Freescale IMX USB Peripheral Controller" | ||
326 | depends on ARCH_MX1 | ||
327 | help | ||
328 | Freescale's IMX series include an integrated full speed | ||
329 | USB 1.1 device controller. The controller in the IMX series | ||
330 | is register-compatible. | ||
331 | |||
332 | It has Six fixed-function endpoints, as well as endpoint | ||
333 | zero (for control transfers). | ||
334 | |||
335 | Say "y" to link the driver statically, or "m" to build a | ||
336 | dynamically linked module called "imx_udc" and force all | ||
337 | gadget drivers to also be dynamically linked. | ||
338 | |||
339 | config USB_IMX | ||
340 | tristate | ||
341 | depends on USB_GADGET_IMX | ||
342 | default USB_GADGET | ||
343 | select USB_GADGET_SELECTED | ||
344 | |||
345 | config USB_GADGET_M66592 | 345 | config USB_GADGET_M66592 |
346 | boolean "Renesas M66592 USB Peripheral Controller" | 346 | boolean "Renesas M66592 USB Peripheral Controller" |
347 | select USB_GADGET_DUALSPEED | 347 | select USB_GADGET_DUALSPEED |
@@ -604,6 +604,7 @@ config USB_ZERO_HNPTEST | |||
604 | config USB_AUDIO | 604 | config USB_AUDIO |
605 | tristate "Audio Gadget (EXPERIMENTAL)" | 605 | tristate "Audio Gadget (EXPERIMENTAL)" |
606 | depends on SND | 606 | depends on SND |
607 | select SND_PCM | ||
607 | help | 608 | help |
608 | Gadget Audio is compatible with USB Audio Class specification 1.0. | 609 | Gadget Audio is compatible with USB Audio Class specification 1.0. |
609 | It will include at least one AudioControl interface, zero or more | 610 | It will include at least one AudioControl interface, zero or more |
diff --git a/drivers/usb/gadget/amd5536udc.c b/drivers/usb/gadget/amd5536udc.c index 826f3adde5d8..77352ccc245e 100644 --- a/drivers/usb/gadget/amd5536udc.c +++ b/drivers/usb/gadget/amd5536udc.c | |||
@@ -48,7 +48,6 @@ | |||
48 | #include <linux/ioport.h> | 48 | #include <linux/ioport.h> |
49 | #include <linux/sched.h> | 49 | #include <linux/sched.h> |
50 | #include <linux/slab.h> | 50 | #include <linux/slab.h> |
51 | #include <linux/smp_lock.h> | ||
52 | #include <linux/errno.h> | 51 | #include <linux/errno.h> |
53 | #include <linux/init.h> | 52 | #include <linux/init.h> |
54 | #include <linux/timer.h> | 53 | #include <linux/timer.h> |
diff --git a/drivers/usb/gadget/audio.c b/drivers/usb/gadget/audio.c index 94de7e864614..9f80f4e970bd 100644 --- a/drivers/usb/gadget/audio.c +++ b/drivers/usb/gadget/audio.c | |||
@@ -42,9 +42,9 @@ | |||
42 | * Instead: allocate your own, using normal USB-IF procedures. | 42 | * Instead: allocate your own, using normal USB-IF procedures. |
43 | */ | 43 | */ |
44 | 44 | ||
45 | /* Thanks to NetChip Technologies for donating this product ID. */ | 45 | /* Thanks to Linux Foundation for donating this product ID. */ |
46 | #define AUDIO_VENDOR_NUM 0x0525 /* NetChip */ | 46 | #define AUDIO_VENDOR_NUM 0x1d6b /* Linux Foundation */ |
47 | #define AUDIO_PRODUCT_NUM 0xa4a1 /* Linux-USB Audio Gadget */ | 47 | #define AUDIO_PRODUCT_NUM 0x0101 /* Linux-USB Audio Gadget */ |
48 | 48 | ||
49 | /*-------------------------------------------------------------------------*/ | 49 | /*-------------------------------------------------------------------------*/ |
50 | 50 | ||
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index d006dc652e02..bd102f5052ba 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c | |||
@@ -293,15 +293,16 @@ static int __init eth_bind(struct usb_composite_dev *cdev) | |||
293 | /* CDC Subset */ | 293 | /* CDC Subset */ |
294 | eth_config_driver.label = "CDC Subset/SAFE"; | 294 | eth_config_driver.label = "CDC Subset/SAFE"; |
295 | 295 | ||
296 | device_desc.idVendor = cpu_to_le16(SIMPLE_VENDOR_NUM), | 296 | device_desc.idVendor = cpu_to_le16(SIMPLE_VENDOR_NUM); |
297 | device_desc.idProduct = cpu_to_le16(SIMPLE_PRODUCT_NUM), | 297 | device_desc.idProduct = cpu_to_le16(SIMPLE_PRODUCT_NUM); |
298 | device_desc.bDeviceClass = USB_CLASS_VENDOR_SPEC; | 298 | if (!has_rndis()) |
299 | device_desc.bDeviceClass = USB_CLASS_VENDOR_SPEC; | ||
299 | } | 300 | } |
300 | 301 | ||
301 | if (has_rndis()) { | 302 | if (has_rndis()) { |
302 | /* RNDIS plus ECM-or-Subset */ | 303 | /* RNDIS plus ECM-or-Subset */ |
303 | device_desc.idVendor = cpu_to_le16(RNDIS_VENDOR_NUM), | 304 | device_desc.idVendor = cpu_to_le16(RNDIS_VENDOR_NUM); |
304 | device_desc.idProduct = cpu_to_le16(RNDIS_PRODUCT_NUM), | 305 | device_desc.idProduct = cpu_to_le16(RNDIS_PRODUCT_NUM); |
305 | device_desc.bNumConfigurations = 2; | 306 | device_desc.bNumConfigurations = 2; |
306 | } | 307 | } |
307 | 308 | ||
diff --git a/drivers/usb/gadget/langwell_udc.c b/drivers/usb/gadget/langwell_udc.c index 6829d5961359..a3913519fd58 100644 --- a/drivers/usb/gadget/langwell_udc.c +++ b/drivers/usb/gadget/langwell_udc.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/ioport.h> | 34 | #include <linux/ioport.h> |
35 | #include <linux/sched.h> | 35 | #include <linux/sched.h> |
36 | #include <linux/slab.h> | 36 | #include <linux/slab.h> |
37 | #include <linux/smp_lock.h> | ||
38 | #include <linux/errno.h> | 37 | #include <linux/errno.h> |
39 | #include <linux/init.h> | 38 | #include <linux/init.h> |
40 | #include <linux/timer.h> | 39 | #include <linux/timer.h> |
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c index 0ce4e2819847..ed21e263f832 100644 --- a/drivers/usb/gadget/pxa25x_udc.c +++ b/drivers/usb/gadget/pxa25x_udc.c | |||
@@ -139,7 +139,7 @@ static int is_vbus_present(void) | |||
139 | { | 139 | { |
140 | struct pxa2xx_udc_mach_info *mach = the_controller->mach; | 140 | struct pxa2xx_udc_mach_info *mach = the_controller->mach; |
141 | 141 | ||
142 | if (mach->gpio_vbus) { | 142 | if (gpio_is_valid(mach->gpio_vbus)) { |
143 | int value = gpio_get_value(mach->gpio_vbus); | 143 | int value = gpio_get_value(mach->gpio_vbus); |
144 | 144 | ||
145 | if (mach->gpio_vbus_inverted) | 145 | if (mach->gpio_vbus_inverted) |
@@ -158,7 +158,7 @@ static void pullup_off(void) | |||
158 | struct pxa2xx_udc_mach_info *mach = the_controller->mach; | 158 | struct pxa2xx_udc_mach_info *mach = the_controller->mach; |
159 | int off_level = mach->gpio_pullup_inverted; | 159 | int off_level = mach->gpio_pullup_inverted; |
160 | 160 | ||
161 | if (mach->gpio_pullup) | 161 | if (gpio_is_valid(mach->gpio_pullup)) |
162 | gpio_set_value(mach->gpio_pullup, off_level); | 162 | gpio_set_value(mach->gpio_pullup, off_level); |
163 | else if (mach->udc_command) | 163 | else if (mach->udc_command) |
164 | mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT); | 164 | mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT); |
@@ -169,7 +169,7 @@ static void pullup_on(void) | |||
169 | struct pxa2xx_udc_mach_info *mach = the_controller->mach; | 169 | struct pxa2xx_udc_mach_info *mach = the_controller->mach; |
170 | int on_level = !mach->gpio_pullup_inverted; | 170 | int on_level = !mach->gpio_pullup_inverted; |
171 | 171 | ||
172 | if (mach->gpio_pullup) | 172 | if (gpio_is_valid(mach->gpio_pullup)) |
173 | gpio_set_value(mach->gpio_pullup, on_level); | 173 | gpio_set_value(mach->gpio_pullup, on_level); |
174 | else if (mach->udc_command) | 174 | else if (mach->udc_command) |
175 | mach->udc_command(PXA2XX_UDC_CMD_CONNECT); | 175 | mach->udc_command(PXA2XX_UDC_CMD_CONNECT); |
@@ -1000,7 +1000,7 @@ static int pxa25x_udc_pullup(struct usb_gadget *_gadget, int is_active) | |||
1000 | udc = container_of(_gadget, struct pxa25x_udc, gadget); | 1000 | udc = container_of(_gadget, struct pxa25x_udc, gadget); |
1001 | 1001 | ||
1002 | /* not all boards support pullup control */ | 1002 | /* not all boards support pullup control */ |
1003 | if (!udc->mach->gpio_pullup && !udc->mach->udc_command) | 1003 | if (!gpio_is_valid(udc->mach->gpio_pullup) && !udc->mach->udc_command) |
1004 | return -EOPNOTSUPP; | 1004 | return -EOPNOTSUPP; |
1005 | 1005 | ||
1006 | udc->pullup = (is_active != 0); | 1006 | udc->pullup = (is_active != 0); |
@@ -1802,11 +1802,13 @@ pxa25x_udc_irq(int irq, void *_dev) | |||
1802 | USIR0 |= tmp; | 1802 | USIR0 |= tmp; |
1803 | handled = 1; | 1803 | handled = 1; |
1804 | } | 1804 | } |
1805 | #ifndef CONFIG_USB_PXA25X_SMALL | ||
1805 | if (usir1 & tmp) { | 1806 | if (usir1 & tmp) { |
1806 | handle_ep(&dev->ep[i+8]); | 1807 | handle_ep(&dev->ep[i+8]); |
1807 | USIR1 |= tmp; | 1808 | USIR1 |= tmp; |
1808 | handled = 1; | 1809 | handled = 1; |
1809 | } | 1810 | } |
1811 | #endif | ||
1810 | } | 1812 | } |
1811 | } | 1813 | } |
1812 | 1814 | ||
@@ -2160,7 +2162,7 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev) | |||
2160 | dev->dev = &pdev->dev; | 2162 | dev->dev = &pdev->dev; |
2161 | dev->mach = pdev->dev.platform_data; | 2163 | dev->mach = pdev->dev.platform_data; |
2162 | 2164 | ||
2163 | if (dev->mach->gpio_vbus) { | 2165 | if (gpio_is_valid(dev->mach->gpio_vbus)) { |
2164 | if ((retval = gpio_request(dev->mach->gpio_vbus, | 2166 | if ((retval = gpio_request(dev->mach->gpio_vbus, |
2165 | "pxa25x_udc GPIO VBUS"))) { | 2167 | "pxa25x_udc GPIO VBUS"))) { |
2166 | dev_dbg(&pdev->dev, | 2168 | dev_dbg(&pdev->dev, |
@@ -2173,7 +2175,7 @@ static int __init pxa25x_udc_probe(struct platform_device *pdev) | |||
2173 | } else | 2175 | } else |
2174 | vbus_irq = 0; | 2176 | vbus_irq = 0; |
2175 | 2177 | ||
2176 | if (dev->mach->gpio_pullup) { | 2178 | if (gpio_is_valid(dev->mach->gpio_pullup)) { |
2177 | if ((retval = gpio_request(dev->mach->gpio_pullup, | 2179 | if ((retval = gpio_request(dev->mach->gpio_pullup, |
2178 | "pca25x_udc GPIO PULLUP"))) { | 2180 | "pca25x_udc GPIO PULLUP"))) { |
2179 | dev_dbg(&pdev->dev, | 2181 | dev_dbg(&pdev->dev, |
@@ -2256,10 +2258,10 @@ lubbock_fail0: | |||
2256 | #endif | 2258 | #endif |
2257 | free_irq(irq, dev); | 2259 | free_irq(irq, dev); |
2258 | err_irq1: | 2260 | err_irq1: |
2259 | if (dev->mach->gpio_pullup) | 2261 | if (gpio_is_valid(dev->mach->gpio_pullup)) |
2260 | gpio_free(dev->mach->gpio_pullup); | 2262 | gpio_free(dev->mach->gpio_pullup); |
2261 | err_gpio_pullup: | 2263 | err_gpio_pullup: |
2262 | if (dev->mach->gpio_vbus) | 2264 | if (gpio_is_valid(dev->mach->gpio_vbus)) |
2263 | gpio_free(dev->mach->gpio_vbus); | 2265 | gpio_free(dev->mach->gpio_vbus); |
2264 | err_gpio_vbus: | 2266 | err_gpio_vbus: |
2265 | clk_put(dev->clk); | 2267 | clk_put(dev->clk); |
@@ -2294,11 +2296,11 @@ static int __exit pxa25x_udc_remove(struct platform_device *pdev) | |||
2294 | free_irq(LUBBOCK_USB_IRQ, dev); | 2296 | free_irq(LUBBOCK_USB_IRQ, dev); |
2295 | } | 2297 | } |
2296 | #endif | 2298 | #endif |
2297 | if (dev->mach->gpio_vbus) { | 2299 | if (gpio_is_valid(dev->mach->gpio_vbus)) { |
2298 | free_irq(gpio_to_irq(dev->mach->gpio_vbus), dev); | 2300 | free_irq(gpio_to_irq(dev->mach->gpio_vbus), dev); |
2299 | gpio_free(dev->mach->gpio_vbus); | 2301 | gpio_free(dev->mach->gpio_vbus); |
2300 | } | 2302 | } |
2301 | if (dev->mach->gpio_pullup) | 2303 | if (gpio_is_valid(dev->mach->gpio_pullup)) |
2302 | gpio_free(dev->mach->gpio_pullup); | 2304 | gpio_free(dev->mach->gpio_pullup); |
2303 | 2305 | ||
2304 | clk_put(dev->clk); | 2306 | clk_put(dev->clk); |
@@ -2329,7 +2331,7 @@ static int pxa25x_udc_suspend(struct platform_device *dev, pm_message_t state) | |||
2329 | struct pxa25x_udc *udc = platform_get_drvdata(dev); | 2331 | struct pxa25x_udc *udc = platform_get_drvdata(dev); |
2330 | unsigned long flags; | 2332 | unsigned long flags; |
2331 | 2333 | ||
2332 | if (!udc->mach->gpio_pullup && !udc->mach->udc_command) | 2334 | if (!gpio_is_valid(udc->mach->gpio_pullup) && !udc->mach->udc_command) |
2333 | WARNING("USB host won't detect disconnect!\n"); | 2335 | WARNING("USB host won't detect disconnect!\n"); |
2334 | udc->suspended = 1; | 2336 | udc->suspended = 1; |
2335 | 2337 | ||
diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c index 2b4660e08c4d..ca41b0b5afb3 100644 --- a/drivers/usb/gadget/rndis.c +++ b/drivers/usb/gadget/rndis.c | |||
@@ -442,6 +442,8 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, | |||
442 | 442 | ||
443 | case OID_802_3_MAC_OPTIONS: | 443 | case OID_802_3_MAC_OPTIONS: |
444 | pr_debug("%s: OID_802_3_MAC_OPTIONS\n", __func__); | 444 | pr_debug("%s: OID_802_3_MAC_OPTIONS\n", __func__); |
445 | *outbuf = cpu_to_le32(0); | ||
446 | retval = 0; | ||
445 | break; | 447 | break; |
446 | 448 | ||
447 | /* ieee802.3 statistics OIDs (table 4-4) */ | 449 | /* ieee802.3 statistics OIDs (table 4-4) */ |
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c index 9a2b8920532d..a9b452fe6221 100644 --- a/drivers/usb/gadget/s3c2410_udc.c +++ b/drivers/usb/gadget/s3c2410_udc.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/ioport.h> | 28 | #include <linux/ioport.h> |
29 | #include <linux/sched.h> | 29 | #include <linux/sched.h> |
30 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
31 | #include <linux/smp_lock.h> | ||
32 | #include <linux/errno.h> | 31 | #include <linux/errno.h> |
33 | #include <linux/init.h> | 32 | #include <linux/init.h> |
34 | #include <linux/timer.h> | 33 | #include <linux/timer.h> |
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 1576a0520adf..1a920c70b5a1 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig | |||
@@ -181,26 +181,27 @@ config USB_OHCI_HCD_PPC_SOC | |||
181 | Enables support for the USB controller on the MPC52xx or | 181 | Enables support for the USB controller on the MPC52xx or |
182 | STB03xxx processor chip. If unsure, say Y. | 182 | STB03xxx processor chip. If unsure, say Y. |
183 | 183 | ||
184 | config USB_OHCI_HCD_PPC_OF | ||
185 | bool "OHCI support for PPC USB controller on OF platform bus" | ||
186 | depends on USB_OHCI_HCD && PPC_OF | ||
187 | default y | ||
188 | ---help--- | ||
189 | Enables support for the USB controller PowerPC present on the | ||
190 | OpenFirmware platform bus. | ||
191 | |||
192 | config USB_OHCI_HCD_PPC_OF_BE | 184 | config USB_OHCI_HCD_PPC_OF_BE |
193 | bool "Support big endian HC" | 185 | bool "OHCI support for OF platform bus (big endian)" |
194 | depends on USB_OHCI_HCD_PPC_OF | 186 | depends on USB_OHCI_HCD && PPC_OF |
195 | default y | ||
196 | select USB_OHCI_BIG_ENDIAN_DESC | 187 | select USB_OHCI_BIG_ENDIAN_DESC |
197 | select USB_OHCI_BIG_ENDIAN_MMIO | 188 | select USB_OHCI_BIG_ENDIAN_MMIO |
189 | ---help--- | ||
190 | Enables support for big-endian USB controllers present on the | ||
191 | OpenFirmware platform bus. | ||
198 | 192 | ||
199 | config USB_OHCI_HCD_PPC_OF_LE | 193 | config USB_OHCI_HCD_PPC_OF_LE |
200 | bool "Support little endian HC" | 194 | bool "OHCI support for OF platform bus (little endian)" |
201 | depends on USB_OHCI_HCD_PPC_OF | 195 | depends on USB_OHCI_HCD && PPC_OF |
202 | default n | ||
203 | select USB_OHCI_LITTLE_ENDIAN | 196 | select USB_OHCI_LITTLE_ENDIAN |
197 | ---help--- | ||
198 | Enables support for little-endian USB controllers present on the | ||
199 | OpenFirmware platform bus. | ||
200 | |||
201 | config USB_OHCI_HCD_PPC_OF | ||
202 | bool | ||
203 | depends on USB_OHCI_HCD && PPC_OF | ||
204 | default USB_OHCI_HCD_PPC_OF_BE || USB_OHCI_HCD_PPC_OF_LE | ||
204 | 205 | ||
205 | config USB_OHCI_HCD_PCI | 206 | config USB_OHCI_HCD_PCI |
206 | bool "OHCI support for PCI-bus USB controllers" | 207 | bool "OHCI support for PCI-bus USB controllers" |
@@ -337,10 +338,10 @@ config USB_R8A66597_HCD | |||
337 | 338 | ||
338 | config SUPERH_ON_CHIP_R8A66597 | 339 | config SUPERH_ON_CHIP_R8A66597 |
339 | boolean "Enable SuperH on-chip R8A66597 USB" | 340 | boolean "Enable SuperH on-chip R8A66597 USB" |
340 | depends on USB_R8A66597_HCD && (CPU_SUBTYPE_SH7366 || CPU_SUBTYPE_SH7723) | 341 | depends on USB_R8A66597_HCD && (CPU_SUBTYPE_SH7366 || CPU_SUBTYPE_SH7723 || CPU_SUBTYPE_SH7724) |
341 | help | 342 | help |
342 | This driver enables support for the on-chip R8A66597 in the | 343 | This driver enables support for the on-chip R8A66597 in the |
343 | SH7366 and SH7723 processors. | 344 | SH7366, SH7723 and SH7724 processors. |
344 | 345 | ||
345 | config USB_WHCI_HCD | 346 | config USB_WHCI_HCD |
346 | tristate "Wireless USB Host Controller Interface (WHCI) driver (EXPERIMENTAL)" | 347 | tristate "Wireless USB Host Controller Interface (WHCI) driver (EXPERIMENTAL)" |
diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c index c3a778bd359c..59d208d94d4e 100644 --- a/drivers/usb/host/ehci-au1xxx.c +++ b/drivers/usb/host/ehci-au1xxx.c | |||
@@ -113,6 +113,8 @@ static const struct hc_driver ehci_au1xxx_hc_driver = { | |||
113 | .bus_resume = ehci_bus_resume, | 113 | .bus_resume = ehci_bus_resume, |
114 | .relinquish_port = ehci_relinquish_port, | 114 | .relinquish_port = ehci_relinquish_port, |
115 | .port_handed_over = ehci_port_handed_over, | 115 | .port_handed_over = ehci_port_handed_over, |
116 | |||
117 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, | ||
116 | }; | 118 | }; |
117 | 119 | ||
118 | static int ehci_hcd_au1xxx_drv_probe(struct platform_device *pdev) | 120 | static int ehci_hcd_au1xxx_drv_probe(struct platform_device *pdev) |
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c index bf86809c5120..991174937db3 100644 --- a/drivers/usb/host/ehci-fsl.c +++ b/drivers/usb/host/ehci-fsl.c | |||
@@ -325,6 +325,8 @@ static const struct hc_driver ehci_fsl_hc_driver = { | |||
325 | .bus_resume = ehci_bus_resume, | 325 | .bus_resume = ehci_bus_resume, |
326 | .relinquish_port = ehci_relinquish_port, | 326 | .relinquish_port = ehci_relinquish_port, |
327 | .port_handed_over = ehci_port_handed_over, | 327 | .port_handed_over = ehci_port_handed_over, |
328 | |||
329 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, | ||
328 | }; | 330 | }; |
329 | 331 | ||
330 | static int ehci_fsl_drv_probe(struct platform_device *pdev) | 332 | static int ehci_fsl_drv_probe(struct platform_device *pdev) |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 2b72473544d3..7d03549c3339 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -1003,6 +1003,8 @@ idle_timeout: | |||
1003 | schedule_timeout_uninterruptible(1); | 1003 | schedule_timeout_uninterruptible(1); |
1004 | goto rescan; | 1004 | goto rescan; |
1005 | case QH_STATE_IDLE: /* fully unlinked */ | 1005 | case QH_STATE_IDLE: /* fully unlinked */ |
1006 | if (qh->clearing_tt) | ||
1007 | goto idle_timeout; | ||
1006 | if (list_empty (&qh->qtd_list)) { | 1008 | if (list_empty (&qh->qtd_list)) { |
1007 | qh_put (qh); | 1009 | qh_put (qh); |
1008 | break; | 1010 | break; |
@@ -1030,12 +1032,14 @@ ehci_endpoint_reset(struct usb_hcd *hcd, struct usb_host_endpoint *ep) | |||
1030 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | 1032 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); |
1031 | struct ehci_qh *qh; | 1033 | struct ehci_qh *qh; |
1032 | int eptype = usb_endpoint_type(&ep->desc); | 1034 | int eptype = usb_endpoint_type(&ep->desc); |
1035 | int epnum = usb_endpoint_num(&ep->desc); | ||
1036 | int is_out = usb_endpoint_dir_out(&ep->desc); | ||
1037 | unsigned long flags; | ||
1033 | 1038 | ||
1034 | if (eptype != USB_ENDPOINT_XFER_BULK && eptype != USB_ENDPOINT_XFER_INT) | 1039 | if (eptype != USB_ENDPOINT_XFER_BULK && eptype != USB_ENDPOINT_XFER_INT) |
1035 | return; | 1040 | return; |
1036 | 1041 | ||
1037 | rescan: | 1042 | spin_lock_irqsave(&ehci->lock, flags); |
1038 | spin_lock_irq(&ehci->lock); | ||
1039 | qh = ep->hcpriv; | 1043 | qh = ep->hcpriv; |
1040 | 1044 | ||
1041 | /* For Bulk and Interrupt endpoints we maintain the toggle state | 1045 | /* For Bulk and Interrupt endpoints we maintain the toggle state |
@@ -1044,29 +1048,24 @@ ehci_endpoint_reset(struct usb_hcd *hcd, struct usb_host_endpoint *ep) | |||
1044 | * the toggle bit in the QH. | 1048 | * the toggle bit in the QH. |
1045 | */ | 1049 | */ |
1046 | if (qh) { | 1050 | if (qh) { |
1051 | usb_settoggle(qh->dev, epnum, is_out, 0); | ||
1047 | if (!list_empty(&qh->qtd_list)) { | 1052 | if (!list_empty(&qh->qtd_list)) { |
1048 | WARN_ONCE(1, "clear_halt for a busy endpoint\n"); | 1053 | WARN_ONCE(1, "clear_halt for a busy endpoint\n"); |
1049 | } else if (qh->qh_state == QH_STATE_IDLE) { | 1054 | } else if (qh->qh_state == QH_STATE_LINKED) { |
1050 | qh->hw_token &= ~cpu_to_hc32(ehci, QTD_TOGGLE); | 1055 | |
1051 | } else { | 1056 | /* The toggle value in the QH can't be updated |
1052 | /* It's not safe to write into the overlay area | 1057 | * while the QH is active. Unlink it now; |
1053 | * while the QH is active. Unlink it first and | 1058 | * re-linking will call qh_refresh(). |
1054 | * wait for the unlink to complete. | ||
1055 | */ | 1059 | */ |
1056 | if (qh->qh_state == QH_STATE_LINKED) { | 1060 | if (eptype == USB_ENDPOINT_XFER_BULK) { |
1057 | if (eptype == USB_ENDPOINT_XFER_BULK) { | 1061 | unlink_async(ehci, qh); |
1058 | unlink_async(ehci, qh); | 1062 | } else { |
1059 | } else { | 1063 | intr_deschedule(ehci, qh); |
1060 | intr_deschedule(ehci, qh); | 1064 | (void) qh_schedule(ehci, qh); |
1061 | (void) qh_schedule(ehci, qh); | ||
1062 | } | ||
1063 | } | 1065 | } |
1064 | spin_unlock_irq(&ehci->lock); | ||
1065 | schedule_timeout_uninterruptible(1); | ||
1066 | goto rescan; | ||
1067 | } | 1066 | } |
1068 | } | 1067 | } |
1069 | spin_unlock_irq(&ehci->lock); | 1068 | spin_unlock_irqrestore(&ehci->lock, flags); |
1070 | } | 1069 | } |
1071 | 1070 | ||
1072 | static int ehci_get_frame (struct usb_hcd *hcd) | 1071 | static int ehci_get_frame (struct usb_hcd *hcd) |
diff --git a/drivers/usb/host/ehci-ixp4xx.c b/drivers/usb/host/ehci-ixp4xx.c index a44bb4a94954..89b7c70c6ed6 100644 --- a/drivers/usb/host/ehci-ixp4xx.c +++ b/drivers/usb/host/ehci-ixp4xx.c | |||
@@ -61,6 +61,8 @@ static const struct hc_driver ixp4xx_ehci_hc_driver = { | |||
61 | #endif | 61 | #endif |
62 | .relinquish_port = ehci_relinquish_port, | 62 | .relinquish_port = ehci_relinquish_port, |
63 | .port_handed_over = ehci_port_handed_over, | 63 | .port_handed_over = ehci_port_handed_over, |
64 | |||
65 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, | ||
64 | }; | 66 | }; |
65 | 67 | ||
66 | static int ixp4xx_ehci_probe(struct platform_device *pdev) | 68 | static int ixp4xx_ehci_probe(struct platform_device *pdev) |
diff --git a/drivers/usb/host/ehci-orion.c b/drivers/usb/host/ehci-orion.c index 770dd9aba62a..dc2ac613a9d1 100644 --- a/drivers/usb/host/ehci-orion.c +++ b/drivers/usb/host/ehci-orion.c | |||
@@ -165,6 +165,8 @@ static const struct hc_driver ehci_orion_hc_driver = { | |||
165 | .bus_resume = ehci_bus_resume, | 165 | .bus_resume = ehci_bus_resume, |
166 | .relinquish_port = ehci_relinquish_port, | 166 | .relinquish_port = ehci_relinquish_port, |
167 | .port_handed_over = ehci_port_handed_over, | 167 | .port_handed_over = ehci_port_handed_over, |
168 | |||
169 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, | ||
168 | }; | 170 | }; |
169 | 171 | ||
170 | static void __init | 172 | static void __init |
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c index f3683e1da161..c2f1b7df918c 100644 --- a/drivers/usb/host/ehci-pci.c +++ b/drivers/usb/host/ehci-pci.c | |||
@@ -404,6 +404,8 @@ static const struct hc_driver ehci_pci_hc_driver = { | |||
404 | .bus_resume = ehci_bus_resume, | 404 | .bus_resume = ehci_bus_resume, |
405 | .relinquish_port = ehci_relinquish_port, | 405 | .relinquish_port = ehci_relinquish_port, |
406 | .port_handed_over = ehci_port_handed_over, | 406 | .port_handed_over = ehci_port_handed_over, |
407 | |||
408 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, | ||
407 | }; | 409 | }; |
408 | 410 | ||
409 | /*-------------------------------------------------------------------------*/ | 411 | /*-------------------------------------------------------------------------*/ |
diff --git a/drivers/usb/host/ehci-ppc-of.c b/drivers/usb/host/ehci-ppc-of.c index fbd272288fc2..36f96da129f5 100644 --- a/drivers/usb/host/ehci-ppc-of.c +++ b/drivers/usb/host/ehci-ppc-of.c | |||
@@ -79,6 +79,8 @@ static const struct hc_driver ehci_ppc_of_hc_driver = { | |||
79 | #endif | 79 | #endif |
80 | .relinquish_port = ehci_relinquish_port, | 80 | .relinquish_port = ehci_relinquish_port, |
81 | .port_handed_over = ehci_port_handed_over, | 81 | .port_handed_over = ehci_port_handed_over, |
82 | |||
83 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, | ||
82 | }; | 84 | }; |
83 | 85 | ||
84 | 86 | ||
diff --git a/drivers/usb/host/ehci-ps3.c b/drivers/usb/host/ehci-ps3.c index 93f7035d00a1..1dee33b9139e 100644 --- a/drivers/usb/host/ehci-ps3.c +++ b/drivers/usb/host/ehci-ps3.c | |||
@@ -75,6 +75,8 @@ static const struct hc_driver ps3_ehci_hc_driver = { | |||
75 | #endif | 75 | #endif |
76 | .relinquish_port = ehci_relinquish_port, | 76 | .relinquish_port = ehci_relinquish_port, |
77 | .port_handed_over = ehci_port_handed_over, | 77 | .port_handed_over = ehci_port_handed_over, |
78 | |||
79 | .clear_tt_buffer_complete = ehci_clear_tt_buffer_complete, | ||
78 | }; | 80 | }; |
79 | 81 | ||
80 | static int __devinit ps3_ehci_probe(struct ps3_system_bus_device *dev) | 82 | static int __devinit ps3_ehci_probe(struct ps3_system_bus_device *dev) |
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index 3192f683f807..9a1384747f3b 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c | |||
@@ -93,6 +93,22 @@ qh_update (struct ehci_hcd *ehci, struct ehci_qh *qh, struct ehci_qtd *qtd) | |||
93 | qh->hw_qtd_next = QTD_NEXT(ehci, qtd->qtd_dma); | 93 | qh->hw_qtd_next = QTD_NEXT(ehci, qtd->qtd_dma); |
94 | qh->hw_alt_next = EHCI_LIST_END(ehci); | 94 | qh->hw_alt_next = EHCI_LIST_END(ehci); |
95 | 95 | ||
96 | /* Except for control endpoints, we make hardware maintain data | ||
97 | * toggle (like OHCI) ... here (re)initialize the toggle in the QH, | ||
98 | * and set the pseudo-toggle in udev. Only usb_clear_halt() will | ||
99 | * ever clear it. | ||
100 | */ | ||
101 | if (!(qh->hw_info1 & cpu_to_hc32(ehci, 1 << 14))) { | ||
102 | unsigned is_out, epnum; | ||
103 | |||
104 | is_out = !(qtd->hw_token & cpu_to_hc32(ehci, 1 << 8)); | ||
105 | epnum = (hc32_to_cpup(ehci, &qh->hw_info1) >> 8) & 0x0f; | ||
106 | if (unlikely (!usb_gettoggle (qh->dev, epnum, is_out))) { | ||
107 | qh->hw_token &= ~cpu_to_hc32(ehci, QTD_TOGGLE); | ||
108 | usb_settoggle (qh->dev, epnum, is_out, 1); | ||
109 | } | ||
110 | } | ||
111 | |||
96 | /* HC must see latest qtd and qh data before we clear ACTIVE+HALT */ | 112 | /* HC must see latest qtd and qh data before we clear ACTIVE+HALT */ |
97 | wmb (); | 113 | wmb (); |
98 | qh->hw_token &= cpu_to_hc32(ehci, QTD_TOGGLE | QTD_STS_PING); | 114 | qh->hw_token &= cpu_to_hc32(ehci, QTD_TOGGLE | QTD_STS_PING); |
@@ -123,6 +139,55 @@ qh_refresh (struct ehci_hcd *ehci, struct ehci_qh *qh) | |||
123 | 139 | ||
124 | /*-------------------------------------------------------------------------*/ | 140 | /*-------------------------------------------------------------------------*/ |
125 | 141 | ||
142 | static void qh_link_async(struct ehci_hcd *ehci, struct ehci_qh *qh); | ||
143 | |||
144 | static void ehci_clear_tt_buffer_complete(struct usb_hcd *hcd, | ||
145 | struct usb_host_endpoint *ep) | ||
146 | { | ||
147 | struct ehci_hcd *ehci = hcd_to_ehci(hcd); | ||
148 | struct ehci_qh *qh = ep->hcpriv; | ||
149 | unsigned long flags; | ||
150 | |||
151 | spin_lock_irqsave(&ehci->lock, flags); | ||
152 | qh->clearing_tt = 0; | ||
153 | if (qh->qh_state == QH_STATE_IDLE && !list_empty(&qh->qtd_list) | ||
154 | && HC_IS_RUNNING(hcd->state)) | ||
155 | qh_link_async(ehci, qh); | ||
156 | spin_unlock_irqrestore(&ehci->lock, flags); | ||
157 | } | ||
158 | |||
159 | static void ehci_clear_tt_buffer(struct ehci_hcd *ehci, struct ehci_qh *qh, | ||
160 | struct urb *urb, u32 token) | ||
161 | { | ||
162 | |||
163 | /* If an async split transaction gets an error or is unlinked, | ||
164 | * the TT buffer may be left in an indeterminate state. We | ||
165 | * have to clear the TT buffer. | ||
166 | * | ||
167 | * Note: this routine is never called for Isochronous transfers. | ||
168 | */ | ||
169 | if (urb->dev->tt && !usb_pipeint(urb->pipe) && !qh->clearing_tt) { | ||
170 | #ifdef DEBUG | ||
171 | struct usb_device *tt = urb->dev->tt->hub; | ||
172 | dev_dbg(&tt->dev, | ||
173 | "clear tt buffer port %d, a%d ep%d t%08x\n", | ||
174 | urb->dev->ttport, urb->dev->devnum, | ||
175 | usb_pipeendpoint(urb->pipe), token); | ||
176 | #endif /* DEBUG */ | ||
177 | if (!ehci_is_TDI(ehci) | ||
178 | || urb->dev->tt->hub != | ||
179 | ehci_to_hcd(ehci)->self.root_hub) { | ||
180 | if (usb_hub_clear_tt_buffer(urb) == 0) | ||
181 | qh->clearing_tt = 1; | ||
182 | } else { | ||
183 | |||
184 | /* REVISIT ARC-derived cores don't clear the root | ||
185 | * hub TT buffer in this way... | ||
186 | */ | ||
187 | } | ||
188 | } | ||
189 | } | ||
190 | |||
126 | static int qtd_copy_status ( | 191 | static int qtd_copy_status ( |
127 | struct ehci_hcd *ehci, | 192 | struct ehci_hcd *ehci, |
128 | struct urb *urb, | 193 | struct urb *urb, |
@@ -149,6 +214,14 @@ static int qtd_copy_status ( | |||
149 | if (token & QTD_STS_BABBLE) { | 214 | if (token & QTD_STS_BABBLE) { |
150 | /* FIXME "must" disable babbling device's port too */ | 215 | /* FIXME "must" disable babbling device's port too */ |
151 | status = -EOVERFLOW; | 216 | status = -EOVERFLOW; |
217 | /* CERR nonzero + halt --> stall */ | ||
218 | } else if (QTD_CERR(token)) { | ||
219 | status = -EPIPE; | ||
220 | |||
221 | /* In theory, more than one of the following bits can be set | ||
222 | * since they are sticky and the transaction is retried. | ||
223 | * Which to test first is rather arbitrary. | ||
224 | */ | ||
152 | } else if (token & QTD_STS_MMF) { | 225 | } else if (token & QTD_STS_MMF) { |
153 | /* fs/ls interrupt xfer missed the complete-split */ | 226 | /* fs/ls interrupt xfer missed the complete-split */ |
154 | status = -EPROTO; | 227 | status = -EPROTO; |
@@ -157,21 +230,15 @@ static int qtd_copy_status ( | |||
157 | ? -ENOSR /* hc couldn't read data */ | 230 | ? -ENOSR /* hc couldn't read data */ |
158 | : -ECOMM; /* hc couldn't write data */ | 231 | : -ECOMM; /* hc couldn't write data */ |
159 | } else if (token & QTD_STS_XACT) { | 232 | } else if (token & QTD_STS_XACT) { |
160 | /* timeout, bad crc, wrong PID, etc; retried */ | 233 | /* timeout, bad CRC, wrong PID, etc */ |
161 | if (QTD_CERR (token)) | 234 | ehci_dbg(ehci, "devpath %s ep%d%s 3strikes\n", |
162 | status = -EPIPE; | 235 | urb->dev->devpath, |
163 | else { | 236 | usb_pipeendpoint(urb->pipe), |
164 | ehci_dbg (ehci, "devpath %s ep%d%s 3strikes\n", | 237 | usb_pipein(urb->pipe) ? "in" : "out"); |
165 | urb->dev->devpath, | 238 | status = -EPROTO; |
166 | usb_pipeendpoint (urb->pipe), | 239 | } else { /* unknown */ |
167 | usb_pipein (urb->pipe) ? "in" : "out"); | ||
168 | status = -EPROTO; | ||
169 | } | ||
170 | /* CERR nonzero + no errors + halt --> stall */ | ||
171 | } else if (QTD_CERR (token)) | ||
172 | status = -EPIPE; | ||
173 | else /* unknown */ | ||
174 | status = -EPROTO; | 240 | status = -EPROTO; |
241 | } | ||
175 | 242 | ||
176 | ehci_vdbg (ehci, | 243 | ehci_vdbg (ehci, |
177 | "dev%d ep%d%s qtd token %08x --> status %d\n", | 244 | "dev%d ep%d%s qtd token %08x --> status %d\n", |
@@ -179,28 +246,6 @@ static int qtd_copy_status ( | |||
179 | usb_pipeendpoint (urb->pipe), | 246 | usb_pipeendpoint (urb->pipe), |
180 | usb_pipein (urb->pipe) ? "in" : "out", | 247 | usb_pipein (urb->pipe) ? "in" : "out", |
181 | token, status); | 248 | token, status); |
182 | |||
183 | /* if async CSPLIT failed, try cleaning out the TT buffer */ | ||
184 | if (status != -EPIPE | ||
185 | && urb->dev->tt | ||
186 | && !usb_pipeint(urb->pipe) | ||
187 | && ((token & QTD_STS_MMF) != 0 | ||
188 | || QTD_CERR(token) == 0) | ||
189 | && (!ehci_is_TDI(ehci) | ||
190 | || urb->dev->tt->hub != | ||
191 | ehci_to_hcd(ehci)->self.root_hub)) { | ||
192 | #ifdef DEBUG | ||
193 | struct usb_device *tt = urb->dev->tt->hub; | ||
194 | dev_dbg (&tt->dev, | ||
195 | "clear tt buffer port %d, a%d ep%d t%08x\n", | ||
196 | urb->dev->ttport, urb->dev->devnum, | ||
197 | usb_pipeendpoint (urb->pipe), token); | ||
198 | #endif /* DEBUG */ | ||
199 | /* REVISIT ARC-derived cores don't clear the root | ||
200 | * hub TT buffer in this way... | ||
201 | */ | ||
202 | usb_hub_tt_clear_buffer (urb->dev, urb->pipe); | ||
203 | } | ||
204 | } | 249 | } |
205 | 250 | ||
206 | return status; | 251 | return status; |
@@ -391,9 +436,16 @@ qh_completions (struct ehci_hcd *ehci, struct ehci_qh *qh) | |||
391 | /* qh unlinked; token in overlay may be most current */ | 436 | /* qh unlinked; token in overlay may be most current */ |
392 | if (state == QH_STATE_IDLE | 437 | if (state == QH_STATE_IDLE |
393 | && cpu_to_hc32(ehci, qtd->qtd_dma) | 438 | && cpu_to_hc32(ehci, qtd->qtd_dma) |
394 | == qh->hw_current) | 439 | == qh->hw_current) { |
395 | token = hc32_to_cpu(ehci, qh->hw_token); | 440 | token = hc32_to_cpu(ehci, qh->hw_token); |
396 | 441 | ||
442 | /* An unlink may leave an incomplete | ||
443 | * async transaction in the TT buffer. | ||
444 | * We have to clear it. | ||
445 | */ | ||
446 | ehci_clear_tt_buffer(ehci, qh, urb, token); | ||
447 | } | ||
448 | |||
397 | /* force halt for unlinked or blocked qh, so we'll | 449 | /* force halt for unlinked or blocked qh, so we'll |
398 | * patch the qh later and so that completions can't | 450 | * patch the qh later and so that completions can't |
399 | * activate it while we "know" it's stopped. | 451 | * activate it while we "know" it's stopped. |
@@ -419,6 +471,13 @@ halt: | |||
419 | && (qtd->hw_alt_next | 471 | && (qtd->hw_alt_next |
420 | & EHCI_LIST_END(ehci))) | 472 | & EHCI_LIST_END(ehci))) |
421 | last_status = -EINPROGRESS; | 473 | last_status = -EINPROGRESS; |
474 | |||
475 | /* As part of low/full-speed endpoint-halt processing | ||
476 | * we must clear the TT buffer (11.17.5). | ||
477 | */ | ||
478 | if (unlikely(last_status != -EINPROGRESS && | ||
479 | last_status != -EREMOTEIO)) | ||
480 | ehci_clear_tt_buffer(ehci, qh, urb, token); | ||
422 | } | 481 | } |
423 | 482 | ||
424 | /* if we're removing something not at the queue head, | 483 | /* if we're removing something not at the queue head, |
@@ -834,6 +893,7 @@ done: | |||
834 | qh->qh_state = QH_STATE_IDLE; | 893 | qh->qh_state = QH_STATE_IDLE; |
835 | qh->hw_info1 = cpu_to_hc32(ehci, info1); | 894 | qh->hw_info1 = cpu_to_hc32(ehci, info1); |
836 | qh->hw_info2 = cpu_to_hc32(ehci, info2); | 895 | qh->hw_info2 = cpu_to_hc32(ehci, info2); |
896 | usb_settoggle (urb->dev, usb_pipeendpoint (urb->pipe), !is_input, 1); | ||
837 | qh_refresh (ehci, qh); | 897 | qh_refresh (ehci, qh); |
838 | return qh; | 898 | return qh; |
839 | } | 899 | } |
@@ -847,6 +907,10 @@ static void qh_link_async (struct ehci_hcd *ehci, struct ehci_qh *qh) | |||
847 | __hc32 dma = QH_NEXT(ehci, qh->qh_dma); | 907 | __hc32 dma = QH_NEXT(ehci, qh->qh_dma); |
848 | struct ehci_qh *head; | 908 | struct ehci_qh *head; |
849 | 909 | ||
910 | /* Don't link a QH if there's a Clear-TT-Buffer pending */ | ||
911 | if (unlikely(qh->clearing_tt)) | ||
912 | return; | ||
913 | |||
850 | /* (re)start the async schedule? */ | 914 | /* (re)start the async schedule? */ |
851 | head = ehci->async; | 915 | head = ehci->async; |
852 | timer_action_done (ehci, TIMER_ASYNC_OFF); | 916 | timer_action_done (ehci, TIMER_ASYNC_OFF); |
@@ -864,7 +928,7 @@ static void qh_link_async (struct ehci_hcd *ehci, struct ehci_qh *qh) | |||
864 | } | 928 | } |
865 | } | 929 | } |
866 | 930 | ||
867 | /* clear halt and maybe recover from silicon quirk */ | 931 | /* clear halt and/or toggle; and maybe recover from silicon quirk */ |
868 | if (qh->qh_state == QH_STATE_IDLE) | 932 | if (qh->qh_state == QH_STATE_IDLE) |
869 | qh_refresh (ehci, qh); | 933 | qh_refresh (ehci, qh); |
870 | 934 | ||
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index 9d1babc7ff65..74f7f83b29ad 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
@@ -1619,11 +1619,14 @@ itd_complete ( | |||
1619 | desc->status = -EPROTO; | 1619 | desc->status = -EPROTO; |
1620 | 1620 | ||
1621 | /* HC need not update length with this error */ | 1621 | /* HC need not update length with this error */ |
1622 | if (!(t & EHCI_ISOC_BABBLE)) | 1622 | if (!(t & EHCI_ISOC_BABBLE)) { |
1623 | desc->actual_length = EHCI_ITD_LENGTH (t); | 1623 | desc->actual_length = EHCI_ITD_LENGTH(t); |
1624 | urb->actual_length += desc->actual_length; | ||
1625 | } | ||
1624 | } else if (likely ((t & EHCI_ISOC_ACTIVE) == 0)) { | 1626 | } else if (likely ((t & EHCI_ISOC_ACTIVE) == 0)) { |
1625 | desc->status = 0; | 1627 | desc->status = 0; |
1626 | desc->actual_length = EHCI_ITD_LENGTH (t); | 1628 | desc->actual_length = EHCI_ITD_LENGTH(t); |
1629 | urb->actual_length += desc->actual_length; | ||
1627 | } else { | 1630 | } else { |
1628 | /* URB was too late */ | 1631 | /* URB was too late */ |
1629 | desc->status = -EXDEV; | 1632 | desc->status = -EXDEV; |
@@ -2014,7 +2017,8 @@ sitd_complete ( | |||
2014 | desc->status = -EPROTO; | 2017 | desc->status = -EPROTO; |
2015 | } else { | 2018 | } else { |
2016 | desc->status = 0; | 2019 | desc->status = 0; |
2017 | desc->actual_length = desc->length - SITD_LENGTH (t); | 2020 | desc->actual_length = desc->length - SITD_LENGTH(t); |
2021 | urb->actual_length += desc->actual_length; | ||
2018 | } | 2022 | } |
2019 | stream->depth -= stream->interval << 3; | 2023 | stream->depth -= stream->interval << 3; |
2020 | 2024 | ||
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h index 90ad3395bb21..2bfff30f4704 100644 --- a/drivers/usb/host/ehci.h +++ b/drivers/usb/host/ehci.h | |||
@@ -354,7 +354,9 @@ struct ehci_qh { | |||
354 | unsigned short period; /* polling interval */ | 354 | unsigned short period; /* polling interval */ |
355 | unsigned short start; /* where polling starts */ | 355 | unsigned short start; /* where polling starts */ |
356 | #define NO_FRAME ((unsigned short)~0) /* pick new start */ | 356 | #define NO_FRAME ((unsigned short)~0) /* pick new start */ |
357 | |||
357 | struct usb_device *dev; /* access to TT */ | 358 | struct usb_device *dev; /* access to TT */ |
359 | unsigned clearing_tt:1; /* Clear-TT-Buf in progress */ | ||
358 | } __attribute__ ((aligned (32))); | 360 | } __attribute__ ((aligned (32))); |
359 | 361 | ||
360 | /*-------------------------------------------------------------------------*/ | 362 | /*-------------------------------------------------------------------------*/ |
diff --git a/drivers/usb/host/fhci-sched.c b/drivers/usb/host/fhci-sched.c index bb63b68ddb77..62a226b61670 100644 --- a/drivers/usb/host/fhci-sched.c +++ b/drivers/usb/host/fhci-sched.c | |||
@@ -576,9 +576,7 @@ irqreturn_t fhci_irq(struct usb_hcd *hcd) | |||
576 | out_be16(&usb->fhci->regs->usb_event, | 576 | out_be16(&usb->fhci->regs->usb_event, |
577 | usb->saved_msk); | 577 | usb->saved_msk); |
578 | } else if (usb->port_status == FHCI_PORT_DISABLED) { | 578 | } else if (usb->port_status == FHCI_PORT_DISABLED) { |
579 | if (fhci_ioports_check_bus_state(fhci) == 1 && | 579 | if (fhci_ioports_check_bus_state(fhci) == 1) |
580 | usb->port_status != FHCI_PORT_LOW && | ||
581 | usb->port_status != FHCI_PORT_FULL) | ||
582 | fhci_device_connected_interrupt(fhci); | 580 | fhci_device_connected_interrupt(fhci); |
583 | } | 581 | } |
584 | usb_er &= ~USB_E_RESET_MASK; | 582 | usb_er &= ~USB_E_RESET_MASK; |
@@ -605,9 +603,7 @@ irqreturn_t fhci_irq(struct usb_hcd *hcd) | |||
605 | } | 603 | } |
606 | 604 | ||
607 | if (usb_er & USB_E_IDLE_MASK) { | 605 | if (usb_er & USB_E_IDLE_MASK) { |
608 | if (usb->port_status == FHCI_PORT_DISABLED && | 606 | if (usb->port_status == FHCI_PORT_DISABLED) { |
609 | usb->port_status != FHCI_PORT_LOW && | ||
610 | usb->port_status != FHCI_PORT_FULL) { | ||
611 | usb_er &= ~USB_E_RESET_MASK; | 607 | usb_er &= ~USB_E_RESET_MASK; |
612 | fhci_device_connected_interrupt(fhci); | 608 | fhci_device_connected_interrupt(fhci); |
613 | } else if (usb->port_status == | 609 | } else if (usb->port_status == |
diff --git a/drivers/usb/host/isp1760-if.c b/drivers/usb/host/isp1760-if.c index 3fa3a1702796..d4feebfc63bd 100644 --- a/drivers/usb/host/isp1760-if.c +++ b/drivers/usb/host/isp1760-if.c | |||
@@ -361,7 +361,7 @@ static int __devexit isp1760_plat_remove(struct platform_device *pdev) | |||
361 | 361 | ||
362 | static struct platform_driver isp1760_plat_driver = { | 362 | static struct platform_driver isp1760_plat_driver = { |
363 | .probe = isp1760_plat_probe, | 363 | .probe = isp1760_plat_probe, |
364 | .remove = isp1760_plat_remove, | 364 | .remove = __devexit_p(isp1760_plat_remove), |
365 | .driver = { | 365 | .driver = { |
366 | .name = "isp1760", | 366 | .name = "isp1760", |
367 | }, | 367 | }, |
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c index 56976cc0352a..e18f74946e68 100644 --- a/drivers/usb/host/r8a66597-hcd.c +++ b/drivers/usb/host/r8a66597-hcd.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/module.h> | 26 | #include <linux/module.h> |
27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
28 | #include <linux/sched.h> | 28 | #include <linux/sched.h> |
29 | #include <linux/smp_lock.h> | ||
30 | #include <linux/errno.h> | 29 | #include <linux/errno.h> |
31 | #include <linux/init.h> | 30 | #include <linux/init.h> |
32 | #include <linux/timer.h> | 31 | #include <linux/timer.h> |
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c index 3c5fe5cee05a..90e1a8dedfa9 100644 --- a/drivers/usb/misc/iowarrior.c +++ b/drivers/usb/misc/iowarrior.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
20 | #include <linux/sched.h> | 20 | #include <linux/sched.h> |
21 | #include <linux/smp_lock.h> | ||
21 | #include <linux/poll.h> | 22 | #include <linux/poll.h> |
22 | #include <linux/usb/iowarrior.h> | 23 | #include <linux/usb/iowarrior.h> |
23 | 24 | ||
diff --git a/drivers/usb/misc/rio500.c b/drivers/usb/misc/rio500.c index deb95bb49fd1..d645f3899fe1 100644 --- a/drivers/usb/misc/rio500.c +++ b/drivers/usb/misc/rio500.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/kernel.h> | 32 | #include <linux/kernel.h> |
33 | #include <linux/signal.h> | 33 | #include <linux/signal.h> |
34 | #include <linux/sched.h> | 34 | #include <linux/sched.h> |
35 | #include <linux/smp_lock.h> | ||
35 | #include <linux/errno.h> | 36 | #include <linux/errno.h> |
36 | #include <linux/random.h> | 37 | #include <linux/random.h> |
37 | #include <linux/poll.h> | 38 | #include <linux/poll.h> |
diff --git a/drivers/usb/misc/usblcd.c b/drivers/usb/misc/usblcd.c index e0ff9ccd866b..29092b8e59ce 100644 --- a/drivers/usb/misc/usblcd.c +++ b/drivers/usb/misc/usblcd.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/kernel.h> | 16 | #include <linux/kernel.h> |
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/smp_lock.h> | ||
19 | #include <linux/errno.h> | 20 | #include <linux/errno.h> |
20 | #include <linux/mutex.h> | 21 | #include <linux/mutex.h> |
21 | #include <asm/uaccess.h> | 22 | #include <asm/uaccess.h> |
diff --git a/drivers/usb/mon/mon_bin.c b/drivers/usb/mon/mon_bin.c index f8d9045d668a..0f7a30b7d2d1 100644 --- a/drivers/usb/mon/mon_bin.c +++ b/drivers/usb/mon/mon_bin.c | |||
@@ -1261,7 +1261,7 @@ static int mon_alloc_buff(struct mon_pgmap *map, int npages) | |||
1261 | return -ENOMEM; | 1261 | return -ENOMEM; |
1262 | } | 1262 | } |
1263 | map[n].ptr = (unsigned char *) vaddr; | 1263 | map[n].ptr = (unsigned char *) vaddr; |
1264 | map[n].pg = virt_to_page(vaddr); | 1264 | map[n].pg = virt_to_page((void *) vaddr); |
1265 | } | 1265 | } |
1266 | return 0; | 1266 | return 0; |
1267 | } | 1267 | } |
diff --git a/drivers/usb/musb/cppi_dma.h b/drivers/usb/musb/cppi_dma.h index 8a39de3e6e47..59bf949e589b 100644 --- a/drivers/usb/musb/cppi_dma.h +++ b/drivers/usb/musb/cppi_dma.h | |||
@@ -5,7 +5,6 @@ | |||
5 | 5 | ||
6 | #include <linux/slab.h> | 6 | #include <linux/slab.h> |
7 | #include <linux/list.h> | 7 | #include <linux/list.h> |
8 | #include <linux/smp_lock.h> | ||
9 | #include <linux/errno.h> | 8 | #include <linux/errno.h> |
10 | #include <linux/dmapool.h> | 9 | #include <linux/dmapool.h> |
11 | 10 | ||
diff --git a/drivers/usb/musb/davinci.c b/drivers/usb/musb/davinci.c index 180d7daa4099..e16ff605c458 100644 --- a/drivers/usb/musb/davinci.c +++ b/drivers/usb/musb/davinci.c | |||
@@ -35,13 +35,14 @@ | |||
35 | #include <mach/hardware.h> | 35 | #include <mach/hardware.h> |
36 | #include <mach/memory.h> | 36 | #include <mach/memory.h> |
37 | #include <mach/gpio.h> | 37 | #include <mach/gpio.h> |
38 | #include <mach/cputype.h> | ||
38 | 39 | ||
39 | #include <asm/mach-types.h> | 40 | #include <asm/mach-types.h> |
40 | 41 | ||
41 | #include "musb_core.h" | 42 | #include "musb_core.h" |
42 | 43 | ||
43 | #ifdef CONFIG_MACH_DAVINCI_EVM | 44 | #ifdef CONFIG_MACH_DAVINCI_EVM |
44 | #define GPIO_nVBUS_DRV 87 | 45 | #define GPIO_nVBUS_DRV 144 |
45 | #endif | 46 | #endif |
46 | 47 | ||
47 | #include "davinci.h" | 48 | #include "davinci.h" |
@@ -329,7 +330,6 @@ static irqreturn_t davinci_interrupt(int irq, void *__hci) | |||
329 | mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); | 330 | mod_timer(&otg_workaround, jiffies + POLL_SECONDS * HZ); |
330 | WARNING("VBUS error workaround (delay coming)\n"); | 331 | WARNING("VBUS error workaround (delay coming)\n"); |
331 | } else if (is_host_enabled(musb) && drvvbus) { | 332 | } else if (is_host_enabled(musb) && drvvbus) { |
332 | musb->is_active = 1; | ||
333 | MUSB_HST_MODE(musb); | 333 | MUSB_HST_MODE(musb); |
334 | musb->xceiv->default_a = 1; | 334 | musb->xceiv->default_a = 1; |
335 | musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; | 335 | musb->xceiv->state = OTG_STATE_A_WAIT_VRISE; |
@@ -343,7 +343,9 @@ static irqreturn_t davinci_interrupt(int irq, void *__hci) | |||
343 | portstate(musb->port1_status &= ~USB_PORT_STAT_POWER); | 343 | portstate(musb->port1_status &= ~USB_PORT_STAT_POWER); |
344 | } | 344 | } |
345 | 345 | ||
346 | /* NOTE: this must complete poweron within 100 msec */ | 346 | /* NOTE: this must complete poweron within 100 msec |
347 | * (OTG_TIME_A_WAIT_VRISE) but we don't check for that. | ||
348 | */ | ||
347 | davinci_source_power(musb, drvvbus, 0); | 349 | davinci_source_power(musb, drvvbus, 0); |
348 | DBG(2, "VBUS %s (%s)%s, devctl %02x\n", | 350 | DBG(2, "VBUS %s (%s)%s, devctl %02x\n", |
349 | drvvbus ? "on" : "off", | 351 | drvvbus ? "on" : "off", |
@@ -411,6 +413,21 @@ int __init musb_platform_init(struct musb *musb) | |||
411 | __raw_writel(phy_ctrl, USB_PHY_CTRL); | 413 | __raw_writel(phy_ctrl, USB_PHY_CTRL); |
412 | } | 414 | } |
413 | 415 | ||
416 | /* On dm355, the default-A state machine needs DRVVBUS control. | ||
417 | * If we won't be a host, there's no need to turn it on. | ||
418 | */ | ||
419 | if (cpu_is_davinci_dm355()) { | ||
420 | u32 deepsleep = __raw_readl(DM355_DEEPSLEEP); | ||
421 | |||
422 | if (is_host_enabled(musb)) { | ||
423 | deepsleep &= ~DRVVBUS_OVERRIDE; | ||
424 | } else { | ||
425 | deepsleep &= ~DRVVBUS_FORCE; | ||
426 | deepsleep |= DRVVBUS_OVERRIDE; | ||
427 | } | ||
428 | __raw_writel(deepsleep, DM355_DEEPSLEEP); | ||
429 | } | ||
430 | |||
414 | /* reset the controller */ | 431 | /* reset the controller */ |
415 | musb_writel(tibase, DAVINCI_USB_CTRL_REG, 0x1); | 432 | musb_writel(tibase, DAVINCI_USB_CTRL_REG, 0x1); |
416 | 433 | ||
@@ -437,6 +454,15 @@ int musb_platform_exit(struct musb *musb) | |||
437 | if (is_host_enabled(musb)) | 454 | if (is_host_enabled(musb)) |
438 | del_timer_sync(&otg_workaround); | 455 | del_timer_sync(&otg_workaround); |
439 | 456 | ||
457 | /* force VBUS off */ | ||
458 | if (cpu_is_davinci_dm355()) { | ||
459 | u32 deepsleep = __raw_readl(DM355_DEEPSLEEP); | ||
460 | |||
461 | deepsleep &= ~DRVVBUS_FORCE; | ||
462 | deepsleep |= DRVVBUS_OVERRIDE; | ||
463 | __raw_writel(deepsleep, DM355_DEEPSLEEP); | ||
464 | } | ||
465 | |||
440 | davinci_source_power(musb, 0 /*off*/, 1); | 466 | davinci_source_power(musb, 0 /*off*/, 1); |
441 | 467 | ||
442 | /* delay, to avoid problems with module reload */ | 468 | /* delay, to avoid problems with module reload */ |
diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index f3772ca3b2cf..381d648a36b8 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h | |||
@@ -38,7 +38,6 @@ | |||
38 | #include <linux/slab.h> | 38 | #include <linux/slab.h> |
39 | #include <linux/list.h> | 39 | #include <linux/list.h> |
40 | #include <linux/interrupt.h> | 40 | #include <linux/interrupt.h> |
41 | #include <linux/smp_lock.h> | ||
42 | #include <linux/errno.h> | 41 | #include <linux/errno.h> |
43 | #include <linux/timer.h> | 42 | #include <linux/timer.h> |
44 | #include <linux/clk.h> | 43 | #include <linux/clk.h> |
diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index 94a2a350a414..cf94511485f2 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c | |||
@@ -373,7 +373,7 @@ static void musb_advance_schedule(struct musb *musb, struct urb *urb, | |||
373 | musb_save_toggle(qh, is_in, urb); | 373 | musb_save_toggle(qh, is_in, urb); |
374 | break; | 374 | break; |
375 | case USB_ENDPOINT_XFER_ISOC: | 375 | case USB_ENDPOINT_XFER_ISOC: |
376 | if (urb->error_count) | 376 | if (status == 0 && urb->error_count) |
377 | status = -EXDEV; | 377 | status = -EXDEV; |
378 | break; | 378 | break; |
379 | } | 379 | } |
@@ -2235,13 +2235,30 @@ static void musb_h_stop(struct usb_hcd *hcd) | |||
2235 | static int musb_bus_suspend(struct usb_hcd *hcd) | 2235 | static int musb_bus_suspend(struct usb_hcd *hcd) |
2236 | { | 2236 | { |
2237 | struct musb *musb = hcd_to_musb(hcd); | 2237 | struct musb *musb = hcd_to_musb(hcd); |
2238 | u8 devctl; | ||
2238 | 2239 | ||
2239 | if (musb->xceiv->state == OTG_STATE_A_SUSPEND) | 2240 | if (!is_host_active(musb)) |
2240 | return 0; | 2241 | return 0; |
2241 | 2242 | ||
2242 | if (is_host_active(musb) && musb->is_active) { | 2243 | switch (musb->xceiv->state) { |
2243 | WARNING("trying to suspend as %s is_active=%i\n", | 2244 | case OTG_STATE_A_SUSPEND: |
2244 | otg_state_string(musb), musb->is_active); | 2245 | return 0; |
2246 | case OTG_STATE_A_WAIT_VRISE: | ||
2247 | /* ID could be grounded even if there's no device | ||
2248 | * on the other end of the cable. NOTE that the | ||
2249 | * A_WAIT_VRISE timers are messy with MUSB... | ||
2250 | */ | ||
2251 | devctl = musb_readb(musb->mregs, MUSB_DEVCTL); | ||
2252 | if ((devctl & MUSB_DEVCTL_VBUS) == MUSB_DEVCTL_VBUS) | ||
2253 | musb->xceiv->state = OTG_STATE_A_WAIT_BCON; | ||
2254 | break; | ||
2255 | default: | ||
2256 | break; | ||
2257 | } | ||
2258 | |||
2259 | if (musb->is_active) { | ||
2260 | WARNING("trying to suspend as %s while active\n", | ||
2261 | otg_state_string(musb)); | ||
2245 | return -EBUSY; | 2262 | return -EBUSY; |
2246 | } else | 2263 | } else |
2247 | return 0; | 2264 | return 0; |
diff --git a/drivers/usb/otg/Kconfig b/drivers/usb/otg/Kconfig index 69feeec1628c..aa884d072f0b 100644 --- a/drivers/usb/otg/Kconfig +++ b/drivers/usb/otg/Kconfig | |||
@@ -59,18 +59,4 @@ config NOP_USB_XCEIV | |||
59 | built-in with usb ip or which are autonomous and doesn't require any | 59 | built-in with usb ip or which are autonomous and doesn't require any |
60 | phy programming such as ISP1x04 etc. | 60 | phy programming such as ISP1x04 etc. |
61 | 61 | ||
62 | config USB_LANGWELL_OTG | ||
63 | tristate "Intel Langwell USB OTG dual-role support" | ||
64 | depends on USB && MRST | ||
65 | select USB_OTG | ||
66 | select USB_OTG_UTILS | ||
67 | help | ||
68 | Say Y here if you want to build Intel Langwell USB OTG | ||
69 | transciever driver in kernel. This driver implements role | ||
70 | switch between EHCI host driver and Langwell USB OTG | ||
71 | client driver. | ||
72 | |||
73 | To compile this driver as a module, choose M here: the | ||
74 | module will be called langwell_otg. | ||
75 | |||
76 | endif # USB || OTG | 62 | endif # USB || OTG |
diff --git a/drivers/usb/otg/Makefile b/drivers/usb/otg/Makefile index 6d1abdd3c0ac..208167856529 100644 --- a/drivers/usb/otg/Makefile +++ b/drivers/usb/otg/Makefile | |||
@@ -9,7 +9,6 @@ obj-$(CONFIG_USB_OTG_UTILS) += otg.o | |||
9 | obj-$(CONFIG_USB_GPIO_VBUS) += gpio_vbus.o | 9 | obj-$(CONFIG_USB_GPIO_VBUS) += gpio_vbus.o |
10 | obj-$(CONFIG_ISP1301_OMAP) += isp1301_omap.o | 10 | obj-$(CONFIG_ISP1301_OMAP) += isp1301_omap.o |
11 | obj-$(CONFIG_TWL4030_USB) += twl4030-usb.o | 11 | obj-$(CONFIG_TWL4030_USB) += twl4030-usb.o |
12 | obj-$(CONFIG_USB_LANGWELL_OTG) += langwell_otg.o | ||
13 | obj-$(CONFIG_NOP_USB_XCEIV) += nop-usb-xceiv.o | 12 | obj-$(CONFIG_NOP_USB_XCEIV) += nop-usb-xceiv.o |
14 | 13 | ||
15 | ccflags-$(CONFIG_USB_DEBUG) += -DDEBUG | 14 | ccflags-$(CONFIG_USB_DEBUG) += -DDEBUG |
diff --git a/drivers/usb/otg/langwell_otg.c b/drivers/usb/otg/langwell_otg.c deleted file mode 100644 index 6f628d0e9f39..000000000000 --- a/drivers/usb/otg/langwell_otg.c +++ /dev/null | |||
@@ -1,1915 +0,0 @@ | |||
1 | /* | ||
2 | * Intel Langwell USB OTG transceiver driver | ||
3 | * Copyright (C) 2008 - 2009, Intel Corporation. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms and conditions of the GNU General Public License, | ||
7 | * version 2, as published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along with | ||
15 | * this program; if not, write to the Free Software Foundation, Inc., | ||
16 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
17 | * | ||
18 | */ | ||
19 | /* This driver helps to switch Langwell OTG controller function between host | ||
20 | * and peripheral. It works with EHCI driver and Langwell client controller | ||
21 | * driver together. | ||
22 | */ | ||
23 | #include <linux/module.h> | ||
24 | #include <linux/init.h> | ||
25 | #include <linux/pci.h> | ||
26 | #include <linux/errno.h> | ||
27 | #include <linux/interrupt.h> | ||
28 | #include <linux/kernel.h> | ||
29 | #include <linux/device.h> | ||
30 | #include <linux/moduleparam.h> | ||
31 | #include <linux/usb/ch9.h> | ||
32 | #include <linux/usb/gadget.h> | ||
33 | #include <linux/usb.h> | ||
34 | #include <linux/usb/otg.h> | ||
35 | #include <linux/notifier.h> | ||
36 | #include <asm/ipc_defs.h> | ||
37 | #include <linux/delay.h> | ||
38 | #include "../core/hcd.h" | ||
39 | |||
40 | #include <linux/usb/langwell_otg.h> | ||
41 | |||
42 | #define DRIVER_DESC "Intel Langwell USB OTG transceiver driver" | ||
43 | #define DRIVER_VERSION "3.0.0.32L.0002" | ||
44 | |||
45 | MODULE_DESCRIPTION(DRIVER_DESC); | ||
46 | MODULE_AUTHOR("Henry Yuan <hang.yuan@intel.com>, Hao Wu <hao.wu@intel.com>"); | ||
47 | MODULE_VERSION(DRIVER_VERSION); | ||
48 | MODULE_LICENSE("GPL"); | ||
49 | |||
50 | static const char driver_name[] = "langwell_otg"; | ||
51 | |||
52 | static int langwell_otg_probe(struct pci_dev *pdev, | ||
53 | const struct pci_device_id *id); | ||
54 | static void langwell_otg_remove(struct pci_dev *pdev); | ||
55 | static int langwell_otg_suspend(struct pci_dev *pdev, pm_message_t message); | ||
56 | static int langwell_otg_resume(struct pci_dev *pdev); | ||
57 | |||
58 | static int langwell_otg_set_host(struct otg_transceiver *otg, | ||
59 | struct usb_bus *host); | ||
60 | static int langwell_otg_set_peripheral(struct otg_transceiver *otg, | ||
61 | struct usb_gadget *gadget); | ||
62 | static int langwell_otg_start_srp(struct otg_transceiver *otg); | ||
63 | |||
64 | static const struct pci_device_id pci_ids[] = {{ | ||
65 | .class = ((PCI_CLASS_SERIAL_USB << 8) | 0xfe), | ||
66 | .class_mask = ~0, | ||
67 | .vendor = 0x8086, | ||
68 | .device = 0x0811, | ||
69 | .subvendor = PCI_ANY_ID, | ||
70 | .subdevice = PCI_ANY_ID, | ||
71 | }, { /* end: all zeroes */ } | ||
72 | }; | ||
73 | |||
74 | static struct pci_driver otg_pci_driver = { | ||
75 | .name = (char *) driver_name, | ||
76 | .id_table = pci_ids, | ||
77 | |||
78 | .probe = langwell_otg_probe, | ||
79 | .remove = langwell_otg_remove, | ||
80 | |||
81 | .suspend = langwell_otg_suspend, | ||
82 | .resume = langwell_otg_resume, | ||
83 | }; | ||
84 | |||
85 | static const char *state_string(enum usb_otg_state state) | ||
86 | { | ||
87 | switch (state) { | ||
88 | case OTG_STATE_A_IDLE: | ||
89 | return "a_idle"; | ||
90 | case OTG_STATE_A_WAIT_VRISE: | ||
91 | return "a_wait_vrise"; | ||
92 | case OTG_STATE_A_WAIT_BCON: | ||
93 | return "a_wait_bcon"; | ||
94 | case OTG_STATE_A_HOST: | ||
95 | return "a_host"; | ||
96 | case OTG_STATE_A_SUSPEND: | ||
97 | return "a_suspend"; | ||
98 | case OTG_STATE_A_PERIPHERAL: | ||
99 | return "a_peripheral"; | ||
100 | case OTG_STATE_A_WAIT_VFALL: | ||
101 | return "a_wait_vfall"; | ||
102 | case OTG_STATE_A_VBUS_ERR: | ||
103 | return "a_vbus_err"; | ||
104 | case OTG_STATE_B_IDLE: | ||
105 | return "b_idle"; | ||
106 | case OTG_STATE_B_SRP_INIT: | ||
107 | return "b_srp_init"; | ||
108 | case OTG_STATE_B_PERIPHERAL: | ||
109 | return "b_peripheral"; | ||
110 | case OTG_STATE_B_WAIT_ACON: | ||
111 | return "b_wait_acon"; | ||
112 | case OTG_STATE_B_HOST: | ||
113 | return "b_host"; | ||
114 | default: | ||
115 | return "UNDEFINED"; | ||
116 | } | ||
117 | } | ||
118 | |||
119 | /* HSM timers */ | ||
120 | static inline struct langwell_otg_timer *otg_timer_initializer | ||
121 | (void (*function)(unsigned long), unsigned long expires, unsigned long data) | ||
122 | { | ||
123 | struct langwell_otg_timer *timer; | ||
124 | timer = kmalloc(sizeof(struct langwell_otg_timer), GFP_KERNEL); | ||
125 | timer->function = function; | ||
126 | timer->expires = expires; | ||
127 | timer->data = data; | ||
128 | return timer; | ||
129 | } | ||
130 | |||
131 | static struct langwell_otg_timer *a_wait_vrise_tmr, *a_wait_bcon_tmr, | ||
132 | *a_aidl_bdis_tmr, *b_ase0_brst_tmr, *b_se0_srp_tmr, *b_srp_res_tmr, | ||
133 | *b_bus_suspend_tmr; | ||
134 | |||
135 | static struct list_head active_timers; | ||
136 | |||
137 | static struct langwell_otg *the_transceiver; | ||
138 | |||
139 | /* host/client notify transceiver when event affects HNP state */ | ||
140 | void langwell_update_transceiver() | ||
141 | { | ||
142 | otg_dbg("transceiver driver is notified\n"); | ||
143 | queue_work(the_transceiver->qwork, &the_transceiver->work); | ||
144 | } | ||
145 | EXPORT_SYMBOL(langwell_update_transceiver); | ||
146 | |||
147 | static int langwell_otg_set_host(struct otg_transceiver *otg, | ||
148 | struct usb_bus *host) | ||
149 | { | ||
150 | otg->host = host; | ||
151 | |||
152 | return 0; | ||
153 | } | ||
154 | |||
155 | static int langwell_otg_set_peripheral(struct otg_transceiver *otg, | ||
156 | struct usb_gadget *gadget) | ||
157 | { | ||
158 | otg->gadget = gadget; | ||
159 | |||
160 | return 0; | ||
161 | } | ||
162 | |||
163 | static int langwell_otg_set_power(struct otg_transceiver *otg, | ||
164 | unsigned mA) | ||
165 | { | ||
166 | return 0; | ||
167 | } | ||
168 | |||
169 | /* A-device drives vbus, controlled through PMIC CHRGCNTL register*/ | ||
170 | static void langwell_otg_drv_vbus(int on) | ||
171 | { | ||
172 | struct ipc_pmic_reg_data pmic_data = {0}; | ||
173 | struct ipc_pmic_reg_data battery_data; | ||
174 | |||
175 | /* Check if battery is attached or not */ | ||
176 | battery_data.pmic_reg_data[0].register_address = 0xd2; | ||
177 | battery_data.ioc = 0; | ||
178 | battery_data.num_entries = 1; | ||
179 | if (ipc_pmic_register_read(&battery_data)) { | ||
180 | otg_dbg("Failed to read PMIC register 0xd2.\n"); | ||
181 | return; | ||
182 | } | ||
183 | |||
184 | if ((battery_data.pmic_reg_data[0].value & 0x20) == 0) { | ||
185 | otg_dbg("no battery attached\n"); | ||
186 | return; | ||
187 | } | ||
188 | |||
189 | /* Workaround for battery attachment issue */ | ||
190 | if (battery_data.pmic_reg_data[0].value == 0x34) { | ||
191 | otg_dbg("battery \n"); | ||
192 | return; | ||
193 | } | ||
194 | |||
195 | otg_dbg("battery attached\n"); | ||
196 | |||
197 | pmic_data.ioc = 0; | ||
198 | pmic_data.pmic_reg_data[0].register_address = 0xD4; | ||
199 | pmic_data.num_entries = 1; | ||
200 | if (on) | ||
201 | pmic_data.pmic_reg_data[0].value = 0x20; | ||
202 | else | ||
203 | pmic_data.pmic_reg_data[0].value = 0xc0; | ||
204 | |||
205 | if (ipc_pmic_register_write(&pmic_data, TRUE)) | ||
206 | otg_dbg("Failed to write PMIC.\n"); | ||
207 | |||
208 | } | ||
209 | |||
210 | /* charge vbus or discharge vbus through a resistor to ground */ | ||
211 | static void langwell_otg_chrg_vbus(int on) | ||
212 | { | ||
213 | |||
214 | u32 val; | ||
215 | |||
216 | val = readl(the_transceiver->regs + CI_OTGSC); | ||
217 | |||
218 | if (on) | ||
219 | writel((val & ~OTGSC_INTSTS_MASK) | OTGSC_VC, | ||
220 | the_transceiver->regs + CI_OTGSC); | ||
221 | else | ||
222 | writel((val & ~OTGSC_INTSTS_MASK) | OTGSC_VD, | ||
223 | the_transceiver->regs + CI_OTGSC); | ||
224 | |||
225 | } | ||
226 | |||
227 | /* Start SRP */ | ||
228 | static int langwell_otg_start_srp(struct otg_transceiver *otg) | ||
229 | { | ||
230 | u32 val; | ||
231 | |||
232 | otg_dbg("Start SRP ->\n"); | ||
233 | |||
234 | val = readl(the_transceiver->regs + CI_OTGSC); | ||
235 | |||
236 | writel((val & ~OTGSC_INTSTS_MASK) | OTGSC_HADP, | ||
237 | the_transceiver->regs + CI_OTGSC); | ||
238 | |||
239 | /* Check if the data plus is finished or not */ | ||
240 | msleep(8); | ||
241 | val = readl(the_transceiver->regs + CI_OTGSC); | ||
242 | if (val & (OTGSC_HADP | OTGSC_DP)) | ||
243 | otg_dbg("DataLine SRP Error\n"); | ||
244 | |||
245 | /* FIXME: VBus SRP */ | ||
246 | |||
247 | return 0; | ||
248 | } | ||
249 | |||
250 | |||
251 | /* stop SOF via bus_suspend */ | ||
252 | static void langwell_otg_loc_sof(int on) | ||
253 | { | ||
254 | struct usb_hcd *hcd; | ||
255 | int err; | ||
256 | |||
257 | otg_dbg("loc_sof -> %d\n", on); | ||
258 | |||
259 | hcd = bus_to_hcd(the_transceiver->otg.host); | ||
260 | if (on) | ||
261 | err = hcd->driver->bus_resume(hcd); | ||
262 | else | ||
263 | err = hcd->driver->bus_suspend(hcd); | ||
264 | |||
265 | if (err) | ||
266 | otg_dbg("Failed to resume/suspend bus - %d\n", err); | ||
267 | } | ||
268 | |||
269 | static void langwell_otg_phy_low_power(int on) | ||
270 | { | ||
271 | u32 val; | ||
272 | |||
273 | otg_dbg("phy low power mode-> %d\n", on); | ||
274 | |||
275 | val = readl(the_transceiver->regs + CI_HOSTPC1); | ||
276 | if (on) | ||
277 | writel(val | HOSTPC1_PHCD, the_transceiver->regs + CI_HOSTPC1); | ||
278 | else | ||
279 | writel(val & ~HOSTPC1_PHCD, the_transceiver->regs + CI_HOSTPC1); | ||
280 | } | ||
281 | |||
282 | /* Enable/Disable OTG interrupt */ | ||
283 | static void langwell_otg_intr(int on) | ||
284 | { | ||
285 | u32 val; | ||
286 | |||
287 | otg_dbg("interrupt -> %d\n", on); | ||
288 | |||
289 | val = readl(the_transceiver->regs + CI_OTGSC); | ||
290 | if (on) { | ||
291 | val = val | (OTGSC_INTEN_MASK | OTGSC_IDPU); | ||
292 | writel(val, the_transceiver->regs + CI_OTGSC); | ||
293 | } else { | ||
294 | val = val & ~(OTGSC_INTEN_MASK | OTGSC_IDPU); | ||
295 | writel(val, the_transceiver->regs + CI_OTGSC); | ||
296 | } | ||
297 | } | ||
298 | |||
299 | /* set HAAR: Hardware Assist Auto-Reset */ | ||
300 | static void langwell_otg_HAAR(int on) | ||
301 | { | ||
302 | u32 val; | ||
303 | |||
304 | otg_dbg("HAAR -> %d\n", on); | ||
305 | |||
306 | val = readl(the_transceiver->regs + CI_OTGSC); | ||
307 | if (on) | ||
308 | writel((val & ~OTGSC_INTSTS_MASK) | OTGSC_HAAR, | ||
309 | the_transceiver->regs + CI_OTGSC); | ||
310 | else | ||
311 | writel((val & ~OTGSC_INTSTS_MASK) & ~OTGSC_HAAR, | ||
312 | the_transceiver->regs + CI_OTGSC); | ||
313 | } | ||
314 | |||
315 | /* set HABA: Hardware Assist B-Disconnect to A-Connect */ | ||
316 | static void langwell_otg_HABA(int on) | ||
317 | { | ||
318 | u32 val; | ||
319 | |||
320 | otg_dbg("HABA -> %d\n", on); | ||
321 | |||
322 | val = readl(the_transceiver->regs + CI_OTGSC); | ||
323 | if (on) | ||
324 | writel((val & ~OTGSC_INTSTS_MASK) | OTGSC_HABA, | ||
325 | the_transceiver->regs + CI_OTGSC); | ||
326 | else | ||
327 | writel((val & ~OTGSC_INTSTS_MASK) & ~OTGSC_HABA, | ||
328 | the_transceiver->regs + CI_OTGSC); | ||
329 | } | ||
330 | |||
331 | static int langwell_otg_check_se0_srp(int on) | ||
332 | { | ||
333 | u32 val; | ||
334 | |||
335 | int delay_time = TB_SE0_SRP * 10; /* step is 100us */ | ||
336 | |||
337 | otg_dbg("check_se0_srp -> \n"); | ||
338 | |||
339 | do { | ||
340 | udelay(100); | ||
341 | if (!delay_time--) | ||
342 | break; | ||
343 | val = readl(the_transceiver->regs + CI_PORTSC1); | ||
344 | val &= PORTSC_LS; | ||
345 | } while (!val); | ||
346 | |||
347 | otg_dbg("check_se0_srp <- \n"); | ||
348 | return val; | ||
349 | } | ||
350 | |||
351 | /* The timeout callback function to set time out bit */ | ||
352 | static void set_tmout(unsigned long indicator) | ||
353 | { | ||
354 | *(int *)indicator = 1; | ||
355 | } | ||
356 | |||
357 | void langwell_otg_nsf_msg(unsigned long indicator) | ||
358 | { | ||
359 | switch (indicator) { | ||
360 | case 2: | ||
361 | case 4: | ||
362 | case 6: | ||
363 | case 7: | ||
364 | printk(KERN_ERR "OTG:NSF-%lu - deivce not responding\n", | ||
365 | indicator); | ||
366 | break; | ||
367 | case 3: | ||
368 | printk(KERN_ERR "OTG:NSF-%lu - deivce not supported\n", | ||
369 | indicator); | ||
370 | break; | ||
371 | default: | ||
372 | printk(KERN_ERR "Do not have this kind of NSF\n"); | ||
373 | break; | ||
374 | } | ||
375 | } | ||
376 | |||
377 | /* Initialize timers */ | ||
378 | static void langwell_otg_init_timers(struct otg_hsm *hsm) | ||
379 | { | ||
380 | /* HSM used timers */ | ||
381 | a_wait_vrise_tmr = otg_timer_initializer(&set_tmout, TA_WAIT_VRISE, | ||
382 | (unsigned long)&hsm->a_wait_vrise_tmout); | ||
383 | a_wait_bcon_tmr = otg_timer_initializer(&set_tmout, TA_WAIT_BCON, | ||
384 | (unsigned long)&hsm->a_wait_bcon_tmout); | ||
385 | a_aidl_bdis_tmr = otg_timer_initializer(&set_tmout, TA_AIDL_BDIS, | ||
386 | (unsigned long)&hsm->a_aidl_bdis_tmout); | ||
387 | b_ase0_brst_tmr = otg_timer_initializer(&set_tmout, TB_ASE0_BRST, | ||
388 | (unsigned long)&hsm->b_ase0_brst_tmout); | ||
389 | b_se0_srp_tmr = otg_timer_initializer(&set_tmout, TB_SE0_SRP, | ||
390 | (unsigned long)&hsm->b_se0_srp); | ||
391 | b_srp_res_tmr = otg_timer_initializer(&set_tmout, TB_SRP_RES, | ||
392 | (unsigned long)&hsm->b_srp_res_tmout); | ||
393 | b_bus_suspend_tmr = otg_timer_initializer(&set_tmout, TB_BUS_SUSPEND, | ||
394 | (unsigned long)&hsm->b_bus_suspend_tmout); | ||
395 | } | ||
396 | |||
397 | /* Free timers */ | ||
398 | static void langwell_otg_free_timers(void) | ||
399 | { | ||
400 | kfree(a_wait_vrise_tmr); | ||
401 | kfree(a_wait_bcon_tmr); | ||
402 | kfree(a_aidl_bdis_tmr); | ||
403 | kfree(b_ase0_brst_tmr); | ||
404 | kfree(b_se0_srp_tmr); | ||
405 | kfree(b_srp_res_tmr); | ||
406 | kfree(b_bus_suspend_tmr); | ||
407 | } | ||
408 | |||
409 | /* Add timer to timer list */ | ||
410 | static void langwell_otg_add_timer(void *gtimer) | ||
411 | { | ||
412 | struct langwell_otg_timer *timer = (struct langwell_otg_timer *)gtimer; | ||
413 | struct langwell_otg_timer *tmp_timer; | ||
414 | u32 val32; | ||
415 | |||
416 | /* Check if the timer is already in the active list, | ||
417 | * if so update timer count | ||
418 | */ | ||
419 | list_for_each_entry(tmp_timer, &active_timers, list) | ||
420 | if (tmp_timer == timer) { | ||
421 | timer->count = timer->expires; | ||
422 | return; | ||
423 | } | ||
424 | timer->count = timer->expires; | ||
425 | |||
426 | if (list_empty(&active_timers)) { | ||
427 | val32 = readl(the_transceiver->regs + CI_OTGSC); | ||
428 | writel(val32 | OTGSC_1MSE, the_transceiver->regs + CI_OTGSC); | ||
429 | } | ||
430 | |||
431 | list_add_tail(&timer->list, &active_timers); | ||
432 | } | ||
433 | |||
434 | /* Remove timer from the timer list; clear timeout status */ | ||
435 | static void langwell_otg_del_timer(void *gtimer) | ||
436 | { | ||
437 | struct langwell_otg_timer *timer = (struct langwell_otg_timer *)gtimer; | ||
438 | struct langwell_otg_timer *tmp_timer, *del_tmp; | ||
439 | u32 val32; | ||
440 | |||
441 | list_for_each_entry_safe(tmp_timer, del_tmp, &active_timers, list) | ||
442 | if (tmp_timer == timer) | ||
443 | list_del(&timer->list); | ||
444 | |||
445 | if (list_empty(&active_timers)) { | ||
446 | val32 = readl(the_transceiver->regs + CI_OTGSC); | ||
447 | writel(val32 & ~OTGSC_1MSE, the_transceiver->regs + CI_OTGSC); | ||
448 | } | ||
449 | } | ||
450 | |||
451 | /* Reduce timer count by 1, and find timeout conditions.*/ | ||
452 | static int langwell_otg_tick_timer(u32 *int_sts) | ||
453 | { | ||
454 | struct langwell_otg_timer *tmp_timer, *del_tmp; | ||
455 | int expired = 0; | ||
456 | |||
457 | list_for_each_entry_safe(tmp_timer, del_tmp, &active_timers, list) { | ||
458 | tmp_timer->count--; | ||
459 | /* check if timer expires */ | ||
460 | if (!tmp_timer->count) { | ||
461 | list_del(&tmp_timer->list); | ||
462 | tmp_timer->function(tmp_timer->data); | ||
463 | expired = 1; | ||
464 | } | ||
465 | } | ||
466 | |||
467 | if (list_empty(&active_timers)) { | ||
468 | otg_dbg("tick timer: disable 1ms int\n"); | ||
469 | *int_sts = *int_sts & ~OTGSC_1MSE; | ||
470 | } | ||
471 | return expired; | ||
472 | } | ||
473 | |||
474 | static void reset_otg(void) | ||
475 | { | ||
476 | u32 val; | ||
477 | int delay_time = 1000; | ||
478 | |||
479 | otg_dbg("reseting OTG controller ...\n"); | ||
480 | val = readl(the_transceiver->regs + CI_USBCMD); | ||
481 | writel(val | USBCMD_RST, the_transceiver->regs + CI_USBCMD); | ||
482 | do { | ||
483 | udelay(100); | ||
484 | if (!delay_time--) | ||
485 | otg_dbg("reset timeout\n"); | ||
486 | val = readl(the_transceiver->regs + CI_USBCMD); | ||
487 | val &= USBCMD_RST; | ||
488 | } while (val != 0); | ||
489 | otg_dbg("reset done.\n"); | ||
490 | } | ||
491 | |||
492 | static void set_host_mode(void) | ||
493 | { | ||
494 | u32 val; | ||
495 | |||
496 | reset_otg(); | ||
497 | val = readl(the_transceiver->regs + CI_USBMODE); | ||
498 | val = (val & (~USBMODE_CM)) | USBMODE_HOST; | ||
499 | writel(val, the_transceiver->regs + CI_USBMODE); | ||
500 | } | ||
501 | |||
502 | static void set_client_mode(void) | ||
503 | { | ||
504 | u32 val; | ||
505 | |||
506 | reset_otg(); | ||
507 | val = readl(the_transceiver->regs + CI_USBMODE); | ||
508 | val = (val & (~USBMODE_CM)) | USBMODE_DEVICE; | ||
509 | writel(val, the_transceiver->regs + CI_USBMODE); | ||
510 | } | ||
511 | |||
512 | static void init_hsm(void) | ||
513 | { | ||
514 | struct langwell_otg *langwell = the_transceiver; | ||
515 | u32 val32; | ||
516 | |||
517 | /* read OTGSC after reset */ | ||
518 | val32 = readl(langwell->regs + CI_OTGSC); | ||
519 | otg_dbg("%s: OTGSC init value = 0x%x\n", __func__, val32); | ||
520 | |||
521 | /* set init state */ | ||
522 | if (val32 & OTGSC_ID) { | ||
523 | langwell->hsm.id = 1; | ||
524 | langwell->otg.default_a = 0; | ||
525 | set_client_mode(); | ||
526 | langwell->otg.state = OTG_STATE_B_IDLE; | ||
527 | langwell_otg_drv_vbus(0); | ||
528 | } else { | ||
529 | langwell->hsm.id = 0; | ||
530 | langwell->otg.default_a = 1; | ||
531 | set_host_mode(); | ||
532 | langwell->otg.state = OTG_STATE_A_IDLE; | ||
533 | } | ||
534 | |||
535 | /* set session indicator */ | ||
536 | if (val32 & OTGSC_BSE) | ||
537 | langwell->hsm.b_sess_end = 1; | ||
538 | if (val32 & OTGSC_BSV) | ||
539 | langwell->hsm.b_sess_vld = 1; | ||
540 | if (val32 & OTGSC_ASV) | ||
541 | langwell->hsm.a_sess_vld = 1; | ||
542 | if (val32 & OTGSC_AVV) | ||
543 | langwell->hsm.a_vbus_vld = 1; | ||
544 | |||
545 | /* defautly power the bus */ | ||
546 | langwell->hsm.a_bus_req = 1; | ||
547 | langwell->hsm.a_bus_drop = 0; | ||
548 | /* defautly don't request bus as B device */ | ||
549 | langwell->hsm.b_bus_req = 0; | ||
550 | /* no system error */ | ||
551 | langwell->hsm.a_clr_err = 0; | ||
552 | } | ||
553 | |||
554 | static irqreturn_t otg_dummy_irq(int irq, void *_dev) | ||
555 | { | ||
556 | void __iomem *reg_base = _dev; | ||
557 | u32 val; | ||
558 | u32 int_mask = 0; | ||
559 | |||
560 | val = readl(reg_base + CI_USBMODE); | ||
561 | if ((val & USBMODE_CM) != USBMODE_DEVICE) | ||
562 | return IRQ_NONE; | ||
563 | |||
564 | val = readl(reg_base + CI_USBSTS); | ||
565 | int_mask = val & INTR_DUMMY_MASK; | ||
566 | |||
567 | if (int_mask == 0) | ||
568 | return IRQ_NONE; | ||
569 | |||
570 | /* clear hsm.b_conn here since host driver can't detect it | ||
571 | * otg_dummy_irq called means B-disconnect happened. | ||
572 | */ | ||
573 | if (the_transceiver->hsm.b_conn) { | ||
574 | the_transceiver->hsm.b_conn = 0; | ||
575 | if (spin_trylock(&the_transceiver->wq_lock)) { | ||
576 | queue_work(the_transceiver->qwork, | ||
577 | &the_transceiver->work); | ||
578 | spin_unlock(&the_transceiver->wq_lock); | ||
579 | } | ||
580 | } | ||
581 | /* Clear interrupts */ | ||
582 | writel(int_mask, reg_base + CI_USBSTS); | ||
583 | return IRQ_HANDLED; | ||
584 | } | ||
585 | |||
586 | static irqreturn_t otg_irq(int irq, void *_dev) | ||
587 | { | ||
588 | struct langwell_otg *langwell = _dev; | ||
589 | u32 int_sts, int_en; | ||
590 | u32 int_mask = 0; | ||
591 | int flag = 0; | ||
592 | |||
593 | int_sts = readl(langwell->regs + CI_OTGSC); | ||
594 | int_en = (int_sts & OTGSC_INTEN_MASK) >> 8; | ||
595 | int_mask = int_sts & int_en; | ||
596 | if (int_mask == 0) | ||
597 | return IRQ_NONE; | ||
598 | |||
599 | if (int_mask & OTGSC_IDIS) { | ||
600 | otg_dbg("%s: id change int\n", __func__); | ||
601 | langwell->hsm.id = (int_sts & OTGSC_ID) ? 1 : 0; | ||
602 | flag = 1; | ||
603 | } | ||
604 | if (int_mask & OTGSC_DPIS) { | ||
605 | otg_dbg("%s: data pulse int\n", __func__); | ||
606 | langwell->hsm.a_srp_det = (int_sts & OTGSC_DPS) ? 1 : 0; | ||
607 | flag = 1; | ||
608 | } | ||
609 | if (int_mask & OTGSC_BSEIS) { | ||
610 | otg_dbg("%s: b session end int\n", __func__); | ||
611 | langwell->hsm.b_sess_end = (int_sts & OTGSC_BSE) ? 1 : 0; | ||
612 | flag = 1; | ||
613 | } | ||
614 | if (int_mask & OTGSC_BSVIS) { | ||
615 | otg_dbg("%s: b session valid int\n", __func__); | ||
616 | langwell->hsm.b_sess_vld = (int_sts & OTGSC_BSV) ? 1 : 0; | ||
617 | flag = 1; | ||
618 | } | ||
619 | if (int_mask & OTGSC_ASVIS) { | ||
620 | otg_dbg("%s: a session valid int\n", __func__); | ||
621 | langwell->hsm.a_sess_vld = (int_sts & OTGSC_ASV) ? 1 : 0; | ||
622 | flag = 1; | ||
623 | } | ||
624 | if (int_mask & OTGSC_AVVIS) { | ||
625 | otg_dbg("%s: a vbus valid int\n", __func__); | ||
626 | langwell->hsm.a_vbus_vld = (int_sts & OTGSC_AVV) ? 1 : 0; | ||
627 | flag = 1; | ||
628 | } | ||
629 | |||
630 | if (int_mask & OTGSC_1MSS) { | ||
631 | /* need to schedule otg_work if any timer is expired */ | ||
632 | if (langwell_otg_tick_timer(&int_sts)) | ||
633 | flag = 1; | ||
634 | } | ||
635 | |||
636 | writel((int_sts & ~OTGSC_INTSTS_MASK) | int_mask, | ||
637 | langwell->regs + CI_OTGSC); | ||
638 | if (flag) | ||
639 | queue_work(langwell->qwork, &langwell->work); | ||
640 | |||
641 | return IRQ_HANDLED; | ||
642 | } | ||
643 | |||
644 | static void langwell_otg_work(struct work_struct *work) | ||
645 | { | ||
646 | struct langwell_otg *langwell = container_of(work, | ||
647 | struct langwell_otg, work); | ||
648 | int retval; | ||
649 | |||
650 | otg_dbg("%s: old state = %s\n", __func__, | ||
651 | state_string(langwell->otg.state)); | ||
652 | |||
653 | switch (langwell->otg.state) { | ||
654 | case OTG_STATE_UNDEFINED: | ||
655 | case OTG_STATE_B_IDLE: | ||
656 | if (!langwell->hsm.id) { | ||
657 | langwell_otg_del_timer(b_srp_res_tmr); | ||
658 | langwell->otg.default_a = 1; | ||
659 | langwell->hsm.a_srp_det = 0; | ||
660 | |||
661 | langwell_otg_chrg_vbus(0); | ||
662 | langwell_otg_drv_vbus(0); | ||
663 | |||
664 | set_host_mode(); | ||
665 | langwell->otg.state = OTG_STATE_A_IDLE; | ||
666 | queue_work(langwell->qwork, &langwell->work); | ||
667 | } else if (langwell->hsm.b_srp_res_tmout) { | ||
668 | langwell->hsm.b_srp_res_tmout = 0; | ||
669 | langwell->hsm.b_bus_req = 0; | ||
670 | langwell_otg_nsf_msg(6); | ||
671 | } else if (langwell->hsm.b_sess_vld) { | ||
672 | langwell_otg_del_timer(b_srp_res_tmr); | ||
673 | langwell->hsm.b_sess_end = 0; | ||
674 | langwell->hsm.a_bus_suspend = 0; | ||
675 | |||
676 | langwell_otg_chrg_vbus(0); | ||
677 | if (langwell->client_ops) { | ||
678 | langwell->client_ops->resume(langwell->pdev); | ||
679 | langwell->otg.state = OTG_STATE_B_PERIPHERAL; | ||
680 | } else | ||
681 | otg_dbg("client driver not loaded.\n"); | ||
682 | |||
683 | } else if (langwell->hsm.b_bus_req && | ||
684 | (langwell->hsm.b_sess_end)) { | ||
685 | /* workaround for b_se0_srp detection */ | ||
686 | retval = langwell_otg_check_se0_srp(0); | ||
687 | if (retval) { | ||
688 | langwell->hsm.b_bus_req = 0; | ||
689 | otg_dbg("LS is not SE0, try again later\n"); | ||
690 | } else { | ||
691 | /* Start SRP */ | ||
692 | langwell_otg_start_srp(&langwell->otg); | ||
693 | langwell_otg_add_timer(b_srp_res_tmr); | ||
694 | } | ||
695 | } | ||
696 | break; | ||
697 | case OTG_STATE_B_SRP_INIT: | ||
698 | if (!langwell->hsm.id) { | ||
699 | langwell->otg.default_a = 1; | ||
700 | langwell->hsm.a_srp_det = 0; | ||
701 | |||
702 | langwell_otg_drv_vbus(0); | ||
703 | langwell_otg_chrg_vbus(0); | ||
704 | |||
705 | langwell->otg.state = OTG_STATE_A_IDLE; | ||
706 | queue_work(langwell->qwork, &langwell->work); | ||
707 | } else if (langwell->hsm.b_sess_vld) { | ||
708 | langwell_otg_chrg_vbus(0); | ||
709 | if (langwell->client_ops) { | ||
710 | langwell->client_ops->resume(langwell->pdev); | ||
711 | langwell->otg.state = OTG_STATE_B_PERIPHERAL; | ||
712 | } else | ||
713 | otg_dbg("client driver not loaded.\n"); | ||
714 | } | ||
715 | break; | ||
716 | case OTG_STATE_B_PERIPHERAL: | ||
717 | if (!langwell->hsm.id) { | ||
718 | langwell->otg.default_a = 1; | ||
719 | langwell->hsm.a_srp_det = 0; | ||
720 | |||
721 | langwell_otg_drv_vbus(0); | ||
722 | langwell_otg_chrg_vbus(0); | ||
723 | set_host_mode(); | ||
724 | |||
725 | if (langwell->client_ops) { | ||
726 | langwell->client_ops->suspend(langwell->pdev, | ||
727 | PMSG_FREEZE); | ||
728 | } else | ||
729 | otg_dbg("client driver has been removed.\n"); | ||
730 | |||
731 | langwell->otg.state = OTG_STATE_A_IDLE; | ||
732 | queue_work(langwell->qwork, &langwell->work); | ||
733 | } else if (!langwell->hsm.b_sess_vld) { | ||
734 | langwell->hsm.b_hnp_enable = 0; | ||
735 | |||
736 | if (langwell->client_ops) { | ||
737 | langwell->client_ops->suspend(langwell->pdev, | ||
738 | PMSG_FREEZE); | ||
739 | } else | ||
740 | otg_dbg("client driver has been removed.\n"); | ||
741 | |||
742 | langwell->otg.state = OTG_STATE_B_IDLE; | ||
743 | } else if (langwell->hsm.b_bus_req && langwell->hsm.b_hnp_enable | ||
744 | && langwell->hsm.a_bus_suspend) { | ||
745 | |||
746 | if (langwell->client_ops) { | ||
747 | langwell->client_ops->suspend(langwell->pdev, | ||
748 | PMSG_FREEZE); | ||
749 | } else | ||
750 | otg_dbg("client driver has been removed.\n"); | ||
751 | |||
752 | langwell_otg_HAAR(1); | ||
753 | langwell->hsm.a_conn = 0; | ||
754 | |||
755 | if (langwell->host_ops) { | ||
756 | langwell->host_ops->probe(langwell->pdev, | ||
757 | langwell->host_ops->id_table); | ||
758 | langwell->otg.state = OTG_STATE_B_WAIT_ACON; | ||
759 | } else | ||
760 | otg_dbg("host driver not loaded.\n"); | ||
761 | |||
762 | langwell->hsm.a_bus_resume = 0; | ||
763 | langwell->hsm.b_ase0_brst_tmout = 0; | ||
764 | langwell_otg_add_timer(b_ase0_brst_tmr); | ||
765 | } | ||
766 | break; | ||
767 | |||
768 | case OTG_STATE_B_WAIT_ACON: | ||
769 | if (!langwell->hsm.id) { | ||
770 | langwell_otg_del_timer(b_ase0_brst_tmr); | ||
771 | langwell->otg.default_a = 1; | ||
772 | langwell->hsm.a_srp_det = 0; | ||
773 | |||
774 | langwell_otg_drv_vbus(0); | ||
775 | langwell_otg_chrg_vbus(0); | ||
776 | set_host_mode(); | ||
777 | |||
778 | langwell_otg_HAAR(0); | ||
779 | if (langwell->host_ops) | ||
780 | langwell->host_ops->remove(langwell->pdev); | ||
781 | else | ||
782 | otg_dbg("host driver has been removed.\n"); | ||
783 | langwell->otg.state = OTG_STATE_A_IDLE; | ||
784 | queue_work(langwell->qwork, &langwell->work); | ||
785 | } else if (!langwell->hsm.b_sess_vld) { | ||
786 | langwell_otg_del_timer(b_ase0_brst_tmr); | ||
787 | langwell->hsm.b_hnp_enable = 0; | ||
788 | langwell->hsm.b_bus_req = 0; | ||
789 | langwell_otg_chrg_vbus(0); | ||
790 | langwell_otg_HAAR(0); | ||
791 | |||
792 | if (langwell->host_ops) | ||
793 | langwell->host_ops->remove(langwell->pdev); | ||
794 | else | ||
795 | otg_dbg("host driver has been removed.\n"); | ||
796 | langwell->otg.state = OTG_STATE_B_IDLE; | ||
797 | } else if (langwell->hsm.a_conn) { | ||
798 | langwell_otg_del_timer(b_ase0_brst_tmr); | ||
799 | langwell_otg_HAAR(0); | ||
800 | langwell->otg.state = OTG_STATE_B_HOST; | ||
801 | queue_work(langwell->qwork, &langwell->work); | ||
802 | } else if (langwell->hsm.a_bus_resume || | ||
803 | langwell->hsm.b_ase0_brst_tmout) { | ||
804 | langwell_otg_del_timer(b_ase0_brst_tmr); | ||
805 | langwell_otg_HAAR(0); | ||
806 | langwell_otg_nsf_msg(7); | ||
807 | |||
808 | if (langwell->host_ops) | ||
809 | langwell->host_ops->remove(langwell->pdev); | ||
810 | else | ||
811 | otg_dbg("host driver has been removed.\n"); | ||
812 | |||
813 | langwell->hsm.a_bus_suspend = 0; | ||
814 | langwell->hsm.b_bus_req = 0; | ||
815 | |||
816 | if (langwell->client_ops) | ||
817 | langwell->client_ops->resume(langwell->pdev); | ||
818 | else | ||
819 | otg_dbg("client driver not loaded.\n"); | ||
820 | |||
821 | langwell->otg.state = OTG_STATE_B_PERIPHERAL; | ||
822 | } | ||
823 | break; | ||
824 | |||
825 | case OTG_STATE_B_HOST: | ||
826 | if (!langwell->hsm.id) { | ||
827 | langwell->otg.default_a = 1; | ||
828 | langwell->hsm.a_srp_det = 0; | ||
829 | |||
830 | langwell_otg_drv_vbus(0); | ||
831 | langwell_otg_chrg_vbus(0); | ||
832 | set_host_mode(); | ||
833 | if (langwell->host_ops) | ||
834 | langwell->host_ops->remove(langwell->pdev); | ||
835 | else | ||
836 | otg_dbg("host driver has been removed.\n"); | ||
837 | langwell->otg.state = OTG_STATE_A_IDLE; | ||
838 | queue_work(langwell->qwork, &langwell->work); | ||
839 | } else if (!langwell->hsm.b_sess_vld) { | ||
840 | langwell->hsm.b_hnp_enable = 0; | ||
841 | langwell->hsm.b_bus_req = 0; | ||
842 | langwell_otg_chrg_vbus(0); | ||
843 | if (langwell->host_ops) | ||
844 | langwell->host_ops->remove(langwell->pdev); | ||
845 | else | ||
846 | otg_dbg("host driver has been removed.\n"); | ||
847 | langwell->otg.state = OTG_STATE_B_IDLE; | ||
848 | } else if ((!langwell->hsm.b_bus_req) || | ||
849 | (!langwell->hsm.a_conn)) { | ||
850 | langwell->hsm.b_bus_req = 0; | ||
851 | langwell_otg_loc_sof(0); | ||
852 | if (langwell->host_ops) | ||
853 | langwell->host_ops->remove(langwell->pdev); | ||
854 | else | ||
855 | otg_dbg("host driver has been removed.\n"); | ||
856 | |||
857 | langwell->hsm.a_bus_suspend = 0; | ||
858 | |||
859 | if (langwell->client_ops) | ||
860 | langwell->client_ops->resume(langwell->pdev); | ||
861 | else | ||
862 | otg_dbg("client driver not loaded.\n"); | ||
863 | |||
864 | langwell->otg.state = OTG_STATE_B_PERIPHERAL; | ||
865 | } | ||
866 | break; | ||
867 | |||
868 | case OTG_STATE_A_IDLE: | ||
869 | langwell->otg.default_a = 1; | ||
870 | if (langwell->hsm.id) { | ||
871 | langwell->otg.default_a = 0; | ||
872 | langwell->hsm.b_bus_req = 0; | ||
873 | langwell_otg_drv_vbus(0); | ||
874 | langwell_otg_chrg_vbus(0); | ||
875 | |||
876 | langwell->otg.state = OTG_STATE_B_IDLE; | ||
877 | queue_work(langwell->qwork, &langwell->work); | ||
878 | } else if (langwell->hsm.a_sess_vld) { | ||
879 | langwell_otg_drv_vbus(1); | ||
880 | langwell->hsm.a_srp_det = 1; | ||
881 | langwell->hsm.a_wait_vrise_tmout = 0; | ||
882 | langwell_otg_add_timer(a_wait_vrise_tmr); | ||
883 | langwell->otg.state = OTG_STATE_A_WAIT_VRISE; | ||
884 | queue_work(langwell->qwork, &langwell->work); | ||
885 | } else if (!langwell->hsm.a_bus_drop && | ||
886 | (langwell->hsm.a_srp_det || langwell->hsm.a_bus_req)) { | ||
887 | langwell_otg_drv_vbus(1); | ||
888 | langwell->hsm.a_wait_vrise_tmout = 0; | ||
889 | langwell_otg_add_timer(a_wait_vrise_tmr); | ||
890 | langwell->otg.state = OTG_STATE_A_WAIT_VRISE; | ||
891 | queue_work(langwell->qwork, &langwell->work); | ||
892 | } | ||
893 | break; | ||
894 | case OTG_STATE_A_WAIT_VRISE: | ||
895 | if (langwell->hsm.id) { | ||
896 | langwell_otg_del_timer(a_wait_vrise_tmr); | ||
897 | langwell->hsm.b_bus_req = 0; | ||
898 | langwell->otg.default_a = 0; | ||
899 | langwell_otg_drv_vbus(0); | ||
900 | langwell->otg.state = OTG_STATE_B_IDLE; | ||
901 | } else if (langwell->hsm.a_vbus_vld) { | ||
902 | langwell_otg_del_timer(a_wait_vrise_tmr); | ||
903 | if (langwell->host_ops) | ||
904 | langwell->host_ops->probe(langwell->pdev, | ||
905 | langwell->host_ops->id_table); | ||
906 | else | ||
907 | otg_dbg("host driver not loaded.\n"); | ||
908 | langwell->hsm.b_conn = 0; | ||
909 | langwell->hsm.a_set_b_hnp_en = 0; | ||
910 | langwell->hsm.a_wait_bcon_tmout = 0; | ||
911 | langwell_otg_add_timer(a_wait_bcon_tmr); | ||
912 | langwell->otg.state = OTG_STATE_A_WAIT_BCON; | ||
913 | } else if (langwell->hsm.a_wait_vrise_tmout) { | ||
914 | if (langwell->hsm.a_vbus_vld) { | ||
915 | if (langwell->host_ops) | ||
916 | langwell->host_ops->probe( | ||
917 | langwell->pdev, | ||
918 | langwell->host_ops->id_table); | ||
919 | else | ||
920 | otg_dbg("host driver not loaded.\n"); | ||
921 | langwell->hsm.b_conn = 0; | ||
922 | langwell->hsm.a_set_b_hnp_en = 0; | ||
923 | langwell->hsm.a_wait_bcon_tmout = 0; | ||
924 | langwell_otg_add_timer(a_wait_bcon_tmr); | ||
925 | langwell->otg.state = OTG_STATE_A_WAIT_BCON; | ||
926 | } else { | ||
927 | langwell_otg_drv_vbus(0); | ||
928 | langwell->otg.state = OTG_STATE_A_VBUS_ERR; | ||
929 | } | ||
930 | } | ||
931 | break; | ||
932 | case OTG_STATE_A_WAIT_BCON: | ||
933 | if (langwell->hsm.id) { | ||
934 | langwell_otg_del_timer(a_wait_bcon_tmr); | ||
935 | |||
936 | langwell->otg.default_a = 0; | ||
937 | langwell->hsm.b_bus_req = 0; | ||
938 | if (langwell->host_ops) | ||
939 | langwell->host_ops->remove(langwell->pdev); | ||
940 | else | ||
941 | otg_dbg("host driver has been removed.\n"); | ||
942 | langwell_otg_drv_vbus(0); | ||
943 | langwell->otg.state = OTG_STATE_B_IDLE; | ||
944 | queue_work(langwell->qwork, &langwell->work); | ||
945 | } else if (!langwell->hsm.a_vbus_vld) { | ||
946 | langwell_otg_del_timer(a_wait_bcon_tmr); | ||
947 | |||
948 | if (langwell->host_ops) | ||
949 | langwell->host_ops->remove(langwell->pdev); | ||
950 | else | ||
951 | otg_dbg("host driver has been removed.\n"); | ||
952 | langwell_otg_drv_vbus(0); | ||
953 | langwell->otg.state = OTG_STATE_A_VBUS_ERR; | ||
954 | } else if (langwell->hsm.a_bus_drop || | ||
955 | (langwell->hsm.a_wait_bcon_tmout && | ||
956 | !langwell->hsm.a_bus_req)) { | ||
957 | langwell_otg_del_timer(a_wait_bcon_tmr); | ||
958 | |||
959 | if (langwell->host_ops) | ||
960 | langwell->host_ops->remove(langwell->pdev); | ||
961 | else | ||
962 | otg_dbg("host driver has been removed.\n"); | ||
963 | langwell_otg_drv_vbus(0); | ||
964 | langwell->otg.state = OTG_STATE_A_WAIT_VFALL; | ||
965 | } else if (langwell->hsm.b_conn) { | ||
966 | langwell_otg_del_timer(a_wait_bcon_tmr); | ||
967 | |||
968 | langwell->hsm.a_suspend_req = 0; | ||
969 | langwell->otg.state = OTG_STATE_A_HOST; | ||
970 | if (!langwell->hsm.a_bus_req && | ||
971 | langwell->hsm.a_set_b_hnp_en) { | ||
972 | /* It is not safe enough to do a fast | ||
973 | * transistion from A_WAIT_BCON to | ||
974 | * A_SUSPEND */ | ||
975 | msleep(10000); | ||
976 | if (langwell->hsm.a_bus_req) | ||
977 | break; | ||
978 | |||
979 | if (request_irq(langwell->pdev->irq, | ||
980 | otg_dummy_irq, IRQF_SHARED, | ||
981 | driver_name, langwell->regs) != 0) { | ||
982 | otg_dbg("request interrupt %d fail\n", | ||
983 | langwell->pdev->irq); | ||
984 | } | ||
985 | |||
986 | langwell_otg_HABA(1); | ||
987 | langwell->hsm.b_bus_resume = 0; | ||
988 | langwell->hsm.a_aidl_bdis_tmout = 0; | ||
989 | langwell_otg_add_timer(a_aidl_bdis_tmr); | ||
990 | |||
991 | langwell_otg_loc_sof(0); | ||
992 | langwell->otg.state = OTG_STATE_A_SUSPEND; | ||
993 | } else if (!langwell->hsm.a_bus_req && | ||
994 | !langwell->hsm.a_set_b_hnp_en) { | ||
995 | struct pci_dev *pdev = langwell->pdev; | ||
996 | if (langwell->host_ops) | ||
997 | langwell->host_ops->remove(pdev); | ||
998 | else | ||
999 | otg_dbg("host driver removed.\n"); | ||
1000 | langwell_otg_drv_vbus(0); | ||
1001 | langwell->otg.state = OTG_STATE_A_WAIT_VFALL; | ||
1002 | } | ||
1003 | } | ||
1004 | break; | ||
1005 | case OTG_STATE_A_HOST: | ||
1006 | if (langwell->hsm.id) { | ||
1007 | langwell->otg.default_a = 0; | ||
1008 | langwell->hsm.b_bus_req = 0; | ||
1009 | if (langwell->host_ops) | ||
1010 | langwell->host_ops->remove(langwell->pdev); | ||
1011 | else | ||
1012 | otg_dbg("host driver has been removed.\n"); | ||
1013 | langwell_otg_drv_vbus(0); | ||
1014 | langwell->otg.state = OTG_STATE_B_IDLE; | ||
1015 | queue_work(langwell->qwork, &langwell->work); | ||
1016 | } else if (langwell->hsm.a_bus_drop || | ||
1017 | (!langwell->hsm.a_set_b_hnp_en && !langwell->hsm.a_bus_req)) { | ||
1018 | if (langwell->host_ops) | ||
1019 | langwell->host_ops->remove(langwell->pdev); | ||
1020 | else | ||
1021 | otg_dbg("host driver has been removed.\n"); | ||
1022 | langwell_otg_drv_vbus(0); | ||
1023 | langwell->otg.state = OTG_STATE_A_WAIT_VFALL; | ||
1024 | } else if (!langwell->hsm.a_vbus_vld) { | ||
1025 | if (langwell->host_ops) | ||
1026 | langwell->host_ops->remove(langwell->pdev); | ||
1027 | else | ||
1028 | otg_dbg("host driver has been removed.\n"); | ||
1029 | langwell_otg_drv_vbus(0); | ||
1030 | langwell->otg.state = OTG_STATE_A_VBUS_ERR; | ||
1031 | } else if (langwell->hsm.a_set_b_hnp_en | ||
1032 | && !langwell->hsm.a_bus_req) { | ||
1033 | /* Set HABA to enable hardware assistance to signal | ||
1034 | * A-connect after receiver B-disconnect. Hardware | ||
1035 | * will then set client mode and enable URE, SLE and | ||
1036 | * PCE after the assistance. otg_dummy_irq is used to | ||
1037 | * clean these ints when client driver is not resumed. | ||
1038 | */ | ||
1039 | if (request_irq(langwell->pdev->irq, | ||
1040 | otg_dummy_irq, IRQF_SHARED, driver_name, | ||
1041 | langwell->regs) != 0) { | ||
1042 | otg_dbg("request interrupt %d failed\n", | ||
1043 | langwell->pdev->irq); | ||
1044 | } | ||
1045 | |||
1046 | /* set HABA */ | ||
1047 | langwell_otg_HABA(1); | ||
1048 | langwell->hsm.b_bus_resume = 0; | ||
1049 | langwell->hsm.a_aidl_bdis_tmout = 0; | ||
1050 | langwell_otg_add_timer(a_aidl_bdis_tmr); | ||
1051 | langwell_otg_loc_sof(0); | ||
1052 | langwell->otg.state = OTG_STATE_A_SUSPEND; | ||
1053 | } else if (!langwell->hsm.b_conn || !langwell->hsm.a_bus_req) { | ||
1054 | langwell->hsm.a_wait_bcon_tmout = 0; | ||
1055 | langwell->hsm.a_set_b_hnp_en = 0; | ||
1056 | langwell_otg_add_timer(a_wait_bcon_tmr); | ||
1057 | langwell->otg.state = OTG_STATE_A_WAIT_BCON; | ||
1058 | } | ||
1059 | break; | ||
1060 | case OTG_STATE_A_SUSPEND: | ||
1061 | if (langwell->hsm.id) { | ||
1062 | langwell_otg_del_timer(a_aidl_bdis_tmr); | ||
1063 | langwell_otg_HABA(0); | ||
1064 | free_irq(langwell->pdev->irq, langwell->regs); | ||
1065 | langwell->otg.default_a = 0; | ||
1066 | langwell->hsm.b_bus_req = 0; | ||
1067 | if (langwell->host_ops) | ||
1068 | langwell->host_ops->remove(langwell->pdev); | ||
1069 | else | ||
1070 | otg_dbg("host driver has been removed.\n"); | ||
1071 | langwell_otg_drv_vbus(0); | ||
1072 | langwell->otg.state = OTG_STATE_B_IDLE; | ||
1073 | queue_work(langwell->qwork, &langwell->work); | ||
1074 | } else if (langwell->hsm.a_bus_req || | ||
1075 | langwell->hsm.b_bus_resume) { | ||
1076 | langwell_otg_del_timer(a_aidl_bdis_tmr); | ||
1077 | langwell_otg_HABA(0); | ||
1078 | free_irq(langwell->pdev->irq, langwell->regs); | ||
1079 | langwell->hsm.a_suspend_req = 0; | ||
1080 | langwell_otg_loc_sof(1); | ||
1081 | langwell->otg.state = OTG_STATE_A_HOST; | ||
1082 | } else if (langwell->hsm.a_aidl_bdis_tmout || | ||
1083 | langwell->hsm.a_bus_drop) { | ||
1084 | langwell_otg_del_timer(a_aidl_bdis_tmr); | ||
1085 | langwell_otg_HABA(0); | ||
1086 | free_irq(langwell->pdev->irq, langwell->regs); | ||
1087 | if (langwell->host_ops) | ||
1088 | langwell->host_ops->remove(langwell->pdev); | ||
1089 | else | ||
1090 | otg_dbg("host driver has been removed.\n"); | ||
1091 | langwell_otg_drv_vbus(0); | ||
1092 | langwell->otg.state = OTG_STATE_A_WAIT_VFALL; | ||
1093 | } else if (!langwell->hsm.b_conn && | ||
1094 | langwell->hsm.a_set_b_hnp_en) { | ||
1095 | langwell_otg_del_timer(a_aidl_bdis_tmr); | ||
1096 | langwell_otg_HABA(0); | ||
1097 | free_irq(langwell->pdev->irq, langwell->regs); | ||
1098 | |||
1099 | if (langwell->host_ops) | ||
1100 | langwell->host_ops->remove(langwell->pdev); | ||
1101 | else | ||
1102 | otg_dbg("host driver has been removed.\n"); | ||
1103 | |||
1104 | langwell->hsm.b_bus_suspend = 0; | ||
1105 | langwell->hsm.b_bus_suspend_vld = 0; | ||
1106 | langwell->hsm.b_bus_suspend_tmout = 0; | ||
1107 | |||
1108 | /* msleep(200); */ | ||
1109 | if (langwell->client_ops) | ||
1110 | langwell->client_ops->resume(langwell->pdev); | ||
1111 | else | ||
1112 | otg_dbg("client driver not loaded.\n"); | ||
1113 | |||
1114 | langwell_otg_add_timer(b_bus_suspend_tmr); | ||
1115 | langwell->otg.state = OTG_STATE_A_PERIPHERAL; | ||
1116 | break; | ||
1117 | } else if (!langwell->hsm.a_vbus_vld) { | ||
1118 | langwell_otg_del_timer(a_aidl_bdis_tmr); | ||
1119 | langwell_otg_HABA(0); | ||
1120 | free_irq(langwell->pdev->irq, langwell->regs); | ||
1121 | if (langwell->host_ops) | ||
1122 | langwell->host_ops->remove(langwell->pdev); | ||
1123 | else | ||
1124 | otg_dbg("host driver has been removed.\n"); | ||
1125 | langwell_otg_drv_vbus(0); | ||
1126 | langwell->otg.state = OTG_STATE_A_VBUS_ERR; | ||
1127 | } | ||
1128 | break; | ||
1129 | case OTG_STATE_A_PERIPHERAL: | ||
1130 | if (langwell->hsm.id) { | ||
1131 | langwell_otg_del_timer(b_bus_suspend_tmr); | ||
1132 | langwell->otg.default_a = 0; | ||
1133 | langwell->hsm.b_bus_req = 0; | ||
1134 | if (langwell->client_ops) | ||
1135 | langwell->client_ops->suspend(langwell->pdev, | ||
1136 | PMSG_FREEZE); | ||
1137 | else | ||
1138 | otg_dbg("client driver has been removed.\n"); | ||
1139 | langwell_otg_drv_vbus(0); | ||
1140 | langwell->otg.state = OTG_STATE_B_IDLE; | ||
1141 | queue_work(langwell->qwork, &langwell->work); | ||
1142 | } else if (!langwell->hsm.a_vbus_vld) { | ||
1143 | langwell_otg_del_timer(b_bus_suspend_tmr); | ||
1144 | if (langwell->client_ops) | ||
1145 | langwell->client_ops->suspend(langwell->pdev, | ||
1146 | PMSG_FREEZE); | ||
1147 | else | ||
1148 | otg_dbg("client driver has been removed.\n"); | ||
1149 | langwell_otg_drv_vbus(0); | ||
1150 | langwell->otg.state = OTG_STATE_A_VBUS_ERR; | ||
1151 | } else if (langwell->hsm.a_bus_drop) { | ||
1152 | langwell_otg_del_timer(b_bus_suspend_tmr); | ||
1153 | if (langwell->client_ops) | ||
1154 | langwell->client_ops->suspend(langwell->pdev, | ||
1155 | PMSG_FREEZE); | ||
1156 | else | ||
1157 | otg_dbg("client driver has been removed.\n"); | ||
1158 | langwell_otg_drv_vbus(0); | ||
1159 | langwell->otg.state = OTG_STATE_A_WAIT_VFALL; | ||
1160 | } else if (langwell->hsm.b_bus_suspend) { | ||
1161 | langwell_otg_del_timer(b_bus_suspend_tmr); | ||
1162 | if (langwell->client_ops) | ||
1163 | langwell->client_ops->suspend(langwell->pdev, | ||
1164 | PMSG_FREEZE); | ||
1165 | else | ||
1166 | otg_dbg("client driver has been removed.\n"); | ||
1167 | |||
1168 | if (langwell->host_ops) | ||
1169 | langwell->host_ops->probe(langwell->pdev, | ||
1170 | langwell->host_ops->id_table); | ||
1171 | else | ||
1172 | otg_dbg("host driver not loaded.\n"); | ||
1173 | langwell->hsm.a_set_b_hnp_en = 0; | ||
1174 | langwell->hsm.a_wait_bcon_tmout = 0; | ||
1175 | langwell_otg_add_timer(a_wait_bcon_tmr); | ||
1176 | langwell->otg.state = OTG_STATE_A_WAIT_BCON; | ||
1177 | } else if (langwell->hsm.b_bus_suspend_tmout) { | ||
1178 | u32 val; | ||
1179 | val = readl(langwell->regs + CI_PORTSC1); | ||
1180 | if (!(val & PORTSC_SUSP)) | ||
1181 | break; | ||
1182 | if (langwell->client_ops) | ||
1183 | langwell->client_ops->suspend(langwell->pdev, | ||
1184 | PMSG_FREEZE); | ||
1185 | else | ||
1186 | otg_dbg("client driver has been removed.\n"); | ||
1187 | if (langwell->host_ops) | ||
1188 | langwell->host_ops->probe(langwell->pdev, | ||
1189 | langwell->host_ops->id_table); | ||
1190 | else | ||
1191 | otg_dbg("host driver not loaded.\n"); | ||
1192 | langwell->hsm.a_set_b_hnp_en = 0; | ||
1193 | langwell->hsm.a_wait_bcon_tmout = 0; | ||
1194 | langwell_otg_add_timer(a_wait_bcon_tmr); | ||
1195 | langwell->otg.state = OTG_STATE_A_WAIT_BCON; | ||
1196 | } | ||
1197 | break; | ||
1198 | case OTG_STATE_A_VBUS_ERR: | ||
1199 | if (langwell->hsm.id) { | ||
1200 | langwell->otg.default_a = 0; | ||
1201 | langwell->hsm.a_clr_err = 0; | ||
1202 | langwell->hsm.a_srp_det = 0; | ||
1203 | langwell->otg.state = OTG_STATE_B_IDLE; | ||
1204 | queue_work(langwell->qwork, &langwell->work); | ||
1205 | } else if (langwell->hsm.a_clr_err) { | ||
1206 | langwell->hsm.a_clr_err = 0; | ||
1207 | langwell->hsm.a_srp_det = 0; | ||
1208 | reset_otg(); | ||
1209 | init_hsm(); | ||
1210 | if (langwell->otg.state == OTG_STATE_A_IDLE) | ||
1211 | queue_work(langwell->qwork, &langwell->work); | ||
1212 | } | ||
1213 | break; | ||
1214 | case OTG_STATE_A_WAIT_VFALL: | ||
1215 | if (langwell->hsm.id) { | ||
1216 | langwell->otg.default_a = 0; | ||
1217 | langwell->otg.state = OTG_STATE_B_IDLE; | ||
1218 | queue_work(langwell->qwork, &langwell->work); | ||
1219 | } else if (langwell->hsm.a_bus_req) { | ||
1220 | langwell_otg_drv_vbus(1); | ||
1221 | langwell->hsm.a_wait_vrise_tmout = 0; | ||
1222 | langwell_otg_add_timer(a_wait_vrise_tmr); | ||
1223 | langwell->otg.state = OTG_STATE_A_WAIT_VRISE; | ||
1224 | } else if (!langwell->hsm.a_sess_vld) { | ||
1225 | langwell->hsm.a_srp_det = 0; | ||
1226 | langwell_otg_drv_vbus(0); | ||
1227 | set_host_mode(); | ||
1228 | langwell->otg.state = OTG_STATE_A_IDLE; | ||
1229 | } | ||
1230 | break; | ||
1231 | default: | ||
1232 | ; | ||
1233 | } | ||
1234 | |||
1235 | otg_dbg("%s: new state = %s\n", __func__, | ||
1236 | state_string(langwell->otg.state)); | ||
1237 | } | ||
1238 | |||
1239 | static ssize_t | ||
1240 | show_registers(struct device *_dev, struct device_attribute *attr, char *buf) | ||
1241 | { | ||
1242 | struct langwell_otg *langwell; | ||
1243 | char *next; | ||
1244 | unsigned size; | ||
1245 | unsigned t; | ||
1246 | |||
1247 | langwell = the_transceiver; | ||
1248 | next = buf; | ||
1249 | size = PAGE_SIZE; | ||
1250 | |||
1251 | t = scnprintf(next, size, | ||
1252 | "\n" | ||
1253 | "USBCMD = 0x%08x \n" | ||
1254 | "USBSTS = 0x%08x \n" | ||
1255 | "USBINTR = 0x%08x \n" | ||
1256 | "ASYNCLISTADDR = 0x%08x \n" | ||
1257 | "PORTSC1 = 0x%08x \n" | ||
1258 | "HOSTPC1 = 0x%08x \n" | ||
1259 | "OTGSC = 0x%08x \n" | ||
1260 | "USBMODE = 0x%08x \n", | ||
1261 | readl(langwell->regs + 0x30), | ||
1262 | readl(langwell->regs + 0x34), | ||
1263 | readl(langwell->regs + 0x38), | ||
1264 | readl(langwell->regs + 0x48), | ||
1265 | readl(langwell->regs + 0x74), | ||
1266 | readl(langwell->regs + 0xb4), | ||
1267 | readl(langwell->regs + 0xf4), | ||
1268 | readl(langwell->regs + 0xf8) | ||
1269 | ); | ||
1270 | size -= t; | ||
1271 | next += t; | ||
1272 | |||
1273 | return PAGE_SIZE - size; | ||
1274 | } | ||
1275 | static DEVICE_ATTR(registers, S_IRUGO, show_registers, NULL); | ||
1276 | |||
1277 | static ssize_t | ||
1278 | show_hsm(struct device *_dev, struct device_attribute *attr, char *buf) | ||
1279 | { | ||
1280 | struct langwell_otg *langwell; | ||
1281 | char *next; | ||
1282 | unsigned size; | ||
1283 | unsigned t; | ||
1284 | |||
1285 | langwell = the_transceiver; | ||
1286 | next = buf; | ||
1287 | size = PAGE_SIZE; | ||
1288 | |||
1289 | t = scnprintf(next, size, | ||
1290 | "\n" | ||
1291 | "current state = %s\n" | ||
1292 | "a_bus_resume = \t%d\n" | ||
1293 | "a_bus_suspend = \t%d\n" | ||
1294 | "a_conn = \t%d\n" | ||
1295 | "a_sess_vld = \t%d\n" | ||
1296 | "a_srp_det = \t%d\n" | ||
1297 | "a_vbus_vld = \t%d\n" | ||
1298 | "b_bus_resume = \t%d\n" | ||
1299 | "b_bus_suspend = \t%d\n" | ||
1300 | "b_conn = \t%d\n" | ||
1301 | "b_se0_srp = \t%d\n" | ||
1302 | "b_sess_end = \t%d\n" | ||
1303 | "b_sess_vld = \t%d\n" | ||
1304 | "id = \t%d\n" | ||
1305 | "a_set_b_hnp_en = \t%d\n" | ||
1306 | "b_srp_done = \t%d\n" | ||
1307 | "b_hnp_enable = \t%d\n" | ||
1308 | "a_wait_vrise_tmout = \t%d\n" | ||
1309 | "a_wait_bcon_tmout = \t%d\n" | ||
1310 | "a_aidl_bdis_tmout = \t%d\n" | ||
1311 | "b_ase0_brst_tmout = \t%d\n" | ||
1312 | "a_bus_drop = \t%d\n" | ||
1313 | "a_bus_req = \t%d\n" | ||
1314 | "a_clr_err = \t%d\n" | ||
1315 | "a_suspend_req = \t%d\n" | ||
1316 | "b_bus_req = \t%d\n" | ||
1317 | "b_bus_suspend_tmout = \t%d\n" | ||
1318 | "b_bus_suspend_vld = \t%d\n", | ||
1319 | state_string(langwell->otg.state), | ||
1320 | langwell->hsm.a_bus_resume, | ||
1321 | langwell->hsm.a_bus_suspend, | ||
1322 | langwell->hsm.a_conn, | ||
1323 | langwell->hsm.a_sess_vld, | ||
1324 | langwell->hsm.a_srp_det, | ||
1325 | langwell->hsm.a_vbus_vld, | ||
1326 | langwell->hsm.b_bus_resume, | ||
1327 | langwell->hsm.b_bus_suspend, | ||
1328 | langwell->hsm.b_conn, | ||
1329 | langwell->hsm.b_se0_srp, | ||
1330 | langwell->hsm.b_sess_end, | ||
1331 | langwell->hsm.b_sess_vld, | ||
1332 | langwell->hsm.id, | ||
1333 | langwell->hsm.a_set_b_hnp_en, | ||
1334 | langwell->hsm.b_srp_done, | ||
1335 | langwell->hsm.b_hnp_enable, | ||
1336 | langwell->hsm.a_wait_vrise_tmout, | ||
1337 | langwell->hsm.a_wait_bcon_tmout, | ||
1338 | langwell->hsm.a_aidl_bdis_tmout, | ||
1339 | langwell->hsm.b_ase0_brst_tmout, | ||
1340 | langwell->hsm.a_bus_drop, | ||
1341 | langwell->hsm.a_bus_req, | ||
1342 | langwell->hsm.a_clr_err, | ||
1343 | langwell->hsm.a_suspend_req, | ||
1344 | langwell->hsm.b_bus_req, | ||
1345 | langwell->hsm.b_bus_suspend_tmout, | ||
1346 | langwell->hsm.b_bus_suspend_vld | ||
1347 | ); | ||
1348 | size -= t; | ||
1349 | next += t; | ||
1350 | |||
1351 | return PAGE_SIZE - size; | ||
1352 | } | ||
1353 | static DEVICE_ATTR(hsm, S_IRUGO, show_hsm, NULL); | ||
1354 | |||
1355 | static ssize_t | ||
1356 | get_a_bus_req(struct device *dev, struct device_attribute *attr, char *buf) | ||
1357 | { | ||
1358 | struct langwell_otg *langwell; | ||
1359 | char *next; | ||
1360 | unsigned size; | ||
1361 | unsigned t; | ||
1362 | |||
1363 | langwell = the_transceiver; | ||
1364 | next = buf; | ||
1365 | size = PAGE_SIZE; | ||
1366 | |||
1367 | t = scnprintf(next, size, "%d", langwell->hsm.a_bus_req); | ||
1368 | size -= t; | ||
1369 | next += t; | ||
1370 | |||
1371 | return PAGE_SIZE - size; | ||
1372 | } | ||
1373 | |||
1374 | static ssize_t | ||
1375 | set_a_bus_req(struct device *dev, struct device_attribute *attr, | ||
1376 | const char *buf, size_t count) | ||
1377 | { | ||
1378 | struct langwell_otg *langwell; | ||
1379 | langwell = the_transceiver; | ||
1380 | if (!langwell->otg.default_a) | ||
1381 | return -1; | ||
1382 | if (count > 2) | ||
1383 | return -1; | ||
1384 | |||
1385 | if (buf[0] == '0') { | ||
1386 | langwell->hsm.a_bus_req = 0; | ||
1387 | otg_dbg("a_bus_req = 0\n"); | ||
1388 | } else if (buf[0] == '1') { | ||
1389 | /* If a_bus_drop is TRUE, a_bus_req can't be set */ | ||
1390 | if (langwell->hsm.a_bus_drop) | ||
1391 | return -1; | ||
1392 | langwell->hsm.a_bus_req = 1; | ||
1393 | otg_dbg("a_bus_req = 1\n"); | ||
1394 | } | ||
1395 | if (spin_trylock(&langwell->wq_lock)) { | ||
1396 | queue_work(langwell->qwork, &langwell->work); | ||
1397 | spin_unlock(&langwell->wq_lock); | ||
1398 | } | ||
1399 | return count; | ||
1400 | } | ||
1401 | static DEVICE_ATTR(a_bus_req, S_IRUGO | S_IWUGO, get_a_bus_req, set_a_bus_req); | ||
1402 | |||
1403 | static ssize_t | ||
1404 | get_a_bus_drop(struct device *dev, struct device_attribute *attr, char *buf) | ||
1405 | { | ||
1406 | struct langwell_otg *langwell; | ||
1407 | char *next; | ||
1408 | unsigned size; | ||
1409 | unsigned t; | ||
1410 | |||
1411 | langwell = the_transceiver; | ||
1412 | next = buf; | ||
1413 | size = PAGE_SIZE; | ||
1414 | |||
1415 | t = scnprintf(next, size, "%d", langwell->hsm.a_bus_drop); | ||
1416 | size -= t; | ||
1417 | next += t; | ||
1418 | |||
1419 | return PAGE_SIZE - size; | ||
1420 | } | ||
1421 | |||
1422 | static ssize_t | ||
1423 | set_a_bus_drop(struct device *dev, struct device_attribute *attr, | ||
1424 | const char *buf, size_t count) | ||
1425 | { | ||
1426 | struct langwell_otg *langwell; | ||
1427 | langwell = the_transceiver; | ||
1428 | if (!langwell->otg.default_a) | ||
1429 | return -1; | ||
1430 | if (count > 2) | ||
1431 | return -1; | ||
1432 | |||
1433 | if (buf[0] == '0') { | ||
1434 | langwell->hsm.a_bus_drop = 0; | ||
1435 | otg_dbg("a_bus_drop = 0\n"); | ||
1436 | } else if (buf[0] == '1') { | ||
1437 | langwell->hsm.a_bus_drop = 1; | ||
1438 | langwell->hsm.a_bus_req = 0; | ||
1439 | otg_dbg("a_bus_drop = 1, then a_bus_req = 0\n"); | ||
1440 | } | ||
1441 | if (spin_trylock(&langwell->wq_lock)) { | ||
1442 | queue_work(langwell->qwork, &langwell->work); | ||
1443 | spin_unlock(&langwell->wq_lock); | ||
1444 | } | ||
1445 | return count; | ||
1446 | } | ||
1447 | static DEVICE_ATTR(a_bus_drop, S_IRUGO | S_IWUGO, | ||
1448 | get_a_bus_drop, set_a_bus_drop); | ||
1449 | |||
1450 | static ssize_t | ||
1451 | get_b_bus_req(struct device *dev, struct device_attribute *attr, char *buf) | ||
1452 | { | ||
1453 | struct langwell_otg *langwell; | ||
1454 | char *next; | ||
1455 | unsigned size; | ||
1456 | unsigned t; | ||
1457 | |||
1458 | langwell = the_transceiver; | ||
1459 | next = buf; | ||
1460 | size = PAGE_SIZE; | ||
1461 | |||
1462 | t = scnprintf(next, size, "%d", langwell->hsm.b_bus_req); | ||
1463 | size -= t; | ||
1464 | next += t; | ||
1465 | |||
1466 | return PAGE_SIZE - size; | ||
1467 | } | ||
1468 | |||
1469 | static ssize_t | ||
1470 | set_b_bus_req(struct device *dev, struct device_attribute *attr, | ||
1471 | const char *buf, size_t count) | ||
1472 | { | ||
1473 | struct langwell_otg *langwell; | ||
1474 | langwell = the_transceiver; | ||
1475 | |||
1476 | if (langwell->otg.default_a) | ||
1477 | return -1; | ||
1478 | |||
1479 | if (count > 2) | ||
1480 | return -1; | ||
1481 | |||
1482 | if (buf[0] == '0') { | ||
1483 | langwell->hsm.b_bus_req = 0; | ||
1484 | otg_dbg("b_bus_req = 0\n"); | ||
1485 | } else if (buf[0] == '1') { | ||
1486 | langwell->hsm.b_bus_req = 1; | ||
1487 | otg_dbg("b_bus_req = 1\n"); | ||
1488 | } | ||
1489 | if (spin_trylock(&langwell->wq_lock)) { | ||
1490 | queue_work(langwell->qwork, &langwell->work); | ||
1491 | spin_unlock(&langwell->wq_lock); | ||
1492 | } | ||
1493 | return count; | ||
1494 | } | ||
1495 | static DEVICE_ATTR(b_bus_req, S_IRUGO | S_IWUGO, get_b_bus_req, set_b_bus_req); | ||
1496 | |||
1497 | static ssize_t | ||
1498 | set_a_clr_err(struct device *dev, struct device_attribute *attr, | ||
1499 | const char *buf, size_t count) | ||
1500 | { | ||
1501 | struct langwell_otg *langwell; | ||
1502 | langwell = the_transceiver; | ||
1503 | |||
1504 | if (!langwell->otg.default_a) | ||
1505 | return -1; | ||
1506 | if (count > 2) | ||
1507 | return -1; | ||
1508 | |||
1509 | if (buf[0] == '1') { | ||
1510 | langwell->hsm.a_clr_err = 1; | ||
1511 | otg_dbg("a_clr_err = 1\n"); | ||
1512 | } | ||
1513 | if (spin_trylock(&langwell->wq_lock)) { | ||
1514 | queue_work(langwell->qwork, &langwell->work); | ||
1515 | spin_unlock(&langwell->wq_lock); | ||
1516 | } | ||
1517 | return count; | ||
1518 | } | ||
1519 | static DEVICE_ATTR(a_clr_err, S_IWUGO, NULL, set_a_clr_err); | ||
1520 | |||
1521 | static struct attribute *inputs_attrs[] = { | ||
1522 | &dev_attr_a_bus_req.attr, | ||
1523 | &dev_attr_a_bus_drop.attr, | ||
1524 | &dev_attr_b_bus_req.attr, | ||
1525 | &dev_attr_a_clr_err.attr, | ||
1526 | NULL, | ||
1527 | }; | ||
1528 | |||
1529 | static struct attribute_group debug_dev_attr_group = { | ||
1530 | .name = "inputs", | ||
1531 | .attrs = inputs_attrs, | ||
1532 | }; | ||
1533 | |||
1534 | int langwell_register_host(struct pci_driver *host_driver) | ||
1535 | { | ||
1536 | int ret = 0; | ||
1537 | |||
1538 | the_transceiver->host_ops = host_driver; | ||
1539 | queue_work(the_transceiver->qwork, &the_transceiver->work); | ||
1540 | otg_dbg("host controller driver is registered\n"); | ||
1541 | |||
1542 | return ret; | ||
1543 | } | ||
1544 | EXPORT_SYMBOL(langwell_register_host); | ||
1545 | |||
1546 | void langwell_unregister_host(struct pci_driver *host_driver) | ||
1547 | { | ||
1548 | if (the_transceiver->host_ops) | ||
1549 | the_transceiver->host_ops->remove(the_transceiver->pdev); | ||
1550 | the_transceiver->host_ops = NULL; | ||
1551 | the_transceiver->hsm.a_bus_drop = 1; | ||
1552 | queue_work(the_transceiver->qwork, &the_transceiver->work); | ||
1553 | otg_dbg("host controller driver is unregistered\n"); | ||
1554 | } | ||
1555 | EXPORT_SYMBOL(langwell_unregister_host); | ||
1556 | |||
1557 | int langwell_register_peripheral(struct pci_driver *client_driver) | ||
1558 | { | ||
1559 | int ret = 0; | ||
1560 | |||
1561 | if (client_driver) | ||
1562 | ret = client_driver->probe(the_transceiver->pdev, | ||
1563 | client_driver->id_table); | ||
1564 | if (!ret) { | ||
1565 | the_transceiver->client_ops = client_driver; | ||
1566 | queue_work(the_transceiver->qwork, &the_transceiver->work); | ||
1567 | otg_dbg("client controller driver is registered\n"); | ||
1568 | } | ||
1569 | |||
1570 | return ret; | ||
1571 | } | ||
1572 | EXPORT_SYMBOL(langwell_register_peripheral); | ||
1573 | |||
1574 | void langwell_unregister_peripheral(struct pci_driver *client_driver) | ||
1575 | { | ||
1576 | if (the_transceiver->client_ops) | ||
1577 | the_transceiver->client_ops->remove(the_transceiver->pdev); | ||
1578 | the_transceiver->client_ops = NULL; | ||
1579 | the_transceiver->hsm.b_bus_req = 0; | ||
1580 | queue_work(the_transceiver->qwork, &the_transceiver->work); | ||
1581 | otg_dbg("client controller driver is unregistered\n"); | ||
1582 | } | ||
1583 | EXPORT_SYMBOL(langwell_unregister_peripheral); | ||
1584 | |||
1585 | static int langwell_otg_probe(struct pci_dev *pdev, | ||
1586 | const struct pci_device_id *id) | ||
1587 | { | ||
1588 | unsigned long resource, len; | ||
1589 | void __iomem *base = NULL; | ||
1590 | int retval; | ||
1591 | u32 val32; | ||
1592 | struct langwell_otg *langwell; | ||
1593 | char qname[] = "langwell_otg_queue"; | ||
1594 | |||
1595 | retval = 0; | ||
1596 | otg_dbg("\notg controller is detected.\n"); | ||
1597 | if (pci_enable_device(pdev) < 0) { | ||
1598 | retval = -ENODEV; | ||
1599 | goto done; | ||
1600 | } | ||
1601 | |||
1602 | langwell = kzalloc(sizeof *langwell, GFP_KERNEL); | ||
1603 | if (langwell == NULL) { | ||
1604 | retval = -ENOMEM; | ||
1605 | goto done; | ||
1606 | } | ||
1607 | the_transceiver = langwell; | ||
1608 | |||
1609 | /* control register: BAR 0 */ | ||
1610 | resource = pci_resource_start(pdev, 0); | ||
1611 | len = pci_resource_len(pdev, 0); | ||
1612 | if (!request_mem_region(resource, len, driver_name)) { | ||
1613 | retval = -EBUSY; | ||
1614 | goto err; | ||
1615 | } | ||
1616 | langwell->region = 1; | ||
1617 | |||
1618 | base = ioremap_nocache(resource, len); | ||
1619 | if (base == NULL) { | ||
1620 | retval = -EFAULT; | ||
1621 | goto err; | ||
1622 | } | ||
1623 | langwell->regs = base; | ||
1624 | |||
1625 | if (!pdev->irq) { | ||
1626 | otg_dbg("No IRQ.\n"); | ||
1627 | retval = -ENODEV; | ||
1628 | goto err; | ||
1629 | } | ||
1630 | |||
1631 | langwell->qwork = create_workqueue(qname); | ||
1632 | if (!langwell->qwork) { | ||
1633 | otg_dbg("cannot create workqueue %s\n", qname); | ||
1634 | retval = -ENOMEM; | ||
1635 | goto err; | ||
1636 | } | ||
1637 | INIT_WORK(&langwell->work, langwell_otg_work); | ||
1638 | |||
1639 | /* OTG common part */ | ||
1640 | langwell->pdev = pdev; | ||
1641 | langwell->otg.dev = &pdev->dev; | ||
1642 | langwell->otg.label = driver_name; | ||
1643 | langwell->otg.set_host = langwell_otg_set_host; | ||
1644 | langwell->otg.set_peripheral = langwell_otg_set_peripheral; | ||
1645 | langwell->otg.set_power = langwell_otg_set_power; | ||
1646 | langwell->otg.start_srp = langwell_otg_start_srp; | ||
1647 | langwell->otg.state = OTG_STATE_UNDEFINED; | ||
1648 | if (otg_set_transceiver(&langwell->otg)) { | ||
1649 | otg_dbg("can't set transceiver\n"); | ||
1650 | retval = -EBUSY; | ||
1651 | goto err; | ||
1652 | } | ||
1653 | |||
1654 | reset_otg(); | ||
1655 | init_hsm(); | ||
1656 | |||
1657 | spin_lock_init(&langwell->lock); | ||
1658 | spin_lock_init(&langwell->wq_lock); | ||
1659 | INIT_LIST_HEAD(&active_timers); | ||
1660 | langwell_otg_init_timers(&langwell->hsm); | ||
1661 | |||
1662 | if (request_irq(pdev->irq, otg_irq, IRQF_SHARED, | ||
1663 | driver_name, langwell) != 0) { | ||
1664 | otg_dbg("request interrupt %d failed\n", pdev->irq); | ||
1665 | retval = -EBUSY; | ||
1666 | goto err; | ||
1667 | } | ||
1668 | |||
1669 | /* enable OTGSC int */ | ||
1670 | val32 = OTGSC_DPIE | OTGSC_BSEIE | OTGSC_BSVIE | | ||
1671 | OTGSC_ASVIE | OTGSC_AVVIE | OTGSC_IDIE | OTGSC_IDPU; | ||
1672 | writel(val32, langwell->regs + CI_OTGSC); | ||
1673 | |||
1674 | retval = device_create_file(&pdev->dev, &dev_attr_registers); | ||
1675 | if (retval < 0) { | ||
1676 | otg_dbg("Can't register sysfs attribute: %d\n", retval); | ||
1677 | goto err; | ||
1678 | } | ||
1679 | |||
1680 | retval = device_create_file(&pdev->dev, &dev_attr_hsm); | ||
1681 | if (retval < 0) { | ||
1682 | otg_dbg("Can't hsm sysfs attribute: %d\n", retval); | ||
1683 | goto err; | ||
1684 | } | ||
1685 | |||
1686 | retval = sysfs_create_group(&pdev->dev.kobj, &debug_dev_attr_group); | ||
1687 | if (retval < 0) { | ||
1688 | otg_dbg("Can't register sysfs attr group: %d\n", retval); | ||
1689 | goto err; | ||
1690 | } | ||
1691 | |||
1692 | if (langwell->otg.state == OTG_STATE_A_IDLE) | ||
1693 | queue_work(langwell->qwork, &langwell->work); | ||
1694 | |||
1695 | return 0; | ||
1696 | |||
1697 | err: | ||
1698 | if (the_transceiver) | ||
1699 | langwell_otg_remove(pdev); | ||
1700 | done: | ||
1701 | return retval; | ||
1702 | } | ||
1703 | |||
1704 | static void langwell_otg_remove(struct pci_dev *pdev) | ||
1705 | { | ||
1706 | struct langwell_otg *langwell; | ||
1707 | |||
1708 | langwell = the_transceiver; | ||
1709 | |||
1710 | if (langwell->qwork) { | ||
1711 | flush_workqueue(langwell->qwork); | ||
1712 | destroy_workqueue(langwell->qwork); | ||
1713 | } | ||
1714 | langwell_otg_free_timers(); | ||
1715 | |||
1716 | /* disable OTGSC interrupt as OTGSC doesn't change in reset */ | ||
1717 | writel(0, langwell->regs + CI_OTGSC); | ||
1718 | |||
1719 | if (pdev->irq) | ||
1720 | free_irq(pdev->irq, langwell); | ||
1721 | if (langwell->regs) | ||
1722 | iounmap(langwell->regs); | ||
1723 | if (langwell->region) | ||
1724 | release_mem_region(pci_resource_start(pdev, 0), | ||
1725 | pci_resource_len(pdev, 0)); | ||
1726 | |||
1727 | otg_set_transceiver(NULL); | ||
1728 | pci_disable_device(pdev); | ||
1729 | sysfs_remove_group(&pdev->dev.kobj, &debug_dev_attr_group); | ||
1730 | device_remove_file(&pdev->dev, &dev_attr_hsm); | ||
1731 | device_remove_file(&pdev->dev, &dev_attr_registers); | ||
1732 | kfree(langwell); | ||
1733 | langwell = NULL; | ||
1734 | } | ||
1735 | |||
1736 | static void transceiver_suspend(struct pci_dev *pdev) | ||
1737 | { | ||
1738 | pci_save_state(pdev); | ||
1739 | pci_set_power_state(pdev, PCI_D3hot); | ||
1740 | langwell_otg_phy_low_power(1); | ||
1741 | } | ||
1742 | |||
1743 | static int langwell_otg_suspend(struct pci_dev *pdev, pm_message_t message) | ||
1744 | { | ||
1745 | int ret = 0; | ||
1746 | struct langwell_otg *langwell; | ||
1747 | |||
1748 | langwell = the_transceiver; | ||
1749 | |||
1750 | /* Disbale OTG interrupts */ | ||
1751 | langwell_otg_intr(0); | ||
1752 | |||
1753 | if (pdev->irq) | ||
1754 | free_irq(pdev->irq, langwell); | ||
1755 | |||
1756 | /* Prevent more otg_work */ | ||
1757 | flush_workqueue(langwell->qwork); | ||
1758 | spin_lock(&langwell->wq_lock); | ||
1759 | |||
1760 | /* start actions */ | ||
1761 | switch (langwell->otg.state) { | ||
1762 | case OTG_STATE_A_IDLE: | ||
1763 | case OTG_STATE_B_IDLE: | ||
1764 | case OTG_STATE_A_WAIT_VFALL: | ||
1765 | case OTG_STATE_A_VBUS_ERR: | ||
1766 | transceiver_suspend(pdev); | ||
1767 | break; | ||
1768 | case OTG_STATE_A_WAIT_VRISE: | ||
1769 | langwell_otg_del_timer(a_wait_vrise_tmr); | ||
1770 | langwell->hsm.a_srp_det = 0; | ||
1771 | langwell_otg_drv_vbus(0); | ||
1772 | langwell->otg.state = OTG_STATE_A_IDLE; | ||
1773 | transceiver_suspend(pdev); | ||
1774 | break; | ||
1775 | case OTG_STATE_A_WAIT_BCON: | ||
1776 | langwell_otg_del_timer(a_wait_bcon_tmr); | ||
1777 | if (langwell->host_ops) | ||
1778 | ret = langwell->host_ops->suspend(pdev, message); | ||
1779 | langwell_otg_drv_vbus(0); | ||
1780 | break; | ||
1781 | case OTG_STATE_A_HOST: | ||
1782 | if (langwell->host_ops) | ||
1783 | ret = langwell->host_ops->suspend(pdev, message); | ||
1784 | langwell_otg_drv_vbus(0); | ||
1785 | langwell_otg_phy_low_power(1); | ||
1786 | break; | ||
1787 | case OTG_STATE_A_SUSPEND: | ||
1788 | langwell_otg_del_timer(a_aidl_bdis_tmr); | ||
1789 | langwell_otg_HABA(0); | ||
1790 | if (langwell->host_ops) | ||
1791 | langwell->host_ops->remove(pdev); | ||
1792 | else | ||
1793 | otg_dbg("host driver has been removed.\n"); | ||
1794 | langwell_otg_drv_vbus(0); | ||
1795 | transceiver_suspend(pdev); | ||
1796 | langwell->otg.state = OTG_STATE_A_WAIT_VFALL; | ||
1797 | break; | ||
1798 | case OTG_STATE_A_PERIPHERAL: | ||
1799 | if (langwell->client_ops) | ||
1800 | ret = langwell->client_ops->suspend(pdev, message); | ||
1801 | else | ||
1802 | otg_dbg("client driver has been removed.\n"); | ||
1803 | langwell_otg_drv_vbus(0); | ||
1804 | transceiver_suspend(pdev); | ||
1805 | langwell->otg.state = OTG_STATE_A_WAIT_VFALL; | ||
1806 | break; | ||
1807 | case OTG_STATE_B_HOST: | ||
1808 | if (langwell->host_ops) | ||
1809 | langwell->host_ops->remove(pdev); | ||
1810 | else | ||
1811 | otg_dbg("host driver has been removed.\n"); | ||
1812 | langwell->hsm.b_bus_req = 0; | ||
1813 | transceiver_suspend(pdev); | ||
1814 | langwell->otg.state = OTG_STATE_B_IDLE; | ||
1815 | break; | ||
1816 | case OTG_STATE_B_PERIPHERAL: | ||
1817 | if (langwell->client_ops) | ||
1818 | ret = langwell->client_ops->suspend(pdev, message); | ||
1819 | else | ||
1820 | otg_dbg("client driver has been removed.\n"); | ||
1821 | break; | ||
1822 | case OTG_STATE_B_WAIT_ACON: | ||
1823 | langwell_otg_del_timer(b_ase0_brst_tmr); | ||
1824 | langwell_otg_HAAR(0); | ||
1825 | if (langwell->host_ops) | ||
1826 | langwell->host_ops->remove(pdev); | ||
1827 | else | ||
1828 | otg_dbg("host driver has been removed.\n"); | ||
1829 | langwell->hsm.b_bus_req = 0; | ||
1830 | langwell->otg.state = OTG_STATE_B_IDLE; | ||
1831 | transceiver_suspend(pdev); | ||
1832 | break; | ||
1833 | default: | ||
1834 | otg_dbg("error state before suspend\n "); | ||
1835 | break; | ||
1836 | } | ||
1837 | spin_unlock(&langwell->wq_lock); | ||
1838 | |||
1839 | return ret; | ||
1840 | } | ||
1841 | |||
1842 | static void transceiver_resume(struct pci_dev *pdev) | ||
1843 | { | ||
1844 | pci_restore_state(pdev); | ||
1845 | pci_set_power_state(pdev, PCI_D0); | ||
1846 | langwell_otg_phy_low_power(0); | ||
1847 | } | ||
1848 | |||
1849 | static int langwell_otg_resume(struct pci_dev *pdev) | ||
1850 | { | ||
1851 | int ret = 0; | ||
1852 | struct langwell_otg *langwell; | ||
1853 | |||
1854 | langwell = the_transceiver; | ||
1855 | |||
1856 | spin_lock(&langwell->wq_lock); | ||
1857 | |||
1858 | switch (langwell->otg.state) { | ||
1859 | case OTG_STATE_A_IDLE: | ||
1860 | case OTG_STATE_B_IDLE: | ||
1861 | case OTG_STATE_A_WAIT_VFALL: | ||
1862 | case OTG_STATE_A_VBUS_ERR: | ||
1863 | transceiver_resume(pdev); | ||
1864 | break; | ||
1865 | case OTG_STATE_A_WAIT_BCON: | ||
1866 | langwell_otg_add_timer(a_wait_bcon_tmr); | ||
1867 | langwell_otg_drv_vbus(1); | ||
1868 | if (langwell->host_ops) | ||
1869 | ret = langwell->host_ops->resume(pdev); | ||
1870 | break; | ||
1871 | case OTG_STATE_A_HOST: | ||
1872 | langwell_otg_drv_vbus(1); | ||
1873 | langwell_otg_phy_low_power(0); | ||
1874 | if (langwell->host_ops) | ||
1875 | ret = langwell->host_ops->resume(pdev); | ||
1876 | break; | ||
1877 | case OTG_STATE_B_PERIPHERAL: | ||
1878 | if (langwell->client_ops) | ||
1879 | ret = langwell->client_ops->resume(pdev); | ||
1880 | else | ||
1881 | otg_dbg("client driver not loaded.\n"); | ||
1882 | break; | ||
1883 | default: | ||
1884 | otg_dbg("error state before suspend\n "); | ||
1885 | break; | ||
1886 | } | ||
1887 | |||
1888 | if (request_irq(pdev->irq, otg_irq, IRQF_SHARED, | ||
1889 | driver_name, the_transceiver) != 0) { | ||
1890 | otg_dbg("request interrupt %d failed\n", pdev->irq); | ||
1891 | ret = -EBUSY; | ||
1892 | } | ||
1893 | |||
1894 | /* enable OTG interrupts */ | ||
1895 | langwell_otg_intr(1); | ||
1896 | |||
1897 | spin_unlock(&langwell->wq_lock); | ||
1898 | |||
1899 | queue_work(langwell->qwork, &langwell->work); | ||
1900 | |||
1901 | |||
1902 | return ret; | ||
1903 | } | ||
1904 | |||
1905 | static int __init langwell_otg_init(void) | ||
1906 | { | ||
1907 | return pci_register_driver(&otg_pci_driver); | ||
1908 | } | ||
1909 | module_init(langwell_otg_init); | ||
1910 | |||
1911 | static void __exit langwell_otg_cleanup(void) | ||
1912 | { | ||
1913 | pci_unregister_driver(&otg_pci_driver); | ||
1914 | } | ||
1915 | module_exit(langwell_otg_cleanup); | ||
diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c index 9ed5ea568679..af456b48985f 100644 --- a/drivers/usb/otg/nop-usb-xceiv.c +++ b/drivers/usb/otg/nop-usb-xceiv.c | |||
@@ -53,6 +53,7 @@ EXPORT_SYMBOL(usb_nop_xceiv_register); | |||
53 | void usb_nop_xceiv_unregister(void) | 53 | void usb_nop_xceiv_unregister(void) |
54 | { | 54 | { |
55 | platform_device_unregister(pd); | 55 | platform_device_unregister(pd); |
56 | pd = NULL; | ||
56 | } | 57 | } |
57 | EXPORT_SYMBOL(usb_nop_xceiv_unregister); | 58 | EXPORT_SYMBOL(usb_nop_xceiv_unregister); |
58 | 59 | ||
diff --git a/drivers/usb/serial/console.c b/drivers/usb/serial/console.c index 247b61bfb7f4..0e4f2e41ace5 100644 --- a/drivers/usb/serial/console.c +++ b/drivers/usb/serial/console.c | |||
@@ -169,9 +169,11 @@ static int usb_console_setup(struct console *co, char *options) | |||
169 | kfree(tty); | 169 | kfree(tty); |
170 | } | 170 | } |
171 | } | 171 | } |
172 | /* So we know not to kill the hardware on a hangup on this | 172 | /* Now that any required fake tty operations are completed restore |
173 | port. We have also bumped the use count by one so it won't go | 173 | * the tty port count */ |
174 | idle */ | 174 | --port->port.count; |
175 | /* The console is special in terms of closing the device so | ||
176 | * indicate this port is now acting as a system console. */ | ||
175 | port->console = 1; | 177 | port->console = 1; |
176 | retval = 0; | 178 | retval = 0; |
177 | 179 | ||
@@ -204,7 +206,7 @@ static void usb_console_write(struct console *co, | |||
204 | 206 | ||
205 | dbg("%s - port %d, %d byte(s)", __func__, port->number, count); | 207 | dbg("%s - port %d, %d byte(s)", __func__, port->number, count); |
206 | 208 | ||
207 | if (!port->port.count) { | 209 | if (!port->console) { |
208 | dbg("%s - port not opened", __func__); | 210 | dbg("%s - port not opened", __func__); |
209 | return; | 211 | return; |
210 | } | 212 | } |
@@ -300,8 +302,7 @@ void usb_serial_console_exit(void) | |||
300 | { | 302 | { |
301 | if (usbcons_info.port) { | 303 | if (usbcons_info.port) { |
302 | unregister_console(&usbcons); | 304 | unregister_console(&usbcons); |
303 | if (usbcons_info.port->port.count) | 305 | usbcons_info.port->console = 0; |
304 | usbcons_info.port->port.count--; | ||
305 | usbcons_info.port = NULL; | 306 | usbcons_info.port = NULL; |
306 | } | 307 | } |
307 | } | 308 | } |
diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 2b9eeda62bfe..e9a40b820fd4 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c | |||
@@ -67,6 +67,8 @@ static struct usb_device_id id_table [] = { | |||
67 | { USB_DEVICE(0x10AB, 0x10C5) }, /* Siemens MC60 Cable */ | 67 | { USB_DEVICE(0x10AB, 0x10C5) }, /* Siemens MC60 Cable */ |
68 | { USB_DEVICE(0x10B5, 0xAC70) }, /* Nokia CA-42 USB */ | 68 | { USB_DEVICE(0x10B5, 0xAC70) }, /* Nokia CA-42 USB */ |
69 | { USB_DEVICE(0x10C4, 0x0F91) }, /* Vstabi */ | 69 | { USB_DEVICE(0x10C4, 0x0F91) }, /* Vstabi */ |
70 | { USB_DEVICE(0x10C4, 0x1101) }, /* Arkham Technology DS101 Bus Monitor */ | ||
71 | { USB_DEVICE(0x10C4, 0x1601) }, /* Arkham Technology DS101 Adapter */ | ||
70 | { USB_DEVICE(0x10C4, 0x800A) }, /* SPORTident BSM7-D-USB main station */ | 72 | { USB_DEVICE(0x10C4, 0x800A) }, /* SPORTident BSM7-D-USB main station */ |
71 | { USB_DEVICE(0x10C4, 0x803B) }, /* Pololu USB-serial converter */ | 73 | { USB_DEVICE(0x10C4, 0x803B) }, /* Pololu USB-serial converter */ |
72 | { USB_DEVICE(0x10C4, 0x8053) }, /* Enfora EDG1228 */ | 74 | { USB_DEVICE(0x10C4, 0x8053) }, /* Enfora EDG1228 */ |
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index 9734085fd2fe..59adfe123110 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c | |||
@@ -1228,8 +1228,8 @@ static void cypress_read_int_callback(struct urb *urb) | |||
1228 | /* precursor to disconnect so just go away */ | 1228 | /* precursor to disconnect so just go away */ |
1229 | return; | 1229 | return; |
1230 | case -EPIPE: | 1230 | case -EPIPE: |
1231 | usb_clear_halt(port->serial->dev, 0x81); | 1231 | /* Can't call usb_clear_halt while in_interrupt */ |
1232 | break; | 1232 | /* FALLS THROUGH */ |
1233 | default: | 1233 | default: |
1234 | /* something ugly is going on... */ | 1234 | /* something ugly is going on... */ |
1235 | dev_err(&urb->dev->dev, | 1235 | dev_err(&urb->dev->dev, |
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 3dc3768ca71c..60c64cc5be2a 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/errno.h> | 33 | #include <linux/errno.h> |
34 | #include <linux/init.h> | 34 | #include <linux/init.h> |
35 | #include <linux/slab.h> | 35 | #include <linux/slab.h> |
36 | #include <linux/smp_lock.h> | ||
36 | #include <linux/tty.h> | 37 | #include <linux/tty.h> |
37 | #include <linux/tty_driver.h> | 38 | #include <linux/tty_driver.h> |
38 | #include <linux/tty_flip.h> | 39 | #include <linux/tty_flip.h> |
@@ -107,6 +108,7 @@ struct ftdi_sio_quirk { | |||
107 | 108 | ||
108 | static int ftdi_jtag_probe(struct usb_serial *serial); | 109 | static int ftdi_jtag_probe(struct usb_serial *serial); |
109 | static int ftdi_mtxorb_hack_setup(struct usb_serial *serial); | 110 | static int ftdi_mtxorb_hack_setup(struct usb_serial *serial); |
111 | static int ftdi_NDI_device_setup(struct usb_serial *serial); | ||
110 | static void ftdi_USB_UIRT_setup(struct ftdi_private *priv); | 112 | static void ftdi_USB_UIRT_setup(struct ftdi_private *priv); |
111 | static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv); | 113 | static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv); |
112 | 114 | ||
@@ -118,6 +120,10 @@ static struct ftdi_sio_quirk ftdi_mtxorb_hack_quirk = { | |||
118 | .probe = ftdi_mtxorb_hack_setup, | 120 | .probe = ftdi_mtxorb_hack_setup, |
119 | }; | 121 | }; |
120 | 122 | ||
123 | static struct ftdi_sio_quirk ftdi_NDI_device_quirk = { | ||
124 | .probe = ftdi_NDI_device_setup, | ||
125 | }; | ||
126 | |||
121 | static struct ftdi_sio_quirk ftdi_USB_UIRT_quirk = { | 127 | static struct ftdi_sio_quirk ftdi_USB_UIRT_quirk = { |
122 | .port_probe = ftdi_USB_UIRT_setup, | 128 | .port_probe = ftdi_USB_UIRT_setup, |
123 | }; | 129 | }; |
@@ -191,6 +197,7 @@ static struct usb_device_id id_table_combined [] = { | |||
191 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_4_PID) }, | 197 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_4_PID) }, |
192 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) }, | 198 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_5_PID) }, |
193 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, | 199 | { USB_DEVICE(FTDI_VID, FTDI_MTXORB_6_PID) }, |
200 | { USB_DEVICE(FTDI_VID, FTDI_R2000KU_TRUE_RNG) }, | ||
194 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0100_PID) }, | 201 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0100_PID) }, |
195 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0101_PID) }, | 202 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0101_PID) }, |
196 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0102_PID) }, | 203 | { USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0102_PID) }, |
@@ -579,6 +586,9 @@ static struct usb_device_id id_table_combined [] = { | |||
579 | { USB_DEVICE(FTDI_VID, FTDI_CCSICDU20_0_PID) }, | 586 | { USB_DEVICE(FTDI_VID, FTDI_CCSICDU20_0_PID) }, |
580 | { USB_DEVICE(FTDI_VID, FTDI_CCSICDU40_1_PID) }, | 587 | { USB_DEVICE(FTDI_VID, FTDI_CCSICDU40_1_PID) }, |
581 | { USB_DEVICE(FTDI_VID, FTDI_CCSMACHX_2_PID) }, | 588 | { USB_DEVICE(FTDI_VID, FTDI_CCSMACHX_2_PID) }, |
589 | { USB_DEVICE(FTDI_VID, FTDI_CCSLOAD_N_GO_3_PID) }, | ||
590 | { USB_DEVICE(FTDI_VID, FTDI_CCSICDU64_4_PID) }, | ||
591 | { USB_DEVICE(FTDI_VID, FTDI_CCSPRIME8_5_PID) }, | ||
582 | { USB_DEVICE(FTDI_VID, INSIDE_ACCESSO) }, | 592 | { USB_DEVICE(FTDI_VID, INSIDE_ACCESSO) }, |
583 | { USB_DEVICE(INTREPID_VID, INTREPID_VALUECAN_PID) }, | 593 | { USB_DEVICE(INTREPID_VID, INTREPID_VALUECAN_PID) }, |
584 | { USB_DEVICE(INTREPID_VID, INTREPID_NEOVI_PID) }, | 594 | { USB_DEVICE(INTREPID_VID, INTREPID_NEOVI_PID) }, |
@@ -644,6 +654,16 @@ static struct usb_device_id id_table_combined [] = { | |||
644 | { USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13S_PID) }, | 654 | { USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13S_PID) }, |
645 | { USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13U_PID) }, | 655 | { USB_DEVICE(FTDI_VID, FTDI_TACTRIX_OPENPORT_13U_PID) }, |
646 | { USB_DEVICE(ELEKTOR_VID, ELEKTOR_FT323R_PID) }, | 656 | { USB_DEVICE(ELEKTOR_VID, ELEKTOR_FT323R_PID) }, |
657 | { USB_DEVICE(FTDI_VID, FTDI_NDI_HUC_PID), | ||
658 | .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, | ||
659 | { USB_DEVICE(FTDI_VID, FTDI_NDI_SPECTRA_SCU_PID), | ||
660 | .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, | ||
661 | { USB_DEVICE(FTDI_VID, FTDI_NDI_FUTURE_2_PID), | ||
662 | .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, | ||
663 | { USB_DEVICE(FTDI_VID, FTDI_NDI_FUTURE_3_PID), | ||
664 | .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, | ||
665 | { USB_DEVICE(FTDI_VID, FTDI_NDI_AURORA_SCU_PID), | ||
666 | .driver_info = (kernel_ulong_t)&ftdi_NDI_device_quirk }, | ||
647 | { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, | 667 | { USB_DEVICE(TELLDUS_VID, TELLDUS_TELLSTICK_PID) }, |
648 | { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, | 668 | { USB_DEVICE(FTDI_VID, FTDI_MAXSTREAM_PID) }, |
649 | { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) }, | 669 | { USB_DEVICE(FTDI_VID, FTDI_PHI_FISCO_PID) }, |
@@ -660,6 +680,8 @@ static struct usb_device_id id_table_combined [] = { | |||
660 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | 680 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
661 | { USB_DEVICE(FTDI_VID, LMI_LM3S_EVAL_BOARD_PID), | 681 | { USB_DEVICE(FTDI_VID, LMI_LM3S_EVAL_BOARD_PID), |
662 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | 682 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, |
683 | { USB_DEVICE(FTDI_VID, FTDI_TURTELIZER_PID), | ||
684 | .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, | ||
663 | { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) }, | 685 | { USB_DEVICE(RATOC_VENDOR_ID, RATOC_PRODUCT_ID_USB60F) }, |
664 | { USB_DEVICE(FTDI_VID, FTDI_REU_TINY_PID) }, | 686 | { USB_DEVICE(FTDI_VID, FTDI_REU_TINY_PID) }, |
665 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO4x4_PID) }, | 687 | { USB_DEVICE(PAPOUCH_VID, PAPOUCH_QUIDO4x4_PID) }, |
@@ -667,7 +689,6 @@ static struct usb_device_id id_table_combined [] = { | |||
667 | { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DUSB_PID) }, | 689 | { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DUSB_PID) }, |
668 | { USB_DEVICE(ALTI2_VID, ALTI2_N3_PID) }, | 690 | { USB_DEVICE(ALTI2_VID, ALTI2_N3_PID) }, |
669 | { USB_DEVICE(FTDI_VID, DIEBOLD_BCS_SE923_PID) }, | 691 | { USB_DEVICE(FTDI_VID, DIEBOLD_BCS_SE923_PID) }, |
670 | { USB_DEVICE(FTDI_VID, FTDI_NDI_HUC_PID) }, | ||
671 | { USB_DEVICE(ATMEL_VID, STK541_PID) }, | 692 | { USB_DEVICE(ATMEL_VID, STK541_PID) }, |
672 | { USB_DEVICE(DE_VID, STB_PID) }, | 693 | { USB_DEVICE(DE_VID, STB_PID) }, |
673 | { USB_DEVICE(DE_VID, WHT_PID) }, | 694 | { USB_DEVICE(DE_VID, WHT_PID) }, |
@@ -1023,6 +1044,16 @@ static __u32 get_ftdi_divisor(struct tty_struct *tty, | |||
1023 | case FT2232C: /* FT2232C chip */ | 1044 | case FT2232C: /* FT2232C chip */ |
1024 | case FT232RL: | 1045 | case FT232RL: |
1025 | if (baud <= 3000000) { | 1046 | if (baud <= 3000000) { |
1047 | __u16 product_id = le16_to_cpu( | ||
1048 | port->serial->dev->descriptor.idProduct); | ||
1049 | if (((FTDI_NDI_HUC_PID == product_id) || | ||
1050 | (FTDI_NDI_SPECTRA_SCU_PID == product_id) || | ||
1051 | (FTDI_NDI_FUTURE_2_PID == product_id) || | ||
1052 | (FTDI_NDI_FUTURE_3_PID == product_id) || | ||
1053 | (FTDI_NDI_AURORA_SCU_PID == product_id)) && | ||
1054 | (baud == 19200)) { | ||
1055 | baud = 1200000; | ||
1056 | } | ||
1026 | div_value = ftdi_232bm_baud_to_divisor(baud); | 1057 | div_value = ftdi_232bm_baud_to_divisor(baud); |
1027 | } else { | 1058 | } else { |
1028 | dbg("%s - Baud rate too high!", __func__); | 1059 | dbg("%s - Baud rate too high!", __func__); |
@@ -1554,6 +1585,39 @@ static void ftdi_HE_TIRA1_setup(struct ftdi_private *priv) | |||
1554 | } /* ftdi_HE_TIRA1_setup */ | 1585 | } /* ftdi_HE_TIRA1_setup */ |
1555 | 1586 | ||
1556 | /* | 1587 | /* |
1588 | * Module parameter to control latency timer for NDI FTDI-based USB devices. | ||
1589 | * If this value is not set in modprobe.conf.local its value will be set to 1ms. | ||
1590 | */ | ||
1591 | static int ndi_latency_timer = 1; | ||
1592 | |||
1593 | /* Setup for the NDI FTDI-based USB devices, which requires hardwired | ||
1594 | * baudrate (19200 gets mapped to 1200000). | ||
1595 | * | ||
1596 | * Called from usbserial:serial_probe. | ||
1597 | */ | ||
1598 | static int ftdi_NDI_device_setup(struct usb_serial *serial) | ||
1599 | { | ||
1600 | struct usb_device *udev = serial->dev; | ||
1601 | int latency = ndi_latency_timer; | ||
1602 | int rv = 0; | ||
1603 | char buf[1]; | ||
1604 | |||
1605 | if (latency == 0) | ||
1606 | latency = 1; | ||
1607 | if (latency > 99) | ||
1608 | latency = 99; | ||
1609 | |||
1610 | dbg("%s setting NDI device latency to %d", __func__, latency); | ||
1611 | dev_info(&udev->dev, "NDI device with a latency value of %d", latency); | ||
1612 | |||
1613 | rv = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | ||
1614 | FTDI_SIO_SET_LATENCY_TIMER_REQUEST, | ||
1615 | FTDI_SIO_SET_LATENCY_TIMER_REQUEST_TYPE, | ||
1616 | latency, 0, buf, 0, WDR_TIMEOUT); | ||
1617 | return 0; | ||
1618 | } | ||
1619 | |||
1620 | /* | ||
1557 | * First port on JTAG adaptors such as Olimex arm-usb-ocd or the FIC/OpenMoko | 1621 | * First port on JTAG adaptors such as Olimex arm-usb-ocd or the FIC/OpenMoko |
1558 | * Neo1973 Debug Board is reserved for JTAG interface and can be accessed from | 1622 | * Neo1973 Debug Board is reserved for JTAG interface and can be accessed from |
1559 | * userspace using openocd. | 1623 | * userspace using openocd. |
@@ -2121,7 +2185,7 @@ static void ftdi_process_read(struct work_struct *work) | |||
2121 | /* Note that the error flag is duplicated for | 2185 | /* Note that the error flag is duplicated for |
2122 | every character received since we don't know | 2186 | every character received since we don't know |
2123 | which character it applied to */ | 2187 | which character it applied to */ |
2124 | if (!usb_serial_handle_sysrq_char(port, | 2188 | if (!usb_serial_handle_sysrq_char(tty, port, |
2125 | data[packet_offset + i])) | 2189 | data[packet_offset + i])) |
2126 | tty_insert_flip_char(tty, | 2190 | tty_insert_flip_char(tty, |
2127 | data[packet_offset + i], | 2191 | data[packet_offset + i], |
@@ -2622,3 +2686,5 @@ MODULE_PARM_DESC(vendor, "User specified vendor ID (default=" | |||
2622 | module_param(product, ushort, 0); | 2686 | module_param(product, ushort, 0); |
2623 | MODULE_PARM_DESC(product, "User specified product ID"); | 2687 | MODULE_PARM_DESC(product, "User specified product ID"); |
2624 | 2688 | ||
2689 | module_param(ndi_latency_timer, int, S_IRUGO | S_IWUSR); | ||
2690 | MODULE_PARM_DESC(ndi_latency_timer, "NDI device latency timer override"); | ||
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h index f1d440a728a3..c9fbd7415092 100644 --- a/drivers/usb/serial/ftdi_sio.h +++ b/drivers/usb/serial/ftdi_sio.h | |||
@@ -506,6 +506,7 @@ | |||
506 | * | 506 | * |
507 | * Armin Laeuger originally sent the PID for the UM 100 module. | 507 | * Armin Laeuger originally sent the PID for the UM 100 module. |
508 | */ | 508 | */ |
509 | #define FTDI_R2000KU_TRUE_RNG 0xFB80 /* R2000KU TRUE RNG */ | ||
509 | #define FTDI_ELV_UR100_PID 0xFB58 /* USB-RS232-Umsetzer (UR 100) */ | 510 | #define FTDI_ELV_UR100_PID 0xFB58 /* USB-RS232-Umsetzer (UR 100) */ |
510 | #define FTDI_ELV_UM100_PID 0xFB5A /* USB-Modul UM 100 */ | 511 | #define FTDI_ELV_UM100_PID 0xFB5A /* USB-Modul UM 100 */ |
511 | #define FTDI_ELV_UO100_PID 0xFB5B /* USB-Modul UO 100 */ | 512 | #define FTDI_ELV_UO100_PID 0xFB5B /* USB-Modul UO 100 */ |
@@ -614,6 +615,9 @@ | |||
614 | #define FTDI_CCSICDU20_0_PID 0xF9D0 | 615 | #define FTDI_CCSICDU20_0_PID 0xF9D0 |
615 | #define FTDI_CCSICDU40_1_PID 0xF9D1 | 616 | #define FTDI_CCSICDU40_1_PID 0xF9D1 |
616 | #define FTDI_CCSMACHX_2_PID 0xF9D2 | 617 | #define FTDI_CCSMACHX_2_PID 0xF9D2 |
618 | #define FTDI_CCSLOAD_N_GO_3_PID 0xF9D3 | ||
619 | #define FTDI_CCSICDU64_4_PID 0xF9D4 | ||
620 | #define FTDI_CCSPRIME8_5_PID 0xF9D5 | ||
617 | 621 | ||
618 | /* Inside Accesso contactless reader (http://www.insidefr.com) */ | 622 | /* Inside Accesso contactless reader (http://www.insidefr.com) */ |
619 | #define INSIDE_ACCESSO 0xFAD0 | 623 | #define INSIDE_ACCESSO 0xFAD0 |
@@ -736,6 +740,15 @@ | |||
736 | #define FTDI_PYRAMID_PID 0xE6C8 /* Pyramid Appliance Display */ | 740 | #define FTDI_PYRAMID_PID 0xE6C8 /* Pyramid Appliance Display */ |
737 | 741 | ||
738 | /* | 742 | /* |
743 | * NDI (www.ndigital.com) product ids | ||
744 | */ | ||
745 | #define FTDI_NDI_HUC_PID 0xDA70 /* NDI Host USB Converter */ | ||
746 | #define FTDI_NDI_SPECTRA_SCU_PID 0xDA71 /* NDI Spectra SCU */ | ||
747 | #define FTDI_NDI_FUTURE_2_PID 0xDA72 /* NDI future device #2 */ | ||
748 | #define FTDI_NDI_FUTURE_3_PID 0xDA73 /* NDI future device #3 */ | ||
749 | #define FTDI_NDI_AURORA_SCU_PID 0xDA74 /* NDI Aurora SCU */ | ||
750 | |||
751 | /* | ||
739 | * Posiflex inc retail equipment (http://www.posiflex.com.tw) | 752 | * Posiflex inc retail equipment (http://www.posiflex.com.tw) |
740 | */ | 753 | */ |
741 | #define POSIFLEX_VID 0x0d3a /* Vendor ID */ | 754 | #define POSIFLEX_VID 0x0d3a /* Vendor ID */ |
@@ -848,9 +861,6 @@ | |||
848 | #define TML_VID 0x1B91 /* Vendor ID */ | 861 | #define TML_VID 0x1B91 /* Vendor ID */ |
849 | #define TML_USB_SERIAL_PID 0x0064 /* USB - Serial Converter */ | 862 | #define TML_USB_SERIAL_PID 0x0064 /* USB - Serial Converter */ |
850 | 863 | ||
851 | /* NDI Polaris System */ | ||
852 | #define FTDI_NDI_HUC_PID 0xDA70 | ||
853 | |||
854 | /* Propox devices */ | 864 | /* Propox devices */ |
855 | #define FTDI_PROPOX_JTAGCABLEII_PID 0xD738 | 865 | #define FTDI_PROPOX_JTAGCABLEII_PID 0xD738 |
856 | 866 | ||
@@ -934,6 +944,8 @@ | |||
934 | #define MARVELL_VID 0x9e88 | 944 | #define MARVELL_VID 0x9e88 |
935 | #define MARVELL_SHEEVAPLUG_PID 0x9e8f | 945 | #define MARVELL_SHEEVAPLUG_PID 0x9e8f |
936 | 946 | ||
947 | #define FTDI_TURTELIZER_PID 0xBDC8 /* JTAG/RS-232 adapter by egnite GmBH */ | ||
948 | |||
937 | /* | 949 | /* |
938 | * BmRequestType: 1100 0000b | 950 | * BmRequestType: 1100 0000b |
939 | * bRequest: FTDI_E2_READ | 951 | * bRequest: FTDI_E2_READ |
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 932d6241b787..ce57f6a32bdf 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -424,10 +424,17 @@ static void flush_and_resubmit_read_urb(struct usb_serial_port *port) | |||
424 | if (!tty) | 424 | if (!tty) |
425 | goto done; | 425 | goto done; |
426 | 426 | ||
427 | /* Push data to tty */ | 427 | /* The per character mucking around with sysrq path it too slow for |
428 | for (i = 0; i < urb->actual_length; i++, ch++) { | 428 | stuff like 3G modems, so shortcircuit it in the 99.9999999% of cases |
429 | if (!usb_serial_handle_sysrq_char(port, *ch)) | 429 | where the USB serial is not a console anyway */ |
430 | tty_insert_flip_char(tty, *ch, TTY_NORMAL); | 430 | if (!port->console || !port->sysrq) |
431 | tty_insert_flip_string(tty, ch, urb->actual_length); | ||
432 | else { | ||
433 | /* Push data to tty */ | ||
434 | for (i = 0; i < urb->actual_length; i++, ch++) { | ||
435 | if (!usb_serial_handle_sysrq_char(tty, port, *ch)) | ||
436 | tty_insert_flip_char(tty, *ch, TTY_NORMAL); | ||
437 | } | ||
431 | } | 438 | } |
432 | tty_flip_buffer_push(tty); | 439 | tty_flip_buffer_push(tty); |
433 | tty_kref_put(tty); | 440 | tty_kref_put(tty); |
@@ -527,11 +534,12 @@ void usb_serial_generic_unthrottle(struct tty_struct *tty) | |||
527 | } | 534 | } |
528 | } | 535 | } |
529 | 536 | ||
530 | int usb_serial_handle_sysrq_char(struct usb_serial_port *port, unsigned int ch) | 537 | int usb_serial_handle_sysrq_char(struct tty_struct *tty, |
538 | struct usb_serial_port *port, unsigned int ch) | ||
531 | { | 539 | { |
532 | if (port->sysrq && port->console) { | 540 | if (port->sysrq && port->console) { |
533 | if (ch && time_before(jiffies, port->sysrq)) { | 541 | if (ch && time_before(jiffies, port->sysrq)) { |
534 | handle_sysrq(ch, tty_port_tty_get(&port->port)); | 542 | handle_sysrq(ch, tty); |
535 | port->sysrq = 0; | 543 | port->sysrq = 0; |
536 | return 1; | 544 | return 1; |
537 | } | 545 | } |
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index c40f95c1951c..c31940a307f8 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/errno.h> | 26 | #include <linux/errno.h> |
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/smp_lock.h> | ||
29 | #include <linux/tty.h> | 30 | #include <linux/tty.h> |
30 | #include <linux/tty_driver.h> | 31 | #include <linux/tty_driver.h> |
31 | #include <linux/tty_flip.h> | 32 | #include <linux/tty_flip.h> |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 575816e6ba37..98262dd552bb 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -206,6 +206,7 @@ static int option_resume(struct usb_serial *serial); | |||
206 | #define NOVATELWIRELESS_PRODUCT_MC950D 0x4400 | 206 | #define NOVATELWIRELESS_PRODUCT_MC950D 0x4400 |
207 | #define NOVATELWIRELESS_PRODUCT_U727 0x5010 | 207 | #define NOVATELWIRELESS_PRODUCT_U727 0x5010 |
208 | #define NOVATELWIRELESS_PRODUCT_MC760 0x6000 | 208 | #define NOVATELWIRELESS_PRODUCT_MC760 0x6000 |
209 | #define NOVATELWIRELESS_PRODUCT_OVMC760 0x6002 | ||
209 | 210 | ||
210 | /* FUTURE NOVATEL PRODUCTS */ | 211 | /* FUTURE NOVATEL PRODUCTS */ |
211 | #define NOVATELWIRELESS_PRODUCT_EVDO_HIGHSPEED 0X6001 | 212 | #define NOVATELWIRELESS_PRODUCT_EVDO_HIGHSPEED 0X6001 |
@@ -307,11 +308,20 @@ static int option_resume(struct usb_serial *serial); | |||
307 | #define DLINK_VENDOR_ID 0x1186 | 308 | #define DLINK_VENDOR_ID 0x1186 |
308 | #define DLINK_PRODUCT_DWM_652 0x3e04 | 309 | #define DLINK_PRODUCT_DWM_652 0x3e04 |
309 | 310 | ||
311 | #define QISDA_VENDOR_ID 0x1da5 | ||
312 | #define QISDA_PRODUCT_H21_4512 0x4512 | ||
313 | #define QISDA_PRODUCT_H21_4523 0x4523 | ||
314 | #define QISDA_PRODUCT_H20_4515 0x4515 | ||
315 | #define QISDA_PRODUCT_H20_4519 0x4519 | ||
316 | |||
310 | 317 | ||
311 | /* TOSHIBA PRODUCTS */ | 318 | /* TOSHIBA PRODUCTS */ |
312 | #define TOSHIBA_VENDOR_ID 0x0930 | 319 | #define TOSHIBA_VENDOR_ID 0x0930 |
313 | #define TOSHIBA_PRODUCT_HSDPA_MINICARD 0x1302 | 320 | #define TOSHIBA_PRODUCT_HSDPA_MINICARD 0x1302 |
314 | 321 | ||
322 | #define ALINK_VENDOR_ID 0x1e0e | ||
323 | #define ALINK_PRODUCT_3GU 0x9200 | ||
324 | |||
315 | static struct usb_device_id option_ids[] = { | 325 | static struct usb_device_id option_ids[] = { |
316 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, | 326 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) }, |
317 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, | 327 | { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) }, |
@@ -430,6 +440,7 @@ static struct usb_device_id option_ids[] = { | |||
430 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC727) }, /* Novatel MC727/U727/USB727 */ | 440 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC727) }, /* Novatel MC727/U727/USB727 */ |
431 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_U727) }, /* Novatel MC727/U727/USB727 */ | 441 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_U727) }, /* Novatel MC727/U727/USB727 */ |
432 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC760) }, /* Novatel MC760/U760/USB760 */ | 442 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC760) }, /* Novatel MC760/U760/USB760 */ |
443 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_OVMC760) }, /* Novatel Ovation MC760 */ | ||
433 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_FULLSPEED) }, /* Novatel HSPA product */ | 444 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_FULLSPEED) }, /* Novatel HSPA product */ |
434 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_FULLSPEED) }, /* Novatel EVDO Embedded product */ | 445 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_FULLSPEED) }, /* Novatel EVDO Embedded product */ |
435 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_FULLSPEED) }, /* Novatel HSPA Embedded product */ | 446 | { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_FULLSPEED) }, /* Novatel HSPA Embedded product */ |
@@ -529,8 +540,13 @@ static struct usb_device_id option_ids[] = { | |||
529 | { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH) }, | 540 | { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH) }, |
530 | { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) }, | 541 | { USB_DEVICE(BENQ_VENDOR_ID, BENQ_PRODUCT_H10) }, |
531 | { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) }, | 542 | { USB_DEVICE(DLINK_VENDOR_ID, DLINK_PRODUCT_DWM_652) }, |
532 | { USB_DEVICE(0x1da5, 0x4515) }, /* BenQ H20 */ | 543 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4512) }, |
544 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H21_4523) }, | ||
545 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4515) }, | ||
546 | { USB_DEVICE(QISDA_VENDOR_ID, QISDA_PRODUCT_H20_4519) }, | ||
533 | { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_HSDPA_MINICARD ) }, /* Toshiba 3G HSDPA == Novatel Expedite EU870D MiniCard */ | 547 | { USB_DEVICE(TOSHIBA_VENDOR_ID, TOSHIBA_PRODUCT_HSDPA_MINICARD ) }, /* Toshiba 3G HSDPA == Novatel Expedite EU870D MiniCard */ |
548 | { USB_DEVICE(ALINK_VENDOR_ID, 0x9000) }, | ||
549 | { USB_DEVICE_AND_INTERFACE_INFO(ALINK_VENDOR_ID, ALINK_PRODUCT_3GU, 0xff, 0xff, 0xff) }, | ||
534 | { } /* Terminating entry */ | 550 | { } /* Terminating entry */ |
535 | }; | 551 | }; |
536 | MODULE_DEVICE_TABLE(usb, option_ids); | 552 | MODULE_DEVICE_TABLE(usb, option_ids); |
@@ -732,7 +748,6 @@ static int option_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
732 | memcpy(this_urb->transfer_buffer, buf, todo); | 748 | memcpy(this_urb->transfer_buffer, buf, todo); |
733 | this_urb->transfer_buffer_length = todo; | 749 | this_urb->transfer_buffer_length = todo; |
734 | 750 | ||
735 | this_urb->dev = port->serial->dev; | ||
736 | err = usb_submit_urb(this_urb, GFP_ATOMIC); | 751 | err = usb_submit_urb(this_urb, GFP_ATOMIC); |
737 | if (err) { | 752 | if (err) { |
738 | dbg("usb_submit_urb %p (write bulk) failed " | 753 | dbg("usb_submit_urb %p (write bulk) failed " |
@@ -860,7 +875,6 @@ static void option_instat_callback(struct urb *urb) | |||
860 | 875 | ||
861 | /* Resubmit urb so we continue receiving IRQ data */ | 876 | /* Resubmit urb so we continue receiving IRQ data */ |
862 | if (status != -ESHUTDOWN && status != -ENOENT) { | 877 | if (status != -ESHUTDOWN && status != -ENOENT) { |
863 | urb->dev = serial->dev; | ||
864 | err = usb_submit_urb(urb, GFP_ATOMIC); | 878 | err = usb_submit_urb(urb, GFP_ATOMIC); |
865 | if (err) | 879 | if (err) |
866 | dbg("%s: resubmit intr urb failed. (%d)", | 880 | dbg("%s: resubmit intr urb failed. (%d)", |
@@ -921,23 +935,11 @@ static int option_open(struct tty_struct *tty, | |||
921 | 935 | ||
922 | dbg("%s", __func__); | 936 | dbg("%s", __func__); |
923 | 937 | ||
924 | /* Reset low level data toggle and start reading from endpoints */ | 938 | /* Start reading from the IN endpoint */ |
925 | for (i = 0; i < N_IN_URB; i++) { | 939 | for (i = 0; i < N_IN_URB; i++) { |
926 | urb = portdata->in_urbs[i]; | 940 | urb = portdata->in_urbs[i]; |
927 | if (!urb) | 941 | if (!urb) |
928 | continue; | 942 | continue; |
929 | if (urb->dev != serial->dev) { | ||
930 | dbg("%s: dev %p != %p", __func__, | ||
931 | urb->dev, serial->dev); | ||
932 | continue; | ||
933 | } | ||
934 | |||
935 | /* | ||
936 | * make sure endpoint data toggle is synchronized with the | ||
937 | * device | ||
938 | */ | ||
939 | usb_clear_halt(urb->dev, urb->pipe); | ||
940 | |||
941 | err = usb_submit_urb(urb, GFP_KERNEL); | 943 | err = usb_submit_urb(urb, GFP_KERNEL); |
942 | if (err) { | 944 | if (err) { |
943 | dbg("%s: submit urb %d failed (%d) %d", | 945 | dbg("%s: submit urb %d failed (%d) %d", |
@@ -946,16 +948,6 @@ static int option_open(struct tty_struct *tty, | |||
946 | } | 948 | } |
947 | } | 949 | } |
948 | 950 | ||
949 | /* Reset low level data toggle on out endpoints */ | ||
950 | for (i = 0; i < N_OUT_URB; i++) { | ||
951 | urb = portdata->out_urbs[i]; | ||
952 | if (!urb) | ||
953 | continue; | ||
954 | urb->dev = serial->dev; | ||
955 | /* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), | ||
956 | usb_pipeout(urb->pipe), 0); */ | ||
957 | } | ||
958 | |||
959 | option_send_setup(port); | 951 | option_send_setup(port); |
960 | 952 | ||
961 | return 0; | 953 | return 0; |
@@ -1218,7 +1210,6 @@ static int option_resume(struct usb_serial *serial) | |||
1218 | dbg("%s: No interrupt URB for port %d\n", __func__, i); | 1210 | dbg("%s: No interrupt URB for port %d\n", __func__, i); |
1219 | continue; | 1211 | continue; |
1220 | } | 1212 | } |
1221 | port->interrupt_in_urb->dev = serial->dev; | ||
1222 | err = usb_submit_urb(port->interrupt_in_urb, GFP_NOIO); | 1213 | err = usb_submit_urb(port->interrupt_in_urb, GFP_NOIO); |
1223 | dbg("Submitted interrupt URB for port %d (result %d)", i, err); | 1214 | dbg("Submitted interrupt URB for port %d (result %d)", i, err); |
1224 | if (err < 0) { | 1215 | if (err < 0) { |
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index ec6c132a25b5..7d15bfa7c2db 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -94,6 +94,7 @@ static struct usb_device_id id_table [] = { | |||
94 | { USB_DEVICE(YCCABLE_VENDOR_ID, YCCABLE_PRODUCT_ID) }, | 94 | { USB_DEVICE(YCCABLE_VENDOR_ID, YCCABLE_PRODUCT_ID) }, |
95 | { USB_DEVICE(SUPERIAL_VENDOR_ID, SUPERIAL_PRODUCT_ID) }, | 95 | { USB_DEVICE(SUPERIAL_VENDOR_ID, SUPERIAL_PRODUCT_ID) }, |
96 | { USB_DEVICE(HP_VENDOR_ID, HP_LD220_PRODUCT_ID) }, | 96 | { USB_DEVICE(HP_VENDOR_ID, HP_LD220_PRODUCT_ID) }, |
97 | { USB_DEVICE(CRESSI_VENDOR_ID, CRESSI_EDY_PRODUCT_ID) }, | ||
97 | { } /* Terminating entry */ | 98 | { } /* Terminating entry */ |
98 | }; | 99 | }; |
99 | 100 | ||
@@ -971,18 +972,46 @@ exit: | |||
971 | __func__, retval); | 972 | __func__, retval); |
972 | } | 973 | } |
973 | 974 | ||
975 | static void pl2303_push_data(struct tty_struct *tty, | ||
976 | struct usb_serial_port *port, struct urb *urb, | ||
977 | u8 line_status) | ||
978 | { | ||
979 | unsigned char *data = urb->transfer_buffer; | ||
980 | /* get tty_flag from status */ | ||
981 | char tty_flag = TTY_NORMAL; | ||
982 | /* break takes precedence over parity, */ | ||
983 | /* which takes precedence over framing errors */ | ||
984 | if (line_status & UART_BREAK_ERROR) | ||
985 | tty_flag = TTY_BREAK; | ||
986 | else if (line_status & UART_PARITY_ERROR) | ||
987 | tty_flag = TTY_PARITY; | ||
988 | else if (line_status & UART_FRAME_ERROR) | ||
989 | tty_flag = TTY_FRAME; | ||
990 | dbg("%s - tty_flag = %d", __func__, tty_flag); | ||
991 | |||
992 | tty_buffer_request_room(tty, urb->actual_length + 1); | ||
993 | /* overrun is special, not associated with a char */ | ||
994 | if (line_status & UART_OVERRUN_ERROR) | ||
995 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | ||
996 | if (port->console && port->sysrq) { | ||
997 | int i; | ||
998 | for (i = 0; i < urb->actual_length; ++i) | ||
999 | if (!usb_serial_handle_sysrq_char(tty, port, data[i])) | ||
1000 | tty_insert_flip_char(tty, data[i], tty_flag); | ||
1001 | } else | ||
1002 | tty_insert_flip_string(tty, data, urb->actual_length); | ||
1003 | tty_flip_buffer_push(tty); | ||
1004 | } | ||
1005 | |||
974 | static void pl2303_read_bulk_callback(struct urb *urb) | 1006 | static void pl2303_read_bulk_callback(struct urb *urb) |
975 | { | 1007 | { |
976 | struct usb_serial_port *port = urb->context; | 1008 | struct usb_serial_port *port = urb->context; |
977 | struct pl2303_private *priv = usb_get_serial_port_data(port); | 1009 | struct pl2303_private *priv = usb_get_serial_port_data(port); |
978 | struct tty_struct *tty; | 1010 | struct tty_struct *tty; |
979 | unsigned char *data = urb->transfer_buffer; | ||
980 | unsigned long flags; | 1011 | unsigned long flags; |
981 | int i; | ||
982 | int result; | 1012 | int result; |
983 | int status = urb->status; | 1013 | int status = urb->status; |
984 | u8 line_status; | 1014 | u8 line_status; |
985 | char tty_flag; | ||
986 | 1015 | ||
987 | dbg("%s - port %d", __func__, port->number); | 1016 | dbg("%s - port %d", __func__, port->number); |
988 | 1017 | ||
@@ -1010,10 +1039,7 @@ static void pl2303_read_bulk_callback(struct urb *urb) | |||
1010 | } | 1039 | } |
1011 | 1040 | ||
1012 | usb_serial_debug_data(debug, &port->dev, __func__, | 1041 | usb_serial_debug_data(debug, &port->dev, __func__, |
1013 | urb->actual_length, data); | 1042 | urb->actual_length, urb->transfer_buffer); |
1014 | |||
1015 | /* get tty_flag from status */ | ||
1016 | tty_flag = TTY_NORMAL; | ||
1017 | 1043 | ||
1018 | spin_lock_irqsave(&priv->lock, flags); | 1044 | spin_lock_irqsave(&priv->lock, flags); |
1019 | line_status = priv->line_status; | 1045 | line_status = priv->line_status; |
@@ -1021,26 +1047,9 @@ static void pl2303_read_bulk_callback(struct urb *urb) | |||
1021 | spin_unlock_irqrestore(&priv->lock, flags); | 1047 | spin_unlock_irqrestore(&priv->lock, flags); |
1022 | wake_up_interruptible(&priv->delta_msr_wait); | 1048 | wake_up_interruptible(&priv->delta_msr_wait); |
1023 | 1049 | ||
1024 | /* break takes precedence over parity, */ | ||
1025 | /* which takes precedence over framing errors */ | ||
1026 | if (line_status & UART_BREAK_ERROR) | ||
1027 | tty_flag = TTY_BREAK; | ||
1028 | else if (line_status & UART_PARITY_ERROR) | ||
1029 | tty_flag = TTY_PARITY; | ||
1030 | else if (line_status & UART_FRAME_ERROR) | ||
1031 | tty_flag = TTY_FRAME; | ||
1032 | dbg("%s - tty_flag = %d", __func__, tty_flag); | ||
1033 | |||
1034 | tty = tty_port_tty_get(&port->port); | 1050 | tty = tty_port_tty_get(&port->port); |
1035 | if (tty && urb->actual_length) { | 1051 | if (tty && urb->actual_length) { |
1036 | tty_buffer_request_room(tty, urb->actual_length + 1); | 1052 | pl2303_push_data(tty, port, urb, line_status); |
1037 | /* overrun is special, not associated with a char */ | ||
1038 | if (line_status & UART_OVERRUN_ERROR) | ||
1039 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | ||
1040 | for (i = 0; i < urb->actual_length; ++i) | ||
1041 | if (!usb_serial_handle_sysrq_char(port, data[i])) | ||
1042 | tty_insert_flip_char(tty, data[i], tty_flag); | ||
1043 | tty_flip_buffer_push(tty); | ||
1044 | } | 1053 | } |
1045 | tty_kref_put(tty); | 1054 | tty_kref_put(tty); |
1046 | /* Schedule the next read _if_ we are still open */ | 1055 | /* Schedule the next read _if_ we are still open */ |
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index 1d7a22e3a9fd..12aac7d2462d 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h | |||
@@ -122,3 +122,7 @@ | |||
122 | /* Hewlett-Packard LD220-HP POS Pole Display */ | 122 | /* Hewlett-Packard LD220-HP POS Pole Display */ |
123 | #define HP_VENDOR_ID 0x03f0 | 123 | #define HP_VENDOR_ID 0x03f0 |
124 | #define HP_LD220_PRODUCT_ID 0x3524 | 124 | #define HP_LD220_PRODUCT_ID 0x3524 |
125 | |||
126 | /* Cressi Edy (diving computer) PC interface */ | ||
127 | #define CRESSI_VENDOR_ID 0x04b8 | ||
128 | #define CRESSI_EDY_PRODUCT_ID 0x0521 | ||
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 032f7aeb40a4..f48d05e0acc1 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -181,35 +181,50 @@ static const struct sierra_iface_info direct_ip_interface_blacklist = { | |||
181 | }; | 181 | }; |
182 | 182 | ||
183 | static struct usb_device_id id_table [] = { | 183 | static struct usb_device_id id_table [] = { |
184 | { USB_DEVICE(0x0F3D, 0x0112) }, /* Airprime/Sierra PC 5220 */ | ||
185 | { USB_DEVICE(0x03F0, 0x1B1D) }, /* HP ev2200 a.k.a MC5720 */ | ||
186 | { USB_DEVICE(0x03F0, 0x1E1D) }, /* HP hs2300 a.k.a MC8775 */ | ||
187 | |||
184 | { USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */ | 188 | { USB_DEVICE(0x1199, 0x0017) }, /* Sierra Wireless EM5625 */ |
185 | { USB_DEVICE(0x1199, 0x0018) }, /* Sierra Wireless MC5720 */ | 189 | { USB_DEVICE(0x1199, 0x0018) }, /* Sierra Wireless MC5720 */ |
186 | { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */ | 190 | { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */ |
187 | { USB_DEVICE(0x03f0, 0x1b1d) }, /* HP ev2200 a.k.a MC5720 */ | ||
188 | { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */ | 191 | { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */ |
189 | { USB_DEVICE(0x1199, 0x0024) }, /* Sierra Wireless MC5727 */ | ||
190 | { USB_DEVICE(0x1199, 0x0220) }, /* Sierra Wireless MC5725 */ | 192 | { USB_DEVICE(0x1199, 0x0220) }, /* Sierra Wireless MC5725 */ |
193 | { USB_DEVICE(0x1199, 0x0022) }, /* Sierra Wireless EM5725 */ | ||
194 | { USB_DEVICE(0x1199, 0x0024) }, /* Sierra Wireless MC5727 */ | ||
195 | { USB_DEVICE(0x1199, 0x0224) }, /* Sierra Wireless MC5727 */ | ||
191 | { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */ | 196 | { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */ |
192 | { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */ | 197 | { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */ |
198 | { USB_DEVICE(0x1199, 0x0112) }, /* Sierra Wireless AirCard 580 */ | ||
193 | { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless USB Dongle 595U */ | 199 | { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless USB Dongle 595U */ |
194 | /* Sierra Wireless C597 */ | 200 | /* Sierra Wireless C597 */ |
195 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x0023, 0xFF, 0xFF, 0xFF) }, | 201 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x0023, 0xFF, 0xFF, 0xFF) }, |
196 | /* Sierra Wireless Device */ | 202 | /* Sierra Wireless T598 */ |
197 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x0025, 0xFF, 0xFF, 0xFF) }, | 203 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x0025, 0xFF, 0xFF, 0xFF) }, |
198 | { USB_DEVICE(0x1199, 0x0026) }, /* Sierra Wireless Device */ | 204 | { USB_DEVICE(0x1199, 0x0026) }, /* Sierra Wireless T11 */ |
199 | { USB_DEVICE(0x1199, 0x0027) }, /* Sierra Wireless Device */ | 205 | { USB_DEVICE(0x1199, 0x0027) }, /* Sierra Wireless AC402 */ |
200 | { USB_DEVICE(0x1199, 0x0028) }, /* Sierra Wireless Device */ | 206 | { USB_DEVICE(0x1199, 0x0028) }, /* Sierra Wireless MC5728 */ |
207 | { USB_DEVICE(0x1199, 0x0029) }, /* Sierra Wireless Device */ | ||
201 | 208 | ||
202 | { USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */ | 209 | { USB_DEVICE(0x1199, 0x6802) }, /* Sierra Wireless MC8755 */ |
203 | { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */ | ||
204 | { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */ | 210 | { USB_DEVICE(0x1199, 0x6803) }, /* Sierra Wireless MC8765 */ |
211 | { USB_DEVICE(0x1199, 0x6804) }, /* Sierra Wireless MC8755 */ | ||
212 | { USB_DEVICE(0x1199, 0x6805) }, /* Sierra Wireless MC8765 */ | ||
213 | { USB_DEVICE(0x1199, 0x6808) }, /* Sierra Wireless MC8755 */ | ||
214 | { USB_DEVICE(0x1199, 0x6809) }, /* Sierra Wireless MC8765 */ | ||
205 | { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 & AC 875U */ | 215 | { USB_DEVICE(0x1199, 0x6812) }, /* Sierra Wireless MC8775 & AC 875U */ |
206 | { USB_DEVICE(0x1199, 0x6813) }, /* Sierra Wireless MC8775 (Lenovo) */ | 216 | { USB_DEVICE(0x1199, 0x6813) }, /* Sierra Wireless MC8775 */ |
207 | { USB_DEVICE(0x1199, 0x6815) }, /* Sierra Wireless MC8775 */ | 217 | { USB_DEVICE(0x1199, 0x6815) }, /* Sierra Wireless MC8775 */ |
208 | { USB_DEVICE(0x03f0, 0x1e1d) }, /* HP hs2300 a.k.a MC8775 */ | 218 | { USB_DEVICE(0x1199, 0x6816) }, /* Sierra Wireless MC8775 */ |
209 | { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */ | 219 | { USB_DEVICE(0x1199, 0x6820) }, /* Sierra Wireless AirCard 875 */ |
210 | { USB_DEVICE(0x1199, 0x6821) }, /* Sierra Wireless AirCard 875U */ | 220 | { USB_DEVICE(0x1199, 0x6821) }, /* Sierra Wireless AirCard 875U */ |
221 | { USB_DEVICE(0x1199, 0x6822) }, /* Sierra Wireless AirCard 875E */ | ||
211 | { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780 */ | 222 | { USB_DEVICE(0x1199, 0x6832) }, /* Sierra Wireless MC8780 */ |
212 | { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781 */ | 223 | { USB_DEVICE(0x1199, 0x6833) }, /* Sierra Wireless MC8781 */ |
224 | { USB_DEVICE(0x1199, 0x6834) }, /* Sierra Wireless MC8780 */ | ||
225 | { USB_DEVICE(0x1199, 0x6835) }, /* Sierra Wireless MC8781 */ | ||
226 | { USB_DEVICE(0x1199, 0x6838) }, /* Sierra Wireless MC8780 */ | ||
227 | { USB_DEVICE(0x1199, 0x6839) }, /* Sierra Wireless MC8781 */ | ||
213 | { USB_DEVICE(0x1199, 0x683A) }, /* Sierra Wireless MC8785 */ | 228 | { USB_DEVICE(0x1199, 0x683A) }, /* Sierra Wireless MC8785 */ |
214 | { USB_DEVICE(0x1199, 0x683B) }, /* Sierra Wireless MC8785 Composite */ | 229 | { USB_DEVICE(0x1199, 0x683B) }, /* Sierra Wireless MC8785 Composite */ |
215 | /* Sierra Wireless MC8790, MC8791, MC8792 Composite */ | 230 | /* Sierra Wireless MC8790, MC8791, MC8792 Composite */ |
@@ -227,16 +242,13 @@ static struct usb_device_id id_table [] = { | |||
227 | { USB_DEVICE(0x1199, 0x685A) }, /* Sierra Wireless AirCard 885 E */ | 242 | { USB_DEVICE(0x1199, 0x685A) }, /* Sierra Wireless AirCard 885 E */ |
228 | /* Sierra Wireless C885 */ | 243 | /* Sierra Wireless C885 */ |
229 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6880, 0xFF, 0xFF, 0xFF)}, | 244 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6880, 0xFF, 0xFF, 0xFF)}, |
230 | /* Sierra Wireless Device */ | 245 | /* Sierra Wireless C888, Air Card 501, USB 303, USB 304 */ |
231 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6890, 0xFF, 0xFF, 0xFF)}, | 246 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6890, 0xFF, 0xFF, 0xFF)}, |
232 | /* Sierra Wireless Device */ | 247 | /* Sierra Wireless C22/C33 */ |
233 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6891, 0xFF, 0xFF, 0xFF)}, | 248 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6891, 0xFF, 0xFF, 0xFF)}, |
234 | /* Sierra Wireless Device */ | 249 | /* Sierra Wireless HSPA Non-Composite Device */ |
235 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)}, | 250 | { USB_DEVICE_AND_INTERFACE_INFO(0x1199, 0x6892, 0xFF, 0xFF, 0xFF)}, |
236 | 251 | { USB_DEVICE(0x1199, 0x6893) }, /* Sierra Wireless Device */ | |
237 | { USB_DEVICE(0x1199, 0x0112) }, /* Sierra Wireless AirCard 580 */ | ||
238 | { USB_DEVICE(0x0F3D, 0x0112) }, /* Airprime/Sierra PC 5220 */ | ||
239 | |||
240 | { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */ | 252 | { USB_DEVICE(0x1199, 0x68A3), /* Sierra Wireless Direct IP modems */ |
241 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist | 253 | .driver_info = (kernel_ulong_t)&direct_ip_interface_blacklist |
242 | }, | 254 | }, |
@@ -814,7 +826,7 @@ static int sierra_startup(struct usb_serial *serial) | |||
814 | return 0; | 826 | return 0; |
815 | } | 827 | } |
816 | 828 | ||
817 | static void sierra_disconnect(struct usb_serial *serial) | 829 | static void sierra_release(struct usb_serial *serial) |
818 | { | 830 | { |
819 | int i; | 831 | int i; |
820 | struct usb_serial_port *port; | 832 | struct usb_serial_port *port; |
@@ -830,7 +842,6 @@ static void sierra_disconnect(struct usb_serial *serial) | |||
830 | if (!portdata) | 842 | if (!portdata) |
831 | continue; | 843 | continue; |
832 | kfree(portdata); | 844 | kfree(portdata); |
833 | usb_set_serial_port_data(port, NULL); | ||
834 | } | 845 | } |
835 | } | 846 | } |
836 | 847 | ||
@@ -853,7 +864,7 @@ static struct usb_serial_driver sierra_device = { | |||
853 | .tiocmget = sierra_tiocmget, | 864 | .tiocmget = sierra_tiocmget, |
854 | .tiocmset = sierra_tiocmset, | 865 | .tiocmset = sierra_tiocmset, |
855 | .attach = sierra_startup, | 866 | .attach = sierra_startup, |
856 | .disconnect = sierra_disconnect, | 867 | .release = sierra_release, |
857 | .read_int_callback = sierra_instat_callback, | 868 | .read_int_callback = sierra_instat_callback, |
858 | }; | 869 | }; |
859 | 870 | ||
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 991d8232e376..14971a926990 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -191,7 +191,6 @@ static struct usb_device_id ti_id_table_5052[5+TI_EXTRA_VID_PID_COUNT+1] = { | |||
191 | { USB_DEVICE(TI_VENDOR_ID, TI_5152_BOOT_PRODUCT_ID) }, | 191 | { USB_DEVICE(TI_VENDOR_ID, TI_5152_BOOT_PRODUCT_ID) }, |
192 | { USB_DEVICE(TI_VENDOR_ID, TI_5052_EEPROM_PRODUCT_ID) }, | 192 | { USB_DEVICE(TI_VENDOR_ID, TI_5052_EEPROM_PRODUCT_ID) }, |
193 | { USB_DEVICE(TI_VENDOR_ID, TI_5052_FIRMWARE_PRODUCT_ID) }, | 193 | { USB_DEVICE(TI_VENDOR_ID, TI_5052_FIRMWARE_PRODUCT_ID) }, |
194 | { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) }, | ||
195 | }; | 194 | }; |
196 | 195 | ||
197 | static struct usb_device_id ti_id_table_combined[14+2*TI_EXTRA_VID_PID_COUNT+1] = { | 196 | static struct usb_device_id ti_id_table_combined[14+2*TI_EXTRA_VID_PID_COUNT+1] = { |
@@ -1658,7 +1657,7 @@ static int ti_do_download(struct usb_device *dev, int pipe, | |||
1658 | u8 cs = 0; | 1657 | u8 cs = 0; |
1659 | int done; | 1658 | int done; |
1660 | struct ti_firmware_header *header; | 1659 | struct ti_firmware_header *header; |
1661 | int status; | 1660 | int status = 0; |
1662 | int len; | 1661 | int len; |
1663 | 1662 | ||
1664 | for (pos = sizeof(struct ti_firmware_header); pos < size; pos++) | 1663 | for (pos = sizeof(struct ti_firmware_header); pos < size; pos++) |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index a84216464ca0..bd7581b3a48a 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/errno.h> | 21 | #include <linux/errno.h> |
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #include <linux/smp_lock.h> | ||
24 | #include <linux/tty.h> | 25 | #include <linux/tty.h> |
25 | #include <linux/tty_driver.h> | 26 | #include <linux/tty_driver.h> |
26 | #include <linux/tty_flip.h> | 27 | #include <linux/tty_flip.h> |
@@ -220,7 +221,8 @@ static int serial_open (struct tty_struct *tty, struct file *filp) | |||
220 | tty->driver_data = port; | 221 | tty->driver_data = port; |
221 | tty_port_tty_set(&port->port, tty); | 222 | tty_port_tty_set(&port->port, tty); |
222 | 223 | ||
223 | if (port->port.count == 1) { | 224 | /* If the console is attached, the device is already open */ |
225 | if (port->port.count == 1 && !port->console) { | ||
224 | 226 | ||
225 | /* lock this module before we call it | 227 | /* lock this module before we call it |
226 | * this may fail, which means we must bail out, | 228 | * this may fail, which means we must bail out, |
diff --git a/drivers/usb/storage/option_ms.c b/drivers/usb/storage/option_ms.c index d41cc0a970f7..773a5cd38c5a 100644 --- a/drivers/usb/storage/option_ms.c +++ b/drivers/usb/storage/option_ms.c | |||
@@ -118,6 +118,9 @@ static int option_inquiry(struct us_data *us) | |||
118 | 118 | ||
119 | result = memcmp(buffer+8, "Option", 6); | 119 | result = memcmp(buffer+8, "Option", 6); |
120 | 120 | ||
121 | if (result != 0) | ||
122 | result = memcmp(buffer+8, "ZCOPTION", 8); | ||
123 | |||
121 | /* Read the CSW */ | 124 | /* Read the CSW */ |
122 | usb_stor_bulk_transfer_buf(us, | 125 | usb_stor_bulk_transfer_buf(us, |
123 | us->recv_bulk_pipe, | 126 | us->recv_bulk_pipe, |
diff --git a/drivers/video/amba-clcd.c b/drivers/video/amba-clcd.c index fb8163d181ab..a21efcd10b78 100644 --- a/drivers/video/amba-clcd.c +++ b/drivers/video/amba-clcd.c | |||
@@ -226,9 +226,10 @@ static int clcdfb_set_par(struct fb_info *info) | |||
226 | clcdfb_enable(fb, regs.cntl); | 226 | clcdfb_enable(fb, regs.cntl); |
227 | 227 | ||
228 | #ifdef DEBUG | 228 | #ifdef DEBUG |
229 | printk(KERN_INFO "CLCD: Registers set to\n" | 229 | printk(KERN_INFO |
230 | KERN_INFO " %08x %08x %08x %08x\n" | 230 | "CLCD: Registers set to\n" |
231 | KERN_INFO " %08x %08x %08x %08x\n", | 231 | " %08x %08x %08x %08x\n" |
232 | " %08x %08x %08x %08x\n", | ||
232 | readl(fb->regs + CLCD_TIM0), readl(fb->regs + CLCD_TIM1), | 233 | readl(fb->regs + CLCD_TIM0), readl(fb->regs + CLCD_TIM1), |
233 | readl(fb->regs + CLCD_TIM2), readl(fb->regs + CLCD_TIM3), | 234 | readl(fb->regs + CLCD_TIM2), readl(fb->regs + CLCD_TIM3), |
234 | readl(fb->regs + CLCD_UBAS), readl(fb->regs + CLCD_LBAS), | 235 | readl(fb->regs + CLCD_UBAS), readl(fb->regs + CLCD_LBAS), |
diff --git a/drivers/video/atafb.c b/drivers/video/atafb.c index 497ff8af03ed..8cd279be74e5 100644 --- a/drivers/video/atafb.c +++ b/drivers/video/atafb.c | |||
@@ -2405,6 +2405,9 @@ static int do_fb_set_var(struct fb_var_screeninfo *var, int isactive) | |||
2405 | return 0; | 2405 | return 0; |
2406 | } | 2406 | } |
2407 | 2407 | ||
2408 | /* fbhw->encode_fix() must be called with fb_info->mm_lock held | ||
2409 | * if it is called after the register_framebuffer() - not a case here | ||
2410 | */ | ||
2408 | static int atafb_get_fix(struct fb_fix_screeninfo *fix, struct fb_info *info) | 2411 | static int atafb_get_fix(struct fb_fix_screeninfo *fix, struct fb_info *info) |
2409 | { | 2412 | { |
2410 | struct atafb_par par; | 2413 | struct atafb_par par; |
@@ -2414,9 +2417,7 @@ static int atafb_get_fix(struct fb_fix_screeninfo *fix, struct fb_info *info) | |||
2414 | if (err) | 2417 | if (err) |
2415 | return err; | 2418 | return err; |
2416 | memset(fix, 0, sizeof(struct fb_fix_screeninfo)); | 2419 | memset(fix, 0, sizeof(struct fb_fix_screeninfo)); |
2417 | mutex_lock(&info->mm_lock); | ||
2418 | err = fbhw->encode_fix(fix, &par); | 2420 | err = fbhw->encode_fix(fix, &par); |
2419 | mutex_unlock(&info->mm_lock); | ||
2420 | return err; | 2421 | return err; |
2421 | } | 2422 | } |
2422 | 2423 | ||
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index cb88394ba995..da05f0801bb7 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c | |||
@@ -261,6 +261,9 @@ static inline void atmel_lcdfb_free_video_memory(struct atmel_lcdfb_info *sinfo) | |||
261 | /** | 261 | /** |
262 | * atmel_lcdfb_alloc_video_memory - Allocate framebuffer memory | 262 | * atmel_lcdfb_alloc_video_memory - Allocate framebuffer memory |
263 | * @sinfo: the frame buffer to allocate memory for | 263 | * @sinfo: the frame buffer to allocate memory for |
264 | * | ||
265 | * This function is called only from the atmel_lcdfb_probe() | ||
266 | * so no locking by fb_info->mm_lock around smem_len setting is needed. | ||
264 | */ | 267 | */ |
265 | static int atmel_lcdfb_alloc_video_memory(struct atmel_lcdfb_info *sinfo) | 268 | static int atmel_lcdfb_alloc_video_memory(struct atmel_lcdfb_info *sinfo) |
266 | { | 269 | { |
@@ -270,9 +273,7 @@ static int atmel_lcdfb_alloc_video_memory(struct atmel_lcdfb_info *sinfo) | |||
270 | 273 | ||
271 | smem_len = (var->xres_virtual * var->yres_virtual | 274 | smem_len = (var->xres_virtual * var->yres_virtual |
272 | * ((var->bits_per_pixel + 7) / 8)); | 275 | * ((var->bits_per_pixel + 7) / 8)); |
273 | mutex_lock(&info->mm_lock); | ||
274 | info->fix.smem_len = max(smem_len, sinfo->smem_len); | 276 | info->fix.smem_len = max(smem_len, sinfo->smem_len); |
275 | mutex_unlock(&info->mm_lock); | ||
276 | 277 | ||
277 | info->screen_base = dma_alloc_writecombine(info->device, info->fix.smem_len, | 278 | info->screen_base = dma_alloc_writecombine(info->device, info->fix.smem_len, |
278 | (dma_addr_t *)&info->fix.smem_start, GFP_KERNEL); | 279 | (dma_addr_t *)&info->fix.smem_start, GFP_KERNEL); |
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 53ea05645ff8..a85c818be945 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/compat.h> | 16 | #include <linux/compat.h> |
17 | #include <linux/types.h> | 17 | #include <linux/types.h> |
18 | #include <linux/errno.h> | 18 | #include <linux/errno.h> |
19 | #include <linux/smp_lock.h> | ||
20 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
21 | #include <linux/major.h> | 20 | #include <linux/major.h> |
22 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c index 0bf2190928d0..72d68b3dc478 100644 --- a/drivers/video/fsl-diu-fb.c +++ b/drivers/video/fsl-diu-fb.c | |||
@@ -1223,12 +1223,6 @@ static int __devinit install_fb(struct fb_info *info) | |||
1223 | return -EINVAL; | 1223 | return -EINVAL; |
1224 | } | 1224 | } |
1225 | 1225 | ||
1226 | if (fsl_diu_set_par(info)) { | ||
1227 | printk(KERN_ERR "fb_set_par failed"); | ||
1228 | fb_dealloc_cmap(&info->cmap); | ||
1229 | return -EINVAL; | ||
1230 | } | ||
1231 | |||
1232 | if (register_framebuffer(info) < 0) { | 1226 | if (register_framebuffer(info) < 0) { |
1233 | printk(KERN_ERR "register_framebuffer failed"); | 1227 | printk(KERN_ERR "register_framebuffer failed"); |
1234 | unmap_video_memory(info); | 1228 | unmap_video_memory(info); |
diff --git a/drivers/video/hitfb.c b/drivers/video/hitfb.c index 020db7fc9153..e7116a6d82d3 100644 --- a/drivers/video/hitfb.c +++ b/drivers/video/hitfb.c | |||
@@ -44,9 +44,6 @@ static struct fb_fix_screeninfo hitfb_fix __initdata = { | |||
44 | .accel = FB_ACCEL_NONE, | 44 | .accel = FB_ACCEL_NONE, |
45 | }; | 45 | }; |
46 | 46 | ||
47 | static u32 pseudo_palette[16]; | ||
48 | static struct fb_info fb_info; | ||
49 | |||
50 | static inline void hitfb_accel_wait(void) | 47 | static inline void hitfb_accel_wait(void) |
51 | { | 48 | { |
52 | while (fb_readw(HD64461_GRCFGR) & HD64461_GRCFGR_ACCSTATUS) ; | 49 | while (fb_readw(HD64461_GRCFGR) & HD64461_GRCFGR_ACCSTATUS) ; |
@@ -331,6 +328,8 @@ static struct fb_ops hitfb_ops = { | |||
331 | static int __init hitfb_probe(struct platform_device *dev) | 328 | static int __init hitfb_probe(struct platform_device *dev) |
332 | { | 329 | { |
333 | unsigned short lcdclor, ldr3, ldvndr; | 330 | unsigned short lcdclor, ldr3, ldvndr; |
331 | struct fb_info *info; | ||
332 | int ret; | ||
334 | 333 | ||
335 | if (fb_get_options("hitfb", NULL)) | 334 | if (fb_get_options("hitfb", NULL)) |
336 | return -ENODEV; | 335 | return -ENODEV; |
@@ -384,32 +383,53 @@ static int __init hitfb_probe(struct platform_device *dev) | |||
384 | break; | 383 | break; |
385 | } | 384 | } |
386 | 385 | ||
387 | fb_info.fbops = &hitfb_ops; | 386 | info = framebuffer_alloc(sizeof(u32) * 16, &dev->dev); |
388 | fb_info.var = hitfb_var; | 387 | if (unlikely(!info)) |
389 | fb_info.fix = hitfb_fix; | 388 | return -ENOMEM; |
390 | fb_info.pseudo_palette = pseudo_palette; | 389 | |
391 | fb_info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN | | 390 | info->fbops = &hitfb_ops; |
391 | info->var = hitfb_var; | ||
392 | info->fix = hitfb_fix; | ||
393 | info->pseudo_palette = info->par; | ||
394 | info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN | | ||
392 | FBINFO_HWACCEL_FILLRECT | FBINFO_HWACCEL_COPYAREA; | 395 | FBINFO_HWACCEL_FILLRECT | FBINFO_HWACCEL_COPYAREA; |
393 | 396 | ||
394 | fb_info.screen_base = (void *)hitfb_fix.smem_start; | 397 | info->screen_base = (void *)hitfb_fix.smem_start; |
395 | 398 | ||
396 | fb_alloc_cmap(&fb_info.cmap, 256, 0); | 399 | ret = fb_alloc_cmap(&info->cmap, 256, 0); |
400 | if (unlikely(ret < 0)) | ||
401 | goto err_fb; | ||
397 | 402 | ||
398 | if (register_framebuffer(&fb_info) < 0) | 403 | ret = register_framebuffer(info); |
399 | return -EINVAL; | 404 | if (unlikely(ret < 0)) |
405 | goto err; | ||
406 | |||
407 | platform_set_drvdata(dev, info); | ||
400 | 408 | ||
401 | printk(KERN_INFO "fb%d: %s frame buffer device\n", | 409 | printk(KERN_INFO "fb%d: %s frame buffer device\n", |
402 | fb_info.node, fb_info.fix.id); | 410 | info->node, info->fix.id); |
411 | |||
403 | return 0; | 412 | return 0; |
413 | |||
414 | err: | ||
415 | fb_dealloc_cmap(&info->cmap); | ||
416 | err_fb: | ||
417 | framebuffer_release(info); | ||
418 | return ret; | ||
404 | } | 419 | } |
405 | 420 | ||
406 | static int __exit hitfb_remove(struct platform_device *dev) | 421 | static int __exit hitfb_remove(struct platform_device *dev) |
407 | { | 422 | { |
408 | return unregister_framebuffer(&fb_info); | 423 | struct fb_info *info = platform_get_drvdata(dev); |
424 | |||
425 | unregister_framebuffer(info); | ||
426 | fb_dealloc_cmap(&info->cmap); | ||
427 | framebuffer_release(info); | ||
428 | |||
429 | return 0; | ||
409 | } | 430 | } |
410 | 431 | ||
411 | #ifdef CONFIG_PM | 432 | static int hitfb_suspend(struct device *dev) |
412 | static int hitfb_suspend(struct platform_device *dev, pm_message_t state) | ||
413 | { | 433 | { |
414 | u16 v; | 434 | u16 v; |
415 | 435 | ||
@@ -421,7 +441,7 @@ static int hitfb_suspend(struct platform_device *dev, pm_message_t state) | |||
421 | return 0; | 441 | return 0; |
422 | } | 442 | } |
423 | 443 | ||
424 | static int hitfb_resume(struct platform_device *dev) | 444 | static int hitfb_resume(struct device *dev) |
425 | { | 445 | { |
426 | u16 v; | 446 | u16 v; |
427 | 447 | ||
@@ -435,17 +455,19 @@ static int hitfb_resume(struct platform_device *dev) | |||
435 | 455 | ||
436 | return 0; | 456 | return 0; |
437 | } | 457 | } |
438 | #endif | 458 | |
459 | static struct dev_pm_ops hitfb_dev_pm_ops = { | ||
460 | .suspend = hitfb_suspend, | ||
461 | .resume = hitfb_resume, | ||
462 | }; | ||
439 | 463 | ||
440 | static struct platform_driver hitfb_driver = { | 464 | static struct platform_driver hitfb_driver = { |
441 | .probe = hitfb_probe, | 465 | .probe = hitfb_probe, |
442 | .remove = __exit_p(hitfb_remove), | 466 | .remove = __exit_p(hitfb_remove), |
443 | #ifdef CONFIG_PM | ||
444 | .suspend = hitfb_suspend, | ||
445 | .resume = hitfb_resume, | ||
446 | #endif | ||
447 | .driver = { | 467 | .driver = { |
448 | .name = "hitfb", | 468 | .name = "hitfb", |
469 | .owner = THIS_MODULE, | ||
470 | .pm = &hitfb_dev_pm_ops, | ||
449 | }, | 471 | }, |
450 | }; | 472 | }; |
451 | 473 | ||
diff --git a/drivers/video/i810/i810_main.c b/drivers/video/i810/i810_main.c index 71960672d721..5743ea25e818 100644 --- a/drivers/video/i810/i810_main.c +++ b/drivers/video/i810/i810_main.c | |||
@@ -2060,8 +2060,7 @@ static int __devinit i810fb_init_pci (struct pci_dev *dev, | |||
2060 | 2060 | ||
2061 | fb_var_to_videomode(&mode, &info->var); | 2061 | fb_var_to_videomode(&mode, &info->var); |
2062 | fb_add_videomode(&mode, &info->modelist); | 2062 | fb_add_videomode(&mode, &info->modelist); |
2063 | encode_fix(&info->fix, info); | 2063 | |
2064 | |||
2065 | i810fb_init_ringbuffer(info); | 2064 | i810fb_init_ringbuffer(info); |
2066 | err = register_framebuffer(info); | 2065 | err = register_framebuffer(info); |
2067 | 2066 | ||
diff --git a/drivers/video/matrox/matroxfb_DAC1064.c b/drivers/video/matrox/matroxfb_DAC1064.c index 0ce3b0a89798..a74e5da17aa0 100644 --- a/drivers/video/matrox/matroxfb_DAC1064.c +++ b/drivers/video/matrox/matroxfb_DAC1064.c | |||
@@ -454,9 +454,9 @@ static void DAC1064_restore_2(WPMINFO2) { | |||
454 | dprintk(KERN_DEBUG "DAC1064regs "); | 454 | dprintk(KERN_DEBUG "DAC1064regs "); |
455 | for (i = 0; i < sizeof(MGA1064_DAC_regs); i++) { | 455 | for (i = 0; i < sizeof(MGA1064_DAC_regs); i++) { |
456 | dprintk("R%02X=%02X ", MGA1064_DAC_regs[i], ACCESS_FBINFO(hw).DACreg[i]); | 456 | dprintk("R%02X=%02X ", MGA1064_DAC_regs[i], ACCESS_FBINFO(hw).DACreg[i]); |
457 | if ((i & 0x7) == 0x7) dprintk("\n" KERN_DEBUG "continuing... "); | 457 | if ((i & 0x7) == 0x7) dprintk(KERN_DEBUG "continuing... "); |
458 | } | 458 | } |
459 | dprintk("\n" KERN_DEBUG "DAC1064clk "); | 459 | dprintk(KERN_DEBUG "DAC1064clk "); |
460 | for (i = 0; i < 6; i++) | 460 | for (i = 0; i < 6; i++) |
461 | dprintk("C%02X=%02X ", i, ACCESS_FBINFO(hw).DACclk[i]); | 461 | dprintk("C%02X=%02X ", i, ACCESS_FBINFO(hw).DACclk[i]); |
462 | dprintk("\n"); | 462 | dprintk("\n"); |
diff --git a/drivers/video/matrox/matroxfb_Ti3026.c b/drivers/video/matrox/matroxfb_Ti3026.c index 13524821e242..4e825112a601 100644 --- a/drivers/video/matrox/matroxfb_Ti3026.c +++ b/drivers/video/matrox/matroxfb_Ti3026.c | |||
@@ -651,9 +651,9 @@ static void Ti3026_restore(WPMINFO2) { | |||
651 | dprintk(KERN_DEBUG "3026DACregs "); | 651 | dprintk(KERN_DEBUG "3026DACregs "); |
652 | for (i = 0; i < 21; i++) { | 652 | for (i = 0; i < 21; i++) { |
653 | dprintk("R%02X=%02X ", DACseq[i], hw->DACreg[i]); | 653 | dprintk("R%02X=%02X ", DACseq[i], hw->DACreg[i]); |
654 | if ((i & 0x7) == 0x7) dprintk("\n" KERN_DEBUG "continuing... "); | 654 | if ((i & 0x7) == 0x7) dprintk(KERN_DEBUG "continuing... "); |
655 | } | 655 | } |
656 | dprintk("\n" KERN_DEBUG "DACclk "); | 656 | dprintk(KERN_DEBUG "DACclk "); |
657 | for (i = 0; i < 6; i++) | 657 | for (i = 0; i < 6; i++) |
658 | dprintk("C%02X=%02X ", i, hw->DACclk[i]); | 658 | dprintk("C%02X=%02X ", i, hw->DACclk[i]); |
659 | dprintk("\n"); | 659 | dprintk("\n"); |
diff --git a/drivers/video/matrox/matroxfb_base.c b/drivers/video/matrox/matroxfb_base.c index 59c3a2e14913..0c1049b308bf 100644 --- a/drivers/video/matrox/matroxfb_base.c +++ b/drivers/video/matrox/matroxfb_base.c | |||
@@ -1876,7 +1876,6 @@ static int initMatrox2(WPMINFO struct board* b){ | |||
1876 | } | 1876 | } |
1877 | matroxfb_init_fix(PMINFO2); | 1877 | matroxfb_init_fix(PMINFO2); |
1878 | ACCESS_FBINFO(fbcon.screen_base) = vaddr_va(ACCESS_FBINFO(video.vbase)); | 1878 | ACCESS_FBINFO(fbcon.screen_base) = vaddr_va(ACCESS_FBINFO(video.vbase)); |
1879 | matroxfb_update_fix(PMINFO2); | ||
1880 | /* Normalize values (namely yres_virtual) */ | 1879 | /* Normalize values (namely yres_virtual) */ |
1881 | matroxfb_check_var(&vesafb_defined, &ACCESS_FBINFO(fbcon)); | 1880 | matroxfb_check_var(&vesafb_defined, &ACCESS_FBINFO(fbcon)); |
1882 | /* And put it into "current" var. Do NOT program hardware yet, or we'll not take over | 1881 | /* And put it into "current" var. Do NOT program hardware yet, or we'll not take over |
diff --git a/drivers/video/matrox/matroxfb_crtc2.c b/drivers/video/matrox/matroxfb_crtc2.c index 909e10a11898..ebcb5c6b4962 100644 --- a/drivers/video/matrox/matroxfb_crtc2.c +++ b/drivers/video/matrox/matroxfb_crtc2.c | |||
@@ -289,16 +289,18 @@ static int matroxfb_dh_release(struct fb_info* info, int user) { | |||
289 | #undef m2info | 289 | #undef m2info |
290 | } | 290 | } |
291 | 291 | ||
292 | /* | ||
293 | * This function is called before the register_framebuffer so | ||
294 | * no locking is needed. | ||
295 | */ | ||
292 | static void matroxfb_dh_init_fix(struct matroxfb_dh_fb_info *m2info) | 296 | static void matroxfb_dh_init_fix(struct matroxfb_dh_fb_info *m2info) |
293 | { | 297 | { |
294 | struct fb_fix_screeninfo *fix = &m2info->fbcon.fix; | 298 | struct fb_fix_screeninfo *fix = &m2info->fbcon.fix; |
295 | 299 | ||
296 | strcpy(fix->id, "MATROX DH"); | 300 | strcpy(fix->id, "MATROX DH"); |
297 | 301 | ||
298 | mutex_lock(&m2info->fbcon.mm_lock); | ||
299 | fix->smem_start = m2info->video.base; | 302 | fix->smem_start = m2info->video.base; |
300 | fix->smem_len = m2info->video.len_usable; | 303 | fix->smem_len = m2info->video.len_usable; |
301 | mutex_unlock(&m2info->fbcon.mm_lock); | ||
302 | fix->ypanstep = 1; | 304 | fix->ypanstep = 1; |
303 | fix->ywrapstep = 0; | 305 | fix->ywrapstep = 0; |
304 | fix->xpanstep = 8; /* TBD */ | 306 | fix->xpanstep = 8; /* TBD */ |
diff --git a/drivers/video/mx3fb.c b/drivers/video/mx3fb.c index 567fb944bd2a..f8778cde2183 100644 --- a/drivers/video/mx3fb.c +++ b/drivers/video/mx3fb.c | |||
@@ -1365,11 +1365,6 @@ static int init_fb_chan(struct mx3fb_data *mx3fb, struct idmac_channel *ichan) | |||
1365 | init_completion(&mx3fbi->flip_cmpl); | 1365 | init_completion(&mx3fbi->flip_cmpl); |
1366 | disable_irq(ichan->eof_irq); | 1366 | disable_irq(ichan->eof_irq); |
1367 | dev_dbg(mx3fb->dev, "disabling irq %d\n", ichan->eof_irq); | 1367 | dev_dbg(mx3fb->dev, "disabling irq %d\n", ichan->eof_irq); |
1368 | ret = mx3fb_set_par(fbi); | ||
1369 | if (ret < 0) | ||
1370 | goto esetpar; | ||
1371 | |||
1372 | mx3fb_blank(FB_BLANK_UNBLANK, fbi); | ||
1373 | 1368 | ||
1374 | dev_info(dev, "registered, using mode %s\n", fb_mode); | 1369 | dev_info(dev, "registered, using mode %s\n", fb_mode); |
1375 | 1370 | ||
diff --git a/drivers/video/omap/omapfb_main.c b/drivers/video/omap/omapfb_main.c index 4ea99bfc37b4..8862233d57b6 100644 --- a/drivers/video/omap/omapfb_main.c +++ b/drivers/video/omap/omapfb_main.c | |||
@@ -1254,7 +1254,7 @@ static struct fb_ops omapfb_ops = { | |||
1254 | static ssize_t omapfb_show_caps_num(struct device *dev, | 1254 | static ssize_t omapfb_show_caps_num(struct device *dev, |
1255 | struct device_attribute *attr, char *buf) | 1255 | struct device_attribute *attr, char *buf) |
1256 | { | 1256 | { |
1257 | struct omapfb_device *fbdev = (struct omapfb_device *)dev->driver_data; | 1257 | struct omapfb_device *fbdev = dev_get_drvdata(dev); |
1258 | int plane; | 1258 | int plane; |
1259 | size_t size; | 1259 | size_t size; |
1260 | struct omapfb_caps caps; | 1260 | struct omapfb_caps caps; |
@@ -1274,7 +1274,7 @@ static ssize_t omapfb_show_caps_num(struct device *dev, | |||
1274 | static ssize_t omapfb_show_caps_text(struct device *dev, | 1274 | static ssize_t omapfb_show_caps_text(struct device *dev, |
1275 | struct device_attribute *attr, char *buf) | 1275 | struct device_attribute *attr, char *buf) |
1276 | { | 1276 | { |
1277 | struct omapfb_device *fbdev = (struct omapfb_device *)dev->driver_data; | 1277 | struct omapfb_device *fbdev = dev_get_drvdata(dev); |
1278 | int i; | 1278 | int i; |
1279 | struct omapfb_caps caps; | 1279 | struct omapfb_caps caps; |
1280 | int plane; | 1280 | int plane; |
@@ -1321,7 +1321,7 @@ static DEVICE_ATTR(caps_text, 0444, omapfb_show_caps_text, NULL); | |||
1321 | static ssize_t omapfb_show_panel_name(struct device *dev, | 1321 | static ssize_t omapfb_show_panel_name(struct device *dev, |
1322 | struct device_attribute *attr, char *buf) | 1322 | struct device_attribute *attr, char *buf) |
1323 | { | 1323 | { |
1324 | struct omapfb_device *fbdev = (struct omapfb_device *)dev->driver_data; | 1324 | struct omapfb_device *fbdev = dev_get_drvdata(dev); |
1325 | 1325 | ||
1326 | return snprintf(buf, PAGE_SIZE, "%s\n", fbdev->panel->name); | 1326 | return snprintf(buf, PAGE_SIZE, "%s\n", fbdev->panel->name); |
1327 | } | 1327 | } |
@@ -1330,7 +1330,7 @@ static ssize_t omapfb_show_bklight_level(struct device *dev, | |||
1330 | struct device_attribute *attr, | 1330 | struct device_attribute *attr, |
1331 | char *buf) | 1331 | char *buf) |
1332 | { | 1332 | { |
1333 | struct omapfb_device *fbdev = (struct omapfb_device *)dev->driver_data; | 1333 | struct omapfb_device *fbdev = dev_get_drvdata(dev); |
1334 | int r; | 1334 | int r; |
1335 | 1335 | ||
1336 | if (fbdev->panel->get_bklight_level) { | 1336 | if (fbdev->panel->get_bklight_level) { |
@@ -1345,7 +1345,7 @@ static ssize_t omapfb_store_bklight_level(struct device *dev, | |||
1345 | struct device_attribute *attr, | 1345 | struct device_attribute *attr, |
1346 | const char *buf, size_t size) | 1346 | const char *buf, size_t size) |
1347 | { | 1347 | { |
1348 | struct omapfb_device *fbdev = (struct omapfb_device *)dev->driver_data; | 1348 | struct omapfb_device *fbdev = dev_get_drvdata(dev); |
1349 | int r; | 1349 | int r; |
1350 | 1350 | ||
1351 | if (fbdev->panel->set_bklight_level) { | 1351 | if (fbdev->panel->set_bklight_level) { |
@@ -1364,7 +1364,7 @@ static ssize_t omapfb_store_bklight_level(struct device *dev, | |||
1364 | static ssize_t omapfb_show_bklight_max(struct device *dev, | 1364 | static ssize_t omapfb_show_bklight_max(struct device *dev, |
1365 | struct device_attribute *attr, char *buf) | 1365 | struct device_attribute *attr, char *buf) |
1366 | { | 1366 | { |
1367 | struct omapfb_device *fbdev = (struct omapfb_device *)dev->driver_data; | 1367 | struct omapfb_device *fbdev = dev_get_drvdata(dev); |
1368 | int r; | 1368 | int r; |
1369 | 1369 | ||
1370 | if (fbdev->panel->get_bklight_level) { | 1370 | if (fbdev->panel->get_bklight_level) { |
@@ -1397,7 +1397,7 @@ static struct attribute_group panel_attr_grp = { | |||
1397 | static ssize_t omapfb_show_ctrl_name(struct device *dev, | 1397 | static ssize_t omapfb_show_ctrl_name(struct device *dev, |
1398 | struct device_attribute *attr, char *buf) | 1398 | struct device_attribute *attr, char *buf) |
1399 | { | 1399 | { |
1400 | struct omapfb_device *fbdev = (struct omapfb_device *)dev->driver_data; | 1400 | struct omapfb_device *fbdev = dev_get_drvdata(dev); |
1401 | 1401 | ||
1402 | return snprintf(buf, PAGE_SIZE, "%s\n", fbdev->ctrl->name); | 1402 | return snprintf(buf, PAGE_SIZE, "%s\n", fbdev->ctrl->name); |
1403 | } | 1403 | } |
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c index 43680e545427..bb63c07e13de 100644 --- a/drivers/video/s3c-fb.c +++ b/drivers/video/s3c-fb.c | |||
@@ -211,23 +211,21 @@ static int s3c_fb_check_var(struct fb_var_screeninfo *var, | |||
211 | 211 | ||
212 | /** | 212 | /** |
213 | * s3c_fb_calc_pixclk() - calculate the divider to create the pixel clock. | 213 | * s3c_fb_calc_pixclk() - calculate the divider to create the pixel clock. |
214 | * @id: window id. | ||
214 | * @sfb: The hardware state. | 215 | * @sfb: The hardware state. |
215 | * @pixclock: The pixel clock wanted, in picoseconds. | 216 | * @pixclock: The pixel clock wanted, in picoseconds. |
216 | * | 217 | * |
217 | * Given the specified pixel clock, work out the necessary divider to get | 218 | * Given the specified pixel clock, work out the necessary divider to get |
218 | * close to the output frequency. | 219 | * close to the output frequency. |
219 | */ | 220 | */ |
220 | static int s3c_fb_calc_pixclk(struct s3c_fb *sfb, unsigned int pixclk) | 221 | static int s3c_fb_calc_pixclk(unsigned char id, struct s3c_fb *sfb, unsigned int pixclk) |
221 | { | 222 | { |
223 | struct s3c_fb_pd_win *win = sfb->pdata->win[id]; | ||
222 | unsigned long clk = clk_get_rate(sfb->bus_clk); | 224 | unsigned long clk = clk_get_rate(sfb->bus_clk); |
223 | unsigned long long tmp; | ||
224 | unsigned int result; | 225 | unsigned int result; |
225 | 226 | ||
226 | tmp = (unsigned long long)clk; | 227 | pixclk *= win->win_mode.refresh; |
227 | tmp *= pixclk; | 228 | result = clk / pixclk; |
228 | |||
229 | do_div(tmp, 1000000000UL); | ||
230 | result = (unsigned int)tmp / 1000; | ||
231 | 229 | ||
232 | dev_dbg(sfb->dev, "pixclk=%u, clk=%lu, div=%d (%lu)\n", | 230 | dev_dbg(sfb->dev, "pixclk=%u, clk=%lu, div=%d (%lu)\n", |
233 | pixclk, clk, result, clk / result); | 231 | pixclk, clk, result, clk / result); |
@@ -267,6 +265,7 @@ static int s3c_fb_set_par(struct fb_info *info) | |||
267 | struct s3c_fb *sfb = win->parent; | 265 | struct s3c_fb *sfb = win->parent; |
268 | void __iomem *regs = sfb->regs; | 266 | void __iomem *regs = sfb->regs; |
269 | int win_no = win->index; | 267 | int win_no = win->index; |
268 | u32 osdc_data = 0; | ||
270 | u32 data; | 269 | u32 data; |
271 | u32 pagewidth; | 270 | u32 pagewidth; |
272 | int clkdiv; | 271 | int clkdiv; |
@@ -302,7 +301,7 @@ static int s3c_fb_set_par(struct fb_info *info) | |||
302 | /* use window 0 as the basis for the lcd output timings */ | 301 | /* use window 0 as the basis for the lcd output timings */ |
303 | 302 | ||
304 | if (win_no == 0) { | 303 | if (win_no == 0) { |
305 | clkdiv = s3c_fb_calc_pixclk(sfb, var->pixclock); | 304 | clkdiv = s3c_fb_calc_pixclk(win_no, sfb, var->pixclock); |
306 | 305 | ||
307 | data = sfb->pdata->vidcon0; | 306 | data = sfb->pdata->vidcon0; |
308 | data &= ~(VIDCON0_CLKVAL_F_MASK | VIDCON0_CLKDIR); | 307 | data &= ~(VIDCON0_CLKVAL_F_MASK | VIDCON0_CLKDIR); |
@@ -359,8 +358,6 @@ static int s3c_fb_set_par(struct fb_info *info) | |||
359 | 358 | ||
360 | data = var->xres * var->yres; | 359 | data = var->xres * var->yres; |
361 | 360 | ||
362 | u32 osdc_data = 0; | ||
363 | |||
364 | osdc_data = VIDISD14C_ALPHA1_R(0xf) | | 361 | osdc_data = VIDISD14C_ALPHA1_R(0xf) | |
365 | VIDISD14C_ALPHA1_G(0xf) | | 362 | VIDISD14C_ALPHA1_G(0xf) | |
366 | VIDISD14C_ALPHA1_B(0xf); | 363 | VIDISD14C_ALPHA1_B(0xf); |
diff --git a/drivers/video/sh_mobile_lcdcfb.c b/drivers/video/sh_mobile_lcdcfb.c index da983b720f08..8f24564f77b0 100644 --- a/drivers/video/sh_mobile_lcdcfb.c +++ b/drivers/video/sh_mobile_lcdcfb.c | |||
@@ -31,7 +31,7 @@ struct sh_mobile_lcdc_chan { | |||
31 | unsigned long enabled; /* ME and SE in LDCNT2R */ | 31 | unsigned long enabled; /* ME and SE in LDCNT2R */ |
32 | struct sh_mobile_lcdc_chan_cfg cfg; | 32 | struct sh_mobile_lcdc_chan_cfg cfg; |
33 | u32 pseudo_palette[PALETTE_NR]; | 33 | u32 pseudo_palette[PALETTE_NR]; |
34 | struct fb_info info; | 34 | struct fb_info *info; |
35 | dma_addr_t dma_handle; | 35 | dma_addr_t dma_handle; |
36 | struct fb_deferred_io defio; | 36 | struct fb_deferred_io defio; |
37 | struct scatterlist *sglist; | 37 | struct scatterlist *sglist; |
@@ -442,22 +442,22 @@ static int sh_mobile_lcdc_start(struct sh_mobile_lcdc_priv *priv) | |||
442 | /* set bpp format in PKF[4:0] */ | 442 | /* set bpp format in PKF[4:0] */ |
443 | tmp = lcdc_read_chan(ch, LDDFR); | 443 | tmp = lcdc_read_chan(ch, LDDFR); |
444 | tmp &= ~(0x0001001f); | 444 | tmp &= ~(0x0001001f); |
445 | tmp |= (priv->ch[k].info.var.bits_per_pixel == 16) ? 3 : 0; | 445 | tmp |= (ch->info->var.bits_per_pixel == 16) ? 3 : 0; |
446 | lcdc_write_chan(ch, LDDFR, tmp); | 446 | lcdc_write_chan(ch, LDDFR, tmp); |
447 | 447 | ||
448 | /* point out our frame buffer */ | 448 | /* point out our frame buffer */ |
449 | lcdc_write_chan(ch, LDSA1R, ch->info.fix.smem_start); | 449 | lcdc_write_chan(ch, LDSA1R, ch->info->fix.smem_start); |
450 | 450 | ||
451 | /* set line size */ | 451 | /* set line size */ |
452 | lcdc_write_chan(ch, LDMLSR, ch->info.fix.line_length); | 452 | lcdc_write_chan(ch, LDMLSR, ch->info->fix.line_length); |
453 | 453 | ||
454 | /* setup deferred io if SYS bus */ | 454 | /* setup deferred io if SYS bus */ |
455 | tmp = ch->cfg.sys_bus_cfg.deferred_io_msec; | 455 | tmp = ch->cfg.sys_bus_cfg.deferred_io_msec; |
456 | if (ch->ldmt1r_value & (1 << 12) && tmp) { | 456 | if (ch->ldmt1r_value & (1 << 12) && tmp) { |
457 | ch->defio.deferred_io = sh_mobile_lcdc_deferred_io; | 457 | ch->defio.deferred_io = sh_mobile_lcdc_deferred_io; |
458 | ch->defio.delay = msecs_to_jiffies(tmp); | 458 | ch->defio.delay = msecs_to_jiffies(tmp); |
459 | ch->info.fbdefio = &ch->defio; | 459 | ch->info->fbdefio = &ch->defio; |
460 | fb_deferred_io_init(&ch->info); | 460 | fb_deferred_io_init(ch->info); |
461 | 461 | ||
462 | /* one-shot mode */ | 462 | /* one-shot mode */ |
463 | lcdc_write_chan(ch, LDSM1R, 1); | 463 | lcdc_write_chan(ch, LDSM1R, 1); |
@@ -503,12 +503,12 @@ static void sh_mobile_lcdc_stop(struct sh_mobile_lcdc_priv *priv) | |||
503 | * flush frame, and wait for frame end interrupt | 503 | * flush frame, and wait for frame end interrupt |
504 | * clean up deferred io and enable clock | 504 | * clean up deferred io and enable clock |
505 | */ | 505 | */ |
506 | if (ch->info.fbdefio) { | 506 | if (ch->info->fbdefio) { |
507 | ch->frame_end = 0; | 507 | ch->frame_end = 0; |
508 | schedule_delayed_work(&ch->info.deferred_work, 0); | 508 | schedule_delayed_work(&ch->info->deferred_work, 0); |
509 | wait_event(ch->frame_end_wait, ch->frame_end); | 509 | wait_event(ch->frame_end_wait, ch->frame_end); |
510 | fb_deferred_io_cleanup(&ch->info); | 510 | fb_deferred_io_cleanup(ch->info); |
511 | ch->info.fbdefio = NULL; | 511 | ch->info->fbdefio = NULL; |
512 | sh_mobile_lcdc_clk_on(priv); | 512 | sh_mobile_lcdc_clk_on(priv); |
513 | } | 513 | } |
514 | 514 | ||
@@ -817,9 +817,16 @@ static int __init sh_mobile_lcdc_probe(struct platform_device *pdev) | |||
817 | priv->base = ioremap_nocache(res->start, (res->end - res->start) + 1); | 817 | priv->base = ioremap_nocache(res->start, (res->end - res->start) + 1); |
818 | 818 | ||
819 | for (i = 0; i < j; i++) { | 819 | for (i = 0; i < j; i++) { |
820 | info = &priv->ch[i].info; | ||
821 | cfg = &priv->ch[i].cfg; | 820 | cfg = &priv->ch[i].cfg; |
822 | 821 | ||
822 | priv->ch[i].info = framebuffer_alloc(0, &pdev->dev); | ||
823 | if (!priv->ch[i].info) { | ||
824 | dev_err(&pdev->dev, "unable to allocate fb_info\n"); | ||
825 | error = -ENOMEM; | ||
826 | break; | ||
827 | } | ||
828 | |||
829 | info = priv->ch[i].info; | ||
823 | info->fbops = &sh_mobile_lcdc_ops; | 830 | info->fbops = &sh_mobile_lcdc_ops; |
824 | info->var.xres = info->var.xres_virtual = cfg->lcd_cfg.xres; | 831 | info->var.xres = info->var.xres_virtual = cfg->lcd_cfg.xres; |
825 | info->var.yres = info->var.yres_virtual = cfg->lcd_cfg.yres; | 832 | info->var.yres = info->var.yres_virtual = cfg->lcd_cfg.yres; |
@@ -872,7 +879,7 @@ static int __init sh_mobile_lcdc_probe(struct platform_device *pdev) | |||
872 | for (i = 0; i < j; i++) { | 879 | for (i = 0; i < j; i++) { |
873 | struct sh_mobile_lcdc_chan *ch = priv->ch + i; | 880 | struct sh_mobile_lcdc_chan *ch = priv->ch + i; |
874 | 881 | ||
875 | info = &ch->info; | 882 | info = ch->info; |
876 | 883 | ||
877 | if (info->fbdefio) { | 884 | if (info->fbdefio) { |
878 | priv->ch->sglist = vmalloc(sizeof(struct scatterlist) * | 885 | priv->ch->sglist = vmalloc(sizeof(struct scatterlist) * |
@@ -915,15 +922,15 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev) | |||
915 | int i; | 922 | int i; |
916 | 923 | ||
917 | for (i = 0; i < ARRAY_SIZE(priv->ch); i++) | 924 | for (i = 0; i < ARRAY_SIZE(priv->ch); i++) |
918 | if (priv->ch[i].info.dev) | 925 | if (priv->ch[i].info->dev) |
919 | unregister_framebuffer(&priv->ch[i].info); | 926 | unregister_framebuffer(priv->ch[i].info); |
920 | 927 | ||
921 | sh_mobile_lcdc_stop(priv); | 928 | sh_mobile_lcdc_stop(priv); |
922 | 929 | ||
923 | for (i = 0; i < ARRAY_SIZE(priv->ch); i++) { | 930 | for (i = 0; i < ARRAY_SIZE(priv->ch); i++) { |
924 | info = &priv->ch[i].info; | 931 | info = priv->ch[i].info; |
925 | 932 | ||
926 | if (!info->device) | 933 | if (!info || !info->device) |
927 | continue; | 934 | continue; |
928 | 935 | ||
929 | if (priv->ch[i].sglist) | 936 | if (priv->ch[i].sglist) |
@@ -932,6 +939,7 @@ static int sh_mobile_lcdc_remove(struct platform_device *pdev) | |||
932 | dma_free_coherent(&pdev->dev, info->fix.smem_len, | 939 | dma_free_coherent(&pdev->dev, info->fix.smem_len, |
933 | info->screen_base, priv->ch[i].dma_handle); | 940 | info->screen_base, priv->ch[i].dma_handle); |
934 | fb_dealloc_cmap(&info->cmap); | 941 | fb_dealloc_cmap(&info->cmap); |
942 | framebuffer_release(info); | ||
935 | } | 943 | } |
936 | 944 | ||
937 | #ifdef CONFIG_HAVE_CLK | 945 | #ifdef CONFIG_HAVE_CLK |
diff --git a/drivers/video/sis/sis_main.c b/drivers/video/sis/sis_main.c index fd33455389b8..4a067f0d0ceb 100644 --- a/drivers/video/sis/sis_main.c +++ b/drivers/video/sis/sis_main.c | |||
@@ -6367,7 +6367,6 @@ error_3: vfree(ivideo->bios_abase); | |||
6367 | sis_fb_info->fix = ivideo->sisfb_fix; | 6367 | sis_fb_info->fix = ivideo->sisfb_fix; |
6368 | sis_fb_info->screen_base = ivideo->video_vbase + ivideo->video_offset; | 6368 | sis_fb_info->screen_base = ivideo->video_vbase + ivideo->video_offset; |
6369 | sis_fb_info->fbops = &sisfb_ops; | 6369 | sis_fb_info->fbops = &sisfb_ops; |
6370 | sisfb_get_fix(&sis_fb_info->fix, -1, sis_fb_info); | ||
6371 | sis_fb_info->pseudo_palette = ivideo->pseudo_palette; | 6370 | sis_fb_info->pseudo_palette = ivideo->pseudo_palette; |
6372 | 6371 | ||
6373 | fb_alloc_cmap(&sis_fb_info->cmap, 256 , 0); | 6372 | fb_alloc_cmap(&sis_fb_info->cmap, 256 , 0); |
diff --git a/drivers/video/sm501fb.c b/drivers/video/sm501fb.c index 16d4f4c7d52b..924d79462780 100644 --- a/drivers/video/sm501fb.c +++ b/drivers/video/sm501fb.c | |||
@@ -1540,9 +1540,6 @@ static int sm501fb_init_fb(struct fb_info *fb, | |||
1540 | if (ret) | 1540 | if (ret) |
1541 | dev_err(info->dev, "check_var() failed on initial setup?\n"); | 1541 | dev_err(info->dev, "check_var() failed on initial setup?\n"); |
1542 | 1542 | ||
1543 | /* ensure we've activated our new configuration */ | ||
1544 | (fb->fbops->fb_set_par)(fb); | ||
1545 | |||
1546 | return 0; | 1543 | return 0; |
1547 | } | 1544 | } |
1548 | 1545 | ||
diff --git a/drivers/video/stifb.c b/drivers/video/stifb.c index eec9dcb7f599..6120f0c526fe 100644 --- a/drivers/video/stifb.c +++ b/drivers/video/stifb.c | |||
@@ -1115,10 +1115,9 @@ static int __init stifb_init_fb(struct sti_struct *sti, int bpp_pref) | |||
1115 | if the device name contains the string "DX" and tell the | 1115 | if the device name contains the string "DX" and tell the |
1116 | user how to reconfigure the card. */ | 1116 | user how to reconfigure the card. */ |
1117 | if (strstr(sti->outptr.dev_name, "DX")) { | 1117 | if (strstr(sti->outptr.dev_name, "DX")) { |
1118 | printk(KERN_WARNING "WARNING: stifb framebuffer driver does not " | 1118 | printk(KERN_WARNING |
1119 | "support '%s' in double-buffer mode.\n" | 1119 | "WARNING: stifb framebuffer driver does not support '%s' in double-buffer mode.\n" |
1120 | KERN_WARNING "WARNING: Please disable the double-buffer mode " | 1120 | "WARNING: Please disable the double-buffer mode in IPL menu (the PARISC-BIOS).\n", |
1121 | "in IPL menu (the PARISC-BIOS).\n", | ||
1122 | sti->outptr.dev_name); | 1121 | sti->outptr.dev_name); |
1123 | goto out_err0; | 1122 | goto out_err0; |
1124 | } | 1123 | } |
diff --git a/drivers/video/w100fb.c b/drivers/video/w100fb.c index 8a141c2c637b..2376f688ec8b 100644 --- a/drivers/video/w100fb.c +++ b/drivers/video/w100fb.c | |||
@@ -748,8 +748,6 @@ int __init w100fb_probe(struct platform_device *pdev) | |||
748 | goto out; | 748 | goto out; |
749 | } | 749 | } |
750 | 750 | ||
751 | w100fb_set_par(info); | ||
752 | |||
753 | if (register_framebuffer(info) < 0) { | 751 | if (register_framebuffer(info) < 0) { |
754 | err = -EINVAL; | 752 | err = -EINVAL; |
755 | goto out; | 753 | goto out; |
diff --git a/drivers/vlynq/Kconfig b/drivers/vlynq/Kconfig index f6542211db48..a9efb1625321 100644 --- a/drivers/vlynq/Kconfig +++ b/drivers/vlynq/Kconfig | |||
@@ -13,7 +13,7 @@ config VLYNQ | |||
13 | 13 | ||
14 | config VLYNQ_DEBUG | 14 | config VLYNQ_DEBUG |
15 | bool "VLYNQ bus debug" | 15 | bool "VLYNQ bus debug" |
16 | depends on VLYNQ && KERNEL_DEBUG | 16 | depends on VLYNQ && DEBUG_KERNEL |
17 | help | 17 | help |
18 | Turn on VLYNQ bus debugging. | 18 | Turn on VLYNQ bus debugging. |
19 | 19 | ||
diff --git a/drivers/vlynq/vlynq.c b/drivers/vlynq/vlynq.c index 7335433b067b..f05d2a368367 100644 --- a/drivers/vlynq/vlynq.c +++ b/drivers/vlynq/vlynq.c | |||
@@ -76,7 +76,7 @@ struct vlynq_regs { | |||
76 | u32 int_device[8]; | 76 | u32 int_device[8]; |
77 | }; | 77 | }; |
78 | 78 | ||
79 | #ifdef VLYNQ_DEBUG | 79 | #ifdef CONFIG_VLYNQ_DEBUG |
80 | static void vlynq_dump_regs(struct vlynq_device *dev) | 80 | static void vlynq_dump_regs(struct vlynq_device *dev) |
81 | { | 81 | { |
82 | int i; | 82 | int i; |
diff --git a/drivers/watchdog/bcm47xx_wdt.c b/drivers/watchdog/bcm47xx_wdt.c index 5c7011cda6a6..751c003864ad 100644 --- a/drivers/watchdog/bcm47xx_wdt.c +++ b/drivers/watchdog/bcm47xx_wdt.c | |||
@@ -161,7 +161,7 @@ static long bcm47xx_wdt_ioctl(struct file *file, | |||
161 | { | 161 | { |
162 | void __user *argp = (void __user *)arg; | 162 | void __user *argp = (void __user *)arg; |
163 | int __user *p = argp; | 163 | int __user *p = argp; |
164 | int new_value, retval = -EINVAL;; | 164 | int new_value, retval = -EINVAL; |
165 | 165 | ||
166 | switch (cmd) { | 166 | switch (cmd) { |
167 | case WDIOC_GETSUPPORT: | 167 | case WDIOC_GETSUPPORT: |
diff --git a/drivers/watchdog/sa1100_wdt.c b/drivers/watchdog/sa1100_wdt.c index ee1caae4d33b..016245419fad 100644 --- a/drivers/watchdog/sa1100_wdt.c +++ b/drivers/watchdog/sa1100_wdt.c | |||
@@ -38,7 +38,7 @@ | |||
38 | 38 | ||
39 | static unsigned long oscr_freq; | 39 | static unsigned long oscr_freq; |
40 | static unsigned long sa1100wdt_users; | 40 | static unsigned long sa1100wdt_users; |
41 | static int pre_margin; | 41 | static unsigned int pre_margin; |
42 | static int boot_status; | 42 | static int boot_status; |
43 | 43 | ||
44 | /* | 44 | /* |
@@ -84,6 +84,7 @@ static const struct watchdog_info ident = { | |||
84 | .options = WDIOF_CARDRESET | WDIOF_SETTIMEOUT | 84 | .options = WDIOF_CARDRESET | WDIOF_SETTIMEOUT |
85 | | WDIOF_KEEPALIVEPING, | 85 | | WDIOF_KEEPALIVEPING, |
86 | .identity = "SA1100/PXA255 Watchdog", | 86 | .identity = "SA1100/PXA255 Watchdog", |
87 | .firmware_version = 1, | ||
87 | }; | 88 | }; |
88 | 89 | ||
89 | static long sa1100dog_ioctl(struct file *file, unsigned int cmd, | 90 | static long sa1100dog_ioctl(struct file *file, unsigned int cmd, |
@@ -118,7 +119,7 @@ static long sa1100dog_ioctl(struct file *file, unsigned int cmd, | |||
118 | if (ret) | 119 | if (ret) |
119 | break; | 120 | break; |
120 | 121 | ||
121 | if (time <= 0 || time > 255) { | 122 | if (time <= 0 || (oscr_freq * (long long)time >= 0xffffffff)) { |
122 | ret = -EINVAL; | 123 | ret = -EINVAL; |
123 | break; | 124 | break; |
124 | } | 125 | } |
diff --git a/drivers/watchdog/w83627hf_wdt.c b/drivers/watchdog/w83627hf_wdt.c index 916890abffdd..f201accc4e3d 100644 --- a/drivers/watchdog/w83627hf_wdt.c +++ b/drivers/watchdog/w83627hf_wdt.c | |||
@@ -89,6 +89,11 @@ static void w83627hf_select_wd_register(void) | |||
89 | c = ((inb_p(WDT_EFDR) & 0xf7) | 0x04); /* select WDT0 */ | 89 | c = ((inb_p(WDT_EFDR) & 0xf7) | 0x04); /* select WDT0 */ |
90 | outb_p(0x2b, WDT_EFER); | 90 | outb_p(0x2b, WDT_EFER); |
91 | outb_p(c, WDT_EFDR); /* set GPIO3 to WDT0 */ | 91 | outb_p(c, WDT_EFDR); /* set GPIO3 to WDT0 */ |
92 | } else if (c == 0x88) { /* W83627EHF */ | ||
93 | outb_p(0x2d, WDT_EFER); /* select GPIO5 */ | ||
94 | c = inb_p(WDT_EFDR) & ~0x01; /* PIN77 -> WDT0# */ | ||
95 | outb_p(0x2d, WDT_EFER); | ||
96 | outb_p(c, WDT_EFDR); /* set GPIO5 to WDT0 */ | ||
92 | } | 97 | } |
93 | 98 | ||
94 | outb_p(0x07, WDT_EFER); /* point to logical device number reg */ | 99 | outb_p(0x07, WDT_EFER); /* point to logical device number reg */ |
diff --git a/drivers/watchdog/w83697ug_wdt.c b/drivers/watchdog/w83697ug_wdt.c index 883b5f79673a..a6c12dec91a1 100644 --- a/drivers/watchdog/w83697ug_wdt.c +++ b/drivers/watchdog/w83697ug_wdt.c | |||
@@ -149,8 +149,10 @@ static void wdt_ctrl(int timeout) | |||
149 | { | 149 | { |
150 | spin_lock(&io_lock); | 150 | spin_lock(&io_lock); |
151 | 151 | ||
152 | if (w83697ug_select_wd_register() < 0) | 152 | if (w83697ug_select_wd_register() < 0) { |
153 | spin_unlock(&io_lock); | ||
153 | return; | 154 | return; |
155 | } | ||
154 | 156 | ||
155 | outb_p(0xF4, WDT_EFER); /* Select CRF4 */ | 157 | outb_p(0xF4, WDT_EFER); /* Select CRF4 */ |
156 | outb_p(timeout, WDT_EFDR); /* Write Timeout counter to CRF4 */ | 158 | outb_p(timeout, WDT_EFDR); /* Write Timeout counter to CRF4 */ |
diff --git a/drivers/xen/events.c b/drivers/xen/events.c index 891d2e90753a..abad71b1632b 100644 --- a/drivers/xen/events.c +++ b/drivers/xen/events.c | |||
@@ -927,9 +927,9 @@ static struct irq_chip xen_dynamic_chip __read_mostly = { | |||
927 | void __init xen_init_IRQ(void) | 927 | void __init xen_init_IRQ(void) |
928 | { | 928 | { |
929 | int i; | 929 | int i; |
930 | size_t size = nr_cpu_ids * sizeof(struct cpu_evtchn_s); | ||
931 | 930 | ||
932 | cpu_evtchn_mask_p = alloc_bootmem(size); | 931 | cpu_evtchn_mask_p = kcalloc(nr_cpu_ids, sizeof(struct cpu_evtchn_s), |
932 | GFP_KERNEL); | ||
933 | BUG_ON(cpu_evtchn_mask_p == NULL); | 933 | BUG_ON(cpu_evtchn_mask_p == NULL); |
934 | 934 | ||
935 | init_evtchn_cpu_bindings(); | 935 | init_evtchn_cpu_bindings(); |
diff --git a/fs/adfs/super.c b/fs/adfs/super.c index aad92f0a1048..6910a98bd73c 100644 --- a/fs/adfs/super.c +++ b/fs/adfs/super.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/parser.h> | 13 | #include <linux/parser.h> |
14 | #include <linux/mount.h> | 14 | #include <linux/mount.h> |
15 | #include <linux/seq_file.h> | 15 | #include <linux/seq_file.h> |
16 | #include <linux/smp_lock.h> | ||
16 | #include <linux/statfs.h> | 17 | #include <linux/statfs.h> |
17 | #include "adfs.h" | 18 | #include "adfs.h" |
18 | #include "dir_f.h" | 19 | #include "dir_f.h" |
diff --git a/fs/afs/dir.c b/fs/afs/dir.c index 9bd757774c9e..88067f36e5e7 100644 --- a/fs/afs/dir.c +++ b/fs/afs/dir.c | |||
@@ -564,7 +564,7 @@ static struct dentry *afs_lookup(struct inode *dir, struct dentry *dentry, | |||
564 | static int afs_d_revalidate(struct dentry *dentry, struct nameidata *nd) | 564 | static int afs_d_revalidate(struct dentry *dentry, struct nameidata *nd) |
565 | { | 565 | { |
566 | struct afs_vnode *vnode, *dir; | 566 | struct afs_vnode *vnode, *dir; |
567 | struct afs_fid fid; | 567 | struct afs_fid uninitialized_var(fid); |
568 | struct dentry *parent; | 568 | struct dentry *parent; |
569 | struct key *key; | 569 | struct key *key; |
570 | void *dir_version; | 570 | void *dir_version; |
diff --git a/fs/afs/mntpt.c b/fs/afs/mntpt.c index c52be53f6946..5ffb570cd3a8 100644 --- a/fs/afs/mntpt.c +++ b/fs/afs/mntpt.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/pagemap.h> | 17 | #include <linux/pagemap.h> |
18 | #include <linux/mount.h> | 18 | #include <linux/mount.h> |
19 | #include <linux/namei.h> | 19 | #include <linux/namei.h> |
20 | #include <linux/mnt_namespace.h> | ||
21 | #include "internal.h" | 20 | #include "internal.h" |
22 | 21 | ||
23 | 22 | ||
diff --git a/fs/afs/super.c b/fs/afs/super.c index ad0514d0115f..e1ea1c240b6a 100644 --- a/fs/afs/super.c +++ b/fs/afs/super.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/module.h> | 18 | #include <linux/module.h> |
19 | #include <linux/init.h> | 19 | #include <linux/init.h> |
20 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
21 | #include <linux/smp_lock.h> | ||
21 | #include <linux/fs.h> | 22 | #include <linux/fs.h> |
22 | #include <linux/pagemap.h> | 23 | #include <linux/pagemap.h> |
23 | #include <linux/parser.h> | 24 | #include <linux/parser.h> |
diff --git a/fs/autofs4/dev-ioctl.c b/fs/autofs4/dev-ioctl.c index f3da2eb51f56..00bf8fcb245f 100644 --- a/fs/autofs4/dev-ioctl.c +++ b/fs/autofs4/dev-ioctl.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/sched.h> | 19 | #include <linux/sched.h> |
20 | #include <linux/compat.h> | 20 | #include <linux/compat.h> |
21 | #include <linux/syscalls.h> | 21 | #include <linux/syscalls.h> |
22 | #include <linux/smp_lock.h> | ||
23 | #include <linux/magic.h> | 22 | #include <linux/magic.h> |
24 | #include <linux/dcache.h> | 23 | #include <linux/dcache.h> |
25 | #include <linux/uaccess.h> | 24 | #include <linux/uaccess.h> |
diff --git a/fs/bfs/dir.c b/fs/bfs/dir.c index 54bd07d44e68..1e41aadb1068 100644 --- a/fs/bfs/dir.c +++ b/fs/bfs/dir.c | |||
@@ -8,7 +8,6 @@ | |||
8 | #include <linux/time.h> | 8 | #include <linux/time.h> |
9 | #include <linux/string.h> | 9 | #include <linux/string.h> |
10 | #include <linux/fs.h> | 10 | #include <linux/fs.h> |
11 | #include <linux/smp_lock.h> | ||
12 | #include <linux/buffer_head.h> | 11 | #include <linux/buffer_head.h> |
13 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
14 | #include "bfs.h" | 13 | #include "bfs.h" |
diff --git a/fs/bfs/file.c b/fs/bfs/file.c index 6a021265f018..88b9a3ff44e4 100644 --- a/fs/bfs/file.c +++ b/fs/bfs/file.c | |||
@@ -11,7 +11,6 @@ | |||
11 | 11 | ||
12 | #include <linux/fs.h> | 12 | #include <linux/fs.h> |
13 | #include <linux/buffer_head.h> | 13 | #include <linux/buffer_head.h> |
14 | #include <linux/smp_lock.h> | ||
15 | #include "bfs.h" | 14 | #include "bfs.h" |
16 | 15 | ||
17 | #undef DEBUG | 16 | #undef DEBUG |
@@ -705,14 +705,13 @@ static struct bio_map_data *bio_alloc_map_data(int nr_segs, int iov_count, | |||
705 | } | 705 | } |
706 | 706 | ||
707 | static int __bio_copy_iov(struct bio *bio, struct bio_vec *iovecs, | 707 | static int __bio_copy_iov(struct bio *bio, struct bio_vec *iovecs, |
708 | struct sg_iovec *iov, int iov_count, int uncopy, | 708 | struct sg_iovec *iov, int iov_count, |
709 | int do_free_page) | 709 | int to_user, int from_user, int do_free_page) |
710 | { | 710 | { |
711 | int ret = 0, i; | 711 | int ret = 0, i; |
712 | struct bio_vec *bvec; | 712 | struct bio_vec *bvec; |
713 | int iov_idx = 0; | 713 | int iov_idx = 0; |
714 | unsigned int iov_off = 0; | 714 | unsigned int iov_off = 0; |
715 | int read = bio_data_dir(bio) == READ; | ||
716 | 715 | ||
717 | __bio_for_each_segment(bvec, bio, i, 0) { | 716 | __bio_for_each_segment(bvec, bio, i, 0) { |
718 | char *bv_addr = page_address(bvec->bv_page); | 717 | char *bv_addr = page_address(bvec->bv_page); |
@@ -727,13 +726,14 @@ static int __bio_copy_iov(struct bio *bio, struct bio_vec *iovecs, | |||
727 | iov_addr = iov[iov_idx].iov_base + iov_off; | 726 | iov_addr = iov[iov_idx].iov_base + iov_off; |
728 | 727 | ||
729 | if (!ret) { | 728 | if (!ret) { |
730 | if (!read && !uncopy) | 729 | if (to_user) |
731 | ret = copy_from_user(bv_addr, iov_addr, | ||
732 | bytes); | ||
733 | if (read && uncopy) | ||
734 | ret = copy_to_user(iov_addr, bv_addr, | 730 | ret = copy_to_user(iov_addr, bv_addr, |
735 | bytes); | 731 | bytes); |
736 | 732 | ||
733 | if (from_user) | ||
734 | ret = copy_from_user(bv_addr, iov_addr, | ||
735 | bytes); | ||
736 | |||
737 | if (ret) | 737 | if (ret) |
738 | ret = -EFAULT; | 738 | ret = -EFAULT; |
739 | } | 739 | } |
@@ -770,7 +770,8 @@ int bio_uncopy_user(struct bio *bio) | |||
770 | 770 | ||
771 | if (!bio_flagged(bio, BIO_NULL_MAPPED)) | 771 | if (!bio_flagged(bio, BIO_NULL_MAPPED)) |
772 | ret = __bio_copy_iov(bio, bmd->iovecs, bmd->sgvecs, | 772 | ret = __bio_copy_iov(bio, bmd->iovecs, bmd->sgvecs, |
773 | bmd->nr_sgvecs, 1, bmd->is_our_pages); | 773 | bmd->nr_sgvecs, bio_data_dir(bio) == READ, |
774 | 0, bmd->is_our_pages); | ||
774 | bio_free_map_data(bmd); | 775 | bio_free_map_data(bmd); |
775 | bio_put(bio); | 776 | bio_put(bio); |
776 | return ret; | 777 | return ret; |
@@ -875,8 +876,9 @@ struct bio *bio_copy_user_iov(struct request_queue *q, | |||
875 | /* | 876 | /* |
876 | * success | 877 | * success |
877 | */ | 878 | */ |
878 | if (!write_to_vm && (!map_data || !map_data->null_mapped)) { | 879 | if ((!write_to_vm && (!map_data || !map_data->null_mapped)) || |
879 | ret = __bio_copy_iov(bio, bio->bi_io_vec, iov, iov_count, 0, 0); | 880 | (map_data && map_data->from_user)) { |
881 | ret = __bio_copy_iov(bio, bio->bi_io_vec, iov, iov_count, 0, 1, 0); | ||
880 | if (ret) | 882 | if (ret) |
881 | goto cleanup; | 883 | goto cleanup; |
882 | } | 884 | } |
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c index de1e2fd32080..9d8ba4d54a37 100644 --- a/fs/btrfs/compression.c +++ b/fs/btrfs/compression.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/time.h> | 26 | #include <linux/time.h> |
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
28 | #include <linux/string.h> | 28 | #include <linux/string.h> |
29 | #include <linux/smp_lock.h> | ||
30 | #include <linux/backing-dev.h> | 29 | #include <linux/backing-dev.h> |
31 | #include <linux/mpage.h> | 30 | #include <linux/mpage.h> |
32 | #include <linux/swap.h> | 31 | #include <linux/swap.h> |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 7c3cd248d8d6..4b833972273a 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/time.h> | 22 | #include <linux/time.h> |
23 | #include <linux/init.h> | 23 | #include <linux/init.h> |
24 | #include <linux/string.h> | 24 | #include <linux/string.h> |
25 | #include <linux/smp_lock.h> | ||
26 | #include <linux/backing-dev.h> | 25 | #include <linux/backing-dev.h> |
27 | #include <linux/mpage.h> | 26 | #include <linux/mpage.h> |
28 | #include <linux/swap.h> | 27 | #include <linux/swap.h> |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 7ffa3d34ea19..791eab19e330 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/time.h> | 26 | #include <linux/time.h> |
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
28 | #include <linux/string.h> | 28 | #include <linux/string.h> |
29 | #include <linux/smp_lock.h> | ||
30 | #include <linux/backing-dev.h> | 29 | #include <linux/backing-dev.h> |
31 | #include <linux/mpage.h> | 30 | #include <linux/mpage.h> |
32 | #include <linux/swap.h> | 31 | #include <linux/swap.h> |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 9f4db848db10..bd88f25889f7 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <linux/time.h> | 27 | #include <linux/time.h> |
28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
29 | #include <linux/string.h> | 29 | #include <linux/string.h> |
30 | #include <linux/smp_lock.h> | ||
31 | #include <linux/backing-dev.h> | 30 | #include <linux/backing-dev.h> |
32 | #include <linux/mount.h> | 31 | #include <linux/mount.h> |
33 | #include <linux/mpage.h> | 32 | #include <linux/mpage.h> |
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index 9f179d4832d5..6d6d06cb6dfc 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/init.h> | 26 | #include <linux/init.h> |
27 | #include <linux/seq_file.h> | 27 | #include <linux/seq_file.h> |
28 | #include <linux/string.h> | 28 | #include <linux/string.h> |
29 | #include <linux/smp_lock.h> | ||
30 | #include <linux/backing-dev.h> | 29 | #include <linux/backing-dev.h> |
31 | #include <linux/mount.h> | 30 | #include <linux/mount.h> |
32 | #include <linux/mpage.h> | 31 | #include <linux/mpage.h> |
diff --git a/fs/char_dev.c b/fs/char_dev.c index b7c9d5187a75..a173551e19d7 100644 --- a/fs/char_dev.c +++ b/fs/char_dev.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <linux/major.h> | 13 | #include <linux/major.h> |
14 | #include <linux/errno.h> | 14 | #include <linux/errno.h> |
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/smp_lock.h> | ||
17 | #include <linux/seq_file.h> | 16 | #include <linux/seq_file.h> |
18 | 17 | ||
19 | #include <linux/kobject.h> | 18 | #include <linux/kobject.h> |
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES index 3a9b7a58a51d..92888aa90749 100644 --- a/fs/cifs/CHANGES +++ b/fs/cifs/CHANGES | |||
@@ -5,7 +5,11 @@ client generated ones by default (mount option "serverino" turned | |||
5 | on by default if server supports it). Add forceuid and forcegid | 5 | on by default if server supports it). Add forceuid and forcegid |
6 | mount options (so that when negotiating unix extensions specifying | 6 | mount options (so that when negotiating unix extensions specifying |
7 | which uid mounted does not immediately force the server's reported | 7 | which uid mounted does not immediately force the server's reported |
8 | uids to be overridden). Add support for scope moutn parm. | 8 | uids to be overridden). Add support for scope mount parm. Improve |
9 | hard link detection to use same inode for both. Do not set | ||
10 | read-only dos attribute on directories (for chmod) since Windows | ||
11 | explorer special cases this attribute bit for directories for | ||
12 | a different purpose. | ||
9 | 13 | ||
10 | Version 1.58 | 14 | Version 1.58 |
11 | ------------ | 15 | ------------ |
diff --git a/fs/cifs/cifs_spnego.c b/fs/cifs/cifs_spnego.c index 4a4581cb2b5e..051caecf7d67 100644 --- a/fs/cifs/cifs_spnego.c +++ b/fs/cifs/cifs_spnego.c | |||
@@ -86,6 +86,9 @@ struct key_type cifs_spnego_key_type = { | |||
86 | /* strlen of ";user=" */ | 86 | /* strlen of ";user=" */ |
87 | #define USER_KEY_LEN 6 | 87 | #define USER_KEY_LEN 6 |
88 | 88 | ||
89 | /* strlen of ";pid=0x" */ | ||
90 | #define PID_KEY_LEN 7 | ||
91 | |||
89 | /* get a key struct with a SPNEGO security blob, suitable for session setup */ | 92 | /* get a key struct with a SPNEGO security blob, suitable for session setup */ |
90 | struct key * | 93 | struct key * |
91 | cifs_get_spnego_key(struct cifsSesInfo *sesInfo) | 94 | cifs_get_spnego_key(struct cifsSesInfo *sesInfo) |
@@ -103,7 +106,8 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo) | |||
103 | IP_KEY_LEN + INET6_ADDRSTRLEN + | 106 | IP_KEY_LEN + INET6_ADDRSTRLEN + |
104 | MAX_MECH_STR_LEN + | 107 | MAX_MECH_STR_LEN + |
105 | UID_KEY_LEN + (sizeof(uid_t) * 2) + | 108 | UID_KEY_LEN + (sizeof(uid_t) * 2) + |
106 | USER_KEY_LEN + strlen(sesInfo->userName) + 1; | 109 | USER_KEY_LEN + strlen(sesInfo->userName) + |
110 | PID_KEY_LEN + (sizeof(pid_t) * 2) + 1; | ||
107 | 111 | ||
108 | spnego_key = ERR_PTR(-ENOMEM); | 112 | spnego_key = ERR_PTR(-ENOMEM); |
109 | description = kzalloc(desc_len, GFP_KERNEL); | 113 | description = kzalloc(desc_len, GFP_KERNEL); |
@@ -141,6 +145,9 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo) | |||
141 | dp = description + strlen(description); | 145 | dp = description + strlen(description); |
142 | sprintf(dp, ";user=%s", sesInfo->userName); | 146 | sprintf(dp, ";user=%s", sesInfo->userName); |
143 | 147 | ||
148 | dp = description + strlen(description); | ||
149 | sprintf(dp, ";pid=0x%x", current->pid); | ||
150 | |||
144 | cFYI(1, ("key description = %s", description)); | 151 | cFYI(1, ("key description = %s", description)); |
145 | spnego_key = request_key(&cifs_spnego_key_type, description, ""); | 152 | spnego_key = request_key(&cifs_spnego_key_type, description, ""); |
146 | 153 | ||
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c index 1403b5d86a73..6941c22398a6 100644 --- a/fs/cifs/cifsacl.c +++ b/fs/cifs/cifsacl.c | |||
@@ -327,7 +327,7 @@ static void dump_ace(struct cifs_ace *pace, char *end_of_acl) | |||
327 | 327 | ||
328 | static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl, | 328 | static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl, |
329 | struct cifs_sid *pownersid, struct cifs_sid *pgrpsid, | 329 | struct cifs_sid *pownersid, struct cifs_sid *pgrpsid, |
330 | struct inode *inode) | 330 | struct cifs_fattr *fattr) |
331 | { | 331 | { |
332 | int i; | 332 | int i; |
333 | int num_aces = 0; | 333 | int num_aces = 0; |
@@ -340,7 +340,7 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl, | |||
340 | if (!pdacl) { | 340 | if (!pdacl) { |
341 | /* no DACL in the security descriptor, set | 341 | /* no DACL in the security descriptor, set |
342 | all the permissions for user/group/other */ | 342 | all the permissions for user/group/other */ |
343 | inode->i_mode |= S_IRWXUGO; | 343 | fattr->cf_mode |= S_IRWXUGO; |
344 | return; | 344 | return; |
345 | } | 345 | } |
346 | 346 | ||
@@ -357,7 +357,7 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl, | |||
357 | /* reset rwx permissions for user/group/other. | 357 | /* reset rwx permissions for user/group/other. |
358 | Also, if num_aces is 0 i.e. DACL has no ACEs, | 358 | Also, if num_aces is 0 i.e. DACL has no ACEs, |
359 | user/group/other have no permissions */ | 359 | user/group/other have no permissions */ |
360 | inode->i_mode &= ~(S_IRWXUGO); | 360 | fattr->cf_mode &= ~(S_IRWXUGO); |
361 | 361 | ||
362 | acl_base = (char *)pdacl; | 362 | acl_base = (char *)pdacl; |
363 | acl_size = sizeof(struct cifs_acl); | 363 | acl_size = sizeof(struct cifs_acl); |
@@ -379,17 +379,17 @@ static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl, | |||
379 | if (compare_sids(&(ppace[i]->sid), pownersid)) | 379 | if (compare_sids(&(ppace[i]->sid), pownersid)) |
380 | access_flags_to_mode(ppace[i]->access_req, | 380 | access_flags_to_mode(ppace[i]->access_req, |
381 | ppace[i]->type, | 381 | ppace[i]->type, |
382 | &(inode->i_mode), | 382 | &fattr->cf_mode, |
383 | &user_mask); | 383 | &user_mask); |
384 | if (compare_sids(&(ppace[i]->sid), pgrpsid)) | 384 | if (compare_sids(&(ppace[i]->sid), pgrpsid)) |
385 | access_flags_to_mode(ppace[i]->access_req, | 385 | access_flags_to_mode(ppace[i]->access_req, |
386 | ppace[i]->type, | 386 | ppace[i]->type, |
387 | &(inode->i_mode), | 387 | &fattr->cf_mode, |
388 | &group_mask); | 388 | &group_mask); |
389 | if (compare_sids(&(ppace[i]->sid), &sid_everyone)) | 389 | if (compare_sids(&(ppace[i]->sid), &sid_everyone)) |
390 | access_flags_to_mode(ppace[i]->access_req, | 390 | access_flags_to_mode(ppace[i]->access_req, |
391 | ppace[i]->type, | 391 | ppace[i]->type, |
392 | &(inode->i_mode), | 392 | &fattr->cf_mode, |
393 | &other_mask); | 393 | &other_mask); |
394 | 394 | ||
395 | /* memcpy((void *)(&(cifscred->aces[i])), | 395 | /* memcpy((void *)(&(cifscred->aces[i])), |
@@ -464,7 +464,7 @@ static int parse_sid(struct cifs_sid *psid, char *end_of_acl) | |||
464 | 464 | ||
465 | /* Convert CIFS ACL to POSIX form */ | 465 | /* Convert CIFS ACL to POSIX form */ |
466 | static int parse_sec_desc(struct cifs_ntsd *pntsd, int acl_len, | 466 | static int parse_sec_desc(struct cifs_ntsd *pntsd, int acl_len, |
467 | struct inode *inode) | 467 | struct cifs_fattr *fattr) |
468 | { | 468 | { |
469 | int rc; | 469 | int rc; |
470 | struct cifs_sid *owner_sid_ptr, *group_sid_ptr; | 470 | struct cifs_sid *owner_sid_ptr, *group_sid_ptr; |
@@ -472,7 +472,7 @@ static int parse_sec_desc(struct cifs_ntsd *pntsd, int acl_len, | |||
472 | char *end_of_acl = ((char *)pntsd) + acl_len; | 472 | char *end_of_acl = ((char *)pntsd) + acl_len; |
473 | __u32 dacloffset; | 473 | __u32 dacloffset; |
474 | 474 | ||
475 | if ((inode == NULL) || (pntsd == NULL)) | 475 | if (pntsd == NULL) |
476 | return -EIO; | 476 | return -EIO; |
477 | 477 | ||
478 | owner_sid_ptr = (struct cifs_sid *)((char *)pntsd + | 478 | owner_sid_ptr = (struct cifs_sid *)((char *)pntsd + |
@@ -497,7 +497,7 @@ static int parse_sec_desc(struct cifs_ntsd *pntsd, int acl_len, | |||
497 | 497 | ||
498 | if (dacloffset) | 498 | if (dacloffset) |
499 | parse_dacl(dacl_ptr, end_of_acl, owner_sid_ptr, | 499 | parse_dacl(dacl_ptr, end_of_acl, owner_sid_ptr, |
500 | group_sid_ptr, inode); | 500 | group_sid_ptr, fattr); |
501 | else | 501 | else |
502 | cFYI(1, ("no ACL")); /* BB grant all or default perms? */ | 502 | cFYI(1, ("no ACL")); /* BB grant all or default perms? */ |
503 | 503 | ||
@@ -508,7 +508,6 @@ static int parse_sec_desc(struct cifs_ntsd *pntsd, int acl_len, | |||
508 | memcpy((void *)(&(cifscred->gsid)), (void *)group_sid_ptr, | 508 | memcpy((void *)(&(cifscred->gsid)), (void *)group_sid_ptr, |
509 | sizeof(struct cifs_sid)); */ | 509 | sizeof(struct cifs_sid)); */ |
510 | 510 | ||
511 | |||
512 | return 0; | 511 | return 0; |
513 | } | 512 | } |
514 | 513 | ||
@@ -671,8 +670,9 @@ static int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen, | |||
671 | } | 670 | } |
672 | 671 | ||
673 | /* Translate the CIFS ACL (simlar to NTFS ACL) for a file into mode bits */ | 672 | /* Translate the CIFS ACL (simlar to NTFS ACL) for a file into mode bits */ |
674 | void acl_to_uid_mode(struct cifs_sb_info *cifs_sb, struct inode *inode, | 673 | void |
675 | const char *path, const __u16 *pfid) | 674 | cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr, |
675 | struct inode *inode, const char *path, const __u16 *pfid) | ||
676 | { | 676 | { |
677 | struct cifs_ntsd *pntsd = NULL; | 677 | struct cifs_ntsd *pntsd = NULL; |
678 | u32 acllen = 0; | 678 | u32 acllen = 0; |
@@ -687,7 +687,7 @@ void acl_to_uid_mode(struct cifs_sb_info *cifs_sb, struct inode *inode, | |||
687 | 687 | ||
688 | /* if we can retrieve the ACL, now parse Access Control Entries, ACEs */ | 688 | /* if we can retrieve the ACL, now parse Access Control Entries, ACEs */ |
689 | if (pntsd) | 689 | if (pntsd) |
690 | rc = parse_sec_desc(pntsd, acllen, inode); | 690 | rc = parse_sec_desc(pntsd, acllen, fattr); |
691 | if (rc) | 691 | if (rc) |
692 | cFYI(1, ("parse sec desc failed rc = %d", rc)); | 692 | cFYI(1, ("parse sec desc failed rc = %d", rc)); |
693 | 693 | ||
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 9f669f982c4d..44f30504b82d 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -308,7 +308,6 @@ cifs_alloc_inode(struct super_block *sb) | |||
308 | if (!cifs_inode) | 308 | if (!cifs_inode) |
309 | return NULL; | 309 | return NULL; |
310 | cifs_inode->cifsAttrs = 0x20; /* default */ | 310 | cifs_inode->cifsAttrs = 0x20; /* default */ |
311 | atomic_set(&cifs_inode->inUse, 0); | ||
312 | cifs_inode->time = 0; | 311 | cifs_inode->time = 0; |
313 | cifs_inode->write_behind_rc = 0; | 312 | cifs_inode->write_behind_rc = 0; |
314 | /* Until the file is open and we have gotten oplock | 313 | /* Until the file is open and we have gotten oplock |
diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index 9570a0e8023f..6c170948300d 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h | |||
@@ -24,6 +24,19 @@ | |||
24 | 24 | ||
25 | #define ROOT_I 2 | 25 | #define ROOT_I 2 |
26 | 26 | ||
27 | /* | ||
28 | * ino_t is 32-bits on 32-bit arch. We have to squash the 64-bit value down | ||
29 | * so that it will fit. | ||
30 | */ | ||
31 | static inline ino_t | ||
32 | cifs_uniqueid_to_ino_t(u64 fileid) | ||
33 | { | ||
34 | ino_t ino = (ino_t) fileid; | ||
35 | if (sizeof(ino_t) < sizeof(u64)) | ||
36 | ino ^= fileid >> (sizeof(u64)-sizeof(ino_t)) * 8; | ||
37 | return ino; | ||
38 | } | ||
39 | |||
27 | extern struct file_system_type cifs_fs_type; | 40 | extern struct file_system_type cifs_fs_type; |
28 | extern const struct address_space_operations cifs_addr_ops; | 41 | extern const struct address_space_operations cifs_addr_ops; |
29 | extern const struct address_space_operations cifs_addr_ops_smallbuf; | 42 | extern const struct address_space_operations cifs_addr_ops_smallbuf; |
@@ -100,5 +113,5 @@ extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg); | |||
100 | extern const struct export_operations cifs_export_ops; | 113 | extern const struct export_operations cifs_export_ops; |
101 | #endif /* EXPERIMENTAL */ | 114 | #endif /* EXPERIMENTAL */ |
102 | 115 | ||
103 | #define CIFS_VERSION "1.59" | 116 | #define CIFS_VERSION "1.60" |
104 | #endif /* _CIFSFS_H */ | 117 | #endif /* _CIFSFS_H */ |
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index e1225e6ded2f..63f6cdfa5638 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h | |||
@@ -364,13 +364,13 @@ struct cifsInodeInfo { | |||
364 | struct list_head openFileList; | 364 | struct list_head openFileList; |
365 | int write_behind_rc; | 365 | int write_behind_rc; |
366 | __u32 cifsAttrs; /* e.g. DOS archive bit, sparse, compressed, system */ | 366 | __u32 cifsAttrs; /* e.g. DOS archive bit, sparse, compressed, system */ |
367 | atomic_t inUse; /* num concurrent users (local openers cifs) of file*/ | ||
368 | unsigned long time; /* jiffies of last update/check of inode */ | 367 | unsigned long time; /* jiffies of last update/check of inode */ |
369 | bool clientCanCacheRead:1; /* read oplock */ | 368 | bool clientCanCacheRead:1; /* read oplock */ |
370 | bool clientCanCacheAll:1; /* read and writebehind oplock */ | 369 | bool clientCanCacheAll:1; /* read and writebehind oplock */ |
371 | bool oplockPending:1; | 370 | bool oplockPending:1; |
372 | bool delete_pending:1; /* DELETE_ON_CLOSE is set */ | 371 | bool delete_pending:1; /* DELETE_ON_CLOSE is set */ |
373 | u64 server_eof; /* current file size on server */ | 372 | u64 server_eof; /* current file size on server */ |
373 | u64 uniqueid; /* server inode number */ | ||
374 | struct inode vfs_inode; | 374 | struct inode vfs_inode; |
375 | }; | 375 | }; |
376 | 376 | ||
@@ -472,6 +472,32 @@ struct dfs_info3_param { | |||
472 | char *node_name; | 472 | char *node_name; |
473 | }; | 473 | }; |
474 | 474 | ||
475 | /* | ||
476 | * common struct for holding inode info when searching for or updating an | ||
477 | * inode with new info | ||
478 | */ | ||
479 | |||
480 | #define CIFS_FATTR_DFS_REFERRAL 0x1 | ||
481 | #define CIFS_FATTR_DELETE_PENDING 0x2 | ||
482 | #define CIFS_FATTR_NEED_REVAL 0x4 | ||
483 | |||
484 | struct cifs_fattr { | ||
485 | u32 cf_flags; | ||
486 | u32 cf_cifsattrs; | ||
487 | u64 cf_uniqueid; | ||
488 | u64 cf_eof; | ||
489 | u64 cf_bytes; | ||
490 | uid_t cf_uid; | ||
491 | gid_t cf_gid; | ||
492 | umode_t cf_mode; | ||
493 | dev_t cf_rdev; | ||
494 | unsigned int cf_nlink; | ||
495 | unsigned int cf_dtype; | ||
496 | struct timespec cf_atime; | ||
497 | struct timespec cf_mtime; | ||
498 | struct timespec cf_ctime; | ||
499 | }; | ||
500 | |||
475 | static inline void free_dfs_info_param(struct dfs_info3_param *param) | 501 | static inline void free_dfs_info_param(struct dfs_info3_param *param) |
476 | { | 502 | { |
477 | if (param) { | 503 | if (param) { |
diff --git a/fs/cifs/cifspdu.h b/fs/cifs/cifspdu.h index a785f69dbc9f..2d07f890a842 100644 --- a/fs/cifs/cifspdu.h +++ b/fs/cifs/cifspdu.h | |||
@@ -2328,19 +2328,7 @@ struct file_attrib_tag { | |||
2328 | typedef struct { | 2328 | typedef struct { |
2329 | __le32 NextEntryOffset; | 2329 | __le32 NextEntryOffset; |
2330 | __u32 ResumeKey; /* as with FileIndex - no need to convert */ | 2330 | __u32 ResumeKey; /* as with FileIndex - no need to convert */ |
2331 | __le64 EndOfFile; | 2331 | FILE_UNIX_BASIC_INFO basic; |
2332 | __le64 NumOfBytes; | ||
2333 | __le64 LastStatusChange; /*SNIA specs DCE time for the 3 time fields */ | ||
2334 | __le64 LastAccessTime; | ||
2335 | __le64 LastModificationTime; | ||
2336 | __le64 Uid; | ||
2337 | __le64 Gid; | ||
2338 | __le32 Type; | ||
2339 | __le64 DevMajor; | ||
2340 | __le64 DevMinor; | ||
2341 | __le64 UniqueId; | ||
2342 | __le64 Permissions; | ||
2343 | __le64 Nlinks; | ||
2344 | char FileName[1]; | 2332 | char FileName[1]; |
2345 | } __attribute__((packed)) FILE_UNIX_INFO; /* level 0x202 */ | 2333 | } __attribute__((packed)) FILE_UNIX_INFO; /* level 0x202 */ |
2346 | 2334 | ||
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index c419416a42ee..da8fbf565991 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -98,9 +98,13 @@ extern struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time, | |||
98 | extern int cifs_posix_open(char *full_path, struct inode **pinode, | 98 | extern int cifs_posix_open(char *full_path, struct inode **pinode, |
99 | struct super_block *sb, int mode, int oflags, | 99 | struct super_block *sb, int mode, int oflags, |
100 | int *poplock, __u16 *pnetfid, int xid); | 100 | int *poplock, __u16 *pnetfid, int xid); |
101 | extern void posix_fill_in_inode(struct inode *tmp_inode, | 101 | extern void cifs_unix_basic_to_fattr(struct cifs_fattr *fattr, |
102 | FILE_UNIX_BASIC_INFO *pData, int isNewInode); | 102 | FILE_UNIX_BASIC_INFO *info, |
103 | extern struct inode *cifs_new_inode(struct super_block *sb, __u64 *inum); | 103 | struct cifs_sb_info *cifs_sb); |
104 | extern void cifs_fattr_to_inode(struct inode *inode, struct cifs_fattr *fattr); | ||
105 | extern struct inode *cifs_iget(struct super_block *sb, | ||
106 | struct cifs_fattr *fattr); | ||
107 | |||
104 | extern int cifs_get_inode_info(struct inode **pinode, | 108 | extern int cifs_get_inode_info(struct inode **pinode, |
105 | const unsigned char *search_path, | 109 | const unsigned char *search_path, |
106 | FILE_ALL_INFO *pfile_info, | 110 | FILE_ALL_INFO *pfile_info, |
@@ -108,8 +112,9 @@ extern int cifs_get_inode_info(struct inode **pinode, | |||
108 | extern int cifs_get_inode_info_unix(struct inode **pinode, | 112 | extern int cifs_get_inode_info_unix(struct inode **pinode, |
109 | const unsigned char *search_path, | 113 | const unsigned char *search_path, |
110 | struct super_block *sb, int xid); | 114 | struct super_block *sb, int xid); |
111 | extern void acl_to_uid_mode(struct cifs_sb_info *cifs_sb, struct inode *inode, | 115 | extern void cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, |
112 | const char *path, const __u16 *pfid); | 116 | struct cifs_fattr *fattr, struct inode *inode, |
117 | const char *path, const __u16 *pfid); | ||
113 | extern int mode_to_acl(struct inode *inode, const char *path, __u64); | 118 | extern int mode_to_acl(struct inode *inode, const char *path, __u64); |
114 | 119 | ||
115 | extern int cifs_mount(struct super_block *, struct cifs_sb_info *, char *, | 120 | extern int cifs_mount(struct super_block *, struct cifs_sb_info *, char *, |
@@ -215,7 +220,11 @@ struct cifs_unix_set_info_args { | |||
215 | dev_t device; | 220 | dev_t device; |
216 | }; | 221 | }; |
217 | 222 | ||
218 | extern int CIFSSMBUnixSetInfo(const int xid, struct cifsTconInfo *pTcon, | 223 | extern int CIFSSMBUnixSetFileInfo(const int xid, struct cifsTconInfo *tcon, |
224 | const struct cifs_unix_set_info_args *args, | ||
225 | u16 fid, u32 pid_of_opener); | ||
226 | |||
227 | extern int CIFSSMBUnixSetPathInfo(const int xid, struct cifsTconInfo *pTcon, | ||
219 | char *fileName, | 228 | char *fileName, |
220 | const struct cifs_unix_set_info_args *args, | 229 | const struct cifs_unix_set_info_args *args, |
221 | const struct nls_table *nls_codepage, | 230 | const struct nls_table *nls_codepage, |
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 61007c627497..922f5fe2084c 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -5074,10 +5074,114 @@ SetAttrLgcyRetry: | |||
5074 | } | 5074 | } |
5075 | #endif /* temporarily unneeded SetAttr legacy function */ | 5075 | #endif /* temporarily unneeded SetAttr legacy function */ |
5076 | 5076 | ||
5077 | static void | ||
5078 | cifs_fill_unix_set_info(FILE_UNIX_BASIC_INFO *data_offset, | ||
5079 | const struct cifs_unix_set_info_args *args) | ||
5080 | { | ||
5081 | u64 mode = args->mode; | ||
5082 | |||
5083 | /* | ||
5084 | * Samba server ignores set of file size to zero due to bugs in some | ||
5085 | * older clients, but we should be precise - we use SetFileSize to | ||
5086 | * set file size and do not want to truncate file size to zero | ||
5087 | * accidently as happened on one Samba server beta by putting | ||
5088 | * zero instead of -1 here | ||
5089 | */ | ||
5090 | data_offset->EndOfFile = cpu_to_le64(NO_CHANGE_64); | ||
5091 | data_offset->NumOfBytes = cpu_to_le64(NO_CHANGE_64); | ||
5092 | data_offset->LastStatusChange = cpu_to_le64(args->ctime); | ||
5093 | data_offset->LastAccessTime = cpu_to_le64(args->atime); | ||
5094 | data_offset->LastModificationTime = cpu_to_le64(args->mtime); | ||
5095 | data_offset->Uid = cpu_to_le64(args->uid); | ||
5096 | data_offset->Gid = cpu_to_le64(args->gid); | ||
5097 | /* better to leave device as zero when it is */ | ||
5098 | data_offset->DevMajor = cpu_to_le64(MAJOR(args->device)); | ||
5099 | data_offset->DevMinor = cpu_to_le64(MINOR(args->device)); | ||
5100 | data_offset->Permissions = cpu_to_le64(mode); | ||
5101 | |||
5102 | if (S_ISREG(mode)) | ||
5103 | data_offset->Type = cpu_to_le32(UNIX_FILE); | ||
5104 | else if (S_ISDIR(mode)) | ||
5105 | data_offset->Type = cpu_to_le32(UNIX_DIR); | ||
5106 | else if (S_ISLNK(mode)) | ||
5107 | data_offset->Type = cpu_to_le32(UNIX_SYMLINK); | ||
5108 | else if (S_ISCHR(mode)) | ||
5109 | data_offset->Type = cpu_to_le32(UNIX_CHARDEV); | ||
5110 | else if (S_ISBLK(mode)) | ||
5111 | data_offset->Type = cpu_to_le32(UNIX_BLOCKDEV); | ||
5112 | else if (S_ISFIFO(mode)) | ||
5113 | data_offset->Type = cpu_to_le32(UNIX_FIFO); | ||
5114 | else if (S_ISSOCK(mode)) | ||
5115 | data_offset->Type = cpu_to_le32(UNIX_SOCKET); | ||
5116 | } | ||
5117 | |||
5077 | int | 5118 | int |
5078 | CIFSSMBUnixSetInfo(const int xid, struct cifsTconInfo *tcon, char *fileName, | 5119 | CIFSSMBUnixSetFileInfo(const int xid, struct cifsTconInfo *tcon, |
5079 | const struct cifs_unix_set_info_args *args, | 5120 | const struct cifs_unix_set_info_args *args, |
5080 | const struct nls_table *nls_codepage, int remap) | 5121 | u16 fid, u32 pid_of_opener) |
5122 | { | ||
5123 | struct smb_com_transaction2_sfi_req *pSMB = NULL; | ||
5124 | FILE_UNIX_BASIC_INFO *data_offset; | ||
5125 | int rc = 0; | ||
5126 | u16 params, param_offset, offset, byte_count, count; | ||
5127 | |||
5128 | cFYI(1, ("Set Unix Info (via SetFileInfo)")); | ||
5129 | rc = small_smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB); | ||
5130 | |||
5131 | if (rc) | ||
5132 | return rc; | ||
5133 | |||
5134 | pSMB->hdr.Pid = cpu_to_le16((__u16)pid_of_opener); | ||
5135 | pSMB->hdr.PidHigh = cpu_to_le16((__u16)(pid_of_opener >> 16)); | ||
5136 | |||
5137 | params = 6; | ||
5138 | pSMB->MaxSetupCount = 0; | ||
5139 | pSMB->Reserved = 0; | ||
5140 | pSMB->Flags = 0; | ||
5141 | pSMB->Timeout = 0; | ||
5142 | pSMB->Reserved2 = 0; | ||
5143 | param_offset = offsetof(struct smb_com_transaction2_sfi_req, Fid) - 4; | ||
5144 | offset = param_offset + params; | ||
5145 | |||
5146 | data_offset = (FILE_UNIX_BASIC_INFO *) | ||
5147 | ((char *)(&pSMB->hdr.Protocol) + offset); | ||
5148 | count = sizeof(FILE_UNIX_BASIC_INFO); | ||
5149 | |||
5150 | pSMB->MaxParameterCount = cpu_to_le16(2); | ||
5151 | /* BB find max SMB PDU from sess */ | ||
5152 | pSMB->MaxDataCount = cpu_to_le16(1000); | ||
5153 | pSMB->SetupCount = 1; | ||
5154 | pSMB->Reserved3 = 0; | ||
5155 | pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION); | ||
5156 | byte_count = 3 /* pad */ + params + count; | ||
5157 | pSMB->DataCount = cpu_to_le16(count); | ||
5158 | pSMB->ParameterCount = cpu_to_le16(params); | ||
5159 | pSMB->TotalDataCount = pSMB->DataCount; | ||
5160 | pSMB->TotalParameterCount = pSMB->ParameterCount; | ||
5161 | pSMB->ParameterOffset = cpu_to_le16(param_offset); | ||
5162 | pSMB->DataOffset = cpu_to_le16(offset); | ||
5163 | pSMB->Fid = fid; | ||
5164 | pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_UNIX_BASIC); | ||
5165 | pSMB->Reserved4 = 0; | ||
5166 | pSMB->hdr.smb_buf_length += byte_count; | ||
5167 | pSMB->ByteCount = cpu_to_le16(byte_count); | ||
5168 | |||
5169 | cifs_fill_unix_set_info(data_offset, args); | ||
5170 | |||
5171 | rc = SendReceiveNoRsp(xid, tcon->ses, (struct smb_hdr *) pSMB, 0); | ||
5172 | if (rc) | ||
5173 | cFYI(1, ("Send error in Set Time (SetFileInfo) = %d", rc)); | ||
5174 | |||
5175 | /* Note: On -EAGAIN error only caller can retry on handle based calls | ||
5176 | since file handle passed in no longer valid */ | ||
5177 | |||
5178 | return rc; | ||
5179 | } | ||
5180 | |||
5181 | int | ||
5182 | CIFSSMBUnixSetPathInfo(const int xid, struct cifsTconInfo *tcon, char *fileName, | ||
5183 | const struct cifs_unix_set_info_args *args, | ||
5184 | const struct nls_table *nls_codepage, int remap) | ||
5081 | { | 5185 | { |
5082 | TRANSACTION2_SPI_REQ *pSMB = NULL; | 5186 | TRANSACTION2_SPI_REQ *pSMB = NULL; |
5083 | TRANSACTION2_SPI_RSP *pSMBr = NULL; | 5187 | TRANSACTION2_SPI_RSP *pSMBr = NULL; |
@@ -5086,7 +5190,6 @@ CIFSSMBUnixSetInfo(const int xid, struct cifsTconInfo *tcon, char *fileName, | |||
5086 | int bytes_returned = 0; | 5190 | int bytes_returned = 0; |
5087 | FILE_UNIX_BASIC_INFO *data_offset; | 5191 | FILE_UNIX_BASIC_INFO *data_offset; |
5088 | __u16 params, param_offset, offset, count, byte_count; | 5192 | __u16 params, param_offset, offset, count, byte_count; |
5089 | __u64 mode = args->mode; | ||
5090 | 5193 | ||
5091 | cFYI(1, ("In SetUID/GID/Mode")); | 5194 | cFYI(1, ("In SetUID/GID/Mode")); |
5092 | setPermsRetry: | 5195 | setPermsRetry: |
@@ -5137,38 +5240,8 @@ setPermsRetry: | |||
5137 | pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_UNIX_BASIC); | 5240 | pSMB->InformationLevel = cpu_to_le16(SMB_SET_FILE_UNIX_BASIC); |
5138 | pSMB->Reserved4 = 0; | 5241 | pSMB->Reserved4 = 0; |
5139 | pSMB->hdr.smb_buf_length += byte_count; | 5242 | pSMB->hdr.smb_buf_length += byte_count; |
5140 | /* Samba server ignores set of file size to zero due to bugs in some | ||
5141 | older clients, but we should be precise - we use SetFileSize to | ||
5142 | set file size and do not want to truncate file size to zero | ||
5143 | accidently as happened on one Samba server beta by putting | ||
5144 | zero instead of -1 here */ | ||
5145 | data_offset->EndOfFile = cpu_to_le64(NO_CHANGE_64); | ||
5146 | data_offset->NumOfBytes = cpu_to_le64(NO_CHANGE_64); | ||
5147 | data_offset->LastStatusChange = cpu_to_le64(args->ctime); | ||
5148 | data_offset->LastAccessTime = cpu_to_le64(args->atime); | ||
5149 | data_offset->LastModificationTime = cpu_to_le64(args->mtime); | ||
5150 | data_offset->Uid = cpu_to_le64(args->uid); | ||
5151 | data_offset->Gid = cpu_to_le64(args->gid); | ||
5152 | /* better to leave device as zero when it is */ | ||
5153 | data_offset->DevMajor = cpu_to_le64(MAJOR(args->device)); | ||
5154 | data_offset->DevMinor = cpu_to_le64(MINOR(args->device)); | ||
5155 | data_offset->Permissions = cpu_to_le64(mode); | ||
5156 | |||
5157 | if (S_ISREG(mode)) | ||
5158 | data_offset->Type = cpu_to_le32(UNIX_FILE); | ||
5159 | else if (S_ISDIR(mode)) | ||
5160 | data_offset->Type = cpu_to_le32(UNIX_DIR); | ||
5161 | else if (S_ISLNK(mode)) | ||
5162 | data_offset->Type = cpu_to_le32(UNIX_SYMLINK); | ||
5163 | else if (S_ISCHR(mode)) | ||
5164 | data_offset->Type = cpu_to_le32(UNIX_CHARDEV); | ||
5165 | else if (S_ISBLK(mode)) | ||
5166 | data_offset->Type = cpu_to_le32(UNIX_BLOCKDEV); | ||
5167 | else if (S_ISFIFO(mode)) | ||
5168 | data_offset->Type = cpu_to_le32(UNIX_FIFO); | ||
5169 | else if (S_ISSOCK(mode)) | ||
5170 | data_offset->Type = cpu_to_le32(UNIX_SOCKET); | ||
5171 | 5243 | ||
5244 | cifs_fill_unix_set_info(data_offset, args); | ||
5172 | 5245 | ||
5173 | pSMB->ByteCount = cpu_to_le16(byte_count); | 5246 | pSMB->ByteCount = cpu_to_le16(byte_count); |
5174 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 5247 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 7dc6b74f9def..4326ffd90fa9 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
@@ -188,6 +188,7 @@ int cifs_posix_open(char *full_path, struct inode **pinode, | |||
188 | FILE_UNIX_BASIC_INFO *presp_data; | 188 | FILE_UNIX_BASIC_INFO *presp_data; |
189 | __u32 posix_flags = 0; | 189 | __u32 posix_flags = 0; |
190 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); | 190 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); |
191 | struct cifs_fattr fattr; | ||
191 | 192 | ||
192 | cFYI(1, ("posix open %s", full_path)); | 193 | cFYI(1, ("posix open %s", full_path)); |
193 | 194 | ||
@@ -236,22 +237,21 @@ int cifs_posix_open(char *full_path, struct inode **pinode, | |||
236 | if (presp_data->Type == cpu_to_le32(-1)) | 237 | if (presp_data->Type == cpu_to_le32(-1)) |
237 | goto posix_open_ret; /* open ok, caller does qpathinfo */ | 238 | goto posix_open_ret; /* open ok, caller does qpathinfo */ |
238 | 239 | ||
239 | /* get new inode and set it up */ | ||
240 | if (!pinode) | 240 | if (!pinode) |
241 | goto posix_open_ret; /* caller does not need info */ | 241 | goto posix_open_ret; /* caller does not need info */ |
242 | 242 | ||
243 | cifs_unix_basic_to_fattr(&fattr, presp_data, cifs_sb); | ||
244 | |||
245 | /* get new inode and set it up */ | ||
243 | if (*pinode == NULL) { | 246 | if (*pinode == NULL) { |
244 | __u64 unique_id = le64_to_cpu(presp_data->UniqueId); | 247 | *pinode = cifs_iget(sb, &fattr); |
245 | *pinode = cifs_new_inode(sb, &unique_id); | 248 | if (!*pinode) { |
249 | rc = -ENOMEM; | ||
250 | goto posix_open_ret; | ||
251 | } | ||
252 | } else { | ||
253 | cifs_fattr_to_inode(*pinode, &fattr); | ||
246 | } | 254 | } |
247 | /* else an inode was passed in. Update its info, don't create one */ | ||
248 | |||
249 | /* We do not need to close the file if new_inode fails since | ||
250 | the caller will retry qpathinfo as long as inode is null */ | ||
251 | if (*pinode == NULL) | ||
252 | goto posix_open_ret; | ||
253 | |||
254 | posix_fill_in_inode(*pinode, presp_data, 1); | ||
255 | 255 | ||
256 | cifs_fill_fileinfo(*pinode, *pnetfid, cifs_sb->tcon, write_only); | 256 | cifs_fill_fileinfo(*pinode, *pnetfid, cifs_sb->tcon, write_only); |
257 | 257 | ||
@@ -425,9 +425,10 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
425 | args.uid = NO_CHANGE_64; | 425 | args.uid = NO_CHANGE_64; |
426 | args.gid = NO_CHANGE_64; | 426 | args.gid = NO_CHANGE_64; |
427 | } | 427 | } |
428 | CIFSSMBUnixSetInfo(xid, tcon, full_path, &args, | 428 | CIFSSMBUnixSetPathInfo(xid, tcon, full_path, &args, |
429 | cifs_sb->local_nls, | 429 | cifs_sb->local_nls, |
430 | cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); | 430 | cifs_sb->mnt_cifs_flags & |
431 | CIFS_MOUNT_MAP_SPECIAL_CHR); | ||
431 | } else { | 432 | } else { |
432 | /* BB implement mode setting via Windows security | 433 | /* BB implement mode setting via Windows security |
433 | descriptors e.g. */ | 434 | descriptors e.g. */ |
@@ -515,10 +516,10 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, | |||
515 | args.uid = NO_CHANGE_64; | 516 | args.uid = NO_CHANGE_64; |
516 | args.gid = NO_CHANGE_64; | 517 | args.gid = NO_CHANGE_64; |
517 | } | 518 | } |
518 | rc = CIFSSMBUnixSetInfo(xid, pTcon, full_path, | 519 | rc = CIFSSMBUnixSetPathInfo(xid, pTcon, full_path, &args, |
519 | &args, cifs_sb->local_nls, | 520 | cifs_sb->local_nls, |
520 | cifs_sb->mnt_cifs_flags & | 521 | cifs_sb->mnt_cifs_flags & |
521 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 522 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
522 | 523 | ||
523 | if (!rc) { | 524 | if (!rc) { |
524 | rc = cifs_get_inode_info_unix(&newinode, full_path, | 525 | rc = cifs_get_inode_info_unix(&newinode, full_path, |
@@ -643,6 +644,15 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, | |||
643 | } | 644 | } |
644 | } | 645 | } |
645 | 646 | ||
647 | /* | ||
648 | * O_EXCL: optimize away the lookup, but don't hash the dentry. Let | ||
649 | * the VFS handle the create. | ||
650 | */ | ||
651 | if (nd->flags & LOOKUP_EXCL) { | ||
652 | d_instantiate(direntry, NULL); | ||
653 | return 0; | ||
654 | } | ||
655 | |||
646 | /* can not grab the rename sem here since it would | 656 | /* can not grab the rename sem here since it would |
647 | deadlock in the cases (beginning of sys_rename itself) | 657 | deadlock in the cases (beginning of sys_rename itself) |
648 | in which we already have the sb rename sem */ | 658 | in which we already have the sb rename sem */ |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 97ce4bf89d15..c34b7f8a217b 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -448,9 +448,9 @@ int cifs_open(struct inode *inode, struct file *file) | |||
448 | .mtime = NO_CHANGE_64, | 448 | .mtime = NO_CHANGE_64, |
449 | .device = 0, | 449 | .device = 0, |
450 | }; | 450 | }; |
451 | CIFSSMBUnixSetInfo(xid, tcon, full_path, &args, | 451 | CIFSSMBUnixSetPathInfo(xid, tcon, full_path, &args, |
452 | cifs_sb->local_nls, | 452 | cifs_sb->local_nls, |
453 | cifs_sb->mnt_cifs_flags & | 453 | cifs_sb->mnt_cifs_flags & |
454 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 454 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
455 | } | 455 | } |
456 | } | 456 | } |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 155c9e785d0c..18afe57b2461 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -77,239 +77,202 @@ static void cifs_set_ops(struct inode *inode, const bool is_dfs_referral) | |||
77 | } | 77 | } |
78 | } | 78 | } |
79 | 79 | ||
80 | static void cifs_unix_info_to_inode(struct inode *inode, | 80 | /* populate an inode with info from a cifs_fattr struct */ |
81 | FILE_UNIX_BASIC_INFO *info, int force_uid_gid) | 81 | void |
82 | cifs_fattr_to_inode(struct inode *inode, struct cifs_fattr *fattr) | ||
82 | { | 83 | { |
84 | struct cifsInodeInfo *cifs_i = CIFS_I(inode); | ||
83 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); | 85 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); |
84 | struct cifsInodeInfo *cifsInfo = CIFS_I(inode); | 86 | unsigned long oldtime = cifs_i->time; |
85 | __u64 num_of_bytes = le64_to_cpu(info->NumOfBytes); | 87 | |
86 | __u64 end_of_file = le64_to_cpu(info->EndOfFile); | 88 | inode->i_atime = fattr->cf_atime; |
89 | inode->i_mtime = fattr->cf_mtime; | ||
90 | inode->i_ctime = fattr->cf_ctime; | ||
91 | inode->i_rdev = fattr->cf_rdev; | ||
92 | inode->i_nlink = fattr->cf_nlink; | ||
93 | inode->i_uid = fattr->cf_uid; | ||
94 | inode->i_gid = fattr->cf_gid; | ||
95 | |||
96 | /* if dynperm is set, don't clobber existing mode */ | ||
97 | if (inode->i_state & I_NEW || | ||
98 | !(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM)) | ||
99 | inode->i_mode = fattr->cf_mode; | ||
100 | |||
101 | cifs_i->cifsAttrs = fattr->cf_cifsattrs; | ||
102 | cifs_i->uniqueid = fattr->cf_uniqueid; | ||
103 | |||
104 | if (fattr->cf_flags & CIFS_FATTR_NEED_REVAL) | ||
105 | cifs_i->time = 0; | ||
106 | else | ||
107 | cifs_i->time = jiffies; | ||
108 | |||
109 | cFYI(1, ("inode 0x%p old_time=%ld new_time=%ld", inode, | ||
110 | oldtime, cifs_i->time)); | ||
87 | 111 | ||
88 | inode->i_atime = cifs_NTtimeToUnix(info->LastAccessTime); | 112 | cifs_i->delete_pending = fattr->cf_flags & CIFS_FATTR_DELETE_PENDING; |
89 | inode->i_mtime = | 113 | |
90 | cifs_NTtimeToUnix(info->LastModificationTime); | 114 | /* |
91 | inode->i_ctime = cifs_NTtimeToUnix(info->LastStatusChange); | 115 | * Can't safely change the file size here if the client is writing to |
92 | inode->i_mode = le64_to_cpu(info->Permissions); | 116 | * it due to potential races. |
117 | */ | ||
118 | spin_lock(&inode->i_lock); | ||
119 | if (is_size_safe_to_change(cifs_i, fattr->cf_eof)) { | ||
120 | i_size_write(inode, fattr->cf_eof); | ||
121 | |||
122 | /* | ||
123 | * i_blocks is not related to (i_size / i_blksize), | ||
124 | * but instead 512 byte (2**9) size is required for | ||
125 | * calculating num blocks. | ||
126 | */ | ||
127 | inode->i_blocks = (512 - 1 + fattr->cf_bytes) >> 9; | ||
128 | } | ||
129 | spin_unlock(&inode->i_lock); | ||
130 | |||
131 | cifs_set_ops(inode, fattr->cf_flags & CIFS_FATTR_DFS_REFERRAL); | ||
132 | } | ||
133 | |||
134 | /* Fill a cifs_fattr struct with info from FILE_UNIX_BASIC_INFO. */ | ||
135 | void | ||
136 | cifs_unix_basic_to_fattr(struct cifs_fattr *fattr, FILE_UNIX_BASIC_INFO *info, | ||
137 | struct cifs_sb_info *cifs_sb) | ||
138 | { | ||
139 | memset(fattr, 0, sizeof(*fattr)); | ||
140 | fattr->cf_uniqueid = le64_to_cpu(info->UniqueId); | ||
141 | fattr->cf_bytes = le64_to_cpu(info->NumOfBytes); | ||
142 | fattr->cf_eof = le64_to_cpu(info->EndOfFile); | ||
143 | |||
144 | fattr->cf_atime = cifs_NTtimeToUnix(info->LastAccessTime); | ||
145 | fattr->cf_mtime = cifs_NTtimeToUnix(info->LastModificationTime); | ||
146 | fattr->cf_ctime = cifs_NTtimeToUnix(info->LastStatusChange); | ||
147 | fattr->cf_mode = le64_to_cpu(info->Permissions); | ||
93 | 148 | ||
94 | /* | 149 | /* |
95 | * Since we set the inode type below we need to mask off | 150 | * Since we set the inode type below we need to mask off |
96 | * to avoid strange results if bits set above. | 151 | * to avoid strange results if bits set above. |
97 | */ | 152 | */ |
98 | inode->i_mode &= ~S_IFMT; | 153 | fattr->cf_mode &= ~S_IFMT; |
99 | switch (le32_to_cpu(info->Type)) { | 154 | switch (le32_to_cpu(info->Type)) { |
100 | case UNIX_FILE: | 155 | case UNIX_FILE: |
101 | inode->i_mode |= S_IFREG; | 156 | fattr->cf_mode |= S_IFREG; |
157 | fattr->cf_dtype = DT_REG; | ||
102 | break; | 158 | break; |
103 | case UNIX_SYMLINK: | 159 | case UNIX_SYMLINK: |
104 | inode->i_mode |= S_IFLNK; | 160 | fattr->cf_mode |= S_IFLNK; |
161 | fattr->cf_dtype = DT_LNK; | ||
105 | break; | 162 | break; |
106 | case UNIX_DIR: | 163 | case UNIX_DIR: |
107 | inode->i_mode |= S_IFDIR; | 164 | fattr->cf_mode |= S_IFDIR; |
165 | fattr->cf_dtype = DT_DIR; | ||
108 | break; | 166 | break; |
109 | case UNIX_CHARDEV: | 167 | case UNIX_CHARDEV: |
110 | inode->i_mode |= S_IFCHR; | 168 | fattr->cf_mode |= S_IFCHR; |
111 | inode->i_rdev = MKDEV(le64_to_cpu(info->DevMajor), | 169 | fattr->cf_dtype = DT_CHR; |
112 | le64_to_cpu(info->DevMinor) & MINORMASK); | 170 | fattr->cf_rdev = MKDEV(le64_to_cpu(info->DevMajor), |
171 | le64_to_cpu(info->DevMinor) & MINORMASK); | ||
113 | break; | 172 | break; |
114 | case UNIX_BLOCKDEV: | 173 | case UNIX_BLOCKDEV: |
115 | inode->i_mode |= S_IFBLK; | 174 | fattr->cf_mode |= S_IFBLK; |
116 | inode->i_rdev = MKDEV(le64_to_cpu(info->DevMajor), | 175 | fattr->cf_dtype = DT_BLK; |
117 | le64_to_cpu(info->DevMinor) & MINORMASK); | 176 | fattr->cf_rdev = MKDEV(le64_to_cpu(info->DevMajor), |
177 | le64_to_cpu(info->DevMinor) & MINORMASK); | ||
118 | break; | 178 | break; |
119 | case UNIX_FIFO: | 179 | case UNIX_FIFO: |
120 | inode->i_mode |= S_IFIFO; | 180 | fattr->cf_mode |= S_IFIFO; |
181 | fattr->cf_dtype = DT_FIFO; | ||
121 | break; | 182 | break; |
122 | case UNIX_SOCKET: | 183 | case UNIX_SOCKET: |
123 | inode->i_mode |= S_IFSOCK; | 184 | fattr->cf_mode |= S_IFSOCK; |
185 | fattr->cf_dtype = DT_SOCK; | ||
124 | break; | 186 | break; |
125 | default: | 187 | default: |
126 | /* safest to call it a file if we do not know */ | 188 | /* safest to call it a file if we do not know */ |
127 | inode->i_mode |= S_IFREG; | 189 | fattr->cf_mode |= S_IFREG; |
190 | fattr->cf_dtype = DT_REG; | ||
128 | cFYI(1, ("unknown type %d", le32_to_cpu(info->Type))); | 191 | cFYI(1, ("unknown type %d", le32_to_cpu(info->Type))); |
129 | break; | 192 | break; |
130 | } | 193 | } |
131 | 194 | ||
132 | if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID) && | 195 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID) |
133 | !force_uid_gid) | 196 | fattr->cf_uid = cifs_sb->mnt_uid; |
134 | inode->i_uid = cifs_sb->mnt_uid; | ||
135 | else | 197 | else |
136 | inode->i_uid = le64_to_cpu(info->Uid); | 198 | fattr->cf_uid = le64_to_cpu(info->Uid); |
137 | 199 | ||
138 | if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID) && | 200 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID) |
139 | !force_uid_gid) | 201 | fattr->cf_gid = cifs_sb->mnt_gid; |
140 | inode->i_gid = cifs_sb->mnt_gid; | ||
141 | else | 202 | else |
142 | inode->i_gid = le64_to_cpu(info->Gid); | 203 | fattr->cf_gid = le64_to_cpu(info->Gid); |
143 | |||
144 | inode->i_nlink = le64_to_cpu(info->Nlinks); | ||
145 | |||
146 | cifsInfo->server_eof = end_of_file; | ||
147 | spin_lock(&inode->i_lock); | ||
148 | if (is_size_safe_to_change(cifsInfo, end_of_file)) { | ||
149 | /* | ||
150 | * We can not safely change the file size here if the client | ||
151 | * is writing to it due to potential races. | ||
152 | */ | ||
153 | i_size_write(inode, end_of_file); | ||
154 | 204 | ||
155 | /* | 205 | fattr->cf_nlink = le64_to_cpu(info->Nlinks); |
156 | * i_blocks is not related to (i_size / i_blksize), | ||
157 | * but instead 512 byte (2**9) size is required for | ||
158 | * calculating num blocks. | ||
159 | */ | ||
160 | inode->i_blocks = (512 - 1 + num_of_bytes) >> 9; | ||
161 | } | ||
162 | spin_unlock(&inode->i_lock); | ||
163 | } | 206 | } |
164 | 207 | ||
165 | |||
166 | /* | 208 | /* |
167 | * Needed to setup inode data for the directory which is the | 209 | * Fill a cifs_fattr struct with fake inode info. |
168 | * junction to the new submount (ie to setup the fake directory | ||
169 | * which represents a DFS referral) | ||
170 | */ | ||
171 | static void fill_fake_finddataunix(FILE_UNIX_BASIC_INFO *pfnd_dat, | ||
172 | struct super_block *sb) | ||
173 | { | ||
174 | struct inode *pinode = NULL; | ||
175 | |||
176 | memset(pfnd_dat, 0, sizeof(FILE_UNIX_BASIC_INFO)); | ||
177 | |||
178 | /* __le64 pfnd_dat->EndOfFile = cpu_to_le64(0); | ||
179 | __le64 pfnd_dat->NumOfBytes = cpu_to_le64(0); | ||
180 | __u64 UniqueId = 0; */ | ||
181 | pfnd_dat->LastStatusChange = | ||
182 | cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME)); | ||
183 | pfnd_dat->LastAccessTime = | ||
184 | cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME)); | ||
185 | pfnd_dat->LastModificationTime = | ||
186 | cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME)); | ||
187 | pfnd_dat->Type = cpu_to_le32(UNIX_DIR); | ||
188 | pfnd_dat->Permissions = cpu_to_le64(S_IXUGO | S_IRWXU); | ||
189 | pfnd_dat->Nlinks = cpu_to_le64(2); | ||
190 | if (sb->s_root) | ||
191 | pinode = sb->s_root->d_inode; | ||
192 | if (pinode == NULL) | ||
193 | return; | ||
194 | |||
195 | /* fill in default values for the remaining based on root | ||
196 | inode since we can not query the server for this inode info */ | ||
197 | pfnd_dat->DevMajor = cpu_to_le64(MAJOR(pinode->i_rdev)); | ||
198 | pfnd_dat->DevMinor = cpu_to_le64(MINOR(pinode->i_rdev)); | ||
199 | pfnd_dat->Uid = cpu_to_le64(pinode->i_uid); | ||
200 | pfnd_dat->Gid = cpu_to_le64(pinode->i_gid); | ||
201 | } | ||
202 | |||
203 | /** | ||
204 | * cifs_new inode - create new inode, initialize, and hash it | ||
205 | * @sb - pointer to superblock | ||
206 | * @inum - if valid pointer and serverino is enabled, replace i_ino with val | ||
207 | * | ||
208 | * Create a new inode, initialize it for CIFS and hash it. Returns the new | ||
209 | * inode or NULL if one couldn't be allocated. | ||
210 | * | 210 | * |
211 | * If the share isn't mounted with "serverino" or inum is a NULL pointer then | 211 | * Needed to setup cifs_fattr data for the directory which is the |
212 | * we'll just use the inode number assigned by new_inode(). Note that this can | 212 | * junction to the new submount (ie to setup the fake directory |
213 | * mean i_ino collisions since the i_ino assigned by new_inode is not | 213 | * which represents a DFS referral). |
214 | * guaranteed to be unique. | ||
215 | */ | 214 | */ |
216 | struct inode * | 215 | void |
217 | cifs_new_inode(struct super_block *sb, __u64 *inum) | 216 | cifs_create_dfs_fattr(struct cifs_fattr *fattr, struct super_block *sb) |
218 | { | 217 | { |
219 | struct inode *inode; | 218 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); |
220 | |||
221 | inode = new_inode(sb); | ||
222 | if (inode == NULL) | ||
223 | return NULL; | ||
224 | |||
225 | /* | ||
226 | * BB: Is i_ino == 0 legal? Here, we assume that it is. If it isn't we | ||
227 | * stop passing inum as ptr. Are there sanity checks we can use to | ||
228 | * ensure that the server is really filling in that field? Also, | ||
229 | * if serverino is disabled, perhaps we should be using iunique()? | ||
230 | */ | ||
231 | if (inum && (CIFS_SB(sb)->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)) | ||
232 | inode->i_ino = (unsigned long) *inum; | ||
233 | |||
234 | /* | ||
235 | * must set this here instead of cifs_alloc_inode since VFS will | ||
236 | * clobber i_flags | ||
237 | */ | ||
238 | if (sb->s_flags & MS_NOATIME) | ||
239 | inode->i_flags |= S_NOATIME | S_NOCMTIME; | ||
240 | |||
241 | insert_inode_hash(inode); | ||
242 | 219 | ||
243 | return inode; | 220 | cFYI(1, ("creating fake fattr for DFS referral")); |
221 | |||
222 | memset(fattr, 0, sizeof(*fattr)); | ||
223 | fattr->cf_mode = S_IFDIR | S_IXUGO | S_IRWXU; | ||
224 | fattr->cf_uid = cifs_sb->mnt_uid; | ||
225 | fattr->cf_gid = cifs_sb->mnt_gid; | ||
226 | fattr->cf_atime = CURRENT_TIME; | ||
227 | fattr->cf_ctime = CURRENT_TIME; | ||
228 | fattr->cf_mtime = CURRENT_TIME; | ||
229 | fattr->cf_nlink = 2; | ||
230 | fattr->cf_flags |= CIFS_FATTR_DFS_REFERRAL; | ||
244 | } | 231 | } |
245 | 232 | ||
246 | int cifs_get_inode_info_unix(struct inode **pinode, | 233 | int cifs_get_inode_info_unix(struct inode **pinode, |
247 | const unsigned char *full_path, struct super_block *sb, int xid) | 234 | const unsigned char *full_path, |
235 | struct super_block *sb, int xid) | ||
248 | { | 236 | { |
249 | int rc = 0; | 237 | int rc; |
250 | FILE_UNIX_BASIC_INFO find_data; | 238 | FILE_UNIX_BASIC_INFO find_data; |
251 | struct cifsTconInfo *pTcon; | 239 | struct cifs_fattr fattr; |
252 | struct inode *inode; | 240 | struct cifsTconInfo *tcon; |
253 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); | 241 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); |
254 | bool is_dfs_referral = false; | ||
255 | struct cifsInodeInfo *cifsInfo; | ||
256 | __u64 num_of_bytes; | ||
257 | __u64 end_of_file; | ||
258 | 242 | ||
259 | pTcon = cifs_sb->tcon; | 243 | tcon = cifs_sb->tcon; |
260 | cFYI(1, ("Getting info on %s", full_path)); | 244 | cFYI(1, ("Getting info on %s", full_path)); |
261 | 245 | ||
262 | /* could have done a find first instead but this returns more info */ | 246 | /* could have done a find first instead but this returns more info */ |
263 | rc = CIFSSMBUnixQPathInfo(xid, pTcon, full_path, &find_data, | 247 | rc = CIFSSMBUnixQPathInfo(xid, tcon, full_path, &find_data, |
264 | cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & | 248 | cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & |
265 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 249 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
266 | if (rc == -EREMOTE && !is_dfs_referral) { | ||
267 | is_dfs_referral = true; | ||
268 | cFYI(DBG2, ("DFS ref")); | ||
269 | /* for DFS, server does not give us real inode data */ | ||
270 | fill_fake_finddataunix(&find_data, sb); | ||
271 | rc = 0; | ||
272 | } else if (rc) | ||
273 | goto cgiiu_exit; | ||
274 | 250 | ||
275 | num_of_bytes = le64_to_cpu(find_data.NumOfBytes); | 251 | if (!rc) { |
276 | end_of_file = le64_to_cpu(find_data.EndOfFile); | 252 | cifs_unix_basic_to_fattr(&fattr, &find_data, cifs_sb); |
253 | } else if (rc == -EREMOTE) { | ||
254 | cifs_create_dfs_fattr(&fattr, sb); | ||
255 | rc = 0; | ||
256 | } else { | ||
257 | return rc; | ||
258 | } | ||
277 | 259 | ||
278 | /* get new inode */ | ||
279 | if (*pinode == NULL) { | 260 | if (*pinode == NULL) { |
280 | __u64 unique_id = le64_to_cpu(find_data.UniqueId); | 261 | /* get new inode */ |
281 | *pinode = cifs_new_inode(sb, &unique_id); | 262 | *pinode = cifs_iget(sb, &fattr); |
282 | if (*pinode == NULL) { | 263 | if (!*pinode) |
283 | rc = -ENOMEM; | 264 | rc = -ENOMEM; |
284 | goto cgiiu_exit; | 265 | } else { |
285 | } | 266 | /* we already have inode, update it */ |
267 | cifs_fattr_to_inode(*pinode, &fattr); | ||
286 | } | 268 | } |
287 | 269 | ||
288 | inode = *pinode; | ||
289 | cifsInfo = CIFS_I(inode); | ||
290 | |||
291 | cFYI(1, ("Old time %ld", cifsInfo->time)); | ||
292 | cifsInfo->time = jiffies; | ||
293 | cFYI(1, ("New time %ld", cifsInfo->time)); | ||
294 | /* this is ok to set on every inode revalidate */ | ||
295 | atomic_set(&cifsInfo->inUse, 1); | ||
296 | |||
297 | cifs_unix_info_to_inode(inode, &find_data, 0); | ||
298 | |||
299 | if (num_of_bytes < end_of_file) | ||
300 | cFYI(1, ("allocation size less than end of file")); | ||
301 | cFYI(1, ("Size %ld and blocks %llu", | ||
302 | (unsigned long) inode->i_size, | ||
303 | (unsigned long long)inode->i_blocks)); | ||
304 | |||
305 | cifs_set_ops(inode, is_dfs_referral); | ||
306 | cgiiu_exit: | ||
307 | return rc; | 270 | return rc; |
308 | } | 271 | } |
309 | 272 | ||
310 | static int decode_sfu_inode(struct inode *inode, __u64 size, | 273 | static int |
311 | const unsigned char *path, | 274 | cifs_sfu_type(struct cifs_fattr *fattr, const unsigned char *path, |
312 | struct cifs_sb_info *cifs_sb, int xid) | 275 | struct cifs_sb_info *cifs_sb, int xid) |
313 | { | 276 | { |
314 | int rc; | 277 | int rc; |
315 | int oplock = 0; | 278 | int oplock = 0; |
@@ -321,10 +284,15 @@ static int decode_sfu_inode(struct inode *inode, __u64 size, | |||
321 | 284 | ||
322 | pbuf = buf; | 285 | pbuf = buf; |
323 | 286 | ||
324 | if (size == 0) { | 287 | fattr->cf_mode &= ~S_IFMT; |
325 | inode->i_mode |= S_IFIFO; | 288 | |
289 | if (fattr->cf_eof == 0) { | ||
290 | fattr->cf_mode |= S_IFIFO; | ||
291 | fattr->cf_dtype = DT_FIFO; | ||
326 | return 0; | 292 | return 0; |
327 | } else if (size < 8) { | 293 | } else if (fattr->cf_eof < 8) { |
294 | fattr->cf_mode |= S_IFREG; | ||
295 | fattr->cf_dtype = DT_REG; | ||
328 | return -EINVAL; /* EOPNOTSUPP? */ | 296 | return -EINVAL; /* EOPNOTSUPP? */ |
329 | } | 297 | } |
330 | 298 | ||
@@ -336,42 +304,46 @@ static int decode_sfu_inode(struct inode *inode, __u64 size, | |||
336 | if (rc == 0) { | 304 | if (rc == 0) { |
337 | int buf_type = CIFS_NO_BUFFER; | 305 | int buf_type = CIFS_NO_BUFFER; |
338 | /* Read header */ | 306 | /* Read header */ |
339 | rc = CIFSSMBRead(xid, pTcon, | 307 | rc = CIFSSMBRead(xid, pTcon, netfid, |
340 | netfid, | ||
341 | 24 /* length */, 0 /* offset */, | 308 | 24 /* length */, 0 /* offset */, |
342 | &bytes_read, &pbuf, &buf_type); | 309 | &bytes_read, &pbuf, &buf_type); |
343 | if ((rc == 0) && (bytes_read >= 8)) { | 310 | if ((rc == 0) && (bytes_read >= 8)) { |
344 | if (memcmp("IntxBLK", pbuf, 8) == 0) { | 311 | if (memcmp("IntxBLK", pbuf, 8) == 0) { |
345 | cFYI(1, ("Block device")); | 312 | cFYI(1, ("Block device")); |
346 | inode->i_mode |= S_IFBLK; | 313 | fattr->cf_mode |= S_IFBLK; |
314 | fattr->cf_dtype = DT_BLK; | ||
347 | if (bytes_read == 24) { | 315 | if (bytes_read == 24) { |
348 | /* we have enough to decode dev num */ | 316 | /* we have enough to decode dev num */ |
349 | __u64 mjr; /* major */ | 317 | __u64 mjr; /* major */ |
350 | __u64 mnr; /* minor */ | 318 | __u64 mnr; /* minor */ |
351 | mjr = le64_to_cpu(*(__le64 *)(pbuf+8)); | 319 | mjr = le64_to_cpu(*(__le64 *)(pbuf+8)); |
352 | mnr = le64_to_cpu(*(__le64 *)(pbuf+16)); | 320 | mnr = le64_to_cpu(*(__le64 *)(pbuf+16)); |
353 | inode->i_rdev = MKDEV(mjr, mnr); | 321 | fattr->cf_rdev = MKDEV(mjr, mnr); |
354 | } | 322 | } |
355 | } else if (memcmp("IntxCHR", pbuf, 8) == 0) { | 323 | } else if (memcmp("IntxCHR", pbuf, 8) == 0) { |
356 | cFYI(1, ("Char device")); | 324 | cFYI(1, ("Char device")); |
357 | inode->i_mode |= S_IFCHR; | 325 | fattr->cf_mode |= S_IFCHR; |
326 | fattr->cf_dtype = DT_CHR; | ||
358 | if (bytes_read == 24) { | 327 | if (bytes_read == 24) { |
359 | /* we have enough to decode dev num */ | 328 | /* we have enough to decode dev num */ |
360 | __u64 mjr; /* major */ | 329 | __u64 mjr; /* major */ |
361 | __u64 mnr; /* minor */ | 330 | __u64 mnr; /* minor */ |
362 | mjr = le64_to_cpu(*(__le64 *)(pbuf+8)); | 331 | mjr = le64_to_cpu(*(__le64 *)(pbuf+8)); |
363 | mnr = le64_to_cpu(*(__le64 *)(pbuf+16)); | 332 | mnr = le64_to_cpu(*(__le64 *)(pbuf+16)); |
364 | inode->i_rdev = MKDEV(mjr, mnr); | 333 | fattr->cf_rdev = MKDEV(mjr, mnr); |
365 | } | 334 | } |
366 | } else if (memcmp("IntxLNK", pbuf, 7) == 0) { | 335 | } else if (memcmp("IntxLNK", pbuf, 7) == 0) { |
367 | cFYI(1, ("Symlink")); | 336 | cFYI(1, ("Symlink")); |
368 | inode->i_mode |= S_IFLNK; | 337 | fattr->cf_mode |= S_IFLNK; |
338 | fattr->cf_dtype = DT_LNK; | ||
369 | } else { | 339 | } else { |
370 | inode->i_mode |= S_IFREG; /* file? */ | 340 | fattr->cf_mode |= S_IFREG; /* file? */ |
341 | fattr->cf_dtype = DT_REG; | ||
371 | rc = -EOPNOTSUPP; | 342 | rc = -EOPNOTSUPP; |
372 | } | 343 | } |
373 | } else { | 344 | } else { |
374 | inode->i_mode |= S_IFREG; /* then it is a file */ | 345 | fattr->cf_mode |= S_IFREG; /* then it is a file */ |
346 | fattr->cf_dtype = DT_REG; | ||
375 | rc = -EOPNOTSUPP; /* or some unknown SFU type */ | 347 | rc = -EOPNOTSUPP; /* or some unknown SFU type */ |
376 | } | 348 | } |
377 | CIFSSMBClose(xid, pTcon, netfid); | 349 | CIFSSMBClose(xid, pTcon, netfid); |
@@ -381,9 +353,13 @@ static int decode_sfu_inode(struct inode *inode, __u64 size, | |||
381 | 353 | ||
382 | #define SFBITS_MASK (S_ISVTX | S_ISGID | S_ISUID) /* SETFILEBITS valid bits */ | 354 | #define SFBITS_MASK (S_ISVTX | S_ISGID | S_ISUID) /* SETFILEBITS valid bits */ |
383 | 355 | ||
384 | static int get_sfu_mode(struct inode *inode, | 356 | /* |
385 | const unsigned char *path, | 357 | * Fetch mode bits as provided by SFU. |
386 | struct cifs_sb_info *cifs_sb, int xid) | 358 | * |
359 | * FIXME: Doesn't this clobber the type bit we got from cifs_sfu_type ? | ||
360 | */ | ||
361 | static int cifs_sfu_mode(struct cifs_fattr *fattr, const unsigned char *path, | ||
362 | struct cifs_sb_info *cifs_sb, int xid) | ||
387 | { | 363 | { |
388 | #ifdef CONFIG_CIFS_XATTR | 364 | #ifdef CONFIG_CIFS_XATTR |
389 | ssize_t rc; | 365 | ssize_t rc; |
@@ -391,68 +367,80 @@ static int get_sfu_mode(struct inode *inode, | |||
391 | __u32 mode; | 367 | __u32 mode; |
392 | 368 | ||
393 | rc = CIFSSMBQueryEA(xid, cifs_sb->tcon, path, "SETFILEBITS", | 369 | rc = CIFSSMBQueryEA(xid, cifs_sb->tcon, path, "SETFILEBITS", |
394 | ea_value, 4 /* size of buf */, cifs_sb->local_nls, | 370 | ea_value, 4 /* size of buf */, cifs_sb->local_nls, |
395 | cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); | 371 | cifs_sb->mnt_cifs_flags & |
372 | CIFS_MOUNT_MAP_SPECIAL_CHR); | ||
396 | if (rc < 0) | 373 | if (rc < 0) |
397 | return (int)rc; | 374 | return (int)rc; |
398 | else if (rc > 3) { | 375 | else if (rc > 3) { |
399 | mode = le32_to_cpu(*((__le32 *)ea_value)); | 376 | mode = le32_to_cpu(*((__le32 *)ea_value)); |
400 | inode->i_mode &= ~SFBITS_MASK; | 377 | fattr->cf_mode &= ~SFBITS_MASK; |
401 | cFYI(1, ("special bits 0%o org mode 0%o", mode, inode->i_mode)); | 378 | cFYI(1, ("special bits 0%o org mode 0%o", mode, |
402 | inode->i_mode = (mode & SFBITS_MASK) | inode->i_mode; | 379 | fattr->cf_mode)); |
380 | fattr->cf_mode = (mode & SFBITS_MASK) | fattr->cf_mode; | ||
403 | cFYI(1, ("special mode bits 0%o", mode)); | 381 | cFYI(1, ("special mode bits 0%o", mode)); |
404 | return 0; | ||
405 | } else { | ||
406 | return 0; | ||
407 | } | 382 | } |
383 | |||
384 | return 0; | ||
408 | #else | 385 | #else |
409 | return -EOPNOTSUPP; | 386 | return -EOPNOTSUPP; |
410 | #endif | 387 | #endif |
411 | } | 388 | } |
412 | 389 | ||
413 | /* | 390 | /* Fill a cifs_fattr struct with info from FILE_ALL_INFO */ |
414 | * Needed to setup inode data for the directory which is the | 391 | void |
415 | * junction to the new submount (ie to setup the fake directory | 392 | cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info, |
416 | * which represents a DFS referral) | 393 | struct cifs_sb_info *cifs_sb, bool adjust_tz) |
417 | */ | ||
418 | static void fill_fake_finddata(FILE_ALL_INFO *pfnd_dat, | ||
419 | struct super_block *sb) | ||
420 | { | 394 | { |
421 | memset(pfnd_dat, 0, sizeof(FILE_ALL_INFO)); | 395 | memset(fattr, 0, sizeof(*fattr)); |
422 | 396 | fattr->cf_cifsattrs = le32_to_cpu(info->Attributes); | |
423 | /* __le64 pfnd_dat->AllocationSize = cpu_to_le64(0); | 397 | if (info->DeletePending) |
424 | __le64 pfnd_dat->EndOfFile = cpu_to_le64(0); | 398 | fattr->cf_flags |= CIFS_FATTR_DELETE_PENDING; |
425 | __u8 pfnd_dat->DeletePending = 0; | 399 | |
426 | __u8 pfnd_data->Directory = 0; | 400 | if (info->LastAccessTime) |
427 | __le32 pfnd_dat->EASize = 0; | 401 | fattr->cf_atime = cifs_NTtimeToUnix(info->LastAccessTime); |
428 | __u64 pfnd_dat->IndexNumber = 0; | 402 | else |
429 | __u64 pfnd_dat->IndexNumber1 = 0; */ | 403 | fattr->cf_atime = CURRENT_TIME; |
430 | pfnd_dat->CreationTime = | 404 | |
431 | cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME)); | 405 | fattr->cf_ctime = cifs_NTtimeToUnix(info->ChangeTime); |
432 | pfnd_dat->LastAccessTime = | 406 | fattr->cf_mtime = cifs_NTtimeToUnix(info->LastWriteTime); |
433 | cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME)); | 407 | |
434 | pfnd_dat->LastWriteTime = | 408 | if (adjust_tz) { |
435 | cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME)); | 409 | fattr->cf_ctime.tv_sec += cifs_sb->tcon->ses->server->timeAdj; |
436 | pfnd_dat->ChangeTime = | 410 | fattr->cf_mtime.tv_sec += cifs_sb->tcon->ses->server->timeAdj; |
437 | cpu_to_le64(cifs_UnixTimeToNT(CURRENT_TIME)); | 411 | } |
438 | pfnd_dat->Attributes = cpu_to_le32(ATTR_DIRECTORY); | 412 | |
439 | pfnd_dat->NumberOfLinks = cpu_to_le32(2); | 413 | fattr->cf_eof = le64_to_cpu(info->EndOfFile); |
414 | fattr->cf_bytes = le64_to_cpu(info->AllocationSize); | ||
415 | |||
416 | if (fattr->cf_cifsattrs & ATTR_DIRECTORY) { | ||
417 | fattr->cf_mode = S_IFDIR | cifs_sb->mnt_dir_mode; | ||
418 | fattr->cf_dtype = DT_DIR; | ||
419 | } else { | ||
420 | fattr->cf_mode = S_IFREG | cifs_sb->mnt_file_mode; | ||
421 | fattr->cf_dtype = DT_REG; | ||
422 | |||
423 | /* clear write bits if ATTR_READONLY is set */ | ||
424 | if (fattr->cf_cifsattrs & ATTR_READONLY) | ||
425 | fattr->cf_mode &= ~(S_IWUGO); | ||
426 | } | ||
427 | |||
428 | fattr->cf_nlink = le32_to_cpu(info->NumberOfLinks); | ||
429 | |||
430 | fattr->cf_uid = cifs_sb->mnt_uid; | ||
431 | fattr->cf_gid = cifs_sb->mnt_gid; | ||
440 | } | 432 | } |
441 | 433 | ||
442 | int cifs_get_inode_info(struct inode **pinode, | 434 | int cifs_get_inode_info(struct inode **pinode, |
443 | const unsigned char *full_path, FILE_ALL_INFO *pfindData, | 435 | const unsigned char *full_path, FILE_ALL_INFO *pfindData, |
444 | struct super_block *sb, int xid, const __u16 *pfid) | 436 | struct super_block *sb, int xid, const __u16 *pfid) |
445 | { | 437 | { |
446 | int rc = 0; | 438 | int rc = 0, tmprc; |
447 | __u32 attr; | ||
448 | struct cifsInodeInfo *cifsInfo; | ||
449 | struct cifsTconInfo *pTcon; | 439 | struct cifsTconInfo *pTcon; |
450 | struct inode *inode; | ||
451 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); | 440 | struct cifs_sb_info *cifs_sb = CIFS_SB(sb); |
452 | char *buf = NULL; | 441 | char *buf = NULL; |
453 | bool adjustTZ = false; | 442 | bool adjustTZ = false; |
454 | bool is_dfs_referral = false; | 443 | struct cifs_fattr fattr; |
455 | umode_t default_mode; | ||
456 | 444 | ||
457 | pTcon = cifs_sb->tcon; | 445 | pTcon = cifs_sb->tcon; |
458 | cFYI(1, ("Getting info on %s", full_path)); | 446 | cFYI(1, ("Getting info on %s", full_path)); |
@@ -487,163 +475,82 @@ int cifs_get_inode_info(struct inode **pinode, | |||
487 | adjustTZ = true; | 475 | adjustTZ = true; |
488 | } | 476 | } |
489 | } | 477 | } |
490 | /* dump_mem("\nQPathInfo return data",&findData, sizeof(findData)); */ | 478 | |
491 | if (rc == -EREMOTE) { | 479 | if (!rc) { |
492 | is_dfs_referral = true; | 480 | cifs_all_info_to_fattr(&fattr, (FILE_ALL_INFO *) pfindData, |
493 | fill_fake_finddata(pfindData, sb); | 481 | cifs_sb, adjustTZ); |
482 | } else if (rc == -EREMOTE) { | ||
483 | cifs_create_dfs_fattr(&fattr, sb); | ||
494 | rc = 0; | 484 | rc = 0; |
495 | } else if (rc) | 485 | } else { |
496 | goto cgii_exit; | 486 | goto cgii_exit; |
487 | } | ||
497 | 488 | ||
498 | attr = le32_to_cpu(pfindData->Attributes); | 489 | /* |
499 | 490 | * If an inode wasn't passed in, then get the inode number | |
500 | /* get new inode */ | 491 | * |
492 | * Is an i_ino of zero legal? Can we use that to check if the server | ||
493 | * supports returning inode numbers? Are there other sanity checks we | ||
494 | * can use to ensure that the server is really filling in that field? | ||
495 | * | ||
496 | * We can not use the IndexNumber field by default from Windows or | ||
497 | * Samba (in ALL_INFO buf) but we can request it explicitly. The SNIA | ||
498 | * CIFS spec claims that this value is unique within the scope of a | ||
499 | * share, and the windows docs hint that it's actually unique | ||
500 | * per-machine. | ||
501 | * | ||
502 | * There may be higher info levels that work but are there Windows | ||
503 | * server or network appliances for which IndexNumber field is not | ||
504 | * guaranteed unique? | ||
505 | */ | ||
501 | if (*pinode == NULL) { | 506 | if (*pinode == NULL) { |
502 | __u64 inode_num; | ||
503 | __u64 *pinum = &inode_num; | ||
504 | |||
505 | /* Is an i_ino of zero legal? Can we use that to check | ||
506 | if the server supports returning inode numbers? Are | ||
507 | there other sanity checks we can use to ensure that | ||
508 | the server is really filling in that field? */ | ||
509 | |||
510 | /* We can not use the IndexNumber field by default from | ||
511 | Windows or Samba (in ALL_INFO buf) but we can request | ||
512 | it explicitly. It may not be unique presumably if | ||
513 | the server has multiple devices mounted under one share */ | ||
514 | |||
515 | /* There may be higher info levels that work but are | ||
516 | there Windows server or network appliances for which | ||
517 | IndexNumber field is not guaranteed unique? */ | ||
518 | |||
519 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { | 507 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) { |
520 | int rc1 = 0; | 508 | int rc1 = 0; |
521 | 509 | ||
522 | rc1 = CIFSGetSrvInodeNumber(xid, pTcon, | 510 | rc1 = CIFSGetSrvInodeNumber(xid, pTcon, |
523 | full_path, pinum, | 511 | full_path, &fattr.cf_uniqueid, |
524 | cifs_sb->local_nls, | 512 | cifs_sb->local_nls, |
525 | cifs_sb->mnt_cifs_flags & | 513 | cifs_sb->mnt_cifs_flags & |
526 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 514 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
527 | if (rc1) { | 515 | if (rc1) { |
528 | cFYI(1, ("GetSrvInodeNum rc %d", rc1)); | ||
529 | pinum = NULL; | ||
530 | /* BB EOPNOSUPP disable SERVER_INUM? */ | 516 | /* BB EOPNOSUPP disable SERVER_INUM? */ |
517 | cFYI(1, ("GetSrvInodeNum rc %d", rc1)); | ||
518 | fattr.cf_uniqueid = iunique(sb, ROOT_I); | ||
531 | } | 519 | } |
532 | } else { | 520 | } else { |
533 | pinum = NULL; | 521 | fattr.cf_uniqueid = iunique(sb, ROOT_I); |
534 | } | ||
535 | |||
536 | *pinode = cifs_new_inode(sb, pinum); | ||
537 | if (*pinode == NULL) { | ||
538 | rc = -ENOMEM; | ||
539 | goto cgii_exit; | ||
540 | } | 522 | } |
541 | } | ||
542 | inode = *pinode; | ||
543 | cifsInfo = CIFS_I(inode); | ||
544 | cifsInfo->cifsAttrs = attr; | ||
545 | cifsInfo->delete_pending = pfindData->DeletePending ? true : false; | ||
546 | cFYI(1, ("Old time %ld", cifsInfo->time)); | ||
547 | cifsInfo->time = jiffies; | ||
548 | cFYI(1, ("New time %ld", cifsInfo->time)); | ||
549 | |||
550 | /* blksize needs to be multiple of two. So safer to default to | ||
551 | blksize and blkbits set in superblock so 2**blkbits and blksize | ||
552 | will match rather than setting to: | ||
553 | (pTcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE) & 0xFFFFFE00;*/ | ||
554 | |||
555 | /* Linux can not store file creation time so ignore it */ | ||
556 | if (pfindData->LastAccessTime) | ||
557 | inode->i_atime = cifs_NTtimeToUnix(pfindData->LastAccessTime); | ||
558 | else /* do not need to use current_fs_time - time not stored */ | ||
559 | inode->i_atime = CURRENT_TIME; | ||
560 | inode->i_mtime = cifs_NTtimeToUnix(pfindData->LastWriteTime); | ||
561 | inode->i_ctime = cifs_NTtimeToUnix(pfindData->ChangeTime); | ||
562 | cFYI(DBG2, ("Attributes came in as 0x%x", attr)); | ||
563 | if (adjustTZ && (pTcon->ses) && (pTcon->ses->server)) { | ||
564 | inode->i_ctime.tv_sec += pTcon->ses->server->timeAdj; | ||
565 | inode->i_mtime.tv_sec += pTcon->ses->server->timeAdj; | ||
566 | } | ||
567 | |||
568 | /* get default inode mode */ | ||
569 | if (attr & ATTR_DIRECTORY) | ||
570 | default_mode = cifs_sb->mnt_dir_mode; | ||
571 | else | ||
572 | default_mode = cifs_sb->mnt_file_mode; | ||
573 | |||
574 | /* set permission bits */ | ||
575 | if (atomic_read(&cifsInfo->inUse) == 0 || | ||
576 | (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM) == 0) | ||
577 | inode->i_mode = default_mode; | ||
578 | else { | ||
579 | /* just reenable write bits if !ATTR_READONLY */ | ||
580 | if ((inode->i_mode & S_IWUGO) == 0 && | ||
581 | (attr & ATTR_READONLY) == 0) | ||
582 | inode->i_mode |= (S_IWUGO & default_mode); | ||
583 | |||
584 | inode->i_mode &= ~S_IFMT; | ||
585 | } | ||
586 | /* clear write bits if ATTR_READONLY is set */ | ||
587 | if (attr & ATTR_READONLY) | ||
588 | inode->i_mode &= ~S_IWUGO; | ||
589 | |||
590 | /* set inode type */ | ||
591 | if ((attr & ATTR_SYSTEM) && | ||
592 | (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL)) { | ||
593 | /* no need to fix endianness on 0 */ | ||
594 | if (pfindData->EndOfFile == 0) | ||
595 | inode->i_mode |= S_IFIFO; | ||
596 | else if (decode_sfu_inode(inode, | ||
597 | le64_to_cpu(pfindData->EndOfFile), | ||
598 | full_path, cifs_sb, xid)) | ||
599 | cFYI(1, ("unknown SFU file type\n")); | ||
600 | } else { | 523 | } else { |
601 | if (attr & ATTR_DIRECTORY) | 524 | fattr.cf_uniqueid = CIFS_I(*pinode)->uniqueid; |
602 | inode->i_mode |= S_IFDIR; | ||
603 | else | ||
604 | inode->i_mode |= S_IFREG; | ||
605 | } | 525 | } |
606 | 526 | ||
607 | cifsInfo->server_eof = le64_to_cpu(pfindData->EndOfFile); | 527 | /* query for SFU type info if supported and needed */ |
608 | spin_lock(&inode->i_lock); | 528 | if (fattr.cf_cifsattrs & ATTR_SYSTEM && |
609 | if (is_size_safe_to_change(cifsInfo, cifsInfo->server_eof)) { | 529 | cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) { |
610 | /* can not safely shrink the file size here if the | 530 | tmprc = cifs_sfu_type(&fattr, full_path, cifs_sb, xid); |
611 | client is writing to it due to potential races */ | 531 | if (tmprc) |
612 | i_size_write(inode, cifsInfo->server_eof); | 532 | cFYI(1, ("cifs_sfu_type failed: %d", tmprc)); |
613 | |||
614 | /* 512 bytes (2**9) is the fake blocksize that must be | ||
615 | used for this calculation */ | ||
616 | inode->i_blocks = (512 - 1 + le64_to_cpu( | ||
617 | pfindData->AllocationSize)) >> 9; | ||
618 | } | 533 | } |
619 | spin_unlock(&inode->i_lock); | ||
620 | 534 | ||
621 | inode->i_nlink = le32_to_cpu(pfindData->NumberOfLinks); | ||
622 | |||
623 | /* BB fill in uid and gid here? with help from winbind? | ||
624 | or retrieve from NTFS stream extended attribute */ | ||
625 | #ifdef CONFIG_CIFS_EXPERIMENTAL | 535 | #ifdef CONFIG_CIFS_EXPERIMENTAL |
626 | /* fill in 0777 bits from ACL */ | 536 | /* fill in 0777 bits from ACL */ |
627 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) { | 537 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) { |
628 | cFYI(1, ("Getting mode bits from ACL")); | 538 | cFYI(1, ("Getting mode bits from ACL")); |
629 | acl_to_uid_mode(cifs_sb, inode, full_path, pfid); | 539 | cifs_acl_to_fattr(cifs_sb, &fattr, *pinode, full_path, pfid); |
630 | } | 540 | } |
631 | #endif | 541 | #endif |
632 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) { | ||
633 | /* fill in remaining high mode bits e.g. SUID, VTX */ | ||
634 | get_sfu_mode(inode, full_path, cifs_sb, xid); | ||
635 | } else if (atomic_read(&cifsInfo->inUse) == 0) { | ||
636 | inode->i_uid = cifs_sb->mnt_uid; | ||
637 | inode->i_gid = cifs_sb->mnt_gid; | ||
638 | /* set so we do not keep refreshing these fields with | ||
639 | bad data after user has changed them in memory */ | ||
640 | atomic_set(&cifsInfo->inUse, 1); | ||
641 | } | ||
642 | |||
643 | cifs_set_ops(inode, is_dfs_referral); | ||
644 | |||
645 | 542 | ||
543 | /* fill in remaining high mode bits e.g. SUID, VTX */ | ||
544 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) | ||
545 | cifs_sfu_mode(&fattr, full_path, cifs_sb, xid); | ||
646 | 546 | ||
547 | if (!*pinode) { | ||
548 | *pinode = cifs_iget(sb, &fattr); | ||
549 | if (!*pinode) | ||
550 | rc = -ENOMEM; | ||
551 | } else { | ||
552 | cifs_fattr_to_inode(*pinode, &fattr); | ||
553 | } | ||
647 | 554 | ||
648 | cgii_exit: | 555 | cgii_exit: |
649 | kfree(buf); | 556 | kfree(buf); |
@@ -695,33 +602,78 @@ char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb) | |||
695 | return full_path; | 602 | return full_path; |
696 | } | 603 | } |
697 | 604 | ||
605 | static int | ||
606 | cifs_find_inode(struct inode *inode, void *opaque) | ||
607 | { | ||
608 | struct cifs_fattr *fattr = (struct cifs_fattr *) opaque; | ||
609 | |||
610 | if (CIFS_I(inode)->uniqueid != fattr->cf_uniqueid) | ||
611 | return 0; | ||
612 | |||
613 | return 1; | ||
614 | } | ||
615 | |||
616 | static int | ||
617 | cifs_init_inode(struct inode *inode, void *opaque) | ||
618 | { | ||
619 | struct cifs_fattr *fattr = (struct cifs_fattr *) opaque; | ||
620 | |||
621 | CIFS_I(inode)->uniqueid = fattr->cf_uniqueid; | ||
622 | return 0; | ||
623 | } | ||
624 | |||
625 | /* Given fattrs, get a corresponding inode */ | ||
626 | struct inode * | ||
627 | cifs_iget(struct super_block *sb, struct cifs_fattr *fattr) | ||
628 | { | ||
629 | unsigned long hash; | ||
630 | struct inode *inode; | ||
631 | |||
632 | cFYI(1, ("looking for uniqueid=%llu", fattr->cf_uniqueid)); | ||
633 | |||
634 | /* hash down to 32-bits on 32-bit arch */ | ||
635 | hash = cifs_uniqueid_to_ino_t(fattr->cf_uniqueid); | ||
636 | |||
637 | inode = iget5_locked(sb, hash, cifs_find_inode, cifs_init_inode, fattr); | ||
638 | |||
639 | /* we have fattrs in hand, update the inode */ | ||
640 | if (inode) { | ||
641 | cifs_fattr_to_inode(inode, fattr); | ||
642 | if (sb->s_flags & MS_NOATIME) | ||
643 | inode->i_flags |= S_NOATIME | S_NOCMTIME; | ||
644 | if (inode->i_state & I_NEW) { | ||
645 | inode->i_ino = hash; | ||
646 | unlock_new_inode(inode); | ||
647 | } | ||
648 | } | ||
649 | |||
650 | return inode; | ||
651 | } | ||
652 | |||
698 | /* gets root inode */ | 653 | /* gets root inode */ |
699 | struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino) | 654 | struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino) |
700 | { | 655 | { |
701 | int xid; | 656 | int xid; |
702 | struct cifs_sb_info *cifs_sb; | 657 | struct cifs_sb_info *cifs_sb; |
703 | struct inode *inode; | 658 | struct inode *inode = NULL; |
704 | long rc; | 659 | long rc; |
705 | char *full_path; | 660 | char *full_path; |
706 | 661 | ||
707 | inode = iget_locked(sb, ino); | 662 | cifs_sb = CIFS_SB(sb); |
708 | if (!inode) | ||
709 | return ERR_PTR(-ENOMEM); | ||
710 | if (!(inode->i_state & I_NEW)) | ||
711 | return inode; | ||
712 | |||
713 | cifs_sb = CIFS_SB(inode->i_sb); | ||
714 | full_path = cifs_build_path_to_root(cifs_sb); | 663 | full_path = cifs_build_path_to_root(cifs_sb); |
715 | if (full_path == NULL) | 664 | if (full_path == NULL) |
716 | return ERR_PTR(-ENOMEM); | 665 | return ERR_PTR(-ENOMEM); |
717 | 666 | ||
718 | xid = GetXid(); | 667 | xid = GetXid(); |
719 | if (cifs_sb->tcon->unix_ext) | 668 | if (cifs_sb->tcon->unix_ext) |
720 | rc = cifs_get_inode_info_unix(&inode, full_path, inode->i_sb, | 669 | rc = cifs_get_inode_info_unix(&inode, full_path, sb, xid); |
721 | xid); | ||
722 | else | 670 | else |
723 | rc = cifs_get_inode_info(&inode, full_path, NULL, inode->i_sb, | 671 | rc = cifs_get_inode_info(&inode, full_path, NULL, sb, |
724 | xid, NULL); | 672 | xid, NULL); |
673 | |||
674 | if (!inode) | ||
675 | return ERR_PTR(-ENOMEM); | ||
676 | |||
725 | if (rc && cifs_sb->tcon->ipc) { | 677 | if (rc && cifs_sb->tcon->ipc) { |
726 | cFYI(1, ("ipc connection - fake read inode")); | 678 | cFYI(1, ("ipc connection - fake read inode")); |
727 | inode->i_mode |= S_IFDIR; | 679 | inode->i_mode |= S_IFDIR; |
@@ -737,7 +689,6 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino) | |||
737 | return ERR_PTR(rc); | 689 | return ERR_PTR(rc); |
738 | } | 690 | } |
739 | 691 | ||
740 | unlock_new_inode(inode); | ||
741 | 692 | ||
742 | kfree(full_path); | 693 | kfree(full_path); |
743 | /* can not call macro FreeXid here since in a void func | 694 | /* can not call macro FreeXid here since in a void func |
@@ -1063,44 +1014,6 @@ out_reval: | |||
1063 | return rc; | 1014 | return rc; |
1064 | } | 1015 | } |
1065 | 1016 | ||
1066 | void posix_fill_in_inode(struct inode *tmp_inode, | ||
1067 | FILE_UNIX_BASIC_INFO *pData, int isNewInode) | ||
1068 | { | ||
1069 | struct cifsInodeInfo *cifsInfo = CIFS_I(tmp_inode); | ||
1070 | loff_t local_size; | ||
1071 | struct timespec local_mtime; | ||
1072 | |||
1073 | cifsInfo->time = jiffies; | ||
1074 | atomic_inc(&cifsInfo->inUse); | ||
1075 | |||
1076 | /* save mtime and size */ | ||
1077 | local_mtime = tmp_inode->i_mtime; | ||
1078 | local_size = tmp_inode->i_size; | ||
1079 | |||
1080 | cifs_unix_info_to_inode(tmp_inode, pData, 1); | ||
1081 | cifs_set_ops(tmp_inode, false); | ||
1082 | |||
1083 | if (!S_ISREG(tmp_inode->i_mode)) | ||
1084 | return; | ||
1085 | |||
1086 | /* | ||
1087 | * No sense invalidating pages for new inode | ||
1088 | * since we we have not started caching | ||
1089 | * readahead file data yet. | ||
1090 | */ | ||
1091 | if (isNewInode) | ||
1092 | return; | ||
1093 | |||
1094 | if (timespec_equal(&tmp_inode->i_mtime, &local_mtime) && | ||
1095 | (local_size == tmp_inode->i_size)) { | ||
1096 | cFYI(1, ("inode exists but unchanged")); | ||
1097 | } else { | ||
1098 | /* file may have changed on server */ | ||
1099 | cFYI(1, ("invalidate inode, readdir detected change")); | ||
1100 | invalidate_remote_inode(tmp_inode); | ||
1101 | } | ||
1102 | } | ||
1103 | |||
1104 | int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) | 1017 | int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) |
1105 | { | 1018 | { |
1106 | int rc = 0, tmprc; | 1019 | int rc = 0, tmprc; |
@@ -1109,6 +1022,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) | |||
1109 | struct cifsTconInfo *pTcon; | 1022 | struct cifsTconInfo *pTcon; |
1110 | char *full_path = NULL; | 1023 | char *full_path = NULL; |
1111 | struct inode *newinode = NULL; | 1024 | struct inode *newinode = NULL; |
1025 | struct cifs_fattr fattr; | ||
1112 | 1026 | ||
1113 | cFYI(1, ("In cifs_mkdir, mode = 0x%x inode = 0x%p", mode, inode)); | 1027 | cFYI(1, ("In cifs_mkdir, mode = 0x%x inode = 0x%p", mode, inode)); |
1114 | 1028 | ||
@@ -1148,7 +1062,6 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) | |||
1148 | cFYI(1, ("posix mkdir returned 0x%x", rc)); | 1062 | cFYI(1, ("posix mkdir returned 0x%x", rc)); |
1149 | d_drop(direntry); | 1063 | d_drop(direntry); |
1150 | } else { | 1064 | } else { |
1151 | __u64 unique_id; | ||
1152 | if (pInfo->Type == cpu_to_le32(-1)) { | 1065 | if (pInfo->Type == cpu_to_le32(-1)) { |
1153 | /* no return info, go query for it */ | 1066 | /* no return info, go query for it */ |
1154 | kfree(pInfo); | 1067 | kfree(pInfo); |
@@ -1162,20 +1075,15 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) | |||
1162 | else | 1075 | else |
1163 | direntry->d_op = &cifs_dentry_ops; | 1076 | direntry->d_op = &cifs_dentry_ops; |
1164 | 1077 | ||
1165 | unique_id = le64_to_cpu(pInfo->UniqueId); | 1078 | cifs_unix_basic_to_fattr(&fattr, pInfo, cifs_sb); |
1166 | newinode = cifs_new_inode(inode->i_sb, &unique_id); | 1079 | newinode = cifs_iget(inode->i_sb, &fattr); |
1167 | if (newinode == NULL) { | 1080 | if (!newinode) { |
1168 | kfree(pInfo); | 1081 | kfree(pInfo); |
1169 | goto mkdir_get_info; | 1082 | goto mkdir_get_info; |
1170 | } | 1083 | } |
1171 | 1084 | ||
1172 | newinode->i_nlink = 2; | ||
1173 | d_instantiate(direntry, newinode); | 1085 | d_instantiate(direntry, newinode); |
1174 | 1086 | ||
1175 | /* we already checked in POSIXCreate whether | ||
1176 | frame was long enough */ | ||
1177 | posix_fill_in_inode(direntry->d_inode, | ||
1178 | pInfo, 1 /* NewInode */); | ||
1179 | #ifdef CONFIG_CIFS_DEBUG2 | 1087 | #ifdef CONFIG_CIFS_DEBUG2 |
1180 | cFYI(1, ("instantiated dentry %p %s to inode %p", | 1088 | cFYI(1, ("instantiated dentry %p %s to inode %p", |
1181 | direntry, direntry->d_name.name, newinode)); | 1089 | direntry, direntry->d_name.name, newinode)); |
@@ -1238,10 +1146,10 @@ mkdir_get_info: | |||
1238 | args.uid = NO_CHANGE_64; | 1146 | args.uid = NO_CHANGE_64; |
1239 | args.gid = NO_CHANGE_64; | 1147 | args.gid = NO_CHANGE_64; |
1240 | } | 1148 | } |
1241 | CIFSSMBUnixSetInfo(xid, pTcon, full_path, &args, | 1149 | CIFSSMBUnixSetPathInfo(xid, pTcon, full_path, &args, |
1242 | cifs_sb->local_nls, | 1150 | cifs_sb->local_nls, |
1243 | cifs_sb->mnt_cifs_flags & | 1151 | cifs_sb->mnt_cifs_flags & |
1244 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 1152 | CIFS_MOUNT_MAP_SPECIAL_CHR); |
1245 | } else { | 1153 | } else { |
1246 | if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) && | 1154 | if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) && |
1247 | (mode & S_IWUGO) == 0) { | 1155 | (mode & S_IWUGO) == 0) { |
@@ -1622,6 +1530,7 @@ int cifs_getattr(struct vfsmount *mnt, struct dentry *dentry, | |||
1622 | if (!err) { | 1530 | if (!err) { |
1623 | generic_fillattr(dentry->d_inode, stat); | 1531 | generic_fillattr(dentry->d_inode, stat); |
1624 | stat->blksize = CIFS_MAX_MSGSIZE; | 1532 | stat->blksize = CIFS_MAX_MSGSIZE; |
1533 | stat->ino = CIFS_I(dentry->d_inode)->uniqueid; | ||
1625 | } | 1534 | } |
1626 | return err; | 1535 | return err; |
1627 | } | 1536 | } |
@@ -1786,6 +1695,7 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs) | |||
1786 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); | 1695 | struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); |
1787 | struct cifsTconInfo *pTcon = cifs_sb->tcon; | 1696 | struct cifsTconInfo *pTcon = cifs_sb->tcon; |
1788 | struct cifs_unix_set_info_args *args = NULL; | 1697 | struct cifs_unix_set_info_args *args = NULL; |
1698 | struct cifsFileInfo *open_file; | ||
1789 | 1699 | ||
1790 | cFYI(1, ("setattr_unix on file %s attrs->ia_valid=0x%x", | 1700 | cFYI(1, ("setattr_unix on file %s attrs->ia_valid=0x%x", |
1791 | direntry->d_name.name, attrs->ia_valid)); | 1701 | direntry->d_name.name, attrs->ia_valid)); |
@@ -1872,10 +1782,18 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs) | |||
1872 | args->ctime = NO_CHANGE_64; | 1782 | args->ctime = NO_CHANGE_64; |
1873 | 1783 | ||
1874 | args->device = 0; | 1784 | args->device = 0; |
1875 | rc = CIFSSMBUnixSetInfo(xid, pTcon, full_path, args, | 1785 | open_file = find_writable_file(cifsInode); |
1876 | cifs_sb->local_nls, | 1786 | if (open_file) { |
1877 | cifs_sb->mnt_cifs_flags & | 1787 | u16 nfid = open_file->netfid; |
1878 | CIFS_MOUNT_MAP_SPECIAL_CHR); | 1788 | u32 npid = open_file->pid; |
1789 | rc = CIFSSMBUnixSetFileInfo(xid, pTcon, args, nfid, npid); | ||
1790 | atomic_dec(&open_file->wrtPending); | ||
1791 | } else { | ||
1792 | rc = CIFSSMBUnixSetPathInfo(xid, pTcon, full_path, args, | ||
1793 | cifs_sb->local_nls, | ||
1794 | cifs_sb->mnt_cifs_flags & | ||
1795 | CIFS_MOUNT_MAP_SPECIAL_CHR); | ||
1796 | } | ||
1879 | 1797 | ||
1880 | if (!rc) | 1798 | if (!rc) |
1881 | rc = inode_setattr(inode, attrs); | 1799 | rc = inode_setattr(inode, attrs); |
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c index 86d0055dc529..f823a4a208a7 100644 --- a/fs/cifs/readdir.c +++ b/fs/cifs/readdir.c | |||
@@ -63,374 +63,123 @@ static inline void dump_cifs_file_struct(struct file *file, char *label) | |||
63 | } | 63 | } |
64 | #endif /* DEBUG2 */ | 64 | #endif /* DEBUG2 */ |
65 | 65 | ||
66 | /* Returns 1 if new inode created, 2 if both dentry and inode were */ | 66 | /* |
67 | /* Might check in the future if inode number changed so we can rehash inode */ | 67 | * Find the dentry that matches "name". If there isn't one, create one. If it's |
68 | static int | 68 | * a negative dentry or the uniqueid changed, then drop it and recreate it. |
69 | construct_dentry(struct qstr *qstring, struct file *file, | 69 | */ |
70 | struct inode **ptmp_inode, struct dentry **pnew_dentry, | 70 | static struct dentry * |
71 | __u64 *inum) | 71 | cifs_readdir_lookup(struct dentry *parent, struct qstr *name, |
72 | struct cifs_fattr *fattr) | ||
72 | { | 73 | { |
73 | struct dentry *tmp_dentry = NULL; | 74 | struct dentry *dentry, *alias; |
74 | struct super_block *sb = file->f_path.dentry->d_sb; | 75 | struct inode *inode; |
75 | int rc = 0; | 76 | struct super_block *sb = parent->d_inode->i_sb; |
77 | |||
78 | cFYI(1, ("For %s", name->name)); | ||
79 | |||
80 | dentry = d_lookup(parent, name); | ||
81 | if (dentry) { | ||
82 | /* FIXME: check for inode number changes? */ | ||
83 | if (dentry->d_inode != NULL) | ||
84 | return dentry; | ||
85 | d_drop(dentry); | ||
86 | dput(dentry); | ||
87 | } | ||
76 | 88 | ||
77 | cFYI(1, ("For %s", qstring->name)); | 89 | dentry = d_alloc(parent, name); |
78 | 90 | if (dentry == NULL) | |
79 | qstring->hash = full_name_hash(qstring->name, qstring->len); | 91 | return NULL; |
80 | tmp_dentry = d_lookup(file->f_path.dentry, qstring); | ||
81 | if (tmp_dentry) { | ||
82 | /* BB: overwrite old name? i.e. tmp_dentry->d_name and | ||
83 | * tmp_dentry->d_name.len?? | ||
84 | */ | ||
85 | cFYI(0, ("existing dentry with inode 0x%p", | ||
86 | tmp_dentry->d_inode)); | ||
87 | *ptmp_inode = tmp_dentry->d_inode; | ||
88 | if (*ptmp_inode == NULL) { | ||
89 | *ptmp_inode = cifs_new_inode(sb, inum); | ||
90 | if (*ptmp_inode == NULL) | ||
91 | return rc; | ||
92 | rc = 1; | ||
93 | } | ||
94 | } else { | ||
95 | tmp_dentry = d_alloc(file->f_path.dentry, qstring); | ||
96 | if (tmp_dentry == NULL) { | ||
97 | cERROR(1, ("Failed allocating dentry")); | ||
98 | *ptmp_inode = NULL; | ||
99 | return rc; | ||
100 | } | ||
101 | 92 | ||
102 | if (CIFS_SB(sb)->tcon->nocase) | 93 | inode = cifs_iget(sb, fattr); |
103 | tmp_dentry->d_op = &cifs_ci_dentry_ops; | 94 | if (!inode) { |
104 | else | 95 | dput(dentry); |
105 | tmp_dentry->d_op = &cifs_dentry_ops; | 96 | return NULL; |
97 | } | ||
106 | 98 | ||
107 | *ptmp_inode = cifs_new_inode(sb, inum); | 99 | if (CIFS_SB(sb)->tcon->nocase) |
108 | if (*ptmp_inode == NULL) | 100 | dentry->d_op = &cifs_ci_dentry_ops; |
109 | return rc; | 101 | else |
110 | rc = 2; | 102 | dentry->d_op = &cifs_dentry_ops; |
103 | |||
104 | alias = d_materialise_unique(dentry, inode); | ||
105 | if (alias != NULL) { | ||
106 | dput(dentry); | ||
107 | if (IS_ERR(alias)) | ||
108 | return NULL; | ||
109 | dentry = alias; | ||
111 | } | 110 | } |
112 | 111 | ||
113 | tmp_dentry->d_time = jiffies; | 112 | return dentry; |
114 | *pnew_dentry = tmp_dentry; | ||
115 | return rc; | ||
116 | } | 113 | } |
117 | 114 | ||
118 | static void fill_in_inode(struct inode *tmp_inode, int new_buf_type, | 115 | static void |
119 | char *buf, unsigned int *pobject_type, int isNewInode) | 116 | cifs_fill_common_info(struct cifs_fattr *fattr, struct cifs_sb_info *cifs_sb) |
120 | { | 117 | { |
121 | loff_t local_size; | 118 | fattr->cf_uid = cifs_sb->mnt_uid; |
122 | struct timespec local_mtime; | 119 | fattr->cf_gid = cifs_sb->mnt_gid; |
123 | |||
124 | struct cifsInodeInfo *cifsInfo = CIFS_I(tmp_inode); | ||
125 | struct cifs_sb_info *cifs_sb = CIFS_SB(tmp_inode->i_sb); | ||
126 | __u32 attr; | ||
127 | __u64 allocation_size; | ||
128 | __u64 end_of_file; | ||
129 | umode_t default_mode; | ||
130 | |||
131 | /* save mtime and size */ | ||
132 | local_mtime = tmp_inode->i_mtime; | ||
133 | local_size = tmp_inode->i_size; | ||
134 | |||
135 | if (new_buf_type) { | ||
136 | FILE_DIRECTORY_INFO *pfindData = (FILE_DIRECTORY_INFO *)buf; | ||
137 | |||
138 | attr = le32_to_cpu(pfindData->ExtFileAttributes); | ||
139 | allocation_size = le64_to_cpu(pfindData->AllocationSize); | ||
140 | end_of_file = le64_to_cpu(pfindData->EndOfFile); | ||
141 | tmp_inode->i_atime = | ||
142 | cifs_NTtimeToUnix(pfindData->LastAccessTime); | ||
143 | tmp_inode->i_mtime = | ||
144 | cifs_NTtimeToUnix(pfindData->LastWriteTime); | ||
145 | tmp_inode->i_ctime = | ||
146 | cifs_NTtimeToUnix(pfindData->ChangeTime); | ||
147 | } else { /* legacy, OS2 and DOS style */ | ||
148 | int offset = cifs_sb->tcon->ses->server->timeAdj; | ||
149 | FIND_FILE_STANDARD_INFO *pfindData = | ||
150 | (FIND_FILE_STANDARD_INFO *)buf; | ||
151 | |||
152 | tmp_inode->i_mtime = cnvrtDosUnixTm(pfindData->LastWriteDate, | ||
153 | pfindData->LastWriteTime, | ||
154 | offset); | ||
155 | tmp_inode->i_atime = cnvrtDosUnixTm(pfindData->LastAccessDate, | ||
156 | pfindData->LastAccessTime, | ||
157 | offset); | ||
158 | tmp_inode->i_ctime = cnvrtDosUnixTm(pfindData->LastWriteDate, | ||
159 | pfindData->LastWriteTime, | ||
160 | offset); | ||
161 | attr = le16_to_cpu(pfindData->Attributes); | ||
162 | allocation_size = le32_to_cpu(pfindData->AllocationSize); | ||
163 | end_of_file = le32_to_cpu(pfindData->DataSize); | ||
164 | } | ||
165 | 120 | ||
166 | /* Linux can not store file creation time unfortunately so ignore it */ | 121 | if (fattr->cf_cifsattrs & ATTR_DIRECTORY) { |
167 | 122 | fattr->cf_mode = S_IFDIR | cifs_sb->mnt_dir_mode; | |
168 | cifsInfo->cifsAttrs = attr; | 123 | fattr->cf_dtype = DT_DIR; |
169 | #ifdef CONFIG_CIFS_EXPERIMENTAL | 124 | } else { |
170 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_CIFS_ACL) { | 125 | fattr->cf_mode = S_IFREG | cifs_sb->mnt_file_mode; |
171 | /* get more accurate mode via ACL - so force inode refresh */ | 126 | fattr->cf_dtype = DT_REG; |
172 | cifsInfo->time = 0; | ||
173 | } else | ||
174 | #endif /* CONFIG_CIFS_EXPERIMENTAL */ | ||
175 | cifsInfo->time = jiffies; | ||
176 | |||
177 | /* treat dos attribute of read-only as read-only mode bit e.g. 555? */ | ||
178 | /* 2767 perms - indicate mandatory locking */ | ||
179 | /* BB fill in uid and gid here? with help from winbind? | ||
180 | or retrieve from NTFS stream extended attribute */ | ||
181 | if (atomic_read(&cifsInfo->inUse) == 0) { | ||
182 | tmp_inode->i_uid = cifs_sb->mnt_uid; | ||
183 | tmp_inode->i_gid = cifs_sb->mnt_gid; | ||
184 | } | ||
185 | |||
186 | if (attr & ATTR_DIRECTORY) | ||
187 | default_mode = cifs_sb->mnt_dir_mode; | ||
188 | else | ||
189 | default_mode = cifs_sb->mnt_file_mode; | ||
190 | |||
191 | /* set initial permissions */ | ||
192 | if ((atomic_read(&cifsInfo->inUse) == 0) || | ||
193 | (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM) == 0) | ||
194 | tmp_inode->i_mode = default_mode; | ||
195 | else { | ||
196 | /* just reenable write bits if !ATTR_READONLY */ | ||
197 | if ((tmp_inode->i_mode & S_IWUGO) == 0 && | ||
198 | (attr & ATTR_READONLY) == 0) | ||
199 | tmp_inode->i_mode |= (S_IWUGO & default_mode); | ||
200 | |||
201 | tmp_inode->i_mode &= ~S_IFMT; | ||
202 | } | 127 | } |
203 | 128 | ||
204 | /* clear write bits if ATTR_READONLY is set */ | 129 | if (fattr->cf_cifsattrs & ATTR_READONLY) |
205 | if (attr & ATTR_READONLY) | 130 | fattr->cf_mode &= ~S_IWUGO; |
206 | tmp_inode->i_mode &= ~S_IWUGO; | ||
207 | 131 | ||
208 | /* set inode type */ | 132 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL && |
209 | if ((attr & ATTR_SYSTEM) && | 133 | fattr->cf_cifsattrs & ATTR_SYSTEM) { |
210 | (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL)) { | 134 | if (fattr->cf_eof == 0) { |
211 | if (end_of_file == 0) { | 135 | fattr->cf_mode &= ~S_IFMT; |
212 | tmp_inode->i_mode |= S_IFIFO; | 136 | fattr->cf_mode |= S_IFIFO; |
213 | *pobject_type = DT_FIFO; | 137 | fattr->cf_dtype = DT_FIFO; |
214 | } else { | 138 | } else { |
215 | /* | 139 | /* |
216 | * trying to get the type can be slow, so just call | 140 | * trying to get the type and mode via SFU can be slow, |
217 | * this a regular file for now, and mark for reval | 141 | * so just call those regular files for now, and mark |
142 | * for reval | ||
218 | */ | 143 | */ |
219 | tmp_inode->i_mode |= S_IFREG; | 144 | fattr->cf_flags |= CIFS_FATTR_NEED_REVAL; |
220 | *pobject_type = DT_REG; | ||
221 | cifsInfo->time = 0; | ||
222 | } | ||
223 | } else { | ||
224 | if (attr & ATTR_DIRECTORY) { | ||
225 | tmp_inode->i_mode |= S_IFDIR; | ||
226 | *pobject_type = DT_DIR; | ||
227 | } else { | ||
228 | tmp_inode->i_mode |= S_IFREG; | ||
229 | *pobject_type = DT_REG; | ||
230 | } | 145 | } |
231 | } | 146 | } |
147 | } | ||
232 | 148 | ||
233 | /* can not fill in nlink here as in qpathinfo version and Unx search */ | 149 | void |
234 | if (atomic_read(&cifsInfo->inUse) == 0) | 150 | cifs_dir_info_to_fattr(struct cifs_fattr *fattr, FILE_DIRECTORY_INFO *info, |
235 | atomic_set(&cifsInfo->inUse, 1); | 151 | struct cifs_sb_info *cifs_sb) |
236 | 152 | { | |
237 | cifsInfo->server_eof = end_of_file; | 153 | memset(fattr, 0, sizeof(*fattr)); |
238 | spin_lock(&tmp_inode->i_lock); | 154 | fattr->cf_cifsattrs = le32_to_cpu(info->ExtFileAttributes); |
239 | if (is_size_safe_to_change(cifsInfo, end_of_file)) { | 155 | fattr->cf_eof = le64_to_cpu(info->EndOfFile); |
240 | /* can not safely change the file size here if the | 156 | fattr->cf_bytes = le64_to_cpu(info->AllocationSize); |
241 | client is writing to it due to potential races */ | 157 | fattr->cf_atime = cifs_NTtimeToUnix(info->LastAccessTime); |
242 | i_size_write(tmp_inode, end_of_file); | 158 | fattr->cf_ctime = cifs_NTtimeToUnix(info->ChangeTime); |
243 | 159 | fattr->cf_mtime = cifs_NTtimeToUnix(info->LastWriteTime); | |
244 | /* 512 bytes (2**9) is the fake blocksize that must be used */ | 160 | |
245 | /* for this calculation, even though the reported blocksize is larger */ | 161 | cifs_fill_common_info(fattr, cifs_sb); |
246 | tmp_inode->i_blocks = (512 - 1 + allocation_size) >> 9; | ||
247 | } | ||
248 | spin_unlock(&tmp_inode->i_lock); | ||
249 | |||
250 | if (allocation_size < end_of_file) | ||
251 | cFYI(1, ("May be sparse file, allocation less than file size")); | ||
252 | cFYI(1, ("File Size %ld and blocks %llu", | ||
253 | (unsigned long)tmp_inode->i_size, | ||
254 | (unsigned long long)tmp_inode->i_blocks)); | ||
255 | if (S_ISREG(tmp_inode->i_mode)) { | ||
256 | cFYI(1, ("File inode")); | ||
257 | tmp_inode->i_op = &cifs_file_inode_ops; | ||
258 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) { | ||
259 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | ||
260 | tmp_inode->i_fop = &cifs_file_direct_nobrl_ops; | ||
261 | else | ||
262 | tmp_inode->i_fop = &cifs_file_direct_ops; | ||
263 | } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | ||
264 | tmp_inode->i_fop = &cifs_file_nobrl_ops; | ||
265 | else | ||
266 | tmp_inode->i_fop = &cifs_file_ops; | ||
267 | |||
268 | if ((cifs_sb->tcon) && (cifs_sb->tcon->ses) && | ||
269 | (cifs_sb->tcon->ses->server->maxBuf < | ||
270 | PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE)) | ||
271 | tmp_inode->i_data.a_ops = &cifs_addr_ops_smallbuf; | ||
272 | else | ||
273 | tmp_inode->i_data.a_ops = &cifs_addr_ops; | ||
274 | |||
275 | if (isNewInode) | ||
276 | return; /* No sense invalidating pages for new inode | ||
277 | since have not started caching readahead file | ||
278 | data yet */ | ||
279 | |||
280 | if (timespec_equal(&tmp_inode->i_mtime, &local_mtime) && | ||
281 | (local_size == tmp_inode->i_size)) { | ||
282 | cFYI(1, ("inode exists but unchanged")); | ||
283 | } else { | ||
284 | /* file may have changed on server */ | ||
285 | cFYI(1, ("invalidate inode, readdir detected change")); | ||
286 | invalidate_remote_inode(tmp_inode); | ||
287 | } | ||
288 | } else if (S_ISDIR(tmp_inode->i_mode)) { | ||
289 | cFYI(1, ("Directory inode")); | ||
290 | tmp_inode->i_op = &cifs_dir_inode_ops; | ||
291 | tmp_inode->i_fop = &cifs_dir_ops; | ||
292 | } else if (S_ISLNK(tmp_inode->i_mode)) { | ||
293 | cFYI(1, ("Symbolic Link inode")); | ||
294 | tmp_inode->i_op = &cifs_symlink_inode_ops; | ||
295 | } else { | ||
296 | cFYI(1, ("Init special inode")); | ||
297 | init_special_inode(tmp_inode, tmp_inode->i_mode, | ||
298 | tmp_inode->i_rdev); | ||
299 | } | ||
300 | } | 162 | } |
301 | 163 | ||
302 | static void unix_fill_in_inode(struct inode *tmp_inode, | 164 | void |
303 | FILE_UNIX_INFO *pfindData, unsigned int *pobject_type, int isNewInode) | 165 | cifs_std_info_to_fattr(struct cifs_fattr *fattr, FIND_FILE_STANDARD_INFO *info, |
166 | struct cifs_sb_info *cifs_sb) | ||
304 | { | 167 | { |
305 | loff_t local_size; | 168 | int offset = cifs_sb->tcon->ses->server->timeAdj; |
306 | struct timespec local_mtime; | ||
307 | |||
308 | struct cifsInodeInfo *cifsInfo = CIFS_I(tmp_inode); | ||
309 | struct cifs_sb_info *cifs_sb = CIFS_SB(tmp_inode->i_sb); | ||
310 | |||
311 | __u32 type = le32_to_cpu(pfindData->Type); | ||
312 | __u64 num_of_bytes = le64_to_cpu(pfindData->NumOfBytes); | ||
313 | __u64 end_of_file = le64_to_cpu(pfindData->EndOfFile); | ||
314 | cifsInfo->time = jiffies; | ||
315 | atomic_inc(&cifsInfo->inUse); | ||
316 | |||
317 | /* save mtime and size */ | ||
318 | local_mtime = tmp_inode->i_mtime; | ||
319 | local_size = tmp_inode->i_size; | ||
320 | |||
321 | tmp_inode->i_atime = | ||
322 | cifs_NTtimeToUnix(pfindData->LastAccessTime); | ||
323 | tmp_inode->i_mtime = | ||
324 | cifs_NTtimeToUnix(pfindData->LastModificationTime); | ||
325 | tmp_inode->i_ctime = | ||
326 | cifs_NTtimeToUnix(pfindData->LastStatusChange); | ||
327 | |||
328 | tmp_inode->i_mode = le64_to_cpu(pfindData->Permissions); | ||
329 | /* since we set the inode type below we need to mask off type | ||
330 | to avoid strange results if bits above were corrupt */ | ||
331 | tmp_inode->i_mode &= ~S_IFMT; | ||
332 | if (type == UNIX_FILE) { | ||
333 | *pobject_type = DT_REG; | ||
334 | tmp_inode->i_mode |= S_IFREG; | ||
335 | } else if (type == UNIX_SYMLINK) { | ||
336 | *pobject_type = DT_LNK; | ||
337 | tmp_inode->i_mode |= S_IFLNK; | ||
338 | } else if (type == UNIX_DIR) { | ||
339 | *pobject_type = DT_DIR; | ||
340 | tmp_inode->i_mode |= S_IFDIR; | ||
341 | } else if (type == UNIX_CHARDEV) { | ||
342 | *pobject_type = DT_CHR; | ||
343 | tmp_inode->i_mode |= S_IFCHR; | ||
344 | tmp_inode->i_rdev = MKDEV(le64_to_cpu(pfindData->DevMajor), | ||
345 | le64_to_cpu(pfindData->DevMinor) & MINORMASK); | ||
346 | } else if (type == UNIX_BLOCKDEV) { | ||
347 | *pobject_type = DT_BLK; | ||
348 | tmp_inode->i_mode |= S_IFBLK; | ||
349 | tmp_inode->i_rdev = MKDEV(le64_to_cpu(pfindData->DevMajor), | ||
350 | le64_to_cpu(pfindData->DevMinor) & MINORMASK); | ||
351 | } else if (type == UNIX_FIFO) { | ||
352 | *pobject_type = DT_FIFO; | ||
353 | tmp_inode->i_mode |= S_IFIFO; | ||
354 | } else if (type == UNIX_SOCKET) { | ||
355 | *pobject_type = DT_SOCK; | ||
356 | tmp_inode->i_mode |= S_IFSOCK; | ||
357 | } else { | ||
358 | /* safest to just call it a file */ | ||
359 | *pobject_type = DT_REG; | ||
360 | tmp_inode->i_mode |= S_IFREG; | ||
361 | cFYI(1, ("unknown inode type %d", type)); | ||
362 | } | ||
363 | 169 | ||
364 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_UID) | 170 | memset(fattr, 0, sizeof(*fattr)); |
365 | tmp_inode->i_uid = cifs_sb->mnt_uid; | 171 | fattr->cf_atime = cnvrtDosUnixTm(info->LastAccessDate, |
366 | else | 172 | info->LastAccessTime, offset); |
367 | tmp_inode->i_uid = le64_to_cpu(pfindData->Uid); | 173 | fattr->cf_ctime = cnvrtDosUnixTm(info->LastWriteDate, |
368 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_OVERR_GID) | 174 | info->LastWriteTime, offset); |
369 | tmp_inode->i_gid = cifs_sb->mnt_gid; | 175 | fattr->cf_mtime = cnvrtDosUnixTm(info->LastWriteDate, |
370 | else | 176 | info->LastWriteTime, offset); |
371 | tmp_inode->i_gid = le64_to_cpu(pfindData->Gid); | ||
372 | tmp_inode->i_nlink = le64_to_cpu(pfindData->Nlinks); | ||
373 | |||
374 | cifsInfo->server_eof = end_of_file; | ||
375 | spin_lock(&tmp_inode->i_lock); | ||
376 | if (is_size_safe_to_change(cifsInfo, end_of_file)) { | ||
377 | /* can not safely change the file size here if the | ||
378 | client is writing to it due to potential races */ | ||
379 | i_size_write(tmp_inode, end_of_file); | ||
380 | |||
381 | /* 512 bytes (2**9) is the fake blocksize that must be used */ | ||
382 | /* for this calculation, not the real blocksize */ | ||
383 | tmp_inode->i_blocks = (512 - 1 + num_of_bytes) >> 9; | ||
384 | } | ||
385 | spin_unlock(&tmp_inode->i_lock); | ||
386 | 177 | ||
387 | if (S_ISREG(tmp_inode->i_mode)) { | 178 | fattr->cf_cifsattrs = le16_to_cpu(info->Attributes); |
388 | cFYI(1, ("File inode")); | 179 | fattr->cf_bytes = le32_to_cpu(info->AllocationSize); |
389 | tmp_inode->i_op = &cifs_file_inode_ops; | 180 | fattr->cf_eof = le32_to_cpu(info->DataSize); |
390 | 181 | ||
391 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) { | 182 | cifs_fill_common_info(fattr, cifs_sb); |
392 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | ||
393 | tmp_inode->i_fop = &cifs_file_direct_nobrl_ops; | ||
394 | else | ||
395 | tmp_inode->i_fop = &cifs_file_direct_ops; | ||
396 | } else if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) | ||
397 | tmp_inode->i_fop = &cifs_file_nobrl_ops; | ||
398 | else | ||
399 | tmp_inode->i_fop = &cifs_file_ops; | ||
400 | |||
401 | if ((cifs_sb->tcon) && (cifs_sb->tcon->ses) && | ||
402 | (cifs_sb->tcon->ses->server->maxBuf < | ||
403 | PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE)) | ||
404 | tmp_inode->i_data.a_ops = &cifs_addr_ops_smallbuf; | ||
405 | else | ||
406 | tmp_inode->i_data.a_ops = &cifs_addr_ops; | ||
407 | |||
408 | if (isNewInode) | ||
409 | return; /* No sense invalidating pages for new inode | ||
410 | since we have not started caching readahead | ||
411 | file data for it yet */ | ||
412 | |||
413 | if (timespec_equal(&tmp_inode->i_mtime, &local_mtime) && | ||
414 | (local_size == tmp_inode->i_size)) { | ||
415 | cFYI(1, ("inode exists but unchanged")); | ||
416 | } else { | ||
417 | /* file may have changed on server */ | ||
418 | cFYI(1, ("invalidate inode, readdir detected change")); | ||
419 | invalidate_remote_inode(tmp_inode); | ||
420 | } | ||
421 | } else if (S_ISDIR(tmp_inode->i_mode)) { | ||
422 | cFYI(1, ("Directory inode")); | ||
423 | tmp_inode->i_op = &cifs_dir_inode_ops; | ||
424 | tmp_inode->i_fop = &cifs_dir_ops; | ||
425 | } else if (S_ISLNK(tmp_inode->i_mode)) { | ||
426 | cFYI(1, ("Symbolic Link inode")); | ||
427 | tmp_inode->i_op = &cifs_symlink_inode_ops; | ||
428 | /* tmp_inode->i_fop = *//* do not need to set to anything */ | ||
429 | } else { | ||
430 | cFYI(1, ("Special inode")); | ||
431 | init_special_inode(tmp_inode, tmp_inode->i_mode, | ||
432 | tmp_inode->i_rdev); | ||
433 | } | ||
434 | } | 183 | } |
435 | 184 | ||
436 | /* BB eventually need to add the following helper function to | 185 | /* BB eventually need to add the following helper function to |
@@ -872,7 +621,7 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst, | |||
872 | len = strnlen(filename, PATH_MAX); | 621 | len = strnlen(filename, PATH_MAX); |
873 | } | 622 | } |
874 | 623 | ||
875 | *pinum = le64_to_cpu(pFindData->UniqueId); | 624 | *pinum = le64_to_cpu(pFindData->basic.UniqueId); |
876 | } else if (level == SMB_FIND_FILE_DIRECTORY_INFO) { | 625 | } else if (level == SMB_FIND_FILE_DIRECTORY_INFO) { |
877 | FILE_DIRECTORY_INFO *pFindData = | 626 | FILE_DIRECTORY_INFO *pFindData = |
878 | (FILE_DIRECTORY_INFO *)current_entry; | 627 | (FILE_DIRECTORY_INFO *)current_entry; |
@@ -932,11 +681,12 @@ static int cifs_filldir(char *pfindEntry, struct file *file, filldir_t filldir, | |||
932 | int rc = 0; | 681 | int rc = 0; |
933 | struct qstr qstring; | 682 | struct qstr qstring; |
934 | struct cifsFileInfo *pCifsF; | 683 | struct cifsFileInfo *pCifsF; |
935 | unsigned int obj_type; | 684 | u64 inum; |
936 | __u64 inum; | 685 | ino_t ino; |
686 | struct super_block *sb; | ||
937 | struct cifs_sb_info *cifs_sb; | 687 | struct cifs_sb_info *cifs_sb; |
938 | struct inode *tmp_inode; | ||
939 | struct dentry *tmp_dentry; | 688 | struct dentry *tmp_dentry; |
689 | struct cifs_fattr fattr; | ||
940 | 690 | ||
941 | /* get filename and len into qstring */ | 691 | /* get filename and len into qstring */ |
942 | /* get dentry */ | 692 | /* get dentry */ |
@@ -954,60 +704,53 @@ static int cifs_filldir(char *pfindEntry, struct file *file, filldir_t filldir, | |||
954 | if (rc != 0) | 704 | if (rc != 0) |
955 | return 0; | 705 | return 0; |
956 | 706 | ||
957 | cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); | 707 | sb = file->f_path.dentry->d_sb; |
708 | cifs_sb = CIFS_SB(sb); | ||
958 | 709 | ||
959 | qstring.name = scratch_buf; | 710 | qstring.name = scratch_buf; |
960 | rc = cifs_get_name_from_search_buf(&qstring, pfindEntry, | 711 | rc = cifs_get_name_from_search_buf(&qstring, pfindEntry, |
961 | pCifsF->srch_inf.info_level, | 712 | pCifsF->srch_inf.info_level, |
962 | pCifsF->srch_inf.unicode, cifs_sb, | 713 | pCifsF->srch_inf.unicode, cifs_sb, |
963 | max_len, | 714 | max_len, &inum /* returned */); |
964 | &inum /* returned */); | ||
965 | 715 | ||
966 | if (rc) | 716 | if (rc) |
967 | return rc; | 717 | return rc; |
968 | 718 | ||
969 | /* only these two infolevels return valid inode numbers */ | ||
970 | if (pCifsF->srch_inf.info_level == SMB_FIND_FILE_UNIX || | ||
971 | pCifsF->srch_inf.info_level == SMB_FIND_FILE_ID_FULL_DIR_INFO) | ||
972 | rc = construct_dentry(&qstring, file, &tmp_inode, &tmp_dentry, | ||
973 | &inum); | ||
974 | else | ||
975 | rc = construct_dentry(&qstring, file, &tmp_inode, &tmp_dentry, | ||
976 | NULL); | ||
977 | |||
978 | if ((tmp_inode == NULL) || (tmp_dentry == NULL)) | ||
979 | return -ENOMEM; | ||
980 | |||
981 | /* we pass in rc below, indicating whether it is a new inode, | ||
982 | so we can figure out whether to invalidate the inode cached | ||
983 | data if the file has changed */ | ||
984 | if (pCifsF->srch_inf.info_level == SMB_FIND_FILE_UNIX) | 719 | if (pCifsF->srch_inf.info_level == SMB_FIND_FILE_UNIX) |
985 | unix_fill_in_inode(tmp_inode, | 720 | cifs_unix_basic_to_fattr(&fattr, |
986 | (FILE_UNIX_INFO *)pfindEntry, | 721 | &((FILE_UNIX_INFO *) pfindEntry)->basic, |
987 | &obj_type, rc); | 722 | cifs_sb); |
988 | else if (pCifsF->srch_inf.info_level == SMB_FIND_FILE_INFO_STANDARD) | 723 | else if (pCifsF->srch_inf.info_level == SMB_FIND_FILE_INFO_STANDARD) |
989 | fill_in_inode(tmp_inode, 0 /* old level 1 buffer type */, | 724 | cifs_std_info_to_fattr(&fattr, (FIND_FILE_STANDARD_INFO *) |
990 | pfindEntry, &obj_type, rc); | 725 | pfindEntry, cifs_sb); |
991 | else | 726 | else |
992 | fill_in_inode(tmp_inode, 1 /* NT */, pfindEntry, &obj_type, rc); | 727 | cifs_dir_info_to_fattr(&fattr, (FILE_DIRECTORY_INFO *) |
728 | pfindEntry, cifs_sb); | ||
993 | 729 | ||
994 | if (rc) /* new inode - needs to be tied to dentry */ { | 730 | /* FIXME: make _to_fattr functions fill this out */ |
995 | d_instantiate(tmp_dentry, tmp_inode); | 731 | if (pCifsF->srch_inf.info_level == SMB_FIND_FILE_ID_FULL_DIR_INFO) |
996 | if (rc == 2) | 732 | fattr.cf_uniqueid = inum; |
997 | d_rehash(tmp_dentry); | 733 | else |
998 | } | 734 | fattr.cf_uniqueid = iunique(sb, ROOT_I); |
999 | 735 | ||
736 | ino = cifs_uniqueid_to_ino_t(fattr.cf_uniqueid); | ||
737 | tmp_dentry = cifs_readdir_lookup(file->f_dentry, &qstring, &fattr); | ||
1000 | 738 | ||
1001 | rc = filldir(direntry, qstring.name, qstring.len, file->f_pos, | 739 | rc = filldir(direntry, qstring.name, qstring.len, file->f_pos, |
1002 | tmp_inode->i_ino, obj_type); | 740 | ino, fattr.cf_dtype); |
741 | |||
742 | /* | ||
743 | * we can not return filldir errors to the caller since they are | ||
744 | * "normal" when the stat blocksize is too small - we return remapped | ||
745 | * error instead | ||
746 | * | ||
747 | * FIXME: This looks bogus. filldir returns -EOVERFLOW in the above | ||
748 | * case already. Why should we be clobbering other errors from it? | ||
749 | */ | ||
1003 | if (rc) { | 750 | if (rc) { |
1004 | cFYI(1, ("filldir rc = %d", rc)); | 751 | cFYI(1, ("filldir rc = %d", rc)); |
1005 | /* we can not return filldir errors to the caller | ||
1006 | since they are "normal" when the stat blocksize | ||
1007 | is too small - we return remapped error instead */ | ||
1008 | rc = -EOVERFLOW; | 752 | rc = -EOVERFLOW; |
1009 | } | 753 | } |
1010 | |||
1011 | dput(tmp_dentry); | 754 | dput(tmp_dentry); |
1012 | return rc; | 755 | return rc; |
1013 | } | 756 | } |
diff --git a/fs/compat.c b/fs/compat.c index cdd51a3a7c53..94502dab972a 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <linux/smb_mount.h> | 32 | #include <linux/smb_mount.h> |
33 | #include <linux/ncp_mount.h> | 33 | #include <linux/ncp_mount.h> |
34 | #include <linux/nfs4_mount.h> | 34 | #include <linux/nfs4_mount.h> |
35 | #include <linux/smp_lock.h> | ||
36 | #include <linux/syscalls.h> | 35 | #include <linux/syscalls.h> |
37 | #include <linux/ctype.h> | 36 | #include <linux/ctype.h> |
38 | #include <linux/module.h> | 37 | #include <linux/module.h> |
@@ -1486,8 +1485,8 @@ int compat_do_execve(char * filename, | |||
1486 | if (!bprm) | 1485 | if (!bprm) |
1487 | goto out_files; | 1486 | goto out_files; |
1488 | 1487 | ||
1489 | retval = mutex_lock_interruptible(¤t->cred_guard_mutex); | 1488 | retval = -ERESTARTNOINTR; |
1490 | if (retval < 0) | 1489 | if (mutex_lock_interruptible(¤t->cred_guard_mutex)) |
1491 | goto out_free; | 1490 | goto out_free; |
1492 | current->in_execve = 1; | 1491 | current->in_execve = 1; |
1493 | 1492 | ||
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c index 626c7483b4de..f28f070a60fc 100644 --- a/fs/compat_ioctl.c +++ b/fs/compat_ioctl.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/compiler.h> | 19 | #include <linux/compiler.h> |
20 | #include <linux/sched.h> | 20 | #include <linux/sched.h> |
21 | #include <linux/smp.h> | 21 | #include <linux/smp.h> |
22 | #include <linux/smp_lock.h> | ||
22 | #include <linux/ioctl.h> | 23 | #include <linux/ioctl.h> |
23 | #include <linux/if.h> | 24 | #include <linux/if.h> |
24 | #include <linux/if_bridge.h> | 25 | #include <linux/if_bridge.h> |
@@ -1277,8 +1277,8 @@ int do_execve(char * filename, | |||
1277 | if (!bprm) | 1277 | if (!bprm) |
1278 | goto out_files; | 1278 | goto out_files; |
1279 | 1279 | ||
1280 | retval = mutex_lock_interruptible(¤t->cred_guard_mutex); | 1280 | retval = -ERESTARTNOINTR; |
1281 | if (retval < 0) | 1281 | if (mutex_lock_interruptible(¤t->cred_guard_mutex)) |
1282 | goto out_free; | 1282 | goto out_free; |
1283 | current->in_execve = 1; | 1283 | current->in_execve = 1; |
1284 | 1284 | ||
diff --git a/fs/exofs/common.h b/fs/exofs/common.h index 24667eedc023..c6718e4817fe 100644 --- a/fs/exofs/common.h +++ b/fs/exofs/common.h | |||
@@ -2,9 +2,7 @@ | |||
2 | * common.h - Common definitions for both Kernel and user-mode utilities | 2 | * common.h - Common definitions for both Kernel and user-mode utilities |
3 | * | 3 | * |
4 | * Copyright (C) 2005, 2006 | 4 | * Copyright (C) 2005, 2006 |
5 | * Avishay Traeger (avishay@gmail.com) (avishay@il.ibm.com) | 5 | * Avishay Traeger (avishay@gmail.com) |
6 | * Copyright (C) 2005, 2006 | ||
7 | * International Business Machines | ||
8 | * Copyright (C) 2008, 2009 | 6 | * Copyright (C) 2008, 2009 |
9 | * Boaz Harrosh <bharrosh@panasas.com> | 7 | * Boaz Harrosh <bharrosh@panasas.com> |
10 | * | 8 | * |
diff --git a/fs/exofs/dir.c b/fs/exofs/dir.c index 65b0c8c776a1..4cfab1cc75c0 100644 --- a/fs/exofs/dir.c +++ b/fs/exofs/dir.c | |||
@@ -1,8 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2005, 2006 | 2 | * Copyright (C) 2005, 2006 |
3 | * Avishay Traeger (avishay@gmail.com) (avishay@il.ibm.com) | 3 | * Avishay Traeger (avishay@gmail.com) |
4 | * Copyright (C) 2005, 2006 | ||
5 | * International Business Machines | ||
6 | * Copyright (C) 2008, 2009 | 4 | * Copyright (C) 2008, 2009 |
7 | * Boaz Harrosh <bharrosh@panasas.com> | 5 | * Boaz Harrosh <bharrosh@panasas.com> |
8 | * | 6 | * |
diff --git a/fs/exofs/exofs.h b/fs/exofs/exofs.h index 0fd4c7859679..5ec72e020b22 100644 --- a/fs/exofs/exofs.h +++ b/fs/exofs/exofs.h | |||
@@ -1,8 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2005, 2006 | 2 | * Copyright (C) 2005, 2006 |
3 | * Avishay Traeger (avishay@gmail.com) (avishay@il.ibm.com) | 3 | * Avishay Traeger (avishay@gmail.com) |
4 | * Copyright (C) 2005, 2006 | ||
5 | * International Business Machines | ||
6 | * Copyright (C) 2008, 2009 | 4 | * Copyright (C) 2008, 2009 |
7 | * Boaz Harrosh <bharrosh@panasas.com> | 5 | * Boaz Harrosh <bharrosh@panasas.com> |
8 | * | 6 | * |
@@ -156,6 +154,9 @@ ino_t exofs_parent_ino(struct dentry *child); | |||
156 | int exofs_set_link(struct inode *, struct exofs_dir_entry *, struct page *, | 154 | int exofs_set_link(struct inode *, struct exofs_dir_entry *, struct page *, |
157 | struct inode *); | 155 | struct inode *); |
158 | 156 | ||
157 | /* super.c */ | ||
158 | int exofs_sync_fs(struct super_block *sb, int wait); | ||
159 | |||
159 | /********************* | 160 | /********************* |
160 | * operation vectors * | 161 | * operation vectors * |
161 | *********************/ | 162 | *********************/ |
diff --git a/fs/exofs/file.c b/fs/exofs/file.c index 6ed7fe484752..839b9dc1e70f 100644 --- a/fs/exofs/file.c +++ b/fs/exofs/file.c | |||
@@ -1,8 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2005, 2006 | 2 | * Copyright (C) 2005, 2006 |
3 | * Avishay Traeger (avishay@gmail.com) (avishay@il.ibm.com) | 3 | * Avishay Traeger (avishay@gmail.com) |
4 | * Copyright (C) 2005, 2006 | ||
5 | * International Business Machines | ||
6 | * Copyright (C) 2008, 2009 | 4 | * Copyright (C) 2008, 2009 |
7 | * Boaz Harrosh <bharrosh@panasas.com> | 5 | * Boaz Harrosh <bharrosh@panasas.com> |
8 | * | 6 | * |
@@ -47,16 +45,23 @@ static int exofs_file_fsync(struct file *filp, struct dentry *dentry, | |||
47 | { | 45 | { |
48 | int ret; | 46 | int ret; |
49 | struct address_space *mapping = filp->f_mapping; | 47 | struct address_space *mapping = filp->f_mapping; |
48 | struct inode *inode = dentry->d_inode; | ||
49 | struct super_block *sb; | ||
50 | 50 | ||
51 | ret = filemap_write_and_wait(mapping); | 51 | ret = filemap_write_and_wait(mapping); |
52 | if (ret) | 52 | if (ret) |
53 | return ret; | 53 | return ret; |
54 | 54 | ||
55 | /*Note: file_fsync below also calles sync_blockdev, which is a no-op | 55 | /* sync the inode attributes */ |
56 | * for exofs, but other then that it does sync_inode and | 56 | ret = write_inode_now(inode, 1); |
57 | * sync_superblock which is what we need here. | 57 | |
58 | */ | 58 | /* This is a good place to write the sb */ |
59 | return file_fsync(filp, dentry, datasync); | 59 | /* TODO: Sechedule an sb-sync on create */ |
60 | sb = inode->i_sb; | ||
61 | if (sb->s_dirt) | ||
62 | exofs_sync_fs(sb, 1); | ||
63 | |||
64 | return ret; | ||
60 | } | 65 | } |
61 | 66 | ||
62 | static int exofs_flush(struct file *file, fl_owner_t id) | 67 | static int exofs_flush(struct file *file, fl_owner_t id) |
diff --git a/fs/exofs/inode.c b/fs/exofs/inode.c index 77d0a295eb1c..6c10f7476699 100644 --- a/fs/exofs/inode.c +++ b/fs/exofs/inode.c | |||
@@ -1,8 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2005, 2006 | 2 | * Copyright (C) 2005, 2006 |
3 | * Avishay Traeger (avishay@gmail.com) (avishay@il.ibm.com) | 3 | * Avishay Traeger (avishay@gmail.com) |
4 | * Copyright (C) 2005, 2006 | ||
5 | * International Business Machines | ||
6 | * Copyright (C) 2008, 2009 | 4 | * Copyright (C) 2008, 2009 |
7 | * Boaz Harrosh <bharrosh@panasas.com> | 5 | * Boaz Harrosh <bharrosh@panasas.com> |
8 | * | 6 | * |
@@ -295,6 +293,9 @@ static int read_exec(struct page_collect *pcol, bool is_sync) | |||
295 | err: | 293 | err: |
296 | if (!is_sync) | 294 | if (!is_sync) |
297 | _unlock_pcol_pages(pcol, ret, READ); | 295 | _unlock_pcol_pages(pcol, ret, READ); |
296 | else /* Pages unlocked by caller in sync mode only free bio */ | ||
297 | pcol_free(pcol); | ||
298 | |||
298 | kfree(pcol_copy); | 299 | kfree(pcol_copy); |
299 | if (or) | 300 | if (or) |
300 | osd_end_request(or); | 301 | osd_end_request(or); |
diff --git a/fs/exofs/namei.c b/fs/exofs/namei.c index 77fdd765e76d..b7dd0c236863 100644 --- a/fs/exofs/namei.c +++ b/fs/exofs/namei.c | |||
@@ -1,8 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2005, 2006 | 2 | * Copyright (C) 2005, 2006 |
3 | * Avishay Traeger (avishay@gmail.com) (avishay@il.ibm.com) | 3 | * Avishay Traeger (avishay@gmail.com) |
4 | * Copyright (C) 2005, 2006 | ||
5 | * International Business Machines | ||
6 | * Copyright (C) 2008, 2009 | 4 | * Copyright (C) 2008, 2009 |
7 | * Boaz Harrosh <bharrosh@panasas.com> | 5 | * Boaz Harrosh <bharrosh@panasas.com> |
8 | * | 6 | * |
diff --git a/fs/exofs/osd.c b/fs/exofs/osd.c index b3d2ccb87aaa..4372542df284 100644 --- a/fs/exofs/osd.c +++ b/fs/exofs/osd.c | |||
@@ -1,8 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2005, 2006 | 2 | * Copyright (C) 2005, 2006 |
3 | * Avishay Traeger (avishay@gmail.com) (avishay@il.ibm.com) | 3 | * Avishay Traeger (avishay@gmail.com) |
4 | * Copyright (C) 2005, 2006 | ||
5 | * International Business Machines | ||
6 | * Copyright (C) 2008, 2009 | 4 | * Copyright (C) 2008, 2009 |
7 | * Boaz Harrosh <bharrosh@panasas.com> | 5 | * Boaz Harrosh <bharrosh@panasas.com> |
8 | * | 6 | * |
diff --git a/fs/exofs/super.c b/fs/exofs/super.c index 8216c5b77b53..5ab10c3bbebe 100644 --- a/fs/exofs/super.c +++ b/fs/exofs/super.c | |||
@@ -1,8 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2005, 2006 | 2 | * Copyright (C) 2005, 2006 |
3 | * Avishay Traeger (avishay@gmail.com) (avishay@il.ibm.com) | 3 | * Avishay Traeger (avishay@gmail.com) |
4 | * Copyright (C) 2005, 2006 | ||
5 | * International Business Machines | ||
6 | * Copyright (C) 2008, 2009 | 4 | * Copyright (C) 2008, 2009 |
7 | * Boaz Harrosh <bharrosh@panasas.com> | 5 | * Boaz Harrosh <bharrosh@panasas.com> |
8 | * | 6 | * |
@@ -33,6 +31,7 @@ | |||
33 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 31 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
34 | */ | 32 | */ |
35 | 33 | ||
34 | #include <linux/smp_lock.h> | ||
36 | #include <linux/string.h> | 35 | #include <linux/string.h> |
37 | #include <linux/parser.h> | 36 | #include <linux/parser.h> |
38 | #include <linux/vfs.h> | 37 | #include <linux/vfs.h> |
@@ -200,7 +199,7 @@ static const struct export_operations exofs_export_ops; | |||
200 | /* | 199 | /* |
201 | * Write the superblock to the OSD | 200 | * Write the superblock to the OSD |
202 | */ | 201 | */ |
203 | static int exofs_sync_fs(struct super_block *sb, int wait) | 202 | int exofs_sync_fs(struct super_block *sb, int wait) |
204 | { | 203 | { |
205 | struct exofs_sb_info *sbi; | 204 | struct exofs_sb_info *sbi; |
206 | struct exofs_fscb *fscb; | 205 | struct exofs_fscb *fscb; |
diff --git a/fs/exofs/symlink.c b/fs/exofs/symlink.c index 36e2d7bc7f7b..4dd687c3e747 100644 --- a/fs/exofs/symlink.c +++ b/fs/exofs/symlink.c | |||
@@ -1,8 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2005, 2006 | 2 | * Copyright (C) 2005, 2006 |
3 | * Avishay Traeger (avishay@gmail.com) (avishay@il.ibm.com) | 3 | * Avishay Traeger (avishay@gmail.com) |
4 | * Copyright (C) 2005, 2006 | ||
5 | * International Business Machines | ||
6 | * Copyright (C) 2008, 2009 | 4 | * Copyright (C) 2008, 2009 |
7 | * Boaz Harrosh <bharrosh@panasas.com> | 5 | * Boaz Harrosh <bharrosh@panasas.com> |
8 | * | 6 | * |
diff --git a/fs/ext2/ioctl.c b/fs/ext2/ioctl.c index 7cb4badef927..e7431309bdca 100644 --- a/fs/ext2/ioctl.c +++ b/fs/ext2/ioctl.c | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <linux/sched.h> | 13 | #include <linux/sched.h> |
14 | #include <linux/compat.h> | 14 | #include <linux/compat.h> |
15 | #include <linux/mount.h> | 15 | #include <linux/mount.h> |
16 | #include <linux/smp_lock.h> | ||
17 | #include <asm/current.h> | 16 | #include <asm/current.h> |
18 | #include <asm/uaccess.h> | 17 | #include <asm/uaccess.h> |
19 | 18 | ||
diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index 01f149aea841..7050a9cd04a4 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/capability.h> | 12 | #include <linux/capability.h> |
13 | #include <linux/time.h> | 13 | #include <linux/time.h> |
14 | #include <linux/compat.h> | 14 | #include <linux/compat.h> |
15 | #include <linux/smp_lock.h> | ||
16 | #include <linux/mount.h> | 15 | #include <linux/mount.h> |
17 | #include <linux/file.h> | 16 | #include <linux/file.h> |
18 | #include <asm/uaccess.h> | 17 | #include <asm/uaccess.h> |
diff --git a/fs/fat/dir.c b/fs/fat/dir.c index 38ff75a0fe22..530b4ca01510 100644 --- a/fs/fat/dir.c +++ b/fs/fat/dir.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/time.h> | 18 | #include <linux/time.h> |
19 | #include <linux/smp_lock.h> | ||
20 | #include <linux/buffer_head.h> | 19 | #include <linux/buffer_head.h> |
21 | #include <linux/compat.h> | 20 | #include <linux/compat.h> |
22 | #include <asm/uaccess.h> | 21 | #include <asm/uaccess.h> |
diff --git a/fs/fat/file.c b/fs/fat/file.c index b28ea646ff60..f042b965c95c 100644 --- a/fs/fat/file.c +++ b/fs/fat/file.c | |||
@@ -134,7 +134,7 @@ static int fat_file_release(struct inode *inode, struct file *filp) | |||
134 | if ((filp->f_mode & FMODE_WRITE) && | 134 | if ((filp->f_mode & FMODE_WRITE) && |
135 | MSDOS_SB(inode->i_sb)->options.flush) { | 135 | MSDOS_SB(inode->i_sb)->options.flush) { |
136 | fat_flush_inodes(inode->i_sb, inode, NULL); | 136 | fat_flush_inodes(inode->i_sb, inode, NULL); |
137 | congestion_wait(WRITE, HZ/10); | 137 | congestion_wait(BLK_RW_ASYNC, HZ/10); |
138 | } | 138 | } |
139 | return 0; | 139 | return 0; |
140 | } | 140 | } |
diff --git a/fs/fat/namei_msdos.c b/fs/fat/namei_msdos.c index 82f88733b681..bbc94ae4fd77 100644 --- a/fs/fat/namei_msdos.c +++ b/fs/fat/namei_msdos.c | |||
@@ -9,7 +9,6 @@ | |||
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <linux/time.h> | 10 | #include <linux/time.h> |
11 | #include <linux/buffer_head.h> | 11 | #include <linux/buffer_head.h> |
12 | #include <linux/smp_lock.h> | ||
13 | #include "fat.h" | 12 | #include "fat.h" |
14 | 13 | ||
15 | /* Characters that are undesirable in an MS-DOS file name */ | 14 | /* Characters that are undesirable in an MS-DOS file name */ |
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c index 73471b7ecc8c..cb6e83557112 100644 --- a/fs/fat/namei_vfat.c +++ b/fs/fat/namei_vfat.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/jiffies.h> | 19 | #include <linux/jiffies.h> |
20 | #include <linux/ctype.h> | 20 | #include <linux/ctype.h> |
21 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
22 | #include <linux/smp_lock.h> | ||
23 | #include <linux/buffer_head.h> | 22 | #include <linux/buffer_head.h> |
24 | #include <linux/namei.h> | 23 | #include <linux/namei.h> |
25 | #include "fat.h" | 24 | #include "fat.h" |
diff --git a/fs/fcntl.c b/fs/fcntl.c index a040b764f8e3..ae413086db97 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c | |||
@@ -19,7 +19,6 @@ | |||
19 | #include <linux/signal.h> | 19 | #include <linux/signal.h> |
20 | #include <linux/rcupdate.h> | 20 | #include <linux/rcupdate.h> |
21 | #include <linux/pid_namespace.h> | 21 | #include <linux/pid_namespace.h> |
22 | #include <linux/smp_lock.h> | ||
23 | 22 | ||
24 | #include <asm/poll.h> | 23 | #include <asm/poll.h> |
25 | #include <asm/siginfo.h> | 24 | #include <asm/siginfo.h> |
diff --git a/fs/freevxfs/vxfs_super.c b/fs/freevxfs/vxfs_super.c index cdbd1654e4cd..1e8af939b3e4 100644 --- a/fs/freevxfs/vxfs_super.c +++ b/fs/freevxfs/vxfs_super.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/buffer_head.h> | 38 | #include <linux/buffer_head.h> |
39 | #include <linux/kernel.h> | 39 | #include <linux/kernel.h> |
40 | #include <linux/slab.h> | 40 | #include <linux/slab.h> |
41 | #include <linux/smp_lock.h> | ||
41 | #include <linux/stat.h> | 42 | #include <linux/stat.h> |
42 | #include <linux/vfs.h> | 43 | #include <linux/vfs.h> |
43 | #include <linux/mount.h> | 44 | #include <linux/mount.h> |
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index f58ecbc416c8..6484eb75acd6 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c | |||
@@ -286,8 +286,8 @@ __releases(&fc->lock) | |||
286 | } | 286 | } |
287 | if (fc->num_background == FUSE_CONGESTION_THRESHOLD && | 287 | if (fc->num_background == FUSE_CONGESTION_THRESHOLD && |
288 | fc->connected && fc->bdi_initialized) { | 288 | fc->connected && fc->bdi_initialized) { |
289 | clear_bdi_congested(&fc->bdi, READ); | 289 | clear_bdi_congested(&fc->bdi, BLK_RW_SYNC); |
290 | clear_bdi_congested(&fc->bdi, WRITE); | 290 | clear_bdi_congested(&fc->bdi, BLK_RW_ASYNC); |
291 | } | 291 | } |
292 | fc->num_background--; | 292 | fc->num_background--; |
293 | fc->active_background--; | 293 | fc->active_background--; |
@@ -414,8 +414,8 @@ static void fuse_request_send_nowait_locked(struct fuse_conn *fc, | |||
414 | fc->blocked = 1; | 414 | fc->blocked = 1; |
415 | if (fc->num_background == FUSE_CONGESTION_THRESHOLD && | 415 | if (fc->num_background == FUSE_CONGESTION_THRESHOLD && |
416 | fc->bdi_initialized) { | 416 | fc->bdi_initialized) { |
417 | set_bdi_congested(&fc->bdi, READ); | 417 | set_bdi_congested(&fc->bdi, BLK_RW_SYNC); |
418 | set_bdi_congested(&fc->bdi, WRITE); | 418 | set_bdi_congested(&fc->bdi, BLK_RW_ASYNC); |
419 | } | 419 | } |
420 | list_add_tail(&req->list, &fc->bg_queue); | 420 | list_add_tail(&req->list, &fc->bg_queue); |
421 | flush_bg_queue(fc); | 421 | flush_bg_queue(fc); |
diff --git a/fs/hfs/super.c b/fs/hfs/super.c index 6f833dc8e910..f7fcbe49da72 100644 --- a/fs/hfs/super.c +++ b/fs/hfs/super.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/nls.h> | 19 | #include <linux/nls.h> |
20 | #include <linux/parser.h> | 20 | #include <linux/parser.h> |
21 | #include <linux/seq_file.h> | 21 | #include <linux/seq_file.h> |
22 | #include <linux/smp_lock.h> | ||
22 | #include <linux/vfs.h> | 23 | #include <linux/vfs.h> |
23 | 24 | ||
24 | #include "hfs_fs.h" | 25 | #include "hfs_fs.h" |
diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c index 9fc3af0c0dab..c0759fe0855b 100644 --- a/fs/hfsplus/super.c +++ b/fs/hfsplus/super.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/pagemap.h> | 12 | #include <linux/pagemap.h> |
13 | #include <linux/fs.h> | 13 | #include <linux/fs.h> |
14 | #include <linux/slab.h> | 14 | #include <linux/slab.h> |
15 | #include <linux/smp_lock.h> | ||
15 | #include <linux/vfs.h> | 16 | #include <linux/vfs.h> |
16 | #include <linux/nls.h> | 17 | #include <linux/nls.h> |
17 | 18 | ||
diff --git a/fs/hpfs/dir.c b/fs/hpfs/dir.c index 6916c41d7017..8865c94f55f6 100644 --- a/fs/hpfs/dir.c +++ b/fs/hpfs/dir.c | |||
@@ -6,6 +6,7 @@ | |||
6 | * directory VFS functions | 6 | * directory VFS functions |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/smp_lock.h> | ||
9 | #include "hpfs_fn.h" | 10 | #include "hpfs_fn.h" |
10 | 11 | ||
11 | static int hpfs_dir_release(struct inode *inode, struct file *filp) | 12 | static int hpfs_dir_release(struct inode *inode, struct file *filp) |
diff --git a/fs/hpfs/file.c b/fs/hpfs/file.c index 64ab52259204..3efabff00367 100644 --- a/fs/hpfs/file.c +++ b/fs/hpfs/file.c | |||
@@ -6,6 +6,7 @@ | |||
6 | * file VFS functions | 6 | * file VFS functions |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/smp_lock.h> | ||
9 | #include "hpfs_fn.h" | 10 | #include "hpfs_fn.h" |
10 | 11 | ||
11 | #define BLOCKS(size) (((size) + 511) >> 9) | 12 | #define BLOCKS(size) (((size) + 511) >> 9) |
diff --git a/fs/hpfs/hpfs_fn.h b/fs/hpfs/hpfs_fn.h index c2ea31bae313..701ca54c0867 100644 --- a/fs/hpfs/hpfs_fn.h +++ b/fs/hpfs/hpfs_fn.h | |||
@@ -13,7 +13,6 @@ | |||
13 | #include <linux/pagemap.h> | 13 | #include <linux/pagemap.h> |
14 | #include <linux/buffer_head.h> | 14 | #include <linux/buffer_head.h> |
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <linux/smp_lock.h> | ||
17 | 16 | ||
18 | #include "hpfs.h" | 17 | #include "hpfs.h" |
19 | 18 | ||
diff --git a/fs/hpfs/inode.c b/fs/hpfs/inode.c index 39a1bfbea312..fe703ae46bc7 100644 --- a/fs/hpfs/inode.c +++ b/fs/hpfs/inode.c | |||
@@ -6,6 +6,7 @@ | |||
6 | * inode VFS functions | 6 | * inode VFS functions |
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/smp_lock.h> | ||
9 | #include "hpfs_fn.h" | 10 | #include "hpfs_fn.h" |
10 | 11 | ||
11 | void hpfs_init_inode(struct inode *i) | 12 | void hpfs_init_inode(struct inode *i) |
diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c index b649232dde97..82b9c4ba9ed0 100644 --- a/fs/hpfs/namei.c +++ b/fs/hpfs/namei.c | |||
@@ -6,6 +6,7 @@ | |||
6 | * adding & removing files & directories | 6 | * adding & removing files & directories |
7 | */ | 7 | */ |
8 | #include <linux/sched.h> | 8 | #include <linux/sched.h> |
9 | #include <linux/smp_lock.h> | ||
9 | #include "hpfs_fn.h" | 10 | #include "hpfs_fn.h" |
10 | 11 | ||
11 | static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | 12 | static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) |
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c index 58a7963e168a..85f96bc651c7 100644 --- a/fs/isofs/inode.c +++ b/fs/isofs/inode.c | |||
@@ -142,6 +142,7 @@ static const struct dentry_operations isofs_dentry_ops[] = { | |||
142 | 142 | ||
143 | struct iso9660_options{ | 143 | struct iso9660_options{ |
144 | unsigned int rock:1; | 144 | unsigned int rock:1; |
145 | unsigned int joliet:1; | ||
145 | unsigned int cruft:1; | 146 | unsigned int cruft:1; |
146 | unsigned int hide:1; | 147 | unsigned int hide:1; |
147 | unsigned int showassoc:1; | 148 | unsigned int showassoc:1; |
@@ -151,7 +152,6 @@ struct iso9660_options{ | |||
151 | unsigned int gid_set:1; | 152 | unsigned int gid_set:1; |
152 | unsigned int utf8:1; | 153 | unsigned int utf8:1; |
153 | unsigned char map; | 154 | unsigned char map; |
154 | char joliet; | ||
155 | unsigned char check; | 155 | unsigned char check; |
156 | unsigned int blocksize; | 156 | unsigned int blocksize; |
157 | mode_t fmode; | 157 | mode_t fmode; |
@@ -632,7 +632,7 @@ static int isofs_fill_super(struct super_block *s, void *data, int silent) | |||
632 | else if (isonum_711(vdp->type) == ISO_VD_SUPPLEMENTARY) { | 632 | else if (isonum_711(vdp->type) == ISO_VD_SUPPLEMENTARY) { |
633 | sec = (struct iso_supplementary_descriptor *)vdp; | 633 | sec = (struct iso_supplementary_descriptor *)vdp; |
634 | if (sec->escape[0] == 0x25 && sec->escape[1] == 0x2f) { | 634 | if (sec->escape[0] == 0x25 && sec->escape[1] == 0x2f) { |
635 | if (opt.joliet == 'y') { | 635 | if (opt.joliet) { |
636 | if (sec->escape[2] == 0x40) | 636 | if (sec->escape[2] == 0x40) |
637 | joliet_level = 1; | 637 | joliet_level = 1; |
638 | else if (sec->escape[2] == 0x43) | 638 | else if (sec->escape[2] == 0x43) |
diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c index a0244740b75a..b47679be118a 100644 --- a/fs/jffs2/erase.c +++ b/fs/jffs2/erase.c | |||
@@ -270,19 +270,21 @@ static inline void jffs2_remove_node_refs_from_ino_list(struct jffs2_sb_info *c, | |||
270 | D2({ | 270 | D2({ |
271 | int i=0; | 271 | int i=0; |
272 | struct jffs2_raw_node_ref *this; | 272 | struct jffs2_raw_node_ref *this; |
273 | printk(KERN_DEBUG "After remove_node_refs_from_ino_list: \n" KERN_DEBUG); | 273 | printk(KERN_DEBUG "After remove_node_refs_from_ino_list: \n"); |
274 | 274 | ||
275 | this = ic->nodes; | 275 | this = ic->nodes; |
276 | 276 | ||
277 | printk(KERN_DEBUG); | ||
277 | while(this) { | 278 | while(this) { |
278 | printk( "0x%08x(%d)->", ref_offset(this), ref_flags(this)); | 279 | printk(KERN_CONT "0x%08x(%d)->", |
280 | ref_offset(this), ref_flags(this)); | ||
279 | if (++i == 5) { | 281 | if (++i == 5) { |
280 | printk("\n" KERN_DEBUG); | 282 | printk(KERN_DEBUG); |
281 | i=0; | 283 | i=0; |
282 | } | 284 | } |
283 | this = this->next_in_ino; | 285 | this = this->next_in_ino; |
284 | } | 286 | } |
285 | printk("\n"); | 287 | printk(KERN_CONT "\n"); |
286 | }); | 288 | }); |
287 | 289 | ||
288 | switch (ic->class) { | 290 | switch (ic->class) { |
diff --git a/fs/jffs2/super.c b/fs/jffs2/super.c index 07a22caf2687..0035c021395a 100644 --- a/fs/jffs2/super.c +++ b/fs/jffs2/super.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/kernel.h> | 12 | #include <linux/kernel.h> |
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/slab.h> | 14 | #include <linux/slab.h> |
15 | #include <linux/smp_lock.h> | ||
15 | #include <linux/init.h> | 16 | #include <linux/init.h> |
16 | #include <linux/list.h> | 17 | #include <linux/list.h> |
17 | #include <linux/fs.h> | 18 | #include <linux/fs.h> |
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c index f2fdcbce143e..4336adba952a 100644 --- a/fs/lockd/clntproc.c +++ b/fs/lockd/clntproc.c | |||
@@ -7,6 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | 8 | ||
9 | #include <linux/module.h> | 9 | #include <linux/module.h> |
10 | #include <linux/smp_lock.h> | ||
10 | #include <linux/types.h> | 11 | #include <linux/types.h> |
11 | #include <linux/errno.h> | 12 | #include <linux/errno.h> |
12 | #include <linux/fs.h> | 13 | #include <linux/fs.h> |
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c index 1725037374c5..bd173a6ca3b1 100644 --- a/fs/lockd/svc4proc.c +++ b/fs/lockd/svc4proc.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/types.h> | 10 | #include <linux/types.h> |
11 | #include <linux/time.h> | 11 | #include <linux/time.h> |
12 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
13 | #include <linux/smp_lock.h> | ||
13 | #include <linux/in.h> | 14 | #include <linux/in.h> |
14 | #include <linux/sunrpc/svc.h> | 15 | #include <linux/sunrpc/svc.h> |
15 | #include <linux/sunrpc/clnt.h> | 16 | #include <linux/sunrpc/clnt.h> |
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c index 3688e55901fc..e1d28ddd2169 100644 --- a/fs/lockd/svcproc.c +++ b/fs/lockd/svcproc.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/types.h> | 10 | #include <linux/types.h> |
11 | #include <linux/time.h> | 11 | #include <linux/time.h> |
12 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
13 | #include <linux/smp_lock.h> | ||
13 | #include <linux/in.h> | 14 | #include <linux/in.h> |
14 | #include <linux/sunrpc/svc.h> | 15 | #include <linux/sunrpc/svc.h> |
15 | #include <linux/sunrpc/clnt.h> | 16 | #include <linux/sunrpc/clnt.h> |
diff --git a/fs/namespace.c b/fs/namespace.c index 3dc283fd4716..277c28a63ead 100644 --- a/fs/namespace.c +++ b/fs/namespace.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/seq_file.h> | 22 | #include <linux/seq_file.h> |
23 | #include <linux/mnt_namespace.h> | 23 | #include <linux/mnt_namespace.h> |
24 | #include <linux/namei.h> | 24 | #include <linux/namei.h> |
25 | #include <linux/nsproxy.h> | ||
25 | #include <linux/security.h> | 26 | #include <linux/security.h> |
26 | #include <linux/mount.h> | 27 | #include <linux/mount.h> |
27 | #include <linux/ramfs.h> | 28 | #include <linux/ramfs.h> |
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index af05b918cb5b..6dd48a4405b4 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <linux/kthread.h> | 10 | #include <linux/kthread.h> |
11 | #include <linux/module.h> | 11 | #include <linux/module.h> |
12 | #include <linux/sched.h> | 12 | #include <linux/sched.h> |
13 | #include <linux/smp_lock.h> | ||
13 | #include <linux/spinlock.h> | 14 | #include <linux/spinlock.h> |
14 | 15 | ||
15 | #include <linux/nfs4.h> | 16 | #include <linux/nfs4.h> |
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 89f98e9a024b..38d42c29fb92 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <linux/nfs_fs.h> | 29 | #include <linux/nfs_fs.h> |
30 | #include <linux/nfs_mount.h> | 30 | #include <linux/nfs_mount.h> |
31 | #include <linux/pagemap.h> | 31 | #include <linux/pagemap.h> |
32 | #include <linux/smp_lock.h> | ||
33 | #include <linux/pagevec.h> | 32 | #include <linux/pagevec.h> |
34 | #include <linux/namei.h> | 33 | #include <linux/namei.h> |
35 | #include <linux/mount.h> | 34 | #include <linux/mount.h> |
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 0055b813ec2c..05062329b678 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/mm.h> | 26 | #include <linux/mm.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/pagemap.h> | 28 | #include <linux/pagemap.h> |
29 | #include <linux/smp_lock.h> | ||
30 | #include <linux/aio.h> | 29 | #include <linux/aio.h> |
31 | 30 | ||
32 | #include <asm/uaccess.h> | 31 | #include <asm/uaccess.h> |
diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c index 46177cb87064..b35d2a616066 100644 --- a/fs/nfs/getroot.c +++ b/fs/nfs/getroot.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <linux/nfs_idmap.h> | 30 | #include <linux/nfs_idmap.h> |
31 | #include <linux/vfs.h> | 31 | #include <linux/vfs.h> |
32 | #include <linux/namei.h> | 32 | #include <linux/namei.h> |
33 | #include <linux/mnt_namespace.h> | ||
34 | #include <linux/security.h> | 33 | #include <linux/security.h> |
35 | 34 | ||
36 | #include <asm/system.h> | 35 | #include <asm/system.h> |
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index 64f87194d390..bd7938eda6a8 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <linux/nfs_mount.h> | 30 | #include <linux/nfs_mount.h> |
31 | #include <linux/nfs4_mount.h> | 31 | #include <linux/nfs4_mount.h> |
32 | #include <linux/lockd/bind.h> | 32 | #include <linux/lockd/bind.h> |
33 | #include <linux/smp_lock.h> | ||
34 | #include <linux/seq_file.h> | 33 | #include <linux/seq_file.h> |
35 | #include <linux/mount.h> | 34 | #include <linux/mount.h> |
36 | #include <linux/nfs_idmap.h> | 35 | #include <linux/nfs_idmap.h> |
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 92ce43517814..ff0c080db59b 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -45,7 +45,6 @@ | |||
45 | #include <linux/nfs4.h> | 45 | #include <linux/nfs4.h> |
46 | #include <linux/nfs_fs.h> | 46 | #include <linux/nfs_fs.h> |
47 | #include <linux/nfs_page.h> | 47 | #include <linux/nfs_page.h> |
48 | #include <linux/smp_lock.h> | ||
49 | #include <linux/namei.h> | 48 | #include <linux/namei.h> |
50 | #include <linux/mount.h> | 49 | #include <linux/mount.h> |
51 | #include <linux/module.h> | 50 | #include <linux/module.h> |
diff --git a/fs/nfs/read.c b/fs/nfs/read.c index 96c4ebfa46f4..73ea5e8d66ce 100644 --- a/fs/nfs/read.c +++ b/fs/nfs/read.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/sunrpc/clnt.h> | 18 | #include <linux/sunrpc/clnt.h> |
19 | #include <linux/nfs_fs.h> | 19 | #include <linux/nfs_fs.h> |
20 | #include <linux/nfs_page.h> | 20 | #include <linux/nfs_page.h> |
21 | #include <linux/smp_lock.h> | ||
22 | 21 | ||
23 | #include <asm/system.h> | 22 | #include <asm/system.h> |
24 | 23 | ||
diff --git a/fs/nfs/write.c b/fs/nfs/write.c index ce728829f79a..0a0a2ff767c3 100644 --- a/fs/nfs/write.c +++ b/fs/nfs/write.c | |||
@@ -202,8 +202,10 @@ static int nfs_set_page_writeback(struct page *page) | |||
202 | struct nfs_server *nfss = NFS_SERVER(inode); | 202 | struct nfs_server *nfss = NFS_SERVER(inode); |
203 | 203 | ||
204 | if (atomic_long_inc_return(&nfss->writeback) > | 204 | if (atomic_long_inc_return(&nfss->writeback) > |
205 | NFS_CONGESTION_ON_THRESH) | 205 | NFS_CONGESTION_ON_THRESH) { |
206 | set_bdi_congested(&nfss->backing_dev_info, WRITE); | 206 | set_bdi_congested(&nfss->backing_dev_info, |
207 | BLK_RW_ASYNC); | ||
208 | } | ||
207 | } | 209 | } |
208 | return ret; | 210 | return ret; |
209 | } | 211 | } |
@@ -215,7 +217,7 @@ static void nfs_end_page_writeback(struct page *page) | |||
215 | 217 | ||
216 | end_page_writeback(page); | 218 | end_page_writeback(page); |
217 | if (atomic_long_dec_return(&nfss->writeback) < NFS_CONGESTION_OFF_THRESH) | 219 | if (atomic_long_dec_return(&nfss->writeback) < NFS_CONGESTION_OFF_THRESH) |
218 | clear_bdi_congested(&nfss->backing_dev_info, WRITE); | 220 | clear_bdi_congested(&nfss->backing_dev_info, BLK_RW_ASYNC); |
219 | } | 221 | } |
220 | 222 | ||
221 | /* | 223 | /* |
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index 1250fb978ac1..6d0847562d87 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/inet.h> | 26 | #include <linux/inet.h> |
27 | #include <linux/string.h> | 27 | #include <linux/string.h> |
28 | #include <linux/smp_lock.h> | ||
29 | #include <linux/ctype.h> | 28 | #include <linux/ctype.h> |
30 | 29 | ||
31 | #include <linux/nfs.h> | 30 | #include <linux/nfs.h> |
diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c index d4c9884cd54b..492c79b7800b 100644 --- a/fs/nfsd/nfssvc.c +++ b/fs/nfsd/nfssvc.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/unistd.h> | 18 | #include <linux/unistd.h> |
19 | #include <linux/slab.h> | 19 | #include <linux/slab.h> |
20 | #include <linux/smp.h> | 20 | #include <linux/smp.h> |
21 | #include <linux/smp_lock.h> | ||
22 | #include <linux/freezer.h> | 21 | #include <linux/freezer.h> |
23 | #include <linux/fs_struct.h> | 22 | #include <linux/fs_struct.h> |
24 | #include <linux/kthread.h> | 23 | #include <linux/kthread.h> |
diff --git a/fs/nilfs2/bmap.c b/fs/nilfs2/bmap.c index 36df60b6d8a4..99d58a028b94 100644 --- a/fs/nilfs2/bmap.c +++ b/fs/nilfs2/bmap.c | |||
@@ -568,6 +568,7 @@ void nilfs_bmap_abort_update_v(struct nilfs_bmap *bmap, | |||
568 | } | 568 | } |
569 | 569 | ||
570 | static struct lock_class_key nilfs_bmap_dat_lock_key; | 570 | static struct lock_class_key nilfs_bmap_dat_lock_key; |
571 | static struct lock_class_key nilfs_bmap_mdt_lock_key; | ||
571 | 572 | ||
572 | /** | 573 | /** |
573 | * nilfs_bmap_read - read a bmap from an inode | 574 | * nilfs_bmap_read - read a bmap from an inode |
@@ -603,7 +604,11 @@ int nilfs_bmap_read(struct nilfs_bmap *bmap, struct nilfs_inode *raw_inode) | |||
603 | bmap->b_ptr_type = NILFS_BMAP_PTR_VS; | 604 | bmap->b_ptr_type = NILFS_BMAP_PTR_VS; |
604 | bmap->b_last_allocated_key = 0; | 605 | bmap->b_last_allocated_key = 0; |
605 | bmap->b_last_allocated_ptr = NILFS_BMAP_INVALID_PTR; | 606 | bmap->b_last_allocated_ptr = NILFS_BMAP_INVALID_PTR; |
607 | lockdep_set_class(&bmap->b_sem, &nilfs_bmap_mdt_lock_key); | ||
606 | break; | 608 | break; |
609 | case NILFS_IFILE_INO: | ||
610 | lockdep_set_class(&bmap->b_sem, &nilfs_bmap_mdt_lock_key); | ||
611 | /* Fall through */ | ||
607 | default: | 612 | default: |
608 | bmap->b_ptr_type = NILFS_BMAP_PTR_VM; | 613 | bmap->b_ptr_type = NILFS_BMAP_PTR_VM; |
609 | bmap->b_last_allocated_key = 0; | 614 | bmap->b_last_allocated_key = 0; |
diff --git a/fs/nilfs2/cpfile.c b/fs/nilfs2/cpfile.c index 7d49813f66d6..aec942cf79e3 100644 --- a/fs/nilfs2/cpfile.c +++ b/fs/nilfs2/cpfile.c | |||
@@ -307,7 +307,7 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile, | |||
307 | ret = nilfs_cpfile_get_checkpoint_block(cpfile, cno, 0, &cp_bh); | 307 | ret = nilfs_cpfile_get_checkpoint_block(cpfile, cno, 0, &cp_bh); |
308 | if (ret < 0) { | 308 | if (ret < 0) { |
309 | if (ret != -ENOENT) | 309 | if (ret != -ENOENT) |
310 | goto out_header; | 310 | break; |
311 | /* skip hole */ | 311 | /* skip hole */ |
312 | ret = 0; | 312 | ret = 0; |
313 | continue; | 313 | continue; |
@@ -340,7 +340,7 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile, | |||
340 | continue; | 340 | continue; |
341 | printk(KERN_ERR "%s: cannot delete block\n", | 341 | printk(KERN_ERR "%s: cannot delete block\n", |
342 | __func__); | 342 | __func__); |
343 | goto out_header; | 343 | break; |
344 | } | 344 | } |
345 | } | 345 | } |
346 | 346 | ||
@@ -358,7 +358,6 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile, | |||
358 | kunmap_atomic(kaddr, KM_USER0); | 358 | kunmap_atomic(kaddr, KM_USER0); |
359 | } | 359 | } |
360 | 360 | ||
361 | out_header: | ||
362 | brelse(header_bh); | 361 | brelse(header_bh); |
363 | 362 | ||
364 | out_sem: | 363 | out_sem: |
diff --git a/fs/nilfs2/dat.c b/fs/nilfs2/dat.c index 0b2710e2d565..8927ca27e6f7 100644 --- a/fs/nilfs2/dat.c +++ b/fs/nilfs2/dat.c | |||
@@ -134,15 +134,6 @@ void nilfs_dat_commit_start(struct inode *dat, struct nilfs_palloc_req *req, | |||
134 | entry = nilfs_palloc_block_get_entry(dat, req->pr_entry_nr, | 134 | entry = nilfs_palloc_block_get_entry(dat, req->pr_entry_nr, |
135 | req->pr_entry_bh, kaddr); | 135 | req->pr_entry_bh, kaddr); |
136 | entry->de_start = cpu_to_le64(nilfs_mdt_cno(dat)); | 136 | entry->de_start = cpu_to_le64(nilfs_mdt_cno(dat)); |
137 | if (entry->de_blocknr != cpu_to_le64(0) || | ||
138 | entry->de_end != cpu_to_le64(NILFS_CNO_MAX)) { | ||
139 | printk(KERN_CRIT | ||
140 | "%s: vbn = %llu, start = %llu, end = %llu, pbn = %llu\n", | ||
141 | __func__, (unsigned long long)req->pr_entry_nr, | ||
142 | (unsigned long long)le64_to_cpu(entry->de_start), | ||
143 | (unsigned long long)le64_to_cpu(entry->de_end), | ||
144 | (unsigned long long)le64_to_cpu(entry->de_blocknr)); | ||
145 | } | ||
146 | entry->de_blocknr = cpu_to_le64(blocknr); | 137 | entry->de_blocknr = cpu_to_le64(blocknr); |
147 | kunmap_atomic(kaddr, KM_USER0); | 138 | kunmap_atomic(kaddr, KM_USER0); |
148 | 139 | ||
diff --git a/fs/nilfs2/dir.c b/fs/nilfs2/dir.c index 54100acc1102..1a4fa04cf071 100644 --- a/fs/nilfs2/dir.c +++ b/fs/nilfs2/dir.c | |||
@@ -43,7 +43,6 @@ | |||
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <linux/pagemap.h> | 45 | #include <linux/pagemap.h> |
46 | #include <linux/smp_lock.h> | ||
47 | #include "nilfs.h" | 46 | #include "nilfs.h" |
48 | #include "page.h" | 47 | #include "page.h" |
49 | 48 | ||
diff --git a/fs/nilfs2/segment.c b/fs/nilfs2/segment.c index aa977549919e..8b5e4778cf28 100644 --- a/fs/nilfs2/segment.c +++ b/fs/nilfs2/segment.c | |||
@@ -1829,26 +1829,13 @@ static int nilfs_segctor_write(struct nilfs_sc_info *sci, | |||
1829 | err = nilfs_segbuf_write(segbuf, &wi); | 1829 | err = nilfs_segbuf_write(segbuf, &wi); |
1830 | 1830 | ||
1831 | res = nilfs_segbuf_wait(segbuf, &wi); | 1831 | res = nilfs_segbuf_wait(segbuf, &wi); |
1832 | err = unlikely(err) ? : res; | 1832 | err = err ? : res; |
1833 | if (unlikely(err)) | 1833 | if (err) |
1834 | return err; | 1834 | return err; |
1835 | } | 1835 | } |
1836 | return 0; | 1836 | return 0; |
1837 | } | 1837 | } |
1838 | 1838 | ||
1839 | static int nilfs_page_has_uncleared_buffer(struct page *page) | ||
1840 | { | ||
1841 | struct buffer_head *head, *bh; | ||
1842 | |||
1843 | head = bh = page_buffers(page); | ||
1844 | do { | ||
1845 | if (buffer_dirty(bh) && !list_empty(&bh->b_assoc_buffers)) | ||
1846 | return 1; | ||
1847 | bh = bh->b_this_page; | ||
1848 | } while (bh != head); | ||
1849 | return 0; | ||
1850 | } | ||
1851 | |||
1852 | static void __nilfs_end_page_io(struct page *page, int err) | 1839 | static void __nilfs_end_page_io(struct page *page, int err) |
1853 | { | 1840 | { |
1854 | if (!err) { | 1841 | if (!err) { |
@@ -1872,12 +1859,11 @@ static void nilfs_end_page_io(struct page *page, int err) | |||
1872 | if (!page) | 1859 | if (!page) |
1873 | return; | 1860 | return; |
1874 | 1861 | ||
1875 | if (buffer_nilfs_node(page_buffers(page)) && | 1862 | if (buffer_nilfs_node(page_buffers(page)) && !PageWriteback(page)) |
1876 | nilfs_page_has_uncleared_buffer(page)) | 1863 | /* |
1877 | /* For b-tree node pages, this function may be called twice | 1864 | * For b-tree node pages, this function may be called twice |
1878 | or more because they might be split in a segment. | 1865 | * or more because they might be split in a segment. |
1879 | This check assures that cleanup has been done for all | 1866 | */ |
1880 | buffers in a split btnode page. */ | ||
1881 | return; | 1867 | return; |
1882 | 1868 | ||
1883 | __nilfs_end_page_io(page, err); | 1869 | __nilfs_end_page_io(page, err); |
@@ -1940,7 +1926,7 @@ static void nilfs_segctor_abort_write(struct nilfs_sc_info *sci, | |||
1940 | } | 1926 | } |
1941 | if (bh->b_page != fs_page) { | 1927 | if (bh->b_page != fs_page) { |
1942 | nilfs_end_page_io(fs_page, err); | 1928 | nilfs_end_page_io(fs_page, err); |
1943 | if (unlikely(fs_page == failed_page)) | 1929 | if (fs_page && fs_page == failed_page) |
1944 | goto done; | 1930 | goto done; |
1945 | fs_page = bh->b_page; | 1931 | fs_page = bh->b_page; |
1946 | } | 1932 | } |
diff --git a/fs/ocfs2/ioctl.c b/fs/ocfs2/ioctl.c index 9fcd36dcc9a0..467b413bec21 100644 --- a/fs/ocfs2/ioctl.c +++ b/fs/ocfs2/ioctl.c | |||
@@ -7,7 +7,6 @@ | |||
7 | 7 | ||
8 | #include <linux/fs.h> | 8 | #include <linux/fs.h> |
9 | #include <linux/mount.h> | 9 | #include <linux/mount.h> |
10 | #include <linux/smp_lock.h> | ||
11 | 10 | ||
12 | #define MLOG_MASK_PREFIX ML_INODE | 11 | #define MLOG_MASK_PREFIX ML_INODE |
13 | #include <cluster/masklog.h> | 12 | #include <cluster/masklog.h> |
diff --git a/fs/partitions/check.c b/fs/partitions/check.c index 1a9c7878f864..ea4e6cb29e13 100644 --- a/fs/partitions/check.c +++ b/fs/partitions/check.c | |||
@@ -436,7 +436,7 @@ struct hd_struct *add_partition(struct gendisk *disk, int partno, | |||
436 | rcu_assign_pointer(ptbl->part[partno], p); | 436 | rcu_assign_pointer(ptbl->part[partno], p); |
437 | 437 | ||
438 | /* suppress uevent if the disk supresses it */ | 438 | /* suppress uevent if the disk supresses it */ |
439 | if (!dev_get_uevent_suppress(pdev)) | 439 | if (!dev_get_uevent_suppress(ddev)) |
440 | kobject_uevent(&pdev->kobj, KOBJ_ADD); | 440 | kobject_uevent(&pdev->kobj, KOBJ_ADD); |
441 | 441 | ||
442 | return p; | 442 | return p; |
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 607c579e5eca..70f36c043d62 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
@@ -2042,8 +2042,8 @@ static int vfs_load_quota_inode(struct inode *inode, int type, int format_id, | |||
2042 | * changes */ | 2042 | * changes */ |
2043 | invalidate_bdev(sb->s_bdev); | 2043 | invalidate_bdev(sb->s_bdev); |
2044 | } | 2044 | } |
2045 | mutex_lock(&inode->i_mutex); | ||
2046 | mutex_lock(&dqopt->dqonoff_mutex); | 2045 | mutex_lock(&dqopt->dqonoff_mutex); |
2046 | mutex_lock_nested(&inode->i_mutex, I_MUTEX_QUOTA); | ||
2047 | if (sb_has_quota_loaded(sb, type)) { | 2047 | if (sb_has_quota_loaded(sb, type)) { |
2048 | error = -EBUSY; | 2048 | error = -EBUSY; |
2049 | goto out_lock; | 2049 | goto out_lock; |
@@ -2094,7 +2094,6 @@ out_file_init: | |||
2094 | dqopt->files[type] = NULL; | 2094 | dqopt->files[type] = NULL; |
2095 | iput(inode); | 2095 | iput(inode); |
2096 | out_lock: | 2096 | out_lock: |
2097 | mutex_unlock(&dqopt->dqonoff_mutex); | ||
2098 | if (oldflags != -1) { | 2097 | if (oldflags != -1) { |
2099 | down_write(&dqopt->dqptr_sem); | 2098 | down_write(&dqopt->dqptr_sem); |
2100 | /* Set the flags back (in the case of accidental quotaon() | 2099 | /* Set the flags back (in the case of accidental quotaon() |
@@ -2104,6 +2103,7 @@ out_lock: | |||
2104 | up_write(&dqopt->dqptr_sem); | 2103 | up_write(&dqopt->dqptr_sem); |
2105 | } | 2104 | } |
2106 | mutex_unlock(&inode->i_mutex); | 2105 | mutex_unlock(&inode->i_mutex); |
2106 | mutex_unlock(&dqopt->dqonoff_mutex); | ||
2107 | out_fmt: | 2107 | out_fmt: |
2108 | put_quota_format(fmt); | 2108 | put_quota_format(fmt); |
2109 | 2109 | ||
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index 77f5bb746bf0..90622200b39c 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c | |||
@@ -997,7 +997,7 @@ static int reiserfs_async_progress_wait(struct super_block *s) | |||
997 | DEFINE_WAIT(wait); | 997 | DEFINE_WAIT(wait); |
998 | struct reiserfs_journal *j = SB_JOURNAL(s); | 998 | struct reiserfs_journal *j = SB_JOURNAL(s); |
999 | if (atomic_read(&j->j_async_throttle)) | 999 | if (atomic_read(&j->j_async_throttle)) |
1000 | congestion_wait(WRITE, HZ / 10); | 1000 | congestion_wait(BLK_RW_ASYNC, HZ / 10); |
1001 | return 0; | 1001 | return 0; |
1002 | } | 1002 | } |
1003 | 1003 | ||
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index d3aeb061612b..7adea74d6a8a 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <linux/exportfs.h> | 24 | #include <linux/exportfs.h> |
25 | #include <linux/quotaops.h> | 25 | #include <linux/quotaops.h> |
26 | #include <linux/vfs.h> | 26 | #include <linux/vfs.h> |
27 | #include <linux/mnt_namespace.h> | ||
28 | #include <linux/mount.h> | 27 | #include <linux/mount.h> |
29 | #include <linux/namei.h> | 28 | #include <linux/namei.h> |
30 | #include <linux/crc32.h> | 29 | #include <linux/crc32.h> |
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c index f3d47d856848..6925b835a43b 100644 --- a/fs/reiserfs/xattr.c +++ b/fs/reiserfs/xattr.c | |||
@@ -46,7 +46,6 @@ | |||
46 | #include <linux/reiserfs_acl.h> | 46 | #include <linux/reiserfs_acl.h> |
47 | #include <asm/uaccess.h> | 47 | #include <asm/uaccess.h> |
48 | #include <net/checksum.h> | 48 | #include <net/checksum.h> |
49 | #include <linux/smp_lock.h> | ||
50 | #include <linux/stat.h> | 49 | #include <linux/stat.h> |
51 | #include <linux/quotaops.h> | 50 | #include <linux/quotaops.h> |
52 | 51 | ||
diff --git a/fs/squashfs/super.c b/fs/squashfs/super.c index 3b52770f46ff..cb5fc57e370b 100644 --- a/fs/squashfs/super.c +++ b/fs/squashfs/super.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/fs.h> | 30 | #include <linux/fs.h> |
31 | #include <linux/vfs.h> | 31 | #include <linux/vfs.h> |
32 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
33 | #include <linux/smp_lock.h> | ||
33 | #include <linux/mutex.h> | 34 | #include <linux/mutex.h> |
34 | #include <linux/pagemap.h> | 35 | #include <linux/pagemap.h> |
35 | #include <linux/init.h> | 36 | #include <linux/init.h> |
@@ -112,8 +112,13 @@ restart: | |||
112 | mutex_unlock(&mutex); | 112 | mutex_unlock(&mutex); |
113 | } | 113 | } |
114 | 114 | ||
115 | /* | ||
116 | * sync everything. Start out by waking pdflush, because that writes back | ||
117 | * all queues in parallel. | ||
118 | */ | ||
115 | SYSCALL_DEFINE0(sync) | 119 | SYSCALL_DEFINE0(sync) |
116 | { | 120 | { |
121 | wakeup_pdflush(0); | ||
117 | sync_filesystems(0); | 122 | sync_filesystems(0); |
118 | sync_filesystems(1); | 123 | sync_filesystems(1); |
119 | if (unlikely(laptop_mode)) | 124 | if (unlikely(laptop_mode)) |
diff --git a/fs/sysfs/bin.c b/fs/sysfs/bin.c index 9345806c8853..2524714bece1 100644 --- a/fs/sysfs/bin.c +++ b/fs/sysfs/bin.c | |||
@@ -171,6 +171,7 @@ static ssize_t write(struct file *file, const char __user *userbuf, | |||
171 | if (count > 0) | 171 | if (count > 0) |
172 | *off = offs + count; | 172 | *off = offs + count; |
173 | 173 | ||
174 | kfree(temp); | ||
174 | return count; | 175 | return count; |
175 | } | 176 | } |
176 | 177 | ||
diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c index bc5857199ec2..762a7d6cec73 100644 --- a/fs/ubifs/io.c +++ b/fs/ubifs/io.c | |||
@@ -297,6 +297,7 @@ static enum hrtimer_restart wbuf_timer_callback_nolock(struct hrtimer *timer) | |||
297 | { | 297 | { |
298 | struct ubifs_wbuf *wbuf = container_of(timer, struct ubifs_wbuf, timer); | 298 | struct ubifs_wbuf *wbuf = container_of(timer, struct ubifs_wbuf, timer); |
299 | 299 | ||
300 | dbg_io("jhead %d", wbuf->jhead); | ||
300 | wbuf->need_sync = 1; | 301 | wbuf->need_sync = 1; |
301 | wbuf->c->need_wbuf_sync = 1; | 302 | wbuf->c->need_wbuf_sync = 1; |
302 | ubifs_wake_up_bgt(wbuf->c); | 303 | ubifs_wake_up_bgt(wbuf->c); |
@@ -311,8 +312,12 @@ static void new_wbuf_timer_nolock(struct ubifs_wbuf *wbuf) | |||
311 | { | 312 | { |
312 | ubifs_assert(!hrtimer_active(&wbuf->timer)); | 313 | ubifs_assert(!hrtimer_active(&wbuf->timer)); |
313 | 314 | ||
314 | if (!ktime_to_ns(wbuf->softlimit)) | 315 | if (wbuf->no_timer) |
315 | return; | 316 | return; |
317 | dbg_io("set timer for jhead %d, %llu-%llu millisecs", wbuf->jhead, | ||
318 | div_u64(ktime_to_ns(wbuf->softlimit), USEC_PER_SEC), | ||
319 | div_u64(ktime_to_ns(wbuf->softlimit) + wbuf->delta, | ||
320 | USEC_PER_SEC)); | ||
316 | hrtimer_start_range_ns(&wbuf->timer, wbuf->softlimit, wbuf->delta, | 321 | hrtimer_start_range_ns(&wbuf->timer, wbuf->softlimit, wbuf->delta, |
317 | HRTIMER_MODE_REL); | 322 | HRTIMER_MODE_REL); |
318 | } | 323 | } |
@@ -323,11 +328,8 @@ static void new_wbuf_timer_nolock(struct ubifs_wbuf *wbuf) | |||
323 | */ | 328 | */ |
324 | static void cancel_wbuf_timer_nolock(struct ubifs_wbuf *wbuf) | 329 | static void cancel_wbuf_timer_nolock(struct ubifs_wbuf *wbuf) |
325 | { | 330 | { |
326 | /* | 331 | if (wbuf->no_timer) |
327 | * If the syncer is waiting for the lock (from the background thread's | 332 | return; |
328 | * context) and another task is changing write-buffer then the syncing | ||
329 | * should be canceled. | ||
330 | */ | ||
331 | wbuf->need_sync = 0; | 333 | wbuf->need_sync = 0; |
332 | hrtimer_cancel(&wbuf->timer); | 334 | hrtimer_cancel(&wbuf->timer); |
333 | } | 335 | } |
@@ -349,8 +351,8 @@ int ubifs_wbuf_sync_nolock(struct ubifs_wbuf *wbuf) | |||
349 | /* Write-buffer is empty or not seeked */ | 351 | /* Write-buffer is empty or not seeked */ |
350 | return 0; | 352 | return 0; |
351 | 353 | ||
352 | dbg_io("LEB %d:%d, %d bytes", | 354 | dbg_io("LEB %d:%d, %d bytes, jhead %d", |
353 | wbuf->lnum, wbuf->offs, wbuf->used); | 355 | wbuf->lnum, wbuf->offs, wbuf->used, wbuf->jhead); |
354 | ubifs_assert(!(c->vfs_sb->s_flags & MS_RDONLY)); | 356 | ubifs_assert(!(c->vfs_sb->s_flags & MS_RDONLY)); |
355 | ubifs_assert(!(wbuf->avail & 7)); | 357 | ubifs_assert(!(wbuf->avail & 7)); |
356 | ubifs_assert(wbuf->offs + c->min_io_size <= c->leb_size); | 358 | ubifs_assert(wbuf->offs + c->min_io_size <= c->leb_size); |
@@ -390,7 +392,7 @@ int ubifs_wbuf_sync_nolock(struct ubifs_wbuf *wbuf) | |||
390 | * @offs: logical eraseblock offset to seek to | 392 | * @offs: logical eraseblock offset to seek to |
391 | * @dtype: data type | 393 | * @dtype: data type |
392 | * | 394 | * |
393 | * This function targets the write buffer to logical eraseblock @lnum:@offs. | 395 | * This function targets the write-buffer to logical eraseblock @lnum:@offs. |
394 | * The write-buffer is synchronized if it is not empty. Returns zero in case of | 396 | * The write-buffer is synchronized if it is not empty. Returns zero in case of |
395 | * success and a negative error code in case of failure. | 397 | * success and a negative error code in case of failure. |
396 | */ | 398 | */ |
@@ -399,7 +401,7 @@ int ubifs_wbuf_seek_nolock(struct ubifs_wbuf *wbuf, int lnum, int offs, | |||
399 | { | 401 | { |
400 | const struct ubifs_info *c = wbuf->c; | 402 | const struct ubifs_info *c = wbuf->c; |
401 | 403 | ||
402 | dbg_io("LEB %d:%d", lnum, offs); | 404 | dbg_io("LEB %d:%d, jhead %d", lnum, offs, wbuf->jhead); |
403 | ubifs_assert(lnum >= 0 && lnum < c->leb_cnt); | 405 | ubifs_assert(lnum >= 0 && lnum < c->leb_cnt); |
404 | ubifs_assert(offs >= 0 && offs <= c->leb_size); | 406 | ubifs_assert(offs >= 0 && offs <= c->leb_size); |
405 | ubifs_assert(offs % c->min_io_size == 0 && !(offs & 7)); | 407 | ubifs_assert(offs % c->min_io_size == 0 && !(offs & 7)); |
@@ -506,9 +508,9 @@ int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len) | |||
506 | struct ubifs_info *c = wbuf->c; | 508 | struct ubifs_info *c = wbuf->c; |
507 | int err, written, n, aligned_len = ALIGN(len, 8), offs; | 509 | int err, written, n, aligned_len = ALIGN(len, 8), offs; |
508 | 510 | ||
509 | dbg_io("%d bytes (%s) to wbuf at LEB %d:%d", len, | 511 | dbg_io("%d bytes (%s) to jhead %d wbuf at LEB %d:%d", len, |
510 | dbg_ntype(((struct ubifs_ch *)buf)->node_type), wbuf->lnum, | 512 | dbg_ntype(((struct ubifs_ch *)buf)->node_type), wbuf->jhead, |
511 | wbuf->offs + wbuf->used); | 513 | wbuf->lnum, wbuf->offs + wbuf->used); |
512 | ubifs_assert(len > 0 && wbuf->lnum >= 0 && wbuf->lnum < c->leb_cnt); | 514 | ubifs_assert(len > 0 && wbuf->lnum >= 0 && wbuf->lnum < c->leb_cnt); |
513 | ubifs_assert(wbuf->offs >= 0 && wbuf->offs % c->min_io_size == 0); | 515 | ubifs_assert(wbuf->offs >= 0 && wbuf->offs % c->min_io_size == 0); |
514 | ubifs_assert(!(wbuf->offs & 7) && wbuf->offs <= c->leb_size); | 516 | ubifs_assert(!(wbuf->offs & 7) && wbuf->offs <= c->leb_size); |
@@ -533,8 +535,8 @@ int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len) | |||
533 | memcpy(wbuf->buf + wbuf->used, buf, len); | 535 | memcpy(wbuf->buf + wbuf->used, buf, len); |
534 | 536 | ||
535 | if (aligned_len == wbuf->avail) { | 537 | if (aligned_len == wbuf->avail) { |
536 | dbg_io("flush wbuf to LEB %d:%d", wbuf->lnum, | 538 | dbg_io("flush jhead %d wbuf to LEB %d:%d", |
537 | wbuf->offs); | 539 | wbuf->jhead, wbuf->lnum, wbuf->offs); |
538 | err = ubi_leb_write(c->ubi, wbuf->lnum, wbuf->buf, | 540 | err = ubi_leb_write(c->ubi, wbuf->lnum, wbuf->buf, |
539 | wbuf->offs, c->min_io_size, | 541 | wbuf->offs, c->min_io_size, |
540 | wbuf->dtype); | 542 | wbuf->dtype); |
@@ -562,7 +564,8 @@ int ubifs_wbuf_write_nolock(struct ubifs_wbuf *wbuf, void *buf, int len) | |||
562 | * minimal I/O unit. We have to fill and flush write-buffer and switch | 564 | * minimal I/O unit. We have to fill and flush write-buffer and switch |
563 | * to the next min. I/O unit. | 565 | * to the next min. I/O unit. |
564 | */ | 566 | */ |
565 | dbg_io("flush wbuf to LEB %d:%d", wbuf->lnum, wbuf->offs); | 567 | dbg_io("flush jhead %d wbuf to LEB %d:%d", |
568 | wbuf->jhead, wbuf->lnum, wbuf->offs); | ||
566 | memcpy(wbuf->buf + wbuf->used, buf, wbuf->avail); | 569 | memcpy(wbuf->buf + wbuf->used, buf, wbuf->avail); |
567 | err = ubi_leb_write(c->ubi, wbuf->lnum, wbuf->buf, wbuf->offs, | 570 | err = ubi_leb_write(c->ubi, wbuf->lnum, wbuf->buf, wbuf->offs, |
568 | c->min_io_size, wbuf->dtype); | 571 | c->min_io_size, wbuf->dtype); |
@@ -695,7 +698,8 @@ int ubifs_read_node_wbuf(struct ubifs_wbuf *wbuf, void *buf, int type, int len, | |||
695 | int err, rlen, overlap; | 698 | int err, rlen, overlap; |
696 | struct ubifs_ch *ch = buf; | 699 | struct ubifs_ch *ch = buf; |
697 | 700 | ||
698 | dbg_io("LEB %d:%d, %s, length %d", lnum, offs, dbg_ntype(type), len); | 701 | dbg_io("LEB %d:%d, %s, length %d, jhead %d", lnum, offs, |
702 | dbg_ntype(type), len, wbuf->jhead); | ||
699 | ubifs_assert(wbuf && lnum >= 0 && lnum < c->leb_cnt && offs >= 0); | 703 | ubifs_assert(wbuf && lnum >= 0 && lnum < c->leb_cnt && offs >= 0); |
700 | ubifs_assert(!(offs & 7) && offs < c->leb_size); | 704 | ubifs_assert(!(offs & 7) && offs < c->leb_size); |
701 | ubifs_assert(type >= 0 && type < UBIFS_NODE_TYPES_CNT); | 705 | ubifs_assert(type >= 0 && type < UBIFS_NODE_TYPES_CNT); |
@@ -819,13 +823,12 @@ out: | |||
819 | * @c: UBIFS file-system description object | 823 | * @c: UBIFS file-system description object |
820 | * @wbuf: write-buffer to initialize | 824 | * @wbuf: write-buffer to initialize |
821 | * | 825 | * |
822 | * This function initializes write buffer. Returns zero in case of success | 826 | * This function initializes write-buffer. Returns zero in case of success |
823 | * %-ENOMEM in case of failure. | 827 | * %-ENOMEM in case of failure. |
824 | */ | 828 | */ |
825 | int ubifs_wbuf_init(struct ubifs_info *c, struct ubifs_wbuf *wbuf) | 829 | int ubifs_wbuf_init(struct ubifs_info *c, struct ubifs_wbuf *wbuf) |
826 | { | 830 | { |
827 | size_t size; | 831 | size_t size; |
828 | ktime_t hardlimit; | ||
829 | 832 | ||
830 | wbuf->buf = kmalloc(c->min_io_size, GFP_KERNEL); | 833 | wbuf->buf = kmalloc(c->min_io_size, GFP_KERNEL); |
831 | if (!wbuf->buf) | 834 | if (!wbuf->buf) |
@@ -851,22 +854,16 @@ int ubifs_wbuf_init(struct ubifs_info *c, struct ubifs_wbuf *wbuf) | |||
851 | 854 | ||
852 | hrtimer_init(&wbuf->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); | 855 | hrtimer_init(&wbuf->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); |
853 | wbuf->timer.function = wbuf_timer_callback_nolock; | 856 | wbuf->timer.function = wbuf_timer_callback_nolock; |
854 | /* | 857 | wbuf->softlimit = ktime_set(WBUF_TIMEOUT_SOFTLIMIT, 0); |
855 | * Make write-buffer soft limit to be 20% of the hard limit. The | 858 | wbuf->delta = WBUF_TIMEOUT_HARDLIMIT - WBUF_TIMEOUT_SOFTLIMIT; |
856 | * write-buffer timer is allowed to expire any time between the soft | 859 | wbuf->delta *= 1000000000ULL; |
857 | * and hard limits. | 860 | ubifs_assert(wbuf->delta <= ULONG_MAX); |
858 | */ | ||
859 | hardlimit = ktime_set(DEFAULT_WBUF_TIMEOUT_SECS, 0); | ||
860 | wbuf->delta = (DEFAULT_WBUF_TIMEOUT_SECS * NSEC_PER_SEC) * 2 / 10; | ||
861 | wbuf->softlimit = ktime_sub_ns(hardlimit, wbuf->delta); | ||
862 | hrtimer_set_expires_range_ns(&wbuf->timer, wbuf->softlimit, | ||
863 | wbuf->delta); | ||
864 | return 0; | 861 | return 0; |
865 | } | 862 | } |
866 | 863 | ||
867 | /** | 864 | /** |
868 | * ubifs_wbuf_add_ino_nolock - add an inode number into the wbuf inode array. | 865 | * ubifs_wbuf_add_ino_nolock - add an inode number into the wbuf inode array. |
869 | * @wbuf: the write-buffer whereto add | 866 | * @wbuf: the write-buffer where to add |
870 | * @inum: the inode number | 867 | * @inum: the inode number |
871 | * | 868 | * |
872 | * This function adds an inode number to the inode array of the write-buffer. | 869 | * This function adds an inode number to the inode array of the write-buffer. |
diff --git a/fs/ubifs/ioctl.c b/fs/ubifs/ioctl.c index 6db7a6be6c97..8aacd64957a2 100644 --- a/fs/ubifs/ioctl.c +++ b/fs/ubifs/ioctl.c | |||
@@ -25,7 +25,6 @@ | |||
25 | /* This file implements EXT2-compatible extended attribute ioctl() calls */ | 25 | /* This file implements EXT2-compatible extended attribute ioctl() calls */ |
26 | 26 | ||
27 | #include <linux/compat.h> | 27 | #include <linux/compat.h> |
28 | #include <linux/smp_lock.h> | ||
29 | #include <linux/mount.h> | 28 | #include <linux/mount.h> |
30 | #include "ubifs.h" | 29 | #include "ubifs.h" |
31 | 30 | ||
diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c index 805605250f12..e5f6cf8a1155 100644 --- a/fs/ubifs/recovery.c +++ b/fs/ubifs/recovery.c | |||
@@ -53,6 +53,25 @@ static int is_empty(void *buf, int len) | |||
53 | } | 53 | } |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * first_non_ff - find offset of the first non-0xff byte. | ||
57 | * @buf: buffer to search in | ||
58 | * @len: length of buffer | ||
59 | * | ||
60 | * This function returns offset of the first non-0xff byte in @buf or %-1 if | ||
61 | * the buffer contains only 0xff bytes. | ||
62 | */ | ||
63 | static int first_non_ff(void *buf, int len) | ||
64 | { | ||
65 | uint8_t *p = buf; | ||
66 | int i; | ||
67 | |||
68 | for (i = 0; i < len; i++) | ||
69 | if (*p++ != 0xff) | ||
70 | return i; | ||
71 | return -1; | ||
72 | } | ||
73 | |||
74 | /** | ||
56 | * get_master_node - get the last valid master node allowing for corruption. | 75 | * get_master_node - get the last valid master node allowing for corruption. |
57 | * @c: UBIFS file-system description object | 76 | * @c: UBIFS file-system description object |
58 | * @lnum: LEB number | 77 | * @lnum: LEB number |
@@ -357,11 +376,7 @@ static int is_last_write(const struct ubifs_info *c, void *buf, int offs) | |||
357 | empty_offs = ALIGN(offs + 1, c->min_io_size); | 376 | empty_offs = ALIGN(offs + 1, c->min_io_size); |
358 | check_len = c->leb_size - empty_offs; | 377 | check_len = c->leb_size - empty_offs; |
359 | p = buf + empty_offs - offs; | 378 | p = buf + empty_offs - offs; |
360 | 379 | return is_empty(p, check_len); | |
361 | for (; check_len > 0; check_len--) | ||
362 | if (*p++ != 0xff) | ||
363 | return 0; | ||
364 | return 1; | ||
365 | } | 380 | } |
366 | 381 | ||
367 | /** | 382 | /** |
@@ -543,8 +558,8 @@ static int drop_incomplete_group(struct ubifs_scan_leb *sleb, int *offs) | |||
543 | * | 558 | * |
544 | * This function does a scan of a LEB, but caters for errors that might have | 559 | * This function does a scan of a LEB, but caters for errors that might have |
545 | * been caused by the unclean unmount from which we are attempting to recover. | 560 | * been caused by the unclean unmount from which we are attempting to recover. |
546 | * | 561 | * Returns %0 in case of success, %-EUCLEAN if an unrecoverable corruption is |
547 | * This function returns %0 on success and a negative error code on failure. | 562 | * found, and a negative error code in case of failure. |
548 | */ | 563 | */ |
549 | struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum, | 564 | struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum, |
550 | int offs, void *sbuf, int grouped) | 565 | int offs, void *sbuf, int grouped) |
@@ -643,7 +658,8 @@ struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum, | |||
643 | goto corrupted; | 658 | goto corrupted; |
644 | default: | 659 | default: |
645 | dbg_err("unknown"); | 660 | dbg_err("unknown"); |
646 | goto corrupted; | 661 | err = -EINVAL; |
662 | goto error; | ||
647 | } | 663 | } |
648 | } | 664 | } |
649 | 665 | ||
@@ -652,8 +668,13 @@ struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum, | |||
652 | clean_buf(c, &buf, lnum, &offs, &len); | 668 | clean_buf(c, &buf, lnum, &offs, &len); |
653 | need_clean = 1; | 669 | need_clean = 1; |
654 | } else { | 670 | } else { |
655 | ubifs_err("corrupt empty space at LEB %d:%d", | 671 | int corruption = first_non_ff(buf, len); |
656 | lnum, offs); | 672 | |
673 | ubifs_err("corrupt empty space LEB %d:%d, corruption " | ||
674 | "starts at %d", lnum, offs, corruption); | ||
675 | /* Make sure we dump interesting non-0xFF data */ | ||
676 | offs = corruption; | ||
677 | buf += corruption; | ||
657 | goto corrupted; | 678 | goto corrupted; |
658 | } | 679 | } |
659 | } | 680 | } |
@@ -813,7 +834,7 @@ struct ubifs_scan_leb *ubifs_recover_log_leb(struct ubifs_info *c, int lnum, | |||
813 | static int recover_head(const struct ubifs_info *c, int lnum, int offs, | 834 | static int recover_head(const struct ubifs_info *c, int lnum, int offs, |
814 | void *sbuf) | 835 | void *sbuf) |
815 | { | 836 | { |
816 | int len, err, need_clean = 0; | 837 | int len, err; |
817 | 838 | ||
818 | if (c->min_io_size > 1) | 839 | if (c->min_io_size > 1) |
819 | len = c->min_io_size; | 840 | len = c->min_io_size; |
@@ -827,19 +848,7 @@ static int recover_head(const struct ubifs_info *c, int lnum, int offs, | |||
827 | 848 | ||
828 | /* Read at the head location and check it is empty flash */ | 849 | /* Read at the head location and check it is empty flash */ |
829 | err = ubi_read(c->ubi, lnum, sbuf, offs, len); | 850 | err = ubi_read(c->ubi, lnum, sbuf, offs, len); |
830 | if (err) | 851 | if (err || !is_empty(sbuf, len)) { |
831 | need_clean = 1; | ||
832 | else { | ||
833 | uint8_t *p = sbuf; | ||
834 | |||
835 | while (len--) | ||
836 | if (*p++ != 0xff) { | ||
837 | need_clean = 1; | ||
838 | break; | ||
839 | } | ||
840 | } | ||
841 | |||
842 | if (need_clean) { | ||
843 | dbg_rcvry("cleaning head at %d:%d", lnum, offs); | 852 | dbg_rcvry("cleaning head at %d:%d", lnum, offs); |
844 | if (offs == 0) | 853 | if (offs == 0) |
845 | return ubifs_leb_unmap(c, lnum); | 854 | return ubifs_leb_unmap(c, lnum); |
diff --git a/fs/ubifs/replay.c b/fs/ubifs/replay.c index 11cc80125a49..2970500f32df 100644 --- a/fs/ubifs/replay.c +++ b/fs/ubifs/replay.c | |||
@@ -837,9 +837,10 @@ static int replay_log_leb(struct ubifs_info *c, int lnum, int offs, void *sbuf) | |||
837 | 837 | ||
838 | dbg_mnt("replay log LEB %d:%d", lnum, offs); | 838 | dbg_mnt("replay log LEB %d:%d", lnum, offs); |
839 | sleb = ubifs_scan(c, lnum, offs, sbuf); | 839 | sleb = ubifs_scan(c, lnum, offs, sbuf); |
840 | if (IS_ERR(sleb)) { | 840 | if (IS_ERR(sleb) ) { |
841 | if (c->need_recovery) | 841 | if (PTR_ERR(sleb) != -EUCLEAN || !c->need_recovery) |
842 | sleb = ubifs_recover_log_leb(c, lnum, offs, sbuf); | 842 | return PTR_ERR(sleb); |
843 | sleb = ubifs_recover_log_leb(c, lnum, offs, sbuf); | ||
843 | if (IS_ERR(sleb)) | 844 | if (IS_ERR(sleb)) |
844 | return PTR_ERR(sleb); | 845 | return PTR_ERR(sleb); |
845 | } | 846 | } |
@@ -957,7 +958,7 @@ out: | |||
957 | return err; | 958 | return err; |
958 | 959 | ||
959 | out_dump: | 960 | out_dump: |
960 | ubifs_err("log error detected while replying the log at LEB %d:%d", | 961 | ubifs_err("log error detected while replaying the log at LEB %d:%d", |
961 | lnum, offs + snod->offs); | 962 | lnum, offs + snod->offs); |
962 | dbg_dump_node(c, snod->node); | 963 | dbg_dump_node(c, snod->node); |
963 | ubifs_scan_destroy(sleb); | 964 | ubifs_scan_destroy(sleb); |
diff --git a/fs/ubifs/scan.c b/fs/ubifs/scan.c index 0ed82479b44b..892ebfee4fe5 100644 --- a/fs/ubifs/scan.c +++ b/fs/ubifs/scan.c | |||
@@ -238,12 +238,12 @@ void ubifs_scanned_corruption(const struct ubifs_info *c, int lnum, int offs, | |||
238 | { | 238 | { |
239 | int len; | 239 | int len; |
240 | 240 | ||
241 | ubifs_err("corrupted data at LEB %d:%d", lnum, offs); | 241 | ubifs_err("corruption at LEB %d:%d", lnum, offs); |
242 | if (dbg_failure_mode) | 242 | if (dbg_failure_mode) |
243 | return; | 243 | return; |
244 | len = c->leb_size - offs; | 244 | len = c->leb_size - offs; |
245 | if (len > 4096) | 245 | if (len > 8192) |
246 | len = 4096; | 246 | len = 8192; |
247 | dbg_err("first %d bytes from LEB %d:%d", len, lnum, offs); | 247 | dbg_err("first %d bytes from LEB %d:%d", len, lnum, offs); |
248 | print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 4, buf, len, 1); | 248 | print_hex_dump(KERN_DEBUG, "", DUMP_PREFIX_OFFSET, 32, 4, buf, len, 1); |
249 | } | 249 | } |
@@ -256,7 +256,9 @@ void ubifs_scanned_corruption(const struct ubifs_info *c, int lnum, int offs, | |||
256 | * @sbuf: scan buffer (must be c->leb_size) | 256 | * @sbuf: scan buffer (must be c->leb_size) |
257 | * | 257 | * |
258 | * This function scans LEB number @lnum and returns complete information about | 258 | * This function scans LEB number @lnum and returns complete information about |
259 | * its contents. Returns an error code in case of failure. | 259 | * its contents. Returns the scaned information in case of success and, |
260 | * %-EUCLEAN if the LEB neads recovery, and other negative error codes in case | ||
261 | * of failure. | ||
260 | */ | 262 | */ |
261 | struct ubifs_scan_leb *ubifs_scan(const struct ubifs_info *c, int lnum, | 263 | struct ubifs_scan_leb *ubifs_scan(const struct ubifs_info *c, int lnum, |
262 | int offs, void *sbuf) | 264 | int offs, void *sbuf) |
@@ -279,7 +281,6 @@ struct ubifs_scan_leb *ubifs_scan(const struct ubifs_info *c, int lnum, | |||
279 | cond_resched(); | 281 | cond_resched(); |
280 | 282 | ||
281 | ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 0); | 283 | ret = ubifs_scan_a_node(c, buf, len, lnum, offs, 0); |
282 | |||
283 | if (ret > 0) { | 284 | if (ret > 0) { |
284 | /* Padding bytes or a valid padding node */ | 285 | /* Padding bytes or a valid padding node */ |
285 | offs += ret; | 286 | offs += ret; |
@@ -304,7 +305,8 @@ struct ubifs_scan_leb *ubifs_scan(const struct ubifs_info *c, int lnum, | |||
304 | goto corrupted; | 305 | goto corrupted; |
305 | default: | 306 | default: |
306 | dbg_err("unknown"); | 307 | dbg_err("unknown"); |
307 | goto corrupted; | 308 | err = -EINVAL; |
309 | goto error; | ||
308 | } | 310 | } |
309 | 311 | ||
310 | err = ubifs_add_snod(c, sleb, buf, offs); | 312 | err = ubifs_add_snod(c, sleb, buf, offs); |
@@ -317,8 +319,10 @@ struct ubifs_scan_leb *ubifs_scan(const struct ubifs_info *c, int lnum, | |||
317 | len -= node_len; | 319 | len -= node_len; |
318 | } | 320 | } |
319 | 321 | ||
320 | if (offs % c->min_io_size) | 322 | if (offs % c->min_io_size) { |
321 | goto corrupted; | 323 | ubifs_err("empty space starts at non-aligned offset %d", offs); |
324 | goto corrupted;; | ||
325 | } | ||
322 | 326 | ||
323 | ubifs_end_scan(c, sleb, lnum, offs); | 327 | ubifs_end_scan(c, sleb, lnum, offs); |
324 | 328 | ||
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 79fad43f3c57..26d2e0d80465 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
@@ -797,7 +797,7 @@ static int alloc_wbufs(struct ubifs_info *c) | |||
797 | * does not need to be synchronized by timer. | 797 | * does not need to be synchronized by timer. |
798 | */ | 798 | */ |
799 | c->jheads[GCHD].wbuf.dtype = UBI_LONGTERM; | 799 | c->jheads[GCHD].wbuf.dtype = UBI_LONGTERM; |
800 | c->jheads[GCHD].wbuf.softlimit = ktime_set(0, 0); | 800 | c->jheads[GCHD].wbuf.no_timer = 1; |
801 | 801 | ||
802 | return 0; | 802 | return 0; |
803 | } | 803 | } |
@@ -986,7 +986,7 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options, | |||
986 | switch (token) { | 986 | switch (token) { |
987 | /* | 987 | /* |
988 | * %Opt_fast_unmount and %Opt_norm_unmount options are ignored. | 988 | * %Opt_fast_unmount and %Opt_norm_unmount options are ignored. |
989 | * We accepte them in order to be backware-compatible. But this | 989 | * We accept them in order to be backward-compatible. But this |
990 | * should be removed at some point. | 990 | * should be removed at some point. |
991 | */ | 991 | */ |
992 | case Opt_fast_unmount: | 992 | case Opt_fast_unmount: |
@@ -1287,6 +1287,9 @@ static int mount_ubifs(struct ubifs_info *c) | |||
1287 | if (err) | 1287 | if (err) |
1288 | goto out_journal; | 1288 | goto out_journal; |
1289 | 1289 | ||
1290 | /* Calculate 'min_idx_lebs' after journal replay */ | ||
1291 | c->min_idx_lebs = ubifs_calc_min_idx_lebs(c); | ||
1292 | |||
1290 | err = ubifs_mount_orphans(c, c->need_recovery, mounted_read_only); | 1293 | err = ubifs_mount_orphans(c, c->need_recovery, mounted_read_only); |
1291 | if (err) | 1294 | if (err) |
1292 | goto out_orphans; | 1295 | goto out_orphans; |
@@ -1754,10 +1757,8 @@ static void ubifs_put_super(struct super_block *sb) | |||
1754 | 1757 | ||
1755 | /* Synchronize write-buffers */ | 1758 | /* Synchronize write-buffers */ |
1756 | if (c->jheads) | 1759 | if (c->jheads) |
1757 | for (i = 0; i < c->jhead_cnt; i++) { | 1760 | for (i = 0; i < c->jhead_cnt; i++) |
1758 | ubifs_wbuf_sync(&c->jheads[i].wbuf); | 1761 | ubifs_wbuf_sync(&c->jheads[i].wbuf); |
1759 | hrtimer_cancel(&c->jheads[i].wbuf.timer); | ||
1760 | } | ||
1761 | 1762 | ||
1762 | /* | 1763 | /* |
1763 | * On fatal errors c->ro_media is set to 1, in which case we do | 1764 | * On fatal errors c->ro_media is set to 1, in which case we do |
@@ -1975,7 +1976,8 @@ static int ubifs_fill_super(struct super_block *sb, void *data, int silent) | |||
1975 | err = bdi_init(&c->bdi); | 1976 | err = bdi_init(&c->bdi); |
1976 | if (err) | 1977 | if (err) |
1977 | goto out_close; | 1978 | goto out_close; |
1978 | err = bdi_register(&c->bdi, NULL, "ubifs"); | 1979 | err = bdi_register(&c->bdi, NULL, "ubifs_%d_%d", |
1980 | c->vi.ubi_num, c->vi.vol_id); | ||
1979 | if (err) | 1981 | if (err) |
1980 | goto out_bdi; | 1982 | goto out_bdi; |
1981 | 1983 | ||
diff --git a/fs/ubifs/ubifs.h b/fs/ubifs/ubifs.h index 1bf01d820066..a29349094422 100644 --- a/fs/ubifs/ubifs.h +++ b/fs/ubifs/ubifs.h | |||
@@ -95,8 +95,9 @@ | |||
95 | */ | 95 | */ |
96 | #define BGT_NAME_PATTERN "ubifs_bgt%d_%d" | 96 | #define BGT_NAME_PATTERN "ubifs_bgt%d_%d" |
97 | 97 | ||
98 | /* Default write-buffer synchronization timeout in seconds */ | 98 | /* Write-buffer synchronization timeout interval in seconds */ |
99 | #define DEFAULT_WBUF_TIMEOUT_SECS 5 | 99 | #define WBUF_TIMEOUT_SOFTLIMIT 3 |
100 | #define WBUF_TIMEOUT_HARDLIMIT 5 | ||
100 | 101 | ||
101 | /* Maximum possible inode number (only 32-bit inodes are supported now) */ | 102 | /* Maximum possible inode number (only 32-bit inodes are supported now) */ |
102 | #define MAX_INUM 0xFFFFFFFF | 103 | #define MAX_INUM 0xFFFFFFFF |
@@ -654,7 +655,8 @@ typedef int (*ubifs_lpt_scan_callback)(struct ubifs_info *c, | |||
654 | * @delta: hard and soft timeouts delta (the timer expire inteval is @softlimit | 655 | * @delta: hard and soft timeouts delta (the timer expire inteval is @softlimit |
655 | * and @softlimit + @delta) | 656 | * and @softlimit + @delta) |
656 | * @timer: write-buffer timer | 657 | * @timer: write-buffer timer |
657 | * @need_sync: it is set if its timer expired and needs sync | 658 | * @no_timer: non-zero if this write-buffer does not have a timer |
659 | * @need_sync: non-zero if the timer expired and the wbuf needs sync'ing | ||
658 | * @next_ino: points to the next position of the following inode number | 660 | * @next_ino: points to the next position of the following inode number |
659 | * @inodes: stores the inode numbers of the nodes which are in wbuf | 661 | * @inodes: stores the inode numbers of the nodes which are in wbuf |
660 | * | 662 | * |
@@ -683,7 +685,8 @@ struct ubifs_wbuf { | |||
683 | ktime_t softlimit; | 685 | ktime_t softlimit; |
684 | unsigned long long delta; | 686 | unsigned long long delta; |
685 | struct hrtimer timer; | 687 | struct hrtimer timer; |
686 | int need_sync; | 688 | unsigned int no_timer:1; |
689 | unsigned int need_sync:1; | ||
687 | int next_ino; | 690 | int next_ino; |
688 | ino_t *inodes; | 691 | ino_t *inodes; |
689 | }; | 692 | }; |
diff --git a/fs/xfs/linux-2.6/kmem.c b/fs/xfs/linux-2.6/kmem.c index 1cd3b55ee3d2..2d3f90afe5f1 100644 --- a/fs/xfs/linux-2.6/kmem.c +++ b/fs/xfs/linux-2.6/kmem.c | |||
@@ -53,7 +53,7 @@ kmem_alloc(size_t size, unsigned int __nocast flags) | |||
53 | printk(KERN_ERR "XFS: possible memory allocation " | 53 | printk(KERN_ERR "XFS: possible memory allocation " |
54 | "deadlock in %s (mode:0x%x)\n", | 54 | "deadlock in %s (mode:0x%x)\n", |
55 | __func__, lflags); | 55 | __func__, lflags); |
56 | congestion_wait(WRITE, HZ/50); | 56 | congestion_wait(BLK_RW_ASYNC, HZ/50); |
57 | } while (1); | 57 | } while (1); |
58 | } | 58 | } |
59 | 59 | ||
@@ -130,7 +130,7 @@ kmem_zone_alloc(kmem_zone_t *zone, unsigned int __nocast flags) | |||
130 | printk(KERN_ERR "XFS: possible memory allocation " | 130 | printk(KERN_ERR "XFS: possible memory allocation " |
131 | "deadlock in %s (mode:0x%x)\n", | 131 | "deadlock in %s (mode:0x%x)\n", |
132 | __func__, lflags); | 132 | __func__, lflags); |
133 | congestion_wait(WRITE, HZ/50); | 133 | congestion_wait(BLK_RW_ASYNC, HZ/50); |
134 | } while (1); | 134 | } while (1); |
135 | } | 135 | } |
136 | 136 | ||
diff --git a/fs/xfs/linux-2.6/xfs_buf.c b/fs/xfs/linux-2.6/xfs_buf.c index 1418b916fc27..0c93c7ef3d18 100644 --- a/fs/xfs/linux-2.6/xfs_buf.c +++ b/fs/xfs/linux-2.6/xfs_buf.c | |||
@@ -412,7 +412,7 @@ _xfs_buf_lookup_pages( | |||
412 | 412 | ||
413 | XFS_STATS_INC(xb_page_retries); | 413 | XFS_STATS_INC(xb_page_retries); |
414 | xfsbufd_wakeup(0, gfp_mask); | 414 | xfsbufd_wakeup(0, gfp_mask); |
415 | congestion_wait(WRITE, HZ/50); | 415 | congestion_wait(BLK_RW_ASYNC, HZ/50); |
416 | goto retry; | 416 | goto retry; |
417 | } | 417 | } |
418 | 418 | ||
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c index f4e255441574..0542fd507649 100644 --- a/fs/xfs/linux-2.6/xfs_file.c +++ b/fs/xfs/linux-2.6/xfs_file.c | |||
@@ -41,7 +41,6 @@ | |||
41 | #include "xfs_ioctl.h" | 41 | #include "xfs_ioctl.h" |
42 | 42 | ||
43 | #include <linux/dcache.h> | 43 | #include <linux/dcache.h> |
44 | #include <linux/smp_lock.h> | ||
45 | 44 | ||
46 | static struct vm_operations_struct xfs_file_vm_ops; | 45 | static struct vm_operations_struct xfs_file_vm_ops; |
47 | 46 | ||
diff --git a/include/linux/backing-dev.h b/include/linux/backing-dev.h index 0ec2c594868e..1d52425a6118 100644 --- a/include/linux/backing-dev.h +++ b/include/linux/backing-dev.h | |||
@@ -229,9 +229,14 @@ static inline int bdi_rw_congested(struct backing_dev_info *bdi) | |||
229 | (1 << BDI_async_congested)); | 229 | (1 << BDI_async_congested)); |
230 | } | 230 | } |
231 | 231 | ||
232 | void clear_bdi_congested(struct backing_dev_info *bdi, int rw); | 232 | enum { |
233 | void set_bdi_congested(struct backing_dev_info *bdi, int rw); | 233 | BLK_RW_ASYNC = 0, |
234 | long congestion_wait(int rw, long timeout); | 234 | BLK_RW_SYNC = 1, |
235 | }; | ||
236 | |||
237 | void clear_bdi_congested(struct backing_dev_info *bdi, int sync); | ||
238 | void set_bdi_congested(struct backing_dev_info *bdi, int sync); | ||
239 | long congestion_wait(int sync, long timeout); | ||
235 | 240 | ||
236 | 241 | ||
237 | static inline bool bdi_cap_writeback_dirty(struct backing_dev_info *bdi) | 242 | static inline bool bdi_cap_writeback_dirty(struct backing_dev_info *bdi) |
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 49ae07951d55..e7cb5dbf6c26 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -70,11 +70,6 @@ enum rq_cmd_type_bits { | |||
70 | REQ_TYPE_ATA_PC, | 70 | REQ_TYPE_ATA_PC, |
71 | }; | 71 | }; |
72 | 72 | ||
73 | enum { | ||
74 | BLK_RW_ASYNC = 0, | ||
75 | BLK_RW_SYNC = 1, | ||
76 | }; | ||
77 | |||
78 | /* | 73 | /* |
79 | * For request of type REQ_TYPE_LINUX_BLOCK, rq->cmd[0] is the opcode being | 74 | * For request of type REQ_TYPE_LINUX_BLOCK, rq->cmd[0] is the opcode being |
80 | * sent down (similar to how REQ_TYPE_BLOCK_PC means that ->cmd[] holds a | 75 | * sent down (similar to how REQ_TYPE_BLOCK_PC means that ->cmd[] holds a |
@@ -723,6 +718,7 @@ struct rq_map_data { | |||
723 | int nr_entries; | 718 | int nr_entries; |
724 | unsigned long offset; | 719 | unsigned long offset; |
725 | int null_mapped; | 720 | int null_mapped; |
721 | int from_user; | ||
726 | }; | 722 | }; |
727 | 723 | ||
728 | struct req_iterator { | 724 | struct req_iterator { |
@@ -779,18 +775,18 @@ extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t, | |||
779 | * congested queues, and wake up anyone who was waiting for requests to be | 775 | * congested queues, and wake up anyone who was waiting for requests to be |
780 | * put back. | 776 | * put back. |
781 | */ | 777 | */ |
782 | static inline void blk_clear_queue_congested(struct request_queue *q, int rw) | 778 | static inline void blk_clear_queue_congested(struct request_queue *q, int sync) |
783 | { | 779 | { |
784 | clear_bdi_congested(&q->backing_dev_info, rw); | 780 | clear_bdi_congested(&q->backing_dev_info, sync); |
785 | } | 781 | } |
786 | 782 | ||
787 | /* | 783 | /* |
788 | * A queue has just entered congestion. Flag that in the queue's VM-visible | 784 | * A queue has just entered congestion. Flag that in the queue's VM-visible |
789 | * state flags and increment the global gounter of congested queues. | 785 | * state flags and increment the global gounter of congested queues. |
790 | */ | 786 | */ |
791 | static inline void blk_set_queue_congested(struct request_queue *q, int rw) | 787 | static inline void blk_set_queue_congested(struct request_queue *q, int sync) |
792 | { | 788 | { |
793 | set_bdi_congested(&q->backing_dev_info, rw); | 789 | set_bdi_congested(&q->backing_dev_info, sync); |
794 | } | 790 | } |
795 | 791 | ||
796 | extern void blk_start_queue(struct request_queue *q); | 792 | extern void blk_start_queue(struct request_queue *q); |
diff --git a/include/linux/crash_dump.h b/include/linux/crash_dump.h index 2dac064d8359..0026f267da20 100644 --- a/include/linux/crash_dump.h +++ b/include/linux/crash_dump.h | |||
@@ -3,7 +3,6 @@ | |||
3 | 3 | ||
4 | #ifdef CONFIG_CRASH_DUMP | 4 | #ifdef CONFIG_CRASH_DUMP |
5 | #include <linux/kexec.h> | 5 | #include <linux/kexec.h> |
6 | #include <linux/smp_lock.h> | ||
7 | #include <linux/device.h> | 6 | #include <linux/device.h> |
8 | #include <linux/proc_fs.h> | 7 | #include <linux/proc_fs.h> |
9 | 8 | ||
diff --git a/include/linux/device.h b/include/linux/device.h index ed4e39f2c423..aebb81036db2 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -25,8 +25,6 @@ | |||
25 | #include <asm/atomic.h> | 25 | #include <asm/atomic.h> |
26 | #include <asm/device.h> | 26 | #include <asm/device.h> |
27 | 27 | ||
28 | #define BUS_ID_SIZE 20 | ||
29 | |||
30 | struct device; | 28 | struct device; |
31 | struct device_private; | 29 | struct device_private; |
32 | struct device_driver; | 30 | struct device_driver; |
diff --git a/include/linux/elfcore.h b/include/linux/elfcore.h index 7605c5e9589f..00d6a68d0421 100644 --- a/include/linux/elfcore.h +++ b/include/linux/elfcore.h | |||
@@ -122,9 +122,10 @@ static inline void elf_core_copy_kernel_regs(elf_gregset_t *elfregs, struct pt_r | |||
122 | 122 | ||
123 | static inline int elf_core_copy_task_regs(struct task_struct *t, elf_gregset_t* elfregs) | 123 | static inline int elf_core_copy_task_regs(struct task_struct *t, elf_gregset_t* elfregs) |
124 | { | 124 | { |
125 | #ifdef ELF_CORE_COPY_TASK_REGS | 125 | #if defined (ELF_CORE_COPY_TASK_REGS) |
126 | |||
127 | return ELF_CORE_COPY_TASK_REGS(t, elfregs); | 126 | return ELF_CORE_COPY_TASK_REGS(t, elfregs); |
127 | #elif defined (task_pt_regs) | ||
128 | elf_core_copy_regs(elfregs, task_pt_regs(t)); | ||
128 | #endif | 129 | #endif |
129 | return 0; | 130 | return 0; |
130 | } | 131 | } |
diff --git a/include/linux/firewire.h b/include/linux/firewire.h index 9823946adbc5..192d1e43c43c 100644 --- a/include/linux/firewire.h +++ b/include/linux/firewire.h | |||
@@ -127,6 +127,7 @@ struct fw_card { | |||
127 | struct delayed_work work; | 127 | struct delayed_work work; |
128 | int bm_retries; | 128 | int bm_retries; |
129 | int bm_generation; | 129 | int bm_generation; |
130 | __be32 bm_transaction_data[2]; | ||
130 | 131 | ||
131 | bool broadcast_channel_allocated; | 132 | bool broadcast_channel_allocated; |
132 | u32 broadcast_channel; | 133 | u32 broadcast_channel; |
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h index 45257475623c..8246c697863d 100644 --- a/include/linux/hardirq.h +++ b/include/linux/hardirq.h | |||
@@ -2,7 +2,9 @@ | |||
2 | #define LINUX_HARDIRQ_H | 2 | #define LINUX_HARDIRQ_H |
3 | 3 | ||
4 | #include <linux/preempt.h> | 4 | #include <linux/preempt.h> |
5 | #ifdef CONFIG_PREEMPT | ||
5 | #include <linux/smp_lock.h> | 6 | #include <linux/smp_lock.h> |
7 | #endif | ||
6 | #include <linux/lockdep.h> | 8 | #include <linux/lockdep.h> |
7 | #include <linux/ftrace_irq.h> | 9 | #include <linux/ftrace_irq.h> |
8 | #include <asm/hardirq.h> | 10 | #include <asm/hardirq.h> |
diff --git a/include/linux/if_ether.h b/include/linux/if_ether.h index ae3a1871413d..70fdba2bbf71 100644 --- a/include/linux/if_ether.h +++ b/include/linux/if_ether.h | |||
@@ -78,6 +78,7 @@ | |||
78 | #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ | 78 | #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ |
79 | #define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ | 79 | #define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ |
80 | #define ETH_P_TIPC 0x88CA /* TIPC */ | 80 | #define ETH_P_TIPC 0x88CA /* TIPC */ |
81 | #define ETH_P_1588 0x88F7 /* IEEE 1588 Timesync */ | ||
81 | #define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */ | 82 | #define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */ |
82 | #define ETH_P_FIP 0x8914 /* FCoE Initialization Protocol */ | 83 | #define ETH_P_FIP 0x8914 /* FCoE Initialization Protocol */ |
83 | #define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ | 84 | #define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ |
diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h new file mode 100644 index 000000000000..7964516c6954 --- /dev/null +++ b/include/linux/input/matrix_keypad.h | |||
@@ -0,0 +1,65 @@ | |||
1 | #ifndef _MATRIX_KEYPAD_H | ||
2 | #define _MATRIX_KEYPAD_H | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include <linux/input.h> | ||
6 | |||
7 | #define MATRIX_MAX_ROWS 16 | ||
8 | #define MATRIX_MAX_COLS 16 | ||
9 | |||
10 | #define KEY(row, col, val) ((((row) & (MATRIX_MAX_ROWS - 1)) << 24) |\ | ||
11 | (((col) & (MATRIX_MAX_COLS - 1)) << 16) |\ | ||
12 | (val & 0xffff)) | ||
13 | |||
14 | #define KEY_ROW(k) (((k) >> 24) & 0xff) | ||
15 | #define KEY_COL(k) (((k) >> 16) & 0xff) | ||
16 | #define KEY_VAL(k) ((k) & 0xffff) | ||
17 | |||
18 | /** | ||
19 | * struct matrix_keymap_data - keymap for matrix keyboards | ||
20 | * @keymap: pointer to array of uint32 values encoded with KEY() macro | ||
21 | * representing keymap | ||
22 | * @keymap_size: number of entries (initialized) in this keymap | ||
23 | * @max_keymap_size: maximum size of keymap supported by the device | ||
24 | * | ||
25 | * This structure is supposed to be used by platform code to supply | ||
26 | * keymaps to drivers that implement matrix-like keypads/keyboards. | ||
27 | */ | ||
28 | struct matrix_keymap_data { | ||
29 | const uint32_t *keymap; | ||
30 | unsigned int keymap_size; | ||
31 | unsigned int max_keymap_size; | ||
32 | }; | ||
33 | |||
34 | /** | ||
35 | * struct matrix_keypad_platform_data - platform-dependent keypad data | ||
36 | * @keymap_data: pointer to &matrix_keymap_data | ||
37 | * @row_gpios: array of gpio numbers reporesenting rows | ||
38 | * @col_gpios: array of gpio numbers reporesenting colums | ||
39 | * @num_row_gpios: actual number of row gpios used by device | ||
40 | * @num_col_gpios: actual number of col gpios used by device | ||
41 | * @col_scan_delay_us: delay, measured in microseconds, that is | ||
42 | * needed before we can keypad after activating column gpio | ||
43 | * @debounce_ms: debounce interval in milliseconds | ||
44 | * | ||
45 | * This structure represents platform-specific data that use used by | ||
46 | * matrix_keypad driver to perform proper initialization. | ||
47 | */ | ||
48 | struct matrix_keypad_platform_data { | ||
49 | const struct matrix_keymap_data *keymap_data; | ||
50 | |||
51 | unsigned int row_gpios[MATRIX_MAX_ROWS]; | ||
52 | unsigned int col_gpios[MATRIX_MAX_COLS]; | ||
53 | unsigned int num_row_gpios; | ||
54 | unsigned int num_col_gpios; | ||
55 | |||
56 | unsigned int col_scan_delay_us; | ||
57 | |||
58 | /* key debounce interval in milli-second */ | ||
59 | unsigned int debounce_ms; | ||
60 | |||
61 | bool active_low; | ||
62 | bool wakeup; | ||
63 | }; | ||
64 | |||
65 | #endif /* _MATRIX_KEYPAD_H */ | ||
diff --git a/include/linux/kmemleak.h b/include/linux/kmemleak.h index 7796aed6cdd5..6a63807f714e 100644 --- a/include/linux/kmemleak.h +++ b/include/linux/kmemleak.h | |||
@@ -27,6 +27,7 @@ extern void kmemleak_init(void); | |||
27 | extern void kmemleak_alloc(const void *ptr, size_t size, int min_count, | 27 | extern void kmemleak_alloc(const void *ptr, size_t size, int min_count, |
28 | gfp_t gfp); | 28 | gfp_t gfp); |
29 | extern void kmemleak_free(const void *ptr); | 29 | extern void kmemleak_free(const void *ptr); |
30 | extern void kmemleak_free_part(const void *ptr, size_t size); | ||
30 | extern void kmemleak_padding(const void *ptr, unsigned long offset, | 31 | extern void kmemleak_padding(const void *ptr, unsigned long offset, |
31 | size_t size); | 32 | size_t size); |
32 | extern void kmemleak_not_leak(const void *ptr); | 33 | extern void kmemleak_not_leak(const void *ptr); |
@@ -71,6 +72,9 @@ static inline void kmemleak_alloc_recursive(const void *ptr, size_t size, | |||
71 | static inline void kmemleak_free(const void *ptr) | 72 | static inline void kmemleak_free(const void *ptr) |
72 | { | 73 | { |
73 | } | 74 | } |
75 | static inline void kmemleak_free_part(const void *ptr, size_t size) | ||
76 | { | ||
77 | } | ||
74 | static inline void kmemleak_free_recursive(const void *ptr, unsigned long flags) | 78 | static inline void kmemleak_free_recursive(const void *ptr, unsigned long flags) |
75 | { | 79 | { |
76 | } | 80 | } |
diff --git a/include/linux/mnt_namespace.h b/include/linux/mnt_namespace.h index 3beb2592b03f..d74785c2393a 100644 --- a/include/linux/mnt_namespace.h +++ b/include/linux/mnt_namespace.h | |||
@@ -2,10 +2,9 @@ | |||
2 | #define _NAMESPACE_H_ | 2 | #define _NAMESPACE_H_ |
3 | #ifdef __KERNEL__ | 3 | #ifdef __KERNEL__ |
4 | 4 | ||
5 | #include <linux/mount.h> | 5 | #include <linux/path.h> |
6 | #include <linux/sched.h> | ||
7 | #include <linux/nsproxy.h> | ||
8 | #include <linux/seq_file.h> | 6 | #include <linux/seq_file.h> |
7 | #include <linux/wait.h> | ||
9 | 8 | ||
10 | struct mnt_namespace { | 9 | struct mnt_namespace { |
11 | atomic_t count; | 10 | atomic_t count; |
@@ -28,14 +27,6 @@ extern struct mnt_namespace *create_mnt_ns(struct vfsmount *mnt); | |||
28 | extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *, | 27 | extern struct mnt_namespace *copy_mnt_ns(unsigned long, struct mnt_namespace *, |
29 | struct fs_struct *); | 28 | struct fs_struct *); |
30 | extern void put_mnt_ns(struct mnt_namespace *ns); | 29 | extern void put_mnt_ns(struct mnt_namespace *ns); |
31 | |||
32 | static inline void exit_mnt_ns(struct task_struct *p) | ||
33 | { | ||
34 | struct mnt_namespace *ns = p->nsproxy->mnt_ns; | ||
35 | if (ns) | ||
36 | put_mnt_ns(ns); | ||
37 | } | ||
38 | |||
39 | static inline void get_mnt_ns(struct mnt_namespace *ns) | 30 | static inline void get_mnt_ns(struct mnt_namespace *ns) |
40 | { | 31 | { |
41 | atomic_inc(&ns->count); | 32 | atomic_inc(&ns->count); |
diff --git a/include/linux/pci.h b/include/linux/pci.h index d304ddf412d0..115fb7ba5089 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -1145,7 +1145,7 @@ static inline void pci_set_drvdata(struct pci_dev *pdev, void *data) | |||
1145 | /* If you want to know what to call your pci_dev, ask this function. | 1145 | /* If you want to know what to call your pci_dev, ask this function. |
1146 | * Again, it's a wrapper around the generic device. | 1146 | * Again, it's a wrapper around the generic device. |
1147 | */ | 1147 | */ |
1148 | static inline const char *pci_name(struct pci_dev *pdev) | 1148 | static inline const char *pci_name(const struct pci_dev *pdev) |
1149 | { | 1149 | { |
1150 | return dev_name(&pdev->dev); | 1150 | return dev_name(&pdev->dev); |
1151 | } | 1151 | } |
diff --git a/include/linux/personality.h b/include/linux/personality.h index a84e9ff9b27e..126120819a0d 100644 --- a/include/linux/personality.h +++ b/include/linux/personality.h | |||
@@ -40,7 +40,10 @@ enum { | |||
40 | * Security-relevant compatibility flags that must be | 40 | * Security-relevant compatibility flags that must be |
41 | * cleared upon setuid or setgid exec: | 41 | * cleared upon setuid or setgid exec: |
42 | */ | 42 | */ |
43 | #define PER_CLEAR_ON_SETID (READ_IMPLIES_EXEC|ADDR_NO_RANDOMIZE) | 43 | #define PER_CLEAR_ON_SETID (READ_IMPLIES_EXEC | \ |
44 | ADDR_NO_RANDOMIZE | \ | ||
45 | ADDR_COMPAT_LAYOUT | \ | ||
46 | MMAP_PAGE_ZERO) | ||
44 | 47 | ||
45 | /* | 48 | /* |
46 | * Personality types. | 49 | * Personality types. |
diff --git a/include/linux/quotaops.h b/include/linux/quotaops.h index 7bc457593684..26361c4c037a 100644 --- a/include/linux/quotaops.h +++ b/include/linux/quotaops.h | |||
@@ -7,7 +7,6 @@ | |||
7 | #ifndef _LINUX_QUOTAOPS_ | 7 | #ifndef _LINUX_QUOTAOPS_ |
8 | #define _LINUX_QUOTAOPS_ | 8 | #define _LINUX_QUOTAOPS_ |
9 | 9 | ||
10 | #include <linux/smp_lock.h> | ||
11 | #include <linux/fs.h> | 10 | #include <linux/fs.h> |
12 | 11 | ||
13 | static inline struct quota_info *sb_dqopt(struct super_block *sb) | 12 | static inline struct quota_info *sb_dqopt(struct super_block *sb) |
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h index e73e2429a1b1..2ce29831feb6 100644 --- a/include/linux/rfkill.h +++ b/include/linux/rfkill.h | |||
@@ -99,7 +99,6 @@ enum rfkill_user_states { | |||
99 | #undef RFKILL_STATE_UNBLOCKED | 99 | #undef RFKILL_STATE_UNBLOCKED |
100 | #undef RFKILL_STATE_HARD_BLOCKED | 100 | #undef RFKILL_STATE_HARD_BLOCKED |
101 | 101 | ||
102 | #include <linux/types.h> | ||
103 | #include <linux/kernel.h> | 102 | #include <linux/kernel.h> |
104 | #include <linux/list.h> | 103 | #include <linux/list.h> |
105 | #include <linux/mutex.h> | 104 | #include <linux/mutex.h> |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 0085d758d645..16a982e389fb 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -498,6 +498,15 @@ struct task_cputime { | |||
498 | .sum_exec_runtime = 0, \ | 498 | .sum_exec_runtime = 0, \ |
499 | } | 499 | } |
500 | 500 | ||
501 | /* | ||
502 | * Disable preemption until the scheduler is running. | ||
503 | * Reset by start_kernel()->sched_init()->init_idle(). | ||
504 | * | ||
505 | * We include PREEMPT_ACTIVE to avoid cond_resched() from working | ||
506 | * before the scheduler is active -- see should_resched(). | ||
507 | */ | ||
508 | #define INIT_PREEMPT_COUNT (1 + PREEMPT_ACTIVE) | ||
509 | |||
501 | /** | 510 | /** |
502 | * struct thread_group_cputimer - thread group interval timer counts | 511 | * struct thread_group_cputimer - thread group interval timer counts |
503 | * @cputime: thread group interval timers. | 512 | * @cputime: thread group interval timers. |
diff --git a/include/linux/slub_def.h b/include/linux/slub_def.h index 4dcbc2c71491..c1c862b1d01a 100644 --- a/include/linux/slub_def.h +++ b/include/linux/slub_def.h | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/workqueue.h> | 11 | #include <linux/workqueue.h> |
12 | #include <linux/kobject.h> | 12 | #include <linux/kobject.h> |
13 | #include <linux/kmemtrace.h> | 13 | #include <linux/kmemtrace.h> |
14 | #include <linux/kmemleak.h> | ||
14 | 15 | ||
15 | enum stat_item { | 16 | enum stat_item { |
16 | ALLOC_FASTPATH, /* Allocation from cpu slab */ | 17 | ALLOC_FASTPATH, /* Allocation from cpu slab */ |
@@ -233,6 +234,7 @@ static __always_inline void *kmalloc_large(size_t size, gfp_t flags) | |||
233 | unsigned int order = get_order(size); | 234 | unsigned int order = get_order(size); |
234 | void *ret = (void *) __get_free_pages(flags | __GFP_COMP, order); | 235 | void *ret = (void *) __get_free_pages(flags | __GFP_COMP, order); |
235 | 236 | ||
237 | kmemleak_alloc(ret, size, 1, flags); | ||
236 | trace_kmalloc(_THIS_IP_, ret, size, PAGE_SIZE << order, flags); | 238 | trace_kmalloc(_THIS_IP_, ret, size, PAGE_SIZE << order, flags); |
237 | 239 | ||
238 | return ret; | 240 | return ret; |
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index 252b245cfcf4..4be57ab03478 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h | |||
@@ -132,6 +132,11 @@ do { \ | |||
132 | #endif /*__raw_spin_is_contended*/ | 132 | #endif /*__raw_spin_is_contended*/ |
133 | #endif | 133 | #endif |
134 | 134 | ||
135 | /* The lock does not imply full memory barrier. */ | ||
136 | #ifndef ARCH_HAS_SMP_MB_AFTER_LOCK | ||
137 | static inline void smp_mb__after_lock(void) { smp_mb(); } | ||
138 | #endif | ||
139 | |||
135 | /** | 140 | /** |
136 | * spin_unlock_wait - wait until the spinlock gets unlocked | 141 | * spin_unlock_wait - wait until the spinlock gets unlocked |
137 | * @lock: the spinlock in question. | 142 | * @lock: the spinlock in question. |
diff --git a/include/linux/sunrpc/xdr.h b/include/linux/sunrpc/xdr.h index d8910b68e1bd..b99c625fddfe 100644 --- a/include/linux/sunrpc/xdr.h +++ b/include/linux/sunrpc/xdr.h | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/uio.h> | 12 | #include <linux/uio.h> |
13 | #include <asm/byteorder.h> | 13 | #include <asm/byteorder.h> |
14 | #include <linux/scatterlist.h> | 14 | #include <linux/scatterlist.h> |
15 | #include <linux/smp_lock.h> | ||
16 | 15 | ||
17 | /* | 16 | /* |
18 | * Buffer adjustment | 17 | * Buffer adjustment |
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index fa4242cdade8..80de7003d8c2 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -321,6 +321,8 @@ asmlinkage long sys_rt_sigtimedwait(const sigset_t __user *uthese, | |||
321 | siginfo_t __user *uinfo, | 321 | siginfo_t __user *uinfo, |
322 | const struct timespec __user *uts, | 322 | const struct timespec __user *uts, |
323 | size_t sigsetsize); | 323 | size_t sigsetsize); |
324 | asmlinkage long sys_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, | ||
325 | siginfo_t __user *uinfo); | ||
324 | asmlinkage long sys_kill(int pid, int sig); | 326 | asmlinkage long sys_kill(int pid, int sig); |
325 | asmlinkage long sys_tgkill(int tgid, int pid, int sig); | 327 | asmlinkage long sys_tgkill(int tgid, int pid, int sig); |
326 | asmlinkage long sys_tkill(int pid, int sig); | 328 | asmlinkage long sys_tkill(int pid, int sig); |
diff --git a/include/linux/sysrq.h b/include/linux/sysrq.h index 98a1d8cfb73d..99adcdc0d3ca 100644 --- a/include/linux/sysrq.h +++ b/include/linux/sysrq.h | |||
@@ -14,6 +14,8 @@ | |||
14 | #ifndef _LINUX_SYSRQ_H | 14 | #ifndef _LINUX_SYSRQ_H |
15 | #define _LINUX_SYSRQ_H | 15 | #define _LINUX_SYSRQ_H |
16 | 16 | ||
17 | #include <linux/errno.h> | ||
18 | |||
17 | struct pt_regs; | 19 | struct pt_regs; |
18 | struct tty_struct; | 20 | struct tty_struct; |
19 | 21 | ||
diff --git a/include/linux/usb.h b/include/linux/usb.h index 84929e914034..b1e3c2fbfe11 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -888,8 +888,6 @@ struct usb_driver { | |||
888 | * struct usb_device_driver - identifies USB device driver to usbcore | 888 | * struct usb_device_driver - identifies USB device driver to usbcore |
889 | * @name: The driver name should be unique among USB drivers, | 889 | * @name: The driver name should be unique among USB drivers, |
890 | * and should normally be the same as the module name. | 890 | * and should normally be the same as the module name. |
891 | * @nodename: Callback to provide a naming hint for a possible | ||
892 | * device node to create. | ||
893 | * @probe: Called to see if the driver is willing to manage a particular | 891 | * @probe: Called to see if the driver is willing to manage a particular |
894 | * device. If it is, probe returns zero and uses dev_set_drvdata() | 892 | * device. If it is, probe returns zero and uses dev_set_drvdata() |
895 | * to associate driver-specific data with the device. If unwilling | 893 | * to associate driver-specific data with the device. If unwilling |
@@ -924,6 +922,8 @@ extern struct bus_type usb_bus_type; | |||
924 | /** | 922 | /** |
925 | * struct usb_class_driver - identifies a USB driver that wants to use the USB major number | 923 | * struct usb_class_driver - identifies a USB driver that wants to use the USB major number |
926 | * @name: the usb class device name for this driver. Will show up in sysfs. | 924 | * @name: the usb class device name for this driver. Will show up in sysfs. |
925 | * @nodename: Callback to provide a naming hint for a possible | ||
926 | * device node to create. | ||
927 | * @fops: pointer to the struct file_operations of this driver. | 927 | * @fops: pointer to the struct file_operations of this driver. |
928 | * @minor_base: the start of the minor range for this driver. | 928 | * @minor_base: the start of the minor range for this driver. |
929 | * | 929 | * |
@@ -1046,6 +1046,8 @@ typedef void (*usb_complete_t)(struct urb *); | |||
1046 | * the device driver is saying that it provided this DMA address, | 1046 | * the device driver is saying that it provided this DMA address, |
1047 | * which the host controller driver should use in preference to the | 1047 | * which the host controller driver should use in preference to the |
1048 | * transfer_buffer. | 1048 | * transfer_buffer. |
1049 | * @sg: scatter gather buffer list | ||
1050 | * @num_sgs: number of entries in the sg list | ||
1049 | * @transfer_buffer_length: How big is transfer_buffer. The transfer may | 1051 | * @transfer_buffer_length: How big is transfer_buffer. The transfer may |
1050 | * be broken up into chunks according to the current maximum packet | 1052 | * be broken up into chunks according to the current maximum packet |
1051 | * size for the endpoint, which is a function of the configuration | 1053 | * size for the endpoint, which is a function of the configuration |
diff --git a/include/linux/usb/langwell_otg.h b/include/linux/usb/langwell_otg.h deleted file mode 100644 index e115ae6df1da..000000000000 --- a/include/linux/usb/langwell_otg.h +++ /dev/null | |||
@@ -1,177 +0,0 @@ | |||
1 | /* | ||
2 | * Intel Langwell USB OTG transceiver driver | ||
3 | * Copyright (C) 2008, Intel Corporation. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify it | ||
6 | * under the terms and conditions of the GNU General Public License, | ||
7 | * version 2, as published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
12 | * more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License along with | ||
15 | * this program; if not, write to the Free Software Foundation, Inc., | ||
16 | * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. | ||
17 | * | ||
18 | */ | ||
19 | |||
20 | #ifndef __LANGWELL_OTG_H__ | ||
21 | #define __LANGWELL_OTG_H__ | ||
22 | |||
23 | /* notify transceiver driver about OTG events */ | ||
24 | extern void langwell_update_transceiver(void); | ||
25 | /* HCD register bus driver */ | ||
26 | extern int langwell_register_host(struct pci_driver *host_driver); | ||
27 | /* HCD unregister bus driver */ | ||
28 | extern void langwell_unregister_host(struct pci_driver *host_driver); | ||
29 | /* DCD register bus driver */ | ||
30 | extern int langwell_register_peripheral(struct pci_driver *client_driver); | ||
31 | /* DCD unregister bus driver */ | ||
32 | extern void langwell_unregister_peripheral(struct pci_driver *client_driver); | ||
33 | /* No silent failure, output warning message */ | ||
34 | extern void langwell_otg_nsf_msg(unsigned long message); | ||
35 | |||
36 | #define CI_USBCMD 0x30 | ||
37 | # define USBCMD_RST BIT(1) | ||
38 | # define USBCMD_RS BIT(0) | ||
39 | #define CI_USBSTS 0x34 | ||
40 | # define USBSTS_SLI BIT(8) | ||
41 | # define USBSTS_URI BIT(6) | ||
42 | # define USBSTS_PCI BIT(2) | ||
43 | #define CI_PORTSC1 0x74 | ||
44 | # define PORTSC_PP BIT(12) | ||
45 | # define PORTSC_LS (BIT(11) | BIT(10)) | ||
46 | # define PORTSC_SUSP BIT(7) | ||
47 | # define PORTSC_CCS BIT(0) | ||
48 | #define CI_HOSTPC1 0xb4 | ||
49 | # define HOSTPC1_PHCD BIT(22) | ||
50 | #define CI_OTGSC 0xf4 | ||
51 | # define OTGSC_DPIE BIT(30) | ||
52 | # define OTGSC_1MSE BIT(29) | ||
53 | # define OTGSC_BSEIE BIT(28) | ||
54 | # define OTGSC_BSVIE BIT(27) | ||
55 | # define OTGSC_ASVIE BIT(26) | ||
56 | # define OTGSC_AVVIE BIT(25) | ||
57 | # define OTGSC_IDIE BIT(24) | ||
58 | # define OTGSC_DPIS BIT(22) | ||
59 | # define OTGSC_1MSS BIT(21) | ||
60 | # define OTGSC_BSEIS BIT(20) | ||
61 | # define OTGSC_BSVIS BIT(19) | ||
62 | # define OTGSC_ASVIS BIT(18) | ||
63 | # define OTGSC_AVVIS BIT(17) | ||
64 | # define OTGSC_IDIS BIT(16) | ||
65 | # define OTGSC_DPS BIT(14) | ||
66 | # define OTGSC_1MST BIT(13) | ||
67 | # define OTGSC_BSE BIT(12) | ||
68 | # define OTGSC_BSV BIT(11) | ||
69 | # define OTGSC_ASV BIT(10) | ||
70 | # define OTGSC_AVV BIT(9) | ||
71 | # define OTGSC_ID BIT(8) | ||
72 | # define OTGSC_HABA BIT(7) | ||
73 | # define OTGSC_HADP BIT(6) | ||
74 | # define OTGSC_IDPU BIT(5) | ||
75 | # define OTGSC_DP BIT(4) | ||
76 | # define OTGSC_OT BIT(3) | ||
77 | # define OTGSC_HAAR BIT(2) | ||
78 | # define OTGSC_VC BIT(1) | ||
79 | # define OTGSC_VD BIT(0) | ||
80 | # define OTGSC_INTEN_MASK (0x7f << 24) | ||
81 | # define OTGSC_INTSTS_MASK (0x7f << 16) | ||
82 | #define CI_USBMODE 0xf8 | ||
83 | # define USBMODE_CM (BIT(1) | BIT(0)) | ||
84 | # define USBMODE_IDLE 0 | ||
85 | # define USBMODE_DEVICE 0x2 | ||
86 | # define USBMODE_HOST 0x3 | ||
87 | |||
88 | #define INTR_DUMMY_MASK (USBSTS_SLI | USBSTS_URI | USBSTS_PCI) | ||
89 | |||
90 | struct otg_hsm { | ||
91 | /* Input */ | ||
92 | int a_bus_resume; | ||
93 | int a_bus_suspend; | ||
94 | int a_conn; | ||
95 | int a_sess_vld; | ||
96 | int a_srp_det; | ||
97 | int a_vbus_vld; | ||
98 | int b_bus_resume; | ||
99 | int b_bus_suspend; | ||
100 | int b_conn; | ||
101 | int b_se0_srp; | ||
102 | int b_sess_end; | ||
103 | int b_sess_vld; | ||
104 | int id; | ||
105 | |||
106 | /* Internal variables */ | ||
107 | int a_set_b_hnp_en; | ||
108 | int b_srp_done; | ||
109 | int b_hnp_enable; | ||
110 | |||
111 | /* Timeout indicator for timers */ | ||
112 | int a_wait_vrise_tmout; | ||
113 | int a_wait_bcon_tmout; | ||
114 | int a_aidl_bdis_tmout; | ||
115 | int b_ase0_brst_tmout; | ||
116 | int b_bus_suspend_tmout; | ||
117 | int b_srp_res_tmout; | ||
118 | |||
119 | /* Informative variables */ | ||
120 | int a_bus_drop; | ||
121 | int a_bus_req; | ||
122 | int a_clr_err; | ||
123 | int a_suspend_req; | ||
124 | int b_bus_req; | ||
125 | |||
126 | /* Output */ | ||
127 | int drv_vbus; | ||
128 | int loc_conn; | ||
129 | int loc_sof; | ||
130 | |||
131 | /* Others */ | ||
132 | int b_bus_suspend_vld; | ||
133 | }; | ||
134 | |||
135 | #define TA_WAIT_VRISE 100 | ||
136 | #define TA_WAIT_BCON 30000 | ||
137 | #define TA_AIDL_BDIS 15000 | ||
138 | #define TB_ASE0_BRST 5000 | ||
139 | #define TB_SE0_SRP 2 | ||
140 | #define TB_SRP_RES 100 | ||
141 | #define TB_BUS_SUSPEND 500 | ||
142 | |||
143 | struct langwell_otg_timer { | ||
144 | unsigned long expires; /* Number of count increase to timeout */ | ||
145 | unsigned long count; /* Tick counter */ | ||
146 | void (*function)(unsigned long); /* Timeout function */ | ||
147 | unsigned long data; /* Data passed to function */ | ||
148 | struct list_head list; | ||
149 | }; | ||
150 | |||
151 | struct langwell_otg { | ||
152 | struct otg_transceiver otg; | ||
153 | struct otg_hsm hsm; | ||
154 | void __iomem *regs; | ||
155 | unsigned region; | ||
156 | struct pci_driver *host_ops; | ||
157 | struct pci_driver *client_ops; | ||
158 | struct pci_dev *pdev; | ||
159 | struct work_struct work; | ||
160 | struct workqueue_struct *qwork; | ||
161 | spinlock_t lock; | ||
162 | spinlock_t wq_lock; | ||
163 | }; | ||
164 | |||
165 | static inline struct langwell_otg *otg_to_langwell(struct otg_transceiver *otg) | ||
166 | { | ||
167 | return container_of(otg, struct langwell_otg, otg); | ||
168 | } | ||
169 | |||
170 | #ifdef DEBUG | ||
171 | #define otg_dbg(fmt, args...) \ | ||
172 | printk(KERN_DEBUG fmt , ## args) | ||
173 | #else | ||
174 | #define otg_dbg(fmt, args...) \ | ||
175 | do { } while (0) | ||
176 | #endif /* DEBUG */ | ||
177 | #endif /* __LANGWELL_OTG_H__ */ | ||
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h index 44801d26a37a..0ec50ba62139 100644 --- a/include/linux/usb/serial.h +++ b/include/linux/usb/serial.h | |||
@@ -317,7 +317,8 @@ extern int usb_serial_generic_register(int debug); | |||
317 | extern void usb_serial_generic_deregister(void); | 317 | extern void usb_serial_generic_deregister(void); |
318 | extern void usb_serial_generic_resubmit_read_urb(struct usb_serial_port *port, | 318 | extern void usb_serial_generic_resubmit_read_urb(struct usb_serial_port *port, |
319 | gfp_t mem_flags); | 319 | gfp_t mem_flags); |
320 | extern int usb_serial_handle_sysrq_char(struct usb_serial_port *port, | 320 | extern int usb_serial_handle_sysrq_char(struct tty_struct *tty, |
321 | struct usb_serial_port *port, | ||
321 | unsigned int ch); | 322 | unsigned int ch); |
322 | extern int usb_serial_handle_break(struct usb_serial_port *port); | 323 | extern int usb_serial_handle_break(struct usb_serial_port *port); |
323 | 324 | ||
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 8a025d510904..95846d988011 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
@@ -318,6 +318,8 @@ struct v4l2_pix_format { | |||
318 | /* see http://www.siliconimaging.com/RGB%20Bayer.htm */ | 318 | /* see http://www.siliconimaging.com/RGB%20Bayer.htm */ |
319 | #define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */ | 319 | #define V4L2_PIX_FMT_SBGGR8 v4l2_fourcc('B', 'A', '8', '1') /* 8 BGBG.. GRGR.. */ |
320 | #define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */ | 320 | #define V4L2_PIX_FMT_SGBRG8 v4l2_fourcc('G', 'B', 'R', 'G') /* 8 GBGB.. RGRG.. */ |
321 | #define V4L2_PIX_FMT_SGRBG8 v4l2_fourcc('G', 'R', 'B', 'G') /* 8 GRGR.. BGBG.. */ | ||
322 | |||
321 | /* | 323 | /* |
322 | * 10bit raw bayer, expanded to 16 bits | 324 | * 10bit raw bayer, expanded to 16 bits |
323 | * xxxxrrrrrrrrrrxxxxgggggggggg xxxxggggggggggxxxxbbbbbbbbbb... | 325 | * xxxxrrrrrrrrrrxxxxgggggggggg xxxxggggggggggxxxxbbbbbbbbbb... |
diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h index 4d7e2272c42f..11a4a2d3e364 100644 --- a/include/media/v4l2-chip-ident.h +++ b/include/media/v4l2-chip-ident.h | |||
@@ -155,6 +155,9 @@ enum { | |||
155 | /* module cafe_ccic, just ident 8801 */ | 155 | /* module cafe_ccic, just ident 8801 */ |
156 | V4L2_IDENT_CAFE = 8801, | 156 | V4L2_IDENT_CAFE = 8801, |
157 | 157 | ||
158 | /* module mt9v011, just ident 8243 */ | ||
159 | V4L2_IDENT_MT9V011 = 8243, | ||
160 | |||
158 | /* module tw9910: just ident 9910 */ | 161 | /* module tw9910: just ident 9910 */ |
159 | V4L2_IDENT_TW9910 = 9910, | 162 | V4L2_IDENT_TW9910 = 9910, |
160 | 163 | ||
diff --git a/include/net/sock.h b/include/net/sock.h index 352f06bbd7a9..2c0da9239b95 100644 --- a/include/net/sock.h +++ b/include/net/sock.h | |||
@@ -54,6 +54,7 @@ | |||
54 | 54 | ||
55 | #include <linux/filter.h> | 55 | #include <linux/filter.h> |
56 | #include <linux/rculist_nulls.h> | 56 | #include <linux/rculist_nulls.h> |
57 | #include <linux/poll.h> | ||
57 | 58 | ||
58 | #include <asm/atomic.h> | 59 | #include <asm/atomic.h> |
59 | #include <net/dst.h> | 60 | #include <net/dst.h> |
@@ -1241,6 +1242,74 @@ static inline int sk_has_allocations(const struct sock *sk) | |||
1241 | return sk_wmem_alloc_get(sk) || sk_rmem_alloc_get(sk); | 1242 | return sk_wmem_alloc_get(sk) || sk_rmem_alloc_get(sk); |
1242 | } | 1243 | } |
1243 | 1244 | ||
1245 | /** | ||
1246 | * sk_has_sleeper - check if there are any waiting processes | ||
1247 | * @sk: socket | ||
1248 | * | ||
1249 | * Returns true if socket has waiting processes | ||
1250 | * | ||
1251 | * The purpose of the sk_has_sleeper and sock_poll_wait is to wrap the memory | ||
1252 | * barrier call. They were added due to the race found within the tcp code. | ||
1253 | * | ||
1254 | * Consider following tcp code paths: | ||
1255 | * | ||
1256 | * CPU1 CPU2 | ||
1257 | * | ||
1258 | * sys_select receive packet | ||
1259 | * ... ... | ||
1260 | * __add_wait_queue update tp->rcv_nxt | ||
1261 | * ... ... | ||
1262 | * tp->rcv_nxt check sock_def_readable | ||
1263 | * ... { | ||
1264 | * schedule ... | ||
1265 | * if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) | ||
1266 | * wake_up_interruptible(sk->sk_sleep) | ||
1267 | * ... | ||
1268 | * } | ||
1269 | * | ||
1270 | * The race for tcp fires when the __add_wait_queue changes done by CPU1 stay | ||
1271 | * in its cache, and so does the tp->rcv_nxt update on CPU2 side. The CPU1 | ||
1272 | * could then endup calling schedule and sleep forever if there are no more | ||
1273 | * data on the socket. | ||
1274 | * | ||
1275 | * The sk_has_sleeper is always called right after a call to read_lock, so we | ||
1276 | * can use smp_mb__after_lock barrier. | ||
1277 | */ | ||
1278 | static inline int sk_has_sleeper(struct sock *sk) | ||
1279 | { | ||
1280 | /* | ||
1281 | * We need to be sure we are in sync with the | ||
1282 | * add_wait_queue modifications to the wait queue. | ||
1283 | * | ||
1284 | * This memory barrier is paired in the sock_poll_wait. | ||
1285 | */ | ||
1286 | smp_mb__after_lock(); | ||
1287 | return sk->sk_sleep && waitqueue_active(sk->sk_sleep); | ||
1288 | } | ||
1289 | |||
1290 | /** | ||
1291 | * sock_poll_wait - place memory barrier behind the poll_wait call. | ||
1292 | * @filp: file | ||
1293 | * @wait_address: socket wait queue | ||
1294 | * @p: poll_table | ||
1295 | * | ||
1296 | * See the comments in the sk_has_sleeper function. | ||
1297 | */ | ||
1298 | static inline void sock_poll_wait(struct file *filp, | ||
1299 | wait_queue_head_t *wait_address, poll_table *p) | ||
1300 | { | ||
1301 | if (p && wait_address) { | ||
1302 | poll_wait(filp, wait_address, p); | ||
1303 | /* | ||
1304 | * We need to be sure we are in sync with the | ||
1305 | * socket flags modification. | ||
1306 | * | ||
1307 | * This memory barrier is paired in the sk_has_sleeper. | ||
1308 | */ | ||
1309 | smp_mb(); | ||
1310 | } | ||
1311 | } | ||
1312 | |||
1244 | /* | 1313 | /* |
1245 | * Queue a received datagram if it will fit. Stream and sequenced | 1314 | * Queue a received datagram if it will fit. Stream and sequenced |
1246 | * protocols can't normally use this as they need to fit buffers in | 1315 | * protocols can't normally use this as they need to fit buffers in |
diff --git a/kernel/exit.c b/kernel/exit.c index 628d41f0dd54..869dc221733e 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/completion.h> | 12 | #include <linux/completion.h> |
13 | #include <linux/personality.h> | 13 | #include <linux/personality.h> |
14 | #include <linux/tty.h> | 14 | #include <linux/tty.h> |
15 | #include <linux/mnt_namespace.h> | ||
16 | #include <linux/iocontext.h> | 15 | #include <linux/iocontext.h> |
17 | #include <linux/key.h> | 16 | #include <linux/key.h> |
18 | #include <linux/security.h> | 17 | #include <linux/security.h> |
diff --git a/kernel/fork.c b/kernel/fork.c index 467746b3f0aa..bd2959228871 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -17,7 +17,6 @@ | |||
17 | #include <linux/module.h> | 17 | #include <linux/module.h> |
18 | #include <linux/vmalloc.h> | 18 | #include <linux/vmalloc.h> |
19 | #include <linux/completion.h> | 19 | #include <linux/completion.h> |
20 | #include <linux/mnt_namespace.h> | ||
21 | #include <linux/personality.h> | 20 | #include <linux/personality.h> |
22 | #include <linux/mempolicy.h> | 21 | #include <linux/mempolicy.h> |
23 | #include <linux/sem.h> | 22 | #include <linux/sem.h> |
diff --git a/kernel/kmod.c b/kernel/kmod.c index 7e95bedb2bfc..385c31a1bdbf 100644 --- a/kernel/kmod.c +++ b/kernel/kmod.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <linux/unistd.h> | 24 | #include <linux/unistd.h> |
25 | #include <linux/kmod.h> | 25 | #include <linux/kmod.h> |
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/mnt_namespace.h> | ||
28 | #include <linux/completion.h> | 27 | #include <linux/completion.h> |
29 | #include <linux/file.h> | 28 | #include <linux/file.h> |
30 | #include <linux/fdtable.h> | 29 | #include <linux/fdtable.h> |
diff --git a/kernel/kprobes.c b/kernel/kprobes.c index c0fa54b276d9..16b5739c516a 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c | |||
@@ -237,13 +237,9 @@ static int __kprobes collect_garbage_slots(void) | |||
237 | { | 237 | { |
238 | struct kprobe_insn_page *kip; | 238 | struct kprobe_insn_page *kip; |
239 | struct hlist_node *pos, *next; | 239 | struct hlist_node *pos, *next; |
240 | int safety; | ||
241 | 240 | ||
242 | /* Ensure no-one is preepmted on the garbages */ | 241 | /* Ensure no-one is preepmted on the garbages */ |
243 | mutex_unlock(&kprobe_insn_mutex); | 242 | if (check_safety()) |
244 | safety = check_safety(); | ||
245 | mutex_lock(&kprobe_insn_mutex); | ||
246 | if (safety != 0) | ||
247 | return -EAGAIN; | 243 | return -EAGAIN; |
248 | 244 | ||
249 | hlist_for_each_entry_safe(kip, pos, next, &kprobe_insn_pages, hlist) { | 245 | hlist_for_each_entry_safe(kip, pos, next, &kprobe_insn_pages, hlist) { |
diff --git a/kernel/module.c b/kernel/module.c index 38928fcaff2b..0a049837008e 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -2451,9 +2451,9 @@ SYSCALL_DEFINE3(init_module, void __user *, umod, | |||
2451 | return ret; | 2451 | return ret; |
2452 | } | 2452 | } |
2453 | if (ret > 0) { | 2453 | if (ret > 0) { |
2454 | printk(KERN_WARNING "%s: '%s'->init suspiciously returned %d, " | 2454 | printk(KERN_WARNING |
2455 | "it should follow 0/-E convention\n" | 2455 | "%s: '%s'->init suspiciously returned %d, it should follow 0/-E convention\n" |
2456 | KERN_WARNING "%s: loading module anyway...\n", | 2456 | "%s: loading module anyway...\n", |
2457 | __func__, mod->name, ret, | 2457 | __func__, mod->name, ret, |
2458 | __func__); | 2458 | __func__); |
2459 | dump_stack(); | 2459 | dump_stack(); |
diff --git a/kernel/perf_counter.c b/kernel/perf_counter.c index d55a50da2347..a641eb753b8c 100644 --- a/kernel/perf_counter.c +++ b/kernel/perf_counter.c | |||
@@ -2020,7 +2020,7 @@ fail: | |||
2020 | 2020 | ||
2021 | static void perf_mmap_free_page(unsigned long addr) | 2021 | static void perf_mmap_free_page(unsigned long addr) |
2022 | { | 2022 | { |
2023 | struct page *page = virt_to_page(addr); | 2023 | struct page *page = virt_to_page((void *)addr); |
2024 | 2024 | ||
2025 | page->mapping = NULL; | 2025 | page->mapping = NULL; |
2026 | __free_page(page); | 2026 | __free_page(page); |
diff --git a/kernel/pid.c b/kernel/pid.c index 5fa1db48d8b7..31310b5d3f50 100644 --- a/kernel/pid.c +++ b/kernel/pid.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include <linux/pid_namespace.h> | 36 | #include <linux/pid_namespace.h> |
37 | #include <linux/init_task.h> | 37 | #include <linux/init_task.h> |
38 | #include <linux/syscalls.h> | 38 | #include <linux/syscalls.h> |
39 | #include <linux/kmemleak.h> | ||
40 | 39 | ||
41 | #define pid_hashfn(nr, ns) \ | 40 | #define pid_hashfn(nr, ns) \ |
42 | hash_long((unsigned long)nr + (unsigned long)ns, pidhash_shift) | 41 | hash_long((unsigned long)nr + (unsigned long)ns, pidhash_shift) |
@@ -513,12 +512,6 @@ void __init pidhash_init(void) | |||
513 | pid_hash = alloc_bootmem(pidhash_size * sizeof(*(pid_hash))); | 512 | pid_hash = alloc_bootmem(pidhash_size * sizeof(*(pid_hash))); |
514 | if (!pid_hash) | 513 | if (!pid_hash) |
515 | panic("Could not alloc pidhash!\n"); | 514 | panic("Could not alloc pidhash!\n"); |
516 | /* | ||
517 | * pid_hash contains references to allocated struct pid objects and it | ||
518 | * must be scanned by kmemleak to avoid false positives. | ||
519 | */ | ||
520 | kmemleak_alloc(pid_hash, pidhash_size * sizeof(*(pid_hash)), 0, | ||
521 | GFP_KERNEL); | ||
522 | for (i = 0; i < pidhash_size; i++) | 515 | for (i = 0; i < pidhash_size; i++) |
523 | INIT_HLIST_HEAD(&pid_hash[i]); | 516 | INIT_HLIST_HEAD(&pid_hash[i]); |
524 | } | 517 | } |
diff --git a/kernel/power/user.c b/kernel/power/user.c index ed97375daae9..bf0014d6a5f0 100644 --- a/kernel/power/user.c +++ b/kernel/power/user.c | |||
@@ -23,7 +23,6 @@ | |||
23 | #include <linux/console.h> | 23 | #include <linux/console.h> |
24 | #include <linux/cpu.h> | 24 | #include <linux/cpu.h> |
25 | #include <linux/freezer.h> | 25 | #include <linux/freezer.h> |
26 | #include <linux/smp_lock.h> | ||
27 | #include <scsi/scsi_scan.h> | 26 | #include <scsi/scsi_scan.h> |
28 | 27 | ||
29 | #include <asm/uaccess.h> | 28 | #include <asm/uaccess.h> |
diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 61c78b2c07ba..082c320e4dbf 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c | |||
@@ -181,8 +181,8 @@ int ptrace_attach(struct task_struct *task) | |||
181 | * interference; SUID, SGID and LSM creds get determined differently | 181 | * interference; SUID, SGID and LSM creds get determined differently |
182 | * under ptrace. | 182 | * under ptrace. |
183 | */ | 183 | */ |
184 | retval = mutex_lock_interruptible(&task->cred_guard_mutex); | 184 | retval = -ERESTARTNOINTR; |
185 | if (retval < 0) | 185 | if (mutex_lock_interruptible(&task->cred_guard_mutex)) |
186 | goto out; | 186 | goto out; |
187 | 187 | ||
188 | task_lock(task); | 188 | task_lock(task); |
diff --git a/kernel/rcutree.c b/kernel/rcutree.c index 0dccfbba6d26..7717b95c2027 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c | |||
@@ -1533,7 +1533,7 @@ void __init __rcu_init(void) | |||
1533 | int j; | 1533 | int j; |
1534 | struct rcu_node *rnp; | 1534 | struct rcu_node *rnp; |
1535 | 1535 | ||
1536 | printk(KERN_WARNING "Experimental hierarchical RCU implementation.\n"); | 1536 | printk(KERN_INFO "Hierarchical RCU implementation.\n"); |
1537 | #ifdef CONFIG_RCU_CPU_STALL_DETECTOR | 1537 | #ifdef CONFIG_RCU_CPU_STALL_DETECTOR |
1538 | printk(KERN_INFO "RCU-based detection of stalled CPUs is enabled.\n"); | 1538 | printk(KERN_INFO "RCU-based detection of stalled CPUs is enabled.\n"); |
1539 | #endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */ | 1539 | #endif /* #ifdef CONFIG_RCU_CPU_STALL_DETECTOR */ |
@@ -1546,7 +1546,6 @@ void __init __rcu_init(void) | |||
1546 | rcu_cpu_notify(&rcu_nb, CPU_UP_PREPARE, (void *)(long)i); | 1546 | rcu_cpu_notify(&rcu_nb, CPU_UP_PREPARE, (void *)(long)i); |
1547 | /* Register notifier for non-boot CPUs */ | 1547 | /* Register notifier for non-boot CPUs */ |
1548 | register_cpu_notifier(&rcu_nb); | 1548 | register_cpu_notifier(&rcu_nb); |
1549 | printk(KERN_WARNING "Experimental hierarchical RCU init done.\n"); | ||
1550 | } | 1549 | } |
1551 | 1550 | ||
1552 | module_param(blimit, int, 0); | 1551 | module_param(blimit, int, 0); |
diff --git a/kernel/sched.c b/kernel/sched.c index 7c9098d186e6..01f55ada3598 100644 --- a/kernel/sched.c +++ b/kernel/sched.c | |||
@@ -6541,6 +6541,11 @@ SYSCALL_DEFINE0(sched_yield) | |||
6541 | return 0; | 6541 | return 0; |
6542 | } | 6542 | } |
6543 | 6543 | ||
6544 | static inline int should_resched(void) | ||
6545 | { | ||
6546 | return need_resched() && !(preempt_count() & PREEMPT_ACTIVE); | ||
6547 | } | ||
6548 | |||
6544 | static void __cond_resched(void) | 6549 | static void __cond_resched(void) |
6545 | { | 6550 | { |
6546 | #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP | 6551 | #ifdef CONFIG_DEBUG_SPINLOCK_SLEEP |
@@ -6560,8 +6565,7 @@ static void __cond_resched(void) | |||
6560 | 6565 | ||
6561 | int __sched _cond_resched(void) | 6566 | int __sched _cond_resched(void) |
6562 | { | 6567 | { |
6563 | if (need_resched() && !(preempt_count() & PREEMPT_ACTIVE) && | 6568 | if (should_resched()) { |
6564 | system_state == SYSTEM_RUNNING) { | ||
6565 | __cond_resched(); | 6569 | __cond_resched(); |
6566 | return 1; | 6570 | return 1; |
6567 | } | 6571 | } |
@@ -6579,12 +6583,12 @@ EXPORT_SYMBOL(_cond_resched); | |||
6579 | */ | 6583 | */ |
6580 | int cond_resched_lock(spinlock_t *lock) | 6584 | int cond_resched_lock(spinlock_t *lock) |
6581 | { | 6585 | { |
6582 | int resched = need_resched() && system_state == SYSTEM_RUNNING; | 6586 | int resched = should_resched(); |
6583 | int ret = 0; | 6587 | int ret = 0; |
6584 | 6588 | ||
6585 | if (spin_needbreak(lock) || resched) { | 6589 | if (spin_needbreak(lock) || resched) { |
6586 | spin_unlock(lock); | 6590 | spin_unlock(lock); |
6587 | if (resched && need_resched()) | 6591 | if (resched) |
6588 | __cond_resched(); | 6592 | __cond_resched(); |
6589 | else | 6593 | else |
6590 | cpu_relax(); | 6594 | cpu_relax(); |
@@ -6599,7 +6603,7 @@ int __sched cond_resched_softirq(void) | |||
6599 | { | 6603 | { |
6600 | BUG_ON(!in_softirq()); | 6604 | BUG_ON(!in_softirq()); |
6601 | 6605 | ||
6602 | if (need_resched() && system_state == SYSTEM_RUNNING) { | 6606 | if (should_resched()) { |
6603 | local_bh_enable(); | 6607 | local_bh_enable(); |
6604 | __cond_resched(); | 6608 | __cond_resched(); |
6605 | local_bh_disable(); | 6609 | local_bh_disable(); |
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig index 1551f47e7669..019f380fd764 100644 --- a/kernel/trace/Kconfig +++ b/kernel/trace/Kconfig | |||
@@ -226,13 +226,13 @@ config BOOT_TRACER | |||
226 | the timings of the initcalls and traces key events and the identity | 226 | the timings of the initcalls and traces key events and the identity |
227 | of tasks that can cause boot delays, such as context-switches. | 227 | of tasks that can cause boot delays, such as context-switches. |
228 | 228 | ||
229 | Its aim is to be parsed by the /scripts/bootgraph.pl tool to | 229 | Its aim is to be parsed by the scripts/bootgraph.pl tool to |
230 | produce pretty graphics about boot inefficiencies, giving a visual | 230 | produce pretty graphics about boot inefficiencies, giving a visual |
231 | representation of the delays during initcalls - but the raw | 231 | representation of the delays during initcalls - but the raw |
232 | /debug/tracing/trace text output is readable too. | 232 | /debug/tracing/trace text output is readable too. |
233 | 233 | ||
234 | You must pass in ftrace=initcall to the kernel command line | 234 | You must pass in initcall_debug and ftrace=initcall to the kernel |
235 | to enable this on bootup. | 235 | command line to enable this on bootup. |
236 | 236 | ||
237 | config TRACE_BRANCH_PROFILING | 237 | config TRACE_BRANCH_PROFILING |
238 | bool | 238 | bool |
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 39af8af6fc30..1090b0aed9ba 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/mutex.h> | 23 | #include <linux/mutex.h> |
24 | #include <linux/debugfs.h> | 24 | #include <linux/debugfs.h> |
25 | #include <linux/smp_lock.h> | ||
25 | #include <linux/time.h> | 26 | #include <linux/time.h> |
26 | #include <linux/uaccess.h> | 27 | #include <linux/uaccess.h> |
27 | 28 | ||
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index f3716bf04df6..bce9e01a29c8 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -3160,10 +3160,10 @@ ftrace_enable_sysctl(struct ctl_table *table, int write, | |||
3160 | 3160 | ||
3161 | ret = proc_dointvec(table, write, file, buffer, lenp, ppos); | 3161 | ret = proc_dointvec(table, write, file, buffer, lenp, ppos); |
3162 | 3162 | ||
3163 | if (ret || !write || (last_ftrace_enabled == ftrace_enabled)) | 3163 | if (ret || !write || (last_ftrace_enabled == !!ftrace_enabled)) |
3164 | goto out; | 3164 | goto out; |
3165 | 3165 | ||
3166 | last_ftrace_enabled = ftrace_enabled; | 3166 | last_ftrace_enabled = !!ftrace_enabled; |
3167 | 3167 | ||
3168 | if (ftrace_enabled) { | 3168 | if (ftrace_enabled) { |
3169 | 3169 | ||
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 3aa0a0dfdfa8..8bc8d8afea6a 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/writeback.h> | 17 | #include <linux/writeback.h> |
18 | #include <linux/kallsyms.h> | 18 | #include <linux/kallsyms.h> |
19 | #include <linux/seq_file.h> | 19 | #include <linux/seq_file.h> |
20 | #include <linux/smp_lock.h> | ||
20 | #include <linux/notifier.h> | 21 | #include <linux/notifier.h> |
21 | #include <linux/irqflags.h> | 22 | #include <linux/irqflags.h> |
22 | #include <linux/debugfs.h> | 23 | #include <linux/debugfs.h> |
diff --git a/kernel/trace/trace_event_types.h b/kernel/trace/trace_event_types.h index 5e32e375134d..6db005e12487 100644 --- a/kernel/trace/trace_event_types.h +++ b/kernel/trace/trace_event_types.h | |||
@@ -26,6 +26,9 @@ TRACE_EVENT_FORMAT(funcgraph_exit, TRACE_GRAPH_RET, | |||
26 | ftrace_graph_ret_entry, ignore, | 26 | ftrace_graph_ret_entry, ignore, |
27 | TRACE_STRUCT( | 27 | TRACE_STRUCT( |
28 | TRACE_FIELD(unsigned long, ret.func, func) | 28 | TRACE_FIELD(unsigned long, ret.func, func) |
29 | TRACE_FIELD(unsigned long long, ret.calltime, calltime) | ||
30 | TRACE_FIELD(unsigned long long, ret.rettime, rettime) | ||
31 | TRACE_FIELD(unsigned long, ret.overrun, overrun) | ||
29 | TRACE_FIELD(int, ret.depth, depth) | 32 | TRACE_FIELD(int, ret.depth, depth) |
30 | ), | 33 | ), |
31 | TP_RAW_FMT("<-- %lx (%d)") | 34 | TP_RAW_FMT("<-- %lx (%d)") |
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index 7938f3ae93e3..e0c2545622e8 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c | |||
@@ -27,8 +27,7 @@ void trace_print_seq(struct seq_file *m, struct trace_seq *s) | |||
27 | { | 27 | { |
28 | int len = s->len >= PAGE_SIZE ? PAGE_SIZE - 1 : s->len; | 28 | int len = s->len >= PAGE_SIZE ? PAGE_SIZE - 1 : s->len; |
29 | 29 | ||
30 | s->buffer[len] = 0; | 30 | seq_write(m, s->buffer, len); |
31 | seq_puts(m, s->buffer); | ||
32 | 31 | ||
33 | trace_seq_init(s); | 32 | trace_seq_init(s); |
34 | } | 33 | } |
diff --git a/kernel/trace/trace_stack.c b/kernel/trace/trace_stack.c index 2d7aebd71dbd..e644af910124 100644 --- a/kernel/trace/trace_stack.c +++ b/kernel/trace/trace_stack.c | |||
@@ -326,10 +326,10 @@ stack_trace_sysctl(struct ctl_table *table, int write, | |||
326 | ret = proc_dointvec(table, write, file, buffer, lenp, ppos); | 326 | ret = proc_dointvec(table, write, file, buffer, lenp, ppos); |
327 | 327 | ||
328 | if (ret || !write || | 328 | if (ret || !write || |
329 | (last_stack_tracer_enabled == stack_tracer_enabled)) | 329 | (last_stack_tracer_enabled == !!stack_tracer_enabled)) |
330 | goto out; | 330 | goto out; |
331 | 331 | ||
332 | last_stack_tracer_enabled = stack_tracer_enabled; | 332 | last_stack_tracer_enabled = !!stack_tracer_enabled; |
333 | 333 | ||
334 | if (stack_tracer_enabled) | 334 | if (stack_tracer_enabled) |
335 | register_ftrace_function(&trace_ops); | 335 | register_ftrace_function(&trace_ops); |
diff --git a/lib/dma-debug.c b/lib/dma-debug.c index 3b93129a968c..65b0d99b6d0a 100644 --- a/lib/dma-debug.c +++ b/lib/dma-debug.c | |||
@@ -716,7 +716,7 @@ void dma_debug_init(u32 num_entries) | |||
716 | 716 | ||
717 | for (i = 0; i < HASH_SIZE; ++i) { | 717 | for (i = 0; i < HASH_SIZE; ++i) { |
718 | INIT_LIST_HEAD(&dma_entry_hash[i].list); | 718 | INIT_LIST_HEAD(&dma_entry_hash[i].list); |
719 | dma_entry_hash[i].lock = SPIN_LOCK_UNLOCKED; | 719 | spin_lock_init(&dma_entry_hash[i].lock); |
720 | } | 720 | } |
721 | 721 | ||
722 | if (dma_debug_fs_init() != 0) { | 722 | if (dma_debug_fs_init() != 0) { |
@@ -856,22 +856,21 @@ static void check_for_stack(struct device *dev, void *addr) | |||
856 | "stack [addr=%p]\n", addr); | 856 | "stack [addr=%p]\n", addr); |
857 | } | 857 | } |
858 | 858 | ||
859 | static inline bool overlap(void *addr, u64 size, void *start, void *end) | 859 | static inline bool overlap(void *addr, unsigned long len, void *start, void *end) |
860 | { | 860 | { |
861 | void *addr2 = (char *)addr + size; | 861 | unsigned long a1 = (unsigned long)addr; |
862 | unsigned long b1 = a1 + len; | ||
863 | unsigned long a2 = (unsigned long)start; | ||
864 | unsigned long b2 = (unsigned long)end; | ||
862 | 865 | ||
863 | return ((addr >= start && addr < end) || | 866 | return !(b1 <= a2 || a1 >= b2); |
864 | (addr2 >= start && addr2 < end) || | ||
865 | ((addr < start) && (addr2 >= end))); | ||
866 | } | 867 | } |
867 | 868 | ||
868 | static void check_for_illegal_area(struct device *dev, void *addr, u64 size) | 869 | static void check_for_illegal_area(struct device *dev, void *addr, unsigned long len) |
869 | { | 870 | { |
870 | if (overlap(addr, size, _text, _etext) || | 871 | if (overlap(addr, len, _text, _etext) || |
871 | overlap(addr, size, __start_rodata, __end_rodata)) | 872 | overlap(addr, len, __start_rodata, __end_rodata)) |
872 | err_printk(dev, NULL, "DMA-API: device driver maps " | 873 | err_printk(dev, NULL, "DMA-API: device driver maps memory from kernel text or rodata [addr=%p] [len=%lu]\n", addr, len); |
873 | "memory from kernel text or rodata " | ||
874 | "[addr=%p] [size=%llu]\n", addr, size); | ||
875 | } | 874 | } |
876 | 875 | ||
877 | static void check_sync(struct device *dev, | 876 | static void check_sync(struct device *dev, |
@@ -969,7 +968,8 @@ void debug_dma_map_page(struct device *dev, struct page *page, size_t offset, | |||
969 | entry->type = dma_debug_single; | 968 | entry->type = dma_debug_single; |
970 | 969 | ||
971 | if (!PageHighMem(page)) { | 970 | if (!PageHighMem(page)) { |
972 | void *addr = ((char *)page_address(page)) + offset; | 971 | void *addr = page_address(page) + offset; |
972 | |||
973 | check_for_stack(dev, addr); | 973 | check_for_stack(dev, addr); |
974 | check_for_illegal_area(dev, addr, size); | 974 | check_for_illegal_area(dev, addr, size); |
975 | } | 975 | } |
diff --git a/mm/backing-dev.c b/mm/backing-dev.c index 493b468a5035..c86edd244294 100644 --- a/mm/backing-dev.c +++ b/mm/backing-dev.c | |||
@@ -283,7 +283,6 @@ static wait_queue_head_t congestion_wqh[2] = { | |||
283 | __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[1]) | 283 | __WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[1]) |
284 | }; | 284 | }; |
285 | 285 | ||
286 | |||
287 | void clear_bdi_congested(struct backing_dev_info *bdi, int sync) | 286 | void clear_bdi_congested(struct backing_dev_info *bdi, int sync) |
288 | { | 287 | { |
289 | enum bdi_state bit; | 288 | enum bdi_state bit; |
@@ -308,18 +307,18 @@ EXPORT_SYMBOL(set_bdi_congested); | |||
308 | 307 | ||
309 | /** | 308 | /** |
310 | * congestion_wait - wait for a backing_dev to become uncongested | 309 | * congestion_wait - wait for a backing_dev to become uncongested |
311 | * @rw: READ or WRITE | 310 | * @sync: SYNC or ASYNC IO |
312 | * @timeout: timeout in jiffies | 311 | * @timeout: timeout in jiffies |
313 | * | 312 | * |
314 | * Waits for up to @timeout jiffies for a backing_dev (any backing_dev) to exit | 313 | * Waits for up to @timeout jiffies for a backing_dev (any backing_dev) to exit |
315 | * write congestion. If no backing_devs are congested then just wait for the | 314 | * write congestion. If no backing_devs are congested then just wait for the |
316 | * next write to be completed. | 315 | * next write to be completed. |
317 | */ | 316 | */ |
318 | long congestion_wait(int rw, long timeout) | 317 | long congestion_wait(int sync, long timeout) |
319 | { | 318 | { |
320 | long ret; | 319 | long ret; |
321 | DEFINE_WAIT(wait); | 320 | DEFINE_WAIT(wait); |
322 | wait_queue_head_t *wqh = &congestion_wqh[rw]; | 321 | wait_queue_head_t *wqh = &congestion_wqh[sync]; |
323 | 322 | ||
324 | prepare_to_wait(wqh, &wait, TASK_UNINTERRUPTIBLE); | 323 | prepare_to_wait(wqh, &wait, TASK_UNINTERRUPTIBLE); |
325 | ret = io_schedule_timeout(timeout); | 324 | ret = io_schedule_timeout(timeout); |
diff --git a/mm/bootmem.c b/mm/bootmem.c index d2a9ce952768..701740c9e81b 100644 --- a/mm/bootmem.c +++ b/mm/bootmem.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/pfn.h> | 12 | #include <linux/pfn.h> |
13 | #include <linux/bootmem.h> | 13 | #include <linux/bootmem.h> |
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/kmemleak.h> | ||
15 | 16 | ||
16 | #include <asm/bug.h> | 17 | #include <asm/bug.h> |
17 | #include <asm/io.h> | 18 | #include <asm/io.h> |
@@ -335,6 +336,8 @@ void __init free_bootmem_node(pg_data_t *pgdat, unsigned long physaddr, | |||
335 | { | 336 | { |
336 | unsigned long start, end; | 337 | unsigned long start, end; |
337 | 338 | ||
339 | kmemleak_free_part(__va(physaddr), size); | ||
340 | |||
338 | start = PFN_UP(physaddr); | 341 | start = PFN_UP(physaddr); |
339 | end = PFN_DOWN(physaddr + size); | 342 | end = PFN_DOWN(physaddr + size); |
340 | 343 | ||
@@ -354,6 +357,8 @@ void __init free_bootmem(unsigned long addr, unsigned long size) | |||
354 | { | 357 | { |
355 | unsigned long start, end; | 358 | unsigned long start, end; |
356 | 359 | ||
360 | kmemleak_free_part(__va(addr), size); | ||
361 | |||
357 | start = PFN_UP(addr); | 362 | start = PFN_UP(addr); |
358 | end = PFN_DOWN(addr + size); | 363 | end = PFN_DOWN(addr + size); |
359 | 364 | ||
@@ -516,6 +521,7 @@ find_block: | |||
516 | region = phys_to_virt(PFN_PHYS(bdata->node_min_pfn) + | 521 | region = phys_to_virt(PFN_PHYS(bdata->node_min_pfn) + |
517 | start_off); | 522 | start_off); |
518 | memset(region, 0, size); | 523 | memset(region, 0, size); |
524 | kmemleak_alloc(region, size, 1, 0); | ||
519 | return region; | 525 | return region; |
520 | } | 526 | } |
521 | 527 | ||
diff --git a/mm/filemap.c b/mm/filemap.c index 22396713feb9..ccea3b665c12 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -2272,6 +2272,7 @@ again: | |||
2272 | pagefault_enable(); | 2272 | pagefault_enable(); |
2273 | flush_dcache_page(page); | 2273 | flush_dcache_page(page); |
2274 | 2274 | ||
2275 | mark_page_accessed(page); | ||
2275 | status = a_ops->write_end(file, mapping, pos, bytes, copied, | 2276 | status = a_ops->write_end(file, mapping, pos, bytes, copied, |
2276 | page, fsdata); | 2277 | page, fsdata); |
2277 | if (unlikely(status < 0)) | 2278 | if (unlikely(status < 0)) |
diff --git a/mm/kmemleak.c b/mm/kmemleak.c index e766e1da09d2..5aabd41ffb8f 100644 --- a/mm/kmemleak.c +++ b/mm/kmemleak.c | |||
@@ -103,10 +103,10 @@ | |||
103 | * Kmemleak configuration and common defines. | 103 | * Kmemleak configuration and common defines. |
104 | */ | 104 | */ |
105 | #define MAX_TRACE 16 /* stack trace length */ | 105 | #define MAX_TRACE 16 /* stack trace length */ |
106 | #define REPORTS_NR 50 /* maximum number of reported leaks */ | ||
107 | #define MSECS_MIN_AGE 5000 /* minimum object age for reporting */ | 106 | #define MSECS_MIN_AGE 5000 /* minimum object age for reporting */ |
108 | #define SECS_FIRST_SCAN 60 /* delay before the first scan */ | 107 | #define SECS_FIRST_SCAN 60 /* delay before the first scan */ |
109 | #define SECS_SCAN_WAIT 600 /* subsequent auto scanning delay */ | 108 | #define SECS_SCAN_WAIT 600 /* subsequent auto scanning delay */ |
109 | #define GRAY_LIST_PASSES 25 /* maximum number of gray list scans */ | ||
110 | 110 | ||
111 | #define BYTES_PER_POINTER sizeof(void *) | 111 | #define BYTES_PER_POINTER sizeof(void *) |
112 | 112 | ||
@@ -158,6 +158,8 @@ struct kmemleak_object { | |||
158 | #define OBJECT_REPORTED (1 << 1) | 158 | #define OBJECT_REPORTED (1 << 1) |
159 | /* flag set to not scan the object */ | 159 | /* flag set to not scan the object */ |
160 | #define OBJECT_NO_SCAN (1 << 2) | 160 | #define OBJECT_NO_SCAN (1 << 2) |
161 | /* flag set on newly allocated objects */ | ||
162 | #define OBJECT_NEW (1 << 3) | ||
161 | 163 | ||
162 | /* the list of all allocated objects */ | 164 | /* the list of all allocated objects */ |
163 | static LIST_HEAD(object_list); | 165 | static LIST_HEAD(object_list); |
@@ -196,9 +198,6 @@ static int kmemleak_stack_scan = 1; | |||
196 | /* protects the memory scanning, parameters and debug/kmemleak file access */ | 198 | /* protects the memory scanning, parameters and debug/kmemleak file access */ |
197 | static DEFINE_MUTEX(scan_mutex); | 199 | static DEFINE_MUTEX(scan_mutex); |
198 | 200 | ||
199 | /* number of leaks reported (for limitation purposes) */ | ||
200 | static int reported_leaks; | ||
201 | |||
202 | /* | 201 | /* |
203 | * Early object allocation/freeing logging. Kmemleak is initialized after the | 202 | * Early object allocation/freeing logging. Kmemleak is initialized after the |
204 | * kernel allocator. However, both the kernel allocator and kmemleak may | 203 | * kernel allocator. However, both the kernel allocator and kmemleak may |
@@ -211,6 +210,7 @@ static int reported_leaks; | |||
211 | enum { | 210 | enum { |
212 | KMEMLEAK_ALLOC, | 211 | KMEMLEAK_ALLOC, |
213 | KMEMLEAK_FREE, | 212 | KMEMLEAK_FREE, |
213 | KMEMLEAK_FREE_PART, | ||
214 | KMEMLEAK_NOT_LEAK, | 214 | KMEMLEAK_NOT_LEAK, |
215 | KMEMLEAK_IGNORE, | 215 | KMEMLEAK_IGNORE, |
216 | KMEMLEAK_SCAN_AREA, | 216 | KMEMLEAK_SCAN_AREA, |
@@ -274,6 +274,11 @@ static int color_gray(const struct kmemleak_object *object) | |||
274 | return object->min_count != -1 && object->count >= object->min_count; | 274 | return object->min_count != -1 && object->count >= object->min_count; |
275 | } | 275 | } |
276 | 276 | ||
277 | static int color_black(const struct kmemleak_object *object) | ||
278 | { | ||
279 | return object->min_count == -1; | ||
280 | } | ||
281 | |||
277 | /* | 282 | /* |
278 | * Objects are considered unreferenced only if their color is white, they have | 283 | * Objects are considered unreferenced only if their color is white, they have |
279 | * not be deleted and have a minimum age to avoid false positives caused by | 284 | * not be deleted and have a minimum age to avoid false positives caused by |
@@ -451,7 +456,7 @@ static void create_object(unsigned long ptr, size_t size, int min_count, | |||
451 | INIT_HLIST_HEAD(&object->area_list); | 456 | INIT_HLIST_HEAD(&object->area_list); |
452 | spin_lock_init(&object->lock); | 457 | spin_lock_init(&object->lock); |
453 | atomic_set(&object->use_count, 1); | 458 | atomic_set(&object->use_count, 1); |
454 | object->flags = OBJECT_ALLOCATED; | 459 | object->flags = OBJECT_ALLOCATED | OBJECT_NEW; |
455 | object->pointer = ptr; | 460 | object->pointer = ptr; |
456 | object->size = size; | 461 | object->size = size; |
457 | object->min_count = min_count; | 462 | object->min_count = min_count; |
@@ -519,27 +524,17 @@ out: | |||
519 | * Remove the metadata (struct kmemleak_object) for a memory block from the | 524 | * Remove the metadata (struct kmemleak_object) for a memory block from the |
520 | * object_list and object_tree_root and decrement its use_count. | 525 | * object_list and object_tree_root and decrement its use_count. |
521 | */ | 526 | */ |
522 | static void delete_object(unsigned long ptr) | 527 | static void __delete_object(struct kmemleak_object *object) |
523 | { | 528 | { |
524 | unsigned long flags; | 529 | unsigned long flags; |
525 | struct kmemleak_object *object; | ||
526 | 530 | ||
527 | write_lock_irqsave(&kmemleak_lock, flags); | 531 | write_lock_irqsave(&kmemleak_lock, flags); |
528 | object = lookup_object(ptr, 0); | ||
529 | if (!object) { | ||
530 | #ifdef DEBUG | ||
531 | kmemleak_warn("Freeing unknown object at 0x%08lx\n", | ||
532 | ptr); | ||
533 | #endif | ||
534 | write_unlock_irqrestore(&kmemleak_lock, flags); | ||
535 | return; | ||
536 | } | ||
537 | prio_tree_remove(&object_tree_root, &object->tree_node); | 532 | prio_tree_remove(&object_tree_root, &object->tree_node); |
538 | list_del_rcu(&object->object_list); | 533 | list_del_rcu(&object->object_list); |
539 | write_unlock_irqrestore(&kmemleak_lock, flags); | 534 | write_unlock_irqrestore(&kmemleak_lock, flags); |
540 | 535 | ||
541 | WARN_ON(!(object->flags & OBJECT_ALLOCATED)); | 536 | WARN_ON(!(object->flags & OBJECT_ALLOCATED)); |
542 | WARN_ON(atomic_read(&object->use_count) < 1); | 537 | WARN_ON(atomic_read(&object->use_count) < 2); |
543 | 538 | ||
544 | /* | 539 | /* |
545 | * Locking here also ensures that the corresponding memory block | 540 | * Locking here also ensures that the corresponding memory block |
@@ -552,6 +547,64 @@ static void delete_object(unsigned long ptr) | |||
552 | } | 547 | } |
553 | 548 | ||
554 | /* | 549 | /* |
550 | * Look up the metadata (struct kmemleak_object) corresponding to ptr and | ||
551 | * delete it. | ||
552 | */ | ||
553 | static void delete_object_full(unsigned long ptr) | ||
554 | { | ||
555 | struct kmemleak_object *object; | ||
556 | |||
557 | object = find_and_get_object(ptr, 0); | ||
558 | if (!object) { | ||
559 | #ifdef DEBUG | ||
560 | kmemleak_warn("Freeing unknown object at 0x%08lx\n", | ||
561 | ptr); | ||
562 | #endif | ||
563 | return; | ||
564 | } | ||
565 | __delete_object(object); | ||
566 | put_object(object); | ||
567 | } | ||
568 | |||
569 | /* | ||
570 | * Look up the metadata (struct kmemleak_object) corresponding to ptr and | ||
571 | * delete it. If the memory block is partially freed, the function may create | ||
572 | * additional metadata for the remaining parts of the block. | ||
573 | */ | ||
574 | static void delete_object_part(unsigned long ptr, size_t size) | ||
575 | { | ||
576 | struct kmemleak_object *object; | ||
577 | unsigned long start, end; | ||
578 | |||
579 | object = find_and_get_object(ptr, 1); | ||
580 | if (!object) { | ||
581 | #ifdef DEBUG | ||
582 | kmemleak_warn("Partially freeing unknown object at 0x%08lx " | ||
583 | "(size %zu)\n", ptr, size); | ||
584 | #endif | ||
585 | return; | ||
586 | } | ||
587 | __delete_object(object); | ||
588 | |||
589 | /* | ||
590 | * Create one or two objects that may result from the memory block | ||
591 | * split. Note that partial freeing is only done by free_bootmem() and | ||
592 | * this happens before kmemleak_init() is called. The path below is | ||
593 | * only executed during early log recording in kmemleak_init(), so | ||
594 | * GFP_KERNEL is enough. | ||
595 | */ | ||
596 | start = object->pointer; | ||
597 | end = object->pointer + object->size; | ||
598 | if (ptr > start) | ||
599 | create_object(start, ptr - start, object->min_count, | ||
600 | GFP_KERNEL); | ||
601 | if (ptr + size < end) | ||
602 | create_object(ptr + size, end - ptr - size, object->min_count, | ||
603 | GFP_KERNEL); | ||
604 | |||
605 | put_object(object); | ||
606 | } | ||
607 | /* | ||
555 | * Make a object permanently as gray-colored so that it can no longer be | 608 | * Make a object permanently as gray-colored so that it can no longer be |
556 | * reported as a leak. This is used in general to mark a false positive. | 609 | * reported as a leak. This is used in general to mark a false positive. |
557 | */ | 610 | */ |
@@ -715,13 +768,28 @@ void kmemleak_free(const void *ptr) | |||
715 | pr_debug("%s(0x%p)\n", __func__, ptr); | 768 | pr_debug("%s(0x%p)\n", __func__, ptr); |
716 | 769 | ||
717 | if (atomic_read(&kmemleak_enabled) && ptr && !IS_ERR(ptr)) | 770 | if (atomic_read(&kmemleak_enabled) && ptr && !IS_ERR(ptr)) |
718 | delete_object((unsigned long)ptr); | 771 | delete_object_full((unsigned long)ptr); |
719 | else if (atomic_read(&kmemleak_early_log)) | 772 | else if (atomic_read(&kmemleak_early_log)) |
720 | log_early(KMEMLEAK_FREE, ptr, 0, 0, 0, 0); | 773 | log_early(KMEMLEAK_FREE, ptr, 0, 0, 0, 0); |
721 | } | 774 | } |
722 | EXPORT_SYMBOL_GPL(kmemleak_free); | 775 | EXPORT_SYMBOL_GPL(kmemleak_free); |
723 | 776 | ||
724 | /* | 777 | /* |
778 | * Partial memory freeing function callback. This function is usually called | ||
779 | * from bootmem allocator when (part of) a memory block is freed. | ||
780 | */ | ||
781 | void kmemleak_free_part(const void *ptr, size_t size) | ||
782 | { | ||
783 | pr_debug("%s(0x%p)\n", __func__, ptr); | ||
784 | |||
785 | if (atomic_read(&kmemleak_enabled) && ptr && !IS_ERR(ptr)) | ||
786 | delete_object_part((unsigned long)ptr, size); | ||
787 | else if (atomic_read(&kmemleak_early_log)) | ||
788 | log_early(KMEMLEAK_FREE_PART, ptr, size, 0, 0, 0); | ||
789 | } | ||
790 | EXPORT_SYMBOL_GPL(kmemleak_free_part); | ||
791 | |||
792 | /* | ||
725 | * Mark an already allocated memory block as a false positive. This will cause | 793 | * Mark an already allocated memory block as a false positive. This will cause |
726 | * the block to no longer be reported as leak and always be scanned. | 794 | * the block to no longer be reported as leak and always be scanned. |
727 | */ | 795 | */ |
@@ -807,7 +875,7 @@ static int scan_should_stop(void) | |||
807 | * found to the gray list. | 875 | * found to the gray list. |
808 | */ | 876 | */ |
809 | static void scan_block(void *_start, void *_end, | 877 | static void scan_block(void *_start, void *_end, |
810 | struct kmemleak_object *scanned) | 878 | struct kmemleak_object *scanned, int allow_resched) |
811 | { | 879 | { |
812 | unsigned long *ptr; | 880 | unsigned long *ptr; |
813 | unsigned long *start = PTR_ALIGN(_start, BYTES_PER_POINTER); | 881 | unsigned long *start = PTR_ALIGN(_start, BYTES_PER_POINTER); |
@@ -818,6 +886,8 @@ static void scan_block(void *_start, void *_end, | |||
818 | unsigned long pointer = *ptr; | 886 | unsigned long pointer = *ptr; |
819 | struct kmemleak_object *object; | 887 | struct kmemleak_object *object; |
820 | 888 | ||
889 | if (allow_resched) | ||
890 | cond_resched(); | ||
821 | if (scan_should_stop()) | 891 | if (scan_should_stop()) |
822 | break; | 892 | break; |
823 | 893 | ||
@@ -881,12 +951,12 @@ static void scan_object(struct kmemleak_object *object) | |||
881 | goto out; | 951 | goto out; |
882 | if (hlist_empty(&object->area_list)) | 952 | if (hlist_empty(&object->area_list)) |
883 | scan_block((void *)object->pointer, | 953 | scan_block((void *)object->pointer, |
884 | (void *)(object->pointer + object->size), object); | 954 | (void *)(object->pointer + object->size), object, 0); |
885 | else | 955 | else |
886 | hlist_for_each_entry(area, elem, &object->area_list, node) | 956 | hlist_for_each_entry(area, elem, &object->area_list, node) |
887 | scan_block((void *)(object->pointer + area->offset), | 957 | scan_block((void *)(object->pointer + area->offset), |
888 | (void *)(object->pointer + area->offset | 958 | (void *)(object->pointer + area->offset |
889 | + area->length), object); | 959 | + area->length), object, 0); |
890 | out: | 960 | out: |
891 | spin_unlock_irqrestore(&object->lock, flags); | 961 | spin_unlock_irqrestore(&object->lock, flags); |
892 | } | 962 | } |
@@ -903,6 +973,7 @@ static void kmemleak_scan(void) | |||
903 | struct task_struct *task; | 973 | struct task_struct *task; |
904 | int i; | 974 | int i; |
905 | int new_leaks = 0; | 975 | int new_leaks = 0; |
976 | int gray_list_pass = 0; | ||
906 | 977 | ||
907 | jiffies_last_scan = jiffies; | 978 | jiffies_last_scan = jiffies; |
908 | 979 | ||
@@ -923,6 +994,7 @@ static void kmemleak_scan(void) | |||
923 | #endif | 994 | #endif |
924 | /* reset the reference count (whiten the object) */ | 995 | /* reset the reference count (whiten the object) */ |
925 | object->count = 0; | 996 | object->count = 0; |
997 | object->flags &= ~OBJECT_NEW; | ||
926 | if (color_gray(object) && get_object(object)) | 998 | if (color_gray(object) && get_object(object)) |
927 | list_add_tail(&object->gray_list, &gray_list); | 999 | list_add_tail(&object->gray_list, &gray_list); |
928 | 1000 | ||
@@ -931,14 +1003,14 @@ static void kmemleak_scan(void) | |||
931 | rcu_read_unlock(); | 1003 | rcu_read_unlock(); |
932 | 1004 | ||
933 | /* data/bss scanning */ | 1005 | /* data/bss scanning */ |
934 | scan_block(_sdata, _edata, NULL); | 1006 | scan_block(_sdata, _edata, NULL, 1); |
935 | scan_block(__bss_start, __bss_stop, NULL); | 1007 | scan_block(__bss_start, __bss_stop, NULL, 1); |
936 | 1008 | ||
937 | #ifdef CONFIG_SMP | 1009 | #ifdef CONFIG_SMP |
938 | /* per-cpu sections scanning */ | 1010 | /* per-cpu sections scanning */ |
939 | for_each_possible_cpu(i) | 1011 | for_each_possible_cpu(i) |
940 | scan_block(__per_cpu_start + per_cpu_offset(i), | 1012 | scan_block(__per_cpu_start + per_cpu_offset(i), |
941 | __per_cpu_end + per_cpu_offset(i), NULL); | 1013 | __per_cpu_end + per_cpu_offset(i), NULL, 1); |
942 | #endif | 1014 | #endif |
943 | 1015 | ||
944 | /* | 1016 | /* |
@@ -960,7 +1032,7 @@ static void kmemleak_scan(void) | |||
960 | /* only scan if page is in use */ | 1032 | /* only scan if page is in use */ |
961 | if (page_count(page) == 0) | 1033 | if (page_count(page) == 0) |
962 | continue; | 1034 | continue; |
963 | scan_block(page, page + 1, NULL); | 1035 | scan_block(page, page + 1, NULL, 1); |
964 | } | 1036 | } |
965 | } | 1037 | } |
966 | 1038 | ||
@@ -972,7 +1044,8 @@ static void kmemleak_scan(void) | |||
972 | read_lock(&tasklist_lock); | 1044 | read_lock(&tasklist_lock); |
973 | for_each_process(task) | 1045 | for_each_process(task) |
974 | scan_block(task_stack_page(task), | 1046 | scan_block(task_stack_page(task), |
975 | task_stack_page(task) + THREAD_SIZE, NULL); | 1047 | task_stack_page(task) + THREAD_SIZE, |
1048 | NULL, 0); | ||
976 | read_unlock(&tasklist_lock); | 1049 | read_unlock(&tasklist_lock); |
977 | } | 1050 | } |
978 | 1051 | ||
@@ -984,6 +1057,7 @@ static void kmemleak_scan(void) | |||
984 | * kmemleak objects cannot be freed from outside the loop because their | 1057 | * kmemleak objects cannot be freed from outside the loop because their |
985 | * use_count was increased. | 1058 | * use_count was increased. |
986 | */ | 1059 | */ |
1060 | repeat: | ||
987 | object = list_entry(gray_list.next, typeof(*object), gray_list); | 1061 | object = list_entry(gray_list.next, typeof(*object), gray_list); |
988 | while (&object->gray_list != &gray_list) { | 1062 | while (&object->gray_list != &gray_list) { |
989 | cond_resched(); | 1063 | cond_resched(); |
@@ -1001,12 +1075,38 @@ static void kmemleak_scan(void) | |||
1001 | 1075 | ||
1002 | object = tmp; | 1076 | object = tmp; |
1003 | } | 1077 | } |
1078 | |||
1079 | if (scan_should_stop() || ++gray_list_pass >= GRAY_LIST_PASSES) | ||
1080 | goto scan_end; | ||
1081 | |||
1082 | /* | ||
1083 | * Check for new objects allocated during this scanning and add them | ||
1084 | * to the gray list. | ||
1085 | */ | ||
1086 | rcu_read_lock(); | ||
1087 | list_for_each_entry_rcu(object, &object_list, object_list) { | ||
1088 | spin_lock_irqsave(&object->lock, flags); | ||
1089 | if ((object->flags & OBJECT_NEW) && !color_black(object) && | ||
1090 | get_object(object)) { | ||
1091 | object->flags &= ~OBJECT_NEW; | ||
1092 | list_add_tail(&object->gray_list, &gray_list); | ||
1093 | } | ||
1094 | spin_unlock_irqrestore(&object->lock, flags); | ||
1095 | } | ||
1096 | rcu_read_unlock(); | ||
1097 | |||
1098 | if (!list_empty(&gray_list)) | ||
1099 | goto repeat; | ||
1100 | |||
1101 | scan_end: | ||
1004 | WARN_ON(!list_empty(&gray_list)); | 1102 | WARN_ON(!list_empty(&gray_list)); |
1005 | 1103 | ||
1006 | /* | 1104 | /* |
1007 | * If scanning was stopped do not report any new unreferenced objects. | 1105 | * If scanning was stopped or new objects were being allocated at a |
1106 | * higher rate than gray list scanning, do not report any new | ||
1107 | * unreferenced objects. | ||
1008 | */ | 1108 | */ |
1009 | if (scan_should_stop()) | 1109 | if (scan_should_stop() || gray_list_pass >= GRAY_LIST_PASSES) |
1010 | return; | 1110 | return; |
1011 | 1111 | ||
1012 | /* | 1112 | /* |
@@ -1039,6 +1139,7 @@ static int kmemleak_scan_thread(void *arg) | |||
1039 | static int first_run = 1; | 1139 | static int first_run = 1; |
1040 | 1140 | ||
1041 | pr_info("Automatic memory scanning thread started\n"); | 1141 | pr_info("Automatic memory scanning thread started\n"); |
1142 | set_user_nice(current, 10); | ||
1042 | 1143 | ||
1043 | /* | 1144 | /* |
1044 | * Wait before the first scan to allow the system to fully initialize. | 1145 | * Wait before the first scan to allow the system to fully initialize. |
@@ -1101,11 +1202,11 @@ static void *kmemleak_seq_start(struct seq_file *seq, loff_t *pos) | |||
1101 | { | 1202 | { |
1102 | struct kmemleak_object *object; | 1203 | struct kmemleak_object *object; |
1103 | loff_t n = *pos; | 1204 | loff_t n = *pos; |
1205 | int err; | ||
1104 | 1206 | ||
1105 | if (!n) | 1207 | err = mutex_lock_interruptible(&scan_mutex); |
1106 | reported_leaks = 0; | 1208 | if (err < 0) |
1107 | if (reported_leaks >= REPORTS_NR) | 1209 | return ERR_PTR(err); |
1108 | return NULL; | ||
1109 | 1210 | ||
1110 | rcu_read_lock(); | 1211 | rcu_read_lock(); |
1111 | list_for_each_entry_rcu(object, &object_list, object_list) { | 1212 | list_for_each_entry_rcu(object, &object_list, object_list) { |
@@ -1131,8 +1232,6 @@ static void *kmemleak_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
1131 | struct list_head *n = &prev_obj->object_list; | 1232 | struct list_head *n = &prev_obj->object_list; |
1132 | 1233 | ||
1133 | ++(*pos); | 1234 | ++(*pos); |
1134 | if (reported_leaks >= REPORTS_NR) | ||
1135 | goto out; | ||
1136 | 1235 | ||
1137 | rcu_read_lock(); | 1236 | rcu_read_lock(); |
1138 | list_for_each_continue_rcu(n, &object_list) { | 1237 | list_for_each_continue_rcu(n, &object_list) { |
@@ -1141,7 +1240,7 @@ static void *kmemleak_seq_next(struct seq_file *seq, void *v, loff_t *pos) | |||
1141 | break; | 1240 | break; |
1142 | } | 1241 | } |
1143 | rcu_read_unlock(); | 1242 | rcu_read_unlock(); |
1144 | out: | 1243 | |
1145 | put_object(prev_obj); | 1244 | put_object(prev_obj); |
1146 | return next_obj; | 1245 | return next_obj; |
1147 | } | 1246 | } |
@@ -1151,8 +1250,15 @@ out: | |||
1151 | */ | 1250 | */ |
1152 | static void kmemleak_seq_stop(struct seq_file *seq, void *v) | 1251 | static void kmemleak_seq_stop(struct seq_file *seq, void *v) |
1153 | { | 1252 | { |
1154 | if (v) | 1253 | if (!IS_ERR(v)) { |
1155 | put_object(v); | 1254 | /* |
1255 | * kmemleak_seq_start may return ERR_PTR if the scan_mutex | ||
1256 | * waiting was interrupted, so only release it if !IS_ERR. | ||
1257 | */ | ||
1258 | mutex_unlock(&scan_mutex); | ||
1259 | if (v) | ||
1260 | put_object(v); | ||
1261 | } | ||
1156 | } | 1262 | } |
1157 | 1263 | ||
1158 | /* | 1264 | /* |
@@ -1164,10 +1270,8 @@ static int kmemleak_seq_show(struct seq_file *seq, void *v) | |||
1164 | unsigned long flags; | 1270 | unsigned long flags; |
1165 | 1271 | ||
1166 | spin_lock_irqsave(&object->lock, flags); | 1272 | spin_lock_irqsave(&object->lock, flags); |
1167 | if ((object->flags & OBJECT_REPORTED) && unreferenced_object(object)) { | 1273 | if ((object->flags & OBJECT_REPORTED) && unreferenced_object(object)) |
1168 | print_unreferenced(seq, object); | 1274 | print_unreferenced(seq, object); |
1169 | reported_leaks++; | ||
1170 | } | ||
1171 | spin_unlock_irqrestore(&object->lock, flags); | 1275 | spin_unlock_irqrestore(&object->lock, flags); |
1172 | return 0; | 1276 | return 0; |
1173 | } | 1277 | } |
@@ -1181,36 +1285,15 @@ static const struct seq_operations kmemleak_seq_ops = { | |||
1181 | 1285 | ||
1182 | static int kmemleak_open(struct inode *inode, struct file *file) | 1286 | static int kmemleak_open(struct inode *inode, struct file *file) |
1183 | { | 1287 | { |
1184 | int ret = 0; | ||
1185 | |||
1186 | if (!atomic_read(&kmemleak_enabled)) | 1288 | if (!atomic_read(&kmemleak_enabled)) |
1187 | return -EBUSY; | 1289 | return -EBUSY; |
1188 | 1290 | ||
1189 | ret = mutex_lock_interruptible(&scan_mutex); | 1291 | return seq_open(file, &kmemleak_seq_ops); |
1190 | if (ret < 0) | ||
1191 | goto out; | ||
1192 | if (file->f_mode & FMODE_READ) { | ||
1193 | ret = seq_open(file, &kmemleak_seq_ops); | ||
1194 | if (ret < 0) | ||
1195 | goto scan_unlock; | ||
1196 | } | ||
1197 | return ret; | ||
1198 | |||
1199 | scan_unlock: | ||
1200 | mutex_unlock(&scan_mutex); | ||
1201 | out: | ||
1202 | return ret; | ||
1203 | } | 1292 | } |
1204 | 1293 | ||
1205 | static int kmemleak_release(struct inode *inode, struct file *file) | 1294 | static int kmemleak_release(struct inode *inode, struct file *file) |
1206 | { | 1295 | { |
1207 | int ret = 0; | 1296 | return seq_release(inode, file); |
1208 | |||
1209 | if (file->f_mode & FMODE_READ) | ||
1210 | seq_release(inode, file); | ||
1211 | mutex_unlock(&scan_mutex); | ||
1212 | |||
1213 | return ret; | ||
1214 | } | 1297 | } |
1215 | 1298 | ||
1216 | /* | 1299 | /* |
@@ -1230,15 +1313,17 @@ static ssize_t kmemleak_write(struct file *file, const char __user *user_buf, | |||
1230 | { | 1313 | { |
1231 | char buf[64]; | 1314 | char buf[64]; |
1232 | int buf_size; | 1315 | int buf_size; |
1233 | 1316 | int ret; | |
1234 | if (!atomic_read(&kmemleak_enabled)) | ||
1235 | return -EBUSY; | ||
1236 | 1317 | ||
1237 | buf_size = min(size, (sizeof(buf) - 1)); | 1318 | buf_size = min(size, (sizeof(buf) - 1)); |
1238 | if (strncpy_from_user(buf, user_buf, buf_size) < 0) | 1319 | if (strncpy_from_user(buf, user_buf, buf_size) < 0) |
1239 | return -EFAULT; | 1320 | return -EFAULT; |
1240 | buf[buf_size] = 0; | 1321 | buf[buf_size] = 0; |
1241 | 1322 | ||
1323 | ret = mutex_lock_interruptible(&scan_mutex); | ||
1324 | if (ret < 0) | ||
1325 | return ret; | ||
1326 | |||
1242 | if (strncmp(buf, "off", 3) == 0) | 1327 | if (strncmp(buf, "off", 3) == 0) |
1243 | kmemleak_disable(); | 1328 | kmemleak_disable(); |
1244 | else if (strncmp(buf, "stack=on", 8) == 0) | 1329 | else if (strncmp(buf, "stack=on", 8) == 0) |
@@ -1251,11 +1336,10 @@ static ssize_t kmemleak_write(struct file *file, const char __user *user_buf, | |||
1251 | stop_scan_thread(); | 1336 | stop_scan_thread(); |
1252 | else if (strncmp(buf, "scan=", 5) == 0) { | 1337 | else if (strncmp(buf, "scan=", 5) == 0) { |
1253 | unsigned long secs; | 1338 | unsigned long secs; |
1254 | int err; | ||
1255 | 1339 | ||
1256 | err = strict_strtoul(buf + 5, 0, &secs); | 1340 | ret = strict_strtoul(buf + 5, 0, &secs); |
1257 | if (err < 0) | 1341 | if (ret < 0) |
1258 | return err; | 1342 | goto out; |
1259 | stop_scan_thread(); | 1343 | stop_scan_thread(); |
1260 | if (secs) { | 1344 | if (secs) { |
1261 | jiffies_scan_wait = msecs_to_jiffies(secs * 1000); | 1345 | jiffies_scan_wait = msecs_to_jiffies(secs * 1000); |
@@ -1264,7 +1348,12 @@ static ssize_t kmemleak_write(struct file *file, const char __user *user_buf, | |||
1264 | } else if (strncmp(buf, "scan", 4) == 0) | 1348 | } else if (strncmp(buf, "scan", 4) == 0) |
1265 | kmemleak_scan(); | 1349 | kmemleak_scan(); |
1266 | else | 1350 | else |
1267 | return -EINVAL; | 1351 | ret = -EINVAL; |
1352 | |||
1353 | out: | ||
1354 | mutex_unlock(&scan_mutex); | ||
1355 | if (ret < 0) | ||
1356 | return ret; | ||
1268 | 1357 | ||
1269 | /* ignore the rest of the buffer, only one command at a time */ | 1358 | /* ignore the rest of the buffer, only one command at a time */ |
1270 | *ppos += size; | 1359 | *ppos += size; |
@@ -1293,7 +1382,7 @@ static int kmemleak_cleanup_thread(void *arg) | |||
1293 | 1382 | ||
1294 | rcu_read_lock(); | 1383 | rcu_read_lock(); |
1295 | list_for_each_entry_rcu(object, &object_list, object_list) | 1384 | list_for_each_entry_rcu(object, &object_list, object_list) |
1296 | delete_object(object->pointer); | 1385 | delete_object_full(object->pointer); |
1297 | rcu_read_unlock(); | 1386 | rcu_read_unlock(); |
1298 | mutex_unlock(&scan_mutex); | 1387 | mutex_unlock(&scan_mutex); |
1299 | 1388 | ||
@@ -1388,6 +1477,9 @@ void __init kmemleak_init(void) | |||
1388 | case KMEMLEAK_FREE: | 1477 | case KMEMLEAK_FREE: |
1389 | kmemleak_free(log->ptr); | 1478 | kmemleak_free(log->ptr); |
1390 | break; | 1479 | break; |
1480 | case KMEMLEAK_FREE_PART: | ||
1481 | kmemleak_free_part(log->ptr, log->size); | ||
1482 | break; | ||
1391 | case KMEMLEAK_NOT_LEAK: | 1483 | case KMEMLEAK_NOT_LEAK: |
1392 | kmemleak_not_leak(log->ptr); | 1484 | kmemleak_not_leak(log->ptr); |
1393 | break; | 1485 | break; |
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index e2fa20dadf40..e717964cb5a0 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c | |||
@@ -1973,7 +1973,7 @@ try_to_free: | |||
1973 | if (!progress) { | 1973 | if (!progress) { |
1974 | nr_retries--; | 1974 | nr_retries--; |
1975 | /* maybe some writeback is necessary */ | 1975 | /* maybe some writeback is necessary */ |
1976 | congestion_wait(WRITE, HZ/10); | 1976 | congestion_wait(BLK_RW_ASYNC, HZ/10); |
1977 | } | 1977 | } |
1978 | 1978 | ||
1979 | } | 1979 | } |
diff --git a/mm/page-writeback.c b/mm/page-writeback.c index 7687879253b9..81627ebcd313 100644 --- a/mm/page-writeback.c +++ b/mm/page-writeback.c | |||
@@ -575,7 +575,7 @@ static void balance_dirty_pages(struct address_space *mapping) | |||
575 | if (pages_written >= write_chunk) | 575 | if (pages_written >= write_chunk) |
576 | break; /* We've done our duty */ | 576 | break; /* We've done our duty */ |
577 | 577 | ||
578 | congestion_wait(WRITE, HZ/10); | 578 | congestion_wait(BLK_RW_ASYNC, HZ/10); |
579 | } | 579 | } |
580 | 580 | ||
581 | if (bdi_nr_reclaimable + bdi_nr_writeback < bdi_thresh && | 581 | if (bdi_nr_reclaimable + bdi_nr_writeback < bdi_thresh && |
@@ -669,7 +669,7 @@ void throttle_vm_writeout(gfp_t gfp_mask) | |||
669 | if (global_page_state(NR_UNSTABLE_NFS) + | 669 | if (global_page_state(NR_UNSTABLE_NFS) + |
670 | global_page_state(NR_WRITEBACK) <= dirty_thresh) | 670 | global_page_state(NR_WRITEBACK) <= dirty_thresh) |
671 | break; | 671 | break; |
672 | congestion_wait(WRITE, HZ/10); | 672 | congestion_wait(BLK_RW_ASYNC, HZ/10); |
673 | 673 | ||
674 | /* | 674 | /* |
675 | * The caller might hold locks which can prevent IO completion | 675 | * The caller might hold locks which can prevent IO completion |
@@ -715,7 +715,7 @@ static void background_writeout(unsigned long _min_pages) | |||
715 | if (wbc.nr_to_write > 0 || wbc.pages_skipped > 0) { | 715 | if (wbc.nr_to_write > 0 || wbc.pages_skipped > 0) { |
716 | /* Wrote less than expected */ | 716 | /* Wrote less than expected */ |
717 | if (wbc.encountered_congestion || wbc.more_io) | 717 | if (wbc.encountered_congestion || wbc.more_io) |
718 | congestion_wait(WRITE, HZ/10); | 718 | congestion_wait(BLK_RW_ASYNC, HZ/10); |
719 | else | 719 | else |
720 | break; | 720 | break; |
721 | } | 721 | } |
@@ -787,7 +787,7 @@ static void wb_kupdate(unsigned long arg) | |||
787 | writeback_inodes(&wbc); | 787 | writeback_inodes(&wbc); |
788 | if (wbc.nr_to_write > 0) { | 788 | if (wbc.nr_to_write > 0) { |
789 | if (wbc.encountered_congestion || wbc.more_io) | 789 | if (wbc.encountered_congestion || wbc.more_io) |
790 | congestion_wait(WRITE, HZ/10); | 790 | congestion_wait(BLK_RW_ASYNC, HZ/10); |
791 | else | 791 | else |
792 | break; /* All the old data is written */ | 792 | break; /* All the old data is written */ |
793 | } | 793 | } |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index e0f2cdf9d8b1..caa92689aac9 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -1666,7 +1666,7 @@ __alloc_pages_high_priority(gfp_t gfp_mask, unsigned int order, | |||
1666 | preferred_zone, migratetype); | 1666 | preferred_zone, migratetype); |
1667 | 1667 | ||
1668 | if (!page && gfp_mask & __GFP_NOFAIL) | 1668 | if (!page && gfp_mask & __GFP_NOFAIL) |
1669 | congestion_wait(WRITE, HZ/50); | 1669 | congestion_wait(BLK_RW_ASYNC, HZ/50); |
1670 | } while (!page && (gfp_mask & __GFP_NOFAIL)); | 1670 | } while (!page && (gfp_mask & __GFP_NOFAIL)); |
1671 | 1671 | ||
1672 | return page; | 1672 | return page; |
@@ -1831,7 +1831,7 @@ rebalance: | |||
1831 | pages_reclaimed += did_some_progress; | 1831 | pages_reclaimed += did_some_progress; |
1832 | if (should_alloc_retry(gfp_mask, order, pages_reclaimed)) { | 1832 | if (should_alloc_retry(gfp_mask, order, pages_reclaimed)) { |
1833 | /* Wait for some write requests to complete then retry */ | 1833 | /* Wait for some write requests to complete then retry */ |
1834 | congestion_wait(WRITE, HZ/50); | 1834 | congestion_wait(BLK_RW_ASYNC, HZ/50); |
1835 | goto rebalance; | 1835 | goto rebalance; |
1836 | } | 1836 | } |
1837 | 1837 | ||
@@ -1983,7 +1983,7 @@ void *alloc_pages_exact(size_t size, gfp_t gfp_mask) | |||
1983 | unsigned long alloc_end = addr + (PAGE_SIZE << order); | 1983 | unsigned long alloc_end = addr + (PAGE_SIZE << order); |
1984 | unsigned long used = addr + PAGE_ALIGN(size); | 1984 | unsigned long used = addr + PAGE_ALIGN(size); |
1985 | 1985 | ||
1986 | split_page(virt_to_page(addr), order); | 1986 | split_page(virt_to_page((void *)addr), order); |
1987 | while (used < alloc_end) { | 1987 | while (used < alloc_end) { |
1988 | free_page(used); | 1988 | free_page(used); |
1989 | used += PAGE_SIZE; | 1989 | used += PAGE_SIZE; |
@@ -4745,8 +4745,10 @@ void *__init alloc_large_system_hash(const char *tablename, | |||
4745 | * some pages at the end of hash table which | 4745 | * some pages at the end of hash table which |
4746 | * alloc_pages_exact() automatically does | 4746 | * alloc_pages_exact() automatically does |
4747 | */ | 4747 | */ |
4748 | if (get_order(size) < MAX_ORDER) | 4748 | if (get_order(size) < MAX_ORDER) { |
4749 | table = alloc_pages_exact(size, GFP_ATOMIC); | 4749 | table = alloc_pages_exact(size, GFP_ATOMIC); |
4750 | kmemleak_alloc(table, size, 1, GFP_ATOMIC); | ||
4751 | } | ||
4750 | } | 4752 | } |
4751 | } while (!table && size > PAGE_SIZE && --log2qty); | 4753 | } while (!table && size > PAGE_SIZE && --log2qty); |
4752 | 4754 | ||
@@ -4764,16 +4766,6 @@ void *__init alloc_large_system_hash(const char *tablename, | |||
4764 | if (_hash_mask) | 4766 | if (_hash_mask) |
4765 | *_hash_mask = (1 << log2qty) - 1; | 4767 | *_hash_mask = (1 << log2qty) - 1; |
4766 | 4768 | ||
4767 | /* | ||
4768 | * If hashdist is set, the table allocation is done with __vmalloc() | ||
4769 | * which invokes the kmemleak_alloc() callback. This function may also | ||
4770 | * be called before the slab and kmemleak are initialised when | ||
4771 | * kmemleak simply buffers the request to be executed later | ||
4772 | * (GFP_ATOMIC flag ignored in this case). | ||
4773 | */ | ||
4774 | if (!hashdist) | ||
4775 | kmemleak_alloc(table, size, 1, GFP_ATOMIC); | ||
4776 | |||
4777 | return table; | 4769 | return table; |
4778 | } | 4770 | } |
4779 | 4771 | ||
@@ -1544,9 +1544,6 @@ void __init kmem_cache_init(void) | |||
1544 | } | 1544 | } |
1545 | 1545 | ||
1546 | g_cpucache_up = EARLY; | 1546 | g_cpucache_up = EARLY; |
1547 | |||
1548 | /* Annotate slab for lockdep -- annotate the malloc caches */ | ||
1549 | init_lock_keys(); | ||
1550 | } | 1547 | } |
1551 | 1548 | ||
1552 | void __init kmem_cache_init_late(void) | 1549 | void __init kmem_cache_init_late(void) |
@@ -1563,6 +1560,9 @@ void __init kmem_cache_init_late(void) | |||
1563 | /* Done! */ | 1560 | /* Done! */ |
1564 | g_cpucache_up = FULL; | 1561 | g_cpucache_up = FULL; |
1565 | 1562 | ||
1563 | /* Annotate slab for lockdep -- annotate the malloc caches */ | ||
1564 | init_lock_keys(); | ||
1565 | |||
1566 | /* | 1566 | /* |
1567 | * Register a cpu startup notifier callback that initializes | 1567 | * Register a cpu startup notifier callback that initializes |
1568 | * cpu_cache_get for all new cpus | 1568 | * cpu_cache_get for all new cpus |
@@ -2547,7 +2547,7 @@ void kmem_cache_destroy(struct kmem_cache *cachep) | |||
2547 | } | 2547 | } |
2548 | 2548 | ||
2549 | if (unlikely(cachep->flags & SLAB_DESTROY_BY_RCU)) | 2549 | if (unlikely(cachep->flags & SLAB_DESTROY_BY_RCU)) |
2550 | synchronize_rcu(); | 2550 | rcu_barrier(); |
2551 | 2551 | ||
2552 | __kmem_cache_destroy(cachep); | 2552 | __kmem_cache_destroy(cachep); |
2553 | mutex_unlock(&cache_chain_mutex); | 2553 | mutex_unlock(&cache_chain_mutex); |
@@ -595,6 +595,8 @@ EXPORT_SYMBOL(kmem_cache_create); | |||
595 | void kmem_cache_destroy(struct kmem_cache *c) | 595 | void kmem_cache_destroy(struct kmem_cache *c) |
596 | { | 596 | { |
597 | kmemleak_free(c); | 597 | kmemleak_free(c); |
598 | if (c->flags & SLAB_DESTROY_BY_RCU) | ||
599 | rcu_barrier(); | ||
598 | slob_free(c, sizeof(struct kmem_cache)); | 600 | slob_free(c, sizeof(struct kmem_cache)); |
599 | } | 601 | } |
600 | EXPORT_SYMBOL(kmem_cache_destroy); | 602 | EXPORT_SYMBOL(kmem_cache_destroy); |
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/kmemcheck.h> | 21 | #include <linux/kmemcheck.h> |
22 | #include <linux/cpu.h> | 22 | #include <linux/cpu.h> |
23 | #include <linux/cpuset.h> | 23 | #include <linux/cpuset.h> |
24 | #include <linux/kmemleak.h> | ||
25 | #include <linux/mempolicy.h> | 24 | #include <linux/mempolicy.h> |
26 | #include <linux/ctype.h> | 25 | #include <linux/ctype.h> |
27 | #include <linux/debugobjects.h> | 26 | #include <linux/debugobjects.h> |
@@ -2595,6 +2594,8 @@ static inline int kmem_cache_close(struct kmem_cache *s) | |||
2595 | */ | 2594 | */ |
2596 | void kmem_cache_destroy(struct kmem_cache *s) | 2595 | void kmem_cache_destroy(struct kmem_cache *s) |
2597 | { | 2596 | { |
2597 | if (s->flags & SLAB_DESTROY_BY_RCU) | ||
2598 | rcu_barrier(); | ||
2598 | down_write(&slub_lock); | 2599 | down_write(&slub_lock); |
2599 | s->refcount--; | 2600 | s->refcount--; |
2600 | if (!s->refcount) { | 2601 | if (!s->refcount) { |
@@ -2833,13 +2834,15 @@ EXPORT_SYMBOL(__kmalloc); | |||
2833 | static void *kmalloc_large_node(size_t size, gfp_t flags, int node) | 2834 | static void *kmalloc_large_node(size_t size, gfp_t flags, int node) |
2834 | { | 2835 | { |
2835 | struct page *page; | 2836 | struct page *page; |
2837 | void *ptr = NULL; | ||
2836 | 2838 | ||
2837 | flags |= __GFP_COMP | __GFP_NOTRACK; | 2839 | flags |= __GFP_COMP | __GFP_NOTRACK; |
2838 | page = alloc_pages_node(node, flags, get_order(size)); | 2840 | page = alloc_pages_node(node, flags, get_order(size)); |
2839 | if (page) | 2841 | if (page) |
2840 | return page_address(page); | 2842 | ptr = page_address(page); |
2841 | else | 2843 | |
2842 | return NULL; | 2844 | kmemleak_alloc(ptr, size, 1, flags); |
2845 | return ptr; | ||
2843 | } | 2846 | } |
2844 | 2847 | ||
2845 | #ifdef CONFIG_NUMA | 2848 | #ifdef CONFIG_NUMA |
@@ -2924,6 +2927,7 @@ void kfree(const void *x) | |||
2924 | page = virt_to_head_page(x); | 2927 | page = virt_to_head_page(x); |
2925 | if (unlikely(!PageSlab(page))) { | 2928 | if (unlikely(!PageSlab(page))) { |
2926 | BUG_ON(!PageCompound(page)); | 2929 | BUG_ON(!PageCompound(page)); |
2930 | kmemleak_free(x); | ||
2927 | put_page(page); | 2931 | put_page(page); |
2928 | return; | 2932 | return; |
2929 | } | 2933 | } |
diff --git a/mm/vmscan.c b/mm/vmscan.c index 54155268dfca..dea7abd31098 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -1104,7 +1104,7 @@ static unsigned long shrink_inactive_list(unsigned long max_scan, | |||
1104 | */ | 1104 | */ |
1105 | if (nr_freed < nr_taken && !current_is_kswapd() && | 1105 | if (nr_freed < nr_taken && !current_is_kswapd() && |
1106 | lumpy_reclaim) { | 1106 | lumpy_reclaim) { |
1107 | congestion_wait(WRITE, HZ/10); | 1107 | congestion_wait(BLK_RW_ASYNC, HZ/10); |
1108 | 1108 | ||
1109 | /* | 1109 | /* |
1110 | * The attempt at page out may have made some | 1110 | * The attempt at page out may have made some |
@@ -1721,7 +1721,7 @@ static unsigned long do_try_to_free_pages(struct zonelist *zonelist, | |||
1721 | 1721 | ||
1722 | /* Take a nap, wait for some writeback to complete */ | 1722 | /* Take a nap, wait for some writeback to complete */ |
1723 | if (sc->nr_scanned && priority < DEF_PRIORITY - 2) | 1723 | if (sc->nr_scanned && priority < DEF_PRIORITY - 2) |
1724 | congestion_wait(WRITE, HZ/10); | 1724 | congestion_wait(BLK_RW_ASYNC, HZ/10); |
1725 | } | 1725 | } |
1726 | /* top priority shrink_zones still had more to do? don't OOM, then */ | 1726 | /* top priority shrink_zones still had more to do? don't OOM, then */ |
1727 | if (!sc->all_unreclaimable && scanning_global_lru(sc)) | 1727 | if (!sc->all_unreclaimable && scanning_global_lru(sc)) |
@@ -1960,7 +1960,7 @@ loop_again: | |||
1960 | * another pass across the zones. | 1960 | * another pass across the zones. |
1961 | */ | 1961 | */ |
1962 | if (total_scanned && priority < DEF_PRIORITY - 2) | 1962 | if (total_scanned && priority < DEF_PRIORITY - 2) |
1963 | congestion_wait(WRITE, HZ/10); | 1963 | congestion_wait(BLK_RW_ASYNC, HZ/10); |
1964 | 1964 | ||
1965 | /* | 1965 | /* |
1966 | * We do this so kswapd doesn't build up large priorities for | 1966 | * We do this so kswapd doesn't build up large priorities for |
@@ -2233,7 +2233,7 @@ unsigned long shrink_all_memory(unsigned long nr_pages) | |||
2233 | goto out; | 2233 | goto out; |
2234 | 2234 | ||
2235 | if (sc.nr_scanned && prio < DEF_PRIORITY - 2) | 2235 | if (sc.nr_scanned && prio < DEF_PRIORITY - 2) |
2236 | congestion_wait(WRITE, HZ / 10); | 2236 | congestion_wait(BLK_RW_ASYNC, HZ / 10); |
2237 | } | 2237 | } |
2238 | } | 2238 | } |
2239 | 2239 | ||
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c index a2a1814c7a8d..8c2588e4edc0 100644 --- a/net/9p/trans_fd.c +++ b/net/9p/trans_fd.c | |||
@@ -735,12 +735,14 @@ static int parse_opts(char *params, struct p9_fd_opts *opts) | |||
735 | if (!*p) | 735 | if (!*p) |
736 | continue; | 736 | continue; |
737 | token = match_token(p, tokens, args); | 737 | token = match_token(p, tokens, args); |
738 | r = match_int(&args[0], &option); | 738 | if (token != Opt_err) { |
739 | if (r < 0) { | 739 | r = match_int(&args[0], &option); |
740 | P9_DPRINTK(P9_DEBUG_ERROR, | 740 | if (r < 0) { |
741 | "integer field, but no integer?\n"); | 741 | P9_DPRINTK(P9_DEBUG_ERROR, |
742 | ret = r; | 742 | "integer field, but no integer?\n"); |
743 | continue; | 743 | ret = r; |
744 | continue; | ||
745 | } | ||
744 | } | 746 | } |
745 | switch (token) { | 747 | switch (token) { |
746 | case Opt_port: | 748 | case Opt_port: |
diff --git a/net/appletalk/ddp.c b/net/appletalk/ddp.c index 590b83963622..bfbe13786bb4 100644 --- a/net/appletalk/ddp.c +++ b/net/appletalk/ddp.c | |||
@@ -54,6 +54,7 @@ | |||
54 | #include <linux/capability.h> | 54 | #include <linux/capability.h> |
55 | #include <linux/module.h> | 55 | #include <linux/module.h> |
56 | #include <linux/if_arp.h> | 56 | #include <linux/if_arp.h> |
57 | #include <linux/smp_lock.h> | ||
57 | #include <linux/termios.h> /* For TIOCOUTQ/INQ */ | 58 | #include <linux/termios.h> /* For TIOCOUTQ/INQ */ |
58 | #include <net/datalink.h> | 59 | #include <net/datalink.h> |
59 | #include <net/psnap.h> | 60 | #include <net/psnap.h> |
diff --git a/net/atm/common.c b/net/atm/common.c index c1c97936192c..8c4d843eb17f 100644 --- a/net/atm/common.c +++ b/net/atm/common.c | |||
@@ -92,7 +92,7 @@ static void vcc_sock_destruct(struct sock *sk) | |||
92 | static void vcc_def_wakeup(struct sock *sk) | 92 | static void vcc_def_wakeup(struct sock *sk) |
93 | { | 93 | { |
94 | read_lock(&sk->sk_callback_lock); | 94 | read_lock(&sk->sk_callback_lock); |
95 | if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) | 95 | if (sk_has_sleeper(sk)) |
96 | wake_up(sk->sk_sleep); | 96 | wake_up(sk->sk_sleep); |
97 | read_unlock(&sk->sk_callback_lock); | 97 | read_unlock(&sk->sk_callback_lock); |
98 | } | 98 | } |
@@ -110,7 +110,7 @@ static void vcc_write_space(struct sock *sk) | |||
110 | read_lock(&sk->sk_callback_lock); | 110 | read_lock(&sk->sk_callback_lock); |
111 | 111 | ||
112 | if (vcc_writable(sk)) { | 112 | if (vcc_writable(sk)) { |
113 | if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) | 113 | if (sk_has_sleeper(sk)) |
114 | wake_up_interruptible(sk->sk_sleep); | 114 | wake_up_interruptible(sk->sk_sleep); |
115 | 115 | ||
116 | sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT); | 116 | sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT); |
@@ -594,7 +594,7 @@ unsigned int vcc_poll(struct file *file, struct socket *sock, poll_table *wait) | |||
594 | struct atm_vcc *vcc; | 594 | struct atm_vcc *vcc; |
595 | unsigned int mask; | 595 | unsigned int mask; |
596 | 596 | ||
597 | poll_wait(file, sk->sk_sleep, wait); | 597 | sock_poll_wait(file, sk->sk_sleep, wait); |
598 | mask = 0; | 598 | mask = 0; |
599 | 599 | ||
600 | vcc = ATM_SD(sock); | 600 | vcc = ATM_SD(sock); |
diff --git a/net/core/datagram.c b/net/core/datagram.c index 58abee1f1df1..b0fe69211eef 100644 --- a/net/core/datagram.c +++ b/net/core/datagram.c | |||
@@ -712,7 +712,7 @@ unsigned int datagram_poll(struct file *file, struct socket *sock, | |||
712 | struct sock *sk = sock->sk; | 712 | struct sock *sk = sock->sk; |
713 | unsigned int mask; | 713 | unsigned int mask; |
714 | 714 | ||
715 | poll_wait(file, sk->sk_sleep, wait); | 715 | sock_poll_wait(file, sk->sk_sleep, wait); |
716 | mask = 0; | 716 | mask = 0; |
717 | 717 | ||
718 | /* exceptional events? */ | 718 | /* exceptional events? */ |
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index 9675f312830d..df30feb2fc72 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c | |||
@@ -740,7 +740,7 @@ int netpoll_setup(struct netpoll *np) | |||
740 | np->name); | 740 | np->name); |
741 | break; | 741 | break; |
742 | } | 742 | } |
743 | cond_resched(); | 743 | msleep(1); |
744 | } | 744 | } |
745 | 745 | ||
746 | /* If carrier appears to come up instantly, we don't | 746 | /* If carrier appears to come up instantly, we don't |
diff --git a/net/core/sock.c b/net/core/sock.c index b0ba569bc973..6354863b1c68 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -1715,7 +1715,7 @@ EXPORT_SYMBOL(sock_no_sendpage); | |||
1715 | static void sock_def_wakeup(struct sock *sk) | 1715 | static void sock_def_wakeup(struct sock *sk) |
1716 | { | 1716 | { |
1717 | read_lock(&sk->sk_callback_lock); | 1717 | read_lock(&sk->sk_callback_lock); |
1718 | if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) | 1718 | if (sk_has_sleeper(sk)) |
1719 | wake_up_interruptible_all(sk->sk_sleep); | 1719 | wake_up_interruptible_all(sk->sk_sleep); |
1720 | read_unlock(&sk->sk_callback_lock); | 1720 | read_unlock(&sk->sk_callback_lock); |
1721 | } | 1721 | } |
@@ -1723,7 +1723,7 @@ static void sock_def_wakeup(struct sock *sk) | |||
1723 | static void sock_def_error_report(struct sock *sk) | 1723 | static void sock_def_error_report(struct sock *sk) |
1724 | { | 1724 | { |
1725 | read_lock(&sk->sk_callback_lock); | 1725 | read_lock(&sk->sk_callback_lock); |
1726 | if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) | 1726 | if (sk_has_sleeper(sk)) |
1727 | wake_up_interruptible_poll(sk->sk_sleep, POLLERR); | 1727 | wake_up_interruptible_poll(sk->sk_sleep, POLLERR); |
1728 | sk_wake_async(sk, SOCK_WAKE_IO, POLL_ERR); | 1728 | sk_wake_async(sk, SOCK_WAKE_IO, POLL_ERR); |
1729 | read_unlock(&sk->sk_callback_lock); | 1729 | read_unlock(&sk->sk_callback_lock); |
@@ -1732,7 +1732,7 @@ static void sock_def_error_report(struct sock *sk) | |||
1732 | static void sock_def_readable(struct sock *sk, int len) | 1732 | static void sock_def_readable(struct sock *sk, int len) |
1733 | { | 1733 | { |
1734 | read_lock(&sk->sk_callback_lock); | 1734 | read_lock(&sk->sk_callback_lock); |
1735 | if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) | 1735 | if (sk_has_sleeper(sk)) |
1736 | wake_up_interruptible_sync_poll(sk->sk_sleep, POLLIN | | 1736 | wake_up_interruptible_sync_poll(sk->sk_sleep, POLLIN | |
1737 | POLLRDNORM | POLLRDBAND); | 1737 | POLLRDNORM | POLLRDBAND); |
1738 | sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_IN); | 1738 | sk_wake_async(sk, SOCK_WAKE_WAITD, POLL_IN); |
@@ -1747,7 +1747,7 @@ static void sock_def_write_space(struct sock *sk) | |||
1747 | * progress. --DaveM | 1747 | * progress. --DaveM |
1748 | */ | 1748 | */ |
1749 | if ((atomic_read(&sk->sk_wmem_alloc) << 1) <= sk->sk_sndbuf) { | 1749 | if ((atomic_read(&sk->sk_wmem_alloc) << 1) <= sk->sk_sndbuf) { |
1750 | if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) | 1750 | if (sk_has_sleeper(sk)) |
1751 | wake_up_interruptible_sync_poll(sk->sk_sleep, POLLOUT | | 1751 | wake_up_interruptible_sync_poll(sk->sk_sleep, POLLOUT | |
1752 | POLLWRNORM | POLLWRBAND); | 1752 | POLLWRNORM | POLLWRBAND); |
1753 | 1753 | ||
diff --git a/net/dccp/output.c b/net/dccp/output.c index c0e88c16d088..c96119fda688 100644 --- a/net/dccp/output.c +++ b/net/dccp/output.c | |||
@@ -196,7 +196,7 @@ void dccp_write_space(struct sock *sk) | |||
196 | { | 196 | { |
197 | read_lock(&sk->sk_callback_lock); | 197 | read_lock(&sk->sk_callback_lock); |
198 | 198 | ||
199 | if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) | 199 | if (sk_has_sleeper(sk)) |
200 | wake_up_interruptible(sk->sk_sleep); | 200 | wake_up_interruptible(sk->sk_sleep); |
201 | /* Should agree with poll, otherwise some programs break */ | 201 | /* Should agree with poll, otherwise some programs break */ |
202 | if (sock_writeable(sk)) | 202 | if (sock_writeable(sk)) |
diff --git a/net/dccp/proto.c b/net/dccp/proto.c index 314a1b5c033c..94ca8eaace7d 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c | |||
@@ -311,7 +311,7 @@ unsigned int dccp_poll(struct file *file, struct socket *sock, | |||
311 | unsigned int mask; | 311 | unsigned int mask; |
312 | struct sock *sk = sock->sk; | 312 | struct sock *sk = sock->sk; |
313 | 313 | ||
314 | poll_wait(file, sk->sk_sleep, wait); | 314 | sock_poll_wait(file, sk->sk_sleep, wait); |
315 | if (sk->sk_state == DCCP_LISTEN) | 315 | if (sk->sk_state == DCCP_LISTEN) |
316 | return inet_csk_listen_poll(sk); | 316 | return inet_csk_listen_poll(sk); |
317 | 317 | ||
diff --git a/net/dsa/mv88e6xxx.c b/net/dsa/mv88e6xxx.c index 4e4d8b5ad03d..efe661a9def4 100644 --- a/net/dsa/mv88e6xxx.c +++ b/net/dsa/mv88e6xxx.c | |||
@@ -418,7 +418,7 @@ static int mv88e6xxx_stats_wait(struct dsa_switch *ds) | |||
418 | int i; | 418 | int i; |
419 | 419 | ||
420 | for (i = 0; i < 10; i++) { | 420 | for (i = 0; i < 10; i++) { |
421 | ret = REG_READ(REG_GLOBAL2, 0x1d); | 421 | ret = REG_READ(REG_GLOBAL, 0x1d); |
422 | if ((ret & 0x8000) == 0) | 422 | if ((ret & 0x8000) == 0) |
423 | return 0; | 423 | return 0; |
424 | } | 424 | } |
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c index 00a54b246dfe..63c2fa7b68c4 100644 --- a/net/ipv4/fib_trie.c +++ b/net/ipv4/fib_trie.c | |||
@@ -316,8 +316,8 @@ static inline void check_tnode(const struct tnode *tn) | |||
316 | 316 | ||
317 | static const int halve_threshold = 25; | 317 | static const int halve_threshold = 25; |
318 | static const int inflate_threshold = 50; | 318 | static const int inflate_threshold = 50; |
319 | static const int halve_threshold_root = 8; | 319 | static const int halve_threshold_root = 15; |
320 | static const int inflate_threshold_root = 15; | 320 | static const int inflate_threshold_root = 25; |
321 | 321 | ||
322 | 322 | ||
323 | static void __alias_free_mem(struct rcu_head *head) | 323 | static void __alias_free_mem(struct rcu_head *head) |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 7870a535dac6..91145244ea63 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -339,7 +339,7 @@ unsigned int tcp_poll(struct file *file, struct socket *sock, poll_table *wait) | |||
339 | struct sock *sk = sock->sk; | 339 | struct sock *sk = sock->sk; |
340 | struct tcp_sock *tp = tcp_sk(sk); | 340 | struct tcp_sock *tp = tcp_sk(sk); |
341 | 341 | ||
342 | poll_wait(file, sk->sk_sleep, wait); | 342 | sock_poll_wait(file, sk->sk_sleep, wait); |
343 | if (sk->sk_state == TCP_LISTEN) | 343 | if (sk->sk_state == TCP_LISTEN) |
344 | return inet_csk_listen_poll(sk); | 344 | return inet_csk_listen_poll(sk); |
345 | 345 | ||
diff --git a/net/ipv4/xfrm4_policy.c b/net/ipv4/xfrm4_policy.c index 60d918c96a4f..0071ee6f441f 100644 --- a/net/ipv4/xfrm4_policy.c +++ b/net/ipv4/xfrm4_policy.c | |||
@@ -136,7 +136,8 @@ _decode_session4(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
136 | case IPPROTO_TCP: | 136 | case IPPROTO_TCP: |
137 | case IPPROTO_SCTP: | 137 | case IPPROTO_SCTP: |
138 | case IPPROTO_DCCP: | 138 | case IPPROTO_DCCP: |
139 | if (pskb_may_pull(skb, xprth + 4 - skb->data)) { | 139 | if (xprth + 4 < skb->data || |
140 | pskb_may_pull(skb, xprth + 4 - skb->data)) { | ||
140 | __be16 *ports = (__be16 *)xprth; | 141 | __be16 *ports = (__be16 *)xprth; |
141 | 142 | ||
142 | fl->fl_ip_sport = ports[!!reverse]; | 143 | fl->fl_ip_sport = ports[!!reverse]; |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 3883b4036a74..43b3c9f89c12 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -1916,8 +1916,32 @@ ok: | |||
1916 | update_lft = 1; | 1916 | update_lft = 1; |
1917 | else if (stored_lft <= MIN_VALID_LIFETIME) { | 1917 | else if (stored_lft <= MIN_VALID_LIFETIME) { |
1918 | /* valid_lft <= stored_lft is always true */ | 1918 | /* valid_lft <= stored_lft is always true */ |
1919 | /* XXX: IPsec */ | 1919 | /* |
1920 | update_lft = 0; | 1920 | * RFC 4862 Section 5.5.3e: |
1921 | * "Note that the preferred lifetime of | ||
1922 | * the corresponding address is always | ||
1923 | * reset to the Preferred Lifetime in | ||
1924 | * the received Prefix Information | ||
1925 | * option, regardless of whether the | ||
1926 | * valid lifetime is also reset or | ||
1927 | * ignored." | ||
1928 | * | ||
1929 | * So if the preferred lifetime in | ||
1930 | * this advertisement is different | ||
1931 | * than what we have stored, but the | ||
1932 | * valid lifetime is invalid, just | ||
1933 | * reset prefered_lft. | ||
1934 | * | ||
1935 | * We must set the valid lifetime | ||
1936 | * to the stored lifetime since we'll | ||
1937 | * be updating the timestamp below, | ||
1938 | * else we'll set it back to the | ||
1939 | * minumum. | ||
1940 | */ | ||
1941 | if (prefered_lft != ifp->prefered_lft) { | ||
1942 | valid_lft = stored_lft; | ||
1943 | update_lft = 1; | ||
1944 | } | ||
1921 | } else { | 1945 | } else { |
1922 | valid_lft = MIN_VALID_LIFETIME; | 1946 | valid_lft = MIN_VALID_LIFETIME; |
1923 | if (valid_lft < prefered_lft) | 1947 | if (valid_lft < prefered_lft) |
@@ -3085,7 +3109,7 @@ restart: | |||
3085 | spin_unlock(&ifp->lock); | 3109 | spin_unlock(&ifp->lock); |
3086 | continue; | 3110 | continue; |
3087 | } else if (age >= ifp->prefered_lft) { | 3111 | } else if (age >= ifp->prefered_lft) { |
3088 | /* jiffies - ifp->tsamp > age >= ifp->prefered_lft */ | 3112 | /* jiffies - ifp->tstamp > age >= ifp->prefered_lft */ |
3089 | int deprecate = 0; | 3113 | int deprecate = 0; |
3090 | 3114 | ||
3091 | if (!(ifp->flags&IFA_F_DEPRECATED)) { | 3115 | if (!(ifp->flags&IFA_F_DEPRECATED)) { |
diff --git a/net/ipv6/xfrm6_policy.c b/net/ipv6/xfrm6_policy.c index b4b16a43f277..3a3c677bc0f2 100644 --- a/net/ipv6/xfrm6_policy.c +++ b/net/ipv6/xfrm6_policy.c | |||
@@ -157,7 +157,8 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
157 | ipv6_addr_copy(&fl->fl6_dst, reverse ? &hdr->saddr : &hdr->daddr); | 157 | ipv6_addr_copy(&fl->fl6_dst, reverse ? &hdr->saddr : &hdr->daddr); |
158 | ipv6_addr_copy(&fl->fl6_src, reverse ? &hdr->daddr : &hdr->saddr); | 158 | ipv6_addr_copy(&fl->fl6_src, reverse ? &hdr->daddr : &hdr->saddr); |
159 | 159 | ||
160 | while (pskb_may_pull(skb, nh + offset + 1 - skb->data)) { | 160 | while (nh + offset + 1 < skb->data || |
161 | pskb_may_pull(skb, nh + offset + 1 - skb->data)) { | ||
161 | nh = skb_network_header(skb); | 162 | nh = skb_network_header(skb); |
162 | exthdr = (struct ipv6_opt_hdr *)(nh + offset); | 163 | exthdr = (struct ipv6_opt_hdr *)(nh + offset); |
163 | 164 | ||
@@ -177,7 +178,8 @@ _decode_session6(struct sk_buff *skb, struct flowi *fl, int reverse) | |||
177 | case IPPROTO_TCP: | 178 | case IPPROTO_TCP: |
178 | case IPPROTO_SCTP: | 179 | case IPPROTO_SCTP: |
179 | case IPPROTO_DCCP: | 180 | case IPPROTO_DCCP: |
180 | if (!onlyproto && pskb_may_pull(skb, nh + offset + 4 - skb->data)) { | 181 | if (!onlyproto && (nh + offset + 4 < skb->data || |
182 | pskb_may_pull(skb, nh + offset + 4 - skb->data))) { | ||
181 | __be16 *ports = (__be16 *)exthdr; | 183 | __be16 *ports = (__be16 *)exthdr; |
182 | 184 | ||
183 | fl->fl_ip_sport = ports[!!reverse]; | 185 | fl->fl_ip_sport = ports[!!reverse]; |
diff --git a/net/ipx/af_ipx.c b/net/ipx/af_ipx.c index 417b0e309495..f1118d92a191 100644 --- a/net/ipx/af_ipx.c +++ b/net/ipx/af_ipx.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <linux/netdevice.h> | 41 | #include <linux/netdevice.h> |
42 | #include <linux/uio.h> | 42 | #include <linux/uio.h> |
43 | #include <linux/skbuff.h> | 43 | #include <linux/skbuff.h> |
44 | #include <linux/smp_lock.h> | ||
44 | #include <linux/socket.h> | 45 | #include <linux/socket.h> |
45 | #include <linux/sockios.h> | 46 | #include <linux/sockios.h> |
46 | #include <linux/string.h> | 47 | #include <linux/string.h> |
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index cb762c8723ea..80cf29aae096 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <linux/capability.h> | 45 | #include <linux/capability.h> |
46 | #include <linux/module.h> | 46 | #include <linux/module.h> |
47 | #include <linux/types.h> | 47 | #include <linux/types.h> |
48 | #include <linux/smp_lock.h> | ||
48 | #include <linux/socket.h> | 49 | #include <linux/socket.h> |
49 | #include <linux/sockios.h> | 50 | #include <linux/sockios.h> |
50 | #include <linux/init.h> | 51 | #include <linux/init.h> |
diff --git a/net/irda/irnet/irnet.h b/net/irda/irnet/irnet.h index bccf4d0059f0..b001c361ad30 100644 --- a/net/irda/irnet/irnet.h +++ b/net/irda/irnet/irnet.h | |||
@@ -241,7 +241,6 @@ | |||
241 | #include <linux/module.h> | 241 | #include <linux/module.h> |
242 | 242 | ||
243 | #include <linux/kernel.h> | 243 | #include <linux/kernel.h> |
244 | #include <linux/smp_lock.h> | ||
245 | #include <linux/skbuff.h> | 244 | #include <linux/skbuff.h> |
246 | #include <linux/tty.h> | 245 | #include <linux/tty.h> |
247 | #include <linux/proc_fs.h> | 246 | #include <linux/proc_fs.h> |
diff --git a/net/irda/irnet/irnet_ppp.c b/net/irda/irnet/irnet_ppp.c index 6d8ae03c14f5..68cbcb19cbd8 100644 --- a/net/irda/irnet/irnet_ppp.c +++ b/net/irda/irnet/irnet_ppp.c | |||
@@ -13,6 +13,7 @@ | |||
13 | * 2) as a control channel (write commands, read events) | 13 | * 2) as a control channel (write commands, read events) |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/smp_lock.h> | ||
16 | #include "irnet_ppp.h" /* Private header */ | 17 | #include "irnet_ppp.h" /* Private header */ |
17 | /* Please put other headers in irnet.h - Thanks */ | 18 | /* Please put other headers in irnet.h - Thanks */ |
18 | 19 | ||
diff --git a/net/iucv/af_iucv.c b/net/iucv/af_iucv.c index 6be5f92d1094..49c15b48408e 100644 --- a/net/iucv/af_iucv.c +++ b/net/iucv/af_iucv.c | |||
@@ -306,7 +306,7 @@ static inline int iucv_below_msglim(struct sock *sk) | |||
306 | static void iucv_sock_wake_msglim(struct sock *sk) | 306 | static void iucv_sock_wake_msglim(struct sock *sk) |
307 | { | 307 | { |
308 | read_lock(&sk->sk_callback_lock); | 308 | read_lock(&sk->sk_callback_lock); |
309 | if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) | 309 | if (sk_has_sleeper(sk)) |
310 | wake_up_interruptible_all(sk->sk_sleep); | 310 | wake_up_interruptible_all(sk->sk_sleep); |
311 | sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT); | 311 | sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT); |
312 | read_unlock(&sk->sk_callback_lock); | 312 | read_unlock(&sk->sk_callback_lock); |
@@ -1256,7 +1256,7 @@ unsigned int iucv_sock_poll(struct file *file, struct socket *sock, | |||
1256 | struct sock *sk = sock->sk; | 1256 | struct sock *sk = sock->sk; |
1257 | unsigned int mask = 0; | 1257 | unsigned int mask = 0; |
1258 | 1258 | ||
1259 | poll_wait(file, sk->sk_sleep, wait); | 1259 | sock_poll_wait(file, sk->sk_sleep, wait); |
1260 | 1260 | ||
1261 | if (sk->sk_state == IUCV_LISTEN) | 1261 | if (sk->sk_state == IUCV_LISTEN) |
1262 | return iucv_accept_poll(sk); | 1262 | return iucv_accept_poll(sk); |
diff --git a/net/mac80211/mesh_hwmp.c b/net/mac80211/mesh_hwmp.c index 003cb470ac84..f49ef288e2e2 100644 --- a/net/mac80211/mesh_hwmp.c +++ b/net/mac80211/mesh_hwmp.c | |||
@@ -637,7 +637,7 @@ static void mesh_queue_preq(struct mesh_path *mpath, u8 flags) | |||
637 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; | 637 | struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh; |
638 | struct mesh_preq_queue *preq_node; | 638 | struct mesh_preq_queue *preq_node; |
639 | 639 | ||
640 | preq_node = kmalloc(sizeof(struct mesh_preq_queue), GFP_KERNEL); | 640 | preq_node = kmalloc(sizeof(struct mesh_preq_queue), GFP_ATOMIC); |
641 | if (!preq_node) { | 641 | if (!preq_node) { |
642 | printk(KERN_DEBUG "Mesh HWMP: could not allocate PREQ node\n"); | 642 | printk(KERN_DEBUG "Mesh HWMP: could not allocate PREQ node\n"); |
643 | return; | 643 | return; |
diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c index b218b98fba7f..37771abd8f5a 100644 --- a/net/mac80211/rc80211_minstrel.c +++ b/net/mac80211/rc80211_minstrel.c | |||
@@ -66,7 +66,7 @@ rix_to_ndx(struct minstrel_sta_info *mi, int rix) | |||
66 | for (i = rix; i >= 0; i--) | 66 | for (i = rix; i >= 0; i--) |
67 | if (mi->r[i].rix == rix) | 67 | if (mi->r[i].rix == rix) |
68 | break; | 68 | break; |
69 | WARN_ON(mi->r[i].rix != rix); | 69 | WARN_ON(i < 0); |
70 | return i; | 70 | return i; |
71 | } | 71 | } |
72 | 72 | ||
@@ -181,6 +181,9 @@ minstrel_tx_status(void *priv, struct ieee80211_supported_band *sband, | |||
181 | break; | 181 | break; |
182 | 182 | ||
183 | ndx = rix_to_ndx(mi, ar[i].idx); | 183 | ndx = rix_to_ndx(mi, ar[i].idx); |
184 | if (ndx < 0) | ||
185 | continue; | ||
186 | |||
184 | mi->r[ndx].attempts += ar[i].count; | 187 | mi->r[ndx].attempts += ar[i].count; |
185 | 188 | ||
186 | if ((i != IEEE80211_TX_MAX_RATES - 1) && (ar[i + 1].idx < 0)) | 189 | if ((i != IEEE80211_TX_MAX_RATES - 1) && (ar[i + 1].idx < 0)) |
diff --git a/net/rxrpc/af_rxrpc.c b/net/rxrpc/af_rxrpc.c index eac5e7bb7365..bfe493ebf27c 100644 --- a/net/rxrpc/af_rxrpc.c +++ b/net/rxrpc/af_rxrpc.c | |||
@@ -63,7 +63,7 @@ static void rxrpc_write_space(struct sock *sk) | |||
63 | _enter("%p", sk); | 63 | _enter("%p", sk); |
64 | read_lock(&sk->sk_callback_lock); | 64 | read_lock(&sk->sk_callback_lock); |
65 | if (rxrpc_writable(sk)) { | 65 | if (rxrpc_writable(sk)) { |
66 | if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) | 66 | if (sk_has_sleeper(sk)) |
67 | wake_up_interruptible(sk->sk_sleep); | 67 | wake_up_interruptible(sk->sk_sleep); |
68 | sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT); | 68 | sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT); |
69 | } | 69 | } |
@@ -588,7 +588,7 @@ static unsigned int rxrpc_poll(struct file *file, struct socket *sock, | |||
588 | unsigned int mask; | 588 | unsigned int mask; |
589 | struct sock *sk = sock->sk; | 589 | struct sock *sk = sock->sk; |
590 | 590 | ||
591 | poll_wait(file, sk->sk_sleep, wait); | 591 | sock_poll_wait(file, sk->sk_sleep, wait); |
592 | mask = 0; | 592 | mask = 0; |
593 | 593 | ||
594 | /* the socket is readable if there are any messages waiting on the Rx | 594 | /* the socket is readable if there are any messages waiting on the Rx |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 35ba035970a2..971890dbfea0 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -6652,21 +6652,6 @@ static void sctp_wait_for_close(struct sock *sk, long timeout) | |||
6652 | finish_wait(sk->sk_sleep, &wait); | 6652 | finish_wait(sk->sk_sleep, &wait); |
6653 | } | 6653 | } |
6654 | 6654 | ||
6655 | static void sctp_sock_rfree_frag(struct sk_buff *skb) | ||
6656 | { | ||
6657 | struct sk_buff *frag; | ||
6658 | |||
6659 | if (!skb->data_len) | ||
6660 | goto done; | ||
6661 | |||
6662 | /* Don't forget the fragments. */ | ||
6663 | skb_walk_frags(skb, frag) | ||
6664 | sctp_sock_rfree_frag(frag); | ||
6665 | |||
6666 | done: | ||
6667 | sctp_sock_rfree(skb); | ||
6668 | } | ||
6669 | |||
6670 | static void sctp_skb_set_owner_r_frag(struct sk_buff *skb, struct sock *sk) | 6655 | static void sctp_skb_set_owner_r_frag(struct sk_buff *skb, struct sock *sk) |
6671 | { | 6656 | { |
6672 | struct sk_buff *frag; | 6657 | struct sk_buff *frag; |
@@ -6776,7 +6761,6 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, | |||
6776 | sctp_skb_for_each(skb, &oldsk->sk_receive_queue, tmp) { | 6761 | sctp_skb_for_each(skb, &oldsk->sk_receive_queue, tmp) { |
6777 | event = sctp_skb2event(skb); | 6762 | event = sctp_skb2event(skb); |
6778 | if (event->asoc == assoc) { | 6763 | if (event->asoc == assoc) { |
6779 | sctp_sock_rfree_frag(skb); | ||
6780 | __skb_unlink(skb, &oldsk->sk_receive_queue); | 6764 | __skb_unlink(skb, &oldsk->sk_receive_queue); |
6781 | __skb_queue_tail(&newsk->sk_receive_queue, skb); | 6765 | __skb_queue_tail(&newsk->sk_receive_queue, skb); |
6782 | sctp_skb_set_owner_r_frag(skb, newsk); | 6766 | sctp_skb_set_owner_r_frag(skb, newsk); |
@@ -6807,7 +6791,6 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, | |||
6807 | sctp_skb_for_each(skb, &oldsp->pd_lobby, tmp) { | 6791 | sctp_skb_for_each(skb, &oldsp->pd_lobby, tmp) { |
6808 | event = sctp_skb2event(skb); | 6792 | event = sctp_skb2event(skb); |
6809 | if (event->asoc == assoc) { | 6793 | if (event->asoc == assoc) { |
6810 | sctp_sock_rfree_frag(skb); | ||
6811 | __skb_unlink(skb, &oldsp->pd_lobby); | 6794 | __skb_unlink(skb, &oldsp->pd_lobby); |
6812 | __skb_queue_tail(queue, skb); | 6795 | __skb_queue_tail(queue, skb); |
6813 | sctp_skb_set_owner_r_frag(skb, newsk); | 6796 | sctp_skb_set_owner_r_frag(skb, newsk); |
@@ -6822,15 +6805,11 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk, | |||
6822 | 6805 | ||
6823 | } | 6806 | } |
6824 | 6807 | ||
6825 | sctp_skb_for_each(skb, &assoc->ulpq.reasm, tmp) { | 6808 | sctp_skb_for_each(skb, &assoc->ulpq.reasm, tmp) |
6826 | sctp_sock_rfree_frag(skb); | ||
6827 | sctp_skb_set_owner_r_frag(skb, newsk); | 6809 | sctp_skb_set_owner_r_frag(skb, newsk); |
6828 | } | ||
6829 | 6810 | ||
6830 | sctp_skb_for_each(skb, &assoc->ulpq.lobby, tmp) { | 6811 | sctp_skb_for_each(skb, &assoc->ulpq.lobby, tmp) |
6831 | sctp_sock_rfree_frag(skb); | ||
6832 | sctp_skb_set_owner_r_frag(skb, newsk); | 6812 | sctp_skb_set_owner_r_frag(skb, newsk); |
6833 | } | ||
6834 | 6813 | ||
6835 | /* Set the type of socket to indicate that it is peeled off from the | 6814 | /* Set the type of socket to indicate that it is peeled off from the |
6836 | * original UDP-style socket or created with the accept() call on a | 6815 | * original UDP-style socket or created with the accept() call on a |
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 5bc2f45bddf0..ebfcf9b89909 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c | |||
@@ -28,7 +28,6 @@ | |||
28 | #include <linux/kallsyms.h> | 28 | #include <linux/kallsyms.h> |
29 | #include <linux/mm.h> | 29 | #include <linux/mm.h> |
30 | #include <linux/slab.h> | 30 | #include <linux/slab.h> |
31 | #include <linux/smp_lock.h> | ||
32 | #include <linux/utsname.h> | 31 | #include <linux/utsname.h> |
33 | #include <linux/workqueue.h> | 32 | #include <linux/workqueue.h> |
34 | #include <linux/in6.h> | 33 | #include <linux/in6.h> |
diff --git a/net/sunrpc/sched.c b/net/sunrpc/sched.c index 1102ce1251f7..8f459abe97cf 100644 --- a/net/sunrpc/sched.c +++ b/net/sunrpc/sched.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/slab.h> | 16 | #include <linux/slab.h> |
17 | #include <linux/mempool.h> | 17 | #include <linux/mempool.h> |
18 | #include <linux/smp.h> | 18 | #include <linux/smp.h> |
19 | #include <linux/smp_lock.h> | ||
20 | #include <linux/spinlock.h> | 19 | #include <linux/spinlock.h> |
21 | #include <linux/mutex.h> | 20 | #include <linux/mutex.h> |
22 | 21 | ||
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index 6f33d33cc064..27d44332f017 100644 --- a/net/sunrpc/svc_xprt.c +++ b/net/sunrpc/svc_xprt.c | |||
@@ -5,6 +5,7 @@ | |||
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/sched.h> | 7 | #include <linux/sched.h> |
8 | #include <linux/smp_lock.h> | ||
8 | #include <linux/errno.h> | 9 | #include <linux/errno.h> |
9 | #include <linux/freezer.h> | 10 | #include <linux/freezer.h> |
10 | #include <linux/kthread.h> | 11 | #include <linux/kthread.h> |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 36d4e44d6233..fc3ebb906911 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -315,7 +315,7 @@ static void unix_write_space(struct sock *sk) | |||
315 | { | 315 | { |
316 | read_lock(&sk->sk_callback_lock); | 316 | read_lock(&sk->sk_callback_lock); |
317 | if (unix_writable(sk)) { | 317 | if (unix_writable(sk)) { |
318 | if (sk->sk_sleep && waitqueue_active(sk->sk_sleep)) | 318 | if (sk_has_sleeper(sk)) |
319 | wake_up_interruptible_sync(sk->sk_sleep); | 319 | wake_up_interruptible_sync(sk->sk_sleep); |
320 | sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT); | 320 | sk_wake_async(sk, SOCK_WAKE_SPACE, POLL_OUT); |
321 | } | 321 | } |
@@ -1985,7 +1985,7 @@ static unsigned int unix_poll(struct file *file, struct socket *sock, poll_table | |||
1985 | struct sock *sk = sock->sk; | 1985 | struct sock *sk = sock->sk; |
1986 | unsigned int mask; | 1986 | unsigned int mask; |
1987 | 1987 | ||
1988 | poll_wait(file, sk->sk_sleep, wait); | 1988 | sock_poll_wait(file, sk->sk_sleep, wait); |
1989 | mask = 0; | 1989 | mask = 0; |
1990 | 1990 | ||
1991 | /* exceptional events? */ | 1991 | /* exceptional events? */ |
@@ -2022,7 +2022,7 @@ static unsigned int unix_dgram_poll(struct file *file, struct socket *sock, | |||
2022 | struct sock *sk = sock->sk, *other; | 2022 | struct sock *sk = sock->sk, *other; |
2023 | unsigned int mask, writable; | 2023 | unsigned int mask, writable; |
2024 | 2024 | ||
2025 | poll_wait(file, sk->sk_sleep, wait); | 2025 | sock_poll_wait(file, sk->sk_sleep, wait); |
2026 | mask = 0; | 2026 | mask = 0; |
2027 | 2027 | ||
2028 | /* exceptional events? */ | 2028 | /* exceptional events? */ |
@@ -2053,7 +2053,7 @@ static unsigned int unix_dgram_poll(struct file *file, struct socket *sock, | |||
2053 | other = unix_peer_get(sk); | 2053 | other = unix_peer_get(sk); |
2054 | if (other) { | 2054 | if (other) { |
2055 | if (unix_peer(other) != sk) { | 2055 | if (unix_peer(other) != sk) { |
2056 | poll_wait(file, &unix_sk(other)->peer_wait, | 2056 | sock_poll_wait(file, &unix_sk(other)->peer_wait, |
2057 | wait); | 2057 | wait); |
2058 | if (unix_recvq_full(other)) | 2058 | if (unix_recvq_full(other)) |
2059 | writable = 0; | 2059 | writable = 0; |
diff --git a/net/wanrouter/wanmain.c b/net/wanrouter/wanmain.c index 466e2d22d256..258daa80ad92 100644 --- a/net/wanrouter/wanmain.c +++ b/net/wanrouter/wanmain.c | |||
@@ -48,6 +48,7 @@ | |||
48 | #include <linux/kernel.h> | 48 | #include <linux/kernel.h> |
49 | #include <linux/module.h> /* support for loadable modules */ | 49 | #include <linux/module.h> /* support for loadable modules */ |
50 | #include <linux/slab.h> /* kmalloc(), kfree() */ | 50 | #include <linux/slab.h> /* kmalloc(), kfree() */ |
51 | #include <linux/smp_lock.h> | ||
51 | #include <linux/mm.h> | 52 | #include <linux/mm.h> |
52 | #include <linux/string.h> /* inline mem*, str* functions */ | 53 | #include <linux/string.h> /* inline mem*, str* functions */ |
53 | 54 | ||
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 241bddd0b4f1..43bdb1372cae 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -447,6 +447,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info) | |||
447 | 447 | ||
448 | rdev = __cfg80211_drv_from_info(info); | 448 | rdev = __cfg80211_drv_from_info(info); |
449 | if (IS_ERR(rdev)) { | 449 | if (IS_ERR(rdev)) { |
450 | mutex_unlock(&cfg80211_mutex); | ||
450 | result = PTR_ERR(rdev); | 451 | result = PTR_ERR(rdev); |
451 | goto unlock; | 452 | goto unlock; |
452 | } | 453 | } |
diff --git a/net/wireless/scan.c b/net/wireless/scan.c index e95b638b919f..f8e71b300001 100644 --- a/net/wireless/scan.c +++ b/net/wireless/scan.c | |||
@@ -366,7 +366,6 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev, | |||
366 | found = rb_find_bss(dev, res); | 366 | found = rb_find_bss(dev, res); |
367 | 367 | ||
368 | if (found) { | 368 | if (found) { |
369 | kref_get(&found->ref); | ||
370 | found->pub.beacon_interval = res->pub.beacon_interval; | 369 | found->pub.beacon_interval = res->pub.beacon_interval; |
371 | found->pub.tsf = res->pub.tsf; | 370 | found->pub.tsf = res->pub.tsf; |
372 | found->pub.signal = res->pub.signal; | 371 | found->pub.signal = res->pub.signal; |
diff --git a/net/x25/af_x25.c b/net/x25/af_x25.c index 21cdc872004e..5e6c072c64d3 100644 --- a/net/x25/af_x25.c +++ b/net/x25/af_x25.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/errno.h> | 40 | #include <linux/errno.h> |
41 | #include <linux/kernel.h> | 41 | #include <linux/kernel.h> |
42 | #include <linux/sched.h> | 42 | #include <linux/sched.h> |
43 | #include <linux/smp_lock.h> | ||
43 | #include <linux/timer.h> | 44 | #include <linux/timer.h> |
44 | #include <linux/string.h> | 45 | #include <linux/string.h> |
45 | #include <linux/net.h> | 46 | #include <linux/net.h> |
diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c index e617acaf10e3..61b8ab39800f 100644 --- a/sound/pci/emu10k1/p16v.c +++ b/sound/pci/emu10k1/p16v.c | |||
@@ -644,7 +644,7 @@ int __devinit snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm * | |||
644 | int err; | 644 | int err; |
645 | int capture=1; | 645 | int capture=1; |
646 | 646 | ||
647 | /* snd_printk("KERN_DEBUG snd_p16v_pcm called. device=%d\n", device); */ | 647 | /* snd_printk(KERN_DEBUG "snd_p16v_pcm called. device=%d\n", device); */ |
648 | emu->p16v_device_offset = device; | 648 | emu->p16v_device_offset = device; |
649 | if (rpcm) | 649 | if (rpcm) |
650 | *rpcm = NULL; | 650 | *rpcm = NULL; |
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c index 29272f2e95a0..b0275a050870 100644 --- a/sound/pci/hda/hda_beep.c +++ b/sound/pci/hda/hda_beep.c | |||
@@ -50,19 +50,22 @@ static void snd_hda_generate_beep(struct work_struct *work) | |||
50 | * The tone frequency of beep generator on IDT/STAC codecs is | 50 | * The tone frequency of beep generator on IDT/STAC codecs is |
51 | * defined from the 8bit tone parameter, in Hz, | 51 | * defined from the 8bit tone parameter, in Hz, |
52 | * freq = 48000 * (257 - tone) / 1024 | 52 | * freq = 48000 * (257 - tone) / 1024 |
53 | * that is from 12kHz to 93.75kHz in step of 46.875 hz | 53 | * that is from 12kHz to 93.75Hz in steps of 46.875 Hz |
54 | */ | 54 | */ |
55 | static int beep_linear_tone(struct hda_beep *beep, int hz) | 55 | static int beep_linear_tone(struct hda_beep *beep, int hz) |
56 | { | 56 | { |
57 | if (hz <= 0) | ||
58 | return 0; | ||
57 | hz *= 1000; /* fixed point */ | 59 | hz *= 1000; /* fixed point */ |
58 | hz = hz - DIGBEEP_HZ_MIN; | 60 | hz = hz - DIGBEEP_HZ_MIN |
61 | + DIGBEEP_HZ_STEP / 2; /* round to nearest step */ | ||
59 | if (hz < 0) | 62 | if (hz < 0) |
60 | hz = 0; /* turn off PC beep*/ | 63 | hz = 0; /* turn off PC beep*/ |
61 | else if (hz >= (DIGBEEP_HZ_MAX - DIGBEEP_HZ_MIN)) | 64 | else if (hz >= (DIGBEEP_HZ_MAX - DIGBEEP_HZ_MIN)) |
62 | hz = 0xff; | 65 | hz = 1; /* max frequency */ |
63 | else { | 66 | else { |
64 | hz /= DIGBEEP_HZ_STEP; | 67 | hz /= DIGBEEP_HZ_STEP; |
65 | hz++; | 68 | hz = 255 - hz; |
66 | } | 69 | } |
67 | return hz; | 70 | return hz; |
68 | } | 71 | } |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 1877d95d4aa6..77c1b840ca8b 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -1455,6 +1455,17 @@ static int azx_pcm_open(struct snd_pcm_substream *substream) | |||
1455 | return err; | 1455 | return err; |
1456 | } | 1456 | } |
1457 | snd_pcm_limit_hw_rates(runtime); | 1457 | snd_pcm_limit_hw_rates(runtime); |
1458 | /* sanity check */ | ||
1459 | if (snd_BUG_ON(!runtime->hw.channels_min) || | ||
1460 | snd_BUG_ON(!runtime->hw.channels_max) || | ||
1461 | snd_BUG_ON(!runtime->hw.formats) || | ||
1462 | snd_BUG_ON(!runtime->hw.rates)) { | ||
1463 | azx_release_device(azx_dev); | ||
1464 | hinfo->ops.close(hinfo, apcm->codec, substream); | ||
1465 | snd_hda_power_down(apcm->codec); | ||
1466 | mutex_unlock(&chip->open_mutex); | ||
1467 | return -EINVAL; | ||
1468 | } | ||
1458 | spin_lock_irqsave(&chip->reg_lock, flags); | 1469 | spin_lock_irqsave(&chip->reg_lock, flags); |
1459 | azx_dev->substream = substream; | 1470 | azx_dev->substream = substream; |
1460 | azx_dev->running = 0; | 1471 | azx_dev->running = 0; |
@@ -1463,13 +1474,6 @@ static int azx_pcm_open(struct snd_pcm_substream *substream) | |||
1463 | runtime->private_data = azx_dev; | 1474 | runtime->private_data = azx_dev; |
1464 | snd_pcm_set_sync(substream); | 1475 | snd_pcm_set_sync(substream); |
1465 | mutex_unlock(&chip->open_mutex); | 1476 | mutex_unlock(&chip->open_mutex); |
1466 | |||
1467 | if (snd_BUG_ON(!runtime->hw.channels_min || !runtime->hw.channels_max)) | ||
1468 | return -EINVAL; | ||
1469 | if (snd_BUG_ON(!runtime->hw.formats)) | ||
1470 | return -EINVAL; | ||
1471 | if (snd_BUG_ON(!runtime->hw.rates)) | ||
1472 | return -EINVAL; | ||
1473 | return 0; | 1477 | return 0; |
1474 | } | 1478 | } |
1475 | 1479 | ||
@@ -2329,9 +2333,19 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, | |||
2329 | gcap = azx_readw(chip, GCAP); | 2333 | gcap = azx_readw(chip, GCAP); |
2330 | snd_printdd(SFX "chipset global capabilities = 0x%x\n", gcap); | 2334 | snd_printdd(SFX "chipset global capabilities = 0x%x\n", gcap); |
2331 | 2335 | ||
2332 | /* ATI chips seems buggy about 64bit DMA addresses */ | 2336 | /* disable SB600 64bit support for safety */ |
2333 | if (chip->driver_type == AZX_DRIVER_ATI) | 2337 | if ((chip->driver_type == AZX_DRIVER_ATI) || |
2334 | gcap &= ~ICH6_GCAP_64OK; | 2338 | (chip->driver_type == AZX_DRIVER_ATIHDMI)) { |
2339 | struct pci_dev *p_smbus; | ||
2340 | p_smbus = pci_get_device(PCI_VENDOR_ID_ATI, | ||
2341 | PCI_DEVICE_ID_ATI_SBX00_SMBUS, | ||
2342 | NULL); | ||
2343 | if (p_smbus) { | ||
2344 | if (p_smbus->revision < 0x30) | ||
2345 | gcap &= ~ICH6_GCAP_64OK; | ||
2346 | pci_dev_put(p_smbus); | ||
2347 | } | ||
2348 | } | ||
2335 | 2349 | ||
2336 | /* allow 64bit DMA address if supported by H/W */ | 2350 | /* allow 64bit DMA address if supported by H/W */ |
2337 | if ((gcap & ICH6_GCAP_64OK) && !pci_set_dma_mask(pci, DMA_BIT_MASK(64))) | 2351 | if ((gcap & ICH6_GCAP_64OK) && !pci_set_dma_mask(pci, DMA_BIT_MASK(64))) |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index e661b21354be..bbb9b42e2604 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -6919,9 +6919,6 @@ static struct hda_verb alc882_targa_verbs[] = { | |||
6919 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | 6919 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
6920 | 6920 | ||
6921 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | 6921 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
6922 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, | ||
6923 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, | ||
6924 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, | ||
6925 | { } /* end */ | 6922 | { } /* end */ |
6926 | }; | 6923 | }; |
6927 | 6924 | ||
@@ -7241,7 +7238,8 @@ static struct alc_config_preset alc882_presets[] = { | |||
7241 | }, | 7238 | }, |
7242 | [ALC882_TARGA] = { | 7239 | [ALC882_TARGA] = { |
7243 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, | 7240 | .mixers = { alc882_targa_mixer, alc882_chmode_mixer }, |
7244 | .init_verbs = { alc882_init_verbs, alc882_targa_verbs}, | 7241 | .init_verbs = { alc882_init_verbs, alc880_gpio3_init_verbs, |
7242 | alc882_targa_verbs}, | ||
7245 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), | 7243 | .num_dacs = ARRAY_SIZE(alc882_dac_nids), |
7246 | .dac_nids = alc882_dac_nids, | 7244 | .dac_nids = alc882_dac_nids, |
7247 | .dig_out_nid = ALC882_DIGOUT_NID, | 7245 | .dig_out_nid = ALC882_DIGOUT_NID, |
@@ -9238,7 +9236,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9238 | }, | 9236 | }, |
9239 | [ALC883_TARGA_DIG] = { | 9237 | [ALC883_TARGA_DIG] = { |
9240 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, | 9238 | .mixers = { alc883_targa_mixer, alc883_chmode_mixer }, |
9241 | .init_verbs = { alc883_init_verbs, alc883_targa_verbs}, | 9239 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
9240 | alc883_targa_verbs}, | ||
9242 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 9241 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
9243 | .dac_nids = alc883_dac_nids, | 9242 | .dac_nids = alc883_dac_nids, |
9244 | .dig_out_nid = ALC883_DIGOUT_NID, | 9243 | .dig_out_nid = ALC883_DIGOUT_NID, |
@@ -9251,7 +9250,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
9251 | }, | 9250 | }, |
9252 | [ALC883_TARGA_2ch_DIG] = { | 9251 | [ALC883_TARGA_2ch_DIG] = { |
9253 | .mixers = { alc883_targa_2ch_mixer}, | 9252 | .mixers = { alc883_targa_2ch_mixer}, |
9254 | .init_verbs = { alc883_init_verbs, alc883_targa_verbs}, | 9253 | .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs, |
9254 | alc883_targa_verbs}, | ||
9255 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 9255 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
9256 | .dac_nids = alc883_dac_nids, | 9256 | .dac_nids = alc883_dac_nids, |
9257 | .adc_nids = alc883_adc_nids_alt, | 9257 | .adc_nids = alc883_adc_nids_alt, |
@@ -12878,9 +12878,9 @@ static struct snd_kcontrol_new alc269_lifebook_mixer[] = { | |||
12878 | 12878 | ||
12879 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { | 12879 | static struct snd_kcontrol_new alc269_eeepc_mixer[] = { |
12880 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | 12880 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
12881 | HDA_CODEC_MUTE("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | 12881 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
12882 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | 12882 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
12883 | HDA_CODEC_MUTE("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | 12883 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), |
12884 | { } /* end */ | 12884 | { } /* end */ |
12885 | }; | 12885 | }; |
12886 | 12886 | ||
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 14f3c3e0f62d..41b5b3a18c1e 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -1590,8 +1590,6 @@ static struct snd_pci_quirk stac9200_cfg_tbl[] = { | |||
1590 | /* SigmaTel reference board */ | 1590 | /* SigmaTel reference board */ |
1591 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, | 1591 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
1592 | "DFI LanParty", STAC_REF), | 1592 | "DFI LanParty", STAC_REF), |
1593 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xfb30, | ||
1594 | "SigmaTel",STAC_9205_REF), | ||
1595 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, | 1593 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
1596 | "DFI LanParty", STAC_REF), | 1594 | "DFI LanParty", STAC_REF), |
1597 | /* Dell laptops have BIOS problem */ | 1595 | /* Dell laptops have BIOS problem */ |
@@ -2344,6 +2342,8 @@ static struct snd_pci_quirk stac9205_cfg_tbl[] = { | |||
2344 | /* SigmaTel reference board */ | 2342 | /* SigmaTel reference board */ |
2345 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, | 2343 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
2346 | "DFI LanParty", STAC_9205_REF), | 2344 | "DFI LanParty", STAC_9205_REF), |
2345 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xfb30, | ||
2346 | "SigmaTel", STAC_9205_REF), | ||
2347 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, | 2347 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
2348 | "DFI LanParty", STAC_9205_REF), | 2348 | "DFI LanParty", STAC_9205_REF), |
2349 | /* Dell */ | 2349 | /* Dell */ |
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index 8e004fb6961a..9008b4b013aa 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c | |||
@@ -210,7 +210,9 @@ struct via_spec { | |||
210 | /* capture */ | 210 | /* capture */ |
211 | unsigned int num_adc_nids; | 211 | unsigned int num_adc_nids; |
212 | hda_nid_t *adc_nids; | 212 | hda_nid_t *adc_nids; |
213 | hda_nid_t mux_nids[3]; | ||
213 | hda_nid_t dig_in_nid; | 214 | hda_nid_t dig_in_nid; |
215 | hda_nid_t dig_in_pin; | ||
214 | 216 | ||
215 | /* capture source */ | 217 | /* capture source */ |
216 | const struct hda_input_mux *input_mux; | 218 | const struct hda_input_mux *input_mux; |
@@ -319,6 +321,9 @@ static void via_auto_set_output_and_unmute(struct hda_codec *codec, | |||
319 | pin_type); | 321 | pin_type); |
320 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, | 322 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
321 | AMP_OUT_UNMUTE); | 323 | AMP_OUT_UNMUTE); |
324 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) | ||
325 | snd_hda_codec_write(codec, nid, 0, | ||
326 | AC_VERB_SET_EAPD_BTLENABLE, 0x02); | ||
322 | } | 327 | } |
323 | 328 | ||
324 | 329 | ||
@@ -387,27 +392,12 @@ static int via_mux_enum_put(struct snd_kcontrol *kcontrol, | |||
387 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 392 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
388 | struct via_spec *spec = codec->spec; | 393 | struct via_spec *spec = codec->spec; |
389 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); | 394 | unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
390 | unsigned int vendor_id = codec->vendor_id; | 395 | |
391 | 396 | if (!spec->mux_nids[adc_idx]) | |
392 | /* AIW0 lydia 060801 add for correct sw0 input select */ | 397 | return -EINVAL; |
393 | if (IS_VT1708_VENDORID(vendor_id) && (adc_idx == 0)) | 398 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, |
394 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, | 399 | spec->mux_nids[adc_idx], |
395 | 0x18, &spec->cur_mux[adc_idx]); | 400 | &spec->cur_mux[adc_idx]); |
396 | else if ((IS_VT1709_10CH_VENDORID(vendor_id) || | ||
397 | IS_VT1709_6CH_VENDORID(vendor_id)) && (adc_idx == 0)) | ||
398 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, | ||
399 | 0x19, &spec->cur_mux[adc_idx]); | ||
400 | else if ((IS_VT1708B_8CH_VENDORID(vendor_id) || | ||
401 | IS_VT1708B_4CH_VENDORID(vendor_id)) && (adc_idx == 0)) | ||
402 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, | ||
403 | 0x17, &spec->cur_mux[adc_idx]); | ||
404 | else if (IS_VT1702_VENDORID(vendor_id) && (adc_idx == 0)) | ||
405 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, | ||
406 | 0x13, &spec->cur_mux[adc_idx]); | ||
407 | else | ||
408 | return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, | ||
409 | spec->adc_nids[adc_idx], | ||
410 | &spec->cur_mux[adc_idx]); | ||
411 | } | 401 | } |
412 | 402 | ||
413 | static int via_independent_hp_info(struct snd_kcontrol *kcontrol, | 403 | static int via_independent_hp_info(struct snd_kcontrol *kcontrol, |
@@ -998,25 +988,11 @@ static int via_init(struct hda_codec *codec) | |||
998 | 988 | ||
999 | /* Lydia Add for EAPD enable */ | 989 | /* Lydia Add for EAPD enable */ |
1000 | if (!spec->dig_in_nid) { /* No Digital In connection */ | 990 | if (!spec->dig_in_nid) { /* No Digital In connection */ |
1001 | if (IS_VT1708_VENDORID(codec->vendor_id)) { | 991 | if (spec->dig_in_pin) { |
1002 | snd_hda_codec_write(codec, VT1708_DIGIN_PIN, 0, | 992 | snd_hda_codec_write(codec, spec->dig_in_pin, 0, |
1003 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
1004 | PIN_OUT); | ||
1005 | snd_hda_codec_write(codec, VT1708_DIGIN_PIN, 0, | ||
1006 | AC_VERB_SET_EAPD_BTLENABLE, 0x02); | ||
1007 | } else if (IS_VT1709_10CH_VENDORID(codec->vendor_id) || | ||
1008 | IS_VT1709_6CH_VENDORID(codec->vendor_id)) { | ||
1009 | snd_hda_codec_write(codec, VT1709_DIGIN_PIN, 0, | ||
1010 | AC_VERB_SET_PIN_WIDGET_CONTROL, | 993 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
1011 | PIN_OUT); | 994 | PIN_OUT); |
1012 | snd_hda_codec_write(codec, VT1709_DIGIN_PIN, 0, | 995 | snd_hda_codec_write(codec, spec->dig_in_pin, 0, |
1013 | AC_VERB_SET_EAPD_BTLENABLE, 0x02); | ||
1014 | } else if (IS_VT1708B_8CH_VENDORID(codec->vendor_id) || | ||
1015 | IS_VT1708B_4CH_VENDORID(codec->vendor_id)) { | ||
1016 | snd_hda_codec_write(codec, VT1708B_DIGIN_PIN, 0, | ||
1017 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
1018 | PIN_OUT); | ||
1019 | snd_hda_codec_write(codec, VT1708B_DIGIN_PIN, 0, | ||
1020 | AC_VERB_SET_EAPD_BTLENABLE, 0x02); | 996 | AC_VERB_SET_EAPD_BTLENABLE, 0x02); |
1021 | } | 997 | } |
1022 | } else /* enable SPDIF-input pin */ | 998 | } else /* enable SPDIF-input pin */ |
@@ -1326,6 +1302,7 @@ static int vt1708_parse_auto_config(struct hda_codec *codec) | |||
1326 | 1302 | ||
1327 | if (spec->autocfg.dig_outs) | 1303 | if (spec->autocfg.dig_outs) |
1328 | spec->multiout.dig_out_nid = VT1708_DIGOUT_NID; | 1304 | spec->multiout.dig_out_nid = VT1708_DIGOUT_NID; |
1305 | spec->dig_in_pin = VT1708_DIGIN_PIN; | ||
1329 | if (spec->autocfg.dig_in_pin) | 1306 | if (spec->autocfg.dig_in_pin) |
1330 | spec->dig_in_nid = VT1708_DIGIN_NID; | 1307 | spec->dig_in_nid = VT1708_DIGIN_NID; |
1331 | 1308 | ||
@@ -1352,6 +1329,34 @@ static int via_auto_init(struct hda_codec *codec) | |||
1352 | return 0; | 1329 | return 0; |
1353 | } | 1330 | } |
1354 | 1331 | ||
1332 | static int get_mux_nids(struct hda_codec *codec) | ||
1333 | { | ||
1334 | struct via_spec *spec = codec->spec; | ||
1335 | hda_nid_t nid, conn[8]; | ||
1336 | unsigned int type; | ||
1337 | int i, n; | ||
1338 | |||
1339 | for (i = 0; i < spec->num_adc_nids; i++) { | ||
1340 | nid = spec->adc_nids[i]; | ||
1341 | while (nid) { | ||
1342 | type = (get_wcaps(codec, nid) & AC_WCAP_TYPE) | ||
1343 | >> AC_WCAP_TYPE_SHIFT; | ||
1344 | if (type == AC_WID_PIN) | ||
1345 | break; | ||
1346 | n = snd_hda_get_connections(codec, nid, conn, | ||
1347 | ARRAY_SIZE(conn)); | ||
1348 | if (n <= 0) | ||
1349 | break; | ||
1350 | if (n > 1) { | ||
1351 | spec->mux_nids[i] = nid; | ||
1352 | break; | ||
1353 | } | ||
1354 | nid = conn[0]; | ||
1355 | } | ||
1356 | } | ||
1357 | return 0; | ||
1358 | } | ||
1359 | |||
1355 | static int patch_vt1708(struct hda_codec *codec) | 1360 | static int patch_vt1708(struct hda_codec *codec) |
1356 | { | 1361 | { |
1357 | struct via_spec *spec; | 1362 | struct via_spec *spec; |
@@ -1799,6 +1804,7 @@ static int vt1709_parse_auto_config(struct hda_codec *codec) | |||
1799 | 1804 | ||
1800 | if (spec->autocfg.dig_outs) | 1805 | if (spec->autocfg.dig_outs) |
1801 | spec->multiout.dig_out_nid = VT1709_DIGOUT_NID; | 1806 | spec->multiout.dig_out_nid = VT1709_DIGOUT_NID; |
1807 | spec->dig_in_pin = VT1709_DIGIN_PIN; | ||
1802 | if (spec->autocfg.dig_in_pin) | 1808 | if (spec->autocfg.dig_in_pin) |
1803 | spec->dig_in_nid = VT1709_DIGIN_NID; | 1809 | spec->dig_in_nid = VT1709_DIGIN_NID; |
1804 | 1810 | ||
@@ -1859,6 +1865,7 @@ static int patch_vt1709_10ch(struct hda_codec *codec) | |||
1859 | if (!spec->adc_nids && spec->input_mux) { | 1865 | if (!spec->adc_nids && spec->input_mux) { |
1860 | spec->adc_nids = vt1709_adc_nids; | 1866 | spec->adc_nids = vt1709_adc_nids; |
1861 | spec->num_adc_nids = ARRAY_SIZE(vt1709_adc_nids); | 1867 | spec->num_adc_nids = ARRAY_SIZE(vt1709_adc_nids); |
1868 | get_mux_nids(codec); | ||
1862 | spec->mixers[spec->num_mixers] = vt1709_capture_mixer; | 1869 | spec->mixers[spec->num_mixers] = vt1709_capture_mixer; |
1863 | spec->num_mixers++; | 1870 | spec->num_mixers++; |
1864 | } | 1871 | } |
@@ -1952,6 +1959,7 @@ static int patch_vt1709_6ch(struct hda_codec *codec) | |||
1952 | if (!spec->adc_nids && spec->input_mux) { | 1959 | if (!spec->adc_nids && spec->input_mux) { |
1953 | spec->adc_nids = vt1709_adc_nids; | 1960 | spec->adc_nids = vt1709_adc_nids; |
1954 | spec->num_adc_nids = ARRAY_SIZE(vt1709_adc_nids); | 1961 | spec->num_adc_nids = ARRAY_SIZE(vt1709_adc_nids); |
1962 | get_mux_nids(codec); | ||
1955 | spec->mixers[spec->num_mixers] = vt1709_capture_mixer; | 1963 | spec->mixers[spec->num_mixers] = vt1709_capture_mixer; |
1956 | spec->num_mixers++; | 1964 | spec->num_mixers++; |
1957 | } | 1965 | } |
@@ -2344,6 +2352,7 @@ static int vt1708B_parse_auto_config(struct hda_codec *codec) | |||
2344 | 2352 | ||
2345 | if (spec->autocfg.dig_outs) | 2353 | if (spec->autocfg.dig_outs) |
2346 | spec->multiout.dig_out_nid = VT1708B_DIGOUT_NID; | 2354 | spec->multiout.dig_out_nid = VT1708B_DIGOUT_NID; |
2355 | spec->dig_in_pin = VT1708B_DIGIN_PIN; | ||
2347 | if (spec->autocfg.dig_in_pin) | 2356 | if (spec->autocfg.dig_in_pin) |
2348 | spec->dig_in_nid = VT1708B_DIGIN_NID; | 2357 | spec->dig_in_nid = VT1708B_DIGIN_NID; |
2349 | 2358 | ||
@@ -2404,6 +2413,7 @@ static int patch_vt1708B_8ch(struct hda_codec *codec) | |||
2404 | if (!spec->adc_nids && spec->input_mux) { | 2413 | if (!spec->adc_nids && spec->input_mux) { |
2405 | spec->adc_nids = vt1708B_adc_nids; | 2414 | spec->adc_nids = vt1708B_adc_nids; |
2406 | spec->num_adc_nids = ARRAY_SIZE(vt1708B_adc_nids); | 2415 | spec->num_adc_nids = ARRAY_SIZE(vt1708B_adc_nids); |
2416 | get_mux_nids(codec); | ||
2407 | spec->mixers[spec->num_mixers] = vt1708B_capture_mixer; | 2417 | spec->mixers[spec->num_mixers] = vt1708B_capture_mixer; |
2408 | spec->num_mixers++; | 2418 | spec->num_mixers++; |
2409 | } | 2419 | } |
@@ -2455,6 +2465,7 @@ static int patch_vt1708B_4ch(struct hda_codec *codec) | |||
2455 | if (!spec->adc_nids && spec->input_mux) { | 2465 | if (!spec->adc_nids && spec->input_mux) { |
2456 | spec->adc_nids = vt1708B_adc_nids; | 2466 | spec->adc_nids = vt1708B_adc_nids; |
2457 | spec->num_adc_nids = ARRAY_SIZE(vt1708B_adc_nids); | 2467 | spec->num_adc_nids = ARRAY_SIZE(vt1708B_adc_nids); |
2468 | get_mux_nids(codec); | ||
2458 | spec->mixers[spec->num_mixers] = vt1708B_capture_mixer; | 2469 | spec->mixers[spec->num_mixers] = vt1708B_capture_mixer; |
2459 | spec->num_mixers++; | 2470 | spec->num_mixers++; |
2460 | } | 2471 | } |
@@ -2889,6 +2900,7 @@ static int patch_vt1708S(struct hda_codec *codec) | |||
2889 | if (!spec->adc_nids && spec->input_mux) { | 2900 | if (!spec->adc_nids && spec->input_mux) { |
2890 | spec->adc_nids = vt1708S_adc_nids; | 2901 | spec->adc_nids = vt1708S_adc_nids; |
2891 | spec->num_adc_nids = ARRAY_SIZE(vt1708S_adc_nids); | 2902 | spec->num_adc_nids = ARRAY_SIZE(vt1708S_adc_nids); |
2903 | get_mux_nids(codec); | ||
2892 | spec->mixers[spec->num_mixers] = vt1708S_capture_mixer; | 2904 | spec->mixers[spec->num_mixers] = vt1708S_capture_mixer; |
2893 | spec->num_mixers++; | 2905 | spec->num_mixers++; |
2894 | } | 2906 | } |
@@ -3206,6 +3218,7 @@ static int patch_vt1702(struct hda_codec *codec) | |||
3206 | if (!spec->adc_nids && spec->input_mux) { | 3218 | if (!spec->adc_nids && spec->input_mux) { |
3207 | spec->adc_nids = vt1702_adc_nids; | 3219 | spec->adc_nids = vt1702_adc_nids; |
3208 | spec->num_adc_nids = ARRAY_SIZE(vt1702_adc_nids); | 3220 | spec->num_adc_nids = ARRAY_SIZE(vt1702_adc_nids); |
3221 | get_mux_nids(codec); | ||
3209 | spec->mixers[spec->num_mixers] = vt1702_capture_mixer; | 3222 | spec->mixers[spec->num_mixers] = vt1702_capture_mixer; |
3210 | spec->num_mixers++; | 3223 | spec->num_mixers++; |
3211 | } | 3224 | } |
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c index d28eeaceb857..49c4b2898aff 100644 --- a/sound/soc/codecs/wm8753.c +++ b/sound/soc/codecs/wm8753.c | |||
@@ -79,7 +79,7 @@ static const u16 wm8753_reg[] = { | |||
79 | 0x0097, 0x0097, 0x0000, 0x0004, | 79 | 0x0097, 0x0097, 0x0000, 0x0004, |
80 | 0x0000, 0x0083, 0x0024, 0x01ba, | 80 | 0x0000, 0x0083, 0x0024, 0x01ba, |
81 | 0x0000, 0x0083, 0x0024, 0x01ba, | 81 | 0x0000, 0x0083, 0x0024, 0x01ba, |
82 | 0x0000, 0x0000 | 82 | 0x0000, 0x0000, 0x0000 |
83 | }; | 83 | }; |
84 | 84 | ||
85 | /* codec private data */ | 85 | /* codec private data */ |
@@ -1660,11 +1660,11 @@ static int wm8753_register(struct wm8753_priv *wm8753) | |||
1660 | codec->set_bias_level = wm8753_set_bias_level; | 1660 | codec->set_bias_level = wm8753_set_bias_level; |
1661 | codec->dai = wm8753_dai; | 1661 | codec->dai = wm8753_dai; |
1662 | codec->num_dai = 2; | 1662 | codec->num_dai = 2; |
1663 | codec->reg_cache_size = ARRAY_SIZE(wm8753->reg_cache); | 1663 | codec->reg_cache_size = ARRAY_SIZE(wm8753->reg_cache) + 1; |
1664 | codec->reg_cache = &wm8753->reg_cache; | 1664 | codec->reg_cache = &wm8753->reg_cache; |
1665 | codec->private_data = wm8753; | 1665 | codec->private_data = wm8753; |
1666 | 1666 | ||
1667 | memcpy(codec->reg_cache, wm8753_reg, sizeof(codec->reg_cache)); | 1667 | memcpy(codec->reg_cache, wm8753_reg, sizeof(wm8753->reg_cache)); |
1668 | INIT_DELAYED_WORK(&codec->delayed_work, wm8753_work); | 1668 | INIT_DELAYED_WORK(&codec->delayed_work, wm8753_work); |
1669 | 1669 | ||
1670 | ret = wm8753_reset(codec); | 1670 | ret = wm8753_reset(codec); |
diff --git a/sound/soc/codecs/wm8988.c b/sound/soc/codecs/wm8988.c index c05f71803aa8..8c0fdf84aac3 100644 --- a/sound/soc/codecs/wm8988.c +++ b/sound/soc/codecs/wm8988.c | |||
@@ -1037,14 +1037,14 @@ static int __devinit wm8988_spi_probe(struct spi_device *spi) | |||
1037 | codec->control_data = spi; | 1037 | codec->control_data = spi; |
1038 | codec->dev = &spi->dev; | 1038 | codec->dev = &spi->dev; |
1039 | 1039 | ||
1040 | spi->dev.driver_data = wm8988; | 1040 | dev_set_drvdata(&spi->dev, wm8988); |
1041 | 1041 | ||
1042 | return wm8988_register(wm8988); | 1042 | return wm8988_register(wm8988); |
1043 | } | 1043 | } |
1044 | 1044 | ||
1045 | static int __devexit wm8988_spi_remove(struct spi_device *spi) | 1045 | static int __devexit wm8988_spi_remove(struct spi_device *spi) |
1046 | { | 1046 | { |
1047 | struct wm8988_priv *wm8988 = spi->dev.driver_data; | 1047 | struct wm8988_priv *wm8988 = dev_get_drvdata(&spi->dev); |
1048 | 1048 | ||
1049 | wm8988_unregister(wm8988); | 1049 | wm8988_unregister(wm8988); |
1050 | 1050 | ||
diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c index efec33a1c5bd..f0a2d4071998 100644 --- a/sound/soc/fsl/mpc5200_dma.c +++ b/sound/soc/fsl/mpc5200_dma.c | |||
@@ -456,6 +456,7 @@ int mpc5200_audio_dma_create(struct of_device *op) | |||
456 | return -ENODEV; | 456 | return -ENODEV; |
457 | 457 | ||
458 | spin_lock_init(&psc_dma->lock); | 458 | spin_lock_init(&psc_dma->lock); |
459 | mutex_init(&psc_dma->mutex); | ||
459 | psc_dma->id = be32_to_cpu(*prop); | 460 | psc_dma->id = be32_to_cpu(*prop); |
460 | psc_dma->irq = irq; | 461 | psc_dma->irq = irq; |
461 | psc_dma->psc_regs = regs; | 462 | psc_dma->psc_regs = regs; |
diff --git a/sound/soc/fsl/mpc5200_dma.h b/sound/soc/fsl/mpc5200_dma.h index 2000803f06a7..8d396bb9d9fe 100644 --- a/sound/soc/fsl/mpc5200_dma.h +++ b/sound/soc/fsl/mpc5200_dma.h | |||
@@ -55,6 +55,7 @@ struct psc_dma { | |||
55 | unsigned int irq; | 55 | unsigned int irq; |
56 | struct device *dev; | 56 | struct device *dev; |
57 | spinlock_t lock; | 57 | spinlock_t lock; |
58 | struct mutex mutex; | ||
58 | u32 sicr; | 59 | u32 sicr; |
59 | uint sysclk; | 60 | uint sysclk; |
60 | int imr; | 61 | int imr; |
diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c index 794a247b3eb5..7eb549985d49 100644 --- a/sound/soc/fsl/mpc5200_psc_ac97.c +++ b/sound/soc/fsl/mpc5200_psc_ac97.c | |||
@@ -34,13 +34,20 @@ static unsigned short psc_ac97_read(struct snd_ac97 *ac97, unsigned short reg) | |||
34 | int status; | 34 | int status; |
35 | unsigned int val; | 35 | unsigned int val; |
36 | 36 | ||
37 | mutex_lock(&psc_dma->mutex); | ||
38 | |||
37 | /* Wait for command send status zero = ready */ | 39 | /* Wait for command send status zero = ready */ |
38 | status = spin_event_timeout(!(in_be16(&psc_dma->psc_regs->sr_csr.status) & | 40 | status = spin_event_timeout(!(in_be16(&psc_dma->psc_regs->sr_csr.status) & |
39 | MPC52xx_PSC_SR_CMDSEND), 100, 0); | 41 | MPC52xx_PSC_SR_CMDSEND), 100, 0); |
40 | if (status == 0) { | 42 | if (status == 0) { |
41 | pr_err("timeout on ac97 bus (rdy)\n"); | 43 | pr_err("timeout on ac97 bus (rdy)\n"); |
44 | mutex_unlock(&psc_dma->mutex); | ||
42 | return -ENODEV; | 45 | return -ENODEV; |
43 | } | 46 | } |
47 | |||
48 | /* Force clear the data valid bit */ | ||
49 | in_be32(&psc_dma->psc_regs->ac97_data); | ||
50 | |||
44 | /* Send the read */ | 51 | /* Send the read */ |
45 | out_be32(&psc_dma->psc_regs->ac97_cmd, (1<<31) | ((reg & 0x7f) << 24)); | 52 | out_be32(&psc_dma->psc_regs->ac97_cmd, (1<<31) | ((reg & 0x7f) << 24)); |
46 | 53 | ||
@@ -50,16 +57,19 @@ static unsigned short psc_ac97_read(struct snd_ac97 *ac97, unsigned short reg) | |||
50 | if (status == 0) { | 57 | if (status == 0) { |
51 | pr_err("timeout on ac97 read (val) %x\n", | 58 | pr_err("timeout on ac97 read (val) %x\n", |
52 | in_be16(&psc_dma->psc_regs->sr_csr.status)); | 59 | in_be16(&psc_dma->psc_regs->sr_csr.status)); |
60 | mutex_unlock(&psc_dma->mutex); | ||
53 | return -ENODEV; | 61 | return -ENODEV; |
54 | } | 62 | } |
55 | /* Get the data */ | 63 | /* Get the data */ |
56 | val = in_be32(&psc_dma->psc_regs->ac97_data); | 64 | val = in_be32(&psc_dma->psc_regs->ac97_data); |
57 | if (((val >> 24) & 0x7f) != reg) { | 65 | if (((val >> 24) & 0x7f) != reg) { |
58 | pr_err("reg echo error on ac97 read\n"); | 66 | pr_err("reg echo error on ac97 read\n"); |
67 | mutex_unlock(&psc_dma->mutex); | ||
59 | return -ENODEV; | 68 | return -ENODEV; |
60 | } | 69 | } |
61 | val = (val >> 8) & 0xffff; | 70 | val = (val >> 8) & 0xffff; |
62 | 71 | ||
72 | mutex_unlock(&psc_dma->mutex); | ||
63 | return (unsigned short) val; | 73 | return (unsigned short) val; |
64 | } | 74 | } |
65 | 75 | ||
@@ -68,16 +78,21 @@ static void psc_ac97_write(struct snd_ac97 *ac97, | |||
68 | { | 78 | { |
69 | int status; | 79 | int status; |
70 | 80 | ||
81 | mutex_lock(&psc_dma->mutex); | ||
82 | |||
71 | /* Wait for command status zero = ready */ | 83 | /* Wait for command status zero = ready */ |
72 | status = spin_event_timeout(!(in_be16(&psc_dma->psc_regs->sr_csr.status) & | 84 | status = spin_event_timeout(!(in_be16(&psc_dma->psc_regs->sr_csr.status) & |
73 | MPC52xx_PSC_SR_CMDSEND), 100, 0); | 85 | MPC52xx_PSC_SR_CMDSEND), 100, 0); |
74 | if (status == 0) { | 86 | if (status == 0) { |
75 | pr_err("timeout on ac97 bus (write)\n"); | 87 | pr_err("timeout on ac97 bus (write)\n"); |
76 | return; | 88 | goto out; |
77 | } | 89 | } |
78 | /* Write data */ | 90 | /* Write data */ |
79 | out_be32(&psc_dma->psc_regs->ac97_cmd, | 91 | out_be32(&psc_dma->psc_regs->ac97_cmd, |
80 | ((reg & 0x7f) << 24) | (val << 8)); | 92 | ((reg & 0x7f) << 24) | (val << 8)); |
93 | |||
94 | out: | ||
95 | mutex_unlock(&psc_dma->mutex); | ||
81 | } | 96 | } |
82 | 97 | ||
83 | static void psc_ac97_warm_reset(struct snd_ac97 *ac97) | 98 | static void psc_ac97_warm_reset(struct snd_ac97 *ac97) |
diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c index dd1ab6177840..9efd27f6b52f 100644 --- a/sound/usb/usx2y/usbusx2yaudio.c +++ b/sound/usb/usx2y/usbusx2yaudio.c | |||
@@ -296,9 +296,10 @@ static void usX2Y_error_urb_status(struct usX2Ydev *usX2Y, | |||
296 | static void usX2Y_error_sequence(struct usX2Ydev *usX2Y, | 296 | static void usX2Y_error_sequence(struct usX2Ydev *usX2Y, |
297 | struct snd_usX2Y_substream *subs, struct urb *urb) | 297 | struct snd_usX2Y_substream *subs, struct urb *urb) |
298 | { | 298 | { |
299 | snd_printk(KERN_ERR "Sequence Error!(hcd_frame=%i ep=%i%s;wait=%i,frame=%i).\n" | 299 | snd_printk(KERN_ERR |
300 | KERN_ERR "Most propably some urb of usb-frame %i is still missing.\n" | 300 | "Sequence Error!(hcd_frame=%i ep=%i%s;wait=%i,frame=%i).\n" |
301 | KERN_ERR "Cause could be too long delays in usb-hcd interrupt handling.\n", | 301 | "Most propably some urb of usb-frame %i is still missing.\n" |
302 | "Cause could be too long delays in usb-hcd interrupt handling.\n", | ||
302 | usb_get_current_frame_number(usX2Y->chip.dev), | 303 | usb_get_current_frame_number(usX2Y->chip.dev), |
303 | subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", | 304 | subs->endpoint, usb_pipein(urb->pipe) ? "in" : "out", |
304 | usX2Y->wait_iso_frame, urb->start_frame, usX2Y->wait_iso_frame); | 305 | usX2Y->wait_iso_frame, urb->start_frame, usX2Y->wait_iso_frame); |
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 9c6d0ae3708e..7822b3d6baca 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -164,7 +164,7 @@ endif | |||
164 | 164 | ||
165 | # CFLAGS and LDFLAGS are for the users to override from the command line. | 165 | # CFLAGS and LDFLAGS are for the users to override from the command line. |
166 | 166 | ||
167 | CFLAGS = $(M64) -ggdb3 -Wall -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -std=gnu99 -Wdeclaration-after-statement -Werror -O6 | 167 | CFLAGS = $(M64) -ggdb3 -Wall -Wextra -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -std=gnu99 -Wdeclaration-after-statement -Werror -O6 |
168 | LDFLAGS = -lpthread -lrt -lelf -lm | 168 | LDFLAGS = -lpthread -lrt -lelf -lm |
169 | ALL_CFLAGS = $(CFLAGS) | 169 | ALL_CFLAGS = $(CFLAGS) |
170 | ALL_LDFLAGS = $(LDFLAGS) | 170 | ALL_LDFLAGS = $(LDFLAGS) |
@@ -223,7 +223,7 @@ SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__powerpc__ | |||
223 | # Those must not be GNU-specific; they are shared with perl/ which may | 223 | # Those must not be GNU-specific; they are shared with perl/ which may |
224 | # be built by a different compiler. (Note that this is an artifact now | 224 | # be built by a different compiler. (Note that this is an artifact now |
225 | # but it still might be nice to keep that distinction.) | 225 | # but it still might be nice to keep that distinction.) |
226 | BASIC_CFLAGS = | 226 | BASIC_CFLAGS = -Iutil/include |
227 | BASIC_LDFLAGS = | 227 | BASIC_LDFLAGS = |
228 | 228 | ||
229 | # Guard against environment variables | 229 | # Guard against environment variables |
@@ -289,10 +289,11 @@ export PERL_PATH | |||
289 | LIB_FILE=libperf.a | 289 | LIB_FILE=libperf.a |
290 | 290 | ||
291 | LIB_H += ../../include/linux/perf_counter.h | 291 | LIB_H += ../../include/linux/perf_counter.h |
292 | LIB_H += ../../include/linux/rbtree.h | ||
293 | LIB_H += ../../include/linux/list.h | ||
294 | LIB_H += util/include/linux/list.h | ||
292 | LIB_H += perf.h | 295 | LIB_H += perf.h |
293 | LIB_H += util/types.h | 296 | LIB_H += util/types.h |
294 | LIB_H += util/list.h | ||
295 | LIB_H += util/rbtree.h | ||
296 | LIB_H += util/levenshtein.h | 297 | LIB_H += util/levenshtein.h |
297 | LIB_H += util/parse-options.h | 298 | LIB_H += util/parse-options.h |
298 | LIB_H += util/parse-events.h | 299 | LIB_H += util/parse-events.h |
@@ -305,6 +306,7 @@ LIB_H += util/strlist.h | |||
305 | LIB_H += util/run-command.h | 306 | LIB_H += util/run-command.h |
306 | LIB_H += util/sigchain.h | 307 | LIB_H += util/sigchain.h |
307 | LIB_H += util/symbol.h | 308 | LIB_H += util/symbol.h |
309 | LIB_H += util/module.h | ||
308 | LIB_H += util/color.h | 310 | LIB_H += util/color.h |
309 | 311 | ||
310 | LIB_OBJS += util/abspath.o | 312 | LIB_OBJS += util/abspath.o |
@@ -328,6 +330,7 @@ LIB_OBJS += util/usage.o | |||
328 | LIB_OBJS += util/wrapper.o | 330 | LIB_OBJS += util/wrapper.o |
329 | LIB_OBJS += util/sigchain.o | 331 | LIB_OBJS += util/sigchain.o |
330 | LIB_OBJS += util/symbol.o | 332 | LIB_OBJS += util/symbol.o |
333 | LIB_OBJS += util/module.o | ||
331 | LIB_OBJS += util/color.o | 334 | LIB_OBJS += util/color.o |
332 | LIB_OBJS += util/pager.o | 335 | LIB_OBJS += util/pager.o |
333 | LIB_OBJS += util/header.o | 336 | LIB_OBJS += util/header.o |
@@ -381,12 +384,6 @@ ifndef CC_LD_DYNPATH | |||
381 | endif | 384 | endif |
382 | endif | 385 | endif |
383 | 386 | ||
384 | ifdef ZLIB_PATH | ||
385 | BASIC_CFLAGS += -I$(ZLIB_PATH)/include | ||
386 | EXTLIBS += -L$(ZLIB_PATH)/$(lib) $(CC_LD_DYNPATH)$(ZLIB_PATH)/$(lib) | ||
387 | endif | ||
388 | EXTLIBS += -lz | ||
389 | |||
390 | ifdef NEEDS_SOCKET | 387 | ifdef NEEDS_SOCKET |
391 | EXTLIBS += -lsocket | 388 | EXTLIBS += -lsocket |
392 | endif | 389 | endif |
@@ -697,6 +694,9 @@ builtin-init-db.o: builtin-init-db.c PERF-CFLAGS | |||
697 | util/config.o: util/config.c PERF-CFLAGS | 694 | util/config.o: util/config.c PERF-CFLAGS |
698 | $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< | 695 | $(QUIET_CC)$(CC) -o $*.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< |
699 | 696 | ||
697 | util/rbtree.o: ../../lib/rbtree.c PERF-CFLAGS | ||
698 | $(QUIET_CC)$(CC) -o util/rbtree.o -c $(ALL_CFLAGS) -DETC_PERFCONFIG='"$(ETC_PERFCONFIG_SQ)"' $< | ||
699 | |||
700 | perf-%$X: %.o $(PERFLIBS) | 700 | perf-%$X: %.o $(PERFLIBS) |
701 | $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) | 701 | $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS) |
702 | 702 | ||
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c index 722c0f54e549..5f9eefecc574 100644 --- a/tools/perf/builtin-annotate.c +++ b/tools/perf/builtin-annotate.c | |||
@@ -10,9 +10,9 @@ | |||
10 | #include "util/util.h" | 10 | #include "util/util.h" |
11 | 11 | ||
12 | #include "util/color.h" | 12 | #include "util/color.h" |
13 | #include "util/list.h" | 13 | #include <linux/list.h> |
14 | #include "util/cache.h" | 14 | #include "util/cache.h" |
15 | #include "util/rbtree.h" | 15 | #include <linux/rbtree.h> |
16 | #include "util/symbol.h" | 16 | #include "util/symbol.h" |
17 | #include "util/string.h" | 17 | #include "util/string.h" |
18 | 18 | ||
@@ -25,10 +25,6 @@ | |||
25 | #define SHOW_USER 2 | 25 | #define SHOW_USER 2 |
26 | #define SHOW_HV 4 | 26 | #define SHOW_HV 4 |
27 | 27 | ||
28 | #define MIN_GREEN 0.5 | ||
29 | #define MIN_RED 5.0 | ||
30 | |||
31 | |||
32 | static char const *input_name = "perf.data"; | 28 | static char const *input_name = "perf.data"; |
33 | static char *vmlinux = "vmlinux"; | 29 | static char *vmlinux = "vmlinux"; |
34 | 30 | ||
@@ -43,6 +39,10 @@ static int dump_trace = 0; | |||
43 | 39 | ||
44 | static int verbose; | 40 | static int verbose; |
45 | 41 | ||
42 | static int modules; | ||
43 | |||
44 | static int full_paths; | ||
45 | |||
46 | static int print_line; | 46 | static int print_line; |
47 | 47 | ||
48 | static unsigned long page_size; | 48 | static unsigned long page_size; |
@@ -160,7 +160,7 @@ static void dsos__fprintf(FILE *fp) | |||
160 | 160 | ||
161 | static struct symbol *vdso__find_symbol(struct dso *dso, u64 ip) | 161 | static struct symbol *vdso__find_symbol(struct dso *dso, u64 ip) |
162 | { | 162 | { |
163 | return dso__find_symbol(kernel_dso, ip); | 163 | return dso__find_symbol(dso, ip); |
164 | } | 164 | } |
165 | 165 | ||
166 | static int load_kernel(void) | 166 | static int load_kernel(void) |
@@ -171,8 +171,8 @@ static int load_kernel(void) | |||
171 | if (!kernel_dso) | 171 | if (!kernel_dso) |
172 | return -1; | 172 | return -1; |
173 | 173 | ||
174 | err = dso__load_kernel(kernel_dso, vmlinux, NULL, verbose); | 174 | err = dso__load_kernel(kernel_dso, vmlinux, NULL, verbose, modules); |
175 | if (err) { | 175 | if (err <= 0) { |
176 | dso__delete(kernel_dso); | 176 | dso__delete(kernel_dso); |
177 | kernel_dso = NULL; | 177 | kernel_dso = NULL; |
178 | } else | 178 | } else |
@@ -203,7 +203,7 @@ static u64 map__map_ip(struct map *map, u64 ip) | |||
203 | return ip - map->start + map->pgoff; | 203 | return ip - map->start + map->pgoff; |
204 | } | 204 | } |
205 | 205 | ||
206 | static u64 vdso__map_ip(struct map *map, u64 ip) | 206 | static u64 vdso__map_ip(struct map *map __used, u64 ip) |
207 | { | 207 | { |
208 | return ip; | 208 | return ip; |
209 | } | 209 | } |
@@ -600,7 +600,7 @@ static LIST_HEAD(hist_entry__sort_list); | |||
600 | 600 | ||
601 | static int sort_dimension__add(char *tok) | 601 | static int sort_dimension__add(char *tok) |
602 | { | 602 | { |
603 | int i; | 603 | unsigned int i; |
604 | 604 | ||
605 | for (i = 0; i < ARRAY_SIZE(sort_dimensions); i++) { | 605 | for (i = 0; i < ARRAY_SIZE(sort_dimensions); i++) { |
606 | struct sort_dimension *sd = &sort_dimensions[i]; | 606 | struct sort_dimension *sd = &sort_dimensions[i]; |
@@ -1043,24 +1043,6 @@ process_event(event_t *event, unsigned long offset, unsigned long head) | |||
1043 | return 0; | 1043 | return 0; |
1044 | } | 1044 | } |
1045 | 1045 | ||
1046 | static char *get_color(double percent) | ||
1047 | { | ||
1048 | char *color = PERF_COLOR_NORMAL; | ||
1049 | |||
1050 | /* | ||
1051 | * We color high-overhead entries in red, mid-overhead | ||
1052 | * entries in green - and keep the low overhead places | ||
1053 | * normal: | ||
1054 | */ | ||
1055 | if (percent >= MIN_RED) | ||
1056 | color = PERF_COLOR_RED; | ||
1057 | else { | ||
1058 | if (percent > MIN_GREEN) | ||
1059 | color = PERF_COLOR_GREEN; | ||
1060 | } | ||
1061 | return color; | ||
1062 | } | ||
1063 | |||
1064 | static int | 1046 | static int |
1065 | parse_line(FILE *file, struct symbol *sym, u64 start, u64 len) | 1047 | parse_line(FILE *file, struct symbol *sym, u64 start, u64 len) |
1066 | { | 1048 | { |
@@ -1069,7 +1051,7 @@ parse_line(FILE *file, struct symbol *sym, u64 start, u64 len) | |||
1069 | static const char *prev_color; | 1051 | static const char *prev_color; |
1070 | unsigned int offset; | 1052 | unsigned int offset; |
1071 | size_t line_len; | 1053 | size_t line_len; |
1072 | u64 line_ip; | 1054 | s64 line_ip; |
1073 | int ret; | 1055 | int ret; |
1074 | char *c; | 1056 | char *c; |
1075 | 1057 | ||
@@ -1122,7 +1104,7 @@ parse_line(FILE *file, struct symbol *sym, u64 start, u64 len) | |||
1122 | } else if (sym->hist_sum) | 1104 | } else if (sym->hist_sum) |
1123 | percent = 100.0 * hits / sym->hist_sum; | 1105 | percent = 100.0 * hits / sym->hist_sum; |
1124 | 1106 | ||
1125 | color = get_color(percent); | 1107 | color = get_percent_color(percent); |
1126 | 1108 | ||
1127 | /* | 1109 | /* |
1128 | * Also color the filename and line if needed, with | 1110 | * Also color the filename and line if needed, with |
@@ -1258,7 +1240,7 @@ static void print_summary(char *filename) | |||
1258 | 1240 | ||
1259 | sym_ext = rb_entry(node, struct sym_ext, node); | 1241 | sym_ext = rb_entry(node, struct sym_ext, node); |
1260 | percent = sym_ext->percent; | 1242 | percent = sym_ext->percent; |
1261 | color = get_color(percent); | 1243 | color = get_percent_color(percent); |
1262 | path = sym_ext->path; | 1244 | path = sym_ext->path; |
1263 | 1245 | ||
1264 | color_fprintf(stdout, color, " %7.2f %s", percent, path); | 1246 | color_fprintf(stdout, color, " %7.2f %s", percent, path); |
@@ -1268,19 +1250,25 @@ static void print_summary(char *filename) | |||
1268 | 1250 | ||
1269 | static void annotate_sym(struct dso *dso, struct symbol *sym) | 1251 | static void annotate_sym(struct dso *dso, struct symbol *sym) |
1270 | { | 1252 | { |
1271 | char *filename = dso->name; | 1253 | char *filename = dso->name, *d_filename; |
1272 | u64 start, end, len; | 1254 | u64 start, end, len; |
1273 | char command[PATH_MAX*2]; | 1255 | char command[PATH_MAX*2]; |
1274 | FILE *file; | 1256 | FILE *file; |
1275 | 1257 | ||
1276 | if (!filename) | 1258 | if (!filename) |
1277 | return; | 1259 | return; |
1278 | if (dso == kernel_dso) | 1260 | if (sym->module) |
1261 | filename = sym->module->path; | ||
1262 | else if (dso == kernel_dso) | ||
1279 | filename = vmlinux; | 1263 | filename = vmlinux; |
1280 | 1264 | ||
1281 | start = sym->obj_start; | 1265 | start = sym->obj_start; |
1282 | if (!start) | 1266 | if (!start) |
1283 | start = sym->start; | 1267 | start = sym->start; |
1268 | if (full_paths) | ||
1269 | d_filename = filename; | ||
1270 | else | ||
1271 | d_filename = basename(filename); | ||
1284 | 1272 | ||
1285 | end = start + sym->end - sym->start + 1; | 1273 | end = start + sym->end - sym->start + 1; |
1286 | len = sym->end - sym->start; | 1274 | len = sym->end - sym->start; |
@@ -1291,13 +1279,14 @@ static void annotate_sym(struct dso *dso, struct symbol *sym) | |||
1291 | } | 1279 | } |
1292 | 1280 | ||
1293 | printf("\n\n------------------------------------------------\n"); | 1281 | printf("\n\n------------------------------------------------\n"); |
1294 | printf(" Percent | Source code & Disassembly of %s\n", filename); | 1282 | printf(" Percent | Source code & Disassembly of %s\n", d_filename); |
1295 | printf("------------------------------------------------\n"); | 1283 | printf("------------------------------------------------\n"); |
1296 | 1284 | ||
1297 | if (verbose >= 2) | 1285 | if (verbose >= 2) |
1298 | printf("annotating [%p] %30s : [%p] %30s\n", dso, dso->name, sym, sym->name); | 1286 | printf("annotating [%p] %30s : [%p] %30s\n", dso, dso->name, sym, sym->name); |
1299 | 1287 | ||
1300 | sprintf(command, "objdump --start-address=0x%016Lx --stop-address=0x%016Lx -dS %s", (u64)start, (u64)end, filename); | 1288 | sprintf(command, "objdump --start-address=0x%016Lx --stop-address=0x%016Lx -dS %s|grep -v %s", |
1289 | (u64)start, (u64)end, filename, filename); | ||
1301 | 1290 | ||
1302 | if (verbose >= 3) | 1291 | if (verbose >= 3) |
1303 | printf("doing: %s\n", command); | 1292 | printf("doing: %s\n", command); |
@@ -1428,7 +1417,7 @@ more: | |||
1428 | 1417 | ||
1429 | head += size; | 1418 | head += size; |
1430 | 1419 | ||
1431 | if (offset + head < stat.st_size) | 1420 | if (offset + head < (unsigned long)stat.st_size) |
1432 | goto more; | 1421 | goto more; |
1433 | 1422 | ||
1434 | rc = EXIT_SUCCESS; | 1423 | rc = EXIT_SUCCESS; |
@@ -1472,8 +1461,12 @@ static const struct option options[] = { | |||
1472 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, | 1461 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, |
1473 | "dump raw trace in ASCII"), | 1462 | "dump raw trace in ASCII"), |
1474 | OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"), | 1463 | OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"), |
1464 | OPT_BOOLEAN('m', "modules", &modules, | ||
1465 | "load module symbols - WARNING: use only with -k and LIVE kernel"), | ||
1475 | OPT_BOOLEAN('l', "print-line", &print_line, | 1466 | OPT_BOOLEAN('l', "print-line", &print_line, |
1476 | "print matching source lines (may be slow)"), | 1467 | "print matching source lines (may be slow)"), |
1468 | OPT_BOOLEAN('P', "full-paths", &full_paths, | ||
1469 | "Don't shorten the displayed pathnames"), | ||
1477 | OPT_END() | 1470 | OPT_END() |
1478 | }; | 1471 | }; |
1479 | 1472 | ||
@@ -1492,7 +1485,7 @@ static void setup_sorting(void) | |||
1492 | free(str); | 1485 | free(str); |
1493 | } | 1486 | } |
1494 | 1487 | ||
1495 | int cmd_annotate(int argc, const char **argv, const char *prefix) | 1488 | int cmd_annotate(int argc, const char **argv, const char *prefix __used) |
1496 | { | 1489 | { |
1497 | symbol__init(); | 1490 | symbol__init(); |
1498 | 1491 | ||
diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c index 0f32dc3f3c4c..2599d86a733b 100644 --- a/tools/perf/builtin-help.c +++ b/tools/perf/builtin-help.c | |||
@@ -3,6 +3,7 @@ | |||
3 | * | 3 | * |
4 | * Builtin help command | 4 | * Builtin help command |
5 | */ | 5 | */ |
6 | #include "perf.h" | ||
6 | #include "util/cache.h" | 7 | #include "util/cache.h" |
7 | #include "builtin.h" | 8 | #include "builtin.h" |
8 | #include "util/exec_cmd.h" | 9 | #include "util/exec_cmd.h" |
@@ -277,7 +278,7 @@ static struct cmdnames main_cmds, other_cmds; | |||
277 | 278 | ||
278 | void list_common_cmds_help(void) | 279 | void list_common_cmds_help(void) |
279 | { | 280 | { |
280 | int i, longest = 0; | 281 | unsigned int i, longest = 0; |
281 | 282 | ||
282 | for (i = 0; i < ARRAY_SIZE(common_cmds); i++) { | 283 | for (i = 0; i < ARRAY_SIZE(common_cmds); i++) { |
283 | if (longest < strlen(common_cmds[i].name)) | 284 | if (longest < strlen(common_cmds[i].name)) |
@@ -415,9 +416,10 @@ static void show_html_page(const char *perf_cmd) | |||
415 | open_html(page_path.buf); | 416 | open_html(page_path.buf); |
416 | } | 417 | } |
417 | 418 | ||
418 | int cmd_help(int argc, const char **argv, const char *prefix) | 419 | int cmd_help(int argc, const char **argv, const char *prefix __used) |
419 | { | 420 | { |
420 | const char *alias; | 421 | const char *alias; |
422 | |||
421 | load_command_list("perf-", &main_cmds, &other_cmds); | 423 | load_command_list("perf-", &main_cmds, &other_cmds); |
422 | 424 | ||
423 | perf_config(perf_help_config, NULL); | 425 | perf_config(perf_help_config, NULL); |
diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c index fe60e37c96ef..f990fa8a35c9 100644 --- a/tools/perf/builtin-list.c +++ b/tools/perf/builtin-list.c | |||
@@ -13,7 +13,7 @@ | |||
13 | #include "util/parse-options.h" | 13 | #include "util/parse-options.h" |
14 | #include "util/parse-events.h" | 14 | #include "util/parse-events.h" |
15 | 15 | ||
16 | int cmd_list(int argc, const char **argv, const char *prefix) | 16 | int cmd_list(int argc __used, const char **argv __used, const char *prefix __used) |
17 | { | 17 | { |
18 | print_events(); | 18 | print_events(); |
19 | return 0; | 19 | return 0; |
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index d18546f37d7c..4ef78a5e6f32 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -294,7 +294,7 @@ static void pid_synthesize_mmap_samples(pid_t pid) | |||
294 | while (1) { | 294 | while (1) { |
295 | char bf[BUFSIZ], *pbf = bf; | 295 | char bf[BUFSIZ], *pbf = bf; |
296 | struct mmap_event mmap_ev = { | 296 | struct mmap_event mmap_ev = { |
297 | .header.type = PERF_EVENT_MMAP, | 297 | .header = { .type = PERF_EVENT_MMAP }, |
298 | }; | 298 | }; |
299 | int n; | 299 | int n; |
300 | size_t size; | 300 | size_t size; |
@@ -650,7 +650,7 @@ static const struct option options[] = { | |||
650 | OPT_END() | 650 | OPT_END() |
651 | }; | 651 | }; |
652 | 652 | ||
653 | int cmd_record(int argc, const char **argv, const char *prefix) | 653 | int cmd_record(int argc, const char **argv, const char *prefix __used) |
654 | { | 654 | { |
655 | int counter; | 655 | int counter; |
656 | 656 | ||
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 135b7837e6bf..4e5cc266311e 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -10,9 +10,9 @@ | |||
10 | #include "util/util.h" | 10 | #include "util/util.h" |
11 | 11 | ||
12 | #include "util/color.h" | 12 | #include "util/color.h" |
13 | #include "util/list.h" | 13 | #include <linux/list.h> |
14 | #include "util/cache.h" | 14 | #include "util/cache.h" |
15 | #include "util/rbtree.h" | 15 | #include <linux/rbtree.h> |
16 | #include "util/symbol.h" | 16 | #include "util/symbol.h" |
17 | #include "util/string.h" | 17 | #include "util/string.h" |
18 | #include "util/callchain.h" | 18 | #include "util/callchain.h" |
@@ -46,6 +46,8 @@ static int dump_trace = 0; | |||
46 | static int verbose; | 46 | static int verbose; |
47 | #define eprintf(x...) do { if (verbose) fprintf(stderr, x); } while (0) | 47 | #define eprintf(x...) do { if (verbose) fprintf(stderr, x); } while (0) |
48 | 48 | ||
49 | static int modules; | ||
50 | |||
49 | static int full_paths; | 51 | static int full_paths; |
50 | 52 | ||
51 | static unsigned long page_size; | 53 | static unsigned long page_size; |
@@ -56,8 +58,17 @@ static char *parent_pattern = default_parent_pattern; | |||
56 | static regex_t parent_regex; | 58 | static regex_t parent_regex; |
57 | 59 | ||
58 | static int exclude_other = 1; | 60 | static int exclude_other = 1; |
61 | |||
62 | static char callchain_default_opt[] = "fractal,0.5"; | ||
63 | |||
59 | static int callchain; | 64 | static int callchain; |
60 | 65 | ||
66 | static | ||
67 | struct callchain_param callchain_param = { | ||
68 | .mode = CHAIN_GRAPH_ABS, | ||
69 | .min_percent = 0.5 | ||
70 | }; | ||
71 | |||
61 | static u64 sample_type; | 72 | static u64 sample_type; |
62 | 73 | ||
63 | struct ip_event { | 74 | struct ip_event { |
@@ -121,6 +132,7 @@ typedef union event_union { | |||
121 | static LIST_HEAD(dsos); | 132 | static LIST_HEAD(dsos); |
122 | static struct dso *kernel_dso; | 133 | static struct dso *kernel_dso; |
123 | static struct dso *vdso; | 134 | static struct dso *vdso; |
135 | static struct dso *hypervisor_dso; | ||
124 | 136 | ||
125 | static void dsos__add(struct dso *dso) | 137 | static void dsos__add(struct dso *dso) |
126 | { | 138 | { |
@@ -176,7 +188,7 @@ static void dsos__fprintf(FILE *fp) | |||
176 | 188 | ||
177 | static struct symbol *vdso__find_symbol(struct dso *dso, u64 ip) | 189 | static struct symbol *vdso__find_symbol(struct dso *dso, u64 ip) |
178 | { | 190 | { |
179 | return dso__find_symbol(kernel_dso, ip); | 191 | return dso__find_symbol(dso, ip); |
180 | } | 192 | } |
181 | 193 | ||
182 | static int load_kernel(void) | 194 | static int load_kernel(void) |
@@ -187,8 +199,8 @@ static int load_kernel(void) | |||
187 | if (!kernel_dso) | 199 | if (!kernel_dso) |
188 | return -1; | 200 | return -1; |
189 | 201 | ||
190 | err = dso__load_kernel(kernel_dso, vmlinux, NULL, verbose); | 202 | err = dso__load_kernel(kernel_dso, vmlinux, NULL, verbose, modules); |
191 | if (err) { | 203 | if (err <= 0) { |
192 | dso__delete(kernel_dso); | 204 | dso__delete(kernel_dso); |
193 | kernel_dso = NULL; | 205 | kernel_dso = NULL; |
194 | } else | 206 | } else |
@@ -202,6 +214,11 @@ static int load_kernel(void) | |||
202 | 214 | ||
203 | dsos__add(vdso); | 215 | dsos__add(vdso); |
204 | 216 | ||
217 | hypervisor_dso = dso__new("[hypervisor]", 0); | ||
218 | if (!hypervisor_dso) | ||
219 | return -1; | ||
220 | dsos__add(hypervisor_dso); | ||
221 | |||
205 | return err; | 222 | return err; |
206 | } | 223 | } |
207 | 224 | ||
@@ -233,7 +250,7 @@ static u64 map__map_ip(struct map *map, u64 ip) | |||
233 | return ip - map->start + map->pgoff; | 250 | return ip - map->start + map->pgoff; |
234 | } | 251 | } |
235 | 252 | ||
236 | static u64 vdso__map_ip(struct map *map, u64 ip) | 253 | static u64 vdso__map_ip(struct map *map __used, u64 ip) |
237 | { | 254 | { |
238 | return ip; | 255 | return ip; |
239 | } | 256 | } |
@@ -640,7 +657,11 @@ sort__sym_print(FILE *fp, struct hist_entry *self) | |||
640 | 657 | ||
641 | if (self->sym) { | 658 | if (self->sym) { |
642 | ret += fprintf(fp, "[%c] %s", | 659 | ret += fprintf(fp, "[%c] %s", |
643 | self->dso == kernel_dso ? 'k' : '.', self->sym->name); | 660 | self->dso == kernel_dso ? 'k' : |
661 | self->dso == hypervisor_dso ? 'h' : '.', self->sym->name); | ||
662 | |||
663 | if (self->sym->module) | ||
664 | ret += fprintf(fp, "\t[%s]", self->sym->module->name); | ||
644 | } else { | 665 | } else { |
645 | ret += fprintf(fp, "%#016llx", (u64)self->ip); | 666 | ret += fprintf(fp, "%#016llx", (u64)self->ip); |
646 | } | 667 | } |
@@ -705,7 +726,7 @@ static LIST_HEAD(hist_entry__sort_list); | |||
705 | 726 | ||
706 | static int sort_dimension__add(char *tok) | 727 | static int sort_dimension__add(char *tok) |
707 | { | 728 | { |
708 | int i; | 729 | unsigned int i; |
709 | 730 | ||
710 | for (i = 0; i < ARRAY_SIZE(sort_dimensions); i++) { | 731 | for (i = 0; i < ARRAY_SIZE(sort_dimensions); i++) { |
711 | struct sort_dimension *sd = &sort_dimensions[i]; | 732 | struct sort_dimension *sd = &sort_dimensions[i]; |
@@ -775,8 +796,109 @@ hist_entry__collapse(struct hist_entry *left, struct hist_entry *right) | |||
775 | return cmp; | 796 | return cmp; |
776 | } | 797 | } |
777 | 798 | ||
799 | static size_t ipchain__fprintf_graph_line(FILE *fp, int depth, int depth_mask) | ||
800 | { | ||
801 | int i; | ||
802 | size_t ret = 0; | ||
803 | |||
804 | ret += fprintf(fp, "%s", " "); | ||
805 | |||
806 | for (i = 0; i < depth; i++) | ||
807 | if (depth_mask & (1 << i)) | ||
808 | ret += fprintf(fp, "| "); | ||
809 | else | ||
810 | ret += fprintf(fp, " "); | ||
811 | |||
812 | ret += fprintf(fp, "\n"); | ||
813 | |||
814 | return ret; | ||
815 | } | ||
816 | static size_t | ||
817 | ipchain__fprintf_graph(FILE *fp, struct callchain_list *chain, int depth, | ||
818 | int depth_mask, int count, u64 total_samples, | ||
819 | int hits) | ||
820 | { | ||
821 | int i; | ||
822 | size_t ret = 0; | ||
823 | |||
824 | ret += fprintf(fp, "%s", " "); | ||
825 | for (i = 0; i < depth; i++) { | ||
826 | if (depth_mask & (1 << i)) | ||
827 | ret += fprintf(fp, "|"); | ||
828 | else | ||
829 | ret += fprintf(fp, " "); | ||
830 | if (!count && i == depth - 1) { | ||
831 | double percent; | ||
832 | |||
833 | percent = hits * 100.0 / total_samples; | ||
834 | ret += percent_color_fprintf(fp, "--%2.2f%%-- ", percent); | ||
835 | } else | ||
836 | ret += fprintf(fp, "%s", " "); | ||
837 | } | ||
838 | if (chain->sym) | ||
839 | ret += fprintf(fp, "%s\n", chain->sym->name); | ||
840 | else | ||
841 | ret += fprintf(fp, "%p\n", (void *)(long)chain->ip); | ||
842 | |||
843 | return ret; | ||
844 | } | ||
845 | |||
846 | static size_t | ||
847 | callchain__fprintf_graph(FILE *fp, struct callchain_node *self, | ||
848 | u64 total_samples, int depth, int depth_mask) | ||
849 | { | ||
850 | struct rb_node *node, *next; | ||
851 | struct callchain_node *child; | ||
852 | struct callchain_list *chain; | ||
853 | int new_depth_mask = depth_mask; | ||
854 | u64 new_total; | ||
855 | size_t ret = 0; | ||
856 | int i; | ||
857 | |||
858 | if (callchain_param.mode == CHAIN_GRAPH_REL) | ||
859 | new_total = self->cumul_hit; | ||
860 | else | ||
861 | new_total = total_samples; | ||
862 | |||
863 | node = rb_first(&self->rb_root); | ||
864 | while (node) { | ||
865 | child = rb_entry(node, struct callchain_node, rb_node); | ||
866 | |||
867 | /* | ||
868 | * The depth mask manages the output of pipes that show | ||
869 | * the depth. We don't want to keep the pipes of the current | ||
870 | * level for the last child of this depth | ||
871 | */ | ||
872 | next = rb_next(node); | ||
873 | if (!next) | ||
874 | new_depth_mask &= ~(1 << (depth - 1)); | ||
875 | |||
876 | /* | ||
877 | * But we keep the older depth mask for the line seperator | ||
878 | * to keep the level link until we reach the last child | ||
879 | */ | ||
880 | ret += ipchain__fprintf_graph_line(fp, depth, depth_mask); | ||
881 | i = 0; | ||
882 | list_for_each_entry(chain, &child->val, list) { | ||
883 | if (chain->ip >= PERF_CONTEXT_MAX) | ||
884 | continue; | ||
885 | ret += ipchain__fprintf_graph(fp, chain, depth, | ||
886 | new_depth_mask, i++, | ||
887 | new_total, | ||
888 | child->cumul_hit); | ||
889 | } | ||
890 | ret += callchain__fprintf_graph(fp, child, new_total, | ||
891 | depth + 1, | ||
892 | new_depth_mask | (1 << depth)); | ||
893 | node = next; | ||
894 | } | ||
895 | |||
896 | return ret; | ||
897 | } | ||
898 | |||
778 | static size_t | 899 | static size_t |
779 | callchain__fprintf(FILE *fp, struct callchain_node *self, u64 total_samples) | 900 | callchain__fprintf_flat(FILE *fp, struct callchain_node *self, |
901 | u64 total_samples) | ||
780 | { | 902 | { |
781 | struct callchain_list *chain; | 903 | struct callchain_list *chain; |
782 | size_t ret = 0; | 904 | size_t ret = 0; |
@@ -784,11 +906,18 @@ callchain__fprintf(FILE *fp, struct callchain_node *self, u64 total_samples) | |||
784 | if (!self) | 906 | if (!self) |
785 | return 0; | 907 | return 0; |
786 | 908 | ||
787 | ret += callchain__fprintf(fp, self->parent, total_samples); | 909 | ret += callchain__fprintf_flat(fp, self->parent, total_samples); |
788 | 910 | ||
789 | 911 | ||
790 | list_for_each_entry(chain, &self->val, list) | 912 | list_for_each_entry(chain, &self->val, list) { |
791 | ret += fprintf(fp, " %p\n", (void *)chain->ip); | 913 | if (chain->ip >= PERF_CONTEXT_MAX) |
914 | continue; | ||
915 | if (chain->sym) | ||
916 | ret += fprintf(fp, " %s\n", chain->sym->name); | ||
917 | else | ||
918 | ret += fprintf(fp, " %p\n", | ||
919 | (void *)(long)chain->ip); | ||
920 | } | ||
792 | 921 | ||
793 | return ret; | 922 | return ret; |
794 | } | 923 | } |
@@ -807,8 +936,19 @@ hist_entry_callchain__fprintf(FILE *fp, struct hist_entry *self, | |||
807 | 936 | ||
808 | chain = rb_entry(rb_node, struct callchain_node, rb_node); | 937 | chain = rb_entry(rb_node, struct callchain_node, rb_node); |
809 | percent = chain->hit * 100.0 / total_samples; | 938 | percent = chain->hit * 100.0 / total_samples; |
810 | ret += fprintf(fp, " %6.2f%%\n", percent); | 939 | switch (callchain_param.mode) { |
811 | ret += callchain__fprintf(fp, chain, total_samples); | 940 | case CHAIN_FLAT: |
941 | ret += percent_color_fprintf(fp, " %6.2f%%\n", | ||
942 | percent); | ||
943 | ret += callchain__fprintf_flat(fp, chain, total_samples); | ||
944 | break; | ||
945 | case CHAIN_GRAPH_ABS: /* Falldown */ | ||
946 | case CHAIN_GRAPH_REL: | ||
947 | ret += callchain__fprintf_graph(fp, chain, | ||
948 | total_samples, 1, 1); | ||
949 | default: | ||
950 | break; | ||
951 | } | ||
812 | ret += fprintf(fp, "\n"); | 952 | ret += fprintf(fp, "\n"); |
813 | rb_node = rb_next(rb_node); | 953 | rb_node = rb_next(rb_node); |
814 | } | 954 | } |
@@ -826,25 +966,10 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, u64 total_samples) | |||
826 | if (exclude_other && !self->parent) | 966 | if (exclude_other && !self->parent) |
827 | return 0; | 967 | return 0; |
828 | 968 | ||
829 | if (total_samples) { | 969 | if (total_samples) |
830 | double percent = self->count * 100.0 / total_samples; | 970 | ret = percent_color_fprintf(fp, " %6.2f%%", |
831 | char *color = PERF_COLOR_NORMAL; | ||
832 | |||
833 | /* | ||
834 | * We color high-overhead entries in red, mid-overhead | ||
835 | * entries in green - and keep the low overhead places | ||
836 | * normal: | ||
837 | */ | ||
838 | if (percent >= 5.0) { | ||
839 | color = PERF_COLOR_RED; | ||
840 | } else { | ||
841 | if (percent >= 0.5) | ||
842 | color = PERF_COLOR_GREEN; | ||
843 | } | ||
844 | |||
845 | ret = color_fprintf(fp, color, " %6.2f%%", | ||
846 | (self->count * 100.0) / total_samples); | 971 | (self->count * 100.0) / total_samples); |
847 | } else | 972 | else |
848 | ret = fprintf(fp, "%12Ld ", self->count); | 973 | ret = fprintf(fp, "%12Ld ", self->count); |
849 | 974 | ||
850 | list_for_each_entry(se, &hist_entry__sort_list, list) { | 975 | list_for_each_entry(se, &hist_entry__sort_list, list) { |
@@ -923,6 +1048,58 @@ static int call__match(struct symbol *sym) | |||
923 | return 0; | 1048 | return 0; |
924 | } | 1049 | } |
925 | 1050 | ||
1051 | static struct symbol ** | ||
1052 | resolve_callchain(struct thread *thread, struct map *map __used, | ||
1053 | struct ip_callchain *chain, struct hist_entry *entry) | ||
1054 | { | ||
1055 | u64 context = PERF_CONTEXT_MAX; | ||
1056 | struct symbol **syms = NULL; | ||
1057 | unsigned int i; | ||
1058 | |||
1059 | if (callchain) { | ||
1060 | syms = calloc(chain->nr, sizeof(*syms)); | ||
1061 | if (!syms) { | ||
1062 | fprintf(stderr, "Can't allocate memory for symbols\n"); | ||
1063 | exit(-1); | ||
1064 | } | ||
1065 | } | ||
1066 | |||
1067 | for (i = 0; i < chain->nr; i++) { | ||
1068 | u64 ip = chain->ips[i]; | ||
1069 | struct dso *dso = NULL; | ||
1070 | struct symbol *sym; | ||
1071 | |||
1072 | if (ip >= PERF_CONTEXT_MAX) { | ||
1073 | context = ip; | ||
1074 | continue; | ||
1075 | } | ||
1076 | |||
1077 | switch (context) { | ||
1078 | case PERF_CONTEXT_HV: | ||
1079 | dso = hypervisor_dso; | ||
1080 | break; | ||
1081 | case PERF_CONTEXT_KERNEL: | ||
1082 | dso = kernel_dso; | ||
1083 | break; | ||
1084 | default: | ||
1085 | break; | ||
1086 | } | ||
1087 | |||
1088 | sym = resolve_symbol(thread, NULL, &dso, &ip); | ||
1089 | |||
1090 | if (sym) { | ||
1091 | if (sort__has_parent && call__match(sym) && | ||
1092 | !entry->parent) | ||
1093 | entry->parent = sym; | ||
1094 | if (!callchain) | ||
1095 | break; | ||
1096 | syms[i] = sym; | ||
1097 | } | ||
1098 | } | ||
1099 | |||
1100 | return syms; | ||
1101 | } | ||
1102 | |||
926 | /* | 1103 | /* |
927 | * collect histogram counts | 1104 | * collect histogram counts |
928 | */ | 1105 | */ |
@@ -935,6 +1112,7 @@ hist_entry__add(struct thread *thread, struct map *map, struct dso *dso, | |||
935 | struct rb_node **p = &hist.rb_node; | 1112 | struct rb_node **p = &hist.rb_node; |
936 | struct rb_node *parent = NULL; | 1113 | struct rb_node *parent = NULL; |
937 | struct hist_entry *he; | 1114 | struct hist_entry *he; |
1115 | struct symbol **syms = NULL; | ||
938 | struct hist_entry entry = { | 1116 | struct hist_entry entry = { |
939 | .thread = thread, | 1117 | .thread = thread, |
940 | .map = map, | 1118 | .map = map, |
@@ -948,36 +1126,8 @@ hist_entry__add(struct thread *thread, struct map *map, struct dso *dso, | |||
948 | }; | 1126 | }; |
949 | int cmp; | 1127 | int cmp; |
950 | 1128 | ||
951 | if (sort__has_parent && chain) { | 1129 | if ((sort__has_parent || callchain) && chain) |
952 | u64 context = PERF_CONTEXT_MAX; | 1130 | syms = resolve_callchain(thread, map, chain, &entry); |
953 | int i; | ||
954 | |||
955 | for (i = 0; i < chain->nr; i++) { | ||
956 | u64 ip = chain->ips[i]; | ||
957 | struct dso *dso = NULL; | ||
958 | struct symbol *sym; | ||
959 | |||
960 | if (ip >= PERF_CONTEXT_MAX) { | ||
961 | context = ip; | ||
962 | continue; | ||
963 | } | ||
964 | |||
965 | switch (context) { | ||
966 | case PERF_CONTEXT_KERNEL: | ||
967 | dso = kernel_dso; | ||
968 | break; | ||
969 | default: | ||
970 | break; | ||
971 | } | ||
972 | |||
973 | sym = resolve_symbol(thread, NULL, &dso, &ip); | ||
974 | |||
975 | if (sym && call__match(sym)) { | ||
976 | entry.parent = sym; | ||
977 | break; | ||
978 | } | ||
979 | } | ||
980 | } | ||
981 | 1131 | ||
982 | while (*p != NULL) { | 1132 | while (*p != NULL) { |
983 | parent = *p; | 1133 | parent = *p; |
@@ -987,8 +1137,10 @@ hist_entry__add(struct thread *thread, struct map *map, struct dso *dso, | |||
987 | 1137 | ||
988 | if (!cmp) { | 1138 | if (!cmp) { |
989 | he->count += count; | 1139 | he->count += count; |
990 | if (callchain) | 1140 | if (callchain) { |
991 | append_chain(&he->callchain, chain); | 1141 | append_chain(&he->callchain, chain, syms); |
1142 | free(syms); | ||
1143 | } | ||
992 | return 0; | 1144 | return 0; |
993 | } | 1145 | } |
994 | 1146 | ||
@@ -1004,7 +1156,8 @@ hist_entry__add(struct thread *thread, struct map *map, struct dso *dso, | |||
1004 | *he = entry; | 1156 | *he = entry; |
1005 | if (callchain) { | 1157 | if (callchain) { |
1006 | callchain_init(&he->callchain); | 1158 | callchain_init(&he->callchain); |
1007 | append_chain(&he->callchain, chain); | 1159 | append_chain(&he->callchain, chain, syms); |
1160 | free(syms); | ||
1008 | } | 1161 | } |
1009 | rb_link_node(&he->rb_node, parent, p); | 1162 | rb_link_node(&he->rb_node, parent, p); |
1010 | rb_insert_color(&he->rb_node, &hist); | 1163 | rb_insert_color(&he->rb_node, &hist); |
@@ -1076,14 +1229,15 @@ static void collapse__resort(void) | |||
1076 | 1229 | ||
1077 | static struct rb_root output_hists; | 1230 | static struct rb_root output_hists; |
1078 | 1231 | ||
1079 | static void output__insert_entry(struct hist_entry *he) | 1232 | static void output__insert_entry(struct hist_entry *he, u64 min_callchain_hits) |
1080 | { | 1233 | { |
1081 | struct rb_node **p = &output_hists.rb_node; | 1234 | struct rb_node **p = &output_hists.rb_node; |
1082 | struct rb_node *parent = NULL; | 1235 | struct rb_node *parent = NULL; |
1083 | struct hist_entry *iter; | 1236 | struct hist_entry *iter; |
1084 | 1237 | ||
1085 | if (callchain) | 1238 | if (callchain) |
1086 | sort_chain_to_rbtree(&he->sorted_chain, &he->callchain); | 1239 | callchain_param.sort(&he->sorted_chain, &he->callchain, |
1240 | min_callchain_hits, &callchain_param); | ||
1087 | 1241 | ||
1088 | while (*p != NULL) { | 1242 | while (*p != NULL) { |
1089 | parent = *p; | 1243 | parent = *p; |
@@ -1099,11 +1253,14 @@ static void output__insert_entry(struct hist_entry *he) | |||
1099 | rb_insert_color(&he->rb_node, &output_hists); | 1253 | rb_insert_color(&he->rb_node, &output_hists); |
1100 | } | 1254 | } |
1101 | 1255 | ||
1102 | static void output__resort(void) | 1256 | static void output__resort(u64 total_samples) |
1103 | { | 1257 | { |
1104 | struct rb_node *next; | 1258 | struct rb_node *next; |
1105 | struct hist_entry *n; | 1259 | struct hist_entry *n; |
1106 | struct rb_root *tree = &hist; | 1260 | struct rb_root *tree = &hist; |
1261 | u64 min_callchain_hits; | ||
1262 | |||
1263 | min_callchain_hits = total_samples * (callchain_param.min_percent / 100); | ||
1107 | 1264 | ||
1108 | if (sort__need_collapse) | 1265 | if (sort__need_collapse) |
1109 | tree = &collapse_hists; | 1266 | tree = &collapse_hists; |
@@ -1115,7 +1272,7 @@ static void output__resort(void) | |||
1115 | next = rb_next(&n->rb_node); | 1272 | next = rb_next(&n->rb_node); |
1116 | 1273 | ||
1117 | rb_erase(&n->rb_node, tree); | 1274 | rb_erase(&n->rb_node, tree); |
1118 | output__insert_entry(n); | 1275 | output__insert_entry(n, min_callchain_hits); |
1119 | } | 1276 | } |
1120 | } | 1277 | } |
1121 | 1278 | ||
@@ -1141,7 +1298,7 @@ static size_t output__fprintf(FILE *fp, u64 total_samples) | |||
1141 | 1298 | ||
1142 | fprintf(fp, "# ........"); | 1299 | fprintf(fp, "# ........"); |
1143 | list_for_each_entry(se, &hist_entry__sort_list, list) { | 1300 | list_for_each_entry(se, &hist_entry__sort_list, list) { |
1144 | int i; | 1301 | unsigned int i; |
1145 | 1302 | ||
1146 | if (exclude_other && (se == &sort_parent)) | 1303 | if (exclude_other && (se == &sort_parent)) |
1147 | continue; | 1304 | continue; |
@@ -1213,6 +1370,7 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head) | |||
1213 | struct map *map = NULL; | 1370 | struct map *map = NULL; |
1214 | void *more_data = event->ip.__more_data; | 1371 | void *more_data = event->ip.__more_data; |
1215 | struct ip_callchain *chain = NULL; | 1372 | struct ip_callchain *chain = NULL; |
1373 | int cpumode; | ||
1216 | 1374 | ||
1217 | if (sample_type & PERF_SAMPLE_PERIOD) { | 1375 | if (sample_type & PERF_SAMPLE_PERIOD) { |
1218 | period = *(u64 *)more_data; | 1376 | period = *(u64 *)more_data; |
@@ -1228,7 +1386,7 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head) | |||
1228 | (long long)period); | 1386 | (long long)period); |
1229 | 1387 | ||
1230 | if (sample_type & PERF_SAMPLE_CALLCHAIN) { | 1388 | if (sample_type & PERF_SAMPLE_CALLCHAIN) { |
1231 | int i; | 1389 | unsigned int i; |
1232 | 1390 | ||
1233 | chain = (void *)more_data; | 1391 | chain = (void *)more_data; |
1234 | 1392 | ||
@@ -1256,7 +1414,9 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head) | |||
1256 | if (comm_list && !strlist__has_entry(comm_list, thread->comm)) | 1414 | if (comm_list && !strlist__has_entry(comm_list, thread->comm)) |
1257 | return 0; | 1415 | return 0; |
1258 | 1416 | ||
1259 | if (event->header.misc & PERF_EVENT_MISC_KERNEL) { | 1417 | cpumode = event->header.misc & PERF_EVENT_MISC_CPUMODE_MASK; |
1418 | |||
1419 | if (cpumode == PERF_EVENT_MISC_KERNEL) { | ||
1260 | show = SHOW_KERNEL; | 1420 | show = SHOW_KERNEL; |
1261 | level = 'k'; | 1421 | level = 'k'; |
1262 | 1422 | ||
@@ -1264,7 +1424,7 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head) | |||
1264 | 1424 | ||
1265 | dprintf(" ...... dso: %s\n", dso->name); | 1425 | dprintf(" ...... dso: %s\n", dso->name); |
1266 | 1426 | ||
1267 | } else if (event->header.misc & PERF_EVENT_MISC_USER) { | 1427 | } else if (cpumode == PERF_EVENT_MISC_USER) { |
1268 | 1428 | ||
1269 | show = SHOW_USER; | 1429 | show = SHOW_USER; |
1270 | level = '.'; | 1430 | level = '.'; |
@@ -1272,6 +1432,9 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head) | |||
1272 | } else { | 1432 | } else { |
1273 | show = SHOW_HV; | 1433 | show = SHOW_HV; |
1274 | level = 'H'; | 1434 | level = 'H'; |
1435 | |||
1436 | dso = hypervisor_dso; | ||
1437 | |||
1275 | dprintf(" ...... dso: [hypervisor]\n"); | 1438 | dprintf(" ...... dso: [hypervisor]\n"); |
1276 | } | 1439 | } |
1277 | 1440 | ||
@@ -1534,9 +1697,19 @@ static int __cmd_report(void) | |||
1534 | 1697 | ||
1535 | sample_type = perf_header__sample_type(); | 1698 | sample_type = perf_header__sample_type(); |
1536 | 1699 | ||
1537 | if (sort__has_parent && !(sample_type & PERF_SAMPLE_CALLCHAIN)) { | 1700 | if (!(sample_type & PERF_SAMPLE_CALLCHAIN)) { |
1538 | fprintf(stderr, "selected --sort parent, but no callchain data\n"); | 1701 | if (sort__has_parent) { |
1539 | exit(-1); | 1702 | fprintf(stderr, "selected --sort parent, but no" |
1703 | " callchain data. Did you call" | ||
1704 | " perf record without -g?\n"); | ||
1705 | exit(-1); | ||
1706 | } | ||
1707 | if (callchain) { | ||
1708 | fprintf(stderr, "selected -c but no callchain data." | ||
1709 | " Did you call perf record without" | ||
1710 | " -g?\n"); | ||
1711 | exit(-1); | ||
1712 | } | ||
1540 | } | 1713 | } |
1541 | 1714 | ||
1542 | if (load_kernel() < 0) { | 1715 | if (load_kernel() < 0) { |
@@ -1619,7 +1792,7 @@ more: | |||
1619 | if (offset + head >= header->data_offset + header->data_size) | 1792 | if (offset + head >= header->data_offset + header->data_size) |
1620 | goto done; | 1793 | goto done; |
1621 | 1794 | ||
1622 | if (offset + head < stat.st_size) | 1795 | if (offset + head < (unsigned long)stat.st_size) |
1623 | goto more; | 1796 | goto more; |
1624 | 1797 | ||
1625 | done: | 1798 | done: |
@@ -1643,12 +1816,58 @@ done: | |||
1643 | dsos__fprintf(stdout); | 1816 | dsos__fprintf(stdout); |
1644 | 1817 | ||
1645 | collapse__resort(); | 1818 | collapse__resort(); |
1646 | output__resort(); | 1819 | output__resort(total); |
1647 | output__fprintf(stdout, total); | 1820 | output__fprintf(stdout, total); |
1648 | 1821 | ||
1649 | return rc; | 1822 | return rc; |
1650 | } | 1823 | } |
1651 | 1824 | ||
1825 | static int | ||
1826 | parse_callchain_opt(const struct option *opt __used, const char *arg, | ||
1827 | int unset __used) | ||
1828 | { | ||
1829 | char *tok; | ||
1830 | char *endptr; | ||
1831 | |||
1832 | callchain = 1; | ||
1833 | |||
1834 | if (!arg) | ||
1835 | return 0; | ||
1836 | |||
1837 | tok = strtok((char *)arg, ","); | ||
1838 | if (!tok) | ||
1839 | return -1; | ||
1840 | |||
1841 | /* get the output mode */ | ||
1842 | if (!strncmp(tok, "graph", strlen(arg))) | ||
1843 | callchain_param.mode = CHAIN_GRAPH_ABS; | ||
1844 | |||
1845 | else if (!strncmp(tok, "flat", strlen(arg))) | ||
1846 | callchain_param.mode = CHAIN_FLAT; | ||
1847 | |||
1848 | else if (!strncmp(tok, "fractal", strlen(arg))) | ||
1849 | callchain_param.mode = CHAIN_GRAPH_REL; | ||
1850 | |||
1851 | else | ||
1852 | return -1; | ||
1853 | |||
1854 | /* get the min percentage */ | ||
1855 | tok = strtok(NULL, ","); | ||
1856 | if (!tok) | ||
1857 | goto setup; | ||
1858 | |||
1859 | callchain_param.min_percent = strtod(tok, &endptr); | ||
1860 | if (tok == endptr) | ||
1861 | return -1; | ||
1862 | |||
1863 | setup: | ||
1864 | if (register_callchain_param(&callchain_param) < 0) { | ||
1865 | fprintf(stderr, "Can't register callchain params\n"); | ||
1866 | return -1; | ||
1867 | } | ||
1868 | return 0; | ||
1869 | } | ||
1870 | |||
1652 | static const char * const report_usage[] = { | 1871 | static const char * const report_usage[] = { |
1653 | "perf report [<options>] <command>", | 1872 | "perf report [<options>] <command>", |
1654 | NULL | 1873 | NULL |
@@ -1662,6 +1881,8 @@ static const struct option options[] = { | |||
1662 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, | 1881 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, |
1663 | "dump raw trace in ASCII"), | 1882 | "dump raw trace in ASCII"), |
1664 | OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"), | 1883 | OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"), |
1884 | OPT_BOOLEAN('m', "modules", &modules, | ||
1885 | "load module symbols - WARNING: use only with -k and LIVE kernel"), | ||
1665 | OPT_STRING('s', "sort", &sort_order, "key[,key2...]", | 1886 | OPT_STRING('s', "sort", &sort_order, "key[,key2...]", |
1666 | "sort by key(s): pid, comm, dso, symbol, parent"), | 1887 | "sort by key(s): pid, comm, dso, symbol, parent"), |
1667 | OPT_BOOLEAN('P', "full-paths", &full_paths, | 1888 | OPT_BOOLEAN('P', "full-paths", &full_paths, |
@@ -1670,7 +1891,9 @@ static const struct option options[] = { | |||
1670 | "regex filter to identify parent, see: '--sort parent'"), | 1891 | "regex filter to identify parent, see: '--sort parent'"), |
1671 | OPT_BOOLEAN('x', "exclude-other", &exclude_other, | 1892 | OPT_BOOLEAN('x', "exclude-other", &exclude_other, |
1672 | "Only display entries with parent-match"), | 1893 | "Only display entries with parent-match"), |
1673 | OPT_BOOLEAN('c', "callchain", &callchain, "Display callchains"), | 1894 | OPT_CALLBACK_DEFAULT('c', "callchain", NULL, "output_type,min_percent", |
1895 | "Display callchains using output_type and min percent threshold. " | ||
1896 | "Default: flat,0", &parse_callchain_opt, callchain_default_opt), | ||
1674 | OPT_STRING('d', "dsos", &dso_list_str, "dso[,dso...]", | 1897 | OPT_STRING('d', "dsos", &dso_list_str, "dso[,dso...]", |
1675 | "only consider symbols in these dsos"), | 1898 | "only consider symbols in these dsos"), |
1676 | OPT_STRING('C', "comms", &comm_list_str, "comm[,comm...]", | 1899 | OPT_STRING('C', "comms", &comm_list_str, "comm[,comm...]", |
@@ -1708,7 +1931,7 @@ static void setup_list(struct strlist **list, const char *list_str, | |||
1708 | } | 1931 | } |
1709 | } | 1932 | } |
1710 | 1933 | ||
1711 | int cmd_report(int argc, const char **argv, const char *prefix) | 1934 | int cmd_report(int argc, const char **argv, const char *prefix __used) |
1712 | { | 1935 | { |
1713 | symbol__init(); | 1936 | symbol__init(); |
1714 | 1937 | ||
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index 2e03524a1de0..27921a8ce1a9 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c | |||
@@ -64,7 +64,7 @@ static struct perf_counter_attr default_attrs[] = { | |||
64 | 64 | ||
65 | static int system_wide = 0; | 65 | static int system_wide = 0; |
66 | static int verbose = 0; | 66 | static int verbose = 0; |
67 | static int nr_cpus = 0; | 67 | static unsigned int nr_cpus = 0; |
68 | static int run_idx = 0; | 68 | static int run_idx = 0; |
69 | 69 | ||
70 | static int run_count = 1; | 70 | static int run_count = 1; |
@@ -96,6 +96,10 @@ static u64 walltime_nsecs_noise; | |||
96 | static u64 runtime_cycles_avg; | 96 | static u64 runtime_cycles_avg; |
97 | static u64 runtime_cycles_noise; | 97 | static u64 runtime_cycles_noise; |
98 | 98 | ||
99 | #define MATCH_EVENT(t, c, counter) \ | ||
100 | (attrs[counter].type == PERF_TYPE_##t && \ | ||
101 | attrs[counter].config == PERF_COUNT_##c) | ||
102 | |||
99 | #define ERR_PERF_OPEN \ | 103 | #define ERR_PERF_OPEN \ |
100 | "Error: counter %d, sys_perf_counter_open() syscall returned with %d (%s)\n" | 104 | "Error: counter %d, sys_perf_counter_open() syscall returned with %d (%s)\n" |
101 | 105 | ||
@@ -108,7 +112,8 @@ static void create_perf_stat_counter(int counter, int pid) | |||
108 | PERF_FORMAT_TOTAL_TIME_RUNNING; | 112 | PERF_FORMAT_TOTAL_TIME_RUNNING; |
109 | 113 | ||
110 | if (system_wide) { | 114 | if (system_wide) { |
111 | int cpu; | 115 | unsigned int cpu; |
116 | |||
112 | for (cpu = 0; cpu < nr_cpus; cpu++) { | 117 | for (cpu = 0; cpu < nr_cpus; cpu++) { |
113 | fd[cpu][counter] = sys_perf_counter_open(attr, -1, cpu, -1, 0); | 118 | fd[cpu][counter] = sys_perf_counter_open(attr, -1, cpu, -1, 0); |
114 | if (fd[cpu][counter] < 0 && verbose) | 119 | if (fd[cpu][counter] < 0 && verbose) |
@@ -132,13 +137,8 @@ static void create_perf_stat_counter(int counter, int pid) | |||
132 | */ | 137 | */ |
133 | static inline int nsec_counter(int counter) | 138 | static inline int nsec_counter(int counter) |
134 | { | 139 | { |
135 | if (attrs[counter].type != PERF_TYPE_SOFTWARE) | 140 | if (MATCH_EVENT(SOFTWARE, SW_CPU_CLOCK, counter) || |
136 | return 0; | 141 | MATCH_EVENT(SOFTWARE, SW_TASK_CLOCK, counter)) |
137 | |||
138 | if (attrs[counter].config == PERF_COUNT_SW_CPU_CLOCK) | ||
139 | return 1; | ||
140 | |||
141 | if (attrs[counter].config == PERF_COUNT_SW_TASK_CLOCK) | ||
142 | return 1; | 142 | return 1; |
143 | 143 | ||
144 | return 0; | 144 | return 0; |
@@ -150,8 +150,8 @@ static inline int nsec_counter(int counter) | |||
150 | static void read_counter(int counter) | 150 | static void read_counter(int counter) |
151 | { | 151 | { |
152 | u64 *count, single_count[3]; | 152 | u64 *count, single_count[3]; |
153 | ssize_t res; | 153 | unsigned int cpu; |
154 | int cpu, nv; | 154 | size_t res, nv; |
155 | int scaled; | 155 | int scaled; |
156 | 156 | ||
157 | count = event_res[run_idx][counter]; | 157 | count = event_res[run_idx][counter]; |
@@ -165,6 +165,7 @@ static void read_counter(int counter) | |||
165 | 165 | ||
166 | res = read(fd[cpu][counter], single_count, nv * sizeof(u64)); | 166 | res = read(fd[cpu][counter], single_count, nv * sizeof(u64)); |
167 | assert(res == nv * sizeof(u64)); | 167 | assert(res == nv * sizeof(u64)); |
168 | |||
168 | close(fd[cpu][counter]); | 169 | close(fd[cpu][counter]); |
169 | fd[cpu][counter] = -1; | 170 | fd[cpu][counter] = -1; |
170 | 171 | ||
@@ -192,15 +193,13 @@ static void read_counter(int counter) | |||
192 | /* | 193 | /* |
193 | * Save the full runtime - to allow normalization during printout: | 194 | * Save the full runtime - to allow normalization during printout: |
194 | */ | 195 | */ |
195 | if (attrs[counter].type == PERF_TYPE_SOFTWARE && | 196 | if (MATCH_EVENT(SOFTWARE, SW_TASK_CLOCK, counter)) |
196 | attrs[counter].config == PERF_COUNT_SW_TASK_CLOCK) | ||
197 | runtime_nsecs[run_idx] = count[0]; | 197 | runtime_nsecs[run_idx] = count[0]; |
198 | if (attrs[counter].type == PERF_TYPE_HARDWARE && | 198 | if (MATCH_EVENT(HARDWARE, HW_CPU_CYCLES, counter)) |
199 | attrs[counter].config == PERF_COUNT_HW_CPU_CYCLES) | ||
200 | runtime_cycles[run_idx] = count[0]; | 199 | runtime_cycles[run_idx] = count[0]; |
201 | } | 200 | } |
202 | 201 | ||
203 | static int run_perf_stat(int argc, const char **argv) | 202 | static int run_perf_stat(int argc __used, const char **argv) |
204 | { | 203 | { |
205 | unsigned long long t0, t1; | 204 | unsigned long long t0, t1; |
206 | int status = 0; | 205 | int status = 0; |
@@ -240,7 +239,8 @@ static int run_perf_stat(int argc, const char **argv) | |||
240 | /* | 239 | /* |
241 | * Wait until the parent tells us to go. | 240 | * Wait until the parent tells us to go. |
242 | */ | 241 | */ |
243 | read(go_pipe[0], &buf, 1); | 242 | if (read(go_pipe[0], &buf, 1) == -1) |
243 | perror("unable to read pipe"); | ||
244 | 244 | ||
245 | execvp(argv[0], (char **)argv); | 245 | execvp(argv[0], (char **)argv); |
246 | 246 | ||
@@ -253,7 +253,8 @@ static int run_perf_stat(int argc, const char **argv) | |||
253 | */ | 253 | */ |
254 | close(child_ready_pipe[1]); | 254 | close(child_ready_pipe[1]); |
255 | close(go_pipe[0]); | 255 | close(go_pipe[0]); |
256 | read(child_ready_pipe[0], &buf, 1); | 256 | if (read(child_ready_pipe[0], &buf, 1) == -1) |
257 | perror("unable to read pipe"); | ||
257 | close(child_ready_pipe[0]); | 258 | close(child_ready_pipe[0]); |
258 | 259 | ||
259 | for (counter = 0; counter < nr_counters; counter++) | 260 | for (counter = 0; counter < nr_counters; counter++) |
@@ -290,9 +291,7 @@ static void nsec_printout(int counter, u64 *count, u64 *noise) | |||
290 | 291 | ||
291 | fprintf(stderr, " %14.6f %-24s", msecs, event_name(counter)); | 292 | fprintf(stderr, " %14.6f %-24s", msecs, event_name(counter)); |
292 | 293 | ||
293 | if (attrs[counter].type == PERF_TYPE_SOFTWARE && | 294 | if (MATCH_EVENT(SOFTWARE, SW_TASK_CLOCK, counter)) { |
294 | attrs[counter].config == PERF_COUNT_SW_TASK_CLOCK) { | ||
295 | |||
296 | if (walltime_nsecs_avg) | 295 | if (walltime_nsecs_avg) |
297 | fprintf(stderr, " # %10.3f CPUs ", | 296 | fprintf(stderr, " # %10.3f CPUs ", |
298 | (double)count[0] / (double)walltime_nsecs_avg); | 297 | (double)count[0] / (double)walltime_nsecs_avg); |
@@ -305,9 +304,7 @@ static void abs_printout(int counter, u64 *count, u64 *noise) | |||
305 | fprintf(stderr, " %14Ld %-24s", count[0], event_name(counter)); | 304 | fprintf(stderr, " %14Ld %-24s", count[0], event_name(counter)); |
306 | 305 | ||
307 | if (runtime_cycles_avg && | 306 | if (runtime_cycles_avg && |
308 | attrs[counter].type == PERF_TYPE_HARDWARE && | 307 | MATCH_EVENT(HARDWARE, HW_INSTRUCTIONS, counter)) { |
309 | attrs[counter].config == PERF_COUNT_HW_INSTRUCTIONS) { | ||
310 | |||
311 | fprintf(stderr, " # %10.3f IPC ", | 308 | fprintf(stderr, " # %10.3f IPC ", |
312 | (double)count[0] / (double)runtime_cycles_avg); | 309 | (double)count[0] / (double)runtime_cycles_avg); |
313 | } else { | 310 | } else { |
@@ -390,7 +387,7 @@ static void calc_avg(void) | |||
390 | event_res_avg[j]+1, event_res[i][j]+1); | 387 | event_res_avg[j]+1, event_res[i][j]+1); |
391 | update_avg("counter/2", j, | 388 | update_avg("counter/2", j, |
392 | event_res_avg[j]+2, event_res[i][j]+2); | 389 | event_res_avg[j]+2, event_res[i][j]+2); |
393 | if (event_scaled[i][j] != -1) | 390 | if (event_scaled[i][j] != (u64)-1) |
394 | update_avg("scaled", j, | 391 | update_avg("scaled", j, |
395 | event_scaled_avg + j, event_scaled[i]+j); | 392 | event_scaled_avg + j, event_scaled[i]+j); |
396 | else | 393 | else |
@@ -510,7 +507,7 @@ static const struct option options[] = { | |||
510 | OPT_END() | 507 | OPT_END() |
511 | }; | 508 | }; |
512 | 509 | ||
513 | int cmd_stat(int argc, const char **argv, const char *prefix) | 510 | int cmd_stat(int argc, const char **argv, const char *prefix __used) |
514 | { | 511 | { |
515 | int status; | 512 | int status; |
516 | 513 | ||
@@ -528,7 +525,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix) | |||
528 | 525 | ||
529 | nr_cpus = sysconf(_SC_NPROCESSORS_ONLN); | 526 | nr_cpus = sysconf(_SC_NPROCESSORS_ONLN); |
530 | assert(nr_cpus <= MAX_NR_CPUS); | 527 | assert(nr_cpus <= MAX_NR_CPUS); |
531 | assert(nr_cpus >= 0); | 528 | assert((int)nr_cpus >= 0); |
532 | 529 | ||
533 | /* | 530 | /* |
534 | * We dont want to block the signals - that would cause | 531 | * We dont want to block the signals - that would cause |
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index cf0d21f1ae10..95d5c0ae375a 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include "util/symbol.h" | 23 | #include "util/symbol.h" |
24 | #include "util/color.h" | 24 | #include "util/color.h" |
25 | #include "util/util.h" | 25 | #include "util/util.h" |
26 | #include "util/rbtree.h" | 26 | #include <linux/rbtree.h> |
27 | #include "util/parse-options.h" | 27 | #include "util/parse-options.h" |
28 | #include "util/parse-events.h" | 28 | #include "util/parse-events.h" |
29 | 29 | ||
@@ -66,6 +66,7 @@ static unsigned int page_size; | |||
66 | static unsigned int mmap_pages = 16; | 66 | static unsigned int mmap_pages = 16; |
67 | static int freq = 0; | 67 | static int freq = 0; |
68 | static int verbose = 0; | 68 | static int verbose = 0; |
69 | static char *vmlinux = NULL; | ||
69 | 70 | ||
70 | static char *sym_filter; | 71 | static char *sym_filter; |
71 | static unsigned long filter_start; | 72 | static unsigned long filter_start; |
@@ -238,7 +239,6 @@ static void print_sym_table(void) | |||
238 | for (nd = rb_first(&tmp); nd; nd = rb_next(nd)) { | 239 | for (nd = rb_first(&tmp); nd; nd = rb_next(nd)) { |
239 | struct sym_entry *syme = rb_entry(nd, struct sym_entry, rb_node); | 240 | struct sym_entry *syme = rb_entry(nd, struct sym_entry, rb_node); |
240 | struct symbol *sym = (struct symbol *)(syme + 1); | 241 | struct symbol *sym = (struct symbol *)(syme + 1); |
241 | char *color = PERF_COLOR_NORMAL; | ||
242 | double pcnt; | 242 | double pcnt; |
243 | 243 | ||
244 | if (++printed > print_entries || syme->snap_count < count_filter) | 244 | if (++printed > print_entries || syme->snap_count < count_filter) |
@@ -247,29 +247,20 @@ static void print_sym_table(void) | |||
247 | pcnt = 100.0 - (100.0 * ((sum_ksamples - syme->snap_count) / | 247 | pcnt = 100.0 - (100.0 * ((sum_ksamples - syme->snap_count) / |
248 | sum_ksamples)); | 248 | sum_ksamples)); |
249 | 249 | ||
250 | /* | ||
251 | * We color high-overhead entries in red, mid-overhead | ||
252 | * entries in green - and keep the low overhead places | ||
253 | * normal: | ||
254 | */ | ||
255 | if (pcnt >= 5.0) { | ||
256 | color = PERF_COLOR_RED; | ||
257 | } else { | ||
258 | if (pcnt >= 0.5) | ||
259 | color = PERF_COLOR_GREEN; | ||
260 | } | ||
261 | |||
262 | if (nr_counters == 1) | 250 | if (nr_counters == 1) |
263 | printf("%20.2f - ", syme->weight); | 251 | printf("%20.2f - ", syme->weight); |
264 | else | 252 | else |
265 | printf("%9.1f %10ld - ", syme->weight, syme->snap_count); | 253 | printf("%9.1f %10ld - ", syme->weight, syme->snap_count); |
266 | 254 | ||
267 | color_fprintf(stdout, color, "%4.1f%%", pcnt); | 255 | percent_color_fprintf(stdout, "%4.1f%%", pcnt); |
268 | printf(" - %016llx : %s\n", sym->start, sym->name); | 256 | printf(" - %016llx : %s", sym->start, sym->name); |
257 | if (sym->module) | ||
258 | printf("\t[%s]", sym->module->name); | ||
259 | printf("\n"); | ||
269 | } | 260 | } |
270 | } | 261 | } |
271 | 262 | ||
272 | static void *display_thread(void *arg) | 263 | static void *display_thread(void *arg __used) |
273 | { | 264 | { |
274 | struct pollfd stdin_poll = { .fd = 0, .events = POLLIN }; | 265 | struct pollfd stdin_poll = { .fd = 0, .events = POLLIN }; |
275 | int delay_msecs = delay_secs * 1000; | 266 | int delay_msecs = delay_secs * 1000; |
@@ -286,11 +277,31 @@ static void *display_thread(void *arg) | |||
286 | return NULL; | 277 | return NULL; |
287 | } | 278 | } |
288 | 279 | ||
280 | /* Tag samples to be skipped. */ | ||
281 | static const char *skip_symbols[] = { | ||
282 | "default_idle", | ||
283 | "cpu_idle", | ||
284 | "enter_idle", | ||
285 | "exit_idle", | ||
286 | "mwait_idle", | ||
287 | "ppc64_runlatch_off", | ||
288 | "pseries_dedicated_idle_sleep", | ||
289 | NULL | ||
290 | }; | ||
291 | |||
289 | static int symbol_filter(struct dso *self, struct symbol *sym) | 292 | static int symbol_filter(struct dso *self, struct symbol *sym) |
290 | { | 293 | { |
291 | static int filter_match; | 294 | static int filter_match; |
292 | struct sym_entry *syme; | 295 | struct sym_entry *syme; |
293 | const char *name = sym->name; | 296 | const char *name = sym->name; |
297 | int i; | ||
298 | |||
299 | /* | ||
300 | * ppc64 uses function descriptors and appends a '.' to the | ||
301 | * start of every instruction address. Remove it. | ||
302 | */ | ||
303 | if (name[0] == '.') | ||
304 | name++; | ||
294 | 305 | ||
295 | if (!strcmp(name, "_text") || | 306 | if (!strcmp(name, "_text") || |
296 | !strcmp(name, "_etext") || | 307 | !strcmp(name, "_etext") || |
@@ -302,13 +313,12 @@ static int symbol_filter(struct dso *self, struct symbol *sym) | |||
302 | return 1; | 313 | return 1; |
303 | 314 | ||
304 | syme = dso__sym_priv(self, sym); | 315 | syme = dso__sym_priv(self, sym); |
305 | /* Tag samples to be skipped. */ | 316 | for (i = 0; skip_symbols[i]; i++) { |
306 | if (!strcmp("default_idle", name) || | 317 | if (!strcmp(skip_symbols[i], name)) { |
307 | !strcmp("cpu_idle", name) || | 318 | syme->skip = 1; |
308 | !strcmp("enter_idle", name) || | 319 | break; |
309 | !strcmp("exit_idle", name) || | 320 | } |
310 | !strcmp("mwait_idle", name)) | 321 | } |
311 | syme->skip = 1; | ||
312 | 322 | ||
313 | if (filter_match == 1) { | 323 | if (filter_match == 1) { |
314 | filter_end = sym->start; | 324 | filter_end = sym->start; |
@@ -340,12 +350,13 @@ static int parse_symbols(void) | |||
340 | { | 350 | { |
341 | struct rb_node *node; | 351 | struct rb_node *node; |
342 | struct symbol *sym; | 352 | struct symbol *sym; |
353 | int modules = vmlinux ? 1 : 0; | ||
343 | 354 | ||
344 | kernel_dso = dso__new("[kernel]", sizeof(struct sym_entry)); | 355 | kernel_dso = dso__new("[kernel]", sizeof(struct sym_entry)); |
345 | if (kernel_dso == NULL) | 356 | if (kernel_dso == NULL) |
346 | return -1; | 357 | return -1; |
347 | 358 | ||
348 | if (dso__load_kernel(kernel_dso, NULL, symbol_filter, 1) != 0) | 359 | if (dso__load_kernel(kernel_dso, vmlinux, symbol_filter, verbose, modules) <= 0) |
349 | goto out_delete_dso; | 360 | goto out_delete_dso; |
350 | 361 | ||
351 | node = rb_first(&kernel_dso->syms); | 362 | node = rb_first(&kernel_dso->syms); |
@@ -407,7 +418,7 @@ static void process_event(u64 ip, int counter, int user) | |||
407 | struct mmap_data { | 418 | struct mmap_data { |
408 | int counter; | 419 | int counter; |
409 | void *base; | 420 | void *base; |
410 | unsigned int mask; | 421 | int mask; |
411 | unsigned int prev; | 422 | unsigned int prev; |
412 | }; | 423 | }; |
413 | 424 | ||
@@ -661,6 +672,7 @@ static const struct option options[] = { | |||
661 | "system-wide collection from all CPUs"), | 672 | "system-wide collection from all CPUs"), |
662 | OPT_INTEGER('C', "CPU", &profile_cpu, | 673 | OPT_INTEGER('C', "CPU", &profile_cpu, |
663 | "CPU to profile on"), | 674 | "CPU to profile on"), |
675 | OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"), | ||
664 | OPT_INTEGER('m', "mmap-pages", &mmap_pages, | 676 | OPT_INTEGER('m', "mmap-pages", &mmap_pages, |
665 | "number of mmap data pages"), | 677 | "number of mmap data pages"), |
666 | OPT_INTEGER('r', "realtime", &realtime_prio, | 678 | OPT_INTEGER('r', "realtime", &realtime_prio, |
@@ -675,7 +687,7 @@ static const struct option options[] = { | |||
675 | "put the counters into a counter group"), | 687 | "put the counters into a counter group"), |
676 | OPT_STRING('s', "sym-filter", &sym_filter, "pattern", | 688 | OPT_STRING('s', "sym-filter", &sym_filter, "pattern", |
677 | "only display symbols matchig this pattern"), | 689 | "only display symbols matchig this pattern"), |
678 | OPT_BOOLEAN('z', "zero", &group, | 690 | OPT_BOOLEAN('z', "zero", &zero, |
679 | "zero history across updates"), | 691 | "zero history across updates"), |
680 | OPT_INTEGER('F', "freq", &freq, | 692 | OPT_INTEGER('F', "freq", &freq, |
681 | "profile at this frequency"), | 693 | "profile at this frequency"), |
@@ -686,10 +698,12 @@ static const struct option options[] = { | |||
686 | OPT_END() | 698 | OPT_END() |
687 | }; | 699 | }; |
688 | 700 | ||
689 | int cmd_top(int argc, const char **argv, const char *prefix) | 701 | int cmd_top(int argc, const char **argv, const char *prefix __used) |
690 | { | 702 | { |
691 | int counter; | 703 | int counter; |
692 | 704 | ||
705 | symbol__init(); | ||
706 | |||
693 | page_size = sysconf(_SC_PAGE_SIZE); | 707 | page_size = sysconf(_SC_PAGE_SIZE); |
694 | 708 | ||
695 | argc = parse_options(argc, argv, options, top_usage, 0); | 709 | argc = parse_options(argc, argv, options, top_usage, 0); |
diff --git a/tools/perf/perf.c b/tools/perf/perf.c index 4eb725933703..c5656784c61d 100644 --- a/tools/perf/perf.c +++ b/tools/perf/perf.c | |||
@@ -229,9 +229,6 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv) | |||
229 | use_pager = 1; | 229 | use_pager = 1; |
230 | commit_pager_choice(); | 230 | commit_pager_choice(); |
231 | 231 | ||
232 | if (p->option & NEED_WORK_TREE) | ||
233 | /* setup_work_tree() */; | ||
234 | |||
235 | status = p->fn(argc, argv, prefix); | 232 | status = p->fn(argc, argv, prefix); |
236 | if (status) | 233 | if (status) |
237 | return status & 0xff; | 234 | return status & 0xff; |
@@ -266,7 +263,7 @@ static void handle_internal_command(int argc, const char **argv) | |||
266 | { "annotate", cmd_annotate, 0 }, | 263 | { "annotate", cmd_annotate, 0 }, |
267 | { "version", cmd_version, 0 }, | 264 | { "version", cmd_version, 0 }, |
268 | }; | 265 | }; |
269 | int i; | 266 | unsigned int i; |
270 | static const char ext[] = STRIP_EXTENSION; | 267 | static const char ext[] = STRIP_EXTENSION; |
271 | 268 | ||
272 | if (sizeof(ext) > 1) { | 269 | if (sizeof(ext) > 1) { |
diff --git a/tools/perf/perf.h b/tools/perf/perf.h index d3042a6ba03d..63e67cc5487b 100644 --- a/tools/perf/perf.h +++ b/tools/perf/perf.h | |||
@@ -68,6 +68,8 @@ static inline unsigned long long rdclock(void) | |||
68 | #define __user | 68 | #define __user |
69 | #define asmlinkage | 69 | #define asmlinkage |
70 | 70 | ||
71 | #define __used __attribute__((__unused__)) | ||
72 | |||
71 | #define unlikely(x) __builtin_expect(!!(x), 0) | 73 | #define unlikely(x) __builtin_expect(!!(x), 0) |
72 | #define min(x, y) ({ \ | 74 | #define min(x, y) ({ \ |
73 | typeof(x) _min1 = (x); \ | 75 | typeof(x) _min1 = (x); \ |
diff --git a/tools/perf/util/alias.c b/tools/perf/util/alias.c index 9b3dd2b428df..b8144e80bb1e 100644 --- a/tools/perf/util/alias.c +++ b/tools/perf/util/alias.c | |||
@@ -3,7 +3,7 @@ | |||
3 | static const char *alias_key; | 3 | static const char *alias_key; |
4 | static char *alias_val; | 4 | static char *alias_val; |
5 | 5 | ||
6 | static int alias_lookup_cb(const char *k, const char *v, void *cb) | 6 | static int alias_lookup_cb(const char *k, const char *v, void *cb __used) |
7 | { | 7 | { |
8 | if (!prefixcmp(k, "alias.") && !strcmp(k+6, alias_key)) { | 8 | if (!prefixcmp(k, "alias.") && !strcmp(k+6, alias_key)) { |
9 | if (!v) | 9 | if (!v) |
diff --git a/tools/perf/util/cache.h b/tools/perf/util/cache.h index 393d6146d13b..161d5f413e28 100644 --- a/tools/perf/util/cache.h +++ b/tools/perf/util/cache.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include "util.h" | 4 | #include "util.h" |
5 | #include "strbuf.h" | 5 | #include "strbuf.h" |
6 | #include "../perf.h" | ||
6 | 7 | ||
7 | #define PERF_DIR_ENVIRONMENT "PERF_DIR" | 8 | #define PERF_DIR_ENVIRONMENT "PERF_DIR" |
8 | #define PERF_WORK_TREE_ENVIRONMENT "PERF_WORK_TREE" | 9 | #define PERF_WORK_TREE_ENVIRONMENT "PERF_WORK_TREE" |
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c index ad3c28578961..9d3c8141b8c1 100644 --- a/tools/perf/util/callchain.c +++ b/tools/perf/util/callchain.c | |||
@@ -4,6 +4,9 @@ | |||
4 | * Handle the callchains from the stream in an ad-hoc radix tree and then | 4 | * Handle the callchains from the stream in an ad-hoc radix tree and then |
5 | * sort them in an rbtree. | 5 | * sort them in an rbtree. |
6 | * | 6 | * |
7 | * Using a radix for code path provides a fast retrieval and factorizes | ||
8 | * memory use. Also that lets us use the paths in a hierarchical graph view. | ||
9 | * | ||
7 | */ | 10 | */ |
8 | 11 | ||
9 | #include <stdlib.h> | 12 | #include <stdlib.h> |
@@ -13,8 +16,12 @@ | |||
13 | 16 | ||
14 | #include "callchain.h" | 17 | #include "callchain.h" |
15 | 18 | ||
19 | #define chain_for_each_child(child, parent) \ | ||
20 | list_for_each_entry(child, &parent->children, brothers) | ||
16 | 21 | ||
17 | static void rb_insert_callchain(struct rb_root *root, struct callchain_node *chain) | 22 | static void |
23 | rb_insert_callchain(struct rb_root *root, struct callchain_node *chain, | ||
24 | enum chain_mode mode) | ||
18 | { | 25 | { |
19 | struct rb_node **p = &root->rb_node; | 26 | struct rb_node **p = &root->rb_node; |
20 | struct rb_node *parent = NULL; | 27 | struct rb_node *parent = NULL; |
@@ -24,32 +31,125 @@ static void rb_insert_callchain(struct rb_root *root, struct callchain_node *cha | |||
24 | parent = *p; | 31 | parent = *p; |
25 | rnode = rb_entry(parent, struct callchain_node, rb_node); | 32 | rnode = rb_entry(parent, struct callchain_node, rb_node); |
26 | 33 | ||
27 | if (rnode->hit < chain->hit) | 34 | switch (mode) { |
28 | p = &(*p)->rb_left; | 35 | case CHAIN_FLAT: |
29 | else | 36 | if (rnode->hit < chain->hit) |
30 | p = &(*p)->rb_right; | 37 | p = &(*p)->rb_left; |
38 | else | ||
39 | p = &(*p)->rb_right; | ||
40 | break; | ||
41 | case CHAIN_GRAPH_ABS: /* Falldown */ | ||
42 | case CHAIN_GRAPH_REL: | ||
43 | if (rnode->cumul_hit < chain->cumul_hit) | ||
44 | p = &(*p)->rb_left; | ||
45 | else | ||
46 | p = &(*p)->rb_right; | ||
47 | break; | ||
48 | default: | ||
49 | break; | ||
50 | } | ||
31 | } | 51 | } |
32 | 52 | ||
33 | rb_link_node(&chain->rb_node, parent, p); | 53 | rb_link_node(&chain->rb_node, parent, p); |
34 | rb_insert_color(&chain->rb_node, root); | 54 | rb_insert_color(&chain->rb_node, root); |
35 | } | 55 | } |
36 | 56 | ||
57 | static void | ||
58 | __sort_chain_flat(struct rb_root *rb_root, struct callchain_node *node, | ||
59 | u64 min_hit) | ||
60 | { | ||
61 | struct callchain_node *child; | ||
62 | |||
63 | chain_for_each_child(child, node) | ||
64 | __sort_chain_flat(rb_root, child, min_hit); | ||
65 | |||
66 | if (node->hit && node->hit >= min_hit) | ||
67 | rb_insert_callchain(rb_root, node, CHAIN_FLAT); | ||
68 | } | ||
69 | |||
37 | /* | 70 | /* |
38 | * Once we get every callchains from the stream, we can now | 71 | * Once we get every callchains from the stream, we can now |
39 | * sort them by hit | 72 | * sort them by hit |
40 | */ | 73 | */ |
41 | void sort_chain_to_rbtree(struct rb_root *rb_root, struct callchain_node *node) | 74 | static void |
75 | sort_chain_flat(struct rb_root *rb_root, struct callchain_node *node, | ||
76 | u64 min_hit, struct callchain_param *param __used) | ||
77 | { | ||
78 | __sort_chain_flat(rb_root, node, min_hit); | ||
79 | } | ||
80 | |||
81 | static void __sort_chain_graph_abs(struct callchain_node *node, | ||
82 | u64 min_hit) | ||
83 | { | ||
84 | struct callchain_node *child; | ||
85 | |||
86 | node->rb_root = RB_ROOT; | ||
87 | |||
88 | chain_for_each_child(child, node) { | ||
89 | __sort_chain_graph_abs(child, min_hit); | ||
90 | if (child->cumul_hit >= min_hit) | ||
91 | rb_insert_callchain(&node->rb_root, child, | ||
92 | CHAIN_GRAPH_ABS); | ||
93 | } | ||
94 | } | ||
95 | |||
96 | static void | ||
97 | sort_chain_graph_abs(struct rb_root *rb_root, struct callchain_node *chain_root, | ||
98 | u64 min_hit, struct callchain_param *param __used) | ||
99 | { | ||
100 | __sort_chain_graph_abs(chain_root, min_hit); | ||
101 | rb_root->rb_node = chain_root->rb_root.rb_node; | ||
102 | } | ||
103 | |||
104 | static void __sort_chain_graph_rel(struct callchain_node *node, | ||
105 | double min_percent) | ||
42 | { | 106 | { |
43 | struct callchain_node *child; | 107 | struct callchain_node *child; |
108 | u64 min_hit; | ||
44 | 109 | ||
45 | list_for_each_entry(child, &node->children, brothers) | 110 | node->rb_root = RB_ROOT; |
46 | sort_chain_to_rbtree(rb_root, child); | 111 | min_hit = node->cumul_hit * min_percent / 100.0; |
47 | 112 | ||
48 | if (node->hit) | 113 | chain_for_each_child(child, node) { |
49 | rb_insert_callchain(rb_root, node); | 114 | __sort_chain_graph_rel(child, min_percent); |
115 | if (child->cumul_hit >= min_hit) | ||
116 | rb_insert_callchain(&node->rb_root, child, | ||
117 | CHAIN_GRAPH_REL); | ||
118 | } | ||
50 | } | 119 | } |
51 | 120 | ||
52 | static struct callchain_node *create_child(struct callchain_node *parent) | 121 | static void |
122 | sort_chain_graph_rel(struct rb_root *rb_root, struct callchain_node *chain_root, | ||
123 | u64 min_hit __used, struct callchain_param *param) | ||
124 | { | ||
125 | __sort_chain_graph_rel(chain_root, param->min_percent); | ||
126 | rb_root->rb_node = chain_root->rb_root.rb_node; | ||
127 | } | ||
128 | |||
129 | int register_callchain_param(struct callchain_param *param) | ||
130 | { | ||
131 | switch (param->mode) { | ||
132 | case CHAIN_GRAPH_ABS: | ||
133 | param->sort = sort_chain_graph_abs; | ||
134 | break; | ||
135 | case CHAIN_GRAPH_REL: | ||
136 | param->sort = sort_chain_graph_rel; | ||
137 | break; | ||
138 | case CHAIN_FLAT: | ||
139 | param->sort = sort_chain_flat; | ||
140 | break; | ||
141 | default: | ||
142 | return -1; | ||
143 | } | ||
144 | return 0; | ||
145 | } | ||
146 | |||
147 | /* | ||
148 | * Create a child for a parent. If inherit_children, then the new child | ||
149 | * will become the new parent of it's parent children | ||
150 | */ | ||
151 | static struct callchain_node * | ||
152 | create_child(struct callchain_node *parent, bool inherit_children) | ||
53 | { | 153 | { |
54 | struct callchain_node *new; | 154 | struct callchain_node *new; |
55 | 155 | ||
@@ -61,91 +161,147 @@ static struct callchain_node *create_child(struct callchain_node *parent) | |||
61 | new->parent = parent; | 161 | new->parent = parent; |
62 | INIT_LIST_HEAD(&new->children); | 162 | INIT_LIST_HEAD(&new->children); |
63 | INIT_LIST_HEAD(&new->val); | 163 | INIT_LIST_HEAD(&new->val); |
164 | |||
165 | if (inherit_children) { | ||
166 | struct callchain_node *next; | ||
167 | |||
168 | list_splice(&parent->children, &new->children); | ||
169 | INIT_LIST_HEAD(&parent->children); | ||
170 | |||
171 | chain_for_each_child(next, new) | ||
172 | next->parent = new; | ||
173 | } | ||
64 | list_add_tail(&new->brothers, &parent->children); | 174 | list_add_tail(&new->brothers, &parent->children); |
65 | 175 | ||
66 | return new; | 176 | return new; |
67 | } | 177 | } |
68 | 178 | ||
179 | /* | ||
180 | * Fill the node with callchain values | ||
181 | */ | ||
69 | static void | 182 | static void |
70 | fill_node(struct callchain_node *node, struct ip_callchain *chain, int start) | 183 | fill_node(struct callchain_node *node, struct ip_callchain *chain, |
184 | int start, struct symbol **syms) | ||
71 | { | 185 | { |
72 | int i; | 186 | unsigned int i; |
73 | 187 | ||
74 | for (i = start; i < chain->nr; i++) { | 188 | for (i = start; i < chain->nr; i++) { |
75 | struct callchain_list *call; | 189 | struct callchain_list *call; |
76 | 190 | ||
77 | call = malloc(sizeof(*chain)); | 191 | call = malloc(sizeof(*call)); |
78 | if (!call) { | 192 | if (!call) { |
79 | perror("not enough memory for the code path tree"); | 193 | perror("not enough memory for the code path tree"); |
80 | return; | 194 | return; |
81 | } | 195 | } |
82 | call->ip = chain->ips[i]; | 196 | call->ip = chain->ips[i]; |
197 | call->sym = syms[i]; | ||
83 | list_add_tail(&call->list, &node->val); | 198 | list_add_tail(&call->list, &node->val); |
84 | } | 199 | } |
85 | node->val_nr = i - start; | 200 | node->val_nr = chain->nr - start; |
201 | if (!node->val_nr) | ||
202 | printf("Warning: empty node in callchain tree\n"); | ||
86 | } | 203 | } |
87 | 204 | ||
88 | static void add_child(struct callchain_node *parent, struct ip_callchain *chain) | 205 | static void |
206 | add_child(struct callchain_node *parent, struct ip_callchain *chain, | ||
207 | int start, struct symbol **syms) | ||
89 | { | 208 | { |
90 | struct callchain_node *new; | 209 | struct callchain_node *new; |
91 | 210 | ||
92 | new = create_child(parent); | 211 | new = create_child(parent, false); |
93 | fill_node(new, chain, parent->val_nr); | 212 | fill_node(new, chain, start, syms); |
94 | 213 | ||
95 | new->hit = 1; | 214 | new->cumul_hit = new->hit = 1; |
96 | } | 215 | } |
97 | 216 | ||
217 | /* | ||
218 | * Split the parent in two parts (a new child is created) and | ||
219 | * give a part of its callchain to the created child. | ||
220 | * Then create another child to host the given callchain of new branch | ||
221 | */ | ||
98 | static void | 222 | static void |
99 | split_add_child(struct callchain_node *parent, struct ip_callchain *chain, | 223 | split_add_child(struct callchain_node *parent, struct ip_callchain *chain, |
100 | struct callchain_list *to_split, int idx) | 224 | struct callchain_list *to_split, int idx_parents, int idx_local, |
225 | struct symbol **syms) | ||
101 | { | 226 | { |
102 | struct callchain_node *new; | 227 | struct callchain_node *new; |
228 | struct list_head *old_tail; | ||
229 | unsigned int idx_total = idx_parents + idx_local; | ||
103 | 230 | ||
104 | /* split */ | 231 | /* split */ |
105 | new = create_child(parent); | 232 | new = create_child(parent, true); |
106 | list_move_tail(&to_split->list, &new->val); | ||
107 | new->hit = parent->hit; | ||
108 | parent->hit = 0; | ||
109 | parent->val_nr = idx; | ||
110 | 233 | ||
111 | /* create the new one */ | 234 | /* split the callchain and move a part to the new child */ |
112 | add_child(parent, chain); | 235 | old_tail = parent->val.prev; |
236 | list_del_range(&to_split->list, old_tail); | ||
237 | new->val.next = &to_split->list; | ||
238 | new->val.prev = old_tail; | ||
239 | to_split->list.prev = &new->val; | ||
240 | old_tail->next = &new->val; | ||
241 | |||
242 | /* split the hits */ | ||
243 | new->hit = parent->hit; | ||
244 | new->cumul_hit = parent->cumul_hit; | ||
245 | new->val_nr = parent->val_nr - idx_local; | ||
246 | parent->val_nr = idx_local; | ||
247 | |||
248 | /* create a new child for the new branch if any */ | ||
249 | if (idx_total < chain->nr) { | ||
250 | parent->hit = 0; | ||
251 | add_child(parent, chain, idx_total, syms); | ||
252 | } else { | ||
253 | parent->hit = 1; | ||
254 | } | ||
113 | } | 255 | } |
114 | 256 | ||
115 | static int | 257 | static int |
116 | __append_chain(struct callchain_node *root, struct ip_callchain *chain, | 258 | __append_chain(struct callchain_node *root, struct ip_callchain *chain, |
117 | int start); | 259 | unsigned int start, struct symbol **syms); |
118 | 260 | ||
119 | static int | 261 | static void |
120 | __append_chain_children(struct callchain_node *root, struct ip_callchain *chain) | 262 | __append_chain_children(struct callchain_node *root, struct ip_callchain *chain, |
263 | struct symbol **syms, unsigned int start) | ||
121 | { | 264 | { |
122 | struct callchain_node *rnode; | 265 | struct callchain_node *rnode; |
123 | 266 | ||
124 | /* lookup in childrens */ | 267 | /* lookup in childrens */ |
125 | list_for_each_entry(rnode, &root->children, brothers) { | 268 | chain_for_each_child(rnode, root) { |
126 | int ret = __append_chain(rnode, chain, root->val_nr); | 269 | unsigned int ret = __append_chain(rnode, chain, start, syms); |
270 | |||
127 | if (!ret) | 271 | if (!ret) |
128 | return 0; | 272 | goto cumul; |
129 | } | 273 | } |
130 | return -1; | 274 | /* nothing in children, add to the current node */ |
275 | add_child(root, chain, start, syms); | ||
276 | |||
277 | cumul: | ||
278 | root->cumul_hit++; | ||
131 | } | 279 | } |
132 | 280 | ||
133 | static int | 281 | static int |
134 | __append_chain(struct callchain_node *root, struct ip_callchain *chain, | 282 | __append_chain(struct callchain_node *root, struct ip_callchain *chain, |
135 | int start) | 283 | unsigned int start, struct symbol **syms) |
136 | { | 284 | { |
137 | struct callchain_list *cnode; | 285 | struct callchain_list *cnode; |
138 | int i = start; | 286 | unsigned int i = start; |
139 | bool found = false; | 287 | bool found = false; |
140 | 288 | ||
141 | /* lookup in the current node */ | 289 | /* |
290 | * Lookup in the current node | ||
291 | * If we have a symbol, then compare the start to match | ||
292 | * anywhere inside a function. | ||
293 | */ | ||
142 | list_for_each_entry(cnode, &root->val, list) { | 294 | list_for_each_entry(cnode, &root->val, list) { |
143 | if (cnode->ip != chain->ips[i++]) | 295 | if (i == chain->nr) |
296 | break; | ||
297 | if (cnode->sym && syms[i]) { | ||
298 | if (cnode->sym->start != syms[i]->start) | ||
299 | break; | ||
300 | } else if (cnode->ip != chain->ips[i]) | ||
144 | break; | 301 | break; |
145 | if (!found) | 302 | if (!found) |
146 | found = true; | 303 | found = true; |
147 | if (i == chain->nr) | 304 | i++; |
148 | break; | ||
149 | } | 305 | } |
150 | 306 | ||
151 | /* matches not, relay on the parent */ | 307 | /* matches not, relay on the parent */ |
@@ -153,22 +309,27 @@ __append_chain(struct callchain_node *root, struct ip_callchain *chain, | |||
153 | return -1; | 309 | return -1; |
154 | 310 | ||
155 | /* we match only a part of the node. Split it and add the new chain */ | 311 | /* we match only a part of the node. Split it and add the new chain */ |
156 | if (i < root->val_nr) { | 312 | if (i - start < root->val_nr) { |
157 | split_add_child(root, chain, cnode, i); | 313 | split_add_child(root, chain, cnode, start, i - start, syms); |
158 | return 0; | 314 | return 0; |
159 | } | 315 | } |
160 | 316 | ||
161 | /* we match 100% of the path, increment the hit */ | 317 | /* we match 100% of the path, increment the hit */ |
162 | if (i == root->val_nr) { | 318 | if (i - start == root->val_nr && i == chain->nr) { |
163 | root->hit++; | 319 | root->hit++; |
320 | root->cumul_hit++; | ||
321 | |||
164 | return 0; | 322 | return 0; |
165 | } | 323 | } |
166 | 324 | ||
167 | return __append_chain_children(root, chain); | 325 | /* We match the node and still have a part remaining */ |
326 | __append_chain_children(root, chain, syms, i); | ||
327 | |||
328 | return 0; | ||
168 | } | 329 | } |
169 | 330 | ||
170 | void append_chain(struct callchain_node *root, struct ip_callchain *chain) | 331 | void append_chain(struct callchain_node *root, struct ip_callchain *chain, |
332 | struct symbol **syms) | ||
171 | { | 333 | { |
172 | if (__append_chain_children(root, chain) == -1) | 334 | __append_chain_children(root, chain, syms, 0); |
173 | add_child(root, chain); | ||
174 | } | 335 | } |
diff --git a/tools/perf/util/callchain.h b/tools/perf/util/callchain.h index fa1cd2f71fd3..7812122bea1d 100644 --- a/tools/perf/util/callchain.h +++ b/tools/perf/util/callchain.h | |||
@@ -2,22 +2,42 @@ | |||
2 | #define __PERF_CALLCHAIN_H | 2 | #define __PERF_CALLCHAIN_H |
3 | 3 | ||
4 | #include "../perf.h" | 4 | #include "../perf.h" |
5 | #include "list.h" | 5 | #include <linux/list.h> |
6 | #include "rbtree.h" | 6 | #include <linux/rbtree.h> |
7 | #include "symbol.h" | ||
7 | 8 | ||
9 | enum chain_mode { | ||
10 | CHAIN_FLAT, | ||
11 | CHAIN_GRAPH_ABS, | ||
12 | CHAIN_GRAPH_REL | ||
13 | }; | ||
8 | 14 | ||
9 | struct callchain_node { | 15 | struct callchain_node { |
10 | struct callchain_node *parent; | 16 | struct callchain_node *parent; |
11 | struct list_head brothers; | 17 | struct list_head brothers; |
12 | struct list_head children; | 18 | struct list_head children; |
13 | struct list_head val; | 19 | struct list_head val; |
14 | struct rb_node rb_node; | 20 | struct rb_node rb_node; /* to sort nodes in an rbtree */ |
15 | int val_nr; | 21 | struct rb_root rb_root; /* sorted tree of children */ |
16 | int hit; | 22 | unsigned int val_nr; |
23 | u64 hit; | ||
24 | u64 cumul_hit; /* hit + hits of children */ | ||
25 | }; | ||
26 | |||
27 | struct callchain_param; | ||
28 | |||
29 | typedef void (*sort_chain_func_t)(struct rb_root *, struct callchain_node *, | ||
30 | u64, struct callchain_param *); | ||
31 | |||
32 | struct callchain_param { | ||
33 | enum chain_mode mode; | ||
34 | double min_percent; | ||
35 | sort_chain_func_t sort; | ||
17 | }; | 36 | }; |
18 | 37 | ||
19 | struct callchain_list { | 38 | struct callchain_list { |
20 | unsigned long ip; | 39 | u64 ip; |
40 | struct symbol *sym; | ||
21 | struct list_head list; | 41 | struct list_head list; |
22 | }; | 42 | }; |
23 | 43 | ||
@@ -28,6 +48,7 @@ static inline void callchain_init(struct callchain_node *node) | |||
28 | INIT_LIST_HEAD(&node->val); | 48 | INIT_LIST_HEAD(&node->val); |
29 | } | 49 | } |
30 | 50 | ||
31 | void append_chain(struct callchain_node *root, struct ip_callchain *chain); | 51 | int register_callchain_param(struct callchain_param *param); |
32 | void sort_chain_to_rbtree(struct rb_root *rb_root, struct callchain_node *node); | 52 | void append_chain(struct callchain_node *root, struct ip_callchain *chain, |
53 | struct symbol **syms); | ||
33 | #endif | 54 | #endif |
diff --git a/tools/perf/util/color.c b/tools/perf/util/color.c index 9a8c20ccc53e..90a044d1fe7d 100644 --- a/tools/perf/util/color.c +++ b/tools/perf/util/color.c | |||
@@ -11,7 +11,8 @@ static int parse_color(const char *name, int len) | |||
11 | }; | 11 | }; |
12 | char *end; | 12 | char *end; |
13 | int i; | 13 | int i; |
14 | for (i = 0; i < ARRAY_SIZE(color_names); i++) { | 14 | |
15 | for (i = 0; i < (int)ARRAY_SIZE(color_names); i++) { | ||
15 | const char *str = color_names[i]; | 16 | const char *str = color_names[i]; |
16 | if (!strncasecmp(name, str, len) && !str[len]) | 17 | if (!strncasecmp(name, str, len) && !str[len]) |
17 | return i - 1; | 18 | return i - 1; |
@@ -28,7 +29,8 @@ static int parse_attr(const char *name, int len) | |||
28 | static const char * const attr_names[] = { | 29 | static const char * const attr_names[] = { |
29 | "bold", "dim", "ul", "blink", "reverse" | 30 | "bold", "dim", "ul", "blink", "reverse" |
30 | }; | 31 | }; |
31 | int i; | 32 | unsigned int i; |
33 | |||
32 | for (i = 0; i < ARRAY_SIZE(attr_names); i++) { | 34 | for (i = 0; i < ARRAY_SIZE(attr_names); i++) { |
33 | const char *str = attr_names[i]; | 35 | const char *str = attr_names[i]; |
34 | if (!strncasecmp(name, str, len) && !str[len]) | 36 | if (!strncasecmp(name, str, len) && !str[len]) |
@@ -222,10 +224,12 @@ int color_fwrite_lines(FILE *fp, const char *color, | |||
222 | { | 224 | { |
223 | if (!*color) | 225 | if (!*color) |
224 | return fwrite(buf, count, 1, fp) != 1; | 226 | return fwrite(buf, count, 1, fp) != 1; |
227 | |||
225 | while (count) { | 228 | while (count) { |
226 | char *p = memchr(buf, '\n', count); | 229 | char *p = memchr(buf, '\n', count); |
230 | |||
227 | if (p != buf && (fputs(color, fp) < 0 || | 231 | if (p != buf && (fputs(color, fp) < 0 || |
228 | fwrite(buf, p ? p - buf : count, 1, fp) != 1 || | 232 | fwrite(buf, p ? (size_t)(p - buf) : count, 1, fp) != 1 || |
229 | fputs(PERF_COLOR_RESET, fp) < 0)) | 233 | fputs(PERF_COLOR_RESET, fp) < 0)) |
230 | return -1; | 234 | return -1; |
231 | if (!p) | 235 | if (!p) |
@@ -238,4 +242,31 @@ int color_fwrite_lines(FILE *fp, const char *color, | |||
238 | return 0; | 242 | return 0; |
239 | } | 243 | } |
240 | 244 | ||
245 | char *get_percent_color(double percent) | ||
246 | { | ||
247 | char *color = PERF_COLOR_NORMAL; | ||
241 | 248 | ||
249 | /* | ||
250 | * We color high-overhead entries in red, mid-overhead | ||
251 | * entries in green - and keep the low overhead places | ||
252 | * normal: | ||
253 | */ | ||
254 | if (percent >= MIN_RED) | ||
255 | color = PERF_COLOR_RED; | ||
256 | else { | ||
257 | if (percent > MIN_GREEN) | ||
258 | color = PERF_COLOR_GREEN; | ||
259 | } | ||
260 | return color; | ||
261 | } | ||
262 | |||
263 | int percent_color_fprintf(FILE *fp, const char *fmt, double percent) | ||
264 | { | ||
265 | int r; | ||
266 | char *color; | ||
267 | |||
268 | color = get_percent_color(percent); | ||
269 | r = color_fprintf(fp, color, fmt, percent); | ||
270 | |||
271 | return r; | ||
272 | } | ||
diff --git a/tools/perf/util/color.h b/tools/perf/util/color.h index 5abfd379582b..706cec50bd25 100644 --- a/tools/perf/util/color.h +++ b/tools/perf/util/color.h | |||
@@ -15,6 +15,9 @@ | |||
15 | #define PERF_COLOR_CYAN "\033[36m" | 15 | #define PERF_COLOR_CYAN "\033[36m" |
16 | #define PERF_COLOR_BG_RED "\033[41m" | 16 | #define PERF_COLOR_BG_RED "\033[41m" |
17 | 17 | ||
18 | #define MIN_GREEN 0.5 | ||
19 | #define MIN_RED 5.0 | ||
20 | |||
18 | /* | 21 | /* |
19 | * This variable stores the value of color.ui | 22 | * This variable stores the value of color.ui |
20 | */ | 23 | */ |
@@ -32,5 +35,7 @@ void color_parse_mem(const char *value, int len, const char *var, char *dst); | |||
32 | int color_fprintf(FILE *fp, const char *color, const char *fmt, ...); | 35 | int color_fprintf(FILE *fp, const char *color, const char *fmt, ...); |
33 | int color_fprintf_ln(FILE *fp, const char *color, const char *fmt, ...); | 36 | int color_fprintf_ln(FILE *fp, const char *color, const char *fmt, ...); |
34 | int color_fwrite_lines(FILE *fp, const char *color, size_t count, const char *buf); | 37 | int color_fwrite_lines(FILE *fp, const char *color, size_t count, const char *buf); |
38 | int percent_color_fprintf(FILE *fp, const char *fmt, double percent); | ||
39 | char *get_percent_color(double percent); | ||
35 | 40 | ||
36 | #endif /* COLOR_H */ | 41 | #endif /* COLOR_H */ |
diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c index 3dd13faa6a27..780df541006d 100644 --- a/tools/perf/util/config.c +++ b/tools/perf/util/config.c | |||
@@ -47,10 +47,12 @@ static int get_next_char(void) | |||
47 | static char *parse_value(void) | 47 | static char *parse_value(void) |
48 | { | 48 | { |
49 | static char value[1024]; | 49 | static char value[1024]; |
50 | int quote = 0, comment = 0, len = 0, space = 0; | 50 | int quote = 0, comment = 0, space = 0; |
51 | size_t len = 0; | ||
51 | 52 | ||
52 | for (;;) { | 53 | for (;;) { |
53 | int c = get_next_char(); | 54 | int c = get_next_char(); |
55 | |||
54 | if (len >= sizeof(value) - 1) | 56 | if (len >= sizeof(value) - 1) |
55 | return NULL; | 57 | return NULL; |
56 | if (c == '\n') { | 58 | if (c == '\n') { |
@@ -353,13 +355,13 @@ int perf_config_string(const char **dest, const char *var, const char *value) | |||
353 | return 0; | 355 | return 0; |
354 | } | 356 | } |
355 | 357 | ||
356 | static int perf_default_core_config(const char *var, const char *value) | 358 | static int perf_default_core_config(const char *var __used, const char *value __used) |
357 | { | 359 | { |
358 | /* Add other config variables here and to Documentation/config.txt. */ | 360 | /* Add other config variables here and to Documentation/config.txt. */ |
359 | return 0; | 361 | return 0; |
360 | } | 362 | } |
361 | 363 | ||
362 | int perf_default_config(const char *var, const char *value, void *dummy) | 364 | int perf_default_config(const char *var, const char *value, void *dummy __used) |
363 | { | 365 | { |
364 | if (!prefixcmp(var, "core.")) | 366 | if (!prefixcmp(var, "core.")) |
365 | return perf_default_core_config(var, value); | 367 | return perf_default_core_config(var, value); |
@@ -471,10 +473,10 @@ static int matches(const char* key, const char* value) | |||
471 | !regexec(store.value_regex, value, 0, NULL, 0))); | 473 | !regexec(store.value_regex, value, 0, NULL, 0))); |
472 | } | 474 | } |
473 | 475 | ||
474 | static int store_aux(const char* key, const char* value, void *cb) | 476 | static int store_aux(const char* key, const char* value, void *cb __used) |
475 | { | 477 | { |
478 | int section_len; | ||
476 | const char *ep; | 479 | const char *ep; |
477 | size_t section_len; | ||
478 | 480 | ||
479 | switch (store.state) { | 481 | switch (store.state) { |
480 | case KEY_SEEN: | 482 | case KEY_SEEN: |
@@ -551,7 +553,7 @@ static int store_write_section(int fd, const char* key) | |||
551 | strbuf_addf(&sb, "[%.*s]\n", store.baselen, key); | 553 | strbuf_addf(&sb, "[%.*s]\n", store.baselen, key); |
552 | } | 554 | } |
553 | 555 | ||
554 | success = write_in_full(fd, sb.buf, sb.len) == sb.len; | 556 | success = (write_in_full(fd, sb.buf, sb.len) == (ssize_t)sb.len); |
555 | strbuf_release(&sb); | 557 | strbuf_release(&sb); |
556 | 558 | ||
557 | return success; | 559 | return success; |
@@ -599,7 +601,7 @@ static int store_write_pair(int fd, const char* key, const char* value) | |||
599 | } | 601 | } |
600 | strbuf_addf(&sb, "%s\n", quote); | 602 | strbuf_addf(&sb, "%s\n", quote); |
601 | 603 | ||
602 | success = write_in_full(fd, sb.buf, sb.len) == sb.len; | 604 | success = (write_in_full(fd, sb.buf, sb.len) == (ssize_t)sb.len); |
603 | strbuf_release(&sb); | 605 | strbuf_release(&sb); |
604 | 606 | ||
605 | return success; | 607 | return success; |
@@ -741,7 +743,7 @@ int perf_config_set_multivar(const char* key, const char* value, | |||
741 | } else { | 743 | } else { |
742 | struct stat st; | 744 | struct stat st; |
743 | char* contents; | 745 | char* contents; |
744 | size_t contents_sz, copy_begin, copy_end; | 746 | ssize_t contents_sz, copy_begin, copy_end; |
745 | int i, new_line = 0; | 747 | int i, new_line = 0; |
746 | 748 | ||
747 | if (value_regex == NULL) | 749 | if (value_regex == NULL) |
diff --git a/tools/perf/util/exec_cmd.c b/tools/perf/util/exec_cmd.c index d39292263153..34a352867382 100644 --- a/tools/perf/util/exec_cmd.c +++ b/tools/perf/util/exec_cmd.c | |||
@@ -1,6 +1,9 @@ | |||
1 | #include "cache.h" | 1 | #include "cache.h" |
2 | #include "exec_cmd.h" | 2 | #include "exec_cmd.h" |
3 | #include "quote.h" | 3 | #include "quote.h" |
4 | |||
5 | #include <string.h> | ||
6 | |||
4 | #define MAX_ARGS 32 | 7 | #define MAX_ARGS 32 |
5 | 8 | ||
6 | extern char **environ; | 9 | extern char **environ; |
@@ -51,7 +54,7 @@ const char *perf_extract_argv0_path(const char *argv0) | |||
51 | slash--; | 54 | slash--; |
52 | 55 | ||
53 | if (slash >= argv0) { | 56 | if (slash >= argv0) { |
54 | argv0_path = strndup(argv0, slash - argv0); | 57 | argv0_path = xstrndup(argv0, slash - argv0); |
55 | return slash + 1; | 58 | return slash + 1; |
56 | } | 59 | } |
57 | 60 | ||
diff --git a/tools/perf/util/help.c b/tools/perf/util/help.c index 17a00e0df2c4..fbb00978b2e2 100644 --- a/tools/perf/util/help.c +++ b/tools/perf/util/help.c | |||
@@ -26,7 +26,7 @@ static int term_columns(void) | |||
26 | return 80; | 26 | return 80; |
27 | } | 27 | } |
28 | 28 | ||
29 | void add_cmdname(struct cmdnames *cmds, const char *name, int len) | 29 | void add_cmdname(struct cmdnames *cmds, const char *name, size_t len) |
30 | { | 30 | { |
31 | struct cmdname *ent = malloc(sizeof(*ent) + len + 1); | 31 | struct cmdname *ent = malloc(sizeof(*ent) + len + 1); |
32 | 32 | ||
@@ -40,7 +40,8 @@ void add_cmdname(struct cmdnames *cmds, const char *name, int len) | |||
40 | 40 | ||
41 | static void clean_cmdnames(struct cmdnames *cmds) | 41 | static void clean_cmdnames(struct cmdnames *cmds) |
42 | { | 42 | { |
43 | int i; | 43 | unsigned int i; |
44 | |||
44 | for (i = 0; i < cmds->cnt; ++i) | 45 | for (i = 0; i < cmds->cnt; ++i) |
45 | free(cmds->names[i]); | 46 | free(cmds->names[i]); |
46 | free(cmds->names); | 47 | free(cmds->names); |
@@ -57,7 +58,7 @@ static int cmdname_compare(const void *a_, const void *b_) | |||
57 | 58 | ||
58 | static void uniq(struct cmdnames *cmds) | 59 | static void uniq(struct cmdnames *cmds) |
59 | { | 60 | { |
60 | int i, j; | 61 | unsigned int i, j; |
61 | 62 | ||
62 | if (!cmds->cnt) | 63 | if (!cmds->cnt) |
63 | return; | 64 | return; |
@@ -71,7 +72,7 @@ static void uniq(struct cmdnames *cmds) | |||
71 | 72 | ||
72 | void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes) | 73 | void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes) |
73 | { | 74 | { |
74 | int ci, cj, ei; | 75 | size_t ci, cj, ei; |
75 | int cmp; | 76 | int cmp; |
76 | 77 | ||
77 | ci = cj = ei = 0; | 78 | ci = cj = ei = 0; |
@@ -106,8 +107,9 @@ static void pretty_print_string_list(struct cmdnames *cmds, int longest) | |||
106 | printf(" "); | 107 | printf(" "); |
107 | 108 | ||
108 | for (j = 0; j < cols; j++) { | 109 | for (j = 0; j < cols; j++) { |
109 | int n = j * rows + i; | 110 | unsigned int n = j * rows + i; |
110 | int size = space; | 111 | unsigned int size = space; |
112 | |||
111 | if (n >= cmds->cnt) | 113 | if (n >= cmds->cnt) |
112 | break; | 114 | break; |
113 | if (j == cols-1 || n + rows >= cmds->cnt) | 115 | if (j == cols-1 || n + rows >= cmds->cnt) |
@@ -208,7 +210,7 @@ void load_command_list(const char *prefix, | |||
208 | void list_commands(const char *title, struct cmdnames *main_cmds, | 210 | void list_commands(const char *title, struct cmdnames *main_cmds, |
209 | struct cmdnames *other_cmds) | 211 | struct cmdnames *other_cmds) |
210 | { | 212 | { |
211 | int i, longest = 0; | 213 | unsigned int i, longest = 0; |
212 | 214 | ||
213 | for (i = 0; i < main_cmds->cnt; i++) | 215 | for (i = 0; i < main_cmds->cnt; i++) |
214 | if (longest < main_cmds->names[i]->len) | 216 | if (longest < main_cmds->names[i]->len) |
@@ -239,7 +241,8 @@ void list_commands(const char *title, struct cmdnames *main_cmds, | |||
239 | 241 | ||
240 | int is_in_cmdlist(struct cmdnames *c, const char *s) | 242 | int is_in_cmdlist(struct cmdnames *c, const char *s) |
241 | { | 243 | { |
242 | int i; | 244 | unsigned int i; |
245 | |||
243 | for (i = 0; i < c->cnt; i++) | 246 | for (i = 0; i < c->cnt; i++) |
244 | if (!strcmp(s, c->names[i]->name)) | 247 | if (!strcmp(s, c->names[i]->name)) |
245 | return 1; | 248 | return 1; |
@@ -271,7 +274,8 @@ static int levenshtein_compare(const void *p1, const void *p2) | |||
271 | 274 | ||
272 | static void add_cmd_list(struct cmdnames *cmds, struct cmdnames *old) | 275 | static void add_cmd_list(struct cmdnames *cmds, struct cmdnames *old) |
273 | { | 276 | { |
274 | int i; | 277 | unsigned int i; |
278 | |||
275 | ALLOC_GROW(cmds->names, cmds->cnt + old->cnt, cmds->alloc); | 279 | ALLOC_GROW(cmds->names, cmds->cnt + old->cnt, cmds->alloc); |
276 | 280 | ||
277 | for (i = 0; i < old->cnt; i++) | 281 | for (i = 0; i < old->cnt; i++) |
@@ -283,7 +287,7 @@ static void add_cmd_list(struct cmdnames *cmds, struct cmdnames *old) | |||
283 | 287 | ||
284 | const char *help_unknown_cmd(const char *cmd) | 288 | const char *help_unknown_cmd(const char *cmd) |
285 | { | 289 | { |
286 | int i, n = 0, best_similarity = 0; | 290 | unsigned int i, n = 0, best_similarity = 0; |
287 | struct cmdnames main_cmds, other_cmds; | 291 | struct cmdnames main_cmds, other_cmds; |
288 | 292 | ||
289 | memset(&main_cmds, 0, sizeof(main_cmds)); | 293 | memset(&main_cmds, 0, sizeof(main_cmds)); |
@@ -345,7 +349,7 @@ const char *help_unknown_cmd(const char *cmd) | |||
345 | exit(1); | 349 | exit(1); |
346 | } | 350 | } |
347 | 351 | ||
348 | int cmd_version(int argc, const char **argv, const char *prefix) | 352 | int cmd_version(int argc __used, const char **argv __used, const char *prefix __used) |
349 | { | 353 | { |
350 | printf("perf version %s\n", perf_version_string); | 354 | printf("perf version %s\n", perf_version_string); |
351 | return 0; | 355 | return 0; |
diff --git a/tools/perf/util/help.h b/tools/perf/util/help.h index 56bc15406ffc..7128783637b4 100644 --- a/tools/perf/util/help.h +++ b/tools/perf/util/help.h | |||
@@ -2,8 +2,8 @@ | |||
2 | #define HELP_H | 2 | #define HELP_H |
3 | 3 | ||
4 | struct cmdnames { | 4 | struct cmdnames { |
5 | int alloc; | 5 | size_t alloc; |
6 | int cnt; | 6 | size_t cnt; |
7 | struct cmdname { | 7 | struct cmdname { |
8 | size_t len; /* also used for similarity index in help.c */ | 8 | size_t len; /* also used for similarity index in help.c */ |
9 | char name[FLEX_ARRAY]; | 9 | char name[FLEX_ARRAY]; |
@@ -19,7 +19,7 @@ static inline void mput_char(char c, unsigned int num) | |||
19 | void load_command_list(const char *prefix, | 19 | void load_command_list(const char *prefix, |
20 | struct cmdnames *main_cmds, | 20 | struct cmdnames *main_cmds, |
21 | struct cmdnames *other_cmds); | 21 | struct cmdnames *other_cmds); |
22 | void add_cmdname(struct cmdnames *cmds, const char *name, int len); | 22 | void add_cmdname(struct cmdnames *cmds, const char *name, size_t len); |
23 | /* Here we require that excludes is a sorted list. */ | 23 | /* Here we require that excludes is a sorted list. */ |
24 | void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes); | 24 | void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes); |
25 | int is_in_cmdlist(struct cmdnames *c, const char *s); | 25 | int is_in_cmdlist(struct cmdnames *c, const char *s); |
diff --git a/tools/perf/util/include/asm/system.h b/tools/perf/util/include/asm/system.h new file mode 100644 index 000000000000..710cecca972d --- /dev/null +++ b/tools/perf/util/include/asm/system.h | |||
@@ -0,0 +1 @@ | |||
/* Empty */ | |||
diff --git a/tools/perf/util/include/linux/kernel.h b/tools/perf/util/include/linux/kernel.h new file mode 100644 index 000000000000..99c1b3d1edd9 --- /dev/null +++ b/tools/perf/util/include/linux/kernel.h | |||
@@ -0,0 +1,21 @@ | |||
1 | #ifndef PERF_LINUX_KERNEL_H_ | ||
2 | #define PERF_LINUX_KERNEL_H_ | ||
3 | |||
4 | #ifndef offsetof | ||
5 | #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) | ||
6 | #endif | ||
7 | |||
8 | #ifndef container_of | ||
9 | /** | ||
10 | * container_of - cast a member of a structure out to the containing structure | ||
11 | * @ptr: the pointer to the member. | ||
12 | * @type: the type of the container struct this is embedded in. | ||
13 | * @member: the name of the member within the struct. | ||
14 | * | ||
15 | */ | ||
16 | #define container_of(ptr, type, member) ({ \ | ||
17 | const typeof(((type *)0)->member) * __mptr = (ptr); \ | ||
18 | (type *)((char *)__mptr - offsetof(type, member)); }) | ||
19 | #endif | ||
20 | |||
21 | #endif | ||
diff --git a/tools/perf/util/include/linux/list.h b/tools/perf/util/include/linux/list.h new file mode 100644 index 000000000000..dbe4b814382a --- /dev/null +++ b/tools/perf/util/include/linux/list.h | |||
@@ -0,0 +1,18 @@ | |||
1 | #include "../../../../include/linux/list.h" | ||
2 | |||
3 | #ifndef PERF_LIST_H | ||
4 | #define PERF_LIST_H | ||
5 | /** | ||
6 | * list_del_range - deletes range of entries from list. | ||
7 | * @begin: first element in the range to delete from the list. | ||
8 | * @end: last element in the range to delete from the list. | ||
9 | * Note: list_empty on the range of entries does not return true after this, | ||
10 | * the entries is in an undefined state. | ||
11 | */ | ||
12 | static inline void list_del_range(struct list_head *begin, | ||
13 | struct list_head *end) | ||
14 | { | ||
15 | begin->prev->next = end->next; | ||
16 | end->next->prev = begin->prev; | ||
17 | } | ||
18 | #endif | ||
diff --git a/tools/perf/util/include/linux/module.h b/tools/perf/util/include/linux/module.h new file mode 100644 index 000000000000..b43e2dc21e04 --- /dev/null +++ b/tools/perf/util/include/linux/module.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef PERF_LINUX_MODULE_H | ||
2 | #define PERF_LINUX_MODULE_H | ||
3 | |||
4 | #define EXPORT_SYMBOL(name) | ||
5 | |||
6 | #endif | ||
diff --git a/tools/perf/util/include/linux/poison.h b/tools/perf/util/include/linux/poison.h new file mode 100644 index 000000000000..fef6dbc9ce13 --- /dev/null +++ b/tools/perf/util/include/linux/poison.h | |||
@@ -0,0 +1 @@ | |||
#include "../../../../include/linux/poison.h" | |||
diff --git a/tools/perf/util/include/linux/prefetch.h b/tools/perf/util/include/linux/prefetch.h new file mode 100644 index 000000000000..7841e485d8c3 --- /dev/null +++ b/tools/perf/util/include/linux/prefetch.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef PERF_LINUX_PREFETCH_H | ||
2 | #define PERF_LINUX_PREFETCH_H | ||
3 | |||
4 | static inline void prefetch(void *a __attribute__((unused))) { } | ||
5 | |||
6 | #endif | ||
diff --git a/tools/perf/util/include/linux/rbtree.h b/tools/perf/util/include/linux/rbtree.h new file mode 100644 index 000000000000..7a243a143037 --- /dev/null +++ b/tools/perf/util/include/linux/rbtree.h | |||
@@ -0,0 +1 @@ | |||
#include "../../../../include/linux/rbtree.h" | |||
diff --git a/tools/perf/util/list.h b/tools/perf/util/list.h deleted file mode 100644 index e2548e8072cf..000000000000 --- a/tools/perf/util/list.h +++ /dev/null | |||
@@ -1,603 +0,0 @@ | |||
1 | #ifndef _LINUX_LIST_H | ||
2 | #define _LINUX_LIST_H | ||
3 | /* | ||
4 | Copyright (C) Cast of dozens, comes from the Linux kernel | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify it | ||
7 | under the terms of version 2 of the GNU General Public License as | ||
8 | published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <stddef.h> | ||
12 | |||
13 | /* | ||
14 | * These are non-NULL pointers that will result in page faults | ||
15 | * under normal circumstances, used to verify that nobody uses | ||
16 | * non-initialized list entries. | ||
17 | */ | ||
18 | #define LIST_POISON1 ((void *)0x00100100) | ||
19 | #define LIST_POISON2 ((void *)0x00200200) | ||
20 | |||
21 | /** | ||
22 | * container_of - cast a member of a structure out to the containing structure | ||
23 | * @ptr: the pointer to the member. | ||
24 | * @type: the type of the container struct this is embedded in. | ||
25 | * @member: the name of the member within the struct. | ||
26 | * | ||
27 | */ | ||
28 | #define container_of(ptr, type, member) ({ \ | ||
29 | const typeof( ((type *)0)->member ) *__mptr = (ptr); \ | ||
30 | (type *)( (char *)__mptr - offsetof(type,member) );}) | ||
31 | |||
32 | /* | ||
33 | * Simple doubly linked list implementation. | ||
34 | * | ||
35 | * Some of the internal functions ("__xxx") are useful when | ||
36 | * manipulating whole lists rather than single entries, as | ||
37 | * sometimes we already know the next/prev entries and we can | ||
38 | * generate better code by using them directly rather than | ||
39 | * using the generic single-entry routines. | ||
40 | */ | ||
41 | |||
42 | struct list_head { | ||
43 | struct list_head *next, *prev; | ||
44 | }; | ||
45 | |||
46 | #define LIST_HEAD_INIT(name) { &(name), &(name) } | ||
47 | |||
48 | #define LIST_HEAD(name) \ | ||
49 | struct list_head name = LIST_HEAD_INIT(name) | ||
50 | |||
51 | static inline void INIT_LIST_HEAD(struct list_head *list) | ||
52 | { | ||
53 | list->next = list; | ||
54 | list->prev = list; | ||
55 | } | ||
56 | |||
57 | /* | ||
58 | * Insert a new entry between two known consecutive entries. | ||
59 | * | ||
60 | * This is only for internal list manipulation where we know | ||
61 | * the prev/next entries already! | ||
62 | */ | ||
63 | static inline void __list_add(struct list_head *new, | ||
64 | struct list_head *prev, | ||
65 | struct list_head *next) | ||
66 | { | ||
67 | next->prev = new; | ||
68 | new->next = next; | ||
69 | new->prev = prev; | ||
70 | prev->next = new; | ||
71 | } | ||
72 | |||
73 | /** | ||
74 | * list_add - add a new entry | ||
75 | * @new: new entry to be added | ||
76 | * @head: list head to add it after | ||
77 | * | ||
78 | * Insert a new entry after the specified head. | ||
79 | * This is good for implementing stacks. | ||
80 | */ | ||
81 | static inline void list_add(struct list_head *new, struct list_head *head) | ||
82 | { | ||
83 | __list_add(new, head, head->next); | ||
84 | } | ||
85 | |||
86 | /** | ||
87 | * list_add_tail - add a new entry | ||
88 | * @new: new entry to be added | ||
89 | * @head: list head to add it before | ||
90 | * | ||
91 | * Insert a new entry before the specified head. | ||
92 | * This is useful for implementing queues. | ||
93 | */ | ||
94 | static inline void list_add_tail(struct list_head *new, struct list_head *head) | ||
95 | { | ||
96 | __list_add(new, head->prev, head); | ||
97 | } | ||
98 | |||
99 | /* | ||
100 | * Delete a list entry by making the prev/next entries | ||
101 | * point to each other. | ||
102 | * | ||
103 | * This is only for internal list manipulation where we know | ||
104 | * the prev/next entries already! | ||
105 | */ | ||
106 | static inline void __list_del(struct list_head * prev, struct list_head * next) | ||
107 | { | ||
108 | next->prev = prev; | ||
109 | prev->next = next; | ||
110 | } | ||
111 | |||
112 | /** | ||
113 | * list_del - deletes entry from list. | ||
114 | * @entry: the element to delete from the list. | ||
115 | * Note: list_empty on entry does not return true after this, the entry is | ||
116 | * in an undefined state. | ||
117 | */ | ||
118 | static inline void list_del(struct list_head *entry) | ||
119 | { | ||
120 | __list_del(entry->prev, entry->next); | ||
121 | entry->next = LIST_POISON1; | ||
122 | entry->prev = LIST_POISON2; | ||
123 | } | ||
124 | |||
125 | /** | ||
126 | * list_del_range - deletes range of entries from list. | ||
127 | * @beging: first element in the range to delete from the list. | ||
128 | * @beging: first element in the range to delete from the list. | ||
129 | * Note: list_empty on the range of entries does not return true after this, | ||
130 | * the entries is in an undefined state. | ||
131 | */ | ||
132 | static inline void list_del_range(struct list_head *begin, | ||
133 | struct list_head *end) | ||
134 | { | ||
135 | begin->prev->next = end->next; | ||
136 | end->next->prev = begin->prev; | ||
137 | } | ||
138 | |||
139 | /** | ||
140 | * list_replace - replace old entry by new one | ||
141 | * @old : the element to be replaced | ||
142 | * @new : the new element to insert | ||
143 | * Note: if 'old' was empty, it will be overwritten. | ||
144 | */ | ||
145 | static inline void list_replace(struct list_head *old, | ||
146 | struct list_head *new) | ||
147 | { | ||
148 | new->next = old->next; | ||
149 | new->next->prev = new; | ||
150 | new->prev = old->prev; | ||
151 | new->prev->next = new; | ||
152 | } | ||
153 | |||
154 | static inline void list_replace_init(struct list_head *old, | ||
155 | struct list_head *new) | ||
156 | { | ||
157 | list_replace(old, new); | ||
158 | INIT_LIST_HEAD(old); | ||
159 | } | ||
160 | |||
161 | /** | ||
162 | * list_del_init - deletes entry from list and reinitialize it. | ||
163 | * @entry: the element to delete from the list. | ||
164 | */ | ||
165 | static inline void list_del_init(struct list_head *entry) | ||
166 | { | ||
167 | __list_del(entry->prev, entry->next); | ||
168 | INIT_LIST_HEAD(entry); | ||
169 | } | ||
170 | |||
171 | /** | ||
172 | * list_move - delete from one list and add as another's head | ||
173 | * @list: the entry to move | ||
174 | * @head: the head that will precede our entry | ||
175 | */ | ||
176 | static inline void list_move(struct list_head *list, struct list_head *head) | ||
177 | { | ||
178 | __list_del(list->prev, list->next); | ||
179 | list_add(list, head); | ||
180 | } | ||
181 | |||
182 | /** | ||
183 | * list_move_tail - delete from one list and add as another's tail | ||
184 | * @list: the entry to move | ||
185 | * @head: the head that will follow our entry | ||
186 | */ | ||
187 | static inline void list_move_tail(struct list_head *list, | ||
188 | struct list_head *head) | ||
189 | { | ||
190 | __list_del(list->prev, list->next); | ||
191 | list_add_tail(list, head); | ||
192 | } | ||
193 | |||
194 | /** | ||
195 | * list_is_last - tests whether @list is the last entry in list @head | ||
196 | * @list: the entry to test | ||
197 | * @head: the head of the list | ||
198 | */ | ||
199 | static inline int list_is_last(const struct list_head *list, | ||
200 | const struct list_head *head) | ||
201 | { | ||
202 | return list->next == head; | ||
203 | } | ||
204 | |||
205 | /** | ||
206 | * list_empty - tests whether a list is empty | ||
207 | * @head: the list to test. | ||
208 | */ | ||
209 | static inline int list_empty(const struct list_head *head) | ||
210 | { | ||
211 | return head->next == head; | ||
212 | } | ||
213 | |||
214 | /** | ||
215 | * list_empty_careful - tests whether a list is empty and not being modified | ||
216 | * @head: the list to test | ||
217 | * | ||
218 | * Description: | ||
219 | * tests whether a list is empty _and_ checks that no other CPU might be | ||
220 | * in the process of modifying either member (next or prev) | ||
221 | * | ||
222 | * NOTE: using list_empty_careful() without synchronization | ||
223 | * can only be safe if the only activity that can happen | ||
224 | * to the list entry is list_del_init(). Eg. it cannot be used | ||
225 | * if another CPU could re-list_add() it. | ||
226 | */ | ||
227 | static inline int list_empty_careful(const struct list_head *head) | ||
228 | { | ||
229 | struct list_head *next = head->next; | ||
230 | return (next == head) && (next == head->prev); | ||
231 | } | ||
232 | |||
233 | static inline void __list_splice(struct list_head *list, | ||
234 | struct list_head *head) | ||
235 | { | ||
236 | struct list_head *first = list->next; | ||
237 | struct list_head *last = list->prev; | ||
238 | struct list_head *at = head->next; | ||
239 | |||
240 | first->prev = head; | ||
241 | head->next = first; | ||
242 | |||
243 | last->next = at; | ||
244 | at->prev = last; | ||
245 | } | ||
246 | |||
247 | /** | ||
248 | * list_splice - join two lists | ||
249 | * @list: the new list to add. | ||
250 | * @head: the place to add it in the first list. | ||
251 | */ | ||
252 | static inline void list_splice(struct list_head *list, struct list_head *head) | ||
253 | { | ||
254 | if (!list_empty(list)) | ||
255 | __list_splice(list, head); | ||
256 | } | ||
257 | |||
258 | /** | ||
259 | * list_splice_init - join two lists and reinitialise the emptied list. | ||
260 | * @list: the new list to add. | ||
261 | * @head: the place to add it in the first list. | ||
262 | * | ||
263 | * The list at @list is reinitialised | ||
264 | */ | ||
265 | static inline void list_splice_init(struct list_head *list, | ||
266 | struct list_head *head) | ||
267 | { | ||
268 | if (!list_empty(list)) { | ||
269 | __list_splice(list, head); | ||
270 | INIT_LIST_HEAD(list); | ||
271 | } | ||
272 | } | ||
273 | |||
274 | /** | ||
275 | * list_entry - get the struct for this entry | ||
276 | * @ptr: the &struct list_head pointer. | ||
277 | * @type: the type of the struct this is embedded in. | ||
278 | * @member: the name of the list_struct within the struct. | ||
279 | */ | ||
280 | #define list_entry(ptr, type, member) \ | ||
281 | container_of(ptr, type, member) | ||
282 | |||
283 | /** | ||
284 | * list_first_entry - get the first element from a list | ||
285 | * @ptr: the list head to take the element from. | ||
286 | * @type: the type of the struct this is embedded in. | ||
287 | * @member: the name of the list_struct within the struct. | ||
288 | * | ||
289 | * Note, that list is expected to be not empty. | ||
290 | */ | ||
291 | #define list_first_entry(ptr, type, member) \ | ||
292 | list_entry((ptr)->next, type, member) | ||
293 | |||
294 | /** | ||
295 | * list_for_each - iterate over a list | ||
296 | * @pos: the &struct list_head to use as a loop cursor. | ||
297 | * @head: the head for your list. | ||
298 | */ | ||
299 | #define list_for_each(pos, head) \ | ||
300 | for (pos = (head)->next; pos != (head); \ | ||
301 | pos = pos->next) | ||
302 | |||
303 | /** | ||
304 | * __list_for_each - iterate over a list | ||
305 | * @pos: the &struct list_head to use as a loop cursor. | ||
306 | * @head: the head for your list. | ||
307 | * | ||
308 | * This variant differs from list_for_each() in that it's the | ||
309 | * simplest possible list iteration code, no prefetching is done. | ||
310 | * Use this for code that knows the list to be very short (empty | ||
311 | * or 1 entry) most of the time. | ||
312 | */ | ||
313 | #define __list_for_each(pos, head) \ | ||
314 | for (pos = (head)->next; pos != (head); pos = pos->next) | ||
315 | |||
316 | /** | ||
317 | * list_for_each_prev - iterate over a list backwards | ||
318 | * @pos: the &struct list_head to use as a loop cursor. | ||
319 | * @head: the head for your list. | ||
320 | */ | ||
321 | #define list_for_each_prev(pos, head) \ | ||
322 | for (pos = (head)->prev; pos != (head); \ | ||
323 | pos = pos->prev) | ||
324 | |||
325 | /** | ||
326 | * list_for_each_safe - iterate over a list safe against removal of list entry | ||
327 | * @pos: the &struct list_head to use as a loop cursor. | ||
328 | * @n: another &struct list_head to use as temporary storage | ||
329 | * @head: the head for your list. | ||
330 | */ | ||
331 | #define list_for_each_safe(pos, n, head) \ | ||
332 | for (pos = (head)->next, n = pos->next; pos != (head); \ | ||
333 | pos = n, n = pos->next) | ||
334 | |||
335 | /** | ||
336 | * list_for_each_entry - iterate over list of given type | ||
337 | * @pos: the type * to use as a loop cursor. | ||
338 | * @head: the head for your list. | ||
339 | * @member: the name of the list_struct within the struct. | ||
340 | */ | ||
341 | #define list_for_each_entry(pos, head, member) \ | ||
342 | for (pos = list_entry((head)->next, typeof(*pos), member); \ | ||
343 | &pos->member != (head); \ | ||
344 | pos = list_entry(pos->member.next, typeof(*pos), member)) | ||
345 | |||
346 | /** | ||
347 | * list_for_each_entry_reverse - iterate backwards over list of given type. | ||
348 | * @pos: the type * to use as a loop cursor. | ||
349 | * @head: the head for your list. | ||
350 | * @member: the name of the list_struct within the struct. | ||
351 | */ | ||
352 | #define list_for_each_entry_reverse(pos, head, member) \ | ||
353 | for (pos = list_entry((head)->prev, typeof(*pos), member); \ | ||
354 | &pos->member != (head); \ | ||
355 | pos = list_entry(pos->member.prev, typeof(*pos), member)) | ||
356 | |||
357 | /** | ||
358 | * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue | ||
359 | * @pos: the type * to use as a start point | ||
360 | * @head: the head of the list | ||
361 | * @member: the name of the list_struct within the struct. | ||
362 | * | ||
363 | * Prepares a pos entry for use as a start point in list_for_each_entry_continue. | ||
364 | */ | ||
365 | #define list_prepare_entry(pos, head, member) \ | ||
366 | ((pos) ? : list_entry(head, typeof(*pos), member)) | ||
367 | |||
368 | /** | ||
369 | * list_for_each_entry_continue - continue iteration over list of given type | ||
370 | * @pos: the type * to use as a loop cursor. | ||
371 | * @head: the head for your list. | ||
372 | * @member: the name of the list_struct within the struct. | ||
373 | * | ||
374 | * Continue to iterate over list of given type, continuing after | ||
375 | * the current position. | ||
376 | */ | ||
377 | #define list_for_each_entry_continue(pos, head, member) \ | ||
378 | for (pos = list_entry(pos->member.next, typeof(*pos), member); \ | ||
379 | &pos->member != (head); \ | ||
380 | pos = list_entry(pos->member.next, typeof(*pos), member)) | ||
381 | |||
382 | /** | ||
383 | * list_for_each_entry_from - iterate over list of given type from the current point | ||
384 | * @pos: the type * to use as a loop cursor. | ||
385 | * @head: the head for your list. | ||
386 | * @member: the name of the list_struct within the struct. | ||
387 | * | ||
388 | * Iterate over list of given type, continuing from current position. | ||
389 | */ | ||
390 | #define list_for_each_entry_from(pos, head, member) \ | ||
391 | for (; &pos->member != (head); \ | ||
392 | pos = list_entry(pos->member.next, typeof(*pos), member)) | ||
393 | |||
394 | /** | ||
395 | * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry | ||
396 | * @pos: the type * to use as a loop cursor. | ||
397 | * @n: another type * to use as temporary storage | ||
398 | * @head: the head for your list. | ||
399 | * @member: the name of the list_struct within the struct. | ||
400 | */ | ||
401 | #define list_for_each_entry_safe(pos, n, head, member) \ | ||
402 | for (pos = list_entry((head)->next, typeof(*pos), member), \ | ||
403 | n = list_entry(pos->member.next, typeof(*pos), member); \ | ||
404 | &pos->member != (head); \ | ||
405 | pos = n, n = list_entry(n->member.next, typeof(*n), member)) | ||
406 | |||
407 | /** | ||
408 | * list_for_each_entry_safe_continue | ||
409 | * @pos: the type * to use as a loop cursor. | ||
410 | * @n: another type * to use as temporary storage | ||
411 | * @head: the head for your list. | ||
412 | * @member: the name of the list_struct within the struct. | ||
413 | * | ||
414 | * Iterate over list of given type, continuing after current point, | ||
415 | * safe against removal of list entry. | ||
416 | */ | ||
417 | #define list_for_each_entry_safe_continue(pos, n, head, member) \ | ||
418 | for (pos = list_entry(pos->member.next, typeof(*pos), member), \ | ||
419 | n = list_entry(pos->member.next, typeof(*pos), member); \ | ||
420 | &pos->member != (head); \ | ||
421 | pos = n, n = list_entry(n->member.next, typeof(*n), member)) | ||
422 | |||
423 | /** | ||
424 | * list_for_each_entry_safe_from | ||
425 | * @pos: the type * to use as a loop cursor. | ||
426 | * @n: another type * to use as temporary storage | ||
427 | * @head: the head for your list. | ||
428 | * @member: the name of the list_struct within the struct. | ||
429 | * | ||
430 | * Iterate over list of given type from current point, safe against | ||
431 | * removal of list entry. | ||
432 | */ | ||
433 | #define list_for_each_entry_safe_from(pos, n, head, member) \ | ||
434 | for (n = list_entry(pos->member.next, typeof(*pos), member); \ | ||
435 | &pos->member != (head); \ | ||
436 | pos = n, n = list_entry(n->member.next, typeof(*n), member)) | ||
437 | |||
438 | /** | ||
439 | * list_for_each_entry_safe_reverse | ||
440 | * @pos: the type * to use as a loop cursor. | ||
441 | * @n: another type * to use as temporary storage | ||
442 | * @head: the head for your list. | ||
443 | * @member: the name of the list_struct within the struct. | ||
444 | * | ||
445 | * Iterate backwards over list of given type, safe against removal | ||
446 | * of list entry. | ||
447 | */ | ||
448 | #define list_for_each_entry_safe_reverse(pos, n, head, member) \ | ||
449 | for (pos = list_entry((head)->prev, typeof(*pos), member), \ | ||
450 | n = list_entry(pos->member.prev, typeof(*pos), member); \ | ||
451 | &pos->member != (head); \ | ||
452 | pos = n, n = list_entry(n->member.prev, typeof(*n), member)) | ||
453 | |||
454 | /* | ||
455 | * Double linked lists with a single pointer list head. | ||
456 | * Mostly useful for hash tables where the two pointer list head is | ||
457 | * too wasteful. | ||
458 | * You lose the ability to access the tail in O(1). | ||
459 | */ | ||
460 | |||
461 | struct hlist_head { | ||
462 | struct hlist_node *first; | ||
463 | }; | ||
464 | |||
465 | struct hlist_node { | ||
466 | struct hlist_node *next, **pprev; | ||
467 | }; | ||
468 | |||
469 | #define HLIST_HEAD_INIT { .first = NULL } | ||
470 | #define HLIST_HEAD(name) struct hlist_head name = { .first = NULL } | ||
471 | #define INIT_HLIST_HEAD(ptr) ((ptr)->first = NULL) | ||
472 | static inline void INIT_HLIST_NODE(struct hlist_node *h) | ||
473 | { | ||
474 | h->next = NULL; | ||
475 | h->pprev = NULL; | ||
476 | } | ||
477 | |||
478 | static inline int hlist_unhashed(const struct hlist_node *h) | ||
479 | { | ||
480 | return !h->pprev; | ||
481 | } | ||
482 | |||
483 | static inline int hlist_empty(const struct hlist_head *h) | ||
484 | { | ||
485 | return !h->first; | ||
486 | } | ||
487 | |||
488 | static inline void __hlist_del(struct hlist_node *n) | ||
489 | { | ||
490 | struct hlist_node *next = n->next; | ||
491 | struct hlist_node **pprev = n->pprev; | ||
492 | *pprev = next; | ||
493 | if (next) | ||
494 | next->pprev = pprev; | ||
495 | } | ||
496 | |||
497 | static inline void hlist_del(struct hlist_node *n) | ||
498 | { | ||
499 | __hlist_del(n); | ||
500 | n->next = LIST_POISON1; | ||
501 | n->pprev = LIST_POISON2; | ||
502 | } | ||
503 | |||
504 | static inline void hlist_del_init(struct hlist_node *n) | ||
505 | { | ||
506 | if (!hlist_unhashed(n)) { | ||
507 | __hlist_del(n); | ||
508 | INIT_HLIST_NODE(n); | ||
509 | } | ||
510 | } | ||
511 | |||
512 | static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) | ||
513 | { | ||
514 | struct hlist_node *first = h->first; | ||
515 | n->next = first; | ||
516 | if (first) | ||
517 | first->pprev = &n->next; | ||
518 | h->first = n; | ||
519 | n->pprev = &h->first; | ||
520 | } | ||
521 | |||
522 | /* next must be != NULL */ | ||
523 | static inline void hlist_add_before(struct hlist_node *n, | ||
524 | struct hlist_node *next) | ||
525 | { | ||
526 | n->pprev = next->pprev; | ||
527 | n->next = next; | ||
528 | next->pprev = &n->next; | ||
529 | *(n->pprev) = n; | ||
530 | } | ||
531 | |||
532 | static inline void hlist_add_after(struct hlist_node *n, | ||
533 | struct hlist_node *next) | ||
534 | { | ||
535 | next->next = n->next; | ||
536 | n->next = next; | ||
537 | next->pprev = &n->next; | ||
538 | |||
539 | if(next->next) | ||
540 | next->next->pprev = &next->next; | ||
541 | } | ||
542 | |||
543 | #define hlist_entry(ptr, type, member) container_of(ptr,type,member) | ||
544 | |||
545 | #define hlist_for_each(pos, head) \ | ||
546 | for (pos = (head)->first; pos; \ | ||
547 | pos = pos->next) | ||
548 | |||
549 | #define hlist_for_each_safe(pos, n, head) \ | ||
550 | for (pos = (head)->first; pos && ({ n = pos->next; 1; }); \ | ||
551 | pos = n) | ||
552 | |||
553 | /** | ||
554 | * hlist_for_each_entry - iterate over list of given type | ||
555 | * @tpos: the type * to use as a loop cursor. | ||
556 | * @pos: the &struct hlist_node to use as a loop cursor. | ||
557 | * @head: the head for your list. | ||
558 | * @member: the name of the hlist_node within the struct. | ||
559 | */ | ||
560 | #define hlist_for_each_entry(tpos, pos, head, member) \ | ||
561 | for (pos = (head)->first; \ | ||
562 | pos && \ | ||
563 | ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ | ||
564 | pos = pos->next) | ||
565 | |||
566 | /** | ||
567 | * hlist_for_each_entry_continue - iterate over a hlist continuing after current point | ||
568 | * @tpos: the type * to use as a loop cursor. | ||
569 | * @pos: the &struct hlist_node to use as a loop cursor. | ||
570 | * @member: the name of the hlist_node within the struct. | ||
571 | */ | ||
572 | #define hlist_for_each_entry_continue(tpos, pos, member) \ | ||
573 | for (pos = (pos)->next; \ | ||
574 | pos && \ | ||
575 | ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ | ||
576 | pos = pos->next) | ||
577 | |||
578 | /** | ||
579 | * hlist_for_each_entry_from - iterate over a hlist continuing from current point | ||
580 | * @tpos: the type * to use as a loop cursor. | ||
581 | * @pos: the &struct hlist_node to use as a loop cursor. | ||
582 | * @member: the name of the hlist_node within the struct. | ||
583 | */ | ||
584 | #define hlist_for_each_entry_from(tpos, pos, member) \ | ||
585 | for (; pos && \ | ||
586 | ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ | ||
587 | pos = pos->next) | ||
588 | |||
589 | /** | ||
590 | * hlist_for_each_entry_safe - iterate over list of given type safe against removal of list entry | ||
591 | * @tpos: the type * to use as a loop cursor. | ||
592 | * @pos: the &struct hlist_node to use as a loop cursor. | ||
593 | * @n: another &struct hlist_node to use as temporary storage | ||
594 | * @head: the head for your list. | ||
595 | * @member: the name of the hlist_node within the struct. | ||
596 | */ | ||
597 | #define hlist_for_each_entry_safe(tpos, pos, n, head, member) \ | ||
598 | for (pos = (head)->first; \ | ||
599 | pos && ({ n = pos->next; 1; }) && \ | ||
600 | ({ tpos = hlist_entry(pos, typeof(*tpos), member); 1;}); \ | ||
601 | pos = n) | ||
602 | |||
603 | #endif | ||
diff --git a/tools/perf/util/module.c b/tools/perf/util/module.c new file mode 100644 index 000000000000..ddabe925d65d --- /dev/null +++ b/tools/perf/util/module.c | |||
@@ -0,0 +1,509 @@ | |||
1 | #include "util.h" | ||
2 | #include "../perf.h" | ||
3 | #include "string.h" | ||
4 | #include "module.h" | ||
5 | |||
6 | #include <libelf.h> | ||
7 | #include <gelf.h> | ||
8 | #include <elf.h> | ||
9 | #include <dirent.h> | ||
10 | #include <sys/utsname.h> | ||
11 | |||
12 | static unsigned int crc32(const char *p, unsigned int len) | ||
13 | { | ||
14 | int i; | ||
15 | unsigned int crc = 0; | ||
16 | |||
17 | while (len--) { | ||
18 | crc ^= *p++; | ||
19 | for (i = 0; i < 8; i++) | ||
20 | crc = (crc >> 1) ^ ((crc & 1) ? 0xedb88320 : 0); | ||
21 | } | ||
22 | return crc; | ||
23 | } | ||
24 | |||
25 | /* module section methods */ | ||
26 | |||
27 | struct sec_dso *sec_dso__new_dso(const char *name) | ||
28 | { | ||
29 | struct sec_dso *self = malloc(sizeof(*self) + strlen(name) + 1); | ||
30 | |||
31 | if (self != NULL) { | ||
32 | strcpy(self->name, name); | ||
33 | self->secs = RB_ROOT; | ||
34 | self->find_section = sec_dso__find_section; | ||
35 | } | ||
36 | |||
37 | return self; | ||
38 | } | ||
39 | |||
40 | static void sec_dso__delete_section(struct section *self) | ||
41 | { | ||
42 | free(((void *)self)); | ||
43 | } | ||
44 | |||
45 | void sec_dso__delete_sections(struct sec_dso *self) | ||
46 | { | ||
47 | struct section *pos; | ||
48 | struct rb_node *next = rb_first(&self->secs); | ||
49 | |||
50 | while (next) { | ||
51 | pos = rb_entry(next, struct section, rb_node); | ||
52 | next = rb_next(&pos->rb_node); | ||
53 | rb_erase(&pos->rb_node, &self->secs); | ||
54 | sec_dso__delete_section(pos); | ||
55 | } | ||
56 | } | ||
57 | |||
58 | void sec_dso__delete_self(struct sec_dso *self) | ||
59 | { | ||
60 | sec_dso__delete_sections(self); | ||
61 | free(self); | ||
62 | } | ||
63 | |||
64 | static void sec_dso__insert_section(struct sec_dso *self, struct section *sec) | ||
65 | { | ||
66 | struct rb_node **p = &self->secs.rb_node; | ||
67 | struct rb_node *parent = NULL; | ||
68 | const u64 hash = sec->hash; | ||
69 | struct section *s; | ||
70 | |||
71 | while (*p != NULL) { | ||
72 | parent = *p; | ||
73 | s = rb_entry(parent, struct section, rb_node); | ||
74 | if (hash < s->hash) | ||
75 | p = &(*p)->rb_left; | ||
76 | else | ||
77 | p = &(*p)->rb_right; | ||
78 | } | ||
79 | rb_link_node(&sec->rb_node, parent, p); | ||
80 | rb_insert_color(&sec->rb_node, &self->secs); | ||
81 | } | ||
82 | |||
83 | struct section *sec_dso__find_section(struct sec_dso *self, const char *name) | ||
84 | { | ||
85 | struct rb_node *n; | ||
86 | u64 hash; | ||
87 | int len; | ||
88 | |||
89 | if (self == NULL) | ||
90 | return NULL; | ||
91 | |||
92 | len = strlen(name); | ||
93 | hash = crc32(name, len); | ||
94 | |||
95 | n = self->secs.rb_node; | ||
96 | |||
97 | while (n) { | ||
98 | struct section *s = rb_entry(n, struct section, rb_node); | ||
99 | |||
100 | if (hash < s->hash) | ||
101 | n = n->rb_left; | ||
102 | else if (hash > s->hash) | ||
103 | n = n->rb_right; | ||
104 | else { | ||
105 | if (!strcmp(name, s->name)) | ||
106 | return s; | ||
107 | else | ||
108 | n = rb_next(&s->rb_node); | ||
109 | } | ||
110 | } | ||
111 | |||
112 | return NULL; | ||
113 | } | ||
114 | |||
115 | static size_t sec_dso__fprintf_section(struct section *self, FILE *fp) | ||
116 | { | ||
117 | return fprintf(fp, "name:%s vma:%llx path:%s\n", | ||
118 | self->name, self->vma, self->path); | ||
119 | } | ||
120 | |||
121 | size_t sec_dso__fprintf(struct sec_dso *self, FILE *fp) | ||
122 | { | ||
123 | size_t ret = fprintf(fp, "dso: %s\n", self->name); | ||
124 | |||
125 | struct rb_node *nd; | ||
126 | for (nd = rb_first(&self->secs); nd; nd = rb_next(nd)) { | ||
127 | struct section *pos = rb_entry(nd, struct section, rb_node); | ||
128 | ret += sec_dso__fprintf_section(pos, fp); | ||
129 | } | ||
130 | |||
131 | return ret; | ||
132 | } | ||
133 | |||
134 | static struct section *section__new(const char *name, const char *path) | ||
135 | { | ||
136 | struct section *self = calloc(1, sizeof(*self)); | ||
137 | |||
138 | if (!self) | ||
139 | goto out_failure; | ||
140 | |||
141 | self->name = calloc(1, strlen(name) + 1); | ||
142 | if (!self->name) | ||
143 | goto out_failure; | ||
144 | |||
145 | self->path = calloc(1, strlen(path) + 1); | ||
146 | if (!self->path) | ||
147 | goto out_failure; | ||
148 | |||
149 | strcpy(self->name, name); | ||
150 | strcpy(self->path, path); | ||
151 | self->hash = crc32(self->name, strlen(name)); | ||
152 | |||
153 | return self; | ||
154 | |||
155 | out_failure: | ||
156 | if (self) { | ||
157 | if (self->name) | ||
158 | free(self->name); | ||
159 | if (self->path) | ||
160 | free(self->path); | ||
161 | free(self); | ||
162 | } | ||
163 | |||
164 | return NULL; | ||
165 | } | ||
166 | |||
167 | /* module methods */ | ||
168 | |||
169 | struct mod_dso *mod_dso__new_dso(const char *name) | ||
170 | { | ||
171 | struct mod_dso *self = malloc(sizeof(*self) + strlen(name) + 1); | ||
172 | |||
173 | if (self != NULL) { | ||
174 | strcpy(self->name, name); | ||
175 | self->mods = RB_ROOT; | ||
176 | self->find_module = mod_dso__find_module; | ||
177 | } | ||
178 | |||
179 | return self; | ||
180 | } | ||
181 | |||
182 | static void mod_dso__delete_module(struct module *self) | ||
183 | { | ||
184 | free(((void *)self)); | ||
185 | } | ||
186 | |||
187 | void mod_dso__delete_modules(struct mod_dso *self) | ||
188 | { | ||
189 | struct module *pos; | ||
190 | struct rb_node *next = rb_first(&self->mods); | ||
191 | |||
192 | while (next) { | ||
193 | pos = rb_entry(next, struct module, rb_node); | ||
194 | next = rb_next(&pos->rb_node); | ||
195 | rb_erase(&pos->rb_node, &self->mods); | ||
196 | mod_dso__delete_module(pos); | ||
197 | } | ||
198 | } | ||
199 | |||
200 | void mod_dso__delete_self(struct mod_dso *self) | ||
201 | { | ||
202 | mod_dso__delete_modules(self); | ||
203 | free(self); | ||
204 | } | ||
205 | |||
206 | static void mod_dso__insert_module(struct mod_dso *self, struct module *mod) | ||
207 | { | ||
208 | struct rb_node **p = &self->mods.rb_node; | ||
209 | struct rb_node *parent = NULL; | ||
210 | const u64 hash = mod->hash; | ||
211 | struct module *m; | ||
212 | |||
213 | while (*p != NULL) { | ||
214 | parent = *p; | ||
215 | m = rb_entry(parent, struct module, rb_node); | ||
216 | if (hash < m->hash) | ||
217 | p = &(*p)->rb_left; | ||
218 | else | ||
219 | p = &(*p)->rb_right; | ||
220 | } | ||
221 | rb_link_node(&mod->rb_node, parent, p); | ||
222 | rb_insert_color(&mod->rb_node, &self->mods); | ||
223 | } | ||
224 | |||
225 | struct module *mod_dso__find_module(struct mod_dso *self, const char *name) | ||
226 | { | ||
227 | struct rb_node *n; | ||
228 | u64 hash; | ||
229 | int len; | ||
230 | |||
231 | if (self == NULL) | ||
232 | return NULL; | ||
233 | |||
234 | len = strlen(name); | ||
235 | hash = crc32(name, len); | ||
236 | |||
237 | n = self->mods.rb_node; | ||
238 | |||
239 | while (n) { | ||
240 | struct module *m = rb_entry(n, struct module, rb_node); | ||
241 | |||
242 | if (hash < m->hash) | ||
243 | n = n->rb_left; | ||
244 | else if (hash > m->hash) | ||
245 | n = n->rb_right; | ||
246 | else { | ||
247 | if (!strcmp(name, m->name)) | ||
248 | return m; | ||
249 | else | ||
250 | n = rb_next(&m->rb_node); | ||
251 | } | ||
252 | } | ||
253 | |||
254 | return NULL; | ||
255 | } | ||
256 | |||
257 | static size_t mod_dso__fprintf_module(struct module *self, FILE *fp) | ||
258 | { | ||
259 | return fprintf(fp, "name:%s path:%s\n", self->name, self->path); | ||
260 | } | ||
261 | |||
262 | size_t mod_dso__fprintf(struct mod_dso *self, FILE *fp) | ||
263 | { | ||
264 | struct rb_node *nd; | ||
265 | size_t ret; | ||
266 | |||
267 | ret = fprintf(fp, "dso: %s\n", self->name); | ||
268 | |||
269 | for (nd = rb_first(&self->mods); nd; nd = rb_next(nd)) { | ||
270 | struct module *pos = rb_entry(nd, struct module, rb_node); | ||
271 | |||
272 | ret += mod_dso__fprintf_module(pos, fp); | ||
273 | } | ||
274 | |||
275 | return ret; | ||
276 | } | ||
277 | |||
278 | static struct module *module__new(const char *name, const char *path) | ||
279 | { | ||
280 | struct module *self = calloc(1, sizeof(*self)); | ||
281 | |||
282 | if (!self) | ||
283 | goto out_failure; | ||
284 | |||
285 | self->name = calloc(1, strlen(name) + 1); | ||
286 | if (!self->name) | ||
287 | goto out_failure; | ||
288 | |||
289 | self->path = calloc(1, strlen(path) + 1); | ||
290 | if (!self->path) | ||
291 | goto out_failure; | ||
292 | |||
293 | strcpy(self->name, name); | ||
294 | strcpy(self->path, path); | ||
295 | self->hash = crc32(self->name, strlen(name)); | ||
296 | |||
297 | return self; | ||
298 | |||
299 | out_failure: | ||
300 | if (self) { | ||
301 | if (self->name) | ||
302 | free(self->name); | ||
303 | if (self->path) | ||
304 | free(self->path); | ||
305 | free(self); | ||
306 | } | ||
307 | |||
308 | return NULL; | ||
309 | } | ||
310 | |||
311 | static int mod_dso__load_sections(struct module *mod) | ||
312 | { | ||
313 | int count = 0, path_len; | ||
314 | struct dirent *entry; | ||
315 | char *line = NULL; | ||
316 | char *dir_path; | ||
317 | DIR *dir; | ||
318 | size_t n; | ||
319 | |||
320 | path_len = strlen("/sys/module/"); | ||
321 | path_len += strlen(mod->name); | ||
322 | path_len += strlen("/sections/"); | ||
323 | |||
324 | dir_path = calloc(1, path_len + 1); | ||
325 | if (dir_path == NULL) | ||
326 | goto out_failure; | ||
327 | |||
328 | strcat(dir_path, "/sys/module/"); | ||
329 | strcat(dir_path, mod->name); | ||
330 | strcat(dir_path, "/sections/"); | ||
331 | |||
332 | dir = opendir(dir_path); | ||
333 | if (dir == NULL) | ||
334 | goto out_free; | ||
335 | |||
336 | while ((entry = readdir(dir))) { | ||
337 | struct section *section; | ||
338 | char *path, *vma; | ||
339 | int line_len; | ||
340 | FILE *file; | ||
341 | |||
342 | if (!strcmp(".", entry->d_name) || !strcmp("..", entry->d_name)) | ||
343 | continue; | ||
344 | |||
345 | path = calloc(1, path_len + strlen(entry->d_name) + 1); | ||
346 | if (path == NULL) | ||
347 | break; | ||
348 | strcat(path, dir_path); | ||
349 | strcat(path, entry->d_name); | ||
350 | |||
351 | file = fopen(path, "r"); | ||
352 | if (file == NULL) { | ||
353 | free(path); | ||
354 | break; | ||
355 | } | ||
356 | |||
357 | line_len = getline(&line, &n, file); | ||
358 | if (line_len < 0) { | ||
359 | free(path); | ||
360 | fclose(file); | ||
361 | break; | ||
362 | } | ||
363 | |||
364 | if (!line) { | ||
365 | free(path); | ||
366 | fclose(file); | ||
367 | break; | ||
368 | } | ||
369 | |||
370 | line[--line_len] = '\0'; /* \n */ | ||
371 | |||
372 | vma = strstr(line, "0x"); | ||
373 | if (!vma) { | ||
374 | free(path); | ||
375 | fclose(file); | ||
376 | break; | ||
377 | } | ||
378 | vma += 2; | ||
379 | |||
380 | section = section__new(entry->d_name, path); | ||
381 | if (!section) { | ||
382 | fprintf(stderr, "load_sections: allocation error\n"); | ||
383 | free(path); | ||
384 | fclose(file); | ||
385 | break; | ||
386 | } | ||
387 | |||
388 | hex2u64(vma, §ion->vma); | ||
389 | sec_dso__insert_section(mod->sections, section); | ||
390 | |||
391 | free(path); | ||
392 | fclose(file); | ||
393 | count++; | ||
394 | } | ||
395 | |||
396 | closedir(dir); | ||
397 | free(line); | ||
398 | free(dir_path); | ||
399 | |||
400 | return count; | ||
401 | |||
402 | out_free: | ||
403 | free(dir_path); | ||
404 | |||
405 | out_failure: | ||
406 | return count; | ||
407 | } | ||
408 | |||
409 | static int mod_dso__load_module_paths(struct mod_dso *self) | ||
410 | { | ||
411 | struct utsname uts; | ||
412 | int count = 0, len; | ||
413 | char *line = NULL; | ||
414 | FILE *file; | ||
415 | char *path; | ||
416 | size_t n; | ||
417 | |||
418 | if (uname(&uts) < 0) | ||
419 | goto out_failure; | ||
420 | |||
421 | len = strlen("/lib/modules/"); | ||
422 | len += strlen(uts.release); | ||
423 | len += strlen("/modules.dep"); | ||
424 | |||
425 | path = calloc(1, len); | ||
426 | if (path == NULL) | ||
427 | goto out_failure; | ||
428 | |||
429 | strcat(path, "/lib/modules/"); | ||
430 | strcat(path, uts.release); | ||
431 | strcat(path, "/modules.dep"); | ||
432 | |||
433 | file = fopen(path, "r"); | ||
434 | free(path); | ||
435 | if (file == NULL) | ||
436 | goto out_failure; | ||
437 | |||
438 | while (!feof(file)) { | ||
439 | char *path, *name, *tmp; | ||
440 | struct module *module; | ||
441 | int line_len, len; | ||
442 | |||
443 | line_len = getline(&line, &n, file); | ||
444 | if (line_len < 0) | ||
445 | break; | ||
446 | |||
447 | if (!line) | ||
448 | goto out_failure; | ||
449 | |||
450 | line[--line_len] = '\0'; /* \n */ | ||
451 | |||
452 | path = strtok(line, ":"); | ||
453 | if (!path) | ||
454 | goto out_failure; | ||
455 | |||
456 | name = strdup(path); | ||
457 | name = strtok(name, "/"); | ||
458 | |||
459 | tmp = name; | ||
460 | |||
461 | while (tmp) { | ||
462 | tmp = strtok(NULL, "/"); | ||
463 | if (tmp) | ||
464 | name = tmp; | ||
465 | } | ||
466 | name = strsep(&name, "."); | ||
467 | |||
468 | /* Quirk: replace '-' with '_' in sound modules */ | ||
469 | for (len = strlen(name); len; len--) { | ||
470 | if (*(name+len) == '-') | ||
471 | *(name+len) = '_'; | ||
472 | } | ||
473 | |||
474 | module = module__new(name, path); | ||
475 | if (!module) { | ||
476 | fprintf(stderr, "load_module_paths: allocation error\n"); | ||
477 | goto out_failure; | ||
478 | } | ||
479 | mod_dso__insert_module(self, module); | ||
480 | |||
481 | module->sections = sec_dso__new_dso("sections"); | ||
482 | if (!module->sections) { | ||
483 | fprintf(stderr, "load_module_paths: allocation error\n"); | ||
484 | goto out_failure; | ||
485 | } | ||
486 | |||
487 | module->active = mod_dso__load_sections(module); | ||
488 | |||
489 | if (module->active > 0) | ||
490 | count++; | ||
491 | } | ||
492 | |||
493 | free(line); | ||
494 | fclose(file); | ||
495 | |||
496 | return count; | ||
497 | |||
498 | out_failure: | ||
499 | return -1; | ||
500 | } | ||
501 | |||
502 | int mod_dso__load_modules(struct mod_dso *dso) | ||
503 | { | ||
504 | int err; | ||
505 | |||
506 | err = mod_dso__load_module_paths(dso); | ||
507 | |||
508 | return err; | ||
509 | } | ||
diff --git a/tools/perf/util/module.h b/tools/perf/util/module.h new file mode 100644 index 000000000000..8a592ef641ca --- /dev/null +++ b/tools/perf/util/module.h | |||
@@ -0,0 +1,53 @@ | |||
1 | #ifndef _PERF_MODULE_ | ||
2 | #define _PERF_MODULE_ 1 | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | #include "../types.h" | ||
6 | #include <linux/list.h> | ||
7 | #include <linux/rbtree.h> | ||
8 | |||
9 | struct section { | ||
10 | struct rb_node rb_node; | ||
11 | u64 hash; | ||
12 | u64 vma; | ||
13 | char *name; | ||
14 | char *path; | ||
15 | }; | ||
16 | |||
17 | struct sec_dso { | ||
18 | struct list_head node; | ||
19 | struct rb_root secs; | ||
20 | struct section *(*find_section)(struct sec_dso *, const char *name); | ||
21 | char name[0]; | ||
22 | }; | ||
23 | |||
24 | struct module { | ||
25 | struct rb_node rb_node; | ||
26 | u64 hash; | ||
27 | char *name; | ||
28 | char *path; | ||
29 | struct sec_dso *sections; | ||
30 | int active; | ||
31 | }; | ||
32 | |||
33 | struct mod_dso { | ||
34 | struct list_head node; | ||
35 | struct rb_root mods; | ||
36 | struct module *(*find_module)(struct mod_dso *, const char *name); | ||
37 | char name[0]; | ||
38 | }; | ||
39 | |||
40 | struct sec_dso *sec_dso__new_dso(const char *name); | ||
41 | void sec_dso__delete_sections(struct sec_dso *self); | ||
42 | void sec_dso__delete_self(struct sec_dso *self); | ||
43 | size_t sec_dso__fprintf(struct sec_dso *self, FILE *fp); | ||
44 | struct section *sec_dso__find_section(struct sec_dso *self, const char *name); | ||
45 | |||
46 | struct mod_dso *mod_dso__new_dso(const char *name); | ||
47 | void mod_dso__delete_modules(struct mod_dso *self); | ||
48 | void mod_dso__delete_self(struct mod_dso *self); | ||
49 | size_t mod_dso__fprintf(struct mod_dso *self, FILE *fp); | ||
50 | struct module *mod_dso__find_module(struct mod_dso *self, const char *name); | ||
51 | int mod_dso__load_modules(struct mod_dso *dso); | ||
52 | |||
53 | #endif /* _PERF_MODULE_ */ | ||
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 4d042f104cdc..5184959e0615 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
@@ -184,16 +184,20 @@ char *event_name(int counter) | |||
184 | return "unknown"; | 184 | return "unknown"; |
185 | } | 185 | } |
186 | 186 | ||
187 | static int parse_aliases(const char *str, char *names[][MAX_ALIASES], int size) | 187 | static int parse_aliases(const char **str, char *names[][MAX_ALIASES], int size) |
188 | { | 188 | { |
189 | int i, j; | 189 | int i, j; |
190 | int n, longest = -1; | ||
190 | 191 | ||
191 | for (i = 0; i < size; i++) { | 192 | for (i = 0; i < size; i++) { |
192 | for (j = 0; j < MAX_ALIASES; j++) { | 193 | for (j = 0; j < MAX_ALIASES && names[i][j]; j++) { |
193 | if (!names[i][j]) | 194 | n = strlen(names[i][j]); |
194 | break; | 195 | if (n > longest && !strncasecmp(*str, names[i][j], n)) |
195 | if (strcasestr(str, names[i][j])) | 196 | longest = n; |
196 | return i; | 197 | } |
198 | if (longest > 0) { | ||
199 | *str += longest; | ||
200 | return i; | ||
197 | } | 201 | } |
198 | } | 202 | } |
199 | 203 | ||
@@ -201,30 +205,53 @@ static int parse_aliases(const char *str, char *names[][MAX_ALIASES], int size) | |||
201 | } | 205 | } |
202 | 206 | ||
203 | static int | 207 | static int |
204 | parse_generic_hw_symbols(const char *str, struct perf_counter_attr *attr) | 208 | parse_generic_hw_event(const char **str, struct perf_counter_attr *attr) |
205 | { | 209 | { |
206 | int cache_type = -1, cache_op = 0, cache_result = 0; | 210 | const char *s = *str; |
211 | int cache_type = -1, cache_op = -1, cache_result = -1; | ||
207 | 212 | ||
208 | cache_type = parse_aliases(str, hw_cache, PERF_COUNT_HW_CACHE_MAX); | 213 | cache_type = parse_aliases(&s, hw_cache, PERF_COUNT_HW_CACHE_MAX); |
209 | /* | 214 | /* |
210 | * No fallback - if we cannot get a clear cache type | 215 | * No fallback - if we cannot get a clear cache type |
211 | * then bail out: | 216 | * then bail out: |
212 | */ | 217 | */ |
213 | if (cache_type == -1) | 218 | if (cache_type == -1) |
214 | return -EINVAL; | 219 | return 0; |
220 | |||
221 | while ((cache_op == -1 || cache_result == -1) && *s == '-') { | ||
222 | ++s; | ||
223 | |||
224 | if (cache_op == -1) { | ||
225 | cache_op = parse_aliases(&s, hw_cache_op, | ||
226 | PERF_COUNT_HW_CACHE_OP_MAX); | ||
227 | if (cache_op >= 0) { | ||
228 | if (!is_cache_op_valid(cache_type, cache_op)) | ||
229 | return 0; | ||
230 | continue; | ||
231 | } | ||
232 | } | ||
233 | |||
234 | if (cache_result == -1) { | ||
235 | cache_result = parse_aliases(&s, hw_cache_result, | ||
236 | PERF_COUNT_HW_CACHE_RESULT_MAX); | ||
237 | if (cache_result >= 0) | ||
238 | continue; | ||
239 | } | ||
240 | |||
241 | /* | ||
242 | * Can't parse this as a cache op or result, so back up | ||
243 | * to the '-'. | ||
244 | */ | ||
245 | --s; | ||
246 | break; | ||
247 | } | ||
215 | 248 | ||
216 | cache_op = parse_aliases(str, hw_cache_op, PERF_COUNT_HW_CACHE_OP_MAX); | ||
217 | /* | 249 | /* |
218 | * Fall back to reads: | 250 | * Fall back to reads: |
219 | */ | 251 | */ |
220 | if (cache_op == -1) | 252 | if (cache_op == -1) |
221 | cache_op = PERF_COUNT_HW_CACHE_OP_READ; | 253 | cache_op = PERF_COUNT_HW_CACHE_OP_READ; |
222 | 254 | ||
223 | if (!is_cache_op_valid(cache_type, cache_op)) | ||
224 | return -EINVAL; | ||
225 | |||
226 | cache_result = parse_aliases(str, hw_cache_result, | ||
227 | PERF_COUNT_HW_CACHE_RESULT_MAX); | ||
228 | /* | 255 | /* |
229 | * Fall back to accesses: | 256 | * Fall back to accesses: |
230 | */ | 257 | */ |
@@ -234,93 +261,154 @@ parse_generic_hw_symbols(const char *str, struct perf_counter_attr *attr) | |||
234 | attr->config = cache_type | (cache_op << 8) | (cache_result << 16); | 261 | attr->config = cache_type | (cache_op << 8) | (cache_result << 16); |
235 | attr->type = PERF_TYPE_HW_CACHE; | 262 | attr->type = PERF_TYPE_HW_CACHE; |
236 | 263 | ||
237 | return 0; | 264 | *str = s; |
265 | return 1; | ||
238 | } | 266 | } |
239 | 267 | ||
240 | static int check_events(const char *str, unsigned int i) | 268 | static int check_events(const char *str, unsigned int i) |
241 | { | 269 | { |
242 | if (!strncmp(str, event_symbols[i].symbol, | 270 | int n; |
243 | strlen(event_symbols[i].symbol))) | ||
244 | return 1; | ||
245 | 271 | ||
246 | if (strlen(event_symbols[i].alias)) | 272 | n = strlen(event_symbols[i].symbol); |
247 | if (!strncmp(str, event_symbols[i].alias, | 273 | if (!strncmp(str, event_symbols[i].symbol, n)) |
248 | strlen(event_symbols[i].alias))) | 274 | return n; |
249 | return 1; | 275 | |
276 | n = strlen(event_symbols[i].alias); | ||
277 | if (n) | ||
278 | if (!strncmp(str, event_symbols[i].alias, n)) | ||
279 | return n; | ||
250 | return 0; | 280 | return 0; |
251 | } | 281 | } |
252 | 282 | ||
253 | /* | 283 | static int |
254 | * Each event can have multiple symbolic names. | 284 | parse_symbolic_event(const char **strp, struct perf_counter_attr *attr) |
255 | * Symbolic names are (almost) exactly matched. | ||
256 | */ | ||
257 | static int parse_event_symbols(const char *str, struct perf_counter_attr *attr) | ||
258 | { | 285 | { |
259 | u64 config, id; | 286 | const char *str = *strp; |
260 | int type; | ||
261 | unsigned int i; | 287 | unsigned int i; |
262 | const char *sep, *pstr; | 288 | int n; |
263 | 289 | ||
264 | if (str[0] == 'r' && hex2u64(str + 1, &config) > 0) { | 290 | for (i = 0; i < ARRAY_SIZE(event_symbols); i++) { |
265 | attr->type = PERF_TYPE_RAW; | 291 | n = check_events(str, i); |
266 | attr->config = config; | 292 | if (n > 0) { |
293 | attr->type = event_symbols[i].type; | ||
294 | attr->config = event_symbols[i].config; | ||
295 | *strp = str + n; | ||
296 | return 1; | ||
297 | } | ||
298 | } | ||
299 | return 0; | ||
300 | } | ||
267 | 301 | ||
302 | static int parse_raw_event(const char **strp, struct perf_counter_attr *attr) | ||
303 | { | ||
304 | const char *str = *strp; | ||
305 | u64 config; | ||
306 | int n; | ||
307 | |||
308 | if (*str != 'r') | ||
268 | return 0; | 309 | return 0; |
310 | n = hex2u64(str + 1, &config); | ||
311 | if (n > 0) { | ||
312 | *strp = str + n + 1; | ||
313 | attr->type = PERF_TYPE_RAW; | ||
314 | attr->config = config; | ||
315 | return 1; | ||
269 | } | 316 | } |
317 | return 0; | ||
318 | } | ||
270 | 319 | ||
271 | pstr = str; | 320 | static int |
272 | sep = strchr(pstr, ':'); | 321 | parse_numeric_event(const char **strp, struct perf_counter_attr *attr) |
273 | if (sep) { | 322 | { |
274 | type = atoi(pstr); | 323 | const char *str = *strp; |
275 | pstr = sep + 1; | 324 | char *endp; |
276 | id = atoi(pstr); | 325 | unsigned long type; |
277 | sep = strchr(pstr, ':'); | 326 | u64 config; |
278 | if (sep) { | 327 | |
279 | pstr = sep + 1; | 328 | type = strtoul(str, &endp, 0); |
280 | if (strchr(pstr, 'k')) | 329 | if (endp > str && type < PERF_TYPE_MAX && *endp == ':') { |
281 | attr->exclude_user = 1; | 330 | str = endp + 1; |
282 | if (strchr(pstr, 'u')) | 331 | config = strtoul(str, &endp, 0); |
283 | attr->exclude_kernel = 1; | 332 | if (endp > str) { |
333 | attr->type = type; | ||
334 | attr->config = config; | ||
335 | *strp = endp; | ||
336 | return 1; | ||
284 | } | 337 | } |
285 | attr->type = type; | 338 | } |
286 | attr->config = id; | 339 | return 0; |
340 | } | ||
287 | 341 | ||
342 | static int | ||
343 | parse_event_modifier(const char **strp, struct perf_counter_attr *attr) | ||
344 | { | ||
345 | const char *str = *strp; | ||
346 | int eu = 1, ek = 1, eh = 1; | ||
347 | |||
348 | if (*str++ != ':') | ||
288 | return 0; | 349 | return 0; |
350 | while (*str) { | ||
351 | if (*str == 'u') | ||
352 | eu = 0; | ||
353 | else if (*str == 'k') | ||
354 | ek = 0; | ||
355 | else if (*str == 'h') | ||
356 | eh = 0; | ||
357 | else | ||
358 | break; | ||
359 | ++str; | ||
289 | } | 360 | } |
361 | if (str >= *strp + 2) { | ||
362 | *strp = str; | ||
363 | attr->exclude_user = eu; | ||
364 | attr->exclude_kernel = ek; | ||
365 | attr->exclude_hv = eh; | ||
366 | return 1; | ||
367 | } | ||
368 | return 0; | ||
369 | } | ||
290 | 370 | ||
291 | for (i = 0; i < ARRAY_SIZE(event_symbols); i++) { | 371 | /* |
292 | if (check_events(str, i)) { | 372 | * Each event can have multiple symbolic names. |
293 | attr->type = event_symbols[i].type; | 373 | * Symbolic names are (almost) exactly matched. |
294 | attr->config = event_symbols[i].config; | 374 | */ |
375 | static int parse_event_symbols(const char **str, struct perf_counter_attr *attr) | ||
376 | { | ||
377 | if (!(parse_raw_event(str, attr) || | ||
378 | parse_numeric_event(str, attr) || | ||
379 | parse_symbolic_event(str, attr) || | ||
380 | parse_generic_hw_event(str, attr))) | ||
381 | return 0; | ||
295 | 382 | ||
296 | return 0; | 383 | parse_event_modifier(str, attr); |
297 | } | ||
298 | } | ||
299 | 384 | ||
300 | return parse_generic_hw_symbols(str, attr); | 385 | return 1; |
301 | } | 386 | } |
302 | 387 | ||
303 | int parse_events(const struct option *opt, const char *str, int unset) | 388 | int parse_events(const struct option *opt __used, const char *str, int unset __used) |
304 | { | 389 | { |
305 | struct perf_counter_attr attr; | 390 | struct perf_counter_attr attr; |
306 | int ret; | ||
307 | 391 | ||
308 | memset(&attr, 0, sizeof(attr)); | 392 | for (;;) { |
309 | again: | 393 | if (nr_counters == MAX_COUNTERS) |
310 | if (nr_counters == MAX_COUNTERS) | 394 | return -1; |
311 | return -1; | 395 | |
396 | memset(&attr, 0, sizeof(attr)); | ||
397 | if (!parse_event_symbols(&str, &attr)) | ||
398 | return -1; | ||
312 | 399 | ||
313 | ret = parse_event_symbols(str, &attr); | 400 | if (!(*str == 0 || *str == ',' || isspace(*str))) |
314 | if (ret < 0) | 401 | return -1; |
315 | return ret; | ||
316 | 402 | ||
317 | attrs[nr_counters] = attr; | 403 | attrs[nr_counters] = attr; |
318 | nr_counters++; | 404 | nr_counters++; |
319 | 405 | ||
320 | str = strstr(str, ","); | 406 | if (*str == 0) |
321 | if (str) { | 407 | break; |
322 | str++; | 408 | if (*str == ',') |
323 | goto again; | 409 | ++str; |
410 | while (isspace(*str)) | ||
411 | ++str; | ||
324 | } | 412 | } |
325 | 413 | ||
326 | return 0; | 414 | return 0; |
@@ -340,7 +428,7 @@ static const char * const event_type_descriptors[] = { | |||
340 | void print_events(void) | 428 | void print_events(void) |
341 | { | 429 | { |
342 | struct event_symbol *syms = event_symbols; | 430 | struct event_symbol *syms = event_symbols; |
343 | unsigned int i, type, prev_type = -1; | 431 | unsigned int i, type, op, prev_type = -1; |
344 | char name[40]; | 432 | char name[40]; |
345 | 433 | ||
346 | fprintf(stderr, "\n"); | 434 | fprintf(stderr, "\n"); |
@@ -365,6 +453,21 @@ void print_events(void) | |||
365 | } | 453 | } |
366 | 454 | ||
367 | fprintf(stderr, "\n"); | 455 | fprintf(stderr, "\n"); |
456 | for (type = 0; type < PERF_COUNT_HW_CACHE_MAX; type++) { | ||
457 | for (op = 0; op < PERF_COUNT_HW_CACHE_OP_MAX; op++) { | ||
458 | /* skip invalid cache type */ | ||
459 | if (!is_cache_op_valid(type, op)) | ||
460 | continue; | ||
461 | |||
462 | for (i = 0; i < PERF_COUNT_HW_CACHE_RESULT_MAX; i++) { | ||
463 | fprintf(stderr, " %-40s [%s]\n", | ||
464 | event_cache_name(type, op, i), | ||
465 | event_type_descriptors[4]); | ||
466 | } | ||
467 | } | ||
468 | } | ||
469 | |||
470 | fprintf(stderr, "\n"); | ||
368 | fprintf(stderr, " %-40s [raw hardware event descriptor]\n", | 471 | fprintf(stderr, " %-40s [raw hardware event descriptor]\n", |
369 | "rNNN"); | 472 | "rNNN"); |
370 | fprintf(stderr, "\n"); | 473 | fprintf(stderr, "\n"); |
diff --git a/tools/perf/util/parse-options.c b/tools/perf/util/parse-options.c index b3affb1658d2..1bf67190c820 100644 --- a/tools/perf/util/parse-options.c +++ b/tools/perf/util/parse-options.c | |||
@@ -20,7 +20,8 @@ static int get_arg(struct parse_opt_ctx_t *p, const struct option *opt, | |||
20 | if (p->opt) { | 20 | if (p->opt) { |
21 | *arg = p->opt; | 21 | *arg = p->opt; |
22 | p->opt = NULL; | 22 | p->opt = NULL; |
23 | } else if (p->argc == 1 && (opt->flags & PARSE_OPT_LASTARG_DEFAULT)) { | 23 | } else if ((opt->flags & PARSE_OPT_LASTARG_DEFAULT) && (p->argc == 1 || |
24 | **(p->argv + 1) == '-')) { | ||
24 | *arg = (const char *)opt->defval; | 25 | *arg = (const char *)opt->defval; |
25 | } else if (p->argc > 1) { | 26 | } else if (p->argc > 1) { |
26 | p->argc--; | 27 | p->argc--; |
@@ -485,7 +486,7 @@ int parse_options_usage(const char * const *usagestr, | |||
485 | } | 486 | } |
486 | 487 | ||
487 | 488 | ||
488 | int parse_opt_verbosity_cb(const struct option *opt, const char *arg, | 489 | int parse_opt_verbosity_cb(const struct option *opt, const char *arg __used, |
489 | int unset) | 490 | int unset) |
490 | { | 491 | { |
491 | int *target = opt->value; | 492 | int *target = opt->value; |
diff --git a/tools/perf/util/parse-options.h b/tools/perf/util/parse-options.h index a1039a6ce0eb..8aa3464c7090 100644 --- a/tools/perf/util/parse-options.h +++ b/tools/perf/util/parse-options.h | |||
@@ -90,21 +90,22 @@ struct option { | |||
90 | intptr_t defval; | 90 | intptr_t defval; |
91 | }; | 91 | }; |
92 | 92 | ||
93 | #define OPT_END() { OPTION_END } | 93 | #define OPT_END() { .type = OPTION_END } |
94 | #define OPT_ARGUMENT(l, h) { OPTION_ARGUMENT, 0, (l), NULL, NULL, (h) } | 94 | #define OPT_ARGUMENT(l, h) { .type = OPTION_ARGUMENT, .long_name = (l), .help = (h) } |
95 | #define OPT_GROUP(h) { OPTION_GROUP, 0, NULL, NULL, NULL, (h) } | 95 | #define OPT_GROUP(h) { .type = OPTION_GROUP, .help = (h) } |
96 | #define OPT_BIT(s, l, v, h, b) { OPTION_BIT, (s), (l), (v), NULL, (h), 0, NULL, (b) } | 96 | #define OPT_BIT(s, l, v, h, b) { .type = OPTION_BIT, .short_name = (s), .long_name = (l), .value = (v), .help = (h), .defval = (b) } |
97 | #define OPT_BOOLEAN(s, l, v, h) { OPTION_BOOLEAN, (s), (l), (v), NULL, (h) } | 97 | #define OPT_BOOLEAN(s, l, v, h) { .type = OPTION_BOOLEAN, .short_name = (s), .long_name = (l), .value = (v), .help = (h) } |
98 | #define OPT_SET_INT(s, l, v, h, i) { OPTION_SET_INT, (s), (l), (v), NULL, (h), 0, NULL, (i) } | 98 | #define OPT_SET_INT(s, l, v, h, i) { .type = OPTION_SET_INT, .short_name = (s), .long_name = (l), .value = (v), .help = (h), .defval = (i) } |
99 | #define OPT_SET_PTR(s, l, v, h, p) { OPTION_SET_PTR, (s), (l), (v), NULL, (h), 0, NULL, (p) } | 99 | #define OPT_SET_PTR(s, l, v, h, p) { .type = OPTION_SET_PTR, .short_name = (s), .long_name = (l), .value = (v), .help = (h), .defval = (p) } |
100 | #define OPT_INTEGER(s, l, v, h) { OPTION_INTEGER, (s), (l), (v), NULL, (h) } | 100 | #define OPT_INTEGER(s, l, v, h) { .type = OPTION_INTEGER, .short_name = (s), .long_name = (l), .value = (v), .help = (h) } |
101 | #define OPT_LONG(s, l, v, h) { OPTION_LONG, (s), (l), (v), NULL, (h) } | 101 | #define OPT_LONG(s, l, v, h) { .type = OPTION_LONG, .short_name = (s), .long_name = (l), .value = (v), .help = (h) } |
102 | #define OPT_STRING(s, l, v, a, h) { OPTION_STRING, (s), (l), (v), (a), (h) } | 102 | #define OPT_STRING(s, l, v, a, h) { .type = OPTION_STRING, .short_name = (s), .long_name = (l), .value = (v), (a), .help = (h) } |
103 | #define OPT_DATE(s, l, v, h) \ | 103 | #define OPT_DATE(s, l, v, h) \ |
104 | { OPTION_CALLBACK, (s), (l), (v), "time",(h), 0, \ | 104 | { .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), .value = (v), .argh = "time", .help = (h), .callback = parse_opt_approxidate_cb } |
105 | parse_opt_approxidate_cb } | ||
106 | #define OPT_CALLBACK(s, l, v, a, h, f) \ | 105 | #define OPT_CALLBACK(s, l, v, a, h, f) \ |
107 | { OPTION_CALLBACK, (s), (l), (v), (a), (h), 0, (f) } | 106 | { .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), .value = (v), (a), .help = (h), .callback = (f) } |
107 | #define OPT_CALLBACK_DEFAULT(s, l, v, a, h, f, d) \ | ||
108 | { .type = OPTION_CALLBACK, .short_name = (s), .long_name = (l), .value = (v), (a), .help = (h), .callback = (f), .defval = (intptr_t)d, .flags = PARSE_OPT_LASTARG_DEFAULT } | ||
108 | 109 | ||
109 | /* parse_options() will filter out the processed options and leave the | 110 | /* parse_options() will filter out the processed options and leave the |
110 | * non-option argments in argv[]. | 111 | * non-option argments in argv[]. |
diff --git a/tools/perf/util/quote.c b/tools/perf/util/quote.c index f18c5212bc92..c6e5dc0dc82f 100644 --- a/tools/perf/util/quote.c +++ b/tools/perf/util/quote.c | |||
@@ -162,12 +162,16 @@ static inline int sq_must_quote(char c) | |||
162 | return sq_lookup[(unsigned char)c] + quote_path_fully > 0; | 162 | return sq_lookup[(unsigned char)c] + quote_path_fully > 0; |
163 | } | 163 | } |
164 | 164 | ||
165 | /* returns the longest prefix not needing a quote up to maxlen if positive. | 165 | /* |
166 | This stops at the first \0 because it's marked as a character needing an | 166 | * Returns the longest prefix not needing a quote up to maxlen if |
167 | escape */ | 167 | * positive. |
168 | static size_t next_quote_pos(const char *s, ssize_t maxlen) | 168 | * This stops at the first \0 because it's marked as a character |
169 | * needing an escape. | ||
170 | */ | ||
171 | static ssize_t next_quote_pos(const char *s, ssize_t maxlen) | ||
169 | { | 172 | { |
170 | size_t len; | 173 | ssize_t len; |
174 | |||
171 | if (maxlen < 0) { | 175 | if (maxlen < 0) { |
172 | for (len = 0; !sq_must_quote(s[len]); len++); | 176 | for (len = 0; !sq_must_quote(s[len]); len++); |
173 | } else { | 177 | } else { |
@@ -192,22 +196,22 @@ static size_t next_quote_pos(const char *s, ssize_t maxlen) | |||
192 | static size_t quote_c_style_counted(const char *name, ssize_t maxlen, | 196 | static size_t quote_c_style_counted(const char *name, ssize_t maxlen, |
193 | struct strbuf *sb, FILE *fp, int no_dq) | 197 | struct strbuf *sb, FILE *fp, int no_dq) |
194 | { | 198 | { |
195 | #undef EMIT | 199 | #define EMIT(c) \ |
196 | #define EMIT(c) \ | 200 | do { \ |
197 | do { \ | 201 | if (sb) strbuf_addch(sb, (c)); \ |
198 | if (sb) strbuf_addch(sb, (c)); \ | 202 | if (fp) fputc((c), fp); \ |
199 | if (fp) fputc((c), fp); \ | 203 | count++; \ |
200 | count++; \ | ||
201 | } while (0) | 204 | } while (0) |
202 | #define EMITBUF(s, l) \ | 205 | |
203 | do { \ | 206 | #define EMITBUF(s, l) \ |
204 | int __ret; \ | 207 | do { \ |
205 | if (sb) strbuf_add(sb, (s), (l)); \ | 208 | int __ret; \ |
206 | if (fp) __ret = fwrite((s), (l), 1, fp); \ | 209 | if (sb) strbuf_add(sb, (s), (l)); \ |
207 | count += (l); \ | 210 | if (fp) __ret = fwrite((s), (l), 1, fp); \ |
211 | count += (l); \ | ||
208 | } while (0) | 212 | } while (0) |
209 | 213 | ||
210 | size_t len, count = 0; | 214 | ssize_t len, count = 0; |
211 | const char *p = name; | 215 | const char *p = name; |
212 | 216 | ||
213 | for (;;) { | 217 | for (;;) { |
@@ -273,8 +277,8 @@ void write_name_quoted(const char *name, FILE *fp, int terminator) | |||
273 | fputc(terminator, fp); | 277 | fputc(terminator, fp); |
274 | } | 278 | } |
275 | 279 | ||
276 | extern void write_name_quotedpfx(const char *pfx, size_t pfxlen, | 280 | void write_name_quotedpfx(const char *pfx, ssize_t pfxlen, |
277 | const char *name, FILE *fp, int terminator) | 281 | const char *name, FILE *fp, int terminator) |
278 | { | 282 | { |
279 | int needquote = 0; | 283 | int needquote = 0; |
280 | 284 | ||
@@ -306,7 +310,7 @@ char *quote_path_relative(const char *in, int len, | |||
306 | len = strlen(in); | 310 | len = strlen(in); |
307 | 311 | ||
308 | /* "../" prefix itself does not need quoting, but "in" might. */ | 312 | /* "../" prefix itself does not need quoting, but "in" might. */ |
309 | needquote = next_quote_pos(in, len) < len; | 313 | needquote = (next_quote_pos(in, len) < len); |
310 | strbuf_setlen(out, 0); | 314 | strbuf_setlen(out, 0); |
311 | strbuf_grow(out, len); | 315 | strbuf_grow(out, len); |
312 | 316 | ||
diff --git a/tools/perf/util/quote.h b/tools/perf/util/quote.h index 5dfad89816db..a5454a1d1c13 100644 --- a/tools/perf/util/quote.h +++ b/tools/perf/util/quote.h | |||
@@ -53,7 +53,7 @@ extern size_t quote_c_style(const char *name, struct strbuf *, FILE *, int no_dq | |||
53 | extern void quote_two_c_style(struct strbuf *, const char *, const char *, int); | 53 | extern void quote_two_c_style(struct strbuf *, const char *, const char *, int); |
54 | 54 | ||
55 | extern void write_name_quoted(const char *name, FILE *, int terminator); | 55 | extern void write_name_quoted(const char *name, FILE *, int terminator); |
56 | extern void write_name_quotedpfx(const char *pfx, size_t pfxlen, | 56 | extern void write_name_quotedpfx(const char *pfx, ssize_t pfxlen, |
57 | const char *name, FILE *, int terminator); | 57 | const char *name, FILE *, int terminator); |
58 | 58 | ||
59 | /* quote path as relative to the given prefix */ | 59 | /* quote path as relative to the given prefix */ |
diff --git a/tools/perf/util/rbtree.c b/tools/perf/util/rbtree.c deleted file mode 100644 index b15ba9c7cb3f..000000000000 --- a/tools/perf/util/rbtree.c +++ /dev/null | |||
@@ -1,383 +0,0 @@ | |||
1 | /* | ||
2 | Red Black Trees | ||
3 | (C) 1999 Andrea Arcangeli <andrea@suse.de> | ||
4 | (C) 2002 David Woodhouse <dwmw2@infradead.org> | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published by | ||
8 | the Free Software Foundation; either version 2 of the License, or | ||
9 | (at your option) any later version. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | |||
20 | linux/lib/rbtree.c | ||
21 | */ | ||
22 | |||
23 | #include "rbtree.h" | ||
24 | |||
25 | static void __rb_rotate_left(struct rb_node *node, struct rb_root *root) | ||
26 | { | ||
27 | struct rb_node *right = node->rb_right; | ||
28 | struct rb_node *parent = rb_parent(node); | ||
29 | |||
30 | if ((node->rb_right = right->rb_left)) | ||
31 | rb_set_parent(right->rb_left, node); | ||
32 | right->rb_left = node; | ||
33 | |||
34 | rb_set_parent(right, parent); | ||
35 | |||
36 | if (parent) | ||
37 | { | ||
38 | if (node == parent->rb_left) | ||
39 | parent->rb_left = right; | ||
40 | else | ||
41 | parent->rb_right = right; | ||
42 | } | ||
43 | else | ||
44 | root->rb_node = right; | ||
45 | rb_set_parent(node, right); | ||
46 | } | ||
47 | |||
48 | static void __rb_rotate_right(struct rb_node *node, struct rb_root *root) | ||
49 | { | ||
50 | struct rb_node *left = node->rb_left; | ||
51 | struct rb_node *parent = rb_parent(node); | ||
52 | |||
53 | if ((node->rb_left = left->rb_right)) | ||
54 | rb_set_parent(left->rb_right, node); | ||
55 | left->rb_right = node; | ||
56 | |||
57 | rb_set_parent(left, parent); | ||
58 | |||
59 | if (parent) | ||
60 | { | ||
61 | if (node == parent->rb_right) | ||
62 | parent->rb_right = left; | ||
63 | else | ||
64 | parent->rb_left = left; | ||
65 | } | ||
66 | else | ||
67 | root->rb_node = left; | ||
68 | rb_set_parent(node, left); | ||
69 | } | ||
70 | |||
71 | void rb_insert_color(struct rb_node *node, struct rb_root *root) | ||
72 | { | ||
73 | struct rb_node *parent, *gparent; | ||
74 | |||
75 | while ((parent = rb_parent(node)) && rb_is_red(parent)) | ||
76 | { | ||
77 | gparent = rb_parent(parent); | ||
78 | |||
79 | if (parent == gparent->rb_left) | ||
80 | { | ||
81 | { | ||
82 | register struct rb_node *uncle = gparent->rb_right; | ||
83 | if (uncle && rb_is_red(uncle)) | ||
84 | { | ||
85 | rb_set_black(uncle); | ||
86 | rb_set_black(parent); | ||
87 | rb_set_red(gparent); | ||
88 | node = gparent; | ||
89 | continue; | ||
90 | } | ||
91 | } | ||
92 | |||
93 | if (parent->rb_right == node) | ||
94 | { | ||
95 | register struct rb_node *tmp; | ||
96 | __rb_rotate_left(parent, root); | ||
97 | tmp = parent; | ||
98 | parent = node; | ||
99 | node = tmp; | ||
100 | } | ||
101 | |||
102 | rb_set_black(parent); | ||
103 | rb_set_red(gparent); | ||
104 | __rb_rotate_right(gparent, root); | ||
105 | } else { | ||
106 | { | ||
107 | register struct rb_node *uncle = gparent->rb_left; | ||
108 | if (uncle && rb_is_red(uncle)) | ||
109 | { | ||
110 | rb_set_black(uncle); | ||
111 | rb_set_black(parent); | ||
112 | rb_set_red(gparent); | ||
113 | node = gparent; | ||
114 | continue; | ||
115 | } | ||
116 | } | ||
117 | |||
118 | if (parent->rb_left == node) | ||
119 | { | ||
120 | register struct rb_node *tmp; | ||
121 | __rb_rotate_right(parent, root); | ||
122 | tmp = parent; | ||
123 | parent = node; | ||
124 | node = tmp; | ||
125 | } | ||
126 | |||
127 | rb_set_black(parent); | ||
128 | rb_set_red(gparent); | ||
129 | __rb_rotate_left(gparent, root); | ||
130 | } | ||
131 | } | ||
132 | |||
133 | rb_set_black(root->rb_node); | ||
134 | } | ||
135 | |||
136 | static void __rb_erase_color(struct rb_node *node, struct rb_node *parent, | ||
137 | struct rb_root *root) | ||
138 | { | ||
139 | struct rb_node *other; | ||
140 | |||
141 | while ((!node || rb_is_black(node)) && node != root->rb_node) | ||
142 | { | ||
143 | if (parent->rb_left == node) | ||
144 | { | ||
145 | other = parent->rb_right; | ||
146 | if (rb_is_red(other)) | ||
147 | { | ||
148 | rb_set_black(other); | ||
149 | rb_set_red(parent); | ||
150 | __rb_rotate_left(parent, root); | ||
151 | other = parent->rb_right; | ||
152 | } | ||
153 | if ((!other->rb_left || rb_is_black(other->rb_left)) && | ||
154 | (!other->rb_right || rb_is_black(other->rb_right))) | ||
155 | { | ||
156 | rb_set_red(other); | ||
157 | node = parent; | ||
158 | parent = rb_parent(node); | ||
159 | } | ||
160 | else | ||
161 | { | ||
162 | if (!other->rb_right || rb_is_black(other->rb_right)) | ||
163 | { | ||
164 | rb_set_black(other->rb_left); | ||
165 | rb_set_red(other); | ||
166 | __rb_rotate_right(other, root); | ||
167 | other = parent->rb_right; | ||
168 | } | ||
169 | rb_set_color(other, rb_color(parent)); | ||
170 | rb_set_black(parent); | ||
171 | rb_set_black(other->rb_right); | ||
172 | __rb_rotate_left(parent, root); | ||
173 | node = root->rb_node; | ||
174 | break; | ||
175 | } | ||
176 | } | ||
177 | else | ||
178 | { | ||
179 | other = parent->rb_left; | ||
180 | if (rb_is_red(other)) | ||
181 | { | ||
182 | rb_set_black(other); | ||
183 | rb_set_red(parent); | ||
184 | __rb_rotate_right(parent, root); | ||
185 | other = parent->rb_left; | ||
186 | } | ||
187 | if ((!other->rb_left || rb_is_black(other->rb_left)) && | ||
188 | (!other->rb_right || rb_is_black(other->rb_right))) | ||
189 | { | ||
190 | rb_set_red(other); | ||
191 | node = parent; | ||
192 | parent = rb_parent(node); | ||
193 | } | ||
194 | else | ||
195 | { | ||
196 | if (!other->rb_left || rb_is_black(other->rb_left)) | ||
197 | { | ||
198 | rb_set_black(other->rb_right); | ||
199 | rb_set_red(other); | ||
200 | __rb_rotate_left(other, root); | ||
201 | other = parent->rb_left; | ||
202 | } | ||
203 | rb_set_color(other, rb_color(parent)); | ||
204 | rb_set_black(parent); | ||
205 | rb_set_black(other->rb_left); | ||
206 | __rb_rotate_right(parent, root); | ||
207 | node = root->rb_node; | ||
208 | break; | ||
209 | } | ||
210 | } | ||
211 | } | ||
212 | if (node) | ||
213 | rb_set_black(node); | ||
214 | } | ||
215 | |||
216 | void rb_erase(struct rb_node *node, struct rb_root *root) | ||
217 | { | ||
218 | struct rb_node *child, *parent; | ||
219 | int color; | ||
220 | |||
221 | if (!node->rb_left) | ||
222 | child = node->rb_right; | ||
223 | else if (!node->rb_right) | ||
224 | child = node->rb_left; | ||
225 | else | ||
226 | { | ||
227 | struct rb_node *old = node, *left; | ||
228 | |||
229 | node = node->rb_right; | ||
230 | while ((left = node->rb_left) != NULL) | ||
231 | node = left; | ||
232 | child = node->rb_right; | ||
233 | parent = rb_parent(node); | ||
234 | color = rb_color(node); | ||
235 | |||
236 | if (child) | ||
237 | rb_set_parent(child, parent); | ||
238 | if (parent == old) { | ||
239 | parent->rb_right = child; | ||
240 | parent = node; | ||
241 | } else | ||
242 | parent->rb_left = child; | ||
243 | |||
244 | node->rb_parent_color = old->rb_parent_color; | ||
245 | node->rb_right = old->rb_right; | ||
246 | node->rb_left = old->rb_left; | ||
247 | |||
248 | if (rb_parent(old)) | ||
249 | { | ||
250 | if (rb_parent(old)->rb_left == old) | ||
251 | rb_parent(old)->rb_left = node; | ||
252 | else | ||
253 | rb_parent(old)->rb_right = node; | ||
254 | } else | ||
255 | root->rb_node = node; | ||
256 | |||
257 | rb_set_parent(old->rb_left, node); | ||
258 | if (old->rb_right) | ||
259 | rb_set_parent(old->rb_right, node); | ||
260 | goto color; | ||
261 | } | ||
262 | |||
263 | parent = rb_parent(node); | ||
264 | color = rb_color(node); | ||
265 | |||
266 | if (child) | ||
267 | rb_set_parent(child, parent); | ||
268 | if (parent) | ||
269 | { | ||
270 | if (parent->rb_left == node) | ||
271 | parent->rb_left = child; | ||
272 | else | ||
273 | parent->rb_right = child; | ||
274 | } | ||
275 | else | ||
276 | root->rb_node = child; | ||
277 | |||
278 | color: | ||
279 | if (color == RB_BLACK) | ||
280 | __rb_erase_color(child, parent, root); | ||
281 | } | ||
282 | |||
283 | /* | ||
284 | * This function returns the first node (in sort order) of the tree. | ||
285 | */ | ||
286 | struct rb_node *rb_first(const struct rb_root *root) | ||
287 | { | ||
288 | struct rb_node *n; | ||
289 | |||
290 | n = root->rb_node; | ||
291 | if (!n) | ||
292 | return NULL; | ||
293 | while (n->rb_left) | ||
294 | n = n->rb_left; | ||
295 | return n; | ||
296 | } | ||
297 | |||
298 | struct rb_node *rb_last(const struct rb_root *root) | ||
299 | { | ||
300 | struct rb_node *n; | ||
301 | |||
302 | n = root->rb_node; | ||
303 | if (!n) | ||
304 | return NULL; | ||
305 | while (n->rb_right) | ||
306 | n = n->rb_right; | ||
307 | return n; | ||
308 | } | ||
309 | |||
310 | struct rb_node *rb_next(const struct rb_node *node) | ||
311 | { | ||
312 | struct rb_node *parent; | ||
313 | |||
314 | if (rb_parent(node) == node) | ||
315 | return NULL; | ||
316 | |||
317 | /* If we have a right-hand child, go down and then left as far | ||
318 | as we can. */ | ||
319 | if (node->rb_right) { | ||
320 | node = node->rb_right; | ||
321 | while (node->rb_left) | ||
322 | node=node->rb_left; | ||
323 | return (struct rb_node *)node; | ||
324 | } | ||
325 | |||
326 | /* No right-hand children. Everything down and left is | ||
327 | smaller than us, so any 'next' node must be in the general | ||
328 | direction of our parent. Go up the tree; any time the | ||
329 | ancestor is a right-hand child of its parent, keep going | ||
330 | up. First time it's a left-hand child of its parent, said | ||
331 | parent is our 'next' node. */ | ||
332 | while ((parent = rb_parent(node)) && node == parent->rb_right) | ||
333 | node = parent; | ||
334 | |||
335 | return parent; | ||
336 | } | ||
337 | |||
338 | struct rb_node *rb_prev(const struct rb_node *node) | ||
339 | { | ||
340 | struct rb_node *parent; | ||
341 | |||
342 | if (rb_parent(node) == node) | ||
343 | return NULL; | ||
344 | |||
345 | /* If we have a left-hand child, go down and then right as far | ||
346 | as we can. */ | ||
347 | if (node->rb_left) { | ||
348 | node = node->rb_left; | ||
349 | while (node->rb_right) | ||
350 | node=node->rb_right; | ||
351 | return (struct rb_node *)node; | ||
352 | } | ||
353 | |||
354 | /* No left-hand children. Go up till we find an ancestor which | ||
355 | is a right-hand child of its parent */ | ||
356 | while ((parent = rb_parent(node)) && node == parent->rb_left) | ||
357 | node = parent; | ||
358 | |||
359 | return parent; | ||
360 | } | ||
361 | |||
362 | void rb_replace_node(struct rb_node *victim, struct rb_node *new, | ||
363 | struct rb_root *root) | ||
364 | { | ||
365 | struct rb_node *parent = rb_parent(victim); | ||
366 | |||
367 | /* Set the surrounding nodes to point to the replacement */ | ||
368 | if (parent) { | ||
369 | if (victim == parent->rb_left) | ||
370 | parent->rb_left = new; | ||
371 | else | ||
372 | parent->rb_right = new; | ||
373 | } else { | ||
374 | root->rb_node = new; | ||
375 | } | ||
376 | if (victim->rb_left) | ||
377 | rb_set_parent(victim->rb_left, new); | ||
378 | if (victim->rb_right) | ||
379 | rb_set_parent(victim->rb_right, new); | ||
380 | |||
381 | /* Copy the pointers/colour from the victim to the replacement */ | ||
382 | *new = *victim; | ||
383 | } | ||
diff --git a/tools/perf/util/rbtree.h b/tools/perf/util/rbtree.h deleted file mode 100644 index 6bdc488a47fb..000000000000 --- a/tools/perf/util/rbtree.h +++ /dev/null | |||
@@ -1,171 +0,0 @@ | |||
1 | /* | ||
2 | Red Black Trees | ||
3 | (C) 1999 Andrea Arcangeli <andrea@suse.de> | ||
4 | |||
5 | This program is free software; you can redistribute it and/or modify | ||
6 | it under the terms of the GNU General Public License as published by | ||
7 | the Free Software Foundation; either version 2 of the License, or | ||
8 | (at your option) any later version. | ||
9 | |||
10 | This program is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | GNU General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU General Public License | ||
16 | along with this program; if not, write to the Free Software | ||
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | |||
19 | linux/include/linux/rbtree.h | ||
20 | |||
21 | To use rbtrees you'll have to implement your own insert and search cores. | ||
22 | This will avoid us to use callbacks and to drop drammatically performances. | ||
23 | I know it's not the cleaner way, but in C (not in C++) to get | ||
24 | performances and genericity... | ||
25 | |||
26 | Some example of insert and search follows here. The search is a plain | ||
27 | normal search over an ordered tree. The insert instead must be implemented | ||
28 | int two steps: as first thing the code must insert the element in | ||
29 | order as a red leaf in the tree, then the support library function | ||
30 | rb_insert_color() must be called. Such function will do the | ||
31 | not trivial work to rebalance the rbtree if necessary. | ||
32 | |||
33 | ----------------------------------------------------------------------- | ||
34 | static inline struct page * rb_search_page_cache(struct inode * inode, | ||
35 | unsigned long offset) | ||
36 | { | ||
37 | struct rb_node * n = inode->i_rb_page_cache.rb_node; | ||
38 | struct page * page; | ||
39 | |||
40 | while (n) | ||
41 | { | ||
42 | page = rb_entry(n, struct page, rb_page_cache); | ||
43 | |||
44 | if (offset < page->offset) | ||
45 | n = n->rb_left; | ||
46 | else if (offset > page->offset) | ||
47 | n = n->rb_right; | ||
48 | else | ||
49 | return page; | ||
50 | } | ||
51 | return NULL; | ||
52 | } | ||
53 | |||
54 | static inline struct page * __rb_insert_page_cache(struct inode * inode, | ||
55 | unsigned long offset, | ||
56 | struct rb_node * node) | ||
57 | { | ||
58 | struct rb_node ** p = &inode->i_rb_page_cache.rb_node; | ||
59 | struct rb_node * parent = NULL; | ||
60 | struct page * page; | ||
61 | |||
62 | while (*p) | ||
63 | { | ||
64 | parent = *p; | ||
65 | page = rb_entry(parent, struct page, rb_page_cache); | ||
66 | |||
67 | if (offset < page->offset) | ||
68 | p = &(*p)->rb_left; | ||
69 | else if (offset > page->offset) | ||
70 | p = &(*p)->rb_right; | ||
71 | else | ||
72 | return page; | ||
73 | } | ||
74 | |||
75 | rb_link_node(node, parent, p); | ||
76 | |||
77 | return NULL; | ||
78 | } | ||
79 | |||
80 | static inline struct page * rb_insert_page_cache(struct inode * inode, | ||
81 | unsigned long offset, | ||
82 | struct rb_node * node) | ||
83 | { | ||
84 | struct page * ret; | ||
85 | if ((ret = __rb_insert_page_cache(inode, offset, node))) | ||
86 | goto out; | ||
87 | rb_insert_color(node, &inode->i_rb_page_cache); | ||
88 | out: | ||
89 | return ret; | ||
90 | } | ||
91 | ----------------------------------------------------------------------- | ||
92 | */ | ||
93 | |||
94 | #ifndef _LINUX_RBTREE_H | ||
95 | #define _LINUX_RBTREE_H | ||
96 | |||
97 | #include <stddef.h> | ||
98 | |||
99 | /** | ||
100 | * container_of - cast a member of a structure out to the containing structure | ||
101 | * @ptr: the pointer to the member. | ||
102 | * @type: the type of the container struct this is embedded in. | ||
103 | * @member: the name of the member within the struct. | ||
104 | * | ||
105 | */ | ||
106 | #define container_of(ptr, type, member) ({ \ | ||
107 | const typeof( ((type *)0)->member ) *__mptr = (ptr); \ | ||
108 | (type *)( (char *)__mptr - offsetof(type,member) );}) | ||
109 | |||
110 | struct rb_node | ||
111 | { | ||
112 | unsigned long rb_parent_color; | ||
113 | #define RB_RED 0 | ||
114 | #define RB_BLACK 1 | ||
115 | struct rb_node *rb_right; | ||
116 | struct rb_node *rb_left; | ||
117 | } __attribute__((aligned(sizeof(long)))); | ||
118 | /* The alignment might seem pointless, but allegedly CRIS needs it */ | ||
119 | |||
120 | struct rb_root | ||
121 | { | ||
122 | struct rb_node *rb_node; | ||
123 | }; | ||
124 | |||
125 | |||
126 | #define rb_parent(r) ((struct rb_node *)((r)->rb_parent_color & ~3)) | ||
127 | #define rb_color(r) ((r)->rb_parent_color & 1) | ||
128 | #define rb_is_red(r) (!rb_color(r)) | ||
129 | #define rb_is_black(r) rb_color(r) | ||
130 | #define rb_set_red(r) do { (r)->rb_parent_color &= ~1; } while (0) | ||
131 | #define rb_set_black(r) do { (r)->rb_parent_color |= 1; } while (0) | ||
132 | |||
133 | static inline void rb_set_parent(struct rb_node *rb, struct rb_node *p) | ||
134 | { | ||
135 | rb->rb_parent_color = (rb->rb_parent_color & 3) | (unsigned long)p; | ||
136 | } | ||
137 | static inline void rb_set_color(struct rb_node *rb, int color) | ||
138 | { | ||
139 | rb->rb_parent_color = (rb->rb_parent_color & ~1) | color; | ||
140 | } | ||
141 | |||
142 | #define RB_ROOT (struct rb_root) { NULL, } | ||
143 | #define rb_entry(ptr, type, member) container_of(ptr, type, member) | ||
144 | |||
145 | #define RB_EMPTY_ROOT(root) ((root)->rb_node == NULL) | ||
146 | #define RB_EMPTY_NODE(node) (rb_parent(node) == node) | ||
147 | #define RB_CLEAR_NODE(node) (rb_set_parent(node, node)) | ||
148 | |||
149 | extern void rb_insert_color(struct rb_node *, struct rb_root *); | ||
150 | extern void rb_erase(struct rb_node *, struct rb_root *); | ||
151 | |||
152 | /* Find logical next and previous nodes in a tree */ | ||
153 | extern struct rb_node *rb_next(const struct rb_node *); | ||
154 | extern struct rb_node *rb_prev(const struct rb_node *); | ||
155 | extern struct rb_node *rb_first(const struct rb_root *); | ||
156 | extern struct rb_node *rb_last(const struct rb_root *); | ||
157 | |||
158 | /* Fast replacement of a single node without remove/rebalance/add/rebalance */ | ||
159 | extern void rb_replace_node(struct rb_node *victim, struct rb_node *new, | ||
160 | struct rb_root *root); | ||
161 | |||
162 | static inline void rb_link_node(struct rb_node * node, struct rb_node * parent, | ||
163 | struct rb_node ** rb_link) | ||
164 | { | ||
165 | node->rb_parent_color = (unsigned long )parent; | ||
166 | node->rb_left = node->rb_right = NULL; | ||
167 | |||
168 | *rb_link = node; | ||
169 | } | ||
170 | |||
171 | #endif /* _LINUX_RBTREE_H */ | ||
diff --git a/tools/perf/util/strbuf.c b/tools/perf/util/strbuf.c index 464e7ca898cf..5249d5a1b0c2 100644 --- a/tools/perf/util/strbuf.c +++ b/tools/perf/util/strbuf.c | |||
@@ -16,7 +16,7 @@ int prefixcmp(const char *str, const char *prefix) | |||
16 | */ | 16 | */ |
17 | char strbuf_slopbuf[1]; | 17 | char strbuf_slopbuf[1]; |
18 | 18 | ||
19 | void strbuf_init(struct strbuf *sb, size_t hint) | 19 | void strbuf_init(struct strbuf *sb, ssize_t hint) |
20 | { | 20 | { |
21 | sb->alloc = sb->len = 0; | 21 | sb->alloc = sb->len = 0; |
22 | sb->buf = strbuf_slopbuf; | 22 | sb->buf = strbuf_slopbuf; |
@@ -92,7 +92,8 @@ void strbuf_ltrim(struct strbuf *sb) | |||
92 | 92 | ||
93 | void strbuf_tolower(struct strbuf *sb) | 93 | void strbuf_tolower(struct strbuf *sb) |
94 | { | 94 | { |
95 | int i; | 95 | unsigned int i; |
96 | |||
96 | for (i = 0; i < sb->len; i++) | 97 | for (i = 0; i < sb->len; i++) |
97 | sb->buf[i] = tolower(sb->buf[i]); | 98 | sb->buf[i] = tolower(sb->buf[i]); |
98 | } | 99 | } |
@@ -264,7 +265,7 @@ size_t strbuf_fread(struct strbuf *sb, size_t size, FILE *f) | |||
264 | return res; | 265 | return res; |
265 | } | 266 | } |
266 | 267 | ||
267 | ssize_t strbuf_read(struct strbuf *sb, int fd, size_t hint) | 268 | ssize_t strbuf_read(struct strbuf *sb, int fd, ssize_t hint) |
268 | { | 269 | { |
269 | size_t oldlen = sb->len; | 270 | size_t oldlen = sb->len; |
270 | size_t oldalloc = sb->alloc; | 271 | size_t oldalloc = sb->alloc; |
@@ -293,7 +294,7 @@ ssize_t strbuf_read(struct strbuf *sb, int fd, size_t hint) | |||
293 | 294 | ||
294 | #define STRBUF_MAXLINK (2*PATH_MAX) | 295 | #define STRBUF_MAXLINK (2*PATH_MAX) |
295 | 296 | ||
296 | int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint) | 297 | int strbuf_readlink(struct strbuf *sb, const char *path, ssize_t hint) |
297 | { | 298 | { |
298 | size_t oldalloc = sb->alloc; | 299 | size_t oldalloc = sb->alloc; |
299 | 300 | ||
@@ -301,7 +302,7 @@ int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint) | |||
301 | hint = 32; | 302 | hint = 32; |
302 | 303 | ||
303 | while (hint < STRBUF_MAXLINK) { | 304 | while (hint < STRBUF_MAXLINK) { |
304 | int len; | 305 | ssize_t len; |
305 | 306 | ||
306 | strbuf_grow(sb, hint); | 307 | strbuf_grow(sb, hint); |
307 | len = readlink(path, sb->buf, hint); | 308 | len = readlink(path, sb->buf, hint); |
@@ -343,7 +344,7 @@ int strbuf_getline(struct strbuf *sb, FILE *fp, int term) | |||
343 | return 0; | 344 | return 0; |
344 | } | 345 | } |
345 | 346 | ||
346 | int strbuf_read_file(struct strbuf *sb, const char *path, size_t hint) | 347 | int strbuf_read_file(struct strbuf *sb, const char *path, ssize_t hint) |
347 | { | 348 | { |
348 | int fd, len; | 349 | int fd, len; |
349 | 350 | ||
diff --git a/tools/perf/util/strbuf.h b/tools/perf/util/strbuf.h index 9ee908a3ec5d..d2aa86c014c1 100644 --- a/tools/perf/util/strbuf.h +++ b/tools/perf/util/strbuf.h | |||
@@ -50,7 +50,7 @@ struct strbuf { | |||
50 | #define STRBUF_INIT { 0, 0, strbuf_slopbuf } | 50 | #define STRBUF_INIT { 0, 0, strbuf_slopbuf } |
51 | 51 | ||
52 | /*----- strbuf life cycle -----*/ | 52 | /*----- strbuf life cycle -----*/ |
53 | extern void strbuf_init(struct strbuf *, size_t); | 53 | extern void strbuf_init(struct strbuf *buf, ssize_t hint); |
54 | extern void strbuf_release(struct strbuf *); | 54 | extern void strbuf_release(struct strbuf *); |
55 | extern char *strbuf_detach(struct strbuf *, size_t *); | 55 | extern char *strbuf_detach(struct strbuf *, size_t *); |
56 | extern void strbuf_attach(struct strbuf *, void *, size_t, size_t); | 56 | extern void strbuf_attach(struct strbuf *, void *, size_t, size_t); |
@@ -61,7 +61,7 @@ static inline void strbuf_swap(struct strbuf *a, struct strbuf *b) { | |||
61 | } | 61 | } |
62 | 62 | ||
63 | /*----- strbuf size related -----*/ | 63 | /*----- strbuf size related -----*/ |
64 | static inline size_t strbuf_avail(const struct strbuf *sb) { | 64 | static inline ssize_t strbuf_avail(const struct strbuf *sb) { |
65 | return sb->alloc ? sb->alloc - sb->len - 1 : 0; | 65 | return sb->alloc ? sb->alloc - sb->len - 1 : 0; |
66 | } | 66 | } |
67 | 67 | ||
@@ -122,9 +122,9 @@ extern void strbuf_addf(struct strbuf *sb, const char *fmt, ...); | |||
122 | 122 | ||
123 | extern size_t strbuf_fread(struct strbuf *, size_t, FILE *); | 123 | extern size_t strbuf_fread(struct strbuf *, size_t, FILE *); |
124 | /* XXX: if read fails, any partial read is undone */ | 124 | /* XXX: if read fails, any partial read is undone */ |
125 | extern ssize_t strbuf_read(struct strbuf *, int fd, size_t hint); | 125 | extern ssize_t strbuf_read(struct strbuf *, int fd, ssize_t hint); |
126 | extern int strbuf_read_file(struct strbuf *sb, const char *path, size_t hint); | 126 | extern int strbuf_read_file(struct strbuf *sb, const char *path, ssize_t hint); |
127 | extern int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint); | 127 | extern int strbuf_readlink(struct strbuf *sb, const char *path, ssize_t hint); |
128 | 128 | ||
129 | extern int strbuf_getline(struct strbuf *, FILE *, int); | 129 | extern int strbuf_getline(struct strbuf *, FILE *, int); |
130 | 130 | ||
diff --git a/tools/perf/util/strlist.h b/tools/perf/util/strlist.h index 2fb117fb4b67..2fdcfee87586 100644 --- a/tools/perf/util/strlist.h +++ b/tools/perf/util/strlist.h | |||
@@ -1,7 +1,7 @@ | |||
1 | #ifndef STRLIST_H_ | 1 | #ifndef STRLIST_H_ |
2 | #define STRLIST_H_ | 2 | #define STRLIST_H_ |
3 | 3 | ||
4 | #include "rbtree.h" | 4 | #include <linux/rbtree.h> |
5 | #include <stdbool.h> | 5 | #include <stdbool.h> |
6 | 6 | ||
7 | struct str_node { | 7 | struct str_node { |
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index 78c2efde01b7..4683b67b5ee4 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
@@ -35,7 +35,7 @@ static struct symbol *symbol__new(u64 start, u64 len, | |||
35 | self = ((void *)self) + priv_size; | 35 | self = ((void *)self) + priv_size; |
36 | } | 36 | } |
37 | self->start = start; | 37 | self->start = start; |
38 | self->end = start + len - 1; | 38 | self->end = len ? start + len - 1 : start; |
39 | memcpy(self->name, name, namelen); | 39 | memcpy(self->name, name, namelen); |
40 | 40 | ||
41 | return self; | 41 | return self; |
@@ -48,8 +48,12 @@ static void symbol__delete(struct symbol *self, unsigned int priv_size) | |||
48 | 48 | ||
49 | static size_t symbol__fprintf(struct symbol *self, FILE *fp) | 49 | static size_t symbol__fprintf(struct symbol *self, FILE *fp) |
50 | { | 50 | { |
51 | return fprintf(fp, " %llx-%llx %s\n", | 51 | if (!self->module) |
52 | return fprintf(fp, " %llx-%llx %s\n", | ||
52 | self->start, self->end, self->name); | 53 | self->start, self->end, self->name); |
54 | else | ||
55 | return fprintf(fp, " %llx-%llx %s \t[%s]\n", | ||
56 | self->start, self->end, self->name, self->module->name); | ||
53 | } | 57 | } |
54 | 58 | ||
55 | struct dso *dso__new(const char *name, unsigned int sym_priv_size) | 59 | struct dso *dso__new(const char *name, unsigned int sym_priv_size) |
@@ -146,6 +150,7 @@ static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter, int verb | |||
146 | char *line = NULL; | 150 | char *line = NULL; |
147 | size_t n; | 151 | size_t n; |
148 | FILE *file = fopen("/proc/kallsyms", "r"); | 152 | FILE *file = fopen("/proc/kallsyms", "r"); |
153 | int count = 0; | ||
149 | 154 | ||
150 | if (file == NULL) | 155 | if (file == NULL) |
151 | goto out_failure; | 156 | goto out_failure; |
@@ -188,8 +193,10 @@ static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter, int verb | |||
188 | 193 | ||
189 | if (filter && filter(self, sym)) | 194 | if (filter && filter(self, sym)) |
190 | symbol__delete(sym, self->sym_priv_size); | 195 | symbol__delete(sym, self->sym_priv_size); |
191 | else | 196 | else { |
192 | dso__insert_symbol(self, sym); | 197 | dso__insert_symbol(self, sym); |
198 | count++; | ||
199 | } | ||
193 | } | 200 | } |
194 | 201 | ||
195 | /* | 202 | /* |
@@ -212,7 +219,7 @@ static int dso__load_kallsyms(struct dso *self, symbol_filter_t filter, int verb | |||
212 | free(line); | 219 | free(line); |
213 | fclose(file); | 220 | fclose(file); |
214 | 221 | ||
215 | return 0; | 222 | return count; |
216 | 223 | ||
217 | out_delete_line: | 224 | out_delete_line: |
218 | free(line); | 225 | free(line); |
@@ -307,6 +314,26 @@ static inline int elf_sym__is_function(const GElf_Sym *sym) | |||
307 | sym->st_size != 0; | 314 | sym->st_size != 0; |
308 | } | 315 | } |
309 | 316 | ||
317 | static inline int elf_sym__is_label(const GElf_Sym *sym) | ||
318 | { | ||
319 | return elf_sym__type(sym) == STT_NOTYPE && | ||
320 | sym->st_name != 0 && | ||
321 | sym->st_shndx != SHN_UNDEF && | ||
322 | sym->st_shndx != SHN_ABS; | ||
323 | } | ||
324 | |||
325 | static inline const char *elf_sec__name(const GElf_Shdr *shdr, | ||
326 | const Elf_Data *secstrs) | ||
327 | { | ||
328 | return secstrs->d_buf + shdr->sh_name; | ||
329 | } | ||
330 | |||
331 | static inline int elf_sec__is_text(const GElf_Shdr *shdr, | ||
332 | const Elf_Data *secstrs) | ||
333 | { | ||
334 | return strstr(elf_sec__name(shdr, secstrs), "text") != NULL; | ||
335 | } | ||
336 | |||
310 | static inline const char *elf_sym__name(const GElf_Sym *sym, | 337 | static inline const char *elf_sym__name(const GElf_Sym *sym, |
311 | const Elf_Data *symstrs) | 338 | const Elf_Data *symstrs) |
312 | { | 339 | { |
@@ -448,9 +475,9 @@ static int dso__synthesize_plt_symbols(struct dso *self, Elf *elf, | |||
448 | } | 475 | } |
449 | 476 | ||
450 | static int dso__load_sym(struct dso *self, int fd, const char *name, | 477 | static int dso__load_sym(struct dso *self, int fd, const char *name, |
451 | symbol_filter_t filter, int verbose) | 478 | symbol_filter_t filter, int verbose, struct module *mod) |
452 | { | 479 | { |
453 | Elf_Data *symstrs; | 480 | Elf_Data *symstrs, *secstrs; |
454 | uint32_t nr_syms; | 481 | uint32_t nr_syms; |
455 | int err = -1; | 482 | int err = -1; |
456 | uint32_t index; | 483 | uint32_t index; |
@@ -458,7 +485,7 @@ static int dso__load_sym(struct dso *self, int fd, const char *name, | |||
458 | GElf_Shdr shdr; | 485 | GElf_Shdr shdr; |
459 | Elf_Data *syms; | 486 | Elf_Data *syms; |
460 | GElf_Sym sym; | 487 | GElf_Sym sym; |
461 | Elf_Scn *sec, *sec_dynsym; | 488 | Elf_Scn *sec, *sec_dynsym, *sec_strndx; |
462 | Elf *elf; | 489 | Elf *elf; |
463 | size_t dynsym_idx; | 490 | size_t dynsym_idx; |
464 | int nr = 0; | 491 | int nr = 0; |
@@ -517,17 +544,29 @@ static int dso__load_sym(struct dso *self, int fd, const char *name, | |||
517 | if (symstrs == NULL) | 544 | if (symstrs == NULL) |
518 | goto out_elf_end; | 545 | goto out_elf_end; |
519 | 546 | ||
547 | sec_strndx = elf_getscn(elf, ehdr.e_shstrndx); | ||
548 | if (sec_strndx == NULL) | ||
549 | goto out_elf_end; | ||
550 | |||
551 | secstrs = elf_getdata(sec_strndx, NULL); | ||
552 | if (symstrs == NULL) | ||
553 | goto out_elf_end; | ||
554 | |||
520 | nr_syms = shdr.sh_size / shdr.sh_entsize; | 555 | nr_syms = shdr.sh_size / shdr.sh_entsize; |
521 | 556 | ||
522 | memset(&sym, 0, sizeof(sym)); | 557 | memset(&sym, 0, sizeof(sym)); |
523 | self->prelinked = elf_section_by_name(elf, &ehdr, &shdr, | 558 | self->adjust_symbols = (ehdr.e_type == ET_EXEC || |
524 | ".gnu.prelink_undo", | 559 | elf_section_by_name(elf, &ehdr, &shdr, |
525 | NULL) != NULL; | 560 | ".gnu.prelink_undo", |
561 | NULL) != NULL); | ||
526 | elf_symtab__for_each_symbol(syms, nr_syms, index, sym) { | 562 | elf_symtab__for_each_symbol(syms, nr_syms, index, sym) { |
527 | struct symbol *f; | 563 | struct symbol *f; |
528 | u64 obj_start; | 564 | u64 obj_start; |
565 | struct section *section = NULL; | ||
566 | int is_label = elf_sym__is_label(&sym); | ||
567 | const char *section_name; | ||
529 | 568 | ||
530 | if (!elf_sym__is_function(&sym)) | 569 | if (!is_label && !elf_sym__is_function(&sym)) |
531 | continue; | 570 | continue; |
532 | 571 | ||
533 | sec = elf_getscn(elf, sym.st_shndx); | 572 | sec = elf_getscn(elf, sym.st_shndx); |
@@ -535,9 +574,14 @@ static int dso__load_sym(struct dso *self, int fd, const char *name, | |||
535 | goto out_elf_end; | 574 | goto out_elf_end; |
536 | 575 | ||
537 | gelf_getshdr(sec, &shdr); | 576 | gelf_getshdr(sec, &shdr); |
577 | |||
578 | if (is_label && !elf_sec__is_text(&shdr, secstrs)) | ||
579 | continue; | ||
580 | |||
581 | section_name = elf_sec__name(&shdr, secstrs); | ||
538 | obj_start = sym.st_value; | 582 | obj_start = sym.st_value; |
539 | 583 | ||
540 | if (self->prelinked) { | 584 | if (self->adjust_symbols) { |
541 | if (verbose >= 2) | 585 | if (verbose >= 2) |
542 | printf("adjusting symbol: st_value: %Lx sh_addr: %Lx sh_offset: %Lx\n", | 586 | printf("adjusting symbol: st_value: %Lx sh_addr: %Lx sh_offset: %Lx\n", |
543 | (u64)sym.st_value, (u64)shdr.sh_addr, (u64)shdr.sh_offset); | 587 | (u64)sym.st_value, (u64)shdr.sh_addr, (u64)shdr.sh_offset); |
@@ -545,6 +589,17 @@ static int dso__load_sym(struct dso *self, int fd, const char *name, | |||
545 | sym.st_value -= shdr.sh_addr - shdr.sh_offset; | 589 | sym.st_value -= shdr.sh_addr - shdr.sh_offset; |
546 | } | 590 | } |
547 | 591 | ||
592 | if (mod) { | ||
593 | section = mod->sections->find_section(mod->sections, section_name); | ||
594 | if (section) | ||
595 | sym.st_value += section->vma; | ||
596 | else { | ||
597 | fprintf(stderr, "dso__load_sym() module %s lookup of %s failed\n", | ||
598 | mod->name, section_name); | ||
599 | goto out_elf_end; | ||
600 | } | ||
601 | } | ||
602 | |||
548 | f = symbol__new(sym.st_value, sym.st_size, | 603 | f = symbol__new(sym.st_value, sym.st_size, |
549 | elf_sym__name(&sym, symstrs), | 604 | elf_sym__name(&sym, symstrs), |
550 | self->sym_priv_size, obj_start, verbose); | 605 | self->sym_priv_size, obj_start, verbose); |
@@ -554,6 +609,7 @@ static int dso__load_sym(struct dso *self, int fd, const char *name, | |||
554 | if (filter && filter(self, f)) | 609 | if (filter && filter(self, f)) |
555 | symbol__delete(f, self->sym_priv_size); | 610 | symbol__delete(f, self->sym_priv_size); |
556 | else { | 611 | else { |
612 | f->module = mod; | ||
557 | dso__insert_symbol(self, f); | 613 | dso__insert_symbol(self, f); |
558 | nr++; | 614 | nr++; |
559 | } | 615 | } |
@@ -577,7 +633,7 @@ int dso__load(struct dso *self, symbol_filter_t filter, int verbose) | |||
577 | if (!name) | 633 | if (!name) |
578 | return -1; | 634 | return -1; |
579 | 635 | ||
580 | self->prelinked = 0; | 636 | self->adjust_symbols = 0; |
581 | 637 | ||
582 | if (strncmp(self->name, "/tmp/perf-", 10) == 0) | 638 | if (strncmp(self->name, "/tmp/perf-", 10) == 0) |
583 | return dso__load_perf_map(self, filter, verbose); | 639 | return dso__load_perf_map(self, filter, verbose); |
@@ -603,7 +659,7 @@ more: | |||
603 | fd = open(name, O_RDONLY); | 659 | fd = open(name, O_RDONLY); |
604 | } while (fd < 0); | 660 | } while (fd < 0); |
605 | 661 | ||
606 | ret = dso__load_sym(self, fd, name, filter, verbose); | 662 | ret = dso__load_sym(self, fd, name, filter, verbose, NULL); |
607 | close(fd); | 663 | close(fd); |
608 | 664 | ||
609 | /* | 665 | /* |
@@ -617,6 +673,86 @@ out: | |||
617 | return ret; | 673 | return ret; |
618 | } | 674 | } |
619 | 675 | ||
676 | static int dso__load_module(struct dso *self, struct mod_dso *mods, const char *name, | ||
677 | symbol_filter_t filter, int verbose) | ||
678 | { | ||
679 | struct module *mod = mod_dso__find_module(mods, name); | ||
680 | int err = 0, fd; | ||
681 | |||
682 | if (mod == NULL || !mod->active) | ||
683 | return err; | ||
684 | |||
685 | fd = open(mod->path, O_RDONLY); | ||
686 | |||
687 | if (fd < 0) | ||
688 | return err; | ||
689 | |||
690 | err = dso__load_sym(self, fd, name, filter, verbose, mod); | ||
691 | close(fd); | ||
692 | |||
693 | return err; | ||
694 | } | ||
695 | |||
696 | int dso__load_modules(struct dso *self, symbol_filter_t filter, int verbose) | ||
697 | { | ||
698 | struct mod_dso *mods = mod_dso__new_dso("modules"); | ||
699 | struct module *pos; | ||
700 | struct rb_node *next; | ||
701 | int err; | ||
702 | |||
703 | err = mod_dso__load_modules(mods); | ||
704 | |||
705 | if (err <= 0) | ||
706 | return err; | ||
707 | |||
708 | /* | ||
709 | * Iterate over modules, and load active symbols. | ||
710 | */ | ||
711 | next = rb_first(&mods->mods); | ||
712 | while (next) { | ||
713 | pos = rb_entry(next, struct module, rb_node); | ||
714 | err = dso__load_module(self, mods, pos->name, filter, verbose); | ||
715 | |||
716 | if (err < 0) | ||
717 | break; | ||
718 | |||
719 | next = rb_next(&pos->rb_node); | ||
720 | } | ||
721 | |||
722 | if (err < 0) { | ||
723 | mod_dso__delete_modules(mods); | ||
724 | mod_dso__delete_self(mods); | ||
725 | } | ||
726 | |||
727 | return err; | ||
728 | } | ||
729 | |||
730 | static inline void dso__fill_symbol_holes(struct dso *self) | ||
731 | { | ||
732 | struct symbol *prev = NULL; | ||
733 | struct rb_node *nd; | ||
734 | |||
735 | for (nd = rb_last(&self->syms); nd; nd = rb_prev(nd)) { | ||
736 | struct symbol *pos = rb_entry(nd, struct symbol, rb_node); | ||
737 | |||
738 | if (prev) { | ||
739 | u64 hole = 0; | ||
740 | int alias = pos->start == prev->start; | ||
741 | |||
742 | if (!alias) | ||
743 | hole = prev->start - pos->end - 1; | ||
744 | |||
745 | if (hole || alias) { | ||
746 | if (alias) | ||
747 | pos->end = prev->end; | ||
748 | else if (hole) | ||
749 | pos->end = prev->start - 1; | ||
750 | } | ||
751 | } | ||
752 | prev = pos; | ||
753 | } | ||
754 | } | ||
755 | |||
620 | static int dso__load_vmlinux(struct dso *self, const char *vmlinux, | 756 | static int dso__load_vmlinux(struct dso *self, const char *vmlinux, |
621 | symbol_filter_t filter, int verbose) | 757 | symbol_filter_t filter, int verbose) |
622 | { | 758 | { |
@@ -625,21 +761,28 @@ static int dso__load_vmlinux(struct dso *self, const char *vmlinux, | |||
625 | if (fd < 0) | 761 | if (fd < 0) |
626 | return -1; | 762 | return -1; |
627 | 763 | ||
628 | err = dso__load_sym(self, fd, vmlinux, filter, verbose); | 764 | err = dso__load_sym(self, fd, vmlinux, filter, verbose, NULL); |
765 | |||
766 | if (err > 0) | ||
767 | dso__fill_symbol_holes(self); | ||
768 | |||
629 | close(fd); | 769 | close(fd); |
630 | 770 | ||
631 | return err; | 771 | return err; |
632 | } | 772 | } |
633 | 773 | ||
634 | int dso__load_kernel(struct dso *self, const char *vmlinux, | 774 | int dso__load_kernel(struct dso *self, const char *vmlinux, |
635 | symbol_filter_t filter, int verbose) | 775 | symbol_filter_t filter, int verbose, int modules) |
636 | { | 776 | { |
637 | int err = -1; | 777 | int err = -1; |
638 | 778 | ||
639 | if (vmlinux) | 779 | if (vmlinux) { |
640 | err = dso__load_vmlinux(self, vmlinux, filter, verbose); | 780 | err = dso__load_vmlinux(self, vmlinux, filter, verbose); |
781 | if (err > 0 && modules) | ||
782 | err = dso__load_modules(self, filter, verbose); | ||
783 | } | ||
641 | 784 | ||
642 | if (err < 0) | 785 | if (err <= 0) |
643 | err = dso__load_kallsyms(self, filter, verbose); | 786 | err = dso__load_kallsyms(self, filter, verbose); |
644 | 787 | ||
645 | return err; | 788 | return err; |
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index 2c48ace8203b..7918cffb23cd 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h | |||
@@ -3,8 +3,9 @@ | |||
3 | 3 | ||
4 | #include <linux/types.h> | 4 | #include <linux/types.h> |
5 | #include "types.h" | 5 | #include "types.h" |
6 | #include "list.h" | 6 | #include <linux/list.h> |
7 | #include "rbtree.h" | 7 | #include <linux/rbtree.h> |
8 | #include "module.h" | ||
8 | 9 | ||
9 | struct symbol { | 10 | struct symbol { |
10 | struct rb_node rb_node; | 11 | struct rb_node rb_node; |
@@ -13,6 +14,7 @@ struct symbol { | |||
13 | u64 obj_start; | 14 | u64 obj_start; |
14 | u64 hist_sum; | 15 | u64 hist_sum; |
15 | u64 *hist; | 16 | u64 *hist; |
17 | struct module *module; | ||
16 | void *priv; | 18 | void *priv; |
17 | char name[0]; | 19 | char name[0]; |
18 | }; | 20 | }; |
@@ -22,7 +24,7 @@ struct dso { | |||
22 | struct rb_root syms; | 24 | struct rb_root syms; |
23 | struct symbol *(*find_symbol)(struct dso *, u64 ip); | 25 | struct symbol *(*find_symbol)(struct dso *, u64 ip); |
24 | unsigned int sym_priv_size; | 26 | unsigned int sym_priv_size; |
25 | unsigned char prelinked; | 27 | unsigned char adjust_symbols; |
26 | char name[0]; | 28 | char name[0]; |
27 | }; | 29 | }; |
28 | 30 | ||
@@ -41,7 +43,8 @@ static inline void *dso__sym_priv(struct dso *self, struct symbol *sym) | |||
41 | struct symbol *dso__find_symbol(struct dso *self, u64 ip); | 43 | struct symbol *dso__find_symbol(struct dso *self, u64 ip); |
42 | 44 | ||
43 | int dso__load_kernel(struct dso *self, const char *vmlinux, | 45 | int dso__load_kernel(struct dso *self, const char *vmlinux, |
44 | symbol_filter_t filter, int verbose); | 46 | symbol_filter_t filter, int verbose, int modules); |
47 | int dso__load_modules(struct dso *self, symbol_filter_t filter, int verbose); | ||
45 | int dso__load(struct dso *self, symbol_filter_t filter, int verbose); | 48 | int dso__load(struct dso *self, symbol_filter_t filter, int verbose); |
46 | 49 | ||
47 | size_t dso__fprintf(struct dso *self, FILE *fp); | 50 | size_t dso__fprintf(struct dso *self, FILE *fp); |
diff --git a/tools/perf/util/wrapper.c b/tools/perf/util/wrapper.c index 6350d65f6d9e..4574ac28396f 100644 --- a/tools/perf/util/wrapper.c +++ b/tools/perf/util/wrapper.c | |||
@@ -7,7 +7,7 @@ | |||
7 | * There's no pack memory to release - but stay close to the Git | 7 | * There's no pack memory to release - but stay close to the Git |
8 | * version so wrap this away: | 8 | * version so wrap this away: |
9 | */ | 9 | */ |
10 | static inline void release_pack_memory(size_t size, int flag) | 10 | static inline void release_pack_memory(size_t size __used, int flag __used) |
11 | { | 11 | { |
12 | } | 12 | } |
13 | 13 | ||
@@ -59,7 +59,8 @@ void *xmemdupz(const void *data, size_t len) | |||
59 | char *xstrndup(const char *str, size_t len) | 59 | char *xstrndup(const char *str, size_t len) |
60 | { | 60 | { |
61 | char *p = memchr(str, '\0', len); | 61 | char *p = memchr(str, '\0', len); |
62 | return xmemdupz(str, p ? p - str : len); | 62 | |
63 | return xmemdupz(str, p ? (size_t)(p - str) : len); | ||
63 | } | 64 | } |
64 | 65 | ||
65 | void *xrealloc(void *ptr, size_t size) | 66 | void *xrealloc(void *ptr, size_t size) |